import{hA as h,s4 as v,bu as C,s5 as R,s6 as T,fc as w,aV as B,bn as H,i as K,ap as M,ab as y,ef as P,bE as D,fQ as Y,b3 as V,ai as I,ft as $,b_ as G,kQ as Q,bM as g,gB as x,i1 as N,aR as q,s7 as W,e2 as j,s8 as z,kb as J,s9 as X,ej as Z,by as ee,e as se,a as l,bP as m,a6 as te}from"./app.owqgWGYv.js";const ne={id:"0c62c3aaedf84bd307e1134828e5fcc88a47d83c453c97544a6cc8711e6444af",type:"mutation",name:"SubscribeForShippingUpdates",source:"mutation SubscribeForShippingUpdates($orderId:ID!,$email:String!,$sessionToken:String!){subscribeForShippingUpdates(orderId:$orderId email:$email sessionInput:{sessionToken:$sessionToken}){...on SubscribeForShippingUpdatesSuccess{__typename}...on SubscribeForShippingUpdatesFailure{code __typename}__typename}}"};class _ extends Error{name="SubscribeForShippingUpdateError"}function pe(){const e=H(),t=K(),n=M("session-token"),[r,s]=y(),[c,o]=y("idle"),i=h()?.orderIdentity?.id;async function u(d){if(o("loading"),s(void 0),!n||!i){o("failed"),s("SUBSCRIPTION_FAILED"),t.notify(new _("Missing sessionToken or orderId"));return}const{data:a}=await e.mutate(ne,{variables:{sessionToken:n,orderId:i,email:d}});if(a){const{__typename:p}=a?.subscribeForShippingUpdates;switch(p){case"SubscribeForShippingUpdatesSuccess":o("subscribed");return;case"SubscribeForShippingUpdatesFailure":o("failed"),s(a?.subscribeForShippingUpdates.code);return;default:o("idle"),t.notify(new _("Undefined subscribeForShippingUpdates type"))}}}return{submitSubscribeForShippingUpdate:u,status:c,error:r}}function ce(){const{purchasingCompany:e}=C(),t=R(),n=T(),r=w();return n&&!r?.value?.email&&!e&&!t}function ue(){const e=f(),t=!!e?.shopAppEligible,n=!!e?.shopAppQrCodeKillswitch;return t&&!n}function de(){const e=v(),t=f();return e&&!!t?.installmentsHighlightEligible}function f(){const e=h();if(e)return{...e.shopAppLinksAndResources}}function le(){const e=h();if(e?.orderIdentity?.id)return Number(B(e.orderIdentity.id))}function re(){const e=P().isActive,{purchasingCompany:t}=C(),n=D(),r=Y(),s=V(),c=f(),S=I().paymentLines.value,{value:i}=$(),{currentDetour:u}=G(),d=Q(),a=!g(x),p=g(N),{shopPayEnabled:O}=q(),{hasSavedCreditCards:E}=W(),b=j(),{value:k}=z(),U=J().searchParams.get(X),F=Z().isStandard(),L=P();return d?.shopPayOptInEnabled===!1||t||!O||n?.__typename==="CustomerProfile"&&r&&(!s||!E)||L.userIdentified||e||U||k||F||p&&c?.shopPayOrder?!1:u?.type==="thankYou"?i?A({paymentLines:i.lines,isIdealEnabledForShopPay:b,isUsdcEnabled:a,isApplePayFlagEnabled:p}):!1:A({paymentLines:S,isIdealEnabledForShopPay:b,isUsdcEnabled:a,isApplePayFlagEnabled:p})}const A=({paymentLines:e,isIdealEnabledForShopPay:t,isUsdcEnabled:n,isApplePayFlagEnabled:r})=>{if(!e?.length||!e[0].method)return!1;const{method:s}=e[0];return s.type==="customOnsite"?!!(s.paymentBrands?.includes("bogus_app_coin")||n&&s.paymentBrands?.includes("usdc")||t&&s.paymentBrands?.includes("ideal")):!!(s.type==="direct"||s.type===ee.CreditCard||t&&s.type==="local"&&s.name==="IDEAL"||r&&s.type==="wallet"&&s.name==="APPLE_PAY")};function oe(){return!!I().shopPayArtifact.value?.optIn}function he(){const e=se(),t=re(),n=oe();return!t||!n?null:l(te,{color:"subdued",children:e("shop_pay.checkout.sign_up_footer.button_footer",{privacy_href:l(m,{target:"_blank",href:"https://www.shopify.com/legal/privacy/app-users",children:e("shop_pay.checkout.sign_up_footer.privacy_policy")}),terms_href:l(m,{target:"_blank",href:"https://shop.app/terms-of-service",children:e("shop_pay.checkout.sign_up_footer.terms_of_service")})})})}export{he as S,pe as a,le as b,f as c,ue as d,de as e,ce as f,re as u};