import{hH as m,su as H,bu as A,sv as x,sw as B,fi as M,aV as K,bn as D,g as V,s as Y,ah as S,el as g,bE as $,fX as z,b3 as G,z as N,fy as q,b_ as Q,k$ as W,bN as P,hj as j,iV as J,aR as X,sx as Z,e8 as ee,sy as se,kl as re,sz as ne,ep as te,by as ae,c as u,a as n,k1 as E,y as F,L as U,I as k,l as f}from"./app.BTSv6d-3.js";const ie={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 C extends Error{name="SubscribeForShippingUpdateError"}function le(){const e=D(),r=V(),t=Y("session-token"),[a,s]=S(),[d,i]=S("idle"),c=m()?.orderIdentity?.id;async function l(h){if(i("loading"),s(void 0),!t||!c){i("failed"),s("SUBSCRIPTION_FAILED"),r.notify(new C("Missing sessionToken or orderId"));return}const{data:o}=await e.mutate(ie,{variables:{sessionToken:t,orderId:c,email:h}});if(o){const{__typename:p}=o?.subscribeForShippingUpdates;switch(p){case"SubscribeForShippingUpdatesSuccess":i("subscribed");return;case"SubscribeForShippingUpdatesFailure":i("failed"),s(o?.subscribeForShippingUpdates.code);return;default:i("idle"),r.notify(new C("Undefined subscribeForShippingUpdates type"))}}}return{submitSubscribeForShippingUpdate:l,status:d,error:a}}function he(){const{purchasingCompany:e}=A(),r=x(),t=B(),a=M();return t&&!a?.value?.email&&!e&&!r}function me(){const e=b(),r=!!e?.shopAppEligible,t=!!e?.shopAppQrCodeKillswitch;return r&&!t}function fe(){const e=H(),r=b();return e&&!!r?.installmentsHighlightEligible}function b(){const e=m();if(e)return{...e.shopAppLinksAndResources}}function be(){const e=m();if(e?.orderIdentity?.id)return Number(K(e.orderIdentity.id))}function ye(){const e=g().isActive,{purchasingCompany:r}=A(),t=$(),a=z(),s=G(),d=b(),y=N().paymentLines.value,{value:c}=q(),{currentDetour:l}=Q(),h=W(),o=!P(j),p=P(J),{shopPayEnabled:O}=X(),{hasSavedCreditCards:L}=Z(),_=ee(),{value:v}=se(),T=re().searchParams.get(ne),w=te().isStandard(),R=g();return h?.shopPayOptInEnabled===!1||r||!O||t?.__typename==="CustomerProfile"&&a&&(!s||!L)||R.userIdentified||e||T||v||w||p&&d?.shopPayOrder?!1:l?.type==="thankYou"?c?I({paymentLines:c.lines,isIdealEnabledForShopPay:_,isUsdcEnabled:o,isApplePayFlagEnabled:p}):!1:I({paymentLines:y,isIdealEnabledForShopPay:_,isUsdcEnabled:o,isApplePayFlagEnabled:p})}const I=({paymentLines:e,isIdealEnabledForShopPay:r,isUsdcEnabled:t,isApplePayFlagEnabled:a})=>{if(!e?.length||!e[0].method)return!1;const{method:s}=e[0];return s.type==="customOnsite"?!!(s.paymentBrands?.includes("bogus_app_coin")||t&&s.paymentBrands?.includes("usdc")||r&&s.paymentBrands?.includes("ideal")):!!(s.type==="direct"||s.type===ae.CreditCard||r&&s.type==="local"&&s.name==="IDEAL"||a&&s.type==="wallet"&&s.name==="APPLE_PAY")};function oe(){const e=u();return n(F,{size:"small",color:"subdued",children:n(E,{children:e("shop_pay_remember_me.terms_and_privacy_html",{privacy_href:n(pe,{}),terms_href:n(ce,{})})})})}function ce(){const e=u();return n(f,{children:n(U,{target:"_blank",href:"https://shop.app/terms-of-service",tone:"monochrome",accessibilityLabel:e("shop_pay_remember_me.new_window_disclaimer"),children:[e("shop_pay_remember_me.terms_of_service"),n(k,{type:"external",size:"small",display:"inline"})]})})}function pe(){const e=u();return n(f,{children:n(U,{target:"_blank",href:"https://www.shopify.com/legal/privacy/app-users",tone:"monochrome",accessibilityLabel:e("shop_pay_remember_me.new_window_disclaimer"),children:[e("shop_pay_remember_me.privacy_policy"),n(k,{type:"external",size:"small",display:"inline"})]})})}function _e({field:e="phone",link:r}){const t=u();return n(f,{children:[n(F,{color:"subdued",children:n(E,{children:[t(e==="phone"?"shop_pay_remember_me.description_html":"shop_pay_remember_me.email_description_html")," ",r]})}),n(oe,{})]})}export{_e as R,le as a,be as b,b as c,me as d,fe as e,he as f,ye as u};