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

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.
@@ -4,7 +4,7 @@ import { ShopifyClient, ShopifyConfig, CartCookieAdapter as CartCookieAdapter$1,
4
4
  import { C as CookieAdapter, b as CartCookieAdapter, R as RouterAdapter, U as UserContextAdapter } from '../types-BLMoxbOk.mjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { SWRConfiguration } from 'swr';
7
- import { e as PlusMemberSettingsMetafields } from '../types-DpxtE_nv.mjs';
7
+ import { e as PlusMemberSettingsMetafields } from '../types-DX-2ABDs.mjs';
8
8
  import 'swr/mutation';
9
9
 
10
10
  interface ShopifyContextValue {
@@ -4,7 +4,7 @@ import { ShopifyClient, ShopifyConfig, CartCookieAdapter as CartCookieAdapter$1,
4
4
  import { C as CookieAdapter, b as CartCookieAdapter, R as RouterAdapter, U as UserContextAdapter } from '../types-BLMoxbOk.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { SWRConfiguration } from 'swr';
7
- import { e as PlusMemberSettingsMetafields } from '../types-DpxtE_nv.js';
7
+ import { e as PlusMemberSettingsMetafields } from '../types-DX-2ABDs.js';
8
8
  import 'swr/mutation';
9
9
 
10
10
  interface ShopifyContextValue {
@@ -786,10 +786,6 @@ var useCartAttributes = ({
786
786
  {
787
787
  key: "_is_login",
788
788
  value: profile?.token ? "true" : "false"
789
- },
790
- {
791
- key: "_last_url",
792
- value: typeof window !== "undefined" ? window.location.origin + window.location.pathname : ""
793
789
  }
794
790
  ];
795
791
  if (profile?.token) {
@@ -845,18 +841,29 @@ var useCartAttributes = ({
845
841
  }
846
842
  ];
847
843
  }, [currentUrl]);
844
+ const commonAttributes = react.useMemo(
845
+ () => [
846
+ ...memberAttributes,
847
+ ...functionAttributes,
848
+ ...presellAttributes,
849
+ ...weightAttributes,
850
+ ...trackingAttributes,
851
+ ...getReferralAttributes()
852
+ ].filter((item) => item?.value),
853
+ [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
854
+ );
855
+ const extraAttributesInCart = react.useMemo(() => {
856
+ return cart?.customAttributes?.filter(
857
+ (item) => !commonAttributes.some((attr) => attr.key === item.key)
858
+ ) || [];
859
+ }, [cart]);
848
860
  return react.useMemo(
849
861
  () => ({
850
- attributes: [
851
- ...memberAttributes,
852
- ...functionAttributes,
853
- ...presellAttributes,
854
- ...weightAttributes,
855
- ...trackingAttributes,
856
- ...getReferralAttributes()
857
- ].filter((item) => item?.value)
862
+ attributes: [...commonAttributes, ...extraAttributesInCart].filter(
863
+ (item) => item?.value
864
+ )
858
865
  }),
859
- [memberAttributes, functionAttributes, presellAttributes, weightAttributes, trackingAttributes]
866
+ [commonAttributes, extraAttributesInCart]
860
867
  );
861
868
  };
862
869
  var useUpdateLineCodeAmountAttributes = ({