@gem-sdk/components 2.0.0-dev.271 → 2.0.0-dev.275

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 (104) hide show
  1. package/dist/cjs/article/components/ArticleImage.js +0 -5
  2. package/dist/cjs/article/components/ArticleList.js +1 -1
  3. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +1 -1
  4. package/dist/cjs/builder.js +13 -13
  5. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.js +70 -0
  6. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.liquid.js +71 -0
  7. package/dist/cjs/cart/components/ShopPayButton/common/classes.js +18 -0
  8. package/dist/cjs/cart/components/ShopPayButton/common/helpers.js +31 -0
  9. package/dist/cjs/cart/components/ShopPayButton/common/styles.js +12 -0
  10. package/dist/cjs/cart/components/ShopPayButton/hooks/useShopPayButton.js +70 -0
  11. package/dist/cjs/cart/next.js +1 -1
  12. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  13. package/dist/cjs/form/setting/submit-button/configs/settings.js +2 -2
  14. package/dist/cjs/header/components/kind/basic/index.js +1 -1
  15. package/dist/cjs/header/components/kind/modern/index.js +1 -1
  16. package/dist/cjs/index.js +39 -39
  17. package/dist/cjs/index.liquid.js +9 -9
  18. package/dist/cjs/marquee/setting/configs/childImageTemplate.js +1 -1
  19. package/dist/cjs/post-purchase/advanced-list/components/common/getClasses.js +1 -1
  20. package/dist/cjs/post-purchase/advanced-list/setting/configs/presets.js +3 -1
  21. package/dist/cjs/post-purchase/advanced-list/setting/configs/settings.js +2 -1
  22. package/dist/cjs/post-purchase/advanced-list/setting/template.js +8 -3
  23. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +0 -7
  24. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
  25. package/dist/cjs/post-purchase/image/setting/Image.js +2 -2
  26. package/dist/cjs/post-purchase/image/setting/setting-v2.js +25 -13
  27. package/dist/cjs/post-purchase/image/setting/ui-v2.js +1 -1
  28. package/dist/cjs/post-purchase/link/setting/configs/settings.js +7 -2
  29. package/dist/cjs/post-purchase/product/settings/product-variants/configs/uiV2.js +4 -2
  30. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.js +28 -0
  31. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.liquid.js +23 -0
  32. package/dist/cjs/product/components/DynamicCheckout/common/classes.js +32 -0
  33. package/dist/cjs/product/components/DynamicCheckout/common/styles.js +181 -0
  34. package/dist/cjs/product/components/DynamicCheckout/components/Button.liquid.js +58 -0
  35. package/dist/cjs/product/components/FileUpload/components/common/index.js +1 -1
  36. package/dist/cjs/product/components/ProductDescription/common/const.js +9 -0
  37. package/dist/cjs/product/components/ProductDescription/common/getClasses.js +30 -0
  38. package/dist/cjs/product/components/ProductDescription/common/getStyle.js +81 -0
  39. package/dist/cjs/product/components/ProductDescription/hooks/useGpDescription.js +90 -0
  40. package/dist/cjs/product/components/ProductDescription/index.js +115 -0
  41. package/dist/cjs/product/components/ProductDescription/index.liquid.js +86 -0
  42. package/dist/cjs/product/next.js +1 -1
  43. package/dist/cjs/setting.js +1 -1
  44. package/dist/esm/article/components/ArticleImage.js +0 -5
  45. package/dist/esm/article/components/ArticleList.js +1 -1
  46. package/dist/esm/banner/components/HeroBannerItem.liquid.js +1 -1
  47. package/dist/esm/builder.js +3 -3
  48. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.js +66 -0
  49. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.liquid.js +67 -0
  50. package/dist/esm/cart/components/ShopPayButton/common/classes.js +15 -0
  51. package/dist/esm/cart/components/ShopPayButton/common/helpers.js +27 -0
  52. package/dist/esm/cart/components/ShopPayButton/common/styles.js +10 -0
  53. package/dist/esm/cart/components/ShopPayButton/hooks/useShopPayButton.js +68 -0
  54. package/dist/esm/cart/next.js +1 -1
  55. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  56. package/dist/esm/form/setting/submit-button/configs/settings.js +2 -2
  57. package/dist/esm/header/components/kind/basic/index.js +1 -1
  58. package/dist/esm/header/components/kind/modern/index.js +1 -1
  59. package/dist/esm/index.js +3 -3
  60. package/dist/esm/index.liquid.js +3 -3
  61. package/dist/esm/marquee/setting/configs/childImageTemplate.js +1 -1
  62. package/dist/esm/post-purchase/advanced-list/components/common/getClasses.js +1 -1
  63. package/dist/esm/post-purchase/advanced-list/setting/configs/presets.js +3 -1
  64. package/dist/esm/post-purchase/advanced-list/setting/configs/settings.js +2 -1
  65. package/dist/esm/post-purchase/advanced-list/setting/template.js +8 -3
  66. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +0 -7
  67. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
  68. package/dist/esm/post-purchase/image/setting/Image.js +2 -2
  69. package/dist/esm/post-purchase/image/setting/setting-v2.js +25 -13
  70. package/dist/esm/post-purchase/image/setting/ui-v2.js +1 -1
  71. package/dist/esm/post-purchase/link/setting/configs/settings.js +7 -2
  72. package/dist/esm/post-purchase/product/settings/product-variants/configs/uiV2.js +4 -2
  73. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.js +24 -0
  74. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.liquid.js +19 -0
  75. package/dist/esm/product/components/DynamicCheckout/common/classes.js +30 -0
  76. package/dist/esm/product/components/DynamicCheckout/common/styles.js +179 -0
  77. package/dist/esm/product/components/DynamicCheckout/components/Button.liquid.js +54 -0
  78. package/dist/esm/product/components/FileUpload/components/common/index.js +1 -1
  79. package/dist/esm/product/components/ProductDescription/common/const.js +6 -0
  80. package/dist/esm/product/components/ProductDescription/common/getClasses.js +27 -0
  81. package/dist/esm/product/components/ProductDescription/common/getStyle.js +77 -0
  82. package/dist/esm/product/components/ProductDescription/hooks/useGpDescription.js +88 -0
  83. package/dist/esm/product/components/ProductDescription/index.js +111 -0
  84. package/dist/esm/product/components/ProductDescription/index.liquid.js +82 -0
  85. package/dist/esm/product/next.js +1 -1
  86. package/dist/esm/setting.js +1 -1
  87. package/dist/types/index.d.ts +29 -97
  88. package/package.json +1 -1
  89. package/dist/cjs/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -20
  90. package/dist/cjs/cart/components/ShopPayButton/index.js +0 -113
  91. package/dist/cjs/cart/components/ShopPayButton/index.liquid.js +0 -51
  92. package/dist/cjs/product/components/DynamicCheckout.liquid.js +0 -250
  93. package/dist/cjs/product/components/ProductDescription/const.js +0 -5
  94. package/dist/cjs/product/components/ProductDescription.js +0 -172
  95. package/dist/cjs/product/components/ProductDescription.liquid.js +0 -120
  96. package/dist/esm/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -17
  97. package/dist/esm/cart/components/ShopPayButton/index.js +0 -109
  98. package/dist/esm/cart/components/ShopPayButton/index.liquid.js +0 -47
  99. package/dist/esm/product/components/DynamicCheckout.liquid.js +0 -246
  100. package/dist/esm/product/components/ProductDescription/const.js +0 -3
  101. package/dist/esm/product/components/ProductDescription.js +0 -168
  102. package/dist/esm/product/components/ProductDescription.liquid.js +0 -116
  103. /package/dist/cjs/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
  104. /package/dist/esm/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
