@gem-sdk/components 2.0.0-dev.274 → 2.0.0-dev.277

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 (148) hide show
  1. package/dist/cjs/article/components/ArticleReadMore.js +2 -4
  2. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +5 -5
  3. package/dist/cjs/builder.js +17 -21
  4. package/dist/cjs/button/components/Button.js +111 -184
  5. package/dist/cjs/button/components/Button.liquid.js +108 -171
  6. package/dist/cjs/button/components/ButtonIcon.js +17 -0
  7. package/dist/cjs/button/components/ButtonIcon.liquid.js +16 -0
  8. package/dist/cjs/button/components/ButtonLabel.js +18 -0
  9. package/dist/cjs/button/components/ButtonLabel.liquid.js +15 -0
  10. package/dist/cjs/button/components/ButtonLoadingIndicator.liquid.js +12 -0
  11. package/dist/cjs/button/components/common/attributes.js +15 -0
  12. package/dist/cjs/button/components/common/classes.js +55 -0
  13. package/dist/cjs/button/components/common/constants.js +26 -0
  14. package/dist/cjs/button/components/common/data.js +76 -0
  15. package/dist/cjs/button/components/common/helpers.js +131 -0
  16. package/dist/cjs/button/components/common/styles.js +157 -0
  17. package/dist/cjs/button/next.js +2 -6
  18. package/dist/cjs/button/setting/configs/settings.js +5 -1
  19. package/dist/cjs/cart/components/CheckoutNow.js +0 -2
  20. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.js +70 -0
  21. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.liquid.js +71 -0
  22. package/dist/cjs/cart/components/ShopPayButton/common/classes.js +18 -0
  23. package/dist/cjs/cart/components/ShopPayButton/common/helpers.js +31 -0
  24. package/dist/cjs/cart/components/ShopPayButton/common/styles.js +12 -0
  25. package/dist/cjs/cart/components/ShopPayButton/hooks/useShopPayButton.js +70 -0
  26. package/dist/cjs/cart/next.js +1 -1
  27. package/dist/cjs/coupon/components/Coupon.js +1 -3
  28. package/dist/cjs/dialog/setting/Dialog.js +7 -580
  29. package/dist/cjs/dialog/setting/configs/settings.js +325 -0
  30. package/dist/cjs/dialog/setting/configs/uiV1.js +288 -0
  31. package/dist/cjs/dialog/setting/configs/uiV2.js +258 -0
  32. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +4 -4
  33. package/dist/cjs/form/components/submit-button/SubmitButton.js +0 -4
  34. package/dist/cjs/header/components/kind/basic/index.js +1 -1
  35. package/dist/cjs/header/components/kind/modern/index.js +1 -1
  36. package/dist/cjs/index.js +41 -43
  37. package/dist/cjs/index.liquid.js +10 -12
  38. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.js +25 -0
  39. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.liquid.js +23 -0
  40. package/dist/cjs/product/components/DynamicCheckout/common/classes.js +32 -0
  41. package/dist/cjs/product/components/DynamicCheckout/common/styles.js +181 -0
  42. package/dist/cjs/product/components/DynamicCheckout/components/Button.liquid.js +58 -0
  43. package/dist/cjs/product/components/DynamicCheckout.js +2 -5
  44. package/dist/cjs/product/components/FileUpload/components/common/index.js +2 -2
  45. package/dist/cjs/product/components/ProductButton.js +2 -3
  46. package/dist/cjs/product/components/ProductButton.liquid.js +3 -3
  47. package/dist/cjs/product/components/ProductDescription/common/const.js +9 -0
  48. package/dist/cjs/product/components/ProductDescription/common/getClasses.js +30 -0
  49. package/dist/cjs/product/components/ProductDescription/common/getStyle.js +81 -0
  50. package/dist/cjs/product/components/ProductDescription/hooks/useGpDescription.js +90 -0
  51. package/dist/cjs/product/components/ProductDescription/index.js +115 -0
  52. package/dist/cjs/product/components/ProductDescription/index.liquid.js +85 -0
  53. package/dist/cjs/product/components/ProductViewMore.js +2 -5
  54. package/dist/cjs/product/components/ProductViewMore.liquid.js +2 -2
  55. package/dist/cjs/product/next.js +1 -1
  56. package/dist/cjs/setting.js +3 -3
  57. package/dist/cjs/text/components/common/getClasses.js +1 -1
  58. package/dist/cjs/third-party/components/PushOwl.js +0 -5
  59. package/dist/esm/article/components/ArticleReadMore.js +1 -3
  60. package/dist/esm/banner/components/HeroBannerItem.liquid.js +5 -5
  61. package/dist/esm/builder.js +4 -8
  62. package/dist/esm/button/components/Button.js +113 -186
  63. package/dist/esm/button/components/Button.liquid.js +109 -172
  64. package/dist/esm/button/components/ButtonIcon.js +13 -0
  65. package/dist/esm/button/components/ButtonIcon.liquid.js +12 -0
  66. package/dist/esm/button/components/ButtonLabel.js +14 -0
  67. package/dist/esm/button/components/ButtonLabel.liquid.js +11 -0
  68. package/dist/esm/button/components/ButtonLoadingIndicator.liquid.js +8 -0
  69. package/dist/esm/button/components/common/attributes.js +13 -0
  70. package/dist/esm/button/components/common/classes.js +49 -0
  71. package/dist/esm/button/components/common/constants.js +24 -0
  72. package/dist/esm/button/components/common/data.js +74 -0
  73. package/dist/esm/button/components/common/helpers.js +118 -0
  74. package/dist/esm/button/components/common/styles.js +148 -0
  75. package/dist/esm/button/next.js +2 -6
  76. package/dist/esm/button/setting/configs/settings.js +5 -1
  77. package/dist/esm/cart/components/CheckoutNow.js +0 -2
  78. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.js +66 -0
  79. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.liquid.js +67 -0
  80. package/dist/esm/cart/components/ShopPayButton/common/classes.js +15 -0
  81. package/dist/esm/cart/components/ShopPayButton/common/helpers.js +27 -0
  82. package/dist/esm/cart/components/ShopPayButton/common/styles.js +10 -0
  83. package/dist/esm/cart/components/ShopPayButton/hooks/useShopPayButton.js +68 -0
  84. package/dist/esm/cart/next.js +1 -1
  85. package/dist/esm/coupon/components/Coupon.js +1 -3
  86. package/dist/esm/dialog/setting/Dialog.js +7 -580
  87. package/dist/esm/dialog/setting/configs/settings.js +323 -0
  88. package/dist/esm/dialog/setting/configs/uiV1.js +286 -0
  89. package/dist/esm/dialog/setting/configs/uiV2.js +256 -0
  90. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +4 -4
  91. package/dist/esm/form/components/submit-button/SubmitButton.js +0 -4
  92. package/dist/esm/header/components/kind/basic/index.js +1 -1
  93. package/dist/esm/header/components/kind/modern/index.js +1 -1
  94. package/dist/esm/index.js +4 -5
  95. package/dist/esm/index.liquid.js +4 -5
  96. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.js +21 -0
  97. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.liquid.js +19 -0
  98. package/dist/esm/product/components/DynamicCheckout/common/classes.js +30 -0
  99. package/dist/esm/product/components/DynamicCheckout/common/styles.js +179 -0
  100. package/dist/esm/product/components/DynamicCheckout/components/Button.liquid.js +54 -0
  101. package/dist/esm/product/components/DynamicCheckout.js +1 -4
  102. package/dist/esm/product/components/FileUpload/components/common/index.js +2 -2
  103. package/dist/esm/product/components/ProductButton.js +1 -2
  104. package/dist/esm/product/components/ProductButton.liquid.js +1 -1
  105. package/dist/esm/product/components/ProductDescription/common/const.js +6 -0
  106. package/dist/esm/product/components/ProductDescription/common/getClasses.js +27 -0
  107. package/dist/esm/product/components/ProductDescription/common/getStyle.js +77 -0
  108. package/dist/esm/product/components/ProductDescription/hooks/useGpDescription.js +88 -0
  109. package/dist/esm/product/components/ProductDescription/index.js +111 -0
  110. package/dist/esm/product/components/ProductDescription/index.liquid.js +81 -0
  111. package/dist/esm/product/components/ProductViewMore.js +1 -4
  112. package/dist/esm/product/components/ProductViewMore.liquid.js +1 -1
  113. package/dist/esm/product/next.js +1 -1
  114. package/dist/esm/setting.js +3 -3
  115. package/dist/esm/text/components/common/getClasses.js +1 -1
  116. package/dist/esm/third-party/components/PushOwl.js +0 -5
  117. package/dist/types/index.d.ts +200 -360
  118. package/package.json +2 -2
  119. package/dist/cjs/button/components/v2/ButtonIcon.js +0 -18
  120. package/dist/cjs/button/components/v2/ButtonLabel.js +0 -25
  121. package/dist/cjs/button/components/v2/ButtonV2.js +0 -140
  122. package/dist/cjs/button/components/v2/ButtonV2.liquid.js +0 -181
  123. package/dist/cjs/button/hooks/useButtonCustomCss.js +0 -88
  124. package/dist/cjs/button/hooks/useButtonStyles.js +0 -93
  125. package/dist/cjs/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -20
  126. package/dist/cjs/cart/components/ShopPayButton/index.js +0 -113
  127. package/dist/cjs/cart/components/ShopPayButton/index.liquid.js +0 -51
  128. package/dist/cjs/product/components/DynamicCheckout.liquid.js +0 -250
  129. package/dist/cjs/product/components/ProductDescription/const.js +0 -5
  130. package/dist/cjs/product/components/ProductDescription.js +0 -172
  131. package/dist/cjs/product/components/ProductDescription.liquid.js +0 -120
  132. package/dist/esm/button/components/v2/ButtonIcon.js +0 -14
  133. package/dist/esm/button/components/v2/ButtonLabel.js +0 -21
  134. package/dist/esm/button/components/v2/ButtonV2.js +0 -136
  135. package/dist/esm/button/components/v2/ButtonV2.liquid.js +0 -177
  136. package/dist/esm/button/hooks/useButtonCustomCss.js +0 -84
  137. package/dist/esm/button/hooks/useButtonStyles.js +0 -91
  138. package/dist/esm/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -17
  139. package/dist/esm/cart/components/ShopPayButton/index.js +0 -109
  140. package/dist/esm/cart/components/ShopPayButton/index.liquid.js +0 -47
  141. package/dist/esm/product/components/DynamicCheckout.liquid.js +0 -246
  142. package/dist/esm/product/components/ProductDescription/const.js +0 -3
  143. package/dist/esm/product/components/ProductDescription.js +0 -168
  144. package/dist/esm/product/components/ProductDescription.liquid.js +0 -116
  145. /package/dist/cjs/button/components/{v2/ButtonLoadingIndicator.js → ButtonLoadingIndicator.js} +0 -0
  146. /package/dist/cjs/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
  147. /package/dist/esm/button/components/{v2/ButtonLoadingIndicator.js → ButtonLoadingIndicator.js} +0 -0
  148. /package/dist/esm/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
