@anker-in/shopify-react 0.1.1-beta.44 → 0.1.1-beta.46
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 -48
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +48 -48
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +48 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -48
- 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/hooks/index.mjs
CHANGED
|
@@ -1255,7 +1255,7 @@ function getCartAttributes({
|
|
|
1255
1255
|
},
|
|
1256
1256
|
{
|
|
1257
1257
|
key: "_member_type",
|
|
1258
|
-
value: memberType ?? String(profile?.memberType
|
|
1258
|
+
value: memberType ?? String(profile?.memberType)
|
|
1259
1259
|
},
|
|
1260
1260
|
{
|
|
1261
1261
|
key: "_user_type",
|
|
@@ -1379,51 +1379,6 @@ var useCartItemQuantityLimit = ({
|
|
|
1379
1379
|
}, [cartItem, cart]);
|
|
1380
1380
|
return quantityLimit;
|
|
1381
1381
|
};
|
|
1382
|
-
function hasPlusMemberInLines({
|
|
1383
|
-
memberSetting,
|
|
1384
|
-
lines
|
|
1385
|
-
}) {
|
|
1386
|
-
const { plus_monthly_product, plus_annual_product } = memberSetting || {};
|
|
1387
|
-
if (!lines || lines.length === 0) {
|
|
1388
|
-
return {
|
|
1389
|
-
hasPlusMember: false,
|
|
1390
|
-
hasMonthlyPlus: false,
|
|
1391
|
-
hasAnnualPlus: false
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
|
-
const monthlyPlusLine = lines.find((line) => {
|
|
1395
|
-
const variantHandle = line.variant?.product?.handle;
|
|
1396
|
-
const variantSku = line.variant?.sku;
|
|
1397
|
-
return variantHandle === plus_monthly_product?.handle && variantSku === plus_monthly_product?.sku;
|
|
1398
|
-
});
|
|
1399
|
-
const annualPlusLine = lines.find((line) => {
|
|
1400
|
-
const variantHandle = line.variant?.product?.handle;
|
|
1401
|
-
const variantSku = line.variant?.sku;
|
|
1402
|
-
return variantHandle === plus_annual_product?.handle && variantSku === plus_annual_product?.sku;
|
|
1403
|
-
});
|
|
1404
|
-
const hasMonthlyPlus = !!monthlyPlusLine;
|
|
1405
|
-
const hasAnnualPlus = !!annualPlusLine;
|
|
1406
|
-
const hasPlusMember = hasMonthlyPlus || hasAnnualPlus;
|
|
1407
|
-
return {
|
|
1408
|
-
hasPlusMember,
|
|
1409
|
-
hasMonthlyPlus,
|
|
1410
|
-
hasAnnualPlus,
|
|
1411
|
-
monthlyPlusLine,
|
|
1412
|
-
annualPlusLine
|
|
1413
|
-
};
|
|
1414
|
-
}
|
|
1415
|
-
function useHasPlusMemberInLines({
|
|
1416
|
-
memberSetting,
|
|
1417
|
-
lines
|
|
1418
|
-
}) {
|
|
1419
|
-
return useMemo(
|
|
1420
|
-
() => hasPlusMemberInLines({
|
|
1421
|
-
memberSetting,
|
|
1422
|
-
lines
|
|
1423
|
-
}),
|
|
1424
|
-
[memberSetting, lines]
|
|
1425
|
-
);
|
|
1426
|
-
}
|
|
1427
1382
|
var useUpdateLineCodeAmountAttributes = ({
|
|
1428
1383
|
cart,
|
|
1429
1384
|
mutateCart,
|
|
@@ -1981,6 +1936,51 @@ function useHasPlusMemberInCart({
|
|
|
1981
1936
|
[memberSetting, cart]
|
|
1982
1937
|
);
|
|
1983
1938
|
}
|
|
1939
|
+
function hasPlusMemberInLines({
|
|
1940
|
+
memberSetting,
|
|
1941
|
+
lines
|
|
1942
|
+
}) {
|
|
1943
|
+
const { plus_monthly_product, plus_annual_product } = memberSetting || {};
|
|
1944
|
+
if (!lines || lines.length === 0) {
|
|
1945
|
+
return {
|
|
1946
|
+
hasPlusMember: false,
|
|
1947
|
+
hasMonthlyPlus: false,
|
|
1948
|
+
hasAnnualPlus: false
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
const monthlyPlusLine = lines.find((line) => {
|
|
1952
|
+
const variantHandle = line.variant?.product?.handle;
|
|
1953
|
+
const variantSku = line.variant?.sku;
|
|
1954
|
+
return variantHandle === plus_monthly_product?.handle && variantSku === plus_monthly_product?.sku;
|
|
1955
|
+
});
|
|
1956
|
+
const annualPlusLine = lines.find((line) => {
|
|
1957
|
+
const variantHandle = line.variant?.product?.handle;
|
|
1958
|
+
const variantSku = line.variant?.sku;
|
|
1959
|
+
return variantHandle === plus_annual_product?.handle && variantSku === plus_annual_product?.sku;
|
|
1960
|
+
});
|
|
1961
|
+
const hasMonthlyPlus = !!monthlyPlusLine;
|
|
1962
|
+
const hasAnnualPlus = !!annualPlusLine;
|
|
1963
|
+
const hasPlusMember = hasMonthlyPlus || hasAnnualPlus;
|
|
1964
|
+
return {
|
|
1965
|
+
hasPlusMember,
|
|
1966
|
+
hasMonthlyPlus,
|
|
1967
|
+
hasAnnualPlus,
|
|
1968
|
+
monthlyPlusLine,
|
|
1969
|
+
annualPlusLine
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
function useHasPlusMemberInLines({
|
|
1973
|
+
memberSetting,
|
|
1974
|
+
lines
|
|
1975
|
+
}) {
|
|
1976
|
+
return useMemo(
|
|
1977
|
+
() => hasPlusMemberInLines({
|
|
1978
|
+
memberSetting,
|
|
1979
|
+
lines
|
|
1980
|
+
}),
|
|
1981
|
+
[memberSetting, lines]
|
|
1982
|
+
);
|
|
1983
|
+
}
|
|
1984
1984
|
function usePlusMemberNeedAddToCart({
|
|
1985
1985
|
cart,
|
|
1986
1986
|
profile
|
|
@@ -2244,7 +2244,7 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
|
|
|
2244
2244
|
if (!lineItems || lineItems.length === 0) {
|
|
2245
2245
|
return;
|
|
2246
2246
|
}
|
|
2247
|
-
const { hasPlusMember } =
|
|
2247
|
+
const { hasPlusMember } = hasPlusMemberInLines({
|
|
2248
2248
|
memberSetting,
|
|
2249
2249
|
lines: lineItems
|
|
2250
2250
|
});
|
|
@@ -2298,7 +2298,7 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
|
|
|
2298
2298
|
}
|
|
2299
2299
|
return resultCart;
|
|
2300
2300
|
},
|
|
2301
|
-
[client, locale, isLoggedIn, cartCookieAdapter, withTrack]
|
|
2301
|
+
[client, locale, isLoggedIn, cartCookieAdapter, withTrack, customer, profile, memberSetting]
|
|
2302
2302
|
);
|
|
2303
2303
|
return useSWRMutation("buy-now", buyNow, swrOptions);
|
|
2304
2304
|
}
|