@gem-sdk/components 2.0.0-dev.708 → 2.0.0-dev.710

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.
@@ -75,7 +75,7 @@ const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNot
75
75
  const bg = core.getValueByDevice(background, device);
76
76
  result = {
77
77
  ...result,
78
- [device]: bg.type === 'color' ? 'url()' : `url('${!enableLazyImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
78
+ [device]: bg?.type === 'color' ? 'url()' : `url('${!enableLazyImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
79
79
  };
80
80
  });
81
81
  return core.makeStyleResponsive('bgi', result);
@@ -457,8 +457,8 @@ const showVideoType = (background)=>{
457
457
  ];
458
458
  return DEVICES.some((item)=>{
459
459
  const bg = core.getValueByDevice(background, item);
460
- if (bg.type === 'color' || bg.type === 'image') return false;
461
- if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
460
+ if (bg?.type === 'color' || bg?.type === 'image') return false;
461
+ if (bg) return bg?.videoType === 'html5' && bg?.videoHtml5 || bg?.videoType === 'youtube' && bg?.video;
462
462
  return false;
463
463
  });
464
464
  };
@@ -11,7 +11,7 @@ const checkHasBackgroundVideo = (background)=>{
11
11
  ];
12
12
  return DEVICES.some((item)=>{
13
13
  const bg = core.getValueByDevice(background, item);
14
- if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
14
+ if (bg) return bg?.videoType === 'html5' && bg?.videoHtml5 || bg?.videoType === 'youtube' && bg?.video;
15
15
  return false;
16
16
  });
17
17
  };
@@ -81,6 +81,7 @@ const getDeviceStyles = ({ uid, device, styles, composeGlobalSize })=>{
81
81
  ${core.composeBorderCss(styles?.borderBtnV2?.hover)}
82
82
  ${core.composeCornerCss(styles?.roundedBtnV2?.hover)}
83
83
  ${core.composeBackgroundCss(styles?.backgroundColorV2?.hover)}
84
+ ${styles?.backgroundColorV2?.hover && `background-image: unset !important;`}
84
85
  }
85
86
  `;
86
87
  };
@@ -33,9 +33,11 @@ const Button = ({ setting, advanced, styles: styles$1, pageContext, builderProps
33
33
  setting: {
34
34
  label: setting?.label
35
35
  },
36
- totalVariant: '{{product.variants.size}}'
36
+ totalVariant: '{{total_combinations}}'
37
37
  });
38
38
  return core.template`
