Loading
function(e,t,n){"use strict";var i=n(620632),r=n(136857),a=n(626584),s=n(949192),l=n(652215);let o=new a.A("OrderActionCreators");class d extends r.Ay{order;constructor(e){super("Order signing failed due to unsatisfied constraints"),this.order=e}}class c extends r.Ay{constructor(){super("Order signed but entitlements not yet visible after polling")}}async function u(e){try{let t=await i.Bo.get({url:l.Rsh.ORDER_ENTITLEMENTS(e),rejectWithError:!1});return null!=t.body?t.body:[]}catch(e){return[]}}let _=[250,500,1e3,1500,2500,4250];n.d(t,{},{FY:d,Ub:async function(e){let t,{orderId:n,expectedRevision:r,loadId:a,purchaseToken:s,gatewayCheckoutContext:o}=e,c={};null!=r&&(c.expected_revision=r),null!=s&&(c.purchase_token=s),null!=o&&(c.gateway_checkout_context=o);try{t=await i.Bo.post({url:l.Rsh.ORDER_SIGN(n),body:c,context:null!=a&&""!==a?{load_id:a}:void 0,rejectWithError:!0})}catch(e){var u;if(e instanceof i.oh&&400===e.status&&null!=(u=e.body)&&"object"==typeof u&&"id"in u&&"status"in u)throw new d(e.body);throw e}if(null==t.body)throw Error("Invalid sign order response");return t.body},Vw:async function(e){let t=await u(e);for(let n of _){if(t.length>0)break;await new Promise(e=>setTimeout(e,n)),t=await u(e)}return t},j2:c,r$:async function(e){try{return(await i.Bo.get({url:l.Rsh.ORDER_GET(e),rejectWithError:!0})).body||null}catch(t){return o.error("failed to fetch order",{error:t,orderId:e}),(0,s.pM)(t,{tags:{source:"OrderActionCreators_getOrder"},extra:{orderId:e}}),null}}})}