@gem-sdk/pages 1.64.0 → 2.0.0-dev.168
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 -0
- package/dist/cjs/components/ErrorFallback.js +1 -0
- package/dist/cjs/components/FacebookPixel.js +7 -9
- package/dist/cjs/components/FooterForPostPurchase.js +1 -0
- package/dist/cjs/components/GoogleAnalytic.js +9 -10
- package/dist/cjs/components/TikTokPixel.js +1 -0
- package/dist/cjs/components/builder/Body.js +1 -0
- package/dist/cjs/components/builder/Footer.js +1 -0
- package/dist/cjs/components/builder/Header.js +4 -5
- package/dist/cjs/components/builder/PopupManager.js +1 -0
- package/dist/cjs/components/builder/SwitchView.js +1 -0
- package/dist/cjs/components/builder/Toolbar.js +1 -0
- package/dist/cjs/components/builder/Toolbox.js +12 -1
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +1 -0
- package/dist/cjs/components/image-to-layout/DropElement.js +1 -0
- package/dist/cjs/components/image-to-layout/ImageToLayout.js +1 -0
- package/dist/cjs/index.js +12 -14
- package/dist/cjs/layouts/main.js +2 -1
- package/dist/cjs/libs/api/get-builder-props.js +7 -2
- package/dist/cjs/libs/api/get-post-purchase-props-preview.js +1 -0
- package/dist/cjs/libs/api/get-static-page-props-preview.js +1 -6
- package/dist/cjs/libs/api/get-static-page-props-v2.js +2 -1
- package/dist/cjs/libs/helpers/gen-css.js +1 -1
- package/dist/cjs/libs/helpers/normalize.js +9 -0
- package/dist/cjs/libs/hooks/use-tracking-view.js +1 -0
- package/dist/cjs/libs/parse-html.js +23 -15
- package/dist/cjs/pages/404.js +1 -0
- package/dist/cjs/pages/500.js +1 -0
- package/dist/cjs/pages/CollectionGlobalProvider.js +1 -0
- package/dist/cjs/pages/builder.js +14 -22
- package/dist/cjs/pages/collection-detail.js +31 -40
- package/dist/cjs/pages/preview.js +1 -0
- package/dist/cjs/pages/product-detail.js +18 -29
- package/dist/cjs/pages/static-v2.js +40 -72
- package/dist/cjs/pages/static.js +34 -44
- package/dist/esm/components/ErrorBoundary.js +1 -0
- package/dist/esm/components/ErrorFallback.js +1 -0
- package/dist/esm/components/FacebookPixel.js +7 -9
- package/dist/esm/components/FooterForPostPurchase.js +1 -0
- package/dist/esm/components/GoogleAnalytic.js +9 -10
- package/dist/esm/components/TikTokPixel.js +1 -0
- package/dist/esm/components/builder/Body.js +1 -0
- package/dist/esm/components/builder/Footer.js +1 -0
- package/dist/esm/components/builder/Header.js +4 -5
- package/dist/esm/components/builder/PopupManager.js +1 -0
- package/dist/esm/components/builder/SwitchView.js +1 -0
- package/dist/esm/components/builder/Toolbar.js +1 -0
- package/dist/esm/components/builder/Toolbox.js +12 -1
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +1 -0
- package/dist/esm/components/image-to-layout/DropElement.js +1 -0
- package/dist/esm/components/image-to-layout/ImageToLayout.js +1 -0
- package/dist/esm/index.js +6 -7
- package/dist/esm/layouts/main.js +2 -1
- package/dist/esm/libs/api/get-builder-props.js +8 -3
- package/dist/esm/libs/api/get-post-purchase-props-preview.js +1 -0
- package/dist/esm/libs/api/get-static-page-props-preview.js +2 -7
- package/dist/esm/libs/api/get-static-page-props-v2.js +3 -2
- package/dist/esm/libs/helpers/gen-css.js +1 -1
- package/dist/esm/libs/helpers/normalize.js +9 -1
- package/dist/esm/libs/hooks/use-tracking-view.js +1 -0
- package/dist/esm/libs/parse-html.js +23 -15
- package/dist/esm/pages/404.js +1 -0
- package/dist/esm/pages/500.js +1 -0
- package/dist/esm/pages/CollectionGlobalProvider.js +1 -0
- package/dist/esm/pages/builder.js +14 -22
- package/dist/esm/pages/collection-detail.js +32 -41
- package/dist/esm/pages/preview.js +1 -0
- package/dist/esm/pages/product-detail.js +19 -30
- package/dist/esm/pages/static-v2.js +41 -73
- package/dist/esm/pages/static.js +35 -45
- package/dist/types/index.d.ts +37 -34
- package/package.json +5 -5
- package/dist/cjs/components/builder/InteractionSelectOnPageHeader.js +0 -192
- package/dist/cjs/libs/helpers/sentry.js +0 -17
- package/dist/esm/components/builder/InteractionSelectOnPageHeader.js +0 -188
- package/dist/esm/libs/helpers/sentry.js +0 -15
|
@@ -1,44 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
5
|
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
var core = require('@gem-sdk/core');
|
|
7
|
-
var nextSeo = require('next-seo');
|
|
8
8
|
var dynamic = require('next/dynamic');
|
|
9
|
-
var
|
|
10
|
-
var router = require('next/router');
|
|
9
|
+
var react = require('react');
|
|
11
10
|
|
|
12
11
|
const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
|
|
13
|
-
const ProductDetailPage = ({ themeStyle, fontStyle,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
12
|
+
const ProductDetailPage = ({ themeStyle, fontStyle, product, components, builderData, sectionData })=>{
|
|
13
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(react.Suspense, {
|
|
14
|
+
fallback: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
17
15
|
children: "Loading..."
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
16
|
+
}),
|
|
21
17
|
children: [
|
|
22
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
23
|
-
|
|
18
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
19
|
+
"data-id": "global-style",
|
|
20
|
+
type: "text/css",
|
|
21
|
+
dangerouslySetInnerHTML: {
|
|
22
|
+
__html: themeStyle
|
|
23
|
+
}
|
|
24
24
|
}),
|
|
25
|
-
/*#__PURE__*/ jsxRuntime.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
__html: themeStyle
|
|
32
|
-
}
|
|
33
|
-
}),
|
|
34
|
-
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
35
|
-
"data-id": "google-fonts",
|
|
36
|
-
type: "text/css",
|
|
37
|
-
dangerouslySetInnerHTML: {
|
|
38
|
-
__html: fontStyle
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
]
|
|
25
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
26
|
+
"data-id": "google-fonts",
|
|
27
|
+
type: "text/css",
|
|
28
|
+
dangerouslySetInnerHTML: {
|
|
29
|
+
__html: fontStyle
|
|
30
|
+
}
|
|
42
31
|
}),
|
|
43
32
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
44
33
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
@@ -1,88 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
var core = require('@gem-sdk/core');
|
|
5
|
-
var nextSeo = require('next-seo');
|
|
6
|
-
var Head = require('next/head');
|
|
7
|
-
var router = require('next/router');
|
|
8
6
|
var useTrackingView = require('../libs/hooks/use-tracking-view.js');
|
|
9
7
|
var parseHtml = require('../libs/parse-html.js');
|
|
10
8
|
var Header = require('../components/builder/Header.js');
|
|
11
9
|
var FooterForPostPurchase = require('../components/FooterForPostPurchase.js');
|
|
12
10
|
var Script = require('next/script');
|
|
13
|
-
var react = require('react');
|
|
14
11
|
|
|
15
|
-
const StaticPageV2 = ({ components, builderData, sectionData,
|
|
16
|
-
const router$1 = router.useRouter();
|
|
12
|
+
const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
|
|
17
13
|
const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
|
|
18
|
-
useTrackingView.useTrackingView(shopToken, pageHandle
|
|
19
|
-
const customCodeHeaderID = 'custom-code-header';
|
|
20
|
-
react.useEffect(()=>{
|
|
21
|
-
const customCodeHeaderElement = document.querySelectorAll(`#${customCodeHeaderID}`);
|
|
22
|
-
if (customCodeHeaderElement.length > 1) {
|
|
23
|
-
customCodeHeaderElement.forEach((script, index)=>{
|
|
24
|
-
if (index !== 0) script.remove();
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}, []);
|
|
28
|
-
if (router$1.isFallback) {
|
|
29
|
-
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
30
|
-
className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
|
|
31
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
32
|
-
className: "gp-flex gp-gap-2",
|
|
33
|
-
children: [
|
|
34
|
-
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
35
|
-
className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
|
|
36
|
-
}),
|
|
37
|
-
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
38
|
-
className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
|
|
39
|
-
}),
|
|
40
|
-
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
41
|
-
className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
|
|
42
|
-
})
|
|
43
|
-
]
|
|
44
|
-
})
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
const hasInteraction = (interaction?.value || []).length > 0;
|
|
14
|
+
useTrackingView.useTrackingView(shopToken, pageHandle);
|
|
48
15
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
49
16
|
children: [
|
|
50
|
-
|
|
51
|
-
|
|
17
|
+
parseHtml.parseHtml(customCodeHeader),
|
|
18
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
19
|
+
"data-id": "global-style",
|
|
20
|
+
type: "text/css",
|
|
21
|
+
dangerouslySetInnerHTML: {
|
|
22
|
+
__html: themeStyle
|
|
23
|
+
}
|
|
52
24
|
}),
|
|
53
|
-
/*#__PURE__*/ jsxRuntime.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
dangerouslySetInnerHTML: {
|
|
60
|
-
__html: themeStyle
|
|
61
|
-
}
|
|
62
|
-
}, "global-style"),
|
|
63
|
-
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
64
|
-
"data-id": "google-fonts",
|
|
65
|
-
type: "text/css",
|
|
66
|
-
dangerouslySetInnerHTML: {
|
|
67
|
-
__html: fontStyle
|
|
68
|
-
}
|
|
69
|
-
}, "google-fonts"),
|
|
70
|
-
elementFontStyle && elementFontStyle.map((fontStyle)=>/*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
71
|
-
"data-id": "google-element-fonts",
|
|
72
|
-
type: "text/css",
|
|
73
|
-
dangerouslySetInnerHTML: {
|
|
74
|
-
__html: fontStyle
|
|
75
|
-
}
|
|
76
|
-
}, fontStyle)),
|
|
77
|
-
customFonts && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
78
|
-
"data-id": "custom-element-fonts",
|
|
79
|
-
type: "text/css",
|
|
80
|
-
dangerouslySetInnerHTML: {
|
|
81
|
-
__html: customFonts
|
|
82
|
-
}
|
|
83
|
-
}, fontStyle)
|
|
84
|
-
]
|
|
25
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
26
|
+
"data-id": "google-fonts",
|
|
27
|
+
type: "text/css",
|
|
28
|
+
dangerouslySetInnerHTML: {
|
|
29
|
+
__html: fontStyle
|
|
30
|
+
}
|
|
85
31
|
}),
|
|
32
|
+
elementFontStyle && elementFontStyle.map((fontStyle)=>/*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
33
|
+
"data-id": "google-element-fonts",
|
|
34
|
+
type: "text/css",
|
|
35
|
+
dangerouslySetInnerHTML: {
|
|
36
|
+
__html: fontStyle
|
|
37
|
+
}
|
|
38
|
+
}, fontStyle)),
|
|
39
|
+
customFonts && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
40
|
+
"data-id": "custom-element-fonts",
|
|
41
|
+
type: "text/css",
|
|
42
|
+
dangerouslySetInnerHTML: {
|
|
43
|
+
__html: customFonts
|
|
44
|
+
}
|
|
45
|
+
}, fontStyle),
|
|
46
|
+
pageBackground?.isUsePageBackground && pageBackground?.background && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
47
|
+
children: `
|
|
48
|
+
body {
|
|
49
|
+
background: ${pageBackground.background};
|
|
50
|
+
}
|
|
51
|
+
`
|
|
52
|
+
}, `page_background_${pageBackground?.background}`),
|
|
86
53
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
87
54
|
productOffers: productOffers,
|
|
88
55
|
publicStoreFrontData: publicStoreFrontData,
|
|
@@ -94,7 +61,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
94
61
|
isPostPurchase && /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
|
|
95
62
|
pageType: "POST_PURCHASE"
|
|
96
63
|
}),
|
|
97
|
-
|
|
64
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
98
65
|
dangerouslySetInnerHTML: {
|
|
99
66
|
__html: `<div id="gp-interaction" style="display: none;">${JSON.stringify(interaction?.value || [])}</div>`
|
|
100
67
|
}
|
|
@@ -111,8 +78,9 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
111
78
|
/*#__PURE__*/ jsxRuntime.jsx(core.Render, {
|
|
112
79
|
uid: builder.uid
|
|
113
80
|
}),
|
|
114
|
-
|
|
81
|
+
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
115
82
|
defer: true,
|
|
83
|
+
strategy: "lazyOnload",
|
|
116
84
|
src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
|
|
117
85
|
})
|
|
118
86
|
]
|
package/dist/cjs/pages/static.js
CHANGED
|
@@ -1,56 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
5
|
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
var core = require('@gem-sdk/core');
|
|
7
|
-
var
|
|
8
|
-
var Head = require('next/head');
|
|
9
|
-
var router = require('next/router');
|
|
8
|
+
var react = require('react');
|
|
10
9
|
|
|
11
|
-
const StaticPage = ({ components, builderData, sectionData,
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: "gp-flex gp-
|
|
16
|
-
children:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
10
|
+
const StaticPage = ({ components, builderData, sectionData, themeStyle, fontStyle })=>{
|
|
11
|
+
const fallbackContent = /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
12
|
+
className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
|
|
13
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
14
|
+
className: "gp-flex gp-gap-2",
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
17
|
+
className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
20
|
+
className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
|
|
21
|
+
}),
|
|
22
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
23
|
+
className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(react.Suspense, {
|
|
29
|
+
fallback: fallbackContent,
|
|
33
30
|
children: [
|
|
34
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
35
|
-
|
|
31
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
32
|
+
"data-id": "global-style",
|
|
33
|
+
type: "text/css",
|
|
34
|
+
dangerouslySetInnerHTML: {
|
|
35
|
+
__html: themeStyle
|
|
36
|
+
}
|
|
36
37
|
}),
|
|
37
|
-
/*#__PURE__*/ jsxRuntime.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
__html: themeStyle
|
|
44
|
-
}
|
|
45
|
-
}),
|
|
46
|
-
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
47
|
-
"data-id": "google-fonts",
|
|
48
|
-
type: "text/css",
|
|
49
|
-
dangerouslySetInnerHTML: {
|
|
50
|
-
__html: fontStyle
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
]
|
|
38
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
39
|
+
"data-id": "google-fonts",
|
|
40
|
+
type: "text/css",
|
|
41
|
+
dangerouslySetInnerHTML: {
|
|
42
|
+
__html: fontStyle
|
|
43
|
+
}
|
|
54
44
|
}),
|
|
55
45
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
56
46
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { fpixel } from '@gem-sdk/core';
|
|
3
|
-
import {
|
|
4
|
+
import { usePathname, useSearchParams } from 'next/navigation';
|
|
4
5
|
import Script from 'next/script';
|
|
5
6
|
import { useEffect } from 'react';
|
|
6
7
|
|
|
7
8
|
const FacebookPixel = ({ pixelId })=>{
|
|
8
|
-
const
|
|
9
|
+
const pathName = usePathname();
|
|
10
|
+
const searchParams = useSearchParams();
|
|
9
11
|
useEffect(()=>{
|
|
10
12
|
const handleRouteChange = ()=>{
|
|
11
13
|
fpixel.pageview();
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
router.events.on('hashChangeComplete', handleRouteChange);
|
|
15
|
-
return ()=>{
|
|
16
|
-
router.events.off('routeChangeComplete', handleRouteChange);
|
|
17
|
-
router.events.off('hashChangeComplete', handleRouteChange);
|
|
18
|
-
};
|
|
15
|
+
handleRouteChange();
|
|
19
16
|
}, [
|
|
20
|
-
|
|
17
|
+
pathName,
|
|
18
|
+
searchParams
|
|
21
19
|
]);
|
|
22
20
|
if (!pixelId) return null;
|
|
23
21
|
return /*#__PURE__*/ jsx(Script, {
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { gtag } from '@gem-sdk/core';
|
|
3
|
-
import {
|
|
4
|
+
import { useSearchParams, usePathname } from 'next/navigation';
|
|
4
5
|
import Script from 'next/script';
|
|
5
6
|
import { useEffect } from 'react';
|
|
6
7
|
|
|
7
8
|
const GoogleAnalytic = ({ trackingId })=>{
|
|
8
|
-
const
|
|
9
|
+
const searchParams = useSearchParams();
|
|
10
|
+
const pathName = usePathname();
|
|
9
11
|
useEffect(()=>{
|
|
12
|
+
const url = pathName + searchParams.toString();
|
|
10
13
|
const handleRouteChange = (url)=>{
|
|
11
14
|
gtag.pageview(url, trackingId);
|
|
12
15
|
};
|
|
13
|
-
|
|
14
|
-
router.events.on('hashChangeComplete', handleRouteChange);
|
|
15
|
-
return ()=>{
|
|
16
|
-
router.events.off('routeChangeComplete', handleRouteChange);
|
|
17
|
-
router.events.off('hashChangeComplete', handleRouteChange);
|
|
18
|
-
};
|
|
16
|
+
handleRouteChange(url);
|
|
19
17
|
}, [
|
|
20
18
|
trackingId,
|
|
21
|
-
|
|
19
|
+
pathName,
|
|
20
|
+
searchParams
|
|
22
21
|
]);
|
|
23
22
|
const handleOnReady = ()=>{
|
|
24
|
-
gtag.pageview(
|
|
23
|
+
gtag.pageview(pathName, trackingId);
|
|
25
24
|
};
|
|
26
25
|
if (!trackingId) return null;
|
|
27
26
|
if (trackingId.startsWith('UA-')) return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { useShopStore, usePageStore, cls, makeStyleResponsive } from '@gem-sdk/core';
|
|
3
4
|
import Devices from './SwitchView.js';
|
|
4
|
-
import InteractionSelectOnPageHeader from './InteractionSelectOnPageHeader.js';
|
|
5
5
|
|
|
6
6
|
const defaultMargin = {
|
|
7
7
|
desktop: '16px',
|
|
@@ -18,7 +18,7 @@ const sizeCheck = {
|
|
|
18
18
|
const Header = (props)=>{
|
|
19
19
|
const { pageType, isOriginTemplate, openPageSetting } = props;
|
|
20
20
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
21
|
-
|
|
21
|
+
usePageStore((s)=>s.sidebarMode);
|
|
22
22
|
const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
|
|
23
23
|
const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
|
|
24
24
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -118,7 +118,7 @@ const Header = (props)=>{
|
|
|
118
118
|
})
|
|
119
119
|
]
|
|
120
120
|
}),
|
|
121
|
-
!
|
|
121
|
+
!isOriginTemplate && /*#__PURE__*/ jsx("button", {
|
|
122
122
|
className: "gp-header gp-invisible gp-absolute gp-left-[8px] gp-flex gp-h-[24px] gp-cursor-pointer gp-items-center gp-justify-center gp-rounded gp-bg-[#EEEEEE] gp-p-[4px] hover:gp-bg-[#f4f4f4] group-hover:gp-visible",
|
|
123
123
|
onClick: openPageSetting,
|
|
124
124
|
children: /*#__PURE__*/ jsxs("div", {
|
|
@@ -176,8 +176,7 @@ const Header = (props)=>{
|
|
|
176
176
|
})
|
|
177
177
|
]
|
|
178
178
|
})
|
|
179
|
-
})
|
|
180
|
-
sidebarMode === 'interaction' && /*#__PURE__*/ jsx(InteractionSelectOnPageHeader, {})
|
|
179
|
+
})
|
|
181
180
|
]
|
|
182
181
|
});
|
|
183
182
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { useMatchMutate, useShopStore, usePageStore, useBuilderPreviewStore, useSectionStore, useModalStore } from '@gem-sdk/core';
|
|
3
4
|
import { memo, useMemo, useCallback, useEffect } from 'react';
|
|
@@ -16,6 +17,7 @@ const Toolbox = ()=>{
|
|
|
16
17
|
const changeStorefrontInfo = useShopStore((s)=>s.changeStorefrontInfo);
|
|
17
18
|
const setDynamicProduct = usePageStore((s)=>s.setDynamicProduct);
|
|
18
19
|
const setPostPurchaseProductOffers = usePageStore((s)=>s.setPostPurchaseProductOffers);
|
|
20
|
+
const setDynamicDiscountOffer = usePageStore((s)=>s.setDynamicDiscountOffer);
|
|
19
21
|
const setSalePageProductId = usePageStore((s)=>s.setSalePageProductId);
|
|
20
22
|
const setDynamicCollection = usePageStore((s)=>s.setDynamicCollection);
|
|
21
23
|
const initState = useBuilderPreviewStore((s)=>s.initState);
|
|
@@ -341,6 +343,13 @@ const Toolbox = ()=>{
|
|
|
341
343
|
}, [
|
|
342
344
|
setPostPurchaseProductOffers
|
|
343
345
|
]);
|
|
346
|
+
const onUpdateDynamicDiscountOffer = useCallback((e)=>{
|
|
347
|
+
const dynamicDiscountOffer = e.detail;
|
|
348
|
+
if (!dynamicDiscountOffer) return;
|
|
349
|
+
setDynamicDiscountOffer(dynamicDiscountOffer);
|
|
350
|
+
}, [
|
|
351
|
+
setDynamicDiscountOffer
|
|
352
|
+
]);
|
|
344
353
|
const onUpdateSalePageProductId = useCallback((e)=>{
|
|
345
354
|
const id = e.detail;
|
|
346
355
|
if (!id) return;
|
|
@@ -412,6 +421,7 @@ const Toolbox = ()=>{
|
|
|
412
421
|
window.addEventListener('update-item-name', onUpdateItemName);
|
|
413
422
|
window.addEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
414
423
|
window.addEventListener('set-product-offer', onUpdateProductOffers);
|
|
424
|
+
window.addEventListener('set-dynamic-discount-offer', onUpdateDynamicDiscountOffer);
|
|
415
425
|
window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
416
426
|
window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
|
|
417
427
|
window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
@@ -469,7 +479,8 @@ const Toolbox = ()=>{
|
|
|
469
479
|
onUpdateInteractionIsSelectOnPage,
|
|
470
480
|
onUpdateInteractionSettingType,
|
|
471
481
|
onUpdateFontType,
|
|
472
|
-
onChangeSidebarMode
|
|
482
|
+
onChangeSidebarMode,
|
|
483
|
+
onUpdateDynamicDiscountOffer
|
|
473
484
|
]);
|
|
474
485
|
return /*#__PURE__*/ jsx("div", {
|
|
475
486
|
className: "toolbox"
|
package/dist/esm/index.js
CHANGED
|
@@ -16,12 +16,6 @@ export { isBot } from './libs/helpers/user-agent.js';
|
|
|
16
16
|
export { normalizePageSectionResponseV2, parseBuilderTemplateV2 } from './libs/helpers/normalize.js';
|
|
17
17
|
export { getFallbackV2 } from './libs/helpers/get-fallback.js';
|
|
18
18
|
export { retryWithDelay } from './libs/helpers/common.js';
|
|
19
|
-
export { default as CollectionDetailPage } from './pages/collection-detail.js';
|
|
20
|
-
export { PreviewPage } from './pages/preview.js';
|
|
21
|
-
export { default as ProductDetailPage } from './pages/product-detail.js';
|
|
22
|
-
export { default as StaticPage } from './pages/static.js';
|
|
23
|
-
export { BuilderPage } from './pages/builder.js';
|
|
24
|
-
export { StaticPageV2 } from './pages/static-v2.js';
|
|
25
19
|
export { getStaticPaths } from './libs/getStaticPaths.js';
|
|
26
20
|
export { getFontFromGroupSetting, getFontsFromDataBuilder } from './libs/helpers/gen-fonts.js';
|
|
27
21
|
export { getFontFromGlobalStyle, getFonts } from './libs/google-fonts.js';
|
|
@@ -33,4 +27,9 @@ export { Page500 } from './pages/500.js';
|
|
|
33
27
|
export { GoogleAnalytic } from './components/GoogleAnalytic.js';
|
|
34
28
|
export { FacebookPixel } from './components/FacebookPixel.js';
|
|
35
29
|
export { TikTokPixel } from './components/TikTokPixel.js';
|
|
36
|
-
export {
|
|
30
|
+
export { default as CollectionDetailPage } from './pages/collection-detail.js';
|
|
31
|
+
export { PreviewPage } from './pages/preview.js';
|
|
32
|
+
export { default as ProductDetailPage } from './pages/product-detail.js';
|
|
33
|
+
export { default as StaticPage } from './pages/static.js';
|
|
34
|
+
export { BuilderPage } from './pages/builder.js';
|
|
35
|
+
export { StaticPageV2 } from './pages/static-v2.js';
|
package/dist/esm/layouts/main.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { useShopStore, cls, AddOn } from '@gem-sdk/core';
|
|
3
4
|
import { parseHtml } from '../libs/parse-html.js';
|
|
@@ -6,7 +7,7 @@ const MainLayout = ({ children, ...props })=>{
|
|
|
6
7
|
const mobileOnly = useShopStore((s)=>s.mobileOnly);
|
|
7
8
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
8
9
|
children: [
|
|
9
|
-
parseHtml(
|
|
10
|
+
parseHtml(props?.customCodeBody),
|
|
10
11
|
/*#__PURE__*/ jsx("div", {
|
|
11
12
|
className: cls({
|
|
12
13
|
'gp-max-w-mobile gp-mx-auto gp-w-full': mobileOnly
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { StorePropertyDocument } from '@gem-sdk/core';
|
|
1
|
+
import { StorePropertyDocument, ShopShopifyDocument } from '@gem-sdk/core';
|
|
2
2
|
import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
|
|
3
3
|
import { serializableJson, parseJson } from '../helpers/parse-json.js';
|
|
4
4
|
|
|
5
5
|
const getBuilderProps = async (fetcher, shopifyFetcher)=>{
|
|
6
|
-
const [storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
6
|
+
const [storeProperty, shopifyMeta, shopifyInfo] = await Promise.allSettled([
|
|
7
7
|
fetcher([
|
|
8
8
|
StorePropertyDocument
|
|
9
9
|
]),
|
|
10
10
|
shopifyFetcher([
|
|
11
11
|
ShopMetaDocument
|
|
12
|
+
]),
|
|
13
|
+
fetcher([
|
|
14
|
+
ShopShopifyDocument
|
|
12
15
|
])
|
|
13
16
|
]);
|
|
14
17
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
15
18
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
19
|
+
const shopInfo = shopifyInfo.status === 'fulfilled' ? shopifyInfo.value : undefined;
|
|
16
20
|
const seo = shopMeta ? {
|
|
17
21
|
titleTemplate: `%s | ${shopMeta.shop.name}`,
|
|
18
22
|
defaultTitle: shopMeta?.shop.name,
|
|
@@ -32,7 +36,8 @@ const getBuilderProps = async (fetcher, shopifyFetcher)=>{
|
|
|
32
36
|
swr: {
|
|
33
37
|
revalidateOnMount: true
|
|
34
38
|
},
|
|
35
|
-
seo
|
|
39
|
+
seo,
|
|
40
|
+
timezone: shopInfo?.shopShopify?.timezone
|
|
36
41
|
});
|
|
37
42
|
};
|
|
38
43
|
|
|
@@ -5,10 +5,9 @@ import { getFontStyleFromPageTemplate, getFontFromGlobalStyle } from '../google-
|
|
|
5
5
|
import { genCSS } from '../helpers/gen-css.js';
|
|
6
6
|
import { generateManifest } from '../helpers/generate-manifres.js';
|
|
7
7
|
import { getFallbackV2 } from '../helpers/get-fallback.js';
|
|
8
|
-
import { parseBuilderTemplateV2 } from '../helpers/normalize.js';
|
|
8
|
+
import { parseBuilderTemplateV2, extractPageBackground } from '../helpers/normalize.js';
|
|
9
9
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
10
10
|
import { getCustomFonts } from '../custom-fonts.js';
|
|
11
|
-
import { sentryCaptureException } from '../helpers/sentry.js';
|
|
12
11
|
|
|
13
12
|
const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
14
13
|
try {
|
|
@@ -30,10 +29,6 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
30
29
|
])
|
|
31
30
|
]);
|
|
32
31
|
if (theme.status === 'rejected') {
|
|
33
|
-
sentryCaptureException('PreviewThemePageDocument', JSON.stringify(theme), {
|
|
34
|
-
variables,
|
|
35
|
-
theme
|
|
36
|
-
});
|
|
37
32
|
throw new Error(theme.reason?.[0]);
|
|
38
33
|
}
|
|
39
34
|
const dataBuilder = theme.value.previewThemePage;
|
|
@@ -146,7 +141,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
146
141
|
customCodeHeader: dataBuilder.customCode?.header ?? null,
|
|
147
142
|
customCodeBody: dataBuilder.customCode?.body ?? null,
|
|
148
143
|
customFonts,
|
|
149
|
-
|
|
144
|
+
pageBackground: extractPageBackground(dataBuilder)
|
|
150
145
|
});
|
|
151
146
|
} catch (err) {
|
|
152
147
|
captureException(err);
|