@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/index.js CHANGED
@@ -1377,7 +1377,7 @@ function getCartAttributes({
1377
1377
  },
1378
1378
  {
1379
1379
  key: "_member_type",
1380
- value: memberType ?? String(profile?.memberType || 0)
1380
+ value: memberType ?? String(profile?.memberType)
1381
1381
  },
1382
1382
  {
1383
1383
  key: "_user_type",
@@ -1501,51 +1501,6 @@ var useCartItemQuantityLimit = ({
1501
1501
  }, [cartItem, cart]);
1502
1502
  return quantityLimit;
1503
1503
  };
1504
- function hasPlusMemberInLines({
1505
- memberSetting,
1506
- lines
1507
- }) {
1508
- const { plus_monthly_product, plus_annual_product } = memberSetting || {};
1509
- if (!lines || lines.length === 0) {
1510
- return {
1511
- hasPlusMember: false,
1512
- hasMonthlyPlus: false,
1513
- hasAnnualPlus: false
1514
- };
1515
- }
1516
- const monthlyPlusLine = lines.find((line) => {
1517
- const variantHandle = line.variant?.product?.handle;
1518
- const variantSku = line.variant?.sku;
1519
- return variantHandle === plus_monthly_product?.handle && variantSku === plus_monthly_product?.sku;
1520
- });
1521
- const annualPlusLine = lines.find((line) => {
1522
- const variantHandle = line.variant?.product?.handle;
1523
- const variantSku = line.variant?.sku;
1524
- return variantHandle === plus_annual_product?.handle && variantSku === plus_annual_product?.sku;
1525
- });
1526
- const hasMonthlyPlus = !!monthlyPlusLine;
1527
- const hasAnnualPlus = !!annualPlusLine;
1528
- const hasPlusMember = hasMonthlyPlus || hasAnnualPlus;
1529
- return {
1530
- hasPlusMember,
1531
- hasMonthlyPlus,
1532
- hasAnnualPlus,
1533
- monthlyPlusLine,
1534
- annualPlusLine
1535
- };
1536
- }
1537
- function useHasPlusMemberInLines({
1538
- memberSetting,
1539
- lines
1540
- }) {
1541
- return react.useMemo(
1542
- () => hasPlusMemberInLines({
1543
- memberSetting,
1544
- lines
1545
- }),
1546
- [memberSetting, lines]
1547
- );
1548
- }
1549
1504
  var useUpdateLineCodeAmountAttributes = ({
1550
1505
  cart,
1551
1506
  mutateCart,
@@ -2103,6 +2058,51 @@ function useHasPlusMemberInCart({
2103
2058
  [memberSetting, cart]
2104
2059
  );
2105
2060
  }
2061
+ function hasPlusMemberInLines({
2062
+ memberSetting,
2063
+ lines
2064
+ }) {
2065
+ const { plus_monthly_product, plus_annual_product } = memberSetting || {};
2066
+ if (!lines || lines.length === 0) {
2067
+ return {
2068
+ hasPlusMember: false,
2069
+ hasMonthlyPlus: false,
2070
+ hasAnnualPlus: false
2071
+ };
2072
+ }
2073
+ const monthlyPlusLine = lines.find((line) => {
2074
+ const variantHandle = line.variant?.product?.handle;
2075
+ const variantSku = line.variant?.sku;
2076
+ return variantHandle === plus_monthly_product?.handle && variantSku === plus_monthly_product?.sku;
2077
+ });
2078
+ const annualPlusLine = lines.find((line) => {
2079
+ const variantHandle = line.variant?.product?.handle;
2080
+ const variantSku = line.variant?.sku;
2081
+ return variantHandle === plus_annual_product?.handle && variantSku === plus_annual_product?.sku;
2082
+ });
2083
+ const hasMonthlyPlus = !!monthlyPlusLine;
2084
+ const hasAnnualPlus = !!annualPlusLine;
2085
+ const hasPlusMember = hasMonthlyPlus || hasAnnualPlus;
2086
+ return {
2087
+ hasPlusMember,
2088
+ hasMonthlyPlus,
2089
+ hasAnnualPlus,
2090
+ monthlyPlusLine,
2091
+ annualPlusLine
2092
+ };
2093
+ }
2094
+ function useHasPlusMemberInLines({
2095
+ memberSetting,
2096
+ lines
2097
+ }) {
2098
+ return react.useMemo(
2099
+ () => hasPlusMemberInLines({
2100
+ memberSetting,
2101
+ lines
2102
+ }),
2103
+ [memberSetting, lines]
2104
+ );
2105
+ }
2106
2106
  function usePlusMemberNeedAddToCart({
2107
2107
  cart,
2108
2108
  profile
@@ -2366,11 +2366,12 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
2366
2366
  if (!lineItems || lineItems.length === 0) {
2367
2367
  return;
2368
2368
  }
2369
- const { hasPlusMember } = useHasPlusMemberInLines({
2369
+ const { hasPlusMember } = hasPlusMemberInLines({
2370
2370
  memberSetting,
2371
2371
  lines: lineItems
2372
2372
  });
2373
2373
  const memberType = hasPlusMember ? "2" : String(profile?.memberType ?? 0);
2374
+ console.log("customer", customer);
2374
2375
  const cartAttributes = getCartAttributes({
2375
2376
  profile,
2376
2377
  customer,