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

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 (76) 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/builder.js +14 -14
  4. package/dist/cjs/form/setting/submit-button/configs/settings.js +2 -2
  5. package/dist/cjs/grid/col/Col.liquid.js +2 -2
  6. package/dist/cjs/grid/row/Row.js +2 -2
  7. package/dist/cjs/grid/row/Row.liquid.js +1 -2
  8. package/dist/cjs/grid/row/commons/getStyle.js +6 -6
  9. package/dist/cjs/index.js +84 -84
  10. package/dist/cjs/index.liquid.js +8 -8
  11. package/dist/cjs/marquee/setting/configs/childImageTemplate.js +1 -1
  12. package/dist/cjs/post-purchase/advanced-list/components/common/getClasses.js +1 -1
  13. package/dist/cjs/post-purchase/advanced-list/setting/configs/presets.js +3 -1
  14. package/dist/cjs/post-purchase/advanced-list/setting/configs/settings.js +2 -1
  15. package/dist/cjs/post-purchase/advanced-list/setting/template.js +8 -3
  16. package/dist/cjs/post-purchase/callout-banner/components/common/getStyles.js +2 -0
  17. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-box/setting.js +10 -10
  18. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +1 -12
  19. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
  20. package/dist/cjs/post-purchase/image/setting/Image.js +2 -2
  21. package/dist/cjs/post-purchase/image/setting/setting-v2.js +25 -13
  22. package/dist/cjs/post-purchase/image/setting/ui-v2.js +1 -1
  23. package/dist/cjs/post-purchase/link/setting/configs/settings.js +7 -2
  24. package/dist/cjs/post-purchase/product/components/ProductPriceBreakdown.js +14 -5
  25. package/dist/cjs/post-purchase/product/components/priceBreakdown/MoneyLine.js +9 -4
  26. package/dist/cjs/post-purchase/product/helpers/product-price-breakdown/getClasses.js +29 -1
  27. package/dist/cjs/post-purchase/product/settings/product-price/uiV2.js +3 -0
  28. package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +3 -3
  29. package/dist/cjs/post-purchase/product/settings/product-variants/configs/uiV2.js +4 -2
  30. package/dist/cjs/post-purchase/utils/constants.js +1 -1
  31. package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +4 -4
  32. package/dist/cjs/product/components/ProductTitle/common/gpCommon.js +17 -0
  33. package/dist/cjs/product/components/ProductTitle/index.js +49 -0
  34. package/dist/cjs/product/components/ProductTitle/index.liquid.js +30 -0
  35. package/dist/cjs/product/next.js +1 -1
  36. package/dist/esm/article/components/ArticleImage.js +0 -5
  37. package/dist/esm/article/components/ArticleList.js +1 -1
  38. package/dist/esm/builder.js +1 -1
  39. package/dist/esm/form/setting/submit-button/configs/settings.js +2 -2
  40. package/dist/esm/grid/col/Col.liquid.js +2 -2
  41. package/dist/esm/grid/row/Row.js +2 -2
  42. package/dist/esm/grid/row/Row.liquid.js +1 -2
  43. package/dist/esm/grid/row/commons/getStyle.js +7 -7
  44. package/dist/esm/index.js +1 -1
  45. package/dist/esm/index.liquid.js +1 -1
  46. package/dist/esm/marquee/setting/configs/childImageTemplate.js +1 -1
  47. package/dist/esm/post-purchase/advanced-list/components/common/getClasses.js +1 -1
  48. package/dist/esm/post-purchase/advanced-list/setting/configs/presets.js +3 -1
  49. package/dist/esm/post-purchase/advanced-list/setting/configs/settings.js +2 -1
  50. package/dist/esm/post-purchase/advanced-list/setting/template.js +8 -3
  51. package/dist/esm/post-purchase/callout-banner/components/common/getStyles.js +2 -0
  52. package/dist/esm/post-purchase/callout-banner/setting/config/callout-box/setting.js +10 -10
  53. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +1 -12
  54. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
  55. package/dist/esm/post-purchase/image/setting/Image.js +2 -2
  56. package/dist/esm/post-purchase/image/setting/setting-v2.js +25 -13
  57. package/dist/esm/post-purchase/image/setting/ui-v2.js +1 -1
  58. package/dist/esm/post-purchase/link/setting/configs/settings.js +7 -2
  59. package/dist/esm/post-purchase/product/components/ProductPriceBreakdown.js +14 -5
  60. package/dist/esm/post-purchase/product/components/priceBreakdown/MoneyLine.js +9 -4
  61. package/dist/esm/post-purchase/product/helpers/product-price-breakdown/getClasses.js +27 -2
  62. package/dist/esm/post-purchase/product/settings/product-price/uiV2.js +3 -0
  63. package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +3 -3
  64. package/dist/esm/post-purchase/product/settings/product-variants/configs/uiV2.js +4 -2
  65. package/dist/esm/post-purchase/utils/constants.js +1 -1
  66. package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +1 -1
  67. package/dist/esm/product/components/ProductTitle/common/gpCommon.js +15 -0
  68. package/dist/esm/product/components/ProductTitle/index.js +45 -0
  69. package/dist/esm/product/components/ProductTitle/index.liquid.js +26 -0
  70. package/dist/esm/product/next.js +1 -1
  71. package/dist/types/index.d.ts +8 -3
  72. package/package.json +1 -1
  73. package/dist/cjs/product/components/ProductTitle.js +0 -43
  74. package/dist/cjs/product/components/ProductTitle.liquid.js +0 -44
  75. package/dist/esm/product/components/ProductTitle.js +0 -39
  76. package/dist/esm/product/components/ProductTitle.liquid.js +0 -40
