@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.
@@ -79,7 +79,7 @@ function normalizeAddToCartLines(lines) {
79
79
  const product = variant.product;
80
80
  const quantity = line.quantity || 1;
81
81
  const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
82
- const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
82
+ const finalPrice = variant.finalPrice?.amount === void 0 ? originalPrice : Number(variant.finalPrice?.amount);
83
83
  const subtotalAmount = originalPrice * quantity;
84
84
  const totalAmount = finalPrice * quantity;
85
85
  return {
@@ -748,7 +748,7 @@ var trackAddToCartGA = ({
748
748
  const currencyCode = variant.product?.price?.currencyCode;
749
749
  const totalPrice = lineItems?.reduce(
750
750
  (prev, { variant: variant2 }) => prev.plus(
751
- variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? variant2?.price?.amount ?? 0
751
+ variant2?.finalPrice?.amount === void 0 ? Number(variant2?.price?.amount) || 0 : Number(variant2?.finalPrice?.amount) || 0
752
752
  ),
753
753
  new Decimal2__default.default(0)
754
754
  ).toNumber();
@@ -784,7 +784,7 @@ var trackBuyNowGA = ({
784
784
  const currencyCode = variant.product?.price?.currencyCode || variant.price?.currencyCode;
785
785
  const totalPrice = lineItems?.reduce(
786
786
  (prev, { variant: variant2 }) => prev.plus(
787
- variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? variant2?.price?.amount ?? 0
787
+ variant2?.finalPrice?.amount === void 0 ? Number(variant2?.price?.amount) || 0 : Number(variant2?.finalPrice?.amount) || 0
788
788
  ),
789
789
  new Decimal2__default.default(0)
790
790
  ).toNumber();
@@ -957,7 +957,7 @@ var getLinesWithFunctionAttributes = (lineItems) => {
957
957
  key: CUSTOMER_ATTRIBUTE_KEY,
958
958
  value: JSON.stringify({
959
959
  is_gift: false,
960
- discounted_amount: Number(line.variant?.finalPrice?.amount || line.variant?.price?.amount) * (line.quantity || 1)
960
+ discounted_amount: line.variant?.finalPrice?.amount === void 0 ? Number(line.variant?.price?.amount) * (line.quantity || 1) : Number(line.variant?.finalPrice?.amount) * (line.quantity || 1)
961
961
  })
962
962
  }
963
963
  ]);