@billgangcom/theme-lib 1.72.4 → 1.72.5
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.cjs.js +1 -1
- package/dist/builder.es.js +2 -2
- package/dist/{index-C3l0gDlm.cjs → index-B6gTSX8i.cjs} +1 -1
- package/dist/{index-Dg_2v0bC.js → index-BMu1khEz.js} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +2 -2
- package/package.json +1 -1
|
@@ -83,7 +83,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
83
83
|
|
|
84
84
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
85
85
|
and limitations under the License.
|
|
86
|
-
***************************************************************************** */var Qn=function(){return Qn=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Qn.apply(this,arguments)};function O7(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}var B7=function(){return Math.random().toString(36).substring(6)},F7=function(e){var t=e.animate,n=t===void 0?!0:t,r=e.backgroundColor,a=r===void 0?"#f5f6f7":r,s=e.backgroundOpacity,l=s===void 0?1:s,c=e.baseUrl,u=c===void 0?"":c,d=e.children,f=e.foregroundColor,h=f===void 0?"#eee":f,m=e.foregroundOpacity,g=m===void 0?1:m,C=e.gradientRatio,p=C===void 0?2:C,v=e.uniqueKey,x=e.rtl,y=x===void 0?!1:x,_=e.speed,E=_===void 0?1.2:_,T=e.style,D=T===void 0?{}:T,S=e.title,R=S===void 0?"Loading...":S,M=e.beforeMask,N=M===void 0?null:M,Z=O7(e,["animate","backgroundColor","backgroundOpacity","baseUrl","children","foregroundColor","foregroundOpacity","gradientRatio","uniqueKey","rtl","speed","style","title","beforeMask"]),B=v||B7(),q="".concat(B,"-diff"),H="".concat(B,"-animated-diff"),le="".concat(B,"-aria"),fe=y?{transform:"scaleX(-1)"}:null,me="".concat(E,"s"),ye="".concat(p*-1," 0"),be="".concat(p," 0");return b.createElement("svg",Qn({"aria-labelledby":le,role:"img",style:Qn(Qn({},D),fe)},Z),R?b.createElement("title",{id:le},R):null,N&&b.isValidElement(N)?N:null,b.createElement("rect",{role:"presentation",x:"0",y:"0",width:"100%",height:"100%",clipPath:"url(".concat(u,"#").concat(q,")"),style:{fill:"url(".concat(u,"#").concat(H,")")}}),b.createElement("defs",null,b.createElement("clipPath",{id:q},d),b.createElement("linearGradient",{id:H,gradientTransform:"translate(".concat(ye,")")},b.createElement("stop",{offset:"0%",stopColor:a,stopOpacity:l}),b.createElement("stop",{offset:"50%",stopColor:h,stopOpacity:g}),b.createElement("stop",{offset:"100%",stopColor:a,stopOpacity:l}),n&&b.createElement("animateTransform",{attributeName:"gradientTransform",type:"translate",values:"".concat(ye,"; 0 0; ").concat(be),dur:me,repeatCount:"indefinite"}))))},zr=function(e){return e.children?b.createElement(F7,Qn({},e)):b.createElement(H7,Qn({},e))},H7=function(e){return b.createElement(zr,Qn({viewBox:"0 0 476 124"},e),b.createElement("rect",{x:"48",y:"8",width:"88",height:"6",rx:"3"}),b.createElement("rect",{x:"48",y:"26",width:"52",height:"6",rx:"3"}),b.createElement("rect",{x:"0",y:"56",width:"410",height:"6",rx:"3"}),b.createElement("rect",{x:"0",y:"72",width:"380",height:"6",rx:"3"}),b.createElement("rect",{x:"0",y:"88",width:"178",height:"6",rx:"3"}),b.createElement("circle",{cx:"20",cy:"20",r:"20"}))};const V7=({adaptiveStyles:e})=>{const{dashInfo:t,balance:n,setBalance:r,setDashInfo:a}=cn();return b.useEffect(()=>{(async()=>{const{data:l}=await U0(),c=await Mi();a(l),r(c)})()},[]),i.jsxs("div",{className:te(Dt.sidebar,{[Dt.mobile]:e!=="desktop"}),children:[!t||!n?i.jsx($7,{adaptiveStyles:e}):i.jsx(D7,{email:t.email,balance:zt(n),adaptiveStyles:e}),i.jsx(M7,{adaptiveStyles:e})]})},$7=({adaptiveStyles:e})=>i.jsx(zr,{speed:2,width:320,height:120,viewBox:"0 0 320 120",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:te(Dt.skeleton,{[Dt.mobile]:e!=="desktop"}),children:i.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"280",height:"100"})}),U7="_balanceContainer_qonmh_1",W7="_transactionsHeaderTitle_qonmh_8",Z7="_headerTitle_qonmh_12",z7="_balanceHeader_qonmh_16",q7="_balanceAmount_qonmh_23",G7="_balanceAmountTitle_qonmh_36",Y7="_balanceAmountValue_qonmh_41",X7="_transactionDate_qonmh_69",K7="_transactionItem_qonmh_76",J7="_transactionDetails_qonmh_84",Q7="_iconWrapper_qonmh_89",ev="_transactionInfo_qonmh_100",tv="_transactionTitle_qonmh_105",nv="_transactionId_qonmh_109",rv="_transactionAmount_qonmh_115",ov="_added_qonmh_120",av="_removed_qonmh_123",sv="_noItemsBlock_qonmh_127",iv="_pagination_qonmh_136",lv="_modal_qonmh_142",cv="_header_qonmh_12",uv="_form_qonmh_154",dv="_label_qonmh_160",fv="_bonusBlock_qonmh_173",hv="_gatewayList_qonmh_187",pv="_gatewayButton_qonmh_194",mv="_selected_qonmh_204",gv="_gatewayName_qonmh_211",vv="_error_qonmh_214",yv="_submitButton_qonmh_219",Cv="_addBalanceButton_qonmh_238",bv="_gatewayIcon_qonmh_257",Sv="_loaderContainer_qonmh_279",wv="_transactionsContainer_qonmh_287",xv="_transactionsHeader_qonmh_8",_v="_transactionsContent_qonmh_301",Te={balanceContainer:U7,transactionsHeaderTitle:W7,headerTitle:Z7,balanceHeader:z7,balanceAmount:q7,balanceAmountTitle:G7,balanceAmountValue:Y7,transactionDate:X7,transactionItem:K7,transactionDetails:J7,iconWrapper:Q7,transactionInfo:ev,transactionTitle:tv,transactionId:nv,transactionAmount:rv,added:ov,removed:av,noItemsBlock:sv,pagination:iv,modal:lv,header:cv,form:uv,label:dv,bonusBlock:fv,gatewayList:hv,gatewayButton:pv,selected:mv,gatewayName:gv,error:vv,submitButton:yv,addBalanceButton:Cv,gatewayIcon:bv,loaderContainer:Sv,transactionsContainer:wv,transactionsHeader:xv,transactionsContent:_v},Tv=async(e=1)=>await v3({PageNumber:e}),Ev=async({price:e,gateway:t,customerEmail:n})=>await $0({customerEmail:n,price:e,gateway:t}),kv=({enterAnother:e,bonusPercent:t,currency:n})=>i.jsxs("div",{className:Te.bonusBlock,children:[i.jsx(z,{name:"Fire"}),i.jsx("div",{children:e>0?`Enter another ${zt({amount:e,currency:n})} and receive an additional bonus of ${t}%`:`You will receive an additional bonus of ${t}%`})]}),Cd=({setIsOpen:e,isModal:t=!0})=>{const[n,r]=b.useState({amount:"",gateway:""}),[a,s]=b.useState({}),[l,c]=b.useState(!1),{gatewaysDetail:u,setGatewaysDetail:d,dashInfo:f,balanceSettings:h}=cn(),m=jn(),{notifications:g,setNotifications:C}=Lt(),{setIsOpen:p}=Zn();b.useEffect(()=>{u||(async()=>{var Z;const M=h!=null&&h.isEnabled?(Z=h==null?void 0:h.topUpSettings)==null?void 0:Z.gateways:[],N=await No(M);d(N)})()},[h,u]);const v=()=>{const R={};return(!n.amount||Number(n.amount)<1)&&(R.amount="The balance field cannot be empty."),n.gateway||(R.gateway="Select pay method"),s(R),Object.keys(R).length===0},x=async R=>{if(R.preventDefault(),!!v()){c(!0);try{const{data:M}=await Ev({price:{amount:Number(n.amount),currency:h!=null&&h.isEnabled?h.topUpSettings.currency:"USD"},gateway:n.gateway,customerEmail:(f==null?void 0:f.email)||""});C([...g,{message:"Order created successfully",status:"success",id:qe()}]),m(`/charges/${M.data.chargeId}`)}catch(M){const N=M;C([...g,{message:`Order creation failed: ${N.message}`,status:"error",id:qe()}])}finally{e(!1),c(!1)}}};if(!h||!h.isEnabled)return null;const{topUpSettings:{currency:y,topUpBonusEnabled:_,bonusPercent:E,minimumTopUpForBonus:T}}=h,D=Number(n.amount),S=_&&!Number.isNaN(D)?T-D:T;return i.jsx(i.Fragment,{children:l?i.jsx(Bd,{}):i.jsxs("div",{className:Te.modal,onClick:R=>R.stopPropagation(),children:[i.jsxs("div",{className:Te.header,children:[i.jsx("h2",{id:"h3",className:Te.headerTitle,children:"Top Up Account Balance"}),t&&i.jsx(z,{name:"X",onClick:()=>{p(!1),setTimeout(()=>{e(!1)},300)},className:Te.closeIcon,hoverable:!0,fill:"var(--text-primary)"})]}),i.jsxs("form",{onSubmit:x,className:Te.form,children:[i.jsxs("label",{className:Te.label,children:[i.jsx(xr,{label:"Enter Amount",type:"number",placeholder:"1000",value:n.amount,onChange:R=>r(M=>({...M,amount:R})),leftIcon:i.jsx(z,{name:"CurrencyDollarSimple",fill:"var(--text-secondary)"}),required:!0}),a.amount&&i.jsx("span",{className:Te.error,children:a.amount})]}),_&&S!==void 0&&i.jsx(kv,{enterAnother:S,bonusPercent:E,currency:y}),u&&i.jsx("div",{className:Te.gatewayList,children:u.length>0?u.map(R=>i.jsxs("div",{className:te(Te.gatewayButton,{[Te.selected]:n.gateway===R.name}),onClick:()=>r(M=>({...M,gateway:R.name})),children:[i.jsx("img",{alt:R.displayName,src:An(R.logoCfImageId),className:Te.gatewayIcon}),i.jsx("div",{className:Te.gatewayName,children:R.displayName})]},R.name)):i.jsx("span",{children:"Gateways not found"})}),!u&&i.jsx(zr,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:i.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})}),a.gateway&&i.jsx("span",{className:Te.error,children:a.gateway}),i.jsx(it,{type:"Primary",disabled:!n.gateway||l,className:Te.submitButton,children:"Continue to Checkout"}),i.jsxs("div",{children:[i.jsx(Md,{}),i.jsx(Id,{})]})]})]})})},Rv=()=>{const[e,t]=b.useState([]),{balanceSettings:n,balance:r}=cn(),{page:a,setPage:s}=Do(),{setIsOpen:l}=Zn(),[c,u]=b.useState(!0),[d,f]=b.useState(0),[h,m]=b.useState(!1),[g,C]=b.useState("Newest");b.useEffect(()=>{s(1)},[]),b.useEffect(()=>{(async()=>{u(!0);const{list:_,totalCount:E}=await Tv(a);t(_),f(E),u(!1)})()},[]);const p=(y,_)=>{var S;const E={},T=new Date,D=[...y].sort((R,M)=>{const N=new Date(R.createdAt).getTime(),Z=new Date(M.createdAt).getTime();return _==="Newest"?Z-N:N-Z});for(const R of D){const M=new Date(R.createdAt),N=M.toDateString()===T.toDateString()?"Today":M.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});E[N]||(E[N]=[]),(S=E[N])==null||S.push(R)}return E},v=({id:y,price:_,status:E,description:T})=>{const D=zt({amount:Math.abs(_.amount),currency:_.currency});return i.jsxs("div",{className:Te.transactionItem,children:[i.jsxs("div",{className:Te.transactionDetails,children:[i.jsx(z,{className:Te.iconWrapper,name:E===lo.ADDED?"Plus":"Minus",width:20,height:20}),i.jsxs("div",{className:Te.transactionInfo,children:[i.jsx("div",{className:Te.transactionTitle,id:"h4",children:T}),i.jsxs("div",{className:Te.transactionId,id:"md",children:["ID: ",y]})]})]}),i.jsxs("div",{className:te(Te.transactionAmount,{[Te.added]:E===lo.ADDED,[Te.removed]:E===lo.REMOVED}),id:"lg",children:[E===lo.ADDED?"+":"-"," ",D]})]},y)},x=()=>{if(e!=null&&e.length){const y=p(e,g);return i.jsxs("div",{className:Te.transactionsContainer,children:[i.jsx("div",{className:Te.transactionsContent,children:Object.entries(y).map(([_,E])=>i.jsxs("div",{id:"lg",children:[i.jsx("div",{className:Te.transactionDate,id:"md",children:_}),E.map(v)]},_))}),i.jsx(Ja,{className:Te.pagination,currentPage:a,totalCount:d,onPageChange:s})]})}return i.jsx(Io,{title:"Transaction History",description:"When you top up your account balance or receive a refund from our team, you'll see a history of transactions here.",className:Te.noItemsBlock})};return i.jsxs(i.Fragment,{children:[(n==null?void 0:n.isEnabled)&&i.jsx("div",{className:Te.balanceContainer,children:i.jsxs("div",{className:Te.balanceHeader,children:[r&&i.jsxs("div",{className:Te.balanceAmount,children:[i.jsx("span",{className:Te.balanceAmountTitle,id:"lg",children:"Your balance"}),i.jsx("span",{className:Te.balanceAmountValue,id:"h4",children:zt(r)})]}),i.jsxs(it,{onClick:y=>{y.stopPropagation(),m(!0),l(!0)},className:Te.addBalanceButton,children:[i.jsx(z,{name:"Plus"}),i.jsx("span",{children:"Add balance"})]})]})}),i.jsxs("div",{className:Te.transactionsHeader,children:[(e==null?void 0:e.length)>0?i.jsx("h3",{id:"h3",className:Te.transactionsHeaderTitle,children:"Transactions"}):i.jsx(Mo,{title:"Transactions"}),(e==null?void 0:e.length)>0&&i.jsx(vd,{options:["Newest","Oldest"],value:g,onChange:y=>{C(y)},style:{width:"110px"}})]}),c?i.jsx("div",{className:Te.loaderContainer,children:i.jsx(un,{})}):i.jsx("div",{children:x()}),h&&(n==null?void 0:n.isEnabled)&&i.jsx(Xa,{close:()=>m(!1),children:i.jsx(Cd,{setIsOpen:m})})]})},Pv="_home_20unt_1",Av="_content_20unt_13",Lv="_tablet_20unt_28",jv="_mobile_20unt_31",Dv="_statContainer_20unt_35",Nv="_text_20unt_47",Mv="_iconWrapper_20unt_53",Iv="_loader_20unt_57",Ov="_title_20unt_65",kn={home:Pv,content:Av,tablet:Lv,mobile:jv,statContainer:Dv,text:Nv,iconWrapper:Mv,loader:Iv,title:Ov},Bv="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17%202V9.85233L13.5806%2010.9427V6.58116L6.41169%208.82252V4.89257L17%202Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M13.5806%2010.9427L13.5805%2014.691L3%2018V9.79935L6.41169%208.82252L6.41152%2013.2598L13.5806%2010.9427Z'%20fill='%23FF3F19'/%3e%3c/svg%3e",Fv="Billgang",ic=({children:e})=>i.jsx("div",{className:kn.statContainer,children:e}),Hv=({adaptiveStyles:e})=>{var u,d;const[t,n]=b.useState(null),{setBalanceSettings:r}=cn(),{pageContext:a}=Wn(),{general:s}=gi(),{header:l}=$n();function c(f){var g,C;const h=f==null?void 0:f.name,m=(C=(g=a==null?void 0:a.listings)==null?void 0:g.filter(p=>p.type==="PRODUCT"))==null?void 0:C.find(p=>p.productData.name===h);return m==null?void 0:m.link.to}return b.useEffect(()=>{const f=async()=>{const{data:m}=await W0();n(m)},h=async()=>{const m=await yd();r(m)};f(),h()},[]),t?i.jsxs("div",{className:kn.home,children:[i.jsx(wb,{adaptiveStyles:e}),i.jsx("h3",{id:"h3",className:kn.title,children:"Your Statistics"}),i.jsxs("div",{className:te(kn.content,{[kn.desktop]:e==="desktop",[kn.tablet]:e==="tablet",[kn.mobile]:e==="mobile"}),children:[i.jsxs(ic,{children:[i.jsx(on,{iconName:"Calendar",title:"Customer since",value:o6(t.createdAt)}),i.jsx(on,{iconName:"CurrencyCircleDollar",title:"Total spent",value:zt({amount:t.totalSpent})}),i.jsx(on,{iconName:"Medal",title:"Top",value:`#${t.ratingPlacement}`,children:t.ratingPlacement>1&&i.jsxs("div",{className:kn.text,id:"md-bold",children:[i.jsx(z,{name:"ArrowUp",className:kn.iconWrapper,width:16,height:16,fill:"var(--text-secondary)"}),"Spend"," ",zt({amount:t.spendMoreDefaultCurrencyForNextPlace,currency:(u=t.balance)==null?void 0:u.currency})," ","more to be #",t.ratingPlacement-1]})}),i.jsx(on,{iconName:"Star",title:"Average review",value:t.averageReview})]}),t.topSpenderProduct?i.jsx(on,{image:An(t.topSpenderProduct.image.cfId),imageName:t.topSpenderProduct.name,iconName:"Crown",title:"Top spent",value:`${zt({amount:t.topSpenderProduct.amountSpentUsd||0})} spent`,productSlug:c(t.topSpenderProduct)}):i.jsx(on,{image:"empty",iconName:"Crown",title:"Top spent",value:`${zt({amount:0})} spent`}),i.jsxs(ic,{children:[i.jsx(on,{iconName:"Bag",title:"Purchases",value:t.totalPurchases}),i.jsx(on,{iconName:"Eye",title:"Visits",value:t.visits}),i.jsx(on,{title:"Powered by",value:Fv,logo:Bv}),i.jsx(on,{title:"Store",value:(s==null?void 0:s.info.name)||"",logo:An((l==null?void 0:l.blockSettings.logo.url)||((d=s==null?void 0:s.info.logo)==null?void 0:d.cfId)||"A5gbiev6F8AaBvp6M146Kw/4ecd0fb9-8ebc-44e9-fa1c-c36f61f4bd00")})]}),t.favoriteProduct?i.jsx(on,{image:An(t.favoriteProduct.image.cfId),imageName:t.favoriteProduct.name,iconName:"Heart",title:"Favorite product",value:`bought ${t.favoriteProduct.purchasedTimes} times`,productSlug:c(t.favoriteProduct)}):i.jsx(on,{image:"empty",iconName:"Heart",title:"Favorite product",value:"bought 0 times"})]})]}):i.jsx("div",{className:kn.loader,children:i.jsx(un,{})})},Vv=async(e=1)=>await r3({PageNumber:e}),$v=()=>{const[e,t]=b.useState(null),[n,r]=b.useState(null),[a,s]=b.useState(0),{page:l}=Do(),[c,u]=b.useState(!0);async function d(){u(!0);const{list:h,totalCount:m}=await Vv(l);t(h),s(m),r(null),u(!1)}async function f(){const h=(e==null?void 0:e.map(g=>g.gatewayName))||[],m=await No(h);r(m)}return b.useEffect(()=>{!n&&e&&f()},[e,n]),b.useEffect(()=>{d()},[l]),i.jsx(i.Fragment,{children:e!=null&&e.length&&e.length===0?i.jsx(Io,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):i.jsxs(i.Fragment,{children:[i.jsx(Mo,{title:"Orders"}),i.jsx(Wb,{orders:e,gatewaysDetail:n,totalCount:a,isLoading:c})]})})},Uv="_container_caax0_1",Wv="_tablet_caax0_15",Zv="_mobile_caax0_18",zv="_progress_caax0_22",qv="_status_caax0_26",Gv="_name_caax0_37",Yv="_completed_caax0_44",Xv="_title_caax0_50",Kv="_description_caax0_58",Jv="_button_caax0_65",Qv="_achievement_caax0_73",ey="_progressText_caax0_92",ty="_progressTextStart_caax0_99",ny="_progressBackground_caax0_103",ry="_progressForeground_caax0_107",oy="_icon_caax0_111",jt={container:Uv,tablet:Wv,mobile:Zv,progress:zv,status:qv,name:Gv,completed:Yv,title:Xv,description:Kv,button:Jv,achievement:Qv,progressText:ey,progressTextStart:ty,progressBackground:ny,progressForeground:ry,icon:oy},ay=({adaptiveStyles:e})=>{const{notifications:t,setNotifications:n}=Lt(),{setBalance:r}=cn(),[a,s]=b.useState(null),l=async()=>{const h=(await I7()).map(m=>({...m,isClaimed:!1}));s(h)};b.useEffect(()=>{l()},[]);async function c(f){try{if(await T3(f),a){const m=a==null?void 0:a.map(g=>g.id===f.id?{...g,isClaimed:!0}:g);s(m)}n([...t,{message:"Reward claimed successfully",status:"success",id:qe()}]);const h=await Mi();s(null),r(h),l()}catch{n([...t,{message:"Failed to claim reward",status:"error",id:qe()}])}}const u=a&&a.length===0,d=a&&a.length>0;return i.jsx(i.Fragment,{children:u?i.jsx(Io,{title:"Rewards Unavailable",description:"Check back in the future to join our reward program."}):i.jsxs(i.Fragment,{children:[i.jsx(Mo,{title:"Rewards",description:"To unlock an exclusive reward, complete everything on this checklist"}),i.jsxs("div",{className:te(jt.container,{[jt.tablet]:e==="tablet",[jt.mobile]:e==="mobile"}),children:[d&&a.map(f=>i.jsx(sy,{achievement:f,onClick:h=>c(h)},f.id)),!d&&[...new Array(6)].map((f,h)=>i.jsx(zr,{speed:2,width:"100%",height:400,viewBox:"0 0 300 300",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:i.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"300px"})},h))]})]})})},sy=({achievement:e,onClick:t})=>{const[n,r]=uy(e),[a,s,l]=dy(e),[c,u]=b.useState(!1),d=s>=l;return i.jsxs("div",{className:jt.achievement,children:[i.jsx(iy,{percentage:Math.min(a,100)}),i.jsx("div",{className:`${jt.status} ${d?jt.completed:""}`,id:"md",children:d?i.jsxs(i.Fragment,{children:[i.jsx(z,{name:"Confetti"}),i.jsx("span",{id:"md",children:"Completed!"})]}):`Done: ${s} / ${l}`}),i.jsxs("div",{className:jt.title,children:[i.jsx(z,{name:"Bag",className:jt.icon,fill:"var(--text-action)",width:18,height:18}),i.jsx("div",{className:jt.name,id:"h5",children:n})]}),i.jsx("span",{className:jt.description,id:"md",children:r}),i.jsx(it,{type:d&&!e.isClaimed?"Primary":"Secondary",className:jt.button,disabled:!d,onClick:async()=>{u(!0),await t(e),u(!1)},children:e.isClaimed?i.jsxs(i.Fragment,{children:[i.jsx(z,{name:"CheckCircle",fill:"var(--text-secondary)"}),i.jsxs("span",{children:["Your claimed ",lc(e)," bonus"]})]}):i.jsxs(i.Fragment,{children:[!c&&(d?i.jsx("span",{children:"Claim"}):lc(e)),c&&i.jsx(un,{})]})})]})},iy=({percentage:e,radius:t=40,strokeWidth:n=8})=>{const r=t+n/2,a=r*2,s=2*Math.PI*t,l=s-e/100*s;return i.jsxs("div",{style:{width:a,height:a},className:jt.progress,children:[i.jsxs("svg",{"aria-hidden":"true",width:a,height:a,children:[i.jsx("circle",{cx:r,cy:r,r:t,fill:"transparent",className:jt.progressBackground,strokeWidth:n}),i.jsx("circle",{cx:r,cy:r,r:t,fill:"transparent",strokeWidth:n,strokeDasharray:`${s} ${s}`,strokeDashoffset:l,className:jt.progressForeground})]}),i.jsxs("span",{className:te(jt.progressText,{[jt.progressTextStart]:e!==0}),id:"md",children:[Math.min(e,100),"%"]})]})},Xo=e=>{switch(e.rewardRule.rewardType){case wo.Balance:return`${zt(e.rewardRule.rewardOptions.balance)} on the balance`;case wo.Product:return`products: ${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},lc=e=>{switch(e.rewardRule.rewardType){case wo.Balance:return zt(e.rewardRule.rewardOptions.balance);case wo.Product:return`${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},ly=e=>{switch(e.rewardRule.ruleType){case en.Spend:return`Spend $${e.rewardRule.ruleOptions.forEach} in total purchases at our store to receive a reward of ${Xo(e)}. You've spent $${e.progress} so far.`;case en.Order:return`Place ${e.rewardRule.ruleOptions.ordersCount} orders to receive a reward of ${Xo(e)}. You've made ${e.progress} orders so far.`;case en.Referral:return`On your referral link should sign up ${e.rewardRule.ruleOptions.minReferrals} people and make at least ${e.rewardRule.ruleOptions.minCompletedOrders} purchase to receive a reward of ${Xo(e)}. You've referred ${e.progress} friends so far.`;case en.Review:return`Leave ${e.rewardRule.ruleOptions.minReviews} reviews with a minimum rating of ${e.rewardRule.ruleOptions.minStars} to receive a reward of ${Xo(e)}. You've left ${e.progress} reviews so far.`}},cy=e=>{switch(e.rewardRule.ruleType){case en.Spend:return`Spend $${e.rewardRule.ruleOptions.forEach} at our store`;case en.Order:return`Make ${e.rewardRule.ruleOptions.ordersCount} orders`;case en.Referral:return`Refer ${e.rewardRule.ruleOptions.minReferrals} friends to our store`;case en.Review:return`Leave ${e.rewardRule.ruleOptions.minReviews} reviews with a minimum rating of ${e.rewardRule.ruleOptions.minStars}`}},uy=e=>[cy(e),ly(e)],dy=e=>{let t;switch(e.rewardRule.ruleType){case en.Spend:t=e.rewardRule.ruleOptions.forEach;break;case en.Order:t=e.rewardRule.ruleOptions.ordersCount;break;case en.Referral:t=e.rewardRule.ruleOptions.minReferrals;break;case en.Review:t=e.rewardRule.ruleOptions.minReviews;break}return[Math.round((e.progress/t*100+Number.EPSILON)*100)/100,e.progress,t]},fy="_appContainer_8shao_1",hy="_mobile_8shao_16",py="_contentContainer_8shao_35",Ko={appContainer:fy,mobile:hy,contentContainer:py},my="_wrapper_10svy_2",gy="_tableContainer_10svy_7",vy="_ticketsTable_10svy_22",yy="_tableBody_10svy_28",Cy="_scrollContainer_10svy_38",by="_tableItem_10svy_46",Sy="_tableLoader_10svy_53",fn={wrapper:my,tableContainer:gy,ticketsTable:vy,tableBody:yy,scrollContainer:Cy,tableItem:by,tableLoader:Sy},wy=async(e=1)=>{try{return await g3({PageNumber:e})}catch(t){return console.error("Failed to fetch tickets:",t),{list:[],totalCount:0}}},xy=()=>{const[e,t]=b.useState(null),{page:n,setPage:r}=Do(),[a,s]=b.useState(!0),[l,c]=b.useState(0);b.useEffect(()=>{(async()=>{s(!0);const{list:f,totalCount:h}=await wy(n);t(f),c(h),s(!1)})()},[n]);const u=!a&&e;return u&&e.length===0?i.jsx(Io,{title:"Tickets",description:"You don't have any tickets yet. If you contact support, tickets will be displayed here."}):i.jsxs("div",{className:fn.wrapper,children:[i.jsx(Mo,{title:"Tickets"}),i.jsxs("div",{className:fn.tableContainer,children:[i.jsxs("div",{className:fn.scrollContainer,children:[i.jsxs(Vi,{className:fn.ticketsTable,children:[i.jsx(Mt,{className:fn.tableItem,children:"TICKET ID"}),i.jsx(Mt,{className:fn.tableItem,children:"LAST MESSAGE"}),i.jsx(Mt,{className:fn.tableItem,children:"DATE"}),i.jsx(Mt,{className:fn.tableItem,children:"STATUS"})]}),u&&i.jsx("div",{className:fn.tableBody,children:e==null?void 0:e.map(d=>i.jsx(U8,{item:d},d.id))}),!u&&i.jsx("div",{className:fn.tableBody,children:i.jsx("div",{className:fn.tableLoader,children:i.jsx(un,{})})})]}),u&&i.jsx(Ja,{currentPage:n,totalCount:l,onPageChange:r})]})]})};var Qs={exports:{}},Jo={exports:{}},je={};/** @license React v16.13.1
|
|
86
|
+
***************************************************************************** */var Qn=function(){return Qn=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Qn.apply(this,arguments)};function O7(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}var B7=function(){return Math.random().toString(36).substring(6)},F7=function(e){var t=e.animate,n=t===void 0?!0:t,r=e.backgroundColor,a=r===void 0?"#f5f6f7":r,s=e.backgroundOpacity,l=s===void 0?1:s,c=e.baseUrl,u=c===void 0?"":c,d=e.children,f=e.foregroundColor,h=f===void 0?"#eee":f,m=e.foregroundOpacity,g=m===void 0?1:m,C=e.gradientRatio,p=C===void 0?2:C,v=e.uniqueKey,x=e.rtl,y=x===void 0?!1:x,_=e.speed,E=_===void 0?1.2:_,T=e.style,D=T===void 0?{}:T,S=e.title,R=S===void 0?"Loading...":S,M=e.beforeMask,N=M===void 0?null:M,Z=O7(e,["animate","backgroundColor","backgroundOpacity","baseUrl","children","foregroundColor","foregroundOpacity","gradientRatio","uniqueKey","rtl","speed","style","title","beforeMask"]),B=v||B7(),q="".concat(B,"-diff"),H="".concat(B,"-animated-diff"),le="".concat(B,"-aria"),fe=y?{transform:"scaleX(-1)"}:null,me="".concat(E,"s"),ye="".concat(p*-1," 0"),be="".concat(p," 0");return b.createElement("svg",Qn({"aria-labelledby":le,role:"img",style:Qn(Qn({},D),fe)},Z),R?b.createElement("title",{id:le},R):null,N&&b.isValidElement(N)?N:null,b.createElement("rect",{role:"presentation",x:"0",y:"0",width:"100%",height:"100%",clipPath:"url(".concat(u,"#").concat(q,")"),style:{fill:"url(".concat(u,"#").concat(H,")")}}),b.createElement("defs",null,b.createElement("clipPath",{id:q},d),b.createElement("linearGradient",{id:H,gradientTransform:"translate(".concat(ye,")")},b.createElement("stop",{offset:"0%",stopColor:a,stopOpacity:l}),b.createElement("stop",{offset:"50%",stopColor:h,stopOpacity:g}),b.createElement("stop",{offset:"100%",stopColor:a,stopOpacity:l}),n&&b.createElement("animateTransform",{attributeName:"gradientTransform",type:"translate",values:"".concat(ye,"; 0 0; ").concat(be),dur:me,repeatCount:"indefinite"}))))},zr=function(e){return e.children?b.createElement(F7,Qn({},e)):b.createElement(H7,Qn({},e))},H7=function(e){return b.createElement(zr,Qn({viewBox:"0 0 476 124"},e),b.createElement("rect",{x:"48",y:"8",width:"88",height:"6",rx:"3"}),b.createElement("rect",{x:"48",y:"26",width:"52",height:"6",rx:"3"}),b.createElement("rect",{x:"0",y:"56",width:"410",height:"6",rx:"3"}),b.createElement("rect",{x:"0",y:"72",width:"380",height:"6",rx:"3"}),b.createElement("rect",{x:"0",y:"88",width:"178",height:"6",rx:"3"}),b.createElement("circle",{cx:"20",cy:"20",r:"20"}))};const V7=({adaptiveStyles:e})=>{const{dashInfo:t,balance:n,setBalance:r,setDashInfo:a}=cn();return b.useEffect(()=>{(async()=>{const{data:l}=await U0(),c=await Mi();a(l),r(c)})()},[]),i.jsxs("div",{className:te(Dt.sidebar,{[Dt.mobile]:e!=="desktop"}),children:[!t||!n?i.jsx($7,{adaptiveStyles:e}):i.jsx(D7,{email:t.email,balance:zt(n),adaptiveStyles:e}),i.jsx(M7,{adaptiveStyles:e})]})},$7=({adaptiveStyles:e})=>i.jsx(zr,{speed:2,width:320,height:120,viewBox:"0 0 320 120",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",className:te(Dt.skeleton,{[Dt.mobile]:e!=="desktop"}),children:i.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"280",height:"100"})}),U7="_balanceContainer_qonmh_1",W7="_transactionsHeaderTitle_qonmh_8",Z7="_headerTitle_qonmh_12",z7="_balanceHeader_qonmh_16",q7="_balanceAmount_qonmh_23",G7="_balanceAmountTitle_qonmh_36",Y7="_balanceAmountValue_qonmh_41",X7="_transactionDate_qonmh_69",K7="_transactionItem_qonmh_76",J7="_transactionDetails_qonmh_84",Q7="_iconWrapper_qonmh_89",ev="_transactionInfo_qonmh_100",tv="_transactionTitle_qonmh_105",nv="_transactionId_qonmh_109",rv="_transactionAmount_qonmh_115",ov="_added_qonmh_120",av="_removed_qonmh_123",sv="_noItemsBlock_qonmh_127",iv="_pagination_qonmh_136",lv="_modal_qonmh_142",cv="_header_qonmh_12",uv="_form_qonmh_154",dv="_label_qonmh_160",fv="_bonusBlock_qonmh_173",hv="_gatewayList_qonmh_187",pv="_gatewayButton_qonmh_194",mv="_selected_qonmh_204",gv="_gatewayName_qonmh_211",vv="_error_qonmh_214",yv="_submitButton_qonmh_219",Cv="_addBalanceButton_qonmh_238",bv="_gatewayIcon_qonmh_257",Sv="_loaderContainer_qonmh_279",wv="_transactionsContainer_qonmh_287",xv="_transactionsHeader_qonmh_8",_v="_transactionsContent_qonmh_301",Te={balanceContainer:U7,transactionsHeaderTitle:W7,headerTitle:Z7,balanceHeader:z7,balanceAmount:q7,balanceAmountTitle:G7,balanceAmountValue:Y7,transactionDate:X7,transactionItem:K7,transactionDetails:J7,iconWrapper:Q7,transactionInfo:ev,transactionTitle:tv,transactionId:nv,transactionAmount:rv,added:ov,removed:av,noItemsBlock:sv,pagination:iv,modal:lv,header:cv,form:uv,label:dv,bonusBlock:fv,gatewayList:hv,gatewayButton:pv,selected:mv,gatewayName:gv,error:vv,submitButton:yv,addBalanceButton:Cv,gatewayIcon:bv,loaderContainer:Sv,transactionsContainer:wv,transactionsHeader:xv,transactionsContent:_v},Tv=async(e=1)=>await v3({PageNumber:e}),Ev=async({price:e,gateway:t,customerEmail:n})=>await $0({customerEmail:n,price:e,gateway:t}),kv=({enterAnother:e,bonusPercent:t,currency:n})=>i.jsxs("div",{className:Te.bonusBlock,children:[i.jsx(z,{name:"Fire"}),i.jsx("div",{children:e>0?`Enter another ${zt({amount:e,currency:n})} and receive an additional bonus of ${t}%`:`You will receive an additional bonus of ${t}%`})]}),Cd=({setIsOpen:e,isModal:t=!0})=>{const[n,r]=b.useState({amount:"",gateway:""}),[a,s]=b.useState({}),[l,c]=b.useState(!1),{gatewaysDetail:u,setGatewaysDetail:d,dashInfo:f,balanceSettings:h}=cn(),m=jn(),{notifications:g,setNotifications:C}=Lt(),{setIsOpen:p}=Zn();b.useEffect(()=>{u||(async()=>{var Z;const M=h!=null&&h.isEnabled?(Z=h==null?void 0:h.topUpSettings)==null?void 0:Z.gateways:[],N=await No(M);d(N)})()},[h,u]);const v=()=>{const R={};return(!n.amount||Number(n.amount)<1)&&(R.amount="The balance field cannot be empty."),n.gateway||(R.gateway="Select pay method"),s(R),Object.keys(R).length===0},x=async R=>{if(R.preventDefault(),!!v()){c(!0);try{const{data:M}=await Ev({price:{amount:Number(n.amount),currency:h!=null&&h.isEnabled?h.topUpSettings.currency:"USD"},gateway:n.gateway,customerEmail:(f==null?void 0:f.email)||""});C([...g,{message:"Order created successfully",status:"success",id:qe()}]),m(`/charges/${M.data.chargeId}`)}catch(M){const N=M;C([...g,{message:`Order creation failed: ${N.message}`,status:"error",id:qe()}])}finally{e(!1),c(!1)}}};if(!h||!h.isEnabled)return null;const{topUpSettings:{currency:y,topUpBonusEnabled:_,bonusPercent:E,minimumTopUpForBonus:T}}=h,D=Number(n.amount),S=_&&!Number.isNaN(D)?T-D:T;return i.jsx(i.Fragment,{children:l?i.jsx(Bd,{}):i.jsxs("div",{className:Te.modal,onClick:R=>R.stopPropagation(),children:[i.jsxs("div",{className:Te.header,children:[i.jsx("h2",{id:"h3",className:Te.headerTitle,children:"Top Up Account Balance"}),t&&i.jsx(z,{name:"X",onClick:()=>{p(!1),setTimeout(()=>{e(!1)},300)},className:Te.closeIcon,hoverable:!0,fill:"var(--text-primary)"})]}),i.jsxs("form",{onSubmit:x,className:Te.form,children:[i.jsxs("label",{className:Te.label,children:[i.jsx(xr,{label:"Enter Amount",type:"number",placeholder:"1000",value:n.amount,onChange:R=>r(M=>({...M,amount:R})),leftIcon:i.jsx(z,{name:"CurrencyDollarSimple",fill:"var(--text-secondary)"}),required:!0}),a.amount&&i.jsx("span",{className:Te.error,children:a.amount})]}),_&&S!==void 0&&i.jsx(kv,{enterAnother:S,bonusPercent:E,currency:y}),u&&i.jsx("div",{className:Te.gatewayList,children:u.length>0?u.map(R=>i.jsxs("div",{className:te(Te.gatewayButton,{[Te.selected]:n.gateway===R.name}),onClick:()=>r(M=>({...M,gateway:R.name})),children:[i.jsx("img",{alt:R.displayName,src:An(R.logoCfImageId),className:Te.gatewayIcon}),i.jsx("div",{className:Te.gatewayName,children:R.displayName})]},R.name)):i.jsx("span",{children:"Gateways not found"})}),!u&&i.jsx(zr,{speed:2,width:"100%",height:"220px",viewBox:"0 0 600 220",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:i.jsx("rect",{x:"0",y:"0",rx:"5",ry:"5",width:"100%",height:"100%"})}),a.gateway&&i.jsx("span",{className:Te.error,children:a.gateway}),i.jsx(it,{type:"Primary",disabled:!n.gateway||l,className:Te.submitButton,children:"Continue to Checkout"}),i.jsxs("div",{children:[i.jsx(Md,{}),i.jsx(Id,{})]})]})]})})},Rv=()=>{const[e,t]=b.useState([]),{balanceSettings:n,balance:r}=cn(),{page:a,setPage:s}=Do(),{setIsOpen:l}=Zn(),[c,u]=b.useState(!0),[d,f]=b.useState(0),[h,m]=b.useState(!1),[g,C]=b.useState("Newest");b.useEffect(()=>{s(1)},[]),b.useEffect(()=>{(async()=>{u(!0);const{list:_,totalCount:E}=await Tv(a);t(_),f(E),u(!1)})()},[a]);const p=(y,_)=>{var S;const E={},T=new Date,D=[...y].sort((R,M)=>{const N=new Date(R.createdAt).getTime(),Z=new Date(M.createdAt).getTime();return _==="Newest"?Z-N:N-Z});for(const R of D){const M=new Date(R.createdAt),N=M.toDateString()===T.toDateString()?"Today":M.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});E[N]||(E[N]=[]),(S=E[N])==null||S.push(R)}return E},v=({id:y,price:_,status:E,description:T})=>{const D=zt({amount:Math.abs(_.amount),currency:_.currency});return i.jsxs("div",{className:Te.transactionItem,children:[i.jsxs("div",{className:Te.transactionDetails,children:[i.jsx(z,{className:Te.iconWrapper,name:E===lo.ADDED?"Plus":"Minus",width:20,height:20}),i.jsxs("div",{className:Te.transactionInfo,children:[i.jsx("div",{className:Te.transactionTitle,id:"h4",children:T}),i.jsxs("div",{className:Te.transactionId,id:"md",children:["ID: ",y]})]})]}),i.jsxs("div",{className:te(Te.transactionAmount,{[Te.added]:E===lo.ADDED,[Te.removed]:E===lo.REMOVED}),id:"lg",children:[E===lo.ADDED?"+":"-"," ",D]})]},y)},x=()=>{if(e!=null&&e.length){const y=p(e,g);return i.jsxs("div",{className:Te.transactionsContainer,children:[i.jsx("div",{className:Te.transactionsContent,children:Object.entries(y).map(([_,E])=>i.jsxs("div",{id:"lg",children:[i.jsx("div",{className:Te.transactionDate,id:"md",children:_}),E.map(v)]},_))}),i.jsx(Ja,{className:Te.pagination,currentPage:a,totalCount:d,onPageChange:s})]})}return i.jsx(Io,{title:"Transaction History",description:"When you top up your account balance or receive a refund from our team, you'll see a history of transactions here.",className:Te.noItemsBlock})};return i.jsxs(i.Fragment,{children:[(n==null?void 0:n.isEnabled)&&i.jsx("div",{className:Te.balanceContainer,children:i.jsxs("div",{className:Te.balanceHeader,children:[r&&i.jsxs("div",{className:Te.balanceAmount,children:[i.jsx("span",{className:Te.balanceAmountTitle,id:"lg",children:"Your balance"}),i.jsx("span",{className:Te.balanceAmountValue,id:"h4",children:zt(r)})]}),i.jsxs(it,{onClick:y=>{y.stopPropagation(),m(!0),l(!0)},className:Te.addBalanceButton,children:[i.jsx(z,{name:"Plus"}),i.jsx("span",{children:"Add balance"})]})]})}),i.jsxs("div",{className:Te.transactionsHeader,children:[(e==null?void 0:e.length)>0?i.jsx("h3",{id:"h3",className:Te.transactionsHeaderTitle,children:"Transactions"}):i.jsx(Mo,{title:"Transactions"}),(e==null?void 0:e.length)>0&&i.jsx(vd,{options:["Newest","Oldest"],value:g,onChange:y=>{C(y)},style:{width:"110px"}})]}),c?i.jsx("div",{className:Te.loaderContainer,children:i.jsx(un,{})}):i.jsx("div",{children:x()}),h&&(n==null?void 0:n.isEnabled)&&i.jsx(Xa,{close:()=>m(!1),children:i.jsx(Cd,{setIsOpen:m})})]})},Pv="_home_20unt_1",Av="_content_20unt_13",Lv="_tablet_20unt_28",jv="_mobile_20unt_31",Dv="_statContainer_20unt_35",Nv="_text_20unt_47",Mv="_iconWrapper_20unt_53",Iv="_loader_20unt_57",Ov="_title_20unt_65",kn={home:Pv,content:Av,tablet:Lv,mobile:jv,statContainer:Dv,text:Nv,iconWrapper:Mv,loader:Iv,title:Ov},Bv="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17%202V9.85233L13.5806%2010.9427V6.58116L6.41169%208.82252V4.89257L17%202Z'%20fill='%23FF3F19'/%3e%3cpath%20d='M13.5806%2010.9427L13.5805%2014.691L3%2018V9.79935L6.41169%208.82252L6.41152%2013.2598L13.5806%2010.9427Z'%20fill='%23FF3F19'/%3e%3c/svg%3e",Fv="Billgang",ic=({children:e})=>i.jsx("div",{className:kn.statContainer,children:e}),Hv=({adaptiveStyles:e})=>{var u,d;const[t,n]=b.useState(null),{setBalanceSettings:r}=cn(),{pageContext:a}=Wn(),{general:s}=gi(),{header:l}=$n();function c(f){var g,C;const h=f==null?void 0:f.name,m=(C=(g=a==null?void 0:a.listings)==null?void 0:g.filter(p=>p.type==="PRODUCT"))==null?void 0:C.find(p=>p.productData.name===h);return m==null?void 0:m.link.to}return b.useEffect(()=>{const f=async()=>{const{data:m}=await W0();n(m)},h=async()=>{const m=await yd();r(m)};f(),h()},[]),t?i.jsxs("div",{className:kn.home,children:[i.jsx(wb,{adaptiveStyles:e}),i.jsx("h3",{id:"h3",className:kn.title,children:"Your Statistics"}),i.jsxs("div",{className:te(kn.content,{[kn.desktop]:e==="desktop",[kn.tablet]:e==="tablet",[kn.mobile]:e==="mobile"}),children:[i.jsxs(ic,{children:[i.jsx(on,{iconName:"Calendar",title:"Customer since",value:o6(t.createdAt)}),i.jsx(on,{iconName:"CurrencyCircleDollar",title:"Total spent",value:zt({amount:t.totalSpent})}),i.jsx(on,{iconName:"Medal",title:"Top",value:`#${t.ratingPlacement}`,children:t.ratingPlacement>1&&i.jsxs("div",{className:kn.text,id:"md-bold",children:[i.jsx(z,{name:"ArrowUp",className:kn.iconWrapper,width:16,height:16,fill:"var(--text-secondary)"}),"Spend"," ",zt({amount:t.spendMoreDefaultCurrencyForNextPlace,currency:(u=t.balance)==null?void 0:u.currency})," ","more to be #",t.ratingPlacement-1]})}),i.jsx(on,{iconName:"Star",title:"Average review",value:t.averageReview})]}),t.topSpenderProduct?i.jsx(on,{image:An(t.topSpenderProduct.image.cfId),imageName:t.topSpenderProduct.name,iconName:"Crown",title:"Top spent",value:`${zt({amount:t.topSpenderProduct.amountSpentUsd||0})} spent`,productSlug:c(t.topSpenderProduct)}):i.jsx(on,{image:"empty",iconName:"Crown",title:"Top spent",value:`${zt({amount:0})} spent`}),i.jsxs(ic,{children:[i.jsx(on,{iconName:"Bag",title:"Purchases",value:t.totalPurchases}),i.jsx(on,{iconName:"Eye",title:"Visits",value:t.visits}),i.jsx(on,{title:"Powered by",value:Fv,logo:Bv}),i.jsx(on,{title:"Store",value:(s==null?void 0:s.info.name)||"",logo:An((l==null?void 0:l.blockSettings.logo.url)||((d=s==null?void 0:s.info.logo)==null?void 0:d.cfId)||"A5gbiev6F8AaBvp6M146Kw/4ecd0fb9-8ebc-44e9-fa1c-c36f61f4bd00")})]}),t.favoriteProduct?i.jsx(on,{image:An(t.favoriteProduct.image.cfId),imageName:t.favoriteProduct.name,iconName:"Heart",title:"Favorite product",value:`bought ${t.favoriteProduct.purchasedTimes} times`,productSlug:c(t.favoriteProduct)}):i.jsx(on,{image:"empty",iconName:"Heart",title:"Favorite product",value:"bought 0 times"})]})]}):i.jsx("div",{className:kn.loader,children:i.jsx(un,{})})},Vv=async(e=1)=>await r3({PageNumber:e}),$v=()=>{const[e,t]=b.useState(null),[n,r]=b.useState(null),[a,s]=b.useState(0),{page:l}=Do(),[c,u]=b.useState(!0);async function d(){u(!0);const{list:h,totalCount:m}=await Vv(l);t(h),s(m),r(null),u(!1)}async function f(){const h=(e==null?void 0:e.map(g=>g.gatewayName))||[],m=await No(h);r(m)}return b.useEffect(()=>{!n&&e&&f()},[e,n]),b.useEffect(()=>{d()},[l]),i.jsx(i.Fragment,{children:e!=null&&e.length&&e.length===0?i.jsx(Io,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):i.jsxs(i.Fragment,{children:[i.jsx(Mo,{title:"Orders"}),i.jsx(Wb,{orders:e,gatewaysDetail:n,totalCount:a,isLoading:c})]})})},Uv="_container_caax0_1",Wv="_tablet_caax0_15",Zv="_mobile_caax0_18",zv="_progress_caax0_22",qv="_status_caax0_26",Gv="_name_caax0_37",Yv="_completed_caax0_44",Xv="_title_caax0_50",Kv="_description_caax0_58",Jv="_button_caax0_65",Qv="_achievement_caax0_73",ey="_progressText_caax0_92",ty="_progressTextStart_caax0_99",ny="_progressBackground_caax0_103",ry="_progressForeground_caax0_107",oy="_icon_caax0_111",jt={container:Uv,tablet:Wv,mobile:Zv,progress:zv,status:qv,name:Gv,completed:Yv,title:Xv,description:Kv,button:Jv,achievement:Qv,progressText:ey,progressTextStart:ty,progressBackground:ny,progressForeground:ry,icon:oy},ay=({adaptiveStyles:e})=>{const{notifications:t,setNotifications:n}=Lt(),{setBalance:r}=cn(),[a,s]=b.useState(null),l=async()=>{const h=(await I7()).map(m=>({...m,isClaimed:!1}));s(h)};b.useEffect(()=>{l()},[]);async function c(f){try{if(await T3(f),a){const m=a==null?void 0:a.map(g=>g.id===f.id?{...g,isClaimed:!0}:g);s(m)}n([...t,{message:"Reward claimed successfully",status:"success",id:qe()}]);const h=await Mi();s(null),r(h),l()}catch{n([...t,{message:"Failed to claim reward",status:"error",id:qe()}])}}const u=a&&a.length===0,d=a&&a.length>0;return i.jsx(i.Fragment,{children:u?i.jsx(Io,{title:"Rewards Unavailable",description:"Check back in the future to join our reward program."}):i.jsxs(i.Fragment,{children:[i.jsx(Mo,{title:"Rewards",description:"To unlock an exclusive reward, complete everything on this checklist"}),i.jsxs("div",{className:te(jt.container,{[jt.tablet]:e==="tablet",[jt.mobile]:e==="mobile"}),children:[d&&a.map(f=>i.jsx(sy,{achievement:f,onClick:h=>c(h)},f.id)),!d&&[...new Array(6)].map((f,h)=>i.jsx(zr,{speed:2,width:"100%",height:400,viewBox:"0 0 300 300",backgroundColor:"var(--surface-secondary)",foregroundColor:"var(--surface-disabled)",children:i.jsx("rect",{x:"0",y:"0",rx:"10",ry:"10",width:"100%",height:"300px"})},h))]})]})})},sy=({achievement:e,onClick:t})=>{const[n,r]=uy(e),[a,s,l]=dy(e),[c,u]=b.useState(!1),d=s>=l;return i.jsxs("div",{className:jt.achievement,children:[i.jsx(iy,{percentage:Math.min(a,100)}),i.jsx("div",{className:`${jt.status} ${d?jt.completed:""}`,id:"md",children:d?i.jsxs(i.Fragment,{children:[i.jsx(z,{name:"Confetti"}),i.jsx("span",{id:"md",children:"Completed!"})]}):`Done: ${s} / ${l}`}),i.jsxs("div",{className:jt.title,children:[i.jsx(z,{name:"Bag",className:jt.icon,fill:"var(--text-action)",width:18,height:18}),i.jsx("div",{className:jt.name,id:"h5",children:n})]}),i.jsx("span",{className:jt.description,id:"md",children:r}),i.jsx(it,{type:d&&!e.isClaimed?"Primary":"Secondary",className:jt.button,disabled:!d,onClick:async()=>{u(!0),await t(e),u(!1)},children:e.isClaimed?i.jsxs(i.Fragment,{children:[i.jsx(z,{name:"CheckCircle",fill:"var(--text-secondary)"}),i.jsxs("span",{children:["Your claimed ",lc(e)," bonus"]})]}):i.jsxs(i.Fragment,{children:[!c&&(d?i.jsx("span",{children:"Claim"}):lc(e)),c&&i.jsx(un,{})]})})]})},iy=({percentage:e,radius:t=40,strokeWidth:n=8})=>{const r=t+n/2,a=r*2,s=2*Math.PI*t,l=s-e/100*s;return i.jsxs("div",{style:{width:a,height:a},className:jt.progress,children:[i.jsxs("svg",{"aria-hidden":"true",width:a,height:a,children:[i.jsx("circle",{cx:r,cy:r,r:t,fill:"transparent",className:jt.progressBackground,strokeWidth:n}),i.jsx("circle",{cx:r,cy:r,r:t,fill:"transparent",strokeWidth:n,strokeDasharray:`${s} ${s}`,strokeDashoffset:l,className:jt.progressForeground})]}),i.jsxs("span",{className:te(jt.progressText,{[jt.progressTextStart]:e!==0}),id:"md",children:[Math.min(e,100),"%"]})]})},Xo=e=>{switch(e.rewardRule.rewardType){case wo.Balance:return`${zt(e.rewardRule.rewardOptions.balance)} on the balance`;case wo.Product:return`products: ${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},lc=e=>{switch(e.rewardRule.rewardType){case wo.Balance:return zt(e.rewardRule.rewardOptions.balance);case wo.Product:return`${e.rewardRule.rewardOptions.productsWithVariants.map(t=>`${t.quantity} ${t.productName} (${t.variantName})`).join()}`}},ly=e=>{switch(e.rewardRule.ruleType){case en.Spend:return`Spend $${e.rewardRule.ruleOptions.forEach} in total purchases at our store to receive a reward of ${Xo(e)}. You've spent $${e.progress} so far.`;case en.Order:return`Place ${e.rewardRule.ruleOptions.ordersCount} orders to receive a reward of ${Xo(e)}. You've made ${e.progress} orders so far.`;case en.Referral:return`On your referral link should sign up ${e.rewardRule.ruleOptions.minReferrals} people and make at least ${e.rewardRule.ruleOptions.minCompletedOrders} purchase to receive a reward of ${Xo(e)}. You've referred ${e.progress} friends so far.`;case en.Review:return`Leave ${e.rewardRule.ruleOptions.minReviews} reviews with a minimum rating of ${e.rewardRule.ruleOptions.minStars} to receive a reward of ${Xo(e)}. You've left ${e.progress} reviews so far.`}},cy=e=>{switch(e.rewardRule.ruleType){case en.Spend:return`Spend $${e.rewardRule.ruleOptions.forEach} at our store`;case en.Order:return`Make ${e.rewardRule.ruleOptions.ordersCount} orders`;case en.Referral:return`Refer ${e.rewardRule.ruleOptions.minReferrals} friends to our store`;case en.Review:return`Leave ${e.rewardRule.ruleOptions.minReviews} reviews with a minimum rating of ${e.rewardRule.ruleOptions.minStars}`}},uy=e=>[cy(e),ly(e)],dy=e=>{let t;switch(e.rewardRule.ruleType){case en.Spend:t=e.rewardRule.ruleOptions.forEach;break;case en.Order:t=e.rewardRule.ruleOptions.ordersCount;break;case en.Referral:t=e.rewardRule.ruleOptions.minReferrals;break;case en.Review:t=e.rewardRule.ruleOptions.minReviews;break}return[Math.round((e.progress/t*100+Number.EPSILON)*100)/100,e.progress,t]},fy="_appContainer_8shao_1",hy="_mobile_8shao_16",py="_contentContainer_8shao_35",Ko={appContainer:fy,mobile:hy,contentContainer:py},my="_wrapper_10svy_2",gy="_tableContainer_10svy_7",vy="_ticketsTable_10svy_22",yy="_tableBody_10svy_28",Cy="_scrollContainer_10svy_38",by="_tableItem_10svy_46",Sy="_tableLoader_10svy_53",fn={wrapper:my,tableContainer:gy,ticketsTable:vy,tableBody:yy,scrollContainer:Cy,tableItem:by,tableLoader:Sy},wy=async(e=1)=>{try{return await g3({PageNumber:e})}catch(t){return console.error("Failed to fetch tickets:",t),{list:[],totalCount:0}}},xy=()=>{const[e,t]=b.useState(null),{page:n,setPage:r}=Do(),[a,s]=b.useState(!0),[l,c]=b.useState(0);b.useEffect(()=>{(async()=>{s(!0);const{list:f,totalCount:h}=await wy(n);t(f),c(h),s(!1)})()},[n]);const u=!a&&e;return u&&e.length===0?i.jsx(Io,{title:"Tickets",description:"You don't have any tickets yet. If you contact support, tickets will be displayed here."}):i.jsxs("div",{className:fn.wrapper,children:[i.jsx(Mo,{title:"Tickets"}),i.jsxs("div",{className:fn.tableContainer,children:[i.jsxs("div",{className:fn.scrollContainer,children:[i.jsxs(Vi,{className:fn.ticketsTable,children:[i.jsx(Mt,{className:fn.tableItem,children:"TICKET ID"}),i.jsx(Mt,{className:fn.tableItem,children:"LAST MESSAGE"}),i.jsx(Mt,{className:fn.tableItem,children:"DATE"}),i.jsx(Mt,{className:fn.tableItem,children:"STATUS"})]}),u&&i.jsx("div",{className:fn.tableBody,children:e==null?void 0:e.map(d=>i.jsx(U8,{item:d},d.id))}),!u&&i.jsx("div",{className:fn.tableBody,children:i.jsx("div",{className:fn.tableLoader,children:i.jsx(un,{})})})]}),u&&i.jsx(Ja,{currentPage:n,totalCount:l,onPageChange:r})]})]})};var Qs={exports:{}},Jo={exports:{}},je={};/** @license React v16.13.1
|
|
87
87
|
* react-is.production.min.js
|
|
88
88
|
*
|
|
89
89
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -17559,7 +17559,7 @@ const k$ = ({ adaptiveStyles: e }) => {
|
|
|
17559
17559
|
const { list: w, totalCount: S } = await hU(o);
|
|
17560
17560
|
t(w), d(S), c(!1);
|
|
17561
17561
|
})();
|
|
17562
|
-
}, []);
|
|
17562
|
+
}, [o]);
|
|
17563
17563
|
const h = (v, w) => {
|
|
17564
17564
|
var b;
|
|
17565
17565
|
const S = {}, _ = /* @__PURE__ */ new Date(), N = [...v].sort((T, I) => {
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./builder.cjs.js"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./builder.cjs.js"),t=require("./index-B6gTSX8i.cjs");exports.App=e.App;exports.ColorVariables=e.ColorVariables;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;exports.useBuilderPages=e.useBuilderPages;exports.useCreateTicket=e.useCreateTicket;exports.ReCaptchaProvider=t.ReCaptchaProvider;exports.aspectRatioOptions=t.aspectRatioOptions;exports.formatPrice=t.formatPrice;exports.splitTextIntoSpans=t.splitTextIntoSpans;exports.useAdaptiveStyles=t.useAdaptiveStyles;exports.useReCaptcha=t.useReCaptcha;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App as s, ColorVariables as t, hotReload as o, iconNames as r, useBuilderPages as p, useCreateTicket as i } from "./builder.es.js";
|
|
2
|
-
import { R as l, a as u, f as R, s as d, b as f, u as m } from "./index-
|
|
2
|
+
import { R as l, a as u, f as R, s as d, b as f, u as m } from "./index-BMu1khEz.js";
|
|
3
3
|
export {
|
|
4
4
|
s as App,
|
|
5
5
|
t as ColorVariables,
|
package/dist/ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-C3l0gDlm.cjs"),j=require("react");require("react-dom");const lt="_block_kh9z8_8",dt="_title_kh9z8_16",ut="_subtitle_kh9z8_23",xt="_alignmentContent_kh9z8_30",pt="_alignments_kh9z8_39",mt="_alignment_kh9z8_30",jt="_circle_kh9z8_64",ht="_paddings_kh9z8_71",gt="_padding_kh9z8_71",ft="_active_kh9z8_97",F={block:lt,title:dt,subtitle:ut,alignmentContent:xt,alignments:pt,alignment:mt,circle:jt,paddings:ht,padding:gt,active:ft},yt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Et=["left","top","right","bottom"],_t=x=>{const{alignment:o,padding:r,setPadding:s,setAlignment:a,isAlignment:e=!0,isPadding:u=!0}=x;function d(l){switch(l){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function h(l){switch(l){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[f,P]=j.useState(null),[R,c]=j.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:F.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:F.title,children:"Layout (for Desktop version)"}),t.jsxRuntimeExports.jsxs("div",{className:F.alignmentContent,children:[e&&t.jsxRuntimeExports.jsxs("div",{className:F.block,children:[t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsx("div",{className:F.alignments,children:yt.map(l=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{a(l)},className:F.alignment,onMouseEnter:()=>{P(l)},onMouseLeave:()=>{P(null)},children:[l!==o&&f!==l&&t.jsxRuntimeExports.jsx("div",{className:F.circle}),l!==o&&f===l&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(f),fill:"#c2c2c2",width:22,height:22}),l===o&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(o),fill:"#FF3F19",width:22,height:22})]},l))})]}),u&&t.jsxRuntimeExports.jsxs("div",{className:F.block,children:[t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:"Paddings"}),t.jsxRuntimeExports.jsx("div",{className:F.paddings,children:Et.map(l=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(F.padding,{[F.active]:R===l}),onFocus:()=>{c(l)},onBlur:()=>{c(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:h(l),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(r[l]),onChange:y=>s({...r,[l]:Math.min(Number(y),999)}),max:999,paddingless:!0,borderless:!0})]},l))})]})]})]})},Rt="_title_82zux_1",bt="_subtitle_82zux_5",vt="_productsBlock_82zux_14",It="_top_82zux_26",St="_products_82zux_14",Nt="_product_82zux_14",Ct="_button_82zux_80",Pt="_disabled_82zux_91",kt="_buttons_82zux_118",Tt="_addButton_82zux_157",wt="_deleteButton_82zux_179",H={title:Rt,subtitle:bt,productsBlock:vt,top:It,products:St,product:Nt,button:Ct,disabled:Pt,buttons:kt,addButton:Tt,deleteButton:wt};function Bt({id:x,children:o}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:u,isDragging:d}=t.useSortable({id:x}),h={transform:t.CSS.Transform.toString(e),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:a,style:h,className:`${H.product} ${d?H.dragging:""}`,...r,...s,children:o})}const Mt=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,other:e,tags:u,title:d,subtitle:h,draggable:f=!1,withImage:P=!1,addable:R=!0,itemsOptions:c,hasRangeSelector:l=!1,rangeSelectorOptions:y,limit:g,autoScrollInterval:p,deletable:i,aspectRatio:E,setAspectRatio:C}=x,M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),A=n=>{const{active:b,over:I}=n;if(I&&b.id!==I.id){const B=s.findIndex(v=>v===b.id),k=s.findIndex(v=>v===I.id);if(B!==-1&&k!==-1){const v=[...s],[_]=v.splice(B,1);v.splice(k,0,_),a(v)}}};function V(n){if(P)return n?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${n[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const L=(n,b=!1)=>{const I=c.find(k=>k.id===n);if(!I)return;const B=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const v=[...s],_=c.find(m=>m.name===k);if(!_)return;const $=_.id,U=v.map(m=>m===n?$:m);a([...U])},value:I.name,options:c.filter(k=>!s.find(v=>v===k.id)).map(k=>k.name),leftAddonOptions:c.map(k=>({value:k.name,addon:V(k.images)}))}),b&&t.jsxRuntimeExports.jsx("div",{className:H.buttons,children:t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(k=>k!==n))})})})]});return f?t.jsxRuntimeExports.jsx(Bt,{id:n,children:B},t.v4()):t.jsxRuntimeExports.jsx("div",{className:H.product,children:B},t.v4())};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(d||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[d&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:d}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:n=>r==null?void 0:r(n)})]}),l&&y&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...y}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[h&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:h}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:A,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s,strategy:t.verticalListSortingStrategy,children:s.map(n=>L(n,i))})}):s.map(n=>L(n,i)),R&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(H.button,{[H.disabled]:!!(g&&g<=s.length||s.length===c.length)}),size:"s",disabled:!!(g&&g<=s.length||s.length===c.length),onClick:()=>{const n=[...s];let b=null;if(c){for(let I=0;I<c.length;I++)if(!s.find(B=>B===c[I].id)){b=c[I];break}}n.push((b==null?void 0:b.id)||c[0].id),a(n)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:H.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),E&&C&&t.jsxRuntimeExports.jsx(t.Select,{value:E,label:"Aspect Ratio",options:Object.keys(t.aspectRatio),onChange:n=>C(n),leftAddonOptions:t.aspectRatioOptions}),u!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{tagsTitle:"Tags",items:u}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e}),p!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(p.scrollInterval),onChange:n=>p.setScrollInterval(Number(n)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},$t="_title_roi3a_1",Ot="_subtitle_roi3a_5",At="_productsBlock_roi3a_14",qt="_top_roi3a_26",Dt="_products_roi3a_14",Lt="_product_roi3a_14",Ut="_button_roi3a_80",zt="_disabled_roi3a_91",Ft="_buttons_roi3a_118",Ht="_addButton_roi3a_164",Vt="_deleteButton_roi3a_179",z={title:$t,subtitle:Ot,productsBlock:At,top:qt,products:Dt,product:Lt,button:Ut,disabled:zt,buttons:Ft,addButton:Ht,deleteButton:Vt};function Yt({product:x,children:o}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:u,isDragging:d}=t.useSortable({id:x.id}),h={transform:t.CSS.Transform.toString(e),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:a,style:h,className:`${z.product} ${d?z.dragging:""}`,...r,...s,children:o})}const Gt=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,title:e,subtitle:u,editable:d=!0,draggable:h=!1,deletable:f=!0,addable:P=!0,itemsType:R,itemsOptions:c,addableOptions:l={},limit:y}=x,[g,p]=j.useState(null),[i,E]=j.useState(null),C=j.useRef(null),M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{if(g){const n=[...s].map(b=>b.id===g.id?g:b);a(n)}},[g]),j.useEffect(()=>{C.current&&i&&(C.current.getBoundingClientRect().height,i.top)},[C.current,i]);const A=(n,b)=>{n.stopPropagation();const I=n.target.getBoundingClientRect();E({top:I.top+window.scrollY,left:I.left-30}),p(b)},V=n=>{const{active:b,over:I}=n;if(I&&b.id!==I.id){const B=s.findIndex(v=>v.id===b.id),k=s.findIndex(v=>v.id===I.id);if(B!==-1&&k!==-1){const v=[...s],[_]=v.splice(B,1);v.splice(k,0,_),a(v)}}},L=(n,b)=>{const I=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),R==="select"&&c&&t.jsxRuntimeExports.jsx(t.Select,{onChange:B=>{const k=[...s],v=c.find($=>$.name===B);if(!v)return;const _=k.map($=>$.id===n.id?{...v,name:{"en-US":B}}:$);p({...n,name:{"en-US":B}}),a([..._])},value:n.name,options:c.filter(B=>!s.find(k=>k.name===B.name)).map(B=>B.name)}),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[d&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:B=>A(B,n)})}),f&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(B=>B.id!==n.id))})})]})]});return h?t.jsxRuntimeExports.jsx(Yt,{product:n,index:b,children:I},n.id):t.jsxRuntimeExports.jsx("div",{className:z.product,children:I},n.id)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(e||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:e}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:n=>r==null?void 0:r(n)})]}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[u&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:u}),h?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:V,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(n=>n.id),strategy:t.verticalListSortingStrategy,children:s.map((n,b)=>L(n,b))})}):s.map((n,b)=>L(n,b)),P&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(z.button,{[z.disabled]:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length))}),size:"s",disabled:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length)),onClick:()=>{const n=[...s];let b=null;if(c){for(let I=0;I<c.length;I++)if(!s.find(B=>B.id===c[I].id)){b=c[I];break}}R==="select"&&c&&n.push({name:b?b.name:c[0].name,id:(b==null?void 0:b.id)||c[0].id,...l}),a(n)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:z.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})]})};function Wt(x){const{product:o,children:r}=x,{attributes:s,listeners:a,setNodeRef:e,transform:u,transition:d,isDragging:h}=t.useSortable({id:o.id}),f={transform:t.CSS.Transform.toString(u),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles.product} ${h?t.styles.dragging:""}`,...s,...a,children:r})}const Xt=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,other:e,title:u,subtitle:d,editable:h=!0,draggable:f=!1,deletable:P=!0,addable:R=!0,itemsType:c,itemsPlaceholder:l="",itemsOptions:y,hasRangeSelector:g=!1,rangeSelectorOptions:p,modalOptions:i,addableOptions:E={},limit:C}=x,[M,A]=j.useState(null),[V,L]=j.useState({top:0,left:0}),[n,b]=j.useState(null),I=j.useRef(null),[B,k]=j.useState(!1),v=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{const m=()=>{A(null),k(!1)};return document.body.addEventListener("click",m),A(null),k(!1),()=>{A(null),k(!1),document.body.removeEventListener("click",m)}},[]),j.useEffect(()=>{if(M){const m=[...s].map(w=>w.id===M.id?M:w);a(m)}},[M]),j.useEffect(()=>{if(I.current&&n){const m=I.current.getBoundingClientRect().height,w=window.innerHeight;let S=n.top;S+m>w+window.scrollY-200&&(S=w+window.scrollY-m-200),S<0&&(S=10),L({top:S,left:n.left})}},[I.current,n]);const _=(m,w)=>{m.stopPropagation();const S=m.target.getBoundingClientRect();b({top:S.top+window.scrollY,left:S.left-30}),A(w),k(!0)},$=m=>{const{active:w,over:S}=m;if(S&&w.id!==S.id){const O=s.findIndex(q=>q.id===w.id),W=s.findIndex(q=>q.id===S.id);if(O!==-1&&W!==-1){const q=[...s],[G]=q.splice(O,1);q.splice(W,0,G),a(q)}}},U=m=>{var S;const w=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),c==="select"&&y&&t.jsxRuntimeExports.jsx(t.Select,{onChange:O=>{const q=[...s].map(G=>G.id===m.id?{...m,name:{"en-US":O}}:G);A({...m,name:{"en-US":O}}),a([...q])},value:m.name["en-US"],options:y.filter(O=>!s.find(W=>W.name["en-US"]===O))}),c==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:O=>{const q=[...s].map(G=>G.id===m.id?{...m,name:{"en-US":O}}:G);a([...q])},value:m.name["en-US"],placeholder:l}),c==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:O=>{const q=[...s].map(G=>G.id===m.id?{...m,images:O}:G);a([...q])},activeImage:(S=s.find(O=>O.id===m.id))==null?void 0:S.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.buttons,children:[h&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:O=>_(O,m)})}),P&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(O=>O.id!==m.id))})})]})]});return f?t.jsxRuntimeExports.jsx(Wt,{product:m,children:w},m.id):t.jsxRuntimeExports.jsx("div",{className:t.styles.product,children:w},m.id)};return t.jsxRuntimeExports.jsxs("div",{className:t.styles.productsBlock,children:[(u||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles.top,children:[u&&t.jsxRuntimeExports.jsx("h3",{className:t.styles.title,children:u}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:m=>r==null?void 0:r(m)})]}),M&&h&&i&&B&&t.jsxRuntimeExports.jsx(t.ItemPopup,{ref:I,activeItem:M,setActiveItem:A,popupPosition:V,modalOptions:i,setIsOpenModal:k}),g&&p&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...p}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:v,onDragEnd:$,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(m=>m.id),strategy:t.verticalListSortingStrategy,children:s.map(m=>U(m))})}):s.map(m=>U(m)),R&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(t.styles.button,{[t.styles.disabled]:!!(C&&C<=s.length)}),size:"s",disabled:!!(C&&C<=s.length),onClick:()=>{const m=[...s];let w=null;if(y){for(let S=0;S<y.length;S++)if(!s.find(O=>O.name["en-US"]===y[S])){w=y[S];break}}c==="select"&&y?m.push({name:{"en-US":w||y[0]},id:t.v4(),...E,maxSymbols:100}):c==="input"?m.push({name:{"en-US":""},id:t.v4(),...E,maxSymbols:100}):m.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),...E,maxSymbols:100}),a(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},Qt="_subtitle_jql1y_1",Jt="_products_jql1y_10",Kt="_product_jql1y_10",Zt="_button_jql1y_11",te="_buttons_jql1y_11",ee="_addButton_jql1y_150",se="_deleteButton_jql1y_165",X={subtitle:Qt,products:Jt,product:Kt,button:Zt,buttons:te,addButton:ee,deleteButton:se},st=x=>{const{buttons:o,setButtons:r,deletable:s=!0,addable:a=!0,editableLink:e=!0}=x,{pages:u}=t.usePagesStore(),[d,h]=j.useState(null),[f,P]=j.useState({top:0,left:0}),[R,c]=j.useState(null),l=j.useRef(null);j.useEffect(()=>{if(d){const p=[...o].map(i=>i.id===d.id?d:i);r(p)}},[d]),j.useEffect(()=>{if(l.current&&R){const p=l.current.getBoundingClientRect().height,i=window.innerHeight;let E=R.top;E+p>i+window.scrollY-200&&(E=i+window.scrollY-p-200),E<0&&(E=10),P({top:E,left:R.left})}},[l.current,R]);const y=(p,i)=>{p.stopPropagation();const E=p.target.getBoundingClientRect();c({top:E.top+window.scrollY-70,left:E.left-(a?30:65)}),h(i)},g=(p,i)=>{const E=[...o],C={...p,id:Math.random().toString(36).substr(2,9)};E.splice(i+1,0,C),r(E)};return t.jsxRuntimeExports.jsxs("div",{className:X.products,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Button Type"}),o.map((p,i)=>t.jsxRuntimeExports.jsxs("div",{className:X.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const M=[...o].map(A=>A.id===p.id?{...p,type:E}:A);r(M)},value:p.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:X.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{g(p,i)}})}),t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>{y(E,p)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const E=o.filter(C=>C.id!==p.id);r(E)},width:20,height:20,fill:"#C12A2A"})})]})]},p.id)),d&&t.jsxRuntimeExports.jsx(t.ButtonPopup,{ref:l,activeButton:d,setActiveButton:h,popupPosition:f,editableLink:e}),a&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:X.button,size:"s",onClick:()=>{const p=[...o];e?p.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Button Name"},destination:"Go to Page",page:u?Object.values(u)[0].path:"/",openInNewTab:!1}):p.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Create Ticket"},destination:"Go to Page",page:u?Object.values(u)[0].path:"/",openInNewTab:!1}),r(p)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:X.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},ne=x=>{const{isActiveButtons:o,setIsActiveButtons:r,buttons:s,setButtons:a,editableLink:e=!0,addable:u=!0,deletable:d=!0}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.top,children:[t.jsxRuntimeExports.jsx("h3",{className:t.styles$1.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:h=>r(h)})]}),o&&t.jsxRuntimeExports.jsx(st,{buttons:s,setButtons:a,editableLink:e,addable:u,deletable:d})]})})};function ie(x){const{product:o,children:r}=x,{attributes:s,listeners:a,setNodeRef:e,transform:u,transition:d,isDragging:h}=t.useSortable({id:String(o.listingId)}),f={transform:t.CSS.Transform.toString(u),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles$2.product} ${h?t.styles$2.dragging:""}`,...s,...a,children:r})}const oe=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,other:e,title:u,subtitle:d,editable:h=!0,draggable:f=!1,withImage:P=!1,deletable:R=!0,addable:c=!0,itemsType:l,itemsOptions:y,limit:g,aspectRatio:p,setAspectRatio:i}=x,[E,C]=j.useState(null),[M,A]=j.useState({top:0,left:0}),[V,L]=j.useState(!1),n=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{const _=()=>{C(null),L(!1)};return document.body.addEventListener("click",_),C(null),L(!1),()=>{C(null),L(!1),document.body.removeEventListener("click",_)}},[]),j.useEffect(()=>{if(E){const _=[...s].map($=>$.listingId===E.listingId?E:$);a(_)}},[E]);const b=(_,$)=>{_.stopPropagation();const U=_.target.getBoundingClientRect(),m=100,w=window.innerHeight;let S=U.top+window.scrollY;S+m>w&&(S=w-m-20),L(!0),A({top:S-80,left:U.left-30}),C($)};function I(_){if(P)return _?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${_}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const B=_=>{const{active:$,over:U}=_;if(U&&$.id!==U.id){const m=s.findIndex(S=>String(S.listingId)===$.id),w=s.findIndex(S=>String(S.listingId)===U.id);if(m!==-1&&w!==-1){const S=[...s],[O]=S.splice(m,1);S.splice(w,0,O),a(S)}}},k=_=>{const $=y.find(m=>_.listingId===m.id);if(!$)return null;const U=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),l==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:m=>{const w=[...s],S=y.find(q=>q.productData.name===m);if(!S)return;const O={listingId:S.id,image:S.productData.images.length>0?S.productData.images[0].cfId:""},W=w.map(q=>q.listingId===_.listingId?O:q);C(O),a([...W])},value:$.productData.name,options:[...y.filter(m=>!s.find(w=>w.listingId===m.id)).map(m=>m.productData.name)],leftAddonOptions:y.map(m=>{var w;return{value:m.productData.name,addon:I(((w=m.productData.images[0])==null?void 0:w.cfId)||"")}})}),t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.buttons,children:[h&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:m=>b(m,_)})}),R&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(m=>m!==_))})})]})]});return f?t.jsxRuntimeExports.jsx(ie,{product:_,children:U},_.listingId):t.jsxRuntimeExports.jsx("div",{className:t.styles$2.product,children:U},_.listingId)},v=j.useRef(null);return t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.productsBlock,children:[(u||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.top,children:[u&&t.jsxRuntimeExports.jsx("h3",{className:t.styles$2.title,children:u}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:_=>r==null?void 0:r(_)})]}),V&&E&&t.jsxRuntimeExports.jsx(t.ListingPopup,{ref:v,activeItem:E,setActiveItem:C,setIsOpenModal:L,popupPosition:M,itemsOptions:y}),o&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles$2.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:n,onDragEnd:B,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(_=>String(_.listingId)),strategy:t.verticalListSortingStrategy,children:s.map(_=>k(_))})}):s.map(_=>k(_)),c&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.styles$2.button,size:"s",onClick:()=>{const _=[...s];for(let $=0;$<y.length;$++)if(!s.find(U=>U.listingId===y[$].id)){_.push({listingId:y[$].id,image:y[$].productData.images.length>0?y[$].productData.images[0].cfId:""});break}a(_)},disabled:s.length===(g||y.length),style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),p&&i&&t.jsxRuntimeExports.jsx(t.Select,{value:p,options:Object.keys(t.aspectRatio),onChange:_=>i(_),leftAddonOptions:t.aspectRatioOptions}),o&&e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},re="_options_s4lx3_1",ae="_price_s4lx3_18",ce="_oldPrice_s4lx3_25",le="_newPrice_s4lx3_34",de="_animate_s4lx3_42",ue="_meta_s4lx3_60",xe="_info_s4lx3_66",pe="_infoRight_s4lx3_75",me="_buttons_s4lx3_82",je="_variants_s4lx3_89",he="_variant_s4lx3_89",ge="_stock_s4lx3_107",fe="_variantInfo_s4lx3_115",ye="_quantity_s4lx3_122",Ee="_button_s4lx3_82",_e="_activeVariant_s4lx3_168",Re="_chargeTypes_s4lx3_172",be="_charge_s4lx3_172",ve="_chargeActive_s4lx3_197",Ie="_title_s4lx3_205",T={options:re,price:ae,oldPrice:ce,newPrice:le,animate:de,meta:ue,info:xe,infoRight:pe,buttons:me,variants:je,variant:he,stock:ge,variantInfo:fe,quantity:ye,button:Ee,activeVariant:_e,chargeTypes:Re,charge:be,chargeActive:ve,title:Ie};var Z=(x=>(x.ONE_TIME="One-Time",x.RECURRING="Subscribe & Save",x))(Z||{});const nt=x=>{var V,L;const{product:o,setIsOpen:r,isCartEnabled:s=!0}=x,{variants:a}=o,[e,u]=j.useState(a[0]),[d,h]=j.useState(e.chargeTypes?e.chargeTypes[0]:"ONE_TIME"),{notifications:f,setNotifications:P}=t.useNotificationStore(),R=t.useNavigate(),[c,l]=j.useState(1),{cart:y,reset:g,addProductToCart:p}=t.useCart(),[i,E]=j.useState(!1);j.useEffect(()=>{E(!0);const n=setTimeout(()=>E(!1),600);return()=>clearTimeout(n)},[c]);async function C(){try{p({productId:o.id,productVariantId:e.id,chargeType:d,quantity:c}),P([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(n){P([...f,{id:t.v4(),message:`Product failed to add to cart: ${n}`,status:"error"}])}r==null||r(!1)}function M(){g(),C(),R("/checkout")}function A(n){if(n>=864e5){const v=Math.floor(n/864e5);return`${v} ${v===1?"day":"days"}`}else if(n>=36e5){const v=Math.floor(n/36e5);return`${v} ${v===1?"hour":"hours"}`}else if(n>=6e4){const v=Math.floor(n/6e4);return`${v} ${v===1?"minute":"minutes"}`}else{const v=Math.floor(n/1e3);return`${v} ${v===1?"second":"seconds"}`}}return j.useEffect(()=>{e.quantity&&e.quantity.available===0?l(0):l(1)},[e.quantity.available]),j.useEffect(()=>{e.chargeTypes&&h(e.chargeTypes.includes(d)?d:e.chargeTypes[0])},[e.chargeTypes]),t.jsxRuntimeExports.jsxs("div",{className:T.options,children:[e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:T.chargeTypes,children:e.chargeTypes.map(n=>t.jsxRuntimeExports.jsx("div",{className:t.clx(T.charge,{[T.chargeActive]:d===n}),onClick:()=>h(n),children:Z[n]},n))}),t.jsxRuntimeExports.jsx("div",{className:T.variants,children:a.filter(n=>{var b;return(b=n.chargeTypes)==null?void 0:b.includes(d)}).map(n=>{var b,I;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(T.variant,{[T.activeVariant]:e.id===n.id}),onClick:()=>{u(n),l(1)},children:[t.jsxRuntimeExports.jsxs("div",{className:T.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:T.title,id:"h4",children:t.splitTextIntoSpans(n.name)}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:[t.formatPrice({amount:d==="ONE_TIME"?n.price.amount:n.subscriptionSettings?n.subscriptionSettings.price.amount:0,currency:d==="ONE_TIME"?n.price.currency:n.subscriptionSettings?n.subscriptionSettings.price.currency:"USD"})," ",d==="RECURRING"&&n.subscriptionSettings&&` / ${t.normalizeInterval(n.subscriptionSettings.recurringIntervalDays||0)}`]})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:T.stock,id:"md",children:[(b=n.quantity.restrictions)!=null&&b.max||n.quantity.available!==void 0?((I=n.quantity.restrictions)==null?void 0:I.max)||n.quantity.available:"∞"," ","in stock"]})})]},n.id)})}),d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:T.quantity,id:"md",children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{c>1?l(n=>n-1):l(1)},className:T.button,disabled:e.quantity.available&&e.quantity.restrictions&&c<=e.quantity.restrictions.min||e.quantity.available===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(t.Input$1,{type:"number",value:String(c),onChange:n=>{e.quantity.available&&Number(n)>e.quantity.available?l(e.quantity.available):l(Number(n))},max:((V=e.quantity.restrictions)==null?void 0:V.max)||e.quantity.available||Number.POSITIVE_INFINITY,min:((L=e.quantity.restrictions)==null?void 0:L.min)||0,centered:!0,disabled:e.quantity&&e.quantity.available===0||Object.keys(e.quantity.restrictions||{}).length!==0&&c>=e.quantity.restrictions.max}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{l(n=>n+1)},className:T.button,disabled:!!(e.quantity.available&&e.quantity.restrictions&&c>=e.quantity.restrictions.max||e.quantity.available===0||e.quantity.available&&c>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:T.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:T.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:T.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"var(--text-action)",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{id:"md",children:!e.deliveryTime||e.deliveryTime===0?"Instant":A(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:T.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:T.infoRight,children:d==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:T.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:T.oldPrice,id:"md",children:t.formatPrice({amount:e.compareAtPrice.amount*c,currency:e.compareAtPrice.currency})})]}):t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),id:"md",children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:T.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:T.oldPrice,id:"md",children:t.formatPrice({amount:e.subscriptionSettings.compareAtPrice.amount*c,currency:e.subscriptionSettings.compareAtPrice.currency})})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:T.buttons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>M(),disabled:e.quantity&&e.quantity.available===0,children:d==="ONE_TIME"?"Buy Now":"Subscribe Now"}),d==="ONE_TIME"&&s&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>C(),disabled:e.quantity&&e.quantity.available===0,children:y.parts.some(n=>n.productId===o.id&&n.productVariantId===e.id)?"Add More":"Add to Cart"})]})]})},Se="_buttons_1uy6y_23",Ne="_modal_1uy6y_32",Ce="_closing_1uy6y_65",Pe="_info_1uy6y_114",ke="_top_1uy6y_121",Te="_title_1uy6y_132",we="_clear_1uy6y_139",Be="_activeClear_1uy6y_146",Me="_count_1uy6y_150",$e="_cart_1uy6y_165",Oe="_empty_1uy6y_173",Ae="_product_1uy6y_199",qe="_products_1uy6y_208",De="_image_1uy6y_216",Le="_productInfo_1uy6y_233",Ue="_content_1uy6y_240",ze="_name_1uy6y_246",Fe="_price_1uy6y_252",He="_productButtons_1uy6y_258",Ve="_productButton_1uy6y_258",Ye="_productCount_1uy6y_275",Ge="_bottom_1uy6y_292",We="_subtotal_1uy6y_300",Xe="_block_1uy6y_308",Qe="_shoppingCount_1uy6y_315",Je="_total_1uy6y_335",Ke="_link_1uy6y_341",Ze="_userInfo_1uy6y_348",ts="_pagesMobileModal_1uy6y_360",es="_pagesMobileModalContent_1uy6y_374",ss="_pagesMobileModalHeader_1uy6y_380",ns="_pagesMobileModalFooter_1uy6y_390",is="_pageLink_1uy6y_397",os="_rightButtons_1uy6y_406",N={buttons:Se,modal:Ne,closing:Ce,info:Pe,top:ke,title:Te,clear:we,activeClear:Be,count:Me,cart:$e,empty:Oe,product:Ae,products:qe,image:De,productInfo:Le,content:Ue,name:ze,price:Fe,productButtons:He,productButton:Ve,productCount:Ye,bottom:Ge,subtotal:We,block:Xe,shoppingCount:Qe,total:Je,link:Ke,userInfo:Ze,pagesMobileModal:ts,pagesMobileModalContent:es,pagesMobileModalHeader:ss,pagesMobileModalFooter:ns,pageLink:is,rightButtons:os,delete:"_delete_1uy6y_413"},rs=x=>{const{shopping:o,signUp:r,isShowUserInfo:s=!0}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:(o||s)&&t.jsxRuntimeExports.jsxs("div",{className:N.buttons,children:[o&&t.jsxRuntimeExports.jsx(it,{}),s&&t.jsxRuntimeExports.jsx(tt,{signUp:r})]})})},it=()=>{const[x,o]=j.useState(!1),[r,s]=j.useState([]),[a,e]=j.useState(!1),{cart:u,products:d}=t.useCart();j.useEffect(()=>{(async()=>{const c=u.parts.map(g=>String(g.productId)),l=d.filter(g=>c.includes(String(g.id)))||[],y=u.parts.map(g=>{const p=l.find(i=>i.id===g.productId);return p?{...p,activeVariantId:g.productVariantId,quantity:g.quantity,chargeType:g.chargeType}:null}).filter(Boolean);s(y)})()},[u.parts,d]);function h(R){return!R||!(R!=null&&R.variants)?!1:R.chargeType==="RECURRING"}const f=u.parts.length>0&&r.length>0&&!h(r[0]);function P(){e(!1),setTimeout(()=>{o(!1)},300)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",style:{padding:10,position:"relative"},onClick:R=>{R.stopPropagation(),window.location.pathname.includes("/admin/builder")||(o(!0),e(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"}),f&&t.jsxRuntimeExports.jsx("div",{className:N.shoppingCount,children:u.parts.length})]}),x&&t.jsxRuntimeExports.jsx(t.Modal,{close:P,withAnimation:!1,children:t.jsxRuntimeExports.jsx(ot,{activeProducts:r,isCartNotEmpty:f,isOpen:a,close:P})})]})},ot=x=>{var g,p;const{activeProducts:o,isCartNotEmpty:r,isOpen:s,close:a}=x,{cart:e,reset:u,getTotalAndDiscount:d,updateQuantityOfProduct:h,removeProduct:f}=t.useCart(),P=t.useNavigate();function R(i,E){P(i,{replace:E})}function c(i){i.quantity&&h({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity+1,chargeType:i.chargeType})}function l(i){i.quantity&&h({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity-1,chargeType:i.chargeType})}function y(i){f({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity||1,chargeType:i.chargeType})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(N.modal,{[N.closing]:!s}),onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:N.top,children:[t.jsxRuntimeExports.jsxs("div",{className:N.info,children:[t.jsxRuntimeExports.jsx("span",{className:N.title,id:"h4",children:"Cart"}),r&&t.jsxRuntimeExports.jsx("div",{className:N.count,id:"md",children:e.parts.length})]}),t.jsxRuntimeExports.jsxs("div",{className:N.rightButtons,children:[r&&t.jsxRuntimeExports.jsx("button",{className:t.clx(N.clear,{[N.activeClear]:r}),disabled:!r,onClick:u,id:"md",children:"Clear all"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",onClick:a,hoverable:!0,width:24,height:24,fill:"var(--text-primary)"})]})]}),r?t.jsxRuntimeExports.jsxs("div",{className:N.cart,children:[t.jsxRuntimeExports.jsx("div",{className:N.products,children:o.map(i=>{var E,C;return t.jsxRuntimeExports.jsxs("div",{className:N.product,children:[t.jsxRuntimeExports.jsxs("div",{className:N.productInfo,children:[i.images.length>0?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:N.image}):t.jsxRuntimeExports.jsx("div",{className:N.image,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsxs("div",{className:N.content,children:[t.jsxRuntimeExports.jsx("div",{className:N.name,children:t.splitTextIntoSpans(((E=i.variants.find(M=>M.id===i.activeVariantId))==null?void 0:E.name)||i.name)}),t.jsxRuntimeExports.jsx("div",{className:N.price,children:t.formatPrice({amount:i.variants.find(M=>M.id===i.activeVariantId).price.amount*((i==null?void 0:i.quantity)||1),currency:i.variants.find(M=>M.id===i.activeVariantId).price.currency})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:N.productButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{i.quantity!==1&&l(i)},className:N.productButton,disabled:i.quantity===1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{className:N.productCount,type:"number",value:((C=i.quantity)==null?void 0:C.toString())||"",onChange:M=>{const A=Math.min(Number(M.target.value),i.variants.find(V=>V.id===i.activeVariantId).quantity.available||1/0);A<1||h({productId:i.id,productVariantId:i.activeVariantId,quantity:A,chargeType:i.chargeType})},min:1,max:i.variants.find(M=>M.id===i.activeVariantId).quantity.available||1/0}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>c(i),className:N.productButton,disabled:i.quantity===i.variants.find(M=>M.id===i.activeVariantId).quantity.available,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:N.delete,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"var(--text-action)",width:20,height:20,onClick:()=>y(i),hoverable:!0})})]})]},i.id)})}),t.jsxRuntimeExports.jsxs("div",{className:N.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:N.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:N.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsx("div",{className:N.total,children:t.formatPrice({amount:d().total,currency:e.parts.length>0&&((p=(g=o.find(i=>i.id===e.parts[0].productId))==null?void 0:g.variants.find(i=>i.id===e.parts[0].productVariantId))==null?void 0:p.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>R("/checkout",!1),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(rt,{})]})},rt=()=>t.jsxRuntimeExports.jsxs("div",{className:N.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsx("span",{id:"h5",children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:N.link,id:"md",children:"view products"})]})]}),tt=({signUp:x,close:o})=>{const{token:r}=t.useStorefrontStore(),s=t.useNavigate(),[a,e]=j.useState("test-email@gmail.com");j.useEffect(()=>{r&&(async()=>{if(!r)return;const h=t.jwtDecode(r);e(h.email)})()},[r]);function u(d){window.location.pathname.includes("/admin/builder")||s(d)}return r?t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",className:N.userInfo,onClick:()=>{u("/customer-dash"),o==null||o()},children:t.jsxRuntimeExports.jsx("div",{children:a||"test-email@gmail.com"})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{u("/customer-dash"),o==null||o()},type:"Secondary",style:{padding:10},children:"Login"}),x&&t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{u("/customer-dash"),o==null||o()},type:"Primary",style:{padding:10,whiteSpace:"nowrap"},children:"Sign Up"})]})},at=({logo:x,setIsOpen:o,signUp:r,pages:s})=>{const{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{o(!1),a(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:N.pagesMobileModal,onClick:u=>u.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:N.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:x}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:e,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X"})})]}),t.jsxRuntimeExports.jsx("div",{className:N.pagesMobileModalContent,children:s.length>0&&s.map(u=>t.jsxRuntimeExports.jsx("div",{className:N.pageLink,onClick:e,children:t.jsxRuntimeExports.jsx(t.Link,{path:u.path,children:u.name["en-US"]},u.id)}))}),t.jsxRuntimeExports.jsx("div",{className:N.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(tt,{signUp:r,close:e})})]})},as=({logo:x,signUp:o,pages:r})=>{const[s,a]=j.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(ct,{setIsOpenModal:a}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>a(!1),hasPadding:!1,children:t.jsxRuntimeExports.jsx(at,{logo:x,setIsOpen:a,signUp:o,pages:r})})]})},ct=x=>{const{setIsOpenModal:o}=x;return t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{padding:10},onClick:r=>{r.stopPropagation(),window.location.pathname.includes("/admin/builder")||o(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List"})})},cs="_share_onabp_1",ls="_modal_onabp_8",ds="_header_onabp_20",us="_title_onabp_46",xs="_copyWrapper_onabp_53",ps="_copyText_onabp_62",ms="_copyTextMobile_onabp_75",js="_copyTextMiniMobile_onabp_94",Q={share:cs,modal:ls,header:ds,title:us,copyWrapper:xs,copyText:ps,copyTextMobile:ms,copyTextMiniMobile:js},hs=({title:x="Copy Product Link"})=>{const{isOpenModal:o,setIsOpenModal:r}=t.useShareLinkStore();function s(){r(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{className:Q.share,onClick:a=>{a.stopPropagation(),s()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),o&&t.jsxRuntimeExports.jsx(t.Modal,{close:r,children:t.jsxRuntimeExports.jsx(gs,{title:x})})]})},gs=({title:x="Copy Product Link"})=>{const{setIsOpenModal:o}=t.useShareLinkStore(),{notifications:r,setNotifications:s}=t.useNotificationStore(),{setIsOpen:a}=t.useModalStore(),e=window.location.href;function u(){navigator.clipboard.writeText(e),s([...r,{id:t.v4(),message:"Link copied to clipboard",status:"success"}])}function d(){a(!1),setTimeout(()=>{o(!1),a(!0)},300)}function h(f,P){return f.length>P?f.slice(0,P)+"...":f}return t.jsxRuntimeExports.jsxs("div",{className:Q.modal,onClick:f=>f.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:Q.header,children:[t.jsxRuntimeExports.jsx("div",{className:Q.title,id:"h4",children:x}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:d,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:Q.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",onClick:u,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:Q.copyText,id:"md",children:h(e,100)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMobile,id:"md",children:h(e,40)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMiniMobile,id:"md",children:h(e,20)})]}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:u,children:r.find(f=>f.message==="Link copied to clipboard")?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},fs="_accordion_153d4_1",ys="_header_153d4_12",Es="_icon_153d4_21",_s="_open_153d4_24",Rs="_content_153d4_28",bs="_contentOpen_153d4_36",vs="_contentText_153d4_40",J={accordion:fs,header:ys,icon:Es,open:_s,content:Rs,contentOpen:bs,contentText:vs},Is=({title:x,content:o,defaultOpen:r=!1})=>{const[s,a]=j.useState(r),[e,u]=j.useState(0),d=j.useRef(null),h=()=>{a(!s)};return j.useEffect(()=>{d.current&&u(s?d.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:J.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:J.header,onClick:h,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:x}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.icon,{[J.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.content,{[J.contentOpen]:s}),children:t.jsxRuntimeExports.jsx("p",{id:"md",className:J.contentText,ref:d,style:{height:`${e}px`,marginTop:`${e>0?"20px":"0px"}`},children:o})})]})},Ss="_buttonsBlock_1x6xf_1",Ns="_cartDisabled_1x6xf_25",et={buttonsBlock:Ss,cartDisabled:Ns},Cs=x=>{var P,R;const{setIsOpen:o,setModalType:r,productId:s,isCartEnabled:a=!0}=x,{cart:e}=t.useCart(),{pageContext:u}=t.usePagesStore(),d=(P=u==null?void 0:u.listings)==null?void 0:P.find(c=>c.id===s);if(!d)return null;const h=(R=u==null?void 0:u.products)==null?void 0:R.find(c=>c.uniquePath===d.productData.uniquePath);if(!h)return null;const f=e.parts.find(c=>c.productId===h.id);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(et.buttonsBlock,{[et.cartDisabled]:!a}),onClick:c=>c.stopPropagation(),children:[a&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{width:"100%"},onClick:()=>{r("Add To Cart"),o(!0)},children:f?"Add More":"Add To Cart"}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>{r("Buy Now"),o(!0)},style:{width:"100%"},children:"Buy"})]})},Ps="_wrapper_27wzz_1",ks="_logo_27wzz_8",Ts="_info_27wzz_12",K={wrapper:Ps,logo:ks,info:Ts},ws=({date:x})=>{const{general:o}=t.useGeneralStore();if(!o)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});function r(s){const a=new Date(s),e={month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return a.toLocaleDateString("en-US",e)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[t.jsxRuntimeExports.jsx("div",{className:K.logo,children:o.info.logo?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${o.info.logo.cfId}/w=500,h=500`,alt:"image",style:{objectFit:"contain",width:"48px",height:"48px"}}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:48,height:48})}),t.jsxRuntimeExports.jsxs("div",{className:K.info,children:[t.jsxRuntimeExports.jsx("h3",{id:"h4",children:o.info.name}),t.jsxRuntimeExports.jsx("p",{id:"p",children:r(x)})]})]})},Bs="_variants_18tbu_82",Ms="_variant_18tbu_82",$s="_stock_18tbu_100",Os="_variantInfo_18tbu_108",As="_title_18tbu_202",qs="_modal_18tbu_208",Ds="_header_18tbu_228",Ls="_productOptions_18tbu_236",Us="_loading_18tbu_244",Y={variants:Bs,variant:Ms,stock:$s,variantInfo:Os,title:As,modal:qs,header:Ds,productOptions:Ls,loading:Us},zs=x=>{var c;const{pageContext:o}=t.usePagesStore(),r=(c=o==null?void 0:o.listings)==null?void 0:c.find(l=>l.id===x.productId),[s,a]=j.useState(!0),[e,u]=j.useState(null),d=(e==null?void 0:e.variants[0])||null,[h,f]=j.useState("ONE_TIME"),{addProducts:P}=t.useCart(),{setIsOpen:R}=t.useModalStore();return j.useEffect(()=>{(async()=>{a(!0);const y=await t.getDynamicPage(encodeURIComponent(`/product/${r.productData.uniquePath}`));P(y==null?void 0:y.data.products),u(y==null?void 0:y.data.products[0]),a(!1)})()},[]),j.useEffect(()=>{R(!0)},[]),t.jsxRuntimeExports.jsx(t.Modal,{close:x.setIsOpen,children:t.jsxRuntimeExports.jsxs("div",{className:Y.modal,onClick:l=>l.stopPropagation(),children:[s&&t.jsxRuntimeExports.jsx("div",{className:Y.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})}),x.type==="Add To Cart"&&x.isCartEnabled&&e&&d&&!s&&t.jsxRuntimeExports.jsx(Fs,{variants:e.variants,activeVariant:d,activeChargeType:h,setActiveChargeType:f,productId:e.id,setIsOpen:x.setIsOpen}),x.type==="Buy Now"&&e&&!s&&t.jsxRuntimeExports.jsx(Hs,{product:e,setIsOpen:x.setIsOpen,isCartEnabled:x.isCartEnabled})]})})},Fs=x=>{const{variants:o,activeChargeType:r,productId:s,setIsOpen:a}=x,{cart:e,addProductToCart:u,addProducts:d,updateQuantityOfProduct:h}=t.useCart(),{notifications:f,setNotifications:P}=t.useNotificationStore(),{pageContext:R}=t.usePagesStore(),{setIsOpen:c}=t.useModalStore(),l=()=>{c(!1),setTimeout(()=>{a(!1)},300)};async function y(g){const p=o.find(C=>C.id===g),i=e.parts.find(C=>C.productId===x.productId&&C.productVariantId===g);if((p==null?void 0:p.quantity.available)&&(p==null?void 0:p.quantity.restrictions)&&((i==null?void 0:i.quantity)||0)+1>(p==null?void 0:p.quantity.restrictions.max)||(p==null?void 0:p.quantity.available)===0||(p==null?void 0:p.quantity.available)&&((i==null?void 0:i.quantity)||0)+1>(p==null?void 0:p.quantity.available)){P([...f,{id:t.v4(),message:"Product is out of stock",status:"error"}]);return}if(i)h({productId:s,productVariantId:g,quantity:i.quantity+1,chargeType:r});else{R!=null&&R.products&&d(R.products);try{u({productId:s,productVariantId:g,quantity:1,chargeType:r}),P([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(C){P([...f,{id:t.v4(),message:`Product failed to add to cart: ${C}`,status:"error"}])}}}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:Y.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",children:"Choose a Variant"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:l})]}),t.jsxRuntimeExports.jsx("div",{className:Y.variants,children:o.filter(g=>{var p;return(p=g.chargeTypes)==null?void 0:p.includes(r)}).map(g=>{var p,i,E;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(Y.variant),onClick:()=>{y(g.id),a(!1)},children:[t.jsxRuntimeExports.jsxs("div",{className:Y.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:Y.title,id:"h4",children:g.name}),t.jsxRuntimeExports.jsx("span",{id:"md",children:t.formatPrice({amount:r==="ONE_TIME"?g.price.amount:g.subscriptionSettings?g.subscriptionSettings.price.amount:0,currency:r==="ONE_TIME"?g.price.currency:((p=g.subscriptionSettings)==null?void 0:p.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:r==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:Y.stock,id:"md",children:[(i=g.quantity.restrictions)!=null&&i.max||g.quantity.available!==void 0?((E=g.quantity.restrictions)==null?void 0:E.max)||g.quantity.available:"∞"," ","in stock"]})})]},g.id)})})]})},Hs=x=>{const{product:o,setIsOpen:r,isCartEnabled:s}=x,{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{r(!1)},300)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:Y.header,children:[t.jsxRuntimeExports.jsxs("div",{id:"h3",className:Y.title,children:["Buy ",t.splitTextIntoSpans(o.name)]}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:e,style:{minWidth:24,minHeight:24}})]}),t.jsxRuntimeExports.jsx("div",{className:Y.productOptions,children:t.jsxRuntimeExports.jsx(nt,{product:o,setIsOpen:r,isCartEnabled:s})})]})},Vs="_contentModal_1ptti_1",Ys="_modalTop_1ptti_13",Gs="_loading_1ptti_19",Ws="_modalCards_1ptti_27",Xs="_modalImage_1ptti_32",Qs="_card_1ptti_37",Js="_cardInfo_1ptti_49",Ks="_cardButtons_1ptti_56",Zs="_title_1ptti_62",tn="_blockImage_1ptti_69",en="_short_1ptti_78",sn="_price_1ptti_82",nn="_oldPrice_1ptti_89",on="_newPrice_1ptti_98",D={contentModal:Vs,modalTop:Ys,loading:Gs,modalCards:Ws,modalImage:Xs,card:Qs,cardInfo:Js,cardButtons:Ks,title:Zs,blockImage:tn,short:en,price:sn,oldPrice:nn,newPrice:on},rn=x=>{const{setIsOpen:o,pageContext:r,groupData:s,setProductId:a,setIsProductModalOpen:e,setShowDropdown:u}=x,[d,h]=j.useState(null),[f,P]=j.useState(!0),{setIsOpen:R}=t.useModalStore();j.useEffect(()=>{var y;P(!0);const l=(y=r.listings)==null?void 0:y.filter(g=>s.listingIdList.includes(g.id));l&&h([...l]),P(!1)},[r]),j.useEffect(()=>{R(!0)},[]);const c=()=>{R(!1),setTimeout(()=>{o(!1)},300)};return t.jsxRuntimeExports.jsx(t.Modal,{close:()=>o(!1),children:t.jsxRuntimeExports.jsxs("div",{className:D.contentModal,onClick:l=>l.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:D.modalTop,children:[t.jsxRuntimeExports.jsx("span",{className:D.title,id:"h4",children:t.splitTextIntoSpans(s.name)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",hoverable:!0,onClick:c,fill:"var(--text-primary)"})]}),!f&&d&&t.jsxRuntimeExports.jsx("div",{className:D.modalCards,children:d.map(l=>t.jsxRuntimeExports.jsxs("div",{className:D.card,children:[t.jsxRuntimeExports.jsx("div",{children:l.productData.images[0]?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${l.productData.images[0].cfId}/w=500`,alt:"",width:64,height:64,className:D.modalImage}):t.jsxRuntimeExports.jsx("div",{className:t.clx(D.blockImage,D.modalImage),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image"})})}),t.jsxRuntimeExports.jsxs("div",{className:D.cardInfo,children:[t.jsxRuntimeExports.jsx("div",{className:D.name,id:"h5",children:l.productData.compareAtPrice&&(l.productData.compareAtPrice.amount||0)-(l.productData.minPrice.amount||0)>0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name),t.jsxRuntimeExports.jsxs("span",{className:D.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})}),t.jsxRuntimeExports.jsx("span",{className:D.oldPrice,id:"md",children:t.formatPrice({amount:l.productData.compareAtPrice.amount,currency:l.productData.compareAtPrice.currency})})]})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name),t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})})]})}),l.productData.shortDescription&&t.jsxRuntimeExports.jsx("span",{className:D.short,id:"md",children:t.splitTextIntoSpans(l.productData.shortDescription)})]}),t.jsxRuntimeExports.jsxs("div",{className:D.cardButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{a(l.id),o(!1),e(!0)},children:"Buy"}),t.jsxRuntimeExports.jsx(t.Link,{path:`/product/${l.productData.uniquePath}`,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",style:{whiteSpace:"nowrap"},onClick:()=>{u(!1),c()},children:"View Details"})})]})]},l.id))}),f&&t.jsxRuntimeExports.jsx("div",{className:D.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})})]})})};exports.AlignText=t.AlignText;exports.Button=t.Button$1;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.InputUI=t.Input$1;exports.ItemsSettings=t.ItemsSettings;exports.Link=t.Link;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.RadioUI=t.Radio;exports.RangeSelector=t.RangeSelector;exports.Select=t.Select;exports.SelectInfiniteList=t.SelectInfiniteList;exports.SelectTypeText=t.SelectTypeText;exports.SelectUI=t.Select$1;exports.Switch=t.Switch;exports.TextSettings=t.TextSettings;exports.TextareaSettings=t.Textarea;exports.TextareaUI=t.Textarea$1;exports.TypesText=t.TypesText;exports.Wrapper=t.Wrapper;exports.Accordion=Is;exports.BurgerMenuButton=ct;exports.ButtonTypeSettings=st;exports.ButtonsSettings=ne;exports.CategorySettings=Mt;exports.ChargeTypes=Z;exports.EmptyCart=rt;exports.FormSettings=Xt;exports.GroupCardModal=rn;exports.HeaderButtons=rs;exports.LayoutSettings=_t;exports.ListingSelector=oe;exports.MetaInfoPost=ws;exports.PagesMobileMenu=as;exports.PagesMobileModal=at;exports.PagesSettings=Gt;exports.ProductCardButtons=Cs;exports.ProductCardModal=zs;exports.ProductOptions=nt;exports.ShareLink=hs;exports.ShoppingButton=it;exports.ShoppingModalCart=ot;exports.UserInfo=tt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-B6gTSX8i.cjs"),j=require("react");require("react-dom");const lt="_block_kh9z8_8",dt="_title_kh9z8_16",ut="_subtitle_kh9z8_23",xt="_alignmentContent_kh9z8_30",pt="_alignments_kh9z8_39",mt="_alignment_kh9z8_30",jt="_circle_kh9z8_64",ht="_paddings_kh9z8_71",gt="_padding_kh9z8_71",ft="_active_kh9z8_97",F={block:lt,title:dt,subtitle:ut,alignmentContent:xt,alignments:pt,alignment:mt,circle:jt,paddings:ht,padding:gt,active:ft},yt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],Et=["left","top","right","bottom"],_t=x=>{const{alignment:o,padding:r,setPadding:s,setAlignment:a,isAlignment:e=!0,isPadding:u=!0}=x;function d(l){switch(l){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function h(l){switch(l){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}const[f,P]=j.useState(null),[R,c]=j.useState(null);return t.jsxRuntimeExports.jsxs("div",{className:F.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:F.title,children:"Layout (for Desktop version)"}),t.jsxRuntimeExports.jsxs("div",{className:F.alignmentContent,children:[e&&t.jsxRuntimeExports.jsxs("div",{className:F.block,children:[t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsx("div",{className:F.alignments,children:yt.map(l=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{a(l)},className:F.alignment,onMouseEnter:()=>{P(l)},onMouseLeave:()=>{P(null)},children:[l!==o&&f!==l&&t.jsxRuntimeExports.jsx("div",{className:F.circle}),l!==o&&f===l&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(f),fill:"#c2c2c2",width:22,height:22}),l===o&&t.jsxRuntimeExports.jsx(t.Icon,{name:d(o),fill:"#FF3F19",width:22,height:22})]},l))})]}),u&&t.jsxRuntimeExports.jsxs("div",{className:F.block,children:[t.jsxRuntimeExports.jsx("h5",{className:F.subtitle,children:"Paddings"}),t.jsxRuntimeExports.jsx("div",{className:F.paddings,children:Et.map(l=>t.jsxRuntimeExports.jsxs("label",{className:t.clx(F.padding,{[F.active]:R===l}),onFocus:()=>{c(l)},onBlur:()=>{c(null)},children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:h(l),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(r[l]),onChange:y=>s({...r,[l]:Math.min(Number(y),999)}),max:999,paddingless:!0,borderless:!0})]},l))})]})]})]})},Rt="_title_82zux_1",bt="_subtitle_82zux_5",vt="_productsBlock_82zux_14",It="_top_82zux_26",St="_products_82zux_14",Nt="_product_82zux_14",Ct="_button_82zux_80",Pt="_disabled_82zux_91",kt="_buttons_82zux_118",Tt="_addButton_82zux_157",wt="_deleteButton_82zux_179",H={title:Rt,subtitle:bt,productsBlock:vt,top:It,products:St,product:Nt,button:Ct,disabled:Pt,buttons:kt,addButton:Tt,deleteButton:wt};function Bt({id:x,children:o}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:u,isDragging:d}=t.useSortable({id:x}),h={transform:t.CSS.Transform.toString(e),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:a,style:h,className:`${H.product} ${d?H.dragging:""}`,...r,...s,children:o})}const Mt=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,other:e,tags:u,title:d,subtitle:h,draggable:f=!1,withImage:P=!1,addable:R=!0,itemsOptions:c,hasRangeSelector:l=!1,rangeSelectorOptions:y,limit:g,autoScrollInterval:p,deletable:i,aspectRatio:E,setAspectRatio:C}=x,M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}})),A=n=>{const{active:b,over:I}=n;if(I&&b.id!==I.id){const B=s.findIndex(v=>v===b.id),k=s.findIndex(v=>v===I.id);if(B!==-1&&k!==-1){const v=[...s],[_]=v.splice(B,1);v.splice(k,0,_),a(v)}}};function V(n){if(P)return n?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${n[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const L=(n,b=!1)=>{const I=c.find(k=>k.id===n);if(!I)return;const B=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const v=[...s],_=c.find(m=>m.name===k);if(!_)return;const $=_.id,U=v.map(m=>m===n?$:m);a([...U])},value:I.name,options:c.filter(k=>!s.find(v=>v===k.id)).map(k=>k.name),leftAddonOptions:c.map(k=>({value:k.name,addon:V(k.images)}))}),b&&t.jsxRuntimeExports.jsx("div",{className:H.buttons,children:t.jsxRuntimeExports.jsx("div",{className:H.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(k=>k!==n))})})})]});return f?t.jsxRuntimeExports.jsx(Bt,{id:n,children:B},t.v4()):t.jsxRuntimeExports.jsx("div",{className:H.product,children:B},t.v4())};return t.jsxRuntimeExports.jsxs("div",{className:H.productsBlock,children:[(d||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[d&&t.jsxRuntimeExports.jsx("h3",{className:H.title,children:d}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:n=>r==null?void 0:r(n)})]}),l&&y&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...y}),t.jsxRuntimeExports.jsxs("div",{className:H.products,children:[h&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:h}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:A,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s,strategy:t.verticalListSortingStrategy,children:s.map(n=>L(n,i))})}):s.map(n=>L(n,i)),R&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center",gap:5},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(H.button,{[H.disabled]:!!(g&&g<=s.length||s.length===c.length)}),size:"s",disabled:!!(g&&g<=s.length||s.length===c.length),onClick:()=>{const n=[...s];let b=null;if(c){for(let I=0;I<c.length;I++)if(!s.find(B=>B===c[I].id)){b=c[I];break}}n.push((b==null?void 0:b.id)||c[0].id),a(n)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:H.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),E&&C&&t.jsxRuntimeExports.jsx(t.Select,{value:E,label:"Aspect Ratio",options:Object.keys(t.aspectRatio),onChange:n=>C(n),leftAddonOptions:t.aspectRatioOptions}),u!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{tagsTitle:"Tags",items:u}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e}),p!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(p.scrollInterval),onChange:n=>p.setScrollInterval(Number(n)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},$t="_title_roi3a_1",Ot="_subtitle_roi3a_5",At="_productsBlock_roi3a_14",qt="_top_roi3a_26",Dt="_products_roi3a_14",Lt="_product_roi3a_14",Ut="_button_roi3a_80",zt="_disabled_roi3a_91",Ft="_buttons_roi3a_118",Ht="_addButton_roi3a_164",Vt="_deleteButton_roi3a_179",z={title:$t,subtitle:Ot,productsBlock:At,top:qt,products:Dt,product:Lt,button:Ut,disabled:zt,buttons:Ft,addButton:Ht,deleteButton:Vt};function Yt({product:x,children:o}){const{attributes:r,listeners:s,setNodeRef:a,transform:e,transition:u,isDragging:d}=t.useSortable({id:x.id}),h={transform:t.CSS.Transform.toString(e),transition:u};return t.jsxRuntimeExports.jsx("div",{ref:a,style:h,className:`${z.product} ${d?z.dragging:""}`,...r,...s,children:o})}const Gt=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,title:e,subtitle:u,editable:d=!0,draggable:h=!1,deletable:f=!0,addable:P=!0,itemsType:R,itemsOptions:c,addableOptions:l={},limit:y}=x,[g,p]=j.useState(null),[i,E]=j.useState(null),C=j.useRef(null),M=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{if(g){const n=[...s].map(b=>b.id===g.id?g:b);a(n)}},[g]),j.useEffect(()=>{C.current&&i&&(C.current.getBoundingClientRect().height,i.top)},[C.current,i]);const A=(n,b)=>{n.stopPropagation();const I=n.target.getBoundingClientRect();E({top:I.top+window.scrollY,left:I.left-30}),p(b)},V=n=>{const{active:b,over:I}=n;if(I&&b.id!==I.id){const B=s.findIndex(v=>v.id===b.id),k=s.findIndex(v=>v.id===I.id);if(B!==-1&&k!==-1){const v=[...s],[_]=v.splice(B,1);v.splice(k,0,_),a(v)}}},L=(n,b)=>{const I=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[h&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),R==="select"&&c&&t.jsxRuntimeExports.jsx(t.Select,{onChange:B=>{const k=[...s],v=c.find($=>$.name===B);if(!v)return;const _=k.map($=>$.id===n.id?{...v,name:{"en-US":B}}:$);p({...n,name:{"en-US":B}}),a([..._])},value:n.name,options:c.filter(B=>!s.find(k=>k.name===B.name)).map(B=>B.name)}),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[d&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:B=>A(B,n)})}),f&&t.jsxRuntimeExports.jsx("div",{className:z.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(B=>B.id!==n.id))})})]})]});return h?t.jsxRuntimeExports.jsx(Yt,{product:n,index:b,children:I},n.id):t.jsxRuntimeExports.jsx("div",{className:z.product,children:I},n.id)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(e||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:e}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:n=>r==null?void 0:r(n)})]}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[u&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:u}),h?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:M,onDragEnd:V,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(n=>n.id),strategy:t.verticalListSortingStrategy,children:s.map((n,b)=>L(n,b))})}):s.map((n,b)=>L(n,b)),P&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(z.button,{[z.disabled]:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length))}),size:"s",disabled:!!(y&&y<=s.length||s.length===(c==null?void 0:c.length)),onClick:()=>{const n=[...s];let b=null;if(c){for(let I=0;I<c.length;I++)if(!s.find(B=>B.id===c[I].id)){b=c[I];break}}R==="select"&&c&&n.push({name:b?b.name:c[0].name,id:(b==null?void 0:b.id)||c[0].id,...l}),a(n)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:z.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})]})};function Wt(x){const{product:o,children:r}=x,{attributes:s,listeners:a,setNodeRef:e,transform:u,transition:d,isDragging:h}=t.useSortable({id:o.id}),f={transform:t.CSS.Transform.toString(u),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles.product} ${h?t.styles.dragging:""}`,...s,...a,children:r})}const Xt=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,other:e,title:u,subtitle:d,editable:h=!0,draggable:f=!1,deletable:P=!0,addable:R=!0,itemsType:c,itemsPlaceholder:l="",itemsOptions:y,hasRangeSelector:g=!1,rangeSelectorOptions:p,modalOptions:i,addableOptions:E={},limit:C}=x,[M,A]=j.useState(null),[V,L]=j.useState({top:0,left:0}),[n,b]=j.useState(null),I=j.useRef(null),[B,k]=j.useState(!1),v=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{const m=()=>{A(null),k(!1)};return document.body.addEventListener("click",m),A(null),k(!1),()=>{A(null),k(!1),document.body.removeEventListener("click",m)}},[]),j.useEffect(()=>{if(M){const m=[...s].map(w=>w.id===M.id?M:w);a(m)}},[M]),j.useEffect(()=>{if(I.current&&n){const m=I.current.getBoundingClientRect().height,w=window.innerHeight;let S=n.top;S+m>w+window.scrollY-200&&(S=w+window.scrollY-m-200),S<0&&(S=10),L({top:S,left:n.left})}},[I.current,n]);const _=(m,w)=>{m.stopPropagation();const S=m.target.getBoundingClientRect();b({top:S.top+window.scrollY,left:S.left-30}),A(w),k(!0)},$=m=>{const{active:w,over:S}=m;if(S&&w.id!==S.id){const O=s.findIndex(q=>q.id===w.id),W=s.findIndex(q=>q.id===S.id);if(O!==-1&&W!==-1){const q=[...s],[G]=q.splice(O,1);q.splice(W,0,G),a(q)}}},U=m=>{var S;const w=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),c==="select"&&y&&t.jsxRuntimeExports.jsx(t.Select,{onChange:O=>{const q=[...s].map(G=>G.id===m.id?{...m,name:{"en-US":O}}:G);A({...m,name:{"en-US":O}}),a([...q])},value:m.name["en-US"],options:y.filter(O=>!s.find(W=>W.name["en-US"]===O))}),c==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:O=>{const q=[...s].map(G=>G.id===m.id?{...m,name:{"en-US":O}}:G);a([...q])},value:m.name["en-US"],placeholder:l}),c==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:O=>{const q=[...s].map(G=>G.id===m.id?{...m,images:O}:G);a([...q])},activeImage:(S=s.find(O=>O.id===m.id))==null?void 0:S.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.buttons,children:[h&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:O=>_(O,m)})}),P&&t.jsxRuntimeExports.jsx("div",{className:t.styles.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(O=>O.id!==m.id))})})]})]});return f?t.jsxRuntimeExports.jsx(Wt,{product:m,children:w},m.id):t.jsxRuntimeExports.jsx("div",{className:t.styles.product,children:w},m.id)};return t.jsxRuntimeExports.jsxs("div",{className:t.styles.productsBlock,children:[(u||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles.top,children:[u&&t.jsxRuntimeExports.jsx("h3",{className:t.styles.title,children:u}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:m=>r==null?void 0:r(m)})]}),M&&h&&i&&B&&t.jsxRuntimeExports.jsx(t.ItemPopup,{ref:I,activeItem:M,setActiveItem:A,popupPosition:V,modalOptions:i,setIsOpenModal:k}),g&&p&&t.jsxRuntimeExports.jsx(t.RangeSelector,{...p}),t.jsxRuntimeExports.jsxs("div",{className:t.styles.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:v,onDragEnd:$,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(m=>m.id),strategy:t.verticalListSortingStrategy,children:s.map(m=>U(m))})}):s.map(m=>U(m)),R&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.clx(t.styles.button,{[t.styles.disabled]:!!(C&&C<=s.length)}),size:"s",disabled:!!(C&&C<=s.length),onClick:()=>{const m=[...s];let w=null;if(y){for(let S=0;S<y.length;S++)if(!s.find(O=>O.name["en-US"]===y[S])){w=y[S];break}}c==="select"&&y?m.push({name:{"en-US":w||y[0]},id:t.v4(),...E,maxSymbols:100}):c==="input"?m.push({name:{"en-US":""},id:t.v4(),...E,maxSymbols:100}):m.push({name:{"en-US":`Image ${s.length+1}`},id:t.v4(),...E,maxSymbols:100}),a(m)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},Qt="_subtitle_jql1y_1",Jt="_products_jql1y_10",Kt="_product_jql1y_10",Zt="_button_jql1y_11",te="_buttons_jql1y_11",ee="_addButton_jql1y_150",se="_deleteButton_jql1y_165",X={subtitle:Qt,products:Jt,product:Kt,button:Zt,buttons:te,addButton:ee,deleteButton:se},st=x=>{const{buttons:o,setButtons:r,deletable:s=!0,addable:a=!0,editableLink:e=!0}=x,{pages:u}=t.usePagesStore(),[d,h]=j.useState(null),[f,P]=j.useState({top:0,left:0}),[R,c]=j.useState(null),l=j.useRef(null);j.useEffect(()=>{if(d){const p=[...o].map(i=>i.id===d.id?d:i);r(p)}},[d]),j.useEffect(()=>{if(l.current&&R){const p=l.current.getBoundingClientRect().height,i=window.innerHeight;let E=R.top;E+p>i+window.scrollY-200&&(E=i+window.scrollY-p-200),E<0&&(E=10),P({top:E,left:R.left})}},[l.current,R]);const y=(p,i)=>{p.stopPropagation();const E=p.target.getBoundingClientRect();c({top:E.top+window.scrollY-70,left:E.left-(a?30:65)}),h(i)},g=(p,i)=>{const E=[...o],C={...p,id:Math.random().toString(36).substr(2,9)};E.splice(i+1,0,C),r(E)};return t.jsxRuntimeExports.jsxs("div",{className:X.products,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Button Type"}),o.map((p,i)=>t.jsxRuntimeExports.jsxs("div",{className:X.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const M=[...o].map(A=>A.id===p.id?{...p,type:E}:A);r(M)},value:p.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:X.buttons,children:[t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{g(p,i)}})}),t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>{y(E,p)}})}),s&&t.jsxRuntimeExports.jsx("div",{className:X.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const E=o.filter(C=>C.id!==p.id);r(E)},width:20,height:20,fill:"#C12A2A"})})]})]},p.id)),d&&t.jsxRuntimeExports.jsx(t.ButtonPopup,{ref:l,activeButton:d,setActiveButton:h,popupPosition:f,editableLink:e}),a&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:X.button,size:"s",onClick:()=>{const p=[...o];e?p.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Button Name"},destination:"Go to Page",page:u?Object.values(u)[0].path:"/",openInNewTab:!1}):p.push({type:"Primary",id:t.v4(),typesText:[],text:{"en-US":"Create Ticket"},destination:"Go to Page",page:u?Object.values(u)[0].path:"/",openInNewTab:!1}),r(p)},style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:X.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]})},ne=x=>{const{isActiveButtons:o,setIsActiveButtons:r,buttons:s,setButtons:a,editableLink:e=!0,addable:u=!0,deletable:d=!0}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:t.styles$1.top,children:[t.jsxRuntimeExports.jsx("h3",{className:t.styles$1.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:h=>r(h)})]}),o&&t.jsxRuntimeExports.jsx(st,{buttons:s,setButtons:a,editableLink:e,addable:u,deletable:d})]})})};function ie(x){const{product:o,children:r}=x,{attributes:s,listeners:a,setNodeRef:e,transform:u,transition:d,isDragging:h}=t.useSortable({id:String(o.listingId)}),f={transform:t.CSS.Transform.toString(u),transition:d};return t.jsxRuntimeExports.jsx("div",{ref:e,style:f,className:`${t.styles$2.product} ${h?t.styles$2.dragging:""}`,...s,...a,children:r})}const oe=x=>{const{isActiveItems:o,setIsActiveItems:r,items:s,setItems:a,other:e,title:u,subtitle:d,editable:h=!0,draggable:f=!1,withImage:P=!1,deletable:R=!0,addable:c=!0,itemsType:l,itemsOptions:y,limit:g,aspectRatio:p,setAspectRatio:i}=x,[E,C]=j.useState(null),[M,A]=j.useState({top:0,left:0}),[V,L]=j.useState(!1),n=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:5}}));j.useEffect(()=>{const _=()=>{C(null),L(!1)};return document.body.addEventListener("click",_),C(null),L(!1),()=>{C(null),L(!1),document.body.removeEventListener("click",_)}},[]),j.useEffect(()=>{if(E){const _=[...s].map($=>$.listingId===E.listingId?E:$);a(_)}},[E]);const b=(_,$)=>{_.stopPropagation();const U=_.target.getBoundingClientRect(),m=100,w=window.innerHeight;let S=U.top+window.scrollY;S+m>w&&(S=w-m-20),L(!0),A({top:S-80,left:U.left-30}),C($)};function I(_){if(P)return _?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${_}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const B=_=>{const{active:$,over:U}=_;if(U&&$.id!==U.id){const m=s.findIndex(S=>String(S.listingId)===$.id),w=s.findIndex(S=>String(S.listingId)===U.id);if(m!==-1&&w!==-1){const S=[...s],[O]=S.splice(m,1);S.splice(w,0,O),a(S)}}},k=_=>{const $=y.find(m=>_.listingId===m.id);if(!$)return null;const U=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),l==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:m=>{const w=[...s],S=y.find(q=>q.productData.name===m);if(!S)return;const O={listingId:S.id,image:S.productData.images.length>0?S.productData.images[0].cfId:""},W=w.map(q=>q.listingId===_.listingId?O:q);C(O),a([...W])},value:$.productData.name,options:[...y.filter(m=>!s.find(w=>w.listingId===m.id)).map(m=>m.productData.name)],leftAddonOptions:y.map(m=>{var w;return{value:m.productData.name,addon:I(((w=m.productData.images[0])==null?void 0:w.cfId)||"")}})}),t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.buttons,children:[h&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:m=>b(m,_)})}),R&&t.jsxRuntimeExports.jsx("div",{className:t.styles$2.deleteButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(s.filter(m=>m!==_))})})]})]});return f?t.jsxRuntimeExports.jsx(ie,{product:_,children:U},_.listingId):t.jsxRuntimeExports.jsx("div",{className:t.styles$2.product,children:U},_.listingId)},v=j.useRef(null);return t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.productsBlock,children:[(u||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.top,children:[u&&t.jsxRuntimeExports.jsx("h3",{className:t.styles$2.title,children:u}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:_=>r==null?void 0:r(_)})]}),V&&E&&t.jsxRuntimeExports.jsx(t.ListingPopup,{ref:v,activeItem:E,setActiveItem:C,setIsOpenModal:L,popupPosition:M,itemsOptions:y}),o&&t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.products,children:[d&&t.jsxRuntimeExports.jsx("h5",{className:t.styles$2.subtitle,children:d}),f?t.jsxRuntimeExports.jsx(t.DndContext,{sensors:n,onDragEnd:B,children:t.jsxRuntimeExports.jsx(t.SortableContext,{items:s.map(_=>String(_.listingId)),strategy:t.verticalListSortingStrategy,children:s.map(_=>k(_))})}):s.map(_=>k(_)),c&&t.jsxRuntimeExports.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:t.jsxRuntimeExports.jsx(t.Button,{withoutHover:!0,className:t.styles$2.button,size:"s",onClick:()=>{const _=[...s];for(let $=0;$<y.length;$++)if(!s.find(U=>U.listingId===y[$].id)){_.push({listingId:y[$].id,image:y[$].productData.images.length>0?y[$].productData.images[0].cfId:""});break}a(_)},disabled:s.length===(g||y.length),style:{width:"fit-content"},children:t.jsxRuntimeExports.jsxs("div",{className:t.styles$2.addButton,children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})})]}),p&&i&&t.jsxRuntimeExports.jsx(t.Select,{value:p,options:Object.keys(t.aspectRatio),onChange:_=>i(_),leftAddonOptions:t.aspectRatioOptions}),o&&e!==void 0&&t.jsxRuntimeExports.jsx(t.OtherAndTagsSettings,{otherTitle:"Other",items:e})]})},re="_options_s4lx3_1",ae="_price_s4lx3_18",ce="_oldPrice_s4lx3_25",le="_newPrice_s4lx3_34",de="_animate_s4lx3_42",ue="_meta_s4lx3_60",xe="_info_s4lx3_66",pe="_infoRight_s4lx3_75",me="_buttons_s4lx3_82",je="_variants_s4lx3_89",he="_variant_s4lx3_89",ge="_stock_s4lx3_107",fe="_variantInfo_s4lx3_115",ye="_quantity_s4lx3_122",Ee="_button_s4lx3_82",_e="_activeVariant_s4lx3_168",Re="_chargeTypes_s4lx3_172",be="_charge_s4lx3_172",ve="_chargeActive_s4lx3_197",Ie="_title_s4lx3_205",T={options:re,price:ae,oldPrice:ce,newPrice:le,animate:de,meta:ue,info:xe,infoRight:pe,buttons:me,variants:je,variant:he,stock:ge,variantInfo:fe,quantity:ye,button:Ee,activeVariant:_e,chargeTypes:Re,charge:be,chargeActive:ve,title:Ie};var Z=(x=>(x.ONE_TIME="One-Time",x.RECURRING="Subscribe & Save",x))(Z||{});const nt=x=>{var V,L;const{product:o,setIsOpen:r,isCartEnabled:s=!0}=x,{variants:a}=o,[e,u]=j.useState(a[0]),[d,h]=j.useState(e.chargeTypes?e.chargeTypes[0]:"ONE_TIME"),{notifications:f,setNotifications:P}=t.useNotificationStore(),R=t.useNavigate(),[c,l]=j.useState(1),{cart:y,reset:g,addProductToCart:p}=t.useCart(),[i,E]=j.useState(!1);j.useEffect(()=>{E(!0);const n=setTimeout(()=>E(!1),600);return()=>clearTimeout(n)},[c]);async function C(){try{p({productId:o.id,productVariantId:e.id,chargeType:d,quantity:c}),P([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(n){P([...f,{id:t.v4(),message:`Product failed to add to cart: ${n}`,status:"error"}])}r==null||r(!1)}function M(){g(),C(),R("/checkout")}function A(n){if(n>=864e5){const v=Math.floor(n/864e5);return`${v} ${v===1?"day":"days"}`}else if(n>=36e5){const v=Math.floor(n/36e5);return`${v} ${v===1?"hour":"hours"}`}else if(n>=6e4){const v=Math.floor(n/6e4);return`${v} ${v===1?"minute":"minutes"}`}else{const v=Math.floor(n/1e3);return`${v} ${v===1?"second":"seconds"}`}}return j.useEffect(()=>{e.quantity&&e.quantity.available===0?l(0):l(1)},[e.quantity.available]),j.useEffect(()=>{e.chargeTypes&&h(e.chargeTypes.includes(d)?d:e.chargeTypes[0])},[e.chargeTypes]),t.jsxRuntimeExports.jsxs("div",{className:T.options,children:[e.chargeTypes&&e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:T.chargeTypes,children:e.chargeTypes.map(n=>t.jsxRuntimeExports.jsx("div",{className:t.clx(T.charge,{[T.chargeActive]:d===n}),onClick:()=>h(n),children:Z[n]},n))}),t.jsxRuntimeExports.jsx("div",{className:T.variants,children:a.filter(n=>{var b;return(b=n.chargeTypes)==null?void 0:b.includes(d)}).map(n=>{var b,I;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(T.variant,{[T.activeVariant]:e.id===n.id}),onClick:()=>{u(n),l(1)},children:[t.jsxRuntimeExports.jsxs("div",{className:T.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:T.title,id:"h4",children:t.splitTextIntoSpans(n.name)}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:[t.formatPrice({amount:d==="ONE_TIME"?n.price.amount:n.subscriptionSettings?n.subscriptionSettings.price.amount:0,currency:d==="ONE_TIME"?n.price.currency:n.subscriptionSettings?n.subscriptionSettings.price.currency:"USD"})," ",d==="RECURRING"&&n.subscriptionSettings&&` / ${t.normalizeInterval(n.subscriptionSettings.recurringIntervalDays||0)}`]})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:T.stock,id:"md",children:[(b=n.quantity.restrictions)!=null&&b.max||n.quantity.available!==void 0?((I=n.quantity.restrictions)==null?void 0:I.max)||n.quantity.available:"∞"," ","in stock"]})})]},n.id)})}),d==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:T.quantity,id:"md",children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{c>1?l(n=>n-1):l(1)},className:T.button,disabled:e.quantity.available&&e.quantity.restrictions&&c<=e.quantity.restrictions.min||e.quantity.available===0,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx(t.Input$1,{type:"number",value:String(c),onChange:n=>{e.quantity.available&&Number(n)>e.quantity.available?l(e.quantity.available):l(Number(n))},max:((V=e.quantity.restrictions)==null?void 0:V.max)||e.quantity.available||Number.POSITIVE_INFINITY,min:((L=e.quantity.restrictions)==null?void 0:L.min)||0,centered:!0,disabled:e.quantity&&e.quantity.available===0||Object.keys(e.quantity.restrictions||{}).length!==0&&c>=e.quantity.restrictions.max}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{l(n=>n+1)},className:T.button,disabled:!!(e.quantity.available&&e.quantity.restrictions&&c>=e.quantity.restrictions.max||e.quantity.available===0||e.quantity.available&&c>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:T.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:T.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:T.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"var(--text-action)",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{id:"md",children:!e.deliveryTime||e.deliveryTime===0?"Instant":A(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:T.info,children:[t.jsxRuntimeExports.jsx("span",{id:"md",children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:T.infoRight,children:d==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:T.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:T.oldPrice,id:"md",children:t.formatPrice({amount:e.compareAtPrice.amount*c,currency:e.compareAtPrice.currency})})]}):t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),id:"md",children:t.formatPrice({amount:e.price.amount*c,currency:e.price.currency})}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:T.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})}),t.jsxRuntimeExports.jsx("span",{className:T.oldPrice,id:"md",children:t.formatPrice({amount:e.subscriptionSettings.compareAtPrice.amount*c,currency:e.subscriptionSettings.compareAtPrice.currency})})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsx("span",{className:t.clx(T.newPrice,{[T.animate]:i}),id:"md",children:t.formatPrice({amount:e.subscriptionSettings.price.amount*c,currency:e.subscriptionSettings.price.currency})})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:T.buttons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>M(),disabled:e.quantity&&e.quantity.available===0,children:d==="ONE_TIME"?"Buy Now":"Subscribe Now"}),d==="ONE_TIME"&&s&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>C(),disabled:e.quantity&&e.quantity.available===0,children:y.parts.some(n=>n.productId===o.id&&n.productVariantId===e.id)?"Add More":"Add to Cart"})]})]})},Se="_buttons_1uy6y_23",Ne="_modal_1uy6y_32",Ce="_closing_1uy6y_65",Pe="_info_1uy6y_114",ke="_top_1uy6y_121",Te="_title_1uy6y_132",we="_clear_1uy6y_139",Be="_activeClear_1uy6y_146",Me="_count_1uy6y_150",$e="_cart_1uy6y_165",Oe="_empty_1uy6y_173",Ae="_product_1uy6y_199",qe="_products_1uy6y_208",De="_image_1uy6y_216",Le="_productInfo_1uy6y_233",Ue="_content_1uy6y_240",ze="_name_1uy6y_246",Fe="_price_1uy6y_252",He="_productButtons_1uy6y_258",Ve="_productButton_1uy6y_258",Ye="_productCount_1uy6y_275",Ge="_bottom_1uy6y_292",We="_subtotal_1uy6y_300",Xe="_block_1uy6y_308",Qe="_shoppingCount_1uy6y_315",Je="_total_1uy6y_335",Ke="_link_1uy6y_341",Ze="_userInfo_1uy6y_348",ts="_pagesMobileModal_1uy6y_360",es="_pagesMobileModalContent_1uy6y_374",ss="_pagesMobileModalHeader_1uy6y_380",ns="_pagesMobileModalFooter_1uy6y_390",is="_pageLink_1uy6y_397",os="_rightButtons_1uy6y_406",N={buttons:Se,modal:Ne,closing:Ce,info:Pe,top:ke,title:Te,clear:we,activeClear:Be,count:Me,cart:$e,empty:Oe,product:Ae,products:qe,image:De,productInfo:Le,content:Ue,name:ze,price:Fe,productButtons:He,productButton:Ve,productCount:Ye,bottom:Ge,subtotal:We,block:Xe,shoppingCount:Qe,total:Je,link:Ke,userInfo:Ze,pagesMobileModal:ts,pagesMobileModalContent:es,pagesMobileModalHeader:ss,pagesMobileModalFooter:ns,pageLink:is,rightButtons:os,delete:"_delete_1uy6y_413"},rs=x=>{const{shopping:o,signUp:r,isShowUserInfo:s=!0}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:(o||s)&&t.jsxRuntimeExports.jsxs("div",{className:N.buttons,children:[o&&t.jsxRuntimeExports.jsx(it,{}),s&&t.jsxRuntimeExports.jsx(tt,{signUp:r})]})})},it=()=>{const[x,o]=j.useState(!1),[r,s]=j.useState([]),[a,e]=j.useState(!1),{cart:u,products:d}=t.useCart();j.useEffect(()=>{(async()=>{const c=u.parts.map(g=>String(g.productId)),l=d.filter(g=>c.includes(String(g.id)))||[],y=u.parts.map(g=>{const p=l.find(i=>i.id===g.productId);return p?{...p,activeVariantId:g.productVariantId,quantity:g.quantity,chargeType:g.chargeType}:null}).filter(Boolean);s(y)})()},[u.parts,d]);function h(R){return!R||!(R!=null&&R.variants)?!1:R.chargeType==="RECURRING"}const f=u.parts.length>0&&r.length>0&&!h(r[0]);function P(){e(!1),setTimeout(()=>{o(!1)},300)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",style:{padding:10,position:"relative"},onClick:R=>{R.stopPropagation(),window.location.pathname.includes("/admin/builder")||(o(!0),e(!0))},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"}),f&&t.jsxRuntimeExports.jsx("div",{className:N.shoppingCount,children:u.parts.length})]}),x&&t.jsxRuntimeExports.jsx(t.Modal,{close:P,withAnimation:!1,children:t.jsxRuntimeExports.jsx(ot,{activeProducts:r,isCartNotEmpty:f,isOpen:a,close:P})})]})},ot=x=>{var g,p;const{activeProducts:o,isCartNotEmpty:r,isOpen:s,close:a}=x,{cart:e,reset:u,getTotalAndDiscount:d,updateQuantityOfProduct:h,removeProduct:f}=t.useCart(),P=t.useNavigate();function R(i,E){P(i,{replace:E})}function c(i){i.quantity&&h({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity+1,chargeType:i.chargeType})}function l(i){i.quantity&&h({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity-1,chargeType:i.chargeType})}function y(i){f({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity||1,chargeType:i.chargeType})}return t.jsxRuntimeExports.jsxs("div",{className:t.clx(N.modal,{[N.closing]:!s}),onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:N.top,children:[t.jsxRuntimeExports.jsxs("div",{className:N.info,children:[t.jsxRuntimeExports.jsx("span",{className:N.title,id:"h4",children:"Cart"}),r&&t.jsxRuntimeExports.jsx("div",{className:N.count,id:"md",children:e.parts.length})]}),t.jsxRuntimeExports.jsxs("div",{className:N.rightButtons,children:[r&&t.jsxRuntimeExports.jsx("button",{className:t.clx(N.clear,{[N.activeClear]:r}),disabled:!r,onClick:u,id:"md",children:"Clear all"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",onClick:a,hoverable:!0,width:24,height:24,fill:"var(--text-primary)"})]})]}),r?t.jsxRuntimeExports.jsxs("div",{className:N.cart,children:[t.jsxRuntimeExports.jsx("div",{className:N.products,children:o.map(i=>{var E,C;return t.jsxRuntimeExports.jsxs("div",{className:N.product,children:[t.jsxRuntimeExports.jsxs("div",{className:N.productInfo,children:[i.images.length>0?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:N.image}):t.jsxRuntimeExports.jsx("div",{className:N.image,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsxs("div",{className:N.content,children:[t.jsxRuntimeExports.jsx("div",{className:N.name,children:t.splitTextIntoSpans(((E=i.variants.find(M=>M.id===i.activeVariantId))==null?void 0:E.name)||i.name)}),t.jsxRuntimeExports.jsx("div",{className:N.price,children:t.formatPrice({amount:i.variants.find(M=>M.id===i.activeVariantId).price.amount*((i==null?void 0:i.quantity)||1),currency:i.variants.find(M=>M.id===i.activeVariantId).price.currency})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:N.productButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{i.quantity!==1&&l(i)},className:N.productButton,disabled:i.quantity===1,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("input",{className:N.productCount,type:"number",value:((C=i.quantity)==null?void 0:C.toString())||"",onChange:M=>{const A=Math.min(Number(M.target.value),i.variants.find(V=>V.id===i.activeVariantId).quantity.available||1/0);A<1||h({productId:i.id,productVariantId:i.activeVariantId,quantity:A,chargeType:i.chargeType})},min:1,max:i.variants.find(M=>M.id===i.activeVariantId).quantity.available||1/0}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>c(i),className:N.productButton,disabled:i.quantity===i.variants.find(M=>M.id===i.activeVariantId).quantity.available,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:N.delete,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",fill:"var(--text-action)",width:20,height:20,onClick:()=>y(i),hoverable:!0})})]})]},i.id)})}),t.jsxRuntimeExports.jsxs("div",{className:N.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:N.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:N.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsx("div",{className:N.total,children:t.formatPrice({amount:d().total,currency:e.parts.length>0&&((p=(g=o.find(i=>i.id===e.parts[0].productId))==null?void 0:g.variants.find(i=>i.id===e.parts[0].productVariantId))==null?void 0:p.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>R("/checkout",!1),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(rt,{})]})},rt=()=>t.jsxRuntimeExports.jsxs("div",{className:N.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--text-secondary)"})}),t.jsxRuntimeExports.jsx("span",{id:"h5",children:"Empty Cart"}),t.jsxRuntimeExports.jsxs("span",{id:"md",children:["You don’t have any items in your shopping cart yet,"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:N.link,id:"md",children:"view products"})]})]}),tt=({signUp:x,close:o})=>{const{token:r}=t.useStorefrontStore(),s=t.useNavigate(),[a,e]=j.useState("test-email@gmail.com");j.useEffect(()=>{r&&(async()=>{if(!r)return;const h=t.jwtDecode(r);e(h.email)})()},[r]);function u(d){window.location.pathname.includes("/admin/builder")||s(d)}return r?t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",className:N.userInfo,onClick:()=>{u("/customer-dash"),o==null||o()},children:t.jsxRuntimeExports.jsx("div",{children:a||"test-email@gmail.com"})}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{u("/customer-dash"),o==null||o()},type:"Secondary",style:{padding:10},children:"Login"}),x&&t.jsxRuntimeExports.jsx(t.Button$1,{onClick:()=>{u("/customer-dash"),o==null||o()},type:"Primary",style:{padding:10,whiteSpace:"nowrap"},children:"Sign Up"})]})},at=({logo:x,setIsOpen:o,signUp:r,pages:s})=>{const{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{o(!1),a(!0)},300)};return t.jsxRuntimeExports.jsxs("div",{className:N.pagesMobileModal,onClick:u=>u.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:N.pagesMobileModalHeader,children:[t.jsxRuntimeExports.jsx("div",{children:x}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:e,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"X"})})]}),t.jsxRuntimeExports.jsx("div",{className:N.pagesMobileModalContent,children:s.length>0&&s.map(u=>t.jsxRuntimeExports.jsx("div",{className:N.pageLink,onClick:e,children:t.jsxRuntimeExports.jsx(t.Link,{path:u.path,children:u.name["en-US"]},u.id)}))}),t.jsxRuntimeExports.jsx("div",{className:N.pagesMobileModalFooter,children:t.jsxRuntimeExports.jsx(tt,{signUp:r,close:e})})]})},as=({logo:x,signUp:o,pages:r})=>{const[s,a]=j.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(ct,{setIsOpenModal:a}),s&&t.jsxRuntimeExports.jsx(t.Modal,{close:()=>a(!1),hasPadding:!1,children:t.jsxRuntimeExports.jsx(at,{logo:x,setIsOpen:a,signUp:o,pages:r})})]})},ct=x=>{const{setIsOpenModal:o}=x;return t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{padding:10},onClick:r=>{r.stopPropagation(),window.location.pathname.includes("/admin/builder")||o(!0)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:"List"})})},cs="_share_onabp_1",ls="_modal_onabp_8",ds="_header_onabp_20",us="_title_onabp_46",xs="_copyWrapper_onabp_53",ps="_copyText_onabp_62",ms="_copyTextMobile_onabp_75",js="_copyTextMiniMobile_onabp_94",Q={share:cs,modal:ls,header:ds,title:us,copyWrapper:xs,copyText:ps,copyTextMobile:ms,copyTextMiniMobile:js},hs=({title:x="Copy Product Link"})=>{const{isOpenModal:o,setIsOpenModal:r}=t.useShareLinkStore();function s(){r(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button$1,{className:Q.share,onClick:a=>{a.stopPropagation(),s()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),o&&t.jsxRuntimeExports.jsx(t.Modal,{close:r,children:t.jsxRuntimeExports.jsx(gs,{title:x})})]})},gs=({title:x="Copy Product Link"})=>{const{setIsOpenModal:o}=t.useShareLinkStore(),{notifications:r,setNotifications:s}=t.useNotificationStore(),{setIsOpen:a}=t.useModalStore(),e=window.location.href;function u(){navigator.clipboard.writeText(e),s([...r,{id:t.v4(),message:"Link copied to clipboard",status:"success"}])}function d(){a(!1),setTimeout(()=>{o(!1),a(!0)},300)}function h(f,P){return f.length>P?f.slice(0,P)+"...":f}return t.jsxRuntimeExports.jsxs("div",{className:Q.modal,onClick:f=>f.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:Q.header,children:[t.jsxRuntimeExports.jsx("div",{className:Q.title,id:"h4",children:x}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:d,hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:Q.copyWrapper,children:[t.jsxRuntimeExports.jsxs(t.Button$1,{type:"Secondary",onClick:u,style:{flex:1},children:[t.jsxRuntimeExports.jsx("div",{className:Q.copyText,id:"md",children:h(e,100)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMobile,id:"md",children:h(e,40)}),t.jsxRuntimeExports.jsx("div",{className:Q.copyTextMiniMobile,id:"md",children:h(e,20)})]}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:u,children:r.find(f=>f.message==="Link copied to clipboard")?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},fs="_accordion_153d4_1",ys="_header_153d4_12",Es="_icon_153d4_21",_s="_open_153d4_24",Rs="_content_153d4_28",bs="_contentOpen_153d4_36",vs="_contentText_153d4_40",J={accordion:fs,header:ys,icon:Es,open:_s,content:Rs,contentOpen:bs,contentText:vs},Is=({title:x,content:o,defaultOpen:r=!1})=>{const[s,a]=j.useState(r),[e,u]=j.useState(0),d=j.useRef(null),h=()=>{a(!s)};return j.useEffect(()=>{d.current&&u(s?d.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:J.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:J.header,onClick:h,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:x}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.icon,{[J.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{className:t.clx(J.content,{[J.contentOpen]:s}),children:t.jsxRuntimeExports.jsx("p",{id:"md",className:J.contentText,ref:d,style:{height:`${e}px`,marginTop:`${e>0?"20px":"0px"}`},children:o})})]})},Ss="_buttonsBlock_1x6xf_1",Ns="_cartDisabled_1x6xf_25",et={buttonsBlock:Ss,cartDisabled:Ns},Cs=x=>{var P,R;const{setIsOpen:o,setModalType:r,productId:s,isCartEnabled:a=!0}=x,{cart:e}=t.useCart(),{pageContext:u}=t.usePagesStore(),d=(P=u==null?void 0:u.listings)==null?void 0:P.find(c=>c.id===s);if(!d)return null;const h=(R=u==null?void 0:u.products)==null?void 0:R.find(c=>c.uniquePath===d.productData.uniquePath);if(!h)return null;const f=e.parts.find(c=>c.productId===h.id);return t.jsxRuntimeExports.jsxs("div",{className:t.clx(et.buttonsBlock,{[et.cartDisabled]:!a}),onClick:c=>c.stopPropagation(),children:[a&&t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",style:{width:"100%"},onClick:()=>{r("Add To Cart"),o(!0)},children:f?"Add More":"Add To Cart"}),t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",onClick:()=>{r("Buy Now"),o(!0)},style:{width:"100%"},children:"Buy"})]})},Ps="_wrapper_27wzz_1",ks="_logo_27wzz_8",Ts="_info_27wzz_12",K={wrapper:Ps,logo:ks,info:Ts},ws=({date:x})=>{const{general:o}=t.useGeneralStore();if(!o)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});function r(s){const a=new Date(s),e={month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return a.toLocaleDateString("en-US",e)}return t.jsxRuntimeExports.jsxs("div",{className:K.wrapper,children:[t.jsxRuntimeExports.jsx("div",{className:K.logo,children:o.info.logo?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${o.info.logo.cfId}/w=500,h=500`,alt:"image",style:{objectFit:"contain",width:"48px",height:"48px"}}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:48,height:48})}),t.jsxRuntimeExports.jsxs("div",{className:K.info,children:[t.jsxRuntimeExports.jsx("h3",{id:"h4",children:o.info.name}),t.jsxRuntimeExports.jsx("p",{id:"p",children:r(x)})]})]})},Bs="_variants_18tbu_82",Ms="_variant_18tbu_82",$s="_stock_18tbu_100",Os="_variantInfo_18tbu_108",As="_title_18tbu_202",qs="_modal_18tbu_208",Ds="_header_18tbu_228",Ls="_productOptions_18tbu_236",Us="_loading_18tbu_244",Y={variants:Bs,variant:Ms,stock:$s,variantInfo:Os,title:As,modal:qs,header:Ds,productOptions:Ls,loading:Us},zs=x=>{var c;const{pageContext:o}=t.usePagesStore(),r=(c=o==null?void 0:o.listings)==null?void 0:c.find(l=>l.id===x.productId),[s,a]=j.useState(!0),[e,u]=j.useState(null),d=(e==null?void 0:e.variants[0])||null,[h,f]=j.useState("ONE_TIME"),{addProducts:P}=t.useCart(),{setIsOpen:R}=t.useModalStore();return j.useEffect(()=>{(async()=>{a(!0);const y=await t.getDynamicPage(encodeURIComponent(`/product/${r.productData.uniquePath}`));P(y==null?void 0:y.data.products),u(y==null?void 0:y.data.products[0]),a(!1)})()},[]),j.useEffect(()=>{R(!0)},[]),t.jsxRuntimeExports.jsx(t.Modal,{close:x.setIsOpen,children:t.jsxRuntimeExports.jsxs("div",{className:Y.modal,onClick:l=>l.stopPropagation(),children:[s&&t.jsxRuntimeExports.jsx("div",{className:Y.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})}),x.type==="Add To Cart"&&x.isCartEnabled&&e&&d&&!s&&t.jsxRuntimeExports.jsx(Fs,{variants:e.variants,activeVariant:d,activeChargeType:h,setActiveChargeType:f,productId:e.id,setIsOpen:x.setIsOpen}),x.type==="Buy Now"&&e&&!s&&t.jsxRuntimeExports.jsx(Hs,{product:e,setIsOpen:x.setIsOpen,isCartEnabled:x.isCartEnabled})]})})},Fs=x=>{const{variants:o,activeChargeType:r,productId:s,setIsOpen:a}=x,{cart:e,addProductToCart:u,addProducts:d,updateQuantityOfProduct:h}=t.useCart(),{notifications:f,setNotifications:P}=t.useNotificationStore(),{pageContext:R}=t.usePagesStore(),{setIsOpen:c}=t.useModalStore(),l=()=>{c(!1),setTimeout(()=>{a(!1)},300)};async function y(g){const p=o.find(C=>C.id===g),i=e.parts.find(C=>C.productId===x.productId&&C.productVariantId===g);if((p==null?void 0:p.quantity.available)&&(p==null?void 0:p.quantity.restrictions)&&((i==null?void 0:i.quantity)||0)+1>(p==null?void 0:p.quantity.restrictions.max)||(p==null?void 0:p.quantity.available)===0||(p==null?void 0:p.quantity.available)&&((i==null?void 0:i.quantity)||0)+1>(p==null?void 0:p.quantity.available)){P([...f,{id:t.v4(),message:"Product is out of stock",status:"error"}]);return}if(i)h({productId:s,productVariantId:g,quantity:i.quantity+1,chargeType:r});else{R!=null&&R.products&&d(R.products);try{u({productId:s,productVariantId:g,quantity:1,chargeType:r}),P([...f,{id:t.v4(),message:"Product added to cart",status:"success"}])}catch(C){P([...f,{id:t.v4(),message:`Product failed to add to cart: ${C}`,status:"error"}])}}}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:Y.header,children:[t.jsxRuntimeExports.jsx("div",{id:"h3",children:"Choose a Variant"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:l})]}),t.jsxRuntimeExports.jsx("div",{className:Y.variants,children:o.filter(g=>{var p;return(p=g.chargeTypes)==null?void 0:p.includes(r)}).map(g=>{var p,i,E;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(Y.variant),onClick:()=>{y(g.id),a(!1)},children:[t.jsxRuntimeExports.jsxs("div",{className:Y.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:Y.title,id:"h4",children:g.name}),t.jsxRuntimeExports.jsx("span",{id:"md",children:t.formatPrice({amount:r==="ONE_TIME"?g.price.amount:g.subscriptionSettings?g.subscriptionSettings.price.amount:0,currency:r==="ONE_TIME"?g.price.currency:((p=g.subscriptionSettings)==null?void 0:p.price.currency)||"USD"})})]}),t.jsxRuntimeExports.jsx("div",{id:"md",children:r==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:Y.stock,id:"md",children:[(i=g.quantity.restrictions)!=null&&i.max||g.quantity.available!==void 0?((E=g.quantity.restrictions)==null?void 0:E.max)||g.quantity.available:"∞"," ","in stock"]})})]},g.id)})})]})},Hs=x=>{const{product:o,setIsOpen:r,isCartEnabled:s}=x,{setIsOpen:a}=t.useModalStore(),e=()=>{a(!1),setTimeout(()=>{r(!1)},300)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:Y.header,children:[t.jsxRuntimeExports.jsxs("div",{id:"h3",className:Y.title,children:["Buy ",t.splitTextIntoSpans(o.name)]}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",width:24,height:24,fill:"var(--text-secondary)",hoverable:!0,onClick:e,style:{minWidth:24,minHeight:24}})]}),t.jsxRuntimeExports.jsx("div",{className:Y.productOptions,children:t.jsxRuntimeExports.jsx(nt,{product:o,setIsOpen:r,isCartEnabled:s})})]})},Vs="_contentModal_1ptti_1",Ys="_modalTop_1ptti_13",Gs="_loading_1ptti_19",Ws="_modalCards_1ptti_27",Xs="_modalImage_1ptti_32",Qs="_card_1ptti_37",Js="_cardInfo_1ptti_49",Ks="_cardButtons_1ptti_56",Zs="_title_1ptti_62",tn="_blockImage_1ptti_69",en="_short_1ptti_78",sn="_price_1ptti_82",nn="_oldPrice_1ptti_89",on="_newPrice_1ptti_98",D={contentModal:Vs,modalTop:Ys,loading:Gs,modalCards:Ws,modalImage:Xs,card:Qs,cardInfo:Js,cardButtons:Ks,title:Zs,blockImage:tn,short:en,price:sn,oldPrice:nn,newPrice:on},rn=x=>{const{setIsOpen:o,pageContext:r,groupData:s,setProductId:a,setIsProductModalOpen:e,setShowDropdown:u}=x,[d,h]=j.useState(null),[f,P]=j.useState(!0),{setIsOpen:R}=t.useModalStore();j.useEffect(()=>{var y;P(!0);const l=(y=r.listings)==null?void 0:y.filter(g=>s.listingIdList.includes(g.id));l&&h([...l]),P(!1)},[r]),j.useEffect(()=>{R(!0)},[]);const c=()=>{R(!1),setTimeout(()=>{o(!1)},300)};return t.jsxRuntimeExports.jsx(t.Modal,{close:()=>o(!1),children:t.jsxRuntimeExports.jsxs("div",{className:D.contentModal,onClick:l=>l.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:D.modalTop,children:[t.jsxRuntimeExports.jsx("span",{className:D.title,id:"h4",children:t.splitTextIntoSpans(s.name)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",hoverable:!0,onClick:c,fill:"var(--text-primary)"})]}),!f&&d&&t.jsxRuntimeExports.jsx("div",{className:D.modalCards,children:d.map(l=>t.jsxRuntimeExports.jsxs("div",{className:D.card,children:[t.jsxRuntimeExports.jsx("div",{children:l.productData.images[0]?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${l.productData.images[0].cfId}/w=500`,alt:"",width:64,height:64,className:D.modalImage}):t.jsxRuntimeExports.jsx("div",{className:t.clx(D.blockImage,D.modalImage),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Image"})})}),t.jsxRuntimeExports.jsxs("div",{className:D.cardInfo,children:[t.jsxRuntimeExports.jsx("div",{className:D.name,id:"h5",children:l.productData.compareAtPrice&&(l.productData.compareAtPrice.amount||0)-(l.productData.minPrice.amount||0)>0?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name),t.jsxRuntimeExports.jsxs("span",{className:D.price,id:"md",children:[t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})}),t.jsxRuntimeExports.jsx("span",{className:D.oldPrice,id:"md",children:t.formatPrice({amount:l.productData.compareAtPrice.amount,currency:l.productData.compareAtPrice.currency})})]})]}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.splitTextIntoSpans(l.productData.name),t.jsxRuntimeExports.jsx("span",{className:D.newPrice,id:"md",children:t.formatPrice({amount:l.productData.minPrice.amount,currency:l.productData.minPrice.currency})})]})}),l.productData.shortDescription&&t.jsxRuntimeExports.jsx("span",{className:D.short,id:"md",children:t.splitTextIntoSpans(l.productData.shortDescription)})]}),t.jsxRuntimeExports.jsxs("div",{className:D.cardButtons,children:[t.jsxRuntimeExports.jsx(t.Button$1,{type:"Secondary",onClick:()=>{a(l.id),o(!1),e(!0)},children:"Buy"}),t.jsxRuntimeExports.jsx(t.Link,{path:`/product/${l.productData.uniquePath}`,children:t.jsxRuntimeExports.jsx(t.Button$1,{type:"Primary",style:{whiteSpace:"nowrap"},onClick:()=>{u(!1),c()},children:"View Details"})})]})]},l.id))}),f&&t.jsxRuntimeExports.jsx("div",{className:D.loading,children:t.jsxRuntimeExports.jsx(t.Loader,{})})]})})};exports.AlignText=t.AlignText;exports.Button=t.Button$1;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.InputUI=t.Input$1;exports.ItemsSettings=t.ItemsSettings;exports.Link=t.Link;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.RadioUI=t.Radio;exports.RangeSelector=t.RangeSelector;exports.Select=t.Select;exports.SelectInfiniteList=t.SelectInfiniteList;exports.SelectTypeText=t.SelectTypeText;exports.SelectUI=t.Select$1;exports.Switch=t.Switch;exports.TextSettings=t.TextSettings;exports.TextareaSettings=t.Textarea;exports.TextareaUI=t.Textarea$1;exports.TypesText=t.TypesText;exports.Wrapper=t.Wrapper;exports.Accordion=Is;exports.BurgerMenuButton=ct;exports.ButtonTypeSettings=st;exports.ButtonsSettings=ne;exports.CategorySettings=Mt;exports.ChargeTypes=Z;exports.EmptyCart=rt;exports.FormSettings=Xt;exports.GroupCardModal=rn;exports.HeaderButtons=rs;exports.LayoutSettings=_t;exports.ListingSelector=oe;exports.MetaInfoPost=ws;exports.PagesMobileMenu=as;exports.PagesMobileModal=at;exports.PagesSettings=Gt;exports.ProductCardButtons=Cs;exports.ProductCardModal=zs;exports.ProductOptions=nt;exports.ShareLink=hs;exports.ShoppingButton=it;exports.ShoppingModalCart=ot;exports.UserInfo=tt;
|
package/dist/ui.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as t, I as j, c as z, d as Nt, e as pt, g as mt, P as gt, S as lt, h as kt, D as ft, i as xt, v as _t, B as dt, k as ot, a as wt, l as Tt, O as ht, m as J, n as yt, C as jt, o as V, p as At, q as Dt, r as bt, t as Et, w as vt, x as W, L as Rt, y as Ct, z as St, A as ct, s as at, f as Q, E as Lt, F as R, G as Ut, M as ut, H as zt, J as rt, K as Mt, N as Ft, Q as Bt, T as Ht, U as $t, V as Vt } from "./index-
|
|
2
|
-
import { a1 as si, a5 as ni, $ as ii, Z as ai, a4 as oi, a3 as ci, Y as ri, _ as li, W as di, X as ui, a0 as hi, a2 as pi } from "./index-
|
|
1
|
+
import { j as t, I as j, c as z, d as Nt, e as pt, g as mt, P as gt, S as lt, h as kt, D as ft, i as xt, v as _t, B as dt, k as ot, a as wt, l as Tt, O as ht, m as J, n as yt, C as jt, o as V, p as At, q as Dt, r as bt, t as Et, w as vt, x as W, L as Rt, y as Ct, z as St, A as ct, s as at, f as Q, E as Lt, F as R, G as Ut, M as ut, H as zt, J as rt, K as Mt, N as Ft, Q as Bt, T as Ht, U as $t, V as Vt } from "./index-BMu1khEz.js";
|
|
2
|
+
import { a1 as si, a5 as ni, $ as ii, Z as ai, a4 as oi, a3 as ci, Y as ri, _ as li, W as di, X as ui, a0 as hi, a2 as pi } from "./index-BMu1khEz.js";
|
|
3
3
|
import g from "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
const Yt = "_block_kh9z8_8", Gt = "_title_kh9z8_16", Wt = "_subtitle_kh9z8_23", Xt = "_alignmentContent_kh9z8_30", Qt = "_alignments_kh9z8_39", Jt = "_alignment_kh9z8_30", Kt = "_circle_kh9z8_64", Zt = "_paddings_kh9z8_71", te = "_padding_kh9z8_71", ee = "_active_kh9z8_97", G = {
|