@gem-sdk/pages 2.1.13-staging.4 → 2.1.15
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 +1 -11
- package/dist/cjs/components/image-to-layout/DropElement.js +8 -27
- package/dist/cjs/libs/api/get-post-purchase-props-preview.js +5 -38
- package/dist/cjs/pages/static-v2.js +1 -2
- package/dist/esm/components/builder/Toolbox.js +1 -11
- package/dist/esm/components/image-to-layout/DropElement.js +8 -27
- package/dist/esm/libs/api/get-post-purchase-props-preview.js +6 -39
- package/dist/esm/pages/static-v2.js +1 -2
- package/dist/types/index.d.ts +0 -2
- package/package.json +2 -2
|
@@ -20,7 +20,6 @@ const Toolbox = ()=>{
|
|
|
20
20
|
const changeStorefrontInfo = core.useShopStore((s)=>s.changeStorefrontInfo);
|
|
21
21
|
const setDynamicProduct = core.usePageStore((s)=>s.setDynamicProduct);
|
|
22
22
|
const setPostPurchaseProductOffers = core.usePageStore((s)=>s.setPostPurchaseProductOffers);
|
|
23
|
-
const setDynamicDiscountOffer = core.usePageStore((s)=>s.setDynamicDiscountOffer);
|
|
24
23
|
const setSalePageProductId = core.usePageStore((s)=>s.setSalePageProductId);
|
|
25
24
|
const setDynamicCollection = core.usePageStore((s)=>s.setDynamicCollection);
|
|
26
25
|
const initState = core.useBuilderPreviewStore((s)=>s.initState);
|
|
@@ -346,13 +345,6 @@ const Toolbox = ()=>{
|
|
|
346
345
|
}, [
|
|
347
346
|
setPostPurchaseProductOffers
|
|
348
347
|
]);
|
|
349
|
-
const onUpdateDynamicDiscountOffer = react.useCallback((e)=>{
|
|
350
|
-
const dynamicDiscountOffer = e.detail;
|
|
351
|
-
if (!dynamicDiscountOffer) return;
|
|
352
|
-
setDynamicDiscountOffer(dynamicDiscountOffer);
|
|
353
|
-
}, [
|
|
354
|
-
setDynamicDiscountOffer
|
|
355
|
-
]);
|
|
356
348
|
const onUpdateSalePageProductId = react.useCallback((e)=>{
|
|
357
349
|
const id = e.detail;
|
|
358
350
|
if (!id) return;
|
|
@@ -424,7 +416,6 @@ const Toolbox = ()=>{
|
|
|
424
416
|
window.addEventListener('update-item-name', onUpdateItemName);
|
|
425
417
|
window.addEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
426
418
|
window.addEventListener('set-product-offer', onUpdateProductOffers);
|
|
427
|
-
window.addEventListener('set-dynamic-discount-offer', onUpdateDynamicDiscountOffer);
|
|
428
419
|
window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
429
420
|
window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
|
|
430
421
|
window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
@@ -482,8 +473,7 @@ const Toolbox = ()=>{
|
|
|
482
473
|
onUpdateInteractionIsSelectOnPage,
|
|
483
474
|
onUpdateInteractionSettingType,
|
|
484
475
|
onUpdateFontType,
|
|
485
|
-
onChangeSidebarMode
|
|
486
|
-
onUpdateDynamicDiscountOffer
|
|
476
|
+
onChangeSidebarMode
|
|
487
477
|
]);
|
|
488
478
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
489
479
|
className: "toolbox"
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var core = require('@gem-sdk/core');
|
|
5
4
|
|
|
6
5
|
const DropElement = ()=>{
|
|
7
|
-
const editingPageType = core.useShopStore((s)=>s.pageType);
|
|
8
6
|
const dispatchEventBuildWithSectionActiveTab = (value)=>{
|
|
9
7
|
const event = new CustomEvent('editor:sidebar:build-with-section-active-tab', {
|
|
10
8
|
bubbles: true,
|
|
@@ -14,15 +12,6 @@ const DropElement = ()=>{
|
|
|
14
12
|
});
|
|
15
13
|
window.dispatchEvent(event);
|
|
16
14
|
};
|
|
17
|
-
const dispatchEventBuildWithTemplateActiveTab = (value)=>{
|
|
18
|
-
const event = new CustomEvent('editor:sidebar:build-with-template-active-tab', {
|
|
19
|
-
bubbles: true,
|
|
20
|
-
detail: {
|
|
21
|
-
value
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
window.dispatchEvent(event);
|
|
25
|
-
};
|
|
26
15
|
const handleClickGenerate = (e)=>{
|
|
27
16
|
const event = new CustomEvent('editor:sidebar:click-img-to-layout-gallery-btn', e);
|
|
28
17
|
window.dispatchEvent(event);
|
|
@@ -111,30 +100,22 @@ const DropElement = ()=>{
|
|
|
111
100
|
children: [
|
|
112
101
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
113
102
|
className: "gp-text-16 gp-font-medium gp-mb-4 gp-text-[#212121]",
|
|
114
|
-
children:
|
|
103
|
+
children: "Start with Sections from sidebar"
|
|
115
104
|
}),
|
|
116
105
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
117
|
-
className: "gp-flex gp-
|
|
106
|
+
className: "gp-flex gp-w-[291px] gp-justify-between",
|
|
118
107
|
children: [
|
|
119
108
|
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
120
109
|
"data-button-add-section": true,
|
|
121
|
-
onClick: ()=>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
} else dispatchEventBuildWithSectionActiveTab(true);
|
|
125
|
-
},
|
|
126
|
-
className: "gp-flex gp-h-[40px] gp-px-6 gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#1C1C1C] gp-text-[14px] gp-text-white hover:gp-bg-[#3B3B3B]",
|
|
127
|
-
children: editingPageType === 'GP_FUNNEL_PAGE' ? 'Use existing page designs' : 'Add sections'
|
|
110
|
+
onClick: ()=>dispatchEventBuildWithSectionActiveTab(true),
|
|
111
|
+
className: "gp-flex gp-h-[40px] gp-w-[136px] gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#1C1C1C] gp-text-[14px] gp-text-white hover:gp-bg-[#3B3B3B]",
|
|
112
|
+
children: "Add sections"
|
|
128
113
|
}),
|
|
129
114
|
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
130
115
|
"data-button-add-elements": true,
|
|
131
|
-
onClick: ()=>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
} else dispatchEventBuildWithSectionActiveTab(false);
|
|
135
|
-
},
|
|
136
|
-
className: "gp-flex gp-h-[40px] gp-px-6 gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#f4f4f4] gp-text-[14px] gp-text-[#212121] hover:gp-bg-[#E2E2E2]",
|
|
137
|
-
children: editingPageType === 'GP_FUNNEL_PAGE' ? 'Explore templates' : 'Add elements'
|
|
116
|
+
onClick: ()=>dispatchEventBuildWithSectionActiveTab(false),
|
|
117
|
+
className: "gp-flex gp-h-[40px] gp-w-[136px] gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#f4f4f4] gp-text-[14px] gp-text-[#212121] hover:gp-bg-[#E2E2E2]",
|
|
118
|
+
children: "Add elements"
|
|
138
119
|
})
|
|
139
120
|
]
|
|
140
121
|
}),
|
|
@@ -33,7 +33,6 @@ 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,
|
|
37
36
|
productOffers: []
|
|
38
37
|
};
|
|
39
38
|
};
|
|
@@ -45,7 +44,7 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
45
44
|
default: true
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
|
-
const [theme, storeProperty, saleFunnelDiscounts
|
|
47
|
+
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
49
48
|
fetcher([
|
|
50
49
|
core.ThemePageDocument,
|
|
51
50
|
variables
|
|
@@ -60,12 +59,6 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
60
59
|
saleFunnelOfferID: data.currentOfferID
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
]),
|
|
64
|
-
fetcher([
|
|
65
|
-
core.SaleFunnelOfferDocument,
|
|
66
|
-
{
|
|
67
|
-
saleFunnelOfferId: data.currentOfferID
|
|
68
|
-
}
|
|
69
62
|
])
|
|
70
63
|
]);
|
|
71
64
|
if (theme.status === 'rejected') {
|
|
@@ -74,14 +67,10 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
74
67
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
75
68
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
76
69
|
}
|
|
77
|
-
if (saleFunnelOffer.status === 'rejected') {
|
|
78
|
-
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
79
|
-
}
|
|
80
70
|
return {
|
|
81
71
|
dataBuilder: theme.value.themePage,
|
|
82
72
|
pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
|
|
83
73
|
storeProperty,
|
|
84
|
-
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
85
74
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
86
75
|
};
|
|
87
76
|
};
|
|
@@ -127,7 +116,6 @@ const fetchThemePageDataByTemplateID = async (data, fetcher)=>{
|
|
|
127
116
|
dataBuilder: theme.value.libraryTemplate,
|
|
128
117
|
pageStyle: undefined,
|
|
129
118
|
storeProperty,
|
|
130
|
-
dynamicDiscountOffer: undefined,
|
|
131
119
|
productOffers: productOffers
|
|
132
120
|
};
|
|
133
121
|
};
|
|
@@ -135,7 +123,7 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
135
123
|
const variables = {
|
|
136
124
|
shopLibraryPageId: data.shopLibraryPageId
|
|
137
125
|
};
|
|
138
|
-
const [theme, storeProperty, saleFunnelDiscounts
|
|
126
|
+
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
139
127
|
fetcher([
|
|
140
128
|
core.ShopLibraryPageDocument,
|
|
141
129
|
variables
|
|
@@ -150,12 +138,6 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
150
138
|
saleFunnelOfferID: data.currentOfferID
|
|
151
139
|
}
|
|
152
140
|
}
|
|
153
|
-
]),
|
|
154
|
-
fetcher([
|
|
155
|
-
core.SaleFunnelOfferDocument,
|
|
156
|
-
{
|
|
157
|
-
saleFunnelOfferId: data.currentOfferID
|
|
158
|
-
}
|
|
159
141
|
])
|
|
160
142
|
]);
|
|
161
143
|
if (theme.status === 'rejected') {
|
|
@@ -164,14 +146,10 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
164
146
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
165
147
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
166
148
|
}
|
|
167
|
-
if (saleFunnelOffer.status === 'rejected') {
|
|
168
|
-
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
169
|
-
}
|
|
170
149
|
return {
|
|
171
150
|
dataBuilder: theme.value.shopLibraryPage,
|
|
172
151
|
pageStyle: undefined,
|
|
173
152
|
storeProperty,
|
|
174
|
-
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
175
153
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
176
154
|
};
|
|
177
155
|
};
|
|
@@ -179,7 +157,7 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
179
157
|
const variables = {
|
|
180
158
|
libraryTemplateId: data.libraryTemplateId
|
|
181
159
|
};
|
|
182
|
-
const [theme, storeProperty, saleFunnelDiscounts
|
|
160
|
+
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
183
161
|
fetcher([
|
|
184
162
|
core.LibraryTemplateDocument,
|
|
185
163
|
variables
|
|
@@ -194,12 +172,6 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
194
172
|
saleFunnelOfferID: data.currentOfferID
|
|
195
173
|
}
|
|
196
174
|
}
|
|
197
|
-
]),
|
|
198
|
-
fetcher([
|
|
199
|
-
core.SaleFunnelOfferDocument,
|
|
200
|
-
{
|
|
201
|
-
saleFunnelOfferId: data.currentOfferID
|
|
202
|
-
}
|
|
203
175
|
])
|
|
204
176
|
]);
|
|
205
177
|
if (theme.status === 'rejected') {
|
|
@@ -208,14 +180,10 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
208
180
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
209
181
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
210
182
|
}
|
|
211
|
-
if (saleFunnelOffer.status === 'rejected') {
|
|
212
|
-
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
213
|
-
}
|
|
214
183
|
return {
|
|
215
184
|
dataBuilder: theme.value.libraryTemplate,
|
|
216
185
|
pageStyle: undefined,
|
|
217
186
|
storeProperty,
|
|
218
|
-
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
219
187
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
220
188
|
};
|
|
221
189
|
};
|
|
@@ -253,7 +221,7 @@ const getRelevantPageData = async (data)=>{
|
|
|
253
221
|
const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFetcher)=>async (data)=>{
|
|
254
222
|
try {
|
|
255
223
|
const { id, currentOfferID, isLibraryTemplate, isShopLibraryPage } = data;
|
|
256
|
-
const { dataBuilder, storeProperty, productOffers, pageStyle
|
|
224
|
+
const { dataBuilder, storeProperty, productOffers, pageStyle } = await getRelevantPageData({
|
|
257
225
|
id,
|
|
258
226
|
currentOfferID,
|
|
259
227
|
fetcher,
|
|
@@ -282,8 +250,7 @@ const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFet
|
|
|
282
250
|
swr: {
|
|
283
251
|
fallback
|
|
284
252
|
},
|
|
285
|
-
productOffers
|
|
286
|
-
dynamicDiscountOffer
|
|
253
|
+
productOffers
|
|
287
254
|
});
|
|
288
255
|
} catch (err) {
|
|
289
256
|
nextjs.captureException(err);
|
|
@@ -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,
|
|
15
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction })=>{
|
|
16
16
|
const router$1 = router.useRouter();
|
|
17
17
|
const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
|
|
18
18
|
useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
|
|
@@ -86,7 +86,6 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
86
86
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
87
87
|
productOffers: productOffers,
|
|
88
88
|
publicStoreFrontData: publicStoreFrontData,
|
|
89
|
-
dynamicDiscountOffer: dynamicDiscountOffer,
|
|
90
89
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
91
90
|
components: components,
|
|
92
91
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -16,7 +16,6 @@ const Toolbox = ()=>{
|
|
|
16
16
|
const changeStorefrontInfo = useShopStore((s)=>s.changeStorefrontInfo);
|
|
17
17
|
const setDynamicProduct = usePageStore((s)=>s.setDynamicProduct);
|
|
18
18
|
const setPostPurchaseProductOffers = usePageStore((s)=>s.setPostPurchaseProductOffers);
|
|
19
|
-
const setDynamicDiscountOffer = usePageStore((s)=>s.setDynamicDiscountOffer);
|
|
20
19
|
const setSalePageProductId = usePageStore((s)=>s.setSalePageProductId);
|
|
21
20
|
const setDynamicCollection = usePageStore((s)=>s.setDynamicCollection);
|
|
22
21
|
const initState = useBuilderPreviewStore((s)=>s.initState);
|
|
@@ -342,13 +341,6 @@ const Toolbox = ()=>{
|
|
|
342
341
|
}, [
|
|
343
342
|
setPostPurchaseProductOffers
|
|
344
343
|
]);
|
|
345
|
-
const onUpdateDynamicDiscountOffer = useCallback((e)=>{
|
|
346
|
-
const dynamicDiscountOffer = e.detail;
|
|
347
|
-
if (!dynamicDiscountOffer) return;
|
|
348
|
-
setDynamicDiscountOffer(dynamicDiscountOffer);
|
|
349
|
-
}, [
|
|
350
|
-
setDynamicDiscountOffer
|
|
351
|
-
]);
|
|
352
344
|
const onUpdateSalePageProductId = useCallback((e)=>{
|
|
353
345
|
const id = e.detail;
|
|
354
346
|
if (!id) return;
|
|
@@ -420,7 +412,6 @@ const Toolbox = ()=>{
|
|
|
420
412
|
window.addEventListener('update-item-name', onUpdateItemName);
|
|
421
413
|
window.addEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
422
414
|
window.addEventListener('set-product-offer', onUpdateProductOffers);
|
|
423
|
-
window.addEventListener('set-dynamic-discount-offer', onUpdateDynamicDiscountOffer);
|
|
424
415
|
window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
425
416
|
window.addEventListener('limit-create-theme-section', onLimitCreateThemeSection);
|
|
426
417
|
window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
@@ -478,8 +469,7 @@ const Toolbox = ()=>{
|
|
|
478
469
|
onUpdateInteractionIsSelectOnPage,
|
|
479
470
|
onUpdateInteractionSettingType,
|
|
480
471
|
onUpdateFontType,
|
|
481
|
-
onChangeSidebarMode
|
|
482
|
-
onUpdateDynamicDiscountOffer
|
|
472
|
+
onChangeSidebarMode
|
|
483
473
|
]);
|
|
484
474
|
return /*#__PURE__*/ jsx("div", {
|
|
485
475
|
className: "toolbox"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useShopStore } from '@gem-sdk/core';
|
|
3
2
|
|
|
4
3
|
const DropElement = ()=>{
|
|
5
|
-
const editingPageType = useShopStore((s)=>s.pageType);
|
|
6
4
|
const dispatchEventBuildWithSectionActiveTab = (value)=>{
|
|
7
5
|
const event = new CustomEvent('editor:sidebar:build-with-section-active-tab', {
|
|
8
6
|
bubbles: true,
|
|
@@ -12,15 +10,6 @@ const DropElement = ()=>{
|
|
|
12
10
|
});
|
|
13
11
|
window.dispatchEvent(event);
|
|
14
12
|
};
|
|
15
|
-
const dispatchEventBuildWithTemplateActiveTab = (value)=>{
|
|
16
|
-
const event = new CustomEvent('editor:sidebar:build-with-template-active-tab', {
|
|
17
|
-
bubbles: true,
|
|
18
|
-
detail: {
|
|
19
|
-
value
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
window.dispatchEvent(event);
|
|
23
|
-
};
|
|
24
13
|
const handleClickGenerate = (e)=>{
|
|
25
14
|
const event = new CustomEvent('editor:sidebar:click-img-to-layout-gallery-btn', e);
|
|
26
15
|
window.dispatchEvent(event);
|
|
@@ -109,30 +98,22 @@ const DropElement = ()=>{
|
|
|
109
98
|
children: [
|
|
110
99
|
/*#__PURE__*/ jsx("div", {
|
|
111
100
|
className: "gp-text-16 gp-font-medium gp-mb-4 gp-text-[#212121]",
|
|
112
|
-
children:
|
|
101
|
+
children: "Start with Sections from sidebar"
|
|
113
102
|
}),
|
|
114
103
|
/*#__PURE__*/ jsxs("div", {
|
|
115
|
-
className: "gp-flex gp-
|
|
104
|
+
className: "gp-flex gp-w-[291px] gp-justify-between",
|
|
116
105
|
children: [
|
|
117
106
|
/*#__PURE__*/ jsx("button", {
|
|
118
107
|
"data-button-add-section": true,
|
|
119
|
-
onClick: ()=>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} else dispatchEventBuildWithSectionActiveTab(true);
|
|
123
|
-
},
|
|
124
|
-
className: "gp-flex gp-h-[40px] gp-px-6 gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#1C1C1C] gp-text-[14px] gp-text-white hover:gp-bg-[#3B3B3B]",
|
|
125
|
-
children: editingPageType === 'GP_FUNNEL_PAGE' ? 'Use existing page designs' : 'Add sections'
|
|
108
|
+
onClick: ()=>dispatchEventBuildWithSectionActiveTab(true),
|
|
109
|
+
className: "gp-flex gp-h-[40px] gp-w-[136px] gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#1C1C1C] gp-text-[14px] gp-text-white hover:gp-bg-[#3B3B3B]",
|
|
110
|
+
children: "Add sections"
|
|
126
111
|
}),
|
|
127
112
|
/*#__PURE__*/ jsx("button", {
|
|
128
113
|
"data-button-add-elements": true,
|
|
129
|
-
onClick: ()=>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
} else dispatchEventBuildWithSectionActiveTab(false);
|
|
133
|
-
},
|
|
134
|
-
className: "gp-flex gp-h-[40px] gp-px-6 gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#f4f4f4] gp-text-[14px] gp-text-[#212121] hover:gp-bg-[#E2E2E2]",
|
|
135
|
-
children: editingPageType === 'GP_FUNNEL_PAGE' ? 'Explore templates' : 'Add elements'
|
|
114
|
+
onClick: ()=>dispatchEventBuildWithSectionActiveTab(false),
|
|
115
|
+
className: "gp-flex gp-h-[40px] gp-w-[136px] gp-items-center gp-font-medium gp-justify-center gp-rounded-[8px] gp-bg-[#f4f4f4] gp-text-[14px] gp-text-[#212121] hover:gp-bg-[#E2E2E2]",
|
|
116
|
+
children: "Add elements"
|
|
136
117
|
})
|
|
137
118
|
]
|
|
138
119
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ThemePageDocument, StorePropertyDocument, SaleFunnelDiscountsDocument,
|
|
1
|
+
import { ThemePageDocument, StorePropertyDocument, SaleFunnelDiscountsDocument, 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,7 +31,6 @@ 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,
|
|
35
34
|
productOffers: []
|
|
36
35
|
};
|
|
37
36
|
};
|
|
@@ -43,7 +42,7 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
43
42
|
default: true
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
|
-
const [theme, storeProperty, saleFunnelDiscounts
|
|
45
|
+
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
47
46
|
fetcher([
|
|
48
47
|
ThemePageDocument,
|
|
49
48
|
variables
|
|
@@ -58,12 +57,6 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
58
57
|
saleFunnelOfferID: data.currentOfferID
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
|
-
]),
|
|
62
|
-
fetcher([
|
|
63
|
-
SaleFunnelOfferDocument,
|
|
64
|
-
{
|
|
65
|
-
saleFunnelOfferId: data.currentOfferID
|
|
66
|
-
}
|
|
67
60
|
])
|
|
68
61
|
]);
|
|
69
62
|
if (theme.status === 'rejected') {
|
|
@@ -72,14 +65,10 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
|
|
|
72
65
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
73
66
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
74
67
|
}
|
|
75
|
-
if (saleFunnelOffer.status === 'rejected') {
|
|
76
|
-
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
77
|
-
}
|
|
78
68
|
return {
|
|
79
69
|
dataBuilder: theme.value.themePage,
|
|
80
70
|
pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
|
|
81
71
|
storeProperty,
|
|
82
|
-
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
83
72
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
84
73
|
};
|
|
85
74
|
};
|
|
@@ -125,7 +114,6 @@ const fetchThemePageDataByTemplateID = async (data, fetcher)=>{
|
|
|
125
114
|
dataBuilder: theme.value.libraryTemplate,
|
|
126
115
|
pageStyle: undefined,
|
|
127
116
|
storeProperty,
|
|
128
|
-
dynamicDiscountOffer: undefined,
|
|
129
117
|
productOffers: productOffers
|
|
130
118
|
};
|
|
131
119
|
};
|
|
@@ -133,7 +121,7 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
133
121
|
const variables = {
|
|
134
122
|
shopLibraryPageId: data.shopLibraryPageId
|
|
135
123
|
};
|
|
136
|
-
const [theme, storeProperty, saleFunnelDiscounts
|
|
124
|
+
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
137
125
|
fetcher([
|
|
138
126
|
ShopLibraryPageDocument,
|
|
139
127
|
variables
|
|
@@ -148,12 +136,6 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
148
136
|
saleFunnelOfferID: data.currentOfferID
|
|
149
137
|
}
|
|
150
138
|
}
|
|
151
|
-
]),
|
|
152
|
-
fetcher([
|
|
153
|
-
SaleFunnelOfferDocument,
|
|
154
|
-
{
|
|
155
|
-
saleFunnelOfferId: data.currentOfferID
|
|
156
|
-
}
|
|
157
139
|
])
|
|
158
140
|
]);
|
|
159
141
|
if (theme.status === 'rejected') {
|
|
@@ -162,14 +144,10 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
|
|
|
162
144
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
163
145
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
164
146
|
}
|
|
165
|
-
if (saleFunnelOffer.status === 'rejected') {
|
|
166
|
-
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
167
|
-
}
|
|
168
147
|
return {
|
|
169
148
|
dataBuilder: theme.value.shopLibraryPage,
|
|
170
149
|
pageStyle: undefined,
|
|
171
150
|
storeProperty,
|
|
172
|
-
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
173
151
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
174
152
|
};
|
|
175
153
|
};
|
|
@@ -177,7 +155,7 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
177
155
|
const variables = {
|
|
178
156
|
libraryTemplateId: data.libraryTemplateId
|
|
179
157
|
};
|
|
180
|
-
const [theme, storeProperty, saleFunnelDiscounts
|
|
158
|
+
const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
|
|
181
159
|
fetcher([
|
|
182
160
|
LibraryTemplateDocument,
|
|
183
161
|
variables
|
|
@@ -192,12 +170,6 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
192
170
|
saleFunnelOfferID: data.currentOfferID
|
|
193
171
|
}
|
|
194
172
|
}
|
|
195
|
-
]),
|
|
196
|
-
fetcher([
|
|
197
|
-
SaleFunnelOfferDocument,
|
|
198
|
-
{
|
|
199
|
-
saleFunnelOfferId: data.currentOfferID
|
|
200
|
-
}
|
|
201
173
|
])
|
|
202
174
|
]);
|
|
203
175
|
if (theme.status === 'rejected') {
|
|
@@ -206,14 +178,10 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
|
|
|
206
178
|
if (saleFunnelDiscounts.status === 'rejected') {
|
|
207
179
|
throw new Error(saleFunnelDiscounts.reason?.[0]);
|
|
208
180
|
}
|
|
209
|
-
if (saleFunnelOffer.status === 'rejected') {
|
|
210
|
-
throw new Error(saleFunnelOffer.reason?.[0]);
|
|
211
|
-
}
|
|
212
181
|
return {
|
|
213
182
|
dataBuilder: theme.value.libraryTemplate,
|
|
214
183
|
pageStyle: undefined,
|
|
215
184
|
storeProperty,
|
|
216
|
-
dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
|
|
217
185
|
productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
|
|
218
186
|
};
|
|
219
187
|
};
|
|
@@ -251,7 +219,7 @@ const getRelevantPageData = async (data)=>{
|
|
|
251
219
|
const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFetcher)=>async (data)=>{
|
|
252
220
|
try {
|
|
253
221
|
const { id, currentOfferID, isLibraryTemplate, isShopLibraryPage } = data;
|
|
254
|
-
const { dataBuilder, storeProperty, productOffers, pageStyle
|
|
222
|
+
const { dataBuilder, storeProperty, productOffers, pageStyle } = await getRelevantPageData({
|
|
255
223
|
id,
|
|
256
224
|
currentOfferID,
|
|
257
225
|
fetcher,
|
|
@@ -280,8 +248,7 @@ const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFet
|
|
|
280
248
|
swr: {
|
|
281
249
|
fallback
|
|
282
250
|
},
|
|
283
|
-
productOffers
|
|
284
|
-
dynamicDiscountOffer
|
|
251
|
+
productOffers
|
|
285
252
|
});
|
|
286
253
|
} catch (err) {
|
|
287
254
|
captureException(err);
|
|
@@ -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,
|
|
13
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction })=>{
|
|
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);
|
|
@@ -84,7 +84,6 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
84
84
|
/*#__PURE__*/ jsx(PageProvider, {
|
|
85
85
|
productOffers: productOffers,
|
|
86
86
|
publicStoreFrontData: publicStoreFrontData,
|
|
87
|
-
dynamicDiscountOffer: dynamicDiscountOffer,
|
|
88
87
|
children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
|
|
89
88
|
components: components,
|
|
90
89
|
children: /*#__PURE__*/ jsxs("div", {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ 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';
|
|
8
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
8
|
import { ShopMetaQueryResponse } from '@gem-sdk/adapter-shopify';
|
|
10
9
|
import * as react from 'react';
|
|
@@ -91,7 +90,6 @@ type StaticPagePropsV2 = PageBuilderPropsV2 & {
|
|
|
91
90
|
isPostPurchase?: boolean;
|
|
92
91
|
shopName?: string;
|
|
93
92
|
productOffers?: ProductOffer[];
|
|
94
|
-
dynamicDiscountOffer?: OfferDynamicDiscount;
|
|
95
93
|
publicStoreFrontData?: PublicStoreFrontData | null;
|
|
96
94
|
isPreview?: boolean;
|
|
97
95
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
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.1.
|
|
29
|
+
"@gem-sdk/core": "2.1.15",
|
|
30
30
|
"@gem-sdk/plugin-cookie-bar": "2.1.0",
|
|
31
31
|
"@gem-sdk/plugin-quick-view": "2.1.0",
|
|
32
32
|
"@gem-sdk/plugin-sticky-add-to-cart": "2.1.0"
|