@gem-sdk/components 2.0.0-dev.600 → 2.0.0-dev.602

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.
@@ -37,7 +37,7 @@ const getButtonContentWrapperClasses = (setting)=>{
37
37
  };
38
38
  const getButtonLabelClasses = (styles, isEditable)=>{
39
39
  return {
40
- 'gp-relative gp-flex gp-h-full gp-items-center gp-overflow-hidden gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line': true,
40
+ 'gp-content-product-button gp-relative gp-flex gp-h-full gp-items-center gp-overflow-hidden gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line': true,
41
41
  '[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]': styles?.typo?.attrs?.italic,
42
42
  'gp-text button-text': isEditable
43
43
  };
@@ -4,7 +4,7 @@ var helpers = require('./helpers.js');
4
4
  var styles = require('./styles.js');
5
5
 
6
6
  const getData = (props)=>{
7
- const { style, dataId, pageContext, styles: styles$1 = {}, setting = {}, builderProps, builderAttrs, isForceValue = false } = props;
7
+ const { style, dataId, pageContext, styles: styles$1 = {}, setting = {}, builderProps, builderAttrs, isUseTranslatedValue = false } = props;
8
8
  const { label, iconSvg, btnLink, loading, options, disabled, translate, iconVisible, shouldClearSpace } = setting;
9
9
  const [wrapStyle, restStyle] = helpers.getSplitStyles(style);
10
10
  const cleanedStyles = helpers.getCleanedStyles(styles$1, disabled);
@@ -36,7 +36,7 @@ const getData = (props)=>{
36
36
  pageContext
37
37
  },
38
38
  ...isLiquid && {
39
- isForceValue
39
+ isUseTranslatedValue
40
40
  }
41
41
  });
42
42
  };
@@ -25,8 +25,8 @@ const getCleanedStyles = (styles, disabled)=>{
25
25
  });
26
26
  return cleanedStyles;
27
27
  };
28
- const handleGetLabelToDisplay = ({ label, styles, translate, pageContext, isForceValue, builderProps, isLiquid = false })=>{
29
- const liquidLabel = isForceValue ? label : helpers.getDynamicSourceLocales({
28
+ const handleGetLabelToDisplay = ({ label, styles, translate, pageContext, isUseTranslatedValue, builderProps, isLiquid = false })=>{
29
+ const liquidLabel = !isUseTranslatedValue ? label : helpers.getDynamicSourceLocales({
30
30
  translate,
31
31
  val: label,
32
32
  pageContext,
@@ -40,6 +40,7 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles: styles$1, se
40
40
  const isSyncProduct = core.useIsSyncProduct();
41
41
  const { selectedOptions, setSelectedOption, forceSelectedOption } = core.useSelectedOption();
42
42
  const [variantId, setVariantId] = React.useState('');
43
+ const mode = core.useEditorMode();
43
44
  React.useEffect(()=>{
44
45
  const url = new URL(window.location.href);
45
46
  const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
@@ -206,9 +207,11 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles: styles$1, se
206
207
  })
207
208
  })
208
209
  ]
209
- }) : /*#__PURE__*/ jsxRuntime.jsx("p", {
210
- className: defaultVariantClasses,
211
- children: "This product has only default variant"
210
+ }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
211
+ children: mode === 'edit' && /*#__PURE__*/ jsxRuntime.jsx("p", {
212
+ className: defaultVariantClasses,
213
+ children: "This product has only default variant"
214
+ })
212
215
  })
213
216
  });
214
217
  };
