text: 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_react=require("react"),_react2=_interopRequireDefault(_react),_propTypes=require("prop-types"),_propTypes2=_interopRequireDefault(_propTypes);function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&("object"==typeof b||"function"==typeof b)?b:a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var DEFAULT_STYLE={width:"400px",height:"228px"},AMAZON_CONSENT_WIDGET_DIV_ID="consentWidgetDiv",ConsentWidget=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.onReady=c.onReady.bind(c),c.onConsent=c.onConsent.bind(c),c.onError=c.onError.bind(c),c}return _inherits(b,a),_createClass(b,[{key:"componentDidMount",value:function(){var a=this.props,c=a.sellerId,d=a.onReady,e=a.language,f=a.onConsent,g=a.onError,h=a.amazonBillingAgreementId,i=a.style;new OffAmazonPayments.Widgets.Consent({sellerId:c,amazonBillingAgreementId:h,design:{size:b.getStyle(i)},onReady:d,language:e,onConsent:f,onError:g}).bind(AMAZON_CONSENT_WIDGET_DIV_ID)}},{key:"onReady",value:function a(b){var a=this.props.onReady;a&&a(b.getConsentStatus())}},{key:"onConsent",value:function a(b){var a=this.props.onConsent;a&&a(b.getConsentStatus())}},{key:"onError",value:function a(b){var a=this.props.onError;a&&a(b)}},{key:"render",value:function(){var a=this.props.style;return _react2.default.createElement("div",{id:AMAZON_CONSENT_WIDGET_DIV_ID,style:b.getStyle(a)})}}]),b}(_react.PureComponent);ConsentWidget.getStyle=function(a){return"object"===("undefined"==typeof a?"undefined":_typeof(a))?a:DEFAULT_STYLE},ConsentWidget.propTypes={amazonBillingAgreementId:_propTypes2.default.string.isRequired,sellerId:_propTypes2.default.string.isRequired,language:_propTypes2.default.string,style:_propTypes2.default.object,onReady:_propTypes2.default.func,onConsent:_propTypes2.default.func,onError:_propTypes2.default.func},exports.default=ConsentWidget;