@billgangcom/theme-lib 1.114.0 → 1.114.1

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 (39) hide show
  1. package/dist/{builder-DoAHiGfI.cjs → builder-BVVH9Uc0.cjs} +8 -8
  2. package/dist/{builder-components-DOXVQePh.js → builder-components-BD45uk6H.js} +4 -4
  3. package/dist/{builder-components-B6Q1FJdO.cjs → builder-components-BEFw4EcA.cjs} +1 -1
  4. package/dist/{builder-Bd2jS6z5.js → builder-dGixT-_d.js} +260 -257
  5. package/dist/builder.cjs.js +1 -1
  6. package/dist/builder.es.js +22 -22
  7. package/dist/{charge-By0YRAtN.cjs → charge-DAXMrlAq.cjs} +1 -1
  8. package/dist/{charge-CYkPC1xJ.js → charge-Nfq6BBT0.js} +6 -6
  9. package/dist/{checkout-BacYMk5p.js → checkout-DJA7m9bE.js} +5 -5
  10. package/dist/{checkout-BBaq5eLv.cjs → checkout-DaksJ-vl.cjs} +1 -1
  11. package/dist/exports.cjs.js +1 -1
  12. package/dist/exports.es.js +6 -6
  13. package/dist/{index-B1J6oyyZ.cjs → index-BE-LNEM-.cjs} +1 -1
  14. package/dist/{index-DZVqcJh_.cjs → index-CMngiHt6.cjs} +1 -1
  15. package/dist/{index-DA2EeXd3.js → index-CSYLpXUY.js} +5 -5
  16. package/dist/{index-Dv-y6xYv.js → index-CX9eAqxn.js} +5 -5
  17. package/dist/{index-BCgXuVzB.js → index-CgAhbfol.js} +1 -1
  18. package/dist/{index-CULiMl6h.cjs → index-Cq-HG360.cjs} +1 -1
  19. package/dist/{index-B86a6HK7.cjs → index-CwBlGUFg.cjs} +1 -1
  20. package/dist/{index-C5xaXw2a.cjs → index-CxES4Y2E.cjs} +1 -1
  21. package/dist/{index-DNGCgy8g.js → index-DKVA1wV8.js} +5 -5
  22. package/dist/{index-D14heDcK.js → index-Drs_bUt0.js} +5 -5
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.es.js +6 -6
  25. package/dist/{order-BkDz1lDn.js → order-BiWH1GaD.js} +5 -5
  26. package/dist/{order-BsI3Djg7.cjs → order-EtDX2zwp.cjs} +1 -1
  27. package/dist/{subscription-mYFIz-QI.js → subscription-BsED7sfb.js} +5 -5
  28. package/dist/{subscription-DYa6vxo1.cjs → subscription-DuCTTG3r.cjs} +1 -1
  29. package/dist/{ticket-Djdg5CC8.cjs → ticket-CbHpWM1U.cjs} +1 -1
  30. package/dist/{ticket-ckMFdKTG.js → ticket-D82dpA86.js} +5 -5
  31. package/dist/{top-up-3v6D0_10.js → top-up-CKuuSysp.js} +5 -5
  32. package/dist/{top-up-CuY2N9Qr.cjs → top-up-Czf-dtwC.cjs} +1 -1
  33. package/dist/{ui-components-Bfju659N.js → ui-components-D3S3Wicn.js} +4 -4
  34. package/dist/{ui-components-foi2BEtM.cjs → ui-components-DgahiZcB.cjs} +1 -1
  35. package/dist/ui.cjs.js +1 -1
  36. package/dist/ui.es.js +1 -1
  37. package/dist/{validation-CnxmZXnT.js → validation-BVXpLz7D.js} +5 -5
  38. package/dist/{validation-BSQGHn4r.cjs → validation-otConG8r.cjs} +1 -1
  39. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./builder-DoAHiGfI.cjs"),p=require("./ticket-Djdg5CC8.cjs"),n=require("react"),E=require("./charge-By0YRAtN.cjs"),M=require("./ui-components-foi2BEtM.cjs"),r=require("@phosphor-icons/react"),V=({children:t,shopDomain:d,shopId:u,shopPassword:h,shopLogo:g})=>{const{setShopDomain:x,setShopId:C,setShopPassword:k,setShopTerms:f,setShopPrivacyPolicy:l,setShopRefundPolicy:j,setShopLogo:w}=a.useStorefrontStore();return n.useLayoutEffect(()=>{const s=async()=>{const{data:c}=await E.fetchTerms();f(c)},S=async()=>{const{data:c}=await E.fetchPrivacyPolicy();l(c)},v=async()=>{const{data:c}=await E.fetchRefundPolicy();j(c)};x(d),C(u),h&&k(h),g&&w(g),s(),S(),v()},[d,u,h]),e.jsx(e.Fragment,{children:t})},_="_wrapper_1xuz3_18",L={wrapper:_};function X(){M.registerIcons({X:r.X,Plus:r.Plus,Minus:r.Minus,Check:r.Check,Clock:r.Clock,Info:r.Info,Copy:r.Copy,Trash:r.Trash,Sliders:r.Sliders,Image:r.Image,List:r.List,Handbag:r.Handbag,Bag:r.Bag,Eye:r.Eye,Crown:r.Crown,ArrowUp:r.ArrowUp,ArrowLineUpRight:r.ArrowLineUpRight,CaretRight:r.CaretRight,CaretDown:r.CaretDown,MagnifyingGlass:r.MagnifyingGlass,ArrowLineDown:r.ArrowLineDown,CloudArrowUpIcon:r.CloudArrowUpIcon,CheckCircle:r.CheckCircle,XCircle:r.XCircle,Star:r.Star,Fire:r.Fire,Lightning:r.Lightning,FileText:r.FileText,BookOpen:r.BookOpen,DownloadSimple:r.DownloadSimple,DiscordLogo:r.DiscordLogo,TelegramLogo:r.TelegramLogo,SignOut:r.SignOut,Wallet:r.Wallet,PaperPlaneRight:r.PaperPlaneRight,ChatsTeardrop:r.ChatsTeardrop,DotsSixVertical:r.DotsSixVertical,ArrowLeft:r.ArrowLeft,ArrowRight:r.ArrowRight,Heart:r.Heart,User:r.User,Calendar:r.Calendar,House:r.House,CurrencyCircleDollar:r.CurrencyCircleDollar,Medal:r.Medal,CalendarCheck:r.CalendarCheck,Question:r.Question,Shield:r.Shield,ShieldCheck:r.ShieldCheck,FileCloud:r.FileCloud,Warning:r.Warning,WarningDiamond:r.WarningDiamond})}const G=n.lazy(()=>Promise.resolve().then(()=>require("./builder-DoAHiGfI.cjs")).then(t=>t.index).then(t=>({default:t.BuilderPage}))),N=n.lazy(()=>Promise.resolve().then(()=>require("./index-B1J6oyyZ.cjs")).then(t=>({default:t.ErrorPage}))),Q=n.lazy(()=>Promise.resolve().then(()=>require("./index-B86a6HK7.cjs")).then(t=>({default:t.ActivePage}))),J=n.lazy(()=>Promise.resolve().then(()=>require("./validation-BSQGHn4r.cjs")).then(t=>({default:t.ValidationPage}))),$=n.lazy(()=>Promise.resolve().then(()=>require("./index-C5xaXw2a.cjs")).then(t=>({default:t.WrapperPage}))),K=n.lazy(()=>Promise.resolve().then(()=>require("./index-DZVqcJh_.cjs")).then(t=>({default:t.RouterErrorPage}))),i=n.lazy(()=>Promise.resolve().then(()=>require("./index-CULiMl6h.cjs")).then(t=>({default:t.DynamicErrorPage}))),Y=n.lazy(()=>Promise.resolve().then(()=>require("./checkout-BBaq5eLv.cjs")).then(t=>({default:t.Checkout}))),Z=n.lazy(()=>Promise.resolve().then(()=>require("./charge-By0YRAtN.cjs")).then(t=>t.index$1).then(t=>({default:t.ChargePage}))),ee=n.lazy(()=>Promise.resolve().then(()=>require("./ticket-Djdg5CC8.cjs")).then(t=>t.index).then(t=>({default:t.TicketItem}))),te=n.lazy(()=>Promise.resolve().then(()=>require("./subscription-DYa6vxo1.cjs")).then(t=>t.index).then(t=>({default:t.Subscription}))),re=n.lazy(()=>Promise.resolve().then(()=>require("./top-up-CuY2N9Qr.cjs")).then(t=>({default:t.TopUpBalance}))),ne=n.lazy(()=>Promise.resolve().then(()=>require("./order-BsI3Djg7.cjs")).then(t=>t.index).then(t=>({default:t.OrderPage}))),oe=n.lazy(()=>Promise.resolve().then(()=>require("./charge-By0YRAtN.cjs")).then(t=>t.index).then(t=>({default:t.CustomerDashboard}))),b=n.lazy(()=>Promise.resolve().then(()=>require("./charge-By0YRAtN.cjs")).then(t=>t.recapcha).then(t=>({default:t.ReCaptchaProvider}))),se=()=>null,o=({children:t})=>e.jsx(n.Suspense,{fallback:e.jsx(se,{}),children:t}),ae=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-B6Q1FJdO.cjs")).then(t=>t.index).then(t=>({default:t.RenderAnnouncement}))),T=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-B6Q1FJdO.cjs")).then(t=>t.index).then(t=>({default:t.RenderFooter}))),I=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-B6Q1FJdO.cjs")).then(t=>t.index).then(t=>({default:t.RenderHeader}))),ie=t=>{const{blocks:d,settings:u,header:h,footer:g,announcement:x,routes:C=[],shopLogo:k,apiURLs:f,isAntistock:l=!1}=t,[j,w]=n.useState(null),{general:s,setIsAntistock:S}=a.useGeneralStore(),{setApiUrls:v}=a.useApiStore(),{setBlocks:c,setSourceBlocks:z,setHeader:B,setFooter:F,setAnnouncement:O,setSettings:U}=a.useBlocksStore(),{themeSettings:y}=a.useThemeSettingsStore(),{settings:D,setSettings:H}=a.useSettingsStore(),P=a.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,W=localStorage.getItem("shopPassword"),A=localStorage.getItem("shopId")||"";return n.useEffect(()=>{S(l)},[l,S]),n.useEffect(()=>{!A&&(s!=null&&s.info.id)&&localStorage.setItem("shopId",s==null?void 0:s.info.id)},[s]),n.useEffect(()=>{!P&&!l&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io"),!P&&l&&localStorage.setItem("fakeDomain","eva8.astck.io")},[P]),n.useEffect(()=>{if(y&&D){const m=p.generateDynamicStyles(y,D);p.loadCustomFonts(),p.setupDynamicFonts(y),p.injectStylesToDOM(m)}},[y,JSON.stringify(D),window.location.hostname]),n.useEffect(()=>{const R=new u().blockSettings;H(R)},[]),n.useEffect(()=>{X()},[]),n.useLayoutEffect(()=>{const m={};Object.keys(d).map(q=>{m[q]=d[q]}),z(m),c(m),B(h),F(g),O(x),U(u),f&&v(f);const R=a.createBrowserRouter([{element:e.jsx(V,{shopDomain:P,shopId:A,shopPassword:W||void 0,shopLogo:k,children:e.jsx(b,{children:e.jsx($,{children:e.jsx(a.Outlet,{})})})}),errorElement:e.jsx(o,{children:e.jsx(K,{})}),children:[{path:"/admin/builder/*",element:e.jsx(o,{children:e.jsx(Q,{children:e.jsx(G,{blocks:d,settings:u,header:h,footer:g,announcement:x})})}),errorElement:e.jsx(o,{children:e.jsx(N,{})})},...C,{path:"/checkout",element:e.jsx(o,{children:e.jsx(Y,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsx(o,{children:e.jsx(re,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsx(o,{children:e.jsx(Z,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsx(o,{children:e.jsx(ne,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsx(o,{children:e.jsx(te,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Subscriptions",!0)},{path:l?"/account":"/customer-dash",element:e.jsx(o,{children:e.jsxs("div",{className:L.wrapper,children:[e.jsx(ae,{}),e.jsx(I,{}),e.jsx("div",{style:{flex:"1 1 auto"},children:e.jsx(oe,{})}),e.jsx(T,{})]})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title=l?"Account":"Customer Dashboard",!0)},{path:"/validation",element:e.jsx(o,{children:e.jsx(J,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsx(o,{children:e.jsxs("div",{className:L.wrapper,children:[e.jsx(I,{}),e.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsx(b,{children:e.jsx(ee,{})})}),e.jsx(T,{})]})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsx(p.DynamicRouteWrapper,{}),errorElement:e.jsx(o,{children:e.jsx(i,{})})}]}]);w(R)},[s]),e.jsx(n.Suspense,{fallback:null,children:j&&e.jsx(a.RouterProvider,{router:j})})};exports.App=ie;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./builder-BVVH9Uc0.cjs"),p=require("./ticket-CbHpWM1U.cjs"),n=require("react"),E=require("./charge-DAXMrlAq.cjs"),M=require("./ui-components-DgahiZcB.cjs"),r=require("@phosphor-icons/react"),V=({children:t,shopDomain:d,shopId:u,shopPassword:h,shopLogo:g})=>{const{setShopDomain:x,setShopId:C,setShopPassword:k,setShopTerms:f,setShopPrivacyPolicy:l,setShopRefundPolicy:j,setShopLogo:w}=a.useStorefrontStore();return n.useLayoutEffect(()=>{const s=async()=>{const{data:c}=await E.fetchTerms();f(c)},S=async()=>{const{data:c}=await E.fetchPrivacyPolicy();l(c)},v=async()=>{const{data:c}=await E.fetchRefundPolicy();j(c)};x(d),C(u),h&&k(h),g&&w(g),s(),S(),v()},[d,u,h]),e.jsx(e.Fragment,{children:t})},_="_wrapper_1xuz3_18",L={wrapper:_};function X(){M.registerIcons({X:r.X,Plus:r.Plus,Minus:r.Minus,Check:r.Check,Clock:r.Clock,Info:r.Info,Copy:r.Copy,Trash:r.Trash,Sliders:r.Sliders,Image:r.Image,List:r.List,Handbag:r.Handbag,Bag:r.Bag,Eye:r.Eye,Crown:r.Crown,ArrowUp:r.ArrowUp,ArrowLineUpRight:r.ArrowLineUpRight,CaretRight:r.CaretRight,CaretDown:r.CaretDown,MagnifyingGlass:r.MagnifyingGlass,ArrowLineDown:r.ArrowLineDown,CloudArrowUpIcon:r.CloudArrowUpIcon,CheckCircle:r.CheckCircle,XCircle:r.XCircle,Star:r.Star,Fire:r.Fire,Lightning:r.Lightning,FileText:r.FileText,BookOpen:r.BookOpen,DownloadSimple:r.DownloadSimple,DiscordLogo:r.DiscordLogo,TelegramLogo:r.TelegramLogo,SignOut:r.SignOut,Wallet:r.Wallet,PaperPlaneRight:r.PaperPlaneRight,ChatsTeardrop:r.ChatsTeardrop,DotsSixVertical:r.DotsSixVertical,ArrowLeft:r.ArrowLeft,ArrowRight:r.ArrowRight,Heart:r.Heart,User:r.User,Calendar:r.Calendar,House:r.House,CurrencyCircleDollar:r.CurrencyCircleDollar,Medal:r.Medal,CalendarCheck:r.CalendarCheck,Question:r.Question,Shield:r.Shield,ShieldCheck:r.ShieldCheck,FileCloud:r.FileCloud,Warning:r.Warning,WarningDiamond:r.WarningDiamond})}const G=n.lazy(()=>Promise.resolve().then(()=>require("./builder-BVVH9Uc0.cjs")).then(t=>t.index).then(t=>({default:t.BuilderPage}))),N=n.lazy(()=>Promise.resolve().then(()=>require("./index-BE-LNEM-.cjs")).then(t=>({default:t.ErrorPage}))),Q=n.lazy(()=>Promise.resolve().then(()=>require("./index-CwBlGUFg.cjs")).then(t=>({default:t.ActivePage}))),J=n.lazy(()=>Promise.resolve().then(()=>require("./validation-otConG8r.cjs")).then(t=>({default:t.ValidationPage}))),$=n.lazy(()=>Promise.resolve().then(()=>require("./index-CxES4Y2E.cjs")).then(t=>({default:t.WrapperPage}))),K=n.lazy(()=>Promise.resolve().then(()=>require("./index-CMngiHt6.cjs")).then(t=>({default:t.RouterErrorPage}))),i=n.lazy(()=>Promise.resolve().then(()=>require("./index-Cq-HG360.cjs")).then(t=>({default:t.DynamicErrorPage}))),Y=n.lazy(()=>Promise.resolve().then(()=>require("./checkout-DaksJ-vl.cjs")).then(t=>({default:t.Checkout}))),Z=n.lazy(()=>Promise.resolve().then(()=>require("./charge-DAXMrlAq.cjs")).then(t=>t.index$1).then(t=>({default:t.ChargePage}))),ee=n.lazy(()=>Promise.resolve().then(()=>require("./ticket-CbHpWM1U.cjs")).then(t=>t.index).then(t=>({default:t.TicketItem}))),te=n.lazy(()=>Promise.resolve().then(()=>require("./subscription-DuCTTG3r.cjs")).then(t=>t.index).then(t=>({default:t.Subscription}))),re=n.lazy(()=>Promise.resolve().then(()=>require("./top-up-Czf-dtwC.cjs")).then(t=>({default:t.TopUpBalance}))),ne=n.lazy(()=>Promise.resolve().then(()=>require("./order-EtDX2zwp.cjs")).then(t=>t.index).then(t=>({default:t.OrderPage}))),oe=n.lazy(()=>Promise.resolve().then(()=>require("./charge-DAXMrlAq.cjs")).then(t=>t.index).then(t=>({default:t.CustomerDashboard}))),b=n.lazy(()=>Promise.resolve().then(()=>require("./charge-DAXMrlAq.cjs")).then(t=>t.recapcha).then(t=>({default:t.ReCaptchaProvider}))),se=()=>null,o=({children:t})=>e.jsx(n.Suspense,{fallback:e.jsx(se,{}),children:t}),ae=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-BEFw4EcA.cjs")).then(t=>t.index).then(t=>({default:t.RenderAnnouncement}))),T=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-BEFw4EcA.cjs")).then(t=>t.index).then(t=>({default:t.RenderFooter}))),I=n.lazy(()=>Promise.resolve().then(()=>require("./builder-components-BEFw4EcA.cjs")).then(t=>t.index).then(t=>({default:t.RenderHeader}))),ie=t=>{const{blocks:d,settings:u,header:h,footer:g,announcement:x,routes:C=[],shopLogo:k,apiURLs:f,isAntistock:l=!1}=t,[j,w]=n.useState(null),{general:s,setIsAntistock:S}=a.useGeneralStore(),{setApiUrls:v}=a.useApiStore(),{setBlocks:c,setSourceBlocks:z,setHeader:B,setFooter:F,setAnnouncement:O,setSettings:U}=a.useBlocksStore(),{themeSettings:y}=a.useThemeSettingsStore(),{settings:D,setSettings:H}=a.useSettingsStore(),P=a.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"":window.location.hostname,W=localStorage.getItem("shopPassword"),A=localStorage.getItem("shopId")||"";return n.useEffect(()=>{S(l)},[l,S]),n.useEffect(()=>{!A&&(s!=null&&s.info.id)&&localStorage.setItem("shopId",s==null?void 0:s.info.id)},[s]),n.useEffect(()=>{!P&&!l&&localStorage.setItem("fakeDomain","drafts-ca18cf24-6659-4015-b1ab-9ebe9fa64e74.bgng.io"),!P&&l&&localStorage.setItem("fakeDomain","eva8.astck.io")},[P]),n.useEffect(()=>{if(y&&D){const m=p.generateDynamicStyles(y,D);p.loadCustomFonts(),p.setupDynamicFonts(y),p.injectStylesToDOM(m)}},[y,JSON.stringify(D),window.location.hostname]),n.useEffect(()=>{const R=new u().blockSettings;H(R)},[]),n.useEffect(()=>{X()},[]),n.useLayoutEffect(()=>{const m={};Object.keys(d).map(q=>{m[q]=d[q]}),z(m),c(m),B(h),F(g),O(x),U(u),f&&v(f);const R=a.createBrowserRouter([{element:e.jsx(V,{shopDomain:P,shopId:A,shopPassword:W||void 0,shopLogo:k,children:e.jsx(b,{children:e.jsx($,{children:e.jsx(a.Outlet,{})})})}),errorElement:e.jsx(o,{children:e.jsx(K,{})}),children:[{path:"/admin/builder/*",element:e.jsx(o,{children:e.jsx(Q,{children:e.jsx(G,{blocks:d,settings:u,header:h,footer:g,announcement:x})})}),errorElement:e.jsx(o,{children:e.jsx(N,{})})},...C,{path:"/checkout",element:e.jsx(o,{children:e.jsx(Y,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Checkout",!0)},{path:"/top-up",element:e.jsx(o,{children:e.jsx(re,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Top Up Balance",!0)},{path:"/charges/:id",element:e.jsx(o,{children:e.jsx(Z,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Charges",!0)},{path:"/orders/:id/:accessToken?",element:e.jsx(o,{children:e.jsx(ne,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Orders",!0)},{path:"/subscriptions/:id/:accessToken?",element:e.jsx(o,{children:e.jsx(te,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Subscriptions",!0)},{path:l?"/account":"/customer-dash",element:e.jsx(o,{children:e.jsxs("div",{className:L.wrapper,children:[e.jsx(ae,{}),e.jsx(I,{}),e.jsx("div",{style:{flex:"1 1 auto"},children:e.jsx(oe,{})}),e.jsx(T,{})]})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title=l?"Account":"Customer Dashboard",!0)},{path:"/validation",element:e.jsx(o,{children:e.jsx(J,{})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Validation",!0)},{path:"/ticket/:id/:accessToken",element:e.jsx(o,{children:e.jsxs("div",{className:L.wrapper,children:[e.jsx(I,{}),e.jsx("div",{style:{flex:1,width:"100%",height:"100%"},children:e.jsx(b,{children:e.jsx(ee,{})})}),e.jsx(T,{})]})}),errorElement:e.jsx(o,{children:e.jsx(i,{})}),loader:()=>(document.title="Ticket",!0)},{path:"*",element:e.jsx(p.DynamicRouteWrapper,{}),errorElement:e.jsx(o,{children:e.jsx(i,{})})}]}]);w(R)},[s]),e.jsx(n.Suspense,{fallback:null,children:j&&e.jsx(a.RouterProvider,{router:j})})};exports.App=ie;
@@ -1,9 +1,9 @@
1
1
  import { jsx as t, Fragment as W, jsxs as z } from "react/jsx-runtime";
2
- import { M as j, V as _, j as M, c as V, m as N, a as X, K as G, ai as J, aj as K, ak as Q } from "./builder-Bd2jS6z5.js";
3
- import { f as Y, l as $, j as q, k as Z, D as ee } from "./ticket-ckMFdKTG.js";
2
+ import { M as j, V as _, j as M, c as V, m as N, a as X, K as G, ai as J, aj as K, ak as Q } from "./builder-dGixT-_d.js";
3
+ import { f as Y, l as $, j as q, k as Z, D as ee } from "./ticket-D82dpA86.js";
4
4
  import r, { Suspense as te } from "react";
5
- import { W as re, X as oe, Y as ne } from "./charge-CYkPC1xJ.js";
6
- import { o as ae } from "./ui-components-Bfju659N.js";
5
+ import { W as re, X as oe, Y as ne } from "./charge-Nfq6BBT0.js";
6
+ import { o as ae } from "./ui-components-D3S3Wicn.js";
7
7
  import { WarningDiamond as se, Warning as ie, FileCloud as ce, ShieldCheck as le, Shield as de, Question as he, CalendarCheck as ue, Medal as me, CurrencyCircleDollar as pe, House as fe, Calendar as ge, User as ye, Heart as Se, ArrowRight as ke, ArrowLeft as Pe, DotsSixVertical as Ce, ChatsTeardrop as we, PaperPlaneRight as Ee, Wallet as Re, SignOut as De, TelegramLogo as be, DiscordLogo as ze, DownloadSimple as Ae, BookOpen as Te, FileText as Ie, Lightning as Le, Fire as Be, Star as ve, XCircle as Fe, CheckCircle as Oe, CloudArrowUpIcon as Ue, ArrowLineDown as xe, MagnifyingGlass as He, CaretDown as We, CaretRight as je, ArrowLineUpRight as _e, ArrowUp as Me, Crown as Ve, Eye as Ne, Bag as Xe, Handbag as Ge, List as Je, Image as Ke, Sliders as Qe, Trash as Ye, Copy as $e, Info as qe, Clock as Ze, Check as et, Minus as tt, Plus as rt, X as ot } from "@phosphor-icons/react";
8
8
  const nt = ({
9
9
  children: e,
@@ -103,45 +103,45 @@ function st() {
103
103
  });
104
104
  }
105
105
  const it = r.lazy(
106
- () => import("./builder-Bd2jS6z5.js").then((e) => e.an).then((e) => ({ default: e.BuilderPage }))
106
+ () => import("./builder-dGixT-_d.js").then((e) => e.an).then((e) => ({ default: e.BuilderPage }))
107
107
  ), ct = r.lazy(
108
- () => import("./index-DNGCgy8g.js").then((e) => ({ default: e.ErrorPage }))
108
+ () => import("./index-DKVA1wV8.js").then((e) => ({ default: e.ErrorPage }))
109
109
  ), lt = r.lazy(
110
- () => import("./index-BCgXuVzB.js").then((e) => ({ default: e.ActivePage }))
110
+ () => import("./index-CgAhbfol.js").then((e) => ({ default: e.ActivePage }))
111
111
  ), dt = r.lazy(
112
- () => import("./validation-CnxmZXnT.js").then((e) => ({ default: e.ValidationPage }))
112
+ () => import("./validation-BVXpLz7D.js").then((e) => ({ default: e.ValidationPage }))
113
113
  ), ht = r.lazy(
114
- () => import("./index-D14heDcK.js").then((e) => ({ default: e.WrapperPage }))
114
+ () => import("./index-Drs_bUt0.js").then((e) => ({ default: e.WrapperPage }))
115
115
  ), ut = r.lazy(
116
- () => import("./index-DA2EeXd3.js").then((e) => ({ default: e.RouterErrorPage }))
116
+ () => import("./index-CSYLpXUY.js").then((e) => ({ default: e.RouterErrorPage }))
117
117
  ), a = r.lazy(
118
- () => import("./index-Dv-y6xYv.js").then((e) => ({ default: e.DynamicErrorPage }))
118
+ () => import("./index-CX9eAqxn.js").then((e) => ({ default: e.DynamicErrorPage }))
119
119
  ), mt = r.lazy(
120
- () => import("./checkout-BacYMk5p.js").then((e) => ({ default: e.Checkout }))
120
+ () => import("./checkout-DJA7m9bE.js").then((e) => ({ default: e.Checkout }))
121
121
  ), pt = r.lazy(
122
- () => import("./charge-CYkPC1xJ.js").then((e) => e.a1).then((e) => ({ default: e.ChargePage }))
122
+ () => import("./charge-Nfq6BBT0.js").then((e) => e.a1).then((e) => ({ default: e.ChargePage }))
123
123
  ), ft = r.lazy(
124
- () => import("./ticket-ckMFdKTG.js").then((e) => e.m).then((e) => ({ default: e.TicketItem }))
124
+ () => import("./ticket-D82dpA86.js").then((e) => e.m).then((e) => ({ default: e.TicketItem }))
125
125
  ), gt = r.lazy(
126
- () => import("./subscription-mYFIz-QI.js").then((e) => e.i).then((e) => ({ default: e.Subscription }))
126
+ () => import("./subscription-BsED7sfb.js").then((e) => e.i).then((e) => ({ default: e.Subscription }))
127
127
  ), yt = r.lazy(
128
- () => import("./top-up-3v6D0_10.js").then((e) => ({ default: e.TopUpBalance }))
128
+ () => import("./top-up-CKuuSysp.js").then((e) => ({ default: e.TopUpBalance }))
129
129
  ), St = r.lazy(
130
- () => import("./order-BkDz1lDn.js").then((e) => e.i).then((e) => ({ default: e.OrderPage }))
130
+ () => import("./order-BiWH1GaD.js").then((e) => e.i).then((e) => ({ default: e.OrderPage }))
131
131
  ), kt = r.lazy(
132
- () => import("./charge-CYkPC1xJ.js").then((e) => e.a0).then((e) => ({ default: e.CustomerDashboard }))
132
+ () => import("./charge-Nfq6BBT0.js").then((e) => e.a0).then((e) => ({ default: e.CustomerDashboard }))
133
133
  ), T = r.lazy(
134
- () => import("./charge-CYkPC1xJ.js").then((e) => e.$).then((e) => ({ default: e.ReCaptchaProvider }))
134
+ () => import("./charge-Nfq6BBT0.js").then((e) => e.$).then((e) => ({ default: e.ReCaptchaProvider }))
135
135
  ), Pt = () => null, o = ({ children: e }) => /* @__PURE__ */ t(te, { fallback: /* @__PURE__ */ t(Pt, {}), children: e }), Ct = r.lazy(
136
- () => import("./builder-components-DOXVQePh.js").then((e) => e.i).then((e) => ({
136
+ () => import("./builder-components-BD45uk6H.js").then((e) => e.i).then((e) => ({
137
137
  default: e.RenderAnnouncement
138
138
  }))
139
139
  ), I = r.lazy(
140
- () => import("./builder-components-DOXVQePh.js").then((e) => e.i).then((e) => ({
140
+ () => import("./builder-components-BD45uk6H.js").then((e) => e.i).then((e) => ({
141
141
  default: e.RenderFooter
142
142
  }))
143
143
  ), L = r.lazy(
144
- () => import("./builder-components-DOXVQePh.js").then((e) => e.i).then((e) => ({
144
+ () => import("./builder-components-BD45uk6H.js").then((e) => e.i).then((e) => ({
145
145
  default: e.RenderHeader
146
146
  }))
147
147
  ), Tt = (e) => {
@@ -1,4 +1,4 @@
1
- "use strict";const b=require("./builder-DoAHiGfI.cjs"),i=require("react/jsx-runtime"),P=require("react"),w=require("./ui-components-foi2BEtM.cjs"),Vd=require("./builder-components-B6Q1FJdO.cjs"),Wc=require("./ticket-Djdg5CC8.cjs");require("react-dom");const Yc=require("./order-BsI3Djg7.cjs"),$d=require("./subscription-DYa6vxo1.cjs");function zd(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 le=zd(P),qd=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,Gc=({children:e,className:t,as:n="span",...r})=>{const[u,a]=P.useState(!1);return P.useEffect(()=>{typeof window<"u"&&a(qd())},[]),u?i.jsx(n,{className:t,...r,"data-stable-text":e,dangerouslySetInnerHTML:{__html:""}}):i.jsx(n,{className:t,...r,children:e})};async function Zd(e){const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/general`+(e?`?password=${e}`:"");return(await b.request({method:"get",url:r,withToken:!1})).data}const Wd=async()=>{const e=b.useApiStore.getState().apiUrls,t=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,n=`${e.storeApi}/v2/shops/${t}/settings-theme`;return await b.request({url:n,withToken:!0,method:"get"})},Yd=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/balance/top-up/${n}`;return await b.request({url:r,method:"post",body:e,withToken:!1})},Gd=async(e,t)=>{const r=`${b.useApiStore.getState().apiUrls.cashappApi}/v1/${t}/cashapp/link`;return await b.request({url:r,method:"post",body:e,withToken:!1})},Tr=async e=>{const t=b.useApiStore.getState().apiUrls;if(!localStorage.getItem("token"))throw new Error("No access token");const r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${t.customersApi}/v2/${r}/customers/${e}`;return await b.request({url:u,withToken:!0,method:"get",typeToken:"customer"})},Xd=()=>Tr("dash/info"),Kd=()=>Tr("dash/dashboard/home"),Qd=()=>Tr("rewards"),Jd=()=>Tr("balance"),e2=()=>Tr("balance/top-up/settings"),t2=()=>Tr("referral-system"),zs=e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/${e}`;return b.request({url:r,withToken:!1,method:"get"})},n2=()=>zs("terms"),r2=()=>zs("refund-policy"),u2=()=>zs("privacy-policy"),ms=10,ta=async({url:e,PageNumber:t})=>{var o;const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.customersApi}/v2/${r}/${e}?PageNumber=${t}&PageSize=${ms}`,a=await b.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}},na=async(e,t="get",n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/orders/${u}/${e}`;return await b.request({url:a,method:t,withToken:!0,body:n,typeToken:"customer"})},a2=e=>na("","post",e),s2=({PageNumber:e})=>ta({url:"customers/orders",PageNumber:e}),i2=e=>na(e),o2=e=>na(e),c2=(e,t,n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v2/orders/${u}/${e}/${t}/replacement-requests`;return b.request({url:a,method:"post",withToken:!0,body:n,typeToken:"customer"})},l2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/public/${n}/images`,u=new FormData;return u.append("file",e),b.request({url:r,method:"post",withToken:!1,body:u})},d2=(e,t,n)=>na(`${e}/${t}/replacement-requests/${n}/cancel`,"post"),f2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/${n}/subscriptions`;return await b.request({url:r,method:"post",withToken:!1,body:e})},h2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/${t}`;return await b.request({url:u,method:"get",withToken:!1})},p2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/${r}/subscriptions/${e}/${t}/upgrades`;return await b.request({url:u,method:"get",withToken:!1})},m2=async(e,t,n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/${u}/subscriptions/${e}/${t}/cancel`;return await b.request({url:a,method:"post",withToken:!1,body:n})},g2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/change-gateway`;return await b.request({url:u,method:"post",withToken:!1,body:{gateway:t}})},b2=({PageNumber:e})=>ta({url:"customers/subscriptions",PageNumber:e}),_2=async({id:e,accessToken:t})=>await p2(e,t),x2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/order`;return await b.request({url:u,method:"post",withToken:!1,body:t})},C2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/public/${r}/tickets/${e}/${t}`;return await b.request({url:u,method:"get",withToken:!1})},E2=async(e,t,n,r,u)=>{const a=b.useApiStore.getState().apiUrls,s=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,o=`${a.slApi}/v1/public/${s}/tickets/${e}/${t}/answer`;return(await b.request({url:o,method:"post",body:{message:n,recaptcha:r,tsId:u},withToken:!1})).data},T2=({PageNumber:e})=>ta({url:"customers/tickets",PageNumber:e}),y2=({PageNumber:e})=>ta({url:"customers/balance/transactions",PageNumber:e}),k2=async(e,t,n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/reviews/${u}/${t}/${n}`;return await b.request({url:a,method:"post",withToken:!1,body:e})},A2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/charges/${n}/${e}`;return await b.request({url:r,method:"get",withToken:!1})},S2=async e=>{const t=b.useApiStore.getState().apiUrls,n=e.map(s=>["names",s]),r=new URLSearchParams(n),u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${t.slApi}/v2/gateways?shopDomain=${u}&${r.toString()}`;return await b.request({url:a,method:"get",withToken:!1})},xu=new Map,Xc=async e=>{const t=b.useApiStore.getState().apiUrls,r=Array.from(new Set(e)).sort().map(l=>["names",l]),u=new URLSearchParams(r),a=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${t.slApi}/v2/checkout?shopDomain=${a}&${u.toString()}`,o=`${s}`;if(xu.has(o))return xu.get(o);const c=b.request({url:s,method:"get",withToken:!1}).catch(l=>{throw xu.delete(o),l});return xu.set(o,c),c},Kc=async({email:e,recaptcha:t,tsId:n})=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.customersApi}/v2/${u}/auth/otp/request`;return(await b.request({url:a,body:{email:e,recaptcha:t,tsId:n},method:"post",withToken:!1})).data?{requested:!0,email:e}:{requested:!1,email:void 0}},Qc=async({email:e,otp:t,recaptcha:n,tsId:r})=>{const u=b.useApiStore.getState().apiUrls,a=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${u.customersApi}/v2/${a}/auth/otp/login`,{data:o}=await b.request({url:s,method:"post",body:{email:e,otp:t,recaptcha:n,tsId:r},withToken:!1});return b.useStorefrontStore.getState().setToken(o.data),localStorage.setItem("token",o.data),{token:o.data,requested:!1}},gs=async()=>{b.useStorefrontStore.getState().setToken(""),b.useCustomerDashboardStore.getState().setDashInfo(null),localStorage.removeItem("token")},I2=Object.freeze(Object.defineProperty({__proto__:null,loginCustomer:Qc,logoutCustomer:gs,requestOtp:Kc},Symbol.toStringTag,{value:"Module"})),N2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v2/coupons/${n}/validate`;return await b.request({url:r,method:"post",body:e,withToken:!1})},v2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/referral-system/signup`;return(await b.request({url:r,withToken:!0,method:"post",body:e,typeToken:"customer"})).data},w2=async()=>{const{data:e}=await t2();return e},D2=async e=>{const{data:t}=await v2(e);return t},L2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}`;return await b.request({url:r,method:"post",body:e,withToken:!1})},P2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}/${e.id}?customerEmail=${e.customerEmail}`;return await b.request({url:r,method:"get",withToken:!1})};async function R2(e){const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/rewards/${e.id}/claim`;return b.request({url:r,method:"post",withToken:!0,typeToken:"customer"})}const wa="Balance",Dn={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},O2={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},Bi=(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=b.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},M2=(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},F2=(e,t)=>{let n=0,r=0;return e.forEach(u=>{var m,p;const a=t.find(g=>(g==null?void 0:g.id)===u.productId),s=a==null?void 0:a.variants.find(g=>g.id===u.productVariantId);if(!s)return;const{gateway:o}=b.useCartStore.getState().cart,c=(s==null?void 0:s.gateways)||[],l=c.some(g=>g.name===o&&g.overrodePrice)?(m=c.find(g=>g.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 g=M2(s,u.quantity),x=f*(1-g/100);r+=x}else r+=f}),{total:n,totalWithVolumeDiscounts:r}},B2=(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})}),ji=e=>new Set(e.gateways.map(t=>t.name)),Da={availableGateways:[],requiresSignInGateways:[]},Hi=(e,t)=>{if(t.length===0)return Da;const n=e[0];if(!n)return Da;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 Da;const a=ji(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=ji(l);for(const f of a)h.has(f)||a.delete(f)}return!localStorage.getItem("token")&&a.has(wa)?(a.delete(wa),{availableGateways:[...a],requiresSignInGateways:[wa]}):{availableGateways:[...a],requiresSignInGateways:[]}},Ui=(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},su=()=>{const{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,customerEmail:a,setCart:s,setProducts:o,setCoupon:c,setPending:l,setApplyCouponPending:h}=b.useCartStore(),f=async x=>{var F;h(!0);const{cart:C}=b.useCartStore.getState(),{gateway:_,parts:v}=C,{notifications:y,setNotifications:D}=b.useNotificationStore.getState();_||(h(!1),D([...y,{message:"There should be a gateway for the coupon",status:"error",id:b.v4()}]));const S=v.map(X=>X.productId);let I=null;try{const{data:X}=await N2({gateway:_,couponName:x,productIds:S});I=X.data,D([...y,{message:"Coupon is applied",status:"success",id:b.v4()}]),s(U=>({...U,coupon:x}))}catch(X){const U=X;D([...y,{message:`Coupon is not applied: ${U.message}`,status:"error",id:b.v4()}]),s(L=>({...L,coupon:null})),c(null),h(!1)}if(h(!1),(F=I==null?void 0:I.restrictToProductIds)!=null&&F.length&&!S.every(X=>{var U;return(U=I==null?void 0:I.restrictToProductIds)==null?void 0:U.includes(X)}))throw new Error("Coupon can't be applied to such products");return c(I),I},g={reset(){s({...O2})},addProducts:x=>{const C=b.useCartStore.getState().products,_=x.filter(v=>!C.some(y=>y.id===v.id));o([...C,..._])},addProductToCart:x=>{const C=b.useCartStore.getState().cart;try{Bi(t,x)}catch(v){throw new Error(v)}const _=C.parts.find(v=>v.productId===x.productId&&v.productVariantId===x.productVariantId&&v.chargeType===x.chargeType);if(_)return g.updateQuantityOfProduct({..._,quantity:(_.quantity||1)+(x.quantity||1),chargeType:x.chargeType});if(C.parts.length&&Hi([...C.parts,x],t).availableGateways.length===0)throw new Error("No common payment gateways available");s({...C,parts:[...C.parts,x]}),C.coupon&&f(C.coupon)},removeProduct({productId:x,productVariantId:C}){s(_=>({..._,parts:_.parts.filter(v=>v.productId!==x||v.productVariantId!==C)})),e.coupon&&f(e.coupon)},getPossibleGateways(){return Hi(e.parts,t)},removeCoupon(){c(null)},getDiscordSettings(){return B2(t,e.parts)},updateQuantityOfProduct(x){Bi(t,x),s(C=>({...C,parts:C.parts.map(_=>_.productId===x.productId&&_.productVariantId===x.productVariantId?{..._,quantity:x.quantity,chargeType:x.chargeType}:_)})),e.coupon&&f(e.coupon)},getTotalAndDiscount(){const{coupon:x}=b.useCartStore.getState(),{total:C,totalWithVolumeDiscounts:_}=F2(e.parts,t);let v;const y=_;return x&&x.discount?!x.isFixed&&x.discount===100?v=0:v=x.isFixed?Math.max(0,y-x.discount):y*(1-x.discount/100):_!==C&&(v=_),{total:C,totalWithVolumeDiscounts:_!==C?_:void 0,totalWithDiscount:v}},setGateway(x){s(_=>({..._,gateway:x}));const{isAntistock:C}=b.useGeneralStore.getState();e.coupon&&!C&&f(e.coupon)},setPaymentMethod(x){s(C=>({...C,paymentMethod:x}))},async submitCart(x){l(!0);const{cart:C}=b.useCartStore.getState(),{discordInfo:_}=b.useDiscordStore.getState();let v;if(C.parts&&a&&j2(C.parts[0],t))try{const{data:y}=await f2({gateway:C.gateway,coupon:C.coupon,partOrder:C.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:_!=null&&_.authorized?_.id:null,customerEmail:a,recaptcha:x,customFields:{...C.customFields},tsId:b.useGetTsId()});v=y.data}catch(y){console.error(y)}else try{const{data:y}=await a2({gateway:C.gateway,parts:[...C.parts],coupon:C.coupon,customerEmail:C.customerEmail,referralCode:localStorage.getItem("referralCode"),recaptcha:x,customFields:{...C.customFields},tsId:b.useGetTsId(),discordSocialConnectId:_!=null&&_.authorized?_.id:null,usePriorityReplacement:C.usePriorityReplacement===!0});v=y.data}catch(y){const D=y,{notifications:S,setNotifications:I}=b.useNotificationStore.getState();I([...S,{message:`Failed to create order: ${D.message}`,status:"error",id:b.v4()}])}if(l(!1),v)return v;throw new Error("Failed to create order")},setDiscordSocialConnectId(x){s(C=>({...C,discordSocialConnectId:x}))},setCustomFields(x){s(C=>({...C,customFields:{...x}}))}};return P.useEffect(()=>{s(x=>({...x,customerEmail:a??""}))},[a,s]),{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,applyCoupon:f,...g}},Jn=()=>{const{notifications:e,setNotifications:t}=b.useNotificationStore();return n=>{navigator.clipboard.writeText(n),t([...e,{status:"success",message:"Successfully copied",id:b.v4()}])}};var bs={exports:{}},Cu={exports:{}},Me={};/** @license React v16.13.1
1
+ "use strict";const b=require("./builder-BVVH9Uc0.cjs"),i=require("react/jsx-runtime"),P=require("react"),w=require("./ui-components-DgahiZcB.cjs"),Vd=require("./builder-components-BEFw4EcA.cjs"),Wc=require("./ticket-CbHpWM1U.cjs");require("react-dom");const Yc=require("./order-EtDX2zwp.cjs"),$d=require("./subscription-DuCTTG3r.cjs");function zd(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 le=zd(P),qd=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,Gc=({children:e,className:t,as:n="span",...r})=>{const[u,a]=P.useState(!1);return P.useEffect(()=>{typeof window<"u"&&a(qd())},[]),u?i.jsx(n,{className:t,...r,"data-stable-text":e,dangerouslySetInnerHTML:{__html:""}}):i.jsx(n,{className:t,...r,children:e})};async function Zd(e){const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/general`+(e?`?password=${e}`:"");return(await b.request({method:"get",url:r,withToken:!1})).data}const Wd=async()=>{const e=b.useApiStore.getState().apiUrls,t=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,n=`${e.storeApi}/v2/shops/${t}/settings-theme`;return await b.request({url:n,withToken:!0,method:"get"})},Yd=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/balance/top-up/${n}`;return await b.request({url:r,method:"post",body:e,withToken:!1})},Gd=async(e,t)=>{const r=`${b.useApiStore.getState().apiUrls.cashappApi}/v1/${t}/cashapp/link`;return await b.request({url:r,method:"post",body:e,withToken:!1})},Tr=async e=>{const t=b.useApiStore.getState().apiUrls;if(!localStorage.getItem("token"))throw new Error("No access token");const r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${t.customersApi}/v2/${r}/customers/${e}`;return await b.request({url:u,withToken:!0,method:"get",typeToken:"customer"})},Xd=()=>Tr("dash/info"),Kd=()=>Tr("dash/dashboard/home"),Qd=()=>Tr("rewards"),Jd=()=>Tr("balance"),e2=()=>Tr("balance/top-up/settings"),t2=()=>Tr("referral-system"),zs=e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/${e}`;return b.request({url:r,withToken:!1,method:"get"})},n2=()=>zs("terms"),r2=()=>zs("refund-policy"),u2=()=>zs("privacy-policy"),ms=10,ta=async({url:e,PageNumber:t})=>{var o;const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.customersApi}/v2/${r}/${e}?PageNumber=${t}&PageSize=${ms}`,a=await b.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}},na=async(e,t="get",n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/orders/${u}/${e}`;return await b.request({url:a,method:t,withToken:!0,body:n,typeToken:"customer"})},a2=e=>na("","post",e),s2=({PageNumber:e})=>ta({url:"customers/orders",PageNumber:e}),i2=e=>na(e),o2=e=>na(e),c2=(e,t,n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v2/orders/${u}/${e}/${t}/replacement-requests`;return b.request({url:a,method:"post",withToken:!0,body:n,typeToken:"customer"})},l2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/public/${n}/images`,u=new FormData;return u.append("file",e),b.request({url:r,method:"post",withToken:!1,body:u})},d2=(e,t,n)=>na(`${e}/${t}/replacement-requests/${n}/cancel`,"post"),f2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/${n}/subscriptions`;return await b.request({url:r,method:"post",withToken:!1,body:e})},h2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/${t}`;return await b.request({url:u,method:"get",withToken:!1})},p2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/${r}/subscriptions/${e}/${t}/upgrades`;return await b.request({url:u,method:"get",withToken:!1})},m2=async(e,t,n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/${u}/subscriptions/${e}/${t}/cancel`;return await b.request({url:a,method:"post",withToken:!1,body:n})},g2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/change-gateway`;return await b.request({url:u,method:"post",withToken:!1,body:{gateway:t}})},b2=({PageNumber:e})=>ta({url:"customers/subscriptions",PageNumber:e}),_2=async({id:e,accessToken:t})=>await p2(e,t),x2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/order`;return await b.request({url:u,method:"post",withToken:!1,body:t})},C2=async(e,t)=>{const n=b.useApiStore.getState().apiUrls,r=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/public/${r}/tickets/${e}/${t}`;return await b.request({url:u,method:"get",withToken:!1})},E2=async(e,t,n,r,u)=>{const a=b.useApiStore.getState().apiUrls,s=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,o=`${a.slApi}/v1/public/${s}/tickets/${e}/${t}/answer`;return(await b.request({url:o,method:"post",body:{message:n,recaptcha:r,tsId:u},withToken:!1})).data},T2=({PageNumber:e})=>ta({url:"customers/tickets",PageNumber:e}),y2=({PageNumber:e})=>ta({url:"customers/balance/transactions",PageNumber:e}),k2=async(e,t,n)=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/reviews/${u}/${t}/${n}`;return await b.request({url:a,method:"post",withToken:!1,body:e})},A2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/charges/${n}/${e}`;return await b.request({url:r,method:"get",withToken:!1})},S2=async e=>{const t=b.useApiStore.getState().apiUrls,n=e.map(s=>["names",s]),r=new URLSearchParams(n),u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${t.slApi}/v2/gateways?shopDomain=${u}&${r.toString()}`;return await b.request({url:a,method:"get",withToken:!1})},xu=new Map,Xc=async e=>{const t=b.useApiStore.getState().apiUrls,r=Array.from(new Set(e)).sort().map(l=>["names",l]),u=new URLSearchParams(r),a=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${t.slApi}/v2/checkout?shopDomain=${a}&${u.toString()}`,o=`${s}`;if(xu.has(o))return xu.get(o);const c=b.request({url:s,method:"get",withToken:!1}).catch(l=>{throw xu.delete(o),l});return xu.set(o,c),c},Kc=async({email:e,recaptcha:t,tsId:n})=>{const r=b.useApiStore.getState().apiUrls,u=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.customersApi}/v2/${u}/auth/otp/request`;return(await b.request({url:a,body:{email:e,recaptcha:t,tsId:n},method:"post",withToken:!1})).data?{requested:!0,email:e}:{requested:!1,email:void 0}},Qc=async({email:e,otp:t,recaptcha:n,tsId:r})=>{const u=b.useApiStore.getState().apiUrls,a=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${u.customersApi}/v2/${a}/auth/otp/login`,{data:o}=await b.request({url:s,method:"post",body:{email:e,otp:t,recaptcha:n,tsId:r},withToken:!1});return b.useStorefrontStore.getState().setToken(o.data),localStorage.setItem("token",o.data),{token:o.data,requested:!1}},gs=async()=>{b.useStorefrontStore.getState().setToken(""),b.useCustomerDashboardStore.getState().setDashInfo(null),localStorage.removeItem("token")},I2=Object.freeze(Object.defineProperty({__proto__:null,loginCustomer:Qc,logoutCustomer:gs,requestOtp:Kc},Symbol.toStringTag,{value:"Module"})),N2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v2/coupons/${n}/validate`;return await b.request({url:r,method:"post",body:e,withToken:!1})},v2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/referral-system/signup`;return(await b.request({url:r,withToken:!0,method:"post",body:e,typeToken:"customer"})).data},w2=async()=>{const{data:e}=await t2();return e},D2=async e=>{const{data:t}=await v2(e);return t},L2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}`;return await b.request({url:r,method:"post",body:e,withToken:!1})},P2=async e=>{const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}/${e.id}?customerEmail=${e.customerEmail}`;return await b.request({url:r,method:"get",withToken:!1})};async function R2(e){const t=b.useApiStore.getState().apiUrls,n=b.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/rewards/${e.id}/claim`;return b.request({url:r,method:"post",withToken:!0,typeToken:"customer"})}const wa="Balance",Dn={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},O2={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},Bi=(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=b.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},M2=(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},F2=(e,t)=>{let n=0,r=0;return e.forEach(u=>{var m,p;const a=t.find(g=>(g==null?void 0:g.id)===u.productId),s=a==null?void 0:a.variants.find(g=>g.id===u.productVariantId);if(!s)return;const{gateway:o}=b.useCartStore.getState().cart,c=(s==null?void 0:s.gateways)||[],l=c.some(g=>g.name===o&&g.overrodePrice)?(m=c.find(g=>g.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 g=M2(s,u.quantity),x=f*(1-g/100);r+=x}else r+=f}),{total:n,totalWithVolumeDiscounts:r}},B2=(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})}),ji=e=>new Set(e.gateways.map(t=>t.name)),Da={availableGateways:[],requiresSignInGateways:[]},Hi=(e,t)=>{if(t.length===0)return Da;const n=e[0];if(!n)return Da;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 Da;const a=ji(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=ji(l);for(const f of a)h.has(f)||a.delete(f)}return!localStorage.getItem("token")&&a.has(wa)?(a.delete(wa),{availableGateways:[...a],requiresSignInGateways:[wa]}):{availableGateways:[...a],requiresSignInGateways:[]}},Ui=(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},su=()=>{const{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,customerEmail:a,setCart:s,setProducts:o,setCoupon:c,setPending:l,setApplyCouponPending:h}=b.useCartStore(),f=async x=>{var F;h(!0);const{cart:C}=b.useCartStore.getState(),{gateway:_,parts:v}=C,{notifications:y,setNotifications:D}=b.useNotificationStore.getState();_||(h(!1),D([...y,{message:"There should be a gateway for the coupon",status:"error",id:b.v4()}]));const S=v.map(X=>X.productId);let I=null;try{const{data:X}=await N2({gateway:_,couponName:x,productIds:S});I=X.data,D([...y,{message:"Coupon is applied",status:"success",id:b.v4()}]),s(U=>({...U,coupon:x}))}catch(X){const U=X;D([...y,{message:`Coupon is not applied: ${U.message}`,status:"error",id:b.v4()}]),s(L=>({...L,coupon:null})),c(null),h(!1)}if(h(!1),(F=I==null?void 0:I.restrictToProductIds)!=null&&F.length&&!S.every(X=>{var U;return(U=I==null?void 0:I.restrictToProductIds)==null?void 0:U.includes(X)}))throw new Error("Coupon can't be applied to such products");return c(I),I},g={reset(){s({...O2})},addProducts:x=>{const C=b.useCartStore.getState().products,_=x.filter(v=>!C.some(y=>y.id===v.id));o([...C,..._])},addProductToCart:x=>{const C=b.useCartStore.getState().cart;try{Bi(t,x)}catch(v){throw new Error(v)}const _=C.parts.find(v=>v.productId===x.productId&&v.productVariantId===x.productVariantId&&v.chargeType===x.chargeType);if(_)return g.updateQuantityOfProduct({..._,quantity:(_.quantity||1)+(x.quantity||1),chargeType:x.chargeType});if(C.parts.length&&Hi([...C.parts,x],t).availableGateways.length===0)throw new Error("No common payment gateways available");s({...C,parts:[...C.parts,x]}),C.coupon&&f(C.coupon)},removeProduct({productId:x,productVariantId:C}){s(_=>({..._,parts:_.parts.filter(v=>v.productId!==x||v.productVariantId!==C)})),e.coupon&&f(e.coupon)},getPossibleGateways(){return Hi(e.parts,t)},removeCoupon(){c(null)},getDiscordSettings(){return B2(t,e.parts)},updateQuantityOfProduct(x){Bi(t,x),s(C=>({...C,parts:C.parts.map(_=>_.productId===x.productId&&_.productVariantId===x.productVariantId?{..._,quantity:x.quantity,chargeType:x.chargeType}:_)})),e.coupon&&f(e.coupon)},getTotalAndDiscount(){const{coupon:x}=b.useCartStore.getState(),{total:C,totalWithVolumeDiscounts:_}=F2(e.parts,t);let v;const y=_;return x&&x.discount?!x.isFixed&&x.discount===100?v=0:v=x.isFixed?Math.max(0,y-x.discount):y*(1-x.discount/100):_!==C&&(v=_),{total:C,totalWithVolumeDiscounts:_!==C?_:void 0,totalWithDiscount:v}},setGateway(x){s(_=>({..._,gateway:x}));const{isAntistock:C}=b.useGeneralStore.getState();e.coupon&&!C&&f(e.coupon)},setPaymentMethod(x){s(C=>({...C,paymentMethod:x}))},async submitCart(x){l(!0);const{cart:C}=b.useCartStore.getState(),{discordInfo:_}=b.useDiscordStore.getState();let v;if(C.parts&&a&&j2(C.parts[0],t))try{const{data:y}=await f2({gateway:C.gateway,coupon:C.coupon,partOrder:C.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:_!=null&&_.authorized?_.id:null,customerEmail:a,recaptcha:x,customFields:{...C.customFields},tsId:b.useGetTsId()});v=y.data}catch(y){console.error(y)}else try{const{data:y}=await a2({gateway:C.gateway,parts:[...C.parts],coupon:C.coupon,customerEmail:C.customerEmail,referralCode:localStorage.getItem("referralCode"),recaptcha:x,customFields:{...C.customFields},tsId:b.useGetTsId(),discordSocialConnectId:_!=null&&_.authorized?_.id:null,usePriorityReplacement:C.usePriorityReplacement===!0});v=y.data}catch(y){const D=y,{notifications:S,setNotifications:I}=b.useNotificationStore.getState();I([...S,{message:`Failed to create order: ${D.message}`,status:"error",id:b.v4()}])}if(l(!1),v)return v;throw new Error("Failed to create order")},setDiscordSocialConnectId(x){s(C=>({...C,discordSocialConnectId:x}))},setCustomFields(x){s(C=>({...C,customFields:{...x}}))}};return P.useEffect(()=>{s(x=>({...x,customerEmail:a??""}))},[a,s]),{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,applyCoupon:f,...g}},Jn=()=>{const{notifications:e,setNotifications:t}=b.useNotificationStore();return n=>{navigator.clipboard.writeText(n),t([...e,{status:"success",message:"Successfully copied",id:b.v4()}])}};var bs={exports:{}},Cu={exports:{}},Me={};/** @license React v16.13.1
2
2
  * react-is.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1,13 +1,13 @@
1
- import { j as We, K as je, r as Ye, M as un, N as Wt, O as cn, Q as ms, U as cr, e as Ft, v as Pe, V as Ve, W as gs, p as pn, f as ee, X as Ia, Y as wr, Z as at, _ as Ge, J as nt, $ as It, b as d2, u as f2, a as bs, a0 as h2, a1 as p2, a2 as xu, a3 as Hi, a4 as m2, a5 as Eo, a6 as vl, a7 as _s, a8 as Sa, a9 as g2 } from "./builder-Bd2jS6z5.js";
1
+ import { j as We, K as je, r as Ye, M as un, N as Wt, O as cn, Q as ms, U as cr, e as Ft, v as Pe, V as Ve, W as gs, p as pn, f as ee, X as Ia, Y as wr, Z as at, _ as Ge, J as nt, $ as It, b as d2, u as f2, a as bs, a0 as h2, a1 as p2, a2 as xu, a3 as Hi, a4 as m2, a5 as Eo, a6 as vl, a7 as _s, a8 as Sa, a9 as g2 } from "./builder-dGixT-_d.js";
2
2
  import { jsx as c, jsxs as _, Fragment as He } from "react/jsx-runtime";
3
3
  import * as fe from "react";
4
4
  import q, { useEffect as Ln, forwardRef as wl, createElement as lt, Component as b2, isValidElement as _2, useState as Se, useRef as Er, useCallback as C2, useMemo as nr } from "react";
5
- import { I as H, e as St, f as yn, g as re, S as Dl, M as qt, W as E2, h as Ll, i as y2, j as Na, k as ca, R as T2 } from "./ui-components-Bfju659N.js";
6
- import { F as x2 } from "./builder-components-DOXVQePh.js";
7
- import { T as Pl } from "./ticket-ckMFdKTG.js";
5
+ import { I as H, e as St, f as yn, g as re, S as Dl, M as qt, W as E2, h as Ll, i as y2, j as Na, k as ca, R as T2 } from "./ui-components-D3S3Wicn.js";
6
+ import { F as x2 } from "./builder-components-BD45uk6H.js";
7
+ import { T as Pl } from "./ticket-D82dpA86.js";
8
8
  import "react-dom";
9
- import { O as Rl } from "./order-BkDz1lDn.js";
10
- import { S as k2 } from "./subscription-mYFIz-QI.js";
9
+ import { O as Rl } from "./order-BiWH1GaD.js";
10
+ import { S as k2 } from "./subscription-BsED7sfb.js";
11
11
  const A2 = () => typeof document < "u" ? document.documentElement.hasAttribute("translated") || document.documentElement.querySelector(".translated-ltr, .translated-rtl") !== null || // Safari переводчик добавляет мета-тег с name="_translator"
12
12
  document.head.querySelector('meta[name="_translator"]') !== null : !1, I2 = ({
13
13
  children: e,
@@ -1,10 +1,10 @@
1
1
  import { jsx as e, jsxs as j } from "react/jsx-runtime";
2
- import { u as D, C as N, a as x } from "./charge-CYkPC1xJ.js";
3
- import { V as A, p as G } from "./builder-Bd2jS6z5.js";
2
+ import { u as D, C as N, a as x } from "./charge-Nfq6BBT0.js";
3
+ import { V as A, p as G } from "./builder-dGixT-_d.js";
4
4
  import c from "react";
5
- import { e as P } from "./ui-components-Bfju659N.js";
6
- import "./builder-components-DOXVQePh.js";
7
- import "./ticket-ckMFdKTG.js";
5
+ import { e as P } from "./ui-components-D3S3Wicn.js";
6
+ import "./builder-components-BD45uk6H.js";
7
+ import "./ticket-D82dpA86.js";
8
8
  import "react-dom";
9
9
  const S = "_checkoutContainer_thje1_1", b = "_loaderContainer_thje1_20", s = {
10
10
  checkoutContainer: S,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./charge-By0YRAtN.cjs"),u=require("./builder-DoAHiGfI.cjs"),l=require("react"),_=require("./ui-components-foi2BEtM.cjs");require("./builder-components-B6Q1FJdO.cjs");require("./ticket-Djdg5CC8.cjs");require("react-dom");const b="_checkoutContainer_thje1_1",S="_loaderContainer_thje1_20",s={checkoutContainer:b,loaderContainer:S},D=()=>{const{isAntistock:r}=u.useGeneralStore(),{cart:t,products:c,pending:d,getTotalAndDiscount:C,getPossibleGateways:h,submitCart:p,setGateway:m,applyCoupon:g,setDiscordSocialConnectId:j,setCustomFields:k,applyCouponPending:y,coupon:i,removeCoupon:q,getDiscordSettings:v,setPaymentMethod:x,reset:f}=n.useCart(),a=l.useMemo(()=>C(),[i,t]),o=u.useNavigate();return l.useEffect(()=>{if(t.parts.length===0){if(r){o("/");return}try{o(-1)}catch{o("/")}}},[t.parts]),d?e.jsx("div",{className:s.checkoutContainer,children:e.jsx("div",{className:s.loaderContainer,children:e.jsx(_.Loader,{})})}):e.jsxs("div",{className:s.checkoutContainer,children:[e.jsx(n.CheckoutItems,{cart:t,products:c,applyCoupon:g,applyCouponPending:y,coupon:i,removeCoupon:q,totalAndDiscount:a}),e.jsx(n.CheckoutOperational,{cart:t,getPossibleGateways:h,setGateway:m,getDiscordSettings:v,products:c,submitCart:p,totalAndDiscount:a,setCustomFieldsToCart:k,setDiscordSocialConnectId:j,setPaymentMethod:x,reset:f,isAntistock:r})]})};exports.Checkout=D;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./charge-DAXMrlAq.cjs"),u=require("./builder-BVVH9Uc0.cjs"),l=require("react"),_=require("./ui-components-DgahiZcB.cjs");require("./builder-components-BEFw4EcA.cjs");require("./ticket-CbHpWM1U.cjs");require("react-dom");const b="_checkoutContainer_thje1_1",S="_loaderContainer_thje1_20",s={checkoutContainer:b,loaderContainer:S},D=()=>{const{isAntistock:r}=u.useGeneralStore(),{cart:t,products:c,pending:d,getTotalAndDiscount:C,getPossibleGateways:h,submitCart:p,setGateway:m,applyCoupon:g,setDiscordSocialConnectId:j,setCustomFields:k,applyCouponPending:y,coupon:i,removeCoupon:q,getDiscordSettings:v,setPaymentMethod:x,reset:f}=n.useCart(),a=l.useMemo(()=>C(),[i,t]),o=u.useNavigate();return l.useEffect(()=>{if(t.parts.length===0){if(r){o("/");return}try{o(-1)}catch{o("/")}}},[t.parts]),d?e.jsx("div",{className:s.checkoutContainer,children:e.jsx("div",{className:s.loaderContainer,children:e.jsx(_.Loader,{})})}):e.jsxs("div",{className:s.checkoutContainer,children:[e.jsx(n.CheckoutItems,{cart:t,products:c,applyCoupon:g,applyCouponPending:y,coupon:i,removeCoupon:q,totalAndDiscount:a}),e.jsx(n.CheckoutOperational,{cart:t,getPossibleGateways:h,setGateway:m,getDiscordSettings:v,products:c,submitCart:p,totalAndDiscount:a,setCustomFieldsToCart:k,setDiscordSocialConnectId:j,setPaymentMethod:x,reset:f,isAntistock:r})]})};exports.Checkout=D;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const o=require("./builder-DoAHiGfI.cjs");require("./ui-components-foi2BEtM.cjs");require("./builder-components-B6Q1FJdO.cjs");const t=require("./charge-By0YRAtN.cjs"),e=require("./ticket-Djdg5CC8.cjs"),r=require("./checkout-BBaq5eLv.cjs");require("react-dom");exports.AntistockRoutes=o.AntistockRoutes;exports.Routes=o.Routes;exports.formatPrice=o.formatPrice;exports.MarkdownText=t.MarkdownText;exports.ReCaptchaProvider=t.ReCaptchaProvider;exports.parseDraftJsText=t.parseDraftJsText;exports.useCart=t.useCart;exports.useGeneralInfo=t.useGeneralInfo;exports.useMarkdownIt=t.useMarkdownIt;exports.useReCaptcha=t.useReCaptcha;exports.ColorVariables=e.ColorVariables;exports.aspectRatioOptions=e.aspectRatioOptions;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;exports.removeNotification=e.removeNotification;exports.showNotification=e.showNotification;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useBalance=e.useBalance;exports.useBuilderPages=e.useBuilderPages;exports.useCreateTicket=e.useCreateTicket;exports.Checkout=r.Checkout;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const o=require("./builder-BVVH9Uc0.cjs");require("./ui-components-DgahiZcB.cjs");require("./builder-components-BEFw4EcA.cjs");const t=require("./charge-DAXMrlAq.cjs"),e=require("./ticket-CbHpWM1U.cjs"),r=require("./checkout-DaksJ-vl.cjs");require("react-dom");exports.AntistockRoutes=o.AntistockRoutes;exports.Routes=o.Routes;exports.formatPrice=o.formatPrice;exports.MarkdownText=t.MarkdownText;exports.ReCaptchaProvider=t.ReCaptchaProvider;exports.parseDraftJsText=t.parseDraftJsText;exports.useCart=t.useCart;exports.useGeneralInfo=t.useGeneralInfo;exports.useMarkdownIt=t.useMarkdownIt;exports.useReCaptcha=t.useReCaptcha;exports.ColorVariables=e.ColorVariables;exports.aspectRatioOptions=e.aspectRatioOptions;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;exports.removeNotification=e.removeNotification;exports.showNotification=e.showNotification;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useBalance=e.useBalance;exports.useBuilderPages=e.useBuilderPages;exports.useCreateTicket=e.useCreateTicket;exports.Checkout=r.Checkout;
@@ -1,11 +1,11 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { Y as p, Z as u, _ as c } from "./builder-Bd2jS6z5.js";
4
- import "./ui-components-Bfju659N.js";
5
- import "./builder-components-DOXVQePh.js";
6
- import { M as n, R as f, H as l, u as d, G as x, I as C, F as R } from "./charge-CYkPC1xJ.js";
7
- import { C as k, c as I, h as T, i as v, r as w, d as M, s as N, u as P, e as b, b as A, a as B } from "./ticket-ckMFdKTG.js";
8
- import { Checkout as S } from "./checkout-BacYMk5p.js";
3
+ import { Y as p, Z as u, _ as c } from "./builder-dGixT-_d.js";
4
+ import "./ui-components-D3S3Wicn.js";
5
+ import "./builder-components-BD45uk6H.js";
6
+ import { M as n, R as f, H as l, u as d, G as x, I as C, F as R } from "./charge-Nfq6BBT0.js";
7
+ import { C as k, c as I, h as T, i as v, r as w, d as M, s as N, u as P, e as b, b as A, a as B } from "./ticket-D82dpA86.js";
8
+ import { Checkout as S } from "./checkout-DJA7m9bE.js";
9
9
  import "react-dom";
10
10
  export {
11
11
  p as AntistockRoutes,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("./ui-components-foi2BEtM.cjs");require("react");const s=require("./builder-DoAHiGfI.cjs");require("./builder-components-B6Q1FJdO.cjs");require("./charge-By0YRAtN.cjs");require("./ticket-Djdg5CC8.cjs");require("react-dom");const j="_wrapper_1yd2j_1",w="_error_1yd2j_11",_="_title_1yd2j_21",b="_buttons_1yd2j_29",i={wrapper:j,error:w,title:_,buttons:b},S=async e=>{const o=localStorage.getItem("shopId")||void 0,r=localStorage.getItem("draftId"),d=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${o}/drafts/${r}/reset`;return await s.request({url:d,withToken:!0,method:"post",body:e})},x=()=>{const{error:e,setError:o}=s.useErrorStore(),{pages:r}=s.usePagesStore(),{setIsOpen:c}=s.useModalStore(),{title:d,description:m,setOnConfirm:u,setTitle:g,setDescription:p}=s.useConfirmationModalStore(),{setBlocks:h}=s.useLayersStore();async function y(){await S({resetSettings:(e==null?void 0:e.failedSettings)??!1,resetThemeSettings:(e==null?void 0:e.failedThemeSettings)??!1,resetPageIds:(e==null?void 0:e.failedPageIds)??[]}),o(null),h({}),window.location.reload()}async function f(){const a=[];r&&Object.keys(r).map(n=>r[n].id).filter(n=>n!==void 0).map(n=>a.push(n)),await S({resetSettings:!0,resetThemeSettings:!0,resetPageIds:a}),o(null)}return t.jsxs("div",{className:i.wrapper,children:[t.jsxs("div",{className:i.error,children:[t.jsxs("div",{children:[t.jsx("div",{className:i.title,children:"Oops! Something went wrong"}),t.jsx("span",{className:i.message,children:(e==null?void 0:e.message)||""})]}),t.jsxs("div",{className:i.buttons,children:[t.jsx(l.ButtonSettings,{type:"Primary",onClick:y,children:"Reset Settings"}),t.jsx(l.ButtonSettings,{type:"Secondary",onClick:a=>{a.stopPropagation(),g("Reset All Settings"),p("Are you sure you want to reset all settings? This is irreversible."),u(async()=>{await f()})},children:"Reset All Settings"})]})]}),d&&m&&t.jsx(l.BuilderModal,{close:()=>{c(!1),setTimeout(()=>{g(null),p(null),u(null),c(!0)},300)},children:t.jsx(l.ConfirmationModal,{})})]})};exports.ErrorPage=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("./ui-components-DgahiZcB.cjs");require("react");const s=require("./builder-BVVH9Uc0.cjs");require("./builder-components-BEFw4EcA.cjs");require("./charge-DAXMrlAq.cjs");require("./ticket-CbHpWM1U.cjs");require("react-dom");const j="_wrapper_1yd2j_1",w="_error_1yd2j_11",_="_title_1yd2j_21",b="_buttons_1yd2j_29",i={wrapper:j,error:w,title:_,buttons:b},S=async e=>{const o=localStorage.getItem("shopId")||void 0,r=localStorage.getItem("draftId"),d=`${s.useApiStore.getState().apiUrls.api}/v2/builder/shops/${o}/drafts/${r}/reset`;return await s.request({url:d,withToken:!0,method:"post",body:e})},x=()=>{const{error:e,setError:o}=s.useErrorStore(),{pages:r}=s.usePagesStore(),{setIsOpen:c}=s.useModalStore(),{title:d,description:m,setOnConfirm:u,setTitle:g,setDescription:p}=s.useConfirmationModalStore(),{setBlocks:h}=s.useLayersStore();async function y(){await S({resetSettings:(e==null?void 0:e.failedSettings)??!1,resetThemeSettings:(e==null?void 0:e.failedThemeSettings)??!1,resetPageIds:(e==null?void 0:e.failedPageIds)??[]}),o(null),h({}),window.location.reload()}async function f(){const a=[];r&&Object.keys(r).map(n=>r[n].id).filter(n=>n!==void 0).map(n=>a.push(n)),await S({resetSettings:!0,resetThemeSettings:!0,resetPageIds:a}),o(null)}return t.jsxs("div",{className:i.wrapper,children:[t.jsxs("div",{className:i.error,children:[t.jsxs("div",{children:[t.jsx("div",{className:i.title,children:"Oops! Something went wrong"}),t.jsx("span",{className:i.message,children:(e==null?void 0:e.message)||""})]}),t.jsxs("div",{className:i.buttons,children:[t.jsx(l.ButtonSettings,{type:"Primary",onClick:y,children:"Reset Settings"}),t.jsx(l.ButtonSettings,{type:"Secondary",onClick:a=>{a.stopPropagation(),g("Reset All Settings"),p("Are you sure you want to reset all settings? This is irreversible."),u(async()=>{await f()})},children:"Reset All Settings"})]})]}),d&&m&&t.jsx(l.BuilderModal,{close:()=>{c(!1),setTimeout(()=>{g(null),p(null),u(null),c(!0)},300)},children:t.jsx(l.ConfirmationModal,{})})]})};exports.ErrorPage=x;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("./builder-DoAHiGfI.cjs");const r=require("react"),t=require("./ui-components-foi2BEtM.cjs");require("./builder-components-B6Q1FJdO.cjs");require("./charge-By0YRAtN.cjs");require("./ticket-Djdg5CC8.cjs");require("react-dom");const i=()=>(r.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(t.Loader,{})}));exports.RouterErrorPage=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("./builder-BVVH9Uc0.cjs");const r=require("react"),t=require("./ui-components-DgahiZcB.cjs");require("./builder-components-BEFw4EcA.cjs");require("./charge-DAXMrlAq.cjs");require("./ticket-CbHpWM1U.cjs");require("react-dom");const i=()=>(r.useEffect(()=>{setTimeout(()=>{window.location.reload()},500)},[]),e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(t.Loader,{})}));exports.RouterErrorPage=i;
@@ -1,10 +1,10 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import "./builder-Bd2jS6z5.js";
2
+ import "./builder-dGixT-_d.js";
3
3
  import e from "react";
4
- import { e as r } from "./ui-components-Bfju659N.js";
5
- import "./builder-components-DOXVQePh.js";
6
- import "./charge-CYkPC1xJ.js";
7
- import "./ticket-ckMFdKTG.js";
4
+ import { e as r } from "./ui-components-D3S3Wicn.js";
5
+ import "./builder-components-BD45uk6H.js";
6
+ import "./charge-Nfq6BBT0.js";
7
+ import "./ticket-D82dpA86.js";
8
8
  import "react-dom";
9
9
  const f = () => (e.useEffect(() => {
10
10
  setTimeout(() => {
@@ -1,10 +1,10 @@
1
1
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
- import { g as i } from "./ui-components-Bfju659N.js";
2
+ import { g as i } from "./ui-components-D3S3Wicn.js";
3
3
  import "react";
4
- import { p as s, am as a } from "./builder-Bd2jS6z5.js";
5
- import "./builder-components-DOXVQePh.js";
6
- import "./charge-CYkPC1xJ.js";
7
- import "./ticket-ckMFdKTG.js";
4
+ import { p as s, am as a } from "./builder-dGixT-_d.js";
5
+ import "./builder-components-BD45uk6H.js";
6
+ import "./charge-Nfq6BBT0.js";
7
+ import "./ticket-D82dpA86.js";
8
8
  import "react-dom";
9
9
  const c = "_wrapper_ej209_1", m = "_content_ej209_12", p = "_title_ej209_22", r = {
10
10
  wrapper: c,
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, Fragment as m } from "react/jsx-runtime";
2
- import { ab as d, o as l, m as b, i as u, q as t, z as s } from "./builder-Bd2jS6z5.js";
2
+ import { ab as d, o as l, m as b, i as u, q as t, z as s } from "./builder-dGixT-_d.js";
3
3
  import k from "react";
4
4
  const B = (i) => {
5
5
  const { children: c } = i, { pathname: r } = d(), { setActiveBlock: e } = l(), { setActiveBlock: a } = b(), { setActiveBlock: o } = u();
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./ui-components-foi2BEtM.cjs");require("react");const n=require("./builder-DoAHiGfI.cjs");require("./builder-components-B6Q1FJdO.cjs");require("./charge-By0YRAtN.cjs");require("./ticket-Djdg5CC8.cjs");require("react-dom");const s="_wrapper_ej209_1",c="_content_ej209_12",a="_title_ej209_22",r={wrapper:s,content:c,title:a},l=()=>{const o=n.useNavigate(),t=n.useRouteError();return console.error("ROUTE ERROR: ",t),alert(t),e.jsx("div",{className:r.wrapper,children:e.jsxs("div",{className:r.content,children:[e.jsx("h1",{className:r.title,children:"Something Went Wrong"}),e.jsx(i.Button,{type:"Primary",onClick:()=>{o("/")},children:"Go Home"})]})})};exports.DynamicErrorPage=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./ui-components-DgahiZcB.cjs");require("react");const n=require("./builder-BVVH9Uc0.cjs");require("./builder-components-BEFw4EcA.cjs");require("./charge-DAXMrlAq.cjs");require("./ticket-CbHpWM1U.cjs");require("react-dom");const s="_wrapper_ej209_1",c="_content_ej209_12",a="_title_ej209_22",r={wrapper:s,content:c,title:a},l=()=>{const o=n.useNavigate(),t=n.useRouteError();return console.error("ROUTE ERROR: ",t),alert(t),e.jsx("div",{className:r.wrapper,children:e.jsxs("div",{className:r.content,children:[e.jsx("h1",{className:r.title,children:"Something Went Wrong"}),e.jsx(i.Button,{type:"Primary",onClick:()=>{o("/")},children:"Go Home"})]})})};exports.DynamicErrorPage=l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("./builder-DoAHiGfI.cjs"),o=require("react"),l=r=>{const{children:i}=r,{pathname:a}=e.useLocation(),{setActiveBlock:t}=e.useNavbarStore(),{setActiveBlock:s}=e.useThemeSettingsStore(),{setActiveBlock:n}=e.usePreviewStore();return o.useEffect(()=>{switch(n({id:null,neededScroll:!1}),a){case"/admin/builder":t(e.navbarBlocks[0]);break;case"/admin/builder/add":t(e.navbarBlocks[1]);break;case"/admin/builder/theme":t(e.navbarBlocks[2]);break;case"/admin/builder/settings":t(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[0]);break;case"/admin/builder/theme/fonts":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[1]);break;case"/admin/builder/theme/borders":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[2]);break;case"/admin/builder/theme/buttons":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[3]);break;case"/admin/builder/theme/inputs":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[4]);break}},[a]),c.jsx(c.Fragment,{children:i})};exports.ActivePage=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("./builder-BVVH9Uc0.cjs"),o=require("react"),l=r=>{const{children:i}=r,{pathname:a}=e.useLocation(),{setActiveBlock:t}=e.useNavbarStore(),{setActiveBlock:s}=e.useThemeSettingsStore(),{setActiveBlock:n}=e.usePreviewStore();return o.useEffect(()=>{switch(n({id:null,neededScroll:!1}),a){case"/admin/builder":t(e.navbarBlocks[0]);break;case"/admin/builder/add":t(e.navbarBlocks[1]);break;case"/admin/builder/theme":t(e.navbarBlocks[2]);break;case"/admin/builder/settings":t(e.navbarBlocks[3]);break;case"/admin/builder/theme/colors":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[0]);break;case"/admin/builder/theme/fonts":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[1]);break;case"/admin/builder/theme/borders":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[2]);break;case"/admin/builder/theme/buttons":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[3]);break;case"/admin/builder/theme/inputs":t(e.navbarBlocks[2]),s(e.themeSettingsBlocks[4]);break}},[a]),c.jsx(c.Fragment,{children:i})};exports.ActivePage=l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),P=require("./charge-By0YRAtN.cjs"),t=require("./builder-DoAHiGfI.cjs"),J=require("./ticket-Djdg5CC8.cjs"),g=require("./ui-components-foi2BEtM.cjs");require("./builder-components-B6Q1FJdO.cjs");require("react-dom");const _="_notifications_1ntnm_1",F="_wrapper_1ntnm_12",j={notifications:_,wrapper:F},z=()=>(i.useEffect(()=>{document.title="Temporarily Unavailable"},[]),s.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1",justifyContent:"center",alignItems:"center",gap:"24px"},children:[s.jsx("h2",{style:{color:"var(--text-primary)",fontSize:"var(--font-heading-h2-size)"},children:"Temporarily Unavailable"}),s.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"var(--font-heading-h3-size)",width:"85%",textAlign:"center"},children:"We're making some quick updates to improve your shopping experience. During this time, browsing and checkout are temporarily unavailable."})]})}));function R(){const c=new URLSearchParams(document.location.search),n=c.get("customerAccessToken"),{setToken:d}=t.useStorefrontStore.getState(),{setDashInfo:u}=t.useCustomerDashboardStore.getState();n&&(c.delete("customerAccessToken"),localStorage.setItem("token",n),d(n),u(null))}const U=({children:c})=>{const n=t.useLocation(),{token:d,setToken:u}=t.useStorefrontStore(),{dashInfo:S,setDashInfo:y}=t.useCustomerDashboardStore(),{shopPassword:f}=t.useStorefrontStore(),v=t.useNavigate(),[l,b]=t.useSearchParams(),{notifications:x}=t.useNotificationStore(),[T,h]=i.useState(!0),{setCustomerEmail:I}=t.useCartStore(),{setThemeSettings:w,themeSettings:N}=t.useThemeSettingsStore(),{settings:C,setSettings:k}=t.useSettingsStore(),{setHeader:D,setFooter:q,setAnnouncement:A}=t.useLayersStore(),{general:o,setGeneral:E,isAntistock:p}=t.useGeneralStore(),{pageContext:L,setPageContext:O}=t.usePagesStore();t.useTrackingAnalytics((o==null?void 0:o.info.id)||localStorage.getItem("shopId")||null,"production",p);const W=async()=>{const e=await J.getDynamicPage(encodeURIComponent("/products"),o==null?void 0:o.info.passwordProtected);if(e){const{data:a}=e;O({...L,listings:a.listings})}};return i.useEffect(()=>{R()},[]),i.useEffect(()=>{const e=localStorage.getItem("token");if(e&&(!d||!S))try{const a=t.jwtDecode(e);y(a),u(e),I(a.email)}catch(a){console.error("Failed to decode token:",a),localStorage.removeItem("token"),u(""),y(null)}},[d,S]),i.useEffect(()=>{const e=l.get("r");e&&(localStorage.setItem("referralCode",e),l.delete("r"),b(l),v({pathname:n.pathname,search:l.toString()},{replace:!0}))},[l,n]),i.useEffect(()=>{!n.pathname.startsWith("/products")&&!n.pathname.startsWith("/admin/builder")&&o&&(o.info.passwordProtected&&f||o.isPasswordValid)&&W()},[o,f]),i.useLayoutEffect(()=>{const e=async()=>{if(h(!0),!o){const r=await P.fetchGeneral(f);if(!r.isPasswordValid&&!n.pathname.includes("/admin/builder")){v("/validation",{state:{from:n.pathname}});return}if(!r.info.passwordProtected){localStorage.removeItem("shopPassword");const{setShopPassword:m}=t.useStorefrontStore.getState();m("")}E(r)}},a=async()=>{h(!0);const{settings:r,theme:m}=(await P.fetchThemeAndSettings()).data;r?(r.settings&&k(r.settings),r.header&&D(JSON.parse(JSON.stringify(r.header))),r.footer&&q(JSON.parse(JSON.stringify(r.footer))),r.announcement&&A(JSON.parse(JSON.stringify(r.announcement)))):k(C),w(m||N),h(!1)};n.pathname.startsWith("/validation")||e(),a()},[]),p&&(o!=null&&o.info.onHold)?s.jsx(z,{}):n.pathname.startsWith("/admin/builder")?s.jsx(s.Fragment,{children:c}):s.jsx(s.Fragment,{children:T?s.jsx("div",{className:j.wrapper,children:s.jsx(g.Loader,{})}):s.jsxs(s.Fragment,{children:[c,x.length>0&&s.jsx("div",{className:j.notifications,children:x.map(e=>s.jsx(g.NotificationBuilder,{type:e.status,message:e.message,timer:e.timer||10,id:e.id,element:p?g.NotificationAntistock:e.component,label:e.label},e.id))})]})})};exports.WrapperPage=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),P=require("./charge-DAXMrlAq.cjs"),t=require("./builder-BVVH9Uc0.cjs"),J=require("./ticket-CbHpWM1U.cjs"),g=require("./ui-components-DgahiZcB.cjs");require("./builder-components-BEFw4EcA.cjs");require("react-dom");const _="_notifications_1ntnm_1",F="_wrapper_1ntnm_12",j={notifications:_,wrapper:F},z=()=>(i.useEffect(()=>{document.title="Temporarily Unavailable"},[]),s.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100vw",height:"100vh",overflowY:"scroll",overflowX:"hidden",background:"var(--surface-primary)",color:"var(--text-primary)"},children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1",justifyContent:"center",alignItems:"center",gap:"24px"},children:[s.jsx("h2",{style:{color:"var(--text-primary)",fontSize:"var(--font-heading-h2-size)"},children:"Temporarily Unavailable"}),s.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"var(--font-heading-h3-size)",width:"85%",textAlign:"center"},children:"We're making some quick updates to improve your shopping experience. During this time, browsing and checkout are temporarily unavailable."})]})}));function R(){const c=new URLSearchParams(document.location.search),n=c.get("customerAccessToken"),{setToken:d}=t.useStorefrontStore.getState(),{setDashInfo:u}=t.useCustomerDashboardStore.getState();n&&(c.delete("customerAccessToken"),localStorage.setItem("token",n),d(n),u(null))}const U=({children:c})=>{const n=t.useLocation(),{token:d,setToken:u}=t.useStorefrontStore(),{dashInfo:S,setDashInfo:y}=t.useCustomerDashboardStore(),{shopPassword:f}=t.useStorefrontStore(),v=t.useNavigate(),[l,b]=t.useSearchParams(),{notifications:x}=t.useNotificationStore(),[T,h]=i.useState(!0),{setCustomerEmail:I}=t.useCartStore(),{setThemeSettings:w,themeSettings:N}=t.useThemeSettingsStore(),{settings:C,setSettings:k}=t.useSettingsStore(),{setHeader:D,setFooter:q,setAnnouncement:A}=t.useLayersStore(),{general:o,setGeneral:E,isAntistock:p}=t.useGeneralStore(),{pageContext:L,setPageContext:O}=t.usePagesStore();t.useTrackingAnalytics((o==null?void 0:o.info.id)||localStorage.getItem("shopId")||null,"production",p);const W=async()=>{const e=await J.getDynamicPage(encodeURIComponent("/products"),o==null?void 0:o.info.passwordProtected);if(e){const{data:a}=e;O({...L,listings:a.listings})}};return i.useEffect(()=>{R()},[]),i.useEffect(()=>{const e=localStorage.getItem("token");if(e&&(!d||!S))try{const a=t.jwtDecode(e);y(a),u(e),I(a.email)}catch(a){console.error("Failed to decode token:",a),localStorage.removeItem("token"),u(""),y(null)}},[d,S]),i.useEffect(()=>{const e=l.get("r");e&&(localStorage.setItem("referralCode",e),l.delete("r"),b(l),v({pathname:n.pathname,search:l.toString()},{replace:!0}))},[l,n]),i.useEffect(()=>{!n.pathname.startsWith("/products")&&!n.pathname.startsWith("/admin/builder")&&o&&(o.info.passwordProtected&&f||o.isPasswordValid)&&W()},[o,f]),i.useLayoutEffect(()=>{const e=async()=>{if(h(!0),!o){const r=await P.fetchGeneral(f);if(!r.isPasswordValid&&!n.pathname.includes("/admin/builder")){v("/validation",{state:{from:n.pathname}});return}if(!r.info.passwordProtected){localStorage.removeItem("shopPassword");const{setShopPassword:m}=t.useStorefrontStore.getState();m("")}E(r)}},a=async()=>{h(!0);const{settings:r,theme:m}=(await P.fetchThemeAndSettings()).data;r?(r.settings&&k(r.settings),r.header&&D(JSON.parse(JSON.stringify(r.header))),r.footer&&q(JSON.parse(JSON.stringify(r.footer))),r.announcement&&A(JSON.parse(JSON.stringify(r.announcement)))):k(C),w(m||N),h(!1)};n.pathname.startsWith("/validation")||e(),a()},[]),p&&(o!=null&&o.info.onHold)?s.jsx(z,{}):n.pathname.startsWith("/admin/builder")?s.jsx(s.Fragment,{children:c}):s.jsx(s.Fragment,{children:T?s.jsx("div",{className:j.wrapper,children:s.jsx(g.Loader,{})}):s.jsxs(s.Fragment,{children:[c,x.length>0&&s.jsx("div",{className:j.notifications,children:x.map(e=>s.jsx(g.NotificationBuilder,{type:e.status,message:e.message,timer:e.timer||10,id:e.id,element:p?g.NotificationAntistock:e.component,label:e.label},e.id))})]})})};exports.WrapperPage=U;
@@ -1,10 +1,10 @@
1
1
  import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
- import { B as m, a as w, C as _ } from "./ui-components-Bfju659N.js";
2
+ import { B as m, a as w, C as _ } from "./ui-components-D3S3Wicn.js";
3
3
  import "react";
4
- import { j as I, r as b, s as j, b as v, J as P, k as T, u as k } from "./builder-Bd2jS6z5.js";
5
- import "./builder-components-DOXVQePh.js";
6
- import "./charge-CYkPC1xJ.js";
7
- import "./ticket-ckMFdKTG.js";
4
+ import { j as I, r as b, s as j, b as v, J as P, k as T, u as k } from "./builder-dGixT-_d.js";
5
+ import "./builder-components-BD45uk6H.js";
6
+ import "./charge-Nfq6BBT0.js";
7
+ import "./ticket-D82dpA86.js";
8
8
  import "react-dom";
9
9
  const C = "_wrapper_1yd2j_1", A = "_error_1yd2j_11", N = "_title_1yd2j_21", B = "_buttons_1yd2j_29", i = {
10
10
  wrapper: C,
@@ -1,10 +1,10 @@
1
1
  import { jsx as o, jsxs as N, Fragment as g } from "react/jsx-runtime";
2
2
  import r from "react";
3
- import { V as z, Z as U } from "./charge-CYkPC1xJ.js";
4
- import { M as f, N as T, ab as V, p as F, a6 as G, e as R, O as H, m as M, a as q, u as B, V as X, b as Y, al as Z, ag as K } from "./builder-Bd2jS6z5.js";
5
- import { g as Q } from "./ticket-ckMFdKTG.js";
6
- import { e as $, N as ee, p as te } from "./ui-components-Bfju659N.js";
7
- import "./builder-components-DOXVQePh.js";
3
+ import { V as z, Z as U } from "./charge-Nfq6BBT0.js";
4
+ import { M as f, N as T, ab as V, p as F, a6 as G, e as R, O as H, m as M, a as q, u as B, V as X, b as Y, al as Z, ag as K } from "./builder-dGixT-_d.js";
5
+ import { g as Q } from "./ticket-D82dpA86.js";
6
+ import { e as $, N as ee, p as te } from "./ui-components-D3S3Wicn.js";
7
+ import "./builder-components-BD45uk6H.js";
8
8
  import "react-dom";
9
9
  const se = "_notifications_1ntnm_1", ae = "_wrapper_1ntnm_12", x = {
10
10
  notifications: se,
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./builder.cjs.js"),a=require("./builder-DoAHiGfI.cjs");require("react/jsx-runtime");const c=require("react"),t=require("./ui-components-foi2BEtM.cjs");require("./builder-components-B6Q1FJdO.cjs");const r=require("./charge-By0YRAtN.cjs"),e=require("./ticket-Djdg5CC8.cjs");require("react-dom");function u(o){c.useEffect(()=>{Object.entries(o).forEach(([s,i])=>{t.registerIcon(s,i)})},[o])}function g(o){Object.entries(o).forEach(([s,i])=>{t.registerIcon(s,i)})}exports.App=n.App;exports.AntistockRoutes=a.AntistockRoutes;exports.Routes=a.Routes;exports.formatPrice=a.formatPrice;exports.Icon=t.Icon;exports.getRegisteredIcon=t.getRegisteredIcon;exports.getRegisteredIcons=t.getRegisteredIcons;exports.isIconRegistered=t.isIconRegistered;exports.registerIcon=t.registerIcon;exports.MarkdownText=r.MarkdownText;exports.ReCaptchaProvider=r.ReCaptchaProvider;exports.parseDraftJsText=r.parseDraftJsText;exports.useCart=r.useCart;exports.useGeneralInfo=r.useGeneralInfo;exports.useMarkdownIt=r.useMarkdownIt;exports.useReCaptcha=r.useReCaptcha;exports.ColorVariables=e.ColorVariables;exports.aspectRatioOptions=e.aspectRatioOptions;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;exports.removeNotification=e.removeNotification;exports.showNotification=e.showNotification;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useBalance=e.useBalance;exports.useBuilderPages=e.useBuilderPages;exports.useCreateTicket=e.useCreateTicket;exports.registerIcons=g;exports.useIconRegistration=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./builder.cjs.js"),a=require("./builder-BVVH9Uc0.cjs");require("react/jsx-runtime");const c=require("react"),t=require("./ui-components-DgahiZcB.cjs");require("./builder-components-BEFw4EcA.cjs");const r=require("./charge-DAXMrlAq.cjs"),e=require("./ticket-CbHpWM1U.cjs");require("react-dom");function u(o){c.useEffect(()=>{Object.entries(o).forEach(([s,i])=>{t.registerIcon(s,i)})},[o])}function g(o){Object.entries(o).forEach(([s,i])=>{t.registerIcon(s,i)})}exports.App=n.App;exports.AntistockRoutes=a.AntistockRoutes;exports.Routes=a.Routes;exports.formatPrice=a.formatPrice;exports.Icon=t.Icon;exports.getRegisteredIcon=t.getRegisteredIcon;exports.getRegisteredIcons=t.getRegisteredIcons;exports.isIconRegistered=t.isIconRegistered;exports.registerIcon=t.registerIcon;exports.MarkdownText=r.MarkdownText;exports.ReCaptchaProvider=r.ReCaptchaProvider;exports.parseDraftJsText=r.parseDraftJsText;exports.useCart=r.useCart;exports.useGeneralInfo=r.useGeneralInfo;exports.useMarkdownIt=r.useMarkdownIt;exports.useReCaptcha=r.useReCaptcha;exports.ColorVariables=e.ColorVariables;exports.aspectRatioOptions=e.aspectRatioOptions;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;exports.removeNotification=e.removeNotification;exports.showNotification=e.showNotification;exports.splitTextIntoSpans=e.splitTextIntoSpans;exports.useAdaptiveStyles=e.useAdaptiveStyles;exports.useBalance=e.useBalance;exports.useBuilderPages=e.useBuilderPages;exports.useCreateTicket=e.useCreateTicket;exports.registerIcons=g;exports.useIconRegistration=u;
package/dist/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { App as R } from "./builder.es.js";
2
- import { Y as g, Z as l, _ as x } from "./builder-Bd2jS6z5.js";
2
+ import { Y as g, Z as l, _ as x } from "./builder-dGixT-_d.js";
3
3
  import "react/jsx-runtime";
4
4
  import { useEffect as o } from "react";
5
- import { r as t } from "./ui-components-Bfju659N.js";
6
- import { I as C, l as b, n as k, m as T } from "./ui-components-Bfju659N.js";
7
- import "./builder-components-DOXVQePh.js";
8
- import { M as w, R as A, H as E, u as M, G as N, I as O, F as P } from "./charge-CYkPC1xJ.js";
9
- import { C as B, c as G, h as S, i as y, r as D, d as F, s as H, u as J, e as V, b as Y, a as Z } from "./ticket-ckMFdKTG.js";
5
+ import { r as t } from "./ui-components-D3S3Wicn.js";
6
+ import { I as C, l as b, n as k, m as T } from "./ui-components-D3S3Wicn.js";
7
+ import "./builder-components-BD45uk6H.js";
8
+ import { M as w, R as A, H as E, u as M, G as N, I as O, F as P } from "./charge-Nfq6BBT0.js";
9
+ import { C as B, c as G, h as S, i as y, r as D, d as F, s as H, u as J, e as V, b as Y, a as Z } from "./ticket-D82dpA86.js";
10
10
  import "react-dom";
11
11
  function f(e) {
12
12
  o(() => {
@@ -1,10 +1,10 @@
1
1
  import { jsx as t, Fragment as B, jsxs as s } from "react/jsx-runtime";
2
2
  import i, { useState as E } from "react";
3
- import { X as V, p as F, M as j, V as W, a7 as q } from "./builder-Bd2jS6z5.js";
4
- import { f as G, N as U, P as z, O as H, g as J, b as X, c as P, d as Y, e as K, h as Q, L as Z, T as ee, i as L, j as te, k as ne, l as ae, m as oe, n as se } from "./charge-CYkPC1xJ.js";
5
- import { M as ce, I as x, g as S, e as ie } from "./ui-components-Bfju659N.js";
6
- import "./builder-components-DOXVQePh.js";
7
- import "./ticket-ckMFdKTG.js";
3
+ import { X as V, p as F, M as j, V as W, a7 as q } from "./builder-dGixT-_d.js";
4
+ import { f as G, N as U, P as z, O as H, g as J, b as X, c as P, d as Y, e as K, h as Q, L as Z, T as ee, i as L, j as te, k as ne, l as ae, m as oe, n as se } from "./charge-Nfq6BBT0.js";
5
+ import { M as ce, I as x, g as S, e as ie } from "./ui-components-D3S3Wicn.js";
6
+ import "./builder-components-BD45uk6H.js";
7
+ import "./ticket-D82dpA86.js";
8
8
  import "react-dom";
9
9
  const re = async (a = 1) => await G({ PageNumber: a }), ze = () => {
10
10
  const [a, r] = i.useState(null), [u, e] = E(null), [h, k] = i.useState(0), { page: g } = V(), [y, _] = i.useState(!0);
@@ -1 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),c=require("react"),x=require("./builder-DoAHiGfI.cjs"),o=require("./charge-By0YRAtN.cjs"),h=require("./ui-components-foi2BEtM.cjs");require("./builder-components-B6Q1FJdO.cjs");require("./ticket-Djdg5CC8.cjs");require("react-dom");const $=async(s=1)=>await o.fetchOrders({PageNumber:s}),F=()=>{const[s,i]=c.useState(null),[d,e]=c.useState(null),[g,j]=c.useState(0),{page:_}=x.usePaginationPagesStore(),[k,f]=c.useState(!0);async function C(){f(!0);const{list:p,totalCount:y}=await $(_);i(p),j(y),e(null),f(!1)}async function r(){const p=(s==null?void 0:s.map(S=>S.gatewayName))||[],y=await o.getGatewaysDetail(p);e(y)}return c.useEffect(()=>{!d&&s&&r()},[s,d]),c.useEffect(()=>{C()},[_]),t.jsx(t.Fragment,{children:s!=null&&s.length&&s.length===0?t.jsx(o.NoItemsBlock,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):t.jsxs(t.Fragment,{children:[t.jsx(o.PageTitle,{title:"Orders"}),t.jsx(o.OrdersTable,{orders:s,gatewaysDetail:d,totalCount:g,isLoading:k})]})})},M="_orderPage_gc87l_1",T="_leftSection_gc87l_15",L="_content_gc87l_35",q="_main_gc87l_42",W="_mainAntistock_gc87l_56",E="_orderMainDataAntistock_gc87l_69",G="_timelineBlockAntistock_gc87l_81",V="_footerAntistock_gc87l_92",U="_statusBlock_gc87l_104",z="_timelineBlock_gc87l_81",H="_footer_gc87l_92",J="_rightSection_gc87l_121",Y="_header_gc87l_142",K="_productList_gc87l_150",Q="_mobileFooter_gc87l_157",X="_loaderContainer_gc87l_166",Z="_orderMainData_gc87l_69",ee="_prices_gc87l_181",te="_headerTitle_gc87l_185",ne="_headerDescription_gc87l_189",a={orderPage:M,leftSection:T,content:L,main:q,mainAntistock:W,orderMainDataAntistock:E,timelineBlockAntistock:G,footerAntistock:V,statusBlock:U,timelineBlock:z,footer:H,rightSection:J,header:Y,productList:K,mobileFooter:Q,loaderContainer:X,orderMainData:Z,prices:ee,headerTitle:te,headerDescription:ne},se="_modalContent_1a05n_1",ae="_iconContainer_1a05n_16",oe="_warningIcon_1a05n_20",ce="_title_1a05n_25",re="_description_1a05n_33",ie="_buttonContainer_1a05n_40",le="_button_1a05n_40",u={modalContent:se,iconContainer:ae,warningIcon:oe,title:ce,description:re,buttonContainer:ie,button:le},ue=({isOpen:s,onClose:i,refundedAmount:d,currency:e})=>{const g=x.useNavigate(),{token:j,shopDomain:_}=x.useStorefrontStore(),{isAntistock:k}=x.useGeneralStore(),f=new Intl.NumberFormat("en-US",{style:"currency",currency:e}),C=()=>{g(k?"/account":"/customer-dash")},r=async()=>{k?window.open(`https://${_}/support`):g("/contact")},p=()=>{i()};return s?t.jsx(h.Modal,{close:i,children:t.jsxs("div",{className:u.modalContent,onClick:y=>y.stopPropagation(),children:[t.jsx("div",{className:u.iconContainer,children:t.jsx(h.Icon,{name:"WarningDiamond",fill:"var(--text-warning)",className:u.warningIcon})}),t.jsx("h2",{className:u.title,children:"Partial Delivery Failure Refund"}),t.jsxs("p",{className:u.description,children:["Your payment was successful but a few products were out of stock. We've automatically refunded the products that were out of stock, with a total of"," ",f.format(d),", to your account balance."]}),t.jsxs("div",{className:u.buttonContainer,children:[!j&&t.jsx(h.Button,{type:"Secondary",onClick:C,className:u.button,children:"Login"}),t.jsx(h.Button,{type:"Secondary",onClick:r,className:u.button,children:"Contact Support"}),t.jsx(h.Button,{type:"Primary",onClick:p,className:u.button,children:"Continue"})]})]})}):null},de=()=>{var O,P,D,A,R,I;const{id:s,accessToken:i}=x.useParams(),d=x.useNavigate(),[e,g]=c.useState(),[j,_]=c.useState(!1),[k,f]=c.useState(!1),C=o.useCopy(),{isAntistock:r}=x.useGeneralStore(),p=((O=e==null?void 0:e.rawPrice)==null?void 0:O.currency)||"USD",y=new Intl.NumberFormat("en-US",{style:"currency",currency:p}),S=c.useMemo(()=>(e==null?void 0:e.partOrders.map(n=>{var N,w;return{id:(n==null?void 0:n.id)||0,image:n.productWithVariant.image,name:(()=>{var v,B;const l=((v=n.productWithVariant)==null?void 0:v.name)||"",m=((B=n.productWithVariant)==null?void 0:B.variantName)||"";return!l&&!m?"":!m||l===m?l:l?`${l} (${m})`:m})(),description:"",price:{quantity:n.quantity,amount:((N=n.productWithVariant)==null?void 0:N.price.amount)||0,currency:(w=n.productWithVariant)==null?void 0:w.price.currency},deliveryCategories:"deliveryCategories"in n?n.deliveryCategories:void 0,customerNote:n.customerNote,chargeType:n.chargeType||"ONE_TIME",replacementRequests:"replacementRequests"in n?n.replacementRequests:void 0,allowedReplacementReasons:"allowedReplacementReasons"in n?n.allowedReplacementReasons:void 0}}))||[],[e]);c.useEffect(()=>{e&&(e.status===o.OrderStatus.FullDeliveryFailure||e.status===o.OrderStatus.PartiallyDelivered)&&e.refundedPrice&&e.refundedPrice.amount>0&&f(!0)},[e==null?void 0:e.status]);const b=async(n,N,w=!1)=>{var m,v;w||_(!0);const{data:l}=await(N?o.fetchAuthorizedOrder(`${n}/${N}`):o.fetchOrder(n));_(!1),l.status!==o.OrderStatus.Completed&&((m=l.charge)==null?void 0:m.status)===o.ChargeStatus.NotPaid&&d(`/charges/${(v=l.charge)==null?void 0:v.id}`,{replace:!0}),g(l)};return c.useLayoutEffect(()=>{if(s&&!i){const n=JSON.parse(localStorage.getItem("orders")||"{}");n[s]&&d(`/orders/${s}/${n[s].fullAccessToken}`)}},[s]),c.useEffect(()=>{s&&b(s,i,!0);const n=setInterval(()=>{s&&b(s,i,!0)},5e3);return()=>{clearInterval(n)}},[s,i]),j?t.jsx("div",{className:a.loaderContainer,children:t.jsx(h.Loader,{})}):t.jsxs("div",{className:a.orderPage,children:[t.jsx("div",{className:a.leftSection,children:t.jsxs("div",{className:a.content,children:[t.jsx(o.CheckoutHeader,{}),e&&t.jsxs("div",{className:`${a.main} ${r?a.mainAntistock:""}`,children:[t.jsx(o.OrderStatusBlock,{className:a.statusBlock,orderStatus:e.status}),t.jsxs("div",{className:`${a.orderMainData} ${r?a.orderMainDataAntistock:""}`,children:[t.jsx(o.CheckoutOrderMainData,{lastUpdate:e.createdAt,paymentType:(P=e.charge)==null?void 0:P.gateway,email:e.customer?e.customer.email:((D=e.charge)==null?void 0:D.customerForCharge.email)||"",orderId:e.id}),"accessToken"in e.review&&!r&&t.jsx(o.LeaveAReview,{orderId:e.id,review:e.review})]}),e.charge&&e.charge.timeline&&t.jsx(o.TrackPayment,{className:`${a.timelineBlock} ${r?a.timelineBlockAntistock:""}`,timeline:e.charge.timeline}),t.jsx(o.CheckoutFooter,{className:`${a.footer} ${r?a.footerAntistock:""}`})]})]})}),t.jsx("div",{className:a.rightSection,style:r?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:t.jsxs("div",{className:a.content,children:[((A=e==null?void 0:e.charge)==null?void 0:A.name)&&t.jsxs("header",{className:a.header,children:[t.jsxs("div",{children:[t.jsx("h1",{className:a.headerTitle,children:e.charge.name}),e.charge.description&&t.jsx("p",{className:a.headerDescription,children:e.charge.description})]}),r?null:t.jsxs(h.Button,{type:"Secondary",onClick:()=>C((e==null?void 0:e.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx(h.Icon,{name:"Copy"}),t.jsx("span",{children:"Copy ID"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:a.productList,children:S.map(n=>t.jsx(o.CheckoutProduct,{product:n,isOrder:!0,isApplicableForReplacement:e==null?void 0:e.isApplicableForReplacement,orderId:s,accessToken:i,allowedReplacementReasons:e==null?void 0:e.allowedReplacementReasons},n.id))}),r?null:t.jsx(o.CheckoutPrices,{formatter:y,coupon:null,total:((R=e==null?void 0:e.endPrice)==null?void 0:R.amount)||0,discount:0,totalWithDiscount:((I=e==null?void 0:e.endPrice)==null?void 0:I.amount)||0,className:a.prices,isShowSubtotal:!1}),t.jsx(o.CheckoutFooter,{className:a.mobileFooter})]})]})}),(e==null?void 0:e.refundedPrice)&&t.jsx(ue,{isOpen:k,onClose:()=>f(!1),refundedAmount:e.refundedPrice.amount,currency:e.refundedPrice.currency})]})},me=Object.freeze(Object.defineProperty({__proto__:null,OrderPage:de},Symbol.toStringTag,{value:"Module"}));exports.Orders=F;exports.index=me;
1
+ "use strict";const t=require("react/jsx-runtime"),c=require("react"),x=require("./builder-BVVH9Uc0.cjs"),o=require("./charge-DAXMrlAq.cjs"),h=require("./ui-components-DgahiZcB.cjs");require("./builder-components-BEFw4EcA.cjs");require("./ticket-CbHpWM1U.cjs");require("react-dom");const $=async(s=1)=>await o.fetchOrders({PageNumber:s}),F=()=>{const[s,i]=c.useState(null),[d,e]=c.useState(null),[g,j]=c.useState(0),{page:_}=x.usePaginationPagesStore(),[k,f]=c.useState(!0);async function C(){f(!0);const{list:p,totalCount:y}=await $(_);i(p),j(y),e(null),f(!1)}async function r(){const p=(s==null?void 0:s.map(S=>S.gatewayName))||[],y=await o.getGatewaysDetail(p);e(y)}return c.useEffect(()=>{!d&&s&&r()},[s,d]),c.useEffect(()=>{C()},[_]),t.jsx(t.Fragment,{children:s!=null&&s.length&&s.length===0?t.jsx(o.NoItemsBlock,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):t.jsxs(t.Fragment,{children:[t.jsx(o.PageTitle,{title:"Orders"}),t.jsx(o.OrdersTable,{orders:s,gatewaysDetail:d,totalCount:g,isLoading:k})]})})},M="_orderPage_gc87l_1",T="_leftSection_gc87l_15",L="_content_gc87l_35",q="_main_gc87l_42",W="_mainAntistock_gc87l_56",E="_orderMainDataAntistock_gc87l_69",G="_timelineBlockAntistock_gc87l_81",V="_footerAntistock_gc87l_92",U="_statusBlock_gc87l_104",z="_timelineBlock_gc87l_81",H="_footer_gc87l_92",J="_rightSection_gc87l_121",Y="_header_gc87l_142",K="_productList_gc87l_150",Q="_mobileFooter_gc87l_157",X="_loaderContainer_gc87l_166",Z="_orderMainData_gc87l_69",ee="_prices_gc87l_181",te="_headerTitle_gc87l_185",ne="_headerDescription_gc87l_189",a={orderPage:M,leftSection:T,content:L,main:q,mainAntistock:W,orderMainDataAntistock:E,timelineBlockAntistock:G,footerAntistock:V,statusBlock:U,timelineBlock:z,footer:H,rightSection:J,header:Y,productList:K,mobileFooter:Q,loaderContainer:X,orderMainData:Z,prices:ee,headerTitle:te,headerDescription:ne},se="_modalContent_1a05n_1",ae="_iconContainer_1a05n_16",oe="_warningIcon_1a05n_20",ce="_title_1a05n_25",re="_description_1a05n_33",ie="_buttonContainer_1a05n_40",le="_button_1a05n_40",u={modalContent:se,iconContainer:ae,warningIcon:oe,title:ce,description:re,buttonContainer:ie,button:le},ue=({isOpen:s,onClose:i,refundedAmount:d,currency:e})=>{const g=x.useNavigate(),{token:j,shopDomain:_}=x.useStorefrontStore(),{isAntistock:k}=x.useGeneralStore(),f=new Intl.NumberFormat("en-US",{style:"currency",currency:e}),C=()=>{g(k?"/account":"/customer-dash")},r=async()=>{k?window.open(`https://${_}/support`):g("/contact")},p=()=>{i()};return s?t.jsx(h.Modal,{close:i,children:t.jsxs("div",{className:u.modalContent,onClick:y=>y.stopPropagation(),children:[t.jsx("div",{className:u.iconContainer,children:t.jsx(h.Icon,{name:"WarningDiamond",fill:"var(--text-warning)",className:u.warningIcon})}),t.jsx("h2",{className:u.title,children:"Partial Delivery Failure Refund"}),t.jsxs("p",{className:u.description,children:["Your payment was successful but a few products were out of stock. We've automatically refunded the products that were out of stock, with a total of"," ",f.format(d),", to your account balance."]}),t.jsxs("div",{className:u.buttonContainer,children:[!j&&t.jsx(h.Button,{type:"Secondary",onClick:C,className:u.button,children:"Login"}),t.jsx(h.Button,{type:"Secondary",onClick:r,className:u.button,children:"Contact Support"}),t.jsx(h.Button,{type:"Primary",onClick:p,className:u.button,children:"Continue"})]})]})}):null},de=()=>{var O,P,D,A,R,I;const{id:s,accessToken:i}=x.useParams(),d=x.useNavigate(),[e,g]=c.useState(),[j,_]=c.useState(!1),[k,f]=c.useState(!1),C=o.useCopy(),{isAntistock:r}=x.useGeneralStore(),p=((O=e==null?void 0:e.rawPrice)==null?void 0:O.currency)||"USD",y=new Intl.NumberFormat("en-US",{style:"currency",currency:p}),S=c.useMemo(()=>(e==null?void 0:e.partOrders.map(n=>{var N,w;return{id:(n==null?void 0:n.id)||0,image:n.productWithVariant.image,name:(()=>{var v,B;const l=((v=n.productWithVariant)==null?void 0:v.name)||"",m=((B=n.productWithVariant)==null?void 0:B.variantName)||"";return!l&&!m?"":!m||l===m?l:l?`${l} (${m})`:m})(),description:"",price:{quantity:n.quantity,amount:((N=n.productWithVariant)==null?void 0:N.price.amount)||0,currency:(w=n.productWithVariant)==null?void 0:w.price.currency},deliveryCategories:"deliveryCategories"in n?n.deliveryCategories:void 0,customerNote:n.customerNote,chargeType:n.chargeType||"ONE_TIME",replacementRequests:"replacementRequests"in n?n.replacementRequests:void 0,allowedReplacementReasons:"allowedReplacementReasons"in n?n.allowedReplacementReasons:void 0}}))||[],[e]);c.useEffect(()=>{e&&(e.status===o.OrderStatus.FullDeliveryFailure||e.status===o.OrderStatus.PartiallyDelivered)&&e.refundedPrice&&e.refundedPrice.amount>0&&f(!0)},[e==null?void 0:e.status]);const b=async(n,N,w=!1)=>{var m,v;w||_(!0);const{data:l}=await(N?o.fetchAuthorizedOrder(`${n}/${N}`):o.fetchOrder(n));_(!1),l.status!==o.OrderStatus.Completed&&((m=l.charge)==null?void 0:m.status)===o.ChargeStatus.NotPaid&&d(`/charges/${(v=l.charge)==null?void 0:v.id}`,{replace:!0}),g(l)};return c.useLayoutEffect(()=>{if(s&&!i){const n=JSON.parse(localStorage.getItem("orders")||"{}");n[s]&&d(`/orders/${s}/${n[s].fullAccessToken}`)}},[s]),c.useEffect(()=>{s&&b(s,i,!0);const n=setInterval(()=>{s&&b(s,i,!0)},5e3);return()=>{clearInterval(n)}},[s,i]),j?t.jsx("div",{className:a.loaderContainer,children:t.jsx(h.Loader,{})}):t.jsxs("div",{className:a.orderPage,children:[t.jsx("div",{className:a.leftSection,children:t.jsxs("div",{className:a.content,children:[t.jsx(o.CheckoutHeader,{}),e&&t.jsxs("div",{className:`${a.main} ${r?a.mainAntistock:""}`,children:[t.jsx(o.OrderStatusBlock,{className:a.statusBlock,orderStatus:e.status}),t.jsxs("div",{className:`${a.orderMainData} ${r?a.orderMainDataAntistock:""}`,children:[t.jsx(o.CheckoutOrderMainData,{lastUpdate:e.createdAt,paymentType:(P=e.charge)==null?void 0:P.gateway,email:e.customer?e.customer.email:((D=e.charge)==null?void 0:D.customerForCharge.email)||"",orderId:e.id}),"accessToken"in e.review&&!r&&t.jsx(o.LeaveAReview,{orderId:e.id,review:e.review})]}),e.charge&&e.charge.timeline&&t.jsx(o.TrackPayment,{className:`${a.timelineBlock} ${r?a.timelineBlockAntistock:""}`,timeline:e.charge.timeline}),t.jsx(o.CheckoutFooter,{className:`${a.footer} ${r?a.footerAntistock:""}`})]})]})}),t.jsx("div",{className:a.rightSection,style:r?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:t.jsxs("div",{className:a.content,children:[((A=e==null?void 0:e.charge)==null?void 0:A.name)&&t.jsxs("header",{className:a.header,children:[t.jsxs("div",{children:[t.jsx("h1",{className:a.headerTitle,children:e.charge.name}),e.charge.description&&t.jsx("p",{className:a.headerDescription,children:e.charge.description})]}),r?null:t.jsxs(h.Button,{type:"Secondary",onClick:()=>C((e==null?void 0:e.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx(h.Icon,{name:"Copy"}),t.jsx("span",{children:"Copy ID"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:a.productList,children:S.map(n=>t.jsx(o.CheckoutProduct,{product:n,isOrder:!0,isApplicableForReplacement:e==null?void 0:e.isApplicableForReplacement,orderId:s,accessToken:i,allowedReplacementReasons:e==null?void 0:e.allowedReplacementReasons},n.id))}),r?null:t.jsx(o.CheckoutPrices,{formatter:y,coupon:null,total:((R=e==null?void 0:e.endPrice)==null?void 0:R.amount)||0,discount:0,totalWithDiscount:((I=e==null?void 0:e.endPrice)==null?void 0:I.amount)||0,className:a.prices,isShowSubtotal:!1}),t.jsx(o.CheckoutFooter,{className:a.mobileFooter})]})]})}),(e==null?void 0:e.refundedPrice)&&t.jsx(ue,{isOpen:k,onClose:()=>f(!1),refundedAmount:e.refundedPrice.amount,currency:e.refundedPrice.currency})]})},me=Object.freeze(Object.defineProperty({__proto__:null,OrderPage:de},Symbol.toStringTag,{value:"Module"}));exports.Orders=F;exports.index=me;
@@ -1,10 +1,10 @@
1
1
  import { jsx as e, Fragment as d, jsxs as o } from "react/jsx-runtime";
2
2
  import a from "react";
3
- import { X as C, N as _, a7 as y, a8 as v, J as P } from "./builder-Bd2jS6z5.js";
4
- import { o as w, N, P as j, S as D, g as I, d as x, p as E, i as f, q as G, A as T, r as k, s as B, t as A, v as O, w as L } from "./charge-CYkPC1xJ.js";
5
- import { e as M, g as F } from "./ui-components-Bfju659N.js";
6
- import "./builder-components-DOXVQePh.js";
7
- import "./ticket-ckMFdKTG.js";
3
+ import { X as C, N as _, a7 as y, a8 as v, J as P } from "./builder-dGixT-_d.js";
4
+ import { o as w, N, P as j, S as D, g as I, d as x, p as E, i as f, q as G, A as T, r as k, s as B, t as A, v as O, w as L } from "./charge-Nfq6BBT0.js";
5
+ import { e as M, g as F } from "./ui-components-D3S3Wicn.js";
6
+ import "./builder-components-BD45uk6H.js";
7
+ import "./ticket-D82dpA86.js";
8
8
  import "react-dom";
9
9
  const H = async (s = 1) => await w({ PageNumber: s }), nt = () => {
10
10
  const [s, i] = a.useState(null), [t, S] = a.useState(0), { page: u, setPage: h } = C(), { gatewaysDetail: l, setGatewaysDetail: b, balanceSettings: n } = _();
@@ -1 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),c=require("react"),u=require("./builder-DoAHiGfI.cjs"),s=require("./charge-By0YRAtN.cjs"),m=require("./ui-components-foi2BEtM.cjs");require("./builder-components-B6Q1FJdO.cjs");require("./ticket-Djdg5CC8.cjs");require("react-dom");const x=async(n=1)=>await s.fetchSubscriptions({PageNumber:n}),f=()=>{const[n,o]=c.useState(null),[e,S]=c.useState(0),{page:l,setPage:b}=u.usePaginationPagesStore(),{gatewaysDetail:d,setGatewaysDetail:g,balanceSettings:i}=u.useCustomerDashboardStore();return c.useEffect(()=>{const h=async()=>{const{list:r,totalCount:p}=await x(l);o(r),S(p)},j=async()=>{const r=await s.getGatewaysDetail(i!=null&&i.isEnabled?(i==null?void 0:i.topUpSettings.gateways)||[]:[]);g(r)};h(),d||j()},[l]),t.jsx(t.Fragment,{children:n&&n.length===0?t.jsx(s.NoItemsBlock,{title:"Subscriptions History",description:"When you subscribe to a product on our website, you'll see a history of your subscriptions here."}):t.jsxs(t.Fragment,{children:[t.jsx(s.PageTitle,{title:"Subscriptions"}),t.jsx(s.SubscriptionsTable,{subscriptions:n,gatewaysDetail:d,totalCount:e,page:l,setPage:b})]})})},C="_subscriptionContainer_1j6ol_1",_="_leftSection_1j6ol_15",y="_content_1j6ol_26",v="_mainContent_1j6ol_33",P="_detailsSection_1j6ol_37",w="_buttonGroup_1j6ol_50",D="_detailsContent_1j6ol_57",a={subscriptionContainer:C,leftSection:_,content:y,mainContent:v,detailsSection:P,buttonGroup:w,detailsContent:D},N=()=>{const{id:n,accessToken:o}=u.useParams(),{subscription:e,setSubscription:S}=u.useSubscriptionStore(),{setIsOpen:l}=u.useModalStore(),[b,d]=c.useState(!1),[g,i]=c.useState(!1);c.useLayoutEffect(()=>{S(null)},[n,o]);const{balanceSettings:h,setBalanceSettings:j}=u.useCustomerDashboardStore();return c.useEffect(()=>{n&&o&&(async()=>{if(!n||!o)return;i(!0);const{data:p}=await s.fetchSubscription(n,o);S({...p}),i(!1)})()},[n,o]),c.useEffect(()=>{h||(async()=>{const p=await s.getBalanceSettings();j(p)})()},[h]),g?t.jsx(m.Loader,{}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:a.subscriptionContainer,children:[t.jsx("div",{className:a.leftSection,children:t.jsxs("div",{className:a.content,children:[t.jsx(s.CheckoutHeader,{}),t.jsxs("div",{className:a.mainContent,children:[e&&t.jsxs(t.Fragment,{children:[t.jsx("h3",{id:"h3",children:"Your Subscription"}),t.jsx(s.SubscriptionProduct,{subscription:{price:e.price,name:e.productName,description:e.productDescription,status:e.status,image:e.productImage,recurringInterval:e.recurringInterval}}),t.jsx("div",{className:a.buttonGroup,children:e.pricingPlanExists&&t.jsx(m.Button,{onClick:r=>{r.stopPropagation(),l(!0),d(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),t.jsx(s.CheckoutFooter,{})]})]})}),t.jsx("div",{className:a.detailsSection,children:t.jsxs("div",{className:a.detailsContent,children:[t.jsx("h3",{id:"h3",children:"Details"}),(e==null?void 0:e.coupon)&&t.jsx(s.SubscriptionCoupon,{coupon:e.coupon,currency:e.price.currency||"USD"}),e&&t.jsx(s.ActiveSubscriptionProduct,{id:n||"",accessToken:o||"",subscription:{price:e.price,name:e.productName,description:e.productDescription,status:e.status,image:e.productImage,recurringInterval:e.recurringInterval}}),e&&t.jsxs(t.Fragment,{children:[t.jsx(s.ActivePaymentMethod,{}),e.activeTo&&t.jsx(s.SubscriptionExpirationDate,{})]}),t.jsx(s.CheckoutFooter,{className:"flex md:hidden"})]})})]}),t.jsx(s.ChangeSubscriptionPlan,{isOpen:b,setIsOpen:d,subscription:e})]})},I=Object.freeze(Object.defineProperty({__proto__:null,Subscription:N},Symbol.toStringTag,{value:"Module"}));exports.Subscriptions=f;exports.index=I;
1
+ "use strict";const t=require("react/jsx-runtime"),c=require("react"),u=require("./builder-BVVH9Uc0.cjs"),s=require("./charge-DAXMrlAq.cjs"),m=require("./ui-components-DgahiZcB.cjs");require("./builder-components-BEFw4EcA.cjs");require("./ticket-CbHpWM1U.cjs");require("react-dom");const x=async(n=1)=>await s.fetchSubscriptions({PageNumber:n}),f=()=>{const[n,o]=c.useState(null),[e,S]=c.useState(0),{page:l,setPage:b}=u.usePaginationPagesStore(),{gatewaysDetail:d,setGatewaysDetail:g,balanceSettings:i}=u.useCustomerDashboardStore();return c.useEffect(()=>{const h=async()=>{const{list:r,totalCount:p}=await x(l);o(r),S(p)},j=async()=>{const r=await s.getGatewaysDetail(i!=null&&i.isEnabled?(i==null?void 0:i.topUpSettings.gateways)||[]:[]);g(r)};h(),d||j()},[l]),t.jsx(t.Fragment,{children:n&&n.length===0?t.jsx(s.NoItemsBlock,{title:"Subscriptions History",description:"When you subscribe to a product on our website, you'll see a history of your subscriptions here."}):t.jsxs(t.Fragment,{children:[t.jsx(s.PageTitle,{title:"Subscriptions"}),t.jsx(s.SubscriptionsTable,{subscriptions:n,gatewaysDetail:d,totalCount:e,page:l,setPage:b})]})})},C="_subscriptionContainer_1j6ol_1",_="_leftSection_1j6ol_15",y="_content_1j6ol_26",v="_mainContent_1j6ol_33",P="_detailsSection_1j6ol_37",w="_buttonGroup_1j6ol_50",D="_detailsContent_1j6ol_57",a={subscriptionContainer:C,leftSection:_,content:y,mainContent:v,detailsSection:P,buttonGroup:w,detailsContent:D},N=()=>{const{id:n,accessToken:o}=u.useParams(),{subscription:e,setSubscription:S}=u.useSubscriptionStore(),{setIsOpen:l}=u.useModalStore(),[b,d]=c.useState(!1),[g,i]=c.useState(!1);c.useLayoutEffect(()=>{S(null)},[n,o]);const{balanceSettings:h,setBalanceSettings:j}=u.useCustomerDashboardStore();return c.useEffect(()=>{n&&o&&(async()=>{if(!n||!o)return;i(!0);const{data:p}=await s.fetchSubscription(n,o);S({...p}),i(!1)})()},[n,o]),c.useEffect(()=>{h||(async()=>{const p=await s.getBalanceSettings();j(p)})()},[h]),g?t.jsx(m.Loader,{}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:a.subscriptionContainer,children:[t.jsx("div",{className:a.leftSection,children:t.jsxs("div",{className:a.content,children:[t.jsx(s.CheckoutHeader,{}),t.jsxs("div",{className:a.mainContent,children:[e&&t.jsxs(t.Fragment,{children:[t.jsx("h3",{id:"h3",children:"Your Subscription"}),t.jsx(s.SubscriptionProduct,{subscription:{price:e.price,name:e.productName,description:e.productDescription,status:e.status,image:e.productImage,recurringInterval:e.recurringInterval}}),t.jsx("div",{className:a.buttonGroup,children:e.pricingPlanExists&&t.jsx(m.Button,{onClick:r=>{r.stopPropagation(),l(!0),d(!0)},style:{maxWidth:"500px",width:"100%"},children:"Change Plan"})})]}),t.jsx(s.CheckoutFooter,{})]})]})}),t.jsx("div",{className:a.detailsSection,children:t.jsxs("div",{className:a.detailsContent,children:[t.jsx("h3",{id:"h3",children:"Details"}),(e==null?void 0:e.coupon)&&t.jsx(s.SubscriptionCoupon,{coupon:e.coupon,currency:e.price.currency||"USD"}),e&&t.jsx(s.ActiveSubscriptionProduct,{id:n||"",accessToken:o||"",subscription:{price:e.price,name:e.productName,description:e.productDescription,status:e.status,image:e.productImage,recurringInterval:e.recurringInterval}}),e&&t.jsxs(t.Fragment,{children:[t.jsx(s.ActivePaymentMethod,{}),e.activeTo&&t.jsx(s.SubscriptionExpirationDate,{})]}),t.jsx(s.CheckoutFooter,{className:"flex md:hidden"})]})})]}),t.jsx(s.ChangeSubscriptionPlan,{isOpen:b,setIsOpen:d,subscription:e})]})},I=Object.freeze(Object.defineProperty({__proto__:null,Subscription:N},Symbol.toStringTag,{value:"Module"}));exports.Subscriptions=f;exports.index=I;