@gem-sdk/pages 1.44.2-staging.87 → 1.45.0-dev.91
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/Header.js +4 -1
- package/dist/cjs/components/builder/InteractionSelectOnPageHeader.js +61 -0
- package/dist/cjs/components/builder/PopupManager.js +1 -1
- package/dist/cjs/components/builder/Toolbar.js +17 -7
- package/dist/cjs/components/builder/Toolbox.js +21 -1
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +2 -2
- package/dist/cjs/libs/hooks/use-tracking-view.js +1 -4
- package/dist/esm/components/builder/Header.js +5 -2
- package/dist/esm/components/builder/InteractionSelectOnPageHeader.js +57 -0
- package/dist/esm/components/builder/PopupManager.js +1 -1
- package/dist/esm/components/builder/Toolbar.js +17 -7
- package/dist/esm/components/builder/Toolbox.js +21 -1
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +2 -2
- package/dist/esm/libs/hooks/use-tracking-view.js +1 -4
- package/package.json +5 -5
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var SwitchView = require('./SwitchView.js');
|
|
8
|
+
var InteractionSelectOnPageHeader = require('./InteractionSelectOnPageHeader.js');
|
|
8
9
|
|
|
9
10
|
const defaultMargin = {
|
|
10
11
|
desktop: '16px',
|
|
@@ -21,6 +22,7 @@ const sizeCheck = {
|
|
|
21
22
|
const Header = (props)=>{
|
|
22
23
|
const { pageType, isOriginTemplate } = props;
|
|
23
24
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
25
|
+
const isSelectOnPage = core.usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
24
26
|
const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
|
|
25
27
|
const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
|
|
26
28
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -177,7 +179,8 @@ const Header = (props)=>{
|
|
|
177
179
|
})
|
|
178
180
|
]
|
|
179
181
|
})
|
|
180
|
-
})
|
|
182
|
+
}),
|
|
183
|
+
isSelectOnPage && /*#__PURE__*/ jsxRuntime.jsx(InteractionSelectOnPageHeader.default, {})
|
|
181
184
|
]
|
|
182
185
|
});
|
|
183
186
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var core = require('@gem-sdk/core');
|
|
7
|
+
|
|
8
|
+
const InteractionSelectOnPageHeader = ()=>{
|
|
9
|
+
const selectType = core.usePageStore((s)=>s.interactionData?.selectType);
|
|
10
|
+
const setInteractionSelectType = core.usePageStore((s)=>s.setInteractionSelectType);
|
|
11
|
+
const setInteractionIsSelectOnPage = core.usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
12
|
+
const closeSelectOnPage = ()=>{
|
|
13
|
+
setInteractionIsSelectOnPage(false);
|
|
14
|
+
const event = new CustomEvent('editor:interaction:change-select-on-page', {
|
|
15
|
+
bubbles: true,
|
|
16
|
+
detail: false
|
|
17
|
+
});
|
|
18
|
+
window.dispatchEvent(event);
|
|
19
|
+
};
|
|
20
|
+
console.log('selectType123', selectType);
|
|
21
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("header", {
|
|
22
|
+
className: "gp-flex gp-justify-between gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full",
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
25
|
+
className: "gp-h-10 gp-w-10"
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ jsxRuntime.jsxs("section", {
|
|
28
|
+
className: "gp-flex gp-bg-[#3C67FF]/[0.15] gp-items-center gp-h-full gp-rounded-b-lg gp-p-1 gp-gap-1",
|
|
29
|
+
children: [
|
|
30
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
31
|
+
onClick: ()=>setInteractionSelectType('element'),
|
|
32
|
+
className: `gp-h-8 gp-w-[132px] gp-items-center gp-justify-center gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-[6px] ${selectType === 'element' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#3C67FF]'}`,
|
|
33
|
+
children: "Select an element"
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
36
|
+
onClick: ()=>setInteractionSelectType('page'),
|
|
37
|
+
className: `gp-h-8 gp-w-[132px] gp-items-center gp-justify-center gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-[6px] ${selectType === 'page' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#3C67FF]'}`,
|
|
38
|
+
children: "Choose entire page"
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
43
|
+
onClick: closeSelectOnPage,
|
|
44
|
+
className: "gp-h-10 gp-w-10 gp-bg-[#3C67FF]/[0.15] gp-flex gp-items-center gp-justify-center gp-rounded-bl-lg",
|
|
45
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
46
|
+
width: "20",
|
|
47
|
+
height: "20",
|
|
48
|
+
viewBox: "0 0 20 20",
|
|
49
|
+
fill: "none",
|
|
50
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
51
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
52
|
+
d: "M3.94194 3.05806C3.69786 2.81398 3.30214 2.81398 3.05806 3.05806C2.81398 3.30214 2.81398 3.69786 3.05806 3.94194L9.11612 10L3.05806 16.0581C2.81398 16.3021 2.81398 16.6979 3.05806 16.9419C3.30214 17.186 3.69786 17.186 3.94194 16.9419L10 10.8839L16.0581 16.9419C16.3021 17.186 16.6979 17.186 16.9419 16.9419C17.186 16.6979 17.186 16.3021 16.9419 16.0581L10.8839 10L16.9419 3.94194C17.186 3.69786 17.186 3.30214 16.9419 3.05806C16.6979 2.81398 16.3021 2.81398 16.0581 3.05806L10 9.11612L3.94194 3.05806Z",
|
|
53
|
+
fill: "#3C67FF"
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.default = InteractionSelectOnPageHeader;
|
|
@@ -379,23 +379,30 @@ const Toolbar = ()=>{
|
|
|
379
379
|
countShowOnboarding,
|
|
380
380
|
onCloseOnboarding
|
|
381
381
|
]);
|
|
382
|
-
const getSelectorComponent = ({ componentUid, productId, articleId })=>{
|
|
382
|
+
const getSelectorComponent = ({ componentUid, productId, articleId, marqueeKey })=>{
|
|
383
383
|
if (articleId) {
|
|
384
384
|
return `${articleId ? `[data-article-id="${articleId}"][data-uid="${componentUid}"], [data-article-id="${articleId}"] [data-uid="${componentUid}"]` : `[data-uid="${componentUid}"]`}`;
|
|
385
385
|
}
|
|
386
|
+
if (marqueeKey) {
|
|
387
|
+
return `[marquee-item-key="${marqueeKey}"] [data-uid="${componentUid}"]`;
|
|
388
|
+
}
|
|
386
389
|
return `${productId ? `[data-product-id="${productId}"][data-uid="${componentUid}"], [data-product-id="${productId}"] [data-uid="${componentUid}"]` : `[data-uid="${componentUid}"]`}`;
|
|
387
390
|
};
|
|
388
|
-
const setActiveComponent = react.useCallback(async ({ componentUid, productId, timeAwait =
|
|
391
|
+
const setActiveComponent = react.useCallback(async ({ componentUid, productId, timeAwait = 600, articleId, forceReActive, marqueeKey })=>{
|
|
389
392
|
if (!componentUid) return;
|
|
390
393
|
const selector = getSelectorComponent({
|
|
391
394
|
componentUid,
|
|
392
395
|
productId,
|
|
393
|
-
articleId
|
|
396
|
+
articleId,
|
|
397
|
+
marqueeKey
|
|
394
398
|
});
|
|
395
399
|
const $component = await waitForElementToExist(selector, timeAwait);
|
|
396
400
|
if (!$component) return;
|
|
397
|
-
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId && articleId == currentComponentActive.current?.articleId) return;
|
|
401
|
+
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId && articleId == currentComponentActive.current?.articleId && marqueeKey == currentComponentActive.current?.marqueeKey) return;
|
|
398
402
|
if (componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || articleId !== currentComponentActive.current?.articleId || forceReActive) removeActiveComponent();
|
|
403
|
+
if (!forceReActive && componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || marqueeKey !== currentComponentActive.current?.marqueeKey) {
|
|
404
|
+
removeActiveComponent();
|
|
405
|
+
}
|
|
399
406
|
const $toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
|
|
400
407
|
const $outline = getChildrenByAttrSelector($component, 'data-outline');
|
|
401
408
|
const $btnAddTop = getChildrenByAttrSelector($component, 'data-toolbar-add-top');
|
|
@@ -404,7 +411,8 @@ const Toolbar = ()=>{
|
|
|
404
411
|
currentComponentActive.current = {
|
|
405
412
|
componentUid,
|
|
406
413
|
productId,
|
|
407
|
-
articleId
|
|
414
|
+
articleId,
|
|
415
|
+
marqueeKey
|
|
408
416
|
};
|
|
409
417
|
$toolbar.removeAttribute('style');
|
|
410
418
|
$toolbar.setAttribute('data-toolbar-active', 'true');
|
|
@@ -423,8 +431,9 @@ const Toolbar = ()=>{
|
|
|
423
431
|
if ($btnAddBottom) {
|
|
424
432
|
$btnAddBottom.setAttribute('data-toolbar-add-active', 'true');
|
|
425
433
|
}
|
|
434
|
+
const isChildOfMarquee = !!$component.closest('[data-component-tag="Marquee"]');
|
|
426
435
|
// Active same element in product list
|
|
427
|
-
if (productId || articleId) {
|
|
436
|
+
if (productId || articleId || isChildOfMarquee) {
|
|
428
437
|
const $relatedElements = document.querySelectorAll(`[data-uid="${componentUid}"]`);
|
|
429
438
|
if ($relatedElements?.length) {
|
|
430
439
|
$relatedElements.forEach(($relatedElement)=>{
|
|
@@ -685,7 +694,8 @@ const Toolbar = ()=>{
|
|
|
685
694
|
setActiveComponent({
|
|
686
695
|
componentUid: detail.componentUid,
|
|
687
696
|
productId: detail.productId,
|
|
688
|
-
articleId: detail.articleId
|
|
697
|
+
articleId: detail.articleId,
|
|
698
|
+
marqueeKey: detail.marqueeKey
|
|
689
699
|
});
|
|
690
700
|
} else {
|
|
691
701
|
removeActiveComponent();
|
|
@@ -36,6 +36,8 @@ const Toolbox = ()=>{
|
|
|
36
36
|
const changeCreateThemeSectionCount = core.useShopStore((s)=>s.changeCreateThemeSectionCount);
|
|
37
37
|
const changeShopPlan = core.useShopStore((s)=>s.changeShopPlan);
|
|
38
38
|
const clearModal = core.useModalStore((s)=>s.clearModal);
|
|
39
|
+
const setInteractionIsSelectOnPage = core.usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
40
|
+
const setInteractionItem = core.usePageStore((s)=>s.setInteractionItem);
|
|
39
41
|
const fonts = react.useMemo(()=>genFonts.getFontsFromDataBuilder(state), [
|
|
40
42
|
state
|
|
41
43
|
]);
|
|
@@ -329,6 +331,18 @@ const Toolbox = ()=>{
|
|
|
329
331
|
}, [
|
|
330
332
|
setSalePageProductId
|
|
331
333
|
]);
|
|
334
|
+
const onUpdateInteractionIsSelectOnPage = react.useCallback((e)=>{
|
|
335
|
+
const isSelectOnPage = e.detail;
|
|
336
|
+
setInteractionIsSelectOnPage(isSelectOnPage);
|
|
337
|
+
}, [
|
|
338
|
+
setInteractionIsSelectOnPage
|
|
339
|
+
]);
|
|
340
|
+
const onUpdateInteractionItem = react.useCallback((e)=>{
|
|
341
|
+
const interactionItem = e.detail;
|
|
342
|
+
setInteractionItem(interactionItem);
|
|
343
|
+
}, [
|
|
344
|
+
setInteractionItem
|
|
345
|
+
]);
|
|
332
346
|
react.useEffect(()=>{
|
|
333
347
|
if (fonts) {
|
|
334
348
|
setFontsToHead('google-font-element', fonts);
|
|
@@ -356,6 +370,8 @@ const Toolbox = ()=>{
|
|
|
356
370
|
window.addEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
357
371
|
window.addEventListener('set-product-offer', onUpdateProductOffers);
|
|
358
372
|
window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
373
|
+
window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
374
|
+
window.addEventListener('update-interaction-item', onUpdateInteractionItem);
|
|
359
375
|
return ()=>{
|
|
360
376
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
361
377
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -375,6 +391,8 @@ const Toolbox = ()=>{
|
|
|
375
391
|
window.removeEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
376
392
|
window.removeEventListener('set-product-offer', onUpdateProductOffers);
|
|
377
393
|
window.removeEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
394
|
+
window.removeEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
395
|
+
window.removeEventListener('update-interaction-item', onUpdateInteractionItem);
|
|
378
396
|
};
|
|
379
397
|
}, [
|
|
380
398
|
onAddEntity,
|
|
@@ -395,7 +413,9 @@ const Toolbox = ()=>{
|
|
|
395
413
|
onUpdateItemName,
|
|
396
414
|
onUpdateItemAttribute,
|
|
397
415
|
onUpdateProductOffers,
|
|
398
|
-
onUpdateSalePageProductId
|
|
416
|
+
onUpdateSalePageProductId,
|
|
417
|
+
onUpdateInteractionItem,
|
|
418
|
+
onUpdateInteractionIsSelectOnPage
|
|
399
419
|
]);
|
|
400
420
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
401
421
|
className: "toolbox"
|
|
@@ -89,12 +89,12 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
89
89
|
}),
|
|
90
90
|
ACTIONS_DATA.map((action)=>{
|
|
91
91
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
92
|
-
className: `gp-relative gp-mx-1 gp-h-[60px] gp-w-[172px] 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 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
92
|
+
className: `gp-relative gp-mx-1 gp-h-[60px] mobile:gp-h-[72px] gp-w-[172px] 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 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
93
93
|
id: action.id,
|
|
94
94
|
"aria-hidden": true,
|
|
95
95
|
children: [
|
|
96
96
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
97
|
-
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121]",
|
|
97
|
+
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121] mobile:gp-flex-col mobile:gp-items-center mobile:gp-gap-0",
|
|
98
98
|
children: [
|
|
99
99
|
action.title,
|
|
100
100
|
action.hasAILogo && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@gem-sdk/core');
|
|
4
4
|
var react = require('react');
|
|
5
|
-
var userAgent = require('../helpers/user-agent.js');
|
|
6
5
|
|
|
7
6
|
const useTrackingView = (token, handle, isFallback)=>{
|
|
8
7
|
const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
|
|
9
8
|
const apiURL = process.env.NEXT_PUBLIC_API_URL;
|
|
10
9
|
const sendTracking = react.useCallback((handle)=>{
|
|
11
10
|
if (!apiURL || !shopToken) return;
|
|
12
|
-
const bot = userAgent.isBot(navigator.userAgent);
|
|
13
11
|
const variables = {
|
|
14
|
-
pageHandle: handle
|
|
15
|
-
userAgent: bot ? 'BOT' : 'BROWSER'
|
|
12
|
+
pageHandle: handle
|
|
16
13
|
};
|
|
17
14
|
const headers = {
|
|
18
15
|
'Content-Type': 'application/json',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useShopStore, cls, makeStyleResponsive } from '@gem-sdk/core';
|
|
2
|
+
import { useShopStore, usePageStore, cls, makeStyleResponsive } from '@gem-sdk/core';
|
|
3
3
|
import Devices from './SwitchView.js';
|
|
4
|
+
import InteractionSelectOnPageHeader from './InteractionSelectOnPageHeader.js';
|
|
4
5
|
|
|
5
6
|
const defaultMargin = {
|
|
6
7
|
desktop: '16px',
|
|
@@ -17,6 +18,7 @@ const sizeCheck = {
|
|
|
17
18
|
const Header = (props)=>{
|
|
18
19
|
const { pageType, isOriginTemplate } = props;
|
|
19
20
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
21
|
+
const isSelectOnPage = usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
20
22
|
const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
|
|
21
23
|
const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
|
|
22
24
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -173,7 +175,8 @@ const Header = (props)=>{
|
|
|
173
175
|
})
|
|
174
176
|
]
|
|
175
177
|
})
|
|
176
|
-
})
|
|
178
|
+
}),
|
|
179
|
+
isSelectOnPage && /*#__PURE__*/ jsx(InteractionSelectOnPageHeader, {})
|
|
177
180
|
]
|
|
178
181
|
});
|
|
179
182
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { usePageStore } from '@gem-sdk/core';
|
|
3
|
+
|
|
4
|
+
const InteractionSelectOnPageHeader = ()=>{
|
|
5
|
+
const selectType = usePageStore((s)=>s.interactionData?.selectType);
|
|
6
|
+
const setInteractionSelectType = usePageStore((s)=>s.setInteractionSelectType);
|
|
7
|
+
const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
8
|
+
const closeSelectOnPage = ()=>{
|
|
9
|
+
setInteractionIsSelectOnPage(false);
|
|
10
|
+
const event = new CustomEvent('editor:interaction:change-select-on-page', {
|
|
11
|
+
bubbles: true,
|
|
12
|
+
detail: false
|
|
13
|
+
});
|
|
14
|
+
window.dispatchEvent(event);
|
|
15
|
+
};
|
|
16
|
+
console.log('selectType123', selectType);
|
|
17
|
+
return /*#__PURE__*/ jsxs("header", {
|
|
18
|
+
className: "gp-flex gp-justify-between gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full",
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx("div", {
|
|
21
|
+
className: "gp-h-10 gp-w-10"
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ jsxs("section", {
|
|
24
|
+
className: "gp-flex gp-bg-[#3C67FF]/[0.15] gp-items-center gp-h-full gp-rounded-b-lg gp-p-1 gp-gap-1",
|
|
25
|
+
children: [
|
|
26
|
+
/*#__PURE__*/ jsx("button", {
|
|
27
|
+
onClick: ()=>setInteractionSelectType('element'),
|
|
28
|
+
className: `gp-h-8 gp-w-[132px] gp-items-center gp-justify-center gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-[6px] ${selectType === 'element' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#3C67FF]'}`,
|
|
29
|
+
children: "Select an element"
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx("button", {
|
|
32
|
+
onClick: ()=>setInteractionSelectType('page'),
|
|
33
|
+
className: `gp-h-8 gp-w-[132px] gp-items-center gp-justify-center gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-[6px] ${selectType === 'page' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#3C67FF]'}`,
|
|
34
|
+
children: "Choose entire page"
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ jsx("button", {
|
|
39
|
+
onClick: closeSelectOnPage,
|
|
40
|
+
className: "gp-h-10 gp-w-10 gp-bg-[#3C67FF]/[0.15] gp-flex gp-items-center gp-justify-center gp-rounded-bl-lg",
|
|
41
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
42
|
+
width: "20",
|
|
43
|
+
height: "20",
|
|
44
|
+
viewBox: "0 0 20 20",
|
|
45
|
+
fill: "none",
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
48
|
+
d: "M3.94194 3.05806C3.69786 2.81398 3.30214 2.81398 3.05806 3.05806C2.81398 3.30214 2.81398 3.69786 3.05806 3.94194L9.11612 10L3.05806 16.0581C2.81398 16.3021 2.81398 16.6979 3.05806 16.9419C3.30214 17.186 3.69786 17.186 3.94194 16.9419L10 10.8839L16.0581 16.9419C16.3021 17.186 16.6979 17.186 16.9419 16.9419C17.186 16.6979 17.186 16.3021 16.9419 16.0581L10.8839 10L16.9419 3.94194C17.186 3.69786 17.186 3.30214 16.9419 3.05806C16.6979 2.81398 16.3021 2.81398 16.0581 3.05806L10 9.11612L3.94194 3.05806Z",
|
|
49
|
+
fill: "#3C67FF"
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { InteractionSelectOnPageHeader as default };
|
|
@@ -375,23 +375,30 @@ const Toolbar = ()=>{
|
|
|
375
375
|
countShowOnboarding,
|
|
376
376
|
onCloseOnboarding
|
|
377
377
|
]);
|
|
378
|
-
const getSelectorComponent = ({ componentUid, productId, articleId })=>{
|
|
378
|
+
const getSelectorComponent = ({ componentUid, productId, articleId, marqueeKey })=>{
|
|
379
379
|
if (articleId) {
|
|
380
380
|
return `${articleId ? `[data-article-id="${articleId}"][data-uid="${componentUid}"], [data-article-id="${articleId}"] [data-uid="${componentUid}"]` : `[data-uid="${componentUid}"]`}`;
|
|
381
381
|
}
|
|
382
|
+
if (marqueeKey) {
|
|
383
|
+
return `[marquee-item-key="${marqueeKey}"] [data-uid="${componentUid}"]`;
|
|
384
|
+
}
|
|
382
385
|
return `${productId ? `[data-product-id="${productId}"][data-uid="${componentUid}"], [data-product-id="${productId}"] [data-uid="${componentUid}"]` : `[data-uid="${componentUid}"]`}`;
|
|
383
386
|
};
|
|
384
|
-
const setActiveComponent = useCallback(async ({ componentUid, productId, timeAwait =
|
|
387
|
+
const setActiveComponent = useCallback(async ({ componentUid, productId, timeAwait = 600, articleId, forceReActive, marqueeKey })=>{
|
|
385
388
|
if (!componentUid) return;
|
|
386
389
|
const selector = getSelectorComponent({
|
|
387
390
|
componentUid,
|
|
388
391
|
productId,
|
|
389
|
-
articleId
|
|
392
|
+
articleId,
|
|
393
|
+
marqueeKey
|
|
390
394
|
});
|
|
391
395
|
const $component = await waitForElementToExist(selector, timeAwait);
|
|
392
396
|
if (!$component) return;
|
|
393
|
-
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId && articleId == currentComponentActive.current?.articleId) return;
|
|
397
|
+
if (!forceReActive && componentUid == currentComponentActive.current?.componentUid && productId == currentComponentActive.current?.productId && articleId == currentComponentActive.current?.articleId && marqueeKey == currentComponentActive.current?.marqueeKey) return;
|
|
394
398
|
if (componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || articleId !== currentComponentActive.current?.articleId || forceReActive) removeActiveComponent();
|
|
399
|
+
if (!forceReActive && componentUid !== currentComponentActive.current?.componentUid || productId !== currentComponentActive.current?.productId || marqueeKey !== currentComponentActive.current?.marqueeKey) {
|
|
400
|
+
removeActiveComponent();
|
|
401
|
+
}
|
|
395
402
|
const $toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
|
|
396
403
|
const $outline = getChildrenByAttrSelector($component, 'data-outline');
|
|
397
404
|
const $btnAddTop = getChildrenByAttrSelector($component, 'data-toolbar-add-top');
|
|
@@ -400,7 +407,8 @@ const Toolbar = ()=>{
|
|
|
400
407
|
currentComponentActive.current = {
|
|
401
408
|
componentUid,
|
|
402
409
|
productId,
|
|
403
|
-
articleId
|
|
410
|
+
articleId,
|
|
411
|
+
marqueeKey
|
|
404
412
|
};
|
|
405
413
|
$toolbar.removeAttribute('style');
|
|
406
414
|
$toolbar.setAttribute('data-toolbar-active', 'true');
|
|
@@ -419,8 +427,9 @@ const Toolbar = ()=>{
|
|
|
419
427
|
if ($btnAddBottom) {
|
|
420
428
|
$btnAddBottom.setAttribute('data-toolbar-add-active', 'true');
|
|
421
429
|
}
|
|
430
|
+
const isChildOfMarquee = !!$component.closest('[data-component-tag="Marquee"]');
|
|
422
431
|
// Active same element in product list
|
|
423
|
-
if (productId || articleId) {
|
|
432
|
+
if (productId || articleId || isChildOfMarquee) {
|
|
424
433
|
const $relatedElements = document.querySelectorAll(`[data-uid="${componentUid}"]`);
|
|
425
434
|
if ($relatedElements?.length) {
|
|
426
435
|
$relatedElements.forEach(($relatedElement)=>{
|
|
@@ -681,7 +690,8 @@ const Toolbar = ()=>{
|
|
|
681
690
|
setActiveComponent({
|
|
682
691
|
componentUid: detail.componentUid,
|
|
683
692
|
productId: detail.productId,
|
|
684
|
-
articleId: detail.articleId
|
|
693
|
+
articleId: detail.articleId,
|
|
694
|
+
marqueeKey: detail.marqueeKey
|
|
685
695
|
});
|
|
686
696
|
} else {
|
|
687
697
|
removeActiveComponent();
|
|
@@ -32,6 +32,8 @@ const Toolbox = ()=>{
|
|
|
32
32
|
const changeCreateThemeSectionCount = useShopStore((s)=>s.changeCreateThemeSectionCount);
|
|
33
33
|
const changeShopPlan = useShopStore((s)=>s.changeShopPlan);
|
|
34
34
|
const clearModal = useModalStore((s)=>s.clearModal);
|
|
35
|
+
const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
|
|
36
|
+
const setInteractionItem = usePageStore((s)=>s.setInteractionItem);
|
|
35
37
|
const fonts = useMemo(()=>getFontsFromDataBuilder(state), [
|
|
36
38
|
state
|
|
37
39
|
]);
|
|
@@ -325,6 +327,18 @@ const Toolbox = ()=>{
|
|
|
325
327
|
}, [
|
|
326
328
|
setSalePageProductId
|
|
327
329
|
]);
|
|
330
|
+
const onUpdateInteractionIsSelectOnPage = useCallback((e)=>{
|
|
331
|
+
const isSelectOnPage = e.detail;
|
|
332
|
+
setInteractionIsSelectOnPage(isSelectOnPage);
|
|
333
|
+
}, [
|
|
334
|
+
setInteractionIsSelectOnPage
|
|
335
|
+
]);
|
|
336
|
+
const onUpdateInteractionItem = useCallback((e)=>{
|
|
337
|
+
const interactionItem = e.detail;
|
|
338
|
+
setInteractionItem(interactionItem);
|
|
339
|
+
}, [
|
|
340
|
+
setInteractionItem
|
|
341
|
+
]);
|
|
328
342
|
useEffect(()=>{
|
|
329
343
|
if (fonts) {
|
|
330
344
|
setFontsToHead('google-font-element', fonts);
|
|
@@ -352,6 +366,8 @@ const Toolbox = ()=>{
|
|
|
352
366
|
window.addEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
353
367
|
window.addEventListener('set-product-offer', onUpdateProductOffers);
|
|
354
368
|
window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
369
|
+
window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
370
|
+
window.addEventListener('update-interaction-item', onUpdateInteractionItem);
|
|
355
371
|
return ()=>{
|
|
356
372
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
357
373
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -371,6 +387,8 @@ const Toolbox = ()=>{
|
|
|
371
387
|
window.removeEventListener('update-item-attribute', onUpdateItemAttribute);
|
|
372
388
|
window.removeEventListener('set-product-offer', onUpdateProductOffers);
|
|
373
389
|
window.removeEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
|
|
390
|
+
window.removeEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
|
|
391
|
+
window.removeEventListener('update-interaction-item', onUpdateInteractionItem);
|
|
374
392
|
};
|
|
375
393
|
}, [
|
|
376
394
|
onAddEntity,
|
|
@@ -391,7 +409,9 @@ const Toolbox = ()=>{
|
|
|
391
409
|
onUpdateItemName,
|
|
392
410
|
onUpdateItemAttribute,
|
|
393
411
|
onUpdateProductOffers,
|
|
394
|
-
onUpdateSalePageProductId
|
|
412
|
+
onUpdateSalePageProductId,
|
|
413
|
+
onUpdateInteractionItem,
|
|
414
|
+
onUpdateInteractionIsSelectOnPage
|
|
395
415
|
]);
|
|
396
416
|
return /*#__PURE__*/ jsx("div", {
|
|
397
417
|
className: "toolbox"
|
|
@@ -85,12 +85,12 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
85
85
|
}),
|
|
86
86
|
ACTIONS_DATA.map((action)=>{
|
|
87
87
|
return /*#__PURE__*/ jsxs("div", {
|
|
88
|
-
className: `gp-relative gp-mx-1 gp-h-[60px] gp-w-[172px] 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 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
88
|
+
className: `gp-relative gp-mx-1 gp-h-[60px] mobile:gp-h-[72px] gp-w-[172px] 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 ${isInput ? 'gp-hidden' : 'gp-flex'}`,
|
|
89
89
|
id: action.id,
|
|
90
90
|
"aria-hidden": true,
|
|
91
91
|
children: [
|
|
92
92
|
/*#__PURE__*/ jsxs("div", {
|
|
93
|
-
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121]",
|
|
93
|
+
className: "gp-mb-[4px] gp-flex gp-gap-2 gp-text-[14px] gp-font-medium gp-text-[#212121] mobile:gp-flex-col mobile:gp-items-center mobile:gp-gap-0",
|
|
94
94
|
children: [
|
|
95
95
|
action.title,
|
|
96
96
|
action.hasAILogo && /*#__PURE__*/ jsxs("svg", {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { PageViewUpDocument } from '@gem-sdk/core';
|
|
2
2
|
import { useCallback, useEffect } from 'react';
|
|
3
|
-
import { isBot } from '../helpers/user-agent.js';
|
|
4
3
|
|
|
5
4
|
const useTrackingView = (token, handle, isFallback)=>{
|
|
6
5
|
const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
|
|
7
6
|
const apiURL = process.env.NEXT_PUBLIC_API_URL;
|
|
8
7
|
const sendTracking = useCallback((handle)=>{
|
|
9
8
|
if (!apiURL || !shopToken) return;
|
|
10
|
-
const bot = isBot(navigator.userAgent);
|
|
11
9
|
const variables = {
|
|
12
|
-
pageHandle: handle
|
|
13
|
-
userAgent: bot ? 'BOT' : 'BROWSER'
|
|
10
|
+
pageHandle: handle
|
|
14
11
|
};
|
|
15
12
|
const headers = {
|
|
16
13
|
'Content-Type': 'application/json',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0-dev.91",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"next": "latest"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "1.
|
|
30
|
-
"@gem-sdk/plugin-cookie-bar": "1.
|
|
31
|
-
"@gem-sdk/plugin-quick-view": "1.
|
|
32
|
-
"@gem-sdk/plugin-sticky-add-to-cart": "1.
|
|
29
|
+
"@gem-sdk/core": "1.45.0-dev.91",
|
|
30
|
+
"@gem-sdk/plugin-cookie-bar": "1.45.0-dev.91",
|
|
31
|
+
"@gem-sdk/plugin-quick-view": "1.45.0-dev.91",
|
|
32
|
+
"@gem-sdk/plugin-sticky-add-to-cart": "1.45.0-dev.91"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"next": ">=13"
|