@plasmicpkgs/commerce-swell 0.0.14 → 0.0.15
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-swell.cjs.development.js +23 -17
- package/dist/commerce-swell.cjs.development.js.map +1 -1
- package/dist/commerce-swell.cjs.production.min.js +1 -1
- package/dist/commerce-swell.cjs.production.min.js.map +1 -1
- package/dist/commerce-swell.esm.js +23 -17
- package/dist/commerce-swell.esm.js.map +1 -1
- package/dist/utils/normalize.d.ts +4 -4
- package/package.json +3 -3
|
@@ -847,7 +847,7 @@ var _excluded = ["file"];
|
|
|
847
847
|
var normalizeProductOption = function normalizeProductOption(_ref2) {
|
|
848
848
|
var id = _ref2.id,
|
|
849
849
|
_ref2$name = _ref2.name,
|
|
850
|
-
displayName = _ref2$name === void 0 ?
|
|
850
|
+
displayName = _ref2$name === void 0 ? "" : _ref2$name,
|
|
851
851
|
_ref2$values = _ref2.values,
|
|
852
852
|
values = _ref2$values === void 0 ? [] : _ref2$values;
|
|
853
853
|
var returnValues = values.map(function (value) {
|
|
@@ -864,7 +864,7 @@ var normalizeProductOption = function normalizeProductOption(_ref2) {
|
|
|
864
864
|
return output;
|
|
865
865
|
});
|
|
866
866
|
return {
|
|
867
|
-
__typename:
|
|
867
|
+
__typename: "MultipleChoiceOption",
|
|
868
868
|
id: id,
|
|
869
869
|
displayName: displayName,
|
|
870
870
|
values: returnValues
|
|
@@ -874,7 +874,7 @@ var normalizeProductOption = function normalizeProductOption(_ref2) {
|
|
|
874
874
|
var normalizeProductImages = function normalizeProductImages(images) {
|
|
875
875
|
if (!images || images.length < 1) {
|
|
876
876
|
return [{
|
|
877
|
-
url:
|
|
877
|
+
url: "/"
|
|
878
878
|
}];
|
|
879
879
|
}
|
|
880
880
|
|
|
@@ -883,7 +883,7 @@ var normalizeProductImages = function normalizeProductImages(images) {
|
|
|
883
883
|
rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
884
884
|
|
|
885
885
|
return _extends({
|
|
886
|
-
url: (file == null ? void 0 : file.url) +
|
|
886
|
+
url: (file == null ? void 0 : file.url) + "",
|
|
887
887
|
height: Number(file == null ? void 0 : file.height),
|
|
888
888
|
width: Number(file == null ? void 0 : file.width)
|
|
889
889
|
}, rest);
|
|
@@ -897,7 +897,7 @@ var normalizeProductVariants = function normalizeProductVariants(variants, produ
|
|
|
897
897
|
price = _ref4.price,
|
|
898
898
|
_ref4$option_value_id = _ref4.option_value_ids,
|
|
899
899
|
optionValueIds = _ref4$option_value_id === void 0 ? [] : _ref4$option_value_id;
|
|
900
|
-
var values = name.split(
|
|
900
|
+
var values = name.split(",").map(function (i) {
|
|
901
901
|
return {
|
|
902
902
|
name: i.trim(),
|
|
903
903
|
label: i.trim()
|
|
@@ -913,7 +913,7 @@ var normalizeProductVariants = function normalizeProductVariants(variants, produ
|
|
|
913
913
|
});
|
|
914
914
|
return normalizeProductOption({
|
|
915
915
|
id: id,
|
|
916
|
-
name: (_matchingOption$name = matchingOption == null ? void 0 : matchingOption.name) != null ? _matchingOption$name :
|
|
916
|
+
name: (_matchingOption$name = matchingOption == null ? void 0 : matchingOption.name) != null ? _matchingOption$name : "",
|
|
917
917
|
values: values
|
|
918
918
|
});
|
|
919
919
|
});
|
|
@@ -953,7 +953,7 @@ function normalizeProduct(swellProduct) {
|
|
|
953
953
|
var product = _extends({}, swellProduct, {
|
|
954
954
|
description: description,
|
|
955
955
|
id: id,
|
|
956
|
-
vendor:
|
|
956
|
+
vendor: "",
|
|
957
957
|
path: "/" + slug,
|
|
958
958
|
images: productImages,
|
|
959
959
|
variants: productVariants && productVariants.length ? productVariants : emptyVariants,
|
|
@@ -980,8 +980,8 @@ function normalizeCart(_ref5) {
|
|
|
980
980
|
discounts = _ref5.discounts;
|
|
981
981
|
var cart = {
|
|
982
982
|
id: id,
|
|
983
|
-
customerId: account_id +
|
|
984
|
-
email:
|
|
983
|
+
customerId: account_id + "",
|
|
984
|
+
email: "",
|
|
985
985
|
createdAt: date_created,
|
|
986
986
|
currency: {
|
|
987
987
|
code: currency
|
|
@@ -1021,21 +1021,21 @@ function normalizeLineItem(_ref6) {
|
|
|
1021
1021
|
var item = {
|
|
1022
1022
|
id: id,
|
|
1023
1023
|
variantId: variant == null ? void 0 : variant.id,
|
|
1024
|
-
productId: (_product$id = product.id) != null ? _product$id :
|
|
1025
|
-
name: (_product$name = product == null ? void 0 : product.name) != null ? _product$name :
|
|
1024
|
+
productId: (_product$id = product.id) != null ? _product$id : "",
|
|
1025
|
+
name: (_product$name = product == null ? void 0 : product.name) != null ? _product$name : "",
|
|
1026
1026
|
quantity: quantity,
|
|
1027
1027
|
variant: {
|
|
1028
|
-
id: (_variant$id = variant == null ? void 0 : variant.id) != null ? _variant$id :
|
|
1029
|
-
sku: (_variant$sku = variant == null ? void 0 : variant.sku) != null ? _variant$sku :
|
|
1028
|
+
id: (_variant$id = variant == null ? void 0 : variant.id) != null ? _variant$id : "",
|
|
1029
|
+
sku: (_variant$sku = variant == null ? void 0 : variant.sku) != null ? _variant$sku : "",
|
|
1030
1030
|
name: variant == null ? void 0 : variant.name,
|
|
1031
1031
|
image: {
|
|
1032
|
-
url: product != null && product.images && product.images.length > 0 ? product == null ? void 0 : product.images[0].file.url :
|
|
1032
|
+
url: product != null && product.images && product.images.length > 0 ? product == null ? void 0 : product.images[0].file.url : "/"
|
|
1033
1033
|
},
|
|
1034
1034
|
requiresShipping: false,
|
|
1035
1035
|
price: price,
|
|
1036
1036
|
listPrice: price
|
|
1037
1037
|
},
|
|
1038
|
-
path:
|
|
1038
|
+
path: "",
|
|
1039
1039
|
discounts: [],
|
|
1040
1040
|
options: [{
|
|
1041
1041
|
value: variant == null ? void 0 : variant.name
|
|
@@ -1048,13 +1048,19 @@ function normalizeCategory(_ref7) {
|
|
|
1048
1048
|
var id = _ref7.id,
|
|
1049
1049
|
name = _ref7.name,
|
|
1050
1050
|
slug = _ref7.slug,
|
|
1051
|
-
products = _ref7.products
|
|
1051
|
+
products = _ref7.products,
|
|
1052
|
+
images = _ref7.images;
|
|
1052
1053
|
return {
|
|
1053
1054
|
id: id,
|
|
1054
1055
|
name: name,
|
|
1055
1056
|
slug: slug,
|
|
1056
1057
|
path: "/" + slug,
|
|
1057
|
-
isEmpty: (products == null ? void 0 : products.length) === 0
|
|
1058
|
+
isEmpty: (products == null ? void 0 : products.length) === 0,
|
|
1059
|
+
images: images == null ? void 0 : images.map(function (image) {
|
|
1060
|
+
return {
|
|
1061
|
+
url: image.file.url
|
|
1062
|
+
};
|
|
1063
|
+
})
|
|
1058
1064
|
};
|
|
1059
1065
|
}
|
|
1060
1066
|
|