diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 9a84c2ee..baadb453 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -12,7 +12,7 @@ BlueFinch_Checkout::config - BlueFinch Checkout Provided By BlueFinch Commerce]]> + BlueFinch Checkout Provided By BlueFinch Commerce]]> diff --git a/view/frontend/web/js/checkout/dist/main.min.js b/view/frontend/web/js/checkout/dist/main.min.js index 2076189b..cab64dce 100644 --- a/view/frontend/web/js/checkout/dist/main.min.js +++ b/view/frontend/web/js/checkout/dist/main.min.js @@ -1477,7 +1477,7 @@ mutation { @OPTION_TITLE
-`;function d(){s.apply(this,arguments),this._initialize()}d.prototype=Object.create(s.prototype),d.prototype.constructor=d,d.ID=d.prototype.ID="options",d.prototype._initialize=function(){this.container=this.getElementById("payment-options-container"),this.elements={},this.model.supportedPaymentOptions.forEach((function(p){this._addPaymentOption(p)}).bind(this))},d.prototype._addPaymentOption=function(p){var u,h=document.createElement("div"),f=c,y=(function(){this.mainView.setPrimaryView(p),this.model.selectPaymentOption(p),n.sendEvent(this.client,"selected."+l[p])}).bind(this);switch(h.className="braintree-option braintree-option__"+p,h.setAttribute("tabindex","0"),h.setAttribute("role","button"),p){case l.applePay:u=this.strings["Apple Pay"],f=f.replace(/@ICON/g,"logoApplePay");break;case l.card:u=this.strings.Card,f=f.replace(/@ICON/g,"iconCardFront"),f=f.replace(/@CLASSNAME/g,"braintree-icon--bordered");break;case l.googlePay:u=this.strings["Google Pay"],f=f.replace(/@ICON/g,"logoGooglePay");break;case l.paypal:u=this.strings.PayPal,f=f.replace(/@ICON/g,"logoPayPal");break;case l.paypalCredit:u=this.strings["PayPal Credit"],f=f.replace(/@ICON/g,"logoPayPalCredit");break;case l.venmo:u=this.strings.Venmo,f=f.replace(/@ICON/g,"logoVenmo");break}f=f.replace(/@OPTION_LABEL/g,this._generateOptionLabel(u)),f=f.replace(/@OPTION_TITLE/g,u),f=f.replace(/@CLASSNAME/g,""),h.innerHTML=f,o(h,y),this.container.appendChild(h),this.elements[p]={div:h,clickHandler:y}},d.prototype._generateOptionLabel=function(p){return this.strings.payingWith.replace("{{paymentSource}}",p)},i.exports=d},{"../constants":202,"../lib/add-selection-event-handler":206,"../lib/analytics":207,"./base-view":259}],265:[function(t,i,a){(function(n){(function(){var o=t("../../lib/assign").assign,s=t("../base-view"),l=t("braintree-web/apple-pay"),c=t("../../lib/dropin-error"),d=t("../../lib/is-https"),p=t("../../constants").paymentOptionIDs,u=2;function h(){s.apply(this,arguments)}h.prototype=Object.create(s.prototype),h.prototype.constructor=h,h.ID=h.prototype.ID=p.applePay,h.prototype.initialize=function(){var f=this;return f.applePayConfiguration=o({},f.model.merchantConfiguration.applePay),f.applePaySessionVersion=f.applePayConfiguration.applePaySessionVersion||u,delete f.applePayConfiguration.applePaySessionVersion,l.create({client:this.client}).then(function(y){f.buttonDiv=f.getElementById("apple-pay-button"),f.applePayInstance=y,f.buttonDiv.onclick=f._showPaymentSheet.bind(f),f.buttonDiv.style["-apple-pay-button-style"]=f.model.merchantConfiguration.applePay.buttonStyle||"black",f.model.asyncDependencyReady(h.ID)}).catch(function(y){f.model.asyncDependencyFailed({view:f.ID,error:new c(y)})})},h.prototype.requestPaymentMethod=function(){return this.model.reportError("applePayButtonMustBeUsed"),s.prototype.requestPaymentMethod.call(this)},h.prototype._showPaymentSheet=function(){var f=this,y,E;return this._sessionInProgress||(this._sessionInProgress=!0,y=this.applePayInstance.createPaymentRequest(this.applePayConfiguration.paymentRequest),E=new n.ApplePaySession(f.applePaySessionVersion,y),E.onvalidatemerchant=function(v){f.applePayInstance.performValidation({validationURL:v.validationURL,displayName:f.applePayConfiguration.displayName}).then(function(g){E.completeMerchantValidation(g)}).catch(function(g){f.model.reportError(g),f._sessionInProgress=!1,E.abort()})},E.onpaymentauthorized=function(v){f.applePayInstance.tokenize({token:v.payment.token}).then(function(g){f._sessionInProgress=!1,E.completePayment(n.ApplePaySession.STATUS_SUCCESS),g.rawPaymentData=v.payment,f.model.addPaymentMethod(g)}).catch(function(g){f.model.reportError(g),f._sessionInProgress=!1,E.completePayment(n.ApplePaySession.STATUS_FAILURE)})},E.oncancel=function(){f._sessionInProgress=!1},E.begin()),!1},h.prototype.updateConfiguration=function(f,y){this.applePayConfiguration[f]=y},h.isEnabled=function(f){var y=f.client.getConfiguration().gatewayConfiguration,E=y.applePayWeb&&!!f.merchantConfiguration.applePay,v=f.merchantConfiguration.applePay&&f.merchantConfiguration.applePay.applePaySessionVersion,g;return v=v||u,!E||(g=n.ApplePaySession&&d.isHTTPS(),!g)||!n.ApplePaySession.supportsVersion(v)?Promise.resolve(!1):Promise.resolve(!!n.ApplePaySession.canMakePayments())},i.exports=h}).call(this)}).call(this,typeof et<"u"?et:typeof self<"u"?self:typeof window<"u"?window:{})},{"../../constants":202,"../../lib/assign":208,"../../lib/dropin-error":212,"../../lib/is-https":215,"../base-view":259,"braintree-web/apple-pay":49}],266:[function(t,i,a){(function(n){(function(){var o=t("../../lib/analytics"),s=t("../../lib/assign").assign,l=t("../../lib/browser-detection"),c=t("../base-view"),d=t("braintree-web/paypal-checkout"),p=t("../../lib/dropin-error");t("../../constants"),t("@braintree/asset-loader");var u=t("../../translations").fiveCharacterLocales,h=3e4,f=["offerCredit","locale"];function y(){c.apply(this,arguments)}y.prototype=Object.create(c.prototype),y.prototype.initialize=function(){var E,v=!!this._isPayPalCredit,g=!1,_=this,T=v?"paypalCredit":"paypal",C=this.model.merchantConfiguration[T],I="#braintree--dropin__"+this.model.componentID;return this.paypalConfiguration=s({},C),E=setTimeout(function(){_.model.asyncDependencyFailed({view:_.ID,error:new p("There was an error connecting to PayPal.")})},h),d.create({client:this.client}).then(function(b){return n.paypal&&n.paypal.Buttons?b:b.loadPayPalSDK(C.sdkConfig||{})}).then(function(b){var A,m='[data-braintree-id="paypal-button"]',w=_.client.getConfiguration().gatewayConfiguration.environment==="production"?"production":"sandbox",S=_.model.merchantConfiguration.locale;_.paypalInstance=b,_.paypalConfiguration.offerCredit=!!v,A={env:w,style:_.paypalConfiguration.buttonStyle||{},commit:_.paypalConfiguration.commit,payment:function(){return b.createPayment(_.paypalConfiguration).catch(P)},onAuthorize:function(R){var B=_.paypalConfiguration.vault&&_.paypalConfiguration.vault.vaultPayPal===!1;return B&&(R.vault=!1),b.tokenizePayment(R).then(function(x){!B&&_.paypalConfiguration.flow==="vault"&&!_.model.isGuestCheckout&&(x.vaulted=!0),_.model.addPaymentMethod(x)}).catch(P)},onError:P},S&&S in u&&(_.paypalConfiguration.locale=S,A.locale=S),A.funding={disallowed:[]},Object.keys(n.paypal.FUNDING).forEach(function(R){R==="PAYPAL"||R==="CREDIT"||R==="PAYLATER"||A.funding.disallowed.push(n.paypal.FUNDING[R])}),v?(m='[data-braintree-id="paypal-credit-button"]',A.style.label="credit"):A.funding.disallowed.push(n.paypal.FUNDING.CREDIT),m=I+" "+m;const O=n.paypal.Buttons(A);O.isEligible()&&O.render(m).then(function(){_.model.asyncDependencyReady(T),g=!0,clearTimeout(E)})}).catch(P);function P(b){g?_.model.reportError(b):(_.model.asyncDependencyFailed({view:_.ID,error:b}),clearTimeout(E))}},y.prototype.requestPaymentMethod=function(){return this.model.reportError("paypalButtonMustBeUsed"),c.prototype.requestPaymentMethod.call(this)},y.prototype.updateConfiguration=function(E,v){f.indexOf(E)===-1&&(this.paypalConfiguration[E]=v)},y.isEnabled=function(E){var v=E.client.getConfiguration().gatewayConfiguration;return E.merchantConfiguration.paypal||E.merchantConfiguration.paypalCredit,v.paypalEnabled?l.isIe9()||l.isIe10()?(o.sendEvent(E.client,E.viewID+".checkout.js-browser-not-supported"),Promise.resolve(!1)):Promise.resolve(!0):Promise.resolve(!1)},i.exports=y}).call(this)}).call(this,typeof et<"u"?et:typeof self<"u"?self:typeof window<"u"?window:{})},{"../../constants":202,"../../lib/analytics":207,"../../lib/assign":208,"../../lib/browser-detection":209,"../../lib/dropin-error":212,"../../translations":242,"../base-view":259,"@braintree/asset-loader":1,"braintree-web/paypal-checkout":128}],267:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../base-view"),s=t("../../constants"),l=t("../../lib/dropin-error"),c=t("braintree-web/hosted-fields"),d=t("../../lib/is-utf-8"),p=t("../../lib/transition-helper"),u=`
+`;function d(){s.apply(this,arguments),this._initialize()}d.prototype=Object.create(s.prototype),d.prototype.constructor=d,d.ID=d.prototype.ID="options",d.prototype._initialize=function(){this.container=this.getElementById("payment-options-container"),this.elements={},this.model.supportedPaymentOptions.forEach((function(p){this._addPaymentOption(p)}).bind(this))},d.prototype._addPaymentOption=function(p){var u,h=document.createElement("div"),f=c,y=(function(){this.mainView.setPrimaryView(p),this.model.selectPaymentOption(p),n.sendEvent(this.client,"selected."+l[p])}).bind(this);switch(h.className="braintree-option braintree-option__"+p,h.setAttribute("tabindex","0"),h.setAttribute("role","button"),p){case l.applePay:u=this.strings["Apple Pay"],f=f.replace(/@ICON/g,"logoApplePay");break;case l.card:u=this.strings.Card,f=f.replace(/@ICON/g,"iconCardFront"),f=f.replace(/@CLASSNAME/g,"braintree-icon--bordered");break;case l.googlePay:u=this.strings["Google Pay"],f=f.replace(/@ICON/g,"logoGooglePay");break;case l.paypal:u=this.strings.PayPal,f=f.replace(/@ICON/g,"logoPayPal");break;case l.paypalCredit:u=this.strings["PayPal Credit"],f=f.replace(/@ICON/g,"logoPayPalCredit");break;case l.venmo:u=this.strings.Venmo,f=f.replace(/@ICON/g,"logoVenmo");break}f=f.replace(/@OPTION_LABEL/g,this._generateOptionLabel(u)),f=f.replace(/@OPTION_TITLE/g,u),f=f.replace(/@CLASSNAME/g,""),h.innerHTML=f,o(h,y),this.container.appendChild(h),this.elements[p]={div:h,clickHandler:y}},d.prototype._generateOptionLabel=function(p){return this.strings.payingWith.replace("{{paymentSource}}",p)},i.exports=d},{"../constants":202,"../lib/add-selection-event-handler":206,"../lib/analytics":207,"./base-view":259}],265:[function(t,i,a){(function(n){(function(){var o=t("../../lib/assign").assign,s=t("../base-view"),l=t("braintree-web/apple-pay"),c=t("../../lib/dropin-error"),d=t("../../lib/is-https"),p=t("../../constants").paymentOptionIDs,u=2;function h(){s.apply(this,arguments)}h.prototype=Object.create(s.prototype),h.prototype.constructor=h,h.ID=h.prototype.ID=p.applePay,h.prototype.initialize=function(){var f=this;return f.applePayConfiguration=o({},f.model.merchantConfiguration.applePay),f.applePaySessionVersion=f.applePayConfiguration.applePaySessionVersion||u,delete f.applePayConfiguration.applePaySessionVersion,l.create({client:this.client}).then(function(y){f.buttonDiv=f.getElementById("apple-pay-button"),f.applePayInstance=y,f.buttonDiv.onclick=f._showPaymentSheet.bind(f),f.buttonDiv.style["-apple-pay-button-style"]=f.model.merchantConfiguration.applePay.buttonStyle||"black",f.model.asyncDependencyReady(h.ID)}).catch(function(y){f.model.asyncDependencyFailed({view:f.ID,error:new c(y)})})},h.prototype.requestPaymentMethod=function(){return this.model.reportError("applePayButtonMustBeUsed"),s.prototype.requestPaymentMethod.call(this)},h.prototype._showPaymentSheet=function(){var f=this,y,E;return this._sessionInProgress||(this._sessionInProgress=!0,y=this.applePayInstance.createPaymentRequest(this.applePayConfiguration.paymentRequest),E=new n.ApplePaySession(f.applePaySessionVersion,y),E.onvalidatemerchant=function(v){f.applePayInstance.performValidation({validationURL:v.validationURL,displayName:f.applePayConfiguration.displayName}).then(function(g){E.completeMerchantValidation(g)}).catch(function(g){f.model.reportError(g),f._sessionInProgress=!1,E.abort()})},E.onpaymentauthorized=function(v){f.applePayInstance.tokenize({token:v.payment.token}).then(function(g){f._sessionInProgress=!1,E.completePayment(n.ApplePaySession.STATUS_SUCCESS),g.rawPaymentData=v.payment,f.model.addPaymentMethod(g)}).catch(function(g){f.model.reportError(g),f._sessionInProgress=!1,E.completePayment(n.ApplePaySession.STATUS_FAILURE)})},E.oncancel=function(){f._sessionInProgress=!1},E.begin()),!1},h.prototype.updateConfiguration=function(f,y){this.applePayConfiguration[f]=y},h.isEnabled=function(f){var y=f.client.getConfiguration().gatewayConfiguration,E=y.applePayWeb&&!!f.merchantConfiguration.applePay,v=f.merchantConfiguration.applePay&&f.merchantConfiguration.applePay.applePaySessionVersion,g;return v=v||u,!E||(g=n.ApplePaySession&&d.isHTTPS(),!g)||!n.ApplePaySession.supportsVersion(v)?Promise.resolve(!1):Promise.resolve(!!n.ApplePaySession.canMakePayments())},i.exports=h}).call(this)}).call(this,typeof et<"u"?et:typeof self<"u"?self:typeof window<"u"?window:{})},{"../../constants":202,"../../lib/assign":208,"../../lib/dropin-error":212,"../../lib/is-https":215,"../base-view":259,"braintree-web/apple-pay":49}],266:[function(t,i,a){(function(n){(function(){var o=t("../../lib/analytics"),s=t("../../lib/assign").assign,l=t("../../lib/browser-detection"),c=t("../base-view"),d=t("braintree-web/paypal-checkout"),p=t("../../lib/dropin-error");t("../../constants"),t("@braintree/asset-loader");var u=t("../../translations").fiveCharacterLocales,h=3e4,f=["offerCredit","locale"];function y(){c.apply(this,arguments)}y.prototype=Object.create(c.prototype),y.prototype.initialize=function(){var E,v=!!this._isPayPalCredit,g=!1,_=this,T=v?"paypalCredit":"paypal",C=this.model.merchantConfiguration[T],I="#braintree--dropin__"+this.model.componentID;return this.paypalConfiguration=s({},C),E=setTimeout(function(){_.model.asyncDependencyFailed({view:_.ID,error:new p("There was an error connecting to PayPal.")})},h),d.create({client:this.client}).then(function(b){return n.paypal&&n.paypal.Buttons?b:b.loadPayPalSDK(C.sdkConfig||{})}).then(function(b){var A,m='[data-braintree-id="paypal-button"]',w=_.client.getConfiguration().gatewayConfiguration.environment==="production"?"production":"sandbox",S=_.model.merchantConfiguration.locale;_.paypalInstance=b,_.paypalConfiguration.offerCredit=!!v,A={env:w,style:_.paypalConfiguration.buttonStyle||{},commit:_.paypalConfiguration.commit,payment:function(){return b.createPayment(_.paypalConfiguration).catch(P)},createOrder:function(R,B){return B.order.create({purchase_units:[{amount:{currency_code:_.paypalConfiguration.sdkConfig.currency,value:_.paypalConfiguration.amount}}]})},onApprove:R=>b.tokenizePayment(R).then(function(B){var x=_.paypalConfiguration.vault&&_.paypalConfiguration.vault.vaultPayPal===!1;x&&(R.vault=!1),!x&&_.paypalConfiguration.flow==="vault"&&!_.model.isGuestCheckout&&(B.vaulted=!0),_.model.addPaymentMethod(B)}).catch(P),onAuthorize:function(R){var B=_.paypalConfiguration.vault&&_.paypalConfiguration.vault.vaultPayPal===!1;return B&&(R.vault=!1),b.tokenizePayment(R).then(function(x){!B&&_.paypalConfiguration.flow==="vault"&&!_.model.isGuestCheckout&&(x.vaulted=!0),_.model.addPaymentMethod(x)}).catch(P)},onError:P},S&&S in u&&(_.paypalConfiguration.locale=S,A.locale=S),A.funding={disallowed:[]},Object.keys(n.paypal.FUNDING).forEach(function(R){R==="PAYPAL"||R==="CREDIT"||R==="PAYLATER"||A.funding.disallowed.push(n.paypal.FUNDING[R])}),v?(m='[data-braintree-id="paypal-credit-button"]',A.style.label="credit"):A.funding.disallowed.push(n.paypal.FUNDING.CREDIT),m=I+" "+m;const O=n.paypal.Buttons(A);O.isEligible()&&O.render(m).then(function(){_.model.asyncDependencyReady(T),g=!0,clearTimeout(E)})}).catch(P);function P(b){g?_.model.reportError(b):(_.model.asyncDependencyFailed({view:_.ID,error:b}),clearTimeout(E))}},y.prototype.requestPaymentMethod=function(){return this.model.reportError("paypalButtonMustBeUsed"),c.prototype.requestPaymentMethod.call(this)},y.prototype.updateConfiguration=function(E,v){f.indexOf(E)===-1&&(this.paypalConfiguration[E]=v)},y.isEnabled=function(E){var v=E.client.getConfiguration().gatewayConfiguration;return E.merchantConfiguration.paypal||E.merchantConfiguration.paypalCredit,v.paypalEnabled?l.isIe9()||l.isIe10()?(o.sendEvent(E.client,E.viewID+".checkout.js-browser-not-supported"),Promise.resolve(!1)):Promise.resolve(!0):Promise.resolve(!1)},i.exports=y}).call(this)}).call(this,typeof et<"u"?et:typeof self<"u"?self:typeof window<"u"?window:{})},{"../../constants":202,"../../lib/analytics":207,"../../lib/assign":208,"../../lib/browser-detection":209,"../../lib/dropin-error":212,"../../translations":242,"../base-view":259,"@braintree/asset-loader":1,"braintree-web/paypal-checkout":128}],267:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../base-view"),s=t("../../constants"),l=t("../../lib/dropin-error"),c=t("braintree-web/hosted-fields"),d=t("../../lib/is-utf-8"),p=t("../../lib/transition-helper"),u=`
@@ -1535,7 +1535,7 @@ The braintree-hidden class should be removed here once we get icons for these c
-`,h=["empty","inputSubmitRequest","binAvailable"],f=["number","expirationDate","cvv","postalCode","cardholderName"];function y(){o.apply(this,arguments)}y.prototype=Object.create(o.prototype),y.prototype.constructor=y,y.ID=y.prototype.ID=s.paymentOptionIDs.card,y.prototype.initialize=function(){var P,b,A,m=this.getElementById("cardholder-name-field-group");return this.model.merchantConfiguration.card&&this.model.merchantConfiguration.card!==!0?this.merchantConfiguration=this.model.merchantConfiguration.card:this.merchantConfiguration={},this.merchantConfiguration.vault=this.merchantConfiguration.vault||{},this.hasCardholderName=!!this.merchantConfiguration.cardholderName,this.cardholderNameRequired=this.hasCardholderName&&this.merchantConfiguration.cardholderName.required===!0,A=this._generateHostedFieldsOptions(),this._renderCardIcons(),this._hideUnsupportedCardIcons(),this.hasCVV=A.fields.cvv,this.saveCardInput=this.getElementById("save-card-input"),this.cardNumberIcon=this.getElementById("card-number-icon"),this.cardNumberIconSvg=this.getElementById("card-number-icon-svg"),this.cvvIcon=this.getElementById("cvv-icon"),this.cvvIconSvg=this.getElementById("cvv-icon-svg"),this.cvvLabelDescriptor=this.getElementById("cvv-label-descriptor"),this.fieldErrors={},this.hasCardholderName||(m.parentNode.removeChild(m),f=f.filter(function(w){return w!=="cardholderName"})),this.hasCVV||(P=this.getElementById("cvv-field-group"),P.parentNode.removeChild(P),f=f.filter(function(w){return w!=="cvv"})),A.fields.postalCode||(b=this.getElementById("postal-code-field-group"),b.parentNode.removeChild(b),f=f.filter(function(w){return w!=="postalCode"})),!this.model.isGuestCheckout&&this.merchantConfiguration.vault.allowVaultCardOverride===!0&&this.getElementById("save-card-field-group").classList.remove("braintree-hidden"),this.merchantConfiguration.vault.vaultCard===!1&&(this.saveCardInput.checked=!1),c.create(A).then((function(w){this.hostedFieldsInstance=w,this.hostedFieldsInstance.on("blur",this._onBlurEvent.bind(this)),this.hostedFieldsInstance.on("cardTypeChange",this._onCardTypeChangeEvent.bind(this)),this.hostedFieldsInstance.on("focus",this._onFocusEvent.bind(this)),this.hostedFieldsInstance.on("notEmpty",this._onNotEmptyEvent.bind(this)),this.hostedFieldsInstance.on("validityChange",this._onValidityChangeEvent.bind(this)),f.forEach((function(S){this.hostedFieldsInstance.setAttribute({field:S,attribute:"aria-required",value:!0})}).bind(this)),h.forEach((function(S){this.hostedFieldsInstance.on(S,(function(O){this.model._emit("card:"+S,O)}).bind(this))}).bind(this)),this.model.asyncDependencyReady(y.ID)}).bind(this)).catch((function(w){this.model.asyncDependencyFailed({view:this.ID,error:w})}).bind(this))},y.prototype._sendRequestableEvent=function(){this._isTokenizing||this.model.setPaymentMethodRequestable({isRequestable:this._validateForm(),type:s.paymentMethodTypes.card})},y.prototype._renderCardIcons=function(){var P=this.merchantConfiguration.overrides,b=this.getElementById("card-view-icons"),A=P&&P.fields&&P.fields.number&&P.fields.number.supportedCardBrands;b.innerHTML=u,A&&Object.keys(A).forEach(function(m){var w=A[m],S,O;w===!1&&(S='div[data-braintree-id="'+s.cardTypeIcons[m]+'-card-icon"]',O=document.querySelector(S),E(O))})},y.prototype._generateHostedFieldsOptions=function(){var P=this.client.getConfiguration().gatewayConfiguration.challenges,b=P.indexOf("cvv")!==-1,A=P.indexOf("postal_code")!==-1,m=this.merchantConfiguration.overrides,w={client:this.client,fields:{cardholderName:{container:this._getFieldContainer("cardholder-name"),placeholder:this.strings.cardholderNamePlaceholder},number:{container:this._getFieldContainer("number"),placeholder:I()},expirationDate:{container:this._getFieldContainer("expiration"),placeholder:this.strings.expirationDatePlaceholder},cvv:{container:this._getFieldContainer("cvv"),placeholder:C(3)},postalCode:{container:this._getFieldContainer("postal-code")}},styles:{input:{"font-size":"16px","font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',color:"#000"},":focus":{color:"black"},"::-webkit-input-placeholder":{color:"#6a6a6a"},":-moz-placeholder":{color:"#6a6a6a"},"::-moz-placeholder":{color:"#6a6a6a"},":-ms-input-placeholder ":{color:"#6a6a6a"},"input::-ms-clear":{color:"transparent"}}};return this.hasCardholderName||delete w.fields.cardholderName,b||delete w.fields.cvv,A||delete w.fields.postalCode,m&&(m.fields&&(m.fields.cvv&&typeof m.fields.cvv.placeholder<"u"&&(this._hasCustomCVVPlaceholder=!0),Object.keys(m.fields).forEach(function(S){if((S==="cvv"||S==="postalCode")&&m.fields[S]===null){delete w.fields[S];return}w.fields[S]&&n(w.fields[S],m.fields[S],{selector:w.fields[S].selector})})),m.styles&&Object.keys(m.styles).forEach(function(S){if(m.styles[S]===null){delete w.styles[S];return}else if(typeof m.styles[S]=="string"){w.styles[S]=m.styles[S];return}T(m.styles[S]),w.styles[S]=w.styles[S]||{},n(w.styles[S],m.styles[S])})),w},y.prototype._validateForm=function(P){var b,A,m,w,S=!0,O=this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;return this.hostedFieldsInstance?(w=this.hostedFieldsInstance.getState(),Object.keys(w.fields).forEach((function(R){var B=w.fields[R];!P&&!S||(B.isEmpty?!this.cardholderNameRequired&&R==="cardholderName"?S=!0:(S=!1,P&&this.showFieldError(R,this.strings["fieldEmptyFor"+_(R)])):B.isValid||(S=!1,P&&this.showFieldError(R,this.strings["fieldInvalidFor"+_(R)])))}).bind(this)),w.fields.number.isValid&&(b=w.cards[0],A=b&&s.configurationCardTypes[b.type],m=A&&O.indexOf(A)!==-1,m||(S=!1,P&&this.showFieldError("number",this.strings.unsupportedCardTypeError))),S):!1},y.prototype.getPaymentMethod=function(){var P=this._validateForm();if(P)return{type:s.paymentMethodTypes.card}},y.prototype.tokenize=function(){var P,b=this,A=b.hostedFieldsInstance.getState(),m={vault:this._shouldVault()};return this.model.clearError(),this._validateForm(!0)?(!this.cardholderNameRequired&&A.fields.cardholderName&&A.fields.cardholderName.isEmpty&&(m.fieldsToTokenize=Object.keys(A.fields).filter(function(w){return w!=="cardholderName"})),b._isTokenizing=!0,b.hostedFieldsInstance.tokenize(m).then(function(w){var S=b.merchantConfiguration.clearFieldsAfterTokenization===!1;return S||Object.keys(A.fields).forEach(function(O){b.hostedFieldsInstance.clear(O)}),b._shouldVault()&&(w.vaulted=!0),new Promise(function(O){P=function(){setTimeout(function(){b.model.addPaymentMethod(w),O(w),b.element.classList.remove("braintree-sheet--tokenized")},0)},p.onTransitionEnd(b.element,"max-height",P),setTimeout(function(){b.allowUserAction(),b._isTokenizing=!1},s.CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT),b.element.classList.add("braintree-sheet--tokenized")})}).catch(function(w){return b._isTokenizing=!1,b.model.reportError(w),b.allowUserAction(),Promise.reject(new l({message:s.errors.NO_PAYMENT_METHOD_ERROR,braintreeWebError:w}))})):(b.model.reportError("hostedFieldsFieldsInvalidError"),b.allowUserAction(),Promise.reject(new l(s.errors.NO_PAYMENT_METHOD_ERROR)))},y.prototype.showFieldError=function(P,b){var A,m=this.getElementById(g(P)+"-field-group"),w=m.querySelector("input");this.fieldErrors.hasOwnProperty(P)||(this.fieldErrors[P]=this.getElementById(g(P)+"-field-error")),m.classList.add("braintree-form__field-group--has-error"),A=this.fieldErrors[P],A.innerHTML=b,w?w.setAttribute("aria-invalid",!0):(this.hostedFieldsInstance.setAttribute({field:P,attribute:"aria-invalid",value:!0}),this.hostedFieldsInstance.setMessage({field:P,message:b}))},y.prototype.hideFieldError=function(P){var b=this.getElementById(g(P)+"-field-group"),A=b.querySelector("input");this.fieldErrors.hasOwnProperty(P)||(this.fieldErrors[P]=this.getElementById(g(P)+"-field-error")),b.classList.remove("braintree-form__field-group--has-error"),A?A.removeAttribute("aria-invalid"):(this.hostedFieldsInstance.removeAttribute({field:P,attribute:"aria-invalid"}),this.hostedFieldsInstance.setMessage({field:P,message:""}))},y.prototype.teardown=function(){return this.hostedFieldsInstance.teardown()},y.prototype._shouldVault=function(){return!this.model.isGuestCheckout&&this.saveCardInput.checked},y.prototype._getFieldContainer=function(P){return P==="expiration"&&(P="expiration-date"),this.getElementById(P+"-field-group").querySelector(".braintree-form__hosted-field")},y.prototype._onBlurEvent=function(P){var b=P.fields[P.emittedBy],A=this.getElementById(g(P.emittedBy)+"-field-group");A.classList.remove("braintree-form__field-group--is-focused"),b.isPotentiallyValid&&this.hideFieldError(P.emittedBy),this._shouldApplyFieldEmptyError(P.emittedBy,b)?this.showFieldError(P.emittedBy,this.strings["fieldEmptyFor"+_(P.emittedBy)]):!b.isEmpty&&!b.isValid?this.showFieldError(P.emittedBy,this.strings["fieldInvalidFor"+_(P.emittedBy)]):P.emittedBy==="number"&&!this._isCardTypeSupported(P.cards[0])&&this.showFieldError("number",this.strings.unsupportedCardTypeError),this.model._emit("card:blur",P),setTimeout((function(){this._shouldApplyFieldEmptyError(P.emittedBy,b)&&this.showFieldError(P.emittedBy,this.strings["fieldEmptyFor"+_(P.emittedBy)])}).bind(this),150)},y.prototype._onCardTypeChangeEvent=function(P){var b,A="#iconCardFront",m="#iconCVVBack",w=this.strings.cvvThreeDigitLabelSubheading,S=C(3),O=this.getElementById("number-field-group");P.cards.length===1?(b=P.cards[0].type,A="#icon-"+b,b==="american-express"&&(m="#iconCVVFront",w=this.strings.cvvFourDigitLabelSubheading,S=C(4)),O.classList.add("braintree-form__field-group--card-type-known")):O.classList.remove("braintree-form__field-group--card-type-known"),P.emittedBy==="number"&&this._isCardTypeSupported(P.cards[0])&&this.hideFieldError(P.emittedBy),this.cardNumberIconSvg.setAttribute("xlink:href",A),this.hasCVV&&(this.cvvIconSvg.setAttribute("xlink:href",m),this.cvvLabelDescriptor.innerHTML=w,this._hasCustomCVVPlaceholder||this.hostedFieldsInstance.setAttribute({field:"cvv",attribute:"placeholder",value:S})),this.model._emit("card:cardTypeChange",P)},y.prototype._onFocusEvent=function(P){var b=this.getElementById(g(P.emittedBy)+"-field-group");b.classList.add("braintree-form__field-group--is-focused"),this.model._emit("card:focus",P)},y.prototype._onNotEmptyEvent=function(P){this.hideFieldError(P.emittedBy),this.model._emit("card:notEmpty",P)},y.prototype._onValidityChangeEvent=function(P){var b,A=P.fields[P.emittedBy];P.emittedBy==="number"&&P.cards[0]?b=A.isValid&&this._isCardTypeSupported(P.cards[0]):b=A.isValid,A.container.classList.toggle("braintree-form__field--valid",b),A.isPotentiallyValid&&this.hideFieldError(P.emittedBy),this._sendRequestableEvent(),this.model._emit("card:validityChange",P)},y.prototype.requestPaymentMethod=function(){return this.preventUserAction(),this.tokenize()},y.prototype.onSelection=function(){this.hostedFieldsInstance&&(setTimeout((function(){this.hasCardholderName?this.hostedFieldsInstance.focus("cardholderName"):this.hostedFieldsInstance.focus("number")}).bind(this),50),this._sendRequestableEvent())},y.prototype._hideUnsupportedCardIcons=function(){var P=this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;Object.keys(s.configurationCardTypes).forEach((function(b){var A,m=s.configurationCardTypes[b];P.indexOf(m)===-1&&(A=this.getElementById(b+"-card-icon"),A.classList.add("braintree-hidden"))}).bind(this))},y.prototype._isCardTypeSupported=function(P){var b=P&&P.type,A=s.configurationCardTypes[b],m=this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;return m.indexOf(A)!==-1},y.isEnabled=function(P){var b=P.client.getConfiguration().gatewayConfiguration,A=P.merchantConfiguration.card===!1;return Promise.resolve(!A&&b.creditCards.supportedCardTypes.length>0)},y.prototype._shouldApplyFieldEmptyError=function(P,b){return!b.isEmpty||P==="cardholderName"&&!this.cardholderNameRequired?!1:v()};function E(P){P&&P.classList.add("braintree-hidden")}function v(){var P=document.activeElement&&document.activeElement.id,b=document.activeElement instanceof HTMLIFrameElement&&P.indexOf("braintree-hosted-field")!==-1;return b}function g(P){return P.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function _(P){return P[0].toUpperCase()+P.substr(1)}function T(P){Object.keys(P).forEach(function(b){var A=g(b);P[A]=P[b]})}function C(P){var b=d()?"•":"*";return Array(P+1).join(b)}function I(){var P=C(4);return[P,P,P,P].join(" ")}i.exports=y},{"../../constants":202,"../../lib/assign":208,"../../lib/dropin-error":212,"../../lib/is-utf-8":216,"../../lib/transition-helper":222,"../base-view":259,"braintree-web/hosted-fields":77}],268:[function(t,i,a){(function(n){(function(){var o=t("../../lib/assign").assign,s=t("../base-view"),l=t("braintree-web/google-payment"),c=t("../../lib/dropin-error"),d=t("../../constants"),p=t("@braintree/asset-loader"),u=t("../../lib/analytics");function h(){s.apply(this,arguments)}h.prototype=Object.create(s.prototype),h.prototype.constructor=h,h.ID=h.prototype.ID=d.paymentOptionIDs.googlePay,h.prototype.initialize=function(){var y=this,E,v,g;return y.googlePayConfiguration=o({},y.model.merchantConfiguration.googlePay),v=y.googlePayConfiguration.googlePayVersion,g=y.googlePayConfiguration.merchantId,E=o({buttonType:"short"},y.googlePayConfiguration.button,{onClick:function(_){_.preventDefault(),y.preventUserAction(),y.tokenize().then(function(){y.allowUserAction()})}}),delete y.googlePayConfiguration.googlePayVersion,delete y.googlePayConfiguration.merchantId,delete y.googlePayConfiguration.button,l.create({client:y.client,googlePayVersion:v,googleMerchantId:g}).then(function(_){y.googlePayInstance=_,y.paymentsClient=f(y.client)}).then(function(){var _=y.getElementById("google-pay-button");_.appendChild(y.paymentsClient.createButton(E)),y.model.asyncDependencyReady(h.ID)}).catch(function(_){y.model.asyncDependencyFailed({view:y.ID,error:new c(_)})})},h.prototype.tokenize=function(){var y=this,E=y.googlePayInstance.createPaymentDataRequest(y.googlePayConfiguration),v;return y.paymentsClient.loadPaymentData(E).then(function(g){return v=g,y.googlePayInstance.parseResponse(g)}).then(function(g){g.rawPaymentData=v,y.model.addPaymentMethod(g)}).catch(function(g){var _=g;if(g.statusCode==="DEVELOPER_ERROR")console.error(g),_="developerError";else if(g.statusCode==="CANCELED"){u.sendEvent(y.client,"googlepay.loadPaymentData.canceled");return}else g.statusCode&&u.sendEvent(y.client,"googlepay.loadPaymentData.failed");y.model.reportError(_)})},h.prototype.updateConfiguration=function(y,E){this.googlePayConfiguration[y]=E},h.isEnabled=function(y){var E=y.client.getConfiguration().gatewayConfiguration;return E.androidPay&&y.merchantConfiguration.googlePay?Promise.resolve().then(function(){return n.google&&n.google.payments&&n.google.payments.api&&n.google.payments.api.PaymentsClient?Promise.resolve():p.loadScript({id:d.GOOGLE_PAYMENT_SCRIPT_ID,src:d.GOOGLE_PAYMENT_SOURCE})}).then(function(){var v=f(y.client);return v.isReadyToPay({allowedPaymentMethods:["CARD","TOKENIZED_CARD"]})}).then(function(v){return!!v.result}):Promise.resolve(!1)};function f(y){return new n.google.payments.api.PaymentsClient({environment:y.getConfiguration().gatewayConfiguration.environment==="production"?"PRODUCTION":"TEST"})}i.exports=h}).call(this)}).call(this,typeof et<"u"?et:typeof self<"u"?self:typeof window<"u"?window:{})},{"../../constants":202,"../../lib/analytics":207,"../../lib/assign":208,"../../lib/dropin-error":212,"../base-view":259,"@braintree/asset-loader":1,"braintree-web/google-payment":70}],269:[function(t,i,a){var n=t("../../constants").paymentOptionIDs,o={};o[n.applePay]=t("./apple-pay-view"),o[n.card]=t("./card-view"),o[n.googlePay]=t("./google-pay-view"),o[n.paypal]=t("./paypal-view"),o[n.paypalCredit]=t("./paypal-credit-view"),o[n.venmo]=t("./venmo-view"),i.exports=o},{"../../constants":202,"./apple-pay-view":265,"./card-view":267,"./google-pay-view":268,"./paypal-credit-view":270,"./paypal-view":271,"./venmo-view":272}],270:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../../constants").paymentOptionIDs,s=t("./base-paypal-view");function l(){s.apply(this,arguments),this._isPayPalCredit=!0}l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.ID=l.prototype.ID=o.paypalCredit,l.isEnabled=function(c){return c.merchantConfiguration.paypalCredit?s.isEnabled(n({viewID:l.ID},c)):Promise.resolve(!1)},i.exports=l},{"../../constants":202,"../../lib/assign":208,"./base-paypal-view":266}],271:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../../constants").paymentOptionIDs,s=t("./base-paypal-view");function l(){s.apply(this,arguments)}l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.ID=l.prototype.ID=o.paypal,l.isEnabled=function(c){return c.merchantConfiguration.paypal?s.isEnabled(n({viewID:l.ID},c)):Promise.resolve(!1)},i.exports=l},{"../../constants":202,"../../lib/assign":208,"./base-paypal-view":266}],272:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../base-view"),s=t("braintree-web/venmo"),l=t("../../lib/dropin-error"),c=t("../../constants").paymentOptionIDs;function d(){o.apply(this,arguments)}d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.ID=d.prototype.ID=c.venmo,d.prototype.initialize=function(){var p=this,u=n({},p.model.merchantConfiguration.venmo,{client:this.client});return s.create(u).then(function(h){return p.venmoInstance=h,p.venmoInstance.hasTokenizationResult()?p.venmoInstance.tokenize().then(function(f){p.model.reportAppSwitchPayload(f)}).catch(function(f){p._isIgnorableError(f)||p.model.reportAppSwitchError(c.venmo,f)}):Promise.resolve()}).then(function(){var h=p.getElementById("venmo-button");h.addEventListener("click",function(f){return f.preventDefault(),p.preventUserAction(),p.venmoInstance.tokenize().then(function(y){p.model.addPaymentMethod(y)}).catch(function(y){p._isIgnorableError(y)||p.model.reportError(y)}).then(function(){p.allowUserAction()})}),p.model.asyncDependencyReady(d.ID)}).catch(function(h){p.model.asyncDependencyFailed({view:p.ID,error:new l(h)})})},d.prototype.requestPaymentMethod=function(){return this.model.reportError("venmoButtonMustBeUsed"),o.prototype.requestPaymentMethod.call(this)},d.prototype._isIgnorableError=function(p){return p.code==="VENMO_APP_CANCELED"||p.code==="VENMO_DESKTOP_CANCELED"},d.isEnabled=function(p){var u=p.client.getConfiguration().gatewayConfiguration,h=u.payWithVenmo&&!!p.merchantConfiguration.venmo;return h?Promise.resolve(s.isBrowserSupported(p.merchantConfiguration.venmo)):Promise.resolve(!1)},i.exports=d},{"../../constants":202,"../../lib/assign":208,"../../lib/dropin-error":212,"../base-view":259,"braintree-web/venmo":149}]},{},[205])(205)})})(by);var O4=by.exports;const D4=fi(O4);const R4={name:"BraintreeNewMethods",components:{Agreements:Hn,CheckboxComponent:Bn,ErrorMessage:ht,MyButton:mt,PrivacyPolicy:Ei,Recaptcha:un},data(){return{instance:null,storeMethod:!1,additionalComponents:"",paymentOptionPriority:[],map:{}}},computed:{...Cr(it,["showMagentoPayments"]),...ue(it,["vaultActive","clientToken","threeDSEnabled","threeDSThresholdAmount","alwaysRequestThreeDS","google","paypal","vaultedMethods","errorMessage"]),...ue(ge,["currencyCode","websiteName","paypalCreditThresholdEnabled","paypalCreditThresholdValue"]),...ue(Pe,["cart","cartGrandTotal"]),...ue(Oe,["customer","isLoggedIn"]),...ue(Ze,["availableMethods","firstOpenController","paymentEmitter","isPaymentMethodAvailable","getPaymentMethodTitle","getPaymentPriority","selectedMethod"]),...ue(Et,["getTypeByPlacement"])},async created(){await this.getInitialConfig(),await this.createClientToken(),await this.getCart(),this.setLoadingState(!0);const e=(this.cartGrandTotal/100).toString();this.map={braintree:"card",braintree_applepay:"applePay",braintree_googlepay:"googlePay",braintree_venmo:"venmo",braintree_paypal:"paypal"};const r=this.availableMethods.filter(({code:n})=>n.startsWith("braintree"));if(this.paymentOptionPriority=r.map(({code:n})=>this.map[n]).filter(Boolean),this.paymentOptionPriority.includes("paypal")&&this.paypal.creditActive)if(this.paypalCreditThresholdEnabled){if(e>=Number(this.paypalCreditThresholdValue)){const n=this.paymentOptionPriority.indexOf("paypal");this.paymentOptionPriority.splice(n+1,0,"paypalCredit"),this.map.braintree_paypal_credit="paypalCredit"}}else{const n=this.paymentOptionPriority.indexOf("paypal");this.paymentOptionPriority.splice(n+1,0,"paypalCredit"),this.map.braintree_paypal_credit="paypalCredit"}const t={authorization:this.clientToken,container:"#braintree-drop-in",threeDSecure:!1,paymentOptionPriority:this.paymentOptionPriority,translations:{Card:this.getPaymentMethodTitle("braintree"),PayPal:this.getPaymentMethodTitle("braintree_paypal")}};this.isPaymentMethodAvailable("braintree")&&(t.card={vault:{allowVaultCardOverride:!0,vault:this.isLoggedIn}}),this.isPaymentMethodAvailable("braintree_applepay")&&(t.applePay={displayName:this.websiteName,paymentRequest:{total:{label:this.websiteName,amount:e}}}),this.isPaymentMethodAvailable("braintree_googlepay")&&(t.googlePay={merchantId:this.google.merchantId,googlePayVersion:2,transactionInfo:{currencyCode:this.currencyCode,totalPriceStatus:"FINAL",totalPrice:e},allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:this.google.cCTypes,billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}}],button:{buttonColor:this.google.buttonColor}}),this.isPaymentMethodAvailable("braintree_paypal")&&(t.paypal={flow:"checkout",amount:e,commit:!0,lineItems:this.getPayPalLineItems(),buttonStyle:{color:this.paypal.buttonColor,label:this.paypal.buttonLabel,shape:this.paypal.buttonShape,size:"responsive"},sdkConfig:{currency:this.currencyCode,dataAttributes:{"csp-nonce":window.cspNonce}}},this.paypal.paylaterActive&&(t.paypal.sdkConfig["enable-funding"]="paylater"),this.paypal.creditActive&&(this.paypalCreditThresholdEnabled?e>=Number(this.paypalCreditThresholdValue)&&(t.paypalCredit={flow:"checkout",amount:e,currency:this.currencyCode,buttonStyle:{color:this.paypal.creditColor!=="gold"&&this.paypal.creditColor!=="blue"&&this.paypal.creditColor!=="silver"?this.paypal.creditColor:"darkblue",label:this.paypal.creditLabel,shape:this.paypal.creditShape,size:"responsive"},commit:!0,sdkConfig:{currency:this.currencyCode,dataAttributes:{"csp-nonce":window.cspNonce}}}):t.paypalCredit={flow:"checkout",amount:e,currency:this.currencyCode,buttonStyle:{color:this.paypal.creditColor!=="gold"&&this.paypal.creditColor!=="blue"&&this.paypal.creditColor!=="silver"?this.paypal.creditColor:"darkblue",label:this.paypal.creditLabel,shape:this.paypal.creditShape,size:"responsive"},commit:!0,sdkConfig:{currency:this.currencyCode,dataAttributes:{"csp-nonce":window.cspNonce}}})),this.isPaymentMethodAvailable("braintree_venmo")&&(t.venmo={allowDesktop:!0});const i=this.cartGrandTotal/100,a=this.threeDSThresholdAmount;this.threeDSEnabled&&i>=a&&(t.threeDSecure={amount:i}),D4.create(t,this.afterBraintreeInit)},unmounted(){this.removeEventListeners(),this.instance&&(this.instance.teardown(),this.setThreeDSInstance(null))},watch:{selectedMethod:{handler(e){e!==null&&(!e.startsWith("braintree")||e==="braintree-lpm"||e==="braintree-ach")&&this.clearSelectedMethod(e)},immediate:!0,deep:!0}},methods:{...ce(xt,["setLoadingState"]),...ce($t,["validateAgreements"]),...ce(it,["createClientToken","unselectVaultedMethods","setClientInstance","setThreeDSInstance","setErrorMessage","clearErrorMessage","escapeNonAsciiCharacters","getPayPalLineItems"]),...ce(Pe,["getCart"]),...ce(ge,["getInitialConfig"]),...ce(Ze,["selectPaymentMethod","setPaymentErrorMessage"]),...ce(Et,["validateToken"]),startPayment(){this.paymentEmitter.emit("braintreePaymentStart"),this.setLoadingState(!0),this.requestPaymentMethod().then(this.getPaymentData).then(this.validateRecaptcha).then(hn).then(()=>St(["cart"])).then(this.redirectToSuccess).catch(e=>{var r,t;this.clearSelectedPaymentMethod(),this.setLoadingState(!1),e.name!=="DropinError"&&this.setErrorMessage(((t=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:t.message)||e.message),this.paymentEmitter.emit("braintreePaymentError")})},requestPaymentMethod(){return new Promise((e,r)=>{this.setErrorMessage(""),(async()=>{if(!this.validateAgreements()){const c=new Error;c.name="DropinError",r(c);return}this.instance||r(new Error("Unable to initialise payment components."));const i=this.cart.billing_address,a=this.escapeNonAsciiCharacters(i.firstname),n=this.escapeNonAsciiCharacters(i.lastname),o={givenName:a,surname:n,phoneNumber:i.telephone,streetAddress:i.street[0],extendedAddress:i.street[1],locality:i.city,region:i.region_code,postalCode:i.postcode,countryCodeAlpha2:i.country_code},s=this.cartGrandTotal/100,l=this.alwaysRequestThreeDS;this.instance.requestPaymentMethod({threeDSecure:{amount:parseFloat(s).toFixed(2),email:this.customer.email,billingAddress:o,challengeRequested:l}},(c,d)=>{c?(this.setPaymentErrorMessage(c.message),r(c.message)):d.liabilityShifted||!d.liabilityShifted&&!d.liabilityShiftPossible||d.type!=="CreditCard"&&d.type!=="AndroidPayCard"?e(d):r(new Error("There was an error completing validation, please try again."))})})().catch(r)})},getPaymentData(e){return{email:this.customer.email,paymentMethod:{method:this.getBraintreeMethod(e.type),additional_data:{payment_method_nonce:e.nonce,is_active_payment_token_enabler:this.storeMethod},extension_attributes:pn()}}},async validateRecaptcha(e){if(!await this.validateToken("braintree"))throw new Error(this.$t("ReCaptcha validation failed, please try again."));return e},getBraintreeMethod(e){switch(e){case"AndroidPayCard":return"braintree_googlepay";case"ApplePayCard":return"braintree_applepay";case"PayPalAccount":return"braintree_paypal";default:return"braintree"}},afterBraintreeInit(e,r){if(this.showMagentoPayments=!0,this.setLoadingState(!1),this.setClientInstance(r._client),r._threeDSecure&&this.setThreeDSInstance(r._threeDSecure._instance),this.instance=r,this.attachEventListeners(r),this.movePaymentContainers(),this.selectedMethod.startsWith("braintree")){const[t]=this.paymentOptionPriority;this.selectPaymentMethod(t),this.setToCurrentViewId()}this.paymentEmitter.emit("braintreeInitComplete"),this.modifyTokenize()},attachEventListeners(e){e.on("changeActiveView",({newViewId:r,previousViewId:t})=>{if(this.removeActiveClass(),this.clearErrorMessage(),r==="methods")this.paymentEmitter.emit("changePaymentMethodDisplay",{visible:!1}),t!=="card"&&this.startPayment();else if(r!=="options"){this.addActiveClass(r);const i=r==="card"?"braintree":`braintree_${r}`;this.selectPaymentMethod(i),this.selectedMethod=r,r==="card"?this.additionalComponents=".braintree-form__flexible-fields":r==="paypal"?this.additionalComponents='div[data-braintree-id="paypal-button"]':r==="paypalCredit"?this.additionalComponents='div[data-braintree-id="paypal-credit-button"]':r==="googlePay"?this.additionalComponents='div[data-braintree-id="google-pay-button"]':r==="applePay"?this.additionalComponents=".braintree-applePay .braintree-sheet__content":r==="venmo"&&(this.additionalComponents=".braintree-venmo .braintree-sheet__content")}}),e.on("3ds:customer-canceled",()=>{this.$refs.braintreeContainer.querySelector(".braintree-options")&&this.clearSelectedPaymentMethod()}),this.paymentEmitter.on("changePaymentMethodDisplay",this.changePaymentMethodDisplay),this.paymentEmitter.on("braintreeStoredPaymentCardSelected",this.clearSelectedPaymentMethod),this.paymentEmitter.on("braintreePaymentStart",this.showLoader),this.paymentEmitter.on("braintreePaymentError",this.hideLoader)},removeEventListeners(){this.paymentEmitter.off("changePaymentMethodDisplay",this.changePaymentMethodDisplay),this.paymentEmitter.off("braintreeStoredPaymentCardSelected",this.clearSelectedPaymentMethod),this.paymentEmitter.off("braintreePaymentStart",this.showLoader),this.paymentEmitter.off("braintreePaymentError",this.hideLoader)},clearSelectedMethod(e){this.unselectVaultedMethods(),e!==null&&(!e.startsWith("braintree")||e==="braintree-lpm"||e==="braintree-ach")&&this.clearSelectedPaymentMethod(),this.storeMethod=!1},changePaymentMethodDisplay({visible:e}){this.$refs.braintreeContainer.querySelectorAll(".braintree-sheet__container .braintree-sheet").forEach(t=>{t.classList.toggle("braintree-hidden",!e)})},movePaymentContainers(){this.$refs.braintreeContainer.querySelectorAll(".braintree-sheet__container .braintree-sheet").forEach(r=>{const{braintreeId:t}=r.dataset,i=this.$refs.braintreeContainer.querySelector(`.braintree-option__${t}`);if(i){const a=Object.values(this.map).findIndex(s=>s===t),n=this.getPaymentPriority(Object.keys(this.map)[a]),o=s=>{r.style.setProperty("--braintree-method-position",s),r.prepend(i)};if(n!==-1)o(n+1);else if(t==="paypalCredit"){const s=Object.values(this.map).findIndex(c=>c==="paypal"),l=this.getPaymentPriority(Object.keys(this.map)[s]);o(l+2)}if(t==="card"){const s=r.querySelector(".braintree-sheet__icons");i.append(s)}}})},modifyTokenize(){if(this.isPaymentMethodAvailable("braintree_googlepay")){const e=this.instance._mainView._views.googlePay.tokenize.bind(Be(this.instance._mainView._views.googlePay));this.instance._mainView._views.googlePay.tokenize=async()=>(this.setErrorMessage(""),this.validateAgreements()?e():Promise.resolve())}if(this.isPaymentMethodAvailable("braintree_venmo")){const e=this.instance._mainView._views.venmo.venmoInstance.tokenize.bind(this.instance._mainView._views.venmo.venmoInstance);this.instance._mainView._views.venmo.venmoInstance.tokenize=async()=>(this.setErrorMessage(""),this.validateAgreements()?e():Promise.resolve())}if(this.isPaymentMethodAvailable("braintree_paypal")){const e=this.instance._mainView._views.paypal.paypalInstance.createPayment.bind(this.instance._mainView._views.paypal.paypalInstance);this.instance._mainView._views.paypal.paypalInstance.createPayment=async r=>(this.setErrorMessage(""),this.validateAgreements()?e(r):Promise.reject())}},addActiveClass(e){const r=e==="card"?".braintree-option__card":`.braintree-option__${e}`,t=this.$refs.braintreeContainer.querySelector(r);t&&t.classList.add("braintree-option__selected")},removeActiveClass(){this.$refs.braintreeContainer.querySelectorAll(".braintree-option").forEach(r=>{r.classList.remove("braintree-option__selected")})},clearSelectedPaymentMethod(){this.instance!==null&&(this.instance.clearSelectedPaymentMethod(),this.paymentEmitter.emit("changePaymentMethodDisplay",{visible:!0}))},setToCurrentViewId(){this.instance._mainView.setPrimaryView(this.selectedMethod)},redirectToSuccess(){window.location.href=kr()},showLoader(){this.instance._mainView.showLoadingIndicator()},hideLoader(){this.instance._mainView.hideLoadingIndicator()}}},L4={id:"braintree-drop-in",ref:"braintreeContainer",class:"braintree-drop-in","data-cy":"braintree-drop-in-container"};function k4(e,r,t,i,a,n){const o=Y("ErrorMessage"),s=Y("CheckboxComponent"),l=Y("Agreements"),c=Y("Recaptcha"),d=Y("PrivacyPolicy"),p=Y("MyButton");return D(),z(Ee,null,[k("div",L4,null,512),a.additionalComponents!==""?(D(),ne(Cl,{key:0,to:a.additionalComponents},[e.errorMessage?(D(),ne(o,{key:0,message:e.errorMessage,attached:!1,margin:!1},null,8,["message"])):$("",!0),e.isLoggedIn&&(e.selectedMethod==="braintree"&&e.vaultActive||e.selectedMethod==="braintree_googlePay"&&e.google.vaultActive||e.selectedMethod==="braintree_paypal"&&e.paypal.vaultActive)?(D(),ne(s,{key:1,id:"braintree-store-method",class:"braintree-store-method",checked:a.storeMethod,"change-handler":({currentTarget:u})=>a.storeMethod=u.checked,text:e.$t("braintree.storePayment"),"data-cy":"braintree-save-payment-card-checkbox"},null,8,["checked","change-handler","text"])):$("",!0),j(l,{id:"braintreeNew"}),e.getTypeByPlacement("braintree")?(D(),ne(c,{key:2,id:"braintree",location:"braintreeNewMethods"})):$("",!0),j(d),e.selectedMethod==="braintree"?(D(),ne(p,{key:3,label:"Pay",primary:"",onClick:r[0]||(r[0]=u=>n.startPayment()),"data-cy":"braintree-new-card-pay-button"})):$("",!0)],8,["to"])):$("",!0)],64)}const Cy=_e(R4,[["render",k4]]);const M4={name:"BraintreeDropIn",components:{BraintreeAch:gy,BraintreeLpm:Ey,BraintreeNewMethods:Cy},computed:{...ue(Oe,["isLoggedIn"]),...ue(Ze,["isPaymentMethodAvailable"])}};function F4(e,r,t,i,a,n){const o=Y("BraintreeNewMethods"),s=Y("BraintreeLpm"),l=Y("BraintreeAch");return D(),z(Ee,null,[j(o),e.isPaymentMethodAvailable("braintree_local_payment")?(D(),ne(s,{key:0})):$("",!0),e.isPaymentMethodAvailable("braintree_ach_direct_debit")?(D(),ne(l,{key:1})):$("",!0)],64)}const Py=_e(M4,[["render",F4]]);const x4={name:"SavedShippingMethod",components:{TextField:Ye,Shipping:Po,Price:gi,Edit:dn},data(){return{shippingStepCompletedText:"",shippingStepCompletedTextId:"bluefinch-checkout-shippingstepcompleted-text"}},async created(){var e;this.locale||await this.getInitialConfig(),this.shippingStepCompletedText=((e=window.bluefinchCheckout)==null?void 0:e[this.shippingStepCompletedTextId])||this.$t("shippingStep.stepCompleteTitle")},computed:{...ue(Pe,["cart"]),...ue(Pt,["selectedMethod"]),...ue(ge,["locale"])},methods:{...ce(ge,["getInitialConfig"]),...ce(Rr,["goToShipping"]),setDetailsStepActive(){const e=document.getElementById("progress-bar");e&&e.classList.add("shipping-active"),this.goToShipping()}}},V4={class:"saved-shipping"},U4={class:"saved-shipping__title"},B4={class:"order-total"},H4={class:"total__row"},z4={class:"saved-shipping__icon"},K4={class:"saved-shipping__icon-image"},j4={class:"title"},W4={class:"shipping-method-title"},Y4={class:"proceed-to-shipping"},G4=["aria-label"];function $4(e,r,t,i,a,n){const o=Y("Shipping"),s=Y("TextField"),l=Y("Price"),c=Y("Edit"),d=Y("router-link");return D(),z("div",V4,[j(d,{class:"saved-shipping-link","aria-label":"proceed-to-shipping-link","data-cy":"completed-step-shipping-trigger",to:"/shipping",onClick:r[0]||(r[0]=p=>{n.setDetailsStepActive()})},{default:ze(()=>{var p,u,h,f,y,E,v,g,_,T,C;return[k("div",U4,[k("div",B4,[k("div",H4,[k("div",z4,[k("div",K4,[j(o,{"data-cy":"completed-step-shipping-icon"})]),k("div",j4,[j(s,{text:a.shippingStepCompletedText,"data-cy":"completed-step-shipping-title"},null,8,["text"])])]),k("div",W4,[j(s,{text:`${(h=(u=(p=e.cart.shipping_addresses)==null?void 0:p[0])==null?void 0:u.selected_shipping_method)==null?void 0:h.method_title}, `,"data-cy":"completed-step-shipping-content-method"},null,8,["text"]),j(l,{class:"shipping-method-value",value:((v=(E=(y=(f=e.cart.shipping_addresses)==null?void 0:f[0])==null?void 0:y.selected_shipping_method)==null?void 0:E.price_incl_tax)==null?void 0:v.value)??((C=(T=(_=(g=e.cart.shipping_addresses)==null?void 0:g[0])==null?void 0:_.selected_shipping_method)==null?void 0:T.amount)==null?void 0:C.value),"data-cy":"completed-step-shipping-content-price"},null,8,["value"])])])])]),k("div",Y4,[k("button",{class:"button--blank edit-shipping-button","aria-label":e.$t("yourDetailsSection.editShippingButtonLabel"),"data-cy":"completed-step-shipping-edit-button"},[j(s,{class:"edit-button-title",text:e.$t("yourDetailsSection.editButton"),"data-cy":"completed-step-shipping-edit-button-text"},null,8,["text"]),j(c,{"data-cy":"completed-step-shipping-edit-icon"})],8,G4)])]}),_:1})])}const Ay=_e(x4,[["render",$4],["__scopeId","data-v-fcbbe81e"]]);const Q4={name:"Rewards",components:{MyButton:mt},computed:{...ue(Pe,["cart"]),...ue(Oe,["customer"])},methods:{...ce(Pe,["useRewardPoints","removeRewardPoints"]),getFormattedPrice(){return br(this.customer.reward_points.balance.money.value)}}},Z4={key:0,class:"reward-points"},q4={"data-cy":"rewards-you-have-text"},J4={class:"reward-points-available","data-cy":"rewards-points-text"},X4={"data-cy":"rewards-available-text"},e8={key:1,class:"reward-points"},t8={"data-cy":"rewards-applied-text"};function r8(e,r,t,i,a,n){var s,l,c,d,p,u;const o=Y("MyButton");return(l=(s=e.customer.reward_points)==null?void 0:s.balance)!=null&&l.points&&!((c=e.cart.applied_reward_points)!=null&&c.points)?(D(),z("div",Z4,[k("div",null,[k("span",q4,Te(e.$t("rewards.youHave")),1),k("span",J4,Te(e.$t("rewards.rewardPoints",{points:e.customer.reward_points.balance.points})),1),k("span",X4,Te(e.$t("rewards.available")),1),k("span",null,"("+Te(n.getFormattedPrice())+")",1)]),j(o,{label:e.$t("rewards.applyButton"),"data-cy":"rewards-apply-button",secondary:"",onClick:r[0]||(r[0]=h=>e.useRewardPoints())},null,8,["label"])])):(p=(d=e.customer.reward_points)==null?void 0:d.balance)!=null&&p.points&&((u=e.cart.applied_reward_points)!=null&&u.points)?(D(),z("div",e8,[k("span",t8,Te(e.$t("rewards.applied")),1),j(o,{label:e.$t("rewards.removeButton"),"data-cy":"rewards-remove-button",secondary:"",onClick:r[1]||(r[1]=h=>e.removeRewardPoints())},null,8,["label"])])):$("",!0)}const Ty=_e(Q4,[["render",r8],["__scopeId","data-v-7d6e478b"]]);const n8={name:"StoreCredit",components:{MyButton:mt},computed:{...ue(Pe,["cart"]),...ue(Oe,["customer"])},methods:{...ce(Pe,["useStoreCredit","removeStoreCredit"]),getFormattedPrice(){return br(this.customer.store_credit.current_balance.value)}}},i8={key:0,class:"store-credit"},a8={class:"store-credit-available","data-cy":"store-credit-text"},o8={key:1,class:"store-credit"},s8={"data-cy":"store-credit-used-text"};function l8(e,r,t,i,a,n){var s,l,c,d,p,u,h;const o=Y("MyButton");return(c=(l=(s=e.customer)==null?void 0:s.store_credit)==null?void 0:l.current_balance)!=null&&c.value&&!((p=(d=e.cart.applied_store_credit)==null?void 0:d.applied_balance)!=null&&p.value)?(D(),z("div",i8,[k("div",null,[k("span",a8,Te(e.$t("storeCredit.applyStoreCredit",{value:n.getFormattedPrice()})),1)]),j(o,{label:e.$t("storeCredit.applyButton"),"data-cy":"use-store-credit-button",secondary:"",onClick:r[0]||(r[0]=f=>e.useStoreCredit())},null,8,["label"])])):(h=(u=e.cart.applied_store_credit)==null?void 0:u.applied_balance)!=null&&h.value?(D(),z("div",o8,[k("span",s8,Te(e.$t("storeCredit.removeStoreCredit")),1),j(o,{label:e.$t("storeCredit.removeButton"),"data-cy":"remove-store-credit-button",secondary:"",onClick:r[1]||(r[1]=f=>e.removeStoreCredit())},null,8,["label"])])):$("",!0)}const Iy=_e(n8,[["render",l8],["__scopeId","data-v-45ad5456"]]),wy=()=>{gt().trackGtmEvent({event:"paymentComplete"})},Sy=e=>{const{maskedId:r}=Pe(),{tokens:t}=Et(),i=` +`,h=["empty","inputSubmitRequest","binAvailable"],f=["number","expirationDate","cvv","postalCode","cardholderName"];function y(){o.apply(this,arguments)}y.prototype=Object.create(o.prototype),y.prototype.constructor=y,y.ID=y.prototype.ID=s.paymentOptionIDs.card,y.prototype.initialize=function(){var P,b,A,m=this.getElementById("cardholder-name-field-group");return this.model.merchantConfiguration.card&&this.model.merchantConfiguration.card!==!0?this.merchantConfiguration=this.model.merchantConfiguration.card:this.merchantConfiguration={},this.merchantConfiguration.vault=this.merchantConfiguration.vault||{},this.hasCardholderName=!!this.merchantConfiguration.cardholderName,this.cardholderNameRequired=this.hasCardholderName&&this.merchantConfiguration.cardholderName.required===!0,A=this._generateHostedFieldsOptions(),this._renderCardIcons(),this._hideUnsupportedCardIcons(),this.hasCVV=A.fields.cvv,this.saveCardInput=this.getElementById("save-card-input"),this.cardNumberIcon=this.getElementById("card-number-icon"),this.cardNumberIconSvg=this.getElementById("card-number-icon-svg"),this.cvvIcon=this.getElementById("cvv-icon"),this.cvvIconSvg=this.getElementById("cvv-icon-svg"),this.cvvLabelDescriptor=this.getElementById("cvv-label-descriptor"),this.fieldErrors={},this.hasCardholderName||(m.parentNode.removeChild(m),f=f.filter(function(w){return w!=="cardholderName"})),this.hasCVV||(P=this.getElementById("cvv-field-group"),P.parentNode.removeChild(P),f=f.filter(function(w){return w!=="cvv"})),A.fields.postalCode||(b=this.getElementById("postal-code-field-group"),b.parentNode.removeChild(b),f=f.filter(function(w){return w!=="postalCode"})),!this.model.isGuestCheckout&&this.merchantConfiguration.vault.allowVaultCardOverride===!0&&this.getElementById("save-card-field-group").classList.remove("braintree-hidden"),this.merchantConfiguration.vault.vaultCard===!1&&(this.saveCardInput.checked=!1),c.create(A).then((function(w){this.hostedFieldsInstance=w,this.hostedFieldsInstance.on("blur",this._onBlurEvent.bind(this)),this.hostedFieldsInstance.on("cardTypeChange",this._onCardTypeChangeEvent.bind(this)),this.hostedFieldsInstance.on("focus",this._onFocusEvent.bind(this)),this.hostedFieldsInstance.on("notEmpty",this._onNotEmptyEvent.bind(this)),this.hostedFieldsInstance.on("validityChange",this._onValidityChangeEvent.bind(this)),f.forEach((function(S){this.hostedFieldsInstance.setAttribute({field:S,attribute:"aria-required",value:!0})}).bind(this)),h.forEach((function(S){this.hostedFieldsInstance.on(S,(function(O){this.model._emit("card:"+S,O)}).bind(this))}).bind(this)),this.model.asyncDependencyReady(y.ID)}).bind(this)).catch((function(w){this.model.asyncDependencyFailed({view:this.ID,error:w})}).bind(this))},y.prototype._sendRequestableEvent=function(){this._isTokenizing||this.model.setPaymentMethodRequestable({isRequestable:this._validateForm(),type:s.paymentMethodTypes.card})},y.prototype._renderCardIcons=function(){var P=this.merchantConfiguration.overrides,b=this.getElementById("card-view-icons"),A=P&&P.fields&&P.fields.number&&P.fields.number.supportedCardBrands;b.innerHTML=u,A&&Object.keys(A).forEach(function(m){var w=A[m],S,O;w===!1&&(S='div[data-braintree-id="'+s.cardTypeIcons[m]+'-card-icon"]',O=document.querySelector(S),E(O))})},y.prototype._generateHostedFieldsOptions=function(){var P=this.client.getConfiguration().gatewayConfiguration.challenges,b=P.indexOf("cvv")!==-1,A=P.indexOf("postal_code")!==-1,m=this.merchantConfiguration.overrides,w={client:this.client,fields:{cardholderName:{container:this._getFieldContainer("cardholder-name"),placeholder:this.strings.cardholderNamePlaceholder},number:{container:this._getFieldContainer("number"),placeholder:I()},expirationDate:{container:this._getFieldContainer("expiration"),placeholder:this.strings.expirationDatePlaceholder},cvv:{container:this._getFieldContainer("cvv"),placeholder:C(3)},postalCode:{container:this._getFieldContainer("postal-code")}},styles:{input:{"font-size":"16px","font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',color:"#000"},":focus":{color:"black"},"::-webkit-input-placeholder":{color:"#6a6a6a"},":-moz-placeholder":{color:"#6a6a6a"},"::-moz-placeholder":{color:"#6a6a6a"},":-ms-input-placeholder ":{color:"#6a6a6a"},"input::-ms-clear":{color:"transparent"}}};return this.hasCardholderName||delete w.fields.cardholderName,b||delete w.fields.cvv,A||delete w.fields.postalCode,m&&(m.fields&&(m.fields.cvv&&typeof m.fields.cvv.placeholder<"u"&&(this._hasCustomCVVPlaceholder=!0),Object.keys(m.fields).forEach(function(S){if((S==="cvv"||S==="postalCode")&&m.fields[S]===null){delete w.fields[S];return}w.fields[S]&&n(w.fields[S],m.fields[S],{selector:w.fields[S].selector})})),m.styles&&Object.keys(m.styles).forEach(function(S){if(m.styles[S]===null){delete w.styles[S];return}else if(typeof m.styles[S]=="string"){w.styles[S]=m.styles[S];return}T(m.styles[S]),w.styles[S]=w.styles[S]||{},n(w.styles[S],m.styles[S])})),w},y.prototype._validateForm=function(P){var b,A,m,w,S=!0,O=this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;return this.hostedFieldsInstance?(w=this.hostedFieldsInstance.getState(),Object.keys(w.fields).forEach((function(R){var B=w.fields[R];!P&&!S||(B.isEmpty?!this.cardholderNameRequired&&R==="cardholderName"?S=!0:(S=!1,P&&this.showFieldError(R,this.strings["fieldEmptyFor"+_(R)])):B.isValid||(S=!1,P&&this.showFieldError(R,this.strings["fieldInvalidFor"+_(R)])))}).bind(this)),w.fields.number.isValid&&(b=w.cards[0],A=b&&s.configurationCardTypes[b.type],m=A&&O.indexOf(A)!==-1,m||(S=!1,P&&this.showFieldError("number",this.strings.unsupportedCardTypeError))),S):!1},y.prototype.getPaymentMethod=function(){var P=this._validateForm();if(P)return{type:s.paymentMethodTypes.card}},y.prototype.tokenize=function(){var P,b=this,A=b.hostedFieldsInstance.getState(),m={vault:this._shouldVault()};return this.model.clearError(),this._validateForm(!0)?(!this.cardholderNameRequired&&A.fields.cardholderName&&A.fields.cardholderName.isEmpty&&(m.fieldsToTokenize=Object.keys(A.fields).filter(function(w){return w!=="cardholderName"})),b._isTokenizing=!0,b.hostedFieldsInstance.tokenize(m).then(function(w){var S=b.merchantConfiguration.clearFieldsAfterTokenization===!1;return S||Object.keys(A.fields).forEach(function(O){b.hostedFieldsInstance.clear(O)}),b._shouldVault()&&(w.vaulted=!0),new Promise(function(O){P=function(){setTimeout(function(){b.model.addPaymentMethod(w),O(w),b.element.classList.remove("braintree-sheet--tokenized")},0)},p.onTransitionEnd(b.element,"max-height",P),setTimeout(function(){b.allowUserAction(),b._isTokenizing=!1},s.CHANGE_ACTIVE_PAYMENT_METHOD_TIMEOUT),b.element.classList.add("braintree-sheet--tokenized")})}).catch(function(w){return b._isTokenizing=!1,b.model.reportError(w),b.allowUserAction(),Promise.reject(new l({message:s.errors.NO_PAYMENT_METHOD_ERROR,braintreeWebError:w}))})):(b.model.reportError("hostedFieldsFieldsInvalidError"),b.allowUserAction(),Promise.reject(new l(s.errors.NO_PAYMENT_METHOD_ERROR)))},y.prototype.showFieldError=function(P,b){var A,m=this.getElementById(g(P)+"-field-group"),w=m.querySelector("input");this.fieldErrors.hasOwnProperty(P)||(this.fieldErrors[P]=this.getElementById(g(P)+"-field-error")),m.classList.add("braintree-form__field-group--has-error"),A=this.fieldErrors[P],A.innerHTML=b,w?w.setAttribute("aria-invalid",!0):(this.hostedFieldsInstance.setAttribute({field:P,attribute:"aria-invalid",value:!0}),this.hostedFieldsInstance.setMessage({field:P,message:b}))},y.prototype.hideFieldError=function(P){var b=this.getElementById(g(P)+"-field-group"),A=b.querySelector("input");this.fieldErrors.hasOwnProperty(P)||(this.fieldErrors[P]=this.getElementById(g(P)+"-field-error")),b.classList.remove("braintree-form__field-group--has-error"),A?A.removeAttribute("aria-invalid"):(this.hostedFieldsInstance.removeAttribute({field:P,attribute:"aria-invalid"}),this.hostedFieldsInstance.setMessage({field:P,message:""}))},y.prototype.teardown=function(){return this.hostedFieldsInstance.teardown()},y.prototype._shouldVault=function(){return!this.model.isGuestCheckout&&this.saveCardInput.checked},y.prototype._getFieldContainer=function(P){return P==="expiration"&&(P="expiration-date"),this.getElementById(P+"-field-group").querySelector(".braintree-form__hosted-field")},y.prototype._onBlurEvent=function(P){var b=P.fields[P.emittedBy],A=this.getElementById(g(P.emittedBy)+"-field-group");A.classList.remove("braintree-form__field-group--is-focused"),b.isPotentiallyValid&&this.hideFieldError(P.emittedBy),this._shouldApplyFieldEmptyError(P.emittedBy,b)?this.showFieldError(P.emittedBy,this.strings["fieldEmptyFor"+_(P.emittedBy)]):!b.isEmpty&&!b.isValid?this.showFieldError(P.emittedBy,this.strings["fieldInvalidFor"+_(P.emittedBy)]):P.emittedBy==="number"&&!this._isCardTypeSupported(P.cards[0])&&this.showFieldError("number",this.strings.unsupportedCardTypeError),this.model._emit("card:blur",P),setTimeout((function(){this._shouldApplyFieldEmptyError(P.emittedBy,b)&&this.showFieldError(P.emittedBy,this.strings["fieldEmptyFor"+_(P.emittedBy)])}).bind(this),150)},y.prototype._onCardTypeChangeEvent=function(P){var b,A="#iconCardFront",m="#iconCVVBack",w=this.strings.cvvThreeDigitLabelSubheading,S=C(3),O=this.getElementById("number-field-group");P.cards.length===1?(b=P.cards[0].type,A="#icon-"+b,b==="american-express"&&(m="#iconCVVFront",w=this.strings.cvvFourDigitLabelSubheading,S=C(4)),O.classList.add("braintree-form__field-group--card-type-known")):O.classList.remove("braintree-form__field-group--card-type-known"),P.emittedBy==="number"&&this._isCardTypeSupported(P.cards[0])&&this.hideFieldError(P.emittedBy),this.cardNumberIconSvg.setAttribute("xlink:href",A),this.hasCVV&&(this.cvvIconSvg.setAttribute("xlink:href",m),this.cvvLabelDescriptor.innerHTML=w,this._hasCustomCVVPlaceholder||this.hostedFieldsInstance.setAttribute({field:"cvv",attribute:"placeholder",value:S})),this.model._emit("card:cardTypeChange",P)},y.prototype._onFocusEvent=function(P){var b=this.getElementById(g(P.emittedBy)+"-field-group");b.classList.add("braintree-form__field-group--is-focused"),this.model._emit("card:focus",P)},y.prototype._onNotEmptyEvent=function(P){this.hideFieldError(P.emittedBy),this.model._emit("card:notEmpty",P)},y.prototype._onValidityChangeEvent=function(P){var b,A=P.fields[P.emittedBy];P.emittedBy==="number"&&P.cards[0]?b=A.isValid&&this._isCardTypeSupported(P.cards[0]):b=A.isValid,A.container.classList.toggle("braintree-form__field--valid",b),A.isPotentiallyValid&&this.hideFieldError(P.emittedBy),this._sendRequestableEvent(),this.model._emit("card:validityChange",P)},y.prototype.requestPaymentMethod=function(){return this.preventUserAction(),this.tokenize()},y.prototype.onSelection=function(){this.hostedFieldsInstance&&(setTimeout((function(){this.hasCardholderName?this.hostedFieldsInstance.focus("cardholderName"):this.hostedFieldsInstance.focus("number")}).bind(this),50),this._sendRequestableEvent())},y.prototype._hideUnsupportedCardIcons=function(){var P=this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;Object.keys(s.configurationCardTypes).forEach((function(b){var A,m=s.configurationCardTypes[b];P.indexOf(m)===-1&&(A=this.getElementById(b+"-card-icon"),A.classList.add("braintree-hidden"))}).bind(this))},y.prototype._isCardTypeSupported=function(P){var b=P&&P.type,A=s.configurationCardTypes[b],m=this.client.getConfiguration().gatewayConfiguration.creditCards.supportedCardTypes;return m.indexOf(A)!==-1},y.isEnabled=function(P){var b=P.client.getConfiguration().gatewayConfiguration,A=P.merchantConfiguration.card===!1;return Promise.resolve(!A&&b.creditCards.supportedCardTypes.length>0)},y.prototype._shouldApplyFieldEmptyError=function(P,b){return!b.isEmpty||P==="cardholderName"&&!this.cardholderNameRequired?!1:v()};function E(P){P&&P.classList.add("braintree-hidden")}function v(){var P=document.activeElement&&document.activeElement.id,b=document.activeElement instanceof HTMLIFrameElement&&P.indexOf("braintree-hosted-field")!==-1;return b}function g(P){return P.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function _(P){return P[0].toUpperCase()+P.substr(1)}function T(P){Object.keys(P).forEach(function(b){var A=g(b);P[A]=P[b]})}function C(P){var b=d()?"•":"*";return Array(P+1).join(b)}function I(){var P=C(4);return[P,P,P,P].join(" ")}i.exports=y},{"../../constants":202,"../../lib/assign":208,"../../lib/dropin-error":212,"../../lib/is-utf-8":216,"../../lib/transition-helper":222,"../base-view":259,"braintree-web/hosted-fields":77}],268:[function(t,i,a){(function(n){(function(){var o=t("../../lib/assign").assign,s=t("../base-view"),l=t("braintree-web/google-payment"),c=t("../../lib/dropin-error"),d=t("../../constants"),p=t("@braintree/asset-loader"),u=t("../../lib/analytics");function h(){s.apply(this,arguments)}h.prototype=Object.create(s.prototype),h.prototype.constructor=h,h.ID=h.prototype.ID=d.paymentOptionIDs.googlePay,h.prototype.initialize=function(){var y=this,E,v,g;return y.googlePayConfiguration=o({},y.model.merchantConfiguration.googlePay),v=y.googlePayConfiguration.googlePayVersion,g=y.googlePayConfiguration.merchantId,E=o({buttonType:"short"},y.googlePayConfiguration.button,{onClick:function(_){_.preventDefault(),y.preventUserAction(),y.tokenize().then(function(){y.allowUserAction()})}}),delete y.googlePayConfiguration.googlePayVersion,delete y.googlePayConfiguration.merchantId,delete y.googlePayConfiguration.button,l.create({client:y.client,googlePayVersion:v,googleMerchantId:g}).then(function(_){y.googlePayInstance=_,y.paymentsClient=f(y.client)}).then(function(){var _=y.getElementById("google-pay-button");_.appendChild(y.paymentsClient.createButton(E)),y.model.asyncDependencyReady(h.ID)}).catch(function(_){y.model.asyncDependencyFailed({view:y.ID,error:new c(_)})})},h.prototype.tokenize=function(){var y=this,E=y.googlePayInstance.createPaymentDataRequest(y.googlePayConfiguration),v;return y.paymentsClient.loadPaymentData(E).then(function(g){return v=g,y.googlePayInstance.parseResponse(g)}).then(function(g){g.rawPaymentData=v,y.model.addPaymentMethod(g)}).catch(function(g){var _=g;if(g.statusCode==="DEVELOPER_ERROR")console.error(g),_="developerError";else if(g.statusCode==="CANCELED"){u.sendEvent(y.client,"googlepay.loadPaymentData.canceled");return}else g.statusCode&&u.sendEvent(y.client,"googlepay.loadPaymentData.failed");y.model.reportError(_)})},h.prototype.updateConfiguration=function(y,E){this.googlePayConfiguration[y]=E},h.isEnabled=function(y){var E=y.client.getConfiguration().gatewayConfiguration;return E.androidPay&&y.merchantConfiguration.googlePay?Promise.resolve().then(function(){return n.google&&n.google.payments&&n.google.payments.api&&n.google.payments.api.PaymentsClient?Promise.resolve():p.loadScript({id:d.GOOGLE_PAYMENT_SCRIPT_ID,src:d.GOOGLE_PAYMENT_SOURCE})}).then(function(){var v=f(y.client);return v.isReadyToPay({allowedPaymentMethods:["CARD","TOKENIZED_CARD"]})}).then(function(v){return!!v.result}):Promise.resolve(!1)};function f(y){return new n.google.payments.api.PaymentsClient({environment:y.getConfiguration().gatewayConfiguration.environment==="production"?"PRODUCTION":"TEST"})}i.exports=h}).call(this)}).call(this,typeof et<"u"?et:typeof self<"u"?self:typeof window<"u"?window:{})},{"../../constants":202,"../../lib/analytics":207,"../../lib/assign":208,"../../lib/dropin-error":212,"../base-view":259,"@braintree/asset-loader":1,"braintree-web/google-payment":70}],269:[function(t,i,a){var n=t("../../constants").paymentOptionIDs,o={};o[n.applePay]=t("./apple-pay-view"),o[n.card]=t("./card-view"),o[n.googlePay]=t("./google-pay-view"),o[n.paypal]=t("./paypal-view"),o[n.paypalCredit]=t("./paypal-credit-view"),o[n.venmo]=t("./venmo-view"),i.exports=o},{"../../constants":202,"./apple-pay-view":265,"./card-view":267,"./google-pay-view":268,"./paypal-credit-view":270,"./paypal-view":271,"./venmo-view":272}],270:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../../constants").paymentOptionIDs,s=t("./base-paypal-view");function l(){s.apply(this,arguments),this._isPayPalCredit=!0}l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.ID=l.prototype.ID=o.paypalCredit,l.isEnabled=function(c){return c.merchantConfiguration.paypalCredit?s.isEnabled(n({viewID:l.ID},c)):Promise.resolve(!1)},i.exports=l},{"../../constants":202,"../../lib/assign":208,"./base-paypal-view":266}],271:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../../constants").paymentOptionIDs,s=t("./base-paypal-view");function l(){s.apply(this,arguments)}l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.ID=l.prototype.ID=o.paypal,l.isEnabled=function(c){return c.merchantConfiguration.paypal?s.isEnabled(n({viewID:l.ID},c)):Promise.resolve(!1)},i.exports=l},{"../../constants":202,"../../lib/assign":208,"./base-paypal-view":266}],272:[function(t,i,a){var n=t("../../lib/assign").assign,o=t("../base-view"),s=t("braintree-web/venmo"),l=t("../../lib/dropin-error"),c=t("../../constants").paymentOptionIDs;function d(){o.apply(this,arguments)}d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.ID=d.prototype.ID=c.venmo,d.prototype.initialize=function(){var p=this,u=n({},p.model.merchantConfiguration.venmo,{client:this.client});return s.create(u).then(function(h){return p.venmoInstance=h,p.venmoInstance.hasTokenizationResult()?p.venmoInstance.tokenize().then(function(f){p.model.reportAppSwitchPayload(f)}).catch(function(f){p._isIgnorableError(f)||p.model.reportAppSwitchError(c.venmo,f)}):Promise.resolve()}).then(function(){var h=p.getElementById("venmo-button");h.addEventListener("click",function(f){return f.preventDefault(),p.preventUserAction(),p.venmoInstance.tokenize().then(function(y){p.model.addPaymentMethod(y)}).catch(function(y){p._isIgnorableError(y)||p.model.reportError(y)}).then(function(){p.allowUserAction()})}),p.model.asyncDependencyReady(d.ID)}).catch(function(h){p.model.asyncDependencyFailed({view:p.ID,error:new l(h)})})},d.prototype.requestPaymentMethod=function(){return this.model.reportError("venmoButtonMustBeUsed"),o.prototype.requestPaymentMethod.call(this)},d.prototype._isIgnorableError=function(p){return p.code==="VENMO_APP_CANCELED"||p.code==="VENMO_DESKTOP_CANCELED"},d.isEnabled=function(p){var u=p.client.getConfiguration().gatewayConfiguration,h=u.payWithVenmo&&!!p.merchantConfiguration.venmo;return h?Promise.resolve(s.isBrowserSupported(p.merchantConfiguration.venmo)):Promise.resolve(!1)},i.exports=d},{"../../constants":202,"../../lib/assign":208,"../../lib/dropin-error":212,"../base-view":259,"braintree-web/venmo":149}]},{},[205])(205)})})(by);var O4=by.exports;const D4=fi(O4);const R4={name:"BraintreeNewMethods",components:{Agreements:Hn,CheckboxComponent:Bn,ErrorMessage:ht,MyButton:mt,PrivacyPolicy:Ei,Recaptcha:un},data(){return{instance:null,storeMethod:!1,additionalComponents:"",paymentOptionPriority:[],map:{}}},computed:{...Cr(it,["showMagentoPayments"]),...ue(it,["vaultActive","clientToken","threeDSEnabled","threeDSThresholdAmount","alwaysRequestThreeDS","google","paypal","vaultedMethods","errorMessage"]),...ue(ge,["currencyCode","websiteName","paypalCreditThresholdEnabled","paypalCreditThresholdValue"]),...ue(Pe,["cart","cartGrandTotal"]),...ue(Oe,["customer","isLoggedIn"]),...ue(Ze,["availableMethods","firstOpenController","paymentEmitter","isPaymentMethodAvailable","getPaymentMethodTitle","getPaymentPriority","selectedMethod"]),...ue(Et,["getTypeByPlacement"])},async created(){await this.getInitialConfig(),await this.createClientToken(),await this.getCart(),this.setLoadingState(!0);const e=(this.cartGrandTotal/100).toString();this.map={braintree:"card",braintree_applepay:"applePay",braintree_googlepay:"googlePay",braintree_venmo:"venmo",braintree_paypal:"paypal"};const r=this.availableMethods.filter(({code:n})=>n.startsWith("braintree"));if(this.paymentOptionPriority=r.map(({code:n})=>this.map[n]).filter(Boolean),this.paymentOptionPriority.includes("paypal")&&this.paypal.creditActive)if(this.paypalCreditThresholdEnabled){if(e>=Number(this.paypalCreditThresholdValue)){const n=this.paymentOptionPriority.indexOf("paypal");this.paymentOptionPriority.splice(n+1,0,"paypalCredit"),this.map.braintree_paypal_credit="paypalCredit"}}else{const n=this.paymentOptionPriority.indexOf("paypal");this.paymentOptionPriority.splice(n+1,0,"paypalCredit"),this.map.braintree_paypal_credit="paypalCredit"}const t={authorization:this.clientToken,container:"#braintree-drop-in",threeDSecure:!1,paymentOptionPriority:this.paymentOptionPriority,translations:{Card:this.getPaymentMethodTitle("braintree"),PayPal:this.getPaymentMethodTitle("braintree_paypal")}};this.isPaymentMethodAvailable("braintree")&&(t.card={vault:{allowVaultCardOverride:!0,vault:this.isLoggedIn}}),this.isPaymentMethodAvailable("braintree_applepay")&&(t.applePay={displayName:this.websiteName,paymentRequest:{total:{label:this.websiteName,amount:e}}}),this.isPaymentMethodAvailable("braintree_googlepay")&&(t.googlePay={merchantId:this.google.merchantId,googlePayVersion:2,transactionInfo:{currencyCode:this.currencyCode,totalPriceStatus:"FINAL",totalPrice:e},allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:this.google.cCTypes,billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}}],button:{buttonColor:this.google.buttonColor}}),this.isPaymentMethodAvailable("braintree_paypal")&&(t.paypal={flow:"checkout",amount:e,commit:!0,lineItems:this.getPayPalLineItems(),buttonStyle:{color:this.paypal.buttonColor,label:this.paypal.buttonLabel,shape:this.paypal.buttonShape,size:"responsive"},sdkConfig:{currency:this.currencyCode,dataAttributes:{"csp-nonce":window.cspNonce}}},this.paypal.paylaterActive&&(t.paypal.sdkConfig["enable-funding"]="paylater"),this.paypal.creditActive&&(this.paypalCreditThresholdEnabled&&e>=Number(this.paypalCreditThresholdValue),t.paypal.sdkConfig["enable-funding"]="credit")),this.isPaymentMethodAvailable("braintree_venmo")&&(t.venmo={allowDesktop:!0});const i=this.cartGrandTotal/100,a=this.threeDSThresholdAmount;this.threeDSEnabled&&i>=a&&(t.threeDSecure={amount:i}),D4.create(t,this.afterBraintreeInit)},unmounted(){this.removeEventListeners(),this.instance&&(this.instance.teardown(),this.setThreeDSInstance(null))},watch:{selectedMethod:{handler(e){e!==null&&(!e.startsWith("braintree")||e==="braintree-lpm"||e==="braintree-ach")&&this.clearSelectedMethod(e)},immediate:!0,deep:!0}},methods:{...ce(xt,["setLoadingState"]),...ce($t,["validateAgreements"]),...ce(it,["createClientToken","unselectVaultedMethods","setClientInstance","setThreeDSInstance","setErrorMessage","clearErrorMessage","escapeNonAsciiCharacters","getPayPalLineItems"]),...ce(Pe,["getCart"]),...ce(ge,["getInitialConfig"]),...ce(Ze,["selectPaymentMethod","setPaymentErrorMessage"]),...ce(Et,["validateToken"]),startPayment(){this.paymentEmitter.emit("braintreePaymentStart"),this.setLoadingState(!0),this.requestPaymentMethod().then(this.getPaymentData).then(this.validateRecaptcha).then(hn).then(()=>St(["cart"])).then(this.redirectToSuccess).catch(e=>{var r,t;this.clearSelectedPaymentMethod(),this.setLoadingState(!1),e.name!=="DropinError"&&this.setErrorMessage(((t=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:t.message)||e.message),this.paymentEmitter.emit("braintreePaymentError")})},requestPaymentMethod(){return new Promise((e,r)=>{this.setErrorMessage(""),(async()=>{if(!this.validateAgreements()){const c=new Error;c.name="DropinError",r(c);return}this.instance||r(new Error("Unable to initialise payment components."));const i=this.cart.billing_address,a=this.escapeNonAsciiCharacters(i.firstname),n=this.escapeNonAsciiCharacters(i.lastname),o={givenName:a,surname:n,phoneNumber:i.telephone,streetAddress:i.street[0],extendedAddress:i.street[1],locality:i.city,region:i.region_code,postalCode:i.postcode,countryCodeAlpha2:i.country_code},s=this.cartGrandTotal/100,l=this.alwaysRequestThreeDS;this.instance.requestPaymentMethod({threeDSecure:{amount:parseFloat(s).toFixed(2),email:this.customer.email,billingAddress:o,challengeRequested:l}},(c,d)=>{c?(this.setPaymentErrorMessage(c.message),r(c.message)):d.liabilityShifted||!d.liabilityShifted&&!d.liabilityShiftPossible||d.type!=="CreditCard"&&d.type!=="AndroidPayCard"?e(d):r(new Error("There was an error completing validation, please try again."))})})().catch(r)})},getPaymentData(e){return{email:this.customer.email,paymentMethod:{method:this.getBraintreeMethod(e.type),additional_data:{payment_method_nonce:e.nonce,is_active_payment_token_enabler:this.storeMethod},extension_attributes:pn()}}},async validateRecaptcha(e){if(!await this.validateToken("braintree"))throw new Error(this.$t("ReCaptcha validation failed, please try again."));return e},getBraintreeMethod(e){switch(e){case"AndroidPayCard":return"braintree_googlepay";case"ApplePayCard":return"braintree_applepay";case"PayPalAccount":return"braintree_paypal";default:return"braintree"}},afterBraintreeInit(e,r){if(this.showMagentoPayments=!0,this.setLoadingState(!1),this.setClientInstance(r._client),r._threeDSecure&&this.setThreeDSInstance(r._threeDSecure._instance),this.instance=r,this.attachEventListeners(r),this.movePaymentContainers(),this.selectedMethod.startsWith("braintree")){const[t]=this.paymentOptionPriority;this.selectPaymentMethod(t),this.setToCurrentViewId()}this.paymentEmitter.emit("braintreeInitComplete"),this.modifyTokenize()},attachEventListeners(e){e.on("changeActiveView",({newViewId:r,previousViewId:t})=>{if(this.removeActiveClass(),this.clearErrorMessage(),r==="methods")this.paymentEmitter.emit("changePaymentMethodDisplay",{visible:!1}),t!=="card"&&this.startPayment();else if(r!=="options"){this.addActiveClass(r);const i=r==="card"?"braintree":`braintree_${r}`;this.selectPaymentMethod(i),this.selectedMethod=r,r==="card"?this.additionalComponents=".braintree-form__flexible-fields":r==="paypal"?this.additionalComponents='div[data-braintree-id="paypal-button"]':r==="paypalCredit"?this.additionalComponents='div[data-braintree-id="paypal-credit-button"]':r==="googlePay"?this.additionalComponents='div[data-braintree-id="google-pay-button"]':r==="applePay"?this.additionalComponents=".braintree-applePay .braintree-sheet__content":r==="venmo"&&(this.additionalComponents=".braintree-venmo .braintree-sheet__content")}}),e.on("3ds:customer-canceled",()=>{this.$refs.braintreeContainer.querySelector(".braintree-options")&&this.clearSelectedPaymentMethod()}),this.paymentEmitter.on("changePaymentMethodDisplay",this.changePaymentMethodDisplay),this.paymentEmitter.on("braintreeStoredPaymentCardSelected",this.clearSelectedPaymentMethod),this.paymentEmitter.on("braintreePaymentStart",this.showLoader),this.paymentEmitter.on("braintreePaymentError",this.hideLoader)},removeEventListeners(){this.paymentEmitter.off("changePaymentMethodDisplay",this.changePaymentMethodDisplay),this.paymentEmitter.off("braintreeStoredPaymentCardSelected",this.clearSelectedPaymentMethod),this.paymentEmitter.off("braintreePaymentStart",this.showLoader),this.paymentEmitter.off("braintreePaymentError",this.hideLoader)},clearSelectedMethod(e){this.unselectVaultedMethods(),e!==null&&(!e.startsWith("braintree")||e==="braintree-lpm"||e==="braintree-ach")&&this.clearSelectedPaymentMethod(),this.storeMethod=!1},changePaymentMethodDisplay({visible:e}){this.$refs.braintreeContainer.querySelectorAll(".braintree-sheet__container .braintree-sheet").forEach(t=>{t.classList.toggle("braintree-hidden",!e)})},movePaymentContainers(){this.$refs.braintreeContainer.querySelectorAll(".braintree-sheet__container .braintree-sheet").forEach(r=>{const{braintreeId:t}=r.dataset,i=this.$refs.braintreeContainer.querySelector(`.braintree-option__${t}`);if(i){const a=Object.values(this.map).findIndex(s=>s===t),n=this.getPaymentPriority(Object.keys(this.map)[a]),o=s=>{r.style.setProperty("--braintree-method-position",s),r.prepend(i)};if(n!==-1)o(n+1);else if(t==="paypalCredit"){const s=Object.values(this.map).findIndex(c=>c==="paypal"),l=this.getPaymentPriority(Object.keys(this.map)[s]);o(l+2)}if(t==="card"){const s=r.querySelector(".braintree-sheet__icons");i.append(s)}}})},modifyTokenize(){if(this.isPaymentMethodAvailable("braintree_googlepay")){const e=this.instance._mainView._views.googlePay.tokenize.bind(Be(this.instance._mainView._views.googlePay));this.instance._mainView._views.googlePay.tokenize=async()=>(this.setErrorMessage(""),this.validateAgreements()?e():Promise.resolve())}if(this.isPaymentMethodAvailable("braintree_venmo")){const e=this.instance._mainView._views.venmo.venmoInstance.tokenize.bind(this.instance._mainView._views.venmo.venmoInstance);this.instance._mainView._views.venmo.venmoInstance.tokenize=async()=>(this.setErrorMessage(""),this.validateAgreements()?e():Promise.resolve())}if(this.isPaymentMethodAvailable("braintree_paypal")){const e=this.instance._mainView._views.paypal.paypalInstance.createPayment.bind(this.instance._mainView._views.paypal.paypalInstance);this.instance._mainView._views.paypal.paypalInstance.createPayment=async r=>(this.setErrorMessage(""),this.validateAgreements()?e(r):Promise.reject())}},addActiveClass(e){const r=e==="card"?".braintree-option__card":`.braintree-option__${e}`,t=this.$refs.braintreeContainer.querySelector(r);t&&t.classList.add("braintree-option__selected")},removeActiveClass(){this.$refs.braintreeContainer.querySelectorAll(".braintree-option").forEach(r=>{r.classList.remove("braintree-option__selected")})},clearSelectedPaymentMethod(){this.instance!==null&&(this.instance.clearSelectedPaymentMethod(),this.paymentEmitter.emit("changePaymentMethodDisplay",{visible:!0}))},setToCurrentViewId(){this.instance._mainView.setPrimaryView(this.selectedMethod)},redirectToSuccess(){window.location.href=kr()},showLoader(){this.instance._mainView.showLoadingIndicator()},hideLoader(){this.instance._mainView.hideLoadingIndicator()}}},L4={id:"braintree-drop-in",ref:"braintreeContainer",class:"braintree-drop-in","data-cy":"braintree-drop-in-container"};function k4(e,r,t,i,a,n){const o=Y("ErrorMessage"),s=Y("CheckboxComponent"),l=Y("Agreements"),c=Y("Recaptcha"),d=Y("PrivacyPolicy"),p=Y("MyButton");return D(),z(Ee,null,[k("div",L4,null,512),a.additionalComponents!==""?(D(),ne(Cl,{key:0,to:a.additionalComponents},[e.errorMessage?(D(),ne(o,{key:0,message:e.errorMessage,attached:!1,margin:!1},null,8,["message"])):$("",!0),e.isLoggedIn&&(e.selectedMethod==="braintree"&&e.vaultActive||e.selectedMethod==="braintree_googlePay"&&e.google.vaultActive||e.selectedMethod==="braintree_paypal"&&e.paypal.vaultActive)?(D(),ne(s,{key:1,id:"braintree-store-method",class:"braintree-store-method",checked:a.storeMethod,"change-handler":({currentTarget:u})=>a.storeMethod=u.checked,text:e.$t("braintree.storePayment"),"data-cy":"braintree-save-payment-card-checkbox"},null,8,["checked","change-handler","text"])):$("",!0),j(l,{id:"braintreeNew"}),e.getTypeByPlacement("braintree")?(D(),ne(c,{key:2,id:"braintree",location:"braintreeNewMethods"})):$("",!0),j(d),e.selectedMethod==="braintree"?(D(),ne(p,{key:3,label:"Pay",primary:"",onClick:r[0]||(r[0]=u=>n.startPayment()),"data-cy":"braintree-new-card-pay-button"})):$("",!0)],8,["to"])):$("",!0)],64)}const Cy=_e(R4,[["render",k4]]);const M4={name:"BraintreeDropIn",components:{BraintreeAch:gy,BraintreeLpm:Ey,BraintreeNewMethods:Cy},computed:{...ue(Oe,["isLoggedIn"]),...ue(Ze,["isPaymentMethodAvailable"])}};function F4(e,r,t,i,a,n){const o=Y("BraintreeNewMethods"),s=Y("BraintreeLpm"),l=Y("BraintreeAch");return D(),z(Ee,null,[j(o),e.isPaymentMethodAvailable("braintree_local_payment")?(D(),ne(s,{key:0})):$("",!0),e.isPaymentMethodAvailable("braintree_ach_direct_debit")?(D(),ne(l,{key:1})):$("",!0)],64)}const Py=_e(M4,[["render",F4]]);const x4={name:"SavedShippingMethod",components:{TextField:Ye,Shipping:Po,Price:gi,Edit:dn},data(){return{shippingStepCompletedText:"",shippingStepCompletedTextId:"bluefinch-checkout-shippingstepcompleted-text"}},async created(){var e;this.locale||await this.getInitialConfig(),this.shippingStepCompletedText=((e=window.bluefinchCheckout)==null?void 0:e[this.shippingStepCompletedTextId])||this.$t("shippingStep.stepCompleteTitle")},computed:{...ue(Pe,["cart"]),...ue(Pt,["selectedMethod"]),...ue(ge,["locale"])},methods:{...ce(ge,["getInitialConfig"]),...ce(Rr,["goToShipping"]),setDetailsStepActive(){const e=document.getElementById("progress-bar");e&&e.classList.add("shipping-active"),this.goToShipping()}}},V4={class:"saved-shipping"},U4={class:"saved-shipping__title"},B4={class:"order-total"},H4={class:"total__row"},z4={class:"saved-shipping__icon"},K4={class:"saved-shipping__icon-image"},j4={class:"title"},W4={class:"shipping-method-title"},Y4={class:"proceed-to-shipping"},G4=["aria-label"];function $4(e,r,t,i,a,n){const o=Y("Shipping"),s=Y("TextField"),l=Y("Price"),c=Y("Edit"),d=Y("router-link");return D(),z("div",V4,[j(d,{class:"saved-shipping-link","aria-label":"proceed-to-shipping-link","data-cy":"completed-step-shipping-trigger",to:"/shipping",onClick:r[0]||(r[0]=p=>{n.setDetailsStepActive()})},{default:ze(()=>{var p,u,h,f,y,E,v,g,_,T,C;return[k("div",U4,[k("div",B4,[k("div",H4,[k("div",z4,[k("div",K4,[j(o,{"data-cy":"completed-step-shipping-icon"})]),k("div",j4,[j(s,{text:a.shippingStepCompletedText,"data-cy":"completed-step-shipping-title"},null,8,["text"])])]),k("div",W4,[j(s,{text:`${(h=(u=(p=e.cart.shipping_addresses)==null?void 0:p[0])==null?void 0:u.selected_shipping_method)==null?void 0:h.method_title}, `,"data-cy":"completed-step-shipping-content-method"},null,8,["text"]),j(l,{class:"shipping-method-value",value:((v=(E=(y=(f=e.cart.shipping_addresses)==null?void 0:f[0])==null?void 0:y.selected_shipping_method)==null?void 0:E.price_incl_tax)==null?void 0:v.value)??((C=(T=(_=(g=e.cart.shipping_addresses)==null?void 0:g[0])==null?void 0:_.selected_shipping_method)==null?void 0:T.amount)==null?void 0:C.value),"data-cy":"completed-step-shipping-content-price"},null,8,["value"])])])])]),k("div",Y4,[k("button",{class:"button--blank edit-shipping-button","aria-label":e.$t("yourDetailsSection.editShippingButtonLabel"),"data-cy":"completed-step-shipping-edit-button"},[j(s,{class:"edit-button-title",text:e.$t("yourDetailsSection.editButton"),"data-cy":"completed-step-shipping-edit-button-text"},null,8,["text"]),j(c,{"data-cy":"completed-step-shipping-edit-icon"})],8,G4)])]}),_:1})])}const Ay=_e(x4,[["render",$4],["__scopeId","data-v-fcbbe81e"]]);const Q4={name:"Rewards",components:{MyButton:mt},computed:{...ue(Pe,["cart"]),...ue(Oe,["customer"])},methods:{...ce(Pe,["useRewardPoints","removeRewardPoints"]),getFormattedPrice(){return br(this.customer.reward_points.balance.money.value)}}},Z4={key:0,class:"reward-points"},q4={"data-cy":"rewards-you-have-text"},J4={class:"reward-points-available","data-cy":"rewards-points-text"},X4={"data-cy":"rewards-available-text"},e8={key:1,class:"reward-points"},t8={"data-cy":"rewards-applied-text"};function r8(e,r,t,i,a,n){var s,l,c,d,p,u;const o=Y("MyButton");return(l=(s=e.customer.reward_points)==null?void 0:s.balance)!=null&&l.points&&!((c=e.cart.applied_reward_points)!=null&&c.points)?(D(),z("div",Z4,[k("div",null,[k("span",q4,Te(e.$t("rewards.youHave")),1),k("span",J4,Te(e.$t("rewards.rewardPoints",{points:e.customer.reward_points.balance.points})),1),k("span",X4,Te(e.$t("rewards.available")),1),k("span",null,"("+Te(n.getFormattedPrice())+")",1)]),j(o,{label:e.$t("rewards.applyButton"),"data-cy":"rewards-apply-button",secondary:"",onClick:r[0]||(r[0]=h=>e.useRewardPoints())},null,8,["label"])])):(p=(d=e.customer.reward_points)==null?void 0:d.balance)!=null&&p.points&&((u=e.cart.applied_reward_points)!=null&&u.points)?(D(),z("div",e8,[k("span",t8,Te(e.$t("rewards.applied")),1),j(o,{label:e.$t("rewards.removeButton"),"data-cy":"rewards-remove-button",secondary:"",onClick:r[1]||(r[1]=h=>e.removeRewardPoints())},null,8,["label"])])):$("",!0)}const Ty=_e(Q4,[["render",r8],["__scopeId","data-v-7d6e478b"]]);const n8={name:"StoreCredit",components:{MyButton:mt},computed:{...ue(Pe,["cart"]),...ue(Oe,["customer"])},methods:{...ce(Pe,["useStoreCredit","removeStoreCredit"]),getFormattedPrice(){return br(this.customer.store_credit.current_balance.value)}}},i8={key:0,class:"store-credit"},a8={class:"store-credit-available","data-cy":"store-credit-text"},o8={key:1,class:"store-credit"},s8={"data-cy":"store-credit-used-text"};function l8(e,r,t,i,a,n){var s,l,c,d,p,u,h;const o=Y("MyButton");return(c=(l=(s=e.customer)==null?void 0:s.store_credit)==null?void 0:l.current_balance)!=null&&c.value&&!((p=(d=e.cart.applied_store_credit)==null?void 0:d.applied_balance)!=null&&p.value)?(D(),z("div",i8,[k("div",null,[k("span",a8,Te(e.$t("storeCredit.applyStoreCredit",{value:n.getFormattedPrice()})),1)]),j(o,{label:e.$t("storeCredit.applyButton"),"data-cy":"use-store-credit-button",secondary:"",onClick:r[0]||(r[0]=f=>e.useStoreCredit())},null,8,["label"])])):(h=(u=e.cart.applied_store_credit)==null?void 0:u.applied_balance)!=null&&h.value?(D(),z("div",o8,[k("span",s8,Te(e.$t("storeCredit.removeStoreCredit")),1),j(o,{label:e.$t("storeCredit.removeButton"),"data-cy":"remove-store-credit-button",secondary:"",onClick:r[1]||(r[1]=f=>e.removeStoreCredit())},null,8,["label"])])):$("",!0)}const Iy=_e(n8,[["render",l8],["__scopeId","data-v-45ad5456"]]),wy=()=>{gt().trackGtmEvent({event:"paymentComplete"})},Sy=e=>{const{maskedId:r}=Pe(),{tokens:t}=Et(),i=` mutation PlaceOrder($cartId: String!, $paymentMethod: PaymentMethodInput!) { ${vc()} diff --git a/view/frontend/web/js/checkout/patches/braintree-web-drop-in+1.43.0.patch b/view/frontend/web/js/checkout/patches/braintree-web-drop-in+1.43.0.patch index e5b0e67c..a89993ca 100644 --- a/view/frontend/web/js/checkout/patches/braintree-web-drop-in+1.43.0.patch +++ b/view/frontend/web/js/checkout/patches/braintree-web-drop-in+1.43.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/braintree-web-drop-in/dist/browser/dropin.js b/node_modules/braintree-web-drop-in/dist/browser/dropin.js -index 3620025..e46fc54 100644 +index 3620025..fc59ad7 100644 --- a/node_modules/braintree-web-drop-in/dist/browser/dropin.js +++ b/node_modules/braintree-web-drop-in/dist/browser/dropin.js @@ -23853,6 +23853,12 @@ BasePayPalView.prototype.initialize = function () { @@ -15,7 +15,38 @@ index 3620025..e46fc54 100644 var checkoutJSConfiguration; var buttonSelector = '[data-braintree-id="paypal-button"]'; var environment = self.client.getConfiguration().gatewayConfiguration.environment === 'production' ? 'production' : 'sandbox'; -@@ -23898,7 +23904,7 @@ BasePayPalView.prototype.initialize = function () { +@@ -23868,6 +23874,30 @@ BasePayPalView.prototype.initialize = function () { + payment: function () { + return paypalInstance.createPayment(self.paypalConfiguration).catch(reportError); + }, ++ createOrder: function (data, actions) { ++ return actions.order.create({ ++ purchase_units: [{ ++ "amount": { ++ "currency_code": self.paypalConfiguration.sdkConfig.currency, ++ "value": self.paypalConfiguration.amount ++ } ++ }] ++ }); ++ }, ++ onApprove: (data) => { ++ return paypalInstance.tokenizePayment(data).then(function (tokenizePayload) { ++ var shouldNotVault = self.paypalConfiguration.vault && self.paypalConfiguration.vault.vaultPayPal === false; ++ ++ if (shouldNotVault) { ++ data.vault = false; ++ } ++ ++ if (!shouldNotVault && self.paypalConfiguration.flow === 'vault' && !self.model.isGuestCheckout) { ++ tokenizePayload.vaulted = true; ++ } ++ self.model.addPaymentMethod(tokenizePayload); ++ }).catch(reportError); ++ }, + onAuthorize: function (data) { + // NEXT_MAJOR_VERSION change out this vaultPayPal property + // to something more generic, such as vaultOnTokenization so +@@ -23898,7 +23928,7 @@ BasePayPalView.prototype.initialize = function () { }; Object.keys(global.paypal.FUNDING).forEach(function (key) { @@ -24,7 +55,7 @@ index 3620025..e46fc54 100644 return; } checkoutJSConfiguration.funding.disallowed.push(global.paypal.FUNDING[key]); -@@ -23913,11 +23919,15 @@ BasePayPalView.prototype.initialize = function () { +@@ -23913,11 +23943,15 @@ BasePayPalView.prototype.initialize = function () { buttonSelector = dropinWrapperId + ' ' + buttonSelector; @@ -45,7 +76,7 @@ index 3620025..e46fc54 100644 }).catch(reportError); function reportError(err) { -@@ -23959,31 +23969,7 @@ BasePayPalView.isEnabled = function (options) { +@@ -23959,31 +23993,7 @@ BasePayPalView.isEnabled = function (options) { return Promise.resolve(false); } diff --git a/view/frontend/web/js/checkout/src/components/Steps/PaymentPage/Braintree/DropIn/NewMethods/NewMethods.vue b/view/frontend/web/js/checkout/src/components/Steps/PaymentPage/Braintree/DropIn/NewMethods/NewMethods.vue index bcc15c69..61e4dc62 100644 --- a/view/frontend/web/js/checkout/src/components/Steps/PaymentPage/Braintree/DropIn/NewMethods/NewMethods.vue +++ b/view/frontend/web/js/checkout/src/components/Steps/PaymentPage/Braintree/DropIn/NewMethods/NewMethods.vue @@ -251,52 +251,10 @@ export default { } if (this.paypal.creditActive) { - if (this.paypalCreditThresholdEnabled) { - if (total >= Number(this.paypalCreditThresholdValue)) { - options.paypalCredit = { - flow: 'checkout', - amount: total, - currency: this.currencyCode, - buttonStyle: { - color: this.paypal.creditColor !== 'gold' - && this.paypal.creditColor !== 'blue' - && this.paypal.creditColor !== 'silver' - ? this.paypal.creditColor : 'darkblue', - label: this.paypal.creditLabel, - shape: this.paypal.creditShape, - size: 'responsive', - }, - commit: true, - sdkConfig: { - currency: this.currencyCode, - dataAttributes: { - 'csp-nonce': window.cspNonce, - }, - }, - }; - } + if (this.paypalCreditThresholdEnabled && total >= Number(this.paypalCreditThresholdValue)) { + options.paypal.sdkConfig['enable-funding'] = 'credit'; } else { - options.paypalCredit = { - flow: 'checkout', - amount: total, - currency: this.currencyCode, - buttonStyle: { - color: this.paypal.creditColor !== 'gold' - && this.paypal.creditColor !== 'blue' - && this.paypal.creditColor !== 'silver' - ? this.paypal.creditColor : 'darkblue', - label: this.paypal.creditLabel, - shape: this.paypal.creditShape, - size: 'responsive', - }, - commit: true, - sdkConfig: { - currency: this.currencyCode, - dataAttributes: { - 'csp-nonce': window.cspNonce, - }, - }, - }; + options.paypal.sdkConfig['enable-funding'] = 'credit'; } } }