@gem-sdk/components 2.0.0-dev.550 → 2.0.0-dev.552
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/estimate-delivery/components/EstimateDate.liquid.js +64 -0
- package/dist/cjs/estimate-delivery/components/common/getNewSetting.js +2 -2
- package/dist/cjs/estimate-delivery/setting/configs/settings.js +9 -6
- package/dist/cjs/estimate-delivery/setting/configs/uiV2.js +3 -3
- package/dist/cjs/image/setting/Image.js +1 -1
- package/dist/cjs/image/setting/configs/settings.js +2 -1
- package/dist/cjs/image/setting/configs/uiV2.js +4 -4
- package/dist/cjs/index.liquid.js +2 -5
- package/dist/cjs/product/components/ProductBadge/common/getAttrs.js +2 -19
- package/dist/cjs/product/components/ProductBadge/index.liquid.js +15 -0
- package/dist/cjs/product/setting/constant/bundle-layout/horizontalThree.js +468 -464
- package/dist/cjs/product/setting/constant/bundle-layout/horizontalTwo.js +5 -1
- package/dist/cjs/product/setting/constant/bundle-layout/verticalThree.js +363 -359
- package/dist/cjs/product/setting/constant/bundle-layout/verticalTwo.js +363 -359
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +60 -0
- package/dist/esm/estimate-delivery/components/common/getNewSetting.js +2 -2
- package/dist/esm/estimate-delivery/setting/configs/settings.js +9 -6
- package/dist/esm/estimate-delivery/setting/configs/uiV2.js +3 -3
- package/dist/esm/image/setting/Image.js +1 -1
- package/dist/esm/image/setting/configs/settings.js +2 -1
- package/dist/esm/image/setting/configs/uiV2.js +4 -4
- package/dist/esm/index.liquid.js +1 -5
- package/dist/esm/product/components/ProductBadge/common/getAttrs.js +2 -19
- package/dist/esm/product/components/ProductBadge/index.liquid.js +17 -2
- package/dist/esm/product/setting/constant/bundle-layout/horizontalThree.js +468 -464
- package/dist/esm/product/setting/constant/bundle-layout/horizontalTwo.js +5 -1
- package/dist/esm/product/setting/constant/bundle-layout/verticalThree.js +363 -359
- package/dist/esm/product/setting/constant/bundle-layout/verticalTwo.js +363 -359
- package/dist/types/index.d.ts +43 -2
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
|
+
import { getSettingPreloadData } from '../../helpers.js';
|
|
3
|
+
import { createClass } from '@gem-sdk/system';
|
|
4
|
+
import '../../accordion/components/common/classes.js';
|
|
5
|
+
import Text from '../../text/components/Text.liquid.js';
|
|
6
|
+
import 'html-react-parser';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
8
|
+
import 'react';
|
|
9
|
+
import 'next/link';
|
|
10
|
+
import { getNewSetting } from './common/getNewSetting.js';
|
|
11
|
+
import { getClassAdvanced } from './common/getAdvanced.js';
|
|
12
|
+
import '../../marquee/common/classes.js';
|
|
13
|
+
import '../../product/components/constants/product-bundle.js';
|
|
14
|
+
import '../../product/components/ProductBadge/types.js';
|
|
15
|
+
import '../../product/components/ProductBadge/constants.js';
|
|
16
|
+
import '../../product/components/ProductBadge/utils/shape.js';
|
|
17
|
+
import '../../product/components/ProductBundle/common/styles.js';
|
|
18
|
+
import '../../product/components/ProductBundle/common/classes.js';
|
|
19
|
+
import '../../product/components/ProductButton/common/types.js';
|
|
20
|
+
|
|
21
|
+
const EstimateDate = ({ setting = {}, styles, builderAttrs, style, builderProps, advanced, isText, pageContext })=>{
|
|
22
|
+
const wrapperClasses = createClass({
|
|
23
|
+
'estimate-date-container': true
|
|
24
|
+
});
|
|
25
|
+
const advancedClass = getClassAdvanced({
|
|
26
|
+
setting,
|
|
27
|
+
advanced,
|
|
28
|
+
type: 'Liquid'
|
|
29
|
+
});
|
|
30
|
+
const newSetting = getNewSetting({
|
|
31
|
+
type: 'Liquid',
|
|
32
|
+
styles,
|
|
33
|
+
setting,
|
|
34
|
+
builderProps
|
|
35
|
+
});
|
|
36
|
+
return template`
|
|
37
|
+
<gp-estimate-date>
|
|
38
|
+
${Text({
|
|
39
|
+
builderProps,
|
|
40
|
+
builderAttrs,
|
|
41
|
+
advanced: {
|
|
42
|
+
...advanced,
|
|
43
|
+
cssClass: advancedClass
|
|
44
|
+
},
|
|
45
|
+
style,
|
|
46
|
+
styles,
|
|
47
|
+
setting: newSetting,
|
|
48
|
+
className: wrapperClasses,
|
|
49
|
+
isText,
|
|
50
|
+
pageContext,
|
|
51
|
+
elementAttrs: {
|
|
52
|
+
'setting-estimate-date': encodeURIComponent(JSON.stringify(setting))
|
|
53
|
+
}
|
|
54
|
+
})}
|
|
55
|
+
</gp-estimate-date>
|
|
56
|
+
${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-estimate-date.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-estimate-date.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
57
|
+
`;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { EstimateDate as default };
|
|
@@ -67,12 +67,12 @@ const getTextContent = ({ type, styles, setting, builderProps, pageContext })=>{
|
|
|
67
67
|
isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
|
|
68
68
|
translate: setting?.translate
|
|
69
69
|
}).toString();
|
|
70
|
-
return `${TextInline({
|
|
70
|
+
return `${setting?.enableCustomText ? TextInline({
|
|
71
71
|
styles: getStyleEstimateDate(styles, 'typoCustom'),
|
|
72
72
|
setting: {
|
|
73
73
|
text: textWithTranslate
|
|
74
74
|
}
|
|
75
|
-
})} ${TextInline({
|
|
75
|
+
}) : ''} ${TextInline({
|
|
76
76
|
styles: getStyleEstimateDate(styles, 'typoDate'),
|
|
77
77
|
setting: {
|
|
78
78
|
text: getDayEst(setting)
|
|
@@ -50,24 +50,27 @@ const EstimateDateSettings = [
|
|
|
50
50
|
label: 'Min estimate',
|
|
51
51
|
type: 'input:number',
|
|
52
52
|
default: 2,
|
|
53
|
-
emptyOnClear:
|
|
54
|
-
min:
|
|
53
|
+
emptyOnClear: false,
|
|
54
|
+
min: 1,
|
|
55
|
+
max: 99969999
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
58
|
id: 'maxEstimate',
|
|
58
59
|
label: 'Max estimate',
|
|
59
60
|
type: 'input:number',
|
|
60
|
-
emptyOnClear: true,
|
|
61
61
|
default: 5,
|
|
62
|
-
|
|
62
|
+
emptyOnClear: false,
|
|
63
|
+
min: 1,
|
|
64
|
+
max: 99969999
|
|
63
65
|
},
|
|
64
66
|
{
|
|
65
67
|
id: 'estimateTime',
|
|
66
68
|
label: 'Estimate',
|
|
67
69
|
type: 'input:number',
|
|
68
|
-
emptyOnClear: true,
|
|
69
70
|
default: 5,
|
|
70
|
-
|
|
71
|
+
emptyOnClear: false,
|
|
72
|
+
min: 0,
|
|
73
|
+
max: 99969999
|
|
71
74
|
}
|
|
72
75
|
]
|
|
73
76
|
}
|
|
@@ -142,7 +142,7 @@ const SettingUIV2 = [
|
|
|
142
142
|
label: {
|
|
143
143
|
en: 'Content'
|
|
144
144
|
},
|
|
145
|
-
iconName: 'polaris-text-
|
|
145
|
+
iconName: 'polaris-text-block',
|
|
146
146
|
fixedValue: 'Estimate delivery between',
|
|
147
147
|
getValueFromSettingID: 'customText',
|
|
148
148
|
isHideClear: true,
|
|
@@ -225,8 +225,8 @@ const SettingUIV2 = [
|
|
|
225
225
|
type: 'medium',
|
|
226
226
|
top: '4px',
|
|
227
227
|
bottom: '4px',
|
|
228
|
-
left: '
|
|
229
|
-
right: '
|
|
228
|
+
left: '16px',
|
|
229
|
+
right: '16px'
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -21,7 +21,8 @@ const SettingUIV2 = [
|
|
|
21
21
|
newValue: {
|
|
22
22
|
shape: 'square',
|
|
23
23
|
shapeValue: '1/1',
|
|
24
|
-
shapeLinked: true
|
|
24
|
+
shapeLinked: true,
|
|
25
|
+
width: '1200px'
|
|
25
26
|
},
|
|
26
27
|
groupType: 'style',
|
|
27
28
|
controlType: 'style'
|
|
@@ -54,7 +55,8 @@ const SettingUIV2 = [
|
|
|
54
55
|
controlId: 'shape',
|
|
55
56
|
newValue: {
|
|
56
57
|
shape: 'original',
|
|
57
|
-
shapeValue: ''
|
|
58
|
+
shapeValue: '',
|
|
59
|
+
width: '1200px'
|
|
58
60
|
},
|
|
59
61
|
groupType: 'style',
|
|
60
62
|
controlType: 'style'
|
|
@@ -281,7 +283,6 @@ const SettingUIV2 = [
|
|
|
281
283
|
en: 'Alt text'
|
|
282
284
|
},
|
|
283
285
|
iconName: 'polaris-text-block',
|
|
284
|
-
fixedValue: 'Describes the appearance of the image',
|
|
285
286
|
getValueFromSettingID: 'alt',
|
|
286
287
|
isHideClear: true,
|
|
287
288
|
controls: [
|
|
@@ -302,7 +303,6 @@ const SettingUIV2 = [
|
|
|
302
303
|
en: 'Image title'
|
|
303
304
|
},
|
|
304
305
|
iconName: 'polaris-text-block',
|
|
305
|
-
fixedValue: 'Title',
|
|
306
306
|
getValueFromSettingID: 'title',
|
|
307
307
|
isHideClear: true,
|
|
308
308
|
controls: [
|
package/dist/esm/index.liquid.js
CHANGED
|
@@ -27,7 +27,7 @@ export { default as CollectionBanner } from './collection/components/collection-
|
|
|
27
27
|
export { default as Countdown } from './countdown-timer/components/Countdown.liquid.js';
|
|
28
28
|
export { default as Coupon } from './coupon/components/Coupon.liquid.js';
|
|
29
29
|
export { default as Dialog } from './dialog/components/Dialog.liquid.js';
|
|
30
|
-
|
|
30
|
+
export { default as EstimateDate } from './estimate-delivery/components/EstimateDate.liquid.js';
|
|
31
31
|
export { default as Col } from './grid/col/Col.liquid.js';
|
|
32
32
|
export { default as Row } from './grid/row/Row.liquid.js';
|
|
33
33
|
export { default as Section } from './grid/section/Section.liquid.js';
|
|
@@ -196,7 +196,3 @@ export { default as StellarDeliveryDatePickup } from './third-party/components/S
|
|
|
196
196
|
export { default as ThirdPartySlot } from './third-party-slot/components/ThirdPartySlot.liquid.js';
|
|
197
197
|
export { default as ShopPayInstallments } from './shop-pay-installment/components/ShopPayInstallments.liquid.js';
|
|
198
198
|
export { default as Sticky } from './sticky/components/Sticky.liquid.js';
|
|
199
|
-
import 'react/jsx-runtime';
|
|
200
|
-
import 'react';
|
|
201
|
-
import 'next/link';
|
|
202
|
-
import '@gem-sdk/system';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { dataStringify } from '@gem-sdk/core';
|
|
2
|
-
|
|
3
1
|
const getImageAttr = ({ setting })=>{
|
|
4
2
|
return {
|
|
5
3
|
src: setting?.image?.src,
|
|
@@ -8,27 +6,12 @@ const getImageAttr = ({ setting })=>{
|
|
|
8
6
|
};
|
|
9
7
|
};
|
|
10
8
|
const getContainerAttrs = (props)=>{
|
|
11
|
-
const { builderAttrs, builderProps
|
|
12
|
-
const isTextBadge = setting?.contentType === 'text';
|
|
9
|
+
const { builderAttrs, builderProps } = props;
|
|
13
10
|
return {
|
|
14
11
|
...builderAttrs,
|
|
15
12
|
'data-id': builderProps?.uid || '',
|
|
16
13
|
id: `g-product-badge-${builderProps?.uid}`,
|
|
17
|
-
'gp-data-hidden': 'false'
|
|
18
|
-
'gp-data': `${dataStringify({
|
|
19
|
-
displayContent: setting?.displayContent,
|
|
20
|
-
minPrice: '{{ minPriceValue }}',
|
|
21
|
-
variantIDs: '{{ product.variants | map: "id" | json | escape }}',
|
|
22
|
-
variantInventoryQuantities: '{{ product.variants | map: "inventory_quantity" | json | escape }}',
|
|
23
|
-
amountDiscount: '{{amountDiscountValue}}',
|
|
24
|
-
percentDiscount: '{{percentDiscountValue}}',
|
|
25
|
-
price: '{{price}}',
|
|
26
|
-
displayTrigger: setting?.displayTrigger,
|
|
27
|
-
uid: builderProps?.uid,
|
|
28
|
-
productCreatedAt: '{{product.created_at | date: "%Y-%m-%d" }}',
|
|
29
|
-
productTags: '{{ product.tags | join: "," }}',
|
|
30
|
-
isTextBadge
|
|
31
|
-
})}`
|
|
14
|
+
'gp-data-hidden': 'false'
|
|
32
15
|
};
|
|
33
16
|
};
|
|
34
17
|
const getEditTooltipAttrs = (props)=>{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
1
|
+
import { template, dataStringify, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
2
|
import { getSettingPreloadData } from '../../../helpers.js';
|
|
3
3
|
import { checkDiscountContentProductBadge } from './utils/common.js';
|
|
4
4
|
import { generateBadgeContent } from './utils/generateLiquidContent.js';
|
|
5
5
|
import { renderBadgeInFirstTime } from './utils/renderBadgeLiquid.js';
|
|
6
|
-
import { createStyle, createClass, createAttr } from '@gem-sdk/system';
|
|
6
|
+
import { createStyle, createClass, createAttr, createStateOrContext } from '@gem-sdk/system';
|
|
7
7
|
import { getWrapperClasses, getSubWrapperClass, getTextContainerClasses, getTextWrapperClasses, getTextContentClasses, getImageContainerClasses, getImageClasses } from './common/getClasses.js';
|
|
8
8
|
import { getContainerStyle, getSubWrapperStyle, getContentStyleInternal, getTextBadgeWrapperStyles, getTextContentStyle, getImageContainerStyles } from './common/getStyles.js';
|
|
9
9
|
import { getSubWrapperAttrs, getContainerAttrs, getTextContentAttrs, getImageAttr } from './common/getAttrs.js';
|
|
@@ -73,6 +73,20 @@ const ProductBadge = (props)=>{
|
|
|
73
73
|
setting
|
|
74
74
|
})
|
|
75
75
|
});
|
|
76
|
+
const createDataState = createStateOrContext({
|
|
77
|
+
displayContent: setting?.displayContent,
|
|
78
|
+
minPrice: '{{ minPriceValue }}',
|
|
79
|
+
variantIDs: '{{ product.variants | map: "id" | json | escape }}',
|
|
80
|
+
variantInventoryQuantities: '{{ product.variants | map: "inventory_quantity" | json | escape }}',
|
|
81
|
+
amountDiscount: '{{amountDiscountValue}}',
|
|
82
|
+
percentDiscount: '{{percentDiscountValue}}',
|
|
83
|
+
price: '{{price}}',
|
|
84
|
+
displayTrigger: setting?.displayTrigger,
|
|
85
|
+
uid: props.builderProps?.uid,
|
|
86
|
+
productCreatedAt: '{{product.created_at | date: "%Y-%m-%d" }}',
|
|
87
|
+
productTags: '{{ product.tags | join: "," }}',
|
|
88
|
+
isTextBadge
|
|
89
|
+
});
|
|
76
90
|
return template`
|
|
77
91
|
{% if product %}
|
|
78
92
|
${generateBadgeContent(setting?.displayContent)}
|
|
@@ -81,6 +95,7 @@ const ProductBadge = (props)=>{
|
|
|
81
95
|
${{
|
|
82
96
|
...containerAttrs
|
|
83
97
|
}}
|
|
98
|
+
gp-data='${dataStringify(createDataState)}'
|
|
84
99
|
class="containerClass"
|
|
85
100
|
style="${containerStyle}"
|
|
86
101
|
>
|