@anker-in/shopify-react 0.1.1-beta.3 → 0.1.1-beta.31

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.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  import { createContext, useMemo, useContext, useRef, useState, useEffect, useCallback } from 'react';
2
- import { createShopifyClient, getProductsByHandles, createCart, updateCartCodes, addCartLines, updateCartLines, removeCartLines, updateCartAttributes, getProduct, getAllProducts, getCollection, getAllCollections, getCollections, getBlog, getAllBlogs, getArticle, getArticles, getArticlesInBlog, getLocalStorage, getCart, setLocalStorage } from '@anker-in/shopify-sdk';
3
- export { ShopifyConfig, clearLocalStorage, createShopifyClient, getLocalStorage, removeLocalStorage, setLocalStorage } from '@anker-in/shopify-sdk';
2
+ import { createShopifyClient, getProductsByHandles, createCart, updateCartCodes, addCartLines, updateCartLines, removeCartLines, updateCartAttributes, getLocalStorage, getProduct, getAllProducts, getCollection, getAllCollections, getCollections, getBlog, getAllBlogs, getArticle, getArticles, getArticlesInBlog, getCart, setLocalStorage, updateCartDeliveryOptions } from '@anker-in/shopify-sdk';
3
+ export * from '@anker-in/shopify-sdk';
4
4
  import Cookies5 from 'js-cookie';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
  import Decimal2 from 'decimal.js';
7
+ import { atobID, btoaID } from '@anker-in/shopify-core';
7
8
  import useSWR from 'swr';
8
9
  import useSWRMutation from 'swr/mutation';
9
10
  import { useRequest } from 'ahooks';
