@gem-sdk/components 2.0.0-dev.393 → 2.0.0-dev.395

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.
Files changed (43) hide show
  1. package/dist/cjs/builder.js +4 -4
  2. package/dist/cjs/index.js +30 -30
  3. package/dist/cjs/index.liquid.js +4 -4
  4. package/dist/cjs/product/components/ProductBundle/common/styles.js +22 -6
  5. package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +2 -1
  6. package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +1 -1
  7. package/dist/cjs/product/components/ProductBundle/setting/ProductBundleDiscount.js +47 -415
  8. package/dist/cjs/product/components/ProductBundle/setting/uiV1.js +404 -0
  9. package/dist/cjs/product/components/ProductBundle/setting/uiV2.js +728 -0
  10. package/dist/cjs/product/components/ProductDiscountTag/common/getClasses.js +38 -0
  11. package/dist/cjs/product/components/ProductDiscountTag/common/getStyle.js +42 -0
  12. package/dist/cjs/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +108 -0
  13. package/dist/cjs/product/components/ProductDiscountTag/index.js +110 -0
  14. package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +91 -0
  15. package/dist/cjs/product/index.js +4 -4
  16. package/dist/cjs/product/next.js +1 -1
  17. package/dist/cjs/product/setting/ProductTag.js +7 -299
  18. package/dist/cjs/product/setting/product-discount-tag/configs/settings.js +191 -0
  19. package/dist/cjs/product/setting/product-discount-tag/configs/uiV2.js +190 -0
  20. package/dist/esm/builder.js +1 -1
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/index.liquid.js +1 -1
  23. package/dist/esm/product/components/ProductBundle/common/styles.js +23 -7
  24. package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +2 -1
  25. package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +1 -1
  26. package/dist/esm/product/components/ProductBundle/setting/ProductBundleDiscount.js +47 -415
  27. package/dist/esm/product/components/ProductBundle/setting/uiV1.js +400 -0
  28. package/dist/esm/product/components/ProductBundle/setting/uiV2.js +724 -0
  29. package/dist/esm/product/components/ProductDiscountTag/common/getClasses.js +33 -0
  30. package/dist/esm/product/components/ProductDiscountTag/common/getStyle.js +38 -0
  31. package/dist/esm/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +106 -0
  32. package/dist/esm/product/components/ProductDiscountTag/index.js +106 -0
  33. package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +87 -0
  34. package/dist/esm/product/next.js +1 -1
  35. package/dist/esm/product/setting/ProductTag.js +7 -299
  36. package/dist/esm/product/setting/product-discount-tag/configs/settings.js +189 -0
  37. package/dist/esm/product/setting/product-discount-tag/configs/uiV2.js +188 -0
  38. package/dist/types/index.d.ts +2 -0
  39. package/package.json +1 -1
  40. package/dist/cjs/product/components/ProductTag/ProductTag.js +0 -200
  41. package/dist/cjs/product/components/ProductTag/ProductTag.liquid.js +0 -107
  42. package/dist/esm/product/components/ProductTag/ProductTag.js +0 -196
  43. package/dist/esm/product/components/ProductTag/ProductTag.liquid.js +0 -103