@@ -34,14 +34,19 @@ const PostPurchaseLinkSettings = [
34
34
  },
35
35
  displayOptions: [
36
36
  {
37
- label: 'Full',
38
- value: '100%',
37
+ label: 'Fit content',
38
+ value: 'Auto',
39
39
  showValue: true
40
40
  },
41
41
  {
42
42
  label: 'Default',
43
43
  value: '1200px',
44
44
  showValue: true
45
+ },
46
+ {
47
+ label: 'Full',
48
+ value: '100%',
49
+ showValue: true
45
50
  }
46
51
  ]
47
52
  }
@@ -9,6 +9,7 @@ import { useGetItemGapPriceBreakdown } from '../hooks/product-price-breakdown/us
9
9
  import { useSetCollapsePrice } from '../hooks/product-price-breakdown/useSetCollapsePrice.js';
10
10
  import MoneyLine from './priceBreakdown/MoneyLine.js';
11
11
  import { useGetMoneyLines } from '../hooks/product-price-breakdown/useGetMoneyLines.js';
12
+ import Text from '../../text/components/Text.js';
12
13
 
13
14
  const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
14
15
  const { labelStyle, moneyStyle, spacing, width, align, isShowPrice, direction } = styles;
@@ -25,7 +26,7 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
25
26
  });
26
27
  const iconCollapseClasses = createClass(getIconCollapseClassesRotate(isCollapsePrice));
27
28
  const containerPriceBreakdownClasses = createClass(getContainerPriceBreakdownClasses(align, builderProps?.uid));
28
- const wrapperLabelClasses = createClass(getWrapperLabelClasses());
29
+ const wrapperLabelClasses = createClass(getWrapperLabelClasses(direction));
29
30
  const labelClasses = createClass(getLabelClasses());
30
31
  const dividerClasses = createClass(getDividerClasses());
31
32
  const wrapperMoneyLinesClasses = createClass(getWrapperMoneyLinesClasses());
@@ -42,9 +43,17 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
42
43
  tabIndex: 0,
43
44
  "aria-hidden": "true",
