PageSourceSearch

https://shop.szene-hamburg.com/cdn/shopifycloud/checkout-web/asset…/CheckoutSheetProtocolProvider.BSTCRCAr.js

js szene-hamburg.com collected 2026-09-24 09:55:28 UTC 11,228 bytes, 1 lines download raw bytes

1import{T as l,A as te,q as A,u as p,h as re}from"./esnext-vendor.D7ldIee_.js";import{M as ne,d5 as $,j as oe,d6 as se,bi as ae,cE as ie,r as ce,N as H,as as ue,cI as le}from"./addresses-is-address-empty.-MuOhIyI.js";import{ba as q,cN as de}from"./hydrate.ByRIsqvd.js";import{C as pe}from"./context-CheckoutSheetProtocolClient.CNLSBD5p.js";import{p as he,u as me,C as ge,P as ye}from"./utils-useViolationsHandler.BKoPz2bB.js";import{o as fe,c as be,a as Pe,g as z,h as V,b as B,d as J,i as b,j as P,k,f as M,e as C,u as w,C as ke,l as f,n as N}from"./utils-checkoutProtocolLinkInterceptor.BsujaGs-.js";import"./app.A60-IfPs.js";import"./constants.DowbVE6J.js";import"./hooks-useReplaceShopPayInHistory.Cz4PqGkk.js";import"./receipt-merchandise-lines.DPd9PNUS.js";function Me(){return ne($)}const Ce=({children:e,version:t,mapDefaults:r,eventListenersHook:o,eventMessageMapper:n})=>{const{client:a}=Me(),i=o(),c=l(()=>{const d=u=>{if(a){const s=n(u);s&&he(a,s)}};return{schema:{version:t,eventMessageMapper:n,eventListeners:i,defaultsMapper:u=>r(u,d),postMessageHandler:d}}},[i,t,n,a,r]);return e(c)};function Y(e){return{handlerId:"error",body:[{group:"authentication",code:e.status.toLowerCase(),reason:e.reason||void 0}]}}function we(e){if(oe(e)){const t=e.amount;if(!t)return;const r=e.discount,o=r.value,{valueType:n,value:a}=fe(o);return{title:r.title,amount:t,valueType:n,value:a,applicationType:r.type}}}function Se(e){if(e)return e.lines.reduce((t,r)=>{const o=r;if(!o)return t;const n=we(o);return n&&t.push(n),t},[])}function v({total:e,subtotal:t,taxes:r,taxesIncluded:o,discountLines:n,shipping:a}){return{total:e,subtotal:t,taxes:Pe(r),taxesIncluded:o,discounts:Se(n),shipping:be(a)}}function Ee({flowType:e,cartToken:t,negotiated:r,receipt:o}){const{confirmationPage:n,purchaseOrder:{email:a,phone:i,shippingAddress:c,billingAddress:d,paymentLines:h},orderIdentity:{id:u}}=o,s=z(r,o),m=v({total:s.total,subtotal:s.subtotal,taxes:s.taxes,taxesIncluded:s.merchandiseLines?.taxesIncluded,discountLines:s.discountLines,shipping:s.delivery}),g=V(t,s.merchandiseLines,m),y=n.url;return{flowType:e,confirmationURL:y,orderDetails:{id:u,cart:g,email:a,phone:i,shippingAddress:c,billingAddress:d,paymentMethods:J(h),deliveries:B(s.delivery,c)},thankYouPageUrl:y,orderId:u,cart:g}}function R(e){return{handlerId:"completed",body:Ee(e)}}function S(e){return{handlerId:e.type,body:{paymentUrl:e.paymentUrl}}}function E(e){const t=e.reasons?.map(r=>({type:"checkout_blocking",flowType:e.flowType,group:"checkout",reason:r}));return{handlerId:"error",body:t&&t.length>0?t:[{type:"checkout_blocking",flowType:e.flowType,group:"checkout"}]}}function I(e){return{handlerId:"locale",body:{locale:e.locale}}}function Ie(e){return{status:e.status,type:e.failure.type,reason:e.failure.type==="payment"?e.failure.code:void 0}}function L(e){return{handlerId:"error",body:[{flowType:e.flowType,group:"checkout",...Ie(e.receipt)}]}}const _={buyerInfo:["regular","checkoutDefaults"],billingAddress:["regular","payPal","shopPay"],paymentInfo:["checkoutDefaults"]};function Le(e){const t={acceptsMarketing:!!e.acceptsMarketing};return _.buyerInfo.includes(e.flowType)&&(t.email=e.contactInfo?.email||void 0,t.selectedShippingAddress=e.checkoutDefaultsSelectedShippingAddress),_.billingAddress.includes(e.flowType)&&e.billingAddress&&(t.selectedPaymentMethod=xe(e.billingAddress)),_.paymentInfo.includes(e.flowType)&&(t.selectedPaymentMethod=e.checkoutDefaultsSelectedPaymentMethod),t}function xe(e){return{referenceId:"",cardType:"",lastFourDigits:"",expirationMonth:"",expirationYear:"",billingAddress:e}}function De(e){return["shopPay","shopPayLogin","checkoutDefaults","applePay","googlePay","payPal","amazonPay","buyWithPrime","shopifyInstallments"].includes(e)}function Te(e){return De(e)?e:"regular"}function _e({flowType:e,negotiated:t}){const{cartToken:r,contactInfo:o,acceptsMarketing:n,merchandiseLines:a,billingAddress:i,shippingAddress:c,total:d,subtotal:h,taxes:u,discountLines:s,delivery:m,selectedPaymentMethod:g}=t,y=v({total:d,subtotal:h,taxes:u,taxesIncluded:a?.taxesIncluded,discountLines:s,shipping:m}
1),j=Te(e),Z=Le({flowType:j,contactInfo:o,billingAddress:i,acceptsMarketing:n,checkoutDefaultsSelectedShippingAddress:c,checkoutDefaultsSelectedPaymentMethod:g}),ee=B(m,c);return{flowType:j,cart:V(r,a,y),buyer:Z,deliveries:ee}}function Ae(e){const{deliveries:t,flowType:r}=e,o=t?.map(n=>(n.method==="SHIPPING"&&!["regular","checkoutDefaults"].includes(r)&&n.details?.location&&(n.details.location=void 0),n));return{...e,deliveries:o}}function x(e){const t=_e(e);return{handlerId:"stateChange",body:{...Ae(t)}}}function D(e){return{handlerId:"updateProgressButton",body:{state:e.state,stage:e.stage}}}function T(e){return{handlerId:"error",body:e.violationErrors.map(t=>({flowType:e.flowType,group:t.group,type:t.type,code:t.code,reason:t.violation?.nonLocalizedMessage}))}}function He(e,t,r=!0){const{acceptedSubscriptionTerms:o,paymentMethodIdentifier:n}=t.method;return{method:{type:"direct",sessionId:e,acceptedSubscriptionTerms:o,paymentMethodIdentifier:n,cardSource:r?"SAVED_CREDIT_CARD":void 0}}}function Ve(e){return e.paymentLines.peek().find(({method:{type:o}})=>o==="direct")}function Be(e){return e!=="progression"&&e!=="completion"}function ve(e){return!1}function G(){const e=me(),t=se(),r=te(void 0),o=A(n=>{r.current=n.detail?.sessionId,e.emit()},[r,e]);return ae(n=>{const a=r.current;n.type==="error"&&a&&window.mobileCheckoutSdkIdentity&&(t(),r.current=void 0)}),ie(({parts:n,reason:a})=>{const i=r.current;if(!i||!window.mobileCheckoutSdkIdentity||Be(a))return{behavior:"allow"};const c=Ve(n);return!c||ve()?{behavior:"allow"}:{behavior:"allow",perform:()=>{n.paymentLines.value=ce(n.paymentLines.peek(),He(i,c))}}}),o}function Q(){const e=G(),{observability:t}=H();return l(()=>({messageKey:"submitPayment",handler:r=>{t.log("checkout_sheet_protocol_submit_payment_message_received","Handling submitPayment message."),e(r)}}),[e,t])}function Re(e){switch(e.type){case"completed":return R(e);case"receiptError":return L(e);case"stateChange":return x(e);case"init":return S(e);case"violation":return T(e);case"checkoutBlockingEvent":return C(e);case"updateProgressButton":return D(e);case"authentication":return Y(e);case"journeyProgressionError":return E(e);case"webPixels":return M(e);case"expired":return k(e);case"configuration":return P(e);case"unrecoverable":return b(e);case"locale":return I(e)}}function Fe(){const e=w(),t=Q();return l(()=>({submitPayment:t,presented:e}),[t,e])}function Ue(e){switch(e.type){case"completed":return R(e);case"receiptError":return L(e);case"stateChange":return x(e);case"init":return S(e);case"violation":return T(e);case"checkoutBlockingEvent":return C(e);case"updateProgressButton":return D(e);case"authentication":return Y(e);case"journeyProgressionError":return E(e);case"webPixels":return M(e);case"expired":return k(e);case"configuration":return P(e);case"unrecoverable":return b(e);case"locale":return I(e)}}function Oe(){const e=w(),t=Q();return l(()=>({submitPayment:t,presented:e}),[t,e])}function F(e){return{handlerId:"error",body:[{group:"killswitch",reason:e.reason||void 0}]}}function U(){const e=G(),{observability:t}=H(),r=A(()=>{const n=document?.activeElement;n instanceof HTMLElement&&n.blur()},[]),o=A(async n=>{t.log("checkout_sheet_protocol_progress_message_received","Handling progress message."),r(),await Promise.resolve(),e(n)},[e,r,t]);return l(()=>({messageKey:"progress",handler:o}),[o])}function O(e){return{handlerId:"error",body:[{group:"authentication",code:e.error,reason:e.reason||void 0}]}}function K(e){switch(e.type){case"completed":return R(e);case"receiptError":return L(e);case"stateChange":return x(e);case"init":return S(e);case"violation":return T(e);case"checkoutBlockingEvent":return C(e);case"updateProgressButton":return D(e);case"authenticationError":return O(e);case"journeyProgressionError":return E(e);case"webPixels":return M(e);case"expired":return k(e);case"configuration":return P(e);case"unrecoverable":return b(e);case"locale":return I(e);case"killswitch":return F(e)}}function W(){const e=w(),t=U();return l(()=>({progress:t,presented:e}),[t,e])}function je({flowType:e,cartToken:t,negotiated:r,receipt:o}){const{confirmationPage:n,purchaseOrder:{email:a,phone:i,shippingAddress:c,billingAddress:d,paymentLines:h},orderIdentity:{id:u}}=o,s=z(r,o),m=v({total:s.total,subtotal:s.subtotal,taxes:s.taxes,taxesIncluded:s.merchandiseLines?.taxesIncluded,discountLines:s.discountLines,shipping:s.delivery}),g=V(t,s.merchandiseLines,m),y=n.url;return{flowType:e,confirmationURL:y,orderDetails:{id:u,cart:g,email:a,phone:i,billingAddress:d,paymentMethods:J(h),deliveries:B(s.delivery,c)}}}function X(e){return{handlerId:"completed",body:je(e)}}function Ne(e){switch(e.type){case"completed":return X(e);
1case"receiptError":return L(e);case"stateChange":return x(e);case"init":return S(e);case"violation":return T(e);case"checkoutBlockingEvent":return C(e);case"updateProgressButton":return D(e);case"authenticationError":return O(e);case"journeyProgressionError":return E(e);case"webPixels":return M(e);case"expired":return k(e);case"configuration":return P(e);case"unrecoverable":return b(e);case"locale":return I(e);case"killswitch":return F(e)}}function Ke(){const e=w(),t=U();return l(()=>({progress:t,presented:e}),[t,e])}function We(e){switch(e.type){case"completed":return X(e);case"receiptError":return L(e);case"stateChange":return x(e);case"init":return S(e);case"violation":return T(e);case"checkoutBlockingEvent":return C(e);case"updateProgressButton":return D(e);case"authenticationError":return O(e);case"journeyProgressionError":return E(e);case"webPixels":return M(e);case"expired":return k(e);case"configuration":return P(e);case"unrecoverable":return b(e);case"locale":return I(e);case"killswitch":return F(e)}}function $e(){const e=w(),t=U();return l(()=>({progress:t,presented:e}),[t,e])}const qe={"2024-04":{mapDefaults:f,eventListenersHook:Fe,eventMessageMapper:Re},"2024-07":{mapDefaults:f,eventListenersHook:Oe,eventMessageMapper:Ue},"2024-10":{mapDefaults:f,eventListenersHook:W,eventMessageMapper:K},"2025-01":{mapDefaults:f,eventListenersHook:Ke,eventMessageMapper:Ne},"2025-04":{mapDefaults:f,eventListenersHook:$e,eventMessageMapper:We},unstable:{mapDefaults:f,eventListenersHook:W,eventMessageMapper:K}},ze=({children:e})=>{const r=q()?.schema||Array.from(ue)[0];return p(Je,{version:r,children:o=>p(ge.Provider,{value:o,children:[p(ke,{}),e]})})},Je=({children:e,version:t})=>{const{mapDefaults:r,eventListenersHook:o,eventMessageMapper:n}=qe[t];return p(Ce,{version:t,mapDefaults:r,eventListenersHook:o,eventMessageMapper:n,children:e})},at=({children:e})=>{const t=de(),{observability:r}=H(),o=l(()=>new pe(r),[r]),n=q(),a=!!n;re(()=>(t.value&&!window.Shopify?.CheckoutSheetProtocol&&(window.Shopify={...window.Shopify,CheckoutSheetProtocol:o},window.addEventListener("click",N)),()=>{delete window.Shopify?.CheckoutSheetProtocol,window.removeEventListener("click",N)}),[o,t.value]);const i=l(()=>({client:t.value?o:null,config:n}),[t.value,o,n]);return le(t.value,a),p($.Provider,{value:i,children:p(ye,{children:p(ze,{children:e})})})};export{at as CheckoutSheetProtocolProvider};

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.