PageSourceSearch

https://www.jidsv.com/cdn/shopifycloud/checkout-web/assets/c1/f7742f92.DgGLYo4K.js

js jidsv.com collected 2026-10-02 10:53:41 UTC 55,688 bytes, 1 lines download raw bytes

1import{t as e,f as t,T as a,z as r,q as o,s as n,l as s,C as i,m as l,u as d,v as u,S as c}from"./2c1ab0fe.GMbxnz74.js";import{fU as g,fT as p,co as m,gl as y,fv as _,i as h,e as v,f5 as E,fF as P,gm as b,fw as A,gn as I,go as S,az as R,fu as f,gp as N,fZ as O,fY as T,B as C,S as D,gq as M}from"./164ad2e3.BbIvMjRY.js";import{dv as G,gM as w,gN as L,cn as k,ey as H,gO as Y,aK as U,aF as B,S as F,aa as V,T as x,W as z,gP as Z,b3 as j,gQ as q,a9 as W,as as Q,at as $,dl as K,gR as X,du as J,dt as ee,C as te,gS as ae,b7 as re,ab as oe,w as ne,gT as se,gU as ie,bp as le,gV as de,b4 as ue}from"./4c290a1e.C6TDJ9Fn.js";import{d as ce}from"./ca5e9c49.BT49yYQL.js";import{S as ge,u as pe,a as me}from"./3a819064.Dx-RF2LD.js";import{u as ye,W as _e}from"./8536083a.BLo7Yz4V.js";import{v as he}from"./2210eadb.DF0gIp_2.js";import{i as ve,b as Ee}from"./0a7dffce.DfUtZWCu.js";import{f as Pe,g as be,s as Ae,r as Ie,B as Se,P as Re,T as fe,U as Ne,V as Oe,D as Te,N as Ce,a as De,b as Me,c as Ge,d as we,e as Le,h as ke,E as He,I as Ye,i as Ue,j as Be,k as Fe,l as Ve,u as xe,m as ze,n as Ze,o as je,p as qe,q as We,t as Qe,S as $e,v as Ke}from"./13b13169.Db0IGzkq.js";import{a as Xe,g as Je}from"./21cc90a2.DAzJmttM.js";import{d as et,b as tt,e as at,c as rt}from"./ed9f2238.D-8_6d2f.js";import{S as ot}from"./app.CepNJbvh.js";import{g as nt,a as st,u as it}from"./33464469.6IaCgV4U.js";import{r as lt}from"./bff2ff9b.Wb1R3ZbF.js";import"./9f047e05.CCJUgz_L.js";import"./5fda1420.KYpufQ--.js";import"./60a453ce.CkhHeRBc.js";import"./bb728e1c.iawBHR84.js";import"./ac5a19ff.CRrh5Bdw.js";import"./53bbdad9.CGJC_1cv.js";import"./7fc410e0.B54X0yKF.js";const dt=/^[A-Z]{1,2}[0-9]{1,2}[A-Z]?$/,ut=/^[A-Z][0-9][A-Z]$/,ct={apiVersion:2,apiVersionMinor:0};function gt(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 pt(e){return mt(JSON.stringify(e))}function mt(e){return e.replace(/["']/g,"%")}function yt({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?Pe(e.amount):"0",v=g&&u&&c,E=v?Pe(u.amount):void 0,P=v?Pe(c.amount.amount):void 0,b=Boolean(m?.lines?.length),A=[];m?.lines&&m.lines.forEach(e=>{A.push({label:be(e),type:"LINE_ITEM",price:Pe(e.totalPrice.amount)}),function(e,t){const a=new Map;return e.lineAllocations.forEach(e=>{e.allocations.filter(_t).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?Pe(t):L(Pe(t))}))}(e,_).forEach(e=>{A.push(e)})}),t&&A.push({label:l.subtotal,type:"SUBTOTAL",price:Pe(t.amount)}),function(e,t){return e?e.flatMap(e=>{if(!ve(e))return[];if(!w(e))return[];const a=e.amount?.amount;if(void 0===a)return[];if(t&&0===a)return[];const r=Pe(a);return[{label:e.title,type:"LINE_ITEM",price:0===a?r:L(r)}]}):[]}(n?.lines,_).forEach(e=>{A.push(e)});const I=G(o).reduce((e,t)=>e+t.method.cost.amount,0);return A.push({label:l.shipping,type:"LINE_ITEM",price:Pe(I)}),a&&"available_total"===a?.status&&0!==a?.totalDuty.amount&&A.push({label:l.duties,type:"LINE_ITEM",price:Pe(a.totalDuty.amount)}),r&&"available_total"===r.status&&0!==r.totalTax.amount&&A.push({label:l.taxes,type:"LINE_ITEM",price:Pe(r.totalTax.amount)}),n?.lines.forEach(e=>{if(ve(e)){if(b&&"LINE"===e.discount.presentationLevel&&"delivery"!==e.sourceTerm)return;if(w(e))return;const t=e.amount?.amount;t&&A.push({label:e.title,type:"LINE_ITEM",price:L(Pe(t))})}}),i?.lines.filter(e=>"giftCard"===e.method.type).forEach(e=>{e.cost&&A.push({label:`${l.giftCard} ${k(e.method).toUpperCase()}`,type:"LINE_ITEM",price:L(Pe(e.cost.amount))})}
1),s?.forEach(e=>{A.push({label:l.tip,type:"LINE_ITEM",price:Pe(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 _t(e){return Ee(e.discountDetails.discount)&&"LINE"===e.discountDetails.discount.presentationLevel}function ht({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&&Y.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 vt({costAfterDiscounts:e,deliveryPromisePresentmentTitle:t}){const{short:a}=t||{};return`${a?`(${a}) `:""}${Pe(e.amount)} ${e.currencyCode}`}function Et(){const{i18n:e}=F();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}}=F(),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 ot{constructor(){super(...arguments),this.name="GooglePayGenericError"}}class It extends ot{constructor(){super(...arguments),this.name="GooglePayCreateButtonError"}}class St extends ot{constructor(){super(...arguments),this.name="GooglePayDeveloperError"}}class Rt extends ot{constructor(){super(...arguments),this.name="GooglePayUnexpectedStatusCodeError"}}class ft extends ot{constructor(){super(...arguments),this.name="GooglePaySubmissionError"}}class Nt extends ot{constructor(){super(...arguments),this.name="GooglePayInvalidError"}}class Ot extends ot{constructor(){super(...arguments),this.name="GooglePayNegotiationError"}}class Tt extends Se{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:tt.GooglePay}}),{paymentSheetAction:{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_AUTHORIZATION",message:this.translated.currencyChangeError}]}})}get completionResultMapper(){return new Re({success:({result:e})=>"receipt"in e?{action:"submit"}:{action:"abort"},rejected:({result:e,violationActions:t,options:a})=>{const r=e.violations??[];this.getUnhandledErrors(r,t).forEach(e=>{this.observability.error(new ft(`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:tt.GooglePay}}),this.reportAddressRequirementMismatch({violationCode:n,wallet:tt.GooglePay,asPaymentMethod:Boolean(a?.asPaymentMethod),outcome:this.isRedesign()?"decelerate":o?.action??"abort"}),o||{action:"abort"}},invalid:({result:e})=>{const t={reasons:JSON.stringify(e.reasons),action:"invalid"};return this.observability.counter({name:"WalletsPlatform_google_pay_payment_sheet_unexpected_action",value:1,attributes:t}),{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))}mapUnhandledStatus(e){return this.observability.error(new ft(`Unhandled completion status: ${e.status}
1`,{groupingHash:`GooglePaySubmissionError::UnhandledCompletionStatus::${e.status}`})),{action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"PAYMENT_AUTHORIZATION",message:this.translated.genericError}]}}}class Ct 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:[...K,"MERCHANDISE_NOT_APPLICABLE",X,...fe,...Ne,...Oe,"LOCALIZATION_EXTENSION_FIELD_ERROR",...Te,...Ce,"DELIVERY_WRONG_NUMBER_OF_DELIVERY_LINES",...De,...Me,...Ge,...J,"PAYMENTS_METHOD_REQUIRED","PAYMENTS_METHOD",...we,...Le,...ee,"PAYMENTS_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN","BUYER_IDENTITY_MISSING_CONTACT_METHOD",...ke,"BUYER_IDENTITY_EMAIL_REQUIRED",...He,...Ye,...te],generateAction:()=>({action:"abort"})},{violations:[...Ue,"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}=Be(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 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}:{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:[...K,"MERCHANDISE_NOT_APPLICABLE",X,...fe,...Ne,...Oe,"LOCALIZATION_EXTENSION_FIELD_ERROR","DELIVERY_WRONG_NUMBER_OF_DELIVERY_LINES","DELIVERY_STRATEGY_CONDITIONS_NOT_SATISFIED",...Ye,...te],generateAction:()=>({action:"abort"})},{violations:[...Ue,"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:Te,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:()=>Mt(this.translated.firstNameMissingError)},{violations:["DELIVERY_LAST_NAME_REQUIRED"],generateAction:()=>Mt(this.translated.lastNameMissingError)},{violations:["DELIVERY_ADDRESS1_REQUIRED"],generateAction:()=>Mt(this.translated.addressLine1MissingError)},{violations:["DELIVERY_ADDRESS2_REQUIRED"],generateAction:()=>Mt(this.translated.addressLine2MissingError)},{violations:["DELIVERY_PHONE_NUMBER_REQUIRED","DELIVERY_OPTIONS_PHONE_NUMBER_REQUIRED"],generateAction:()=>Mt(this.translated.phoneMissingError)},{violations:["DELIVERY_POSTAL_CODE_REQUIRED"],generateAction:()=>Mt(this.translated.zipMissingError)},{violations:["DELIVERY_CITY_REQUIRED"],generateAction:()=>Mt(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}=Be(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}=Be(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:[...He,"BUYER_IDENTITY_EMAIL_REQUIRED"],generateAction:()=>Mt(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:()=>Mt(this.translated.addressInvalid)},{violations:[...ke,"DELIVERY_OPTIONS_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN","DELIVERY_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"],generateAction:()=>Mt(this.translated.phoneInvalidError)},{violations:["DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE","DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY"],generateAction:()=>
1Mt(this.translated.zipInvalidError)},{violations:["PAYMENTS_METHOD_REQUIRED","PAYMENTS_METHOD"],generateAction:()=>Gt(this.translated.genericError)},{violations:["PAYMENTS_FIRST_NAME_REQUIRED"],generateAction:()=>Gt(this.translated.billingAddressFirstNameMissingError)},{violations:["PAYMENTS_LAST_NAME_REQUIRED"],generateAction:()=>Gt(this.translated.lastNameMissingError)},{violations:["PAYMENTS_ADDRESS1_REQUIRED"],generateAction:()=>Gt(this.translated.billingAddressLine1MissingError)},{violations:["PAYMENTS_CITY_REQUIRED"],generateAction:()=>Gt(this.translated.billingAddressCityMissingError)},{violations:["PAYMENTS_ZONE_REQUIRED_FOR_COUNTRY"],generateAction:()=>Gt(this.translated.billingAddressZoneMissingError)},{violations:["PAYMENTS_POSTAL_CODE_REQUIRED"],generateAction:()=>Gt(this.translated.billingAddressZipMissingError)},{violations:["PAYMENTS_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"],generateAction:()=>Gt(this.translated.billingAddressPhoneInvalidError)},{violations:[Fe],generateAction:()=>Gt(this.translated.billingAddressZipInvalidError)},{violations:[Ve],generateAction:()=>Gt(this.translated.billingAddressZoneInvalidError)},{violations:["PAYMENTS_INVALID_POSTAL_CODE_FOR_ZONE"],generateAction:()=>Gt(this.translated.billingZipInvalidError)},{violations:["PAYMENTS_ADDRESS1_CONTAINS_HTML_TAGS","PAYMENTS_CITY_CONTAINS_HTML_TAGS","PAYMENTS_LAST_NAME_CONTAINS_URL"],generateAction:()=>Gt(this.translated.billingAddressInvalid)}]}}function Mt(e){return{action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:e}]}}function Gt(e){return{action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:e}]}}function wt(){const{persistedGooglePaySignal:e}=W(),{observability:t,checkout:a}=F(),r=x(),o=q({availableDeliveryAddresses:r.availableDeliveryAddresses?.value,mustSelectProvidedAddress:r.mustSelectProvidedAddress?.value}),s=a.configuration.addressSettings.nonBillingAddressSettings.value,{deliveryLines:i,email:l,shippingAddress:d,paymentLines:u}=z();return n(()=>{t.leaveErrorBreadcrumb("[GooglePay] useClearGooglePayProposedState clearing proposed state");const a=ae(u.value);u.value=a,l.value="",e.value={...e.value,description:void 0},o||(I(i,void 0),d.value=re({countryCode:s.defaultShippingDetails.country.code,zoneCode:s.defaultShippingDetails.zone.code}))},[s.defaultShippingDetails,o,e,i,l,u,d,t])}const Lt={paymentMethod:{walletPaymentMethod:{name:"GOOGLE_PAY",walletContent:{googlePayWalletContent:{signature:"",signedMessage:"",protocolVersion:""}}}},amount:{any:!0}};function kt({googlePayTransactionId:t}){const{deliveryLines:r,shippingAddress:o}=z(),s=Et(),{checkout:i,i18n:l,observability:d,shop:u}=F(),c=i.configuration.addressSettings.nonBillingAddressSettings,g=wt(),{persistedGooglePaySignal:p}
1=W(),m=We(),_=x(),{value:h}=_.deliveryNext,v=_.availableDeliveryAddresses?.value,E=_.mustSelectProvidedAddress?.value,P=q({availableDeliveryAddresses:v,mustSelectProvidedAddress:E}),b=i.isShippingRequired.value&&!P,A=y(u),S=i.configuration.layout.isOnePage.value,R=u.hasFlagEnabled(Z),f=S||R,N=e(()=>f&&j({checkout:i})),O=n(e=>e.reduce((t,a,r)=>r===e.length-1?l.translate("shipping.shipping_method_combinations.combination",{rest:t,current:a}):l.translate("shipping.shipping_method_combinations.with_separator",{rest:t,current:a}),""),[l]),T=a(()=>({businessDays:e=>l.translate("shipping.estimated_delivery_date",{count:e}),businessDaysRange:(e,t)=>l.translate("shipping.estimated_delivery_date_range",{minimum:e,maximum:t}),subscriptionsOnlyShippingTitle:l.translate("shipping.subscription_shipping"),combineTwoShippingTitles:(e,t)=>l.translate("shipping.shipping_method_combinations.combination",{rest:e,current:t}),combineMultipleShippingTitles:O}),[l,O]),C=n(({intent:e,trigger:t,result:a})=>{if(a.errors.some(e=>K.has(e.code)))return d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, stock problems"),{reason:"OTHER_ERROR",intent:e,message:l.translate("wallets.errors.detour.stock_problems",{walletName:l.translate("brand.google_pay")})};if(a.errors.some(e=>e.code===X))return d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, price mismatch"),{reason:"OTHER_ERROR",intent:e,message:l.translate("wallets.errors.detour.price_change",{walletName:l.translate("brand.google_pay")})};if(a.errors.some(e=>se.has(e.code)))return d.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:l.translate("wallets.errors.invalid.zone")};if(a.errors.some(e=>Ce.includes(e.code)))return d.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:l.translate("wallets.errors.unsupported.address")};if(!ie(a.negotiated.paymentMethods,"GOOGLE_PAY"))return d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, google pay unavailable"),{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:e,message:l.translate("wallets.errors.unsupported.wallet_is_unavailable",{walletName:l.translate("brand.google_pay")})};const r=p.value;if(r?.initialCurrencyCode!==a.negotiated.subtotal?.currencyCode)return d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, currency change",{beforeCurrencyCode:r?.initialCurrencyCode,afterCurrencyCode:a.negotiated.subtotal?.currencyCode}),{reason:"OTHER_ERROR",intent:e,message:l.translate("wallets.errors.detour.currency_change",{walletName:l.translate("brand.google_pay")})};const o="INITIALIZE"===t;return a.errors.some(e=>Te.includes(e.code))&&!o?(d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiation error, delivery line changed"),{reason:"SHIPPING_OPTION_INVA
1LID",intent:e,message:l.translate("wallets.errors.outdated.shipping_method")}):void 0},[p,l,d]),D=n(({result:e,intent:a,trigger:r,resolve:o,reject:n,shippingOptionId:i,destinationCountry:u,destinationRegion:c,abortSignal:p})=>{function m(){return n({reason:"OTHER_ERROR",message:l.translate("wallets.errors.generic",{walletName:l.translate("brand.google_pay")}),intent:a})}if(p.aborted)return d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged result arrived after the session was aborted"),m();switch(d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged received negotiation result",{status:e.status,intent:a,trigger:r}),e.status){case"success":{if(null==e.negotiated.paymentDue)return d.error(new At("Missing negotiated paymentDue",{groupingHash:"GooglePayGenericError::MissingNegotiatedPaymentDue"})),m();const n=de(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:pt(r),label:e,description:vt({costAfterDiscounts:t,deliveryPromisePresentmentTitle:a})}))}(m):function(e,t){const a=U(e).filter(B).map(Xe);return Je(a).filter(e=>e.length).map(e=>{return{id:(a=e,mt(Ae(a))),label:gt(e,t),description:e.map(vt).join(", ")};var a})}(o,g),b=yt({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(H({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:s,i18nCurrency:l.currency,translations:T,selectedShippingId:i,deliveryMacros:n,googlePayTransactionId:g,shouldWalletDecelerateForSubscriptions:N.value,discountsZeroValueUXEnabled:A});if(p.error=C({intent:a,trigger:r,result:e}),b&&!p.newShippingOptionParameters&&!p.error){const t=e.negotiated.deliveryNext&&"unavailable"!==e.negotiated.deliveryNext.status?e.negotiated.deliveryNext.lines:[],o={wallet:"google_pay",intent:a,trigger:r,googlePayTransactionId:g,destinationCountry:u,destinationRegion:c,deliveryNextStatus:e.negotiated.deliveryNext?.status,deliveryLineCount:t.length,deliveryLineStatuses:t.map(e=>e.status).join(",")};d.log("google_pay_missing_shipping_options","wallet_missing_shipping_options",o),d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged resolved with no shipping options and no error",o)}return d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged handleNegotiationResult",{result:e.status,intent:a,trigger:r,transactionInfo:p.newTransactionInfo?JSON.stringify(p.newTransactionInfo):"MISSING"}),o(p)}case"throttled":return g(),n({reason:"OTHER_ERROR",message:l.translate("wallets.errors.detour.queue",{walletName:l.translate("brand.google_pay")}),intent:a});case"tooManyRequests":case"denied":case"alreadyCompleted":return g(),m();case"invalid":return e.reasons.includes(le.SubmittedForCompletion)?(d.log("payment_data_changed_negotiation_rejected","wallet_rejected_negotiation",{wallet:"google_pay",reason:"invalid",intent:a,trigger:r,reasons:e.reasons}),d.counter({name:"wallet_rejected_negotiation",value:1,attributes:{wallet:"google_pay",reason:"invalid"}}
1)):d.error(new Nt("Received unhandled invalid result",{groupingHash:"GooglePayInvalidError::UnhandledInvalidResult"}),{metadata:{request:{reasons:e.reasons}}}),m();case"stale":return d.log("payment_data_changed_negotiation_rejected","wallet_rejected_negotiation",{wallet:"google_pay",reason:"stale",intent:a,trigger:r}),d.counter({name:"wallet_rejected_negotiation",value:1,attributes:{wallet:"google_pay",reason:"stale"}}),m();case"fetch_failed":return d.log("payment_data_changed_negotiation_rejected","wallet_rejected_negotiation",{wallet:"google_pay",reason:"fetch_failed",intent:a,trigger:r,fetchFailureReason:e.reason,isActionable:e.isActionable,networkError:e.networkError??!1}),d.counter({name:"wallet_rejected_negotiation",value:1,attributes:{wallet:"google_pay",reason:"fetch_failed"}}),m();case"unexpected_error":return d.error(new Ot("Negotiation threw during the Google Pay session",{groupingHash:"GooglePayNegotiationError::NegotiationThrew",cause:e.error}),{metadata:{request:{intent:a,trigger:r,error:String(e.error)}}}),m();default:return d.error(new At(`Unhandled negotiation status: ${e.status}`,{groupingHash:"GooglePayGenericError::UnhandledNegotiationStatus"}),{metadata:{request:{intent:a,trigger:r,violations:e.violations.map(e=>e.code)}}}),m()}},[g,l,s,T,C,d,N,b,t,A]),M=n((e,t,a)=>t?new Promise((n,s)=>{ue(h)||I(r,void 0);const i="INITIALIZE"===a?e.initiallySelectedShippingOptionId:void 0,l=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&&ut.test(r)?e.postalCode=`${r} 0Z0`:"GB"===t&&dt.test(r)&&(e.postalCode=`${r} 0ZZ`),e}(ht({googleAddress:e,isFirstNameRequired:t}))}({googleAddress:t,isFirstNameRequired:c.value.isRequired("firstName")});d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiating for handleShippingAddressSelected",{trigger:a,city:t.locality,administrativeArea:t.administrativeArea,countryCode:t.countryCode}),P||(o.value=l),m({abortSignal:e.abortController.signal,fieldsToResolve:["deliveryNext","taxes"],customizeNegotiation:e=>({...Qe(e,l,{interfaceFlow:"GOOGLE_PAY",isConstrainedAddress:P,availableDeliveryAddresses:v,negotiatedDelivery:h}),payment:{...e.payment,totalAmount:{any:!0},paymentLines:lt(e.payment?.paymentLines,Lt)}}),observability:d,walletName:tt.GooglePay,onComplete:r=>D({result:r,intent:"SHIPPING_ADDRESS",trigger:a,resolve:n,reject:s,destinationCountry:t.countryCode,destinationRegion:t.administrativeArea,...i&&{shippingOptionId:i},abortSignal:e.abortController.signal}),logPrefix:"GooglePay::usePaymentDataChanged::handleShippingAddressSelected"}).catch(r=>{D({result:r instanceof $e?{status:"stale"}:{status:"unexpected_error",error:r},intent:"SHIPPING_ADDRESS",trigger:a,resolve:n,reject:s,destinationCountry:t.countryCode,destinationRegion:t.administrativeArea,abortSignal:e.abortController.signal})})}):Promise.resolve({}),[c,D,o,r,m,d,h,P,v]),G=n((e,t,a)=>new Promise((n,s)=>{let i;try{i=Ke(function(e){const t=new RegExp("[%]","g");return e.replace(t,'"')}(t))}catch{return d.error(new At(`Invalid shippingOptionId format: ${t}`,{groupingHash:"GooglePayGenericError::InvalidShippingOptionId"}
1)),n({error:{reason:"SHIPPING_OPTION_INVALID",message:l.translate("general.choose_delivery_strategy"),intent:"SHIPPING_OPTION"}})}I(r,i);const u=o.value;d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged negotiating for handleShippingMethodSelected",{trigger:a}),m({abortSignal:e,fieldsToResolve:["deliveryNext","taxes"],customizeNegotiation:e=>({...Qe(e,u,{interfaceFlow:"GOOGLE_PAY",isConstrainedAddress:P,availableDeliveryAddresses:v,negotiatedDelivery:h}),payment:{...e.payment,totalAmount:{any:!0},paymentLines:lt(e.payment?.paymentLines,Lt)}}),observability:d,walletName:tt.GooglePay,onComplete:r=>D({result:r,intent:"SHIPPING_OPTION",trigger:a,resolve:n,reject:s,shippingOptionId:t,abortSignal:e}),logPrefix:"GooglePay::usePaymentDataChanged::handleShippingMethodSelected"}).catch(r=>{D({result:r instanceof $e?{status:"stale"}:{status:"unexpected_error",error:r},intent:"SHIPPING_OPTION",trigger:a,resolve:n,reject:s,shippingOptionId:t,abortSignal:e})})}),[D,l,o,r,m,d,P,v,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 M(e,r,n);case"SHIPPING_OPTION":return o?.id?G(e.abortController.signal,o.id,n):a("SHIPPING_OPTION_INVA
1LID",l.translate("general.choose_delivery_strategy"),"SHIPPING_OPTION");default:return d.error(new At(`Could not recognize the intent: ${n}`,{groupingHash:"GooglePayGenericError::CannotRecognizeIntent"})),d.leaveErrorBreadcrumb("[GooglePay] usePaymentDataChanged could not recognize the intent",{callbackTrigger:n}),a("OTHER_ERROR",l.translate("wallets.errors.generic",{walletName:l.translate("brand.google_pay")}),"SHIPPING_ADDRESS")}},[M,G,d,l])}const Ht="QIbE6";function Yt({asPaymentMethod:G=!1}){const w=s(null),L=o(null),k=s(!1),Y=s(0),{isScrimOpen:U,closePopupWindowsAndScrim:B}=f({endpoint:L,invokingWallet:"GOOGLE_PAY"}),K=N(),J=Pt(),ee=g("GOOGLE_PAY").value,{value:te}=x().deliveryNext,{i18n:ae,observability:re,checkout:{wallets:se,proposal:ie},client:{userAgent:le},shop:de}=F(),ve=s({abortController:Bt(),initiallySelectedShippingOptionId:void 0}),Ee=o(void 0),{inMemoryGooglePayParts:{sdkStatus:Pe,buttonStatus:be}}=W(),{markAsLoaded:Ae}=ce(),Se=s(!0),Re=s(!1),fe=function({asPaymentMethod:a}){const o=V(),n=Pt(),s=function(){const{checkout:a}=F(),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:i,i18n:l,shop:d}=F(),u=x(),c=p(),_=Et(),{locationAddress:h}=z(),v=m(),E=y(d),P=i.configuration.layout.isOnePage.value,b=d.hasFlagEnabled(Z),A=P||b,I=e(()=>A&&j({checkout:i})),S=r(a);return e(()=>{const e=!S.value&&!q({availableDeliveryAddresses:u.availableDeliveryAddresses?.value,mustSelectProvidedAddress:u.mustSelectProvidedAddress?.value})&&i.isShippingRequired.value,a=e?["PAYMENT_AUTHORIZATION","SHIPPING_ADDRESS","SHIPPING_OPTION"]:["PAYMENT_AUTHORIZATION"],r=Ie(o,{includeShopPromotion:!1}),g=v.value&&h.fields.countryCode.value?[h.fields.countryCode.value]:d.shippingCountries?.map(e=>e.value),p=s.value,m=n.value;if(0===p.length||!m||!g||0===g.length&&e||null==r.paymentDue||null==r.subtotal)return null;const y=i.configuration.addressSettings.nonBillingAddressSettings.value,P=t(()=>y.isRequired("phone")),b=Boolean(H({deferredTotal:r.deferredTotal,checkoutTotal:r.checkoutTotal,paymentFlexibilityPaymentTermsTemplate:r.paymentFlexibilityPaymentTermsTemplate})?.amount);return{...ct,allowedPaymentMethods:p,merchantInfo:m,callbackIntents:a,emailRequired:c.value,shippingAddressParameters:{format:"FULL-ISO3166",allowedCountryCodes:g,phoneNumberRequired:P},shippingAddressRequired:e,shippingOptionRequired:e,transactionInfo:yt({labels:_,i18nCurrency:l.currency,...r,hasPayableDeposit:b,shouldWalletDecelerateForSubscriptions:I.value,discountsZeroValueUXEnabled:E})}})}({asPaymentMethod:G}),Ne=s(null),{checkoutCardsinkCallerIdentificationSignature:Oe}=ie.negotiated.fields,Te=a(()=>{if(!de.cardsinkUrl)return;const e=window.location.host;return{isLocalDev:e.endsWith("checkout.my.shop.dev")||e.endsWith("checkout.shop.dev"),cardsinkUrl:de.cardsinkUrl,callerIdentificationJwt:Oe.value}},[de.cardsinkUrl,Oe]),Ce=G?ae.translate("wallets.call_to_action",{walletName:""}):void 0,De=ae.translate("brand.google_pay"),Me=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}=F();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:A(p.current)},cardsinkConfig:v,sourceId:P.sourceId});y.current=!1,l(),b.status===ge.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===ge.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===ge.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:L,isTerminated:k,color:K,config:ee,merchantInfo:J.value,buttonLabel:Ce,ariaLabel:De,markAsLoaded:Ae,sdkStatus:Pe,sdkStatusRef:w,buttonStatus:be,paymentDataRequest:fe,containerRef:Ne,asPaymentMethod:G,isFirstRender:Se,updateSdkStatus:Ut,connectedNullPaymentDataRequest:Re,cardsinkConfig:Te}),Ge=function({paymentDataRequest:e,asPaymentMethod:t,isScrimOpen:a,containerRef:r,endpoint:s}){const i=_(),{negotiate:l}=h(),d=v(),{observability:u,checkout:{wallets:c,proposal:g},client:{userAgent:p}}=F(),m=Q(p),y="Safari"===m.name,A=$(p),I=o(!1),S=o(!1),{inMemoryGooglePayParts:{paymentSheetError:R,paymentSheetOpenPromise:f,paymentSheetOpenPromiseResolve:N,sdkStatus:O},persistedGooglePaySignal:T}=W(),C=et(tt.GooglePay),D=E(tt.GooglePay),M=P(tt.GooglePay);return n(async()=>{i(r);try{if(t){if(I.value)return;I.value=!0,y&&(s.value?.call.updateValidationLock({status:"success"}),a.value=!0),await new Promise((e,t)=>
1{const a=d.value,r=g.negotiated.value;l({negotiationStage:"completion",legacyFiltering:{},silenceViolations:nt({journey:a,negotiated:r,fieldsToValidate:[...b(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=O.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{D();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"}),R.value={type:"config_missing_required_fields"},a.value=!1,void s.value?.call.updateValidationLock({status:"failure"});M(),C(at.Success,t?rt.PaymentMethod:rt.Express),u.counter({name:"wallet_sheet_clicked",value:1,attributes:{instrument:tt.GooglePay}}),S.value||(u.counter({name:"wallet_attempt_to_open_payment_sheet",value:1,attributes:{os:A,browser:m.name}}),S.value=!0),T.value={initialCurrencyCode:r.transactionInfo.currencyCode,receiptIdForPaymentFailure:T.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=>{N.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{I.value&&(I.value=!1)}},[t,m,r,i,M,D,s,S,y,a,I,d,l,A,e,R,f,N,T,g,O,u,C,c])}({paymentDataRequest:fe,asPaymentMethod:G,isScrimOpen:U,containerRef:Ne,endpoint:L}),we=function(e){const t=et(tt.GooglePay),a=o(!1),{persistedGooglePaySignal:r,inMemoryGooglePayParts:{sdkStatus:s,buttonStatus:i,paymentSheetError:l,paymentSheetOpenPromiseResolve:d,paymentSheetOpenPromise:u}}=W(),{observability:c,checkout:{wallets:g},client:{userAgent:p}}=F(),m=Q(p),y=$(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:tt.GooglePay}}):c.counter({name:"wallet_sheet_failed",value:1,attributes:{instrument:tt.GooglePay}}),p.name){case"CANCELED":c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: CANCELED"),t(at.Cancelled);break;case"DEVELOPER_ERROR":c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: DEVELOPER_ERROR",{errorMessage:p.message}),t(at.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(at.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(at.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(at.Failure);break;case"FAILED_TO_OPEN_WINDOW":a.value||(c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: FAILED_TO_OPEN_WINDOW"),t(at.Failure),c.counter({name:"wallet_failed_to_open_window",value:1,attributes:{os:y,browser:m.name}}),a.value=!0);break;default:c.leaveErrorBreadcrumb("[GooglePay] useGooglePayResponseHandler error: UNEXPECTED_STATUS",{errorName:p.name,errorMessage:p.message}),c.error(new Rt(`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])}(U),Le=kt({googlePayTransactionId:Ee}),ke=function({asPaymentMethod:t}){const{deliveryLines:r,email:o,shippingAddress:s,billingAddress:i,paymentLines:l}=z(),{progress:d}=h(),{shop:u,checkout:c,observability:p}=F(),m=c.configuration.addressSettings.nonBillingAddressSettings,y=oe(),_=x(),v=_.availableDeliveryAddresses?.value,E=_.mustSelectProvidedAddress?.value,P=q({availableDeliveryAddresses:v,mustSelectProvidedAddress:E}),b=V(),A=c.configuration.layout.isOnePage.value,f=u.hasFlagEnabled(Z),N=!A&&f,O=e(()=>c.configuration.layout.isOnePage.value||f),T=e(()=>O.value&&j({checkout:c})),C=g("GOOGLE_PAY"),D=function({supportsOnePage:e=!1}={}){const{i18n:t,observability:r}=F(),{inMemoryGooglePayParts:o}=W(),n=xe(),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 Ct(r,s,o,n):new Dt(r,s,o,n),[r,e,s,o,n])}({supportsOnePage:O.value||T.value}),M=wt(),G=ze(),w=S(),L=R(),k=function(){const{walletUsedForSubmissionSignal:e,inMemoryGooglePayParts:{paymentSheetError:t}}=W(),a=wt();return n(()=>{t.value=void 0,e.value=void 0,a()},[t,e,a])}(),H=st({flag:Z,onAbort:k,onError:k}),{inMemoryGooglePayParts:{paymentSheetOpenPromise:Y,paymentSheetError:U},persistedGooglePaySignal:B,walletUsedForSubmissionSignal:Q}=W(),{trackAttempt:$,trackComplete:K}=it(tt.GooglePay),J=n(async({reason:e})=>{N?await H({wallet:"GOOGLE_PAY",reason:e,asPaymentMethod:!1,announceSubscriptionReviewLayoutSwitch:"subscriptions"===e}):(c.wallets.setEscalatedWallet("GOOGLE_PAY"),L?.dispatch("addressReplaced"))},[H,N,L,c.wallets]);return n(({isShippingRequired:e,paymentData:a,cardsinkResult:n})=>new Promise(u=>{const c=performance.now();p.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"}),$();const g=()=>{K({result:"failed",durationMs:performance.now()-c})},h=a.shippingAddress,v=a.paymentMethodData.info?.billingAddress,E=a.paymentMethodData,A=m.value.isRequired("address2"),S=D.val
1idatePaymentCurrency({initialCurrencyCode:B.value?.initialCurrencyCode,currentCurrencyCode:b.current.fields.subtotal?.value?.currencyCode}),R=D.validateBilling(a),f=D.validateShipping(a,e,A);if(p.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized: validation results",{paymentValidationResult:S,billingValidationResult:R,shippingValidationResult:f}),S.paymentSheetAction)return g(),j(S.paymentSheetAction);if(R.paymentSheetAction)return g(),j(R.paymentSheetAction);if(f.paymentSheetAction)return g(),j(f.paymentSheetAction);if(R.shouldPersist&&v&&(i.value=ht({googleAddress:v,isFirstNameRequired:m.value.isRequired("firstName")})),f.shouldPersist&&h){const e=h.iso3166AdministrativeArea;w({postalCode:h.postalCode,countryCode:h.countryCode,city:h.locality,zoneCode:e},"GOOGLE_PAY"),P||(s.value=ht({googleAddress:h,isFirstNameRequired:m.value.isRequired("firstName")}))}const L=_.buyerIdentity.value?.customerProfile?.email||a.email;L&&(o.value=L),G(),B.value={...B.value,description:E.description,receiptIdForPaymentFailure:void 0};const k=l.value,{signature:H,signedMessage:F,protocolVersion:V}=a.paymentMethodData.tokenizationData.token?JSON.parse(a.paymentMethodData.tokenizationData.token):{signature:"",signedMessage:"",protocolVersion:""};let x=0;const z=Ze(b.current.fields.deliveryNext?.value),Z=async()=>{let e=!1;p.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, payment authorized completion attempt",{attemptNumber:x}),await d("google-pay-payment-authorized",async a=>{p.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&&(Q.value="GOOGLE_PAY"),"denied"!==a.status&&"throttled"!==a.status&&"tooManyRequests"!==a.status||M();const o=a,n="rejected"===o.status&&o.violations.some(e=>e.code===X),{shouldRetry:s,retryReason:i,updatedDeliveryMethodHandles:l}=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=qe(e,a.current.fields.deliveryNext?.peek(),r);if(t)return{shouldRetry:!0,retryReason:"delivery_option_mismatch",updatedDeliveryMethodHandles:t}}return o}(o,x,b,z);if(l&&I(r,l),s&&!n)return x++,p.counter({name:"wallet_submit_for_completion_retry",value:1,attributes:{retry_reason:i,retry_count:x,status:o.status,instrument:tt.GooglePay}}),p.log("payment_authorized_completion_retried",`GooglePay::usePaymentAuthorized: Retrying ${i} completion`,{attemptNumber:x}),void Z();const d=D.completionResultMapper.mapResultToPaymentSheetAction(o,{options:{asPaymentMethod:t}});p.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, payment sheet action mapper result",{paymentSheetAction:d});const u="show_error"===d.action||"abort"===d.action?"failed":"success";try{await j(d)}finally{K({result:u,durationMs:performance.now()-c,attributes:{retry_count:x>0?x.toString():void 0}}),p.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, authorization result",{authorizationResult:u}),!O.value||"rejected"!==a.status&&"invalid"!==a.status||(U.value||(U.value={type:"recovery_notice"}),N?e=!0:J({reason:"submitForCompletion"}))}},{skipToCompletion:!0,customizeCompletion:je}),e&&J({reason:"submitForCompletion"})};async function j(e){if(e.effects?.forEach(e=>e()),"show_error"===e.action)return p.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, resolving with error",{paymentSheetAction:e}),void u({transactionState:"ERROR",error:e.errors?.[0]});p.leaveErrorBreadcrumb("[GooglePay] usePaymentAuthorized, resolving with success"),u({transactionState:"SUCCESS"}),await Y.value}(()=>{const e=b.current.fields.paymentDue.value,t=e&&e.amount>0||y.value;return n?(e=>{if(e){if(n&&"error"in n)return p.leaveErrorBreadcrumb("[GooglePay] Cardsink deposit failed in sandbox",{error:n.error}),p.counter({name:"wallet_authorization_cardsink",value:1,attributes:{status:"failed",instrument:tt.GooglePay}}),j({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",message:"Failed to process payment",intent:"PAYMENT_AUTHORIZATION"}]}),!1;
1n&&"sessionId"in n&&(p.leaveErrorBreadcrumb("[GooglePay] Using sessionId from sandbox cardsink",{sessionId:n.sessionId}),p.counter({name:"wallet_authorization_cardsink",value:1,attributes:{status:"success",instrument:tt.GooglePay}}),l.value=ne(k,{method:{type:"wallet",name:"GOOGLE_PAY",walletContent:{protocolVersion:"",signature:"",signedMessage:"",sessionId:n.sessionId,paymentMethodIdentifier:C.value?.paymentMethodIdentifier}}}))}return!0})(t):(t&&(l.value=ne(k,{method:{type:"wallet",name:"GOOGLE_PAY",walletContent:{signature:H,signedMessage:F,protocolVersion:V,paymentMethodIdentifier:C.value?.paymentMethodIdentifier}}})),!0)})()&&(T.value?j({action:"decelerate",effects:[()=>{U.value=void 0}]}).finally(()=>J({reason:"subscriptions"})).catch(e=>{p.leaveErrorBreadcrumb("[Google Pay] Failed to handle payment sheet action:",{err:e})}):Z())}),[m,t,M,C,_,y,b,Y,D,B,d,i,r,o,l,s,Q,w,p,U,G,P,O,T,J,N,$,K])}({asPaymentMethod:G}),He=ye(),Ye=pe();function Ue(e){re.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};re.counter({name:"google_pay_callback_events",value:1,attributes:n}),"resolved"!==r&&"rejected"!==r||re.histogram({name:"google_pay_callback_duration",value:o,unit:"ms",attributes:n})}function Be(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=he(),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:Ee.peek(),log:e=>{"started"===e.outcome?(a=!0,Y.current++):!a||"resolved"!==e.outcome&&"rejected"!==e.outcome||(a=!1,Y.current--),Ue(e)}})}function Fe(e){try{re.log("google_pay_sandbox_lifecycle","[GooglePay] sandbox lifecycle",{stage:e,googlePayTransactionId:Ee.peek(),pendingHostCallbacksInComponent:Y.current},{requiresKeepalive:!0})}catch{}}const Ve=me({onPaymentAuthorized:e=>Be("authorization").observe(()=>ke(e)),onPaymentDataChanged:e=>Be("shipping",e.callbackTrigger).observe(()=>Le({sessionData:ve.current,intermediatePaymentData:e})),onClick:async({transactionId:e}={})=>(e&&(Ee.value=e),ue(te)&&(ve.current.initiallySelectedShippingOptionId=pt(M({proposedDeliveryLines:ie.proposed.deliveryLines}))),await Ge()),onResponse:e=>{Fe("wallet_response_received");const t=ve.current.abortController;ve.current={abortController:Bt(),initiallySelectedShippingOptionId:void 0};const a=we(e);return t.abort(),a},telemetry:He,breadcrumb:e=>{var t;if("[GooglePay Sandbox] callback progress"!==e.message&&"[GooglePay Sandbox] loadPaymentData started"!==e.message&&"[GooglePay Sandbox] loadPaymentData resolved"!==e.message)Ye(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||Ue(e.attributes)):re.log("google_pay_sheet_progress",e.message,e.attributes,{requiresKeepalive:!0})}catch{}}});i(()=>{const e=!Se.current||Re.current;L.value&&fe.value&&e&&(Re.current=!1,L.value.call.updatePaymentDataRequest(fe.value))}),l(()=>(Ut({status:"loading"},Pe,w),()=>{const e=Pe.value,t=be.value;e===w.current&&"error"!==t.status&&(Pe.value={status:"idle"},be.value={status:"not_rendered"},"GOOGLE_PAY"===se.activeSession.value?.wallet&&se.clearActiveSession({invokingWallet:"GOOG
1LE_PAY"}))}),[]);const We=G?"54px":void 0,Qe=d(C,{inlineAlignment:"center",children:d(D,{size:"large"})}),$e=!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)}(le),Ke=r(!$e),Xe=d(T,{isOpen:U,isInvisible:Ke,onClick:B,children:$e&&d(O,{handleClose:B,walletName:ae.translate("brand.google_pay")})}),Je=d(c,{children:[d(_e,{wallet:bt,onConnect:Me,onTerminate:()=>{Fe("endpoint_terminated"),k.current=!0,L.value=null},hostMethods:Ve,ref:Ne,height:We}),Xe]}),ot=G&&"rendered"!==be.value.status&&"error"!==be.value.status;return G?d(c,{children:[ot&&Qe,d(C,{className:u({[Ht]:ot}),children:Je})]}):Je}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.