@@ -14,20 +14,20 @@ var Product_liquid = require('./product/components/Product.liquid.js');
14
14
  var index_liquid = require('./product/components/ProductTitle/index.liquid.js');
15
15
  var ProductPrice_liquid = require('./product/components/ProductPrice.liquid.js');
16
16
  var ProductButton_liquid = require('./product/components/ProductButton.liquid.js');
17
- var ProductDescription_liquid = require('./product/components/ProductDescription.liquid.js');
17
+ var index_liquid$1 = require('./product/components/ProductDescription/index.liquid.js');
18
18
  var ProductImages_liquid = require('./product/components/ProductImages.liquid.js');
19
19
  var ProductImages_liquid$1 = require('./product/components/ProductImagesV2/liquid/ProductImages.liquid.js');
20
20
  var ProductQuantity_liquid = require('./product/components/ProductQuantity.liquid.js');
21
- var index_liquid$1 = require('./product/components/ProductVariants/index.liquid.js');
21
+ var index_liquid$2 = require('./product/components/ProductVariants/index.liquid.js');
22
22
  var ProductTag_liquid = require('./product/components/ProductTag.liquid.js');
23
23
  var ProductProperties_liquid = require('./product/components/ProductProperties.liquid.js');
24
24
  var ProductList_liquid = require('./product/components/ProductList.liquid.js');
