@gem-sdk/core 1.30.5 → 1.30.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.
|
@@ -61,7 +61,7 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
61
61
|
return makeStyle.removeNullUndefined({
|
|
62
62
|
...makeStyle.makeStyle({
|
|
63
63
|
fs: !attrs?.italic ? value?.fontStyle : undefined,
|
|
64
|
-
ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, ${value.fontFamily})` : undefined,
|
|
64
|
+
ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, '${value.fontFamily}')` : undefined,
|
|
65
65
|
weight: !attrs?.bold ? value?.fontWeight : undefined,
|
|
66
66
|
ls: value?.letterSpacing,
|
|
67
67
|
lh: value?.lineHeight
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function checkInStock(variant) {
|
|
3
|
+
function checkInStock(variant, product) {
|
|
4
4
|
if (!variant) return false;
|
|
5
|
-
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
5
|
+
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant, product) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
6
6
|
}
|
|
7
|
-
function isDefaultVariant(variant) {
|
|
8
|
-
return variant?.title === 'Default Title';
|
|
7
|
+
function isDefaultVariant(variant, product) {
|
|
8
|
+
return Boolean(variant?.title === 'Default Title' && product?.options?.some((option)=>option.values.length > 1));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
exports.checkInStock = checkInStock;
|
|
@@ -149,7 +149,8 @@ const useCurrentVariant = ()=>{
|
|
|
149
149
|
};
|
|
150
150
|
const useCurrentVariantInStock = ()=>{
|
|
151
151
|
const currentVariant = useCurrentVariant();
|
|
152
|
-
|
|
152
|
+
const currentProduct = useProduct();
|
|
153
|
+
return variant.checkInStock(currentVariant, currentProduct);
|
|
153
154
|
};
|
|
154
155
|
const useVariantOutStock = (optionId, optionValue, options)=>{
|
|
155
156
|
const { selectedOptions } = useSelectedOption();
|
|
@@ -59,7 +59,7 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
59
59
|
return removeNullUndefined({
|
|
60
60
|
...makeStyle({
|
|
61
61
|
fs: !attrs?.italic ? value?.fontStyle : undefined,
|
|
62
|
-
ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, ${value.fontFamily})` : undefined,
|
|
62
|
+
ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, '${value.fontFamily}')` : undefined,
|
|
63
63
|
weight: !attrs?.bold ? value?.fontWeight : undefined,
|
|
64
64
|
ls: value?.letterSpacing,
|
|
65
65
|
lh: value?.lineHeight
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function checkInStock(variant) {
|
|
1
|
+
function checkInStock(variant, product) {
|
|
2
2
|
if (!variant) return false;
|
|
3
|
-
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
3
|
+
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant, product) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
4
4
|
}
|
|
5
|
-
function isDefaultVariant(variant) {
|
|
6
|
-
return variant?.title === 'Default Title';
|
|
5
|
+
function isDefaultVariant(variant, product) {
|
|
6
|
+
return Boolean(variant?.title === 'Default Title' && product?.options?.some((option)=>option.values.length > 1));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { checkInStock };
|
|
@@ -147,7 +147,8 @@ const useCurrentVariant = ()=>{
|
|
|
147
147
|
};
|
|
148
148
|
const useCurrentVariantInStock = ()=>{
|
|
149
149
|
const currentVariant = useCurrentVariant();
|
|
150
|
-
|
|
150
|
+
const currentProduct = useProduct();
|
|
151
|
+
return checkInStock(currentVariant, currentProduct);
|
|
151
152
|
};
|
|
152
153
|
const useVariantOutStock = (optionId, optionValue, options)=>{
|
|
153
154
|
const { selectedOptions } = useSelectedOption();
|