@gem-sdk/components 2.0.0-dev.293 → 2.0.0-dev.294

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.
@@ -19,7 +19,7 @@ const AdaptiveImage = (props)=>{
19
19
  srcDesktop,
20
20
  enableLazyLoadImage: enableLazyloadImage
21
21
  }));
22
- const pictureStyle = system.createStyle({
22
+ const pictureStyle = system.createStyleReact({
23
23
  ...styles.getAdaptivePictureStyles()
24
24
  });
25
25
  const adaptiveImageStyles = system.createStyle({
@@ -39,13 +39,13 @@ const AdaptiveImage = (props)=>{
39
39
  })
40
40
  });
41
41
  const renderSource = ()=>{
42
- return `
43
- ${srcMobile ? `<source media="(max-width: 767px)" srcset="${enableLazyLoadImage ? constants.IMAGE_PLACEHOLDER : srcMobile}" />` : ``}
44
- ${srcTablet ? `<source media="(max-width: 1024px)" srcset="${enableLazyLoadImage ? constants.IMAGE_PLACEHOLDER : srcTablet}" />` : ``}
42
+ return core.template`
43
+ ${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyLoadImage ? constants.IMAGE_PLACEHOLDER : srcMobile}" />` : ``}
44
+ ${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyLoadImage ? constants.IMAGE_PLACEHOLDER : srcTablet}" />` : ``}
45
45
  `;
46
46
  };
47
47
  const renderImage = ()=>{
48
- return `
48
+ return core.template`
49
49
  <img
50
50
  ${{
51
51
  ...restProps
@@ -22,11 +22,7 @@ const Image = ({ style, styles: styles$1, setting, children, advanced, className
22
22
  setting: imageLink,
23
23
  enableImageLink
24
24
  });
25
- console.log('image', {
26
- setting,
27
- styles: styles$1
28
- });
29
- const wrapperStyles = system.createStyle(styles.getWrapperStyles(styles$1));
25
+ const wrapperStyles = system.createStyleReact(styles.getWrapperStyles(styles$1));
30
26
  const noDataImageStyles = system.createStyle(styles.getNoDataImageStyles(styles$1));
31
27
  const imageStyles = system.createStyle(styles.getImageStyles(styles$1, builderProps));
32
28
  const containerStyles = system.createStyle(styles.getContainerStyles(style, styles$1));
@@ -11,7 +11,7 @@ const getContainerStyles = (style, styles)=>{
11
11
  };
12
12
  const getWrapperStyles = (styles)=>{
13
13
  return {
14
- borderRadius: 'inherit',
14
+ 'border-radius': 'inherit',
15
15
  overflow: 'hidden',
16
16
  ...core.makeStyleResponsive('jc', styles?.align)
17
17
  };
@@ -62,7 +62,7 @@ const getAdaptiveImageStyles = ({ layout, aspectRatio, borderRadius })=>{
62
62
  };
63
63
  const getAdaptivePictureStyles = ()=>{
64
64
  return {
65
- borderRadius: 'inherit'
65
+ 'border-radius': 'inherit'
66
66
  };
67
67
  };
68
68
  const getNoDataImageStyles = (styles)=>{
@@ -8,6 +8,7 @@ const getNextImageLiquidAttrs = (props)=>{
8
8
  const { srcset, setting, storage, baseSrc, priority, customAttrs, width = 2237, height = 1678, isNotLazyload, backupFileKey, backupFilePath, srcIsLiquidCode, enableLazyLoadImage, alt = constants.NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = constants.NEXT_IMAGE_CONFIG.DEFAULT_SRC, sizes = constants.NEXT_IMAGE_CONFIG.DEFAULT_SIZES } = props;
9
9
  const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
10
10
  const getLoadingAttrs = ()=>{
11
+ const { qualityPercent, qualityType } = setting ?? {};
11
12
  const newBackupFileKey = backupFileKey ? getSrcSet.getNewBackupFileKey(backupFileKey ?? '', src) : '';
12
13
  const srcImage = srcIsLiquidCode ? baseSrc : getSrcSet.getImageSrc({
13
14
  src,
@@ -37,43 +38,24 @@ const getNextImageLiquidAttrs = (props)=>{
37
38
  srcset: srcset || ''
38
39
  };
39
40
  return {
41
+ 'data-sizes': 'auto',
42
+ 'quality-type': JSON.stringify(qualityType) || '{}',
43
+ 'quality-percent': JSON.stringify(qualityPercent) || '{}',
40
44
  ...hasLazyLoad ? lazyLoadAttrs : priorityLoadAttrs
41
45
  };
42
46
  };
43
47
  const getBaseAttrs = ()=>{
44
- const { qualityPercent, qualityType } = setting ?? {};
45
48
  return {
46
49
  alt,
47
50
  width,
48
51
  height,
49
- draggable: 'false',
50
- 'data-sizes': 'auto',
51
- 'quality-type': JSON.stringify(qualityType) || '{}',
52
- 'quality-percent': JSON.stringify(qualityPercent) || '{}'
52
+ draggable: 'false'
53
53
  };
54
54
  };
55
- const getFilteredAttrs = ()=>{
56
- const ignoreAttrs = [
57
- 'src',
58
- 'srcset',
59
- 'width',
60
- 'height',
61
- 'alt',
62
- 'base-src'
63
- ];
64
- const filteredAttrs = {};
65
- Object.entries(props).forEach(([key, value])=>{
66
- if (!ignoreAttrs.includes(key) && (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')) {
67
- filteredAttrs[key] = value;
68
- }
69
- });
70
- return filteredAttrs;
71
- };
72
55
  return system.createAttr({
73
56
  ...customAttrs,
74
57
  ...getBaseAttrs(),
75
- ...getLoadingAttrs(),
76
- ...getFilteredAttrs()
58
+ ...getLoadingAttrs()
77
59
  });
78
60
  };
79
61
 
@@ -4,7 +4,7 @@ var system = require('@gem-sdk/system');
4
4
  var constants = require('../common/constants.js');
5
5
 
6
6
  const getNextImageReactAttrs = (props)=>{
7
- const { width = constants.NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS, height = constants.NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS, priority, isNotLazyload, enableLazyLoadImage, base64 = constants.IMAGE_PLACEHOLDER, alt = constants.NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = constants.NEXT_IMAGE_CONFIG.DEFAULT_SRC } = props;
7
+ const { width = constants.NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS, height = constants.NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS, quality, priority, isNotLazyload, enableLazyLoadImage, base64 = constants.IMAGE_PLACEHOLDER, alt = constants.NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = constants.NEXT_IMAGE_CONFIG.DEFAULT_SRC } = props;
8
8
  const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
9
9
  const getLoadingAttrs = ()=>{
10
10
  const lazyLoadAttrs = {
@@ -26,12 +26,12 @@ const getNextImageReactAttrs = (props)=>{
26
26
  src,
27
27
  alt,
28
28
  width,
29
- height
29
+ height,
30
+ quality
30
31
  });
31
32
  const baseAttrs = getBaseAttrs();
32
33
  const loadingAttrs = system.createAttr(getLoadingAttrs());
33
34
  return {
34
- ...props,
35
35
  ...baseAttrs,
36
36
  ...loadingAttrs
37
37
  };
@@ -184,11 +184,11 @@ const SettingUIV2 = [
184
184
  type: 'select',
185
185
  options: [
186
186
  {
187
- label: 'Link variants, quantity between same products',
187
+ label: 'Link variants, quantity <br> between same products',
188
188
  value: true
189
189
  },
190
190
  {
191
- label: 'Unlink variants, quantity between same products',
191
+ label: 'Unlink variants, quantity <br> between same products',
192
192
  value: false
193
193
  }
194
194
  ],
@@ -6,7 +6,7 @@ var thirdParty = require('../helpers/thirdParty.js');
6
6
 
7
7
  const RechargeSubscriptions = ({ setting, advanced })=>{
8
8
  const { align, appBlockId } = setting ?? {};
9
- return thirdParty.getLiquidForAppBlock(appBlockId, align, advanced?.cssClass);
9
+ return thirdParty.getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`);
10
10
  };