25
- var DynamicCheckout_liquid = require('./product/components/DynamicCheckout.liquid.js');
25
+ var DynamicCheckout_liquid = require('./product/components/DynamicCheckout/DynamicCheckout.liquid.js');
26
26
  var Vendor_liquid = require('./product/components/Vendor.liquid.js');
27
27
  var ProductBundleDiscount_liquid = require('./product/components/ProductBundleDiscount.liquid.js');
28
28
  var ProductBundleDiscountItem_liquid = require('./product/components/ProductBundleDiscountItem.liquid.js');
29
29
  var ProductViewMore_liquid = require('./product/components/ProductViewMore.liquid.js');
30
- var index_liquid$2 = require('./product/components/ProductBadge/index.liquid.js');
30
+ var index_liquid$3 = require('./product/components/ProductBadge/index.liquid.js');
31
31
  var Sku_liquid = require('./product/components/Sku.liquid.js');
32
32
  var UploadFile_liquid = require('./product/components/FileUpload/components/UploadFile.liquid.js');
33
33
  var Heading_liquid = require('./heading/Heading.liquid.js');
@@ -49,7 +49,7 @@ var TabItem_liquid = require('./tab/components/TabItem.liquid.js');
49
49
  var HeroBanner_liquid = require('./banner/components/HeroBanner.liquid.js');
50
50
  var CSSCode_liquid = require('./code/components/CSSCode.liquid.js');
51
51
  var StockCounter_liquid = require('./stock-counter/components/StockCounter.liquid.js');
52
- var index_liquid$3 = require('./cart/components/ShopPayButton/index.liquid.js');
52
+ var ShopPayButton_liquid = require('./cart/components/ShopPayButton/ShopPayButton.liquid.js');
53
53
  var Newsletter_liquid = require('./form/components/newsletter/Newsletter.liquid.js');
54
54
  var Contact_liquid = require('./form/components/contact/Contact.liquid.js');
55
55
  var FormEmail_liquid = require('./form/components/form-email/FormEmail.liquid.js');
@@ -211,11 +211,11 @@ exports.Product = Product_liquid.default;
211
211
  exports.ProductTitle = index_liquid.default;
212
212
  exports.ProductPrice = ProductPrice_liquid.ProductPrice;
213
213
  exports.ProductButton = ProductButton_liquid.default;
214
- exports.ProductDescription = ProductDescription_liquid.default;
214
+ exports.ProductDescription = index_liquid$1.default;
215
215
  exports.ProductImages = ProductImages_liquid.default;
216
216
  exports.ProductImagesV2 = ProductImages_liquid$1.default;
217
217
  exports.ProductQuantity = ProductQuantity_liquid.default;
218
- exports.ProductVariants = index_liquid$1.default;
218
+ exports.ProductVariants = index_liquid$2.default;
219
219
  exports.ProductTag = ProductTag_liquid.default;
220
220
  exports.ProductProperties = ProductProperties_liquid.default;
221
221
  exports.ProductList = ProductList_liquid.default;
@@ -224,7 +224,7 @@ exports.ProductVendor = Vendor_liquid.default;
224
224
  exports.ProductBundleDiscount = ProductBundleDiscount_liquid.default;
225
225
  exports.ProductBundleDiscountItem = ProductBundleDiscountItem_liquid.default;
226
226
  exports.ProductViewMore = ProductViewMore_liquid.default;
227
- exports.ProductBadge = index_liquid$2.default;
227
+ exports.ProductBadge = index_liquid$3.default;
228
228
  exports.ProductSku = Sku_liquid.default;
229
229
  exports.FileUpload = UploadFile_liquid.default;
230
230
  exports.Heading = Heading_liquid.default;
