@gem-sdk/components 2.0.0-dev.392 → 2.0.0-dev.394

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/ProductDiscountTag/common/getClasses.js +38 -0
  5. package/dist/cjs/product/components/ProductDiscountTag/common/getStyle.js +42 -0
  6. package/dist/cjs/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +108 -0
  7. package/dist/cjs/product/components/ProductDiscountTag/index.js +110 -0
  8. package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +91 -0
  9. package/dist/cjs/product/index.js +4 -4
  10. package/dist/cjs/product/next.js +1 -1
  11. package/dist/cjs/product/setting/ProductTag.js +7 -299
  12. package/dist/cjs/product/setting/product-badge/configs/settings.js +6 -0
  13. package/dist/cjs/product/setting/product-badge/configs/uiV2.js +14 -19
  14. package/dist/cjs/product/setting/product-discount-tag/configs/settings.js +191 -0
  15. package/dist/cjs/product/setting/product-discount-tag/configs/uiV2.js +190 -0
  16. package/dist/cjs/product/setting/product-vendor/configs/settings.js +12 -0
  17. package/dist/cjs/product/setting/product-vendor/configs/uiV2.js +1 -1
  18. package/dist/cjs/sticky/components/Sticky.js +4 -4
  19. package/dist/cjs/sticky/components/hooks/useSticky.js +19 -9
  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/ProductDiscountTag/common/getClasses.js +33 -0
  24. package/dist/esm/product/components/ProductDiscountTag/common/getStyle.js +38 -0
  25. package/dist/esm/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +106 -0
  26. package/dist/esm/product/components/ProductDiscountTag/index.js +106 -0
  27. package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +87 -0
  28. package/dist/esm/product/next.js +1 -1
  29. package/dist/esm/product/setting/ProductTag.js +7 -299
  30. package/dist/esm/product/setting/product-badge/configs/settings.js +6 -0
  31. package/dist/esm/product/setting/product-badge/configs/uiV2.js +14 -19
  32. package/dist/esm/product/setting/product-discount-tag/configs/settings.js +189 -0
  33. package/dist/esm/product/setting/product-discount-tag/configs/uiV2.js +188 -0
  34. package/dist/esm/product/setting/product-vendor/configs/settings.js +12 -0
  35. package/dist/esm/product/setting/product-vendor/configs/uiV2.js +1 -1
  36. package/dist/esm/sticky/components/Sticky.js +4 -4
  37. package/dist/esm/sticky/components/hooks/useSticky.js +20 -10
  38. package/dist/types/index.d.ts +1 -0
  39. package/package.json +2 -2
  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',
@@ -129,6 +129,12 @@ const ProductBadgeSettings = [
129
129
  }
130
130
  ]
131
131
  },
132
+ {
133
+ id: 'contentBanner',
134
+ type: 'banner',
135
+ message: `{inventory_quantity} Only work with product enable “Track inventory”`,
136
+ closable: true
137
+ },
132
138
  {
133
139
  id: 'contentType',
134
140
  label: 'Shape',
@@ -95,6 +95,16 @@ const SettingUIV2 = [
95
95
  setting: {
96
96
  id: 'displayContent'
97
97
  }
98
+ },
99
+ {
100
+ label: {
101
+ en: ''
102
+ },
103
+ layout: 'vertical',
104
+ setting: {
105
+ id: 'contentBanner'
106
+ },
107
+ conditionDisplay: 'displayContent.includes("{inventory_quantity}")'
98
108
  }
99
109
  ]
100
110
  },
@@ -349,26 +359,10 @@ const SettingUIV2 = [
349
359
  },
350
360
  controls: [
351
361
  {
352
- id: 'badge-position',
353
- type: 'combo',
354
- iconName: 'polaris-plus',
355
- isHideClear: true,
356
- fixedValue: 'Edit',
357
- popoverLabel: {
358
- en: 'Position'
359
- },
360
- label: {
361
- en: 'Choose'
362
- },
363
362
  layout: 'vertical',
364
- controls: [
365
- {
366
- layout: 'vertical',
367
- setting: {
368
- id: 'position'
369
- }
370
- }
371
- ]
363
+ setting: {
364
+ id: 'position'
365
+ }
372
366
  }
373
367
  ],
374
368
  conditionDisplay: 'positionWithImage === "inside"'
@@ -391,6 +385,7 @@ const SettingUIV2 = [
391
385
  en: 'Align'
392
386
  },
393
387
  conditionEnable: '!(parseInt(textSizeV2) >= 100 && textSizeV2?.includes("%"))',
388
+ conditionDisplay: 'positionWithImage === "outside"',
394
389
  setting: {
395
390
  id: 'align'
396
391
  },
@@ -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;