@gem-sdk/components 2.0.0-dev.274 → 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 (74) hide show
  1. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +1 -1
  2. package/dist/cjs/builder.js +13 -13
  3. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.js +70 -0
  4. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.liquid.js +71 -0
  5. package/dist/cjs/cart/components/ShopPayButton/common/classes.js +18 -0
  6. package/dist/cjs/cart/components/ShopPayButton/common/helpers.js +31 -0
  7. package/dist/cjs/cart/components/ShopPayButton/common/styles.js +12 -0
  8. package/dist/cjs/cart/components/ShopPayButton/hooks/useShopPayButton.js +70 -0
  9. package/dist/cjs/cart/next.js +1 -1
  10. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  11. package/dist/cjs/header/components/kind/basic/index.js +1 -1
  12. package/dist/cjs/header/components/kind/modern/index.js +1 -1
  13. package/dist/cjs/index.js +39 -39
  14. package/dist/cjs/index.liquid.js +9 -9
  15. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.js +28 -0
  16. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.liquid.js +23 -0
  17. package/dist/cjs/product/components/DynamicCheckout/common/classes.js +32 -0
  18. package/dist/cjs/product/components/DynamicCheckout/common/styles.js +181 -0
  19. package/dist/cjs/product/components/DynamicCheckout/components/Button.liquid.js +58 -0
  20. package/dist/cjs/product/components/FileUpload/components/common/index.js +1 -1
  21. package/dist/cjs/product/components/ProductDescription/common/const.js +9 -0
  22. package/dist/cjs/product/components/ProductDescription/common/getClasses.js +30 -0
  23. package/dist/cjs/product/components/ProductDescription/common/getStyle.js +81 -0
  24. package/dist/cjs/product/components/ProductDescription/hooks/useGpDescription.js +90 -0
  25. package/dist/cjs/product/components/ProductDescription/index.js +115 -0
  26. package/dist/cjs/product/components/ProductDescription/index.liquid.js +86 -0
  27. package/dist/cjs/product/next.js +1 -1
  28. package/dist/cjs/setting.js +1 -1
  29. package/dist/esm/banner/components/HeroBannerItem.liquid.js +1 -1
  30. package/dist/esm/builder.js +3 -3
  31. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.js +66 -0
  32. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.liquid.js +67 -0
  33. package/dist/esm/cart/components/ShopPayButton/common/classes.js +15 -0
  34. package/dist/esm/cart/components/ShopPayButton/common/helpers.js +27 -0
  35. package/dist/esm/cart/components/ShopPayButton/common/styles.js +10 -0
  36. package/dist/esm/cart/components/ShopPayButton/hooks/useShopPayButton.js +68 -0
  37. package/dist/esm/cart/next.js +1 -1
  38. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  39. package/dist/esm/header/components/kind/basic/index.js +1 -1
  40. package/dist/esm/header/components/kind/modern/index.js +1 -1
  41. package/dist/esm/index.js +3 -3
  42. package/dist/esm/index.liquid.js +3 -3
  43. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.js +24 -0
  44. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.liquid.js +19 -0
  45. package/dist/esm/product/components/DynamicCheckout/common/classes.js +30 -0
  46. package/dist/esm/product/components/DynamicCheckout/common/styles.js +179 -0
  47. package/dist/esm/product/components/DynamicCheckout/components/Button.liquid.js +54 -0
  48. package/dist/esm/product/components/FileUpload/components/common/index.js +1 -1
  49. package/dist/esm/product/components/ProductDescription/common/const.js +6 -0
  50. package/dist/esm/product/components/ProductDescription/common/getClasses.js +27 -0
  51. package/dist/esm/product/components/ProductDescription/common/getStyle.js +77 -0
  52. package/dist/esm/product/components/ProductDescription/hooks/useGpDescription.js +88 -0
  53. package/dist/esm/product/components/ProductDescription/index.js +111 -0
  54. package/dist/esm/product/components/ProductDescription/index.liquid.js +82 -0
  55. package/dist/esm/product/next.js +1 -1
  56. package/dist/esm/setting.js +1 -1
  57. package/dist/types/index.d.ts +29 -97
  58. package/package.json +1 -1
  59. package/dist/cjs/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -20
  60. package/dist/cjs/cart/components/ShopPayButton/index.js +0 -113
  61. package/dist/cjs/cart/components/ShopPayButton/index.liquid.js +0 -51
  62. package/dist/cjs/product/components/DynamicCheckout.liquid.js +0 -250
  63. package/dist/cjs/product/components/ProductDescription/const.js +0 -5
  64. package/dist/cjs/product/components/ProductDescription.js +0 -172
  65. package/dist/cjs/product/components/ProductDescription.liquid.js +0 -120
  66. package/dist/esm/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -17
  67. package/dist/esm/cart/components/ShopPayButton/index.js +0 -109
  68. package/dist/esm/cart/components/ShopPayButton/index.liquid.js +0 -47
  69. package/dist/esm/product/components/DynamicCheckout.liquid.js +0 -246
  70. package/dist/esm/product/components/ProductDescription/const.js +0 -3
  71. package/dist/esm/product/components/ProductDescription.js +0 -168
  72. package/dist/esm/product/components/ProductDescription.liquid.js +0 -116
  73. /package/dist/cjs/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
  74. /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;