11
11
 
12
12
  exports.default = RechargeSubscriptions;
@@ -54,8 +54,11 @@ const config = {
54
54
  options: [
55
55
  {
56
56
  label: 'Subscription Widget',
57
- value: 'subscription-widget',
58
- maxOption: 1
57
+ value: 'subscription-widget'
58
+ },
59
+ {
60
+ label: 'Subscription Widget 2.0',
61
+ value: 'subscription-widget-v2'
59
62
  }
60
63
  ],
61
64
  default: 'subscription-widget'
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import { IMAGE_PLACEHOLDER } from './common/constants.js';
4
- import { createAttr, createStyle, createClass } from '@gem-sdk/system';
4
+ import { createAttr, createStyleReact, createStyle, createClass } from '@gem-sdk/system';
5
5
  import { getLoadingAdaptiveImageAttrs } from './common/attributes.js';
6
6
  import { getAdaptiveImageClasses } from './common/classes.js';
7
7
  import { getAdaptiveImageData } from './common/data.js';
@@ -15,7 +15,7 @@ const AdaptiveImage = (props)=>{
15
15
  srcDesktop,
16
16
  enableLazyLoadImage: enableLazyloadImage
17
17
  }));
18
- const pictureStyle = createStyle({
18
+ const pictureStyle = createStyleReact({
19
19
  ...getAdaptivePictureStyles()
20
20
  });
21
21
  const adaptiveImageStyles = createStyle({
@@ -35,13 +35,13 @@ const AdaptiveImage = (props)=>{
35
35
  })
36
36
  });
37
37
  const renderSource = ()=>{
38
- return `
39
- ${srcMobile ? `<source media="(max-width: 767px)" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcMobile}" />` : ``}
40
- ${srcTablet ? `<source media="(max-width: 1024px)" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcTablet}" />` : ``}
38
+ return template`
39
+ ${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcMobile}" />` : ``}
40
+ ${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcTablet}" />` : ``}
41
41
  `;
42
42
  };
43
43
  const renderImage = ()=>{
44
- return `
44
+ return template`
45
45
  <img
46
46
  ${{
47
47
  ...restProps
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import { createStyle, createClass, createAttr, If } from '@gem-sdk/system';
3
+ import { createStyleReact, createStyle, createClass, createAttr, If } from '@gem-sdk/system';
4
4
  import AdaptiveImage from './AdaptiveImage.js';
5
5
  import NextImage from './NextImage.js';
6
6
  import NoDataImage from './NoDataImage.js';
@@ -18,11 +18,7 @@ const Image = ({ style, styles, setting, children, advanced, className, builderA
18
18
  setting: imageLink,
19
19
  enableImageLink
20
20
  });
21
- console.log('image', {
22
- setting,
23
- styles
24
- });
25
- const wrapperStyles = createStyle(getWrapperStyles(styles));
21
+ const wrapperStyles = createStyleReact(getWrapperStyles(styles));
26
22
  const noDataImageStyles = createStyle(getNoDataImageStyles(styles));
27
23
  const imageStyles = createStyle(getImageStyles(styles, builderProps));
28
24
  const containerStyles = createStyle(getContainerStyles(style, styles));
@@ -9,7 +9,7 @@ const getContainerStyles = (style, styles)=>{
9
9
  };
10
10
  const getWrapperStyles = (styles)=>{
11
11
  return {
12
- borderRadius: 'inherit',
12
+ 'border-radius': 'inherit',
13
13
  overflow: 'hidden',
14
14
  ...makeStyleResponsive('jc', styles?.align)
15
15
  };
@@ -60,7 +60,7 @@ const getAdaptiveImageStyles = ({ layout, aspectRatio, borderRadius })=>{
60
60
  };
61
61
  const getAdaptivePictureStyles = ()=>{
62
62
  return {
63
- borderRadius: 'inherit'
63
+ 'border-radius': 'inherit'
64
64
  };
65
65
  };
66
66
  const getNoDataImageStyles = (styles)=>{
@@ -6,6 +6,7 @@ const getNextImageLiquidAttrs = (props)=>{
6
6
  const { srcset, setting, storage, baseSrc, priority, customAttrs, width = 2237, height = 1678, isNotLazyload, backupFileKey, backupFilePath, srcIsLiquidCode, enableLazyLoadImage, alt = NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = NEXT_IMAGE_CONFIG.DEFAULT_SRC, sizes = NEXT_IMAGE_CONFIG.DEFAULT_SIZES } = props;
7
7
  const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
8
8
  const getLoadingAttrs = ()=>{
9
+ const { qualityPercent, qualityType } = setting ?? {};
9
10
  const newBackupFileKey = backupFileKey ? getNewBackupFileKey(backupFileKey ?? '', src) : '';
10
11
  const srcImage = srcIsLiquidCode ? baseSrc : getImageSrc({
11
12
  src,
@@ -35,43 +36,24 @@ const getNextImageLiquidAttrs = (props)=>{
35
36
  srcset: srcset || ''
36
37
  };
37
38
  return {
39
+ 'data-sizes': 'auto',
40
+ 'quality-type': JSON.stringify(qualityType) || '{}',
41
+ 'quality-percent': JSON.stringify(qualityPercent) || '{}',
38
42
  ...hasLazyLoad ? lazyLoadAttrs : priorityLoadAttrs
39
43
  };
40
44
  };
41
45
  const getBaseAttrs = ()=>{
42
- const { qualityPercent, qualityType } = setting ?? {};
43
46
  return {
44
47
  alt,
45
48
  width,
46
49
  height,
47
- draggable: 'false',
48
- 'data-sizes': 'auto',
49
- 'quality-type': JSON.stringify(qualityType) || '{}',
50
- 'quality-percent': JSON.stringify(qualityPercent) || '{}'
50
+ draggable: 'false'
51
51
  };
52
52
  };
53
- const getFilteredAttrs = ()=>{
54
- const ignoreAttrs = [
55
- 'src',
56
- 'srcset',
57
- 'width',
58
- 'height',
59
- 'alt',
60
- 'base-src'
61
- ];
62
- const filteredAttrs = {};
63
- Object.entries(props).forEach(([key, value])=>{
64
- if (!ignoreAttrs.includes(key) && (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')) {
65
- filteredAttrs[key] = value;
66
- }
67
- });
68
- return filteredAttrs;
69
- };
70
53
  return createAttr({
71
54
  ...customAttrs,
72
55
  ...getBaseAttrs(),
73
- ...getLoadingAttrs(),
74
- ...getFilteredAttrs()
56
+ ...getLoadingAttrs()
75
57
  });
76
58
  };
77
59
 
@@ -2,7 +2,7 @@ import { createAttr } from '@gem-sdk/system';
2
2
  import { NEXT_IMAGE_CONFIG, IMAGE_PLACEHOLDER } from '../common/constants.js';
3
3
 
4
4
  const getNextImageReactAttrs = (props)=>{
5
- const { width = NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS, height = NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS, priority, isNotLazyload, enableLazyLoadImage, base64 = IMAGE_PLACEHOLDER, alt = NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = NEXT_IMAGE_CONFIG.DEFAULT_SRC } = props;
5
+ const { width = NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS, height = NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS, quality, priority, isNotLazyload, enableLazyLoadImage, base64 = IMAGE_PLACEHOLDER, alt = NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = NEXT_IMAGE_CONFIG.DEFAULT_SRC } = props;
6
6
  const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
7
7
  const getLoadingAttrs = ()=>{
8
8
  const lazyLoadAttrs = {
@@ -24,12 +24,12 @@ const getNextImageReactAttrs = (props)=>{
24
24
  src,
25
25
  alt,
26
26
  width,
27
- height
27
+ height,
28
+ quality
28
29
  });
29
30
  const baseAttrs = getBaseAttrs();
30
31
  const loadingAttrs = createAttr(getLoadingAttrs());
31
32
  return {
32
- ...props,
33
33
  ...baseAttrs,
34
34
  ...loadingAttrs
35
35
  };
@@ -182,11 +182,11 @@ const SettingUIV2 = [
182
182
  type: 'select',
183
183
  options: [
184
184
  {
185
- label: 'Link variants, quantity between same products',
185
+ label: 'Link variants, quantity <br> between same products',
186
186
  value: true
187
187
  },
188
188
  {
189
- label: 'Unlink variants, quantity between same products',
189
+ label: 'Unlink variants, quantity <br> between same products',
190
190
  value: false
191
191
  }
192
192
  ],
@@ -2,7 +2,7 @@ import { getLiquidForAppBlock } from '../helpers/thirdParty.js';
2
2
 
3
3
  const RechargeSubscriptions = ({ setting, advanced })=>{
4
4
  const { align, appBlockId } = setting ?? {};
5
- return getLiquidForAppBlock(appBlockId, align, advanced?.cssClass);
5
+ return getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`);
6
6
  };
7
7
 
8
8
  export { RechargeSubscriptions as default };
@@ -50,8 +50,11 @@ const config = {
50
50
  options: [
51
51
  {
52
52
  label: 'Subscription Widget',
53
- value: 'subscription-widget',
54
- maxOption: 1
53
+ value: 'subscription-widget'
54
+ },
55
+ {
56
+ label: 'Subscription Widget 2.0',
57
+ value: 'subscription-widget-v2'
55
58
  }
56
59
  ],
57
60
  default: 'subscription-widget'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.293",
3
+ "version": "2.0.0-dev.294",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -22,7 +22,7 @@
22
22
  "relationship": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/get-control-relationship.js && node ./scripts/get-element-relationship.js"
23
23
  },
24
24
  "devDependencies": {
25
- "@gem-sdk/core": "2.0.0-dev.292",
25
+ "@gem-sdk/core": "2.0.0-dev.294",
26
26
  "@gem-sdk/styles": "2.0.0-dev.263",
27
27
  "@gem-sdk/system": "2.0.0-dev.263",
28
28
  "@types/react-transition-group": "^4.4.5"