@gem-sdk/pages 2.0.0-dev.852 → 2.0.0-dev.871
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Footer.js +1 -1
- package/dist/cjs/components/Header.js +1 -1
- package/dist/cjs/components/builder/Toolbar.js +1 -1
- package/dist/cjs/pages/builder.js +1 -1
- package/dist/esm/components/Footer.js +1 -1
- package/dist/esm/components/Header.js +1 -1
- package/dist/esm/components/builder/Toolbar.js +1 -1
- package/dist/esm/pages/builder.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),react=require("react");const defaultMargin={desktop:"40px",tablet:"40px",mobile:"40px"},FOOTER_OFF_COLOR="#F4F4F4",Footer=e=>{let{pageType:t}=e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),react=require("react");const defaultMargin={desktop:"40px",tablet:"40px",mobile:"40px"},FOOTER_OFF_COLOR="#F4F4F4",Footer=e=>{let{pageType:t,isOriginTemplate:s}=e,r=new URLSearchParams(window.location.search),i=r.get("storefrontHandle"),l=core.useShopStore(e=>e.layoutSettings),[o,n]=react.useState(!1);return react.useEffect(()=>{let e=parent.document.querySelector(".iframe");if(!e)return;let t=document.querySelector("#storefront");if(!t)return;let s=e.clientHeight,r=l?.showHeader?s-40-48:s-48,i=new ResizeObserver(e=>{let t=e[0]?.target.clientHeight;t&&r&&n(t<r)});return i.observe(t),()=>{i.unobserve(t)}},[l]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:"POST_PURCHASE"===t?jsxRuntime.jsx("div",{className:core.cls("gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans"),children:jsxRuntime.jsx("div",{className:"gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",style:{maxWidth:"var(--g-ct-w, 1200px)",...core.makeStyleResponsive("ml",defaultMargin),...core.makeStyleResponsive("mr",defaultMargin)},children:jsxRuntime.jsxs("p",{className:"gp-text-lg",children:["All rights reserved ",i]})})}):jsxRuntime.jsx("div",{className:core.cls("gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans",{"gp-fixed gp-bottom-0 gp-w-full":o}),children:jsxRuntime.jsxs("div",{className:"gp-flex gp-h-[40px] gp-flex-1 gp-items-center gp-justify-between",style:{maxWidth:"var(--g-ct-w)",...core.makeStyleResponsive("ml",defaultMargin),...core.makeStyleResponsive("mr",defaultMargin)},children:[jsxRuntime.jsxs("svg",{width:"192",height:"8",viewBox:"0 0 192 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H52C54.2091 0 56 1.79086 56 4C56 6.20914 54.2091 8 52 8H4C1.79086 8 0 6.20914 0 4Z",fill:l?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),jsxRuntime.jsx("path",{d:"M68 4C68 1.79086 69.7909 0 72 0H120C122.209 0 124 1.79086 124 4C124 6.20914 122.209 8 120 8H72C69.7909 8 68 6.20914 68 4Z",fill:l?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),jsxRuntime.jsx("path",{d:"M136 4C136 1.79086 137.791 0 140 0H188C190.209 0 192 1.79086 192 4C192 6.20914 190.209 8 188 8H140C137.791 8 136 6.20914 136 4Z",fill:l?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR})]}),!s&&jsxRuntime.jsx("div",{className:"gp-footer gp-invisible gp-absolute gp-left-[8px] gp-flex gp-h-[24px] gp-w-[24px] gp-cursor-pointer gp-items-center gp-justify-center gp-rounded gp-bg-[#EEEEEE] gp-p-[4px] hover:gp-bg-[#0000001a] group-hover:gp-visible",children:jsxRuntime.jsx("div",{className:"gp-flex gp-h-[24px] gp-w-[24px] gp-items-center gp-justify-center",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.99985 4.08501C5.38983 4.08501 4.08465 5.39019 4.08465 7.00021C4.08465 8.61023 5.38983 9.9154 6.99985 9.9154C8.60987 9.9154 9.91504 8.61023 9.91504 7.00021C9.91504 5.39019 8.60987 4.08501 6.99985 4.08501ZM5.08465 7.00021C5.08465 5.94247 5.94211 5.08501 6.99985 5.08501C8.05758 5.08501 8.91504 5.94247 8.91504 7.00021C8.91504 8.05794 8.05758 8.9154 6.99985 8.9154C5.94211 8.9154 5.08465 8.05794 5.08465 7.00021Z",fill:"#212121"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.52351 0.00390625C5.28138 0.00390625 5.07405 0.177388 5.03135 0.415715L4.7415 2.03321C4.40346 2.18248 4.08346 2.36419 3.78558 2.57432L2.18557 2.00147C1.95684 1.91958 1.70235 2.01395 1.58232 2.22517L0.122204 4.79451C0.00217064 5.00572 0.0513362 5.27266 0.238747 5.42725L1.50086 6.46836C1.48358 6.64355 1.47474 6.82106 1.47474 7.00047C1.47474 7.17981 1.48357 7.35726 1.50084 7.53238L0.238747 8.57347C0.0513362 8.72806 0.00217064 8.995 0.122203 9.20622L1.58232 11.7756C1.70235 11.9868 1.95684 12.0811 2.18557 11.9993L3.78537 11.4265C4.08332 11.6367 4.40341 11.8185 4.74155 11.9678L5.03135 13.585C5.07405 13.8233 5.28138 13.9968 5.52351 13.9968H8.47647C8.7186 13.9968 8.92593 13.8233 8.96863 13.585L9.25846 11.9676C9.5965 11.8183 9.91649 11.6365 10.2144 11.4264L11.8144 11.9993C12.0431 12.0811 12.2976 11.9868 12.4177 11.7756L13.8778 9.20622C13.9978 8.995 13.9486 8.72806 13.7612 8.57347L12.4988 7.5321C12.516 7.35706 12.5249 7.17971 12.5249 7.00047C12.5249 6.82116 12.516 6.64375 12.4988 6.46864L13.7612 5.42725C13.9486 5.27266 13.9978 5.00572 13.8778 4.79451L12.4177 2.22517C12.2976 2.01395 12.0431 1.91958 11.8144 2.00147L10.2141 2.57441C9.91636 2.36433 9.59645 2.18264 9.25851 2.0334L8.96863 0.415715C8.92593 0.177389 8.7186 0.00390625 8.47647 0.00390625H5.52351ZM5.67747 2.47943L5.94187 1.00391H8.0581L8.32253 2.47958C8.35348 2.6523 8.47271 2.79616 8.63668 2.85863C9.06768 3.02283 9.46674 3.25007 9.82215 3.5288C9.95734 3.63483 10.1375 3.66402 10.2993 3.6061L11.7559 3.08459L12.8007 4.92323L11.6503 5.8722C11.5145 5.98427 11.4476 6.15956 11.4743 6.33366C11.5076 6.55089 11.5249 6.77354 11.5249 7.00047C11.5249 7.22735 11.5076 7.44993 11.4743 7.66711C11.4476 7.8412 11.5145 8.01648 11.6504 8.12855L12.8007 9.07749L11.7559 10.9161L10.2994 10.3947C10.1377 10.3368 9.95752 10.366 9.82233 10.472C9.46686 10.7508 9.06773 10.9781 8.63664 11.1423C8.47267 11.2048 8.35344 11.3487 8.32249 11.5214L8.0581 12.9968H5.94187L5.67752 11.5215C5.64656 11.3488 5.52732 11.2049 5.36333 11.1425C4.93215 10.9782 4.53292 10.7509 4.17738 10.4721C4.04219 10.3661 3.86203 10.3369 3.70027 10.3948L2.24412 10.9161L1.19924 9.07749L2.34929 8.12883C2.48516 8.01675 2.55204 7.84146 2.52535 7.66736C2.49205 7.4501 2.47474 7.22743 2.47474 7.00047C2.47474 6.77345 2.49206 6.55072 2.52538 6.33341C2.55207 6.15931 2.48519 5.984 2.34932 5.87192L1.19924 4.92323L2.24412 3.08459L3.70047 3.60601C3.86221 3.66392 4.04236 3.63474 4.17755 3.52872C4.53304 3.24994 4.93219 3.02269 5.36329 2.85849C5.52728 2.79603 5.64652 2.65216 5.67747 2.47943Z",fill:"#212121"})]})})}),jsxRuntime.jsxs("svg",{width:"82",height:"8",viewBox:"0 0 82 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H18C20.2091 0 22 1.79086 22 4C22 6.20914 20.2091 8 18 8H4C1.79086 8 0 6.20914 0 4Z",fill:l?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),jsxRuntime.jsx("path",{d:"M30 4C30 1.79086 31.7909 0 34 0H48C50.2091 0 52 1.79086 52 4C52 6.20914 50.2091 8 48 8H34C31.7909 8 30 6.20914 30 4Z",fill:l?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),jsxRuntime.jsx("path",{d:"M60 4C60 1.79086 61.7909 0 64 0H78C80.2091 0 82 1.79086 82 4C82 6.20914 80.2091 8 78 8H64C61.7909 8 60 6.20914 60 4Z",fill:l?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR})]})]})})})};exports.default=Footer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core");const defaultMargin={desktop:"40px",tablet:"40px",mobile:"40px"},HEADER_OFF_COLOR="#F4F4F4",sizeCheck={desktop:"24px",tablet:"36px",mobile:"36px"},Header=e=>{let{pageType:s}=e,i=core.useShopStore(e=>e.layoutSettings);return jsxRuntime.jsx("div",{className:core.cls("gp-header-container gp-border-1 gp-group gp-relative gp-flex gp-justify-center gp-border-b gp-border-[#EEEEEE] gp-font-sans"),children:"POST_PURCHASE"===s?jsxRuntime.jsx("div",{className:"gp-flex gp-flex-1 gp-items-center gp-justify-between",style:{maxWidth:"var(--g-ct-w, 1200px)",...core.makeStyleResponsive("ml",defaultMargin),...core.makeStyleResponsive("mr",defaultMargin)},children:jsxRuntime.jsxs("div",{className:"tablet:gp-items-center gp-flex gp-py-3",children:[jsxRuntime.jsxs("svg",{style:{...core.makeStyleResponsive("w",sizeCheck),...core.makeStyleResponsive("h",sizeCheck)},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15.7244 10.6242C15.9587 10.3899 15.9587 10.01 15.7244 9.77571C15.49 9.5414 15.1101 9.5414 14.8758 9.77571L11.1001 13.5514L9.42436 11.8757C9.19005 11.6414 8.81015 11.6414 8.57583 11.8757C8.34152 12.11 8.34152 12.4899 8.57583 12.7242L10.6758 14.8242C10.9101 15.0586 11.29 15.0586 11.5244 14.8242L15.7244 10.6242Z",fill:"#197BBD"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.4001 12C20.4001 16.6392 16.6393 20.4 12.0001 20.4C7.36091 20.4 3.6001 16.6392 3.6001 12C3.6001 7.36078 7.36091 3.59998 12.0001 3.59998C16.6393 3.59998 20.4001 7.36078 20.4001 12ZM19.2001 12C19.2001 15.9764 15.9765 19.2 12.0001 19.2C8.02365 19.2 4.8001 15.9764 4.8001 12C4.8001 8.02352 8.02365 4.79998 12.0001 4.79998C15.9765 4.79998 19.2001 8.02352 19.2001 12Z",fill:"#197BBD"})]}),jsxRuntime.jsxs("div",{className:"gp-ml-4",children:[jsxRuntime.jsx("p",{className:"gp-text-sm",children:"Order #1001"}),jsxRuntime.jsx("p",{children:"You’ve paid for your order."}),jsxRuntime.jsxs("div",{className:"gp-mt-1 gp-flex gp-items-center gp-text-[#197BBD]",children:[jsxRuntime.jsx("div",{className:"gp-text-sm",children:"View order confirmation"}),jsxRuntime.jsx("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.6318 9.21817C4.45607 9.04244 4.45607 8.75751 4.6318 8.58178L6.7136 6.49998L4.6318 4.41817C4.45607 4.24244 4.45607 3.95751 4.6318 3.78178C4.80754 3.60604 5.09246 3.60604 5.2682 3.78178L7.6682 6.18178C7.84393 6.35751 7.84393 6.64244 7.6682 6.81817L5.2682 9.21817C5.09246 9.39391 4.80754 9.39391 4.6318 9.21817Z",fill:"#197BBD"})})]})]})]})}):jsxRuntime.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core");const defaultMargin={desktop:"40px",tablet:"40px",mobile:"40px"},HEADER_OFF_COLOR="#F4F4F4",sizeCheck={desktop:"24px",tablet:"36px",mobile:"36px"},Header=e=>{let{pageType:s,isOriginTemplate:t}=e,i=core.useShopStore(e=>e.layoutSettings),l=()=>{let e=new CustomEvent("editor:header:sync-platform-origin",{bubbles:!0,detail:{isSync:!0}});window.dispatchEvent(e)};return jsxRuntime.jsx("div",{className:core.cls("gp-header-container gp-border-1 gp-group gp-relative gp-flex gp-justify-center gp-border-b gp-border-[#EEEEEE] gp-font-sans"),children:"POST_PURCHASE"===s?jsxRuntime.jsx("div",{className:"gp-flex gp-flex-1 gp-items-center gp-justify-between",style:{maxWidth:"var(--g-ct-w, 1200px)",...core.makeStyleResponsive("ml",defaultMargin),...core.makeStyleResponsive("mr",defaultMargin)},children:jsxRuntime.jsxs("div",{className:"tablet:gp-items-center gp-flex gp-py-3",children:[jsxRuntime.jsxs("svg",{style:{...core.makeStyleResponsive("w",sizeCheck),...core.makeStyleResponsive("h",sizeCheck)},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15.7244 10.6242C15.9587 10.3899 15.9587 10.01 15.7244 9.77571C15.49 9.5414 15.1101 9.5414 14.8758 9.77571L11.1001 13.5514L9.42436 11.8757C9.19005 11.6414 8.81015 11.6414 8.57583 11.8757C8.34152 12.11 8.34152 12.4899 8.57583 12.7242L10.6758 14.8242C10.9101 15.0586 11.29 15.0586 11.5244 14.8242L15.7244 10.6242Z",fill:"#197BBD"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.4001 12C20.4001 16.6392 16.6393 20.4 12.0001 20.4C7.36091 20.4 3.6001 16.6392 3.6001 12C3.6001 7.36078 7.36091 3.59998 12.0001 3.59998C16.6393 3.59998 20.4001 7.36078 20.4001 12ZM19.2001 12C19.2001 15.9764 15.9765 19.2 12.0001 19.2C8.02365 19.2 4.8001 15.9764 4.8001 12C4.8001 8.02352 8.02365 4.79998 12.0001 4.79998C15.9765 4.79998 19.2001 8.02352 19.2001 12Z",fill:"#197BBD"})]}),jsxRuntime.jsxs("div",{className:"gp-ml-4",children:[jsxRuntime.jsx("p",{className:"gp-text-sm",children:"Order #1001"}),jsxRuntime.jsx("p",{children:"You’ve paid for your order."}),jsxRuntime.jsxs("div",{className:"gp-mt-1 gp-flex gp-items-center gp-text-[#197BBD]",children:[jsxRuntime.jsx("div",{className:"gp-text-sm",children:"View order confirmation"}),jsxRuntime.jsx("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.6318 9.21817C4.45607 9.04244 4.45607 8.75751 4.6318 8.58178L6.7136 6.49998L4.6318 4.41817C4.45607 4.24244 4.45607 3.95751 4.6318 3.78178C4.80754 3.60604 5.09246 3.60604 5.2682 3.78178L7.6682 6.18178C7.84393 6.35751 7.84393 6.64244 7.6682 6.81817L5.2682 9.21817C5.09246 9.39391 4.80754 9.39391 4.6318 9.21817Z",fill:"#197BBD"})})]})]})]})}):jsxRuntime.jsxs("div",{className:"gp-flex gp-h-[40px] gp-flex-1 gp-items-center gp-justify-between",style:{maxWidth:"var(--g-ct-w)",...core.makeStyleResponsive("ml",defaultMargin),...core.makeStyleResponsive("mr",defaultMargin)},children:[jsxRuntime.jsxs("svg",{width:"84",height:"8",viewBox:"0 0 84 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H18C20.2091 0 22 1.79086 22 4C22 6.20914 20.2091 8 18 8H4C1.79086 8 0 6.20914 0 4Z",fill:i?.showHeader?"#9E9E9E":HEADER_OFF_COLOR}),jsxRuntime.jsx("path",{d:"M28 4C28 1.79086 29.7909 0 32 0H80C82.2091 0 84 1.79086 84 4C84 6.20914 82.2091 8 80 8H32C29.7909 8 28 6.20914 28 4Z",fill:i?.showHeader?"#D6D6D6":HEADER_OFF_COLOR})]}),t?jsxRuntime.jsxs("div",{"aria-hidden":"true",onClick:l,className:"gp-cursor-pointer gp-flex gp-items-center gp-absolute gp-left-[50%] gp-translate-x-[-50%] gp-px-[16px] gp-py-[4px] gp-gap-[8px] gp-bg-[#F4F4F4] gp-rounded-[8px]",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M3.90968 10.1949L4.43442 8.83042C4.53354 8.57268 4.82283 8.44409 5.08057 8.54321C5.33831 8.64233 5.4669 8.93162 5.36778 9.18936L4.41649 11.663C4.31737 11.9207 4.02807 12.0493 3.77033 11.9502L1.29673 10.9989C1.039 10.8998 0.910409 10.6105 1.00953 10.3527C1.10865 10.095 1.39794 9.9664 1.65568 10.0655L2.98072 10.5751C2.01452 8.65896 2.17519 6.2744 3.59096 4.47542C5.07135 2.59435 7.49662 1.8966 9.66109 2.52294C9.92635 2.59969 10.0792 2.87696 10.0024 3.14222C9.92564 3.40747 9.64838 3.56028 9.38312 3.48353C7.59636 2.96649 5.59676 3.54369 4.37679 5.09386C3.19267 6.59849 3.07215 8.60154 3.90968 10.1949Z",fill:"#212121"}),jsxRuntime.jsx("path",{d:"M6.75057 12.5097C6.48531 12.4329 6.20804 12.5858 6.13129 12.851C6.05453 13.1163 6.20734 13.3935 6.4726 13.4703C8.63707 14.0966 11.0623 13.3989 12.5427 11.5178C13.9845 9.68582 14.1246 7.24656 13.0986 5.31313L14.4512 5.57503C14.7223 5.62752 14.9846 5.4503 15.0371 5.1792C15.0896 4.90809 14.9124 4.64576 14.6413 4.59326L12.0394 4.08945C11.7683 4.03695 11.506 4.21417 11.4535 4.48528L10.9496 7.08716C10.8972 7.35827 11.0744 7.6206 11.3455 7.6731C11.6166 7.72559 11.8789 7.54837 11.9314 7.27727L12.2195 5.78971C13.062 7.38444 12.9432 9.39202 11.7569 10.8994C10.5369 12.4495 8.53732 13.0267 6.75057 12.5097Z",fill:"#212121"})]}),jsxRuntime.jsx("span",{className:"gp-font-medium gp-text-[12px] gp-leading-[20px] gp-text-[#212121] gp-font-[Inter]",children:"Update changes from Shopify"})]}):jsxRuntime.jsx("div",{className:"gp-header gp-invisible gp-absolute gp-left-[8px] gp-flex gp-h-[24px] gp-w-[24px] gp-cursor-pointer gp-items-center gp-justify-center gp-rounded gp-bg-[#EEEEEE] gp-p-[4px] hover:gp-bg-[#0000001a] group-hover:gp-visible",children:jsxRuntime.jsx("div",{className:"gp-flex gp-h-[24px] gp-w-[24px] gp-items-center gp-justify-center",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.99985 4.08501C5.38983 4.08501 4.08465 5.39019 4.08465 7.00021C4.08465 8.61023 5.38983 9.9154 6.99985 9.9154C8.60987 9.9154 9.91504 8.61023 9.91504 7.00021C9.91504 5.39019 8.60987 4.08501 6.99985 4.08501ZM5.08465 7.00021C5.08465 5.94247 5.94211 5.08501 6.99985 5.08501C8.05758 5.08501 8.91504 5.94247 8.91504 7.00021C8.91504 8.05794 8.05758 8.9154 6.99985 8.9154C5.94211 8.9154 5.08465 8.05794 5.08465 7.00021Z",fill:"#212121"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.52351 0.00390625C5.28138 0.00390625 5.07405 0.177388 5.03135 0.415715L4.7415 2.03321C4.40346 2.18248 4.08346 2.36419 3.78558 2.57432L2.18557 2.00147C1.95684 1.91958 1.70235 2.01395 1.58232 2.22517L0.122204 4.79451C0.00217064 5.00572 0.0513362 5.27266 0.238747 5.42725L1.50086 6.46836C1.48358 6.64355 1.47474 6.82106 1.47474 7.00047C1.47474 7.17981 1.48357 7.35726 1.50084 7.53238L0.238747 8.57347C0.0513362 8.72806 0.00217064 8.995 0.122203 9.20622L1.58232 11.7756C1.70235 11.9868 1.95684 12.0811 2.18557 11.9993L3.78537 11.4265C4.08332 11.6367 4.40341 11.8185 4.74155 11.9678L5.03135 13.585C5.07405 13.8233 5.28138 13.9968 5.52351 13.9968H8.47647C8.7186 13.9968 8.92593 13.8233 8.96863 13.585L9.25846 11.9676C9.5965 11.8183 9.91649 11.6365 10.2144 11.4264L11.8144 11.9993C12.0431 12.0811 12.2976 11.9868 12.4177 11.7756L13.8778 9.20622C13.9978 8.995 13.9486 8.72806 13.7612 8.57347L12.4988 7.5321C12.516 7.35706 12.5249 7.17971 12.5249 7.00047C12.5249 6.82116 12.516 6.64375 12.4988 6.46864L13.7612 5.42725C13.9486 5.27266 13.9978 5.00572 13.8778 4.79451L12.4177 2.22517C12.2976 2.01395 12.0431 1.91958 11.8144 2.00147L10.2141 2.57441C9.91636 2.36433 9.59645 2.18264 9.25851 2.0334L8.96863 0.415715C8.92593 0.177389 8.7186 0.00390625 8.47647 0.00390625H5.52351ZM5.67747 2.47943L5.94187 1.00391H8.0581L8.32253 2.47958C8.35348 2.6523 8.47271 2.79616 8.63668 2.85863C9.06768 3.02283 9.46674 3.25007 9.82215 3.5288C9.95734 3.63483 10.1375 3.66402 10.2993 3.6061L11.7559 3.08459L12.8007 4.92323L11.6503 5.8722C11.5145 5.98427 11.4476 6.15956 11.4743 6.33366C11.5076 6.55089 11.5249 6.77354 11.5249 7.00047C11.5249 7.22735 11.5076 7.44993 11.4743 7.66711C11.4476 7.8412 11.5145 8.01648 11.6504 8.12855L12.8007 9.07749L11.7559 10.9161L10.2994 10.3947C10.1377 10.3368 9.95752 10.366 9.82233 10.472C9.46686 10.7508 9.06773 10.9781 8.63664 11.1423C8.47267 11.2048 8.35344 11.3487 8.32249 11.5214L8.0581 12.9968H5.94187L5.67752 11.5215C5.64656 11.3488 5.52732 11.2049 5.36333 11.1425C4.93215 10.9782 4.53292 10.7509 4.17738 10.4721C4.04219 10.3661 3.86203 10.3369 3.70027 10.3948L2.24412 10.9161L1.19924 9.07749L2.34929 8.12883C2.48516 8.01675 2.55204 7.84146 2.52535 7.66736C2.49205 7.4501 2.47474 7.22743 2.47474 7.00047C2.47474 6.77345 2.49206 6.55072 2.52538 6.33341C2.55207 6.15931 2.48519 5.984 2.34932 5.87192L1.19924 4.92323L2.24412 3.08459L3.70047 3.60601C3.86221 3.66392 4.04236 3.63474 4.17755 3.52872C4.53304 3.24994 4.93219 3.02269 5.36329 2.85849C5.52728 2.79603 5.64652 2.65216 5.67747 2.47943Z",fill:"#212121"})]})})}),jsxRuntime.jsxs("svg",{width:"192",height:"8",viewBox:"0 0 192 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H52C54.2091 0 56 1.79086 56 4C56 6.20914 54.2091 8 52 8H4C1.79086 8 0 6.20914 0 4Z",fill:i?.showHeader?"#D6D6D6":HEADER_OFF_COLOR}),jsxRuntime.jsx("path",{d:"M68 4C68 1.79086 69.7909 0 72 0H120C122.209 0 124 1.79086 124 4C124 6.20914 122.209 8 120 8H72C69.7909 8 68 6.20914 68 4Z",fill:i?.showHeader?"#D6D6D6":HEADER_OFF_COLOR}),jsxRuntime.jsx("path",{d:"M136 4C136 1.79086 137.791 0 140 0H188C190.209 0 192 1.79086 192 4C192 6.20914 190.209 8 188 8H140C137.791 8 136 6.20914 136 4Z",fill:i?.showHeader?"#D6D6D6":HEADER_OFF_COLOR})]})]})})};exports.default=Header;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),Onboarding=require("./toolbar/Onboarding.js");const TOOLBAR_HOVER_HEIGHT=24,TOOLBAR_ACTIVE_HEIGHT=32,getDOMElementParents=(t,e,r)=>{let o=[];for(;t;)if(t=t.parentElement??void 0){if("BODY"===t.tagName||"ROOT"===t.getAttribute("data-uid"))break;if(e){if(t.matches(e)&&(o.push(t),r&&o.length==r))return o;continue}if(o.push(t),r&&o.length==r)break}return o},getChildrenByAttrSelector=(t,e)=>{let r=t.children.length;if(r)for(let o=0;o<r;o++){let r=t.children[o];if(r){let t=r.getAttribute(e);if(t)return r}}},isOverParent=({current:t,parent:e,index:r,revert:o})=>{for(let a=0;a<r;a++){let r=t.top-23*a>=e.top&&t.top-23*a<=e.top+e.height||t.top-23*a>=e.top+e.height&&t.top-23*a<=e.top;if(o&&(r=t.bottom+23*a>=e.bottom&&t.bottom+23*a<=e.bottom-e.height||t.bottom+23*a>=e.bottom-e.height&&t.bottom+23*a<=e.bottom),r)return!0}return!1},waitForElementToExist=(t,e=200)=>new Promise(r=>{let o=setInterval(()=>{let e=document.querySelector(t);e&&(clearInterval(o),clearTimeout(a),r(e))},50),a=setTimeout(()=>{clearInterval(o),clearTimeout(a),r(null)},e)}),notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},isLayoutElement=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},isPopup=t=>{let e=t.getAttribute("data-component-tag");return"Dialog"===e},isSticky=t=>{let e=t.getAttribute("data-component-tag");return"Sticky"===e},isOverToolbarPosition=(t,e)=>{let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();return r.top-o.top<33},findOverflowParent=(t,e)=>{let r=e||t;if(t&&!isSection(t))return notVisible(t)&&isOverToolbarPosition(e,t)?t:t.parentElement?findOverflowParent(t.parentElement,r):void 0},COMPONENTS_TAG_NOT_LOAD_IMAGES=["PostPurchaseProductImages"],Toolbar=()=>{let t=react.useRef(null),e=react.useRef(!1),r=react.useRef(),o=react.useRef(!1),a=react.useRef(!1),[i,n]=react.useState(!1),[l,d]=react.useState(0),[u,c]=react.useState("bottom"),s=react.useRef(null),b=({state:t,$toolbar:e,$component:r})=>{let o=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<33&&(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")}},m=react.useCallback(({$component:t,componentUid:e,focus:r,isThemeSection:o,isParent:a})=>{if(!t&&!e)return;if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}let i=getChildrenByAttrSelector(t,"data-toolbar"),n=getChildrenByAttrSelector(t,"data-outline"),l=getChildrenByAttrSelector(t,"data-toolbar-add-top"),d=getChildrenByAttrSelector(t,"data-toolbar-add-bottom"),u=getChildrenByAttrSelector(t,"data-column"),c=getChildrenByAttrSelector(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"),b({$toolbar:i,$component:t,state:"hover"})),n&&(n.setAttribute("data-outline-hover","true"),a&&n.setAttribute("data-outline-parent-hover","true"),o&&n.setAttribute("data-outline-overlay-theme-section","true"),r&&n.setAttribute("data-outline-hover-focus","true")),l&&!a&&l.setAttribute("data-toolbar-add-hover","true"),d&&!a&&d.setAttribute("data-toolbar-add-hover","true"),u&&u.setAttribute("data-column-visible","true")},[]),v=react.useCallback(({$component:t,componentUid:e})=>{if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=getDOMElementParents(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&m({$component:t,isParent:!0});f({$component:t,$parents:r})}},[m]),f=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=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(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({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-23*i;l&&(d=parseFloat(e.top)-o+23*i);let u=parseFloat(e.left)+a;n.setAttribute("style",`top: ${d}px;left: ${u}px;`),i++}}}}},g=react.useCallback(()=>{let t=["data-outline-overlay","data-outline-overlay-theme-section","data-theme-section-status-active"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})},[]),p=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-column-visible","data-outline-parent-hover","data-toolbar-hover-overflow"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))}),g()},[g]),h=react.useCallback(()=>{if(s.current&&clearTimeout(s.current),l>0){let t=new CustomEvent("editor:toolbar:close-onboarding",{bubbles:!0,detail:{close:"close Onboarding"}});window.dispatchEvent(t),n(!1)}},[l]),A=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-column-force-visible","data-toolbar-active-overflow"],o=document.querySelectorAll(e.map(t=>`[${t}]`).join(","));o&&e.forEach(t=>{o.forEach(e=>e.removeAttribute(t))}),$(!1),r.current&&r.current(),h()},[h]),w=(e,o)=>{let a=e=>{let r=e.detail;r?.componentUid==t.current?.componentUid&&o()};window.removeEventListener("editor:component:render",a),window.addEventListener("editor:component:render",a);let i=e.getAttribute("data-component-tag");if(i&&!COMPONENTS_TAG_NOT_LOAD_IMAGES.includes(i)){let t=e.querySelectorAll("img");t?.length&&t.forEach(t=>{t.addEventListener("load",()=>{o()})})}r.current=()=>{window.removeEventListener("editor:component:render",a)}},y=react.useCallback(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=getChildrenByAttrSelector(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let r=o.querySelector("[data-spacing-margin-bottom-bg]")||null,a=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(r&&a){let i=e.marginBottom;if(0>parseFloat(i)&&(i="0"),r.style.height=i,a.style.top=i,o.setAttribute("data-spacing-margin-bottom-active","true"),isLayoutElement(t))r.style.left="0";else{let t=e.paddingLeft,o=`-${t}`,i=`translate(${o}, -100%)`;r.style.left=o,a.style.transform=i}}}},[]),E=()=>{let t=document.querySelector("[data-toolbar-active]"),e=document.querySelector("[data-toolbar-onboarding]");t&&e&&(e?.removeAttribute("data-onboarding-active"),setTimeout(()=>{let r=t.getBoundingClientRect(),o=r.top||0,a=e?.getBoundingClientRect(),i=a?.height||0,n=parent.document.querySelector(".iframe"),l=n?.contentWindow,u=l?.scrollY||0,s=n?.clientHeight||0;if(o+i>s){let t=r.top+u-i-8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),c("top"),l&&t<r.top+u&&setTimeout(()=>{let e=t-20;l.scrollTo({top:e,behavior:"smooth"})},200)}else{let t=r.top+u+r.height+8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),c("bottom")}d(t=>t+1),e?.setAttribute("data-onboarding-active","true")},100))},S=react.useCallback(({$component:t})=>{if(!t||isSection(t)||isPopup(t)||isSticky(t))return;let e=document.querySelector("[data-toolbar-onboarding]");0==l?E():(h(),e?.removeAttribute("data-onboarding-active"))},[l,h]),C=react.useCallback(async({componentUid:e,productId:r,timeAwait:o=500,forceReActive:a})=>{if(!e)return;let i=`${r?`[data-product-id="${r}"][data-uid="${e}"], [data-product-id="${r}"] [data-uid="${e}"]`:`[data-uid="${e}"]`}`,n=await waitForElementToExist(i,o);if(!n||!a&&e==t.current?.componentUid&&r==t.current?.productId)return;(a||e===t.current?.componentUid)&&r===t.current?.productId||A();let l=getChildrenByAttrSelector(n,"data-toolbar"),d=getChildrenByAttrSelector(n,"data-outline"),u=getChildrenByAttrSelector(n,"data-toolbar-add-top"),c=getChildrenByAttrSelector(n,"data-toolbar-add-bottom"),m=getChildrenByAttrSelector(n,"data-column");if(l&&(t.current={componentUid:e,productId:r},l.removeAttribute("style"),l.setAttribute("data-toolbar-active","true"),b({$toolbar:l,$component:n,state:"active"})),d&&d.setAttribute("data-outline-active","true"),u&&u.setAttribute("data-toolbar-add-active","true"),c&&c.setAttribute("data-toolbar-add-active","true"),m&&m.setAttribute("data-column-force-visible","true"),r){let t=document.querySelectorAll(`[data-uid="${e}"]`);t?.length&&t.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}y({$component:n}),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{S({$component:n})},5e3),p(),w(n,()=>{C({componentUid:e,productId:r,timeAwait:2e3,forceReActive:!0})})},[A,p,y,S]),$=async e=>{if(e){if(t.current?.componentUid){let r=t.current?.componentUid,o=t.current?.productId,a=await waitForElementToExist(`${o?`[data-product-id="${o}"] `:""}[data-uid="${r}"]`,500);if(a){let t=getChildrenByAttrSelector(a,"data-toolbar"),r=getChildrenByAttrSelector(a,"data-outline"),o=getChildrenByAttrSelector(a,"data-spacing");t&&e&&t.setAttribute("data-toolbar-editor-inline-focus","true"),r&&e&&r.setAttribute("data-outline-editor-inline-focus","true"),o&&e&&o.setAttribute("data-spacing-hidden","true")}}}else{let t=document.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"))})}},B=react.useCallback(e=>{let r=e.closest("[data-theme-section]"),o=r?.getAttribute("data-uid"),a=r&&o===t.current?.componentUid;if(!a)return;let i=getChildrenByAttrSelector(r,"data-theme-section-status");i&&i.setAttribute("data-theme-section-status-active","true")},[]),L=async({value:e})=>{if(!e)return;let r=await waitForElementToExist(`${t.current?.productId?`[data-product-id="${t.current?.productId}"] `:""}[data-uid="${t.current?.componentUid}"]`,500);if(r){let e=r?.querySelectorAll("[data-toolbar-parent]");if(e.length){let r=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},o=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},a=async e=>{let r=e.getAttribute("data-parent-uid");if(!r)return;let a=async()=>{let t=await waitForElementToExist(`[data-uid="${r}"]`,500),e=t?.closest("[data-product-id]"),o=e?.getAttribute("data-product-id")||"";return!!o},i="";await a()&&(i=t.current?.productId||"");let n=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:r,productId:i}});o(e),window.dispatchEvent(n)};e.forEach(t=>{t.addEventListener("mouseover",()=>r(t)),t.addEventListener("mouseout",()=>o(t)),t.addEventListener("click",()=>a(t))})}}},T=react.useCallback(r=>{if(e.current||o.current||a.current)return;let i=r.target;if(!i||"function"!=typeof i.closest){g();return}let n=i.closest("[data-toolbar-hover]");if(n)return;let l=i.closest("[data-toolbar-wrap]"),d=l?.getAttribute("data-uid");if(!l||!d||"ROOT"==d){p();return}let u=getChildrenByAttrSelector(l,"data-toolbar"),c=getChildrenByAttrSelector(l,"data-outline");if(c&&c.removeAttribute("data-outline-overlay"),!d||"ROOT"==d||u?.getAttribute("data-toolbar-hover-focus"))return;if(u?.getAttribute("data-toolbar-hover-focus")||p(),B(i),d==t.current?.componentUid){if(t.current.productId){let e=l.closest("[data-product-id]");if(e){let r=e.getAttribute("data-product-id");if(r==t.current.productId)return}}let e=i.closest("[data-theme-section]");if(!e)return;m({$component:e,focus:!0,isThemeSection:!0})}let s=i.closest("[data-theme-section]");s?m({$component:s,focus:!0,isThemeSection:!0}):(m({$component:l,componentUid:d,focus:!0}),v({$component:l,componentUid:d}))},[B,p,m,v,g,t]),O=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid?C({componentUid:r.componentUid,productId:r.productId}):A()},[C,A,e]),k=react.useCallback(()=>{p()},[p]),R=react.useCallback(t=>{let r=t.detail;r.value&&(p(),A()),e.current=r.value},[p,A]),q=react.useCallback(t=>{let e=t.detail;e.value?$(!0):$(!1)},[]),I=react.useCallback(t=>{if(e.current)return;let r=t.detail;L({value:r?.value||!1})},[]),P=react.useCallback(t=>{let e=t.detail;e?.value?(p(),o.current=!0):o.current=!1},[p]),x=react.useCallback(t=>{let e=t.detail;e?.value?(p(),a.current=!0):a.current=!1},[p]),U=(t,e)=>{if(!t)return;let r=document.querySelectorAll(`[data-uid="${t}"]`);r.length&&r.forEach(t=>{let r=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")))})},_=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid&&U(r?.componentUid,r?.type)},[e]),j=react.useCallback(t=>{let e=t.detail;e?.isNewUser&&n(!0)},[]),F=react.useCallback(()=>{i&&E()},[i]);return react.useEffect(()=>(document.addEventListener("mousemove",T),window.addEventListener("editor:active-component",O),window.addEventListener("editor:focus-outside-preview",k),window.addEventListener("editor:is-dragging",R),window.addEventListener("editor:is-editing-text-editor",q),window.addEventListener("editor:toolbar:show-parents",I),window.addEventListener("editor:toolbar:resize-spacing",P),window.addEventListener("editor:toolbar:resize-column",x),window.addEventListener("editor:hover-component",_),window.addEventListener("editor:toolbar-onboarding",j),window.addEventListener("resize",F),()=>{document.removeEventListener("mousemove",T),window.removeEventListener("editor:active-component",O),window.removeEventListener("editor:is-dragging",k),window.removeEventListener("editor:is-dragging",R),window.removeEventListener("editor:is-editing-text-editor",q),window.removeEventListener("editor:toolbar:show-parents",I),window.removeEventListener("editor:toolbar:resize-spacing",P),window.removeEventListener("editor:toolbar:resize-column",x),window.removeEventListener("editor:hover-component",_),window.removeEventListener("editor:toolbar-onboarding",j),window.removeEventListener("resize",F)}),[T,O,k,R,q,I,P,x,_,j,F]),i&&jsxRuntime.jsx(Onboarding.default,{enable:!0,position:u,onCloseOnboarding:h})};var Toolbar$1=react.memo(Toolbar);exports.default=Toolbar$1;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),Onboarding=require("./toolbar/Onboarding.js");const TOOLBAR_HOVER_HEIGHT=24,TOOLBAR_ACTIVE_HEIGHT=32,getDOMElementParents=(t,e,r)=>{let o=[];for(;t;)if(t=t.parentElement??void 0){if("BODY"===t.tagName||"ROOT"===t.getAttribute("data-uid"))break;if(e){if(t.matches(e)&&(o.push(t),r&&o.length==r))return o;continue}if(o.push(t),r&&o.length==r)break}return o},getChildrenByAttrSelector=(t,e)=>{let r=t.children.length;if(r)for(let o=0;o<r;o++){let r=t.children[o];if(r){let t=r.getAttribute(e);if(t)return r}}},isOverParent=({current:t,parent:e,index:r,revert:o})=>{for(let a=0;a<r;a++){let r=t.top-23*a>=e.top&&t.top-23*a<=e.top+e.height||t.top-23*a>=e.top+e.height&&t.top-23*a<=e.top;if(o&&(r=t.bottom+23*a>=e.bottom&&t.bottom+23*a<=e.bottom-e.height||t.bottom+23*a>=e.bottom-e.height&&t.bottom+23*a<=e.bottom),r)return!0}return!1},waitForElementToExist=(t,e=200)=>new Promise(r=>{let o=setInterval(()=>{let e=document.querySelector(t);e&&(clearInterval(o),clearTimeout(a),r(e))},50),a=setTimeout(()=>{clearInterval(o),clearTimeout(a),r(null)},e)}),notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},isLayoutElement=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},isPopup=t=>{let e=t.getAttribute("data-component-tag");return"Dialog"===e},isSticky=t=>{let e=t.getAttribute("data-component-tag");return"Sticky"===e},isOverToolbarPosition=(t,e)=>{let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();return r.top-o.top<33},findOverflowParent=(t,e)=>{let r=e||t;if(t&&!isSection(t))return notVisible(t)&&isOverToolbarPosition(e,t)?t:t.parentElement?findOverflowParent(t.parentElement,r):void 0},COMPONENTS_TAG_NOT_LOAD_IMAGES=["PostPurchaseProductImages"],Toolbar=()=>{let t=react.useRef(null),e=react.useRef(!1),r=react.useRef(),o=react.useRef(!1),a=react.useRef(!1),[i,n]=react.useState(!1),[l,d]=react.useState(0),[u,c]=react.useState("bottom"),s=react.useRef(null),b=({state:t,$toolbar:e,$component:r})=>{let o=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<33&&(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")}},v=react.useCallback(({$component:t,componentUid:e,focus:r,isPreventSection:o,isParent:a})=>{if(!t&&!e)return;if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}let i=getChildrenByAttrSelector(t,"data-toolbar"),n=getChildrenByAttrSelector(t,"data-outline"),l=getChildrenByAttrSelector(t,"data-toolbar-add-top"),d=getChildrenByAttrSelector(t,"data-toolbar-add-bottom"),u=getChildrenByAttrSelector(t,"data-column"),c=getChildrenByAttrSelector(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"),b({$toolbar:i,$component:t,state:"hover"})),n&&(n.setAttribute("data-outline-hover","true"),a&&n.setAttribute("data-outline-parent-hover","true"),o&&n.setAttribute("data-outline-overlay-theme-section","true"),r&&n.setAttribute("data-outline-hover-focus","true")),l&&!a&&l.setAttribute("data-toolbar-add-hover","true"),d&&!a&&d.setAttribute("data-toolbar-add-hover","true"),u&&u.setAttribute("data-column-visible","true")},[]),m=react.useCallback(({$component:t,componentUid:e})=>{if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=getDOMElementParents(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&v({$component:t,isParent:!0});f({$component:t,$parents:r})}},[v]),f=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=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(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({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-23*i;l&&(d=parseFloat(e.top)-o+23*i);let u=parseFloat(e.left)+a;n.setAttribute("style",`top: ${d}px;left: ${u}px;`),i++}}}}},g=react.useCallback(()=>{let t=["data-outline-overlay","data-outline-overlay-theme-section","data-theme-section-status-active"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})},[]),p=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-column-visible","data-outline-parent-hover","data-toolbar-hover-overflow"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))}),g()},[g]),h=react.useCallback(()=>{if(s.current&&clearTimeout(s.current),l>0){let t=new CustomEvent("editor:toolbar:close-onboarding",{bubbles:!0,detail:{close:"close Onboarding"}});window.dispatchEvent(t),n(!1)}},[l]),A=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-column-force-visible","data-toolbar-active-overflow"],o=document.querySelectorAll(e.map(t=>`[${t}]`).join(","));o&&e.forEach(t=>{o.forEach(e=>e.removeAttribute(t))}),$(!1),r.current&&r.current(),h()},[h]),w=(e,o)=>{let a=e=>{let r=e.detail;r?.componentUid==t.current?.componentUid&&o()};window.removeEventListener("editor:component:render",a),window.addEventListener("editor:component:render",a);let i=e.getAttribute("data-component-tag");if(i&&!COMPONENTS_TAG_NOT_LOAD_IMAGES.includes(i)){let t=e.querySelectorAll("img");t?.length&&t.forEach(t=>{t.addEventListener("load",()=>{o()})})}r.current=()=>{window.removeEventListener("editor:component:render",a)}},y=react.useCallback(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=getChildrenByAttrSelector(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let r=o.querySelector("[data-spacing-margin-bottom-bg]")||null,a=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(r&&a){let i=e.marginBottom;if(0>parseFloat(i)&&(i="0"),r.style.height=i,a.style.top=i,o.setAttribute("data-spacing-margin-bottom-active","true"),isLayoutElement(t))r.style.left="0";else{let t=e.paddingLeft,o=`-${t}`,i=`translate(${o}, -100%)`;r.style.left=o,a.style.transform=i}}}},[]),E=()=>{let t=document.querySelector("[data-toolbar-active]"),e=document.querySelector("[data-toolbar-onboarding]");t&&e&&(e?.removeAttribute("data-onboarding-active"),setTimeout(()=>{let r=t.getBoundingClientRect(),o=r.top||0,a=e?.getBoundingClientRect(),i=a?.height||0,n=parent.document.querySelector(".iframe"),l=n?.contentWindow,u=l?.scrollY||0,s=n?.clientHeight||0;if(o+i>s){let t=r.top+u-i-8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),c("top"),l&&t<r.top+u&&setTimeout(()=>{let e=t-20;l.scrollTo({top:e,behavior:"smooth"})},200)}else{let t=r.top+u+r.height+8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),c("bottom")}d(t=>t+1),e?.setAttribute("data-onboarding-active","true")},100))},S=react.useCallback(({$component:t})=>{if(!t||isSection(t)||isPopup(t)||isSticky(t))return;let e=document.querySelector("[data-toolbar-onboarding]");0==l?E():(h(),e?.removeAttribute("data-onboarding-active"))},[l,h]),C=react.useCallback(async({componentUid:e,productId:r,timeAwait:o=500,forceReActive:a})=>{if(!e)return;let i=`${r?`[data-product-id="${r}"][data-uid="${e}"], [data-product-id="${r}"] [data-uid="${e}"]`:`[data-uid="${e}"]`}`,n=await waitForElementToExist(i,o);if(!n||!a&&e==t.current?.componentUid&&r==t.current?.productId)return;(a||e===t.current?.componentUid)&&r===t.current?.productId||A();let l=getChildrenByAttrSelector(n,"data-toolbar"),d=getChildrenByAttrSelector(n,"data-outline"),u=getChildrenByAttrSelector(n,"data-toolbar-add-top"),c=getChildrenByAttrSelector(n,"data-toolbar-add-bottom"),v=getChildrenByAttrSelector(n,"data-column");if(l&&(t.current={componentUid:e,productId:r},l.removeAttribute("style"),l.setAttribute("data-toolbar-active","true"),b({$toolbar:l,$component:n,state:"active"})),d&&d.setAttribute("data-outline-active","true"),u&&u.setAttribute("data-toolbar-add-active","true"),c&&c.setAttribute("data-toolbar-add-active","true"),v&&v.setAttribute("data-column-force-visible","true"),r){let t=document.querySelectorAll(`[data-uid="${e}"]`);t?.length&&t.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}y({$component:n}),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{S({$component:n})},5e3),p(),w(n,()=>{C({componentUid:e,productId:r,timeAwait:2e3,forceReActive:!0})})},[A,p,y,S]),$=async e=>{if(e){if(t.current?.componentUid){let r=t.current?.componentUid,o=t.current?.productId,a=await waitForElementToExist(`${o?`[data-product-id="${o}"] `:""}[data-uid="${r}"]`,500);if(a){let t=getChildrenByAttrSelector(a,"data-toolbar"),r=getChildrenByAttrSelector(a,"data-outline"),o=getChildrenByAttrSelector(a,"data-spacing");t&&e&&t.setAttribute("data-toolbar-editor-inline-focus","true"),r&&e&&r.setAttribute("data-outline-editor-inline-focus","true"),o&&e&&o.setAttribute("data-spacing-hidden","true")}}}else{let t=document.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"))})}},B=react.useCallback(e=>{let r=e.closest("[data-theme-section]"),o=r?.getAttribute("data-uid"),a=r&&o===t.current?.componentUid;if(!a)return;let i=getChildrenByAttrSelector(r,"data-theme-section-status");i&&i.setAttribute("data-theme-section-status-active","true")},[]),L=async({value:e})=>{if(!e)return;let r=await waitForElementToExist(`${t.current?.productId?`[data-product-id="${t.current?.productId}"] `:""}[data-uid="${t.current?.componentUid}"]`,500);if(r){let e=r?.querySelectorAll("[data-toolbar-parent]");if(e.length){let r=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},o=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},a=async e=>{let r=e.getAttribute("data-parent-uid");if(!r)return;let a=async()=>{let t=await waitForElementToExist(`[data-uid="${r}"]`,500),e=t?.closest("[data-product-id]"),o=e?.getAttribute("data-product-id")||"";return!!o},i="";await a()&&(i=t.current?.productId||"");let n=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:r,productId:i}});o(e),window.dispatchEvent(n)};e.forEach(t=>{t.addEventListener("mouseover",()=>r(t)),t.addEventListener("mouseout",()=>o(t)),t.addEventListener("click",()=>a(t))})}}},O=react.useCallback(r=>{if(e.current||o.current||a.current)return;let i=r.target;if(!i||"function"!=typeof i.closest){g();return}let n=i.closest("[data-toolbar-hover]");if(n)return;let l=i.closest("[data-toolbar-wrap]"),d=l?.getAttribute("data-uid");if(!l||!d||"ROOT"==d){p();return}let u=getChildrenByAttrSelector(l,"data-toolbar"),c=getChildrenByAttrSelector(l,"data-outline");if(c&&c.removeAttribute("data-outline-overlay"),!d||"ROOT"==d||u?.getAttribute("data-toolbar-hover-focus"))return;if(u?.getAttribute("data-toolbar-hover-focus")||p(),B(i),d==t.current?.componentUid){if(t.current.productId){let e=l.closest("[data-product-id]");if(e){let r=e.getAttribute("data-product-id");if(r==t.current.productId)return}}let e=i.closest("[data-theme-section]")||i.closest("[data-shopify-section]");if(!e)return;v({$component:e,focus:!0,isPreventSection:!0})}let s=i.closest("[data-theme-section]")||i.closest("[data-shopify-section]");s?v({$component:s,focus:!0,isPreventSection:!0}):(v({$component:l,componentUid:d,focus:!0}),m({$component:l,componentUid:d}))},[B,p,v,m,g,t]),T=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid?C({componentUid:r.componentUid,productId:r.productId}):A()},[C,A,e]),k=react.useCallback(()=>{p()},[p]),R=react.useCallback(t=>{let r=t.detail;r.value&&(p(),A()),e.current=r.value},[p,A]),q=react.useCallback(t=>{let e=t.detail;e.value?$(!0):$(!1)},[]),P=react.useCallback(t=>{if(e.current)return;let r=t.detail;L({value:r?.value||!1})},[]),I=react.useCallback(t=>{let e=t.detail;e?.value?(p(),o.current=!0):o.current=!1},[p]),x=react.useCallback(t=>{let e=t.detail;e?.value?(p(),a.current=!0):a.current=!1},[p]),U=(t,e)=>{if(!t)return;let r=document.querySelectorAll(`[data-uid="${t}"]`);r.length&&r.forEach(t=>{let r=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")))})},_=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid&&U(r?.componentUid,r?.type)},[e]),j=react.useCallback(t=>{let e=t.detail;e?.isNewUser&&n(!0)},[]),F=react.useCallback(()=>{i&&E()},[i]);return react.useEffect(()=>(document.addEventListener("mousemove",O),window.addEventListener("editor:active-component",T),window.addEventListener("editor:focus-outside-preview",k),window.addEventListener("editor:is-dragging",R),window.addEventListener("editor:is-editing-text-editor",q),window.addEventListener("editor:toolbar:show-parents",P),window.addEventListener("editor:toolbar:resize-spacing",I),window.addEventListener("editor:toolbar:resize-column",x),window.addEventListener("editor:hover-component",_),window.addEventListener("editor:toolbar-onboarding",j),window.addEventListener("resize",F),()=>{document.removeEventListener("mousemove",O),window.removeEventListener("editor:active-component",T),window.removeEventListener("editor:is-dragging",k),window.removeEventListener("editor:is-dragging",R),window.removeEventListener("editor:is-editing-text-editor",q),window.removeEventListener("editor:toolbar:show-parents",P),window.removeEventListener("editor:toolbar:resize-spacing",I),window.removeEventListener("editor:toolbar:resize-column",x),window.removeEventListener("editor:hover-component",_),window.removeEventListener("editor:toolbar-onboarding",j),window.removeEventListener("resize",F)}),[O,T,k,R,q,P,I,x,_,j,F]),i&&jsxRuntime.jsx(Onboarding.default,{enable:!0,position:u,onCloseOnboarding:h})};var Toolbar$1=react.memo(Toolbar);exports.default=Toolbar$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),nextSeo=require("next-seo"),Head=require("next/head"),react=require("react"),Toolbox=require("../components/builder/Toolbox.js"),Header=require("../components/Header.js"),Footer=require("../components/Footer.js"),CollectionGlobalProvider=require("./CollectionGlobalProvider.js"),PopupManager=require("../components/builder/PopupManager.js"),ImageToLayout=require("../components/image-to-layout/ImageToLayout.js"),AddSectionImageToLayout=require("../components/image-to-layout/AddSectionImageToLayout.js"),Toolbar=require("../components/builder/Toolbar.js");const BuilderPage=({components:e,seo:t,themeStyle:o,fontStyle:r,sectionData:
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),nextSeo=require("next-seo"),Head=require("next/head"),react=require("react"),Toolbox=require("../components/builder/Toolbox.js"),Header=require("../components/Header.js"),Footer=require("../components/Footer.js"),CollectionGlobalProvider=require("./CollectionGlobalProvider.js"),PopupManager=require("../components/builder/PopupManager.js"),ImageToLayout=require("../components/image-to-layout/ImageToLayout.js"),AddSectionImageToLayout=require("../components/image-to-layout/AddSectionImageToLayout.js"),Toolbar=require("../components/builder/Toolbar.js");const BuilderPage=({components:e,seo:t,themeStyle:o,fontStyle:r,sectionData:i,pageType:s,editorImageToLayout:n,isThemeSectionEditor:a,hiddenToolbar:u,isOriginTemplate:d})=>{let[l,x]=react.useState(!1),j=react.useMemo(()=>({ROOT:{uid:"ROOT",tag:"Root",label:"Root",childrens:[]}}),[]);return react.useEffect(()=>{x(!0)},[]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nextSeo.NextSeo,{...t}),jsxRuntime.jsxs(Head,{children:[o&&jsxRuntime.jsx("style",{type:"text/css",id:"global-style",dangerouslySetInnerHTML:{__html:o}}),r&&jsxRuntime.jsx("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:r}})]}),jsxRuntime.jsx(core.PageProvider,{children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsx(core.SectionProvider,{data:i,children:jsxRuntime.jsxs(core.BuilderPreviewProvider,{state:j,isThemeSectionEditor:a,children:[jsxRuntime.jsx(Toolbox.default,{}),!u&&jsxRuntime.jsx(Toolbar.default,{}),jsxRuntime.jsx(PopupManager.default,{}),l&&jsxRuntime.jsxs("div",{className:"builder gp-z-1 gp-relative",children:[!u&&(a?jsxRuntime.jsx("div",{className:"gp-h-[40px] gp-bg-[#f4f4f4]"}):jsxRuntime.jsx(Header.default,{pageType:s,isOriginTemplate:d})),jsxRuntime.jsx("div",{id:"storefront",className:`${a?"theme-section-editor":""} ${"POST_PURCHASE"===s?"post-purchase-page":""}`,children:"GP_COLLECTION"===s?jsxRuntime.jsx(CollectionGlobalProvider.default,{children:jsxRuntime.jsx(core.RenderPreview,{uid:"ROOT"})}):jsxRuntime.jsx(core.RenderPreview,{uid:"ROOT"})}),jsxRuntime.jsx(ImageToLayout.default,{editorImageToLayout:n||!1}),jsxRuntime.jsx(AddSectionImageToLayout.default,{editorImageToLayout:n||!1}),jsxRuntime.jsx("div",{id:"visual-content"}),!a&&!u&&jsxRuntime.jsx(Footer.default,{pageType:s,isOriginTemplate:d})]})]},"preview")})})})]})};exports.BuilderPage=BuilderPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useShopStore as l,cls as p,makeStyleResponsive as o}from"@gem-sdk/core";import{useState as g,useEffect as i}from"react";let defaultMargin={desktop:"40px",tablet:"40px",mobile:"40px"},FOOTER_OFF_COLOR="#F4F4F4",Footer=C=>{let{pageType:n}=C,
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useShopStore as l,cls as p,makeStyleResponsive as o}from"@gem-sdk/core";import{useState as g,useEffect as i}from"react";let defaultMargin={desktop:"40px",tablet:"40px",mobile:"40px"},FOOTER_OFF_COLOR="#F4F4F4",Footer=C=>{let{pageType:n,isOriginTemplate:s}=C,d=new URLSearchParams(window.location.search),a=d.get("storefrontHandle"),h=l(e=>e.layoutSettings),[f,c]=g(!1);return i(()=>{let e=parent.document.querySelector(".iframe");if(!e)return;let t=document.querySelector("#storefront");if(!t)return;let r=e.clientHeight,l=h?.showHeader?r-40-48:r-48,p=new ResizeObserver(e=>{let t=e[0]?.target.clientHeight;t&&l&&c(t<l)});return p.observe(t),()=>{p.unobserve(t)}},[h]),e(t,{children:"POST_PURCHASE"===n?e("div",{className:p("gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans"),children:e("div",{className:"gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",style:{maxWidth:"var(--g-ct-w, 1200px)",...o("ml",defaultMargin),...o("mr",defaultMargin)},children:r("p",{className:"gp-text-lg",children:["All rights reserved ",a]})})}):e("div",{className:p("gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans",{"gp-fixed gp-bottom-0 gp-w-full":f}),children:r("div",{className:"gp-flex gp-h-[40px] gp-flex-1 gp-items-center gp-justify-between",style:{maxWidth:"var(--g-ct-w)",...o("ml",defaultMargin),...o("mr",defaultMargin)},children:[r("svg",{width:"192",height:"8",viewBox:"0 0 192 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H52C54.2091 0 56 1.79086 56 4C56 6.20914 54.2091 8 52 8H4C1.79086 8 0 6.20914 0 4Z",fill:h?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),e("path",{d:"M68 4C68 1.79086 69.7909 0 72 0H120C122.209 0 124 1.79086 124 4C124 6.20914 122.209 8 120 8H72C69.7909 8 68 6.20914 68 4Z",fill:h?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),e("path",{d:"M136 4C136 1.79086 137.791 0 140 0H188C190.209 0 192 1.79086 192 4C192 6.20914 190.209 8 188 8H140C137.791 8 136 6.20914 136 4Z",fill:h?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR})]}),!s&&e("div",{className:"gp-footer gp-invisible gp-absolute gp-left-[8px] gp-flex gp-h-[24px] gp-w-[24px] gp-cursor-pointer gp-items-center gp-justify-center gp-rounded gp-bg-[#EEEEEE] gp-p-[4px] hover:gp-bg-[#0000001a] group-hover:gp-visible",children:e("div",{className:"gp-flex gp-h-[24px] gp-w-[24px] gp-items-center gp-justify-center",children:r("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.99985 4.08501C5.38983 4.08501 4.08465 5.39019 4.08465 7.00021C4.08465 8.61023 5.38983 9.9154 6.99985 9.9154C8.60987 9.9154 9.91504 8.61023 9.91504 7.00021C9.91504 5.39019 8.60987 4.08501 6.99985 4.08501ZM5.08465 7.00021C5.08465 5.94247 5.94211 5.08501 6.99985 5.08501C8.05758 5.08501 8.91504 5.94247 8.91504 7.00021C8.91504 8.05794 8.05758 8.9154 6.99985 8.9154C5.94211 8.9154 5.08465 8.05794 5.08465 7.00021Z",fill:"#212121"}),e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.52351 0.00390625C5.28138 0.00390625 5.07405 0.177388 5.03135 0.415715L4.7415 2.03321C4.40346 2.18248 4.08346 2.36419 3.78558 2.57432L2.18557 2.00147C1.95684 1.91958 1.70235 2.01395 1.58232 2.22517L0.122204 4.79451C0.00217064 5.00572 0.0513362 5.27266 0.238747 5.42725L1.50086 6.46836C1.48358 6.64355 1.47474 6.82106 1.47474 7.00047C1.47474 7.17981 1.48357 7.35726 1.50084 7.53238L0.238747 8.57347C0.0513362 8.72806 0.00217064 8.995 0.122203 9.20622L1.58232 11.7756C1.70235 11.9868 1.95684 12.0811 2.18557 11.9993L3.78537 11.4265C4.08332 11.6367 4.40341 11.8185 4.74155 11.9678L5.03135 13.585C5.07405 13.8233 5.28138 13.9968 5.52351 13.9968H8.47647C8.7186 13.9968 8.92593 13.8233 8.96863 13.585L9.25846 11.9676C9.5965 11.8183 9.91649 11.6365 10.2144 11.4264L11.8144 11.9993C12.0431 12.0811 12.2976 11.9868 12.4177 11.7756L13.8778 9.20622C13.9978 8.995 13.9486 8.72806 13.7612 8.57347L12.4988 7.5321C12.516 7.35706 12.5249 7.17971 12.5249 7.00047C12.5249 6.82116 12.516 6.64375 12.4988 6.46864L13.7612 5.42725C13.9486 5.27266 13.9978 5.00572 13.8778 4.79451L12.4177 2.22517C12.2976 2.01395 12.0431 1.91958 11.8144 2.00147L10.2141 2.57441C9.91636 2.36433 9.59645 2.18264 9.25851 2.0334L8.96863 0.415715C8.92593 0.177389 8.7186 0.00390625 8.47647 0.00390625H5.52351ZM5.67747 2.47943L5.94187 1.00391H8.0581L8.32253 2.47958C8.35348 2.6523 8.47271 2.79616 8.63668 2.85863C9.06768 3.02283 9.46674 3.25007 9.82215 3.5288C9.95734 3.63483 10.1375 3.66402 10.2993 3.6061L11.7559 3.08459L12.8007 4.92323L11.6503 5.8722C11.5145 5.98427 11.4476 6.15956 11.4743 6.33366C11.5076 6.55089 11.5249 6.77354 11.5249 7.00047C11.5249 7.22735 11.5076 7.44993 11.4743 7.66711C11.4476 7.8412 11.5145 8.01648 11.6504 8.12855L12.8007 9.07749L11.7559 10.9161L10.2994 10.3947C10.1377 10.3368 9.95752 10.366 9.82233 10.472C9.46686 10.7508 9.06773 10.9781 8.63664 11.1423C8.47267 11.2048 8.35344 11.3487 8.32249 11.5214L8.0581 12.9968H5.94187L5.67752 11.5215C5.64656 11.3488 5.52732 11.2049 5.36333 11.1425C4.93215 10.9782 4.53292 10.7509 4.17738 10.4721C4.04219 10.3661 3.86203 10.3369 3.70027 10.3948L2.24412 10.9161L1.19924 9.07749L2.34929 8.12883C2.48516 8.01675 2.55204 7.84146 2.52535 7.66736C2.49205 7.4501 2.47474 7.22743 2.47474 7.00047C2.47474 6.77345 2.49206 6.55072 2.52538 6.33341C2.55207 6.15931 2.48519 5.984 2.34932 5.87192L1.19924 4.92323L2.24412 3.08459L3.70047 3.60601C3.86221 3.66392 4.04236 3.63474 4.17755 3.52872C4.53304 3.24994 4.93219 3.02269 5.36329 2.85849C5.52728 2.79603 5.64652 2.65216 5.67747 2.47943Z",fill:"#212121"})]})})}),r("svg",{width:"82",height:"8",viewBox:"0 0 82 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H18C20.2091 0 22 1.79086 22 4C22 6.20914 20.2091 8 18 8H4C1.79086 8 0 6.20914 0 4Z",fill:h?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),e("path",{d:"M30 4C30 1.79086 31.7909 0 34 0H48C50.2091 0 52 1.79086 52 4C52 6.20914 50.2091 8 48 8H34C31.7909 8 30 6.20914 30 4Z",fill:h?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR}),e("path",{d:"M60 4C60 1.79086 61.7909 0 64 0H78C80.2091 0 82 1.79086 82 4C82 6.20914 80.2091 8 78 8H64C61.7909 8 60 6.20914 60 4Z",fill:h?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR})]})]})})})};export{Footer as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useShopStore as p,cls as t,makeStyleResponsive as i}from"@gem-sdk/core";let defaultMargin={desktop:"40px",tablet:"40px",mobile:"40px"},HEADER_OFF_COLOR="#F4F4F4",sizeCheck={desktop:"24px",tablet:"36px",mobile:"36px"},Header=C=>{let{pageType:g,isOriginTemplate:d}=C,r=p(e=>e.layoutSettings),n=()=>{let e=new CustomEvent("editor:header:sync-platform-origin",{bubbles:!0,detail:{isSync:!0}});window.dispatchEvent(e)};return e("div",{className:t("gp-header-container gp-border-1 gp-group gp-relative gp-flex gp-justify-center gp-border-b gp-border-[#EEEEEE] gp-font-sans"),children:"POST_PURCHASE"===g?e("div",{className:"gp-flex gp-flex-1 gp-items-center gp-justify-between",style:{maxWidth:"var(--g-ct-w, 1200px)",...i("ml",defaultMargin),...i("mr",defaultMargin)},children:l("div",{className:"tablet:gp-items-center gp-flex gp-py-3",children:[l("svg",{style:{...i("w",sizeCheck),...i("h",sizeCheck)},viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M15.7244 10.6242C15.9587 10.3899 15.9587 10.01 15.7244 9.77571C15.49 9.5414 15.1101 9.5414 14.8758 9.77571L11.1001 13.5514L9.42436 11.8757C9.19005 11.6414 8.81015 11.6414 8.57583 11.8757C8.34152 12.11 8.34152 12.4899 8.57583 12.7242L10.6758 14.8242C10.9101 15.0586 11.29 15.0586 11.5244 14.8242L15.7244 10.6242Z",fill:"#197BBD"}),e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.4001 12C20.4001 16.6392 16.6393 20.4 12.0001 20.4C7.36091 20.4 3.6001 16.6392 3.6001 12C3.6001 7.36078 7.36091 3.59998 12.0001 3.59998C16.6393 3.59998 20.4001 7.36078 20.4001 12ZM19.2001 12C19.2001 15.9764 15.9765 19.2 12.0001 19.2C8.02365 19.2 4.8001 15.9764 4.8001 12C4.8001 8.02352 8.02365 4.79998 12.0001 4.79998C15.9765 4.79998 19.2001 8.02352 19.2001 12Z",fill:"#197BBD"})]}),l("div",{className:"gp-ml-4",children:[e("p",{className:"gp-text-sm",children:"Order #1001"}),e("p",{children:"You’ve paid for your order."}),l("div",{className:"gp-mt-1 gp-flex gp-items-center gp-text-[#197BBD]",children:[e("div",{className:"gp-text-sm",children:"View order confirmation"}),e("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.6318 9.21817C4.45607 9.04244 4.45607 8.75751 4.6318 8.58178L6.7136 6.49998L4.6318 4.41817C4.45607 4.24244 4.45607 3.95751 4.6318 3.78178C4.80754 3.60604 5.09246 3.60604 5.2682 3.78178L7.6682 6.18178C7.84393 6.35751 7.84393 6.64244 7.6682 6.81817L5.2682 9.21817C5.09246 9.39391 4.80754 9.39391 4.6318 9.21817Z",fill:"#197BBD"})})]})]})]})}):l("div",{className:"gp-flex gp-h-[40px] gp-flex-1 gp-items-center gp-justify-between",style:{maxWidth:"var(--g-ct-w)",...i("ml",defaultMargin),...i("mr",defaultMargin)},children:[l("svg",{width:"84",height:"8",viewBox:"0 0 84 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H18C20.2091 0 22 1.79086 22 4C22 6.20914 20.2091 8 18 8H4C1.79086 8 0 6.20914 0 4Z",fill:r?.showHeader?"#9E9E9E":HEADER_OFF_COLOR}),e("path",{d:"M28 4C28 1.79086 29.7909 0 32 0H80C82.2091 0 84 1.79086 84 4C84 6.20914 82.2091 8 80 8H32C29.7909 8 28 6.20914 28 4Z",fill:r?.showHeader?"#D6D6D6":HEADER_OFF_COLOR})]}),d?l("div",{"aria-hidden":"true",onClick:n,className:"gp-cursor-pointer gp-flex gp-items-center gp-absolute gp-left-[50%] gp-translate-x-[-50%] gp-px-[16px] gp-py-[4px] gp-gap-[8px] gp-bg-[#F4F4F4] gp-rounded-[8px]",children:[l("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M3.90968 10.1949L4.43442 8.83042C4.53354 8.57268 4.82283 8.44409 5.08057 8.54321C5.33831 8.64233 5.4669 8.93162 5.36778 9.18936L4.41649 11.663C4.31737 11.9207 4.02807 12.0493 3.77033 11.9502L1.29673 10.9989C1.039 10.8998 0.910409 10.6105 1.00953 10.3527C1.10865 10.095 1.39794 9.9664 1.65568 10.0655L2.98072 10.5751C2.01452 8.65896 2.17519 6.2744 3.59096 4.47542C5.07135 2.59435 7.49662 1.8966 9.66109 2.52294C9.92635 2.59969 10.0792 2.87696 10.0024 3.14222C9.92564 3.40747 9.64838 3.56028 9.38312 3.48353C7.59636 2.96649 5.59676 3.54369 4.37679 5.09386C3.19267 6.59849 3.07215 8.60154 3.90968 10.1949Z",fill:"#212121"}),e("path",{d:"M6.75057 12.5097C6.48531 12.4329 6.20804 12.5858 6.13129 12.851C6.05453 13.1163 6.20734 13.3935 6.4726 13.4703C8.63707 14.0966 11.0623 13.3989 12.5427 11.5178C13.9845 9.68582 14.1246 7.24656 13.0986 5.31313L14.4512 5.57503C14.7223 5.62752 14.9846 5.4503 15.0371 5.1792C15.0896 4.90809 14.9124 4.64576 14.6413 4.59326L12.0394 4.08945C11.7683 4.03695 11.506 4.21417 11.4535 4.48528L10.9496 7.08716C10.8972 7.35827 11.0744 7.6206 11.3455 7.6731C11.6166 7.72559 11.8789 7.54837 11.9314 7.27727L12.2195 5.78971C13.062 7.38444 12.9432 9.39202 11.7569 10.8994C10.5369 12.4495 8.53732 13.0267 6.75057 12.5097Z",fill:"#212121"})]}),e("span",{className:"gp-font-medium gp-text-[12px] gp-leading-[20px] gp-text-[#212121] gp-font-[Inter]",children:"Update changes from Shopify"})]}):e("div",{className:"gp-header gp-invisible gp-absolute gp-left-[8px] gp-flex gp-h-[24px] gp-w-[24px] gp-cursor-pointer gp-items-center gp-justify-center gp-rounded gp-bg-[#EEEEEE] gp-p-[4px] hover:gp-bg-[#0000001a] group-hover:gp-visible",children:e("div",{className:"gp-flex gp-h-[24px] gp-w-[24px] gp-items-center gp-justify-center",children:l("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.99985 4.08501C5.38983 4.08501 4.08465 5.39019 4.08465 7.00021C4.08465 8.61023 5.38983 9.9154 6.99985 9.9154C8.60987 9.9154 9.91504 8.61023 9.91504 7.00021C9.91504 5.39019 8.60987 4.08501 6.99985 4.08501ZM5.08465 7.00021C5.08465 5.94247 5.94211 5.08501 6.99985 5.08501C8.05758 5.08501 8.91504 5.94247 8.91504 7.00021C8.91504 8.05794 8.05758 8.9154 6.99985 8.9154C5.94211 8.9154 5.08465 8.05794 5.08465 7.00021Z",fill:"#212121"}),e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.52351 0.00390625C5.28138 0.00390625 5.07405 0.177388 5.03135 0.415715L4.7415 2.03321C4.40346 2.18248 4.08346 2.36419 3.78558 2.57432L2.18557 2.00147C1.95684 1.91958 1.70235 2.01395 1.58232 2.22517L0.122204 4.79451C0.00217064 5.00572 0.0513362 5.27266 0.238747 5.42725L1.50086 6.46836C1.48358 6.64355 1.47474 6.82106 1.47474 7.00047C1.47474 7.17981 1.48357 7.35726 1.50084 7.53238L0.238747 8.57347C0.0513362 8.72806 0.00217064 8.995 0.122203 9.20622L1.58232 11.7756C1.70235 11.9868 1.95684 12.0811 2.18557 11.9993L3.78537 11.4265C4.08332 11.6367 4.40341 11.8185 4.74155 11.9678L5.03135 13.585C5.07405 13.8233 5.28138 13.9968 5.52351 13.9968H8.47647C8.7186 13.9968 8.92593 13.8233 8.96863 13.585L9.25846 11.9676C9.5965 11.8183 9.91649 11.6365 10.2144 11.4264L11.8144 11.9993C12.0431 12.0811 12.2976 11.9868 12.4177 11.7756L13.8778 9.20622C13.9978 8.995 13.9486 8.72806 13.7612 8.57347L12.4988 7.5321C12.516 7.35706 12.5249 7.17971 12.5249 7.00047C12.5249 6.82116 12.516 6.64375 12.4988 6.46864L13.7612 5.42725C13.9486 5.27266 13.9978 5.00572 13.8778 4.79451L12.4177 2.22517C12.2976 2.01395 12.0431 1.91958 11.8144 2.00147L10.2141 2.57441C9.91636 2.36433 9.59645 2.18264 9.25851 2.0334L8.96863 0.415715C8.92593 0.177389 8.7186 0.00390625 8.47647 0.00390625H5.52351ZM5.67747 2.47943L5.94187 1.00391H8.0581L8.32253 2.47958C8.35348 2.6523 8.47271 2.79616 8.63668 2.85863C9.06768 3.02283 9.46674 3.25007 9.82215 3.5288C9.95734 3.63483 10.1375 3.66402 10.2993 3.6061L11.7559 3.08459L12.8007 4.92323L11.6503 5.8722C11.5145 5.98427 11.4476 6.15956 11.4743 6.33366C11.5076 6.55089 11.5249 6.77354 11.5249 7.00047C11.5249 7.22735 11.5076 7.44993 11.4743 7.66711C11.4476 7.8412 11.5145 8.01648 11.6504 8.12855L12.8007 9.07749L11.7559 10.9161L10.2994 10.3947C10.1377 10.3368 9.95752 10.366 9.82233 10.472C9.46686 10.7508 9.06773 10.9781 8.63664 11.1423C8.47267 11.2048 8.35344 11.3487 8.32249 11.5214L8.0581 12.9968H5.94187L5.67752 11.5215C5.64656 11.3488 5.52732 11.2049 5.36333 11.1425C4.93215 10.9782 4.53292 10.7509 4.17738 10.4721C4.04219 10.3661 3.86203 10.3369 3.70027 10.3948L2.24412 10.9161L1.19924 9.07749L2.34929 8.12883C2.48516 8.01675 2.55204 7.84146 2.52535 7.66736C2.49205 7.4501 2.47474 7.22743 2.47474 7.00047C2.47474 6.77345 2.49206 6.55072 2.52538 6.33341C2.55207 6.15931 2.48519 5.984 2.34932 5.87192L1.19924 4.92323L2.24412 3.08459L3.70047 3.60601C3.86221 3.66392 4.04236 3.63474 4.17755 3.52872C4.53304 3.24994 4.93219 3.02269 5.36329 2.85849C5.52728 2.79603 5.64652 2.65216 5.67747 2.47943Z",fill:"#212121"})]})})}),l("svg",{width:"192",height:"8",viewBox:"0 0 192 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M0 4C0 1.79086 1.79086 0 4 0H52C54.2091 0 56 1.79086 56 4C56 6.20914 54.2091 8 52 8H4C1.79086 8 0 6.20914 0 4Z",fill:r?.showHeader?"#D6D6D6":HEADER_OFF_COLOR}),e("path",{d:"M68 4C68 1.79086 69.7909 0 72 0H120C122.209 0 124 1.79086 124 4C124 6.20914 122.209 8 120 8H72C69.7909 8 68 6.20914 68 4Z",fill:r?.showHeader?"#D6D6D6":HEADER_OFF_COLOR}),e("path",{d:"M136 4C136 1.79086 137.791 0 140 0H188C190.209 0 192 1.79086 192 4C192 6.20914 190.209 8 188 8H140C137.791 8 136 6.20914 136 4Z",fill:r?.showHeader?"#D6D6D6":HEADER_OFF_COLOR})]})]})})};export{Header as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{memo as e,useRef as r,useState as o,useCallback as a,useEffect as i}from"react";import n from"./toolbar/Onboarding.js";let TOOLBAR_HOVER_HEIGHT=24,TOOLBAR_ACTIVE_HEIGHT=32,getDOMElementParents=(t,e,r)=>{let o=[];for(;t;)if(t=t.parentElement??void 0){if("BODY"===t.tagName||"ROOT"===t.getAttribute("data-uid"))break;if(e){if(t.matches(e)&&(o.push(t),r&&o.length==r))return o;continue}if(o.push(t),r&&o.length==r)break}return o},getChildrenByAttrSelector=(t,e)=>{let r=t.children.length;if(r)for(let o=0;o<r;o++){let r=t.children[o];if(r){let t=r.getAttribute(e);if(t)return r}}},isOverParent=({current:t,parent:e,index:r,revert:o})=>{for(let a=0;a<r;a++){let r=t.top-23*a>=e.top&&t.top-23*a<=e.top+e.height||t.top-23*a>=e.top+e.height&&t.top-23*a<=e.top;if(o&&(r=t.bottom+23*a>=e.bottom&&t.bottom+23*a<=e.bottom-e.height||t.bottom+23*a>=e.bottom-e.height&&t.bottom+23*a<=e.bottom),r)return!0}return!1},waitForElementToExist=(t,e=200)=>new Promise(r=>{let o=setInterval(()=>{let e=document.querySelector(t);e&&(clearInterval(o),clearTimeout(a),r(e))},50),a=setTimeout(()=>{clearInterval(o),clearTimeout(a),r(null)},e)}),notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},isLayoutElement=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},isPopup=t=>{let e=t.getAttribute("data-component-tag");return"Dialog"===e},isSticky=t=>{let e=t.getAttribute("data-component-tag");return"Sticky"===e},isOverToolbarPosition=(t,e)=>{let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();return r.top-o.top<33},findOverflowParent=(t,e)=>{let r=e||t;if(t&&!isSection(t))return notVisible(t)&&isOverToolbarPosition(e,t)?t:t.parentElement?findOverflowParent(t.parentElement,r):void 0},COMPONENTS_TAG_NOT_LOAD_IMAGES=["PostPurchaseProductImages"],Toolbar=()=>{let e=r(null),l=r(!1),d=r(),u=r(!1),c=r(!1),[s,b]=o(!1),[m,v]=o(0),[g,f]=o("bottom"),p=r(null),h=({state:t,$toolbar:e,$component:r})=>{let o=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<33&&(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")}},A=a(({$component:t,componentUid:e,focus:r,isThemeSection:o,isParent:a})=>{if(!t&&!e)return;if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}let i=getChildrenByAttrSelector(t,"data-toolbar"),n=getChildrenByAttrSelector(t,"data-outline"),l=getChildrenByAttrSelector(t,"data-toolbar-add-top"),d=getChildrenByAttrSelector(t,"data-toolbar-add-bottom"),u=getChildrenByAttrSelector(t,"data-column"),c=getChildrenByAttrSelector(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"),h({$toolbar:i,$component:t,state:"hover"})),n&&(n.setAttribute("data-outline-hover","true"),a&&n.setAttribute("data-outline-parent-hover","true"),o&&n.setAttribute("data-outline-overlay-theme-section","true"),r&&n.setAttribute("data-outline-hover-focus","true")),l&&!a&&l.setAttribute("data-toolbar-add-hover","true"),d&&!a&&d.setAttribute("data-toolbar-add-hover","true"),u&&u.setAttribute("data-column-visible","true")},[]),w=a(({$component:t,componentUid:e})=>{if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=getDOMElementParents(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&A({$component:t,isParent:!0});y({$component:t,$parents:r})}},[A]),y=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=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(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({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-23*i;l&&(d=parseFloat(e.top)-o+23*i);let u=parseFloat(e.left)+a;n.setAttribute("style",`top: ${d}px;left: ${u}px;`),i++}}}}},E=a(()=>{let t=["data-outline-overlay","data-outline-overlay-theme-section","data-theme-section-status-active"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})},[]),S=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-column-visible","data-outline-parent-hover","data-toolbar-hover-overflow"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))}),E()},[E]),C=a(()=>{if(p.current&&clearTimeout(p.current),m>0){let t=new CustomEvent("editor:toolbar:close-onboarding",{bubbles:!0,detail:{close:"close Onboarding"}});window.dispatchEvent(t),b(!1)}},[m]),$=a(()=>{e.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-column-force-visible","data-toolbar-active-overflow"],r=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));r&&t.forEach(t=>{r.forEach(e=>e.removeAttribute(t))}),I(!1),d.current&&d.current(),C()},[C]),B=(t,r)=>{let o=t=>{let o=t.detail;o?.componentUid==e.current?.componentUid&&r()};window.removeEventListener("editor:component:render",o),window.addEventListener("editor:component:render",o);let a=t.getAttribute("data-component-tag");if(a&&!COMPONENTS_TAG_NOT_LOAD_IMAGES.includes(a)){let e=t.querySelectorAll("img");e?.length&&e.forEach(t=>{t.addEventListener("load",()=>{r()})})}d.current=()=>{window.removeEventListener("editor:component:render",o)}},L=a(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=getChildrenByAttrSelector(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let r=o.querySelector("[data-spacing-margin-bottom-bg]")||null,a=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(r&&a){let i=e.marginBottom;if(0>parseFloat(i)&&(i="0"),r.style.height=i,a.style.top=i,o.setAttribute("data-spacing-margin-bottom-active","true"),isLayoutElement(t))r.style.left="0";else{let t=e.paddingLeft,o=`-${t}`,i=`translate(${o}, -100%)`;r.style.left=o,a.style.transform=i}}}},[]),T=()=>{let t=document.querySelector("[data-toolbar-active]"),e=document.querySelector("[data-toolbar-onboarding]");t&&e&&(e?.removeAttribute("data-onboarding-active"),setTimeout(()=>{let r=t.getBoundingClientRect(),o=r.top||0,a=e?.getBoundingClientRect(),i=a?.height||0,n=parent.document.querySelector(".iframe"),l=n?.contentWindow,d=l?.scrollY||0,u=n?.clientHeight||0;if(o+i>u){let t=r.top+d-i-8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),f("top"),l&&t<r.top+d&&setTimeout(()=>{let e=t-20;l.scrollTo({top:e,behavior:"smooth"})},200)}else{let t=r.top+d+r.height+8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),f("bottom")}v(t=>t+1),e?.setAttribute("data-onboarding-active","true")},100))},O=a(({$component:t})=>{if(!t||isSection(t)||isPopup(t)||isSticky(t))return;let e=document.querySelector("[data-toolbar-onboarding]");0==m?T():(C(),e?.removeAttribute("data-onboarding-active"))},[m,C]),q=a(async({componentUid:t,productId:r,timeAwait:o=500,forceReActive:a})=>{if(!t)return;let i=`${r?`[data-product-id="${r}"][data-uid="${t}"], [data-product-id="${r}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`,n=await waitForElementToExist(i,o);if(!n||!a&&t==e.current?.componentUid&&r==e.current?.productId)return;(a||t===e.current?.componentUid)&&r===e.current?.productId||$();let l=getChildrenByAttrSelector(n,"data-toolbar"),d=getChildrenByAttrSelector(n,"data-outline"),u=getChildrenByAttrSelector(n,"data-toolbar-add-top"),c=getChildrenByAttrSelector(n,"data-toolbar-add-bottom"),s=getChildrenByAttrSelector(n,"data-column");if(l&&(e.current={componentUid:t,productId:r},l.removeAttribute("style"),l.setAttribute("data-toolbar-active","true"),h({$toolbar:l,$component:n,state:"active"})),d&&d.setAttribute("data-outline-active","true"),u&&u.setAttribute("data-toolbar-add-active","true"),c&&c.setAttribute("data-toolbar-add-active","true"),s&&s.setAttribute("data-column-force-visible","true"),r){let e=document.querySelectorAll(`[data-uid="${t}"]`);e?.length&&e.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}L({$component:n}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{O({$component:n})},5e3),S(),B(n,()=>{q({componentUid:t,productId:r,timeAwait:2e3,forceReActive:!0})})},[$,S,L,O]),I=async t=>{if(t){if(e.current?.componentUid){let r=e.current?.componentUid,o=e.current?.productId,a=await waitForElementToExist(`${o?`[data-product-id="${o}"] `:""}[data-uid="${r}"]`,500);if(a){let e=getChildrenByAttrSelector(a,"data-toolbar"),r=getChildrenByAttrSelector(a,"data-outline"),o=getChildrenByAttrSelector(a,"data-spacing");e&&t&&e.setAttribute("data-toolbar-editor-inline-focus","true"),r&&t&&r.setAttribute("data-outline-editor-inline-focus","true"),o&&t&&o.setAttribute("data-spacing-hidden","true")}}}else{let t=document.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"))})}},P=a(t=>{let r=t.closest("[data-theme-section]"),o=r?.getAttribute("data-uid"),a=r&&o===e.current?.componentUid;if(!a)return;let i=getChildrenByAttrSelector(r,"data-theme-section-status");i&&i.setAttribute("data-theme-section-status-active","true")},[]),R=async({value:t})=>{if(!t)return;let r=await waitForElementToExist(`${e.current?.productId?`[data-product-id="${e.current?.productId}"] `:""}[data-uid="${e.current?.componentUid}"]`,500);if(r){let t=r?.querySelectorAll("[data-toolbar-parent]");if(t.length){let r=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},o=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},a=async t=>{let r=t.getAttribute("data-parent-uid");if(!r)return;let a=async()=>{let t=await waitForElementToExist(`[data-uid="${r}"]`,500),e=t?.closest("[data-product-id]"),o=e?.getAttribute("data-product-id")||"";return!!o},i="";await a()&&(i=e.current?.productId||"");let n=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:r,productId:i}});o(t),window.dispatchEvent(n)};t.forEach(t=>{t.addEventListener("mouseover",()=>r(t)),t.addEventListener("mouseout",()=>o(t)),t.addEventListener("click",()=>a(t))})}}},U=a(t=>{if(l.current||u.current||c.current)return;let r=t.target;if(!r||"function"!=typeof r.closest){E();return}let o=r.closest("[data-toolbar-hover]");if(o)return;let a=r.closest("[data-toolbar-wrap]"),i=a?.getAttribute("data-uid");if(!a||!i||"ROOT"==i){S();return}let n=getChildrenByAttrSelector(a,"data-toolbar"),d=getChildrenByAttrSelector(a,"data-outline");if(d&&d.removeAttribute("data-outline-overlay"),!i||"ROOT"==i||n?.getAttribute("data-toolbar-hover-focus"))return;if(n?.getAttribute("data-toolbar-hover-focus")||S(),P(r),i==e.current?.componentUid){if(e.current.productId){let t=a.closest("[data-product-id]");if(t){let r=t.getAttribute("data-product-id");if(r==e.current.productId)return}}let t=r.closest("[data-theme-section]");if(!t)return;A({$component:t,focus:!0,isThemeSection:!0})}let s=r.closest("[data-theme-section]");s?A({$component:s,focus:!0,isThemeSection:!0}):(A({$component:a,componentUid:i,focus:!0}),w({$component:a,componentUid:i}))},[P,S,A,w,E,e]),x=a(t=>{if(l.current)return;let e=t.detail;e?.componentUid?q({componentUid:e.componentUid,productId:e.productId}):$()},[q,$,l]),_=a(()=>{S()},[S]),F=a(t=>{let e=t.detail;e.value&&(S(),$()),l.current=e.value},[S,$]),N=a(t=>{let e=t.detail;e.value?I(!0):I(!1)},[]),D=a(t=>{if(l.current)return;let e=t.detail;R({value:e?.value||!1})},[]),k=a(t=>{let e=t.detail;e?.value?(S(),u.current=!0):u.current=!1},[S]),z=a(t=>{let e=t.detail;e?.value?(S(),c.current=!0):c.current=!1},[S]),G=(t,e)=>{if(!t)return;let r=document.querySelectorAll(`[data-uid="${t}"]`);r.length&&r.forEach(t=>{let r=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")))})},H=a(t=>{if(l.current)return;let e=t.detail;e?.componentUid&&G(e?.componentUid,e?.type)},[l]),M=a(t=>{let e=t.detail;e?.isNewUser&&b(!0)},[]),j=a(()=>{s&&T()},[s]);return i(()=>(document.addEventListener("mousemove",U),window.addEventListener("editor:active-component",x),window.addEventListener("editor:focus-outside-preview",_),window.addEventListener("editor:is-dragging",F),window.addEventListener("editor:is-editing-text-editor",N),window.addEventListener("editor:toolbar:show-parents",D),window.addEventListener("editor:toolbar:resize-spacing",k),window.addEventListener("editor:toolbar:resize-column",z),window.addEventListener("editor:hover-component",H),window.addEventListener("editor:toolbar-onboarding",M),window.addEventListener("resize",j),()=>{document.removeEventListener("mousemove",U),window.removeEventListener("editor:active-component",x),window.removeEventListener("editor:is-dragging",_),window.removeEventListener("editor:is-dragging",F),window.removeEventListener("editor:is-editing-text-editor",N),window.removeEventListener("editor:toolbar:show-parents",D),window.removeEventListener("editor:toolbar:resize-spacing",k),window.removeEventListener("editor:toolbar:resize-column",z),window.removeEventListener("editor:hover-component",H),window.removeEventListener("editor:toolbar-onboarding",M),window.removeEventListener("resize",j)}),[U,x,_,F,N,D,k,z,H,M,j]),s&&t(n,{enable:!0,position:g,onCloseOnboarding:C})};var Toolbar$1=e(Toolbar);export{Toolbar$1 as default};
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{memo as e,useRef as r,useState as o,useCallback as a,useEffect as i}from"react";import n from"./toolbar/Onboarding.js";let TOOLBAR_HOVER_HEIGHT=24,TOOLBAR_ACTIVE_HEIGHT=32,getDOMElementParents=(t,e,r)=>{let o=[];for(;t;)if(t=t.parentElement??void 0){if("BODY"===t.tagName||"ROOT"===t.getAttribute("data-uid"))break;if(e){if(t.matches(e)&&(o.push(t),r&&o.length==r))return o;continue}if(o.push(t),r&&o.length==r)break}return o},getChildrenByAttrSelector=(t,e)=>{let r=t.children.length;if(r)for(let o=0;o<r;o++){let r=t.children[o];if(r){let t=r.getAttribute(e);if(t)return r}}},isOverParent=({current:t,parent:e,index:r,revert:o})=>{for(let a=0;a<r;a++){let r=t.top-23*a>=e.top&&t.top-23*a<=e.top+e.height||t.top-23*a>=e.top+e.height&&t.top-23*a<=e.top;if(o&&(r=t.bottom+23*a>=e.bottom&&t.bottom+23*a<=e.bottom-e.height||t.bottom+23*a>=e.bottom-e.height&&t.bottom+23*a<=e.bottom),r)return!0}return!1},waitForElementToExist=(t,e=200)=>new Promise(r=>{let o=setInterval(()=>{let e=document.querySelector(t);e&&(clearInterval(o),clearTimeout(a),r(e))},50),a=setTimeout(()=>{clearInterval(o),clearTimeout(a),r(null)},e)}),notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},isLayoutElement=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},isPopup=t=>{let e=t.getAttribute("data-component-tag");return"Dialog"===e},isSticky=t=>{let e=t.getAttribute("data-component-tag");return"Sticky"===e},isOverToolbarPosition=(t,e)=>{let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();return r.top-o.top<33},findOverflowParent=(t,e)=>{let r=e||t;if(t&&!isSection(t))return notVisible(t)&&isOverToolbarPosition(e,t)?t:t.parentElement?findOverflowParent(t.parentElement,r):void 0},COMPONENTS_TAG_NOT_LOAD_IMAGES=["PostPurchaseProductImages"],Toolbar=()=>{let e=r(null),l=r(!1),d=r(),u=r(!1),c=r(!1),[s,b]=o(!1),[m,v]=o(0),[f,g]=o("bottom"),p=r(null),h=({state:t,$toolbar:e,$component:r})=>{let o=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<33&&(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")}},A=a(({$component:t,componentUid:e,focus:r,isPreventSection:o,isParent:a})=>{if(!t&&!e)return;if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}if(!e){let r=t.getAttribute("data-uid");if(!r)return;e=r}let i=getChildrenByAttrSelector(t,"data-toolbar"),n=getChildrenByAttrSelector(t,"data-outline"),l=getChildrenByAttrSelector(t,"data-toolbar-add-top"),d=getChildrenByAttrSelector(t,"data-toolbar-add-bottom"),u=getChildrenByAttrSelector(t,"data-column"),c=getChildrenByAttrSelector(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"),h({$toolbar:i,$component:t,state:"hover"})),n&&(n.setAttribute("data-outline-hover","true"),a&&n.setAttribute("data-outline-parent-hover","true"),o&&n.setAttribute("data-outline-overlay-theme-section","true"),r&&n.setAttribute("data-outline-hover-focus","true")),l&&!a&&l.setAttribute("data-toolbar-add-hover","true"),d&&!a&&d.setAttribute("data-toolbar-add-hover","true"),u&&u.setAttribute("data-column-visible","true")},[]),w=a(({$component:t,componentUid:e})=>{if(!t){let r=document.querySelector(`[data-uid="${e}"]`);if(!r)return;t=r}let r=getDOMElementParents(t,'[data-uid][data-component-type="component"]:not([data-component-no-setting])',1);if(r.length){for(let t of r)t&&A({$component:t,isParent:!0});y({$component:t,$parents:r})}},[A]),y=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=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(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({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-23*i;l&&(d=parseFloat(e.top)-o+23*i);let u=parseFloat(e.left)+a;n.setAttribute("style",`top: ${d}px;left: ${u}px;`),i++}}}}},E=a(()=>{let t=["data-outline-overlay","data-outline-overlay-theme-section","data-theme-section-status-active"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))})},[]),S=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-column-visible","data-outline-parent-hover","data-toolbar-hover-overflow"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))}),E()},[E]),C=a(()=>{if(p.current&&clearTimeout(p.current),m>0){let t=new CustomEvent("editor:toolbar:close-onboarding",{bubbles:!0,detail:{close:"close Onboarding"}});window.dispatchEvent(t),b(!1)}},[m]),$=a(()=>{e.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-column-force-visible","data-toolbar-active-overflow"],r=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));r&&t.forEach(t=>{r.forEach(e=>e.removeAttribute(t))}),q(!1),d.current&&d.current(),C()},[C]),B=(t,r)=>{let o=t=>{let o=t.detail;o?.componentUid==e.current?.componentUid&&r()};window.removeEventListener("editor:component:render",o),window.addEventListener("editor:component:render",o);let a=t.getAttribute("data-component-tag");if(a&&!COMPONENTS_TAG_NOT_LOAD_IMAGES.includes(a)){let e=t.querySelectorAll("img");e?.length&&e.forEach(t=>{t.addEventListener("load",()=>{r()})})}d.current=()=>{window.removeEventListener("editor:component:render",o)}},L=a(({$component:t})=>{if(!t)return;let e=getComputedStyle(t),r=getChildrenByAttrSelector(t,"data-spacing"),o=r?.querySelector("[data-spacing-margin-bottom]")||null;if(o){let r=o.querySelector("[data-spacing-margin-bottom-bg]")||null,a=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(r&&a){let i=e.marginBottom;if(0>parseFloat(i)&&(i="0"),r.style.height=i,a.style.top=i,o.setAttribute("data-spacing-margin-bottom-active","true"),isLayoutElement(t))r.style.left="0";else{let t=e.paddingLeft,o=`-${t}`,i=`translate(${o}, -100%)`;r.style.left=o,a.style.transform=i}}}},[]),T=()=>{let t=document.querySelector("[data-toolbar-active]"),e=document.querySelector("[data-toolbar-onboarding]");t&&e&&(e?.removeAttribute("data-onboarding-active"),setTimeout(()=>{let r=t.getBoundingClientRect(),o=r.top||0,a=e?.getBoundingClientRect(),i=a?.height||0,n=parent.document.querySelector(".iframe"),l=n?.contentWindow,d=l?.scrollY||0,u=n?.clientHeight||0;if(o+i>u){let t=r.top+d-i-8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),g("top"),l&&t<r.top+d&&setTimeout(()=>{let e=t-20;l.scrollTo({top:e,behavior:"smooth"})},200)}else{let t=r.top+d+r.height+8;e?.setAttribute("style",`top: ${t}px;left: ${r.left}px;`),g("bottom")}v(t=>t+1),e?.setAttribute("data-onboarding-active","true")},100))},O=a(({$component:t})=>{if(!t||isSection(t)||isPopup(t)||isSticky(t))return;let e=document.querySelector("[data-toolbar-onboarding]");0==m?T():(C(),e?.removeAttribute("data-onboarding-active"))},[m,C]),P=a(async({componentUid:t,productId:r,timeAwait:o=500,forceReActive:a})=>{if(!t)return;let i=`${r?`[data-product-id="${r}"][data-uid="${t}"], [data-product-id="${r}"] [data-uid="${t}"]`:`[data-uid="${t}"]`}`,n=await waitForElementToExist(i,o);if(!n||!a&&t==e.current?.componentUid&&r==e.current?.productId)return;(a||t===e.current?.componentUid)&&r===e.current?.productId||$();let l=getChildrenByAttrSelector(n,"data-toolbar"),d=getChildrenByAttrSelector(n,"data-outline"),u=getChildrenByAttrSelector(n,"data-toolbar-add-top"),c=getChildrenByAttrSelector(n,"data-toolbar-add-bottom"),s=getChildrenByAttrSelector(n,"data-column");if(l&&(e.current={componentUid:t,productId:r},l.removeAttribute("style"),l.setAttribute("data-toolbar-active","true"),h({$toolbar:l,$component:n,state:"active"})),d&&d.setAttribute("data-outline-active","true"),u&&u.setAttribute("data-toolbar-add-active","true"),c&&c.setAttribute("data-toolbar-add-active","true"),s&&s.setAttribute("data-column-force-visible","true"),r){let e=document.querySelectorAll(`[data-uid="${t}"]`);e?.length&&e.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&e.setAttribute("data-outline-active","true")})}L({$component:n}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{O({$component:n})},5e3),S(),B(n,()=>{P({componentUid:t,productId:r,timeAwait:2e3,forceReActive:!0})})},[$,S,L,O]),q=async t=>{if(t){if(e.current?.componentUid){let r=e.current?.componentUid,o=e.current?.productId,a=await waitForElementToExist(`${o?`[data-product-id="${o}"] `:""}[data-uid="${r}"]`,500);if(a){let e=getChildrenByAttrSelector(a,"data-toolbar"),r=getChildrenByAttrSelector(a,"data-outline"),o=getChildrenByAttrSelector(a,"data-spacing");e&&t&&e.setAttribute("data-toolbar-editor-inline-focus","true"),r&&t&&r.setAttribute("data-outline-editor-inline-focus","true"),o&&t&&o.setAttribute("data-spacing-hidden","true")}}}else{let t=document.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"))})}},I=a(t=>{let r=t.closest("[data-theme-section]"),o=r?.getAttribute("data-uid"),a=r&&o===e.current?.componentUid;if(!a)return;let i=getChildrenByAttrSelector(r,"data-theme-section-status");i&&i.setAttribute("data-theme-section-status-active","true")},[]),R=async({value:t})=>{if(!t)return;let r=await waitForElementToExist(`${e.current?.productId?`[data-product-id="${e.current?.productId}"] `:""}[data-uid="${e.current?.componentUid}"]`,500);if(r){let t=r?.querySelectorAll("[data-toolbar-parent]");if(t.length){let r=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.setAttribute("data-outline-force-hover","true"),e.setAttribute("data-outline-force-overlay","true"))})},o=t=>{let e=t.getAttribute("data-parent-uid");if(!e)return;let r=document.querySelectorAll(`[data-uid="${e}"]`);r.length&&r.forEach(t=>{let e=getChildrenByAttrSelector(t,"data-outline");e&&(e.removeAttribute("data-outline-force-hover"),e.removeAttribute("data-outline-force-overlay"))})},a=async t=>{let r=t.getAttribute("data-parent-uid");if(!r)return;let a=async()=>{let t=await waitForElementToExist(`[data-uid="${r}"]`,500),e=t?.closest("[data-product-id]"),o=e?.getAttribute("data-product-id")||"";return!!o},i="";await a()&&(i=e.current?.productId||"");let n=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:r,productId:i}});o(t),window.dispatchEvent(n)};t.forEach(t=>{t.addEventListener("mouseover",()=>r(t)),t.addEventListener("mouseout",()=>o(t)),t.addEventListener("click",()=>a(t))})}}},U=a(t=>{if(l.current||u.current||c.current)return;let r=t.target;if(!r||"function"!=typeof r.closest){E();return}let o=r.closest("[data-toolbar-hover]");if(o)return;let a=r.closest("[data-toolbar-wrap]"),i=a?.getAttribute("data-uid");if(!a||!i||"ROOT"==i){S();return}let n=getChildrenByAttrSelector(a,"data-toolbar"),d=getChildrenByAttrSelector(a,"data-outline");if(d&&d.removeAttribute("data-outline-overlay"),!i||"ROOT"==i||n?.getAttribute("data-toolbar-hover-focus"))return;if(n?.getAttribute("data-toolbar-hover-focus")||S(),I(r),i==e.current?.componentUid){if(e.current.productId){let t=a.closest("[data-product-id]");if(t){let r=t.getAttribute("data-product-id");if(r==e.current.productId)return}}let t=r.closest("[data-theme-section]")||r.closest("[data-shopify-section]");if(!t)return;A({$component:t,focus:!0,isPreventSection:!0})}let s=r.closest("[data-theme-section]")||r.closest("[data-shopify-section]");s?A({$component:s,focus:!0,isPreventSection:!0}):(A({$component:a,componentUid:i,focus:!0}),w({$component:a,componentUid:i}))},[I,S,A,w,E,e]),x=a(t=>{if(l.current)return;let e=t.detail;e?.componentUid?P({componentUid:e.componentUid,productId:e.productId}):$()},[P,$,l]),_=a(()=>{S()},[S]),F=a(t=>{let e=t.detail;e.value&&(S(),$()),l.current=e.value},[S,$]),N=a(t=>{let e=t.detail;e.value?q(!0):q(!1)},[]),D=a(t=>{if(l.current)return;let e=t.detail;R({value:e?.value||!1})},[]),k=a(t=>{let e=t.detail;e?.value?(S(),u.current=!0):u.current=!1},[S]),z=a(t=>{let e=t.detail;e?.value?(S(),c.current=!0):c.current=!1},[S]),G=(t,e)=>{if(!t)return;let r=document.querySelectorAll(`[data-uid="${t}"]`);r.length&&r.forEach(t=>{let r=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")))})},H=a(t=>{if(l.current)return;let e=t.detail;e?.componentUid&&G(e?.componentUid,e?.type)},[l]),M=a(t=>{let e=t.detail;e?.isNewUser&&b(!0)},[]),j=a(()=>{s&&T()},[s]);return i(()=>(document.addEventListener("mousemove",U),window.addEventListener("editor:active-component",x),window.addEventListener("editor:focus-outside-preview",_),window.addEventListener("editor:is-dragging",F),window.addEventListener("editor:is-editing-text-editor",N),window.addEventListener("editor:toolbar:show-parents",D),window.addEventListener("editor:toolbar:resize-spacing",k),window.addEventListener("editor:toolbar:resize-column",z),window.addEventListener("editor:hover-component",H),window.addEventListener("editor:toolbar-onboarding",M),window.addEventListener("resize",j),()=>{document.removeEventListener("mousemove",U),window.removeEventListener("editor:active-component",x),window.removeEventListener("editor:is-dragging",_),window.removeEventListener("editor:is-dragging",F),window.removeEventListener("editor:is-editing-text-editor",N),window.removeEventListener("editor:toolbar:show-parents",D),window.removeEventListener("editor:toolbar:resize-spacing",k),window.removeEventListener("editor:toolbar:resize-column",z),window.removeEventListener("editor:hover-component",H),window.removeEventListener("editor:toolbar-onboarding",M),window.removeEventListener("resize",j)}),[U,x,_,F,N,D,k,z,H,M,j]),s&&t(n,{enable:!0,position:f,onCloseOnboarding:C})};var Toolbar$1=e(Toolbar);export{Toolbar$1 as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as o,jsx as t}from"react/jsx-runtime";import{PageProvider as r,BuilderComponentProvider as i,SectionProvider as m,BuilderPreviewProvider as n,RenderPreview as a}from"@gem-sdk/core";import{NextSeo as l}from"next-seo";import s from"next/head";import{useState as d,useMemo as p,useEffect as c}from"react";import g from"../components/builder/Toolbox.js";import u from"../components/Header.js";import
|
|
1
|
+
import{jsxs as e,Fragment as o,jsx as t}from"react/jsx-runtime";import{PageProvider as r,BuilderComponentProvider as i,SectionProvider as m,BuilderPreviewProvider as n,RenderPreview as a}from"@gem-sdk/core";import{NextSeo as l}from"next-seo";import s from"next/head";import{useState as d,useMemo as p,useEffect as c}from"react";import g from"../components/builder/Toolbox.js";import u from"../components/Header.js";import T from"../components/Footer.js";import f from"./CollectionGlobalProvider.js";import h from"../components/builder/PopupManager.js";import y from"../components/image-to-layout/ImageToLayout.js";import O from"../components/image-to-layout/AddSectionImageToLayout.js";import b from"../components/builder/Toolbar.js";let BuilderPage=({components:j,seo:v,themeStyle:x,fontStyle:L,sectionData:I,pageType:P,editorImageToLayout:R,isThemeSectionEditor:S,hiddenToolbar:_,isOriginTemplate:C})=>{let[H,N]=d(!1),E=p(()=>({ROOT:{uid:"ROOT",tag:"Root",label:"Root",childrens:[]}}),[]);return c(()=>{N(!0)},[]),e(o,{children:[t(l,{...v}),e(s,{children:[x&&t("style",{type:"text/css",id:"global-style",dangerouslySetInnerHTML:{__html:x}}),L&&t("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:L}})]}),t(r,{children:t(i,{components:j,children:t(m,{data:I,children:e(n,{state:E,isThemeSectionEditor:S,children:[t(g,{}),!_&&t(b,{}),t(h,{}),H&&e("div",{className:"builder gp-z-1 gp-relative",children:[!_&&(S?t("div",{className:"gp-h-[40px] gp-bg-[#f4f4f4]"}):t(u,{pageType:P,isOriginTemplate:C})),t("div",{id:"storefront",className:`${S?"theme-section-editor":""} ${"POST_PURCHASE"===P?"post-purchase-page":""}`,children:"GP_COLLECTION"===P?t(f,{children:t(a,{uid:"ROOT"})}):t(a,{uid:"ROOT"})}),t(y,{editorImageToLayout:R||!1}),t(O,{editorImageToLayout:R||!1}),t("div",{id:"visual-content"}),!S&&!_&&t(T,{pageType:P,isOriginTemplate:C})]})]},"preview")})})})]})};export{BuilderPage};
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.871",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"next": "latest"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
29
|
+
"@gem-sdk/core": "2.0.0-dev.871",
|
|
30
30
|
"@gem-sdk/plugin-cookie-bar": "1.14.0-dev.619",
|
|
31
31
|
"@gem-sdk/plugin-quick-view": "1.14.0-dev.619",
|
|
32
32
|
"@gem-sdk/plugin-sticky-add-to-cart": "1.14.0-dev.619"
|