@paydock/client-sdk 1.10.82-beta → 1.10.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bundles/widget.umd.js +6 -5
- package/bundles/widget.umd.min.js +1 -1
- package/lib/checkout-button/zipmoney.runner.js +2 -1
- package/lib/checkout-button/zipmoney.runner.js.map +1 -1
- package/lib/components/param.d.ts +2 -0
- package/lib/components/param.js.map +1 -1
- package/lib/payment-source-widget/payment-source-widget.d.ts +1 -1
- package/lib/payment-source-widget/payment-source-widget.js +3 -2
- package/lib/payment-source-widget/payment-source-widget.js.map +1 -1
- package/lib/wallet-buttons/flypay.wallet-service.js +2 -2
- package/lib/wallet-buttons/flypay.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/wallet-buttons.js +1 -1
- package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
- package/lib/wallet-buttons/wallet-service.d.ts +1 -0
- package/lib/wallet-buttons/wallet-service.js.map +1 -1
- package/package.json +1 -1
- package/slate.md +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The SDK supports methods for customization of widget by your needs (styling, for
|
|
|
8
8
|
|
|
9
9
|
## Other information
|
|
10
10
|
|
|
11
|
-
To work with the widget you will need public_key ([see Authentication](https://docs.paydock.com/#authentication))
|
|
11
|
+
To work with the widget you will need public_key or access_token ([see Authentication](https://docs.paydock.com/#authentication))
|
|
12
12
|
|
|
13
13
|
Also you will need added gateway ([see API Reference by gateway](https://docs.paydock.com/#gateways))
|
|
14
14
|
|
package/bundles/widget.umd.js
CHANGED
|
@@ -3981,7 +3981,7 @@
|
|
|
3981
3981
|
this.background.clear();
|
|
3982
3982
|
this.checkout = checkoutData;
|
|
3983
3983
|
var checkoutLink = String(ECHO_LINK);
|
|
3984
|
-
checkoutLink = Url.extendSearchParams(checkoutLink, 'public_key', this.publicKey);
|
|
3984
|
+
checkoutLink = Url.extendSearchParams(checkoutLink, AccessToken.validateJWT(this.publicKey) ? 'access_token' : 'public_key', this.publicKey);
|
|
3985
3985
|
checkoutLink = Url.extendSearchParams(checkoutLink, 'json_body', encodeURIComponent(JSON.stringify({
|
|
3986
3986
|
redirect_uri: this.checkout.link
|
|
3987
3987
|
})));
|
|
@@ -5060,12 +5060,13 @@
|
|
|
5060
5060
|
currency = meta.currency,
|
|
5061
5061
|
id = meta.id,
|
|
5062
5062
|
gateway_mode = meta.gateway_mode,
|
|
5063
|
+
reference = meta.reference,
|
|
5063
5064
|
request_shipping = meta.request_shipping;
|
|
5064
5065
|
|
|
5065
5066
|
_this.link.setParams(_extends({ token: token,
|
|
5066
5067
|
amount: amount,
|
|
5067
5068
|
currency: currency,
|
|
5068
|
-
gateway_mode: gateway_mode, credentials: id }, request_shipping ? { request_shipping: request_shipping } : {}));
|
|
5069
|
+
gateway_mode: gateway_mode, credentials: reference || id }, request_shipping ? { request_shipping: request_shipping } : {}));
|
|
5069
5070
|
_this.token = token;
|
|
5070
5071
|
_this.event = new FlypayIframeEvent(window);
|
|
5071
5072
|
return _this;
|
|
@@ -6493,7 +6494,7 @@
|
|
|
6493
6494
|
this.service = new StripeWalletService(tokenMeta.credentials.client_auth, _extends(_extends({}, meta), { amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency }));
|
|
6494
6495
|
break;
|
|
6495
6496
|
case WALLET_GATEWAY.FLYPAY:
|
|
6496
|
-
this.service = new FlypayWalletService(chargeToken, _extends(_extends({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency }));
|
|
6497
|
+
this.service = new FlypayWalletService(chargeToken, _extends(_extends({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, reference: tokenMeta.charge.reference }));
|
|
6497
6498
|
break;
|
|
6498
6499
|
case WALLET_GATEWAY.PAYPAL:
|
|
6499
6500
|
this.service = new PaypalWalletService(tokenMeta.credentials.client_auth, _extends(_extends({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, capture: tokenMeta.charge.capture }));
|
|
@@ -6915,13 +6916,13 @@
|
|
|
6915
6916
|
* var widget = new PaymentSourceWidget('publicKey', customerReference, true);
|
|
6916
6917
|
**/
|
|
6917
6918
|
var PaymentSourceWidget = function () {
|
|
6918
|
-
function PaymentSourceWidget(
|
|
6919
|
+
function PaymentSourceWidget(accessToken, queryToken) {
|
|
6919
6920
|
classCallCheck(this, PaymentSourceWidget);
|
|
6920
6921
|
|
|
6921
6922
|
this.configs = [];
|
|
6922
6923
|
this.configTokens = [];
|
|
6923
6924
|
this.link = new Link(PAYMENT_SOURCE_LINK);
|
|
6924
|
-
this.link.setParams({
|
|
6925
|
+
this.link.setParams(_extends({ query_token: queryToken }, AccessToken.validateJWT(accessToken) ? { access_token: accessToken } : { public_key: accessToken }));
|
|
6925
6926
|
}
|
|
6926
6927
|
/**
|
|
6927
6928
|
* Object contain styles for widget
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).paydock={})}(this,function(e){"use strict";function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e};function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:a(o,t,n)}if("value"in i)return i.value;var r=i.get;return void 0!==r?r.call(n):void 0}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&s.return&&s.return()}finally{if(o)throw r}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},u="x-access-token",d="x-user-public-key",h=(t(p,null,[{key:"validateJWT",value:function(e){if(!e)return null;var t=e.split("."),n=s(t,3),i=n[0],o=n[1],r=n[2];if(!i||!o||!r)return null;if(2+i.length+o.length+r.length!==e.length)return null;try{return{head:JSON.parse(atob(i)),body:JSON.parse(atob(o)),signature:r}}catch(e){return null}}},{key:"extractData",value:function(e){try{return JSON.parse(atob(e.meta))}catch(e){return null}}},{key:"extractMeta",value:function(e){try{return JSON.parse(atob(e.meta)).meta}catch(e){return null}}},{key:"getAccessHeaderNameByToken",value:function(e){return p.validateJWT(e)?u:d}}]),p);function p(){l(this,p)}var f="sandbox",v="sandbox-kovena",m="sandbox-demo",y="sandbox-demo-kovena",g="production",_="staging",k="staging_2",E="staging_3",b="staging_4",w="staging_5",S=[v,y],C=f,O="paydock.com",T="kovena.com",P=(t(R,[{key:"setEnv",value:function(e,t){if(!this.isValidMode(this.configs,e))throw new Error("unknown env: "+e);if(this.env=e,t&&!t.match("^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$"))throw new Error("invalid: "+t);t?this.alias=t:-1!==S.indexOf(this.env)?this.alias=T:this.alias=O}},{key:"getEnv",value:function(){return this.env}},{key:"getConf",value:function(){for(var e in this.configs)if(this.configs.hasOwnProperty(e)&&this.configs[e].env===this.getEnv())return{url:-1!==this.configs[e].url.indexOf("localhost")?this.configs[e].url:this.configs[e].url+this.alias,env:this.configs[e].env};throw new Error("invalid env")}},{key:"isValidMode",value:function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].env===t)return!0;return!1}}]),R);function R(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:C;l(this,R),this.configs=e,this.setEnv(t)}var x=(t(I,null,[{key:"extendSearchParams",value:function(e,t,n){return e.replace(new RegExp("([?&]"+t+"(?=[=&#]|$)[^#&]*|(?=#|$))"),"&"+t+"="+encodeURIComponent(n)).replace(/^([^?&]+)&/,"$1?")}}]),I);function I(){l(this,I)}var L=(t(N,null,[{key:"generate",value:function(){if("undefined"==typeof window||void 0===window.crypto||void 0===window.crypto.getRandomValues)return this.random()+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+this.random()+this.random();var e=new Uint16Array(8);return window.crypto.getRandomValues(e),this.hash(e[0])+this.hash(e[1])+"-"+this.hash(e[2])+"-"+this.hash(e[3])+"-"+this.hash(e[4])+"-"+this.hash(e[5])+this.hash(e[6])+this.hash(e[7])}},{key:"hash",value:function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t}},{key:"random",value:function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}]),N);function N(){l(this,N)}var D="/wallet/flypay",U=(t(M,[{key:"getNetUrl",value:function(){return this.env.getConf().url+this.linkResource}},{key:"getUrl",value:function(){var e=this.getNetUrl(),t=this.getParams();for(var n in t)t.hasOwnProperty(n)&&(e=x.extendSearchParams(e,n,t[n]));return e}},{key:"setParams",value:function(e){this.params=A({},this.params,e)}},{key:"concatParams",value:function(e){for(var t in e)e.hasOwnProperty(t)&&e[t].length&&("string"!=typeof this.params[t]&&(this.params[t]=""),this.params[t].length?this.params[t]+=","+e[t]:this.params[t]+=e[t])}},{key:"getParams",value:function(){return this.params}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}}]),M);function M(e){l(this,M),this.params={},this.widgetId=L.generate(),this.linkResource=e,this.env=new P([{env:v,url:"https://widget-sandbox."},{env:m,url:"https://widget-sandbox-demo."},{env:y,url:"https://widget-sandbox-demo."},{env:f,url:"https://widget-sandbox."},{env:g,url:"https://widget."},{env:_,url:"https://widsta."},{env:k,url:"https://widsta-2."},{env:E,url:"https://widsta-3."},{env:b,url:"https://widsta-4."},{env:w,url:"https://widsta-5."}]),this.setParams({widget_id:this.widgetId})}var j=(t(F,null,[{key:"values",value:function(t){return Object.keys(t).map(function(e){return t[e]})}}]),F);function F(){l(this,F)}var H,B,z,q,W={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},V={CARD_NAME:"card_name",CARD_NUMBER:"card_number",EXPIRE_MONTH:"expire_month",EXPIRE_YEAR:"expire_year",CARD_CCV:"card_ccv",ACCOUNT_NAME:"account_name",ACCOUNT_BSB:"account_bsb",ACCOUNT_NUMBER:"account_number",ACCOUNT_ROUTING:"account_routing",ACCOUNT_HOLDER_TYPE:"account_holder_type",ACCOUNT_BANK_NAME:"account_bank_name",ACCOUNT_TYPE:"account_type",FIRST_NAME:"first_name",LAST_NAME:"last_name",EMAIL:"email",PHONE:"phone",PHONE2:"phone2",ADDRESS_LINE1:"address_line1",ADDRESS_LINE2:"address_line2",ADDRESS_STATE:"address_state",ADDRESS_COUNTRY:"address_country",ADDRESS_CITY:"address_city",ADDRESS_POSTCODE:"address_postcode",ADDRESS_COMPANY:"address_company"},Y={BACKGROUND_COLOR:"background_color",BACKGROUND_ACTIVE_COLOR:"background_active_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",ICON_SIZE:"icon_size",BUTTON_COLOR:"button_color",ERROR_COLOR:"error_color",SUCCESS_COLOR:"success_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},K={TITLE:"title",TITLE_H1:"title_h1",TITLE_H2:"title_h2",TITLE_H3:"title_h3",TITLE_H4:"title_h4",TITLE_H5:"title_h5",TITLE_H6:"title_h6",FINISH:"finish_text",TITLE_DESCRIPTION:"title_description",SUBMIT_BUTTON:"submit_button",SUBMIT_BUTTON_PROCESSING:"submit_button_processing"},J={SUBMIT_BUTTON:"submit_button",TABS:"tabs"},X={AMEX:"amex",AUSBC:"ausbc",DINERS:"diners",DISCOVER:"discover",JAPCB:"japcb",LASER:"laser",MASTERCARD:"mastercard",SOLO:"solo",VISA:"visa",VISA_WHITE:"visa_white"},Z=[].concat(["brand_name","cart_border_color","reference","email","hdr_img","logo_img","pay_flow_color","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone","hide_shipping_address"],["first_name","last_name","phone","tokenize","email","gender","date_of_birth","charge","statistics","hide_shipping_address"],["amount","currency","email","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone"],["customer_storage_number","tokenise_algorithm"]);(B=H=H||{}).STRIPE="Stripe",B.FLYPAY="Flypay",B.PAYPAL="Paypal",B.MASTERCARD="MasterCard",(q=z=z||{}).GOOGLE="google",q.APPLE="apple",q.FLYPAY="flypay",q.PAYPAL="paypal";var Q={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},$={PAYMENT_SOURCE:"payment_source",CARD_PAYMENT_SOURCE_WITH_CVV:"card_payment_source_with_cvv",CARD_PAYMENT_SOURCE_WITHOUT_CVV:"card_payment_source_without_cvv"},ee=(t(te,[{key:"setWebHookDestination",value:function(e){this.configs.webhook_destination=e}},{key:"setSuccessRedirectUrl",value:function(e){this.configs.success_redirect_url=e}},{key:"setErrorRedirectUrl",value:function(e){this.configs.error_redirect_url=e}},{key:"setFormFields",value:function(e){for(var t in Array.isArray(this.configs.defined_form_fields)||(this.configs.defined_form_fields=[]),e)e.hasOwnProperty(t)&&(-1!==j.values(V).indexOf(e[t].replace("*",""))?this.configs.defined_form_fields.push(e[t]):console.warn("Configuration::setFormFields: unsupported form field "+e[t]))}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Z.indexOf(t)?this.configs.meta[t]=e[t]:console.warn("Configuration::setMeta: unsupported meta key "+t))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"setLabel",value:function(e){this.configs.label=e}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"createToken",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.send(e,function(e,t){if(200<=t&&t<300)return n(e.resource.data.configuration_token);void 0===e.error||void 0===e.error.message?i("unknown error"):i(e.error.message)})}},{key:"send",value:function(e,t){var n=new XMLHttpRequest;n.open("POST",this.getUrl(),!0),n.setRequestHeader("Content-Type","application/json; charset=UTF-8"),n.setRequestHeader(h.getAccessHeaderNameByToken(e),e),n.send(JSON.stringify(this.getConfigs())),n.onload=function(){var e={};try{e=JSON.parse(n.responseText)}catch(e){}t(e,n.status)}}},{key:"getConfigs",value:function(){return this.configs}},{key:"getUrl",value:function(){return this.env.getConf().url+"/v1/remote-action/configs"}}],[{key:"createEachToken",value:function(e,n,i,t){function o(t){n.hasOwnProperty(t)&&n[t].createToken(e,function(e){a[t]=e,u++,n.length===u&&te.finishCreatingEachToken(a,s,i,r)},function(e){s.push("gateway: "+n[t].getConfigs().predefined_fields.gateway_id+" | "+e),u++,n.length===u&&te.finishCreatingEachToken(a,s,i,r)})}var r=3<arguments.length&&void 0!==t?t:function(e){},a=new Array(n.length),s=[],u=0;for(var l in n)o(l)}},{key:"finishCreatingEachToken",value:function(e,t,n,i){1<=t.length?i(t):n(e)}}]),te);function te(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"default",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Q.CARD,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:$.PAYMENT_SOURCE;if(l(this,te),-1===j.values(Q).indexOf(t))throw new Error("unsupported payment type");if(t===Q.CHECKOUT)throw new Error('Payment type "checkout" is deprecated. Use CheckoutButton for this type of payments https://www.npmjs.com/package/@paydock/client-sdk#checkout-button');if(-1===j.values($).indexOf(n))throw new Error("unsupported purpose");this.env=new P([{env:v,url:"https://api-sandbox."},{env:m,url:"https://api-sandbox-demo."},{env:y,url:"https://api-sandbox-demo."},{env:f,url:"https://api-sandbox."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}]),this.configs={purpose:n,meta:{},dynamic_fields_position:!0,predefined_fields:{gateway_id:e,type:t}}}var ne={INPUT:"input",SUBMIT_BUTTON:"submit_button",LABEL:"label",TITLE:"title",TITLE_DESCRIPTION:"title_description"},ie={ERROR:"error",FOCUS:"focus",HOVER:"hover"},oe=[{element:ne.INPUT,states:[ie.FOCUS,ie.ERROR],styles:["color","border","border_radius","background_color","height","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition"]},{element:ne.SUBMIT_BUTTON,states:[ie.HOVER],styles:["color","border","border_radius","background_color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition","opacity"]},{element:ne.LABEL,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin"]},{element:ne.TITLE,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]},{element:ne.TITLE_DESCRIPTION,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]}],re=(t(ae,null,[{key:"check",value:function(e,t,n,i){for(var o in e)if(e.hasOwnProperty(o)&&e[o].element===t){if(-1===e[o].states.indexOf(n)&&n)return!1;for(var r in i)if(i.hasOwnProperty(r)&&-1===e[o].styles.indexOf(r.replace("-","_")))return!1;return!0}return!1}},{key:"encode",value:function(e,t,n){var i=[];for(var o in n)n.hasOwnProperty(o)&&i.push(o.replace("_","-")+":"+n[o]);var r=i.join(";");return t?e+"::"+t+"{"+r+"}":e+"{"+r+"}"}},{key:"decode",value:function(e){var t=(e.match("::(.*){")||["",null])[1],n=null!==t?(e.match("(.*)::")||["",""])[1].trim():(e.match("(.*){")||["",""])[1].trim(),i=(e.match("{(.*)}")||["",""])[1].split(";"),o={};for(var r in i)if(i.hasOwnProperty(r)){var a=i[r].split(":");!a&&2!==a.length||(o[a[0].trim()]=(a[1]||"").trim())}return{element:n,state:t,styles:o}}}]),ae);function ae(){l(this,ae)}var se=(t(ue,[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"usePhoneCountryMask",value:function(e){return e?!e.only_countries||/^[a-z]+$/.test(e.only_countries.join(""))&&2*e.only_countries.length===e.only_countries.join("").length?!e.preferred_countries||/^[a-z]+$/.test(e.preferred_countries.join(""))&&2*e.preferred_countries.length===e.preferred_countries.join("").length?e.default_country&&2!==e.default_country.length?console.warn("Widget::usePhoneCountryMask[s: default_country - incorrect value length"):(this.link.setParams({use_country_phone_mask:!0}),e.only_countries&&this.link.setParams({phone_mask_only_countries:e.only_countries.join(",")}),e.preferred_countries&&this.link.setParams({phone_mask_preferred_countries:e.preferred_countries.join(",")}),void(e.default_country&&this.link.setParams({phone_mask_default_country:e.default_country}))):console.warn("Widget::usePhoneCountryMask[s: preferred_countries - unsupported symbols or incorrect length of value"):console.warn("Widget::usePhoneCountryMask[s: only_countries - unsupported symbols or incorrect length of value"):this.link.setParams({use_country_phone_mask:!0})}},{key:"setStyle",value:function(e,t){-1!==j.values(Y).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setStyle[s: unsupported style param "+e)}},{key:"setTexts",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setText(t,e[t])}},{key:"setText",value:function(e,t){-1!==j.values(K).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setText[s: unsupported text param "+e)}},{key:"setElementStyle",value:function(e,t,n){var i=3===arguments.length?t:null,o=3===arguments.length?n:t;if(!re.check(oe,e,i,o))return console.warn('Styles for "'+e+'" element with "'+(i||"default")+'" state was ignored because some of the arguments are unacceptable');this.link.concatParams({element_styles:re.encode(e,i,o)})}},{key:"setFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormValue(t,e[t])}},{key:"setFormValue",value:function(e,t){return-1===j.values(V).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field "+e):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: "+e+" - unsupported symbols (: or ,) in value"):void("string"==typeof this.link.getParams().form_values&&this.link.getParams().form_values.length?this.link.setParams({form_values:this.link.getParams().form_values+","+e+":"+t}):this.link.setParams({form_values:e+":"+t}))}},{key:"setFormLabels",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormLabel(t,e[t])}},{key:"setFormLabel",value:function(e,t){if(-1===j.values(V).indexOf(e))return console.warn("Widget::setFormLabel[s: unsupported field "+e);var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormLabel[s: "+e+" - unsupported symbols (: or ,) in value");this.link.concatParams({form_labels:e+":"+n})}},{key:"setFormPlaceholders",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormPlaceholder(t,e[t])}},{key:"setFormPlaceholder",value:function(e,t){if(-1===j.values(V).indexOf(e))return console.warn("Widget::setFormPlaceholder[s: unsupported field "+e);var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormPlaceholder[s: "+e+" - unsupported symbols (: or ,) in value");this.link.concatParams({form_placeholders:e+":"+n})}},{key:"setFormElements",value:function(e){var t=this;e.forEach(function(e){return t.setFormElement(e)})}},{key:"setFormElement",value:function(e){e.value&&this.setFormValue(e.field,e.value),e.label&&this.setFormLabel(e.field,e.label),e.placeholder&&this.setFormPlaceholder(e.field,e.placeholder)}},{key:"setIcons",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setIcon(t,e[t])}},{key:"setIcon",value:function(e,t){if(/\,/.test(t)||/\:/.test(t))return console.warn("Widget::setIcon[s: "+e+" - unsupported symbols (: or ,) in value");"string"==typeof this.link.getParams().icons&&this.link.getParams().icons.length?this.link.setParams({icons:this.link.getParams().icons+","+e+":"+t}):this.link.setParams({icons:e+":"+t})}},{key:"setHiddenElements",value:function(e){var t=[],n=j.values(J).concat(j.values(V));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::setHiddenElements: unsupported element "+e[i]));t.length&&this.link.concatParams({hidden_elements:t.join(",")})}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"useGatewayFieldValidation",value:function(){this.link.setParams({fields_validation:!0})}},{key:"setSupportedCardIcons",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(-1!==j.values(X).indexOf(e[i])?n.push(e[i]):console.warn("Widget::cardTypes: unsupported type of cards "+e[i]));n.length&&this.link.concatParams({supported_card_types:n.join(",")}),t&&this.link.setParams({validate_card_types:t})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"loadIFrameUrl",value:function(t,e){var n=this,i=1<arguments.length&&void 0!==e?e:function(e){};if(this.link.setParams({configuration_tokens:""}),this.configTokens.length)return this.link.setParams({configuration_tokens:this.configTokens.join(",")}),t(this.link.getUrl());ee.createEachToken(this.accessToken,this.configs,function(e){return n.link.concatParams({configuration_tokens:e.join(",")}),t(n.link.getUrl())},function(e){i(e)})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}]),ue);function ue(e,t){if(l(this,ue),this.configs=[],this.configTokens=[],this.link=new U("/remote-action"),h.validateJWT(e)?this.link.setParams({token:e}):this.link.setParams({public_key:e}),this.accessToken=e,!t||Array.isArray(t)&&!t.length)throw Error("configuration token is required");if("string"==typeof t)this.configTokens.push(t);else if(t instanceof ee)this.configs.push(t);else if(Array.isArray(t)&&"string"==typeof t[0])this.configTokens=t;else{if(!(Array.isArray(t)&&t[0]instanceof ee))throw Error("Unsupported type of configuration token");this.configs=t}}var le=(t(ce,null,[{key:"insertToInput",value:function(e,t,n){if(void 0!==n[t]){var i=document.querySelector(e);i&&(i.value=n[t])}}},{key:"subscribe",value:function(e,t,n){t.addEventListener?t.addEventListener(e,n):t.attachEvent("on"+e,n)}}]),ce);function ce(){l(this,ce)}var de=(t(he,[{key:"isExist",value:function(){return!!this.getElement()}},{key:"getStyles",value:function(e){if(this.isExist()){var t=this.getElement().getAttribute("widget-style");if(!t)return{};var n=t.split(";");return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"on",value:function(e,t){this.isExist()&&le.subscribe(e,this.getElement(),t)}},{key:"getAttr",value:function(e){if(this.isExist()){var t=this.getElement(),n=[];for(var i in e)if(e.hasOwnProperty(i)){var o=e[i].replace(/_/g,"-"),r=t.getAttribute(o);r&&n.push(e[i]+":"+r)}return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"convertConfigs",value:function(e,t){var n={};for(var i in e)if(e.hasOwnProperty(i)){var o=e[i].split(":"),r=o[0].replace(/-/g,"_").trim();-1!==t.indexOf(r)&&(n[r]=o[1].trim())}return n}}]),he);function he(e){l(this,he),this.selector=e}var pe=(t(fe,[{key:"load",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.container.isExist()&&!this.isExist()){var i=document.createElement("iframe");i.setAttribute("src",e),n.title&&(i.title=n.title),this.container.getElement().appendChild(i)}}},{key:"loadFromHtml",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.container.isExist()&&!this.isExist()){var i=document.createElement("iframe");i.setAttribute("height","100%"),i.setAttribute("width","100%"),n.title&&(i.title=n.title),this.container.getElement().appendChild(i);var o=this.getElement().contentDocument;o.open(),o.write("<html><head><style>html, body {margin: 0;} iframe {border: 0; width: 100%}</style><title></title></head><body>{{content}}</body></html>".replace("{{content}}",e)),o.close()}}},{key:"remove",value:function(){if(this.container.isExist()&&this.isExist()){var e=this.getElement();this.container.getElement().removeChild(e)}}},{key:"show",value:function(){this.isExist()&&(this.setStyle("visibility","visible"),this.setStyle("display","block"))}},{key:"hide",value:function(e){var t=0<arguments.length&&void 0!==e&&e;this.isExist()&&(t?this.setStyle("visibility","hidden"):this.setStyle("display","none"))}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"getElement",value:function(){return this.container.isExist()?this.container.getElement().querySelector("iframe"):null}},{key:"setStyle",value:function(e,t){this.getElement().style[e]=t}}]),fe);function fe(e){l(this,fe),this.container=e}var ve={AFTER_LOAD:"afterLoad",SUBMIT:"submit",FINISH:"finish",VALIDATION_ERROR:"validationError",SYSTEM_ERROR:"systemError",CHECKOUT_SUCCESS:"checkoutSuccess",CHECKOUT_ERROR:"checkoutError",VALIDATION:"validation",SELECT:"select",UNSELECT:"unselect",NEXT:"next",PREV:"prev",META_CHANGE:"metaChange",RESIZE:"resize",CHARGE_AUTH_SUCCESS:"chargeAuthSuccess",CHARGE_AUTH_REJECT:"chargeAuthReject",CHARGE_AUTH_CANCELLED:"chargeAuthCancelled",ADDITIONAL_DATA_SUCCESS:"additionalDataCollectSuccess",ADDITIONAL_DATA_REJECT:"additionalDataCollectReject",CHARGE_AUTH:"chargeAuth"},me=(t(ye,[{key:"emit",value:function(e){for(var t in this.listeners)this.listeners[t].event===e.event&&e.widget_id===this.listeners[t].widget_id&&this.listeners[t].listener.apply(this,[e])}},{key:"on",value:function(e,t,n){for(var i in ve)ve.hasOwnProperty(i)&&e===ve[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t)}}]),ye);function ye(e){var n=this;l(this,ye),this.listeners=[],e&&le.subscribe("message",e,function(e){var t=void 0;try{t=JSON.parse(e.data)}catch(e){}t&&n.emit(t)})}var ge={SUBMIT_FORM:"submit_form",CHANGE_TAB:"tab",HIDE_ELEMENTS:"hide_elements",SHOW_ELEMENTS:"show_elements",REFRESH_CHECKOUT:"refresh_checkout",UPDATE_FORM_VALUES:"update_form_values",INIT_CHECKOUT:"init_checkout"},_e=(t(ke,[{key:"push",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.iFrame.isExist()){-1===j.values(ge).indexOf(e)&&console.warn("unsupported trigger type");var i={trigger:e,destination:"widget.paydock",data:n};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(i),"*")}}}]),ke);function ke(e){l(this,ke),this.iFrame=e}var Ee=(t(be,[{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"beforeSubmit",value:function(t){var n=this;this.isExist()&&this.subscribe(this.getElement(),function(e){e.preventDefault(),n.intercepted=!0,t.apply(n,[])})}},{key:"continueSubmit",value:function(){var e=this;this.isExist()&&this.intercepted&&(this.intercepted=!1,setTimeout(function(){e.getElement().submit()},50))}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("submit",t):e.attachEvent("onsubmit",t)}}]),be);function be(e){l(this,be),this.intercepted=!1,this.selector=e}var we=(o(Se,se),t(Se,[{key:"load",value:function(){var t=this;this.setStyles(this.container.getStyles(j.values(Y))),this.setTexts(this.container.getAttr(j.values(K))),this.loadIFrameUrl(function(e){t.iFrame.load(e,{title:"Card details"}),t.afterLoad()},function(e){for(var t in console.error("Errors when creating a token[s, widget will not be load:"),e)e.hasOwnProperty(t)&&console.error("--- | "+e[t])})}},{key:"afterLoad",value:function(){var t=this;this.on(ve.VALIDATION,function(e){t.validationData=e})}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise(function(t){return n.event.on(e,n.link.getParams().widget_id,function(e){return t(e)})})}},{key:"trigger",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};this.triggerElement.push(e,n)}},{key:"getValidationState",value:function(){return this.validationData}},{key:"isValidForm",value:function(){return!!this.validationData.form_valid}},{key:"isInvalidField",value:function(e){var t=0<arguments.length&&void 0!==e?e:"";return!!this.validationData.invalid_fields&&-1!==this.validationData.invalid_fields.indexOf(t)}},{key:"isFieldErrorShowed",value:function(e){var t=0<arguments.length&&void 0!==e?e:"";return!!this.validationData.invalid_showed_fields&&-1!==this.validationData.invalid_showed_fields.indexOf(t)}},{key:"isInvalidFieldByValidator",value:function(e,t){var n=0<arguments.length&&void 0!==e?e:"";return!(this.validationData.validators&&!this.validationData.validators[t])&&-1!==this.validationData.validators[t].indexOf(n)}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"hideElements",value:function(e){var t=[],n=j.values(J).concat(j.values(V));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::hideElements: unsupported element "+e[i]));t.length&&this.trigger(ge.HIDE_ELEMENTS,{elements:t.join(",")})}},{key:"showElements",value:function(e){var t=[],n=j.values(J).concat(j.values(V));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::showElements: unsupported element "+e[i]));t.length&&this.trigger(ge.SHOW_ELEMENTS,{elements:t.join(",")})}},{key:"updateFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.updateFormValue(t,e[t])}},{key:"updateFormValue",value:function(e,t){return-1===j.values(V).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field "+e):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: "+e+" - unsupported symbols (: or ,) in value"):void this.trigger(ge.UPDATE_FORM_VALUES,{form_values:e+":"+t})}},{key:"onFinishInsert",value:function(t,n){this.on(ve.FINISH,function(e){le.insertToInput(t,n,e)})}},{key:"interceptSubmitForm",value:function(e){var t=this;this.setHiddenElements([J.SUBMIT_BUTTON]);var n=new Ee(e);n.beforeSubmit(function(){t.triggerElement.push(ge.SUBMIT_FORM,{}),t.event.on(ve.FINISH,t.link.getParams().widget_id,function(){n.continueSubmit()})})}},{key:"useCheckoutAutoSubmit",value:function(){var t=this;this.setHiddenElements([J.SUBMIT_BUTTON]),this.on(ve.CHECKOUT_SUCCESS,function(e){t.trigger(ge.SUBMIT_FORM)}),this.on(ve.VALIDATION_ERROR,function(e){t.trigger(ge.REFRESH_CHECKOUT)}),this.on(ve.SYSTEM_ERROR,function(e){t.trigger(ge.REFRESH_CHECKOUT)})}},{key:"useAutoResize",value:function(){var t=this;this.on(ve.RESIZE,function(e){t.iFrame.getElement()&&(t.iFrame.getElement().scrolling="no",e.height&&t.iFrame.setStyle("height",e.height+"px"))})}}]),Se);function Se(e,t,n){l(this,Se);var i=c(this,(Se.__proto__||Object.getPrototypeOf(Se)).call(this,t,n));return i.validationData={},i.container=new de(e),i.iFrame=new pe(i.container),i.triggerElement=new _e(i.iFrame),i.event=new me(window),i}var Ce=(o(Oe,we),t(Oe,[{key:"setWebHookDestination",value:function(e){this.configs[0].setWebHookDestination(e)}},{key:"setSuccessRedirectUrl",value:function(e){this.configs[0].setSuccessRedirectUrl(e)}},{key:"setErrorRedirectUrl",value:function(e){this.configs[0].setErrorRedirectUrl(e)}},{key:"setFormFields",value:function(e){this.configs[0].setFormFields(e)}},{key:"setFormElements",value:function(e){var t=this;e.forEach(function(e){return t.setFormElement(e)})}},{key:"setFormElement",value:function(e){this.configs[0].setFormFields([e.field]),a(Oe.prototype.__proto__||Object.getPrototypeOf(Oe.prototype),"setFormElement",this).call(this,A(A({},e),{field:e.field.replace("*","")}))}},{key:"setMeta",value:function(e){this.configs[0].setMeta(e)}}]),Oe);function Oe(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default",i=arguments[3],o=arguments[4];l(this,Oe);var r=new ee(n,i,o);return c(this,(Oe.__proto__||Object.getPrototypeOf(Oe)).call(this,e,t,r))}var Te=(t(Pe,[{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getUrl",value:function(){return this.env.getConf().url+this.getLink()}},{key:"create",value:function(e,t,n,i){var o=this,r=new XMLHttpRequest;r.onload=function(){o.parser(r.responseText,r.status,n,i)},r.open("POST",this.getUrl(),!0),r.setRequestHeader("Content-Type","application/json; charset=UTF-8"),r.setRequestHeader(h.getAccessHeaderNameByToken(e),e),r.send(JSON.stringify(t))}},{key:"get",value:function(e,t,n){var i=this,o=new XMLHttpRequest;o.onload=function(){i.parser(o.responseText,o.status,t,n)},o.open("GET",this.getUrl(),!0),o.setRequestHeader("Content-Type","application/json; charset=UTF-8"),o.setRequestHeader(h.getAccessHeaderNameByToken(e),e),o.send()}},{key:"parser",value:function(e,t,n,i){var o={};try{o=JSON.parse(e)}catch(e){}if(200<=t&&t<300||302===t)return n(o.resource.data,t);i(o.error||{message:"unknown error"},t)}}]),Pe);function Pe(){l(this,Pe),this.env=new P([{env:v,url:"https://api-sandbox."},{env:m,url:"https://api-sandbox-demo."},{env:y,url:"https://api-sandbox-demo."},{env:f,url:"https://api-sandbox."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}])}var Ae=(o(Re,Te),t(Re,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout"}},{key:"setDescriptions",value:function(e){this.body.description=e}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Z.indexOf(t)?this.body.meta[t]=e[t]:console.warn("ExternalCheckout::setMeta: unsupported meta key "+t))}},{key:"getConfigs",value:function(){return this.body}},{key:"send",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e,t){};this.create(e,this.getConfigs(),function(e,t){n(e)},function(e,t){void 0===e.message?i(t+": unknown error","unknown_error"):i(e.message,e.code)})}}]),Re);function Re(e,t,n){l(this,Re);var i=c(this,(Re.__proto__||Object.getPrototypeOf(Re)).call(this));return i.body={gateway_id:e,meta:{},success_redirect_url:t,error_redirect_url:n,redirect_url:t},i}var xe=(o(Ie,Te),t(Ie,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout/:token".replace(":token",this.token)}},{key:"send",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.get(e,function(e,t){n(e)},function(e,t){void 0===e.message?i(t+": unknown error"):i(e.message)})}}]),Ie);function Ie(e){l(this,Ie);var t=c(this,(Ie.__proto__||Object.getPrototypeOf(Ie)).call(this));return t.token=e,t}var Le=(t(Ne,[{key:"emit",value:function(e,t){var n=this.events[e];n&&n.forEach(function(e){e.call(null,t)})}},{key:"subscribe",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter(function(e){return t!==e})}}}]),Ne);function Ne(){l(this,Ne),this.events={}}var De='\n <div class="cs-loader">\n <div class="cs-loader-inner">\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n </div>\n </div>\n',Ue="\n <style> \n .cs-loader {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n }\n \n .cs-loader-inner {\n transform: translateY(-50%);\n top: 50%;\n position: absolute;\n width: calc(100% - 200px);\n color: #8e8d8c;\n padding: 0 100px;\n text-align: center;\n }\n \n \n .cs-loader-inner label {\n font-size: 20px;\n opacity: 0;\n display:inline-block;\n }\n \n @keyframes lol {\n 0% {\n opacity: 0;\n transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n transform: translateX(300px);\n }\n }\n \n @-webkit-keyframes lol {\n 0% {\n opacity: 0;\n -webkit-transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n -webkit-transform: translateX(300px);\n -moz-transform: translateX(300px);\n }\n }\n \n .cs-loader-inner label:nth-child(6) {\n -webkit-animation: lol 3s infinite ease-in-out;\n -moz-animation: lol 3s infinite ease-in-out;\n animation: lol 3s infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(5) {\n -webkit-animation: lol 3s 100ms infinite ease-in-out;\n -moz-animation: lol 3s 100ms infinite ease-in-out;\n animation: lol 3s 100ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(4) {\n -webkit-animation: lol 3s 200ms infinite ease-in-out;\n -moz-animation: lol 3s 200ms infinite ease-in-out;\n animation: lol 3s 200ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(3) {\n -webkit-animation: lol 3s 300ms infinite ease-in-out;\n -moz-animation: lol 3s 300ms infinite ease-in-out;\n animation: lol 3s 300ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(2) {\n -webkit-animation: lol 3s 400ms infinite ease-in-out;\n -moz-animation: lol 3s 400ms infinite ease-in-out;\n animation: lol 3s 400ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(1) {\n -webkit-animation: lol 3s 500ms infinite ease-in-out;\n -moz-animation: lol 3s 500ms infinite ease-in-out;\n animation: lol 3s 500ms infinite ease-in-out;\n }\n </style>\n",Me=(t(je,null,[{key:"isFacebook",value:function(){return-1!==navigator.userAgent.indexOf("FBSN/iOS")&&-1!==navigator.userAgent.indexOf("AppleWebKit")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isInstagram",value:function(){return-1!==navigator.userAgent.indexOf("iOS")&&-1!==navigator.userAgent.indexOf("Instagram")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isSupportPopUp",value:function(){return!this.isFacebook()&&!this.isInstagram()}},{key:"getLanguage",value:function(){return window.navigator.language||""}},{key:"getTimezoneOffset",value:function(){return(new Date).getTimezoneOffset()}},{key:"getBrowserName",value:function(){var e=navigator.userAgent;return-1<e.indexOf("Firefox")?"Mozilla Firefox":-1<e.indexOf("Opera")?"Opera":-1<e.indexOf("Trident")?"Microsoft Internet Explorer":-1<e.indexOf("Edge")?"Microsoft Edge":-1<e.indexOf("Chrome")?"Google Chrome or Chromium":-1<e.indexOf("Safari")?"Apple Safari":"unknown"}},{key:"isJavaEnabled",value:function(){return navigator.javaEnabled()}},{key:"getColorDepth",value:function(){return screen.colorDepth}},{key:"getScreenHeight",value:function(){return screen.height}},{key:"getScreenWidth",value:function(){return screen.width}}]),je);function je(){l(this,je)}var Fe="close",He="focus",Be=(t(ze,[{key:"initControl",value:function(){if(!this.isInit()&&this.showControl){if(!Me.isSupportPopUp())return this.createLoader();this.createTemplate(),this.createStyles(),this.eventHandler()}}},{key:"initLoader",value:function(){!this.isInit()&&this.showLoader&&(this.createStyles(),this.createLoader())}},{key:"eventHandler",value:function(){var e=this,t=document.querySelector("[data-close]"),n=document.querySelector("[data-continue]");t&&le.subscribe("click",t,function(){return e.eventEmitter.emit(Fe,{})}),n&&le.subscribe("click",n,function(){return e.eventEmitter.emit(He,{})})}},{key:"clear",value:function(){(this.style||this.overlay)&&(this.style.parentNode.removeChild(this.style),this.overlay.parentNode.removeChild(this.overlay),this.style=null,this.overlay=null)}},{key:"createLoader",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0];this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=Ue+De,t.appendChild(this.overlay),setTimeout(function(){e.isInit()&&e.overlay.classList.add("display")},5)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <strong class="checkout-title" data-title>{{title}}</strong>\n <p data-description>{{description}}</p>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');n=(n=n.replace("{{description}}",this.description)).replace("{{title}}",this.title),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout(function(){e.isInit()&&e.overlay.classList.add("display")},5)}},{key:"createStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .hide-continue-button [data-continue] {\n display: none;\n }\n \n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay { \n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display { \n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n"),n=document.querySelector(".checkout-container");t=t.replace("{{width}}",n?String(n.offsetHeight/2):"0"),this.style=document.createElement("style"),this.style.type="text/css",this.style.appendChild(document.createTextNode(t)),e.appendChild(this.style)}},{key:"setBackdropDescription",value:function(e){this.description=e}},{key:"setBackdropTitle",value:function(e){this.title=e}},{key:"onTrigger",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"isInit",value:function(){return!(!this.overlay||!this.style)}},{key:"hideContinueControl",value:function(){this.isInit()&&this.overlay.classList.add("hide-continue-button")}},{key:"turnOffControl",value:function(){this.showControl=!1}},{key:"turnOffLoader",value:function(){this.showLoader=!1}}]),ze);function ze(){l(this,ze),this.description="Don't see the secure checkout browser? We'll help you re-launch the window to complete your purchase",this.title="Checkout",this.overlay=null,this.style=null,this.showControl=!0,this.showLoader=!0,this.eventEmitter=new Le}var qe={EXTERNAL_CHECKOUT_TOKEN:"external_checkout_token",CHECKOUT_TOKEN:"checkout_token",BANK_ACCOUNT:"bank_account",CARD:"card"},We=(o(Ve,Te),t(Ve,[{key:"getLink",value:function(){return"/v1/payment_sources/tokens"}},{key:"send",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.create(e,this.getConfigs(),function(e,t){return n(e)},function(e,t){void 0===e.message?i("unknown error"):i(e.message)})}},{key:"getConfigs",value:function(){return this.body}}]),Ve);function Ve(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:qe.CARD;l(this,Ve);var i=c(this,(Ve.__proto__||Object.getPrototypeOf(Ve)).call(this));switch(i.body={gateway_id:e,type:n},n){case qe.CARD:case qe.BANK_ACCOUNT:delete t.gateway_id,delete t.type,delete t.checkout_token,i.body=A(i.body,t);break;case qe.CHECKOUT_TOKEN:case qe.EXTERNAL_CHECKOUT_TOKEN:i.body.checkout_token=t;break;default:throw new Error("Unsupported type of PaymentSourceToken")}return i}var Ye="success",Ge="declined",Ke="close",Je="referred",Xe="error",Ze=(t(Qe,[{key:"continue",value:function(){}},{key:"next",value:function(){}},{key:"stop",value:function(){}},{key:"error",value:function(e,t,n){n(!0)}},{key:"setCustomRedirectUri",value:function(e){this.customRedirectUti=e}},{key:"setEnv",value:function(e,t){this.widgetEnv.setEnv(e,t)}},{key:"setBackgroundTitle",value:function(e){this.background.setBackdropTitle(e)}},{key:"setBackgroundDescription",value:function(e){this.background.setBackdropDescription(e)}},{key:"turnOffBackdrop",value:function(){this.background.turnOffControl(),this.background.turnOffLoader()}}]),Qe);function Qe(){var e=this;l(this,Qe),this.customRedirectUti=null,this.background=new Be,this.background.onTrigger(He,function(){return e.continue()}),this.background.onTrigger(Fe,function(){return e.stop()}),this.widgetEnv=new P([{env:f,url:"https://widget-sandbox."},{env:v,url:"https://widget-sandbox."},{env:m,url:"https://widget-sandbox-demo."},{env:y,url:"https://widget-sandbox-demo."},{env:g,url:"https://widget."},{env:_,url:"https://widsta."},{env:k,url:"https://widsta-2."},{env:E,url:"https://widsta-3."},{env:b,url:"https://widsta-4."},{env:w,url:"https://widsta-5."}])}var $e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function et(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nt(e,t){return e(t={exports:{}},t.exports),t.exports}tt(nt(function(e){!function o(r,a,s){function u(t,e){if(!a[t]){if(!r[t]){if(!e&&et)return et();if(l)return l(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[t]={exports:{}};r[t][0].call(i.exports,function(e){return u(r[t][1][e]||e)},i,i.exports,o,r,a,s)}return a[t].exports}for(var l=et,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,t,n){function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function r(t){if(c===setTimeout)return setTimeout(t,0);if((c===i||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function a(){v&&p&&(v=!1,p.length?f=p.concat(f):m=-1,f.length&&s())}function s(){if(!v){var e=r(a);v=!0;for(var t=f.length;t;){for(p=f,f=[];++m<t;)p&&p[m].run();m=-1,t=f.length}p=null,v=!1,function(t){if(d===clearTimeout)return clearTimeout(t);if((d===o||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}(e)}}function u(e,t){this.fun=e,this.array=t}function l(){}var c,d,h=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:i}catch(e){c=i}try{d="function"==typeof clearTimeout?clearTimeout:o}catch(e){d=o}}();var p,f=[],v=!1,m=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new u(e,t)),1!==f.length||v||r(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.prependListener=l,h.prependOnceListener=l,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],2:[function(e,i,o){(function(Y){!function(e){if("function"==typeof bootstrap)bootstrap("promise",e);else if("object"==(void 0===o?"undefined":G(o))&&"object"==(void 0===i?"undefined":G(i)))i.exports=e();else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=e}else{if("undefined"==typeof window&&"undefined"==typeof self)throw new Error("This environment was not anticipated by Q. Please file a bug.");var t="undefined"!=typeof window?window:self,n=t.Q;t.Q=e(),t.Q.noConflict=function(){return t.Q=n,this}}}(function(){function e(e){return function(){return P.apply(e,arguments)}}function s(e,t){if(b&&t.stack&&"object"==(void 0===e?"undefined":G(e))&&null!==e&&e.stack){for(var n=[],i=t;i;i=i.source)i.stack&&(!e.__minimumStackCounter__||e.__minimumStackCounter__>i.stackCounter)&&(N(e,"__minimumStackCounter__",{value:i.stackCounter,configurable:!0}),n.unshift(i.stack));n.unshift(e.stack);var o=function(e){for(var t=e.split("\n"),n=[],i=0;i<t.length;++i){var o=t[i];a(o)||(-1!==(r=o).indexOf("(module.js:")||-1!==r.indexOf("(node.js:"))||!o||n.push(o)}var r;return n.join("\n")}(n.join("\n"+j+"\n"));N(e,"stack",{value:o,configurable:!0})}}function o(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var i=/.*@(.+):(\d+)$/.exec(e);return i?[i[1],Number(i[2])]:void 0}function a(e){var t=o(e);if(t){var n=t[0],i=t[1];return n===S&&O<=i&&i<=V}}function t(){if(b)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=o(0<t[0].indexOf("@")?t[1]:t[2]);if(!n)return;return S=n[0],n[1]}}function u(e){return e instanceof c?e:r(e)?(t=e,n=l(),u.nextTick(function(){try{t.then(n.resolve,n.reject,n.notify)}catch(e){n.reject(e)}}),n.promise):m(e);var t,n}function l(){function t(n){o=n,u.longStackSupport&&b&&(i.source=n),R(r,function(e,t){u.nextTick(function(){n.promiseDispatch.apply(n,t)})},void 0),a=r=void 0}var o,r=[],a=[],e=L(l.prototype),i=L(c.prototype);if(i.promiseDispatch=function(e,t,n){var i=A(arguments);r?(r.push(i),"when"===t&&n[1]&&a.push(n[1])):u.nextTick(function(){o.promiseDispatch.apply(o,i)})},i.valueOf=function(){if(r)return i;var e=h(o);return p(e)&&(o=e),e},i.inspect=function(){return o?o.inspect():{state:"pending"}},u.longStackSupport&&b)try{throw new Error}catch(t){i.stack=t.stack.substring(t.stack.indexOf("\n")+1),i.stackCounter=F++}return e.promise=i,e.resolve=function(e){o||t(u(e))},e.fulfill=function(e){o||t(m(e))},e.reject=function(e){o||t(v(e))},e.notify=function(n){o||R(a,function(e,t){u.nextTick(function(){t(n)})},void 0)},e}function n(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=l();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function i(o){return n(function(e,t){for(var n=0,i=o.length;n<i;n++)u(o[n]).then(e,t)})}function c(o,r,t){void 0===r&&(r=function(e){return v(new Error("Promise does not support operation: "+e))}),void 0===t&&(t=function(){return{state:"unknown"}});var a=L(c.prototype);if(a.promiseDispatch=function(e,t,n){var i;try{i=o[t]?o[t].apply(a,n):r.call(a,t,n)}catch(e){i=v(e)}e&&e(i)},a.inspect=t){var e=t();"rejected"===e.state&&(a.exception=e.reason),a.valueOf=function(){var e=t();return"pending"===e.state||"rejected"===e.state?a:e.value}}return a}function d(e,t,n,i){return u(e).then(t,n,i)}function h(e){if(p(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function p(e){return e instanceof c}function r(e){return(t=e)===Object(t)&&"function"==typeof e.then;var t}function f(){B.length=0,z.length=0,W=W||!0}function v(t){var e,n,i=c({when:function(e){return e&&function(t){if(W){var n=x(z,t);-1!==n&&("object"==(void 0===Y?"undefined":G(Y))&&"function"==typeof Y.emit&&u.nextTick.runAfter(function(){var e=x(q,t);-1!==e&&(Y.emit("rejectionHandled",B[n],t),q.splice(e,1))}),z.splice(n,1),B.splice(n,1))}}(this),e?e(t):this}},function(){return this},function(){return{state:"rejected",reason:t}});return e=i,n=t,W&&("object"==(void 0===Y?"undefined":G(Y))&&"function"==typeof Y.emit&&u.nextTick.runAfter(function(){-1!==x(z,e)&&(Y.emit("unhandledRejection",n,e),q.push(e))}),z.push(e),n&&void 0!==n.stack?B.push(n.stack):B.push("(no stack) "+n)),i}function m(n){return c({when:function(){return n},get:function(e){return n[e]},set:function(e,t){n[e]=t},delete:function(e){delete n[e]},post:function(e,t){return null==e?n.apply(void 0,t):n[e].apply(n,t)},apply:function(e,t){return n.apply(e,t)},keys:function(){return U(n)}},void 0,function(){return{state:"fulfilled",value:n}})}function y(e,t,n){return u(e).spread(t,n)}function g(e,t,n){return u(e).dispatch(t,n)}function _(e){return d(e,function(o){var r=0,a=l();return R(o,function(e,t,n){var i;p(t)&&"fulfilled"===(i=t.inspect()).state?o[n]=i.value:(++r,d(t,function(e){o[n]=e,0==--r&&a.resolve(o)},a.reject,function(e){a.notify({index:n,value:e})}))},void 0),0===r&&a.resolve(o),a.promise})}function k(o){if(0===o.length)return u.resolve();var r=u.defer(),a=0;return R(o,function(e,t,n){var i=o[n];a++,d(i,function(e){r.resolve(e)},function(e){0==--a&&(e.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+e.message,r.reject(e))},function(e){r.notify({index:n,value:e})})},void 0),r.promise}function E(e){return d(e,function(e){return e=I(e,u),d(_(I(e,function(e){return d(e,w,w)})),function(){return e})})}var b=!1;try{throw new Error}catch(e){b=!!e.stack}function w(){}var S,C,O=t(),T=function(){function n(){for(var e,t;o.next;)e=(o=o.next).task,o.task=void 0,(t=o.domain)&&(o.domain=void 0,t.enter()),i(e,t);for(;u.length;)i(e=u.pop());r=!1}function i(e,t){try{e()}catch(e){if(s)throw t&&t.exit(),setTimeout(n,0),t&&t.enter(),e;setTimeout(function(){throw e},0)}t&&t.exit()}var o={task:void 0,next:null},t=o,r=!1,a=void 0,s=!1,u=[];if(T=function(e){t=t.next={task:e,domain:s&&Y.domain,next:null},r||(r=!0,a())},"object"==(void 0===Y?"undefined":G(Y))&&"[object process]"===Y.toString()&&Y.nextTick)s=!0,a=function(){Y.nextTick(n)};else if("function"==typeof setImmediate)a="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)};else if("undefined"!=typeof MessageChannel){var e=new MessageChannel;e.port1.onmessage=function(){a=l,(e.port1.onmessage=n)()};var l=function(){e.port2.postMessage(0)};a=function(){setTimeout(n,0),l()}}else a=function(){setTimeout(n,0)};return T.runAfter=function(e){u.push(e),r||(r=!0,a())},T}(),P=Function.call,A=e(Array.prototype.slice),R=e(Array.prototype.reduce||function(e,t){var n=0,i=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=i)throw new TypeError}for(;n<i;n++)n in this&&(t=e(t,this[n],n));return t}),x=e(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),I=e(Array.prototype.map||function(i,o){var r=this,a=[];return R(r,function(e,t,n){a.push(i.call(o,t,n,r))},void 0),a}),L=Object.create||function(e){function t(){}return t.prototype=e,new t},N=Object.defineProperty||function(e,t,n){return e[t]=n.value,e},D=e(Object.prototype.hasOwnProperty),U=Object.keys||function(e){var t=[];for(var n in e)D(e,n)&&t.push(n);return t},M=e(Object.prototype.toString);C="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var j="From previous event:";(u.resolve=u).nextTick=T,u.longStackSupport=!1;var F=1;"object"==(void 0===Y?"undefined":G(Y))&&Y&&Y.env&&Y.env.Q_DEBUG&&(u.longStackSupport=!0),(u.defer=l).prototype.makeNodeResolver=function(){var n=this;return function(e,t){e?n.reject(e):2<arguments.length?n.resolve(A(arguments,1)):n.resolve(t)}},u.Promise=n,(u.promise=n).race=i,n.all=_,n.reject=v,(n.resolve=u).passByCopy=function(e){return e},c.prototype.passByCopy=function(){return this},u.join=function(e,t){return u(e).join(t)},c.prototype.join=function(e){return u([this,e]).spread(function(e,t){if(e===t)return e;throw new Error("Q can't join: not the same: "+e+" "+t)})},u.race=i,c.prototype.race=function(){return this.then(u.race)},(u.makePromise=c).prototype.toString=function(){return"[object Promise]"},c.prototype.then=function(t,n,o){var i=this,r=l(),a=!1;return u.nextTick(function(){i.promiseDispatch(function(e){a||(a=!0,r.resolve(function(e){try{return"function"==typeof t?t(e):e}catch(e){return v(e)}}(e)))},"when",[function(e){a||(a=!0,r.resolve(function(e){if("function"==typeof n){s(e,i);try{return n(e)}catch(e){return v(e)}}return v(e)}(e)))}])}),i.promiseDispatch(void 0,"when",[void 0,function(e){var t,n,i=!1;try{n=e,t="function"==typeof o?o(n):n}catch(e){if(i=!0,!u.onerror)throw e;u.onerror(e)}i||r.notify(t)}]),r.promise},u.tap=function(e,t){return u(e).tap(t)},c.prototype.tap=function(t){return t=u(t),this.then(function(e){return t.fcall(e).thenResolve(e)})},u.when=d,c.prototype.thenResolve=function(e){return this.then(function(){return e})},u.thenResolve=function(e,t){return u(e).thenResolve(t)},c.prototype.thenReject=function(e){return this.then(function(){throw e})},u.thenReject=function(e,t){return u(e).thenReject(t)},u.nearer=h,u.isPromise=p,u.isPromiseAlike=r,u.isPending=function(e){return p(e)&&"pending"===e.inspect().state},c.prototype.isPending=function(){return"pending"===this.inspect().state},u.isFulfilled=function(e){return!p(e)||"fulfilled"===e.inspect().state},c.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},u.isRejected=function(e){return p(e)&&"rejected"===e.inspect().state},c.prototype.isRejected=function(){return"rejected"===this.inspect().state};var H,B=[],z=[],q=[],W=!0;u.resetUnhandledRejections=f,u.getUnhandledReasons=function(){return B.slice()},u.stopUnhandledRejectionTracking=function(){f(),W=!1},f(),u.reject=v,u.fulfill=m,u.master=function(n){return c({isDef:function(){}},function(e,t){return g(n,e,t)},function(){return u(n).inspect()})},u.spread=y,c.prototype.spread=function(t,e){return this.all().then(function(e){return t.apply(void 0,e)},e)},u.async=function(t){return function(){function e(e,t){var n;if("undefined"==typeof StopIteration){try{n=i[e](t)}catch(e){return v(e)}return n.done?u(n.value):d(n.value,o,r)}try{n=i[e](t)}catch(e){return function(e){return"[object StopIteration]"===M(e)||e instanceof C}(e)?u(e.value):v(e)}return d(n,o,r)}var i=t.apply(this,arguments),o=e.bind(e,"next"),r=e.bind(e,"throw");return o()}},u.spawn=function(e){u.done(u.async(e)())},u.return=function(e){throw new C(e)},u.promised=function(n){return function(){return y([this,_(arguments)],function(e,t){return n.apply(e,t)})}},u.dispatch=g,c.prototype.dispatch=function(e,t){var n=this,i=l();return u.nextTick(function(){n.promiseDispatch(i.resolve,e,t)}),i.promise},u.get=function(e,t){return u(e).dispatch("get",[t])},c.prototype.get=function(e){return this.dispatch("get",[e])},u.set=function(e,t,n){return u(e).dispatch("set",[t,n])},c.prototype.set=function(e,t){return this.dispatch("set",[e,t])},u.del=u.delete=function(e,t){return u(e).dispatch("delete",[t])},c.prototype.del=c.prototype.delete=function(e){return this.dispatch("delete",[e])},u.mapply=u.post=function(e,t,n){return u(e).dispatch("post",[t,n])},c.prototype.mapply=c.prototype.post=function(e,t){return this.dispatch("post",[e,t])},u.send=u.mcall=u.invoke=function(e,t){return u(e).dispatch("post",[t,A(arguments,2)])},c.prototype.send=c.prototype.mcall=c.prototype.invoke=function(e){return this.dispatch("post",[e,A(arguments,1)])},u.fapply=function(e,t){return u(e).dispatch("apply",[void 0,t])},c.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},u.try=u.fcall=function(e){return u(e).dispatch("apply",[void 0,A(arguments,1)])},c.prototype.fcall=function(){return this.dispatch("apply",[void 0,A(arguments)])},u.fbind=function(e){var t=u(e),n=A(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(A(arguments))])}},c.prototype.fbind=function(){var e=this,t=A(arguments);return function(){return e.dispatch("apply",[this,t.concat(A(arguments))])}},u.keys=function(e){return u(e).dispatch("keys",[])},c.prototype.keys=function(){return this.dispatch("keys",[])},u.all=_,c.prototype.all=function(){return _(this)},u.any=k,c.prototype.any=function(){return k(this)},u.allResolved=(H=E,function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("allResolved is deprecated, use allSettled instead.",new Error("").stack),H.apply(H,arguments)}),c.prototype.allResolved=function(){return E(this)},u.allSettled=function(e){return u(e).allSettled()},c.prototype.allSettled=function(){return this.then(function(e){return _(I(e,function(e){function t(){return e.inspect()}return(e=u(e)).then(t,t)}))})},u.fail=u.catch=function(e,t){return u(e).then(void 0,t)},c.prototype.fail=c.prototype.catch=function(e){return this.then(void 0,e)},u.progress=function(e,t){return u(e).then(void 0,void 0,t)},c.prototype.progress=function(e){return this.then(void 0,void 0,e)},u.fin=u.finally=function(e,t){return u(e).finally(t)},c.prototype.fin=c.prototype.finally=function(t){if(!t||"function"!=typeof t.apply)throw new Error("Q can't apply finally callback");return t=u(t),this.then(function(e){return t.fcall().then(function(){return e})},function(e){return t.fcall().then(function(){throw e})})},u.done=function(e,t,n,i){return u(e).done(t,n,i)},c.prototype.done=function(e,t,n){var i=function(e){u.nextTick(function(){if(s(e,o),!u.onerror)throw e;u.onerror(e)})},o=e||t||n?this.then(e,t,n):this;"object"==(void 0===Y?"undefined":G(Y))&&Y&&Y.domain&&(i=Y.domain.bind(i)),o.then(void 0,i)},u.timeout=function(e,t,n){return u(e).timeout(t,n)},c.prototype.timeout=function(e,t){var n=l(),i=setTimeout(function(){t&&"string"!=typeof t||((t=new Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)},e);return this.then(function(e){clearTimeout(i),n.resolve(e)},function(e){clearTimeout(i),n.reject(e)},n.notify),n.promise},u.delay=function(e,t){return void 0===t&&(t=e,e=void 0),u(e).delay(t)},c.prototype.delay=function(n){return this.then(function(e){var t=l();return setTimeout(function(){t.resolve(e)},n),t.promise})},u.nfapply=function(e,t){return u(e).nfapply(t)},c.prototype.nfapply=function(e){var t=l(),n=A(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},u.nfcall=function(e){var t=A(arguments,1);return u(e).nfapply(t)},c.prototype.nfcall=function(){var e=A(arguments),t=l();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},u.nfbind=u.denodeify=function(n){if(void 0===n)throw new Error("Q can't wrap an undefined function");var i=A(arguments,1);return function(){var e=i.concat(A(arguments)),t=l();return e.push(t.makeNodeResolver()),u(n).fapply(e).fail(t.reject),t.promise}},c.prototype.nfbind=c.prototype.denodeify=function(){var e=A(arguments);return e.unshift(this),u.denodeify.apply(void 0,e)},u.nbind=function(n,i){var o=A(arguments,2);return function(){var e=o.concat(A(arguments)),t=l();return e.push(t.makeNodeResolver()),u(function(){return n.apply(i,arguments)}).fapply(e).fail(t.reject),t.promise}},c.prototype.nbind=function(){var e=A(arguments,0);return e.unshift(this),u.nbind.apply(void 0,e)},u.nmapply=u.npost=function(e,t,n){return u(e).npost(t,n)},c.prototype.nmapply=c.prototype.npost=function(e,t){var n=A(t||[]),i=l();return n.push(i.makeNodeResolver()),this.dispatch("post",[e,n]).fail(i.reject),i.promise},u.nsend=u.nmcall=u.ninvoke=function(e,t){var n=A(arguments,2),i=l();return n.push(i.makeNodeResolver()),u(e).dispatch("post",[t,n]).fail(i.reject),i.promise},c.prototype.nsend=c.prototype.nmcall=c.prototype.ninvoke=function(e){var t=A(arguments,1),n=l();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},u.nodeify=function(e,t){return u(e).nodeify(t)},c.prototype.nodeify=function(t){if(!t)return this;this.then(function(e){u.nextTick(function(){t(null,e)})},function(e){u.nextTick(function(){t(e)})})},u.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var V=t();return u})}).call(this,e("_process"))},{_process:1}],3:[function(e,t,n){function r(e){switch(void 0===e?"undefined":G(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}t.exports=function(n,i,o,e){return i=i||"&",o=o||"=",null===n&&(n=void 0),"object"==(void 0===n?"undefined":G(n))?Object.keys(n).map(function(e){var t=encodeURIComponent(r(e))+o;return Array.isArray(n[e])?n[e].map(function(e){return t+encodeURIComponent(r(e))}).join(i):t+encodeURIComponent(r(n[e]))}).join(i):e?encodeURIComponent(r(e))+o+encodeURIComponent(r(n)):""}},{}],4:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function o(n,i,o){return l.default.information("zip:checkout:init"),c.default.Promise(function(e,t){return n.onCheckout(e,t,{})}).then(function(e){var t=e.redirect_uri||e.redirectUri||e.data&&(e.data.redirect_uri||e.data.redirectUri);if(!t)return l.default.debug("zip:checkout:error","Response does not contain redirectUri property"),o(e),void n.onError({code:"checkout_error",message:"The response does not contain the redirectUri property",detail:e});l.default.debug("zip:checkout:success",e),i({redirectUri:t})}).catch(function(e){l.default.debug("zip:checkout:error",e),o(e),n.onError({code:"checkout_error",message:"Checkout response error",detail:e})})}Object.defineProperty(n,"__esModule",{value:!0}),n.Checkout=void 0;var r=function(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),e},a=i(e("./modal")),s=i(e("./options")),u=i(e("./utility")),l=i(e("./console")),c=i((e("./events"),e("q"))),d=(r(h,null,[{key:"init",value:function(t){if("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),t=A({},s.default,t),!this._validate(t))return l.default.setLevel(t.logLevel),t.redirect?o(t,function(e){return t.redirectFn(e.redirectUri)}):(e=t,(n=new a.default).onClose=e.onComplete.bind(e),n.build(),void o(e,function(e){return n.setUri(e.redirectUri)},function(e){return n.close(!1)}));var e,n}},{key:"attachButton",value:function(e,t){var n=document.querySelectorAll(e);if(!n.length)return config.onError({code:"attach_error",message:"Cannot find button to attach zipMoney checkout"});for(var i=0;i<n.length;i++)u.default.addEventHandler(n[i],"click",function(){return Zip.Checkout.init(t)})}},{key:"_validate",value:function(e){return["error","information","debug"].indexOf(e.logLevel.toLowerCase())<0&&(e.logLevel="error"),["standard","express"].indexOf(e.request.toLowerCase())<0&&(e.request="standard"),e.onComplete=e.onComplete||function(){},e.onError=e.onError||function(){},e.checkoutUri||e.onCheckout!==s.default.onCheckout?"express"===e.request?e.onError({code:"not_implemented",message:"This feature is not yet implemented"}):e.redirect||e.onComplete!==s.default.onComplete||e.redirectUri?void 0:e.onError({code:"validation",message:"if onComplete function is not specified then redirectUri must be specified"}):e.onError({code:"validation",message:"if onCheckout function is not specified then checkoutUri must be specified"})}}]),h);function h(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h)}function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.Checkout=d},{"./console":5,"./events":6,"./modal":8,"./options":9,"./utility":10,q:2}],5:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i="error",o={error:function(){var e;(e=window.console).log.apply(e,arguments)},information:function(){var e;"error"!==i&&(e=window.console).log.apply(e,arguments)},debug:function(){var e;"debug"===i&&(e=window.console).log.apply(e,arguments)},setLevel:function(e){i=e}};n.default=o},{}],6:[function(c,e,d){(function(i){Object.defineProperty(d,"__esModule",{value:!0}),d.EventListener=void 0;var e=function(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e},t=c("./utility");function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}if((t&&t.__esModule?t:{default:t}).default.isIe){var n=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};n.prototype=i.Event.prototype,i.CustomEvent=n}var r={},a=d.EventListener=(e(s,null,[{key:"constructor",value:function(){r={}}},{key:"on",value:function(e,t){r[e]=t}},{key:"off",value:function(e){r[e]=null}}]),s);function s(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s)}a.Event=function(e,t){this.eventType=e,this.data=t||{}},a.Event.eventTypes={resize:"resize",transition:"transition",close:"close",complete:"complete",clear:"clear"};var u=window.addEventListener?"addEventListener":"attachEvent",l=window[u];l("attachEvent"==u?"onmessage":"message",function(e){var t,n;e.data.zipmoney&&(t=e.data.msg,n=new i.CustomEvent("zipmoney",{detail:t}),i.dispatchEvent(n))},!1),l("zipmoney",function(e){var t,n=e.detail.eventType,i=r[n];i?i(e.detail.data||{}):(t=e,console.log("Unexpected Event",t))},!1)}).call(this,void 0!==$e?$e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utility":10}],7:[function(i,e,t){(function(e){var t=i("./checkout"),n=i("./events");e.Zip=e.Zip||{},e.Zip.Checkout=t.Checkout,e.zipMoneyEvent=n.EventListener.ZipEvent}).call(this,void 0!==$e?$e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./checkout":4,"./events":6}],8:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}function s(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function u(e){for(var t=document.querySelectorAll("html, body"),n=0;n<t.length;n++)t[n].style.overflowY=e}function l(e){var t=document.body.currentStyle||window.getComputedStyle(document.body),n=e-(document.body.offsetHeight+(parseInt(t.marginTop,10)+parseInt(t.marginBottom,10))-parseInt(t.height,10));document.body.style.height=n+"px"}Object.defineProperty(n,"__esModule",{value:!0});var o=function(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e},a=i(e("./utility")),c=e("./events"),d=(i(e("./console")),{iframeWidth:400,iframeMinWidth:320,iframeInitialHeight:704,iframeMinHeight:600,verticalMargin:35}),h=["resize","transition","close","complete","clear"],p="https://d3k1w8lx8mqizo.cloudfront.net/zm/",f=(o(v,[{key:"build",value:function(){this._initialHtmlHeight=s(),window.scrollTo(0,0);var e,t,n,i,o,r=this._frame=(e=this._frameUri,t=this._isMobile,(n=document.createElement("iframe")).id="zipmoney-iframe",n.frameborder=0,A(n.style,{padding:"0",border:"none",zIndex:"999999",backgroundColor:"#FFF",backgroundImage:"url("+p+"spinner.gif)",backgroundRepeat:"no-repeat",backgroundPosition:"50% 50%"}),A(n.style,t?{overflow:"scroll",width:"100%",height:"100%",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",margin:"0"}:{width:d.iframeWidth+"px",minWidth:d.iframeMinWidth+"px",height:d.iframeInitialHeight+"px",margin:d.verticalMargin+"px auto 0 auto",display:"table-row",backgroundSize:"25%",textAlign:"center",boxShadow:"0px 0px 70px 0px rgb(0, 0, 0)"}),n.src=e||"",n);if(!this._isMobile){var a=((o=document.createElement("img")).src=p+"icon-close.png",A(o.style,{width:"50px",height:"50px",position:"absolute",top:"20px",right:"20px",cursor:"pointer"}),o);a.onclick=this.close.bind(this),this._overlay=((i=document.createElement("div")).className="zipmoney-overlay",A(i.style,{position:"absolute",left:"0",top:"0",display:"table-cell",textAlign:"center",verticalAlign:"middle",background:"rgba(0, 0, 0, 0.75)",zIndex:"10000",height:"100%",width:"100%"}),i),this._overlay.appendChild(a),this._overlay.appendChild(this._frame),this._overlay.appendChild(function(){var e=document.createElement("div");e.style.width=d.iframeWidth+"px",e.style.minWidth=d.iframeMinWidth+"px",e.style.margin="10px auto 0 auto",e.style.overflow="hidden";var t=document.createElement("img");t.src=p+"iframe-secure.png",t.style.cssFloat="left";var n=document.createElement("img");return n.src=p+"poweredby-trans.png",n.style.cssFloat="right",e.appendChild(t),e.appendChild(n),e}()),r=this._overlay}document.body.appendChild(r),this._isMobile&&l(this._frame.offsetHeight),u("auto"),this._startMonitoringWindowResize()}},{key:"setUri",value:function(e){this._frameUri=e,this._frame&&(this._frame.src=e)}},{key:"resize",value:function(e){var t=this._isMobile?16:0,n=(e=d.iframeMinHeight<=e?e:d.iframeMinHeight,(e+=t)+2*d.verticalMargin),i=r();this._frame.style.height=e+"px",this._overlay&&(this._overlay.style.height=Math.max(i,this._initialHtmlHeight,n)+"px"),this._isMobile&&l(e)}},{key:"transition",value:function(){window.scroll(0,0)}},{key:"close",value:function(e){var t=!(0<arguments.length&&void 0!==e)||e,n={state:"cancelled"};this._events.length&&(n=this._events.pop()),this._destroy(),this.onClose&&t&&this.onClose(n)}},{key:"complete",value:function(e){this._events.push(e)}},{key:"clear",value:function(){this._events=[]}},{key:"_startMonitoringWindowResize",value:function(){var o=this;this._resizeHandler=a.default.debounce(function(){return e=o,t=r(),n=s(),i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,e._overlay&&(e._overlay.style.height=Math.max(t,n)+"px"),void(e._isMobile||i<d.iframeWidth?e._frame.style.width="100%":e._frame.style.width=d.iframeWidth+"px");var e,t,n,i},250),a.default.addEventHandler(window,"resize",this._resizeHandler)}},{key:"_stopMonitoringWindowResize",value:function(){a.default.removeEventHandler(window,"resize",this._resizeHandler)}},{key:"_destroy",value:function(){this._stopMonitoringWindowResize(),this._overlay?document.body.removeChild(this._overlay):document.body.removeChild(this._frame),this._isMobile&&(document.body.style.height="initial"),u("initial"),this._overlay=this._frame=null,h.forEach(function(e){return c.EventListener.off(c.EventListener.Event.eventTypes[e])})}}]),v);function v(){var t=this;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,v),this._events=[],this._isMobile=a.default.isMobileDevice(),h.forEach(function(e){return c.EventListener.on(c.EventListener.Event.eventTypes[e],t[e].bind(t))})}function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.default=f},{"./console":5,"./events":6,"./utility":10}],9:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var o=i(e("./xr")),r=i(e("./console"));o.default.configure({headers:{"X-Requested-With":"XMLHttpRequest"}});var a={request:"standard",redirect:!1,logLevel:"Error",onCheckout:function(t,e){o.default.post(this.checkoutUri).then(function(e){return t(e.data)}).catch(e)},onShippingAddressChanged:function(e,t){o.default.post(this.shippingUri).then(e).catch(t)},onComplete:function(e){if(r.default.information("zip:completed",e),"cancelled"!==e.state){var t=e.checkoutId?"&checkoutId="+e.checkoutId:"";this.redirectFn(this.redirectUri+"?result="+e.state+t)}},onError:function(e){r.default.error(e)},redirectFn:function(e){window.location.href=e}};n.default=a},{"./console":5,"./xr":11}],10:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=(function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}(o,null,[{key:"isIe",value:function(){var e=-1,t=window.navigator.userAgent,n=t.indexOf("MSIE "),i=t.indexOf("Trident/");if(0<n)e=parseInt(t.substring(n+5,t.indexOf(".",n)),10);else if(0<i){var o=t.indexOf("rv:");e=parseInt(t.substring(o+3,t.indexOf(".",o)),10)}return-1<e?e:void 0}},{key:"isMobileDevice",value:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}},{key:"debounce",value:function(i,o){var r;return function(){var e=this,t=arguments,n=!r;clearTimeout(r),r=setTimeout(function(){r=null,i.apply(e,t)},o),n&&i.apply(e,t)}}},{key:"addEventHandler",value:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}},{key:"removeEventHandler",value:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}}]),o);function o(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.default=i},{}],11:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function l(e){for(var t=arguments.length,n=Array(1<t?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var o in n)if({}.hasOwnProperty.call(n,o)){var r=n[o];if("object"===(void 0===r?"undefined":c(r)))for(var a in r)!{}.hasOwnProperty.call(r,a)||(e[a]=r[a])}return e}function o(s){return t=function(t,n){var i=l({},p,f,s),o=i.xmlHttpRequest();for(var e in i.abort&&s.abort(function(){n(u(o)),o.abort()}),o.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,d.default)(i.params):i.url,!0),o.withCredentials=i.withCredentials,o.addEventListener(h.LOAD,function(){if(200<=o.status&&o.status<300){var e=null;o.responseText&&(e=!0===i.raw?o.responseText:i.load(o.responseText)),t(u(o,e))}else n(u(o))}),o.addEventListener(h.ABORT,function(){return n(u(o))}),o.addEventListener(h.ERROR,function(){return n(u(o))}),o.addEventListener(h.TIMEOUT,function(){return n(u(o))}),i.headers)!{}.hasOwnProperty.call(i.headers,e)||o.setRequestHeader(e,i.headers[e]);for(var r in i.events)!{}.hasOwnProperty.call(i.events,r)||o.addEventListener(r,i.events[r].bind(null,o),!1);var a="object"!==c(i.data)||i.raw?i.data:i.dump(i.data);void 0!==a?o.send(a):o.send()},((e=s)&&e.promise?e.promise:f.promise||p.promise)(t);var e,t}Object.defineProperty(n,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==G(Symbol.iterator)?function(e){return void 0===e?"undefined":G(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":G(e)},d=i(e("querystring/encode")),r=i(e("q")),a={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},h={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p={method:a.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:JSON.stringify,load:JSON.parse,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return r.default.Promise(e)},withCredentials:!1},f={};o.assign=l,o.encode=d.default,o.configure=function(e){f=l({},f,e)},o.Methods=a,o.Events=h,o.defaults=p,o.get=function(e,t,n){return o(l({url:e,method:a.GET,params:t},n))},o.put=function(e,t,n){return o(l({url:e,method:a.PUT,data:t},n))},o.post=function(e,t,n){return o(l({url:e,method:a.POST,data:t},n))},o.patch=function(e,t,n){return o(l({url:e,method:a.PATCH,data:t},n))},o.del=function(e,t){return o(l({url:e,method:a.DELETE},t))},o.options=function(e,t){return o(l({url:e,method:a.OPTIONS},t))},n.default=o},{q:2,"querystring/encode":3}]},{},[7])}));var it=(o(ot,Ze),t(ot,[{key:"run",value:function(){this.runs=!0,this.background.initLoader()}},{key:"isRunning",value:function(){return this.runs}},{key:"next",value:function(e){var t=this;this.background.clear(),this.checkout=e;var n=String("/v1/echo");n=x.extendSearchParams(n,"public_key",this.publicKey),n=x.extendSearchParams(n,"json_body",encodeURIComponent(JSON.stringify({redirect_uri:this.checkout.link}))),Zip.Checkout.init({checkoutUri:this.echoEnv.getConf().url+n,onComplete:function(e){return t.eventHandler(e)},onError:function(e){return t.eventHandler(e)}})}},{key:"onStop",value:function(e){var t=this;this.eventEmitter.subscribe(Ke,function(){t.background.clear(),e()})}},{key:"onCheckout",value:function(e,t){var n=this;this.eventEmitter.subscribe(e,function(){t(n.checkout)})}},{key:"eventHandler",value:function(e){switch(this.runs=!1,e.state){case"approved":this.eventEmitter.emit(Ke,{}),this.eventEmitter.emit(Ye,{});break;case"declined":this.eventEmitter.emit(Ke,{}),this.eventEmitter.emit(Ge,{});break;case"cancelled":this.eventEmitter.emit(Ke,{});break;case"referred":this.eventEmitter.emit(Ke,{}),this.eventEmitter.emit(Je,{});break;default:console.warn("Unknown gateway status")}}},{key:"getSuccessRedirectUri",value:function(){return this.customRedirectUti?this.customRedirectUti:this.widgetEnv.getConf().url+String("/checkout/zipmoney")}},{key:"getErrorRedirectUri",value:function(){return this.getSuccessRedirectUri()}},{key:"setEnv",value:function(e,t){a(ot.prototype.__proto__||Object.getPrototypeOf(ot.prototype),"setEnv",this).call(this,e,t),this.echoEnv.setEnv(e,t)}}]),ot);function ot(e){l(this,ot);var t=c(this,(ot.__proto__||Object.getPrototypeOf(ot)).call(this));return t.publicKey=e,t.checkout=null,t.runs=!1,t.eventEmitter=new Le,t.echoEnv=new P([{env:f,url:"https://api-sandbox."},{env:v,url:"https://api-sandbox."},{env:m,url:"https://api-sandbox-demo."},{env:y,url:"https://api-sandbox-demo."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}]),t}o(rt,Te),t(rt,[{key:"getLink",value:function(){return String("/v1/gateways/:gateway_id").replace(":gateway_id",this.gatewayID)}},{key:"sendRequest",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.get(e,function(e,t){n(e)},function(e,t){void 0===e.message?i(t+": unknown error"):i(e.message)})}}],[{key:"sendRequest",value:function(e,t,n,i,o){var r=4<arguments.length&&void 0!==o?o:function(e){},a=new this(e);a.setEnv(n),a.sendRequest(t,i,r)}}]);function rt(e){l(this,rt);var t=c(this,(rt.__proto__||Object.getPrototypeOf(rt)).call(this));return t.gatewayID=e,t}var at="Zipmoney",st="PaypalClassic",ut="Afterpay",lt="paydock-dispatcher",ct=(t(dt,[{key:"restartDispatcher",value:function(){var e=document.getElementById(lt);e&&e.parentNode.removeChild(e);var t=document.createElement("iframe");t.setAttribute("src",this.env.getConf().url+"/dispatcher"),t.id=lt,t.style.display="none",document.body.appendChild(t)}},{key:"on",value:function(n,i){var o=this;le.subscribe("message",window,function(e){var t=null;try{t=JSON.parse(e.data)}catch(e){}t&&t.message_source===o.messageSource&&t.event===n&&i(t)})}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.restartDispatcher()}}]),dt);function dt(e){l(this,dt),this.messageSource=e,this.env=new P([{env:f,url:"https://widget-sandbox."},{env:v,url:"https://widget-sandbox."},{env:m,url:"https://widget-sandbox-demo."},{env:y,url:"https://widget-sandbox-demo."},{env:g,url:"https://widget."},{env:_,url:"https://widsta."},{env:k,url:"https://widsta-2."},{env:E,url:"https://widsta-3."},{env:b,url:"https://widsta-4."},{env:w,url:"https://widsta-5."}])}var ht=(t(pt,[{key:"isExist",value:function(){return!(!this.getElement()||this.getElement().closed)}},{key:"getElement",value:function(){return this.window}},{key:"init",value:function(){var e=this;if(!Me.isSupportPopUp())return this.window=window;var t=this.getConfigs();this.window=window.open("about:blank","_blank","width="+t.width+",height="+t.height+",top="+t.top+",left="+t.left+",scrollbars="+(t.scrollbars?"yes":"no")+",resizable="+(t.resizable?"yes":"no")),this.showLoader();var n=setInterval(function(){e.isExist()||(clearInterval(n),e.eventEmitter.emit("close",{}))},200)}},{key:"redirect",value:function(e){this.isExist()&&(this.window.location.href=e)}},{key:"close",value:function(){this.isExist()&&this.getElement().close&&(this.getElement().close(),this.window=null)}},{key:"focus",value:function(){this.isExist()&&this.getElement().focus&&this.getElement().focus()}},{key:"setConfigs",value:function(e){this.configs=A(this.configs,e)}},{key:"getNetConfigs",value:function(){return A({},this.configs)}},{key:"getConfigs",value:function(){var e=this.getNetConfigs();return e.left=window.screenX+(window.screen.width/2-e.width/2),e.top=window.screenY+(window.screen.height/2-e.height/2),e}},{key:"onClose",value:function(e){this.eventEmitter.subscribe("close",e)}},{key:"initError",value:function(e){this.getElement().document.write("."),(this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0]).innerHTML="<style>\n .error-wrapper {\n color: #ff0000;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n }\n </style>"+'<div class="error-wrapper"><div>{{error}}</div></div>'.replace("{{error}}",e)}},{key:"showLoader",value:function(){this.getElement().document.write(".");var e=this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0];if(e.innerHTML=Ue+De,this.env===_&&this.env===k&&this.env===E&&this.env===b&&this.env===w){var t=0;le.subscribe("click",e,function(){5==++t&&(e.innerHTML='\n <style>\n html{width: 100%;height: 100%;}\n body{margin: 0px;padding: 0px;background-color: #111;}\n \n .eye{\n width: 20px; height: 8px;\n background-color: #eee;\n border-radius:0px 0px 20px 20px;\n position: relative;\n top: 40px;\n left: 10px;\n box-shadow: 40px 0px 0px 0px #eee; \n }\n \n .head{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden; \n position: relative;\n margin: -250px auto;\n width: 80px; height: 80px;\n background-color: #111;\n border-radius:50px;\n box-shadow: inset -4px 2px 0px 0px #eee;\n -webkit-animation:node 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n .body{ \n position: relative;\n margin: 90px auto;\n width: 140px; height: 120px;\n background-color: #111;\n border-radius: 50px/25px ;\n box-shadow: inset -5px 2px 0px 0px #eee;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out; \n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out; \n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out; \n }\n \n @keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-moz-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-moz-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-webkit-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-webkit-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n \n \n .circ{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin: 60px auto;\n width: 180px; height: 180px;\n background-color: #111;\n border-radius: 0px 0px 50px 50px;\n position: relative;\n z-index: -1; \n left: 0%;\n top: 20%;\n overflow: hidden;\n }\n \n .hands{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin-top: 140px;\n width: 120px;height: 120px;\n position: absolute;\n background-color: #111;\n border-radius:20px;\n box-shadow:-1px -4px 0px 0px #eee;\n transform:rotate(45deg);\n -webkit-transform:rotate(45deg);\n -mox-transform:rotate(45deg);\n top:75%;left: 16%;\n z-index: 1;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n \n .load{ position: absolute;\n width: 100px; height: 20px;\n margin: -10px auto;\n -webkit-font-smoothing: antialiased;\n -moz-font-smoothing: antialiased;\n font-smoothing: antialiased;\n font-family: \'Julius Sans One\', sans-serif;\n font-size:30px;\n font-weight:400;\n color:#eee;\n left: 10%;\n top: 5%;\n }\n </style>\n\n <div class="circ">\n <div class="load">A little patience ...</div>\n <div class="hands"></div>\n <div class="body"></div>\n <div class="head">\n <div class="eye"></div>\n </div>\n </div>\n')})}}},{key:"setEnv",value:function(e){this.env=e}}]),pt);function pt(){l(this,pt),this.configs={width:500,height:500,scrollbars:!0,resizable:!0,top:0,left:0},this.eventEmitter=new Le}var ft=(o(vt,Ze),t(vt,[{key:"run",value:function(){this.isRunning()||(this.popup.init(),this.background.initControl())}},{key:"isRunning",value:function(){return this.popup.isExist()}},{key:"next",value:function(e){this.checkout=e,Me.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.checkout.link)}},{key:"continue",value:function(){this.popup.focus()}},{key:"stop",value:function(){this.popup.close()}},{key:"onStop",value:function(e){var t=this;this.popup.onClose(function(){t.background.clear(),t.checkout=null,e()})}},{key:"onCheckout",value:function(e,i){var o=this;this.dispatcher.on(e,function(e){if(o.checkout&&o.checkout.reference_id===e.reference_id)o.background.clear(),i(o.checkout);else if(!Me.isSupportPopUp()){var t=window.localStorage.getItem("paydock_checkout_token");if(!t)return;var n=JSON.parse(t);n&&n.reference_id===e.reference_id&&(window.localStorage.removeItem("paydock_checkout_token"),o.checkout=n,o.background.clear(),i(o.checkout))}})}},{key:"setEnv",value:function(e,t){a(vt.prototype.__proto__||Object.getPrototypeOf(vt.prototype),"setEnv",this).call(this,e,t),this.dispatcher.setEnv(e,t),this.popup.setEnv(e)}}]),vt);function vt(e){l(this,vt);var t=c(this,(vt.__proto__||Object.getPrototypeOf(vt)).call(this));return t.publicKey=e,t.checkout=null,t.dispatcher=new ct("checkout.paydock"),setTimeout(function(){return t.dispatcher.restartDispatcher()},200),t.popup=new ht,t}var mt=(o(yt,ft),t(yt,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+x.extendSearchParams("/checkout/success","merchant",encodeURIComponent(window.location.href))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+x.extendSearchParams("/checkout/error","merchant",encodeURIComponent(window.location.href))}}]),yt);function yt(){return l(this,yt),c(this,(yt.__proto__||Object.getPrototypeOf(yt)).apply(this,arguments))}var gt=(o(_t,ft),t(_t,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/success".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/error".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"next",value:function(e){this.checkout=e,Me.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.getRedirectUrl())}},{key:"error",value:function(e,t,n){return!t||t&&"invalid_amount"!==t?n(!0):(this.popup.initError(e),n(!1))}},{key:"run",value:function(){this.isRunning()||(this.popup.setConfigs({width:420,height:715}),this.popup.init(),this.background.initControl())}},{key:"getRedirectUrl",value:function(){var e="live"===this.checkout.mode?"live":"test";return this.widgetEnv.getConf().url+x.extendSearchParams("/checkout/afterpay/init","token",encodeURIComponent(this.checkout.reference_id))+"&env="+encodeURIComponent(e)}}]),_t);function _t(){return l(this,_t),c(this,(_t.__proto__||Object.getPrototypeOf(_t)).apply(this,arguments))}var kt={CLICK:"click",POPUP_REDIRECT:"popupRedirect",ERROR:"error",REFERRED:"referred",DECLINED:"declined",CANCELLED:"cancelled",ACCEPTED:"accepted",FINISH:"finish",CLOSE:"close"},Et=(t(bt,[{key:"initCheckout",value:function(){var n=this;this.container.on("click",function(e){if(!n.runner.isRunning()){n.eventEmitter.emit(kt.CLICK,{}),n.runner.run();var t=new Ae(n.gatewayId,n.runner.getSuccessRedirectUri(),n.runner.getErrorRedirectUri());t.setMeta(n.meta),t.setEnv(n.env),t.send(n.aceessToken,function(e){n.eventEmitter.emit(kt.POPUP_REDIRECT,{}),n.runner.next(e)},function(e,t){n.eventEmitter.emit(kt.ERROR,{}),n.runner.error(e,t,function(e){e&&n.close()})})}})}},{key:"initCheckoutHandlers",value:function(){var t=this;this.runner.onCheckout(Ye,function(e){t.eventEmitter.emit(kt.ACCEPTED,{}),t.background.initLoader(),t.close(),t.checkToken(e.token,function(){t.createOneTimeToken(e.token)})}),this.runner.onCheckout(Xe,function(){t.eventEmitter.emit(kt.ERROR,{}),console.error("Error from checkout server"),t.close()}),this.runner.onCheckout(Je,function(){t.eventEmitter.emit(kt.REFERRED,{}),t.close()}),this.runner.onCheckout(Ge,function(){t.eventEmitter.emit(kt.DECLINED,{}),t.close()}),this.eventEmitter.subscribe(kt.ERROR,function(){t.background.clear()}),this.eventEmitter.subscribe(kt.FINISH,function(){t.background.clear()})}},{key:"checkToken",value:function(e,t){var n=this,i=new xe(e);i.setEnv(this.env),i.send(this.aceessToken,function(e){n.details=e,t()},function(){n.eventEmitter.emit(kt.ERROR,{}),console.error("Error during creating payment source token")})}},{key:"createOneTimeToken",value:function(e){var t=this,n=new We(this.gatewayId,e,qe.CHECKOUT_TOKEN);n.setEnv(this.env),n.send(this.aceessToken,function(e){t.eventEmitter.emit(kt.FINISH,{payment_source_token:e,checkout_email:t.details.checkout_email,checkout_holder:t.details.checkout_holder,gateway_type:t.details.gateway_type})},function(){t.eventEmitter.emit(kt.ERROR,{}),console.error("Error during creating payment source token")})}},{key:"on",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"close",value:function(){this.runner.stop()}},{key:"onFinishInsert",value:function(t,n){this.on(kt.FINISH,function(e){le.insertToInput(t,n,e)})}},{key:"setMeta",value:function(e){this.meta=A(this.meta,e)}},{key:"setBackdropDescription",value:function(e){this.runner.setBackgroundDescription(e)}},{key:"setBackdropTitle",value:function(e){this.runner.setBackgroundTitle(e)}},{key:"setSuspendedRedirectUri",value:function(e){this.runner.setCustomRedirectUri(e)}},{key:"turnOffBackdrop",value:function(){this.turnOffControlBackdrop(),this.turnOffLoaderBackdrop()}},{key:"turnOffControlBackdrop",value:function(){this.runner.turnOffBackdrop()}},{key:"turnOffLoaderBackdrop",value:function(){this.background.turnOffLoader()}},{key:"setEnv",value:function(e,t){this.env=e,this.runner.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env}}]),bt);function bt(e,t){var n=this,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default",o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:st;switch(l(this,bt),this.aceessToken=t,this.gatewayId=i,this.gatewayType=o,this.details=null,this.meta={},this.env=C,this.eventEmitter=new Le,this.container=new de(e),this.background=new Be,o){case st:this.runner=new mt(t);break;case ut:this.runner=new gt(t);break;case at:this.runner=new it(t)}this.initCheckout(),this.initCheckoutHandlers(),this.runner.onStop(function(){n.eventEmitter.emit(kt.CLOSE,{})})}var wt=(o(St,Et),t(St,[{key:"setSuspendedRedirectUri",value:function(e){a(St.prototype.__proto__||Object.getPrototypeOf(St.prototype),"setSuspendedRedirectUri",this).call(this,e)}}]),St);function St(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default";l(this,St);var i=c(this,(St.__proto__||Object.getPrototypeOf(St)).call(this,e,t,n,at));return i.publicKey=t,i.gatewayId=n,i}var Ct=(o(Ot,Et),Ot);function Ot(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default";l(this,Ot);var i=c(this,(Ot.__proto__||Object.getPrototypeOf(Ot)).call(this,e,t,n,ut));return i.accessToken=t,i.gatewayId=n,i}var Tt,Pt,At=(o(Rt,Et),Rt);function Rt(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default";l(this,Rt);var i=c(this,(Rt.__proto__||Object.getPrototypeOf(Rt)).call(this,e,t,n,st));return i.publicKey=t,i.gatewayId=n,i}(Pt=Tt=Tt||{}).AFTER_LOAD="after_load",Pt.UNAVAILABLE="unavailable",Pt.START_LOADING="start_loading",Pt.END_LOADING="end_loading",Pt.UPDATE="update",Pt.PAYMENT_SUCCESSFUL="payment_successful",Pt.PAYMENT_IN_REVIEW="payment_in_review",Pt.PAYMENT_ERROR="payment_error";var xt=(o(It,me),t(It,[{key:"on",value:function(e,t,n){for(var i in Tt)Tt.hasOwnProperty(i)&&e===Tt[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}]),It);function It(){return l(this,It),c(this,(It.__proto__||Object.getPrototypeOf(It)).apply(this,arguments))}var Lt={CLOSE:"close",UPDATED:"updated"},Nt=(o(Dt,_e),t(Dt,[{key:"push",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.iFrame.isExist()){-1===j.values(Lt).indexOf(e)&&console.warn("unsupported trigger type");var i={message_source:"wallet.paydock",reference_id:this.widgetId,trigger:e,destination:"widget.paydock",data:n};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(i),"*")}}}]),Dt);function Dt(e,t){l(this,Dt);var n=c(this,(Dt.__proto__||Object.getPrototypeOf(Dt)).call(this,e));return n.widgetId=t,n}var Ut=(o(Mt,Be),t(Mt,[{key:"initControl",value:function(){this.imageStyle||this.createImageStyles(),a(Mt.prototype.__proto__||Object.getPrototypeOf(Mt.prototype),"initControl",this).call(this)}},{key:"clear",value:function(){this.imageStyle&&this.imageStyle.parentNode.removeChild(this.imageStyle),this.imageStyle=null,a(Mt.prototype.__proto__||Object.getPrototypeOf(Mt.prototype),"clear",this).call(this)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <div class="checkout-bg-logo"></div>\n <a href="#" data-close>Close</a>\n </div>\n');this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout(function(){e.isInit()&&e.overlay.classList.add("display")},5)}},{key:"createImageStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n }\n");document.querySelector(".checkout-container"),t=t.replace("{{url}}",this.bgImageUrl),this.imageStyle=document.createElement("style"),this.imageStyle.type="text/css",this.imageStyle.appendChild(document.createTextNode(t)),e.appendChild(this.imageStyle)}}]),Mt);function Mt(e){l(this,Mt);var t=c(this,(Mt.__proto__||Object.getPrototypeOf(Mt)).call(this));return t.bgImageUrl=e,t.imageStyle=null,t}var jt={UNAVAILABLE:"unavailable",UPDATE:"update",PAYMENT_METHOD_SELECTED:"payment_method_selected",PAYMENT_SUCCESS:"payment_success",PAYMENT_IN_REVIEW:"payment_in_review",PAYMENT_ERROR:"payment_error",CALLBACK:"callback"},Ft=(t(Ht,[{key:"initializeChildWallets",value:function(){this.childWallets=[]}},{key:"getGatewayName",value:function(){throw new Error("Method not implemented")}},{key:"setEnv",value:function(e){return this.env=e,this}},{key:"load",value:function(t){this.childWallets.forEach(function(e){return e.load(t)})}},{key:"update",value:function(){}},{key:"on",value:function(e,t){var n=this;if(-1===j.values(jt).indexOf(e))throw new Error("invalid wallet event");return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise(function(t){return n.eventEmitter.subscribe(e,function(e){return t(e)})})}}]),Ht);function Ht(e,t){l(this,Ht),this.publicKey=e,this.meta=t,this.env=f,this.eventEmitter=new Le,this.initializeChildWallets()}var Bt=(o(zt,Ft),t(zt,[{key:"load",value:function(e){this.container=e,this.iFrame=new pe(this.container);var t=this.link.getParams().widget_id;this.triggerElement=new Nt(this.iFrame,t),this.setupIFrameEvents(t),this.background=this.initBackground(),this.iFrame.load(this.link.getUrl())}},{key:"close",value:function(){this.triggerElement.push(Lt.CLOSE),this.background.clear()}},{key:"update",value:function(e){this.triggerElement.push(Lt.UPDATED,e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),this}},{key:"initBackground",value:function(){var e=this,t=new Ut(this.link.getNetUrl().replace(D,"/images/logo.png"));return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Fe,function(){return e.triggerElement.push(Lt.CLOSE)}),t}},{key:"setupIFrameEvents",value:function(e){var t=this;this.event.on(Tt.UNAVAILABLE,e,function(e){return t.eventEmitter.emit(jt.UNAVAILABLE,null)}),this.event.on(Tt.START_LOADING,e,function(e){return t.background.initControl()}),this.event.on(Tt.END_LOADING,e,function(e){return t.background.clear()}),this.event.on(Tt.UPDATE,e,function(e){t.eventEmitter.emit(jt.UPDATE,t.parseUpdateData(e))}),this.event.on(Tt.PAYMENT_SUCCESSFUL,e,function(e){t.eventEmitter.emit(jt.PAYMENT_SUCCESS,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()}),this.event.on(Tt.PAYMENT_IN_REVIEW,e,function(e){t.eventEmitter.emit(jt.PAYMENT_IN_REVIEW,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()}),this.event.on(Tt.PAYMENT_ERROR,e,function(e){t.eventEmitter.emit(jt.PAYMENT_ERROR,e),t.iFrame.getElement()||t.background.clear()})}},{key:"parsePaymentSuccessfulData",value:function(e){var t;return{id:this.meta.id,amount:e.amount,currency:e.currencyCode,status:null===(t=e.charge)||void 0===t?void 0:t.status}}},{key:"parseUpdateData",value:function(e){return A(A(A({wallet_response_code:e.responseCode,wallet_session_id:e.sessionId},e.paymentMethodDetails?{payment_source:{wallet_payment_method_id:e.paymentMethodDetails.paymentMethodId,card_number_last4:e.paymentMethodDetails.lastFourDigitsOfPan,card_scheme:e.paymentMethodDetails.paymentScheme}}:{}),e.loyaltyAccountSummary?{wallet_loyalty_account:{id:e.loyaltyAccountSummary.loyaltyAccountId,barcode:e.loyaltyAccountSummary.loyaltyAccountBarcode}}:{}),e.deliveryAddressDetails?{shipping:{address_line1:e.deliveryAddressDetails.line1,address_line2:e.deliveryAddressDetails.line2,address_postcode:e.deliveryAddressDetails.postalCode,address_city:e.deliveryAddressDetails.city,address_state:e.deliveryAddressDetails.state,address_country:e.deliveryAddressDetails.countryCode,address_company:e.deliveryAddressDetails.companyName,wallet_address_id:e.deliveryAddressDetails.addressId,post_office_box_number:e.deliveryAddressDetails.postOfficeBoxNumber,wallet_address_created_timestamp:e.deliveryAddressDetails.createdTimestamp,wallet_address_updated_timestamp:e.deliveryAddressDetails.updatedTimestamp,wallet_address_name:e.deliveryAddressDetails.name}}:{})}}]),zt);function zt(e,t){l(this,zt);var n=c(this,(zt.__proto__||Object.getPrototypeOf(zt)).call(this,e,t));n.link=new U(D);var i=t.amount,o=t.currency,r=t.id,a=t.gateway_mode,s=t.request_shipping;return n.link.setParams(A({token:e,amount:i,currency:o,gateway_mode:a,credentials:r},s?{request_shipping:s}:{})),n.token=e,n.event=new xt(window),n}var qt=(o(Wt,Ft),t(Wt,[{key:"load",value:function(e){var o=this;if(window.Promise){var t=e.getElement().id||"",n=document.createElement("script");n.src="https://www.paypal.com/sdk/js?client-id="+this.publicKey+"¤cy="+this.meta.currency+(!0===this.meta.pay_later?"&enable-funding=paylater&disable-funding=card":"&disable-funding=credit,card")+(this.meta.capture?"":"&intent=authorize"),n.async=!0,n.onload=function(){window.paypal?(o.paypal=window.paypal,o.paypal.Buttons(A(A({},o.meta.style&&{style:o.meta.style}),{createOrder:function(){return new Promise(function(t,n){o.eventEmitter.emit(jt.CALLBACK,{data:A({request_type:"CREATE_TRANSACTION"},o.meta.request_shipping&&{request_shipping:o.meta.request_shipping}),onSuccess:function(e){return t(e.id)},onError:function(e){return n(e)}})})},onShippingChange:function(i){return new Promise(function(e,t){var n=o.parseUpdateData(i);o.latestShippingData=n.shipping,o.latestShippingChangePromiseResolve=e,o.latestShippingChangePromiseReject=t,o.eventEmitter.emit(jt.UPDATE,n)})},onApprove:function(n){return new Promise(function(e,t){return o.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:{payment_method_id:n.orderID,customer:{payment_source:{external_payer_id:n.payerID}}},onSuccess:function(){return e(!0)},onError:function(e){return t(e)}})})},onError:function(){}})).render("#"+t)):o.eventEmitter.emit(jt.UNAVAILABLE,null)},document.head.appendChild(n)}else this.eventEmitter.emit(jt.UNAVAILABLE,null)}},{key:"update",value:function(e){var t=this;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject)return e.success?void this.eventEmitter.emit(jt.CALLBACK,{data:{request_type:"UPDATE_TRANSACTION",shipping:this.latestShippingData},onSuccess:function(){return t.latestShippingChangePromiseResolve(!0)},onError:function(){return t.latestShippingChangePromiseReject()}}):this.latestShippingChangePromiseReject()}},{key:"parseUpdateData",value:function(e){var t;return A(A({wallet_order_id:e.orderID,wallet_session_id:e.paymentID,payment_source:{wallet_payment_method_id:e.paymentToken}},e.shipping_address&&{shipping:{address_city:e.shipping_address.city,address_state:e.shipping_address.state,address_postcode:e.shipping_address.postal_code,address_country:e.shipping_address.country_code}}),e.selected_shipping_option&&{selected_shipping_option:{id:e.selected_shipping_option.id,label:e.selected_shipping_option.label,amount:e.selected_shipping_option.amount.value,currency:e.selected_shipping_option.amount.currency_code,type:null===(t=e.selected_shipping_option)||void 0===t?void 0:t.type}})}}]),Wt);function Wt(){return l(this,Wt),c(this,(Wt.__proto__||Object.getPrototypeOf(Wt)).apply(this,arguments))}var Vt=nt(function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"===G(Symbol.iterator)?function(e){return void 0===e?"undefined":G(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":G(e)})(e)}Object.defineProperty(t,"__esModule",{value:!0});function o(i){return null!==l?l:l=new Promise(function(e,t){if("undefined"!=typeof window)if(window.Stripe&&i&&console.warn(u),window.Stripe)e(window.Stripe);else try{var n=function(){for(var e=document.querySelectorAll('script[src^="'.concat(a,'"]')),t=0;t<e.length;t++){var n=e[t];if(s.test(n.src))return n}return null}();n&&i?console.warn(u):n=n||function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(a).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n}(i),n.addEventListener("load",function(){window.Stripe?e(window.Stripe):t(new Error("Stripe.js not available"))}),n.addEventListener("error",function(){t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else e(null)})}function i(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];c=!0;var i=Date.now();return o(r).then(function(e){return function(e,t,n){if(null===e)return null;var i,o,r=e.apply(void 0,t);return o=n,(i=r)&&i._registerWrapper&&i._registerWrapper({name:"stripe-js",version:"1.11.0",startTime:o}),r}(e,t,i)})}var r,a="https://js.stripe.com/v3",s=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,u="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",l=null,c=!1;i.setLoadParameters=function(e){if(c)throw new Error("You cannot change load parameters after calling loadStripe");r=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==n(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)}(e)},t.loadStripe=i});tt(Vt);Vt.loadStripe;var Yt=Vt.loadStripe,Gt="success",Kt="fail",Jt=(o(Xt,Ft),t(Xt,[{key:"initPaymentRequest",value:function(){return this.stripe.paymentRequest({country:this.meta.country.toUpperCase(),currency:this.meta.currency.toLowerCase(),total:{label:this.meta.amount_label,amount:Math.floor(100*this.meta.amount)},requestPayerName:!0===this.meta.request_payer_name,requestPayerEmail:!0===this.meta.request_payer_email,requestPayerPhone:!0===this.meta.request_payer_phone})}},{key:"createWalletButton",value:function(){return this.stripe.elements().create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"load",value:function(t){var n=this;return Yt(this.publicKey).then(function(e){n.stripe=e,n.paymentRequest=n.initPaymentRequest()}).then(function(){return n.checkAvailability()}).then(function(e){return n.mount(t,e)}).then(function(){return n.setOnPaymentMethodSelected()})}},{key:"checkAvailability",value:function(){var i=this;return this.paymentRequest.canMakePayment().then(function(e){if(e){var t=!i.meta.wallets||i.meta.wallets.includes(z.GOOGLE),n=!i.meta.wallets||i.meta.wallets.includes(z.APPLE);return{google_pay:t&&!e.applePay,apple_pay:n&&e.applePay,flypay:!1}}})}},{key:"mount",value:function(e,t){if(!t||!t.apple_pay&&!t.google_pay)return this.eventEmitter.emit(jt.UNAVAILABLE,null);this.createWalletButton().mount(e.getElement())}},{key:"setOnPaymentMethodSelected",value:function(){var c=this;this.paymentRequest.on("paymentmethod",function(e){var t,n,i=e.paymentMethod,o=i.id,r=i.card,a=i.billing_details,s=a.name,u=a.address,l={payment_method_id:o,customer:{payer_name:e.payerName,payer_email:e.payerEmail,payer_phone:e.payerPhone,payment_source:{wallet_type:c.getWalletType(null===(t=null==r?void 0:r.wallet)||void 0===t?void 0:t.type),card_name:s,type:null===(n=null==r?void 0:r.wallet)||void 0===n?void 0:n.type,card_scheme:null==r?void 0:r.brand,card_number_last4:null==r?void 0:r.last4,expire_month:null==r?void 0:r.exp_month,expire_year:null==r?void 0:r.exp_year,address_line1:u.line1,address_line2:u.line2,address_city:u.city,address_postcode:u.postal_code,address_state:u.state,address_country:u.country}}};c.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:l,onSuccess:function(){return e.complete(Gt)},onError:function(){return e.complete(Kt)}})})}},{key:"getWalletType",value:function(e){return e?"google_pay"===e?z.GOOGLE:z.APPLE:null}}]),Xt);function Xt(){return l(this,Xt),c(this,(Xt.__proto__||Object.getPrototypeOf(Xt)).apply(this,arguments))}var Zt=(o(Qt,Ft),t(Qt,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[z.APPLE])||void 0===n?void 0:n.merchant)||""}},{key:"getMetaStyles",value:function(){var e,t,n;if(null!==(e=this.meta)&&void 0!==e&&e.style&&"object"===G(null===(t=this.meta)||void 0===t?void 0:t.style)){var i=JSON.parse(JSON.stringify(null===(n=this.meta)||void 0===n?void 0:n.style));return"google"in i&&(null==i||delete i.google),"apple"in i?null==i?void 0:i.apple:i}return null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i;if(null!==(e=this.meta)&&void 0!==e&&e.raw_data_initialization&&null!==(t=this.meta)&&void 0!==t&&t.raw_data_initialization&&"object"===G(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)){var o=JSON.parse(JSON.stringify(null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization));return"google"in o&&(null==o||delete o.google),"apple"in o?null==o?void 0:o.apple:o}return null}},{key:"isShippingRequired",value:function(){var e;return null===(e=this.meta)||void 0===e?void 0:e.request_shipping}},{key:"hasShippingOptions",value:function(){var e,t;return(null===(e=this.meta)||void 0===e?void 0:e.request_shipping)&&!(null===(t=this.meta)||void 0===t||!t.shipping_options)}},{key:"load",value:function(n){var i=this;if(window.Promise)return this.checkAvailability().then(function(e){var t;e?(i.isShippingRequired()&&i.hasShippingOptions()&&(i.selectedShippingOption=null===(t=i.meta)||void 0===t?void 0:t.shipping_options[0],i.latestShippingData.shippingMethod=i.formatShippingOptions([i.selectedShippingOption])[0]),i.mount(n)):i.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.APPLE})}).catch(function(e){return console.error("Error checking ApplePay availability",e)});this.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.APPLE})}},{key:"update",value:function(e){var t,n,i;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success||!e.body)return this.latestShippingChangePromiseReject();var o=null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount,r=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;o&&(this.meta.amount=o),r&&(this.meta.shipping_options=r,this.selectedShippingOption=r?r[0]:void 0);var a=A({newTotal:{label:null===(i=this.meta)||void 0===i?void 0:i.amount_label,amount:this.meta.amount.toString(),type:"final"}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingMethods:this.formatShippingOptions(this.meta.shipping_options)});this.paymentSession.completeShippingContactSelection(a),this.latestShippingChangePromiseResolve({})}}},{key:"checkAvailability",value:function(){var n=this;return new Promise(function(t,e){window.ApplePaySession&&ApplePaySession||t(!1),ApplePaySession.canMakePaymentsWithActiveCard(n.getMerchantId()).then(function(e){return t(e)}).catch(function(e){return t(!1)})})}},{key:"mount",value:function(e){var t=this,n=document.createElement("style");n.innerHTML=this.createButtonStyle(),document.head.appendChild(n);var i=document.createElement("div");i.onclick=function(){return t.onApplePayButtonClicked()},i.classList.add("paydock-apple-container","apple-pay-button","apple-pay-button-black"),e.getElement().appendChild(i)}},{key:"onApplePayButtonClicked",value:function(){this.paymentSession=new ApplePaySession(3,this.createRequest()),this.paymentSession.onvalidatemerchant=this.onValidateMerchant,this.paymentSession.onpaymentauthorized=this.onPaymentAuthorized,this.paymentSession.onshippingcontactselected=this.onShippingContactSelected,this.paymentSession.onshippingmethodselected=this.onShippingMethodSelected,this.paymentSession.begin()}},{key:"createRequest",value:function(){var e,t=this.getMetaRawDataInitialization();return t&&"object"===(void 0===t?"undefined":G(t))&&("object"===G(t.total)?t.total.amount=this.meta.amount.toString():t.total={label:(null===(e=this.meta)||void 0===e?void 0:e.amount_label)||"",amount:this.meta.amount.toString()},this.isShippingRequired()&&this.hasShippingOptions()&&(t.shippingMethods=this.formatShippingOptions(this.meta.shipping_options))),t||A(A(A({countryCode:this.meta.country.toUpperCase(),currencyCode:this.meta.currency.toUpperCase(),merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard","amex","discover"]},this.meta.show_billing_address&&{requiredBillingContactFields:["name","postalAddress"]}),this.isShippingRequired()&&A({requiredShippingContactFields:["postalAddress","name","phone","email"]},this.hasShippingOptions()&&{shippingMethods:this.formatShippingOptions(this.meta.shipping_options)})),{total:{label:this.meta.amount_label,amount:this.meta.amount.toString(),type:"final"}})}},{key:"getMerchantSession",value:function(){var e=this;return new Promise(function(t,n){return e.eventEmitter.emit(jt.CALLBACK,{data:A({request_type:"CREATE_SESSION",wallet_type:z.APPLE,session_id:window.location.hostname},e.isShippingRequired()&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e)},onError:function(e){return n(e)}})})}},{key:"createButtonStyle",value:function(){var e,t;return"\n .paydock-apple-container {\n width: 100%;\n height: 40px;\n }\n\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: "+((null===(e=this.getMetaStyles())||void 0===e?void 0:e.button_type)||"plain")+"\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n -apple-pay-button-type: "+((null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"plain")+"\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n "}}]),Qt);function Qt(e,t,n,i){l(this,Qt);var s=c(this,(Qt.__proto__||Object.getPrototypeOf(Qt)).call(this,e,t));return s.gatewayName=n,s.eventEmitter=i,s.latestShippingData={},s.onValidateMerchant=function(e){s.getMerchantSession().then(function(e){s.paymentSession.completeMerchantValidation(e)}).catch(function(e){return console.error("Error fetching merchant session",e)})},s.onPaymentAuthorized=function(e){var t,n=e.payment,i=n.token,o=n.billingContact,r=n.shippingContact;s.latestShippingData.shippingContact=r;var a=null===(t=s.selectedShippingOption)||void 0===t?void 0:t.type;s.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:A({customer:{payment_source:{wallet_type:z.APPLE,card_name:i.paymentMethod.displayName,type:i.paymentMethod.type,card_scheme:i.paymentMethod.network,address_line1:null==o?void 0:o.addressLines[0],address_line2:null==o?void 0:o.addressLines[1],address_country:null==o?void 0:o.countryCode,address_city:null==o?void 0:o.locality,address_postcode:null==o?void 0:o.postalCode,address_state:null==o?void 0:o.administrativeArea,ref_token:i.paymentData?JSON.stringify(i.paymentData):""}}},s.meta.request_shipping&&r&&{shipping:A(A(A({},a&&{method:a}),s.hasShippingOptions()&&{options:s.meta.shipping_options}),{address_line1:r.addressLines[0],address_line2:r.addressLines[1],address_country:r.countryCode,address_city:r.locality,address_postcode:r.postalCode,address_state:r.administrativeArea,contact:{first_name:r.givenName,last_name:r.familyName,email:r.emailAddress,phone:r.phoneNumber}})}),onSuccess:function(){return s.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS)},onError:function(){return s.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE)}})},s.onShippingContactSelected=function(e){s.latestShippingData.shippingContact=e.shippingContact;var t=s.parseUpdateData(s.latestShippingData);return s.eventEmitter.emit(jt.UPDATE,t),new Promise(function(e,t){s.latestShippingChangePromiseResolve=e,s.latestShippingChangePromiseReject=t})},s.onShippingMethodSelected=function(e){var t,n;s.latestShippingData.shippingMethod=e.shippingMethod;var i={newTotal:{label:s.meta.amount_label||(null===(n=null===(t=s.getMetaRawDataInitialization())||void 0===t?void 0:t.total)||void 0===n?void 0:n.label),amount:s.meta.amount.toString(),type:"final"}};s.paymentSession.completeShippingMethodSelection(i)},s.parseUpdateData=function(e){var t,n,i,o,r,a,s,u;return A({shipping:{address_city:null===(t=null==e?void 0:e.shippingContact)||void 0===t?void 0:t.locality,address_state:null===(n=null==e?void 0:e.shippingContact)||void 0===n?void 0:n.administrativeArea,address_postcode:null===(i=null==e?void 0:e.shippingContact)||void 0===i?void 0:i.postalCode,address_country:null===(o=null==e?void 0:e.shippingContact)||void 0===o?void 0:o.countryCode}},(null==e?void 0:e.shippingMethod)&&{selected_shipping_option:{id:null===(r=null==e?void 0:e.shippingMethod)||void 0===r?void 0:r.identifier,label:null===(a=null==e?void 0:e.shippingMethod)||void 0===a?void 0:a.label,detail:null===(s=null==e?void 0:e.shippingMethod)||void 0===s?void 0:s.detail,amount:null===(u=null==e?void 0:e.shippingMethod)||void 0===u?void 0:u.amount}})},s.formatShippingOptions=function(e){return e.map(function(e){return{identifier:e.id,label:e.label,detail:(null==e?void 0:e.detail)||"",amount:e.amount}})},s.eventEmitter=i,s}var $t=(o(en,Ft),t(en,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[z.GOOGLE])||void 0===n?void 0:n.merchant}},{key:"getMetaStyles",value:function(){var e,t,n,i;return"object"===G(null===(e=this.meta)||void 0===e?void 0:e.style)&&"google"in(null===(t=this.meta)||void 0===t?void 0:t.style)?null===(i=null===(n=this.meta)||void 0===n?void 0:n.style)||void 0===i?void 0:i.google:null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i,o;return null!==(e=this.meta)&&void 0!==e&&e.raw_data_initialization&&"object"===G(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"google"in(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)?null===(o=null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization)||void 0===o?void 0:o.google:null}},{key:"isShippingRequired",value:function(){return this.meta.request_shipping}},{key:"hasShippingOptions",value:function(){return this.meta.request_shipping&&!!this.meta.shipping_options}},{key:"load",value:function(r){var a=this;if(window.Promise)return new Promise(function(i,o){var e=document.createElement("script");e.type="text/javascript",e.src="https://pay.google.com/gp/p/js/pay.js",e.async=!0,e.onload=function(){var e,t,n;if(!window.google)return a.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.GOOGLE}),void o();a.isShippingRequired()&&a.hasShippingOptions()&&(a.selectedShippingOption=null===(e=a.meta)||void 0===e?void 0:e.shipping_options[0]),a.paymentsClient=new google.payments.api.PaymentsClient(A({merchantInfo:A(A({},null!==(t=a.meta)&&void 0!==t&&t.merchant_name?{merchantName:null===(n=a.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:a.getMerchantId()}),paymentDataCallbacks:A({onPaymentAuthorized:function(e){return a.onPaymentAuthorized(e)}},a.isShippingRequired()&&{onPaymentDataChanged:function(e){return a.onPaymentDataChanged(e)}})},a.env!==g?{environment:"TEST"}:{environment:"PRODUCTION"})),a.checkAvailability().then(function(e){if(!e)return a.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.GOOGLE}),void o();a.mount(r),i()})},document.head.appendChild(e)});this.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.GOOGLE})}},{key:"update",value:function(e){var t,n,i,o;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success)return this.latestShippingChangePromiseReject();var r=(null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount)||this.meta.amount,a=(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options)||this.meta.shipping_options;r&&(this.meta.amount=r),a&&(this.meta.shipping_options=a,this.selectedShippingOption=a?a[0]:void 0);var s=A({newTransactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:null===(i=this.meta.amount)||void 0===i?void 0:i.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingOptionParameters:{defaultSelectedOptionId:null===(o=this.selectedShippingOption)||void 0===o?void 0:o.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}});this.latestShippingChangePromiseResolve(s)}}},{key:"checkAvailability",value:function(){return this.paymentsClient.isReadyToPay(this.createRequest()).then(function(e){return!!e.result}).catch(function(e){return console.error("Error checking GooglePay availability",e),!1})}},{key:"mount",value:function(e){var t,n,i,o=this;e.getElement().appendChild(this.paymentsClient.createButton({onClick:function(){return o.loadPaymentData()},buttonType:(null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"pay",buttonSizeMode:(null===(n=this.getMetaStyles())||void 0===n?void 0:n.button_size_mode)||"fill",buttonColor:(null===(i=this.getMetaStyles())||void 0===i?void 0:i.button_color)||"default"}))}},{key:"loadPaymentData",value:function(){this.paymentsClient.loadPaymentData(this.createPaymentDataRequest()).catch(function(){console.error("Error while loading payment data")})}},{key:"onPaymentAuthorized",value:function(b){var e,t,n,i,o,r,a,s,u,w=this,S=null===(n=null===(t=null===(e=b.paymentMethodData)||void 0===e?void 0:e.info)||void 0===t?void 0:t.billingAddress)||void 0===n?void 0:n.address1,C=null===(r=null===(o=null===(i=b.paymentMethodData)||void 0===i?void 0:i.info)||void 0===o?void 0:o.billingAddress)||void 0===r?void 0:r.address2,O=null===(a=null==b?void 0:b.shippingAddress)||void 0===a?void 0:a.address1,T=null===(s=null==b?void 0:b.shippingAddress)||void 0===s?void 0:s.address2,P=null===(u=this.selectedShippingOption)||void 0===u?void 0:u.type;return new Promise(function(t){var e,n,i,o,r,a,s,u,l,c,d,h,p,f,v,m,y,g,_,k,E;return w.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:A({customer:{payment_source:A(A(A(A({wallet_type:z.GOOGLE,card_name:null===(e=b.paymentMethodData)||void 0===e?void 0:e.description,type:b.paymentMethodData.type,card_scheme:null===(i=null===(n=b.paymentMethodData)||void 0===n?void 0:n.info)||void 0===i?void 0:i.cardNetwork},S&&{address_line1:S}),C&&{address_line2:C}),C&&{address_line2:C}),{address_country:null===(a=null===(r=null===(o=b.paymentMethodData)||void 0===o?void 0:o.info)||void 0===r?void 0:r.billingAddress)||void 0===a?void 0:a.countryCode,address_city:null===(l=null===(u=null===(s=b.paymentMethodData)||void 0===s?void 0:s.info)||void 0===u?void 0:u.billingAddress)||void 0===l?void 0:l.locality,address_postcode:null===(h=null===(d=null===(c=b.paymentMethodData)||void 0===c?void 0:c.info)||void 0===d?void 0:d.billingAddress)||void 0===h?void 0:h.postalCode,address_state:null===(v=null===(f=null===(p=b.paymentMethodData)||void 0===p?void 0:p.info)||void 0===f?void 0:f.billingAddress)||void 0===v?void 0:v.administrativeArea,ref_token:b.paymentMethodData.tokenizationData.token})}},w.isShippingRequired()&&{shipping:A(A(A(A(A({},P&&{method:P}),w.hasShippingOptions()&&{options:w.meta.shipping_options}),O&&{address_line1:O}),T&&{address_line2:T}),{address_country:null===(m=null==b?void 0:b.shippingAddress)||void 0===m?void 0:m.countryCode,address_city:null===(y=null==b?void 0:b.shippingAddress)||void 0===y?void 0:y.locality,address_postcode:null===(g=null==b?void 0:b.shippingAddress)||void 0===g?void 0:g.postalCode,address_state:null===(_=null==b?void 0:b.shippingAddress)||void 0===_?void 0:_.administrativeArea,contact:{first_name:null===(k=null==b?void 0:b.shippingAddress)||void 0===k?void 0:k.name,email:null==b?void 0:b.email,phone:null===(E=null==b?void 0:b.shippingAddress)||void 0===E?void 0:E.phoneNumber}})}),onSuccess:function(){return t({transactionState:"SUCCESS"})},onError:function(e){return t({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:e,reason:"PAYMENT_DATA_INVALID"}})}})})}},{key:"onPaymentDataChanged",value:function(e){var n=this;if(this.isShippingRequired()){var t=this.parseUpdateData(e);return this.eventEmitter.emit(jt.UPDATE,t),new Promise(function(e,t){n.latestShippingChangePromiseResolve=e,n.latestShippingChangePromiseReject=t})}}},{key:"createRequest",value:function(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.createCardData()],existingPaymentMethodRequired:!0}}},{key:"createPaymentDataRequest",value:function(){var e,t,n,i;this.isShippingRequired()&&this.hasShippingOptions()&&(this.selectedShippingOption=null===(e=this.meta)||void 0===e?void 0:e.shipping_options[0]);var o=this.getMerchantId();return A({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[A(A({},this.createCardData()),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"paydock",gatewayMerchantId:o}}})],transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:this.meta.amount.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()},merchantInfo:A(A({},null!==(t=this.meta)&&void 0!==t&&t.merchant_name?{merchantName:null===(n=this.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:o}),callbackIntents:["PAYMENT_AUTHORIZATION"].concat(r(this.isShippingRequired()?["SHIPPING_ADDRESS"]:[]),r(this.hasShippingOptions()?["SHIPPING_OPTION"]:[]))},this.isShippingRequired()&&A({shippingAddressRequired:!0},this.hasShippingOptions()&&{shippingOptionRequired:!0,shippingOptionParameters:{defaultSelectedOptionId:null===(i=this.selectedShippingOption)||void 0===i?void 0:i.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}}))}},{key:"createCardData",value:function(){return this.getMetaRawDataInitialization()||{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!!this.meta.show_billing_address}}}}]),en);function en(e,t,n,i){l(this,en);var u=c(this,(en.__proto__||Object.getPrototypeOf(en)).call(this,e,t));return u.gatewayName=n,u.eventEmitter=i,u.parseUpdateData=function(n){var e,t,i,o,r,a,s=null===(t=null===(e=u.meta)||void 0===e?void 0:e.shipping_options)||void 0===t?void 0:t.find(function(e){var t;return e.id===(null===(t=null==n?void 0:n.shippingOptionData)||void 0===t?void 0:t.id)});return A({shipping:{address_city:null===(i=n.shippingAddress)||void 0===i?void 0:i.locality,address_state:null===(o=n.shippingAddress)||void 0===o?void 0:o.administrativeArea,address_postcode:null===(r=null==n?void 0:n.shippingAddress)||void 0===r?void 0:r.postalCode,address_country:null===(a=null==n?void 0:n.shippingAddress)||void 0===a?void 0:a.countryCode}},s&&{selected_shipping_option:{id:null==s?void 0:s.id,label:null==s?void 0:s.label,detail:null==s?void 0:s.detail,type:null==s?void 0:s.type}})},u.formatShippingOptions=function(e){return e.map(function(e){return{id:e.id,label:e.label,description:(null==e?void 0:e.detail)||""}})},u.eventEmitter=i,u}var tn,nn,on=(o(rn,Ft),t(rn,[{key:"initializeChildWallets",value:function(){var e,t,n,i,o,r;this.childWallets=[];var a=!(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t.apple)||void 0===n||!n.merchant),s=!(null===(r=null===(o=null===(i=this.meta)||void 0===i?void 0:i.credentials)||void 0===o?void 0:o.google)||void 0===r||!r.merchant);!a||this.meta.wallets&&!this.meta.wallets.includes(z.APPLE)||this.childWallets.push(new Zt(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter)),!s||this.meta.wallets&&!this.meta.wallets.includes(z.GOOGLE)||this.childWallets.push(new $t(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter))}},{key:"getGatewayName",value:function(){return H.MASTERCARD}},{key:"update",value:function(t){this.childWallets.forEach(function(e){return e.update(t)})}}]),rn);function rn(){return l(this,rn),c(this,(rn.__proto__||Object.getPrototypeOf(rn)).apply(this,arguments))}(nn=tn=tn||{})[nn.PUBLIC_KEY=0]="PUBLIC_KEY",nn[nn.TOKEN=1]="TOKEN";var an=(t(sn,[{key:"setEnv",value:function(e,t){return this.env.setEnv(e,t),this}},{key:"setAuthType",value:function(){return this.authType=h.validateJWT(this.auth)?tn.TOKEN:tn.PUBLIC_KEY}},{key:"getClient",value:function(e,t){var i=this,o=new XMLHttpRequest;return o.open(e,this.env.getConf().url+t,!0),o.setRequestHeader("Content-Type","application/json; charset=UTF-8"),this.setAuthHeader(o),{config:o,send:function(e,t,n){o.onload=function(){return i.parser({text:o.responseText,status:o.status},t,n)},o.send(JSON.stringify(e))}}}},{key:"getClientPromise",value:function(e,t){var i=this,o=new XMLHttpRequest;return o.open(e,this.env.getConf().url+t,!0),o.setRequestHeader("Content-Type","application/json; charset=UTF-8"),this.setAuthHeader(o),{config:o,send:function(n){return new Promise(function(e,t){o.onload=function(){return e({text:o.responseText,status:o.status})},o.send(JSON.stringify(n))}).then(function(e){return i.parserPromise(e)})}}}},{key:"parser",value:function(e,t,n){var i=e.text,o=e.status;try{var r=JSON.parse(i);if(200<=o&&o<300||302===o)return t(r.resource.data);n(r.error||{message:"unknown error"})}catch(e){}}},{key:"parserPromise",value:function(e){var t=e.text,n=e.status;try{var i=JSON.parse(t);return 200<=n&&n<300||302===n?Promise.resolve(i.resource.data):Promise.reject(i.error||{message:"unknown error"})}catch(e){return Promise.reject(e)}}},{key:"setAuthHeader",value:function(e){switch(this.authType){case tn.PUBLIC_KEY:e.setRequestHeader("x-user-public-key",this.auth);break;case tn.TOKEN:e.setRequestHeader("x-access-token",this.auth)}}}]),sn);function sn(e,t){l(this,sn),this.auth=e,this.authType=t||this.setAuthType(),this.env=new P([{env:f,url:"https://api-sandbox."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}])}var un=(t(ln,[{key:"walletCapture",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/capture").send(e)}},{key:"walletCallback",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/callback").send(e)}},{key:"standalone3dsProcess",value:function(e){return this.api.getClientPromise("POST","/v1/charges/standalone-3ds/process").send(e)}},{key:"standalone3dsHandle",value:function(){return this.api.getClientPromise("GET","/v1/charges/standalone-3ds/handle").send(void 0)}}]),ln);function ln(e){l(this,ln),this.api=e}var cn=(o(dn,an),t(dn,[{key:"charge",value:function(){return new un(this)}}]),dn);function dn(){return l(this,dn),c(this,(dn.__proto__||Object.getPrototypeOf(dn)).apply(this,arguments))}var hn="unavailable",pn="update",fn="paymentSuccessful",vn="paymentError",mn="paymentInReview",yn=(t(gn,[{key:"load",value:function(){try{this.setupServiceCallbacks(),this.service.load(this.container)}catch(e){throw this.eventEmitter.emit(hn,null),e}}},{key:"update",value:function(e){this.service.update(e)}},{key:"setEnv",value:function(e,t){this.api.setEnv(e,t),this.service.setEnv(e)}},{key:"close",value:function(){"function"==typeof this.service.close&&this.service.close()}},{key:"on",value:function(e,t){var n=this;return e===pn&&(this.hasUpdateHandler=!0),"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise(function(t){return n.eventEmitter.subscribe(e,function(e){return t(e)})})}},{key:"onUnavailable",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(hn,e):new Promise(function(e){return t.eventEmitter.subscribe(hn,function(){return e()})})}},{key:"onUpdate",value:function(e){var n=this;return this.hasUpdateHandler=!0,"function"==typeof e?this.eventEmitter.subscribe(pn,e):new Promise(function(t){return n.eventEmitter.subscribe(pn,function(e){return t(e)})})}},{key:"onPaymentSuccessful",value:function(e){var n=this;return"function"==typeof e?this.eventEmitter.subscribe(fn,e):new Promise(function(t){return n.eventEmitter.subscribe(fn,function(e){return t(e)})})}},{key:"onPaymentInReview",value:function(e){var n=this;return"function"==typeof e?this.eventEmitter.subscribe(mn,e):new Promise(function(t){return n.eventEmitter.subscribe(mn,function(e){return t(e)})})}},{key:"onPaymentError",value:function(e){var n=this;return"function"==typeof e?this.eventEmitter.subscribe(vn,e):new Promise(function(t){return n.eventEmitter.subscribe(vn,function(e){return t(e)})})}},{key:"setupServiceCallbacks",value:function(){this.setupUnavailableCallback(),this.setupUpdateCallback(),this.setupWalletCallback(),this.setupPaymentCallback(),this.setupPaymentSuccessCallback(),this.setupPaymentInReviewCallback(),this.setupPaymentErrorCallback()}},{key:"setupUnavailableCallback",value:function(){var t=this;this.service.on(jt.UNAVAILABLE,function(e){return t.eventEmitter.emit(hn,{event:hn,data:e})})}},{key:"setupUpdateCallback",value:function(){var t=this;this.service.on(jt.UPDATE,function(e){return t.hasUpdateHandler?t.eventEmitter.emit(pn,{event:pn,data:e}):t.update({success:!0})})}},{key:"setupWalletCallback",value:function(){var o=this;this.service.on(jt.CALLBACK,function(e){var t=e.data,n=e.onSuccess,i=e.onError;o.api.charge().walletCallback(t).then(function(e){return n(e)},function(e){return i(e.message)})})}},{key:"setupPaymentCallback",value:function(){var o=this;this.service.on(jt.PAYMENT_METHOD_SELECTED,function(e){var n=e.data,i=e.onSuccess,t=e.onError;o.api.charge().walletCapture(n).then(function(e){"function"==typeof i&&i();var t="inreview"===e.status?mn:fn;o.eventEmitter.emit(t,{event:t,data:A(A({},e),n.customer&&{payer_name:n.customer.payer_name,payer_email:n.customer.payer_email,payer_phone:n.customer.payer_phone})})},function(e){"function"==typeof t&&t(e),o.eventEmitter.emit(vn,{event:vn,data:e})})})}},{key:"setupPaymentSuccessCallback",value:function(){var t=this;this.service.on(jt.PAYMENT_SUCCESS,function(e){return t.eventEmitter.emit(fn,{event:fn,data:e})})}},{key:"setupPaymentInReviewCallback",value:function(){var t=this;this.service.on(jt.PAYMENT_IN_REVIEW,function(e){return t.eventEmitter.emit(mn,{event:mn,data:e})})}},{key:"setupPaymentErrorCallback",value:function(){var t=this;this.service.on(jt.PAYMENT_ERROR,function(e){return t.eventEmitter.emit(vn,{event:vn,data:e})})}}]),gn);function gn(e,t,n){l(this,gn),this.hasUpdateHandler=!1;var i=h.validateJWT(t);if(!i)throw new Error("Invalid charge token");this.eventEmitter=new Le,this.container=new de(e);var o=h.extractMeta(i.body);switch(this.api=new cn(t,tn.TOKEN),o.gateway.type){case H.STRIPE:this.service=new Jt(o.credentials.client_auth,A(A({},n),{amount:o.charge.amount,currency:o.charge.currency}));break;case H.FLYPAY:this.service=new Bt(t,A(A({},n),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency}));break;case H.PAYPAL:this.service=new qt(o.credentials.client_auth,A(A({},n),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,capture:o.charge.capture}));break;case H.MASTERCARD:this.service=new on("",A(A({},n),{credentials:o.gateway.credentials,amount:o.charge.amount,currency:o.charge.currency}))}}var _n=(t(kn,[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==j.values(Y).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setStyle[s: unsupported style param "+e)}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"setLimit",value:function(e){this.link.setParams({limit:e})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"getIFrameUrl",value:function(){return this.link.getUrl()}},{key:"filterByGatewayIds",value:function(e){this.link.setParams({gateway_ids:e.join(",")})}},{key:"filterByTypes",value:function(e){var t=[],n=!0,i=!1,o=void 0;try{for(var r,a=e[Symbol.iterator]();!(n=(r=a.next()).done);n=!0){var s=r.value;e.hasOwnProperty(s)&&(-1===j.values(W).indexOf(s)?console.warn("PaymentSourceWidget::filterByTypes: unsupported type "+s):t.push(s))}}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}this.link.setParams({payment_source_types:t.join(",")})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}]),kn);function kn(e,t){l(this,kn),this.configs=[],this.configTokens=[],this.link=new U("/payment-sources"),this.link.setParams({public_key:e,query_token:t})}var En=(o(bn,_n),t(bn,[{key:"load",value:function(){this.iFrame.load(this.getIFrameUrl(),{title:"Payment Sources"})}},{key:"on",value:function(e,t){this.event.on(e,this.link.getParams().widget_id,t)}},{key:"hide",value:function(e){console.info("PayDock SDK"),this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"onSelectInsert",value:function(t,n){this.on(ve.SELECT,function(e){le.insertToInput(t,n,e)})}}]),bn);function bn(e,t,n){l(this,bn);var i=c(this,(bn.__proto__||Object.getPrototypeOf(bn)).call(this,t,n));return i.container=new de(e),i.iFrame=new pe(i.container),i.event=new me(window),i}var wn,Sn,Cn={visibility:"hidden",border:"0",width:"0",height:"0"};(Sn=wn=wn||{}).SUCCESS="success",Sn.ERROR="error",Sn.PENDING="pending";var On="chargeAuthSuccess",Tn="chargeAuthReject",Pn="chargeAuthDecoupled",An="chargeAuthChallenge",Rn="error",xn=(t(In,[{key:"load",value:function(e,t){var n=e.initialization_url,i=e.secondary_url,o=e.charge_3ds_id;try{this.setupIFrameEvents(o),this.initializeIFrames(n,i,t)}catch(e){this.eventEmitter.emit(Rn,this.parseError(e,o))}}},{key:"initializeIFrames",value:function(e,t,n,i){var o=!(3<arguments.length&&void 0!==i)||i,r=document.createElement("div");r.setAttribute("id","paydock_authorization_iframe"),this.container.getElement().appendChild(r),this.browserAndChallengeContainer=new de("#paydock_authorization_iframe"),this.iFrameAuthorization=new pe(this.browserAndChallengeContainer),this.iFrameAuthorization.load(e,{title:n});var a=document.createElement("div");a.setAttribute("id","paydock_secondary_iframe"),this.container.getElement().appendChild(a),this.monitoringContainer=new de("#paydock_secondary_iframe"),this.iFrameSecondaryUrl=new pe(this.monitoringContainer),this.iFrameSecondaryUrl.load(t,{title:n}),this.hideIframes(o)}},{key:"hideIframes",value:function(e){var t=!(0<arguments.length&&void 0!==e)||e;for(var n in Cn)Cn.hasOwnProperty(n)&&(t&&this.iFrameAuthorization.setStyle(n,Cn[n]),this.iFrameSecondaryUrl.setStyle(n,Cn[n]))}},{key:"setupIFrameEvents",value:function(e){var t=this;this.iFrameEvent.on(ve.CHARGE_AUTH,e,function(e){"MethodSkipped"===e.status&&t.performAuthentication(e)}),this.iFrameEvent.on(ve.CHARGE_AUTH_SUCCESS,e,function(e){t.processResult(e.charge_3ds_id)})}},{key:"parseResultData",value:function(e,t){return{status:e.status,charge_3ds_id:t}}},{key:"parseHandleResponse",value:function(e,t){var n=e.status,i=e.result;return{status:n,charge_3ds_id:t,result:{description:null==i?void 0:i.description}}}},{key:"parseError",value:function(e,t){return{charge_3ds_id:t,error:e}}},{key:"processResult",value:function(t){var n=this;this.resultRead||(this.resultRead=!0,this.api.charge().standalone3dsHandle().then(function(e){n.iFrameAuthorization.remove(),n.iFrameSecondaryUrl.remove(),e.status===wn.SUCCESS?n.eventEmitter.emit(On,n.parseResultData(e,t)):n.eventEmitter.emit(Tn,n.parseResultData(e,t))},function(e){n.eventEmitter.emit(Rn,n.parseError(e,t))}))}},{key:"externalAPI",value:function(e,t){var i=new XMLHttpRequest;return i.open(e,t,!0),new Promise(function(t,n){i.onload=function(){try{var e=JSON.parse(i.responseText);t(e)}catch(e){n(e)}},i.send()})}},{key:"doPolling",value:function(t,n){var i=this;this.externalAPI("GET",t).then(function(e){if(e.event&&"AuthResultNotReady"!==e.event){if("AuthResultReady"!==e.event)throw new Error("Event not supported");i.processResult(n)}else setTimeout(function(){i.doPolling(t,n)},2e3)}).catch(function(e){return i.eventEmitter.emit(Rn,i.parseError(e,n))})}},{key:"performAuthentication",value:function(e){var i=this,o=e.charge_3ds_id;this.iFrameAuthorization.remove(),this.iFrameSecondaryUrl.remove(),this.api.charge().standalone3dsProcess({charge_3ds_id:o}).then(function(e){var t,n;if("success"===e.status)i.eventEmitter.emit(On,i.parseHandleResponse(e,o));else{if("pending"!==e.status)return i.eventEmitter.emit(Tn,i.parseHandleResponse(e,o));null!==(t=null==e?void 0:e.result)&&void 0!==t&&t.challenge?(i.eventEmitter.emit(An,i.parseHandleResponse(e,o)),i.initializeIFrames(e.result.challenge_url,"authenticationResult.result.secondary_url","Authentication Challenge",!1),i.doPolling(e.result.secondary_url,o)):null!==(n=null==e?void 0:e.result)&&void 0!==n&&n.decoupled_challenge&&(i.eventEmitter.emit(Pn,i.parseHandleResponse(e,o)),i.doPolling(e.result.secondary_url,o))}},function(e){i.eventEmitter.emit(Rn,i.parseError(e,o))})}}]),In);function In(e,t,n){l(this,In),this.container=e,this.api=t,this.eventEmitter=n,this.resultRead=!1,this.iFrameEvent=new me(window)}var Ln,Nn,Dn="GPayments",Un=(t(Mn,[{key:"load",value:function(e,t){var n=h.validateJWT(e);if(!n)throw new Error("Invalid charge token");var i=h.extractData(n.body),o=new cn(e,tn.TOKEN);switch(o.setEnv(this.env,this.alias),i.service_type){case Dn:new xn(this.container,o,this.eventEmitter).load(i,t.title)}}},{key:"setEnv",value:function(e,t){this.env=e,this.alias=t}}]),Mn);function Mn(e,t){l(this,Mn),this.env=f,this.container=e,this.eventEmitter=t}(Nn=Ln=Ln||{}).HTML="html",Nn.URL="url",Nn.STANDALONE_3DS="standalone_3ds";var jn=(t(Fn,[{key:"load",value:function(){this.token.format===Ln.HTML?this.iFrame.loadFromHtml(this.token.content,{title:"3d secure authentication"}):this.token.format===Ln.URL?this.iFrame.load(this.token.content,{title:"3d secure authentication"}):this.token.format===Ln.STANDALONE_3DS?this.standalone3dsService.load(this.token.content,{title:"3d secure authentication"}):console.error("Token contain unsupported payload")}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.standalone3dsService.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"on",value:function(e,t){var n=this;return this.token.format===Ln.STANDALONE_3DS?"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise(function(t){return n.eventEmitter.subscribe(e,function(e){return t(e)})}):"function"==typeof t?this.event.on(e,this.link.getParams().ref_id,t):new Promise(function(t){return n.event.on(e,n.link.getParams().ref_id,function(e){return t(e)})})}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}}],[{key:"extractToken",value:function(e){return JSON.parse(window.atob(e))}}]),Fn);function Fn(e,t){l(this,Fn),this.configs=[],this.link=new U("/3ds/webhook"),this.token=Fn.extractToken(t),this.link.setParams({ref_id:this.token.charge_3ds_id}),this.container=new de(e),this.iFrame=new pe(this.container),this.eventEmitter=new Le,this.standalone3dsService=new Un(this.container,this.eventEmitter),this.event=new me(window)}var Hn="/v1/charges/3ds",Bn=(t(zn,[{key:"preAuth",value:function(e,t){return"function"==typeof t?this.api.getClient("POST",Hn).send(A(A({},e),{_3ds:A(A({},e._3ds),{browser_details:{name:Me.getBrowserName(),java_enabled:Me.isJavaEnabled().toString(),language:Me.getLanguage(),screen_height:Me.getScreenHeight().toString(),screen_width:Me.getScreenWidth().toString(),time_zone:Me.getTimezoneOffset().toString(),color_depth:Me.getColorDepth().toString()}})}),function(e){t(e)}):this.api.getClientPromise("POST",Hn).send(A(A({},e),{_3ds:A(A({},e._3ds),{browser_details:{name:Me.getBrowserName(),java_enabled:Me.isJavaEnabled().toString(),language:Me.getLanguage(),screen_height:Me.getScreenHeight().toString(),screen_width:Me.getScreenWidth().toString(),time_zone:Me.getTimezoneOffset().toString(),color_depth:Me.getColorDepth().toString()}})}))}}]),zn);function zn(e){l(this,zn),this.api=e}var qn,Wn,Vn=(o(Yn,an),t(Yn,[{key:"getBrowserDetails",value:function(){return{name:Me.getBrowserName(),java_enabled:Me.isJavaEnabled().toString(),language:Me.getLanguage(),screen_height:Me.getScreenHeight().toString(),screen_width:Me.getScreenWidth().toString(),time_zone:Me.getTimezoneOffset().toString(),color_depth:Me.getColorDepth().toString()}}},{key:"charge",value:function(){return new Bn(this)}}]),Yn);function Yn(e){l(this,Yn);var t=c(this,(Yn.__proto__||Object.getPrototypeOf(Yn)).call(this,e));return t.publicKey=t.auth,t}(Wn=qn=qn||{}).AFTER_LOAD="after_load",Wn.SYSTEM_ERROR="system_error",Wn.CVV_SECURE_CODE_REQUESTED="cvv_secure_code_requested",Wn.CARD_NUMBER_SECURE_CODE_REQUESTED="card_number_secure_code_requested",Wn.ACCESS_FORBIDDEN="access_forbidden",Wn.SESSION_EXPIRED="session_expired",Wn.OPERATION_FORBIDDEN="operation_forbidden";var Gn=(o(Kn,me),t(Kn,[{key:"on",value:function(e,t,n){for(var i in qn)qn.hasOwnProperty(i)&&e===qn[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}]),Kn);function Kn(){return l(this,Kn),c(this,(Kn.__proto__||Object.getPrototypeOf(Kn)).apply(this,arguments))}var Jn=(t(Xn,[{key:"setEnv",value:function(e,t){this.link.setEnv(e,t)}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise(function(t){return n.event.on(e,n.link.getParams().widget_id,function(e){return t(e)})})}},{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==j.values(Y).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setStyle[s: unsupported style param "+e)}},{key:"load",value:function(){this.iFrame.load(this.link.getUrl(),{title:"Vault Display"})}}]),Xn);function Xn(e,t){l(this,Xn),this.validationData={},this.configs=[],this.container=new de(e),this.iFrame=new pe(this.container),this.triggerElement=new _e(this.iFrame),this.event=new Gn(window),this.vaultDisplayToken=t,this.link=new U("/vault-display"),this.link.setParams({vault_display_token:t})}e.AfterpayCheckoutButton=Ct,e.Api=Vn,e.CHECKOUT_BUTTON_EVENT=kt,e.Canvas3ds=jn,e.CheckoutButton=Et,e.Configuration=ee,e.ELEMENT=J,e.EVENT=ve,e.ExternalCheckoutBuilder=Ae,e.ExternalCheckoutChecker=xe,e.FORM_FIELD=V,e.HtmlMultiWidget=we,e.HtmlPaymentSourceWidget=En,e.HtmlWidget=Ce,e.MultiWidget=se,e.PAYMENT_TYPE=Q,e.PURPOSE=$,e.PaymentSourceBuilder=We,e.PaymentSourceWidget=_n,e.PaypalCheckoutButton=At,e.STYLABLE_ELEMENT=ne,e.STYLABLE_ELEMENT_STATE=ie,e.STYLE=Y,e.SUPPORTED_CARD_TYPES=X,e.TEXT=K,e.TRIGGER=ge,e.TYPE=qe,e.VAULT_DISPLAY_STYLE={BACKGROUND_COLOR:"background_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",BUTTON_COLOR:"button_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},e.VaultDisplayWidget=Jn,e.WalletButtons=yn,e.ZipmoneyCheckoutButton=wt,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).paydock={})}(this,function(e){"use strict";function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e};function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:a(o,t,n)}if("value"in i)return i.value;var r=i.get;return void 0!==r?r.call(n):void 0}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{!i&&s.return&&s.return()}finally{if(o)throw r}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},u="x-access-token",d="x-user-public-key",h=(t(p,null,[{key:"validateJWT",value:function(e){if(!e)return null;var t=e.split("."),n=s(t,3),i=n[0],o=n[1],r=n[2];if(!i||!o||!r)return null;if(2+i.length+o.length+r.length!==e.length)return null;try{return{head:JSON.parse(atob(i)),body:JSON.parse(atob(o)),signature:r}}catch(e){return null}}},{key:"extractData",value:function(e){try{return JSON.parse(atob(e.meta))}catch(e){return null}}},{key:"extractMeta",value:function(e){try{return JSON.parse(atob(e.meta)).meta}catch(e){return null}}},{key:"getAccessHeaderNameByToken",value:function(e){return p.validateJWT(e)?u:d}}]),p);function p(){l(this,p)}var f="sandbox",v="sandbox-kovena",m="sandbox-demo",y="sandbox-demo-kovena",g="production",_="staging",k="staging_2",E="staging_3",b="staging_4",w="staging_5",S=[v,y],C=f,O="paydock.com",T="kovena.com",P=(t(R,[{key:"setEnv",value:function(e,t){if(!this.isValidMode(this.configs,e))throw new Error("unknown env: "+e);if(this.env=e,t&&!t.match("^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$"))throw new Error("invalid: "+t);t?this.alias=t:-1!==S.indexOf(this.env)?this.alias=T:this.alias=O}},{key:"getEnv",value:function(){return this.env}},{key:"getConf",value:function(){for(var e in this.configs)if(this.configs.hasOwnProperty(e)&&this.configs[e].env===this.getEnv())return{url:-1!==this.configs[e].url.indexOf("localhost")?this.configs[e].url:this.configs[e].url+this.alias,env:this.configs[e].env};throw new Error("invalid env")}},{key:"isValidMode",value:function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].env===t)return!0;return!1}}]),R);function R(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:C;l(this,R),this.configs=e,this.setEnv(t)}var x=(t(I,null,[{key:"extendSearchParams",value:function(e,t,n){return e.replace(new RegExp("([?&]"+t+"(?=[=&#]|$)[^#&]*|(?=#|$))"),"&"+t+"="+encodeURIComponent(n)).replace(/^([^?&]+)&/,"$1?")}}]),I);function I(){l(this,I)}var L=(t(N,null,[{key:"generate",value:function(){if("undefined"==typeof window||void 0===window.crypto||void 0===window.crypto.getRandomValues)return this.random()+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+this.random()+this.random();var e=new Uint16Array(8);return window.crypto.getRandomValues(e),this.hash(e[0])+this.hash(e[1])+"-"+this.hash(e[2])+"-"+this.hash(e[3])+"-"+this.hash(e[4])+"-"+this.hash(e[5])+this.hash(e[6])+this.hash(e[7])}},{key:"hash",value:function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t}},{key:"random",value:function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}]),N);function N(){l(this,N)}var D="/wallet/flypay",U=(t(M,[{key:"getNetUrl",value:function(){return this.env.getConf().url+this.linkResource}},{key:"getUrl",value:function(){var e=this.getNetUrl(),t=this.getParams();for(var n in t)t.hasOwnProperty(n)&&(e=x.extendSearchParams(e,n,t[n]));return e}},{key:"setParams",value:function(e){this.params=A({},this.params,e)}},{key:"concatParams",value:function(e){for(var t in e)e.hasOwnProperty(t)&&e[t].length&&("string"!=typeof this.params[t]&&(this.params[t]=""),this.params[t].length?this.params[t]+=","+e[t]:this.params[t]+=e[t])}},{key:"getParams",value:function(){return this.params}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}}]),M);function M(e){l(this,M),this.params={},this.widgetId=L.generate(),this.linkResource=e,this.env=new P([{env:v,url:"https://widget-sandbox."},{env:m,url:"https://widget-sandbox-demo."},{env:y,url:"https://widget-sandbox-demo."},{env:f,url:"https://widget-sandbox."},{env:g,url:"https://widget."},{env:_,url:"https://widsta."},{env:k,url:"https://widsta-2."},{env:E,url:"https://widsta-3."},{env:b,url:"https://widsta-4."},{env:w,url:"https://widsta-5."}]),this.setParams({widget_id:this.widgetId})}var j=(t(F,null,[{key:"values",value:function(t){return Object.keys(t).map(function(e){return t[e]})}}]),F);function F(){l(this,F)}var H,B,z,q,W={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},V={CARD_NAME:"card_name",CARD_NUMBER:"card_number",EXPIRE_MONTH:"expire_month",EXPIRE_YEAR:"expire_year",CARD_CCV:"card_ccv",ACCOUNT_NAME:"account_name",ACCOUNT_BSB:"account_bsb",ACCOUNT_NUMBER:"account_number",ACCOUNT_ROUTING:"account_routing",ACCOUNT_HOLDER_TYPE:"account_holder_type",ACCOUNT_BANK_NAME:"account_bank_name",ACCOUNT_TYPE:"account_type",FIRST_NAME:"first_name",LAST_NAME:"last_name",EMAIL:"email",PHONE:"phone",PHONE2:"phone2",ADDRESS_LINE1:"address_line1",ADDRESS_LINE2:"address_line2",ADDRESS_STATE:"address_state",ADDRESS_COUNTRY:"address_country",ADDRESS_CITY:"address_city",ADDRESS_POSTCODE:"address_postcode",ADDRESS_COMPANY:"address_company"},Y={BACKGROUND_COLOR:"background_color",BACKGROUND_ACTIVE_COLOR:"background_active_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",ICON_SIZE:"icon_size",BUTTON_COLOR:"button_color",ERROR_COLOR:"error_color",SUCCESS_COLOR:"success_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},K={TITLE:"title",TITLE_H1:"title_h1",TITLE_H2:"title_h2",TITLE_H3:"title_h3",TITLE_H4:"title_h4",TITLE_H5:"title_h5",TITLE_H6:"title_h6",FINISH:"finish_text",TITLE_DESCRIPTION:"title_description",SUBMIT_BUTTON:"submit_button",SUBMIT_BUTTON_PROCESSING:"submit_button_processing"},J={SUBMIT_BUTTON:"submit_button",TABS:"tabs"},X={AMEX:"amex",AUSBC:"ausbc",DINERS:"diners",DISCOVER:"discover",JAPCB:"japcb",LASER:"laser",MASTERCARD:"mastercard",SOLO:"solo",VISA:"visa",VISA_WHITE:"visa_white"},Z=[].concat(["brand_name","cart_border_color","reference","email","hdr_img","logo_img","pay_flow_color","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone","hide_shipping_address"],["first_name","last_name","phone","tokenize","email","gender","date_of_birth","charge","statistics","hide_shipping_address"],["amount","currency","email","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone"],["customer_storage_number","tokenise_algorithm"]);(B=H=H||{}).STRIPE="Stripe",B.FLYPAY="Flypay",B.PAYPAL="Paypal",B.MASTERCARD="MasterCard",(q=z=z||{}).GOOGLE="google",q.APPLE="apple",q.FLYPAY="flypay",q.PAYPAL="paypal";var Q={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},$={PAYMENT_SOURCE:"payment_source",CARD_PAYMENT_SOURCE_WITH_CVV:"card_payment_source_with_cvv",CARD_PAYMENT_SOURCE_WITHOUT_CVV:"card_payment_source_without_cvv"},ee=(t(te,[{key:"setWebHookDestination",value:function(e){this.configs.webhook_destination=e}},{key:"setSuccessRedirectUrl",value:function(e){this.configs.success_redirect_url=e}},{key:"setErrorRedirectUrl",value:function(e){this.configs.error_redirect_url=e}},{key:"setFormFields",value:function(e){for(var t in Array.isArray(this.configs.defined_form_fields)||(this.configs.defined_form_fields=[]),e)e.hasOwnProperty(t)&&(-1!==j.values(V).indexOf(e[t].replace("*",""))?this.configs.defined_form_fields.push(e[t]):console.warn("Configuration::setFormFields: unsupported form field "+e[t]))}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Z.indexOf(t)?this.configs.meta[t]=e[t]:console.warn("Configuration::setMeta: unsupported meta key "+t))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"setLabel",value:function(e){this.configs.label=e}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"createToken",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.send(e,function(e,t){if(200<=t&&t<300)return n(e.resource.data.configuration_token);void 0===e.error||void 0===e.error.message?i("unknown error"):i(e.error.message)})}},{key:"send",value:function(e,t){var n=new XMLHttpRequest;n.open("POST",this.getUrl(),!0),n.setRequestHeader("Content-Type","application/json; charset=UTF-8"),n.setRequestHeader(h.getAccessHeaderNameByToken(e),e),n.send(JSON.stringify(this.getConfigs())),n.onload=function(){var e={};try{e=JSON.parse(n.responseText)}catch(e){}t(e,n.status)}}},{key:"getConfigs",value:function(){return this.configs}},{key:"getUrl",value:function(){return this.env.getConf().url+"/v1/remote-action/configs"}}],[{key:"createEachToken",value:function(e,n,i,t){function o(t){n.hasOwnProperty(t)&&n[t].createToken(e,function(e){a[t]=e,u++,n.length===u&&te.finishCreatingEachToken(a,s,i,r)},function(e){s.push("gateway: "+n[t].getConfigs().predefined_fields.gateway_id+" | "+e),u++,n.length===u&&te.finishCreatingEachToken(a,s,i,r)})}var r=3<arguments.length&&void 0!==t?t:function(e){},a=new Array(n.length),s=[],u=0;for(var l in n)o(l)}},{key:"finishCreatingEachToken",value:function(e,t,n,i){1<=t.length?i(t):n(e)}}]),te);function te(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"default",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Q.CARD,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:$.PAYMENT_SOURCE;if(l(this,te),-1===j.values(Q).indexOf(t))throw new Error("unsupported payment type");if(t===Q.CHECKOUT)throw new Error('Payment type "checkout" is deprecated. Use CheckoutButton for this type of payments https://www.npmjs.com/package/@paydock/client-sdk#checkout-button');if(-1===j.values($).indexOf(n))throw new Error("unsupported purpose");this.env=new P([{env:v,url:"https://api-sandbox."},{env:m,url:"https://api-sandbox-demo."},{env:y,url:"https://api-sandbox-demo."},{env:f,url:"https://api-sandbox."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}]),this.configs={purpose:n,meta:{},dynamic_fields_position:!0,predefined_fields:{gateway_id:e,type:t}}}var ne={INPUT:"input",SUBMIT_BUTTON:"submit_button",LABEL:"label",TITLE:"title",TITLE_DESCRIPTION:"title_description"},ie={ERROR:"error",FOCUS:"focus",HOVER:"hover"},oe=[{element:ne.INPUT,states:[ie.FOCUS,ie.ERROR],styles:["color","border","border_radius","background_color","height","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition"]},{element:ne.SUBMIT_BUTTON,states:[ie.HOVER],styles:["color","border","border_radius","background_color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition","opacity"]},{element:ne.LABEL,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin"]},{element:ne.TITLE,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]},{element:ne.TITLE_DESCRIPTION,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]}],re=(t(ae,null,[{key:"check",value:function(e,t,n,i){for(var o in e)if(e.hasOwnProperty(o)&&e[o].element===t){if(-1===e[o].states.indexOf(n)&&n)return!1;for(var r in i)if(i.hasOwnProperty(r)&&-1===e[o].styles.indexOf(r.replace("-","_")))return!1;return!0}return!1}},{key:"encode",value:function(e,t,n){var i=[];for(var o in n)n.hasOwnProperty(o)&&i.push(o.replace("_","-")+":"+n[o]);var r=i.join(";");return t?e+"::"+t+"{"+r+"}":e+"{"+r+"}"}},{key:"decode",value:function(e){var t=(e.match("::(.*){")||["",null])[1],n=null!==t?(e.match("(.*)::")||["",""])[1].trim():(e.match("(.*){")||["",""])[1].trim(),i=(e.match("{(.*)}")||["",""])[1].split(";"),o={};for(var r in i)if(i.hasOwnProperty(r)){var a=i[r].split(":");!a&&2!==a.length||(o[a[0].trim()]=(a[1]||"").trim())}return{element:n,state:t,styles:o}}}]),ae);function ae(){l(this,ae)}var se=(t(ue,[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"usePhoneCountryMask",value:function(e){return e?!e.only_countries||/^[a-z]+$/.test(e.only_countries.join(""))&&2*e.only_countries.length===e.only_countries.join("").length?!e.preferred_countries||/^[a-z]+$/.test(e.preferred_countries.join(""))&&2*e.preferred_countries.length===e.preferred_countries.join("").length?e.default_country&&2!==e.default_country.length?console.warn("Widget::usePhoneCountryMask[s: default_country - incorrect value length"):(this.link.setParams({use_country_phone_mask:!0}),e.only_countries&&this.link.setParams({phone_mask_only_countries:e.only_countries.join(",")}),e.preferred_countries&&this.link.setParams({phone_mask_preferred_countries:e.preferred_countries.join(",")}),void(e.default_country&&this.link.setParams({phone_mask_default_country:e.default_country}))):console.warn("Widget::usePhoneCountryMask[s: preferred_countries - unsupported symbols or incorrect length of value"):console.warn("Widget::usePhoneCountryMask[s: only_countries - unsupported symbols or incorrect length of value"):this.link.setParams({use_country_phone_mask:!0})}},{key:"setStyle",value:function(e,t){-1!==j.values(Y).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setStyle[s: unsupported style param "+e)}},{key:"setTexts",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setText(t,e[t])}},{key:"setText",value:function(e,t){-1!==j.values(K).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setText[s: unsupported text param "+e)}},{key:"setElementStyle",value:function(e,t,n){var i=3===arguments.length?t:null,o=3===arguments.length?n:t;if(!re.check(oe,e,i,o))return console.warn('Styles for "'+e+'" element with "'+(i||"default")+'" state was ignored because some of the arguments are unacceptable');this.link.concatParams({element_styles:re.encode(e,i,o)})}},{key:"setFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormValue(t,e[t])}},{key:"setFormValue",value:function(e,t){return-1===j.values(V).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field "+e):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: "+e+" - unsupported symbols (: or ,) in value"):void("string"==typeof this.link.getParams().form_values&&this.link.getParams().form_values.length?this.link.setParams({form_values:this.link.getParams().form_values+","+e+":"+t}):this.link.setParams({form_values:e+":"+t}))}},{key:"setFormLabels",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormLabel(t,e[t])}},{key:"setFormLabel",value:function(e,t){if(-1===j.values(V).indexOf(e))return console.warn("Widget::setFormLabel[s: unsupported field "+e);var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormLabel[s: "+e+" - unsupported symbols (: or ,) in value");this.link.concatParams({form_labels:e+":"+n})}},{key:"setFormPlaceholders",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormPlaceholder(t,e[t])}},{key:"setFormPlaceholder",value:function(e,t){if(-1===j.values(V).indexOf(e))return console.warn("Widget::setFormPlaceholder[s: unsupported field "+e);var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormPlaceholder[s: "+e+" - unsupported symbols (: or ,) in value");this.link.concatParams({form_placeholders:e+":"+n})}},{key:"setFormElements",value:function(e){var t=this;e.forEach(function(e){return t.setFormElement(e)})}},{key:"setFormElement",value:function(e){e.value&&this.setFormValue(e.field,e.value),e.label&&this.setFormLabel(e.field,e.label),e.placeholder&&this.setFormPlaceholder(e.field,e.placeholder)}},{key:"setIcons",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setIcon(t,e[t])}},{key:"setIcon",value:function(e,t){if(/\,/.test(t)||/\:/.test(t))return console.warn("Widget::setIcon[s: "+e+" - unsupported symbols (: or ,) in value");"string"==typeof this.link.getParams().icons&&this.link.getParams().icons.length?this.link.setParams({icons:this.link.getParams().icons+","+e+":"+t}):this.link.setParams({icons:e+":"+t})}},{key:"setHiddenElements",value:function(e){var t=[],n=j.values(J).concat(j.values(V));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::setHiddenElements: unsupported element "+e[i]));t.length&&this.link.concatParams({hidden_elements:t.join(",")})}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"useGatewayFieldValidation",value:function(){this.link.setParams({fields_validation:!0})}},{key:"setSupportedCardIcons",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(-1!==j.values(X).indexOf(e[i])?n.push(e[i]):console.warn("Widget::cardTypes: unsupported type of cards "+e[i]));n.length&&this.link.concatParams({supported_card_types:n.join(",")}),t&&this.link.setParams({validate_card_types:t})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"loadIFrameUrl",value:function(t,e){var n=this,i=1<arguments.length&&void 0!==e?e:function(e){};if(this.link.setParams({configuration_tokens:""}),this.configTokens.length)return this.link.setParams({configuration_tokens:this.configTokens.join(",")}),t(this.link.getUrl());ee.createEachToken(this.accessToken,this.configs,function(e){return n.link.concatParams({configuration_tokens:e.join(",")}),t(n.link.getUrl())},function(e){i(e)})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}]),ue);function ue(e,t){if(l(this,ue),this.configs=[],this.configTokens=[],this.link=new U("/remote-action"),h.validateJWT(e)?this.link.setParams({token:e}):this.link.setParams({public_key:e}),this.accessToken=e,!t||Array.isArray(t)&&!t.length)throw Error("configuration token is required");if("string"==typeof t)this.configTokens.push(t);else if(t instanceof ee)this.configs.push(t);else if(Array.isArray(t)&&"string"==typeof t[0])this.configTokens=t;else{if(!(Array.isArray(t)&&t[0]instanceof ee))throw Error("Unsupported type of configuration token");this.configs=t}}var le=(t(ce,null,[{key:"insertToInput",value:function(e,t,n){if(void 0!==n[t]){var i=document.querySelector(e);i&&(i.value=n[t])}}},{key:"subscribe",value:function(e,t,n){t.addEventListener?t.addEventListener(e,n):t.attachEvent("on"+e,n)}}]),ce);function ce(){l(this,ce)}var de=(t(he,[{key:"isExist",value:function(){return!!this.getElement()}},{key:"getStyles",value:function(e){if(this.isExist()){var t=this.getElement().getAttribute("widget-style");if(!t)return{};var n=t.split(";");return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"on",value:function(e,t){this.isExist()&&le.subscribe(e,this.getElement(),t)}},{key:"getAttr",value:function(e){if(this.isExist()){var t=this.getElement(),n=[];for(var i in e)if(e.hasOwnProperty(i)){var o=e[i].replace(/_/g,"-"),r=t.getAttribute(o);r&&n.push(e[i]+":"+r)}return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"convertConfigs",value:function(e,t){var n={};for(var i in e)if(e.hasOwnProperty(i)){var o=e[i].split(":"),r=o[0].replace(/-/g,"_").trim();-1!==t.indexOf(r)&&(n[r]=o[1].trim())}return n}}]),he);function he(e){l(this,he),this.selector=e}var pe=(t(fe,[{key:"load",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.container.isExist()&&!this.isExist()){var i=document.createElement("iframe");i.setAttribute("src",e),n.title&&(i.title=n.title),this.container.getElement().appendChild(i)}}},{key:"loadFromHtml",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.container.isExist()&&!this.isExist()){var i=document.createElement("iframe");i.setAttribute("height","100%"),i.setAttribute("width","100%"),n.title&&(i.title=n.title),this.container.getElement().appendChild(i);var o=this.getElement().contentDocument;o.open(),o.write("<html><head><style>html, body {margin: 0;} iframe {border: 0; width: 100%}</style><title></title></head><body>{{content}}</body></html>".replace("{{content}}",e)),o.close()}}},{key:"remove",value:function(){if(this.container.isExist()&&this.isExist()){var e=this.getElement();this.container.getElement().removeChild(e)}}},{key:"show",value:function(){this.isExist()&&(this.setStyle("visibility","visible"),this.setStyle("display","block"))}},{key:"hide",value:function(e){var t=0<arguments.length&&void 0!==e&&e;this.isExist()&&(t?this.setStyle("visibility","hidden"):this.setStyle("display","none"))}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"getElement",value:function(){return this.container.isExist()?this.container.getElement().querySelector("iframe"):null}},{key:"setStyle",value:function(e,t){this.getElement().style[e]=t}}]),fe);function fe(e){l(this,fe),this.container=e}var ve={AFTER_LOAD:"afterLoad",SUBMIT:"submit",FINISH:"finish",VALIDATION_ERROR:"validationError",SYSTEM_ERROR:"systemError",CHECKOUT_SUCCESS:"checkoutSuccess",CHECKOUT_ERROR:"checkoutError",VALIDATION:"validation",SELECT:"select",UNSELECT:"unselect",NEXT:"next",PREV:"prev",META_CHANGE:"metaChange",RESIZE:"resize",CHARGE_AUTH_SUCCESS:"chargeAuthSuccess",CHARGE_AUTH_REJECT:"chargeAuthReject",CHARGE_AUTH_CANCELLED:"chargeAuthCancelled",ADDITIONAL_DATA_SUCCESS:"additionalDataCollectSuccess",ADDITIONAL_DATA_REJECT:"additionalDataCollectReject",CHARGE_AUTH:"chargeAuth"},me=(t(ye,[{key:"emit",value:function(e){for(var t in this.listeners)this.listeners[t].event===e.event&&e.widget_id===this.listeners[t].widget_id&&this.listeners[t].listener.apply(this,[e])}},{key:"on",value:function(e,t,n){for(var i in ve)ve.hasOwnProperty(i)&&e===ve[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t)}}]),ye);function ye(e){var n=this;l(this,ye),this.listeners=[],e&&le.subscribe("message",e,function(e){var t=void 0;try{t=JSON.parse(e.data)}catch(e){}t&&n.emit(t)})}var ge={SUBMIT_FORM:"submit_form",CHANGE_TAB:"tab",HIDE_ELEMENTS:"hide_elements",SHOW_ELEMENTS:"show_elements",REFRESH_CHECKOUT:"refresh_checkout",UPDATE_FORM_VALUES:"update_form_values",INIT_CHECKOUT:"init_checkout"},_e=(t(ke,[{key:"push",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.iFrame.isExist()){-1===j.values(ge).indexOf(e)&&console.warn("unsupported trigger type");var i={trigger:e,destination:"widget.paydock",data:n};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(i),"*")}}}]),ke);function ke(e){l(this,ke),this.iFrame=e}var Ee=(t(be,[{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"beforeSubmit",value:function(t){var n=this;this.isExist()&&this.subscribe(this.getElement(),function(e){e.preventDefault(),n.intercepted=!0,t.apply(n,[])})}},{key:"continueSubmit",value:function(){var e=this;this.isExist()&&this.intercepted&&(this.intercepted=!1,setTimeout(function(){e.getElement().submit()},50))}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("submit",t):e.attachEvent("onsubmit",t)}}]),be);function be(e){l(this,be),this.intercepted=!1,this.selector=e}var we=(o(Se,se),t(Se,[{key:"load",value:function(){var t=this;this.setStyles(this.container.getStyles(j.values(Y))),this.setTexts(this.container.getAttr(j.values(K))),this.loadIFrameUrl(function(e){t.iFrame.load(e,{title:"Card details"}),t.afterLoad()},function(e){for(var t in console.error("Errors when creating a token[s, widget will not be load:"),e)e.hasOwnProperty(t)&&console.error("--- | "+e[t])})}},{key:"afterLoad",value:function(){var t=this;this.on(ve.VALIDATION,function(e){t.validationData=e})}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise(function(t){return n.event.on(e,n.link.getParams().widget_id,function(e){return t(e)})})}},{key:"trigger",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};this.triggerElement.push(e,n)}},{key:"getValidationState",value:function(){return this.validationData}},{key:"isValidForm",value:function(){return!!this.validationData.form_valid}},{key:"isInvalidField",value:function(e){var t=0<arguments.length&&void 0!==e?e:"";return!!this.validationData.invalid_fields&&-1!==this.validationData.invalid_fields.indexOf(t)}},{key:"isFieldErrorShowed",value:function(e){var t=0<arguments.length&&void 0!==e?e:"";return!!this.validationData.invalid_showed_fields&&-1!==this.validationData.invalid_showed_fields.indexOf(t)}},{key:"isInvalidFieldByValidator",value:function(e,t){var n=0<arguments.length&&void 0!==e?e:"";return!(this.validationData.validators&&!this.validationData.validators[t])&&-1!==this.validationData.validators[t].indexOf(n)}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"hideElements",value:function(e){var t=[],n=j.values(J).concat(j.values(V));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::hideElements: unsupported element "+e[i]));t.length&&this.trigger(ge.HIDE_ELEMENTS,{elements:t.join(",")})}},{key:"showElements",value:function(e){var t=[],n=j.values(J).concat(j.values(V));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::showElements: unsupported element "+e[i]));t.length&&this.trigger(ge.SHOW_ELEMENTS,{elements:t.join(",")})}},{key:"updateFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.updateFormValue(t,e[t])}},{key:"updateFormValue",value:function(e,t){return-1===j.values(V).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field "+e):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: "+e+" - unsupported symbols (: or ,) in value"):void this.trigger(ge.UPDATE_FORM_VALUES,{form_values:e+":"+t})}},{key:"onFinishInsert",value:function(t,n){this.on(ve.FINISH,function(e){le.insertToInput(t,n,e)})}},{key:"interceptSubmitForm",value:function(e){var t=this;this.setHiddenElements([J.SUBMIT_BUTTON]);var n=new Ee(e);n.beforeSubmit(function(){t.triggerElement.push(ge.SUBMIT_FORM,{}),t.event.on(ve.FINISH,t.link.getParams().widget_id,function(){n.continueSubmit()})})}},{key:"useCheckoutAutoSubmit",value:function(){var t=this;this.setHiddenElements([J.SUBMIT_BUTTON]),this.on(ve.CHECKOUT_SUCCESS,function(e){t.trigger(ge.SUBMIT_FORM)}),this.on(ve.VALIDATION_ERROR,function(e){t.trigger(ge.REFRESH_CHECKOUT)}),this.on(ve.SYSTEM_ERROR,function(e){t.trigger(ge.REFRESH_CHECKOUT)})}},{key:"useAutoResize",value:function(){var t=this;this.on(ve.RESIZE,function(e){t.iFrame.getElement()&&(t.iFrame.getElement().scrolling="no",e.height&&t.iFrame.setStyle("height",e.height+"px"))})}}]),Se);function Se(e,t,n){l(this,Se);var i=c(this,(Se.__proto__||Object.getPrototypeOf(Se)).call(this,t,n));return i.validationData={},i.container=new de(e),i.iFrame=new pe(i.container),i.triggerElement=new _e(i.iFrame),i.event=new me(window),i}var Ce=(o(Oe,we),t(Oe,[{key:"setWebHookDestination",value:function(e){this.configs[0].setWebHookDestination(e)}},{key:"setSuccessRedirectUrl",value:function(e){this.configs[0].setSuccessRedirectUrl(e)}},{key:"setErrorRedirectUrl",value:function(e){this.configs[0].setErrorRedirectUrl(e)}},{key:"setFormFields",value:function(e){this.configs[0].setFormFields(e)}},{key:"setFormElements",value:function(e){var t=this;e.forEach(function(e){return t.setFormElement(e)})}},{key:"setFormElement",value:function(e){this.configs[0].setFormFields([e.field]),a(Oe.prototype.__proto__||Object.getPrototypeOf(Oe.prototype),"setFormElement",this).call(this,A(A({},e),{field:e.field.replace("*","")}))}},{key:"setMeta",value:function(e){this.configs[0].setMeta(e)}}]),Oe);function Oe(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default",i=arguments[3],o=arguments[4];l(this,Oe);var r=new ee(n,i,o);return c(this,(Oe.__proto__||Object.getPrototypeOf(Oe)).call(this,e,t,r))}var Te=(t(Pe,[{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getUrl",value:function(){return this.env.getConf().url+this.getLink()}},{key:"create",value:function(e,t,n,i){var o=this,r=new XMLHttpRequest;r.onload=function(){o.parser(r.responseText,r.status,n,i)},r.open("POST",this.getUrl(),!0),r.setRequestHeader("Content-Type","application/json; charset=UTF-8"),r.setRequestHeader(h.getAccessHeaderNameByToken(e),e),r.send(JSON.stringify(t))}},{key:"get",value:function(e,t,n){var i=this,o=new XMLHttpRequest;o.onload=function(){i.parser(o.responseText,o.status,t,n)},o.open("GET",this.getUrl(),!0),o.setRequestHeader("Content-Type","application/json; charset=UTF-8"),o.setRequestHeader(h.getAccessHeaderNameByToken(e),e),o.send()}},{key:"parser",value:function(e,t,n,i){var o={};try{o=JSON.parse(e)}catch(e){}if(200<=t&&t<300||302===t)return n(o.resource.data,t);i(o.error||{message:"unknown error"},t)}}]),Pe);function Pe(){l(this,Pe),this.env=new P([{env:v,url:"https://api-sandbox."},{env:m,url:"https://api-sandbox-demo."},{env:y,url:"https://api-sandbox-demo."},{env:f,url:"https://api-sandbox."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}])}var Ae=(o(Re,Te),t(Re,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout"}},{key:"setDescriptions",value:function(e){this.body.description=e}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Z.indexOf(t)?this.body.meta[t]=e[t]:console.warn("ExternalCheckout::setMeta: unsupported meta key "+t))}},{key:"getConfigs",value:function(){return this.body}},{key:"send",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e,t){};this.create(e,this.getConfigs(),function(e,t){n(e)},function(e,t){void 0===e.message?i(t+": unknown error","unknown_error"):i(e.message,e.code)})}}]),Re);function Re(e,t,n){l(this,Re);var i=c(this,(Re.__proto__||Object.getPrototypeOf(Re)).call(this));return i.body={gateway_id:e,meta:{},success_redirect_url:t,error_redirect_url:n,redirect_url:t},i}var xe=(o(Ie,Te),t(Ie,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout/:token".replace(":token",this.token)}},{key:"send",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.get(e,function(e,t){n(e)},function(e,t){void 0===e.message?i(t+": unknown error"):i(e.message)})}}]),Ie);function Ie(e){l(this,Ie);var t=c(this,(Ie.__proto__||Object.getPrototypeOf(Ie)).call(this));return t.token=e,t}var Le=(t(Ne,[{key:"emit",value:function(e,t){var n=this.events[e];n&&n.forEach(function(e){e.call(null,t)})}},{key:"subscribe",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter(function(e){return t!==e})}}}]),Ne);function Ne(){l(this,Ne),this.events={}}var De='\n <div class="cs-loader">\n <div class="cs-loader-inner">\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n </div>\n </div>\n',Ue="\n <style> \n .cs-loader {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n }\n \n .cs-loader-inner {\n transform: translateY(-50%);\n top: 50%;\n position: absolute;\n width: calc(100% - 200px);\n color: #8e8d8c;\n padding: 0 100px;\n text-align: center;\n }\n \n \n .cs-loader-inner label {\n font-size: 20px;\n opacity: 0;\n display:inline-block;\n }\n \n @keyframes lol {\n 0% {\n opacity: 0;\n transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n transform: translateX(300px);\n }\n }\n \n @-webkit-keyframes lol {\n 0% {\n opacity: 0;\n -webkit-transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n -webkit-transform: translateX(300px);\n -moz-transform: translateX(300px);\n }\n }\n \n .cs-loader-inner label:nth-child(6) {\n -webkit-animation: lol 3s infinite ease-in-out;\n -moz-animation: lol 3s infinite ease-in-out;\n animation: lol 3s infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(5) {\n -webkit-animation: lol 3s 100ms infinite ease-in-out;\n -moz-animation: lol 3s 100ms infinite ease-in-out;\n animation: lol 3s 100ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(4) {\n -webkit-animation: lol 3s 200ms infinite ease-in-out;\n -moz-animation: lol 3s 200ms infinite ease-in-out;\n animation: lol 3s 200ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(3) {\n -webkit-animation: lol 3s 300ms infinite ease-in-out;\n -moz-animation: lol 3s 300ms infinite ease-in-out;\n animation: lol 3s 300ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(2) {\n -webkit-animation: lol 3s 400ms infinite ease-in-out;\n -moz-animation: lol 3s 400ms infinite ease-in-out;\n animation: lol 3s 400ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(1) {\n -webkit-animation: lol 3s 500ms infinite ease-in-out;\n -moz-animation: lol 3s 500ms infinite ease-in-out;\n animation: lol 3s 500ms infinite ease-in-out;\n }\n </style>\n",Me=(t(je,null,[{key:"isFacebook",value:function(){return-1!==navigator.userAgent.indexOf("FBSN/iOS")&&-1!==navigator.userAgent.indexOf("AppleWebKit")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isInstagram",value:function(){return-1!==navigator.userAgent.indexOf("iOS")&&-1!==navigator.userAgent.indexOf("Instagram")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isSupportPopUp",value:function(){return!this.isFacebook()&&!this.isInstagram()}},{key:"getLanguage",value:function(){return window.navigator.language||""}},{key:"getTimezoneOffset",value:function(){return(new Date).getTimezoneOffset()}},{key:"getBrowserName",value:function(){var e=navigator.userAgent;return-1<e.indexOf("Firefox")?"Mozilla Firefox":-1<e.indexOf("Opera")?"Opera":-1<e.indexOf("Trident")?"Microsoft Internet Explorer":-1<e.indexOf("Edge")?"Microsoft Edge":-1<e.indexOf("Chrome")?"Google Chrome or Chromium":-1<e.indexOf("Safari")?"Apple Safari":"unknown"}},{key:"isJavaEnabled",value:function(){return navigator.javaEnabled()}},{key:"getColorDepth",value:function(){return screen.colorDepth}},{key:"getScreenHeight",value:function(){return screen.height}},{key:"getScreenWidth",value:function(){return screen.width}}]),je);function je(){l(this,je)}var Fe="close",He="focus",Be=(t(ze,[{key:"initControl",value:function(){if(!this.isInit()&&this.showControl){if(!Me.isSupportPopUp())return this.createLoader();this.createTemplate(),this.createStyles(),this.eventHandler()}}},{key:"initLoader",value:function(){!this.isInit()&&this.showLoader&&(this.createStyles(),this.createLoader())}},{key:"eventHandler",value:function(){var e=this,t=document.querySelector("[data-close]"),n=document.querySelector("[data-continue]");t&&le.subscribe("click",t,function(){return e.eventEmitter.emit(Fe,{})}),n&&le.subscribe("click",n,function(){return e.eventEmitter.emit(He,{})})}},{key:"clear",value:function(){(this.style||this.overlay)&&(this.style.parentNode.removeChild(this.style),this.overlay.parentNode.removeChild(this.overlay),this.style=null,this.overlay=null)}},{key:"createLoader",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0];this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=Ue+De,t.appendChild(this.overlay),setTimeout(function(){e.isInit()&&e.overlay.classList.add("display")},5)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <strong class="checkout-title" data-title>{{title}}</strong>\n <p data-description>{{description}}</p>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');n=(n=n.replace("{{description}}",this.description)).replace("{{title}}",this.title),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout(function(){e.isInit()&&e.overlay.classList.add("display")},5)}},{key:"createStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .hide-continue-button [data-continue] {\n display: none;\n }\n \n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay { \n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display { \n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n"),n=document.querySelector(".checkout-container");t=t.replace("{{width}}",n?String(n.offsetHeight/2):"0"),this.style=document.createElement("style"),this.style.type="text/css",this.style.appendChild(document.createTextNode(t)),e.appendChild(this.style)}},{key:"setBackdropDescription",value:function(e){this.description=e}},{key:"setBackdropTitle",value:function(e){this.title=e}},{key:"onTrigger",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"isInit",value:function(){return!(!this.overlay||!this.style)}},{key:"hideContinueControl",value:function(){this.isInit()&&this.overlay.classList.add("hide-continue-button")}},{key:"turnOffControl",value:function(){this.showControl=!1}},{key:"turnOffLoader",value:function(){this.showLoader=!1}}]),ze);function ze(){l(this,ze),this.description="Don't see the secure checkout browser? We'll help you re-launch the window to complete your purchase",this.title="Checkout",this.overlay=null,this.style=null,this.showControl=!0,this.showLoader=!0,this.eventEmitter=new Le}var qe={EXTERNAL_CHECKOUT_TOKEN:"external_checkout_token",CHECKOUT_TOKEN:"checkout_token",BANK_ACCOUNT:"bank_account",CARD:"card"},We=(o(Ve,Te),t(Ve,[{key:"getLink",value:function(){return"/v1/payment_sources/tokens"}},{key:"send",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.create(e,this.getConfigs(),function(e,t){return n(e)},function(e,t){void 0===e.message?i("unknown error"):i(e.message)})}},{key:"getConfigs",value:function(){return this.body}}]),Ve);function Ve(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:qe.CARD;l(this,Ve);var i=c(this,(Ve.__proto__||Object.getPrototypeOf(Ve)).call(this));switch(i.body={gateway_id:e,type:n},n){case qe.CARD:case qe.BANK_ACCOUNT:delete t.gateway_id,delete t.type,delete t.checkout_token,i.body=A(i.body,t);break;case qe.CHECKOUT_TOKEN:case qe.EXTERNAL_CHECKOUT_TOKEN:i.body.checkout_token=t;break;default:throw new Error("Unsupported type of PaymentSourceToken")}return i}var Ye="success",Ge="declined",Ke="close",Je="referred",Xe="error",Ze=(t(Qe,[{key:"continue",value:function(){}},{key:"next",value:function(){}},{key:"stop",value:function(){}},{key:"error",value:function(e,t,n){n(!0)}},{key:"setCustomRedirectUri",value:function(e){this.customRedirectUti=e}},{key:"setEnv",value:function(e,t){this.widgetEnv.setEnv(e,t)}},{key:"setBackgroundTitle",value:function(e){this.background.setBackdropTitle(e)}},{key:"setBackgroundDescription",value:function(e){this.background.setBackdropDescription(e)}},{key:"turnOffBackdrop",value:function(){this.background.turnOffControl(),this.background.turnOffLoader()}}]),Qe);function Qe(){var e=this;l(this,Qe),this.customRedirectUti=null,this.background=new Be,this.background.onTrigger(He,function(){return e.continue()}),this.background.onTrigger(Fe,function(){return e.stop()}),this.widgetEnv=new P([{env:f,url:"https://widget-sandbox."},{env:v,url:"https://widget-sandbox."},{env:m,url:"https://widget-sandbox-demo."},{env:y,url:"https://widget-sandbox-demo."},{env:g,url:"https://widget."},{env:_,url:"https://widsta."},{env:k,url:"https://widsta-2."},{env:E,url:"https://widsta-3."},{env:b,url:"https://widsta-4."},{env:w,url:"https://widsta-5."}])}var $e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function et(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nt(e,t){return e(t={exports:{}},t.exports),t.exports}tt(nt(function(e){!function o(r,a,s){function u(t,e){if(!a[t]){if(!r[t]){if(!e&&et)return et();if(l)return l(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[t]={exports:{}};r[t][0].call(i.exports,function(e){return u(r[t][1][e]||e)},i,i.exports,o,r,a,s)}return a[t].exports}for(var l=et,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,t,n){function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function r(t){if(c===setTimeout)return setTimeout(t,0);if((c===i||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function a(){v&&p&&(v=!1,p.length?f=p.concat(f):m=-1,f.length&&s())}function s(){if(!v){var e=r(a);v=!0;for(var t=f.length;t;){for(p=f,f=[];++m<t;)p&&p[m].run();m=-1,t=f.length}p=null,v=!1,function(t){if(d===clearTimeout)return clearTimeout(t);if((d===o||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}(e)}}function u(e,t){this.fun=e,this.array=t}function l(){}var c,d,h=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:i}catch(e){c=i}try{d="function"==typeof clearTimeout?clearTimeout:o}catch(e){d=o}}();var p,f=[],v=!1,m=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new u(e,t)),1!==f.length||v||r(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.prependListener=l,h.prependOnceListener=l,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],2:[function(e,i,o){(function(Y){!function(e){if("function"==typeof bootstrap)bootstrap("promise",e);else if("object"==(void 0===o?"undefined":G(o))&&"object"==(void 0===i?"undefined":G(i)))i.exports=e();else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=e}else{if("undefined"==typeof window&&"undefined"==typeof self)throw new Error("This environment was not anticipated by Q. Please file a bug.");var t="undefined"!=typeof window?window:self,n=t.Q;t.Q=e(),t.Q.noConflict=function(){return t.Q=n,this}}}(function(){function e(e){return function(){return P.apply(e,arguments)}}function s(e,t){if(b&&t.stack&&"object"==(void 0===e?"undefined":G(e))&&null!==e&&e.stack){for(var n=[],i=t;i;i=i.source)i.stack&&(!e.__minimumStackCounter__||e.__minimumStackCounter__>i.stackCounter)&&(N(e,"__minimumStackCounter__",{value:i.stackCounter,configurable:!0}),n.unshift(i.stack));n.unshift(e.stack);var o=function(e){for(var t=e.split("\n"),n=[],i=0;i<t.length;++i){var o=t[i];a(o)||(-1!==(r=o).indexOf("(module.js:")||-1!==r.indexOf("(node.js:"))||!o||n.push(o)}var r;return n.join("\n")}(n.join("\n"+j+"\n"));N(e,"stack",{value:o,configurable:!0})}}function o(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var i=/.*@(.+):(\d+)$/.exec(e);return i?[i[1],Number(i[2])]:void 0}function a(e){var t=o(e);if(t){var n=t[0],i=t[1];return n===S&&O<=i&&i<=V}}function t(){if(b)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=o(0<t[0].indexOf("@")?t[1]:t[2]);if(!n)return;return S=n[0],n[1]}}function u(e){return e instanceof c?e:r(e)?(t=e,n=l(),u.nextTick(function(){try{t.then(n.resolve,n.reject,n.notify)}catch(e){n.reject(e)}}),n.promise):m(e);var t,n}function l(){function t(n){o=n,u.longStackSupport&&b&&(i.source=n),R(r,function(e,t){u.nextTick(function(){n.promiseDispatch.apply(n,t)})},void 0),a=r=void 0}var o,r=[],a=[],e=L(l.prototype),i=L(c.prototype);if(i.promiseDispatch=function(e,t,n){var i=A(arguments);r?(r.push(i),"when"===t&&n[1]&&a.push(n[1])):u.nextTick(function(){o.promiseDispatch.apply(o,i)})},i.valueOf=function(){if(r)return i;var e=h(o);return p(e)&&(o=e),e},i.inspect=function(){return o?o.inspect():{state:"pending"}},u.longStackSupport&&b)try{throw new Error}catch(t){i.stack=t.stack.substring(t.stack.indexOf("\n")+1),i.stackCounter=F++}return e.promise=i,e.resolve=function(e){o||t(u(e))},e.fulfill=function(e){o||t(m(e))},e.reject=function(e){o||t(v(e))},e.notify=function(n){o||R(a,function(e,t){u.nextTick(function(){t(n)})},void 0)},e}function n(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=l();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function i(o){return n(function(e,t){for(var n=0,i=o.length;n<i;n++)u(o[n]).then(e,t)})}function c(o,r,t){void 0===r&&(r=function(e){return v(new Error("Promise does not support operation: "+e))}),void 0===t&&(t=function(){return{state:"unknown"}});var a=L(c.prototype);if(a.promiseDispatch=function(e,t,n){var i;try{i=o[t]?o[t].apply(a,n):r.call(a,t,n)}catch(e){i=v(e)}e&&e(i)},a.inspect=t){var e=t();"rejected"===e.state&&(a.exception=e.reason),a.valueOf=function(){var e=t();return"pending"===e.state||"rejected"===e.state?a:e.value}}return a}function d(e,t,n,i){return u(e).then(t,n,i)}function h(e){if(p(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function p(e){return e instanceof c}function r(e){return(t=e)===Object(t)&&"function"==typeof e.then;var t}function f(){B.length=0,z.length=0,W=W||!0}function v(t){var e,n,i=c({when:function(e){return e&&function(t){if(W){var n=x(z,t);-1!==n&&("object"==(void 0===Y?"undefined":G(Y))&&"function"==typeof Y.emit&&u.nextTick.runAfter(function(){var e=x(q,t);-1!==e&&(Y.emit("rejectionHandled",B[n],t),q.splice(e,1))}),z.splice(n,1),B.splice(n,1))}}(this),e?e(t):this}},function(){return this},function(){return{state:"rejected",reason:t}});return e=i,n=t,W&&("object"==(void 0===Y?"undefined":G(Y))&&"function"==typeof Y.emit&&u.nextTick.runAfter(function(){-1!==x(z,e)&&(Y.emit("unhandledRejection",n,e),q.push(e))}),z.push(e),n&&void 0!==n.stack?B.push(n.stack):B.push("(no stack) "+n)),i}function m(n){return c({when:function(){return n},get:function(e){return n[e]},set:function(e,t){n[e]=t},delete:function(e){delete n[e]},post:function(e,t){return null==e?n.apply(void 0,t):n[e].apply(n,t)},apply:function(e,t){return n.apply(e,t)},keys:function(){return U(n)}},void 0,function(){return{state:"fulfilled",value:n}})}function y(e,t,n){return u(e).spread(t,n)}function g(e,t,n){return u(e).dispatch(t,n)}function _(e){return d(e,function(o){var r=0,a=l();return R(o,function(e,t,n){var i;p(t)&&"fulfilled"===(i=t.inspect()).state?o[n]=i.value:(++r,d(t,function(e){o[n]=e,0==--r&&a.resolve(o)},a.reject,function(e){a.notify({index:n,value:e})}))},void 0),0===r&&a.resolve(o),a.promise})}function k(o){if(0===o.length)return u.resolve();var r=u.defer(),a=0;return R(o,function(e,t,n){var i=o[n];a++,d(i,function(e){r.resolve(e)},function(e){0==--a&&(e.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+e.message,r.reject(e))},function(e){r.notify({index:n,value:e})})},void 0),r.promise}function E(e){return d(e,function(e){return e=I(e,u),d(_(I(e,function(e){return d(e,w,w)})),function(){return e})})}var b=!1;try{throw new Error}catch(e){b=!!e.stack}function w(){}var S,C,O=t(),T=function(){function n(){for(var e,t;o.next;)e=(o=o.next).task,o.task=void 0,(t=o.domain)&&(o.domain=void 0,t.enter()),i(e,t);for(;u.length;)i(e=u.pop());r=!1}function i(e,t){try{e()}catch(e){if(s)throw t&&t.exit(),setTimeout(n,0),t&&t.enter(),e;setTimeout(function(){throw e},0)}t&&t.exit()}var o={task:void 0,next:null},t=o,r=!1,a=void 0,s=!1,u=[];if(T=function(e){t=t.next={task:e,domain:s&&Y.domain,next:null},r||(r=!0,a())},"object"==(void 0===Y?"undefined":G(Y))&&"[object process]"===Y.toString()&&Y.nextTick)s=!0,a=function(){Y.nextTick(n)};else if("function"==typeof setImmediate)a="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)};else if("undefined"!=typeof MessageChannel){var e=new MessageChannel;e.port1.onmessage=function(){a=l,(e.port1.onmessage=n)()};var l=function(){e.port2.postMessage(0)};a=function(){setTimeout(n,0),l()}}else a=function(){setTimeout(n,0)};return T.runAfter=function(e){u.push(e),r||(r=!0,a())},T}(),P=Function.call,A=e(Array.prototype.slice),R=e(Array.prototype.reduce||function(e,t){var n=0,i=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=i)throw new TypeError}for(;n<i;n++)n in this&&(t=e(t,this[n],n));return t}),x=e(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),I=e(Array.prototype.map||function(i,o){var r=this,a=[];return R(r,function(e,t,n){a.push(i.call(o,t,n,r))},void 0),a}),L=Object.create||function(e){function t(){}return t.prototype=e,new t},N=Object.defineProperty||function(e,t,n){return e[t]=n.value,e},D=e(Object.prototype.hasOwnProperty),U=Object.keys||function(e){var t=[];for(var n in e)D(e,n)&&t.push(n);return t},M=e(Object.prototype.toString);C="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var j="From previous event:";(u.resolve=u).nextTick=T,u.longStackSupport=!1;var F=1;"object"==(void 0===Y?"undefined":G(Y))&&Y&&Y.env&&Y.env.Q_DEBUG&&(u.longStackSupport=!0),(u.defer=l).prototype.makeNodeResolver=function(){var n=this;return function(e,t){e?n.reject(e):2<arguments.length?n.resolve(A(arguments,1)):n.resolve(t)}},u.Promise=n,(u.promise=n).race=i,n.all=_,n.reject=v,(n.resolve=u).passByCopy=function(e){return e},c.prototype.passByCopy=function(){return this},u.join=function(e,t){return u(e).join(t)},c.prototype.join=function(e){return u([this,e]).spread(function(e,t){if(e===t)return e;throw new Error("Q can't join: not the same: "+e+" "+t)})},u.race=i,c.prototype.race=function(){return this.then(u.race)},(u.makePromise=c).prototype.toString=function(){return"[object Promise]"},c.prototype.then=function(t,n,o){var i=this,r=l(),a=!1;return u.nextTick(function(){i.promiseDispatch(function(e){a||(a=!0,r.resolve(function(e){try{return"function"==typeof t?t(e):e}catch(e){return v(e)}}(e)))},"when",[function(e){a||(a=!0,r.resolve(function(e){if("function"==typeof n){s(e,i);try{return n(e)}catch(e){return v(e)}}return v(e)}(e)))}])}),i.promiseDispatch(void 0,"when",[void 0,function(e){var t,n,i=!1;try{n=e,t="function"==typeof o?o(n):n}catch(e){if(i=!0,!u.onerror)throw e;u.onerror(e)}i||r.notify(t)}]),r.promise},u.tap=function(e,t){return u(e).tap(t)},c.prototype.tap=function(t){return t=u(t),this.then(function(e){return t.fcall(e).thenResolve(e)})},u.when=d,c.prototype.thenResolve=function(e){return this.then(function(){return e})},u.thenResolve=function(e,t){return u(e).thenResolve(t)},c.prototype.thenReject=function(e){return this.then(function(){throw e})},u.thenReject=function(e,t){return u(e).thenReject(t)},u.nearer=h,u.isPromise=p,u.isPromiseAlike=r,u.isPending=function(e){return p(e)&&"pending"===e.inspect().state},c.prototype.isPending=function(){return"pending"===this.inspect().state},u.isFulfilled=function(e){return!p(e)||"fulfilled"===e.inspect().state},c.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},u.isRejected=function(e){return p(e)&&"rejected"===e.inspect().state},c.prototype.isRejected=function(){return"rejected"===this.inspect().state};var H,B=[],z=[],q=[],W=!0;u.resetUnhandledRejections=f,u.getUnhandledReasons=function(){return B.slice()},u.stopUnhandledRejectionTracking=function(){f(),W=!1},f(),u.reject=v,u.fulfill=m,u.master=function(n){return c({isDef:function(){}},function(e,t){return g(n,e,t)},function(){return u(n).inspect()})},u.spread=y,c.prototype.spread=function(t,e){return this.all().then(function(e){return t.apply(void 0,e)},e)},u.async=function(t){return function(){function e(e,t){var n;if("undefined"==typeof StopIteration){try{n=i[e](t)}catch(e){return v(e)}return n.done?u(n.value):d(n.value,o,r)}try{n=i[e](t)}catch(e){return function(e){return"[object StopIteration]"===M(e)||e instanceof C}(e)?u(e.value):v(e)}return d(n,o,r)}var i=t.apply(this,arguments),o=e.bind(e,"next"),r=e.bind(e,"throw");return o()}},u.spawn=function(e){u.done(u.async(e)())},u.return=function(e){throw new C(e)},u.promised=function(n){return function(){return y([this,_(arguments)],function(e,t){return n.apply(e,t)})}},u.dispatch=g,c.prototype.dispatch=function(e,t){var n=this,i=l();return u.nextTick(function(){n.promiseDispatch(i.resolve,e,t)}),i.promise},u.get=function(e,t){return u(e).dispatch("get",[t])},c.prototype.get=function(e){return this.dispatch("get",[e])},u.set=function(e,t,n){return u(e).dispatch("set",[t,n])},c.prototype.set=function(e,t){return this.dispatch("set",[e,t])},u.del=u.delete=function(e,t){return u(e).dispatch("delete",[t])},c.prototype.del=c.prototype.delete=function(e){return this.dispatch("delete",[e])},u.mapply=u.post=function(e,t,n){return u(e).dispatch("post",[t,n])},c.prototype.mapply=c.prototype.post=function(e,t){return this.dispatch("post",[e,t])},u.send=u.mcall=u.invoke=function(e,t){return u(e).dispatch("post",[t,A(arguments,2)])},c.prototype.send=c.prototype.mcall=c.prototype.invoke=function(e){return this.dispatch("post",[e,A(arguments,1)])},u.fapply=function(e,t){return u(e).dispatch("apply",[void 0,t])},c.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},u.try=u.fcall=function(e){return u(e).dispatch("apply",[void 0,A(arguments,1)])},c.prototype.fcall=function(){return this.dispatch("apply",[void 0,A(arguments)])},u.fbind=function(e){var t=u(e),n=A(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(A(arguments))])}},c.prototype.fbind=function(){var e=this,t=A(arguments);return function(){return e.dispatch("apply",[this,t.concat(A(arguments))])}},u.keys=function(e){return u(e).dispatch("keys",[])},c.prototype.keys=function(){return this.dispatch("keys",[])},u.all=_,c.prototype.all=function(){return _(this)},u.any=k,c.prototype.any=function(){return k(this)},u.allResolved=(H=E,function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("allResolved is deprecated, use allSettled instead.",new Error("").stack),H.apply(H,arguments)}),c.prototype.allResolved=function(){return E(this)},u.allSettled=function(e){return u(e).allSettled()},c.prototype.allSettled=function(){return this.then(function(e){return _(I(e,function(e){function t(){return e.inspect()}return(e=u(e)).then(t,t)}))})},u.fail=u.catch=function(e,t){return u(e).then(void 0,t)},c.prototype.fail=c.prototype.catch=function(e){return this.then(void 0,e)},u.progress=function(e,t){return u(e).then(void 0,void 0,t)},c.prototype.progress=function(e){return this.then(void 0,void 0,e)},u.fin=u.finally=function(e,t){return u(e).finally(t)},c.prototype.fin=c.prototype.finally=function(t){if(!t||"function"!=typeof t.apply)throw new Error("Q can't apply finally callback");return t=u(t),this.then(function(e){return t.fcall().then(function(){return e})},function(e){return t.fcall().then(function(){throw e})})},u.done=function(e,t,n,i){return u(e).done(t,n,i)},c.prototype.done=function(e,t,n){var i=function(e){u.nextTick(function(){if(s(e,o),!u.onerror)throw e;u.onerror(e)})},o=e||t||n?this.then(e,t,n):this;"object"==(void 0===Y?"undefined":G(Y))&&Y&&Y.domain&&(i=Y.domain.bind(i)),o.then(void 0,i)},u.timeout=function(e,t,n){return u(e).timeout(t,n)},c.prototype.timeout=function(e,t){var n=l(),i=setTimeout(function(){t&&"string"!=typeof t||((t=new Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)},e);return this.then(function(e){clearTimeout(i),n.resolve(e)},function(e){clearTimeout(i),n.reject(e)},n.notify),n.promise},u.delay=function(e,t){return void 0===t&&(t=e,e=void 0),u(e).delay(t)},c.prototype.delay=function(n){return this.then(function(e){var t=l();return setTimeout(function(){t.resolve(e)},n),t.promise})},u.nfapply=function(e,t){return u(e).nfapply(t)},c.prototype.nfapply=function(e){var t=l(),n=A(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},u.nfcall=function(e){var t=A(arguments,1);return u(e).nfapply(t)},c.prototype.nfcall=function(){var e=A(arguments),t=l();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},u.nfbind=u.denodeify=function(n){if(void 0===n)throw new Error("Q can't wrap an undefined function");var i=A(arguments,1);return function(){var e=i.concat(A(arguments)),t=l();return e.push(t.makeNodeResolver()),u(n).fapply(e).fail(t.reject),t.promise}},c.prototype.nfbind=c.prototype.denodeify=function(){var e=A(arguments);return e.unshift(this),u.denodeify.apply(void 0,e)},u.nbind=function(n,i){var o=A(arguments,2);return function(){var e=o.concat(A(arguments)),t=l();return e.push(t.makeNodeResolver()),u(function(){return n.apply(i,arguments)}).fapply(e).fail(t.reject),t.promise}},c.prototype.nbind=function(){var e=A(arguments,0);return e.unshift(this),u.nbind.apply(void 0,e)},u.nmapply=u.npost=function(e,t,n){return u(e).npost(t,n)},c.prototype.nmapply=c.prototype.npost=function(e,t){var n=A(t||[]),i=l();return n.push(i.makeNodeResolver()),this.dispatch("post",[e,n]).fail(i.reject),i.promise},u.nsend=u.nmcall=u.ninvoke=function(e,t){var n=A(arguments,2),i=l();return n.push(i.makeNodeResolver()),u(e).dispatch("post",[t,n]).fail(i.reject),i.promise},c.prototype.nsend=c.prototype.nmcall=c.prototype.ninvoke=function(e){var t=A(arguments,1),n=l();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},u.nodeify=function(e,t){return u(e).nodeify(t)},c.prototype.nodeify=function(t){if(!t)return this;this.then(function(e){u.nextTick(function(){t(null,e)})},function(e){u.nextTick(function(){t(e)})})},u.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var V=t();return u})}).call(this,e("_process"))},{_process:1}],3:[function(e,t,n){function r(e){switch(void 0===e?"undefined":G(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}t.exports=function(n,i,o,e){return i=i||"&",o=o||"=",null===n&&(n=void 0),"object"==(void 0===n?"undefined":G(n))?Object.keys(n).map(function(e){var t=encodeURIComponent(r(e))+o;return Array.isArray(n[e])?n[e].map(function(e){return t+encodeURIComponent(r(e))}).join(i):t+encodeURIComponent(r(n[e]))}).join(i):e?encodeURIComponent(r(e))+o+encodeURIComponent(r(n)):""}},{}],4:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function o(n,i,o){return l.default.information("zip:checkout:init"),c.default.Promise(function(e,t){return n.onCheckout(e,t,{})}).then(function(e){var t=e.redirect_uri||e.redirectUri||e.data&&(e.data.redirect_uri||e.data.redirectUri);if(!t)return l.default.debug("zip:checkout:error","Response does not contain redirectUri property"),o(e),void n.onError({code:"checkout_error",message:"The response does not contain the redirectUri property",detail:e});l.default.debug("zip:checkout:success",e),i({redirectUri:t})}).catch(function(e){l.default.debug("zip:checkout:error",e),o(e),n.onError({code:"checkout_error",message:"Checkout response error",detail:e})})}Object.defineProperty(n,"__esModule",{value:!0}),n.Checkout=void 0;var r=function(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),e},a=i(e("./modal")),s=i(e("./options")),u=i(e("./utility")),l=i(e("./console")),c=i((e("./events"),e("q"))),d=(r(h,null,[{key:"init",value:function(t){if("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),t=A({},s.default,t),!this._validate(t))return l.default.setLevel(t.logLevel),t.redirect?o(t,function(e){return t.redirectFn(e.redirectUri)}):(e=t,(n=new a.default).onClose=e.onComplete.bind(e),n.build(),void o(e,function(e){return n.setUri(e.redirectUri)},function(e){return n.close(!1)}));var e,n}},{key:"attachButton",value:function(e,t){var n=document.querySelectorAll(e);if(!n.length)return config.onError({code:"attach_error",message:"Cannot find button to attach zipMoney checkout"});for(var i=0;i<n.length;i++)u.default.addEventHandler(n[i],"click",function(){return Zip.Checkout.init(t)})}},{key:"_validate",value:function(e){return["error","information","debug"].indexOf(e.logLevel.toLowerCase())<0&&(e.logLevel="error"),["standard","express"].indexOf(e.request.toLowerCase())<0&&(e.request="standard"),e.onComplete=e.onComplete||function(){},e.onError=e.onError||function(){},e.checkoutUri||e.onCheckout!==s.default.onCheckout?"express"===e.request?e.onError({code:"not_implemented",message:"This feature is not yet implemented"}):e.redirect||e.onComplete!==s.default.onComplete||e.redirectUri?void 0:e.onError({code:"validation",message:"if onComplete function is not specified then redirectUri must be specified"}):e.onError({code:"validation",message:"if onCheckout function is not specified then checkoutUri must be specified"})}}]),h);function h(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h)}function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.Checkout=d},{"./console":5,"./events":6,"./modal":8,"./options":9,"./utility":10,q:2}],5:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i="error",o={error:function(){var e;(e=window.console).log.apply(e,arguments)},information:function(){var e;"error"!==i&&(e=window.console).log.apply(e,arguments)},debug:function(){var e;"debug"===i&&(e=window.console).log.apply(e,arguments)},setLevel:function(e){i=e}};n.default=o},{}],6:[function(c,e,d){(function(i){Object.defineProperty(d,"__esModule",{value:!0}),d.EventListener=void 0;var e=function(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e},t=c("./utility");function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}if((t&&t.__esModule?t:{default:t}).default.isIe){var n=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};n.prototype=i.Event.prototype,i.CustomEvent=n}var r={},a=d.EventListener=(e(s,null,[{key:"constructor",value:function(){r={}}},{key:"on",value:function(e,t){r[e]=t}},{key:"off",value:function(e){r[e]=null}}]),s);function s(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s)}a.Event=function(e,t){this.eventType=e,this.data=t||{}},a.Event.eventTypes={resize:"resize",transition:"transition",close:"close",complete:"complete",clear:"clear"};var u=window.addEventListener?"addEventListener":"attachEvent",l=window[u];l("attachEvent"==u?"onmessage":"message",function(e){var t,n;e.data.zipmoney&&(t=e.data.msg,n=new i.CustomEvent("zipmoney",{detail:t}),i.dispatchEvent(n))},!1),l("zipmoney",function(e){var t,n=e.detail.eventType,i=r[n];i?i(e.detail.data||{}):(t=e,console.log("Unexpected Event",t))},!1)}).call(this,void 0!==$e?$e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utility":10}],7:[function(i,e,t){(function(e){var t=i("./checkout"),n=i("./events");e.Zip=e.Zip||{},e.Zip.Checkout=t.Checkout,e.zipMoneyEvent=n.EventListener.ZipEvent}).call(this,void 0!==$e?$e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./checkout":4,"./events":6}],8:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}function s(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function u(e){for(var t=document.querySelectorAll("html, body"),n=0;n<t.length;n++)t[n].style.overflowY=e}function l(e){var t=document.body.currentStyle||window.getComputedStyle(document.body),n=e-(document.body.offsetHeight+(parseInt(t.marginTop,10)+parseInt(t.marginBottom,10))-parseInt(t.height,10));document.body.style.height=n+"px"}Object.defineProperty(n,"__esModule",{value:!0});var o=function(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e},a=i(e("./utility")),c=e("./events"),d=(i(e("./console")),{iframeWidth:400,iframeMinWidth:320,iframeInitialHeight:704,iframeMinHeight:600,verticalMargin:35}),h=["resize","transition","close","complete","clear"],p="https://d3k1w8lx8mqizo.cloudfront.net/zm/",f=(o(v,[{key:"build",value:function(){this._initialHtmlHeight=s(),window.scrollTo(0,0);var e,t,n,i,o,r=this._frame=(e=this._frameUri,t=this._isMobile,(n=document.createElement("iframe")).id="zipmoney-iframe",n.frameborder=0,A(n.style,{padding:"0",border:"none",zIndex:"999999",backgroundColor:"#FFF",backgroundImage:"url("+p+"spinner.gif)",backgroundRepeat:"no-repeat",backgroundPosition:"50% 50%"}),A(n.style,t?{overflow:"scroll",width:"100%",height:"100%",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",margin:"0"}:{width:d.iframeWidth+"px",minWidth:d.iframeMinWidth+"px",height:d.iframeInitialHeight+"px",margin:d.verticalMargin+"px auto 0 auto",display:"table-row",backgroundSize:"25%",textAlign:"center",boxShadow:"0px 0px 70px 0px rgb(0, 0, 0)"}),n.src=e||"",n);if(!this._isMobile){var a=((o=document.createElement("img")).src=p+"icon-close.png",A(o.style,{width:"50px",height:"50px",position:"absolute",top:"20px",right:"20px",cursor:"pointer"}),o);a.onclick=this.close.bind(this),this._overlay=((i=document.createElement("div")).className="zipmoney-overlay",A(i.style,{position:"absolute",left:"0",top:"0",display:"table-cell",textAlign:"center",verticalAlign:"middle",background:"rgba(0, 0, 0, 0.75)",zIndex:"10000",height:"100%",width:"100%"}),i),this._overlay.appendChild(a),this._overlay.appendChild(this._frame),this._overlay.appendChild(function(){var e=document.createElement("div");e.style.width=d.iframeWidth+"px",e.style.minWidth=d.iframeMinWidth+"px",e.style.margin="10px auto 0 auto",e.style.overflow="hidden";var t=document.createElement("img");t.src=p+"iframe-secure.png",t.style.cssFloat="left";var n=document.createElement("img");return n.src=p+"poweredby-trans.png",n.style.cssFloat="right",e.appendChild(t),e.appendChild(n),e}()),r=this._overlay}document.body.appendChild(r),this._isMobile&&l(this._frame.offsetHeight),u("auto"),this._startMonitoringWindowResize()}},{key:"setUri",value:function(e){this._frameUri=e,this._frame&&(this._frame.src=e)}},{key:"resize",value:function(e){var t=this._isMobile?16:0,n=(e=d.iframeMinHeight<=e?e:d.iframeMinHeight,(e+=t)+2*d.verticalMargin),i=r();this._frame.style.height=e+"px",this._overlay&&(this._overlay.style.height=Math.max(i,this._initialHtmlHeight,n)+"px"),this._isMobile&&l(e)}},{key:"transition",value:function(){window.scroll(0,0)}},{key:"close",value:function(e){var t=!(0<arguments.length&&void 0!==e)||e,n={state:"cancelled"};this._events.length&&(n=this._events.pop()),this._destroy(),this.onClose&&t&&this.onClose(n)}},{key:"complete",value:function(e){this._events.push(e)}},{key:"clear",value:function(){this._events=[]}},{key:"_startMonitoringWindowResize",value:function(){var o=this;this._resizeHandler=a.default.debounce(function(){return e=o,t=r(),n=s(),i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,e._overlay&&(e._overlay.style.height=Math.max(t,n)+"px"),void(e._isMobile||i<d.iframeWidth?e._frame.style.width="100%":e._frame.style.width=d.iframeWidth+"px");var e,t,n,i},250),a.default.addEventHandler(window,"resize",this._resizeHandler)}},{key:"_stopMonitoringWindowResize",value:function(){a.default.removeEventHandler(window,"resize",this._resizeHandler)}},{key:"_destroy",value:function(){this._stopMonitoringWindowResize(),this._overlay?document.body.removeChild(this._overlay):document.body.removeChild(this._frame),this._isMobile&&(document.body.style.height="initial"),u("initial"),this._overlay=this._frame=null,h.forEach(function(e){return c.EventListener.off(c.EventListener.Event.eventTypes[e])})}}]),v);function v(){var t=this;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,v),this._events=[],this._isMobile=a.default.isMobileDevice(),h.forEach(function(e){return c.EventListener.on(c.EventListener.Event.eventTypes[e],t[e].bind(t))})}function m(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.default=f},{"./console":5,"./events":6,"./utility":10}],9:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var o=i(e("./xr")),r=i(e("./console"));o.default.configure({headers:{"X-Requested-With":"XMLHttpRequest"}});var a={request:"standard",redirect:!1,logLevel:"Error",onCheckout:function(t,e){o.default.post(this.checkoutUri).then(function(e){return t(e.data)}).catch(e)},onShippingAddressChanged:function(e,t){o.default.post(this.shippingUri).then(e).catch(t)},onComplete:function(e){if(r.default.information("zip:completed",e),"cancelled"!==e.state){var t=e.checkoutId?"&checkoutId="+e.checkoutId:"";this.redirectFn(this.redirectUri+"?result="+e.state+t)}},onError:function(e){r.default.error(e)},redirectFn:function(e){window.location.href=e}};n.default=a},{"./console":5,"./xr":11}],10:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=(function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}(o,null,[{key:"isIe",value:function(){var e=-1,t=window.navigator.userAgent,n=t.indexOf("MSIE "),i=t.indexOf("Trident/");if(0<n)e=parseInt(t.substring(n+5,t.indexOf(".",n)),10);else if(0<i){var o=t.indexOf("rv:");e=parseInt(t.substring(o+3,t.indexOf(".",o)),10)}return-1<e?e:void 0}},{key:"isMobileDevice",value:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}},{key:"debounce",value:function(i,o){var r;return function(){var e=this,t=arguments,n=!r;clearTimeout(r),r=setTimeout(function(){r=null,i.apply(e,t)},o),n&&i.apply(e,t)}}},{key:"addEventHandler",value:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}},{key:"removeEventHandler",value:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}}]),o);function o(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}n.default=i},{}],11:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function l(e){for(var t=arguments.length,n=Array(1<t?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var o in n)if({}.hasOwnProperty.call(n,o)){var r=n[o];if("object"===(void 0===r?"undefined":c(r)))for(var a in r)!{}.hasOwnProperty.call(r,a)||(e[a]=r[a])}return e}function o(s){return t=function(t,n){var i=l({},p,f,s),o=i.xmlHttpRequest();for(var e in i.abort&&s.abort(function(){n(u(o)),o.abort()}),o.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,d.default)(i.params):i.url,!0),o.withCredentials=i.withCredentials,o.addEventListener(h.LOAD,function(){if(200<=o.status&&o.status<300){var e=null;o.responseText&&(e=!0===i.raw?o.responseText:i.load(o.responseText)),t(u(o,e))}else n(u(o))}),o.addEventListener(h.ABORT,function(){return n(u(o))}),o.addEventListener(h.ERROR,function(){return n(u(o))}),o.addEventListener(h.TIMEOUT,function(){return n(u(o))}),i.headers)!{}.hasOwnProperty.call(i.headers,e)||o.setRequestHeader(e,i.headers[e]);for(var r in i.events)!{}.hasOwnProperty.call(i.events,r)||o.addEventListener(r,i.events[r].bind(null,o),!1);var a="object"!==c(i.data)||i.raw?i.data:i.dump(i.data);void 0!==a?o.send(a):o.send()},((e=s)&&e.promise?e.promise:f.promise||p.promise)(t);var e,t}Object.defineProperty(n,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==G(Symbol.iterator)?function(e){return void 0===e?"undefined":G(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":G(e)},d=i(e("querystring/encode")),r=i(e("q")),a={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},h={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p={method:a.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:JSON.stringify,load:JSON.parse,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return r.default.Promise(e)},withCredentials:!1},f={};o.assign=l,o.encode=d.default,o.configure=function(e){f=l({},f,e)},o.Methods=a,o.Events=h,o.defaults=p,o.get=function(e,t,n){return o(l({url:e,method:a.GET,params:t},n))},o.put=function(e,t,n){return o(l({url:e,method:a.PUT,data:t},n))},o.post=function(e,t,n){return o(l({url:e,method:a.POST,data:t},n))},o.patch=function(e,t,n){return o(l({url:e,method:a.PATCH,data:t},n))},o.del=function(e,t){return o(l({url:e,method:a.DELETE},t))},o.options=function(e,t){return o(l({url:e,method:a.OPTIONS},t))},n.default=o},{q:2,"querystring/encode":3}]},{},[7])}));var it=(o(ot,Ze),t(ot,[{key:"run",value:function(){this.runs=!0,this.background.initLoader()}},{key:"isRunning",value:function(){return this.runs}},{key:"next",value:function(e){var t=this;this.background.clear(),this.checkout=e;var n=String("/v1/echo");n=x.extendSearchParams(n,h.validateJWT(this.publicKey)?"access_token":"public_key",this.publicKey),n=x.extendSearchParams(n,"json_body",encodeURIComponent(JSON.stringify({redirect_uri:this.checkout.link}))),Zip.Checkout.init({checkoutUri:this.echoEnv.getConf().url+n,onComplete:function(e){return t.eventHandler(e)},onError:function(e){return t.eventHandler(e)}})}},{key:"onStop",value:function(e){var t=this;this.eventEmitter.subscribe(Ke,function(){t.background.clear(),e()})}},{key:"onCheckout",value:function(e,t){var n=this;this.eventEmitter.subscribe(e,function(){t(n.checkout)})}},{key:"eventHandler",value:function(e){switch(this.runs=!1,e.state){case"approved":this.eventEmitter.emit(Ke,{}),this.eventEmitter.emit(Ye,{});break;case"declined":this.eventEmitter.emit(Ke,{}),this.eventEmitter.emit(Ge,{});break;case"cancelled":this.eventEmitter.emit(Ke,{});break;case"referred":this.eventEmitter.emit(Ke,{}),this.eventEmitter.emit(Je,{});break;default:console.warn("Unknown gateway status")}}},{key:"getSuccessRedirectUri",value:function(){return this.customRedirectUti?this.customRedirectUti:this.widgetEnv.getConf().url+String("/checkout/zipmoney")}},{key:"getErrorRedirectUri",value:function(){return this.getSuccessRedirectUri()}},{key:"setEnv",value:function(e,t){a(ot.prototype.__proto__||Object.getPrototypeOf(ot.prototype),"setEnv",this).call(this,e,t),this.echoEnv.setEnv(e,t)}}]),ot);function ot(e){l(this,ot);var t=c(this,(ot.__proto__||Object.getPrototypeOf(ot)).call(this));return t.publicKey=e,t.checkout=null,t.runs=!1,t.eventEmitter=new Le,t.echoEnv=new P([{env:f,url:"https://api-sandbox."},{env:v,url:"https://api-sandbox."},{env:m,url:"https://api-sandbox-demo."},{env:y,url:"https://api-sandbox-demo."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}]),t}o(rt,Te),t(rt,[{key:"getLink",value:function(){return String("/v1/gateways/:gateway_id").replace(":gateway_id",this.gatewayID)}},{key:"sendRequest",value:function(e,n,t){var i=2<arguments.length&&void 0!==t?t:function(e){};this.get(e,function(e,t){n(e)},function(e,t){void 0===e.message?i(t+": unknown error"):i(e.message)})}}],[{key:"sendRequest",value:function(e,t,n,i,o){var r=4<arguments.length&&void 0!==o?o:function(e){},a=new this(e);a.setEnv(n),a.sendRequest(t,i,r)}}]);function rt(e){l(this,rt);var t=c(this,(rt.__proto__||Object.getPrototypeOf(rt)).call(this));return t.gatewayID=e,t}var at="Zipmoney",st="PaypalClassic",ut="Afterpay",lt="paydock-dispatcher",ct=(t(dt,[{key:"restartDispatcher",value:function(){var e=document.getElementById(lt);e&&e.parentNode.removeChild(e);var t=document.createElement("iframe");t.setAttribute("src",this.env.getConf().url+"/dispatcher"),t.id=lt,t.style.display="none",document.body.appendChild(t)}},{key:"on",value:function(n,i){var o=this;le.subscribe("message",window,function(e){var t=null;try{t=JSON.parse(e.data)}catch(e){}t&&t.message_source===o.messageSource&&t.event===n&&i(t)})}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.restartDispatcher()}}]),dt);function dt(e){l(this,dt),this.messageSource=e,this.env=new P([{env:f,url:"https://widget-sandbox."},{env:v,url:"https://widget-sandbox."},{env:m,url:"https://widget-sandbox-demo."},{env:y,url:"https://widget-sandbox-demo."},{env:g,url:"https://widget."},{env:_,url:"https://widsta."},{env:k,url:"https://widsta-2."},{env:E,url:"https://widsta-3."},{env:b,url:"https://widsta-4."},{env:w,url:"https://widsta-5."}])}var ht=(t(pt,[{key:"isExist",value:function(){return!(!this.getElement()||this.getElement().closed)}},{key:"getElement",value:function(){return this.window}},{key:"init",value:function(){var e=this;if(!Me.isSupportPopUp())return this.window=window;var t=this.getConfigs();this.window=window.open("about:blank","_blank","width="+t.width+",height="+t.height+",top="+t.top+",left="+t.left+",scrollbars="+(t.scrollbars?"yes":"no")+",resizable="+(t.resizable?"yes":"no")),this.showLoader();var n=setInterval(function(){e.isExist()||(clearInterval(n),e.eventEmitter.emit("close",{}))},200)}},{key:"redirect",value:function(e){this.isExist()&&(this.window.location.href=e)}},{key:"close",value:function(){this.isExist()&&this.getElement().close&&(this.getElement().close(),this.window=null)}},{key:"focus",value:function(){this.isExist()&&this.getElement().focus&&this.getElement().focus()}},{key:"setConfigs",value:function(e){this.configs=A(this.configs,e)}},{key:"getNetConfigs",value:function(){return A({},this.configs)}},{key:"getConfigs",value:function(){var e=this.getNetConfigs();return e.left=window.screenX+(window.screen.width/2-e.width/2),e.top=window.screenY+(window.screen.height/2-e.height/2),e}},{key:"onClose",value:function(e){this.eventEmitter.subscribe("close",e)}},{key:"initError",value:function(e){this.getElement().document.write("."),(this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0]).innerHTML="<style>\n .error-wrapper {\n color: #ff0000;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n }\n </style>"+'<div class="error-wrapper"><div>{{error}}</div></div>'.replace("{{error}}",e)}},{key:"showLoader",value:function(){this.getElement().document.write(".");var e=this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0];if(e.innerHTML=Ue+De,this.env===_&&this.env===k&&this.env===E&&this.env===b&&this.env===w){var t=0;le.subscribe("click",e,function(){5==++t&&(e.innerHTML='\n <style>\n html{width: 100%;height: 100%;}\n body{margin: 0px;padding: 0px;background-color: #111;}\n \n .eye{\n width: 20px; height: 8px;\n background-color: #eee;\n border-radius:0px 0px 20px 20px;\n position: relative;\n top: 40px;\n left: 10px;\n box-shadow: 40px 0px 0px 0px #eee; \n }\n \n .head{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden; \n position: relative;\n margin: -250px auto;\n width: 80px; height: 80px;\n background-color: #111;\n border-radius:50px;\n box-shadow: inset -4px 2px 0px 0px #eee;\n -webkit-animation:node 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n .body{ \n position: relative;\n margin: 90px auto;\n width: 140px; height: 120px;\n background-color: #111;\n border-radius: 50px/25px ;\n box-shadow: inset -5px 2px 0px 0px #eee;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out; \n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out; \n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out; \n }\n \n @keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-moz-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-moz-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-webkit-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-webkit-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n \n \n .circ{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin: 60px auto;\n width: 180px; height: 180px;\n background-color: #111;\n border-radius: 0px 0px 50px 50px;\n position: relative;\n z-index: -1; \n left: 0%;\n top: 20%;\n overflow: hidden;\n }\n \n .hands{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin-top: 140px;\n width: 120px;height: 120px;\n position: absolute;\n background-color: #111;\n border-radius:20px;\n box-shadow:-1px -4px 0px 0px #eee;\n transform:rotate(45deg);\n -webkit-transform:rotate(45deg);\n -mox-transform:rotate(45deg);\n top:75%;left: 16%;\n z-index: 1;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n \n .load{ position: absolute;\n width: 100px; height: 20px;\n margin: -10px auto;\n -webkit-font-smoothing: antialiased;\n -moz-font-smoothing: antialiased;\n font-smoothing: antialiased;\n font-family: \'Julius Sans One\', sans-serif;\n font-size:30px;\n font-weight:400;\n color:#eee;\n left: 10%;\n top: 5%;\n }\n </style>\n\n <div class="circ">\n <div class="load">A little patience ...</div>\n <div class="hands"></div>\n <div class="body"></div>\n <div class="head">\n <div class="eye"></div>\n </div>\n </div>\n')})}}},{key:"setEnv",value:function(e){this.env=e}}]),pt);function pt(){l(this,pt),this.configs={width:500,height:500,scrollbars:!0,resizable:!0,top:0,left:0},this.eventEmitter=new Le}var ft=(o(vt,Ze),t(vt,[{key:"run",value:function(){this.isRunning()||(this.popup.init(),this.background.initControl())}},{key:"isRunning",value:function(){return this.popup.isExist()}},{key:"next",value:function(e){this.checkout=e,Me.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.checkout.link)}},{key:"continue",value:function(){this.popup.focus()}},{key:"stop",value:function(){this.popup.close()}},{key:"onStop",value:function(e){var t=this;this.popup.onClose(function(){t.background.clear(),t.checkout=null,e()})}},{key:"onCheckout",value:function(e,i){var o=this;this.dispatcher.on(e,function(e){if(o.checkout&&o.checkout.reference_id===e.reference_id)o.background.clear(),i(o.checkout);else if(!Me.isSupportPopUp()){var t=window.localStorage.getItem("paydock_checkout_token");if(!t)return;var n=JSON.parse(t);n&&n.reference_id===e.reference_id&&(window.localStorage.removeItem("paydock_checkout_token"),o.checkout=n,o.background.clear(),i(o.checkout))}})}},{key:"setEnv",value:function(e,t){a(vt.prototype.__proto__||Object.getPrototypeOf(vt.prototype),"setEnv",this).call(this,e,t),this.dispatcher.setEnv(e,t),this.popup.setEnv(e)}}]),vt);function vt(e){l(this,vt);var t=c(this,(vt.__proto__||Object.getPrototypeOf(vt)).call(this));return t.publicKey=e,t.checkout=null,t.dispatcher=new ct("checkout.paydock"),setTimeout(function(){return t.dispatcher.restartDispatcher()},200),t.popup=new ht,t}var mt=(o(yt,ft),t(yt,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+x.extendSearchParams("/checkout/success","merchant",encodeURIComponent(window.location.href))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+x.extendSearchParams("/checkout/error","merchant",encodeURIComponent(window.location.href))}}]),yt);function yt(){return l(this,yt),c(this,(yt.__proto__||Object.getPrototypeOf(yt)).apply(this,arguments))}var gt=(o(_t,ft),t(_t,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/success".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/error".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"next",value:function(e){this.checkout=e,Me.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.getRedirectUrl())}},{key:"error",value:function(e,t,n){return!t||t&&"invalid_amount"!==t?n(!0):(this.popup.initError(e),n(!1))}},{key:"run",value:function(){this.isRunning()||(this.popup.setConfigs({width:420,height:715}),this.popup.init(),this.background.initControl())}},{key:"getRedirectUrl",value:function(){var e="live"===this.checkout.mode?"live":"test";return this.widgetEnv.getConf().url+x.extendSearchParams("/checkout/afterpay/init","token",encodeURIComponent(this.checkout.reference_id))+"&env="+encodeURIComponent(e)}}]),_t);function _t(){return l(this,_t),c(this,(_t.__proto__||Object.getPrototypeOf(_t)).apply(this,arguments))}var kt={CLICK:"click",POPUP_REDIRECT:"popupRedirect",ERROR:"error",REFERRED:"referred",DECLINED:"declined",CANCELLED:"cancelled",ACCEPTED:"accepted",FINISH:"finish",CLOSE:"close"},Et=(t(bt,[{key:"initCheckout",value:function(){var n=this;this.container.on("click",function(e){if(!n.runner.isRunning()){n.eventEmitter.emit(kt.CLICK,{}),n.runner.run();var t=new Ae(n.gatewayId,n.runner.getSuccessRedirectUri(),n.runner.getErrorRedirectUri());t.setMeta(n.meta),t.setEnv(n.env),t.send(n.aceessToken,function(e){n.eventEmitter.emit(kt.POPUP_REDIRECT,{}),n.runner.next(e)},function(e,t){n.eventEmitter.emit(kt.ERROR,{}),n.runner.error(e,t,function(e){e&&n.close()})})}})}},{key:"initCheckoutHandlers",value:function(){var t=this;this.runner.onCheckout(Ye,function(e){t.eventEmitter.emit(kt.ACCEPTED,{}),t.background.initLoader(),t.close(),t.checkToken(e.token,function(){t.createOneTimeToken(e.token)})}),this.runner.onCheckout(Xe,function(){t.eventEmitter.emit(kt.ERROR,{}),console.error("Error from checkout server"),t.close()}),this.runner.onCheckout(Je,function(){t.eventEmitter.emit(kt.REFERRED,{}),t.close()}),this.runner.onCheckout(Ge,function(){t.eventEmitter.emit(kt.DECLINED,{}),t.close()}),this.eventEmitter.subscribe(kt.ERROR,function(){t.background.clear()}),this.eventEmitter.subscribe(kt.FINISH,function(){t.background.clear()})}},{key:"checkToken",value:function(e,t){var n=this,i=new xe(e);i.setEnv(this.env),i.send(this.aceessToken,function(e){n.details=e,t()},function(){n.eventEmitter.emit(kt.ERROR,{}),console.error("Error during creating payment source token")})}},{key:"createOneTimeToken",value:function(e){var t=this,n=new We(this.gatewayId,e,qe.CHECKOUT_TOKEN);n.setEnv(this.env),n.send(this.aceessToken,function(e){t.eventEmitter.emit(kt.FINISH,{payment_source_token:e,checkout_email:t.details.checkout_email,checkout_holder:t.details.checkout_holder,gateway_type:t.details.gateway_type})},function(){t.eventEmitter.emit(kt.ERROR,{}),console.error("Error during creating payment source token")})}},{key:"on",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"close",value:function(){this.runner.stop()}},{key:"onFinishInsert",value:function(t,n){this.on(kt.FINISH,function(e){le.insertToInput(t,n,e)})}},{key:"setMeta",value:function(e){this.meta=A(this.meta,e)}},{key:"setBackdropDescription",value:function(e){this.runner.setBackgroundDescription(e)}},{key:"setBackdropTitle",value:function(e){this.runner.setBackgroundTitle(e)}},{key:"setSuspendedRedirectUri",value:function(e){this.runner.setCustomRedirectUri(e)}},{key:"turnOffBackdrop",value:function(){this.turnOffControlBackdrop(),this.turnOffLoaderBackdrop()}},{key:"turnOffControlBackdrop",value:function(){this.runner.turnOffBackdrop()}},{key:"turnOffLoaderBackdrop",value:function(){this.background.turnOffLoader()}},{key:"setEnv",value:function(e,t){this.env=e,this.runner.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env}}]),bt);function bt(e,t){var n=this,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default",o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:st;switch(l(this,bt),this.aceessToken=t,this.gatewayId=i,this.gatewayType=o,this.details=null,this.meta={},this.env=C,this.eventEmitter=new Le,this.container=new de(e),this.background=new Be,o){case st:this.runner=new mt(t);break;case ut:this.runner=new gt(t);break;case at:this.runner=new it(t)}this.initCheckout(),this.initCheckoutHandlers(),this.runner.onStop(function(){n.eventEmitter.emit(kt.CLOSE,{})})}var wt=(o(St,Et),t(St,[{key:"setSuspendedRedirectUri",value:function(e){a(St.prototype.__proto__||Object.getPrototypeOf(St.prototype),"setSuspendedRedirectUri",this).call(this,e)}}]),St);function St(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default";l(this,St);var i=c(this,(St.__proto__||Object.getPrototypeOf(St)).call(this,e,t,n,at));return i.publicKey=t,i.gatewayId=n,i}var Ct=(o(Ot,Et),Ot);function Ot(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default";l(this,Ot);var i=c(this,(Ot.__proto__||Object.getPrototypeOf(Ot)).call(this,e,t,n,ut));return i.accessToken=t,i.gatewayId=n,i}var Tt,Pt,At=(o(Rt,Et),Rt);function Rt(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"default";l(this,Rt);var i=c(this,(Rt.__proto__||Object.getPrototypeOf(Rt)).call(this,e,t,n,st));return i.publicKey=t,i.gatewayId=n,i}(Pt=Tt=Tt||{}).AFTER_LOAD="after_load",Pt.UNAVAILABLE="unavailable",Pt.START_LOADING="start_loading",Pt.END_LOADING="end_loading",Pt.UPDATE="update",Pt.PAYMENT_SUCCESSFUL="payment_successful",Pt.PAYMENT_IN_REVIEW="payment_in_review",Pt.PAYMENT_ERROR="payment_error";var xt=(o(It,me),t(It,[{key:"on",value:function(e,t,n){for(var i in Tt)Tt.hasOwnProperty(i)&&e===Tt[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}]),It);function It(){return l(this,It),c(this,(It.__proto__||Object.getPrototypeOf(It)).apply(this,arguments))}var Lt={CLOSE:"close",UPDATED:"updated"},Nt=(o(Dt,_e),t(Dt,[{key:"push",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};if(this.iFrame.isExist()){-1===j.values(Lt).indexOf(e)&&console.warn("unsupported trigger type");var i={message_source:"wallet.paydock",reference_id:this.widgetId,trigger:e,destination:"widget.paydock",data:n};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(i),"*")}}}]),Dt);function Dt(e,t){l(this,Dt);var n=c(this,(Dt.__proto__||Object.getPrototypeOf(Dt)).call(this,e));return n.widgetId=t,n}var Ut=(o(Mt,Be),t(Mt,[{key:"initControl",value:function(){this.imageStyle||this.createImageStyles(),a(Mt.prototype.__proto__||Object.getPrototypeOf(Mt.prototype),"initControl",this).call(this)}},{key:"clear",value:function(){this.imageStyle&&this.imageStyle.parentNode.removeChild(this.imageStyle),this.imageStyle=null,a(Mt.prototype.__proto__||Object.getPrototypeOf(Mt.prototype),"clear",this).call(this)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <div class="checkout-bg-logo"></div>\n <a href="#" data-close>Close</a>\n </div>\n');this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout(function(){e.isInit()&&e.overlay.classList.add("display")},5)}},{key:"createImageStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n }\n");document.querySelector(".checkout-container"),t=t.replace("{{url}}",this.bgImageUrl),this.imageStyle=document.createElement("style"),this.imageStyle.type="text/css",this.imageStyle.appendChild(document.createTextNode(t)),e.appendChild(this.imageStyle)}}]),Mt);function Mt(e){l(this,Mt);var t=c(this,(Mt.__proto__||Object.getPrototypeOf(Mt)).call(this));return t.bgImageUrl=e,t.imageStyle=null,t}var jt={UNAVAILABLE:"unavailable",UPDATE:"update",PAYMENT_METHOD_SELECTED:"payment_method_selected",PAYMENT_SUCCESS:"payment_success",PAYMENT_IN_REVIEW:"payment_in_review",PAYMENT_ERROR:"payment_error",CALLBACK:"callback"},Ft=(t(Ht,[{key:"initializeChildWallets",value:function(){this.childWallets=[]}},{key:"getGatewayName",value:function(){throw new Error("Method not implemented")}},{key:"setEnv",value:function(e){return this.env=e,this}},{key:"load",value:function(t){this.childWallets.forEach(function(e){return e.load(t)})}},{key:"update",value:function(){}},{key:"on",value:function(e,t){var n=this;if(-1===j.values(jt).indexOf(e))throw new Error("invalid wallet event");return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise(function(t){return n.eventEmitter.subscribe(e,function(e){return t(e)})})}}]),Ht);function Ht(e,t){l(this,Ht),this.publicKey=e,this.meta=t,this.env=f,this.eventEmitter=new Le,this.initializeChildWallets()}var Bt=(o(zt,Ft),t(zt,[{key:"load",value:function(e){this.container=e,this.iFrame=new pe(this.container);var t=this.link.getParams().widget_id;this.triggerElement=new Nt(this.iFrame,t),this.setupIFrameEvents(t),this.background=this.initBackground(),this.iFrame.load(this.link.getUrl())}},{key:"close",value:function(){this.triggerElement.push(Lt.CLOSE),this.background.clear()}},{key:"update",value:function(e){this.triggerElement.push(Lt.UPDATED,e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),this}},{key:"initBackground",value:function(){var e=this,t=new Ut(this.link.getNetUrl().replace(D,"/images/logo.png"));return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Fe,function(){return e.triggerElement.push(Lt.CLOSE)}),t}},{key:"setupIFrameEvents",value:function(e){var t=this;this.event.on(Tt.UNAVAILABLE,e,function(e){return t.eventEmitter.emit(jt.UNAVAILABLE,null)}),this.event.on(Tt.START_LOADING,e,function(e){return t.background.initControl()}),this.event.on(Tt.END_LOADING,e,function(e){return t.background.clear()}),this.event.on(Tt.UPDATE,e,function(e){t.eventEmitter.emit(jt.UPDATE,t.parseUpdateData(e))}),this.event.on(Tt.PAYMENT_SUCCESSFUL,e,function(e){t.eventEmitter.emit(jt.PAYMENT_SUCCESS,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()}),this.event.on(Tt.PAYMENT_IN_REVIEW,e,function(e){t.eventEmitter.emit(jt.PAYMENT_IN_REVIEW,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()}),this.event.on(Tt.PAYMENT_ERROR,e,function(e){t.eventEmitter.emit(jt.PAYMENT_ERROR,e),t.iFrame.getElement()||t.background.clear()})}},{key:"parsePaymentSuccessfulData",value:function(e){var t;return{id:this.meta.id,amount:e.amount,currency:e.currencyCode,status:null===(t=e.charge)||void 0===t?void 0:t.status}}},{key:"parseUpdateData",value:function(e){return A(A(A({wallet_response_code:e.responseCode,wallet_session_id:e.sessionId},e.paymentMethodDetails?{payment_source:{wallet_payment_method_id:e.paymentMethodDetails.paymentMethodId,card_number_last4:e.paymentMethodDetails.lastFourDigitsOfPan,card_scheme:e.paymentMethodDetails.paymentScheme}}:{}),e.loyaltyAccountSummary?{wallet_loyalty_account:{id:e.loyaltyAccountSummary.loyaltyAccountId,barcode:e.loyaltyAccountSummary.loyaltyAccountBarcode}}:{}),e.deliveryAddressDetails?{shipping:{address_line1:e.deliveryAddressDetails.line1,address_line2:e.deliveryAddressDetails.line2,address_postcode:e.deliveryAddressDetails.postalCode,address_city:e.deliveryAddressDetails.city,address_state:e.deliveryAddressDetails.state,address_country:e.deliveryAddressDetails.countryCode,address_company:e.deliveryAddressDetails.companyName,wallet_address_id:e.deliveryAddressDetails.addressId,post_office_box_number:e.deliveryAddressDetails.postOfficeBoxNumber,wallet_address_created_timestamp:e.deliveryAddressDetails.createdTimestamp,wallet_address_updated_timestamp:e.deliveryAddressDetails.updatedTimestamp,wallet_address_name:e.deliveryAddressDetails.name}}:{})}}]),zt);function zt(e,t){l(this,zt);var n=c(this,(zt.__proto__||Object.getPrototypeOf(zt)).call(this,e,t));n.link=new U(D);var i=t.amount,o=t.currency,r=t.id,a=t.gateway_mode,s=t.reference,u=t.request_shipping;return n.link.setParams(A({token:e,amount:i,currency:o,gateway_mode:a,credentials:s||r},u?{request_shipping:u}:{})),n.token=e,n.event=new xt(window),n}var qt=(o(Wt,Ft),t(Wt,[{key:"load",value:function(e){var o=this;if(window.Promise){var t=e.getElement().id||"",n=document.createElement("script");n.src="https://www.paypal.com/sdk/js?client-id="+this.publicKey+"¤cy="+this.meta.currency+(!0===this.meta.pay_later?"&enable-funding=paylater&disable-funding=card":"&disable-funding=credit,card")+(this.meta.capture?"":"&intent=authorize"),n.async=!0,n.onload=function(){window.paypal?(o.paypal=window.paypal,o.paypal.Buttons(A(A({},o.meta.style&&{style:o.meta.style}),{createOrder:function(){return new Promise(function(t,n){o.eventEmitter.emit(jt.CALLBACK,{data:A({request_type:"CREATE_TRANSACTION"},o.meta.request_shipping&&{request_shipping:o.meta.request_shipping}),onSuccess:function(e){return t(e.id)},onError:function(e){return n(e)}})})},onShippingChange:function(i){return new Promise(function(e,t){var n=o.parseUpdateData(i);o.latestShippingData=n.shipping,o.latestShippingChangePromiseResolve=e,o.latestShippingChangePromiseReject=t,o.eventEmitter.emit(jt.UPDATE,n)})},onApprove:function(n){return new Promise(function(e,t){return o.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:{payment_method_id:n.orderID,customer:{payment_source:{external_payer_id:n.payerID}}},onSuccess:function(){return e(!0)},onError:function(e){return t(e)}})})},onError:function(){}})).render("#"+t)):o.eventEmitter.emit(jt.UNAVAILABLE,null)},document.head.appendChild(n)}else this.eventEmitter.emit(jt.UNAVAILABLE,null)}},{key:"update",value:function(e){var t=this;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject)return e.success?void this.eventEmitter.emit(jt.CALLBACK,{data:{request_type:"UPDATE_TRANSACTION",shipping:this.latestShippingData},onSuccess:function(){return t.latestShippingChangePromiseResolve(!0)},onError:function(){return t.latestShippingChangePromiseReject()}}):this.latestShippingChangePromiseReject()}},{key:"parseUpdateData",value:function(e){var t;return A(A({wallet_order_id:e.orderID,wallet_session_id:e.paymentID,payment_source:{wallet_payment_method_id:e.paymentToken}},e.shipping_address&&{shipping:{address_city:e.shipping_address.city,address_state:e.shipping_address.state,address_postcode:e.shipping_address.postal_code,address_country:e.shipping_address.country_code}}),e.selected_shipping_option&&{selected_shipping_option:{id:e.selected_shipping_option.id,label:e.selected_shipping_option.label,amount:e.selected_shipping_option.amount.value,currency:e.selected_shipping_option.amount.currency_code,type:null===(t=e.selected_shipping_option)||void 0===t?void 0:t.type}})}}]),Wt);function Wt(){return l(this,Wt),c(this,(Wt.__proto__||Object.getPrototypeOf(Wt)).apply(this,arguments))}var Vt=nt(function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"===G(Symbol.iterator)?function(e){return void 0===e?"undefined":G(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":G(e)})(e)}Object.defineProperty(t,"__esModule",{value:!0});function o(i){return null!==l?l:l=new Promise(function(e,t){if("undefined"!=typeof window)if(window.Stripe&&i&&console.warn(u),window.Stripe)e(window.Stripe);else try{var n=function(){for(var e=document.querySelectorAll('script[src^="'.concat(a,'"]')),t=0;t<e.length;t++){var n=e[t];if(s.test(n.src))return n}return null}();n&&i?console.warn(u):n=n||function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(a).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n}(i),n.addEventListener("load",function(){window.Stripe?e(window.Stripe):t(new Error("Stripe.js not available"))}),n.addEventListener("error",function(){t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else e(null)})}function i(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];c=!0;var i=Date.now();return o(r).then(function(e){return function(e,t,n){if(null===e)return null;var i,o,r=e.apply(void 0,t);return o=n,(i=r)&&i._registerWrapper&&i._registerWrapper({name:"stripe-js",version:"1.11.0",startTime:o}),r}(e,t,i)})}var r,a="https://js.stripe.com/v3",s=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,u="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",l=null,c=!1;i.setLoadParameters=function(e){if(c)throw new Error("You cannot change load parameters after calling loadStripe");r=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==n(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)}(e)},t.loadStripe=i});tt(Vt);Vt.loadStripe;var Yt=Vt.loadStripe,Gt="success",Kt="fail",Jt=(o(Xt,Ft),t(Xt,[{key:"initPaymentRequest",value:function(){return this.stripe.paymentRequest({country:this.meta.country.toUpperCase(),currency:this.meta.currency.toLowerCase(),total:{label:this.meta.amount_label,amount:Math.floor(100*this.meta.amount)},requestPayerName:!0===this.meta.request_payer_name,requestPayerEmail:!0===this.meta.request_payer_email,requestPayerPhone:!0===this.meta.request_payer_phone})}},{key:"createWalletButton",value:function(){return this.stripe.elements().create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"load",value:function(t){var n=this;return Yt(this.publicKey).then(function(e){n.stripe=e,n.paymentRequest=n.initPaymentRequest()}).then(function(){return n.checkAvailability()}).then(function(e){return n.mount(t,e)}).then(function(){return n.setOnPaymentMethodSelected()})}},{key:"checkAvailability",value:function(){var i=this;return this.paymentRequest.canMakePayment().then(function(e){if(e){var t=!i.meta.wallets||i.meta.wallets.includes(z.GOOGLE),n=!i.meta.wallets||i.meta.wallets.includes(z.APPLE);return{google_pay:t&&!e.applePay,apple_pay:n&&e.applePay,flypay:!1}}})}},{key:"mount",value:function(e,t){if(!t||!t.apple_pay&&!t.google_pay)return this.eventEmitter.emit(jt.UNAVAILABLE,null);this.createWalletButton().mount(e.getElement())}},{key:"setOnPaymentMethodSelected",value:function(){var c=this;this.paymentRequest.on("paymentmethod",function(e){var t,n,i=e.paymentMethod,o=i.id,r=i.card,a=i.billing_details,s=a.name,u=a.address,l={payment_method_id:o,customer:{payer_name:e.payerName,payer_email:e.payerEmail,payer_phone:e.payerPhone,payment_source:{wallet_type:c.getWalletType(null===(t=null==r?void 0:r.wallet)||void 0===t?void 0:t.type),card_name:s,type:null===(n=null==r?void 0:r.wallet)||void 0===n?void 0:n.type,card_scheme:null==r?void 0:r.brand,card_number_last4:null==r?void 0:r.last4,expire_month:null==r?void 0:r.exp_month,expire_year:null==r?void 0:r.exp_year,address_line1:u.line1,address_line2:u.line2,address_city:u.city,address_postcode:u.postal_code,address_state:u.state,address_country:u.country}}};c.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:l,onSuccess:function(){return e.complete(Gt)},onError:function(){return e.complete(Kt)}})})}},{key:"getWalletType",value:function(e){return e?"google_pay"===e?z.GOOGLE:z.APPLE:null}}]),Xt);function Xt(){return l(this,Xt),c(this,(Xt.__proto__||Object.getPrototypeOf(Xt)).apply(this,arguments))}var Zt=(o(Qt,Ft),t(Qt,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[z.APPLE])||void 0===n?void 0:n.merchant)||""}},{key:"getMetaStyles",value:function(){var e,t,n;if(null!==(e=this.meta)&&void 0!==e&&e.style&&"object"===G(null===(t=this.meta)||void 0===t?void 0:t.style)){var i=JSON.parse(JSON.stringify(null===(n=this.meta)||void 0===n?void 0:n.style));return"google"in i&&(null==i||delete i.google),"apple"in i?null==i?void 0:i.apple:i}return null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i;if(null!==(e=this.meta)&&void 0!==e&&e.raw_data_initialization&&null!==(t=this.meta)&&void 0!==t&&t.raw_data_initialization&&"object"===G(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)){var o=JSON.parse(JSON.stringify(null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization));return"google"in o&&(null==o||delete o.google),"apple"in o?null==o?void 0:o.apple:o}return null}},{key:"isShippingRequired",value:function(){var e;return null===(e=this.meta)||void 0===e?void 0:e.request_shipping}},{key:"hasShippingOptions",value:function(){var e,t;return(null===(e=this.meta)||void 0===e?void 0:e.request_shipping)&&!(null===(t=this.meta)||void 0===t||!t.shipping_options)}},{key:"load",value:function(n){var i=this;if(window.Promise)return this.checkAvailability().then(function(e){var t;e?(i.isShippingRequired()&&i.hasShippingOptions()&&(i.selectedShippingOption=null===(t=i.meta)||void 0===t?void 0:t.shipping_options[0],i.latestShippingData.shippingMethod=i.formatShippingOptions([i.selectedShippingOption])[0]),i.mount(n)):i.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.APPLE})}).catch(function(e){return console.error("Error checking ApplePay availability",e)});this.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.APPLE})}},{key:"update",value:function(e){var t,n,i;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success||!e.body)return this.latestShippingChangePromiseReject();var o=null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount,r=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;o&&(this.meta.amount=o),r&&(this.meta.shipping_options=r,this.selectedShippingOption=r?r[0]:void 0);var a=A({newTotal:{label:null===(i=this.meta)||void 0===i?void 0:i.amount_label,amount:this.meta.amount.toString(),type:"final"}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingMethods:this.formatShippingOptions(this.meta.shipping_options)});this.paymentSession.completeShippingContactSelection(a),this.latestShippingChangePromiseResolve({})}}},{key:"checkAvailability",value:function(){var n=this;return new Promise(function(t,e){window.ApplePaySession&&ApplePaySession||t(!1),ApplePaySession.canMakePaymentsWithActiveCard(n.getMerchantId()).then(function(e){return t(e)}).catch(function(e){return t(!1)})})}},{key:"mount",value:function(e){var t=this,n=document.createElement("style");n.innerHTML=this.createButtonStyle(),document.head.appendChild(n);var i=document.createElement("div");i.onclick=function(){return t.onApplePayButtonClicked()},i.classList.add("paydock-apple-container","apple-pay-button","apple-pay-button-black"),e.getElement().appendChild(i)}},{key:"onApplePayButtonClicked",value:function(){this.paymentSession=new ApplePaySession(3,this.createRequest()),this.paymentSession.onvalidatemerchant=this.onValidateMerchant,this.paymentSession.onpaymentauthorized=this.onPaymentAuthorized,this.paymentSession.onshippingcontactselected=this.onShippingContactSelected,this.paymentSession.onshippingmethodselected=this.onShippingMethodSelected,this.paymentSession.begin()}},{key:"createRequest",value:function(){var e,t=this.getMetaRawDataInitialization();return t&&"object"===(void 0===t?"undefined":G(t))&&("object"===G(t.total)?t.total.amount=this.meta.amount.toString():t.total={label:(null===(e=this.meta)||void 0===e?void 0:e.amount_label)||"",amount:this.meta.amount.toString()},this.isShippingRequired()&&this.hasShippingOptions()&&(t.shippingMethods=this.formatShippingOptions(this.meta.shipping_options))),t||A(A(A({countryCode:this.meta.country.toUpperCase(),currencyCode:this.meta.currency.toUpperCase(),merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard","amex","discover"]},this.meta.show_billing_address&&{requiredBillingContactFields:["name","postalAddress"]}),this.isShippingRequired()&&A({requiredShippingContactFields:["postalAddress","name","phone","email"]},this.hasShippingOptions()&&{shippingMethods:this.formatShippingOptions(this.meta.shipping_options)})),{total:{label:this.meta.amount_label,amount:this.meta.amount.toString(),type:"final"}})}},{key:"getMerchantSession",value:function(){var e=this;return new Promise(function(t,n){return e.eventEmitter.emit(jt.CALLBACK,{data:A({request_type:"CREATE_SESSION",wallet_type:z.APPLE,session_id:window.location.hostname},e.isShippingRequired()&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e)},onError:function(e){return n(e)}})})}},{key:"createButtonStyle",value:function(){var e,t;return"\n .paydock-apple-container {\n width: 100%;\n height: 40px;\n }\n\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: "+((null===(e=this.getMetaStyles())||void 0===e?void 0:e.button_type)||"plain")+"\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n -apple-pay-button-type: "+((null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"plain")+"\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n "}}]),Qt);function Qt(e,t,n,i){l(this,Qt);var s=c(this,(Qt.__proto__||Object.getPrototypeOf(Qt)).call(this,e,t));return s.gatewayName=n,s.eventEmitter=i,s.latestShippingData={},s.onValidateMerchant=function(e){s.getMerchantSession().then(function(e){s.paymentSession.completeMerchantValidation(e)}).catch(function(e){return console.error("Error fetching merchant session",e)})},s.onPaymentAuthorized=function(e){var t,n=e.payment,i=n.token,o=n.billingContact,r=n.shippingContact;s.latestShippingData.shippingContact=r;var a=null===(t=s.selectedShippingOption)||void 0===t?void 0:t.type;s.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:A({customer:{payment_source:{wallet_type:z.APPLE,card_name:i.paymentMethod.displayName,type:i.paymentMethod.type,card_scheme:i.paymentMethod.network,address_line1:null==o?void 0:o.addressLines[0],address_line2:null==o?void 0:o.addressLines[1],address_country:null==o?void 0:o.countryCode,address_city:null==o?void 0:o.locality,address_postcode:null==o?void 0:o.postalCode,address_state:null==o?void 0:o.administrativeArea,ref_token:i.paymentData?JSON.stringify(i.paymentData):""}}},s.meta.request_shipping&&r&&{shipping:A(A(A({},a&&{method:a}),s.hasShippingOptions()&&{options:s.meta.shipping_options}),{address_line1:r.addressLines[0],address_line2:r.addressLines[1],address_country:r.countryCode,address_city:r.locality,address_postcode:r.postalCode,address_state:r.administrativeArea,contact:{first_name:r.givenName,last_name:r.familyName,email:r.emailAddress,phone:r.phoneNumber}})}),onSuccess:function(){return s.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS)},onError:function(){return s.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE)}})},s.onShippingContactSelected=function(e){s.latestShippingData.shippingContact=e.shippingContact;var t=s.parseUpdateData(s.latestShippingData);return s.eventEmitter.emit(jt.UPDATE,t),new Promise(function(e,t){s.latestShippingChangePromiseResolve=e,s.latestShippingChangePromiseReject=t})},s.onShippingMethodSelected=function(e){var t,n;s.latestShippingData.shippingMethod=e.shippingMethod;var i={newTotal:{label:s.meta.amount_label||(null===(n=null===(t=s.getMetaRawDataInitialization())||void 0===t?void 0:t.total)||void 0===n?void 0:n.label),amount:s.meta.amount.toString(),type:"final"}};s.paymentSession.completeShippingMethodSelection(i)},s.parseUpdateData=function(e){var t,n,i,o,r,a,s,u;return A({shipping:{address_city:null===(t=null==e?void 0:e.shippingContact)||void 0===t?void 0:t.locality,address_state:null===(n=null==e?void 0:e.shippingContact)||void 0===n?void 0:n.administrativeArea,address_postcode:null===(i=null==e?void 0:e.shippingContact)||void 0===i?void 0:i.postalCode,address_country:null===(o=null==e?void 0:e.shippingContact)||void 0===o?void 0:o.countryCode}},(null==e?void 0:e.shippingMethod)&&{selected_shipping_option:{id:null===(r=null==e?void 0:e.shippingMethod)||void 0===r?void 0:r.identifier,label:null===(a=null==e?void 0:e.shippingMethod)||void 0===a?void 0:a.label,detail:null===(s=null==e?void 0:e.shippingMethod)||void 0===s?void 0:s.detail,amount:null===(u=null==e?void 0:e.shippingMethod)||void 0===u?void 0:u.amount}})},s.formatShippingOptions=function(e){return e.map(function(e){return{identifier:e.id,label:e.label,detail:(null==e?void 0:e.detail)||"",amount:e.amount}})},s.eventEmitter=i,s}var $t=(o(en,Ft),t(en,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[z.GOOGLE])||void 0===n?void 0:n.merchant}},{key:"getMetaStyles",value:function(){var e,t,n,i;return"object"===G(null===(e=this.meta)||void 0===e?void 0:e.style)&&"google"in(null===(t=this.meta)||void 0===t?void 0:t.style)?null===(i=null===(n=this.meta)||void 0===n?void 0:n.style)||void 0===i?void 0:i.google:null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i,o;return null!==(e=this.meta)&&void 0!==e&&e.raw_data_initialization&&"object"===G(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"google"in(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)?null===(o=null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization)||void 0===o?void 0:o.google:null}},{key:"isShippingRequired",value:function(){return this.meta.request_shipping}},{key:"hasShippingOptions",value:function(){return this.meta.request_shipping&&!!this.meta.shipping_options}},{key:"load",value:function(r){var a=this;if(window.Promise)return new Promise(function(i,o){var e=document.createElement("script");e.type="text/javascript",e.src="https://pay.google.com/gp/p/js/pay.js",e.async=!0,e.onload=function(){var e,t,n;if(!window.google)return a.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.GOOGLE}),void o();a.isShippingRequired()&&a.hasShippingOptions()&&(a.selectedShippingOption=null===(e=a.meta)||void 0===e?void 0:e.shipping_options[0]),a.paymentsClient=new google.payments.api.PaymentsClient(A({merchantInfo:A(A({},null!==(t=a.meta)&&void 0!==t&&t.merchant_name?{merchantName:null===(n=a.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:a.getMerchantId()}),paymentDataCallbacks:A({onPaymentAuthorized:function(e){return a.onPaymentAuthorized(e)}},a.isShippingRequired()&&{onPaymentDataChanged:function(e){return a.onPaymentDataChanged(e)}})},a.env!==g?{environment:"TEST"}:{environment:"PRODUCTION"})),a.checkAvailability().then(function(e){if(!e)return a.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.GOOGLE}),void o();a.mount(r),i()})},document.head.appendChild(e)});this.eventEmitter.emit(jt.UNAVAILABLE,{wallet:z.GOOGLE})}},{key:"update",value:function(e){var t,n,i,o;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success)return this.latestShippingChangePromiseReject();var r=(null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount)||this.meta.amount,a=(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options)||this.meta.shipping_options;r&&(this.meta.amount=r),a&&(this.meta.shipping_options=a,this.selectedShippingOption=a?a[0]:void 0);var s=A({newTransactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:null===(i=this.meta.amount)||void 0===i?void 0:i.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingOptionParameters:{defaultSelectedOptionId:null===(o=this.selectedShippingOption)||void 0===o?void 0:o.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}});this.latestShippingChangePromiseResolve(s)}}},{key:"checkAvailability",value:function(){return this.paymentsClient.isReadyToPay(this.createRequest()).then(function(e){return!!e.result}).catch(function(e){return console.error("Error checking GooglePay availability",e),!1})}},{key:"mount",value:function(e){var t,n,i,o=this;e.getElement().appendChild(this.paymentsClient.createButton({onClick:function(){return o.loadPaymentData()},buttonType:(null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"pay",buttonSizeMode:(null===(n=this.getMetaStyles())||void 0===n?void 0:n.button_size_mode)||"fill",buttonColor:(null===(i=this.getMetaStyles())||void 0===i?void 0:i.button_color)||"default"}))}},{key:"loadPaymentData",value:function(){this.paymentsClient.loadPaymentData(this.createPaymentDataRequest()).catch(function(){console.error("Error while loading payment data")})}},{key:"onPaymentAuthorized",value:function(b){var e,t,n,i,o,r,a,s,u,w=this,S=null===(n=null===(t=null===(e=b.paymentMethodData)||void 0===e?void 0:e.info)||void 0===t?void 0:t.billingAddress)||void 0===n?void 0:n.address1,C=null===(r=null===(o=null===(i=b.paymentMethodData)||void 0===i?void 0:i.info)||void 0===o?void 0:o.billingAddress)||void 0===r?void 0:r.address2,O=null===(a=null==b?void 0:b.shippingAddress)||void 0===a?void 0:a.address1,T=null===(s=null==b?void 0:b.shippingAddress)||void 0===s?void 0:s.address2,P=null===(u=this.selectedShippingOption)||void 0===u?void 0:u.type;return new Promise(function(t){var e,n,i,o,r,a,s,u,l,c,d,h,p,f,v,m,y,g,_,k,E;return w.eventEmitter.emit(jt.PAYMENT_METHOD_SELECTED,{data:A({customer:{payment_source:A(A(A(A({wallet_type:z.GOOGLE,card_name:null===(e=b.paymentMethodData)||void 0===e?void 0:e.description,type:b.paymentMethodData.type,card_scheme:null===(i=null===(n=b.paymentMethodData)||void 0===n?void 0:n.info)||void 0===i?void 0:i.cardNetwork},S&&{address_line1:S}),C&&{address_line2:C}),C&&{address_line2:C}),{address_country:null===(a=null===(r=null===(o=b.paymentMethodData)||void 0===o?void 0:o.info)||void 0===r?void 0:r.billingAddress)||void 0===a?void 0:a.countryCode,address_city:null===(l=null===(u=null===(s=b.paymentMethodData)||void 0===s?void 0:s.info)||void 0===u?void 0:u.billingAddress)||void 0===l?void 0:l.locality,address_postcode:null===(h=null===(d=null===(c=b.paymentMethodData)||void 0===c?void 0:c.info)||void 0===d?void 0:d.billingAddress)||void 0===h?void 0:h.postalCode,address_state:null===(v=null===(f=null===(p=b.paymentMethodData)||void 0===p?void 0:p.info)||void 0===f?void 0:f.billingAddress)||void 0===v?void 0:v.administrativeArea,ref_token:b.paymentMethodData.tokenizationData.token})}},w.isShippingRequired()&&{shipping:A(A(A(A(A({},P&&{method:P}),w.hasShippingOptions()&&{options:w.meta.shipping_options}),O&&{address_line1:O}),T&&{address_line2:T}),{address_country:null===(m=null==b?void 0:b.shippingAddress)||void 0===m?void 0:m.countryCode,address_city:null===(y=null==b?void 0:b.shippingAddress)||void 0===y?void 0:y.locality,address_postcode:null===(g=null==b?void 0:b.shippingAddress)||void 0===g?void 0:g.postalCode,address_state:null===(_=null==b?void 0:b.shippingAddress)||void 0===_?void 0:_.administrativeArea,contact:{first_name:null===(k=null==b?void 0:b.shippingAddress)||void 0===k?void 0:k.name,email:null==b?void 0:b.email,phone:null===(E=null==b?void 0:b.shippingAddress)||void 0===E?void 0:E.phoneNumber}})}),onSuccess:function(){return t({transactionState:"SUCCESS"})},onError:function(e){return t({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:e,reason:"PAYMENT_DATA_INVALID"}})}})})}},{key:"onPaymentDataChanged",value:function(e){var n=this;if(this.isShippingRequired()){var t=this.parseUpdateData(e);return this.eventEmitter.emit(jt.UPDATE,t),new Promise(function(e,t){n.latestShippingChangePromiseResolve=e,n.latestShippingChangePromiseReject=t})}}},{key:"createRequest",value:function(){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.createCardData()],existingPaymentMethodRequired:!0}}},{key:"createPaymentDataRequest",value:function(){var e,t,n,i;this.isShippingRequired()&&this.hasShippingOptions()&&(this.selectedShippingOption=null===(e=this.meta)||void 0===e?void 0:e.shipping_options[0]);var o=this.getMerchantId();return A({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[A(A({},this.createCardData()),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"paydock",gatewayMerchantId:o}}})],transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:this.meta.amount.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()},merchantInfo:A(A({},null!==(t=this.meta)&&void 0!==t&&t.merchant_name?{merchantName:null===(n=this.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:o}),callbackIntents:["PAYMENT_AUTHORIZATION"].concat(r(this.isShippingRequired()?["SHIPPING_ADDRESS"]:[]),r(this.hasShippingOptions()?["SHIPPING_OPTION"]:[]))},this.isShippingRequired()&&A({shippingAddressRequired:!0},this.hasShippingOptions()&&{shippingOptionRequired:!0,shippingOptionParameters:{defaultSelectedOptionId:null===(i=this.selectedShippingOption)||void 0===i?void 0:i.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}}))}},{key:"createCardData",value:function(){return this.getMetaRawDataInitialization()||{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!!this.meta.show_billing_address}}}}]),en);function en(e,t,n,i){l(this,en);var u=c(this,(en.__proto__||Object.getPrototypeOf(en)).call(this,e,t));return u.gatewayName=n,u.eventEmitter=i,u.parseUpdateData=function(n){var e,t,i,o,r,a,s=null===(t=null===(e=u.meta)||void 0===e?void 0:e.shipping_options)||void 0===t?void 0:t.find(function(e){var t;return e.id===(null===(t=null==n?void 0:n.shippingOptionData)||void 0===t?void 0:t.id)});return A({shipping:{address_city:null===(i=n.shippingAddress)||void 0===i?void 0:i.locality,address_state:null===(o=n.shippingAddress)||void 0===o?void 0:o.administrativeArea,address_postcode:null===(r=null==n?void 0:n.shippingAddress)||void 0===r?void 0:r.postalCode,address_country:null===(a=null==n?void 0:n.shippingAddress)||void 0===a?void 0:a.countryCode}},s&&{selected_shipping_option:{id:null==s?void 0:s.id,label:null==s?void 0:s.label,detail:null==s?void 0:s.detail,type:null==s?void 0:s.type}})},u.formatShippingOptions=function(e){return e.map(function(e){return{id:e.id,label:e.label,description:(null==e?void 0:e.detail)||""}})},u.eventEmitter=i,u}var tn,nn,on=(o(rn,Ft),t(rn,[{key:"initializeChildWallets",value:function(){var e,t,n,i,o,r;this.childWallets=[];var a=!(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t.apple)||void 0===n||!n.merchant),s=!(null===(r=null===(o=null===(i=this.meta)||void 0===i?void 0:i.credentials)||void 0===o?void 0:o.google)||void 0===r||!r.merchant);!a||this.meta.wallets&&!this.meta.wallets.includes(z.APPLE)||this.childWallets.push(new Zt(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter)),!s||this.meta.wallets&&!this.meta.wallets.includes(z.GOOGLE)||this.childWallets.push(new $t(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter))}},{key:"getGatewayName",value:function(){return H.MASTERCARD}},{key:"update",value:function(t){this.childWallets.forEach(function(e){return e.update(t)})}}]),rn);function rn(){return l(this,rn),c(this,(rn.__proto__||Object.getPrototypeOf(rn)).apply(this,arguments))}(nn=tn=tn||{})[nn.PUBLIC_KEY=0]="PUBLIC_KEY",nn[nn.TOKEN=1]="TOKEN";var an=(t(sn,[{key:"setEnv",value:function(e,t){return this.env.setEnv(e,t),this}},{key:"setAuthType",value:function(){return this.authType=h.validateJWT(this.auth)?tn.TOKEN:tn.PUBLIC_KEY}},{key:"getClient",value:function(e,t){var i=this,o=new XMLHttpRequest;return o.open(e,this.env.getConf().url+t,!0),o.setRequestHeader("Content-Type","application/json; charset=UTF-8"),this.setAuthHeader(o),{config:o,send:function(e,t,n){o.onload=function(){return i.parser({text:o.responseText,status:o.status},t,n)},o.send(JSON.stringify(e))}}}},{key:"getClientPromise",value:function(e,t){var i=this,o=new XMLHttpRequest;return o.open(e,this.env.getConf().url+t,!0),o.setRequestHeader("Content-Type","application/json; charset=UTF-8"),this.setAuthHeader(o),{config:o,send:function(n){return new Promise(function(e,t){o.onload=function(){return e({text:o.responseText,status:o.status})},o.send(JSON.stringify(n))}).then(function(e){return i.parserPromise(e)})}}}},{key:"parser",value:function(e,t,n){var i=e.text,o=e.status;try{var r=JSON.parse(i);if(200<=o&&o<300||302===o)return t(r.resource.data);n(r.error||{message:"unknown error"})}catch(e){}}},{key:"parserPromise",value:function(e){var t=e.text,n=e.status;try{var i=JSON.parse(t);return 200<=n&&n<300||302===n?Promise.resolve(i.resource.data):Promise.reject(i.error||{message:"unknown error"})}catch(e){return Promise.reject(e)}}},{key:"setAuthHeader",value:function(e){switch(this.authType){case tn.PUBLIC_KEY:e.setRequestHeader("x-user-public-key",this.auth);break;case tn.TOKEN:e.setRequestHeader("x-access-token",this.auth)}}}]),sn);function sn(e,t){l(this,sn),this.auth=e,this.authType=t||this.setAuthType(),this.env=new P([{env:f,url:"https://api-sandbox."},{env:g,url:"https://api."},{env:_,url:"https://apista."},{env:k,url:"https://apista-2."},{env:E,url:"https://apista-3."},{env:b,url:"https://apista-4."},{env:w,url:"https://apista-5."}])}var un=(t(ln,[{key:"walletCapture",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/capture").send(e)}},{key:"walletCallback",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/callback").send(e)}},{key:"standalone3dsProcess",value:function(e){return this.api.getClientPromise("POST","/v1/charges/standalone-3ds/process").send(e)}},{key:"standalone3dsHandle",value:function(){return this.api.getClientPromise("GET","/v1/charges/standalone-3ds/handle").send(void 0)}}]),ln);function ln(e){l(this,ln),this.api=e}var cn=(o(dn,an),t(dn,[{key:"charge",value:function(){return new un(this)}}]),dn);function dn(){return l(this,dn),c(this,(dn.__proto__||Object.getPrototypeOf(dn)).apply(this,arguments))}var hn="unavailable",pn="update",fn="paymentSuccessful",vn="paymentError",mn="paymentInReview",yn=(t(gn,[{key:"load",value:function(){try{this.setupServiceCallbacks(),this.service.load(this.container)}catch(e){throw this.eventEmitter.emit(hn,null),e}}},{key:"update",value:function(e){this.service.update(e)}},{key:"setEnv",value:function(e,t){this.api.setEnv(e,t),this.service.setEnv(e)}},{key:"close",value:function(){"function"==typeof this.service.close&&this.service.close()}},{key:"on",value:function(e,t){var n=this;return e===pn&&(this.hasUpdateHandler=!0),"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise(function(t){return n.eventEmitter.subscribe(e,function(e){return t(e)})})}},{key:"onUnavailable",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(hn,e):new Promise(function(e){return t.eventEmitter.subscribe(hn,function(){return e()})})}},{key:"onUpdate",value:function(e){var n=this;return this.hasUpdateHandler=!0,"function"==typeof e?this.eventEmitter.subscribe(pn,e):new Promise(function(t){return n.eventEmitter.subscribe(pn,function(e){return t(e)})})}},{key:"onPaymentSuccessful",value:function(e){var n=this;return"function"==typeof e?this.eventEmitter.subscribe(fn,e):new Promise(function(t){return n.eventEmitter.subscribe(fn,function(e){return t(e)})})}},{key:"onPaymentInReview",value:function(e){var n=this;return"function"==typeof e?this.eventEmitter.subscribe(mn,e):new Promise(function(t){return n.eventEmitter.subscribe(mn,function(e){return t(e)})})}},{key:"onPaymentError",value:function(e){var n=this;return"function"==typeof e?this.eventEmitter.subscribe(vn,e):new Promise(function(t){return n.eventEmitter.subscribe(vn,function(e){return t(e)})})}},{key:"setupServiceCallbacks",value:function(){this.setupUnavailableCallback(),this.setupUpdateCallback(),this.setupWalletCallback(),this.setupPaymentCallback(),this.setupPaymentSuccessCallback(),this.setupPaymentInReviewCallback(),this.setupPaymentErrorCallback()}},{key:"setupUnavailableCallback",value:function(){var t=this;this.service.on(jt.UNAVAILABLE,function(e){return t.eventEmitter.emit(hn,{event:hn,data:e})})}},{key:"setupUpdateCallback",value:function(){var t=this;this.service.on(jt.UPDATE,function(e){return t.hasUpdateHandler?t.eventEmitter.emit(pn,{event:pn,data:e}):t.update({success:!0})})}},{key:"setupWalletCallback",value:function(){var o=this;this.service.on(jt.CALLBACK,function(e){var t=e.data,n=e.onSuccess,i=e.onError;o.api.charge().walletCallback(t).then(function(e){return n(e)},function(e){return i(e.message)})})}},{key:"setupPaymentCallback",value:function(){var o=this;this.service.on(jt.PAYMENT_METHOD_SELECTED,function(e){var n=e.data,i=e.onSuccess,t=e.onError;o.api.charge().walletCapture(n).then(function(e){"function"==typeof i&&i();var t="inreview"===e.status?mn:fn;o.eventEmitter.emit(t,{event:t,data:A(A({},e),n.customer&&{payer_name:n.customer.payer_name,payer_email:n.customer.payer_email,payer_phone:n.customer.payer_phone})})},function(e){"function"==typeof t&&t(e),o.eventEmitter.emit(vn,{event:vn,data:e})})})}},{key:"setupPaymentSuccessCallback",value:function(){var t=this;this.service.on(jt.PAYMENT_SUCCESS,function(e){return t.eventEmitter.emit(fn,{event:fn,data:e})})}},{key:"setupPaymentInReviewCallback",value:function(){var t=this;this.service.on(jt.PAYMENT_IN_REVIEW,function(e){return t.eventEmitter.emit(mn,{event:mn,data:e})})}},{key:"setupPaymentErrorCallback",value:function(){var t=this;this.service.on(jt.PAYMENT_ERROR,function(e){return t.eventEmitter.emit(vn,{event:vn,data:e})})}}]),gn);function gn(e,t,n){l(this,gn),this.hasUpdateHandler=!1;var i=h.validateJWT(t);if(!i)throw new Error("Invalid charge token");this.eventEmitter=new Le,this.container=new de(e);var o=h.extractMeta(i.body);switch(this.api=new cn(t,tn.TOKEN),o.gateway.type){case H.STRIPE:this.service=new Jt(o.credentials.client_auth,A(A({},n),{amount:o.charge.amount,currency:o.charge.currency}));break;case H.FLYPAY:this.service=new Bt(t,A(A({},n),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}));break;case H.PAYPAL:this.service=new qt(o.credentials.client_auth,A(A({},n),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,capture:o.charge.capture}));break;case H.MASTERCARD:this.service=new on("",A(A({},n),{credentials:o.gateway.credentials,amount:o.charge.amount,currency:o.charge.currency}))}}var _n=(t(kn,[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==j.values(Y).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setStyle[s: unsupported style param "+e)}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"setLimit",value:function(e){this.link.setParams({limit:e})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"getIFrameUrl",value:function(){return this.link.getUrl()}},{key:"filterByGatewayIds",value:function(e){this.link.setParams({gateway_ids:e.join(",")})}},{key:"filterByTypes",value:function(e){var t=[],n=!0,i=!1,o=void 0;try{for(var r,a=e[Symbol.iterator]();!(n=(r=a.next()).done);n=!0){var s=r.value;e.hasOwnProperty(s)&&(-1===j.values(W).indexOf(s)?console.warn("PaymentSourceWidget::filterByTypes: unsupported type "+s):t.push(s))}}catch(e){i=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}this.link.setParams({payment_source_types:t.join(",")})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}]),kn);function kn(e,t){l(this,kn),this.configs=[],this.configTokens=[],this.link=new U("/payment-sources"),this.link.setParams(A({query_token:t},h.validateJWT(e)?{access_token:e}:{public_key:e}))}var En=(o(bn,_n),t(bn,[{key:"load",value:function(){this.iFrame.load(this.getIFrameUrl(),{title:"Payment Sources"})}},{key:"on",value:function(e,t){this.event.on(e,this.link.getParams().widget_id,t)}},{key:"hide",value:function(e){console.info("PayDock SDK"),this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"onSelectInsert",value:function(t,n){this.on(ve.SELECT,function(e){le.insertToInput(t,n,e)})}}]),bn);function bn(e,t,n){l(this,bn);var i=c(this,(bn.__proto__||Object.getPrototypeOf(bn)).call(this,t,n));return i.container=new de(e),i.iFrame=new pe(i.container),i.event=new me(window),i}var wn,Sn,Cn={visibility:"hidden",border:"0",width:"0",height:"0"};(Sn=wn=wn||{}).SUCCESS="success",Sn.ERROR="error",Sn.PENDING="pending";var On="chargeAuthSuccess",Tn="chargeAuthReject",Pn="chargeAuthDecoupled",An="chargeAuthChallenge",Rn="error",xn=(t(In,[{key:"load",value:function(e,t){var n=e.initialization_url,i=e.secondary_url,o=e.charge_3ds_id;try{this.setupIFrameEvents(o),this.initializeIFrames(n,i,t)}catch(e){this.eventEmitter.emit(Rn,this.parseError(e,o))}}},{key:"initializeIFrames",value:function(e,t,n,i){var o=!(3<arguments.length&&void 0!==i)||i,r=document.createElement("div");r.setAttribute("id","paydock_authorization_iframe"),this.container.getElement().appendChild(r),this.browserAndChallengeContainer=new de("#paydock_authorization_iframe"),this.iFrameAuthorization=new pe(this.browserAndChallengeContainer),this.iFrameAuthorization.load(e,{title:n});var a=document.createElement("div");a.setAttribute("id","paydock_secondary_iframe"),this.container.getElement().appendChild(a),this.monitoringContainer=new de("#paydock_secondary_iframe"),this.iFrameSecondaryUrl=new pe(this.monitoringContainer),this.iFrameSecondaryUrl.load(t,{title:n}),this.hideIframes(o)}},{key:"hideIframes",value:function(e){var t=!(0<arguments.length&&void 0!==e)||e;for(var n in Cn)Cn.hasOwnProperty(n)&&(t&&this.iFrameAuthorization.setStyle(n,Cn[n]),this.iFrameSecondaryUrl.setStyle(n,Cn[n]))}},{key:"setupIFrameEvents",value:function(e){var t=this;this.iFrameEvent.on(ve.CHARGE_AUTH,e,function(e){"MethodSkipped"===e.status&&t.performAuthentication(e)}),this.iFrameEvent.on(ve.CHARGE_AUTH_SUCCESS,e,function(e){t.processResult(e.charge_3ds_id)})}},{key:"parseResultData",value:function(e,t){return{status:e.status,charge_3ds_id:t}}},{key:"parseHandleResponse",value:function(e,t){var n=e.status,i=e.result;return{status:n,charge_3ds_id:t,result:{description:null==i?void 0:i.description}}}},{key:"parseError",value:function(e,t){return{charge_3ds_id:t,error:e}}},{key:"processResult",value:function(t){var n=this;this.resultRead||(this.resultRead=!0,this.api.charge().standalone3dsHandle().then(function(e){n.iFrameAuthorization.remove(),n.iFrameSecondaryUrl.remove(),e.status===wn.SUCCESS?n.eventEmitter.emit(On,n.parseResultData(e,t)):n.eventEmitter.emit(Tn,n.parseResultData(e,t))},function(e){n.eventEmitter.emit(Rn,n.parseError(e,t))}))}},{key:"externalAPI",value:function(e,t){var i=new XMLHttpRequest;return i.open(e,t,!0),new Promise(function(t,n){i.onload=function(){try{var e=JSON.parse(i.responseText);t(e)}catch(e){n(e)}},i.send()})}},{key:"doPolling",value:function(t,n){var i=this;this.externalAPI("GET",t).then(function(e){if(e.event&&"AuthResultNotReady"!==e.event){if("AuthResultReady"!==e.event)throw new Error("Event not supported");i.processResult(n)}else setTimeout(function(){i.doPolling(t,n)},2e3)}).catch(function(e){return i.eventEmitter.emit(Rn,i.parseError(e,n))})}},{key:"performAuthentication",value:function(e){var i=this,o=e.charge_3ds_id;this.iFrameAuthorization.remove(),this.iFrameSecondaryUrl.remove(),this.api.charge().standalone3dsProcess({charge_3ds_id:o}).then(function(e){var t,n;if("success"===e.status)i.eventEmitter.emit(On,i.parseHandleResponse(e,o));else{if("pending"!==e.status)return i.eventEmitter.emit(Tn,i.parseHandleResponse(e,o));null!==(t=null==e?void 0:e.result)&&void 0!==t&&t.challenge?(i.eventEmitter.emit(An,i.parseHandleResponse(e,o)),i.initializeIFrames(e.result.challenge_url,"authenticationResult.result.secondary_url","Authentication Challenge",!1),i.doPolling(e.result.secondary_url,o)):null!==(n=null==e?void 0:e.result)&&void 0!==n&&n.decoupled_challenge&&(i.eventEmitter.emit(Pn,i.parseHandleResponse(e,o)),i.doPolling(e.result.secondary_url,o))}},function(e){i.eventEmitter.emit(Rn,i.parseError(e,o))})}}]),In);function In(e,t,n){l(this,In),this.container=e,this.api=t,this.eventEmitter=n,this.resultRead=!1,this.iFrameEvent=new me(window)}var Ln,Nn,Dn="GPayments",Un=(t(Mn,[{key:"load",value:function(e,t){var n=h.validateJWT(e);if(!n)throw new Error("Invalid charge token");var i=h.extractData(n.body),o=new cn(e,tn.TOKEN);switch(o.setEnv(this.env,this.alias),i.service_type){case Dn:new xn(this.container,o,this.eventEmitter).load(i,t.title)}}},{key:"setEnv",value:function(e,t){this.env=e,this.alias=t}}]),Mn);function Mn(e,t){l(this,Mn),this.env=f,this.container=e,this.eventEmitter=t}(Nn=Ln=Ln||{}).HTML="html",Nn.URL="url",Nn.STANDALONE_3DS="standalone_3ds";var jn=(t(Fn,[{key:"load",value:function(){this.token.format===Ln.HTML?this.iFrame.loadFromHtml(this.token.content,{title:"3d secure authentication"}):this.token.format===Ln.URL?this.iFrame.load(this.token.content,{title:"3d secure authentication"}):this.token.format===Ln.STANDALONE_3DS?this.standalone3dsService.load(this.token.content,{title:"3d secure authentication"}):console.error("Token contain unsupported payload")}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.standalone3dsService.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"on",value:function(e,t){var n=this;return this.token.format===Ln.STANDALONE_3DS?"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise(function(t){return n.eventEmitter.subscribe(e,function(e){return t(e)})}):"function"==typeof t?this.event.on(e,this.link.getParams().ref_id,t):new Promise(function(t){return n.event.on(e,n.link.getParams().ref_id,function(e){return t(e)})})}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}}],[{key:"extractToken",value:function(e){return JSON.parse(window.atob(e))}}]),Fn);function Fn(e,t){l(this,Fn),this.configs=[],this.link=new U("/3ds/webhook"),this.token=Fn.extractToken(t),this.link.setParams({ref_id:this.token.charge_3ds_id}),this.container=new de(e),this.iFrame=new pe(this.container),this.eventEmitter=new Le,this.standalone3dsService=new Un(this.container,this.eventEmitter),this.event=new me(window)}var Hn="/v1/charges/3ds",Bn=(t(zn,[{key:"preAuth",value:function(e,t){return"function"==typeof t?this.api.getClient("POST",Hn).send(A(A({},e),{_3ds:A(A({},e._3ds),{browser_details:{name:Me.getBrowserName(),java_enabled:Me.isJavaEnabled().toString(),language:Me.getLanguage(),screen_height:Me.getScreenHeight().toString(),screen_width:Me.getScreenWidth().toString(),time_zone:Me.getTimezoneOffset().toString(),color_depth:Me.getColorDepth().toString()}})}),function(e){t(e)}):this.api.getClientPromise("POST",Hn).send(A(A({},e),{_3ds:A(A({},e._3ds),{browser_details:{name:Me.getBrowserName(),java_enabled:Me.isJavaEnabled().toString(),language:Me.getLanguage(),screen_height:Me.getScreenHeight().toString(),screen_width:Me.getScreenWidth().toString(),time_zone:Me.getTimezoneOffset().toString(),color_depth:Me.getColorDepth().toString()}})}))}}]),zn);function zn(e){l(this,zn),this.api=e}var qn,Wn,Vn=(o(Yn,an),t(Yn,[{key:"getBrowserDetails",value:function(){return{name:Me.getBrowserName(),java_enabled:Me.isJavaEnabled().toString(),language:Me.getLanguage(),screen_height:Me.getScreenHeight().toString(),screen_width:Me.getScreenWidth().toString(),time_zone:Me.getTimezoneOffset().toString(),color_depth:Me.getColorDepth().toString()}}},{key:"charge",value:function(){return new Bn(this)}}]),Yn);function Yn(e){l(this,Yn);var t=c(this,(Yn.__proto__||Object.getPrototypeOf(Yn)).call(this,e));return t.publicKey=t.auth,t}(Wn=qn=qn||{}).AFTER_LOAD="after_load",Wn.SYSTEM_ERROR="system_error",Wn.CVV_SECURE_CODE_REQUESTED="cvv_secure_code_requested",Wn.CARD_NUMBER_SECURE_CODE_REQUESTED="card_number_secure_code_requested",Wn.ACCESS_FORBIDDEN="access_forbidden",Wn.SESSION_EXPIRED="session_expired",Wn.OPERATION_FORBIDDEN="operation_forbidden";var Gn=(o(Kn,me),t(Kn,[{key:"on",value:function(e,t,n){for(var i in qn)qn.hasOwnProperty(i)&&e===qn[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}]),Kn);function Kn(){return l(this,Kn),c(this,(Kn.__proto__||Object.getPrototypeOf(Kn)).apply(this,arguments))}var Jn=(t(Xn,[{key:"setEnv",value:function(e,t){this.link.setEnv(e,t)}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise(function(t){return n.event.on(e,n.link.getParams().widget_id,function(e){return t(e)})})}},{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==j.values(Y).indexOf(e)?this.link.setParams(n({},e,t)):console.warn("Widget::setStyle[s: unsupported style param "+e)}},{key:"load",value:function(){this.iFrame.load(this.link.getUrl(),{title:"Vault Display"})}}]),Xn);function Xn(e,t){l(this,Xn),this.validationData={},this.configs=[],this.container=new de(e),this.iFrame=new pe(this.container),this.triggerElement=new _e(this.iFrame),this.event=new Gn(window),this.vaultDisplayToken=t,this.link=new U("/vault-display"),this.link.setParams({vault_display_token:t})}e.AfterpayCheckoutButton=Ct,e.Api=Vn,e.CHECKOUT_BUTTON_EVENT=kt,e.Canvas3ds=jn,e.CheckoutButton=Et,e.Configuration=ee,e.ELEMENT=J,e.EVENT=ve,e.ExternalCheckoutBuilder=Ae,e.ExternalCheckoutChecker=xe,e.FORM_FIELD=V,e.HtmlMultiWidget=we,e.HtmlPaymentSourceWidget=En,e.HtmlWidget=Ce,e.MultiWidget=se,e.PAYMENT_TYPE=Q,e.PURPOSE=$,e.PaymentSourceBuilder=We,e.PaymentSourceWidget=_n,e.PaypalCheckoutButton=At,e.STYLABLE_ELEMENT=ne,e.STYLABLE_ELEMENT_STATE=ie,e.STYLE=Y,e.SUPPORTED_CARD_TYPES=X,e.TEXT=K,e.TRIGGER=ge,e.TYPE=qe,e.VAULT_DISPLAY_STYLE={BACKGROUND_COLOR:"background_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",BUTTON_COLOR:"button_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},e.VaultDisplayWidget=Jn,e.WalletButtons=yn,e.ZipmoneyCheckoutButton=wt,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AccessToken } from './../helper/access-token';
|
|
1
2
|
import "../../vendors/zipmoney";
|
|
2
3
|
import { EVENT, Runner } from "./runner";
|
|
3
4
|
import { Env, ENV } from '../components/env';
|
|
@@ -36,7 +37,7 @@ export class ZipmoneyRunner extends Runner {
|
|
|
36
37
|
this.background.clear();
|
|
37
38
|
this.checkout = checkoutData;
|
|
38
39
|
let checkoutLink = String(ECHO_LINK);
|
|
39
|
-
checkoutLink = Url.extendSearchParams(checkoutLink, 'public_key', this.publicKey);
|
|
40
|
+
checkoutLink = Url.extendSearchParams(checkoutLink, AccessToken.validateJWT(this.publicKey) ? 'access_token' : 'public_key', this.publicKey);
|
|
40
41
|
checkoutLink = Url.extendSearchParams(checkoutLink, 'json_body', encodeURIComponent(JSON.stringify({
|
|
41
42
|
redirect_uri: this.checkout.link,
|
|
42
43
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zipmoney.runner.js","sourceRoot":"","sources":["../../checkout-button/zipmoney.runner.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,EAAC,KAAK,EAAW,MAAM,EAAC,MAAM,UAA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IStyles, ITexts {
|
|
|
167
167
|
gateway_mode: string;
|
|
168
168
|
}
|
|
169
169
|
export interface IParams extends IStyles, ITexts {
|
|
170
|
+
access_token?: string;
|
|
170
171
|
public_key?: string;
|
|
171
172
|
token?: string;
|
|
172
173
|
configuration_token?: string;
|
|
@@ -374,6 +375,7 @@ export interface ITokenWalletMeta {
|
|
|
374
375
|
amount: number;
|
|
375
376
|
currency: string;
|
|
376
377
|
capture?: boolean;
|
|
378
|
+
reference?: string;
|
|
377
379
|
};
|
|
378
380
|
gateway: {
|
|
379
381
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"param.js","sourceRoot":"","sources":["../../components/param.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;CACvB,CAAC;AAIF,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,mBAAmB,EAAE,qBAAqB;IAC1C,iBAAiB,EAAE,mBAAmB;IACtC,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,iBAAiB;IAClC,YAAY,EAAE,cAAc;IAC5B,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;CACrC,CAA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F,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC,MAAM,CACvD;IACI,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,OAAO;IACP,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,WAAW;IACX,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,OAAO;IACP,uBAAuB;CAC1B,EACD;IACI,YAAY;IACZ,WAAW;IACX,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;IACR,eAAe;IACf,QAAQ;IACR,YAAY;IACZ,uBAAuB;CAC1B,EACD;IACI,QAAQ;IACR,UAAU;IACV,OAAO;IACP,YAAY;IACZ,WAAW;IACX,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,OAAO;CACV,EACD;IACI,yBAAyB;IACzB,oBAAoB;CACvB,CACJ,CAAC;AAwED,CAAC;AAcD,CAAC;
|
|
1
|
+
{"version":3,"file":"param.js","sourceRoot":"","sources":["../../components/param.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;CACvB,CAAC;AAIF,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,mBAAmB,EAAE,qBAAqB;IAC1C,iBAAiB,EAAE,mBAAmB;IACtC,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE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B"}
|
|
@@ -20,7 +20,7 @@ export declare class PaymentSourceWidget {
|
|
|
20
20
|
protected configs: Configuration[];
|
|
21
21
|
protected configTokens: string[];
|
|
22
22
|
protected publicKey: string;
|
|
23
|
-
constructor(
|
|
23
|
+
constructor(accessToken: string, queryToken: string);
|
|
24
24
|
/**
|
|
25
25
|
* Object contain styles for widget
|
|
26
26
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AccessToken } from './../helper/access-token';
|
|
1
2
|
import { Link, PAYMENT_SOURCE_LINK } from '../components/link';
|
|
2
3
|
import { PAYMENT_SOURCE_TYPE, STYLE } from '../components/param';
|
|
3
4
|
import { ObjectHelper } from '../helper/object';
|
|
@@ -16,11 +17,11 @@ import { ObjectHelper } from '../helper/object';
|
|
|
16
17
|
* var widget = new PaymentSourceWidget('publicKey', customerReference, true);
|
|
17
18
|
**/
|
|
18
19
|
export class PaymentSourceWidget {
|
|
19
|
-
constructor(
|
|
20
|
+
constructor(accessToken, queryToken) {
|
|
20
21
|
this.configs = [];
|
|
21
22
|
this.configTokens = [];
|
|
22
23
|
this.link = new Link(PAYMENT_SOURCE_LINK);
|
|
23
|
-
this.link.setParams({
|
|
24
|
+
this.link.setParams(Object.assign({ query_token: queryToken }, (AccessToken.validateJWT(accessToken) ? { access_token: accessToken } : { public_key: accessToken })));
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Object contain styles for widget
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-source-widget.js","sourceRoot":"","sources":["../../payment-source-widget/payment-source-widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAA6B,mBAAmB,EAAE,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD;;;;;;;;;;;;;IAaI;AACJ,MAAM,OAAO,mBAAm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,IAAI,CAAC;gBAC3B,SAAS;YAEb,IAAI,YAAY,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC7D,OAAO,CAAC,IAAI,CAAC,wDAAwD,IAAI,EAAE,CAAC,CAAC;;gBAE7E,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACjC;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC,oBAAoB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CAAC,IAAI;QACnB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;IACzC,CAAC;CACJ"}
|
|
@@ -9,11 +9,11 @@ export class FlypayWalletService extends WalletService {
|
|
|
9
9
|
constructor(token, meta) {
|
|
10
10
|
super(token, meta);
|
|
11
11
|
this.link = new Link(FLYPAY_LINK);
|
|
12
|
-
const { amount, currency, id, gateway_mode, request_shipping } = meta;
|
|
12
|
+
const { amount, currency, id, gateway_mode, reference, request_shipping } = meta;
|
|
13
13
|
this.link.setParams(Object.assign({ token,
|
|
14
14
|
amount,
|
|
15
15
|
currency,
|
|
16
|
-
gateway_mode, credentials: id }, (request_shipping ? { request_shipping } : {})));
|
|
16
|
+
gateway_mode, credentials: reference || id }, (request_shipping ? { request_shipping } : {})));
|
|
17
17
|
this.token = token;
|
|
18
18
|
this.event = new FlypayIframeEvent(window);
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flypay.wallet-service.js","sourceRoot":"","sources":["../../wallet-buttons/flypay.wallet-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBA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AAe,EAAE,IAAI,CAAC,sBAAsB,CAAC,WAAW;gBACxD,iBAAiB,EAAE,IAAI,CAAC,sBAAsB,CAAC,SAAS;gBACxD,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,CAAC,mBAAmB;gBACvE,gCAAgC,EAAE,IAAI,CAAC,sBAAsB,CAAC,gBAAgB;gBAC9E,gCAAgC,EAAE,IAAI,CAAC,sBAAsB,CAAC,gBAAgB;gBAC9E,mBAAmB,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI;aACxD;SACJ,CAAC,CAAC,CAAC,EAAE,EACR;IACN,CAAC;CACJ"}
|
|
@@ -103,7 +103,7 @@ export class WalletButtons {
|
|
|
103
103
|
this.service = new StripeWalletService(tokenMeta.credentials.client_auth, Object.assign(Object.assign({}, meta), { amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency }));
|
|
104
104
|
break;
|
|
105
105
|
case WALLET_GATEWAY.FLYPAY:
|
|
106
|
-
this.service = new FlypayWalletService(chargeToken, Object.assign(Object.assign({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency }));
|
|
106
|
+
this.service = new FlypayWalletService(chargeToken, Object.assign(Object.assign({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, reference: tokenMeta.charge.reference }));
|
|
107
107
|
break;
|
|
108
108
|
case WALLET_GATEWAY.PAYPAL:
|
|
109
109
|
this.service = new PaypalWalletService(tokenMeta.credentials.client_auth, Object.assign(Object.assign({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, capture: tokenMeta.charge.capture }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-buttons.js","sourceRoot":"","sources":["../../wallet-buttons/wallet-buttons.ts"],"names":[],"mappings":"AAAA,OA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CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAC9H,CAAC;IACN,CAAC;IAEO,yBAAyB;QAC7B,IAAI,CAAC,OAAO,CAAC,EAAE,CACX,YAAY,CAAC,aAAa,EAC1B,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAS,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CACtH,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-service.js","sourceRoot":"","sources":["../../wallet-buttons/wallet-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAO,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"wallet-service.js","sourceRoot":"","sources":["../../wallet-buttons/wallet-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAO,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAwEhD,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;IAChB,uBAAuB,EAAE,yBAAyB;IAClD,eAAe,EAAE,iBAAiB;IAClC,iBAAiB,EAAE,mBAAmB;IACtC,aAAa,EAAE,eAAe;IAC9B,QAAQ,EAAE,UAAU;CACvB,CAAA;AAqCD,MAAM,OAAgB,aAAa;IAK/B,YAAsB,SAAiB,EAAY,IAAwB;QAArD,cAAS,GAAT,SAAS,CAAQ;QAAY,SAA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 @@ The SDK supports methods for customization of widget by your needs (styling, for
|
|
|
8
8
|
|
|
9
9
|
## Other information
|
|
10
10
|
|
|
11
|
-
To work with the widget you will need public_key ([see Authentication](https://docs.paydock.com/#authentication))
|
|
11
|
+
To work with the widget you will need public_key or access_token ([see Authentication](https://docs.paydock.com/#authentication))
|
|
12
12
|
|
|
13
13
|
Also you will need added gateway ([see API Reference by gateway](https://docs.paydock.com/#gateways))
|
|
14
14
|
|