@@ -52,8 +52,8 @@ const ProductButton = (props)=>{
52
52
  gp-data-wrapper="true"
53
53
  gp-href="${urlData.href}"
54
54
  class="gp-product-button"
55
- label-out-of-Stock="${outOfStockButtonLabel}"
56
- label-unavailable="${unavailableButtonLabel}"
55
+ gp-label-out-of-stock="${outOfStockButtonLabel}"
56
+ gp-label-unavailable="${unavailableButtonLabel}"
57
57
  gp-data='${JSON.stringify(productButtonState).replaceAll("'", ''')}'
58
58
  data-variant-selection-required-message="${variantSelectionRequiredMessage}"
59
59
  >
@@ -32,7 +32,7 @@ const SoldOutButton = (props)=>{
32
32
  uid: `${builderProps?.uid}-sold-out`
33
33
  },
34
34
  pageContext,
35
- isForceValue: true,
35
+ isUseTranslatedValue: true,
36
36
  dataId: builderProps?.uid,
37
37
  customAttrs: {
38
38
  'gp-data-hidden': `{% if variant.available %}true{% endif %}`
@@ -26,13 +26,23 @@ const SettingUIV2 = [
26
26
  ]
27
27
  },
28
28
  {
29
- conditionDisplay: 'widgetType === "badge"',
30
- messageConfig: {
31
- type: 'info',
32
- message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get the badge ID ?</a>'
33
- },
34
29
  controls: [
35
30
  {
31
+ conditionDisplay: 'widgetType === "badge"',
32
+ messageConfig: {
33
+ type: 'info',
34
+ message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get the badge ID ?</a>'
35
+ }
36
+ },
37
+ {
38
+ conditionDisplay: 'widgetType === "trustedBadge"',
39
+ messageConfig: {
40
+ type: 'info',
41
+ message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get trust badge ID ?</a>'
42
+ }
43
+ },
44
+ {
45
+ conditionDisplay: 'widgetType === "badge"',
36
46
  type: 'combo',
37
47
  label: {
38
48
  en: 'Badge ID'
@@ -57,18 +67,10 @@ const SettingUIV2 = [
57
67
  }
58
68
  }
59
69
  ]
60
- }
61
- ]
62
- },
63
- {
64
- messageConfig: {
65
- type: 'info',
66
- message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get trust badge ID ?</a>'
67
- },
68
- conditionDisplay: 'widgetType === "trustedBadge"',
69
- controls: [
70
+ },
70
71
  {
71
72
  type: 'combo',
73
+ conditionDisplay: 'widgetType === "trustedBadge"',
72
74
  label: {
73
75
  en: 'Trust Badge ID'
74
76
  },
@@ -53,41 +53,6 @@ const SettingUIV2 = [
53
53
  }
54
54
  ]
55
55
  },
56
- {
57
- messageConfig: {
58
- type: 'info',
59
- message: 'How to get the embedded code? Click <a href="https://app.omnisend.com/forms/list/all" target="_blank" class="reference">here</a>'
60
- },
61
- conditionDisplay: `widgetType == 'landing-page'`,
62
- controls: [
63
- {
64
- type: 'combo',
65
- label: {
66
- en: 'Landing Page Link'
67
- },
68
- iconName: 'polaris-text-block',
69
- getValueFromSettingID: 'landingPageLink',
70
- isHideClear: true,
71
- popoverLabel: {
72
- en: 'Landing Page Link'
73
- },
74
- controls: [
75
- {
76
- label: {
77
- en: 'Content'
78
- },
79
- options: {
80
- fullWidth: true
81
- },
82
- layout: 'vertical',
83
- setting: {
84
- id: 'landingPageLink'
85
- }
86
- }
87
- ]
88
- }
89
- ]
90
- },
91
56
  {
92
57
  controls: [
93
58
  {
@@ -34,19 +34,33 @@ const SettingUIV2 = [
34
34
  setting: {
35
35
  id: 'widgetType'
36
36
  }
37
- }
38
- ]
39
- },
40
- {
41
- conditionDisplay: 'version === "v1"',
42
- controls: [
37
+ },
43
38
  {
39
+ conditionDisplay: `version === "v1"`,
40
+ type: 'combo',
44
41
  label: {
45
42
  en: 'App Key'
46
43
  },
47
- setting: {
48
- id: 'appKey'
49
- }
44
+ iconName: 'polaris-text-block',
45
+ getValueFromSettingID: 'appKey',
46
+ isHideClear: true,
47
+ popoverLabel: {
48
+ en: 'App Key'
49
+ },
50
+ controls: [
51
+ {
52
+ label: {
53
+ en: 'Content'
54
+ },
55
+ options: {
56
+ fullWidth: true
57
+ },
58
+ layout: 'vertical',
59
+ setting: {
60
+ id: 'appKey'
61
+ }
62
+ }
63
+ ]
50
64
  }
51
65
  ]
52
66
  },
@@ -35,7 +35,7 @@ const getButtonContentWrapperClasses = (setting)=>{
35
35
  };
36
36
  const getButtonLabelClasses = (styles, isEditable)=>{
37
37
  return {
38
- 'gp-relative gp-flex gp-h-full gp-items-center gp-overflow-hidden gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line': true,
38
+ 'gp-content-product-button gp-relative gp-flex gp-h-full gp-items-center gp-overflow-hidden gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line': true,
39
39
  '[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]': styles?.typo?.attrs?.italic,
40
40
  'gp-text button-text': isEditable
41
41
  };
@@ -2,7 +2,7 @@ import { getSplitStyles, getCleanedStyles, checkIsScrollToElement, getDataState,
2
2
  import { getCustomCssStyles } from './styles.js';
3
3
 
4
4
  const getData = (props)=>{
5
- const { style, dataId, pageContext, styles = {}, setting = {}, builderProps, builderAttrs, isForceValue = false } = props;
5
+ const { style, dataId, pageContext, styles = {}, setting = {}, builderProps, builderAttrs, isUseTranslatedValue = false } = props;
6
6
  const { label, iconSvg, btnLink, loading, options, disabled, translate, iconVisible, shouldClearSpace } = setting;
7
7
  const [wrapStyle, restStyle] = getSplitStyles(style);
8
8
  const cleanedStyles = getCleanedStyles(styles, disabled);
@@ -34,7 +34,7 @@ const getData = (props)=>{
34
34
  pageContext
35
35
  },
36
36
  ...isLiquid && {
37
- isForceValue
37
+ isUseTranslatedValue
38
38
  }
39
39
  });
40
40
  };
