@anker-in/shopify-react 0.1.1-beta.12 → 0.1.1-beta.14

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.
@@ -880,7 +880,7 @@ function useRemoveCartCodes(options) {
880
880
  // src/hooks/cart/use-add-to-cart.ts
881
881
  function useAddToCart({ withTrack = true } = {}, swrOptions) {
882
882
  const { client, config, locale, cartCookieAdapter, userAdapter } = useShopify();
883
- const { cart } = useCartContext();
883
+ const { cart, addCustomAttributes } = useCartContext();
884
884
  const { trigger: applyCartCodes } = useApplyCartCodes();
885
885
  const { trigger: removeInvalidCodes } = useRemoveCartCodes();
886
886
  const { trigger: addCartLines2 } = useAddCartLines();
@@ -894,7 +894,8 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
894
894
  buyerIdentity,
895
895
  needCreateCart = false,
896
896
  onCodesInvalid,
897
- replaceExistingCodes
897
+ replaceExistingCodes,
898
+ customAttributes
898
899
  } = arg;
899
900
  if (!lineItems || lineItems.length === 0) {
900
901
  return;
@@ -939,6 +940,9 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
939
940
  discountCodes
940
941
  });
941
942
  }
943
+ if (customAttributes && customAttributes.length > 0) {
944
+ addCustomAttributes(customAttributes);
945
+ }
942
946
  if (withTrack) {
943
947
  trackAddToCartGA({
944
948
  lineItems,
@@ -2565,9 +2569,9 @@ function useUpdateCartDeliveryOptions(mutate, metafieldIdentifiers, options) {
2565
2569
  // src/hooks/member/plus/use-update-plus-member-delivery-options.ts
2566
2570
  var useUpdatePlusMemberDeliveryOptions = ({
2567
2571
  options
2568
- }) => {
2572
+ } = {}) => {
2569
2573
  const { cart: cartContextData, mutateCart, metafieldIdentifiers } = useCartContext();
2570
- const { trigger: updateCartDeliveryOptions2, isMutating } = useUpdateCartDeliveryOptions(
2574
+ const { trigger: updateCartDeliveryOptions2 } = useUpdateCartDeliveryOptions(
2571
2575
  mutateCart,
2572
2576
  metafieldIdentifiers
2573
2577
  );
@@ -2577,11 +2581,13 @@ var useUpdatePlusMemberDeliveryOptions = ({
2577
2581
  const { deliveryData } = arg;
2578
2582
  const firstDeliveryGroup = currentCart?.deliveryGroups?.[0];
2579
2583
  const deliveryGroupId = firstDeliveryGroup?.id;
2580
- const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option?.code;
2584
+ const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option;
2581
2585
  if (!deliveryGroupId || !selectedOptionCode || selectedOptionCode === firstDeliveryGroup?.selectedDeliveryOption?.code) {
2582
2586
  return null;
2583
2587
  }
2584
- const deliveryGroup = currentCart?.deliveryGroups?.find((group) => group?.id === deliveryGroupId);
2588
+ const deliveryGroup = currentCart?.deliveryGroups?.find(
2589
+ (group) => group?.id === deliveryGroupId
2590
+ );
2585
2591
  const matchedOption = deliveryGroup?.deliveryOptions?.find(
2586
2592
  (option) => option?.code === selectedOptionCode
2587
2593
  );
@@ -2700,7 +2706,7 @@ function useAddPlusMemberProductsToCart({
2700
2706
  if (profile?.isMonthlyPlus && selectedPlusMemberMode === "monthly" /* MONTHLY */) {
2701
2707
  return void 0;
2702
2708
  }
2703
- if (!profile?.isAnnualPlus && selectedPlusMemberMode === "annual" /* ANNUAL */) {
2709
+ if (profile?.isAnnualPlus && selectedPlusMemberMode === "annual" /* ANNUAL */) {
2704
2710
  return void 0;
2705
2711
  }
2706
2712
  return selectedPlusMemberProduct;