@@ -2,309 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var uiV2 = require('./product-discount-tag/configs/uiV2.js');
6
+ var settings = require('./product-discount-tag/configs/settings.js');
7
+ var uiV1 = require('./product/configs/uiV1.js');
8
+
5
9
  const config = {
6
10
  tag: 'ProductTag',
7
11
  label: 'Discount Tag',
8
12
  icon: `<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19.75 2A2.25 2.25 0 0 1 22 4.25v5.462a3.25 3.25 0 0 1-.952 2.298l-8.5 8.503a3.255 3.255 0 0 1-4.597.001L3.489 16.06a3.25 3.25 0 0 1-.003-4.596l8.5-8.51A3.25 3.25 0 0 1 14.284 2h5.465Zm0 1.5h-5.465c-.465 0-.91.185-1.239.513l-8.512 8.523a1.75 1.75 0 0 0 .015 2.462l4.461 4.454a1.755 1.755 0 0 0 2.477 0l8.5-8.503a1.75 1.75 0 0 0 .513-1.237V4.25a.75.75 0 0 0-.75-.75ZM17 5.502a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z"/></svg>`,
9
- settings: [
10
- {
11
- id: 'setting',
12
- // note: 'Product Tag won’t display on live page if Compare at price field is empty or lower than Price.',
13
- controls: [
14
- {
15
- id: 'customContent',
16
- label: 'Custom Content',
17
- type: 'custom-content',
18
- default: {
19
- prefix: 'SALE',
20
- suffix: 'OFF',
21
- unit: 'percentage'
22
- }
23
- },
24
- {
25
- id: 'translate',
26
- type: 'input',
27
- default: 'customContent'
28
- }
29
- ]
30
- },
31
- {
32
- id: 'style',
33
- controls: [
34
- {
35
- id: 'size',
36
- type: 'size-setting',
37
- devices: {
38
- desktop: {
39
- default: {
40
- width: 'Auto',
41
- height: 'Auto',
42
- padding: {
43
- type: 'small',
44
- top: '4px',
45
- left: '16px',
46
- bottom: '4px',
47
- right: '16px'
48
- }
49
- }
50
- }
51
- },
52
- settingConfig: {
53
- width: {
54
- displayOptions: [
55
- 'full',
56
- 'auto',
57
- 'default'
58
- ]
59
- },
60
- padding: {
61
- paddingConfig: {
62
- small: {
63
- vertical: '4px',
64
- horizontal: '16px'
65
- },
66
- medium: {
67
- vertical: '8px',
68
- horizontal: '24px'
69
- },
70
- large: {
71
- vertical: '16px',
72
- horizontal: '32px'
73
- },
74
- custom: {
75
- vertical: '0px',
76
- horizontal: '0px'
77
- }
78
- }
79
- }
80
- },
81
- hiddenSettings: [
82
- 'shape',
83
- 'gap'
84
- ]
85
- },
86
- {
87
- id: 'textContentAlign',
88
- label: 'Alignment',
89
- type: 'segment',
90
- options: [
91
- {
92
- label: 'Left',
93
- value: 'left',
94
- type: 'text',
95
- tooltip: 'Align left'
96
- },
97
- {
98
- label: 'Center',
99
- value: 'center',
100
- type: 'text',
101
- tooltip: 'Align center'
102
- },
103
- {
104
- label: 'Right',
105
- value: 'right',
106
- type: 'text',
107
- tooltip: 'Align right'
108
- },
109
- {
110
- label: 'Justify',
111
- value: 'justify',
112
- type: 'text',
113
- tooltip: 'Align justify'
114
- }
115
- ],
116
- devices: {
117
- desktop: {
118
- default: 'center'
119
- }
120
- }
121
- },
122
- {
123
- id: 'backgroundColor',
124
- type: 'colorpicker',
125
- label: 'Background Color',
126
- default: '#3C67FF'
127
- },
128
- {
129
- id: 'borderTag',
130
- type: 'border',
131
- label: 'Border',
132
- default: {
133
- borderType: 'none',
134
- border: 'none',
135
- borderWidth: '1px',
136
- width: '1px 1px 1px 1px',
137
- color: '#000000',
138
- isCustom: false
139
- }
140
- },
141
- {
142
- id: 'roundedTag',
143
- type: 'radius-preset',
144
- label: 'Border Radius',
145
- default: {
146
- radiusType: 'large'
147
- }
148
- },
149
- {
150
- id: 'textAlign',
151
- label: 'Alignment',
152
- type: 'segment',
153
- options: [
154
- {
155
- label: 'Left',
156
- value: 'left',
157
- type: 'align',
158
- tooltip: 'Align left'
159
- },
160
- {
161
- label: 'Center',
162
- value: 'center',
163
- type: 'align',
164
- tooltip: 'Align center'
165
- },
166
- {
167
- label: 'Right',
168
- value: 'right',
169
- type: 'align',
170
- tooltip: 'Align right'
171
- }
172
- ],
173
- devices: {
174
- desktop: {
175
- default: 'left'
176
- }
177
- }
178
- },
179
- {
180
- id: 'typo',
181
- type: 'typography-v2',
182
- default: {
183
- type: 'subheading-2',
184
- attrs: {
185
- color: '#FFFFFF'
186
- }
187
- },
188
- ignoreReRender: true
189
- }
190
- ]
191
- }
192
- ],
193
- ui: [
194
- {
195
- type: 'group',
196
- controls: [
197
- {
198
- type: 'control',
199
- label: {
200
- en: 'Tag'
201
- },
202
- options: {
203
- label: 'large'
204
- },
205
- setting: {
206
- id: 'customContent'
207
- },
208
- layout: 'vertical'
209
- }
210
- ]
211
- },
212
- {
213
- type: 'group',
214
- label: {
215
- en: 'Size'
216
- },
217
- controls: [
218
- {
219
- type: 'control',
220
- setting: {
221
- id: 'size'
222
- },
223
- layout: 'vertical'
224
- }
225
- ]
226
- },
227
- {
228
- type: 'control',
229
- label: {
230
- en: 'Text align'
231
- },
232
- setting: {
233
- id: 'textContentAlign'
234
- }
235
- },
236
- {
237
- type: 'control',
238
- label: {
239
- en: 'Background color'
240
- },
241
- options: {
242
- label: 'large'
243
- },
244
- setting: {
245
- id: 'backgroundColor'
246
- }
247
- },
248
- {
249
- type: 'group',
250
- options: {
251
- labelPosition: 'start'
252
- },
253
- label: {
254
- en: 'Border'
255
- },
256
- controls: [
257
- {
258
- type: 'control',
259
- options: {
260
- labelPosition: 'start'
261
- },
262
- label: {
263
- en: 'Border'
264
- },
265
- setting: {
266
- id: 'borderTag'
267
- }
268
- },
269
- {
270
- type: 'control',
271
- label: {
272
- en: 'Corner'
273
- },
274
- setting: {
275
- id: 'roundedTag'
276
- }
277
- }
278
- ]
279
- },
280
- {
281
- type: 'group',
282
- label: {
283
- en: 'Text'
284
- },
285
- controls: [
286
- {
287
- type: 'control',
288
- setting: {
289
- id: 'typo'
290
- },
291
- layout: 'vertical'
292
- }
293
- ]
294
- },
295
- {
296
- type: 'control',
297
- label: {
298
- en: 'Align'
299
- },
300
- options: {
301
- label: 'large'
302
- },
303
- setting: {
304
- id: 'textAlign'
305
- }
306
- }
307
- ],
13
+ settings: settings.ProductDiscountTagSettings,
14
+ ui: uiV1.SettingUIV1,
15
+ uiV2: uiV2.SettingUIV2,
308
16
  presets: [
309
17
  {
310
18
  id: 'product-tag',
@@ -0,0 +1,191 @@
1
+ 'use strict';
2
+
3
+ const ProductDiscountTagSettings = [
4
+ {
5
+ id: 'setting',
6
+ // note: 'Product Tag won’t display on live page if Compare at price field is empty or lower than Price.',
7
+ controls: [
8
+ {
9
+ id: 'customContent',
10
+ label: 'Custom Content',
11
+ type: 'custom-content',
12
+ default: {
13
+ prefix: 'SALE',
14
+ suffix: 'OFF',
15
+ unit: 'percentage'
16
+ }
17
+ },
18
+ {
19
+ id: 'translate',
20
+ type: 'input',
21
+ default: 'customContent'
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ id: 'style',
27
+ controls: [
28
+ {
29
+ id: 'size',
30
+ type: 'size-setting',
31
+ devices: {
32
+ desktop: {
33
+ default: {
34
+ width: 'Auto',
35
+ height: 'Auto',
36
+ padding: {
37
+ type: 'small',
38
+ top: '4px',
39
+ left: '16px',
40
+ bottom: '4px',
41
+ right: '16px'
42
+ }
43
+ }
44
+ }
45
+ },
46
+ settingConfig: {
47
+ width: {
48
+ displayOptions: [
49
+ 'full',
50
+ 'auto',
51
+ 'default'
52
+ ]
53
+ },
54
+ padding: {
55
+ paddingConfig: {
56
+ small: {
57
+ vertical: '4px',
58
+ horizontal: '16px'
59
+ },
60
+ medium: {
61
+ vertical: '8px',
62
+ horizontal: '24px'
63
+ },
64
+ large: {
65
+ vertical: '16px',
66
+ horizontal: '32px'
67
+ },
68
+ custom: {
69
+ vertical: '0px',
70
+ horizontal: '0px'
71
+ }
72
+ }
73
+ }
74
+ },
75
+ hiddenSettings: [
76
+ 'shape',
77
+ 'gap'
78
+ ]
79
+ },
80
+ {
81
+ id: 'textContentAlign',
82
+ label: 'Alignment',
83
+ type: 'option:value',
84
+ options: [
85
+ {
86
+ label: 'Left',
87
+ value: 'left',
88
+ type: 'text',
89
+ tooltip: 'Align left'
90
+ },
91
+ {
92
+ label: 'Center',
93
+ value: 'center',
94
+ type: 'text',
95
+ tooltip: 'Align center'
96
+ },
97
+ {
98
+ label: 'Right',
99
+ value: 'right',
100
+ type: 'text',
101
+ tooltip: 'Align right'
102
+ },
103
+ {
104
+ label: 'Justify',
105
+ value: 'justify',
106
+ type: 'text',
107
+ tooltip: 'Align justify'
108
+ }
109
+ ],
110
+ devices: {
111
+ desktop: {
112
+ default: 'center'
113
+ }
114
+ }
115
+ },
116
+ {
117
+ id: 'backgroundColor',
118
+ type: 'color-picker-v2',
119
+ label: 'Background Color',
120
+ default: '#3C67FF'
121
+ },
122
+ {
123
+ id: 'borderTag',
124
+ type: 'border',
125
+ label: 'Border',
126
+ default: {
127
+ borderType: 'none',
128
+ border: 'none',
129
+ borderWidth: '1px',
130
+ width: '1px 1px 1px 1px',
131
+ color: '#000000',
132
+ isCustom: false
133
+ }
134
+ },
135
+ {
136
+ id: 'roundedTag',
137
+ type: 'radius-preset',
138
+ label: 'Border Radius',
139
+ default: {
140
+ radiusType: 'large'
141
+ }
142
+ },
143
+ {
144
+ id: 'textAlign',
145
+ label: 'Alignment',
146
+ type: 'option:value',
147
+ options: [
148
+ {
149
+ label: 'Left',
150
+ value: 'left',
151
+ type: 'align',
152
+ tooltip: 'Align left',
153
+ iconName: 'gp-align-left'
154
+ },
155
+ {
156
+ label: 'Center',
157
+ value: 'center',
158
+ type: 'align',
159
+ tooltip: 'Align center',
160
+ iconName: 'gp-align-center'
161
+ },
162
+ {
163
+ label: 'Right',
164
+ value: 'right',
165
+ type: 'align',
166
+ tooltip: 'Align right',
167
+ iconName: 'gp-align-right'
168
+ }
169
+ ],
170
+ devices: {
171
+ desktop: {
172
+ default: 'left'
173
+ }
174
+ }
175
+ },
176
+ {
177
+ id: 'typo',
178
+ type: 'typography-v2',
179
+ default: {
180
+ type: 'subheading-2',
181
+ attrs: {
182
+ color: '#FFFFFF'
183
+ }
184
+ },
185
+ ignoreReRender: true
186
+ }
187
+ ]
188
+ }
189
+ ];
190
+
191
+ exports.ProductDiscountTagSettings = ProductDiscountTagSettings;
@@ -0,0 +1,190 @@
1
+ 'use strict';
2
+
3
+ const SettingUIV2 = [
4
+ {
5
+ controls: [
6
+ {
7
+ label: {
8
+ en: 'Tag'
9
+ },
10
+ setting: {
11
+ id: 'customContent'
12
+ },
13
+ layout: 'vertical',
14
+ options: {
15
+ labelVariant: 'primary'
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ label: {
22
+ en: 'Size'
23
+ },
24
+ controls: [
25
+ {
26
+ label: {
27
+ en: 'Width'
28
+ },
29
+ controlConfig: {
30
+ id: 'width',
31
+ type: 'dropdown:input',
32
+ units: [
33
+ 'px',
34
+ '%'
35
+ ],
36
+ linkWithSetting: {
37
+ name: 'size',
38
+ field: 'width'
39
+ },
40
+ displayOptions: [
41
+ {
42
+ label: 'Fit content',
43
+ value: 'Auto',
44
+ showValue: true
45
+ },
46
+ {
47
+ label: 'Full',
48
+ value: '100%',
49
+ showValue: true
50
+ },
51
+ {
52
+ label: 'Default',
53
+ value: 'default',
54
+ showValue: true
55
+ }
56
+ ]
57
+ }
58
+ },
59
+ {
60
+ id: 'height',
61
+ label: {
62
+ en: 'Height'
63
+ },
64
+ controlConfig: {
65
+ id: 'height',
66
+ type: 'dropdown:input',
67
+ label: 'Height',
68
+ units: [
69
+ 'px',
70
+ '%'
71
+ ],
72
+ linkWithSetting: {
73
+ name: 'size',
74
+ field: 'height'
75
+ }
76
+ },
77
+ layout: 'horizontal'
78
+ },
79
+ {
80
+ label: {
81
+ en: 'Padding'
82
+ },
83
+ controlConfig: {
84
+ id: 'padding',
85
+ type: 'padding-v2',
86
+ linkWithSetting: {
87
+ name: 'size',
88
+ field: 'padding'
89
+ }
90
+ }
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ label: {
96
+ en: 'Background'
97
+ },
98
+ controls: [
99
+ {
100
+ label: {
101
+ en: 'Color'
102
+ },
103
+ setting: {
104
+ id: 'backgroundColor'
105
+ }
106
+ }
107
+ ]
108
+ },
109
+ {
110
+ label: {
111
+ en: 'Shape'
112
+ },
113
+ controls: [
114
+ {
115
+ label: {
116
+ en: 'Border'
117
+ },
118
+ setting: {
119
+ id: 'borderTag'
120
+ }
121
+ },
122
+ {
123
+ label: {
124
+ en: 'Corner'
125
+ },
126
+ setting: {
127
+ id: 'roundedTag'
128
+ }
129
+ }
130
+ ]
131
+ },
132
+ {
133
+ label: {
134
+ en: 'Text style'
135
+ },
136
+ controls: [
137
+ {
138
+ setting: {
139
+ id: 'typo'
140
+ },
141
+ layout: 'vertical',
142
+ options: {
143
+ hideLabel: true,
144
+ fullWidth: true,
145
+ updateFields: [
146
+ {
147
+ field: 'attrs.textAlign',
148
+ settingId: 'textContentAlign'
149
+ }
150
+ ]
151
+ },
152
+ controlChangeTrigger: {
153
+ settings: [
154
+ {
155
+ action: {
156
+ controlId: 'textContentAlign',
157
+ valueFromField: 'attrs.textAlign',
158
+ groupType: 'style',
159
+ controlType: 'style'
160
+ }
161
+ }
162
+ ],
163
+ options: {
164
+ noRecordHistory: true
165
+ }
166
+ }
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ controls: [
172
+ {
173
+ label: {
174
+ en: 'Align'
175
+ },
176
+ setting: {
177
+ id: 'textAlign'
178
+ },
179
+ conditionEnable: '!(parseInt(size.width) >= 100 && size.width?.includes("%"))',
180
+ options: {
181
+ labelVariant: 'primary',
182
+ fullWidth: true,
183
+ disableMessage: `Align is not supported when width is 100%`
184
+ }
185
+ }
186
+ ]
187
+ }
188
+ ];
189
+
190
+ exports.SettingUIV2 = SettingUIV2;
@@ -229,7 +229,7 @@ import ProductImages from './product/components/ProductImages.js';
229
229
  import ProductImagesV2 from './product/components/ProductImagesV2/index.js';
230
230
  import ProductProperties from './product/components/ProductProperties/ProductProperties.js';
231
231
  import QuickView from './product/components/ProductQuickView/index.js';
232
- import ProductTag from './product/components/ProductTag/ProductTag.js';
232
+ import ProductTag from './product/components/ProductDiscountTag/index.js';
233
233
  import ProductList from './product/components/ProductList/ProductList.js';
234
234
  import DynamicCheckout from './product/components/DynamicCheckout/DynamicCheckout.js';
235
235
  import ProductBundleDiscount from './product/components/ProductBundle/components/ProductBundleDiscount.js';