@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/hooks/index.js +4 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +4 -2
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +4 -2
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/hooks/index.js
CHANGED
|
@@ -95,7 +95,7 @@ function normalizeAddToCartLines(lines) {
|
|
|
95
95
|
customAttributes: line.attributes || [],
|
|
96
96
|
variant: {
|
|
97
97
|
id: variant.id,
|
|
98
|
-
price:
|
|
98
|
+
price: finalPrice,
|
|
99
99
|
listPrice: variant.compareAtPrice?.amount ? Number(variant.compareAtPrice.amount) : 0,
|
|
100
100
|
sku: variant.sku || "",
|
|
101
101
|
name: variant.title || "",
|
|
@@ -126,7 +126,7 @@ function createMockCartFromLines(lines, existingCart) {
|
|
|
126
126
|
const normalizedLines = normalizeAddToCartLines(lines);
|
|
127
127
|
const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
|
|
128
128
|
const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
|
|
129
|
-
console.log("lines
|
|
129
|
+
console.log("lines createMockCartFromLines4444", normalizedLines, lines);
|
|
130
130
|
const currency = lines[0]?.variant?.price?.currencyCode;
|
|
131
131
|
return {
|
|
132
132
|
id: existingCart?.id || "temp-cart-id",
|
|
@@ -376,6 +376,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
376
376
|
}
|
|
377
377
|
return cart;
|
|
378
378
|
}, [lines, cart]);
|
|
379
|
+
console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
|
|
379
380
|
const { activeCampaign, subtotal } = react.useMemo(() => {
|
|
380
381
|
for (const campaign of autoFreeGiftConfig) {
|
|
381
382
|
const { rule_conditions = [], rule_result } = campaign;
|
|
@@ -391,6 +392,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
391
392
|
all_store_variant: spend_get_reward.main_product?.all_store_variant || false
|
|
392
393
|
}
|
|
393
394
|
);
|
|
395
|
+
console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
|
|
394
396
|
if (matchedSubtotal > 0) {
|
|
395
397
|
return { activeCampaign: campaign, subtotal: matchedSubtotal };
|
|
396
398
|
}
|