@gem-sdk/components 2.0.0-dev.723 → 2.0.0-dev.724
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.
- package/dist/cjs/product/components/ProductVariants/hooks/useGpVariants.js +3 -2
- package/dist/cjs/product/components/ProductWrap/hook/useProductSetting.js +2 -1
- package/dist/cjs/product/setting/product-variant/configs/uiV2.js +1 -10
- package/dist/esm/product/components/ProductVariants/hooks/useGpVariants.js +3 -2
- package/dist/esm/product/components/ProductWrap/hook/useProductSetting.js +2 -1
- package/dist/esm/product/setting/product-variant/configs/uiV2.js +1 -10
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -22,14 +22,15 @@ const useGpVariants = (props, variants)=>{
|
|
|
22
22
|
});
|
|
23
23
|
const mode = core.useEditorMode();
|
|
24
24
|
const { selectedOptions, setSelectedOption, forceSelectedOption } = core.useSelectedOption();
|
|
25
|
-
const { setHasPreSelected } = core.useHasPreSelected();
|
|
25
|
+
const { setHasPreSelected, hasPreSelected: productHasPreSelected } = core.useHasPreSelected();
|
|
26
26
|
const [variantId, setVariantId] = React.useState('');
|
|
27
27
|
React.useEffect(()=>{
|
|
28
28
|
const url = new URL(window.location.href);
|
|
29
29
|
const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
|
|
30
|
-
setHasPreSelected(hasPreSelected || !!variantParam);
|
|
30
|
+
if (productHasPreSelected === undefined) setHasPreSelected(hasPreSelected || !!variantParam);
|
|
31
31
|
}, [
|
|
32
32
|
hasPreSelected,
|
|
33
|
+
productHasPreSelected,
|
|
33
34
|
setHasPreSelected
|
|
34
35
|
]);
|
|
35
36
|
React.useEffect(()=>{
|
|
@@ -33,7 +33,8 @@ const useProductSetting = (props)=>{
|
|
|
33
33
|
quantity,
|
|
34
34
|
readOnly,
|
|
35
35
|
isSyncProduct,
|
|
36
|
-
key: `uid-${product?.id}-${initialVariantId ?? ''}
|
|
36
|
+
key: `uid-${product?.id}-${initialVariantId ?? ''}`,
|
|
37
|
+
hasPreSelected: productSetting?.hasPreSelected
|
|
37
38
|
}), [
|
|
38
39
|
initialVariantId,
|
|
39
40
|
isSyncProduct,
|
|
@@ -487,22 +487,13 @@ const SettingUIV2 = [
|
|
|
487
487
|
}
|
|
488
488
|
},
|
|
489
489
|
{
|
|
490
|
-
label: {
|
|
491
|
-
en: 'Default option'
|
|
492
|
-
},
|
|
493
|
-
setting: {
|
|
494
|
-
id: 'hasPreSelected'
|
|
495
|
-
}
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
conditionDisplay: 'hasPreSelected == true',
|
|
499
490
|
layout: 'vertical',
|
|
500
491
|
setting: {
|
|
501
492
|
id: 'selectVariantDefault'
|
|
502
493
|
}
|
|
503
494
|
},
|
|
504
495
|
{
|
|
505
|
-
conditionDisplay: 'hasPreSelected == false',
|
|
496
|
+
conditionDisplay: 'productSetting?.hasPreSelected === false || (productSetting?.hasPreSelected === undefined && hasPreSelected == false)',
|
|
506
497
|
label: {
|
|
507
498
|
en: 'Blank option text'
|
|
508
499
|
},
|
|
@@ -20,14 +20,15 @@ const useGpVariants = (props, variants)=>{
|
|
|
20
20
|
});
|
|
21
21
|
const mode = useEditorMode();
|
|
22
22
|
const { selectedOptions, setSelectedOption, forceSelectedOption } = useSelectedOption();
|
|
23
|
-
const { setHasPreSelected } = useHasPreSelected();
|
|
23
|
+
const { setHasPreSelected, hasPreSelected: productHasPreSelected } = useHasPreSelected();
|
|
24
24
|
const [variantId, setVariantId] = useState('');
|
|
25
25
|
useEffect(()=>{
|
|
26
26
|
const url = new URL(window.location.href);
|
|
27
27
|
const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
|
|
28
|
-
setHasPreSelected(hasPreSelected || !!variantParam);
|
|
28
|
+
if (productHasPreSelected === undefined) setHasPreSelected(hasPreSelected || !!variantParam);
|
|
29
29
|
}, [
|
|
30
30
|
hasPreSelected,
|
|
31
|
+
productHasPreSelected,
|
|
31
32
|
setHasPreSelected
|
|
32
33
|
]);
|
|
33
34
|
useEffect(()=>{
|
|
@@ -31,7 +31,8 @@ const useProductSetting = (props)=>{
|
|
|
31
31
|
quantity,
|
|
32
32
|
readOnly,
|
|
33
33
|
isSyncProduct,
|
|
34
|
-
key: `uid-${product?.id}-${initialVariantId ?? ''}
|
|
34
|
+
key: `uid-${product?.id}-${initialVariantId ?? ''}`,
|
|
35
|
+
hasPreSelected: productSetting?.hasPreSelected
|
|
35
36
|
}), [
|
|
36
37
|
initialVariantId,
|
|
37
38
|
isSyncProduct,
|
|
@@ -485,22 +485,13 @@ const SettingUIV2 = [
|
|
|
485
485
|
}
|
|
486
486
|
},
|
|
487
487
|
{
|
|
488
|
-
label: {
|
|
489
|
-
en: 'Default option'
|
|
490
|
-
},
|
|
491
|
-
setting: {
|
|
492
|
-
id: 'hasPreSelected'
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
conditionDisplay: 'hasPreSelected == true',
|
|
497
488
|
layout: 'vertical',
|
|
498
489
|
setting: {
|
|
499
490
|
id: 'selectVariantDefault'
|
|
500
491
|
}
|
|
501
492
|
},
|
|
502
493
|
{
|
|
503
|
-
conditionDisplay: 'hasPreSelected == false',
|
|
494
|
+
conditionDisplay: 'productSetting?.hasPreSelected === false || (productSetting?.hasPreSelected === undefined && hasPreSelected == false)',
|
|
504
495
|
label: {
|
|
505
496
|
en: 'Blank option text'
|
|
506
497
|
},
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.724",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
28
|
+
"@gem-sdk/core": "2.0.0-dev.724",
|
|
29
29
|
"@gem-sdk/styles": "2.0.0-dev.703",
|
|
30
30
|
"@gem-sdk/system": "2.0.0-dev.695",
|
|
31
31
|
"@types/react-transition-group": "^4.4.5",
|