@gem-sdk/pages 1.13.42 → 1.14.0-dev.323
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/ErrorBoundary.js +1 -40
- package/dist/cjs/components/ErrorFallback.js +1 -26
- package/dist/cjs/components/FacebookPixel.js +3 -36
- package/dist/cjs/components/Footer.js +1 -141
- package/dist/cjs/components/GoogleAnalytic.js +5 -67
- package/dist/cjs/components/Header.js +1 -110
- package/dist/cjs/components/TikTokPixel.js +3 -19
- package/dist/cjs/components/builder/PopupManager.js +1 -62
- package/dist/cjs/components/builder/Toolbar.js +1 -0
- package/dist/cjs/components/builder/Toolbox.js +1 -271
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +1 -279
- package/dist/cjs/components/image-to-layout/DropElement.js +1 -123
- package/dist/cjs/components/image-to-layout/ImageToLayout.js +1 -62
- package/dist/cjs/components/image-to-layout/ImageToLayoutInput.js +1 -201
- package/dist/cjs/components/image-to-layout/PagesSuggestion.js +1 -80
- package/dist/cjs/index.js +1 -75
- package/dist/cjs/layouts/main.js +1 -30
- package/dist/cjs/libs/api/get-builder-props.js +1 -41
- package/dist/cjs/libs/api/get-collection-props.js +1 -68
- package/dist/cjs/libs/api/get-home-page-props-v2.js +1 -141
- package/dist/cjs/libs/api/get-home-page-props.js +1 -151
- package/dist/cjs/libs/api/get-preview-props.js +1 -18
- package/dist/cjs/libs/api/get-product-props.js +1 -73
- package/dist/cjs/libs/api/get-static-page-props-preview.js +1 -148
- package/dist/cjs/libs/api/get-static-page-props-v2.js +1 -148
- package/dist/cjs/libs/api/get-static-page-props.js +1 -148
- package/dist/cjs/libs/fetcher.js +1 -67
- package/dist/cjs/libs/get-layout.js +1 -13
- package/dist/cjs/libs/get-storefront-api.js +1 -12
- package/dist/cjs/libs/getStaticPaths.js +1 -10
- package/dist/cjs/libs/google-fonts.js +1 -102
- package/dist/cjs/libs/helpers/common.js +1 -27
- package/dist/cjs/libs/helpers/gen-css.js +1 -111
- package/dist/cjs/libs/helpers/gen-fonts.js +1 -57
- package/dist/cjs/libs/helpers/generate-manifres.js +1 -5
- package/dist/cjs/libs/helpers/get-fallback.js +1 -35
- package/dist/cjs/libs/helpers/normalize.js +1 -90
- package/dist/cjs/libs/helpers/parse-json.js +1 -16
- package/dist/cjs/libs/helpers/user-agent.js +1 -7
- package/dist/cjs/libs/hooks/use-tracking-view.js +1 -45
- package/dist/cjs/libs/parse-html.js +1 -42
- package/dist/cjs/libs/shopify-cdn-with-google-fonts.js +1 -1845
- package/dist/cjs/pages/404.js +1 -43
- package/dist/cjs/pages/500.js +1 -74
- package/dist/cjs/pages/CollectionGlobalProvider.js +1 -59
- package/dist/cjs/pages/builder.js +1 -95
- package/dist/cjs/pages/collection-detail.js +1 -62
- package/dist/cjs/pages/preview.js +1 -26
- package/dist/cjs/pages/product-detail.js +1 -67
- package/dist/cjs/pages/static-v2.js +1 -82
- package/dist/cjs/pages/static.js +1 -73
- package/dist/esm/components/ErrorBoundary.js +1 -38
- package/dist/esm/components/ErrorFallback.js +1 -24
- package/dist/esm/components/FacebookPixel.js +3 -34
- package/dist/esm/components/Footer.js +1 -137
- package/dist/esm/components/GoogleAnalytic.js +5 -65
- package/dist/esm/components/Header.js +1 -106
- package/dist/esm/components/TikTokPixel.js +3 -17
- package/dist/esm/components/builder/PopupManager.js +1 -58
- package/dist/esm/components/builder/Toolbar.js +1 -0
- package/dist/esm/components/builder/Toolbox.js +1 -267
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +1 -275
- package/dist/esm/components/image-to-layout/DropElement.js +1 -121
- package/dist/esm/components/image-to-layout/ImageToLayout.js +1 -58
- package/dist/esm/components/image-to-layout/ImageToLayoutInput.js +1 -199
- package/dist/esm/components/image-to-layout/PagesSuggestion.js +1 -78
- package/dist/esm/index.js +1 -33
- package/dist/esm/layouts/main.js +1 -26
- package/dist/esm/libs/api/get-builder-props.js +1 -39
- package/dist/esm/libs/api/get-collection-props.js +1 -66
- package/dist/esm/libs/api/get-home-page-props-v2.js +1 -139
- package/dist/esm/libs/api/get-home-page-props.js +1 -149
- package/dist/esm/libs/api/get-preview-props.js +1 -16
- package/dist/esm/libs/api/get-product-props.js +1 -71
- package/dist/esm/libs/api/get-static-page-props-preview.js +1 -146
- package/dist/esm/libs/api/get-static-page-props-v2.js +1 -146
- package/dist/esm/libs/api/get-static-page-props.js +1 -146
- package/dist/esm/libs/fetcher.js +1 -64
- package/dist/esm/libs/get-layout.js +1 -11
- package/dist/esm/libs/get-storefront-api.js +1 -10
- package/dist/esm/libs/getStaticPaths.js +1 -8
- package/dist/esm/libs/google-fonts.js +1 -96
- package/dist/esm/libs/helpers/common.js +1 -24
- package/dist/esm/libs/helpers/gen-css.js +1 -109
- package/dist/esm/libs/helpers/gen-fonts.js +1 -54
- package/dist/esm/libs/helpers/generate-manifres.js +1 -3
- package/dist/esm/libs/helpers/get-fallback.js +1 -33
- package/dist/esm/libs/helpers/normalize.js +1 -85
- package/dist/esm/libs/helpers/parse-json.js +1 -13
- package/dist/esm/libs/helpers/user-agent.js +1 -5
- package/dist/esm/libs/hooks/use-tracking-view.js +1 -43
- package/dist/esm/libs/parse-html.js +1 -40
- package/dist/esm/libs/shopify-cdn-with-google-fonts.js +1 -1843
- package/dist/esm/pages/404.js +1 -41
- package/dist/esm/pages/500.js +1 -72
- package/dist/esm/pages/CollectionGlobalProvider.js +1 -55
- package/dist/esm/pages/builder.js +1 -93
- package/dist/esm/pages/collection-detail.js +1 -58
- package/dist/esm/pages/preview.js +1 -24
- package/dist/esm/pages/product-detail.js +1 -63
- package/dist/esm/pages/static-v2.js +1 -80
- package/dist/esm/pages/static.js +1 -69
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -5
|
@@ -1,40 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
|
|
6
|
-
const initialState = {
|
|
7
|
-
hasError: false
|
|
8
|
-
};
|
|
9
|
-
class ErrorBoundary extends react.Component {
|
|
10
|
-
state = initialState;
|
|
11
|
-
static getDerivedStateFromError(error) {
|
|
12
|
-
// Update state so the next render will show the fallback UI
|
|
13
|
-
return {
|
|
14
|
-
hasError: true,
|
|
15
|
-
error
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
reset = ()=>{
|
|
19
|
-
this.setState(initialState);
|
|
20
|
-
};
|
|
21
|
-
componentDidCatch(error, errorInfo) {
|
|
22
|
-
// You can use your own error logging service here
|
|
23
|
-
this.props.onError?.(error, errorInfo);
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
const { FallbackComponent } = this.props;
|
|
27
|
-
// Check if the error is thrown
|
|
28
|
-
if (this.state.hasError) {
|
|
29
|
-
// You can render any custom fallback UI
|
|
30
|
-
return /*#__PURE__*/ jsxRuntime.jsx(FallbackComponent, {
|
|
31
|
-
error: this.state.error,
|
|
32
|
-
resetErrorBoundary: this.reset
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
// Return children components in case of no error
|
|
36
|
-
return this.props.children;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
exports.ErrorBoundary = ErrorBoundary;
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react");const initialState={hasError:!1};class ErrorBoundary extends react.Component{state=initialState;static getDerivedStateFromError(r){return{hasError:!0,error:r}}reset=()=>{this.setState(initialState)};componentDidCatch(r,t){this.props.onError?.(r,t)}render(){let{FallbackComponent:r}=this.props;return this.state.hasError?jsxRuntime.jsx(r,{error:this.state.error,resetErrorBoundary:this.reset}):this.props.children}}exports.ErrorBoundary=ErrorBoundary;
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
|
|
5
|
-
const ErrorFallback = ({ error, resetErrorBoundary })=>{
|
|
6
|
-
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7
|
-
role: "alert",
|
|
8
|
-
className: "flex flex-col items-center gap-2",
|
|
9
|
-
children: [
|
|
10
|
-
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
11
|
-
className: "text-center text-2xl",
|
|
12
|
-
children: "Oops! Something went wrong"
|
|
13
|
-
}),
|
|
14
|
-
/*#__PURE__*/ jsxRuntime.jsx("pre", {
|
|
15
|
-
children: error?.message
|
|
16
|
-
}),
|
|
17
|
-
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
18
|
-
onClick: resetErrorBoundary,
|
|
19
|
-
className: "inline-flex h-10 items-center justify-center gap-2 rounded bg-[#3C67FF] px-6 text-white active:translate-y-1",
|
|
20
|
-
children: "Try again"
|
|
21
|
-
})
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.ErrorFallback = ErrorFallback;
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime");const ErrorFallback=({error:e,resetErrorBoundary:t})=>jsxRuntime.jsxs("div",{role:"alert",className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-center text-2xl",children:"Oops! Something went wrong"}),jsxRuntime.jsx("pre",{children:e?.message}),jsxRuntime.jsx("button",{onClick:t,className:"inline-flex h-10 items-center justify-center gap-2 rounded bg-[#3C67FF] px-6 text-white active:translate-y-1",children:"Try again"})]});exports.ErrorFallback=ErrorFallback;
|
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var core = require('@gem-sdk/core');
|
|
5
|
-
var router = require('next/router');
|
|
6
|
-
var Script = require('next/script');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
|
|
9
|
-
const FacebookPixel = ({ pixelId })=>{
|
|
10
|
-
const router$1 = router.useRouter();
|
|
11
|
-
react.useEffect(()=>{
|
|
12
|
-
const handleRouteChange = ()=>{
|
|
13
|
-
core.fpixel.pageview();
|
|
14
|
-
};
|
|
15
|
-
router$1.events.on('routeChangeComplete', handleRouteChange);
|
|
16
|
-
router$1.events.on('hashChangeComplete', handleRouteChange);
|
|
17
|
-
return ()=>{
|
|
18
|
-
router$1.events.off('routeChangeComplete', handleRouteChange);
|
|
19
|
-
router$1.events.off('hashChangeComplete', handleRouteChange);
|
|
20
|
-
};
|
|
21
|
-
}, [
|
|
22
|
-
router$1.events
|
|
23
|
-
]);
|
|
24
|
-
if (!pixelId) return null;
|
|
25
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
26
|
-
id: "fb-pixel",
|
|
27
|
-
strategy: "lazyOnload",
|
|
28
|
-
dangerouslySetInnerHTML: {
|
|
29
|
-
__html: `
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),router=require("next/router"),Script=require("next/script"),react=require("react");const FacebookPixel=({pixelId:e})=>{let t=router.useRouter();return(react.useEffect(()=>{let e=()=>{core.fpixel.pageview()};return t.events.on("routeChangeComplete",e),t.events.on("hashChangeComplete",e),()=>{t.events.off("routeChangeComplete",e),t.events.off("hashChangeComplete",e)}},[t.events]),e)?jsxRuntime.jsx(Script,{id:"fb-pixel",strategy:"lazyOnload",dangerouslySetInnerHTML:{__html:`
|
|
30
2
|
!function(f,b,e,v,n,t,s)
|
|
31
3
|
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
32
4
|
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
@@ -35,11 +7,6 @@ const FacebookPixel = ({ pixelId })=>{
|
|
|
35
7
|
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
36
8
|
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
37
9
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
38
|
-
fbq('init', ${
|
|
10
|
+
fbq('init', ${e});
|
|
39
11
|
fbq('track', 'PageView');
|
|
40
|
-
`
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
exports.FacebookPixel = FacebookPixel;
|
|
12
|
+
`}}):null};exports.FacebookPixel=FacebookPixel;
|
|
@@ -1,141 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var core = require('@gem-sdk/core');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
|
|
9
|
-
const defaultMargin = {
|
|
10
|
-
desktop: '40px',
|
|
11
|
-
tablet: '40px',
|
|
12
|
-
mobile: '40px'
|
|
13
|
-
};
|
|
14
|
-
const Footer = ()=>{
|
|
15
|
-
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
16
|
-
const [shouldFixed, setShouldFixed] = react.useState(false);
|
|
17
|
-
react.useEffect(()=>{
|
|
18
|
-
const $iframe = parent.document.querySelector('.iframe');
|
|
19
|
-
if (!$iframe) return;
|
|
20
|
-
const $storefront = document.querySelector('#storefront');
|
|
21
|
-
if (!$storefront) return;
|
|
22
|
-
const headerHeight = 40;
|
|
23
|
-
const footerHeight = 48;
|
|
24
|
-
const iframeHeight = $iframe.clientHeight;
|
|
25
|
-
const comparedHeight = layoutSetting?.showHeader ? iframeHeight - headerHeight - footerHeight : iframeHeight - footerHeight;
|
|
26
|
-
const observer = new ResizeObserver((entries)=>{
|
|
27
|
-
// Handle set fixed footer
|
|
28
|
-
const currentEditingFrameHeight = entries[0]?.target.clientHeight;
|
|
29
|
-
if (currentEditingFrameHeight && comparedHeight) setShouldFixed(currentEditingFrameHeight < comparedHeight);
|
|
30
|
-
});
|
|
31
|
-
observer.observe($storefront);
|
|
32
|
-
return ()=>{
|
|
33
|
-
observer.unobserve($storefront);
|
|
34
|
-
};
|
|
35
|
-
}, [
|
|
36
|
-
layoutSetting
|
|
37
|
-
]);
|
|
38
|
-
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
39
|
-
className: core.cls('gp-footer-container border-1 group flex h-[48px] justify-center border-y border-[#EEEEEE] bg-white font-sans', {
|
|
40
|
-
hidden: !layoutSetting?.showFooter,
|
|
41
|
-
'fixed bottom-0 w-full': shouldFixed
|
|
42
|
-
}),
|
|
43
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
44
|
-
className: "flex h-[40px] flex-1 items-center justify-between",
|
|
45
|
-
style: {
|
|
46
|
-
maxWidth: `var(--g-ct-w)`,
|
|
47
|
-
...core.makeStyleResponsive('ml', defaultMargin),
|
|
48
|
-
...core.makeStyleResponsive('mr', defaultMargin)
|
|
49
|
-
},
|
|
50
|
-
children: [
|
|
51
|
-
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
52
|
-
width: "192",
|
|
53
|
-
height: "8",
|
|
54
|
-
viewBox: "0 0 192 8",
|
|
55
|
-
fill: "none",
|
|
56
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
57
|
-
children: [
|
|
58
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
59
|
-
width: "56",
|
|
60
|
-
height: "8",
|
|
61
|
-
rx: "3",
|
|
62
|
-
fill: "#E1E1E1"
|
|
63
|
-
}),
|
|
64
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
65
|
-
x: "68",
|
|
66
|
-
width: "56",
|
|
67
|
-
height: "8",
|
|
68
|
-
rx: "3",
|
|
69
|
-
fill: "#E1E1E1"
|
|
70
|
-
}),
|
|
71
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
72
|
-
x: "136",
|
|
73
|
-
width: "56",
|
|
74
|
-
height: "8",
|
|
75
|
-
rx: "3",
|
|
76
|
-
fill: "#E1E1E1"
|
|
77
|
-
})
|
|
78
|
-
]
|
|
79
|
-
}),
|
|
80
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
81
|
-
className: "gp-footer invisible absolute left-[8px] flex h-[24px] w-[24px] cursor-pointer items-center justify-center rounded bg-[#EEEEEE] p-[4px] hover:bg-[#0000001a] group-hover:visible",
|
|
82
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
83
|
-
className: "flex h-[24px] w-[24px] items-center justify-center",
|
|
84
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
85
|
-
width: "14",
|
|
86
|
-
height: "14",
|
|
87
|
-
viewBox: "0 0 14 14",
|
|
88
|
-
fill: "none",
|
|
89
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
90
|
-
children: [
|
|
91
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
92
|
-
fillRule: "evenodd",
|
|
93
|
-
clipRule: "evenodd",
|
|
94
|
-
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",
|
|
95
|
-
fill: "#212121"
|
|
96
|
-
}),
|
|
97
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
98
|
-
fillRule: "evenodd",
|
|
99
|
-
clipRule: "evenodd",
|
|
100
|
-
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",
|
|
101
|
-
fill: "#212121"
|
|
102
|
-
})
|
|
103
|
-
]
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
}),
|
|
107
|
-
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
108
|
-
width: "82",
|
|
109
|
-
height: "8",
|
|
110
|
-
viewBox: "0 0 82 8",
|
|
111
|
-
fill: "none",
|
|
112
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
113
|
-
children: [
|
|
114
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
115
|
-
width: "22",
|
|
116
|
-
height: "8",
|
|
117
|
-
rx: "3",
|
|
118
|
-
fill: "#E1E1E1"
|
|
119
|
-
}),
|
|
120
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
121
|
-
x: "30",
|
|
122
|
-
width: "22",
|
|
123
|
-
height: "8",
|
|
124
|
-
rx: "3",
|
|
125
|
-
fill: "#E1E1E1"
|
|
126
|
-
}),
|
|
127
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
128
|
-
x: "60",
|
|
129
|
-
width: "22",
|
|
130
|
-
height: "8",
|
|
131
|
-
rx: "3",
|
|
132
|
-
fill: "#E1E1E1"
|
|
133
|
-
})
|
|
134
|
-
]
|
|
135
|
-
})
|
|
136
|
-
]
|
|
137
|
-
})
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
exports.default = Footer;
|
|
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=()=>{let e=core.useShopStore(e=>e.layoutSettings),[t,s]=react.useState(!1);return react.useEffect(()=>{let t=parent.document.querySelector(".iframe");if(!t)return;let r=document.querySelector("#storefront");if(!r)return;let i=t.clientHeight,o=e?.showHeader?i-40-48:i-48,l=new ResizeObserver(e=>{let t=e[0]?.target.clientHeight;t&&o&&s(t<o)});return l.observe(r),()=>{l.unobserve(r)}},[e]),jsxRuntime.jsx("div",{className:core.cls("gp-footer-container border-1 group flex h-[48px] justify-center border-y border-[#EEEEEE] bg-white font-sans",{"fixed bottom-0 w-full":t}),children:jsxRuntime.jsxs("div",{className:"flex h-[40px] flex-1 items-center 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:e?.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:e?.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:e?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR})]}),jsxRuntime.jsx("div",{className:"gp-footer invisible absolute left-[8px] flex h-[24px] w-[24px] cursor-pointer items-center justify-center rounded bg-[#EEEEEE] p-[4px] hover:bg-[#0000001a] group-hover:visible",children:jsxRuntime.jsx("div",{className:"flex h-[24px] w-[24px] items-center 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:e?.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:e?.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:e?.showFooter?"#D6D6D6":FOOTER_OFF_COLOR})]})]})})};exports.default=Footer;
|
|
@@ -1,74 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var core = require('@gem-sdk/core');
|
|
5
|
-
var router = require('next/router');
|
|
6
|
-
var Script = require('next/script');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
|
|
9
|
-
const GoogleAnalytic = ({ trackingId })=>{
|
|
10
|
-
const router$1 = router.useRouter();
|
|
11
|
-
react.useEffect(()=>{
|
|
12
|
-
const handleRouteChange = (url)=>{
|
|
13
|
-
core.gtag.pageview(url, trackingId);
|
|
14
|
-
};
|
|
15
|
-
router$1.events.on('routeChangeComplete', handleRouteChange);
|
|
16
|
-
router$1.events.on('hashChangeComplete', handleRouteChange);
|
|
17
|
-
return ()=>{
|
|
18
|
-
router$1.events.off('routeChangeComplete', handleRouteChange);
|
|
19
|
-
router$1.events.off('hashChangeComplete', handleRouteChange);
|
|
20
|
-
};
|
|
21
|
-
}, [
|
|
22
|
-
trackingId,
|
|
23
|
-
router$1.events
|
|
24
|
-
]);
|
|
25
|
-
const handleOnReady = ()=>{
|
|
26
|
-
core.gtag.pageview(router$1.pathname, trackingId);
|
|
27
|
-
};
|
|
28
|
-
if (!trackingId) return null;
|
|
29
|
-
if (trackingId.startsWith('UA-')) return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
30
|
-
children: [
|
|
31
|
-
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
32
|
-
strategy: "lazyOnload",
|
|
33
|
-
onReady: handleOnReady,
|
|
34
|
-
src: "https://www.google-analytics.com/analytics.js"
|
|
35
|
-
}),
|
|
36
|
-
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
37
|
-
id: "google-analytics",
|
|
38
|
-
strategy: "lazyOnload",
|
|
39
|
-
dangerouslySetInnerHTML: {
|
|
40
|
-
__html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
41
|
-
ga('create', '${trackingId}', 'auto');
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),router=require("next/router"),Script=require("next/script"),react=require("react");const GoogleAnalytic=({trackingId:e})=>{let t=router.useRouter();react.useEffect(()=>{let a=t=>{core.gtag.pageview(t,e)};return t.events.on("routeChangeComplete",a),t.events.on("hashChangeComplete",a),()=>{t.events.off("routeChangeComplete",a),t.events.off("hashChangeComplete",a)}},[e,t.events]);let a=()=>{core.gtag.pageview(t.pathname,e)};return e?e.startsWith("UA-")?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Script,{strategy:"lazyOnload",onReady:a,src:"https://www.google-analytics.com/analytics.js"}),jsxRuntime.jsx(Script,{id:"google-analytics",strategy:"lazyOnload",dangerouslySetInnerHTML:{__html:`window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
2
|
+
ga('create', '${e}', 'auto');
|
|
42
3
|
ga('require', 'ec');
|
|
43
4
|
ga('send', 'pageview');
|
|
44
|
-
`
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
50
|
-
children: [
|
|
51
|
-
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
52
|
-
strategy: "lazyOnload",
|
|
53
|
-
onReady: handleOnReady,
|
|
54
|
-
src: `https://www.googletagmanager.com/gtag/js?id=${trackingId}`
|
|
55
|
-
}),
|
|
56
|
-
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
57
|
-
id: "gtag-init",
|
|
58
|
-
strategy: "lazyOnload",
|
|
59
|
-
dangerouslySetInnerHTML: {
|
|
60
|
-
__html: `
|
|
5
|
+
`}})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Script,{strategy:"lazyOnload",onReady:a,src:`https://www.googletagmanager.com/gtag/js?id=${e}`}),jsxRuntime.jsx(Script,{id:"gtag-init",strategy:"lazyOnload",dangerouslySetInnerHTML:{__html:`
|
|
61
6
|
window.dataLayer = window.dataLayer || [];
|
|
62
7
|
function gtag(){dataLayer.push(arguments);}
|
|
63
8
|
gtag('js', new Date());
|
|
64
|
-
gtag('config', '${
|
|
9
|
+
gtag('config', '${e}', {
|
|
65
10
|
page_path: window.location.pathname,
|
|
66
11
|
});
|
|
67
|
-
`
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
]
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
exports.GoogleAnalytic = GoogleAnalytic;
|
|
12
|
+
`}})]}):null};exports.GoogleAnalytic=GoogleAnalytic;
|
|
@@ -1,110 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var core = require('@gem-sdk/core');
|
|
7
|
-
|
|
8
|
-
const defaultMargin = {
|
|
9
|
-
desktop: '40px',
|
|
10
|
-
tablet: '40px',
|
|
11
|
-
mobile: '40px'
|
|
12
|
-
};
|
|
13
|
-
const Header = ()=>{
|
|
14
|
-
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
15
|
-
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
16
|
-
className: core.cls('gp-header-container border-1 group relative flex justify-center border-b border-[#EEEEEE] font-sans', {
|
|
17
|
-
hidden: !layoutSetting?.showHeader
|
|
18
|
-
}),
|
|
19
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
20
|
-
className: "flex h-[40px] flex-1 items-center justify-between",
|
|
21
|
-
style: {
|
|
22
|
-
maxWidth: `var(--g-ct-w)`,
|
|
23
|
-
...core.makeStyleResponsive('ml', defaultMargin),
|
|
24
|
-
...core.makeStyleResponsive('mr', defaultMargin)
|
|
25
|
-
},
|
|
26
|
-
children: [
|
|
27
|
-
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
28
|
-
width: "84",
|
|
29
|
-
height: "8",
|
|
30
|
-
viewBox: "0 0 84 8",
|
|
31
|
-
fill: "none",
|
|
32
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
-
children: [
|
|
34
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
35
|
-
width: "22",
|
|
36
|
-
height: "8",
|
|
37
|
-
rx: "3",
|
|
38
|
-
fill: "#9E9E9E"
|
|
39
|
-
}),
|
|
40
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
41
|
-
x: "28",
|
|
42
|
-
width: "56",
|
|
43
|
-
height: "8",
|
|
44
|
-
rx: "3",
|
|
45
|
-
fill: "#E1E1E1"
|
|
46
|
-
})
|
|
47
|
-
]
|
|
48
|
-
}),
|
|
49
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
50
|
-
className: "gp-header invisible absolute left-[8px] flex h-[24px] w-[24px] cursor-pointer items-center justify-center rounded bg-[#EEEEEE] p-[4px] hover:bg-[#0000001a] group-hover:visible",
|
|
51
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
52
|
-
className: "flex h-[24px] w-[24px] items-center justify-center",
|
|
53
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
54
|
-
width: "14",
|
|
55
|
-
height: "14",
|
|
56
|
-
viewBox: "0 0 14 14",
|
|
57
|
-
fill: "none",
|
|
58
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
59
|
-
children: [
|
|
60
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
61
|
-
fillRule: "evenodd",
|
|
62
|
-
clipRule: "evenodd",
|
|
63
|
-
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",
|
|
64
|
-
fill: "#212121"
|
|
65
|
-
}),
|
|
66
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
67
|
-
fillRule: "evenodd",
|
|
68
|
-
clipRule: "evenodd",
|
|
69
|
-
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",
|
|
70
|
-
fill: "#212121"
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
}),
|
|
76
|
-
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
77
|
-
width: "192",
|
|
78
|
-
height: "8",
|
|
79
|
-
viewBox: "0 0 192 8",
|
|
80
|
-
fill: "none",
|
|
81
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
82
|
-
children: [
|
|
83
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
84
|
-
width: "56",
|
|
85
|
-
height: "8",
|
|
86
|
-
rx: "3",
|
|
87
|
-
fill: "#E1E1E1"
|
|
88
|
-
}),
|
|
89
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
90
|
-
x: "68",
|
|
91
|
-
width: "56",
|
|
92
|
-
height: "8",
|
|
93
|
-
rx: "3",
|
|
94
|
-
fill: "#E1E1E1"
|
|
95
|
-
}),
|
|
96
|
-
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
97
|
-
x: "136",
|
|
98
|
-
width: "56",
|
|
99
|
-
height: "8",
|
|
100
|
-
rx: "3",
|
|
101
|
-
fill: "#E1E1E1"
|
|
102
|
-
})
|
|
103
|
-
]
|
|
104
|
-
})
|
|
105
|
-
]
|
|
106
|
-
})
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
exports.default = Header;
|
|
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",Header=()=>{let e=core.useShopStore(e=>e.layoutSettings);return jsxRuntime.jsx("div",{className:core.cls("gp-header-container border-1 group relative flex justify-center border-b border-[#EEEEEE] font-sans"),children:jsxRuntime.jsxs("div",{className:"flex h-[40px] flex-1 items-center 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:e?.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:e?.showHeader?"#D6D6D6":HEADER_OFF_COLOR})]}),jsxRuntime.jsx("div",{className:"gp-header invisible absolute left-[8px] flex h-[24px] w-[24px] cursor-pointer items-center justify-center rounded bg-[#EEEEEE] p-[4px] hover:bg-[#0000001a] group-hover:visible",children:jsxRuntime.jsx("div",{className:"flex h-[24px] w-[24px] items-center 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:e?.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:e?.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:e?.showHeader?"#D6D6D6":HEADER_OFF_COLOR})]})]})})};exports.default=Header;
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var Script = require('next/script');
|
|
5
|
-
|
|
6
|
-
const TikTokPixel = ({ pixelId })=>{
|
|
7
|
-
if (!pixelId) return null;
|
|
8
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
9
|
-
id: "tiktok-pixel",
|
|
10
|
-
strategy: "lazyOnload",
|
|
11
|
-
dangerouslySetInnerHTML: {
|
|
12
|
-
__html: `
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),Script=require("next/script");const TikTokPixel=({pixelId:t})=>t?jsxRuntime.jsx(Script,{id:"tiktok-pixel",strategy:"lazyOnload",dangerouslySetInnerHTML:{__html:`
|
|
13
2
|
!function (w, d, t) {
|
|
14
3
|
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib="+t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};
|
|
15
|
-
ttq.load('${
|
|
4
|
+
ttq.load('${t}');
|
|
16
5
|
ttq.page();
|
|
17
6
|
}(window, document, 'ttq');
|
|
18
|
-
`
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
exports.TikTokPixel = TikTokPixel;
|
|
7
|
+
`}}):null;exports.TikTokPixel=TikTokPixel;
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var core = require('@gem-sdk/core');
|
|
7
|
-
var react = require('react');
|
|
8
|
-
|
|
9
|
-
const isDialog = (item)=>!!item && item?.tag === 'Dialog' && item.type === 'component';
|
|
10
|
-
const PopupManager = ()=>{
|
|
11
|
-
const state = core.useBuilderPreviewStore((s)=>s.state);
|
|
12
|
-
const setModalActive = core.useModalStore((s)=>s.setModalActive);
|
|
13
|
-
const activeModalId = core.useModalStore((s)=>s.activeId);
|
|
14
|
-
const popups = react.useMemo(()=>{
|
|
15
|
-
return state.ROOT.childrens?.map((id)=>{
|
|
16
|
-
return state?.[id];
|
|
17
|
-
}).filter(isDialog);
|
|
18
|
-
}, [
|
|
19
|
-
state
|
|
20
|
-
]);
|
|
21
|
-
const onSetActiveModal = react.useCallback((e)=>{
|
|
22
|
-
const detail = e.detail;
|
|
23
|
-
setModalActive(detail?.modalId);
|
|
24
|
-
}, [
|
|
25
|
-
setModalActive
|
|
26
|
-
]);
|
|
27
|
-
react.useEffect(()=>{
|
|
28
|
-
window.addEventListener('set-active-modal', onSetActiveModal);
|
|
29
|
-
return ()=>{
|
|
30
|
-
window.removeEventListener('set-active-modal', onSetActiveModal);
|
|
31
|
-
};
|
|
32
|
-
}, [
|
|
33
|
-
onSetActiveModal
|
|
34
|
-
]);
|
|
35
|
-
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
36
|
-
className: "pointer-events-none fixed inset-y-0 right-0 z-10 flex w-10 flex-col items-center justify-center gap-1 overflow-y-auto overflow-x-hidden text-sm",
|
|
37
|
-
children: popups?.map((item)=>{
|
|
38
|
-
const display = item?.advanced?.d;
|
|
39
|
-
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
40
|
-
className: core.cls('pointer-events-auto w-full shrink cursor-pointer select-none items-center justify-center whitespace-nowrap py-2 text-white [writing-mode:vertical-lr]', {
|
|
41
|
-
'bg-blue-500': activeModalId === item.uid,
|
|
42
|
-
'bg-blue-700': activeModalId !== item.uid
|
|
43
|
-
}),
|
|
44
|
-
role: "button",
|
|
45
|
-
"aria-hidden": "true",
|
|
46
|
-
onClick: ()=>setModalActive(item?.uid),
|
|
47
|
-
style: {
|
|
48
|
-
'--d': display?.desktop ? 'inline-flex' : 'none',
|
|
49
|
-
'--d-tablet': display?.tablet ? 'inline-flex' : 'none',
|
|
50
|
-
'--d-mobile': display?.mobile ? 'inline-flex' : 'none'
|
|
51
|
-
},
|
|
52
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
53
|
-
className: "text-ellipsis whitespace-nowrap",
|
|
54
|
-
children: item?.settings?.name || 'Popup Name'
|
|
55
|
-
})
|
|
56
|
-
}, item?.uid);
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
var PopupManager$1 = /*#__PURE__*/ react.memo(PopupManager);
|
|
61
|
-
|
|
62
|
-
exports.default = PopupManager$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 isDialog=e=>!!e&&e?.tag==="Dialog"&&"component"===e.type,PopupManager=()=>{let e=core.useBuilderPreviewStore(e=>e.state),t=core.useModalStore(e=>e.setModalActive),i=core.useModalStore(e=>e.activeId),r=react.useMemo(()=>e.ROOT.childrens?.map(t=>e?.[t]).filter(isDialog),[e]),n=react.useCallback(e=>{let i=e.detail;t(i?.modalId)},[t]);return react.useEffect(()=>(window.addEventListener("set-active-modal",n),()=>{window.removeEventListener("set-active-modal",n)}),[n]),jsxRuntime.jsx("div",{className:"pointer-events-none fixed inset-y-0 right-0 z-10 flex w-10 flex-col items-center justify-center gap-1 overflow-y-auto overflow-x-hidden text-sm",children:r?.map(e=>{let r=e?.advanced?.d;return jsxRuntime.jsx("div",{className:core.cls("pointer-events-auto w-full shrink cursor-pointer select-none items-center justify-center whitespace-nowrap py-2 text-white [writing-mode:vertical-lr]",{"bg-blue-500":i===e.uid,"bg-blue-700":i!==e.uid}),role:"button","aria-hidden":"true",onClick:()=>t(e?.uid),style:{"--d":r?.desktop?"inline-flex":"none","--d-tablet":r?.tablet?"inline-flex":"none","--d-mobile":r?.mobile?"inline-flex":"none"},children:jsxRuntime.jsx("span",{className:"text-ellipsis whitespace-nowrap",children:e?.settings?.name||"Popup Name"})},e?.uid)})})};var PopupManager$1=react.memo(PopupManager);exports.default=PopupManager$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var react=require("react");const TOOLBAR_HOVER_HEIGHT=24,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=(t,e,r)=>{for(let o=0;o<r;o++){let r=t.top-23*o>=e.top&&t.top-23*o<=e.top+e.height&&t.left>=e.left&&t.left<=e.left+e.width;if(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},isOverToolbarPosition=(t,e)=>{let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();return r.top-o.top<37},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},Toolbar=()=>{let t=react.useRef(null),e=react.useRef(!1),r=react.useRef(),o=react.useRef(!1),a=react.useCallback(({$component:t,componentUid:e,focus:r,isThemeSection:o})=>{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 a=getChildrenByAttrSelector(t,"data-toolbar"),i=getChildrenByAttrSelector(t,"data-outline"),l=getChildrenByAttrSelector(t,"data-toolbar-add-top"),n=getChildrenByAttrSelector(t,"data-toolbar-add-bottom"),d=getChildrenByAttrSelector(t,"data-theme-section-status");if(o&&d&&d.setAttribute("data-theme-section-status-active","true"),a){a.removeAttribute("style"),a.setAttribute("data-toolbar-hover","true"),r&&a.setAttribute("data-toolbar-hover-focus","true");let e=findOverflowParent(t,a);e&&a.setAttribute("data-toolbar-hover-revert","true")}i&&(i.setAttribute("data-outline-hover","true"),o&&i.setAttribute("data-outline-overlay-theme-section","true"),r&&i.setAttribute("data-outline-hover-focus","true")),l&&l.setAttribute("data-toolbar-add-hover","true"),n&&n.setAttribute("data-toolbar-add-hover","true")},[]),i=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])');if(r.length){for(let t of r)t&&a({$component:t});l({$component:t,$parents:r})}},[a]),l=({$component:t,$parents:e})=>{if(!t||!e?.length)return;let r=getChildrenByAttrSelector(t,"data-toolbar-hover-focus");if(r){let t=r.getBoundingClientRect(),o=1;for(let r of e)if(r){let e=r.getAttribute("data-component-tag");if("Section"===e)continue;let a=getChildrenByAttrSelector(r,"data-toolbar-hover");if(a){let e=a.getAttribute("data-toolbar-active");if(e)continue;let r=a.getBoundingClientRect();if(isOverParent(t,r,o)){let e=getComputedStyle(a),i=!!a.getAttribute("data-toolbar-hover-revert"),l=t.top-r.top,n=t.left-r.left,d=parseFloat(e.top)+l-23*o;i&&(d=parseFloat(e.top)-l+23*o);let u=parseFloat(e.left)+n;a.setAttribute("style",`top: ${d}px;left: ${u}px;`),o++}}}}},n=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))})},[]),d=react.useCallback(()=>{let t=["data-toolbar-hover-focus","data-toolbar-hover","data-outline-hover-focus","data-toolbar-hover-revert","data-outline-hover","data-toolbar-add-hover"],e=document.querySelectorAll(t.map(t=>`[${t}]`).join(","));e&&t.forEach(t=>{e.forEach(e=>e.removeAttribute(t))}),n()},[n]),u=react.useCallback(()=>{t.current=null;let e=["data-toolbar-active","data-outline-active","data-toolbar-add-active","data-toolbar-active-revert","data-spacing-margin-bottom-active","data-toolbar-force-hover","data-outline-force-hover"],o=document.querySelectorAll(e.map(t=>`[${t}]`).join(","));o&&e.forEach(t=>{o.forEach(e=>e.removeAttribute(t))}),v(!1),r.current&&r.current.disconnect()},[]),c=(t,e)=>{let o=t.parentNode;o&&(r.current&&r.current.disconnect(),r.current=new MutationObserver(o=>{for(let a of o)a.removedNodes.forEach(o=>{o===t&&(r.current&&r.current.disconnect(),e())})}),r.current.observe(o,{childList:!0}))},s=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 t=o.querySelector("[data-spacing-margin-bottom-bg]")||null,r=o.querySelector("[data-spacing-margin-bottom-drag]")||null;if(t&&r){let a=e.marginBottom;t.style.height=a,r.style.top=a,o.setAttribute("data-spacing-margin-bottom-active","true")}}},[]),b=(t,e)=>{let r=t.closest('[data-toolbar-wrap][data-component-tag="Section"]');if(r){if(e){let t=getChildrenByAttrSelector(r,"data-toolbar"),e=getChildrenByAttrSelector(r,"data-outline");t&&t.setAttribute("data-toolbar-force-hover","true"),e&&e.setAttribute("data-outline-force-hover","true")}else{let t=getChildrenByAttrSelector(r,"data-toolbar"),e=getChildrenByAttrSelector(r,"data-outline");t&&t.removeAttribute("data-toolbar-force-hover"),e&&e.removeAttribute("data-outline-force-hover")}}},f=react.useCallback(async({componentUid:e,productId:r,timeAwait:o=500,forceReActive:a})=>{if(!e)return;let i=await waitForElementToExist(`${r?`[data-product-id="${r}"] `:""}[data-uid="${e}"]`,o);if(!i||!a&&e==t.current?.componentUid&&r==t.current?.productId)return;(a||e===t.current?.componentUid)&&r===t.current?.productId||u();let l=getChildrenByAttrSelector(i,"data-toolbar"),n=getChildrenByAttrSelector(i,"data-outline"),v=getChildrenByAttrSelector(i,"data-toolbar-add-top"),m=getChildrenByAttrSelector(i,"data-toolbar-add-bottom");if(l){t.current={componentUid:e,productId:r},l.removeAttribute("style"),l.setAttribute("data-toolbar-active","true");let o=findOverflowParent(i,l);o&&l.setAttribute("data-toolbar-active-revert","true")}if(n&&n.setAttribute("data-outline-active","true"),v&&v.setAttribute("data-toolbar-add-active","true"),m&&m.setAttribute("data-toolbar-add-active","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")})}s({$component:i}),b(i,!0),d(),c(i,()=>{f({componentUid:e,productId:r,timeAwait:2e3,forceReActive:!0})})},[u,d,s]),v=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"))})}},m=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")},[]),h=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 l=new CustomEvent("editor:toolbar:force-active-component",{bubbles:!0,detail:{componentUid:r,productId:i}});o(e),window.dispatchEvent(l)};e.forEach(t=>{t.addEventListener("mouseover",()=>r(t)),t.addEventListener("mouseout",()=>o(t)),t.addEventListener("click",()=>a(t))})}}},g=react.useCallback(r=>{if(e.current||o.current)return;let l=r.target;if(!l){n();return}let u=l.closest("[data-toolbar-hover]");if(u){n();let t=l.closest("[data-toolbar-wrap]");if(!t)return;let e=getChildrenByAttrSelector(t,"data-outline");if(!e)return;let r=t.getAttribute("data-theme-section"),o=r?"data-outline-overlay-theme-section":"data-outline-overlay";e.setAttribute(o,"true")}else{let e=l.closest("[data-toolbar-wrap]"),r=e?.getAttribute("data-uid");if(!e||!r||"ROOT"==r){d();return}let o=getChildrenByAttrSelector(e,"data-toolbar"),n=getChildrenByAttrSelector(e,"data-outline");if(n&&n.removeAttribute("data-outline-overlay"),!r||"ROOT"==r||o?.getAttribute("data-toolbar-hover-focus"))return;if(o?.getAttribute("data-toolbar-hover-focus")||d(),m(l),r==t.current?.componentUid){if(t.current.productId){let r=e.closest("[data-product-id]");if(r){let e=r.getAttribute("data-product-id");if(e==t.current.productId)return}}let r=l.closest("[data-theme-section]");if(!r)return;a({$component:r,focus:!0,isThemeSection:!0})}let u=l.closest("[data-theme-section]");u?a({$component:u,focus:!0,isThemeSection:!0}):(a({$component:e,componentUid:r,focus:!0}),i({$component:e,componentUid:r}))}},[m,d,a,i,n,t]),p=react.useCallback(t=>{if(e.current)return;let r=t.detail;r?.componentUid?f({componentUid:r.componentUid,productId:r.productId}):u()},[f,u,e]),A=react.useCallback(()=>{d()},[d]),y=react.useCallback(t=>{let r=t.detail;r.value&&(d(),u()),e.current=r.value},[d,u]),w=react.useCallback(t=>{let e=t.detail;e.value?v(!0):v(!1)},[]),S=react.useCallback(t=>{if(e.current)return;let r=t.detail;h({value:r?.value||!1})},[]),C=react.useCallback(t=>{let e=t.detail;e?.value?(d(),o.current=!0):o.current=!1},[d]);return react.useEffect(()=>(document.addEventListener("mousemove",g),window.addEventListener("editor:active-component",p),window.addEventListener("editor:focus-outside-preview",A),window.addEventListener("editor:is-dragging",y),window.addEventListener("editor:is-editing-text-editor",w),window.addEventListener("editor:toolbar:show-parents",S),window.addEventListener("editor:toolbar:resize-spacing",C),()=>{document.removeEventListener("mousemove",g),window.removeEventListener("editor:active-component",p),window.removeEventListener("editor:is-dragging",A),window.removeEventListener("editor:is-dragging",y),window.removeEventListener("editor:is-editing-text-editor",w),window.removeEventListener("editor:toolbar:show-parents",S),window.removeEventListener("editor:toolbar:resize-spacing",C)}),[g,p,A,y,w,S,C]),null};var Toolbar$1=react.memo(Toolbar);exports.default=Toolbar$1;
|