@gem-sdk/core 1.23.0-staging.305 → 1.23.0-staging.309

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.
@@ -49,11 +49,21 @@ const getBgImageByDevice = (background, device, options)=>{
49
49
  const isBgVideo = background?.[device]?.type === 'video';
50
50
  if (isBgVideo) return;
51
51
  const backupFileKey = background?.[device]?.image?.backupFileKey;
52
- const imageByDevice = options?.liquid && backupFileKey && `{{ "${backupFileKey}" | asset_url }}` || background?.[device]?.image?.src;
52
+ const storage = background?.[device]?.image?.storage;
53
+ let imageByDevice = background?.[device]?.image?.src;
54
+ if (storage === 'FILE_CONTENT') {
55
+ if (options?.liquid && backupFileKey) {
56
+ imageByDevice = `{{ "${backupFileKey.replace('.jpeg', '.jpg')}" | file_url }}`;
57
+ }
58
+ }
59
+ if (storage === 'THEME' || !storage) {
60
+ if (options?.liquid && backupFileKey) {
61
+ imageByDevice = `{{ "${backupFileKey}" | asset_url }}`;
62
+ }
63
+ }
53
64
  if (typeof imageByDevice === 'string') {
54
65
  return `url(${imageByDevice})`;
55
66
  }
56
- return;
57
67
  };
58
68
  const getStyleBgPosition = (background)=>{
59
69
  const bgPosition = {
@@ -155,6 +155,7 @@ const getSingleColorVariable = (color)=>{
155
155
  return `var(--g-c-${color}, ${color})`;
156
156
  };
157
157
  function isColor(color) {
158
+ if (!color || typeof color !== 'string') return false;
158
159
  return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
159
160
  }
160
161
  const getGlobalColorStyle = (data)=>{
@@ -47,11 +47,21 @@ const getBgImageByDevice = (background, device, options)=>{
47
47
  const isBgVideo = background?.[device]?.type === 'video';
48
48
  if (isBgVideo) return;
49
49
  const backupFileKey = background?.[device]?.image?.backupFileKey;
50
- const imageByDevice = options?.liquid && backupFileKey && `{{ "${backupFileKey}" | asset_url }}` || background?.[device]?.image?.src;
50
+ const storage = background?.[device]?.image?.storage;
51
+ let imageByDevice = background?.[device]?.image?.src;
52
+ if (storage === 'FILE_CONTENT') {
53
+ if (options?.liquid && backupFileKey) {
54
+ imageByDevice = `{{ "${backupFileKey.replace('.jpeg', '.jpg')}" | file_url }}`;
55
+ }
56
+ }
57
+ if (storage === 'THEME' || !storage) {
58
+ if (options?.liquid && backupFileKey) {
59
+ imageByDevice = `{{ "${backupFileKey}" | asset_url }}`;
60
+ }
61
+ }
51
62
  if (typeof imageByDevice === 'string') {
52
63
  return `url(${imageByDevice})`;
53
64
  }
54
- return;
55
65
  };
56
66
  const getStyleBgPosition = (background)=>{
57
67
  const bgPosition = {
@@ -153,6 +153,7 @@ const getSingleColorVariable = (color)=>{
153
153
  return `var(--g-c-${color}, ${color})`;
154
154
  };
155
155
  function isColor(color) {
156
+ if (!color || typeof color !== 'string') return false;
156
157
  return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
157
158
  }
158
159
  const getGlobalColorStyle = (data)=>{
@@ -669,6 +669,8 @@ type Background = {
669
669
  width?: number;
670
670
  height?: number;
671
671
  backupFileKey?: string;
672
+ storage?: 'THEME' | 'FILE_CONTENT';
673
+ backupFilePath?: string;
672
674
  };
673
675
  size?: BgSize;
674
676
  position?: BgPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.305",
3
+ "version": "1.23.0-staging.309",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",