@gem-sdk/core 1.22.31-staging.1 → 1.22.31-staging.23

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.
@@ -6,22 +6,39 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var react = require('react');
7
7
  var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
8
8
  var constant = require('./constant.js');
9
+ var RenderCustomCode = require('./RenderCustomCode.js');
9
10
 
10
11
  const ComponentWrapper = ({ children, ...props })=>{
11
12
  if (props.type === 'section') return null;
12
13
  const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
13
14
  const advanced = props.advanced;
14
15
  if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
15
- return /*#__PURE__*/ jsxRuntime.jsx(children.type, {
16
- ...children.props,
17
- style,
18
- advanced
16
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
17
+ children: [
18
+ /*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
19
+ uid: props.uid,
20
+ advanced: advanced
21
+ }),
22
+ /*#__PURE__*/ jsxRuntime.jsx(children.type, {
23
+ ...children.props,
24
+ style,
25
+ advanced
26
+ })
27
+ ]
19
28
  });
20
29
  }
21
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
22
- style: style,
23
- className: `${props.uid}`,
24
- children: children
30
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
31
+ children: [
32
+ /*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
33
+ uid: props.uid,
34
+ advanced: advanced
35
+ }),
36
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
37
+ style: style,
38
+ className: `${props.uid}`,
39
+ children: children
40
+ })
41
+ ]
25
42
  });
26
43
  };
27
44
 
@@ -86,10 +86,12 @@ const setDefaultSwatches = (swatches, options)=>{
86
86
  });
87
87
  }
88
88
  });
89
- sw.optionValues.map((op)=>{
89
+ sw.optionValues = sw.optionValues.map((op)=>{
90
+ if (op.imageUrl === undefined) swatchChange = true;
90
91
  return {
91
- ...op,
92
- colors: getColorDefault(op.label, op.colors)
92
+ label: op.label ?? '',
93
+ colors: getColorDefault(op.label, op.colors),
94
+ imageUrl: op.imageUrl ?? ''
93
95
  };
94
96
  });
95
97
  });
@@ -141,8 +141,7 @@ const useCurrentVariant = ()=>{
141
141
  };
142
142
  const useCurrentVariantInStock = ()=>{
143
143
  const currentVariant = useCurrentVariant();
144
- const isInStock = variant.checkInStock(currentVariant);
145
- return isInStock;
144
+ return variant.checkInStock(currentVariant);
146
145
  };
147
146
  const useVariantOutStock = (optionId, optionValue)=>{
148
147
  const { selectedOptions } = useSelectedOption();
@@ -1,23 +1,40 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { isValidElement } from 'react';
3
3
  import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
4
4
  import { disableWrap } from './constant.js';
5
+ import RenderCustomCode from './RenderCustomCode.js';
5
6
 
6
7
  const ComponentWrapper = ({ children, ...props })=>{
7
8
  if (props.type === 'section') return null;
8
9
  const style = composeAdvanceStyle(props.advanced, props.tag);
9
10
  const advanced = props.advanced;
10
11
  if (disableWrap.includes(props.tag) && /*#__PURE__*/ isValidElement(children)) {
11
- return /*#__PURE__*/ jsx(children.type, {
12
- ...children.props,
13
- style,
14
- advanced
12
+ return /*#__PURE__*/ jsxs(Fragment, {
13
+ children: [
14
+ /*#__PURE__*/ jsx(RenderCustomCode, {
15
+ uid: props.uid,
16
+ advanced: advanced
17
+ }),
18
+ /*#__PURE__*/ jsx(children.type, {
19
+ ...children.props,
20
+ style,
21
+ advanced
22
+ })
23
+ ]
15
24
  });
16
25
  }
17
- return /*#__PURE__*/ jsx("div", {
18
- style: style,
19
- className: `${props.uid}`,
20
- children: children
26
+ return /*#__PURE__*/ jsxs(Fragment, {
27
+ children: [
28
+ /*#__PURE__*/ jsx(RenderCustomCode, {
29
+ uid: props.uid,
30
+ advanced: advanced
31
+ }),
32
+ /*#__PURE__*/ jsx("div", {
33
+ style: style,
34
+ className: `${props.uid}`,
35
+ children: children
36
+ })
37
+ ]
21
38
  });
22
39
  };
23
40
 
@@ -82,10 +82,12 @@ const setDefaultSwatches = (swatches, options)=>{
82
82
  });
83
83
  }
84
84
  });
85
- sw.optionValues.map((op)=>{
85
+ sw.optionValues = sw.optionValues.map((op)=>{
86
+ if (op.imageUrl === undefined) swatchChange = true;
86
87
  return {
87
- ...op,
88
- colors: getColorDefault(op.label, op.colors)
88
+ label: op.label ?? '',
89
+ colors: getColorDefault(op.label, op.colors),
90
+ imageUrl: op.imageUrl ?? ''
89
91
  };
90
92
  });
91
93
  });
@@ -139,8 +139,7 @@ const useCurrentVariant = ()=>{
139
139
  };
140
140
  const useCurrentVariantInStock = ()=>{
141
141
  const currentVariant = useCurrentVariant();
142
- const isInStock = checkInStock(currentVariant);
143
- return isInStock;
142
+ return checkInStock(currentVariant);
144
143
  };
145
144
  const useVariantOutStock = (optionId, optionValue)=>{
146
145
  const { selectedOptions } = useSelectedOption();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.22.31-staging.1",
3
+ "version": "1.22.31-staging.23",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",