@gem-sdk/pages 4.0.18 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),navigation=require("next/navigation"),Script=require("next/script");const SharePageTracking=({trackingId:e,params:a})=>{let t=navigation.usePathname(),r=()=>{core.gtag.sharePageView(t,e,a)};return e?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Script,{strategy:"lazyOnload",onReady:r,src:`https://www.googletagmanager.com/gtag/js?id=${e}`}),jsxRuntime.jsx(Script,{id:"gtag-init",strategy:"lazyOnload",dangerouslySetInnerHTML:{__html:`
3
+ window.dataLayer = window.dataLayer || [];
4
+ function gtag(){dataLayer.push(arguments);}
5
+ gtag('js', new Date());
6
+ gtag('config', '${e}');
7
+ `}})]}):null};exports.SharePageTracking=SharePageTracking;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),getDOMElementParents=require("./toolbar/utils/getDOMElementParents.js"),_const=require("./toolbar/const.js"),getChildrenByAttrSelector=require("./toolbar/utils/getChildrenByAttrSelector.js"),findOverflowParent=require("./toolbar/utils/findOverflowParent.js"),waitForElementToExist=require("./toolbar/utils/waitForElementToExist.js"),isOverParent=require("./toolbar/utils/isOverParent.js"),findDOMClosest=require("./toolbar/utils/findDOMClosest.js");const Toolbar=()=>{let t=react.useRef(null),e=react.useRef(!1),r=react.useRef(),o=react.useRef(!1),a=react.useRef([]),i=react.useRef([]),n=react.useRef([]),l=({state:t,$toolbar:e,$component:r})=>{let o=findOverflowParent.findOverflowParent(r,e),a=e.getBoundingClientRect(),i=r.getBoundingClientRect(),n=window.innerWidth;o?i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true"):a.top<_const.TOOLBAR_ACTIVE_HEIGHT+1&&(i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true")),i.left+a.width>n&&e.setAttribute(`data-toolbar-${t}-overflow`,"true");let l=r?.closest('[aria-label="Dialog body"]');if(l){let r=l.getBoundingClientRect(),o=r.left+r.width-20;i.left+a.width>o&&e.setAttribute(`data-toolbar-${t}-overflow`,"true")}},d=react.useCallback(({$component:t,componentUid:e,focus:r,isPreventSection:o,isParent:n})=>{if(!t&&!e)return;if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}a.current.push(t);let d=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar"),u=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline"),c=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar-add-top"),s=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar-add-bottom"),b=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-theme-section-status");o&&b&&b.setAttribute("data-theme-section-status-active","true"),d&&(d.removeAttribute("style"),n||d.setAttribute("data-toolbar-hover","true"),r&&d.setAttribute("data-toolbar-hover-focus","true"),l({$toolbar:d,$component:t,state:"hover"})),u&&(u.setAttribute("data-outline-hover","true"),n&&u.setAttribute("data-outline-parent-hover","true"),o&&(i.current.push(t),u.setAttribute("data-outline-overlay-theme-section","true")),r&&u.setAttribute("data-outline-hover-focus","true")),c&&!n&&c.setAttribute("data-toolbar-add-hover","true"),s&&!n&&s.setAttribute("data-toolbar-add-hover","true")},[]),u=react.useCallback(({$component:t,componentUid:e})=>{if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=getDOMElementParents.getDOMElementParents(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&d({$component:t,isParent:!0});c({$component:t,$parents:r})}},[d]),c=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar-hover-focus");if(r){let t=r.getBoundingClientRect(),o=!!r.getAttribute("data-toolbar-hover-revert"),a=!!r.getAttribute("data-toolbar-hover-inside"),i=1;for(let r of e)if(r){let e=r.getAttribute("data-component-tag");if("Section"===e)continue;let n=getChildrenByAttrSelector.getChildrenByAttrSelector(r,"data-toolbar-hover");if(n){let e=n.getAttribute("data-toolbar-active");if(e)continue;let r=n.getBoundingClientRect(),l=o||a;if(isOverParent.isOverParent({current:t,parent:r,index:i,revert:l})){let e=getComputedStyle(n),o=t.top-r.top,a=t.left-r.left,d=parseFloat(e.top)+o-(_const.TOOLBAR_HOVER_HEIGHT-1)*i;l&&(d=parseFloat(e.top)-o+(_const.TOOLBAR_HOVER_HEIGHT-1)*i);let u=parseFloat(e.left)+a;n.setAttribute("style",`top: ${d}px;left: ${u}px;`),i++}}}}},s=react.useCallback(()=>{let t=["data-outline-overlay-theme-section","data-theme-section-status-active"],e=i.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}i.current=[]},[]),b=react.useCallback(()=>{let t=["data-toolbar-hover-focus","data-toolbar-hover","data-outline-hover-focus","data-toolbar-hover-revert","data-toolbar-hover-inside","data-outline-hover","data-toolbar-add-hover","data-outline-parent-hover","data-toolbar-hover-overflow"],e=a.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}s(),a.current=[]},[s]),f=react.useCallback(()=>{t.current=null;let e=["data-toolbar-active","data-outline-active","data-toolbar-add-active","data-toolbar-active-revert","data-toolbar-active-inside","data-spacing-margin-bottom-active","data-toolbar-force-hover","data-outline-force-hover","data-toolbar-active-overflow"],o=n.current;if(o.length)for(let t of o){let r=t.querySelectorAll(e.map(t=>`[${t}]`).join(","));r&&e.forEach(t=>{r.forEach(e=>e.removeAttribute(t))})}n.current=[],m(!1),r.current&&r.current()},[]),v=react.useCallback(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let t=o.querySelector("[data-spacing-margin-bottom-bg]")||null,r=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(t&&r){let a=e.marginBottom;t.style.height=a,r.style.top=a,o.setAttribute("data-spacing-margin-bottom-active","true")}}},[]),h=({componentUid:t,productId:e,articleId:r,marqueeKey:o})=>r?`${r?`[data-article-id="${r}"][data-uid="${t}"], [data-article-id="${r}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`:o?`[marquee-item-key="${o}"] [data-uid="${t}"]`:`${e?`[data-product-id="${e}"][data-uid="${t}"], [data-product-id="${e}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`,g=react.useCallback(async({componentUid:e,productId:r,timeAwait:o=600,articleId:a,forceReActive:i,marqueeKey:d})=>{if(!e)return;let u=h({componentUid:e,productId:r,articleId:a,marqueeKey:d}),c=await waitForElementToExist.waitForElementToExist(u,o);if(!c||!i&&e==t.current?.componentUid&&r==t.current?.productId&&a==t.current?.articleId&&d==t.current?.marqueeKey)return;(e!==t.current?.componentUid||r!==t.current?.productId||a!==t.current?.articleId||i)&&f(),(i||e===t.current?.componentUid)&&r===t.current?.productId&&d===t.current?.marqueeKey||f(),n.current.push(c);let s=getChildrenByAttrSelector.getChildrenByAttrSelector(c,"data-toolbar"),g=getChildrenByAttrSelector.getChildrenByAttrSelector(c,"data-outline"),m=getChildrenByAttrSelector.getChildrenByAttrSelector(c,"data-toolbar-add-top"),A=getChildrenByAttrSelector.getChildrenByAttrSelector(c,"data-toolbar-add-bottom");s&&(t.current={componentUid:e,productId:r,articleId:a,marqueeKey:d},s.removeAttribute("style"),s.setAttribute("data-toolbar-active","true"),l({$toolbar:s,$component:c,state:"active"})),g&&g.setAttribute("data-outline-active","true"),m&&m.setAttribute("data-toolbar-add-active","true"),A&&A.setAttribute("data-toolbar-add-active","true");let{$isChildOfMarquee:p,$section:y}=findDOMClosest.findDOMClosest(c,{$isChildOfMarquee:'[data-component-tag="Marquee"]',$section:'[data-component-tag="Section"]'});if(y&&(r||a||p)){let t=y.querySelectorAll(`[data-uid="${e}"]`);t?.length&&t.forEach(t=>{n.current.push(t);let e=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}v({$component:c}),b()},[f,b,v]),m=async e=>{if(e){if(t.current?.componentUid){let r=h({...t.current}),o=await waitForElementToExist.waitForElementToExist(r,500);if(o){let t=getChildrenByAttrSelector.getChildrenByAttrSelector(o,"data-toolbar"),r=getChildrenByAttrSelector.getChildrenByAttrSelector(o,"data-outline"),a=getChildrenByAttrSelector.getChildrenByAttrSelector(o,"data-spacing");t&&e&&t.setAttribute("data-toolbar-editor-inline-focus","true"),r&&e&&r.setAttribute("data-outline-editor-inline-focus","true"),a&&e&&a.setAttribute("data-spacing-hidden","true")}}}else{let t=document.body.querySelector("#storefront")?.querySelectorAll("[data-outline-editor-inline-focus],[data-toolbar-editor-inline-focus],[data-spacing-hidden]");t?.length&&t.forEach(t=>{t&&(t.removeAttribute("data-toolbar-editor-inline-focus"),t.removeAttribute("data-outline-editor-inline-focus"),t.removeAttribute("data-spacing-hidden"))})}},A=react.useCallback(e=>{let r=e.closest("[data-theme-section]"),o=r?.getAttribute("data-uid"),a=r&&o===t.current?.componentUid;if(!a)return;i.current.push(r);let n=getChildrenByAttrSelector.getChildrenByAttrSelector(r,"data-theme-section-status");n&&n.setAttribute("data-theme-section-status-active","true")},[]),p=async({value:e})=>{if(!e||!t.current)return;let r=!1,o=h({...t.current}),a=await waitForElementToExist.waitForElementToExist(o,500);if(a){let e=a?.querySelectorAll("[data-toolbar-parent]");if(e.length){let o=t=>{if(r)return;let e=t.getAttribute("data-parent-uid");if(!e)return;let o=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${e}"]`);o?.length&&o.forEach(t=>{let e=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},a=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${e}"]`);r?.length&&r.forEach(t=>{let e=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},i=async e=>{r=!0;let o=e.getAttribute("data-parent-uid");if(!o)return;let i=async()=>{let t=await waitForElementToExist.waitForElementToExist(`[data-uid="${o}"]`,500),e=t?.closest("[data-product-id]");return!!e?.getAttribute("data-product-id")},n=async()=>{let t=await waitForElementToExist.waitForElementToExist(`[data-uid="${o}"]`,500),e=t?.closest("[data-article-id]");return!!e?.getAttribute("data-article-id")},l="",d="";await i()&&(l=t.current?.productId||""),await n()&&(d=t.current?.articleId||"");let u=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:o,productId:l,articleId:d,elementTag:e.getAttribute("data-component-tag")||""}});a(e),window.dispatchEvent(u),setTimeout(()=>{r=!1},0)};e.forEach(t=>{t.addEventListener("mouseover",()=>o(t)),t.addEventListener("mouseout",()=>a(t)),t.addEventListener("click",()=>i(t))})}}},y=react.useCallback(r=>{if(e.current||o.current)return;let a=r.target;if(!a||"function"!=typeof a.closest){s(),b();return}let{$toolbarHover:i,$component:n,$themeSection:l,$shopifySection:c}=findDOMClosest.findDOMClosest(a,{$toolbarHover:"[data-toolbar-hover]",$component:"[data-toolbar-wrap]",$themeSection:"[data-theme-section]",$shopifySection:"[data-shopify-section]"});if(i)return;let f=n?.getAttribute("data-uid");if(!n||!f||"ROOT"==f){b();return}let v=getChildrenByAttrSelector.getChildrenByAttrSelector(n,"data-toolbar");if(!f||"ROOT"==f||v?.getAttribute("data-toolbar-hover-focus"))return;v?.getAttribute("data-toolbar-hover-focus")||b(),A(a);let h=l||c;if(f==t.current?.componentUid){if(t.current.productId){let e=n.closest("[data-product-id]");if(e){let r=e.getAttribute("data-product-id");if(r==t.current.productId){b();return}}}if(!h)return;d({$component:h,focus:!0,isPreventSection:!0})}h?d({$component:h,focus:!0,isPreventSection:!0}):(d({$component:n,componentUid:f,focus:!0}),u({$component:n,componentUid:f}))},[A,b,d,u,s,t]),C=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid?g({componentUid:r.componentUid,productId:r.productId,articleId:r.articleId,marqueeKey:r.marqueeKey}):f()},[g,f,e]),S=react.useCallback(()=>{b()},[b]),w=react.useCallback(t=>{let r=t.detail;r.value&&(b(),f()),e.current=r.value},[b,f]),E=react.useCallback(t=>{let e=t.detail;e.value?m(!0):m(!1)},[]),B=react.useCallback(t=>{if(e.current)return;let r=t.detail;p({value:r?.value||!1})},[]),$=react.useCallback(t=>{let e=t.detail;e?.value?(b(),o.current=!0):o.current=!1},[b]),q=(t,e)=>{if(!t)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${t}"]`);r?.length&&r.forEach(t=>{let r=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");r&&("in"===e?(r.setAttribute("data-outline-force-hover","true"),r.setAttribute("data-outline-force-overlay","true")):(r.removeAttribute("data-outline-force-hover"),r.removeAttribute("data-outline-force-overlay")))})},O=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid&&q(r?.componentUid,r?.type)},[e]),T=e=>{let r=e.detail;t.current?.componentUid&&r?.componentUid==t.current?.componentUid&&g({...t.current})};return react.useEffect(()=>(document.addEventListener("mousemove",y),window.addEventListener("editor:active-component",C),window.addEventListener("editor:focus-outside-preview",S),window.addEventListener("editor:is-dragging",w),window.addEventListener("editor:is-editing-text-editor",E),window.addEventListener("editor:toolbar:show-parents",B),window.addEventListener("editor:toolbar:resize-spacing",$),window.addEventListener("editor:hover-component",O),window.addEventListener("editor:component:render",T),()=>{document.removeEventListener("mousemove",y),window.removeEventListener("editor:active-component",C),window.removeEventListener("editor:is-dragging",S),window.removeEventListener("editor:is-dragging",w),window.removeEventListener("editor:is-editing-text-editor",E),window.removeEventListener("editor:toolbar:show-parents",B),window.removeEventListener("editor:toolbar:resize-spacing",$),window.removeEventListener("editor:hover-component",O),window.removeEventListener("editor:component:render",T)}),[y,C,S,w,E,B,$,O,T]),jsxRuntime.jsx(jsxRuntime.Fragment,{})};var Toolbar$1=react.memo(Toolbar);exports.default=Toolbar$1;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),getDOMElementParents=require("./toolbar/utils/getDOMElementParents.js"),_const=require("./toolbar/const.js"),getChildrenByAttrSelector=require("./toolbar/utils/getChildrenByAttrSelector.js"),findOverflowParent=require("./toolbar/utils/findOverflowParent.js"),waitForElementToExist=require("./toolbar/utils/waitForElementToExist.js"),isOverParent=require("./toolbar/utils/isOverParent.js"),findDOMClosest=require("./toolbar/utils/findDOMClosest.js");const Toolbar=()=>{let t=react.useRef(null),e=react.useRef(!1),r=react.useRef(),o=react.useRef(!1),a=react.useRef([]),i=react.useRef([]),n=react.useRef([]),l=({state:t,$toolbar:e,$component:r})=>{let o=findOverflowParent.findOverflowParent(r,e),a=e.getBoundingClientRect(),i=r.getBoundingClientRect(),n=window.innerWidth;o?i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true"):a.top<_const.TOOLBAR_ACTIVE_HEIGHT+1&&(i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true")),i.left+a.width>n&&e.setAttribute(`data-toolbar-${t}-overflow`,"true");let l=r?.closest('[aria-label="Dialog body"]');if(l){let r=l.getBoundingClientRect(),o=r.left+r.width-20;i.left+a.width>o&&e.setAttribute(`data-toolbar-${t}-overflow`,"true")}},d=react.useCallback(({$component:t,componentUid:e,focus:r,isPreventSection:o,isParent:n})=>{if(!t&&!e)return;if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}a.current.push(t);let d=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar"),u=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline"),c=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar-add-top"),s=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar-add-bottom"),b=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-theme-section-status");o&&b&&b.setAttribute("data-theme-section-status-active","true"),d&&(d.removeAttribute("style"),n||d.setAttribute("data-toolbar-hover","true"),r&&d.setAttribute("data-toolbar-hover-focus","true"),l({$toolbar:d,$component:t,state:"hover"})),u&&(u.setAttribute("data-outline-hover","true"),n&&u.setAttribute("data-outline-parent-hover","true"),o&&(i.current.push(t),u.setAttribute("data-outline-overlay-theme-section","true")),r&&u.setAttribute("data-outline-hover-focus","true")),c&&!n&&c.setAttribute("data-toolbar-add-hover","true"),s&&!n&&s.setAttribute("data-toolbar-add-hover","true")},[]),u=react.useCallback(({$component:t,componentUid:e})=>{if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=getDOMElementParents.getDOMElementParents(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&d({$component:t,isParent:!0});c({$component:t,$parents:r})}},[d]),c=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-toolbar-hover-focus");if(r){let t=r.getBoundingClientRect(),o=!!r.getAttribute("data-toolbar-hover-revert"),a=!!r.getAttribute("data-toolbar-hover-inside"),i=1;for(let r of e)if(r){let e=r.getAttribute("data-component-tag");if("Section"===e)continue;let n=getChildrenByAttrSelector.getChildrenByAttrSelector(r,"data-toolbar-hover");if(n){let e=n.getAttribute("data-toolbar-active");if(e)continue;let r=n.getBoundingClientRect(),l=o||a;if(isOverParent.isOverParent({current:t,parent:r,index:i,revert:l})){let e=getComputedStyle(n),o=t.top-r.top,a=t.left-r.left,d=parseFloat(e.top)+o-(_const.TOOLBAR_HOVER_HEIGHT-1)*i;l&&(d=parseFloat(e.top)-o+(_const.TOOLBAR_HOVER_HEIGHT-1)*i);let u=parseFloat(e.left)+a;n.setAttribute("style",`top: ${d}px;left: ${u}px;`),i++}}}}},s=react.useCallback(()=>{let t=["data-outline-overlay-theme-section","data-theme-section-status-active"],e=i.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}i.current=[]},[]),b=react.useCallback(()=>{let t=["data-toolbar-hover-focus","data-toolbar-hover","data-outline-hover-focus","data-toolbar-hover-revert","data-toolbar-hover-inside","data-outline-hover","data-toolbar-add-hover","data-outline-parent-hover","data-toolbar-hover-overflow"],e=a.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}s(),a.current=[]},[s]),f=react.useCallback(()=>{t.current=null;let e=["data-toolbar-active","data-outline-active","data-toolbar-add-active","data-toolbar-active-revert","data-toolbar-active-inside","data-spacing-margin-bottom-active","data-toolbar-force-hover","data-outline-force-hover","data-toolbar-active-overflow"],o=n.current;if(o.length)for(let t of o){let r=t.querySelectorAll(e.map(t=>`[${t}]`).join(","));r&&e.forEach(t=>{r.forEach(e=>e.removeAttribute(t))})}n.current=[],g(!1),r.current&&r.current()},[]),m=react.useCallback(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let t=o.querySelector("[data-spacing-margin-bottom-bg]")||null,r=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(t&&r){let a=e.marginBottom;t.style.height=a,r.style.top=a,o.setAttribute("data-spacing-margin-bottom-active","true")}}},[]),v=({componentUid:t,productId:e,articleId:r,marqueeKey:o,carouselItemKey:a})=>r?`${r?`[data-article-id="${r}"][data-uid="${t}"], [data-article-id="${r}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`:o?`[marquee-item-key="${o}"] [data-uid="${t}"]`:a?`[data-carousel-item-key="${a}"] [data-uid="${t}"]`:`${e?`[data-product-id="${e}"][data-uid="${t}"], [data-product-id="${e}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`,h=react.useCallback(async({componentUid:e,productId:r,timeAwait:o=600,articleId:a,forceReActive:i,marqueeKey:d,carouselItemKey:u})=>{if(!e)return;let c=v({componentUid:e,productId:r,articleId:a,marqueeKey:d,carouselItemKey:u}),s=await waitForElementToExist.waitForElementToExist(c,o);if(!s||!i&&e==t.current?.componentUid&&r==t.current?.productId&&a==t.current?.articleId&&d==t.current?.marqueeKey&&u==t.current?.carouselItemKey)return;(e!==t.current?.componentUid||r!==t.current?.productId||a!==t.current?.articleId||u!==t.current?.carouselItemKey||i)&&f(),(i||e===t.current?.componentUid)&&r===t.current?.productId&&d===t.current?.marqueeKey&&u===t.current?.carouselItemKey||f(),n.current.push(s);let h=getChildrenByAttrSelector.getChildrenByAttrSelector(s,"data-toolbar"),g=getChildrenByAttrSelector.getChildrenByAttrSelector(s,"data-outline"),A=getChildrenByAttrSelector.getChildrenByAttrSelector(s,"data-toolbar-add-top"),y=getChildrenByAttrSelector.getChildrenByAttrSelector(s,"data-toolbar-add-bottom");h&&(t.current={componentUid:e,productId:r,articleId:a,marqueeKey:d,carouselItemKey:u},h.removeAttribute("style"),h.setAttribute("data-toolbar-active","true"),l({$toolbar:h,$component:s,state:"active"})),g&&g.setAttribute("data-outline-active","true"),A&&A.setAttribute("data-toolbar-add-active","true"),y&&y.setAttribute("data-toolbar-add-active","true");let{$isChildOfMarquee:p,$section:C}=findDOMClosest.findDOMClosest(s,{$isChildOfMarquee:'[data-component-tag="Marquee"]',$section:'[data-component-tag="Section"]'});if(C&&(r||a||p)){let t=C.querySelectorAll(`[data-uid="${e}"]`);t?.length&&t.forEach(t=>{n.current.push(t);let e=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}m({$component:s}),b()},[f,b,m]),g=async e=>{if(e){if(t.current?.componentUid){let r=v({...t.current}),o=await waitForElementToExist.waitForElementToExist(r,500);if(o){let t=getChildrenByAttrSelector.getChildrenByAttrSelector(o,"data-toolbar"),r=getChildrenByAttrSelector.getChildrenByAttrSelector(o,"data-outline"),a=getChildrenByAttrSelector.getChildrenByAttrSelector(o,"data-spacing");t&&e&&t.setAttribute("data-toolbar-editor-inline-focus","true"),r&&e&&r.setAttribute("data-outline-editor-inline-focus","true"),a&&e&&a.setAttribute("data-spacing-hidden","true")}}}else{let t=document.body.querySelector("#storefront")?.querySelectorAll("[data-outline-editor-inline-focus],[data-toolbar-editor-inline-focus],[data-spacing-hidden]");t?.length&&t.forEach(t=>{t&&(t.removeAttribute("data-toolbar-editor-inline-focus"),t.removeAttribute("data-outline-editor-inline-focus"),t.removeAttribute("data-spacing-hidden"))})}},A=react.useCallback(e=>{let r=e.closest("[data-theme-section]"),o=r?.getAttribute("data-uid"),a=r&&o===t.current?.componentUid;if(!a)return;i.current.push(r);let n=getChildrenByAttrSelector.getChildrenByAttrSelector(r,"data-theme-section-status");n&&n.setAttribute("data-theme-section-status-active","true")},[]),y=async({value:e})=>{if(!e||!t.current)return;let r=!1,o=v({...t.current}),a=await waitForElementToExist.waitForElementToExist(o,500);if(a){let e=a?.querySelectorAll("[data-toolbar-parent]");if(e.length){let o=t=>{if(r)return;let e=t.getAttribute("data-parent-uid");if(!e)return;let o=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${e}"]`);o?.length&&o.forEach(t=>{let e=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},a=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${e}"]`);r?.length&&r.forEach(t=>{let e=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},i=async e=>{r=!0;let o=e.getAttribute("data-parent-uid");if(!o)return;let i=async()=>{let t=await waitForElementToExist.waitForElementToExist(`[data-uid="${o}"]`,500),e=t?.closest("[data-product-id]");return!!e?.getAttribute("data-product-id")},n=async()=>{let t=await waitForElementToExist.waitForElementToExist(`[data-uid="${o}"]`,500),e=t?.closest("[data-article-id]");return!!e?.getAttribute("data-article-id")},l=async()=>{let t=await waitForElementToExist.waitForElementToExist(`[data-uid="${o}"]`,500),e=t?.closest("[data-carousel-item-key]");return!!e?.getAttribute("data-carousel-item-key")},d="",u="",c="";await i()&&(d=t.current?.productId||""),await n()&&(u=t.current?.articleId||""),await l()&&(c=t.current?.carouselItemKey||"");let s=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:o,productId:d,articleId:u,carouselItemKey:c,elementTag:e.getAttribute("data-component-tag")||""}});a(e),window.dispatchEvent(s),setTimeout(()=>{r=!1},0)};e.forEach(t=>{t.addEventListener("mouseover",()=>o(t)),t.addEventListener("mouseout",()=>a(t)),t.addEventListener("click",()=>i(t))})}}},p=react.useCallback(r=>{if(e.current||o.current)return;let a=r.target;if(!a||"function"!=typeof a.closest){s(),b();return}let{$toolbarHover:i,$component:n,$themeSection:l,$shopifySection:c}=findDOMClosest.findDOMClosest(a,{$toolbarHover:"[data-toolbar-hover]",$component:"[data-toolbar-wrap]",$themeSection:"[data-theme-section]",$shopifySection:"[data-shopify-section]"});if(i)return;let f=n?.getAttribute("data-uid");if(!n||!f||"ROOT"==f){b();return}let m=getChildrenByAttrSelector.getChildrenByAttrSelector(n,"data-toolbar");if(!f||"ROOT"==f||m?.getAttribute("data-toolbar-hover-focus"))return;m?.getAttribute("data-toolbar-hover-focus")||b(),A(a);let v=l||c;if(f==t.current?.componentUid){if(t.current.productId){let e=n.closest("[data-product-id]");if(e){let r=e.getAttribute("data-product-id");if(r==t.current.productId){b();return}}}if(!v)return;d({$component:v,focus:!0,isPreventSection:!0})}v?d({$component:v,focus:!0,isPreventSection:!0}):(d({$component:n,componentUid:f,focus:!0}),u({$component:n,componentUid:f}))},[A,b,d,u,s,t]),C=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid?h({componentUid:r.componentUid,productId:r.productId,articleId:r.articleId,marqueeKey:r.marqueeKey,carouselItemKey:r.carouselItemKey}):f()},[h,f,e]),w=react.useCallback(()=>{b()},[b]),E=react.useCallback(t=>{let r=t.detail;r.value&&(b(),f()),e.current=r.value},[b,f]),S=react.useCallback(t=>{let e=t.detail;e.value?g(!0):g(!1)},[]),B=react.useCallback(t=>{if(e.current)return;let r=t.detail;y({value:r?.value||!1})},[]),$=react.useCallback(t=>{let e=t.detail;e?.value?(b(),o.current=!0):o.current=!1},[b]),q=(t,e)=>{if(!t)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${t}"]`);r?.length&&r.forEach(t=>{let r=getChildrenByAttrSelector.getChildrenByAttrSelector(t,"data-outline");r&&("in"===e?(r.setAttribute("data-outline-force-hover","true"),r.setAttribute("data-outline-force-overlay","true")):(r.removeAttribute("data-outline-force-hover"),r.removeAttribute("data-outline-force-overlay")))})},O=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid&&q(r?.componentUid,r?.type)},[e]),T=e=>{let r=e.detail;t.current?.componentUid&&r?.componentUid==t.current?.componentUid&&h({...t.current})};return react.useEffect(()=>(document.addEventListener("mousemove",p),window.addEventListener("editor:active-component",C),window.addEventListener("editor:focus-outside-preview",w),window.addEventListener("editor:is-dragging",E),window.addEventListener("editor:is-editing-text-editor",S),window.addEventListener("editor:toolbar:show-parents",B),window.addEventListener("editor:toolbar:resize-spacing",$),window.addEventListener("editor:hover-component",O),window.addEventListener("editor:component:render",T),()=>{document.removeEventListener("mousemove",p),window.removeEventListener("editor:active-component",C),window.removeEventListener("editor:is-dragging",w),window.removeEventListener("editor:is-dragging",E),window.removeEventListener("editor:is-editing-text-editor",S),window.removeEventListener("editor:toolbar:show-parents",B),window.removeEventListener("editor:toolbar:resize-spacing",$),window.removeEventListener("editor:hover-component",O),window.removeEventListener("editor:component:render",T)}),[p,C,w,E,S,B,$,O,T]),jsxRuntime.jsx(jsxRuntime.Fragment,{})};var Toolbar$1=react.memo(Toolbar);exports.default=Toolbar$1;
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var getCollectionProps=require("./libs/api/get-collection-props.js"),getHomePageProps=require("./libs/api/get-home-page-props.js"),getHomePagePropsV2=require("./libs/api/get-home-page-props-v2.js"),getPreviewProps=require("./libs/api/get-preview-props.js"),getBuilderProps=require("./libs/api/get-builder-props.js"),getProductProps=require("./libs/api/get-product-props.js"),getStaticPagePropsV2=require("./libs/api/get-static-page-props-v2.js"),getPostPurchasePropsPreview=require("./libs/api/get-post-purchase-props-preview.js"),getStaticPagePropsPreview=require("./libs/api/get-static-page-props-preview.js"),fetcher=require("./libs/fetcher.js"),getLayout=require("./libs/get-layout.js"),genCss=require("./libs/helpers/gen-css.js"),useTrackingView=require("./libs/hooks/use-tracking-view.js"),usePagePreview=require("./libs/hooks/usePagePreview.js"),userAgent=require("./libs/helpers/user-agent.js"),normalize=require("./libs/helpers/normalize.js"),getFallback=require("./libs/helpers/get-fallback.js"),common=require("./libs/helpers/common.js"),getStaticPaths=require("./libs/getStaticPaths.js"),genFonts=require("./libs/helpers/gen-fonts.js"),googleFonts=require("./libs/google-fonts.js"),getStorefrontApi=require("./libs/get-storefront-api.js"),ErrorBoundary=require("./components/ErrorBoundary.js"),ErrorFallback=require("./components/ErrorFallback.js"),_404=require("./pages/404.js"),_500=require("./pages/500.js"),GoogleAnalytic=require("./components/GoogleAnalytic.js"),FacebookPixel=require("./components/FacebookPixel.js"),TikTokPixel=require("./components/TikTokPixel.js"),collectionDetail=require("./pages/collection-detail.js"),preview=require("./pages/preview.js"),productDetail=require("./pages/product-detail.js"),_static=require("./pages/static.js"),builder=require("./pages/builder.js"),staticV2=require("./pages/static-v2.js");exports.getCollectionProps=getCollectionProps.getCollectionProps,exports.getHomePageProps=getHomePageProps.getHomePageProps,exports.getHomePagePropsV2=getHomePagePropsV2.getHomePagePropsV2,exports.getPreviewProps=getPreviewProps.getPreviewProps,exports.getBuilderProps=getBuilderProps.getBuilderProps,exports.getProductProps=getProductProps.getProductProps,exports.getStaticPagePropsV2=getStaticPagePropsV2.getStaticPagePropsV2,exports.getPostPurchasePropsPreview=getPostPurchasePropsPreview.getPostPurchasePropsPreview,exports.getStaticPagePropsPreview=getStaticPagePropsPreview.getStaticPagePropsPreview,exports.createAppAPIFetcher=fetcher.createAppAPIFetcher,exports.createFetcher=fetcher.createFetcher,exports.createShopifyFetcher=fetcher.createShopifyFetcher,exports.getLayout=getLayout.getLayout,exports.genCSS=genCss.genCSS,exports.useTrackingView=useTrackingView.useTrackingView,exports.usePagePreview=usePagePreview.usePagePreview,exports.isBot=userAgent.isBot,exports.normalizePageSectionResponseV2=normalize.normalizePageSectionResponseV2,exports.parseBuilderTemplateV2=normalize.parseBuilderTemplateV2,exports.getFallbackV2=getFallback.getFallbackV2,exports.retryWithDelay=common.retryWithDelay,exports.getStaticPaths=getStaticPaths.getStaticPaths,exports.getFontFromGroupSetting=genFonts.getFontFromGroupSetting,exports.getFontsFromDataBuilder=genFonts.getFontsFromDataBuilder,exports.getFontFromGlobalStyle=googleFonts.getFontFromGlobalStyle,exports.getFonts=googleFonts.getFonts,exports.getStorefrontApi=getStorefrontApi.getStorefrontApi,exports.ErrorBoundary=ErrorBoundary.ErrorBoundary,exports.ErrorFallback=ErrorFallback.ErrorFallback,exports.Page404=_404.Page404,exports.Page500=_500.Page500,exports.GoogleAnalytic=GoogleAnalytic.GoogleAnalytic,exports.FacebookPixel=FacebookPixel.FacebookPixel,exports.TikTokPixel=TikTokPixel.TikTokPixel,exports.CollectionDetailPage=collectionDetail.default,exports.PreviewPage=preview.PreviewPage,exports.ProductDetailPage=productDetail.default,exports.StaticPage=_static.default,exports.BuilderPage=builder.BuilderPage,exports.StaticPageV2=staticV2.StaticPageV2;
1
+ "use strict";var getCollectionProps=require("./libs/api/get-collection-props.js"),getCollectionSharePageProps=require("./libs/api/get-collection-share-page-props.js"),getHomePageProps=require("./libs/api/get-home-page-props.js"),getHomePagePropsV2=require("./libs/api/get-home-page-props-v2.js"),getPreviewProps=require("./libs/api/get-preview-props.js"),getBuilderProps=require("./libs/api/get-builder-props.js"),getProductProps=require("./libs/api/get-product-props.js"),getStaticPagePropsV2=require("./libs/api/get-static-page-props-v2.js"),getSharePageProps=require("./libs/api/get-share-page-props.js"),getPostPurchasePropsPreview=require("./libs/api/get-post-purchase-props-preview.js"),getStaticPagePropsPreview=require("./libs/api/get-static-page-props-preview.js"),getPreviewContentProps=require("./libs/api/get-preview-content-props.js"),fetcher=require("./libs/fetcher.js"),getLayout=require("./libs/get-layout.js"),genCss=require("./libs/helpers/gen-css.js"),useTrackingView=require("./libs/hooks/use-tracking-view.js"),usePagePreview=require("./libs/hooks/usePagePreview.js"),userAgent=require("./libs/helpers/user-agent.js"),normalize=require("./libs/helpers/normalize.js"),getFallback=require("./libs/helpers/get-fallback.js"),common=require("./libs/helpers/common.js"),SharePageTracking=require("./components/SharePageTracking.js"),getStaticPaths=require("./libs/getStaticPaths.js"),genFonts=require("./libs/helpers/gen-fonts.js"),googleFonts=require("./libs/google-fonts.js"),getStorefrontApi=require("./libs/get-storefront-api.js"),ErrorBoundary=require("./components/ErrorBoundary.js"),ErrorFallback=require("./components/ErrorFallback.js"),_404=require("./pages/404.js"),_500=require("./pages/500.js"),GoogleAnalytic=require("./components/GoogleAnalytic.js"),FacebookPixel=require("./components/FacebookPixel.js"),TikTokPixel=require("./components/TikTokPixel.js"),collectionDetail=require("./pages/collection-detail.js"),preview=require("./pages/preview.js"),productDetail=require("./pages/product-detail.js"),_static=require("./pages/static.js"),builder=require("./pages/builder.js"),staticV2=require("./pages/static-v2.js"),previewTemplate=require("./pages/preview-template.js");exports.getCollectionProps=getCollectionProps.getCollectionProps,exports.getCollectionSharePageProps=getCollectionSharePageProps.getCollectionSharePageProps,exports.getHomePageProps=getHomePageProps.getHomePageProps,exports.getHomePagePropsV2=getHomePagePropsV2.getHomePagePropsV2,exports.getPreviewProps=getPreviewProps.getPreviewProps,exports.getBuilderProps=getBuilderProps.getBuilderProps,exports.getProductProps=getProductProps.getProductProps,exports.getStaticPagePropsV2=getStaticPagePropsV2.getStaticPagePropsV2,exports.getSharePageProps=getSharePageProps.getSharePageProps,exports.getPostPurchasePropsPreview=getPostPurchasePropsPreview.getPostPurchasePropsPreview,exports.getStaticPagePropsPreview=getStaticPagePropsPreview.getStaticPagePropsPreview,exports.getSharePageContentProps=getPreviewContentProps.getSharePageContentProps,exports.createAppAPIFetcher=fetcher.createAppAPIFetcher,exports.createFetcher=fetcher.createFetcher,exports.createShopifyFetcher=fetcher.createShopifyFetcher,exports.createTemplateFetcher=fetcher.createTemplateFetcher,exports.getLayout=getLayout.getLayout,exports.genCSS=genCss.genCSS,exports.useTrackingView=useTrackingView.useTrackingView,exports.usePagePreview=usePagePreview.usePagePreview,exports.isBot=userAgent.isBot,exports.normalizePageSectionResponseV2=normalize.normalizePageSectionResponseV2,exports.parseBuilderTemplateV2=normalize.parseBuilderTemplateV2,exports.getFallbackV2=getFallback.getFallbackV2,exports.retryWithDelay=common.retryWithDelay,exports.SharePageTracking=SharePageTracking.SharePageTracking,exports.getStaticPaths=getStaticPaths.getStaticPaths,exports.getFontFromGroupSetting=genFonts.getFontFromGroupSetting,exports.getFontsFromDataBuilder=genFonts.getFontsFromDataBuilder,exports.getFontFromGlobalStyle=googleFonts.getFontFromGlobalStyle,exports.getFonts=googleFonts.getFonts,exports.getStorefrontApi=getStorefrontApi.getStorefrontApi,exports.ErrorBoundary=ErrorBoundary.ErrorBoundary,exports.ErrorFallback=ErrorFallback.ErrorFallback,exports.Page404=_404.Page404,exports.Page500=_500.Page500,exports.GoogleAnalytic=GoogleAnalytic.GoogleAnalytic,exports.FacebookPixel=FacebookPixel.FacebookPixel,exports.TikTokPixel=TikTokPixel.TikTokPixel,exports.CollectionDetailPage=collectionDetail.default,exports.PreviewPage=preview.PreviewPage,exports.ProductDetailPage=productDetail.default,exports.StaticPage=_static.default,exports.BuilderPage=builder.BuilderPage,exports.StaticPageV2=staticV2.StaticPageV2,exports.PreviewTemplate=previewTemplate.PreviewTemplate;
@@ -0,0 +1 @@
1
+ "use strict";var core=require("@gem-sdk/core"),parseJson=require("../helpers/parse-json.js");const getCollectionSharePageProps=e=>async o=>{let r={first:1,orderBy:{direction:"DESC",field:"UPDATED_AT"},where:{isSample:!1,baseID:o||void 0}},[s]=await Promise.all([e([core.CollectionsDocument,r])]);if(!s||!s?.collections?.edges?.[0]?.node)throw Error("Collection not found");let l=s?.collections?.edges?.[0]?.node;return parseJson.serializableJson({collection:l})};exports.getCollectionSharePageProps=getCollectionSharePageProps;
@@ -0,0 +1 @@
1
+ "use strict";var core=require("@gem-sdk/core"),nextjs=require("@sentry/nextjs"),customFonts=require("../custom-fonts.js"),googleFonts=require("../google-fonts.js"),genCss=require("../helpers/gen-css.js"),normalize=require("../helpers/normalize.js"),parseJson=require("../helpers/parse-json.js"),fetcher=require("../fetcher.js"),getCollectionSharePageProps=require("./get-collection-share-page-props.js");const getSharePageContentProps=e=>async t=>{try{let{sharedPage:l,customFonts:o,publicToken:r}=await e([t]);if(!l||!r)return null;let{page:s,themeStyle:n,pageMeta:a,shopMeta:u,moneyFormat:c,moneyWithCurrencyFormat:i}=l,{sectionPosition:p}=s??{},g=normalize.parseBuilderTemplateV2({...l,sectionPosition:p}),P=null,d=null,f=null;if(s?.type==="GP_COLLECTION"){let e=(a??[]).find(e=>"selected_preview_collection"===e.key)?.value,t=e?JSON.parse(e??{}):null;d=t?.collectionId,f=t?.collectionTitle}let C=null;if(s?.type==="GP_PRODUCT"){let e=(a??[]).find(e=>"selected_preview_product"===e.key)?.value;C=e?JSON.parse(e??{}):null}let[h,m,y,S,F]=await Promise.allSettled([googleFonts.getFontStyleFromPageTemplate(g),googleFonts.getFontFromGlobalStyle(n?.data),customFonts.getCustomFonts(o),fetcher.createFetcher(r)([core.StorePropertyDocument]),s?.type==="GP_COLLECTION"?getCollectionSharePageProps.getCollectionSharePageProps(fetcher.createFetcher(r))(d??void 0):null]);P="fulfilled"===F.status?F.value?.collection:null;let v="fulfilled"===h.status?h.value:null,_="fulfilled"===m.status?m.value:null,j="fulfilled"===y.status?y.value:null,O="fulfilled"===S.status?S.value:void 0;return parseJson.serializableJson({builderData:g,page:s,themeStyle:genCss.genCSS(n?.data,!1),pageMeta:a,shopMeta:u,elementFontStyle:v,fontStyle:_,customFonts:j,publicStoreFrontData:r?{token:r,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null,pageType:s?.type,moneyFormat:c,moneyWithCurrencyFormat:i,swatches:parseJson.parseJson(O?.storeProperty?.swatchesConfig),collection:P,dynamicCollection:s?.type==="GP_COLLECTION"?{collectionId:P?.baseID,collectionTitle:f}:null,dynamicProduct:s?.type==="GP_PRODUCT"?C:null})}catch(e){return nextjs.captureException(e),null}};exports.getSharePageContentProps=getSharePageContentProps;
@@ -0,0 +1 @@
1
+ "use strict";var nextjs=require("@sentry/nextjs"),parseJson=require("../helpers/parse-json.js");const getSharePageProps=e=>async t=>{try{let{sharedPage:r,publicToken:a}=await e([t]);if(!r||!a)return null;let{share:s,shopMeta:n,page:l,pageMeta:i}=r,o=s?.thumbnails?Array.isArray(s.thumbnails)?s.thumbnails.map(e=>({url:e})):"string"==typeof s.thumbnails?[{url:s.thumbnails}]:[]:[],u={defaultTitle:n?.shop?.name??"",title:s?.title,openGraph:{site_name:n?.shop?.name??"",locale:n?.localization?.country?.isoCode??"",title:s?.title??n?.shop?.name??"",images:o},nofollow:!0,noindex:!0};return parseJson.serializableJson({seo:u,share:s,page:l,pageMeta:i})}catch(e){return nextjs.captureException(e),null}};exports.getSharePageProps=getSharePageProps;
@@ -1 +1 @@
1
- "use strict";var getStorefrontApi=require("./get-storefront-api.js"),extractOperation=require("./helpers/extract-operation.js");const createFetcher=e=>{let r=e||process.env.NEXT_PUBLIC_SHOP_TOKEN;return async e=>{let[t,o,n]=e;if(!r)throw Error("shopToken is not defined");let i=process.env.NEXT_PUBLIC_API_URL;if(!i)throw Error("NEXT_PUBLIC_API_URL is not defined");let s=extractOperation.extractOperation(t);s&&(i=`${i}?gp-online-store-operation=${s}`);let p={"Content-Type":"application/json","X-GemX-Shop-Token":r};return fetch(i,{method:"POST",headers:p,body:JSON.stringify({query:t,variables:o,operationName:n})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createAppAPIFetcher=(e,r)=>{let t=process.env.NEXT_APP_API_URL;return async o=>{let[n,i,s]=o;if(!e)throw Error("shopToken is not defined");if(!t)throw Error("NEXT_APP_API_URL is not defined");let p=extractOperation.extractOperation(n);p&&(t=`${t}?gp-online-store-operation=${p}`);let c={"Content-Type":"application/json",Authorization:`Token ${e}`,"X-GemX-Shop-ID":r||""};return fetch(`${t}?gp-online-store-operation=${s}`,{method:"POST",headers:c,body:JSON.stringify({query:n,variables:i,operationName:s})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createShopifyFetcher=(e,r)=>{let t=e??process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,o=r??process.env.NEXT_PUBLIC_STOREFRONT_HANDLE;return async e=>{if(!t)throw Error("NEXT_PUBLIC_STOREFRONT_TOKEN is not defined");if(!o)throw Error("NEXT_PUBLIC_STOREFRONT_HANDLE is not defined");let r={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t},[n,i]=e;return fetch(getStorefrontApi.getStorefrontApi(o),{method:"POST",headers:r,body:JSON.stringify({query:n,variables:i})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}};exports.createAppAPIFetcher=createAppAPIFetcher,exports.createFetcher=createFetcher,exports.createShopifyFetcher=createShopifyFetcher;
1
+ "use strict";var getStorefrontApi=require("./get-storefront-api.js"),extractOperation=require("./helpers/extract-operation.js");const createFetcher=e=>{let r=e||process.env.NEXT_PUBLIC_SHOP_TOKEN;return async e=>{let[t,o,n]=e;if(!r)throw Error("shopToken is not defined");let s=process.env.NEXT_PUBLIC_API_URL;if(!s)throw Error("NEXT_PUBLIC_API_URL is not defined");let i=extractOperation.extractOperation(t);i&&(s=`${s}?gp-online-store-operation=${i}`);let a={"Content-Type":"application/json","X-GemX-Shop-Token":r};return fetch(s,{method:"POST",headers:a,body:JSON.stringify({query:t,variables:o,operationName:n})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createAppAPIFetcher=(e,r)=>{let t=process.env.NEXT_APP_API_URL;return async o=>{let[n,s,i]=o;if(!e)throw Error("shopToken is not defined");if(!t)throw Error("NEXT_APP_API_URL is not defined");let a=extractOperation.extractOperation(n);a&&(t=`${t}?gp-online-store-operation=${a}`);let c={"Content-Type":"application/json",Authorization:`Token ${e}`,"X-GemX-Shop-ID":r||""};return fetch(`${t}?gp-online-store-operation=${i}`,{method:"POST",headers:c,body:JSON.stringify({query:n,variables:s,operationName:i})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createShopifyFetcher=(e,r)=>{let t=e??process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,o=r??process.env.NEXT_PUBLIC_STOREFRONT_HANDLE;return async e=>{if(!t)throw Error("NEXT_PUBLIC_STOREFRONT_TOKEN is not defined");if(!o)throw Error("NEXT_PUBLIC_STOREFRONT_HANDLE is not defined");let r={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t},[n,s]=e;return fetch(getStorefrontApi.getStorefrontApi(o),{method:"POST",headers:r,body:JSON.stringify({query:n,variables:s})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createTemplateFetcher=e=>{let r=process.env.NEXT_PUBLIC_URL_SHARE_PAGE;return async()=>{if(!r)throw Error("NEXT_PUBLIC_URL_SHARE_PAGE is not defined");try{let t=await fetch(`${r}/share/page/${e}`,{method:"GET"});if(!t.ok)throw Error(`HTTP error! status: ${t.status}`);let o=await t.json();if(o.errors)throw Error(`API errors: ${JSON.stringify(o.errors)}`);return o.result}catch(e){throw console.error("Template fetcher error:",e),e}}};exports.createAppAPIFetcher=createAppAPIFetcher,exports.createFetcher=createFetcher,exports.createShopifyFetcher=createShopifyFetcher,exports.createTemplateFetcher=createTemplateFetcher;
@@ -1 +1 @@
1
- "use strict";const getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o],n=r.styles,i=r.settings;getFontFromGroupSetting(e,n),getFontFromGroupSetting(e,i)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=e[r];if(!n)continue;for(let e of(getFontValue(t,n),o))n[e]&&getFontValue(t,n[e])}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let o=e.custom?.fontFamily;"string"==typeof o&&(o={value:e.custom?.fontFamily||"",type:"google"});let r=o?.value,n=e.custom?.fontVariants;if(n?.length||(n=[e.custom?.fontWeight]),o&&n?.length){let i=n.map(t=>"regular"===t?"400":t),l=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(l){let n=uniqueArray([l,...e?.attrs?.isAlwaysLoadBold?["700"]:[]]),a=t.find(t=>t.family==r&&t.variants.includes(l));if(!a){let e=t.find(t=>t.family==r);e?e.variants.push(l):("700"!==l&&i.includes("700")&&n.push("700"),t.push({family:r||"",variants:n,subsets:[],type:o.type}))}}}};exports.getFontFromGroupSetting=getFontFromGroupSetting,exports.getFontsFromDataBuilder=getFontsFromDataBuilder;
1
+ "use strict";const EXCLUDED_FONT_FAMILIES=["sans-serif"],getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o],n=r.styles,i=r.settings;getFontFromGroupSetting(e,n),getFontFromGroupSetting(e,i)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=e[r];if(!n)continue;for(let e of(getFontValue(t,n),o))n[e]&&getFontValue(t,n[e])}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let o=e.custom?.fontFamily;"string"==typeof o&&(o={value:e.custom?.fontFamily||"",type:"google"});let r=o?.value;if(EXCLUDED_FONT_FAMILIES.includes(r))return;let n=e.custom?.fontVariants;if(n?.length||(n=[e.custom?.fontWeight]),o&&n?.length){let i=n.map(t=>"regular"===t?"400":t),s=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(s){let n=uniqueArray([s,...e?.attrs?.isAlwaysLoadBold?["700"]:[]]),l=t.find(t=>t.family==r&&t.variants.includes(s));if(!l){let e=t.find(t=>t.family==r);e?e.variants.push(s):("700"!==s&&i.includes("700")&&n.push("700"),t.push({family:r||"",variants:n,subsets:[],type:o.type}))}}}};exports.getFontFromGroupSetting=getFontFromGroupSetting,exports.getFontsFromDataBuilder=getFontsFromDataBuilder;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core");const getFallbackV2=async(e,t,a=!0)=>{let r=!!a&&!process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,l=t.map(e=>core.prefetchQueries(e.data,{isSample:r,isStorefront:a})).flat(),c=await Promise.allSettled(l.map(({query:t,variables:a,func:r})=>r?r(e,a):t?e([t,a]):{})),s=l.reduce((e,{key:t},a)=>{let r=c[a];return r?.status==="fulfilled"?{...e,[t]:r.value}:e},{});return s};exports.getFallbackV2=getFallbackV2;
1
+ "use strict";var core=require("@gem-sdk/core");const getFallbackV2=async(e,t,a=!0,r=!1)=>{let l=!r&&!!a&&!process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,c=t.map(e=>core.prefetchQueries(e.data,{isSample:l,isStorefront:a})).flat(),s=await Promise.allSettled(c.map(({query:t,variables:a,func:r})=>r?r(e,a):t?e([t,a]):{})),u=c.reduce((e,{key:t},a)=>{let r=s[a];return r?.status==="fulfilled"?{...e,[t]:r.value}:e},{});return u};exports.getFallbackV2=getFallbackV2;
@@ -0,0 +1,5 @@
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),Head=require("next/head"),router=require("next/router"),parseHtml=require("../libs/parse-html.js"),react=require("react"),dynamic=require("next/dynamic");const PreviewTemplate=({components:e,builderData:t,sectionData:s,themeStyle:r,fontStyle:n,elementFontStyle:a,customCodeHeader:i,customFonts:l,pageBackground:c,publicStoreFrontData:o,page:u,collection:d,dynamicCollection:m,dynamicProduct:g})=>{let{disableExternalLinks:x}=core.usePreviewSharePage(),p=router.useRouter(),{t:j}=core.useI18n(),h="custom-code-header",y=dynamic(()=>import("@gem-sdk/core").then(e=>e.CollectionProvider)),R=u?.type==="GP_COLLECTION"?y:react.Fragment;return(react.useEffect(()=>{let e=document.querySelectorAll(`[class*="${h}-"]`),t=[];e.length>1&&e.forEach(e=>{let s=e.className;if(t.includes(s)){e.remove();return}t.push(s)})},[]),react.useEffect(()=>{x()},[x]),p.isFallback)?jsxRuntime.jsx("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:jsxRuntime.jsxs("div",{className:"gp-flex gp-gap-2",children:[jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Head,{children:[parseHtml.parseHtml(h,i,!0),r&&jsxRuntime.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:r}},"global-style"),n&&jsxRuntime.jsx("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:n}},"google-fonts"),a&&a.map(e=>jsxRuntime.jsx("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:e}},e)),l&&jsxRuntime.jsx("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:l}},n),c?.isUsePageBackground&&c?.background&&jsxRuntime.jsx("style",{children:`
2
+ body {
3
+ background: ${c.background};
4
+ }
5
+ `},`page_background_${c?.background}`)]}),jsxRuntime.jsx(core.PageProvider,{publicStoreFrontData:o,dynamicCollection:m,dynamicProduct:g,children:jsxRuntime.jsx(R,{collection:d,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsx("div",{id:"storefront","data-page-name":u?.name,"data-assigned-product-title":g?.productTitle,"data-assigned-collection-title":m?.collectionTitle,children:jsxRuntime.jsx(core.SectionProvider,{data:s,children:jsxRuntime.jsx(core.I18nProvider,{t:j,children:t?.map(e=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(core.BuilderProvider,{state:e.data,lazy:e.lazy,priority:e.priority,isPreview:!0,children:jsxRuntime.jsx(core.Render,{uid:e.uid})},e.uid)}))})})})})})})]})};exports.PreviewTemplate=PreviewTemplate;
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ import{jsxs as a,Fragment as t,jsx as e}from"react/jsx-runtime";import{gtag as r}from"@gem-sdk/core";import{usePathname as g}from"next/navigation";import n from"next/script";let SharePageTracking=({trackingId:o,params:i})=>{let m=g(),d=()=>{r.sharePageView(m,o,i)};return o?a(t,{children:[e(n,{strategy:"lazyOnload",onReady:d,src:`https://www.googletagmanager.com/gtag/js?id=${o}`}),e(n,{id:"gtag-init",strategy:"lazyOnload",dangerouslySetInnerHTML:{__html:`
3
+ window.dataLayer = window.dataLayer || [];
4
+ function gtag(){dataLayer.push(arguments);}
5
+ gtag('js', new Date());
6
+ gtag('config', '${o}');
7
+ `}})]}):null};export{SharePageTracking};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as t,Fragment as e}from"react/jsx-runtime";import{memo as r,useRef as o,useCallback as a,useEffect as i}from"react";import{getDOMElementParents as n}from"./toolbar/utils/getDOMElementParents.js";import{TOOLBAR_ACTIVE_HEIGHT as d,TOOLBAR_HOVER_HEIGHT as u}from"./toolbar/const.js";import{getChildrenByAttrSelector as l}from"./toolbar/utils/getChildrenByAttrSelector.js";import{findOverflowParent as c}from"./toolbar/utils/findOverflowParent.js";import{waitForElementToExist as s}from"./toolbar/utils/waitForElementToExist.js";import{isOverParent as b}from"./toolbar/utils/isOverParent.js";import{findDOMClosest as f}from"./toolbar/utils/findDOMClosest.js";let Toolbar=()=>{let r=o(null),v=o(!1),m=o(),p=o(!1),h=o([]),g=o([]),A=o([]),w=({state:t,$toolbar:e,$component:r})=>{let o=c(r,e),a=e.getBoundingClientRect(),i=r.getBoundingClientRect(),n=window.innerWidth;o?i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true"):a.top<d+1&&(i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true")),i.left+a.width>n&&e.setAttribute(`data-toolbar-${t}-overflow`,"true");let u=r?.closest('[aria-label="Dialog body"]');if(u){let r=u.getBoundingClientRect(),o=r.left+r.width-20;i.left+a.width>o&&e.setAttribute(`data-toolbar-${t}-overflow`,"true")}},y=a(({$component:t,componentUid:e,focus:r,isPreventSection:o,isParent:a})=>{if(!t&&!e)return;if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}h.current.push(t);let i=l(t,"data-toolbar"),n=l(t,"data-outline"),d=l(t,"data-toolbar-add-top"),u=l(t,"data-toolbar-add-bottom"),c=l(t,"data-theme-section-status");o&&c&&c.setAttribute("data-theme-section-status-active","true"),i&&(i.removeAttribute("style"),a||i.setAttribute("data-toolbar-hover","true"),r&&i.setAttribute("data-toolbar-hover-focus","true"),w({$toolbar:i,$component:t,state:"hover"})),n&&(n.setAttribute("data-outline-hover","true"),a&&n.setAttribute("data-outline-parent-hover","true"),o&&(g.current.push(t),n.setAttribute("data-outline-overlay-theme-section","true")),r&&n.setAttribute("data-outline-hover-focus","true")),d&&!a&&d.setAttribute("data-toolbar-add-hover","true"),u&&!a&&u.setAttribute("data-toolbar-add-hover","true")},[]),$=a(({$component:t,componentUid:e})=>{if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=n(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&y({$component:t,isParent:!0});E({$component:t,$parents:r})}},[y]),E=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=l(t,"data-toolbar-hover-focus");if(r){let t=r.getBoundingClientRect(),o=!!r.getAttribute("data-toolbar-hover-revert"),a=!!r.getAttribute("data-toolbar-hover-inside"),i=1;for(let r of e)if(r){let e=r.getAttribute("data-component-tag");if("Section"===e)continue;let n=l(r,"data-toolbar-hover");if(n){let e=n.getAttribute("data-toolbar-active");if(e)continue;let r=n.getBoundingClientRect(),d=o||a;if(b({current:t,parent:r,index:i,revert:d})){let e=getComputedStyle(n),o=t.top-r.top,a=t.left-r.left,l=parseFloat(e.top)+o-(u-1)*i;d&&(l=parseFloat(e.top)-o+(u-1)*i);let c=parseFloat(e.left)+a;n.setAttribute("style",`top: ${l}px;left: ${c}px;`),i++}}}}},S=a(()=>{let t=["data-outline-overlay-theme-section","data-theme-section-status-active"],e=g.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}g.current=[]},[]),q=a(()=>{let t=["data-toolbar-hover-focus","data-toolbar-hover","data-outline-hover-focus","data-toolbar-hover-revert","data-toolbar-hover-inside","data-outline-hover","data-toolbar-add-hover","data-outline-parent-hover","data-toolbar-hover-overflow"],e=h.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}S(),h.current=[]},[S]),L=a(()=>{r.current=null;let t=["data-toolbar-active","data-outline-active","data-toolbar-add-active","data-toolbar-active-revert","data-toolbar-active-inside","data-spacing-margin-bottom-active","data-toolbar-force-hover","data-outline-force-hover","data-toolbar-active-overflow"],e=A.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}A.current=[],C(!1),m.current&&m.current()},[]),U=a(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=l(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let t=o.querySelector("[data-spacing-margin-bottom-bg]")||null,r=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(t&&r){let a=e.marginBottom;t.style.height=a,r.style.top=a,o.setAttribute("data-spacing-margin-bottom-active","true")}}},[]),I=({componentUid:t,productId:e,articleId:r,marqueeKey:o})=>r?`${r?`[data-article-id="${r}"][data-uid="${t}"], [data-article-id="${r}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`:o?`[marquee-item-key="${o}"] [data-uid="${t}"]`:`${e?`[data-product-id="${e}"][data-uid="${t}"], [data-product-id="${e}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`,j=a(async({componentUid:t,productId:e,timeAwait:o=600,articleId:a,forceReActive:i,marqueeKey:n})=>{if(!t)return;let d=I({componentUid:t,productId:e,articleId:a,marqueeKey:n}),u=await s(d,o);if(!u||!i&&t==r.current?.componentUid&&e==r.current?.productId&&a==r.current?.articleId&&n==r.current?.marqueeKey)return;(t!==r.current?.componentUid||e!==r.current?.productId||a!==r.current?.articleId||i)&&L(),(i||t===r.current?.componentUid)&&e===r.current?.productId&&n===r.current?.marqueeKey||L(),A.current.push(u);let c=l(u,"data-toolbar"),b=l(u,"data-outline"),v=l(u,"data-toolbar-add-top"),m=l(u,"data-toolbar-add-bottom");c&&(r.current={componentUid:t,productId:e,articleId:a,marqueeKey:n},c.removeAttribute("style"),c.setAttribute("data-toolbar-active","true"),w({$toolbar:c,$component:u,state:"active"})),b&&b.setAttribute("data-outline-active","true"),v&&v.setAttribute("data-toolbar-add-active","true"),m&&m.setAttribute("data-toolbar-add-active","true");let{$isChildOfMarquee:p,$section:h}=f(u,{$isChildOfMarquee:'[data-component-tag="Marquee"]',$section:'[data-component-tag="Section"]'});if(h&&(e||a||p)){let e=h.querySelectorAll(`[data-uid="${t}"]`);e?.length&&e.forEach(t=>{A.current.push(t);let e=l(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}U({$component:u}),q()},[L,q,U]),C=async t=>{if(t){if(r.current?.componentUid){let e=I({...r.current}),o=await s(e,500);if(o){let e=l(o,"data-toolbar"),r=l(o,"data-outline"),a=l(o,"data-spacing");e&&t&&e.setAttribute("data-toolbar-editor-inline-focus","true"),r&&t&&r.setAttribute("data-outline-editor-inline-focus","true"),a&&t&&a.setAttribute("data-spacing-hidden","true")}}}else{let t=document.body.querySelector("#storefront")?.querySelectorAll("[data-outline-editor-inline-focus],[data-toolbar-editor-inline-focus],[data-spacing-hidden]");t?.length&&t.forEach(t=>{t&&(t.removeAttribute("data-toolbar-editor-inline-focus"),t.removeAttribute("data-outline-editor-inline-focus"),t.removeAttribute("data-spacing-hidden"))})}},O=a(t=>{let e=t.closest("[data-theme-section]"),o=e?.getAttribute("data-uid"),a=e&&o===r.current?.componentUid;if(!a)return;g.current.push(e);let i=l(e,"data-theme-section-status");i&&i.setAttribute("data-theme-section-status-active","true")},[]),T=async({value:t})=>{if(!t||!r.current)return;let e=!1,o=I({...r.current}),a=await s(o,500);if(a){let t=a?.querySelectorAll("[data-toolbar-parent]");if(t.length){let o=t=>{if(e)return;let r=t.getAttribute("data-parent-uid");if(!r)return;let o=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${r}"]`);o?.length&&o.forEach(t=>{let e=l(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},a=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${e}"]`);r?.length&&r.forEach(t=>{let e=l(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},i=async t=>{e=!0;let o=t.getAttribute("data-parent-uid");if(!o)return;let i=async()=>{let t=await s(`[data-uid="${o}"]`,500),e=t?.closest("[data-product-id]");return!!e?.getAttribute("data-product-id")},n=async()=>{let t=await s(`[data-uid="${o}"]`,500),e=t?.closest("[data-article-id]");return!!e?.getAttribute("data-article-id")},d="",u="";await i()&&(d=r.current?.productId||""),await n()&&(u=r.current?.articleId||"");let l=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:o,productId:d,articleId:u,elementTag:t.getAttribute("data-component-tag")||""}});a(t),window.dispatchEvent(l),setTimeout(()=>{e=!1},0)};t.forEach(t=>{t.addEventListener("mouseover",()=>o(t)),t.addEventListener("mouseout",()=>a(t)),t.addEventListener("click",()=>i(t))})}}},x=a(t=>{if(v.current||p.current)return;let e=t.target;if(!e||"function"!=typeof e.closest){S(),q();return}let{$toolbarHover:o,$component:a,$themeSection:i,$shopifySection:n}=f(e,{$toolbarHover:"[data-toolbar-hover]",$component:"[data-toolbar-wrap]",$themeSection:"[data-theme-section]",$shopifySection:"[data-shopify-section]"});if(o)return;let d=a?.getAttribute("data-uid");if(!a||!d||"ROOT"==d){q();return}let u=l(a,"data-toolbar");if(!d||"ROOT"==d||u?.getAttribute("data-toolbar-hover-focus"))return;u?.getAttribute("data-toolbar-hover-focus")||q(),O(e);let c=i||n;if(d==r.current?.componentUid){if(r.current.productId){let t=a.closest("[data-product-id]");if(t){let e=t.getAttribute("data-product-id");if(e==r.current.productId){q();return}}}if(!c)return;y({$component:c,focus:!0,isPreventSection:!0})}c?y({$component:c,focus:!0,isPreventSection:!0}):(y({$component:a,componentUid:d,focus:!0}),$({$component:a,componentUid:d}))},[O,q,y,$,S,r]),B=a(t=>{if(v.current)return;let e=t.detail;e?.componentUid?j({componentUid:e.componentUid,productId:e.productId,articleId:e.articleId,marqueeKey:e.marqueeKey}):L()},[j,L,v]),R=a(()=>{q()},[q]),P=a(t=>{let e=t.detail;e.value&&(q(),L()),v.current=e.value},[q,L]),F=a(t=>{let e=t.detail;e.value?C(!0):C(!1)},[]),K=a(t=>{if(v.current)return;let e=t.detail;T({value:e?.value||!1})},[]),M=a(t=>{let e=t.detail;e?.value?(q(),p.current=!0):p.current=!1},[q]),D=(t,e)=>{if(!t)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${t}"]`);r?.length&&r.forEach(t=>{let r=l(t,"data-outline");r&&("in"===e?(r.setAttribute("data-outline-force-hover","true"),r.setAttribute("data-outline-force-overlay","true")):(r.removeAttribute("data-outline-force-hover"),r.removeAttribute("data-outline-force-overlay")))})},k=a(t=>{if(v.current)return;let e=t.detail;e?.componentUid&&D(e?.componentUid,e?.type)},[v]),z=t=>{let e=t.detail;r.current?.componentUid&&e?.componentUid==r.current?.componentUid&&j({...r.current})};return i(()=>(document.addEventListener("mousemove",x),window.addEventListener("editor:active-component",B),window.addEventListener("editor:focus-outside-preview",R),window.addEventListener("editor:is-dragging",P),window.addEventListener("editor:is-editing-text-editor",F),window.addEventListener("editor:toolbar:show-parents",K),window.addEventListener("editor:toolbar:resize-spacing",M),window.addEventListener("editor:hover-component",k),window.addEventListener("editor:component:render",z),()=>{document.removeEventListener("mousemove",x),window.removeEventListener("editor:active-component",B),window.removeEventListener("editor:is-dragging",R),window.removeEventListener("editor:is-dragging",P),window.removeEventListener("editor:is-editing-text-editor",F),window.removeEventListener("editor:toolbar:show-parents",K),window.removeEventListener("editor:toolbar:resize-spacing",M),window.removeEventListener("editor:hover-component",k),window.removeEventListener("editor:component:render",z)}),[x,B,R,P,F,K,M,k,z]),t(e,{})};var Toolbar$1=r(Toolbar);export{Toolbar$1 as default};
2
+ import{jsx as t,Fragment as e}from"react/jsx-runtime";import{memo as r,useRef as o,useCallback as a,useEffect as i}from"react";import{getDOMElementParents as n}from"./toolbar/utils/getDOMElementParents.js";import{TOOLBAR_ACTIVE_HEIGHT as d,TOOLBAR_HOVER_HEIGHT as u}from"./toolbar/const.js";import{getChildrenByAttrSelector as l}from"./toolbar/utils/getChildrenByAttrSelector.js";import{findOverflowParent as c}from"./toolbar/utils/findOverflowParent.js";import{waitForElementToExist as s}from"./toolbar/utils/waitForElementToExist.js";import{isOverParent as b}from"./toolbar/utils/isOverParent.js";import{findDOMClosest as m}from"./toolbar/utils/findDOMClosest.js";let Toolbar=()=>{let r=o(null),f=o(!1),v=o(),p=o(!1),h=o([]),g=o([]),A=o([]),y=({state:t,$toolbar:e,$component:r})=>{let o=c(r,e),a=e.getBoundingClientRect(),i=r.getBoundingClientRect(),n=window.innerWidth;o?i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true"):a.top<d+1&&(i?.height<=60?e.setAttribute(`data-toolbar-${t}-revert`,"true"):e.setAttribute(`data-toolbar-${t}-inside`,"true")),i.left+a.width>n&&e.setAttribute(`data-toolbar-${t}-overflow`,"true");let u=r?.closest('[aria-label="Dialog body"]');if(u){let r=u.getBoundingClientRect(),o=r.left+r.width-20;i.left+a.width>o&&e.setAttribute(`data-toolbar-${t}-overflow`,"true")}},w=a(({$component:t,componentUid:e,focus:r,isPreventSection:o,isParent:a})=>{if(!t&&!e)return;if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}h.current.push(t);let i=l(t,"data-toolbar"),n=l(t,"data-outline"),d=l(t,"data-toolbar-add-top"),u=l(t,"data-toolbar-add-bottom"),c=l(t,"data-theme-section-status");o&&c&&c.setAttribute("data-theme-section-status-active","true"),i&&(i.removeAttribute("style"),a||i.setAttribute("data-toolbar-hover","true"),r&&i.setAttribute("data-toolbar-hover-focus","true"),y({$toolbar:i,$component:t,state:"hover"})),n&&(n.setAttribute("data-outline-hover","true"),a&&n.setAttribute("data-outline-parent-hover","true"),o&&(g.current.push(t),n.setAttribute("data-outline-overlay-theme-section","true")),r&&n.setAttribute("data-outline-hover-focus","true")),d&&!a&&d.setAttribute("data-toolbar-add-hover","true"),u&&!a&&u.setAttribute("data-toolbar-add-hover","true")},[]),$=a(({$component:t,componentUid:e})=>{if(!t){let r=document.body.querySelector("#storefront")?.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=n(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&w({$component:t,isParent:!0});E({$component:t,$parents:r})}},[w]),E=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=l(t,"data-toolbar-hover-focus");if(r){let t=r.getBoundingClientRect(),o=!!r.getAttribute("data-toolbar-hover-revert"),a=!!r.getAttribute("data-toolbar-hover-inside"),i=1;for(let r of e)if(r){let e=r.getAttribute("data-component-tag");if("Section"===e)continue;let n=l(r,"data-toolbar-hover");if(n){let e=n.getAttribute("data-toolbar-active");if(e)continue;let r=n.getBoundingClientRect(),d=o||a;if(b({current:t,parent:r,index:i,revert:d})){let e=getComputedStyle(n),o=t.top-r.top,a=t.left-r.left,l=parseFloat(e.top)+o-(u-1)*i;d&&(l=parseFloat(e.top)-o+(u-1)*i);let c=parseFloat(e.left)+a;n.setAttribute("style",`top: ${l}px;left: ${c}px;`),i++}}}}},S=a(()=>{let t=["data-outline-overlay-theme-section","data-theme-section-status-active"],e=g.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}g.current=[]},[]),q=a(()=>{let t=["data-toolbar-hover-focus","data-toolbar-hover","data-outline-hover-focus","data-toolbar-hover-revert","data-toolbar-hover-inside","data-outline-hover","data-toolbar-add-hover","data-outline-parent-hover","data-toolbar-hover-overflow"],e=h.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}S(),h.current=[]},[S]),L=a(()=>{r.current=null;let t=["data-toolbar-active","data-outline-active","data-toolbar-add-active","data-toolbar-active-revert","data-toolbar-active-inside","data-spacing-margin-bottom-active","data-toolbar-force-hover","data-outline-force-hover","data-toolbar-active-overflow"],e=A.current;if(e.length)for(let r of e){let e=r.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})}A.current=[],C(!1),v.current&&v.current()},[]),I=a(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=l(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let t=o.querySelector("[data-spacing-margin-bottom-bg]")||null,r=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(t&&r){let a=e.marginBottom;t.style.height=a,r.style.top=a,o.setAttribute("data-spacing-margin-bottom-active","true")}}},[]),U=({componentUid:t,productId:e,articleId:r,marqueeKey:o,carouselItemKey:a})=>r?`${r?`[data-article-id="${r}"][data-uid="${t}"], [data-article-id="${r}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`:o?`[marquee-item-key="${o}"] [data-uid="${t}"]`:a?`[data-carousel-item-key="${a}"] [data-uid="${t}"]`:`${e?`[data-product-id="${e}"][data-uid="${t}"], [data-product-id="${e}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`,j=a(async({componentUid:t,productId:e,timeAwait:o=600,articleId:a,forceReActive:i,marqueeKey:n,carouselItemKey:d})=>{if(!t)return;let u=U({componentUid:t,productId:e,articleId:a,marqueeKey:n,carouselItemKey:d}),c=await s(u,o);if(!c||!i&&t==r.current?.componentUid&&e==r.current?.productId&&a==r.current?.articleId&&n==r.current?.marqueeKey&&d==r.current?.carouselItemKey)return;(t!==r.current?.componentUid||e!==r.current?.productId||a!==r.current?.articleId||d!==r.current?.carouselItemKey||i)&&L(),(i||t===r.current?.componentUid)&&e===r.current?.productId&&n===r.current?.marqueeKey&&d===r.current?.carouselItemKey||L(),A.current.push(c);let b=l(c,"data-toolbar"),f=l(c,"data-outline"),v=l(c,"data-toolbar-add-top"),p=l(c,"data-toolbar-add-bottom");b&&(r.current={componentUid:t,productId:e,articleId:a,marqueeKey:n,carouselItemKey:d},b.removeAttribute("style"),b.setAttribute("data-toolbar-active","true"),y({$toolbar:b,$component:c,state:"active"})),f&&f.setAttribute("data-outline-active","true"),v&&v.setAttribute("data-toolbar-add-active","true"),p&&p.setAttribute("data-toolbar-add-active","true");let{$isChildOfMarquee:h,$section:g}=m(c,{$isChildOfMarquee:'[data-component-tag="Marquee"]',$section:'[data-component-tag="Section"]'});if(g&&(e||a||h)){let e=g.querySelectorAll(`[data-uid="${t}"]`);e?.length&&e.forEach(t=>{A.current.push(t);let e=l(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}I({$component:c}),q()},[L,q,I]),C=async t=>{if(t){if(r.current?.componentUid){let e=U({...r.current}),o=await s(e,500);if(o){let e=l(o,"data-toolbar"),r=l(o,"data-outline"),a=l(o,"data-spacing");e&&t&&e.setAttribute("data-toolbar-editor-inline-focus","true"),r&&t&&r.setAttribute("data-outline-editor-inline-focus","true"),a&&t&&a.setAttribute("data-spacing-hidden","true")}}}else{let t=document.body.querySelector("#storefront")?.querySelectorAll("[data-outline-editor-inline-focus],[data-toolbar-editor-inline-focus],[data-spacing-hidden]");t?.length&&t.forEach(t=>{t&&(t.removeAttribute("data-toolbar-editor-inline-focus"),t.removeAttribute("data-outline-editor-inline-focus"),t.removeAttribute("data-spacing-hidden"))})}},K=a(t=>{let e=t.closest("[data-theme-section]"),o=e?.getAttribute("data-uid"),a=e&&o===r.current?.componentUid;if(!a)return;g.current.push(e);let i=l(e,"data-theme-section-status");i&&i.setAttribute("data-theme-section-status-active","true")},[]),O=async({value:t})=>{if(!t||!r.current)return;let e=!1,o=U({...r.current}),a=await s(o,500);if(a){let t=a?.querySelectorAll("[data-toolbar-parent]");if(t.length){let o=t=>{if(e)return;let r=t.getAttribute("data-parent-uid");if(!r)return;let o=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${r}"]`);o?.length&&o.forEach(t=>{let e=l(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},a=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${e}"]`);r?.length&&r.forEach(t=>{let e=l(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},i=async t=>{e=!0;let o=t.getAttribute("data-parent-uid");if(!o)return;let i=async()=>{let t=await s(`[data-uid="${o}"]`,500),e=t?.closest("[data-product-id]");return!!e?.getAttribute("data-product-id")},n=async()=>{let t=await s(`[data-uid="${o}"]`,500),e=t?.closest("[data-article-id]");return!!e?.getAttribute("data-article-id")},d=async()=>{let t=await s(`[data-uid="${o}"]`,500),e=t?.closest("[data-carousel-item-key]");return!!e?.getAttribute("data-carousel-item-key")},u="",l="",c="";await i()&&(u=r.current?.productId||""),await n()&&(l=r.current?.articleId||""),await d()&&(c=r.current?.carouselItemKey||"");let b=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:o,productId:u,articleId:l,carouselItemKey:c,elementTag:t.getAttribute("data-component-tag")||""}});a(t),window.dispatchEvent(b),setTimeout(()=>{e=!1},0)};t.forEach(t=>{t.addEventListener("mouseover",()=>o(t)),t.addEventListener("mouseout",()=>a(t)),t.addEventListener("click",()=>i(t))})}}},T=a(t=>{if(f.current||p.current)return;let e=t.target;if(!e||"function"!=typeof e.closest){S(),q();return}let{$toolbarHover:o,$component:a,$themeSection:i,$shopifySection:n}=m(e,{$toolbarHover:"[data-toolbar-hover]",$component:"[data-toolbar-wrap]",$themeSection:"[data-theme-section]",$shopifySection:"[data-shopify-section]"});if(o)return;let d=a?.getAttribute("data-uid");if(!a||!d||"ROOT"==d){q();return}let u=l(a,"data-toolbar");if(!d||"ROOT"==d||u?.getAttribute("data-toolbar-hover-focus"))return;u?.getAttribute("data-toolbar-hover-focus")||q(),K(e);let c=i||n;if(d==r.current?.componentUid){if(r.current.productId){let t=a.closest("[data-product-id]");if(t){let e=t.getAttribute("data-product-id");if(e==r.current.productId){q();return}}}if(!c)return;w({$component:c,focus:!0,isPreventSection:!0})}c?w({$component:c,focus:!0,isPreventSection:!0}):(w({$component:a,componentUid:d,focus:!0}),$({$component:a,componentUid:d}))},[K,q,w,$,S,r]),x=a(t=>{if(f.current)return;let e=t.detail;e?.componentUid?j({componentUid:e.componentUid,productId:e.productId,articleId:e.articleId,marqueeKey:e.marqueeKey,carouselItemKey:e.carouselItemKey}):L()},[j,L,f]),B=a(()=>{q()},[q]),R=a(t=>{let e=t.detail;e.value&&(q(),L()),f.current=e.value},[q,L]),P=a(t=>{let e=t.detail;e.value?C(!0):C(!1)},[]),k=a(t=>{if(f.current)return;let e=t.detail;O({value:e?.value||!1})},[]),F=a(t=>{let e=t.detail;e?.value?(q(),p.current=!0):p.current=!1},[q]),M=(t,e)=>{if(!t)return;let r=document.body.querySelector("#storefront")?.querySelectorAll(`[data-uid="${t}"]`);r?.length&&r.forEach(t=>{let r=l(t,"data-outline");r&&("in"===e?(r.setAttribute("data-outline-force-hover","true"),r.setAttribute("data-outline-force-overlay","true")):(r.removeAttribute("data-outline-force-hover"),r.removeAttribute("data-outline-force-overlay")))})},D=a(t=>{if(f.current)return;let e=t.detail;e?.componentUid&&M(e?.componentUid,e?.type)},[f]),z=t=>{let e=t.detail;r.current?.componentUid&&e?.componentUid==r.current?.componentUid&&j({...r.current})};return i(()=>(document.addEventListener("mousemove",T),window.addEventListener("editor:active-component",x),window.addEventListener("editor:focus-outside-preview",B),window.addEventListener("editor:is-dragging",R),window.addEventListener("editor:is-editing-text-editor",P),window.addEventListener("editor:toolbar:show-parents",k),window.addEventListener("editor:toolbar:resize-spacing",F),window.addEventListener("editor:hover-component",D),window.addEventListener("editor:component:render",z),()=>{document.removeEventListener("mousemove",T),window.removeEventListener("editor:active-component",x),window.removeEventListener("editor:is-dragging",B),window.removeEventListener("editor:is-dragging",R),window.removeEventListener("editor:is-editing-text-editor",P),window.removeEventListener("editor:toolbar:show-parents",k),window.removeEventListener("editor:toolbar:resize-spacing",F),window.removeEventListener("editor:hover-component",D),window.removeEventListener("editor:component:render",z)}),[T,x,B,R,P,k,F,D,z]),t(e,{})};var Toolbar$1=r(Toolbar);export{Toolbar$1 as default};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{getCollectionProps}from"./libs/api/get-collection-props.js";export{getHomePageProps}from"./libs/api/get-home-page-props.js";export{getHomePagePropsV2}from"./libs/api/get-home-page-props-v2.js";export{getPreviewProps}from"./libs/api/get-preview-props.js";export{getBuilderProps}from"./libs/api/get-builder-props.js";export{getProductProps}from"./libs/api/get-product-props.js";export{getStaticPagePropsV2}from"./libs/api/get-static-page-props-v2.js";export{getPostPurchasePropsPreview}from"./libs/api/get-post-purchase-props-preview.js";export{getStaticPagePropsPreview}from"./libs/api/get-static-page-props-preview.js";export{createAppAPIFetcher,createFetcher,createShopifyFetcher}from"./libs/fetcher.js";export{getLayout}from"./libs/get-layout.js";export{genCSS}from"./libs/helpers/gen-css.js";export{useTrackingView}from"./libs/hooks/use-tracking-view.js";export{usePagePreview}from"./libs/hooks/usePagePreview.js";export{isBot}from"./libs/helpers/user-agent.js";export{normalizePageSectionResponseV2,parseBuilderTemplateV2}from"./libs/helpers/normalize.js";export{getFallbackV2}from"./libs/helpers/get-fallback.js";export{retryWithDelay}from"./libs/helpers/common.js";export{getStaticPaths}from"./libs/getStaticPaths.js";export{getFontFromGroupSetting,getFontsFromDataBuilder}from"./libs/helpers/gen-fonts.js";export{getFontFromGlobalStyle,getFonts}from"./libs/google-fonts.js";export{getStorefrontApi}from"./libs/get-storefront-api.js";export{ErrorBoundary}from"./components/ErrorBoundary.js";export{ErrorFallback}from"./components/ErrorFallback.js";export{Page404}from"./pages/404.js";export{Page500}from"./pages/500.js";export{GoogleAnalytic}from"./components/GoogleAnalytic.js";export{FacebookPixel}from"./components/FacebookPixel.js";export{TikTokPixel}from"./components/TikTokPixel.js";export{default as CollectionDetailPage}from"./pages/collection-detail.js";export{PreviewPage}from"./pages/preview.js";export{default as ProductDetailPage}from"./pages/product-detail.js";export{default as StaticPage}from"./pages/static.js";export{BuilderPage}from"./pages/builder.js";export{StaticPageV2}from"./pages/static-v2.js";
1
+ export{getCollectionProps}from"./libs/api/get-collection-props.js";export{getCollectionSharePageProps}from"./libs/api/get-collection-share-page-props.js";export{getHomePageProps}from"./libs/api/get-home-page-props.js";export{getHomePagePropsV2}from"./libs/api/get-home-page-props-v2.js";export{getPreviewProps}from"./libs/api/get-preview-props.js";export{getBuilderProps}from"./libs/api/get-builder-props.js";export{getProductProps}from"./libs/api/get-product-props.js";export{getStaticPagePropsV2}from"./libs/api/get-static-page-props-v2.js";export{getSharePageProps}from"./libs/api/get-share-page-props.js";export{getPostPurchasePropsPreview}from"./libs/api/get-post-purchase-props-preview.js";export{getStaticPagePropsPreview}from"./libs/api/get-static-page-props-preview.js";export{getSharePageContentProps}from"./libs/api/get-preview-content-props.js";export{createAppAPIFetcher,createFetcher,createShopifyFetcher,createTemplateFetcher}from"./libs/fetcher.js";export{getLayout}from"./libs/get-layout.js";export{genCSS}from"./libs/helpers/gen-css.js";export{useTrackingView}from"./libs/hooks/use-tracking-view.js";export{usePagePreview}from"./libs/hooks/usePagePreview.js";export{isBot}from"./libs/helpers/user-agent.js";export{normalizePageSectionResponseV2,parseBuilderTemplateV2}from"./libs/helpers/normalize.js";export{getFallbackV2}from"./libs/helpers/get-fallback.js";export{retryWithDelay}from"./libs/helpers/common.js";export{SharePageTracking}from"./components/SharePageTracking.js";export{getStaticPaths}from"./libs/getStaticPaths.js";export{getFontFromGroupSetting,getFontsFromDataBuilder}from"./libs/helpers/gen-fonts.js";export{getFontFromGlobalStyle,getFonts}from"./libs/google-fonts.js";export{getStorefrontApi}from"./libs/get-storefront-api.js";export{ErrorBoundary}from"./components/ErrorBoundary.js";export{ErrorFallback}from"./components/ErrorFallback.js";export{Page404}from"./pages/404.js";export{Page500}from"./pages/500.js";export{GoogleAnalytic}from"./components/GoogleAnalytic.js";export{FacebookPixel}from"./components/FacebookPixel.js";export{TikTokPixel}from"./components/TikTokPixel.js";export{default as CollectionDetailPage}from"./pages/collection-detail.js";export{PreviewPage}from"./pages/preview.js";export{default as ProductDetailPage}from"./pages/product-detail.js";export{default as StaticPage}from"./pages/static.js";export{BuilderPage}from"./pages/builder.js";export{StaticPageV2}from"./pages/static-v2.js";export{PreviewTemplate}from"./pages/preview-template.js";
@@ -0,0 +1 @@
1
+ import{CollectionsDocument as e}from"@gem-sdk/core";import{serializableJson as o}from"../helpers/parse-json.js";let getCollectionSharePageProps=r=>async t=>{let l={first:1,orderBy:{direction:"DESC",field:"UPDATED_AT"},where:{isSample:!1,baseID:t||void 0}},[i]=await Promise.all([r([e,l])]);if(!i||!i?.collections?.edges?.[0]?.node)throw Error("Collection not found");let s=i?.collections?.edges?.[0]?.node;return o({collection:s})};export{getCollectionSharePageProps};
@@ -0,0 +1 @@
1
+ import{StorePropertyDocument as e}from"@gem-sdk/core";import{captureException as l}from"@sentry/nextjs";import{getCustomFonts as t}from"../custom-fonts.js";import{getFontStyleFromPageTemplate as o,getFontFromGlobalStyle as r}from"../google-fonts.js";import{genCSS as s}from"../helpers/gen-css.js";import{parseBuilderTemplateV2 as n}from"../helpers/normalize.js";import{serializableJson as a,parseJson as u}from"../helpers/parse-json.js";import{createFetcher as i}from"../fetcher.js";import{getCollectionSharePageProps as p}from"./get-collection-share-page-props.js";let getSharePageContentProps=c=>async f=>{try{let{sharedPage:l,customFonts:m,publicToken:d}=await c([f]);if(!l||!d)return null;let{page:y,themeStyle:P,pageMeta:C,shopMeta:g,moneyFormat:v,moneyWithCurrencyFormat:_}=l,{sectionPosition:h}=y??{},O=n({...l,sectionPosition:h}),j=null,I=null,L=null;if(y?.type==="GP_COLLECTION"){let e=(C??[]).find(e=>"selected_preview_collection"===e.key)?.value,l=e?JSON.parse(e??{}):null;I=l?.collectionId,L=l?.collectionTitle}let T=null;if(y?.type==="GP_PRODUCT"){let e=(C??[]).find(e=>"selected_preview_product"===e.key)?.value;T=e?JSON.parse(e??{}):null}let[S,w,N,D,G]=await Promise.allSettled([o(O),r(P?.data),t(m),i(d)([e]),y?.type==="GP_COLLECTION"?p(i(d))(I??void 0):null]);j="fulfilled"===G.status?G.value?.collection:null;let k="fulfilled"===S.status?S.value:null,E="fulfilled"===w.status?w.value:null,U="fulfilled"===N.status?N.value:null,b="fulfilled"===D.status?D.value:void 0;return a({builderData:O,page:y,themeStyle:s(P?.data,!1),pageMeta:C,shopMeta:g,elementFontStyle:k,fontStyle:E,customFonts:U,publicStoreFrontData:d?{token:d,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null,pageType:y?.type,moneyFormat:v,moneyWithCurrencyFormat:_,swatches:u(b?.storeProperty?.swatchesConfig),collection:j,dynamicCollection:y?.type==="GP_COLLECTION"?{collectionId:j?.baseID,collectionTitle:L}:null,dynamicProduct:y?.type==="GP_PRODUCT"?T:null})}catch(e){return l(e),null}};export{getSharePageContentProps};
@@ -0,0 +1 @@
1
+ import{captureException as t}from"@sentry/nextjs";import{serializableJson as e}from"../helpers/parse-json.js";let getSharePageProps=r=>async a=>{try{let{sharedPage:t,publicToken:l}=await r([a]);if(!t||!l)return null;let{share:n,shopMeta:o,page:i,pageMeta:s}=t,m=n?.thumbnails?Array.isArray(n.thumbnails)?n.thumbnails.map(t=>({url:t})):"string"==typeof n.thumbnails?[{url:n.thumbnails}]:[]:[],p={defaultTitle:o?.shop?.name??"",title:n?.title,openGraph:{site_name:o?.shop?.name??"",locale:o?.localization?.country?.isoCode??"",title:n?.title??o?.shop?.name??"",images:m},nofollow:!0,noindex:!0};return e({seo:p,share:n,page:i,pageMeta:s})}catch(e){return t(e),null}};export{getSharePageProps};
@@ -1 +1 @@
1
- import{getStorefrontApi as e}from"./get-storefront-api.js";import{extractOperation as r}from"./helpers/extract-operation.js";let createFetcher=e=>{let t=e||process.env.NEXT_PUBLIC_SHOP_TOKEN;return async e=>{let[o,n,i]=e;if(!t)throw Error("shopToken is not defined");let s=process.env.NEXT_PUBLIC_API_URL;if(!s)throw Error("NEXT_PUBLIC_API_URL is not defined");let p=r(o);p&&(s=`${s}?gp-online-store-operation=${p}`);let h={"Content-Type":"application/json","X-GemX-Shop-Token":t};return fetch(s,{method:"POST",headers:h,body:JSON.stringify({query:o,variables:n,operationName:i})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createAppAPIFetcher=(e,t)=>{let o=process.env.NEXT_APP_API_URL;return async n=>{let[i,s,p]=n;if(!e)throw Error("shopToken is not defined");if(!o)throw Error("NEXT_APP_API_URL is not defined");let h=r(i);h&&(o=`${o}?gp-online-store-operation=${h}`);let c={"Content-Type":"application/json",Authorization:`Token ${e}`,"X-GemX-Shop-ID":t||""};return fetch(`${o}?gp-online-store-operation=${p}`,{method:"POST",headers:c,body:JSON.stringify({query:i,variables:s,operationName:p})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createShopifyFetcher=(r,t)=>{let o=r??process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,n=t??process.env.NEXT_PUBLIC_STOREFRONT_HANDLE;return async r=>{if(!o)throw Error("NEXT_PUBLIC_STOREFRONT_TOKEN is not defined");if(!n)throw Error("NEXT_PUBLIC_STOREFRONT_HANDLE is not defined");let t={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":o},[i,s]=r;return fetch(e(n),{method:"POST",headers:t,body:JSON.stringify({query:i,variables:s})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}};export{createAppAPIFetcher,createFetcher,createShopifyFetcher};
1
+ import{getStorefrontApi as e}from"./get-storefront-api.js";import{extractOperation as r}from"./helpers/extract-operation.js";let createFetcher=e=>{let t=e||process.env.NEXT_PUBLIC_SHOP_TOKEN;return async e=>{let[o,n,s]=e;if(!t)throw Error("shopToken is not defined");let i=process.env.NEXT_PUBLIC_API_URL;if(!i)throw Error("NEXT_PUBLIC_API_URL is not defined");let h=r(o);h&&(i=`${i}?gp-online-store-operation=${h}`);let a={"Content-Type":"application/json","X-GemX-Shop-Token":t};return fetch(i,{method:"POST",headers:a,body:JSON.stringify({query:o,variables:n,operationName:s})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createAppAPIFetcher=(e,t)=>{let o=process.env.NEXT_APP_API_URL;return async n=>{let[s,i,h]=n;if(!e)throw Error("shopToken is not defined");if(!o)throw Error("NEXT_APP_API_URL is not defined");let a=r(s);a&&(o=`${o}?gp-online-store-operation=${a}`);let c={"Content-Type":"application/json",Authorization:`Token ${e}`,"X-GemX-Shop-ID":t||""};return fetch(`${o}?gp-online-store-operation=${h}`,{method:"POST",headers:c,body:JSON.stringify({query:s,variables:i,operationName:h})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createShopifyFetcher=(r,t)=>{let o=r??process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,n=t??process.env.NEXT_PUBLIC_STOREFRONT_HANDLE;return async r=>{if(!o)throw Error("NEXT_PUBLIC_STOREFRONT_TOKEN is not defined");if(!n)throw Error("NEXT_PUBLIC_STOREFRONT_HANDLE is not defined");let t={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":o},[s,i]=r;return fetch(e(n),{method:"POST",headers:t,body:JSON.stringify({query:s,variables:i})}).then(e=>e.json()).then(e=>e.errors?Promise.reject(e.errors):e.data)}},createTemplateFetcher=e=>{let r=process.env.NEXT_PUBLIC_URL_SHARE_PAGE;return async()=>{if(!r)throw Error("NEXT_PUBLIC_URL_SHARE_PAGE is not defined");try{let t=await fetch(`${r}/share/page/${e}`,{method:"GET"});if(!t.ok)throw Error(`HTTP error! status: ${t.status}`);let o=await t.json();if(o.errors)throw Error(`API errors: ${JSON.stringify(o.errors)}`);return o.result}catch(e){throw console.error("Template fetcher error:",e),e}}};export{createAppAPIFetcher,createFetcher,createShopifyFetcher,createTemplateFetcher};
@@ -1 +1 @@
1
- let getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let n=t[o],r=n.styles,i=n.settings;getFontFromGroupSetting(e,r),getFontFromGroupSetting(e,i)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let r=e[n];if(!r)continue;for(let e of(getFontValue(t,r),o))r[e]&&getFontValue(t,r[e])}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let o=e.custom?.fontFamily;"string"==typeof o&&(o={value:e.custom?.fontFamily||"",type:"google"});let n=o?.value,r=e.custom?.fontVariants;if(r?.length||(r=[e.custom?.fontWeight]),o&&r?.length){let i=r.map(t=>"regular"===t?"400":t),l=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(l){let r=uniqueArray([l,...e?.attrs?.isAlwaysLoadBold?["700"]:[]]),a=t.find(t=>t.family==n&&t.variants.includes(l));if(!a){let e=t.find(t=>t.family==n);e?e.variants.push(l):("700"!==l&&i.includes("700")&&r.push("700"),t.push({family:n||"",variants:r,subsets:[],type:o.type}))}}}};export{getFontFromGroupSetting,getFontsFromDataBuilder};
1
+ let EXCLUDED_FONT_FAMILIES=["sans-serif"],getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let n=t[o],r=n.styles,i=n.settings;getFontFromGroupSetting(e,r),getFontFromGroupSetting(e,i)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let r=e[n];if(!r)continue;for(let e of(getFontValue(t,r),o))r[e]&&getFontValue(t,r[e])}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let o=e.custom?.fontFamily;"string"==typeof o&&(o={value:e.custom?.fontFamily||"",type:"google"});let n=o?.value;if(EXCLUDED_FONT_FAMILIES.includes(n))return;let r=e.custom?.fontVariants;if(r?.length||(r=[e.custom?.fontWeight]),o&&r?.length){let i=r.map(t=>"regular"===t?"400":t),l=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(l){let r=uniqueArray([l,...e?.attrs?.isAlwaysLoadBold?["700"]:[]]),a=t.find(t=>t.family==n&&t.variants.includes(l));if(!a){let e=t.find(t=>t.family==n);e?e.variants.push(l):("700"!==l&&i.includes("700")&&r.push("700"),t.push({family:n||"",variants:r,subsets:[],type:o.type}))}}}};export{getFontFromGroupSetting,getFontsFromDataBuilder};
@@ -1 +1 @@
1
- import{prefetchQueries as e}from"@gem-sdk/core";let getFallbackV2=async(t,a,l=!0)=>{let r=!!l&&!process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,s=a.map(t=>e(t.data,{isSample:r,isStorefront:l})).flat(),c=await Promise.allSettled(s.map(({query:e,variables:a,func:l})=>l?l(t,a):e?t([e,a]):{})),m=s.reduce((e,{key:t},a)=>{let l=c[a];return l?.status==="fulfilled"?{...e,[t]:l.value}:e},{});return m};export{getFallbackV2};
1
+ import{prefetchQueries as e}from"@gem-sdk/core";let getFallbackV2=async(t,a,l=!0,r=!1)=>{let s=!r&&!!l&&!process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,c=a.map(t=>e(t.data,{isSample:s,isStorefront:l})).flat(),m=await Promise.allSettled(c.map(({query:e,variables:a,func:l})=>l?l(t,a):e?t([e,a]):{})),o=c.reduce((e,{key:t},a)=>{let l=m[a];return l?.status==="fulfilled"?{...e,[t]:l.value}:e},{});return o};export{getFallbackV2};
@@ -0,0 +1,5 @@
1
+ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{usePreviewSharePage as l,useI18n as r,PageProvider as n,BuilderComponentProvider as s,SectionProvider as i,I18nProvider as o,BuilderProvider as d,Render as c}from"@gem-sdk/core";import p from"next/head";import{useRouter as g}from"next/router";import{parseHtml as m}from"../libs/parse-html.js";import{useEffect as u,Fragment as h}from"react";import f from"next/dynamic";let PreviewTemplate=({components:y,builderData:_,sectionData:b,themeStyle:x,fontStyle:k,elementFontStyle:v,customCodeHeader:T,customFonts:N,pageBackground:P,publicStoreFrontData:L,page:S,collection:I,dynamicCollection:q,dynamicProduct:C})=>{let{disableExternalLinks:H}=l(),M=g(),{t:j}=r(),w="custom-code-header",F=f(()=>import("@gem-sdk/core").then(e=>e.CollectionProvider)),$=S?.type==="GP_COLLECTION"?F:h;return(u(()=>{let e=document.querySelectorAll(`[class*="${w}-"]`),t=[];e.length>1&&e.forEach(e=>{let a=e.className;if(t.includes(a)){e.remove();return}t.push(a)})},[]),u(()=>{H()},[H]),M.isFallback)?e("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:t("div",{className:"gp-flex gp-gap-2",children:[e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})}):t(a,{children:[t(p,{children:[m(w,T,!0),x&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:x}},"global-style"),k&&e("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:k}},"google-fonts"),v&&v.map(t=>e("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:t}},t)),N&&e("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:N}},k),P?.isUsePageBackground&&P?.background&&e("style",{children:`
2
+ body {
3
+ background: ${P.background};
4
+ }
5
+ `},`page_background_${P?.background}`)]}),e(n,{publicStoreFrontData:L,dynamicCollection:q,dynamicProduct:C,children:e($,{collection:I,children:e(s,{components:y,children:e("div",{id:"storefront","data-page-name":S?.name,"data-assigned-product-title":C?.productTitle,"data-assigned-collection-title":q?.collectionTitle,children:e(i,{data:b,children:e(o,{t:j,children:_?.map(t=>e(a,{children:e(d,{state:t.data,lazy:t.lazy,priority:t.priority,isPreview:!0,children:e(c,{uid:t.uid})},t.uid)}))})})})})})})]})};export{PreviewTemplate};
@@ -57,6 +57,15 @@ type PageBuilderPropsV2 = {
57
57
  } & Omit<PageBuilderProps, 'builderData'>;
58
58
  type AdditionalPageBuilderProps = {
59
59
  components: Record<string, React__default.ComponentType<any>>;
60
+ collection?: any;
61
+ dynamicCollection?: {
62
+ collectionId?: string;
63
+ collectionTitle?: string;
64
+ };
65
+ dynamicProduct?: {
66
+ productId?: string;
67
+ productTitle?: string;
68
+ };
60
69
  };
61
70
  type NextPageWithLayout<P = PageBuilderProps, IP = P> = NextPage<P, IP> & {
62
71
  getLayout?: (page: React__default.ReactElement, pageProps?: any) => React__default.ReactNode;
@@ -102,22 +111,77 @@ type StaticPagePropsV2 = PageBuilderPropsV2 & {
102
111
  isPreview?: boolean;
103
112
  domain?: string;
104
113
  };
114
+ type SharePageAPIResponse = {
115
+ sharedPage: SharePageProps;
116
+ customFonts: ShopType.CustomFont[];
117
+ publicToken?: string;
118
+ };
119
+ type SharePageType = {
120
+ designerName?: string | null;
121
+ id: string;
122
+ thumbnails?: string[] | null;
123
+ title: string;
124
+ };
125
+ type SharePageProps = PageBuilderPropsV2 & {
126
+ publicStoreFrontData?: PublicStoreFrontData | null;
127
+ seo?: NextSeoProps;
128
+ builderData?: {
129
+ uid: string;
130
+ lazy?: boolean;
131
+ priority?: boolean;
132
+ data: BuilderState;
133
+ }[];
134
+ page?: {
135
+ id: string;
136
+ name?: string;
137
+ sectionPosition?: string[];
138
+ type?: string;
139
+ shopID?: string;
140
+ };
141
+ themeStyle?: any;
142
+ share?: SharePageType;
143
+ pageSections?: {
144
+ id: BigInt;
145
+ themePageID: BigInt;
146
+ shopID: BigInt;
147
+ cid: string;
148
+ name: string;
149
+ component: any;
150
+ };
151
+ pageMeta?: {
152
+ id: string;
153
+ themePageID: string;
154
+ key: string;
155
+ value: string;
156
+ }[];
157
+ shopMeta?: any;
158
+ pageType?: ShopType.PublishedThemePageType;
159
+ moneyFormat?: string | null;
160
+ moneyWithCurrencyFormat?: string | null;
161
+ trackingId?: string | null;
162
+ };
105
163
 
106
164
  declare const getCollectionProps: (fetcher: FetchFunc) => (handle?: string) => Promise<CollectionDetailPageProps>;
107
165
 
166
+ declare const getCollectionSharePageProps: (fetcher: FetchFunc) => (baseId?: string) => Promise<{
167
+ collection: any;
168
+ }>;
169
+
108
170
  declare const getHomePageProps: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => () => Promise<PageBuilderProps>;
109
171
 
110
172
  declare const getHomePagePropsV2: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => () => Promise<PageBuilderPropsV2>;
111
173
 
112
174
  declare const getPreviewProps: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (pageType: ShopType.PublishedThemePageType, slug?: string) => Promise<PageBuilderProps>;
113
175
 
114
- type Props$4 = Pick<PageBuilderProps, 'swr' | 'themeStyle' | 'seo' | 'currency' | 'locale' | 'swatches'>;
115
- declare const getBuilderProps: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => Promise<Props$4>;
176
+ type Props$5 = Pick<PageBuilderProps, 'swr' | 'themeStyle' | 'seo' | 'currency' | 'locale' | 'swatches'>;
177
+ declare const getBuilderProps: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => Promise<Props$5>;
116
178
 
117
179
  declare const getProductProps: (fetcher: FetchFunc) => (handle?: string) => Promise<ProductPageProps>;
118
180
 
119
181
  declare const getStaticPagePropsV2: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
120
182
 
183
+ declare const getSharePageProps: (fetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
184
+
121
185
  declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, librarySaleFunnelID?: string, storeFrontFetcher?: FetchFunc) => (data: {
122
186
  id: string;
123
187
  currentOfferID: string;
@@ -127,9 +191,12 @@ declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, librarySaleFunne
127
191
 
128
192
  declare const getStaticPagePropsPreview: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
129
193
 
194
+ declare const getSharePageContentProps: (fetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
195
+
130
196
  declare const createFetcher: (token?: string | null) => FetchFunc;
131
197
  declare const createAppAPIFetcher: (token?: string | null, shopID?: string) => FetchFunc;
132
198
  declare const createShopifyFetcher: (storefrontToken?: string, handle?: string) => FetchFunc;
199
+ declare const createTemplateFetcher: (handle: string) => FetchFunc;
133
200
 
134
201
  declare const getLayout: (page: React.ReactElement, pageProps?: any) => react_jsx_runtime.JSX.Element;
135
202
 
@@ -179,7 +246,7 @@ declare const parseBuilderTemplateV2: (data?: ParseBuilderTemplateV2Props) => {
179
246
 
180
247
  declare const getFallbackV2: (fetcher: FetchFunc, data: {
181
248
  data: any;
182
- }[], isStorefront?: boolean) => Promise<{}>;
249
+ }[], isStorefront?: boolean, disableIsSample?: boolean) => Promise<{}>;
183
250
 
184
251
  type RetryConfig = {
185
252
  retries?: number;
@@ -188,6 +255,15 @@ type RetryConfig = {
188
255
  };
189
256
  declare const retryWithDelay: <T = unknown>(fn: () => T, config?: RetryConfig) => Promise<T>;
190
257
 
258
+ type Props$4 = {
259
+ trackingId?: string | null;
260
+ params?: {
261
+ page_id?: string;
262
+ source_shop_id?: string;
263
+ };
264
+ };
265
+ declare const SharePageTracking: ({ trackingId, params }: Props$4) => react_jsx_runtime.JSX.Element | null;
266
+
191
267
  declare const getStaticPaths: GetStaticPaths;
192
268
 
193
269
  type FontType = 'bunny' | 'google';
@@ -268,4 +344,6 @@ declare const BuilderPage: React.FC<BuilderPageProps>;
268
344
 
269
345
  declare const StaticPageV2: React.FC<StaticPagePropsV2 & AdditionalPageBuilderProps>;
270
346
 
271
- export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PageBuilderPropsV2, PreviewPage, ProductDetailPage, StaticPage, StaticPagePropsV2, StaticPageV2, TikTokPixel, createAppAPIFetcher, createFetcher, createShopifyFetcher, genCSS, getBuilderProps, getCollectionProps, getFallbackV2, getFontFromGlobalStyle, getFontFromGroupSetting, getFonts, getFontsFromDataBuilder, getHomePageProps, getHomePagePropsV2, getLayout, getPostPurchasePropsPreview, getPreviewProps, getProductProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, usePagePreview, useTrackingView };
347
+ declare const PreviewTemplate: React.FC<SharePageProps & AdditionalPageBuilderProps>;
348
+
349
+ export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PageBuilderPropsV2, PreviewPage, PreviewTemplate, ProductDetailPage, SharePageAPIResponse, SharePageProps, SharePageTracking, StaticPage, StaticPagePropsV2, StaticPageV2, TikTokPixel, createAppAPIFetcher, createFetcher, createShopifyFetcher, createTemplateFetcher, genCSS, getBuilderProps, getCollectionProps, getCollectionSharePageProps, getFallbackV2, getFontFromGlobalStyle, getFontFromGroupSetting, getFonts, getFontsFromDataBuilder, getHomePageProps, getHomePagePropsV2, getLayout, getPostPurchasePropsPreview, getPreviewProps, getProductProps, getSharePageContentProps, getSharePageProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, usePagePreview, useTrackingView };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "4.0.18",
3
+ "version": "5.0.0",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,10 +26,10 @@
26
26
  "next": "14.2.20"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "4.0.11",
30
- "@gem-sdk/plugin-cookie-bar": "3.1.0",
31
- "@gem-sdk/plugin-quick-view": "3.1.0",
32
- "@gem-sdk/plugin-sticky-add-to-cart": "3.1.0"
29
+ "@gem-sdk/core": "5.0.0",
30
+ "@gem-sdk/plugin-cookie-bar": "5.0.0",
31
+ "@gem-sdk/plugin-quick-view": "5.0.0",
32
+ "@gem-sdk/plugin-sticky-add-to-cart": "5.0.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "next": ">=14"