@gem-sdk/core 1.43.0-dev.90 → 1.43.0-staging.14
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 +6 -120
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -44
- package/dist/cjs/components/Render.liquid.js +0 -3
- package/dist/cjs/components/RenderCustomCode.js +0 -3
- package/dist/cjs/components/constant.js +2 -19
- package/dist/cjs/components/resize/Spacing.js +0 -3
- package/dist/cjs/components/theme-section/CreateThemeSection.js +0 -3
- package/dist/cjs/contexts/BuilderPreviewContext.js +10 -17
- package/dist/cjs/contexts/SectionContext.js +0 -1
- package/dist/cjs/contexts/ShopContext.js +0 -18
- package/dist/cjs/helpers/background.js +3 -6
- package/dist/cjs/helpers/carousel.js +10 -7
- package/dist/cjs/helpers/colors.js +2 -2
- package/dist/cjs/helpers/queries/get-products.js +0 -23
- package/dist/cjs/helpers/shadow.js +1 -1
- package/dist/cjs/hooks/shop/use-products-query.js +0 -29
- package/dist/cjs/hooks/useAnimations.js +0 -3
- package/dist/cjs/hooks/useFormatMoney.js +60 -61
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +0 -3
- package/dist/cjs/hooks/useProduct.js +0 -3
- package/dist/cjs/index.js +0 -13
- package/dist/esm/components/ComponentToolbarPreview.js +6 -120
- package/dist/esm/components/ComponentWrapperPreview.js +1 -44
- package/dist/esm/components/Render.liquid.js +0 -3
- package/dist/esm/components/RenderCustomCode.js +0 -3
- package/dist/esm/components/constant.js +3 -19
- package/dist/esm/components/resize/Spacing.js +0 -3
- package/dist/esm/components/theme-section/CreateThemeSection.js +0 -3
- package/dist/esm/contexts/BuilderPreviewContext.js +10 -17
- package/dist/esm/contexts/SectionContext.js +0 -1
- package/dist/esm/contexts/ShopContext.js +1 -19
- package/dist/esm/helpers/background.js +4 -6
- package/dist/esm/helpers/carousel.js +10 -7
- package/dist/esm/helpers/colors.js +2 -2
- package/dist/esm/helpers/queries/get-products.js +1 -23
- package/dist/esm/helpers/shadow.js +1 -1
- package/dist/esm/hooks/shop/use-products-query.js +2 -30
- package/dist/esm/hooks/useAnimations.js +0 -3
- package/dist/esm/hooks/useFormatMoney.js +61 -61
- package/dist/esm/hooks/useInitialSwatchesOptions.js +0 -3
- package/dist/esm/hooks/useProduct.js +0 -3
- package/dist/esm/index.js +2 -6
- package/dist/types/index.d.ts +47 -220
- package/package.json +3 -6
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +0 -252
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +0 -85
- package/dist/cjs/components/ai-generator/components/PickProduct.js +0 -219
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +0 -77
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +0 -47
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +0 -110
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +0 -37
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +0 -70
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +0 -67
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +0 -19
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +0 -37
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +0 -21
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +0 -21
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +0 -27
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +0 -31
- package/dist/cjs/contexts/ArticleContext.js +0 -39
- package/dist/cjs/contexts/ArticleListContext.js +0 -31
- package/dist/cjs/graphql/queries/articles.generated.js +0 -55
- package/dist/cjs/graphql/queries/blogs.generated.js +0 -63
- package/dist/cjs/helpers/align.js +0 -19
- package/dist/cjs/hooks/articles/useArticlesQuery.js +0 -32
- package/dist/esm/components/ai-generator/AIContentGenerator.js +0 -250
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +0 -83
- package/dist/esm/components/ai-generator/components/PickProduct.js +0 -217
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +0 -75
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +0 -45
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +0 -108
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +0 -35
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +0 -68
- package/dist/esm/components/ai-generator/icons/AIIcon.js +0 -65
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +0 -17
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +0 -34
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +0 -19
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +0 -19
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +0 -25
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +0 -29
- package/dist/esm/contexts/ArticleContext.js +0 -36
- package/dist/esm/contexts/ArticleListContext.js +0 -27
- package/dist/esm/graphql/queries/articles.generated.js +0 -53
- package/dist/esm/graphql/queries/blogs.generated.js +0 -61
- package/dist/esm/helpers/align.js +0 -17
- package/dist/esm/hooks/articles/useArticlesQuery.js +0 -29
|
@@ -10,7 +10,6 @@ var ShopContext = require('../contexts/ShopContext.js');
|
|
|
10
10
|
require('@gem-sdk/adapter-shopify');
|
|
11
11
|
require('swr');
|
|
12
12
|
require('swr/mutation');
|
|
13
|
-
require('swr/infinite');
|
|
14
13
|
require('vanilla-lazyload');
|
|
15
14
|
require('../hooks/useCartUI.js');
|
|
16
15
|
var CreateThemeSection = require('./theme-section/CreateThemeSection.js');
|
|
@@ -18,9 +17,6 @@ var Tooltip = require('./toolbar/Tooltip.js');
|
|
|
18
17
|
var ThemeSectionStatus = require('./theme-section/ThemeSectionStatus.js');
|
|
19
18
|
var Resize = require('./resize/Resize.js');
|
|
20
19
|
var useToolbarPostPurchase = require('../hooks/useToolbarPostPurchase.js');
|
|
21
|
-
var constant = require('./constant.js');
|
|
22
|
-
var AIContentGenerator = require('./ai-generator/AIContentGenerator.js');
|
|
23
|
-
var AIGenContentLoading = require('./ai-generator/AIGenContentLoading.js');
|
|
24
20
|
require('../helpers/convert.js');
|
|
25
21
|
|
|
26
22
|
const SECTION_LIMIT = 25;
|
|
@@ -34,8 +30,6 @@ const isSection = (el)=>{
|
|
|
34
30
|
};
|
|
35
31
|
const ComponentToolbarPreview = (props)=>{
|
|
36
32
|
const isThemeSection = props.isThemeSection;
|
|
37
|
-
const isShopifySection = props.isShopifySection;
|
|
38
|
-
const storefrontUrl = ShopContext.useShopStore((s)=>s.storefrontUrl);
|
|
39
33
|
const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
|
|
40
34
|
const getParents = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getParents);
|
|
41
35
|
const root = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getItem('ROOT'));
|
|
@@ -46,7 +40,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
46
40
|
const [parents, setParents] = react.useState([]);
|
|
47
41
|
const [deleteTooltipPosition, setDeleteTooltipPosition] = react.useState('top');
|
|
48
42
|
const [isDisableDelete, setIsUnableDelete] = react.useState(false);
|
|
49
|
-
const [parentProductUid, setParentProductUid] = react.useState('');
|
|
50
43
|
const [tooltipText, setTooltipText] = react.useState({
|
|
51
44
|
width: '',
|
|
52
45
|
text: ''
|
|
@@ -86,27 +79,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
86
79
|
}, [
|
|
87
80
|
props.tag
|
|
88
81
|
]);
|
|
89
|
-
const productId = react.useMemo(()=>{
|
|
90
|
-
const ele = document.querySelector(`[data-uid="${parentProductUid}"]`);
|
|
91
|
-
return ele?.getAttribute('data-product-id');
|
|
92
|
-
}, [
|
|
93
|
-
parentProductUid
|
|
94
|
-
]);
|
|
95
|
-
const shopName = react.useMemo(()=>{
|
|
96
|
-
const pattern = /^(?:https?:\/\/)?([^/]+)\.myshopify\.com/;
|
|
97
|
-
if (storefrontUrl) {
|
|
98
|
-
return storefrontUrl.match(pattern)?.[1];
|
|
99
|
-
}
|
|
100
|
-
return '';
|
|
101
|
-
}, [
|
|
102
|
-
storefrontUrl
|
|
103
|
-
]);
|
|
104
|
-
const shopifyEditLink = react.useMemo(()=>{
|
|
105
|
-
return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
|
|
106
|
-
}, [
|
|
107
|
-
productId,
|
|
108
|
-
shopName
|
|
109
|
-
]);
|
|
110
82
|
// Get parents
|
|
111
83
|
const onActiveComponent = react.useCallback((e)=>{
|
|
112
84
|
const detail = e.detail;
|
|
@@ -125,10 +97,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
125
97
|
return true;
|
|
126
98
|
}).slice(0, 3);
|
|
127
99
|
setParents(currentParents);
|
|
128
|
-
const parentFindUid = currentParents.find((item)=>item.tag === 'Product')?.uid;
|
|
129
|
-
if (parentFindUid) {
|
|
130
|
-
setParentProductUid(parentFindUid);
|
|
131
|
-
}
|
|
132
100
|
} else {
|
|
133
101
|
setParents([]);
|
|
134
102
|
setIsShowParent(false);
|
|
@@ -200,9 +168,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
200
168
|
});
|
|
201
169
|
window.dispatchEvent(event);
|
|
202
170
|
};
|
|
203
|
-
const goToShopifyEditLink = ()=>{
|
|
204
|
-
window.open(shopifyEditLink, '_blank');
|
|
205
|
-
};
|
|
206
171
|
const onDelete = (e)=>{
|
|
207
172
|
e.preventDefault();
|
|
208
173
|
e.stopPropagation();
|
|
@@ -210,8 +175,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
210
175
|
bubbles: true,
|
|
211
176
|
detail: {
|
|
212
177
|
componentUid: props.uid,
|
|
213
|
-
isThemeSection
|
|
214
|
-
isShopifySection
|
|
178
|
+
isThemeSection: isThemeSection
|
|
215
179
|
}
|
|
216
180
|
});
|
|
217
181
|
window.dispatchEvent(event);
|
|
@@ -227,8 +191,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
227
191
|
bubbles: true,
|
|
228
192
|
detail: {
|
|
229
193
|
componentUid: props.uid,
|
|
230
|
-
isThemeSection
|
|
231
|
-
isShopifySection
|
|
194
|
+
isThemeSection: isThemeSection
|
|
232
195
|
}
|
|
233
196
|
});
|
|
234
197
|
window.dispatchEvent(event);
|
|
@@ -277,9 +240,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
277
240
|
return false;
|
|
278
241
|
};
|
|
279
242
|
const getSectionName = ()=>{
|
|
280
|
-
if (isShopifySection) {
|
|
281
|
-
return `Shopify section: ${props.name}`;
|
|
282
|
-
}
|
|
283
243
|
const checkRenamedSection = props.name && props.name === `Section ${props.uid}`;
|
|
284
244
|
if (getSectionNumber() >= SECTION_LIMIT - 5) {
|
|
285
245
|
return `${checkRenamedSection ? 'Section' : props?.name} ${getIndexSection() + 1}/${SECTION_LIMIT}`;
|
|
@@ -296,7 +256,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
296
256
|
"data-toolbar": true,
|
|
297
257
|
"data-toolbar-section": props.tag == 'Section',
|
|
298
258
|
"data-toolbar-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
|
|
299
|
-
"data-toolbar-shopify-section": props.tag == 'Section' && !!isShopifySection,
|
|
300
259
|
"data-toolbar-limit": getIndexSection() >= SECTION_LIMIT,
|
|
301
260
|
children: [
|
|
302
261
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -339,39 +298,9 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
339
298
|
]
|
|
340
299
|
})
|
|
341
300
|
}),
|
|
342
|
-
props.tag == 'Section' ? /*#__PURE__*/ jsxRuntime.
|
|
301
|
+
props.tag == 'Section' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
343
302
|
"data-toolbar-name": true,
|
|
344
|
-
children:
|
|
345
|
-
getSectionName(),
|
|
346
|
-
props.isShopifySection && !props.isShopifyVisibility && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
347
|
-
"data-toolbar-visibility": true,
|
|
348
|
-
width: "20",
|
|
349
|
-
height: "20",
|
|
350
|
-
viewBox: "0 0 20 20",
|
|
351
|
-
fill: "none",
|
|
352
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
353
|
-
children: [
|
|
354
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
355
|
-
fillRule: "evenodd",
|
|
356
|
-
clipRule: "evenodd",
|
|
357
|
-
d: "M13.1252 9.99773C13.1243 8.27226 11.7248 6.87423 9.99935 6.87506C8.27386 6.87561 6.87518 8.27455 6.87518 10.0001C6.87518 11.7259 8.27429 13.1251 10.0002 13.1251C11.7257 13.1251 13.125 11.727 13.1252 10.0011V9.99773ZM9.99985 8.12506C11.035 8.12451 11.8746 8.96322 11.8752 9.99839V10.0004C11.8752 11.0357 11.0359 11.8751 10.0002 11.8751C8.96465 11.8751 8.12518 11.0356 8.12518 10.0001C8.12518 8.96472 8.96451 8.12533 9.99985 8.12506Z",
|
|
358
|
-
fill: "#F9F9F9"
|
|
359
|
-
}),
|
|
360
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
361
|
-
fillRule: "evenodd",
|
|
362
|
-
clipRule: "evenodd",
|
|
363
|
-
d: "M9.99885 4.37593C5.66421 4.37604 2.80603 7.64523 1.79548 9.00983C1.35636 9.60279 1.35918 10.4 1.80012 10.9902C2.81706 12.3514 5.69374 15.6241 9.99886 15.6241C14.3806 15.6241 17.2194 12.3452 18.2168 10.9808C18.6473 10.392 18.6442 9.60472 18.211 9.01902C17.2056 7.65938 14.3429 4.37583 9.99885 4.37593ZM2.80002 9.75374C3.77049 8.44326 6.30207 5.62602 9.99888 5.62593C13.7041 5.62585 16.24 8.45598 17.206 9.76225C17.3146 9.9091 17.3149 10.0965 17.2077 10.2431C16.254 11.5477 13.7416 14.3741 9.99886 14.3741C6.33149 14.3741 3.78173 11.5541 2.80152 10.242C2.69021 10.0931 2.69001 9.90229 2.80002 9.75374Z",
|
|
364
|
-
fill: "#F9F9F9"
|
|
365
|
-
}),
|
|
366
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
367
|
-
fillRule: "evenodd",
|
|
368
|
-
clipRule: "evenodd",
|
|
369
|
-
d: "M18.0763 3.26988C18.3415 3.58809 18.2985 4.06101 17.9803 4.32619L2.98032 16.8262C2.66211 17.0914 2.18919 17.0484 1.92402 16.7302C1.65884 16.412 1.70184 15.939 2.02004 15.6739L17.02 3.17385C17.3383 2.90868 17.8112 2.95167 18.0763 3.26988Z",
|
|
370
|
-
fill: "#F9F9F9"
|
|
371
|
-
})
|
|
372
|
-
]
|
|
373
|
-
})
|
|
374
|
-
]
|
|
303
|
+
children: getSectionName()
|
|
375
304
|
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
376
305
|
"data-toolbar-name": true,
|
|
377
306
|
children: toolbarName()
|
|
@@ -451,10 +380,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
451
380
|
]
|
|
452
381
|
}, parent.uid);
|
|
453
382
|
}),
|
|
454
|
-
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() &&
|
|
455
|
-
...props
|
|
456
|
-
}),
|
|
457
|
-
!props.isShopifySection && constant.ableGenerateContentElements.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(AIContentGenerator.AIContentGenerator, {
|
|
383
|
+
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
|
|
458
384
|
...props
|
|
459
385
|
}),
|
|
460
386
|
props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -475,42 +401,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
475
401
|
})
|
|
476
402
|
})
|
|
477
403
|
}),
|
|
478
|
-
toolbarName() === 'Product Title' && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
479
|
-
"data-toolbar-title": true,
|
|
480
|
-
enable: true,
|
|
481
|
-
"data-toolbar-disable": false,
|
|
482
|
-
text: "Edit content in Shopify",
|
|
483
|
-
position: "top",
|
|
484
|
-
onClick: goToShopifyEditLink,
|
|
485
|
-
"aria-hidden": "true",
|
|
486
|
-
children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
487
|
-
width: "16",
|
|
488
|
-
height: "16",
|
|
489
|
-
viewBox: "0 0 16 16",
|
|
490
|
-
fill: "none",
|
|
491
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
492
|
-
children: [
|
|
493
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
494
|
-
fillRule: "evenodd",
|
|
495
|
-
clipRule: "evenodd",
|
|
496
|
-
d: "M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",
|
|
497
|
-
fill: "currentColor"
|
|
498
|
-
}),
|
|
499
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
500
|
-
d: "M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",
|
|
501
|
-
fill: "currentColor"
|
|
502
|
-
}),
|
|
503
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
504
|
-
d: "M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",
|
|
505
|
-
fill: "currentColor"
|
|
506
|
-
}),
|
|
507
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
508
|
-
d: "M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",
|
|
509
|
-
fill: "currentColor"
|
|
510
|
-
})
|
|
511
|
-
]
|
|
512
|
-
})
|
|
513
|
-
}),
|
|
514
404
|
/*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
515
405
|
enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
516
406
|
text: "Page has reached Shopify’s 25 section-limit",
|
|
@@ -564,7 +454,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
564
454
|
"data-outline": true,
|
|
565
455
|
"data-outline-section": props.tag == 'Section',
|
|
566
456
|
"data-outline-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
|
|
567
|
-
"data-outline-shopify-section": props.tag == 'Section' && !!isShopifySection,
|
|
568
457
|
"data-outline-limit": getIndexSection() >= SECTION_LIMIT
|
|
569
458
|
}, 'outline-' + props.uid),
|
|
570
459
|
props.tag == 'Section' && !isThemeSectionEditor && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -611,15 +500,12 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
611
500
|
})
|
|
612
501
|
]
|
|
613
502
|
}),
|
|
614
|
-
constant.ableGenerateContentElements.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(AIGenContentLoading.AIGenContentLoading, {
|
|
615
|
-
...props
|
|
616
|
-
}),
|
|
617
503
|
/*#__PURE__*/ jsxRuntime.jsx(Resize.default, {
|
|
618
504
|
...props
|
|
619
505
|
})
|
|
620
506
|
]
|
|
621
507
|
});
|
|
622
508
|
};
|
|
623
|
-
var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview);
|
|
509
|
+
var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview);
|
|
624
510
|
|
|
625
511
|
exports.default = ComponentToolbarPreview$1;
|
|
@@ -14,10 +14,8 @@ require('swr');
|
|
|
14
14
|
require('@gem-sdk/adapter-shopify');
|
|
15
15
|
require('swr/mutation');
|
|
16
16
|
var shop = require('../hooks/shop.js');
|
|
17
|
-
require('swr/infinite');
|
|
18
17
|
require('vanilla-lazyload');
|
|
19
18
|
require('../hooks/useCartUI.js');
|
|
20
|
-
var cls = require('../helpers/cls.js');
|
|
21
19
|
require('../helpers/convert.js');
|
|
22
20
|
|
|
23
21
|
const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
@@ -43,10 +41,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
43
41
|
if (props.tag === 'Section' && props.isThemeSection) {
|
|
44
42
|
customProps['data-theme-section'] = true;
|
|
45
43
|
}
|
|
46
|
-
if (props.tag === 'Section' && props.isShopifySection) {
|
|
47
|
-
customProps['data-shopify-section'] = true;
|
|
48
|
-
customProps['data-toolbar-wrap'] = true;
|
|
49
|
-
}
|
|
50
44
|
// Build editor configs
|
|
51
45
|
if (props.editorConfigs) {
|
|
52
46
|
const editorConfigs = props.editorConfigs;
|
|
@@ -101,40 +95,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
101
95
|
'data-component-label': props.label,
|
|
102
96
|
'data-not-droppable': isNotDroppable(props.tag)
|
|
103
97
|
};
|
|
104
|
-
const ShopifySection = ({ name, visibility })=>{
|
|
105
|
-
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
106
|
-
className: cls.cls('gp-flex gp-items-center gp-justify-center gp-gap-[8px] gp-bg-[#F4F4F4] gp-p-[16px] gp-border gp-border-[#D6D6D6]', {
|
|
107
|
-
'gp-opacity-60': !visibility
|
|
108
|
-
}),
|
|
109
|
-
children: [
|
|
110
|
-
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
111
|
-
width: "24",
|
|
112
|
-
height: "24",
|
|
113
|
-
viewBox: "0 0 24 24",
|
|
114
|
-
fill: "none",
|
|
115
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
116
|
-
children: [
|
|
117
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
118
|
-
d: "M19.1475 5.16194C19.1416 5.1148 19.1197 5.0713 19.0857 5.03911C19.0516 5.00692 19.0076 4.9881 18.9614 4.98597C18.8835 4.98597 17.3469 4.95397 17.3469 4.95397C17.3469 4.95397 16.0588 3.67419 15.9342 3.5311C15.8104 3.40312 15.5619 3.43512 15.4684 3.46711L14.8166 3.67508C14.7361 3.40491 14.6323 3.14259 14.5067 2.89121C14.0566 1.99536 13.3727 1.51544 12.5659 1.51544C12.5044 1.51544 12.4577 1.51544 12.3954 1.53144C12.3642 1.49945 12.3486 1.46745 12.3175 1.45145C11.9608 1.06752 11.5107 0.875552 10.967 0.891549C9.92824 0.923543 8.88772 1.70741 8.03419 3.08318C7.44467 4.05901 6.99453 5.27392 6.8543 6.21776C5.65969 6.6017 4.82087 6.87365 4.79057 6.87365C4.18461 7.06562 4.16903 7.08161 4.09199 7.67351C4.06082 8.12144 2.47754 20.7415 2.47754 20.7415L15.7636 23.1091L21.522 21.6374C21.5064 21.6374 19.1631 5.27392 19.1475 5.16194ZM14.1492 3.89904C13.8062 4.00572 13.4648 4.11772 13.1251 4.23498C13.1251 3.69108 13.0472 2.92321 12.8143 2.28331C13.6064 2.41129 13.9942 3.33914 14.1492 3.89904ZM12.4265 4.44206C11.7279 4.66602 10.9679 4.90598 10.207 5.14594C10.4243 4.29808 10.8277 3.46623 11.3245 2.90632C11.533 2.66965 11.7863 2.47913 12.069 2.34641C12.3806 2.9712 12.4421 3.85105 12.4265 4.44206ZM10.9982 1.61143C11.2466 1.61143 11.4483 1.65942 11.6197 1.7874C11.3127 1.95192 11.0387 2.17444 10.8121 2.44329C10.1455 3.17916 9.63305 4.31408 9.43135 5.4179C8.79423 5.62586 8.17356 5.81783 7.61521 5.9938C7.98744 4.25009 9.39933 1.65942 10.9982 1.61143Z",
|
|
119
|
-
fill: "#95BF47"
|
|
120
|
-
}),
|
|
121
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
122
|
-
d: "M18.9647 4.94709C18.8851 4.94709 17.3155 4.91503 17.3155 4.91503C17.3155 4.91503 15.9981 3.63242 15.8716 3.48812C15.8261 3.43951 15.7635 3.41074 15.6973 3.40796V23.1094L21.5828 21.6344L19.1709 5.12345C19.1399 5.01122 19.0444 4.94709 18.9647 4.94709Z",
|
|
123
|
-
fill: "#5E8E3E"
|
|
124
|
-
}),
|
|
125
|
-
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
126
|
-
d: "M13.0575 8.51577L12.3029 10.8908C12.3029 10.8908 11.4602 10.5663 10.4599 10.6253C8.98595 10.6991 8.98595 11.4809 8.98595 11.6727C9.07404 12.7348 12.39 12.9709 12.5828 15.4631C12.7238 17.4251 11.3545 18.7675 9.35396 18.8708C6.96778 18.9733 5.65137 17.7939 5.65137 17.7939L6.16032 15.9794C6.16032 15.9794 7.49435 16.8203 8.5465 16.7613C9.23162 16.7318 9.4949 16.245 9.45967 15.9204C9.35396 14.5337 6.65165 14.6223 6.47645 12.3365C6.33551 10.4188 7.82712 8.48626 11.1265 8.30924C12.4076 8.23548 13.0575 8.51577 13.0575 8.51577Z",
|
|
127
|
-
fill: "white"
|
|
128
|
-
})
|
|
129
|
-
]
|
|
130
|
-
}),
|
|
131
|
-
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
132
|
-
className: "gp-text-[#212121] gp-text-[14px] gp-leading-[24px] gp-font-medium",
|
|
133
|
-
children: name
|
|
134
|
-
})
|
|
135
|
-
]
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
98
|
if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
|
|
139
99
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
140
100
|
children: [
|
|
@@ -149,10 +109,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
149
109
|
builderAttrs,
|
|
150
110
|
advanced,
|
|
151
111
|
children: [
|
|
152
|
-
props
|
|
153
|
-
name: props.name ?? '',
|
|
154
|
-
visibility: !!props.isShopifyVisibility
|
|
155
|
-
}) : children.props['children'],
|
|
112
|
+
children.props['children'],
|
|
156
113
|
/*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.default, {
|
|
157
114
|
...props
|
|
158
115
|
})
|
|
@@ -9,14 +9,11 @@ require('zustand');
|
|
|
9
9
|
require('swr');
|
|
10
10
|
require('@gem-sdk/adapter-shopify');
|
|
11
11
|
require('swr/mutation');
|
|
12
|
-
require('swr/infinite');
|
|
13
12
|
require('vanilla-lazyload');
|
|
14
13
|
require('../hooks/useCartUI.js');
|
|
15
14
|
require('react-transition-group');
|
|
16
15
|
require('@gem-sdk/core');
|
|
17
16
|
var constant = require('./constant.js');
|
|
18
|
-
require('classnames');
|
|
19
|
-
require('dayjs');
|
|
20
17
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
21
18
|
var convert = require('../helpers/convert.js');
|
|
22
19
|
var render = require('../helpers/render.js');
|
|
@@ -11,13 +11,10 @@ require('swr');
|
|
|
11
11
|
require('@gem-sdk/adapter-shopify');
|
|
12
12
|
require('swr/mutation');
|
|
13
13
|
var shop = require('../hooks/shop.js');
|
|
14
|
-
require('swr/infinite');
|
|
15
14
|
require('vanilla-lazyload');
|
|
16
15
|
require('../hooks/useCartUI.js');
|
|
17
16
|
require('react-transition-group');
|
|
18
17
|
require('@gem-sdk/core');
|
|
19
|
-
require('classnames');
|
|
20
|
-
require('dayjs');
|
|
21
18
|
require('../helpers/convert.js');
|
|
22
19
|
|
|
23
20
|
const RenderCustomCode = ({ uid, advanced })=>{
|
|
@@ -36,10 +36,7 @@ const disableWrap = [
|
|
|
36
36
|
'ProductImagesV2',
|
|
37
37
|
'PostPurchaseProductImages',
|
|
38
38
|
'Sticky',
|
|
39
|
-
'Heading'
|
|
40
|
-
'ProductBadge',
|
|
41
|
-
'Marquee',
|
|
42
|
-
'MarqueeItem'
|
|
39
|
+
'Heading'
|
|
43
40
|
];
|
|
44
41
|
const customRenderChildren = [
|
|
45
42
|
'Accordion',
|
|
@@ -50,8 +47,7 @@ const customRenderChildren = [
|
|
|
50
47
|
];
|
|
51
48
|
const excludeApplyStyle = [
|
|
52
49
|
'IconListV2',
|
|
53
|
-
'IconList'
|
|
54
|
-
'ProductBadge'
|
|
50
|
+
'IconList'
|
|
55
51
|
];
|
|
56
52
|
const postPurchaseRequiredElements = [
|
|
57
53
|
'PostPurchaseProductOffer',
|
|
@@ -70,20 +66,7 @@ const postPurchaseWrapElements = [
|
|
|
70
66
|
'PostPurchaseCalloutBox',
|
|
71
67
|
'PostPurchaseProductOffer'
|
|
72
68
|
];
|
|
73
|
-
const ableGenerateContentElements = [
|
|
74
|
-
'Section',
|
|
75
|
-
'Row',
|
|
76
|
-
'Text',
|
|
77
|
-
'Heading',
|
|
78
|
-
'Accordion',
|
|
79
|
-
'Product',
|
|
80
|
-
'HeroBanner',
|
|
81
|
-
'IconList',
|
|
82
|
-
'IconListV2',
|
|
83
|
-
'AdvancedList'
|
|
84
|
-
];
|
|
85
69
|
|
|
86
|
-
exports.ableGenerateContentElements = ableGenerateContentElements;
|
|
87
70
|
exports.customRenderChildren = customRenderChildren;
|
|
88
71
|
exports.disableWrap = disableWrap;
|
|
89
72
|
exports.excludeApplyStyle = excludeApplyStyle;
|
|
@@ -10,13 +10,10 @@ 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');
|
|
14
13
|
require('vanilla-lazyload');
|
|
15
14
|
require('../../hooks/useCartUI.js');
|
|
16
15
|
require('react-transition-group');
|
|
17
16
|
require('@gem-sdk/core');
|
|
18
|
-
require('classnames');
|
|
19
|
-
require('dayjs');
|
|
20
17
|
require('../../helpers/convert.js');
|
|
21
18
|
|
|
22
19
|
function Spacing(props) {
|
|
@@ -8,11 +8,8 @@ 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');
|
|
12
11
|
require('vanilla-lazyload');
|
|
13
12
|
require('../../hooks/useCartUI.js');
|
|
14
|
-
require('classnames');
|
|
15
|
-
require('dayjs');
|
|
16
13
|
require('../../helpers/convert.js');
|
|
17
14
|
|
|
18
15
|
const SHOW_TOOLTIP_TIMEOUT = 600;
|
|
@@ -28,11 +28,10 @@ const root = {
|
|
|
28
28
|
label: 'Root',
|
|
29
29
|
childrens: []
|
|
30
30
|
};
|
|
31
|
-
const createBuilderPreviewProvider = (args,
|
|
31
|
+
const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.createStore((set, get)=>({
|
|
32
32
|
state: args,
|
|
33
33
|
loaded: false,
|
|
34
34
|
isThemeSectionEditor: !!isThemeSectionEditor,
|
|
35
|
-
pageName: pageName,
|
|
36
35
|
dynamicProduct: null,
|
|
37
36
|
dynamicCollection: null,
|
|
38
37
|
addItem: (args)=>{
|
|
@@ -254,11 +253,7 @@ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>zus
|
|
|
254
253
|
}
|
|
255
254
|
},
|
|
256
255
|
getItem: (id)=>{
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
...item,
|
|
260
|
-
rawChildrens: item?.childrens?.map((v)=>get().state[v])
|
|
261
|
-
};
|
|
256
|
+
return get().state[id];
|
|
262
257
|
},
|
|
263
258
|
removeItem: (id)=>{
|
|
264
259
|
if (id === 'ROOT') {
|
|
@@ -433,16 +428,15 @@ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>zus
|
|
|
433
428
|
updateItemAttribute: (id, value, attr)=>{
|
|
434
429
|
if (!attr || ![
|
|
435
430
|
'label',
|
|
436
|
-
'customLabel'
|
|
437
|
-
'isShopifyVisibility'
|
|
431
|
+
'customLabel'
|
|
438
432
|
].includes(attr)) return;
|
|
439
433
|
const state = get().state;
|
|
440
434
|
const item = state[id];
|
|
435
|
+
// Ignore section
|
|
436
|
+
if (item?.type === 'section') return;
|
|
441
437
|
if (item) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
item.dateModified = dateModified;
|
|
445
|
-
}
|
|
438
|
+
const dateModified = Date.now();
|
|
439
|
+
item.dateModified = dateModified;
|
|
446
440
|
const updatedItem = {
|
|
447
441
|
...item,
|
|
448
442
|
[attr]: value
|
|
@@ -456,14 +450,13 @@ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>zus
|
|
|
456
450
|
}
|
|
457
451
|
}
|
|
458
452
|
}));
|
|
459
|
-
const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor,
|
|
453
|
+
const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
|
|
460
454
|
const Component = lazy ? react.Suspense : react.Fragment;
|
|
461
455
|
const value = react.useMemo(()=>{
|
|
462
|
-
return createBuilderPreviewProvider(state,
|
|
456
|
+
return createBuilderPreviewProvider(state, isThemeSectionEditor);
|
|
463
457
|
}, [
|
|
464
458
|
state,
|
|
465
|
-
isThemeSectionEditor
|
|
466
|
-
pageName
|
|
459
|
+
isThemeSectionEditor
|
|
467
460
|
]);
|
|
468
461
|
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
469
462
|
children: /*#__PURE__*/ jsxRuntime.jsx(BuilderPreviewContext.Provider, {
|
|
@@ -10,7 +10,6 @@ const SectionContext = /*#__PURE__*/ react.createContext(null);
|
|
|
10
10
|
const createSectionProvider = (data)=>zustand.createStore((set, get)=>({
|
|
11
11
|
data: data ?? {},
|
|
12
12
|
getSection: (id)=>{
|
|
13
|
-
console.log('get().data', get().data);
|
|
14
13
|
const section = get().data[id];
|
|
15
14
|
return section ?? undefined;
|
|
16
15
|
},
|
|
@@ -53,24 +53,6 @@ const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps
|
|
|
53
53
|
const store = react.useMemo(()=>createShopStoreProvider(storeOption), [
|
|
54
54
|
storeOption
|
|
55
55
|
]);
|
|
56
|
-
const onUpdateLimitation = (e)=>{
|
|
57
|
-
const isAllow = !!e.detail?.isAllow;
|
|
58
|
-
const maxGenerateCount = e.detail?.maxGenerateCount;
|
|
59
|
-
const nextQuota = e.detail?.nextQuota;
|
|
60
|
-
store.setState({
|
|
61
|
-
generateContentLimitation: {
|
|
62
|
-
isAllow,
|
|
63
|
-
maxGenerateCount,
|
|
64
|
-
nextQuota
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
react.useEffect(()=>{
|
|
69
|
-
window.addEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
70
|
-
return ()=>{
|
|
71
|
-
window.removeEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
|
|
72
|
-
};
|
|
73
|
-
}, []);
|
|
74
56
|
return /*#__PURE__*/ jsxRuntime.jsx(AddonContext.AddonProvider, {
|
|
75
57
|
components: addons,
|
|
76
58
|
children: /*#__PURE__*/ jsxRuntime.jsx(useSWR.SWRConfig, {
|
|
@@ -9,9 +9,7 @@ const getStyleBackgroundByDevice = (background, options)=>{
|
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
11
|
return {
|
|
12
|
-
|
|
13
|
-
...getStyleBgColor(background)
|
|
14
|
-
} : {},
|
|
12
|
+
...getStyleBgColor(background),
|
|
15
13
|
...!options?.ignoreBackgroundImage ? {
|
|
16
14
|
...getStyleBgImage(background, options),
|
|
17
15
|
...getStyleBgPosition(background),
|
|
@@ -205,7 +203,7 @@ const getGradientBgrStyleForButton = (backgroundStyle)=>{
|
|
|
205
203
|
});
|
|
206
204
|
return bgrStyle;
|
|
207
205
|
};
|
|
208
|
-
const getGradientBgrStyleByDevice = (backgroundStyle
|
|
206
|
+
const getGradientBgrStyleByDevice = (backgroundStyle)=>{
|
|
209
207
|
if (!backgroundStyle) return;
|
|
210
208
|
const bgrStyle = {};
|
|
211
209
|
[
|
|
@@ -216,7 +214,7 @@ const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage = fa
|
|
|
216
214
|
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY)) {
|
|
217
215
|
Object.assign(bgrStyle, {
|
|
218
216
|
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]: 'transparent',
|
|
219
|
-
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]:
|
|
217
|
+
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
220
218
|
});
|
|
221
219
|
}
|
|
222
220
|
});
|
|
@@ -229,5 +227,4 @@ exports.getBgImageByDevice = getBgImageByDevice;
|
|
|
229
227
|
exports.getGradientBgrStyleByDevice = getGradientBgrStyleByDevice;
|
|
230
228
|
exports.getGradientBgrStyleForButton = getGradientBgrStyleForButton;
|
|
231
229
|
exports.getStyleBackgroundByDevice = getStyleBackgroundByDevice;
|
|
232
|
-
exports.getStyleBgColor = getStyleBgColor;
|
|
233
230
|
exports.makeFixedBgAttachment = makeFixedBgAttachment;
|
|
@@ -2,21 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
var getResonsiveValue = require('./get-resonsive-value.js');
|
|
4
4
|
|
|
5
|
-
const getCarouselContainerHeight = (dotStyle)=>{
|
|
6
|
-
const getVal = (dotStyle)=>{
|
|
7
|
-
|
|
5
|
+
const getCarouselContainerHeight = (dotStyle, dotSize, dotGapToCarousel)=>{
|
|
6
|
+
const getVal = (dotStyle, dotSize, dotGapToCarousel)=>{
|
|
7
|
+
if (dotStyle === 'outside') {
|
|
8
|
+
return `calc(100% - ${dotSize ?? '0'}px - ${!dotGapToCarousel || dotGapToCarousel === 'Auto' ? '0' : dotGapToCarousel}px)`;
|
|
9
|
+
}
|
|
10
|
+
return '100%';
|
|
8
11
|
};
|
|
9
12
|
return {
|
|
10
|
-
desktop: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'desktop')),
|
|
11
|
-
tablet: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'tablet')),
|
|
12
|
-
mobile: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'mobile'))
|
|
13
|
+
desktop: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'desktop'), getResonsiveValue.getResponsiveValueByScreen(dotSize, 'desktop'), getResonsiveValue.getResponsiveValueByScreen(dotGapToCarousel, 'desktop')),
|
|
14
|
+
tablet: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'tablet'), getResonsiveValue.getResponsiveValueByScreen(dotSize, 'tablet'), getResonsiveValue.getResponsiveValueByScreen(dotGapToCarousel, 'tablet')),
|
|
15
|
+
mobile: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'mobile'), getResonsiveValue.getResponsiveValueByScreen(dotSize, 'mobile'), getResonsiveValue.getResponsiveValueByScreen(dotGapToCarousel, 'mobile'))
|
|
13
16
|
};
|
|
14
17
|
};
|
|
15
18
|
const makeContainerWidthOrHeight = (setting)=>{
|
|
16
19
|
const getStyleName = (vertical)=>{
|
|
17
20
|
return vertical ? 'w' : 'h';
|
|
18
21
|
};
|
|
19
|
-
const result = getCarouselContainerHeight(setting.dotStyle);
|
|
22
|
+
const result = getCarouselContainerHeight(setting.dotStyle, setting.dotSize, setting.dotGapToCarousel);
|
|
20
23
|
return {
|
|
21
24
|
[`--${getStyleName(getResonsiveValue.getResponsiveValueByScreen(setting?.vertical, 'desktop'))}`]: result.desktop,
|
|
22
25
|
[`--${getStyleName(getResonsiveValue.getResponsiveValueByScreen(setting?.vertical, 'tablet'))}-tablet`]: result.tablet,
|
|
@@ -119,7 +119,7 @@ const getGlobalColorStateStyle = (type, data)=>{
|
|
|
119
119
|
return Object.fromEntries(Object.entries(data).map(([state, value])=>{
|
|
120
120
|
if (state === 'active') return [];
|
|
121
121
|
return [
|
|
122
|
-
`-${constant.stateMapping?.[state]
|
|
122
|
+
`-${constant.stateMapping?.[state]}-${type}`,
|
|
123
123
|
getSingleColorVariable(value)
|
|
124
124
|
];
|
|
125
125
|
}).filter(isDefined.isDefined));
|
|
@@ -156,7 +156,7 @@ const getSingleColorVariable = (color)=>{
|
|
|
156
156
|
};
|
|
157
157
|
function isColor(color) {
|
|
158
158
|
if (!color || typeof color !== 'string') return false;
|
|
159
|
-
return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent')
|
|
159
|
+
return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
|
|
160
160
|
}
|
|
161
161
|
const getGlobalColorStyle = (data)=>{
|
|
162
162
|
if (!data) return {};
|
|
@@ -80,28 +80,6 @@ const getProductQueryAll = async (fetcher, arg)=>{
|
|
|
80
80
|
const pageData = await fetchProducts(fetcher, variables);
|
|
81
81
|
return pageData;
|
|
82
82
|
};
|
|
83
|
-
const getListProductByVariables = async (fetcher, arg)=>{
|
|
84
|
-
const variables = {
|
|
85
|
-
first: arg.first || 8,
|
|
86
|
-
firstMedia: 1,
|
|
87
|
-
firstVariant: 1,
|
|
88
|
-
orderBy: {
|
|
89
|
-
field: 'PLATFORM_CREATED_AT',
|
|
90
|
-
direction: 'DESC'
|
|
91
|
-
},
|
|
92
|
-
orderByMedia: {
|
|
93
|
-
field: 'POSITION',
|
|
94
|
-
direction: 'ASC'
|
|
95
|
-
},
|
|
96
|
-
where: {
|
|
97
|
-
status: 'ACTIVE',
|
|
98
|
-
...arg.where
|
|
99
|
-
},
|
|
100
|
-
after: arg.after
|
|
101
|
-
};
|
|
102
|
-
const pageData = await fetchProducts(fetcher, variables);
|
|
103
|
-
return pageData;
|
|
104
|
-
};
|
|
105
83
|
const fetchProducts = async (fetcher, variables)=>{
|
|
106
84
|
return fetcher([
|
|
107
85
|
products_generated.ProductsDocument,
|
|
@@ -209,6 +187,5 @@ const mergeMediasToProducts = async ({ fetcher, products, isSample, isStorefront
|
|
|
209
187
|
// );
|
|
210
188
|
// };
|
|
211
189
|
|
|
212
|
-
exports.getListProductByVariables = getListProductByVariables;
|
|
213
190
|
exports.getProductQueryAll = getProductQueryAll;
|
|
214
191
|
exports.getProducts = getProducts;
|