Loading
function(r,e,t){t.d(e,{i:()=>E});var n=t(64700),o=t(977445),a=t(624210),i=t(945810);let l=(0,i.mj)({name:"2026-06-otp-orders-phase-1",kind:"user",defaultConfig:{enabled:!1},variations:{1:{enabled:!0}}}),s=(0,i.mj)({name:"2026-03-orders-dual-write",kind:"user",defaultConfig:{enabled:!1},variations:{1:{enabled:!0}}});var u=t(211287),d=t(739508),c=t(120700),p=t(818348);let h=new Set([c.C.COLLECTIBLES_CHECKOUT,c.C.SLAYER_STOREFRONT_CHECKOUT]);function E(r){let e,{skuIDs:t,applicationId:i,paymentGateway:c,checkoutFlow:E,isGift:g,loadId:f,onOrderCreated:y}=r,C=s.useConfig({location:"payment_modal"}).enabled,m=u.A.useConfig({location:"payment_modal"}).enabled,_=l.useConfig({location:"payment_modal"}).enabled,S=c===p.kM.VIRTUAL_CURRENCY,v=null!=E&&h.has(E);e=S?m:v?!0!==g&&_:C;let R=S&&m,w=null!=t?t[0]:void 0,[b,x]=(0,n.useState)(null),[A,T]=(0,n.useState)(null),[I,B]=(0,n.useState)(R),k=(0,n.useRef)(!1),O=(0,n.useCallback)(async r=>{let{skuId:e}=r;B(!0);try{let r=null!=i&&(0,o.Fs)(i),t=await (0,a.fS)({skuId:e,paymentGateway:c,loadId:f,testMode:r});x(t),null!=y&&y(t)}catch(t){let r=t instanceof Error?t:Error(String(t));(0,d.gr)(t)||(0,d.pM)(r,{tags:{source:"create_order"},extra:{skuId:e,paymentGateway:String(c),loadId:f}}),T(r)}finally{B(!1)}},[i,c,f,y]);return(0,n.useEffect)(()=>{e&&null!=w&&(null!=b||null!=A||k.current||(k.current=!0,O({skuId:w})))},[w,e,b,O,A]),{order:b,isCreateOrderLoading:I,createOrderError:A,shouldBlockOnOrderCreation:R}}}