@gem-sdk/pages 2.0.0-staging.159 → 2.0.0-staging.711
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/FooterForPostPurchase.js +1 -1
- package/dist/cjs/components/builder/Footer.js +2 -2
- package/dist/cjs/components/builder/Header.js +0 -1
- package/dist/cjs/components/builder/Toolbar.js +6 -0
- package/dist/cjs/components/builder/Toolbox.js +17 -14
- package/dist/cjs/components/composable/getListFontWeightTypos.js +14 -0
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +5 -4
- package/dist/cjs/components/image-to-layout/DropElement.js +34 -9
- package/dist/cjs/constants/index.js +3 -0
- package/dist/cjs/libs/api/get-static-page-props-preview.js +5 -0
- package/dist/cjs/libs/api/get-static-page-props-v2.js +7 -2
- package/dist/cjs/libs/google-fonts.js +25 -5
- package/dist/cjs/libs/helpers/gen-fonts.js +9 -3
- package/dist/cjs/libs/helpers/normalize.js +2 -1
- package/dist/cjs/libs/helpers/parse-json.js +1 -1
- package/dist/cjs/libs/helpers/sentry.js +17 -0
- package/dist/cjs/pages/404.js +1 -0
- package/dist/cjs/pages/500.js +1 -0
- package/dist/cjs/pages/CollectionGlobalProvider.js +1 -0
- package/dist/cjs/pages/builder.js +46 -41
- package/dist/cjs/pages/collection-detail.js +1 -0
- package/dist/cjs/pages/preview.js +1 -0
- package/dist/cjs/pages/product-detail.js +1 -0
- package/dist/cjs/pages/static-v2.js +20 -16
- package/dist/cjs/pages/static.js +1 -0
- package/dist/esm/components/FooterForPostPurchase.js +1 -1
- package/dist/esm/components/builder/Footer.js +2 -2
- package/dist/esm/components/builder/Header.js +1 -2
- package/dist/esm/components/builder/Toolbar.js +6 -0
- package/dist/esm/components/builder/Toolbox.js +17 -14
- package/dist/esm/components/composable/getListFontWeightTypos.js +12 -0
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +6 -5
- package/dist/esm/components/image-to-layout/DropElement.js +34 -9
- package/dist/esm/constants/index.js +3 -0
- package/dist/esm/libs/api/get-static-page-props-preview.js +5 -0
- package/dist/esm/libs/api/get-static-page-props-v2.js +7 -2
- package/dist/esm/libs/google-fonts.js +25 -5
- package/dist/esm/libs/helpers/gen-fonts.js +9 -3
- package/dist/esm/libs/helpers/normalize.js +2 -1
- package/dist/esm/libs/helpers/parse-json.js +1 -1
- package/dist/esm/libs/helpers/sentry.js +15 -0
- package/dist/esm/pages/404.js +1 -0
- package/dist/esm/pages/500.js +1 -0
- package/dist/esm/pages/CollectionGlobalProvider.js +1 -0
- package/dist/esm/pages/builder.js +47 -42
- package/dist/esm/pages/collection-detail.js +1 -0
- package/dist/esm/pages/preview.js +1 -0
- package/dist/esm/pages/product-detail.js +1 -0
- package/dist/esm/pages/static-v2.js +21 -17
- package/dist/esm/pages/static.js +1 -0
- package/dist/types/index.d.ts +63 -57
- package/package.json +6 -6
|
@@ -13,7 +13,7 @@ const defaultMargin = {
|
|
|
13
13
|
};
|
|
14
14
|
const FooterForPostPurchase = (props)=>{
|
|
15
15
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
16
|
-
className: core.cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-
|
|
16
|
+
className: core.cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-font-sans'),
|
|
17
17
|
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
18
18
|
className: "gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",
|
|
19
19
|
style: {
|
|
@@ -45,7 +45,7 @@ const Footer = (props)=>{
|
|
|
45
45
|
]);
|
|
46
46
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
47
47
|
children: pageType === 'POST_PURCHASE' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
48
|
-
className: core.cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-
|
|
48
|
+
className: core.cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-font-sans'),
|
|
49
49
|
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
50
50
|
className: "gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",
|
|
51
51
|
style: {
|
|
@@ -62,7 +62,7 @@ const Footer = (props)=>{
|
|
|
62
62
|
})
|
|
63
63
|
})
|
|
64
64
|
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
65
|
-
className: core.cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE
|
|
65
|
+
className: core.cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE gp-font-sans', {
|
|
66
66
|
'gp-fixed gp-bottom-0 gp-w-full': shouldFixed
|
|
67
67
|
}),
|
|
68
68
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -22,7 +22,6 @@ const sizeCheck = {
|
|
|
22
22
|
const Header = (props)=>{
|
|
23
23
|
const { pageType, isOriginTemplate, openPageSetting } = props;
|
|
24
24
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
25
|
-
core.usePageStore((s)=>s.sidebarMode);
|
|
26
25
|
const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
|
|
27
26
|
const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
|
|
28
27
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -411,6 +411,7 @@ const Toolbar = ()=>{
|
|
|
411
411
|
if (!value || !currentComponentActive.current) {
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
414
|
+
let isClickProcessing = false;
|
|
414
415
|
const selector = getSelectorComponent({
|
|
415
416
|
...currentComponentActive.current
|
|
416
417
|
});
|
|
@@ -419,6 +420,7 @@ const Toolbar = ()=>{
|
|
|
419
420
|
const $parents = $component?.querySelectorAll('[data-toolbar-parent]');
|
|
420
421
|
if ($parents.length) {
|
|
421
422
|
const onHover = ($parent)=>{
|
|
423
|
+
if (isClickProcessing) return;
|
|
422
424
|
const uid = $parent.getAttribute('data-parent-uid');
|
|
423
425
|
if (!uid) return;
|
|
424
426
|
const $parentComponents = document.body.querySelector('#storefront')?.querySelectorAll(`[data-uid="${uid}"]`);
|
|
@@ -447,6 +449,7 @@ const Toolbar = ()=>{
|
|
|
447
449
|
}
|
|
448
450
|
};
|
|
449
451
|
const onClick = async ($parent)=>{
|
|
452
|
+
isClickProcessing = true;
|
|
450
453
|
const uid = $parent.getAttribute('data-parent-uid');
|
|
451
454
|
if (!uid) return;
|
|
452
455
|
const isElementInsideProduct = async ()=>{
|
|
@@ -478,6 +481,9 @@ const Toolbar = ()=>{
|
|
|
478
481
|
});
|
|
479
482
|
outHover($parent);
|
|
480
483
|
window.dispatchEvent(event);
|
|
484
|
+
setTimeout(()=>{
|
|
485
|
+
isClickProcessing = false;
|
|
486
|
+
}, 0);
|
|
481
487
|
};
|
|
482
488
|
$parents.forEach(($parent)=>{
|
|
483
489
|
$parent.addEventListener('mouseover', ()=>onHover($parent));
|
|
@@ -8,11 +8,12 @@ var core = require('@gem-sdk/core');
|
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var getStorefrontApi = require('../../libs/get-storefront-api.js');
|
|
10
10
|
var googleFonts = require('../../libs/google-fonts.js');
|
|
11
|
+
var checkOptionFont = require('../../libs/helpers/check-option-font.js');
|
|
11
12
|
var genCss = require('../../libs/helpers/gen-css.js');
|
|
12
13
|
var genFonts = require('../../libs/helpers/gen-fonts.js');
|
|
13
14
|
var shopifyCdnWithGoogleFonts = require('../../libs/shopify-cdn-with-google-fonts.js');
|
|
14
15
|
var libsStore = require('../../store/libs-store.js');
|
|
15
|
-
var
|
|
16
|
+
var getListFontWeightTypos = require('../composable/getListFontWeightTypos.js');
|
|
16
17
|
|
|
17
18
|
const globalStyleId = 'global-style';
|
|
18
19
|
const Toolbox = ()=>{
|
|
@@ -39,7 +40,7 @@ const Toolbox = ()=>{
|
|
|
39
40
|
const changeLayoutSettings = core.useShopStore((s)=>s.changeLayoutSettings);
|
|
40
41
|
const changeCreateThemeSectionCount = core.useShopStore((s)=>s.changeCreateThemeSectionCount);
|
|
41
42
|
const changeShopPlan = core.useShopStore((s)=>s.changeShopPlan);
|
|
42
|
-
const
|
|
43
|
+
const updatePriceWithCurrency = core.useShopStore((s)=>s.updatePriceWithCurrency);
|
|
43
44
|
const changeFontType = libsStore.libsStore((s)=>s.changeFontType);
|
|
44
45
|
const fontType = libsStore.libsStore((s)=>s.fontType);
|
|
45
46
|
const clearModal = core.useModalStore((s)=>s.clearModal);
|
|
@@ -138,9 +139,11 @@ const Toolbox = ()=>{
|
|
|
138
139
|
try {
|
|
139
140
|
if (detail.data) {
|
|
140
141
|
const themeStyle = genCss.genCSS(detail.data, detail.mobileOnly);
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
const fontWeights = getListFontWeightTypos.getListFontWeightTypos(detail.data?.typography);
|
|
143
|
+
const font = Object.entries(detail.data?.font).map(([, value])=>({
|
|
144
|
+
...value,
|
|
145
|
+
variants: value.variants.filter((variant)=>fontWeights.includes(variant) || variant === 'regular' && fontWeights.includes('400')).map((variant)=>variant === 'regular' ? '400' : variant)
|
|
146
|
+
})).map((item)=>{
|
|
144
147
|
if (item.type == 'custom') {
|
|
145
148
|
const isGoogleFont = shopifyCdnWithGoogleFonts.shopifyCdnWithGoogleFonts.find((ggFont)=>ggFont.family == item.family);
|
|
146
149
|
if (isGoogleFont) {
|
|
@@ -297,12 +300,12 @@ const Toolbox = ()=>{
|
|
|
297
300
|
}, [
|
|
298
301
|
changeShopPlan
|
|
299
302
|
]);
|
|
300
|
-
const
|
|
301
|
-
const
|
|
302
|
-
if (!
|
|
303
|
-
|
|
303
|
+
const onUpdatePriceWithCurrency = react.useCallback((e)=>{
|
|
304
|
+
const showPriceCurrency = e.detail;
|
|
305
|
+
if (!showPriceCurrency) return;
|
|
306
|
+
updatePriceWithCurrency(showPriceCurrency);
|
|
304
307
|
}, [
|
|
305
|
-
|
|
308
|
+
updatePriceWithCurrency
|
|
306
309
|
]);
|
|
307
310
|
const onUpdateFontType = react.useCallback((e)=>{
|
|
308
311
|
const fontType = e.detail;
|
|
@@ -428,7 +431,6 @@ const Toolbox = ()=>{
|
|
|
428
431
|
window.addEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
429
432
|
window.addEventListener('update-create-theme-section-count', onUpdateCreateThemeSectionCount);
|
|
430
433
|
window.addEventListener('update-shop-plan', onUpdateShopPlan);
|
|
431
|
-
window.addEventListener('update-shopify-plan', onUpdateShopifyPlan);
|
|
432
434
|
window.addEventListener('set-dynamic-product', onUpdateDynamicProduct);
|
|
433
435
|
window.addEventListener('set-dynamic-collection', onUpdateDynamicCollection);
|
|
434
436
|
window.addEventListener('update-item-name', onUpdateItemName);
|
|
@@ -442,6 +444,7 @@ const Toolbox = ()=>{
|
|
|
442
444
|
window.addEventListener('update-interaction-setting-type', onUpdateInteractionSettingType);
|
|
443
445
|
window.addEventListener('change-sidebar-mode', onChangeSidebarMode);
|
|
444
446
|
window.addEventListener('update-font-type', onUpdateFontType);
|
|
447
|
+
window.addEventListener('update-price-with-currency', onUpdatePriceWithCurrency);
|
|
445
448
|
return ()=>{
|
|
446
449
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
447
450
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -455,7 +458,7 @@ const Toolbox = ()=>{
|
|
|
455
458
|
window.removeEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
456
459
|
window.removeEventListener('update-create-theme-section-count', onUpdateCreateThemeSectionCount);
|
|
457
460
|
window.removeEventListener('update-shop-plan', onUpdateShopPlan);
|
|
458
|
-
window.removeEventListener('update-
|
|
461
|
+
window.removeEventListener('update-price-with-currency', onUpdatePriceWithCurrency);
|
|
459
462
|
window.removeEventListener('set-dynamic-product', onUpdateDynamicProduct);
|
|
460
463
|
window.removeEventListener('set-dynamic-collection', onUpdateDynamicCollection);
|
|
461
464
|
window.removeEventListener('update-item-name', onUpdateItemName);
|
|
@@ -471,7 +474,6 @@ const Toolbox = ()=>{
|
|
|
471
474
|
}, [
|
|
472
475
|
onAddEntity,
|
|
473
476
|
onUpdateShopPlan,
|
|
474
|
-
onUpdateShopifyPlan,
|
|
475
477
|
onForceUpdateEntityProps,
|
|
476
478
|
onUpdateEntityProp,
|
|
477
479
|
onInitBuilder,
|
|
@@ -495,7 +497,8 @@ const Toolbox = ()=>{
|
|
|
495
497
|
onUpdateInteractionSettingType,
|
|
496
498
|
onUpdateFontType,
|
|
497
499
|
onChangeSidebarMode,
|
|
498
|
-
onUpdateDynamicDiscountOffer
|
|
500
|
+
onUpdateDynamicDiscountOffer,
|
|
501
|
+
onUpdatePriceWithCurrency
|
|
499
502
|
]);
|
|
500
503
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
501
504
|
className: "toolbox"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getListFontWeightTypos = (font)=>{
|
|
4
|
+
const fontWeights = new Set();
|
|
5
|
+
Object.values(font).forEach((fontStyle)=>{
|
|
6
|
+
// Check desktop fontWeight
|
|
7
|
+
if (fontStyle.desktop?.fontWeight) {
|
|
8
|
+
fontWeights.add(fontStyle.desktop.fontWeight);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return Array.from(fontWeights);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.getListFontWeightTypos = getListFontWeightTypos;
|
|
@@ -37,6 +37,7 @@ const defaultPadding = {
|
|
|
37
37
|
mobile: 'var(--g-ct-p)'
|
|
38
38
|
};
|
|
39
39
|
const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
40
|
+
const { t } = core.useI18nStore();
|
|
40
41
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
41
42
|
const totalSection = core.useBuilderPreviewStore((state)=>state.state.ROOT.childrens?.length);
|
|
42
43
|
const editingPageType = core.useShopStore((s)=>s.pageType);
|
|
@@ -82,11 +83,11 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
82
83
|
children: [
|
|
83
84
|
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
84
85
|
className: "gp-absolute gp-top-[-12px] gp-bg-white gp-px-[8px] gp-text-[14px] gp-font-normal gp-text-[#9E9E9E]",
|
|
85
|
-
children:
|
|
86
|
+
children: t('Add section')
|
|
86
87
|
}),
|
|
87
88
|
ACTIONS_DATA.map((action)=>{
|
|
88
89
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
89
|
-
className: `gp-relative gp-mx-1 gp-h-[60px] gp-
|
|
90
|
+
className: `gp-relative gp-mx-1 gp-min-h-[60px] gp-border-box w375:gp-w-auto w576:gp-w-auto gp-cursor-pointer gp-flex-col gp-items-center gp-justify-center gp-rounded-[3px] gp-bg-[#F4F4F4] hover:gp-bg-black/10 gp-flex gp-p-2`,
|
|
90
91
|
id: action.id,
|
|
91
92
|
onClick: ()=>handleAddSectionAction(action.eventID),
|
|
92
93
|
"aria-hidden": true,
|
|
@@ -94,7 +95,7 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
94
95
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
95
96
|
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121]",
|
|
96
97
|
children: [
|
|
97
|
-
action.title,
|
|
98
|
+
t(action.title),
|
|
98
99
|
action.hasAILogo && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
99
100
|
width: "43",
|
|
100
101
|
height: "20",
|
|
@@ -137,7 +138,7 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
137
138
|
className: "gp-flex gp-items-center",
|
|
138
139
|
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
139
140
|
className: "gp-mr-[3px] gp-text-center gp-text-[12px] gp-font-normal gp-text-[#676767]",
|
|
140
|
-
children: action.content
|
|
141
|
+
children: t(action.content)
|
|
141
142
|
})
|
|
142
143
|
})
|
|
143
144
|
]
|
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var core = require('@gem-sdk/core');
|
|
5
6
|
|
|
7
|
+
const SALE_FUNNEL_PAGE_TYPES = [
|
|
8
|
+
'GP_FUNNEL_PAGE',
|
|
9
|
+
'GP_PRE_SALE_PAGE'
|
|
10
|
+
];
|
|
6
11
|
const DropElement = ()=>{
|
|
12
|
+
const { t } = core.useI18n();
|
|
13
|
+
const editingPageType = core.useShopStore((s)=>s.pageType);
|
|
14
|
+
const isFunnelSalesPage = SALE_FUNNEL_PAGE_TYPES.includes(editingPageType || '');
|
|
7
15
|
const dispatchEventBuildWithSectionActiveTab = (value)=>{
|
|
8
16
|
const event = new CustomEvent('editor:sidebar:build-with-section-active-tab', {
|
|
9
17
|
bubbles: true,
|
|
@@ -13,6 +21,15 @@ const DropElement = ()=>{
|
|
|
13
21
|
});
|
|
14
22
|
window.dispatchEvent(event);
|
|
15
23
|
};
|
|
24
|
+
const dispatchEventBuildWithTemplateActiveTab = (value)=>{
|
|
25
|
+
const event = new CustomEvent('editor:sidebar:build-with-template-active-tab', {
|
|
26
|
+
bubbles: true,
|
|
27
|
+
detail: {
|
|
28
|
+
value
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
window.dispatchEvent(event);
|
|
32
|
+
};
|
|
16
33
|
const handleClickGenerate = (e)=>{
|
|
17
34
|
const event = new CustomEvent('editor:sidebar:click-img-to-layout-gallery-btn', e);
|
|
18
35
|
window.dispatchEvent(event);
|
|
@@ -101,22 +118,30 @@ const DropElement = ()=>{
|
|
|
101
118
|
children: [
|
|
102
119
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
103
120
|
className: "gp-text-16 gp-font-medium gp-mb-4 gp-text-[#212121]",
|
|
104
|
-
children:
|
|
121
|
+
children: isFunnelSalesPage ? t('Start building with Sections/Elements or') : t('Start with Sections from sidebar')
|
|
105
122
|
}),
|
|
106
123
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
107
|
-
className: "gp-flex gp-
|
|
124
|
+
className: "gp-flex gp-gap-3 gp-justify-between",
|
|
108
125
|
children: [
|
|
109
126
|
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
110
127
|
"data-button-add-section": true,
|
|
111
|
-
onClick: ()=>
|
|
112
|
-
|
|
113
|
-
|
|
128
|
+
onClick: ()=>{
|
|
129
|
+
if (isFunnelSalesPage) {
|
|
130
|
+
dispatchEventBuildWithTemplateActiveTab('funnelExisting');
|
|
131
|
+
} else dispatchEventBuildWithSectionActiveTab(true);
|
|
132
|
+
},
|
|
133
|
+
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]",
|
|
134
|
+
children: isFunnelSalesPage ? t('Use existing page designs') : t('Add sections')
|
|
114
135
|
}),
|
|
115
136
|
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
116
137
|
"data-button-add-elements": true,
|
|
117
|
-
onClick: ()=>
|
|
118
|
-
|
|
119
|
-
|
|
138
|
+
onClick: ()=>{
|
|
139
|
+
if (isFunnelSalesPage) {
|
|
140
|
+
dispatchEventBuildWithTemplateActiveTab('templates');
|
|
141
|
+
} else dispatchEventBuildWithSectionActiveTab(false);
|
|
142
|
+
},
|
|
143
|
+
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]",
|
|
144
|
+
children: isFunnelSalesPage ? t('Explore templates') : t('Add elements')
|
|
120
145
|
})
|
|
121
146
|
]
|
|
122
147
|
}),
|
|
@@ -155,7 +180,7 @@ const DropElement = ()=>{
|
|
|
155
180
|
"aria-hidden": "true",
|
|
156
181
|
id: "gp-img-to-layout-gallery-btn",
|
|
157
182
|
className: "gp-relative gp-cursor-pointer gp-text-[14px] gp-font-medium gp-text-[#3C67FF]",
|
|
158
|
-
children:
|
|
183
|
+
children: t('Start with Generating from URL or image')
|
|
159
184
|
})
|
|
160
185
|
})
|
|
161
186
|
]
|
|
@@ -8,5 +8,8 @@ exports.PublishedThemePageMetafields = void 0;
|
|
|
8
8
|
PublishedThemePageMetafields["ANALYTICS_FB_PIXEL_ID"] = 'analytics_fb_pixel_id';
|
|
9
9
|
PublishedThemePageMetafields["ANALYTICS_TIKTOK_PIXEL_ID"] = 'analytics_tiktok_pixel_id';
|
|
10
10
|
PublishedThemePageMetafields["GLOBAL_META_DESCRIPTION"] = 'global-meta-description';
|
|
11
|
+
PublishedThemePageMetafields["GLOBAL_META_TITLE"] = 'global-meta-title';
|
|
11
12
|
PublishedThemePageMetafields["GLOBAL_META_THUMBNAIL"] = 'global-meta-thumbnail';
|
|
13
|
+
PublishedThemePageMetafields["NOINDEX_KEY"] = 'noindex';
|
|
14
|
+
PublishedThemePageMetafields["NOFOLLOW_KEY"] = 'nofollow';
|
|
12
15
|
})(exports.PublishedThemePageMetafields || (exports.PublishedThemePageMetafields = {}));
|
|
@@ -10,6 +10,7 @@ var getFallback = require('../helpers/get-fallback.js');
|
|
|
10
10
|
var normalize = require('../helpers/normalize.js');
|
|
11
11
|
var parseJson = require('../helpers/parse-json.js');
|
|
12
12
|
var customFonts = require('../custom-fonts.js');
|
|
13
|
+
var sentry = require('../helpers/sentry.js');
|
|
13
14
|
|
|
14
15
|
const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
15
16
|
try {
|
|
@@ -31,6 +32,10 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
31
32
|
])
|
|
32
33
|
]);
|
|
33
34
|
if (theme.status === 'rejected') {
|
|
35
|
+
sentry.sentryCaptureException('PreviewThemePageDocument', theme.reason, {
|
|
36
|
+
variables,
|
|
37
|
+
theme
|
|
38
|
+
});
|
|
34
39
|
throw new Error(theme.reason?.[0]);
|
|
35
40
|
}
|
|
36
41
|
const dataBuilder = theme.value.previewThemePage;
|
|
@@ -61,23 +61,28 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
61
61
|
]);
|
|
62
62
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
63
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 title = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_TITLE, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_TITLE)?.value;
|
|
64
65
|
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);
|
|
66
|
+
const noindex = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOINDEX_KEY, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.NOINDEX_KEY)?.value;
|
|
67
|
+
const nofollow = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOFOLLOW_KEY, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.NOFOLLOW_KEY)?.value;
|
|
65
68
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
66
69
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
67
70
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
68
71
|
const seo = {
|
|
69
72
|
defaultTitle: shopMeta?.shop.name,
|
|
70
|
-
title: dataBuilder?.name,
|
|
73
|
+
title: title || dataBuilder?.name,
|
|
71
74
|
description: description ?? shopMeta?.shop.description,
|
|
72
75
|
openGraph: {
|
|
73
76
|
site_name: shopMeta?.shop.name,
|
|
74
77
|
locale: shopMeta?.localization.country.isoCode,
|
|
75
|
-
title: dataBuilder?.name ?? shopMeta?.shop.name,
|
|
78
|
+
title: (title || dataBuilder?.name) ?? shopMeta?.shop.name,
|
|
76
79
|
description: description ?? shopMeta?.shop.description,
|
|
77
80
|
images: thumbnail ? [
|
|
78
81
|
thumbnail
|
|
79
82
|
] : []
|
|
80
83
|
},
|
|
84
|
+
noindex: noindex === 'true',
|
|
85
|
+
nofollow: nofollow === 'true',
|
|
81
86
|
canonical: `https://${shopData?.storeProperty?.primaryDomain}/${slug}`,
|
|
82
87
|
additionalMetaTags: [
|
|
83
88
|
{
|
|
@@ -36,7 +36,27 @@ const composeFonts = (fonts)=>{
|
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
|
-
const
|
|
39
|
+
const handleGenerateFontParams = (variants, fontType = 'google')=>{
|
|
40
|
+
const regularWeights = [];
|
|
41
|
+
if (!variants.length) {
|
|
42
|
+
return fontType === 'bunny' ? '400' : 'wght@400';
|
|
43
|
+
}
|
|
44
|
+
// Get regular weights and remove italic variants
|
|
45
|
+
variants.forEach((variant)=>{
|
|
46
|
+
if (typeof variant !== 'string' || variant?.includes('italic')) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const weight = variant === 'regular' ? '400' : variant;
|
|
50
|
+
regularWeights.push(weight);
|
|
51
|
+
});
|
|
52
|
+
// Sort weights numerically (ex: [900, 700, 400] -> [400, 700, 900])
|
|
53
|
+
const sortedRegularWeights = regularWeights.sort((a, b)=>Number(a) - Number(b));
|
|
54
|
+
// Build the variant string with only regular weights
|
|
55
|
+
const axisPrefix = 'wght@';
|
|
56
|
+
const listVariantsGoogleFonts = sortedRegularWeights.map((weight)=>weight);
|
|
57
|
+
return fontType === 'google' ? `${axisPrefix}${listVariantsGoogleFonts.join(';')}` : sortedRegularWeights.join(',');
|
|
58
|
+
};
|
|
59
|
+
const createFontUrl = (fonts, option, fontType = 'google')=>{
|
|
40
60
|
const mainFonts = fonts.filter((font)=>{
|
|
41
61
|
return !([
|
|
42
62
|
'bunny',
|
|
@@ -50,8 +70,8 @@ const createFontUrl = (fonts, option, fontType)=>{
|
|
|
50
70
|
return index === arr.findIndex((t)=>t.family === font.family);
|
|
51
71
|
});
|
|
52
72
|
const family = composeFonts(uniqFonts).map((font)=>{
|
|
53
|
-
return `${font.family.replace(/ /g, '+')}:${font.variants
|
|
54
|
-
}).join('|');
|
|
73
|
+
return `${font.family.replace(/ /g, '+')}:${handleGenerateFontParams(font.variants, fontType)}`;
|
|
74
|
+
}).join(fontType === 'google' ? '&family=' : '|');
|
|
55
75
|
params.append('family', family);
|
|
56
76
|
params.append('display', display);
|
|
57
77
|
if (option?.subset) {
|
|
@@ -61,7 +81,7 @@ const createFontUrl = (fonts, option, fontType)=>{
|
|
|
61
81
|
params.append('effect', option.effect);
|
|
62
82
|
}
|
|
63
83
|
const bunnyFontUrl = `https://fonts.bunny.net/css?family=${family}`;
|
|
64
|
-
const googleFontUrl = `https://fonts.googleapis.com/
|
|
84
|
+
const googleFontUrl = `https://fonts.googleapis.com/css2?${decodeURIComponent(params.toString())}`;
|
|
65
85
|
return fontType === 'bunny' ? bunnyFontUrl : googleFontUrl;
|
|
66
86
|
};
|
|
67
87
|
// eslint-disable-next-line max-params
|
|
@@ -87,7 +107,7 @@ async function getFonts(fonts, option, isImportFontByUrl = true, fontType) {
|
|
|
87
107
|
}
|
|
88
108
|
}
|
|
89
109
|
return value;
|
|
90
|
-
} catch (
|
|
110
|
+
} catch (_e) {
|
|
91
111
|
return '';
|
|
92
112
|
}
|
|
93
113
|
}
|
|
@@ -35,6 +35,9 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
const uniqueArray = (arr)=>{
|
|
39
|
+
return Array.from(new Set(arr));
|
|
40
|
+
};
|
|
38
41
|
const getFontValue = (fonts, value)=>{
|
|
39
42
|
let customFontFamily = value.custom?.fontFamily;
|
|
40
43
|
if (typeof customFontFamily === 'string') {
|
|
@@ -60,15 +63,18 @@ const getFontValue = (fonts, value)=>{
|
|
|
60
63
|
});
|
|
61
64
|
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
62
65
|
if (customFontWeight) {
|
|
66
|
+
const fontVariants = uniqueArray([
|
|
67
|
+
customFontWeight,
|
|
68
|
+
...value?.attrs?.isAlwaysLoadBold ? [
|
|
69
|
+
'700'
|
|
70
|
+
] : []
|
|
71
|
+
]);
|
|
63
72
|
const isExist = fonts.find((item)=>item.family == fontFamily && item.variants.includes(customFontWeight));
|
|
64
73
|
if (!isExist) {
|
|
65
74
|
const isFontFamily = fonts.find((item)=>item.family == fontFamily);
|
|
66
75
|
if (isFontFamily) {
|
|
67
76
|
isFontFamily.variants.push(customFontWeight);
|
|
68
77
|
} else {
|
|
69
|
-
const fontVariants = [
|
|
70
|
-
customFontWeight
|
|
71
|
-
];
|
|
72
78
|
if (customFontWeight !== '700') {
|
|
73
79
|
if (variants.includes('700')) {
|
|
74
80
|
fontVariants.push('700'); // Auto add 700 for bold in editor inline
|
|
@@ -74,7 +74,8 @@ function normalizePageSectionResponseV2(sections, orders) {
|
|
|
74
74
|
const parseBuilderTemplateV2 = (data)=>{
|
|
75
75
|
return normalizePageSectionResponseV2([
|
|
76
76
|
...data?.pageSections ?? [],
|
|
77
|
-
...data?.themePageCustomSections ?? []
|
|
77
|
+
...data?.themePageCustomSections ?? [],
|
|
78
|
+
...data?.themeSections ?? []
|
|
78
79
|
], data?.sectionPosition);
|
|
79
80
|
};
|
|
80
81
|
const parseBuilderTemplate = (data)=>{
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var nextjs = require('@sentry/nextjs');
|
|
4
|
+
|
|
5
|
+
const sentryCaptureException = (funcName, message, data, options)=>{
|
|
6
|
+
nextjs.withScope((scope)=>{
|
|
7
|
+
scope.setLevel(options?.level ?? 'log');
|
|
8
|
+
if (options?.tag) {
|
|
9
|
+
scope.setTag(options?.tag.key, options?.tag.value);
|
|
10
|
+
}
|
|
11
|
+
scope.setExtra('function', funcName);
|
|
12
|
+
scope.setExtra('data', JSON.stringify(data));
|
|
13
|
+
nextjs.captureMessage(`${funcName}: ${message}`);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.sentryCaptureException = sentryCaptureException;
|
package/dist/cjs/pages/404.js
CHANGED
package/dist/cjs/pages/500.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -17,6 +18,7 @@ var Body = require('../components/builder/Body.js');
|
|
|
17
18
|
|
|
18
19
|
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
|
|
19
20
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
21
|
+
const { t } = core.useI18n();
|
|
20
22
|
const isDisableHeaderFooter = ()=>{
|
|
21
23
|
return isThemeSectionEditor;
|
|
22
24
|
};
|
|
@@ -64,47 +66,50 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
64
66
|
components: components,
|
|
65
67
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
66
68
|
data: sectionData,
|
|
67
|
-
children: /*#__PURE__*/ jsxRuntime.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
69
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.I18nProvider, {
|
|
70
|
+
t: t,
|
|
71
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
|
|
72
|
+
pageName: pageName,
|
|
73
|
+
state: initState,
|
|
74
|
+
isThemeSectionEditor: isThemeSectionEditor,
|
|
75
|
+
children: [
|
|
76
|
+
/*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
|
|
77
|
+
!hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Toolbar.default, {}),
|
|
78
|
+
/*#__PURE__*/ jsxRuntime.jsx(PopupManager.default, {}),
|
|
79
|
+
loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
80
|
+
className: "builder gp-z-1 gp-relative",
|
|
81
|
+
children: [
|
|
82
|
+
!hiddenToolbar && (isDisableHeaderFooter() ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
83
|
+
className: "gp-h-[40px] gp-bg-[#ffffff] gp-border-b-[1px] gp-border-[#eeeeee]",
|
|
84
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(SwitchView.default, {})
|
|
85
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
|
|
86
|
+
pageType: pageType,
|
|
87
|
+
isOriginTemplate: isOriginTemplate,
|
|
88
|
+
openPageSetting: openPageSetting
|
|
89
|
+
})),
|
|
90
|
+
/*#__PURE__*/ jsxRuntime.jsx(Body.default, {
|
|
91
|
+
pageType: pageType,
|
|
92
|
+
isThemeSectionEditor: isThemeSectionEditor
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ jsxRuntime.jsx(ImageToLayout.default, {
|
|
95
|
+
editorImageToLayout: editorImageToLayout || false
|
|
96
|
+
}),
|
|
97
|
+
/*#__PURE__*/ jsxRuntime.jsx(AddSectionImageToLayout.default, {
|
|
98
|
+
editorImageToLayout: editorImageToLayout || false
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
101
|
+
id: "visual-content"
|
|
102
|
+
}),
|
|
103
|
+
!isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Footer.default, {
|
|
104
|
+
pageType: pageType,
|
|
105
|
+
isOriginTemplate: isOriginTemplate,
|
|
106
|
+
openPageSetting: openPageSetting
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}, "preview")
|
|
112
|
+
})
|
|
108
113
|
})
|
|
109
114
|
})
|
|
110
115
|
})
|