@anker-in/shopify-react 0.1.1-beta.44 → 0.1.1-beta.45
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.d.mts +79 -79
- package/dist/hooks/index.d.ts +79 -79
- package/dist/hooks/index.js +48 -47
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +48 -47
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +48 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -47
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.js +1 -1
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +1 -1
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1369,7 +1369,7 @@ function getCartAttributes({
|
|
|
1369
1369
|
},
|
|
1370
1370
|
{
|
|
1371
1371
|
key: "_member_type",
|
|
1372
|
-
value: memberType ?? String(profile?.memberType
|
|
1372
|
+
value: memberType ?? String(profile?.memberType)
|
|
1373
1373
|
},
|
|
1374
1374
|
{
|
|
1375
1375
|
key: "_user_type",
|
|
@@ -1493,51 +1493,6 @@ var useCartItemQuantityLimit = ({
|
|
|
1493
1493
|
}, [cartItem, cart]);
|
|
1494
1494
|
return quantityLimit;
|
|
1495
1495
|
};
|
|
1496
|
-
function hasPlusMemberInLines({
|
|
1497
|
-
memberSetting,
|
|
1498
|
-
lines
|
|
1499
|
-
}) {
|
|
1500
|
-
const { plus_monthly_product, plus_annual_product } = memberSetting || {};
|
|
1501
|
-
if (!lines || lines.length === 0) {
|
|
1502
|
-
return {
|
|
1503
|
-
hasPlusMember: false,
|
|
1504
|
-
hasMonthlyPlus: false,
|
|
1505
|
-
hasAnnualPlus: false
|
|
1506
|
-
};
|
|
1507
|
-
}
|
|
1508
|
-
const monthlyPlusLine = lines.find((line) => {
|
|
1509
|
-
const variantHandle = line.variant?.product?.handle;
|
|
1510
|
-
const variantSku = line.variant?.sku;
|
|
1511
|
-
return variantHandle === plus_monthly_product?.handle && variantSku === plus_monthly_product?.sku;
|
|
1512
|
-
});
|
|
1513
|
-
const annualPlusLine = lines.find((line) => {
|
|
1514
|
-
const variantHandle = line.variant?.product?.handle;
|
|
1515
|
-
const variantSku = line.variant?.sku;
|
|
1516
|
-
return variantHandle === plus_annual_product?.handle && variantSku === plus_annual_product?.sku;
|
|
1517
|
-
});
|
|
1518
|
-
const hasMonthlyPlus = !!monthlyPlusLine;
|
|
1519
|
-
const hasAnnualPlus = !!annualPlusLine;
|
|
1520
|
-
const hasPlusMember = hasMonthlyPlus || hasAnnualPlus;
|
|
1521
|
-
return {
|
|
1522
|
-
hasPlusMember,
|
|
1523
|
-
hasMonthlyPlus,
|
|
1524
|
-
hasAnnualPlus,
|
|
1525
|
-
monthlyPlusLine,
|
|
1526
|
-
annualPlusLine
|
|
1527
|
-
};
|
|
1528
|
-
}
|
|
1529
|
-
function useHasPlusMemberInLines({
|
|
1530
|
-
memberSetting,
|
|
1531
|
-
lines
|
|
1532
|
-
}) {
|
|
1533
|
-
return useMemo(
|
|
1534
|
-
() => hasPlusMemberInLines({
|
|
1535
|
-
memberSetting,
|
|
1536
|
-
lines
|
|
1537
|
-
}),
|
|
1538
|
-
[memberSetting, lines]
|
|
1539
|
-
);
|
|
1540
|
-
}
|
|
1541
1496
|
var useUpdateLineCodeAmountAttributes = ({
|
|
1542
1497
|
cart,
|
|
1543
1498
|
mutateCart,
|
|
@@ -2095,6 +2050,51 @@ function useHasPlusMemberInCart({
|
|
|
2095
2050
|
[memberSetting, cart]
|
|
2096
2051
|
);
|
|
2097
2052
|
}
|
|
2053
|
+
function hasPlusMemberInLines({
|
|
2054
|
+
memberSetting,
|
|
2055
|
+
lines
|
|
2056
|
+
}) {
|
|
2057
|
+
const { plus_monthly_product, plus_annual_product } = memberSetting || {};
|
|
2058
|
+
if (!lines || lines.length === 0) {
|
|
2059
|
+
return {
|
|
2060
|
+
hasPlusMember: false,
|
|
2061
|
+
hasMonthlyPlus: false,
|
|
2062
|
+
hasAnnualPlus: false
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
const monthlyPlusLine = lines.find((line) => {
|
|
2066
|
+
const variantHandle = line.variant?.product?.handle;
|
|
2067
|
+
const variantSku = line.variant?.sku;
|
|
2068
|
+
return variantHandle === plus_monthly_product?.handle && variantSku === plus_monthly_product?.sku;
|
|
2069
|
+
});
|
|
2070
|
+
const annualPlusLine = lines.find((line) => {
|
|
2071
|
+
const variantHandle = line.variant?.product?.handle;
|
|
2072
|
+
const variantSku = line.variant?.sku;
|
|
2073
|
+
return variantHandle === plus_annual_product?.handle && variantSku === plus_annual_product?.sku;
|
|
2074
|
+
});
|
|
2075
|
+
const hasMonthlyPlus = !!monthlyPlusLine;
|
|
2076
|
+
const hasAnnualPlus = !!annualPlusLine;
|
|
2077
|
+
const hasPlusMember = hasMonthlyPlus || hasAnnualPlus;
|
|
2078
|
+
return {
|
|
2079
|
+
hasPlusMember,
|
|
2080
|
+
hasMonthlyPlus,
|
|
2081
|
+
hasAnnualPlus,
|
|
2082
|
+
monthlyPlusLine,
|
|
2083
|
+
annualPlusLine
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
function useHasPlusMemberInLines({
|
|
2087
|
+
memberSetting,
|
|
2088
|
+
lines
|
|
2089
|
+
}) {
|
|
2090
|
+
return useMemo(
|
|
2091
|
+
() => hasPlusMemberInLines({
|
|
2092
|
+
memberSetting,
|
|
2093
|
+
lines
|
|
2094
|
+
}),
|
|
2095
|
+
[memberSetting, lines]
|
|
2096
|
+
);
|
|
2097
|
+
}
|
|
2098
2098
|
function usePlusMemberNeedAddToCart({
|
|
2099
2099
|
cart,
|
|
2100
2100
|
profile
|
|
@@ -2358,11 +2358,12 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
|
|
|
2358
2358
|
if (!lineItems || lineItems.length === 0) {
|
|
2359
2359
|
return;
|
|
2360
2360
|
}
|
|
2361
|
-
const { hasPlusMember } =
|
|
2361
|
+
const { hasPlusMember } = hasPlusMemberInLines({
|
|
2362
2362
|
memberSetting,
|
|
2363
2363
|
lines: lineItems
|
|
2364
2364
|
});
|
|
2365
2365
|
const memberType = hasPlusMember ? "2" : String(profile?.memberType ?? 0);
|
|
2366
|
+
console.log("customer", customer);
|
|
2366
2367
|
const cartAttributes = getCartAttributes({
|
|
2367
2368
|
profile,
|
|
2368
2369
|
customer,
|