@gem-sdk/core 2.0.0-dev.871 → 2.0.0-dev.878

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand");var BuilderPreviewContext=require("../contexts/BuilderPreviewContext.js"),ShopContext=require("../contexts/ShopContext.js");require("@gem-sdk/adapter-shopify"),require("swr"),require("swr/mutation"),require("vanilla-lazyload"),require("../hooks/useCartUI.js");var CreateThemeSection=require("./theme-section/CreateThemeSection.js"),AIContentGenerator=require("./ai-generator/AIContentGenerator.js"),AIGenContentLoading=require("./ai-generator/AIGenContentLoading.js"),Tooltip=require("./toolbar/Tooltip.js"),ThemeSectionStatus=require("./theme-section/ThemeSectionStatus.js"),useToolbarPostPurchase=require("../hooks/useToolbarPostPurchase.js"),Resize=require("./resize/Resize.js");require("../helpers/convert.js");const SECTION_LIMIT=25,notVisible=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},isSection=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t},ComponentToolbarPreview=e=>{let t=e.isThemeSection,i=e.isShopifySection,o=ShopContext.useShopStore(e=>e.pageType),n=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getParents),r=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getItem("ROOT")),a=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[l,s]=react.useState(null),[d,u]=react.useState(!1),[c,C]=react.useState(!1),[h,x]=react.useState([]),[m,p]=react.useState("top"),[j,g]=react.useState(!1),[b,v]=react.useState({width:"",text:""}),[S,f]=react.useState(!1),R=react.useMemo(()=>"POST_PURCHASE"===o,[o]),{checkDisableDelete:w,getTooltipText:T,checkDisableDuplicate:P}=useToolbarPostPurchase.usePostPurchase(e.uid,e.tag||""),H=(e,t)=>{let i=h.length,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();return o.top-n.top<36*i},V=(e,t)=>{let i=t||e;if(e&&!isSection(e))return notVisible(e)&&H(t,e)?e:e.parentElement?V(e.parentElement,i):void 0},M=react.useCallback(()=>{if("Section"==e.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?p("bottom"):p("top")}},[e.tag]),Z=react.useCallback(t=>{let i=t.detail;if(i?.componentUid==e.uid){M(),R&&(g(w()),v(T()),f(P()));let t=n(e.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&a||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);x(t)}else x([]),u(!1)},[e.uid,R,n,w,T,P,a,M]);if(react.useEffect(()=>(window.addEventListener("editor:active-component",Z),()=>{window.removeEventListener("editor:active-component",Z)}),[Z]),"section"===e.type||e.editorConfigs?.toolbar?.hide)return null;let E=()=>r?.childrens?.length||0,L=()=>"Section"!==e.tag?-1:r?.childrens?.length?r.childrens.findIndex(t=>t==e.uid):-1,B=e=>{if(!h.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(d)C(!1),u(!1);else{let e=V(i,i);if(e)C(!0);else{let e=i.getBoundingClientRect();e.top<36*h.length?C(!0):C(!1)}u(!0)}let o=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!d}});window.dispatchEvent(o)},q=o=>{o.preventDefault(),o.stopPropagation();let n=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t,isShopifySection:i}});return window.dispatchEvent(n),!1},y=o=>{if(o.preventDefault(),o.stopPropagation(),E()>=25&&"Section"==e.tag)return!1;let n=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t,isShopifySection:i}});return window.dispatchEvent(n),!1},I=t=>{t.preventDefault(),t.stopPropagation();let i=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:e.uid}});return window.dispatchEvent(i),!1},A=()=>{s(null),window.removeEventListener("editor:close-add-section-popup",A)},k=(t,i)=>{if(t.preventDefault(),t.stopPropagation(),E()>=25)return!1;let o=t.target;if(o){s(i);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:e.uid,position:i,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",A)}return!1},O=()=>{if(i)return`Shopify section: ${e.name}`;let t=e.name&&e.name===`Section ${e.uid}`;return E()>=20?`${t?"Section":e?.name} ${L()+1}/25`:t?`Section ${L()+1}`:e?.name};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!("Section"==e.tag&&a)&&jsxRuntime.jsxs("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==e.tag,"data-toolbar-theme-section":"Section"==e.tag&&!!t||a,"data-toolbar-shopify-section":"Section"==e.tag&&!!i,"data-toolbar-limit":L()>=25,children:[jsxRuntime.jsxs("div",{"data-toolbar-show-parent":!0,onClick:e=>B(e),"aria-hidden":"true",children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==e.tag?jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:O()}):jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:e.customLabel||e.label}),"Section"!==e.tag&&h.length>0&&jsxRuntime.jsx("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":d,children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),d&&h.map((e,t)=>{let i=e?.childrens?.length??0,o=e.label;return"Row"===e.label&&(o=i<=1?e.label+" "+i+" col":e.label+" "+i+" cols"),jsxRuntime.jsxs("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":a,"data-toolbar-parent-revert":c,style:{top:c?`${36*(t+1)}px`:`${-36*(t+1)}px`},children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:o})]},e.uid)}),"Section"===e.tag&&!e.isThemeSection&&"STATIC"!==o&&"POST_PURCHASE"!==o&&!e.isShopifySection&&25>L()&&jsxRuntime.jsx(CreateThemeSection.CreateThemeSection,{...e}),"Section"===e.tag&&!e.isShopifySection&&jsxRuntime.jsx(AIContentGenerator.AIContentGenerator,{...e}),"Sticky"==e.tag&&jsxRuntime.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>I(e),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{enable:"Section"==e.tag&&E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==e.tag&&E()>=25||S,onClick:S?void 0:e=>y(e),"aria-hidden":"true",className:S?"!gp-cursor-not-allowed":"",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{"data-toolbar-delete":!0,onClick:e=>j?null:q(e),enable:j,"data-toolbar-disable":j,width:b.width,text:b.text,position:m,"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]},e.uid),"STATIC"!==o&&"POST_PURCHASE"!==o&&25>L()&&jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatusWrapper,{...e}),jsxRuntime.jsx("div",{"data-outline":!0,"data-outline-section":"Section"==e.tag,"data-outline-theme-section":"Section"==e.tag&&!!t||a,"data-outline-shopify-section":"Section"==e.tag&&!!i,"data-outline-limit":L()>=25},"outline-"+e.uid),"Section"==e.tag&&!a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tooltip.default,{enable:E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":E()>=25,"data-toolbar-add-open":"above"==l,onClick:e=>k(e,"above"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),jsxRuntime.jsx(Tooltip.default,{enable:E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":E()>=25,"data-toolbar-add-open":"below"==l,onClick:e=>k(e,"below"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),"Section"===e.tag&&jsxRuntime.jsx(AIGenContentLoading.AIGenContentLoading,{...e}),jsxRuntime.jsx(Resize.default,{...e})]})};var ComponentToolbarPreview$1=react.memo(ComponentToolbarPreview);exports.default=ComponentToolbarPreview$1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand");var BuilderPreviewContext=require("../contexts/BuilderPreviewContext.js"),ShopContext=require("../contexts/ShopContext.js");require("@gem-sdk/adapter-shopify"),require("swr"),require("swr/mutation"),require("vanilla-lazyload"),require("../hooks/useCartUI.js");var CreateThemeSection=require("./theme-section/CreateThemeSection.js"),AIContentGenerator=require("./ai-generator/AIContentGenerator.js"),AIGenContentLoading=require("./ai-generator/AIGenContentLoading.js"),Tooltip=require("./toolbar/Tooltip.js"),ThemeSectionStatus=require("./theme-section/ThemeSectionStatus.js"),useToolbarPostPurchase=require("../hooks/useToolbarPostPurchase.js"),Resize=require("./resize/Resize.js");require("../helpers/convert.js");const SECTION_LIMIT=25,notVisible=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},isSection=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t},ComponentToolbarPreview=e=>{let t=e.isThemeSection,i=e.isShopifySection,o=ShopContext.useShopStore(e=>e.pageType),n=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getParents),l=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getItem("ROOT")),r=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[a,s]=react.useState(null),[d,u]=react.useState(!1),[C,c]=react.useState(!1),[h,x]=react.useState([]),[p,m]=react.useState("top"),[j,v]=react.useState(!1),[b,g]=react.useState({width:"",text:""}),[R,f]=react.useState(!1),w=react.useMemo(()=>"POST_PURCHASE"===o,[o]),{checkDisableDelete:S,getTooltipText:T,checkDisableDuplicate:P}=useToolbarPostPurchase.usePostPurchase(e.uid,e.tag||""),M=(e,t)=>{let i=h.length,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();return o.top-n.top<36*i},V=(e,t)=>{let i=t||e;if(e&&!isSection(e))return notVisible(e)&&M(t,e)?e:e.parentElement?V(e.parentElement,i):void 0},Z=react.useCallback(()=>{if("Section"==e.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?m("bottom"):m("top")}},[e.tag]),H=react.useCallback(t=>{let i=t.detail;if(i?.componentUid==e.uid){Z(),w&&(v(S()),g(T()),f(P()));let t=n(e.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&r||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);x(t)}else x([]),u(!1)},[e.uid,w,n,S,T,P,r,Z]);if(react.useEffect(()=>(window.addEventListener("editor:active-component",H),()=>{window.removeEventListener("editor:active-component",H)}),[H]),"section"===e.type||e.editorConfigs?.toolbar?.hide)return null;let E=()=>l?.childrens?.length||0,L=()=>"Section"!==e.tag?-1:l?.childrens?.length?l.childrens.findIndex(t=>t==e.uid):-1,y=e=>{if(!h.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(d)c(!1),u(!1);else{let e=V(i,i);if(e)c(!0);else{let e=i.getBoundingClientRect();e.top<36*h.length?c(!0):c(!1)}u(!0)}let o=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!d}});window.dispatchEvent(o)},B=o=>{o.preventDefault(),o.stopPropagation();let n=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t,isShopifySection:i}});return window.dispatchEvent(n),!1},q=o=>{if(o.preventDefault(),o.stopPropagation(),E()>=25&&"Section"==e.tag)return!1;let n=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t,isShopifySection:i}});return window.dispatchEvent(n),!1},I=t=>{t.preventDefault(),t.stopPropagation();let o=new CustomEvent("editor:toolbar:visibility-shopify-section",{bubbles:!0,detail:{componentUid:e.uid,isShopifySection:i}});return window.dispatchEvent(o),!1},A=t=>{t.preventDefault(),t.stopPropagation();let i=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:e.uid}});return window.dispatchEvent(i),!1},k=()=>{s(null),window.removeEventListener("editor:close-add-section-popup",k)},F=(t,i)=>{if(t.preventDefault(),t.stopPropagation(),E()>=25)return!1;let o=t.target;if(o){s(i);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:e.uid,position:i,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",k)}return!1},U=()=>{if(i)return`Shopify section: ${e.name}`;let t=e.name&&e.name===`Section ${e.uid}`;return E()>=20?`${t?"Section":e?.name} ${L()+1}/25`:t?`Section ${L()+1}`:e?.name};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!("Section"==e.tag&&r)&&jsxRuntime.jsxs("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==e.tag,"data-toolbar-theme-section":"Section"==e.tag&&!!t||r,"data-toolbar-shopify-section":"Section"==e.tag&&!!i,"data-toolbar-limit":L()>=25,children:[jsxRuntime.jsxs("div",{"data-toolbar-show-parent":!0,onClick:e=>y(e),"aria-hidden":"true",children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==e.tag?jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:U()}):jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:e.customLabel||e.label}),"Section"!==e.tag&&h.length>0&&jsxRuntime.jsx("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":d,children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),d&&h.map((e,t)=>{let i=e?.childrens?.length??0,o=e.label;return"Row"===e.label&&(o=i<=1?e.label+" "+i+" col":e.label+" "+i+" cols"),jsxRuntime.jsxs("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":r,"data-toolbar-parent-revert":C,style:{top:C?`${36*(t+1)}px`:`${-36*(t+1)}px`},children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:o})]},e.uid)}),"Section"===e.tag&&!e.isThemeSection&&"STATIC"!==o&&"POST_PURCHASE"!==o&&!e.isShopifySection&&25>L()&&jsxRuntime.jsx(CreateThemeSection.CreateThemeSection,{...e}),jsxRuntime.jsx(AIContentGenerator.AIContentGenerator,{...e}),"Sticky"==e.tag&&jsxRuntime.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>A(e),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{enable:"Section"==e.tag&&E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==e.tag&&E()>=25||R,onClick:R?void 0:e=>q(e),"aria-hidden":"true",className:R?"!gp-cursor-not-allowed":"",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),"Section"===e.tag&&e.isShopifySection&&jsxRuntime.jsx(Tooltip.default,{enable:!1,text:"",position:"bottom","data-toolbar-visibility":!0,onClick:e=>I(e),"aria-hidden":"true",children:e.isShopifyVisibility?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.4998 7.99841C10.499 6.61803 9.37945 5.49961 7.99909 5.50027C6.6187 5.50071 5.49975 6.61987 5.49975 8.00027C5.49975 9.38099 6.61904 10.5003 7.99975 10.5003C9.38021 10.5003 10.4996 9.38184 10.4998 8.00107V7.99841ZM7.99949 6.50027C8.82762 6.49983 9.49931 7.17081 9.49975 7.99894V8.00054C9.49975 8.8288 8.82836 9.50027 7.99975 9.50027C7.17133 9.50027 6.49975 8.8287 6.49975 8.00027C6.49975 7.172 7.17122 6.50049 7.99949 6.50027Z",fill:"white"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.99869 3.50098C4.53098 3.50106 2.24443 6.11641 1.43599 7.20809C1.0847 7.68246 1.08696 8.32021 1.43971 8.79238C2.25325 9.88131 4.55461 12.4995 7.9987 12.4995C11.5041 12.4995 13.7751 9.87636 14.5731 8.78489C14.9175 8.31382 14.915 7.68401 14.5684 7.21544C13.7641 6.12774 11.474 3.50089 7.99869 3.50098ZM2.23962 7.80322C3.016 6.75484 5.04126 4.50105 7.99871 4.50098C10.9629 4.50091 12.9916 6.76501 13.7644 7.81003C13.8513 7.92751 13.8516 8.07739 13.7658 8.19472C13.0028 9.23835 10.9929 11.4995 7.9987 11.4995C5.0648 11.4995 3.025 9.24349 2.24082 8.19386C2.15178 8.07468 2.15162 7.92206 2.23962 7.80322Z",fill:"white"})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.4998 7.99857C10.499 6.61819 9.37945 5.49977 7.99909 5.50044C6.6187 5.50088 5.49975 6.62003 5.49975 8.00044C5.49975 9.38115 6.61904 10.5004 7.99975 10.5004C9.38021 10.5004 10.4996 9.382 10.4998 8.00124V7.99857ZM7.99949 6.50044C8.82762 6.49999 9.49931 7.17097 9.49975 7.9991V8.0007C9.49975 8.82896 8.82836 9.50044 7.99975 9.50044C7.17133 9.50044 6.49975 8.82886 6.49975 8.00044C6.49975 7.17216 7.17122 6.50066 7.99949 6.50044Z",fill:"#F9F9F9"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.99869 3.50114C4.53098 3.50122 2.24443 6.11658 1.43599 7.20825C1.0847 7.68262 1.08696 8.32038 1.43971 8.79254C2.25325 9.88147 4.55461 12.4997 7.9987 12.4997C11.5041 12.4997 13.7751 9.87652 14.5731 8.78505C14.9175 8.31398 14.915 7.68417 14.5684 7.2156C13.7641 6.1279 11.474 3.50106 7.99869 3.50114ZM2.23962 7.80338C3.016 6.755 5.04126 4.50121 7.99871 4.50114C10.9629 4.50107 12.9916 6.76517 13.7644 7.81019C13.8513 7.92767 13.8516 8.07755 13.7658 8.19488C13.0028 9.23851 10.9929 11.4997 7.9987 11.4997C5.0648 11.4997 3.025 9.24365 2.24082 8.19402C2.15178 8.07484 2.15162 7.92222 2.23962 7.80338Z",fill:"#F9F9F9"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.4607 2.6163C14.6728 2.87086 14.6384 3.2492 14.3839 3.46134L2.38387 13.4613C2.1293 13.6735 1.75096 13.6391 1.53882 13.3845C1.32668 13.13 1.36108 12.7516 1.61565 12.5395L13.6156 2.53947C13.8702 2.32733 14.2486 2.36173 14.4607 2.6163Z",fill:"#F9F9F9"})]})}),jsxRuntime.jsx(Tooltip.default,{"data-toolbar-delete":!0,onClick:e=>j?null:B(e),enable:j,"data-toolbar-disable":j,width:b.width,text:b.text,position:p,"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]},e.uid),"STATIC"!==o&&"POST_PURCHASE"!==o&&25>L()&&jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatusWrapper,{...e}),jsxRuntime.jsx("div",{"data-outline":!0,"data-outline-section":"Section"==e.tag,"data-outline-theme-section":"Section"==e.tag&&!!t||r,"data-outline-shopify-section":"Section"==e.tag&&!!i,"data-outline-limit":L()>=25},"outline-"+e.uid),"Section"==e.tag&&!r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tooltip.default,{enable:E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":E()>=25,"data-toolbar-add-open":"above"==a,onClick:e=>F(e,"above"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),jsxRuntime.jsx(Tooltip.default,{enable:E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":E()>=25,"data-toolbar-add-open":"below"==a,onClick:e=>F(e,"below"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),jsxRuntime.jsx(AIGenContentLoading.AIGenContentLoading,{...e}),jsxRuntime.jsx(Resize.default,{...e})]})};var ComponentToolbarPreview$1=react.memo(ComponentToolbarPreview);exports.default=ComponentToolbarPreview$1;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),AIIcon=require("./icons/AIIcon.js"),CloseIcon=require("./icons/CloseIcon.js"),ShowMoreIcon=require("./icons/ShowMoreIcon.js"),PickProduct=require("./components/PickProduct.js"),ToneAndVoice=require("./components/ToneAndVoice.js"),classNames=require("classnames"),useListenEventGenerate=require("./hooks/useListenEventGenerate.js"),useGettingGenerateRequest=require("./hooks/useGettingGenerateRequest.js");const AIContentGenerator=({...e})=>{let[t,s]=react.useState(!1),[n,i]=react.useState(!1),[r,o]=react.useState(!1),{isGenerating:a,onGenerate:c}=useListenEventGenerate.useListenEventGenerate(e.uid),{getRequestBody:p,prompt:g,changeProductName:u,changePrompt:l}=useGettingGenerateRequest.useGettingGenerateRequest(),m=()=>{s(!t)},d=()=>{s(!1)},x=e=>{l(e.target.value)},j=react.useCallback(t=>{let s=t.detail;s?.componentUid!==e.uid?(i(!1),d()):i(!0)},[e.uid]),h=()=>{o(!r)},R=()=>{let e=p();c(e)};return react.useEffect(()=>{a||d()},[a]),react.useEffect(()=>(window.addEventListener("editor:active-component",j),()=>{window.removeEventListener("editor:active-component",j)}),[j]),jsxRuntime.jsxs("div",{className:`gp-relative ${!n&&"gp-hidden"}`,children:[jsxRuntime.jsx("div",{className:"gp-border-r-[#6a6a6a] gp-border-r gp-pr-1 gp-mr-1",children:jsxRuntime.jsxs("button",{className:"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium",onClick:m,children:[jsxRuntime.jsx(AIIcon.AIIcon,{}),"AI Content"]})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!t},"gp-absolute gp-top-8 gp-right-0 gp-rounded-lg gp-bg-[#151515] gp-p-4 gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-justify-between gp-mb-4",children:[jsxRuntime.jsx("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),jsxRuntime.jsx("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:d,children:jsxRuntime.jsx(CloseIcon.CloseIcon,{})})]}),jsxRuntime.jsxs("div",{className:"gp-mt-2",children:[jsxRuntime.jsx("div",{className:"gp-mb-4",children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),jsxRuntime.jsx("div",{className:"gp-mb-4 gp-flex",children:jsxRuntime.jsx("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: Generate feature benefits",rows:4,value:g,onChange:x})}),jsxRuntime.jsx("div",{className:"gp-mb-4",children:jsxRuntime.jsxs("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:h,children:["Show more",jsxRuntime.jsx("span",{className:classNames({"gp-rotate-180":r}),children:jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon,{})})]})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!r},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[jsxRuntime.jsx(ToneAndVoice.ToneAndVoice,{}),jsxRuntime.jsx(PickProduct.PickProduct,{changeProductName:u})]}),jsxRuntime.jsx("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:R,children:a?"Generating...":"Generate"})]})]})]})};exports.AIContentGenerator=AIContentGenerator;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),AIIcon=require("./icons/AIIcon.js"),CloseIcon=require("./icons/CloseIcon.js"),ShowMoreIcon=require("./icons/ShowMoreIcon.js"),PickProduct=require("./components/PickProduct.js"),ToneAndVoice=require("./components/ToneAndVoice.js"),classNames=require("classnames"),useListenEventGenerate=require("./hooks/useListenEventGenerate.js"),useGettingGenerateRequest=require("./hooks/useGettingGenerateRequest.js");const AIContentGenerator=({...e})=>{let[t,s]=react.useState(!1),[n,i]=react.useState(!1),{isGenerating:r,onGenerate:o}=useListenEventGenerate.useListenEventGenerate({uid:e.uid,tag:String(e.tag)}),{getRequestBody:a,prompt:c,changeProductName:g,changePrompt:p}=useGettingGenerateRequest.useGettingGenerateRequest(),u=()=>{s(!t)},l=()=>{s(!1)},m=e=>{p(e.target.value)},d=react.useCallback(t=>{let s=t.detail;s?.componentUid!==e.uid&&l()},[e.uid]),x=()=>{i(!n)},j=()=>{let e=a();o(e)};return react.useEffect(()=>{r||l()},[r]),react.useEffect(()=>(window.addEventListener("editor:active-component",d),()=>{window.removeEventListener("editor:active-component",d)}),[d]),jsxRuntime.jsxs("div",{className:"gp-relative",children:[jsxRuntime.jsx("div",{className:"gp-border-r-[#6a6a6a]"}),jsxRuntime.jsx("div",{className:"gp-border-r-[#6a6a6a] gp-border-r gp-pr-1 gp-mr-1",children:jsxRuntime.jsxs("button",{className:"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium",onClick:u,children:[jsxRuntime.jsx(AIIcon.AIIcon,{}),"AI Content"]})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!t,"gp-right-0":"Section"===e.tag,"gp-left-0":"Section"!==e.tag},"gp-absolute gp-top-8 gp-right-0 gp-rounded-lg gp-bg-[#151515] gp-p-4 gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-justify-between gp-mb-4",children:[jsxRuntime.jsx("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),jsxRuntime.jsx("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:l,children:jsxRuntime.jsx(CloseIcon.CloseIcon,{})})]}),jsxRuntime.jsxs("div",{className:"gp-mt-2",children:[jsxRuntime.jsx("div",{className:"gp-mb-4",children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),jsxRuntime.jsx("div",{className:"gp-mb-4 gp-flex",children:jsxRuntime.jsx("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: Generate feature benefits",rows:4,value:c,onChange:m})}),jsxRuntime.jsx("div",{className:"gp-mb-4",children:jsxRuntime.jsxs("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:x,children:["Show more",jsxRuntime.jsx("span",{className:classNames({"gp-rotate-180":n}),children:jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon,{})})]})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!n},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[jsxRuntime.jsx(ToneAndVoice.ToneAndVoice,{}),jsxRuntime.jsx(PickProduct.PickProduct,{changeProductName:g})]}),jsxRuntime.jsx("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:j,children:r?"Generating...":"Generate"})]})]})]})};exports.AIContentGenerator=AIContentGenerator;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react");const AIGenContentLoading=({...e})=>{let[t,n]=react.useState(!1),[r,s]=react.useState(1),a=react.useRef(null),i=react.useCallback(t=>{let r=t.detail;if(r?.sectionUid===e.uid){if("loading"===r.status){n(!0);return}if("success"===r.status){n(!1);return}}},[e.uid]);return react.useEffect(()=>{if(t){a.current=setInterval(()=>{s(e=>3===e?1:e+1)},500);return}a.current&&clearInterval(a.current)},[t]),react.useEffect(()=>(window.addEventListener("editor:ai-generate-content-status",i),()=>{window.removeEventListener("editor:ai-generate-content-status",i)}),[i]),t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-white gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center",children:jsxRuntime.jsxs("span",{className:"gp-font-medium",children:["Generating Content",Array.from(Array(r).keys()).map(()=>".")]})})}):null};exports.AIGenContentLoading=AIGenContentLoading;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react");const AIGenContentLoading=({...e})=>{let[t,n]=react.useState(!1),[r,a]=react.useState(1),s=react.useRef(null),i=react.useCallback(t=>{let r=t.detail;if(r?.sectionUid===e.uid){if("loading"===r.status){n(!0);return}if("success"===r.status){n(!1);return}}},[e.uid]);return react.useEffect(()=>{if(t){s.current=setInterval(()=>{a(e=>3===e?1:e+1)},500);return}s.current&&clearInterval(s.current)},[t]),react.useEffect(()=>(window.addEventListener("editor:ai-generate-content-status",i),()=>{window.removeEventListener("editor:ai-generate-content-status",i)}),[i]),t?jsxRuntime.jsx("div",{className:"gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-white gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center",children:jsxRuntime.jsxs("span",{className:"gp-font-medium",children:["Generating Content",Array.from(Array(r).keys()).map(()=>".")]})}):null};exports.AIGenContentLoading=AIGenContentLoading;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand"),require("swr"),require("@gem-sdk/adapter-shopify"),require("swr/mutation");var useProductsQuery=require("../../../hooks/shop/use-products-query.js");require("vanilla-lazyload"),require("../../../hooks/useCartUI.js"),require("react-transition-group"),require("@gem-sdk/core"),require("classnames"),require("../../../helpers/convert.js");const PickProduct=e=>{let{data:s,isLoading:r}=useProductsQuery.useProductsQuery([]),[t,a]=react.useState(),[i,u]=react.useState(!1),g=()=>{u(!i)},p=e=>{a(e),u(!1)};return react.useEffect(()=>{if(s?.products?.edges.length&&!t){let e=s.products.edges[0]?.node;e&&a({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[s,t]),react.useEffect(()=>{t&&t.name&&e.changeProductName(t.name)},[t,e]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[jsxRuntime.jsx("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),jsxRuntime.jsxs("div",{className:"gp-relative",children:[r?jsxRuntime.jsx("div",{children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"Getting products..."})}):jsxRuntime.jsxs("button",{className:"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:g,children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:t?.image,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px]",children:t?.name})]}),i&&jsxRuntime.jsx("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:s?.products?.edges.map(e=>jsxRuntime.jsxs("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{p({id:e.node?.id,name:e.node?.title,image:e.node?.featuredImage?.src})},children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:e.node?.featuredImage?.src,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:e.node?.title})]},e.node?.id))})]})]})})};exports.PickProduct=PickProduct;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand"),require("swr"),require("@gem-sdk/adapter-shopify"),require("swr/mutation");var useProductsQuery=require("../../../hooks/shop/use-products-query.js");require("vanilla-lazyload"),require("../../../hooks/useCartUI.js"),require("react-transition-group"),require("@gem-sdk/core"),require("classnames"),require("../../../helpers/convert.js");const PickProduct=e=>{let{data:s,isLoading:r}=useProductsQuery.useProductsQuery([]),[t,a]=react.useState(),[g,u]=react.useState(!1),i=()=>{u(!g)},p=e=>{a(e),u(!1)};return react.useEffect(()=>{if(s?.products?.edges.length&&!t){let e=s.products.edges[0]?.node;e&&a({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[s,t]),react.useEffect(()=>{t&&t.name&&e.changeProductName(t.name)},[t,e]),jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[jsxRuntime.jsx("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),jsxRuntime.jsxs("div",{className:"gp-relative",children:[r?jsxRuntime.jsx("div",{children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"Getting products..."})}):jsxRuntime.jsxs("button",{className:"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:i,children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:t?.image,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px]",children:t?.name})]}),g&&jsxRuntime.jsx("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:s?.products?.edges.map(e=>jsxRuntime.jsxs("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{p({id:e.node?.id,name:e.node?.title,image:e.node?.featuredImage?.src})},children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:e.node?.featuredImage?.src,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:e.node?.title})]},e.node?.id))})]})]})};exports.PickProduct=PickProduct;
@@ -1 +1 @@
1
- "use strict";var react=require("react");const useListenEventGenerate=e=>{let[t,n]=react.useState(!1),s=t=>{let s=new CustomEvent("editor:toolbar:ai-generate-content",{bubbles:!0,detail:{componentUid:e,genRequest:t}});window.dispatchEvent(s),n(!0),a("loading")},a=t=>{let n=new CustomEvent("editor:ai-generate-content-status",{bubbles:!0,detail:{status:t,sectionUid:e}});window.dispatchEvent(n)},i=react.useCallback(t=>{let s=t.detail;s?.sectionUid===e&&"success"===s.status&&n(!1)},[e]);return react.useEffect(()=>(window.addEventListener("editor:ai-generate-content-status",i),()=>{window.removeEventListener("editor:ai-generate-content-status",i)}),[i]),{isGenerating:t,onGenerate:s}};exports.useListenEventGenerate=useListenEventGenerate;
1
+ "use strict";var react=require("react");const useListenEventGenerate=e=>{let{uid:t,tag:n}=e,[s,a]=react.useState(!1),i=e=>{let s=new CustomEvent("editor:toolbar:ai-generate-content",{bubbles:!0,detail:{componentUid:t,componentTag:n,genRequest:e}});window.dispatchEvent(s),a(!0),r("loading")},r=e=>{let n=new CustomEvent("editor:ai-generate-content-status",{bubbles:!0,detail:{status:e,sectionUid:t}});window.dispatchEvent(n)},o=react.useCallback(e=>{let n=e.detail;n?.sectionUid===t&&"success"===n.status&&a(!1)},[t]);return react.useEffect(()=>(window.addEventListener("editor:ai-generate-content-status",o),()=>{window.removeEventListener("editor:ai-generate-content-status",o)}),[o]),{isGenerating:s,onGenerate:i}};exports.useListenEventGenerate=useListenEventGenerate;
@@ -1 +1 @@
1
- "use strict";const disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","ProductImagesV2","PostPurchaseProductImages","Sticky","Heading"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"],excludeApplyStyle=["IconListV2","IconList"],postPurchaseRequiredElements=["PostPurchaseProductOffer","PostPurchaseProductTitle","PostPurchaseProductPrice","PostPurchaseAcceptButton","PostPurchaseButton","PostPurchaseCalloutBox","PostPurchaseProductPriceBreakdown","PostPurchaseProductImages","PostPurchaseCalloutText"],postPurchaseWrapElements=["Row","Section","PostPurchaseCalloutBox","PostPurchaseProductOffer"];exports.customRenderChildren=customRenderChildren,exports.disableWrap=disableWrap,exports.excludeApplyStyle=excludeApplyStyle,exports.postPurchaseRequiredElements=postPurchaseRequiredElements,exports.postPurchaseWrapElements=postPurchaseWrapElements;
1
+ "use strict";const disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","ProductImagesV2","PostPurchaseProductImages","Sticky","Heading","ProductBadge","Marquee"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"],excludeApplyStyle=["IconListV2","IconList","ProductBadge"],postPurchaseRequiredElements=["PostPurchaseProductOffer","PostPurchaseProductTitle","PostPurchaseProductPrice","PostPurchaseAcceptButton","PostPurchaseButton","PostPurchaseCalloutBox","PostPurchaseProductPriceBreakdown","PostPurchaseProductImages","PostPurchaseCalloutText"],postPurchaseWrapElements=["Row","Section","PostPurchaseCalloutBox","PostPurchaseProductOffer"];exports.customRenderChildren=customRenderChildren,exports.disableWrap=disableWrap,exports.excludeApplyStyle=excludeApplyStyle,exports.postPurchaseRequiredElements=postPurchaseRequiredElements,exports.postPurchaseWrapElements=postPurchaseWrapElements;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),zustand=require("zustand"),cloneDeep=require("../helpers/clone-deep.js"),normalizeBuilderData=require("../helpers/normalize-builder-data.js");function moveByIndex(e,t,i){let r=e.splice(t,1)[0];void 0!==r&&e.splice(i,0,r)}function removeByKey(e,t){let i=t[e];i&&(delete t[e],"section"!==i.type&&i.childrens?.map(e=>removeByKey(e,t)))}const BuilderPreviewContext=react.createContext(null),root={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},createBuilderPreviewProvider=(e,t)=>zustand.createStore((i,r)=>({state:e,loaded:!1,isThemeSectionEditor:!!t,dynamicProduct:null,dynamicCollection:null,addItem:e=>{let{position:t,data:l}=e,n=r().state,s=Date.now();if("section"===e.type){if(!Array.isArray(l)){let e=l.uid,r=n.ROOT;r.childrens?r.childrens.splice(t??0,0,e):r.childrens=[e],r.dateModified=s,i({state:{...n,[e]:{uid:e,type:"section",label:l.label},ROOT:cloneDeep.cloneDeep(r)}})}}else{let{id:r,data:l}=e,d=r?n[r]??n.ROOT:n.ROOT;if("section"===d.type)return;if(Array.isArray(l)){let e=l.map(e=>e.uid),r=l.reduceRight((e,t)=>{let i=normalizeBuilderData.normalizeBuilderData(t);return{...e,...i}},{});d.dateModified=s,d.childrens=d.childrens??[],d.childrens.splice(t??0,0,...e),i({state:{...n,...r,[d.uid]:cloneDeep.cloneDeep(d)}})}else{let e=normalizeBuilderData.normalizeBuilderData(l);d.dateModified=s,d.childrens=d.childrens??[],d.childrens.splice(t??0,0,l.uid),i({state:{...n,...e,[d.uid]:cloneDeep.cloneDeep(d)}})}}},changeItemProp:(e,t,l)=>{if(!l||!["setting","style","advanced"].includes(l))return;let n=r().state,s=n[e];if(s?.type!=="section"&&s){let r=Date.now();switch(s.dateModified=r,l){case"setting":i({state:{...n,[e]:{...s,settings:{...s.settings,...t}}}});break;case"style":i({state:{...n,[e]:{...s,styles:{...s.styles,...t}}}});break;case"advanced":i({state:{...n,[e]:{...s,advanced:{...s.advanced,...t}}}})}}},forceChangeItemProp:(e,t,l)=>{if(!l||!["setting","style","advanced"].includes(l))return;let n=r().state,s=n[e];if(s?.type!=="section"&&s){let r=Date.now();switch(s.dateModified=r,l){case"setting":i({state:{...n,[e]:{...s,settings:t}}});break;case"style":i({state:{...n,[e]:{...s,styles:t}}});break;case"advanced":i({state:{...n,[e]:{...s,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:l,group:n})=>{if(!n||!["setting","style","advanced"].includes(n))return;let s=r().state,d=s[e];if(d?.type!=="section"&&d){let r={style:d.styles??{},advanced:d.advanced??{},setting:d.settings??{}};void 0===l?(console.warn("Data is undefined"),delete r[n][t]):r[n][t]=l,i({state:{...s,[e]:{...d,settings:{...r.setting},styles:{...r.style},advanced:{...r.advanced}}}})}},getItem:e=>r().state[e],removeItem:e=>{if("ROOT"===e)i({state:{ROOT:root}});else{let t=r().state;removeByKey(e,t);let l=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(l){let r=Date.now(),[n,s]=l;if("section"===s.type)return;s.childrens=s.childrens?.filter(t=>t!==e),s.dateModified=r,i({state:{...t,[n]:cloneDeep.cloneDeep(s)}})}}},moveItem:(e,t,l)=>{let n=r().state,s=n[e],d=n[t];if(s&&d&&"section"!==d.type){if("section"===s.type){let t=n.ROOT;if(!t.childrens)return;let r=t.childrens.findIndex(t=>t===e);moveByIndex(t.childrens,r,l??0),i({state:{...n,ROOT:cloneDeep.cloneDeep(t)}})}else{let r=Object.entries(n).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(s&&r){let a=Date.now(),[,c]=r;if("section"===c.type)return;if(c.dateModified=a,t===c.uid&&c.childrens){let t=c.childrens.findIndex(t=>t===e);c.childrens&&t!==l&&(moveByIndex(c.childrens,t,l??0),i({state:{...n,[c.uid]:cloneDeep.cloneDeep(c)}}))}else c.childrens=c.childrens?.filter(t=>t!==e),d&&(d.dateModified=a,d.childrens=d.childrens??[],d.childrens.splice(l??0,0,s.uid),i({state:{...n,[d.uid]:cloneDeep.cloneDeep(d),[c.uid]:cloneDeep.cloneDeep(c)}}))}}}},forceChangeState:e=>{i({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),r=e.reduceRight((e,t)=>{let i=normalizeBuilderData.normalizeBuilderData(t);return{...e,...i}},{});i({loaded:!0,state:{ROOT:{...root,childrens:t},...r}})}else{let t=normalizeBuilderData.normalizeBuilderData(e);i({loaded:!0,state:{ROOT:{...root,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let l=r().state,n=l.ROOT;n.childrens||(n.childrens=[]),n.childrens.splice(t??0,0,e.uid),i({state:{...l,ROOT:cloneDeep.cloneDeep(n)}})},getParents:(e,t)=>{let i=r().state,l=[],n=0,s=e;for(;!t||!(n>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(s));if(!e)break;let[,t]=e;if(!t)break;l.push(t),s=t.uid,n++}return l},updateItemName:(e,t)=>{let l=r().state,n=l[e];n&&(n.name=t,i({state:{...l,[e]:cloneDeep.cloneDeep(n)}}))},updateItemAttribute:(e,t,l)=>{if(!l||!["label","customLabel"].includes(l))return;let n=r().state,s=n[e];if(s?.type!=="section"&&s){let r=Date.now();s.dateModified=r;let d={...s,[l]:t};i({state:{...n,[e]:d}})}}})),BuilderPreviewProvider=({children:e,state:t,isThemeSectionEditor:i,lazy:r,...l})=>{let n=r?react.Suspense:react.Fragment,s=react.useMemo(()=>createBuilderPreviewProvider(t,i),[t,i]);return jsxRuntime.jsx(n,{children:jsxRuntime.jsx(BuilderPreviewContext.Provider,{...l,value:s,children:e})})},useBuilderPreviewStore=(e,t)=>{let i=react.useContext(BuilderPreviewContext);if(!i)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return zustand.useStore(i,e,t)};exports.BuilderPreviewProvider=BuilderPreviewProvider,exports.useBuilderPreviewStore=useBuilderPreviewStore;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),zustand=require("zustand"),cloneDeep=require("../helpers/clone-deep.js"),normalizeBuilderData=require("../helpers/normalize-builder-data.js");function moveByIndex(e,t,i){let r=e.splice(t,1)[0];void 0!==r&&e.splice(i,0,r)}function removeByKey(e,t){let i=t[e];i&&(delete t[e],"section"!==i.type&&i.childrens?.map(e=>removeByKey(e,t)))}const BuilderPreviewContext=react.createContext(null),root={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},createBuilderPreviewProvider=(e,t)=>zustand.createStore((i,r)=>({state:e,loaded:!1,isThemeSectionEditor:!!t,dynamicProduct:null,dynamicCollection:null,addItem:e=>{let{position:t,data:l}=e,s=r().state,n=Date.now();if("section"===e.type){if(!Array.isArray(l)){let e=l.uid,r=s.ROOT;r.childrens?r.childrens.splice(t??0,0,e):r.childrens=[e],r.dateModified=n,i({state:{...s,[e]:{uid:e,type:"section",label:l.label},ROOT:cloneDeep.cloneDeep(r)}})}}else{let{id:r,data:l}=e,d=r?s[r]??s.ROOT:s.ROOT;if("section"===d.type)return;if(Array.isArray(l)){let e=l.map(e=>e.uid),r=l.reduceRight((e,t)=>{let i=normalizeBuilderData.normalizeBuilderData(t);return{...e,...i}},{});d.dateModified=n,d.childrens=d.childrens??[],d.childrens.splice(t??0,0,...e),i({state:{...s,...r,[d.uid]:cloneDeep.cloneDeep(d)}})}else{let e=normalizeBuilderData.normalizeBuilderData(l);d.dateModified=n,d.childrens=d.childrens??[],d.childrens.splice(t??0,0,l.uid),i({state:{...s,...e,[d.uid]:cloneDeep.cloneDeep(d)}})}}},changeItemProp:(e,t,l)=>{if(!l||!["setting","style","advanced"].includes(l))return;let s=r().state,n=s[e];if(n?.type!=="section"&&n){let r=Date.now();switch(n.dateModified=r,l){case"setting":i({state:{...s,[e]:{...n,settings:{...n.settings,...t}}}});break;case"style":i({state:{...s,[e]:{...n,styles:{...n.styles,...t}}}});break;case"advanced":i({state:{...s,[e]:{...n,advanced:{...n.advanced,...t}}}})}}},forceChangeItemProp:(e,t,l)=>{if(!l||!["setting","style","advanced"].includes(l))return;let s=r().state,n=s[e];if(n?.type!=="section"&&n){let r=Date.now();switch(n.dateModified=r,l){case"setting":i({state:{...s,[e]:{...n,settings:t}}});break;case"style":i({state:{...s,[e]:{...n,styles:t}}});break;case"advanced":i({state:{...s,[e]:{...n,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:l,group:s})=>{if(!s||!["setting","style","advanced"].includes(s))return;let n=r().state,d=n[e];if(d?.type!=="section"&&d){let r={style:d.styles??{},advanced:d.advanced??{},setting:d.settings??{}};void 0===l?(console.warn("Data is undefined"),delete r[s][t]):r[s][t]=l,i({state:{...n,[e]:{...d,settings:{...r.setting},styles:{...r.style},advanced:{...r.advanced}}}})}},getItem:e=>r().state[e],removeItem:e=>{if("ROOT"===e)i({state:{ROOT:root}});else{let t=r().state;removeByKey(e,t);let l=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(l){let r=Date.now(),[s,n]=l;if("section"===n.type)return;n.childrens=n.childrens?.filter(t=>t!==e),n.dateModified=r,i({state:{...t,[s]:cloneDeep.cloneDeep(n)}})}}},moveItem:(e,t,l)=>{let s=r().state,n=s[e],d=s[t];if(n&&d&&"section"!==d.type){if("section"===n.type){let t=s.ROOT;if(!t.childrens)return;let r=t.childrens.findIndex(t=>t===e);moveByIndex(t.childrens,r,l??0),i({state:{...s,ROOT:cloneDeep.cloneDeep(t)}})}else{let r=Object.entries(s).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(n&&r){let a=Date.now(),[,c]=r;if("section"===c.type)return;if(c.dateModified=a,t===c.uid&&c.childrens){let t=c.childrens.findIndex(t=>t===e);c.childrens&&t!==l&&(moveByIndex(c.childrens,t,l??0),i({state:{...s,[c.uid]:cloneDeep.cloneDeep(c)}}))}else c.childrens=c.childrens?.filter(t=>t!==e),d&&(d.dateModified=a,d.childrens=d.childrens??[],d.childrens.splice(l??0,0,n.uid),i({state:{...s,[d.uid]:cloneDeep.cloneDeep(d),[c.uid]:cloneDeep.cloneDeep(c)}}))}}}},forceChangeState:e=>{i({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),r=e.reduceRight((e,t)=>{let i=normalizeBuilderData.normalizeBuilderData(t);return{...e,...i}},{});i({loaded:!0,state:{ROOT:{...root,childrens:t},...r}})}else{let t=normalizeBuilderData.normalizeBuilderData(e);i({loaded:!0,state:{ROOT:{...root,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let l=r().state,s=l.ROOT;s.childrens||(s.childrens=[]),s.childrens.splice(t??0,0,e.uid),i({state:{...l,ROOT:cloneDeep.cloneDeep(s)}})},getParents:(e,t)=>{let i=r().state,l=[],s=0,n=e;for(;!t||!(s>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(n));if(!e)break;let[,t]=e;if(!t)break;l.push(t),n=t.uid,s++}return l},updateItemName:(e,t)=>{let l=r().state,s=l[e];s&&(s.name=t,i({state:{...l,[e]:cloneDeep.cloneDeep(s)}}))},updateItemAttribute:(e,t,l)=>{if(!l||!["label","customLabel","isShopifyVisibility"].includes(l))return;let s=r().state,n=s[e];if(n){if("section"!==n.type){let e=Date.now();n.dateModified=e}let r={...n,[l]:t};i({state:{...s,[e]:r}})}}})),BuilderPreviewProvider=({children:e,state:t,isThemeSectionEditor:i,lazy:r,...l})=>{let s=r?react.Suspense:react.Fragment,n=react.useMemo(()=>createBuilderPreviewProvider(t,i),[t,i]);return jsxRuntime.jsx(s,{children:jsxRuntime.jsx(BuilderPreviewContext.Provider,{...l,value:n,children:e})})},useBuilderPreviewStore=(e,t)=>{let i=react.useContext(BuilderPreviewContext);if(!i)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return zustand.useStore(i,e,t)};exports.BuilderPreviewProvider=BuilderPreviewProvider,exports.useBuilderPreviewStore=useBuilderPreviewStore;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),zustand=require("zustand"),react=require("react"),cloneDeep=require("../helpers/clone-deep.js"),normalizeBuilderData=require("../helpers/normalize-builder-data.js");const SectionContext=react.createContext(null),createSectionProvider=e=>zustand.createStore((t,r)=>({data:e??{},getSection:e=>{let t=r().data[e];return t??void 0},addSection:(e,r)=>{let o=normalizeBuilderData.normalizeBuilderData(r);t(t=>({data:{...t.data,[e]:cloneDeep.cloneDeep(o)}}))},removeSection:e=>{t(t=>{let{[e]:r,...o}=t.data;return{data:o}})}})),SectionProvider=({children:e,data:t,...r})=>jsxRuntime.jsx(SectionContext.Provider,{...r,value:createSectionProvider(t),children:e}),useSectionStore=(e,t)=>{let r=react.useContext(SectionContext);if(!r)throw Error("useSectionStore must be used within a SectionProvider");return zustand.useStore(r,e,t)},useSection=e=>useSectionStore(t=>t.getSection(e));exports.SectionProvider=SectionProvider,exports.useSection=useSection,exports.useSectionStore=useSectionStore;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),zustand=require("zustand"),react=require("react"),cloneDeep=require("../helpers/clone-deep.js"),normalizeBuilderData=require("../helpers/normalize-builder-data.js");const SectionContext=react.createContext(null),createSectionProvider=e=>zustand.createStore((t,r)=>({data:e??{},getSection:e=>{console.log("get().data",r().data);let t=r().data[e];return t??void 0},addSection:(e,r)=>{let o=normalizeBuilderData.normalizeBuilderData(r);t(t=>({data:{...t.data,[e]:cloneDeep.cloneDeep(o)}}))},removeSection:e=>{t(t=>{let{[e]:r,...o}=t.data;return{data:o}})}})),SectionProvider=({children:e,data:t,...r})=>jsxRuntime.jsx(SectionContext.Provider,{...r,value:createSectionProvider(t),children:e}),useSectionStore=(e,t)=>{let r=react.useContext(SectionContext);if(!r)throw Error("useSectionStore must be used within a SectionProvider");return zustand.useStore(r,e,t)},useSection=e=>useSectionStore(t=>t.getSection(e));exports.SectionProvider=SectionProvider,exports.useSection=useSection,exports.useSectionStore=useSectionStore;
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{memo as i,useState as n,useMemo as l,useCallback as a,useEffect as r}from"react";import"zustand";import{useBuilderPreviewStore as d}from"../contexts/BuilderPreviewContext.js";import{useShopStore as C}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import{CreateThemeSection as c}from"./theme-section/CreateThemeSection.js";import{AIContentGenerator as p}from"./ai-generator/AIContentGenerator.js";import{AIGenContentLoading as s}from"./ai-generator/AIGenContentLoading.js";import h from"./toolbar/Tooltip.js";import{ThemeSectionStatusWrapper as u}from"./theme-section/ThemeSectionStatus.js";import{usePostPurchase as m}from"../hooks/useToolbarPostPurchase.js";import g from"./resize/Resize.js";import"../helpers/convert.js";let SECTION_LIMIT=25,notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},ComponentToolbarPreview=i=>{let b=i.isThemeSection,f=i.isShopifySection,v=C(t=>t.pageType),w=d(t=>t.getParents),S=d(t=>t.getItem("ROOT")),H=d(t=>t.isThemeSectionEditor),[V,x]=n(null),[M,T]=n(!1),[Z,E]=n(!1),[P,L]=n([]),[R,y]=n("top"),[B,j]=n(!1),[k,I]=n({width:"",text:""}),[U,$]=n(!1),A=l(()=>"POST_PURCHASE"===v,[v]),{checkDisableDelete:O,getTooltipText:z,checkDisableDuplicate:D}=m(i.uid,i.tag||""),_=(t,e)=>{let o=P.length,i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.top-n.top<36*o},G=(t,e)=>{let o=e||t;if(t&&!isSection(t))return notVisible(t)&&_(e,t)?t:t.parentElement?G(t.parentElement,o):void 0},N=a(()=>{if("Section"==i.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?y("bottom"):y("top")}},[i.tag]),q=a(t=>{let e=t.detail;if(e?.componentUid==i.uid){N(),A&&(j(O()),I(z()),$(D()));let t=w(i.uid).filter(t=>!("ROOT"===t.uid||"Section"===t.tag&&H||t.editorConfigs?.toolbar?.hide||t.editorConfigs?.component?.noSetting)).slice(0,3);L(t)}else L([]),T(!1)},[i.uid,A,w,O,z,D,H,N]);if(r(()=>(window.addEventListener("editor:active-component",q),()=>{window.removeEventListener("editor:active-component",q)}),[q]),"section"===i.type||i.editorConfigs?.toolbar?.hide)return null;let F=()=>S?.childrens?.length||0,J=()=>"Section"!==i.tag?-1:S?.childrens?.length?S.childrens.findIndex(t=>t==i.uid):-1,K=t=>{if(!P.length)return;let e=t?.target||null,o=e.closest("[data-toolbar-active]");if(!e||!o)return;if(M)E(!1),T(!1);else{let t=G(o,o);if(t)E(!0);else{let t=o.getBoundingClientRect();t.top<36*P.length?E(!0):E(!1)}T(!0)}let i=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!M}});window.dispatchEvent(i)},Q=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:i.uid,isThemeSection:b,isShopifySection:f}});return window.dispatchEvent(e),!1},W=t=>{if(t.preventDefault(),t.stopPropagation(),F()>=25&&"Section"==i.tag)return!1;let e=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:i.uid,isThemeSection:b,isShopifySection:f}});return window.dispatchEvent(e),!1},X=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:i.uid}});return window.dispatchEvent(e),!1},Y=()=>{x(null),window.removeEventListener("editor:close-add-section-popup",Y)},tt=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),F()>=25)return!1;let o=t.target;if(o){x(e);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:i.uid,position:e,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",Y)}return!1},te=()=>{if(f)return`Shopify section: ${i.name}`;let t=i.name&&i.name===`Section ${i.uid}`;return F()>=20?`${t?"Section":i?.name} ${J()+1}/25`:t?`Section ${J()+1}`:i?.name};return t(e,{children:[!("Section"==i.tag&&H)&&t("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==i.tag,"data-toolbar-theme-section":"Section"==i.tag&&!!b||H,"data-toolbar-shopify-section":"Section"==i.tag&&!!f,"data-toolbar-limit":J()>=25,children:[t("div",{"data-toolbar-show-parent":!0,onClick:t=>K(t),"aria-hidden":"true",children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==i.tag?o("div",{"data-toolbar-name":!0,children:te()}):o("div",{"data-toolbar-name":!0,children:i.customLabel||i.label}),"Section"!==i.tag&&P.length>0&&o("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":M,children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),M&&P.map((e,i)=>{let n=e?.childrens?.length??0,l=e.label;return"Row"===e.label&&(l=n<=1?e.label+" "+n+" col":e.label+" "+n+" cols"),t("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":H,"data-toolbar-parent-revert":Z,style:{top:Z?`${36*(i+1)}px`:`${-36*(i+1)}px`},children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),o("div",{"data-toolbar-name":!0,children:l})]},e.uid)}),"Section"===i.tag&&!i.isThemeSection&&"STATIC"!==v&&"POST_PURCHASE"!==v&&!i.isShopifySection&&25>J()&&o(c,{...i}),"Section"===i.tag&&!i.isShopifySection&&o(p,{...i}),"Sticky"==i.tag&&o("div",{"data-toolbar-zoom-out":!0,onClick:t=>X(t),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),o(h,{enable:"Section"==i.tag&&F()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==i.tag&&F()>=25||U,onClick:U?void 0:t=>W(t),"aria-hidden":"true",className:U?"!gp-cursor-not-allowed":"",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),o(h,{"data-toolbar-delete":!0,onClick:t=>B?null:Q(t),enable:B,"data-toolbar-disable":B,width:k.width,text:k.text,position:R,"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]},i.uid),"STATIC"!==v&&"POST_PURCHASE"!==v&&25>J()&&o(u,{...i}),o("div",{"data-outline":!0,"data-outline-section":"Section"==i.tag,"data-outline-theme-section":"Section"==i.tag&&!!b||H,"data-outline-shopify-section":"Section"==i.tag&&!!f,"data-outline-limit":J()>=25},"outline-"+i.uid),"Section"==i.tag&&!H&&t(e,{children:[o(h,{enable:F()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":F()>=25,"data-toolbar-add-open":"above"==V,onClick:t=>tt(t,"above"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),o(h,{enable:F()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":F()>=25,"data-toolbar-add-open":"below"==V,onClick:t=>tt(t,"below"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),"Section"===i.tag&&o(s,{...i}),o(g,{...i})]})};var ComponentToolbarPreview$1=i(ComponentToolbarPreview);export{ComponentToolbarPreview$1 as default};
1
+ import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{memo as i,useState as n,useMemo as l,useCallback as a,useEffect as r}from"react";import"zustand";import{useBuilderPreviewStore as d}from"../contexts/BuilderPreviewContext.js";import{useShopStore as C}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import{CreateThemeSection as c}from"./theme-section/CreateThemeSection.js";import{AIContentGenerator as p}from"./ai-generator/AIContentGenerator.js";import{AIGenContentLoading as h}from"./ai-generator/AIGenContentLoading.js";import s from"./toolbar/Tooltip.js";import{ThemeSectionStatusWrapper as u}from"./theme-section/ThemeSectionStatus.js";import{usePostPurchase as m}from"../hooks/useToolbarPostPurchase.js";import v from"./resize/Resize.js";import"../helpers/convert.js";let SECTION_LIMIT=25,notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},ComponentToolbarPreview=i=>{let b=i.isThemeSection,g=i.isShopifySection,f=C(t=>t.pageType),w=d(t=>t.getParents),S=d(t=>t.getItem("ROOT")),M=d(t=>t.isThemeSectionEditor),[V,Z]=n(null),[x,H]=n(!1),[R,E]=n(!1),[T,y]=n([]),[P,L]=n("top"),[B,j]=n(!1),[k,I]=n({width:"",text:""}),[U,F]=n(!1),$=l(()=>"POST_PURCHASE"===f,[f]),{checkDisableDelete:A,getTooltipText:O,checkDisableDuplicate:z}=m(i.uid,i.tag||""),D=(t,e)=>{let o=T.length,i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.top-n.top<36*o},_=(t,e)=>{let o=e||t;if(t&&!isSection(t))return notVisible(t)&&D(e,t)?t:t.parentElement?_(t.parentElement,o):void 0},G=a(()=>{if("Section"==i.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?L("bottom"):L("top")}},[i.tag]),N=a(t=>{let e=t.detail;if(e?.componentUid==i.uid){G(),$&&(j(A()),I(O()),F(z()));let t=w(i.uid).filter(t=>!("ROOT"===t.uid||"Section"===t.tag&&M||t.editorConfigs?.toolbar?.hide||t.editorConfigs?.component?.noSetting)).slice(0,3);y(t)}else y([]),H(!1)},[i.uid,$,w,A,O,z,M,G]);if(r(()=>(window.addEventListener("editor:active-component",N),()=>{window.removeEventListener("editor:active-component",N)}),[N]),"section"===i.type||i.editorConfigs?.toolbar?.hide)return null;let q=()=>S?.childrens?.length||0,J=()=>"Section"!==i.tag?-1:S?.childrens?.length?S.childrens.findIndex(t=>t==i.uid):-1,K=t=>{if(!T.length)return;let e=t?.target||null,o=e.closest("[data-toolbar-active]");if(!e||!o)return;if(x)E(!1),H(!1);else{let t=_(o,o);if(t)E(!0);else{let t=o.getBoundingClientRect();t.top<36*T.length?E(!0):E(!1)}H(!0)}let i=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!x}});window.dispatchEvent(i)},Q=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:i.uid,isThemeSection:b,isShopifySection:g}});return window.dispatchEvent(e),!1},W=t=>{if(t.preventDefault(),t.stopPropagation(),q()>=25&&"Section"==i.tag)return!1;let e=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:i.uid,isThemeSection:b,isShopifySection:g}});return window.dispatchEvent(e),!1},X=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:visibility-shopify-section",{bubbles:!0,detail:{componentUid:i.uid,isShopifySection:g}});return window.dispatchEvent(e),!1},Y=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:i.uid}});return window.dispatchEvent(e),!1},tt=()=>{Z(null),window.removeEventListener("editor:close-add-section-popup",tt)},te=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),q()>=25)return!1;let o=t.target;if(o){Z(e);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:i.uid,position:e,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",tt)}return!1},to=()=>{if(g)return`Shopify section: ${i.name}`;let t=i.name&&i.name===`Section ${i.uid}`;return q()>=20?`${t?"Section":i?.name} ${J()+1}/25`:t?`Section ${J()+1}`:i?.name};return t(e,{children:[!("Section"==i.tag&&M)&&t("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==i.tag,"data-toolbar-theme-section":"Section"==i.tag&&!!b||M,"data-toolbar-shopify-section":"Section"==i.tag&&!!g,"data-toolbar-limit":J()>=25,children:[t("div",{"data-toolbar-show-parent":!0,onClick:t=>K(t),"aria-hidden":"true",children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==i.tag?o("div",{"data-toolbar-name":!0,children:to()}):o("div",{"data-toolbar-name":!0,children:i.customLabel||i.label}),"Section"!==i.tag&&T.length>0&&o("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":x,children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),x&&T.map((e,i)=>{let n=e?.childrens?.length??0,l=e.label;return"Row"===e.label&&(l=n<=1?e.label+" "+n+" col":e.label+" "+n+" cols"),t("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":M,"data-toolbar-parent-revert":R,style:{top:R?`${36*(i+1)}px`:`${-36*(i+1)}px`},children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),o("div",{"data-toolbar-name":!0,children:l})]},e.uid)}),"Section"===i.tag&&!i.isThemeSection&&"STATIC"!==f&&"POST_PURCHASE"!==f&&!i.isShopifySection&&25>J()&&o(c,{...i}),o(p,{...i}),"Sticky"==i.tag&&o("div",{"data-toolbar-zoom-out":!0,onClick:t=>Y(t),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),o(s,{enable:"Section"==i.tag&&q()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==i.tag&&q()>=25||U,onClick:U?void 0:t=>W(t),"aria-hidden":"true",className:U?"!gp-cursor-not-allowed":"",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),"Section"===i.tag&&i.isShopifySection&&o(s,{enable:!1,text:"",position:"bottom","data-toolbar-visibility":!0,onClick:t=>X(t),"aria-hidden":"true",children:i.isShopifyVisibility?t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.4998 7.99841C10.499 6.61803 9.37945 5.49961 7.99909 5.50027C6.6187 5.50071 5.49975 6.61987 5.49975 8.00027C5.49975 9.38099 6.61904 10.5003 7.99975 10.5003C9.38021 10.5003 10.4996 9.38184 10.4998 8.00107V7.99841ZM7.99949 6.50027C8.82762 6.49983 9.49931 7.17081 9.49975 7.99894V8.00054C9.49975 8.8288 8.82836 9.50027 7.99975 9.50027C7.17133 9.50027 6.49975 8.8287 6.49975 8.00027C6.49975 7.172 7.17122 6.50049 7.99949 6.50027Z",fill:"white"}),o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.99869 3.50098C4.53098 3.50106 2.24443 6.11641 1.43599 7.20809C1.0847 7.68246 1.08696 8.32021 1.43971 8.79238C2.25325 9.88131 4.55461 12.4995 7.9987 12.4995C11.5041 12.4995 13.7751 9.87636 14.5731 8.78489C14.9175 8.31382 14.915 7.68401 14.5684 7.21544C13.7641 6.12774 11.474 3.50089 7.99869 3.50098ZM2.23962 7.80322C3.016 6.75484 5.04126 4.50105 7.99871 4.50098C10.9629 4.50091 12.9916 6.76501 13.7644 7.81003C13.8513 7.92751 13.8516 8.07739 13.7658 8.19472C13.0028 9.23835 10.9929 11.4995 7.9987 11.4995C5.0648 11.4995 3.025 9.24349 2.24082 8.19386C2.15178 8.07468 2.15162 7.92206 2.23962 7.80322Z",fill:"white"})]}):t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.4998 7.99857C10.499 6.61819 9.37945 5.49977 7.99909 5.50044C6.6187 5.50088 5.49975 6.62003 5.49975 8.00044C5.49975 9.38115 6.61904 10.5004 7.99975 10.5004C9.38021 10.5004 10.4996 9.382 10.4998 8.00124V7.99857ZM7.99949 6.50044C8.82762 6.49999 9.49931 7.17097 9.49975 7.9991V8.0007C9.49975 8.82896 8.82836 9.50044 7.99975 9.50044C7.17133 9.50044 6.49975 8.82886 6.49975 8.00044C6.49975 7.17216 7.17122 6.50066 7.99949 6.50044Z",fill:"#F9F9F9"}),o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.99869 3.50114C4.53098 3.50122 2.24443 6.11658 1.43599 7.20825C1.0847 7.68262 1.08696 8.32038 1.43971 8.79254C2.25325 9.88147 4.55461 12.4997 7.9987 12.4997C11.5041 12.4997 13.7751 9.87652 14.5731 8.78505C14.9175 8.31398 14.915 7.68417 14.5684 7.2156C13.7641 6.1279 11.474 3.50106 7.99869 3.50114ZM2.23962 7.80338C3.016 6.755 5.04126 4.50121 7.99871 4.50114C10.9629 4.50107 12.9916 6.76517 13.7644 7.81019C13.8513 7.92767 13.8516 8.07755 13.7658 8.19488C13.0028 9.23851 10.9929 11.4997 7.9987 11.4997C5.0648 11.4997 3.025 9.24365 2.24082 8.19402C2.15178 8.07484 2.15162 7.92222 2.23962 7.80338Z",fill:"#F9F9F9"}),o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.4607 2.6163C14.6728 2.87086 14.6384 3.2492 14.3839 3.46134L2.38387 13.4613C2.1293 13.6735 1.75096 13.6391 1.53882 13.3845C1.32668 13.13 1.36108 12.7516 1.61565 12.5395L13.6156 2.53947C13.8702 2.32733 14.2486 2.36173 14.4607 2.6163Z",fill:"#F9F9F9"})]})}),o(s,{"data-toolbar-delete":!0,onClick:t=>B?null:Q(t),enable:B,"data-toolbar-disable":B,width:k.width,text:k.text,position:P,"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]},i.uid),"STATIC"!==f&&"POST_PURCHASE"!==f&&25>J()&&o(u,{...i}),o("div",{"data-outline":!0,"data-outline-section":"Section"==i.tag,"data-outline-theme-section":"Section"==i.tag&&!!b||M,"data-outline-shopify-section":"Section"==i.tag&&!!g,"data-outline-limit":J()>=25},"outline-"+i.uid),"Section"==i.tag&&!M&&t(e,{children:[o(s,{enable:q()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":q()>=25,"data-toolbar-add-open":"above"==V,onClick:t=>te(t,"above"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),o(s,{enable:q()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":q()>=25,"data-toolbar-add-open":"below"==V,onClick:t=>te(t,"below"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),o(h,{...i}),o(v,{...i})]})};var ComponentToolbarPreview$1=i(ComponentToolbarPreview);export{ComponentToolbarPreview$1 as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as p,useCallback as o,useEffect as n}from"react";import{AIIcon as r}from"./icons/AIIcon.js";import{CloseIcon as g}from"./icons/CloseIcon.js";import{ShowMoreIcon as i}from"./icons/ShowMoreIcon.js";import{PickProduct as s}from"./components/PickProduct.js";import{ToneAndVoice as a}from"./components/ToneAndVoice.js";import l from"classnames";import{useListenEventGenerate as d}from"./hooks/useListenEventGenerate.js";import{useGettingGenerateRequest as m}from"./hooks/useGettingGenerateRequest.js";let AIContentGenerator=({...c})=>{let[u,h]=p(!1),[f,x]=p(!1),[b,v]=p(!1),{isGenerating:N,onGenerate:w}=d(c.uid),{getRequestBody:A,prompt:C,changeProductName:j,changePrompt:G}=m(),k=()=>{h(!u)},I=()=>{h(!1)},B=e=>{G(e.target.value)},y=o(e=>{let t=e.detail;t?.componentUid!==c.uid?(x(!1),I()):x(!0)},[c.uid]),E=()=>{v(!b)},L=()=>{let e=A();w(e)};return n(()=>{N||I()},[N]),n(()=>(window.addEventListener("editor:active-component",y),()=>{window.removeEventListener("editor:active-component",y)}),[y]),e("div",{className:`gp-relative ${!f&&"gp-hidden"}`,children:[t("div",{className:"gp-border-r-[#6a6a6a] gp-border-r gp-pr-1 gp-mr-1",children:e("button",{className:"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium",onClick:k,children:[t(r,{}),"AI Content"]})}),e("div",{className:l({"gp-hidden":!u},"gp-absolute gp-top-8 gp-right-0 gp-rounded-lg gp-bg-[#151515] gp-p-4 gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),children:[e("div",{className:"gp-flex gp-items-center gp-justify-between gp-mb-4",children:[t("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),t("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:I,children:t(g,{})})]}),e("div",{className:"gp-mt-2",children:[t("div",{className:"gp-mb-4",children:t("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),t("div",{className:"gp-mb-4 gp-flex",children:t("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: Generate feature benefits",rows:4,value:C,onChange:B})}),t("div",{className:"gp-mb-4",children:e("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:E,children:["Show more",t("span",{className:l({"gp-rotate-180":b}),children:t(i,{})})]})}),e("div",{className:l({"gp-hidden":!b},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[t(a,{}),t(s,{changeProductName:j})]}),t("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:L,children:N?"Generating...":"Generate"})]})]})]})};export{AIContentGenerator};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as p,useCallback as o,useEffect as r}from"react";import{AIIcon as g}from"./icons/AIIcon.js";import{CloseIcon as n}from"./icons/CloseIcon.js";import{ShowMoreIcon as i}from"./icons/ShowMoreIcon.js";import{PickProduct as a}from"./components/PickProduct.js";import{ToneAndVoice as s}from"./components/ToneAndVoice.js";import l from"classnames";import{useListenEventGenerate as c}from"./hooks/useListenEventGenerate.js";import{useGettingGenerateRequest as d}from"./hooks/useGettingGenerateRequest.js";let AIContentGenerator=({...m})=>{let[u,h]=p(!1),[f,x]=p(!1),{isGenerating:b,onGenerate:v}=c({uid:m.uid,tag:String(m.tag)}),{getRequestBody:N,prompt:w,changeProductName:A,changePrompt:C}=d(),j=()=>{h(!u)},G=()=>{h(!1)},k=e=>{C(e.target.value)},I=o(e=>{let t=e.detail;t?.componentUid!==m.uid&&G()},[m.uid]),B=()=>{x(!f)},y=()=>{let e=N();v(e)};return r(()=>{b||G()},[b]),r(()=>(window.addEventListener("editor:active-component",I),()=>{window.removeEventListener("editor:active-component",I)}),[I]),e("div",{className:"gp-relative",children:[t("div",{className:"gp-border-r-[#6a6a6a]"}),t("div",{className:"gp-border-r-[#6a6a6a] gp-border-r gp-pr-1 gp-mr-1",children:e("button",{className:"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium",onClick:j,children:[t(g,{}),"AI Content"]})}),e("div",{className:l({"gp-hidden":!u,"gp-right-0":"Section"===m.tag,"gp-left-0":"Section"!==m.tag},"gp-absolute gp-top-8 gp-right-0 gp-rounded-lg gp-bg-[#151515] gp-p-4 gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),children:[e("div",{className:"gp-flex gp-items-center gp-justify-between gp-mb-4",children:[t("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),t("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:G,children:t(n,{})})]}),e("div",{className:"gp-mt-2",children:[t("div",{className:"gp-mb-4",children:t("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),t("div",{className:"gp-mb-4 gp-flex",children:t("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: Generate feature benefits",rows:4,value:w,onChange:k})}),t("div",{className:"gp-mb-4",children:e("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:B,children:["Show more",t("span",{className:l({"gp-rotate-180":f}),children:t(i,{})})]})}),e("div",{className:l({"gp-hidden":!f},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[t(s,{}),t(a,{changeProductName:A})]}),t("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:y,children:b?"Generating...":"Generate"})]})]})]})};export{AIContentGenerator};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import{useState as r,useRef as i,useCallback as a,useEffect as s}from"react";let AIGenContentLoading=({...l})=>{let[o,u]=r(!1),[c,g]=r(1),d=i(null),p=a(e=>{let t=e.detail;if(t?.sectionUid===l.uid){if("loading"===t.status){u(!0);return}if("success"===t.status){u(!1);return}}},[l.uid]);return s(()=>{if(o){d.current=setInterval(()=>{g(e=>3===e?1:e+1)},500);return}d.current&&clearInterval(d.current)},[o]),s(()=>(window.addEventListener("editor:ai-generate-content-status",p),()=>{window.removeEventListener("editor:ai-generate-content-status",p)}),[p]),o?e(t,{children:e("div",{className:"gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-white gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center",children:n("span",{className:"gp-font-medium",children:["Generating Content",Array.from(Array(c).keys()).map(()=>".")]})})}):null};export{AIGenContentLoading};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as n,useRef as r,useCallback as i,useEffect as a}from"react";let AIGenContentLoading=({...s})=>{let[o,l]=n(!1),[u,g]=n(1),c=r(null),p=i(e=>{let t=e.detail;if(t?.sectionUid===s.uid){if("loading"===t.status){l(!0);return}if("success"===t.status){l(!1);return}}},[s.uid]);return a(()=>{if(o){c.current=setInterval(()=>{g(e=>3===e?1:e+1)},500);return}c.current&&clearInterval(c.current)},[o]),a(()=>(window.addEventListener("editor:ai-generate-content-status",p),()=>{window.removeEventListener("editor:ai-generate-content-status",p)}),[p]),o?e("div",{className:"gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-white gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center",children:t("span",{className:"gp-font-medium",children:["Generating Content",Array.from(Array(u).keys()).map(()=>".")]})}):null};export{AIGenContentLoading};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as p,jsxs as t}from"react/jsx-runtime";import{useState as r,useEffect as g}from"react";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{useProductsQuery as a}from"../../../hooks/shop/use-products-query.js";import"vanilla-lazyload";import"../../../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"../../../helpers/convert.js";let PickProduct=s=>{let{data:o,isLoading:d}=a([]),[i,l]=r(),[c,m]=r(!1),n=()=>{m(!c)},u=e=>{l(e),m(!1)};return g(()=>{if(o?.products?.edges.length&&!i){let e=o.products.edges[0]?.node;e&&l({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[o,i]),g(()=>{i&&i.name&&s.changeProductName(i.name)},[i,s]),e(p,{children:t("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[e("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),t("div",{className:"gp-relative",children:[d?e("div",{children:e("span",{className:"gp-text-xs",children:"Getting products..."})}):t("button",{className:"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:n,children:[e("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:i?.image,alt:"product_image"}),e("span",{className:"gp-truncate gp-max-w-[210px]",children:i?.name})]}),c&&e("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:o?.products?.edges.map(p=>t("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{u({id:p.node?.id,name:p.node?.title,image:p.node?.featuredImage?.src})},children:[e("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:p.node?.featuredImage?.src,alt:"product_image"}),e("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:p.node?.title})]},p.node?.id))})]})]})})};export{PickProduct};
1
+ import{jsxs as e,jsx as p}from"react/jsx-runtime";import{useState as t,useEffect as g}from"react";import"zustand";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{useProductsQuery as r}from"../../../hooks/shop/use-products-query.js";import"vanilla-lazyload";import"../../../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"../../../helpers/convert.js";let PickProduct=a=>{let{data:s,isLoading:o}=r([]),[d,i]=t(),[l,c]=t(!1),m=()=>{c(!l)},n=e=>{i(e),c(!1)};return g(()=>{if(s?.products?.edges.length&&!d){let e=s.products.edges[0]?.node;e&&i({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[s,d]),g(()=>{d&&d.name&&a.changeProductName(d.name)},[d,a]),e("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[p("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),e("div",{className:"gp-relative",children:[o?p("div",{children:p("span",{className:"gp-text-xs",children:"Getting products..."})}):e("button",{className:"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:m,children:[p("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:d?.image,alt:"product_image"}),p("span",{className:"gp-truncate gp-max-w-[210px]",children:d?.name})]}),l&&p("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:s?.products?.edges.map(t=>e("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{n({id:t.node?.id,name:t.node?.title,image:t.node?.featuredImage?.src})},children:[p("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:t.node?.featuredImage?.src,alt:"product_image"}),p("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:t.node?.title})]},t.node?.id))})]})]})};export{PickProduct};
@@ -1 +1 @@
1
- import{useState as e,useCallback as t,useEffect as n}from"react";let useListenEventGenerate=i=>{let[s,o]=e(!1),a=e=>{let t=new CustomEvent("editor:toolbar:ai-generate-content",{bubbles:!0,detail:{componentUid:i,genRequest:e}});window.dispatchEvent(t),o(!0),r("loading")},r=e=>{let t=new CustomEvent("editor:ai-generate-content-status",{bubbles:!0,detail:{status:e,sectionUid:i}});window.dispatchEvent(t)},d=t(e=>{let t=e.detail;t?.sectionUid===i&&"success"===t.status&&o(!1)},[i]);return n(()=>(window.addEventListener("editor:ai-generate-content-status",d),()=>{window.removeEventListener("editor:ai-generate-content-status",d)}),[d]),{isGenerating:s,onGenerate:a}};export{useListenEventGenerate};
1
+ import{useState as e,useCallback as t,useEffect as n}from"react";let useListenEventGenerate=i=>{let{uid:s,tag:o}=i,[a,d]=e(!1),r=e=>{let t=new CustomEvent("editor:toolbar:ai-generate-content",{bubbles:!0,detail:{componentUid:s,componentTag:o,genRequest:e}});window.dispatchEvent(t),d(!0),u("loading")},u=e=>{let t=new CustomEvent("editor:ai-generate-content-status",{bubbles:!0,detail:{status:e,sectionUid:s}});window.dispatchEvent(t)},c=t(e=>{let t=e.detail;t?.sectionUid===s&&"success"===t.status&&d(!1)},[s]);return n(()=>(window.addEventListener("editor:ai-generate-content-status",c),()=>{window.removeEventListener("editor:ai-generate-content-status",c)}),[c]),{isGenerating:a,onGenerate:r}};export{useListenEventGenerate};
@@ -1 +1 @@
1
- let disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","ProductImagesV2","PostPurchaseProductImages","Sticky","Heading"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"],excludeApplyStyle=["IconListV2","IconList"],postPurchaseRequiredElements=["PostPurchaseProductOffer","PostPurchaseProductTitle","PostPurchaseProductPrice","PostPurchaseAcceptButton","PostPurchaseButton","PostPurchaseCalloutBox","PostPurchaseProductPriceBreakdown","PostPurchaseProductImages","PostPurchaseCalloutText"],postPurchaseWrapElements=["Row","Section","PostPurchaseCalloutBox","PostPurchaseProductOffer"];export{customRenderChildren,disableWrap,excludeApplyStyle,postPurchaseRequiredElements,postPurchaseWrapElements};
1
+ let disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","ProductImagesV2","PostPurchaseProductImages","Sticky","Heading","ProductBadge","Marquee"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"],excludeApplyStyle=["IconListV2","IconList","ProductBadge"],postPurchaseRequiredElements=["PostPurchaseProductOffer","PostPurchaseProductTitle","PostPurchaseProductPrice","PostPurchaseAcceptButton","PostPurchaseButton","PostPurchaseCalloutBox","PostPurchaseProductPriceBreakdown","PostPurchaseProductImages","PostPurchaseCalloutText"],postPurchaseWrapElements=["Row","Section","PostPurchaseCalloutBox","PostPurchaseProductOffer"];export{customRenderChildren,disableWrap,excludeApplyStyle,postPurchaseRequiredElements,postPurchaseWrapElements};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as i,createContext as d,Suspense as r,Fragment as s}from"react";import{useStore as l,createStore as n}from"zustand";import{cloneDeep as a}from"../helpers/clone-deep.js";import{normalizeBuilderData as c}from"../helpers/normalize-builder-data.js";function moveByIndex(e,t,i){let d=e.splice(t,1)[0];void 0!==d&&e.splice(i,0,d)}function removeByKey(e,t){let i=t[e];i&&(delete t[e],"section"!==i.type&&i.childrens?.map(e=>removeByKey(e,t)))}let BuilderPreviewContext=d(null),root={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},createBuilderPreviewProvider=(e,t)=>n((i,d)=>({state:e,loaded:!1,isThemeSectionEditor:!!t,dynamicProduct:null,dynamicCollection:null,addItem:e=>{let{position:t,data:r}=e,s=d().state,l=Date.now();if("section"===e.type){if(!Array.isArray(r)){let e=r.uid,d=s.ROOT;d.childrens?d.childrens.splice(t??0,0,e):d.childrens=[e],d.dateModified=l,i({state:{...s,[e]:{uid:e,type:"section",label:r.label},ROOT:a(d)}})}}else{let{id:d,data:r}=e,n=d?s[d]??s.ROOT:s.ROOT;if("section"===n.type)return;if(Array.isArray(r)){let e=r.map(e=>e.uid),d=r.reduceRight((e,t)=>{let i=c(t);return{...e,...i}},{});n.dateModified=l,n.childrens=n.childrens??[],n.childrens.splice(t??0,0,...e),i({state:{...s,...d,[n.uid]:a(n)}})}else{let e=c(r);n.dateModified=l,n.childrens=n.childrens??[],n.childrens.splice(t??0,0,r.uid),i({state:{...s,...e,[n.uid]:a(n)}})}}},changeItemProp:(e,t,r)=>{if(!r||!["setting","style","advanced"].includes(r))return;let s=d().state,l=s[e];if(l?.type!=="section"&&l){let d=Date.now();switch(l.dateModified=d,r){case"setting":i({state:{...s,[e]:{...l,settings:{...l.settings,...t}}}});break;case"style":i({state:{...s,[e]:{...l,styles:{...l.styles,...t}}}});break;case"advanced":i({state:{...s,[e]:{...l,advanced:{...l.advanced,...t}}}})}}},forceChangeItemProp:(e,t,r)=>{if(!r||!["setting","style","advanced"].includes(r))return;let s=d().state,l=s[e];if(l?.type!=="section"&&l){let d=Date.now();switch(l.dateModified=d,r){case"setting":i({state:{...s,[e]:{...l,settings:t}}});break;case"style":i({state:{...s,[e]:{...l,styles:t}}});break;case"advanced":i({state:{...s,[e]:{...l,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:r,group:s})=>{if(!s||!["setting","style","advanced"].includes(s))return;let l=d().state,n=l[e];if(n?.type!=="section"&&n){let d={style:n.styles??{},advanced:n.advanced??{},setting:n.settings??{}};void 0===r?(console.warn("Data is undefined"),delete d[s][t]):d[s][t]=r,i({state:{...l,[e]:{...n,settings:{...d.setting},styles:{...d.style},advanced:{...d.advanced}}}})}},getItem:e=>d().state[e],removeItem:e=>{if("ROOT"===e)i({state:{ROOT:root}});else{let t=d().state;removeByKey(e,t);let r=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(r){let d=Date.now(),[s,l]=r;if("section"===l.type)return;l.childrens=l.childrens?.filter(t=>t!==e),l.dateModified=d,i({state:{...t,[s]:a(l)}})}}},moveItem:(e,t,r)=>{let s=d().state,l=s[e],n=s[t];if(l&&n&&"section"!==n.type){if("section"===l.type){let t=s.ROOT;if(!t.childrens)return;let d=t.childrens.findIndex(t=>t===e);moveByIndex(t.childrens,d,r??0),i({state:{...s,ROOT:a(t)}})}else{let d=Object.entries(s).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(l&&d){let c=Date.now(),[,o]=d;if("section"===o.type)return;if(o.dateModified=c,t===o.uid&&o.childrens){let t=o.childrens.findIndex(t=>t===e);o.childrens&&t!==r&&(moveByIndex(o.childrens,t,r??0),i({state:{...s,[o.uid]:a(o)}}))}else o.childrens=o.childrens?.filter(t=>t!==e),n&&(n.dateModified=c,n.childrens=n.childrens??[],n.childrens.splice(r??0,0,l.uid),i({state:{...s,[n.uid]:a(n),[o.uid]:a(o)}}))}}}},forceChangeState:e=>{i({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),d=e.reduceRight((e,t)=>{let i=c(t);return{...e,...i}},{});i({loaded:!0,state:{ROOT:{...root,childrens:t},...d}})}else{let t=c(e);i({loaded:!0,state:{ROOT:{...root,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let r=d().state,s=r.ROOT;s.childrens||(s.childrens=[]),s.childrens.splice(t??0,0,e.uid),i({state:{...r,ROOT:a(s)}})},getParents:(e,t)=>{let i=d().state,r=[],s=0,l=e;for(;!t||!(s>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(l));if(!e)break;let[,t]=e;if(!t)break;r.push(t),l=t.uid,s++}return r},updateItemName:(e,t)=>{let r=d().state,s=r[e];s&&(s.name=t,i({state:{...r,[e]:a(s)}}))},updateItemAttribute:(e,t,r)=>{if(!r||!["label","customLabel"].includes(r))return;let s=d().state,l=s[e];if(l?.type!=="section"&&l){let d=Date.now();l.dateModified=d;let n={...l,[r]:t};i({state:{...s,[e]:n}})}}})),BuilderPreviewProvider=({children:i,state:d,isThemeSectionEditor:l,lazy:n,...a})=>{let c=n?r:s,o=t(()=>createBuilderPreviewProvider(d,l),[d,l]);return e(c,{children:e(BuilderPreviewContext.Provider,{...a,value:o,children:i})})},useBuilderPreviewStore=(e,t)=>{let d=i(BuilderPreviewContext);if(!d)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return l(d,e,t)};export{BuilderPreviewProvider,useBuilderPreviewStore};
1
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as i,createContext as s,Suspense as d,Fragment as r}from"react";import{useStore as l,createStore as n}from"zustand";import{cloneDeep as a}from"../helpers/clone-deep.js";import{normalizeBuilderData as c}from"../helpers/normalize-builder-data.js";function moveByIndex(e,t,i){let s=e.splice(t,1)[0];void 0!==s&&e.splice(i,0,s)}function removeByKey(e,t){let i=t[e];i&&(delete t[e],"section"!==i.type&&i.childrens?.map(e=>removeByKey(e,t)))}let BuilderPreviewContext=s(null),root={uid:"ROOT",tag:"Root",label:"Root",childrens:[]},createBuilderPreviewProvider=(e,t)=>n((i,s)=>({state:e,loaded:!1,isThemeSectionEditor:!!t,dynamicProduct:null,dynamicCollection:null,addItem:e=>{let{position:t,data:d}=e,r=s().state,l=Date.now();if("section"===e.type){if(!Array.isArray(d)){let e=d.uid,s=r.ROOT;s.childrens?s.childrens.splice(t??0,0,e):s.childrens=[e],s.dateModified=l,i({state:{...r,[e]:{uid:e,type:"section",label:d.label},ROOT:a(s)}})}}else{let{id:s,data:d}=e,n=s?r[s]??r.ROOT:r.ROOT;if("section"===n.type)return;if(Array.isArray(d)){let e=d.map(e=>e.uid),s=d.reduceRight((e,t)=>{let i=c(t);return{...e,...i}},{});n.dateModified=l,n.childrens=n.childrens??[],n.childrens.splice(t??0,0,...e),i({state:{...r,...s,[n.uid]:a(n)}})}else{let e=c(d);n.dateModified=l,n.childrens=n.childrens??[],n.childrens.splice(t??0,0,d.uid),i({state:{...r,...e,[n.uid]:a(n)}})}}},changeItemProp:(e,t,d)=>{if(!d||!["setting","style","advanced"].includes(d))return;let r=s().state,l=r[e];if(l?.type!=="section"&&l){let s=Date.now();switch(l.dateModified=s,d){case"setting":i({state:{...r,[e]:{...l,settings:{...l.settings,...t}}}});break;case"style":i({state:{...r,[e]:{...l,styles:{...l.styles,...t}}}});break;case"advanced":i({state:{...r,[e]:{...l,advanced:{...l.advanced,...t}}}})}}},forceChangeItemProp:(e,t,d)=>{if(!d||!["setting","style","advanced"].includes(d))return;let r=s().state,l=r[e];if(l?.type!=="section"&&l){let s=Date.now();switch(l.dateModified=s,d){case"setting":i({state:{...r,[e]:{...l,settings:t}}});break;case"style":i({state:{...r,[e]:{...l,styles:t}}});break;case"advanced":i({state:{...r,[e]:{...l,advanced:t}}})}}},changeItemPropByKey:({id:e,key:t,data:d,group:r})=>{if(!r||!["setting","style","advanced"].includes(r))return;let l=s().state,n=l[e];if(n?.type!=="section"&&n){let s={style:n.styles??{},advanced:n.advanced??{},setting:n.settings??{}};void 0===d?(console.warn("Data is undefined"),delete s[r][t]):s[r][t]=d,i({state:{...l,[e]:{...n,settings:{...s.setting},styles:{...s.style},advanced:{...s.advanced}}}})}},getItem:e=>s().state[e],removeItem:e=>{if("ROOT"===e)i({state:{ROOT:root}});else{let t=s().state;removeByKey(e,t);let d=Object.entries(t).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(d){let s=Date.now(),[r,l]=d;if("section"===l.type)return;l.childrens=l.childrens?.filter(t=>t!==e),l.dateModified=s,i({state:{...t,[r]:a(l)}})}}},moveItem:(e,t,d)=>{let r=s().state,l=r[e],n=r[t];if(l&&n&&"section"!==n.type){if("section"===l.type){let t=r.ROOT;if(!t.childrens)return;let s=t.childrens.findIndex(t=>t===e);moveByIndex(t.childrens,s,d??0),i({state:{...r,ROOT:a(t)}})}else{let s=Object.entries(r).find(([,t])=>"section"!==t.type&&t.childrens?.includes(e));if(l&&s){let c=Date.now(),[,o]=s;if("section"===o.type)return;if(o.dateModified=c,t===o.uid&&o.childrens){let t=o.childrens.findIndex(t=>t===e);o.childrens&&t!==d&&(moveByIndex(o.childrens,t,d??0),i({state:{...r,[o.uid]:a(o)}}))}else o.childrens=o.childrens?.filter(t=>t!==e),n&&(n.dateModified=c,n.childrens=n.childrens??[],n.childrens.splice(d??0,0,l.uid),i({state:{...r,[n.uid]:a(n),[o.uid]:a(o)}}))}}}},forceChangeState:e=>{i({state:e,loaded:!0})},initState:e=>{if(Array.isArray(e)){let t=e.map(e=>e.uid),s=e.reduceRight((e,t)=>{let i=c(t);return{...e,...i}},{});i({loaded:!0,state:{ROOT:{...root,childrens:t},...s}})}else{let t=c(e);i({loaded:!0,state:{ROOT:{...root,childrens:[e.uid]},...t}})}},addSection:(e,t)=>{let d=s().state,r=d.ROOT;r.childrens||(r.childrens=[]),r.childrens.splice(t??0,0,e.uid),i({state:{...d,ROOT:a(r)}})},getParents:(e,t)=>{let i=s().state,d=[],r=0,l=e;for(;!t||!(r>=t);){let e=Object.entries(i).find(([,e])=>"section"!==e.type&&e.childrens?.includes(l));if(!e)break;let[,t]=e;if(!t)break;d.push(t),l=t.uid,r++}return d},updateItemName:(e,t)=>{let d=s().state,r=d[e];r&&(r.name=t,i({state:{...d,[e]:a(r)}}))},updateItemAttribute:(e,t,d)=>{if(!d||!["label","customLabel","isShopifyVisibility"].includes(d))return;let r=s().state,l=r[e];if(l){if("section"!==l.type){let e=Date.now();l.dateModified=e}let s={...l,[d]:t};i({state:{...r,[e]:s}})}}})),BuilderPreviewProvider=({children:i,state:s,isThemeSectionEditor:l,lazy:n,...a})=>{let c=n?d:r,o=t(()=>createBuilderPreviewProvider(s,l),[s,l]);return e(c,{children:e(BuilderPreviewContext.Provider,{...a,value:o,children:i})})},useBuilderPreviewStore=(e,t)=>{let s=i(BuilderPreviewContext);if(!s)throw Error("useBuilderPreviewStore must be used within a BuilderPreviewProvider");return l(s,e,t)};export{BuilderPreviewProvider,useBuilderPreviewStore};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useStore as t,createStore as o}from"zustand";import{useContext as r,createContext as i}from"react";import{cloneDeep as n}from"../helpers/clone-deep.js";import{normalizeBuilderData as c}from"../helpers/normalize-builder-data.js";let SectionContext=i(null),createSectionProvider=e=>o((t,o)=>({data:e??{},getSection:e=>{let t=o().data[e];return t??void 0},addSection:(e,o)=>{let r=c(o);t(t=>({data:{...t.data,[e]:n(r)}}))},removeSection:e=>{t(t=>{let{[e]:o,...r}=t.data;return{data:r}})}})),SectionProvider=({children:t,data:o,...r})=>e(SectionContext.Provider,{...r,value:createSectionProvider(o),children:t}),useSectionStore=(e,o)=>{let i=r(SectionContext);if(!i)throw Error("useSectionStore must be used within a SectionProvider");return t(i,e,o)},useSection=e=>useSectionStore(t=>t.getSection(e));export{SectionProvider,useSection,useSectionStore};
1
+ import{jsx as e}from"react/jsx-runtime";import{useStore as t,createStore as o}from"zustand";import{useContext as r,createContext as i}from"react";import{cloneDeep as n}from"../helpers/clone-deep.js";import{normalizeBuilderData as a}from"../helpers/normalize-builder-data.js";let SectionContext=i(null),createSectionProvider=e=>o((t,o)=>({data:e??{},getSection:e=>{console.log("get().data",o().data);let t=o().data[e];return t??void 0},addSection:(e,o)=>{let r=a(o);t(t=>({data:{...t.data,[e]:n(r)}}))},removeSection:e=>{t(t=>{let{[e]:o,...r}=t.data;return{data:r}})}})),SectionProvider=({children:t,data:o,...r})=>e(SectionContext.Provider,{...r,value:createSectionProvider(o),children:t}),useSectionStore=(e,o)=>{let i=r(SectionContext);if(!i)throw Error("useSectionStore must be used within a SectionProvider");return t(i,e,o)},useSection=e=>useSectionStore(t=>t.getSection(e));export{SectionProvider,useSection,useSectionStore};
@@ -6546,6 +6546,12 @@ type SaleFunnelDiscountEdge$1 = {
6546
6546
  type ProductOffer = Maybe$1<Pick<SaleFunnelDiscountEdge$1, 'cursor'> & {
6547
6547
  node?: Maybe$1<Pick<SaleFunnelDiscount$1, 'id' | 'value' | 'type' | 'position' | 'objectBaseID' | 'objectType' | 'title' | 'valueType' | 'isEnabled'>>;
6548
6548
  }>;
6549
+ type RawChild = {
6550
+ uid: string;
6551
+ builder: Record<string, any>;
6552
+ components: Record<string, any>;
6553
+ [key: string]: any;
6554
+ };
6549
6555
 
6550
6556
  type InitComponentType<T = any> = {
6551
6557
  [K in keyof T]-?: {
@@ -6963,6 +6969,7 @@ type PositionControlType<T> = SharedControlType<T> & {
6963
6969
 
6964
6970
  type PositionSquareControlType<T> = SharedControlType<T> & {
6965
6971
  type: 'position:square';
6972
+ ignoreValue?: string[];
6966
6973
  };
6967
6974
 
6968
6975
  type RadioGroupControlType = {
@@ -6983,6 +6990,7 @@ type RangeControlType<T> = SharedControlType<T> & {
6983
6990
  disableOnChange?: boolean;
6984
6991
  useOnlyUnitInit?: boolean;
6985
6992
  hideUnit?: boolean;
6993
+ hideInput?: boolean;
6986
6994
  };
6987
6995
 
6988
6996
  type Option$3<T> = {
@@ -36052,4 +36060,4 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage$1, 'id' | 'name'
36052
36060
 
36053
36061
  declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
36054
36062
 
36055
- export { AddOn, AddonProvider, AddonProviderProps, AdvancedType, AliReviewsWidgetType, AlignItemProp, AlignProp, AnimationBaseSetting, AnimationConfig, AnimationDirectionType, AnimationEasingType, AnimationFadeSettingType, AnimationSetting, AnimationSettingType, AnimationShakeSettingType, AnimationSlideSettingType, AnimationTrigger, AnimationTriggerType, AnimationType, AnimationZoomDirectionType, AnimationZoomSettingType, appAPI as AppAPIType, ArticleListProvider, ArticleListProviderProps, ArticleProvider, ArticleProviderProps, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlTriggerAction, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, DynamicCollection, DynamicProduct, ExtractState, FeraReviewsV3WidgetType, FeraReviewsWidgetType, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GRADIENT_BGR_KEY, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, GrowaveWidgetType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsAdvancedWidgetType, LaiProductReviewsWidgetType, LibrarySaleFunnelDocument, LibrarySaleFunnelQueryResponse, LibrarySaleFunnelQueryVariables, LibraryTemplateDocument, LibraryTemplateQueryResponse, LibraryTemplateQueryVariables, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices$1 as NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OmnisendWidgetType, OpinewDesignWidgetType, OpinewWidgetType, OptionNormalStyle, OptionSpecialStyle, Options, PageContext, PageProvider, PageProviderProps, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PostPurchaseTypo, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductOffer, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublicStoreFrontData, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveKey, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SaleFunnelDiscount$1 as SaleFunnelDiscount, SaleFunnelDiscountEdge$1 as SaleFunnelDiscountEdge, SaleFunnelDiscountObjectType$1 as SaleFunnelDiscountObjectType, SaleFunnelDiscountType$1 as SaleFunnelDiscountType, SaleFunnelDiscountValueType$1 as SaleFunnelDiscountValueType, SaleFunnelDiscountsDocument, SaleFunnelDiscountsQueryResponse, SaleFunnelDiscountsQueryVariables, Scalars$1 as Scalars, ScaleByDirection, SectionData, SectionEntity, SectionProvider, SectionProviderProps, SettingByAnimationType, SettingByAnimationValues, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeSettingGlobal, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, ThemePageDocument, ThemePageQueryResponse, ThemePageQueryVariables, ThemeSectionStatus$1 as ThemeSectionStatus, TransformProp, TriggerConfig, TrustooWidgetType, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, UltimateSalesBoostWidgetType, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, YotpoReviewsWidgetType, animations, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeAdvanceStyleForPostPurchase, composeBackgroundCss, composeBorderCss, composeCornerCss, composeFallbackTypographyStyle, composeGridLayout, composeMemo, composePositionLineHeight, composePostionIconList, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertHTML, convertOldLayout, dataStringify, fetchMedias, fetchVariants, filterAttrInStyle, filterCornerInStyle, filterToolbarPreview, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getAspectRatioGlobalSize, getBgImageByDevice, getBorderStyle, getCarouselContainerHeight, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getGlobalSizeGap, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getHeightByShapeGlobalSize, getPaddingGlobalSize, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeContainerWidthOrHeight, makeDotGapToCarouselStyle, makeFixedBgAttachment, makeGlobalSize, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleState, makeStyleWithDefault, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeAttrInStyle, removeNullUndefined, removePaddingYInStyle, removeUndefinedValuesFromObject, shopifyPriceRounding, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useArticleListStore, useArticleStore, useArticlesQuery, useBlogsQuery, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageStore, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductOfferDiscount, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useProductsQueryAll, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
36063
+ export { AddOn, AddonProvider, AddonProviderProps, AdvancedType, AliReviewsWidgetType, AlignItemProp, AlignProp, AnimationBaseSetting, AnimationConfig, AnimationDirectionType, AnimationEasingType, AnimationFadeSettingType, AnimationSetting, AnimationSettingType, AnimationShakeSettingType, AnimationSlideSettingType, AnimationTrigger, AnimationTriggerType, AnimationType, AnimationZoomDirectionType, AnimationZoomSettingType, appAPI as AppAPIType, ArticleListProvider, ArticleListProviderProps, ArticleProvider, ArticleProviderProps, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlTriggerAction, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, DynamicCollection, DynamicProduct, ExtractState, FeraReviewsV3WidgetType, FeraReviewsWidgetType, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GRADIENT_BGR_KEY, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, GrowaveWidgetType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsAdvancedWidgetType, LaiProductReviewsWidgetType, LibrarySaleFunnelDocument, LibrarySaleFunnelQueryResponse, LibrarySaleFunnelQueryVariables, LibraryTemplateDocument, LibraryTemplateQueryResponse, LibraryTemplateQueryVariables, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices$1 as NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OmnisendWidgetType, OpinewDesignWidgetType, OpinewWidgetType, OptionNormalStyle, OptionSpecialStyle, Options, PageContext, PageProvider, PageProviderProps, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PostPurchaseTypo, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductOffer, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublicStoreFrontData, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RawChild, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveKey, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SaleFunnelDiscount$1 as SaleFunnelDiscount, SaleFunnelDiscountEdge$1 as SaleFunnelDiscountEdge, SaleFunnelDiscountObjectType$1 as SaleFunnelDiscountObjectType, SaleFunnelDiscountType$1 as SaleFunnelDiscountType, SaleFunnelDiscountValueType$1 as SaleFunnelDiscountValueType, SaleFunnelDiscountsDocument, SaleFunnelDiscountsQueryResponse, SaleFunnelDiscountsQueryVariables, Scalars$1 as Scalars, ScaleByDirection, SectionData, SectionEntity, SectionProvider, SectionProviderProps, SettingByAnimationType, SettingByAnimationValues, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeSettingGlobal, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, ThemePageDocument, ThemePageQueryResponse, ThemePageQueryVariables, ThemeSectionStatus$1 as ThemeSectionStatus, TransformProp, TriggerConfig, TrustooWidgetType, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, UltimateSalesBoostWidgetType, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, YotpoReviewsWidgetType, animations, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeAdvanceStyleForPostPurchase, composeBackgroundCss, composeBorderCss, composeCornerCss, composeFallbackTypographyStyle, composeGridLayout, composeMemo, composePositionLineHeight, composePostionIconList, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertHTML, convertOldLayout, dataStringify, fetchMedias, fetchVariants, filterAttrInStyle, filterCornerInStyle, filterToolbarPreview, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getAspectRatioGlobalSize, getBgImageByDevice, getBorderStyle, getCarouselContainerHeight, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getGlobalSizeGap, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getHeightByShapeGlobalSize, getPaddingGlobalSize, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeContainerWidthOrHeight, makeDotGapToCarouselStyle, makeFixedBgAttachment, makeGlobalSize, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleState, makeStyleWithDefault, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeAttrInStyle, removeNullUndefined, removePaddingYInStyle, removeUndefinedValuesFromObject, shopifyPriceRounding, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useArticleListStore, useArticleStore, useArticlesQuery, useBlogsQuery, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageStore, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductOfferDiscount, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useProductsQueryAll, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "2.0.0-dev.871",
3
+ "version": "2.0.0-dev.878",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@gem-sdk/adapter-shopify": "1.14.0-dev.619",
31
- "@gem-sdk/styles": "2.0.0-dev.871",
31
+ "@gem-sdk/styles": "2.0.0-dev.878",
32
32
  "@types/classnames": "^2.3.1"
33
33
  },
34
34
  "dependencies": {