@gem-sdk/core 1.41.0-dev.23 → 1.41.0-dev.26
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/ComponentToolbarPreview.js +10 -0
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -0
- package/dist/cjs/components/Render.liquid.js +2 -0
- package/dist/cjs/components/RenderCustomCode.js +2 -0
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +189 -0
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +57 -0
- package/dist/cjs/components/ai-generator/components/PickProduct.js +218 -0
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -0
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +70 -0
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -0
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +63 -0
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -0
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -0
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -0
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -0
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -0
- package/dist/cjs/components/constant.js +13 -0
- package/dist/cjs/components/resize/Spacing.js +2 -0
- package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -0
- package/dist/cjs/helpers/queries/get-products.js +25 -2
- package/dist/cjs/hooks/shop/use-products-query.js +29 -0
- package/dist/cjs/hooks/useAnimations.js +2 -0
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -0
- package/dist/cjs/hooks/useProduct.js +2 -0
- package/dist/esm/components/ComponentToolbarPreview.js +10 -0
- package/dist/esm/components/ComponentWrapperPreview.js +1 -0
- package/dist/esm/components/Render.liquid.js +2 -0
- package/dist/esm/components/RenderCustomCode.js +2 -0
- package/dist/esm/components/ai-generator/AIContentGenerator.js +187 -0
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +55 -0
- package/dist/esm/components/ai-generator/components/PickProduct.js +216 -0
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -0
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +68 -0
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -0
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +61 -0
- package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -0
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -0
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -0
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -0
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -0
- package/dist/esm/components/constant.js +13 -1
- package/dist/esm/components/resize/Spacing.js +2 -0
- package/dist/esm/components/theme-section/CreateThemeSection.js +2 -0
- package/dist/esm/helpers/queries/get-products.js +25 -3
- package/dist/esm/hooks/shop/use-products-query.js +30 -2
- package/dist/esm/hooks/useAnimations.js +2 -0
- package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -0
- package/dist/esm/hooks/useProduct.js +2 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
const useFlipPopup = (isShowPopup, dom)=>{
|
|
6
|
+
const { genTool, genPopup } = dom;
|
|
7
|
+
const [popupPositionY, setPopupPositionY] = react.useState('top');
|
|
8
|
+
const [popupPositionX, setPopupPositionX] = react.useState('left');
|
|
9
|
+
const [isValidating, setIsValidating] = react.useState(true);
|
|
10
|
+
const calculatePopupPositionY = react.useCallback(()=>{
|
|
11
|
+
if (!genTool.current || !genPopup.current) return;
|
|
12
|
+
const viewHeight = window.innerHeight;
|
|
13
|
+
const scrollHeight = document.documentElement.scrollHeight;
|
|
14
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
15
|
+
const toolPos = genTool.current?.getBoundingClientRect();
|
|
16
|
+
const genPopupHeight = genPopup.current?.getBoundingClientRect().height;
|
|
17
|
+
const MIN_DISTANCE = 50;
|
|
18
|
+
if (scrollTop + toolPos.top + genPopupHeight >= scrollHeight - MIN_DISTANCE) {
|
|
19
|
+
setPopupPositionY('bottom');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (toolPos.bottom + genPopupHeight > viewHeight) {
|
|
23
|
+
if (toolPos.top - genPopupHeight < 0) {
|
|
24
|
+
setPopupPositionY('top');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
setPopupPositionY('bottom');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setPopupPositionY('top');
|
|
31
|
+
}, [
|
|
32
|
+
genPopup,
|
|
33
|
+
genTool
|
|
34
|
+
]);
|
|
35
|
+
const calculatePopupPositionX = react.useCallback(()=>{
|
|
36
|
+
if (!genTool.current || !genPopup.current) return;
|
|
37
|
+
const viewWidth = window.innerWidth;
|
|
38
|
+
const toolPos = genTool.current?.getBoundingClientRect();
|
|
39
|
+
const genPopupWidth = genPopup.current?.getBoundingClientRect().width;
|
|
40
|
+
if (toolPos.left + genPopupWidth > viewWidth) {
|
|
41
|
+
setPopupPositionX('right');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setPopupPositionX('left');
|
|
45
|
+
}, [
|
|
46
|
+
genPopup,
|
|
47
|
+
genTool
|
|
48
|
+
]);
|
|
49
|
+
react.useEffect(()=>{
|
|
50
|
+
if (!isShowPopup) {
|
|
51
|
+
setIsValidating(true);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setIsValidating(true);
|
|
55
|
+
calculatePopupPositionY();
|
|
56
|
+
calculatePopupPositionX();
|
|
57
|
+
setIsValidating(false);
|
|
58
|
+
}, [
|
|
59
|
+
isShowPopup,
|
|
60
|
+
calculatePopupPositionX,
|
|
61
|
+
calculatePopupPositionY
|
|
62
|
+
]);
|
|
63
|
+
return {
|
|
64
|
+
isValidating,
|
|
65
|
+
popupPositionY,
|
|
66
|
+
popupPositionX
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.useFlipPopup = useFlipPopup;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
const useGettingGenerateRequest = ()=>{
|
|
6
|
+
const [prompt, setPrompt] = react.useState('');
|
|
7
|
+
const [productName, setProductName] = react.useState('');
|
|
8
|
+
const [tone, setTone] = react.useState('');
|
|
9
|
+
const changePrompt = (value)=>{
|
|
10
|
+
const limit = 200;
|
|
11
|
+
setPrompt(value.slice(0, limit));
|
|
12
|
+
};
|
|
13
|
+
const changeProductName = (value)=>{
|
|
14
|
+
setProductName(value);
|
|
15
|
+
};
|
|
16
|
+
const changeTone = (value)=>{
|
|
17
|
+
setTone(value);
|
|
18
|
+
};
|
|
19
|
+
const getRequestBody = ()=>{
|
|
20
|
+
return {
|
|
21
|
+
prompt,
|
|
22
|
+
productName,
|
|
23
|
+
tone
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
prompt,
|
|
28
|
+
changePrompt,
|
|
29
|
+
productName,
|
|
30
|
+
changeProductName,
|
|
31
|
+
tone,
|
|
32
|
+
changeTone,
|
|
33
|
+
getRequestBody
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.useGettingGenerateRequest = useGettingGenerateRequest;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
const useListenEventGenerate = (componentInfo)=>{
|
|
6
|
+
const { uid: componentUid, tag: componentTag } = componentInfo;
|
|
7
|
+
const [isGenerating, setIsGenerating] = react.useState(false);
|
|
8
|
+
const onGenerate = (body)=>{
|
|
9
|
+
const eventCreate = new CustomEvent('editor:toolbar:ai-generate-content', {
|
|
10
|
+
bubbles: true,
|
|
11
|
+
detail: {
|
|
12
|
+
componentUid: componentUid,
|
|
13
|
+
componentTag: componentTag,
|
|
14
|
+
genRequest: body
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
window.dispatchEvent(eventCreate);
|
|
18
|
+
setIsGenerating(true);
|
|
19
|
+
onNotifyStatus('loading');
|
|
20
|
+
};
|
|
21
|
+
const onNotifyStatus = (status)=>{
|
|
22
|
+
const eventNotifyStatus = new CustomEvent('editor:ai-generate-content-status', {
|
|
23
|
+
bubbles: true,
|
|
24
|
+
detail: {
|
|
25
|
+
status: status,
|
|
26
|
+
generatingUid: componentUid
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
window.dispatchEvent(eventNotifyStatus);
|
|
30
|
+
};
|
|
31
|
+
const onGenerateContentStatus = react.useCallback((e)=>{
|
|
32
|
+
const detail = e.detail;
|
|
33
|
+
if (detail?.generatingUid === componentUid && detail.status === 'success') {
|
|
34
|
+
setIsGenerating(false);
|
|
35
|
+
}
|
|
36
|
+
}, [
|
|
37
|
+
componentUid
|
|
38
|
+
]);
|
|
39
|
+
const onOpenProductElementSettings = (productElementUid)=>{
|
|
40
|
+
const eventCreate = new CustomEvent('editor:toolbar:open-product-element', {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
detail: {
|
|
43
|
+
productElementUid: productElementUid
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
window.dispatchEvent(eventCreate);
|
|
47
|
+
};
|
|
48
|
+
react.useEffect(()=>{
|
|
49
|
+
window.addEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
|
|
50
|
+
return ()=>{
|
|
51
|
+
window.removeEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
|
|
52
|
+
};
|
|
53
|
+
}, [
|
|
54
|
+
onGenerateContentStatus
|
|
55
|
+
]);
|
|
56
|
+
return {
|
|
57
|
+
isGenerating,
|
|
58
|
+
onGenerate,
|
|
59
|
+
onOpenProductElementSettings
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.useListenEventGenerate = useListenEventGenerate;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const AIIcon = ()=>{
|
|
6
|
+
const getRandomId = ()=>{
|
|
7
|
+
return Math.random().toString(36).substring(7);
|
|
8
|
+
};
|
|
9
|
+
const linearGradientId = getRandomId();
|
|
10
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
11
|
+
width: "16",
|
|
12
|
+
height: "16",
|
|
13
|
+
viewBox: "0 0 16 16",
|
|
14
|
+
fill: "none",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
18
|
+
d: "M11.6363 2.67137C11.5886 2.52361 11.3795 2.52361 11.3318 2.67137L11.1133 3.34797C11.0352 3.58971 10.8469 3.78 10.606 3.86067L9.93715 4.08465C9.79156 4.1334 9.79156 4.33933 9.93715 4.38809L10.606 4.61207C10.8469 4.69273 11.0352 4.88302 11.1133 5.12477L11.3318 5.80137C11.3795 5.94913 11.5886 5.94913 11.6363 5.80137L11.8549 5.12477C11.933 4.88302 12.1212 4.69273 12.3621 4.61207L13.031 4.38809C13.1766 4.33933 13.1766 4.1334 13.031 4.08465L12.3621 3.86067C12.1212 3.78 11.933 3.58971 11.8549 3.34797L11.6363 2.67137Z",
|
|
19
|
+
fill: `url(#${linearGradientId}_0)`
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
22
|
+
d: "M7.61245 3.30705C7.54086 3.08541 7.22728 3.08541 7.15569 3.30705L6.39541 5.6608C6.16115 6.38604 5.59636 6.9569 4.87367 7.19891L2.56369 7.97242C2.3453 8.04555 2.34531 8.35445 2.5637 8.42758L4.87367 9.2011C5.59636 9.4431 6.16115 10.014 6.39541 10.7392L7.15569 13.093C7.22728 13.3146 7.54086 13.3146 7.61245 13.093L8.37273 10.7392C8.60699 10.014 9.17178 9.4431 9.89447 9.2011L12.2044 8.42758C12.4228 8.35445 12.4228 8.04555 12.2044 7.97242L9.89447 7.1989C9.17178 6.9569 8.60699 6.38604 8.37273 5.6608L7.61245 3.30705Z",
|
|
23
|
+
fill: `url(#${linearGradientId}_1)`
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ jsxRuntime.jsxs("defs", {
|
|
26
|
+
children: [
|
|
27
|
+
/*#__PURE__*/ jsxRuntime.jsxs("linearGradient", {
|
|
28
|
+
id: `${linearGradientId}_0`,
|
|
29
|
+
x1: "15.3433",
|
|
30
|
+
y1: "2.56054",
|
|
31
|
+
x2: "4.24885",
|
|
32
|
+
y2: "1.00838",
|
|
33
|
+
gradientUnits: "userSpaceOnUse",
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ jsxRuntime.jsx("stop", {
|
|
36
|
+
stopColor: "#D8E1FF"
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ jsxRuntime.jsx("stop", {
|
|
39
|
+
offset: "1",
|
|
40
|
+
stopColor: "#C8ACFF"
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsxRuntime.jsxs("linearGradient", {
|
|
45
|
+
id: `${linearGradientId}_1`,
|
|
46
|
+
x1: "15.3433",
|
|
47
|
+
y1: "2.56054",
|
|
48
|
+
x2: "4.24885",
|
|
49
|
+
y2: "1.00838",
|
|
50
|
+
gradientUnits: "userSpaceOnUse",
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ jsxRuntime.jsx("stop", {
|
|
53
|
+
stopColor: "#D8E1FF"
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ jsxRuntime.jsx("stop", {
|
|
56
|
+
offset: "1",
|
|
57
|
+
stopColor: "#C8ACFF"
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
exports.AIIcon = AIIcon;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const CloseIcon = ()=>{
|
|
6
|
+
return /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
7
|
+
width: "16",
|
|
8
|
+
height: "16",
|
|
9
|
+
viewBox: "0 0 16 16",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
13
|
+
d: "M11.1755 12.0243C11.4099 12.2586 11.7898 12.2586 12.0241 12.0243C12.2584 11.79 12.2584 11.4101 12.0241 11.1757L8.84833 8L12.0241 4.82427C12.2584 4.58995 12.2584 4.21005 12.0241 3.97574C11.7898 3.74142 11.4099 3.74142 11.1755 3.97574L7.9998 7.15148L4.82407 3.97574C4.58975 3.74142 4.20986 3.74142 3.97554 3.97574C3.74123 4.21005 3.74123 4.58995 3.97554 4.82427L7.15128 8L3.97554 11.1757C3.74123 11.4101 3.74123 11.79 3.97554 12.0243C4.20986 12.2586 4.58975 12.2586 4.82407 12.0243L7.9998 8.84853L11.1755 12.0243Z",
|
|
14
|
+
fill: "#F9F9F9"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.CloseIcon = CloseIcon;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const DropdownIcon = ()=>{
|
|
6
|
+
return /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
7
|
+
width: "20",
|
|
8
|
+
height: "20",
|
|
9
|
+
viewBox: "0 0 20 20",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
13
|
+
fillRule: "evenodd",
|
|
14
|
+
clipRule: "evenodd",
|
|
15
|
+
d: "M5.13313 7.62204C5.31064 7.45932 5.59845 7.45932 5.77596 7.62204L10 11.4941L14.224 7.62204C14.4016 7.45932 14.6894 7.45932 14.8669 7.62204C15.0444 7.78476 15.0444 8.04858 14.8669 8.21129L10.3214 12.378C10.1439 12.5407 9.8561 12.5407 9.67859 12.378L5.13313 8.21129C4.95562 8.04858 4.95562 7.78476 5.13313 7.62204Z",
|
|
16
|
+
fill: "#F9F9F9"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const TickIcon = ()=>{
|
|
21
|
+
return /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
22
|
+
width: "20",
|
|
23
|
+
height: "20",
|
|
24
|
+
viewBox: "0 0 20 20",
|
|
25
|
+
fill: "none",
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
28
|
+
fillRule: "evenodd",
|
|
29
|
+
clipRule: "evenodd",
|
|
30
|
+
d: "M15.8415 5.1766C16.0528 5.41207 16.0528 5.79383 15.8415 6.0293L7.95016 14.8234C7.84869 14.9365 7.71107 15 7.56757 15C7.42408 15 7.28645 14.9365 7.18499 14.8234L4.15846 11.4505C3.94717 11.215 3.94718 10.8333 4.15848 10.5978C4.36978 10.3623 4.71236 10.3623 4.92365 10.5978L7.56759 13.5443L15.0764 5.1766C15.2877 4.94113 15.6302 4.94113 15.8415 5.1766Z",
|
|
31
|
+
fill: "#00C853"
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.DropdownIcon = DropdownIcon;
|
|
37
|
+
exports.TickIcon = TickIcon;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const SearchIcon = ()=>{
|
|
6
|
+
return /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
7
|
+
width: "20",
|
|
8
|
+
height: "20",
|
|
9
|
+
viewBox: "0 0 20 20",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
13
|
+
fillRule: "evenodd",
|
|
14
|
+
clipRule: "evenodd",
|
|
15
|
+
d: "M8.75 2.5C5.29822 2.5 2.5 5.29822 2.5 8.75C2.5 12.2018 5.29822 15 8.75 15C10.2508 15 11.628 14.471 12.7055 13.5893L16.4775 17.3614C16.7216 17.6054 17.1173 17.6054 17.3614 17.3614C17.6054 17.1173 17.6054 16.7216 17.3614 16.4775L13.5893 12.7055C14.471 11.628 15 10.2508 15 8.75C15 5.29822 12.2018 2.5 8.75 2.5ZM3.75 8.75C3.75 5.98858 5.98858 3.75 8.75 3.75C11.5114 3.75 13.75 5.98858 13.75 8.75C13.75 11.5114 11.5114 13.75 8.75 13.75C5.98858 13.75 3.75 11.5114 3.75 8.75Z",
|
|
16
|
+
fill: "#AAAAAA"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.SearchIcon = SearchIcon;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const ShowMoreIcon = ()=>{
|
|
6
|
+
return /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
7
|
+
width: "17",
|
|
8
|
+
height: "16",
|
|
9
|
+
viewBox: "0 0 17 16",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
13
|
+
fillRule: "evenodd",
|
|
14
|
+
clipRule: "evenodd",
|
|
15
|
+
d: "M4.60651 6.09763C4.74852 5.96746 4.97876 5.96746 5.12077 6.09763L8.5 9.19526L11.8792 6.09763C12.0212 5.96746 12.2515 5.96746 12.3935 6.09763C12.5355 6.22781 12.5355 6.43886 12.3935 6.56904L8.75713 9.90237C8.61512 10.0325 8.38488 10.0325 8.24287 9.90237L4.60651 6.56904C4.4645 6.43886 4.4645 6.22781 4.60651 6.09763Z",
|
|
16
|
+
fill: "#F9F9F9"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.ShowMoreIcon = ShowMoreIcon;
|
|
@@ -69,7 +69,20 @@ const postPurchaseWrapElements = [
|
|
|
69
69
|
'PostPurchaseCalloutBox',
|
|
70
70
|
'PostPurchaseProductOffer'
|
|
71
71
|
];
|
|
72
|
+
const ableGenerateContentElements = [
|
|
73
|
+
'Section',
|
|
74
|
+
'Row',
|
|
75
|
+
'Text',
|
|
76
|
+
'Heading',
|
|
77
|
+
'Accordion',
|
|
78
|
+
'Product',
|
|
79
|
+
'HeroBanner',
|
|
80
|
+
'IconList',
|
|
81
|
+
'IconListV2',
|
|
82
|
+
'AdvancedList'
|
|
83
|
+
];
|
|
72
84
|
|
|
85
|
+
exports.ableGenerateContentElements = ableGenerateContentElements;
|
|
73
86
|
exports.customRenderChildren = customRenderChildren;
|
|
74
87
|
exports.disableWrap = disableWrap;
|
|
75
88
|
exports.excludeApplyStyle = excludeApplyStyle;
|
|
@@ -10,10 +10,12 @@ require('swr');
|
|
|
10
10
|
require('@gem-sdk/adapter-shopify');
|
|
11
11
|
require('swr/mutation');
|
|
12
12
|
var shop = require('../../hooks/shop.js');
|
|
13
|
+
require('swr/infinite');
|
|
13
14
|
require('vanilla-lazyload');
|
|
14
15
|
require('../../hooks/useCartUI.js');
|
|
15
16
|
require('react-transition-group');
|
|
16
17
|
require('@gem-sdk/core');
|
|
18
|
+
require('classnames');
|
|
17
19
|
require('../../helpers/convert.js');
|
|
18
20
|
|
|
19
21
|
function Spacing(props) {
|
|
@@ -8,8 +8,10 @@ var ShopContext = require('../../contexts/ShopContext.js');
|
|
|
8
8
|
require('@gem-sdk/adapter-shopify');
|
|
9
9
|
require('swr');
|
|
10
10
|
require('swr/mutation');
|
|
11
|
+
require('swr/infinite');
|
|
11
12
|
require('vanilla-lazyload');
|
|
12
13
|
require('../../hooks/useCartUI.js');
|
|
14
|
+
require('classnames');
|
|
13
15
|
require('../../helpers/convert.js');
|
|
14
16
|
|
|
15
17
|
const SHOW_TOOLTIP_TIMEOUT = 600;
|
|
@@ -85,7 +85,7 @@ const getProductQueryAll = async (fetcher, arg)=>{
|
|
|
85
85
|
hasTagsWith: [
|
|
86
86
|
{
|
|
87
87
|
nameNotIn: [
|
|
88
|
-
|
|
88
|
+
'bogos-gift'
|
|
89
89
|
]
|
|
90
90
|
}
|
|
91
91
|
]
|
|
@@ -97,6 +97,28 @@ const getProductQueryAll = async (fetcher, arg)=>{
|
|
|
97
97
|
};
|
|
98
98
|
return fetchProducts(fetcher, variables);
|
|
99
99
|
};
|
|
100
|
+
const getListProductByVariables = async (fetcher, arg)=>{
|
|
101
|
+
const variables = {
|
|
102
|
+
first: arg.first || 8,
|
|
103
|
+
firstMedia: 1,
|
|
104
|
+
firstVariant: 1,
|
|
105
|
+
orderBy: {
|
|
106
|
+
field: 'PLATFORM_CREATED_AT',
|
|
107
|
+
direction: 'DESC'
|
|
108
|
+
},
|
|
109
|
+
orderByMedia: {
|
|
110
|
+
field: 'POSITION',
|
|
111
|
+
direction: 'ASC'
|
|
112
|
+
},
|
|
113
|
+
where: {
|
|
114
|
+
status: 'ACTIVE',
|
|
115
|
+
...arg.where
|
|
116
|
+
},
|
|
117
|
+
after: arg.after
|
|
118
|
+
};
|
|
119
|
+
const pageData = await fetchProducts(fetcher, variables);
|
|
120
|
+
return pageData;
|
|
121
|
+
};
|
|
100
122
|
const fetchProducts = async (fetcher, variables)=>{
|
|
101
123
|
return fetcher([
|
|
102
124
|
products_generated.ProductsDocument,
|
|
@@ -150,7 +172,7 @@ const loopFetchProducts = async (fetcher, { ids, isSample, isStorefront, default
|
|
|
150
172
|
hasTagsWith: [
|
|
151
173
|
{
|
|
152
174
|
nameNotIn: [
|
|
153
|
-
|
|
175
|
+
'bogos-gift'
|
|
154
176
|
]
|
|
155
177
|
}
|
|
156
178
|
]
|
|
@@ -222,5 +244,6 @@ const mergeMediasToProducts = async ({ fetcher, products, isSample, isStorefront
|
|
|
222
244
|
// );
|
|
223
245
|
// };
|
|
224
246
|
|
|
247
|
+
exports.getListProductByVariables = getListProductByVariables;
|
|
225
248
|
exports.getProductQueryAll = getProductQueryAll;
|
|
226
249
|
exports.getProducts = getProducts;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var useSWR = require('swr');
|
|
4
|
+
var useSWRInfinite = require('swr/infinite');
|
|
4
5
|
var getProducts = require('../../helpers/queries/get-products.js');
|
|
5
6
|
var query = require('../../helpers/query.js');
|
|
6
7
|
var shop = require('../shop.js');
|
|
@@ -20,6 +21,33 @@ const useProductsQuery = (ids, options, params)=>{
|
|
|
20
21
|
return getProducts.getProducts(params?.fetcher || fetcher, arg);
|
|
21
22
|
}, options);
|
|
22
23
|
};
|
|
24
|
+
const getKey = (variable)=>{
|
|
25
|
+
return (pageIndex, previousPageData)=>{
|
|
26
|
+
if (!variable || previousPageData && !previousPageData.products?.pageInfo?.hasNextPage) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
if (pageIndex === 0) {
|
|
30
|
+
return [
|
|
31
|
+
'query/products',
|
|
32
|
+
variable
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
return [
|
|
36
|
+
'query/products',
|
|
37
|
+
{
|
|
38
|
+
...variable,
|
|
39
|
+
after: previousPageData.products?.pageInfo?.endCursor
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const useListProductQuery = (variable, options)=>{
|
|
45
|
+
const fetcher = useFetchHandle.useFetchHandle();
|
|
46
|
+
const data = useSWRInfinite(getKey(variable), async ([, arg])=>{
|
|
47
|
+
return getProducts.getListProductByVariables(fetcher, arg);
|
|
48
|
+
}, options);
|
|
49
|
+
return data;
|
|
50
|
+
};
|
|
23
51
|
const useProductsQueryAll = (variable, options)=>{
|
|
24
52
|
const fetcher = useFetchHandle.useFetchHandle();
|
|
25
53
|
return useSWR(variable ? [
|
|
@@ -30,5 +58,6 @@ const useProductsQueryAll = (variable, options)=>{
|
|
|
30
58
|
}, options);
|
|
31
59
|
};
|
|
32
60
|
|
|
61
|
+
exports.useListProductQuery = useListProductQuery;
|
|
33
62
|
exports.useProductsQuery = useProductsQuery;
|
|
34
63
|
exports.useProductsQueryAll = useProductsQueryAll;
|
|
@@ -7,10 +7,12 @@ require('zustand');
|
|
|
7
7
|
require('swr');
|
|
8
8
|
require('@gem-sdk/adapter-shopify');
|
|
9
9
|
require('swr/mutation');
|
|
10
|
+
require('swr/infinite');
|
|
10
11
|
require('vanilla-lazyload');
|
|
11
12
|
require('./useCartUI.js');
|
|
12
13
|
require('react-transition-group');
|
|
13
14
|
require('@gem-sdk/core');
|
|
15
|
+
require('classnames');
|
|
14
16
|
require('../helpers/convert.js');
|
|
15
17
|
|
|
16
18
|
const useAnimations = ()=>{
|
|
@@ -13,10 +13,12 @@ require('react/jsx-runtime');
|
|
|
13
13
|
require('zustand');
|
|
14
14
|
require('@gem-sdk/adapter-shopify');
|
|
15
15
|
require('swr/mutation');
|
|
16
|
+
require('swr/infinite');
|
|
16
17
|
require('vanilla-lazyload');
|
|
17
18
|
require('./useCartUI.js');
|
|
18
19
|
require('react-transition-group');
|
|
19
20
|
require('@gem-sdk/core');
|
|
21
|
+
require('classnames');
|
|
20
22
|
var isBrowser = require('../helpers/is-browser.js');
|
|
21
23
|
require('../helpers/convert.js');
|
|
22
24
|
|
|
@@ -8,11 +8,13 @@ require('swr');
|
|
|
8
8
|
var PageContext = require('../contexts/PageContext.js');
|
|
9
9
|
require('@gem-sdk/adapter-shopify');
|
|
10
10
|
require('swr/mutation');
|
|
11
|
+
require('swr/infinite');
|
|
11
12
|
require('vanilla-lazyload');
|
|
12
13
|
require('./useCartUI.js');
|
|
13
14
|
var variant = require('../helpers/variant.js');
|
|
14
15
|
require('react-transition-group');
|
|
15
16
|
require('@gem-sdk/core');
|
|
17
|
+
require('classnames');
|
|
16
18
|
var flattenConnection = require('../helpers/flatten-connection.js');
|
|
17
19
|
require('../helpers/convert.js');
|
|
18
20
|
var product = require('../helpers/product.js');
|
|
@@ -6,6 +6,7 @@ import { useShopStore } from '../contexts/ShopContext.js';
|
|
|
6
6
|
import '@gem-sdk/adapter-shopify';
|
|
7
7
|
import 'swr';
|
|
8
8
|
import 'swr/mutation';
|
|
9
|
+
import 'swr/infinite';
|
|
9
10
|
import 'vanilla-lazyload';
|
|
10
11
|
import '../hooks/useCartUI.js';
|
|
11
12
|
import { CreateThemeSection } from './theme-section/CreateThemeSection.js';
|
|
@@ -13,6 +14,9 @@ import Tooltip from './toolbar/Tooltip.js';
|
|
|
13
14
|
import { ThemeSectionStatus } from './theme-section/ThemeSectionStatus.js';
|
|
14
15
|
import Resize from './resize/Resize.js';
|
|
15
16
|
import { usePostPurchase } from '../hooks/useToolbarPostPurchase.js';
|
|
17
|
+
import { ableGenerateContentElements } from './constant.js';
|
|
18
|
+
import { AIContentGenerator } from './ai-generator/AIContentGenerator.js';
|
|
19
|
+
import { AIGenContentLoading } from './ai-generator/AIGenContentLoading.js';
|
|
16
20
|
import '../helpers/convert.js';
|
|
17
21
|
|
|
18
22
|
const SECTION_LIMIT = 25;
|
|
@@ -416,6 +420,9 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
416
420
|
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
|
|
417
421
|
...props
|
|
418
422
|
}),
|
|
423
|
+
!props.isShopifySection && ableGenerateContentElements.includes(props.tag) && /*#__PURE__*/ jsx(AIContentGenerator, {
|
|
424
|
+
...props
|
|
425
|
+
}),
|
|
419
426
|
props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
|
|
420
427
|
"data-toolbar-zoom-out": true,
|
|
421
428
|
onClick: (e)=>onZoomOut(e),
|
|
@@ -534,6 +541,9 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
534
541
|
})
|
|
535
542
|
]
|
|
536
543
|
}),
|
|
544
|
+
ableGenerateContentElements.includes(props.tag) && /*#__PURE__*/ jsx(AIGenContentLoading, {
|
|
545
|
+
...props
|
|
546
|
+
}),
|
|
537
547
|
/*#__PURE__*/ jsx(Resize, {
|
|
538
548
|
...props
|
|
539
549
|
})
|
|
@@ -10,6 +10,7 @@ import 'swr';
|
|
|
10
10
|
import '@gem-sdk/adapter-shopify';
|
|
11
11
|
import 'swr/mutation';
|
|
12
12
|
import { usePageType } from '../hooks/shop.js';
|
|
13
|
+
import 'swr/infinite';
|
|
13
14
|
import 'vanilla-lazyload';
|
|
14
15
|
import '../hooks/useCartUI.js';
|
|
15
16
|
import { cls } from '../helpers/cls.js';
|
|
@@ -5,11 +5,13 @@ import 'zustand';
|
|
|
5
5
|
import 'swr';
|
|
6
6
|
import '@gem-sdk/adapter-shopify';
|
|
7
7
|
import 'swr/mutation';
|
|
8
|
+
import 'swr/infinite';
|
|
8
9
|
import 'vanilla-lazyload';
|
|
9
10
|
import '../hooks/useCartUI.js';
|
|
10
11
|
import 'react-transition-group';
|
|
11
12
|
import '@gem-sdk/core';
|
|
12
13
|
import { disableWrap, customRenderChildren } from './constant.js';
|
|
14
|
+
import 'classnames';
|
|
13
15
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
14
16
|
import { baseAssetURL, isLocalEnv } from '../helpers/convert.js';
|
|
15
17
|
import { RenderIf, template } from '../helpers/render.js';
|
|
@@ -7,10 +7,12 @@ import 'swr';
|
|
|
7
7
|
import '@gem-sdk/adapter-shopify';
|
|
8
8
|
import 'swr/mutation';
|
|
9
9
|
import { useEditorMode } from '../hooks/shop.js';
|
|
10
|
+
import 'swr/infinite';
|
|
10
11
|
import 'vanilla-lazyload';
|
|
11
12
|
import '../hooks/useCartUI.js';
|
|
12
13
|
import 'react-transition-group';
|
|
13
14
|
import '@gem-sdk/core';
|
|
15
|
+
import 'classnames';
|
|
14
16
|
import '../helpers/convert.js';
|
|
15
17
|
|
|
16
18
|
const RenderCustomCode = ({ uid, advanced })=>{
|