@@ -23,8 +23,8 @@ const getCleanedStyles = (styles, disabled)=>{
23
23
  });
24
24
  return cleanedStyles;
25
25
  };
26
- const handleGetLabelToDisplay = ({ label, styles, translate, pageContext, isForceValue, builderProps, isLiquid = false })=>{
27
- const liquidLabel = isForceValue ? label : getDynamicSourceLocales({
26
+ const handleGetLabelToDisplay = ({ label, styles, translate, pageContext, isUseTranslatedValue, builderProps, isLiquid = false })=>{
27
+ const liquidLabel = !isUseTranslatedValue ? label : getDynamicSourceLocales({
28
28
  translate,
29
29
  val: label,
30
30
  pageContext,
@@ -5,7 +5,7 @@ import { createClass, createStyle } from '@gem-sdk/system';
5
5
  import { getDefaultVariantClasses, getContainerClasses, getDropdownVariantWrapperClasses } from '../common/classes.js';
6
6
  import { getWrapperStyles } from '../common/styles.js';
7
7
  import ProductOption from './ProductOption.js';
8
- import { useVariants, useProduct, useIsSyncProduct, useSelectedOption, useInitialSwatchesOptions, useSwatchesOptions, getSelectedVariant } from '@gem-sdk/core';
8
+ import { useVariants, useProduct, useIsSyncProduct, useSelectedOption, useEditorMode, useInitialSwatchesOptions, useSwatchesOptions, getSelectedVariant } from '@gem-sdk/core';
9
9
  import { useTransition } from '../hooks/useTransition.js';
10
10
  import { useState, useEffect, useMemo, useCallback } from 'react';
11
11
  import { checkDefaultVariant } from '../../../../../product/helpers/product.js';
@@ -36,6 +36,7 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles, setting })=>
36
36
  const isSyncProduct = useIsSyncProduct();
37
37
  const { selectedOptions, setSelectedOption, forceSelectedOption } = useSelectedOption();
38
38
  const [variantId, setVariantId] = useState('');
39
+ const mode = useEditorMode();
39
40
  useEffect(()=>{
40
41
  const url = new URL(window.location.href);
41
42
  const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
@@ -202,9 +203,11 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles, setting })=>
202
203
  })
203
204
  })
204
205
  ]
205
- }) : /*#__PURE__*/ jsx("p", {
206
- className: defaultVariantClasses,
207
- children: "This product has only default variant"
206
+ }) : /*#__PURE__*/ jsx("div", {
207
+ children: mode === 'edit' && /*#__PURE__*/ jsx("p", {
208
+ className: defaultVariantClasses,
209
+ children: "This product has only default variant"
210
+ })
208
211
  })
209
212
  });
210
213
  };
