@gem-sdk/components 2.1.19 → 2.1.20

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.
@@ -14,7 +14,7 @@ const ArticleList = ({ styles, setting, className, children, builderProps })=>{
14
14
  const { articleSetting, numberOfArticle } = setting ?? {};
15
15
  const { articleIds, articlePickType } = articleSetting ?? {};
16
16
  const articlesQuery = {
17
- first: 10,
17
+ first: articleIds?.length ?? 50,
18
18
  where: {
19
19
  baseIDIn: [
20
20
  ...articleSetting?.articleIds ?? []
@@ -134,6 +134,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
134
134
  tablet: helpers$1.createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
135
135
  mobile: helpers$1.createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
136
136
  };
137
+ const enableLazyLoad = !setting?.preload && enableLazyloadImage;
137
138
  const renderInnerHeroBanner = ()=>{
138
139
  return core.template /* liquid */ `
139
140
  <div
@@ -197,9 +198,10 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
197
198
  'clip-path': index.getClipPath(borderBg?.width, cornerBg)
198
199
  }}"
199
200
  >
200
- <div class="${core.cls('hero-banner-bg-parallax gp-hero-banner-image-background gp_lazybg', {
201
+ <div class="${core.cls('hero-banner-bg-parallax gp-hero-banner-image-background', {
201
202
  'gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)]': hoverEffect,
202
- 'gp-transition-transform': hoverEffect
203
+ 'gp-transition-transform': hoverEffect,
204
+ gp_lazybg: enableLazyLoad
203
205
  })}"
204
206
  style="${{
205
207
  ...core.getStyleBackgroundByDevice(background, {
@@ -208,9 +210,9 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
208
210
  liquid: true
209
211
  }),
210
212
  ...core.makeStyleResponsive('bgi', {
211
- desktop: `url('${bgiEnableByDevice['desktop'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
212
- tablet: `url('${bgiEnableByDevice['tablet'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
213
- mobile: `url('${bgiEnableByDevice['mobile'] ? setting?.preload || !enableLazyloadImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
213
+ desktop: `url('${bgiEnableByDevice['desktop'] ? !enableLazyLoad ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
214
+ tablet: `url('${bgiEnableByDevice['tablet'] ? !enableLazyLoad ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
215
+ mobile: `url('${bgiEnableByDevice['mobile'] ? !enableLazyLoad ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
214
216
  }),
215
217
  '--duration': `${hoverEffectDuration ?? 0}s`,
216
218
  '--scale': hoverEffectScale ?? 1,
@@ -218,6 +220,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
218
220
  ...index.getStyleHeroBannerBg(backgroundResponsive || {}, enableParallax)
219
221
  }}"
220
222
  >
223
+ ${embed()}
221
224
  ${!setting?.preload ? getSrcSet.DEVICES.map((device)=>{
222
225
  return core.RenderIf(getEnableBgImageByDevice(device), NextImage_liquid.default({
223
226
  src: getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device),
@@ -227,8 +230,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
227
230
  enableLazyloadImage
228
231
  }));
229
232
  }).join('') : ''}
230
- </div>
231
- ${embed()} </div>
233
+ </div></div>
232
234
  </div>
233
235
  ${core.RenderIf(overlayEnable, core.template`<div
234
236
  aria-label="Overlay"
@@ -27,13 +27,14 @@ const getHeightHeroBanner = (background, enableParallax)=>{
27
27
  'tablet'
28
28
  ];
29
29
  DEVICES.forEach((device)=>{
30
+ const enableParallaxDevice = background?.[device]?.type === 'image' ? enableParallax : false;
30
31
  const isScale = isScaleImage({
31
- enableParallax,
32
+ enableParallax: enableParallaxDevice,
32
33
  attachment: background[device]?.attachment
33
34
  });
34
35
  result = {
35
36
  ...result,
36
- [device]: enableParallax ? '150%' : isScale ? '100vh' : '100%'
37
+ [device]: enableParallaxDevice ? '150%' : isScale ? '100vh' : '100%'
37
38
  };
38
39
  });
39
40
  return core.makeStyleResponsive('h', result);
@@ -46,8 +47,9 @@ const getWidthHeroBanner = (background, enableParallax)=>{
46
47
  'tablet'
47
48
  ];
48
49
  DEVICES.forEach((device)=>{
50
+ const enableParallaxDevice = background?.[device]?.type === 'image' ? enableParallax : false;
49
51
  const isScale = isScaleImage({
50
- enableParallax,
52
+ enableParallax: enableParallaxDevice,
51
53
  attachment: background[device]?.attachment
52
54
  });
53
55
  result = {
@@ -6,10 +6,10 @@ var core = require('@gem-sdk/core');
6
6
  var helpers = require('../../../helpers.js');
7
7
 
8
8
  const FormTextarea = ({ setting, builderProps, className, builderAttrs, advanced, pageContext })=>{
9
- const { text, name, placeholder, required, width, fullWidth, typography } = setting ?? {};
9
+ const { text, name, placeholder, required, width, fullWidth, typography, translate } = setting ?? {};
10
10
  const textAreaWidth = core.makeStyleResponsive('w', core.makeWidth(width, fullWidth));
11
11
  const defaultName = name === '' || name === undefined ? 'contact[note]' : name;
12
- const { border, rounded, hasBoxShadow, boxShadow, pos, d, op, right, top, left, bottom, z, margin, padding, translate } = advanced ?? {};
12
+ const { border, rounded, hasBoxShadow, boxShadow, pos, d, op, right, top, left, bottom, z, margin, padding } = advanced ?? {};
13
13
  const spacingSetting = advanced?.['spacing-setting'];
14
14
  const inputStyle = core.composeAdvanceStyle({
15
15
  border,
@@ -80,7 +80,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
80
80
  style: {
81
81
  ...core.getStyleShadowState(styles?.boxShadowImg, 'box-shadow', styles?.hasBoxShadowImg),
82
82
  borderRadius: 'inherit',
83
- overflow: 'hidden',
84
83
  ...core.makeStyleResponsive('jc', styles?.align)
85
84
  },
86
85
  children: [
@@ -50,7 +50,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
50
50
  style="${{
51
51
  ...core.getStyleShadowState(styles?.boxShadowImg, 'box-shadow', styles?.hasBoxShadowImg),
52
52
  'border-radius': 'inherit',
53
- overflow: 'hidden',
54
53
  ...core.makeStyleResponsive('jc', styles?.align)
55
54
  }}"
56
55
  >
@@ -232,7 +232,7 @@ const config = {
232
232
  value: 'go-to-url'
233
233
  }
234
234
  ],
235
- default: 'continue-shopping'
235
+ default: 'open-cart-drawer'
236
236
  },
237
237
  {
238
238
  id: 'customURL',
@@ -761,7 +761,7 @@ const StickyPreset = {
761
761
  settings: {
762
762
  label: 'Add to cart',
763
763
  outOfStockLabel: 'Out of stock',
764
- actionEffect: 'continue-shopping',
764
+ actionEffect: 'open-cart-drawer',
765
765
  customURL: {
766
766
  link: '/cart',
767
767
  target: '_self'
@@ -1856,7 +1856,7 @@ const StickyPresetProduct = {
1856
1856
  settings: {
1857
1857
  label: 'Add to cart',
1858
1858
  outOfStockLabel: 'Out of stock',
1859
- actionEffect: 'continue-shopping',
1859
+ actionEffect: 'open-cart-drawer',
1860
1860
  customURL: {
1861
1861
  link: '/cart',
1862
1862
  target: '_self'
@@ -3,10 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@gem-sdk/core');
6
+ var thirdParty = require('../helpers/thirdParty.js');
6
7
 
7
8
  const ShopifySubscriptions = ({ setting, advanced })=>{
8
- const { align } = setting ?? {};
9
- return core.template`
9
+ const { align, widgetType, appBlockId } = setting ?? {};
10
+ return widgetType === 'app-block' ? thirdParty.getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`) : core.template`
10
11
  <div
11
12
  class="${advanced?.cssClass}"
12
13
  style="${{
@@ -42,6 +42,11 @@ const config = {
42
42
  {
43
43
  id: 'setting',
44
44
  controls: [
45
+ {
46
+ id: 'appBlockId',
47
+ type: 'input',
48
+ default: ''
49
+ },
45
50
  {
46
51
  id: 'install',
47
52
  type: 'open-link',
@@ -58,6 +63,23 @@ const config = {
58
63
  href: 'https://admin.shopify.com/?redirect=/apps/subscriptions-remix',
59
64
  appName: ShopifySubscriptions.AppConfig.label
60
65
  },
66
+ {
67
+ id: 'widgetType',
68
+ label: 'Choose widget',
69
+ type: 'select',
70
+ default: 'app-block',
71
+ options: [
72
+ {
73
+ label: 'app block',
74
+ value: 'app-block'
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ id: 'productHandle',
80
+ type: 'product-handle',
81
+ hide: true
82
+ },
61
83
  {
62
84
  id: 'align',
63
85
  label: 'Alignment',
@@ -10,7 +10,7 @@ const ArticleList = ({ styles, setting, className, children, builderProps })=>{
10
10
  const { articleSetting, numberOfArticle } = setting ?? {};
11
11
  const { articleIds, articlePickType } = articleSetting ?? {};
12
12
  const articlesQuery = {
13
- first: 10,
13
+ first: articleIds?.length ?? 50,
14
14
  where: {
15
15
  baseIDIn: [
16
16
  ...articleSetting?.articleIds ?? []
@@ -130,6 +130,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
130
130
  tablet: createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
131
131
  mobile: createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
132
132
  };
133
+ const enableLazyLoad = !setting?.preload && enableLazyloadImage;
133
134
  const renderInnerHeroBanner = ()=>{
134
135
  return template /* liquid */ `
135
136
  <div
@@ -193,9 +194,10 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
193
194
  'clip-path': getClipPath(borderBg?.width, cornerBg)
194
195
  }}"
195
196
  >
196
- <div class="${cls('hero-banner-bg-parallax gp-hero-banner-image-background gp_lazybg', {
197
+ <div class="${cls('hero-banner-bg-parallax gp-hero-banner-image-background', {
197
198
  'gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)]': hoverEffect,
198
- 'gp-transition-transform': hoverEffect
199
+ 'gp-transition-transform': hoverEffect,
200
+ gp_lazybg: enableLazyLoad
199
201
  })}"
200
202
  style="${{
201
203
  ...getStyleBackgroundByDevice(background, {
@@ -204,9 +206,9 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
204
206
  liquid: true
205
207
  }),
206
208
  ...makeStyleResponsive('bgi', {
207
- desktop: `url('${bgiEnableByDevice['desktop'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
208
- tablet: `url('${bgiEnableByDevice['tablet'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
209
- mobile: `url('${bgiEnableByDevice['mobile'] ? setting?.preload || !enableLazyloadImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
209
+ desktop: `url('${bgiEnableByDevice['desktop'] ? !enableLazyLoad ? getImageSrc(getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
210
+ tablet: `url('${bgiEnableByDevice['tablet'] ? !enableLazyLoad ? getImageSrc(getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
211
+ mobile: `url('${bgiEnableByDevice['mobile'] ? !enableLazyLoad ? getImageSrc(getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
210
212
  }),
211
213
  '--duration': `${hoverEffectDuration ?? 0}s`,
212
214
  '--scale': hoverEffectScale ?? 1,
@@ -214,6 +216,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
214
216
  ...getStyleHeroBannerBg(backgroundResponsive || {}, enableParallax)
215
217
  }}"
216
218
  >
219
+ ${embed()}
217
220
  ${!setting?.preload ? DEVICES.map((device)=>{
218
221
  return RenderIf(getEnableBgImageByDevice(device), NextImage({
219
222
  src: getImageSrc(getResponsiveValueByScreen(srcSet, device), device),
@@ -223,8 +226,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
223
226
  enableLazyloadImage
224
227
  }));
225
228
  }).join('') : ''}
226
- </div>
227
- ${embed()} </div>
229
+ </div></div>
228
230
  </div>
229
231
  ${RenderIf(overlayEnable, template`<div
230
232
  aria-label="Overlay"
@@ -25,13 +25,14 @@ const getHeightHeroBanner = (background, enableParallax)=>{
25
25
  'tablet'
26
26
  ];
27
27
  DEVICES.forEach((device)=>{
28
+ const enableParallaxDevice = background?.[device]?.type === 'image' ? enableParallax : false;
28
29
  const isScale = isScaleImage({
29
- enableParallax,
30
+ enableParallax: enableParallaxDevice,
30
31
  attachment: background[device]?.attachment
31
32
  });
32
33
  result = {
33
34
  ...result,
34
- [device]: enableParallax ? '150%' : isScale ? '100vh' : '100%'
35
+ [device]: enableParallaxDevice ? '150%' : isScale ? '100vh' : '100%'
35
36
  };
36
37
  });
37
38
  return makeStyleResponsive('h', result);
@@ -44,8 +45,9 @@ const getWidthHeroBanner = (background, enableParallax)=>{
44
45
  'tablet'
45
46
  ];
46
47
  DEVICES.forEach((device)=>{
48
+ const enableParallaxDevice = background?.[device]?.type === 'image' ? enableParallax : false;
47
49
  const isScale = isScaleImage({
48
- enableParallax,
50
+ enableParallax: enableParallaxDevice,
49
51
  attachment: background[device]?.attachment
50
52
  });
51
53
  result = {
@@ -2,10 +2,10 @@ import { makeStyleResponsive, makeWidth, composeAdvanceStyle, composeTypographyC
2
2
  import { getDynamicSourceLocales } from '../../../helpers.js';
3
3
 
4
4
  const FormTextarea = ({ setting, builderProps, className, builderAttrs, advanced, pageContext })=>{
5
- const { text, name, placeholder, required, width, fullWidth, typography } = setting ?? {};
5
+ const { text, name, placeholder, required, width, fullWidth, typography, translate } = setting ?? {};
6
6
  const textAreaWidth = makeStyleResponsive('w', makeWidth(width, fullWidth));
7
7
  const defaultName = name === '' || name === undefined ? 'contact[note]' : name;
8
- const { border, rounded, hasBoxShadow, boxShadow, pos, d, op, right, top, left, bottom, z, margin, padding, translate } = advanced ?? {};
8
+ const { border, rounded, hasBoxShadow, boxShadow, pos, d, op, right, top, left, bottom, z, margin, padding } = advanced ?? {};
9
9
  const spacingSetting = advanced?.['spacing-setting'];
10
10
  const inputStyle = composeAdvanceStyle({
11
11
  border,
@@ -76,7 +76,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
76
76
  style: {
77
77
  ...getStyleShadowState(styles?.boxShadowImg, 'box-shadow', styles?.hasBoxShadowImg),
78
78
  borderRadius: 'inherit',
79
- overflow: 'hidden',
80
79
  ...makeStyleResponsive('jc', styles?.align)
81
80
  },
82
81
  children: [
@@ -46,7 +46,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
46
46
  style="${{
47
47
  ...getStyleShadowState(styles?.boxShadowImg, 'box-shadow', styles?.hasBoxShadowImg),
48
48
  'border-radius': 'inherit',
49
- overflow: 'hidden',
50
49
  ...makeStyleResponsive('jc', styles?.align)
51
50
  }}"
52
51
  >
@@ -228,7 +228,7 @@ const config = {
228
228
  value: 'go-to-url'
229
229
  }
230
230
  ],
231
- default: 'continue-shopping'
231
+ default: 'open-cart-drawer'
232
232
  },
233
233
  {
234
234
  id: 'customURL',
@@ -759,7 +759,7 @@ const StickyPreset = {
759
759
  settings: {
760
760
  label: 'Add to cart',
761
761
  outOfStockLabel: 'Out of stock',
762
- actionEffect: 'continue-shopping',
762
+ actionEffect: 'open-cart-drawer',
763
763
  customURL: {
764
764
  link: '/cart',
765
765
  target: '_self'
@@ -1854,7 +1854,7 @@ const StickyPresetProduct = {
1854
1854
  settings: {
1855
1855
  label: 'Add to cart',
1856
1856
  outOfStockLabel: 'Out of stock',
1857
- actionEffect: 'continue-shopping',
1857
+ actionEffect: 'open-cart-drawer',
1858
1858
  customURL: {
1859
1859
  link: '/cart',
1860
1860
  target: '_self'
@@ -1,8 +1,9 @@
1
1
  import { template, makeStyleResponsive } from '@gem-sdk/core';
2
+ import { getLiquidForAppBlock } from '../helpers/thirdParty.js';
2
3
 
3
4
  const ShopifySubscriptions = ({ setting, advanced })=>{
4
- const { align } = setting ?? {};
5
- return template`
5
+ const { align, widgetType, appBlockId } = setting ?? {};
6
+ return widgetType === 'app-block' ? getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`) : template`
6
7
  <div
7
8
  class="${advanced?.cssClass}"
8
9
  style="${{
@@ -38,6 +38,11 @@ const config = {
38
38
  {
39
39
  id: 'setting',
40
40
  controls: [
41
+ {
42
+ id: 'appBlockId',
43
+ type: 'input',
44
+ default: ''
45
+ },
41
46
  {
42
47
  id: 'install',
43
48
  type: 'open-link',
@@ -54,6 +59,23 @@ const config = {
54
59
  href: 'https://admin.shopify.com/?redirect=/apps/subscriptions-remix',
55
60
  appName: AppConfig.label
56
61
  },
62
+ {
63
+ id: 'widgetType',
64
+ label: 'Choose widget',
65
+ type: 'select',
66
+ default: 'app-block',
67
+ options: [
68
+ {
69
+ label: 'app block',
70
+ value: 'app-block'
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ id: 'productHandle',
76
+ type: 'product-handle',
77
+ hide: true
78
+ },
57
79
  {
58
80
  id: 'align',
59
81
  label: 'Alignment',
@@ -2927,6 +2927,9 @@ type ShopifySubscriptionsProps = BaseProps<{
2927
2927
  align?: ObjectDevices<AlignProp>;
2928
2928
  openApp?: any;
2929
2929
  install?: any;
2930
+ appBlockId?: string;
2931
+ widgetType?: string;
2932
+ productHandle?: string;
2930
2933
  }>;
2931
2934
  declare const ShopifySubscriptions$1: React.FC<ShopifySubscriptionsProps>;
2932
2935
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.1.19",
3
+ "version": "2.1.20",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -21,7 +21,7 @@
21
21
  "format": "prettier --write \"./src/**/*.{ts,tsx}\""
22
22
  },
23
23
  "devDependencies": {
24
- "@gem-sdk/core": "2.1.18",
24
+ "@gem-sdk/core": "2.1.20",
25
25
  "@gem-sdk/styles": "2.1.0",
26
26
  "@types/react-transition-group": "^4.4.5"
27
27
  },