@plasmicpkgs/commerce-shopify 0.0.166 → 0.0.168
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-shopify.cjs.development.js +59 -49
- package/dist/commerce-shopify.cjs.development.js.map +1 -1
- package/dist/commerce-shopify.cjs.production.min.js +1 -1
- package/dist/commerce-shopify.cjs.production.min.js.map +1 -1
- package/dist/commerce-shopify.esm.js +59 -49
- package/dist/commerce-shopify.esm.js.map +1 -1
- package/dist/utils/normalize.d.ts +1 -1
- package/package.json +4 -4
|
@@ -756,29 +756,32 @@ var normalizeProductOption = function normalizeProductOption(_ref2) {
|
|
|
756
756
|
})
|
|
757
757
|
};
|
|
758
758
|
};
|
|
759
|
-
var
|
|
760
|
-
var
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
759
|
+
var normalizeImage = function normalizeImage(_ref3) {
|
|
760
|
+
var url = _ref3.originalSrc,
|
|
761
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
762
|
+
return _extends({
|
|
763
|
+
url: url
|
|
764
|
+
}, rest);
|
|
765
|
+
};
|
|
766
|
+
var normalizeProductImages = function normalizeProductImages(_ref4) {
|
|
767
|
+
var edges = _ref4.edges;
|
|
768
|
+
return edges == null ? void 0 : edges.map(function (_ref5) {
|
|
769
|
+
var node = _ref5.node;
|
|
770
|
+
return normalizeImage(node);
|
|
768
771
|
});
|
|
769
772
|
};
|
|
770
|
-
var normalizeProductVariants = function normalizeProductVariants(
|
|
771
|
-
var edges =
|
|
772
|
-
return edges == null ? void 0 : edges.map(function (
|
|
773
|
-
var
|
|
774
|
-
id =
|
|
775
|
-
selectedOptions =
|
|
776
|
-
sku =
|
|
777
|
-
title =
|
|
778
|
-
priceV2 =
|
|
779
|
-
compareAtPriceV2 =
|
|
780
|
-
requiresShipping =
|
|
781
|
-
availableForSale =
|
|
773
|
+
var normalizeProductVariants = function normalizeProductVariants(_ref6) {
|
|
774
|
+
var edges = _ref6.edges;
|
|
775
|
+
return edges == null ? void 0 : edges.map(function (_ref7) {
|
|
776
|
+
var _ref7$node = _ref7.node,
|
|
777
|
+
id = _ref7$node.id,
|
|
778
|
+
selectedOptions = _ref7$node.selectedOptions,
|
|
779
|
+
sku = _ref7$node.sku,
|
|
780
|
+
title = _ref7$node.title,
|
|
781
|
+
priceV2 = _ref7$node.priceV2,
|
|
782
|
+
compareAtPriceV2 = _ref7$node.compareAtPriceV2,
|
|
783
|
+
requiresShipping = _ref7$node.requiresShipping,
|
|
784
|
+
availableForSale = _ref7$node.availableForSale;
|
|
782
785
|
return {
|
|
783
786
|
id: id,
|
|
784
787
|
name: selectedOptions.some(function (o) {
|
|
@@ -789,9 +792,9 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
|
|
|
789
792
|
listPrice: +(compareAtPriceV2 == null ? void 0 : compareAtPriceV2.amount),
|
|
790
793
|
requiresShipping: requiresShipping,
|
|
791
794
|
availableForSale: availableForSale,
|
|
792
|
-
options: selectedOptions.map(function (
|
|
793
|
-
var name =
|
|
794
|
-
value =
|
|
795
|
+
options: selectedOptions.map(function (_ref8) {
|
|
796
|
+
var name = _ref8.name,
|
|
797
|
+
value = _ref8.value;
|
|
795
798
|
var options = normalizeProductOption({
|
|
796
799
|
id: id,
|
|
797
800
|
name: name,
|
|
@@ -802,18 +805,18 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
|
|
|
802
805
|
};
|
|
803
806
|
});
|
|
804
807
|
};
|
|
805
|
-
function normalizeProduct(
|
|
806
|
-
var id =
|
|
807
|
-
name =
|
|
808
|
-
vendor =
|
|
809
|
-
images =
|
|
810
|
-
variants =
|
|
811
|
-
description =
|
|
812
|
-
descriptionHtml =
|
|
813
|
-
handle =
|
|
814
|
-
priceRange =
|
|
815
|
-
options =
|
|
816
|
-
rest = _objectWithoutPropertiesLoose(
|
|
808
|
+
function normalizeProduct(_ref9) {
|
|
809
|
+
var id = _ref9.id,
|
|
810
|
+
name = _ref9.title,
|
|
811
|
+
vendor = _ref9.vendor,
|
|
812
|
+
images = _ref9.images,
|
|
813
|
+
variants = _ref9.variants,
|
|
814
|
+
description = _ref9.description,
|
|
815
|
+
descriptionHtml = _ref9.descriptionHtml,
|
|
816
|
+
handle = _ref9.handle,
|
|
817
|
+
priceRange = _ref9.priceRange,
|
|
818
|
+
options = _ref9.options,
|
|
819
|
+
rest = _objectWithoutPropertiesLoose(_ref9, _excluded2);
|
|
817
820
|
return _extends({
|
|
818
821
|
id: id,
|
|
819
822
|
name: name,
|
|
@@ -854,13 +857,13 @@ function normalizeCart(checkout) {
|
|
|
854
857
|
discounts: []
|
|
855
858
|
};
|
|
856
859
|
}
|
|
857
|
-
function normalizeLineItem(
|
|
860
|
+
function normalizeLineItem(_ref10) {
|
|
858
861
|
var _variant$sku, _variant$image, _variant$requiresShip, _variant$priceV, _variant$compareAtPri, _variant$product;
|
|
859
|
-
var
|
|
860
|
-
id =
|
|
861
|
-
title =
|
|
862
|
-
variant =
|
|
863
|
-
quantity =
|
|
862
|
+
var _ref10$node = _ref10.node,
|
|
863
|
+
id = _ref10$node.id,
|
|
864
|
+
title = _ref10$node.title,
|
|
865
|
+
variant = _ref10$node.variant,
|
|
866
|
+
quantity = _ref10$node.quantity;
|
|
864
867
|
return {
|
|
865
868
|
id: id,
|
|
866
869
|
variantId: String(variant == null ? void 0 : variant.id),
|
|
@@ -896,17 +899,19 @@ export const normalizePage = (
|
|
|
896
899
|
export const normalizePages = (edges: PageEdge[], locale?: string): Page[] =>
|
|
897
900
|
edges?.map((edge) => normalizePage(edge.node, locale))
|
|
898
901
|
*/
|
|
899
|
-
var normalizeCategory = function normalizeCategory(
|
|
900
|
-
var name =
|
|
901
|
-
handle =
|
|
902
|
-
id =
|
|
903
|
-
products =
|
|
902
|
+
var normalizeCategory = function normalizeCategory(_ref11) {
|
|
903
|
+
var name = _ref11.title,
|
|
904
|
+
handle = _ref11.handle,
|
|
905
|
+
id = _ref11.id,
|
|
906
|
+
products = _ref11.products,
|
|
907
|
+
image = _ref11.image;
|
|
904
908
|
return {
|
|
905
909
|
id: id,
|
|
906
910
|
name: name,
|
|
907
911
|
slug: handle,
|
|
908
912
|
path: "/" + handle,
|
|
909
|
-
isEmpty: products.edges.length === 0
|
|
913
|
+
isEmpty: products.edges.length === 0,
|
|
914
|
+
images: image ? [normalizeImage(image)] : undefined
|
|
910
915
|
};
|
|
911
916
|
};
|
|
912
917
|
|
|
@@ -948,7 +953,12 @@ var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
|
948
953
|
};
|
|
949
954
|
|
|
950
955
|
var simpleProductConnection = "\nfragment simpleProductConnection on ProductConnection {\n edges {\n node {\n id\n }\n }\n}\n";
|
|
951
|
-
|
|
956
|
+
/*
|
|
957
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
958
|
+
Changes:
|
|
959
|
+
- Fetch image.
|
|
960
|
+
*/
|
|
961
|
+
var collectionFieldsFragment = "\n fragment collectionFieldsFragment on Collection {\n id\n title\n handle\n image {\n originalSrc\n altText\n width\n height\n }\n products(first: $first) {\n ...simpleProductConnection\n }\n }\n " + simpleProductConnection + "\n";
|
|
952
962
|
var getCollectionQueryById = /* GraphQL */"\n query getSiteCollection($id: ID, $handle: String, $first: Int = 1) {\n collection(id: $id, handle: $handle) {\n ...collectionFieldsFragment\n }\n }\n " + collectionFieldsFragment + "\n";
|
|
953
963
|
|
|
954
964
|
/*
|