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

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,1889 +0,0 @@
1
- import * as swr_mutation from 'swr/mutation';
2
- import { SWRMutationConfiguration } from 'swr/mutation';
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';
6
- import Decimal from 'decimal.js';
7
- import * as swr from 'swr';
8
- import swr__default, { SWRConfiguration } from 'swr';
9
- import * as swr__internal from 'swr/_internal';
10
- import * as React$1 from 'react';
11
- import { PropsWithChildren, Dispatch, SetStateAction, RefObject } from 'react';
12
- import * as react_jsx_runtime from 'react/jsx-runtime';
13
-
14
- interface CreateCartInput {
15
- /** Lines to add to the cart */
16
- lines?: CartLineInput$1[];
17
- /** Buyer identity for cart creation */
18
- buyerIdentity?: {
19
- email?: string;
20
- countryCode?: string;
21
- };
22
- /** Discount codes */
23
- discountCodes?: string[];
24
- /** Custom attributes */
25
- customAttributes?: Array<{
26
- key: string;
27
- value: string;
28
- }>;
29
- }
30
- /**
31
- * Hook for creating a new cart
32
- *
33
- * Automatically removes invalid discount codes after creating cart
34
- *
35
- * @param options - SWR mutation configuration
36
- * @returns SWR mutation with trigger function
37
- *
38
- * @example
39
- * ```tsx
40
- * const { trigger, isMutating } = useCreateCart()
41
- *
42
- * // Create empty cart
43
- * await trigger({})
44
- *
45
- * // Create cart with items
46
- * await trigger({
47
- * lines: [{
48
- * merchandiseId: 'gid://shopify/ProductVariant/123',
49
- * quantity: 1
50
- * }],
51
- * buyerIdentity: {
52
- * email: 'customer@example.com',
53
- * countryCode: 'US'
54
- * },
55
- * discountCodes: ['SUMMER2024']
56
- * })
57
- * ```
58
- */
59
- declare function useCreateCart(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'create-cart', CreateCartInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "create-cart", CreateCartInput>;
60
-
61
- interface AddCartLinesInput {
62
- /** Cart ID (optional, will use cookie or create new cart) */
63
- cartId?: string;
64
- /** Lines to add */
65
- lines: CartLineInput$1[];
66
- /** Buyer identity for new cart */
67
- buyerIdentity?: {
68
- email?: string;
69
- countryCode?: string;
70
- };
71
- }
72
- /**
73
- * Hook for adding lines to cart
74
- *
75
- * Automatically removes invalid discount codes after adding items
76
- *
77
- * @param options - SWR mutation configuration
78
- * @returns SWR mutation with trigger function
79
- *
80
- * @example
81
- * ```tsx
82
- * const { trigger, isMutating } = useAddCartLines()
83
- *
84
- * await trigger({
85
- * lines: [{
86
- * merchandiseId: 'gid://shopify/ProductVariant/123',
87
- * quantity: 1
88
- * }]
89
- * })
90
- * ```
91
- */
92
- declare function useAddCartLines(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'add-cart-lines', AddCartLinesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "add-cart-lines", AddCartLinesInput>;
93
-
94
- /**
95
- * Hook for updating cart line quantities
96
- *
97
- * @param options - SWR mutation configuration
98
- * @returns SWR mutation with trigger function
99
- *
100
- * @example
101
- * ```tsx
102
- * const { trigger, isMutating } = useUpdateCartLines()
103
- *
104
- * await trigger({
105
- * lines: [{
106
- * id: 'gid://shopify/CartLine/123',
107
- * quantity: 2
108
- * }]
109
- * })
110
- * ```
111
- */
112
- declare function useUpdateCartLines(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'update-cart-lines', UpdateCartLinesOptions>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "update-cart-lines", UpdateCartLinesOptions>;
113
-
114
- interface RemoveCartLinesInput {
115
- /** Cart ID (optional, will use cookie) */
116
- cartId?: string;
117
- /** Line IDs to remove */
118
- lineIds: string[];
119
- /** Whether to automatically remove invalid discount codes (default: true) */
120
- autoRemoveInvalidCodes?: boolean;
121
- /** Callback when discount codes are removed */
122
- onCodesRemoved?: (updatedCart: NormalizedCart, removedCodes: string[]) => Promise<NormalizedCart | undefined>;
123
- }
124
- /**
125
- * Hook for removing lines from cart
126
- *
127
- * Automatically removes invalid discount codes after removing items
128
- *
129
- * @param options - SWR mutation configuration
130
- * @returns SWR mutation with trigger function
131
- *
132
- * @example
133
- * ```tsx
134
- * const { trigger, isMutating } = useRemoveCartLines()
135
- *
136
- * await trigger({
137
- * lineIds: ['gid://shopify/CartLine/123']
138
- * })
139
- * ```
140
- */
141
- declare function useRemoveCartLines(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'remove-cart-lines', RemoveCartLinesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "remove-cart-lines", RemoveCartLinesInput>;
142
-
143
- interface ApplyCartCodesInput {
144
- /** Cart ID (required) */
145
- cartId?: string;
146
- /** Discount codes to apply (added to existing applicable codes) */
147
- discountCodes: string[];
148
- /** Replace existing applicable codes */
149
- replaceExistingCodes?: boolean;
150
- }
151
- /**
152
- * Hook for applying discount codes to cart
153
- *
154
- * Merges new codes with existing applicable codes and validates them
155
- *
156
- * @param options - SWR mutation configuration
157
- * @returns SWR mutation with trigger function
158
- *
159
- * @example
160
- * ```tsx
161
- * const { trigger, isMutating, error } = useApplyCartCodes()
162
- *
163
- * try {
164
- * await trigger({
165
- * cartId: 'gid://shopify/Cart/123',
166
- * discountCodes: ['SUMMER2024']
167
- * })
168
- * } catch (error) {
169
- * // Handle unapplicable codes
170
- * }
171
- * ```
172
- */
173
- declare function useApplyCartCodes(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'apply-codes', ApplyCartCodesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "apply-codes", ApplyCartCodesInput>;
174
-
175
- interface RemoveCartCodesInput {
176
- /** Cart ID (required) */
177
- cartId?: string;
178
- /** Discount codes to remove */
179
- discountCodes: string[];
180
- }
181
- /**
182
- * Hook for removing discount codes from cart
183
- *
184
- * @param options - SWR mutation configuration
185
- * @returns SWR mutation with trigger function
186
- *
187
- * @example
188
- * ```tsx
189
- * const { trigger, isMutating } = useRemoveCartCodes()
190
- *
191
- * await trigger({
192
- * cartId: 'gid://shopify/Cart/123',
193
- * discountCodes: ['EXPIRED_CODE']
194
- * })
195
- * ```
196
- */
197
- declare function useRemoveCartCodes(options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'remove-codes', RemoveCartCodesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "remove-codes", RemoveCartCodesInput>;
198
-
199
- interface UpdateCartAttributesInput {
200
- /** Cart ID (optional, will use cookie) */
201
- cartId?: string;
202
- /** Custom attributes to set on cart */
203
- attributes: Array<{
204
- key: string;
205
- value: string;
206
- }>;
207
- }
208
- /**
209
- * Hook for updating cart attributes (custom key-value pairs)
210
- *
211
- * @param options - SWR mutation configuration
212
- * @returns SWR mutation with trigger function
213
- *
214
- * @example
215
- * ```tsx
216
- * const { trigger, isMutating } = useUpdateCartAttributes()
217
- *
218
- * await trigger({
219
- * attributes: [
220
- * { key: 'gift_message', value: 'Happy Birthday!' },
221
- * { key: 'gift_wrap', value: 'true' }
222
- * ]
223
- * })
224
- * ```
225
- */
226
- declare function useUpdateCartAttributes(mutate: (cart: NormalizedCart | undefined) => void, metafieldIdentifiers?: {
227
- variant: HasMetafieldsIdentifier[];
228
- product: HasMetafieldsIdentifier[];
229
- }, options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'update-cart-attributes', UpdateCartAttributesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "update-cart-attributes", UpdateCartAttributesInput>;
230
-
231
- interface BuyNowInput {
232
- /** Metafield identifiers */
233
- metafieldIdentifiers?: {
234
- variant: HasMetafieldsIdentifier[];
235
- product: HasMetafieldsIdentifier[];
236
- };
237
- /** Line items to add to the new cart */
238
- lineItems: Array<AddToCartLineItem>;
239
- /** Discount codes to apply */
240
- discountCodes?: string[];
241
- /** Custom attributes for the cart */
242
- customAttributes?: Array<{
243
- key: string;
244
- value: string;
245
- }>;
246
- /** Buyer identity */
247
- buyerIdentity?: {
248
- email?: string;
249
- countryCode?: string;
250
- };
251
- /** GTM tracking parameters */
252
- gtmParams?: Omit<GtmParams, 'brand'>;
253
- /** Facebook Pixel tracking configuration */
254
- fbqTrackConfig?: BuyNowTrackConfig;
255
- /** Whether to redirect to checkout page (default: true) */
256
- redirectToCheckout?: boolean;
257
- }
258
- interface UseBuyNowOptions {
259
- /** Enable tracking (GA and FBQ) */
260
- withTrack?: boolean;
261
- }
262
- /**
263
- * Hook for buy now functionality
264
- *
265
- * Creates a new cart with the specified items and redirects to checkout.
266
- * Includes automatic tracking for GA4 and Facebook Pixel.
267
- *
268
- * @param options - Hook configuration
269
- * @param swrOptions - SWR mutation configuration
270
- * @returns SWR mutation with trigger function
271
- *
272
- * @example
273
- * ```tsx
274
- * const { trigger, isMutating } = useBuyNow({
275
- * withTrack: true,
276
- * redirectToCheckout: true,
277
- * })
278
- *
279
- * await trigger({
280
- * lineItems: [{
281
- * variantId: 'gid://shopify/ProductVariant/123',
282
- * quantity: 1
283
- * }],
284
- * gtmParams: {
285
- * pageGroup: 'PDP',
286
- * position: 'Buy Now Button'
287
- * }
288
- * })
289
- * ```
290
- */
291
- declare function useBuyNow({ withTrack }?: UseBuyNowOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, BuyNowInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, BuyNowInput>;
292
-
293
- type AutoFreeGift = {
294
- currentTier: {
295
- amount: number;
296
- gift?: NormalizedProductVariant;
297
- };
298
- nextTierGoal: {
299
- amount: number;
300
- gift?: NormalizedProductVariant;
301
- };
302
- };
303
- type DiscountLabel = {
304
- cart_checkout_label: string;
305
- product_label: string;
306
- sold_out_label: string;
307
- };
308
- type AutoFreeGiftMainProduct = {
309
- spend_money_type: number;
310
- variant_id_list: string[];
311
- all_store_variant: boolean;
312
- };
313
- type GiftProduct = {
314
- spend_sum_money: number;
315
- gift_type: number;
316
- reward_list: {
317
- get_unit: number;
318
- variant_id: string;
319
- bak_variant_id_list: null;
320
- }[];
321
- };
322
- type AutoFreeGiftConfig = Config[];
323
- type RuleCondition = {
324
- with_special_url_params: string[];
325
- without_special_url_params: string[];
326
- with_user_tags: string[];
327
- without_user_tags: string[];
328
- };
329
- type MainProductInfo = {
330
- spend_money_type: SpendMoneyType;
331
- variant_list: VariantItem[];
332
- all_store_variant: boolean;
333
- };
334
- type Config = {
335
- rule_id: number;
336
- rule_type: RuleType;
337
- discount_label: {
338
- cart_checkout_label: string;
339
- product_label: string;
340
- sold_out_label: string;
341
- };
342
- frontend_labels: {
343
- key: string;
344
- label: string;
345
- desc: string;
346
- }[];
347
- apply_unit: number;
348
- rule_result: {
349
- buy_rule_type: BuyRuleType;
350
- spend_get_reward: {
351
- main_product: MainProductInfo;
352
- gift_product: GiftProductItem[];
353
- };
354
- buy_get_reward: {
355
- main_product: MainProductInfo;
356
- gift_product: GiftProductItem[] | null;
357
- };
358
- };
359
- rule_conditions?: RuleCondition[];
360
- };
361
- interface GiftTier {
362
- spend_sum_money: number;
363
- gift_type: number;
364
- reward_list: RewardItem[];
365
- }
366
- interface RewardItem {
367
- get_unit: number;
368
- variant_list: VariantItem[];
369
- }
370
- interface VariantItem {
371
- variant_id: string;
372
- sku: string;
373
- handle: string;
374
- discount_value: number;
375
- }
376
- interface GiftProductItem {
377
- spend_sum_money: number;
378
- gift_type: number;
379
- reward_list: RewardItem[];
380
- }
381
- declare enum RuleType {
382
- AUTO_FREE_GIFT = 1,// 自动赠品
383
- BUNDLE = 2,// 组合
384
- VOLUME_DISCOUNT = 3,// 量价折扣
385
- ORDER_DISCOUNT = 4,// 订单折扣
386
- PRICE_DISCOUNT = 5
387
- }
388
- declare enum BuyRuleType {
389
- BUY_GET_GIFT = 1,// 买赠
390
- SPEND_GET_GIFT = 2
391
- }
392
- declare enum SpendMoneyType {
393
- ORIGIN_PRICE = 1,// 原价
394
- DISCOUNT_PRICE = 2
395
- }
396
- interface FunctionGiftResult {
397
- qualifyingGift: FormattedGift | null;
398
- nextTierGoal: GiftTier | null;
399
- activeCampaign: Config | null;
400
- isLoading: boolean;
401
- giftProductsResult?: NormalizedProduct[] | [];
402
- }
403
- interface FormattedGift {
404
- tier: GiftTier;
405
- itemsToAdd: CartLineInput[];
406
- }
407
- interface CartLineInput {
408
- variant: {
409
- id: string;
410
- handle: string;
411
- sku: string;
412
- };
413
- quantity: number;
414
- attributes: {
415
- key: string;
416
- value: string;
417
- }[];
418
- }
419
- type AutoFreeGiftItem = {
420
- line: NormalizedLineItem;
421
- isSoldOut: boolean;
422
- };
423
- type AutoFreeGiftList = AutoFreeGiftItem[] | [];
424
-
425
- /**
426
- * [计算型 Hook]
427
- * 根据购物车、活动配置和用户信息,计算出应得的赠品和下一个目标。
428
- * 此 Hook 不产生任何副作用。
429
- * 使用示例:
430
- * const { qualifyingGift, nextTierGoal, activeCampaign, isLoading } = useCalcAutoFreeGift(cart, autoFreeGiftConfig);
431
- */
432
- declare const useCalcAutoFreeGift: (cart: any, autoFreeGiftConfig: AutoFreeGiftConfig, customer: any) => FunctionGiftResult;
433
-
434
- declare enum OrderDiscountType {
435
- PERCENTAGE = 1,// 百分比折扣
436
- FIXED_AMOUNT = 2,// 固定金额折扣
437
- REDUCE_PRICE = 3
438
- }
439
- declare enum OrderBasePriceType {
440
- ORIGIN_PRICE = 1,// 原价
441
- MIN_DISCOUNTED_PRICE = 2
442
- }
443
- type TieredDiscount = {
444
- amount: number;
445
- discount: number;
446
- discount_type: OrderDiscountType;
447
- };
448
- type OrderDiscountConfig = {
449
- rule_id: number;
450
- rule_type: number;
451
- rule_conditions?: RuleCondition[];
452
- result_detail: {
453
- main_product: {
454
- variant_list: Array<{
455
- variant_id: string;
456
- sku: string;
457
- handle: string;
458
- }>;
459
- all_store_variant: boolean;
460
- };
461
- order_discount_conf: {
462
- base_price: OrderBasePriceType;
463
- tiered_discounts: TieredDiscount[];
464
- };
465
- };
466
- };
467
-
468
- interface OrderDiscountResult {
469
- qualifyingDiscount: TieredDiscount | null;
470
- nextTierGoal: TieredDiscount | null;
471
- activeCampaign: OrderDiscountConfig | null;
472
- discountAmount: number;
473
- cartTotalForDiscount: number;
474
- isLoading: boolean;
475
- }
476
- /**
477
- * [计算型 Hook]
478
- * 根据购物车、活动配置和用户信息,计算出应得的订单折扣和下一个目标。
479
- * 此 Hook 不产生任何副作用。
480
- * 使用示例:
481
- * const { qualifyingDiscount, nextTierGoal, activeCampaign, discountAmount, isLoading } = useCalcOrderDiscount(cart, orderDiscountConfig);
482
- * @param cart - 购物车
483
- * @param orderDiscountConfig - 订单折扣配置
484
- * @returns { OrderDiscountResult }
485
- */
486
- declare const useCalcOrderDiscount: (cart: any, orderDiscountConfig: OrderDiscountConfig[], customer: any) => OrderDiscountResult;
487
-
488
- interface ShippingMethodsContext {
489
- freeShippingMethods: PlusMemberShippingMethodConfig[];
490
- paymentShippingMethods: PlusMemberShippingMethodConfig[];
491
- nddOverweight: boolean;
492
- tddOverweight: boolean;
493
- }
494
- interface PlusMemberContextValue<TProduct = any, TVariant = any, TProfile = any> {
495
- plusMemberMetafields: PlusMemberSettingsMetafields;
496
- shopCommon?: Record<string, any>;
497
- zipCode: string;
498
- setZipCode: (value: string) => void;
499
- allowNextDayDelivery: boolean;
500
- setAllowNextDayDelivery: (value: boolean) => void;
501
- allowThirdDayDelivery: boolean;
502
- setAllowThirdDayDelivery: (value: boolean) => void;
503
- selectedPlusMemberMode: DeliveryPlusType;
504
- setSelectedPlusMemberMode: (value: DeliveryPlusType) => void;
505
- showAreaCheckModal: boolean;
506
- setShowAreaCheckModal: (value: boolean) => void;
507
- selectedShippingMethod?: PlusMemberShippingMethodConfig;
508
- setSelectedShippingMethod: (value: PlusMemberShippingMethodConfig) => void;
509
- showTip: boolean;
510
- setShowTip: (value: boolean) => void;
511
- showMoreShippingMethod: boolean;
512
- setShowMoreShippingMethod: (value: boolean) => void;
513
- variant: TVariant;
514
- product: TProduct;
515
- shippingMethodsContext: ShippingMethodsContext;
516
- selectedPlusMemberProduct: SelectedPlusMemberProduct;
517
- plusMemberProducts: NormalizedProduct[];
518
- showPlusMemberBenefit: boolean;
519
- setShowPlusMemberBenefit: (value: boolean) => void;
520
- deleteMarginBottom: boolean;
521
- setDeleteMarginBottom: (value: boolean) => void;
522
- profile?: TProfile;
523
- locale?: string;
524
- }
525
- declare const PlusMemberContext: React$1.Context<PlusMemberContextValue<any, any, any>>;
526
-
527
- /**
528
- * Hook to access Plus Member Context
529
- */
530
- declare function usePlusMemberContext<TProduct = any, TVariant = any>(): PlusMemberContextValue<any, any, any>;
531
-
532
- /**
533
- * Hook to get Plus Monthly Product Variant
534
- */
535
- declare function usePlusMonthlyProductVariant<TVariant = any>(): TVariant | undefined;
536
-
537
- /**
538
- * Hook to get Plus Annual Product Variant
539
- */
540
- declare function usePlusAnnualProductVariant<TVariant = any>(): TVariant | undefined;
541
-
542
- /**
543
- * Hook to calculate available shipping methods based on product weight and member status
544
- */
545
-
546
- interface UseShippingMethodsOptions<TVariant = any> {
547
- /** Product variant with weight information */
548
- variant: TVariant;
549
- /** Zip code for delivery */
550
- zipCode: string;
551
- /** Whether next day delivery is allowed */
552
- allowNextDayDelivery: boolean;
553
- /** Whether third day delivery is allowed */
554
- allowThirdDayDelivery: boolean;
555
- /** Plus member metafields configuration */
556
- plusMemberMetafields: PlusMemberSettingsMetafields;
557
- /** Selected plus member mode */
558
- selectedPlusMemberMode: DeliveryPlusType;
559
- /** Whether user is a plus member */
560
- isPlus?: boolean;
561
- /** Available NDD coupon code */
562
- nddCoupon?: string;
563
- /** Available TDD coupon code */
564
- tddCoupon?: string;
565
- }
566
- interface UseShippingMethodsResult {
567
- freeShippingMethods: PlusMemberShippingMethodConfig[];
568
- paymentShippingMethods: PlusMemberShippingMethodConfig[];
569
- nddOverweight: boolean;
570
- tddOverweight: boolean;
571
- }
572
- /**
573
- * Calculate available shipping methods based on product weight, member status, and available coupons
574
- *
575
- * @param options - Configuration options
576
- * @returns Shipping methods categorized by free/payment and overweight status
577
- *
578
- * @example
579
- * ```tsx
580
- * const { freeShippingMethods, paymentShippingMethods, nddOverweight, tddOverweight } = useShippingMethods({
581
- * variant,
582
- * zipCode,
583
- * allowNextDayDelivery,
584
- * allowThirdDayDelivery,
585
- * plusMemberMetafields,
586
- * selectedPlusMemberMode,
587
- * isPlus: profile?.isPlus,
588
- * nddCoupon,
589
- * tddCoupon,
590
- * })
591
- * ```
592
- */
593
- declare function useShippingMethods<TVariant extends {
594
- weight?: number;
595
- } = any>(options: UseShippingMethodsOptions<TVariant>): UseShippingMethodsResult;
596
-
597
- /**
598
- * Hook to check shipping method availability and automatically adjust selection
599
- */
600
- declare function useShippingMethodAvailableCheck(): void;
601
-
602
- /**
603
- * Hook to replace cart plus member product
604
- *
605
- * When adding a monthly membership while an annual membership exists in cart,
606
- * the annual membership will be replaced and vice versa.
607
- *
608
- * @returns Handler function to replace conflicting membership products
609
- *
610
- * @example
611
- * ```tsx
612
- * const replaceCartPlusMember = useReplaceCartPlusMember()
613
- *
614
- * // Call before adding new membership product
615
- * await replaceCartPlusMember()
616
- * ```
617
- */
618
- declare const useReplaceCartPlusMember: () => () => Promise<void>;
619
-
620
- /**
621
- * Hook to get delivery discount codes from delivery data
622
- *
623
- * Extracts and returns the discount codes from the delivery custom data.
624
- *
625
- * @param deliveryData - Delivery data containing custom attributes
626
- * @returns Array of discount codes or undefined
627
- *
628
- * @example
629
- * ```tsx
630
- * const deliveryCodes = usePlusMemberDeliveryCodes({ deliveryData })
631
- * ```
632
- */
633
- declare const usePlusMemberDeliveryCodes: ({ deliveryData, }: {
634
- deliveryData?: DeliveryData;
635
- }) => string[] | undefined;
636
-
637
- type Attribute = {
638
- key: string;
639
- value: string;
640
- };
641
- type Discount = {
642
- amount: number;
643
- code?: string;
644
- };
645
- type Image = {
646
- url: string;
647
- altText?: string;
648
- width?: number;
649
- height?: number;
650
- };
651
- type Measurement = {
652
- value: number;
653
- unit: string;
654
- };
655
- type ExportSelectedOption = {
656
- id?: string;
657
- name: string;
658
- value: string;
659
- };
660
- type ExportProductVariant = {
661
- id: string;
662
- sku: string;
663
- name: string;
664
- requiresShipping: boolean;
665
- price: number;
666
- listPrice: number;
667
- image?: Image;
668
- isInStock?: boolean;
669
- availableForSale?: boolean;
670
- weight?: number;
671
- height?: Measurement;
672
- width?: Measurement;
673
- depth?: Measurement;
674
- metafields?: any;
675
- quantityAvailable: number;
676
- currentlyNotInStock: boolean;
677
- };
678
- type ExportDiscountAllocations = {
679
- amount: number;
680
- code: string;
681
- };
682
- type ExportLineItem = {
683
- id: string;
684
- variantId: string;
685
- productId: string;
686
- name: string;
687
- quantity: number;
688
- discounts: Discount[];
689
- path: string;
690
- variant: ExportProductVariant;
691
- totalAmount: number;
692
- subtotalAmount: number;
693
- options?: ExportSelectedOption[];
694
- discountAllocations?: ExportDiscountAllocations[];
695
- product?: any;
696
- weight?: number;
697
- customAttributes?: Array<Omit<Attribute, '__typename'>>;
698
- freeGiftVariant?: ExportLineItem;
699
- relatedVariant?: ExportLineItem;
700
- };
701
- type ExportDiscounts = {
702
- applicable: boolean;
703
- code: string;
704
- };
705
- type ExportCart = {
706
- id: string;
707
- customerId?: string;
708
- email?: string;
709
- createdAt: string;
710
- currency: {
711
- code: string;
712
- };
713
- taxesIncluded?: boolean;
714
- lineItems: ExportLineItem[];
715
- totallineItemsDiscount?: number;
716
- orderDiscounts?: number;
717
- lineItemsSubtotalPrice: number;
718
- subtotalPrice: number;
719
- totalPrice: number;
720
- totalTaxAmount: number;
721
- discountCodes: ExportDiscounts[];
722
- discountAllocations?: ExportDiscountAllocations[];
723
- discounts?: Discount[];
724
- url?: string;
725
- ready: boolean;
726
- orderStatusUrl?: any;
727
- customAttributes?: any;
728
- maxNum?: number;
729
- };
730
-
731
- /**
732
- * Hook to generate custom attributes for cart line items
733
- *
734
- * Creates custom attributes based on delivery data to be attached to line items.
735
- *
736
- * @param deliveryData - Delivery data containing custom attributes
737
- * @returns Array of custom attributes for line items
738
- *
739
- * @example
740
- * ```tsx
741
- * const itemAttributes = usePlusMemberItemCustomAttributes({ deliveryData })
742
- *
743
- * // Use in addToCart
744
- * await addToCart({
745
- * lineItems: lineItems.map(item => ({
746
- * ...item,
747
- * customAttributes: [...(item.customAttributes || []), ...itemAttributes]
748
- * }))
749
- * })
750
- * ```
751
- */
752
- declare const usePlusMemberItemCustomAttributes: ({ deliveryData, }: {
753
- deliveryData?: DeliveryData;
754
- }) => Attribute[];
755
-
756
- interface CustomerOrder {
757
- edges?: Array<any>;
758
- }
759
- interface Customer {
760
- orders?: CustomerOrder;
761
- }
762
- /**
763
- * Hook to generate custom attributes for checkout
764
- *
765
- * Creates custom attributes based on delivery data, profile, and customer information
766
- * to be attached to the checkout.
767
- *
768
- * Requires profile to be provided via PlusMemberContext.
769
- *
770
- * @param deliveryData - Delivery data containing custom attributes
771
- * @param product - Product information (optional, for hiding shipping benefits check)
772
- * @param variant - Variant information (optional, for presale and hiding shipping benefits check)
773
- * @param customer - Customer information (optional, for user type determination)
774
- * @param isShowShippingBenefits - Function to check if shipping benefits should be shown (optional)
775
- * @returns Array of custom attributes for checkout
776
- *
777
- * @example
778
- * ```tsx
779
- * const checkoutAttributes = usePlusMemberCheckoutCustomAttributes({
780
- * deliveryData,
781
- * product,
782
- * variant,
783
- * customer,
784
- * isShowShippingBenefits
785
- * })
786
- *
787
- * // Use in checkout
788
- * await createCheckout({
789
- * lineItems,
790
- * customAttributes: checkoutAttributes
791
- * })
792
- * ```
793
- */
794
- declare const usePlusMemberCheckoutCustomAttributes: <TProduct = any, TVariant = any>({ deliveryData, product, variant, customer, isShowShippingBenefits, }: {
795
- deliveryData?: DeliveryData;
796
- product?: TProduct;
797
- variant?: TVariant;
798
- customer?: Customer;
799
- isShowShippingBenefits?: (args: {
800
- variant?: TVariant;
801
- product?: TProduct;
802
- setting: any;
803
- }) => boolean;
804
- }) => Attribute[];
805
-
806
- /**
807
- * useAutoRemovePlusMemberInCart Hook
808
- * 自动移除购物车中的会员产品
809
- * 年费会员删除月费会员产品,月费会员删除年费会员产品
810
- */
811
-
812
- interface UseAutoRemovePlusMemberInCartProps {
813
- /** Plus Member 配置 */
814
- metafields: PlusMemberSettingsMetafields;
815
- /** 用户是否是月费会员 */
816
- isMonthlyPlus?: boolean;
817
- /** 用户是否是年费会员 */
818
- isAnnualPlus?: boolean;
819
- }
820
- /**
821
- * 自动移除购物车中的会员产品
822
- *
823
- * @param props - Hook 参数
824
- * @param props.metafields - Plus Member 配置
825
- * @param props.isMonthlyPlus - 用户是否是月费会员
826
- * @param props.isAnnualPlus - 用户是否是年费会员
827
- *
828
- * @example
829
- * ```tsx
830
- * const { profile } = useProfile()
831
- *
832
- * useAutoRemovePlusMemberInCart({
833
- * metafields: plusMemberSettings,
834
- * isMonthlyPlus: profile?.isMonthlyPlus,
835
- * isAnnualPlus: profile?.isAnnualPlus,
836
- * })
837
- * ```
838
- */
839
- declare function useAutoRemovePlusMemberInCart({ metafields, isMonthlyPlus, isAnnualPlus, }: UseAutoRemovePlusMemberInCartProps): void;
840
-
841
- /**
842
- * useHasPlusMemberInCart Hook
843
- * 判断购物车中是否包含年费会员或月费会员产品
844
- */
845
-
846
- interface UseHasPlusMemberInCartProps {
847
- /** Plus Member 配置 */
848
- memberSetting?: PlusMemberSettingsMetafields;
849
- /** 购物车数据 */
850
- cart?: NormalizedCart;
851
- }
852
- interface HasPlusMemberInCartResult {
853
- /** 购物车中是否有任何会员产品 */
854
- hasPlusMember: boolean;
855
- /** 购物车中是否有月费会员产品 */
856
- hasMonthlyPlus: boolean;
857
- /** 购物车中是否有年费会员产品 */
858
- hasAnnualPlus: boolean;
859
- /** 月费会员产品的 line item */
860
- monthlyPlusItem?: {
861
- id: string;
862
- quantity: number;
863
- handle?: string;
864
- sku?: string;
865
- };
866
- /** 年费会员产品的 line item */
867
- annualPlusItem?: {
868
- id: string;
869
- quantity: number;
870
- handle?: string;
871
- sku?: string;
872
- };
873
- }
874
- /**
875
- * 判断购物车中是否包含年费会员或月费会员产品
876
- *
877
- * @param props - Hook 参数
878
- * @param props.metafields - Plus Member 配置
879
- * @returns 会员产品信息
880
- *
881
- * @example
882
- * ```tsx
883
- * const {
884
- * hasPlusMember,
885
- * hasMonthlyPlus,
886
- * hasAnnualPlus,
887
- * monthlyPlusItem,
888
- * annualPlusItem,
889
- * } = useHasPlusMemberInCart({
890
- * memberSetting: plusMemberSettings,
891
- * })
892
- *
893
- * if (hasPlusMember) {
894
- * console.log('购物车中有会员产品')
895
- * }
896
- * ```
897
- */
898
- declare function useHasPlusMemberInCart({ memberSetting, cart, }: UseHasPlusMemberInCartProps): HasPlusMemberInCartResult;
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
-
945
- interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any> {
946
- variant: TVariant;
947
- product: TProduct;
948
- memberSetting: PlusMemberSettingsMetafields;
949
- initialSelectedPlusMemberMode?: DeliveryPlusType;
950
- profile?: TProfile;
951
- locale?: string;
952
- }
953
- /**
954
- * Plus Member Provider Component
955
- *
956
- * Provides Plus Member context and state management to child components.
957
- *
958
- * @param variant - Product variant
959
- * @param product - Product
960
- * @param metafields - Plus member settings from metafields
961
- * @param initialSelectedPlusMemberMode - Initial selected mode (default: 'free')
962
- * @param profile - User profile
963
- * @param locale - Locale code
964
- * @param children - Child components
965
- *
966
- * @example
967
- * ```tsx
968
- * <PlusMemberProvider
969
- * variant={variant}
970
- * product={product}
971
- * memberSetting={memberSetting}
972
- * profile={profile}
973
- * locale={locale}
974
- * >
975
- * <YourComponent />
976
- * </PlusMemberProvider>
977
- * ```
978
- */
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;
980
-
981
- declare const getReferralAttributes: () => {
982
- key: string;
983
- value: string;
984
- }[];
985
- declare const useCartAttributes: ({ profile, customer, cart, memberSetting, }: {
986
- profile: any;
987
- customer: any;
988
- cart?: NormalizedCart;
989
- memberSetting?: PlusMemberSettingsMetafields;
990
- }) => {
991
- attributes: Array<{
992
- key: string;
993
- value: any;
994
- }>;
995
- };
996
-
997
- declare const useCartItemQuantityLimit: ({ cart, cartItem, config, }: {
998
- cart?: NormalizedCart;
999
- cartItem: NormalizedLineItem;
1000
- config: {
1001
- handle: Record<string, {
1002
- min: number;
1003
- max: number;
1004
- }>;
1005
- sku: Record<string, {
1006
- min: number;
1007
- max: number;
1008
- }>;
1009
- };
1010
- }) => {
1011
- min: number;
1012
- max: number;
1013
- };
1014
-
1015
- interface GiveawayProduct {
1016
- handle: string;
1017
- sku: string;
1018
- }
1019
- interface Breakpoint {
1020
- breakpoint: string;
1021
- giveawayProducts: GiveawayProduct[];
1022
- }
1023
- interface Campaign {
1024
- activityAvailableQuery?: string;
1025
- activityQroperty?: string;
1026
- breakpoints?: Array<{
1027
- breakpoint: string;
1028
- giveawayProducts: GiveawayProduct[];
1029
- }>;
1030
- includeTags?: string[];
1031
- useTotalAmount?: boolean;
1032
- }
1033
- interface UseScriptAutoFreeGiftResult {
1034
- involvedLines: NormalizedLineItem[];
1035
- reorder: (a: NormalizedLineItem, b: NormalizedLineItem) => number;
1036
- disableCodeRemove: boolean;
1037
- nextFreeGiftLevel: Breakpoint | null;
1038
- freeGiftLevel: Breakpoint | null;
1039
- involvedSubTotal: Decimal;
1040
- giftProductsResult?: NormalizedProduct[];
1041
- }
1042
- declare const useScriptAutoFreeGift: ({ campaign, _giveaway, cart, locale: providedLocale, }: {
1043
- campaign: Campaign | null;
1044
- _giveaway: string;
1045
- cart: NormalizedCart | undefined;
1046
- locale?: string;
1047
- }) => UseScriptAutoFreeGiftResult;
1048
-
1049
- declare const useUpdateLineCodeAmountAttributes: ({ cart, mutateCart, isCartLoading, setLoadingState, metafieldIdentifiers, }: {
1050
- cart?: NormalizedCart;
1051
- mutateCart: (cart: NormalizedCart | undefined) => void;
1052
- isCartLoading: boolean;
1053
- setLoadingState: React.Dispatch<React.SetStateAction<any>>;
1054
- metafieldIdentifiers?: {
1055
- variant: HasMetafieldsIdentifier[];
1056
- product: HasMetafieldsIdentifier[];
1057
- };
1058
- }) => void;
1059
-
1060
- declare enum PriceDiscountType {
1061
- PERCENTAGE = 1,// 百分比折扣
1062
- FIXED_AMOUNT = 2
1063
- }
1064
- declare enum PriceBasePriceType {
1065
- MIN_DISCOUNTED_PRICE = 1,// 最低折扣价
1066
- MIN_TOTAL_PRICE = 2
1067
- }
1068
- type PriceDiscountConfig = {
1069
- rule_id: number;
1070
- rule_type: number;
1071
- discount_type: PriceDiscountType;
1072
- discount_value: number;
1073
- base_price_type: PriceBasePriceType;
1074
- applicable_products: Array<{
1075
- product_id: string;
1076
- variant_id?: string;
1077
- }>;
1078
- };
1079
-
1080
- declare const currencyCodeMapping: Record<string, string>;
1081
- declare const defaultSWRMutationConfiguration: SWRMutationConfiguration<any, any, any, any, any> & {
1082
- throwOnError?: boolean;
1083
- };
1084
- declare const CUSTOMER_ATTRIBUTE_KEY = "_discounts_function_env";
1085
- declare const CUSTOMER_SCRIPT_GIFT_KEY = "_giveaway_gradient_gifts";
1086
- declare const CODE_AMOUNT_KEY = "_sku_code_money";
1087
- declare const SCRIPT_CODE_AMOUNT_KEY = "_code_money";
1088
- declare const MAIN_PRODUCT_CODE: string[];
1089
-
1090
- declare const getQuery: () => Record<string, string>;
1091
- declare function atobID(id: string): string | undefined;
1092
- declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
1093
-
1094
- declare const getMatchedMainProductSubTotal: (cartData: any, variant_list: AutoFreeGiftMainProduct["variant_id_list"], main_product: AutoFreeGiftMainProduct) => any;
1095
- declare const safeParse: (str: string) => any;
1096
- declare const getDiscountEnvAttributeValue: (attributes?: {
1097
- key: string;
1098
- value: string;
1099
- }[]) => any;
1100
- declare const checkAttributesUpdateNeeded: (oldAttributes: Attribute$1[], newAttributes: Attribute$1[], customAttributesNeedRemove: {
1101
- key: string;
1102
- }[]) => boolean;
1103
- declare function preCheck(rule_conditions: RuleCondition[], userTags: string[], currentDealsTypes: string[]): boolean;
1104
- declare const formatScriptAutoFreeGift: ({ scriptAutoFreeGiftResult, gradient_gifts, locale, }: {
1105
- scriptAutoFreeGiftResult: UseScriptAutoFreeGiftResult;
1106
- gradient_gifts: any;
1107
- locale: string;
1108
- }) => any[];
1109
- declare const formatFunctionAutoFreeGift: ({ qualifyingGift, giftProductsResult, locale, }: {
1110
- locale: string;
1111
- qualifyingGift?: FormattedGift | null;
1112
- giftProductsResult?: NormalizedProduct[] | [];
1113
- }) => any[];
1114
-
1115
- interface UseProductOptions extends SWRConfiguration<NormalizedProduct | undefined> {
1116
- handle?: string;
1117
- metafieldIdentifiers?: Array<{
1118
- namespace: string;
1119
- key: string;
1120
- }>;
1121
- }
1122
- /**
1123
- * Hook to fetch a single product by handle
1124
- *
1125
- * @param options - Hook options including handle and SWR configuration
1126
- * @returns SWR response with product data
1127
- *
1128
- * @example
1129
- * ```typescript
1130
- * function ProductPage() {
1131
- * const { data: product, error, isLoading } = useProduct({
1132
- * handle: 'my-product'
1133
- * })
1134
- *
1135
- * if (isLoading) return <div>Loading...</div>
1136
- * if (error) return <div>Error loading product</div>
1137
- * if (!product) return <div>Product not found</div>
1138
- *
1139
- * return (
1140
- * <div>
1141
- * <h1>{product.title}</h1>
1142
- * <p>{product.description}</p>
1143
- * <p>${product.price.amount}</p>
1144
- * </div>
1145
- * )
1146
- * }
1147
- * ```
1148
- */
1149
- declare function useProduct(options?: UseProductOptions): swr.SWRResponse<NormalizedProduct | undefined, any, SWRConfiguration<NormalizedProduct | undefined, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedProduct | undefined>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedProduct | undefined>)> | undefined>;
1150
-
1151
- interface UseAllProductsOptions extends SWRConfiguration<NormalizedProduct[]> {
1152
- first?: number;
1153
- query?: string;
1154
- sortKey?: 'TITLE' | 'PRODUCT_TYPE' | 'VENDOR' | 'UPDATED_AT' | 'CREATED_AT' | 'BEST_SELLING' | 'PRICE' | 'RELEVANCE';
1155
- reverse?: boolean;
1156
- metafieldIdentifiers?: Array<{
1157
- namespace: string;
1158
- key: string;
1159
- }>;
1160
- }
1161
- /**
1162
- * Hook to fetch all products
1163
- *
1164
- * This hook automatically handles pagination and fetches all products.
1165
- * Use with caution on stores with many products.
1166
- *
1167
- * @param options - Hook options including query parameters and SWR configuration
1168
- * @returns SWR response with products array
1169
- *
1170
- * @example
1171
- * ```typescript
1172
- * function ProductList() {
1173
- * const { data: products, error, isLoading } = useAllProducts({
1174
- * sortKey: 'TITLE',
1175
- * reverse: false
1176
- * })
1177
- *
1178
- * if (isLoading) return <div>Loading...</div>
1179
- * if (error) return <div>Error loading products</div>
1180
- *
1181
- * return (
1182
- * <div>
1183
- * {products?.map(product => (
1184
- * <div key={product.id}>
1185
- * <h2>{product.title}</h2>
1186
- * <p>${product.price.amount}</p>
1187
- * </div>
1188
- * ))}
1189
- * </div>
1190
- * )
1191
- * }
1192
- * ```
1193
- */
1194
- declare function useAllProducts(options?: UseAllProductsOptions): swr.SWRResponse<NormalizedProduct[], any, SWRConfiguration<NormalizedProduct[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedProduct[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedProduct[]>)> | undefined>;
1195
-
1196
- interface UseProductsByHandlesOptions extends SWRConfiguration<NormalizedProduct[]> {
1197
- handles?: string[];
1198
- metafieldIdentifiers?: {
1199
- product: HasMetafieldsIdentifier[];
1200
- variant: HasMetafieldsIdentifier[];
1201
- };
1202
- }
1203
- /**
1204
- * Hook to fetch multiple products by their handles
1205
- *
1206
- * @param options - Hook options including handles array and SWR configuration
1207
- * @returns SWR response with products array
1208
- *
1209
- * @example
1210
- * ```typescript
1211
- * function FeaturedProducts() {
1212
- * const { data: products, error, isLoading } = useProductsByHandles({
1213
- * handles: ['product-1', 'product-2', 'product-3']
1214
- * })
1215
- *
1216
- * if (isLoading) return <div>Loading...</div>
1217
- * if (error) return <div>Error loading products</div>
1218
- *
1219
- * return (
1220
- * <div>
1221
- * {products?.map(product => (
1222
- * <div key={product.id}>
1223
- * <h2>{product.title}</h2>
1224
- * <p>${product.price.amount}</p>
1225
- * </div>
1226
- * ))}
1227
- * </div>
1228
- * )
1229
- * }
1230
- * ```
1231
- */
1232
- declare function useProductsByHandles(options?: UseProductsByHandlesOptions): swr.SWRResponse<NormalizedProduct[], any, SWRConfiguration<NormalizedProduct[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedProduct[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedProduct[]>)> | undefined>;
1233
-
1234
- /**
1235
- * useVariant Hook
1236
- *
1237
- * Client-side hook to get the selected variant based on selected options
1238
- */
1239
-
1240
- type Options = Record<string, string>;
1241
- /**
1242
- * Hook to manage variant selection based on selected options
1243
- *
1244
- * @param product - The product object
1245
- * @param selectedOptions - Currently selected options { Color: 'Red', Size: 'M' }
1246
- * @returns The matching variant
1247
- *
1248
- * @example
1249
- * ```typescript
1250
- * function ProductDetail() {
1251
- * const { data: product } = useProduct({ handle: 'my-product' })
1252
- * const [selectedOptions, setSelectedOptions] = useState({ Color: 'Red', Size: 'M' })
1253
- * const variant = useVariant({ product, selectedOptions })
1254
- *
1255
- * return (
1256
- * <div>
1257
- * <h1>{product.title}</h1>
1258
- * <p>Selected: {variant.title}</p>
1259
- * <p>Price: ${variant.price.amount}</p>
1260
- * <p>Available: {variant.availableForSale ? 'Yes' : 'No'}</p>
1261
- * </div>
1262
- * )
1263
- * }
1264
- * ```
1265
- */
1266
- declare function useVariant({ product, selectedOptions, }: {
1267
- product?: NormalizedProduct;
1268
- selectedOptions: Options;
1269
- }): NormalizedProductVariant | undefined;
1270
-
1271
- /**
1272
- * usePrice Hook
1273
- *
1274
- * Client-side hook to format price for display
1275
- */
1276
- interface UsePriceOptions {
1277
- amount: number;
1278
- baseAmount?: number;
1279
- currencyCode: string;
1280
- soldOutDescription?: string;
1281
- maximumFractionDigits?: number;
1282
- minimumFractionDigits?: number;
1283
- removeTrailingZeros?: boolean;
1284
- }
1285
- interface UsePriceResult {
1286
- price: string;
1287
- basePrice?: string;
1288
- free: boolean;
1289
- }
1290
- /**
1291
- * Hook to format price for display
1292
- *
1293
- * @param options - Price formatting options
1294
- * @returns Formatted price object
1295
- *
1296
- * @example
1297
- * ```typescript
1298
- * function ProductPrice({ variant }) {
1299
- * const { price, basePrice, free } = usePrice({
1300
- * amount: variant.price.amount,
1301
- * baseAmount: variant.compareAtPrice?.amount,
1302
- * currencyCode: variant.price.currencyCode
1303
- * })
1304
- *
1305
- * return (
1306
- * <div>
1307
- * {free ? (
1308
- * <span>Free</span>
1309
- * ) : (
1310
- * <>
1311
- * <span className="price">{price}</span>
1312
- * {basePrice && <span className="original">{basePrice}</span>}
1313
- * </>
1314
- * )}
1315
- * </div>
1316
- * )
1317
- * }
1318
- * ```
1319
- */
1320
- declare function usePrice({ amount, baseAmount, currencyCode, soldOutDescription, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: UsePriceOptions): UsePriceResult;
1321
-
1322
- /**
1323
- * useSelectedOptions Hook
1324
- *
1325
- * Client-side hook to manage selected product options
1326
- */
1327
-
1328
- type SelectedOptionsResult = [Options, Dispatch<SetStateAction<Options>>];
1329
- /**
1330
- * Hook to manage selected product options based on URL query or SKU
1331
- *
1332
- * @param product - The product object
1333
- * @param sku - Optional SKU to match variant
1334
- * @returns Tuple of [options, setOptions]
1335
- *
1336
- * @example
1337
- * ```typescript
1338
- * function ProductDetail() {
1339
- * const { data: product } = useProduct({ handle: 'my-product' })
1340
- * const [selectedOptions, setSelectedOptions] = useSelectedOptions(product)
1341
- * const variant = useVariant({ product, selectedOptions })
1342
- *
1343
- * const handleOptionChange = (name: string, value: string) => {
1344
- * setSelectedOptions(prev => ({ ...prev, [name]: value }))
1345
- * }
1346
- *
1347
- * return (
1348
- * <div>
1349
- * {product?.options.map(option => (
1350
- * <select
1351
- * key={option.id}
1352
- * value={selectedOptions[option.name] || ''}
1353
- * onChange={(e) => handleOptionChange(option.name, e.target.value)}
1354
- * >
1355
- * {option.values.map(value => (
1356
- * <option key={value.label} value={value.label}>
1357
- * {value.label}
1358
- * </option>
1359
- * ))}
1360
- * </select>
1361
- * ))}
1362
- * <p>Selected: {variant?.title}</p>
1363
- * </div>
1364
- * )
1365
- * }
1366
- * ```
1367
- */
1368
- declare function useSelectedOptions(product?: NormalizedProduct, sku?: string): SelectedOptionsResult;
1369
-
1370
- /**
1371
- * useProductUrl Hook
1372
- *
1373
- * Hook to generate product URLs with variant query params
1374
- * Requires routerAdapter to be configured in ShopifyProvider
1375
- */
1376
-
1377
- /**
1378
- * Hook to generate product URLs
1379
- *
1380
- * @param otherQuery - Additional query parameters to include
1381
- * @returns Function to generate product URL
1382
- *
1383
- * @example
1384
- * ```typescript
1385
- * function ProductCard({ product, variant }) {
1386
- * const getProductUrl = useProductUrl()
1387
- *
1388
- * const url = getProductUrl({ product, variant })
1389
- *
1390
- * return (
1391
- * <a href={url}>
1392
- * <h2>{product.title}</h2>
1393
- * <p>{variant.title}</p>
1394
- * </a>
1395
- * )
1396
- * }
1397
- * ```
1398
- *
1399
- * @example With additional query params
1400
- * ```typescript
1401
- * function ProductCard({ product, variant }) {
1402
- * const getProductUrl = useProductUrl({ utm_source: 'email' })
1403
- *
1404
- * const url = getProductUrl({ product, variant })
1405
- * // URL will include: ?variant=123&utm_source=email
1406
- *
1407
- * return <a href={url}>{product.title}</a>
1408
- * }
1409
- * ```
1410
- */
1411
- declare function useProductUrl(otherQuery?: Record<string, string>): ({ product, variant }: {
1412
- product?: NormalizedProduct;
1413
- variant?: NormalizedProductVariant;
1414
- }) => string;
1415
-
1416
- /**
1417
- * useUpdateVariantQuery Hook
1418
- *
1419
- * Hook to automatically update URL query string when variant changes
1420
- */
1421
-
1422
- /**
1423
- * Hook to update URL query string when variant changes
1424
- *
1425
- * This hook automatically updates the browser URL with the selected variant ID
1426
- * without causing a page reload. Useful for shareable URLs and browser history.
1427
- *
1428
- * @param variant - The selected variant
1429
- *
1430
- * @example
1431
- * ```typescript
1432
- * function ProductDetail() {
1433
- * const { data: product } = useProduct({ handle: 'my-product' })
1434
- * const [selectedOptions, setSelectedOptions] = useSelectedOptions(product)
1435
- * const variant = useVariant({ product, selectedOptions })
1436
- *
1437
- * // Automatically updates URL when variant changes
1438
- * useUpdateVariantQuery(variant)
1439
- *
1440
- * return (
1441
- * <div>
1442
- * <h1>{product?.title}</h1>
1443
- * <p>Current variant: {variant?.title}</p>
1444
- * {/* URL will be: /products/my-product?variant=123456 *\/}
1445
- * </div>
1446
- * )
1447
- * }
1448
- * ```
1449
- */
1450
- declare function useUpdateVariantQuery(variant?: NormalizedProductVariant): void;
1451
-
1452
- /**
1453
- * useVariantMedia Hook
1454
- *
1455
- * Hook to get media (images and videos) for the selected variant
1456
- */
1457
-
1458
- type ImageMedia = Media & {
1459
- mediaContentType: 'IMAGE';
1460
- };
1461
- type VideoMedia = Media & {
1462
- mediaContentType: 'VIDEO' | 'EXTERNAL_VIDEO';
1463
- };
1464
- interface VariantMedia {
1465
- productList: ImageMedia[];
1466
- sceneList: ImageMedia[];
1467
- videoList: VideoMedia[];
1468
- }
1469
- /**
1470
- * Hook to get media for the selected variant
1471
- *
1472
- * @param product - The product object
1473
- * @param variant - The selected variant
1474
- * @returns Object with productList (first image), sceneList (other images), videoList
1475
- *
1476
- * @example
1477
- * ```typescript
1478
- * function ProductGallery() {
1479
- * const { data: product } = useProduct({ handle: 'my-product' })
1480
- * const [selectedOptions, setSelectedOptions] = useSelectedOptions(product)
1481
- * const variant = useVariant({ product, selectedOptions })
1482
- * const { productList, sceneList, videoList } = useVariantMedia({ product, variant })
1483
- *
1484
- * return (
1485
- * <div>
1486
- * {/* Main product image *\/}
1487
- * {productList.map(media => (
1488
- * <img key={media.id} src={media.image?.url} alt={media.alt} />
1489
- * ))}
1490
- *
1491
- * {/* Scene/detail images *\/}
1492
- * {sceneList.map(media => (
1493
- * <img key={media.id} src={media.image?.url} alt={media.alt} />
1494
- * ))}
1495
- *
1496
- * {/* Videos *\/}
1497
- * {videoList.map(media => (
1498
- * <video key={media.id} src={media.sources?.[0]?.url} controls />
1499
- * ))}
1500
- * </div>
1501
- * )
1502
- * }
1503
- * ```
1504
- */
1505
- declare function useVariantMedia({ product, variant, }: {
1506
- product?: NormalizedProduct;
1507
- variant?: NormalizedProductVariant;
1508
- }): VariantMedia;
1509
-
1510
- interface UseCollectionOptions extends SWRConfiguration<NormalizedCollection | undefined> {
1511
- handle?: string;
1512
- metafieldIdentifiers?: Array<{
1513
- namespace: string;
1514
- key: string;
1515
- }>;
1516
- }
1517
- declare function useCollection(options?: UseCollectionOptions): swr.SWRResponse<NormalizedCollection | undefined, any, SWRConfiguration<NormalizedCollection | undefined, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedCollection | undefined>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedCollection | undefined>)> | undefined>;
1518
-
1519
- interface UseAllCollectionsOptions extends SWRConfiguration<NormalizedCollection[]> {
1520
- first?: number;
1521
- query?: string;
1522
- sortKey?: 'TITLE' | 'UPDATED_AT' | 'ID' | 'RELEVANCE';
1523
- reverse?: boolean;
1524
- metafieldIdentifiers?: Array<{
1525
- namespace: string;
1526
- key: string;
1527
- }>;
1528
- }
1529
- declare function useAllCollections(options?: UseAllCollectionsOptions): swr.SWRResponse<NormalizedCollection[], any, SWRConfiguration<NormalizedCollection[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedCollection[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedCollection[]>)> | undefined>;
1530
-
1531
- interface UseCollectionsOptions extends SWRConfiguration<CollectionsConnection> {
1532
- first?: number;
1533
- after?: string;
1534
- query?: string;
1535
- sortKey?: 'TITLE' | 'UPDATED_AT' | 'ID' | 'RELEVANCE';
1536
- reverse?: boolean;
1537
- metafieldIdentifiers?: Array<{
1538
- namespace: string;
1539
- key: string;
1540
- }>;
1541
- }
1542
- declare function useCollections(options?: UseCollectionsOptions): swr.SWRResponse<CollectionsConnection, any, SWRConfiguration<CollectionsConnection, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<CollectionsConnection>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<CollectionsConnection>)> | undefined>;
1543
-
1544
- interface UseBlogOptions extends SWRConfiguration<NormalizedBlog | undefined> {
1545
- handle?: string;
1546
- metafieldIdentifiers?: Array<{
1547
- namespace: string;
1548
- key: string;
1549
- }>;
1550
- }
1551
- declare function useBlog(options?: UseBlogOptions): swr.SWRResponse<NormalizedBlog | undefined, any, SWRConfiguration<NormalizedBlog | undefined, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedBlog | undefined>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedBlog | undefined>)> | undefined>;
1552
-
1553
- interface UseAllBlogsOptions extends SWRConfiguration<NormalizedBlog[]> {
1554
- first?: number;
1555
- query?: string;
1556
- metafieldIdentifiers?: Array<{
1557
- namespace: string;
1558
- key: string;
1559
- }>;
1560
- }
1561
- declare function useAllBlogs(options?: UseAllBlogsOptions): swr.SWRResponse<NormalizedBlog[], any, SWRConfiguration<NormalizedBlog[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedBlog[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedBlog[]>)> | undefined>;
1562
-
1563
- interface UseArticleOptions extends SWRConfiguration<NormalizedArticle | undefined> {
1564
- blogHandle?: string;
1565
- articleHandle?: string;
1566
- metafieldIdentifiers?: Array<{
1567
- namespace: string;
1568
- key: string;
1569
- }>;
1570
- }
1571
- declare function useArticle(options?: UseArticleOptions): swr.SWRResponse<NormalizedArticle | undefined, any, SWRConfiguration<NormalizedArticle | undefined, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle | undefined>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle | undefined>)> | undefined>;
1572
-
1573
- interface UseArticlesOptions extends SWRConfiguration<NormalizedArticle[]> {
1574
- first?: number;
1575
- query?: string;
1576
- sortKey?: 'PUBLISHED_AT' | 'UPDATED_AT' | 'TITLE' | 'ID' | 'RELEVANCE';
1577
- reverse?: boolean;
1578
- metafieldIdentifiers?: Array<{
1579
- namespace: string;
1580
- key: string;
1581
- }>;
1582
- }
1583
- declare function useArticles(options?: UseArticlesOptions): swr.SWRResponse<NormalizedArticle[], any, SWRConfiguration<NormalizedArticle[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>)> | undefined>;
1584
-
1585
- interface UseArticlesInBlogOptions extends SWRConfiguration<NormalizedArticle[]> {
1586
- blogHandle?: string;
1587
- first?: number;
1588
- sortKey?: 'PUBLISHED_AT' | 'UPDATED_AT' | 'TITLE' | 'ID' | 'RELEVANCE';
1589
- reverse?: boolean;
1590
- metafieldIdentifiers?: Array<{
1591
- namespace: string;
1592
- key: string;
1593
- }>;
1594
- }
1595
- declare function useArticlesInBlog(options?: UseArticlesInBlogOptions): swr.SWRResponse<NormalizedArticle[], any, SWRConfiguration<NormalizedArticle[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>)> | undefined>;
1596
-
1597
- type SearchResultType = 'ARTICLE' | 'PAGE' | 'PRODUCT';
1598
- interface SearchResultItem {
1599
- type: SearchResultType;
1600
- id?: string;
1601
- handle?: string;
1602
- title?: string;
1603
- description?: string;
1604
- url?: string;
1605
- image?: {
1606
- url: string;
1607
- altText?: string;
1608
- };
1609
- }
1610
- interface SearchResult {
1611
- items: SearchResultItem[];
1612
- totalCount: number;
1613
- pageInfo?: {
1614
- hasNextPage: boolean;
1615
- endCursor?: string;
1616
- };
1617
- }
1618
- interface UseSearchOptions extends SWRConfiguration<SearchResult | undefined> {
1619
- query?: string;
1620
- first?: number;
1621
- types?: SearchResultType[];
1622
- productFilters?: any[];
1623
- }
1624
- declare function useSearch(options?: UseSearchOptions): swr.SWRResponse<SearchResult | undefined, any, SWRConfiguration<SearchResult | undefined, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<SearchResult | undefined>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<SearchResult | undefined>)> | undefined>;
1625
-
1626
- interface SiteInfo {
1627
- name: string;
1628
- description?: string;
1629
- primaryDomain: {
1630
- url: string;
1631
- host: string;
1632
- };
1633
- brand?: {
1634
- logo?: {
1635
- image?: {
1636
- url: string;
1637
- };
1638
- };
1639
- colors?: {
1640
- primary?: string;
1641
- secondary?: string;
1642
- };
1643
- };
1644
- metafields?: Record<string, any>;
1645
- }
1646
- interface UseSiteOptions extends SWRConfiguration<SiteInfo | undefined> {
1647
- metafieldIdentifiers?: Array<{
1648
- namespace: string;
1649
- key: string;
1650
- }>;
1651
- }
1652
- declare function useSite(options?: UseSiteOptions): swr.SWRResponse<SiteInfo | undefined, any, SWRConfiguration<SiteInfo | undefined, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<SiteInfo | undefined>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<SiteInfo | undefined>)> | undefined>;
1653
-
1654
- /**
1655
- * useIntersection Hook
1656
- *
1657
- * Observes element visibility using IntersectionObserver API
1658
- */
1659
-
1660
- interface UseIntersectionOptions {
1661
- /** Callback function when element becomes visible */
1662
- callback: () => void;
1663
- /** Only trigger callback once (default: false) */
1664
- once?: boolean;
1665
- /** Root element for intersection (default: viewport) */
1666
- root?: Element | null;
1667
- /** Margin around root (default: '0px') */
1668
- rootMargin?: string;
1669
- /** Visibility threshold 0-1 (default: 0.8) */
1670
- threshold?: number;
1671
- }
1672
- /**
1673
- * Hook to observe element visibility with IntersectionObserver
1674
- *
1675
- * Triggers a callback when the target element becomes visible in the viewport
1676
- *
1677
- * @param targetRef - React ref to the target element
1678
- * @param options - Intersection observer options
1679
- *
1680
- * @example
1681
- * ```typescript
1682
- * function LazyImage() {
1683
- * const imageRef = useRef<HTMLImageElement>(null)
1684
- * const [loaded, setLoaded] = useState(false)
1685
- *
1686
- * useIntersection(imageRef, {
1687
- * callback: () => setLoaded(true),
1688
- * once: true,
1689
- * threshold: 0.5
1690
- * })
1691
- *
1692
- * return (
1693
- * <img
1694
- * ref={imageRef}
1695
- * src={loaded ? actualSrc : placeholderSrc}
1696
- * alt="Lazy loaded"
1697
- * />
1698
- * )
1699
- * }
1700
- * ```
1701
- */
1702
- declare function useIntersection(targetRef: RefObject<Element> | undefined, options: UseIntersectionOptions): void;
1703
-
1704
- /**
1705
- * useExposure Hook
1706
- *
1707
- * Tracks element exposure (visibility + duration) for analytics/tracking
1708
- */
1709
-
1710
- interface UseExposureOptions {
1711
- /** Visibility threshold 0-1 (default: 0.5, meaning 50% visible) */
1712
- threshold?: number;
1713
- /** Duration in milliseconds element must be visible (default: 2000ms) */
1714
- duration?: number;
1715
- /** Only trigger callback once (default: true) */
1716
- once?: boolean;
1717
- /** Callback when element has been exposed for the required duration */
1718
- onExposure: () => void;
1719
- }
1720
- /**
1721
- * Hook to track element exposure (visibility + duration threshold)
1722
- *
1723
- * Useful for tracking ad impressions, product views, or any analytics
1724
- * that require an element to be visible for a certain duration
1725
- *
1726
- * @param targetRef - React ref to the target element
1727
- * @param options - Exposure tracking options
1728
- * @returns Current visibility state
1729
- *
1730
- * @example
1731
- * ```typescript
1732
- * function ProductCard({ product }) {
1733
- * const cardRef = useRef<HTMLDivElement>(null)
1734
- *
1735
- * const isVisible = useExposure(cardRef, {
1736
- * threshold: 0.5, // 50% visible
1737
- * duration: 2000, // 2 seconds
1738
- * once: true, // Only track once
1739
- * onExposure: () => {
1740
- * // Track product impression
1741
- * analytics.track('Product Viewed', {
1742
- * productId: product.id,
1743
- * productName: product.title
1744
- * })
1745
- * }
1746
- * })
1747
- *
1748
- * return (
1749
- * <div ref={cardRef}>
1750
- * {product.title}
1751
- * {isVisible && <div className="viewing-indicator" />}
1752
- * </div>
1753
- * )
1754
- * }
1755
- * ```
1756
- */
1757
- declare function useExposure(targetRef: RefObject<Element>, options: UseExposureOptions): boolean;
1758
-
1759
- /**
1760
- * useGeoLocation Hook
1761
- *
1762
- * Fetches and caches user's geographic location
1763
- */
1764
-
1765
- interface GeoLocationData {
1766
- /** Geographic information */
1767
- geo: {
1768
- /** Country information */
1769
- country?: {
1770
- /** Country code (e.g., 'US', 'GB') */
1771
- code?: string;
1772
- /** Country name */
1773
- name?: string;
1774
- };
1775
- /** Region/state information */
1776
- region?: {
1777
- code?: string;
1778
- name?: string;
1779
- };
1780
- /** City name */
1781
- city?: string;
1782
- /** Coordinates */
1783
- latitude?: number;
1784
- longitude?: number;
1785
- /** Timezone */
1786
- timezone?: string;
1787
- };
1788
- /** Suggested locale based on location */
1789
- suggestLocale?: string;
1790
- }
1791
- interface LocaleMapping {
1792
- /** Countries that should map to EU locale */
1793
- euCountries?: string[];
1794
- /** Countries that should map to DE locale */
1795
- deCountries?: string[];
1796
- /** Countries that should map to AU locale */
1797
- auCountries?: string[];
1798
- /** Countries that should map to AE-EN locale */
1799
- aeEnCountries?: string[];
1800
- /** Custom country to locale mapping */
1801
- customMapping?: Record<string, string>;
1802
- }
1803
- interface UseGeoLocationOptions extends SWRConfiguration<GeoLocationData | undefined> {
1804
- /** API endpoint for fetching geo data (default: '/geolocation') */
1805
- endpoint?: string;
1806
- /** Cache key for localStorage (default: 'geoLocation') */
1807
- cacheKey?: string;
1808
- /** Cache duration in milliseconds (default: 24 hours) */
1809
- cacheDuration?: number;
1810
- /** Locale mapping configuration */
1811
- localeMapping?: LocaleMapping;
1812
- /** Enable automatic caching (default: true) */
1813
- enableCache?: boolean;
1814
- }
1815
- /**
1816
- * Hook to fetch and cache user's geographic location
1817
- *
1818
- * Fetches geo data from an API endpoint and caches it in localStorage
1819
- * Automatically determines suggested locale based on country
1820
- *
1821
- * @param options - Geo location options
1822
- * @returns SWR response with geo location data
1823
- *
1824
- * @example
1825
- * ```typescript
1826
- * function LocaleSwitcher() {
1827
- * const { data: geoData, error, isLoading } = useGeoLocation({
1828
- * endpoint: '/api/geolocation',
1829
- * localeMapping: {
1830
- * euCountries: ['FR', 'DE', 'IT', 'ES'],
1831
- * auCountries: ['AU', 'NZ']
1832
- * }
1833
- * })
1834
- *
1835
- * if (isLoading) return <div>Loading...</div>
1836
- * if (error) return <div>Error loading location</div>
1837
- *
1838
- * return (
1839
- * <div>
1840
- * <p>Country: {geoData?.geo.country?.code}</p>
1841
- * <p>Suggested Locale: {geoData?.suggestLocale}</p>
1842
- * </div>
1843
- * )
1844
- * }
1845
- * ```
1846
- *
1847
- * @example
1848
- * ```typescript
1849
- * // With custom locale mapping
1850
- * const { data } = useGeoLocation({
1851
- * localeMapping: {
1852
- * customMapping: {
1853
- * 'JP': 'ja',
1854
- * 'CN': 'zh-cn',
1855
- * 'TW': 'zh-tw'
1856
- * }
1857
- * }
1858
- * })
1859
- * ```
1860
- */
1861
- declare function useGeoLocation(options?: UseGeoLocationOptions): ReturnType<typeof swr__default<GeoLocationData | undefined>>;
1862
- /**
1863
- * Get cached geo location data without fetching
1864
- *
1865
- * @param cacheKey - Cache key (default: 'geoLocation')
1866
- * @returns Cached geo data or undefined
1867
- *
1868
- * @example
1869
- * ```typescript
1870
- * const cachedGeo = getCachedGeoLocation()
1871
- * if (cachedGeo) {
1872
- * console.log('Country:', cachedGeo.geo.country?.code)
1873
- * }
1874
- * ```
1875
- */
1876
- declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | undefined;
1877
- /**
1878
- * Clear cached geo location data
1879
- *
1880
- * @param cacheKey - Cache key (default: 'geoLocation')
1881
- *
1882
- * @example
1883
- * ```typescript
1884
- * clearGeoLocationCache()
1885
- * ```
1886
- */
1887
- declare function clearGeoLocationCache(cacheKey?: string): void;
1888
-
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 };