@billgangcom/theme-lib 1.123.6 → 1.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/{builder-DJQh1c1e.js → builder-CAyJ72db.js} +1169 -1169
  2. package/dist/builder-CnQFO7Gq.cjs +43 -0
  3. package/dist/{builder-components-CpOz_SUG.js → builder-components-D-YCuD-D.js} +337 -332
  4. package/dist/{builder-components-Bgg9F62l.cjs → builder-components-VjghhiN2.cjs} +2 -2
  5. package/dist/builder.cjs.js +1 -1
  6. package/dist/builder.es.js +129 -126
  7. package/dist/{charge-DywF6LWF.cjs → charge-BSlqfF8j.cjs} +1 -1
  8. package/dist/{charge-z48cLi-k.js → charge-MZi_xfIe.js} +6 -6
  9. package/dist/{checkout-M3jKk4q6.js → checkout-DP0YAiOB.js} +5 -5
  10. package/dist/{checkout-DTwC9CX7.cjs → checkout-X7XMD-OB.cjs} +1 -1
  11. package/dist/exports.cjs.js +1 -1
  12. package/dist/exports.es.js +6 -6
  13. package/dist/{index-BSrpJXEj.cjs → index-3mJCQJiU.cjs} +1 -1
  14. package/dist/{index-DD71JxVQ.cjs → index-7zEe4e-T.cjs} +1 -1
  15. package/dist/{index-DHPgQ7DA.js → index-BQ-OGjfc.js} +5 -5
  16. package/dist/{index-DO-nVcAG.cjs → index-BmIXPuN8.cjs} +1 -1
  17. package/dist/{index-BTjeATna.js → index-Bs1RNOaG.js} +1 -1
  18. package/dist/{index-CloS3B1y.js → index-BtMsyng7.js} +5 -5
  19. package/dist/{index-CYANU9EG.js → index-CS18NKWD.js} +5 -5
  20. package/dist/{index-CcM2U332.js → index-CnpiXLcN.js} +2 -2
  21. package/dist/{index-Bidor65E.cjs → index-D2VapYho.cjs} +1 -1
  22. package/dist/{index-D9rOdRq1.cjs → index-DEPx2Mhc.cjs} +1 -1
  23. package/dist/{index-CElp6y2B.js → index-DEdog3Tq.js} +5 -5
  24. package/dist/{index-9XqQn8Cq.cjs → index-DcaIpOYs.cjs} +1 -1
  25. package/dist/index.cjs.js +1 -1
  26. package/dist/index.es.js +6 -6
  27. package/dist/{order-2fi-ASUJ.cjs → order-CmpxNhN2.cjs} +1 -1
  28. package/dist/{order-P0fQ9MtH.js → order-JpAF7zFI.js} +5 -5
  29. package/dist/src/builder/constants/block-icons.d.ts +96 -16
  30. package/dist/src/ui/ItemsSettings/popup.d.ts +9 -2
  31. package/dist/src/ui/Select/utils/index.d.ts +1 -1
  32. package/dist/style.css +1 -1
  33. package/dist/{subscription-S3Q0J-LT.js → subscription-2jqv9XIK.js} +5 -5
  34. package/dist/{subscription-BXILybzC.cjs → subscription-CFSduwOC.cjs} +1 -1
  35. package/dist/{ticket-D67XjuXI.cjs → ticket-CYgJNT8X.cjs} +1 -1
  36. package/dist/{ticket-CF6WDvC5.js → ticket-CfkLSm70.js} +5 -5
  37. package/dist/{top-up-DkwIdCFZ.js → top-up-DahJqmZg.js} +5 -5
  38. package/dist/{top-up-Cl5gOjYY.cjs → top-up-odB3Qytv.cjs} +1 -1
  39. package/dist/ui-components-BeqAtEXu.cjs +1 -0
  40. package/dist/{ui-components-CNP0TL7h.js → ui-components-Bugw9fsk.js} +778 -772
  41. package/dist/ui.cjs.js +1 -1
  42. package/dist/ui.es.js +1 -1
  43. package/dist/{validation-CFXeO04y.cjs → validation-1RuE4Br5.cjs} +1 -1
  44. package/dist/{validation-C8mTX1VQ.js → validation-CLJwGwJ2.js} +5 -5
  45. package/package.json +1 -1
  46. package/dist/builder--8Ry7cQ4.cjs +0 -43
  47. package/dist/ui-components-DnpGt0Lr.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("./builder--8Ry7cQ4.cjs"),m=require("./ticket-D67XjuXI.cjs"),n=require("react"),v=require("./charge-DywF6LWF.cjs"),_=require("./ui-components-DnpGt0Lr.cjs"),e=require("@phosphor-icons/react"),Q=({children:r,shopDomain:u,shopId:d,shopPassword:h,shopLogo:g})=>{const{setShopDomain:x,setShopId:j,setShopPassword:P,setShopTerms:p,setShopPrivacyPolicy:l,setShopRefundPolicy:f,setShopLogo:y}=i.useStorefrontStore();return n.useLayoutEffect(()=>{const s=async()=>{const{data:a}=await v.fetchTerms();p(a)},S=async()=>{const{data:a}=await v.fetchPrivacyPolicy();l(a)},A=async()=>{const{data:a}=await v.fetchRefundPolicy();f(a)};x(u),j(d),h&&P(h),g&&y(g),s(),S(),A()},[u,d,h]),t.jsx(t.Fragment,{children:r})},X="_wrapper_1xuz3_18",D={wrapper:X};function J(){_.registerIcons({X:e.XIcon,Plus:e.PlusIcon,Minus:e.MinusIcon,Check:e.CheckIcon,Clock:e.ClockIcon,Info:e.InfoIcon,Copy:e.CopyIcon,Trash:e.TrashIcon,Sliders:e.SlidersIcon,Image:e.ImageIcon,List:e.ListIcon,Handbag:e.HandbagIcon,Bag:e.BagIcon,Eye:e.EyeIcon,Crown:e.CrownIcon,ArrowUp:e.ArrowUpIcon,ArrowDown:e.ArrowDownIcon,Confetti:e.ConfettiIcon,ArrowLeft:e.ArrowLeftIcon,ArrowRight:e.ArrowRightIcon,ArrowLineUpRight:e.ArrowLineUpRightIcon,ArrowUpRight:e.ArrowUpRightIcon,ArrowUUpLeft:e.ArrowUUpLeftIcon,ArrowUUpRight:e.ArrowUUpRightIcon,CaretRight:e.CaretRightIcon,CaretDown:e.CaretDownIcon,CaretUp:e.CaretUpIcon,CaretLeft:e.CaretLeftIcon,MagnifyingGlass:e.MagnifyingGlassIcon,MagnifyingGlassMinus:e.MagnifyingGlassMinusIcon,ArrowLineDown:e.ArrowLineDownIcon,Selection:e.SelectionIcon,CloudArrowUpIcon:e.CloudArrowUpIcon,ArrowsHorizontal:e.ArrowsHorizontalIcon,ArrowsVertical:e.ArrowsVerticalIcon,CheckCircle:e.CheckCircleIcon,XCircle:e.XCircleIcon,Star:e.StarIcon,Fire:e.FireIcon,Lightning:e.LightningIcon,AlignCenterHorizontal:e.AlignCenterHorizontalIcon,File:e.FileIcon,FileText:e.FileTextIcon,BookOpen:e.BookOpenIcon,DownloadSimple:e.DownloadSimpleIcon,DiscordLogo:e.DiscordLogoIcon,TelegramLogo:e.TelegramLogoIcon,SignOut:e.SignOutIcon,Wallet:e.WalletIcon,PaperPlaneRight:e.PaperPlaneRightIcon,ChatsTeardrop:e.ChatsTeardropIcon,DotsSixVertical:e.DotsSixVerticalIcon,Share:e.ShareIcon,Shield:e.ShieldIcon,ShieldCheck:e.ShieldCheckIcon,FileCloud:e.FileCloudIcon,Lock:e.LockIcon,Heart:e.HeartIcon,User:e.UserIcon,Calendar:e.CalendarIcon,Smiley:e.SmileyIcon,Globe:e.GlobeIcon,House:e.HouseIcon,HouseSimple:e.HouseSimpleIcon,CurrencyCircleDollar:e.CurrencyCircleDollarIcon,Medal:e.MedalIcon,CalendarCheck:e.CalendarCheckIcon,Question:e.QuestionIcon,Warning:e.WarningIcon,WarningDiamond:e.WarningDiamondIcon,TreeStructure:e.TreeStructureIcon,Palette:e.PaletteIcon,Gear:e.GearIcon,PaintBrushBroad:e.PaintBrushBroadIcon,TextAa:e.TextAaIcon,TextB:e.TextBIcon,TextH:e.TextHIcon,CornersOut:e.CornersOutIcon,ArrowSquareIn:e.ArrowSquareInIcon,Textbox:e.TextboxIcon,SquaresFour:e.SquaresFourIcon,SealQuestion:e.SealQuestionIcon,ChatCentered:e.ChatCenteredIcon,Ticket:e.TicketIcon,UserCircleGear:e.UserCircleGearIcon,Desktop:e.DesktopIcon,DeviceTabletCamera:e.DeviceTabletCameraIcon,DeviceMobileCamera:e.DeviceMobileCameraIcon,Cards:e.CardsIcon,PushPin:e.PushPinIcon,TextAlignLeft:e.TextAlignLeftIcon,TextAlignRight:e.TextAlignRightIcon,TextAlignCenter:e.TextAlignCenterIcon,AlignLeft:e.AlignLeftIcon,AlignRight:e.AlignRightIcon,AlignTop:e.AlignTopIcon,AlignBottom:e.AlignBottomIcon,TextItalic:e.TextItalicIcon,TextStrikethrough:e.TextStrikethroughIcon,TextUnderline:e.TextUnderlineIcon})}const $=n.lazy(()=>Promise.resolve().then(()=>require("./builder--8Ry7cQ4.cjs")).then(r=>r.index).then(r=>({default:r.BuilderPage}))),K=n.lazy(()=>Promise.resolve().then(()=>require("./index-9XqQn8Cq.cjs")).then(r=>({default:r.ErrorPage}))),Y=n.lazy(()=>Promise.resolve().then(()=>require("./index-DO-nVcAG.cjs")).then(r=>({default:r.ActivePage}))),Z=n.lazy(()=>Promise.resolve().then(()=>require("./validation-CFXeO04y.cjs")).then(r=>({default:r.ValidationPage}))),ee=n.lazy(()=>Promise.resolve().then(()=>require("./index-D9rOdRq1.cjs")).then(r=>({default:r.WrapperPage}))),te=n.lazy(()=>Promise.resolve().then(()=>require("./index-DD71JxVQ.cjs")).then(r=>({default:r.RouterErrorPage}))),c=n.lazy(()=>Promise.resolve().then(()=>require("./index-BSrpJXEj.cjs")).then(r=>({default:r.DynamicErrorPage}))),re=n.lazy(()=>Promise.resolve().then(()=>require("./checkout-DTwC9CX7.cjs")).then(r=>({default:r.Checkout}))),ne=n.lazy(()=>Promise.resolve().then(()=>require("./charge-DywF6LWF.cjs")).then(r=>r.index$1).then(r=>({default:r.ChargePage}))),oe=n.lazy(()=>Promise.resolve().then(()=>require("./ticket-D67XjuXI.cjs")).then(r=>r.index).then(r=>({default:r.TicketItem}))),se=n.lazy(()=>Promise.resolve().then(()=>require("./subscription-BXILybzC.cjs")).then(r=>r.index).then(r=>({default:r.Subscription}))),ce=n.lazy(()=>Promise.resolve().then(()=>require("./top-up-Cl5gOjYY.cjs")).then(r=>({default:r.TopUpBalance}))),ie=n.lazy(()=>Promise.resolve().then(()=>require("./order-2fi-ASUJ.cjs")).then(r=>r.index).then(r=>({default:r.OrderPage}))),ae=n.lazy(()=>Promise.resolve().then(()=>require("./index-Bidor65E.cjs")).then(r=>({default:r.TermsPage}))),le=n.lazy(()=>Promise.resolve().then(()=>require("./charge-DywF6LWF.cjs")).then(r=>r.index).then(r=>({default:r.CustomerDashboard}))),U=n.lazy(()=>Promise.resolve().then(()=>require("./charge-DywF6LWF.cjs")).then(r=>r.recapcha).then(r=>({default:r.ReCaptchaProvider}))),ue=()=>null,o=({children:r})=>t.jsx(n.Suspense,{fallback:t.jsx(ue,{}),children:r}),B=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-Bgg9F62l.cjs")).then(r=>r.index).then(r=>({default:r.RenderAnnouncement}))),L=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-Bgg9F62l.cjs")).then(r=>r.index).then(r=>({default:r.RenderFooter}))),R=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-Bgg9F62l.cjs")).then(r=>r.index).then(r=>({default:r.RenderHeader}))),de=r=>{var q;const{blocks:u,settings:d,header:h,footer:g,announcement:x,routes:j=[],shopLogo:P,apiURLs:p,isAntistock:l=!1}=r,[f,y]=n.useState(null),{general:s,setIsAntistock:S}=i.useGeneralStore(),{setApiUrls:A}=i.useApiStore(),a=((q=s==null?void 0:s.info)==null?void 0:q.customerAccountSettings)??"OPTIONAL",z=a==="DISABLED",{setBlocks:H,setSourceBlocks:F,setHeader:O,setFooter:M,setAnnouncement:G,setSettings:W}=i.useBlocksStore(),{themeSettings:C}=i.useThemeSettingsStore(),{settings:T,setSettings:V}=i.useSettingsStore(),w=i.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,N=localStorage.getItem("shopPassword"),b=localStorage.getItem("shopId")||"";return n.useEffect(()=>{S(l)},[l,S]),n.useEffect(()=>{!b&&(s!=null&&s.info.id)&&localStorage.setItem("shopId",s==null?void 0:s.info.id)},[s]),n.useEffect(()=>{!w&&!l&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io")},[w]),n.useEffect(()=>{if(C&&T){const I=m.generateDynamicStyles(C,T);m.loadCustomFonts(),m.setupDynamicFonts(C),m.injectStylesToDOM(I)}},[C,JSON.stringify(T),window.location.hostname]),n.useEffect(()=>{const k=new d().blockSettings;V(k)},[]),n.useEffect(()=>{J()},[]),n.useLayoutEffect(()=>{const I={};Object.keys(u).map(E=>{I[E]=u[E]}),F(I),H(I),O(h),M(g),G(x),W(d),p&&A(p);const k=i.createBrowserRouter([{element:t.jsx(Q,{shopDomain:w,shopId:b,shopPassword:N||void 0,shopLogo:P,children:t.jsx(U,{children:t.jsx(ee,{children:t.jsx(i.Outlet,{})})})}),errorElement:t.jsx(o,{children:t.jsx(te,{})}),children:[{path:"/admin/builder/*",element:t.jsx(o,{children:t.jsx(Y,{children:t.jsx($,{blocks:u,settings:d,header:h,footer:g,announcement:x})})}),errorElement:t.jsx(o,{children:t.jsx(K,{})})},...j,{path:"/checkout",element:t.jsx(o,{children:t.jsx(re,{})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:t.jsx(o,{children:t.jsx(ce,{})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:t.jsx(o,{children:t.jsx(ne,{})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:t.jsx(o,{children:t.jsx(ie,{})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:t.jsx(o,{children:t.jsx(se,{})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Subscriptions",!0)},...z?[]:[{path:l?"/account":"/customer-dash",element:t.jsx(o,{children:t.jsxs("div",{className:D.wrapper,children:[t.jsx(B,{}),t.jsx(R,{}),t.jsx("div",{style:{flex:"1 1 auto"},children:t.jsx(le,{})}),t.jsx(L,{})]})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title=l?"Account":"Customer Dashboard",!0)}],{path:"/validation",element:t.jsx(o,{children:t.jsx(Z,{})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:t.jsx(o,{children:t.jsxs("div",{className:D.wrapper,children:[t.jsx(R,{}),t.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:t.jsx(U,{children:t.jsx(oe,{})})}),t.jsx(L,{})]})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Ticket",!0)},{path:"/terms",element:t.jsx(o,{children:t.jsxs("div",{className:D.wrapper,children:[t.jsx(B,{}),t.jsx(R,{}),t.jsx("div",{style:{flex:1,width:"100%"},children:t.jsx(ae,{})}),t.jsx(L,{})]})}),errorElement:t.jsx(o,{children:t.jsx(c,{})}),loader:()=>(document.title="Terms of Service",!0)},{path:"*",element:t.jsx(m.DynamicRouteWrapper,{}),errorElement:t.jsx(o,{children:t.jsx(c,{})})}]}]);y(k)},[s,a]),t.jsx(n.Suspense,{fallback:null,children:f&&t.jsx(i.RouterProvider,{router:f})})};exports.App=de;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("./builder-CnQFO7Gq.cjs"),m=require("./ticket-CYgJNT8X.cjs"),o=require("react"),D=require("./charge-BSlqfF8j.cjs"),_=require("./ui-components-BeqAtEXu.cjs"),e=require("@phosphor-icons/react"),Q=({children:r,shopDomain:d,shopId:h,shopPassword:g,shopLogo:I})=>{const{setShopDomain:x,setShopId:P,setShopPassword:y,setShopTerms:p,setShopPrivacyPolicy:l,setShopRefundPolicy:f,setShopLogo:A}=i.useStorefrontStore();return o.useLayoutEffect(()=>{const s=async()=>{const{data:u}=await D.fetchTerms();p(u)},C=async()=>{const{data:u}=await D.fetchPrivacyPolicy();l(u)},w=async()=>{const{data:u}=await D.fetchRefundPolicy();f(u)};x(d),P(h),g&&y(g),I&&A(I),s(),C(),w()},[d,h,g]),t.jsx(t.Fragment,{children:r})},X="_wrapper_1xuz3_18",L={wrapper:X};function J(){_.registerIcons({X:e.XIcon,Plus:e.PlusIcon,Minus:e.MinusIcon,Check:e.CheckIcon,Clock:e.ClockIcon,Info:e.InfoIcon,Copy:e.CopyIcon,Trash:e.TrashIcon,Sliders:e.SlidersIcon,Image:e.ImageIcon,List:e.ListIcon,Handbag:e.HandbagIcon,Bag:e.BagIcon,Eye:e.EyeIcon,Crown:e.CrownIcon,ArrowUp:e.ArrowUpIcon,ArrowDown:e.ArrowDownIcon,Confetti:e.ConfettiIcon,ArrowLeft:e.ArrowLeftIcon,ArrowRight:e.ArrowRightIcon,ArrowLineUpRight:e.ArrowLineUpRightIcon,ArrowUpRight:e.ArrowUpRightIcon,ArrowUUpLeft:e.ArrowUUpLeftIcon,ArrowUUpRight:e.ArrowUUpRightIcon,CaretRight:e.CaretRightIcon,CaretDown:e.CaretDownIcon,CaretUp:e.CaretUpIcon,CaretLeft:e.CaretLeftIcon,MagnifyingGlass:e.MagnifyingGlassIcon,MagnifyingGlassMinus:e.MagnifyingGlassMinusIcon,ArrowLineDown:e.ArrowLineDownIcon,Selection:e.SelectionIcon,CloudArrowUpIcon:e.CloudArrowUpIcon,ArrowsHorizontal:e.ArrowsHorizontalIcon,ArrowsVertical:e.ArrowsVerticalIcon,CheckCircle:e.CheckCircleIcon,XCircle:e.XCircleIcon,Star:e.StarIcon,Fire:e.FireIcon,Lightning:e.LightningIcon,AlignCenterHorizontal:e.AlignCenterHorizontalIcon,File:e.FileIcon,FileText:e.FileTextIcon,BookOpen:e.BookOpenIcon,DownloadSimple:e.DownloadSimpleIcon,DiscordLogo:e.DiscordLogoIcon,TelegramLogo:e.TelegramLogoIcon,SignOut:e.SignOutIcon,Wallet:e.WalletIcon,PaperPlaneRight:e.PaperPlaneRightIcon,ChatsTeardrop:e.ChatsTeardropIcon,DotsSixVertical:e.DotsSixVerticalIcon,Share:e.ShareIcon,Shield:e.ShieldIcon,ShieldCheck:e.ShieldCheckIcon,FileCloud:e.FileCloudIcon,Lock:e.LockIcon,Heart:e.HeartIcon,User:e.UserIcon,Calendar:e.CalendarIcon,Smiley:e.SmileyIcon,Globe:e.GlobeIcon,House:e.HouseIcon,HouseSimple:e.HouseSimpleIcon,CurrencyCircleDollar:e.CurrencyCircleDollarIcon,Medal:e.MedalIcon,CalendarCheck:e.CalendarCheckIcon,Question:e.QuestionIcon,Warning:e.WarningIcon,WarningDiamond:e.WarningDiamondIcon,TreeStructure:e.TreeStructureIcon,Palette:e.PaletteIcon,Gear:e.GearIcon,PaintBrushBroad:e.PaintBrushBroadIcon,TextAa:e.TextAaIcon,TextB:e.TextBIcon,TextH:e.TextHIcon,CornersOut:e.CornersOutIcon,ArrowSquareIn:e.ArrowSquareInIcon,Textbox:e.TextboxIcon,SquaresFour:e.SquaresFourIcon,SealQuestion:e.SealQuestionIcon,ChatCentered:e.ChatCenteredIcon,Ticket:e.TicketIcon,UserCircleGear:e.UserCircleGearIcon,Desktop:e.DesktopIcon,DeviceTabletCamera:e.DeviceTabletCameraIcon,DeviceMobileCamera:e.DeviceMobileCameraIcon,Cards:e.CardsIcon,PushPin:e.PushPinIcon,TextAlignLeft:e.TextAlignLeftIcon,TextAlignRight:e.TextAlignRightIcon,TextAlignCenter:e.TextAlignCenterIcon,AlignLeft:e.AlignLeftIcon,AlignRight:e.AlignRightIcon,AlignTop:e.AlignTopIcon,AlignBottom:e.AlignBottomIcon,TextItalic:e.TextItalicIcon,TextStrikethrough:e.TextStrikethroughIcon,TextUnderline:e.TextUnderlineIcon})}const $=o.lazy(()=>Promise.resolve().then(()=>require("./builder-CnQFO7Gq.cjs")).then(r=>r.index).then(r=>({default:r.BuilderPage}))),K=o.lazy(()=>Promise.resolve().then(()=>require("./index-DcaIpOYs.cjs")).then(r=>({default:r.ErrorPage}))),Y=o.lazy(()=>Promise.resolve().then(()=>require("./index-BmIXPuN8.cjs")).then(r=>({default:r.ActivePage}))),Z=o.lazy(()=>Promise.resolve().then(()=>require("./validation-1RuE4Br5.cjs")).then(r=>({default:r.ValidationPage}))),ee=o.lazy(()=>Promise.resolve().then(()=>require("./index-DEPx2Mhc.cjs")).then(r=>({default:r.WrapperPage}))),te=o.lazy(()=>Promise.resolve().then(()=>require("./index-7zEe4e-T.cjs")).then(r=>({default:r.RouterErrorPage}))),c=o.lazy(()=>Promise.resolve().then(()=>require("./index-3mJCQJiU.cjs")).then(r=>({default:r.DynamicErrorPage}))),re=o.lazy(()=>Promise.resolve().then(()=>require("./checkout-X7XMD-OB.cjs")).then(r=>({default:r.Checkout}))),oe=o.lazy(()=>Promise.resolve().then(()=>require("./charge-BSlqfF8j.cjs")).then(r=>r.index$1).then(r=>({default:r.ChargePage}))),ne=o.lazy(()=>Promise.resolve().then(()=>require("./ticket-CYgJNT8X.cjs")).then(r=>r.index).then(r=>({default:r.TicketItem}))),se=o.lazy(()=>Promise.resolve().then(()=>require("./subscription-CFSduwOC.cjs")).then(r=>r.index).then(r=>({default:r.Subscription}))),ce=o.lazy(()=>Promise.resolve().then(()=>require("./top-up-odB3Qytv.cjs")).then(r=>({default:r.TopUpBalance}))),ie=o.lazy(()=>Promise.resolve().then(()=>require("./order-CmpxNhN2.cjs")).then(r=>r.index).then(r=>({default:r.OrderPage}))),ae=o.lazy(()=>Promise.resolve().then(()=>require("./index-D2VapYho.cjs")).then(r=>({default:r.TermsPage}))),le=o.lazy(()=>Promise.resolve().then(()=>require("./charge-BSlqfF8j.cjs")).then(r=>r.index).then(r=>({default:r.CustomerDashboard}))),U=o.lazy(()=>Promise.resolve().then(()=>require("./charge-BSlqfF8j.cjs")).then(r=>r.recapcha).then(r=>({default:r.ReCaptchaProvider}))),ue=()=>null,n=({children:r})=>t.jsx(o.Suspense,{fallback:t.jsx(ue,{}),children:r}),B=o.lazy(()=>Promise.resolve().then(()=>require("./builder-components-VjghhiN2.cjs")).then(r=>r.index).then(r=>({default:r.RenderAnnouncement}))),R=o.lazy(()=>Promise.resolve().then(()=>require("./builder-components-VjghhiN2.cjs")).then(r=>r.index).then(r=>({default:r.RenderFooter}))),b=o.lazy(()=>Promise.resolve().then(()=>require("./builder-components-VjghhiN2.cjs")).then(r=>r.index).then(r=>({default:r.RenderHeader}))),de=r=>{var E;const{blocks:d,settings:h,header:g,footer:I,announcement:x,routes:P=[],shopLogo:y,apiURLs:p,isAntistock:l=!1}=r,[f,A]=o.useState(null),{general:s,setIsAntistock:C}=i.useGeneralStore(),{setApiUrls:w}=i.useApiStore(),u=((E=s==null?void 0:s.info)==null?void 0:E.customerAccountSettings)??"OPTIONAL",z=u==="DISABLED",{setBlocks:H,setSourceBlocks:F,setHeader:O,setFooter:M,setAnnouncement:G,setSettings:W}=i.useBlocksStore(),{themeSettings:S}=i.useThemeSettingsStore(),{settings:T,setSettings:V}=i.useSettingsStore(),k=i.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,N=localStorage.getItem("shopPassword"),q=localStorage.getItem("shopId")||"";return o.useEffect(()=>{if(C(l),l){const a=document.documentElement;getComputedStyle(a).getPropertyValue("--brand-color").trim()==="#ff3f19"&&a.style.setProperty("--brand-color","#a13dff")}},[l,C]),o.useEffect(()=>{!q&&(s!=null&&s.info.id)&&localStorage.setItem("shopId",s==null?void 0:s.info.id)},[s]),o.useEffect(()=>{!k&&!l&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io")},[k]),o.useEffect(()=>{if(S&&T){const a=m.generateDynamicStyles(S,T);m.loadCustomFonts(),m.setupDynamicFonts(S),m.injectStylesToDOM(a)}},[S,JSON.stringify(T),window.location.hostname]),o.useEffect(()=>{const j=new h().blockSettings;V(j)},[]),o.useEffect(()=>{J()},[]),o.useLayoutEffect(()=>{const a={};Object.keys(d).map(v=>{a[v]=d[v]}),F(a),H(a),O(g),M(I),G(x),W(h),p&&w(p);const j=i.createBrowserRouter([{element:t.jsx(Q,{shopDomain:k,shopId:q,shopPassword:N||void 0,shopLogo:y,children:t.jsx(U,{children:t.jsx(ee,{children:t.jsx(i.Outlet,{})})})}),errorElement:t.jsx(n,{children:t.jsx(te,{})}),children:[{path:"/admin/builder/*",element:t.jsx(n,{children:t.jsx(Y,{children:t.jsx($,{blocks:d,settings:h,header:g,footer:I,announcement:x})})}),errorElement:t.jsx(n,{children:t.jsx(K,{})})},...P,{path:"/checkout",element:t.jsx(n,{children:t.jsx(re,{})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:t.jsx(n,{children:t.jsx(ce,{})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:t.jsx(n,{children:t.jsx(oe,{})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:t.jsx(n,{children:t.jsx(ie,{})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:t.jsx(n,{children:t.jsx(se,{})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Subscriptions",!0)},...z?[]:[{path:l?"/account":"/customer-dash",element:t.jsx(n,{children:t.jsxs("div",{className:L.wrapper,children:[t.jsx(B,{}),t.jsx(b,{}),t.jsx("div",{style:{flex:"1 1 auto"},children:t.jsx(le,{})}),t.jsx(R,{})]})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title=l?"Account":"Customer Dashboard",!0)}],{path:"/validation",element:t.jsx(n,{children:t.jsx(Z,{})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:t.jsx(n,{children:t.jsxs("div",{className:L.wrapper,children:[t.jsx(b,{}),t.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:t.jsx(U,{children:t.jsx(ne,{})})}),t.jsx(R,{})]})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Ticket",!0)},{path:"/terms",element:t.jsx(n,{children:t.jsxs("div",{className:L.wrapper,children:[t.jsx(B,{}),t.jsx(b,{}),t.jsx("div",{style:{flex:1,width:"100%"},children:t.jsx(ae,{})}),t.jsx(R,{})]})}),errorElement:t.jsx(n,{children:t.jsx(c,{})}),loader:()=>(document.title="Terms of Service",!0)},{path:"*",element:t.jsx(m.DynamicRouteWrapper,{}),errorElement:t.jsx(n,{children:t.jsx(c,{})})}]}]);A(j)},[s,u]),t.jsx(o.Suspense,{fallback:null,children:f&&t.jsx(i.RouterProvider,{router:f})})};exports.App=de;
@@ -1,44 +1,44 @@
1
- import { jsx as e, Fragment as j, jsxs as P } from "react/jsx-runtime";
2
- import { N as V, z as N, j as q, c as Q, m as X, a as J, M as $, aj as K, ak as Y, al as Z } from "./builder-DJQh1c1e.js";
3
- import { f as ee, l as te, j as oe, k as ne, D as re } from "./ticket-CF6WDvC5.js";
1
+ import { jsx as e, Fragment as _, jsxs as D } from "react/jsx-runtime";
2
+ import { N as j, z as N, j as q, c as Q, m as X, a as J, M as $, aj as K, ak as Y, al as Z } from "./builder-CAyJ72db.js";
3
+ import { f as ee, l as te, j as oe, k as ne, D as re } from "./ticket-CfkLSm70.js";
4
4
  import o, { Suspense as ce } from "react";
5
- import { _ as ae, $ as ie, a0 as se } from "./charge-z48cLi-k.js";
6
- import { w as le } from "./ui-components-CNP0TL7h.js";
7
- import { TextUnderlineIcon as de, TextStrikethroughIcon as he, TextItalicIcon as ue, AlignBottomIcon as me, AlignTopIcon as Ie, AlignRightIcon as pe, AlignLeftIcon as ge, TextAlignCenterIcon as fe, TextAlignRightIcon as Se, TextAlignLeftIcon as Ce, PushPinIcon as ye, CardsIcon as Ae, DeviceMobileCameraIcon as we, DeviceTabletCameraIcon as Te, DesktopIcon as ke, UserCircleGearIcon as Pe, TicketIcon as De, ChatCenteredIcon as Le, SealQuestionIcon as Re, SquaresFourIcon as xe, TextboxIcon as be, ArrowSquareInIcon as Ee, CornersOutIcon as Be, TextHIcon as Ue, TextBIcon as ze, TextAaIcon as ve, PaintBrushBroadIcon as He, GearIcon as Fe, PaletteIcon as Oe, TreeStructureIcon as Me, WarningDiamondIcon as Ge, WarningIcon as We, QuestionIcon as _e, CalendarCheckIcon as je, MedalIcon as Ve, CurrencyCircleDollarIcon as Ne, HouseSimpleIcon as qe, HouseIcon as Qe, GlobeIcon as Xe, SmileyIcon as Je, CalendarIcon as $e, UserIcon as Ke, HeartIcon as Ye, LockIcon as Ze, FileCloudIcon as et, ShieldCheckIcon as tt, ShieldIcon as ot, ShareIcon as nt, DotsSixVerticalIcon as rt, ChatsTeardropIcon as ct, PaperPlaneRightIcon as at, WalletIcon as it, SignOutIcon as st, TelegramLogoIcon as lt, DiscordLogoIcon as dt, DownloadSimpleIcon as ht, BookOpenIcon as ut, FileTextIcon as mt, FileIcon as It, AlignCenterHorizontalIcon as pt, LightningIcon as gt, FireIcon as ft, StarIcon as St, XCircleIcon as Ct, CheckCircleIcon as yt, ArrowsVerticalIcon as At, ArrowsHorizontalIcon as wt, CloudArrowUpIcon as Tt, SelectionIcon as kt, ArrowLineDownIcon as Pt, MagnifyingGlassMinusIcon as Dt, MagnifyingGlassIcon as Lt, CaretLeftIcon as Rt, CaretUpIcon as xt, CaretDownIcon as bt, CaretRightIcon as Et, ArrowUUpRightIcon as Bt, ArrowUUpLeftIcon as Ut, ArrowUpRightIcon as zt, ArrowLineUpRightIcon as vt, ArrowRightIcon as Ht, ArrowLeftIcon as Ft, ConfettiIcon as Ot, ArrowDownIcon as Mt, ArrowUpIcon as Gt, CrownIcon as Wt, EyeIcon as _t, BagIcon as jt, HandbagIcon as Vt, ListIcon as Nt, ImageIcon as qt, SlidersIcon as Qt, TrashIcon as Xt, CopyIcon as Jt, InfoIcon as $t, ClockIcon as Kt, CheckIcon as Yt, MinusIcon as Zt, PlusIcon as eo, XIcon as to } from "@phosphor-icons/react";
5
+ import { _ as ae, $ as ie, a0 as le } from "./charge-MZi_xfIe.js";
6
+ import { w as se } from "./ui-components-Bugw9fsk.js";
7
+ import { TextUnderlineIcon as de, TextStrikethroughIcon as ue, TextItalicIcon as he, AlignBottomIcon as me, AlignTopIcon as pe, AlignRightIcon as Ie, AlignLeftIcon as ge, TextAlignCenterIcon as fe, TextAlignRightIcon as Ce, TextAlignLeftIcon as Se, PushPinIcon as ye, CardsIcon as Ae, DeviceMobileCameraIcon as we, DeviceTabletCameraIcon as Te, DesktopIcon as Pe, UserCircleGearIcon as ke, TicketIcon as De, ChatCenteredIcon as Le, SealQuestionIcon as Re, SquaresFourIcon as xe, TextboxIcon as be, ArrowSquareInIcon as Ee, CornersOutIcon as Be, TextHIcon as Ue, TextBIcon as ze, TextAaIcon as ve, PaintBrushBroadIcon as He, GearIcon as Fe, PaletteIcon as Oe, TreeStructureIcon as Me, WarningDiamondIcon as Ge, WarningIcon as We, QuestionIcon as Ve, CalendarCheckIcon as _e, MedalIcon as je, CurrencyCircleDollarIcon as Ne, HouseSimpleIcon as qe, HouseIcon as Qe, GlobeIcon as Xe, SmileyIcon as Je, CalendarIcon as $e, UserIcon as Ke, HeartIcon as Ye, LockIcon as Ze, FileCloudIcon as et, ShieldCheckIcon as tt, ShieldIcon as ot, ShareIcon as nt, DotsSixVerticalIcon as rt, ChatsTeardropIcon as ct, PaperPlaneRightIcon as at, WalletIcon as it, SignOutIcon as lt, TelegramLogoIcon as st, DiscordLogoIcon as dt, DownloadSimpleIcon as ut, BookOpenIcon as ht, FileTextIcon as mt, FileIcon as pt, AlignCenterHorizontalIcon as It, LightningIcon as gt, FireIcon as ft, StarIcon as Ct, XCircleIcon as St, CheckCircleIcon as yt, ArrowsVerticalIcon as At, ArrowsHorizontalIcon as wt, CloudArrowUpIcon as Tt, SelectionIcon as Pt, ArrowLineDownIcon as kt, MagnifyingGlassMinusIcon as Dt, MagnifyingGlassIcon as Lt, CaretLeftIcon as Rt, CaretUpIcon as xt, CaretDownIcon as bt, CaretRightIcon as Et, ArrowUUpRightIcon as Bt, ArrowUUpLeftIcon as Ut, ArrowUpRightIcon as zt, ArrowLineUpRightIcon as vt, ArrowRightIcon as Ht, ArrowLeftIcon as Ft, ConfettiIcon as Ot, ArrowDownIcon as Mt, ArrowUpIcon as Gt, CrownIcon as Wt, EyeIcon as Vt, BagIcon as _t, HandbagIcon as jt, ListIcon as Nt, ImageIcon as qt, SlidersIcon as Qt, TrashIcon as Xt, CopyIcon as Jt, InfoIcon as $t, ClockIcon as Kt, CheckIcon as Yt, MinusIcon as Zt, PlusIcon as eo, XIcon as to } from "@phosphor-icons/react";
8
8
  const oo = ({
9
9
  children: t,
10
10
  shopDomain: s,
11
- shopId: l,
12
- shopPassword: d,
13
- shopLogo: u
11
+ shopId: d,
12
+ shopPassword: u,
13
+ shopLogo: h
14
14
  }) => {
15
15
  const {
16
16
  setShopDomain: m,
17
17
  setShopId: S,
18
- setShopPassword: C,
19
- setShopTerms: I,
18
+ setShopPassword: y,
19
+ setShopTerms: p,
20
20
  setShopPrivacyPolicy: i,
21
- setShopRefundPolicy: p,
22
- setShopLogo: y
23
- } = V();
21
+ setShopRefundPolicy: I,
22
+ setShopLogo: A
23
+ } = j();
24
24
  return o.useLayoutEffect(() => {
25
25
  const r = async () => {
26
- const { data: a } = await ae();
27
- I(a);
26
+ const { data: l } = await ae();
27
+ p(l);
28
28
  }, g = async () => {
29
- const { data: a } = await ie();
30
- i(a);
31
- }, A = async () => {
32
- const { data: a } = await se();
33
- p(a);
29
+ const { data: l } = await ie();
30
+ i(l);
31
+ }, w = async () => {
32
+ const { data: l } = await le();
33
+ I(l);
34
34
  };
35
- m(s), S(l), d && C(d), u && y(u), r(), g(), A();
36
- }, [s, l, d]), /* @__PURE__ */ e(j, { children: t });
37
- }, no = "_wrapper_1xuz3_18", D = {
35
+ m(s), S(d), u && y(u), h && A(h), r(), g(), w();
36
+ }, [s, d, u]), /* @__PURE__ */ e(_, { children: t });
37
+ }, no = "_wrapper_1xuz3_18", L = {
38
38
  wrapper: no
39
39
  };
40
40
  function ro() {
41
- le({
41
+ se({
42
42
  // Основные UI иконки
43
43
  X: to,
44
44
  Plus: eo,
@@ -51,9 +51,9 @@ function ro() {
51
51
  Sliders: Qt,
52
52
  Image: qt,
53
53
  List: Nt,
54
- Handbag: Vt,
55
- Bag: jt,
56
- Eye: _t,
54
+ Handbag: jt,
55
+ Bag: _t,
56
+ Eye: Vt,
57
57
  Crown: Wt,
58
58
  ArrowUp: Gt,
59
59
  ArrowDown: Mt,
@@ -70,28 +70,28 @@ function ro() {
70
70
  CaretLeft: Rt,
71
71
  MagnifyingGlass: Lt,
72
72
  MagnifyingGlassMinus: Dt,
73
- ArrowLineDown: Pt,
74
- Selection: kt,
73
+ ArrowLineDown: kt,
74
+ Selection: Pt,
75
75
  CloudArrowUpIcon: Tt,
76
76
  ArrowsHorizontal: wt,
77
77
  ArrowsVertical: At,
78
78
  // Статусы и действия
79
79
  CheckCircle: yt,
80
- XCircle: Ct,
81
- Star: St,
80
+ XCircle: St,
81
+ Star: Ct,
82
82
  Fire: ft,
83
83
  Lightning: gt,
84
- AlignCenterHorizontal: pt,
84
+ AlignCenterHorizontal: It,
85
85
  // Файлы и документы
86
- File: It,
86
+ File: pt,
87
87
  FileText: mt,
88
- BookOpen: ut,
89
- DownloadSimple: ht,
88
+ BookOpen: ht,
89
+ DownloadSimple: ut,
90
90
  // Социальные сети
91
91
  DiscordLogo: dt,
92
- TelegramLogo: lt,
92
+ TelegramLogo: st,
93
93
  // Навигация и интерфейс
94
- SignOut: st,
94
+ SignOut: lt,
95
95
  Wallet: it,
96
96
  PaperPlaneRight: at,
97
97
  ChatsTeardrop: ct,
@@ -112,9 +112,9 @@ function ro() {
112
112
  House: Qe,
113
113
  HouseSimple: qe,
114
114
  CurrencyCircleDollar: Ne,
115
- Medal: Ve,
116
- CalendarCheck: je,
117
- Question: _e,
115
+ Medal: je,
116
+ CalendarCheck: _e,
117
+ Question: Ve,
118
118
  // Иконки для статусов
119
119
  Warning: We,
120
120
  WarningDiamond: Ge,
@@ -133,124 +133,127 @@ function ro() {
133
133
  SealQuestion: Re,
134
134
  ChatCentered: Le,
135
135
  Ticket: De,
136
- UserCircleGear: Pe,
137
- Desktop: ke,
136
+ UserCircleGear: ke,
137
+ Desktop: Pe,
138
138
  DeviceTabletCamera: Te,
139
139
  DeviceMobileCamera: we,
140
140
  Cards: Ae,
141
141
  PushPin: ye,
142
142
  // Иконки для выравнивания текста и отступов
143
- TextAlignLeft: Ce,
144
- TextAlignRight: Se,
143
+ TextAlignLeft: Se,
144
+ TextAlignRight: Ce,
145
145
  TextAlignCenter: fe,
146
146
  AlignLeft: ge,
147
- AlignRight: pe,
148
- AlignTop: Ie,
147
+ AlignRight: Ie,
148
+ AlignTop: pe,
149
149
  AlignBottom: me,
150
150
  // Иконки для форматирования текста
151
- TextItalic: ue,
152
- TextStrikethrough: he,
151
+ TextItalic: he,
152
+ TextStrikethrough: ue,
153
153
  TextUnderline: de
154
154
  });
155
155
  }
156
156
  const co = o.lazy(
157
- () => import("./builder-DJQh1c1e.js").then((t) => t.ao).then((t) => ({ default: t.BuilderPage }))
157
+ () => import("./builder-CAyJ72db.js").then((t) => t.ao).then((t) => ({ default: t.BuilderPage }))
158
158
  ), ao = o.lazy(
159
- () => import("./index-DHPgQ7DA.js").then((t) => ({ default: t.ErrorPage }))
159
+ () => import("./index-BQ-OGjfc.js").then((t) => ({ default: t.ErrorPage }))
160
160
  ), io = o.lazy(
161
- () => import("./index-BTjeATna.js").then((t) => ({ default: t.ActivePage }))
162
- ), so = o.lazy(
163
- () => import("./validation-C8mTX1VQ.js").then((t) => ({ default: t.ValidationPage }))
161
+ () => import("./index-Bs1RNOaG.js").then((t) => ({ default: t.ActivePage }))
164
162
  ), lo = o.lazy(
165
- () => import("./index-CElp6y2B.js").then((t) => ({ default: t.WrapperPage }))
166
- ), ho = o.lazy(
167
- () => import("./index-CYANU9EG.js").then((t) => ({ default: t.RouterErrorPage }))
168
- ), c = o.lazy(
169
- () => import("./index-CloS3B1y.js").then((t) => ({ default: t.DynamicErrorPage }))
163
+ () => import("./validation-CLJwGwJ2.js").then((t) => ({ default: t.ValidationPage }))
164
+ ), so = o.lazy(
165
+ () => import("./index-DEdog3Tq.js").then((t) => ({ default: t.WrapperPage }))
170
166
  ), uo = o.lazy(
171
- () => import("./checkout-M3jKk4q6.js").then((t) => ({ default: t.Checkout }))
167
+ () => import("./index-CS18NKWD.js").then((t) => ({ default: t.RouterErrorPage }))
168
+ ), c = o.lazy(
169
+ () => import("./index-BtMsyng7.js").then((t) => ({ default: t.DynamicErrorPage }))
170
+ ), ho = o.lazy(
171
+ () => import("./checkout-DP0YAiOB.js").then((t) => ({ default: t.Checkout }))
172
172
  ), mo = o.lazy(
173
- () => import("./charge-z48cLi-k.js").then((t) => t.a8).then((t) => ({ default: t.ChargePage }))
174
- ), Io = o.lazy(
175
- () => import("./ticket-CF6WDvC5.js").then((t) => t.m).then((t) => ({ default: t.TicketItem }))
173
+ () => import("./charge-MZi_xfIe.js").then((t) => t.a8).then((t) => ({ default: t.ChargePage }))
176
174
  ), po = o.lazy(
177
- () => import("./subscription-S3Q0J-LT.js").then((t) => t.i).then((t) => ({ default: t.Subscription }))
175
+ () => import("./ticket-CfkLSm70.js").then((t) => t.m).then((t) => ({ default: t.TicketItem }))
176
+ ), Io = o.lazy(
177
+ () => import("./subscription-2jqv9XIK.js").then((t) => t.i).then((t) => ({ default: t.Subscription }))
178
178
  ), go = o.lazy(
179
- () => import("./top-up-DkwIdCFZ.js").then((t) => ({ default: t.TopUpBalance }))
179
+ () => import("./top-up-DahJqmZg.js").then((t) => ({ default: t.TopUpBalance }))
180
180
  ), fo = o.lazy(
181
- () => import("./order-P0fQ9MtH.js").then((t) => t.i).then((t) => ({ default: t.OrderPage }))
182
- ), So = o.lazy(
183
- () => import("./index-CcM2U332.js").then((t) => ({ default: t.TermsPage }))
181
+ () => import("./order-JpAF7zFI.js").then((t) => t.i).then((t) => ({ default: t.OrderPage }))
184
182
  ), Co = o.lazy(
185
- () => import("./charge-z48cLi-k.js").then((t) => t.a7).then((t) => ({ default: t.CustomerDashboard }))
183
+ () => import("./index-CnpiXLcN.js").then((t) => ({ default: t.TermsPage }))
184
+ ), So = o.lazy(
185
+ () => import("./charge-MZi_xfIe.js").then((t) => t.a7).then((t) => ({ default: t.CustomerDashboard }))
186
186
  ), B = o.lazy(
187
- () => import("./charge-z48cLi-k.js").then((t) => t.a6).then((t) => ({ default: t.ReCaptchaProvider }))
187
+ () => import("./charge-MZi_xfIe.js").then((t) => t.a6).then((t) => ({ default: t.ReCaptchaProvider }))
188
188
  ), yo = () => null, n = ({ children: t }) => /* @__PURE__ */ e(ce, { fallback: /* @__PURE__ */ e(yo, {}), children: t }), U = o.lazy(
189
- () => import("./builder-components-CpOz_SUG.js").then((t) => t.i).then((t) => ({
189
+ () => import("./builder-components-D-YCuD-D.js").then((t) => t.i).then((t) => ({
190
190
  default: t.RenderAnnouncement
191
191
  }))
192
- ), L = o.lazy(
193
- () => import("./builder-components-CpOz_SUG.js").then((t) => t.i).then((t) => ({
192
+ ), R = o.lazy(
193
+ () => import("./builder-components-D-YCuD-D.js").then((t) => t.i).then((t) => ({
194
194
  default: t.RenderFooter
195
195
  }))
196
- ), R = o.lazy(
197
- () => import("./builder-components-CpOz_SUG.js").then((t) => t.i).then((t) => ({
196
+ ), x = o.lazy(
197
+ () => import("./builder-components-D-YCuD-D.js").then((t) => t.i).then((t) => ({
198
198
  default: t.RenderHeader
199
199
  }))
200
- ), Ro = (t) => {
201
- var b;
200
+ ), xo = (t) => {
201
+ var E;
202
202
  const {
203
203
  blocks: s,
204
- settings: l,
205
- header: d,
206
- footer: u,
204
+ settings: d,
205
+ header: u,
206
+ footer: h,
207
207
  announcement: m,
208
208
  routes: S = [],
209
- shopLogo: C,
210
- apiURLs: I,
209
+ shopLogo: y,
210
+ apiURLs: p,
211
211
  isAntistock: i = !1
212
- } = t, [p, y] = o.useState(null), { general: r, setIsAntistock: g } = N(), { setApiUrls: A } = q(), a = ((b = r == null ? void 0 : r.info) == null ? void 0 : b.customerAccountSettings) ?? "OPTIONAL", z = a === "DISABLED", {
212
+ } = t, [I, A] = o.useState(null), { general: r, setIsAntistock: g } = N(), { setApiUrls: w } = q(), l = ((E = r == null ? void 0 : r.info) == null ? void 0 : E.customerAccountSettings) ?? "OPTIONAL", z = l === "DISABLED", {
213
213
  setBlocks: v,
214
214
  setSourceBlocks: H,
215
215
  setHeader: F,
216
216
  setFooter: O,
217
217
  setAnnouncement: M,
218
218
  setSettings: G
219
- } = Q(), { themeSettings: f } = X(), { settings: w, setSettings: W } = J(), T = $ ? localStorage.getItem("fakeDomain") || "" : window.location.hostname, _ = localStorage.getItem("shopPassword"), x = localStorage.getItem("shopId") || "";
219
+ } = Q(), { themeSettings: f } = X(), { settings: T, setSettings: W } = J(), P = $ ? localStorage.getItem("fakeDomain") || "" : window.location.hostname, V = localStorage.getItem("shopPassword"), b = localStorage.getItem("shopId") || "";
220
220
  return o.useEffect(() => {
221
- g(i);
221
+ if (g(i), i) {
222
+ const a = document.documentElement;
223
+ getComputedStyle(a).getPropertyValue("--brand-color").trim() === "#ff3f19" && a.style.setProperty("--brand-color", "#a13dff");
224
+ }
222
225
  }, [i, g]), o.useEffect(() => {
223
- !x && (r != null && r.info.id) && localStorage.setItem("shopId", r == null ? void 0 : r.info.id);
226
+ !b && (r != null && r.info.id) && localStorage.setItem("shopId", r == null ? void 0 : r.info.id);
224
227
  }, [r]), o.useEffect(() => {
225
- !T && !i && localStorage.setItem("fakeDomain", "drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io");
226
- }, [T]), o.useEffect(() => {
227
- if (f && w) {
228
- const h = ee(f, w);
229
- te(), oe(f), ne(h);
228
+ !P && !i && localStorage.setItem("fakeDomain", "drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io");
229
+ }, [P]), o.useEffect(() => {
230
+ if (f && T) {
231
+ const a = ee(f, T);
232
+ te(), oe(f), ne(a);
230
233
  }
231
- }, [f, JSON.stringify(w), window.location.hostname]), o.useEffect(() => {
232
- const k = new l().blockSettings;
233
- W(k);
234
+ }, [f, JSON.stringify(T), window.location.hostname]), o.useEffect(() => {
235
+ const C = new d().blockSettings;
236
+ W(C);
234
237
  }, []), o.useEffect(() => {
235
238
  ro();
236
239
  }, []), o.useLayoutEffect(() => {
237
- const h = {};
238
- Object.keys(s).map((E) => {
239
- h[E] = s[E];
240
- }), H(h), v(h), F(d), O(u), M(m), G(l), I && A(I);
241
- const k = K([
240
+ const a = {};
241
+ Object.keys(s).map((k) => {
242
+ a[k] = s[k];
243
+ }), H(a), v(a), F(u), O(h), M(m), G(d), p && w(p);
244
+ const C = K([
242
245
  {
243
246
  element: /* @__PURE__ */ e(
244
247
  oo,
245
248
  {
246
- shopDomain: T,
247
- shopId: x,
248
- shopPassword: _ || void 0,
249
- shopLogo: C,
250
- children: /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(lo, { children: /* @__PURE__ */ e(Y, {}) }) })
249
+ shopDomain: P,
250
+ shopId: b,
251
+ shopPassword: V || void 0,
252
+ shopLogo: y,
253
+ children: /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(so, { children: /* @__PURE__ */ e(Y, {}) }) })
251
254
  }
252
255
  ),
253
- errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(ho, {}) }),
256
+ errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(uo, {}) }),
254
257
  children: [
255
258
  {
256
259
  path: "/admin/builder/*",
@@ -258,9 +261,9 @@ const co = o.lazy(
258
261
  co,
259
262
  {
260
263
  blocks: s,
261
- settings: l,
262
- header: d,
263
- footer: u,
264
+ settings: d,
265
+ header: u,
266
+ footer: h,
264
267
  announcement: m
265
268
  }
266
269
  ) }) }),
@@ -269,7 +272,7 @@ const co = o.lazy(
269
272
  ...S,
270
273
  {
271
274
  path: "/checkout",
272
- element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(uo, {}) }),
275
+ element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(ho, {}) }),
273
276
  errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(c, {}) }),
274
277
  loader: () => (document.title = "Checkout", !0)
275
278
  },
@@ -293,26 +296,26 @@ const co = o.lazy(
293
296
  },
294
297
  {
295
298
  path: "/subscriptions/:id/:accessToken?",
296
- element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(po, {}) }),
299
+ element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(Io, {}) }),
297
300
  errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(c, {}) }),
298
301
  loader: () => (document.title = "Subscriptions", !0)
299
302
  },
300
303
  ...z ? [] : [
301
304
  {
302
305
  path: i ? "/account" : "/customer-dash",
303
- element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ P("div", { className: D.wrapper, children: [
306
+ element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ D("div", { className: L.wrapper, children: [
304
307
  /* @__PURE__ */ e(U, {}),
305
- /* @__PURE__ */ e(R, {}),
308
+ /* @__PURE__ */ e(x, {}),
306
309
  /* @__PURE__ */ e(
307
310
  "div",
308
311
  {
309
312
  style: {
310
313
  flex: "1 1 auto"
311
314
  },
312
- children: /* @__PURE__ */ e(Co, {})
315
+ children: /* @__PURE__ */ e(So, {})
313
316
  }
314
317
  ),
315
- /* @__PURE__ */ e(L, {})
318
+ /* @__PURE__ */ e(R, {})
316
319
  ] }) }),
317
320
  errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(c, {}) }),
318
321
  loader: () => (document.title = i ? "Account" : "Customer Dashboard", !0)
@@ -320,14 +323,14 @@ const co = o.lazy(
320
323
  ],
321
324
  {
322
325
  path: "/validation",
323
- element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(so, {}) }),
326
+ element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(lo, {}) }),
324
327
  errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(c, {}) }),
325
328
  loader: () => (document.title = "Validation", !0)
326
329
  },
327
330
  {
328
331
  path: "/ticket/:id/:accessToken",
329
- element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ P("div", { className: D.wrapper, children: [
330
- /* @__PURE__ */ e(R, {}),
332
+ element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ D("div", { className: L.wrapper, children: [
333
+ /* @__PURE__ */ e(x, {}),
331
334
  /* @__PURE__ */ e(
332
335
  "div",
333
336
  {
@@ -336,19 +339,19 @@ const co = o.lazy(
336
339
  width: "100%",
337
340
  height: "100%"
338
341
  },
339
- children: /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(Io, {}) })
342
+ children: /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(po, {}) })
340
343
  }
341
344
  ),
342
- /* @__PURE__ */ e(L, {})
345
+ /* @__PURE__ */ e(R, {})
343
346
  ] }) }),
344
347
  errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(c, {}) }),
345
348
  loader: () => (document.title = "Ticket", !0)
346
349
  },
