Loading
function(e,t,n){"use strict";n.d(t,{_5:()=>S,rV:()=>C});var i=n(627968),r=n(64700),s=n(430993),a=n(834730),o=n(20742),l=n(534479),u=n(977445),d=n(624210),c=n(945810);let _=(0,c.mj)({name:"2026-06-otp-orders-phase-1",kind:"user",defaultConfig:{enabled:!1},variations:{1:{enabled:!0}}}),h=(0,c.mj)({name:"2026-03-orders-dual-write",kind:"user",defaultConfig:{enabled:!1},variations:{1:{enabled:!0}}});var f=n(211287),E=n(739508),p=n(120700),m=n(818348);let g=new Set([p.C.COLLECTIBLES_CHECKOUT,p.C.SLAYER_STOREFRONT_CHECKOUT]);var A=n(480642),I=n(375708);let T=r.createContext(null);function S(){return r.useContext(T)}function N(e){let{renderModalProps:t,children:n}=e,r=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.rQ,{}),(0,i.jsx)(s.c,{children:n})]});return null!=t?(0,i.jsx)(A.Jg,{...t,children:r}):r}function C(e){let{loadId:t,skuIDs:n,applicationId:s,paymentGateway:o,checkoutFlow:c,isGift:p,onOrderCreated:A,renderModalProps:S,children:C}=e,{order:y,isCreateOrderLoading:v,createOrderError:R,shouldBlockOnOrderCreation:O}=function(e){let t,{skuIDs:n,applicationId:i,paymentGateway:s,checkoutFlow:a,isGift:o,loadId:l,onOrderCreated:c}=e,p=h.useConfig({location:"payment_modal"}).enabled,A=f.A.useConfig({location:"payment_modal"}).enabled,I=_.useConfig({location:"payment_modal"}).enabled,T=s===m.kM.VIRTUAL_CURRENCY,S=null!=a&&g.has(a);t=T?A:S?!0!==o&&I:p;let N=T&&A,C=null!=n?n[0]:void 0,[y,v]=(0,r.useState)(null),[R,O]=(0,r.useState)(null),[b,L]=(0,r.useState)(N),D=(0,r.useRef)(!1),P=(0,r.useCallback)(async e=>{let{skuId:t}=e;L(!0);try{let e=null!=i&&(0,u.Fs)(i),n=await (0,d.fS)({skuId:t,paymentGateway:s,loadId:l,testMode:e});v(n),null!=c&&c(n)}catch(n){let e=n instanceof Error?n:Error(String(n));(0,E.gr)(n)||(0,E.pM)(e,{tags:{source:"create_order"},extra:{skuId:t,paymentGateway:String(s),loadId:l}}),O(e)}finally{L(!1)}},[i,s,l,c]);return(0,r.useEffect)(()=>{t&&null!=C&&(null!=y||null!=R||D.current||(D.current=!0,P({skuId:C})))},[C,t,y,P,R]),{order:y,isCreateOrderLoading:b,createOrderError:R,shouldBlockOnOrderCreation:N}}({skuIDs:n,applicationId:s,paymentGateway:o,checkoutFlow:c,isGift:p,loadId:t,onOrderCreated:A});if(O){if(v)return(0,i.jsx)(N,{renderModalProps:S,children:(0,i.jsx)(l.A,{})});else if(null!=R)return(0,i.jsx)(N,{renderModalProps:S,children:(0,i.jsx)(a.E,{variant:"text-md/normal",children:I.intl.string(I.t.F8FvUy)})})}return(0,i.jsx)(T.Provider,{value:y,children:C})}}