@@ -48,8 +48,8 @@ const ProductButton = (props)=>{
48
48
  gp-data-wrapper="true"
49
49
  gp-href="${urlData.href}"
50
50
  class="gp-product-button"
51
- label-out-of-Stock="${outOfStockButtonLabel}"
52
- label-unavailable="${unavailableButtonLabel}"
51
+ gp-label-out-of-stock="${outOfStockButtonLabel}"
52
+ gp-label-unavailable="${unavailableButtonLabel}"
53
53
  gp-data='${JSON.stringify(productButtonState).replaceAll("'", '&#039;')}'
54
54
  data-variant-selection-required-message="${variantSelectionRequiredMessage}"
55
55
  >
@@ -30,7 +30,7 @@ const SoldOutButton = (props)=>{
30
30
  uid: `${builderProps?.uid}-sold-out`
31
31
  },
32
32
  pageContext,
33
- isForceValue: true,
33
+ isUseTranslatedValue: true,
34
34
  dataId: builderProps?.uid,
35
35
  customAttrs: {
36
36
  'gp-data-hidden': `{% if variant.available %}true{% endif %}`
@@ -22,13 +22,23 @@ const SettingUIV2 = [
22
22
  ]
23
23
  },
24
24
  {
25
- conditionDisplay: 'widgetType === "badge"',
26
- messageConfig: {
27
- type: 'info',
28
- message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get the badge ID ?</a>'
29
- },
30
25
  controls: [
31
26
  {
27
+ conditionDisplay: 'widgetType === "badge"',
28
+ messageConfig: {
29
+ type: 'info',
30
+ message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get the badge ID ?</a>'
31
+ }
32
+ },
33
+ {
34
+ conditionDisplay: 'widgetType === "trustedBadge"',
35
+ messageConfig: {
36
+ type: 'info',
37
+ message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get trust badge ID ?</a>'
38
+ }
39
+ },
40
+ {
41
+ conditionDisplay: 'widgetType === "badge"',
32
42
  type: 'combo',
33
43
  label: {
34
44
  en: 'Badge ID'
@@ -53,18 +63,10 @@ const SettingUIV2 = [
53
63
  }
54
64
  }
55
65
  ]
56
- }
57
- ]
58
- },
59
- {
60
- messageConfig: {
61
- type: 'info',
62
- message: '<a style="text-decoration: none; color: #8AA4FF; font-style: normal" href="https://help.fordeercommerce.io/en/article/how-to-get-labelbadge-id-oaszaa/?bust=1728450204490" target="_blank">How can I get trust badge ID ?</a>'
63
- },
64
- conditionDisplay: 'widgetType === "trustedBadge"',
65
- controls: [
66
+ },
66
67
  {
67
68
  type: 'combo',
69
+ conditionDisplay: 'widgetType === "trustedBadge"',
68
70
  label: {
69
71
  en: 'Trust Badge ID'
70
72
  },
@@ -49,41 +49,6 @@ const SettingUIV2 = [
49
49
  }
50
50
  ]
51
51
  },
52
- {
53
- messageConfig: {
54
- type: 'info',
55
- message: 'How to get the embedded code? Click <a href="https://app.omnisend.com/forms/list/all" target="_blank" class="reference">here</a>'
56
- },
57
- conditionDisplay: `widgetType == 'landing-page'`,
58
- controls: [
59
- {
60
- type: 'combo',
61
- label: {
62
- en: 'Landing Page Link'
63
- },
64
- iconName: 'polaris-text-block',
65
- getValueFromSettingID: 'landingPageLink',
66
- isHideClear: true,
67
- popoverLabel: {
68
- en: 'Landing Page Link'
69
- },
70
- controls: [
71
- {
72
- label: {
73
- en: 'Content'
74
- },
75
- options: {
76
- fullWidth: true
77
- },
78
- layout: 'vertical',
79
- setting: {
80
- id: 'landingPageLink'
81
- }
82
- }
83
- ]
84
- }
85
- ]
86
- },
87
52
  {
88
53
  controls: [
89
54
  {
@@ -30,19 +30,33 @@ const SettingUIV2 = [
30
30
  setting: {
31
31
  id: 'widgetType'
32
32
  }
33
- }
34
- ]
35
- },
36
- {
37
- conditionDisplay: 'version === "v1"',
38
- controls: [
33
+ },
39
34
  {
35
+ conditionDisplay: `version === "v1"`,
36
+ type: 'combo',
40
37
  label: {
41
38
  en: 'App Key'
42
39
  },
43
- setting: {
44
- id: 'appKey'
45
- }
40
+ iconName: 'polaris-text-block',
41
+ getValueFromSettingID: 'appKey',
42
+ isHideClear: true,
43
+ popoverLabel: {
44
+ en: 'App Key'
45
+ },
46
+ controls: [
47
+ {
48
+ label: {
49
+ en: 'Content'
50
+ },
51
+ options: {
52
+ fullWidth: true
53
+ },
54
+ layout: 'vertical',
55
+ setting: {
56
+ id: 'appKey'
57
+ }
58
+ }
59
+ ]
46
60
  }
47
61
  ]
48
62
  },
@@ -337,7 +337,7 @@ type ButtonProps = MixedProps$3 & BasePropsWrap<{
337
337
  nodePrice?: JSX.Element | string;
338
338
  };
339
339
  type ButtonLiquidProps = ButtonProps & {
340
- isForceValue?: boolean;
340
+ isUseTranslatedValue?: boolean;
341
341
  pageContext?: PageContext;
342
342
  };
343
343
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.600",
3
+ "version": "2.0.0-dev.602",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -23,7 +23,7 @@
23
23
  "update-img-src-3rd": "node ./scripts/update-img-src-3rd.js"
24
24
  },
25
25
  "devDependencies": {
26
- "@gem-sdk/core": "2.0.0-dev.596",
26
+ "@gem-sdk/core": "2.0.0-dev.602",
27
27
  "@gem-sdk/styles": "2.0.0-dev.571",
28
28
  "@gem-sdk/system": "2.0.0-dev.504",
29
29
  "@types/react-transition-group": "^4.4.5"