@gem-sdk/pages 2.0.0-dev.699 → 2.0.0-dev.709
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 -1
- 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 -1
- 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));
|
|
@@ -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));
|
|
@@ -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.709",
|
|
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.704",
|
|
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"
|