@billgangcom/theme-lib 1.16.2 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/utils/fetchAll.d.ts +1 -0
- package/dist/builder/utils/index.d.ts +1 -0
- package/dist/builder.cjs.js +3 -3
- package/dist/builder.es.js +832 -820
- package/dist/{root-WMlk2lMG.cjs → root-CcZWgeeq.cjs} +27 -27
- package/dist/{root-wNhoQi1j.js → root-iwDkF_8A.js} +855 -842
- package/dist/shared/lib/api.d.ts +1 -2
- package/dist/shared/lib/getDynamicRoutes.d.ts +2 -1
- package/dist/store/useLayersStore.d.ts +1 -0
- package/dist/store/useThemeSettingsStore.d.ts +1 -0
- package/dist/ui/HeaderButtons/index.d.ts +4 -0
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +996 -789
- package/package.json +1 -1
package/dist/shared/lib/api.d.ts
CHANGED
|
@@ -4,5 +4,4 @@ export declare const getImages: () => Promise<any>;
|
|
|
4
4
|
export declare const updateImages: (formData: FormData) => Promise<any>;
|
|
5
5
|
export declare const deletePage: (route: string) => Promise<any>;
|
|
6
6
|
export declare const getDynamicPage: (route: string) => Promise<any>;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const getTheme: () => Promise<any>;
|
|
7
|
+
export declare const getThemeAndSettings: () => Promise<any>;
|
|
@@ -5,6 +5,7 @@ interface Options {
|
|
|
5
5
|
blocks: Record<string, Record<string, any>>;
|
|
6
6
|
currentBlock: string | null;
|
|
7
7
|
positionBlock: number | null;
|
|
8
|
+
setBlocks: (blocks: Record<string, Record<string, any>>) => void;
|
|
8
9
|
setHeader: (header: IBlock) => void;
|
|
9
10
|
setFooter: (footer: IBlock) => void;
|
|
10
11
|
createPage: (name: string) => void;
|
|
@@ -3,6 +3,7 @@ interface Options {
|
|
|
3
3
|
activeBlock: ThemeSettingsBlock | null;
|
|
4
4
|
setActiveBlock: (activeBlock: ThemeSettingsBlock | null) => void;
|
|
5
5
|
themeSettings: ThemeSettings;
|
|
6
|
+
setThemeSettings: (themeSettings: ThemeSettings) => void;
|
|
6
7
|
updateColor: (category: keyof ThemeSettings['colors'], colorType: string, newColor: string) => void;
|
|
7
8
|
updateFont: (fontType: FontType, id: FontTypeHeading | FontTypeParagraph, field: keyof FontFields, newValue: string | number) => void;
|
|
8
9
|
updateBorder: (field: keyof BorderFields, newValue: string | number) => void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
interface Props {
|
|
2
3
|
shopping: boolean;
|
|
3
4
|
signUp: boolean;
|
|
4
5
|
}
|
|
5
6
|
export declare const HeaderButtons: React.FC<Props>;
|
|
7
|
+
export declare const ShoppingButton: React.FC;
|
|
8
|
+
export declare const ShoppingModalCart: React.FC;
|
|
9
|
+
export declare const EmptyCart: React.FC;
|
|
6
10
|
export {};
|
package/dist/ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./root-WMlk2lMG.cjs"),m=require("react"),ot="_accordion_2tiiw_1",it="_header_2tiiw_9",ct="_icon_2tiiw_16",rt="_open_2tiiw_19",at="_content_2tiiw_23",V={accordion:ot,header:it,icon:ct,open:rt,content:at},lt=({title:x,content:n})=>{const[s,o]=m.useState(!1),[c,r]=m.useState(0),e=m.useRef(null),i=()=>{o(!s)};return m.useEffect(()=>{e.current&&r(s?e.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:V.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:V.header,onClick:i,children:[t.jsxRuntimeExports.jsx("h3",{children:x}),t.jsxRuntimeExports.jsx("div",{className:t.clx(V.icon,{[V.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:V.content,style:{height:`${c}px`},children:t.jsxRuntimeExports.jsx("p",{children:n})})]})},ut="_wrapper_1g82c_2",xt="_alignmentBlock_1g82c_8",dt="_title_1g82c_15",pt="_subtitle_1g82c_22",mt="_alignmentContent_1g82c_29",_t="_alignments_1g82c_35",ht="_alignment_1g82c_8",jt="_circle_1g82c_54",gt="_paddings_1g82c_61",bt="_padding_1g82c_61",ft="_input_1g82c_79",S={wrapper:ut,alignmentBlock:xt,title:dt,subtitle:pt,alignmentContent:mt,alignments:_t,alignment:ht,circle:jt,paddings:gt,padding:bt,input:ft},Rt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],vt=["left","top","right","bottom"],Et=x=>{const{alignment:n,padding:s,setPadding:o,setAlignment:c}=x;function r(){switch(n){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 e(i){switch(i){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:S.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:S.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:S.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:S.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:S.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:S.alignments,children:Rt.map(i=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{c(i)},className:S.alignment,children:[i!==n&&t.jsxRuntimeExports.jsx("div",{className:S.circle}),i===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:r(),fill:"#FF3F19",width:22,height:22})]},i))}),t.jsxRuntimeExports.jsx("div",{className:S.paddings,children:vt.map(i=>t.jsxRuntimeExports.jsxs("label",{className:S.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(i),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(s[i]),onChange:u=>o({...s,[i]:Number(u)}),paddingless:!0,borderless:!0})]}))})]})]})]})},kt="_subtitle_2zbxx_1",yt="_header_2zbxx_8",$t="_text_2zbxx_9",It="_top_2zbxx_16",Nt="_itemsBlock_2zbxx_23",G={subtitle:kt,header:yt,text:$t,top:It,itemsBlock:Nt},wt="_typeTexts_3zlec_1",Ct="_block_3zlec_7",Bt="_active_3zlec_18",K={typeTexts:wt,block:Ct,active:Bt},Pt=["bold","italic","underline","strike-through","code"],W=x=>{const{typesText:n,setTypesText:s}=x;function o(c){switch(c){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:K.typeTexts,children:Pt.map(c=>t.jsxRuntimeExports.jsx("div",{className:t.clx(K.block,{[K.active]:n.includes(c)}),onClick:()=>{const r=[...n];if(r.includes(c)){const e=r.filter(i=>i!==c);s(e)}else r.push(c),s(r)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:o(c),fill:n.includes(c)?"#252525":"#757575",width:20,height:20})},String(c)))})},Z=x=>{const{typesText:n,isActiveText:s,setIsActiveText:o,text:c,setText:r,setTypesText:e,title:i,subtitle:u="Items"}=x;return t.jsxRuntimeExports.jsxs("div",{className:G.text,children:[(i||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:G.top,children:[i&&t.jsxRuntimeExports.jsx("h3",{className:G.title,children:i}),s!==void 0&&o&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:R=>o(R)})]}),t.jsxRuntimeExports.jsxs("div",{className:G.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:u}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:R=>r(R),value:c,maxLength:150}),t.jsxRuntimeExports.jsx(W,{typesText:n,setTypesText:e})]})]})},Tt="_subtitle_11qr1_1",St="_header_11qr1_8",At="_text_11qr1_9",Ot="_productsBlock_11qr1_10",Dt="_top_11qr1_22",Lt="_itemsBlock_11qr1_29",qt="_typeTexts_11qr1_35",Mt="_block_11qr1_41",Ht="_active_11qr1_52",zt="_products_11qr1_10",Ut="_product_11qr1_10",Ft="_button_11qr1_70",Vt="_disabled_11qr1_80",Gt="_image_11qr1_84",Xt="_info_11qr1_91",Yt="_name_11qr1_102",Jt="_buttons_11qr1_106",Kt="_modal_11qr1_112",Qt="_link_11qr1_130",Wt="_modalOptions_11qr1_136",$={subtitle:Tt,header:St,text:At,productsBlock:Ot,top:Dt,itemsBlock:Lt,typeTexts:qt,block:Mt,active:Ht,products:zt,product:Ut,button:Ft,disabled:Vt,image:Gt,info:Xt,name:Yt,buttons:Jt,modal:Kt,link:Qt,modalOptions:Wt},Zt=x=>{const{activeItem:n,setActiveItem:s,popupPosition:o,modalOptions:c,setIsOpenModal:r}=x;return t.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:e=>{e.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),r(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:$.modalOptions,children:c.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:i=>{const u={...n,[e.field]:i};s(u)}});if(e.type==="text")return t.jsxRuntimeExports.jsx(Z,{typesText:n[e.field.type],setTypesText:i=>{const u={...n,[e.field.type]:i};s(u)},text:n[e.field.text]||"",setText:i=>{const u={...n,[e.field.text]:i};s(u)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:i=>{const u={...n,[e.field]:i};s(u)},value:n[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:$.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:i=>{const u={...n,[e.field.text]:i};s(u)},value:n[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!n[e.field.switch]||!1,label:e.switchLabel,onChange:i=>{const u={...n,[e.field.switch]:i};s(u)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(et,{items:n[e.field]||[],setItems:i=>{const u={...n,[e.field]:i};s(u)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:i=>{const u={...n,[e.field]:i};s(u)},label:e.label,value:n[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:n[e.field]})})})})]})},te="_other_1wtgi_1",ee="_subtitle_1wtgi_7",se="_items_1wtgi_14",Q={other:te,subtitle:ee,items:se},tt=x=>{const{items:n,title:s="Other"}=x;return t.jsxRuntimeExports.jsxs("div",{className:Q.other,children:[t.jsxRuntimeExports.jsx("h5",{className:Q.subtitle,children:s}),t.jsxRuntimeExports.jsx("div",{className:Q.items,children:n.map(o=>t.jsxRuntimeExports.jsx(t.Switch,{current:o.isItem,onChange:c=>o.setIsItem(c),label:o.label,hasBackground:!0,paddingless:!1}))})]})},ne=x=>{const{index:n,moveProduct:s,children:o}=x,[,c]=t.useDrop({accept:"product",hover(i){i.index!==n&&(s(i.index,n),i.index=n)}}),[{isDragging:r},e]=t.useDrag({type:"product",item:{index:n},collect:i=>({isDragging:i.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:i=>e(c(i)),className:`${$.product} ${r?$.dragging:""}`,children:o})},et=x=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:c,other:r,title:e,subtitle:i,editable:u=!0,draggable:R=!1,withImage:p=!1,deletable:g=!0,addable:j=!0,itemsType:E,itemsPlaceholder:l="",itemsOptions:_,hasRangeSelector:w=!1,rangeSelectorOptions:z,modalOptions:U,addableOptions:v={},limit:P}=x,[O,D]=m.useState(null),[J,Y]=m.useState({top:0,left:0}),[d,b]=m.useState(!1),C=(a,I)=>{const B=[...o],[f]=B.splice(a,1);B.splice(I,0,f),c(B)};m.useEffect(()=>{const a=()=>{D(null),b(!1)};return document.body.addEventListener("click",a),D(null),b(!1),()=>{D(null),b(!1),document.body.removeEventListener("click",a)}},[]),m.useEffect(()=>{if(O){const a=[...o].map(I=>I.id===O.id?O:I);c(a)}},[O]);const k=(a,I)=>{a.stopPropagation(),b(!0);const B=a.target.getBoundingClientRect(),f=500,F=window.innerHeight;let A=B.top+window.scrollY;A+f>F&&(A=F-f-20),Y({top:A-80,left:B.left-30}),D(I)};function M(a){if(p)return a?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${a[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const T=(a,I)=>{const B=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[R&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),E==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const A=[...o].map(L=>L.id===a.id?{...a,name:f}:L);D({...a,name:f}),c([...A])},value:a.name,options:_,leftAddon:M(a.images)}),E==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:f=>{const A=[...o].map(L=>L.id===a.id?{...a,name:f}:L);c([...A])},value:a.name,placeholder:l}),E==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:f=>{const A=[...o].map(L=>L.id===a.id?{...a,images:f}:L);c([...A])}}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[u&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>k(f,a)}),g&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>c(o.filter(f=>f.id!==a.id))})]})]});return R?t.jsxRuntimeExports.jsx(ne,{product:a,index:I,moveProduct:C,children:B},a.id):t.jsxRuntimeExports.jsx("div",{className:$.product,children:B},a.id)};return t.jsxRuntimeExports.jsxs("div",{className:$.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:$.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:a=>s==null?void 0:s(a)})]}),O&&u&&U&&d&&t.jsxRuntimeExports.jsx(Zt,{activeItem:O,setActiveItem:D,popupPosition:J,modalOptions:U,setIsOpenModal:b}),w&&z&&t.jsxRuntimeExports.jsx(nt,{...z}),t.jsxRuntimeExports.jsxs("div",{className:$.products,children:[i&&t.jsxRuntimeExports.jsx("h5",{className:$.subtitle,children:i}),R?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((a,I)=>T(a,I))}):o.map((a,I)=>T(a,I)),j&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx($.button,{[$.disabled]:!!(P&&P<=o.length)}),size:"s",disabled:!!(P&&P<=o.length),onClick:()=>{const a=[...o];E==="select"?a.push({name:_[0]||`Product ${o.length+1}`,id:t.v4(),...v}):E==="input"?a.push({name:"",id:t.v4(),...v}):a.push({name:`Image ${o.length+1}`,id:t.v4(),...v}),c(a)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(tt,{items:r})]})},oe="_subtitle_41klp_1",ie="_header_41klp_8",ce="_text_41klp_9",re="_productsBlock_41klp_10",ae="_buttonsBlock_41klp_11",le="_top_41klp_21",ue="_itemsBlock_41klp_28",xe="_typeTexts_41klp_34",de="_block_41klp_40",pe="_active_41klp_51",me="_products_41klp_10",_e="_product_41klp_10",he="_button_41klp_11",je="_image_41klp_79",ge="_info_41klp_86",be="_name_41klp_97",fe="_buttons_41klp_11",Re="_modal_41klp_107",ve="_other_41klp_124",Ee="_options_41klp_130",H={subtitle:oe,header:ie,text:ce,productsBlock:re,buttonsBlock:ae,top:le,itemsBlock:ue,typeTexts:xe,block:de,active:pe,products:me,product:_e,button:he,image:je,info:ge,name:be,buttons:fe,modal:Re,other:ve,options:Ee},ke=x=>{const{activeButton:n,setActiveButton:s,popupPosition:o}=x,[c,r]=m.useState(n.typesText),[e,i]=m.useState(n.destination),[u,R]=m.useState(n.link||""),[p,g]=m.useState(n.text||"");return m.useEffect(()=>{s({...n,...{text:p,link:u,destination:e,typesText:c}})},[c,e,u,p]),t.jsxRuntimeExports.jsxs("div",{className:H.modal,onClick:j=>{j.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:H.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:j=>i(j),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:j=>R(j),value:u,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:j=>g(j),value:p,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(W,{typesText:c,setTypesText:r})]})]})},ye="_subtitle_1y5sw_1",$e="_header_1y5sw_8",Ie="_text_1y5sw_9",Ne="_productsBlock_1y5sw_10",we="_buttonsBlock_1y5sw_11",Ce="_top_1y5sw_22",Be="_itemsBlock_1y5sw_29",Pe="_typeTexts_1y5sw_35",Te="_block_1y5sw_41",Se="_active_1y5sw_52",Ae="_products_1y5sw_10",Oe="_product_1y5sw_10",De="_button_1y5sw_11",Le="_image_1y5sw_80",qe="_info_1y5sw_87",Me="_name_1y5sw_98",He="_buttons_1y5sw_11",ze="_modal_1y5sw_108",Ue="_other_1y5sw_125",Fe="_options_1y5sw_131",X={subtitle:ye,header:$e,text:Ie,productsBlock:Ne,buttonsBlock:we,top:Ce,itemsBlock:Be,typeTexts:Pe,block:Te,active:Se,products:Ae,product:Oe,button:De,image:Le,info:qe,name:Me,buttons:He,modal:ze,other:Ue,options:Fe},st=x=>{const{buttons:n,setButtons:s,deletable:o=!0,addable:c=!0}=x,[r,e]=m.useState(null),[i,u]=m.useState({top:0,left:0});m.useEffect(()=>{const p=()=>{e(null)};return document.body.addEventListener("click",p),e(null),()=>{e(null),document.body.removeEventListener("click",p)}},[]),m.useEffect(()=>{if(r){const p=[...n].map(g=>g.id===r.id?r:g);s(p)}},[r]);const R=(p,g)=>{p.stopPropagation();const j=p.target.getBoundingClientRect(),E=490,l=window.innerHeight;let _=j.top+window.scrollY;_+E>l&&(_=l-E-20),u({top:_,left:j.left-30}),e(g)};return t.jsxRuntimeExports.jsxs("div",{className:X.products,children:[t.jsxRuntimeExports.jsx("h5",{className:X.subtitle,children:"Button Type"}),n.map(p=>t.jsxRuntimeExports.jsxs("div",{className:X.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:g=>{const E=[...n].map(l=>l.id===p.id?{...p,type:g}:l);s(E)},value:p.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:X.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:g=>{R(g,p)}}),o&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const g=n.filter(j=>j.id!==p.id);s(g)},width:20,height:20,fill:"#C12A2A"})]})]},p.id)),r&&t.jsxRuntimeExports.jsx(ke,{activeButton:r,setActiveButton:e,popupPosition:i}),c&&t.jsxRuntimeExports.jsxs(t.Button,{className:X.button,size:"s",onClick:()=>{const p=[...n];p.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),s(p)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Ve=x=>{const{isActiveButtons:n,setIsActiveButtons:s,buttons:o,setButtons:c}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:H.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:H.top,children:[t.jsxRuntimeExports.jsx("h3",{className:H.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:r=>s(r)})]}),t.jsxRuntimeExports.jsx(st,{buttons:o,setButtons:c})]})})},Ge="_wrapper_tn7gb_1",Xe="_subtitle_tn7gb_7",Ye="_content_tn7gb_14",Je="_range_tn7gb_21",Ke="_track_tn7gb_26",Qe="_progress_tn7gb_35",We="_dots_tn7gb_45",Ze="_dot_tn7gb_45",ts="_active_tn7gb_62",es="_input_tn7gb_74",ss="_countBlock_tn7gb_88",ns="_count_tn7gb_88",os="_controls_tn7gb_103",is="_button_tn7gb_108",y={wrapper:Ge,subtitle:Xe,content:Ye,range:Je,track:Ke,progress:Qe,dots:We,dot:Ze,active:ts,input:es,countBlock:ss,count:ns,controls:os,button:is},nt=x=>{const{label:n,min:s=1,max:o=4,step:c=1,count:r,setCount:e}=x,[i,u]=m.useState(!1),R=Array.from({length:(o-s)/c+1}),p=(r-s)/(o-s)*100,g=()=>{r<o&&e(r+c)},j=()=>{r>s&&e(r-c)},E=l=>{const _=s+l*c;e(_)};return t.jsxRuntimeExports.jsxs("div",{className:y.wrapper,children:[n&&t.jsxRuntimeExports.jsx("h5",{className:y.subtitle,children:n}),t.jsxRuntimeExports.jsxs("div",{className:y.content,children:[t.jsxRuntimeExports.jsxs("div",{className:y.range,children:[t.jsxRuntimeExports.jsx("div",{className:y.track}),t.jsxRuntimeExports.jsx("div",{className:y.progress,style:{width:`${p}%`}}),t.jsxRuntimeExports.jsx("div",{className:y.dots,children:R.map((l,_)=>{const w=_<=(r-s)/c;return t.jsxRuntimeExports.jsx("button",{onClick:()=>E(_),className:t.clx(y.dot,{[y.active]:w,[y.inactive]:!w,[y.dragging]:i}),"aria-label":`Set value to ${s+_*c}`},_)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:s,max:o,step:c,value:r,onChange:l=>e(Number(l.target.value)),onMouseDown:()=>u(!0),onMouseUp:()=>u(!1),onTouchStart:()=>u(!0),onTouchEnd:()=>u(!1),className:y.input})]}),t.jsxRuntimeExports.jsxs("div",{className:y.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:s,max:o,paddingless:!0,onChange:l=>{const _=Number(l);_>o?e(o):_<s?e(s):e(_)},value:String(r)}),t.jsxRuntimeExports.jsxs("div",{className:y.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:r>=o,className:y.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:j,disabled:r<=s,className:y.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},cs="_subtitle_1nl8x_1",rs="_header_1nl8x_8",as="_text_1nl8x_9",ls="_productsBlock_1nl8x_10",us="_top_1nl8x_22",xs="_itemsBlock_1nl8x_29",ds="_typeTexts_1nl8x_35",ps="_block_1nl8x_41",ms="_active_1nl8x_52",_s="_products_1nl8x_10",hs="_product_1nl8x_10",js="_button_1nl8x_70",gs="_image_1nl8x_80",bs="_info_1nl8x_87",fs="_name_1nl8x_98",Rs="_buttons_1nl8x_102",vs="_modal_1nl8x_108",Es="_link_1nl8x_126",ks="_modalOptions_1nl8x_132",N={subtitle:cs,header:rs,text:as,productsBlock:ls,top:us,itemsBlock:xs,typeTexts:ds,block:ps,active:ms,products:_s,product:hs,button:js,image:gs,info:bs,name:fs,buttons:Rs,modal:vs,link:Es,modalOptions:ks},ys=x=>{const{activeItem:n,setActiveItem:s,popupPosition:o,setIsOpenModal:c}=x;return t.jsxRuntimeExports.jsxs("div",{className:N.modal,onClick:r=>{r.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:N.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{c(!1),s(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:N.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:r=>{const e={...n,images:r,imagePath:r[0]};s(e)}})})]})},$s=x=>{const{index:n,moveProduct:s,children:o}=x,[,c]=t.useDrop({accept:"product",hover(i){i.index!==n&&(s(i.index,n),i.index=n)}}),[{isDragging:r},e]=t.useDrag({type:"product",item:{index:n},collect:i=>({isDragging:i.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:i=>e(c(i)),className:`${N.product} ${r?N.dragging:""}`,children:o})},Is=x=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:c,other:r,title:e,subtitle:i,editable:u=!0,draggable:R=!1,withImage:p=!1,deletable:g=!0,addable:j=!0,itemsType:E,itemsOptions:l}=x,[_,w]=m.useState(null),[z,U]=m.useState({top:0,left:0}),[v,P]=m.useState(!1),O=(d,b)=>{const C=[...o],[k]=C.splice(d,1);C.splice(b,0,k),c(C)};m.useEffect(()=>{const d=()=>{w(null),P(!1)};return document.body.addEventListener("click",d),w(null),P(!1),()=>{w(null),P(!1),document.body.removeEventListener("click",d)}},[]),m.useEffect(()=>{if(_){const d=[...o].map(b=>b.id===_.id?_:b);c(d)}},[_]);const D=(d,b)=>{d.stopPropagation();const C=d.target.getBoundingClientRect(),k=100,M=window.innerHeight;let T=C.top+window.scrollY;T+k>M&&(T=M-k-20),P(!0),U({top:T-80,left:C.left-30}),w(b)};function J(d){if(p)return d?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${d}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Y=(d,b)=>{const C=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[R&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),E==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const M=[...o],T=Number(k.split(" ")[1]),a=l.find(f=>f.id===T);if(!a)return;const I={...a.productData.stats,newPrice:a.productData.minPrice.amount,oldPrice:a.productData.compareAtPrice.amount},B=M.map(f=>f.id===d.id?{...d,name:k,listingId:T,stats:I}:f);w({...d,name:k,listingId:T}),c([...B])},value:d.name,options:[...l.map(k=>`Product ${k.id}`)],leftAddon:J(d.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:N.buttons,children:[u&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:k=>D(k,d)}),g&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>c(o.filter(k=>k.id!==d.id))})]})]});return R?t.jsxRuntimeExports.jsx($s,{product:d,index:b,moveProduct:O,children:C},d.id):t.jsxRuntimeExports.jsx("div",{className:N.product,children:C},d.id)};return t.jsxRuntimeExports.jsxs("div",{className:N.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:N.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:N.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:d=>s==null?void 0:s(d)})]}),v&&_&&t.jsxRuntimeExports.jsx(ys,{activeItem:_,setActiveItem:w,setIsOpenModal:P,popupPosition:z}),t.jsxRuntimeExports.jsxs("div",{className:N.products,children:[i&&t.jsxRuntimeExports.jsx("h5",{className:N.subtitle,children:i}),R?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((d,b)=>Y(d,b))}):o.map((d,b)=>Y(d,b)),j&&t.jsxRuntimeExports.jsxs(t.Button,{className:N.button,size:"s",onClick:()=>{const d=[...o],b=l[0].id;d.push({name:`Product ${b}`,id:t.v4(),listingId:b,imagePath:"",images:[],stats:{...l[0].productData.stats,newPrice:l[0].productData.minPrice.amount,oldPrice:l[0].productData.compareAtPrice.amount}}),c(d)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),r!==void 0&&t.jsxRuntimeExports.jsx(tt,{items:r})]})},Ns="_options_163bj_1",ws="_price_163bj_12",Cs="_oldPrice_163bj_18",Bs="_newPrice_163bj_26",Ps="_meta_163bj_33",Ts="_info_163bj_39",Ss="_infoRight_163bj_46",As="_buttons_163bj_52",Os="_variants_163bj_59",Ds="_variant_163bj_59",Ls="_stock_163bj_74",qs="_variantInfo_163bj_81",Ms="_quantity_163bj_87",Hs="_count_163bj_93",zs="_button_163bj_52",Us="_activeVariant_163bj_110",Fs="_chargeTypes_163bj_114",Vs="_charge_163bj_114",Gs="_chargeActive_163bj_131",h={options:Ns,price:ws,oldPrice:Cs,newPrice:Bs,meta:Ps,info:Ts,infoRight:Ss,buttons:As,variants:Os,variant:Ds,stock:Ls,variantInfo:qs,quantity:Ms,count:Hs,button:zs,activeVariant:Us,chargeTypes:Fs,charge:Vs,chargeActive:Gs},Xs=x=>{const{variants:n}=x,[s,o]=m.useState(n[0]),c=t.useNavigate(),[r,e]=m.useState(1),{reset:i,addProductToCart:u,cart:R,getPages:p}=t.useCart();function g(){if(R.parts.length===0){const l=encodeURIComponent("product/subscription-test");p(l).then(()=>{console.log(x.id,s.id,r),u({productId:x.id,productVariantId:s.id,quantity:r})})}}function j(){i(),g(),c("/checkout")}function E(l){if(l>=864e5){const v=Math.floor(l/864e5);return`${v} ${v===1?"day":"days"}`}else if(l>=36e5){const v=Math.floor(l/36e5);return`${v} ${v===1?"hour":"hours"}`}else if(l>=6e4){const v=Math.floor(l/6e4);return`${v} ${v===1?"minute":"minutes"}`}else{const v=Math.floor(l/1e3);return`${v} ${v===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:h.options,children:[t.jsxRuntimeExports.jsx("div",{className:h.chargeTypes,children:s.chargeTypes?s.chargeTypes.map(l=>t.jsxRuntimeExports.jsx("div",{children:l})):t.jsxRuntimeExports.jsx("div",{className:t.clx(h.charge,h.chargeActive),children:"One-Time"})}),t.jsxRuntimeExports.jsx("div",{className:h.variants,children:n.map(l=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(h.variant,{[h.activeVariant]:s.id===l.id}),onClick:()=>o(l),children:[t.jsxRuntimeExports.jsxs("div",{className:h.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:h.title,children:l.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",l.price.amount]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("span",{className:h.stock,children:[l.quantity.restrictions.max||0," in stock"]})})]}))}),t.jsxRuntimeExports.jsxs("div",{className:h.quantity,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{r>1?e(l=>l-1):e(1)},className:h.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("div",{className:h.count,children:r}),t.jsxRuntimeExports.jsx("div",{onClick:()=>e(l=>l+1),className:h.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:h.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:h.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:h.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:s.deliveryTime===0?"Instant":E(s.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:h.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:h.infoRight,children:s.compareAtPrice&&(s.compareAtPrice.amount||0)-(s.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:h.price,children:[t.jsxRuntimeExports.jsxs("span",{className:h.newPrice,children:["$ ",(s.price.amount||0)*r]}),t.jsxRuntimeExports.jsxs("span",{className:h.oldPrice,children:["$ ",(s.compareAtPrice.amount||0)*r]})]}):t.jsxRuntimeExports.jsxs("span",{className:h.newPrice,children:["$ ",(s.price.amount||0)*r]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:h.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>j(),children:"Buy Now"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>g(),children:"Add to Cart"})]})]})},Ys="_button_pstfl_1",Js="_login_pstfl_11",Ks="_signUp_pstfl_15",Qs="_buttons_pstfl_20",q={button:Ys,login:Js,signUp:Ks,buttons:Qs},Ws=x=>{const{shopping:n,signUp:s}=x,o=t.useNavigate();function c(r){o(r)}return t.jsxRuntimeExports.jsxs("div",{className:q.buttons,children:[n&&t.jsxRuntimeExports.jsx("div",{className:q.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"#252525"})}),t.jsxRuntimeExports.jsx("div",{className:t.clx(q.button,q.login),onClick:()=>c("/customer-dash"),children:"Login"}),s&&t.jsxRuntimeExports.jsx("div",{className:t.clx(q.button,q.login,q.signUp),onClick:()=>c("/customer-dash"),children:"Sign Up"})]})};exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.Accordion=lt;exports.ButtonTypeSettings=st;exports.ButtonsSettings=Ve;exports.HeaderButtons=Ws;exports.ItemsSettings=et;exports.LayoutSettings=Et;exports.ListingSelector=Is;exports.ProductOptions=Xs;exports.RangeSelector=nt;exports.TextSettings=Z;exports.TypesText=W;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./root-CcZWgeeq.cjs"),h=require("react"),rt="_accordion_2tiiw_1",at="_header_2tiiw_9",lt="_icon_2tiiw_16",ut="_open_2tiiw_19",xt="_content_2tiiw_23",U={accordion:rt,header:at,icon:lt,open:ut,content:xt},dt=({title:l,content:n})=>{const[s,o]=h.useState(!1),[r,a]=h.useState(0),e=h.useRef(null),c=()=>{o(!s)};return h.useEffect(()=>{e.current&&a(s?e.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:U.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:U.header,onClick:c,children:[t.jsxRuntimeExports.jsx("h3",{children:l}),t.jsxRuntimeExports.jsx("div",{className:t.clx(U.icon,{[U.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:U.content,style:{height:`${r}px`},children:t.jsxRuntimeExports.jsx("p",{children:n})})]})},pt="_wrapper_1g82c_2",mt="_alignmentBlock_1g82c_8",jt="_title_1g82c_15",_t="_subtitle_1g82c_22",ht="_alignmentContent_1g82c_29",gt="_alignments_1g82c_35",bt="_alignment_1g82c_8",ft="_circle_1g82c_54",vt="_paddings_1g82c_61",Rt="_padding_1g82c_61",Et="_input_1g82c_79",O={wrapper:pt,alignmentBlock:mt,title:jt,subtitle:_t,alignmentContent:ht,alignments:gt,alignment:bt,circle:ft,paddings:vt,padding:Rt,input:Et},yt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],kt=["left","top","right","bottom"],It=l=>{const{alignment:n,padding:s,setPadding:o,setAlignment:r}=l;function a(){switch(n){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 e(c){switch(c){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:O.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:O.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:O.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:O.alignments,children:yt.map(c=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{r(c)},className:O.alignment,children:[c!==n&&t.jsxRuntimeExports.jsx("div",{className:O.circle}),c===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(),fill:"#FF3F19",width:22,height:22})]},c))}),t.jsxRuntimeExports.jsx("div",{className:O.paddings,children:kt.map(c=>t.jsxRuntimeExports.jsxs("label",{className:O.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(c),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(s[c]),onChange:x=>o({...s,[c]:Number(x)}),paddingless:!0,borderless:!0})]},c))})]})]})]})},$t="_subtitle_2zbxx_1",Nt="_header_2zbxx_8",Ct="_text_2zbxx_9",wt="_top_2zbxx_16",Bt="_itemsBlock_2zbxx_23",G={subtitle:$t,header:Nt,text:Ct,top:wt,itemsBlock:Bt},Pt="_typeTexts_3zlec_1",St="_block_3zlec_7",Tt="_active_3zlec_18",W={typeTexts:Pt,block:St,active:Tt},At=["bold","italic","underline","strike-through","code"],K=l=>{const{typesText:n,setTypesText:s}=l;function o(r){switch(r){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:W.typeTexts,children:At.map(r=>t.jsxRuntimeExports.jsx("div",{className:t.clx(W.block,{[W.active]:n.includes(r)}),onClick:()=>{const a=[...n];if(a.includes(r)){const e=a.filter(c=>c!==r);s(e)}else a.push(r),s(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:o(r),fill:n.includes(r)?"#252525":"#757575",width:20,height:20})},String(r)))})},Z=l=>{const{typesText:n,isActiveText:s,setIsActiveText:o,text:r,setText:a,setTypesText:e,title:c,subtitle:x="Items"}=l;return t.jsxRuntimeExports.jsxs("div",{className:G.text,children:[(c||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:G.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:G.title,children:c}),s!==void 0&&o&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:v=>o(v)})]}),t.jsxRuntimeExports.jsxs("div",{className:G.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:x}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:v=>a(v),value:r,maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:n,setTypesText:e})]})]})},Ot="_subtitle_11qr1_1",Dt="_header_11qr1_8",qt="_text_11qr1_9",Lt="_productsBlock_11qr1_10",Mt="_top_11qr1_22",Ht="_itemsBlock_11qr1_29",Vt="_typeTexts_11qr1_35",zt="_block_11qr1_41",Ft="_active_11qr1_52",Ut="_products_11qr1_10",Gt="_product_11qr1_10",Yt="_button_11qr1_70",Xt="_disabled_11qr1_80",Qt="_image_11qr1_84",Wt="_info_11qr1_91",Jt="_name_11qr1_102",Kt="_buttons_11qr1_106",Zt="_modal_11qr1_112",te="_link_11qr1_130",ee="_modalOptions_11qr1_136",$={subtitle:Ot,header:Dt,text:qt,productsBlock:Lt,top:Mt,itemsBlock:Ht,typeTexts:Vt,block:zt,active:Ft,products:Ut,product:Gt,button:Yt,disabled:Xt,image:Qt,info:Wt,name:Jt,buttons:Kt,modal:Zt,link:te,modalOptions:ee},se=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,modalOptions:r,setIsOpenModal:a}=l;return t.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:e=>{e.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),a(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:$.modalOptions,children:r.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:c=>{const x={...n,[e.field]:c};s(x)}},String(e.field));if(e.type==="text")return t.jsxRuntimeExports.jsx(Z,{typesText:n[e.field.type],setTypesText:c=>{const x={...n,[e.field.type]:c};s(x)},text:n[e.field.text]||"",setText:c=>{const x={...n,[e.field.text]:c};s(x)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field]:c};s(x)},value:n[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:$.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field.text]:c};s(x)},value:n[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!n[e.field.switch]||!1,label:e.switchLabel,onChange:c=>{const x={...n,[e.field.switch]:c};s(x)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(et,{items:n[e.field]||[],setItems:c=>{const x={...n,[e.field]:c};s(x)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:c=>{const x={...n,[e.field]:c};s(x)},label:e.label,value:n[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:n[e.field]})})})})]})},ne="_other_1wtgi_1",oe="_subtitle_1wtgi_7",ie="_items_1wtgi_14",J={other:ne,subtitle:oe,items:ie},tt=l=>{const{items:n,title:s="Other"}=l;return t.jsxRuntimeExports.jsxs("div",{className:J.other,children:[t.jsxRuntimeExports.jsx("h5",{className:J.subtitle,children:s}),t.jsxRuntimeExports.jsx("div",{className:J.items,children:n.map((o,r)=>t.jsxRuntimeExports.jsx(t.Switch,{current:o.isItem,onChange:a=>o.setIsItem(a),label:o.label,hasBackground:!0,paddingless:!1},r))})]})},ce=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${$.product} ${a?$.dragging:""}`,children:o})},et=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsPlaceholder:d="",itemsOptions:j,hasRangeSelector:N=!1,rangeSelectorOptions:B,modalOptions:y,addableOptions:z={},limit:T}=l,[q,L]=h.useState(null),[Q,X]=h.useState({top:0,left:0}),[p,R]=h.useState(!1),P=(u,C)=>{const S=[...o],[E]=S.splice(u,1);S.splice(C,0,E),r(S)};h.useEffect(()=>{const u=()=>{L(null),R(!1)};return document.body.addEventListener("click",u),L(null),R(!1),()=>{L(null),R(!1),document.body.removeEventListener("click",u)}},[]),h.useEffect(()=>{if(q){const u=[...o].map(C=>C.id===q.id?q:C);r(u)}},[q]);const k=(u,C)=>{u.stopPropagation(),R(!0);const S=u.target.getBoundingClientRect(),E=500,F=window.innerHeight;let D=S.top+window.scrollY;D+E>F&&(D=F-E-20),X({top:D-80,left:S.left-30}),L(C)};function H(u){if(m)return u?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${u[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const A=(u,C)=>{const S=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);L({...u,name:E}),r([...D])},value:u.name,options:j,leftAddon:H(u.images)}),i==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);r([...D])},value:u.name,placeholder:d}),i==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,images:E}:M);r([...D])}}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>k(E,u)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(E=>E.id!==u.id))})]})]});return v?t.jsxRuntimeExports.jsx(ce,{product:u,index:C,moveProduct:P,children:S},u.id):t.jsxRuntimeExports.jsx("div",{className:$.product,children:S},u.id)};return t.jsxRuntimeExports.jsxs("div",{className:$.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:$.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:u=>s==null?void 0:s(u)})]}),q&&x&&y&&p&&t.jsxRuntimeExports.jsx(se,{activeItem:q,setActiveItem:L,popupPosition:Q,modalOptions:y,setIsOpenModal:R}),N&&B&&t.jsxRuntimeExports.jsx(nt,{...B}),t.jsxRuntimeExports.jsxs("div",{className:$.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:$.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((u,C)=>A(u,C))}):o.map((u,C)=>A(u,C)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx($.button,{[$.disabled]:!!(T&&T<=o.length)}),size:"s",disabled:!!(T&&T<=o.length),onClick:()=>{const u=[...o];i==="select"?u.push({name:j[0]||`Product ${o.length+1}`,id:t.v4(),...z}):i==="input"?u.push({name:"",id:t.v4(),...z}):u.push({name:`Image ${o.length+1}`,id:t.v4(),...z}),r(u)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),a!==void 0&&t.jsxRuntimeExports.jsx(tt,{items:a})]})},re="_subtitle_41klp_1",ae="_header_41klp_8",le="_text_41klp_9",ue="_productsBlock_41klp_10",xe="_buttonsBlock_41klp_11",de="_top_41klp_21",pe="_itemsBlock_41klp_28",me="_typeTexts_41klp_34",je="_block_41klp_40",_e="_active_41klp_51",he="_products_41klp_10",ge="_product_41klp_10",be="_button_41klp_11",fe="_image_41klp_79",ve="_info_41klp_86",Re="_name_41klp_97",Ee="_buttons_41klp_11",ye="_modal_41klp_107",ke="_other_41klp_124",Ie="_options_41klp_130",V={subtitle:re,header:ae,text:le,productsBlock:ue,buttonsBlock:xe,top:de,itemsBlock:pe,typeTexts:me,block:je,active:_e,products:he,product:ge,button:be,image:fe,info:ve,name:Re,buttons:Ee,modal:ye,other:ke,options:Ie},$e=l=>{const{activeButton:n,setActiveButton:s,popupPosition:o}=l,[r,a]=h.useState(n.typesText),[e,c]=h.useState(n.destination),[x,v]=h.useState(n.link||""),[m,f]=h.useState(n.text||"");return h.useEffect(()=>{s({...n,...{text:m,link:x,destination:e,typesText:r}})},[r,e,x,m]),t.jsxRuntimeExports.jsxs("div",{className:V.modal,onClick:g=>{g.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:V.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:g=>c(g),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:g=>v(g),value:x,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:g=>f(g),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:r,setTypesText:a})]})]})},Ne="_subtitle_1y5sw_1",Ce="_header_1y5sw_8",we="_text_1y5sw_9",Be="_productsBlock_1y5sw_10",Pe="_buttonsBlock_1y5sw_11",Se="_top_1y5sw_22",Te="_itemsBlock_1y5sw_29",Ae="_typeTexts_1y5sw_35",Oe="_block_1y5sw_41",De="_active_1y5sw_52",qe="_products_1y5sw_10",Le="_product_1y5sw_10",Me="_button_1y5sw_11",He="_image_1y5sw_80",Ve="_info_1y5sw_87",ze="_name_1y5sw_98",Fe="_buttons_1y5sw_11",Ue="_modal_1y5sw_108",Ge="_other_1y5sw_125",Ye="_options_1y5sw_131",Y={subtitle:Ne,header:Ce,text:we,productsBlock:Be,buttonsBlock:Pe,top:Se,itemsBlock:Te,typeTexts:Ae,block:Oe,active:De,products:qe,product:Le,button:Me,image:He,info:Ve,name:ze,buttons:Fe,modal:Ue,other:Ge,options:Ye},st=l=>{const{buttons:n,setButtons:s,deletable:o=!0,addable:r=!0}=l,[a,e]=h.useState(null),[c,x]=h.useState({top:0,left:0});h.useEffect(()=>{const m=()=>{e(null)};return document.body.addEventListener("click",m),e(null),()=>{e(null),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(a){const m=[...n].map(f=>f.id===a.id?a:f);s(m)}},[a]);const v=(m,f)=>{m.stopPropagation();const g=m.target.getBoundingClientRect(),i=490,d=window.innerHeight;let j=g.top+window.scrollY;j+i>d&&(j=d-i-20),x({top:j,left:g.left-30}),e(f)};return t.jsxRuntimeExports.jsxs("div",{className:Y.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Y.subtitle,children:"Button Type"}),n.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Y.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const i=[...n].map(d=>d.id===m.id?{...m,type:f}:d);s(i)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Y.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{v(f,m)}}),o&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=n.filter(g=>g.id!==m.id);s(f)},width:20,height:20,fill:"#C12A2A"})]})]},m.id)),a&&t.jsxRuntimeExports.jsx($e,{activeButton:a,setActiveButton:e,popupPosition:c}),r&&t.jsxRuntimeExports.jsxs(t.Button,{className:Y.button,size:"s",onClick:()=>{const m=[...n];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),s(m)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Xe=l=>{const{isActiveButtons:n,setIsActiveButtons:s,buttons:o,setButtons:r}=l;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:V.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{className:V.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:a=>s(a)})]}),t.jsxRuntimeExports.jsx(st,{buttons:o,setButtons:r})]})})},Qe="_wrapper_tn7gb_1",We="_subtitle_tn7gb_7",Je="_content_tn7gb_14",Ke="_range_tn7gb_21",Ze="_track_tn7gb_26",ts="_progress_tn7gb_35",es="_dots_tn7gb_45",ss="_dot_tn7gb_45",ns="_active_tn7gb_62",os="_input_tn7gb_74",is="_countBlock_tn7gb_88",cs="_count_tn7gb_88",rs="_controls_tn7gb_103",as="_button_tn7gb_108",I={wrapper:Qe,subtitle:We,content:Je,range:Ke,track:Ze,progress:ts,dots:es,dot:ss,active:ns,input:os,countBlock:is,count:cs,controls:rs,button:as},nt=l=>{const{label:n,min:s=1,max:o=4,step:r=1,count:a,setCount:e}=l,[c,x]=h.useState(!1),v=Array.from({length:(o-s)/r+1}),m=(a-s)/(o-s)*100,f=()=>{a<o&&e(a+r)},g=()=>{a>s&&e(a-r)},i=d=>{const j=s+d*r;e(j)};return t.jsxRuntimeExports.jsxs("div",{className:I.wrapper,children:[n&&t.jsxRuntimeExports.jsx("h5",{className:I.subtitle,children:n}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsxs("div",{className:I.range,children:[t.jsxRuntimeExports.jsx("div",{className:I.track}),t.jsxRuntimeExports.jsx("div",{className:I.progress,style:{width:`${m}%`}}),t.jsxRuntimeExports.jsx("div",{className:I.dots,children:v.map((d,j)=>{const N=j<=(a-s)/r;return t.jsxRuntimeExports.jsx("button",{onClick:()=>i(j),className:t.clx(I.dot,{[I.active]:N,[I.inactive]:!N,[I.dragging]:c}),"aria-label":`Set value to ${s+j*r}`},j)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:s,max:o,step:r,value:a,onChange:d=>e(Number(d.target.value)),onMouseDown:()=>x(!0),onMouseUp:()=>x(!1),onTouchStart:()=>x(!0),onTouchEnd:()=>x(!1),className:I.input})]}),t.jsxRuntimeExports.jsxs("div",{className:I.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:s,max:o,paddingless:!0,onChange:d=>{const j=Number(d);j>o?e(o):j<s?e(s):e(j)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:I.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:f,disabled:a>=o,className:I.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:a<=s,className:I.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},ls="_subtitle_1nl8x_1",us="_header_1nl8x_8",xs="_text_1nl8x_9",ds="_productsBlock_1nl8x_10",ps="_top_1nl8x_22",ms="_itemsBlock_1nl8x_29",js="_typeTexts_1nl8x_35",_s="_block_1nl8x_41",hs="_active_1nl8x_52",gs="_products_1nl8x_10",bs="_product_1nl8x_10",fs="_button_1nl8x_70",vs="_image_1nl8x_80",Rs="_info_1nl8x_87",Es="_name_1nl8x_98",ys="_buttons_1nl8x_102",ks="_modal_1nl8x_108",Is="_link_1nl8x_126",$s="_modalOptions_1nl8x_132",w={subtitle:ls,header:us,text:xs,productsBlock:ds,top:ps,itemsBlock:ms,typeTexts:js,block:_s,active:hs,products:gs,product:bs,button:fs,image:vs,info:Rs,name:Es,buttons:ys,modal:ks,link:Is,modalOptions:$s},Ns=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,setIsOpenModal:r}=l;return t.jsxRuntimeExports.jsxs("div",{className:w.modal,onClick:a=>{a.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{r(!1),s(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:w.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:a=>{const e={...n,images:a,imagePath:a[0]};s(e)}})})]})},Cs=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${w.product} ${a?w.dragging:""}`,children:o})},ws=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsOptions:d}=l,[j,N]=h.useState(null),[B,y]=h.useState({top:0,left:0}),[z,T]=h.useState(!1),q=(p,R)=>{const P=[...o],[k]=P.splice(p,1);P.splice(R,0,k),r(P)};h.useEffect(()=>{const p=()=>{N(null),T(!1)};return document.body.addEventListener("click",p),N(null),T(!1),()=>{N(null),T(!1),document.body.removeEventListener("click",p)}},[]),h.useEffect(()=>{if(j){const p=[...o].map(R=>R.id===j.id?j:R);r(p)}},[j]);const L=(p,R)=>{p.stopPropagation();const P=p.target.getBoundingClientRect(),k=100,H=window.innerHeight;let A=P.top+window.scrollY;A+k>H&&(A=H-k-20),T(!0),y({top:A-80,left:P.left-30}),N(R)};function Q(p){if(m)return p?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${p}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=(p,R)=>{const P=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const H=[...o],A=Number(k.split(" ")[1]),u=d.find(E=>E.id===A);if(!u)return;const C={...u.productData.stats,newPrice:u.productData.minPrice.amount,oldPrice:u.productData.compareAtPrice.amount},S=H.map(E=>E.id===p.id?{...p,name:k,listingId:A,stats:C}:E);N({...p,name:k,listingId:A}),r([...S])},value:p.name,options:[...d.map(k=>`Product ${k.id}`)],leftAddon:Q(p.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:k=>L(k,p)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(k=>k.id!==p.id))})]})]});return v?t.jsxRuntimeExports.jsx(Cs,{product:p,index:R,moveProduct:q,children:P},p.id):t.jsxRuntimeExports.jsx("div",{className:w.product,children:P},p.id)};return t.jsxRuntimeExports.jsxs("div",{className:w.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:w.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:p=>s==null?void 0:s(p)})]}),z&&j&&t.jsxRuntimeExports.jsx(Ns,{activeItem:j,setActiveItem:N,setIsOpenModal:T,popupPosition:B}),t.jsxRuntimeExports.jsxs("div",{className:w.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:w.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((p,R)=>X(p,R))}):o.map((p,R)=>X(p,R)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:w.button,size:"s",onClick:()=>{const p=[...o],R=d[0].id;p.push({name:`Product ${R}`,id:t.v4(),listingId:R,imagePath:"",images:[],stats:{...d[0].productData.stats,newPrice:d[0].productData.minPrice.amount,oldPrice:d[0].productData.compareAtPrice.amount}}),r(p)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]}),a!==void 0&&t.jsxRuntimeExports.jsx(tt,{items:a})]})},Bs="_options_163bj_1",Ps="_price_163bj_12",Ss="_oldPrice_163bj_18",Ts="_newPrice_163bj_26",As="_meta_163bj_33",Os="_info_163bj_39",Ds="_infoRight_163bj_46",qs="_buttons_163bj_52",Ls="_variants_163bj_59",Ms="_variant_163bj_59",Hs="_stock_163bj_74",Vs="_variantInfo_163bj_81",zs="_quantity_163bj_87",Fs="_count_163bj_93",Us="_button_163bj_52",Gs="_activeVariant_163bj_110",Ys="_chargeTypes_163bj_114",Xs="_charge_163bj_114",Qs="_chargeActive_163bj_131",b={options:Bs,price:Ps,oldPrice:Ss,newPrice:Ts,meta:As,info:Os,infoRight:Ds,buttons:qs,variants:Ls,variant:Ms,stock:Hs,variantInfo:Vs,quantity:zs,count:Fs,button:Us,activeVariant:Gs,chargeTypes:Ys,charge:Xs,chargeActive:Qs},Ws=l=>{const{variants:n}=l,[s,o]=h.useState(n[0]),r=t.useNavigate(),[a,e]=h.useState(1),{reset:c,addProductToCart:x,getProducts:v}=t.useCart();async function m(){await v(),await x({productId:l.id,productVariantId:s.id,quantity:a})}function f(){c(),m(),r("/checkout")}function g(i){if(i>=864e5){const y=Math.floor(i/864e5);return`${y} ${y===1?"day":"days"}`}else if(i>=36e5){const y=Math.floor(i/36e5);return`${y} ${y===1?"hour":"hours"}`}else if(i>=6e4){const y=Math.floor(i/6e4);return`${y} ${y===1?"minute":"minutes"}`}else{const y=Math.floor(i/1e3);return`${y} ${y===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:b.options,children:[t.jsxRuntimeExports.jsx("div",{className:b.chargeTypes,children:s.chargeTypes?s.chargeTypes.map(i=>t.jsxRuntimeExports.jsx("div",{children:i},i)):t.jsxRuntimeExports.jsx("div",{className:t.clx(b.charge,b.chargeActive),children:"One-Time"})}),t.jsxRuntimeExports.jsx("div",{className:b.variants,children:n.map(i=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(b.variant,{[b.activeVariant]:s.id===i.id}),onClick:()=>o(i),children:[t.jsxRuntimeExports.jsxs("div",{className:b.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:b.title,children:i.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",i.price.amount]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("span",{className:b.stock,children:[i.quantity.restrictions.max||0," in stock"]})})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:b.quantity,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{a>1?e(i=>i-1):e(1)},className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("div",{className:b.count,children:a}),t.jsxRuntimeExports.jsx("div",{onClick:()=>e(i=>i+1),className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:b.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:b.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:s.deliveryTime===0?"Instant":g(s.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:b.infoRight,children:s.compareAtPrice&&(s.compareAtPrice.amount||0)-(s.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:b.price,children:[t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]}),t.jsxRuntimeExports.jsxs("span",{className:b.oldPrice,children:["$ ",(s.compareAtPrice.amount||0)*a]})]}):t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>f(),children:"Buy Now"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>m(),children:"Add to Cart"})]})]})},Js="_button_1jgdy_1",Ks="_login_1jgdy_12",Zs="_signUp_1jgdy_16",tn="_buttons_1jgdy_21",en="_modal_1jgdy_28",sn="_info_1jgdy_44",nn="_top_1jgdy_50",on="_title_1jgdy_59",cn="_clear_1jgdy_65",rn="_activeClear_1jgdy_72",an="_count_1jgdy_76",ln="_cart_1jgdy_89",un="_empty_1jgdy_96",xn="_product_1jgdy_122",dn="_products_1jgdy_129",pn="_image_1jgdy_136",mn="_productInfo_1jgdy_142",jn="_content_1jgdy_148",_n="_name_1jgdy_154",hn="_price_1jgdy_160",gn="_productButtons_1jgdy_166",bn="_productButton_1jgdy_166",fn="_productCount_1jgdy_183",vn="_bottom_1jgdy_197",Rn="_subtotal_1jgdy_205",En="_block_1jgdy_211",yn="_shoppingCount_1jgdy_217",_={button:Js,login:Ks,signUp:Zs,buttons:tn,modal:en,info:sn,top:nn,title:on,clear:cn,activeClear:rn,count:an,cart:ln,empty:un,product:xn,products:dn,image:pn,productInfo:mn,content:jn,name:_n,price:hn,productButtons:gn,productButton:bn,productCount:fn,bottom:vn,subtotal:Rn,block:En,shoppingCount:yn},kn=l=>{const{shopping:n,signUp:s}=l,o=t.useNavigate();function r(a){o(a)}return t.jsxRuntimeExports.jsxs("div",{className:_.buttons,children:[n&&t.jsxRuntimeExports.jsx(ot,{}),t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login),onClick:()=>r("/customer-dash"),children:"Login"}),s&&t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login,_.signUp),onClick:()=>r("/customer-dash"),children:"Sign Up"})]})},ot=()=>{const[l,n]=h.useState(!1),{cart:s}=t.useCart();return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:_.button,onClick:o=>{o.stopPropagation(),n(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"#252525"}),s.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.shoppingCount,children:s.parts.length})]}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:n,children:t.jsxRuntimeExports.jsx(it,{})})]})},it=()=>{const{cart:l,reset:n,getProducts:s,getTotalAndDiscount:o,updateQuantityOfProduct:r}=t.useCart(),[a,e]=h.useState([]),c=t.useNavigate();function x(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].productVariantId}function v(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].quantity}function m(i){c(i)}function f(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity+1})}function g(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity-1})}return h.useEffect(()=>{(async()=>{const d=l.parts.map(B=>String(B.productId)),N=(await s([...d])).map(B=>({...B,activeVariantId:x(B),quantity:v(B)}));e(N)})()},[l]),t.jsxRuntimeExports.jsxs("div",{className:_.modal,onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:_.top,children:[t.jsxRuntimeExports.jsxs("div",{className:_.info,children:[t.jsxRuntimeExports.jsx("span",{className:_.title,children:"Cart"}),l.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.count,children:l.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(_.clear,{[_.activeClear]:l.parts.length>0}),disabled:l.parts.length===0,onClick:()=>n(),children:"Clear all"})]}),l.parts.length>0?t.jsxRuntimeExports.jsxs("div",{className:_.cart,children:[t.jsxRuntimeExports.jsx("div",{className:_.products,children:a.map(i=>t.jsxRuntimeExports.jsxs("div",{className:_.product,children:[t.jsxRuntimeExports.jsxs("div",{className:_.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:_.image}),t.jsxRuntimeExports.jsxs("div",{className:_.content,children:[t.jsxRuntimeExports.jsx("div",{className:_.name,children:i.name}),t.jsxRuntimeExports.jsxs("div",{className:_.price,children:["$",i.variants.find(d=>d.id===i.activeVariantId).price.amount*((i==null?void 0:i.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:_.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{i.quantity!==1&&g(i)},className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:_.productCount,children:i.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>f(i),className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:_.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:_.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:_.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsxs("div",{children:["$",o().total]})]}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>m("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(ct,{})]})},ct=()=>t.jsxRuntimeExports.jsxs("div",{className:_.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"})}),t.jsxRuntimeExports.jsx("span",{children:"Your cart is empty"}),t.jsxRuntimeExports.jsx("span",{children:"Check out the store's products and add them here"})]});exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.Accordion=dt;exports.ButtonTypeSettings=st;exports.ButtonsSettings=Xe;exports.EmptyCart=ct;exports.HeaderButtons=kn;exports.ItemsSettings=et;exports.LayoutSettings=It;exports.ListingSelector=ws;exports.ProductOptions=Ws;exports.RangeSelector=nt;exports.ShoppingButton=ot;exports.ShoppingModalCart=it;exports.TextSettings=Z;exports.TypesText=K;
|