SCUTPreviewCheckout.react",["fbt","ix","AtomicToastManagerHooks","Clipboard","GeoButton.react","GeoFlexbox.react","GeoSpinner.react","RelayHooks","SCUTPreviewCheckoutQuery.graphql","SCUTV2Context","URI","fbicon","geoMargin","react"],(function(t,n,r,o,a,i,l,s,u){"use strict";var e,c,d,m=d||(d=o("react")),p=d,_=p.Suspense,f=p.useEffect,g=p.useState,h=e!==void 0?e:e=n("SCUTPreviewCheckoutQuery.graphql");function y(e){var t=e.cmsID;return m.jsx(C,{cmsID:t})}y.displayName=y.name+" [from "+i.id+"]";function C(e){var t=e.cmsID;return m.jsxs(r("GeoFlexbox.react"),{direction:"row",columnGap:8,xstyle:r("geoMargin").top12,children:[m.jsx(v,{cmsID:t}),m.jsx(b,{cmsID:t})]})}C.displayName=C.name+" [from "+i.id+"]";function b(e){var t=e.cmsID,n=g(!1),a=n[0],l=n[1],u=o("SCUTV2Context").useSCUTV2Context(),c=u.checkoutURL,d=u.selectedProducts,p=c.length===0||d.filter(function(e){return e.selectedItem!=null}).length===0||a;return m.jsxs(_,{fallback:m.jsx(r("GeoSpinner.react"),{center:!0,loggingName:i.id}),children:[m.jsx(r("GeoButton.react"),{isDisabled:p,isLoading:a,label:s._(/*BTDS*/"Copy URL"),onClick:function(){return l(!0)}}),a?m.jsx(S,{cmsID:t,setIsURLGenerationInProgress:l,shouldCopyToClipboard:!0,shouldOpenNewTab:!1}):null]})}b.displayName=b.name+" [from "+i.id+"]";function v(e){var t=e.cmsID,n=g(!1),a=n[0],l=n[1],c=o("SCUTV2Context").useSCUTV2Context(),d=c.checkoutURL,p=c.selectedProducts,f=c.setHasPreviewedCheckoutURL,h=c.setHasCartInputChanged,y=d.length===0||p.filter(function(e){return e.selectedItem!=null}).length===0||a;return m.jsxs(_,{fallback:m.jsx(r("GeoSpinner.react"),{center:!0,loggingName:i.id}),children:[m.jsx(r("GeoButton.react"),{isDisabled:y,isLoading:a,icon:o("fbicon")._(u("509932"),16),label:s._(/*BTDS*/"Preview checkout"),onClick:function(){l(!0),f(!0),h(!1)}}),a?m.jsx(S,{cmsID:t,setIsURLGenerationInProgress:l,shouldCopyToClipboard:!1,shouldOpenNewTab:!0}):null]})}v.displayName=v.name+" [from "+i.id+"]";function S(e){var t=e.cmsID,n=e.setIsURLGenerationInProgress,a=e.shouldCopyToClipboard,i=e.shouldOpenNewTab,l=o("SCUTV2Context").useSCUTV2Context(),u=l.checkoutURL,d=l.selectedProducts,m=l.promoCode,p=o("AtomicToastManagerHooks").useAtomicToastManagerActions(),_=p.addToast,g=o("RelayHooks").useLazyLoadQuery(h,{cmsID:t,products:d.filter(function(e){return e.selectedItem&&e.quantity}).map(function(e){var t=e.selectedItem?e.selectedItem.getUniqueID():null;return t==null?null:{retailer_id:t,quantity:e.quantity}}).filter(Boolean),checkoutURLBase:u,checkoutURLFormat:"STATIC_QUERY_PARAMS",promoCode:m}),y=g.fetch__CommerceMerchantSettings.checkout_url_for_cart_contents_with_qr_code.checkout_url;return f(function(){a?(o("Clipboard").copy(y.split("&fbclid")[0]),_({status:"success",title:s._(/*BTDS*/"URL copied")})):i&&(c||(c=r("URI"))).goURIOnNewWindow(y),n(!1)},[y,n,a,i,_]),null}S.displayName=S.name+" [from "+i.id+"]",l.default=y}),226);
-----
SCUTPreviewCheckoutQuery.graphql",["SCUTPreviewCheckoutQuery_facebookRelayOperation"],(function(t,n,r,o,a,i){"use strict";var e=(function(){var e={defaultValue:null,kind:"LocalArgument",name:"checkoutURLBase"},t={defaultValue:null,kind:"LocalArgument",name:"checkoutURLFormat"},r={defaultValue:null,kind:"LocalArgument",name:"cmsID"},o={defaultValue:null,kind:"LocalArgument",name:"products"},a={defaultValue:null,kind:"LocalArgument",name:"promoCode"},i=[{kind:"Variable",name:"id",variableName:"cmsID"}],l=[{kind:"Variable",name:"checkout_base_url",variableName:"checkoutURLBase"},{kind:"Variable",name:"checkout_url_format",variableName:"checkoutURLFormat"},{kind:"Variable",name:"products",variableName:"products"},{kind:"Variable",name:"promo_code",variableName:"promoCode"}],s={alias:null,args:null,kind:"ScalarField",name:"checkout_url",storageKey:null};return{fragment:{argumentDefinitions:[e,t,r,o,a],kind:"Fragment",metadata:null,name:"SCUTPreviewCheckoutQuery",selections:[{kind:"RequiredField",field:{alias:null,args:i,concreteType:"CommerceMerchantSettings",kind:"LinkedField",name:"fetch__CommerceMerchantSettings",plural:!1,selections:[{kind:"RequiredField",field:{alias:null,args:l,concreteType:"XFBCheckoutURLWithQRCode",kind:"LinkedField",name:"checkout_url_for_cart_contents_with_qr_code",plural:!1,selections:[{kind:"RequiredField",field:s,action:"THROW",path:"fetch__CommerceMerchantSettings.checkout_url_for_cart_contents_with_qr_code.checkout_url"}],storageKey:null},action:"THROW",path:"fetch__CommerceMerchantSettings.checkout_url_for_cart_contents_with_qr_code"}],storageKey:null},action:"THROW",path:"fetch__CommerceMerchantSettings"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[r,o,e,t,a],kind:"Operation",name:"SCUTPreviewCheckoutQuery",selections:[{alias:null,args:i,concreteType:"CommerceMerchantSettings",kind:"LinkedField",name:"fetch__CommerceMerchantSettings",plural:!1,selections:[{alias:null,args:l,concreteType:"XFBCheckoutURLWithQRCode",kind:"LinkedField",name:"checkout_url_for_cart_contents_with_qr_code",plural:!1,selections:[s],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{id:n("SCUTPreviewCheckoutQuery_facebookRelayOperation"),metadata:{},name:"SCUTPreviewCheckoutQuery",operationKind:"query",text:null}}})();a.exports=e}),null);
-----
SCUTPreviewCheckoutQuery_facebookRelayOperation",[],(function(t,n,r,o,a,i){a.exports="24681345078224132"}),null);
-----