@anker-in/shopify-react 0.1.1-beta.0 → 0.1.1-beta.2

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.
@@ -1,7 +1,8 @@
1
1
  import * as swr_mutation from 'swr/mutation';
2
2
  import { SWRMutationConfiguration } from 'swr/mutation';
3
- import { CartLineInput as CartLineInput$1, NormalizedCart, NormalizedProductVariant, MoneyV2, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedLineItem, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
4
- import { G as GtmParams, B as BuyNowTrackConfig, c as PlusMemberShippingMethodConfig, d as PlusMemberSettingsMetafields, D as DeliveryPlusType, e as SelectedPlusMemberProduct, h as DeliveryData } from './types-CMA6_FML.js';
3
+ import * as _anker_in_shopify_sdk from '@anker-in/shopify-sdk';
4
+ import { CartLineInput as CartLineInput$1, NormalizedCart, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, Attribute as Attribute$1, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
5
+ import { A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberProduct, i as DeliveryData } from './types-CICUnw0v.js';
5
6
  import Decimal from 'decimal.js';
6
7
  import * as swr from 'swr';
7
8
  import swr__default, { SWRConfiguration } from 'swr';
@@ -90,79 +91,6 @@ interface AddCartLinesInput {
90
91
  */
91
92
  declare function useAddCartLines(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'add-cart-lines', AddCartLinesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "add-cart-lines", AddCartLinesInput>;
92
93
 
93
- interface AddToCartInput {
94
- /** Lines to add */
95
- lineItems: Array<{
96
- variant?: NormalizedProductVariant;
97
- finalPrice?: MoneyV2;
98
- sellingPlanId?: string;
99
- quantity?: number;
100
- attributes?: Array<{
101
- key: string;
102
- value: string;
103
- }>;
104
- }>;
105
- /** Cart ID (optional) */
106
- cartId?: string;
107
- /** Discount codes to apply */
108
- discountCodes?: string[];
109
- /** Custom attributes for the cart */
110
- customAttributes?: Array<{
111
- key: string;
112
- value: string;
113
- }>;
114
- /** 全量更新 codes,默认是追加 */
115
- replaceExistingCodes?: boolean;
116
- /** Buyer identity for cart creation */
117
- buyerIdentity?: {
118
- email?: string;
119
- countryCode?: string;
120
- };
121
- /** GTM tracking parameters */
122
- gtmParams?: Omit<GtmParams, 'brand'>;
123
- /** Force create new cart */
124
- needCreateCart?: boolean;
125
- /** Callback when discount codes are invalid */
126
- onCodesInvalid?: (updatedCart: NormalizedCart, invalidCodes: string[]) => Promise<NormalizedCart | undefined>;
127
- }
128
- interface UseAddToCartOptions {
129
- /** Enable tracking (GA and FBQ) */
130
- withTrack?: boolean;
131
- /** Brand name for tracking */
132
- brand?: string;
133
- }
134
- /**
135
- * Hook for adding items to cart with tracking support
136
- *
137
- * This is the enhanced version that includes:
138
- * - Automatic cart creation if needed
139
- * - Discount code validation
140
- * - Google Analytics tracking
141
- * - Facebook Pixel tracking
142
- * - Invalid code handling
143
- *
144
- * @param options - Hook configuration
145
- * @param swrOptions - SWR mutation configuration
146
- * @returns SWR mutation with trigger function
147
- *
148
- * @example
149
- * ```tsx
150
- * const { trigger, isMutating } = useAddToCart({ withTrack: true, brand: 'Anker' })
151
- *
152
- * await trigger({
153
- * lineItems: [{
154
- * variantId: 'gid://shopify/ProductVariant/123',
155
- * quantity: 2
156
- * }],
157
- * gtmParams: {
158
- * pageGroup: 'PDP',
159
- * position: 'Add to Cart Button'
160
- * }
161
- * })
162
- * ```
163
- */
164
- declare function useAddToCart({ withTrack, brand }?: UseAddToCartOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, AddToCartInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, AddToCartInput>;
165
-
166
94
  /**
167
95
  * Hook for updating cart line quantities
168
96
  *
@@ -307,17 +235,7 @@ interface BuyNowInput {
307
235
  product: HasMetafieldsIdentifier[];
308
236
  };
309
237
  /** Line items to add to the new cart */
310
- lineItems: Array<{
311
- variant?: {
312
- id: string;
313
- };
314
- variantId?: string;
315
- quantity?: number;
316
- attributes?: Array<{
317
- key: string;
318
- value: string;
319
- }>;
320
- }>;
238
+ lineItems: Array<AddToCartLineItem>;
321
239
  /** Discount codes to apply */
322
240
  discountCodes?: string[];
323
241
  /** Custom attributes for the cart */
@@ -340,8 +258,6 @@ interface BuyNowInput {
340
258
  interface UseBuyNowOptions {
341
259
  /** Enable tracking (GA and FBQ) */
342
260
  withTrack?: boolean;
343
- /** Brand name for tracking */
344
- brand?: string;
345
261
  }
346
262
  /**
347
263
  * Hook for buy now functionality
@@ -358,7 +274,6 @@ interface UseBuyNowOptions {
358
274
  * const { trigger, isMutating } = useBuyNow({
359
275
  * withTrack: true,
360
276
  * redirectToCheckout: true,
361
- * brand: 'Anker'
362
277
  * })
363
278
  *
364
279
  * await trigger({
@@ -373,7 +288,7 @@ interface UseBuyNowOptions {
373
288
  * })
374
289
  * ```
375
290
  */
376
- declare function useBuyNow({ withTrack, brand }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
291
+ declare function useBuyNow({ withTrack }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
377
292
 
378
293
  type AutoFreeGift = {
379
294
  currentTier: {
@@ -982,11 +897,55 @@ interface HasPlusMemberInCartResult {
982
897
  */
983
898
  declare function useHasPlusMemberInCart({ memberSetting, cart, }: UseHasPlusMemberInCartProps): HasPlusMemberInCartResult;
984
899
 
900
+ interface UseAddPlusMemberProductsToCartProps {
901
+ /** 购物车数据 */
902
+ cart?: NormalizedCart;
903
+ /** Plus Member 配置 */
904
+ memberSetting?: PlusMemberSettingsMetafields;
905
+ /** 选中的会员模式 */
906
+ selectedPlusMemberMode: DeliveryPlusType;
907
+ /** 选中的会员产品 */
908
+ selectedPlusMemberProduct?: SelectedPlusMemberProduct;
909
+ }
910
+ /**
911
+ * 返回需要添加到购物车的 Plus Member 产品
912
+ *
913
+ * 该 hook 会根据用户选择的会员模式和购物车现有状态,
914
+ * 返回需要添加的会员产品。如果不需要添加会员产品,则返回 undefined。
915
+ *
916
+ * @param props - Hook 参数
917
+ * @param props.cart - 购物车数据
918
+ * @param props.memberSetting - Plus Member 配置
919
+ * @param props.selectedPlusMemberMode - 选中的会员模式
920
+ * @param props.selectedPlusMemberProduct - 选中的会员产品
921
+ * @returns Plus Member 产品对象或 undefined
922
+ *
923
+ * @example
924
+ * ```tsx
925
+ * const plusMemberProduct = useAddPlusMemberProductsToCart({
926
+ * cart,
927
+ * memberSetting,
928
+ * selectedPlusMemberMode: DeliveryPlusType.MONTHLY,
929
+ * selectedPlusMemberProduct: { product, variant },
930
+ * })
931
+ *
932
+ * // plusMemberProduct 格式:
933
+ * // {
934
+ * // product: NormalizedProduct,
935
+ * // variant: NormalizedProductVariant
936
+ * // }
937
+ * // 或 undefined (当不需要添加会员产品时)
938
+ * ```
939
+ */
940
+ declare function useAddPlusMemberProductsToCart({ cart, memberSetting, selectedPlusMemberMode, selectedPlusMemberProduct, }: UseAddPlusMemberProductsToCartProps): {
941
+ product: _anker_in_shopify_sdk.NormalizedProduct;
942
+ variant: _anker_in_shopify_sdk.NormalizedProductVariant;
943
+ } | undefined;
944
+
985
945
  interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any> {
986
946
  variant: TVariant;
987
947
  product: TProduct;
988
- metafields: PlusMemberSettingsMetafields;
989
- shopCommon?: Record<string, any>;
948
+ memberSetting: PlusMemberSettingsMetafields;
990
949
  initialSelectedPlusMemberMode?: DeliveryPlusType;
991
950
  profile?: TProfile;
992
951
  locale?: string;
@@ -999,7 +958,6 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
999
958
  * @param variant - Product variant
1000
959
  * @param product - Product
1001
960
  * @param metafields - Plus member settings from metafields
1002
- * @param shopCommon - Shop common settings
1003
961
  * @param initialSelectedPlusMemberMode - Initial selected mode (default: 'free')
1004
962
  * @param profile - User profile
1005
963
  * @param locale - Locale code
@@ -1010,8 +968,7 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
1010
968
  * <PlusMemberProvider
1011
969
  * variant={variant}
1012
970
  * product={product}
1013
- * metafields={memberSettings}
1014
- * shopCommon={shopCommon}
971
+ * memberSetting={memberSetting}
1015
972
  * profile={profile}
1016
973
  * locale={locale}
1017
974
  * >
@@ -1019,7 +976,7 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
1019
976
  * </PlusMemberProvider>
1020
977
  * ```
1021
978
  */
1022
- declare const PlusMemberProvider: <TProduct = any, TVariant = any, TProfile = any>({ variant, product, shopCommon, metafields, initialSelectedPlusMemberMode, profile, locale, children, }: PropsWithChildren<PlusMemberProviderProps<TProduct, TVariant, TProfile>>) => react_jsx_runtime.JSX.Element;
979
+ declare const PlusMemberProvider: <TProduct = any, TVariant = any, TProfile = any>({ variant, product, memberSetting, initialSelectedPlusMemberMode, profile, locale, children, }: PropsWithChildren<PlusMemberProviderProps<TProduct, TVariant, TProfile>>) => react_jsx_runtime.JSX.Element;
1023
980
 
1024
981
  declare const getReferralAttributes: () => {
1025
982
  key: string;
@@ -1135,18 +1092,14 @@ declare function atobID(id: string): string | undefined;
1135
1092
  declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
1136
1093
 
1137
1094
  declare const getMatchedMainProductSubTotal: (cartData: any, variant_list: AutoFreeGiftMainProduct["variant_id_list"], main_product: AutoFreeGiftMainProduct) => any;
1095
+ declare const safeParse: (str: string) => any;
1138
1096
  declare const getDiscountEnvAttributeValue: (attributes?: {
1139
1097
  key: string;
1140
1098
  value: string;
1141
1099
  }[]) => any;
1142
- declare const isAttributesEqual: (attrs1?: {
1143
- key: string;
1144
- value: string;
1145
- }[], attrs2?: {
1100
+ declare const checkAttributesUpdateNeeded: (oldAttributes: Attribute$1[], newAttributes: Attribute$1[], customAttributesNeedRemove: {
1146
1101
  key: string;
1147
- value: string;
1148
1102
  }[]) => boolean;
1149
- declare const safeParseJson: (str: string) => any;
1150
1103
  declare function preCheck(rule_conditions: RuleCondition[], userTags: string[], currentDealsTypes: string[]): boolean;
1151
1104
  declare const formatScriptAutoFreeGift: ({ scriptAutoFreeGiftResult, gradient_gifts, locale, }: {
1152
1105
  scriptAutoFreeGiftResult: UseScriptAutoFreeGiftResult;
@@ -1933,4 +1886,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
1933
1886
  */
1934
1887
  declare function clearGeoLocationCache(cacheKey?: string): void;
1935
1888
 
1936
- export { PriceBasePriceType as $, type AddCartLinesInput as A, type BuyNowInput as B, type CreateCartInput as C, type DiscountLabel as D, type Config as E, type GiftTier as F, type GiftProduct as G, type RewardItem as H, type GiftProductItem as I, RuleType as J, BuyRuleType as K, type FunctionGiftResult as L, type MainProductInfo as M, type FormattedGift as N, type OrderDiscountResult as O, type CartLineInput as P, type AutoFreeGiftItem as Q, type RemoveCartLinesInput as R, SpendMoneyType as S, type AutoFreeGiftList as T, type UseAddToCartOptions as U, type VariantItem as V, OrderDiscountType as W, OrderBasePriceType as X, type TieredDiscount as Y, type OrderDiscountConfig as Z, PriceDiscountType as _, useAddCartLines as a, PlusMemberContext as a$, type PriceDiscountConfig as a0, currencyCodeMapping as a1, defaultSWRMutationConfiguration as a2, CUSTOMER_ATTRIBUTE_KEY as a3, CUSTOMER_SCRIPT_GIFT_KEY as a4, CODE_AMOUNT_KEY as a5, SCRIPT_CODE_AMOUNT_KEY as a6, MAIN_PRODUCT_CODE as a7, getQuery as a8, atobID as a9, useVariantMedia as aA, type UseCollectionOptions as aB, useCollection as aC, type UseAllCollectionsOptions as aD, useAllCollections as aE, type UseCollectionsOptions as aF, useCollections as aG, type UseBlogOptions as aH, useBlog as aI, type UseAllBlogsOptions as aJ, useAllBlogs as aK, type UseArticleOptions as aL, useArticle as aM, type UseArticlesOptions as aN, useArticles as aO, type UseArticlesInBlogOptions as aP, useArticlesInBlog as aQ, type SearchResultType as aR, type SearchResultItem as aS, type SearchResult as aT, type UseSearchOptions as aU, useSearch as aV, type SiteInfo as aW, type UseSiteOptions as aX, useSite as aY, type ShippingMethodsContext as aZ, type PlusMemberContextValue as a_, btoaID as aa, getMatchedMainProductSubTotal as ab, getDiscountEnvAttributeValue as ac, isAttributesEqual as ad, safeParseJson as ae, preCheck as af, formatScriptAutoFreeGift as ag, formatFunctionAutoFreeGift as ah, useSelectedOptions as ai, type SelectedOptionsResult as aj, type UseProductOptions as ak, useProduct as al, type UseAllProductsOptions as am, useAllProducts as an, type UseProductsByHandlesOptions as ao, useProductsByHandles as ap, type Options as aq, useVariant as ar, type UsePriceOptions as as, type UsePriceResult as at, usePrice as au, useProductUrl as av, useUpdateVariantQuery as aw, type ImageMedia as ax, type VideoMedia as ay, type VariantMedia as az, type AddToCartInput as b, usePlusMemberContext as b0, usePlusMonthlyProductVariant as b1, usePlusAnnualProductVariant as b2, type UseShippingMethodsOptions as b3, type UseShippingMethodsResult as b4, useShippingMethods as b5, useShippingMethodAvailableCheck as b6, useReplaceCartPlusMember as b7, usePlusMemberDeliveryCodes as b8, usePlusMemberItemCustomAttributes as b9, type ExportDiscountAllocations as bA, type ExportLineItem as bB, type ExportDiscounts as bC, type ExportCart as bD, type CustomerOrder as ba, type Customer as bb, usePlusMemberCheckoutCustomAttributes as bc, type UseAutoRemovePlusMemberInCartProps as bd, useAutoRemovePlusMemberInCart as be, type UseHasPlusMemberInCartProps as bf, type HasPlusMemberInCartResult as bg, useHasPlusMemberInCart as bh, type PlusMemberProviderProps as bi, PlusMemberProvider as bj, type UseIntersectionOptions as bk, useIntersection as bl, type UseExposureOptions as bm, useExposure as bn, type GeoLocationData as bo, type LocaleMapping as bp, type UseGeoLocationOptions as bq, useGeoLocation as br, getCachedGeoLocation as bs, clearGeoLocationCache as bt, type Attribute as bu, type Discount as bv, type Image as bw, type Measurement as bx, type ExportSelectedOption as by, type ExportProductVariant as bz, useAddToCart as c, useUpdateCartLines as d, useRemoveCartLines as e, type ApplyCartCodesInput as f, useApplyCartCodes as g, type RemoveCartCodesInput as h, useRemoveCartCodes as i, type UpdateCartAttributesInput as j, useUpdateCartAttributes as k, type UseBuyNowOptions as l, useBuyNow as m, useCalcAutoFreeGift as n, useCalcOrderDiscount as o, getReferralAttributes as p, useCartAttributes as q, useCartItemQuantityLimit as r, type UseScriptAutoFreeGiftResult as s, useScriptAutoFreeGift as t, useCreateCart as u, useUpdateLineCodeAmountAttributes as v, type AutoFreeGift as w, type AutoFreeGiftMainProduct as x, type AutoFreeGiftConfig as y, type RuleCondition as z };
1889
+ export { defaultSWRMutationConfiguration as $, type AddCartLinesInput as A, type BuyNowInput as B, type CreateCartInput as C, type DiscountLabel as D, type GiftProductItem as E, RuleType as F, type GiftProduct as G, BuyRuleType as H, type FunctionGiftResult as I, type FormattedGift as J, type CartLineInput as K, type AutoFreeGiftItem as L, type MainProductInfo as M, type AutoFreeGiftList as N, type OrderDiscountResult as O, OrderDiscountType as P, OrderBasePriceType as Q, type RemoveCartLinesInput as R, SpendMoneyType as S, type TieredDiscount as T, type UpdateCartAttributesInput as U, type VariantItem as V, type OrderDiscountConfig as W, PriceDiscountType as X, PriceBasePriceType as Y, type PriceDiscountConfig as Z, currencyCodeMapping as _, useAddCartLines as a, usePlusAnnualProductVariant as a$, CUSTOMER_ATTRIBUTE_KEY as a0, CUSTOMER_SCRIPT_GIFT_KEY as a1, CODE_AMOUNT_KEY as a2, SCRIPT_CODE_AMOUNT_KEY as a3, MAIN_PRODUCT_CODE as a4, getQuery as a5, atobID as a6, btoaID as a7, getMatchedMainProductSubTotal as a8, safeParse as a9, type UseAllCollectionsOptions as aA, useAllCollections as aB, type UseCollectionsOptions as aC, useCollections as aD, type UseBlogOptions as aE, useBlog as aF, type UseAllBlogsOptions as aG, useAllBlogs as aH, type UseArticleOptions as aI, useArticle as aJ, type UseArticlesOptions as aK, useArticles as aL, type UseArticlesInBlogOptions as aM, useArticlesInBlog as aN, type SearchResultType as aO, type SearchResultItem as aP, type SearchResult as aQ, type UseSearchOptions as aR, useSearch as aS, type SiteInfo as aT, type UseSiteOptions as aU, useSite as aV, type ShippingMethodsContext as aW, type PlusMemberContextValue as aX, PlusMemberContext as aY, usePlusMemberContext as aZ, usePlusMonthlyProductVariant as a_, getDiscountEnvAttributeValue as aa, checkAttributesUpdateNeeded as ab, preCheck as ac, formatScriptAutoFreeGift as ad, formatFunctionAutoFreeGift as ae, useSelectedOptions as af, type SelectedOptionsResult as ag, type UseProductOptions as ah, useProduct as ai, type UseAllProductsOptions as aj, useAllProducts as ak, type UseProductsByHandlesOptions as al, useProductsByHandles as am, type Options as an, useVariant as ao, type UsePriceOptions as ap, type UsePriceResult as aq, usePrice as ar, useProductUrl as as, useUpdateVariantQuery as at, type ImageMedia as au, type VideoMedia as av, type VariantMedia as aw, useVariantMedia as ax, type UseCollectionOptions as ay, useCollection as az, useUpdateCartLines as b, type UseShippingMethodsOptions as b0, type UseShippingMethodsResult as b1, useShippingMethods as b2, useShippingMethodAvailableCheck as b3, useReplaceCartPlusMember as b4, usePlusMemberDeliveryCodes as b5, usePlusMemberItemCustomAttributes as b6, type CustomerOrder as b7, type Customer as b8, usePlusMemberCheckoutCustomAttributes as b9, type ExportLineItem as bA, type ExportDiscounts as bB, type ExportCart as bC, type UseAutoRemovePlusMemberInCartProps as ba, useAutoRemovePlusMemberInCart as bb, type UseHasPlusMemberInCartProps as bc, type HasPlusMemberInCartResult as bd, useHasPlusMemberInCart as be, type UseAddPlusMemberProductsToCartProps as bf, useAddPlusMemberProductsToCart as bg, type PlusMemberProviderProps as bh, PlusMemberProvider as bi, type UseIntersectionOptions as bj, useIntersection as bk, type UseExposureOptions as bl, useExposure as bm, type GeoLocationData as bn, type LocaleMapping as bo, type UseGeoLocationOptions as bp, useGeoLocation as bq, getCachedGeoLocation as br, clearGeoLocationCache as bs, type Attribute as bt, type Discount as bu, type Image as bv, type Measurement as bw, type ExportSelectedOption as bx, type ExportProductVariant as by, type ExportDiscountAllocations as bz, useRemoveCartLines as c, type ApplyCartCodesInput as d, useApplyCartCodes as e, type RemoveCartCodesInput as f, useRemoveCartCodes as g, useUpdateCartAttributes as h, type UseBuyNowOptions as i, useBuyNow as j, useCalcAutoFreeGift as k, useCalcOrderDiscount as l, getReferralAttributes as m, useCartAttributes as n, useCartItemQuantityLimit as o, type UseScriptAutoFreeGiftResult as p, useScriptAutoFreeGift as q, useUpdateLineCodeAmountAttributes as r, type AutoFreeGift as s, type AutoFreeGiftMainProduct as t, useCreateCart as u, type AutoFreeGiftConfig as v, type RuleCondition as w, type Config as x, type GiftTier as y, type RewardItem as z };
@@ -1,7 +1,8 @@
1
1
  import * as swr_mutation from 'swr/mutation';
2
2
  import { SWRMutationConfiguration } from 'swr/mutation';
3
- import { CartLineInput as CartLineInput$1, NormalizedCart, NormalizedProductVariant, MoneyV2, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedLineItem, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
4
- import { G as GtmParams, B as BuyNowTrackConfig, c as PlusMemberShippingMethodConfig, d as PlusMemberSettingsMetafields, D as DeliveryPlusType, e as SelectedPlusMemberProduct, h as DeliveryData } from './types-CMA6_FML.mjs';
3
+ import * as _anker_in_shopify_sdk from '@anker-in/shopify-sdk';
4
+ import { CartLineInput as CartLineInput$1, NormalizedCart, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, Attribute as Attribute$1, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
5
+ import { A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberProduct, i as DeliveryData } from './types-CICUnw0v.mjs';
5
6
  import Decimal from 'decimal.js';
6
7
  import * as swr from 'swr';
7
8
  import swr__default, { SWRConfiguration } from 'swr';
@@ -90,79 +91,6 @@ interface AddCartLinesInput {
90
91
  */
91
92
  declare function useAddCartLines(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'add-cart-lines', AddCartLinesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "add-cart-lines", AddCartLinesInput>;
92
93
 
93
- interface AddToCartInput {
94
- /** Lines to add */
95
- lineItems: Array<{
96
- variant?: NormalizedProductVariant;
97
- finalPrice?: MoneyV2;
98
- sellingPlanId?: string;
99
- quantity?: number;
100
- attributes?: Array<{
101
- key: string;
102
- value: string;
103
- }>;
104
- }>;
105
- /** Cart ID (optional) */
106
- cartId?: string;
107
- /** Discount codes to apply */
108
- discountCodes?: string[];
109
- /** Custom attributes for the cart */
110
- customAttributes?: Array<{
111
- key: string;
112
- value: string;
113
- }>;
114
- /** 全量更新 codes,默认是追加 */
115
- replaceExistingCodes?: boolean;
116
- /** Buyer identity for cart creation */
117
- buyerIdentity?: {
118
- email?: string;
119
- countryCode?: string;
120
- };
121
- /** GTM tracking parameters */
122
- gtmParams?: Omit<GtmParams, 'brand'>;
123
- /** Force create new cart */
124
- needCreateCart?: boolean;
125
- /** Callback when discount codes are invalid */
126
- onCodesInvalid?: (updatedCart: NormalizedCart, invalidCodes: string[]) => Promise<NormalizedCart | undefined>;
127
- }
128
- interface UseAddToCartOptions {
129
- /** Enable tracking (GA and FBQ) */
130
- withTrack?: boolean;
131
- /** Brand name for tracking */
132
- brand?: string;
133
- }
134
- /**
135
- * Hook for adding items to cart with tracking support
136
- *
137
- * This is the enhanced version that includes:
138
- * - Automatic cart creation if needed
139
- * - Discount code validation
140
- * - Google Analytics tracking
141
- * - Facebook Pixel tracking
142
- * - Invalid code handling
143
- *
144
- * @param options - Hook configuration
145
- * @param swrOptions - SWR mutation configuration
146
- * @returns SWR mutation with trigger function
147
- *
148
- * @example
149
- * ```tsx
150
- * const { trigger, isMutating } = useAddToCart({ withTrack: true, brand: 'Anker' })
151
- *
152
- * await trigger({
153
- * lineItems: [{
154
- * variantId: 'gid://shopify/ProductVariant/123',
155
- * quantity: 2
156
- * }],
157
- * gtmParams: {
158
- * pageGroup: 'PDP',
159
- * position: 'Add to Cart Button'
160
- * }
161
- * })
162
- * ```
163
- */
164
- declare function useAddToCart({ withTrack, brand }?: UseAddToCartOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, AddToCartInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, AddToCartInput>;
165
-
166
94
  /**
167
95
  * Hook for updating cart line quantities
168
96
  *
@@ -307,17 +235,7 @@ interface BuyNowInput {
307
235
  product: HasMetafieldsIdentifier[];
308
236
  };
309
237
  /** Line items to add to the new cart */
310
- lineItems: Array<{
311
- variant?: {
312
- id: string;
313
- };
314
- variantId?: string;
315
- quantity?: number;
316
- attributes?: Array<{
317
- key: string;
318
- value: string;
319
- }>;
320
- }>;
238
+ lineItems: Array<AddToCartLineItem>;
321
239
  /** Discount codes to apply */
322
240
  discountCodes?: string[];
323
241
  /** Custom attributes for the cart */
@@ -340,8 +258,6 @@ interface BuyNowInput {
340
258
  interface UseBuyNowOptions {
341
259
  /** Enable tracking (GA and FBQ) */
342
260
  withTrack?: boolean;
343
- /** Brand name for tracking */
344
- brand?: string;
345
261
  }
346
262
  /**
347
263
  * Hook for buy now functionality
@@ -358,7 +274,6 @@ interface UseBuyNowOptions {
358
274
  * const { trigger, isMutating } = useBuyNow({
359
275
  * withTrack: true,
360
276
  * redirectToCheckout: true,
361
- * brand: 'Anker'
362
277
  * })
363
278
  *
364
279
  * await trigger({
@@ -373,7 +288,7 @@ interface UseBuyNowOptions {
373
288
  * })
374
289
  * ```
375
290
  */
376
- declare function useBuyNow({ withTrack, brand }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
291
+ declare function useBuyNow({ withTrack }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
377
292
 
378
293
  type AutoFreeGift = {
379
294
  currentTier: {
@@ -982,11 +897,55 @@ interface HasPlusMemberInCartResult {
982
897
  */
983
898
  declare function useHasPlusMemberInCart({ memberSetting, cart, }: UseHasPlusMemberInCartProps): HasPlusMemberInCartResult;
984
899
 
900
+ interface UseAddPlusMemberProductsToCartProps {
901
+ /** 购物车数据 */
902
+ cart?: NormalizedCart;
903
+ /** Plus Member 配置 */
904
+ memberSetting?: PlusMemberSettingsMetafields;
905
+ /** 选中的会员模式 */
906
+ selectedPlusMemberMode: DeliveryPlusType;
907
+ /** 选中的会员产品 */
908
+ selectedPlusMemberProduct?: SelectedPlusMemberProduct;
909
+ }
910
+ /**
911
+ * 返回需要添加到购物车的 Plus Member 产品
912
+ *
913
+ * 该 hook 会根据用户选择的会员模式和购物车现有状态,
914
+ * 返回需要添加的会员产品。如果不需要添加会员产品,则返回 undefined。
915
+ *
916
+ * @param props - Hook 参数
917
+ * @param props.cart - 购物车数据
918
+ * @param props.memberSetting - Plus Member 配置
919
+ * @param props.selectedPlusMemberMode - 选中的会员模式
920
+ * @param props.selectedPlusMemberProduct - 选中的会员产品
921
+ * @returns Plus Member 产品对象或 undefined
922
+ *
923
+ * @example
924
+ * ```tsx
925
+ * const plusMemberProduct = useAddPlusMemberProductsToCart({
926
+ * cart,
927
+ * memberSetting,
928
+ * selectedPlusMemberMode: DeliveryPlusType.MONTHLY,
929
+ * selectedPlusMemberProduct: { product, variant },
930
+ * })
931
+ *
932
+ * // plusMemberProduct 格式:
933
+ * // {
934
+ * // product: NormalizedProduct,
935
+ * // variant: NormalizedProductVariant
936
+ * // }
937
+ * // 或 undefined (当不需要添加会员产品时)
938
+ * ```
939
+ */
940
+ declare function useAddPlusMemberProductsToCart({ cart, memberSetting, selectedPlusMemberMode, selectedPlusMemberProduct, }: UseAddPlusMemberProductsToCartProps): {
941
+ product: _anker_in_shopify_sdk.NormalizedProduct;
942
+ variant: _anker_in_shopify_sdk.NormalizedProductVariant;
943
+ } | undefined;
944
+
985
945
  interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any> {
986
946
  variant: TVariant;
987
947
  product: TProduct;
988
- metafields: PlusMemberSettingsMetafields;
989
- shopCommon?: Record<string, any>;
948
+ memberSetting: PlusMemberSettingsMetafields;
990
949
  initialSelectedPlusMemberMode?: DeliveryPlusType;
991
950
  profile?: TProfile;
992
951
  locale?: string;
@@ -999,7 +958,6 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
999
958
  * @param variant - Product variant
1000
959
  * @param product - Product
1001
960
  * @param metafields - Plus member settings from metafields
1002
- * @param shopCommon - Shop common settings
1003
961
  * @param initialSelectedPlusMemberMode - Initial selected mode (default: 'free')
1004
962
  * @param profile - User profile
1005
963
  * @param locale - Locale code
@@ -1010,8 +968,7 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
1010
968
  * <PlusMemberProvider
1011
969
  * variant={variant}
1012
970
  * product={product}
1013
- * metafields={memberSettings}
1014
- * shopCommon={shopCommon}
971
+ * memberSetting={memberSetting}
1015
972
  * profile={profile}
1016
973
  * locale={locale}
1017
974
  * >
@@ -1019,7 +976,7 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
1019
976
  * </PlusMemberProvider>
1020
977
  * ```
1021
978
  */
1022
- declare const PlusMemberProvider: <TProduct = any, TVariant = any, TProfile = any>({ variant, product, shopCommon, metafields, initialSelectedPlusMemberMode, profile, locale, children, }: PropsWithChildren<PlusMemberProviderProps<TProduct, TVariant, TProfile>>) => react_jsx_runtime.JSX.Element;
979
+ declare const PlusMemberProvider: <TProduct = any, TVariant = any, TProfile = any>({ variant, product, memberSetting, initialSelectedPlusMemberMode, profile, locale, children, }: PropsWithChildren<PlusMemberProviderProps<TProduct, TVariant, TProfile>>) => react_jsx_runtime.JSX.Element;
1023
980
 
1024
981
  declare const getReferralAttributes: () => {
1025
982
  key: string;
@@ -1135,18 +1092,14 @@ declare function atobID(id: string): string | undefined;
1135
1092
  declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
1136
1093
 
1137
1094
  declare const getMatchedMainProductSubTotal: (cartData: any, variant_list: AutoFreeGiftMainProduct["variant_id_list"], main_product: AutoFreeGiftMainProduct) => any;
1095
+ declare const safeParse: (str: string) => any;
1138
1096
  declare const getDiscountEnvAttributeValue: (attributes?: {
1139
1097
  key: string;
1140
1098
  value: string;
1141
1099
  }[]) => any;
1142
- declare const isAttributesEqual: (attrs1?: {
1143
- key: string;
1144
- value: string;
1145
- }[], attrs2?: {
1100
+ declare const checkAttributesUpdateNeeded: (oldAttributes: Attribute$1[], newAttributes: Attribute$1[], customAttributesNeedRemove: {
1146
1101
  key: string;
1147
- value: string;
1148
1102
  }[]) => boolean;
1149
- declare const safeParseJson: (str: string) => any;
1150
1103
  declare function preCheck(rule_conditions: RuleCondition[], userTags: string[], currentDealsTypes: string[]): boolean;
1151
1104
  declare const formatScriptAutoFreeGift: ({ scriptAutoFreeGiftResult, gradient_gifts, locale, }: {
1152
1105
  scriptAutoFreeGiftResult: UseScriptAutoFreeGiftResult;
@@ -1933,4 +1886,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
1933
1886
  */
1934
1887
  declare function clearGeoLocationCache(cacheKey?: string): void;
1935
1888
 
1936
- export { PriceBasePriceType as $, type AddCartLinesInput as A, type BuyNowInput as B, type CreateCartInput as C, type DiscountLabel as D, type Config as E, type GiftTier as F, type GiftProduct as G, type RewardItem as H, type GiftProductItem as I, RuleType as J, BuyRuleType as K, type FunctionGiftResult as L, type MainProductInfo as M, type FormattedGift as N, type OrderDiscountResult as O, type CartLineInput as P, type AutoFreeGiftItem as Q, type RemoveCartLinesInput as R, SpendMoneyType as S, type AutoFreeGiftList as T, type UseAddToCartOptions as U, type VariantItem as V, OrderDiscountType as W, OrderBasePriceType as X, type TieredDiscount as Y, type OrderDiscountConfig as Z, PriceDiscountType as _, useAddCartLines as a, PlusMemberContext as a$, type PriceDiscountConfig as a0, currencyCodeMapping as a1, defaultSWRMutationConfiguration as a2, CUSTOMER_ATTRIBUTE_KEY as a3, CUSTOMER_SCRIPT_GIFT_KEY as a4, CODE_AMOUNT_KEY as a5, SCRIPT_CODE_AMOUNT_KEY as a6, MAIN_PRODUCT_CODE as a7, getQuery as a8, atobID as a9, useVariantMedia as aA, type UseCollectionOptions as aB, useCollection as aC, type UseAllCollectionsOptions as aD, useAllCollections as aE, type UseCollectionsOptions as aF, useCollections as aG, type UseBlogOptions as aH, useBlog as aI, type UseAllBlogsOptions as aJ, useAllBlogs as aK, type UseArticleOptions as aL, useArticle as aM, type UseArticlesOptions as aN, useArticles as aO, type UseArticlesInBlogOptions as aP, useArticlesInBlog as aQ, type SearchResultType as aR, type SearchResultItem as aS, type SearchResult as aT, type UseSearchOptions as aU, useSearch as aV, type SiteInfo as aW, type UseSiteOptions as aX, useSite as aY, type ShippingMethodsContext as aZ, type PlusMemberContextValue as a_, btoaID as aa, getMatchedMainProductSubTotal as ab, getDiscountEnvAttributeValue as ac, isAttributesEqual as ad, safeParseJson as ae, preCheck as af, formatScriptAutoFreeGift as ag, formatFunctionAutoFreeGift as ah, useSelectedOptions as ai, type SelectedOptionsResult as aj, type UseProductOptions as ak, useProduct as al, type UseAllProductsOptions as am, useAllProducts as an, type UseProductsByHandlesOptions as ao, useProductsByHandles as ap, type Options as aq, useVariant as ar, type UsePriceOptions as as, type UsePriceResult as at, usePrice as au, useProductUrl as av, useUpdateVariantQuery as aw, type ImageMedia as ax, type VideoMedia as ay, type VariantMedia as az, type AddToCartInput as b, usePlusMemberContext as b0, usePlusMonthlyProductVariant as b1, usePlusAnnualProductVariant as b2, type UseShippingMethodsOptions as b3, type UseShippingMethodsResult as b4, useShippingMethods as b5, useShippingMethodAvailableCheck as b6, useReplaceCartPlusMember as b7, usePlusMemberDeliveryCodes as b8, usePlusMemberItemCustomAttributes as b9, type ExportDiscountAllocations as bA, type ExportLineItem as bB, type ExportDiscounts as bC, type ExportCart as bD, type CustomerOrder as ba, type Customer as bb, usePlusMemberCheckoutCustomAttributes as bc, type UseAutoRemovePlusMemberInCartProps as bd, useAutoRemovePlusMemberInCart as be, type UseHasPlusMemberInCartProps as bf, type HasPlusMemberInCartResult as bg, useHasPlusMemberInCart as bh, type PlusMemberProviderProps as bi, PlusMemberProvider as bj, type UseIntersectionOptions as bk, useIntersection as bl, type UseExposureOptions as bm, useExposure as bn, type GeoLocationData as bo, type LocaleMapping as bp, type UseGeoLocationOptions as bq, useGeoLocation as br, getCachedGeoLocation as bs, clearGeoLocationCache as bt, type Attribute as bu, type Discount as bv, type Image as bw, type Measurement as bx, type ExportSelectedOption as by, type ExportProductVariant as bz, useAddToCart as c, useUpdateCartLines as d, useRemoveCartLines as e, type ApplyCartCodesInput as f, useApplyCartCodes as g, type RemoveCartCodesInput as h, useRemoveCartCodes as i, type UpdateCartAttributesInput as j, useUpdateCartAttributes as k, type UseBuyNowOptions as l, useBuyNow as m, useCalcAutoFreeGift as n, useCalcOrderDiscount as o, getReferralAttributes as p, useCartAttributes as q, useCartItemQuantityLimit as r, type UseScriptAutoFreeGiftResult as s, useScriptAutoFreeGift as t, useCreateCart as u, useUpdateLineCodeAmountAttributes as v, type AutoFreeGift as w, type AutoFreeGiftMainProduct as x, type AutoFreeGiftConfig as y, type RuleCondition as z };
1889
+ export { defaultSWRMutationConfiguration as $, type AddCartLinesInput as A, type BuyNowInput as B, type CreateCartInput as C, type DiscountLabel as D, type GiftProductItem as E, RuleType as F, type GiftProduct as G, BuyRuleType as H, type FunctionGiftResult as I, type FormattedGift as J, type CartLineInput as K, type AutoFreeGiftItem as L, type MainProductInfo as M, type AutoFreeGiftList as N, type OrderDiscountResult as O, OrderDiscountType as P, OrderBasePriceType as Q, type RemoveCartLinesInput as R, SpendMoneyType as S, type TieredDiscount as T, type UpdateCartAttributesInput as U, type VariantItem as V, type OrderDiscountConfig as W, PriceDiscountType as X, PriceBasePriceType as Y, type PriceDiscountConfig as Z, currencyCodeMapping as _, useAddCartLines as a, usePlusAnnualProductVariant as a$, CUSTOMER_ATTRIBUTE_KEY as a0, CUSTOMER_SCRIPT_GIFT_KEY as a1, CODE_AMOUNT_KEY as a2, SCRIPT_CODE_AMOUNT_KEY as a3, MAIN_PRODUCT_CODE as a4, getQuery as a5, atobID as a6, btoaID as a7, getMatchedMainProductSubTotal as a8, safeParse as a9, type UseAllCollectionsOptions as aA, useAllCollections as aB, type UseCollectionsOptions as aC, useCollections as aD, type UseBlogOptions as aE, useBlog as aF, type UseAllBlogsOptions as aG, useAllBlogs as aH, type UseArticleOptions as aI, useArticle as aJ, type UseArticlesOptions as aK, useArticles as aL, type UseArticlesInBlogOptions as aM, useArticlesInBlog as aN, type SearchResultType as aO, type SearchResultItem as aP, type SearchResult as aQ, type UseSearchOptions as aR, useSearch as aS, type SiteInfo as aT, type UseSiteOptions as aU, useSite as aV, type ShippingMethodsContext as aW, type PlusMemberContextValue as aX, PlusMemberContext as aY, usePlusMemberContext as aZ, usePlusMonthlyProductVariant as a_, getDiscountEnvAttributeValue as aa, checkAttributesUpdateNeeded as ab, preCheck as ac, formatScriptAutoFreeGift as ad, formatFunctionAutoFreeGift as ae, useSelectedOptions as af, type SelectedOptionsResult as ag, type UseProductOptions as ah, useProduct as ai, type UseAllProductsOptions as aj, useAllProducts as ak, type UseProductsByHandlesOptions as al, useProductsByHandles as am, type Options as an, useVariant as ao, type UsePriceOptions as ap, type UsePriceResult as aq, usePrice as ar, useProductUrl as as, useUpdateVariantQuery as at, type ImageMedia as au, type VideoMedia as av, type VariantMedia as aw, useVariantMedia as ax, type UseCollectionOptions as ay, useCollection as az, useUpdateCartLines as b, type UseShippingMethodsOptions as b0, type UseShippingMethodsResult as b1, useShippingMethods as b2, useShippingMethodAvailableCheck as b3, useReplaceCartPlusMember as b4, usePlusMemberDeliveryCodes as b5, usePlusMemberItemCustomAttributes as b6, type CustomerOrder as b7, type Customer as b8, usePlusMemberCheckoutCustomAttributes as b9, type ExportLineItem as bA, type ExportDiscounts as bB, type ExportCart as bC, type UseAutoRemovePlusMemberInCartProps as ba, useAutoRemovePlusMemberInCart as bb, type UseHasPlusMemberInCartProps as bc, type HasPlusMemberInCartResult as bd, useHasPlusMemberInCart as be, type UseAddPlusMemberProductsToCartProps as bf, useAddPlusMemberProductsToCart as bg, type PlusMemberProviderProps as bh, PlusMemberProvider as bi, type UseIntersectionOptions as bj, useIntersection as bk, type UseExposureOptions as bl, useExposure as bm, type GeoLocationData as bn, type LocaleMapping as bo, type UseGeoLocationOptions as bp, useGeoLocation as bq, getCachedGeoLocation as br, clearGeoLocationCache as bs, type Attribute as bt, type Discount as bu, type Image as bv, type Measurement as bw, type ExportSelectedOption as bx, type ExportProductVariant as by, type ExportDiscountAllocations as bz, useRemoveCartLines as c, type ApplyCartCodesInput as d, useApplyCartCodes as e, type RemoveCartCodesInput as f, useRemoveCartCodes as g, useUpdateCartAttributes as h, type UseBuyNowOptions as i, useBuyNow as j, useCalcAutoFreeGift as k, useCalcOrderDiscount as l, getReferralAttributes as m, useCartAttributes as n, useCartItemQuantityLimit as o, type UseScriptAutoFreeGiftResult as p, useScriptAutoFreeGift as q, useUpdateLineCodeAmountAttributes as r, type AutoFreeGift as s, type AutoFreeGiftMainProduct as t, useCreateCart as u, type AutoFreeGiftConfig as v, type RuleCondition as w, type Config as x, type GiftTier as y, type RewardItem as z };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { AttributeInput, CartContextValue, CartProvider, CartProviderProps, LoadingState, ShopifyContext, ShopifyContextValue, ShopifyProvider, ShopifyProviderProps, useCartContext, useShopify } from './provider/index.mjs';
2
2
  export { b as CartCookieAdapter, C as CookieAdapter, a as CookieOptions, R as RouterAdapter, U as UserContextAdapter } from './types-BLMoxbOk.mjs';
3
3
  export { browserCartCookieAdapter, browserCookieAdapter } from './adapters/index.mjs';
4
- export { A as AddCartLinesInput, b as AddToCartInput, f as ApplyCartCodesInput, bu as Attribute, w as AutoFreeGift, y as AutoFreeGiftConfig, Q as AutoFreeGiftItem, T as AutoFreeGiftList, x as AutoFreeGiftMainProduct, B as BuyNowInput, K as BuyRuleType, a5 as CODE_AMOUNT_KEY, a3 as CUSTOMER_ATTRIBUTE_KEY, a4 as CUSTOMER_SCRIPT_GIFT_KEY, P as CartLineInput, E as Config, C as CreateCartInput, bb as Customer, ba as CustomerOrder, bv as Discount, D as DiscountLabel, bD as ExportCart, bA as ExportDiscountAllocations, bC as ExportDiscounts, bB as ExportLineItem, bz as ExportProductVariant, by as ExportSelectedOption, N as FormattedGift, L as FunctionGiftResult, bo as GeoLocationData, G as GiftProduct, I as GiftProductItem, F as GiftTier, bg as HasPlusMemberInCartResult, bw as Image, ax as ImageMedia, bp as LocaleMapping, a7 as MAIN_PRODUCT_CODE, M as MainProductInfo, bx as Measurement, aq as Options, X as OrderBasePriceType, Z as OrderDiscountConfig, O as OrderDiscountResult, W as OrderDiscountType, a$ as PlusMemberContext, a_ as PlusMemberContextValue, bj as PlusMemberProvider, bi as PlusMemberProviderProps, $ as PriceBasePriceType, a0 as PriceDiscountConfig, _ as PriceDiscountType, h as RemoveCartCodesInput, R as RemoveCartLinesInput, H as RewardItem, z as RuleCondition, J as RuleType, a6 as SCRIPT_CODE_AMOUNT_KEY, aT as SearchResult, aS as SearchResultItem, aR as SearchResultType, aj as SelectedOptionsResult, aZ as ShippingMethodsContext, aW as SiteInfo, S as SpendMoneyType, Y as TieredDiscount, j as UpdateCartAttributesInput, U as UseAddToCartOptions, aJ as UseAllBlogsOptions, aD as UseAllCollectionsOptions, am as UseAllProductsOptions, aL as UseArticleOptions, aP as UseArticlesInBlogOptions, aN as UseArticlesOptions, bd as UseAutoRemovePlusMemberInCartProps, aH as UseBlogOptions, l as UseBuyNowOptions, aB as UseCollectionOptions, aF as UseCollectionsOptions, bm as UseExposureOptions, bq as UseGeoLocationOptions, bf as UseHasPlusMemberInCartProps, bk as UseIntersectionOptions, as as UsePriceOptions, at as UsePriceResult, ak as UseProductOptions, ao as UseProductsByHandlesOptions, s as UseScriptAutoFreeGiftResult, aU as UseSearchOptions, b3 as UseShippingMethodsOptions, b4 as UseShippingMethodsResult, aX as UseSiteOptions, V as VariantItem, az as VariantMedia, ay as VideoMedia, a9 as atobID, aa as btoaID, bt as clearGeoLocationCache, a1 as currencyCodeMapping, a2 as defaultSWRMutationConfiguration, ah as formatFunctionAutoFreeGift, ag as formatScriptAutoFreeGift, bs as getCachedGeoLocation, ac as getDiscountEnvAttributeValue, ab as getMatchedMainProductSubTotal, a8 as getQuery, p as getReferralAttributes, ad as isAttributesEqual, af as preCheck, ae as safeParseJson, a as useAddCartLines, c as useAddToCart, aK as useAllBlogs, aE as useAllCollections, an as useAllProducts, g as useApplyCartCodes, aM as useArticle, aO as useArticles, aQ as useArticlesInBlog, be as useAutoRemovePlusMemberInCart, aI as useBlog, m as useBuyNow, n as useCalcAutoFreeGift, o as useCalcOrderDiscount, q as useCartAttributes, r as useCartItemQuantityLimit, aC as useCollection, aG as useCollections, u as useCreateCart, bn as useExposure, br as useGeoLocation, bh as useHasPlusMemberInCart, bl as useIntersection, b2 as usePlusAnnualProductVariant, bc as usePlusMemberCheckoutCustomAttributes, b0 as usePlusMemberContext, b8 as usePlusMemberDeliveryCodes, b9 as usePlusMemberItemCustomAttributes, b1 as usePlusMonthlyProductVariant, au as usePrice, al as useProduct, av as useProductUrl, ap as useProductsByHandles, i as useRemoveCartCodes, e as useRemoveCartLines, b7 as useReplaceCartPlusMember, t as useScriptAutoFreeGift, aV as useSearch, ai as useSelectedOptions, b6 as useShippingMethodAvailableCheck, b5 as useShippingMethods, aY as useSite, k as useUpdateCartAttributes, d as useUpdateCartLines, v as useUpdateLineCodeAmountAttributes, aw as useUpdateVariantQuery, ar as useVariant, aA as useVariantMedia } from './index-DenyuVGJ.mjs';
5
- export { B as BuyNowTrackConfig, g as DeliveryCustomData, h as DeliveryData, f as DeliveryOption, D as DeliveryPlusType, G as GtmParams, M as MailingAddress, P as PLUS_MEMBER_TYPE, a as PlusMemberMode, d as PlusMemberSettingsMetafields, c as PlusMemberShippingMethodConfig, b as PlusMemberShippingMethodMetafields, e as SelectedPlusMemberProduct, S as ShippingMethodMode, j as TrackingAdapter, T as TrackingLineItem, i as TrackingOptions, k as gaTrack, n as trackAddToCartFBQ, t as trackAddToCartGA, l as trackBeginCheckoutGA, o as trackBuyNowFBQ, m as trackBuyNowGA } from './types-CMA6_FML.mjs';
4
+ export { A as AddCartLinesInput, d as ApplyCartCodesInput, bt as Attribute, s as AutoFreeGift, v as AutoFreeGiftConfig, L as AutoFreeGiftItem, N as AutoFreeGiftList, t as AutoFreeGiftMainProduct, B as BuyNowInput, H as BuyRuleType, a2 as CODE_AMOUNT_KEY, a0 as CUSTOMER_ATTRIBUTE_KEY, a1 as CUSTOMER_SCRIPT_GIFT_KEY, K as CartLineInput, x as Config, C as CreateCartInput, b8 as Customer, b7 as CustomerOrder, bu as Discount, D as DiscountLabel, bC as ExportCart, bz as ExportDiscountAllocations, bB as ExportDiscounts, bA as ExportLineItem, by as ExportProductVariant, bx as ExportSelectedOption, J as FormattedGift, I as FunctionGiftResult, bn as GeoLocationData, G as GiftProduct, E as GiftProductItem, y as GiftTier, bd as HasPlusMemberInCartResult, bv as Image, au as ImageMedia, bo as LocaleMapping, a4 as MAIN_PRODUCT_CODE, M as MainProductInfo, bw as Measurement, an as Options, Q as OrderBasePriceType, W as OrderDiscountConfig, O as OrderDiscountResult, P as OrderDiscountType, aY as PlusMemberContext, aX as PlusMemberContextValue, bi as PlusMemberProvider, bh as PlusMemberProviderProps, Y as PriceBasePriceType, Z as PriceDiscountConfig, X as PriceDiscountType, f as RemoveCartCodesInput, R as RemoveCartLinesInput, z as RewardItem, w as RuleCondition, F as RuleType, a3 as SCRIPT_CODE_AMOUNT_KEY, aQ as SearchResult, aP as SearchResultItem, aO as SearchResultType, ag as SelectedOptionsResult, aW as ShippingMethodsContext, aT as SiteInfo, S as SpendMoneyType, T as TieredDiscount, U as UpdateCartAttributesInput, bf as UseAddPlusMemberProductsToCartProps, aG as UseAllBlogsOptions, aA as UseAllCollectionsOptions, aj as UseAllProductsOptions, aI as UseArticleOptions, aM as UseArticlesInBlogOptions, aK as UseArticlesOptions, ba as UseAutoRemovePlusMemberInCartProps, aE as UseBlogOptions, i as UseBuyNowOptions, ay as UseCollectionOptions, aC as UseCollectionsOptions, bl as UseExposureOptions, bp as UseGeoLocationOptions, bc as UseHasPlusMemberInCartProps, bj as UseIntersectionOptions, ap as UsePriceOptions, aq as UsePriceResult, ah as UseProductOptions, al as UseProductsByHandlesOptions, p as UseScriptAutoFreeGiftResult, aR as UseSearchOptions, b0 as UseShippingMethodsOptions, b1 as UseShippingMethodsResult, aU as UseSiteOptions, V as VariantItem, aw as VariantMedia, av as VideoMedia, a6 as atobID, a7 as btoaID, ab as checkAttributesUpdateNeeded, bs as clearGeoLocationCache, _ as currencyCodeMapping, $ as defaultSWRMutationConfiguration, ae as formatFunctionAutoFreeGift, ad as formatScriptAutoFreeGift, br as getCachedGeoLocation, aa as getDiscountEnvAttributeValue, a8 as getMatchedMainProductSubTotal, a5 as getQuery, m as getReferralAttributes, ac as preCheck, a9 as safeParse, a as useAddCartLines, bg as useAddPlusMemberProductsToCart, aH as useAllBlogs, aB as useAllCollections, ak as useAllProducts, e as useApplyCartCodes, aJ as useArticle, aL as useArticles, aN as useArticlesInBlog, bb as useAutoRemovePlusMemberInCart, aF as useBlog, j as useBuyNow, k as useCalcAutoFreeGift, l as useCalcOrderDiscount, n as useCartAttributes, o as useCartItemQuantityLimit, az as useCollection, aD as useCollections, u as useCreateCart, bm as useExposure, bq as useGeoLocation, be as useHasPlusMemberInCart, bk as useIntersection, a$ as usePlusAnnualProductVariant, b9 as usePlusMemberCheckoutCustomAttributes, aZ as usePlusMemberContext, b5 as usePlusMemberDeliveryCodes, b6 as usePlusMemberItemCustomAttributes, a_ as usePlusMonthlyProductVariant, ar as usePrice, ai as useProduct, as as useProductUrl, am as useProductsByHandles, g as useRemoveCartCodes, c as useRemoveCartLines, b4 as useReplaceCartPlusMember, q as useScriptAutoFreeGift, aS as useSearch, af as useSelectedOptions, b3 as useShippingMethodAvailableCheck, b2 as useShippingMethods, aV as useSite, h as useUpdateCartAttributes, b as useUpdateCartLines, r as useUpdateLineCodeAmountAttributes, at as useUpdateVariantQuery, ao as useVariant, ax as useVariantMedia } from './index-Bea95u2X.mjs';
5
+ export { a as AddToCartInput, A as AddToCartLineItem, B as BuyNowTrackConfig, h as DeliveryCustomData, i as DeliveryData, g as DeliveryOption, D as DeliveryPlusType, G as GtmParams, M as MailingAddress, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, e as PlusMemberSettingsMetafields, d as PlusMemberShippingMethodConfig, c as PlusMemberShippingMethodMetafields, f as SelectedPlusMemberProduct, S as ShippingMethodMode, U as UseAddToCartOptions, j as gaTrack, m as trackAddToCartFBQ, t as trackAddToCartGA, k as trackBeginCheckoutGA, n as trackBuyNowFBQ, l as trackBuyNowGA, u as useAddToCart } from './types-CICUnw0v.mjs';
6
6
  export { ShopifyConfig, clearLocalStorage, createShopifyClient, getLocalStorage, removeLocalStorage, setLocalStorage } from '@anker-in/shopify-sdk';
7
7
  import 'react';
8
8
  import 'react/jsx-runtime';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { AttributeInput, CartContextValue, CartProvider, CartProviderProps, LoadingState, ShopifyContext, ShopifyContextValue, ShopifyProvider, ShopifyProviderProps, useCartContext, useShopify } from './provider/index.js';
2
2
  export { b as CartCookieAdapter, C as CookieAdapter, a as CookieOptions, R as RouterAdapter, U as UserContextAdapter } from './types-BLMoxbOk.js';
3
3
  export { browserCartCookieAdapter, browserCookieAdapter } from './adapters/index.js';
4
- export { A as AddCartLinesInput, b as AddToCartInput, f as ApplyCartCodesInput, bu as Attribute, w as AutoFreeGift, y as AutoFreeGiftConfig, Q as AutoFreeGiftItem, T as AutoFreeGiftList, x as AutoFreeGiftMainProduct, B as BuyNowInput, K as BuyRuleType, a5 as CODE_AMOUNT_KEY, a3 as CUSTOMER_ATTRIBUTE_KEY, a4 as CUSTOMER_SCRIPT_GIFT_KEY, P as CartLineInput, E as Config, C as CreateCartInput, bb as Customer, ba as CustomerOrder, bv as Discount, D as DiscountLabel, bD as ExportCart, bA as ExportDiscountAllocations, bC as ExportDiscounts, bB as ExportLineItem, bz as ExportProductVariant, by as ExportSelectedOption, N as FormattedGift, L as FunctionGiftResult, bo as GeoLocationData, G as GiftProduct, I as GiftProductItem, F as GiftTier, bg as HasPlusMemberInCartResult, bw as Image, ax as ImageMedia, bp as LocaleMapping, a7 as MAIN_PRODUCT_CODE, M as MainProductInfo, bx as Measurement, aq as Options, X as OrderBasePriceType, Z as OrderDiscountConfig, O as OrderDiscountResult, W as OrderDiscountType, a$ as PlusMemberContext, a_ as PlusMemberContextValue, bj as PlusMemberProvider, bi as PlusMemberProviderProps, $ as PriceBasePriceType, a0 as PriceDiscountConfig, _ as PriceDiscountType, h as RemoveCartCodesInput, R as RemoveCartLinesInput, H as RewardItem, z as RuleCondition, J as RuleType, a6 as SCRIPT_CODE_AMOUNT_KEY, aT as SearchResult, aS as SearchResultItem, aR as SearchResultType, aj as SelectedOptionsResult, aZ as ShippingMethodsContext, aW as SiteInfo, S as SpendMoneyType, Y as TieredDiscount, j as UpdateCartAttributesInput, U as UseAddToCartOptions, aJ as UseAllBlogsOptions, aD as UseAllCollectionsOptions, am as UseAllProductsOptions, aL as UseArticleOptions, aP as UseArticlesInBlogOptions, aN as UseArticlesOptions, bd as UseAutoRemovePlusMemberInCartProps, aH as UseBlogOptions, l as UseBuyNowOptions, aB as UseCollectionOptions, aF as UseCollectionsOptions, bm as UseExposureOptions, bq as UseGeoLocationOptions, bf as UseHasPlusMemberInCartProps, bk as UseIntersectionOptions, as as UsePriceOptions, at as UsePriceResult, ak as UseProductOptions, ao as UseProductsByHandlesOptions, s as UseScriptAutoFreeGiftResult, aU as UseSearchOptions, b3 as UseShippingMethodsOptions, b4 as UseShippingMethodsResult, aX as UseSiteOptions, V as VariantItem, az as VariantMedia, ay as VideoMedia, a9 as atobID, aa as btoaID, bt as clearGeoLocationCache, a1 as currencyCodeMapping, a2 as defaultSWRMutationConfiguration, ah as formatFunctionAutoFreeGift, ag as formatScriptAutoFreeGift, bs as getCachedGeoLocation, ac as getDiscountEnvAttributeValue, ab as getMatchedMainProductSubTotal, a8 as getQuery, p as getReferralAttributes, ad as isAttributesEqual, af as preCheck, ae as safeParseJson, a as useAddCartLines, c as useAddToCart, aK as useAllBlogs, aE as useAllCollections, an as useAllProducts, g as useApplyCartCodes, aM as useArticle, aO as useArticles, aQ as useArticlesInBlog, be as useAutoRemovePlusMemberInCart, aI as useBlog, m as useBuyNow, n as useCalcAutoFreeGift, o as useCalcOrderDiscount, q as useCartAttributes, r as useCartItemQuantityLimit, aC as useCollection, aG as useCollections, u as useCreateCart, bn as useExposure, br as useGeoLocation, bh as useHasPlusMemberInCart, bl as useIntersection, b2 as usePlusAnnualProductVariant, bc as usePlusMemberCheckoutCustomAttributes, b0 as usePlusMemberContext, b8 as usePlusMemberDeliveryCodes, b9 as usePlusMemberItemCustomAttributes, b1 as usePlusMonthlyProductVariant, au as usePrice, al as useProduct, av as useProductUrl, ap as useProductsByHandles, i as useRemoveCartCodes, e as useRemoveCartLines, b7 as useReplaceCartPlusMember, t as useScriptAutoFreeGift, aV as useSearch, ai as useSelectedOptions, b6 as useShippingMethodAvailableCheck, b5 as useShippingMethods, aY as useSite, k as useUpdateCartAttributes, d as useUpdateCartLines, v as useUpdateLineCodeAmountAttributes, aw as useUpdateVariantQuery, ar as useVariant, aA as useVariantMedia } from './index-BUWkkUdh.js';
5
- export { B as BuyNowTrackConfig, g as DeliveryCustomData, h as DeliveryData, f as DeliveryOption, D as DeliveryPlusType, G as GtmParams, M as MailingAddress, P as PLUS_MEMBER_TYPE, a as PlusMemberMode, d as PlusMemberSettingsMetafields, c as PlusMemberShippingMethodConfig, b as PlusMemberShippingMethodMetafields, e as SelectedPlusMemberProduct, S as ShippingMethodMode, j as TrackingAdapter, T as TrackingLineItem, i as TrackingOptions, k as gaTrack, n as trackAddToCartFBQ, t as trackAddToCartGA, l as trackBeginCheckoutGA, o as trackBuyNowFBQ, m as trackBuyNowGA } from './types-CMA6_FML.js';
4
+ export { A as AddCartLinesInput, d as ApplyCartCodesInput, bt as Attribute, s as AutoFreeGift, v as AutoFreeGiftConfig, L as AutoFreeGiftItem, N as AutoFreeGiftList, t as AutoFreeGiftMainProduct, B as BuyNowInput, H as BuyRuleType, a2 as CODE_AMOUNT_KEY, a0 as CUSTOMER_ATTRIBUTE_KEY, a1 as CUSTOMER_SCRIPT_GIFT_KEY, K as CartLineInput, x as Config, C as CreateCartInput, b8 as Customer, b7 as CustomerOrder, bu as Discount, D as DiscountLabel, bC as ExportCart, bz as ExportDiscountAllocations, bB as ExportDiscounts, bA as ExportLineItem, by as ExportProductVariant, bx as ExportSelectedOption, J as FormattedGift, I as FunctionGiftResult, bn as GeoLocationData, G as GiftProduct, E as GiftProductItem, y as GiftTier, bd as HasPlusMemberInCartResult, bv as Image, au as ImageMedia, bo as LocaleMapping, a4 as MAIN_PRODUCT_CODE, M as MainProductInfo, bw as Measurement, an as Options, Q as OrderBasePriceType, W as OrderDiscountConfig, O as OrderDiscountResult, P as OrderDiscountType, aY as PlusMemberContext, aX as PlusMemberContextValue, bi as PlusMemberProvider, bh as PlusMemberProviderProps, Y as PriceBasePriceType, Z as PriceDiscountConfig, X as PriceDiscountType, f as RemoveCartCodesInput, R as RemoveCartLinesInput, z as RewardItem, w as RuleCondition, F as RuleType, a3 as SCRIPT_CODE_AMOUNT_KEY, aQ as SearchResult, aP as SearchResultItem, aO as SearchResultType, ag as SelectedOptionsResult, aW as ShippingMethodsContext, aT as SiteInfo, S as SpendMoneyType, T as TieredDiscount, U as UpdateCartAttributesInput, bf as UseAddPlusMemberProductsToCartProps, aG as UseAllBlogsOptions, aA as UseAllCollectionsOptions, aj as UseAllProductsOptions, aI as UseArticleOptions, aM as UseArticlesInBlogOptions, aK as UseArticlesOptions, ba as UseAutoRemovePlusMemberInCartProps, aE as UseBlogOptions, i as UseBuyNowOptions, ay as UseCollectionOptions, aC as UseCollectionsOptions, bl as UseExposureOptions, bp as UseGeoLocationOptions, bc as UseHasPlusMemberInCartProps, bj as UseIntersectionOptions, ap as UsePriceOptions, aq as UsePriceResult, ah as UseProductOptions, al as UseProductsByHandlesOptions, p as UseScriptAutoFreeGiftResult, aR as UseSearchOptions, b0 as UseShippingMethodsOptions, b1 as UseShippingMethodsResult, aU as UseSiteOptions, V as VariantItem, aw as VariantMedia, av as VideoMedia, a6 as atobID, a7 as btoaID, ab as checkAttributesUpdateNeeded, bs as clearGeoLocationCache, _ as currencyCodeMapping, $ as defaultSWRMutationConfiguration, ae as formatFunctionAutoFreeGift, ad as formatScriptAutoFreeGift, br as getCachedGeoLocation, aa as getDiscountEnvAttributeValue, a8 as getMatchedMainProductSubTotal, a5 as getQuery, m as getReferralAttributes, ac as preCheck, a9 as safeParse, a as useAddCartLines, bg as useAddPlusMemberProductsToCart, aH as useAllBlogs, aB as useAllCollections, ak as useAllProducts, e as useApplyCartCodes, aJ as useArticle, aL as useArticles, aN as useArticlesInBlog, bb as useAutoRemovePlusMemberInCart, aF as useBlog, j as useBuyNow, k as useCalcAutoFreeGift, l as useCalcOrderDiscount, n as useCartAttributes, o as useCartItemQuantityLimit, az as useCollection, aD as useCollections, u as useCreateCart, bm as useExposure, bq as useGeoLocation, be as useHasPlusMemberInCart, bk as useIntersection, a$ as usePlusAnnualProductVariant, b9 as usePlusMemberCheckoutCustomAttributes, aZ as usePlusMemberContext, b5 as usePlusMemberDeliveryCodes, b6 as usePlusMemberItemCustomAttributes, a_ as usePlusMonthlyProductVariant, ar as usePrice, ai as useProduct, as as useProductUrl, am as useProductsByHandles, g as useRemoveCartCodes, c as useRemoveCartLines, b4 as useReplaceCartPlusMember, q as useScriptAutoFreeGift, aS as useSearch, af as useSelectedOptions, b3 as useShippingMethodAvailableCheck, b2 as useShippingMethods, aV as useSite, h as useUpdateCartAttributes, b as useUpdateCartLines, r as useUpdateLineCodeAmountAttributes, at as useUpdateVariantQuery, ao as useVariant, ax as useVariantMedia } from './index-BZ6WbAdZ.js';
5
+ export { a as AddToCartInput, A as AddToCartLineItem, B as BuyNowTrackConfig, h as DeliveryCustomData, i as DeliveryData, g as DeliveryOption, D as DeliveryPlusType, G as GtmParams, M as MailingAddress, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, e as PlusMemberSettingsMetafields, d as PlusMemberShippingMethodConfig, c as PlusMemberShippingMethodMetafields, f as SelectedPlusMemberProduct, S as ShippingMethodMode, U as UseAddToCartOptions, j as gaTrack, m as trackAddToCartFBQ, t as trackAddToCartGA, k as trackBeginCheckoutGA, n as trackBuyNowFBQ, l as trackBuyNowGA, u as useAddToCart } from './types-CICUnw0v.js';
6
6
  export { ShopifyConfig, clearLocalStorage, createShopifyClient, getLocalStorage, removeLocalStorage, setLocalStorage } from '@anker-in/shopify-sdk';
7
7
  import 'react';
8
8
  import 'react/jsx-runtime';