@gem-sdk/pages 2.0.0-staging.120 → 2.0.2
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 +0 -1
- package/dist/cjs/components/ErrorFallback.js +0 -1
- package/dist/cjs/components/FacebookPixel.js +9 -7
- package/dist/cjs/components/FooterForPostPurchase.js +0 -1
- package/dist/cjs/components/GoogleAnalytic.js +10 -9
- package/dist/cjs/components/TikTokPixel.js +0 -1
- package/dist/cjs/components/builder/Body.js +0 -1
- package/dist/cjs/components/builder/Footer.js +0 -1
- package/dist/cjs/components/builder/Header.js +4 -3
- package/dist/cjs/components/builder/InteractionSelectOnPageHeader.js +192 -0
- package/dist/cjs/components/builder/PopupManager.js +0 -1
- package/dist/cjs/components/builder/SwitchView.js +0 -1
- package/dist/cjs/components/builder/Toolbar.js +0 -1
- package/dist/cjs/components/builder/Toolbox.js +0 -1
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +0 -1
- package/dist/cjs/components/image-to-layout/DropElement.js +0 -1
- package/dist/cjs/components/image-to-layout/ImageToLayout.js +0 -1
- package/dist/cjs/index.js +14 -12
- package/dist/cjs/layouts/main.js +0 -1
- package/dist/cjs/libs/api/get-post-purchase-props-preview.js +0 -1
- package/dist/cjs/libs/api/get-static-page-props-preview.js +9 -5
- package/dist/cjs/libs/api/get-static-page-props-v2.js +1 -2
- package/dist/cjs/libs/helpers/normalize.js +0 -9
- package/dist/cjs/libs/helpers/sentry.js +17 -0
- package/dist/cjs/libs/hooks/use-tracking-view.js +0 -1
- package/dist/cjs/pages/static-v2.js +2 -9
- package/dist/esm/components/ErrorBoundary.js +0 -1
- package/dist/esm/components/ErrorFallback.js +0 -1
- package/dist/esm/components/FacebookPixel.js +9 -7
- package/dist/esm/components/FooterForPostPurchase.js +0 -1
- package/dist/esm/components/GoogleAnalytic.js +10 -9
- package/dist/esm/components/TikTokPixel.js +0 -1
- package/dist/esm/components/builder/Body.js +0 -1
- package/dist/esm/components/builder/Footer.js +0 -1
- package/dist/esm/components/builder/Header.js +4 -3
- package/dist/esm/components/builder/InteractionSelectOnPageHeader.js +188 -0
- package/dist/esm/components/builder/PopupManager.js +0 -1
- package/dist/esm/components/builder/SwitchView.js +0 -1
- package/dist/esm/components/builder/Toolbar.js +0 -1
- package/dist/esm/components/builder/Toolbox.js +0 -1
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +0 -1
- package/dist/esm/components/image-to-layout/DropElement.js +0 -1
- package/dist/esm/components/image-to-layout/ImageToLayout.js +0 -1
- package/dist/esm/index.js +7 -6
- package/dist/esm/layouts/main.js +0 -1
- package/dist/esm/libs/api/get-post-purchase-props-preview.js +0 -1
- package/dist/esm/libs/api/get-static-page-props-preview.js +10 -6
- package/dist/esm/libs/api/get-static-page-props-v2.js +2 -3
- package/dist/esm/libs/helpers/normalize.js +1 -9
- package/dist/esm/libs/helpers/sentry.js +15 -0
- package/dist/esm/libs/hooks/use-tracking-view.js +0 -1
- package/dist/esm/pages/static-v2.js +2 -9
- package/dist/types/index.d.ts +32 -34
- package/package.json +5 -5
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
4
|
var core = require('@gem-sdk/core');
|
|
6
|
-
var
|
|
5
|
+
var router = require('next/router');
|
|
7
6
|
var Script = require('next/script');
|
|
8
7
|
var react = require('react');
|
|
9
8
|
|
|
10
9
|
const FacebookPixel = ({ pixelId })=>{
|
|
11
|
-
const
|
|
12
|
-
const searchParams = navigation.useSearchParams();
|
|
10
|
+
const router$1 = router.useRouter();
|
|
13
11
|
react.useEffect(()=>{
|
|
14
12
|
const handleRouteChange = ()=>{
|
|
15
13
|
core.fpixel.pageview();
|
|
16
14
|
};
|
|
17
|
-
handleRouteChange
|
|
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
|
+
};
|
|
18
21
|
}, [
|
|
19
|
-
|
|
20
|
-
searchParams
|
|
22
|
+
router$1.events
|
|
21
23
|
]);
|
|
22
24
|
if (!pixelId) return null;
|
|
23
25
|
return /*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
4
|
var core = require('@gem-sdk/core');
|
|
6
|
-
var
|
|
5
|
+
var router = require('next/router');
|
|
7
6
|
var Script = require('next/script');
|
|
8
7
|
var react = require('react');
|
|
9
8
|
|
|
10
9
|
const GoogleAnalytic = ({ trackingId })=>{
|
|
11
|
-
const
|
|
12
|
-
const pathName = navigation.usePathname();
|
|
10
|
+
const router$1 = router.useRouter();
|
|
13
11
|
react.useEffect(()=>{
|
|
14
|
-
const url = pathName + searchParams.toString();
|
|
15
12
|
const handleRouteChange = (url)=>{
|
|
16
13
|
core.gtag.pageview(url, trackingId);
|
|
17
14
|
};
|
|
18
|
-
handleRouteChange
|
|
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
|
+
};
|
|
19
21
|
}, [
|
|
20
22
|
trackingId,
|
|
21
|
-
|
|
22
|
-
searchParams
|
|
23
|
+
router$1.events
|
|
23
24
|
]);
|
|
24
25
|
const handleOnReady = ()=>{
|
|
25
|
-
core.gtag.pageview(
|
|
26
|
+
core.gtag.pageview(router$1.pathname, trackingId);
|
|
26
27
|
};
|
|
27
28
|
if (!trackingId) return null;
|
|
28
29
|
if (trackingId.startsWith('UA-')) return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -6,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
var core = require('@gem-sdk/core');
|
|
8
7
|
var SwitchView = require('./SwitchView.js');
|
|
8
|
+
var InteractionSelectOnPageHeader = require('./InteractionSelectOnPageHeader.js');
|
|
9
9
|
|
|
10
10
|
const defaultMargin = {
|
|
11
11
|
desktop: '16px',
|
|
@@ -22,7 +22,7 @@ const sizeCheck = {
|
|
|
22
22
|
const Header = (props)=>{
|
|
23
23
|
const { pageType, isOriginTemplate, openPageSetting } = props;
|
|
24
24
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
25
|
-
core.usePageStore((s)=>s.sidebarMode);
|
|
25
|
+
const sidebarMode = core.usePageStore((s)=>s.sidebarMode);
|
|
26
26
|
const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
|
|
27
27
|
const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
|
|
28
28
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -180,7 +180,8 @@ const Header = (props)=>{
|
|
|
180
180
|
})
|
|
181
181
|
]
|
|
182
182
|
})
|
|
183
|
-
})
|
|
183
|
+
}),
|
|
184
|
+
sidebarMode === 'interaction' && /*#__PURE__*/ jsxRuntime.jsx(InteractionSelectOnPageHeader.default, {})
|
|
184
185
|
]
|
|
185
186
|
});
|
|
186
187
|
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
'use strict';
|
|
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 InteractionSelectOnPageHeader = ()=>{
|
|
10
|
+
const selectType = core.usePageStore((s)=>s.interactionData?.selectType);
|
|
11
|
+
const settingType = core.usePageStore((s)=>s.interactionData?.settingType);
|
|
12
|
+
const setInteractionSelectType = core.usePageStore((s)=>s.setInteractionSelectType);
|
|
13
|
+
const { closeSelectOnPage, changeSelectMode } = core.useInteraction();
|
|
14
|
+
const [hoverOption, setHoverOption] = react.useState(null);
|
|
15
|
+
const [openDropdown, setOpenDropdown] = react.useState(false);
|
|
16
|
+
const popupRef = react.useRef(null);
|
|
17
|
+
const isSelectOnPage = core.usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
18
|
+
const handleSetInteraction = (type)=>{
|
|
19
|
+
setOpenDropdown(false);
|
|
20
|
+
setInteractionSelectType(type);
|
|
21
|
+
changeSelectMode(type);
|
|
22
|
+
if (type == 'PAGE') closeSelectOnPage();
|
|
23
|
+
};
|
|
24
|
+
const handleClickOutside = react.useCallback((event)=>{
|
|
25
|
+
if (!openDropdown) return;
|
|
26
|
+
if (popupRef.current && !popupRef.current.contains(event.target)) {
|
|
27
|
+
setOpenDropdown(false);
|
|
28
|
+
}
|
|
29
|
+
}, [
|
|
30
|
+
openDropdown
|
|
31
|
+
]);
|
|
32
|
+
react.useEffect(()=>{
|
|
33
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
34
|
+
return ()=>{
|
|
35
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
36
|
+
};
|
|
37
|
+
}, [
|
|
38
|
+
handleClickOutside
|
|
39
|
+
]);
|
|
40
|
+
const isShowOverlay = react.useMemo(()=>{
|
|
41
|
+
return hoverOption !== 'ELEMENT' && (selectType === 'PAGE' || selectType === 'ELEMENT' && hoverOption === 'PAGE') && settingType === 'TRIGGER';
|
|
42
|
+
}, [
|
|
43
|
+
hoverOption,
|
|
44
|
+
selectType
|
|
45
|
+
]);
|
|
46
|
+
const title = react.useMemo(()=>{
|
|
47
|
+
const type = selectType === 'ELEMENT' ? 'an element' : 'entire page';
|
|
48
|
+
if (settingType === 'TRIGGER') return `Start with triggering ${type}`;
|
|
49
|
+
return `Set ${selectType === 'ELEMENT' ? 'an element' : 'entire page'} as target`;
|
|
50
|
+
}, [
|
|
51
|
+
selectType,
|
|
52
|
+
settingType
|
|
53
|
+
]);
|
|
54
|
+
const renderIconCheckSvg = ()=>{
|
|
55
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
56
|
+
className: "gp-w-[21px]",
|
|
57
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
58
|
+
width: "21",
|
|
59
|
+
height: "20",
|
|
60
|
+
viewBox: "0 0 21 20",
|
|
61
|
+
fill: "none",
|
|
62
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
63
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
64
|
+
fillRule: "evenodd",
|
|
65
|
+
clipRule: "evenodd",
|
|
66
|
+
d: "M16.3415 5.1766C16.5528 5.41207 16.5528 5.79383 16.3415 6.0293L8.45016 14.8234C8.34869 14.9365 8.21107 15 8.06757 15C7.92408 15 7.78645 14.9365 7.68499 14.8234L4.65846 11.4505C4.44717 11.215 4.44718 10.8333 4.65848 10.5978C4.86978 10.3623 5.21236 10.3623 5.42365 10.5978L8.06759 13.5443L15.5764 5.1766C15.7877 4.94113 16.1302 4.94113 16.3415 5.1766Z",
|
|
67
|
+
fill: "#00C853"
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
if (!isSelectOnPage) return null;
|
|
73
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ jsxRuntime.jsx("header", {
|
|
76
|
+
className: "gp-flex gp-text-[12px] gp-justify-center gp-items-center gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full gp-z-[1000] gp-bg-[#151515] gp-text-white interaction-select-mode-header",
|
|
77
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("section", {
|
|
78
|
+
className: "gp-flex gp-bg-[#151515]/[0.15] gp-items-center gp-h-full gp-rounded-b-lg gp-pt-1 gp-gap-2",
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
81
|
+
className: "gp-relative",
|
|
82
|
+
children: [
|
|
83
|
+
/*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
84
|
+
className: `gp-h-full hover:gp-bg-[#7190FF] gp-w-[280px] gp-gap-2 gp-py-2 gp-px-4 gp-items-center gp-justify-center gp-leading-5 gp-font-medium gp-flex gp-rounded-b-[8px] gp-bg-[#3C67FF] gp-text-[#F9F9F9]`,
|
|
85
|
+
onClick: ()=>setOpenDropdown((prev)=>!prev),
|
|
86
|
+
children: [
|
|
87
|
+
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
88
|
+
className: "gp-grow",
|
|
89
|
+
children: title
|
|
90
|
+
}),
|
|
91
|
+
settingType === 'TRIGGER' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
92
|
+
className: "gp-w-[21px]",
|
|
93
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
94
|
+
width: "16",
|
|
95
|
+
height: "16",
|
|
96
|
+
viewBox: "0 0 16 16",
|
|
97
|
+
fill: "currentColor",
|
|
98
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
99
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
100
|
+
fillRule: "evenodd",
|
|
101
|
+
clipRule: "evenodd",
|
|
102
|
+
d: "M4.13017 6.11716C4.30374 5.96095 4.58515 5.96095 4.75871 6.11716L8 9.03431L11.2413 6.11716C11.4149 5.96095 11.6963 5.96095 11.8698 6.11716C12.0434 6.27337 12.0434 6.52663 11.8698 6.68284L8.31427 9.88284C8.1407 10.0391 7.8593 10.0391 7.68573 9.88284L4.13017 6.68284C3.95661 6.52663 3.95661 6.27337 4.13017 6.11716Z",
|
|
103
|
+
fill: "currentColor"
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
openDropdown && settingType === 'TRIGGER' && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
110
|
+
ref: popupRef,
|
|
111
|
+
className: "gp-p-2 gp-flex gp-flex-col gp-absolute gp-top-[calc(100%_+_4px)] gp-w-[280px] gp-bg-[#151515] gp-rounded-xl gp-text-white",
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
114
|
+
className: "gp-p-2 gp-flex gp-gap-2 gp-cursor-pointer hover:gp-bg-[#3b3b3b] gp-rounded-lg",
|
|
115
|
+
"aria-hidden": true,
|
|
116
|
+
onClick: ()=>handleSetInteraction('ELEMENT'),
|
|
117
|
+
onMouseOver: ()=>setHoverOption('ELEMENT'),
|
|
118
|
+
onFocus: ()=>setHoverOption('ELEMENT'),
|
|
119
|
+
onMouseLeave: ()=>setHoverOption(null),
|
|
120
|
+
children: [
|
|
121
|
+
selectType === 'ELEMENT' ? renderIconCheckSvg() : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
122
|
+
className: "gp-w-[21px]",
|
|
123
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
124
|
+
width: "18",
|
|
125
|
+
height: "18",
|
|
126
|
+
viewBox: "0 0 18 18",
|
|
127
|
+
fill: "none",
|
|
128
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
129
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
130
|
+
fillRule: "evenodd",
|
|
131
|
+
clipRule: "evenodd",
|
|
132
|
+
d: "M8.99983 0.351562C9.34501 0.351562 9.62483 0.631385 9.62483 0.976562V2.15278C12.923 2.45 15.5496 5.07654 15.8468 8.37476H17.0233C17.3684 8.37476 17.6483 8.65458 17.6483 8.99976C17.6483 9.34493 17.3684 9.62476 17.0233 9.62476H15.8468C15.5496 12.923 12.923 15.5495 9.62483 15.8467V17.0232C9.62483 17.3683 9.34501 17.6482 8.99983 17.6482C8.65465 17.6482 8.37483 17.3683 8.37483 17.0232V15.8467C5.07662 15.5495 2.45007 12.923 2.15286 9.62476H0.976562C0.631385 9.62476 0.351562 9.34493 0.351562 8.99976C0.351562 8.65458 0.631385 8.37476 0.976562 8.37476H2.15286C2.45007 5.07654 5.07662 2.45 8.37483 2.15278V0.976562C8.37483 0.631385 8.65465 0.351562 8.99983 0.351562ZM3.40916 9.62476H5.97656C6.32174 9.62476 6.60156 9.34493 6.60156 8.99976C6.60156 8.65458 6.32174 8.37476 5.97656 8.37476H3.40916C3.69738 5.7675 5.76757 3.6973 8.37483 3.40909V5.97656C8.37483 6.32174 8.65465 6.60156 8.99983 6.60156C9.34501 6.60156 9.62483 6.32174 9.62483 5.97656V3.40909C12.2321 3.6973 14.3023 5.7675 14.5905 8.37476H12.0233C11.6781 8.37476 11.3983 8.65458 11.3983 8.99976C11.3983 9.34493 11.6781 9.62476 12.0233 9.62476H14.5905C14.3023 12.232 12.2321 14.3022 9.62483 14.5904V12.0232C9.62483 11.678 9.34501 11.3982 8.99983 11.3982C8.65465 11.3982 8.37483 11.678 8.37483 12.0232V14.5904C5.76757 14.3022 3.69738 12.232 3.40916 9.62476Z",
|
|
133
|
+
fill: "#AAAAAA"
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
138
|
+
className: "gp-h-[21px]",
|
|
139
|
+
children: "An element"
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
144
|
+
className: "gp-p-2 gp-flex gp-gap-2 gp-cursor-pointer hover:gp-bg-[#3b3b3b] gp-rounded-lg",
|
|
145
|
+
onClick: ()=>handleSetInteraction('PAGE'),
|
|
146
|
+
onMouseOver: ()=>setHoverOption('PAGE'),
|
|
147
|
+
onFocus: ()=>setHoverOption('PAGE'),
|
|
148
|
+
onMouseLeave: ()=>setHoverOption(null),
|
|
149
|
+
"aria-hidden": true,
|
|
150
|
+
children: [
|
|
151
|
+
selectType === 'PAGE' ? renderIconCheckSvg() : /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
152
|
+
width: "21",
|
|
153
|
+
height: "20",
|
|
154
|
+
viewBox: "0 0 21 20",
|
|
155
|
+
fill: "none",
|
|
156
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
157
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
158
|
+
fillRule: "evenodd",
|
|
159
|
+
clipRule: "evenodd",
|
|
160
|
+
d: "M7.25 4.5C6.55964 4.5 6 5.05964 6 5.75V14.25C6 14.9404 6.55964 15.5 7.25 15.5H13.75C14.4404 15.5 15 14.9404 15 14.25V9.5H11.75C10.7835 9.5 10 8.7165 10 7.75V4.5H7.25ZM11.5 5.56066L13.9393 8H11.75C11.6119 8 11.5 7.88807 11.5 7.75V5.56066ZM4.5 5.75C4.5 4.23122 5.73122 3 7.25 3H10.75C10.9489 3 11.1397 3.07902 11.2803 3.21967L16.2803 8.21967C16.421 8.36032 16.5 8.55109 16.5 8.75V14.25C16.5 15.7688 15.2688 17 13.75 17H7.25C5.73122 17 4.5 15.7688 4.5 14.25V5.75Z",
|
|
161
|
+
fill: "#AAAAAA"
|
|
162
|
+
})
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
165
|
+
className: "gp-h-[21px]",
|
|
166
|
+
children: "Entire page"
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
})
|
|
170
|
+
]
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
}),
|
|
174
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
175
|
+
className: "",
|
|
176
|
+
onClick: closeSelectOnPage,
|
|
177
|
+
children: "Cancel"
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
})
|
|
181
|
+
}),
|
|
182
|
+
isShowOverlay && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
183
|
+
className: `gp-w-full gp-fixed gp-top-0 gp-left-0 gp-mt-[40px] gp-z-[999] gp-bg-[#3c67ff]/[0.25] gp-pointer-events-none`,
|
|
184
|
+
style: {
|
|
185
|
+
height: 'calc(100% - 40px)'
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
exports.default = InteractionSelectOnPageHeader;
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,6 +18,12 @@ var userAgent = require('./libs/helpers/user-agent.js');
|
|
|
18
18
|
var normalize = require('./libs/helpers/normalize.js');
|
|
19
19
|
var getFallback = require('./libs/helpers/get-fallback.js');
|
|
20
20
|
var common = require('./libs/helpers/common.js');
|
|
21
|
+
var collectionDetail = require('./pages/collection-detail.js');
|
|
22
|
+
var preview = require('./pages/preview.js');
|
|
23
|
+
var productDetail = require('./pages/product-detail.js');
|
|
24
|
+
var _static = require('./pages/static.js');
|
|
25
|
+
var builder = require('./pages/builder.js');
|
|
26
|
+
var staticV2 = require('./pages/static-v2.js');
|
|
21
27
|
var getStaticPaths = require('./libs/getStaticPaths.js');
|
|
22
28
|
var genFonts = require('./libs/helpers/gen-fonts.js');
|
|
23
29
|
var googleFonts = require('./libs/google-fonts.js');
|
|
@@ -29,12 +35,7 @@ var _500 = require('./pages/500.js');
|
|
|
29
35
|
var GoogleAnalytic = require('./components/GoogleAnalytic.js');
|
|
30
36
|
var FacebookPixel = require('./components/FacebookPixel.js');
|
|
31
37
|
var TikTokPixel = require('./components/TikTokPixel.js');
|
|
32
|
-
var
|
|
33
|
-
var preview = require('./pages/preview.js');
|
|
34
|
-
var productDetail = require('./pages/product-detail.js');
|
|
35
|
-
var _static = require('./pages/static.js');
|
|
36
|
-
var builder = require('./pages/builder.js');
|
|
37
|
-
var staticV2 = require('./pages/static-v2.js');
|
|
38
|
+
var parseHtml = require('./libs/parse-html.js');
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
|
|
@@ -59,6 +60,12 @@ exports.normalizePageSectionResponseV2 = normalize.normalizePageSectionResponseV
|
|
|
59
60
|
exports.parseBuilderTemplateV2 = normalize.parseBuilderTemplateV2;
|
|
60
61
|
exports.getFallbackV2 = getFallback.getFallbackV2;
|
|
61
62
|
exports.retryWithDelay = common.retryWithDelay;
|
|
63
|
+
exports.CollectionDetailPage = collectionDetail.default;
|
|
64
|
+
exports.PreviewPage = preview.PreviewPage;
|
|
65
|
+
exports.ProductDetailPage = productDetail.default;
|
|
66
|
+
exports.StaticPage = _static.default;
|
|
67
|
+
exports.BuilderPage = builder.BuilderPage;
|
|
68
|
+
exports.StaticPageV2 = staticV2.StaticPageV2;
|
|
62
69
|
exports.getStaticPaths = getStaticPaths.getStaticPaths;
|
|
63
70
|
exports.getFontFromGroupSetting = genFonts.getFontFromGroupSetting;
|
|
64
71
|
exports.getFontsFromDataBuilder = genFonts.getFontsFromDataBuilder;
|
|
@@ -72,9 +79,4 @@ exports.Page500 = _500.Page500;
|
|
|
72
79
|
exports.GoogleAnalytic = GoogleAnalytic.GoogleAnalytic;
|
|
73
80
|
exports.FacebookPixel = FacebookPixel.FacebookPixel;
|
|
74
81
|
exports.TikTokPixel = TikTokPixel.TikTokPixel;
|
|
75
|
-
exports.
|
|
76
|
-
exports.PreviewPage = preview.PreviewPage;
|
|
77
|
-
exports.ProductDetailPage = productDetail.default;
|
|
78
|
-
exports.StaticPage = _static.default;
|
|
79
|
-
exports.BuilderPage = builder.BuilderPage;
|
|
80
|
-
exports.StaticPageV2 = staticV2.StaticPageV2;
|
|
82
|
+
exports.parseHtml = parseHtml.parseHtml;
|
package/dist/cjs/layouts/main.js
CHANGED
|
@@ -10,6 +10,7 @@ var getFallback = require('../helpers/get-fallback.js');
|
|
|
10
10
|
var normalize = require('../helpers/normalize.js');
|
|
11
11
|
var parseJson = require('../helpers/parse-json.js');
|
|
12
12
|
var customFonts = require('../custom-fonts.js');
|
|
13
|
+
var sentry = require('../helpers/sentry.js');
|
|
13
14
|
|
|
14
15
|
const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
15
16
|
try {
|
|
@@ -31,6 +32,10 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
31
32
|
])
|
|
32
33
|
]);
|
|
33
34
|
if (theme.status === 'rejected') {
|
|
35
|
+
sentry.sentryCaptureException('PreviewThemePageDocument', JSON.stringify(theme), {
|
|
36
|
+
variables,
|
|
37
|
+
theme
|
|
38
|
+
});
|
|
34
39
|
throw new Error(theme.reason?.[0]);
|
|
35
40
|
}
|
|
36
41
|
const dataBuilder = theme.value.previewThemePage;
|
|
@@ -45,7 +50,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
45
50
|
getFallback.getFallbackV2(fetcher, pageTemplate),
|
|
46
51
|
customFonts.getCustomFonts(themePageCustomFonts)
|
|
47
52
|
]);
|
|
48
|
-
const mobileOnly =
|
|
53
|
+
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
49
54
|
const description = dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
|
|
50
55
|
const thumbnail = parseJson.parseJson(dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
|
|
51
56
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
@@ -119,15 +124,15 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
119
124
|
};
|
|
120
125
|
const languageIsoCode = shopMeta?.localization.language.isoCode ?? null;
|
|
121
126
|
const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
|
|
122
|
-
const locale = languageIsoCode
|
|
127
|
+
const locale = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
|
|
123
128
|
return parseJson.serializableJson({
|
|
124
129
|
themeStyle: genCss.genCSS(dataBuilder?.themeStyle?.data, mobileOnly),
|
|
125
130
|
fontStyle,
|
|
126
131
|
elementFontStyle,
|
|
127
132
|
builderData: pageTemplate,
|
|
128
133
|
pageType,
|
|
129
|
-
moneyFormat: shopMeta?.shop
|
|
130
|
-
currency: shopMeta?.localization
|
|
134
|
+
moneyFormat: shopMeta?.shop.moneyFormat ?? null,
|
|
135
|
+
currency: shopMeta?.localization.country.currency.isoCode ?? null,
|
|
131
136
|
languageIsoCode,
|
|
132
137
|
countryIsoCode,
|
|
133
138
|
locale,
|
|
@@ -143,7 +148,6 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
143
148
|
customCodeHeader: dataBuilder.customCode?.header ?? null,
|
|
144
149
|
customCodeBody: dataBuilder.customCode?.body ?? null,
|
|
145
150
|
customFonts: customFonts$1,
|
|
146
|
-
pageBackground: normalize.extractPageBackground(dataBuilder),
|
|
147
151
|
interaction: dataBuilder?.interaction
|
|
148
152
|
});
|
|
149
153
|
} catch (err) {
|
|
@@ -152,8 +152,7 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
152
152
|
customCodeBody: dataBuilder.themePageCustomCode?.body ?? null,
|
|
153
153
|
pageHandle: dataBuilder.handle ?? null,
|
|
154
154
|
customFonts: customFonts$1,
|
|
155
|
-
interaction: dataBuilder?.interaction
|
|
156
|
-
pageBackground: normalize.extractPageBackground(dataBuilder)
|
|
155
|
+
interaction: dataBuilder?.interaction
|
|
157
156
|
});
|
|
158
157
|
} catch (err) {
|
|
159
158
|
nextjs.captureException(err);
|
|
@@ -83,14 +83,6 @@ const parseBuilderTemplate = (data)=>{
|
|
|
83
83
|
...data?.themePageCustomSections ?? []
|
|
84
84
|
], data?.sectionPosition);
|
|
85
85
|
};
|
|
86
|
-
const extractPageBackground = (data)=>{
|
|
87
|
-
try {
|
|
88
|
-
const pageBackgroundStr = data?.metafields?.find((item)=>item?.key === 'page_background')?.value;
|
|
89
|
-
return JSON.parse(pageBackgroundStr ?? '{}');
|
|
90
|
-
} catch {
|
|
91
|
-
return {};
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
86
|
const parseBuilderLibraryTemplate = (data)=>{
|
|
95
87
|
return normalizePageSectionResponseV2([
|
|
96
88
|
...data?.sections ?? []
|
|
@@ -102,7 +94,6 @@ const parseShopLibraryPageTemplate = (data)=>{
|
|
|
102
94
|
], data?.sectionPosition);
|
|
103
95
|
};
|
|
104
96
|
|
|
105
|
-
exports.extractPageBackground = extractPageBackground;
|
|
106
97
|
exports.normalizeBuilderData = normalizeBuilderData;
|
|
107
98
|
exports.normalizePageSectionResponseV2 = normalizePageSectionResponseV2;
|
|
108
99
|
exports.parseBuilderLibraryTemplate = parseBuilderLibraryTemplate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var nextjs = require('@sentry/nextjs');
|
|
4
|
+
|
|
5
|
+
const sentryCaptureException = (funcName, message, data, options)=>{
|
|
6
|
+
nextjs.withScope((scope)=>{
|
|
7
|
+
scope.setLevel(options?.level ?? 'log');
|
|
8
|
+
if (options?.tag) {
|
|
9
|
+
scope.setTag(options?.tag.key, options?.tag.value);
|
|
10
|
+
}
|
|
11
|
+
scope.setExtra('function', funcName);
|
|
12
|
+
scope.setExtra('data', JSON.stringify(data));
|
|
13
|
+
nextjs.captureMessage(`${funcName}: ${message}`);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.sentryCaptureException = sentryCaptureException;
|
|
@@ -12,7 +12,7 @@ var FooterForPostPurchase = require('../components/FooterForPostPurchase.js');
|
|
|
12
12
|
var Script = require('next/script');
|
|
13
13
|
var react = require('react');
|
|
14
14
|
|
|
15
|
-
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction
|
|
15
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction })=>{
|
|
16
16
|
const router$1 = router.useRouter();
|
|
17
17
|
const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
|
|
18
18
|
useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
|
|
@@ -80,14 +80,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
80
80
|
dangerouslySetInnerHTML: {
|
|
81
81
|
__html: customFonts
|
|
82
82
|
}
|
|
83
|
-
}, fontStyle)
|
|
84
|
-
pageBackground?.isUsePageBackground && pageBackground?.background && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
85
|
-
children: `
|
|
86
|
-
body {
|
|
87
|
-
background: ${pageBackground.background};
|
|
88
|
-
}
|
|
89
|
-
`
|
|
90
|
-
}, `page_background_${pageBackground?.background}`)
|
|
83
|
+
}, fontStyle)
|
|
91
84
|
]
|
|
92
85
|
}),
|
|
93
86
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { fpixel } from '@gem-sdk/core';
|
|
4
|
-
import {
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
5
4
|
import Script from 'next/script';
|
|
6
5
|
import { useEffect } from 'react';
|
|
7
6
|
|
|
8
7
|
const FacebookPixel = ({ pixelId })=>{
|
|
9
|
-
const
|
|
10
|
-
const searchParams = useSearchParams();
|
|
8
|
+
const router = useRouter();
|
|
11
9
|
useEffect(()=>{
|
|
12
10
|
const handleRouteChange = ()=>{
|
|
13
11
|
fpixel.pageview();
|
|
14
12
|
};
|
|
15
|
-
handleRouteChange
|
|
13
|
+
router.events.on('routeChangeComplete', handleRouteChange);
|
|
14
|
+
router.events.on('hashChangeComplete', handleRouteChange);
|
|
15
|
+
return ()=>{
|
|
16
|
+
router.events.off('routeChangeComplete', handleRouteChange);
|
|
17
|
+
router.events.off('hashChangeComplete', handleRouteChange);
|
|
18
|
+
};
|
|
16
19
|
}, [
|
|
17
|
-
|
|
18
|
-
searchParams
|
|
20
|
+
router.events
|
|
19
21
|
]);
|
|
20
22
|
if (!pixelId) return null;
|
|
21
23
|
return /*#__PURE__*/ jsx(Script, {
|