@billgangcom/theme-lib 1.122.0 → 1.123.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builder-DOCPzptl.cjs → builder-BNQD7fm1.cjs} +13 -13
- package/dist/{builder-BDWYOk4o.js → builder-Cbzb-Pzj.js} +805 -805
- package/dist/{builder-components-CvexDBBH.js → builder-components-B6Ct-1cI.js} +699 -699
- package/dist/builder-components-B8gWw88v.cjs +5 -0
- package/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +23 -23
- package/dist/{charge-C15xUj35.js → charge-Bv8wu-fV.js} +7 -7
- package/dist/{charge-CJQibcfu.cjs → charge-DcKd_es2.cjs} +2 -2
- package/dist/{checkout-CpzLu5oq.cjs → checkout-BQwNBpVW.cjs} +1 -1
- package/dist/{checkout-BrL3RJUF.js → checkout-DkIvY2zs.js} +5 -5
- package/dist/exports.cjs.js +1 -1
- package/dist/exports.es.js +6 -6
- package/dist/{index-BWWTIm1T.js → index-BHLQHIsH.js} +2 -2
- package/dist/{index-DOXo55nb.js → index-BIfw5wrd.js} +5 -5
- package/dist/{index-BHCz9QsY.cjs → index-BYdRgPyI.cjs} +1 -1
- package/dist/{index-LHU1sHHV.js → index-Bk-mY9E3.js} +5 -5
- package/dist/{index-DYH2kLjz.cjs → index-BnMpELp_.cjs} +1 -1
- package/dist/{index-Duey4obm.cjs → index-BtqOzf1F.cjs} +1 -1
- package/dist/{index-CaE8IYfM.js → index-C-OH-0Jj.js} +1 -1
- package/dist/{index-DNSijKmM.js → index-CtZBWOyf.js} +5 -5
- package/dist/{index-foFJrz8D.js → index-D1W9Fza6.js} +5 -5
- package/dist/{index-C0e_BhGQ.cjs → index-DoklSmf4.cjs} +1 -1
- package/dist/{index-Dcnqy8X3.cjs → index-DozNvPOR.cjs} +1 -1
- package/dist/{index-Bxaj05Fb.cjs → index-Dyg2ZZW6.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +6 -6
- package/dist/{order-DNKJ-JsD.cjs → order-B0gf5VEi.cjs} +1 -1
- package/dist/{order-C-Ur9Jbh.js → order-S6e2WcCX.js} +5 -5
- package/dist/src/builder/components/ExitButton/index.d.ts +1 -4
- package/dist/style.css +1 -1
- package/dist/{subscription-B6uyLDB4.cjs → subscription-5ytxlwXp.cjs} +1 -1
- package/dist/{subscription-BySRgrl2.js → subscription-HEpvSKgZ.js} +5 -5
- package/dist/{ticket-DWQeThhP.cjs → ticket-C5g3kw8c.cjs} +1 -1
- package/dist/{ticket-FYGZ32D-.js → ticket-CbQabuyp.js} +5 -5
- package/dist/{top-up-BO5_olGw.cjs → top-up-CrbYB293.cjs} +1 -1
- package/dist/{top-up-IV8ZjQ3f.js → top-up-lubckd9w.js} +5 -5
- package/dist/{ui-components-CiVZSTvC.js → ui-components-BhVIVLV-.js} +2214 -2210
- package/dist/ui-components-jkqz3-Kc.cjs +1 -0
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +1 -1
- package/dist/{validation-2cuCf_Ob.cjs → validation-Be-6h5-8.cjs} +1 -1
- package/dist/{validation-D7cnZ3qf.js → validation-lwFWEACU.js} +5 -5
- package/package.json +1 -1
- package/dist/builder-components-Bb96v4TW.cjs +0 -5
- package/dist/ui-components-CencTE96.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const g=require("./builder-DOCPzptl.cjs"),i=require("react/jsx-runtime"),L=require("react"),N=require("./ui-components-CencTE96.cjs"),nl=require("./builder-components-Bb96v4TW.cjs");require("react-dom");const rl=require("./ticket-DWQeThhP.cjs"),ul=require("./order-DNKJ-JsD.cjs"),t2=require("./subscription-B6uyLDB4.cjs");function n2(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const me=n2(L),r2=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,al=({children:e,className:t,as:n="span",...r})=>{const[u,a]=L.useState(!1);return L.useEffect(()=>{typeof window<"u"&&a(r2())},[]),u?i.jsx(n,{className:t,...r,"data-stable-text":e,dangerouslySetInnerHTML:{__html:""}}):i.jsx(n,{className:t,...r,children:e})};async function u2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/general`+(e?`?password=${e}`:"");return(await g.request({method:"get",url:r,withToken:!1})).data}const a2=async()=>{const e=g.useApiStore.getState().apiUrls,t=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,n=`${e.storeApi}/v2/shops/${t}/settings-theme`;return await g.request({url:n,withToken:!0,method:"get"})},s2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/balance/top-up/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},i2=async(e,t)=>{const r=`${g.useApiStore.getState().apiUrls.cashappApi}/v1/${t}/cashapp/link`;return await g.request({url:r,method:"post",body:e,withToken:!1})},Nr=async e=>{const t=g.useApiStore.getState().apiUrls;if(!localStorage.getItem("token"))throw new Error("No access token");const r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${t.customersApi}/v2/${r}/customers/${e}`;return await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"})},o2=()=>Nr("dash/info"),sl=()=>Nr("dash/dashboard/home"),c2=()=>Nr("rewards"),l2=()=>Nr("balance"),d2=()=>Nr("balance/top-up/settings"),f2=()=>Nr("referral-system"),Ks=e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/${e}`;return g.request({url:r,withToken:!1,method:"get"})},h2=()=>Ks("terms"),p2=()=>Ks("refund-policy"),m2=()=>Ks("privacy-policy"),Es=10,aa=async({url:e,PageNumber:t})=>{var o;const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.customersApi}/v2/${r}/${e}?PageNumber=${t}&PageSize=${Es}`,a=await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"}),s=Number((o=a.headers)==null?void 0:o["x-pagination-total"]);return{list:a.data,totalCount:s}},sa=async(e,t="get",n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/orders/${u}/${e}`;return await g.request({url:a,method:t,withToken:!0,body:n,typeToken:"customer"})},g2=e=>sa("","post",e),b2=({PageNumber:e})=>aa({url:"customers/orders",PageNumber:e}),_2=e=>sa(e),x2=e=>sa(e),C2=(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v2/orders/${u}/${e}/${t}/replacement-requests`;return g.request({url:a,method:"post",withToken:!0,body:n,typeToken:"customer"})},E2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/public/${n}/images`,u=new FormData;return u.append("file",e),g.request({url:r,method:"post",withToken:!1,body:u})},y2=(e,t,n)=>sa(`${e}/${t}/replacement-requests/${n}/cancel`,"post"),T2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/${n}/subscriptions`;return await g.request({url:r,method:"post",withToken:!1,body:e})},k2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},A2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/${r}/subscriptions/${e}/${t}/upgrades`;return await g.request({url:u,method:"get",withToken:!1})},S2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/${u}/subscriptions/${e}/${t}/cancel`;return await g.request({url:a,method:"post",withToken:!1,body:n})},I2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/change-gateway`;return await g.request({url:u,method:"post",withToken:!1,body:{gateway:t}})},N2=({PageNumber:e})=>aa({url:"customers/subscriptions",PageNumber:e}),v2=async({id:e,accessToken:t})=>await A2(e,t),w2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/order`;return await g.request({url:u,method:"post",withToken:!1,body:t})},D2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/public/${r}/tickets/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},L2=async(e,t,n,r,u,a)=>{const s=g.useApiStore.getState().apiUrls,o=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,c=`${s.slApi}/v1/public/${o}/tickets/${e}/${t}/answer`;return(await g.request({url:c,method:"post",body:{message:n,recaptcha:r,tsId:u,...a&&a.length>0&&{imageIds:a.map(h=>h.imageId)}},withToken:!1})).data},P2=({PageNumber:e})=>aa({url:"customers/tickets",PageNumber:e}),R2=({PageNumber:e})=>aa({url:"customers/balance/transactions",PageNumber:e}),M2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/reviews/${u}/${t}/${n}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},O2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/charges/${n}/${e}`;return await g.request({url:r,method:"get",withToken:!1})},j2=async e=>{const t=g.useApiStore.getState().apiUrls,n=e.map(s=>["names",s]),r=new URLSearchParams(n),u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${t.slApi}/v2/gateways?shopDomain=${u}&${r.toString()}`;return await g.request({url:a,method:"get",withToken:!1})},ku=new Map,il=async e=>{const t=g.useApiStore.getState().apiUrls,r=Array.from(new Set(e)).sort().map(l=>["names",l]),u=new URLSearchParams(r),a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${t.slApi}/v2/checkout?shopDomain=${a}&${u.toString()}`,o=`${s}`;if(ku.has(o))return ku.get(o);const c=g.request({url:s,method:"get",withToken:!1}).catch(l=>{throw ku.delete(o),l});return ku.set(o,c),c},ol=async({email:e,recaptcha:t,tsId:n})=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.customersApi}/v2/${u}/auth/otp/request`;return(await g.request({url:a,body:{email:e,recaptcha:t,tsId:n},method:"post",withToken:!1})).data?{requested:!0,email:e}:{requested:!1,email:void 0}},cl=async({email:e,otp:t,recaptcha:n,tsId:r})=>{const u=g.useApiStore.getState().apiUrls,a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${u.customersApi}/v2/${a}/auth/otp/login`,{data:o}=await g.request({url:s,method:"post",body:{email:e,otp:t,recaptcha:n,tsId:r},withToken:!1});return g.useStorefrontStore.getState().setToken(o.data),localStorage.setItem("token",o.data),{token:o.data,requested:!1}},ys=async()=>{g.useStorefrontStore.getState().setToken(""),g.useCustomerDashboardStore.getState().setDashInfo(null),localStorage.removeItem("token")},F2=Object.freeze(Object.defineProperty({__proto__:null,loginCustomer:cl,logoutCustomer:ys,requestOtp:ol},Symbol.toStringTag,{value:"Module"})),B2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v2/coupons/${n}/validate`;return await g.request({url:r,method:"post",body:e,withToken:!1})},H2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/referral-system/signup`;return(await g.request({url:r,withToken:!0,method:"post",body:e,typeToken:"customer"})).data},U2=async()=>{const{data:e}=await f2();return e},V2=async e=>{const{data:t}=await H2(e);return t},$2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},z2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}/${e.id}?customerEmail=${e.customerEmail}`;return await g.request({url:r,method:"get",withToken:!1})};async function q2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/rewards/${e.id}/claim`;return g.request({url:r,method:"post",withToken:!0,typeToken:"customer"})}const Z2=async(e,t,n,r)=>{const a=`${g.useApiStore.getState().apiUrls.slApi}/v1/vouches/${t}/${n}/${r}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},ll=()=>g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,W2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key`;return g.request({url:n,method:"get",withToken:!0,typeToken:"customer"})},Y2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key/regenerate`;return g.request({url:n,method:"post",withToken:!0,typeToken:"customer"})},Ma="Balance",jn={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},G2={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},Wi=(e,t)=>{var l;const{productId:n,productVariantId:r,quantity:u,chargeType:a}=t,s=e.find(h=>h.id===n);if(!s)throw new Error("Product does not exist");const o=s.variants.find(h=>h.id===r);if(!o)throw new Error("Variant does not exist");if(a==="RECURRING"&&!o.subscriptionSettings)throw new Error("Variant does not have subscription settings");if(u!==void 0&&((l=o.quantity)!=null&&l.available)&&o.quantity.available<u)throw new Error("Not enough quantity available");const c=g.useCartStore.getState().cart;if(c.parts.length>0){const h=e.find(m=>m.id===c.parts[0].productId),f=h==null?void 0:h.variants.find(m=>m.id===c.parts[0].productVariantId);if(f&&o.price.currency!==f.price.currency)throw new Error("Product have different currency")}return o},X2=(e,t)=>{if(!e.volumeDiscounts||e.volumeDiscounts.length===0)return 0;const n=e.volumeDiscounts.filter(u=>t>=u.amount);return n.length===0?0:n.reduce((u,a)=>a.amount>u.amount?a:u).percentage},K2=(e,t)=>{let n=0,r=0;return e.forEach(u=>{var m,p;const a=t.find(b=>(b==null?void 0:b.id)===u.productId),s=a==null?void 0:a.variants.find(b=>b.id===u.productVariantId);if(!s)return;const{gateway:o}=g.useCartStore.getState().cart,c=(s==null?void 0:s.gateways)||[],l=c.some(b=>b.name===o&&b.overrodePrice)?(m=c.find(b=>b.name===o))==null?void 0:m.overrodePrice:null;let h=0,f=0;if(u.chargeType==="ONE_TIME"?(h=(l==null?void 0:l.amount)||(s==null?void 0:s.price.amount)||0,f=h*u.quantity):f=s!=null&&s.subscriptionSettings?s.subscriptionSettings.price.amount+(((p=s.subscriptionSettings.entryFee)==null?void 0:p.amount)||0):0,n+=f,u.chargeType==="ONE_TIME"){const b=X2(s,u.quantity),_=f*(1-b/100);r+=_}else r+=f}),{total:n,totalWithVolumeDiscounts:r}},Q2=(e,t)=>({isRequired:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isRequired}),isEnabled:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isEnabled})}),Yi=e=>new Set(e.gateways.map(t=>t.name)),Oa={availableGateways:[],requiresSignInGateways:[]},Gi=(e,t)=>{if(t.length===0)return Oa;const n=e[0];if(!n)return Oa;const r=t.find(o=>o.id===n.productId),u=r==null?void 0:r.variants.find(o=>o.id===n.productVariantId);if(!u)return Oa;const a=Yi(u);for(const o of e){const c=t.find(f=>f.id===o.productId);if(!c)continue;const l=c.variants.find(f=>f.id===o.productVariantId);if(!l)continue;const h=Yi(l);for(const f of a)h.has(f)||a.delete(f)}return!localStorage.getItem("token")&&a.has(Ma)?(a.delete(Ma),{availableGateways:[...a],requiresSignInGateways:[Ma]}):{availableGateways:[...a],requiresSignInGateways:[]}},Xi=(e,t)=>{if(e.length===0)return[];const r=e.map(a=>{const s=t.find(c=>c.id===a.productId),o=s==null?void 0:s.variants.find(c=>c.id===a.productVariantId);return(o==null?void 0:o.customFields)??[]}).flat().reduce((a,s)=>{const o=a[s.name];return o?(s.required&&!o.required&&(a[s.name]={...s,value:s.defaultValue}),a):(a[s.name]={...s,value:s.defaultValue},a)},{});return Object.values(r).map(a=>({...a,value:""}))},J2=(e,t)=>{const n=t.find(u=>u.id===e.productId),r=n==null?void 0:n.variants.find(u=>u.id===e.productVariantId);return e.chargeType==="RECURRING"?!!(r!=null&&r.subscriptionSettings):!1},du=()=>{const{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,customerEmail:a,setCart:s,setProducts:o,setCoupon:c,setPending:l,setApplyCouponPending:h}=g.useCartStore(),f=async _=>{var M;h(!0);const{cart:E}=g.useCartStore.getState(),{gateway:x,parts:k}=E,{notifications:y,setNotifications:D}=g.useNotificationStore.getState();x||(h(!1),D([...y,{message:"There should be a gateway for the coupon",status:"error",id:g.v4()}]));const S=k.map(H=>H.productId);let I=null;try{const{data:H}=await B2({gateway:x,couponName:_,productIds:S});I=H.data,D([...y,{message:"Coupon is applied",status:"success",id:g.v4()}]),s(U=>({...U,coupon:_}))}catch(H){const U=H;D([...y,{message:`Coupon is not applied: ${U.message}`,status:"error",id:g.v4()}]),s(P=>({...P,coupon:null})),c(null),h(!1)}if(h(!1),(M=I==null?void 0:I.restrictToProductIds)!=null&&M.length&&!S.every(H=>{var U;return(U=I==null?void 0:I.restrictToProductIds)==null?void 0:U.includes(H)}))throw new Error("Coupon can't be applied to such products");return c(I),I},b={reset(){s({...G2})},addProducts:_=>{const E=g.useCartStore.getState().products,x=_.filter(k=>!E.some(y=>y.id===k.id));o([...E,...x])},addProductToCart:_=>{const E=g.useCartStore.getState().cart;try{Wi(t,_)}catch(k){throw new Error(k)}const x=E.parts.find(k=>k.productId===_.productId&&k.productVariantId===_.productVariantId&&k.chargeType===_.chargeType);if(x)return b.updateQuantityOfProduct({...x,quantity:(x.quantity||1)+(_.quantity||1),chargeType:_.chargeType});if(E.parts.length&&Gi([...E.parts,_],t).availableGateways.length===0)throw new Error("No common payment gateways available");s({...E,parts:[...E.parts,_]}),E.coupon&&f(E.coupon)},removeProduct({productId:_,productVariantId:E}){s(x=>({...x,parts:x.parts.filter(k=>k.productId!==_||k.productVariantId!==E)})),e.coupon&&f(e.coupon)},getPossibleGateways(){return Gi(e.parts,t)},removeCoupon(){c(null)},getDiscordSettings(){return Q2(t,e.parts)},updateQuantityOfProduct(_){Wi(t,_),s(E=>({...E,parts:E.parts.map(x=>x.productId===_.productId&&x.productVariantId===_.productVariantId?{...x,quantity:_.quantity,chargeType:_.chargeType}:x)})),e.coupon&&f(e.coupon)},getTotalAndDiscount(){const{coupon:_}=g.useCartStore.getState(),{total:E,totalWithVolumeDiscounts:x}=K2(e.parts,t);let k;const y=x;return _&&_.discount?!_.isFixed&&_.discount===100?k=0:k=_.isFixed?Math.max(0,y-_.discount):y*(1-_.discount/100):x!==E&&(k=x),{total:E,totalWithVolumeDiscounts:x!==E?x:void 0,totalWithDiscount:k}},setGateway(_){s(x=>({...x,gateway:_}));const{isAntistock:E}=g.useGeneralStore.getState();e.coupon&&!E&&f(e.coupon)},setPaymentMethod(_){s(E=>({...E,paymentMethod:_}))},async submitCart(_){l(!0);const{cart:E}=g.useCartStore.getState(),{discordInfo:x}=g.useDiscordStore.getState();let k;if(E.parts&&a&&J2(E.parts[0],t))try{const{data:y}=await T2({gateway:E.gateway,coupon:E.coupon,partOrder:E.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:x!=null&&x.authorized?x.id:null,customerEmail:a,recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId()});k=y.data}catch(y){console.error(y)}else try{const{data:y}=await g2({gateway:E.gateway,parts:[...E.parts],coupon:E.coupon,customerEmail:E.customerEmail,referralCode:localStorage.getItem("referralCode"),recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId(),discordSocialConnectId:x!=null&&x.authorized?x.id:null,usePriorityReplacement:E.usePriorityReplacement===!0});k=y.data}catch(y){const D=y,{notifications:S,setNotifications:I}=g.useNotificationStore.getState();I([...S,{message:`Failed to create order: ${D.message}`,status:"error",id:g.v4()}])}if(l(!1),k)return k;throw new Error("Failed to create order")},setDiscordSocialConnectId(_){s(E=>({...E,discordSocialConnectId:_}))},setCustomFields(_){s(E=>({...E,customFields:{..._}}))}};return L.useEffect(()=>{s(_=>({..._,customerEmail:a??""}))},[a,s]),{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,applyCoupon:f,...b}},Zn=()=>{const{notifications:e,setNotifications:t}=g.useNotificationStore();return n=>{navigator.clipboard.writeText(n),t([...e,{status:"success",message:"Successfully copied",id:g.v4()}])}};var Ts={exports:{}},Au={exports:{}},Re={};/** @license React v16.13.1
|
|
1
|
+
"use strict";const g=require("./builder-BNQD7fm1.cjs"),i=require("react/jsx-runtime"),L=require("react"),N=require("./ui-components-jkqz3-Kc.cjs"),nl=require("./builder-components-B8gWw88v.cjs");require("react-dom");const rl=require("./ticket-C5g3kw8c.cjs"),ul=require("./order-B0gf5VEi.cjs"),t2=require("./subscription-5ytxlwXp.cjs");function n2(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const me=n2(L),r2=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,al=({children:e,className:t,as:n="span",...r})=>{const[u,a]=L.useState(!1);return L.useEffect(()=>{typeof window<"u"&&a(r2())},[]),u?i.jsx(n,{className:t,...r,"data-stable-text":e,dangerouslySetInnerHTML:{__html:""}}):i.jsx(n,{className:t,...r,children:e})};async function u2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/general`+(e?`?password=${e}`:"");return(await g.request({method:"get",url:r,withToken:!1})).data}const a2=async()=>{const e=g.useApiStore.getState().apiUrls,t=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,n=`${e.storeApi}/v2/shops/${t}/settings-theme`;return await g.request({url:n,withToken:!0,method:"get"})},s2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/balance/top-up/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},i2=async(e,t)=>{const r=`${g.useApiStore.getState().apiUrls.cashappApi}/v1/${t}/cashapp/link`;return await g.request({url:r,method:"post",body:e,withToken:!1})},Nr=async e=>{const t=g.useApiStore.getState().apiUrls;if(!localStorage.getItem("token"))throw new Error("No access token");const r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${t.customersApi}/v2/${r}/customers/${e}`;return await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"})},o2=()=>Nr("dash/info"),sl=()=>Nr("dash/dashboard/home"),c2=()=>Nr("rewards"),l2=()=>Nr("balance"),d2=()=>Nr("balance/top-up/settings"),f2=()=>Nr("referral-system"),Ks=e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.storeApi}/shops/${n}/${e}`;return g.request({url:r,withToken:!1,method:"get"})},h2=()=>Ks("terms"),p2=()=>Ks("refund-policy"),m2=()=>Ks("privacy-policy"),Es=10,aa=async({url:e,PageNumber:t})=>{var o;const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.customersApi}/v2/${r}/${e}?PageNumber=${t}&PageSize=${Es}`,a=await g.request({url:u,withToken:!0,method:"get",typeToken:"customer"}),s=Number((o=a.headers)==null?void 0:o["x-pagination-total"]);return{list:a.data,totalCount:s}},sa=async(e,t="get",n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/orders/${u}/${e}`;return await g.request({url:a,method:t,withToken:!0,body:n,typeToken:"customer"})},g2=e=>sa("","post",e),b2=({PageNumber:e})=>aa({url:"customers/orders",PageNumber:e}),_2=e=>sa(e),x2=e=>sa(e),C2=(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v2/orders/${u}/${e}/${t}/replacement-requests`;return g.request({url:a,method:"post",withToken:!0,body:n,typeToken:"customer"})},E2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/public/${n}/images`,u=new FormData;return u.append("file",e),g.request({url:r,method:"post",withToken:!1,body:u})},y2=(e,t,n)=>sa(`${e}/${t}/replacement-requests/${n}/cancel`,"post"),T2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/${n}/subscriptions`;return await g.request({url:r,method:"post",withToken:!1,body:e})},k2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},A2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/${r}/subscriptions/${e}/${t}/upgrades`;return await g.request({url:u,method:"get",withToken:!1})},S2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/${u}/subscriptions/${e}/${t}/cancel`;return await g.request({url:a,method:"post",withToken:!1,body:n})},I2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/change-gateway`;return await g.request({url:u,method:"post",withToken:!1,body:{gateway:t}})},N2=({PageNumber:e})=>aa({url:"customers/subscriptions",PageNumber:e}),v2=async({id:e,accessToken:t})=>await A2(e,t),w2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v2/${r}/subscriptions/${e}/order`;return await g.request({url:u,method:"post",withToken:!1,body:t})},D2=async(e,t)=>{const n=g.useApiStore.getState().apiUrls,r=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,u=`${n.slApi}/v1/public/${r}/tickets/${e}/${t}`;return await g.request({url:u,method:"get",withToken:!1})},L2=async(e,t,n,r,u,a)=>{const s=g.useApiStore.getState().apiUrls,o=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,c=`${s.slApi}/v1/public/${o}/tickets/${e}/${t}/answer`;return(await g.request({url:c,method:"post",body:{message:n,recaptcha:r,tsId:u,...a&&a.length>0&&{imageIds:a.map(h=>h.imageId)}},withToken:!1})).data},P2=({PageNumber:e})=>aa({url:"customers/tickets",PageNumber:e}),R2=({PageNumber:e})=>aa({url:"customers/balance/transactions",PageNumber:e}),M2=async(e,t,n)=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.slApi}/v1/reviews/${u}/${t}/${n}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},O2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/charges/${n}/${e}`;return await g.request({url:r,method:"get",withToken:!1})},j2=async e=>{const t=g.useApiStore.getState().apiUrls,n=e.map(s=>["names",s]),r=new URLSearchParams(n),u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${t.slApi}/v2/gateways?shopDomain=${u}&${r.toString()}`;return await g.request({url:a,method:"get",withToken:!1})},ku=new Map,il=async e=>{const t=g.useApiStore.getState().apiUrls,r=Array.from(new Set(e)).sort().map(l=>["names",l]),u=new URLSearchParams(r),a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${t.slApi}/v2/checkout?shopDomain=${a}&${u.toString()}`,o=`${s}`;if(ku.has(o))return ku.get(o);const c=g.request({url:s,method:"get",withToken:!1}).catch(l=>{throw ku.delete(o),l});return ku.set(o,c),c},ol=async({email:e,recaptcha:t,tsId:n})=>{const r=g.useApiStore.getState().apiUrls,u=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${r.customersApi}/v2/${u}/auth/otp/request`;return(await g.request({url:a,body:{email:e,recaptcha:t,tsId:n},method:"post",withToken:!1})).data?{requested:!0,email:e}:{requested:!1,email:void 0}},cl=async({email:e,otp:t,recaptcha:n,tsId:r})=>{const u=g.useApiStore.getState().apiUrls,a=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,s=`${u.customersApi}/v2/${a}/auth/otp/login`,{data:o}=await g.request({url:s,method:"post",body:{email:e,otp:t,recaptcha:n,tsId:r},withToken:!1});return g.useStorefrontStore.getState().setToken(o.data),localStorage.setItem("token",o.data),{token:o.data,requested:!1}},ys=async()=>{g.useStorefrontStore.getState().setToken(""),g.useCustomerDashboardStore.getState().setDashInfo(null),localStorage.removeItem("token")},F2=Object.freeze(Object.defineProperty({__proto__:null,loginCustomer:cl,logoutCustomer:ys,requestOtp:ol},Symbol.toStringTag,{value:"Module"})),B2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v2/coupons/${n}/validate`;return await g.request({url:r,method:"post",body:e,withToken:!1})},H2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/referral-system/signup`;return(await g.request({url:r,withToken:!0,method:"post",body:e,typeToken:"customer"})).data},U2=async()=>{const{data:e}=await f2();return e},V2=async e=>{const{data:t}=await H2(e);return t},$2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}`;return await g.request({url:r,method:"post",body:e,withToken:!1})},z2=async e=>{const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.slApi}/v1/discord/${n}/${e.id}?customerEmail=${e.customerEmail}`;return await g.request({url:r,method:"get",withToken:!1})};async function q2(e){const t=g.useApiStore.getState().apiUrls,n=g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${t.customersApi}/v2/${n}/customers/rewards/${e.id}/claim`;return g.request({url:r,method:"post",withToken:!0,typeToken:"customer"})}const Z2=async(e,t,n,r)=>{const a=`${g.useApiStore.getState().apiUrls.slApi}/v1/vouches/${t}/${n}/${r}`;return await g.request({url:a,method:"post",withToken:!1,body:e})},ll=()=>g.IS_LOCAL_HOST?localStorage.getItem("fakeDomain"):window.location.hostname,W2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key`;return g.request({url:n,method:"get",withToken:!0,typeToken:"customer"})},Y2=async()=>{const e=g.useApiStore.getState().apiUrls,t=ll(),n=`${e.customersApi}/v2/${t}/api-key/regenerate`;return g.request({url:n,method:"post",withToken:!0,typeToken:"customer"})},Ma="Balance",jn={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},G2={customerEmail:"",recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},Wi=(e,t)=>{var l;const{productId:n,productVariantId:r,quantity:u,chargeType:a}=t,s=e.find(h=>h.id===n);if(!s)throw new Error("Product does not exist");const o=s.variants.find(h=>h.id===r);if(!o)throw new Error("Variant does not exist");if(a==="RECURRING"&&!o.subscriptionSettings)throw new Error("Variant does not have subscription settings");if(u!==void 0&&((l=o.quantity)!=null&&l.available)&&o.quantity.available<u)throw new Error("Not enough quantity available");const c=g.useCartStore.getState().cart;if(c.parts.length>0){const h=e.find(m=>m.id===c.parts[0].productId),f=h==null?void 0:h.variants.find(m=>m.id===c.parts[0].productVariantId);if(f&&o.price.currency!==f.price.currency)throw new Error("Product have different currency")}return o},X2=(e,t)=>{if(!e.volumeDiscounts||e.volumeDiscounts.length===0)return 0;const n=e.volumeDiscounts.filter(u=>t>=u.amount);return n.length===0?0:n.reduce((u,a)=>a.amount>u.amount?a:u).percentage},K2=(e,t)=>{let n=0,r=0;return e.forEach(u=>{var m,p;const a=t.find(b=>(b==null?void 0:b.id)===u.productId),s=a==null?void 0:a.variants.find(b=>b.id===u.productVariantId);if(!s)return;const{gateway:o}=g.useCartStore.getState().cart,c=(s==null?void 0:s.gateways)||[],l=c.some(b=>b.name===o&&b.overrodePrice)?(m=c.find(b=>b.name===o))==null?void 0:m.overrodePrice:null;let h=0,f=0;if(u.chargeType==="ONE_TIME"?(h=(l==null?void 0:l.amount)||(s==null?void 0:s.price.amount)||0,f=h*u.quantity):f=s!=null&&s.subscriptionSettings?s.subscriptionSettings.price.amount+(((p=s.subscriptionSettings.entryFee)==null?void 0:p.amount)||0):0,n+=f,u.chargeType==="ONE_TIME"){const b=X2(s,u.quantity),_=f*(1-b/100);r+=_}else r+=f}),{total:n,totalWithVolumeDiscounts:r}},Q2=(e,t)=>({isRequired:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isRequired}),isEnabled:t.some(r=>{var a;const u=e.find(s=>(s==null?void 0:s.id)===r.productId);return(a=u==null?void 0:u.variants.find(s=>s.id===r.productVariantId))==null?void 0:a.discordSettings.isEnabled})}),Yi=e=>new Set(e.gateways.map(t=>t.name)),Oa={availableGateways:[],requiresSignInGateways:[]},Gi=(e,t)=>{if(t.length===0)return Oa;const n=e[0];if(!n)return Oa;const r=t.find(o=>o.id===n.productId),u=r==null?void 0:r.variants.find(o=>o.id===n.productVariantId);if(!u)return Oa;const a=Yi(u);for(const o of e){const c=t.find(f=>f.id===o.productId);if(!c)continue;const l=c.variants.find(f=>f.id===o.productVariantId);if(!l)continue;const h=Yi(l);for(const f of a)h.has(f)||a.delete(f)}return!localStorage.getItem("token")&&a.has(Ma)?(a.delete(Ma),{availableGateways:[...a],requiresSignInGateways:[Ma]}):{availableGateways:[...a],requiresSignInGateways:[]}},Xi=(e,t)=>{if(e.length===0)return[];const r=e.map(a=>{const s=t.find(c=>c.id===a.productId),o=s==null?void 0:s.variants.find(c=>c.id===a.productVariantId);return(o==null?void 0:o.customFields)??[]}).flat().reduce((a,s)=>{const o=a[s.name];return o?(s.required&&!o.required&&(a[s.name]={...s,value:s.defaultValue}),a):(a[s.name]={...s,value:s.defaultValue},a)},{});return Object.values(r).map(a=>({...a,value:""}))},J2=(e,t)=>{const n=t.find(u=>u.id===e.productId),r=n==null?void 0:n.variants.find(u=>u.id===e.productVariantId);return e.chargeType==="RECURRING"?!!(r!=null&&r.subscriptionSettings):!1},du=()=>{const{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,customerEmail:a,setCart:s,setProducts:o,setCoupon:c,setPending:l,setApplyCouponPending:h}=g.useCartStore(),f=async _=>{var M;h(!0);const{cart:E}=g.useCartStore.getState(),{gateway:x,parts:k}=E,{notifications:y,setNotifications:D}=g.useNotificationStore.getState();x||(h(!1),D([...y,{message:"There should be a gateway for the coupon",status:"error",id:g.v4()}]));const S=k.map(H=>H.productId);let I=null;try{const{data:H}=await B2({gateway:x,couponName:_,productIds:S});I=H.data,D([...y,{message:"Coupon is applied",status:"success",id:g.v4()}]),s(U=>({...U,coupon:_}))}catch(H){const U=H;D([...y,{message:`Coupon is not applied: ${U.message}`,status:"error",id:g.v4()}]),s(P=>({...P,coupon:null})),c(null),h(!1)}if(h(!1),(M=I==null?void 0:I.restrictToProductIds)!=null&&M.length&&!S.every(H=>{var U;return(U=I==null?void 0:I.restrictToProductIds)==null?void 0:U.includes(H)}))throw new Error("Coupon can't be applied to such products");return c(I),I},b={reset(){s({...G2})},addProducts:_=>{const E=g.useCartStore.getState().products,x=_.filter(k=>!E.some(y=>y.id===k.id));o([...E,...x])},addProductToCart:_=>{const E=g.useCartStore.getState().cart;try{Wi(t,_)}catch(k){throw new Error(k)}const x=E.parts.find(k=>k.productId===_.productId&&k.productVariantId===_.productVariantId&&k.chargeType===_.chargeType);if(x)return b.updateQuantityOfProduct({...x,quantity:(x.quantity||1)+(_.quantity||1),chargeType:_.chargeType});if(E.parts.length&&Gi([...E.parts,_],t).availableGateways.length===0)throw new Error("No common payment gateways available");s({...E,parts:[...E.parts,_]}),E.coupon&&f(E.coupon)},removeProduct({productId:_,productVariantId:E}){s(x=>({...x,parts:x.parts.filter(k=>k.productId!==_||k.productVariantId!==E)})),e.coupon&&f(e.coupon)},getPossibleGateways(){return Gi(e.parts,t)},removeCoupon(){c(null)},getDiscordSettings(){return Q2(t,e.parts)},updateQuantityOfProduct(_){Wi(t,_),s(E=>({...E,parts:E.parts.map(x=>x.productId===_.productId&&x.productVariantId===_.productVariantId?{...x,quantity:_.quantity,chargeType:_.chargeType}:x)})),e.coupon&&f(e.coupon)},getTotalAndDiscount(){const{coupon:_}=g.useCartStore.getState(),{total:E,totalWithVolumeDiscounts:x}=K2(e.parts,t);let k;const y=x;return _&&_.discount?!_.isFixed&&_.discount===100?k=0:k=_.isFixed?Math.max(0,y-_.discount):y*(1-_.discount/100):x!==E&&(k=x),{total:E,totalWithVolumeDiscounts:x!==E?x:void 0,totalWithDiscount:k}},setGateway(_){s(x=>({...x,gateway:_}));const{isAntistock:E}=g.useGeneralStore.getState();e.coupon&&!E&&f(e.coupon)},setPaymentMethod(_){s(E=>({...E,paymentMethod:_}))},async submitCart(_){l(!0);const{cart:E}=g.useCartStore.getState(),{discordInfo:x}=g.useDiscordStore.getState();let k;if(E.parts&&a&&J2(E.parts[0],t))try{const{data:y}=await T2({gateway:E.gateway,coupon:E.coupon,partOrder:E.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:x!=null&&x.authorized?x.id:null,customerEmail:a,recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId()});k=y.data}catch(y){console.error(y)}else try{const{data:y}=await g2({gateway:E.gateway,parts:[...E.parts],coupon:E.coupon,customerEmail:E.customerEmail,referralCode:localStorage.getItem("referralCode"),recaptcha:_,customFields:{...E.customFields},tsId:g.useGetTsId(),discordSocialConnectId:x!=null&&x.authorized?x.id:null,usePriorityReplacement:E.usePriorityReplacement===!0});k=y.data}catch(y){const D=y,{notifications:S,setNotifications:I}=g.useNotificationStore.getState();I([...S,{message:`Failed to create order: ${D.message}`,status:"error",id:g.v4()}])}if(l(!1),k)return k;throw new Error("Failed to create order")},setDiscordSocialConnectId(_){s(E=>({...E,discordSocialConnectId:_}))},setCustomFields(_){s(E=>({...E,customFields:{..._}}))}};return L.useEffect(()=>{s(_=>({..._,customerEmail:a??""}))},[a,s]),{cart:e,products:t,coupon:n,pending:r,applyCouponPending:u,applyCoupon:f,...b}},Zn=()=>{const{notifications:e,setNotifications:t}=g.useNotificationStore();return n=>{navigator.clipboard.writeText(n),t([...e,{status:"success",message:"Successfully copied",id:g.v4()}])}};var Ts={exports:{}},Au={exports:{}},Re={};/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -61,7 +61,7 @@ and limitations under the License.
|
|
|
61
61
|
`)}),n.push(r+"]"),n;if(e!==null&&typeof e=="object"){const u=Object.entries(e);return n.push(`{
|
|
62
62
|
`),u.forEach(([a,s],o)=>{n.push(Ka.repeat(t+1)),n.push(`"${a}": `),n.push(...Ls(s,t+1)),n.push(o<u.length-1?`,
|
|
63
63
|
`:`
|
|
64
|
-
`)}),n.push(r+"}"),n}return typeof e=="string"?(n.push(i.jsx("span",{className:re.jsonString,children:`"${e}"`})),n):typeof e=="number"?(n.push(i.jsx("span",{className:re.jsonNumber,children:String(e)})),n):typeof e=="boolean"?(n.push(i.jsx("span",{className:re.jsonBoolean,children:e?"true":"false"})),n):(n.push("null"),n)},s0=()=>{const e=Zn(),{shopDomain:t}=g.useStorefrontStore(),{notifications:n,setNotifications:r}=g.useNotificationStore(),{dashboardSettings:u}=g.useCustomerDashboardStore(),a=L.useMemo(()=>t||localStorage.getItem("fakeDomain")||window.location.hostname||"{customDomain}",[t]),s=L.useMemo(()=>`https://${a}/o-api`,[a]),[o,c]=L.useState(localStorage.getItem("token")||"{apiKey}"),[l,h]=L.useState(!1),[f,m]=L.useState(!1),p=L.useMemo(()=>o?o.length>20?`${o.slice(0,20)}…`:o:"",[o]),b=l?"Loading…":p,[_,E]=L.useState(""),[x,k]=L.useState(""),y=(u==null?void 0:u.products)??[],D=L.useMemo(()=>_&&y.find(se=>se.name===_)||null,[_,y]),S=(D==null?void 0:D.variants)??[],I=L.useMemo(()=>!x||!D?null:S.find(se=>se.name===x)||null,[x,S,D]),M=`${s}`,H=`${M}/v1/orders`,U={parts:[{productId:D?String(D.id):"{productId}",productVariantId:I?String(I.id):"{productVariantId}",quantity:1}]},P=JSON.stringify(U,null,2),B=`curl -X POST "${H}" -H "Authorization: Bearer ${o}" -H "Content-Type: application/json" -d '${P}'`,O={data:{id:"3fa85f64-5717-4562-b3fc-2c963f66afa6",fullAccessToken:"string"},message:"string",errors:[]},X=JSON.stringify(O,null,2),K=`curl -X GET "${`${M}/v1/orders/${a}/{id}/{accessToken}`}"`;L.useEffect(()=>{let se=!0;return(async()=>{var C;h(!0);try{const{data:V}=await W2(),te=(C=V==null?void 0:V.data)==null?void 0:C.accessToken;se&&te&&c(te)}catch(V){console.error("Failed to fetch customer API key",V)}finally{se&&h(!1)}})(),()=>{se=!1}},[]);const ue=async()=>{var se;m(!0);try{const{data:_e}=await Y2(),C=(se=_e==null?void 0:_e.data)==null?void 0:se.accessToken;C&&(c(C),r([...n,{id:g.v4(),message:"API key has been successfully regenerated.",status:"success"}]))}catch(_e){r([...n,{id:g.v4(),message:_e.message??"Failed to regenerate API Key.",status:"error"}])}finally{m(!1)}},ae=se=>{e(se)};return i.jsx("div",{className:re.apiPage,children:i.jsxs("div",{className:re.cards,children:[i.jsxs("section",{className:re.card,"aria-label":"API Key",children:[i.jsx("header",{className:re.cardHeader,children:i.jsxs("div",{className:re.cardHeaderRow,children:[i.jsx("div",{children:i.jsx("div",{className:re.cardTitle,children:"API Key"})}),i.jsx("div",{className:re.apiKeyMeta,children:i.jsx(N.Button,{type:"Secondary",className:re.regenerateButton,onClick:ue,disabled:f,children:f?"Regenerating...":"Regenerate"})})]})}),i.jsx("div",{className:re.fieldRow,children:i.jsxs("div",{className:re.fieldValueWrapper,children:[i.jsx("div",{className:re.fieldValue,children:b}),i.jsx("button",{type:"button",className:re.copyButton,onClick:()=>ae(o),"aria-label":"Copy API key",children:i.jsx(N.Icon,{name:"Copy"})})]})})]}),i.jsxs("section",{className:re.card,"aria-label":"API Getting Started",children:[i.jsx("header",{className:re.cardHeader,children:i.jsx("div",{className:re.cardTitle,children:"Getting Started"})}),i.jsxs("div",{className:re.fieldRow,children:[i.jsx("div",{className:re.fieldLabel,children:"Base URL"}),i.jsxs("div",{className:re.fieldValueWrapper,children:[i.jsx("div",{className:re.fieldValue,children:s}),i.jsx("button",{type:"button",className:re.copyButton,onClick:()=>ae(s),"aria-label":"Copy base URL",children:i.jsx(N.Icon,{name:"Copy"})})]})]}),i.jsxs("div",{className:re.fieldRow,children:[i.jsx("div",{className:re.fieldLabel,children:"Authorization"}),i.jsxs("div",{className:re.fieldValueWrapper,children:[i.jsx("div",{className:re.fieldValue,children:`Bearer ${p}`}),i.jsx("button",{type:"button",className:re.copyButton,onClick:()=>ae(`Bearer ${o}`),"aria-label":"Copy authentication header",children:i.jsx(N.Icon,{name:"Copy"})})]})]})]}),i.jsxs("section",{className:re.card,"aria-label":"Purchase Product via API",children:[i.jsxs("header",{className:re.cardHeader,children:[i.jsx("div",{className:re.cardTitle,children:(u==null?void 0:u.purchaseProductCustomTitle)||"Purchase Product via API"}),u!=null&&u.purchaseProductCustomDescription?i.jsx("div",{className:re.cardDescription,children:u==null?void 0:u.purchaseProductCustomDescription}):null]}),i.jsxs("div",{className:re.twoColumn,children:[i.jsxs("div",{className:re.selectorGroup,children:[i.jsxs("label",{className:re.selectorLabel,children:["Product",i.jsx(N.Select,{options:y.map(se=>se.name),value:_||"Select product",onChange:se=>{E(se),k("")}})]}),D&&i.jsxs("label",{className:re.selectorLabel,children:["Variant",i.jsx(N.Select,{options:S.map(se=>se.name),value:x||"Select variant",onChange:se=>k(se)})]})]}),i.jsxs("div",{className:re.codeBlockGroup,children:[i.jsxs("div",{className:re.codeBlock,children:[i.jsxs("div",{className:re.codeHeader,children:[i.jsx("div",{className:re.codeTitle,children:"Example Request"}),i.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[i.jsx("div",{className:re.codeMethod,children:"POST"}),i.jsx("button",{className:re.copyButton,type:"button",onClick:()=>ae(B),"aria-label":"Copy example request",children:i.jsx(N.Icon,{name:"Copy"})})]})]}),i.jsx("pre",{style:{color:"var(--text-secondary)"},className:re.codeBody,children:B})]}),i.jsxs("div",{className:re.codeBlock,children:[i.jsxs("div",{className:re.codeHeader,children:[i.jsx("div",{className:re.codeTitle,children:"Example Response"}),i.jsx("button",{className:re.copyButton,type:"button",onClick:()=>ae(X),"aria-label":"Copy example response",children:i.jsx(N.Icon,{name:"Copy"})})]}),i.jsx("pre",{className:re.codeBody,children:Ls(O)})]})]})]})]}),i.jsxs("section",{className:re.card,"aria-label":"Check Order Status",children:[i.jsx("header",{className:re.cardHeader,children:i.jsx("div",{className:re.cardTitle,children:"Check Order Status"})}),i.jsxs("ul",{className:re.endpointDescriptionList,children:[i.jsx("li",{children:"id: Order ID returned when creating an order"}),i.jsx("li",{children:"accessToken: FullAccessToken returned when creating an order"})]}),i.jsxs("div",{className:re.codeBlock,children:[i.jsxs("div",{className:re.codeHeader,children:[i.jsx("div",{className:re.codeTitle,children:"Example Request"}),i.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[i.jsx("div",{className:re.codeMethod,children:"GET"}),i.jsx("button",{className:re.copyButton,type:"button",onClick:()=>ae(K),"aria-label":"Copy status example request",children:i.jsx(N.Icon,{name:"Copy"})})]})]}),i.jsx("pre",{className:re.codeBody,children:K})]})]})]})})};var S4=Object.defineProperty,I4=Object.defineProperties,N4=Object.getOwnPropertyDescriptors,Ku=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,o0=Object.prototype.propertyIsEnumerable,Po=(e,t,n)=>t in e?S4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v4=(e,t)=>{for(var n in t||(t={}))i0.call(t,n)&&Po(e,n,t[n]);if(Ku)for(var n of Ku(t))o0.call(t,n)&&Po(e,n,t[n]);return e},w4=(e,t)=>I4(e,N4(t)),D4=(e,t)=>{var n={};for(var r in e)i0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ku)for(var r of Ku(e))t.indexOf(r)<0&&o0.call(e,r)&&(n[r]=e[r]);return n};function L4(e){let t=setTimeout(e,0),n=setTimeout(e,10),r=setTimeout(e,50);return[t,n,r]}function P4(e){let t=me.useRef();return me.useEffect(()=>{t.current=e}),t.current}var R4=18,c0=40,M4=`${c0}px`,O4=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function j4({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[u,a]=me.useState(!1),[s,o]=me.useState(!1),[c,l]=me.useState(!1),h=me.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&u&&s,[u,s,n]),f=me.useCallback(()=>{let m=e.current,p=t.current;if(!m||!p||c||n==="none")return;let b=m,_=b.getBoundingClientRect().left+b.offsetWidth,E=b.getBoundingClientRect().top+b.offsetHeight/2,x=_-R4,k=E;document.querySelectorAll(O4).length===0&&document.elementFromPoint(x,k)===m||(a(!0),l(!0))},[e,t,c,n]);return me.useEffect(()=>{let m=e.current;if(!m||n==="none")return;function p(){let _=window.innerWidth-m.getBoundingClientRect().right;o(_>=c0)}p();let b=setInterval(p,1e3);return()=>{clearInterval(b)}},[e,n]),me.useEffect(()=>{let m=r||document.activeElement===t.current;if(n==="none"||!m)return;let p=setTimeout(f,0),b=setTimeout(f,2e3),_=setTimeout(f,5e3),E=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(p),clearTimeout(b),clearTimeout(_),clearTimeout(E)}},[t,r,n,f]),{hasPWMBadge:u,willPushPWMBadge:h,PWM_BADGE_SPACE_WIDTH:M4}}var F4=me.createContext({}),l0=me.forwardRef((e,t)=>{var n=e,{value:r,onChange:u,maxLength:a,textAlign:s="left",pattern:o,placeholder:c,inputMode:l="numeric",onComplete:h,pushPasswordManagerStrategy:f="increase-width",pasteTransformer:m,containerClassName:p,noScriptCSSFallback:b=B4,render:_,children:E}=n,x=D4(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),k,y,D,S,I;let[M,H]=me.useState(typeof x.defaultValue=="string"?x.defaultValue:""),U=r??M,P=P4(U),B=me.useCallback(oe=>{u==null||u(oe),H(oe)},[u]),O=me.useMemo(()=>o?typeof o=="string"?new RegExp(o):o:null,[o]),X=me.useRef(null),Y=me.useRef(null),K=me.useRef({value:U,onChange:B,isIOS:typeof window<"u"&&((y=(k=window==null?void 0:window.CSS)==null?void 0:k.supports)==null?void 0:y.call(k,"-webkit-touch-callout","none"))}),ue=me.useRef({prev:[(D=X.current)==null?void 0:D.selectionStart,(S=X.current)==null?void 0:S.selectionEnd,(I=X.current)==null?void 0:I.selectionDirection]});me.useImperativeHandle(t,()=>X.current,[]),me.useEffect(()=>{let oe=X.current,pe=Y.current;if(!oe||!pe)return;K.current.value!==oe.value&&K.current.onChange(oe.value),ue.current.prev=[oe.selectionStart,oe.selectionEnd,oe.selectionDirection];function Qe(){if(document.activeElement!==oe){te(null),J(null);return}let ee=oe.selectionStart,ge=oe.selectionEnd,mt=oe.selectionDirection,gt=oe.maxLength,qt=oe.value,At=ue.current.prev,Ve=-1,j=-1,W;if(qt.length!==0&&ee!==null&&ge!==null){let Ot=ee===ge,_n=ee===qt.length&&qt.length<gt;if(Ot&&!_n){let dt=ee;if(dt===0)Ve=0,j=1,W="forward";else if(dt===gt)Ve=dt-1,j=dt,W="backward";else if(gt>1&&qt.length>1){let xn=0;if(At[0]!==null&&At[1]!==null){W=dt<At[1]?"backward":"forward";let Yn=At[0]===At[1]&&At[0]<gt;W==="backward"&&!Yn&&(xn=-1)}Ve=xn+dt,j=xn+dt+1}}Ve!==-1&&j!==-1&&Ve!==j&&X.current.setSelectionRange(Ve,j,W)}let fe=Ve!==-1?Ve:ee,Se=j!==-1?j:ge,Oe=W??mt;te(fe),J(Se),ue.current.prev=[fe,Se,Oe]}if(document.addEventListener("selectionchange",Qe,{capture:!0}),Qe(),document.activeElement===oe&&C(!0),!document.getElementById("input-otp-style")){let ee=document.createElement("style");if(ee.id="input-otp-style",document.head.appendChild(ee),ee.sheet){let ge="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";Fr(ee.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),Fr(ee.sheet,`[data-input-otp]:autofill { ${ge} }`),Fr(ee.sheet,`[data-input-otp]:-webkit-autofill { ${ge} }`),Fr(ee.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),Fr(ee.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let Ee=()=>{pe&&pe.style.setProperty("--root-height",`${oe.clientHeight}px`)};Ee();let Ne=new ResizeObserver(Ee);return Ne.observe(oe),()=>{document.removeEventListener("selectionchange",Qe,{capture:!0}),Ne.disconnect()}},[]);let[ae,se]=me.useState(!1),[_e,C]=me.useState(!1),[V,te]=me.useState(null),[v,J]=me.useState(null);me.useEffect(()=>{L4(()=>{var oe,pe,Qe,Ee;(oe=X.current)==null||oe.dispatchEvent(new Event("input"));let Ne=(pe=X.current)==null?void 0:pe.selectionStart,ee=(Qe=X.current)==null?void 0:Qe.selectionEnd,ge=(Ee=X.current)==null?void 0:Ee.selectionDirection;Ne!==null&&ee!==null&&(te(Ne),J(ee),ue.current.prev=[Ne,ee,ge])})},[U,_e]),me.useEffect(()=>{P!==void 0&&U!==P&&P.length<a&&U.length===a&&(h==null||h(U))},[a,h,P,U]);let ne=j4({containerRef:Y,inputRef:X,pushPasswordManagerStrategy:f,isFocused:_e}),Q=me.useCallback(oe=>{let pe=oe.currentTarget.value.slice(0,a);if(pe.length>0&&O&&!O.test(pe)){oe.preventDefault();return}typeof P=="string"&&pe.length<P.length&&document.dispatchEvent(new Event("selectionchange")),B(pe)},[a,B,P,O]),de=me.useCallback(()=>{var oe;if(X.current){let pe=Math.min(X.current.value.length,a-1),Qe=X.current.value.length;(oe=X.current)==null||oe.setSelectionRange(pe,Qe),te(pe),J(Qe)}C(!0)},[a]),le=me.useCallback(oe=>{var pe,Qe;let Ee=X.current;if(!m&&(!K.current.isIOS||!oe.clipboardData||!Ee))return;let Ne=oe.clipboardData.getData("text/plain"),ee=m?m(Ne):Ne;oe.preventDefault();let ge=(pe=X.current)==null?void 0:pe.selectionStart,mt=(Qe=X.current)==null?void 0:Qe.selectionEnd,gt=(ge!==mt?U.slice(0,ge)+ee+U.slice(mt):U.slice(0,ge)+ee+U.slice(ge)).slice(0,a);if(gt.length>0&&O&&!O.test(gt))return;Ee.value=gt,B(gt);let qt=Math.min(gt.length,a-1),At=gt.length;Ee.setSelectionRange(qt,At),te(qt),J(At)},[a,B,O,U]),ie=me.useMemo(()=>({position:"relative",cursor:x.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[x.disabled]),xe=me.useMemo(()=>({position:"absolute",inset:0,width:ne.willPushPWMBadge?`calc(100% + ${ne.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:ne.willPushPWMBadge?`inset(0 ${ne.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:s,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[ne.PWM_BADGE_SPACE_WIDTH,ne.willPushPWMBadge,s]),$e=me.useMemo(()=>me.createElement("input",w4(v4({autoComplete:x.autoComplete||"one-time-code"},x),{"data-input-otp":!0,"data-input-otp-placeholder-shown":U.length===0||void 0,"data-input-otp-mss":V,"data-input-otp-mse":v,inputMode:l,pattern:O==null?void 0:O.source,"aria-placeholder":c,style:xe,maxLength:a,value:U,ref:X,onPaste:oe=>{var pe;le(oe),(pe=x.onPaste)==null||pe.call(x,oe)},onChange:Q,onMouseOver:oe=>{var pe;se(!0),(pe=x.onMouseOver)==null||pe.call(x,oe)},onMouseLeave:oe=>{var pe;se(!1),(pe=x.onMouseLeave)==null||pe.call(x,oe)},onFocus:oe=>{var pe;de(),(pe=x.onFocus)==null||pe.call(x,oe)},onBlur:oe=>{var pe;C(!1),(pe=x.onBlur)==null||pe.call(x,oe)}})),[Q,de,le,l,xe,a,v,V,x,O==null?void 0:O.source,U]),G=me.useMemo(()=>({slots:Array.from({length:a}).map((oe,pe)=>{var Qe;let Ee=_e&&V!==null&&v!==null&&(V===v&&pe===V||pe>=V&&pe<v),Ne=U[pe]!==void 0?U[pe]:null,ee=U[0]!==void 0?null:(Qe=c==null?void 0:c[pe])!=null?Qe:null;return{char:Ne,placeholderChar:ee,isActive:Ee,hasFakeCaret:Ee&&Ne===null}}),isFocused:_e,isHovering:!x.disabled&&ae}),[_e,ae,a,v,V,x.disabled,U]),pt=me.useMemo(()=>_?_(G):me.createElement(F4.Provider,{value:G},E),[E,G,_]);return me.createElement(me.Fragment,null,b!==null&&me.createElement("noscript",null,me.createElement("style",null,b)),me.createElement("div",{ref:Y,"data-input-otp-container":!0,style:ie,className:p},pt,me.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},$e)))});l0.displayName="Input";function Fr(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var B4=`
|
|
64
|
+
`)}),n.push(r+"}"),n}return typeof e=="string"?(n.push(i.jsx("span",{className:re.jsonString,children:`"${e}"`})),n):typeof e=="number"?(n.push(i.jsx("span",{className:re.jsonNumber,children:String(e)})),n):typeof e=="boolean"?(n.push(i.jsx("span",{className:re.jsonBoolean,children:e?"true":"false"})),n):(n.push("null"),n)},s0=()=>{const e=Zn(),{shopDomain:t}=g.useStorefrontStore(),{notifications:n,setNotifications:r}=g.useNotificationStore(),{dashboardSettings:u}=g.useCustomerDashboardStore(),a=L.useMemo(()=>t||localStorage.getItem("fakeDomain")||window.location.hostname||"{customDomain}",[t]),s=L.useMemo(()=>`https://${a}/o-api`,[a]),[o,c]=L.useState(localStorage.getItem("token")||"{apiKey}"),[l,h]=L.useState(!1),[f,m]=L.useState(!1),p=L.useMemo(()=>o?o.length>20?`${o.slice(0,20)}…`:o:"",[o]),b=l?"Loading…":p,[_,E]=L.useState(""),[x,k]=L.useState(""),y=(u==null?void 0:u.products)??[],D=L.useMemo(()=>_&&y.find(se=>se.name===_)||null,[_,y]),S=(D==null?void 0:D.variants)??[],I=L.useMemo(()=>!x||!D?null:S.find(se=>se.name===x)||null,[x,S,D]),M=`${s}`,H=`${M}/v1/customer-orders/${a}`,U={parts:[{productId:D?String(D.id):"{productId}",productVariantId:I?String(I.id):"{productVariantId}",quantity:1}]},P=JSON.stringify(U,null,2),B=`curl -X POST "${H}" -H "Authorization: Bearer ${o}" -H "Content-Type: application/json" -d '${P}'`,O={data:{id:"3fa85f64-5717-4562-b3fc-2c963f66afa6",fullAccessToken:"string"},message:"string",errors:[]},X=JSON.stringify(O,null,2),K=`curl -X GET "${`${M}/v1/orders/${a}/{id}/{accessToken}`}"`;L.useEffect(()=>{let se=!0;return(async()=>{var C;h(!0);try{const{data:V}=await W2(),te=(C=V==null?void 0:V.data)==null?void 0:C.accessToken;se&&te&&c(te)}catch(V){console.error("Failed to fetch customer API key",V)}finally{se&&h(!1)}})(),()=>{se=!1}},[]);const ue=async()=>{var se;m(!0);try{const{data:_e}=await Y2(),C=(se=_e==null?void 0:_e.data)==null?void 0:se.accessToken;C&&(c(C),r([...n,{id:g.v4(),message:"API key has been successfully regenerated.",status:"success"}]))}catch(_e){r([...n,{id:g.v4(),message:_e.message??"Failed to regenerate API Key.",status:"error"}])}finally{m(!1)}},ae=se=>{e(se)};return i.jsx("div",{className:re.apiPage,children:i.jsxs("div",{className:re.cards,children:[i.jsxs("section",{className:re.card,"aria-label":"API Key",children:[i.jsx("header",{className:re.cardHeader,children:i.jsxs("div",{className:re.cardHeaderRow,children:[i.jsx("div",{children:i.jsx("div",{className:re.cardTitle,children:"API Key"})}),i.jsx("div",{className:re.apiKeyMeta,children:i.jsx(N.Button,{type:"Secondary",className:re.regenerateButton,onClick:ue,disabled:f,children:f?"Regenerating...":"Regenerate"})})]})}),i.jsx("div",{className:re.fieldRow,children:i.jsxs("div",{className:re.fieldValueWrapper,children:[i.jsx("div",{className:re.fieldValue,children:b}),i.jsx("button",{type:"button",className:re.copyButton,onClick:()=>ae(o),"aria-label":"Copy API key",children:i.jsx(N.Icon,{name:"Copy"})})]})})]}),i.jsxs("section",{className:re.card,"aria-label":"API Getting Started",children:[i.jsx("header",{className:re.cardHeader,children:i.jsx("div",{className:re.cardTitle,children:"Getting Started"})}),i.jsxs("div",{className:re.fieldRow,children:[i.jsx("div",{className:re.fieldLabel,children:"Base URL"}),i.jsxs("div",{className:re.fieldValueWrapper,children:[i.jsx("div",{className:re.fieldValue,children:s}),i.jsx("button",{type:"button",className:re.copyButton,onClick:()=>ae(s),"aria-label":"Copy base URL",children:i.jsx(N.Icon,{name:"Copy"})})]})]}),i.jsxs("div",{className:re.fieldRow,children:[i.jsx("div",{className:re.fieldLabel,children:"Authorization"}),i.jsxs("div",{className:re.fieldValueWrapper,children:[i.jsx("div",{className:re.fieldValue,children:`Bearer ${p}`}),i.jsx("button",{type:"button",className:re.copyButton,onClick:()=>ae(`Bearer ${o}`),"aria-label":"Copy authentication header",children:i.jsx(N.Icon,{name:"Copy"})})]})]})]}),i.jsxs("section",{className:re.card,"aria-label":"Purchase Product via API",children:[i.jsxs("header",{className:re.cardHeader,children:[i.jsx("div",{className:re.cardTitle,children:(u==null?void 0:u.purchaseProductCustomTitle)||"Purchase Product via API"}),u!=null&&u.purchaseProductCustomDescription?i.jsx("div",{className:re.cardDescription,children:u==null?void 0:u.purchaseProductCustomDescription}):null]}),i.jsxs("div",{className:re.twoColumn,children:[i.jsxs("div",{className:re.selectorGroup,children:[i.jsxs("label",{className:re.selectorLabel,children:["Product",i.jsx(N.Select,{options:y.map(se=>se.name),value:_||"Select product",onChange:se=>{E(se),k("")}})]}),D&&i.jsxs("label",{className:re.selectorLabel,children:["Variant",i.jsx(N.Select,{options:S.map(se=>se.name),value:x||"Select variant",onChange:se=>k(se)})]})]}),i.jsxs("div",{className:re.codeBlockGroup,children:[i.jsxs("div",{className:re.codeBlock,children:[i.jsxs("div",{className:re.codeHeader,children:[i.jsx("div",{className:re.codeTitle,children:"Example Request"}),i.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[i.jsx("div",{className:re.codeMethod,children:"POST"}),i.jsx("button",{className:re.copyButton,type:"button",onClick:()=>ae(B),"aria-label":"Copy example request",children:i.jsx(N.Icon,{name:"Copy"})})]})]}),i.jsx("pre",{style:{color:"var(--text-secondary)"},className:re.codeBody,children:B})]}),i.jsxs("div",{className:re.codeBlock,children:[i.jsxs("div",{className:re.codeHeader,children:[i.jsx("div",{className:re.codeTitle,children:"Example Response"}),i.jsx("button",{className:re.copyButton,type:"button",onClick:()=>ae(X),"aria-label":"Copy example response",children:i.jsx(N.Icon,{name:"Copy"})})]}),i.jsx("pre",{className:re.codeBody,children:Ls(O)})]})]})]})]}),i.jsxs("section",{className:re.card,"aria-label":"Check Order Status",children:[i.jsx("header",{className:re.cardHeader,children:i.jsx("div",{className:re.cardTitle,children:"Check Order Status"})}),i.jsxs("ul",{className:re.endpointDescriptionList,children:[i.jsx("li",{children:"id: Order ID returned when creating an order"}),i.jsx("li",{children:"accessToken: FullAccessToken returned when creating an order"})]}),i.jsxs("div",{className:re.codeBlock,children:[i.jsxs("div",{className:re.codeHeader,children:[i.jsx("div",{className:re.codeTitle,children:"Example Request"}),i.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[i.jsx("div",{className:re.codeMethod,children:"GET"}),i.jsx("button",{className:re.copyButton,type:"button",onClick:()=>ae(K),"aria-label":"Copy status example request",children:i.jsx(N.Icon,{name:"Copy"})})]})]}),i.jsx("pre",{className:re.codeBody,children:K})]})]})]})})};var S4=Object.defineProperty,I4=Object.defineProperties,N4=Object.getOwnPropertyDescriptors,Ku=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,o0=Object.prototype.propertyIsEnumerable,Po=(e,t,n)=>t in e?S4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v4=(e,t)=>{for(var n in t||(t={}))i0.call(t,n)&&Po(e,n,t[n]);if(Ku)for(var n of Ku(t))o0.call(t,n)&&Po(e,n,t[n]);return e},w4=(e,t)=>I4(e,N4(t)),D4=(e,t)=>{var n={};for(var r in e)i0.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ku)for(var r of Ku(e))t.indexOf(r)<0&&o0.call(e,r)&&(n[r]=e[r]);return n};function L4(e){let t=setTimeout(e,0),n=setTimeout(e,10),r=setTimeout(e,50);return[t,n,r]}function P4(e){let t=me.useRef();return me.useEffect(()=>{t.current=e}),t.current}var R4=18,c0=40,M4=`${c0}px`,O4=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function j4({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[u,a]=me.useState(!1),[s,o]=me.useState(!1),[c,l]=me.useState(!1),h=me.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&u&&s,[u,s,n]),f=me.useCallback(()=>{let m=e.current,p=t.current;if(!m||!p||c||n==="none")return;let b=m,_=b.getBoundingClientRect().left+b.offsetWidth,E=b.getBoundingClientRect().top+b.offsetHeight/2,x=_-R4,k=E;document.querySelectorAll(O4).length===0&&document.elementFromPoint(x,k)===m||(a(!0),l(!0))},[e,t,c,n]);return me.useEffect(()=>{let m=e.current;if(!m||n==="none")return;function p(){let _=window.innerWidth-m.getBoundingClientRect().right;o(_>=c0)}p();let b=setInterval(p,1e3);return()=>{clearInterval(b)}},[e,n]),me.useEffect(()=>{let m=r||document.activeElement===t.current;if(n==="none"||!m)return;let p=setTimeout(f,0),b=setTimeout(f,2e3),_=setTimeout(f,5e3),E=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(p),clearTimeout(b),clearTimeout(_),clearTimeout(E)}},[t,r,n,f]),{hasPWMBadge:u,willPushPWMBadge:h,PWM_BADGE_SPACE_WIDTH:M4}}var F4=me.createContext({}),l0=me.forwardRef((e,t)=>{var n=e,{value:r,onChange:u,maxLength:a,textAlign:s="left",pattern:o,placeholder:c,inputMode:l="numeric",onComplete:h,pushPasswordManagerStrategy:f="increase-width",pasteTransformer:m,containerClassName:p,noScriptCSSFallback:b=B4,render:_,children:E}=n,x=D4(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),k,y,D,S,I;let[M,H]=me.useState(typeof x.defaultValue=="string"?x.defaultValue:""),U=r??M,P=P4(U),B=me.useCallback(oe=>{u==null||u(oe),H(oe)},[u]),O=me.useMemo(()=>o?typeof o=="string"?new RegExp(o):o:null,[o]),X=me.useRef(null),Y=me.useRef(null),K=me.useRef({value:U,onChange:B,isIOS:typeof window<"u"&&((y=(k=window==null?void 0:window.CSS)==null?void 0:k.supports)==null?void 0:y.call(k,"-webkit-touch-callout","none"))}),ue=me.useRef({prev:[(D=X.current)==null?void 0:D.selectionStart,(S=X.current)==null?void 0:S.selectionEnd,(I=X.current)==null?void 0:I.selectionDirection]});me.useImperativeHandle(t,()=>X.current,[]),me.useEffect(()=>{let oe=X.current,pe=Y.current;if(!oe||!pe)return;K.current.value!==oe.value&&K.current.onChange(oe.value),ue.current.prev=[oe.selectionStart,oe.selectionEnd,oe.selectionDirection];function Qe(){if(document.activeElement!==oe){te(null),J(null);return}let ee=oe.selectionStart,ge=oe.selectionEnd,mt=oe.selectionDirection,gt=oe.maxLength,qt=oe.value,At=ue.current.prev,Ve=-1,j=-1,W;if(qt.length!==0&&ee!==null&&ge!==null){let Ot=ee===ge,_n=ee===qt.length&&qt.length<gt;if(Ot&&!_n){let dt=ee;if(dt===0)Ve=0,j=1,W="forward";else if(dt===gt)Ve=dt-1,j=dt,W="backward";else if(gt>1&&qt.length>1){let xn=0;if(At[0]!==null&&At[1]!==null){W=dt<At[1]?"backward":"forward";let Yn=At[0]===At[1]&&At[0]<gt;W==="backward"&&!Yn&&(xn=-1)}Ve=xn+dt,j=xn+dt+1}}Ve!==-1&&j!==-1&&Ve!==j&&X.current.setSelectionRange(Ve,j,W)}let fe=Ve!==-1?Ve:ee,Se=j!==-1?j:ge,Oe=W??mt;te(fe),J(Se),ue.current.prev=[fe,Se,Oe]}if(document.addEventListener("selectionchange",Qe,{capture:!0}),Qe(),document.activeElement===oe&&C(!0),!document.getElementById("input-otp-style")){let ee=document.createElement("style");if(ee.id="input-otp-style",document.head.appendChild(ee),ee.sheet){let ge="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";Fr(ee.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),Fr(ee.sheet,`[data-input-otp]:autofill { ${ge} }`),Fr(ee.sheet,`[data-input-otp]:-webkit-autofill { ${ge} }`),Fr(ee.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),Fr(ee.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let Ee=()=>{pe&&pe.style.setProperty("--root-height",`${oe.clientHeight}px`)};Ee();let Ne=new ResizeObserver(Ee);return Ne.observe(oe),()=>{document.removeEventListener("selectionchange",Qe,{capture:!0}),Ne.disconnect()}},[]);let[ae,se]=me.useState(!1),[_e,C]=me.useState(!1),[V,te]=me.useState(null),[v,J]=me.useState(null);me.useEffect(()=>{L4(()=>{var oe,pe,Qe,Ee;(oe=X.current)==null||oe.dispatchEvent(new Event("input"));let Ne=(pe=X.current)==null?void 0:pe.selectionStart,ee=(Qe=X.current)==null?void 0:Qe.selectionEnd,ge=(Ee=X.current)==null?void 0:Ee.selectionDirection;Ne!==null&&ee!==null&&(te(Ne),J(ee),ue.current.prev=[Ne,ee,ge])})},[U,_e]),me.useEffect(()=>{P!==void 0&&U!==P&&P.length<a&&U.length===a&&(h==null||h(U))},[a,h,P,U]);let ne=j4({containerRef:Y,inputRef:X,pushPasswordManagerStrategy:f,isFocused:_e}),Q=me.useCallback(oe=>{let pe=oe.currentTarget.value.slice(0,a);if(pe.length>0&&O&&!O.test(pe)){oe.preventDefault();return}typeof P=="string"&&pe.length<P.length&&document.dispatchEvent(new Event("selectionchange")),B(pe)},[a,B,P,O]),de=me.useCallback(()=>{var oe;if(X.current){let pe=Math.min(X.current.value.length,a-1),Qe=X.current.value.length;(oe=X.current)==null||oe.setSelectionRange(pe,Qe),te(pe),J(Qe)}C(!0)},[a]),le=me.useCallback(oe=>{var pe,Qe;let Ee=X.current;if(!m&&(!K.current.isIOS||!oe.clipboardData||!Ee))return;let Ne=oe.clipboardData.getData("text/plain"),ee=m?m(Ne):Ne;oe.preventDefault();let ge=(pe=X.current)==null?void 0:pe.selectionStart,mt=(Qe=X.current)==null?void 0:Qe.selectionEnd,gt=(ge!==mt?U.slice(0,ge)+ee+U.slice(mt):U.slice(0,ge)+ee+U.slice(ge)).slice(0,a);if(gt.length>0&&O&&!O.test(gt))return;Ee.value=gt,B(gt);let qt=Math.min(gt.length,a-1),At=gt.length;Ee.setSelectionRange(qt,At),te(qt),J(At)},[a,B,O,U]),ie=me.useMemo(()=>({position:"relative",cursor:x.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[x.disabled]),xe=me.useMemo(()=>({position:"absolute",inset:0,width:ne.willPushPWMBadge?`calc(100% + ${ne.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:ne.willPushPWMBadge?`inset(0 ${ne.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:s,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[ne.PWM_BADGE_SPACE_WIDTH,ne.willPushPWMBadge,s]),$e=me.useMemo(()=>me.createElement("input",w4(v4({autoComplete:x.autoComplete||"one-time-code"},x),{"data-input-otp":!0,"data-input-otp-placeholder-shown":U.length===0||void 0,"data-input-otp-mss":V,"data-input-otp-mse":v,inputMode:l,pattern:O==null?void 0:O.source,"aria-placeholder":c,style:xe,maxLength:a,value:U,ref:X,onPaste:oe=>{var pe;le(oe),(pe=x.onPaste)==null||pe.call(x,oe)},onChange:Q,onMouseOver:oe=>{var pe;se(!0),(pe=x.onMouseOver)==null||pe.call(x,oe)},onMouseLeave:oe=>{var pe;se(!1),(pe=x.onMouseLeave)==null||pe.call(x,oe)},onFocus:oe=>{var pe;de(),(pe=x.onFocus)==null||pe.call(x,oe)},onBlur:oe=>{var pe;C(!1),(pe=x.onBlur)==null||pe.call(x,oe)}})),[Q,de,le,l,xe,a,v,V,x,O==null?void 0:O.source,U]),G=me.useMemo(()=>({slots:Array.from({length:a}).map((oe,pe)=>{var Qe;let Ee=_e&&V!==null&&v!==null&&(V===v&&pe===V||pe>=V&&pe<v),Ne=U[pe]!==void 0?U[pe]:null,ee=U[0]!==void 0?null:(Qe=c==null?void 0:c[pe])!=null?Qe:null;return{char:Ne,placeholderChar:ee,isActive:Ee,hasFakeCaret:Ee&&Ne===null}}),isFocused:_e,isHovering:!x.disabled&&ae}),[_e,ae,a,v,V,x.disabled,U]),pt=me.useMemo(()=>_?_(G):me.createElement(F4.Provider,{value:G},E),[E,G,_]);return me.createElement(me.Fragment,null,b!==null&&me.createElement("noscript",null,me.createElement("style",null,b)),me.createElement("div",{ref:Y,"data-input-otp-container":!0,style:ie,className:p},pt,me.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},$e)))});l0.displayName="Input";function Fr(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var B4=`
|
|
65
65
|
[data-input-otp] {
|
|
66
66
|
--nojs-bg: white !important;
|
|
67
67
|
--nojs-fg: black !important;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./charge-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./charge-DcKd_es2.cjs"),u=require("./builder-BNQD7fm1.cjs"),l=require("react"),_=require("./ui-components-jkqz3-Kc.cjs");require("./builder-components-B8gWw88v.cjs");require("react-dom");require("./ticket-C5g3kw8c.cjs");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,11 +1,11 @@
|
|
|
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-
|
|
3
|
-
import { K as A, p as G } from "./builder-
|
|
2
|
+
import { u as D, C as N, a as x } from "./charge-Bv8wu-fV.js";
|
|
3
|
+
import { K as A, p as G } from "./builder-Cbzb-Pzj.js";
|
|
4
4
|
import c from "react";
|
|
5
|
-
import { e as P } from "./ui-components-
|
|
6
|
-
import "./builder-components-
|
|
5
|
+
import { e as P } from "./ui-components-BhVIVLV-.js";
|
|
6
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
7
7
|
import "react-dom";
|
|
8
|
-
import "./ticket-
|
|
8
|
+
import "./ticket-CbQabuyp.js";
|
|
9
9
|
const S = "_checkoutContainer_thje1_1", b = "_loaderContainer_thje1_20", s = {
|
|
10
10
|
checkoutContainer: S,
|
|
11
11
|
loaderContainer: b
|
package/dist/exports.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const o=require("./builder-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const o=require("./builder-BNQD7fm1.cjs"),a=require("./ui-components-jkqz3-Kc.cjs");require("./builder-components-B8gWw88v.cjs");const t=require("./charge-DcKd_es2.cjs"),e=require("./ticket-C5g3kw8c.cjs"),r=require("./checkout-BQwNBpVW.cjs");require("react-dom");exports.AntistockRoutes=o.AntistockRoutes;exports.Routes=o.Routes;exports.formatPrice=o.formatPrice;exports.ImagesLoader=a.ImagesLoader;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;
|
package/dist/exports.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Y as i, Z as p, _ as u } from "./builder-
|
|
4
|
-
import { k as c } from "./ui-components-
|
|
5
|
-
import "./builder-components-
|
|
6
|
-
import { M as f, G as d, J as l, u as x, I as C, K as h, H as k } from "./charge-
|
|
7
|
-
import { C as I, c as T, h as v, i as w, r as M, d as N, s as P, u as b, e as g, b as A, a as B } from "./ticket-
|
|
8
|
-
import { Checkout as J } from "./checkout-
|
|
3
|
+
import { Y as i, Z as p, _ as u } from "./builder-Cbzb-Pzj.js";
|
|
4
|
+
import { k as c } from "./ui-components-BhVIVLV-.js";
|
|
5
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
6
|
+
import { M as f, G as d, J as l, u as x, I as C, K as h, H as k } from "./charge-Bv8wu-fV.js";
|
|
7
|
+
import { C as I, c as T, h as v, i as w, r as M, d as N, s as P, u as b, e as g, b as A, a as B } from "./ticket-CbQabuyp.js";
|
|
8
|
+
import { Checkout as J } from "./checkout-DkIvY2zs.js";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
export {
|
|
11
11
|
i as AntistockRoutes,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { N as i, K as m } from "./builder-
|
|
3
|
-
import { a2 as l, a3 as p, a4 as d, M as _ } from "./charge-
|
|
2
|
+
import { N as i, K as m } from "./builder-Cbzb-Pzj.js";
|
|
3
|
+
import { a2 as l, a3 as p, a4 as d, M as _ } from "./charge-Bv8wu-fV.js";
|
|
4
4
|
const x = "_wrapper_x27n6_1", f = "_content_x27n6_10", v = "_title_x27n6_18", h = "_text_x27n6_24", N = "_empty_x27n6_42", r = {
|
|
5
5
|
wrapper: x,
|
|
6
6
|
content: f,
|
|
@@ -1,11 +1,11 @@
|
|
|
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-
|
|
2
|
+
import { B as m, a as w, C as _ } from "./ui-components-BhVIVLV-.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-
|
|
5
|
-
import "./builder-components-
|
|
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-Cbzb-Pzj.js";
|
|
5
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
6
6
|
import "react-dom";
|
|
7
|
-
import "./charge-
|
|
8
|
-
import "./ticket-
|
|
7
|
+
import "./charge-Bv8wu-fV.js";
|
|
8
|
+
import "./ticket-CbQabuyp.js";
|
|
9
9
|
const C = "_wrapper_1yd2j_1", A = "_error_1yd2j_11", N = "_title_1yd2j_21", B = "_buttons_1yd2j_29", i = {
|
|
10
10
|
wrapper: C,
|
|
11
11
|
error: A,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("./builder-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("./builder-BNQD7fm1.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,11 +1,11 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import "./builder-
|
|
2
|
+
import "./builder-Cbzb-Pzj.js";
|
|
3
3
|
import e from "react";
|
|
4
|
-
import { e as r } from "./ui-components-
|
|
5
|
-
import "./builder-components-
|
|
4
|
+
import { e as r } from "./ui-components-BhVIVLV-.js";
|
|
5
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
6
6
|
import "react-dom";
|
|
7
|
-
import "./charge-
|
|
8
|
-
import "./ticket-
|
|
7
|
+
import "./charge-Bv8wu-fV.js";
|
|
8
|
+
import "./ticket-CbQabuyp.js";
|
|
9
9
|
const f = () => (e.useEffect(() => {
|
|
10
10
|
setTimeout(() => {
|
|
11
11
|
window.location.reload();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("./ui-components-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("./ui-components-jkqz3-Kc.cjs");require("react");const s=require("./builder-BNQD7fm1.cjs");require("./builder-components-B8gWw88v.cjs");require("react-dom");require("./charge-DcKd_es2.cjs");require("./ticket-C5g3kw8c.cjs");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"),i=require("./ui-components-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./ui-components-jkqz3-Kc.cjs");require("react");const n=require("./builder-BNQD7fm1.cjs");require("./builder-components-B8gWw88v.cjs");require("react-dom");require("./charge-DcKd_es2.cjs");require("./ticket-C5g3kw8c.cjs");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,5 +1,5 @@
|
|
|
1
1
|
import { jsx as n, Fragment as m } from "react/jsx-runtime";
|
|
2
|
-
import { ac as d, o as l, m as b, i as u, q as t, z as s } from "./builder-
|
|
2
|
+
import { ac as d, o as l, m as b, i as u, q as t, z as s } from "./builder-Cbzb-Pzj.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,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 { Z as z, a1 as U } from "./charge-
|
|
4
|
-
import { N as f, O as T, ac as F, p as G, a7 as R, e as H, Q as V, m as q, a as B, u as K, K as M, b as Q, am as X, ah as Y } from "./builder-
|
|
5
|
-
import { g as Z } from "./ticket-
|
|
6
|
-
import { e as $, N as ee, x as te } from "./ui-components-
|
|
7
|
-
import "./builder-components-
|
|
3
|
+
import { Z as z, a1 as U } from "./charge-Bv8wu-fV.js";
|
|
4
|
+
import { N as f, O as T, ac as F, p as G, a7 as R, e as H, Q as V, m as q, a as B, u as K, K as M, b as Q, am as X, ah as Y } from "./builder-Cbzb-Pzj.js";
|
|
5
|
+
import { g as Z } from "./ticket-CbQabuyp.js";
|
|
6
|
+
import { e as $, N as ee, x as te } from "./ui-components-BhVIVLV-.js";
|
|
7
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
8
8
|
import "react-dom";
|
|
9
9
|
const se = "_notifications_1ntnm_1", ae = "_wrapper_1ntnm_12", P = {
|
|
10
10
|
notifications: se,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { g as i } from "./ui-components-
|
|
2
|
+
import { g as i } from "./ui-components-BhVIVLV-.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { p as s, an as a } from "./builder-
|
|
5
|
-
import "./builder-components-
|
|
4
|
+
import { p as s, an as a } from "./builder-Cbzb-Pzj.js";
|
|
5
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
6
6
|
import "react-dom";
|
|
7
|
-
import "./charge-
|
|
8
|
-
import "./ticket-
|
|
7
|
+
import "./charge-Bv8wu-fV.js";
|
|
8
|
+
import "./ticket-CbQabuyp.js";
|
|
9
9
|
const c = "_wrapper_ej209_1", p = "_content_ej209_12", m = "_title_ej209_22", r = {
|
|
10
10
|
wrapper: c,
|
|
11
11
|
content: p,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),P=require("./charge-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("react"),P=require("./charge-DcKd_es2.cjs"),t=require("./builder-BNQD7fm1.cjs"),J=require("./ticket-C5g3kw8c.cjs"),g=require("./ui-components-jkqz3-Kc.cjs");require("./builder-components-B8gWw88v.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./builder-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./builder-BNQD7fm1.cjs"),n=require("./charge-DcKd_es2.cjs"),l="_wrapper_x27n6_1",m="_content_x27n6_10",x="_title_x27n6_18",d="_text_x27n6_24",p="_empty_x27n6_42",r={wrapper:l,content:m,title:x,text:d,empty:p},_=()=>{const{shopTerms:t}=c.useStorefrontStore(),{isAntistock:o}=c.useGeneralStore(),a=!!(t!=null&&t.termsOfService&&t.termsOfService.length>0);return e.jsx("div",{className:r.wrapper,children:e.jsxs("div",{className:r.content,children:[e.jsx("h1",{className:r.title,children:"Terms of Service"}),a?o?e.jsx("div",{className:r.text,children:e.jsx(n.MarkdownText,{text:t.termsOfService})}):e.jsx(n.Markdown,{remarkPlugins:[n.remarkGfm],rehypePlugins:[n.rehypeRaw],className:r.text,components:{a:({node:i,...s})=>e.jsx("a",{...s,target:"_blank",rel:"noopener noreferrer",id:"md"}),p:({node:i,...s})=>e.jsx("p",{...s,id:"md"})},children:t==null?void 0:t.termsOfService}):e.jsx("p",{className:r.empty,children:"No terms of service."})]})})};exports.TermsPage=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("./builder-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("./builder-BNQD7fm1.cjs");const r=require("react"),t=require("./ui-components-jkqz3-Kc.cjs");require("./builder-components-B8gWw88v.cjs");require("react-dom");require("./charge-DcKd_es2.cjs");require("./ticket-C5g3kw8c.cjs");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;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./builder.cjs.js"),c=require("./builder-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./builder.cjs.js"),c=require("./builder-BNQD7fm1.cjs"),u=require("react/jsx-runtime"),d=require("react"),e=require("./ui-components-jkqz3-Kc.cjs");require("./builder-components-B8gWw88v.cjs");const r=require("./charge-DcKd_es2.cjs");require("react-dom");const t=require("./ticket-C5g3kw8c.cjs");function I(o){d.useEffect(()=>{Object.entries(o).forEach(([s,i])=>{e.registerIcon(s,i)})},[o])}function f(o){Object.entries(o).forEach(([s,i])=>{e.registerIcon(s,i)})}function l(o){return o.endsWith("Icon")?o.slice(0,-4):o}function g(o,s=20,i=!0){return o.map(n=>({value:i?l(n):n,addon:u.jsx(e.Icon,{name:n,width:s,height:s,showPlaceholder:!0})}))}exports.App=a.App;exports.AntistockRoutes=c.AntistockRoutes;exports.Routes=c.Routes;exports.formatPrice=c.formatPrice;exports.Icon=e.Icon;exports.addIconSuffix=e.addIconSuffix;exports.getRegisteredIcon=e.getRegisteredIcon;exports.getRegisteredIcons=e.getRegisteredIcons;exports.isIconRegistered=e.isIconRegistered;exports.loadIcon=e.loadIcon;exports.registerIcon=e.registerIcon;exports.stripIconSuffix=e.stripIconSuffix;exports.useDynamicIconRegistration=e.useDynamicIconRegistration;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=t.ColorVariables;exports.aspectRatioOptions=t.aspectRatioOptions;exports.hotReload=t.hotReload;exports.iconNames=t.iconNames;exports.removeNotification=t.removeNotification;exports.showNotification=t.showNotification;exports.splitTextIntoSpans=t.splitTextIntoSpans;exports.useAdaptiveStyles=t.useAdaptiveStyles;exports.useBalance=t.useBalance;exports.useBuilderPages=t.useBuilderPages;exports.useCreateTicket=t.useCreateTicket;exports.createIconLeftAddons=g;exports.registerIcons=f;exports.useIconRegistration=I;
|
package/dist/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { App as R } from "./builder.es.js";
|
|
2
|
-
import { Y as v, Z as w, _ as b } from "./builder-
|
|
2
|
+
import { Y as v, Z as w, _ as b } from "./builder-Cbzb-Pzj.js";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
import { useEffect as i } from "react";
|
|
5
|
-
import { r as o, I as n } from "./ui-components-
|
|
6
|
-
import { v as A, o as P, q as S, p as T, s as j, t as E, n as M } from "./ui-components-
|
|
7
|
-
import "./builder-components-
|
|
8
|
-
import { M as y, G as B, J as D, u as G, I as J, K as q, H } from "./charge-
|
|
5
|
+
import { r as o, I as n } from "./ui-components-BhVIVLV-.js";
|
|
6
|
+
import { v as A, o as P, q as S, p as T, s as j, t as E, n as M } from "./ui-components-BhVIVLV-.js";
|
|
7
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
8
|
+
import { M as y, G as B, J as D, u as G, I as J, K as q, H } from "./charge-Bv8wu-fV.js";
|
|
9
9
|
import "react-dom";
|
|
10
|
-
import { C as L, c as V, h as W, i as Y, r as Z, d as _, s as F, u as Q, e as U, b as X, a as $ } from "./ticket-
|
|
10
|
+
import { C as L, c as V, h as W, i as Y, r as Z, d as _, s as F, u as Q, e as U, b as X, a as $ } from "./ticket-CbQabuyp.js";
|
|
11
11
|
function m(e) {
|
|
12
12
|
i(() => {
|
|
13
13
|
Object.entries(e).forEach(([s, t]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),r=require("react"),O=require("./builder-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),r=require("react"),O=require("./builder-BNQD7fm1.cjs"),s=require("./charge-DcKd_es2.cjs"),C=require("./ui-components-jkqz3-Kc.cjs");require("./builder-components-B8gWw88v.cjs");require("react-dom");require("./ticket-C5g3kw8c.cjs");const K=async(n=1)=>await s.fetchOrders({PageNumber:n}),Q=()=>{const[n,l]=r.useState(null),[d,e]=r.useState(null),[p,g]=r.useState(0),{page:m}=O.usePaginationPagesStore(),[f,_]=r.useState(!0);async function j(){_(!0);const{list:S,totalCount:u}=await K(m);l(S),g(u),e(null),_(!1)}async function y(){const S=(n==null?void 0:n.map(c=>c.gatewayName))||[],u=await s.getGatewaysDetail(S);e(u)}return r.useEffect(()=>{!d&&n&&y()},[n,d]),r.useEffect(()=>{j()},[m]),t.jsx(t.Fragment,{children:n!=null&&n.length&&n.length===0?t.jsx(s.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(s.PageTitle,{title:"Orders"}),t.jsx(s.OrdersTable,{orders:n,gatewaysDetail:d,totalCount:p,isLoading:f})]})})},X="_orderPage_gc87l_1",Y="_leftSection_gc87l_15",Z="_content_gc87l_35",ee="_main_gc87l_42",te="_mainAntistock_gc87l_56",se="_orderMainDataAntistock_gc87l_69",ne="_timelineBlockAntistock_gc87l_81",ae="_footerAntistock_gc87l_92",oe="_statusBlock_gc87l_104",ie="_timelineBlock_gc87l_81",ce="_footer_gc87l_92",re="_rightSection_gc87l_121",le="_header_gc87l_142",ue="_productList_gc87l_150",de="_mobileFooter_gc87l_157",me="_loaderContainer_gc87l_166",he="_orderMainData_gc87l_69",ge="_prices_gc87l_181",fe="_headerTitle_gc87l_185",pe="_headerDescription_gc87l_189",i={orderPage:X,leftSection:Y,content:Z,main:ee,mainAntistock:te,orderMainDataAntistock:se,timelineBlockAntistock:ne,footerAntistock:ae,statusBlock:oe,timelineBlock:ie,footer:ce,rightSection:re,header:le,productList:ue,mobileFooter:de,loaderContainer:me,orderMainData:he,prices:ge,headerTitle:fe,headerDescription:pe},_e=n=>{if(!n)return null;const l=n.split(":");if(l.length!==3)return null;const[d,e,p]=l,g=Number(d),m=Number(e),f=Number(p);return Number.isNaN(g)||Number.isNaN(m)||Number.isNaN(f)?null:((g*60+m)*60+f)*1e3},ye=()=>{var A,R,M,T,F,E,I,V,B;const{id:n,accessToken:l}=O.useParams(),d=O.useNavigate(),[e,p]=r.useState(),[g,m]=r.useState(!1),[f,_]=r.useState(!1),[j,y]=r.useState(!1),S=s.useCopy(),{isAntistock:u,general:c}=O.useGeneralStore(),G=((A=e==null?void 0:e.rawPrice)==null?void 0:A.currency)||"USD",U=new Intl.NumberFormat("en-US",{style:"currency",currency:G}),D=r.useMemo(()=>{var h;const a=_e((e==null?void 0:e.estimatedProcessingTime)??null),N=(h=e==null?void 0:e.timeline)==null?void 0:h[s.OrderStatus.Processing],P=(e==null?void 0:e.status)===s.OrderStatus.Processing&&N&&a?{processingStartTime:new Date(N),expectedProcessingMs:a,processingExpiresAt:e!=null&&e.processingExpiresAt?new Date(e.processingExpiresAt):void 0}:null;return(e==null?void 0:e.partOrders.map(o=>{var x,$,q;return{id:Number((x=o.productWithVariant)==null?void 0:x.id)||0,partOrderId:Number(o==null?void 0:o.id)||0,image:o.productWithVariant.image,name:(()=>{var L,W;const v=((L=o.productWithVariant)==null?void 0:L.name)||"",k=((W=o.productWithVariant)==null?void 0:W.variantName)||"";return!v&&!k?"":!k||v===k?v:v?`${v} (${k})`:k})(),description:"",price:{quantity:o.quantity,amount:(($=o.productWithVariant)==null?void 0:$.price.amount)||0,currency:(q=o.productWithVariant)==null?void 0:q.price.currency},deliveryCategories:"deliveryCategories"in o?o.deliveryCategories:void 0,customerNote:o.customerNote,chargeType:o.chargeType||"ONE_TIME",replacementRequests:"replacementRequests"in o?o.replacementRequests:void 0,allowedReplacementReasons:"allowedReplacementReasons"in o?o.allowedReplacementReasons:void 0,processingInfo:P}}))||[]},[e]);r.useEffect(()=>{e&&(e.status===s.OrderStatus.FullDeliveryFailure||e.status===s.OrderStatus.PartiallyDelivered)&&e.refundedPrice&&e.refundedPrice.amount>0&&_(!0)},[e==null?void 0:e.status]);const w=r.useCallback(async(a,N,P=!1)=>{var o,x;P||m(!0);const{data:h}=await(N?s.fetchAuthorizedOrder(`${a}/${N}`):s.fetchOrder(a));m(!1),h.status!==s.OrderStatus.Completed&&((o=h.charge)==null?void 0:o.status)===s.ChargeStatus.NotPaid&&d(`/charges/${(x=h.charge)==null?void 0:x.id}`,{replace:!0}),p(h)},[d]);r.useLayoutEffect(()=>{if(n&&!l){const a=JSON.parse(localStorage.getItem("orders")||"{}");a[n]&&d(`/orders/${n}/${a[n].fullAccessToken}`)}},[n,l,d]),r.useEffect(()=>{n&&w(n,l,!0);const a=setInterval(()=>{n&&w(n,l,!0)},5e3);return()=>{clearInterval(a)}},[n,l,w]);const z=r.useMemo(()=>!!(e!=null&&e.isApplicableForReplacement&&(e.status===s.OrderStatus.Completed||e.status===s.OrderStatus.PartiallyDelivered||e.status===s.OrderStatus.FullDeliveryFailure)),[e]),b=r.useMemo(()=>{var a;return!!((a=c==null?void 0:c.info)!=null&&a.isVouchesEnabled&&l&&((e==null?void 0:e.status)===s.OrderStatus.Completed||(e==null?void 0:e.status)===s.OrderStatus.FullDeliveryFailure||(e==null?void 0:e.status)===s.OrderStatus.PartiallyDelivered))},[(R=c==null?void 0:c.info)==null?void 0:R.isVouchesEnabled,l]),H=r.useMemo(()=>{var a;return!!(!((a=c==null?void 0:c.info)!=null&&a.isVouchesEnabled)&&(e!=null&&e.review)&&"accessToken"in e.review&&!u)},[(M=c==null?void 0:c.info)==null?void 0:M.isVouchesEnabled,e==null?void 0:e.review,u]),J=r.useMemo(()=>{var a;return((a=c==null?void 0:c.info)==null?void 0:a.domain)||window.location.hostname},[(T=c==null?void 0:c.info)==null?void 0:T.domain]);return g?t.jsx("div",{className:i.loaderContainer,children:t.jsx(C.Loader,{})}):(console.log("ORDER PAGE"),console.log(e),t.jsxs("div",{className:i.orderPage,children:[t.jsx("div",{className:i.leftSection,children:t.jsxs("div",{className:i.content,children:[t.jsx(s.CheckoutHeader,{}),e&&t.jsxs("div",{className:`${i.main} ${u?i.mainAntistock:""}`,children:[t.jsx(s.OrderStatusBlock,{className:i.statusBlock,orderStatus:e.status}),t.jsxs("div",{className:`${i.orderMainData} ${u?i.orderMainDataAntistock:""}`,children:[b&&t.jsx(s.VouchCard,{onAddMessage:()=>y(!0),isVouchLeft:e.isVouchLeft}),t.jsx(s.CheckoutOrderMainData,{lastUpdate:e.createdAt,paymentType:(F=e.charge)==null?void 0:F.gateway,email:e.customer?e.customer.email:((E=e.charge)==null?void 0:E.customerForCharge.email)||"",orderId:e.id}),H&&e.review&&t.jsx(s.LeaveAReview,{orderId:e.id,review:e.review})]}),e.charge&&e.charge.timeline&&t.jsx(s.TrackPayment,{className:`${i.timelineBlock} ${u?i.timelineBlockAntistock:""}`,timeline:e.charge.timeline}),t.jsx(s.CheckoutFooter,{className:`${i.footer} ${u?i.footerAntistock:""}`})]})]})}),t.jsx("div",{className:i.rightSection,style:u?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:t.jsxs("div",{className:i.content,children:[((I=e==null?void 0:e.charge)==null?void 0:I.name)&&t.jsxs("header",{className:i.header,children:[t.jsxs("div",{children:[t.jsx("h1",{className:i.headerTitle,children:e.charge.name}),e.charge.description&&t.jsx("p",{className:i.headerDescription,children:e.charge.description})]}),u?null:t.jsxs(C.Button,{type:"Secondary",onClick:()=>S((e==null?void 0:e.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx(C.Icon,{name:"Copy"}),t.jsx("span",{children:"Copy ID"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:i.productList,children:D.map(a=>t.jsx(s.CheckoutProduct,{product:a,isOrder:!0,isApplicableForReplacement:z,orderId:n,accessToken:l,allowedReplacementReasons:e==null?void 0:e.allowedReplacementReasons},a.id))}),u?null:t.jsx(s.CheckoutPrices,{formatter:U,coupon:null,total:((V=e==null?void 0:e.endPrice)==null?void 0:V.amount)||0,discount:0,totalWithDiscount:((B=e==null?void 0:e.endPrice)==null?void 0:B.amount)||0,className:i.prices,isShowSubtotal:!1}),t.jsx(s.CheckoutFooter,{className:i.mobileFooter})]})]})}),(e==null?void 0:e.refundedPrice)&&t.jsx(s.RefundNotificationModal,{isOpen:f,onClose:()=>_(!1),refundedAmount:e.refundedPrice.amount,currency:e.refundedPrice.currency}),b&&t.jsx(s.VouchModal,{isOpen:j,onClose:()=>y(!1),products:D,orderId:n,accessToken:l,shopDomain:J,onSuccess:()=>{y(!1),n&&w(n,l,!0)}})]}))},Se=Object.freeze(Object.defineProperty({__proto__:null,OrderPage:ye},Symbol.toStringTag,{value:"Module"}));exports.Orders=Q;exports.index=Se;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as s, Fragment as G, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import r, { useState as Q, useMemo as b } from "react";
|
|
3
|
-
import { X as Y, a8 as Z, p as ee, K as te } from "./builder-
|
|
4
|
-
import { f as se, N as ae, P as oe, O as ne, g as ie, b as ce, c as u, d as re, e as le, h as ue, i as de, j as me, V as he, k as fe, L as pe, T as ge, l as U, m as _e, n as ye, R as Ne, o as ve } from "./charge-
|
|
5
|
-
import { e as ke, g as Se, I as we } from "./ui-components-
|
|
6
|
-
import "./builder-components-
|
|
3
|
+
import { X as Y, a8 as Z, p as ee, K as te } from "./builder-Cbzb-Pzj.js";
|
|
4
|
+
import { f as se, N as ae, P as oe, O as ne, g as ie, b as ce, c as u, d as re, e as le, h as ue, i as de, j as me, V as he, k as fe, L as pe, T as ge, l as U, m as _e, n as ye, R as Ne, o as ve } from "./charge-Bv8wu-fV.js";
|
|
5
|
+
import { e as ke, g as Se, I as we } from "./ui-components-BhVIVLV-.js";
|
|
6
|
+
import "./builder-components-B6Ct-1cI.js";
|
|
7
7
|
import "react-dom";
|
|
8
|
-
import "./ticket-
|
|
8
|
+
import "./ticket-CbQabuyp.js";
|
|
9
9
|
const Pe = async (t = 1) => await se({ PageNumber: t }), tt = () => {
|
|
10
10
|
const [t, c] = r.useState(null), [d, e] = Q(null), [_, p] = r.useState(0), { page: h } = Y(), [g, y] = r.useState(!0);
|
|
11
11
|
async function O() {
|