@gem-sdk/core 1.23.0-staging.273 → 1.23.0-staging.274
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function checkInStock(variant, product$1) {
|
|
3
|
+
function checkInStock(variant, product) {
|
|
6
4
|
if (!variant) return false;
|
|
7
|
-
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !
|
|
5
|
+
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant, product) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
6
|
+
}
|
|
7
|
+
function isDefaultVariant(variant, product) {
|
|
8
|
+
return Boolean(variant?.title === 'Default Title' && product?.options?.some((option)=>option.values.length > 1));
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
exports.checkInStock = checkInStock;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { checkDefaultVariant } from '../components/src/product/helpers/product.js';
|
|
2
|
-
|
|
3
1
|
function checkInStock(variant, product) {
|
|
4
2
|
if (!variant) return false;
|
|
5
|
-
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !
|
|
3
|
+
return variant?.inventoryQuantity && variant.inventoryQuantity > 0 && !isDefaultVariant(variant, product) || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
|
|
4
|
+
}
|
|
5
|
+
function isDefaultVariant(variant, product) {
|
|
6
|
+
return Boolean(variant?.title === 'Default Title' && product?.options?.some((option)=>option.values.length > 1));
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export { checkInStock };
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const checkDefaultVariant = (product)=>{
|
|
4
|
-
return !product?.options?.length || product?.options?.length === 1 && product?.options?.[0]?.name === 'Title' && product?.options?.[0]?.values?.length === 1 && product?.options?.[0]?.values?.[0]?.label === 'Default Title';
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
exports.checkDefaultVariant = checkDefaultVariant;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const checkDefaultVariant = (product)=>{
|
|
2
|
-
return !product?.options?.length || product?.options?.length === 1 && product?.options?.[0]?.name === 'Title' && product?.options?.[0]?.values?.length === 1 && product?.options?.[0]?.values?.[0]?.label === 'Default Title';
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
export { checkDefaultVariant };
|