@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/index.js
CHANGED
|
@@ -166,7 +166,7 @@ function normalizeAddToCartLines(lines) {
|
|
|
166
166
|
customAttributes: line.attributes || [],
|
|
167
167
|
variant: {
|
|
168
168
|
id: variant.id,
|
|
169
|
-
price:
|
|
169
|
+
price: finalPrice,
|
|
170
170
|
listPrice: variant.compareAtPrice?.amount ? Number(variant.compareAtPrice.amount) : 0,
|
|
171
171
|
sku: variant.sku || "",
|
|
172
172
|
name: variant.title || "",
|
|
@@ -197,7 +197,7 @@ function createMockCartFromLines(lines, existingCart) {
|
|
|
197
197
|
const normalizedLines = normalizeAddToCartLines(lines);
|
|
198
198
|
const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
|
|
199
199
|
const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
|
|
200
|
-
console.log("lines
|
|
200
|
+
console.log("lines createMockCartFromLines4444", normalizedLines, lines);
|
|
201
201
|
const currency = lines[0]?.variant?.price?.currencyCode;
|
|
202
202
|
return {
|
|
203
203
|
id: existingCart?.id || "temp-cart-id",
|
|
@@ -447,6 +447,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
447
447
|
}
|
|
448
448
|
return cart;
|
|
449
449
|
}, [lines, cart]);
|
|
450
|
+
console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
|
|
450
451
|
const { activeCampaign, subtotal } = react.useMemo(() => {
|
|
451
452
|
for (const campaign of autoFreeGiftConfig) {
|
|
452
453
|
const { rule_conditions = [], rule_result } = campaign;
|
|
@@ -462,6 +463,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
462
463
|
all_store_variant: spend_get_reward.main_product?.all_store_variant || false
|
|
463
464
|
}
|
|
464
465
|
);
|
|
466
|
+
console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
|
|
465
467
|
if (matchedSubtotal > 0) {
|
|
466
468
|
return { activeCampaign: campaign, subtotal: matchedSubtotal };
|
|
467
469
|
}
|