@@ -1,113 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var core = require('@gem-sdk/core');
8
- var dynamic = require('next/dynamic');
9
- var React = require('react');
10
- var ShopPayButtonCommon = require('./ShopPayButtonCommon.js');
11
-
12
- const DynamicCheckoutBlack = dynamic(()=>Promise.resolve().then(function () { return require('./icons/DynamicCheckoutBlack.js'); }));
13
- const DynamicCheckoutPurple = dynamic(()=>Promise.resolve().then(function () { return require('./icons/DynamicCheckoutPurple.js'); }));
14
- const DynamicCheckoutWhite = dynamic(()=>Promise.resolve().then(function () { return require('./icons/DynamicCheckoutWhite.js'); }));
15
- const ExpressCheckoutBlack = dynamic(()=>Promise.resolve().then(function () { return require('./icons/ExpressCheckoutBlack.js'); }));
16
- const ExpressCheckoutPurple = dynamic(()=>Promise.resolve().then(function () { return require('./icons/ExpressCheckoutPurple.js'); }));
17
- const ExpressCheckoutWhite = dynamic(()=>Promise.resolve().then(function () { return require('./icons/ExpressCheckoutWhite.js'); }));
18
- /**
19
- * The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
20
- */ const ShopPayButton = ({ className, setting, builderAttrs, style, styles })=>{
21
- const storefrontUrl = core.useShopStore((s)=>s.storefrontUrl);
22
- const storeUrl = ShopPayButtonCommon.getStoreUrl(storefrontUrl);
23
- const { data: cartData } = core.useCartData();
24
- const currentVariant = core.useCurrentVariant();
25
- const isCurrentVariantInStock = core.useCurrentVariantInStock();
26
- const { quantity } = core.useQuantity();
27
- const mode = core.useEditorMode();
28
- const idsInCart = React.useMemo(()=>{
29
- const items = cartData?.lineItems.map((v)=>({
30
- id: v.variantId,
31
- quantity: v.quantity
32
- }))?.reduce((prev, curr)=>{
33
- const bareId = ShopPayButtonCommon.getIdFromGid(curr?.id);
34
- if (bareId) {
35
- prev.push(`${bareId}:${curr?.quantity ?? 1}`);
36
- }
37
- return prev;
38
- }, []);
39
- return items;
40
- }, [
41
- cartData?.lineItems
42
- ]);
43
- const variants = React.useMemo(()=>{
44
- if (setting?.kind === 'cart-buy') {
45
- return idsInCart;
46
- }
47
- if (currentVariant?.baseID && isCurrentVariantInStock && quantity) {
48
- return [
49
- `${ShopPayButtonCommon.getIdFromGid(currentVariant.baseID)}:${quantity}`
50
- ];
51
- }
52
- return undefined;
53
- }, [
54
- setting?.kind,
55
- currentVariant?.baseID,
56
- isCurrentVariantInStock,
57
- quantity,
58
- idsInCart
59
- ]);
60
- const SPButton = React.useMemo(()=>{
61
- if (styles?.type === 'dynamic') {
62
- if (styles.color === 'black') return DynamicCheckoutBlack;
63
- if (styles.color === 'purple') return DynamicCheckoutPurple;
64
- return DynamicCheckoutWhite;
65
- } else {
66
- if (styles?.color === 'black') return ExpressCheckoutBlack;
67
- if (styles?.color === 'purple') return ExpressCheckoutPurple;
68
- return ExpressCheckoutWhite;
69
- }
70
- }, [
71
- styles?.type,
72
- styles?.color
73
- ]);
74
- if (!storeUrl) {
75
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
76
- ...builderAttrs,
77
- children: "URL Not Found"
78
- });
79
- }
80
- const payUrl = `${storeUrl}/cart/${variants?.join(',')}?payment=shop_pay`;
81
- const onClickPay = (w, h)=>{
82
- if (mode === 'edit') return;
83
- if (setting?.openMode === 'popup') {
84
- const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
85
- const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
86
- const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
87
- const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
88
- const systemZoom = width / window.screen.availWidth;
89
- const left = (width - w) / 2 / systemZoom + dualScreenLeft;
90
- const top = (height - h) / 2 / systemZoom + dualScreenTop;
91
- window.open(payUrl, 'shop_pay', `scrollbars=yes, width=${w / systemZoom}, height=${h / systemZoom}, top=${top}, left=${left}`);
92
- } else {
93
- !!payUrl && window.open(payUrl);
94
- }
95
- };
96
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
97
- ...builderAttrs,
98
- style: {
99
- ...style,
100
- ...core.makeStyleResponsive('jc', styles?.align)
101
- },
102
- className: core.cls(className, 'gp-flex'),
103
- children: /*#__PURE__*/ jsxRuntime.jsx("button", {
104
- disabled: !variants?.length,
105
- className: "disabled:gp-cursor-not-allowed disabled:gp-opacity-50",
106
- "aria-label": "Buy with Shop Pay",
107
- onClick: ()=>onClickPay(600, 600),
108
- children: /*#__PURE__*/ jsxRuntime.jsx(SPButton, {})
109
- })
110
- });
111
- };
112
-
113
- exports.default = ShopPayButton;
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@gem-sdk/core');
6
- var DynamicCheckoutBlack_liquid = require('./icons/DynamicCheckoutBlack.liquid.js');
7
- var DynamicCheckoutPurple_liquid = require('./icons/DynamicCheckoutPurple.liquid.js');
8
- var DynamicCheckoutWhite_liquid = require('./icons/DynamicCheckoutWhite.liquid.js');
9
- var ExpressCheckoutBlack_liquid = require('./icons/ExpressCheckoutBlack.liquid.js');
10
- var ExpressCheckoutPurple_liquid = require('./icons/ExpressCheckoutPurple.liquid.js');
11
- var ExpressCheckoutWhite_liquid = require('./icons/ExpressCheckoutWhite.liquid.js');
12
- var helpers = require('../../../helpers.js');
13
-
14
- /**
15
- * The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
16
- */ const ShopPayButton = ({ className, setting, builderAttrs, style, styles, advanced })=>{
17
- const SPButton = ()=>{
18
- if (styles?.type === 'dynamic') {
19
- if (styles.color === 'black') return DynamicCheckoutBlack_liquid.default;
20
- if (styles.color === 'purple') return DynamicCheckoutPurple_liquid.default;
21
- return DynamicCheckoutWhite_liquid.default;
22
- } else {
23
- if (styles?.color === 'black') return ExpressCheckoutBlack_liquid.default;
24
- if (styles?.color === 'purple') return ExpressCheckoutPurple_liquid.default;
25
- return ExpressCheckoutWhite_liquid.default;
26
- }
27
- };
28
- return core.template`
29
- <gp-shop-pay-button
30
- ${{
31
- ...builderAttrs
32
- }}
33
- style="${{
34
- ...style,
35
- ...core.makeStyleResponsive('jc', styles?.align)
36
- }}"
37
- class="${core.cls(className, 'gp-flex', advanced?.cssClass)}"
38
- gp-data='{"setting":${JSON.stringify(setting)}, "shop_url": "{{shop.url}}" }'
39
- >
40
- <button
41
- class="disabled:gp-cursor-not-allowed disabled:gp-pacity-50 gp-shop-button"
42
- aria-label="Buy with Shop Pay"
43
- >
44
- ${SPButton()({})}
45
- </button>
46
- </gp-shop-pay-button>
47
- ${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-shop-pay-button.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-shop-pay-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
48
- `;
49
- };
50
-
51
- exports.default = ShopPayButton;
@@ -1,250 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@gem-sdk/core');
6
- var helpers = require('../../helpers.js');
7
-
8
- const DynamicCheckout = ({ builderProps, styles, advanced, setting, pageContext })=>{
9
- const composeGlobalSize = {
10
- width: core.getWidthHeightGlobalSize('width', styles?.globalSize),
11
- height: core.getWidthHeightGlobalSize('height', styles?.globalSize),
12
- padding: core.getPaddingGlobalSize(styles?.globalSize)
13
- };
14
- const composeSize = (width, height, important = true)=>{
15
- return `
16
- ${width ? `width: ${width}${important ? '!important;' : ''};` : ''}
17
- ${height ? `height: ${height}${important ? '!important;' : ''};` : ''}
18
- `;
19
- };
20
- const composeSpacing = (device)=>{
21
- const suffix = device && device !== 'desktop' ? `-${device}` : '';
22
- const spacingDevice = {
23
- top: composeGlobalSize.padding[`--pt${suffix}`],
24
- bottom: composeGlobalSize.padding[`--pb${suffix}`],
25
- left: composeGlobalSize.padding[`--pl${suffix}`],
26
- right: composeGlobalSize.padding[`--pr${suffix}`]
27
- };
28
- return `padding-top: ${spacingDevice.top ? `${spacingDevice.top} !important;` : ''};
29
- padding-bottom: ${spacingDevice.bottom ? `${spacingDevice.bottom} !important;` : ''};
30
- padding-left: ${spacingDevice.left ? `${spacingDevice.left} !important;` : ''};
31
- padding-right: ${spacingDevice.right ? `${spacingDevice.right} !important;` : ''};
32
- `;
33
- };
34
- const composeFontSize = (fontSize)=>{
35
- return fontSize ? `font-size: ${fontSize} !important;` : '';
36
- };
37
- const composeLineHeight = (lineHeight)=>{
38
- return lineHeight ? `line-height: ${lineHeight} !important;` : '';
39
- };
40
- const composeTextAlign = (align)=>{
41
- return `${align ? `text-align: ${align} !important;` : ''}`;
42
- };
43
- const translatedLabel = helpers.getDynamicSourceLocales({
44
- val: setting?.label,
45
- uid: builderProps?.uid,
46
- settingId: 'label',
47
- pageContext,
48
- translate: setting?.translate
49
- });
50
- return core.template /* liquid */ `
51
- {%- liquid
52
- assign inventory_quantity = variant.inventory_quantity | default: 0
53
- assign supported_payment_methods = shop.enabled_payment_types
54
- -%}
55
- <gp-product-dynamic data-id="${builderProps?.uid}" data-translate-label="${translatedLabel}" class="${advanced?.cssClass}" gp-data='${JSON.stringify({
56
- setting: {
57
- label: setting?.label
58
- },
59
- totalVariant: '{{product.variants.size}}'
60
- }).replaceAll("'", '&#039;')}
61
- '>
62
- <div class="${core.cls('gp-block', `${'wrap__button--unbranded__' + builderProps?.uid}`, String.raw`[&_.shopify-payment-button\_\_button--unbranded]:gp-min-h-fit`, String.raw`disabled:[&_.shopify-payment-button\_\_button--unbranded]:gp-pointer-events-none`, styles?.typo?.type ? String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${core.genTypoClass(styles?.typo?.type)}` : '', styles?.btnSpacing?.type ? String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${core.genSizeClass(styles?.btnSpacing?.type)}` : '', core.getGlobalColorStateClassDynamicBtn('text', styles?.textColor))}">
63
- {{ form | payment_button }}
64
- </div>
65
- {% style %}
66
- .wrap__button--unbranded__${builderProps?.uid} {
67
- ${composeTextAlign(styles?.align?.desktop)}
68
- }
69
-
70
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button {
71
- display: inline-block;
72
- min-height: unset !important;
73
- ${composeSize(composeGlobalSize.width.desktop ?? 'auto', composeGlobalSize.height.desktop ?? 'auto', false)}
74
- }
75
-
76
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button div {
77
- width: 100%;
78
- margin-top: 0px !important;
79
- }
80
-
81
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__more-options {
82
- display: none;
83
- }
84
-
85
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded {
86
- max-width: 100%;
87
- min-width: unset;
88
- min-height: unset !important;
89
- background-color: unset !important;
90
- position: relative;
91
- border: none !important;
92
- margin: 0;
93
- z-index: 0;
94
- border-radius: unset;
95
- width: 100%;
96
- display: inline-flex;
97
- justify-content: center;
98
- align-items: center;
99
- ${core.composeTypographyV2Css(styles?.typo, true)}
100
- ${core.composeShadowCss({
101
- boxShadowValue: styles?.boxShadowBtnV2?.desktop?.normal,
102
- hasBoxShadow: styles?.boxShadowBtnV2?.desktop?.normal?.type !== 'none'
103
- })}
104
- ${composeSpacing('desktop')}
105
- ${core.composeCornerCss(styles?.roundedBtnV2?.desktop?.normal, true)}
106
- ${composeSize(undefined, composeGlobalSize.height.desktop ?? 'auto', false)}
107
- }
108
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
109
- content: "";
110
- height: 100%;
111
- width: 100%;
112
- position: absolute;
113
- top: 0;
114
- left: 0;
115
- pointer-events: none;
116
- z-index: -1;
117
- ${core.composeBorderCss(styles?.borderBtnV2?.desktop?.normal)}
118
- ${core.composeCornerCss(styles?.roundedBtnV2?.desktop?.normal)}
119
- ${core.composeBackgroundCss(styles?.backgroundColorV2?.desktop?.normal)}
120
- ${core.composeBackgroundImageCss(styles?.backgroundImage, {
121
- device: 'desktop',
122
- state: 'normal'
123
- })}
124
- }
125
-
126
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover {
127
- ${core.composeShadowCss({
128
- boxShadowValue: styles?.boxShadowBtnV2?.desktop?.hover,
129
- hasBoxShadow: styles?.boxShadowBtnV2?.desktop?.hover?.type !== 'none',
130
- important: true
131
- })}
132
- ${core.composeTextHoverColorCss('desktop', styles?.textColorHover, true)}
133
- }
134
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover::before {
135
- ${core.composeBorderCss(styles?.borderBtnV2?.desktop?.hover)}
136
- ${core.composeCornerCss(styles?.roundedBtnV2?.desktop?.hover)}
137
- ${core.composeBackgroundCss(styles?.backgroundColorV2?.desktop?.hover)}
138
- }
139
-
140
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded::after {
141
- border-radius: 0;
142
- box-shadow: none;
143
- }
144
-
145
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded::after:hover {
146
- border-radius: 0;
147
- box-shadow: none;
148
- }
149
-
150
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button > div {
151
- max-width: 100%;
152
- }
153
-
154
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button > div > div {
155
- max-width: 100%;
156
- }
157
-
158
- @media only screen and (max-width: 1024px) and (min-width: 768px) {
159
- .wrap__button--unbranded__${builderProps?.uid} {
160
- ${composeTextAlign(styles?.align?.tablet)}
161
- }
162
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button {
163
- ${composeSize(composeGlobalSize.width.tablet, composeGlobalSize.height.tablet)}
164
- }
165
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover {
166
- ${core.composeShadowCss({
167
- boxShadowValue: styles?.boxShadowBtnV2?.tablet?.hover,
168
- hasBoxShadow: styles?.boxShadowBtnV2?.tablet?.hover?.type !== 'none',
169
- important: true
170
- })}
171
- ${core.composeTextHoverColorCss('tablet', styles?.textColorHover, true)}
172
- }
173
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded {
174
- width: 100%;
175
-
176
- ${composeSpacing('tablet')}
177
- ${composeLineHeight(styles?.typo?.custom?.lineHeight?.tablet)}
178
- ${composeFontSize(styles?.typo?.custom?.fontSize?.tablet)}
179
- ${composeSize(composeGlobalSize.width.tablet ?? 'auto', composeGlobalSize.height.tablet ?? 'auto', false)}
180
- ${core.composeShadowCss({
181
- boxShadowValue: styles?.boxShadowBtnV2?.tablet?.normal,
182
- hasBoxShadow: styles?.boxShadowBtnV2?.tablet?.normal?.type !== 'none'
183
- })}
184
- ${core.composeCornerCss(styles?.roundedBtnV2?.tablet?.normal, true)}
185
- }
186
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover::before {
187
- ${core.composeBorderCss(styles?.borderBtnV2?.tablet?.hover)}
188
- ${core.composeCornerCss(styles?.roundedBtnV2?.tablet?.hover)}
189
- ${core.composeBackgroundCss(styles?.backgroundColorV2?.tablet?.hover)}
190
- }
191
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
192
- ${core.composeBorderCss(styles?.borderBtnV2?.tablet?.normal)}
193
- ${core.composeCornerCss(styles?.roundedBtnV2?.tablet?.normal)}
194
- ${core.composeBackgroundImageCss(styles?.backgroundImage, {
195
- device: 'tablet',
196
- state: 'normal'
197
- })}
198
- }
199
- }
200
-
201
- @media only screen and (max-width: 767px) {
202
- .wrap__button--unbranded__${builderProps?.uid} {
203
- ${composeTextAlign(styles?.align?.mobile)}
204
- }
205
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button {
206
- ${composeSize(composeGlobalSize.width.mobile, composeGlobalSize.height.mobile)}
207
- }
208
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover {
209
- ${core.composeShadowCss({
210
- boxShadowValue: styles?.boxShadowBtnV2?.mobile?.hover,
211
- hasBoxShadow: styles?.boxShadowBtnV2?.mobile?.hover?.type !== 'none',
212
- important: true
213
- })}
214
- ${core.composeTextHoverColorCss('mobile', styles?.textColorHover, true)}
215
- }
216
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded {
217
- width: 100%;
218
- ${composeSpacing('mobile')}
219
- ${composeLineHeight(styles?.typo?.custom?.lineHeight?.mobile)}
220
- ${composeFontSize(styles?.typo?.custom?.fontSize?.mobile)}
221
- ${composeSize(composeGlobalSize.width.mobile ?? 'auto', composeGlobalSize.height.mobile ?? 'auto', false)}
222
- ${core.composeShadowCss({
223
- boxShadowValue: styles?.boxShadowBtnV2?.mobile?.normal,
224
- hasBoxShadow: styles?.boxShadowBtnV2?.mobile?.normal?.type !== 'none'
225
- })}
226
- ${core.composeCornerCss(styles?.roundedBtnV2?.mobile?.normal, true)}
227
- }
228
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover::before {
229
- ${core.composeBorderCss(styles?.borderBtnV2?.mobile?.hover)}
230
- ${core.composeCornerCss(styles?.roundedBtnV2?.mobile?.hover)}
231
- ${core.composeBackgroundCss(styles?.backgroundColorV2?.mobile?.hover)}
232
- }
233
- .wrap__button--unbranded__${builderProps?.uid} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
234
- ${core.composeBorderCss(styles?.borderBtnV2?.mobile?.normal)}
235
- ${core.composeCornerCss(styles?.roundedBtnV2?.mobile?.normal)}
236
- ${core.composeBackgroundImageCss(styles?.backgroundImage, {
237
- device: 'mobile',
238
- state: 'normal'
239
- })}
240
- ${core.composeBackgroundCss(styles?.backgroundColorV2?.mobile?.normal)}
241
- }
242
- }
243
-
244
- {% endstyle %}
245
- </gp-product-dynamic>
246
- ${core.RenderIf(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>`)}
247
- `;
248
- };
249
-
250
- exports.default = DynamicCheckout;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- const DESCRIPTION_LINE_HEIGHT_DEFAULT = 21;
4
-
5
- exports.DESCRIPTION_LINE_HEIGHT_DEFAULT = DESCRIPTION_LINE_HEIGHT_DEFAULT;
@@ -1,172 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var core = require('@gem-sdk/core');
8
- var React = require('react');
9
- var NoDataState = require('../../common/components/NoDataState.js');
10
- var common = require('./ProductDescription/common.js');
11
- var _const = require('./ProductDescription/const.js');
12
-
13
- const ProductDescription = ({ setting, builderProps })=>{
14
- const [open, setOpen] = React.useState(false);
15
- const [isShowViewMore, allowShowViewMore] = React.useState(false);
16
- const product = core.useProduct();
17
- const { htmlTag } = setting ?? {};
18
- const ref = React.useRef(null);
19
- const currentDevice = core.useCurrentDevice();
20
- const hasLineClamp = core.getResponsiveValueByScreen(setting?.hasLineClamp, currentDevice);
21
- const lineClamp = core.getResponsiveValueByScreen(setting?.lineClamp, currentDevice);
22
- const { redirectProductShopifyLink } = core.useProductShopifyEditLink();
23
- const mode = core.useEditorMode();
24
- const isSafari = core.isBrowser() ? navigator?.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 : false;
25
- React.useEffect(()=>{
26
- const dom = ref.current;
27
- setOpen(false);
28
- if (!dom) return;
29
- const enableShowMore = hasLineClamp && product?.descriptionHtml;
30
- if (!enableShowMore) dom.style.maxHeight = 'none';
31
- else {
32
- const value = lineClamp;
33
- setTimeout(()=>{
34
- const scrollHeight = dom?.scrollHeight ?? 0;
35
- const clientHeight = dom?.clientHeight ?? 0;
36
- const lineHeight = getLineHeightFromDom();
37
- const lineText = Math.round((scrollHeight ?? 0) / lineHeight);
38
- dom.style.maxHeight = getMaxHeight(lineHeight);
39
- const conditionCheckLine = value && value < lineText || clientHeight < scrollHeight;
40
- if (value && conditionCheckLine) {
41
- allowShowViewMore(()=>true);
42
- } else {
43
- allowShowViewMore(()=>false);
44
- }
45
- }, 100);
46
- }
47
- }, [
48
- hasLineClamp,
49
- lineClamp,
50
- product?.description,
51
- isSafari
52
- ]);
53
- const getLineHeightFromDom = ()=>{
54
- if (!ref.current) return _const.DESCRIPTION_LINE_HEIGHT_DEFAULT;
55
- const lineHeight = window.getComputedStyle(ref.current).getPropertyValue('line-height');
56
- return parseInt(lineHeight);
57
- };
58
- const getMaxHeight = (lineHeight)=>{
59
- if (!hasLineClamp || !lineClamp) return 'auto';
60
- if (lineHeight) return `${lineClamp * lineHeight}px`;
61
- return 'auto';
62
- };
63
- const Tag = htmlTag === 'html' ? 'div' : 'p';
64
- const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
65
- const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
66
- const css = `
67
- .gp-p-description-text > *:not(ol):not(ul):not(table):not(div):not(style):not(script) {
68
- display: inline !important;
69
- }
70
- .gp-p-description-text > *:not(ol):not(ul):not(table):not(div):not(style):not(script)::after {
71
- content: "\\A";
72
- white-space: pre;
73
- }
74
- .gp-p-description-text > table {
75
- box-shadow: none;
76
- }
77
- `;
78
- const noDescriptionHtml = !product?.descriptionHtml;
79
- if (noDescriptionHtml && mode === 'edit') {
80
- return /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
81
- elementType: "secondary",
82
- description: "Highlight key benefits with product description.",
83
- descriptionActions: [
84
- {
85
- text: 'Add description',
86
- callback: redirectProductShopifyLink
87
- },
88
- {
89
- text: 'sync data',
90
- callback: 'syncProduct'
91
- }
92
- ]
93
- });
94
- }
95
- const handleToggleShowMore = ()=>{
96
- if (!ref.current) return;
97
- const lineHeight = getLineHeightFromDom();
98
- if (open) {
99
- ref.current.style.maxHeight = getMaxHeight(lineHeight);
100
- } else {
101
- ref.current.style.maxHeight = 'none';
102
- }
103
- setOpen((prev)=>!prev);
104
- };
105
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
106
- children: noDescriptionHtml ? null : /*#__PURE__*/ jsxRuntime.jsxs("div", {
107
- "data-id": builderProps?.uid,
108
- children: [
109
- !isSafari && /*#__PURE__*/ jsxRuntime.jsx("style", {
110
- type: "text/css",
111
- dangerouslySetInnerHTML: {
112
- __html: css
113
- }
114
- }),
115
- /*#__PURE__*/ jsxRuntime.jsx(Tag, {
116
- ref: ref,
117
- "data-gp-text": true,
118
- className: core.cls('gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre', appendTypoClass, core.getGlobalColorClass('text', setting?.color)),
119
- style: {
120
- ...core.getStyleShadow({
121
- value: setting?.typo?.custom?.textShadow,
122
- styleAppliedFor: 'text-shadow',
123
- isEnableShadow: setting?.typo?.custom?.textShadow?.type !== 'none'
124
- }),
125
- ...core.makeStyleResponsive('ta', setting?.textAlign),
126
- ...hasLineClamp && !open ? core.makeStyleResponsive('line-clamp', setting?.lineClamp) : {},
127
- ...core.makeStyle({
128
- tt: setting?.transform
129
- }),
130
- ...appendTypoStyle,
131
- ...common.getMaxHeightStyleDefault(setting)
132
- },
133
- dangerouslySetInnerHTML: {
134
- __html: product?.descriptionHtml || ''
135
- }
136
- }),
137
- hasLineClamp && isShowViewMore && /*#__PURE__*/ jsxRuntime.jsxs("button", {
138
- className: core.cls(appendTypoClass, core.getGlobalColorClass('text', setting?.showMoreColor), 'gp-mt-4 gp-w-full gp-transition-all hover:gp-opacity-80'),
139
- style: {
140
- ...core.makeStyleResponsive('ta', setting?.textAlign),
141
- ...core.makeStyle({
142
- tt: setting?.transform
143
- }),
144
- ...appendTypoStyle,
145
- ...core.getGlobalColorStyle(setting?.showMoreColor)
146
- },
147
- onClick: handleToggleShowMore,
148
- children: [
149
- !open ? setting?.viewMoreText : setting?.viewLessText,
150
- setting?.enableViewMoreIcon && /*#__PURE__*/ jsxRuntime.jsx("svg", {
151
- className: "gp-ml-1 gp-inline-block",
152
- height: "1em",
153
- width: "1em",
154
- viewBox: "0 0 22 12",
155
- fill: "none",
156
- xmlns: "http://www.w3.org/2000/svg",
157
- children: !open ? /*#__PURE__*/ jsxRuntime.jsx("path", {
158
- 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",
159
- fill: "currentColor"
160
- }) : /*#__PURE__*/ jsxRuntime.jsx("path", {
161
- d: "M0.292893 10.2929C-0.0976311 10.6834 -0.0976311 11.3166 0.292893 11.7071C0.683417 12.0976 1.31658 12.0976 1.70711 11.7071L0.292893 10.2929ZM11 1L11.7071 0.292893C11.3166 -0.0976311 10.6834 -0.0976311 10.2929 0.292893L11 1ZM20.2929 11.7071C20.6834 12.0976 21.3166 12.0976 21.7071 11.7071C22.0976 11.3166 22.0976 10.6834 21.7071 10.2929L20.2929 11.7071ZM1.70711 11.7071L11.7071 1.70711L10.2929 0.292893L0.292893 10.2929L1.70711 11.7071ZM10.2929 1.70711L20.2929 11.7071L21.7071 10.2929L11.7071 0.292893L10.2929 1.70711Z",
162
- fill: "currentColor"
163
- })
164
- })
165
- ]
166
- })
167
- ]
168
- })
169
- });
170
- };
171
-
172
- exports.default = ProductDescription;