Module 834521

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