39
+ ${system.Liquid(`{%- assign total_combinations = 1 -%}`)}
40
+ ${system.LiquidFor(`option in product.options_with_values`, `{%- assign total_combinations = total_combinations | times: option.values.size -%}`)}
39
41
  ${system.Liquid(`
40
42
  {%- liquid
41
43
  assign inventory_quantity = variant.inventory_quantity | default: 0
@@ -110,7 +110,7 @@ const ProductBadge = (props)=>{
110
110
  gp-data='${core.dataStringify(createDataState)}'
111
111
  class="containerClass"
112
112
  style="${containerStyle}"
113
- data-display-content="${displayContentVal}"
113
+ data-display-content="${pageContext?.isPreviewing ? displayContentVal : core.sanitizeLiquid(`{{${displayContentVal}}}`)}"
114
114
  >
115
115
  <div class="${wrapperClass}">
116
116
  <div
@@ -38,7 +38,7 @@ const getGPProductButtonState = (styles, setting)=>{
38
38
  },
39
39
  variantID: '{{variant.id}}',
40
40
  disabled: `{{variant.available}}`,
41
- totalVariant: '{{product.variants.size}}'
41
+ totalVariant: '{{total_combinations}}'
42
42
  };
43
43
  };
44
44
  const renderSeparator = (separator)=>{
@@ -73,7 +73,7 @@ const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNot
73
73
  const bg = getValueByDevice(background, device);
74
74
  result = {
75
75
  ...result,
76
- [device]: bg.type === 'color' ? 'url()' : `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
76
+ [device]: bg?.type === 'color' ? 'url()' : `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
77
77
  };
78
78
  });
79
79
  return makeStyleResponsive('bgi', result);
@@ -455,8 +455,8 @@ const showVideoType = (background)=>{
455
455
  ];
456
456
  return DEVICES.some((item)=>{
457
457
  const bg = getValueByDevice(background, item);
458
- if (bg.type === 'color' || bg.type === 'image') return false;
459
- if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
458
+ if (bg?.type === 'color' || bg?.type === 'image') return false;
459
+ if (bg) return bg?.videoType === 'html5' && bg?.videoHtml5 || bg?.videoType === 'youtube' && bg?.video;
460
460
  return false;
461
461
  });
462
462
  };
@@ -9,7 +9,7 @@ const checkHasBackgroundVideo = (background)=>{
9
9
  ];
10
10
  return DEVICES.some((item)=>{
11
11
  const bg = getValueByDevice(background, item);
12
- if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
12
+ if (bg) return bg?.videoType === 'html5' && bg?.videoHtml5 || bg?.videoType === 'youtube' && bg?.video;
13
13
  return false;
14
14
  });
15
15
  };
@@ -79,6 +79,7 @@ const getDeviceStyles = ({ uid, device, styles, composeGlobalSize })=>{
79
79
  ${composeBorderCss(styles?.borderBtnV2?.hover)}
80
80
  ${composeCornerCss(styles?.roundedBtnV2?.hover)}
81
81
  ${composeBackgroundCss(styles?.backgroundColorV2?.hover)}
82
+ ${styles?.backgroundColorV2?.hover && `background-image: unset !important;`}
82
83
  }
83
84
  `;
84
85
  };
@@ -1,5 +1,5 @@
1
1
  import { template, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
- import { createClass, createStateOrContext, Liquid, If } from '@gem-sdk/system';
2
+ import { createClass, createStateOrContext, Liquid, LiquidFor, If } from '@gem-sdk/system';
3
3
  import { getDynamicSourceLocales, getSettingPreloadData } from '../../../../helpers.js';
4
4
  import { getButtonClasses } from '../common/classes.js';
5
5
  import { getButtonStyles } from '../common/styles.js';
@@ -29,9 +29,11 @@ const Button = ({ setting, advanced, styles, pageContext, builderProps, classNam
29
29
  setting: {
30
30
  label: setting?.label
31
31
  },
32
- totalVariant: '{{product.variants.size}}'
32
+ totalVariant: '{{total_combinations}}'
33
33
  });
34
34
  return template`
35
+ ${Liquid(`{%- assign total_combinations = 1 -%}`)}
36
+ ${LiquidFor(`option in product.options_with_values`, `{%- assign total_combinations = total_combinations | times: option.values.size -%}`)}
35
37
  ${Liquid(`
36
38
  {%- liquid
37
39
  assign inventory_quantity = variant.inventory_quantity | default: 0
@@ -1,4 +1,4 @@
1
- import { template, dataStringify, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
1
+ import { template, dataStringify, sanitizeLiquid, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import { getDynamicSourceLocales, getSettingPreloadData } from '../../../helpers.js';
3
3
  import { checkDiscountContentProductBadge } from './utils/common.js';
4
4
  import { generateBadgeContent } from './utils/generateLiquidContent.js';
@@ -106,7 +106,7 @@ const ProductBadge = (props)=>{
106
106
  gp-data='${dataStringify(createDataState)}'
107
107
  class="containerClass"
108
108
  style="${containerStyle}"
109
- data-display-content="${displayContentVal}"
109
+ data-display-content="${pageContext?.isPreviewing ? displayContentVal : sanitizeLiquid(`{{${displayContentVal}}}`)}"
110
110
  >
111
111
  <div class="${wrapperClass}">
112
112
  <div
@@ -36,7 +36,7 @@ const getGPProductButtonState = (styles, setting)=>{
36
36
  },
37
37
  variantID: '{{variant.id}}',
38
38
  disabled: `{{variant.available}}`,
39
- totalVariant: '{{product.variants.size}}'
39
+ totalVariant: '{{total_combinations}}'
40
40
  };
41
41
  };
42
42
  const renderSeparator = (separator)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.708",
3
+ "version": "2.0.0-dev.710",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "2.0.0-dev.704",
28
+ "@gem-sdk/core": "2.0.0-dev.710",
29
29
  "@gem-sdk/styles": "2.0.0-dev.703",
30
30
  "@gem-sdk/system": "2.0.0-dev.695",
31
31
  "@types/react-transition-group": "^4.4.5",