@@ -246,7 +246,7 @@ exports.TabItem = TabItem_liquid.default;
246
246
  exports.HeroBanner = HeroBanner_liquid.default;
247
247
  exports.CSSCode = CSSCode_liquid.default;
248
248
  exports.StockCounter = StockCounter_liquid.default;
249
- exports.ShopPayButton = index_liquid$3.default;
249
+ exports.ShopPayButton = ShopPayButton_liquid.default;
250
250
  exports.Newsletter = Newsletter_liquid.default;
251
251
  exports.ContactForm = Contact_liquid.default;
252
252
  exports.FormEmail = FormEmail_liquid.default;
@@ -70,7 +70,7 @@ const renderChildImageTemplate = (imgSrc)=>({
70
70
  height: 110
71
71
  }
72
72
  },
73
- isAdaptive: false,
73
+ isAdaptive: true,
74
74
  isNotLazyload: true
75
75
  }
76
76
  }
@@ -13,7 +13,7 @@ const getClasses = (uid, align)=>{
13
13
  };
14
14
  };
15
15
  const getContainerClasses = ()=>{
16
- const classList = 'gp-inline-flex gp-flex-col';
16
+ const classList = 'gp-inline-flex gp-flex-col gp-w-full';
17
17
  return core.composeClasses(classList);
18
18
  };
19
19
 
