@anker-in/shopify-react 0.1.1-beta.33 → 0.1.1-beta.35

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.
@@ -70,7 +70,7 @@ function normalizeAddToCartLines(lines) {
70
70
  const product = variant.product;
71
71
  const quantity = line.quantity || 1;
72
72
  const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
73
- const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
73
+ const finalPrice = variant.finalPrice?.amount === void 0 ? originalPrice : Number(variant.finalPrice?.amount);
74
74
  const subtotalAmount = originalPrice * quantity;
75
75
  const totalAmount = finalPrice * quantity;
76
76
  return {
@@ -739,7 +739,7 @@ var trackAddToCartGA = ({
739
739
  const currencyCode = variant.product?.price?.currencyCode;
740
740
  const totalPrice = lineItems?.reduce(
741
741
  (prev, { variant: variant2 }) => prev.plus(
742
- variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? variant2?.price?.amount ?? 0
742
+ variant2?.finalPrice?.amount === void 0 ? Number(variant2?.price?.amount) || 0 : Number(variant2?.finalPrice?.amount) || 0
743
743
  ),
744
744
  new Decimal2(0)
745
745
  ).toNumber();
@@ -775,7 +775,7 @@ var trackBuyNowGA = ({
775
775
  const currencyCode = variant.product?.price?.currencyCode || variant.price?.currencyCode;
776
776
  const totalPrice = lineItems?.reduce(
777
777
  (prev, { variant: variant2 }) => prev.plus(
778
- variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? variant2?.price?.amount ?? 0
778
+ variant2?.finalPrice?.amount === void 0 ? Number(variant2?.price?.amount) || 0 : Number(variant2?.finalPrice?.amount) || 0
779
779
  ),
780
780
  new Decimal2(0)
781
781
  ).toNumber();
@@ -948,7 +948,7 @@ var getLinesWithFunctionAttributes = (lineItems) => {
948
948
  key: CUSTOMER_ATTRIBUTE_KEY,
949
949
  value: JSON.stringify({
950
950
  is_gift: false,
951
- discounted_amount: Number(line.variant?.finalPrice?.amount || line.variant?.price?.amount) * (line.quantity || 1)
951
+ discounted_amount: line.variant?.finalPrice?.amount === void 0 ? Number(line.variant?.price?.amount) * (line.quantity || 1) : Number(line.variant?.finalPrice?.amount) * (line.quantity || 1)
952
952
  })
953
953
  }
954
954
  ]);