@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.
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +116 -110
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +114 -109
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/{index-BUWkkUdh.d.ts → index-BZ6WbAdZ.d.ts} +56 -103
- package/dist/{index-DenyuVGJ.d.mts → index-Bea95u2X.d.mts} +56 -103
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +139 -121
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +137 -120
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +2 -1
- package/dist/provider/index.d.ts +2 -1
- package/dist/provider/index.js +44 -27
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +44 -27
- package/dist/provider/index.mjs.map +1 -1
- package/dist/{types-CMA6_FML.d.mts → types-CICUnw0v.d.mts} +85 -76
- package/dist/{types-CMA6_FML.d.ts → types-CICUnw0v.d.ts} +85 -76
- package/package.json +5 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as swr_mutation from 'swr/mutation';
|
|
2
2
|
import { SWRMutationConfiguration } from 'swr/mutation';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
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
|
|
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
|
-
|
|
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
|
-
*
|
|
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,
|
|
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
|
|
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 {
|
|
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
|
|
4
|
-
import {
|
|
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
|
|
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
|
-
|
|
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
|
-
*
|
|
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,
|
|
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
|
|
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 {
|
|
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,
|
|
5
|
-
export { B as BuyNowTrackConfig,
|
|
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,
|
|
5
|
-
export { B as BuyNowTrackConfig,
|
|
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';
|