@@ -24,7 +24,8 @@ const ConfigPreset = [
24
24
  settings: {
25
25
  childItem: [
26
26
  'Item 1',
27
- 'Item 2'
27
+ 'Item 2',
28
+ 'Item 3'
28
29
  ]
29
30
  },
30
31
  advanced: {
@@ -32,6 +33,7 @@ const ConfigPreset = [
32
33
  inlinePadding: 'none'
33
34
  },
34
35
  childrens: [
36
+ template.ChildTemplate,
35
37
  template.ChildTemplate,
36
38
  template.ChildTemplate
37
39
  ]
@@ -12,8 +12,9 @@ const ConfigSettings = [
12
12
  label: 'Item management',
13
13
  type: 'child-item',
14
14
  default: [
15
+ 'Item 1',
15
16
  'Item 2',
16
- 'Item 2'
17
+ 'Item 3'
17
18
  ],
18
19
  childTemplate: template.ChildTemplate
19
20
  }
@@ -36,14 +36,16 @@ const ChildTemplate = {
36
36
  label: 'Image',
37
37
  styles: {
38
38
  width: {
39
- desktop: '100px'
39
+ desktop: '32px'
40
40
  },
41
+ aspectRatio: '1',
42
+ align: 'left',
41
43
  enableBorder: 'none'
42
44
  },
43
45
  settings: {
44
46
  srcSet: {
45
47
  desktop: {
46
- src: 'https://ucarecdn.com/ee6d5074-1640-4cc7-8933-47c8589c3dee/-/format/auto/'
48
+ src: 'https://cdn.shopify.com/s/files/1/0791/2780/6265/files/gempages_468220687216018311-d69940af-f03e-4864-a612-63cd9a4dce36.png'
47
49
  }
48
50
  }
49
51
  }
@@ -61,7 +63,7 @@ const ChildTemplate = {
61
63
  text: 'Your custom text goes here'
62
64
  },
63
65
  advanced: {
64
- blockPadding: 'base'
66
+ blockPadding: 'extraTight'
65
67
  },
66
68
  styles: {
67
69
  typo: {
@@ -69,6 +71,9 @@ const ChildTemplate = {
69
71
  textColor: 'default',
70
72
  fontWeight: 'normal',
71
73
  textTransform: 'none'
74
+ },
75
+ width: {
76
+ desktop: '100%'
72
77
  }
73
78
  }
74
79
  }
@@ -78,13 +78,6 @@ const CalloutTextSettings = [
78
78
  type: 'text',
79
79
  tooltip: 'Align right',
80
80
  iconName: 'polaris-text-align-right'
81
- },
82
- {
83
- label: 'Justify',
84
- value: 'justify',
85
- type: 'text',
86
- tooltip: 'Align justify',
87
- iconName: 'gp-text-align-justify'
88
81
  }
89
82
  ],
90
83
  default: 'left'
@@ -92,7 +92,7 @@ const SettingUIV2 = [
92
92
  {
93
93
  type: 'control',
94
94
  label: {
95
- en: 'Text align'
95
+ en: 'Align'
96
96
  },
97
97
  setting: {
98
98
  id: 'textAlign'
@@ -92,7 +92,7 @@ const config = {
92
92
  hideUnit: false,
93
93
  devices: {
94
94
  desktop: {
95
- default: undefined
95
+ default: '500px'
96
96
  }
97
97
  },
98
98
  displayOptions: [
@@ -148,7 +148,7 @@ const config = {
148
148
  tooltip: 'Align right'
149
149
  }
150
150
  ],
151
- default: 'center'
151
+ default: 'left'
152
152
  },
153
153
  {
154
154
  id: 'enableBorder',
@@ -43,39 +43,51 @@ const ImagePostPurchaseSettingV2 = [
43
43
  type: 'select',
44
44
  default: 'auto',
45
45
  options: [
46
- {
47
- label: 'Original',
48
- value: 'auto'
49
- },
50
46
  {
51
47
  label: 'Square',
52
48
  value: '1',
53
49
  type: 'image-shape',
54
- icon: 'image-shape-square'
50
+ icon: 'gp-image-shape-square'
55
51
  },
56
52
  {
57
53
  label: 'Vertical',
58
54
  value: '3/4',
59
55
  type: 'image-shape',
60
- icon: 'image-shape-vertical'
56
+ icon: 'gp-image-shape-vertical'
61
57
  },
62
58
  {
63
59
  label: 'Horizontal',
64
60
  value: '4/3',
65
61
  type: 'image-shape',
66
- icon: 'image-shape-horizontal'
62
+ icon: 'gp-image-shape-horizontal'
63
+ },
64
+ {
65
+ label: 'Original',
66
+ value: 'auto'
67
67
  }
68
68
  ]
69
69
  },
70
70
  {
71
71
  id: 'width',
72
- type: 'input:unit',
72
+ type: 'dropdown:input',
73
73
  label: 'Width',
74
- min: 0,
74
+ inputType: 'number',
75
75
  units: [
76
76
  'px',
77
77
  '%'
78
78
  ],
79
+ displayOptions: [
80
+ {
81
+ label: 'Full',
82
+ value: '100%',
83
+ showValue: true
84
+ },
85
+ {
86
+ label: 'Default',
87
+ value: '1200px',
88
+ showValue: true
89
+ }
90
+ ],
79
91
  devices: {
80
92
  desktop: {
81
93
  default: '500px'
@@ -130,21 +142,21 @@ const ImagePostPurchaseSettingV2 = [
130
142
  iconName: 'gp-align-right'
131
143
  }
132
144
  ],
133
- default: 'center'
145
+ default: 'left'
134
146
  },
135
147
  {
136
148
  id: 'enableBorder',
137
- type: 'option:value',
149
+ type: 'segment',
138
150
  default: 'none',
139
151
  options: [
140
152
  {
141
- label: 'None',
142
153
  value: 'none',
154
+ iconName: 'gp-cursor-none',
143
155
  type: 'border'
144
156
  },
145
157
  {
146
- label: 'Solid',
147
158
  value: 'solid',
159
+ iconName: 'gp-line',
148
160
  type: 'border'
149
161
  }
150
162
  ]
@@ -70,7 +70,7 @@ const SettingUIV2 = [
70
70
  },
71
71
  options: {
72
72
  labelVariant: 'primary',
73
- disableMessage: `Align is not supported when width is 100%`
73
+ disableMessage: 'Horizontal alignment is disabled when the width is set to 100% or greater'
74
74
  }
75
75
  }
76
76
  ]
@@ -36,14 +36,19 @@ const PostPurchaseLinkSettings = [
36
36
  },
37
37
  displayOptions: [
38
38
  {
39
- label: 'Full',
40
- value: '100%',
39
+ label: 'Fit content',
40
+ value: 'Auto',
41
41
  showValue: true
42
42
  },
43
43
  {
44
44
  label: 'Default',
45
45
  value: '1200px',
46
46
  showValue: true
47
+ },
48
+ {
49
+ label: 'Full',
50
+ value: '100%',
51
+ showValue: true
47
52
  }
48
53
  ]
49
54
  }
@@ -148,7 +148,6 @@ const ProductVariantsSettingUIV2 = [
148
148
  ]
149
149
  },
150
150
  {
151
- conditionDisplay: "width !== '100%'",
152
151
  controls: [
153
152
  {
154
153
  label: {
@@ -157,8 +156,11 @@ const ProductVariantsSettingUIV2 = [
157
156
  setting: {
158
157
  id: 'align'
159
158
  },
159
+ conditionEnable: '!(parseInt(width) == 100 && width?.includes("%"))',
160
160
  options: {
161
- labelVariant: 'primary'
161
+ labelVariant: 'primary',
162
+ fullWidth: true,
163
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
162
164
  }
163
165
  }
164
166
  ]
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var ButtonV2 = require('../../../button/components/v2/ButtonV2.js');
8
+ require('@gem-sdk/core');
9
+ require('next/link');
10
+ require('react');
11
+
12
+ const DynamicCheckout = ({ builderProps, builderAttrs, style, styles, advanced, setting })=>{
13
+ const { ...buttonStyles } = styles ?? {};
14
+ const label = setting?.label || 'Buy it now';
15
+ return /*#__PURE__*/ jsxRuntime.jsx(ButtonV2.default, {
16
+ builderProps: builderProps,
17
+ builderAttrs: builderAttrs,
18
+ advanced: advanced,
19
+ setting: {
20
+ label: label,
21
+ htmlType: 'button'
22
+ },
23
+ style: style,
24
+ styles: buttonStyles
25
+ });
26
+ };
27
+
28
+ exports.default = DynamicCheckout;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Button_liquid = require('./components/Button.liquid.js');
6
+
7
+ const DynamicCheckout = ({ builderProps, styles, advanced, setting, pageContext })=>{
8
+ const { ...buttonStyles } = styles ?? {};
9
+ const label = setting?.label || 'Buy it now';
10
+ return Button_liquid.default({
11
+ builderProps,
12
+ className: '',
13
+ advanced,
14
+ setting: {
15
+ label: label,
16
+ htmlType: 'button'
17
+ },
18
+ styles: buttonStyles,
19
+ pageContext
20
+ });
21
+ };
22
+
23
+ exports.default = DynamicCheckout;
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+
5
+ const getBaseClasses = (uid)=>({
6
+ 'gp-block': true,
7
+ [`wrap__button--unbranded__${uid}`]: true,
8
+ [String.raw`[&_.shopify-payment-button\_\_button--unbranded]:gp-min-h-fit`]: true,
9
+ [String.raw`disabled:[&_.shopify-payment-button\_\_button--unbranded]:gp-pointer-events-none`]: true
10
+ });
11
+ const getTypographyClass = (typoType)=>{
12
+ if (!typoType) return {};
13
+ return {
14
+ [String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${core.genTypoClass(typoType)}`]: true
15
+ };
16
+ };
17
+ const getSpacingClass = (spacingType)=>{
18
+ if (!spacingType) return {};
19
+ return {
20
+ [String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${core.genSizeClass(spacingType)}`]: true
21
+ };
22
+ };
23
+ const getButtonClasses = ({ uid = '', styles })=>{
24
+ return {
25
+ ...getBaseClasses(uid),
26
+ ...getTypographyClass(styles?.typo?.type),
27
+ ...getSpacingClass(styles?.btnSpacing?.type),
28
+ [core.getGlobalColorStateClassDynamicBtn('text', styles?.textColor)]: true
29
+ };
30
+ };
31
+
32
+ exports.getButtonClasses = getButtonClasses;
@@ -0,0 +1,181 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+
5
+ const composeSize = (width, height, important = true)=>{
6
+ return `
7
+ ${width ? `width: ${width}${important ? '!important;' : ''};` : ''}
8
+ ${height ? `height: ${height}${important ? '!important;' : ''};` : ''}
9
+ `;
10
+ };
11
+ const composeSpacing = (device, padding)=>{
12
+ const suffix = device && device !== 'desktop' ? `-${device}` : '';
13
+ const spacingDevice = {
14
+ top: padding[`--pt${suffix}`],
15
+ bottom: padding[`--pb${suffix}`],
16
+ left: padding[`--pl${suffix}`],
17
+ right: padding[`--pr${suffix}`]
18
+ };
19
+ return `
20
+ padding-top: ${spacingDevice.top ? `${spacingDevice.top} !important;` : ''};
21
+ padding-bottom: ${spacingDevice.bottom ? `${spacingDevice.bottom} !important;` : ''};
22
+ padding-left: ${spacingDevice.left ? `${spacingDevice.left} !important;` : ''};
23
+ padding-right: ${spacingDevice.right ? `${spacingDevice.right} !important;` : ''};
24
+ `;
25
+ };
26
+ const composeFontSize = (fontSize)=>{
27
+ return fontSize ? `font-size: ${fontSize} !important;` : '';
28
+ };
29
+ const composeLineHeight = (lineHeight)=>{
30
+ return lineHeight ? `line-height: ${lineHeight} !important;` : '';
31
+ };
32
+ const composeTextAlign = (align)=>{
33
+ return `${align ? `text-align: ${align} !important;` : ''}`;
34
+ };
35
+ const getDeviceStyles = ({ uid, device, styles, composeGlobalSize })=>{
36
+ return `
37
+ .wrap__button--unbranded__${uid} {
38
+ ${composeTextAlign(styles?.align?.[device])}
39
+ }
40
+
41
+ .wrap__button--unbranded__${uid} .shopify-payment-button {
42
+ ${composeSize(composeGlobalSize.width[device], composeGlobalSize.height[device], device !== 'desktop')}
43
+ }
44
+
45
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded {
46
+ width: 100%;
47
+ ${device !== 'desktop' ? `
48
+ ${composeLineHeight(styles?.typo?.custom?.lineHeight?.[device])}
49
+ ${composeFontSize(styles?.typo?.custom?.fontSize?.[device])}
50
+ ` : ''}
51
+ ${composeSpacing(device, composeGlobalSize.padding)}
52
+ ${composeSize(composeGlobalSize.width[device] ?? 'auto', composeGlobalSize.height[device] ?? 'auto', false)}
53
+ ${core.composeShadowCss({
54
+ boxShadowValue: styles?.boxShadowBtnV2?.[device]?.normal,
55
+ hasBoxShadow: styles?.boxShadowBtnV2?.[device]?.normal?.type !== 'none'
56
+ })}
57
+ ${core.composeCornerCss(styles?.roundedBtnV2?.[device]?.normal, true)}
58
+ ${device === 'desktop' ? core.composeTypographyV2Css(styles?.typo, true) : ''}
59
+ }
60
+
61
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover {
62
+ ${core.composeShadowCss({
63
+ boxShadowValue: styles?.boxShadowBtnV2?.[device]?.hover,
64
+ hasBoxShadow: styles?.boxShadowBtnV2?.[device]?.hover?.type !== 'none',
65
+ important: true
66
+ })}
67
+ ${core.composeTextHoverColorCss(device, styles?.textColorHover, true)}
68
+ }
69
+
70
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
71
+ ${core.composeBorderCss(styles?.borderBtnV2?.[device]?.normal)}
72
+ ${core.composeCornerCss(styles?.roundedBtnV2?.[device]?.normal)}
73
+ ${core.composeBackgroundImageCss(styles?.backgroundImage, {
74
+ device,
75
+ state: 'normal'
76
+ })}
77
+ ${core.composeBackgroundCss(styles?.backgroundColorV2?.[device]?.normal)}
78
+ }
79
+
80
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover::before {
81
+ ${core.composeBorderCss(styles?.borderBtnV2?.[device]?.hover)}
82
+ ${core.composeCornerCss(styles?.roundedBtnV2?.[device]?.hover)}
83
+ ${core.composeBackgroundCss(styles?.backgroundColorV2?.[device]?.hover)}
84
+ }
85
+ `;
86
+ };
87
+ const getButtonStyles = ({ styles, uid })=>{
88
+ const composeGlobalSize = {
89
+ width: core.getWidthHeightGlobalSize('width', styles?.globalSize),
90
+ height: core.getWidthHeightGlobalSize('height', styles?.globalSize),
91
+ padding: core.getPaddingGlobalSize(styles?.globalSize)
92
+ };
93
+ const baseStyles = `
94
+ .wrap__button--unbranded__${uid} .shopify-payment-button {
95
+ display: inline-block;
96
+ min-height: unset !important;
97
+ }
98
+
99
+ .wrap__button--unbranded__${uid} .shopify-payment-button div {
100
+ width: 100%;
101
+ margin-top: 0px !important;
102
+ }
103
+
104
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__more-options {
105
+ display: none;
106
+ }
107
+
108
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded {
109
+ max-width: 100%;
110
+ min-width: unset;
111
+ min-height: unset !important;
112
+ background-color: unset !important;
113
+ position: relative;
114
+ border: none !important;
115
+ margin: 0;
116
+ z-index: 0;
117
+ border-radius: unset;
118
+ width: 100%;
119
+ display: inline-flex;
120
+ justify-content: center;
121
+ align-items: center;
122
+ }
123
+
124
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
125
+ content: "";
126
+ height: 100%;
127
+ width: 100%;
128
+ position: absolute;
129
+ top: 0;
130
+ left: 0;
131
+ pointer-events: none;
132
+ z-index: -1;
133
+ }
134
+
135
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::after {
136
+ border-radius: 0;
137
+ box-shadow: none;
138
+ }
139
+
140
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::after:hover {
141
+ border-radius: 0;
142
+ box-shadow: none;
143
+ }
144
+
145
+ .wrap__button--unbranded__${uid} .shopify-payment-button > div {
146
+ max-width: 100%;
147
+ }
148
+
149
+ .wrap__button--unbranded__${uid} .shopify-payment-button > div > div {
150
+ max-width: 100%;
151
+ }
152
+
153
+ ${getDeviceStyles({
154
+ device: 'desktop',
155
+ uid,
156
+ styles,
157
+ composeGlobalSize
158
+ })}
159
+
160
+ @media only screen and (max-width: 1024px) and (min-width: 768px) {
161
+ ${getDeviceStyles({
162
+ device: 'tablet',
163
+ uid,
164
+ styles,
165
+ composeGlobalSize
166
+ })}
167
+ }
168
+
169
+ @media only screen and (max-width: 767px) {
170
+ ${getDeviceStyles({
171
+ device: 'mobile',
172
+ uid,
173
+ styles,
174
+ composeGlobalSize
175
+ })}
176
+ }
177
+ `;
178
+ return baseStyles;
179
+ };
180
+
181
+ exports.getButtonStyles = getButtonStyles;
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@gem-sdk/core');
6
+ var system = require('@gem-sdk/system');
7
+ var helpers = require('../../../../helpers.js');
8
+ var classes = require('../common/classes.js');
9
+ var styles = require('../common/styles.js');
10
+
11
+ const Button = ({ setting, advanced, styles: styles$1, pageContext, builderProps, className = '' })=>{
12
+ const translatedLabel = helpers.getDynamicSourceLocales({
13
+ pageContext,
14
+ settingId: 'label',
15
+ val: setting?.label,
16
+ uid: builderProps?.uid,
17
+ translate: setting?.translate
18
+ });
19
+ const buttonClass = system.createClass({
20
+ ...!!className && {
21
+ [className]: true
22
+ },
23
+ ...classes.getButtonClasses({
24
+ styles: styles$1,
25
+ uid: builderProps?.uid
26
+ })
27
+ });
28
+ const buttonStyles = styles.getButtonStyles({
29
+ styles: styles$1,
30
+ uid: builderProps?.uid
31
+ });
32
+ const buttonState = system.createStateOrContext({
33
+ setting: {
34
+ label: setting?.label
35
+ },
36
+ totalVariant: '{{product.variants.size}}'
37
+ });
38
+ return core.template`
39
+ ${system.Liquid(`
40
+ {%- liquid
41
+ assign inventory_quantity = variant.inventory_quantity | default: 0
42
+ assign supported_payment_methods = shop.enabled_payment_types
43
+ -%}
44
+ `)}
45
+ <gp-product-dynamic data-id="${builderProps?.uid}" data-translate-label="${translatedLabel}" class="${advanced?.cssClass}" gp-data='${JSON.stringify(buttonState).replaceAll("'", '&#039;')}
46
+ '>
47
+ <div class="${buttonClass}">
48
+ {{ form | payment_button }}
49
+ </div>
50
+ {% style %}
51
+ ${buttonStyles}
52
+ {% endstyle %}
53
+ </gp-product-dynamic>
54
+ ${system.If(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-dynamic.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-dynamic.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
55
+ `;
56
+ };
57
+
58
+ exports.default = Button;