44
45
  children: [
45
- /*#__PURE__*/ jsx("p", {
46
+ /*#__PURE__*/ jsx(Text, {
46
47
  className: labelClasses,
47
- children: isCollapsePrice ? setting.contentHide || 'Hide price breakdown' : setting.contentShow || 'Show price breakdown'
48
+ styles: {
49
+ direction
50
+ },
51
+ setting: {
52
+ text: isCollapsePrice ? setting.contentHide || 'Hide price breakdown' : setting.contentShow || 'Show price breakdown',
53
+ options: {
54
+ isCannotEditing: true
55
+ }
56
+ }
48
57
  }),
49
58
  /*#__PURE__*/ jsx("svg", {
50
59
  width: "17",
@@ -83,6 +92,7 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
83
92
  /*#__PURE__*/ jsx("div", {
84
93
  children: /*#__PURE__*/ jsx(MoneyLine, {
85
94
  uniqueId: item.uniqueId,
95
+ direction: direction,
86
96
  builderPropsUID: builderProps?.uid,
87
97
  title: item.uniqueId === 'totalLabel' ? `<b>${item.title}</b>` : item.title,
88
98
  money: item.money,
@@ -94,8 +104,7 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
94
104
  direction
95
105
  },
96
106
  moneyTextStyles: {
97
- typo: moneyStyle,
98
- direction
107
+ typo: moneyStyle
99
108
  }
100
109
  })
101
110
  }, item.uniqueId)
@@ -3,15 +3,20 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useProduct } from '@gem-sdk/core';
4
4
  import Tooltip from '../../../../common/components/Tooltip.js';
5
5
  import Text from '../../../text/components/Text.js';
6
+ import { createClass } from '@gem-sdk/system';
7
+ import { getMoneyRowClasses, getTextLabelMoneyClasses, getTextValueMoneyClasses } from '../../helpers/product-price-breakdown/getClasses.js';
6
8
 
7
- const MoneyLine = ({ uniqueId, title, money, labelTextStyles, moneyTextStyles, builderPropsUID, tooltipData })=>{
9
+ const MoneyLine = ({ uniqueId, title, money, labelTextStyles, moneyTextStyles, builderPropsUID, tooltipData, direction })=>{
8
10
  const currentProduct = useProduct();
9
11
  const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
12
+ const moneyRowClasses = createClass(getMoneyRowClasses(direction));
13
+ const textLabelMoneyClasses = createClass(getTextLabelMoneyClasses(direction));
14
+ const textValueMoneyClasses = createClass(getTextValueMoneyClasses(direction));
10
15
  return /*#__PURE__*/ jsxs("div", {
11
- className: "gp-flex gp-w-full gp-justify-between",
16
+ className: moneyRowClasses,
12
17
  children: [
13
18
  /*#__PURE__*/ jsx(Text, {
14
- className: "gp-w-3/5",
19
+ className: textLabelMoneyClasses,
15
20
  setting: {
16
21
  text: title,
17
22
  options: {
@@ -23,7 +28,7 @@ const MoneyLine = ({ uniqueId, title, money, labelTextStyles, moneyTextStyles, b
23
28
  styles: labelTextStyles
24
29
  }),
25
30
  !tooltipData ? /*#__PURE__*/ jsx(Text, {
26
- className: "gp-w-2/5 gp-text-end",
31
+ className: textValueMoneyClasses,
27
32
  setting: {
28
33
  text: money,
29
34
  options: {
@@ -1,6 +1,9 @@
1
1
  import { composeClasses } from '@gem-sdk/core';
2
2
 
3
- const getWrapperLabelClasses = ()=>composeClasses('gp-flex gp-text-[#1879B9] gp-h-4.5 gp-cursor-pointer');
3
+ const getWrapperLabelClasses = (direction)=>({
4
+ ...composeClasses('gp-flex gp-text-[#1879B9] gp-h-4.5 gp-cursor-pointer'),
5
+ 'gp-justify-end': direction === 'rtl'
6
+ });
4
7
  const getIconCollapseClassesRotate = (isCollapsePrice)=>{
5
8
  return composeClasses(!isCollapsePrice ? 'gp-rotate-180' : '');
6
9
  };
@@ -20,5 +23,27 @@ const getContainerPriceBreakdownClasses = (align, uid)=>{
20
23
  };
21
24
  };
22
25
  const getWrapperBreakdownClasses = ()=>composeClasses('gp-col-[1] gp-row-[1]');
26
+ const getMoneyRowClasses = (direction)=>{
27
+ const classList = 'gp-flex gp-w-full gp-justify-between';
28
+ return {
29
+ ...composeClasses(classList),
30
+ 'gp-flex-row-reverse': direction === 'rtl'
31
+ };
32
+ };
33
+ const getTextLabelMoneyClasses = (direction)=>{
34
+ const classList = 'gp-w-3/5';
35
+ return {
36
+ ...composeClasses(classList),
37
+ 'gp-text-end': direction === 'rtl'
38
+ };
39
+ };
40
+ const getTextValueMoneyClasses = (direction)=>{
41
+ const classList = 'gp-w-2/5';
42
+ return {
43
+ ...composeClasses(classList),
44
+ 'gp-text-start': direction === 'rtl',
45
+ 'gp-text-end': direction !== 'rtl'
46
+ };
47
+ };
23
48
 
24
- export { getContainerPriceBreakdownClasses, getDividerClasses, getIconCollapseClassesRotate, getLabelClasses, getWrapperBreakdownClasses, getWrapperLabelClasses, getWrapperMoneyLinesClasses };
49
+ export { getContainerPriceBreakdownClasses, getDividerClasses, getIconCollapseClassesRotate, getLabelClasses, getMoneyRowClasses, getTextLabelMoneyClasses, getTextValueMoneyClasses, getWrapperBreakdownClasses, getWrapperLabelClasses, getWrapperMoneyLinesClasses };
@@ -6,6 +6,9 @@ const uiV2 = [
6
6
  label: {
7
7
  en: 'Type'
8
8
  },
9
+ options: {
10
+ labelVariant: 'primary'
11
+ },
9
12
  setting: {
10
13
  id: 'priceType'
11
14
  }
@@ -26,7 +26,7 @@ const SettingUIV2 = [
26
26
  iconName: 'polaris-text-block',
27
27
  compoDefaultValue: 'Show',
28
28
  getValueFromSettingID: 'contentShow',
29
- disableClearMessage: `This label title is needed for customers <br> to show the price breakdown`,
29
+ disableClearMessage: `This content is needed for customers <br> to show the price breakdown`,
30
30
  layout: 'horizontal',
31
31
  controls: [
32
32
  {
@@ -51,7 +51,7 @@ const SettingUIV2 = [
51
51
  type: 'combo',
52
52
  iconName: 'polaris-text-block',
53
53
  getValueFromSettingID: 'contentHide',
54
- disableClearMessage: `This label title is needed for customers <br> to hide the price breakdown`,
54
+ disableClearMessage: `This content is needed for customers <br> to hide the price breakdown`,
55
55
  layout: 'horizontal',
56
56
  controls: [
57
57
  {
@@ -210,7 +210,7 @@ const SettingUIV2 = [
210
210
  setting: {
211
211
  id: 'align'
212
212
  },
213
- conditionEnable: '!(parseInt(width) == 100 && width?.includes("%"))',
213
+ conditionEnable: '!(parseInt(width) >= 100 && width?.includes("%"))',
214
214
  options: {
215
215
  labelVariant: 'primary',
216
216
  fullWidth: true,
@@ -146,7 +146,6 @@ const ProductVariantsSettingUIV2 = [
146
146
  ]
147
147
  },
148
148
  {
149
- conditionDisplay: "width !== '100%'",
150
149
  controls: [
151
150
  {
152
151
  label: {
@@ -155,8 +154,11 @@ const ProductVariantsSettingUIV2 = [
155
154
  setting: {
156
155
  id: 'align'
157
156
  },
157
+ conditionEnable: '!(parseInt(width) == 100 && width?.includes("%"))',
158
158
  options: {
159
- labelVariant: 'primary'
159
+ labelVariant: 'primary',
160
+ fullWidth: true,
161
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
160
162
  }
161
163
  }
162
164
  ]
@@ -13,7 +13,7 @@ const postPurchaseSpacing = [
13
13
  },
14
14
  {
15
15
  label: 'Default',
16
- value: 'none',
16
+ value: undefined,
17
17
  displayValue: '14px',
18
18
  showValue: true
19
19
  },
@@ -11,7 +11,7 @@ import ProductPrice from '../ProductPrice.js';
11
11
  import ProductQuantity from '../ProductQuantity.js';
12
12
  import ProductVariants from '../ProductVariants/index.js';
13
13
  import ProductImages from '../ProductImages.js';
14
- import ProductTitle from '../ProductTitle.js';
14
+ import ProductTitle from '../ProductTitle/index.js';
15
15
 
16
16
  const ModalContent = ()=>{
17
17
  const product = useProduct();
@@ -0,0 +1,15 @@
1
+ const getTextProps = (props, productTitle)=>{
2
+ const { setting, builderProps, styles, advanced } = props;
3
+ return {
4
+ builderProps,
5
+ styles,
6
+ setting: {
7
+ ...setting,
8
+ text: productTitle ? productTitle : '{{ product.title }}',
9
+ excludeFlex: true
10
+ },
11
+ advanced
12
+ };
13
+ };
14
+
15
+ export { getTextProps };
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import Link from 'next/link';
4
+ import { useProduct, useEditorMode } from '@gem-sdk/core';
5
+ import { urlJoin } from '../../../link/helpers/url-join.js';
6
+ import Text from '../../../text/components/Text.js';
7
+ import { createClass, createAttr, Unless, If } from '@gem-sdk/system';
8
+ import { getTextProps } from './common/gpCommon.js';
9
+
10
+ const ProductTitle = (props)=>{
11
+ const { setting, builderProps } = props;
12
+ const product = useProduct();
13
+ const destination = product?.handle ? urlJoin('/products', product.handle) : '#';
14
+ const currentProductId = product?.baseID?.replace('gid://shopify/Product/', '');
15
+ const mode = useEditorMode();
16
+ const renderText = ()=>{
17
+ return /*#__PURE__*/ jsx(Text, {
18
+ ...getTextProps(props, product?.title)
19
+ });
20
+ };
21
+ const linkAttrs = {
22
+ href: destination,
23
+ title: product?.title
24
+ };
25
+ const isEnableLink = setting?.linkProduct;
26
+ const linkClassName = createClass({
27
+ 'gp-product-title-link-wrapper': true
28
+ });
29
+ const editorAttrs = createAttr({
30
+ id: `shopify-text-element-${builderProps?.uid}`,
31
+ ...currentProductId && {
32
+ 'data-product-id': currentProductId
33
+ }
34
+ });
35
+ return /*#__PURE__*/ jsx("div", {
36
+ ...mode === 'edit' && editorAttrs,
37
+ children: Unless(!!product, '', If(isEnableLink, /*#__PURE__*/ jsx(Link, {
38
+ ...linkAttrs,
39
+ className: linkClassName,
40
+ children: renderText()
41
+ }), renderText()))
42
+ });
43
+ };
44
+
45
+ export { ProductTitle as default };
@@ -0,0 +1,26 @@
1
+ import { template } from '@gem-sdk/core';
2
+ import { getStaticLocale } from '../../../helpers.js';
3
+ import Text from '../../../text/components/Text.liquid.js';
4
+ import { createClass, LiquidUnless, If } from '@gem-sdk/system';
5
+ import { getTextProps } from './common/gpCommon.js';
6
+
7
+ const ProductTitle = (props)=>{
8
+ const { setting } = props;
9
+ const noProduct = `<p>${getStaticLocale('ProductTitle', 'product_not_found')}</p>`;
10
+ const renderText = ()=>{
11
+ return Text(getTextProps(props));
12
+ };
13
+ const linkAttrs = {
14
+ href: '{{ product.url }}',
15
+ title: '{{ product.title }}'
16
+ };
17
+ const isEnableLink = setting?.linkProduct;
18
+ const linkClassName = createClass({
19
+ 'gp-product-title-link-wrapper': true
20
+ });
21
+ return LiquidUnless('product', `${noProduct}`, If(isEnableLink, template`<a ${linkAttrs} class="${linkClassName}">
22
+ ${renderText()}
23
+ </a>`, `${renderText()}`));
24
+ };
25
+
26
+ export { ProductTitle as default };
@@ -7,7 +7,7 @@ import '@gem-sdk/core';
7
7
  const Product = dynamic(()=>import('./components/Product.js'), {
8
8
  loading: Loading
9
9
  });
10
- const ProductTitle = dynamic(()=>import('./components/ProductTitle.js'), {
10
+ const ProductTitle = dynamic(()=>import('./components/ProductTitle/index.js'), {
11
11
  loading: Loading
12
12
  });
13
13
  const ProductQuantity = dynamic(()=>import('./components/ProductQuantity.js'), {
@@ -614,6 +614,11 @@ type ColProps = BasePropsWrap<{
614
614
  }> & React.ComponentPropsWithoutRef<'div'> & {
615
615
  justifyContent?: ObjectDevices<Property.JustifyContent>;
616
616
  order?: ObjectDevices<number>;
617
+ className?: string;
618
+ children?: any;
619
+ layout?: ObjectDevices<ObjectLayoutValue>;
620
+ parentTag?: string;
621
+ rawChildren?: any[];
617
622
  } & {
618
623
  advanced?: any;
619
624
  };
@@ -4919,7 +4924,7 @@ type VariantPreset = {
4919
4924
 
4920
4925
  declare const PostPurchaseProductVariants: React.FC<PostPurchaseProductVariantsProps>;
4921
4926
 
4922
- type TStatus = 'info' | 'success' | 'warning' | 'critical';
4927
+ type TStatus = 'info' | 'success' | 'warning' | 'critical' | 'none';
4923
4928
  type CalloutBoxProps = RowProps & {
4924
4929
  styles: {
4925
4930
  backgroundColor: TStatus | '';
@@ -5686,7 +5691,7 @@ declare const Coupon: ({ setting, builderProps, builderAttrs, style, styles, adv
5686
5691
  pageContext?: PageContext | undefined;
5687
5692
  }) => string;
5688
5693
 
5689
- declare const Column: ({ children, className, style, builderAttrs, builderProps, advanced, setting, styles, justifyContent, order, ...props }: ColProps) => string;
5694
+ declare const Column: (props: ColProps) => string;
5690
5695
 
5691
5696
  declare const Row: (props: RowProps) => string;
5692
5697
 
@@ -5792,7 +5797,7 @@ declare const Product: ({ children, setting, styles, style, builderProps, rawChi
5792
5797
  rawChildren?: any[] | undefined;
5793
5798
  }) => string;
5794
5799
 
5795
- declare const ProductTitle: ({ setting, styles, advanced, builderProps }: ProductTitleProps) => string;
5800
+ declare const ProductTitle: (props: ProductTitleProps) => string;
5796
5801
 
5797
5802
  declare const ProductPrice: ({ setting, styles, builderProps, builderAttrs, style, advanced, classNames, }: ProductPriceProps) => string;
5798
5803
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.268",
3
+ "version": "2.0.0-dev.274",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -1,43 +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 Link = require('next/link');
8
- var core = require('@gem-sdk/core');
9
- var Text = require('../../text/components/Text.js');
10
- var urlJoin = require('../../link/helpers/url-join.js');
11
-
12
- const ProductTitle = ({ setting, builderProps, styles })=>{
13
- const product = core.useProduct();
14
- const destination = product?.handle ? urlJoin.urlJoin('/products', product.handle) : '#';
15
- const currentProductId = product?.baseID?.replace('gid://shopify/Product/', '');
16
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
17
- id: `shopify-text-element-${builderProps?.uid}`,
18
- "data-product-id": currentProductId,
19
- children: !product ? null : setting?.linkProduct ? /*#__PURE__*/ jsxRuntime.jsx(Link, {
20
- href: destination,
21
- title: product?.title,
22
- children: /*#__PURE__*/ jsxRuntime.jsx(Text.default, {
23
- builderProps: builderProps,
24
- styles: styles,
25
- setting: {
26
- ...setting,
27
- text: product.title,
28
- excludeFlex: true
29
- }
30
- })
31
- }) : /*#__PURE__*/ jsxRuntime.jsx(Text.default, {
32
- builderProps: builderProps,
33
- styles: styles,
34
- setting: {
35
- ...setting,
36
- text: product.title,
37
- excludeFlex: true
38
- }
39
- })
40
- });
41
- };
42
-
43
- exports.default = ProductTitle;
@@ -1,44 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@gem-sdk/core');
6
- var Text_liquid = require('../../text/components/Text.liquid.js');
7
- var helpers = require('../../helpers.js');
8
-
9
- const ProductTitle = ({ setting, styles, advanced, builderProps })=>{
10
- return core.template`
11
- {%- unless product -%}
12
- <p>${helpers.getStaticLocale('ProductTitle', 'product_not_found')}</p>
13
- {%- else -%}
14
- ${setting?.linkProduct ? `
15
- <a href="{{ product.url }}" title="{{ product.title }}" class="gp-product-title-link-wrapper">
16
- ${Text_liquid.default({
17
- styles: styles,
18
- setting: {
19
- ...setting,
20
- text: '{{ product.title }}',
21
- excludeFlex: true
22
- },
23
- advanced: advanced,
24
- builderProps
25
- })}
26
- </a>
27
- ` : `
28
- ${Text_liquid.default({
29
- styles: styles,
30
- setting: {
31
- ...setting,
32
- text: '{{ product.title }}',
33
- excludeFlex: true
34
- },
35
- advanced: advanced,
36
- className: 'gp-product-title',
37
- builderProps
38
- })}
39
- `}
40
- {%- endunless -%}
41
- `;
42
- };
43
-
44
- exports.default = ProductTitle;
@@ -1,39 +0,0 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import Link from 'next/link';
4
- import { useProduct } from '@gem-sdk/core';
5
- import Text from '../../text/components/Text.js';
6
- import { urlJoin } from '../../link/helpers/url-join.js';
7
-
8
- const ProductTitle = ({ setting, builderProps, styles })=>{
9
- const product = useProduct();
10
- const destination = product?.handle ? urlJoin('/products', product.handle) : '#';
11
- const currentProductId = product?.baseID?.replace('gid://shopify/Product/', '');
12
- return /*#__PURE__*/ jsx("div", {
13
- id: `shopify-text-element-${builderProps?.uid}`,
14
- "data-product-id": currentProductId,
15
- children: !product ? null : setting?.linkProduct ? /*#__PURE__*/ jsx(Link, {
16
- href: destination,
17
- title: product?.title,
18
- children: /*#__PURE__*/ jsx(Text, {
19
- builderProps: builderProps,
20
- styles: styles,
21
- setting: {
22
- ...setting,
23
- text: product.title,
24
- excludeFlex: true
25
- }
26
- })
27
- }) : /*#__PURE__*/ jsx(Text, {
28
- builderProps: builderProps,
29
- styles: styles,
30
- setting: {
31
- ...setting,
32
- text: product.title,
33
- excludeFlex: true
34
- }
35
- })
36
- });
37
- };
38
-
39
- export { ProductTitle as default };
@@ -1,40 +0,0 @@
1
- import { template } from '@gem-sdk/core';
2
- import Text from '../../text/components/Text.liquid.js';
3
- import { getStaticLocale } from '../../helpers.js';
4
-
5
- const ProductTitle = ({ setting, styles, advanced, builderProps })=>{
6
- return template`
7
- {%- unless product -%}
8
- <p>${getStaticLocale('ProductTitle', 'product_not_found')}</p>
9
- {%- else -%}
10
- ${setting?.linkProduct ? `
11
- <a href="{{ product.url }}" title="{{ product.title }}" class="gp-product-title-link-wrapper">
12
- ${Text({
13
- styles: styles,
14
- setting: {
15
- ...setting,
16
- text: '{{ product.title }}',
17
- excludeFlex: true
18
- },
19
- advanced: advanced,
20
- builderProps
21
- })}
22
- </a>
23
- ` : `
24
- ${Text({
25
- styles: styles,
26
- setting: {
27
- ...setting,
28
- text: '{{ product.title }}',
29
- excludeFlex: true
30
- },
31
- advanced: advanced,
32
- className: 'gp-product-title',
33
- builderProps
34
- })}
35
- `}
36
- {%- endunless -%}
37
- `;
38
- };
39
-
40
- export { ProductTitle as default };