@gem-sdk/pages 2.0.0-dev.696 → 2.0.0-dev.701
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/Toolbar.js +6 -0
- package/dist/cjs/components/builder/Toolbox.js +3 -3
- package/dist/cjs/components/image-to-layout/DropElement.js +5 -4
- package/dist/cjs/libs/api/get-static-page-props-preview.js +5 -0
- package/dist/cjs/libs/helpers/sentry.js +17 -0
- package/dist/esm/components/builder/Toolbar.js +6 -0
- package/dist/esm/components/builder/Toolbox.js +3 -3
- package/dist/esm/components/image-to-layout/DropElement.js +6 -5
- package/dist/esm/libs/api/get-static-page-props-preview.js +5 -0
- package/dist/esm/libs/helpers/sentry.js +15 -0
- package/package.json +2 -2
|
@@ -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));
|
|
@@ -301,9 +301,9 @@ const Toolbox = ()=>{
|
|
|
301
301
|
changeShopPlan
|
|
302
302
|
]);
|
|
303
303
|
const onUpdatePriceWithCurrency = react.useCallback((e)=>{
|
|
304
|
-
const
|
|
305
|
-
if (!
|
|
306
|
-
updatePriceWithCurrency(
|
|
304
|
+
const showPriceCurrency = e.detail;
|
|
305
|
+
if (!showPriceCurrency) return;
|
|
306
|
+
updatePriceWithCurrency(showPriceCurrency);
|
|
307
307
|
}, [
|
|
308
308
|
updatePriceWithCurrency
|
|
309
309
|
]);
|
|
@@ -9,6 +9,7 @@ const SALE_FUNNEL_PAGE_TYPES = [
|
|
|
9
9
|
'GP_PRE_SALE_PAGE'
|
|
10
10
|
];
|
|
11
11
|
const DropElement = ()=>{
|
|
12
|
+
const { t } = core.useI18n();
|
|
12
13
|
const editingPageType = core.useShopStore((s)=>s.pageType);
|
|
13
14
|
const isFunnelSalesPage = SALE_FUNNEL_PAGE_TYPES.includes(editingPageType || '');
|
|
14
15
|
const dispatchEventBuildWithSectionActiveTab = (value)=>{
|
|
@@ -117,7 +118,7 @@ const DropElement = ()=>{
|
|
|
117
118
|
children: [
|
|
118
119
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
119
120
|
className: "gp-text-16 gp-font-medium gp-mb-4 gp-text-[#212121]",
|
|
120
|
-
children: isFunnelSalesPage ? 'Start building with Sections/Elements or' : 'Start with Sections from sidebar'
|
|
121
|
+
children: isFunnelSalesPage ? t('Start building with Sections/Elements or') : t('Start with Sections from sidebar')
|
|
121
122
|
}),
|
|
122
123
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
123
124
|
className: "gp-flex gp-gap-3 gp-justify-between",
|
|
@@ -130,7 +131,7 @@ const DropElement = ()=>{
|
|
|
130
131
|
} else dispatchEventBuildWithSectionActiveTab(true);
|
|
131
132
|
},
|
|
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]",
|
|
133
|
-
children: isFunnelSalesPage ? 'Use existing page designs' : 'Add sections'
|
|
134
|
+
children: isFunnelSalesPage ? t('Use existing page designs') : t('Add sections')
|
|
134
135
|
}),
|
|
135
136
|
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
136
137
|
"data-button-add-elements": true,
|
|
@@ -140,7 +141,7 @@ const DropElement = ()=>{
|
|
|
140
141
|
} else dispatchEventBuildWithSectionActiveTab(false);
|
|
141
142
|
},
|
|
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]",
|
|
143
|
-
children: isFunnelSalesPage ? 'Explore templates' : 'Add elements'
|
|
144
|
+
children: isFunnelSalesPage ? t('Explore templates') : t('Add elements')
|
|
144
145
|
})
|
|
145
146
|
]
|
|
146
147
|
}),
|
|
@@ -179,7 +180,7 @@ const DropElement = ()=>{
|
|
|
179
180
|
"aria-hidden": "true",
|
|
180
181
|
id: "gp-img-to-layout-gallery-btn",
|
|
181
182
|
className: "gp-relative gp-cursor-pointer gp-text-[14px] gp-font-medium gp-text-[#3C67FF]",
|
|
182
|
-
children:
|
|
183
|
+
children: t('Start with Generating from URL or image')
|
|
183
184
|
})
|
|
184
185
|
})
|
|
185
186
|
]
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -407,6 +407,7 @@ const Toolbar = ()=>{
|
|
|
407
407
|
if (!value || !currentComponentActive.current) {
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
|
+
let isClickProcessing = false;
|
|
410
411
|
const selector = getSelectorComponent({
|
|
411
412
|
...currentComponentActive.current
|
|
412
413
|
});
|
|
@@ -415,6 +416,7 @@ const Toolbar = ()=>{
|
|
|
415
416
|
const $parents = $component?.querySelectorAll('[data-toolbar-parent]');
|
|
416
417
|
if ($parents.length) {
|
|
417
418
|
const onHover = ($parent)=>{
|
|
419
|
+
if (isClickProcessing) return;
|
|
418
420
|
const uid = $parent.getAttribute('data-parent-uid');
|
|
419
421
|
if (!uid) return;
|
|
420
422
|
const $parentComponents = document.body.querySelector('#storefront')?.querySelectorAll(`[data-uid="${uid}"]`);
|
|
@@ -443,6 +445,7 @@ const Toolbar = ()=>{
|
|
|
443
445
|
}
|
|
444
446
|
};
|
|
445
447
|
const onClick = async ($parent)=>{
|
|
448
|
+
isClickProcessing = true;
|
|
446
449
|
const uid = $parent.getAttribute('data-parent-uid');
|
|
447
450
|
if (!uid) return;
|
|
448
451
|
const isElementInsideProduct = async ()=>{
|
|
@@ -474,6 +477,9 @@ const Toolbar = ()=>{
|
|
|
474
477
|
});
|
|
475
478
|
outHover($parent);
|
|
476
479
|
window.dispatchEvent(event);
|
|
480
|
+
setTimeout(()=>{
|
|
481
|
+
isClickProcessing = false;
|
|
482
|
+
}, 0);
|
|
477
483
|
};
|
|
478
484
|
$parents.forEach(($parent)=>{
|
|
479
485
|
$parent.addEventListener('mouseover', ()=>onHover($parent));
|
|
@@ -297,9 +297,9 @@ const Toolbox = ()=>{
|
|
|
297
297
|
changeShopPlan
|
|
298
298
|
]);
|
|
299
299
|
const onUpdatePriceWithCurrency = useCallback((e)=>{
|
|
300
|
-
const
|
|
301
|
-
if (!
|
|
302
|
-
updatePriceWithCurrency(
|
|
300
|
+
const showPriceCurrency = e.detail;
|
|
301
|
+
if (!showPriceCurrency) return;
|
|
302
|
+
updatePriceWithCurrency(showPriceCurrency);
|
|
303
303
|
}, [
|
|
304
304
|
updatePriceWithCurrency
|
|
305
305
|
]);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useShopStore } from '@gem-sdk/core';
|
|
3
|
+
import { useI18n, useShopStore } from '@gem-sdk/core';
|
|
4
4
|
|
|
5
5
|
const SALE_FUNNEL_PAGE_TYPES = [
|
|
6
6
|
'GP_FUNNEL_PAGE',
|
|
7
7
|
'GP_PRE_SALE_PAGE'
|
|
8
8
|
];
|
|
9
9
|
const DropElement = ()=>{
|
|
10
|
+
const { t } = useI18n();
|
|
10
11
|
const editingPageType = useShopStore((s)=>s.pageType);
|
|
11
12
|
const isFunnelSalesPage = SALE_FUNNEL_PAGE_TYPES.includes(editingPageType || '');
|
|
12
13
|
const dispatchEventBuildWithSectionActiveTab = (value)=>{
|
|
@@ -115,7 +116,7 @@ const DropElement = ()=>{
|
|
|
115
116
|
children: [
|
|
116
117
|
/*#__PURE__*/ jsx("div", {
|
|
117
118
|
className: "gp-text-16 gp-font-medium gp-mb-4 gp-text-[#212121]",
|
|
118
|
-
children: isFunnelSalesPage ? 'Start building with Sections/Elements or' : 'Start with Sections from sidebar'
|
|
119
|
+
children: isFunnelSalesPage ? t('Start building with Sections/Elements or') : t('Start with Sections from sidebar')
|
|
119
120
|
}),
|
|
120
121
|
/*#__PURE__*/ jsxs("div", {
|
|
121
122
|
className: "gp-flex gp-gap-3 gp-justify-between",
|
|
@@ -128,7 +129,7 @@ const DropElement = ()=>{
|
|
|
128
129
|
} else dispatchEventBuildWithSectionActiveTab(true);
|
|
129
130
|
},
|
|
130
131
|
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]",
|
|
131
|
-
children: isFunnelSalesPage ? 'Use existing page designs' : 'Add sections'
|
|
132
|
+
children: isFunnelSalesPage ? t('Use existing page designs') : t('Add sections')
|
|
132
133
|
}),
|
|
133
134
|
/*#__PURE__*/ jsx("button", {
|
|
134
135
|
"data-button-add-elements": true,
|
|
@@ -138,7 +139,7 @@ const DropElement = ()=>{
|
|
|
138
139
|
} else dispatchEventBuildWithSectionActiveTab(false);
|
|
139
140
|
},
|
|
140
141
|
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]",
|
|
141
|
-
children: isFunnelSalesPage ? 'Explore templates' : 'Add elements'
|
|
142
|
+
children: isFunnelSalesPage ? t('Explore templates') : t('Add elements')
|
|
142
143
|
})
|
|
143
144
|
]
|
|
144
145
|
}),
|
|
@@ -177,7 +178,7 @@ const DropElement = ()=>{
|
|
|
177
178
|
"aria-hidden": "true",
|
|
178
179
|
id: "gp-img-to-layout-gallery-btn",
|
|
179
180
|
className: "gp-relative gp-cursor-pointer gp-text-[14px] gp-font-medium gp-text-[#3C67FF]",
|
|
180
|
-
children:
|
|
181
|
+
children: t('Start with Generating from URL or image')
|
|
181
182
|
})
|
|
182
183
|
})
|
|
183
184
|
]
|
|
@@ -8,6 +8,7 @@ import { getFallbackV2 } from '../helpers/get-fallback.js';
|
|
|
8
8
|
import { parseBuilderTemplateV2, extractPageBackground } from '../helpers/normalize.js';
|
|
9
9
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
10
10
|
import { getCustomFonts } from '../custom-fonts.js';
|
|
11
|
+
import { sentryCaptureException } from '../helpers/sentry.js';
|
|
11
12
|
|
|
12
13
|
const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
13
14
|
try {
|
|
@@ -29,6 +30,10 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
29
30
|
])
|
|
30
31
|
]);
|
|
31
32
|
if (theme.status === 'rejected') {
|
|
33
|
+
sentryCaptureException('PreviewThemePageDocument', theme.reason, {
|
|
34
|
+
variables,
|
|
35
|
+
theme
|
|
36
|
+
});
|
|
32
37
|
throw new Error(theme.reason?.[0]);
|
|
33
38
|
}
|
|
34
39
|
const dataBuilder = theme.value.previewThemePage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { withScope, captureMessage } from '@sentry/nextjs';
|
|
2
|
+
|
|
3
|
+
const sentryCaptureException = (funcName, message, data, options)=>{
|
|
4
|
+
withScope((scope)=>{
|
|
5
|
+
scope.setLevel(options?.level ?? 'log');
|
|
6
|
+
if (options?.tag) {
|
|
7
|
+
scope.setTag(options?.tag.key, options?.tag.value);
|
|
8
|
+
}
|
|
9
|
+
scope.setExtra('function', funcName);
|
|
10
|
+
scope.setExtra('data', JSON.stringify(data));
|
|
11
|
+
captureMessage(`${funcName}: ${message}`);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { sentryCaptureException };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.701",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"next": "14.2.20"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
29
|
+
"@gem-sdk/core": "2.0.0-dev.701",
|
|
30
30
|
"@gem-sdk/plugin-cookie-bar": "2.0.0-dev.695",
|
|
31
31
|
"@gem-sdk/plugin-quick-view": "2.0.0-dev.695",
|
|
32
32
|
"@gem-sdk/plugin-sticky-add-to-cart": "2.0.0-dev.695"
|