@bigcommerce/checkout-sdk 1.983.3 → 1.983.4
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/dist/cjs/checkout-button.js +1 -1
- package/dist/cjs/checkout-sdk-essential.js +1 -1
- package/dist/cjs/checkout-sdk.js +1 -1
- package/dist/cjs/hosted-form-v2-iframe-host.js +1 -1
- package/dist/cjs/integrations/amazon-pay.js +1 -1
- package/dist/cjs/integrations/bigcommerce-payments.js +1 -1
- package/dist/cjs/integrations/braintree.js +1 -1
- package/dist/cjs/integrations/google-pay.js +1 -1
- package/dist/cjs/integrations/klarna.js +1 -1
- package/dist/cjs/integrations/paypal-commerce.js +1 -1
- package/dist/cjs/integrations/paypal-express.js +1 -1
- package/dist/cjs/integrations/zip.js +1 -1
- package/dist/esm/checkout-button.js +1 -1
- package/dist/esm/checkout-sdk-essential.js +1 -1
- package/dist/esm/checkout-sdk.js +1 -1
- package/dist/esm/hosted-form-v2-iframe-host.js +1 -1
- package/dist/esm/integrations/amazon-pay.js +1 -1
- package/dist/esm/integrations/bigcommerce-payments.js +1 -1
- package/dist/esm/integrations/braintree.js +1 -1
- package/dist/esm/integrations/google-pay.js +1 -1
- package/dist/esm/integrations/klarna.js +1 -1
- package/dist/esm/integrations/paypal-commerce.js +1 -1
- package/dist/esm/integrations/paypal-express.js +1 -1
- package/dist/esm/integrations/zip.js +1 -1
- package/package.json +9 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createFormPoster as e}from"@bigcommerce/form-poster";import{createRequestSender as t}from"@bigcommerce/request-sender";import{getScriptLoader as n,getStylesheetLoader as r}from"@bigcommerce/script-loader";import{find as i,includes as o,isArray as a,isObject as s,round as l,some as c}from"lodash";class d extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class h extends d{constructor(e){super(e||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}class u{constructor(e,t,n=window){this._scriptLoader=e,this._stylesheetLoader=t,this._window=n}load(e){return t=this,n=function*(){var t,n;if(yield Promise.all([this._stylesheetLoader.loadStylesheet(`https://checkoutshopper-${null!=(t=e.environment)?t:""}.adyen.com/checkoutshopper/sdk/3.10.1/adyen.css`,{prepend:!1,attributes:{integrity:"sha384-8ofgICZZ/k5cC5N7xegqFZOA73H9RQ7H13439JfAZW8Gj3qjuKL2isaTD3GMIhDE",crossorigin:"anonymous"}}),this._scriptLoader.loadScript(`https://checkoutshopper-${null!=(n=e.environment)?n:""}.adyen.com/checkoutshopper/sdk/3.10.1/adyen.js`,{async:!0,attributes:{integrity:"sha384-wG2z9zSQo61EIvyXmiFCo+zB3y0ZB4hsrXVcANmpP8HLthjoQJQPBh7tZKJSV8jA",crossorigin:"anonymous"}})]),!this._window.AdyenCheckout)throw new h;return new this._window.AdyenCheckout(e)},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}function y(e,t){return Object.assign(e,{resolveIds:t})}function p(e){return"object"==typeof e&&null!==e&&"errors"in e&&Array.isArray(e.errors)&&"code"in e.errors[0]&&"string"==typeof e.errors[0].code&&"provider_data"in e&&"object"==typeof e.provider_data}var g=(e=>(e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress",e))(g||{});class _ extends d{constructor(e){super(function(e){switch(e){case 0:return"Unable to proceed because billing address data is unavailable.";case 1:return"Unable to proceed because cart data is unavailable.";case 3:return"Unable to proceed because consignments data is unavailable.";case 2:return"Unable to proceed because checkout data is unavailable.";case 4:return"Unable to proceed because customer data is unavailable.";case 5:case 7:return"Unable to proceed because configuration data is unavailable.";case 6:return"Unable to proceed because order data is unavailable.";case 8:return"Unable to proceed because order ID is unavailable or not generated yet.";case 9:return"Unable to proceed because payment data is unavailable.";case 15:return"Unable to proceed because the token required to submit a payment is missing.";case 12:return"Unable to proceed because payment method data is unavailable or not properly configured.";case 16:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}function m(){const{navigator:e}=window;let t;return t=e.language?e.language:e.userLanguage,{color_depth:window.screen.colorDepth||24,java_enabled:"function"==typeof e.javaEnabled&&e.javaEnabled(),language:t,screen_height:window.screen.height,screen_width:window.screen.width,time_zone_offset:(new Date).getTimezoneOffset().toString()}}const P=e=>"object"==typeof e&&null!==e&&"body"in e;class f extends d{constructor(e){super(e||"Payment process was cancelled."),this.name="PaymentMethodCancelledError",this.type="payment_cancelled"}}var w=(e=>(e[e.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",e[e.CustomerNotInitialized=1]="CustomerNotInitialized",e[e.PaymentNotInitialized=2]="PaymentNotInitialized",e[e.ShippingNotInitialized=3]="ShippingNotInitialized",e[e.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized",e))(w||{});class b extends d{constructor(e){super(function(e){switch(e){case 1:return"Unable to proceed because the customer step of checkout has not been initialized.";case 2:return"Unable to proceed because the payment step of checkout has not been initialized.";case 3:return"Unable to proceed because the shipping step of checkout has not been initialized.";case 4:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(e)),this.subtype=e,this.name="NotInitializedError",this.type="not_initialized"}}class S extends d{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}var C=Object.defineProperty,v=Object.defineProperties,I=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,M=(e,t,n)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function k(e,t,n){if("function"!=typeof n.value)return n;let r=n.value;return{get(){const e=r.bind(this);var i;return Object.defineProperty(this,t,(i=((e,t)=>{for(var n in t||(t={}))A.call(t,n)&&M(e,n,t[n]);if(O)for(var n of O(t))T.call(t,n)&&M(e,n,t[n]);return e})({},n),v(i,I({value:e})))),e},set(e){r=e}}}class E{constructor(e){if(!e)throw new Error("Currency settings missing");const{decimalPlaces:t,symbolLocation:n,symbol:r,thousandsSeparator:i,decimalSeparator:o}=e;if("string"!=typeof n||"string"!=typeof r||"string"!=typeof i||"string"!=typeof o||"string"!=typeof t)throw new S("Invalid currency settings provided");this._decimalPlaces=parseInt(t,10),this._symbolLocation=n,this._symbol=r,this._thousandsSeparator=i,this._decimalSeparator=o}format(e){if("number"!=typeof e)throw new S("Invalid amount provided");const t=this._formatNumber(e),n=this._formatCurrency(t);return e<0?`-${n}`:n}_formatNumber(e){const t=Math.abs(e),[n,r=""]=this._toFixed(t,this._decimalPlaces).split("."),i=n.replace(/\B(?=(\d{3})+(?!\d))/g,this._thousandsSeparator);return this._decimalPlaces<1?i:[i,r].join(this._decimalSeparator)}_formatCurrency(e){return"left"===this._symbolLocation.toLowerCase()?`${this._symbol}${e}`:`${e}${this._symbol}`}_toFixed(e,t){return(+`${Math.round(+`${e}e${t}`)}e${-t}`).toFixed(t)}}Object.defineProperty,Object.getOwnPropertyDescriptor;let D=class{constructor(e){this._storeConfig=e,this._customerFormatter=new E(this._storeConfig.shopperCurrency),this._storeFormatter=new E(this._storeConfig.currency)}toCustomerCurrency(e){const t=this._storeConfig.shopperCurrency.exchangeRate;return this._customerFormatter.format(e*t)}toStoreCurrency(e){return this._storeFormatter.format(e)}};function N(e,t){if(null==e)throw t?t():new Error("An unexpected error has occurred.");return e}D=((e,t)=>{for(var n,r=t,i=e.length-1;i>=0;i--)(n=e[i])&&(r=n(r)||r);return r})([function(e,t,n){return t&&n?k(0,t,n):function(e){const t=class extends e{};return Object.getOwnPropertyNames(e.prototype).forEach(n=>{const r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&"constructor"!==n&&Object.defineProperty(t.prototype,n,k(e.prototype,n,r))}),t}(e)}],D);function z(){if("undefined"==typeof window)return!1;if(function(e){return"ReactNativeWebView"in e}(window))return!0;const e=navigator.userAgent||navigator.vendor||(function(e){return"opera"in e}(window)?window.opera:""),t=/android.+; wv/i.test(e),n=/iPhone|iPod|iPad/i.test(e)&&/AppleWebKit/i.test(e)&&!/Safari/i.test(e);return t||n}function G(e,t,n=!0){var r;return null!=(r=e[t])?r:n}var R=(e=>(e.ESTIMATED="ESTIMATED",e.FINAL="FINAL",e.NOT_CURRENTLY_KNOWN="NOT_CURRENTLY_KNOWN",e))(R||{}),B=(e=>(e.AMEX="AMEX",e.DISCOVER="DISCOVER",e.INTERAC="INTERAC",e.JCB="JCB",e.MC="MASTERCARD",e.VISA="VISA",e))(B||{}),L=(e=>(e.OFFER="OFFER",e.PAYMENT_AUTHORIZATION="PAYMENT_AUTHORIZATION",e.SHIPPING_ADDRESS="SHIPPING_ADDRESS",e.SHIPPING_OPTION="SHIPPING_OPTION",e))(L||{}),x=(e=>(e.OFFER_INVALID="OFFER_INVALID",e.PAYMENT_DATA_INVALID="PAYMENT_DATA_INVALID",e.SHIPPING_ADDRESS_INVALID="SHIPPING_ADDRESS_INVALID",e.SHIPPING_ADDRESS_UNSERVICEABLE="SHIPPING_ADDRESS_UNSERVICEABLE",e.SHIPPING_OPTION_INVALID="SHIPPING_OPTION_INVALID",e.OTHER_ERROR="OTHER_ERROR",e))(x||{}),j=(e=>(e.INITIALIZE="INITIALIZE",e.SHIPPING_OPTION="SHIPPING_OPTION",e.SHIPPING_ADDRESS="SHIPPING_ADDRESS",e.OFFER="OFFER",e))(j||{});function F(e){return e in B}var V=Object.defineProperty,U=Object.defineProperties,W=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,Z=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J=(e,t)=>{for(var n in t||(t={}))q.call(t,n)&&Z(e,n,t[n]);if(H)for(var n of H(t))K.call(t,n)&&Z(e,n,t[n]);return e},Y=(e,t)=>U(e,W(t)),X=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Q{constructor(e,t){this._gatewayIdentifier=e,this._paymentIntegrationService=t,this._isBuyNowFlow=!1,this._shouldRequestShipping=!0,this._isWebViewExperimentOn=null}mapToShippingAddressRequestBody({shippingAddress:e}){if(!e)return;const{company:t="",phone:n=""}=this._paymentIntegrationService.getState().getShippingAddress()||{};return this._mapToAddressRequestBody(e,t,n)}mapToBillingAddressRequestBody(e){const{billingAddress:t}=e.paymentMethodData.info;if(!t)return;const{company:n="",phone:r="",email:i,customFields:o=[]}=this._paymentIntegrationService.getState().getBillingAddress()||{};return Y(J({},this._mapToAddressRequestBody(t,n,r,o)),{email:i||e.email})}mapToExternalCheckoutData(e){var t;const{paymentMethodData:{tokenizationData:{token:n},info:{cardNetwork:r,cardDetails:i}}}=e;if(!n)throw new _(g.MissingPaymentToken);return Promise.resolve(J({nonce:n,card_information:{type:r,number:i}},this._isBuyNowFlow&&{cart_id:null==(t=this._paymentIntegrationService.getState().getCart())?void 0:t.id}))}getRequiredData(){return X(this,null,function*(){var e;const t={emailRequired:!0};if(!this._isShippingAddressRequired())return t;const n=null==(e=(yield this._paymentIntegrationService.loadShippingCountries()).getShippingCountries())?void 0:e.map(e=>e.code);return Y(J({},t),{shippingAddressRequired:!0,shippingAddressParameters:J({phoneNumberRequired:!0},n&&{allowedCountryCodes:n}),shippingOptionRequired:!0})})}getCallbackIntents(){return this._isShippingAddressRequired()?[L.OFFER,L.SHIPPING_ADDRESS,L.SHIPPING_OPTION]:[L.OFFER]}getCallbackTriggers(){return{availableTriggers:[j.INITIALIZE,j.SHIPPING_ADDRESS,j.SHIPPING_OPTION,j.OFFER],initializationTrigger:[j.INITIALIZE],addressChangeTriggers:[j.INITIALIZE,j.SHIPPING_ADDRESS],shippingOptionsChangeTriggers:[j.SHIPPING_OPTION],offerChangeTriggers:[j.OFFER]}}getNonce(e){var t;const n=null==(t=this._paymentIntegrationService.getState().getPaymentMethodOrThrow(e).initializationData)?void 0:t.nonce;if(!n)throw new _(g.MissingPaymentToken);return Promise.resolve(n)}extraPaymentData(){return Promise.resolve(void 0)}getMerchantInfo(){const{googleMerchantName:e,googleMerchantId:t,platformToken:n}=this.getGooglePayInitializationData();return{merchantName:e,merchantId:t,authJwt:n}}getTransactionInfo(){let e;const{getCartOrThrow:t}=this._paymentIntegrationService.getState();e=this._isBuyNowFlow?this._getCurrencyCodeOrThrow():t().currency.code;const n=this.getGooglePayInitializationData().storeCountry;if(this.isWebViewWithRestrictions()){const t=this.getTotalPrice();return Y(J({},n&&{countryCode:n}),{currencyCode:e,totalPrice:t,totalPriceStatus:R.ESTIMATED})}return Y(J({},n&&{countryCode:n}),{currencyCode:e,totalPriceStatus:R.ESTIMATED,totalPrice:"0"})}isWebViewWithRestrictions(){return null!==this._isWebViewExperimentOn?this._isWebViewExperimentOn&&z():z()}setIsWebViewExperimentOn(e){this._isWebViewExperimentOn=e}setFilterAvailableShippingOptions(e){this._filterAvailableShippingOptions=e}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData().gatewayMerchantId;if(!e)throw new S("Unable to proceed, gatewayMerchantId is missing.");return{gateway:this._gatewayIdentifier,gatewayMerchantId:e}}getCardParameters(){return{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:this.getPaymentMethod().supportedCards.filter(F).map(e=>B[e]),billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}}initialize(e,t,n){return this._getPaymentMethodFn=e,this._isBuyNowFlow=Boolean(t),this._currencyCode=n,this._isBuyNowFlow&&this._getCurrencyCodeOrThrow(),Promise.resolve()}handleShippingAddressChange(e){return X(this,null,function*(){var t,n;e&&(e.name=e.name||"",e.address1=e.address1||"");const r=this.mapToShippingAddressRequestBody({shippingAddress:e});r&&(yield this._paymentIntegrationService.updateShippingAddress(r));const i=this._paymentIntegrationService.getState(),o=i.getConsignments();if(!(null==o?void 0:o[0]))return;const a=o[0],s=i.getStoreConfigOrThrow();this._currencyService||(this._currencyService=new D(s));let l=a.availableShippingOptions||[];if("function"==typeof this._filterAvailableShippingOptions)try{l=yield this._filterAvailableShippingOptions(l)}catch(e){console.error("Failed to filter available shipping options:",e)}const c=l.map(this._getGooglePayShippingOption.bind(this)),d=l.find(e=>e.isRecommended),h=l.some(e=>{var t;return e.id===(null==(t=a.selectedShippingOption)?void 0:t.id)})?null==(t=a.selectedShippingOption)?void 0:t.id:void 0;if(c.length){const e=h||(null==d?void 0:d.id)||(null==(n=c[0])?void 0:n.id);return!h&&c[0]&&(yield this.handleShippingOptionChange((null==d?void 0:d.id)||c[0].id)),{defaultSelectedOptionId:e,shippingOptions:c}}})}handleShippingOptionChange(e){return X(this,null,function*(){if("shipping_option_unselected"!==e)return this._paymentIntegrationService.selectShippingOption(e)})}getTotalPrice(){const{getCheckoutOrThrow:e,getCartOrThrow:t,getStoreConfigOrThrow:n}=this._paymentIntegrationService.getState(),{decimalPlaces:r}=t().currency,i=G(n().checkoutSettings.features,"PI-5075.google_pay_round_total_price_to_max_2_decimal_places")?Math.min(r,2):r;return l(e().outstandingBalance,i).toFixed(i)}handleCoupons(e){return X(this,null,function*(){const{redemptionCodes:t=[]}=e,{offers:n}=this.getAppliedCoupons()||{};let r;return yield t.reduce((e,t)=>X(this,null,function*(){if(yield e,(n||[]).some(({redemptionCode:e})=>e===t))return;const i=yield this.applyCoupon(t);i&&(r=i)}),Promise.resolve()),yield(n||[]).reduce((e,n)=>X(this,null,function*(){yield e,t.includes(n.redemptionCode)||(yield this._paymentIntegrationService.removeCoupon(n.redemptionCode))}),Promise.resolve()),{newOfferInfo:this.getAppliedCoupons(),error:r}})}getAppliedCoupons(){const e=this._paymentIntegrationService.getState(),{coupons:t}=e.getCheckout()||{};return{offers:(t||[]).map(e=>{const{displayName:t,code:n}=e;return{redemptionCode:n,description:t}})}}applyCoupon(e){return X(this,null,function*(){let t;try{yield this._paymentIntegrationService.applyCoupon(e)}catch(e){return e instanceof Error&&(t={reason:x.OFFER_INVALID,message:e.message,intent:j.OFFER}),t}})}setShouldRequestShipping(e){this._shouldRequestShipping=e}getGooglePayInitializationData(){return N(this.getPaymentMethod().initializationData,()=>new S("Missing initialization data."))}getPaymentMethod(){return N(this._getPaymentMethodFn,()=>new b(w.PaymentNotInitialized))()}getGatewayIdentifier(){return this._gatewayIdentifier}setGatewayIdentifier(e){this._gatewayIdentifier=e||this.getGatewayIdentifier()}_isShippingAddressRequired(){const{getCartOrThrow:e,getStoreConfigOrThrow:t,getShippingAddress:n}=this._paymentIntegrationService.getState(),r=t();let i;return i=G(r.checkoutSettings.features,"PI-4290.google_pay_require_shipping_address")?this._shouldRequestShipping:void 0===n(),i&&(o=e(),a=r,!!o&&(!!o.lineItems.physicalItems.some(e=>e.isShippingRequired)||!(!a||!o.lineItems.customItems)&&o.lineItems.customItems.length>0));var o,a}_mapToAddressRequestBody(e,t,n,r){const{name:i,address1:o,address2:a,address3:s,locality:l,administrativeArea:c,countryCode:d,postalCode:h,phoneNumber:u}=e,[y,p]=this._getFirstAndLastName(i);return{firstName:y,lastName:p,company:t,address1:o,address2:`${a} ${s}`.trim(),city:l||c,stateOrProvince:c,stateOrProvinceCode:c,countryCode:d,postalCode:h,phone:u||n,customFields:r||[]}}_getFirstAndLastName(e){const t=e.split(" ");return 1===t.length?[e,""]:[t.slice(0,-1).join(" "),t[t.length-1]]}_getCurrencyCodeOrThrow(){return N(this._currencyCode,()=>new S('Unable to initialize payment because "options.currencyCode" argument is not provided.'))}_getGooglePayShippingOption({id:e,cost:t,description:n,additionalDescription:r}){var i;return{id:e,label:`${(null==(i=this._currencyService)?void 0:i.toCustomerCurrency(t))||t} ${n}`,description:r}}}var $=Object.getPrototypeOf,ee=Reflect.get,te=(e,t,n)=>ee($(e),n,t),ne=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class re extends Q{constructor(e,t){super("adyen",e),this._scriptLoader=t,this._service=e}initialize(e,t,n){return ne(this,null,function*(){yield te(re.prototype,this,"initialize").call(this,e,t,n);const r=te(re.prototype,this,"getPaymentMethod").call(this),i=this._service.getState().getStoreConfig();if(!i)throw new _(g.MissingCheckoutConfig);return this._adyenClient=yield this._scriptLoader.load({environment:r.config.testMode?"test":"live",locale:i.storeProfile.storeLanguage}),Promise.resolve()})}getNonce(e){return ne(this,null,function*(){const t=yield te(re.prototype,this,"getNonce").call(this,e),n=te(re.prototype,this,"getPaymentMethod").call(this);return JSON.stringify({type:n.method,googlePayToken:t,browser_info:m()})})}processAdditionalAction(e){return ne(this,null,function*(){if(!P(e)||!p(e.body))throw e;const t=yield this._handleAction(e.body.provider_data);try{return yield this._service.submitPayment(t)}catch(e){return this.processAdditionalAction(e)}})}_handleAction(e){return new Promise((t,n)=>{const r=JSON.parse(e.action);this._getAdyenClient().createFromAction(r,{onAdditionalDetails:e=>{const n={methodId:r.paymentMethodType,paymentData:{nonce:JSON.stringify(e.data)}};t(n)},size:"05",onError:e=>n(e)}).mount("body"),n(new f)})}_getAdyenClient(){if(!this._adyenClient)throw new b(w.PaymentNotInitialized);return this._adyenClient}}const ie={"X-Checkout-SDK-Version":"1.983.3"};class oe extends d{constructor(e){super(e||"Unable to proceed because the client library of a payment method has thrown an unexpected error."),this.name="PaymentMethodFailedError",this.type="payment_method_client_invalid"}}var ae=Object.defineProperty,se=Object.defineProperties,le=Object.getOwnPropertyDescriptors,ce=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,ue=(e,t,n)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ye=(e,t)=>{for(var n in t||(t={}))de.call(t,n)&&ue(e,n,t[n]);if(ce)for(var n of ce(t))he.call(t,n)&&ue(e,n,t[n]);return e},pe=(e,t)=>se(e,le(t)),ge=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class _e{constructor(e,t,n,r){this._scriptLoader=e,this._gateway=t,this._requestSender=n,this._formPoster=r,this._baseRequest={apiVersion:2,apiVersionMinor:0}}initialize(e,t,n,r){return ge(this,null,function*(){this._paymentsClient=yield this._scriptLoader.getGooglePaymentsClient(e().config.testMode,t),yield this._gateway.initialize(e,n,r),this._buildButtonPayloads()})}initializeWidget(){return ge(this,null,function*(){yield this._buildWidgetPayloads(),yield this._determineReadinessToPay(),this._prefetchGooglePaymentData()})}getNonce(e){return this._gateway.getNonce(e)}extraPaymentData(){return ge(this,null,function*(){return this._gateway.extraPaymentData()})}addPaymentButton(e,t){const n=document.querySelector(`#${e}`);if(!n)return;const r=this._getPaymentsClient().createButton(pe(ye({},t),{allowedPaymentMethods:[this._getBaseCardPaymentMethod()]}));return n.appendChild(r)}showPaymentSheet(){return ge(this,null,function*(){const e=this._getPaymentDataRequest();return this._getPaymentsClient().loadPaymentData(e)})}setExternalCheckoutXhr(e,t){return ge(this,null,function*(){return this._setExternalCheckout(e,t)})}setExternalCheckoutForm(e,t,n){return ge(this,null,function*(){return this._setExternalCheckout(e,t,!0,n)})}mapToBillingAddressRequestBody(e){return this._gateway.mapToBillingAddressRequestBody(e)}mapToShippingAddressRequestBody(e){return this._gateway.mapToShippingAddressRequestBody(e)}processAdditionalAction(e,t){return"processAdditionalAction"in this._gateway?this._gateway.processAdditionalAction(e,t):Promise.reject(e)}signOut(e){return ge(this,null,function*(){yield this._requestSender.get(`/remote-checkout/${e}/signout`)})}getCallbackTriggers(){return this._gateway.getCallbackTriggers()}setShouldRequestShipping(e){return this._gateway.setShouldRequestShipping(e)}handleShippingAddressChange(e){return ge(this,null,function*(){return this._gateway.handleShippingAddressChange(e)})}handleShippingOptionChange(e){return ge(this,null,function*(){yield this._gateway.handleShippingOptionChange(e)})}handleCoupons(e){return ge(this,null,function*(){return this._gateway.handleCoupons(e)})}getTotalPrice(){return this._gateway.getTotalPrice()}_setExternalCheckout(e,t,n=!1,r){return ge(this,null,function*(){const i="/checkout.php",o=ye({action:"set_external_checkout",provider:e},yield this._gateway.mapToExternalCheckoutData(t));if(n)return new Promise(e=>{this._formPoster.postForm(r?`${r}/checkout`:i,pe(ye({},o),{card_information:JSON.stringify(o.card_information)}),e)});yield this._requestSender.post(i,{headers:ye({Accept:"text/html","Content-Type":"application/x-www-form-urlencoded"},ie),body:o})})}isWebViewWithRestrictions(){return this._gateway.isWebViewWithRestrictions()}setIsWebViewExperimentOn(e){return this._gateway.setIsWebViewExperimentOn(e)}setFilterAvailableShippingOptions(e){return this._gateway.setFilterAvailableShippingOptions(e)}_prefetchGooglePaymentData(){const e=this._getPaymentDataRequest();e.transactionInfo=this._gateway.getTransactionInfo(),this._getPaymentsClient().prefetchPaymentData(e)}_determineReadinessToPay(){return ge(this,null,function*(){try{const{result:e}=yield this._getPaymentsClient().isReadyToPay(this._getIsReadyToPayRequest());if(!1===e)throw new oe("Google Pay is not supported by the current device and browser, please try another payment method.")}catch(e){if(e instanceof oe)throw e;throw new oe}})}_buildButtonPayloads(){this._baseCardPaymentMethod={type:"CARD",parameters:this._gateway.getCardParameters()}}_buildWidgetPayloads(){return ge(this,null,function*(){const e=this._getBaseCardPaymentMethod();this._cardPaymentMethod=pe(ye({},e),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:yield this._gateway.getPaymentGatewayParameters()}});const t=this._gateway.isWebViewWithRestrictions()?{shippingOptionRequired:!1}:{callbackIntents:this._gateway.getCallbackIntents(),offerInfo:this._gateway.getAppliedCoupons()};this._paymentDataRequest=ye(ye(pe(ye({},this._baseRequest),{allowedPaymentMethods:[this._cardPaymentMethod],transactionInfo:this._gateway.getTransactionInfo(),merchantInfo:this._gateway.getMerchantInfo()}),yield this._gateway.getRequiredData()),t),this._isReadyToPayRequest=pe(ye({},this._baseRequest),{allowedPaymentMethods:[e]})})}_getBaseCardPaymentMethod(){return this._getOrThrow(this._baseCardPaymentMethod)}_getPaymentDataRequest(){return this._getOrThrow(this._paymentDataRequest)}_getIsReadyToPayRequest(){return this._getOrThrow(this._isReadyToPayRequest)}_getPaymentsClient(){return this._getOrThrow(this._paymentsClient)}_getOrThrow(e){return N(e,()=>new b(w.PaymentNotInitialized))}}class me extends S{constructor(e){let t="Unable to submit payment for the order because the payload is invalid.";e&&(t=`${t} Make sure the following fields are provided correctly: ${e.join(", ")}.`),super(t),this.name="PaymentArgumentInvalidError"}}class Pe extends d{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}var fe=(e=>(e.ACKNOWLEDGE="ACKNOWLEDGE",e.FINALIZE="FINALIZE",e.INITIALIZE="INITIALIZE",e))(fe||{});const we=fe;var be=Object.defineProperty,Se=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,Ie=(e,t,n)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oe=(e,t)=>{for(var n in t||(t={}))Ce.call(t,n)&&Ie(e,n,t[n]);if(Se)for(var n of Se(t))ve.call(t,n)&&Ie(e,n,t[n]);return e};const Ae={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},Te={position:"fixed","background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"},Me="embedded-checkout-loading-indicator-rotation";class ke{constructor(e){this.styles=Oe(Oe({},Ae),e&&e.styles),this.containerStyles=Oe({},e&&e.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(e){if(e){const t=document.getElementById(e);if(!t)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");t.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const e=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",e)};this.container.addEventListener("transitionend",e),this.container.style.opacity="0"}buildContainer(){const e=document.createElement("div");return e.style.display="block",e.style.bottom="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.position="absolute",e.style.right="0",e.style.top="0",e.style.transition="all 250ms ease-out",e.style.opacity="0",this.setStyleAttribute(e,this.containerStyles),e}buildIndicator(){const e=document.createElement("div");return e.style.display="block",e.style.width=`${this.styles.size}px`,e.style.height=`${this.styles.size}px`,e.style.borderRadius=`${this.styles.size}px`,e.style.border="solid 1px",e.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,e.style.margin="0 auto",e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="50%",e.style.transform="translateY(-50%) rotate(0deg)",e.style.transformStyle="preserve-3d",e.style.animation=`${Me} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,e}setStyleAttribute(e,t){Object.keys(t).forEach(n=>{e.style.setProperty(n,t[n])})}defineAnimation(){var e;if(document.getElementById(Me))return;const t=document.createElement("style");t.id=Me,null==(e=document.head)||e.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule(`\n @keyframes ${Me} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}function Ee(e){return"object"==typeof e&&null!==e&&"statusCode"in e}var De=(e=>(e.ADYEN_V2="googlepayadyenv2",e.ADYEN_V3="googlepayadyenv3",e.AUTHORIZE_NET="googlepayauthorizenet",e.BNZ="googlepaybnz",e.BRAINTREE="googlepaybraintree",e.PAYPAL_COMMERCE="googlepaypaypalcommerce",e.BIGCOMMERCE_PAYMENTS="googlepay_bigcommerce_payments",e.CHECKOUT_COM="googlepaycheckoutcom",e.CYBERSOURCE_V2="googlepaycybersourcev2",e.ORBITAL="googlepayorbital",e.STRIPE="googlepaystripe",e.STRIPE_UPE="googlepaystripeupe",e.STRIPE_OCS="googlepaystripeocs",e.WORLDPAY_ACCESS="googlepayworldpayaccess",e.TD_ONLINE_MART="googlepaytdonlinemart",e))(De||{});function Ne(e){return Object.values(De).includes(e)}var ze=Object.defineProperty,Ge=Object.defineProperties,Re=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,je=(e,t,n)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fe=(e,t)=>{for(var n in t||(t={}))Le.call(t,n)&&je(e,n,t[n]);if(Be)for(var n of Be(t))xe.call(t,n)&&je(e,n,t[n]);return e},Ve=(e,t)=>Ge(e,Re(t)),Ue=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class We{constructor(e,t){this._paymentIntegrationService=e,this._googlePayPaymentProcessor=t,this._isDeinitializationBlocked=!1,this._isContainerMode=!1,this._loadingIndicator=new ke({containerStyles:Te})}initialize(e){return Ue(this,null,function*(){var t,n;if(!(null==e?void 0:e.methodId)||!Ne(e.methodId))throw new S('Unable to proceed because "methodId" is not a valid key.');this._methodId=e.methodId;const r=e[this._getMethodId()];if(!(null==r?void 0:r.walletButton)&&!(null==r?void 0:r.container))throw new S("Unable to proceed without valid options.");const i=r,{walletButton:o,loadingContainerId:a,container:s,buttonColor:l,buttonSizeMode:c,buttonType:d,onInit:h}=i,u=((e,t)=>{var n={};for(var r in e)Le.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&Be)for(var r of Be(e))t.indexOf(r)<0&&xe.call(e,r)&&(n[r]=e[r]);return n})(i,["walletButton","loadingContainerId","container","buttonColor","buttonSizeMode","buttonType","onInit"]);this._loadingIndicatorContainer=a,yield this._paymentIntegrationService.loadPaymentMethod(this._getMethodId());const y=this._paymentIntegrationService.getState().getPaymentMethodOrThrow(this._getMethodId());if(this._googlePayPaymentProcessor.setIsWebViewExperimentOn(!!(null==(t=y.initializationData)?void 0:t.isWebViewExperimentOn)),yield this._googlePayPaymentProcessor.initialize(()=>y,this._getGooglePayClientOptions(null==(n=y.initializationData)?void 0:n.storeCountry)),s){this._isContainerMode=!0;const e=()=>this._addPaymentButtonToContainer(r);h?h(e):e()}else this._addPaymentButton(o,u)})}execute(e){return Ue(this,arguments,function*({payment:e}){if(!(null==e?void 0:e.methodId))throw new me(["payment"]);yield this._paymentIntegrationService.submitOrder();const t=yield this._googlePayPaymentProcessor.getNonce(e.methodId),n=yield this._googlePayPaymentProcessor.extraPaymentData();try{yield this._paymentIntegrationService.submitPayment(Ve(Fe({},e),{paymentData:Fe({nonce:t},n)}))}catch(t){yield this._handleSubmitPaymentFailure(t,e.methodId)}})}finalize(e){return Ue(this,null,function*(){if(!this._isHandleUnsuccessful3dsCheckExperimentOn())return Promise.reject(new Pe);const t=this._paymentIntegrationService.getState(),n=t.getOrder(),r=t.getPaymentStatus();if(!n||r!==we.FINALIZE&&r!==we.INITIALIZE)return Promise.reject(new Pe);try{yield this._paymentIntegrationService.finalizeOrder(e)}catch(t){throw(null==e?void 0:e.methodId)&&(yield this._invalidateStalePaymentToken(e.methodId)),t}})}deinitialize(){var e,t;return this._isDeinitializationBlocked||(this._isContainerMode?null==(e=this._paymentButton)||e.remove():this._clickListener&&(null==(t=this._paymentButton)||t.removeEventListener("click",this._clickListener)),this._paymentButton=void 0,this._clickListener=void 0,this._methodId=void 0,this._isContainerMode=!1),Promise.resolve()}_handleSubmitPaymentFailure(e,t){return Ue(this,null,function*(){const n=this._isHandleUnsuccessful3dsCheckExperimentOn();try{yield this._googlePayPaymentProcessor.processAdditionalAction(e,t)}catch(e){throw n&&(yield this._invalidateStalePaymentToken(t)),e}})}_addPaymentButton(e,t){if(this._paymentButton)return;const n=document.getElementById(e);if(!n)throw new S("Unable to proceed without a walletButton.");this._paymentButton=n,this._clickListener=this._handleClick(t),this._paymentButton.addEventListener("click",this._clickListener)}_addPaymentButtonToContainer(e){if(this._paymentButton)return;const{container:t,buttonColor:n,buttonSizeMode:r,buttonType:i,onError:o}=e;if(!t)throw new S("Unable to proceed: container ID is not valid.");const a=this._googlePayPaymentProcessor.addPaymentButton(t,{buttonColor:null!=n?n:"default",buttonSizeMode:null!=r?r:"fill",buttonType:null!=i?i:"pay",onClick:this._handleContainerButtonClick(o)});if(!a)throw new S(`Unable to proceed: container element "#${t}" not found in the DOM.`);this._paymentButton=a}_handleContainerButtonClick(e){return t=>Ue(this,null,function*(){t.preventDefault(),yield this._runGooglePayWidgetInteractionWithErrorHandling(e,()=>Ue(this,null,function*(){this._googlePayPaymentProcessor.setShouldRequestShipping(!1),yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheetAndPay()}))})}_handleClick({onPaymentSelect:e,onError:t}){return n=>Ue(this,null,function*(){n.preventDefault(),yield this._runGooglePayWidgetInteractionWithErrorHandling(t,()=>Ue(this,null,function*(){this._googlePayPaymentProcessor.setShouldRequestShipping(!1),yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheetAndPay()})),null==e||e()})}_interactWithPaymentSheetAndPay(){return Ue(this,null,function*(){const e=yield this._googlePayPaymentProcessor.showPaymentSheet();this._toggleBlockDeinitialization(!0),this._toggleLoadingIndicator(!0);const t=this._getMethodId(),n=this._paymentIntegrationService.getState(),{features:r}=n.getStoreConfigOrThrow().checkoutSettings,i=G(r,"PI-5031.google_pay_dont_override_address"),o=this._googlePayPaymentProcessor.mapToBillingAddressRequestBody(e);o&&!i&&(yield this._paymentIntegrationService.updateBillingAddress(o)),yield this._googlePayPaymentProcessor.setExternalCheckoutXhr(t,e),yield this._paymentIntegrationService.loadPaymentMethod(t);const a=this._paymentIntegrationService.getState().getPaymentMethodOrThrow(t);yield this._googlePayPaymentProcessor.initialize(()=>a);try{yield this.execute({useStoreCredit:!1,payment:{methodId:t}}),this._completeCheckoutFlow()}catch(e){throw yield this._paymentIntegrationService.loadCheckout(),e}})}_completeCheckoutFlow(){window.location.replace("/checkout/order-confirmation"),this._toggleLoadingIndicator(!1),this._toggleBlockDeinitialization(!1)}_getMethodId(){return N(this._methodId,()=>new b(w.PaymentNotInitialized))}_getIsSignedInOrThrow(){return Ue(this,null,function*(){try{return!!(yield this._googlePayPaymentProcessor.getNonce(this._getMethodId()))}catch(e){if(e instanceof _&&e.subtype===g.MissingPaymentToken)return!1;throw e}})}_handleOfferTrigger(e){return Ue(this,null,function*(){let t=!1,n="Sign in to Google Pay first to apply or remove promo codes.";try{t=yield this._getIsSignedInOrThrow()}catch(e){e instanceof _&&(n=e.message)}if(t){const{newOfferInfo:t,error:n}=yield this._googlePayPaymentProcessor.handleCoupons(e);return{newOfferInfo:t,error:n}}return{error:{reason:x.OFFER_INVALID,message:n,intent:j.OFFER}}})}_getGooglePayClientOptions(e){return this._googlePayPaymentProcessor.isWebViewWithRestrictions()?{}:{paymentDataCallbacks:{onPaymentDataChanged:t=>Ue(this,[t],function*({callbackTrigger:t,offerData:n}){if(t!==j.INITIALIZE&&t!==j.OFFER)return;const{offerChangeTriggers:r}=this._googlePayPaymentProcessor.getCallbackTriggers(),{newOfferInfo:i,error:o}=r.includes(t)?yield this._handleOfferTrigger(n):{},a=o;yield this._paymentIntegrationService.loadCheckout();const{code:s}=this._paymentIntegrationService.getState().getCartOrThrow().currency,l=this._googlePayPaymentProcessor.getTotalPrice();return Fe(Fe({newTransactionInfo:Ve(Fe({},e&&{countryCode:e}),{currencyCode:s,totalPriceStatus:R.FINAL,totalPrice:l})},i&&{newOfferInfo:i}),a&&{error:a})})}}}_runGooglePayWidgetInteractionWithErrorHandling(e,t){return Ue(this,null,function*(){try{yield t()}catch(t){let n=t;if(this._toggleLoadingIndicator(!1),Ee(t)){if("CANCELED"===t.statusCode)throw new f;n=new oe(JSON.stringify(t))}throw null==e||e(new oe("An error occurred while requesting your Google Pay payment details.")),n}finally{this._toggleBlockDeinitialization(!1)}})}_toggleBlockDeinitialization(e){this._isDeinitializationBlocked=e}_toggleLoadingIndicator(e){e&&this._loadingIndicatorContainer?this._loadingIndicator.show(this._loadingIndicatorContainer):this._loadingIndicator.hide()}_invalidateStalePaymentToken(e){return Ue(this,null,function*(){try{yield this._paymentIntegrationService.loadPaymentMethod(e)}catch(e){}})}_isHandleUnsuccessful3dsCheckExperimentOn(){const{features:e}=this._paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings;return G(e,"PI-5643.google_pay_handle_unsuccessful_3ds_check",!1)}}var He=Object.defineProperty,qe=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class Ye{constructor(e){this._scriptLoader=e,this._window=window}getGooglePaymentsClient(e=!1,t){return n=this,r=function*(){if(yield this._scriptLoader.loadScript("https://pay.google.com/gp/p/js/pay.js"),!this._window.google)throw new h;return void 0===this._paymentsClient&&(this._paymentsClient=new this._window.google.payments.api.PaymentsClient(((e,t)=>{for(var n in t||(t={}))Ke.call(t,n)&&Je(e,n,t[n]);if(qe)for(var n of qe(t))Ze.call(t,n)&&Je(e,n,t[n]);return e})({environment:e?"TEST":"PRODUCTION"},null!=t?t:{}))),this._paymentsClient},new Promise((e,t)=>{var i=e=>{try{a(r.next(e))}catch(e){t(e)}},o=e=>{try{a(r.throw(e))}catch(e){t(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((r=r.apply(n,null)).next())});var n,r}}function Xe(){return new Ye(n())}const Qe=y(i=>new We(i,new _e(Xe(),new re(i,new u(n(),r())),t(),e())),[{id:"googlepayadyenv2"}]),$e={css:"sha384-5MvB4RnzvviA3VBT4KYABZ4HXNZG5LRqREEgd41xt/pf/QvKmsj2O9GuNuywRXx9",js:"sha384-yvY2yFNR4WqIjPqP9MzjI+gJimmaJnAvj4rLHKvgJbgFD5fMuf8zIJrFJOW8Lhhf"},et={css:"sha384-PWrMXiOTu6vDvUL+llWHVeWnBIxMTJ6PxGu6f8gKPGpoklzxJxRmeuOgVHE8Xk5U",js:"sha384-eFpi7m7SawN2cMRhljHMUvdeYR9Hi6dWhw40OEHv5HNavDq6Gdhsnch9FcdU3+JZ"};class tt{constructor(e,t,n=window){this._scriptLoader=e,this._stylesheetLoader=t,this._window=n}load(e,t=!1){return n=this,r=function*(){var n,r;const i=t?"6.44.0":"5.71.1",o=t?et:$e;if(yield Promise.all([this._stylesheetLoader.loadStylesheet(`https://checkoutshopper-${null!=(n=e.environment)?n:""}.adyen.com/checkoutshopper/sdk/${i}/adyen.css`,{prepend:!1,attributes:{integrity:o.css,crossorigin:"anonymous"}}),this._scriptLoader.loadScript(`https://checkoutshopper-${null!=(r=e.environment)?r:""}.adyen.com/checkoutshopper/sdk/${i}/adyen.js`,{async:!0,attributes:{integrity:o.js,crossorigin:"anonymous"}})]),t){const t=this._window.AdyenWeb;if(!t)throw new h;const n=yield t.AdyenCheckout(e);return n.createComponent=(e,r)=>t.createComponent(e,n,r),n}if(!this._window.AdyenCheckout)throw new h;return this._window.AdyenCheckout(e)},new Promise((e,t)=>{var i=e=>{try{a(r.next(e))}catch(e){t(e)}},o=e=>{try{a(r.throw(e))}catch(e){t(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((r=r.apply(n,null)).next())});var n,r}}var nt=Object.defineProperty,rt=Object.getOwnPropertySymbols,it=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,st=Reflect.get,lt=(e,t,n)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ct=(e,t,n)=>st(it(e),n,t),dt=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class ht extends Q{constructor(e,t){super("adyen",e),this._scriptLoader=t,this._service=e}initialize(e,t,n){return dt(this,null,function*(){var r;yield ct(ht.prototype,this,"initialize").call(this,e,t,n);const i=ct(ht.prototype,this,"getPaymentMethod").call(this),o=this._service.getState(),a=o.getStoreConfig();if(!a)throw new _(g.MissingCheckoutConfig);const s=G(a.checkoutSettings.features,"PI-5661.adyen_sdk_upgrade",!0);return this._adyenClient=yield this._scriptLoader.load(((e,t)=>{for(var n in t||(t={}))ot.call(t,n)&<(e,n,t[n]);if(rt)for(var n of rt(t))at.call(t,n)&<(e,n,t[n]);return e})({environment:i.config.testMode?"test":"live",locale:a.storeProfile.storeLanguage},s?{countryCode:(null==(r=o.getBillingAddress())?void 0:r.countryCode)||a.storeProfile.storeCountryCode}:{}),s),Promise.resolve()})}processAdditionalAction(e){return dt(this,null,function*(){if(!P(e)||!p(e.body))throw e;const t=yield this._handleAction(e.body.provider_data);try{return yield this._service.submitPayment(t)}catch(e){return this.processAdditionalAction(e)}})}getNonce(e){return dt(this,null,function*(){const t=yield ct(ht.prototype,this,"getNonce").call(this,e),n=ct(ht.prototype,this,"getPaymentMethod").call(this);return JSON.stringify({type:n.method,googlePayToken:t,browser_info:m()})})}_handleAction(e){return new Promise((t,n)=>{const r=JSON.parse(e.action);this._getAdyenClient().createFromAction(r,{onAdditionalDetails:e=>{const n={methodId:r.paymentMethodType,paymentData:{nonce:JSON.stringify(e.data)}};t(n)},size:"05",onError:e=>n(e)}).mount("body"),n(new f)})}_getAdyenClient(){if(!this._adyenClient)throw new b(w.PaymentNotInitialized);return this._adyenClient}}const ut=y(i=>new We(i,new _e(Xe(),new ht(i,new tt(n(),r())),t(),e())),[{id:"googlepayadyenv3"}]);var yt=Object.getPrototypeOf,pt=Reflect.get;class gt extends Q{constructor(e){super("authorizenet",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=gt.prototype,pt(yt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData();return function(e){if(!function(e){return"paymentGatewayId"in e}(e))throw new _(g.MissingPaymentMethod)}(e),{gateway:this.getGatewayIdentifier(),gatewayMerchantId:e.paymentGatewayId}}}const _t=y(n=>new We(n,new _e(Xe(),new gt(n),t(),e())),[{id:"googlepayauthorizenet"}]);var mt=(e=>(e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json",e))(mt||{});const Pt=mt;function ft(e){if(!function(e){return"checkoutcomkey"in e}(e))throw new _(g.MissingPaymentMethod)}var wt=Object.getPrototypeOf,bt=Reflect.get,St=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Ct extends Q{constructor(e,t){super("checkoutltd",e),this._requestSender=t}processAdditionalAction(e){return new Promise((t,n)=>{if(P(e)&&function(e){var t;if("object"!=typeof e||null===e)return!1;const n=e;return"string"==typeof(null==(t=n.three_ds_result)?void 0:t.acs_url)&&"string"==typeof n.three_ds_result.code}(e.body)&&"three_d_secure_required"===e.body.three_ds_result.code)return window.location.assign(e.body.three_ds_result.acs_url);n(e)})}mapToExternalCheckoutData(e){return St(this,null,function*(){const t=yield(n=Ct.prototype,bt(wt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;let r;try{r=JSON.parse(t.nonce)}catch(e){throw new S("Unable to parse response from Google Pay.")}return function(e){if(!function(e){return"object"==typeof e&&null!==e&&"protocolVersion"in e&&"signature"in e&&"signedMessage"in e}(e))throw new _(g.MissingPaymentToken)}(r),t.nonce=yield this._tokenize(r),t})}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData();return ft(e),{gateway:this.getGatewayIdentifier(),gatewayMerchantId:e.checkoutcomkey}}_tokenize(e){return St(this,null,function*(){const t=this.getPaymentMethod().config.testMode?"https://api.sandbox.checkout.com/tokens":"https://api.checkout.com/tokens",n=this.getGooglePayInitializationData();ft(n);const{body:r}=yield this._requestSender.post(t,{credentials:!1,body:{type:"googlepay",token_data:e},headers:{Authorization:n.checkoutcomkey,"Content-Type":Pt.Json,"X-XSRF-TOKEN":null}});return r.token})}}const vt=y(n=>{const r=t();return new We(n,new _e(Xe(),new Ct(n,r),r,e()))},[{id:"googlepaycheckoutcom"}]);var It=Object.getPrototypeOf,Ot=Reflect.get;class At extends Q{constructor(e){super("cybersource",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=At.prototype,Ot(It(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}const Tt=y(n=>new We(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaycybersourcev2"},{id:"googlepaybnz"}]);var Mt=Object.getPrototypeOf,kt=Reflect.get;class Et extends Q{constructor(e){super("chase",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=Et.prototype,kt(Mt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}const Dt=y(n=>new We(n,new _e(Xe(),new Et(n),t(),e())),[{id:"googlepayorbital"}]);var Nt=(e=>(e.V3="v3",e.ACACIA="acacia",e.BASIL="basil",e.CLOVER="clover",e))(Nt||{}),zt=Object.defineProperty,Gt=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable,Lt=(e,t,n)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xt=(e,t)=>{for(var n in t||(t={}))Rt.call(t,n)&&Lt(e,n,t[n]);if(Gt)for(var n of Gt(t))Bt.call(t,n)&&Lt(e,n,t[n]);return e},jt=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Ft{constructor(e,t=window){this.scriptLoader=e,this.stripeWindow=t}getStripeClient(e,t,n,r,i){return jt(this,null,function*(){if(this.stripeWindow.bcStripeClient)return this.stripeWindow.bcStripeClient;const o=yield this.load(n),{stripePublishableKey:a,stripeConnectedAccount:s}=e,l=o(a,xt(xt(xt(xt({},s?{stripeAccount:s}:{}),t?{locale:t}:{}),r?{betas:r}:{}),i?{apiVersion:i}:{}));return Object.assign(this.stripeWindow,{bcStripeClient:l}),l})}getElements(e,t){return jt(this,null,function*(){let n=this.stripeWindow.bcStripeElements;return n?yield this.updateStripeElements(t):(n=e.elements(t),Object.assign(this.stripeWindow,{bcStripeElements:n})),n})}updateStripeElements(e){return jt(this,null,function*(){const t=this.stripeWindow.bcStripeElements;t&&(t.update(e),yield t.fetchUpdates())})}getStripeCheckout(e,t){return jt(this,null,function*(){let n=yield this.getStoredStripeCheckout(t);if(n){const{actions:e}=yield n.loadActions();yield null==e?void 0:e.runServerUpdate(()=>Promise.resolve())}else n=yield e.initCheckout(t),Object.assign(this.stripeWindow,{bcStripeCheckout:n});return n})}load(e){return jt(this,null,function*(){if(!this.stripeWindow.Stripe&&(yield this.scriptLoader.loadScript(this.getScriptUrl(e)),!this.stripeWindow.Stripe))throw new h;return this.stripeWindow.Stripe})}getScriptUrl(e){return e&&e!==Nt.V3?`https://js.stripe.com/${e}/stripe.js`:"https://js.stripe.com/v3/"}getStoredStripeCheckout(e){return jt(this,null,function*(){const t=this.stripeWindow.bcStripeCheckout;if(t)try{const{actions:n,error:r}=yield t.loadActions();if(r||!n)return void this.logErrorToConsole(r);const i=yield n.getSession(),o=e.clientSecret.split("_secret_")[0];if(i.id===o)return t}catch(e){return void this.logErrorToConsole(e)}})}logErrorToConsole(e){e?console.error(e):console.error("No stripe checkout actions available on loadActions().")}}const Vt={body:{},headers:{},status:0};class Ut extends d{constructor(e,{message:t,errors:n}={}){const{body:r,headers:i,status:o}=e||Vt;super(t||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}const Wt=["payment_element_beta_2","alipay_pm_beta_1","link_default_integration_beta_1","shipping_address_element_beta_1","address_element_beta_1"];function Ht(e){if(!function(e){return"stripeConnectedAccount"in e&&"stripePublishableKey"in e&&"stripeVersion"in e}(e))throw new _(g.MissingPaymentMethod)}var qt=Object.getPrototypeOf,Kt=Reflect.get,Zt=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Jt extends Q{constructor(e,t){super("stripe",e),this.paymentIntegrationService=e,this.scriptLoader=t}mapToExternalCheckoutData(e){return Zt(this,null,function*(){const t=yield(n=Jt.prototype,Kt(qt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;let r;try{r=JSON.parse(t.nonce)}catch(e){throw new S("Unable to parse response from Google Pay.")}return function(e){if(!function(e){return"object"==typeof e&&null!==e&&"id"in e}(e))throw new _(g.MissingPaymentToken)}(r),t.nonce=r.id,t})}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData();Ht(e);const{stripeVersion:t,stripePublishableKey:n,stripeConnectedAccount:r}=e;return{gateway:this.getGatewayIdentifier(),"stripe:version":t,"stripe:publishableKey":`${n}/${r}`}}processAdditionalAction(e,t){return Zt(this,null,function*(){var n,r;if(!t)throw new me(["payment"]);if(!P(e)||("object"!=typeof(r=e.body)||null===r||!("three_ds_result"in r)||!("errors"in r)))throw e;if(c(e.body.errors,{code:"three_d_secure_required"})){const r=this.getGooglePayInitializationData();Ht(r),this.stripeUPEClient=yield this.loadStripeJs(r,t);const i=e.body.three_ds_result.token;let o,a=!1;try{o=yield this.stripeUPEClient.confirmCardPayment(i)}catch(e){try{o=yield this.stripeUPEClient.retrievePaymentIntent(i)}catch(e){a=!0}}if(null==o?void 0:o.error){if(this._throwDisplayableStripeError(o.error),this._isCancellationError(o.error))throw new f;throw new oe}if(!(null==o?void 0:o.paymentIntent)&&!a)throw new Ut;return this.paymentIntegrationService.submitPayment({methodId:t,paymentData:{nonce:(null==(n=null==o?void 0:o.paymentIntent)?void 0:n.id)||i}})}throw e})}loadStripeJs(e,t){return Zt(this,null,function*(){if(this.stripeUPEClient)return this.stripeUPEClient;const n=this.paymentIntegrationService.getState().getCartLocale();return"googlepaystripeocs"===t?this.scriptLoader.getStripeClient(e,n,Nt.CLOVER):this.scriptLoader.getStripeClient(e,n,Nt.V3,Wt,"2020-03-02;alipay_beta=v1;link_beta=v1")})}_isCancellationError(e){var t,n;return e&&-1!==(null==(n=null==(t=e.payment_intent.last_payment_error)?void 0:t.message)?void 0:n.indexOf("canceled"))}_throwDisplayableStripeError(e){if(o(["card_error","invalid_request_error","validation_error"],e.type))throw new Error(e.message)}}const Yt=y(r=>new We(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripe"},{id:"googlepaystripeupe"},{id:"googlepaystripeocs"}]);var Xt=Object.getPrototypeOf,Qt=Reflect.get;class $t extends Q{constructor(e){super("worldpay",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=$t.prototype,Qt(Xt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}const en=y(n=>new We(n,new _e(Xe(),new $t(n),t(),e())),[{id:"googlepayworldpayaccess"}]),tn="3.128.0",nn="3.123.2",rn="3.106.0";class on{constructor(e){this.paymentIntegrationService=e,this.braintreeWindow=window}getSDKVersion(){const e=this.paymentIntegrationService.getState().getStoreConfig(),t=(null==e?void 0:e.checkoutSettings.features)||{};return this.getPreloadedSDKVersion()||(G(t,"PAYPAL-5809.braintree_hosted_fields_fix_version")?tn:G(t,"PAYPAL-5636.update_braintree_sdk_version")?nn:rn)}getPreloadedSDKVersion(){const e=this.braintreeWindow.braintree;if(e){const t=i(Object.values(e),e=>!!e.VERSION);return null==t?void 0:t.VERSION}}}class an extends d{constructor(e){super(e||"Unsupported browser error"),this.name="UnsupportedBrowserError",this.type="unsupported_browser"}}var sn=(e=>(e.KountNotEnabled="DATA_COLLECTOR_KOUNT_NOT_ENABLED",e))(sn||{}),ln=Object.defineProperty,cn=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,un=(e,t,n)=>t in e?ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class pn{constructor(e){this.braintreeScriptLoader=e}initialize(e){this.setClientToken(e)}deinitialize(){return yn(this,null,function*(){yield this.teardownModule(this.dataCollector),this.dataCollector=void 0})}getClient(){return yn(this,null,function*(){if(!this.client){const e=this.getClientTokenOrThrow(),t=yield this.braintreeScriptLoader.loadClient();this.client=yield t.create({authorization:e})}return this.client})}getDataCollectorOrThrow(e){return yn(this,null,function*(){const t={deviceData:void 0,teardown:()=>Promise.resolve()};if(!this.dataCollector)try{const t=yield this.getClient(),n=yield this.braintreeScriptLoader.loadDataCollector(),r=((e,t)=>{for(var n in t||(t={}))dn.call(t,n)&&un(e,n,t[n]);if(cn)for(var n of cn(t))hn.call(t,n)&&un(e,n,t[n]);return e})({client:t,kount:!0},e);this.dataCollector=yield n.create(r)}catch(e){if(function(e){return Boolean("object"==typeof e&&null!==e&&("type"in e||"message"in e||"code"in e))}(e)&&e.code===sn.KountNotEnabled)return t;throw e}return this.dataCollector})}getBraintreeGooglePayment(){return yn(this,null,function*(){if(!this.googlePayment){const[e,t]=yield Promise.all([this.getClient(),this.braintreeScriptLoader.loadGooglePayment()]);this.googlePayment=yield t.create({client:e})}return this.googlePayment})}getBraintreeThreeDS(){return yn(this,null,function*(){if(!this.threeDS){const[e,t]=yield Promise.all([this.getClient(),this.braintreeScriptLoader.load3DS()]);this.threeDS=yield t.create({client:e,version:2})}return this.threeDS})}getBraintreeLocalPayment(e){return yn(this,null,function*(){if(!this.braintreeLocalPayment){const[t,n]=yield Promise.all([this.getClient(),this.braintreeScriptLoader.loadLocalPayment()]);this.braintreeLocalPayment=yield new Promise((r,i)=>{n.create({client:t,merchantAccountId:e},(e,t)=>{e&&i(e),r(t)})})}return this.braintreeLocalPayment})}getUsBankAccount(){return yn(this,null,function*(){if(!this.usBankAccount){const e=yield this.getClient(),t=yield this.braintreeScriptLoader.loadUsBankAccount();this.usBankAccount=yield t.create({client:e})}return this.usBankAccount})}getBraintreeVisaCheckout(){return this.visaCheckout||(this.visaCheckout=Promise.all([this.getClient(),this.braintreeScriptLoader.loadVisaCheckout()]).then(([e,t])=>t.create({client:e}))),this.visaCheckout}getVisaCheckoutSdk(e){return yn(this,null,function*(){return this.visaCheckoutSDK||(this.visaCheckoutSDK=yield this.braintreeScriptLoader.loadVisaCheckoutSdk(e)),this.visaCheckoutSDK})}getVenmoCheckoutOrThrow(){return yn(this,null,function*(){if(!this.braintreeVenmo){const e=yield this.getClient(),t=yield this.braintreeScriptLoader.loadVenmoCheckout(),n={client:e,allowDesktop:!0,paymentMethodUsage:"multi_use"},r=yield t.create(n);if(!r.isBrowserSupported())throw new an;this.braintreeVenmo=r}return this.braintreeVenmo})}setClientToken(e){this.clientToken=e}getClientTokenOrThrow(){if(!this.clientToken)throw new b(w.PaymentNotInitialized);return this.clientToken}teardownModule(e){return e?e.teardown():Promise.resolve()}}var gn=(e=>(e.Client="client",e.DataCollector="dataCollector",e.Fastlane="fastlane",e.GooglePayment="googlePayment",e.HostedFields="hostedFields",e.LocalPayment="localPayment",e.Paypal="paypal",e.PaypalCheckout="paypalCheckout",e.ThreeDSecure="threeDSecure",e.UsBankAccount="usBankAccount",e.Venmo="venmo",e.VisaCheckout="visaCheckout",e))(gn||{});const _n={[rn]:{[gn.Client]:"sha384-26BXDNnJI23JYRyFBj4xe4sVNrUSSiSSu11kxVXNM/vEPONm4LuL00w6ZaTgQewt",[gn.PaypalCheckout]:"sha384-B+vzbZwnQtzWBthpkT4TXKUibO65tyeK7eCxSvpblgprTep2+IAXB2Cxxjrn710O",[gn.Paypal]:"sha384-uyAGL1/3+XJAHnGoNy4eCoXdzJ4f7Ilzp+6w9PNnEjs6DCCz9WMyJjMN1gzc78U+",[gn.LocalPayment]:"sha384-LIvOEMkIVEwVuYBdVOQc1AC5YbGGlwyfUheS0ACK218D2STuVYQlZ4FyEPowAEfT",[gn.DataCollector]:"sha384-1bo9JDz+Kscthc085cCKWur8CLwUoBpoNyxsDi7932mCl0zFq3A5mv+FQLw9GHpV",[gn.UsBankAccount]:"sha384-xmHBVaU+w74V+OebD3AaPONFxHUGMf+QRs8G/JxVPXNNP7MDa2jL0ICWHIe2tTfJ",[gn.GooglePayment]:"sha384-WKDJl8mqoP82qZpMGH6AbZxnvXnSW8ILV4M64CyMLiugGMwu7LyP89wjCkHqsiBe",[gn.ThreeDSecure]:"sha384-VQUlpGHzsGvs5XeiGFip7EXRsvoHWEXDVmgCacfbyieZI9mdBOqq3NSoyo28OCOB",[gn.VisaCheckout]:"sha384-yx7mADfzTN0T43Q6rlH49LIg1EJ0iUZgBp/EczX9LXsUGkySgxrD+nWHQRBkyfoT",[gn.Venmo]:"sha384-QX4rPjoj1ZDhuG0aSyKs56lEKDqTMTcjYxUHY1SzO5VZDsqIE2NTkqot7KNSCyov",[gn.HostedFields]:"sha384-VvYBACfSu0Cr/J32uKmxG7AXcNOJE1AzIIL3kbikyS7YKp5fz5Is+NzNP/lyauNy",[gn.Fastlane]:"sha384-9oGsZMRZwpGtDEDYa/dFt76dECqj1xAni9gIKgc3KfMIiRnR73nEeeUDLiBzxhFa"},[nn]:{[gn.Client]:"sha384-o+nbQGcwNNxIBeXeu3+XmbSq+Cg8R3EN3N0l5hXCgMMU2RGY0t1z0LroSEIAbfAO",[gn.PaypalCheckout]:"sha384-WrfbWPBS4mH86GAoycPSgiH8hQ8KH7A67C93Hjhunv/xhNk2YpBn3wbFA4Fhg9U/",[gn.Paypal]:"sha384-VF389nvvrRUgDsTXMxTYORDtVegB9IQa3Cxr//DyJnLYnz8/X8VCzEvck2c+Megt",[gn.LocalPayment]:"sha384-tZKx2rEQbfmZpoPSY5VPmJEhaq4X75dLvwHMs3VE9U+C8lPyw+hWTIL1+GPvWCIH",[gn.DataCollector]:"sha384-E6k3wOpP7syCDDwaRDLF06942Y00NkbwJvWi2OQXwwKzGwG5fd3E7RFUvCCecfvO",[gn.UsBankAccount]:"sha384-258FON8LZGG0W9Qaz4Jij83pZHu30YnKjJA7gNulLBh6CclkucgF+tHDQuYFRYfW",[gn.GooglePayment]:"sha384-taJ2p/0+n0VH328POAoBiuEbL3tnHUTE9S42hK1V+Txs3X+QYjZOyKW35JgHRFfO",[gn.ThreeDSecure]:"sha384-+NSZH4Zj3sO5bdWvPKhU5N16QDxeueTVTnUVeleeESkhLSaz4Ob1hh/5myecc9Ym",[gn.VisaCheckout]:"sha384-66DiBjghxk1OmBj8aksN8gbQ+CwoQcx1vPfiXUN08g1iQVM+BwewF0p7toM3i7SS",[gn.Venmo]:"sha384-B5UwY42kE4RoLoWbQ7YpqosUlUad2/DlGWiw0HhoZbSPk30CQAaSA10ohyLDTkDU",[gn.HostedFields]:"sha384-Aw9EesSaUeWxe36PqEHiOyOyOq8M6CIb1gw7/yHNVPRzGtFXXcd2OQ8qXrIlOj2P",[gn.Fastlane]:"sha384-rhBL1hpZ71JqG+2TsT0Dih47mbjx8cjJCpeZjk9tw3df1gFMKfCTmMyZunhr7H4Y"},[tn]:{[gn.Client]:"sha384-0WNxksIpRP+fYZiIdr12g6DBUQfLDzYCQJZtR/C8KkcwSGhPHfcFp3tTaGcMyFTq",[gn.PaypalCheckout]:"sha384-lWM1jk4BOxoDNV6Kop7tVNvQgINlmEVz0c/OwM+HNHK3QC8xqwd54Ovrt2QRDTjh",[gn.Paypal]:"sha384-fXUmVxC2EMZBDXZ7eTHSTL/LFBrHej/MSXT/vTBXvra4lzgLNGvREAp+x0GYObuH",[gn.LocalPayment]:"sha384-pha1xGuGSkmZH5x9aqHvRaO4xLea7rmQ/79PFj9zxNzxuFcOWZg7gOP7FibygOEC",[gn.DataCollector]:"sha384-Q6PI2F9eekWbAxhroybl+aEcvqhdowN/EQlGwBUyJOzPFn9982u9xl6SU6XfGKzc",[gn.UsBankAccount]:"sha384-W3RLQSKJL1tQ3+Y7mP6tmkamtZ8bV4Yw/XxL9Jj5JtXHraD8loMF8hAIG5m2zK7F",[gn.GooglePayment]:"sha384-TITQMsFWA3elDNGP2mWz2oKBo4qjt+TlqzovcaPoeBiAh/wPBi6nae50ADdgU1/i",[gn.ThreeDSecure]:"sha384-YiycYN89ZlL/Evcaq4y1ajW1mhd7JYfZBDuOwHtIn4/Jnm20GL+/XCM+zYAwWD8D",[gn.VisaCheckout]:"sha384-/OdaTv9qrkKzjObtUe6yzfDhHozFW/+uXlrSl736sOZRJpjGQETvpYXqMFFg69xv",[gn.Venmo]:"sha384-dA+ojdW9vbJS4JavcXyOs9d5uZHJg5dNtYupoPSH2zsXIiYDVS5amLb/u8qmQ6oz",[gn.HostedFields]:"sha384-31ZkS58+iaWsW06ftW52zzVZFp43WPd7pNYRiddYynSNg6Oh7WGbSFGorAUH6T1z",[gn.Fastlane]:"sha384-jlbrwNvL3HvLAUCtLSmrnQ2GH1udCUrRS/bVmReAS5fuIVvcW8Pko/Gkg82tlgtr"}};var mn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Pn{constructor(e,t,n){this.scriptLoader=e,this.braintreeHostWindow=t,this.braintreeSDKVersionManager=n}loadClient(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.Client,"client.min.js")})}loadFastlane(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.Fastlane,"fastlane.min.js")})}loadPaypalCheckout(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.PaypalCheckout,"paypal-checkout.min.js")})}loadPaypal(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.Paypal,"paypal.min.js")})}loadLocalPayment(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.LocalPayment,"local-payment.min.js")})}loadDataCollector(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.DataCollector,"data-collector.min.js")})}loadUsBankAccount(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.UsBankAccount,"us-bank-account.min.js")})}loadGooglePayment(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.GooglePayment,"google-payment.min.js")})}load3DS(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.ThreeDSecure,"three-d-secure.min.js")})}loadVisaCheckout(){return this.loadBraintreeModuleOrThrow(gn.VisaCheckout,"visa-checkout.min.js")}loadVenmoCheckout(){return this.loadBraintreeModuleOrThrow(gn.Venmo,"venmo.min.js")}loadHostedFields(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.HostedFields,"hosted-fields.min.js")})}loadVisaCheckoutSdk(e){return mn(this,null,function*(){if(this.braintreeHostWindow.V)return this.braintreeHostWindow.V;const t=e?"sha384-0eu1s1GtqzXlL9DtLgmwzC5WWlEH/ADRM0n38cVQkvtT+W/gey96rcb1LwuUOPDm":"sha384-1f1csvP3ZFxg4dILH1GaY4LHlZ0oX7Rk83rxmLlwbnIi4TM0NYzXoev1VoEiVDS6";return this.scriptLoader.loadScript(`//${e?"sandbox-":""}assets.secure.checkout.visa.com/checkout-widget/resources/js/integration/v1/sdk.js`,{async:!0,attributes:{integrity:t,crossorigin:"anonymous"}}).then(()=>{if(!this.braintreeHostWindow.V)throw new h;return this.braintreeHostWindow.V})})}loadBraintreeModuleOrThrow(e,t){return mn(this,null,function*(){let n=this.getBraintreeModule(e);if(n)return n;const r=this.braintreeSDKVersionManager.getSDKVersion(),i=`//js.braintreegateway.com/web/${r}/js/${t}`,o=r in _n?this.getIntegrityValuesByModuleName(e,r):void 0;if(yield this.scriptLoader.loadScript(i,o?{async:!0,attributes:{integrity:o,crossorigin:"anonymous"}}:void 0),n=this.getBraintreeModule(e),!n)throw new h;return n})}getBraintreeModule(e){var t;return null==(t=this.braintreeHostWindow.braintree)?void 0:t[e]}getIntegrityValuesByModuleName(e,t){const n=_n[t][e];if(!n)throw new Error("Unexpected fileName value");return n}}class fn{constructor(e){const t=new Promise((e,t)=>{this.cancel=t});this.promise=Promise.race([e,t])}}var wn=Object.defineProperty,bn=Object.getOwnPropertySymbols,Sn=Object.getPrototypeOf,Cn=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable,In=Reflect.get,On=(e,t,n)=>t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,An=(e,t,n)=>In(Sn(e),n,t),Tn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Mn extends Q{constructor(e,t){super("braintree",e),this._braintreeSdk=t,this._methodId=De.BRAINTREE,this._verificationsInProgress=0,this._service=e}initialize(e,t,n){return Tn(this,null,function*(){yield An(Mn.prototype,this,"initialize").call(this,e,t,n);let r=An(Mn.prototype,this,"getPaymentMethod").call(this);if(r.clientToken||(r=(yield this._service.loadPaymentMethod(this._methodId)).getPaymentMethodOrThrow(this._methodId)),!r.clientToken||!r.initializationData)throw new _(g.MissingPaymentMethod);return this._braintreeSdk.initialize(r.clientToken),this._braintreeGooglePayment=yield this._braintreeSdk.getBraintreeGooglePayment(),Promise.resolve()})}getNonce(e){return Tn(this,null,function*(){var t;const n=yield An(Mn.prototype,this,"getNonce").call(this,e),{clientToken:r,initializationData:i}=An(Mn.prototype,this,"getPaymentMethod").call(this);if(!r||!i||!(null==(t=i.card_information)?void 0:t.bin))throw new _(g.MissingPaymentMethod);const{isThreeDSecureEnabled:o,card_information:{bin:a,isNetworkTokenized:s}}=i;if(o&&!s){const e=yield this._braintreeSdk.getBraintreeThreeDS(),{orderAmount:t}=this._service.getState().getOrderOrThrow();return(yield this._braintreePresent3DSChallenge(e,t,n,a)).nonce}return n})}extraPaymentData(){return Tn(this,null,function*(){return{deviceSessionId:yield this._getBraintreeDeviceData()}})}mapToExternalCheckoutData(e){return Tn(this,null,function*(){const t=yield An(Mn.prototype,this,"mapToExternalCheckoutData").call(this,e);let n;try{n=JSON.parse(t.nonce)}catch(e){throw new S("Unable to parse response from Google Pay.")}return function(e){if(!function(e){return"object"==typeof e&&null!==e&&"androidPayCards"in e}(e))throw new _(g.MissingPaymentToken)}(n),t.nonce=n.androidPayCards[0].nonce,t.card_information.bin=n.androidPayCards[0].details.bin,t.card_information.isNetworkTokenized=n.androidPayCards[0].details.isNetworkTokenized,t})}getCardParameters(){return super.getCardParameters()}getPaymentGatewayParameters(){return Tn(this,null,function*(){return this.getBraintreeGooglePayment().createPaymentDataRequest(((e,t)=>{for(var n in t||(t={}))Cn.call(t,n)&&On(e,n,t[n]);if(bn)for(var n of bn(t))vn.call(t,n)&&On(e,n,t[n]);return e})({merchantInfo:An(Mn.prototype,this,"getMerchantInfo").call(this),transactionInfo:An(Mn.prototype,this,"getTransactionInfo").call(this),cardRequirements:{billingAddressRequired:!0,billingAddressFormat:"FULL"}},yield An(Mn.prototype,this,"getRequiredData").call(this))).paymentMethodTokenizationParameters.parameters})}getBraintreeGooglePayment(){if(!this._braintreeGooglePayment)throw new _(g.MissingPaymentMethod);return this._braintreeGooglePayment}_getBraintreeDeviceData(){return Tn(this,null,function*(){const{deviceData:e}=yield this._braintreeSdk.getDataCollectorOrThrow();return e})}_braintreePresent3DSChallenge(e,t,n,r){return Tn(this,null,function*(){this._verificationsInProgress>0&&(yield this._cancelBraintree3DSVerification(e)),this._verificationsInProgress+=1;const i=new fn(e.verifyCard({amount:t,bin:r,nonce:n,onLookupComplete:(e,t)=>{t()}}));try{return yield i.promise}finally{this._verificationsInProgress-=1}})}_cancelBraintree3DSVerification(e){return Tn(this,null,function*(){try{yield e.cancelVerifyCard()}catch(e){}})}}const kn=y(r=>{const i=t(),o=window,a=new on(r),s=new pn(new Pn(n(),o,a));return new We(r,new _e(Xe(),new Mn(r,s),i,e()))},[{id:"googlepaybraintree"}]),En=["ar_BH","ar_DZ","ar_EG","ar_JO","ar_KW","ar_MA","ar_OM","ar_QA","ar_SA","ar_TN","ar_YE","ar_AE","bg_BG","cs_CZ","da_DK","da_FO","da_GL","de_AT","de_CH","de_DE","de_LU","el_GR","en_AD","en_AE","en_AG","en_AI","en_AL","en_AM","en_AN","en_AO","en_AT","en_AU","en_AW","en_AZ","en_BB","en_BE","en_BH","en_BJ","en_BM","en_BN","en_BS","en_BT","en_BW","en_BY","en_BZ","en_C2","en_CA","en_CD","en_CG","en_CH","en_CI","en_CK","en_CL","en_CM","en_CN","en_CO","en_CR","en_CV","en_CY","en_CZ","en_DE","en_DJ","en_DK","en_DM","en_DO","en_DZ","en_EC","en_EE","en_EG","en_ER","en_ES","en_ET","en_FI","en_FJ","en_FK","en_FM","en_FO","en_FR","en_GA","en_GB","en_GD","en_GE","en_GF","en_GI","en_GL","en_GM","en_GN","en_GP","en_GR","en_GT","en_GW","en_GY","en_HK","en_HN","en_HR","en_HU","en_ID","en_IE","en_IL","en_IN","en_IS","en_IT","en_JM","en_JO","en_JP","en_KE","en_KG","en_KH","en_KI","en_KM","en_KN","en_KR","en_KW","en_KY","en_KZ","en_LA","en_LC","en_LI","en_LK","en_LS","en_LT","en_LU","en_LV","en_MA","en_MC","en_MD","en_ME","en_MG","en_MH","en_MK","en_ML","en_MN","en_MQ","en_MR","en_MS","en_MT","en_MU","en_MV","en_MW","en_MY","en_MZ","en_NA","en_NC","en_NE","en_NF","en_NG","en_NI","en_NL","en_NO","en_NP","en_NR","en_NU","en_NZ","en_OM","en_PA","en_PE","en_PF","en_PG","en_PH","en_PL","en_PM","en_PN","en_PT","en_PW","en_PY","en_QA","en_RE","en_RO","en_RS","en_RU","en_RW","en_SA","en_SB","en_SC","en_SE","en_SG","en_SH","en_SI","en_SJ","en_SK","en_SL","en_SM","en_SN","en_SO","en_SR","en_ST","en_SV","en_SZ","en_TC","en_TD","en_TG","en_TH","en_TJ","en_TM","en_TN","en_TO","en_TR","en_TT","en_TV","en_TW","en_TZ","en_UA","en_UG","en_US","en_UY","en_VA","en_VC","en_VE","en_VG","en_VN","en_VU","en_WF","en_WS","en_YE","en_YT","en_ZA","en_ZM","en_ZW","es_AD","es_AI","es_AO","es_AR","es_AW","es_BB","es_BJ","es_BM","es_BO","es_BS","es_BZ","es_CD","es_CG","es_CK","es_CL","es_CO","es_CR","es_CV","es_DJ","es_DM","es_DO","es_DZ","es_EC","es_EG","es_ER","es_ES","es_ET","es_FJ","es_FK","es_FO","es_GA","es_GD","es_GE","es_GI","es_GL","es_GM","es_GN","es_GT","es_GW","es_GY","es_HN","es_IE","es_JM","es_JO","es_KE","es_KG","es_KI","es_KM","es_KN","es_KW","es_KY","es_KZ","es_LC","es_LI","es_LS","es_LU","es_MA","es_MG","es_MH","es_ML","es_MR","es_MS","es_MU","es_MW","es_MX","es_MZ","es_NA","es_NC","es_NE","es_NF","es_NI","es_NR","es_NU","es_NZ","es_OM","es_PA","es_PE","es_PF","es_PG","es_PM","es_PN","es_PW","es_PY","es_QA","es_RS","es_RW","es_SA","es_SB","es_SC","es_SH","es_SJ","es_SL","es_SM","es_SN","es_SO","es_SR","es_ST","es_SV","es_SZ","es_TC","es_TD","es_TG","es_TJ","es_TM","es_TN","es_TT","es_TV","es_UA","es_UG","es_US","es_UY","es_VA","es_VC","es_VE","es_VG","es_VU","es_WF","es_YE","es_ZM","et_EE","fi_FI","fr_AD","fr_AE","fr_AI","fr_AM","fr_AO","fr_AW","fr_AZ","fr_BB","fr_BE","fr_BF","fr_BI","fr_BJ","fr_BM","fr_BS","fr_BZ","fr_CA","fr_CD","fr_CG","fr_CH","fr_CI","fr_CK","fr_CM","fr_CV","fr_DJ","fr_DM","fr_DO","fr_DZ","fr_EC","fr_ER","fr_ET","fr_FJ","fr_FK","fr_FO","fr_FR","fr_GA","fr_GD","fr_GE","fr_GF","fr_GI","fr_GL","fr_GM","fr_GN","fr_GP","fr_GT","fr_GW","fr_GY","fr_HN","fr_IE","fr_JM","fr_JO","fr_KE","fr_KG","fr_KI","fr_KM","fr_KN","fr_KW","fr_KY","fr_KZ","fr_LC","fr_LI","fr_LS","fr_LU","fr_MA","fr_MC","fr_MG","fr_MH","fr_ML","fr_MQ","fr_MR","fr_MS","fr_MU","fr_MW","fr_MZ","fr_NA","fr_NC","fr_NE","fr_NF","fr_NI","fr_NR","fr_NU","fr_NZ","fr_OM","fr_PA","fr_PE","fr_PF","fr_PG","fr_PM","fr_PN","fr_PW","fr_QA","fr_RE","fr_RS","fr_RW","fr_SA","fr_SB","fr_SC","fr_SH","fr_SJ","fr_SL","fr_SM","fr_SN","fr_SO","fr_SR","fr_ST","fr_SV","fr_SZ","fr_TC","fr_TD","fr_TG","fr_TJ","fr_TM","fr_TN","fr_TT","fr_TV","fr_UA","fr_UG","fr_US","fr_UY","fr_VA","fr_VC","fr_VE","fr_VG","fr_VU","fr_WF","fr_YE","fr_YT","fr_ZA","fr_ZM","he_IL","hu_HU","id_ID","it_IT","ja_JP","ko_KR","lv_LV","lt_LT","ms_BN","ms_MY","nl_BE","nl_NL","pl_PL","pt_BR","pt_PT","ro_RO","ru_EE","ru_LT","ru_LV","ru_RU","ru_UA","si_LK","sk_SK","sl_SI","sq_AL","sv_SE","tl_PH","th_TH","tr_TR","vi_VN","zh_C2","zh_CN","zh_HK","zh_TW","zh_AD","zh_AE","zh_AI","zh_AO","zh_AW","zh_BB","zh_BH","zh_BJ","zh_BM","zh_BS","zh_BZ","zh_CD","zh_CG","zh_CK","zh_CL","zh_CO","zh_CV","zh_DJ","zh_DM","zh_DO","zh_DZ","zh_EC","zh_EG","zh_ER","zh_ET","zh_FJ","zh_FK","zh_FO","zh_GA","zh_GD","zh_GE","zh_GI","zh_GL","zh_GM","zh_GN","zh_GT","zh_GW","zh_GY","zh_HN","zh_IE","zh_JM","zh_JO","zh_KE","zh_KG","zh_KI","zh_KM","zh_KN","zh_KW","zh_KY","zh_KZ","zh_LC","zh_LI","zh_LS","zh_LT","zh_LU","zh_MA","zh_MG","zh_MH","zh_ML","zh_MR","zh_MS","zh_MU","zh_MW","zh_MZ","zh_NA","zh_NC","zh_NE","zh_NF","zh_NI","zh_NR","zh_NU","zh_NZ","zh_OM","zh_PA","zh_PE","zh_PF","zh_PG","zh_PM","zh_PN","zh_PW","zh_QA","zh_RS","zh_RW","zh_SA","zh_SB","zh_SC","zh_SH","zh_SJ","zh_SL","zh_SM","zh_SN","zh_SO","zh_SR","zh_ST","zh_SV","zh_SZ","zh_TC","zh_TD","zh_TG","zh_TJ","zh_TM","zh_TN","zh_TT","zh_TV","zh_UA","zh_UG","zh_US","zh_UY","zh_VA","zh_VC","zh_VE","zh_VG","zh_VU","zh_WF","zh_YE","zh_ZA","zh_ZM"];function Dn(e){if(!e)return;let t;if(e.includes("-")){const[n,r]=e.split("-");t=`${n}_${r.toUpperCase()}`}else t=`${e}_${e.toUpperCase()}`;return En.includes(t)?t:void 0}var Nn=Object.defineProperty,zn=Object.defineProperties,Gn=Object.getOwnPropertyDescriptors,Rn=Object.getOwnPropertySymbols,Bn=Object.prototype.hasOwnProperty,Ln=Object.prototype.propertyIsEnumerable,xn=(e,t,n)=>t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jn=(e,t)=>{for(var n in t||(t={}))Bn.call(t,n)&&xn(e,n,t[n]);if(Rn)for(var n of Rn(t))Ln.call(t,n)&&xn(e,n,t[n]);return e},Fn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Vn{constructor(e){this.scriptLoader=e,this.window=window}getPayPalFastlaneSdk(e,t,n,r){return Fn(this,null,function*(){if(!this.window.paypalFastlaneSdk){const i=this.getPayPalFastlaneSdkConfiguration(e,t,n,r);if(yield this.loadPayPalSdk(i),!this.window.paypalFastlaneSdk)throw new h}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r,i){return Fn(this,null,function*(){if(!this.window.paypalGooglePay||i){const i=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r);yield this.loadPayPalSdk(i)}if(!this.window.paypalGooglePay)throw new h;return this.window.paypalGooglePay})}getPayPalApmsSdk(e,t,n){return Fn(this,null,function*(){if(!this.window.paypalApms){const r=this.getPayPalApmSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.paypalApms)throw new h}return this.window.paypalApms})}getPayPalMessages(e,t,n){return Fn(this,null,function*(){if(!this.window.paypalMessages){const r=this.getPayPalSdkMessagesConfiguration(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalMessages)throw new h;return this.window.paypalMessages})}loadPayPalSdk(e){return Fn(this,arguments,function*({options:e,attributes:t}){const n=this.transformConfig(e),r=this.transformConfig(t),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(e,t,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new _(g.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:l,attributionId:c}=o,d=Dn(r);return{options:jn({"client-id":s,"merchant-id":l,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:t,intent:a},d&&{locale:d}),attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":c,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new _(g.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:l,buyerCountry:c,attributionId:d,isHostedCheckoutEnabled:h,isDeveloperModeApplicable:u}=o,y=h||r,p=Dn(n);return{options:jn(jn({"client-id":s,"merchant-id":l,commit:y,components:["googlepay"],currency:t,intent:a},u&&{"buyer-country":c}),p&&{locale:p}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new _(g.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:s,attributionId:l,isDeveloperModeApplicable:c,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:h=[]}=r,u=h,y=d.filter(e=>!h.includes(e)),p=Dn(n);return{options:jn(jn({"client-id":o,"merchant-id":a,"enable-funding":u.length>0?u:void 0,"disable-funding":y.length>0?y:void 0,commit:!0,components:["buttons","payment-fields"],currency:t,intent:i},c&&{"buyer-country":s}),p&&{locale:p}),attributes:{"data-partner-attribution-id":l,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new _(g.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:s,buyerCountry:l}=r,c=Dn(n);return{options:jn(jn({"client-id":i,"merchant-id":o,components:["messages"],currency:t},s&&{"buyer-country":l}),c&&{locale:c}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":a}}}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];var i,o;null==r||""===r||Array.isArray(r)&&0===r.length||(i=jn({},t),o={[n]:Array.isArray(r)?r.join(","):r},t=zn(i,Gn(o)))}),t}}function Un(e){if(!function(e){return!!e.initializationData&&"attributionId"in e.initializationData&&"isVenmoEnabled"in e.initializationData&&"isGooglePayEnabled"in e.initializationData&&"isPayPalCreditAvailable"in e.initializationData}(e))throw new _(g.MissingPaymentMethod)}var Wn=Object.getPrototypeOf,Hn=Reflect.get,qn=(e,t,n)=>Hn(Wn(e),n,t),Kn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Zn extends Q{constructor(e,t){super("paypalsb",e),this.payPalCommerceSdk=t,this.service=e}initialize(e,t,n){return Kn(this,null,function*(){var r,i,o,a,s;const l=this.service.getState(),c=null!=(i=null==(r=l.getStoreConfig())?void 0:r.currency.code)?i:n;if(!c)throw new _(g.MissingPaymentMethod);yield qn(Zn.prototype,this,"initialize").call(this,e,t,c);const d=qn(Zn.prototype,this,"getPaymentMethod").call(this);if(!d.initializationData)throw new _(g.MissingPaymentMethod);Un(d);const h=yield this.payPalCommerceSdk.getPayPalGooglePaySdk(d,c,l.getLocale());this.googlepayConfig=yield h.Googlepay().config();const{allowedPaymentMethods:u}=this.googlepayConfig;this.setGatewayIdentifier(null==(s=null==(a=null==(o=u[0])?void 0:o.tokenizationSpecification)?void 0:a.parameters)?void 0:s.gateway)})}getPaymentGatewayParameters(){if(this.googlepayConfig){const{allowedPaymentMethods:e}=this.googlepayConfig,{gatewayMerchantId:t}=e[0].tokenizationSpecification.parameters;return{gateway:this.getGatewayIdentifier(),gatewayMerchantId:t}}return{gateway:this.getGatewayIdentifier()}}mapToExternalCheckoutData(e){return Kn(this,null,function*(){const t=yield qn(Zn.prototype,this,"mapToExternalCheckoutData").call(this,e);return t.nonce=btoa(t.nonce),t})}}const Jn="This API endpoint is for internal use only and may change in the future";var Yn=Object.defineProperty,Xn=Object.getOwnPropertySymbols,Qn=Object.prototype.hasOwnProperty,$n=Object.prototype.propertyIsEnumerable,er=(e,t,n)=>t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function tr(e){const t=e.getState().getBillingAddress();if(!t)return;const{firstName:n,lastName:r,address1:i,address2:o,city:a,stateOrProvinceCode:s,countryCode:l,postalCode:c,phone:d}=t,h=`${n} ${r}`.trim();return h&&l?((e,t)=>{for(var n in t||(t={}))Qn.call(t,n)&&er(e,n,t[n]);if(Xn)for(var n of Xn(t))$n.call(t,n)&&er(e,n,t[n]);return e})({name:h,address1:i,address2:o,address3:"",locality:a,administrativeArea:s,countryCode:l,postalCode:c,sortingCode:""},d&&{phoneNumber:d}):void 0}var nr=(e=>(e.Approved="APPROVED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e))(nr||{}),rr=Object.defineProperty,ir=Object.getOwnPropertySymbols,or=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable,sr=(e,t,n)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lr=(e,t)=>{for(var n in t||(t={}))or.call(t,n)&&sr(e,n,t[n]);if(ir)for(var n of ir(t))ar.call(t,n)&&sr(e,n,t[n]);return e},cr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class dr extends We{constructor(e,t,n,r){super(e,t),this._payPalCommerceSdk=n,this._requestSender=r}execute(e){return cr(this,arguments,function*({payment:e}){if(!(null==e?void 0:e.methodId))throw new me(["payment"]);const t=this._paymentIntegrationService.getState(),n=t.getCartOrThrow().id,{initializationData:r}=t.getPaymentMethodOrThrow(this._getMethodId()),{orderId:i}=yield this.getOrderId(n),{card_information:o}=r||{},a=yield this._googlePayPaymentProcessor.getNonce(e.methodId),s={tokenizationData:{type:"PAYMENT_GATEWAY",token:atob(a)},info:{cardNetwork:(null==o?void 0:o.type)||"",cardDetails:(null==o?void 0:o.number)||""},type:"CARD"};yield this.confirmOrder(i,s),yield this._paymentIntegrationService.submitOrder();try{const t={formattedPayload:{method_id:e.methodId,paypal_account:{order_id:i}}};yield this._paymentIntegrationService.submitPayment({methodId:e.methodId,paymentData:t})}catch(t){yield this._handleSubmitPaymentFailure(t,e.methodId)}})}finalize(){return Promise.reject(new Pe)}confirmOrder(e,t){return cr(this,null,function*(){const n=this._paymentIntegrationService.getState(),r=n.getPaymentMethodOrThrow(this._getMethodId());if(!r.initializationData)throw new _(g.MissingPaymentMethod);const i=n.getCartOrThrow().currency.code,o=yield this._payPalCommerceSdk.getPayPalGooglePaySdk(r,i,n.getLocale(),!0),a=tr(this._paymentIntegrationService),{status:s}=yield o.Googlepay().confirmOrder(lr({orderId:e,paymentMethodData:t},a&&{billingAddress:a}));if(s===nr.PayerActionRequired)return yield o.Googlepay().initiatePayerAction({orderId:e}),Promise.resolve();if(s!==nr.Approved)throw new S("Payment is not approved.");return Promise.resolve()})}getOrderId(e){return cr(this,null,function*(){const t={cartId:e,shouldSaveInstrument:!1},{body:n}=yield this._requestSender.post("/api/storefront/payments/googlepaypaypalcommercecheckout",{headers:lr({"X-API-INTERNAL":Jn,"Content-Type":Pt.Json},ie),body:t});return n})}}const hr=y(r=>{const i=new Vn(n());return new dr(r,new _e(Xe(),new Zn(r,i),t(),e()),i,t())},[{id:"googlepaypaypalcommerce"}]);var ur=Object.defineProperty,yr=Object.defineProperties,pr=Object.getOwnPropertyDescriptors,gr=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,Pr=(e,t,n)=>t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fr=(e,t)=>{for(var n in t||(t={}))_r.call(t,n)&&Pr(e,n,t[n]);if(gr)for(var n of gr(t))mr.call(t,n)&&Pr(e,n,t[n]);return e},wr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class br{constructor(e){this.scriptLoader=e,this.window=window}getPayPalFastlaneSdk(e,t,n){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.bigCommercePaymentsFastlaneSdk)throw new h}return this.window.bigCommercePaymentsFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.bigCommercePaymentsGooglePay)throw new h;return this.window.bigCommercePaymentsGooglePay})}getPayPalApmsSdk(e,t){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsApms){const n=this.getPayPalApmSdkConfiguration(e,t);if(yield this.loadPayPalSdk(n),!this.window.bigCommercePaymentsApms)throw new h}return this.window.bigCommercePaymentsApms})}getPayPalMessages(e,t){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsMessages){const n=this.getPayPalSdkMessagesConfiguration(e,t);yield this.loadPayPalSdk(n)}if(!this.window.bigCommercePaymentsMessages)throw new h;return this.window.bigCommercePaymentsMessages})}loadPayPalSdk(e){return wr(this,arguments,function*({options:e,attributes:t}){const n=this.transformConfig(e),r=this.transformConfig(t),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(e,t,n){const{clientToken:r,initializationData:i}=e;if(!i||!i.clientId)throw new _(g.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:s,attributionId:l}=i;return{options:{"client-id":a,"merchant-id":s,commit:!0,components:["fastlane","three-domain-secure"],currency:t,intent:o},attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"bigCommercePaymentsFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":r}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n=!0){const{clientToken:r,initializationData:i}=e;if(!i||!i.clientId)throw new _(g.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:s,buyerCountry:l,attributionId:c,isHostedCheckoutEnabled:d,isDeveloperModeApplicable:h}=i;return{options:fr({"client-id":a,"merchant-id":s,commit:d||n,components:["googlepay"],currency:t,intent:o},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":c,"data-client-token":r,"data-namespace":"bigCommercePaymentsGooglePay"}}}getPayPalApmSdkConfiguration(e,t){const{initializationData:n}=e;if(!n||!n.clientId)throw new _(g.MissingPaymentMethod);const{intent:r,clientId:i,merchantId:o,buyerCountry:a,attributionId:s,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:c=[],enabledAlternativePaymentMethods:d=[]}=n,h=this.filterFundingOptions(d),u=this.filterFundingOptions(c.filter(e=>!d.includes(e)));return{options:fr({"client-id":i,"merchant-id":o,"enable-funding":h.length>0?h:void 0,"disable-funding":u.length>0?u:void 0,commit:!0,components:["buttons","payment-fields"],currency:t,intent:r},l&&{"buyer-country":a}),attributes:{"data-partner-attribution-id":s,"data-namespace":"bigCommercePaymentsApms"}}}getPayPalSdkMessagesConfiguration(e,t){const{initializationData:n}=e;if(!n||!n.clientId)throw new _(g.MissingPaymentMethod);const{clientId:r,merchantId:i,attributionId:o,isDeveloperModeApplicable:a,buyerCountry:s}=n;return{options:fr({"client-id":r,"merchant-id":i,components:["messages"],currency:t},a&&{"buyer-country":s}),attributes:{"data-namespace":"bigCommercePaymentsMessages","data-partner-attribution-id":o}}}filterFundingOptions(e){const t=["klarna","afterpay"];return e?e.filter(e=>!t.includes(e)):[]}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];var i,o;null==r||""===r||Array.isArray(r)&&0===r.length||(i=fr({},t),o={[n]:Array.isArray(r)?r.join(","):r},t=yr(i,pr(o)))}),t}}var Sr=Object.getPrototypeOf,Cr=Reflect.get,vr=(e,t,n)=>Cr(Sr(e),n,t),Ir=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Or extends Q{constructor(e,t){super("googlepay_bigcommerce_payments",e),this.payPalSdkHelper=t,this.service=e}initialize(e,t,n){return Ir(this,null,function*(){var r,i,o,a,s;const l=null!=(i=null==(r=this.service.getState().getStoreConfig())?void 0:r.currency.code)?i:n;if(!l)throw new _(g.MissingPaymentMethod);yield vr(Or.prototype,this,"initialize").call(this,e,t,l);const c=vr(Or.prototype,this,"getPaymentMethod").call(this);if(!c.initializationData)throw new _(g.MissingPaymentMethod);Un(c);const d=yield this.payPalSdkHelper.getPayPalGooglePaySdk(c,l);this.googlepayConfig=yield d.Googlepay().config();const{allowedPaymentMethods:h}=this.googlepayConfig;this.setGatewayIdentifier(null==(s=null==(a=null==(o=h[0])?void 0:o.tokenizationSpecification)?void 0:a.parameters)?void 0:s.gateway)})}getPaymentGatewayParameters(){if(this.googlepayConfig){const{allowedPaymentMethods:e}=this.googlepayConfig,{gatewayMerchantId:t}=e[0].tokenizationSpecification.parameters;return{gateway:this.getGatewayIdentifier(),gatewayMerchantId:t}}return{gateway:this.getGatewayIdentifier()}}mapToExternalCheckoutData(e){return Ir(this,null,function*(){const t=yield vr(Or.prototype,this,"mapToExternalCheckoutData").call(this,e);return t.nonce=btoa(t.nonce),t})}}var Ar=(e=>(e.Approved="APPROVED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e))(Ar||{}),Tr=Object.defineProperty,Mr=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,Er=Object.prototype.propertyIsEnumerable,Dr=(e,t,n)=>t in e?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t)=>{for(var n in t||(t={}))kr.call(t,n)&&Dr(e,n,t[n]);if(Mr)for(var n of Mr(t))Er.call(t,n)&&Dr(e,n,t[n]);return e},zr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Gr extends We{constructor(e,t,n,r){super(e,t),this._payPalSdkHelper=n,this._requestSender=r}execute(e){return zr(this,arguments,function*({payment:e}){if(!(null==e?void 0:e.methodId))throw new me(["payment"]);const t=this._paymentIntegrationService.getState(),n=t.getCartOrThrow().id,{initializationData:r}=t.getPaymentMethodOrThrow(this._getMethodId()),{orderId:i}=yield this.getOrderId(n),{card_information:o}=r||{},a=yield this._googlePayPaymentProcessor.getNonce(e.methodId),s={tokenizationData:{type:"PAYMENT_GATEWAY",token:atob(a)},info:{cardNetwork:(null==o?void 0:o.type)||"",cardDetails:(null==o?void 0:o.number)||""},type:"CARD"};yield this.confirmOrder(i,s),yield this._paymentIntegrationService.submitOrder();try{const t={formattedPayload:{method_id:e.methodId,paypal_account:{order_id:i}}};yield this._paymentIntegrationService.submitPayment({methodId:e.methodId,paymentData:t})}catch(t){yield this._handleSubmitPaymentFailure(t,e.methodId)}})}finalize(){return Promise.reject(new Pe)}confirmOrder(e,t){return zr(this,null,function*(){const n=this._paymentIntegrationService.getState(),r=n.getPaymentMethodOrThrow(this._getMethodId());if(!r.initializationData)throw new _(g.MissingPaymentMethod);const i=n.getCartOrThrow().currency.code,o=yield this._payPalSdkHelper.getPayPalGooglePaySdk(r,i,!0),a=tr(this._paymentIntegrationService),{status:s}=yield o.Googlepay().confirmOrder(Nr({orderId:e,paymentMethodData:t},a&&{billingAddress:a}));if(s===Ar.PayerActionRequired)return yield o.Googlepay().initiatePayerAction({orderId:e}),Promise.resolve();if(s!==Ar.Approved)throw new S("Payment is not approved.");return Promise.resolve()})}getOrderId(e){return zr(this,null,function*(){const t={cartId:e,shouldSaveInstrument:!1},{body:n}=yield this._requestSender.post("/api/storefront/payments/googlepay_bigcommerce_paymentscheckout",{headers:Nr({"X-API-INTERNAL":Jn,"Content-Type":Pt.Json},ie),body:t});return n})}}const Rr=y(r=>{const i=new br(n());return new Gr(r,new _e(Xe(),new Or(r,i),t(),e()),i,t())},[{id:"googlepay_bigcommerce_payments"}]);var Br=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Lr extends Q{constructor(e,t){super("worldlinena",e),this.formPoster=t}extraPaymentData(){return Br(this,null,function*(){return Promise.resolve({browser_info:m()})})}processAdditionalAction(e){return Br(this,null,function*(){if(!function(e){return P(e)&&(t=e.body,s(t)&&"object"==typeof t&&"errors"in t&&"three_ds_result"in t&&a(t.errors)&&c(t.errors,{code:"three_d_secure_required"}));var t}(e))throw e;const{three_ds_result:t}=e.body,{acs_url:n,payer_auth_request:r,merchant_data:i}=t||{};if(!n||!r||!i)throw new me(["formUrl","threeDSSessionData","creq"]);return new Promise(e=>{this.formPoster.postForm(n,{threeDSSessionData:r,creq:i},e,"_top")})})}}const xr=y(n=>new We(n,new _e(Xe(),new Lr(n,e()),t(),e())),[{id:"googlepaytdonlinemart"}]);class jr extends d{constructor(e){super(e||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var Fr=Object.defineProperty,Vr=Object.defineProperties,Ur=Object.getOwnPropertyDescriptors,Wr=Object.getOwnPropertySymbols,Hr=Object.prototype.hasOwnProperty,qr=Object.prototype.propertyIsEnumerable,Kr=(e,t,n)=>t in e?Fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zr=(e,t)=>{for(var n in t||(t={}))Hr.call(t,n)&&Kr(e,n,t[n]);if(Wr)for(var n of Wr(t))qr.call(t,n)&&Kr(e,n,t[n]);return e},Jr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Yr{constructor(e,t){this._paymentIntegrationService=e,this._googlePayPaymentProcessor=t}initialize(e){return Jr(this,null,function*(){var t,n;if(!(null==e?void 0:e.methodId)||!Ne(e.methodId))throw new S('Unable to proceed because "methodId" is not a valid key.');this._methodId=e.methodId;const r=e[this._getMethodId()];if(!r)throw new S("Unable to proceed without valid options.");let i,o=this._paymentIntegrationService.getState();try{i=o.getPaymentMethodOrThrow(this._getMethodId())}catch(e){o=yield this._paymentIntegrationService.loadPaymentMethod(this._getMethodId()),i=o.getPaymentMethodOrThrow(this._getMethodId())}try{this._googlePayPaymentProcessor.setIsWebViewExperimentOn(!!(null==(t=i.initializationData)?void 0:t.isWebViewExperimentOn)),this._googlePayPaymentProcessor.setFilterAvailableShippingOptions(r.filterAvailableShippingOptions),yield this._googlePayPaymentProcessor.initialize(()=>i,this._getGooglePayClientOptions(null==(n=i.initializationData)?void 0:n.storeCountry))}catch(e){return}this._addPaymentButton(r)})}signIn(){return Promise.reject(new jr('In order to sign in via Google Pay, the shopper must click on "Google Pay" button.'))}signOut(){return Jr(this,null,function*(){var e;const t=null==(e=this._paymentIntegrationService.getState().getPaymentId())?void 0:e.providerId;t&&(yield this._googlePayPaymentProcessor.signOut(t))})}executePaymentMethodCheckout(e){var t;return null==(t=null==e?void 0:e.continueWithCheckoutCallback)||t.call(e),Promise.resolve()}deinitialize(){var e;return null==(e=this._paymentButton)||e.remove(),this._paymentButton=void 0,this._methodId=void 0,Promise.resolve()}_getGooglePayClientOptions(e){return this._googlePayPaymentProcessor.isWebViewWithRestrictions()?{}:{paymentDataCallbacks:{onPaymentDataChanged:t=>Jr(this,[t],function*({callbackTrigger:t,shippingAddress:n,shippingOptionData:r,offerData:i}){const{availableTriggers:o,addressChangeTriggers:a,shippingOptionsChangeTriggers:s,offerChangeTriggers:l}=this._googlePayPaymentProcessor.getCallbackTriggers();if(!o.includes(t))return;const c=a.includes(t)?yield this._googlePayPaymentProcessor.handleShippingAddressChange(n):void 0;s.includes(t)&&(yield this._googlePayPaymentProcessor.handleShippingOptionChange(r.id));const{newOfferInfo:d,error:h}=l.includes(t)?yield this._googlePayPaymentProcessor.handleCoupons(i):{},u=h;yield this._paymentIntegrationService.loadCheckout();const y=this._googlePayPaymentProcessor.getTotalPrice(),{code:p}=this._paymentIntegrationService.getState().getCartOrThrow().currency;return Zr(Zr(Zr({newTransactionInfo:(g=Zr({},e&&{countryCode:e}),_={currencyCode:p,totalPriceStatus:R.FINAL,totalPrice:y},Vr(g,Ur(_)))},c&&{newShippingOptionParameters:c}),d&&{newOfferInfo:d}),u&&{error:u});var g,_})}}}_addPaymentButton({container:e,buttonColor:t,buttonType:n,onClick:r,onError:i}){var o;this._paymentButton=null!=(o=this._paymentButton)?o:this._googlePayPaymentProcessor.addPaymentButton(e,{buttonColor:null!=t?t:"default",buttonType:null!=n?n:"plain",onClick:this._handleClick(i,r)})}_handleClick(e,t){return n=>Jr(this,null,function*(){n.preventDefault(),t&&"function"==typeof t&&t();try{yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheet()}catch(t){let n=t;if(Ee(t)){if("CANCELED"===t.statusCode)throw new f;n=new oe(JSON.stringify(t))}throw null==e||e(new oe("An error occurred while requesting your Google Pay payment details.")),n}})}_interactWithPaymentSheet(){return Jr(this,null,function*(){const e=yield this._googlePayPaymentProcessor.showPaymentSheet(),t=this._googlePayPaymentProcessor.mapToBillingAddressRequestBody(e),n=this._googlePayPaymentProcessor.mapToShippingAddressRequestBody(e),r="/embedded-checkout"===window.location.pathname?this._paymentIntegrationService.getState().getStoreConfigOrThrow().links.siteLink:void 0;t&&(yield this._paymentIntegrationService.updateBillingAddress(t)),n&&(yield this._paymentIntegrationService.updateShippingAddress(n)),yield this._googlePayPaymentProcessor.setExternalCheckoutForm(this._getMethodId(),e,r)})}_getMethodId(){return N(this._methodId,()=>new b(w.PaymentNotInitialized))}}const Xr=y(n=>{const r=t();return new Yr(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv2"}]),Qr=y(n=>{const r=t();return new Yr(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv3"}]),$r=y(n=>new Yr(n,new _e(Xe(),new gt(n),t(),e())),[{id:"googlepayauthorizenet"}]),ei=y(n=>{const r=t();return new Yr(n,new _e(Xe(),new Ct(n,r),r,e()))},[{id:"googlepaycheckoutcom"}]),ti=y(n=>new Yr(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaycybersourcev2"}]),ni=y(n=>new Yr(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaybnz"}]),ri=y(n=>new Yr(n,new _e(Xe(),new Et(n),t(),e())),[{id:"googlepayorbital"}]),ii=y(r=>new Yr(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripe"},{id:"googlepaystripeocs"}]),oi=y(r=>new Yr(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripeupe"}]),ai=y(n=>new Yr(n,new _e(Xe(),new $t(n),t(),e())),[{id:"googlepayworldpayaccess"}]),si=y(r=>{const i=t(),o=window,a=new on(r),s=new pn(new Pn(n(),o,a));return new Yr(r,new _e(Xe(),new Mn(r,s),i,e()))},[{id:"googlepaybraintree"}]),li=y(r=>new Yr(r,new _e(Xe(),new Zn(r,new Vn(n())),t(),e())),[{id:"googlepaypaypalcommerce"}]),ci=y(r=>new Yr(r,new _e(Xe(),new Or(r,new br(n())),t(),e())),[{id:"googlepay_bigcommerce_payments"}]),di=y(n=>new Yr(n,new _e(Xe(),new Lr(n,e()),t(),e())),[{id:"googlepaytdonlinemart"}]);class hi extends d{constructor(e){super(e||"An unexpected error has occurred during buy now cart creation process. Please try again later."),this.name="BuyNowCartCreationError",this.type="buy_now_cart_creation_error"}}var ui=Object.defineProperty,yi=Object.defineProperties,pi=Object.getOwnPropertyDescriptors,gi=Object.getOwnPropertySymbols,_i=Object.prototype.hasOwnProperty,mi=Object.prototype.propertyIsEnumerable,Pi=(e,t,n)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fi=(e,t)=>{for(var n in t||(t={}))_i.call(t,n)&&Pi(e,n,t[n]);if(gi)for(var n of gi(t))mi.call(t,n)&&Pi(e,n,t[n]);return e},wi=(e,t)=>yi(e,pi(t)),bi=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Si{constructor(e,t){this._paymentIntegrationService=e,this._googlePayPaymentProcessor=t}initialize(e){return bi(this,null,function*(){var t,n,r;if(!e.methodId||!Ne(e.methodId))throw new S('Unable to proceed because "methodId" is not a valid key.');if(this._methodId=e.methodId,!e.containerId)throw new S('Unable to proceed because "containerId" is not a valid key.');const i=e[this._getMethodOrThrow()];if(!i)throw new S("Unable to proceed without valid options.");const{buyNowInitializeOptions:o,currencyCode:a,buttonColor:s,buttonType:l,onError:c,filterAvailableShippingOptions:d}=i;let h,u=this._paymentIntegrationService.getState();try{h=u.getPaymentMethodOrThrow(this._getMethodOrThrow())}catch(e){u=yield this._paymentIntegrationService.loadPaymentMethod(this._getMethodOrThrow()),h=u.getPaymentMethodOrThrow(this._getMethodOrThrow())}if(this._countryCode=null==(t=h.initializationData)?void 0:t.storeCountry,this._googlePayPaymentProcessor.setIsWebViewExperimentOn(!!(null==(n=h.initializationData)?void 0:n.isWebViewExperimentOn)),this._googlePayPaymentProcessor.setFilterAvailableShippingOptions(d),o){if(!a)throw new S('Unable to initialize payment because "options.currencyCode" argument is not provided.');this._currencyCode=a,this._buyNowInitializeOptions=o,yield this._googlePayPaymentProcessor.initialize(()=>h,this._getGooglePayClientOptions(),!!o,a)}else yield this._paymentIntegrationService.loadDefaultCheckout(),yield this._googlePayPaymentProcessor.initialize(()=>h,this._getGooglePayClientOptions());this._paymentButton=null!=(r=this._paymentButton)?r:this._googlePayPaymentProcessor.addPaymentButton(e.containerId,{buttonColor:null!=s?s:"default",buttonType:null!=l?l:"plain",onClick:this._handleClick(c)})})}deinitialize(){var e;return null==(e=this._paymentButton)||e.remove(),this._paymentButton=void 0,this._methodId=void 0,Promise.resolve()}_handleClick(e){return t=>bi(this,null,function*(){t.preventDefault();try{this._buyNowInitializeOptions?yield this._createBuyNowCartOrThrow(this._buyNowInitializeOptions):yield this._paymentIntegrationService.loadDefaultCheckout(),yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheet()}catch(t){let n=t;if(Ee(t)){if("CANCELED"===t.statusCode)throw new f;n=new oe(JSON.stringify(t))}throw null==e||e(new oe("An error occurred while requesting your Google Pay payment details.")),n}})}_interactWithPaymentSheet(){return bi(this,null,function*(){var e;const t=yield this._googlePayPaymentProcessor.showPaymentSheet(),n=this._googlePayPaymentProcessor.mapToBillingAddressRequestBody(t),r=this._googlePayPaymentProcessor.mapToShippingAddressRequestBody(t),i="/embedded-checkout"===window.location.pathname?this._paymentIntegrationService.getState().getStoreConfigOrThrow().links.siteLink:void 0;n&&(yield this._paymentIntegrationService.updateBillingAddress(n)),r&&!(null==(e=this._buyNowCart)?void 0:e.lineItems.digitalItems.length)&&(yield this._paymentIntegrationService.updateShippingAddress(r)),yield this._googlePayPaymentProcessor.setExternalCheckoutForm(this._getMethodOrThrow(),t,i)})}_getGooglePayClientOptions(){return this._googlePayPaymentProcessor.isWebViewWithRestrictions()?{}:{paymentDataCallbacks:{onPaymentDataChanged:e=>bi(this,[e],function*({callbackTrigger:e,shippingAddress:t,shippingOptionData:n,offerData:r}){const{availableTriggers:i,addressChangeTriggers:o,shippingOptionsChangeTriggers:a,offerChangeTriggers:s}=this._googlePayPaymentProcessor.getCallbackTriggers();if(!i.includes(e))return;const l=o.includes(e)?yield this._googlePayPaymentProcessor.handleShippingAddressChange(t):void 0;a.includes(e)&&(yield this._googlePayPaymentProcessor.handleShippingOptionChange(n.id));const{newOfferInfo:c,error:d}=s.includes(e)?yield this._googlePayPaymentProcessor.handleCoupons(r):{},h=d;return this._buyNowInitializeOptions?this._getBuyNowTransactionInfo(l,c,h):this._getTransactionInfo(l,c,h)})}}}_createBuyNowCartOrThrow(e){return bi(this,null,function*(){if("function"==typeof(null==e?void 0:e.getBuyNowCartRequestBody)){const t=e.getBuyNowCartRequestBody();try{this._buyNowCart=yield this._paymentIntegrationService.createBuyNowCart(t),yield this._paymentIntegrationService.loadCheckout(this._buyNowCart.id)}catch(e){if("string"==typeof e)throw new hi(e);throw e}}})}_getBuyNowTransactionInfo(e,t,n){if(!this._buyNowCart)return;const{cartAmount:r}=this._buyNowCart,i=this._googlePayPaymentProcessor.getTotalPrice();return fi(fi(fi({newTransactionInfo:wi(fi({},this._countryCode&&{countryCode:this._countryCode}),{currencyCode:this._getCurrencyCodeOrThrow(),totalPrice:i||String(r),totalPriceStatus:R.FINAL})},e&&{newShippingOptionParameters:e}),t&&{newOfferInfo:t}),n&&{error:n})}_getTransactionInfo(e,t,n){return bi(this,null,function*(){yield this._paymentIntegrationService.loadCheckout();const r=this._googlePayPaymentProcessor.getTotalPrice(),{code:i}=this._paymentIntegrationService.getState().getCartOrThrow().currency;return fi(fi(fi({newTransactionInfo:wi(fi({},this._countryCode&&{countryCode:this._countryCode}),{currencyCode:i,totalPriceStatus:R.FINAL,totalPrice:r})},e&&{newShippingOptionParameters:e}),t&&{newOfferInfo:t}),n&&{error:n})})}_getMethodOrThrow(){return N(this._methodId,()=>new b(w.PaymentNotInitialized))}_getCurrencyCodeOrThrow(){return N(this._currencyCode,()=>new S('Unable to initialize payment because "options.currencyCode" argument is not provided.'))}}const Ci=y(r=>{const i=t(),o=window,a=new on(r),s=new pn(new Pn(n(),o,a));return new Si(r,new _e(Xe(),new Mn(r,s),i,e()))},[{id:"googlepaybraintree"}]),vi=y(r=>new Si(r,new _e(Xe(),new Zn(r,new Vn(n())),t(),e())),[{id:"googlepaypaypalcommerce"}]),Ii=y(r=>new Si(r,new _e(Xe(),new Or(r,new br(n())),t(),e())),[{id:"googlepay_bigcommerce_payments"}]),Oi=y(n=>{const r=t();return new Si(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv2"}]),Ai=y(n=>{const r=t();return new Si(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv3"}]),Ti=y(n=>new Si(n,new _e(Xe(),new gt(n),t(),e())),[{id:"googlepayauthorizenet"}]),Mi=y(n=>{const r=t();return new Si(n,new _e(Xe(),new Ct(n,r),r,e()))},[{id:"googlepaycheckoutcom"}]),ki=y(n=>new Si(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaycybersourcev2"},{id:"googlepaybnz"}]),Ei=y(n=>new Si(n,new _e(Xe(),new Et(n),t(),e())),[{id:"googlepayorbital"}]),Di=y(r=>new Si(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripe"},{id:"googlepaystripeupe"},{id:"googlepaystripeocs"}]),Ni=y(n=>new Si(n,new _e(Xe(),new $t(n),t(),e())),[{id:"googlepayworldpayaccess"}]),zi=y(n=>new Si(n,new _e(Xe(),new Lr(n,e()),t(),e())),[{id:"googlepaytdonlinemart"}]);export{Oi as createGooglePayAdyenV2ButtonStrategy,Xr as createGooglePayAdyenV2CustomerStrategy,Qe as createGooglePayAdyenV2PaymentStrategy,Ai as createGooglePayAdyenV3ButtonStrategy,Qr as createGooglePayAdyenV3CustomerStrategy,ut as createGooglePayAdyenV3PaymentStrategy,Ti as createGooglePayAuthorizeDotNetButtonStrategy,$r as createGooglePayAuthorizeDotNetCustomerStrategy,_t as createGooglePayAuthorizeNetPaymentStrategy,Ii as createGooglePayBigCommercePaymentsButtonStrategy,ci as createGooglePayBigCommercePaymentsCustomerStrategy,Rr as createGooglePayBigCommercePaymentsPaymentStrategy,ni as createGooglePayBnzCustomerStrategy,Ci as createGooglePayBraintreeButtonStrategy,si as createGooglePayBraintreeCustomerStrategy,kn as createGooglePayBraintreePaymentStrategy,Mi as createGooglePayCheckoutComButtonStrategy,ei as createGooglePayCheckoutComCustomerStrategy,vt as createGooglePayCheckoutComPaymentStrategy,ki as createGooglePayCybersourceButtonStrategy,ti as createGooglePayCybersourceCustomerStrategy,Tt as createGooglePayCybersourcePaymentStrategy,Ei as createGooglePayOrbitalButtonStrategy,ri as createGooglePayOrbitalCustomerStrategy,Dt as createGooglePayOrbitalPaymentStrategy,hr as createGooglePayPPCPPaymentStrategy,vi as createGooglePayPayPalCommerceButtonStrategy,li as createGooglePayPayPalCommerceCustomerStrategy,Di as createGooglePayStripeButtonStrategy,ii as createGooglePayStripeCustomerStrategy,Yt as createGooglePayStripePaymentStrategy,oi as createGooglePayStripeUpeCustomerStrategy,zi as createGooglePayTdOnlineMartButtonStrategy,di as createGooglePayTdOnlineMartCustomerStrategy,xr as createGooglePayTdOnlineMartPaymentStrategy,Ni as createGooglePayWorldpayAccessButtonStrategy,ai as createGooglePayWorldpayAccessCustomerStrategy,en as createGooglePayWorldpayAccessPaymentStrategy};
|
|
1
|
+
import{createFormPoster as e}from"@bigcommerce/form-poster";import{createRequestSender as t}from"@bigcommerce/request-sender";import{getScriptLoader as n,getStylesheetLoader as r}from"@bigcommerce/script-loader";import{find as i,includes as o,isArray as a,isObject as s,round as l,some as c}from"lodash";class d extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class h extends d{constructor(e){super(e||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}class u{constructor(e,t,n=window){this._scriptLoader=e,this._stylesheetLoader=t,this._window=n}load(e){return t=this,n=function*(){var t,n;if(yield Promise.all([this._stylesheetLoader.loadStylesheet(`https://checkoutshopper-${null!=(t=e.environment)?t:""}.adyen.com/checkoutshopper/sdk/3.10.1/adyen.css`,{prepend:!1,attributes:{integrity:"sha384-8ofgICZZ/k5cC5N7xegqFZOA73H9RQ7H13439JfAZW8Gj3qjuKL2isaTD3GMIhDE",crossorigin:"anonymous"}}),this._scriptLoader.loadScript(`https://checkoutshopper-${null!=(n=e.environment)?n:""}.adyen.com/checkoutshopper/sdk/3.10.1/adyen.js`,{async:!0,attributes:{integrity:"sha384-wG2z9zSQo61EIvyXmiFCo+zB3y0ZB4hsrXVcANmpP8HLthjoQJQPBh7tZKJSV8jA",crossorigin:"anonymous"}})]),!this._window.AdyenCheckout)throw new h;return new this._window.AdyenCheckout(e)},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}function y(e,t){return Object.assign(e,{resolveIds:t})}function p(e){return"object"==typeof e&&null!==e&&"errors"in e&&Array.isArray(e.errors)&&"code"in e.errors[0]&&"string"==typeof e.errors[0].code&&"provider_data"in e&&"object"==typeof e.provider_data}var g=(e=>(e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress",e))(g||{});class _ extends d{constructor(e){super(function(e){switch(e){case 0:return"Unable to proceed because billing address data is unavailable.";case 1:return"Unable to proceed because cart data is unavailable.";case 3:return"Unable to proceed because consignments data is unavailable.";case 2:return"Unable to proceed because checkout data is unavailable.";case 4:return"Unable to proceed because customer data is unavailable.";case 5:case 7:return"Unable to proceed because configuration data is unavailable.";case 6:return"Unable to proceed because order data is unavailable.";case 8:return"Unable to proceed because order ID is unavailable or not generated yet.";case 9:return"Unable to proceed because payment data is unavailable.";case 15:return"Unable to proceed because the token required to submit a payment is missing.";case 12:return"Unable to proceed because payment method data is unavailable or not properly configured.";case 16:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}function m(){const{navigator:e}=window;let t;return t=e.language?e.language:e.userLanguage,{color_depth:window.screen.colorDepth||24,java_enabled:"function"==typeof e.javaEnabled&&e.javaEnabled(),language:t,screen_height:window.screen.height,screen_width:window.screen.width,time_zone_offset:(new Date).getTimezoneOffset().toString()}}const P=e=>"object"==typeof e&&null!==e&&"body"in e;class f extends d{constructor(e){super(e||"Payment process was cancelled."),this.name="PaymentMethodCancelledError",this.type="payment_cancelled"}}var w=(e=>(e[e.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",e[e.CustomerNotInitialized=1]="CustomerNotInitialized",e[e.PaymentNotInitialized=2]="PaymentNotInitialized",e[e.ShippingNotInitialized=3]="ShippingNotInitialized",e[e.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized",e))(w||{});class b extends d{constructor(e){super(function(e){switch(e){case 1:return"Unable to proceed because the customer step of checkout has not been initialized.";case 2:return"Unable to proceed because the payment step of checkout has not been initialized.";case 3:return"Unable to proceed because the shipping step of checkout has not been initialized.";case 4:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(e)),this.subtype=e,this.name="NotInitializedError",this.type="not_initialized"}}class S extends d{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}var C=Object.defineProperty,v=Object.defineProperties,I=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,M=(e,t,n)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function k(e,t,n){if("function"!=typeof n.value)return n;let r=n.value;return{get(){const e=r.bind(this);var i;return Object.defineProperty(this,t,(i=((e,t)=>{for(var n in t||(t={}))A.call(t,n)&&M(e,n,t[n]);if(O)for(var n of O(t))T.call(t,n)&&M(e,n,t[n]);return e})({},n),v(i,I({value:e})))),e},set(e){r=e}}}class E{constructor(e){if(!e)throw new Error("Currency settings missing");const{decimalPlaces:t,symbolLocation:n,symbol:r,thousandsSeparator:i,decimalSeparator:o}=e;if("string"!=typeof n||"string"!=typeof r||"string"!=typeof i||"string"!=typeof o||"string"!=typeof t)throw new S("Invalid currency settings provided");this._decimalPlaces=parseInt(t,10),this._symbolLocation=n,this._symbol=r,this._thousandsSeparator=i,this._decimalSeparator=o}format(e){if("number"!=typeof e)throw new S("Invalid amount provided");const t=this._formatNumber(e),n=this._formatCurrency(t);return e<0?`-${n}`:n}_formatNumber(e){const t=Math.abs(e),[n,r=""]=this._toFixed(t,this._decimalPlaces).split("."),i=n.replace(/\B(?=(\d{3})+(?!\d))/g,this._thousandsSeparator);return this._decimalPlaces<1?i:[i,r].join(this._decimalSeparator)}_formatCurrency(e){return"left"===this._symbolLocation.toLowerCase()?`${this._symbol}${e}`:`${e}${this._symbol}`}_toFixed(e,t){return(+`${Math.round(+`${e}e${t}`)}e${-t}`).toFixed(t)}}Object.defineProperty,Object.getOwnPropertyDescriptor;let D=class{constructor(e){this._storeConfig=e,this._customerFormatter=new E(this._storeConfig.shopperCurrency),this._storeFormatter=new E(this._storeConfig.currency)}toCustomerCurrency(e){const t=this._storeConfig.shopperCurrency.exchangeRate;return this._customerFormatter.format(e*t)}toStoreCurrency(e){return this._storeFormatter.format(e)}};function N(e,t){if(null==e)throw t?t():new Error("An unexpected error has occurred.");return e}D=((e,t)=>{for(var n,r=t,i=e.length-1;i>=0;i--)(n=e[i])&&(r=n(r)||r);return r})([function(e,t,n){return t&&n?k(0,t,n):function(e){const t=class extends e{};return Object.getOwnPropertyNames(e.prototype).forEach(n=>{const r=Object.getOwnPropertyDescriptor(e.prototype,n);r&&"constructor"!==n&&Object.defineProperty(t.prototype,n,k(e.prototype,n,r))}),t}(e)}],D);function z(){if("undefined"==typeof window)return!1;if(function(e){return"ReactNativeWebView"in e}(window))return!0;const e=navigator.userAgent||navigator.vendor||(function(e){return"opera"in e}(window)?window.opera:""),t=/android.+; wv/i.test(e),n=/iPhone|iPod|iPad/i.test(e)&&/AppleWebKit/i.test(e)&&!/Safari/i.test(e);return t||n}function G(e,t,n=!0){var r;return null!=(r=e[t])?r:n}var R=(e=>(e.ESTIMATED="ESTIMATED",e.FINAL="FINAL",e.NOT_CURRENTLY_KNOWN="NOT_CURRENTLY_KNOWN",e))(R||{}),B=(e=>(e.AMEX="AMEX",e.DISCOVER="DISCOVER",e.INTERAC="INTERAC",e.JCB="JCB",e.MC="MASTERCARD",e.VISA="VISA",e))(B||{}),L=(e=>(e.OFFER="OFFER",e.PAYMENT_AUTHORIZATION="PAYMENT_AUTHORIZATION",e.SHIPPING_ADDRESS="SHIPPING_ADDRESS",e.SHIPPING_OPTION="SHIPPING_OPTION",e))(L||{}),x=(e=>(e.OFFER_INVALID="OFFER_INVALID",e.PAYMENT_DATA_INVALID="PAYMENT_DATA_INVALID",e.SHIPPING_ADDRESS_INVALID="SHIPPING_ADDRESS_INVALID",e.SHIPPING_ADDRESS_UNSERVICEABLE="SHIPPING_ADDRESS_UNSERVICEABLE",e.SHIPPING_OPTION_INVALID="SHIPPING_OPTION_INVALID",e.OTHER_ERROR="OTHER_ERROR",e))(x||{}),j=(e=>(e.INITIALIZE="INITIALIZE",e.SHIPPING_OPTION="SHIPPING_OPTION",e.SHIPPING_ADDRESS="SHIPPING_ADDRESS",e.OFFER="OFFER",e))(j||{});function F(e){return e in B}var V=Object.defineProperty,U=Object.defineProperties,W=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,Z=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J=(e,t)=>{for(var n in t||(t={}))q.call(t,n)&&Z(e,n,t[n]);if(H)for(var n of H(t))K.call(t,n)&&Z(e,n,t[n]);return e},Y=(e,t)=>U(e,W(t)),X=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Q{constructor(e,t){this._gatewayIdentifier=e,this._paymentIntegrationService=t,this._isBuyNowFlow=!1,this._shouldRequestShipping=!0,this._isWebViewExperimentOn=null}mapToShippingAddressRequestBody({shippingAddress:e}){if(!e)return;const{company:t="",phone:n=""}=this._paymentIntegrationService.getState().getShippingAddress()||{};return this._mapToAddressRequestBody(e,t,n)}mapToBillingAddressRequestBody(e){const{billingAddress:t}=e.paymentMethodData.info;if(!t)return;const{company:n="",phone:r="",email:i,customFields:o=[]}=this._paymentIntegrationService.getState().getBillingAddress()||{};return Y(J({},this._mapToAddressRequestBody(t,n,r,o)),{email:i||e.email})}mapToExternalCheckoutData(e){var t;const{paymentMethodData:{tokenizationData:{token:n},info:{cardNetwork:r,cardDetails:i}}}=e;if(!n)throw new _(g.MissingPaymentToken);return Promise.resolve(J({nonce:n,card_information:{type:r,number:i}},this._isBuyNowFlow&&{cart_id:null==(t=this._paymentIntegrationService.getState().getCart())?void 0:t.id}))}getRequiredData(){return X(this,null,function*(){var e;const t={emailRequired:!0};if(!this._isShippingAddressRequired())return t;const n=null==(e=(yield this._paymentIntegrationService.loadShippingCountries()).getShippingCountries())?void 0:e.map(e=>e.code);return Y(J({},t),{shippingAddressRequired:!0,shippingAddressParameters:J({phoneNumberRequired:!0},n&&{allowedCountryCodes:n}),shippingOptionRequired:!0})})}getCallbackIntents(){return this._isShippingAddressRequired()?[L.OFFER,L.SHIPPING_ADDRESS,L.SHIPPING_OPTION]:[L.OFFER]}getCallbackTriggers(){return{availableTriggers:[j.INITIALIZE,j.SHIPPING_ADDRESS,j.SHIPPING_OPTION,j.OFFER],initializationTrigger:[j.INITIALIZE],addressChangeTriggers:[j.INITIALIZE,j.SHIPPING_ADDRESS],shippingOptionsChangeTriggers:[j.SHIPPING_OPTION],offerChangeTriggers:[j.OFFER]}}getNonce(e){var t;const n=null==(t=this._paymentIntegrationService.getState().getPaymentMethodOrThrow(e).initializationData)?void 0:t.nonce;if(!n)throw new _(g.MissingPaymentToken);return Promise.resolve(n)}extraPaymentData(){return Promise.resolve(void 0)}getMerchantInfo(){const{googleMerchantName:e,googleMerchantId:t,platformToken:n}=this.getGooglePayInitializationData();return{merchantName:e,merchantId:t,authJwt:n}}getTransactionInfo(){let e;const{getCartOrThrow:t}=this._paymentIntegrationService.getState();e=this._isBuyNowFlow?this._getCurrencyCodeOrThrow():t().currency.code;const n=this.getGooglePayInitializationData().storeCountry;if(this.isWebViewWithRestrictions()){const t=this.getTotalPrice();return Y(J({},n&&{countryCode:n}),{currencyCode:e,totalPrice:t,totalPriceStatus:R.ESTIMATED})}return Y(J({},n&&{countryCode:n}),{currencyCode:e,totalPriceStatus:R.ESTIMATED,totalPrice:"0"})}isWebViewWithRestrictions(){return null!==this._isWebViewExperimentOn?this._isWebViewExperimentOn&&z():z()}setIsWebViewExperimentOn(e){this._isWebViewExperimentOn=e}setFilterAvailableShippingOptions(e){this._filterAvailableShippingOptions=e}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData().gatewayMerchantId;if(!e)throw new S("Unable to proceed, gatewayMerchantId is missing.");return{gateway:this._gatewayIdentifier,gatewayMerchantId:e}}getCardParameters(){return{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:this.getPaymentMethod().supportedCards.filter(F).map(e=>B[e]),billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}}initialize(e,t,n){return this._getPaymentMethodFn=e,this._isBuyNowFlow=Boolean(t),this._currencyCode=n,this._isBuyNowFlow&&this._getCurrencyCodeOrThrow(),Promise.resolve()}handleShippingAddressChange(e){return X(this,null,function*(){var t,n;e&&(e.name=e.name||"",e.address1=e.address1||"");const r=this.mapToShippingAddressRequestBody({shippingAddress:e});r&&(yield this._paymentIntegrationService.updateShippingAddress(r));const i=this._paymentIntegrationService.getState(),o=i.getConsignments();if(!(null==o?void 0:o[0]))return;const a=o[0],s=i.getStoreConfigOrThrow();this._currencyService||(this._currencyService=new D(s));let l=a.availableShippingOptions||[];if("function"==typeof this._filterAvailableShippingOptions)try{l=yield this._filterAvailableShippingOptions(l)}catch(e){console.error("Failed to filter available shipping options:",e)}const c=l.map(this._getGooglePayShippingOption.bind(this)),d=l.find(e=>e.isRecommended),h=l.some(e=>{var t;return e.id===(null==(t=a.selectedShippingOption)?void 0:t.id)})?null==(t=a.selectedShippingOption)?void 0:t.id:void 0;if(c.length){const e=h||(null==d?void 0:d.id)||(null==(n=c[0])?void 0:n.id);return!h&&c[0]&&(yield this.handleShippingOptionChange((null==d?void 0:d.id)||c[0].id)),{defaultSelectedOptionId:e,shippingOptions:c}}})}handleShippingOptionChange(e){return X(this,null,function*(){if("shipping_option_unselected"!==e)return this._paymentIntegrationService.selectShippingOption(e)})}getTotalPrice(){const{getCheckoutOrThrow:e,getCartOrThrow:t,getStoreConfigOrThrow:n}=this._paymentIntegrationService.getState(),{decimalPlaces:r}=t().currency,i=G(n().checkoutSettings.features,"PI-5075.google_pay_round_total_price_to_max_2_decimal_places")?Math.min(r,2):r;return l(e().outstandingBalance,i).toFixed(i)}handleCoupons(e){return X(this,null,function*(){const{redemptionCodes:t=[]}=e,{offers:n}=this.getAppliedCoupons()||{};let r;return yield t.reduce((e,t)=>X(this,null,function*(){if(yield e,(n||[]).some(({redemptionCode:e})=>e===t))return;const i=yield this.applyCoupon(t);i&&(r=i)}),Promise.resolve()),yield(n||[]).reduce((e,n)=>X(this,null,function*(){yield e,t.includes(n.redemptionCode)||(yield this._paymentIntegrationService.removeCoupon(n.redemptionCode))}),Promise.resolve()),{newOfferInfo:this.getAppliedCoupons(),error:r}})}getAppliedCoupons(){const e=this._paymentIntegrationService.getState(),{coupons:t}=e.getCheckout()||{};return{offers:(t||[]).map(e=>{const{displayName:t,code:n}=e;return{redemptionCode:n,description:t}})}}applyCoupon(e){return X(this,null,function*(){let t;try{yield this._paymentIntegrationService.applyCoupon(e)}catch(e){return e instanceof Error&&(t={reason:x.OFFER_INVALID,message:e.message,intent:j.OFFER}),t}})}setShouldRequestShipping(e){this._shouldRequestShipping=e}getGooglePayInitializationData(){return N(this.getPaymentMethod().initializationData,()=>new S("Missing initialization data."))}getPaymentMethod(){return N(this._getPaymentMethodFn,()=>new b(w.PaymentNotInitialized))()}getGatewayIdentifier(){return this._gatewayIdentifier}setGatewayIdentifier(e){this._gatewayIdentifier=e||this.getGatewayIdentifier()}_isShippingAddressRequired(){const{getCartOrThrow:e,getStoreConfigOrThrow:t,getShippingAddress:n}=this._paymentIntegrationService.getState(),r=t();let i;return i=G(r.checkoutSettings.features,"PI-4290.google_pay_require_shipping_address")?this._shouldRequestShipping:void 0===n(),i&&(o=e(),a=r,!!o&&(!!o.lineItems.physicalItems.some(e=>e.isShippingRequired)||!(!a||!o.lineItems.customItems)&&o.lineItems.customItems.length>0));var o,a}_mapToAddressRequestBody(e,t,n,r){const{name:i,address1:o,address2:a,address3:s,locality:l,administrativeArea:c,countryCode:d,postalCode:h,phoneNumber:u}=e,[y,p]=this._getFirstAndLastName(i);return{firstName:y,lastName:p,company:t,address1:o,address2:`${a} ${s}`.trim(),city:l||c,stateOrProvince:c,stateOrProvinceCode:c,countryCode:d,postalCode:h,phone:u||n,customFields:r||[]}}_getFirstAndLastName(e){const t=e.split(" ");return 1===t.length?[e,""]:[t.slice(0,-1).join(" "),t[t.length-1]]}_getCurrencyCodeOrThrow(){return N(this._currencyCode,()=>new S('Unable to initialize payment because "options.currencyCode" argument is not provided.'))}_getGooglePayShippingOption({id:e,cost:t,description:n,additionalDescription:r}){var i;return{id:e,label:`${(null==(i=this._currencyService)?void 0:i.toCustomerCurrency(t))||t} ${n}`,description:r}}}var $=Object.getPrototypeOf,ee=Reflect.get,te=(e,t,n)=>ee($(e),n,t),ne=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class re extends Q{constructor(e,t){super("adyen",e),this._scriptLoader=t,this._service=e}initialize(e,t,n){return ne(this,null,function*(){yield te(re.prototype,this,"initialize").call(this,e,t,n);const r=te(re.prototype,this,"getPaymentMethod").call(this),i=this._service.getState().getStoreConfig();if(!i)throw new _(g.MissingCheckoutConfig);return this._adyenClient=yield this._scriptLoader.load({environment:r.config.testMode?"test":"live",locale:i.storeProfile.storeLanguage}),Promise.resolve()})}getNonce(e){return ne(this,null,function*(){const t=yield te(re.prototype,this,"getNonce").call(this,e),n=te(re.prototype,this,"getPaymentMethod").call(this);return JSON.stringify({type:n.method,googlePayToken:t,browser_info:m()})})}processAdditionalAction(e){return ne(this,null,function*(){if(!P(e)||!p(e.body))throw e;const t=yield this._handleAction(e.body.provider_data);try{return yield this._service.submitPayment(t)}catch(e){return this.processAdditionalAction(e)}})}_handleAction(e){return new Promise((t,n)=>{const r=JSON.parse(e.action);this._getAdyenClient().createFromAction(r,{onAdditionalDetails:e=>{const n={methodId:r.paymentMethodType,paymentData:{nonce:JSON.stringify(e.data)}};t(n)},size:"05",onError:e=>n(e)}).mount("body"),n(new f)})}_getAdyenClient(){if(!this._adyenClient)throw new b(w.PaymentNotInitialized);return this._adyenClient}}const ie={"X-Checkout-SDK-Version":"1.983.4"};class oe extends d{constructor(e){super(e||"Unable to proceed because the client library of a payment method has thrown an unexpected error."),this.name="PaymentMethodFailedError",this.type="payment_method_client_invalid"}}var ae=Object.defineProperty,se=Object.defineProperties,le=Object.getOwnPropertyDescriptors,ce=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,ue=(e,t,n)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ye=(e,t)=>{for(var n in t||(t={}))de.call(t,n)&&ue(e,n,t[n]);if(ce)for(var n of ce(t))he.call(t,n)&&ue(e,n,t[n]);return e},pe=(e,t)=>se(e,le(t)),ge=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class _e{constructor(e,t,n,r){this._scriptLoader=e,this._gateway=t,this._requestSender=n,this._formPoster=r,this._baseRequest={apiVersion:2,apiVersionMinor:0}}initialize(e,t,n,r){return ge(this,null,function*(){this._paymentsClient=yield this._scriptLoader.getGooglePaymentsClient(e().config.testMode,t),yield this._gateway.initialize(e,n,r),this._buildButtonPayloads()})}initializeWidget(){return ge(this,null,function*(){yield this._buildWidgetPayloads(),yield this._determineReadinessToPay(),this._prefetchGooglePaymentData()})}getNonce(e){return this._gateway.getNonce(e)}extraPaymentData(){return ge(this,null,function*(){return this._gateway.extraPaymentData()})}addPaymentButton(e,t){const n=document.querySelector(`#${e}`);if(!n)return;const r=this._getPaymentsClient().createButton(pe(ye({},t),{allowedPaymentMethods:[this._getBaseCardPaymentMethod()]}));return n.appendChild(r)}showPaymentSheet(){return ge(this,null,function*(){const e=this._getPaymentDataRequest();return this._getPaymentsClient().loadPaymentData(e)})}setExternalCheckoutXhr(e,t){return ge(this,null,function*(){return this._setExternalCheckout(e,t)})}setExternalCheckoutForm(e,t,n){return ge(this,null,function*(){return this._setExternalCheckout(e,t,!0,n)})}mapToBillingAddressRequestBody(e){return this._gateway.mapToBillingAddressRequestBody(e)}mapToShippingAddressRequestBody(e){return this._gateway.mapToShippingAddressRequestBody(e)}processAdditionalAction(e,t){return"processAdditionalAction"in this._gateway?this._gateway.processAdditionalAction(e,t):Promise.reject(e)}signOut(e){return ge(this,null,function*(){yield this._requestSender.get(`/remote-checkout/${e}/signout`)})}getCallbackTriggers(){return this._gateway.getCallbackTriggers()}setShouldRequestShipping(e){return this._gateway.setShouldRequestShipping(e)}handleShippingAddressChange(e){return ge(this,null,function*(){return this._gateway.handleShippingAddressChange(e)})}handleShippingOptionChange(e){return ge(this,null,function*(){yield this._gateway.handleShippingOptionChange(e)})}handleCoupons(e){return ge(this,null,function*(){return this._gateway.handleCoupons(e)})}getTotalPrice(){return this._gateway.getTotalPrice()}_setExternalCheckout(e,t,n=!1,r){return ge(this,null,function*(){const i="/checkout.php",o=ye({action:"set_external_checkout",provider:e},yield this._gateway.mapToExternalCheckoutData(t));if(n)return new Promise(e=>{this._formPoster.postForm(r?`${r}/checkout`:i,pe(ye({},o),{card_information:JSON.stringify(o.card_information)}),e)});yield this._requestSender.post(i,{headers:ye({Accept:"text/html","Content-Type":"application/x-www-form-urlencoded"},ie),body:o})})}isWebViewWithRestrictions(){return this._gateway.isWebViewWithRestrictions()}setIsWebViewExperimentOn(e){return this._gateway.setIsWebViewExperimentOn(e)}setFilterAvailableShippingOptions(e){return this._gateway.setFilterAvailableShippingOptions(e)}_prefetchGooglePaymentData(){const e=this._getPaymentDataRequest();e.transactionInfo=this._gateway.getTransactionInfo(),this._getPaymentsClient().prefetchPaymentData(e)}_determineReadinessToPay(){return ge(this,null,function*(){try{const{result:e}=yield this._getPaymentsClient().isReadyToPay(this._getIsReadyToPayRequest());if(!1===e)throw new oe("Google Pay is not supported by the current device and browser, please try another payment method.")}catch(e){if(e instanceof oe)throw e;throw new oe}})}_buildButtonPayloads(){this._baseCardPaymentMethod={type:"CARD",parameters:this._gateway.getCardParameters()}}_buildWidgetPayloads(){return ge(this,null,function*(){const e=this._getBaseCardPaymentMethod();this._cardPaymentMethod=pe(ye({},e),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:yield this._gateway.getPaymentGatewayParameters()}});const t=this._gateway.isWebViewWithRestrictions()?{shippingOptionRequired:!1}:{callbackIntents:this._gateway.getCallbackIntents(),offerInfo:this._gateway.getAppliedCoupons()};this._paymentDataRequest=ye(ye(pe(ye({},this._baseRequest),{allowedPaymentMethods:[this._cardPaymentMethod],transactionInfo:this._gateway.getTransactionInfo(),merchantInfo:this._gateway.getMerchantInfo()}),yield this._gateway.getRequiredData()),t),this._isReadyToPayRequest=pe(ye({},this._baseRequest),{allowedPaymentMethods:[e]})})}_getBaseCardPaymentMethod(){return this._getOrThrow(this._baseCardPaymentMethod)}_getPaymentDataRequest(){return this._getOrThrow(this._paymentDataRequest)}_getIsReadyToPayRequest(){return this._getOrThrow(this._isReadyToPayRequest)}_getPaymentsClient(){return this._getOrThrow(this._paymentsClient)}_getOrThrow(e){return N(e,()=>new b(w.PaymentNotInitialized))}}class me extends S{constructor(e){let t="Unable to submit payment for the order because the payload is invalid.";e&&(t=`${t} Make sure the following fields are provided correctly: ${e.join(", ")}.`),super(t),this.name="PaymentArgumentInvalidError"}}class Pe extends d{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}var fe=(e=>(e.ACKNOWLEDGE="ACKNOWLEDGE",e.FINALIZE="FINALIZE",e.INITIALIZE="INITIALIZE",e))(fe||{});const we=fe;var be=Object.defineProperty,Se=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,Ie=(e,t,n)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oe=(e,t)=>{for(var n in t||(t={}))Ce.call(t,n)&&Ie(e,n,t[n]);if(Se)for(var n of Se(t))ve.call(t,n)&&Ie(e,n,t[n]);return e};const Ae={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},Te={position:"fixed","background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"},Me="embedded-checkout-loading-indicator-rotation";class ke{constructor(e){this.styles=Oe(Oe({},Ae),e&&e.styles),this.containerStyles=Oe({},e&&e.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(e){if(e){const t=document.getElementById(e);if(!t)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");t.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const e=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",e)};this.container.addEventListener("transitionend",e),this.container.style.opacity="0"}buildContainer(){const e=document.createElement("div");return e.style.display="block",e.style.bottom="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.position="absolute",e.style.right="0",e.style.top="0",e.style.transition="all 250ms ease-out",e.style.opacity="0",this.setStyleAttribute(e,this.containerStyles),e}buildIndicator(){const e=document.createElement("div");return e.style.display="block",e.style.width=`${this.styles.size}px`,e.style.height=`${this.styles.size}px`,e.style.borderRadius=`${this.styles.size}px`,e.style.border="solid 1px",e.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,e.style.margin="0 auto",e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="50%",e.style.transform="translateY(-50%) rotate(0deg)",e.style.transformStyle="preserve-3d",e.style.animation=`${Me} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,e}setStyleAttribute(e,t){Object.keys(t).forEach(n=>{e.style.setProperty(n,t[n])})}defineAnimation(){var e;if(document.getElementById(Me))return;const t=document.createElement("style");t.id=Me,null==(e=document.head)||e.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule(`\n @keyframes ${Me} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}function Ee(e){return"object"==typeof e&&null!==e&&"statusCode"in e}var De=(e=>(e.ADYEN_V2="googlepayadyenv2",e.ADYEN_V3="googlepayadyenv3",e.AUTHORIZE_NET="googlepayauthorizenet",e.BNZ="googlepaybnz",e.BRAINTREE="googlepaybraintree",e.PAYPAL_COMMERCE="googlepaypaypalcommerce",e.BIGCOMMERCE_PAYMENTS="googlepay_bigcommerce_payments",e.CHECKOUT_COM="googlepaycheckoutcom",e.CYBERSOURCE_V2="googlepaycybersourcev2",e.ORBITAL="googlepayorbital",e.STRIPE="googlepaystripe",e.STRIPE_UPE="googlepaystripeupe",e.STRIPE_OCS="googlepaystripeocs",e.WORLDPAY_ACCESS="googlepayworldpayaccess",e.TD_ONLINE_MART="googlepaytdonlinemart",e))(De||{});function Ne(e){return Object.values(De).includes(e)}var ze=Object.defineProperty,Ge=Object.defineProperties,Re=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,je=(e,t,n)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fe=(e,t)=>{for(var n in t||(t={}))Le.call(t,n)&&je(e,n,t[n]);if(Be)for(var n of Be(t))xe.call(t,n)&&je(e,n,t[n]);return e},Ve=(e,t)=>Ge(e,Re(t)),Ue=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class We{constructor(e,t){this._paymentIntegrationService=e,this._googlePayPaymentProcessor=t,this._isDeinitializationBlocked=!1,this._isContainerMode=!1,this._loadingIndicator=new ke({containerStyles:Te})}initialize(e){return Ue(this,null,function*(){var t,n;if(!(null==e?void 0:e.methodId)||!Ne(e.methodId))throw new S('Unable to proceed because "methodId" is not a valid key.');this._methodId=e.methodId;const r=e[this._getMethodId()];if(!(null==r?void 0:r.walletButton)&&!(null==r?void 0:r.container))throw new S("Unable to proceed without valid options.");const i=r,{walletButton:o,loadingContainerId:a,container:s,buttonColor:l,buttonSizeMode:c,buttonType:d,onInit:h}=i,u=((e,t)=>{var n={};for(var r in e)Le.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&Be)for(var r of Be(e))t.indexOf(r)<0&&xe.call(e,r)&&(n[r]=e[r]);return n})(i,["walletButton","loadingContainerId","container","buttonColor","buttonSizeMode","buttonType","onInit"]);this._loadingIndicatorContainer=a,yield this._paymentIntegrationService.loadPaymentMethod(this._getMethodId());const y=this._paymentIntegrationService.getState().getPaymentMethodOrThrow(this._getMethodId());if(this._googlePayPaymentProcessor.setIsWebViewExperimentOn(!!(null==(t=y.initializationData)?void 0:t.isWebViewExperimentOn)),yield this._googlePayPaymentProcessor.initialize(()=>y,this._getGooglePayClientOptions(null==(n=y.initializationData)?void 0:n.storeCountry)),s){this._isContainerMode=!0;const e=()=>this._addPaymentButtonToContainer(r);h?h(e):e()}else this._addPaymentButton(o,u)})}execute(e){return Ue(this,arguments,function*({payment:e}){if(!(null==e?void 0:e.methodId))throw new me(["payment"]);yield this._paymentIntegrationService.submitOrder();const t=yield this._googlePayPaymentProcessor.getNonce(e.methodId),n=yield this._googlePayPaymentProcessor.extraPaymentData();try{yield this._paymentIntegrationService.submitPayment(Ve(Fe({},e),{paymentData:Fe({nonce:t},n)}))}catch(t){yield this._handleSubmitPaymentFailure(t,e.methodId)}})}finalize(e){return Ue(this,null,function*(){if(!this._isHandleUnsuccessful3dsCheckExperimentOn())return Promise.reject(new Pe);const t=this._paymentIntegrationService.getState(),n=t.getOrder(),r=t.getPaymentStatus();if(!n||r!==we.FINALIZE&&r!==we.INITIALIZE)return Promise.reject(new Pe);try{yield this._paymentIntegrationService.finalizeOrder(e)}catch(t){throw(null==e?void 0:e.methodId)&&(yield this._invalidateStalePaymentToken(e.methodId)),t}})}deinitialize(){var e,t;return this._isDeinitializationBlocked||(this._isContainerMode?null==(e=this._paymentButton)||e.remove():this._clickListener&&(null==(t=this._paymentButton)||t.removeEventListener("click",this._clickListener)),this._paymentButton=void 0,this._clickListener=void 0,this._methodId=void 0,this._isContainerMode=!1),Promise.resolve()}_handleSubmitPaymentFailure(e,t){return Ue(this,null,function*(){const n=this._isHandleUnsuccessful3dsCheckExperimentOn();try{yield this._googlePayPaymentProcessor.processAdditionalAction(e,t)}catch(e){throw n&&(yield this._invalidateStalePaymentToken(t)),e}})}_addPaymentButton(e,t){if(this._paymentButton)return;const n=document.getElementById(e);if(!n)throw new S("Unable to proceed without a walletButton.");this._paymentButton=n,this._clickListener=this._handleClick(t),this._paymentButton.addEventListener("click",this._clickListener)}_addPaymentButtonToContainer(e){if(this._paymentButton)return;const{container:t,buttonColor:n,buttonSizeMode:r,buttonType:i,onError:o}=e;if(!t)throw new S("Unable to proceed: container ID is not valid.");const a=this._googlePayPaymentProcessor.addPaymentButton(t,{buttonColor:null!=n?n:"default",buttonSizeMode:null!=r?r:"fill",buttonType:null!=i?i:"pay",onClick:this._handleContainerButtonClick(o)});if(!a)throw new S(`Unable to proceed: container element "#${t}" not found in the DOM.`);this._paymentButton=a}_handleContainerButtonClick(e){return t=>Ue(this,null,function*(){t.preventDefault(),yield this._runGooglePayWidgetInteractionWithErrorHandling(e,()=>Ue(this,null,function*(){this._googlePayPaymentProcessor.setShouldRequestShipping(!1),yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheetAndPay()}))})}_handleClick({onPaymentSelect:e,onError:t}){return n=>Ue(this,null,function*(){n.preventDefault(),yield this._runGooglePayWidgetInteractionWithErrorHandling(t,()=>Ue(this,null,function*(){this._googlePayPaymentProcessor.setShouldRequestShipping(!1),yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheetAndPay()})),null==e||e()})}_interactWithPaymentSheetAndPay(){return Ue(this,null,function*(){const e=yield this._googlePayPaymentProcessor.showPaymentSheet();this._toggleBlockDeinitialization(!0),this._toggleLoadingIndicator(!0);const t=this._getMethodId(),n=this._paymentIntegrationService.getState(),{features:r}=n.getStoreConfigOrThrow().checkoutSettings,i=G(r,"PI-5031.google_pay_dont_override_address"),o=this._googlePayPaymentProcessor.mapToBillingAddressRequestBody(e);o&&!i&&(yield this._paymentIntegrationService.updateBillingAddress(o)),yield this._googlePayPaymentProcessor.setExternalCheckoutXhr(t,e),yield this._paymentIntegrationService.loadPaymentMethod(t);const a=this._paymentIntegrationService.getState().getPaymentMethodOrThrow(t);yield this._googlePayPaymentProcessor.initialize(()=>a);try{yield this.execute({useStoreCredit:!1,payment:{methodId:t}}),this._completeCheckoutFlow()}catch(e){throw yield this._paymentIntegrationService.loadCheckout(),e}})}_completeCheckoutFlow(){window.location.replace("/checkout/order-confirmation"),this._toggleLoadingIndicator(!1),this._toggleBlockDeinitialization(!1)}_getMethodId(){return N(this._methodId,()=>new b(w.PaymentNotInitialized))}_getIsSignedInOrThrow(){return Ue(this,null,function*(){try{return!!(yield this._googlePayPaymentProcessor.getNonce(this._getMethodId()))}catch(e){if(e instanceof _&&e.subtype===g.MissingPaymentToken)return!1;throw e}})}_handleOfferTrigger(e){return Ue(this,null,function*(){let t=!1,n="Sign in to Google Pay first to apply or remove promo codes.";try{t=yield this._getIsSignedInOrThrow()}catch(e){e instanceof _&&(n=e.message)}if(t){const{newOfferInfo:t,error:n}=yield this._googlePayPaymentProcessor.handleCoupons(e);return{newOfferInfo:t,error:n}}return{error:{reason:x.OFFER_INVALID,message:n,intent:j.OFFER}}})}_getGooglePayClientOptions(e){return this._googlePayPaymentProcessor.isWebViewWithRestrictions()?{}:{paymentDataCallbacks:{onPaymentDataChanged:t=>Ue(this,[t],function*({callbackTrigger:t,offerData:n}){if(t!==j.INITIALIZE&&t!==j.OFFER)return;const{offerChangeTriggers:r}=this._googlePayPaymentProcessor.getCallbackTriggers(),{newOfferInfo:i,error:o}=r.includes(t)?yield this._handleOfferTrigger(n):{},a=o;yield this._paymentIntegrationService.loadCheckout();const{code:s}=this._paymentIntegrationService.getState().getCartOrThrow().currency,l=this._googlePayPaymentProcessor.getTotalPrice();return Fe(Fe({newTransactionInfo:Ve(Fe({},e&&{countryCode:e}),{currencyCode:s,totalPriceStatus:R.FINAL,totalPrice:l})},i&&{newOfferInfo:i}),a&&{error:a})})}}}_runGooglePayWidgetInteractionWithErrorHandling(e,t){return Ue(this,null,function*(){try{yield t()}catch(t){let n=t;if(this._toggleLoadingIndicator(!1),Ee(t)){if("CANCELED"===t.statusCode)throw new f;n=new oe(JSON.stringify(t))}throw null==e||e(new oe("An error occurred while requesting your Google Pay payment details.")),n}finally{this._toggleBlockDeinitialization(!1)}})}_toggleBlockDeinitialization(e){this._isDeinitializationBlocked=e}_toggleLoadingIndicator(e){e&&this._loadingIndicatorContainer?this._loadingIndicator.show(this._loadingIndicatorContainer):this._loadingIndicator.hide()}_invalidateStalePaymentToken(e){return Ue(this,null,function*(){try{yield this._paymentIntegrationService.loadPaymentMethod(e)}catch(e){}})}_isHandleUnsuccessful3dsCheckExperimentOn(){const{features:e}=this._paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings;return G(e,"PI-5643.google_pay_handle_unsuccessful_3ds_check",!1)}}var He=Object.defineProperty,qe=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class Ye{constructor(e){this._scriptLoader=e,this._window=window}getGooglePaymentsClient(e=!1,t){return n=this,r=function*(){if(yield this._scriptLoader.loadScript("https://pay.google.com/gp/p/js/pay.js"),!this._window.google)throw new h;return void 0===this._paymentsClient&&(this._paymentsClient=new this._window.google.payments.api.PaymentsClient(((e,t)=>{for(var n in t||(t={}))Ke.call(t,n)&&Je(e,n,t[n]);if(qe)for(var n of qe(t))Ze.call(t,n)&&Je(e,n,t[n]);return e})({environment:e?"TEST":"PRODUCTION"},null!=t?t:{}))),this._paymentsClient},new Promise((e,t)=>{var i=e=>{try{a(r.next(e))}catch(e){t(e)}},o=e=>{try{a(r.throw(e))}catch(e){t(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((r=r.apply(n,null)).next())});var n,r}}function Xe(){return new Ye(n())}const Qe=y(i=>new We(i,new _e(Xe(),new re(i,new u(n(),r())),t(),e())),[{id:"googlepayadyenv2"}]),$e={css:"sha384-5MvB4RnzvviA3VBT4KYABZ4HXNZG5LRqREEgd41xt/pf/QvKmsj2O9GuNuywRXx9",js:"sha384-yvY2yFNR4WqIjPqP9MzjI+gJimmaJnAvj4rLHKvgJbgFD5fMuf8zIJrFJOW8Lhhf"},et={css:"sha384-PWrMXiOTu6vDvUL+llWHVeWnBIxMTJ6PxGu6f8gKPGpoklzxJxRmeuOgVHE8Xk5U",js:"sha384-eFpi7m7SawN2cMRhljHMUvdeYR9Hi6dWhw40OEHv5HNavDq6Gdhsnch9FcdU3+JZ"};class tt{constructor(e,t,n=window){this._scriptLoader=e,this._stylesheetLoader=t,this._window=n}load(e,t=!1){return n=this,r=function*(){var n,r;const i=t?"6.44.0":"5.71.1",o=t?et:$e;if(yield Promise.all([this._stylesheetLoader.loadStylesheet(`https://checkoutshopper-${null!=(n=e.environment)?n:""}.adyen.com/checkoutshopper/sdk/${i}/adyen.css`,{prepend:!1,attributes:{integrity:o.css,crossorigin:"anonymous"}}),this._scriptLoader.loadScript(`https://checkoutshopper-${null!=(r=e.environment)?r:""}.adyen.com/checkoutshopper/sdk/${i}/adyen.js`,{async:!0,attributes:{integrity:o.js,crossorigin:"anonymous"}})]),t){const t=this._window.AdyenWeb;if(!t)throw new h;const n=yield t.AdyenCheckout(e);return n.createComponent=(e,r)=>t.createComponent(e,n,r),n}if(!this._window.AdyenCheckout)throw new h;return this._window.AdyenCheckout(e)},new Promise((e,t)=>{var i=e=>{try{a(r.next(e))}catch(e){t(e)}},o=e=>{try{a(r.throw(e))}catch(e){t(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((r=r.apply(n,null)).next())});var n,r}}var nt=Object.defineProperty,rt=Object.getOwnPropertySymbols,it=Object.getPrototypeOf,ot=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,st=Reflect.get,lt=(e,t,n)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ct=(e,t,n)=>st(it(e),n,t),dt=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class ht extends Q{constructor(e,t){super("adyen",e),this._scriptLoader=t,this._service=e}initialize(e,t,n){return dt(this,null,function*(){var r;yield ct(ht.prototype,this,"initialize").call(this,e,t,n);const i=ct(ht.prototype,this,"getPaymentMethod").call(this),o=this._service.getState(),a=o.getStoreConfig();if(!a)throw new _(g.MissingCheckoutConfig);const s=G(a.checkoutSettings.features,"PI-5661.adyen_sdk_upgrade",!0);return this._adyenClient=yield this._scriptLoader.load(((e,t)=>{for(var n in t||(t={}))ot.call(t,n)&<(e,n,t[n]);if(rt)for(var n of rt(t))at.call(t,n)&<(e,n,t[n]);return e})({environment:i.config.testMode?"test":"live",locale:a.storeProfile.storeLanguage},s?{countryCode:(null==(r=o.getBillingAddress())?void 0:r.countryCode)||a.storeProfile.storeCountryCode}:{}),s),Promise.resolve()})}processAdditionalAction(e){return dt(this,null,function*(){if(!P(e)||!p(e.body))throw e;const t=yield this._handleAction(e.body.provider_data);try{return yield this._service.submitPayment(t)}catch(e){return this.processAdditionalAction(e)}})}getNonce(e){return dt(this,null,function*(){const t=yield ct(ht.prototype,this,"getNonce").call(this,e),n=ct(ht.prototype,this,"getPaymentMethod").call(this);return JSON.stringify({type:n.method,googlePayToken:t,browser_info:m()})})}_handleAction(e){return new Promise((t,n)=>{const r=JSON.parse(e.action);this._getAdyenClient().createFromAction(r,{onAdditionalDetails:e=>{const n={methodId:r.paymentMethodType,paymentData:{nonce:JSON.stringify(e.data)}};t(n)},size:"05",onError:e=>n(e)}).mount("body"),n(new f)})}_getAdyenClient(){if(!this._adyenClient)throw new b(w.PaymentNotInitialized);return this._adyenClient}}const ut=y(i=>new We(i,new _e(Xe(),new ht(i,new tt(n(),r())),t(),e())),[{id:"googlepayadyenv3"}]);var yt=Object.getPrototypeOf,pt=Reflect.get;class gt extends Q{constructor(e){super("authorizenet",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=gt.prototype,pt(yt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData();return function(e){if(!function(e){return"paymentGatewayId"in e}(e))throw new _(g.MissingPaymentMethod)}(e),{gateway:this.getGatewayIdentifier(),gatewayMerchantId:e.paymentGatewayId}}}const _t=y(n=>new We(n,new _e(Xe(),new gt(n),t(),e())),[{id:"googlepayauthorizenet"}]);var mt=(e=>(e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json",e))(mt||{});const Pt=mt;function ft(e){if(!function(e){return"checkoutcomkey"in e}(e))throw new _(g.MissingPaymentMethod)}var wt=Object.getPrototypeOf,bt=Reflect.get,St=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Ct extends Q{constructor(e,t){super("checkoutltd",e),this._requestSender=t}processAdditionalAction(e){return new Promise((t,n)=>{if(P(e)&&function(e){var t;if("object"!=typeof e||null===e)return!1;const n=e;return"string"==typeof(null==(t=n.three_ds_result)?void 0:t.acs_url)&&"string"==typeof n.three_ds_result.code}(e.body)&&"three_d_secure_required"===e.body.three_ds_result.code)return window.location.assign(e.body.three_ds_result.acs_url);n(e)})}mapToExternalCheckoutData(e){return St(this,null,function*(){const t=yield(n=Ct.prototype,bt(wt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;let r;try{r=JSON.parse(t.nonce)}catch(e){throw new S("Unable to parse response from Google Pay.")}return function(e){if(!function(e){return"object"==typeof e&&null!==e&&"protocolVersion"in e&&"signature"in e&&"signedMessage"in e}(e))throw new _(g.MissingPaymentToken)}(r),t.nonce=yield this._tokenize(r),t})}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData();return ft(e),{gateway:this.getGatewayIdentifier(),gatewayMerchantId:e.checkoutcomkey}}_tokenize(e){return St(this,null,function*(){const t=this.getPaymentMethod().config.testMode?"https://api.sandbox.checkout.com/tokens":"https://api.checkout.com/tokens",n=this.getGooglePayInitializationData();ft(n);const{body:r}=yield this._requestSender.post(t,{credentials:!1,body:{type:"googlepay",token_data:e},headers:{Authorization:n.checkoutcomkey,"Content-Type":Pt.Json,"X-XSRF-TOKEN":null}});return r.token})}}const vt=y(n=>{const r=t();return new We(n,new _e(Xe(),new Ct(n,r),r,e()))},[{id:"googlepaycheckoutcom"}]);var It=Object.getPrototypeOf,Ot=Reflect.get;class At extends Q{constructor(e){super("cybersource",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=At.prototype,Ot(It(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}const Tt=y(n=>new We(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaycybersourcev2"},{id:"googlepaybnz"}]);var Mt=Object.getPrototypeOf,kt=Reflect.get;class Et extends Q{constructor(e){super("chase",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=Et.prototype,kt(Mt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}const Dt=y(n=>new We(n,new _e(Xe(),new Et(n),t(),e())),[{id:"googlepayorbital"}]);var Nt=(e=>(e.V3="v3",e.ACACIA="acacia",e.BASIL="basil",e.CLOVER="clover",e))(Nt||{}),zt=Object.defineProperty,Gt=Object.getOwnPropertySymbols,Rt=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable,Lt=(e,t,n)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xt=(e,t)=>{for(var n in t||(t={}))Rt.call(t,n)&&Lt(e,n,t[n]);if(Gt)for(var n of Gt(t))Bt.call(t,n)&&Lt(e,n,t[n]);return e},jt=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Ft{constructor(e,t=window){this.scriptLoader=e,this.stripeWindow=t}getStripeClient(e,t,n,r,i){return jt(this,null,function*(){if(this.stripeWindow.bcStripeClient)return this.stripeWindow.bcStripeClient;const o=yield this.load(n),{stripePublishableKey:a,stripeConnectedAccount:s}=e,l=o(a,xt(xt(xt(xt({},s?{stripeAccount:s}:{}),t?{locale:t}:{}),r?{betas:r}:{}),i?{apiVersion:i}:{}));return Object.assign(this.stripeWindow,{bcStripeClient:l}),l})}getElements(e,t){return jt(this,null,function*(){let n=this.stripeWindow.bcStripeElements;return n?yield this.updateStripeElements(t):(n=e.elements(t),Object.assign(this.stripeWindow,{bcStripeElements:n})),n})}updateStripeElements(e){return jt(this,null,function*(){const t=this.stripeWindow.bcStripeElements;t&&(t.update(e),yield t.fetchUpdates())})}getStripeCheckout(e,t){return jt(this,null,function*(){let n=yield this.getStoredStripeCheckout(t);if(n){const{actions:e}=yield n.loadActions();yield null==e?void 0:e.runServerUpdate(()=>Promise.resolve())}else n=yield e.initCheckout(t),Object.assign(this.stripeWindow,{bcStripeCheckout:n});return n})}load(e){return jt(this,null,function*(){if(!this.stripeWindow.Stripe&&(yield this.scriptLoader.loadScript(this.getScriptUrl(e)),!this.stripeWindow.Stripe))throw new h;return this.stripeWindow.Stripe})}getScriptUrl(e){return e&&e!==Nt.V3?`https://js.stripe.com/${e}/stripe.js`:"https://js.stripe.com/v3/"}getStoredStripeCheckout(e){return jt(this,null,function*(){const t=this.stripeWindow.bcStripeCheckout;if(t)try{const{actions:n,error:r}=yield t.loadActions();if(r||!n)return void this.logErrorToConsole(r);const i=yield n.getSession(),o=e.clientSecret.split("_secret_")[0];if(i.id===o)return t}catch(e){return void this.logErrorToConsole(e)}})}logErrorToConsole(e){e?console.error(e):console.error("No stripe checkout actions available on loadActions().")}}const Vt={body:{},headers:{},status:0};class Ut extends d{constructor(e,{message:t,errors:n}={}){const{body:r,headers:i,status:o}=e||Vt;super(t||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}const Wt=["payment_element_beta_2","alipay_pm_beta_1","link_default_integration_beta_1","shipping_address_element_beta_1","address_element_beta_1"];function Ht(e){if(!function(e){return"stripeConnectedAccount"in e&&"stripePublishableKey"in e&&"stripeVersion"in e}(e))throw new _(g.MissingPaymentMethod)}var qt=Object.getPrototypeOf,Kt=Reflect.get,Zt=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Jt extends Q{constructor(e,t){super("stripe",e),this.paymentIntegrationService=e,this.scriptLoader=t}mapToExternalCheckoutData(e){return Zt(this,null,function*(){const t=yield(n=Jt.prototype,Kt(qt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;let r;try{r=JSON.parse(t.nonce)}catch(e){throw new S("Unable to parse response from Google Pay.")}return function(e){if(!function(e){return"object"==typeof e&&null!==e&&"id"in e}(e))throw new _(g.MissingPaymentToken)}(r),t.nonce=r.id,t})}getPaymentGatewayParameters(){const e=this.getGooglePayInitializationData();Ht(e);const{stripeVersion:t,stripePublishableKey:n,stripeConnectedAccount:r}=e;return{gateway:this.getGatewayIdentifier(),"stripe:version":t,"stripe:publishableKey":`${n}/${r}`}}processAdditionalAction(e,t){return Zt(this,null,function*(){var n,r;if(!t)throw new me(["payment"]);if(!P(e)||("object"!=typeof(r=e.body)||null===r||!("three_ds_result"in r)||!("errors"in r)))throw e;if(c(e.body.errors,{code:"three_d_secure_required"})){const r=this.getGooglePayInitializationData();Ht(r),this.stripeUPEClient=yield this.loadStripeJs(r,t);const i=e.body.three_ds_result.token;let o,a=!1;try{o=yield this.stripeUPEClient.confirmCardPayment(i)}catch(e){try{o=yield this.stripeUPEClient.retrievePaymentIntent(i)}catch(e){a=!0}}if(null==o?void 0:o.error){if(this._throwDisplayableStripeError(o.error),this._isCancellationError(o.error))throw new f;throw new oe}if(!(null==o?void 0:o.paymentIntent)&&!a)throw new Ut;return this.paymentIntegrationService.submitPayment({methodId:t,paymentData:{nonce:(null==(n=null==o?void 0:o.paymentIntent)?void 0:n.id)||i}})}throw e})}loadStripeJs(e,t){return Zt(this,null,function*(){if(this.stripeUPEClient)return this.stripeUPEClient;const n=this.paymentIntegrationService.getState().getCartLocale();return"googlepaystripeocs"===t?this.scriptLoader.getStripeClient(e,n,Nt.CLOVER):this.scriptLoader.getStripeClient(e,n,Nt.V3,Wt,"2020-03-02;alipay_beta=v1;link_beta=v1")})}_isCancellationError(e){var t,n;return e&&-1!==(null==(n=null==(t=e.payment_intent.last_payment_error)?void 0:t.message)?void 0:n.indexOf("canceled"))}_throwDisplayableStripeError(e){if(o(["card_error","invalid_request_error","validation_error"],e.type))throw new Error(e.message)}}const Yt=y(r=>new We(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripe"},{id:"googlepaystripeupe"},{id:"googlepaystripeocs"}]);var Xt=Object.getPrototypeOf,Qt=Reflect.get;class $t extends Q{constructor(e){super("worldpay",e)}mapToExternalCheckoutData(e){return t=this,n=function*(){const t=yield(n=$t.prototype,Qt(Xt(n),"mapToExternalCheckoutData",this)).call(this,e);var n;return t.nonce=btoa(t.nonce),t},new Promise((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())});var t,n}}const en=y(n=>new We(n,new _e(Xe(),new $t(n),t(),e())),[{id:"googlepayworldpayaccess"}]),tn="3.128.0",nn="3.123.2",rn="3.106.0";class on{constructor(e){this.paymentIntegrationService=e,this.braintreeWindow=window}getSDKVersion(){const e=this.paymentIntegrationService.getState().getStoreConfig(),t=(null==e?void 0:e.checkoutSettings.features)||{};return this.getPreloadedSDKVersion()||(G(t,"PAYPAL-5809.braintree_hosted_fields_fix_version")?tn:G(t,"PAYPAL-5636.update_braintree_sdk_version")?nn:rn)}getPreloadedSDKVersion(){const e=this.braintreeWindow.braintree;if(e){const t=i(Object.values(e),e=>!!e.VERSION);return null==t?void 0:t.VERSION}}}class an extends d{constructor(e){super(e||"Unsupported browser error"),this.name="UnsupportedBrowserError",this.type="unsupported_browser"}}var sn=(e=>(e.KountNotEnabled="DATA_COLLECTOR_KOUNT_NOT_ENABLED",e))(sn||{}),ln=Object.defineProperty,cn=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable,un=(e,t,n)=>t in e?ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class pn{constructor(e){this.braintreeScriptLoader=e}initialize(e){this.setClientToken(e)}deinitialize(){return yn(this,null,function*(){yield this.teardownModule(this.dataCollector),this.dataCollector=void 0})}getClient(){return yn(this,null,function*(){if(!this.client){const e=this.getClientTokenOrThrow(),t=yield this.braintreeScriptLoader.loadClient();this.client=yield t.create({authorization:e})}return this.client})}getDataCollectorOrThrow(e){return yn(this,null,function*(){const t={deviceData:void 0,teardown:()=>Promise.resolve()};if(!this.dataCollector)try{const t=yield this.getClient(),n=yield this.braintreeScriptLoader.loadDataCollector(),r=((e,t)=>{for(var n in t||(t={}))dn.call(t,n)&&un(e,n,t[n]);if(cn)for(var n of cn(t))hn.call(t,n)&&un(e,n,t[n]);return e})({client:t,kount:!0},e);this.dataCollector=yield n.create(r)}catch(e){if(function(e){return Boolean("object"==typeof e&&null!==e&&("type"in e||"message"in e||"code"in e))}(e)&&e.code===sn.KountNotEnabled)return t;throw e}return this.dataCollector})}getBraintreeGooglePayment(){return yn(this,null,function*(){if(!this.googlePayment){const[e,t]=yield Promise.all([this.getClient(),this.braintreeScriptLoader.loadGooglePayment()]);this.googlePayment=yield t.create({client:e})}return this.googlePayment})}getBraintreeThreeDS(){return yn(this,null,function*(){if(!this.threeDS){const[e,t]=yield Promise.all([this.getClient(),this.braintreeScriptLoader.load3DS()]);this.threeDS=yield t.create({client:e,version:2})}return this.threeDS})}getBraintreeLocalPayment(e){return yn(this,null,function*(){if(!this.braintreeLocalPayment){const[t,n]=yield Promise.all([this.getClient(),this.braintreeScriptLoader.loadLocalPayment()]);this.braintreeLocalPayment=yield new Promise((r,i)=>{n.create({client:t,merchantAccountId:e},(e,t)=>{e&&i(e),r(t)})})}return this.braintreeLocalPayment})}getUsBankAccount(){return yn(this,null,function*(){if(!this.usBankAccount){const e=yield this.getClient(),t=yield this.braintreeScriptLoader.loadUsBankAccount();this.usBankAccount=yield t.create({client:e})}return this.usBankAccount})}getBraintreeVisaCheckout(){return this.visaCheckout||(this.visaCheckout=Promise.all([this.getClient(),this.braintreeScriptLoader.loadVisaCheckout()]).then(([e,t])=>t.create({client:e}))),this.visaCheckout}getVisaCheckoutSdk(e){return yn(this,null,function*(){return this.visaCheckoutSDK||(this.visaCheckoutSDK=yield this.braintreeScriptLoader.loadVisaCheckoutSdk(e)),this.visaCheckoutSDK})}getVenmoCheckoutOrThrow(){return yn(this,null,function*(){if(!this.braintreeVenmo){const e=yield this.getClient(),t=yield this.braintreeScriptLoader.loadVenmoCheckout(),n={client:e,allowDesktop:!0,paymentMethodUsage:"multi_use"},r=yield t.create(n);if(!r.isBrowserSupported())throw new an;this.braintreeVenmo=r}return this.braintreeVenmo})}setClientToken(e){this.clientToken=e}getClientTokenOrThrow(){if(!this.clientToken)throw new b(w.PaymentNotInitialized);return this.clientToken}teardownModule(e){return e?e.teardown():Promise.resolve()}}var gn=(e=>(e.Client="client",e.DataCollector="dataCollector",e.Fastlane="fastlane",e.GooglePayment="googlePayment",e.HostedFields="hostedFields",e.LocalPayment="localPayment",e.Paypal="paypal",e.PaypalCheckout="paypalCheckout",e.ThreeDSecure="threeDSecure",e.UsBankAccount="usBankAccount",e.Venmo="venmo",e.VisaCheckout="visaCheckout",e))(gn||{});const _n={[rn]:{[gn.Client]:"sha384-26BXDNnJI23JYRyFBj4xe4sVNrUSSiSSu11kxVXNM/vEPONm4LuL00w6ZaTgQewt",[gn.PaypalCheckout]:"sha384-B+vzbZwnQtzWBthpkT4TXKUibO65tyeK7eCxSvpblgprTep2+IAXB2Cxxjrn710O",[gn.Paypal]:"sha384-uyAGL1/3+XJAHnGoNy4eCoXdzJ4f7Ilzp+6w9PNnEjs6DCCz9WMyJjMN1gzc78U+",[gn.LocalPayment]:"sha384-LIvOEMkIVEwVuYBdVOQc1AC5YbGGlwyfUheS0ACK218D2STuVYQlZ4FyEPowAEfT",[gn.DataCollector]:"sha384-1bo9JDz+Kscthc085cCKWur8CLwUoBpoNyxsDi7932mCl0zFq3A5mv+FQLw9GHpV",[gn.UsBankAccount]:"sha384-xmHBVaU+w74V+OebD3AaPONFxHUGMf+QRs8G/JxVPXNNP7MDa2jL0ICWHIe2tTfJ",[gn.GooglePayment]:"sha384-WKDJl8mqoP82qZpMGH6AbZxnvXnSW8ILV4M64CyMLiugGMwu7LyP89wjCkHqsiBe",[gn.ThreeDSecure]:"sha384-VQUlpGHzsGvs5XeiGFip7EXRsvoHWEXDVmgCacfbyieZI9mdBOqq3NSoyo28OCOB",[gn.VisaCheckout]:"sha384-yx7mADfzTN0T43Q6rlH49LIg1EJ0iUZgBp/EczX9LXsUGkySgxrD+nWHQRBkyfoT",[gn.Venmo]:"sha384-QX4rPjoj1ZDhuG0aSyKs56lEKDqTMTcjYxUHY1SzO5VZDsqIE2NTkqot7KNSCyov",[gn.HostedFields]:"sha384-VvYBACfSu0Cr/J32uKmxG7AXcNOJE1AzIIL3kbikyS7YKp5fz5Is+NzNP/lyauNy",[gn.Fastlane]:"sha384-9oGsZMRZwpGtDEDYa/dFt76dECqj1xAni9gIKgc3KfMIiRnR73nEeeUDLiBzxhFa"},[nn]:{[gn.Client]:"sha384-o+nbQGcwNNxIBeXeu3+XmbSq+Cg8R3EN3N0l5hXCgMMU2RGY0t1z0LroSEIAbfAO",[gn.PaypalCheckout]:"sha384-WrfbWPBS4mH86GAoycPSgiH8hQ8KH7A67C93Hjhunv/xhNk2YpBn3wbFA4Fhg9U/",[gn.Paypal]:"sha384-VF389nvvrRUgDsTXMxTYORDtVegB9IQa3Cxr//DyJnLYnz8/X8VCzEvck2c+Megt",[gn.LocalPayment]:"sha384-tZKx2rEQbfmZpoPSY5VPmJEhaq4X75dLvwHMs3VE9U+C8lPyw+hWTIL1+GPvWCIH",[gn.DataCollector]:"sha384-E6k3wOpP7syCDDwaRDLF06942Y00NkbwJvWi2OQXwwKzGwG5fd3E7RFUvCCecfvO",[gn.UsBankAccount]:"sha384-258FON8LZGG0W9Qaz4Jij83pZHu30YnKjJA7gNulLBh6CclkucgF+tHDQuYFRYfW",[gn.GooglePayment]:"sha384-taJ2p/0+n0VH328POAoBiuEbL3tnHUTE9S42hK1V+Txs3X+QYjZOyKW35JgHRFfO",[gn.ThreeDSecure]:"sha384-+NSZH4Zj3sO5bdWvPKhU5N16QDxeueTVTnUVeleeESkhLSaz4Ob1hh/5myecc9Ym",[gn.VisaCheckout]:"sha384-66DiBjghxk1OmBj8aksN8gbQ+CwoQcx1vPfiXUN08g1iQVM+BwewF0p7toM3i7SS",[gn.Venmo]:"sha384-B5UwY42kE4RoLoWbQ7YpqosUlUad2/DlGWiw0HhoZbSPk30CQAaSA10ohyLDTkDU",[gn.HostedFields]:"sha384-Aw9EesSaUeWxe36PqEHiOyOyOq8M6CIb1gw7/yHNVPRzGtFXXcd2OQ8qXrIlOj2P",[gn.Fastlane]:"sha384-rhBL1hpZ71JqG+2TsT0Dih47mbjx8cjJCpeZjk9tw3df1gFMKfCTmMyZunhr7H4Y"},[tn]:{[gn.Client]:"sha384-0WNxksIpRP+fYZiIdr12g6DBUQfLDzYCQJZtR/C8KkcwSGhPHfcFp3tTaGcMyFTq",[gn.PaypalCheckout]:"sha384-lWM1jk4BOxoDNV6Kop7tVNvQgINlmEVz0c/OwM+HNHK3QC8xqwd54Ovrt2QRDTjh",[gn.Paypal]:"sha384-fXUmVxC2EMZBDXZ7eTHSTL/LFBrHej/MSXT/vTBXvra4lzgLNGvREAp+x0GYObuH",[gn.LocalPayment]:"sha384-pha1xGuGSkmZH5x9aqHvRaO4xLea7rmQ/79PFj9zxNzxuFcOWZg7gOP7FibygOEC",[gn.DataCollector]:"sha384-Q6PI2F9eekWbAxhroybl+aEcvqhdowN/EQlGwBUyJOzPFn9982u9xl6SU6XfGKzc",[gn.UsBankAccount]:"sha384-W3RLQSKJL1tQ3+Y7mP6tmkamtZ8bV4Yw/XxL9Jj5JtXHraD8loMF8hAIG5m2zK7F",[gn.GooglePayment]:"sha384-TITQMsFWA3elDNGP2mWz2oKBo4qjt+TlqzovcaPoeBiAh/wPBi6nae50ADdgU1/i",[gn.ThreeDSecure]:"sha384-YiycYN89ZlL/Evcaq4y1ajW1mhd7JYfZBDuOwHtIn4/Jnm20GL+/XCM+zYAwWD8D",[gn.VisaCheckout]:"sha384-/OdaTv9qrkKzjObtUe6yzfDhHozFW/+uXlrSl736sOZRJpjGQETvpYXqMFFg69xv",[gn.Venmo]:"sha384-dA+ojdW9vbJS4JavcXyOs9d5uZHJg5dNtYupoPSH2zsXIiYDVS5amLb/u8qmQ6oz",[gn.HostedFields]:"sha384-31ZkS58+iaWsW06ftW52zzVZFp43WPd7pNYRiddYynSNg6Oh7WGbSFGorAUH6T1z",[gn.Fastlane]:"sha384-jlbrwNvL3HvLAUCtLSmrnQ2GH1udCUrRS/bVmReAS5fuIVvcW8Pko/Gkg82tlgtr"}};var mn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Pn{constructor(e,t,n){this.scriptLoader=e,this.braintreeHostWindow=t,this.braintreeSDKVersionManager=n}loadClient(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.Client,"client.min.js")})}loadFastlane(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.Fastlane,"fastlane.min.js")})}loadPaypalCheckout(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.PaypalCheckout,"paypal-checkout.min.js")})}loadPaypal(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.Paypal,"paypal.min.js")})}loadLocalPayment(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.LocalPayment,"local-payment.min.js")})}loadDataCollector(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.DataCollector,"data-collector.min.js")})}loadUsBankAccount(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.UsBankAccount,"us-bank-account.min.js")})}loadGooglePayment(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.GooglePayment,"google-payment.min.js")})}load3DS(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.ThreeDSecure,"three-d-secure.min.js")})}loadVisaCheckout(){return this.loadBraintreeModuleOrThrow(gn.VisaCheckout,"visa-checkout.min.js")}loadVenmoCheckout(){return this.loadBraintreeModuleOrThrow(gn.Venmo,"venmo.min.js")}loadHostedFields(){return mn(this,null,function*(){return this.loadBraintreeModuleOrThrow(gn.HostedFields,"hosted-fields.min.js")})}loadVisaCheckoutSdk(e){return mn(this,null,function*(){if(this.braintreeHostWindow.V)return this.braintreeHostWindow.V;const t=e?"sha384-0eu1s1GtqzXlL9DtLgmwzC5WWlEH/ADRM0n38cVQkvtT+W/gey96rcb1LwuUOPDm":"sha384-1f1csvP3ZFxg4dILH1GaY4LHlZ0oX7Rk83rxmLlwbnIi4TM0NYzXoev1VoEiVDS6";return this.scriptLoader.loadScript(`//${e?"sandbox-":""}assets.secure.checkout.visa.com/checkout-widget/resources/js/integration/v1/sdk.js`,{async:!0,attributes:{integrity:t,crossorigin:"anonymous"}}).then(()=>{if(!this.braintreeHostWindow.V)throw new h;return this.braintreeHostWindow.V})})}loadBraintreeModuleOrThrow(e,t){return mn(this,null,function*(){let n=this.getBraintreeModule(e);if(n)return n;const r=this.braintreeSDKVersionManager.getSDKVersion(),i=`//js.braintreegateway.com/web/${r}/js/${t}`,o=r in _n?this.getIntegrityValuesByModuleName(e,r):void 0;if(yield this.scriptLoader.loadScript(i,o?{async:!0,attributes:{integrity:o,crossorigin:"anonymous"}}:void 0),n=this.getBraintreeModule(e),!n)throw new h;return n})}getBraintreeModule(e){var t;return null==(t=this.braintreeHostWindow.braintree)?void 0:t[e]}getIntegrityValuesByModuleName(e,t){const n=_n[t][e];if(!n)throw new Error("Unexpected fileName value");return n}}class fn{constructor(e){const t=new Promise((e,t)=>{this.cancel=t});this.promise=Promise.race([e,t])}}var wn=Object.defineProperty,bn=Object.getOwnPropertySymbols,Sn=Object.getPrototypeOf,Cn=Object.prototype.hasOwnProperty,vn=Object.prototype.propertyIsEnumerable,In=Reflect.get,On=(e,t,n)=>t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,An=(e,t,n)=>In(Sn(e),n,t),Tn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Mn extends Q{constructor(e,t){super("braintree",e),this._braintreeSdk=t,this._methodId=De.BRAINTREE,this._verificationsInProgress=0,this._service=e}initialize(e,t,n){return Tn(this,null,function*(){yield An(Mn.prototype,this,"initialize").call(this,e,t,n);let r=An(Mn.prototype,this,"getPaymentMethod").call(this);if(r.clientToken||(r=(yield this._service.loadPaymentMethod(this._methodId)).getPaymentMethodOrThrow(this._methodId)),!r.clientToken||!r.initializationData)throw new _(g.MissingPaymentMethod);return this._braintreeSdk.initialize(r.clientToken),this._braintreeGooglePayment=yield this._braintreeSdk.getBraintreeGooglePayment(),Promise.resolve()})}getNonce(e){return Tn(this,null,function*(){var t;const n=yield An(Mn.prototype,this,"getNonce").call(this,e),{clientToken:r,initializationData:i}=An(Mn.prototype,this,"getPaymentMethod").call(this);if(!r||!i||!(null==(t=i.card_information)?void 0:t.bin))throw new _(g.MissingPaymentMethod);const{isThreeDSecureEnabled:o,card_information:{bin:a,isNetworkTokenized:s}}=i;if(o&&!s){const e=yield this._braintreeSdk.getBraintreeThreeDS(),{orderAmount:t}=this._service.getState().getOrderOrThrow();return(yield this._braintreePresent3DSChallenge(e,t,n,a)).nonce}return n})}extraPaymentData(){return Tn(this,null,function*(){return{deviceSessionId:yield this._getBraintreeDeviceData()}})}mapToExternalCheckoutData(e){return Tn(this,null,function*(){const t=yield An(Mn.prototype,this,"mapToExternalCheckoutData").call(this,e);let n;try{n=JSON.parse(t.nonce)}catch(e){throw new S("Unable to parse response from Google Pay.")}return function(e){if(!function(e){return"object"==typeof e&&null!==e&&"androidPayCards"in e}(e))throw new _(g.MissingPaymentToken)}(n),t.nonce=n.androidPayCards[0].nonce,t.card_information.bin=n.androidPayCards[0].details.bin,t.card_information.isNetworkTokenized=n.androidPayCards[0].details.isNetworkTokenized,t})}getCardParameters(){return super.getCardParameters()}getPaymentGatewayParameters(){return Tn(this,null,function*(){return this.getBraintreeGooglePayment().createPaymentDataRequest(((e,t)=>{for(var n in t||(t={}))Cn.call(t,n)&&On(e,n,t[n]);if(bn)for(var n of bn(t))vn.call(t,n)&&On(e,n,t[n]);return e})({merchantInfo:An(Mn.prototype,this,"getMerchantInfo").call(this),transactionInfo:An(Mn.prototype,this,"getTransactionInfo").call(this),cardRequirements:{billingAddressRequired:!0,billingAddressFormat:"FULL"}},yield An(Mn.prototype,this,"getRequiredData").call(this))).paymentMethodTokenizationParameters.parameters})}getBraintreeGooglePayment(){if(!this._braintreeGooglePayment)throw new _(g.MissingPaymentMethod);return this._braintreeGooglePayment}_getBraintreeDeviceData(){return Tn(this,null,function*(){const{deviceData:e}=yield this._braintreeSdk.getDataCollectorOrThrow();return e})}_braintreePresent3DSChallenge(e,t,n,r){return Tn(this,null,function*(){this._verificationsInProgress>0&&(yield this._cancelBraintree3DSVerification(e)),this._verificationsInProgress+=1;const i=new fn(e.verifyCard({amount:t,bin:r,nonce:n,onLookupComplete:(e,t)=>{t()}}));try{return yield i.promise}finally{this._verificationsInProgress-=1}})}_cancelBraintree3DSVerification(e){return Tn(this,null,function*(){try{yield e.cancelVerifyCard()}catch(e){}})}}const kn=y(r=>{const i=t(),o=window,a=new on(r),s=new pn(new Pn(n(),o,a));return new We(r,new _e(Xe(),new Mn(r,s),i,e()))},[{id:"googlepaybraintree"}]),En=["ar_BH","ar_DZ","ar_EG","ar_JO","ar_KW","ar_MA","ar_OM","ar_QA","ar_SA","ar_TN","ar_YE","ar_AE","bg_BG","cs_CZ","da_DK","da_FO","da_GL","de_AT","de_CH","de_DE","de_LU","el_GR","en_AD","en_AE","en_AG","en_AI","en_AL","en_AM","en_AN","en_AO","en_AT","en_AU","en_AW","en_AZ","en_BB","en_BE","en_BH","en_BJ","en_BM","en_BN","en_BS","en_BT","en_BW","en_BY","en_BZ","en_C2","en_CA","en_CD","en_CG","en_CH","en_CI","en_CK","en_CL","en_CM","en_CN","en_CO","en_CR","en_CV","en_CY","en_CZ","en_DE","en_DJ","en_DK","en_DM","en_DO","en_DZ","en_EC","en_EE","en_EG","en_ER","en_ES","en_ET","en_FI","en_FJ","en_FK","en_FM","en_FO","en_FR","en_GA","en_GB","en_GD","en_GE","en_GF","en_GI","en_GL","en_GM","en_GN","en_GP","en_GR","en_GT","en_GW","en_GY","en_HK","en_HN","en_HR","en_HU","en_ID","en_IE","en_IL","en_IN","en_IS","en_IT","en_JM","en_JO","en_JP","en_KE","en_KG","en_KH","en_KI","en_KM","en_KN","en_KR","en_KW","en_KY","en_KZ","en_LA","en_LC","en_LI","en_LK","en_LS","en_LT","en_LU","en_LV","en_MA","en_MC","en_MD","en_ME","en_MG","en_MH","en_MK","en_ML","en_MN","en_MQ","en_MR","en_MS","en_MT","en_MU","en_MV","en_MW","en_MY","en_MZ","en_NA","en_NC","en_NE","en_NF","en_NG","en_NI","en_NL","en_NO","en_NP","en_NR","en_NU","en_NZ","en_OM","en_PA","en_PE","en_PF","en_PG","en_PH","en_PL","en_PM","en_PN","en_PT","en_PW","en_PY","en_QA","en_RE","en_RO","en_RS","en_RU","en_RW","en_SA","en_SB","en_SC","en_SE","en_SG","en_SH","en_SI","en_SJ","en_SK","en_SL","en_SM","en_SN","en_SO","en_SR","en_ST","en_SV","en_SZ","en_TC","en_TD","en_TG","en_TH","en_TJ","en_TM","en_TN","en_TO","en_TR","en_TT","en_TV","en_TW","en_TZ","en_UA","en_UG","en_US","en_UY","en_VA","en_VC","en_VE","en_VG","en_VN","en_VU","en_WF","en_WS","en_YE","en_YT","en_ZA","en_ZM","en_ZW","es_AD","es_AI","es_AO","es_AR","es_AW","es_BB","es_BJ","es_BM","es_BO","es_BS","es_BZ","es_CD","es_CG","es_CK","es_CL","es_CO","es_CR","es_CV","es_DJ","es_DM","es_DO","es_DZ","es_EC","es_EG","es_ER","es_ES","es_ET","es_FJ","es_FK","es_FO","es_GA","es_GD","es_GE","es_GI","es_GL","es_GM","es_GN","es_GT","es_GW","es_GY","es_HN","es_IE","es_JM","es_JO","es_KE","es_KG","es_KI","es_KM","es_KN","es_KW","es_KY","es_KZ","es_LC","es_LI","es_LS","es_LU","es_MA","es_MG","es_MH","es_ML","es_MR","es_MS","es_MU","es_MW","es_MX","es_MZ","es_NA","es_NC","es_NE","es_NF","es_NI","es_NR","es_NU","es_NZ","es_OM","es_PA","es_PE","es_PF","es_PG","es_PM","es_PN","es_PW","es_PY","es_QA","es_RS","es_RW","es_SA","es_SB","es_SC","es_SH","es_SJ","es_SL","es_SM","es_SN","es_SO","es_SR","es_ST","es_SV","es_SZ","es_TC","es_TD","es_TG","es_TJ","es_TM","es_TN","es_TT","es_TV","es_UA","es_UG","es_US","es_UY","es_VA","es_VC","es_VE","es_VG","es_VU","es_WF","es_YE","es_ZM","et_EE","fi_FI","fr_AD","fr_AE","fr_AI","fr_AM","fr_AO","fr_AW","fr_AZ","fr_BB","fr_BE","fr_BF","fr_BI","fr_BJ","fr_BM","fr_BS","fr_BZ","fr_CA","fr_CD","fr_CG","fr_CH","fr_CI","fr_CK","fr_CM","fr_CV","fr_DJ","fr_DM","fr_DO","fr_DZ","fr_EC","fr_ER","fr_ET","fr_FJ","fr_FK","fr_FO","fr_FR","fr_GA","fr_GD","fr_GE","fr_GF","fr_GI","fr_GL","fr_GM","fr_GN","fr_GP","fr_GT","fr_GW","fr_GY","fr_HN","fr_IE","fr_JM","fr_JO","fr_KE","fr_KG","fr_KI","fr_KM","fr_KN","fr_KW","fr_KY","fr_KZ","fr_LC","fr_LI","fr_LS","fr_LU","fr_MA","fr_MC","fr_MG","fr_MH","fr_ML","fr_MQ","fr_MR","fr_MS","fr_MU","fr_MW","fr_MZ","fr_NA","fr_NC","fr_NE","fr_NF","fr_NI","fr_NR","fr_NU","fr_NZ","fr_OM","fr_PA","fr_PE","fr_PF","fr_PG","fr_PM","fr_PN","fr_PW","fr_QA","fr_RE","fr_RS","fr_RW","fr_SA","fr_SB","fr_SC","fr_SH","fr_SJ","fr_SL","fr_SM","fr_SN","fr_SO","fr_SR","fr_ST","fr_SV","fr_SZ","fr_TC","fr_TD","fr_TG","fr_TJ","fr_TM","fr_TN","fr_TT","fr_TV","fr_UA","fr_UG","fr_US","fr_UY","fr_VA","fr_VC","fr_VE","fr_VG","fr_VU","fr_WF","fr_YE","fr_YT","fr_ZA","fr_ZM","he_IL","hu_HU","id_ID","it_IT","ja_JP","ko_KR","lv_LV","lt_LT","ms_BN","ms_MY","nl_BE","nl_NL","pl_PL","pt_BR","pt_PT","ro_RO","ru_EE","ru_LT","ru_LV","ru_RU","ru_UA","si_LK","sk_SK","sl_SI","sq_AL","sv_SE","tl_PH","th_TH","tr_TR","vi_VN","zh_C2","zh_CN","zh_HK","zh_TW","zh_AD","zh_AE","zh_AI","zh_AO","zh_AW","zh_BB","zh_BH","zh_BJ","zh_BM","zh_BS","zh_BZ","zh_CD","zh_CG","zh_CK","zh_CL","zh_CO","zh_CV","zh_DJ","zh_DM","zh_DO","zh_DZ","zh_EC","zh_EG","zh_ER","zh_ET","zh_FJ","zh_FK","zh_FO","zh_GA","zh_GD","zh_GE","zh_GI","zh_GL","zh_GM","zh_GN","zh_GT","zh_GW","zh_GY","zh_HN","zh_IE","zh_JM","zh_JO","zh_KE","zh_KG","zh_KI","zh_KM","zh_KN","zh_KW","zh_KY","zh_KZ","zh_LC","zh_LI","zh_LS","zh_LT","zh_LU","zh_MA","zh_MG","zh_MH","zh_ML","zh_MR","zh_MS","zh_MU","zh_MW","zh_MZ","zh_NA","zh_NC","zh_NE","zh_NF","zh_NI","zh_NR","zh_NU","zh_NZ","zh_OM","zh_PA","zh_PE","zh_PF","zh_PG","zh_PM","zh_PN","zh_PW","zh_QA","zh_RS","zh_RW","zh_SA","zh_SB","zh_SC","zh_SH","zh_SJ","zh_SL","zh_SM","zh_SN","zh_SO","zh_SR","zh_ST","zh_SV","zh_SZ","zh_TC","zh_TD","zh_TG","zh_TJ","zh_TM","zh_TN","zh_TT","zh_TV","zh_UA","zh_UG","zh_US","zh_UY","zh_VA","zh_VC","zh_VE","zh_VG","zh_VU","zh_WF","zh_YE","zh_ZA","zh_ZM"];function Dn(e){if(!e)return;let t;if(e.includes("-")){const[n,r]=e.split("-");t=`${n}_${r.toUpperCase()}`}else t=`${e}_${e.toUpperCase()}`;return En.includes(t)?t:void 0}var Nn=Object.defineProperty,zn=Object.defineProperties,Gn=Object.getOwnPropertyDescriptors,Rn=Object.getOwnPropertySymbols,Bn=Object.prototype.hasOwnProperty,Ln=Object.prototype.propertyIsEnumerable,xn=(e,t,n)=>t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jn=(e,t)=>{for(var n in t||(t={}))Bn.call(t,n)&&xn(e,n,t[n]);if(Rn)for(var n of Rn(t))Ln.call(t,n)&&xn(e,n,t[n]);return e},Fn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Vn{constructor(e){this.scriptLoader=e,this.window=window}getPayPalFastlaneSdk(e,t,n,r){return Fn(this,null,function*(){if(!this.window.paypalFastlaneSdk){const i=this.getPayPalFastlaneSdkConfiguration(e,t,n,r);if(yield this.loadPayPalSdk(i),!this.window.paypalFastlaneSdk)throw new h}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r,i){return Fn(this,null,function*(){if(!this.window.paypalGooglePay||i){const i=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r);yield this.loadPayPalSdk(i)}if(!this.window.paypalGooglePay)throw new h;return this.window.paypalGooglePay})}getPayPalApmsSdk(e,t,n){return Fn(this,null,function*(){if(!this.window.paypalApms){const r=this.getPayPalApmSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.paypalApms)throw new h}return this.window.paypalApms})}getPayPalMessages(e,t,n){return Fn(this,null,function*(){if(!this.window.paypalMessages){const r=this.getPayPalSdkMessagesConfiguration(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalMessages)throw new h;return this.window.paypalMessages})}loadPayPalSdk(e){return Fn(this,arguments,function*({options:e,attributes:t}){const n=this.transformConfig(e),r=this.transformConfig(t),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(e,t,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new _(g.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:l,attributionId:c}=o,d=Dn(r);return{options:jn({"client-id":s,"merchant-id":l,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:t,intent:a},d&&{locale:d}),attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":c,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new _(g.MissingPaymentMethod);const{intent:a,clientId:s,merchantId:l,buyerCountry:c,attributionId:d,isHostedCheckoutEnabled:h,isDeveloperModeApplicable:u}=o,y=h||r,p=Dn(n);return{options:jn(jn({"client-id":s,"merchant-id":l,commit:y,components:["googlepay"],currency:t,intent:a},u&&{"buyer-country":c}),p&&{locale:p}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new _(g.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:s,attributionId:l,isDeveloperModeApplicable:c,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:h=[]}=r,u=h,y=d.filter(e=>!h.includes(e)),p=Dn(n);return{options:jn(jn({"client-id":o,"merchant-id":a,"enable-funding":u.length>0?u:void 0,"disable-funding":y.length>0?y:void 0,commit:!0,components:["buttons","payment-fields"],currency:t,intent:i},c&&{"buyer-country":s}),p&&{locale:p}),attributes:{"data-partner-attribution-id":l,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new _(g.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:s,buyerCountry:l}=r,c=Dn(n);return{options:jn(jn({"client-id":i,"merchant-id":o,components:["messages"],currency:t},s&&{"buyer-country":l}),c&&{locale:c}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":a}}}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];var i,o;null==r||""===r||Array.isArray(r)&&0===r.length||(i=jn({},t),o={[n]:Array.isArray(r)?r.join(","):r},t=zn(i,Gn(o)))}),t}}function Un(e){if(!function(e){return!!e.initializationData&&"attributionId"in e.initializationData&&"isVenmoEnabled"in e.initializationData&&"isGooglePayEnabled"in e.initializationData&&"isPayPalCreditAvailable"in e.initializationData}(e))throw new _(g.MissingPaymentMethod)}var Wn=Object.getPrototypeOf,Hn=Reflect.get,qn=(e,t,n)=>Hn(Wn(e),n,t),Kn=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Zn extends Q{constructor(e,t){super("paypalsb",e),this.payPalCommerceSdk=t,this.service=e}initialize(e,t,n){return Kn(this,null,function*(){var r,i,o,a,s;const l=this.service.getState(),c=null!=(i=null==(r=l.getStoreConfig())?void 0:r.currency.code)?i:n;if(!c)throw new _(g.MissingPaymentMethod);yield qn(Zn.prototype,this,"initialize").call(this,e,t,c);const d=qn(Zn.prototype,this,"getPaymentMethod").call(this);if(!d.initializationData)throw new _(g.MissingPaymentMethod);Un(d);const h=yield this.payPalCommerceSdk.getPayPalGooglePaySdk(d,c,l.getLocale());this.googlepayConfig=yield h.Googlepay().config();const{allowedPaymentMethods:u}=this.googlepayConfig;this.setGatewayIdentifier(null==(s=null==(a=null==(o=u[0])?void 0:o.tokenizationSpecification)?void 0:a.parameters)?void 0:s.gateway)})}getPaymentGatewayParameters(){if(this.googlepayConfig){const{allowedPaymentMethods:e}=this.googlepayConfig,{gatewayMerchantId:t}=e[0].tokenizationSpecification.parameters;return{gateway:this.getGatewayIdentifier(),gatewayMerchantId:t}}return{gateway:this.getGatewayIdentifier()}}mapToExternalCheckoutData(e){return Kn(this,null,function*(){const t=yield qn(Zn.prototype,this,"mapToExternalCheckoutData").call(this,e);return t.nonce=btoa(t.nonce),t})}}const Jn="This API endpoint is for internal use only and may change in the future";var Yn=Object.defineProperty,Xn=Object.getOwnPropertySymbols,Qn=Object.prototype.hasOwnProperty,$n=Object.prototype.propertyIsEnumerable,er=(e,t,n)=>t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function tr(e){const t=e.getState().getBillingAddress();if(!t)return;const{firstName:n,lastName:r,address1:i,address2:o,city:a,stateOrProvinceCode:s,countryCode:l,postalCode:c,phone:d}=t,h=`${n} ${r}`.trim();return h&&l?((e,t)=>{for(var n in t||(t={}))Qn.call(t,n)&&er(e,n,t[n]);if(Xn)for(var n of Xn(t))$n.call(t,n)&&er(e,n,t[n]);return e})({name:h,address1:i,address2:o,address3:"",locality:a,administrativeArea:s,countryCode:l,postalCode:c,sortingCode:""},d&&{phoneNumber:d}):void 0}var nr=(e=>(e.Approved="APPROVED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e))(nr||{}),rr=Object.defineProperty,ir=Object.getOwnPropertySymbols,or=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable,sr=(e,t,n)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lr=(e,t)=>{for(var n in t||(t={}))or.call(t,n)&&sr(e,n,t[n]);if(ir)for(var n of ir(t))ar.call(t,n)&&sr(e,n,t[n]);return e},cr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class dr extends We{constructor(e,t,n,r){super(e,t),this._payPalCommerceSdk=n,this._requestSender=r}execute(e){return cr(this,arguments,function*({payment:e}){if(!(null==e?void 0:e.methodId))throw new me(["payment"]);const t=this._paymentIntegrationService.getState(),n=t.getCartOrThrow().id,{initializationData:r}=t.getPaymentMethodOrThrow(this._getMethodId()),{orderId:i}=yield this.getOrderId(n),{card_information:o}=r||{},a=yield this._googlePayPaymentProcessor.getNonce(e.methodId),s={tokenizationData:{type:"PAYMENT_GATEWAY",token:atob(a)},info:{cardNetwork:(null==o?void 0:o.type)||"",cardDetails:(null==o?void 0:o.number)||""},type:"CARD"};yield this.confirmOrder(i,s),yield this._paymentIntegrationService.submitOrder();try{const t={formattedPayload:{method_id:e.methodId,paypal_account:{order_id:i}}};yield this._paymentIntegrationService.submitPayment({methodId:e.methodId,paymentData:t})}catch(t){yield this._handleSubmitPaymentFailure(t,e.methodId)}})}finalize(){return Promise.reject(new Pe)}confirmOrder(e,t){return cr(this,null,function*(){const n=this._paymentIntegrationService.getState(),r=n.getPaymentMethodOrThrow(this._getMethodId());if(!r.initializationData)throw new _(g.MissingPaymentMethod);const i=n.getCartOrThrow().currency.code,o=yield this._payPalCommerceSdk.getPayPalGooglePaySdk(r,i,n.getLocale(),!0),a=tr(this._paymentIntegrationService),{status:s}=yield o.Googlepay().confirmOrder(lr({orderId:e,paymentMethodData:t},a&&{billingAddress:a}));if(s===nr.PayerActionRequired)return yield o.Googlepay().initiatePayerAction({orderId:e}),Promise.resolve();if(s!==nr.Approved)throw new S("Payment is not approved.");return Promise.resolve()})}getOrderId(e){return cr(this,null,function*(){const t={cartId:e,shouldSaveInstrument:!1},{body:n}=yield this._requestSender.post("/api/storefront/payments/googlepaypaypalcommercecheckout",{headers:lr({"X-API-INTERNAL":Jn,"Content-Type":Pt.Json},ie),body:t});return n})}}const hr=y(r=>{const i=new Vn(n());return new dr(r,new _e(Xe(),new Zn(r,i),t(),e()),i,t())},[{id:"googlepaypaypalcommerce"}]);var ur=Object.defineProperty,yr=Object.defineProperties,pr=Object.getOwnPropertyDescriptors,gr=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,Pr=(e,t,n)=>t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fr=(e,t)=>{for(var n in t||(t={}))_r.call(t,n)&&Pr(e,n,t[n]);if(gr)for(var n of gr(t))mr.call(t,n)&&Pr(e,n,t[n]);return e},wr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class br{constructor(e){this.scriptLoader=e,this.window=window}getPayPalFastlaneSdk(e,t,n){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.bigCommercePaymentsFastlaneSdk)throw new h}return this.window.bigCommercePaymentsFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.bigCommercePaymentsGooglePay)throw new h;return this.window.bigCommercePaymentsGooglePay})}getPayPalApmsSdk(e,t){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsApms){const n=this.getPayPalApmSdkConfiguration(e,t);if(yield this.loadPayPalSdk(n),!this.window.bigCommercePaymentsApms)throw new h}return this.window.bigCommercePaymentsApms})}getPayPalMessages(e,t){return wr(this,null,function*(){if(!this.window.bigCommercePaymentsMessages){const n=this.getPayPalSdkMessagesConfiguration(e,t);yield this.loadPayPalSdk(n)}if(!this.window.bigCommercePaymentsMessages)throw new h;return this.window.bigCommercePaymentsMessages})}loadPayPalSdk(e){return wr(this,arguments,function*({options:e,attributes:t}){const n=this.transformConfig(e),r=this.transformConfig(t),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(e,t,n){const{clientToken:r,initializationData:i}=e;if(!i||!i.clientId)throw new _(g.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:s,attributionId:l}=i;return{options:{"client-id":a,"merchant-id":s,commit:!0,components:["fastlane","three-domain-secure"],currency:t,intent:o},attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"bigCommercePaymentsFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":r}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n=!0){const{clientToken:r,initializationData:i}=e;if(!i||!i.clientId)throw new _(g.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:s,buyerCountry:l,attributionId:c,isHostedCheckoutEnabled:d,isDeveloperModeApplicable:h}=i;return{options:fr({"client-id":a,"merchant-id":s,commit:d||n,components:["googlepay"],currency:t,intent:o},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":c,"data-client-token":r,"data-namespace":"bigCommercePaymentsGooglePay"}}}getPayPalApmSdkConfiguration(e,t){const{initializationData:n}=e;if(!n||!n.clientId)throw new _(g.MissingPaymentMethod);const{intent:r,clientId:i,merchantId:o,buyerCountry:a,attributionId:s,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:c=[],enabledAlternativePaymentMethods:d=[]}=n,h=this.filterFundingOptions(d),u=this.filterFundingOptions(c.filter(e=>!d.includes(e)));return{options:fr({"client-id":i,"merchant-id":o,"enable-funding":h.length>0?h:void 0,"disable-funding":u.length>0?u:void 0,commit:!0,components:["buttons","payment-fields"],currency:t,intent:r},l&&{"buyer-country":a}),attributes:{"data-partner-attribution-id":s,"data-namespace":"bigCommercePaymentsApms"}}}getPayPalSdkMessagesConfiguration(e,t){const{initializationData:n}=e;if(!n||!n.clientId)throw new _(g.MissingPaymentMethod);const{clientId:r,merchantId:i,attributionId:o,isDeveloperModeApplicable:a,buyerCountry:s}=n;return{options:fr({"client-id":r,"merchant-id":i,components:["messages"],currency:t},a&&{"buyer-country":s}),attributes:{"data-namespace":"bigCommercePaymentsMessages","data-partner-attribution-id":o}}}filterFundingOptions(e){const t=["klarna","afterpay"];return e?e.filter(e=>!t.includes(e)):[]}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];var i,o;null==r||""===r||Array.isArray(r)&&0===r.length||(i=fr({},t),o={[n]:Array.isArray(r)?r.join(","):r},t=yr(i,pr(o)))}),t}}var Sr=Object.getPrototypeOf,Cr=Reflect.get,vr=(e,t,n)=>Cr(Sr(e),n,t),Ir=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Or extends Q{constructor(e,t){super("googlepay_bigcommerce_payments",e),this.payPalSdkHelper=t,this.service=e}initialize(e,t,n){return Ir(this,null,function*(){var r,i,o,a,s;const l=null!=(i=null==(r=this.service.getState().getStoreConfig())?void 0:r.currency.code)?i:n;if(!l)throw new _(g.MissingPaymentMethod);yield vr(Or.prototype,this,"initialize").call(this,e,t,l);const c=vr(Or.prototype,this,"getPaymentMethod").call(this);if(!c.initializationData)throw new _(g.MissingPaymentMethod);Un(c);const d=yield this.payPalSdkHelper.getPayPalGooglePaySdk(c,l);this.googlepayConfig=yield d.Googlepay().config();const{allowedPaymentMethods:h}=this.googlepayConfig;this.setGatewayIdentifier(null==(s=null==(a=null==(o=h[0])?void 0:o.tokenizationSpecification)?void 0:a.parameters)?void 0:s.gateway)})}getPaymentGatewayParameters(){if(this.googlepayConfig){const{allowedPaymentMethods:e}=this.googlepayConfig,{gatewayMerchantId:t}=e[0].tokenizationSpecification.parameters;return{gateway:this.getGatewayIdentifier(),gatewayMerchantId:t}}return{gateway:this.getGatewayIdentifier()}}mapToExternalCheckoutData(e){return Ir(this,null,function*(){const t=yield vr(Or.prototype,this,"mapToExternalCheckoutData").call(this,e);return t.nonce=btoa(t.nonce),t})}}var Ar=(e=>(e.Approved="APPROVED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e))(Ar||{}),Tr=Object.defineProperty,Mr=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,Er=Object.prototype.propertyIsEnumerable,Dr=(e,t,n)=>t in e?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t)=>{for(var n in t||(t={}))kr.call(t,n)&&Dr(e,n,t[n]);if(Mr)for(var n of Mr(t))Er.call(t,n)&&Dr(e,n,t[n]);return e},zr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Gr extends We{constructor(e,t,n,r){super(e,t),this._payPalSdkHelper=n,this._requestSender=r}execute(e){return zr(this,arguments,function*({payment:e}){if(!(null==e?void 0:e.methodId))throw new me(["payment"]);const t=this._paymentIntegrationService.getState(),n=t.getCartOrThrow().id,{initializationData:r}=t.getPaymentMethodOrThrow(this._getMethodId()),{orderId:i}=yield this.getOrderId(n),{card_information:o}=r||{},a=yield this._googlePayPaymentProcessor.getNonce(e.methodId),s={tokenizationData:{type:"PAYMENT_GATEWAY",token:atob(a)},info:{cardNetwork:(null==o?void 0:o.type)||"",cardDetails:(null==o?void 0:o.number)||""},type:"CARD"};yield this.confirmOrder(i,s),yield this._paymentIntegrationService.submitOrder();try{const t={formattedPayload:{method_id:e.methodId,paypal_account:{order_id:i}}};yield this._paymentIntegrationService.submitPayment({methodId:e.methodId,paymentData:t})}catch(t){yield this._handleSubmitPaymentFailure(t,e.methodId)}})}finalize(){return Promise.reject(new Pe)}confirmOrder(e,t){return zr(this,null,function*(){const n=this._paymentIntegrationService.getState(),r=n.getPaymentMethodOrThrow(this._getMethodId());if(!r.initializationData)throw new _(g.MissingPaymentMethod);const i=n.getCartOrThrow().currency.code,o=yield this._payPalSdkHelper.getPayPalGooglePaySdk(r,i,!0),a=tr(this._paymentIntegrationService),{status:s}=yield o.Googlepay().confirmOrder(Nr({orderId:e,paymentMethodData:t},a&&{billingAddress:a}));if(s===Ar.PayerActionRequired)return yield o.Googlepay().initiatePayerAction({orderId:e}),Promise.resolve();if(s!==Ar.Approved)throw new S("Payment is not approved.");return Promise.resolve()})}getOrderId(e){return zr(this,null,function*(){const t={cartId:e,shouldSaveInstrument:!1},{body:n}=yield this._requestSender.post("/api/storefront/payments/googlepay_bigcommerce_paymentscheckout",{headers:Nr({"X-API-INTERNAL":Jn,"Content-Type":Pt.Json},ie),body:t});return n})}}const Rr=y(r=>{const i=new br(n());return new Gr(r,new _e(Xe(),new Or(r,i),t(),e()),i,t())},[{id:"googlepay_bigcommerce_payments"}]);var Br=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Lr extends Q{constructor(e,t){super("worldlinena",e),this.formPoster=t}extraPaymentData(){return Br(this,null,function*(){return Promise.resolve({browser_info:m()})})}processAdditionalAction(e){return Br(this,null,function*(){if(!function(e){return P(e)&&(t=e.body,s(t)&&"object"==typeof t&&"errors"in t&&"three_ds_result"in t&&a(t.errors)&&c(t.errors,{code:"three_d_secure_required"}));var t}(e))throw e;const{three_ds_result:t}=e.body,{acs_url:n,payer_auth_request:r,merchant_data:i}=t||{};if(!n||!r||!i)throw new me(["formUrl","threeDSSessionData","creq"]);return new Promise(e=>{this.formPoster.postForm(n,{threeDSSessionData:r,creq:i},e,"_top")})})}}const xr=y(n=>new We(n,new _e(Xe(),new Lr(n,e()),t(),e())),[{id:"googlepaytdonlinemart"}]);class jr extends d{constructor(e){super(e||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var Fr=Object.defineProperty,Vr=Object.defineProperties,Ur=Object.getOwnPropertyDescriptors,Wr=Object.getOwnPropertySymbols,Hr=Object.prototype.hasOwnProperty,qr=Object.prototype.propertyIsEnumerable,Kr=(e,t,n)=>t in e?Fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zr=(e,t)=>{for(var n in t||(t={}))Hr.call(t,n)&&Kr(e,n,t[n]);if(Wr)for(var n of Wr(t))qr.call(t,n)&&Kr(e,n,t[n]);return e},Jr=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Yr{constructor(e,t){this._paymentIntegrationService=e,this._googlePayPaymentProcessor=t}initialize(e){return Jr(this,null,function*(){var t,n;if(!(null==e?void 0:e.methodId)||!Ne(e.methodId))throw new S('Unable to proceed because "methodId" is not a valid key.');this._methodId=e.methodId;const r=e[this._getMethodId()];if(!r)throw new S("Unable to proceed without valid options.");let i,o=this._paymentIntegrationService.getState();try{i=o.getPaymentMethodOrThrow(this._getMethodId())}catch(e){o=yield this._paymentIntegrationService.loadPaymentMethod(this._getMethodId()),i=o.getPaymentMethodOrThrow(this._getMethodId())}try{this._googlePayPaymentProcessor.setIsWebViewExperimentOn(!!(null==(t=i.initializationData)?void 0:t.isWebViewExperimentOn)),this._googlePayPaymentProcessor.setFilterAvailableShippingOptions(r.filterAvailableShippingOptions),yield this._googlePayPaymentProcessor.initialize(()=>i,this._getGooglePayClientOptions(null==(n=i.initializationData)?void 0:n.storeCountry))}catch(e){return}this._addPaymentButton(r)})}signIn(){return Promise.reject(new jr('In order to sign in via Google Pay, the shopper must click on "Google Pay" button.'))}signOut(){return Jr(this,null,function*(){var e;const t=null==(e=this._paymentIntegrationService.getState().getPaymentId())?void 0:e.providerId;t&&(yield this._googlePayPaymentProcessor.signOut(t))})}executePaymentMethodCheckout(e){var t;return null==(t=null==e?void 0:e.continueWithCheckoutCallback)||t.call(e),Promise.resolve()}deinitialize(){var e;return null==(e=this._paymentButton)||e.remove(),this._paymentButton=void 0,this._methodId=void 0,Promise.resolve()}_getGooglePayClientOptions(e){return this._googlePayPaymentProcessor.isWebViewWithRestrictions()?{}:{paymentDataCallbacks:{onPaymentDataChanged:t=>Jr(this,[t],function*({callbackTrigger:t,shippingAddress:n,shippingOptionData:r,offerData:i}){const{availableTriggers:o,addressChangeTriggers:a,shippingOptionsChangeTriggers:s,offerChangeTriggers:l}=this._googlePayPaymentProcessor.getCallbackTriggers();if(!o.includes(t))return;const c=a.includes(t)?yield this._googlePayPaymentProcessor.handleShippingAddressChange(n):void 0;s.includes(t)&&(yield this._googlePayPaymentProcessor.handleShippingOptionChange(r.id));const{newOfferInfo:d,error:h}=l.includes(t)?yield this._googlePayPaymentProcessor.handleCoupons(i):{},u=h;yield this._paymentIntegrationService.loadCheckout();const y=this._googlePayPaymentProcessor.getTotalPrice(),{code:p}=this._paymentIntegrationService.getState().getCartOrThrow().currency;return Zr(Zr(Zr({newTransactionInfo:(g=Zr({},e&&{countryCode:e}),_={currencyCode:p,totalPriceStatus:R.FINAL,totalPrice:y},Vr(g,Ur(_)))},c&&{newShippingOptionParameters:c}),d&&{newOfferInfo:d}),u&&{error:u});var g,_})}}}_addPaymentButton({container:e,buttonColor:t,buttonType:n,onClick:r,onError:i}){var o;this._paymentButton=null!=(o=this._paymentButton)?o:this._googlePayPaymentProcessor.addPaymentButton(e,{buttonColor:null!=t?t:"default",buttonType:null!=n?n:"plain",onClick:this._handleClick(i,r)})}_handleClick(e,t){return n=>Jr(this,null,function*(){n.preventDefault(),t&&"function"==typeof t&&t();try{yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheet()}catch(t){let n=t;if(Ee(t)){if("CANCELED"===t.statusCode)throw new f;n=new oe(JSON.stringify(t))}throw null==e||e(new oe("An error occurred while requesting your Google Pay payment details.")),n}})}_interactWithPaymentSheet(){return Jr(this,null,function*(){const e=yield this._googlePayPaymentProcessor.showPaymentSheet(),t=this._googlePayPaymentProcessor.mapToBillingAddressRequestBody(e),n=this._googlePayPaymentProcessor.mapToShippingAddressRequestBody(e),r="/embedded-checkout"===window.location.pathname?this._paymentIntegrationService.getState().getStoreConfigOrThrow().links.siteLink:void 0;t&&(yield this._paymentIntegrationService.updateBillingAddress(t)),n&&(yield this._paymentIntegrationService.updateShippingAddress(n)),yield this._googlePayPaymentProcessor.setExternalCheckoutForm(this._getMethodId(),e,r)})}_getMethodId(){return N(this._methodId,()=>new b(w.PaymentNotInitialized))}}const Xr=y(n=>{const r=t();return new Yr(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv2"}]),Qr=y(n=>{const r=t();return new Yr(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv3"}]),$r=y(n=>new Yr(n,new _e(Xe(),new gt(n),t(),e())),[{id:"googlepayauthorizenet"}]),ei=y(n=>{const r=t();return new Yr(n,new _e(Xe(),new Ct(n,r),r,e()))},[{id:"googlepaycheckoutcom"}]),ti=y(n=>new Yr(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaycybersourcev2"}]),ni=y(n=>new Yr(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaybnz"}]),ri=y(n=>new Yr(n,new _e(Xe(),new Et(n),t(),e())),[{id:"googlepayorbital"}]),ii=y(r=>new Yr(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripe"},{id:"googlepaystripeocs"}]),oi=y(r=>new Yr(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripeupe"}]),ai=y(n=>new Yr(n,new _e(Xe(),new $t(n),t(),e())),[{id:"googlepayworldpayaccess"}]),si=y(r=>{const i=t(),o=window,a=new on(r),s=new pn(new Pn(n(),o,a));return new Yr(r,new _e(Xe(),new Mn(r,s),i,e()))},[{id:"googlepaybraintree"}]),li=y(r=>new Yr(r,new _e(Xe(),new Zn(r,new Vn(n())),t(),e())),[{id:"googlepaypaypalcommerce"}]),ci=y(r=>new Yr(r,new _e(Xe(),new Or(r,new br(n())),t(),e())),[{id:"googlepay_bigcommerce_payments"}]),di=y(n=>new Yr(n,new _e(Xe(),new Lr(n,e()),t(),e())),[{id:"googlepaytdonlinemart"}]);class hi extends d{constructor(e){super(e||"An unexpected error has occurred during buy now cart creation process. Please try again later."),this.name="BuyNowCartCreationError",this.type="buy_now_cart_creation_error"}}var ui=Object.defineProperty,yi=Object.defineProperties,pi=Object.getOwnPropertyDescriptors,gi=Object.getOwnPropertySymbols,_i=Object.prototype.hasOwnProperty,mi=Object.prototype.propertyIsEnumerable,Pi=(e,t,n)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fi=(e,t)=>{for(var n in t||(t={}))_i.call(t,n)&&Pi(e,n,t[n]);if(gi)for(var n of gi(t))mi.call(t,n)&&Pi(e,n,t[n]);return e},wi=(e,t)=>yi(e,pi(t)),bi=(e,t,n)=>new Promise((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())});class Si{constructor(e,t){this._paymentIntegrationService=e,this._googlePayPaymentProcessor=t}initialize(e){return bi(this,null,function*(){var t,n,r;if(!e.methodId||!Ne(e.methodId))throw new S('Unable to proceed because "methodId" is not a valid key.');if(this._methodId=e.methodId,!e.containerId)throw new S('Unable to proceed because "containerId" is not a valid key.');const i=e[this._getMethodOrThrow()];if(!i)throw new S("Unable to proceed without valid options.");const{buyNowInitializeOptions:o,currencyCode:a,buttonColor:s,buttonType:l,onError:c,filterAvailableShippingOptions:d}=i;let h,u=this._paymentIntegrationService.getState();try{h=u.getPaymentMethodOrThrow(this._getMethodOrThrow())}catch(e){u=yield this._paymentIntegrationService.loadPaymentMethod(this._getMethodOrThrow()),h=u.getPaymentMethodOrThrow(this._getMethodOrThrow())}if(this._countryCode=null==(t=h.initializationData)?void 0:t.storeCountry,this._googlePayPaymentProcessor.setIsWebViewExperimentOn(!!(null==(n=h.initializationData)?void 0:n.isWebViewExperimentOn)),this._googlePayPaymentProcessor.setFilterAvailableShippingOptions(d),o){if(!a)throw new S('Unable to initialize payment because "options.currencyCode" argument is not provided.');this._currencyCode=a,this._buyNowInitializeOptions=o,yield this._googlePayPaymentProcessor.initialize(()=>h,this._getGooglePayClientOptions(),!!o,a)}else yield this._paymentIntegrationService.loadDefaultCheckout(),yield this._googlePayPaymentProcessor.initialize(()=>h,this._getGooglePayClientOptions());this._paymentButton=null!=(r=this._paymentButton)?r:this._googlePayPaymentProcessor.addPaymentButton(e.containerId,{buttonColor:null!=s?s:"default",buttonType:null!=l?l:"plain",onClick:this._handleClick(c)})})}deinitialize(){var e;return null==(e=this._paymentButton)||e.remove(),this._paymentButton=void 0,this._methodId=void 0,Promise.resolve()}_handleClick(e){return t=>bi(this,null,function*(){t.preventDefault();try{this._buyNowInitializeOptions?yield this._createBuyNowCartOrThrow(this._buyNowInitializeOptions):yield this._paymentIntegrationService.loadDefaultCheckout(),yield this._googlePayPaymentProcessor.initializeWidget(),yield this._interactWithPaymentSheet()}catch(t){let n=t;if(Ee(t)){if("CANCELED"===t.statusCode)throw new f;n=new oe(JSON.stringify(t))}throw null==e||e(new oe("An error occurred while requesting your Google Pay payment details.")),n}})}_interactWithPaymentSheet(){return bi(this,null,function*(){var e;const t=yield this._googlePayPaymentProcessor.showPaymentSheet(),n=this._googlePayPaymentProcessor.mapToBillingAddressRequestBody(t),r=this._googlePayPaymentProcessor.mapToShippingAddressRequestBody(t),i="/embedded-checkout"===window.location.pathname?this._paymentIntegrationService.getState().getStoreConfigOrThrow().links.siteLink:void 0;n&&(yield this._paymentIntegrationService.updateBillingAddress(n)),r&&!(null==(e=this._buyNowCart)?void 0:e.lineItems.digitalItems.length)&&(yield this._paymentIntegrationService.updateShippingAddress(r)),yield this._googlePayPaymentProcessor.setExternalCheckoutForm(this._getMethodOrThrow(),t,i)})}_getGooglePayClientOptions(){return this._googlePayPaymentProcessor.isWebViewWithRestrictions()?{}:{paymentDataCallbacks:{onPaymentDataChanged:e=>bi(this,[e],function*({callbackTrigger:e,shippingAddress:t,shippingOptionData:n,offerData:r}){const{availableTriggers:i,addressChangeTriggers:o,shippingOptionsChangeTriggers:a,offerChangeTriggers:s}=this._googlePayPaymentProcessor.getCallbackTriggers();if(!i.includes(e))return;const l=o.includes(e)?yield this._googlePayPaymentProcessor.handleShippingAddressChange(t):void 0;a.includes(e)&&(yield this._googlePayPaymentProcessor.handleShippingOptionChange(n.id));const{newOfferInfo:c,error:d}=s.includes(e)?yield this._googlePayPaymentProcessor.handleCoupons(r):{},h=d;return this._buyNowInitializeOptions?this._getBuyNowTransactionInfo(l,c,h):this._getTransactionInfo(l,c,h)})}}}_createBuyNowCartOrThrow(e){return bi(this,null,function*(){if("function"==typeof(null==e?void 0:e.getBuyNowCartRequestBody)){const t=e.getBuyNowCartRequestBody();try{this._buyNowCart=yield this._paymentIntegrationService.createBuyNowCart(t),yield this._paymentIntegrationService.loadCheckout(this._buyNowCart.id)}catch(e){if("string"==typeof e)throw new hi(e);throw e}}})}_getBuyNowTransactionInfo(e,t,n){if(!this._buyNowCart)return;const{cartAmount:r}=this._buyNowCart,i=this._googlePayPaymentProcessor.getTotalPrice();return fi(fi(fi({newTransactionInfo:wi(fi({},this._countryCode&&{countryCode:this._countryCode}),{currencyCode:this._getCurrencyCodeOrThrow(),totalPrice:i||String(r),totalPriceStatus:R.FINAL})},e&&{newShippingOptionParameters:e}),t&&{newOfferInfo:t}),n&&{error:n})}_getTransactionInfo(e,t,n){return bi(this,null,function*(){yield this._paymentIntegrationService.loadCheckout();const r=this._googlePayPaymentProcessor.getTotalPrice(),{code:i}=this._paymentIntegrationService.getState().getCartOrThrow().currency;return fi(fi(fi({newTransactionInfo:wi(fi({},this._countryCode&&{countryCode:this._countryCode}),{currencyCode:i,totalPriceStatus:R.FINAL,totalPrice:r})},e&&{newShippingOptionParameters:e}),t&&{newOfferInfo:t}),n&&{error:n})})}_getMethodOrThrow(){return N(this._methodId,()=>new b(w.PaymentNotInitialized))}_getCurrencyCodeOrThrow(){return N(this._currencyCode,()=>new S('Unable to initialize payment because "options.currencyCode" argument is not provided.'))}}const Ci=y(r=>{const i=t(),o=window,a=new on(r),s=new pn(new Pn(n(),o,a));return new Si(r,new _e(Xe(),new Mn(r,s),i,e()))},[{id:"googlepaybraintree"}]),vi=y(r=>new Si(r,new _e(Xe(),new Zn(r,new Vn(n())),t(),e())),[{id:"googlepaypaypalcommerce"}]),Ii=y(r=>new Si(r,new _e(Xe(),new Or(r,new br(n())),t(),e())),[{id:"googlepay_bigcommerce_payments"}]),Oi=y(n=>{const r=t();return new Si(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv2"}]),Ai=y(n=>{const r=t();return new Si(n,new _e(Xe(),new Q("adyen",n),r,e()))},[{id:"googlepayadyenv3"}]),Ti=y(n=>new Si(n,new _e(Xe(),new gt(n),t(),e())),[{id:"googlepayauthorizenet"}]),Mi=y(n=>{const r=t();return new Si(n,new _e(Xe(),new Ct(n,r),r,e()))},[{id:"googlepaycheckoutcom"}]),ki=y(n=>new Si(n,new _e(Xe(),new At(n),t(),e())),[{id:"googlepaycybersourcev2"},{id:"googlepaybnz"}]),Ei=y(n=>new Si(n,new _e(Xe(),new Et(n),t(),e())),[{id:"googlepayorbital"}]),Di=y(r=>new Si(r,new _e(Xe(),new Jt(r,new Ft(n())),t(),e())),[{id:"googlepaystripe"},{id:"googlepaystripeupe"},{id:"googlepaystripeocs"}]),Ni=y(n=>new Si(n,new _e(Xe(),new $t(n),t(),e())),[{id:"googlepayworldpayaccess"}]),zi=y(n=>new Si(n,new _e(Xe(),new Lr(n,e()),t(),e())),[{id:"googlepaytdonlinemart"}]);export{Oi as createGooglePayAdyenV2ButtonStrategy,Xr as createGooglePayAdyenV2CustomerStrategy,Qe as createGooglePayAdyenV2PaymentStrategy,Ai as createGooglePayAdyenV3ButtonStrategy,Qr as createGooglePayAdyenV3CustomerStrategy,ut as createGooglePayAdyenV3PaymentStrategy,Ti as createGooglePayAuthorizeDotNetButtonStrategy,$r as createGooglePayAuthorizeDotNetCustomerStrategy,_t as createGooglePayAuthorizeNetPaymentStrategy,Ii as createGooglePayBigCommercePaymentsButtonStrategy,ci as createGooglePayBigCommercePaymentsCustomerStrategy,Rr as createGooglePayBigCommercePaymentsPaymentStrategy,ni as createGooglePayBnzCustomerStrategy,Ci as createGooglePayBraintreeButtonStrategy,si as createGooglePayBraintreeCustomerStrategy,kn as createGooglePayBraintreePaymentStrategy,Mi as createGooglePayCheckoutComButtonStrategy,ei as createGooglePayCheckoutComCustomerStrategy,vt as createGooglePayCheckoutComPaymentStrategy,ki as createGooglePayCybersourceButtonStrategy,ti as createGooglePayCybersourceCustomerStrategy,Tt as createGooglePayCybersourcePaymentStrategy,Ei as createGooglePayOrbitalButtonStrategy,ri as createGooglePayOrbitalCustomerStrategy,Dt as createGooglePayOrbitalPaymentStrategy,hr as createGooglePayPPCPPaymentStrategy,vi as createGooglePayPayPalCommerceButtonStrategy,li as createGooglePayPayPalCommerceCustomerStrategy,Di as createGooglePayStripeButtonStrategy,ii as createGooglePayStripeCustomerStrategy,Yt as createGooglePayStripePaymentStrategy,oi as createGooglePayStripeUpeCustomerStrategy,zi as createGooglePayTdOnlineMartButtonStrategy,di as createGooglePayTdOnlineMartCustomerStrategy,xr as createGooglePayTdOnlineMartPaymentStrategy,Ni as createGooglePayWorldpayAccessButtonStrategy,ai as createGooglePayWorldpayAccessCustomerStrategy,en as createGooglePayWorldpayAccessPaymentStrategy};
|
|
2
2
|
//# sourceMappingURL=google-pay.js.map
|