@gem-sdk/components 2.0.0-dev.625 → 2.0.0-dev.628

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.
@@ -65,7 +65,8 @@ const CollectionPaginatorSettings = [
65
65
  ],
66
66
  step: 1,
67
67
  max: 40,
68
- default: '12px'
68
+ default: '12px',
69
+ ignoreMax: true
69
70
  },
70
71
  {
71
72
  id: 'text',
@@ -61,7 +61,7 @@ const getTextContent = ({ type, styles, setting, builderProps, pageContext })=>{
61
61
  const estimateClasses = system.createClass({
62
62
  'estimate-date-main': true
63
63
  });
64
- const textWithTranslate = isReact ? setting?.customText : helpers.getDynamicSourceLocales({
64
+ const textWithTranslate = isReact || pageContext?.isPreviewing ? setting?.customText : helpers.getDynamicSourceLocales({
65
65
  val: setting?.customText,
66
66
  uid: builderProps?.uid,
67
67
  settingId: setting?.translate || '',
@@ -212,7 +212,7 @@ const LineSettings = [
212
212
  ],
213
213
  devices: {
214
214
  desktop: {
215
- default: 'left'
215
+ default: 'center'
216
216
  }
217
217
  }
218
218
  },
@@ -896,6 +896,7 @@ const SettingUIV2 = [
896
896
  conditionDisplay: "enableMessage === true && actionEffect === 'continue-shopping'",
897
897
  type: 'combo',
898
898
  getValueFromSettingID: 'successMessage',
899
+ compoDefaultValue: 'Add product to cart successfully',
899
900
  iconName: 'polaris-check-circle',
900
901
  isHideClear: true,
901
902
  popoverLabel: {
@@ -927,6 +928,7 @@ const SettingUIV2 = [
927
928
  fixedValue: 'Edit',
928
929
  iconName: 'polaris-alert-bubble',
929
930
  getValueFromSettingID: 'errorMessage',
931
+ compoDefaultValue: 'Cannot add product to cart',
930
932
  isHideClear: true,
931
933
  popoverLabel: {
932
934
  en: 'Error message'
@@ -52,6 +52,7 @@ const HTML5Embed = (props)=>{
52
52
  src: thumbnail,
53
53
  alt: title,
54
54
  priority: preload,
55
+ enableLazyLoadImage: true,
55
56
  style: preloadImageStyle
56
57
  })}
57
58
  ${system.If(autoplay, `<script>
@@ -11,13 +11,13 @@ var index = require('./common/index.js');
11
11
  var NextImage_liquid = require('../../image/components/NextImage.liquid.js');
12
12
 
13
13
  const LiteVimeoEmbed = (props)=>{
14
- const { title, id, lazy, aspectRatio, autoplay, muted } = props;
14
+ const { title, id, lazy, aspectRatio, autoplay, muted, preload, thumbnailLink } = props;
15
15
  const { iframeSrc } = index.getVimeoParams(props);
16
16
  const iframe = !lazy;
17
17
  const posterUrl = props.thumbnail;
18
18
  const stateVimeo = system.createStateOrContext({
19
19
  id,
20
- thumbnail: posterUrl,
20
+ thumbnail: thumbnailLink,
21
21
  lazy,
22
22
  iframeSrc,
23
23
  title,
@@ -51,12 +51,14 @@ const LiteVimeoEmbed = (props)=>{
51
51
  data-title="${title}"
52
52
  style="${articleVimeoStyle}"
53
53
  >
54
- ${system.If(!iframe, core.template`
55
- ${NextImage_liquid.default({
54
+ ${system.If(!iframe, core.template`
55
+ ${NextImage_liquid.default({
56
56
  src: posterUrl,
57
57
  alt: title,
58
- className: imageVimeoClasses
59
- })}}`)}
58
+ className: imageVimeoClasses,
59
+ enableLazyLoadImage: true,
60
+ priority: preload
61
+ })}`)}
60
62
  ${system.If(!iframe, core.template`
61
63
  <button type="button" class="${buttonVimeoClasses}" aria-label="Play">
62
64
  <svg class="gp-w-5 gp-text-white" viewBox="0 0 24 24">
@@ -19,7 +19,7 @@ const LiteVimeoEmbed = dynamic(()=>Promise.resolve().then(function () { return r
19
19
  const LiteYouTubeEmbed = dynamic(()=>Promise.resolve().then(function () { return require('./LiteYouTubeEmbed.js'); }));
20
20
  const Video = ({ className, setting, style, builderAttrs, builderProps, advanced, children })=>{
21
21
  const mode = core.useEditorMode();
22
- const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, preload, startTime, endTime } = setting ?? {};
22
+ const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
23
23
  const { cssClass: advancedCssClass } = advanced ?? {};
24
24
  const posterSrc = poster?.src;
25
25
  const isInstantLP = mode !== 'edit';
@@ -76,7 +76,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
76
76
  muted: !mute,
77
77
  thumbnail: posterSrc,
78
78
  lazy: setting.lazy ?? true,
79
- preload: preload,
79
+ preload: poster?.preload,
80
80
  style: youtubeStyle
81
81
  });
82
82
  }
@@ -94,6 +94,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
94
94
  id: videoId,
95
95
  title: "Video",
96
96
  aspectRatio: aspectRatio,
97
+ preload: poster?.preload,
97
98
  vimeoStyleIframe: vimeoStyle
98
99
  });
99
100
  }
@@ -108,7 +109,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
108
109
  src: html5Url,
109
110
  thumbnail: posterSrc,
110
111
  title: "Video",
111
- preload: preload,
112
+ preload: poster?.preload,
112
113
  lazy: setting.lazy ?? true,
113
114
  isVideoComponent: true,
114
115
  style: html5Style
@@ -129,7 +130,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
129
130
  setting?.type,
130
131
  setting?.lazy,
131
132
  posterSrc,
132
- preload,
133
+ poster?.preload,
133
134
  vimeoStyle,
134
135
  youtubeStyle,
135
136
  html5Style
@@ -15,7 +15,7 @@ var LiteYouTubeEmbed_liquid = require('./LiteYouTubeEmbed.liquid.js');
15
15
  var getSrcSet = require('../../image/helpers/getSrcSet.js');
16
16
 
17
17
  const Video = ({ className, setting, style, builderAttrs, builderProps, advanced })=>{
18
- const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, preload, startTime, endTime } = setting ?? {};
18
+ const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
19
19
  const posterSrc = getSrcSet.getImageSrc(poster);
20
20
  const { cssClass: advancedCssClass } = advanced ?? {};
21
21
  const isInstantLP = false;
@@ -61,7 +61,6 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
61
61
  if (endTime) {
62
62
  params += `&end=${common.parseTimeVideo(endTime)}`;
63
63
  }
64
- console.log('autoplay', autoplay);
65
64
  return LiteYouTubeEmbed_liquid.default({
66
65
  uid: builderProps?.uid,
67
66
  id: videoId,
@@ -74,7 +73,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
74
73
  muted: !mute,
75
74
  thumbnail: posterSrc,
76
75
  lazy: setting.lazy ?? true,
77
- preload: setting.preload,
76
+ preload: poster?.preload,
78
77
  style: youtubeStyle
79
78
  });
80
79
  }
@@ -87,11 +86,13 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
87
86
  loop: loopVideo,
88
87
  controls,
89
88
  thumbnail: posterSrc,
89
+ thumbnailLink: poster?.src,
90
90
  autoplay: autoplay,
91
91
  lazy: setting.lazy ?? true,
92
92
  id: videoId,
93
93
  title: 'Video',
94
94
  aspectRatio: aspectRatio,
95
+ preload: poster?.preload,
95
96
  vimeoStyleIframe: vimeoStyle
96
97
  });
97
98
  }
@@ -107,7 +108,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
107
108
  src: html5Url,
108
109
  thumbnail: posterSrc,
109
110
  title: 'Video',
110
- preload,
111
+ preload: poster?.preload,
111
112
  lazy: setting.lazy ?? true,
112
113
  isVideoComponent: true,
113
114
  style: html5Style
@@ -78,7 +78,7 @@ const getImageVimeoClasses = ()=>{
78
78
  };
79
79
  };
80
80
  const getButtonVimeoClasses = ()=>{
81
- const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button gp-pointer-events-none`;
81
+ const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button`;
82
82
  return {
83
83
  ...composeClasses(classList)
84
84
  };
@@ -25,7 +25,7 @@ const listSourceVideoSupport = [
25
25
  '.mov'
26
26
  ];
27
27
  const getYoutubeParams = (props)=>{
28
- const { id, poster, params, muted, webp, controls, adNetwork, autoplay } = props;
28
+ const { id, poster, params, muted, webp, controls, adNetwork, autoplay, lazy } = props;
29
29
  const videoId = encodeURIComponent(id);
30
30
  const posterImp = poster || 'hqdefault';
31
31
  const paramsImp = `${params}` || '';
@@ -34,7 +34,7 @@ const getYoutubeParams = (props)=>{
34
34
  const vi = webp ? 'vi_webp' : 'vi';
35
35
  const posterUrl = props.thumbnail || `https://i.ytimg.com/${vi}/${videoId}/${posterImp}.${format}`;
36
36
  const ytUrl = props.noCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com';
37
- const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
37
+ const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${lazy ? true : autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
38
38
  const adNetworkImp = adNetwork || false;
39
39
  return {
40
40
  videoId,
@@ -63,7 +63,8 @@ const CollectionPaginatorSettings = [
63
63
  ],
64
64
  step: 1,
65
65
  max: 40,
66
- default: '12px'
66
+ default: '12px',
67
+ ignoreMax: true
67
68
  },
68
69
  {
69
70
  id: 'text',
@@ -59,7 +59,7 @@ const getTextContent = ({ type, styles, setting, builderProps, pageContext })=>{
59
59
  const estimateClasses = createClass({
60
60
  'estimate-date-main': true
61
61
  });
62
- const textWithTranslate = isReact ? setting?.customText : getDynamicSourceLocales({
62
+ const textWithTranslate = isReact || pageContext?.isPreviewing ? setting?.customText : getDynamicSourceLocales({
63
63
  val: setting?.customText,
64
64
  uid: builderProps?.uid,
65
65
  settingId: setting?.translate || '',
@@ -210,7 +210,7 @@ const LineSettings = [
210
210
  ],
211
211
  devices: {
212
212
  desktop: {
213
- default: 'left'
213
+ default: 'center'
214
214
  }
215
215
  }
216
216
  },
@@ -894,6 +894,7 @@ const SettingUIV2 = [
894
894
  conditionDisplay: "enableMessage === true && actionEffect === 'continue-shopping'",
895
895
  type: 'combo',
896
896
  getValueFromSettingID: 'successMessage',
897
+ compoDefaultValue: 'Add product to cart successfully',
897
898
  iconName: 'polaris-check-circle',
898
899
  isHideClear: true,
899
900
  popoverLabel: {
@@ -925,6 +926,7 @@ const SettingUIV2 = [
925
926
  fixedValue: 'Edit',
926
927
  iconName: 'polaris-alert-bubble',
927
928
  getValueFromSettingID: 'errorMessage',
929
+ compoDefaultValue: 'Cannot add product to cart',
928
930
  isHideClear: true,
929
931
  popoverLabel: {
930
932
  en: 'Error message'
@@ -48,6 +48,7 @@ const HTML5Embed = (props)=>{
48
48
  src: thumbnail,
49
49
  alt: title,
50
50
  priority: preload,
51
+ enableLazyLoadImage: true,
51
52
  style: preloadImageStyle
52
53
  })}
53
54
  ${If(autoplay, `<script>
@@ -7,13 +7,13 @@ import { getVimeoParams } from './common/index.js';
7
7
  import NextImage from '../../image/components/NextImage.liquid.js';
8
8
 
9
9
  const LiteVimeoEmbed = (props)=>{
10
- const { title, id, lazy, aspectRatio, autoplay, muted } = props;
10
+ const { title, id, lazy, aspectRatio, autoplay, muted, preload, thumbnailLink } = props;
11
11
  const { iframeSrc } = getVimeoParams(props);
12
12
  const iframe = !lazy;
13
13
  const posterUrl = props.thumbnail;
14
14
  const stateVimeo = createStateOrContext({
15
15
  id,
16
- thumbnail: posterUrl,
16
+ thumbnail: thumbnailLink,
17
17
  lazy,
18
18
  iframeSrc,
19
19
  title,
@@ -47,12 +47,14 @@ const LiteVimeoEmbed = (props)=>{
47
47
  data-title="${title}"
48
48
  style="${articleVimeoStyle}"
49
49
  >
50
- ${If(!iframe, template`
51
- ${NextImage({
50
+ ${If(!iframe, template`
51
+ ${NextImage({
52
52
  src: posterUrl,
53
53
  alt: title,
54
- className: imageVimeoClasses
55
- })}}`)}
54
+ className: imageVimeoClasses,
55
+ enableLazyLoadImage: true,
56
+ priority: preload
57
+ })}`)}
56
58
  ${If(!iframe, template`
57
59
  <button type="button" class="${buttonVimeoClasses}" aria-label="Play">
58
60
  <svg class="gp-w-5 gp-text-white" viewBox="0 0 24 24">
@@ -15,7 +15,7 @@ const LiteVimeoEmbed = dynamic(()=>import('./LiteVimeoEmbed.js'));
15
15
  const LiteYouTubeEmbed = dynamic(()=>import('./LiteYouTubeEmbed.js'));
16
16
  const Video = ({ className, setting, style, builderAttrs, builderProps, advanced, children })=>{
17
17
  const mode = useEditorMode();
18
- const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, preload, startTime, endTime } = setting ?? {};
18
+ const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
19
19
  const { cssClass: advancedCssClass } = advanced ?? {};
20
20
  const posterSrc = poster?.src;
21
21
  const isInstantLP = mode !== 'edit';
@@ -72,7 +72,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
72
72
  muted: !mute,
73
73
  thumbnail: posterSrc,
74
74
  lazy: setting.lazy ?? true,
75
- preload: preload,
75
+ preload: poster?.preload,
76
76
  style: youtubeStyle
77
77
  });
78
78
  }
@@ -90,6 +90,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
90
90
  id: videoId,
91
91
  title: "Video",
92
92
  aspectRatio: aspectRatio,
93
+ preload: poster?.preload,
93
94
  vimeoStyleIframe: vimeoStyle
94
95
  });
95
96
  }
@@ -104,7 +105,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
104
105
  src: html5Url,
105
106
  thumbnail: posterSrc,
106
107
  title: "Video",
107
- preload: preload,
108
+ preload: poster?.preload,
108
109
  lazy: setting.lazy ?? true,
109
110
  isVideoComponent: true,
110
111
  style: html5Style
@@ -125,7 +126,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
125
126
  setting?.type,
126
127
  setting?.lazy,
127
128
  posterSrc,
128
- preload,
129
+ poster?.preload,
129
130
  vimeoStyle,
130
131
  youtubeStyle,
131
132
  html5Style
@@ -11,7 +11,7 @@ import LiteYouTubeEmbed from './LiteYouTubeEmbed.liquid.js';
11
11
  import { getImageSrc } from '../../image/helpers/getSrcSet.js';
12
12
 
13
13
  const Video = ({ className, setting, style, builderAttrs, builderProps, advanced })=>{
14
- const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, preload, startTime, endTime } = setting ?? {};
14
+ const { youtubeUrl = '', vimeoUrl = '', html5Url, autoplay = false, loopVideo = false, controls = false, mute, poster, startTime, endTime } = setting ?? {};
15
15
  const posterSrc = getImageSrc(poster);
16
16
  const { cssClass: advancedCssClass } = advanced ?? {};
17
17
  const isInstantLP = false;
@@ -57,7 +57,6 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
57
57
  if (endTime) {
58
58
  params += `&end=${parseTimeVideo(endTime)}`;
59
59
  }
60
- console.log('autoplay', autoplay);
61
60
  return LiteYouTubeEmbed({
62
61
  uid: builderProps?.uid,
63
62
  id: videoId,
@@ -70,7 +69,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
70
69
  muted: !mute,
71
70
  thumbnail: posterSrc,
72
71
  lazy: setting.lazy ?? true,
73
- preload: setting.preload,
72
+ preload: poster?.preload,
74
73
  style: youtubeStyle
75
74
  });
76
75
  }
@@ -83,11 +82,13 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
83
82
  loop: loopVideo,
84
83
  controls,
85
84
  thumbnail: posterSrc,
85
+ thumbnailLink: poster?.src,
86
86
  autoplay: autoplay,
87
87
  lazy: setting.lazy ?? true,
88
88
  id: videoId,
89
89
  title: 'Video',
90
90
  aspectRatio: aspectRatio,
91
+ preload: poster?.preload,
91
92
  vimeoStyleIframe: vimeoStyle
92
93
  });
93
94
  }
@@ -103,7 +104,7 @@ const Video = ({ className, setting, style, builderAttrs, builderProps, advanced
103
104
  src: html5Url,
104
105
  thumbnail: posterSrc,
105
106
  title: 'Video',
106
- preload,
107
+ preload: poster?.preload,
107
108
  lazy: setting.lazy ?? true,
108
109
  isVideoComponent: true,
109
110
  style: html5Style
@@ -76,7 +76,7 @@ const getImageVimeoClasses = ()=>{
76
76
  };
77
77
  };
78
78
  const getButtonVimeoClasses = ()=>{
79
- const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button gp-pointer-events-none`;
79
+ const classList = `gp-absolute gp-left-1/2 gp-top-1/2 gp-flex gp-aspect-[56/32] gp-w-14 -gp-translate-x-1/2 -gp-translate-y-1/2 gp-items-center gp-justify-center gp-rounded gp-bg-black/80 gp-transition-colors hover:gp-bg-[#ef0800] gp-z-10 gp-lite-vimeo-embed-button`;
80
80
  return {
81
81
  ...composeClasses(classList)
82
82
  };
@@ -23,7 +23,7 @@ const listSourceVideoSupport = [
23
23
  '.mov'
24
24
  ];
25
25
  const getYoutubeParams = (props)=>{
26
- const { id, poster, params, muted, webp, controls, adNetwork, autoplay } = props;
26
+ const { id, poster, params, muted, webp, controls, adNetwork, autoplay, lazy } = props;
27
27
  const videoId = encodeURIComponent(id);
28
28
  const posterImp = poster || 'hqdefault';
29
29
  const paramsImp = `${params}` || '';
@@ -32,7 +32,7 @@ const getYoutubeParams = (props)=>{
32
32
  const vi = webp ? 'vi_webp' : 'vi';
33
33
  const posterUrl = props.thumbnail || `https://i.ytimg.com/${vi}/${videoId}/${posterImp}.${format}`;
34
34
  const ytUrl = props.noCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com';
35
- const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
35
+ const iframeSrc = `${ytUrl}/embed/${videoId}?autoplay=${lazy ? true : autoplay}&state=1${mutedImp}${paramsImp}&controls=${controls ? 1 : 0}`;
36
36
  const adNetworkImp = adNetwork || false;
37
37
  return {
38
38
  videoId,
@@ -4418,6 +4418,7 @@ type PosterProps = {
4418
4418
  base64?: string;
4419
4419
  backupFileKey?: string;
4420
4420
  storage?: 'THEME' | 'FILE_CONTENT';
4421
+ preload?: boolean;
4421
4422
  };
4422
4423
  type VideoProps = BasePropsWrap<{
4423
4424
  ratioOptions?: ObjectDevices$1<Ratio>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.625",
3
+ "version": "2.0.0-dev.628",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",