@@ -140,9 +141,10 @@ function normalizeAddToCartLines(lines) {
140
141
  const variant = line.variant;
141
142
  const product = variant.product;
142
143
  const quantity = line.quantity || 1;
143
- const price = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : variant.compareAtPrice?.amount ? Number(variant.compareAtPrice.amount) : variant.price?.amount ? Number(variant.price.amount) : 0;
144
- const subtotalAmount = price * quantity;
145
- const totalAmount = subtotalAmount;
144
+ const originalPrice = variant.price?.amount ? Number(variant.price.amount) : 0;
145
+ const finalPrice = variant.finalPrice?.amount ? Number(variant.finalPrice.amount) : originalPrice;
146
+ const subtotalAmount = originalPrice * quantity;
147
+ const totalAmount = finalPrice * quantity;
146
148
  return {
147
149
  id: `temp-line-${index}-${variant.id}`,
148
150
  // Temporary ID for pre-cart lines
@@ -156,7 +158,7 @@ function normalizeAddToCartLines(lines) {
156
158
  customAttributes: line.attributes || [],
157
159
  variant: {
158
160
  id: variant.id,
159
- price,
161
+ price: finalPrice,
160
162
  listPrice: variant.compareAtPrice?.amount ? Number(variant.compareAtPrice.amount) : 0,
161
163
  sku: variant.sku || "",
162
164
  name: variant.title || "",
@@ -187,15 +189,16 @@ function createMockCartFromLines(lines, existingCart) {
187
189
  const normalizedLines = normalizeAddToCartLines(lines);
188
190
  const subtotalPrice = normalizedLines.reduce((sum, line) => sum + line.subtotalAmount, 0);
189
191
  const totalPrice = normalizedLines.reduce((sum, line) => sum + line.totalAmount, 0);
192
+ const currency = lines[0]?.variant?.price?.currencyCode;
190
193
  return {
191
194
  id: existingCart?.id || "temp-cart-id",
192
195
  customerId: existingCart?.customerId,
193
196
  email: existingCart?.email,
194
197
  createdAt: existingCart?.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
195
- currency: existingCart?.currency || { code: "USD" },
198
+ currency: existingCart?.currency || { code: currency },
196
199
  taxesIncluded: existingCart?.taxesIncluded,
197
200
  lineItems: normalizedLines,
198
- totallineItemsDiscount: 0,
201
+ totalLineItemsDiscount: 0,
199
202
  orderDiscounts: 0,
200
203
  lineItemsSubtotalPrice: subtotalPrice,
201
204
  subtotalPrice,
@@ -226,16 +229,6 @@ var getQuery = () => {
226
229
  }
227
230
  return theRequest;
228
231
  };
229
- function atobID(id) {
230
- if (id && typeof id === "string" && id.includes("/")) {
231
- return id.split("/").pop()?.split("?")?.shift();
232
- } else {
233
- return id;
234
- }
235
- }
236
- function btoaID(id, type = "ProductVariant") {
237
- return `gid://shopify/${type}/${id}`;
238
- }
239
232
  var getMatchedMainProductSubTotal = (cartData, variant_list, main_product) => {
240
233
  const isAllStoreVariant = main_product?.all_store_variant ?? false;
241
234
  const matchedList = cartData?.lineItems?.filter((line) => {
@@ -445,6 +438,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
445
438
  }
446
439
  return cart;
447
440
  }, [lines, cart]);
441
+ console.log("effectiveCart useCalcAutoFreeGift", effectiveCart);
448
442
  const { activeCampaign, subtotal } = useMemo(() => {
449
443
  for (const campaign of autoFreeGiftConfig) {
450
444
  const { rule_conditions = [], rule_result } = campaign;
@@ -460,6 +454,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
460
454
  all_store_variant: spend_get_reward.main_product?.all_store_variant || false
461
455
  }
462
456
  );
457
+ console.log("matchedSubtotal useCalcAutoFreeGift", matchedSubtotal);
463
458
  if (matchedSubtotal > 0) {
464
459
  return { activeCampaign: campaign, subtotal: matchedSubtotal };
465
460
  }
@@ -472,11 +467,20 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
472
467
  return { qualifyingGift: null, nextTierGoal: null };
473
468
  }
474
469
  const giftTiers = activeCampaign.rule_result.spend_get_reward.gift_product;
475
- const qualifyingTier = [...giftTiers].reverse().find((tier) => subtotal >= Number(tier.spend_sum_money));
476
- const nextGoal = giftTiers.find((tier) => subtotal < Number(tier.spend_sum_money));
470
+ const currentCurrency = effectiveCart?.currency?.code || "";
471
+ console.log("currentCurrency useCalcAutoFreeGift", effectiveCart, currentCurrency);
472
+ const getThresholdAmount = (tier) => {
473
+ if (tier.spend_sum_money_multi_markets?.[currentCurrency]?.value) {
474
+ return Number(tier.spend_sum_money_multi_markets[currentCurrency].value);
475
+ }
476
+ return Number(tier.spend_sum_money || 0);
477
+ };
478
+ const qualifyingTier = [...giftTiers].sort((a, b) => getThresholdAmount(b) - getThresholdAmount(a)).find((tier) => subtotal >= getThresholdAmount(tier));
479
+ const nextGoal = giftTiers.find((tier) => subtotal < getThresholdAmount(tier));
477
480
  if (!qualifyingTier) {
478
481
  return { qualifyingGift: null, nextTierGoal: nextGoal || null };
479
482
  }
483
+ const actualThreshold = getThresholdAmount(qualifyingTier);
480
484
  const formattedGift = {
481
485
  tier: qualifyingTier,
482
486
  itemsToAdd: qualifyingTier.reward_list?.map((reward) => {
@@ -495,7 +499,10 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
495
499
  value: JSON.stringify({
496
500
  is_gift: true,
497
501
  rule_id: activeCampaign.rule_id,
498
- spend_sum_money: qualifyingTier.spend_sum_money
502
+ spend_sum_money: actualThreshold,
503
+ // 使用实际的门槛金额(多币种支持)
504
+ currency_code: currentCurrency
505
+ // 记录当前币种
499
506
  })
500
507
  }
501
508
  ]
@@ -503,7 +510,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
503
510
  }).filter((item) => item !== null)
504
511
  };
505
512
  return { qualifyingGift: formattedGift, nextTierGoal: nextGoal || null };
506
- }, [activeCampaign, subtotal]);
513
+ }, [activeCampaign, subtotal, effectiveCart]);
507
514
  const giftHandles = useMemo(() => {
508
515
  const giftVariant = autoFreeGiftConfig.map(
509
516
  (item) => item.rule_result?.spend_get_reward?.gift_product?.map(
@@ -519,18 +526,24 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
519
526
  }
520
527
  return true;
521
528
  }, [giftHandles]);
522
- const { data: giftProductsResult } = useSWR(shouldFetch ? giftHandles : null, async () => {
523
- const res = await getProductsByHandles(client, {
524
- handles: giftHandles,
525
- locale
526
- });
527
- const result = Array.isArray(res) ? res : [];
528
- giftProductsCache.current = {
529
- data: result,
530
- giftHandles: [...giftHandles]
531
- };
532
- return result;
533
- });
529
+ const { data: giftProductsResult } = useSWR(
530
+ shouldFetch ? giftHandles : null,
531
+ async () => {
532
+ const res = await getProductsByHandles(client, {
533
+ handles: giftHandles,
534
+ locale
535
+ });
536
+ const result = Array.isArray(res) ? res : [];
537
+ giftProductsCache.current = {
538
+ data: result,
539
+ giftHandles: [...giftHandles]
540
+ };
541
+ return result;
542
+ },
543
+ {
544
+ revalidateOnFocus: false
545
+ }
546
+ );
534
547
  const finalGiftProductsResult = useMemo(() => {
535
548
  if (giftProductsCache.current && !shouldFetch) {
536
549
  return giftProductsCache.current.data || void 0;
@@ -583,12 +596,14 @@ var useScriptAutoFreeGift = ({
583
596
  upgrade_multiple2 = 1.2;
584
597
  upgrade_value2 = 40;
585
598
  }
586
- effectiveCart?.lineItems?.forEach(({ customAttributes }) => {
587
- customAttributes?.forEach(({ key, value }) => {
588
- if (key === "_amount_upgrade_multiple") upgrade_multiple2 = Number(value) || 1;
589
- if (key === "_amount_upgrade_value") upgrade_value2 = Number(value) || 0;
590
- });
591
- });
599
+ effectiveCart?.lineItems?.forEach(
600
+ ({ customAttributes }) => {
601
+ customAttributes?.forEach(({ key, value }) => {
602
+ if (key === "_amount_upgrade_multiple") upgrade_multiple2 = Number(value) || 1;
603
+ if (key === "_amount_upgrade_value") upgrade_value2 = Number(value) || 0;
604
+ });
605
+ }
606
+ );
592
607
  return [upgrade_multiple2, upgrade_value2];
593
608
  }, [effectiveCart?.lineItems, points_subscribe]);
594
609
  const breakpoints = useMemo(() => {
@@ -653,18 +668,24 @@ var useScriptAutoFreeGift = ({
653
668
  const nextLevel = levelIndex > 0 ? sortedLevels[levelIndex - 1] ?? null : null;
654
669
  return [currentLevel, nextLevel];
655
670
  }, [breakpoints, involvedSubTotal, involvedLines.length]);
656
- const { data: giftProductsResult } = useSWR(shouldFetch ? giftHandles : null, async () => {
657
- const res = await getProductsByHandles(client, {
658
- handles: giftHandles,
659
- locale
660
- });
661
- const result = Array.isArray(res) ? res : [];
662
- giftProductsCache.current = {
663
- data: result,
664
- giftHandles: [...giftHandles]
665
- };
666
- return result;
667
- });
671
+ const { data: giftProductsResult } = useSWR(
672
+ shouldFetch ? giftHandles : null,
673
+ async () => {
674
+ const res = await getProductsByHandles(client, {
675
+ handles: giftHandles,
676
+ locale
677
+ });
678
+ const result = Array.isArray(res) ? res : [];
679
+ giftProductsCache.current = {
680
+ data: result,
681
+ giftHandles: [...giftHandles]
682
+ };
683
+ return result;
684
+ },
685
+ {
686
+ revalidateOnFocus: false
687
+ }
688
+ );
668
689
  const finalGiftProductsResult = useMemo(() => {
669
690
  if (giftProductsCache.current && !shouldFetch) {
670
691
  return giftProductsCache.current.data || void 0;
@@ -850,10 +871,10 @@ var trackBuyNowGA = ({
850
871
  return;
851
872
  }
852
873
  const { variant } = lineItems[0];
853
- const currencyCode = variant.price?.currencyCode;
874
+ const currencyCode = variant.product?.price?.currencyCode || variant.price?.currencyCode;
854
875
  const totalPrice = lineItems?.reduce(
855
876
  (prev, { variant: variant2 }) => prev.plus(
856
- variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? (variant2?.price?.amount || 0)
877
+ variant2?.finalPrice?.amount ?? variant2?.compareAtPrice?.amount ?? variant2?.price?.amount ?? 0
857
878
  ),
858
879
  new Decimal2(0)
859
880
  ).toNumber();
@@ -927,7 +948,7 @@ function useApplyCartCodes(options) {
927
948
  if (!discountCodes?.length) {
928
949
  throw new Error("Invalid input used for this operation: Miss discountCode");
929
950
  }
930
- const cartId = providedCartId ? void 0 : providedCartId || cart?.id;
951
+ const cartId = providedCartId || cart?.id;
931
952
  if (!cartId) {
932
953
  return void 0;
933
954
  }
@@ -940,12 +961,18 @@ function useApplyCartCodes(options) {
940
961
  cookieAdapter: cartCookieAdapter,
941
962
  metafieldIdentifiers
942
963
  });
964
+ const unApplicableCodes = discountCodes.filter(
965
+ (code) => updatedCart?.discountCodes?.find((item) => item.code === code && !item.applicable)
966
+ );
967
+ if (unApplicableCodes.length) {
968
+ throw new Error(`${unApplicableCodes.join(", ")} is not applicable to the cart`);
969
+ }
943
970
  if (updatedCart) {
944
971
  mutateCart(updatedCart);
945
972
  }
946
973
  return updatedCart;
947
974
  },
948
- [client, locale, cartCookieAdapter, mutateCart, cart]
975
+ [client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
949
976
  );
950
977
  return useSWRMutation("apply-codes", applyCodes, options);
951
978
  }
@@ -955,7 +982,7 @@ function useRemoveCartCodes(options) {
955
982
  const removeCodes = useCallback(
956
983
  async (_key, { arg }) => {
957
984
  const { cartId: providedCartId, discountCodes } = arg;
958
- const cartId = providedCartId ? void 0 : providedCartId || cart?.id;
985
+ const cartId = providedCartId || cart?.id;
959
986
  const codes = cart?.discountCodes?.filter((code) => !!code.applicable) || [];
960
987
  const leftCodes = codes.filter((code) => discountCodes?.length ? !discountCodes.includes(code.code) : code.code).map((code) => code.code);
961
988
  const updatedCart = await updateCartCodes(client, {
@@ -969,15 +996,70 @@ function useRemoveCartCodes(options) {
969
996
  }
970
997
  return updatedCart;
971
998
  },
972
- [client, locale, cartCookieAdapter, mutateCart, cart]
999
+ [client, locale, cartCookieAdapter, mutateCart, cart, metafieldIdentifiers]
973
1000
  );
974
1001
  return useSWRMutation("remove-codes", removeCodes, options);
975
1002
  }
976
1003
 
1004
+ // src/hooks/cart/utils/add-to-cart.ts
1005
+ var getLinesWithAttributes = ({
1006
+ cart,
1007
+ lineItems
1008
+ }) => {
1009
+ return lineItems.map((line) => {
1010
+ const sameLineInCart = cart?.lineItems.find(
1011
+ (lineInCart) => lineInCart.variant.sku === line.variant?.sku && lineInCart.product?.handle === line.variant?.product?.handle
1012
+ );
1013
+ const codeAmountAttribute = sameLineInCart?.customAttributes?.find(
1014
+ (attr) => attr.key === CODE_AMOUNT_KEY
1015
+ );
1016
+ const scriptCodeAmountAttribute = sameLineInCart?.customAttributes?.find(
1017
+ (attr) => attr.key === SCRIPT_CODE_AMOUNT_KEY
1018
+ );
1019
+ let functionAttribute = null;
1020
+ try {
1021
+ functionAttribute = sameLineInCart?.customAttributes?.find(
1022
+ (attr) => attr.key === CUSTOMER_ATTRIBUTE_KEY && JSON.parse(attr.value)?.discounted_amount
1023
+ );
1024
+ } catch (error) {
1025
+ }
1026
+ if (codeAmountAttribute || functionAttribute || scriptCodeAmountAttribute) {
1027
+ return {
1028
+ ...line,
1029
+ attributes: [
1030
+ ...line.attributes || [],
1031
+ codeAmountAttribute,
1032
+ functionAttribute,
1033
+ scriptCodeAmountAttribute
1034
+ ].filter(Boolean)
1035
+ };
1036
+ }
1037
+ return line;
1038
+ });
1039
+ };
1040
+ var getLinesWithFunctionAttributes = (lineItems) => {
1041
+ return lineItems.map((line) => {
1042
+ let itemAttributes = line.attributes || [];
1043
+ const functionEnvAttribute = itemAttributes.find((attr) => attr.key === CUSTOMER_ATTRIBUTE_KEY);
1044
+ if (!functionEnvAttribute) {
1045
+ itemAttributes = itemAttributes.concat([
1046
+ {
1047
+ key: CUSTOMER_ATTRIBUTE_KEY,
1048
+ value: JSON.stringify({
1049
+ is_gift: false,
1050
+ discounted_amount: Number(line.variant?.finalPrice?.amount || line.variant?.price?.amount) * (line.quantity || 1)
1051
+ })
1052
+ }
1053
+ ]);
1054
+ }
1055
+ return { ...line, attributes: itemAttributes };
1056
+ });
1057
+ };
1058
+
977
1059
  // src/hooks/cart/use-add-to-cart.ts
978
1060
  function useAddToCart({ withTrack = true } = {}, swrOptions) {
979
1061
  const { client, config, locale, cartCookieAdapter, userAdapter } = useShopify();
980
- const { cart } = useCartContext();
1062
+ const { cart, addCustomAttributes } = useCartContext();
981
1063
  const { trigger: applyCartCodes } = useApplyCartCodes();
982
1064
  const { trigger: removeInvalidCodes } = useRemoveCartCodes();
983
1065
  const { trigger: addCartLines2 } = useAddCartLines();
@@ -991,12 +1073,18 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
991
1073
  buyerIdentity,
992
1074
  needCreateCart = false,
993
1075
  onCodesInvalid,
994
- replaceExistingCodes
1076
+ replaceExistingCodes,
1077
+ customAttributes
995
1078
  } = arg;
996
1079
  if (!lineItems || lineItems.length === 0) {
997
1080
  return;
998
1081
  }
999
- const lines = lineItems.map((item) => ({
1082
+ const linesWithAttributes = getLinesWithAttributes({
1083
+ cart,
1084
+ lineItems
1085
+ });
1086
+ const linesWithFunctionAttributes = getLinesWithFunctionAttributes(linesWithAttributes);
1087
+ const lines = linesWithFunctionAttributes.map((item) => ({
1000
1088
  merchandiseId: item.variant?.id || "",
1001
1089
  quantity: item.quantity || 1,
1002
1090
  attributes: item.attributes,
@@ -1036,6 +1124,9 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
1036
1124
  discountCodes
1037
1125
  });
1038
1126
  }
1127
+ if (customAttributes && customAttributes.length > 0) {
1128
+ addCustomAttributes(customAttributes);
1129
+ }
1039
1130
  if (withTrack) {
1040
1131
  trackAddToCartGA({
1041
1132
  lineItems,
@@ -1062,9 +1153,10 @@ function useUpdateCartLines(options) {
1062
1153
  if (updatedCart) {
1063
1154
  mutateCart(updatedCart);
1064
1155
  }
1156
+ console.log("use-update-cart-lines updatedCart", metafieldIdentifiers, updatedCart);
1065
1157
  return updatedCart;
1066
1158
  },
1067
- [client, locale, cartCookieAdapter, mutateCart]
1159
+ [client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
1068
1160
  );
1069
1161
  return useSWRMutation("update-cart-lines", updateLines, options);
1070
1162
  }
@@ -1103,7 +1195,7 @@ function useRemoveCartLines(options) {
1103
1195
  }
1104
1196
  return updatedCart;
1105
1197
  },
1106
- [client, locale, cartCookieAdapter, mutateCart]
1198
+ [client, locale, cartCookieAdapter, mutateCart, metafieldIdentifiers]
1107
1199
  );
1108
1200
  return useSWRMutation("remove-cart-lines", removeLines, options);
1109
1201
  }
@@ -1122,7 +1214,7 @@ function useUpdateCartAttributes(mutate, metafieldIdentifiers, options) {
1122
1214
  }
1123
1215
  return updatedCart;
1124
1216
  },
1125
- [client, locale, cartCookieAdapter, mutate]
1217
+ [client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
1126
1218
  );
1127
1219
  return useSWRMutation("update-cart-attributes", updateAttributes, options);
1128
1220
  }
@@ -1144,7 +1236,8 @@ function useBuyNow({ withTrack = true } = {}, swrOptions) {
1144
1236
  if (!lineItems || lineItems.length === 0) {
1145
1237
  return;
1146
1238
  }
1147
- const lines = lineItems.map((item) => ({
1239
+ const linesWithFunctionAttributes = getLinesWithFunctionAttributes(lineItems);
1240
+ const lines = linesWithFunctionAttributes.map((item) => ({
1148
1241
  merchandiseId: item.variant?.id || "",
1149
1242
  quantity: item.quantity || 1,
1150
1243
  attributes: item.attributes,
@@ -1262,7 +1355,7 @@ var useCalcOrderDiscount = (cart, orderDiscountConfig, customer) => {
1262
1355
  const isCustomerLoading = useMemo(() => !customer ? true : false, [customer]);
1263
1356
  const dealsType = "";
1264
1357
  const { activeCampaign, subtotal } = useMemo(() => {
1265
- for (const campaign of orderDiscountConfig) {
1358
+ for (const campaign of orderDiscountConfig || []) {
1266
1359
  const { rule_conditions = [], result_detail } = campaign;
1267
1360
  const { main_product, order_discount_conf } = result_detail || {};
1268
1361
  const isPreCheckPassed = preCheck(rule_conditions, tags, []);
@@ -1292,9 +1385,12 @@ var useCalcOrderDiscount = (cart, orderDiscountConfig, customer) => {
1292
1385
  discountAmount: 0
1293
1386
  };
1294
1387
  }
1295
- const tieredDiscounts = activeCampaign.result_detail.order_discount_conf.tiered_discounts;
1296
- const qualifyingTier = [...tieredDiscounts].reverse().find((tier) => subtotal >= Number(tier.amount));
1297
- const nextGoal = tieredDiscounts.find((tier) => subtotal < Number(tier.amount));
1388
+ const currentCurrency = cart?.currency?.code || "";
1389
+ console.log("currentCurrency", cart, currentCurrency);
1390
+ const orderDiscountConf = activeCampaign.result_detail.order_discount_conf;
1391
+ const tieredDiscounts = orderDiscountConf.tiered_discounts_markets?.[currentCurrency] || orderDiscountConf.tiered_discounts;
1392
+ const qualifyingTier = [...tieredDiscounts].sort((a, b) => Number(b.amount) - Number(a.amount)).find((tier) => subtotal >= Number(tier.amount));
1393
+ const nextGoal = [...tieredDiscounts].sort((a, b) => Number(a.amount) - Number(b.amount)).find((tier) => subtotal < Number(tier.amount));
1298
1394
  if (!qualifyingTier) {
1299
1395
  return {
1300
1396
  qualifyingDiscount: null,
@@ -1362,12 +1458,10 @@ function useHasPlusMemberInCart({
1362
1458
  };
1363
1459
  }, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
1364
1460
  }
1365
-
1366
- // src/hooks/cart/feature/use-cart-attributes.ts
1367
1461
  var getReferralAttributes = () => {
1368
- const inviteCode = Cookies5.get("invite_code");
1369
- const playModeId = Cookies5.get("playModeId");
1370
- const popup = Cookies5.get("_popup");
1462
+ const inviteCode = getLocalStorage("inviteCode") || Cookies5.get("inviteCode");
1463
+ const playModeId = getLocalStorage("playModeId") || Cookies5.get("playModeId");
1464
+ const popup = getLocalStorage("_popup") || Cookies5.get("_popup");
1371
1465
  if (inviteCode && playModeId) {
1372
1466
  return popup ? [
1373
1467
  { key: "_invite_code", value: inviteCode ? inviteCode : "" },
@@ -1391,8 +1485,6 @@ var useCartAttributes = ({
1391
1485
  memberSetting,
1392
1486
  cart
1393
1487
  });
1394
- console.log("memberSetting", memberSetting);
1395
- console.log("hasPlusMember", hasPlusMember);
1396
1488
  useEffect(() => {
1397
1489
  setCurrentUrl(window.location.href);
1398
1490
  }, []);
@@ -1418,7 +1510,7 @@ var useCartAttributes = ({
1418
1510
  return "new_user_login";
1419
1511
  }, [customer]);
1420
1512
  const memberAttributes = useMemo(() => {
1421
- return [
1513
+ const attributes = [
1422
1514
  {
1423
1515
  key: "_token",
1424
1516
  value: profile?.token
@@ -1439,17 +1531,28 @@ var useCartAttributes = ({
1439
1531
  value: profile?.token ? "true" : "false"
1440
1532
  }
1441
1533
  ];
1534
+ if (profile?.token) {
1535
+ attributes.push({
1536
+ key: "_login_user",
1537
+ value: "1"
1538
+ });
1539
+ }
1540
+ return attributes;
1442
1541
  }, [profile?.memberType, profile?.token, userType, hasPlusMember]);
1443
1542
  const functionAttributes = useMemo(() => {
1444
- return [
1445
- cart?.discountCodes && {
1543
+ const hasFunctionEnvAttribute = cart?.lineItems.some(
1544
+ (item) => item.customAttributes?.some((attr) => attr.key === CUSTOMER_ATTRIBUTE_KEY)
1545
+ );
1546
+ const discountCodes = cart?.discountCodes.map((item) => item.code).filter((code) => code) || [];
1547
+ return hasFunctionEnvAttribute ? [
1548
+ {
1446
1549
  key: "_discounts_function_env",
1447
1550
  value: JSON.stringify({
1448
- discount_code: cart?.discountCodes.map((item) => item.code),
1551
+ discount_code: discountCodes,
1449
1552
  user_tags: customer?.tags || []
1450
1553
  })
1451
1554
  }
1452
- ];
1555
+ ] : [];
1453
1556
  }, [cart]);
1454
1557
  const presellAttributes = useMemo(() => {
1455
1558
  return [
@@ -1481,18 +1584,50 @@ var useCartAttributes = ({
1481
1584
  }
1482
1585
  ];
1483
1586
  }, [currentUrl]);
1587
+ const commonAttributes = useMemo(
1588
+ () => [
1589
+ ...memberAttributes,
1590
+ ...functionAttributes,
1591
+ ...presellAttributes,
1592
+ ...weightAttributes,
1593
+ ...trackingAttributes,
1594
+ ...getReferralAttributes()
1595
+ ].filter((item) => item?.value),
1596
+ [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
1597
+ );
1598
+ const extraAttributesInCart = useMemo(() => {
1599
+ const commonAttributeKeys = [
1600
+ // member attributes
1601
+ "_token",
1602
+ "_member_type",
1603
+ "_user_type",
1604
+ "_is_login",
1605
+ "_login_user",
1606
+ // function attributes
1607
+ "_discounts_function_env",
1608
+ // presell attributes
1609
+ "_presale",
1610
+ // weight attributes
1611
+ "_weight",
1612
+ "_app_source_name",
1613
+ // tracking attributes
1614
+ "utm_params",
1615
+ // referral attributes
1616
+ "_invite_code",
1617
+ "_play_mode_id",
1618
+ "_popup"
1619
+ ];
1620
+ return cart?.customAttributes?.filter(
1621
+ (item) => !commonAttributeKeys.includes(item.key)
1622
+ ) || [];
1623
+ }, [cart]);
1484
1624
  return useMemo(
1485
1625
  () => ({
1486
- attributes: [
1487
- ...memberAttributes,
1488
- ...functionAttributes,
1489
- ...presellAttributes,
1490
- ...weightAttributes,
1491
- ...trackingAttributes,
1492
- ...getReferralAttributes()
1493
- ].filter((item) => item?.value)
1626
+ attributes: [...commonAttributes, ...extraAttributesInCart].filter(
1627
+ (item) => item?.value
1628
+ )
1494
1629
  }),
1495
- [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
1630
+ [commonAttributes, extraAttributesInCart]
1496
1631
  );
1497
1632
  };
1498
1633
  var DEFAULT_MIN = 1;
@@ -1555,7 +1690,7 @@ var useUpdateLineCodeAmountAttributes = ({
1555
1690
  );
1556
1691
  const functionEnvValue = getDiscountEnvAttributeValue(line.customAttributes);
1557
1692
  const hasSameFunctionEnvAttribute = Number(functionEnvValue.discounted_amount) === Number(line.totalAmount);
1558
- if (!hasSameFunctionEnvAttribute && hasFunctionEnvAttribute) {
1693
+ if (!hasSameFunctionEnvAttribute && hasFunctionEnvAttribute && !functionEnvValue.is_gift) {
1559
1694
  attrNeedUpdate.push({
1560
1695
  key: CUSTOMER_ATTRIBUTE_KEY,
1561
1696
  value: JSON.stringify({
@@ -1594,29 +1729,22 @@ var useUpdateLineCodeAmountAttributes = ({
1594
1729
  }).filter(
1595
1730
  ({ attrNeedUpdate, attrNeedDelete }) => attrNeedUpdate.length || attrNeedDelete.length
1596
1731
  ).map(({ line, attrNeedUpdate, attrNeedDelete }) => {
1732
+ let lineId = line.id;
1733
+ let attributes = line.customAttributes || [];
1734
+ if (attrNeedDelete.length) {
1735
+ attributes = attributes.filter(
1736
+ (attr) => !attrNeedDelete.includes(attr.key)
1737
+ );
1738
+ }
1597
1739
  if (attrNeedUpdate.length) {
1598
- return {
1599
- id: line.id,
1600
- attributes: [
1601
- ...line.customAttributes?.filter(
1602
- (attr) => !attrNeedUpdate.some((updateAttr) => updateAttr.key === attr.key)
1603
- ) || [],
1604
- ...attrNeedUpdate
1605
- ]
1606
- };
1607
- } else if (attrNeedDelete.length) {
1608
- return {
1609
- id: line.id,
1610
- attributes: line.customAttributes?.filter(
1611
- (attr) => !attrNeedDelete.includes(attr.key)
1612
- ) || []
1613
- };
1614
- } else {
1615
- return {
1616
- id: line.id,
1617
- attributes: line.customAttributes || []
1618
- };
1740
+ attributes = attributes.filter(
1741
+ (attr) => !attrNeedUpdate.some((updateAttr) => updateAttr.key === attr.key)
1742
+ ).concat(attrNeedUpdate);
1619
1743
  }
1744
+ return {
1745
+ id: lineId,
1746
+ attributes
1747
+ };
1620
1748
  }),
1621
1749
  [cart?.lineItems, mainProductDiscountCodes]
1622
1750
  );
@@ -1709,8 +1837,9 @@ function useProductsByHandles(options = {}) {
1709
1837
  metafieldIdentifiers
1710
1838
  });
1711
1839
  },
1712
- swrOptions || {
1713
- revalidateOnFocus: false
1840
+ {
1841
+ revalidateOnFocus: false,
1842
+ ...swrOptions
1714
1843
  }
1715
1844
  );
1716
1845
  }
@@ -2626,6 +2755,73 @@ var usePlusMemberDeliveryCodes = ({
2626
2755
  [deliveryData]
2627
2756
  );
2628
2757
  };
2758
+ function useUpdateCartDeliveryOptions(mutate, metafieldIdentifiers, options) {
2759
+ const { client, locale, cartCookieAdapter } = useShopify();
2760
+ const updateDeliveryOptions = useCallback(
2761
+ async (_key, { arg }) => {
2762
+ const updatedCart = await updateCartDeliveryOptions(client, {
2763
+ ...arg,
2764
+ metafieldIdentifiers,
2765
+ cookieAdapter: cartCookieAdapter
2766
+ });
2767
+ console.log("useUpdateCartDeliveryOptions updatedCart", updatedCart);
2768
+ if (updatedCart) {
2769
+ mutate(updatedCart);
2770
+ }
2771
+ return updatedCart;
2772
+ },
2773
+ [client, locale, cartCookieAdapter, mutate, metafieldIdentifiers]
2774
+ );
2775
+ return useSWRMutation("update-cart-delivery-options", updateDeliveryOptions, options);
2776
+ }
2777
+
2778
+ // src/hooks/member/plus/use-update-plus-member-delivery-options.ts
2779
+ var useUpdatePlusMemberDeliveryOptions = ({
2780
+ options
2781
+ } = {}) => {
2782
+ const { cart: cartContextData, mutateCart, metafieldIdentifiers } = useCartContext();
2783
+ const { trigger: updateCartDeliveryOptions2 } = useUpdateCartDeliveryOptions(
2784
+ mutateCart,
2785
+ metafieldIdentifiers
2786
+ );
2787
+ const handler = useCallback(
2788
+ async (_, { arg }) => {
2789
+ const currentCart = arg?.cart || cartContextData;
2790
+ const { deliveryData } = arg;
2791
+ const firstDeliveryGroup = currentCart?.deliveryGroups?.[0];
2792
+ const deliveryGroupId = firstDeliveryGroup?.id;
2793
+ const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option?.code;
2794
+ if (!deliveryGroupId || !selectedOptionCode || selectedOptionCode === firstDeliveryGroup?.selectedDeliveryOption?.code) {
2795
+ return null;
2796
+ }
2797
+ const deliveryGroup = currentCart?.deliveryGroups?.find(
2798
+ (group) => group?.id === deliveryGroupId
2799
+ );
2800
+ const matchedOption = deliveryGroup?.deliveryOptions?.find(
2801
+ (option) => option?.code === selectedOptionCode
2802
+ );
2803
+ if (!matchedOption?.handle) {
2804
+ return null;
2805
+ }
2806
+ const deliveryOptions = [
2807
+ {
2808
+ deliveryGroupId,
2809
+ deliveryOptionHandle: matchedOption.handle
2810
+ }
2811
+ ];
2812
+ const updatedCart = await updateCartDeliveryOptions2({
2813
+ selectedDeliveryOptions: deliveryOptions,
2814
+ cartId: currentCart?.id
2815
+ });
2816
+ if (updatedCart && mutateCart) {
2817
+ mutateCart(updatedCart);
2818
+ }
2819
+ return updatedCart;
2820
+ },
2821
+ [cartContextData, updateCartDeliveryOptions2, mutateCart]
2822
+ );
2823
+ return useSWRMutation("update-cart-delivery-options", handler, options);
2824
+ };
2629
2825
  var usePlusMemberItemCustomAttributes = ({
2630
2826
  deliveryData
2631
2827
  }) => {
@@ -2645,48 +2841,18 @@ var usePlusMemberCheckoutCustomAttributes = ({
2645
2841
  deliveryData,
2646
2842
  product,
2647
2843
  variant,
2648
- customer,
2649
2844
  isShowShippingBenefits
2650
2845
  }) => {
2651
2846
  const { deliveryCustomData } = deliveryData || {};
2652
2847
  const { profile } = usePlusMemberContext();
2653
- const userType = useMemo(() => {
2654
- const customerInfo = customer;
2655
- if (!customerInfo) {
2656
- return "new_user_unlogin";
2657
- }
2658
- if (customer) {
2659
- const { orders = {} } = customer;
2660
- const edgesLength = orders?.edges?.length;
2661
- if (edgesLength === 1) {
2662
- return "old_user_orders_once";
2663
- } else if (edgesLength && edgesLength > 1) {
2664
- return "old_user_orders_twice";
2665
- }
2666
- }
2667
- return "new_user_login";
2668
- }, [customer]);
2669
2848
  return useMemo(() => {
2670
2849
  const checkoutCustomAttributes = [
2671
- {
2672
- key: "_token",
2673
- value: profile?.token || ""
2674
- },
2850
+ // _last_url: 付费会员结算完成之后 checkout 有一个继续购买的按钮, 用于跳转到继续购买的页面
2675
2851
  {
2676
2852
  key: "_last_url",
2677
2853
  value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
2678
- },
2679
- {
2680
- key: "_user_type",
2681
- value: userType
2682
2854
  }
2683
2855
  ];
2684
- if (profile) {
2685
- checkoutCustomAttributes.push({
2686
- key: "_login_user",
2687
- value: "1"
2688
- });
2689
- }
2690
2856
  if (deliveryCustomData) {
2691
2857
  checkoutCustomAttributes.push({
2692
2858
  key: "_checkout_delivery_custom",
@@ -2696,12 +2862,6 @@ var usePlusMemberCheckoutCustomAttributes = ({
2696
2862
  })
2697
2863
  });
2698
2864
  }
2699
- if (variant?.metafields?.presell) {
2700
- checkoutCustomAttributes.push({
2701
- key: "_presale",
2702
- value: "true"
2703
- });
2704
- }
2705
2865
  if (isShowShippingBenefits && !isShowShippingBenefits({ variant, product, setting: {} })) {
2706
2866
  checkoutCustomAttributes.push({
2707
2867
  key: "_hide_shipping",
@@ -2709,18 +2869,17 @@ var usePlusMemberCheckoutCustomAttributes = ({
2709
2869
  });
2710
2870
  }
2711
2871
  return checkoutCustomAttributes;
2712
- }, [deliveryCustomData, product, profile, userType, variant, isShowShippingBenefits]);
2872
+ }, [deliveryCustomData, product, profile, variant, isShowShippingBenefits]);
2713
2873
  };
2714
2874
  function useAutoRemovePlusMemberInCart({
2715
- metafields,
2716
- isMonthlyPlus,
2717
- isAnnualPlus
2875
+ cart,
2876
+ profile,
2877
+ memberSetting
2718
2878
  }) {
2719
- const { plus_monthly_product, plus_annual_product } = metafields || {};
2720
- const { cart } = useCartContext();
2879
+ const { plus_monthly_product, plus_annual_product } = memberSetting || {};
2721
2880
  const { trigger: removeCartLines2 } = useRemoveCartLines();
2722
2881
  useEffect(() => {
2723
- if (!cart) return;
2882
+ if (!cart || !plus_monthly_product || !plus_annual_product) return;
2724
2883
  const removePlusProduct = async (productType) => {
2725
2884
  if (!productType) return;
2726
2885
  const product = cart.lineItems?.find(
@@ -2732,33 +2891,25 @@ function useAutoRemovePlusMemberInCart({
2732
2891
  });
2733
2892
  }
2734
2893
  };
2735
- if (isMonthlyPlus) {
2894
+ if (profile?.isMonthlyPlus) {
2736
2895
  removePlusProduct(plus_monthly_product);
2737
2896
  }
2738
- if (isAnnualPlus) {
2897
+ if (profile?.isAnnualPlus) {
2739
2898
  removePlusProduct(plus_annual_product);
2740
2899
  }
2741
- }, [
2742
- cart,
2743
- plus_annual_product,
2744
- plus_monthly_product,
2745
- isAnnualPlus,
2746
- isMonthlyPlus,
2747
- removeCartLines2
2748
- ]);
2900
+ }, [cart, plus_annual_product, plus_monthly_product, profile, removeCartLines2]);
2749
2901
  }
2750
2902
  function useAddPlusMemberProductsToCart({
2751
2903
  cart,
2752
- memberSetting,
2753
- selectedPlusMemberMode,
2754
- selectedPlusMemberProduct
2904
+ profile
2755
2905
  }) {
2906
+ const { selectedPlusMemberMode, selectedPlusMemberProduct, plusMemberMetafields } = usePlusMemberContext();
2756
2907
  const { hasMonthlyPlus, hasAnnualPlus } = useHasPlusMemberInCart({
2757
- cart,
2758
- memberSetting
2908
+ memberSetting: plusMemberMetafields,
2909
+ cart
2759
2910
  });
2760
2911
  const plusMemberProduct = useMemo(() => {
2761
- if (selectedPlusMemberMode === "free" /* FREE */) {
2912
+ if (!selectedPlusMemberProduct || selectedPlusMemberMode === "free" /* FREE */) {
2762
2913
  return void 0;
2763
2914
  }
2764
2915
  if (selectedPlusMemberMode === "monthly" /* MONTHLY */ && hasMonthlyPlus) {
@@ -2767,7 +2918,10 @@ function useAddPlusMemberProductsToCart({
2767
2918
  if (selectedPlusMemberMode === "annual" /* ANNUAL */ && hasAnnualPlus) {
2768
2919
  return void 0;
2769
2920
  }
2770
- if (!selectedPlusMemberProduct) {
2921
+ if (profile?.isMonthlyPlus && selectedPlusMemberMode === "monthly" /* MONTHLY */) {
2922
+ return void 0;
2923
+ }
2924
+ if (profile?.isAnnualPlus && selectedPlusMemberMode === "annual" /* ANNUAL */) {
2771
2925
  return void 0;
2772
2926
  }
2773
2927
  return selectedPlusMemberProduct;
@@ -3086,8 +3240,13 @@ function CartProvider({
3086
3240
  const { attributes } = useCartAttributes({ profile, customer, cart, memberSetting });
3087
3241
  useRequest(
3088
3242
  () => {
3089
- const newAttributes = [...attributes, ...customAttributes];
3090
- const needUpdate = cart && !checkAttributesUpdateNeeded(
3243
+ const newAttributes = [...attributes];
3244
+ customAttributes.forEach((item) => {
3245
+ if (item.value && !newAttributes.some((attr) => attr.key === item.key)) {
3246
+ newAttributes.push(item);
3247
+ }
3248
+ });
3249
+ const needUpdate = cart && checkAttributesUpdateNeeded(
3091
3250
  cart.customAttributes,
3092
3251
  newAttributes,
3093
3252
  customAttributesNeedDelete
@@ -3191,8 +3350,14 @@ function CartProvider({
3191
3350
  );
3192
3351
  return result;
3193
3352
  }, [cart?.lineItems, scriptAutoFreeGift, functionAutoFreeGift]);
3353
+ const totalQuantity = useMemo(() => {
3354
+ const cartLinesCount = cart?.lineItems.reduce((acc, item) => acc + item.quantity, 0) || 0;
3355
+ const giftLinesCount = giftNeedAddToCartLines?.reduce((acc, item) => acc + (item.quantity || 1), 0) || 0;
3356
+ return cartLinesCount + giftLinesCount;
3357
+ }, [cart?.lineItems, giftNeedAddToCartLines]);
3194
3358
  const value = useMemo(
3195
3359
  () => ({
3360
+ totalQuantity,
3196
3361
  cart,
3197
3362
  isCartLoading,
3198
3363
  triggerFetch: fetchCart,
@@ -3220,6 +3385,7 @@ function CartProvider({
3220
3385
  }),
3221
3386
  [
3222
3387
  cart,
3388
+ totalQuantity,
3223
3389
  isCartLoading,
3224
3390
  fetchCart,
3225
3391
  mutateCart,
@@ -3244,14 +3410,14 @@ function CartProvider({
3244
3410
  );
3245
3411
  return /* @__PURE__ */ jsx(CartContext.Provider, { value, children });
3246
3412
  }
3247
- function useCartContext() {
3413
+ function useCartContext(options) {
3248
3414
  const context = useContext(CartContext);
3249
- if (!context) {
3415
+ if (!context && !options?.optional) {
3250
3416
  throw new Error("useCartContext must be used within a CartProvider");
3251
3417
  }
3252
3418
  return context;
3253
3419
  }
3254
3420
 
3255
- export { BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, CartProvider, DeliveryPlusType, MAIN_PRODUCT_CODE, OrderBasePriceType, OrderDiscountType, PLUS_MEMBER_TYPE, PlusMemberContext, PlusMemberMode, PlusMemberProvider, PriceBasePriceType, PriceDiscountType, RuleType, SCRIPT_CODE_AMOUNT_KEY, ShippingMethodMode, ShopifyContext, ShopifyProvider, SpendMoneyType, atobID, browserCartCookieAdapter, browserCookieAdapter, btoaID, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, gaTrack, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, trackAddToCartFBQ, trackAddToCartGA, trackBeginCheckoutGA, trackBuyNowFBQ, trackBuyNowGA, useAddCartLines, useAddPlusMemberProductsToCart, useAddToCart, useAllBlogs, useAllCollections, useAllProducts, useApplyCartCodes, useArticle, useArticles, useArticlesInBlog, useAutoRemovePlusMemberInCart, useBlog, useBuyNow, useCalcAutoFreeGift, useCalcGiftsFromLines, useCalcOrderDiscount, useCartAttributes, useCartContext, useCartItemQuantityLimit, useCollection, useCollections, useCreateCart, useExposure, useGeoLocation, useHasPlusMemberInCart, useIntersection, usePlusAnnualProductVariant, usePlusMemberCheckoutCustomAttributes, usePlusMemberContext, usePlusMemberDeliveryCodes, usePlusMemberItemCustomAttributes, usePlusMonthlyProductVariant, usePrice, useProduct, useProductUrl, useProductsByHandles, useRemoveCartCodes, useRemoveCartLines, useReplaceCartPlusMember, useScriptAutoFreeGift, useSearch, useSelectedOptions, useShippingMethodAvailableCheck, useShippingMethods, useShopify, useSite, useUpdateCartAttributes, useUpdateCartLines, useUpdateLineCodeAmountAttributes, useUpdateVariantQuery, useVariant, useVariantMedia };
3421
+ export { BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, CartProvider, DeliveryPlusType, MAIN_PRODUCT_CODE, OrderBasePriceType, OrderDiscountType, PLUS_MEMBER_TYPE, PlusMemberContext, PlusMemberMode, PlusMemberProvider, PriceBasePriceType, PriceDiscountType, RuleType, SCRIPT_CODE_AMOUNT_KEY, ShippingMethodMode, ShopifyContext, ShopifyProvider, SpendMoneyType, browserCartCookieAdapter, browserCookieAdapter, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, gaTrack, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, trackAddToCartFBQ, trackAddToCartGA, trackBeginCheckoutGA, trackBuyNowFBQ, trackBuyNowGA, useAddCartLines, useAddPlusMemberProductsToCart, useAddToCart, useAllBlogs, useAllCollections, useAllProducts, useApplyCartCodes, useArticle, useArticles, useArticlesInBlog, useAutoRemovePlusMemberInCart, useBlog, useBuyNow, useCalcAutoFreeGift, useCalcGiftsFromLines, useCalcOrderDiscount, useCartAttributes, useCartContext, useCartItemQuantityLimit, useCollection, useCollections, useCreateCart, useExposure, useGeoLocation, useHasPlusMemberInCart, useIntersection, usePlusAnnualProductVariant, usePlusMemberCheckoutCustomAttributes, usePlusMemberContext, usePlusMemberDeliveryCodes, usePlusMemberItemCustomAttributes, usePlusMonthlyProductVariant, usePrice, useProduct, useProductUrl, useProductsByHandles, useRemoveCartCodes, useRemoveCartLines, useReplaceCartPlusMember, useScriptAutoFreeGift, useSearch, useSelectedOptions, useShippingMethodAvailableCheck, useShippingMethods, useShopify, useSite, useUpdateCartAttributes, useUpdateCartLines, useUpdateLineCodeAmountAttributes, useUpdatePlusMemberDeliveryOptions, useUpdateVariantQuery, useVariant, useVariantMedia };
3256
3422
  //# sourceMappingURL=index.mjs.map
3257
3423
  //# sourceMappingURL=index.mjs.map