347
350
  {
348
351
  path: "/terms",
349
- element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ P("div", { className: D.wrapper, children: [
352
+ element: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ D("div", { className: L.wrapper, children: [
350
353
  /* @__PURE__ */ e(U, {}),
351
- /* @__PURE__ */ e(R, {}),
354
+ /* @__PURE__ */ e(x, {}),
352
355
  /* @__PURE__ */ e(
353
356
  "div",
354
357
  {
@@ -356,10 +359,10 @@ const co = o.lazy(
356
359
  flex: 1,
357
360
  width: "100%"
358
361
  },
359
- children: /* @__PURE__ */ e(So, {})
362
+ children: /* @__PURE__ */ e(Co, {})
360
363
  }
361
364
  ),
362
- /* @__PURE__ */ e(L, {})
365
+ /* @__PURE__ */ e(R, {})
363
366
  ] }) }),
364
367
  errorElement: /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(c, {}) }),
365
368
  loader: () => (document.title = "Terms of Service", !0)
@@ -372,9 +375,9 @@ const co = o.lazy(
372
375
  ]
373
376
  }
374
377
  ]);
375
- y(k);
376
- }, [r, a]), /* @__PURE__ */ e(o.Suspense, { fallback: null, children: p && /* @__PURE__ */ e(Z, { router: p }) });
378
+ A(C);
379
+ }, [r, l]), /* @__PURE__ */ e(o.Suspense, { fallback: null, children: I && /* @__PURE__ */ e(Z, { router: I }) });
377
380
  };
