@plasmicpkgs/commerce 0.0.14 → 0.0.17
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 +75 -19
- 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.esm.js +70 -20
- package/dist/commerce.esm.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/registerCategoryMedia.d.ts +1 -0
- package/dist/registerProductMedia.d.ts +1 -0
- package/dist/types/site.d.ts +3 -1
- package/package.json +2 -2
|
@@ -1498,7 +1498,9 @@ var cartMeta = {
|
|
|
1498
1498
|
options: ["Size", "Total Price"]
|
|
1499
1499
|
},
|
|
1500
1500
|
hideIfIsEmpty: {
|
|
1501
|
-
type: "boolean"
|
|
1501
|
+
type: "boolean",
|
|
1502
|
+
defaultValue: false,
|
|
1503
|
+
description: "You can hide this component if the cart is empty"
|
|
1502
1504
|
}
|
|
1503
1505
|
},
|
|
1504
1506
|
importPath: "@plasmicpkgs/commerce",
|
|
@@ -1561,13 +1563,6 @@ var useCategories = function useCategories(input) {
|
|
|
1561
1563
|
}, hook))(input);
|
|
1562
1564
|
};
|
|
1563
1565
|
|
|
1564
|
-
var useCommerceExtraFeatures = function useCommerceExtraFeatures() {
|
|
1565
|
-
var _useCommerce = useCommerce(),
|
|
1566
|
-
providerRef = _useCommerce.providerRef;
|
|
1567
|
-
|
|
1568
|
-
return providerRef.current.extraFeatures;
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
1566
|
var categoryCollectionMeta = {
|
|
1572
1567
|
name: "plasmic-commerce-category-collection",
|
|
1573
1568
|
displayName: "Category Collection",
|
|
@@ -1615,8 +1610,10 @@ var categoryCollectionMeta = {
|
|
|
1615
1610
|
var _ctx$categories$map;
|
|
1616
1611
|
|
|
1617
1612
|
return (_ctx$categories$map = ctx == null ? void 0 : ctx.categories.map(function (category) {
|
|
1613
|
+
var _category$depth;
|
|
1614
|
+
|
|
1618
1615
|
return {
|
|
1619
|
-
label: category.name,
|
|
1616
|
+
label: "" + " ".repeat((_category$depth = category.depth) != null ? _category$depth : 0) + category.name,
|
|
1620
1617
|
value: category.id
|
|
1621
1618
|
};
|
|
1622
1619
|
})) != null ? _ctx$categories$map : [];
|
|
@@ -1641,7 +1638,6 @@ function CategoryCollection(props) {
|
|
|
1641
1638
|
emptyMessage = props.emptyMessage,
|
|
1642
1639
|
selectedCategory = props.category,
|
|
1643
1640
|
setControlContextData = props.setControlContextData;
|
|
1644
|
-
var features = useCommerceExtraFeatures();
|
|
1645
1641
|
var inEditor = React__default.useContext(host.PlasmicCanvasContext);
|
|
1646
1642
|
|
|
1647
1643
|
var _useCategories = useCategories(),
|
|
@@ -1650,7 +1646,6 @@ function CategoryCollection(props) {
|
|
|
1650
1646
|
|
|
1651
1647
|
var _useCategories2 = useCategories({
|
|
1652
1648
|
categoryId: selectedCategory,
|
|
1653
|
-
topologicalSort: !selectedCategory && (features == null ? void 0 : features.includeSubCategories),
|
|
1654
1649
|
addIsEmptyField: !!inEditor
|
|
1655
1650
|
}),
|
|
1656
1651
|
categories = _useCategories2.data,
|
|
@@ -1793,7 +1788,26 @@ var categoryMediaMeta = {
|
|
|
1793
1788
|
name: "plasmic-commerce-category-media",
|
|
1794
1789
|
displayName: "Category Media",
|
|
1795
1790
|
props: {
|
|
1796
|
-
mediaIndex: "number"
|
|
1791
|
+
mediaIndex: "number",
|
|
1792
|
+
mediaSize: {
|
|
1793
|
+
type: "choice",
|
|
1794
|
+
options: [{
|
|
1795
|
+
label: "Fill",
|
|
1796
|
+
value: "fill"
|
|
1797
|
+
}, {
|
|
1798
|
+
label: "Container",
|
|
1799
|
+
value: "contain"
|
|
1800
|
+
}, {
|
|
1801
|
+
label: "Cover",
|
|
1802
|
+
value: "cover"
|
|
1803
|
+
}, {
|
|
1804
|
+
label: "None",
|
|
1805
|
+
value: "none"
|
|
1806
|
+
}, {
|
|
1807
|
+
label: "Scale down",
|
|
1808
|
+
value: "scale-down"
|
|
1809
|
+
}]
|
|
1810
|
+
}
|
|
1797
1811
|
},
|
|
1798
1812
|
importPath: "@plasmicpkgs/commerce",
|
|
1799
1813
|
importName: "CategoryMedia"
|
|
@@ -1803,14 +1817,18 @@ function CategoryMedia(props) {
|
|
|
1803
1817
|
|
|
1804
1818
|
var className = props.className,
|
|
1805
1819
|
_props$mediaIndex = props.mediaIndex,
|
|
1806
|
-
mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex
|
|
1820
|
+
mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex,
|
|
1821
|
+
mediaSize = props.mediaSize;
|
|
1807
1822
|
var category = useCategoryContext();
|
|
1808
1823
|
var image = category != null && category.images ? category.images[mediaIndex] : undefined;
|
|
1809
1824
|
return React__default.createElement("img", {
|
|
1810
1825
|
alt: (category == null ? void 0 : category.name) || "Category Image",
|
|
1811
1826
|
src: (_image$url = image == null ? void 0 : image.url) != null ? _image$url : "",
|
|
1812
1827
|
loading: "lazy",
|
|
1813
|
-
className: className
|
|
1828
|
+
className: className,
|
|
1829
|
+
style: {
|
|
1830
|
+
objectFit: mediaSize
|
|
1831
|
+
}
|
|
1814
1832
|
});
|
|
1815
1833
|
}
|
|
1816
1834
|
function registerCategoryMedia(loader, customCategoryMediaMeta) {
|
|
@@ -1946,6 +1964,13 @@ var useBrands = function useBrands(input) {
|
|
|
1946
1964
|
}, hook))(input);
|
|
1947
1965
|
};
|
|
1948
1966
|
|
|
1967
|
+
var useCommerceExtraFeatures = function useCommerceExtraFeatures() {
|
|
1968
|
+
var _useCommerce = useCommerce(),
|
|
1969
|
+
providerRef = _useCommerce.providerRef;
|
|
1970
|
+
|
|
1971
|
+
return providerRef.current.extraFeatures;
|
|
1972
|
+
};
|
|
1973
|
+
|
|
1949
1974
|
var productCollectionMeta = {
|
|
1950
1975
|
name: "plasmic-commerce-product-collection",
|
|
1951
1976
|
displayName: "Product Collection",
|
|
@@ -1991,8 +2016,10 @@ var productCollectionMeta = {
|
|
|
1991
2016
|
var _ctx$categories$map;
|
|
1992
2017
|
|
|
1993
2018
|
return (_ctx$categories$map = ctx == null ? void 0 : ctx.categories.map(function (category) {
|
|
2019
|
+
var _category$depth;
|
|
2020
|
+
|
|
1994
2021
|
return {
|
|
1995
|
-
label: category.name,
|
|
2022
|
+
label: "" + " ".repeat((_category$depth = category.depth) != null ? _category$depth : 0) + category.name,
|
|
1996
2023
|
value: category.id
|
|
1997
2024
|
};
|
|
1998
2025
|
})) != null ? _ctx$categories$map : [];
|
|
@@ -2198,7 +2225,26 @@ var productMediaMeta = {
|
|
|
2198
2225
|
name: "plasmic-commerce-product-media",
|
|
2199
2226
|
displayName: "Product Media",
|
|
2200
2227
|
props: {
|
|
2201
|
-
mediaIndex: "number"
|
|
2228
|
+
mediaIndex: "number",
|
|
2229
|
+
mediaSize: {
|
|
2230
|
+
type: "choice",
|
|
2231
|
+
options: [{
|
|
2232
|
+
label: "Fill",
|
|
2233
|
+
value: "fill"
|
|
2234
|
+
}, {
|
|
2235
|
+
label: "Container",
|
|
2236
|
+
value: "contain"
|
|
2237
|
+
}, {
|
|
2238
|
+
label: "Cover",
|
|
2239
|
+
value: "cover"
|
|
2240
|
+
}, {
|
|
2241
|
+
label: "None",
|
|
2242
|
+
value: "none"
|
|
2243
|
+
}, {
|
|
2244
|
+
label: "Scale down",
|
|
2245
|
+
value: "scale-down"
|
|
2246
|
+
}]
|
|
2247
|
+
}
|
|
2202
2248
|
},
|
|
2203
2249
|
importPath: "@plasmicpkgs/commerce",
|
|
2204
2250
|
importName: "ProductMedia"
|
|
@@ -2208,7 +2254,8 @@ function ProductMedia(props) {
|
|
|
2208
2254
|
|
|
2209
2255
|
var className = props.className,
|
|
2210
2256
|
_props$mediaIndex = props.mediaIndex,
|
|
2211
|
-
mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex
|
|
2257
|
+
mediaIndex = _props$mediaIndex === void 0 ? 0 : _props$mediaIndex,
|
|
2258
|
+
mediaSize = props.mediaSize;
|
|
2212
2259
|
var product = useProduct();
|
|
2213
2260
|
var sliderContext = useProductSliderContext();
|
|
2214
2261
|
var image = product == null ? void 0 : product.images[sliderContext != null ? sliderContext : mediaIndex];
|
|
@@ -2216,7 +2263,10 @@ function ProductMedia(props) {
|
|
|
2216
2263
|
alt: (product == null ? void 0 : product.name) || "Product Image",
|
|
2217
2264
|
src: product ? (_image$url = image == null ? void 0 : image.url) != null ? _image$url : "" : placeholderImage,
|
|
2218
2265
|
loading: "lazy",
|
|
2219
|
-
className: className
|
|
2266
|
+
className: className,
|
|
2267
|
+
style: {
|
|
2268
|
+
objectFit: mediaSize
|
|
2269
|
+
}
|
|
2220
2270
|
});
|
|
2221
2271
|
}
|
|
2222
2272
|
function registerProductMedia(loader, customProductMediaMeta) {
|
|
@@ -2536,7 +2586,7 @@ var product = {
|
|
|
2536
2586
|
|
|
2537
2587
|
/*
|
|
2538
2588
|
Forked from https://github.com/vercel/commerce/tree/main/packages/commerce/src
|
|
2539
|
-
Changes: Added CategoryImage
|
|
2589
|
+
Changes: Added CategoryImage and depth/children/parent_id to Category
|
|
2540
2590
|
*/
|
|
2541
2591
|
|
|
2542
2592
|
var site = {
|
|
@@ -2567,6 +2617,7 @@ exports.CartType = cart;
|
|
|
2567
2617
|
exports.CategoryCollection = CategoryCollection;
|
|
2568
2618
|
exports.CategoryField = CategoryField;
|
|
2569
2619
|
exports.CategoryLink = CategoryLink;
|
|
2620
|
+
exports.CategoryMedia = CategoryMedia;
|
|
2570
2621
|
exports.CommerceError = CommerceError;
|
|
2571
2622
|
exports.CoreCommerceProvider = CoreCommerceProvider;
|
|
2572
2623
|
exports.FetcherError = FetcherError;
|
|
@@ -2577,6 +2628,7 @@ exports.ProductMedia = ProductMedia;
|
|
|
2577
2628
|
exports.ProductPlaceholder = defaultProduct;
|
|
2578
2629
|
exports.ProductPriceComponent = ProductPriceComponent;
|
|
2579
2630
|
exports.ProductQuantity = ProductQuantity;
|
|
2631
|
+
exports.ProductSlider = ProductSlider;
|
|
2580
2632
|
exports.ProductTextField = ProductTextField;
|
|
2581
2633
|
exports.ProductTypes = product;
|
|
2582
2634
|
exports.ProductVariantPicker = ProductVariantPicker;
|
|
@@ -2587,6 +2639,7 @@ exports.cartMeta = cartMeta;
|
|
|
2587
2639
|
exports.categoryCollectionMeta = categoryCollectionMeta;
|
|
2588
2640
|
exports.categoryFieldMeta = categoryFieldMeta;
|
|
2589
2641
|
exports.categoryLinkMeta = categoryLinkMeta;
|
|
2642
|
+
exports.categoryMediaMeta = categoryMediaMeta;
|
|
2590
2643
|
exports.fetcher = fetcher$4;
|
|
2591
2644
|
exports.getCommerceProvider = getCommerceProvider;
|
|
2592
2645
|
exports.productBoxMeta = productBoxMeta;
|
|
@@ -2595,6 +2648,7 @@ exports.productLinkMeta = productLinkMeta;
|
|
|
2595
2648
|
exports.productMediaMeta = productMediaMeta;
|
|
2596
2649
|
exports.productPriceMeta = productPriceMeta;
|
|
2597
2650
|
exports.productQuantityMeta = productQuantityMeta;
|
|
2651
|
+
exports.productSliderMeta = productSliderMeta;
|
|
2598
2652
|
exports.productTextFieldMeta = productTextFieldMeta;
|
|
2599
2653
|
exports.productVariantPickerMeta = productVariantPickerMeta;
|
|
2600
2654
|
exports.registerAddToCartButton = registerAddToCartButton;
|
|
@@ -2603,12 +2657,14 @@ exports.registerCart = registerCart;
|
|
|
2603
2657
|
exports.registerCategoryCollection = registerCategoryCollection;
|
|
2604
2658
|
exports.registerCategoryField = registerCategoryField;
|
|
2605
2659
|
exports.registerCategoryLink = registerCategoryLink;
|
|
2660
|
+
exports.registerCategoryMedia = registerCategoryMedia;
|
|
2606
2661
|
exports.registerProductBox = registerProductBox;
|
|
2607
2662
|
exports.registerProductCollection = registerProductCollection;
|
|
2608
2663
|
exports.registerProductLink = registerProductLink;
|
|
2609
2664
|
exports.registerProductMedia = registerProductMedia;
|
|
2610
2665
|
exports.registerProductPrice = registerProductPrice;
|
|
2611
2666
|
exports.registerProductQuantity = registerProductQuantity;
|
|
2667
|
+
exports.registerProductSlider = registerProductSlider;
|
|
2612
2668
|
exports.registerProductVariantPicker = registerProductVariantPicker;
|
|
2613
2669
|
exports.registerTextField = registerTextField;
|
|
2614
2670
|
exports.useAddItem = useAddItem;
|