PageSourceSearch

https://arthauss.co.uk/cdn/shopifycloud/checkout-web/assets/c1/f7742f92.IdRLMA01.js

js arthauss.co.uk collected 2026-10-08 11:40:07 UTC 57,124 bytes, 1 lines download raw bytes

1import{k as e,L as t,T as a,s as r,o,q as n,g as s,p as i,h as l,u as d,m as u,S as c}from"./2c1ab0fe.Bf8FS-kA.js";import{fK as g,fJ as p,cD as m,g8 as y,g9 as _,ga as h,fq as v,v as E,k as P,f9 as b,fx as A,gb as I,gc as S,aI as f,gd as R,fP as N,fO as C,b as O,c as T,ge as D}from"./164ad2e3.BPEX42uv.js";import{d9 as M,g4 as G,g5 as w,d3 as L,ea as k,g6 as H,au as Y,ar as U,c as B,c1 as F,aQ as V,g7 as x,a6 as z,aF as j,aG as Z,S as q,g8 as W,d8 as $,d7 as Q,g9 as K,ga as X,aT as J,a7 as ee,cV as te,gb as ae,gc as re,gd as oe,b5 as ne,ge as se,aR as ie}from"./4b4bc88f.C6QXxWcp.js";import{c as le}from"./71ae3d5c.D57ySY2w.js";import{g as de,u as ue}from"./cb8fcd45.i_aYtVJ1.js";import{u as ce,a as ge}from"./3a819064.BXw85K7s.js";import{u as pe,W as me}from"./8536083a.DKzaNAdK.js";import{v as ye}from"./2210eadb.DF0gIp_2.js";import{a as _e,b as he}from"./f67abd2c.DVYhtaBv.js";import{f as ve,g as Ee,s as Pe,r as be,B as Ae,P as Ie,T as Se,U as fe,V as Re,D as Ne,N as Ce,a as Oe,b as Te,c as De,d as Me,e as Ge,h as we,E as Le,I as ke,i as He,j as Ye,k as Ue,l as Be,u as Fe,m as Ve,n as xe,o as ze,p as je,q as Ze,t as qe,S as We,v as $e}from"./13b13169.BmfVZ12k.js";import{a as Qe,g as Ke}from"./e12db40c.2vh-yzuN.js";import{a as Xe,c as Je,b as et}from"./78ab3dd0.CCnSg37g.js";import{b as tt}from"./ed9f2238.hc0X2InV.js";import{S as at}from"./app.YmvH25zM.js";import{g as rt,a as ot,u as nt}from"./33464469.BZEIvxax.js";import{S as st}from"./ee2bb050.BMkfY2YF.js";import{r as it}from"./d25d1b95.Dqt_DMcu.js";import"./d0bb51ec.3dWJ276v.js";import"./60a453ce.Boic_DNC.js";import"./9dba8418.bYtorePf.js";import"./c6c0cbda.BXj5YQC9.js";import"./22345fd4.BoFvu5gm.js";import"./cdfd59e6.BaiEhbwb.js";import"./7fc410e0.C3Cozzap.js";import"./17e57de1.Dh6ifiWc.js";import"./ca3e798e.Dc6mNaNz.js";const lt=/^[A-Z]{1,2}[0-9]{1,2}[A-Z]?$/,dt=/^[A-Z][0-9][A-Z]$/,ut={apiVersion:2,apiVersionMinor:0};function ct(e,t){const a=e.find(e=>"ONE_TIME_PURCHASE"===e.deliveryLine.type),r=e.find(e=>"SUBSCRIPTION"===e.deliveryLine.type);let o="";if(r){if("PICK_UP"===r.methodType||"LOCAL"===r.methodType)return r.title;o=r.title}const n=[a?.title??"",o].filter(Boolean),[s,i]=n;return void 0===s?"":void 0===i?s:2===n.length?t.combineTwoShippingTitles(s,i):t.combineMultipleShippingTitles(n)}function gt(e){return pt(JSON.stringify(e))}function pt(e){return e.replace(/["']/g,"%")}function mt({paymentDue:e,subtotal:t,duties:a,taxes:r,deliveryNext:o,discountLines:n,tipLines:s,paymentLines:i,labels:l,i18nCurrency:d,checkoutTotal:u,deferredTotal:c,hasPayableDeposit:g,googlePayTransactionId:p,merchandiseLines:m,shouldWalletDecelerateForSubscriptions:y=!1,discountsZeroValueUXEnabled:_=!1}){const h=e?ve(e.amount):"0",v=g&&u&&c,E=v?ve(u.amount):void 0,P=v?ve(c.amount.amount):void 0,b=Boolean(m?.lines?.length),A=[];m?.lines&&m.lines.forEach(e=>{A.push({label:Ee(e),type:"LINE_ITEM",price:ve(e.totalPrice.amount)}),function(e,t){const a=new Map;return e.lineAllocations.forEach(e=>{e.allocations.filter(yt).forEach(e=>{const{title:t}=e.discountDetails;a.set(t,(a.get(t)??0)+e.amount.amount)})}),Array.from(a).filter(([,e])=>!t||0!==e).map(([e,t])=>({label:e,type:"LINE_ITEM",price:0===t?ve(t):w(ve(t))}))}(e,_).forEach(e=>{A.push(e)})}),t&&A.push({label:l.subtotal,type:"SUBTOTAL",price:ve(t.amount)}),function(e,t){return e?e.flatMap(e=>{if(!_e(e))return[];if(!G(e))return[];const a=e.amount?.amount;if(void 0===a)return[];if(t&&0===a)return[];const r=ve(a);return[{label:e.title,type:"LINE_ITEM",price:0===a?r:w(r)}]}):[]}(n?.lines,_).forEach(e=>{A.push(e)});const I=M(o).reduce((e,t)=>e+t.method.cost.amount,0);return A.push({label:l.shipping,type:"LINE_ITEM",price:ve(I)}),a&&"available_total"===a?.status&&0!==a?.totalDuty.amount&&A.push({label:l.duties,type:"LINE_ITEM",price:ve(a.totalDuty.amount)}),r&&"available_total"===r.status&&0!==r.totalTax.amount&&A.push({label:l.taxes,type:"LINE_ITEM",price:ve(r.totalTax.amount)}),n?.lines.forEach(e=>{if(_e(e)){if(b&&"LINE"===e.discount.presentationLevel&&"delivery"!==e.sourceTerm)return;if(G(e))return;const t=e.amount?.amount;t&&A.push({label:e.title,type:"LINE_ITEM",price:w(ve(t))})}}),i?.lines.filter(e=>
1"giftCard"===e.method.type).forEach(e=>{e.cost&&A.push({label:`${l.giftCard} ${L(e.method).toUpperCase()}`,type:"LINE_ITEM",price:w(ve(e.cost.amount))})}),s?.forEach(e=>{A.push({label:l.tip,type:"LINE_ITEM",price:ve(e.amount.amount)})}),E&&A.push({label:l.deposit,type:"LINE_ITEM",price:E}),P&&A.push({label:l.totalDueLater,type:"LINE_ITEM",price:P}),{totalPrice:E||h,currencyCode:t?.currencyCode||d,totalPriceStatus:"ESTIMATED",totalPriceLabel:E?l.totalDueToday:l.total,displayItems:A,...p&&{transactionId:p},...y&&{checkoutOption:"CONTINUE_TO_REVIEW"}}}function yt(e){return he(e.discountDetails.discount)&&"LINE"===e.discountDetails.discount.presentationLevel}function _t({googleAddress:e,isFirstNameRequired:t}){let a=e.iso3166AdministrativeArea||void 0,r=e.locality||void 0,o=e.countryCode;"AE"===e.countryCode&&(r=e.administrativeArea),e.countryCode&&H.includes(e.countryCode)&&(a=e.countryCode,o="US");const n={city:r,postalCode:e.postalCode||void 0,zoneCode:a,countryCode:o};if("name"in e){const[a,...r]=(e.name||"").split(" ");0===r.length?(n.lastName=a,t&&(n.firstName=n.lastName)):(n.firstName=a,n.lastName=r.join(" "))}return"address1"in e&&(n.address1=e.address1),"address2"in e&&(n.address2=e.address2),"phoneNumber"in e&&(n.phone=e.phoneNumber),n}function ht({costAfterDiscounts:e,deliveryPromisePresentmentTitle:t}){const{short:a}=t||{};return`${a?`(${a}) `:""}${ve(e.amount)} ${e.currencyCode}`}function vt(e,t){e.log("google_pay_authorization_decelerated","Google Pay authorization decelerated",t)}function Et(){const{i18n:e}=B();return a(()=>({total:e.translate("order_summary.total_label"),subtotal:e.translate("order_summary.subtotal_label"),shipping:e.translate("order_summary.shipping_label"),duties:e.translate("order_summary.duties_label"),taxes:e.translate("order_summary.estimated_taxes_label"),giftCard:e.translate("order_summary.gift_card_label"),tip:e.translate("order_summary.tip_label"),deposit:e.translate("order_summary.deposit_label"),totalDueToday:e.translate("order_summary.total_due_today_label"),totalDueLater:e.translate("order_summary.total_due_later_label")}),[e])}function Pt(){const{shop:{name:t,myshopifyDomain:a}}=B(),r=g("GOOGLE_PAY");return e(()=>{const e=r.value;return void 0===e?void 0:{merchantName:t,merchantId:e.merchantId,merchantOrigin:a,authJwt:e.authJwt}})}const bt="GOOGLE_PAY";class At extends at{constructor(){super(...arguments),this.name="GooglePayGenericError"}}class It extends at{constructor(){super(...arguments),this.name="GooglePayCreateButtonError"}}class St extends at{constructor(){super(...arguments),this.name="GooglePayDeveloperError"}}class ft extends at{constructor(){super(...arguments),this.name="GooglePayUnexpectedStatusCodeError"}}class Rt extends at{constructor(){super(...arguments),this.name="GooglePaySubmissionError"}}class Nt extends at{constructor(){super(...arguments),this.name="GooglePayInvalidError"}}class Ct extends at{constructor(){super(...arguments),this.name="GooglePayNegotiationError"}}function Ot({currentPage:e,plan:t},a){const r=new Set;if(!e)return r;const o=t.greenPath.findIndex(t=>_(t,e));for(const n of t.greenPath.slice(0,o+1))for(const e of h(n,a))r.add(e);return r}class Tt extends Ae{constructor(e,t,a){super(),this.observability=e,this.translated=t,this.reportAddressRequirementMismatch=a}get negotiationResultMapper(){return null}validatePaymentCurrency({initialCurrencyCode:e,currentCurrencyCode:t}){return null==e||null==t?(this.observability.leaveErrorBreadcrumb("[GooglePay] validatePaymentCurrency skipped currency comparison, missing currency code",{initialCurrencyCode:e,currentCurrencyCode:t}),{}):e===t?(this.observability.log("google_pay_validate_payment_currency_succeeded","[GooglePay] validatePaymentCurrency succeeded, currency codes match",{currencyCode:t}),{}):(this.observability.leaveErrorBreadcrumb("[GooglePay] validatePaymentCurrency blocking submission, currency change",{initialCurrencyCode:e,currentCurrencyCode:t}),this.observability.counter({name:"wallet_action_generator_handled_error",value:1,attributes:{violationCode:"CURRENCY_CHANGE",WalletName:Xe.GooglePay}}),{paymentSheetAction:{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_AUTHORIZATION",message:this.translated.currencyChangeError}]}})}get completionResultMapper(){return new Ie({success:({result:e})=>"receipt"in e?{action:"submit"}:{action:"abort"},rejected:({result:e,violationActions:t,options:a})=>{const r=e.violations??[];
1this.getUnhandledErrors(r,t).forEach(e=>{this.observability.error(new Rt(`submitForCompletion in ${this.isRedesign()?"redesign":"3-page"} Google Pay failed due to unhandled error ${e.code}`,{groupingHash:`GooglePaySubmissionError::SubmitForCompletion::UnhandledError::${e.code}`}),{severity:"error"})});const{firstPaymentSheetAction:o,violationCode:n}=this.getMergedPaymentSheetAction({resultViolations:r,violationActions:t});return n&&this.observability.counter({name:"wallet_action_generator_handled_error",value:1,attributes:{violationCode:n,WalletName:Xe.GooglePay}}),this.reportAddressRequirementMismatch({violationCode:n,wallet:Xe.GooglePay,asPaymentMethod:Boolean(a?.asPaymentMethod),outcome:this.isRedesign()?"decelerate":o?.action??"abort"}),this.logCompletionDeceleration({asPaymentMethod:Boolean(a?.asPaymentMethod),layout:a?.layout,violationCode:n??r.at(0)?.code??"unknown",violations:r.map(e=>e.code).join(",")}),o||{action:"abort"}},invalid:({result:e,options:t})=>{const a={reasons:JSON.stringify(e.reasons),action:"invalid"};return this.observability.counter({name:"WalletsPlatform_google_pay_payment_sheet_unexpected_action",value:1,attributes:a}),this.logCompletionDeceleration({asPaymentMethod:Boolean(t?.asPaymentMethod),layout:t?.layout,violationCode:e.reasons.at(0)??"unknown",violations:e.reasons.join(",")}),{action:"abort"}},denied:()=>({action:"abort"}),throttled:()=>({action:"abort"}),tooManyRequests:()=>({action:"abort"}),alreadyCompleted:()=>({action:"abort"}),fetch_failed:()=>(this.observability.counter({name:"WalletsPlatform_google_pay_payment_sheet_unexpected_action",attributes:{action:"fetch_failed"},value:1}),{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_AUTHORIZATION",message:this.translated.genericError}]})},e=>this.mapUnhandledStatus(e),(e,t)=>this.getCompletionViolationActions(e,t))}logCompletionDeceleration(e){this.isRedesign()&&vt(this.observability,{reason:"submitForCompletion",...e})}mapUnhandledStatus(e){return this.observability.error(new Rt(`Unhandled completion status: ${e.status}`,{groupingHash:`GooglePaySubmissionError::UnhandledCompletionStatus::${e.status}`})),{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_AUTHORIZATION",message:this.translated.genericError}]}}}class Dt extends Tt{constructor(e,t,a,r){super(e,t,r),this.inMemoryGooglePayParts=a}validateBilling(e){const t=e.paymentMethodData.info?.billingAddress;return t?{shouldPersist:!0}:this.genericPaymentMethodError()}validateShipping(e,t){const a=e.shippingAddress;return t?a?{shouldPersist:!0}:this.genericPaymentMethodError():{shouldPersist:!1}}isRedesign(){return!0}getCompletionViolationActions(e,t){return[{violations:[...q,"MERCHANDISE_NOT_APPLICABLE",W,...Se,...fe,...Re,"LOCALIZATION_EXTENSION_FIELD_ERROR",...Ne,...Ce,"DELIVERY_WRONG_NUMBER_OF_DELIVERY_LINES",...Oe,...Te,...De,...$,"PAYMENTS_METHOD_REQUIRED","PAYMENTS_METHOD",...Me,...Ge,...Q,"PAYMENTS_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN","BUYER_IDENTITY_MISSING_CONTACT_METHOD",...we,"BUYER_IDENTITY_EMAIL_REQUIRED",...Le,...ke,...K],generateAction:()=>({action:"abort"})},{violations:[...He,"BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE"],generateAction:()=>({action:"abort",effects:[()=>{this.inMemoryGooglePayParts.paymentSheetError.value={type:"unexpected_terminal_error"}}]})},{violations:["DELIVERY_ZONE_NOT_FOUND"],generateAction:()=>({action:"abort",effects:[()=>this.logZoneCompletionFailure(t,"DELIVERY_ZONE_NOT_FOUND")]})},{violations:["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY"],generateAction:()=>({action:"abort",effects:[()=>this.logZoneCompletionFailure(t,"DELIVERY_ZONE_REQUIRED_FOR_COUNTRY")]})}]}genericPaymentMethodError(){return{shouldPersist:!1,paymentSheetAction:{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_METHOD",message:this.translated.genericError}]}}}logZoneCompletionFailure(e,t){const{shippingZone:a,shippingCountry:r}=Ye(e);this.observability.log("redesign_payment_sheet_action_generator_payment_completion_failed","google_pay_payment_completion_failed",{reason:t,shippingZone:a,shippingCountry:r,result:e})}}class Mt extends Tt{constructor(e,t,a,r){super(e,t,r),this.inMemoryGooglePayParts=a}validateBilling(e){const t=e.paymentMethodData.info?.billingAddress;return t?{shouldPersist:!0}:{shouldPersist:!1,paymentSheetAction:{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_METHOD",message:this.translated.genericError}]}}}validateShipping(e,t,a){const r=e.shippingAddress;return t?r?a&&!r.address2?{shouldPersist:!1,paymentSheetAction:{action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.translated.addressLine2MissingError}]}}:{shouldPersist:!0}:{shouldPersist:!1,paymentSheetAction:{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_METHOD",message:this.translated.genericError}]}}:{shouldPersist:!1}}isRedesign(){return!1}getCompletionViolationActions(e,t){return[{violations:[...q,"MERCHANDISE_NOT_APPLICABLE",W,...Se,...fe,...Re,"LOCALIZATION_EXTENSION_FIELD_ERROR","DELIVERY_WRONG_NUMBER_OF_DELIVERY_LINES","DELIVERY_STRATEGY_CONDITIONS_NOT_SATISFIED",...ke,...K],generateAction:()=>({action:"abort"})},{violations:[...He,"BUYER_IDENTITY_MISSING_CONTACT_METHOD","BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE"],generateAction:()=>({action:"abort",effects:[()=>{this.inMemoryGooglePayParts.paymentSheetError.value={type:"unexpected_terminal_error"}}]})},{violations:Ne,generateAction:()=>({action:"abort",effects:[()=>{this.inMemoryGooglePayParts.paymentSheetError.value={type:"unusable_partial_address"}}]})},{violations:Ce,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:"SHIPPING_ADDRESS",message:this.translated.addressUnserviceableError}]})},{violations:["DELIVERY_FIRST_NAME_REQUIRED"],generateAction:()=>Gt(this.translated.firstNameMissingError)},{violations:["DELIVERY_LAST_NAME_REQUIRED"],generateAction:()=>Gt(this.translated.lastNameMissingError)},{violations:["DELIVERY_ADDRESS1_REQUIRED"],generateAction:()=>Gt(this.translated.addressLine1MissingError)},{violations:["DELIVERY_ADDRESS2_REQUIRED"],generateAction:()=>Gt(this.translated.addressLine2MissingError)},{violations:["DELIVERY_PHONE_NUMBER_REQUIRED","DELIVERY_OPTIONS_PHONE_NUMBER_REQUIRED"],generateAction:()=>Gt(this.translated.phoneMissingError)},{violations:["DELIVERY_POSTAL_CODE_REQUIRED"],generateAction:()=>Gt(this.translated.zipMissingError)},{violations:["DELIVERY_CITY_REQUIRED"],generateAction:()=>Gt(this.translated.cityMissingError)},{violations:["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY"],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.translated.zoneMissingError}],effects:[()=>{const{shippingZone:e,shippingCountry:a}=Ye(t);this.observability.log("three_page_payment_sheet_action_generator_payment_completion_failed","google_pay_payment_completion_failed",{reason:"DELIVERY_ZONE_REQUIRED_FOR_COUNTRY",shippingZone:e,shippingCountry:a,result:t})}]})},{violations:["DELIVERY_ZONE_NOT_FOUND"],generateAction:()=>{const{shippingZone:e,shippingCountry:a}=Ye(t);return{action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_OPTION",message:this.translated.zoneInvalidError}],effects:[()=>{this.observability.log("three_page_payment_sheet_action_generator_payment_completion_failed","google_pay_payment_completion_failed",{reason:"DELIVERY_ZONE_NOT_FOUND",shippingZone:e,shippingCountry:a,result:t})}]}}},{violations:[...Le,"BUYER_IDENTITY_EMAIL_REQUIRED"],generateAction:()=>Gt(this.translated.emailInvalidError)},{violations:["DELIVERY_COMPANY_REQUIRED","DELIVERY_ADDRESS1_CONTAINS_EMOJIS","DELIVERY_ADDRESS1_CONTAINS_HTML_TAGS","DELIVERY_ADDRESS1_CONTAINS_MATHEMATICAL_SYMBOLS","DELIVERY_LAST_NAME_CONTAINS_URL"],generateAction:()=>Gt(this.translated.addressInvalid)},{violations:[...we,"DELIVERY_OPTIONS_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN","DELIVERY_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"],generateAction:()=>Gt(this.translated.phoneInvalidError)},{violations:["DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE","DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY"],generateAction:()=>
1Gt(this.translated.zipInvalidError)},{violations:["PAYMENTS_METHOD_REQUIRED","PAYMENTS_METHOD"],generateAction:()=>wt(this.translated.genericError)},{violations:["PAYMENTS_FIRST_NAME_REQUIRED"],generateAction:()=>wt(this.translated.billingAddressFirstNameMissingError)},{violations:["PAYMENTS_LAST_NAME_REQUIRED"],generateAction:()=>wt(this.translated.lastNameMissingError)},{violations:["PAYMENTS_ADDRESS1_REQUIRED"],generateAction:()=>wt(this.translated.billingAddressLine1MissingError)},{violations:["PAYMENTS_CITY_REQUIRED"],generateAction:()=>wt(this.translated.billingAddressCityMissingError)},{violations:["PAYMENTS_ZONE_REQUIRED_FOR_COUNTRY"],generateAction:()=>wt(this.translated.billingAddressZoneMissingError)},{violations:["PAYMENTS_POSTAL_CODE_REQUIRED"],generateAction:()=>wt(this.translated.billingAddressZipMissingError)},{violations:["PAYMENTS_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"],generateAction:()=>wt(this.translated.billingAddressPhoneInvalidError)},{violations:[Ue],generateAction:()=>wt(this.translated.billingAddressZipInvalidError)},{violations:[Be],generateAction:()=>wt(this.translated.billingAddressZoneInvalidError)},{violations:["PAYMENTS_INVALID_POSTAL_CODE_FOR_ZONE"],generateAction:()=>wt(this.translated.billingZipInvalidError)},{violations:["PAYMENTS_ADDRESS1_CONTAINS_HTML_TAGS","PAYMENTS_CITY_CONTAINS_HTML_TAGS","PAYMENTS_LAST_NAME_CONTAINS_URL"],generateAction:()=>wt(this.translated.billingAddressInvalid)}]}}function Gt(e){return{action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:e}]}}function wt(e){return{action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:e}]}}function Lt(){const{persistedGooglePaySignal:e}=z(),{observability:t,checkout:a}=B(),r=x({availableDeliveryAddresses:a.negotiator.current.fields.availableDeliveryAddresses?.value,mustSelectProvidedAddress:a.negotiator.current.fields.mustSelectProvidedAddress?.value}),o=a.configuration.addressSettings.nonBillingAddressSettings.value,{deliveryLines:s,email:i,shippingAddress:l,paymentLines:d}=a.negotiator.parts;return n(()=>{t.leaveErrorBreadcrumb("[GooglePay] useClearGooglePayProposedState clearing proposed state");const a=X(d.value);d.value=a,i.value="",e.value={...e.value,description:void 0},r||(I(s,void 0),l.value=J({countryCode:o.defaultShippingDetails.country.code,zoneCode:o.defaultShippingDetails.zone.code}))},[o.defaultShippingDetails,r,e,s,i,d,l,t])}const kt={paymentMethod:{walletPaymentMethod:{name:"GOOGLE_PAY",walletContent:{googlePayWalletContent:{signature:"",signedMessage:"",protocolVersion:""}}}},amount:{any:!0}};function Ht({googlePayTransactionId:t}){const r=Et(),{checkout:o,i18n:s,observability:i,shop:l}=B(),{deliveryLines:d,shippingAddress:u}=o.negotiator.parts,c=o.configuration.addressSettings.nonBillingAddressSettings,g=Lt(),{persistedGooglePaySignal:p}=z(),m=Ze(),{value:_}=o.negotiator.current.fields.deliveryNext,h=o.negotiator.current.fields.availableDeliveryAddresses?.value,v=o.negotiator.current.fields.mustSelectProvidedAddress?.value,E=x({availableDeliveryAddresses:h,mustSelectProvidedAddress:v}),P=o.isShippingRequired.value&&!E,b=y(l),A=o.configuration.layout.isOnePage.value,S=l.hasFlagEnabled(F),f=A||S,R=e(()=>f&&V({checkout:o})),N=n(e=>e.reduce((t,a,r)=>r===e.length-1?s.translate("shipping.shipping_method_combinations.combination",{rest:t,current:a}):s.translate("shipping.shipping_method_combinations.with_separator",{rest:t,current:a}),""),[s]),C=a(()=>({businessDays:e=>s.translate("shipping.estimated_delivery_date",{count:e}),businessDaysRange:(e,t)=>
1s.translate("shipping.estimated_delivery_date_range",{minimum:e,maximum:t}),subscriptionsOnlyShippingTitle:s.translate("shipping.subscription_shipping"),combineTwoShippingTitles:(e,t)=>s.translate("shipping.shipping_method_combinations.combination",{rest:e,current:t}),combineMultipleShippingTitles:N}),[s,N]),O=n(({intent:e,trigger:t,result:a})=>{if(a.errors.some(e=>q.has(e.code)))return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, stock problems"),{reason:"OTHER_ERROR",intent:e,message:s.translate("wallets.errors.detour.stock_problems",{walletName:s.translate("brand.google_pay")})};if(a.errors.some(e=>e.code===W))return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, price mismatch"),{reason:"OTHER_ERROR",intent:e,message:s.translate("wallets.errors.detour.price_change",{walletName:s.translate("brand.google_pay")})};if(a.errors.some(e=>re.has(e.code)))return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, delivery zone not found",{zoneCode:a.negotiated.shippingAddress?.zoneCode,countryCode:a.negotiated.shippingAddress?.countryCode}),{reason:"SHIPPING_ADDRESS_INVALID",intent:e,message:s.translate("wallets.errors.invalid.zone")};if(a.errors.some(e=>Ce.includes(e.code)))return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, no delivery strategy",{zoneCode:a.negotiated.shippingAddress?.zoneCode,countryCode:a.negotiated.shippingAddress?.countryCode}),{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:e,message:s.translate("wallets.errors.unsupported.address")};if(!oe(a.negotiated.paymentMethods,"GOOGLE_PAY"))return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, google pay unavailable"),{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:e,message:s.translate("wallets.errors.unsupported.wallet_is_unavailable",{walletName:s.translate("brand.google_pay")})};const r=p.value;if(r?.initialCurrencyCode!==a.negotiated.subtotal?.currencyCode)return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, currency change",{beforeCurrencyCode:r?.initialCurrencyCode,afterCurrencyCode:a.negotiated.subtotal?.currencyCode}),{reason:"OTHER_ERROR",intent:e,message:s.translate("wallets.errors.detour.currency_change",{walletName:s.translate("brand.google_pay")})};const o="INITIALIZE"===t;return a.errors.some(e=>Ne.includes(e.code))&&!o?(i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, delivery line changed"),{reason:"SHIPPING_OPTION_INVA
1LID",intent:e,message:s.translate("wallets.errors.outdated.shipping_method")}):void 0},[p,s,i]),T=n(({result:e,intent:a,trigger:o,resolve:n,reject:l,shippingOptionId:d,destinationCountry:u,destinationRegion:c,abortSignal:p})=>{function m(){return l({reason:"OTHER_ERROR",message:s.translate("wallets.errors.generic",{walletName:s.translate("brand.google_pay")}),intent:a})}if(p.aborted)return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged result arrived after the session was aborted"),m();switch(i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged received negotiation result",{status:e.status,intent:a,trigger:o}),e.status){case"success":{if(null==e.negotiated.paymentDue)return i.error(new At("Missing negotiated paymentDue",{groupingHash:"GooglePayGenericError::MissingNegotiatedPaymentDue"})),m();const l=se(e.negotiated.deliveryNext),g=t.value,p=function({paymentDue:e,subtotal:t,duties:a,taxes:r,deliveryNext:o,discountLines:n,tipLines:s,paymentLines:i,checkoutTotal:l,deferredTotal:d,labels:u,i18nCurrency:c,translations:g,selectedShippingId:p,deliveryMacros:m,paymentFlexibilityPaymentTermsTemplate:y,googlePayTransactionId:_,merchandiseLines:h,shouldWalletDecelerateForSubscriptions:v=!1,discountsZeroValueUXEnabled:E=!1}){const P=m?.length?function(e){return e.map(({totalTitle:e,totalCostAfterDiscounts:t,deliveryPromisePresentmentTitle:a,deliveryMethodHandles:r})=>({id:gt(r),label:e,description:ht({costAfterDiscounts:t,deliveryPromisePresentmentTitle:a})}))}(m):function(e,t){const a=Y(e).filter(U).map(Qe);return Ke(a).filter(e=>e.length).map(e=>{return{id:(a=e,pt(Pe(a))),label:ct(e,t),description:e.map(ht).join(", ")};var a})}(o,g),b=mt({paymentDue:e,subtotal:t,duties:a,taxes:r,deliveryNext:o,discountLines:n,tipLines:s,paymentLines:i,labels:u,i18nCurrency:c,checkoutTotal:l,deferredTotal:d,hasPayableDeposit:Boolean(k({deferredTotal:d,checkoutTotal:l,paymentFlexibilityPaymentTermsTemplate:y})?.amount),googlePayTransactionId:_,merchandiseLines:h,shouldWalletDecelerateForSubscriptions:v,discountsZeroValueUXEnabled:E}),A=P.find(e=>e.id===p)?.id??P[0]?.id;return{...P.length>0?{newShippingOptionParameters:{shippingOptions:P,defaultSelectedOptionId:A}}:{},newTransactionInfo:b}}({...e.negotiated,labels:r,i18nCurrency:s.currency,translations:C,selectedShippingId:d,deliveryMacros:l,googlePayTransactionId:g,shouldWalletDecelerateForSubscriptions:R.value,discountsZeroValueUXEnabled:b});if(p.error=O({intent:a,trigger:o,result:e}),P&&!p.newShippingOptionParameters&&!p.error){const t=e.negotiated.deliveryNext&&"unavailable"!==e.negotiated.deliveryNext.status?e.negotiated.deliveryNext.lines:[],r={wallet:"google_pay",intent:a,trigger:o,googlePayTransactionId:g,destinationCountry:u,destinationRegion:c,deliveryNextStatus:e.negotiated.deliveryNext?.status,deliveryLineCount:t.length,deliveryLineStatuses:t.map(e=>e.status).join(",")};i.log("google_pay_missing_shipping_options","wallet_missing_shipping_options",r),i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged resolved with no shipping options and no error",r)}return i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged handleNegotiationResult",{result:e.status,intent:a,trigger:o,transactionInfo:p.newTransactionInfo?JSON.stringify(p.newTransactionInfo):"MISSING"}),n(p)}case"throttled":return g(),l({reason:"OTHER_ERROR",message:s.translate("wallets.errors.detour.queue",{walletName:s.translate("brand.google_pay")}),intent:a});case"tooManyRequests":case"denied":case"alreadyCompleted":return g(),m();case"invalid":return e.reasons.includes(ne.SubmittedForCompletion)?(i.log("payment_data_changed_negotiation_rejected","wallet_rejected_negotiation",{wallet:"google_pay",reason:"invalid",intent:a,trigger:o,reasons:e.reasons}),i.counter({name:"wallet_rejected_negotiation",value:1,attributes:{wallet:"google_pay",reason:"invalid"}}
1)):i.error(new Nt("Received unhandled invalid result",{groupingHash:"GooglePayInvalidError::UnhandledInvalidResult"}),{metadata:{request:{reasons:e.reasons}}}),m();case"stale":return i.log("payment_data_changed_negotiation_rejected","wallet_rejected_negotiation",{wallet:"google_pay",reason:"stale",intent:a,trigger:o}),i.counter({name:"wallet_rejected_negotiation",value:1,attributes:{wallet:"google_pay",reason:"stale"}}),m();case"fetch_failed":return i.log("payment_data_changed_negotiation_rejected","wallet_rejected_negotiation",{wallet:"google_pay",reason:"fetch_failed",intent:a,trigger:o,fetchFailureReason:e.reason,isActionable:e.isActionable,networkError:e.networkError??!1}),i.counter({name:"wallet_rejected_negotiation",value:1,attributes:{wallet:"google_pay",reason:"fetch_failed"}}),m();case"unexpected_error":return i.error(new Ct("Negotiation threw during the Google Pay session",{groupingHash:"GooglePayNegotiationError::NegotiationThrew",cause:e.error}),{metadata:{request:{intent:a,trigger:o,error:String(e.error)}}}),m();default:return i.error(new At(`Unhandled negotiation status: ${e.status}`,{groupingHash:"GooglePayGenericError::UnhandledNegotiationStatus"}),{metadata:{request:{intent:a,trigger:o,violations:e.violations.map(e=>e.code)}}}),m()}},[g,s,r,C,O,i,R,P,t,b]),D=n((e,t,a)=>t?new Promise((r,o)=>{ie(_)||I(d,void 0);const n="INITIALIZE"===a?e.initiallySelectedShippingOptionId:void 0,s=function({googleAddress:e,isFirstNameRequired:t}){return function(e){const{countryCode:t,postalCode:a}=e;if(null==a)return e;const r=a.trim().toUpperCase();return"CA"===t&&dt.test(r)?e.postalCode=`${r} 0Z0`:"GB"===t&&lt.test(r)&&(e.postalCode=`${r} 0ZZ`),e}(_t({googleAddress:e,isFirstNameRequired:t}))}({googleAddress:t,isFirstNameRequired:c.value.isRequired("firstName")});i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiating for handleShippingAddressSelected",{trigger:a,city:t.locality,administrativeArea:t.administrativeArea,countryCode:t.countryCode}),E||(u.value=s),m({abortSignal:e.abortController.signal,fieldsToResolve:["deliveryNext","taxes"],customizeNegotiation:e=>({...qe(e,s,{interfaceFlow:"GOOGLE_PAY",isConstrainedAddress:E,availableDeliveryAddresses:h,negotiatedDelivery:_}),payment:{...e.payment,totalAmount:{any:!0},paymentLines:it(e.payment?.paymentLines,kt)}}),observability:i,walletName:Xe.GooglePay,onComplete:s=>T({result:s,intent:"SHIPPING_ADDRESS",trigger:a,resolve:r,reject:o,destinationCountry:t.countryCode,destinationRegion:t.administrativeArea,...n&&{shippingOptionId:n},abortSignal:e.abortController.signal}),logPrefix:"GooglePay::usePaymentDataChanged::handleShippingAddressSelected"}).catch(n=>{T({result:n instanceof We?{status:"stale"}:{status:"unexpected_error",error:n},intent:"SHIPPING_ADDRESS",trigger:a,resolve:r,reject:o,destinationCountry:t.countryCode,destinationRegion:t.administrativeArea,abortSignal:e.abortController.signal})})}):Promise.resolve({}),[c,T,u,d,m,i,_,E,h]),M=n((e,t,a)=>new Promise((r,o)=>{let n;try{n=$e(function(e){const t=new RegExp("[%]","g");return e.replace(t,'"')}(t))}catch{return i.error(new At(`Invalid shippingOptionId format: ${t}`,{groupingHash:"GooglePayGenericError::InvalidShippingOptionId"}
1)),r({error:{reason:"SHIPPING_OPTION_INVALID",message:s.translate("general.choose_delivery_strategy"),intent:"SHIPPING_OPTION"}})}I(d,n);const l=u.value;i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiating for handleShippingMethodSelected",{trigger:a}),m({abortSignal:e,fieldsToResolve:["deliveryNext","taxes"],customizeNegotiation:e=>({...qe(e,l,{interfaceFlow:"GOOGLE_PAY",isConstrainedAddress:E,availableDeliveryAddresses:h,negotiatedDelivery:_}),payment:{...e.payment,totalAmount:{any:!0},paymentLines:it(e.payment?.paymentLines,kt)}}),observability:i,walletName:Xe.GooglePay,onComplete:n=>T({result:n,intent:"SHIPPING_OPTION",trigger:a,resolve:r,reject:o,shippingOptionId:t,abortSignal:e}),logPrefix:"GooglePay::usePaymentDataChanged::handleShippingMethodSelected"}).catch(n=>{T({result:n instanceof We?{status:"stale"}:{status:"unexpected_error",error:n},intent:"SHIPPING_OPTION",trigger:a,resolve:r,reject:o,shippingOptionId:t,abortSignal:e})})}),[T,s,u,d,m,i,E,h,_]);return n(async({sessionData:e,intermediatePaymentData:t})=>{function a(e,t,a){return{error:{reason:e,message:t,intent:a}}}const{shippingAddress:r,shippingOptionData:o,callbackTrigger:n}=t;switch(n){case"INITIALIZE":case"SHIPPING_ADDRESS":return D(e,r,n);case"SHIPPING_OPTION":return o?.id?M(e.abortController.signal,o.id,n):a("SHIPPING_OPTION_INVA
1LID",s.translate("general.choose_delivery_strategy"),"SHIPPING_OPTION");default:return i.error(new At(`Could not recognize the intent: ${n}`,{groupingHash:"GooglePayGenericError::CannotRecognizeIntent"})),i.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged could not recognize the intent",{callbackTrigger:n}),a("OTHER_ERROR",s.translate("wallets.errors.generic",{walletName:s.translate("brand.google_pay")}),"SHIPPING_ADDRESS")}},[D,M,i,s])}function Yt({asPaymentMethod:_=!1}){const h=s(null),M=o(null),G=s(!1),w=s(0),{isScrimOpen:L,closePopupWindowsAndScrim:H}=ue({endpoint:M,invokingWallet:"GOOGLE_PAY"}),Y=R(),U=Pt(),q=g("GOOGLE_PAY").value,{i18n:$,observability:Q,checkout:{wallets:K,proposal:X,negotiator:J},client:{userAgent:re},shop:oe}=B(),{value:ne}=J.current.fields.deliveryNext,se=s({abortController:Bt(),initiallySelectedShippingOptionId:void 0}),_e=o(void 0),{inMemoryGooglePayParts:{sdkStatus:he,buttonStatus:ve}}=z(),{markAsLoaded:Ee}=le(),Pe=s(!0),Ae=s(!1),Ie=function({asPaymentMethod:a}){const o=Pt(),n=function(){const{checkout:a}=B(),r=g("GOOGLE_PAY");return e(()=>{const e=r.value;if(void 0===e)return[];const o=a.configuration.addressSettings.nonBillingAddressSettings.value,n=t(()=>o.isRequired("phone")),{allowedAuthMethods:s,allowedCardNetworks:i,gateway:l,gatewayMerchantId:d}=e;return[{type:"CARD",parameters:{allowedAuthMethods:s,allowedCardNetworks:i,billingAddressRequired:!0,billingAddressParameters:{format:"FULL-ISO3166",phoneNumberRequired:n}},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:l??"",gatewayMerchantId:d??""}}}]})}(),{checkout:s,i18n:i,shop:l}=B(),d=s.negotiator,u=p(),c=Et(),{locationAddress:_}=s.negotiator.parts,h=m(),v=y(l),E=s.configuration.layout.isOnePage.value,P=l.hasFlagEnabled(F),b=E||P,A=e(()=>b&&V({checkout:s})),I=r(a);return e(()=>{const e=!I.value&&!x({availableDeliveryAddresses:s.negotiator.current.fields.availableDeliveryAddresses?.value,mustSelectProvidedAddress:s.negotiator.current.fields.mustSelectProvidedAddress?.value})&&s.isShippingRequired.value,a=e?["PAYMENT_AUTHORIZATION","SHIPPING_ADDRESS","SHIPPING_OPTION"]:["PAYMENT_AUTHORIZATION"],r=be(d,{includeShopPromotion:!1}),g=h.value&&_.fields.countryCode.value?[_.fields.countryCode.value]:l.shippingCountries?.map(e=>e.value),p=n.value,m=o.value;if(0===p.length||!m||!g||0===g.length&&e||null==r.paymentDue||null==r.subtotal)return null;const y=s.configuration.addressSettings.nonBillingAddressSettings.value,E=t(()=>y.isRequired("phone")),P=Boolean(k({deferredTotal:r.deferredTotal,checkoutTotal:r.checkoutTotal,paymentFlexibilityPaymentTermsTemplate:r.paymentFlexibilityPaymentTermsTemplate})?.amount);return{...ut,allowedPaymentMethods:p,merchantInfo:m,callbackIntents:a,emailRequired:u.value,shippingAddressParameters:{format:"FULL-ISO3166",allowedCountryCodes:g,phoneNumberRequired:E},shippingAddressRequired:e,shippingOptionRequired:e,transactionInfo:mt({labels:c,i18nCurrency:i.currency,...r,hasPayableDeposit:P,shouldWalletDecelerateForSubscriptions:A.value,discountsZeroValueUXEnabled:v})}})}({asPaymentMethod:_}),Se=s(null),{checkoutCardsinkCallerIdentificationSignature:fe}=X.negotiated.fields,Re=a(()=>{if(!oe.cardsinkUrl)return;const e=window.location.host;return{isLocalDev:e.endsWith("checkout.my.shop.dev")||e.endsWith("checkout.shop.dev"),cardsinkUrl:oe.cardsinkUrl,callerIdentificationJwt:fe.value}},[oe.cardsinkUrl,fe]),Ne=_?$.translate("wallets.call_to_action",{walletName:""}):void 0,Ce=$.translate("brand.google_pay"),Oe=function({endpoint:e,isTerminated:t,color:a,config:r,merchantInfo:o,buttonLabel:s,ariaLabel:i,markAsLoaded:l,sdkStatus:d,sdkStatusRef:u,buttonStatus:c,paymentDataRequest:g,containerRef:p,asPaymentMethod:m,isFirstRender:y,updateSdkStatus:_,connectedNullPaymentDataRequest:h,cardsinkConfig:v}){const{observability:E,source:P}=B();return n(async n=>{if(t.current)return void E.leaveErrorBreadcrumb("[GooglePay] useOnConnect skipped - sandbox already terminated");E.leaveErrorBreadcrumb("[GooglePay] useOnConnect starting configuration"),g.value||(h.current=!0),e.value=n;const b=await n.call.configure({isDark:"dark"===a,environment:r?.environment,merchantInfo:o,buttonLabel:s,ariaLabel:i,paymentDataRequest:g.value,style:{borderRadius:de(p.current)},cardsinkConfig:v,sourceId:P.sourceId});y.current=!1,l(),b.status===st.Success?(E.leaveErrorBreadcrumb("[GooglePay] useOnConnect configuration successful"),_({status:"available"},d,u),"error"!==c.value.status&&(c.value={status:"rendered"},E.counter({name:"checkout_wallet_button_rendered",value:1,attributes:{wallet_name:bt,status:"success",isPaymentMethodFlow:m}}))):(E.leaveErrorBreadcrumb("[GooglePay] useOnConnect configuration failed",{status:b.status}),b.status===st.Error&&function({result:{type:e,name:t,message:a},observability:r}){"createButton"===e&&r.error(new It(a,{cause:{name:t,message:a}}),{metadata:{additionalKey:{name:t,message:a}}})}({result:b,observability:E}),c.value={status:"error"},E.counter({name:"checkout_wallet_button_rendered",value:1,attributes:{wallet_name:bt,status:"error",isPaymentMethodFlow:m,reason:b.status===st.ScriptLoadError?"script_load_error":"sandbox_error"}}),_({status:"error"},d,u))},[e,t,a,r?.environment,o,s,i,l,d,u,c,g,p,E,m,y,_,h,v,P.sourceId])}({endpoint:M,isTerminated:G,color:Y,config:q,merchantInfo:U.value,buttonLabel:Ne,ariaLabel:Ce,markAsLoaded:Ee,sdkStatus:he,sdkStatusRef:h,buttonStatus:ve,paymentDataRequest:Ie,containerRef:Se,asPaymentMethod:_,isFirstRender:Pe,updateSdkStatus:Ut,connectedNullPaymentDataRequest:Ae,cardsinkConfig:Re}),Te=function({paymentDataRequest:e,asPaymentMethod:t,isScrimOpen:a,containerRef:r,endpoint:s}){const i=v(),{negotiate:l}=E(),d=P(),{observability:u,checkout:{wallets:c,proposal:g},client:{userAgent:p}}
1=B(),m=j(p)?.name,y="Safari"===m,_=Z(p),h=o(!1),I=o(!1),{inMemoryGooglePayParts:{paymentSheetError:S,paymentSheetOpenPromise:f,paymentSheetOpenPromiseResolve:R,sdkStatus:N},persistedGooglePaySignal:C}=z(),O=tt(Xe.GooglePay),T=b(Xe.GooglePay),D=A(Xe.GooglePay);return n(async()=>{i(r);try{if(t){if(h.value)return;h.value=!0,y&&(s.value?.call.updateValidationLock({status:"success"}),a.value=!0),await new Promise((e,t)=>{const a=d.value,r=g.negotiated.value;l({negotiationStage:"completion",silenceViolations:rt({journey:a,negotiated:r,fieldsToValidate:[...Ot(a,r)]}),runListenersOnError:!0,onComplete:a=>{"success"===a?.status?e():t()}})})}if(a.value=!0,c.activeSession.value)return u.leaveErrorBreadcrumb("[GooglePay] useHandleClick onClick early return - active session exists"),a.value=!1,void s.value?.call.updateValidationLock({status:"failure"});const r=N.value;if("available"!==r?.status)return u.leaveErrorBreadcrumb("[GooglePay] useHandleClick onClick early return - SDK not available",{sdkStatus:r?.status}),a.value=!1,void s.value?.call.updateValidationLock({status:"failure"});c.setActiveSession({newValue:"GOOGLE_PAY",asPaymentMethod:t});try{T();const r=e.value;if(null===r||null==r.callbackIntents||0===r.callbackIntents.length)return u.leaveErrorBreadcrumb("[GooglePay] useHandleClick onClick early return - invalid payment data request",{paymentDataRequest:null===r?"null":"invalid"}),c.clearActiveSession({invokingWallet:"GOOGLE_PAY"}),S.value={type:"config_missing_required_fields"},a.value=!1,void s.value?.call.updateValidationLock({status:"failure"});D(),O(Je.Success,t?et.PaymentMethod:et.Express),u.counter({name:"wallet_sheet_clicked",value:1,attributes:{instrument:Xe.GooglePay}}),I.value||(u.counter({name:"wallet_attempt_to_open_payment_sheet",value:1,attributes:{os:_,browser:m}}),I.value=!0),C.value={initialCurrencyCode:r.transactionInfo.currencyCode,receiptIdForPaymentFailure:C.value?.receiptIdForPaymentFailure},u.log("handle_click_button_clicked","Google Pay button clicked",{allowedAuthMethods:r.allowedPaymentMethods.map(e=>e.parameters.allowedAuthMethods)}),f.value=new Promise(e=>{R.value=e}),s.value?.call.updateValidationLock({status:"success"})}catch(o){throw c.clearActiveSession({invokingWallet:"GOOGLE_PAY"}),a.value=!1,o}}catch(o){u.leaveErrorBreadcrumb("[GooglePay] useHandleClick onClick error handling",{error:o}),y&&t?(s.value?.call.closePopupWindows(),a.value=!1):t&&y||(a.value=!1),s.value?.call.updateValidationLock({status:"failure"})}finally{h.value&&(h.value=!1)}},[t,m,r,i,D,T,s,I,y,a,h,d,l,_,e,S,f,R,C,g,N,u,O,c])}({paymentDataRequest:Ie,asPaymentMethod:_,isScrimOpen:L,containerRef:Se,endpoint:M}),De=function(e){const t=tt(Xe.GooglePay),a=o(!1),{persistedGooglePaySignal:r,inMemoryGooglePayParts:{sdkStatus:s,buttonStatus:i,paymentSheetError:l,paymentSheetOpenPromiseResolve:d,paymentSheetOpenPromise:u}}=z(),{observability:c,checkout:{wallets:g},client:{userAgent:p}}=B(),m=j(p)?.name,y=Z(p);return n(o=>{c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler onResponse",{response:o}),e.value=!1;const{response:n,error:p}=o;if(n)d.value?.(void 0);else if(p){switch("CANCELED"===p.name?c.counter({name:"wallet_sheet_cancelled",value:1,attributes:{instrument:Xe.GooglePay}}):c.counter({name:"wallet_sheet_failed",value:1,attributes:{instrument:Xe.GooglePay}}),p.name){case"CANCELED":c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: CANCELED"),t(Je.Cancelled);break;case"DEVELOPER_ERROR":c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: DEVELOPER_ERROR",{errorMessage:p.message}),t(Je.Failure),l.value={type:"invalid_config"},c.error(new St(`loadPaymentData failed: ${p.message}`,{groupingHash:"GooglePayDeveloperError::LoadPaymentDataFailed"}));break;case"BUYER_ACCOUNT_ERROR":case"MERCHANT_ACCOUNT_ERROR":c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: ACCOUNT_ERROR",{errorType:p.name,errorMessage:p.message}),t(Je.Failure),i.value={status:"error"},s.value={status:"error"},c.log("google_pay_response_handler_session_unavailable","Google Pay is unavailable for this session",{reason:p.name});break;case"INTERNAL_ERROR":c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: INTERNAL_ERROR",{errorMessage:p.message}),t(Je.Failure),l.value={type:"unexpected_terminal_error"},c.log("google_pay_response_handler_internal_error","Google Pay internal server error occurred",{errorMessage:p.message});break;case"VALIDATION_TIMEOUT":c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: VALIDATION_TIMEOUT"),t(Je.Failure);break;case"FAILED_TO_OPEN_WINDOW":a.value||(c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: FAILED_TO_OPEN_WINDOW"),t(Je.Failure),c.counter({name:"wallet_failed_to_open_window",value:1,attributes:{os:y,browser:m}}),a.value=!0);break;default:c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: UNEXPECTED_STATUS",{errorName:p.name,errorMessage:p.message}),c.error(new ft(`loadPaymentData failed with unexpected status code: [${p.name}] ${p.message}`,{groupingHash:`GooglePayUnexpectedStatusCodeError::UnexpectedStatus::${p.name}`}))}d.value?.(void 0)}c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler cleanup complete"),"GOOGLE_PAY"===g.activeSession.value?.wallet?g.clearActiveSession({invokingWallet:"GOOG
1LE_PAY"}):c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler cleanup complete, but activeSession is not Google Pay",{activeSession:g.activeSession.value}),u.value=void 0,r.value={initialCurrencyCode:void 0}},[m,y,u,r,d,c,t,l,i,s,a,e,g])}(L),Me=Ht({googlePayTransactionId:_e}),Ge=function({asPaymentMethod:t}){const{progress:r}=E(),{shop:o,checkout:s,observability:i}=B(),{deliveryLines:l,email:d,shippingAddress:u,billingAddress:c,paymentLines:p}=s.negotiator.parts,m=s.configuration.addressSettings.nonBillingAddressSettings,y=ee(),_=s.negotiator.current.fields.availableDeliveryAddresses?.value,h=s.negotiator.current.fields.mustSelectProvidedAddress?.value,v=x({availableDeliveryAddresses:_,mustSelectProvidedAddress:h}),P=s.negotiator,b=s.configuration.layout.isOnePage.value,A=s.configuration.layout.baseName,R=o.hasFlagEnabled(F),N=!b&&R,C=e(()=>s.configuration.layout.isOnePage.value||R),O=e(()=>C.value&&V({checkout:s})),T=g("GOOGLE_PAY"),D=function({supportsOnePage:e=!1}={}){const{i18n:t,observability:r}=B(),{inMemoryGooglePayParts:o}=z(),n=Fe(),s=a(()=>({genericError:t.translate("wallets.errors.generic",{walletName:t.translate("brand.google_pay")}),shippingMethodError:t.translate("wallets.errors.outdated.shipping_method"),currencyChangeError:t.translate("wallets.errors.detour.currency_change",{walletName:t.translate("brand.google_pay")}),addressUnserviceableError:t.translate("wallets.errors.unsupported.address"),addressInvalid:t.translate("wallets.errors.invalid.shipping_address"),phoneInvalidError:t.translate("wallets.errors.invalid.phone"),zipInvalidError:t.translate("wallets.errors.invalid.postal_code"),zoneInvalidError:t.translate("wallets.errors.invalid.zone"),firstNameMissingError:t.translate("wallets.errors.missing.first_name"),lastNameMissingError:t.translate("wallets.errors.missing.last_name"),addressLine1MissingError:t.translate("wallets.errors.missing.address1"),addressLine2MissingError:t.translate("wallets.errors.missing.address2"),zipMissingError:t.translate("wallets.errors.missing.zip"),zoneMissingError:t.translate("wallets.errors.missing.province"),cityMissingError:t.translate("wallets.errors.missing.city"),emailInvalidError:t.translate("wallets.errors.invalid.email"),phoneMissingError:t.translate("wallets.errors.missing.phone"),billingAddressInvalid:t.translate("wallets.errors.invalid.billing_address"),billingAddressPhoneInvalidError:t.translate("wallets.errors.invalid.billing_phone"),billingAddressZipInvalidError:t.translate("wallets.errors.invalid.billing_zip"),billingAddressZoneInvalidError:t.translate("wallets.errors.invalid.billing_zone"),billingZipInvalidError:t.translate("wallets.errors.invalid.billing_zip"),billingAddressLine1MissingError:t.translate("wallets.errors.missing.billing_address1"),billingAddressFirstNameMissingError:t.translate("wallets.errors.missing.billing_first_name"),billingAddressCityMissingError:t.translate("wallets.errors.missing.billing_city"),billingAddressZipMissingError:t.translate("wallets.errors.missing.billing_zip"),billingAddressZoneMissingError:t.translate("wallets.errors.missing.billing_province")}),[t]);return a(()=>e?new Dt(r,s,o,n):new Mt(r,s,o,n),[r,e,s,o,n])}({supportsOnePage:C.value||O.value}),M=Lt(),G=Ve(),w=S(),L=f(),k=function(){const{walletUsedForSubmissionSignal:e,inMemoryGooglePayParts:{paymentSheetError:t}}=z(),a=Lt();return n(()=>{t.value=void 0,e.value=void 0,a()},[t,e,a])}(),H=ot({flag:F,onAbort:k,onError:k}),{inMemoryGooglePayParts:{paymentSheetOpenPromise:Y,paymentSheetError:U},persistedGooglePaySignal:j,walletUsedForSubmissionSignal:Z}=z(),{trackAttempt:q,trackComplete:$}=nt(Xe.GooglePay),Q=n(async({reason:e})=>{N?await H({wallet:"GOOGLE_PAY",reason:e,asPaymentMethod:!1,announceSubscriptionReviewLayoutSwitch:"subscriptions"===e}):(s.wallets.setEscalatedWallet("GOOGLE_PAY"),L?.dispatch("addressReplaced"))},[H,N,L,s.wallets]);return n(({isShippingRequired:e,paymentData:a,cardsinkResult:n})=>new Promise(g=>{const _=performance.now();i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, attempting completion",{shippingAddressCity:a.shippingAddress?.locality??"MISSING",shippingAddressAdministrativeArea:a.shippingAddress?.administrativeArea??"MISSING",shippingAddressCountryCode:a.shippingAddress?.countryCode??"MISSING",billingAddressCity:a.paymentMethodData.info?.billingAddress?.locality??"MISSING",billingAddressAdministrativeArea:a.paymentMethodData.info?.billingAddress?.administrativeArea??"MISSING",billingAddressCountryCode:a.paymentMethodData.info?.billingAddress?.countryCode??"MISSING"}),q();const h=()=>{$({result:"failed",durationMs:performance.now()-_})},E=a.shippingAddress,b=a.paymentMethodData.info?.billingAddress,S=a.paymentMethodData,f=m.value.isRequired("address2"),R=D.validatePaymentCurrency({initialCurrencyCode:j.value?.initialCurrencyCode,currentCurrencyCode:P.current.fields.subtotal?.value?.currencyCode}
1),L=D.validateBilling(a),k=D.validateShipping(a,e,f);if(i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized: validation results",{paymentValidationResult:R,billingValidationResult:L,shippingValidationResult:k}),R.paymentSheetAction)return h(),ee(R.paymentSheetAction);if(L.paymentSheetAction)return h(),ee(L.paymentSheetAction);if(k.paymentSheetAction)return h(),ee(k.paymentSheetAction);const H={};if(L.shouldPersist&&b&&(c.value=_t({googleAddress:b,isFirstNameRequired:m.value.isRequired("firstName")}),H.billing=b.address1),k.shouldPersist&&E){const e=E.iso3166AdministrativeArea;w({postalCode:E.postalCode,countryCode:E.countryCode,city:E.locality,zoneCode:e},"GOOGLE_PAY"),v||(u.value=_t({googleAddress:E,isFirstNameRequired:m.value.isRequired("firstName")}),H.shipping=E.address1)}const B=s.negotiator.current.fields.buyerIdentity.value?.customerProfile?.email||a.email;B&&(d.value=B),G(),j.value={...j.value,description:S.description,receiptIdForPaymentFailure:void 0};const F=p.value,{signature:V,signedMessage:x,protocolVersion:z}=a.paymentMethodData.tokenizationData.token?JSON.parse(a.paymentMethodData.tokenizationData.token):{signature:"",signedMessage:"",protocolVersion:""};let K=0;const X=xe(P.current.fields.deliveryNext?.value),J=async()=>{let e=!1;i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, payment authorized completion attempt",{attemptNumber:K}),await r("google-pay-payment-authorized",async a=>{i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, payment authorized completion result",{result:{status:a.status,violations:("violations"in a?a.violations:[])||[],errors:("errors"in a?a.errors:[])||[]}}),"success"===a.status&&(Z.value="GOOGLE_PAY"),"denied"!==a.status&&"throttled"!==a.status&&"tooManyRequests"!==a.status||M();const r=a,o="rejected"===r.status&&r.violations.some(e=>e.code===W),{shouldRetry:n,retryReason:s,updatedDeliveryMethodHandles:d}=function(e,t,a,r){const o={shouldRetry:!1,retryReason:"",updatedDeliveryMethodHandles:void 0};if(t>=1)return o;if("stale"===e.status)return{shouldRetry:!0,retryReason:"stale",updatedDeliveryMethodHandles:void 0};if("fetch_failed"===e.status)return{shouldRetry:!0,retryReason:"fetch_failed",updatedDeliveryMethodHandles:void 0};if("rejected"===e.status&&e.violations?.length){const t=je(e,a.current.fields.deliveryNext?.peek(),r);if(t)return{shouldRetry:!0,retryReason:"delivery_option_mismatch",updatedDeliveryMethodHandles:t}}return o}(r,K,P,X);if(d&&I(l,d),n&&!o)return K++,i.counter({name:"wallet_submit_for_completion_retry",value:1,attributes:{retry_reason:s,retry_count:K,status:r.status,instrument:Xe.GooglePay}}),i.log("payment_authorized_completion_retried",`GooglePay::usePaymentAuthorized: Retrying ${s} completion`,{attemptNumber:K}),void J();const u=D.completionResultMapper.mapResultToPaymentSheetAction(r,{options:{asPaymentMethod:t,layout:A}});i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, payment sheet action mapper result",{paymentSheetAction:u});const c="show_error"===u.action||"abort"===u.action?"failed":"success";try{await ee(u)}finally{$({result:c,durationMs:performance.now()-_,attributes:{retry_count:K>0?K.toString():void 0}}),i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, authorization result",{authorizationResult:c}),!C.value||"rejected"!==a.status&&"invalid"!==a.status||(U.value||(U.value={type:"recovery_notice"}),N?e=!0:Q({reason:"submitForCompletion"}))}},{skipToCompletion:!0,customizeCompletion:ze,walletStreetLines:o.hasFlagEnabled(ae)?H:void 0}),e&&Q({reason:"submitForCompletion"})};async function ee(e){if(e.effects?.forEach(e=>e()),"show_error"===e.action)return i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, resolving with error",{paymentSheetAction:e}),void g({transactionState:"ERROR",error:e.errors?.[0]});i.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, resolving with success"),g({transactionState:"SUCCESS"}),await Y.value}(()=>{const e=P.current.fields.paymentDue.value,t=e&&e.amount>0||y.value;return n?(e=>{if(e){if(n&&"error"in n)return i.leaveErrorBreadcrumb("[GooglePay] Cardsink deposit failed in sandbox",{error:n.error}),i.counter({name:"wallet_authorization_cardsink",value:1,attributes:{status:"failed",instrument:Xe.GooglePay}}),ee({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",message:"Failed to process payment",intent:"PAYMENT_AUTHORIZATION"}]}),!1;
1n&&"sessionId"in n&&(i.leaveErrorBreadcrumb("[GooglePay] Using sessionId from sandbox cardsink",{sessionId:n.sessionId}),i.counter({name:"wallet_authorization_cardsink",value:1,attributes:{status:"success",instrument:Xe.GooglePay}}),p.value=te(F,{method:{type:"wallet",name:"GOOGLE_PAY",walletContent:{protocolVersion:"",signature:"",signedMessage:"",sessionId:n.sessionId,paymentMethodIdentifier:T.value?.paymentMethodIdentifier}}}))}return!0})(t):(t&&(p.value=te(F,{method:{type:"wallet",name:"GOOGLE_PAY",walletContent:{signature:V,signedMessage:x,protocolVersion:z,paymentMethodIdentifier:T.value?.paymentMethodIdentifier}}})),!0)})()&&(O.value?(vt(i,{reason:"subscriptions",asPaymentMethod:t,layout:A}),ee({action:"decelerate",effects:[()=>{U.value=void 0}]}).finally(()=>Q({reason:"subscriptions"})).catch(e=>{i.leaveErrorBreadcrumb("[Google Pay] Failed to handle payment sheet action:",{err:e})})):J())}),[m,t,M,T,s.negotiator.current.fields,y,P,Y,D,j,r,c,l,d,p,u,Z,o,w,i,U,G,v,C,O,Q,N,q,$,A])}({asPaymentMethod:_}),we=pe(),Le=ce();function ke(e){Q.log("google_pay_callback_timing","[GooglePay] callback progress",e,{requiresKeepalive:!0});const{scope:t,callback:a,outcome:r,durationMs:o}=e;if("progress"===r)return;const n={scope:t,callback:a,outcome:r};Q.counter({name:"google_pay_callback_events",value:1,attributes:n}),"resolved"!==r&&"rejected"!==r||Q.histogram({name:"google_pay_callback_duration",value:o,unit:"ms",attributes:n})}function He(e,t){let a=!1;return function({log:e,stage:t,...a}){try{let r=function(t){try{"resolved"!==t&&"rejected"!==t||clearTimeout(i),e({...a,callbackId:o,stage:s,outcome:t,durationMs:performance.now()-n,visibilityState:document.visibilityState})}catch{}};const o=ye(),n=performance.now();let s=t;const i=setTimeout(()=>r("pending"),25e3);return r("started"),{stage(e){s!==e&&(s=e,r("progress"))},observe(e){try{return e().then(e=>(r("resolved"),e),e=>{throw r("rejected"),e})}catch(t){throw r("rejected"),t}}}}catch{return{stage(){},observe:e=>e()}}}({scope:"host",callback:e,stage:"checkout",trigger:t,googlePayTransactionId:_e.peek(),log:e=>{"started"===e.outcome?(a=!0,w.current++):!a||"resolved"!==e.outcome&&"rejected"!==e.outcome||(a=!1,w.current--),ke(e)}})}function Ye(e){try{Q.log("google_pay_sandbox_lifecycle","[GooglePay] sandbox lifecycle",{stage:e,googlePayTransactionId:_e.peek(),pendingHostCallbacksInComponent:w.current},{requiresKeepalive:!0})}catch{}}const Ue=ge({onPaymentAuthorized:e=>He("authorization").observe(()=>Ge(e)),onPaymentDataChanged:e=>He("shipping",e.callbackTrigger).observe(()=>Me({sessionData:se.current,intermediatePaymentData:e})),onClick:async({transactionId:e}={})=>(e&&(_e.value=e),ie(ne)&&(se.current.initiallySelectedShippingOptionId=gt(D({proposedDeliveryLines:X.proposed.deliveryLines}))),await Te()),onResponse:e=>{Ye("wallet_response_received");const t=se.current.abortController;se.current={abortController:Bt(),initiallySelectedShippingOptionId:void 0};const a=De(e);return t.abort(),a},telemetry:we,breadcrumb:e=>{var t;if("[GooglePay Sandbox] callback progress"!==e.message&&"[GooglePay Sandbox] loadPaymentData started"!==e.message&&"[GooglePay Sandbox] loadPaymentData resolved"!==e.message)Le(e);else try{"[GooglePay Sandbox] callback progress"===e.message?(t=e.attributes,"host"!==t?.scope&&"sandbox"!==t?.scope||"shipping"!==t.callback&&"authorization"!==t.callback||"checkout"!==t.stage&&"cardsink"!==t.stage&&"host_rpc"!==t.stage||"started"!==t.outcome&&"progress"!==t.outcome&&"pending"!==t.outcome&&"resolved"!==t.outcome&&"rejected"!==t.outcome||"string"!=typeof t.callbackId||"number"!=typeof t.durationMs||!Number.isFinite(t.durationMs)||"visible"!==t.visibilityState&&"hidden"!==t.visibilityState||void 0!==t.googlePayTransactionId&&"string"!=typeof t.googlePayTransactionId||void 0!==t.trigger&&"string"!=typeof t.trigger||ke(e.attributes)):Q.log("google_pay_sheet_progress",e.message,e.attributes,{requiresKeepalive:!0})}catch{}}});i(()=>{const e=!Pe.current||Ae.current;M.value&&Ie.value&&e&&(Ae.current=!1,M.value.call.updatePaymentDataRequest(Ie.value))}),l(()=>(Ut({status:"loading"},he,h),()=>{const e=he.value,t=ve.value;e===h.current&&"error"!==t.status&&(he.value={status:"idle"},ve.value={status:"not_rendered"},"GOOGLE_PAY"===K.activeSession.value?.wallet&&K.clearActiveSession({invokingWallet:"GOOG
1LE_PAY"}))}),[]);const Be=_?"54px":void 0,Ze=d(O,{inlineAlignment:"center",children:d(T,{size:"large"})}),qe=!function(e=window.navigator.userAgent){return/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/[\d.]+(?: Mobile)? Safari\/537\.36$/.test(e)||/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/[\d.]+ Safari\/537\.36 Edg\/[\d.]+$/.test(e)||/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/[\d.]+(?: Mobile)? Safari\/537\.36 Vivaldi\/[\d.]+$/.test(e)}(re),We=r(!qe),$e=d(C,{isOpen:L,isInvisible:We,onClick:H,children:qe&&d(N,{handleClose:H,walletName:$.translate("brand.google_pay")})}),Qe=d(c,{children:[d(me,{wallet:bt,onConnect:Oe,onTerminate:()=>{Ye("endpoint_terminated"),G.current=!0,M.value=null},hostMethods:Ue,ref:Se,height:Be}),$e]}),Ke=_&&"rendered"!==ve.value.status&&"error"!==ve.value.status;return _?d(c,{children:[Ke&&Ze,d(O,{className:u(Ke&&"QIbE6"),children:Qe})]}):Qe}function Ut(e,t,a){a.current=e,t.value=a.current}function Bt(){return new AbortController}export{Yt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.