@anker-in/shopify-react 0.1.1-beta.24 → 0.1.1-beta.26

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
@@ -158,7 +158,7 @@ function normalizeAddToCartLines(lines) {
158
158
  customAttributes: line.attributes || [],
159
159
  variant: {
160
160
  id: variant.id,
161
- price: variant.price?.amount ? Number(variant.price.amount) : 0,
161
+ price: finalPrice,
162
162
  listPrice: variant.compareAtPrice?.amount ? Number(variant.compareAtPrice.amount) : 0,
163
163
  sku: variant.sku || "",
164
164
  name: variant.title || "",
@@ -189,7 +189,7 @@ function createMockCartFromLines(lines, existingCart) {
189
189
  const normalizedLines = normalizeAddToCartLines(lines);
190
190
  const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
191
191
  const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
192
- console.log("lines createMockCartFromLines", lines);
192
+ console.log("lines createMockCartFromLines4444", normalizedLines, lines);
193
193
  const currency = lines[0]?.variant?.price?.currencyCode;
194
194
  return {
195
195
  id: existingCart?.id || "temp-cart-id",
@@ -439,6 +439,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
439
439
  }
440
440
  return cart;
441
441
  }, [lines, cart]);
442
+ console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
442
443
  const { activeCampaign, subtotal } = useMemo(() => {
443
444
  for (const campaign of autoFreeGiftConfig) {
444
445
  const { rule_conditions = [], rule_result } = campaign;
@@ -454,6 +455,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
454
455
  all_store_variant: spend_get_reward.main_product?.all_store_variant || false
455
456
  }
456
457
  );
458
+ console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
457
459
  if (matchedSubtotal > 0) {
458
460
  return { activeCampaign: campaign, subtotal: matchedSubtotal };
459
461
  }