@@ -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;
@@ -13,7 +13,7 @@ require('../../../ProductVariants/variants/index.js');
13
13
  require('next/image');
14
14
  require('react-youtube');
15
15
  require('../../../../../image/components/AdaptiveImage.js');
16
- require('../../../../../cart/components/ShopPayButton/index.js');
16
+ require('../../../../../cart/components/ShopPayButton/ShopPayButton.js');
17
17
  require('../../../../../countdown-timer/setting/configs/settings.js');
18
18
  require('../../../../../header/components/Header.js');
19
19
  require('../../../../../header/components/kind/basic/index.js');
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const DESCRIPTION_LINE_HEIGHT_DEFAULT = 21;
4
+ const ICON_SVG = `<svg height="1em" width="1em" viewBox="0 0 22 12" fill="none" xmlns="http://www.w3.org/2000/svg" ><path d="M1.70711 0.292893C1.31658 -0.0976311 0.683417 -0.0976311 0.292893 0.292893C-0.0976311 0.683417 -0.0976311 1.31658 0.292893 1.70711L1.70711 0.292893ZM11 11L10.2929 11.7071C10.6834 12.0976 11.3166 12.0976 11.7071 11.7071L11 11ZM21.7071 1.70711C22.0976 1.31658 22.0976 0.683417 21.7071 0.292893C21.3166 -0.0976311 20.6834 -0.0976311 20.2929 0.292893L21.7071 1.70711ZM0.292893 1.70711L10.2929 11.7071L11.7071 10.2929L1.70711 0.292893L0.292893 1.70711ZM11.7071 11.7071L21.7071 1.70711L20.2929 0.292893L10.2929 10.2929L11.7071 11.7071Z"
5
+ fill="currentColor"/>
6
+ </svg>`;
7
+
8
+ exports.DESCRIPTION_LINE_HEIGHT_DEFAULT = DESCRIPTION_LINE_HEIGHT_DEFAULT;
9
+ exports.ICON_SVG = ICON_SVG;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+
5
+ const getClasses = ({ setting })=>{
6
+ const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
7
+ const globalColorClass = core.getGlobalColorClass('text', setting?.color);
8
+ return {
9
+ 'gp-relative p-description-wrapper gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre': true,
10
+ ...appendTypoClass && {
11
+ [appendTypoClass]: true
12
+ },
13
+ [globalColorClass]: true,
14
+ "data-[browser=safari]:after:gp-content-[' '] data-[browser=safari]:after:gp-absolute data-[browser=safari]:after:gp-left-0 data-[browser=safari]:after:gp-right-0 data-[browser=safari]:after:gp-bottom-0 data-[browser=safari]:after:gp-w-full data-[browser=safari]:after:gp-h-1/2 data-[browser=safari]:after:gp-bg-gradient-to-t data-[browser=safari]:after:gp-from-white": true
15
+ };
16
+ };
17
+ const getButtonClasses = ({ setting })=>{
18
+ const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
19
+ const globalColorClass = core.getGlobalColorClass('text', setting?.showMoreColor);
20
+ return {
21
+ 'p-description-show-more gp-items-center gp-mt-4 gp-w-full gp-transition-all hover:gp-opacity-80': true,
22
+ ...appendTypoClass && {
23
+ [appendTypoClass]: true
24
+ },
25
+ [globalColorClass]: true
26
+ };
27
+ };
28
+
29
+ exports.getButtonClasses = getButtonClasses;
30
+ exports.getClasses = getClasses;
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+ var getMaxHeight = require('./getMaxHeight.js');
5
+
6
+ const devices = [
7
+ 'desktop',
8
+ 'mobile',
9
+ 'tablet'
10
+ ];
11
+ const getDisplayStyle = (fnCondition, defaultValue)=>{
12
+ let result = {};
13
+ devices.forEach((device)=>{
14
+ result = {
15
+ ...result,
16
+ [`--d${device === 'desktop' ? '' : `-${device}`}`]: `${fnCondition(device) ? 'none' : defaultValue}`
17
+ };
18
+ });
19
+ return result;
20
+ };
21
+ const getTextStyle = ({ setting, renderMaxHeight })=>{
22
+ const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
23
+ const composeStyles = {
24
+ ...core.getStyleShadow({
25
+ value: setting?.typo?.custom?.textShadow,
26
+ styleAppliedFor: 'text-shadow',
27
+ isEnableShadow: setting?.typo?.custom?.textShadow?.type !== 'none'
28
+ }),
29
+ ...core.makeStyleResponsive('ta', setting?.textAlign),
30
+ ...core.getGlobalColorStyle(setting?.color),
31
+ ...core.makeStyle({
32
+ tt: setting?.transform
33
+ }),
34
+ ...appendTypoStyle,
35
+ ...renderMaxHeight && getMaxHeight.getMaxHeightStyleDefault(setting)
36
+ };
37
+ return core.filterTruthyStyles(composeStyles);
38
+ };
39
+ const getButtonStyle = ({ setting })=>{
40
+ const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
41
+ const getDisplayCollapse = ()=>{
42
+ return getDisplayStyle((device)=>!!setting?.hasLineClamp && setting.hasLineClamp[device] !== undefined && !setting.hasLineClamp[device], 'inline-flex');
43
+ };
44
+ const composeStyles = {
45
+ ...core.makeStyleResponsive('jc', setting?.textAlign),
46
+ ...core.makeStyle({
47
+ tt: setting?.transform
48
+ }),
49
+ ...appendTypoStyle,
50
+ ...core.getGlobalColorStyle(setting?.showMoreColor),
51
+ ...getDisplayCollapse()
52
+ };
53
+ return core.filterTruthyStyles(composeStyles);
54
+ };
55
+ const getStaticCss = ()=>{
56
+ const gpDescriptionCss = `
57
+ .gp-p-description-text > *:not(ol):not(ul):not(table):not(div):not(style):not(script) {
58
+ display: inline !important;
59
+ }
60
+ .gp-p-description-text > *:not(ol):not(ul):not(table):not(div):not(style):not(script)::after {
61
+ content: "\\A";
62
+ white-space: pre;
63
+ }
64
+ .gp-p-description-text > table {
65
+ box-shadow: none;
66
+ }
67
+ `;
68
+ const textDescriptionCss = `
69
+ .p-description-wrapper.gp-p-description-text * {
70
+ color: inherit;
71
+ line-height: inherit !important;
72
+ }`;
73
+ return {
74
+ gpDescriptionCss,
75
+ textDescriptionCss
76
+ };
77
+ };
78
+
79
+ exports.getButtonStyle = getButtonStyle;
80
+ exports.getStaticCss = getStaticCss;
81
+ exports.getTextStyle = getTextStyle;
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var _const = require('../common/const.js');
5
+ var core = require('@gem-sdk/core');
6
+
7
+ const useGpDescription = (setting)=>{
8
+ const ref = React.useRef(null);
9
+ const [open, setOpen] = React.useState(false);
10
+ const [isShowViewMore, setIsShowViewMore] = React.useState(false);
11
+ const product = core.useProduct();
12
+ const currentDevice = core.useCurrentDevice();
13
+ const hasLineClamp = core.getResponsiveValueByScreen(setting?.hasLineClamp, currentDevice);
14
+ const lineClamp = core.getResponsiveValueByScreen(setting?.lineClamp, currentDevice);
15
+ const { redirectProductShopifyLink } = core.useProductShopifyEditLink();
16
+ const mode = core.useEditorMode();
17
+ const getLineHeightFromDom = React.useCallback(()=>{
18
+ if (!ref.current) return _const.DESCRIPTION_LINE_HEIGHT_DEFAULT;
19
+ const lineHeight = window.getComputedStyle(ref.current).getPropertyValue('line-height');
20
+ return Math.ceil(parseFloat(lineHeight));
21
+ }, []);
22
+ const getMaxHeight = React.useCallback((lineHeight)=>{
23
+ if (!hasLineClamp || !lineClamp) return 'auto';
24
+ if (lineHeight) return `${lineClamp * lineHeight}px`;
25
+ return 'auto';
26
+ }, [
27
+ hasLineClamp,
28
+ lineClamp
29
+ ]);
30
+ const handleToggleShowMore = ()=>{
31
+ if (!ref.current) return;
32
+ const lineHeight = getLineHeightFromDom();
33
+ if (open) {
34
+ ref.current.style.maxHeight = getMaxHeight(lineHeight);
35
+ } else {
36
+ ref.current.style.maxHeight = 'none';
37
+ }
38
+ setOpen((prev)=>!prev);
39
+ };
40
+ React.useEffect(()=>{
41
+ const lineHeight = getLineHeightFromDom();
42
+ getMaxHeight(lineHeight);
43
+ }, [
44
+ setting?.typo?.custom,
45
+ getMaxHeight,
46
+ getLineHeightFromDom
47
+ ]);
48
+ React.useEffect(()=>{
49
+ const dom = ref.current;
50
+ setOpen(false);
51
+ if (!dom) return;
52
+ const enableShowMore = hasLineClamp && product?.descriptionHtml;
53
+ if (!enableShowMore) dom.style.maxHeight = 'none';
54
+ else {
55
+ const value = lineClamp;
56
+ setTimeout(()=>{
57
+ const scrollHeight = dom?.scrollHeight ?? 0;
58
+ const clientHeight = dom?.clientHeight ?? 0;
59
+ const lineHeight = getLineHeightFromDom();
60
+ const lineText = Math.round((scrollHeight ?? 0) / lineHeight);
61
+ dom.style.maxHeight = getMaxHeight(lineHeight);
62
+ const conditionCheckLine = value && value < lineText || clientHeight < scrollHeight;
63
+ if (value && conditionCheckLine) {
64
+ setIsShowViewMore(()=>true);
65
+ } else {
66
+ setIsShowViewMore(()=>false);
67
+ }
68
+ }, 100);
69
+ }
70
+ }, [
71
+ hasLineClamp,
72
+ lineClamp,
73
+ product?.description,
74
+ product?.descriptionHtml,
75
+ getLineHeightFromDom,
76
+ getMaxHeight,
77
+ setOpen,
78
+ setIsShowViewMore
79
+ ]);
80
+ return {
81
+ ref,
82
+ open,
83
+ isShowViewMore,
84
+ handleToggleShowMore,
85
+ mode,
86
+ redirectProductShopifyLink
87
+ };
88
+ };
89
+
90
+ exports.useGpDescription = useGpDescription;