@gem-sdk/pages 2.0.0-staging.152 → 2.0.0-staging.159
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/Toolbox.js +11 -1
- package/dist/cjs/constants/index.js +12 -0
- package/dist/cjs/libs/api/get-home-page-props-v2.js +20 -8
- package/dist/cjs/libs/api/get-home-page-props.js +15 -3
- package/dist/cjs/libs/api/get-post-purchase-props-preview.js +38 -5
- package/dist/cjs/libs/api/get-static-page-props-v2.js +12 -8
- package/dist/cjs/libs/api/get-static-page-props.js +16 -3
- package/dist/cjs/libs/helpers/get-metafield.js +7 -0
- package/dist/cjs/pages/static-v2.js +2 -1
- package/dist/esm/components/builder/Toolbox.js +11 -1
- package/dist/esm/constants/index.js +12 -0
- package/dist/esm/libs/api/get-home-page-props-v2.js +21 -9
- package/dist/esm/libs/api/get-home-page-props.js +16 -4
- package/dist/esm/libs/api/get-post-purchase-props-preview.js +39 -6
- package/dist/esm/libs/api/get-static-page-props-v2.js +12 -8
- package/dist/esm/libs/api/get-static-page-props.js +17 -4
- package/dist/esm/libs/helpers/get-metafield.js +5 -0
- package/dist/esm/pages/static-v2.js +2 -1
- package/dist/types/index.d.ts +4 -2
- package/package.json +2 -2
|
@@ -21,6 +21,7 @@ const Toolbox = ()=>{
|
|
|
21
21
|
const changeStorefrontInfo = core.useShopStore((s)=>s.changeStorefrontInfo);
|
|
22
22
|
const setDynamicProduct = core.usePageStore((s)=>s.setDynamicProduct);
|
|
23
23
|
const setPostPurchaseProductOffers = core.usePageStore((s)=>s.setPostPurchaseProductOffers);
|
|
24
|
+
const setDynamicDiscountOffer = core.usePageStore((s)=>s.setDynamicDiscountOffer);
|
|
24
25
|
const setSalePageProductId = core.usePageStore((s)=>s.setSalePageProductId);
|
|
25
26
|
const setDynamicCollection = core.usePageStore((s)=>s.setDynamicCollection);
|
|
26
27
|
const initState = core.useBuilderPreviewStore((s)=>s.initState);
|
|
@@ -354,6 +355,13 @@ const Toolbox = ()=>{
|
|
|
354
355
|
}, [
|
|
355
356
|
setPostPurchaseProductOffers
|
|
356
357
|
]);
|
|
358
|
+
const onUpdateDynamicDiscountOffer = react.useCallback((e)=>{
|
|
359
|
+
const dynamicDiscountOffer = e.detail;
|
|
360
|
+
if (!dynamicDiscountOffer) return;
|
|
361
|
+
setDynamicDiscountOffer(dynamicDiscountOffer);
|
|
362
|
+
}, [
|
|
363
|
+
setDynamicDiscountOffer
|
|
364
|
+
]);
|
|
357
365
|
const onUpdateSalePageProductId = react.useCallback((e)=>{
|
|
358
366
|
const id = e.detail;
|
|
359
367
|
if (!id) return;
|
|
@@ -426,6 +434,7 @@ const Toolbox = ()=>{
|
|
|
426
434
|
window.addEventListener('update-item-name', onUpdateItemName);
|
|
427
435
|
window.addEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
428
436
|
window.addEventListener('set-product-offer', onUpdateProductOffers);
|
|
437
|
+
window.addEventListener('set-dynamic-discount-offer', onUpdateDynamicDiscountOffer);
|
|
429
438
|
window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
430
439
|
window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
|
|
431
440
|
window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
@@ -485,7 +494,8 @@ const Toolbox = ()=>{
|
|
|
485
494
|
onUpdateInteractionIsSelectOnPage,
|
|
486
495
|
onUpdateInteractionSettingType,
|
|
487
496
|
onUpdateFontType,
|
|
488
|
-
onChangeSidebarMode
|
|
497
|
+
onChangeSidebarMode,
|
|
498
|
+
onUpdateDynamicDiscountOffer
|
|
489
499
|
]);
|
|
490
500
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
491
501
|
className: "toolbox"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.PublishedThemePageMetafields = void 0;
|
|
4
|
+
(function(PublishedThemePageMetafields) {
|
|
5
|
+
PublishedThemePageMetafields["CUSTOM_CODE_HEADER"] = 'custom_code_header';
|
|
6
|
+
PublishedThemePageMetafields["CUSTOM_CODE_BODY"] = 'custom_code_body';
|
|
7
|
+
PublishedThemePageMetafields["ANALYTICS_GA_TRACKING_ID"] = 'analytics_ga_tracking_id';
|
|
8
|
+
PublishedThemePageMetafields["ANALYTICS_FB_PIXEL_ID"] = 'analytics_fb_pixel_id';
|
|
9
|
+
PublishedThemePageMetafields["ANALYTICS_TIKTOK_PIXEL_ID"] = 'analytics_tiktok_pixel_id';
|
|
10
|
+
PublishedThemePageMetafields["GLOBAL_META_DESCRIPTION"] = 'global-meta-description';
|
|
11
|
+
PublishedThemePageMetafields["GLOBAL_META_THUMBNAIL"] = 'global-meta-thumbnail';
|
|
12
|
+
})(exports.PublishedThemePageMetafields || (exports.PublishedThemePageMetafields = {}));
|
|
@@ -9,13 +9,15 @@ var getFallback = require('../helpers/get-fallback.js');
|
|
|
9
9
|
var normalize = require('../helpers/normalize.js');
|
|
10
10
|
var parseJson = require('../helpers/parse-json.js');
|
|
11
11
|
var nextjs = require('@sentry/nextjs');
|
|
12
|
+
var index = require('../../constants/index.js');
|
|
13
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
12
14
|
|
|
13
15
|
const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
14
16
|
try {
|
|
15
17
|
const variables = {
|
|
16
18
|
slugType: 'STATIC'
|
|
17
19
|
};
|
|
18
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
20
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
19
21
|
fetcher([
|
|
20
22
|
core.PublishedThemePagesDocument,
|
|
21
23
|
variables
|
|
@@ -25,11 +27,21 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
25
27
|
]),
|
|
26
28
|
shopifyFetcher([
|
|
27
29
|
adapterShopify.ShopMetaDocument
|
|
30
|
+
]),
|
|
31
|
+
fetcher([
|
|
32
|
+
core.PublishedShopMetasDocument,
|
|
33
|
+
{
|
|
34
|
+
keys: [
|
|
35
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
36
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
37
|
+
]
|
|
38
|
+
}
|
|
28
39
|
])
|
|
29
40
|
]);
|
|
30
41
|
if (theme.status === 'rejected') {
|
|
31
42
|
throw new Error(theme.reason?.[0]);
|
|
32
43
|
}
|
|
44
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
33
45
|
const dataBuilder = theme.value?.publishedThemePages?.[0];
|
|
34
46
|
if (!dataBuilder) {
|
|
35
47
|
throw new Error(`No data builder found for Home page`);
|
|
@@ -41,8 +53,8 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
41
53
|
getFallback.getFallbackV2(fetcher, homeTemplate)
|
|
42
54
|
]);
|
|
43
55
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
44
|
-
const description = dataBuilder?.
|
|
45
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
56
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
57
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
46
58
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
47
59
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
48
60
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -129,11 +141,11 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
129
141
|
swatches: parseJson.parseJson(shopData?.storeProperty?.swatchesConfig),
|
|
130
142
|
seo,
|
|
131
143
|
mobileOnly,
|
|
132
|
-
gaTrackingId: dataBuilder
|
|
133
|
-
facebookPixelId: dataBuilder
|
|
134
|
-
tiktokPixelId: dataBuilder
|
|
135
|
-
customCodeHeader: dataBuilder
|
|
136
|
-
customCodeBody: dataBuilder
|
|
144
|
+
gaTrackingId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
|
|
145
|
+
facebookPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
146
|
+
tiktokPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
147
|
+
customCodeHeader: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
|
|
148
|
+
customCodeBody: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
|
|
137
149
|
pageHandle: dataBuilder.handle ?? null
|
|
138
150
|
});
|
|
139
151
|
} catch (err) {
|
|
@@ -7,6 +7,8 @@ var genCss = require('../helpers/gen-css.js');
|
|
|
7
7
|
var generateManifres = require('../helpers/generate-manifres.js');
|
|
8
8
|
var normalize = require('../helpers/normalize.js');
|
|
9
9
|
var parseJson = require('../helpers/parse-json.js');
|
|
10
|
+
var index = require('../../constants/index.js');
|
|
11
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
10
12
|
|
|
11
13
|
const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
12
14
|
const pageType = 'STATIC';
|
|
@@ -17,7 +19,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
17
19
|
// PublishedThemePagesDocument,
|
|
18
20
|
// variables,
|
|
19
21
|
// ]);
|
|
20
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
22
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
21
23
|
fetcher([
|
|
22
24
|
core.PublishedThemePagesDocument,
|
|
23
25
|
variables
|
|
@@ -27,6 +29,15 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
27
29
|
]),
|
|
28
30
|
shopifyFetcher([
|
|
29
31
|
adapterShopify.ShopMetaDocument
|
|
32
|
+
]),
|
|
33
|
+
fetcher([
|
|
34
|
+
core.PublishedShopMetasDocument,
|
|
35
|
+
{
|
|
36
|
+
keys: [
|
|
37
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
38
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
39
|
+
]
|
|
40
|
+
}
|
|
30
41
|
])
|
|
31
42
|
]);
|
|
32
43
|
if (theme.status === 'rejected') {
|
|
@@ -34,6 +45,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
34
45
|
pageType
|
|
35
46
|
};
|
|
36
47
|
}
|
|
48
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
37
49
|
const dataBuilder = theme.value.publishedThemePages?.[0];
|
|
38
50
|
const homeTemplate = normalize.parseBuilderTemplate(dataBuilder);
|
|
39
51
|
const fontStyle = await googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
@@ -58,8 +70,8 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
58
70
|
}
|
|
59
71
|
return acc;
|
|
60
72
|
}, {});
|
|
61
|
-
const description = dataBuilder?.
|
|
62
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
73
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
74
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
63
75
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
64
76
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
65
77
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -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);
|
|
@@ -10,6 +10,8 @@ var normalize = require('../helpers/normalize.js');
|
|
|
10
10
|
var parseJson = require('../helpers/parse-json.js');
|
|
11
11
|
var nextjs = require('@sentry/nextjs');
|
|
12
12
|
var customFonts = require('../custom-fonts.js');
|
|
13
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
14
|
+
var index = require('../../constants/index.js');
|
|
13
15
|
|
|
14
16
|
const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
15
17
|
try {
|
|
@@ -33,7 +35,9 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
33
35
|
core.PublishedShopMetasDocument,
|
|
34
36
|
{
|
|
35
37
|
keys: [
|
|
36
|
-
'source_font'
|
|
38
|
+
'source_font',
|
|
39
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
40
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
37
41
|
]
|
|
38
42
|
}
|
|
39
43
|
])
|
|
@@ -56,8 +60,8 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
56
60
|
customFonts.getCustomFonts(themePageCustomFonts)
|
|
57
61
|
]);
|
|
58
62
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
59
|
-
const description = dataBuilder?.
|
|
60
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
63
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
64
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
61
65
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
62
66
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
63
67
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -145,11 +149,11 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
145
149
|
swatches: parseJson.parseJson(shopData?.storeProperty?.swatchesConfig),
|
|
146
150
|
seo,
|
|
147
151
|
mobileOnly,
|
|
148
|
-
gaTrackingId: dataBuilder
|
|
149
|
-
facebookPixelId: dataBuilder
|
|
150
|
-
tiktokPixelId: dataBuilder
|
|
151
|
-
customCodeHeader: dataBuilder
|
|
152
|
-
customCodeBody: dataBuilder
|
|
152
|
+
gaTrackingId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
|
|
153
|
+
facebookPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
154
|
+
tiktokPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
155
|
+
customCodeHeader: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
|
|
156
|
+
customCodeBody: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
|
|
153
157
|
pageHandle: dataBuilder.handle ?? null,
|
|
154
158
|
customFonts: customFonts$1,
|
|
155
159
|
interaction: dataBuilder?.interaction,
|
|
@@ -7,6 +7,8 @@ var genCss = require('../helpers/gen-css.js');
|
|
|
7
7
|
var generateManifres = require('../helpers/generate-manifres.js');
|
|
8
8
|
var normalize = require('../helpers/normalize.js');
|
|
9
9
|
var parseJson = require('../helpers/parse-json.js');
|
|
10
|
+
var index = require('../../constants/index.js');
|
|
11
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
10
12
|
|
|
11
13
|
const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
12
14
|
const pageType = 'STATIC';
|
|
@@ -14,7 +16,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
14
16
|
slug,
|
|
15
17
|
slugType: pageType
|
|
16
18
|
};
|
|
17
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
19
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
18
20
|
fetcher([
|
|
19
21
|
core.PublishedThemePagesDocument,
|
|
20
22
|
variables
|
|
@@ -24,6 +26,16 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
24
26
|
]),
|
|
25
27
|
shopifyFetcher([
|
|
26
28
|
adapterShopify.ShopMetaDocument
|
|
29
|
+
]),
|
|
30
|
+
fetcher([
|
|
31
|
+
core.PublishedShopMetasDocument,
|
|
32
|
+
{
|
|
33
|
+
keys: [
|
|
34
|
+
'source_font',
|
|
35
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
36
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
37
|
+
]
|
|
38
|
+
}
|
|
27
39
|
])
|
|
28
40
|
]);
|
|
29
41
|
if (theme.status === 'rejected') {
|
|
@@ -31,6 +43,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
31
43
|
pageType
|
|
32
44
|
};
|
|
33
45
|
}
|
|
46
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
34
47
|
const dataBuilder = theme.value.publishedThemePages?.[0];
|
|
35
48
|
const pageTemplate = normalize.parseBuilderTemplate(dataBuilder);
|
|
36
49
|
const fontStyle = await googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
@@ -55,8 +68,8 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
55
68
|
}
|
|
56
69
|
return acc;
|
|
57
70
|
}, {});
|
|
58
|
-
const description = dataBuilder?.
|
|
59
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
71
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
72
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
60
73
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
61
74
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
62
75
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -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, pageBackground })=>{
|
|
15
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, dynamicDiscountOffer, isPreview, interaction, pageBackground })=>{
|
|
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);
|
|
@@ -93,6 +93,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
93
93
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
94
94
|
productOffers: productOffers,
|
|
95
95
|
publicStoreFrontData: publicStoreFrontData,
|
|
96
|
+
dynamicDiscountOffer: dynamicDiscountOffer,
|
|
96
97
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
97
98
|
components: components,
|
|
98
99
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -17,6 +17,7 @@ const Toolbox = ()=>{
|
|
|
17
17
|
const changeStorefrontInfo = useShopStore((s)=>s.changeStorefrontInfo);
|
|
18
18
|
const setDynamicProduct = usePageStore((s)=>s.setDynamicProduct);
|
|
19
19
|
const setPostPurchaseProductOffers = usePageStore((s)=>s.setPostPurchaseProductOffers);
|
|
20
|
+
const setDynamicDiscountOffer = usePageStore((s)=>s.setDynamicDiscountOffer);
|
|
20
21
|
const setSalePageProductId = usePageStore((s)=>s.setSalePageProductId);
|
|
21
22
|
const setDynamicCollection = usePageStore((s)=>s.setDynamicCollection);
|
|
22
23
|
const initState = useBuilderPreviewStore((s)=>s.initState);
|
|
@@ -350,6 +351,13 @@ const Toolbox = ()=>{
|
|
|
350
351
|
}, [
|
|
351
352
|
setPostPurchaseProductOffers
|
|
352
353
|
]);
|
|
354
|
+
const onUpdateDynamicDiscountOffer = useCallback((e)=>{
|
|
355
|
+
const dynamicDiscountOffer = e.detail;
|
|
356
|
+
if (!dynamicDiscountOffer) return;
|
|
357
|
+
setDynamicDiscountOffer(dynamicDiscountOffer);
|
|
358
|
+
}, [
|
|
359
|
+
setDynamicDiscountOffer
|
|
360
|
+
]);
|
|
353
361
|
const onUpdateSalePageProductId = useCallback((e)=>{
|
|
354
362
|
const id = e.detail;
|
|
355
363
|
if (!id) return;
|
|
@@ -422,6 +430,7 @@ const Toolbox = ()=>{
|
|
|
422
430
|
window.addEventListener('update-item-name', onUpdateItemName);
|
|
423
431
|
window.addEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
424
432
|
window.addEventListener('set-product-offer', onUpdateProductOffers);
|
|
433
|
+
window.addEventListener('set-dynamic-discount-offer', onUpdateDynamicDiscountOffer);
|
|
425
434
|
window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
426
435
|
window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
|
|
427
436
|
window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
@@ -481,7 +490,8 @@ const Toolbox = ()=>{
|
|
|
481
490
|
onUpdateInteractionIsSelectOnPage,
|
|
482
491
|
onUpdateInteractionSettingType,
|
|
483
492
|
onUpdateFontType,
|
|
484
|
-
onChangeSidebarMode
|
|
493
|
+
onChangeSidebarMode,
|
|
494
|
+
onUpdateDynamicDiscountOffer
|
|
485
495
|
]);
|
|
486
496
|
return /*#__PURE__*/ jsx("div", {
|
|
487
497
|
className: "toolbox"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var PublishedThemePageMetafields;
|
|
2
|
+
(function(PublishedThemePageMetafields) {
|
|
3
|
+
PublishedThemePageMetafields["CUSTOM_CODE_HEADER"] = 'custom_code_header';
|
|
4
|
+
PublishedThemePageMetafields["CUSTOM_CODE_BODY"] = 'custom_code_body';
|
|
5
|
+
PublishedThemePageMetafields["ANALYTICS_GA_TRACKING_ID"] = 'analytics_ga_tracking_id';
|
|
6
|
+
PublishedThemePageMetafields["ANALYTICS_FB_PIXEL_ID"] = 'analytics_fb_pixel_id';
|
|
7
|
+
PublishedThemePageMetafields["ANALYTICS_TIKTOK_PIXEL_ID"] = 'analytics_tiktok_pixel_id';
|
|
8
|
+
PublishedThemePageMetafields["GLOBAL_META_DESCRIPTION"] = 'global-meta-description';
|
|
9
|
+
PublishedThemePageMetafields["GLOBAL_META_THUMBNAIL"] = 'global-meta-thumbnail';
|
|
10
|
+
})(PublishedThemePageMetafields || (PublishedThemePageMetafields = {}));
|
|
11
|
+
|
|
12
|
+
export { PublishedThemePageMetafields };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublishedThemePagesDocument, StorePropertyDocument } from '@gem-sdk/core';
|
|
1
|
+
import { PublishedThemePagesDocument, StorePropertyDocument, PublishedShopMetasDocument } from '@gem-sdk/core';
|
|
2
2
|
import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
|
|
3
3
|
import { getFontStyleFromPageTemplate, getFontFromGlobalStyle } from '../google-fonts.js';
|
|
4
4
|
import { genCSS } from '../helpers/gen-css.js';
|
|
@@ -7,13 +7,15 @@ import { getFallbackV2 } from '../helpers/get-fallback.js';
|
|
|
7
7
|
import { parseBuilderTemplateV2 } from '../helpers/normalize.js';
|
|
8
8
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
9
9
|
import { captureException } from '@sentry/nextjs';
|
|
10
|
+
import { PublishedThemePageMetafields } from '../../constants/index.js';
|
|
11
|
+
import { getPublishedThemePageMetafieldByKey } from '../helpers/get-metafield.js';
|
|
10
12
|
|
|
11
13
|
const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
12
14
|
try {
|
|
13
15
|
const variables = {
|
|
14
16
|
slugType: 'STATIC'
|
|
15
17
|
};
|
|
16
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
18
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
17
19
|
fetcher([
|
|
18
20
|
PublishedThemePagesDocument,
|
|
19
21
|
variables
|
|
@@ -23,11 +25,21 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
23
25
|
]),
|
|
24
26
|
shopifyFetcher([
|
|
25
27
|
ShopMetaDocument
|
|
28
|
+
]),
|
|
29
|
+
fetcher([
|
|
30
|
+
PublishedShopMetasDocument,
|
|
31
|
+
{
|
|
32
|
+
keys: [
|
|
33
|
+
PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
34
|
+
PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
35
|
+
]
|
|
36
|
+
}
|
|
26
37
|
])
|
|
27
38
|
]);
|
|
28
39
|
if (theme.status === 'rejected') {
|
|
29
40
|
throw new Error(theme.reason?.[0]);
|
|
30
41
|
}
|
|
42
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
31
43
|
const dataBuilder = theme.value?.publishedThemePages?.[0];
|
|
32
44
|
if (!dataBuilder) {
|
|
33
45
|
throw new Error(`No data builder found for Home page`);
|
|
@@ -39,8 +51,8 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
39
51
|
getFallbackV2(fetcher, homeTemplate)
|
|
40
52
|
]);
|
|
41
53
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
42
|
-
const description = dataBuilder?.
|
|
43
|
-
const thumbnail = parseJson(dataBuilder?.
|
|
54
|
+
const description = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
55
|
+
const thumbnail = parseJson(getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
44
56
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
45
57
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
46
58
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -127,11 +139,11 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
127
139
|
swatches: parseJson(shopData?.storeProperty?.swatchesConfig),
|
|
128
140
|
seo,
|
|
129
141
|
mobileOnly,
|
|
130
|
-
gaTrackingId: dataBuilder
|
|
131
|
-
facebookPixelId: dataBuilder
|
|
132
|
-
tiktokPixelId: dataBuilder
|
|
133
|
-
customCodeHeader: dataBuilder
|
|
134
|
-
customCodeBody: dataBuilder
|
|
142
|
+
gaTrackingId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
|
|
143
|
+
facebookPixelId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
144
|
+
tiktokPixelId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
145
|
+
customCodeHeader: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
|
|
146
|
+
customCodeBody: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
|
|
135
147
|
pageHandle: dataBuilder.handle ?? null
|
|
136
148
|
});
|
|
137
149
|
} catch (err) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { PublishedThemePagesDocument, StorePropertyDocument, prefetchQueries } from '@gem-sdk/core';
|
|
1
|
+
import { PublishedThemePagesDocument, StorePropertyDocument, PublishedShopMetasDocument, prefetchQueries } from '@gem-sdk/core';
|
|
2
2
|
import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
|
|
3
3
|
import { getFontFromGlobalStyle } from '../google-fonts.js';
|
|
4
4
|
import { genCSS } from '../helpers/gen-css.js';
|
|
5
5
|
import { generateManifest } from '../helpers/generate-manifres.js';
|
|
6
6
|
import { parseBuilderTemplate } from '../helpers/normalize.js';
|
|
7
7
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
8
|
+
import { PublishedThemePageMetafields } from '../../constants/index.js';
|
|
9
|
+
import { getPublishedThemePageMetafieldByKey } from '../helpers/get-metafield.js';
|
|
8
10
|
|
|
9
11
|
const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
10
12
|
const pageType = 'STATIC';
|
|
@@ -15,7 +17,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
15
17
|
// PublishedThemePagesDocument,
|
|
16
18
|
// variables,
|
|
17
19
|
// ]);
|
|
18
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
20
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
19
21
|
fetcher([
|
|
20
22
|
PublishedThemePagesDocument,
|
|
21
23
|
variables
|
|
@@ -25,6 +27,15 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
25
27
|
]),
|
|
26
28
|
shopifyFetcher([
|
|
27
29
|
ShopMetaDocument
|
|
30
|
+
]),
|
|
31
|
+
fetcher([
|
|
32
|
+
PublishedShopMetasDocument,
|
|
33
|
+
{
|
|
34
|
+
keys: [
|
|
35
|
+
PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
36
|
+
PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
37
|
+
]
|
|
38
|
+
}
|
|
28
39
|
])
|
|
29
40
|
]);
|
|
30
41
|
if (theme.status === 'rejected') {
|
|
@@ -32,6 +43,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
32
43
|
pageType
|
|
33
44
|
};
|
|
34
45
|
}
|
|
46
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
35
47
|
const dataBuilder = theme.value.publishedThemePages?.[0];
|
|
36
48
|
const homeTemplate = parseBuilderTemplate(dataBuilder);
|
|
37
49
|
const fontStyle = await getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
@@ -56,8 +68,8 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
56
68
|
}
|
|
57
69
|
return acc;
|
|
58
70
|
}, {});
|
|
59
|
-
const description = dataBuilder?.
|
|
60
|
-
const thumbnail = parseJson(dataBuilder?.
|
|
71
|
+
const description = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
72
|
+
const thumbnail = parseJson(getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
61
73
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
62
74
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
63
75
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ThemePageDocument, StorePropertyDocument, SaleFunnelDiscountsDocument, LibraryTemplateDocument, LibrarySaleFunnelDocument, ShopLibraryPageDocument } from '@gem-sdk/core';
|
|
1
|
+
import { ThemePageDocument, StorePropertyDocument, SaleFunnelDiscountsDocument, SaleFunnelOfferDocument, LibraryTemplateDocument, LibrarySaleFunnelDocument, ShopLibraryPageDocument } from '@gem-sdk/core';
|
|
2
2
|
import { captureException } from '@sentry/nextjs';
|
|
3
3
|
import { getFontStyleFromPageTemplate, getFontFromGlobalStyle } from '../google-fonts.js';
|
|
4
4
|
import { getFallbackV2 } from '../helpers/get-fallback.js';
|
|
@@ -31,6 +31,7 @@ const fetchSalePageDataByID = async (data, fetcher)=>{
|
|
|
31
31
|
dataBuilder: theme.value.themePage,
|
|
32
32
|
pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
|
|
33
33
|
storeProperty,
|
|
34
|
+
dynamicDiscountOffer: undefined,
|
|
34
35
|
productOffers: []
|
|
35
36
|
};
|
|
36
37
|
};
|
|
@@ -42,7 +43,7 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
42
43
|
default: true
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
|
-
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
46
|
+
const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
|
|
46
47
|
fetcher([
|
|
47
48
|
ThemePageDocument,
|
|
48
49
|
variables
|
|
@@ -57,6 +58,12 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
57
58
|
saleFunnelOfferID: data.currentOfferID
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
]),
|
|
62
|
+
fetcher([
|
|
63
|
+
SaleFunnelOfferDocument,
|
|
64
|
+
{
|
|
65
|
+
saleFunnelOfferId: data.currentOfferID
|
|
66
|
+
}
|
|
60
67
|
])
|
|
61
68
|
]);
|
|
62
69
|
if (theme.status === 'rejected') {
|
|
@@ -65,10 +72,14 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
65
72
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
66
73
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
67
74
|
}
|
|
75
|
+
if (saleFunnelOffer.status === 'rejected') {
|
|
76
|
+
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
77
|
+
}
|
|
68
78
|
return {
|
|
69
79
|
dataBuilder: theme.value.themePage,
|
|
70
80
|
pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
|
|
71
81
|
storeProperty,
|
|
82
|
+
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
72
83
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
73
84
|
};
|
|
74
85
|
};
|
|
@@ -114,6 +125,7 @@ const fetchThemePageDataByTemplateID = async (data, fetcher)=>{
|
|
|
114
125
|
dataBuilder: theme.value.libraryTemplate,
|
|
115
126
|
pageStyle: undefined,
|
|
116
127
|
storeProperty,
|
|
128
|
+
dynamicDiscountOffer: undefined,
|
|
117
129
|
productOffers: productOffers
|
|
118
130
|
};
|
|
119
131
|
};
|
|
@@ -121,7 +133,7 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
121
133
|
const variables = {
|
|
122
134
|
shopLibraryPageId: data.shopLibraryPageId
|
|
123
135
|
};
|
|
124
|
-
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
136
|
+
const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
|
|
125
137
|
fetcher([
|
|
126
138
|
ShopLibraryPageDocument,
|
|
127
139
|
variables
|
|
@@ -136,6 +148,12 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
136
148
|
saleFunnelOfferID: data.currentOfferID
|
|
137
149
|
}
|
|
138
150
|
}
|
|
151
|
+
]),
|
|
152
|
+
fetcher([
|
|
153
|
+
SaleFunnelOfferDocument,
|
|
154
|
+
{
|
|
155
|
+
saleFunnelOfferId: data.currentOfferID
|
|
156
|
+
}
|
|
139
157
|
])
|
|
140
158
|
]);
|
|
141
159
|
if (theme.status === 'rejected') {
|
|
@@ -144,10 +162,14 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
144
162
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
145
163
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
146
164
|
}
|
|
165
|
+
if (saleFunnelOffer.status === 'rejected') {
|
|
166
|
+
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
167
|
+
}
|
|
147
168
|
return {
|
|
148
169
|
dataBuilder: theme.value.shopLibraryPage,
|
|
149
170
|
pageStyle: undefined,
|
|
150
171
|
storeProperty,
|
|
172
|
+
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
151
173
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
152
174
|
};
|
|
153
175
|
};
|
|
@@ -155,7 +177,7 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
155
177
|
const variables = {
|
|
156
178
|
libraryTemplateId: data.libraryTemplateId
|
|
157
179
|
};
|
|
158
|
-
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
180
|
+
const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
|
|
159
181
|
fetcher([
|
|
160
182
|
LibraryTemplateDocument,
|
|
161
183
|
variables
|
|
@@ -170,6 +192,12 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
170
192
|
saleFunnelOfferID: data.currentOfferID
|
|
171
193
|
}
|
|
172
194
|
}
|
|
195
|
+
]),
|
|
196
|
+
fetcher([
|
|
197
|
+
SaleFunnelOfferDocument,
|
|
198
|
+
{
|
|
199
|
+
saleFunnelOfferId: data.currentOfferID
|
|
200
|
+
}
|
|
173
201
|
])
|
|
174
202
|
]);
|
|
175
203
|
if (theme.status === 'rejected') {
|
|
@@ -178,10 +206,14 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
178
206
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
179
207
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
180
208
|
}
|
|
209
|
+
if (saleFunnelOffer.status === 'rejected') {
|
|
210
|
+
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
211
|
+
}
|
|
181
212
|
return {
|
|
182
213
|
dataBuilder: theme.value.libraryTemplate,
|
|
183
214
|
pageStyle: undefined,
|
|
184
215
|
storeProperty,
|
|
216
|
+
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
185
217
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
186
218
|
};
|
|
187
219
|
};
|
|
@@ -219,7 +251,7 @@ const getRelevantPageData = async (data)=>{
|
|
|
219
251
|
const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFetcher)=>async (data)=>{
|
|
220
252
|
try {
|
|
221
253
|
const { id, currentOfferID, isLibraryTemplate, isShopLibraryPage } = data;
|
|
222
|
-
const { dataBuilder, storeProperty, productOffers, pageStyle } = await getRelevantPageData({
|
|
254
|
+
const { dataBuilder, storeProperty, productOffers, pageStyle, dynamicDiscountOffer } = await getRelevantPageData({
|
|
223
255
|
id,
|
|
224
256
|
currentOfferID,
|
|
225
257
|
fetcher,
|
|
@@ -248,7 +280,8 @@ const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFet
|
|
|
248
280
|
swr: {
|
|
249
281
|
fallback
|
|
250
282
|
},
|
|
251
|
-
productOffers
|
|
283
|
+
productOffers,
|
|
284
|
+
dynamicDiscountOffer
|
|
252
285
|
});
|
|
253
286
|
} catch (err) {
|
|
254
287
|
console.log('error', err);
|
|
@@ -8,6 +8,8 @@ import { parseBuilderTemplateV2, extractPageBackground } from '../helpers/normal
|
|
|
8
8
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
9
9
|
import { captureException } from '@sentry/nextjs';
|
|
10
10
|
import { getCustomFonts } from '../custom-fonts.js';
|
|
11
|
+
import { getPublishedThemePageMetafieldByKey } from '../helpers/get-metafield.js';
|
|
12
|
+
import { PublishedThemePageMetafields } from '../../constants/index.js';
|
|
11
13
|
|
|
12
14
|
const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
13
15
|
try {
|
|
@@ -31,7 +33,9 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
31
33
|
PublishedShopMetasDocument,
|
|
32
34
|
{
|
|
33
35
|
keys: [
|
|
34
|
-
'source_font'
|
|
36
|
+
'source_font',
|
|
37
|
+
PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
38
|
+
PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
35
39
|
]
|
|
36
40
|
}
|
|
37
41
|
])
|
|
@@ -54,8 +58,8 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
54
58
|
getCustomFonts(themePageCustomFonts)
|
|
55
59
|
]);
|
|
56
60
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
57
|
-
const description = dataBuilder?.
|
|
58
|
-
const thumbnail = parseJson(dataBuilder?.
|
|
61
|
+
const description = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
62
|
+
const thumbnail = parseJson(getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
59
63
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
60
64
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
61
65
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -143,11 +147,11 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
143
147
|
swatches: parseJson(shopData?.storeProperty?.swatchesConfig),
|
|
144
148
|
seo,
|
|
145
149
|
mobileOnly,
|
|
146
|
-
gaTrackingId: dataBuilder
|
|
147
|
-
facebookPixelId: dataBuilder
|
|
148
|
-
tiktokPixelId: dataBuilder
|
|
149
|
-
customCodeHeader: dataBuilder
|
|
150
|
-
customCodeBody: dataBuilder
|
|
150
|
+
gaTrackingId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
|
|
151
|
+
facebookPixelId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
152
|
+
tiktokPixelId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
153
|
+
customCodeHeader: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
|
|
154
|
+
customCodeBody: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
|
|
151
155
|
pageHandle: dataBuilder.handle ?? null,
|
|
152
156
|
customFonts,
|
|
153
157
|
interaction: dataBuilder?.interaction,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { PublishedThemePagesDocument, StorePropertyDocument, prefetchQueries } from '@gem-sdk/core';
|
|
1
|
+
import { PublishedThemePagesDocument, StorePropertyDocument, PublishedShopMetasDocument, prefetchQueries } from '@gem-sdk/core';
|
|
2
2
|
import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
|
|
3
3
|
import { getFontFromGlobalStyle } from '../google-fonts.js';
|
|
4
4
|
import { genCSS } from '../helpers/gen-css.js';
|
|
5
5
|
import { generateManifest } from '../helpers/generate-manifres.js';
|
|
6
6
|
import { parseBuilderTemplate } from '../helpers/normalize.js';
|
|
7
7
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
8
|
+
import { PublishedThemePageMetafields } from '../../constants/index.js';
|
|
9
|
+
import { getPublishedThemePageMetafieldByKey } from '../helpers/get-metafield.js';
|
|
8
10
|
|
|
9
11
|
const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
10
12
|
const pageType = 'STATIC';
|
|
@@ -12,7 +14,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
12
14
|
slug,
|
|
13
15
|
slugType: pageType
|
|
14
16
|
};
|
|
15
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
17
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
16
18
|
fetcher([
|
|
17
19
|
PublishedThemePagesDocument,
|
|
18
20
|
variables
|
|
@@ -22,6 +24,16 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
22
24
|
]),
|
|
23
25
|
shopifyFetcher([
|
|
24
26
|
ShopMetaDocument
|
|
27
|
+
]),
|
|
28
|
+
fetcher([
|
|
29
|
+
PublishedShopMetasDocument,
|
|
30
|
+
{
|
|
31
|
+
keys: [
|
|
32
|
+
'source_font',
|
|
33
|
+
PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
34
|
+
PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
35
|
+
]
|
|
36
|
+
}
|
|
25
37
|
])
|
|
26
38
|
]);
|
|
27
39
|
if (theme.status === 'rejected') {
|
|
@@ -29,6 +41,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
29
41
|
pageType
|
|
30
42
|
};
|
|
31
43
|
}
|
|
44
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
32
45
|
const dataBuilder = theme.value.publishedThemePages?.[0];
|
|
33
46
|
const pageTemplate = parseBuilderTemplate(dataBuilder);
|
|
34
47
|
const fontStyle = await getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
@@ -53,8 +66,8 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
53
66
|
}
|
|
54
67
|
return acc;
|
|
55
68
|
}, {});
|
|
56
|
-
const description = dataBuilder?.
|
|
57
|
-
const thumbnail = parseJson(dataBuilder?.
|
|
69
|
+
const description = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
70
|
+
const thumbnail = parseJson(getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
58
71
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
59
72
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
60
73
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -10,7 +10,7 @@ import FooterForPostPurchase from '../components/FooterForPostPurchase.js';
|
|
|
10
10
|
import Script from 'next/script';
|
|
11
11
|
import { useEffect } from 'react';
|
|
12
12
|
|
|
13
|
-
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
|
|
13
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, dynamicDiscountOffer, isPreview, interaction, pageBackground })=>{
|
|
14
14
|
const router = useRouter();
|
|
15
15
|
const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
|
|
16
16
|
useTrackingView(shopToken, pageHandle, router.isFallback);
|
|
@@ -91,6 +91,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
91
91
|
/*#__PURE__*/ jsx(PageProvider, {
|
|
92
92
|
productOffers: productOffers,
|
|
93
93
|
publicStoreFrontData: publicStoreFrontData,
|
|
94
|
+
dynamicDiscountOffer: dynamicDiscountOffer,
|
|
94
95
|
children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
|
|
95
96
|
components: components,
|
|
96
97
|
children: /*#__PURE__*/ jsxs("div", {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as next_seo from 'next-seo';
|
|
|
4
4
|
import { NextSeoProps } from 'next-seo';
|
|
5
5
|
import { AppProps } from 'next/app';
|
|
6
6
|
import { SWRConfig } from 'swr';
|
|
7
|
+
import { OfferDynamicDiscount } from '@gem-sdk/core/src/types/appAPI';
|
|
7
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
9
|
import { ShopMetaQueryResponse } from '@gem-sdk/adapter-shopify';
|
|
9
10
|
import * as react from 'react';
|
|
@@ -94,6 +95,7 @@ type StaticPagePropsV2 = PageBuilderPropsV2 & {
|
|
|
94
95
|
isPostPurchase?: boolean;
|
|
95
96
|
shopName?: string;
|
|
96
97
|
productOffers?: ProductOffer[];
|
|
98
|
+
dynamicDiscountOffer?: OfferDynamicDiscount;
|
|
97
99
|
publicStoreFrontData?: PublicStoreFrontData | null;
|
|
98
100
|
isPreview?: boolean;
|
|
99
101
|
};
|
|
@@ -123,8 +125,8 @@ declare const usePagePreview: (dataBuilder: ThemePageQueryResponse['themePage'],
|
|
|
123
125
|
pageConfig: {
|
|
124
126
|
mobileOnly: boolean;
|
|
125
127
|
locale: string | null;
|
|
126
|
-
languageIsoCode: ("ID" | "AF" | "AM" | "AR" | "AZ" | "BE" | "BG" | "BM" | "BN" | "BO" | "BR" | "BS" | "CA" | "CU" | "CY" | "DE" | "DZ" | "EE" | "ES" | "ET" | "FI" | "FO" | "FR" | "GA" | "GD" | "GL" | "HR" | "HU" | "IS" | "IT" | "KI" | "KM" | "KN" | "KW" | "KY" | "LA" | "LB" | "
|
|
127
|
-
countryIsoCode: ("ID" | "AC" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AN" | "AO" | "AR" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "
|
|
128
|
+
languageIsoCode: ("ID" | "LT" | "AF" | "AM" | "AR" | "AZ" | "BE" | "BG" | "BM" | "BN" | "BO" | "BR" | "BS" | "CA" | "CU" | "CY" | "DE" | "DZ" | "EE" | "ES" | "ET" | "FI" | "FO" | "FR" | "GA" | "GD" | "GL" | "HR" | "HU" | "IS" | "IT" | "KI" | "KM" | "KN" | "KW" | "KY" | "LA" | "LB" | "LU" | "LV" | "MG" | "MK" | "ML" | "MN" | "MO" | "MR" | "MS" | "MT" | "MY" | "NE" | "NL" | "NO" | "OM" | "PA" | "PL" | "PS" | "PT" | "RO" | "RU" | "RW" | "SA" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SK" | "SL" | "SN" | "SO" | "SR" | "SV" | "TA" | "TG" | "TH" | "TK" | "TO" | "TR" | "TT" | "UG" | "UZ" | "AK" | "AS" | "CE" | "CKB" | "CS" | "DA" | "EL" | "EN" | "EO" | "EU" | "FA" | "FF" | "FIL" | "FY" | "GU" | "GV" | "HA" | "HE" | "HI" | "HY" | "IA" | "IG" | "II" | "JA" | "JV" | "KA" | "KK" | "KL" | "KO" | "KS" | "KU" | "LG" | "LN" | "LO" | "MI" | "NB" | "ND" | "NN" | "OR" | "OS" | "PT_BR" | "PT_PT" | "QU" | "RM" | "RN" | "SQ" | "SU" | "SW" | "TE" | "TI" | "UK" | "UR" | "VI" | "VO" | "WO" | "XH" | "YI" | "YO" | "ZH" | "ZH_CN" | "ZH_TW" | "ZU") | null;
|
|
129
|
+
countryIsoCode: ("ID" | "GT" | "LT" | "AC" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AN" | "AO" | "AR" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MK" | "ML" | "MM" | "MN" | "MO" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PS" | "PT" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TA" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VN" | "VU" | "WF" | "WS" | "XK" | "YE" | "YT" | "ZA" | "ZM" | "ZW" | "ZZ") | null;
|
|
128
130
|
moneyFormat: string | null;
|
|
129
131
|
currency: ("AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BYR" | "BZD" | "CAD" | "CDF" | "CHF" | "CLP" | "CNY" | "COP" | "CRC" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JEP" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KID" | "KMF" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LTL" | "LVL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "SSP" | "STD" | "STN" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "UYU" | "UZS" | "VED" | "VEF" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "XXX" | "YER" | "ZAR" | "ZMW") | null;
|
|
130
132
|
swatches: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "2.0.0-staging.
|
|
3
|
+
"version": "2.0.0-staging.159",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"next": "latest"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "2.0.0-staging.
|
|
29
|
+
"@gem-sdk/core": "2.0.0-staging.160",
|
|
30
30
|
"@gem-sdk/plugin-cookie-bar": "1.58.0-staging.25",
|
|
31
31
|
"@gem-sdk/plugin-quick-view": "1.58.0-staging.25",
|
|
32
32
|
"@gem-sdk/plugin-sticky-add-to-cart": "1.58.0-staging.25"
|