@gem-sdk/pages 2.0.0-dev.173 → 2.0.0-dev.194
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/builder/Header.js +1 -1
- package/dist/cjs/layouts/main.js +1 -1
- package/dist/cjs/libs/api/get-post-purchase-props-preview.js +38 -5
- package/dist/cjs/libs/api/get-static-page-props-preview.js +6 -5
- package/dist/cjs/libs/parse-html.js +15 -23
- package/dist/cjs/pages/builder.js +22 -13
- package/dist/cjs/pages/collection-detail.js +40 -30
- package/dist/cjs/pages/product-detail.js +29 -17
- package/dist/cjs/pages/static-v2.js +80 -40
- package/dist/cjs/pages/static.js +44 -33
- package/dist/esm/components/builder/Header.js +1 -1
- package/dist/esm/layouts/main.js +1 -1
- package/dist/esm/libs/api/get-post-purchase-props-preview.js +39 -6
- package/dist/esm/libs/api/get-static-page-props-preview.js +6 -5
- package/dist/esm/libs/parse-html.js +15 -23
- package/dist/esm/pages/builder.js +22 -13
- package/dist/esm/pages/collection-detail.js +41 -31
- package/dist/esm/pages/product-detail.js +30 -18
- package/dist/esm/pages/static-v2.js +81 -41
- package/dist/esm/pages/static.js +45 -34
- package/dist/types/index.d.ts +4 -2
- package/package.json +5 -5
|
@@ -122,7 +122,7 @@ const Header = (props)=>{
|
|
|
122
122
|
})
|
|
123
123
|
]
|
|
124
124
|
}),
|
|
125
|
-
!isOriginTemplate && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
125
|
+
!(isOriginTemplate || pageType === 'STATIC') && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
126
126
|
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",
|
|
127
127
|
onClick: openPageSetting,
|
|
128
128
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
package/dist/cjs/layouts/main.js
CHANGED
|
@@ -11,7 +11,7 @@ const MainLayout = ({ children, ...props })=>{
|
|
|
11
11
|
const mobileOnly = core.useShopStore((s)=>s.mobileOnly);
|
|
12
12
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13
13
|
children: [
|
|
14
|
-
parseHtml.parseHtml(props?.customCodeBody),
|
|
14
|
+
parseHtml.parseHtml('custom-code-body', props?.customCodeBody),
|
|
15
15
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
16
16
|
className: core.cls({
|
|
17
17
|
'gp-max-w-mobile gp-mx-auto gp-w-full': mobileOnly
|
|
@@ -33,6 +33,7 @@ const fetchSalePageDataByID = async (data, fetcher)=>{
|
|
|
33
33
|
dataBuilder: theme.value.themePage,
|
|
34
34
|
pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
|
|
35
35
|
storeProperty,
|
|
36
|
+
dynamicDiscountOffer: undefined,
|
|
36
37
|
productOffers: []
|
|
37
38
|
};
|
|
38
39
|
};
|
|
@@ -44,7 +45,7 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
44
45
|
default: true
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
|
-
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
48
|
+
const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
|
|
48
49
|
fetcher([
|
|
49
50
|
core.ThemePageDocument,
|
|
50
51
|
variables
|
|
@@ -59,6 +60,12 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
59
60
|
saleFunnelOfferID: data.currentOfferID
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
]),
|
|
64
|
+
fetcher([
|
|
65
|
+
core.SaleFunnelOfferDocument,
|
|
66
|
+
{
|
|
67
|
+
saleFunnelOfferId: data.currentOfferID
|
|
68
|
+
}
|
|
62
69
|
])
|
|
63
70
|
]);
|
|
64
71
|
if (theme.status === 'rejected') {
|
|
@@ -67,10 +74,14 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
67
74
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
68
75
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
69
76
|
}
|
|
77
|
+
if (saleFunnelOffer.status === 'rejected') {
|
|
78
|
+
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
79
|
+
}
|
|
70
80
|
return {
|
|
71
81
|
dataBuilder: theme.value.themePage,
|
|
72
82
|
pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
|
|
73
83
|
storeProperty,
|
|
84
|
+
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
74
85
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
75
86
|
};
|
|
76
87
|
};
|
|
@@ -116,6 +127,7 @@ const fetchThemePageDataByTemplateID = async (data, fetcher)=>{
|
|
|
116
127
|
dataBuilder: theme.value.libraryTemplate,
|
|
117
128
|
pageStyle: undefined,
|
|
118
129
|
storeProperty,
|
|
130
|
+
dynamicDiscountOffer: undefined,
|
|
119
131
|
productOffers: productOffers
|
|
120
132
|
};
|
|
121
133
|
};
|
|
@@ -123,7 +135,7 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
123
135
|
const variables = {
|
|
124
136
|
shopLibraryPageId: data.shopLibraryPageId
|
|
125
137
|
};
|
|
126
|
-
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
138
|
+
const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
|
|
127
139
|
fetcher([
|
|
128
140
|
core.ShopLibraryPageDocument,
|
|
129
141
|
variables
|
|
@@ -138,6 +150,12 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
138
150
|
saleFunnelOfferID: data.currentOfferID
|
|
139
151
|
}
|
|
140
152
|
}
|
|
153
|
+
]),
|
|
154
|
+
fetcher([
|
|
155
|
+
core.SaleFunnelOfferDocument,
|
|
156
|
+
{
|
|
157
|
+
saleFunnelOfferId: data.currentOfferID
|
|
158
|
+
}
|
|
141
159
|
])
|
|
142
160
|
]);
|
|
143
161
|
if (theme.status === 'rejected') {
|
|
@@ -146,10 +164,14 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
146
164
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
147
165
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
148
166
|
}
|
|
167
|
+
if (saleFunnelOffer.status === 'rejected') {
|
|
168
|
+
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
169
|
+
}
|
|
149
170
|
return {
|
|
150
171
|
dataBuilder: theme.value.shopLibraryPage,
|
|
151
172
|
pageStyle: undefined,
|
|
152
173
|
storeProperty,
|
|
174
|
+
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
153
175
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
154
176
|
};
|
|
155
177
|
};
|
|
@@ -157,7 +179,7 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
157
179
|
const variables = {
|
|
158
180
|
libraryTemplateId: data.libraryTemplateId
|
|
159
181
|
};
|
|
160
|
-
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
182
|
+
const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
|
|
161
183
|
fetcher([
|
|
162
184
|
core.LibraryTemplateDocument,
|
|
163
185
|
variables
|
|
@@ -172,6 +194,12 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
172
194
|
saleFunnelOfferID: data.currentOfferID
|
|
173
195
|
}
|
|
174
196
|
}
|
|
197
|
+
]),
|
|
198
|
+
fetcher([
|
|
199
|
+
core.SaleFunnelOfferDocument,
|
|
200
|
+
{
|
|
201
|
+
saleFunnelOfferId: data.currentOfferID
|
|
202
|
+
}
|
|
175
203
|
])
|
|
176
204
|
]);
|
|
177
205
|
if (theme.status === 'rejected') {
|
|
@@ -180,10 +208,14 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
180
208
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
181
209
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
182
210
|
}
|
|
211
|
+
if (saleFunnelOffer.status === 'rejected') {
|
|
212
|
+
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
213
|
+
}
|
|
183
214
|
return {
|
|
184
215
|
dataBuilder: theme.value.libraryTemplate,
|
|
185
216
|
pageStyle: undefined,
|
|
186
217
|
storeProperty,
|
|
218
|
+
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
187
219
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
188
220
|
};
|
|
189
221
|
};
|
|
@@ -221,7 +253,7 @@ const getRelevantPageData = async (data)=>{
|
|
|
221
253
|
const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFetcher)=>async (data)=>{
|
|
222
254
|
try {
|
|
223
255
|
const { id, currentOfferID, isLibraryTemplate, isShopLibraryPage } = data;
|
|
224
|
-
const { dataBuilder, storeProperty, productOffers, pageStyle } = await getRelevantPageData({
|
|
256
|
+
const { dataBuilder, storeProperty, productOffers, pageStyle, dynamicDiscountOffer } = await getRelevantPageData({
|
|
225
257
|
id,
|
|
226
258
|
currentOfferID,
|
|
227
259
|
fetcher,
|
|
@@ -250,7 +282,8 @@ const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFet
|
|
|
250
282
|
swr: {
|
|
251
283
|
fallback
|
|
252
284
|
},
|
|
253
|
-
productOffers
|
|
285
|
+
productOffers,
|
|
286
|
+
dynamicDiscountOffer
|
|
254
287
|
});
|
|
255
288
|
} catch (err) {
|
|
256
289
|
console.log('error', err);
|
|
@@ -45,7 +45,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
45
45
|
getFallback.getFallbackV2(fetcher, pageTemplate),
|
|
46
46
|
customFonts.getCustomFonts(themePageCustomFonts)
|
|
47
47
|
]);
|
|
48
|
-
const mobileOnly = dataBuilder.isMobile
|
|
48
|
+
const mobileOnly = !!dataBuilder.isMobile;
|
|
49
49
|
const description = dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
|
|
50
50
|
const thumbnail = parseJson.parseJson(dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
|
|
51
51
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
@@ -119,15 +119,15 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
119
119
|
};
|
|
120
120
|
const languageIsoCode = shopMeta?.localization.language.isoCode ?? null;
|
|
121
121
|
const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
|
|
122
|
-
const locale =
|
|
122
|
+
const locale = languageIsoCode && countryIsoCode ? `${languageIsoCode}-${countryIsoCode}` : null;
|
|
123
123
|
return parseJson.serializableJson({
|
|
124
124
|
themeStyle: genCss.genCSS(dataBuilder?.themeStyle?.data, mobileOnly),
|
|
125
125
|
fontStyle,
|
|
126
126
|
elementFontStyle,
|
|
127
127
|
builderData: pageTemplate,
|
|
128
128
|
pageType,
|
|
129
|
-
moneyFormat: shopMeta?.shop
|
|
130
|
-
currency: shopMeta?.localization
|
|
129
|
+
moneyFormat: shopMeta?.shop?.moneyFormat ?? null,
|
|
130
|
+
currency: shopMeta?.localization?.country?.currency?.isoCode ?? null,
|
|
131
131
|
languageIsoCode,
|
|
132
132
|
countryIsoCode,
|
|
133
133
|
locale,
|
|
@@ -143,7 +143,8 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
143
143
|
customCodeHeader: dataBuilder.customCode?.header ?? null,
|
|
144
144
|
customCodeBody: dataBuilder.customCode?.body ?? null,
|
|
145
145
|
customFonts: customFonts$1,
|
|
146
|
-
pageBackground: normalize.extractPageBackground(dataBuilder)
|
|
146
|
+
pageBackground: normalize.extractPageBackground(dataBuilder),
|
|
147
|
+
interaction: dataBuilder?.interaction
|
|
147
148
|
});
|
|
148
149
|
} catch (err) {
|
|
149
150
|
nextjs.captureException(err);
|
|
@@ -2,35 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var parse = require('html-react-parser');
|
|
5
|
-
var Script = require('next/script');
|
|
6
5
|
|
|
7
|
-
const parseHtml = (html, isHead)=>{
|
|
6
|
+
const parseHtml = (key, html, isHead)=>{
|
|
8
7
|
if (!html) return undefined;
|
|
9
8
|
try {
|
|
10
9
|
return parse(html, {
|
|
11
10
|
replace: (node)=>{
|
|
12
|
-
if (node.type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
if (!isHead) {
|
|
29
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
30
|
-
...node.attribs
|
|
31
|
-
});
|
|
11
|
+
if (node.type !== 'script' || !(node instanceof parse.Element)) return null;
|
|
12
|
+
const child = node.children?.[0];
|
|
13
|
+
if (!child) return null;
|
|
14
|
+
if (!(child instanceof parse.Text) && !isHead) return /*#__PURE__*/ jsxRuntime.jsx("script", {
|
|
15
|
+
id: key,
|
|
16
|
+
...node.attribs
|
|
17
|
+
}, key);
|
|
18
|
+
if (child instanceof parse.Text && isHead) {
|
|
19
|
+
return /*#__PURE__*/ jsxRuntime.jsx("script", {
|
|
20
|
+
id: key,
|
|
21
|
+
...node.attribs,
|
|
22
|
+
dangerouslySetInnerHTML: {
|
|
23
|
+
__html: child.data
|
|
32
24
|
}
|
|
33
|
-
}
|
|
25
|
+
}, key);
|
|
34
26
|
}
|
|
35
27
|
}
|
|
36
28
|
});
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
+
var nextSeo = require('next-seo');
|
|
7
|
+
var Head = require('next/head');
|
|
6
8
|
var react = require('react');
|
|
7
9
|
var Toolbox = require('../components/builder/Toolbox.js');
|
|
8
10
|
var Header = require('../components/builder/Header.js');
|
|
@@ -14,7 +16,7 @@ var Toolbar = require('../components/builder/Toolbar.js');
|
|
|
14
16
|
var SwitchView = require('../components/builder/SwitchView.js');
|
|
15
17
|
var Body = require('../components/builder/Body.js');
|
|
16
18
|
|
|
17
|
-
const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
|
|
19
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
|
|
18
20
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
19
21
|
const isDisableHeaderFooter = ()=>{
|
|
20
22
|
return isThemeSectionEditor;
|
|
@@ -37,19 +39,26 @@ const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType,
|
|
|
37
39
|
};
|
|
38
40
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
39
41
|
children: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
id: "global-style",
|
|
43
|
-
dangerouslySetInnerHTML: {
|
|
44
|
-
__html: themeStyle
|
|
45
|
-
}
|
|
42
|
+
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
43
|
+
...seo
|
|
46
44
|
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
46
|
+
children: [
|
|
47
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
48
|
+
type: "text/css",
|
|
49
|
+
id: "global-style",
|
|
50
|
+
dangerouslySetInnerHTML: {
|
|
51
|
+
__html: themeStyle
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
55
|
+
"data-id": "google-fonts",
|
|
56
|
+
type: "text/css",
|
|
57
|
+
dangerouslySetInnerHTML: {
|
|
58
|
+
__html: fontStyle
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
]
|
|
53
62
|
}),
|
|
54
63
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
55
64
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
@@ -5,43 +5,53 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
|
+
var nextSeo = require('next-seo');
|
|
8
9
|
var dynamic = require('next/dynamic');
|
|
9
|
-
var
|
|
10
|
+
var Head = require('next/head');
|
|
11
|
+
var router = require('next/router');
|
|
10
12
|
|
|
11
13
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
12
|
-
const CollectionDetailPage = ({ components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
|
|
14
|
+
const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
|
|
15
|
+
const router$1 = router.useRouter();
|
|
16
|
+
if (router$1.isFallback) {
|
|
17
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
18
|
+
children: "Loading..."
|
|
19
|
+
});
|
|
20
|
+
}
|
|
13
21
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14
22
|
children: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: "text/css",
|
|
18
|
-
dangerouslySetInnerHTML: {
|
|
19
|
-
__html: themeStyle
|
|
20
|
-
}
|
|
23
|
+
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
24
|
+
...seo
|
|
21
25
|
}),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
27
|
+
children: [
|
|
28
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
29
|
+
"data-id": "global-style",
|
|
30
|
+
type: "text/css",
|
|
31
|
+
dangerouslySetInnerHTML: {
|
|
32
|
+
__html: themeStyle
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
36
|
+
"data-id": "google-fonts",
|
|
37
|
+
type: "text/css",
|
|
38
|
+
dangerouslySetInnerHTML: {
|
|
39
|
+
__html: fontStyle
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
]
|
|
28
43
|
}),
|
|
29
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
children: builderData && /*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
|
|
41
|
-
state: builderData,
|
|
42
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
|
|
43
|
-
uid: "ROOT"
|
|
44
|
-
})
|
|
44
|
+
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
45
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
46
|
+
components: components,
|
|
47
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
48
|
+
data: sectionData,
|
|
49
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CollectionProvider, {
|
|
50
|
+
collection: collection,
|
|
51
|
+
children: builderData && /*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
|
|
52
|
+
state: builderData,
|
|
53
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
|
|
54
|
+
uid: "ROOT"
|
|
45
55
|
})
|
|
46
56
|
})
|
|
47
57
|
})
|
|
@@ -5,29 +5,41 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
|
+
var nextSeo = require('next-seo');
|
|
8
9
|
var dynamic = require('next/dynamic');
|
|
9
|
-
var
|
|
10
|
+
var Head = require('next/head');
|
|
11
|
+
var router = require('next/router');
|
|
10
12
|
|
|
11
13
|
const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
|
|
12
|
-
const ProductDetailPage = ({ themeStyle, fontStyle, product, components, builderData, sectionData })=>{
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const ProductDetailPage = ({ themeStyle, fontStyle, seo, product, components, builderData, sectionData })=>{
|
|
15
|
+
const router$1 = router.useRouter();
|
|
16
|
+
if (router$1.isFallback) {
|
|
17
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
15
18
|
children: "Loading..."
|
|
16
|
-
})
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
17
22
|
children: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type: "text/css",
|
|
21
|
-
dangerouslySetInnerHTML: {
|
|
22
|
-
__html: themeStyle
|
|
23
|
-
}
|
|
23
|
+
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
24
|
+
...seo
|
|
24
25
|
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
27
|
+
children: [
|
|
28
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
29
|
+
"data-id": "global-style",
|
|
30
|
+
type: "text/css",
|
|
31
|
+
dangerouslySetInnerHTML: {
|
|
32
|
+
__html: themeStyle
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
36
|
+
"data-id": "google-fonts",
|
|
37
|
+
type: "text/css",
|
|
38
|
+
dangerouslySetInnerHTML: {
|
|
39
|
+
__html: fontStyle
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
]
|
|
31
43
|
}),
|
|
32
44
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
33
45
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
@@ -1,58 +1,99 @@
|
|
|
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');
|
|
5
|
+
var nextSeo = require('next-seo');
|
|
6
|
+
var Head = require('next/head');
|
|
7
|
+
var router = require('next/router');
|
|
6
8
|
var useTrackingView = require('../libs/hooks/use-tracking-view.js');
|
|
7
9
|
var parseHtml = require('../libs/parse-html.js');
|
|
8
10
|
var Header = require('../components/builder/Header.js');
|
|
9
11
|
var FooterForPostPurchase = require('../components/FooterForPostPurchase.js');
|
|
10
12
|
var Script = require('next/script');
|
|
13
|
+
var react = require('react');
|
|
11
14
|
|
|
12
|
-
const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
|
|
15
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, dynamicDiscountOffer, isPreview, interaction, pageBackground })=>{
|
|
16
|
+
const router$1 = router.useRouter();
|
|
13
17
|
const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
|
|
14
|
-
useTrackingView.useTrackingView(shopToken, pageHandle);
|
|
18
|
+
useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
|
|
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;
|
|
15
48
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
16
49
|
children: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"data-id": "global-style",
|
|
20
|
-
type: "text/css",
|
|
21
|
-
dangerouslySetInnerHTML: {
|
|
22
|
-
__html: themeStyle
|
|
23
|
-
}
|
|
50
|
+
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
51
|
+
...seo
|
|
24
52
|
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
54
|
+
children: [
|
|
55
|
+
parseHtml.parseHtml(customCodeHeaderID, customCodeHeader, true),
|
|
56
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
57
|
+
"data-id": "global-style",
|
|
58
|
+
type: "text/css",
|
|
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
|
+
pageBackground?.isUsePageBackground && pageBackground?.background && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
85
|
+
children: `
|
|
86
|
+
body {
|
|
87
|
+
background: ${pageBackground.background};
|
|
88
|
+
}
|
|
89
|
+
`
|
|
90
|
+
}, `page_background_${pageBackground?.background}`)
|
|
91
|
+
]
|
|
31
92
|
}),
|
|
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}`),
|
|
53
93
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
54
94
|
productOffers: productOffers,
|
|
55
95
|
publicStoreFrontData: publicStoreFrontData,
|
|
96
|
+
dynamicDiscountOffer: dynamicDiscountOffer,
|
|
56
97
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
57
98
|
components: components,
|
|
58
99
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -61,7 +102,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontSt
|
|
|
61
102
|
isPostPurchase && /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
|
|
62
103
|
pageType: "POST_PURCHASE"
|
|
63
104
|
}),
|
|
64
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
105
|
+
hasInteraction && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
65
106
|
dangerouslySetInnerHTML: {
|
|
66
107
|
__html: `<div id="gp-interaction" style="display: none;">${JSON.stringify(interaction?.value || [])}</div>`
|
|
67
108
|
}
|
|
@@ -78,9 +119,8 @@ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontSt
|
|
|
78
119
|
/*#__PURE__*/ jsxRuntime.jsx(core.Render, {
|
|
79
120
|
uid: builder.uid
|
|
80
121
|
}),
|
|
81
|
-
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
122
|
+
hasInteraction && /*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
82
123
|
defer: true,
|
|
83
|
-
strategy: "lazyOnload",
|
|
84
124
|
src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
|
|
85
125
|
})
|
|
86
126
|
]
|