378
381
  export {
379
- Ro as App
382
+ xo as App
380
383
  };
@@ -1,4 +1,4 @@
1
- "use strict";const g=require("./builder--8Ry7cQ4.cjs"),i=require("react/jsx-runtime"),L=require("react"),N=require("./ui-components-DnpGt0Lr.cjs"),nl=require("./builder-components-Bgg9F62l.cjs");require("react-dom");const rl=require("./ticket-D67XjuXI.cjs"),ul=require("./order-2fi-ASUJ.cjs"),t2=require("./subscription-BXILybzC.cjs");function n2(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const me=n2(L),r2=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,al=({children:e,className:t,as:n="span",...r})=>{const[u,a]=L.useState(!1);return L.useEffect(()=>{typeof window<"u"&&a(r2())},[]),u?i.jsx(n,{className:t,...r,"data-stable-text":e,dangerouslySetInnerHTML:{__html:""}}):i.jsx(n,{className:t,...r,children:e})};async function u2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/general`+(e?`?password=${e}`:"");return(await g.request({method:"get",url:r,withToken:!1})).data}const a2=async()=>{const e=g.useApiStore.getState().apiUrls,t=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,n=`${e.storeApi}/v2/shops/${t}/settings-theme`;return await g.request({url:n,withToken:!0,method:"get"})},s2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/balance/top-up/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},i2=async(e,t)=>{const r=`${g.useApiStore.getState().apiUrls.cashappApi}/v1/${t}/cashapp/link`;return await g.request({url:r,method:"post",body:e,withToken:!1})},Nr=async e=>{const t=g.useApiStore.getState().apiUrls;if(!localStorage.getItem("token"))throw new Error("No access token");const r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${t.customersApi}/v2/${r}/customers/${e}`;return await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"})},o2=()=>Nr("dash/info"),sl=()=>Nr("dash/dashboard/home"),c2=()=>Nr("rewards"),l2=()=>Nr("balance"),d2=()=>Nr("balance/top-up/settings"),f2=()=>Nr("referral-system"),Ks=e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/${e}`;return g.request({url:r,withToken:!1,method:"get"})},h2=()=>Ks("terms"),p2=()=>Ks("refund-policy"),m2=()=>Ks("privacy-policy"),Es=10,aa=async({url:e,PageNumber:t})=>{var o;const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.customersApi}/v2/${r}/${e}?PageNumber=${t}&PageSize=${Es}`,a=await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"}),s=Number((o=a.headers)==null?void 0:o["x-pagination-total"]);return{list:a.data,totalCount:s}},sa=async(e,t="get",n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/orders/${u}/${e}`;return await g.request({url:a,method:t,withToken:!0,body:n,typeToken:"customer"})},g2=e=>sa("","post",e),b2=({PageNumber:e})=>aa({url:"customers/orders",PageNumber:e}),_2=e=>sa(e),x2=e=>sa(e),C2=(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v2/orders/${u}/${e}/${t}/replacement-requests`;return g.request({url:a,method:"post",withToken:!0,body:n,typeToken:"customer"})},E2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/public/${n}/images`,u=new FormData;return u.append("file",e),g.request({url:r,method:"post",withToken:!1,body:u})},y2=(e,t,n)=>sa(`${e}/${t}/replacement-requests/${n}/cancel`,"post"),T2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/${n}/subscriptions`;return await g.request({url:r,method:"post",withToken:!1,body:e})},k2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},A2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/${r}/subscriptions/${e}/${t}/upgrades`;return await g.request({url:u,method:"get",withToken:!1})},S2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/${u}/subscriptions/${e}/${t}/cancel`;return await g.request({url:a,method:"post",withToken:!1,body:n})},I2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/change-gateway`;return await g.request({url:u,method:"post",withToken:!1,body:{gateway:t}})},N2=({PageNumber:e})=>aa({url:"customers/subscriptions",PageNumber:e}),v2=async({id:e,accessToken:t})=>await A2(e,t),w2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/order`;return await g.request({url:u,method:"post",withToken:!1,body:t})},D2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/public/${r}/tickets/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},L2=async(e,t,n,r,u,a)=>{const s=g.useApiStore.getState().apiUrls,o=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,c=`${s.slApi}/v1/public/${o}/tickets/${e}/${t}/answer`;return(await g.request({url:c,method:"post",body:{message:n,recaptcha:r,tsId:u,...a&&a.length>0&&{imageIds:a.map(h=>h.imageId)}},withToken:!1})).data},P2=({PageNumber:e})=>aa({url:"customers/tickets",PageNumber:e}),R2=({PageNumber:e})=>aa({url:"customers/balance/transactions",PageNumber:e}),M2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/reviews/${u}/${t}/${n}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},O2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/charges/${n}/${e}`;return await g.request({url:r,method:"get",withToken:!1})},j2=async e=>{const t=g.useApiStore.getState().apiUrls,n=e.map(s=>["names",s]),r=new URLSearchParams(n),u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${t.slApi}/v2/gateways?shopDomain=${u}&${r.toString()}`;return await g.request({url:a,method:"get",withToken:!1})},ku=new Map,il=async e=>{const t=g.useApiStore.getState().apiUrls,r=Array.from(new Set(e)).sort().map(l=>["names",l]),u=new URLSearchParams(r),a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${t.slApi}/v2/checkout?shopDomain=${a}&${u.toString()}`,o=`${s}`;if(ku.has(o))return ku.get(o);const c=g.request({url:s,method:"get",withToken:!1}).catch(l=>{throw ku.delete(o),l});return ku.set(o,c),c},ol=async({email:e,recaptcha:t,tsId:n})=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.customersApi}/v2/${u}/auth/otp/request`;return(await g.request({url:a,body:{email:e,recaptcha:t,tsId:n},method:"post",withToken:!1})).data?{requested:!0,email:e}:{requested:!1,email:void 0}},cl=async({email:e,otp:t,recaptcha:n,tsId:r})=>{const u=g.useApiStore.getState().apiUrls,a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${u.customersApi}/v2/${a}/auth/otp/login`,{data:o}=await g.request({url:s,method:"post",body:{email:e,otp:t,recaptcha:n,tsId:r},withToken:!1});return g.useStorefrontStore.getState().setToken(o.data),localStorage.setItem("token",o.data),{token:o.data,requested:!1}},ys=async()=>{g.useStorefrontStore.getState().setToken(""),g.useCustomerDashboardStore.getState().setDashInfo(null),localStorage.removeItem("token")},F2=Object.freeze(Object.defineProperty({__proto__:null,loginCustomer:cl,logoutCustomer:ys,requestOtp:ol},Symbol.toStringTag,{value:"Module"})),B2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v2/coupons/${n}/validate`;return await g.request({url:r,method:"post",body:e,withToken:!1})},H2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/referral-system/signup`;return(await g.request({url:r,withToken:!0,method:"post",body:e,typeToken:"customer"})).data},U2=async()=>{const{data:e}=await f2();return e},V2=async e=>{const{data:t}=await H2(e);return t},$2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},z2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}/${e.id}?customerEmail=${e.customerEmail}`;return await g.request({url:r,method:"get",withToken:!1})};async function q2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/rewards/${e.id}/claim`;return g.request({url:r,method:"post",withToken:!0,typeToken:"customer"})}const Z2=async(e,t,n,r)=>{const a=`${g.useApiStore.getState().apiUrls.slApi}/v1/vouches/${t}/${n}/${r}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},ll=()=>g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,W2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key`;return g.request({url:n,method:"get",withToken:!0,typeToken:"customer"})},Y2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key/regenerate`;return g.request({url:n,method:"post",withToken:!0,typeToken:"customer"})},Ma="Balance",jn={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},G2={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},Wi=(e,t)=>{var l;const{productId:n,productVariantId:r,quantity:u,chargeType:a}=t,s=e.find(h=>h.id===n);if(!s)throw new Error("Product does not exist");const o=s.variants.find(h=>h.id===r);if(!o)throw new Error("Variant does not exist");if(a==="RECURRING"&&!o.subscriptionSettings)throw new Error("Variant does not have subscription settings");if(u!==void 0&&((l=o.quantity)!=null&&l.available)&&o.quantity.available<u)throw new Error("Not enough quantity available");const c=g.useCartStore.getState().cart;if(c.parts.length>0){const h=e.find(m=>m.id===c.parts[0].productId),f=h==null?void 0:h.variants.find(m=>m.id===c.parts[0].productVariantId);if(f&&o.price.currency!==f.price.currency)throw new Error("Product have different currency")}return o},X2=(e,t)=>{if(!e.volumeDiscounts||e.volumeDiscounts.length===0)return 0;const n=e.volumeDiscounts.filter(u=>t>=u.amount);return n.length===0?0:n.reduce((u,a)=>a.amount>u.amount?a:u).percentage},K2=(e,t)=>{let n=0,r=0;return e.forEach(u=>{var m,p;const a=t.find(b=>(b==null?void 0:b.id)===u.productId),s=a==null?void 0:a.variants.find(b=>b.id===u.productVariantId);if(!s)return;const{gateway:o}=g.useCartStore.getState().cart,c=(s==null?void 0:s.gateways)||[],l=c.some(b=>b.name===o&&b.overrodePrice)?(m=c.find(b=>b.name===o))==null?void 0:m.overrodePrice:null;let h=0,f=0;if(u.chargeType==="ONE_TIME"?(h=(l==null?void 0:l.amount)||(s==null?void 0:s.price.amount)||0,f=h*u.quantity):f=s!=null&&s.subscriptionSettings?s.subscriptionSettings.price.amount+(((p=s.subscriptionSettings.entryFee)==null?void 0:p.amount)||0):0,n+=f,u.chargeType==="ONE_TIME"){const b=X2(s,u.quantity),_=f*(1-b/100);r+=_}else r+=f}),{total:n,totalWithVolumeDiscounts:r}},Q2=(e,t)=>({isRequired:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isRequired}),isEnabled:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isEnabled})}),Yi=e=>new Set(e.gateways.map(t=>t.name)),Oa={availableGateways:[],requiresSignInGateways:[]},Gi=(e,t)=>{if(t.length===0)return Oa;const n=e[0];if(!n)return Oa;const r=t.find(o=>o.id===n.productId),u=r==null?void 0:r.variants.find(o=>o.id===n.productVariantId);if(!u)return Oa;const a=Yi(u);for(const o of e){const c=t.find(f=>f.id===o.productId);if(!c)continue;const l=c.variants.find(f=>f.id===o.productVariantId);if(!l)continue;const h=Yi(l);for(const f of a)h.has(f)||a.delete(f)}return!localStorage.getItem("token")&&a.has(Ma)?(a.delete(Ma),{availableGateways:[...a],requiresSignInGateways:[Ma]}):{availableGateways:[...a],requiresSignInGateways:[]}},Xi=(e,t)=>{if(e.length===0)return[];const r=e.map(a=>{const s=t.find(c=>c.id===a.productId),o=s==null?void 0:s.variants.find(c=>c.id===a.productVariantId);return(o==null?void 0:o.customFields)??[]}).flat().reduce((a,s)=>{const o=a[s.name];return o?(s.required&&!o.required&&(a[s.name]={...s,value:s.defaultValue}),a):(a[s.name]={...s,value:s.defaultValue},a)},{});return Object.values(r).map(a=>({...a,value:""}))},J2=(e,t)=>{const n=t.find(u=>u.id===e.productId),r=n==null?void 0:n.variants.find(u=>u.id===e.productVariantId);return e.chargeType==="RECURRING"?!!(r!=null&&r.subscriptionSettings):!1},du=()=>{const{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,customerEmail:a,setCart:s,setProducts:o,setCoupon:c,setPending:l,setApplyCouponPending:h}=g.useCartStore(),f=async _=>{var M;h(!0);const{cart:E}=g.useCartStore.getState(),{gateway:x,parts:k}=E,{notifications:y,setNotifications:D}=g.useNotificationStore.getState();x||(h(!1),D([...y,{message:"There should be a gateway for the coupon",status:"error",id:g.v4()}]));const S=k.map(H=>H.productId);let I=null;try{const{data:H}=await B2({gateway:x,couponName:_,productIds:S});I=H.data,D([...y,{message:"Coupon is applied",status:"success",id:g.v4()}]),s(U=>({...U,coupon:_}))}catch(H){const U=H;D([...y,{message:`Coupon is not applied: ${U.message}`,status:"error",id:g.v4()}]),s(P=>({...P,coupon:null})),c(null),h(!1)}if(h(!1),(M=I==null?void 0:I.restrictToProductIds)!=null&&M.length&&!S.every(H=>{var U;return(U=I==null?void 0:I.restrictToProductIds)==null?void 0:U.includes(H)}))throw new Error("Coupon can't be applied to such products");return c(I),I},b={reset(){s({...G2})},addProducts:_=>{const E=g.useCartStore.getState().products,x=_.filter(k=>!E.some(y=>y.id===k.id));o([...E,...x])},addProductToCart:_=>{const E=g.useCartStore.getState().cart;try{Wi(t,_)}catch(k){throw new Error(k)}const x=E.parts.find(k=>k.productId===_.productId&&k.productVariantId===_.productVariantId&&k.chargeType===_.chargeType);if(x)return b.updateQuantityOfProduct({...x,quantity:(x.quantity||1)+(_.quantity||1),chargeType:_.chargeType});if(E.parts.length&&Gi([...E.parts,_],t).availableGateways.length===0)throw new Error("No common payment gateways available");s({...E,parts:[...E.parts,_]}),E.coupon&&f(E.coupon)},removeProduct({productId:_,productVariantId:E}){s(x=>({...x,parts:x.parts.filter(k=>k.productId!==_||k.productVariantId!==E)})),e.coupon&&f(e.coupon)},getPossibleGateways(){return Gi(e.parts,t)},removeCoupon(){c(null)},getDiscordSettings(){return Q2(t,e.parts)},updateQuantityOfProduct(_){Wi(t,_),s(E=>({...E,parts:E.parts.map(x=>x.productId===_.productId&&x.productVariantId===_.productVariantId?{...x,quantity:_.quantity,chargeType:_.chargeType}:x)})),e.coupon&&f(e.coupon)},getTotalAndDiscount(){const{coupon:_}=g.useCartStore.getState(),{total:E,totalWithVolumeDiscounts:x}=K2(e.parts,t);let k;const y=x;return _&&_.discount?!_.isFixed&&_.discount===100?k=0:k=_.isFixed?Math.max(0,y-_.discount):y*(1-_.discount/100):x!==E&&(k=x),{total:E,totalWithVolumeDiscounts:x!==E?x:void 0,totalWithDiscount:k}},setGateway(_){s(x=>({...x,gateway:_}));const{isAntistock:E}=g.useGeneralStore.getState();e.coupon&&!E&&f(e.coupon)},setPaymentMethod(_){s(E=>({...E,paymentMethod:_}))},async submitCart(_){l(!0);const{cart:E}=g.useCartStore.getState(),{discordInfo:x}=g.useDiscordStore.getState();let k;if(E.parts&&a&&J2(E.parts[0],t))try{const{data:y}=await T2({gateway:E.gateway,coupon:E.coupon,partOrder:E.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:x!=null&&x.authorized?x.id:null,customerEmail:a,recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId()});k=y.data}catch(y){console.error(y)}else try{const{data:y}=await g2({gateway:E.gateway,parts:[...E.parts],coupon:E.coupon,customerEmail:E.customerEmail,referralCode:localStorage.getItem("referralCode"),recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId(),discordSocialConnectId:x!=null&&x.authorized?x.id:null,usePriorityReplacement:E.usePriorityReplacement===!0});k=y.data}catch(y){const D=y,{notifications:S,setNotifications:I}=g.useNotificationStore.getState();I([...S,{message:`Failed to create order: ${D.message}`,status:"error",id:g.v4()}])}if(l(!1),k)return k;throw new Error("Failed to create order")},setDiscordSocialConnectId(_){s(E=>({...E,discordSocialConnectId:_}))},setCustomFields(_){s(E=>({...E,customFields:{..._}}))}};return L.useEffect(()=>{s(_=>({..._,customerEmail:a??""}))},[a,s]),{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,applyCoupon:f,...b}},Zn=()=>{const{notifications:e,setNotifications:t}=g.useNotificationStore();return n=>{navigator.clipboard.writeText(n),t([...e,{status:"success",message:"Successfully copied",id:g.v4()}])}};var Ts={exports:{}},Au={exports:{}},Re={};/** @license React v16.13.1
1
+ "use strict";const g=require("./builder-CnQFO7Gq.cjs"),i=require("react/jsx-runtime"),L=require("react"),N=require("./ui-components-BeqAtEXu.cjs"),nl=require("./builder-components-VjghhiN2.cjs");require("react-dom");const rl=require("./ticket-CYgJNT8X.cjs"),ul=require("./order-CmpxNhN2.cjs"),t2=require("./subscription-CFSduwOC.cjs");function n2(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const me=n2(L),r2=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,al=({children:e,className:t,as:n="span",...r})=>{const[u,a]=L.useState(!1);return L.useEffect(()=>{typeof window<"u"&&a(r2())},[]),u?i.jsx(n,{className:t,...r,"data-stable-text":e,dangerouslySetInnerHTML:{__html:""}}):i.jsx(n,{className:t,...r,children:e})};async function u2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/general`+(e?`?password=${e}`:"");return(await g.request({method:"get",url:r,withToken:!1})).data}const a2=async()=>{const e=g.useApiStore.getState().apiUrls,t=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,n=`${e.storeApi}/v2/shops/${t}/settings-theme`;return await g.request({url:n,withToken:!0,method:"get"})},s2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/balance/top-up/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},i2=async(e,t)=>{const r=`${g.useApiStore.getState().apiUrls.cashappApi}/v1/${t}/cashapp/link`;return await g.request({url:r,method:"post",body:e,withToken:!1})},Nr=async e=>{const t=g.useApiStore.getState().apiUrls;if(!localStorage.getItem("token"))throw new Error("No access token");const r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${t.customersApi}/v2/${r}/customers/${e}`;return await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"})},o2=()=>Nr("dash/info"),sl=()=>Nr("dash/dashboard/home"),c2=()=>Nr("rewards"),l2=()=>Nr("balance"),d2=()=>Nr("balance/top-up/settings"),f2=()=>Nr("referral-system"),Ks=e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/${e}`;return g.request({url:r,withToken:!1,method:"get"})},h2=()=>Ks("terms"),p2=()=>Ks("refund-policy"),m2=()=>Ks("privacy-policy"),Es=10,aa=async({url:e,PageNumber:t})=>{var o;const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.customersApi}/v2/${r}/${e}?PageNumber=${t}&PageSize=${Es}`,a=await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"}),s=Number((o=a.headers)==null?void 0:o["x-pagination-total"]);return{list:a.data,totalCount:s}},sa=async(e,t="get",n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/orders/${u}/${e}`;return await g.request({url:a,method:t,withToken:!0,body:n,typeToken:"customer"})},g2=e=>sa("","post",e),b2=({PageNumber:e})=>aa({url:"customers/orders",PageNumber:e}),_2=e=>sa(e),x2=e=>sa(e),C2=(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v2/orders/${u}/${e}/${t}/replacement-requests`;return g.request({url:a,method:"post",withToken:!0,body:n,typeToken:"customer"})},E2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/public/${n}/images`,u=new FormData;return u.append("file",e),g.request({url:r,method:"post",withToken:!1,body:u})},y2=(e,t,n)=>sa(`${e}/${t}/replacement-requests/${n}/cancel`,"post"),T2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/${n}/subscriptions`;return await g.request({url:r,method:"post",withToken:!1,body:e})},k2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},A2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/${r}/subscriptions/${e}/${t}/upgrades`;return await g.request({url:u,method:"get",withToken:!1})},S2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/${u}/subscriptions/${e}/${t}/cancel`;return await g.request({url:a,method:"post",withToken:!1,body:n})},I2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/change-gateway`;return await g.request({url:u,method:"post",withToken:!1,body:{gateway:t}})},N2=({PageNumber:e})=>aa({url:"customers/subscriptions",PageNumber:e}),v2=async({id:e,accessToken:t})=>await A2(e,t),w2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/order`;return await g.request({url:u,method:"post",withToken:!1,body:t})},D2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/public/${r}/tickets/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},L2=async(e,t,n,r,u,a)=>{const s=g.useApiStore.getState().apiUrls,o=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,c=`${s.slApi}/v1/public/${o}/tickets/${e}/${t}/answer`;return(await g.request({url:c,method:"post",body:{message:n,recaptcha:r,tsId:u,...a&&a.length>0&&{imageIds:a.map(h=>h.imageId)}},withToken:!1})).data},P2=({PageNumber:e})=>aa({url:"customers/tickets",PageNumber:e}),R2=({PageNumber:e})=>aa({url:"customers/balance/transactions",PageNumber:e}),M2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/reviews/${u}/${t}/${n}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},O2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/charges/${n}/${e}`;return await g.request({url:r,method:"get",withToken:!1})},j2=async e=>{const t=g.useApiStore.getState().apiUrls,n=e.map(s=>["names",s]),r=new URLSearchParams(n),u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${t.slApi}/v2/gateways?shopDomain=${u}&${r.toString()}`;return await g.request({url:a,method:"get",withToken:!1})},ku=new Map,il=async e=>{const t=g.useApiStore.getState().apiUrls,r=Array.from(new Set(e)).sort().map(l=>["names",l]),u=new URLSearchParams(r),a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${t.slApi}/v2/checkout?shopDomain=${a}&${u.toString()}`,o=`${s}`;if(ku.has(o))return ku.get(o);const c=g.request({url:s,method:"get",withToken:!1}).catch(l=>{throw ku.delete(o),l});return ku.set(o,c),c},ol=async({email:e,recaptcha:t,tsId:n})=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.customersApi}/v2/${u}/auth/otp/request`;return(await g.request({url:a,body:{email:e,recaptcha:t,tsId:n},method:"post",withToken:!1})).data?{requested:!0,email:e}:{requested:!1,email:void 0}},cl=async({email:e,otp:t,recaptcha:n,tsId:r})=>{const u=g.useApiStore.getState().apiUrls,a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${u.customersApi}/v2/${a}/auth/otp/login`,{data:o}=await g.request({url:s,method:"post",body:{email:e,otp:t,recaptcha:n,tsId:r},withToken:!1});return g.useStorefrontStore.getState().setToken(o.data),localStorage.setItem("token",o.data),{token:o.data,requested:!1}},ys=async()=>{g.useStorefrontStore.getState().setToken(""),g.useCustomerDashboardStore.getState().setDashInfo(null),localStorage.removeItem("token")},F2=Object.freeze(Object.defineProperty({__proto__:null,loginCustomer:cl,logoutCustomer:ys,requestOtp:ol},Symbol.toStringTag,{value:"Module"})),B2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v2/coupons/${n}/validate`;return await g.request({url:r,method:"post",body:e,withToken:!1})},H2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/referral-system/signup`;return(await g.request({url:r,withToken:!0,method:"post",body:e,typeToken:"customer"})).data},U2=async()=>{const{data:e}=await f2();return e},V2=async e=>{const{data:t}=await H2(e);return t},$2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},z2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}/${e.id}?customerEmail=${e.customerEmail}`;return await g.request({url:r,method:"get",withToken:!1})};async function q2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/rewards/${e.id}/claim`;return g.request({url:r,method:"post",withToken:!0,typeToken:"customer"})}const Z2=async(e,t,n,r)=>{const a=`${g.useApiStore.getState().apiUrls.slApi}/v1/vouches/${t}/${n}/${r}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},ll=()=>g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,W2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key`;return g.request({url:n,method:"get",withToken:!0,typeToken:"customer"})},Y2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key/regenerate`;return g.request({url:n,method:"post",withToken:!0,typeToken:"customer"})},Ma="Balance",jn={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},G2={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},Wi=(e,t)=>{var l;const{productId:n,productVariantId:r,quantity:u,chargeType:a}=t,s=e.find(h=>h.id===n);if(!s)throw new Error("Product does not exist");const o=s.variants.find(h=>h.id===r);if(!o)throw new Error("Variant does not exist");if(a==="RECURRING"&&!o.subscriptionSettings)throw new Error("Variant does not have subscription settings");if(u!==void 0&&((l=o.quantity)!=null&&l.available)&&o.quantity.available<u)throw new Error("Not enough quantity available");const c=g.useCartStore.getState().cart;if(c.parts.length>0){const h=e.find(m=>m.id===c.parts[0].productId),f=h==null?void 0:h.variants.find(m=>m.id===c.parts[0].productVariantId);if(f&&o.price.currency!==f.price.currency)throw new Error("Product have different currency")}return o},X2=(e,t)=>{if(!e.volumeDiscounts||e.volumeDiscounts.length===0)return 0;const n=e.volumeDiscounts.filter(u=>t>=u.amount);return n.length===0?0:n.reduce((u,a)=>a.amount>u.amount?a:u).percentage},K2=(e,t)=>{let n=0,r=0;return e.forEach(u=>{var m,p;const a=t.find(b=>(b==null?void 0:b.id)===u.productId),s=a==null?void 0:a.variants.find(b=>b.id===u.productVariantId);if(!s)return;const{gateway:o}=g.useCartStore.getState().cart,c=(s==null?void 0:s.gateways)||[],l=c.some(b=>b.name===o&&b.overrodePrice)?(m=c.find(b=>b.name===o))==null?void 0:m.overrodePrice:null;let h=0,f=0;if(u.chargeType==="ONE_TIME"?(h=(l==null?void 0:l.amount)||(s==null?void 0:s.price.amount)||0,f=h*u.quantity):f=s!=null&&s.subscriptionSettings?s.subscriptionSettings.price.amount+(((p=s.subscriptionSettings.entryFee)==null?void 0:p.amount)||0):0,n+=f,u.chargeType==="ONE_TIME"){const b=X2(s,u.quantity),_=f*(1-b/100);r+=_}else r+=f}),{total:n,totalWithVolumeDiscounts:r}},Q2=(e,t)=>({isRequired:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isRequired}),isEnabled:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isEnabled})}),Yi=e=>new Set(e.gateways.map(t=>t.name)),Oa={availableGateways:[],requiresSignInGateways:[]},Gi=(e,t)=>{if(t.length===0)return Oa;const n=e[0];if(!n)return Oa;const r=t.find(o=>o.id===n.productId),u=r==null?void 0:r.variants.find(o=>o.id===n.productVariantId);if(!u)return Oa;const a=Yi(u);for(const o of e){const c=t.find(f=>f.id===o.productId);if(!c)continue;const l=c.variants.find(f=>f.id===o.productVariantId);if(!l)continue;const h=Yi(l);for(const f of a)h.has(f)||a.delete(f)}return!localStorage.getItem("token")&&a.has(Ma)?(a.delete(Ma),{availableGateways:[...a],requiresSignInGateways:[Ma]}):{availableGateways:[...a],requiresSignInGateways:[]}},Xi=(e,t)=>{if(e.length===0)return[];const r=e.map(a=>{const s=t.find(c=>c.id===a.productId),o=s==null?void 0:s.variants.find(c=>c.id===a.productVariantId);return(o==null?void 0:o.customFields)??[]}).flat().reduce((a,s)=>{const o=a[s.name];return o?(s.required&&!o.required&&(a[s.name]={...s,value:s.defaultValue}),a):(a[s.name]={...s,value:s.defaultValue},a)},{});return Object.values(r).map(a=>({...a,value:""}))},J2=(e,t)=>{const n=t.find(u=>u.id===e.productId),r=n==null?void 0:n.variants.find(u=>u.id===e.productVariantId);return e.chargeType==="RECURRING"?!!(r!=null&&r.subscriptionSettings):!1},du=()=>{const{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,customerEmail:a,setCart:s,setProducts:o,setCoupon:c,setPending:l,setApplyCouponPending:h}=g.useCartStore(),f=async _=>{var M;h(!0);const{cart:E}=g.useCartStore.getState(),{gateway:x,parts:k}=E,{notifications:y,setNotifications:D}=g.useNotificationStore.getState();x||(h(!1),D([...y,{message:"There should be a gateway for the coupon",status:"error",id:g.v4()}]));const S=k.map(H=>H.productId);let I=null;try{const{data:H}=await B2({gateway:x,couponName:_,productIds:S});I=H.data,D([...y,{message:"Coupon is applied",status:"success",id:g.v4()}]),s(U=>({...U,coupon:_}))}catch(H){const U=H;D([...y,{message:`Coupon is not applied: ${U.message}`,status:"error",id:g.v4()}]),s(P=>({...P,coupon:null})),c(null),h(!1)}if(h(!1),(M=I==null?void 0:I.restrictToProductIds)!=null&&M.length&&!S.every(H=>{var U;return(U=I==null?void 0:I.restrictToProductIds)==null?void 0:U.includes(H)}))throw new Error("Coupon can't be applied to such products");return c(I),I},b={reset(){s({...G2})},addProducts:_=>{const E=g.useCartStore.getState().products,x=_.filter(k=>!E.some(y=>y.id===k.id));o([...E,...x])},addProductToCart:_=>{const E=g.useCartStore.getState().cart;try{Wi(t,_)}catch(k){throw new Error(k)}const x=E.parts.find(k=>k.productId===_.productId&&k.productVariantId===_.productVariantId&&k.chargeType===_.chargeType);if(x)return b.updateQuantityOfProduct({...x,quantity:(x.quantity||1)+(_.quantity||1),chargeType:_.chargeType});if(E.parts.length&&Gi([...E.parts,_],t).availableGateways.length===0)throw new Error("No common payment gateways available");s({...E,parts:[...E.parts,_]}),E.coupon&&f(E.coupon)},removeProduct({productId:_,productVariantId:E}){s(x=>({...x,parts:x.parts.filter(k=>k.productId!==_||k.productVariantId!==E)})),e.coupon&&f(e.coupon)},getPossibleGateways(){return Gi(e.parts,t)},removeCoupon(){c(null)},getDiscordSettings(){return Q2(t,e.parts)},updateQuantityOfProduct(_){Wi(t,_),s(E=>({...E,parts:E.parts.map(x=>x.productId===_.productId&&x.productVariantId===_.productVariantId?{...x,quantity:_.quantity,chargeType:_.chargeType}:x)})),e.coupon&&f(e.coupon)},getTotalAndDiscount(){const{coupon:_}=g.useCartStore.getState(),{total:E,totalWithVolumeDiscounts:x}=K2(e.parts,t);let k;const y=x;return _&&_.discount?!_.isFixed&&_.discount===100?k=0:k=_.isFixed?Math.max(0,y-_.discount):y*(1-_.discount/100):x!==E&&(k=x),{total:E,totalWithVolumeDiscounts:x!==E?x:void 0,totalWithDiscount:k}},setGateway(_){s(x=>({...x,gateway:_}));const{isAntistock:E}=g.useGeneralStore.getState();e.coupon&&!E&&f(e.coupon)},setPaymentMethod(_){s(E=>({...E,paymentMethod:_}))},async submitCart(_){l(!0);const{cart:E}=g.useCartStore.getState(),{discordInfo:x}=g.useDiscordStore.getState();let k;if(E.parts&&a&&J2(E.parts[0],t))try{const{data:y}=await T2({gateway:E.gateway,coupon:E.coupon,partOrder:E.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:x!=null&&x.authorized?x.id:null,customerEmail:a,recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId()});k=y.data}catch(y){console.error(y)}else try{const{data:y}=await g2({gateway:E.gateway,parts:[...E.parts],coupon:E.coupon,customerEmail:E.customerEmail,referralCode:localStorage.getItem("referralCode"),recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId(),discordSocialConnectId:x!=null&&x.authorized?x.id:null,usePriorityReplacement:E.usePriorityReplacement===!0});k=y.data}catch(y){const D=y,{notifications:S,setNotifications:I}=g.useNotificationStore.getState();I([...S,{message:`Failed to create order: ${D.message}`,status:"error",id:g.v4()}])}if(l(!1),k)return k;throw new Error("Failed to create order")},setDiscordSocialConnectId(_){s(E=>({...E,discordSocialConnectId:_}))},setCustomFields(_){s(E=>({...E,customFields:{..._}}))}};return L.useEffect(()=>{s(_=>({..._,customerEmail:a??""}))},[a,s]),{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,applyCoupon:f,...b}},Zn=()=>{const{notifications:e,setNotifications:t}=g.useNotificationStore();return n=>{navigator.clipboard.writeText(n),t([...e,{status:"success",message:"Successfully copied",id:g.v4()}])}};var Ts={exports:{}},Au={exports:{}},Re={};/** @license React v16.13.1
2
2
  * react-is.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.