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

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/index.mjs CHANGED
@@ -159,7 +159,7 @@ function normalizeAddToCartLines(lines) {
159
159
  const product = variant.product;
160
160
  const quantity = line.quantity || 1;
161
161
  const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
162
- const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
162
+ const finalPrice = variant.finalPrice?.amount === void 0 ? originalPrice : Number(variant.finalPrice?.amount);
163
163
  const subtotalAmount = originalPrice * quantity;
164
164
  const totalAmount = finalPrice * quantity;
165
165
  return {
@@ -818,7 +818,7 @@ var trackAddToCartGA = ({
818
818
  const currencyCode = variant.product?.price?.currencyCode;
819
819
  const totalPrice = lineItems?.reduce(
820
820
  (prev, { variant: variant2 }) => prev.plus(
821
- variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? variant2?.price?.amount ?? 0
821
+ variant2?.finalPrice?.amount === void 0 ? Number(variant2?.price?.amount) || 0 : Number(variant2?.finalPrice?.amount) || 0
822
822
  ),
823
823
  new Decimal2(0)
824
824
  ).toNumber();
@@ -853,7 +853,7 @@ var trackBeginCheckoutGA = ({
853
853
  }
854
854
  const totalPrice = lineItems?.reduce(
855
855
  (prev, { variant }) => prev.plus(
856
- variant?.finalPrice?.amount ?? variant?.compareAtPrice?.amount ?? variant?.price?.amount ?? 0
856
+ variant?.finalPrice?.amount === void 0 ? Number(variant?.price?.amount) || 0 : Number(variant?.finalPrice?.amount) || 0
857
857
  ),
858
858
  new Decimal2(0)
859
859
  ).toNumber();
@@ -889,7 +889,7 @@ var trackBuyNowGA = ({
889
889
  const currencyCode = variant.product?.price?.currencyCode || variant.price?.currencyCode;
890
890
  const totalPrice = lineItems?.reduce(
891
891
  (prev, { variant: variant2 }) => prev.plus(
892
- variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? variant2?.price?.amount ?? 0
892
+ variant2?.finalPrice?.amount === void 0 ? Number(variant2?.price?.amount) || 0 : Number(variant2?.finalPrice?.amount) || 0
893
893
  ),
894
894
  new Decimal2(0)
895
895
  ).toNumber();
@@ -1062,7 +1062,7 @@ var getLinesWithFunctionAttributes = (lineItems) => {
1062
1062
  key: CUSTOMER_ATTRIBUTE_KEY,
1063
1063
  value: JSON.stringify({
1064
1064
  is_gift: false,
1065
- discounted_amount: Number(line.variant?.finalPrice?.amount || line.variant?.price?.amount) * (line.quantity || 1)
1065
+ discounted_amount: line.variant?.finalPrice?.amount === void 0 ? Number(line.variant?.price?.amount) * (line.quantity || 1) : Number(line.variant?.finalPrice?.amount) * (line.quantity || 1)
1066
1066
  })
1067
1067
  }
1068
1068
  ]);