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

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,7 @@
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 { CartLineInput as CartLineInput$1, NormalizedCart, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
4
+ 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
5
  import Decimal from 'decimal.js';
6
6
  import * as swr from 'swr';
7
7
  import swr__default, { SWRConfiguration } from 'swr';
@@ -90,79 +90,6 @@ interface AddCartLinesInput {
90
90
  */
91
91
  declare function useAddCartLines(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'add-cart-lines', AddCartLinesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "add-cart-lines", AddCartLinesInput>;
92
92
 
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
93
  /**
167
94
  * Hook for updating cart line quantities
168
95
  *
@@ -307,17 +234,7 @@ interface BuyNowInput {
307
234
  product: HasMetafieldsIdentifier[];
308
235
  };
309
236
  /** 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
- }>;
237
+ lineItems: Array<AddToCartLineItem>;
321
238
  /** Discount codes to apply */
322
239
  discountCodes?: string[];
323
240
  /** Custom attributes for the cart */
@@ -340,8 +257,6 @@ interface BuyNowInput {
340
257
  interface UseBuyNowOptions {
341
258
  /** Enable tracking (GA and FBQ) */
342
259
  withTrack?: boolean;
343
- /** Brand name for tracking */
344
- brand?: string;
345
260
  }
346
261
  /**
347
262
  * Hook for buy now functionality
@@ -358,7 +273,6 @@ interface UseBuyNowOptions {
358
273
  * const { trigger, isMutating } = useBuyNow({
359
274
  * withTrack: true,
360
275
  * redirectToCheckout: true,
361
- * brand: 'Anker'
362
276
  * })
363
277
  *
364
278
  * await trigger({
@@ -373,7 +287,7 @@ interface UseBuyNowOptions {
373
287
  * })
374
288
  * ```
375
289
  */
376
- declare function useBuyNow({ withTrack, brand }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
290
+ declare function useBuyNow({ withTrack }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
377
291
 
378
292
  type AutoFreeGift = {
379
293
  currentTier: {
@@ -1933,4 +1847,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
1933
1847
  */
1934
1848
  declare function clearGeoLocationCache(cacheKey?: string): void;
1935
1849
 
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 };
1850
+ 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, getDiscountEnvAttributeValue 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_, isAttributesEqual as aa, safeParseJson 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 ExportCart as bA, type UseAutoRemovePlusMemberInCartProps as ba, useAutoRemovePlusMemberInCart as bb, type UseHasPlusMemberInCartProps as bc, type HasPlusMemberInCartResult as bd, useHasPlusMemberInCart as be, type PlusMemberProviderProps as bf, PlusMemberProvider as bg, type UseIntersectionOptions as bh, useIntersection as bi, type UseExposureOptions as bj, useExposure as bk, type GeoLocationData as bl, type LocaleMapping as bm, type UseGeoLocationOptions as bn, useGeoLocation as bo, getCachedGeoLocation as bp, clearGeoLocationCache as bq, type Attribute as br, type Discount as bs, type Image as bt, type Measurement as bu, type ExportSelectedOption as bv, type ExportProductVariant as bw, type ExportDiscountAllocations as bx, type ExportLineItem as by, type ExportDiscounts 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,7 @@
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 { CartLineInput as CartLineInput$1, NormalizedCart, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
4
+ 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
5
  import Decimal from 'decimal.js';
6
6
  import * as swr from 'swr';
7
7
  import swr__default, { SWRConfiguration } from 'swr';
@@ -90,79 +90,6 @@ interface AddCartLinesInput {
90
90
  */
91
91
  declare function useAddCartLines(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'add-cart-lines', AddCartLinesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "add-cart-lines", AddCartLinesInput>;
92
92
 
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
93
  /**
167
94
  * Hook for updating cart line quantities
168
95
  *
@@ -307,17 +234,7 @@ interface BuyNowInput {
307
234
  product: HasMetafieldsIdentifier[];
308
235
  };
309
236
  /** 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
- }>;
237
+ lineItems: Array<AddToCartLineItem>;
321
238
  /** Discount codes to apply */
322
239
  discountCodes?: string[];
323
240
  /** Custom attributes for the cart */
@@ -340,8 +257,6 @@ interface BuyNowInput {
340
257
  interface UseBuyNowOptions {
341
258
  /** Enable tracking (GA and FBQ) */
342
259
  withTrack?: boolean;
343
- /** Brand name for tracking */
344
- brand?: string;
345
260
  }
346
261
  /**
347
262
  * Hook for buy now functionality
@@ -358,7 +273,6 @@ interface UseBuyNowOptions {
358
273
  * const { trigger, isMutating } = useBuyNow({
359
274
  * withTrack: true,
360
275
  * redirectToCheckout: true,
361
- * brand: 'Anker'
362
276
  * })
363
277
  *
364
278
  * await trigger({
@@ -373,7 +287,7 @@ interface UseBuyNowOptions {
373
287
  * })
374
288
  * ```
375
289
  */
376
- declare function useBuyNow({ withTrack, brand }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
290
+ declare function useBuyNow({ withTrack }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
377
291
 
378
292
  type AutoFreeGift = {
379
293
  currentTier: {
@@ -1933,4 +1847,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
1933
1847
  */
1934
1848
  declare function clearGeoLocationCache(cacheKey?: string): void;
1935
1849
 
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 };
1850
+ 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, getDiscountEnvAttributeValue 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_, isAttributesEqual as aa, safeParseJson 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 ExportCart as bA, type UseAutoRemovePlusMemberInCartProps as ba, useAutoRemovePlusMemberInCart as bb, type UseHasPlusMemberInCartProps as bc, type HasPlusMemberInCartResult as bd, useHasPlusMemberInCart as be, type PlusMemberProviderProps as bf, PlusMemberProvider as bg, type UseIntersectionOptions as bh, useIntersection as bi, type UseExposureOptions as bj, useExposure as bk, type GeoLocationData as bl, type LocaleMapping as bm, type UseGeoLocationOptions as bn, useGeoLocation as bo, getCachedGeoLocation as bp, clearGeoLocationCache as bq, type Attribute as br, type Discount as bs, type Image as bt, type Measurement as bu, type ExportSelectedOption as bv, type ExportProductVariant as bw, type ExportDiscountAllocations as bx, type ExportLineItem as by, type ExportDiscounts 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, br 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, bs as Discount, D as DiscountLabel, bA as ExportCart, bx as ExportDiscountAllocations, bz as ExportDiscounts, by as ExportLineItem, bw as ExportProductVariant, bv as ExportSelectedOption, J as FormattedGift, I as FunctionGiftResult, bl as GeoLocationData, G as GiftProduct, E as GiftProductItem, y as GiftTier, bd as HasPlusMemberInCartResult, bt as Image, au as ImageMedia, bm as LocaleMapping, a4 as MAIN_PRODUCT_CODE, M as MainProductInfo, bu as Measurement, an as Options, Q as OrderBasePriceType, W as OrderDiscountConfig, O as OrderDiscountResult, P as OrderDiscountType, aY as PlusMemberContext, aX as PlusMemberContextValue, bg as PlusMemberProvider, bf 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, 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, bj as UseExposureOptions, bn as UseGeoLocationOptions, bc as UseHasPlusMemberInCartProps, bh 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, bq as clearGeoLocationCache, _ as currencyCodeMapping, $ as defaultSWRMutationConfiguration, ae as formatFunctionAutoFreeGift, ad as formatScriptAutoFreeGift, bp as getCachedGeoLocation, a9 as getDiscountEnvAttributeValue, a8 as getMatchedMainProductSubTotal, a5 as getQuery, m as getReferralAttributes, aa as isAttributesEqual, ac as preCheck, ab as safeParseJson, a as useAddCartLines, 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, bk as useExposure, bo as useGeoLocation, be as useHasPlusMemberInCart, bi 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-RevQokdZ.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, br 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, bs as Discount, D as DiscountLabel, bA as ExportCart, bx as ExportDiscountAllocations, bz as ExportDiscounts, by as ExportLineItem, bw as ExportProductVariant, bv as ExportSelectedOption, J as FormattedGift, I as FunctionGiftResult, bl as GeoLocationData, G as GiftProduct, E as GiftProductItem, y as GiftTier, bd as HasPlusMemberInCartResult, bt as Image, au as ImageMedia, bm as LocaleMapping, a4 as MAIN_PRODUCT_CODE, M as MainProductInfo, bu as Measurement, an as Options, Q as OrderBasePriceType, W as OrderDiscountConfig, O as OrderDiscountResult, P as OrderDiscountType, aY as PlusMemberContext, aX as PlusMemberContextValue, bg as PlusMemberProvider, bf 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, 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, bj as UseExposureOptions, bn as UseGeoLocationOptions, bc as UseHasPlusMemberInCartProps, bh 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, bq as clearGeoLocationCache, _ as currencyCodeMapping, $ as defaultSWRMutationConfiguration, ae as formatFunctionAutoFreeGift, ad as formatScriptAutoFreeGift, bp as getCachedGeoLocation, a9 as getDiscountEnvAttributeValue, a8 as getMatchedMainProductSubTotal, a5 as getQuery, m as getReferralAttributes, aa as isAttributesEqual, ac as preCheck, ab as safeParseJson, a as useAddCartLines, 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, bk as useExposure, bo as useGeoLocation, be as useHasPlusMemberInCart, bi 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-CCMIeIUh.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';
package/dist/index.js CHANGED
@@ -667,8 +667,6 @@ function useAddCartLines(options) {
667
667
  );
668
668
  return useSWRMutation__default.default("add-cart-lines", addLines, options);
669
669
  }
670
-
671
- // src/tracking/ga.ts
672
670
  var gaTrack = (data) => {
673
671
  if (typeof window === "undefined") {
674
672
  return;
@@ -686,18 +684,15 @@ var gaTrack = (data) => {
686
684
  };
687
685
  var trackAddToCartGA = ({
688
686
  lineItems = [],
689
- gtmParams = {},
690
- brand
687
+ gtmParams = {}
691
688
  }) => {
692
689
  if (!lineItems.length || !lineItems[0]?.variant) {
693
690
  return;
694
691
  }
695
692
  const { variant } = lineItems[0];
696
- const currencyCode = variant?.price?.currencyCode;
697
- const totalPrice = lineItems.reduce((sum, item) => {
698
- const price = parseFloat(item.variant?.price?.amount || "0");
699
- return sum + price;
700
- }, 0);
693
+ const currencyCode = variant.product?.price?.currencyCode;
694
+ const price = variant.compareAtPrice?.amount ?? (variant.price?.amount || 0);
695
+ const totalPrice = lineItems?.reduce((prev, { variant: variant2 }) => prev.plus(variant2?.finalPrice?.amount ?? price), new Decimal2__default.default(0)).toNumber();
701
696
  gaTrack({
702
697
  event: "ga4Event",
703
698
  event_name: "add_to_cart",
@@ -708,11 +703,11 @@ var trackAddToCartGA = ({
708
703
  position: gtmParams?.position || "",
709
704
  items: lineItems.map(({ variant: variant2, quantity }) => ({
710
705
  item_id: variant2?.sku,
711
- item_name: variant2?.product?.title || variant2?.product?.name,
712
- item_brand: brand || gtmParams?.brand || "",
706
+ item_name: variant2?.product?.title || variant2?.product?.title,
707
+ item_brand: gtmParams?.brand || "",
713
708
  item_category: variant2?.product?.productType || "",
714
- item_variant: variant2?.title || variant2?.name,
715
- price: variant2?.finalPrice?.amount ?? variant2?.price?.amount,
709
+ item_variant: variant2?.title || variant2?.title,
710
+ price,
716
711
  quantity: quantity || 1
717
712
  })),
718
713
  ...gtmParams?.ga4Params
@@ -722,13 +717,14 @@ var trackAddToCartGA = ({
722
717
  var trackBeginCheckoutGA = ({
723
718
  lineItems = [],
724
719
  currencyCode,
725
- totalPrice,
726
- gtmParams = {},
727
- brand
720
+ gtmParams = {}
728
721
  }) => {
729
722
  if (!lineItems.length) {
730
723
  return;
731
724
  }
725
+ const { variant } = lineItems[0] || {};
726
+ const price = variant?.compareAtPrice?.amount ?? (variant?.price?.amount || 0);
727
+ const totalPrice = lineItems?.reduce((prev, { variant: variant2 }) => prev.plus(variant2?.finalPrice?.amount ?? price), new Decimal2__default.default(0)).toNumber();
732
728
  gaTrack({
733
729
  event: "ga4Event",
734
730
  event_name: "begin_checkout",
@@ -740,10 +736,10 @@ var trackBeginCheckoutGA = ({
740
736
  items: lineItems.map((item) => ({
741
737
  item_id: item.variant?.sku,
742
738
  item_name: item.variant?.product?.title,
743
- item_brand: brand || gtmParams?.brand || "",
739
+ item_brand: gtmParams?.brand || "",
744
740
  item_category: item.variant?.product?.productType,
745
741
  item_variant: item.variant?.title,
746
- price: item.finalPrice?.amount || item.variant?.price?.amount,
742
+ price,
747
743
  quantity: item.quantity || 1
748
744
  })),
749
745
  ...gtmParams?.ga4Params
@@ -752,19 +748,15 @@ var trackBeginCheckoutGA = ({
752
748
  };
753
749
  var trackBuyNowGA = ({
754
750
  lineItems = [],
755
- gtmParams = {},
756
- brand
751
+ gtmParams = {}
757
752
  }) => {
758
753
  if (!lineItems.length || !lineItems[0]?.variant) {
759
754
  return;
760
755
  }
761
756
  const { variant } = lineItems[0];
762
757
  const currencyCode = variant.price?.currencyCode;
763
- const totalPrice = lineItems.reduce((sum, item) => {
764
- const price = parseFloat(item.finalPrice?.amount || item.variant?.price?.amount || "0");
765
- const quantity = item.quantity || 1;
766
- return sum + price * quantity;
767
- }, 0);
758
+ const price = variant.compareAtPrice?.amount ?? (variant.price?.amount || 0);
759
+ const totalPrice = lineItems?.reduce((prev, { variant: variant2 }) => prev.plus(variant2?.finalPrice?.amount ?? price), new Decimal2__default.default(0)).toNumber();
768
760
  gaTrack({
769
761
  event: "ga4Event",
770
762
  event_name: "begin_checkout",
@@ -776,10 +768,10 @@ var trackBuyNowGA = ({
776
768
  items: lineItems.map((item) => ({
777
769
  item_id: item.variant?.sku,
778
770
  item_name: item.variant?.product?.title || item.variant?.title,
779
- item_brand: item.variant?.product?.vendor || brand || gtmParams?.brand || "",
771
+ item_brand: gtmParams?.brand || "",
780
772
  item_category: item.variant?.product?.productType || "",
781
773
  item_variant: item.variant?.title,
782
- price: item.finalPrice?.amount || item.variant?.price?.amount,
774
+ price,
783
775
  quantity: item.quantity || 1
784
776
  })),
785
777
  ...gtmParams?.ga4Params
@@ -793,10 +785,10 @@ var trackAddToCartFBQ = ({ lineItems = [] }) => {
793
785
  return;
794
786
  }
795
787
  if (lineItems.length && lineItems[0]?.variant) {
796
- const { variant, quantity, finalPrice } = lineItems[0];
788
+ const { variant, quantity } = lineItems[0];
797
789
  try {
798
790
  window.fbq("track", "AddToCart", {
799
- value: finalPrice?.amount || variant?.price?.amount,
791
+ value: variant?.compareAtPrice?.amount ?? (variant?.price?.amount || variant?.price || 0),
800
792
  num_items: quantity,
801
793
  currency: variant?.price?.currencyCode,
802
794
  content_name: variant?.product?.title,
@@ -883,9 +875,9 @@ function useRemoveCartCodes(options) {
883
875
  }
884
876
 
885
877
  // src/hooks/cart/use-add-to-cart.ts
886
- function useAddToCart({ withTrack = true, brand } = {}, swrOptions) {
887
- const { client, locale, cartCookieAdapter, userAdapter } = useShopify();
888
- const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
878
+ function useAddToCart({ withTrack = true } = {}, swrOptions) {
879
+ const { client, config, locale, cartCookieAdapter, userAdapter } = useShopify();
880
+ const { cart } = useCartContext();
889
881
  const { trigger: applyCartCodes } = useApplyCartCodes();
890
882
  const { trigger: removeInvalidCodes } = useRemoveCartCodes();
891
883
  const { trigger: addCartLines2 } = useAddCartLines();
@@ -907,7 +899,8 @@ function useAddToCart({ withTrack = true, brand } = {}, swrOptions) {
907
899
  const lines = lineItems.map((item) => ({
908
900
  merchandiseId: item.variant?.id || "",
909
901
  quantity: item.quantity || 1,
910
- attributes: item.attributes
902
+ attributes: item.attributes,
903
+ sellingPlanId: item.sellingPlanId
911
904
  })).filter((item) => item.merchandiseId && item.quantity);
912
905
  if (lines.length === 0) {
913
906
  return;
@@ -942,34 +935,16 @@ function useAddToCart({ withTrack = true, brand } = {}, swrOptions) {
942
935
  discountCodes
943
936
  });
944
937
  }
945
- if (withTrack && resultCart.lineItems) {
946
- const trackingLineItems = resultCart.lineItems.map((line) => ({
947
- variant: {
948
- id: line.variant.id,
949
- sku: line.variant.sku || "",
950
- title: line.variant.name,
951
- price: {
952
- amount: String(line.variant.price),
953
- currencyCode: resultCart.currency.code
954
- },
955
- product: line.product ? {
956
- title: line.product.title || line.name,
957
- productType: line.product.productType,
958
- vendor: line.product.vendor
959
- } : void 0
960
- },
961
- quantity: line.quantity
962
- }));
938
+ if (withTrack) {
963
939
  trackAddToCartGA({
964
- lineItems: trackingLineItems,
965
- gtmParams: { ...gtmParams, brand },
966
- brand
940
+ lineItems,
941
+ gtmParams: { ...gtmParams, brand: config.getBrand() }
967
942
  });
968
- trackAddToCartFBQ({ lineItems: trackingLineItems });
943
+ trackAddToCartFBQ({ lineItems });
969
944
  }
970
945
  return resultCart;
971
946
  },
972
- [client, locale, cartCookieAdapter, userAdapter, cart, withTrack, brand]
947
+ [client, locale, cartCookieAdapter, userAdapter, cart, withTrack]
973
948
  );
974
949
  return useSWRMutation__default.default("add-to-cart", addToCart, swrOptions);
975
950
  }
@@ -1050,8 +1025,8 @@ function useUpdateCartAttributes(mutate, metafieldIdentifiers, options) {
1050
1025
  );
1051
1026
  return useSWRMutation__default.default("update-cart-attributes", updateAttributes, options);
1052
1027
  }
1053
- function useBuyNow({ withTrack = true, brand } = {}, swrOptions) {
1054
- const { client, locale, cartCookieAdapter, userAdapter } = useShopify();
1028
+ function useBuyNow({ withTrack = true } = {}, swrOptions) {
1029
+ const { client, config, locale, cartCookieAdapter, userAdapter } = useShopify();
1055
1030
  const isLoggedIn = userAdapter?.isLoggedIn || false;
1056
1031
  const buyNow = react.useCallback(
1057
1032
  async (_key, { arg }) => {
@@ -1069,9 +1044,10 @@ function useBuyNow({ withTrack = true, brand } = {}, swrOptions) {
1069
1044
  return;
1070
1045
  }
1071
1046
  const lines = lineItems.map((item) => ({
1072
- merchandiseId: item.variant?.id || item.variantId || "",
1047
+ merchandiseId: item.variant?.id || "",
1073
1048
  quantity: item.quantity || 1,
1074
- attributes: item.attributes
1049
+ attributes: item.attributes,
1050
+ sellingPlanId: item.sellingPlanId
1075
1051
  })).filter((item) => item.merchandiseId && item.quantity);
1076
1052
  if (lines.length === 0) {
1077
1053
  return;
@@ -1088,27 +1064,9 @@ function useBuyNow({ withTrack = true, brand } = {}, swrOptions) {
1088
1064
  throw new Error("Failed to create cart for buy now");
1089
1065
  }
1090
1066
  if (withTrack && resultCart.lineItems) {
1091
- const trackingLineItems = resultCart.lineItems.map((line) => ({
1092
- variant: {
1093
- id: line.variantId,
1094
- sku: line.variant.sku || "",
1095
- title: line.variant.name,
1096
- price: {
1097
- amount: String(line.variant.price),
1098
- currencyCode: resultCart.currency.code
1099
- },
1100
- product: line.product ? {
1101
- title: line.product.title || line.name,
1102
- productType: line.product.productType,
1103
- vendor: line.product.vendor
1104
- } : void 0
1105
- },
1106
- quantity: line.quantity
1107
- }));
1108
1067
  trackBuyNowGA({
1109
- lineItems: trackingLineItems,
1110
- gtmParams: { ...gtmParams, brand },
1111
- brand
1068
+ lineItems,
1069
+ gtmParams: { ...gtmParams, brand: config.getBrand() }
1112
1070
  });
1113
1071
  if (fbqTrackConfig) {
1114
1072
  trackBuyNowFBQ({ trackConfig: fbqTrackConfig });
@@ -1125,7 +1083,7 @@ function useBuyNow({ withTrack = true, brand } = {}, swrOptions) {
1125
1083
  }
1126
1084
  return resultCart;
1127
1085
  },
1128
- [client, locale, isLoggedIn, cartCookieAdapter, withTrack, brand]
1086
+ [client, locale, isLoggedIn, cartCookieAdapter, withTrack]
1129
1087
  );
1130
1088
  return useSWRMutation__default.default("buy-now", buyNow, swrOptions);
1131
1089
  }