@plasmicpkgs/commerce 0.0.7 → 0.0.8
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/commerce.cjs.development.js +32 -15
- package/dist/commerce.cjs.development.js.map +1 -1
- package/dist/commerce.cjs.production.min.js +1 -1
- package/dist/commerce.cjs.production.min.js.map +1 -1
- package/dist/commerce.d.ts +2 -1
- package/dist/commerce.esm.js +33 -15
- package/dist/commerce.esm.js.map +1 -1
- package/dist/registerProductCollection.d.ts +3 -0
- package/dist/types/product.d.ts +3 -0
- package/dist/utils/types.d.ts +3 -1
- package/dist/utils/use-extra-features.d.ts +1 -0
- package/package.json +3 -3
package/dist/commerce.esm.js
CHANGED
|
@@ -1227,12 +1227,13 @@ function AddToCartButton(props) {
|
|
|
1227
1227
|
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1228
1228
|
var _form$getValues$Produ;
|
|
1229
1229
|
|
|
1230
|
-
var quantity, variantId;
|
|
1230
|
+
var quantity, _form$getValues$Produ2, variantId;
|
|
1231
|
+
|
|
1231
1232
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1232
1233
|
while (1) {
|
|
1233
1234
|
switch (_context.prev = _context.next) {
|
|
1234
1235
|
case 0:
|
|
1235
|
-
quantity = (_form$getValues$Produ =
|
|
1236
|
+
quantity = +((_form$getValues$Produ = form.getValues()["ProductQuantity"]) != null ? _form$getValues$Produ : 1);
|
|
1236
1237
|
|
|
1237
1238
|
if (!(isNaN(quantity) || quantity < 1)) {
|
|
1238
1239
|
_context.next = 3;
|
|
@@ -1249,7 +1250,7 @@ function AddToCartButton(props) {
|
|
|
1249
1250
|
break;
|
|
1250
1251
|
}
|
|
1251
1252
|
|
|
1252
|
-
variantId = form.getValues()["ProductVariant"];
|
|
1253
|
+
variantId = (_form$getValues$Produ2 = form.getValues()["ProductVariant"]) != null ? _form$getValues$Produ2 : product.variants[0].id;
|
|
1253
1254
|
_context.next = 7;
|
|
1254
1255
|
return addItem({
|
|
1255
1256
|
productId: product.id,
|
|
@@ -1428,6 +1429,13 @@ var useBrands = function useBrands(input) {
|
|
|
1428
1429
|
}, hook))(input);
|
|
1429
1430
|
};
|
|
1430
1431
|
|
|
1432
|
+
var useCommerceExtraFeatures = function useCommerceExtraFeatures() {
|
|
1433
|
+
var _useCommerce = useCommerce(),
|
|
1434
|
+
providerRef = _useCommerce.providerRef;
|
|
1435
|
+
|
|
1436
|
+
return providerRef.current.extraFeatures;
|
|
1437
|
+
};
|
|
1438
|
+
|
|
1431
1439
|
var productCollectionMeta = {
|
|
1432
1440
|
name: "plasmic-commerce-product-collection",
|
|
1433
1441
|
displayName: "Product Collection",
|
|
@@ -1466,6 +1474,14 @@ var productCollectionMeta = {
|
|
|
1466
1474
|
})) != null ? _ctx$categories$map : [];
|
|
1467
1475
|
}
|
|
1468
1476
|
},
|
|
1477
|
+
includeSubCategories: {
|
|
1478
|
+
type: "boolean",
|
|
1479
|
+
hidden: function hidden(props, ctx) {
|
|
1480
|
+
var _ctx$features;
|
|
1481
|
+
|
|
1482
|
+
return !(ctx != null && (_ctx$features = ctx.features) != null && _ctx$features.includeSubCategories);
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1469
1485
|
brand: {
|
|
1470
1486
|
type: "choice",
|
|
1471
1487
|
options: function options(props, ctx) {
|
|
@@ -1497,27 +1513,33 @@ function ProductCollection(props) {
|
|
|
1497
1513
|
children = props.children,
|
|
1498
1514
|
count = props.count,
|
|
1499
1515
|
category = props.category,
|
|
1516
|
+
includeSubCategories = props.includeSubCategories,
|
|
1500
1517
|
brand = props.brand,
|
|
1501
1518
|
noLayout = props.noLayout,
|
|
1502
1519
|
setControlContextData = props.setControlContextData;
|
|
1503
1520
|
|
|
1521
|
+
var _useCategories = useCategories(),
|
|
1522
|
+
categories = _useCategories.data;
|
|
1523
|
+
|
|
1524
|
+
var _useBrands = useBrands(),
|
|
1525
|
+
brands = _useBrands.data;
|
|
1526
|
+
|
|
1504
1527
|
var _useSearch = useSearch({
|
|
1505
1528
|
categoryId: category,
|
|
1506
1529
|
brandId: brand,
|
|
1507
|
-
count: count
|
|
1530
|
+
count: count,
|
|
1531
|
+
categories: categories != null ? categories : [],
|
|
1532
|
+
includeSubCategories: includeSubCategories
|
|
1508
1533
|
}),
|
|
1509
1534
|
data = _useSearch.data;
|
|
1510
1535
|
|
|
1511
|
-
var
|
|
1512
|
-
categories = _useCategories.data;
|
|
1513
|
-
|
|
1514
|
-
var _useBrands = useBrands(),
|
|
1515
|
-
brands = _useBrands.data;
|
|
1536
|
+
var features = useCommerceExtraFeatures();
|
|
1516
1537
|
|
|
1517
1538
|
if (categories && brands) {
|
|
1518
1539
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
1519
1540
|
categories: categories,
|
|
1520
|
-
brands: brands
|
|
1541
|
+
brands: brands,
|
|
1542
|
+
features: features
|
|
1521
1543
|
});
|
|
1522
1544
|
}
|
|
1523
1545
|
|
|
@@ -2002,10 +2024,6 @@ function registerCart(loader, customCartMeta) {
|
|
|
2002
2024
|
doRegisterComponent(CartComponent, customCartMeta != null ? customCartMeta : cartMeta);
|
|
2003
2025
|
}
|
|
2004
2026
|
|
|
2005
|
-
var x = function x() {
|
|
2006
|
-
return 2;
|
|
2007
|
-
};
|
|
2008
|
-
|
|
2009
2027
|
|
|
2010
2028
|
|
|
2011
2029
|
var product = {
|
|
@@ -2067,5 +2085,5 @@ function registerAll(loader) {
|
|
|
2067
2085
|
registerProductLink(loader);
|
|
2068
2086
|
}
|
|
2069
2087
|
|
|
2070
|
-
export { AddToCartButton, CartComponent, cart as CartType, CommerceError, CoreCommerceProvider, FetcherError, ProductBox, ProductCollection, ProductLink, ProductMedia, ProductPriceComponent, ProductQuantity, ProductTextField, product as ProductTypes, ProductVariantPicker, site as SiteTypes, ValidationError, addToCartButtonMeta, cartMeta, fetcher$2 as fetcher, getCommerceProvider, productBoxMeta, productCollectionMeta, productLinkMeta, productMediaMeta, productPriceMeta, productQuantityMeta, productTextFieldMeta, productVariantPickerMeta, registerAddToCartButton, registerAll, registerCart, registerProductBox, registerProductCollection, registerProductLink, registerProductMedia, registerProductPrice, registerProductQuantity, registerProductVariantPicker, registerTextField, useAddItem, useBrands, useCart, useCategories, useCommerce, useProduct$1 as useProduct, useRemoveItem, useSearch, useUpdateItem
|
|
2088
|
+
export { AddToCartButton, CartComponent, cart as CartType, CommerceError, CoreCommerceProvider, FetcherError, ProductBox, ProductCollection, ProductLink, ProductMedia, ProductPriceComponent, ProductQuantity, ProductTextField, product as ProductTypes, ProductVariantPicker, site as SiteTypes, ValidationError, addToCartButtonMeta, cartMeta, fetcher$2 as fetcher, getCommerceProvider, productBoxMeta, productCollectionMeta, productLinkMeta, productMediaMeta, productPriceMeta, productQuantityMeta, productTextFieldMeta, productVariantPickerMeta, registerAddToCartButton, registerAll, registerCart, registerProductBox, registerProductCollection, registerProductLink, registerProductMedia, registerProductPrice, registerProductQuantity, registerProductVariantPicker, registerTextField, useAddItem, useBrands, useCart, useCategories, useCommerce, useProduct$1 as useProduct, useRemoveItem, useSearch, useUpdateItem };
|
|
2071
2089
|
//# sourceMappingURL=commerce.esm.js.map
|