@gem-sdk/core 1.44.0-dev.145 → 1.44.0-staging.49
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 +2 -2
- package/dist/cjs/components/ComponentWrapperPreview.js +0 -3
- package/dist/cjs/components/RenderPreview.js +0 -1
- package/dist/cjs/components/constant.js +2 -7
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +5 -14
- package/dist/cjs/contexts/BuilderPreviewContext.js +1 -5
- package/dist/cjs/contexts/SectionContext.js +0 -1
- package/dist/cjs/helpers/background.js +3 -6
- package/dist/cjs/helpers/colors.js +2 -2
- package/dist/cjs/helpers/shadow.js +1 -1
- package/dist/cjs/hooks/useFormatMoney.js +60 -61
- package/dist/cjs/index.js +0 -13
- package/dist/esm/components/ComponentToolbarPreview.js +3 -3
- package/dist/esm/components/ComponentWrapperPreview.js +0 -3
- package/dist/esm/components/RenderPreview.js +0 -1
- package/dist/esm/components/constant.js +2 -7
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +5 -14
- package/dist/esm/contexts/BuilderPreviewContext.js +1 -5
- package/dist/esm/contexts/SectionContext.js +0 -1
- package/dist/esm/helpers/background.js +4 -6
- package/dist/esm/helpers/colors.js +2 -2
- package/dist/esm/helpers/shadow.js +1 -1
- package/dist/esm/hooks/useFormatMoney.js +61 -61
- package/dist/esm/index.js +2 -6
- package/dist/types/index.d.ts +42 -231
- package/package.json +3 -3
- 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 -33
- 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 -30
|
@@ -562,7 +562,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
562
562
|
})
|
|
563
563
|
]
|
|
564
564
|
}, props.uid),
|
|
565
|
-
isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.
|
|
565
|
+
isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatus, {
|
|
566
566
|
...props
|
|
567
567
|
}),
|
|
568
568
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -625,6 +625,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
625
625
|
]
|
|
626
626
|
});
|
|
627
627
|
};
|
|
628
|
-
var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview);
|
|
628
|
+
var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview);
|
|
629
629
|
|
|
630
630
|
exports.default = ComponentToolbarPreview$1;
|
|
@@ -135,9 +135,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
135
135
|
if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
|
|
136
136
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
137
137
|
children: [
|
|
138
|
-
/*#__PURE__*/ jsxRuntime.jsx(ComponentAnimation.default, {
|
|
139
|
-
...props
|
|
140
|
-
}),
|
|
141
138
|
/*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
|
|
142
139
|
uid: props.uid,
|
|
143
140
|
advanced: advanced
|
|
@@ -45,7 +45,6 @@ const RenderPreview = ({ uid, ...passProps })=>{
|
|
|
45
45
|
setting: item.settings,
|
|
46
46
|
...passProps,
|
|
47
47
|
children: item.childrens.map((id)=>/*#__PURE__*/ jsxRuntime.jsx(RenderPreviewMemo, {
|
|
48
|
-
...passProps,
|
|
49
48
|
uid: id
|
|
50
49
|
}, id))
|
|
51
50
|
}) : /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
@@ -36,11 +36,7 @@ const disableWrap = [
|
|
|
36
36
|
'ProductImagesV2',
|
|
37
37
|
'PostPurchaseProductImages',
|
|
38
38
|
'Sticky',
|
|
39
|
-
'Heading'
|
|
40
|
-
'ProductBadge',
|
|
41
|
-
'Marquee',
|
|
42
|
-
'MarqueeItem',
|
|
43
|
-
'EstimateDate'
|
|
39
|
+
'Heading'
|
|
44
40
|
];
|
|
45
41
|
const customRenderChildren = [
|
|
46
42
|
'Accordion',
|
|
@@ -51,8 +47,7 @@ const customRenderChildren = [
|
|
|
51
47
|
];
|
|
52
48
|
const excludeApplyStyle = [
|
|
53
49
|
'IconListV2',
|
|
54
|
-
'IconList'
|
|
55
|
-
'ProductBadge'
|
|
50
|
+
'IconList'
|
|
56
51
|
];
|
|
57
52
|
const postPurchaseRequiredElements = [
|
|
58
53
|
'PostPurchaseProductOffer',
|
|
@@ -2,17 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
case 'DRAFT':
|
|
8
|
-
return 'This Theme Section is Draft. Publish page will also publish Theme Section.';
|
|
9
|
-
case 'NEED_PUBLISHING':
|
|
10
|
-
return 'Need to republish. Go to global edit and publish this section';
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
|
|
14
|
-
const isRenderThemeSectionStatus = tag === 'Section' && isThemeSection && (status === 'DRAFT' || status === 'NEED_PUBLISHING');
|
|
15
|
-
const statusMessage = getStatusMessage(status);
|
|
5
|
+
const ThemeSectionStatus = ({ ...props })=>{
|
|
6
|
+
const isRenderThemeSectionStatus = props.tag === 'Section' && props?.isThemeSection && props?.needPublishing;
|
|
16
7
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
17
8
|
children: isRenderThemeSectionStatus && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
18
9
|
"data-theme-section-status": true,
|
|
@@ -33,13 +24,13 @@ const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
|
|
|
33
24
|
})
|
|
34
25
|
})
|
|
35
26
|
}),
|
|
36
|
-
|
|
27
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
37
28
|
"data-theme-section-status-text": true,
|
|
38
|
-
children:
|
|
29
|
+
children: "Need to republish. Go to global edit and publish this section"
|
|
39
30
|
})
|
|
40
31
|
]
|
|
41
32
|
})
|
|
42
33
|
});
|
|
43
34
|
};
|
|
44
35
|
|
|
45
|
-
exports.
|
|
36
|
+
exports.ThemeSectionStatus = ThemeSectionStatus;
|
|
@@ -254,11 +254,7 @@ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>zus
|
|
|
254
254
|
}
|
|
255
255
|
},
|
|
256
256
|
getItem: (id)=>{
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
...item,
|
|
260
|
-
rawChildrens: item?.childrens?.map((v)=>get().state[v])
|
|
261
|
-
};
|
|
257
|
+
return get().state[id];
|
|
262
258
|
},
|
|
263
259
|
removeItem: (id)=>{
|
|
264
260
|
if (id === 'ROOT') {
|
|
@@ -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
|
},
|
|
@@ -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;
|
|
@@ -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 {};
|
|
@@ -27,7 +27,7 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
|
27
27
|
if (typeof value.distance == 'undefined') return {};
|
|
28
28
|
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
29
29
|
return {
|
|
30
|
-
[`-${!isActiveState ? constant.stateMapping?.[state]
|
|
30
|
+
[`-${!isActiveState ? constant.stateMapping?.[state] : ''}-${getShortname.getShortName(styleAppliedFor)}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
|
|
@@ -5,71 +5,70 @@ var shop = require('./shop.js');
|
|
|
5
5
|
const shopifyPriceRounding = (amount, precision)=>{
|
|
6
6
|
return parseFloat(`${amount}`).toFixed(Number(precision) + 1).slice(0, -1);
|
|
7
7
|
};
|
|
8
|
-
const formatMoney = function(cents, format) {
|
|
9
|
-
let value = '';
|
|
10
|
-
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
11
|
-
const formatString = format || '${{amount}}';
|
|
12
|
-
/**
|
|
13
|
-
* check default
|
|
14
|
-
* @param opt opt
|
|
15
|
-
* @param def def
|
|
16
|
-
* @returns any
|
|
17
|
-
*/ function defaultOption(opt, def) {
|
|
18
|
-
return typeof opt == 'undefined' ? def : opt;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* formatWithDelimiters
|
|
22
|
-
* @param number number
|
|
23
|
-
* @param precision precision
|
|
24
|
-
* @param thousands thousands
|
|
25
|
-
* @param decimal decimal
|
|
26
|
-
* @returns any
|
|
27
|
-
*/ // eslint-disable-next-line max-params
|
|
28
|
-
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
29
|
-
precision = defaultOption(precision, 2);
|
|
30
|
-
thousands = defaultOption(thousands, ',');
|
|
31
|
-
decimal = defaultOption(decimal, '.');
|
|
32
|
-
if (isNaN(number) || number == null) {
|
|
33
|
-
return 0;
|
|
34
|
-
}
|
|
35
|
-
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
36
|
-
number = shopifyPriceRounding(number, Number(precision));
|
|
37
|
-
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
38
|
-
return dollars + cents;
|
|
39
|
-
}
|
|
40
|
-
switch(formatString.match(placeholderRegex)[1]){
|
|
41
|
-
case 'amount':
|
|
42
|
-
value = formatWithDelimiters(cents, 2);
|
|
43
|
-
break;
|
|
44
|
-
case 'amount_no_decimals':
|
|
45
|
-
value = formatWithDelimiters(cents, 0);
|
|
46
|
-
break;
|
|
47
|
-
case 'amount_with_comma_separator':
|
|
48
|
-
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
49
|
-
break;
|
|
50
|
-
case 'amount_no_decimals_with_comma_separator':
|
|
51
|
-
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
52
|
-
break;
|
|
53
|
-
case 'amount_with_apostrophe_separator':
|
|
54
|
-
value = formatWithDelimiters(cents, 2, "'", '.');
|
|
55
|
-
break;
|
|
56
|
-
case 'amount_no_decimals_with_space_separator':
|
|
57
|
-
value = formatWithDelimiters(cents, 0, ' ');
|
|
58
|
-
break;
|
|
59
|
-
case 'amount_with_space_separator':
|
|
60
|
-
value = formatWithDelimiters(cents, 2, ' ', ',');
|
|
61
|
-
break;
|
|
62
|
-
case 'amount_with_period_and_space_separator':
|
|
63
|
-
value = formatWithDelimiters(cents, 2, ' ', '.');
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
return formatString.replace(placeholderRegex, value);
|
|
67
|
-
};
|
|
68
8
|
const useFormatMoney = (amount, withCurrency)=>{
|
|
69
9
|
const { moneyFormat, moneyWithCurrencyFormat } = shop.useMoneyFormat();
|
|
10
|
+
const formatMoney = function(cents, format) {
|
|
11
|
+
let value = '';
|
|
12
|
+
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
13
|
+
const formatString = format || '${{amount}}';
|
|
14
|
+
/**
|
|
15
|
+
* check default
|
|
16
|
+
* @param opt opt
|
|
17
|
+
* @param def def
|
|
18
|
+
* @returns any
|
|
19
|
+
*/ function defaultOption(opt, def) {
|
|
20
|
+
return typeof opt == 'undefined' ? def : opt;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* formatWithDelimiters
|
|
24
|
+
* @param number number
|
|
25
|
+
* @param precision precision
|
|
26
|
+
* @param thousands thousands
|
|
27
|
+
* @param decimal decimal
|
|
28
|
+
* @returns any
|
|
29
|
+
*/ // eslint-disable-next-line max-params
|
|
30
|
+
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
31
|
+
precision = defaultOption(precision, 2);
|
|
32
|
+
thousands = defaultOption(thousands, ',');
|
|
33
|
+
decimal = defaultOption(decimal, '.');
|
|
34
|
+
if (isNaN(number) || number == null) {
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
38
|
+
number = shopifyPriceRounding(number, Number(precision));
|
|
39
|
+
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
40
|
+
return dollars + cents;
|
|
41
|
+
}
|
|
42
|
+
switch(formatString.match(placeholderRegex)[1]){
|
|
43
|
+
case 'amount':
|
|
44
|
+
value = formatWithDelimiters(cents, 2);
|
|
45
|
+
break;
|
|
46
|
+
case 'amount_no_decimals':
|
|
47
|
+
value = formatWithDelimiters(cents, 0);
|
|
48
|
+
break;
|
|
49
|
+
case 'amount_with_comma_separator':
|
|
50
|
+
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
51
|
+
break;
|
|
52
|
+
case 'amount_no_decimals_with_comma_separator':
|
|
53
|
+
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
54
|
+
break;
|
|
55
|
+
case 'amount_with_apostrophe_separator':
|
|
56
|
+
value = formatWithDelimiters(cents, 2, "'", '.');
|
|
57
|
+
break;
|
|
58
|
+
case 'amount_no_decimals_with_space_separator':
|
|
59
|
+
value = formatWithDelimiters(cents, 0, ' ');
|
|
60
|
+
break;
|
|
61
|
+
case 'amount_with_space_separator':
|
|
62
|
+
value = formatWithDelimiters(cents, 2, ' ', ',');
|
|
63
|
+
break;
|
|
64
|
+
case 'amount_with_period_and_space_separator':
|
|
65
|
+
value = formatWithDelimiters(cents, 2, ' ', '.');
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return formatString.replace(placeholderRegex, value);
|
|
69
|
+
};
|
|
70
70
|
return withCurrency ? formatMoney(`${amount}`, moneyWithCurrencyFormat || moneyFormat) : formatMoney(`${amount}`, moneyFormat);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
exports.formatMoney = formatMoney;
|
|
74
73
|
exports.shopifyPriceRounding = shopifyPriceRounding;
|
|
75
74
|
exports.useFormatMoney = useFormatMoney;
|
package/dist/cjs/index.js
CHANGED
|
@@ -16,8 +16,6 @@ var ShopContext = require('./contexts/ShopContext.js');
|
|
|
16
16
|
var PageContext = require('./contexts/PageContext.js');
|
|
17
17
|
var CollectionContext = require('./contexts/CollectionContext.js');
|
|
18
18
|
var ModalContext = require('./contexts/ModalContext.js');
|
|
19
|
-
var ArticleListContext = require('./contexts/ArticleListContext.js');
|
|
20
|
-
var ArticleContext = require('./contexts/ArticleContext.js');
|
|
21
19
|
var pageViewUp_generated = require('./graphql/mutations/page-view-up.generated.js');
|
|
22
20
|
var collectionDetailFilter_generated = require('./graphql/queries/collection-detail-filter.generated.js');
|
|
23
21
|
var collection_generated = require('./graphql/queries/collection.generated.js');
|
|
@@ -60,7 +58,6 @@ var iconList = require('./helpers/icon-list.js');
|
|
|
60
58
|
var isDefined = require('./helpers/is-defined.js');
|
|
61
59
|
var layout = require('./helpers/layout.js');
|
|
62
60
|
var makeStyle = require('./helpers/make-style.js');
|
|
63
|
-
var align = require('./helpers/align.js');
|
|
64
61
|
var product = require('./helpers/product.js');
|
|
65
62
|
var query = require('./helpers/query.js');
|
|
66
63
|
var radius = require('./helpers/radius.js');
|
|
@@ -92,7 +89,6 @@ var useIsomorphicLayoutEffect = require('./hooks/useIsomorphicLayoutEffect.js');
|
|
|
92
89
|
var useLoadScript = require('./hooks/useLoadScript.js');
|
|
93
90
|
var useMoney = require('./hooks/useMoney.js');
|
|
94
91
|
var usePrevious = require('./hooks/usePrevious.js');
|
|
95
|
-
var useArticlesQuery = require('./hooks/articles/useArticlesQuery.js');
|
|
96
92
|
var useProduct = require('./hooks/useProduct.js');
|
|
97
93
|
var useProductList = require('./hooks/useProductList.js');
|
|
98
94
|
var useSuspenseFetch = require('./hooks/useSuspenseFetch.js');
|
|
@@ -140,10 +136,6 @@ exports.CollectionProvider = CollectionContext.CollectionProvider;
|
|
|
140
136
|
exports.useCollectionStore = CollectionContext.useCollectionStore;
|
|
141
137
|
exports.ModalProvider = ModalContext.ModalProvider;
|
|
142
138
|
exports.useModalStore = ModalContext.useModalStore;
|
|
143
|
-
exports.ArticleListProvider = ArticleListContext.ArticleListProvider;
|
|
144
|
-
exports.useArticleListStore = ArticleListContext.useArticleListStore;
|
|
145
|
-
exports.ArticleProvider = ArticleContext.ArticleProvider;
|
|
146
|
-
exports.useArticleStore = ArticleContext.useArticleStore;
|
|
147
139
|
exports.PageViewUpDocument = pageViewUp_generated.PageViewUpDocument;
|
|
148
140
|
exports.CollectionDetailFilterDocument = collectionDetailFilter_generated.CollectionDetailFilterDocument;
|
|
149
141
|
exports.CollectionDocument = collection_generated.CollectionDocument;
|
|
@@ -195,7 +187,6 @@ exports.getBgImageByDevice = background.getBgImageByDevice;
|
|
|
195
187
|
exports.getGradientBgrStyleByDevice = background.getGradientBgrStyleByDevice;
|
|
196
188
|
exports.getGradientBgrStyleForButton = background.getGradientBgrStyleForButton;
|
|
197
189
|
exports.getStyleBackgroundByDevice = background.getStyleBackgroundByDevice;
|
|
198
|
-
exports.getStyleBgColor = background.getStyleBgColor;
|
|
199
190
|
exports.makeFixedBgAttachment = background.makeFixedBgAttachment;
|
|
200
191
|
exports.composeTextColorCss = colors.composeTextColorCss;
|
|
201
192
|
exports.getGlobalColorCSSProp = colors.getGlobalColorCSSProp;
|
|
@@ -241,7 +232,6 @@ exports.makeStyleResponsiveState = makeStyle.makeStyleResponsiveState;
|
|
|
241
232
|
exports.makeStyleState = makeStyle.makeStyleState;
|
|
242
233
|
exports.makeWidth = makeStyle.makeWidth;
|
|
243
234
|
exports.removeNullUndefined = makeStyle.removeNullUndefined;
|
|
244
|
-
exports.convertTextAlignToJustify = align.convertTextAlignToJustify;
|
|
245
235
|
exports.checkAvailableVariantInStock = product.checkAvailableVariantInStock;
|
|
246
236
|
exports.getSelectedVariant = product.getSelectedVariant;
|
|
247
237
|
exports.parseSelectedOption = product.parseSelectedOption;
|
|
@@ -315,7 +305,6 @@ exports.useProductQuery = useProductQuery.useProductQuery;
|
|
|
315
305
|
exports.useProductsQuery = useProductsQuery.useProductsQuery;
|
|
316
306
|
exports.useProductsQueryAll = useProductsQuery.useProductsQueryAll;
|
|
317
307
|
exports.useCurrentDevice = useCurrentDevice.useCurrentDevice;
|
|
318
|
-
exports.formatMoney = useFormatMoney.formatMoney;
|
|
319
308
|
exports.shopifyPriceRounding = useFormatMoney.shopifyPriceRounding;
|
|
320
309
|
exports.useFormatMoney = useFormatMoney.useFormatMoney;
|
|
321
310
|
exports.useLazyVideo = useLazyVideo.useLazyVideo;
|
|
@@ -331,8 +320,6 @@ exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect.default;
|
|
|
331
320
|
exports.useLoadScript = useLoadScript.default;
|
|
332
321
|
exports.useMoney = useMoney.default;
|
|
333
322
|
exports.usePrevious = usePrevious.usePrevious;
|
|
334
|
-
exports.useArticlesQuery = useArticlesQuery.useArticlesQuery;
|
|
335
|
-
exports.useBlogsQuery = useArticlesQuery.useBlogsQuery;
|
|
336
323
|
exports.useCheckAvailableVariantInStock = useProduct.useCheckAvailableVariantInStock;
|
|
337
324
|
exports.useCurrentVariant = useProduct.useCurrentVariant;
|
|
338
325
|
exports.useCurrentVariantInStock = useProduct.useCurrentVariantInStock;
|
|
@@ -11,7 +11,7 @@ import 'vanilla-lazyload';
|
|
|
11
11
|
import '../hooks/useCartUI.js';
|
|
12
12
|
import { CreateThemeSection } from './theme-section/CreateThemeSection.js';
|
|
13
13
|
import Tooltip from './toolbar/Tooltip.js';
|
|
14
|
-
import {
|
|
14
|
+
import { ThemeSectionStatus } from './theme-section/ThemeSectionStatus.js';
|
|
15
15
|
import Resize from './resize/Resize.js';
|
|
16
16
|
import { usePostPurchase } from '../hooks/useToolbarPostPurchase.js';
|
|
17
17
|
import { ableGenerateContentElements } from './constant.js';
|
|
@@ -558,7 +558,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
558
558
|
})
|
|
559
559
|
]
|
|
560
560
|
}, props.uid),
|
|
561
|
-
isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(
|
|
561
|
+
isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(ThemeSectionStatus, {
|
|
562
562
|
...props
|
|
563
563
|
}),
|
|
564
564
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -621,6 +621,6 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
621
621
|
]
|
|
622
622
|
});
|
|
623
623
|
};
|
|
624
|
-
var ComponentToolbarPreview$1 = /*#__PURE__*/ memo(ComponentToolbarPreview);
|
|
624
|
+
var ComponentToolbarPreview$1 = /*#__PURE__*/ memo(ComponentToolbarPreview);
|
|
625
625
|
|
|
626
626
|
export { ComponentToolbarPreview$1 as default };
|
|
@@ -131,9 +131,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
131
131
|
if (disableWrap.includes(props.tag) && /*#__PURE__*/ isValidElement(children)) {
|
|
132
132
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
133
133
|
children: [
|
|
134
|
-
/*#__PURE__*/ jsx(ComponentAnimation, {
|
|
135
|
-
...props
|
|
136
|
-
}),
|
|
137
134
|
/*#__PURE__*/ jsx(RenderCustomCode, {
|
|
138
135
|
uid: props.uid,
|
|
139
136
|
advanced: advanced
|
|
@@ -34,11 +34,7 @@ const disableWrap = [
|
|
|
34
34
|
'ProductImagesV2',
|
|
35
35
|
'PostPurchaseProductImages',
|
|
36
36
|
'Sticky',
|
|
37
|
-
'Heading'
|
|
38
|
-
'ProductBadge',
|
|
39
|
-
'Marquee',
|
|
40
|
-
'MarqueeItem',
|
|
41
|
-
'EstimateDate'
|
|
37
|
+
'Heading'
|
|
42
38
|
];
|
|
43
39
|
const customRenderChildren = [
|
|
44
40
|
'Accordion',
|
|
@@ -49,8 +45,7 @@ const customRenderChildren = [
|
|
|
49
45
|
];
|
|
50
46
|
const excludeApplyStyle = [
|
|
51
47
|
'IconListV2',
|
|
52
|
-
'IconList'
|
|
53
|
-
'ProductBadge'
|
|
48
|
+
'IconList'
|
|
54
49
|
];
|
|
55
50
|
const postPurchaseRequiredElements = [
|
|
56
51
|
'PostPurchaseProductOffer',
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
case 'DRAFT':
|
|
6
|
-
return 'This Theme Section is Draft. Publish page will also publish Theme Section.';
|
|
7
|
-
case 'NEED_PUBLISHING':
|
|
8
|
-
return 'Need to republish. Go to global edit and publish this section';
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
|
|
12
|
-
const isRenderThemeSectionStatus = tag === 'Section' && isThemeSection && (status === 'DRAFT' || status === 'NEED_PUBLISHING');
|
|
13
|
-
const statusMessage = getStatusMessage(status);
|
|
3
|
+
const ThemeSectionStatus = ({ ...props })=>{
|
|
4
|
+
const isRenderThemeSectionStatus = props.tag === 'Section' && props?.isThemeSection && props?.needPublishing;
|
|
14
5
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
15
6
|
children: isRenderThemeSectionStatus && /*#__PURE__*/ jsxs("div", {
|
|
16
7
|
"data-theme-section-status": true,
|
|
@@ -31,13 +22,13 @@ const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
|
|
|
31
22
|
})
|
|
32
23
|
})
|
|
33
24
|
}),
|
|
34
|
-
|
|
25
|
+
/*#__PURE__*/ jsx("span", {
|
|
35
26
|
"data-theme-section-status-text": true,
|
|
36
|
-
children:
|
|
27
|
+
children: "Need to republish. Go to global edit and publish this section"
|
|
37
28
|
})
|
|
38
29
|
]
|
|
39
30
|
})
|
|
40
31
|
});
|
|
41
32
|
};
|
|
42
33
|
|
|
43
|
-
export {
|
|
34
|
+
export { ThemeSectionStatus };
|
|
@@ -252,11 +252,7 @@ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>cre
|
|
|
252
252
|
}
|
|
253
253
|
},
|
|
254
254
|
getItem: (id)=>{
|
|
255
|
-
|
|
256
|
-
return {
|
|
257
|
-
...item,
|
|
258
|
-
rawChildrens: item?.childrens?.map((v)=>get().state[v])
|
|
259
|
-
};
|
|
255
|
+
return get().state[id];
|
|
260
256
|
},
|
|
261
257
|
removeItem: (id)=>{
|
|
262
258
|
if (id === 'ROOT') {
|
|
@@ -8,7 +8,6 @@ const SectionContext = /*#__PURE__*/ createContext(null);
|
|
|
8
8
|
const createSectionProvider = (data)=>createStore((set, get)=>({
|
|
9
9
|
data: data ?? {},
|
|
10
10
|
getSection: (id)=>{
|
|
11
|
-
console.log('get().data', get().data);
|
|
12
11
|
const section = get().data[id];
|
|
13
12
|
return section ?? undefined;
|
|
14
13
|
},
|
|
@@ -7,9 +7,7 @@ const getStyleBackgroundByDevice = (background, options)=>{
|
|
|
7
7
|
return {};
|
|
8
8
|
}
|
|
9
9
|
return {
|
|
10
|
-
|
|
11
|
-
...getStyleBgColor(background)
|
|
12
|
-
} : {},
|
|
10
|
+
...getStyleBgColor(background),
|
|
13
11
|
...!options?.ignoreBackgroundImage ? {
|
|
14
12
|
...getStyleBgImage(background, options),
|
|
15
13
|
...getStyleBgPosition(background),
|
|
@@ -203,7 +201,7 @@ const getGradientBgrStyleForButton = (backgroundStyle)=>{
|
|
|
203
201
|
});
|
|
204
202
|
return bgrStyle;
|
|
205
203
|
};
|
|
206
|
-
const getGradientBgrStyleByDevice = (backgroundStyle
|
|
204
|
+
const getGradientBgrStyleByDevice = (backgroundStyle)=>{
|
|
207
205
|
if (!backgroundStyle) return;
|
|
208
206
|
const bgrStyle = {};
|
|
209
207
|
[
|
|
@@ -214,11 +212,11 @@ const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage = fa
|
|
|
214
212
|
if (backgroundStyle[device]?.color?.includes(GRADIENT_BGR_KEY)) {
|
|
215
213
|
Object.assign(bgrStyle, {
|
|
216
214
|
[`--bgc${device !== 'desktop' ? '-' + device : ''}`]: 'transparent',
|
|
217
|
-
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]:
|
|
215
|
+
[`--bgi${device !== 'desktop' ? '-' + device : ''}`]: `${getBgImageByDevice(backgroundStyle, device) || 'url()'}, ${backgroundStyle[device]?.color}`
|
|
218
216
|
});
|
|
219
217
|
}
|
|
220
218
|
});
|
|
221
219
|
return bgrStyle;
|
|
222
220
|
};
|
|
223
221
|
|
|
224
|
-
export { GRADIENT_BGR_KEY, composeBackgroundCss, getBgImageByDevice, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getStyleBackgroundByDevice,
|
|
222
|
+
export { GRADIENT_BGR_KEY, composeBackgroundCss, getBgImageByDevice, getGradientBgrStyleByDevice, getGradientBgrStyleForButton, getStyleBackgroundByDevice, makeFixedBgAttachment };
|
|
@@ -117,7 +117,7 @@ const getGlobalColorStateStyle = (type, data)=>{
|
|
|
117
117
|
return Object.fromEntries(Object.entries(data).map(([state, value])=>{
|
|
118
118
|
if (state === 'active') return [];
|
|
119
119
|
return [
|
|
120
|
-
`-${stateMapping?.[state]
|
|
120
|
+
`-${stateMapping?.[state]}-${type}`,
|
|
121
121
|
getSingleColorVariable(value)
|
|
122
122
|
];
|
|
123
123
|
}).filter(isDefined));
|
|
@@ -154,7 +154,7 @@ const getSingleColorVariable = (color)=>{
|
|
|
154
154
|
};
|
|
155
155
|
function isColor(color) {
|
|
156
156
|
if (!color || typeof color !== 'string') return false;
|
|
157
|
-
return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent')
|
|
157
|
+
return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
|
|
158
158
|
}
|
|
159
159
|
const getGlobalColorStyle = (data)=>{
|
|
160
160
|
if (!data) return {};
|
|
@@ -25,7 +25,7 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
|
|
|
25
25
|
if (typeof value.distance == 'undefined') return {};
|
|
26
26
|
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
27
27
|
return {
|
|
28
|
-
[`-${!isActiveState ? stateMapping?.[state]
|
|
28
|
+
[`-${!isActiveState ? stateMapping?.[state] : ''}-${getShortName(styleAppliedFor)}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${getSingleColorVariable(value?.color)}` : 'none'
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
|