PageSourceSearch

https://shop.stalbansmuseums.org.uk/cdn/shopifycloud/checkout-web/assets/c1/hooks-usePreselectSpi.IsvB0pZz.js

js stalbansmuseums.org.uk collected 2026-09-24 21:47:12 UTC 4,314 bytes, 1 lines download raw bytes

1import{A as P,f as p,l as m,T as S,q as v}from"./esnext-vendor.BBoIVOQW.js";import{a5 as C,T as A,W as I,bt as R,Y as M,bu as L,bf as N,bv as b,bw as B,aF as y,a6 as _}from"./addresses-is-address-empty.ZJ1ThpFy.js";import{b4 as f,b5 as O}from"./hydrate.Tsur0pib.js";import{u as T}from"./payment-usePaymentExemptionReason.lTG2U3gh.js";const E={eligible:!1,nonEligibleReason:"SHOP_CASH_NOT_AVAILABLE",serverConfirmed:!0},H={eligible:!0,nonEligibleReason:null,serverConfirmed:!1};function V(){const e=C().shopCashBalance,s=P(null);return p(()=>{const n=e.value;if(n?.status==="filled"){const t={eligible:n.eligible,nonEligibleReason:n.eligible?null:n.nonEligibleReason??"SHOP_CASH_NOT_AVAILABLE",serverConfirmed:!0};return s.current=t,t}return n?.status==="unavailable"?(s.current=E,E):s.current?{...s.current,serverConfirmed:!1}:H})}function k(){const{shopPay:e,checkout:s}=A(),n=I(),t=T(),o=p(()=>{if(!s.isShippingRequired.value)return null;const a=e.session.selectedShippingAddress.value;return a?.address?a.address:n.shippingAddress.value}),l=p(()=>{const a=e.session.selectedPaymentMethod.value,u=!n.paymentLines.value.some(i=>!R(i))&&a!=null&&M(a);return(t.value==="APPLE_PAY"||u)&&o.value!=null}),r=p(()=>{const a=e.session.selectedPaymentMethod.value;if(l.value&&o.value){const i=o.value,c=i.phone||n.billingAddress.value.phone||e.user.phoneNumber.value;return c&&c!==i.phone?{...i,phone:c}:i}const d=L(a);if(d){const i=d.billingAddress.address;return i.phone?i:{...i,phone:n.billingAddress.value.phone}}const u=e.session.selectedBillingAddress.value;return u?.address?u.address:n.billingAddressOption.value==="shipping"&&o.value?o.value:n.billingAddress.value}),h=m(f(o.value?.countryCode,void 0,s.configuration.addressSettings.nonBillingAddressSettings.value)),g=m(f(r.value.countryCode,void 0,s.configuration.addressSettings.billingAddressSettings.value));return p(()=>{const a=o.value,d=r.value,u=a?h.value(a,"shipping"):new Map,i=g.value(d,"billing");return{selectedBillingAddress:d,selectedShippingAddress:a,isUsingApplePayShippingFallback:l.value,billingAddressErrors:i,shippingAddressErrors:u}})}function K(){const e=V(),s=C().deliveryNext,n=N("deliveryNext"),t=k();return p(()=>{const{nonEligibleReason:o,serverConfirmed:l}=e.value,r=s.value,h=n.value,{selectedShippingAddress:g,shippingAddressErrors:a,billingAddressErrors:d}=t.value,u=d.size>0,i=a.size>0||g&&!h&&r?.status==="unavailable";let c=null;return o?c=o:i?c=b.ShopCashInvalidShippingAddress:u&&(c=b.ShopCashInvalidBillingAddress),{eligible:c==null,nonEligibleReason:c,serverConfirmed:l}})}const U=e=>!!(e.amount&&!isNaN(e.amount)&&e.amount>0&&e.currencyCode&&B[e.currencyCode]),x=e=>"amount"in e&&typeof e.amount=="string",D=e=>x(e)?{amount:Number(e.amount),currencyCode:e.currencyCode}:{amount:Number(e.value),currencyCode:e.currency},Q=e=>{if(!e)return null;const s=D(e);return U(s)?s:null},F="shopify_pay_payment_page_shop_cash_redemption_visibility/1.1",Y="shopify_pay_payment_page_shop_cash_redemption_eligibility/3.1",q="shopify_pay_payment_page_shop_cash_redemption_actions/1.0",w="shopify_pay_payment_page_shop_cash_reward_eligibility/5.1",W="shopify_pay_payment_page_ui_interaction/1.1",X=()=>{const{userEvents:e,source:s,checkout:n,shop:t,shopPay:o}=A(),l=o.user.publicId.value,r=S(()=>({publicId:l}),[l]),h=v(i=>e.monorailEvent({schemaId:F,payload:{...y(s,n,t),...r,...i}}),[e,s,n,t,r]),g=v(i=>e.monorailEvent({schemaId:Y,payload:{...y(s,n,t),...r,...i}}),[e,s,n,t,r]),a=v(i=>e.monorailEvent({schemaId:q,payload:{...y(s,n,t),...r,...i}}),[e,s,n,t,r]),d=v(i=>e.monorailEvent({schemaId:w,payload:{...y(s,n,t),...r,...i}}),[e,s,n,t,r]),u=v(i=>e.monorailEvent({schemaId:W,payload:{...y(s,n,t),...i}}),[e,s,n,t]);return{recordRedemptionActionEvent:a,recordRedemptionVisibilityEvent:h,recordRedemptionEligibilityEvent:g,recordRewardEligibilityEvent:d,recordUiInteractionEvent:u}};function Z(){const{checkout:e,shopPay:s}=A(),n=O();return p(()=>{if(!e.installments.isSupported.value)return{spiPreselected:!1,preselectionReason:void 0};const t=[];n.value&&t.push(_.PointOfSale),s.config.shouldPreSelectInstallments&&t.push(_.SpiBanner);const o=s.user.installments.preselectReason.value;o&&t.push(o);const l=t.length>0;return{spiPreselected:l,preselectionReason:l?t.join(","):void 0}})}export{Q as a,K as b,Z as c,k as d,D as t,X as u};

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.