@plasmicpkgs/commerce-shopify 0.0.166 → 0.0.167
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 +2 -2
|
@@ -763,29 +763,32 @@ var normalizeProductOption = function normalizeProductOption(_ref2) {
|
|
|
763
763
|
})
|
|
764
764
|
};
|
|
765
765
|
};
|
|
766
|
-
var
|
|
767
|
-
var
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
766
|
+
var normalizeImage = function normalizeImage(_ref3) {
|
|
767
|
+
var url = _ref3.originalSrc,
|
|
768
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
769
|
+
return _extends({
|
|
770
|
+
url: url
|
|
771
|
+
}, rest);
|
|
772
|
+
};
|
|
773
|
+
var normalizeProductImages = function normalizeProductImages(_ref4) {
|
|
774
|
+
var edges = _ref4.edges;
|
|
775
|
+
return edges == null ? void 0 : edges.map(function (_ref5) {
|
|
776
|
+
var node = _ref5.node;
|
|
777
|
+
return normalizeImage(node);
|
|
775
778
|
});
|
|
776
779
|
};
|
|
777
|
-
var normalizeProductVariants = function normalizeProductVariants(
|
|
778
|
-
var edges =
|
|
779
|
-
return edges == null ? void 0 : edges.map(function (
|
|
780
|
-
var
|
|
781
|
-
id =
|
|
782
|
-
selectedOptions =
|
|
783
|
-
sku =
|
|
784
|
-
title =
|
|
785
|
-
priceV2 =
|
|
786
|
-
compareAtPriceV2 =
|
|
787
|
-
requiresShipping =
|
|
788
|
-
availableForSale =
|
|
780
|
+
var normalizeProductVariants = function normalizeProductVariants(_ref6) {
|
|
781
|
+
var edges = _ref6.edges;
|
|
782
|
+
return edges == null ? void 0 : edges.map(function (_ref7) {
|
|
783
|
+
var _ref7$node = _ref7.node,
|
|
784
|
+
id = _ref7$node.id,
|
|
785
|
+
selectedOptions = _ref7$node.selectedOptions,
|
|
786
|
+
sku = _ref7$node.sku,
|
|
787
|
+
title = _ref7$node.title,
|
|
788
|
+
priceV2 = _ref7$node.priceV2,
|
|
789
|
+
compareAtPriceV2 = _ref7$node.compareAtPriceV2,
|
|
790
|
+
requiresShipping = _ref7$node.requiresShipping,
|
|
791
|
+
availableForSale = _ref7$node.availableForSale;
|
|
789
792
|
return {
|
|
790
793
|
id: id,
|
|
791
794
|
name: selectedOptions.some(function (o) {
|
|
@@ -796,9 +799,9 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
|
|
|
796
799
|
listPrice: +(compareAtPriceV2 == null ? void 0 : compareAtPriceV2.amount),
|
|
797
800
|
requiresShipping: requiresShipping,
|
|
798
801
|
availableForSale: availableForSale,
|
|
799
|
-
options: selectedOptions.map(function (
|
|
800
|
-
var name =
|
|
801
|
-
value =
|
|
802
|
+
options: selectedOptions.map(function (_ref8) {
|
|
803
|
+
var name = _ref8.name,
|
|
804
|
+
value = _ref8.value;
|
|
802
805
|
var options = normalizeProductOption({
|
|
803
806
|
id: id,
|
|
804
807
|
name: name,
|
|
@@ -809,18 +812,18 @@ var normalizeProductVariants = function normalizeProductVariants(_ref5) {
|
|
|
809
812
|
};
|
|
810
813
|
});
|
|
811
814
|
};
|
|
812
|
-
function normalizeProduct(
|
|
813
|
-
var id =
|
|
814
|
-
name =
|
|
815
|
-
vendor =
|
|
816
|
-
images =
|
|
817
|
-
variants =
|
|
818
|
-
description =
|
|
819
|
-
descriptionHtml =
|
|
820
|
-
handle =
|
|
821
|
-
priceRange =
|
|
822
|
-
options =
|
|
823
|
-
rest = _objectWithoutPropertiesLoose(
|
|
815
|
+
function normalizeProduct(_ref9) {
|
|
816
|
+
var id = _ref9.id,
|
|
817
|
+
name = _ref9.title,
|
|
818
|
+
vendor = _ref9.vendor,
|
|
819
|
+
images = _ref9.images,
|
|
820
|
+
variants = _ref9.variants,
|
|
821
|
+
description = _ref9.description,
|
|
822
|
+
descriptionHtml = _ref9.descriptionHtml,
|
|
823
|
+
handle = _ref9.handle,
|
|
824
|
+
priceRange = _ref9.priceRange,
|
|
825
|
+
options = _ref9.options,
|
|
826
|
+
rest = _objectWithoutPropertiesLoose(_ref9, _excluded2);
|
|
824
827
|
return _extends({
|
|
825
828
|
id: id,
|
|
826
829
|
name: name,
|
|
@@ -861,13 +864,13 @@ function normalizeCart(checkout) {
|
|
|
861
864
|
discounts: []
|
|
862
865
|
};
|
|
863
866
|
}
|
|
864
|
-
function normalizeLineItem(
|
|
867
|
+
function normalizeLineItem(_ref10) {
|
|
865
868
|
var _variant$sku, _variant$image, _variant$requiresShip, _variant$priceV, _variant$compareAtPri, _variant$product;
|
|
866
|
-
var
|
|
867
|
-
id =
|
|
868
|
-
title =
|
|
869
|
-
variant =
|
|
870
|
-
quantity =
|
|
869
|
+
var _ref10$node = _ref10.node,
|
|
870
|
+
id = _ref10$node.id,
|
|
871
|
+
title = _ref10$node.title,
|
|
872
|
+
variant = _ref10$node.variant,
|
|
873
|
+
quantity = _ref10$node.quantity;
|
|
871
874
|
return {
|
|
872
875
|
id: id,
|
|
873
876
|
variantId: String(variant == null ? void 0 : variant.id),
|
|
@@ -903,17 +906,19 @@ export const normalizePage = (
|
|
|
903
906
|
export const normalizePages = (edges: PageEdge[], locale?: string): Page[] =>
|
|
904
907
|
edges?.map((edge) => normalizePage(edge.node, locale))
|
|
905
908
|
*/
|
|
906
|
-
var normalizeCategory = function normalizeCategory(
|
|
907
|
-
var name =
|
|
908
|
-
handle =
|
|
909
|
-
id =
|
|
910
|
-
products =
|
|
909
|
+
var normalizeCategory = function normalizeCategory(_ref11) {
|
|
910
|
+
var name = _ref11.title,
|
|
911
|
+
handle = _ref11.handle,
|
|
912
|
+
id = _ref11.id,
|
|
913
|
+
products = _ref11.products,
|
|
914
|
+
image = _ref11.image;
|
|
911
915
|
return {
|
|
912
916
|
id: id,
|
|
913
917
|
name: name,
|
|
914
918
|
slug: handle,
|
|
915
919
|
path: "/" + handle,
|
|
916
|
-
isEmpty: products.edges.length === 0
|
|
920
|
+
isEmpty: products.edges.length === 0,
|
|
921
|
+
images: image ? [normalizeImage(image)] : undefined
|
|
917
922
|
};
|
|
918
923
|
};
|
|
919
924
|
|
|
@@ -955,7 +960,12 @@ var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
|
955
960
|
};
|
|
956
961
|
|
|
957
962
|
var simpleProductConnection = "\nfragment simpleProductConnection on ProductConnection {\n edges {\n node {\n id\n }\n }\n}\n";
|
|
958
|
-
|
|
963
|
+
/*
|
|
964
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/shopify/src
|
|
965
|
+
Changes:
|
|
966
|
+
- Fetch image.
|
|
967
|
+
*/
|
|
968
|
+
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";
|
|
959
969
|
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";
|
|
960
970
|
|
|
961
971
|
/*
|