@gem-sdk/core 1.27.1 → 1.27.11
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.
|
@@ -25,7 +25,11 @@ const componentTexts = [
|
|
|
25
25
|
'Heading'
|
|
26
26
|
];
|
|
27
27
|
const componentIconList = [
|
|
28
|
-
'IconListV2'
|
|
28
|
+
'IconListV2',
|
|
29
|
+
'IconList'
|
|
30
|
+
];
|
|
31
|
+
const componentUsingAdvanced = [
|
|
32
|
+
'IconList'
|
|
29
33
|
];
|
|
30
34
|
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
31
35
|
const item = builder[uid];
|
|
@@ -117,6 +121,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
117
121
|
styles: item.styles,
|
|
118
122
|
setting: item.settings,
|
|
119
123
|
advanced: {
|
|
124
|
+
...componentUsingAdvanced.includes(item.tag) ? item?.advanced : {},
|
|
120
125
|
cssClass: item?.advanced?.cssClass
|
|
121
126
|
},
|
|
122
127
|
pageContext,
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
var variant = require('./variant.js');
|
|
4
4
|
|
|
5
|
-
function getSelectedVariant(variants, choices) {
|
|
5
|
+
function getSelectedVariant(variants, choices, variantId) {
|
|
6
6
|
/**
|
|
7
7
|
* Ensure the user has selected all the required options, not just some.
|
|
8
8
|
*/ if (!variants || !variants.length || !choices || variants[0]?.selectedOptions.length !== Object.keys(choices).length) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
+
if (variantId) {
|
|
12
|
+
return variants.find((variant)=>variant?.id === variantId);
|
|
13
|
+
}
|
|
11
14
|
return variants.find((variant)=>{
|
|
12
15
|
return Object.entries(choices).every(([name, value])=>{
|
|
13
16
|
return variant?.selectedOptions.some((option)=>option.name === name && option.value === value);
|
|
@@ -21,7 +21,11 @@ const componentTexts = [
|
|
|
21
21
|
'Heading'
|
|
22
22
|
];
|
|
23
23
|
const componentIconList = [
|
|
24
|
-
'IconListV2'
|
|
24
|
+
'IconListV2',
|
|
25
|
+
'IconList'
|
|
26
|
+
];
|
|
27
|
+
const componentUsingAdvanced = [
|
|
28
|
+
'IconList'
|
|
25
29
|
];
|
|
26
30
|
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
27
31
|
const item = builder[uid];
|
|
@@ -113,6 +117,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
113
117
|
styles: item.styles,
|
|
114
118
|
setting: item.settings,
|
|
115
119
|
advanced: {
|
|
120
|
+
...componentUsingAdvanced.includes(item.tag) ? item?.advanced : {},
|
|
116
121
|
cssClass: item?.advanced?.cssClass
|
|
117
122
|
},
|
|
118
123
|
pageContext,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { checkInStock } from './variant.js';
|
|
2
2
|
|
|
3
|
-
function getSelectedVariant(variants, choices) {
|
|
3
|
+
function getSelectedVariant(variants, choices, variantId) {
|
|
4
4
|
/**
|
|
5
5
|
* Ensure the user has selected all the required options, not just some.
|
|
6
6
|
*/ if (!variants || !variants.length || !choices || variants[0]?.selectedOptions.length !== Object.keys(choices).length) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
+
if (variantId) {
|
|
10
|
+
return variants.find((variant)=>variant?.id === variantId);
|
|
11
|
+
}
|
|
9
12
|
return variants.find((variant)=>{
|
|
10
13
|
return Object.entries(choices).every(([name, value])=>{
|
|
11
14
|
return variant?.selectedOptions.some((option)=>option.name === name && option.value === value);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9515,7 +9515,7 @@ declare const composeRadiusResponsive: (radiusValue?: ObjectDevices<CornerRadius
|
|
|
9515
9515
|
declare const getRadiusStyleActiveState: (radiusValue?: StateProp<CornerRadius>) => React.CSSProperties;
|
|
9516
9516
|
declare const composeCornerCss: (value?: CornerRadius | undefined, important?: boolean) => string | undefined;
|
|
9517
9517
|
|
|
9518
|
-
declare function getSelectedVariant(variants?: Maybe<VariantSelectFragment>[], choices?: Record<string, string
|
|
9518
|
+
declare function getSelectedVariant(variants?: Maybe<VariantSelectFragment>[], choices?: Record<string, string>, variantId?: string | null): Maybe<VariantSelectFragment>;
|
|
9519
9519
|
declare function parseSelectedOption(options: SelectedOption[]): SelectedOption | undefined;
|
|
9520
9520
|
declare function checkAvailableVariantInStock(variants: Maybe<VariantSelectFragment>[] | undefined, optionId: string, optionValue: string): boolean;
|
|
9521
9521
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@gem-sdk/adapter-shopify": "1.25.0",
|
|
28
|
-
"@gem-sdk/styles": "1.
|
|
28
|
+
"@gem-sdk/styles": "1.27.9"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|