@wix/headless-gift-voucher 0.0.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.
Files changed (69) hide show
  1. package/cjs/dist/__mocks__/gift-card.d.ts +14 -0
  2. package/cjs/dist/__mocks__/gift-card.d.ts.map +1 -0
  3. package/cjs/dist/__mocks__/gift-card.js +49 -0
  4. package/cjs/dist/enums/index.d.ts +52 -0
  5. package/cjs/dist/enums/index.d.ts.map +1 -0
  6. package/cjs/dist/enums/index.js +52 -0
  7. package/cjs/dist/react/GiftCard.d.ts +1318 -0
  8. package/cjs/dist/react/GiftCard.d.ts.map +1 -0
  9. package/cjs/dist/react/GiftCard.js +1126 -0
  10. package/cjs/dist/react/core/GiftCard.d.ts +863 -0
  11. package/cjs/dist/react/core/GiftCard.d.ts.map +1 -0
  12. package/cjs/dist/react/core/GiftCard.js +737 -0
  13. package/cjs/dist/react/index.d.ts +2 -0
  14. package/cjs/dist/react/index.d.ts.map +1 -0
  15. package/cjs/dist/react/index.js +1 -0
  16. package/cjs/dist/services/gift-card-checkout-service.d.ts +133 -0
  17. package/cjs/dist/services/gift-card-checkout-service.d.ts.map +1 -0
  18. package/cjs/dist/services/gift-card-checkout-service.js +159 -0
  19. package/cjs/dist/services/gift-card-service.d.ts +102 -0
  20. package/cjs/dist/services/gift-card-service.d.ts.map +1 -0
  21. package/cjs/dist/services/gift-card-service.js +165 -0
  22. package/cjs/dist/services/index.d.ts +3 -0
  23. package/cjs/dist/services/index.d.ts.map +1 -0
  24. package/cjs/dist/services/index.js +2 -0
  25. package/cjs/dist/utils/formatting-utils.d.ts +13 -0
  26. package/cjs/dist/utils/formatting-utils.d.ts.map +1 -0
  27. package/cjs/dist/utils/formatting-utils.js +38 -0
  28. package/cjs/dist/utils/gift-card-utils.d.ts +18 -0
  29. package/cjs/dist/utils/gift-card-utils.d.ts.map +1 -0
  30. package/cjs/dist/utils/gift-card-utils.js +118 -0
  31. package/cjs/dist/utils/validation-utils.d.ts +10 -0
  32. package/cjs/dist/utils/validation-utils.d.ts.map +1 -0
  33. package/cjs/dist/utils/validation-utils.js +24 -0
  34. package/dist/__mocks__/gift-card.d.ts +14 -0
  35. package/dist/__mocks__/gift-card.d.ts.map +1 -0
  36. package/dist/__mocks__/gift-card.js +49 -0
  37. package/dist/enums/index.d.ts +52 -0
  38. package/dist/enums/index.d.ts.map +1 -0
  39. package/dist/enums/index.js +52 -0
  40. package/dist/react/GiftCard.d.ts +1318 -0
  41. package/dist/react/GiftCard.d.ts.map +1 -0
  42. package/dist/react/GiftCard.js +1126 -0
  43. package/dist/react/core/GiftCard.d.ts +863 -0
  44. package/dist/react/core/GiftCard.d.ts.map +1 -0
  45. package/dist/react/core/GiftCard.js +737 -0
  46. package/dist/react/index.d.ts +2 -0
  47. package/dist/react/index.d.ts.map +1 -0
  48. package/dist/react/index.js +1 -0
  49. package/dist/services/gift-card-checkout-service.d.ts +133 -0
  50. package/dist/services/gift-card-checkout-service.d.ts.map +1 -0
  51. package/dist/services/gift-card-checkout-service.js +159 -0
  52. package/dist/services/gift-card-service.d.ts +102 -0
  53. package/dist/services/gift-card-service.d.ts.map +1 -0
  54. package/dist/services/gift-card-service.js +165 -0
  55. package/dist/services/index.d.ts +3 -0
  56. package/dist/services/index.d.ts.map +1 -0
  57. package/dist/services/index.js +2 -0
  58. package/dist/utils/formatting-utils.d.ts +13 -0
  59. package/dist/utils/formatting-utils.d.ts.map +1 -0
  60. package/dist/utils/formatting-utils.js +38 -0
  61. package/dist/utils/gift-card-utils.d.ts +18 -0
  62. package/dist/utils/gift-card-utils.d.ts.map +1 -0
  63. package/dist/utils/gift-card-utils.js +118 -0
  64. package/dist/utils/validation-utils.d.ts +10 -0
  65. package/dist/utils/validation-utils.d.ts.map +1 -0
  66. package/dist/utils/validation-utils.js +24 -0
  67. package/package.json +72 -0
  68. package/react/package.json +4 -0
  69. package/services/package.json +4 -0
@@ -0,0 +1,1318 @@
1
+ import React from 'react';
2
+ import * as CoreGiftCard from './core/GiftCard.js';
3
+ import type { GiftCardServiceConfig, GiftCardProduct } from '../services/gift-card-service.js';
4
+ import { AsChildChildren } from '@wix/headless-utils/react';
5
+ import { WixMediaImage } from '@wix/headless-media/react';
6
+ /**
7
+ * Props for the GiftCard root component
8
+ */
9
+ export interface GiftCardRootProps {
10
+ children: React.ReactNode;
11
+ giftCardServiceConfig: GiftCardServiceConfig;
12
+ }
13
+ /**
14
+ * Root component that provides the GiftCard service context.
15
+ * Supports both SSR (with product in config) and client-side auto-fetch (empty config).
16
+ *
17
+ * @component
18
+ * @example
19
+ * ```tsx
20
+ * // With SSR config
21
+ * <GiftCard.Root giftCardServiceConfig={{ product: myProduct }}>
22
+ * <GiftCard.Name className="text-2xl font-bold" />
23
+ * </GiftCard.Root>
24
+ *
25
+ * // Without config (auto-fetch)
26
+ * <GiftCard.Root giftCardServiceConfig={{}}>
27
+ * <GiftCard.Name className="text-2xl font-bold" />
28
+ * </GiftCard.Root>
29
+ * ```
30
+ */
31
+ export declare const Root: {
32
+ (props: GiftCardRootProps): React.ReactNode;
33
+ displayName: string;
34
+ };
35
+ /**
36
+ * Data exposed by the Raw component via render props
37
+ */
38
+ export interface GiftCardRawData {
39
+ /** The gift card product data, or null if not loaded */
40
+ giftCard: GiftCardProduct | null;
41
+ /** Whether the gift card is currently loading */
42
+ isLoading: boolean;
43
+ /** Error message if loading failed, or null */
44
+ error: string | null;
45
+ }
46
+ /**
47
+ * Props for the GiftCard Raw component
48
+ */
49
+ export interface RawProps {
50
+ /** Whether to render as a child component - must be true for Raw */
51
+ asChild?: boolean;
52
+ /** Render function that receives the gift card state */
53
+ children?: AsChildChildren<GiftCardRawData>;
54
+ /** CSS classes to apply to the element */
55
+ className?: string;
56
+ }
57
+ /**
58
+ * Provides direct access to the gift card data via render props.
59
+ * Should be used only when you need full control over rendering all states.
60
+ * For standard usage, use GiftCard.Loading and GiftCard.Error as siblings.
61
+ *
62
+ * @component
63
+ * @example
64
+ * ```tsx
65
+ * // Full control with render props
66
+ * <GiftCard.Raw asChild>
67
+ * {({ giftCard, isLoading, error }) => {
68
+ * if (isLoading) return <div>Loading gift card...</div>;
69
+ * if (error) return <div>Error: {error}</div>;
70
+ * return (
71
+ * <div className="flex flex-col gap-4">
72
+ * <h2>Gift Card: {giftCard.name}</h2>
73
+ * <p>ID: {giftCard.product_id}</p>
74
+ * </div>
75
+ * );
76
+ * }}
77
+ * </GiftCard.Raw>
78
+ * ```
79
+ */
80
+ export declare const Raw: React.ForwardRefExoticComponent<RawProps & React.RefAttributes<HTMLElement>>;
81
+ /**
82
+ * Props for the GiftCard Image component
83
+ */
84
+ type ImageProps = Omit<React.ComponentProps<typeof WixMediaImage>, 'src' | 'media'>;
85
+ /**
86
+ * Displays the gift card image using WixMediaImage
87
+ *
88
+ * @component
89
+ * @example
90
+ * ```tsx
91
+ * // Default usage
92
+ * <GiftCard.Image className="w-full h-full object-cover" />
93
+ *
94
+ * // asChild with primitive
95
+ * <GiftCard.Image asChild>
96
+ * <img className="w-full h-full object-cover" />
97
+ * </GiftCard.Image>
98
+ *
99
+ * // asChild with react component
100
+ * <GiftCard.Image asChild>
101
+ * {React.forwardRef(({src, ...props}, ref) => (
102
+ * <img ref={ref} {...props} src={src} className="w-full h-full object-cover" />
103
+ * ))}
104
+ * </GiftCard.Image>
105
+ * ```
106
+ */
107
+ export declare const Image: React.ForwardRefExoticComponent<Omit<ImageProps, "ref"> & React.RefAttributes<HTMLImageElement>>;
108
+ /**
109
+ * Data exposed by the GiftCard Name component
110
+ */
111
+ export interface GiftCardNameData {
112
+ /** Gift card product name */
113
+ name: string;
114
+ }
115
+ /**
116
+ * Props for GiftCard Name component
117
+ */
118
+ export interface NameProps {
119
+ /** Whether to render as a child component */
120
+ asChild?: boolean;
121
+ /** Custom render function when using asChild */
122
+ children?: AsChildChildren<GiftCardNameData>;
123
+ /** CSS classes to apply to the default element */
124
+ className?: string;
125
+ }
126
+ /**
127
+ * Displays the gift card product name with customizable rendering.
128
+ *
129
+ * @component
130
+ * @example
131
+ * ```tsx
132
+ * // Default usage
133
+ * <GiftCard.Name className="text-2xl font-bold" />
134
+ *
135
+ * // asChild with primitive
136
+ * <GiftCard.Name asChild>
137
+ * <h1 className="text-4xl font-bold" />
138
+ * </GiftCard.Name>
139
+ *
140
+ * // asChild with react component
141
+ * <GiftCard.Name asChild>
142
+ * {React.forwardRef(({ name, ...props }, ref) => (
143
+ * <h1 ref={ref} {...props} className="text-4xl font-bold">
144
+ * {name}
145
+ * </h1>
146
+ * ))}
147
+ * </GiftCard.Name>
148
+ * ```
149
+ */
150
+ export declare const Name: React.ForwardRefExoticComponent<NameProps & React.RefAttributes<HTMLElement>>;
151
+ /**
152
+ * Data exposed by the GiftCard Description component
153
+ */
154
+ export interface GiftCardDescriptionData {
155
+ /** Gift card product description */
156
+ description: string;
157
+ }
158
+ /**
159
+ * Props for GiftCard Description component
160
+ */
161
+ export interface DescriptionProps {
162
+ /** Whether to render as a child component */
163
+ asChild?: boolean;
164
+ /** Custom render function when using asChild */
165
+ children?: AsChildChildren<GiftCardDescriptionData>;
166
+ /** CSS classes to apply to the default element */
167
+ className?: string;
168
+ }
169
+ /**
170
+ * Renders the gift card product description.
171
+ *
172
+ * @component
173
+ * @example
174
+ * ```tsx
175
+ * // Default usage
176
+ * <GiftCard.Description className="text-content-secondary" />
177
+ *
178
+ * // asChild with primitive
179
+ * <GiftCard.Description asChild>
180
+ * <p className="text-sm" />
181
+ * </GiftCard.Description>
182
+ *
183
+ * // asChild with react component
184
+ * <GiftCard.Description asChild>
185
+ * {React.forwardRef(({ description, ...props }, ref) => (
186
+ * <p ref={ref} {...props}>{description}</p>
187
+ * ))}
188
+ * </GiftCard.Description>
189
+ * ```
190
+ */
191
+ export declare const Description: React.ForwardRefExoticComponent<DescriptionProps & React.RefAttributes<HTMLElement>>;
192
+ /**
193
+ * Props for GiftCard Loading component
194
+ */
195
+ export interface LoadingProps {
196
+ /** CSS classes to apply to the default element */
197
+ className?: string;
198
+ /** Content to show while loading */
199
+ children?: React.ReactNode;
200
+ }
201
+ /**
202
+ * Displays loading state indicator.
203
+ * Only renders content when isLoading is true.
204
+ *
205
+ * @component
206
+ * @example
207
+ * ```tsx
208
+ * <GiftCard.Loading className="text-gray-500">
209
+ * Loading...
210
+ * </GiftCard.Loading>
211
+ * ```
212
+ */
213
+ export declare const Loading: React.ForwardRefExoticComponent<LoadingProps & React.RefAttributes<HTMLDivElement>>;
214
+ /**
215
+ * Props for GiftCard Error component
216
+ */
217
+ export interface ErrorProps {
218
+ /** CSS classes to apply to the default element */
219
+ className?: string;
220
+ }
221
+ /**
222
+ * Displays error state.
223
+ * Only renders when there's an error.
224
+ *
225
+ * @component
226
+ * @example
227
+ * ```tsx
228
+ * <GiftCard.Error className="text-red-500" />
229
+ * ```
230
+ */
231
+ export declare const Error: React.ForwardRefExoticComponent<ErrorProps & React.RefAttributes<HTMLDivElement>>;
232
+ /**
233
+ * Data exposed by the PresetVariants component via render props
234
+ */
235
+ export interface PresetVariantsData {
236
+ /** Array of preset variants */
237
+ presetVariants: CoreGiftCard.PresetVariantItemData[];
238
+ }
239
+ /**
240
+ * Props for the PresetVariants component
241
+ */
242
+ export interface PresetVariantsProps {
243
+ /** Whether to render as a child component */
244
+ asChild?: boolean;
245
+ /** Custom render function when using asChild, or ReactNode for default rendering */
246
+ children?: React.ReactNode | AsChildChildren<PresetVariantsData>;
247
+ /** CSS classes to apply to the default element */
248
+ className?: string;
249
+ /** Label displayed above the variants */
250
+ label?: string;
251
+ /** Empty state to display when no variants are available */
252
+ emptyState?: React.ReactNode;
253
+ }
254
+ /**
255
+ * Container component for preset variant selection.
256
+ * Provides label and empty state support.
257
+ *
258
+ * @component
259
+ * @example
260
+ * ```tsx
261
+ * // With label and empty state
262
+ * <GiftCard.PresetVariants label="Select Amount" emptyState={<div>No variants</div>}>
263
+ * <GiftCard.PresetVariantRepeater>
264
+ * <GiftCard.PresetVariant.Amount />
265
+ * </GiftCard.PresetVariantRepeater>
266
+ * <GiftCard.CustomVariantTrigger label="Other amount" />
267
+ * </GiftCard.PresetVariants>
268
+ * ```
269
+ */
270
+ export declare const PresetVariants: React.ForwardRefExoticComponent<PresetVariantsProps & React.RefAttributes<HTMLDivElement>>;
271
+ /**
272
+ * Props for the PresetVariantRepeater component
273
+ */
274
+ export interface PresetVariantRepeaterProps {
275
+ /** Children to render for each preset variant */
276
+ children: React.ReactNode;
277
+ /** CSS classes to apply to each variant container */
278
+ className?: string;
279
+ }
280
+ /**
281
+ * Repeater component that renders children for each preset variant.
282
+ * Creates a PresetVariant context for each variant that child components can access.
283
+ *
284
+ * @component
285
+ * @example
286
+ * ```tsx
287
+ * <GiftCard.PresetVariantRepeater>
288
+ * <GiftCard.PresetVariant.Amount />
289
+ * </GiftCard.PresetVariantRepeater>
290
+ * ```
291
+ */
292
+ export declare const PresetVariantRepeater: {
293
+ (props: PresetVariantRepeaterProps): React.ReactNode;
294
+ displayName: string;
295
+ };
296
+ /**
297
+ * Data exposed by the PresetVariant.Amount component via render props
298
+ */
299
+ export interface PresetVariantAmountData {
300
+ /** Variant ID */
301
+ id: string;
302
+ /** Price amount as number (what the customer pays) */
303
+ price: number;
304
+ /** Original value as number (what the gift card is worth) */
305
+ value: number;
306
+ /** Whether this variant has a discount (price < value) */
307
+ hasDiscount: boolean;
308
+ /** Whether this variant has a custom image */
309
+ hasImage: boolean;
310
+ /** Whether this variant is currently selected */
311
+ isSelected: boolean;
312
+ /** Currency code for Money formatting */
313
+ currencyCode: string;
314
+ /** Locale code for Money formatting */
315
+ locale: string;
316
+ }
317
+ /**
318
+ * Props for the PresetVariant.Amount component
319
+ */
320
+ export interface PresetVariantAmountProps {
321
+ /** Whether to render as a child component */
322
+ asChild?: boolean;
323
+ /** Custom render function when using asChild */
324
+ children?: AsChildChildren<PresetVariantAmountData>;
325
+ /** CSS classes to apply to the button */
326
+ className?: string;
327
+ }
328
+ /**
329
+ == * PresetVariant namespace containing preset variant sub-components
330
+ */
331
+ export declare const PresetVariant: {
332
+ readonly Amount: React.ForwardRefExoticComponent<PresetVariantAmountProps & React.RefAttributes<HTMLButtonElement>>;
333
+ };
334
+ /**
335
+ * Data exposed by the CurrentPrice component via render props.
336
+ * Contains raw numeric amounts - use Money component for formatting.
337
+ */
338
+ export interface GiftCardCurrentPriceData {
339
+ /** Price amount as number (what the customer pays) */
340
+ price: number;
341
+ /** Original value as number (what the gift card is worth) */
342
+ value: number;
343
+ /** Whether current selection has a discount (price < value) */
344
+ hasDiscount: boolean;
345
+ /** Currency code from service config (e.g., "ILS", "USD") */
346
+ currencyCode: string;
347
+ /** Locale code from service config (e.g., "en-US", "he-IL") */
348
+ locale: string;
349
+ }
350
+ /**
351
+ * Props for the GiftCard CurrentPrice component
352
+ */
353
+ export interface CurrentPriceProps {
354
+ /** Whether to render as a child component */
355
+ asChild?: boolean;
356
+ /** Custom render function when using asChild, or ReactNode for default rendering */
357
+ children?: AsChildChildren<GiftCardCurrentPriceData>;
358
+ /** CSS classes to apply to the default element */
359
+ className?: string;
360
+ }
361
+ /**
362
+ * Displays the current price based on the selected variant (preset or custom amount).
363
+ * Uses the Money component for formatting. Supports discount display when price differs from value.
364
+ *
365
+ * Price vs Value:
366
+ * - `price` - What the customer pays (raw number)
367
+ * - `value` - What the gift card is worth (raw number)
368
+ * - `hasDiscount` - `true` when `price < value`, indicating a discounted variant
369
+ *
370
+ * @component
371
+ * @example
372
+ * ```tsx
373
+ * // Default usage - shows price, with strikethrough value when discounted
374
+ * <GiftCard.CurrentPrice className="text-3xl font-bold text-brand-primary" />
375
+ *
376
+ * // asChild with primitive
377
+ * <GiftCard.CurrentPrice asChild>
378
+ * <span className="text-2xl font-bold" />
379
+ * </GiftCard.CurrentPrice>
380
+ *
381
+ * // asChild with react component for full control
382
+ * <GiftCard.CurrentPrice asChild>
383
+ * {React.forwardRef(({ price, value, hasDiscount, currencyCode, ...props }, ref) => (
384
+ * <div ref={ref} {...props} className="flex items-baseline gap-3">
385
+ * {hasDiscount && (
386
+ * <Money money={{ amount: value, currency: currencyCode }} className="line-through text-lg text-content-muted" />
387
+ * )}
388
+ * <Money money={{ amount: price, currency: currencyCode }} className="text-4xl font-bold text-brand-primary" />
389
+ * </div>
390
+ * ))}
391
+ * </GiftCard.CurrentPrice>
392
+ * ```
393
+ */
394
+ export declare const CurrentPrice: React.ForwardRefExoticComponent<CurrentPriceProps & React.RefAttributes<HTMLElement>>;
395
+ /**
396
+ * Data exposed by the CustomVariantTrigger component via render props
397
+ */
398
+ export interface GiftCardCustomVariantTriggerData {
399
+ /** Whether the custom variant is currently selected */
400
+ isSelected: boolean;
401
+ /** Function to select the custom variant */
402
+ onClick: () => void;
403
+ }
404
+ /**
405
+ * Props for the GiftCard CustomVariantTrigger component
406
+ */
407
+ export interface CustomVariantTriggerProps {
408
+ /** Label text for the trigger button */
409
+ label?: string;
410
+ /** Whether to render as a child component */
411
+ asChild?: boolean;
412
+ /** Custom render function when using asChild, or ReactNode for default rendering */
413
+ children?: AsChildChildren<GiftCardCustomVariantTriggerData>;
414
+ /** CSS classes to apply to the default element */
415
+ className?: string;
416
+ }
417
+ /**
418
+ * Trigger button for selecting custom amount option.
419
+ * Use alongside PresetVariantRepeater to allow custom amounts.
420
+ * Only renders when custom variant is enabled for the gift card.
421
+ *
422
+ * @component
423
+ * @example
424
+ * ```tsx
425
+ * // Default usage
426
+ * <GiftCard.CustomVariantTrigger label="Other amount" className="px-6 py-4 border-2 border-dashed rounded-xl" />
427
+ *
428
+ * // asChild with primitive
429
+ * <GiftCard.CustomVariantTrigger label="Other amount" asChild>
430
+ * <button className="px-6 py-4 border-2 border-dashed rounded-xl hover:border-brand-primary" />
431
+ * </GiftCard.CustomVariantTrigger>
432
+ *
433
+ * // asChild with react component
434
+ * <GiftCard.CustomVariantTrigger>
435
+ * {React.forwardRef(({ isSelected, onClick, ...props }, ref) => (
436
+ * <button
437
+ * ref={ref}
438
+ * {...props}
439
+ * onClick={onClick}
440
+ * data-selected={isSelected}
441
+ * className="px-6 py-4 border-2 border-dashed rounded-xl"
442
+ * >
443
+ * Custom amount
444
+ * </button>
445
+ * ))}
446
+ * </GiftCard.CustomVariantTrigger>
447
+ * ```
448
+ */
449
+ export declare const CustomVariantTrigger: React.ForwardRefExoticComponent<CustomVariantTriggerProps & React.RefAttributes<HTMLButtonElement>>;
450
+ /**
451
+ * Data exposed by the CustomAmountInput component via render props
452
+ */
453
+ export interface GiftCardCustomAmountInputData {
454
+ /** Current custom amount value (defaults to 0) */
455
+ value: number;
456
+ /** Function to update the custom amount */
457
+ setValue: (amount: number) => void;
458
+ /** Minimum allowed amount (null if no minimum) */
459
+ min: number | null;
460
+ /** Maximum allowed amount (null if no maximum) */
461
+ max: number | null;
462
+ /** Whether the current value is valid (within min/max range) */
463
+ isValid: boolean;
464
+ /** Whether validation errors should be displayed */
465
+ showError: boolean;
466
+ /** Whether the input should be visible (custom variant is selected) */
467
+ isVisible: boolean;
468
+ /** Currency code from service config (e.g., "ILS", "USD") */
469
+ currencyCode: string;
470
+ /** Currency symbol derived from currency code (e.g., "$", "€", "₪") */
471
+ currencySymbol: string;
472
+ }
473
+ /**
474
+ * Props for the GiftCard CustomAmountInput component
475
+ */
476
+ export interface CustomAmountInputProps {
477
+ /** Label for the input */
478
+ label?: string;
479
+ /** Whether to render as a child component */
480
+ asChild?: boolean;
481
+ /** Custom render function when using asChild, or ReactNode for default rendering */
482
+ children?: AsChildChildren<GiftCardCustomAmountInputData>;
483
+ /** CSS classes to apply to the default element */
484
+ className?: string;
485
+ }
486
+ /**
487
+ * Input for entering a custom gift card amount.
488
+ * Only renders when custom variant is selected.
489
+ * The custom amount changes the currentPrice value displayed by GiftCard.CurrentPrice.
490
+ *
491
+ * Validation:
492
+ * - Amount must be within min/max range defined by the product's custom variant
493
+ * - data-invalid attribute is applied when showError is true and amount is outside the allowed range
494
+ * - The showError flag is controlled by the checkout service (set to true after form submission attempts)
495
+ *
496
+ * @component
497
+ * @example
498
+ * ```tsx
499
+ * // Default usage
500
+ * <GiftCard.CustomAmountInput
501
+ * label="Enter amount"
502
+ * className="w-full p-4 border-2 rounded-xl text-2xl font-bold text-center"
503
+ * />
504
+ *
505
+ * // asChild with primitive
506
+ * <GiftCard.CustomAmountInput label="Enter amount" asChild>
507
+ * <input type="number" className="w-full p-4 border-2 rounded-xl" />
508
+ * </GiftCard.CustomAmountInput>
509
+ *
510
+ * // asChild with react component with validation error display
511
+ * <GiftCard.CustomAmountInput>
512
+ * {React.forwardRef(({ value, setValue, min, max, isValid, showError, isVisible, currencyCode, ...props }, ref) =>
513
+ * isVisible && (
514
+ * <div className="space-y-2">
515
+ * <label>Enter amount ({currencyCode})</label>
516
+ * <input
517
+ * ref={ref}
518
+ * {...props}
519
+ * type="number"
520
+ * value={value || ''}
521
+ * onChange={(e) => setValue(parseFloat(e.target.value) || 0)}
522
+ * min={min ?? undefined}
523
+ * max={max ?? undefined}
524
+ * data-invalid={showError && !isValid}
525
+ * />
526
+ * {showError && !isValid && (
527
+ * <p className="text-red-500">
528
+ * {min && max
529
+ * ? `Amount must be between ${min} and ${max}`
530
+ * : min
531
+ * ? `Amount must be at least ${min}`
532
+ * : max
533
+ * ? `Amount must be no more than ${max}`
534
+ * : 'Please enter a valid amount'}
535
+ * </p>
536
+ * )}
537
+ * </div>
538
+ * )
539
+ * )}
540
+ * </GiftCard.CustomAmountInput>
541
+ * ```
542
+ */
543
+ export declare const CustomAmountInput: React.ForwardRefExoticComponent<CustomAmountInputProps & React.RefAttributes<HTMLInputElement>>;
544
+ /**
545
+ * Data exposed by the Quantity component via render props
546
+ */
547
+ export interface GiftCardQuantityData {
548
+ /** Current quantity value */
549
+ quantity: number;
550
+ /** Function to set quantity value */
551
+ setQuantity: (quantity: number) => void;
552
+ }
553
+ /**
554
+ * Props for the GiftCard Quantity component
555
+ */
556
+ export interface QuantityProps {
557
+ /** Whether to render as a child component */
558
+ asChild?: boolean;
559
+ /** Custom render function when using asChild */
560
+ children?: AsChildChildren<GiftCardQuantityData>;
561
+ /** CSS classes to apply to the container */
562
+ className?: string;
563
+ /** How much to increment/decrement (default: 1) */
564
+ steps?: number;
565
+ /** Label displayed above the quantity input */
566
+ label?: string;
567
+ }
568
+ /**
569
+ * Container for quantity selection controls.
570
+ * Renders a Quantity.Root from @wix/headless-components connected to the gift card service state.
571
+ *
572
+ * Use with Quantity.Decrement, Quantity.Input, Quantity.Increment components from @wix/headless-components.
573
+ *
574
+ * @component
575
+ * @example
576
+ * ```tsx
577
+ * import { Quantity } from '@wix/headless-components/react';
578
+ *
579
+ * // Default usage - renders built-in Quantity components
580
+ * <GiftCard.Quantity steps={1} />
581
+ *
582
+ * // With label and custom styling
583
+ * <GiftCard.Quantity
584
+ * label="Quantity"
585
+ * className="flex items-center gap-2"
586
+ * steps={1}
587
+ * />
588
+ *
589
+ * // asChild with custom Quantity children (use platform Quantity components)
590
+ * <GiftCard.Quantity asChild steps={1}>
591
+ * {({ quantity, setQuantity }) => (
592
+ * <QuantityComponent.Root
593
+ * initialValue={quantity}
594
+ * onValueChange={setQuantity}
595
+ * steps={1}
596
+ * min={1}
597
+ * >
598
+ * <Quantity.Decrement className="px-4 py-2 border rounded-l-lg" />
599
+ * <Quantity.Input className="w-16 text-center border-y" />
600
+ * <Quantity.Increment className="px-4 py-2 border rounded-r-lg" />
601
+ * </QuantityComponent.Root>
602
+ * )}
603
+ * </GiftCard.Quantity>
604
+ *
605
+ * // asChild with fully custom implementation
606
+ * <GiftCard.Quantity asChild>
607
+ * {React.forwardRef(({ quantity, setQuantity, ...props }, ref) => (
608
+ * <div ref={ref} {...props} className="flex items-center gap-2">
609
+ * <button
610
+ * onClick={() => setQuantity(quantity - 1)}
611
+ * disabled={quantity <= 1}
612
+ * className="w-10 h-10 border rounded-lg"
613
+ * >
614
+ * -
615
+ * </button>
616
+ * <span className="w-16 text-center text-2xl font-bold">
617
+ * {quantity}
618
+ * </span>
619
+ * <button
620
+ * onClick={() => setQuantity(quantity + 1)}
621
+ * className="w-10 h-10 border rounded-lg"
622
+ * >
623
+ * +
624
+ * </button>
625
+ * </div>
626
+ * ))}
627
+ * </GiftCard.Quantity>
628
+ * ```
629
+ */
630
+ export declare const Quantity: React.ForwardRefExoticComponent<QuantityProps & React.RefAttributes<HTMLDivElement>>;
631
+ /**
632
+ * Data exposed by the GiftToggle component via render props
633
+ */
634
+ export interface GiftCardGiftToggleData {
635
+ /** Whether this is a gift purchase (for someone else) */
636
+ isGift: boolean;
637
+ /** Function to set whether this is a gift purchase */
638
+ setIsGift: (value: boolean) => void;
639
+ }
640
+ /**
641
+ * Props for the GiftCard GiftToggle component
642
+ */
643
+ export interface GiftToggleProps {
644
+ /** Label displayed above the toggle (optional) */
645
+ label?: string;
646
+ /** Label for "For someone else" option */
647
+ forSomeoneLabel?: string;
648
+ /** Label for "For myself" option */
649
+ forMyselfLabel?: string;
650
+ /** Whether to render as a child component */
651
+ asChild?: boolean;
652
+ /** Custom render function when using asChild */
653
+ children?: AsChildChildren<GiftCardGiftToggleData>;
654
+ /** CSS classes to apply to the default element */
655
+ className?: string;
656
+ }
657
+ /**
658
+ * Toggle between "For someone else" (gift) and "For myself" purchase modes.
659
+ * When isGift is true, the recipient form should be shown.
660
+ * When isGift is false, the recipient form should be hidden.
661
+ *
662
+ * @component
663
+ * @example
664
+ * ```tsx
665
+ * // Default usage
666
+ * <GiftCard.GiftToggle
667
+ * label="Who is the gift card for?"
668
+ * forSomeoneLabel="For someone else"
669
+ * forMyselfLabel="For myself"
670
+ * className="flex gap-2"
671
+ * />
672
+ *
673
+ * // asChild with primitive
674
+ * <GiftCard.GiftToggle
675
+ * label="Who is the gift card for?"
676
+ * forSomeoneLabel="For someone else"
677
+ * forMyselfLabel="For myself"
678
+ * asChild
679
+ * >
680
+ * <div className="space-y-3" />
681
+ * </GiftCard.GiftToggle>
682
+ *
683
+ * // asChild with react component
684
+ * <GiftCard.GiftToggle>
685
+ * {React.forwardRef(({ isGift, setIsGift, ...props }, ref) => (
686
+ * <div ref={ref} {...props} className="space-y-3">
687
+ * <h3>Who is the gift card for?</h3>
688
+ * <div className="flex rounded-xl overflow-hidden border-2">
689
+ * <button
690
+ * onClick={() => setIsGift(true)}
691
+ * data-selected={isGift}
692
+ * className="flex-1 px-6 py-3 data-[selected]:bg-brand-primary data-[selected]:text-white"
693
+ * >
694
+ * For someone else
695
+ * </button>
696
+ * <button
697
+ * onClick={() => setIsGift(false)}
698
+ * data-selected={!isGift}
699
+ * className="flex-1 px-6 py-3 data-[selected]:bg-brand-primary data-[selected]:text-white"
700
+ * >
701
+ * For myself
702
+ * </button>
703
+ * </div>
704
+ * </div>
705
+ * ))}
706
+ * </GiftCard.GiftToggle>
707
+ * ```
708
+ */
709
+ export declare const GiftToggle: React.ForwardRefExoticComponent<GiftToggleProps & React.RefAttributes<HTMLElement>>;
710
+ /**
711
+ * Data exposed by the RecipientEmail component via render props
712
+ */
713
+ export interface GiftCardRecipientEmailData {
714
+ /** Current email value */
715
+ value: string;
716
+ /** Function to update the email value */
717
+ setValue: (value: string) => void;
718
+ /** Whether the email is valid */
719
+ isValid: boolean;
720
+ /** Whether to show validation errors (e.g., after form submission attempt) */
721
+ showError: boolean;
722
+ /** Whether the input should be visible (isGift is true) */
723
+ isVisible: boolean;
724
+ }
725
+ /**
726
+ * Props for the GiftCard RecipientEmail component
727
+ */
728
+ export interface RecipientEmailProps {
729
+ /** Label for the email input */
730
+ label?: string;
731
+ /** Whether to render as a child component */
732
+ asChild?: boolean;
733
+ /** Custom render function when using asChild */
734
+ children?: AsChildChildren<GiftCardRecipientEmailData>;
735
+ /** CSS classes to apply to the default element */
736
+ className?: string;
737
+ }
738
+ /**
739
+ * Input for entering recipient email address.
740
+ * Provides email state, validation, and error display control.
741
+ *
742
+ * The `showError` flag is controlled by the checkout service and indicates
743
+ * whether validation errors should be displayed (typically set to true after
744
+ * a form submission attempt).
745
+ *
746
+ * @component
747
+ * @example
748
+ * ```tsx
749
+ * // Default usage
750
+ * <GiftCard.RecipientEmail label="Recipient email" className="w-full p-3 border rounded-lg" />
751
+ *
752
+ * // asChild with primitive
753
+ * <GiftCard.RecipientEmail label="Recipient email" asChild>
754
+ * <input type="email" className="w-full p-3 border-2 rounded-lg" />
755
+ * </GiftCard.RecipientEmail>
756
+ *
757
+ * // asChild with react component
758
+ * <GiftCard.RecipientEmail>
759
+ * {React.forwardRef(({ value, setValue, isValid, showError, ...props }, ref) => (
760
+ * <div className="space-y-2">
761
+ * <label className="text-sm font-medium">
762
+ * Email <span className="text-status-error">*</span>
763
+ * </label>
764
+ * <input
765
+ * ref={ref}
766
+ * {...props}
767
+ * type="email"
768
+ * value={value}
769
+ * onChange={(e) => setValue(e.target.value)}
770
+ * data-invalid={showError && !isValid}
771
+ * className="w-full p-3 border-2 rounded-lg data-[invalid]:border-status-error"
772
+ * />
773
+ * {showError && !isValid && (
774
+ * <p className="text-sm text-status-error">Please enter a valid email</p>
775
+ * )}
776
+ * </div>
777
+ * ))}
778
+ * </GiftCard.RecipientEmail>
779
+ * ```
780
+ */
781
+ export declare const RecipientEmail: React.ForwardRefExoticComponent<RecipientEmailProps & React.RefAttributes<HTMLInputElement>>;
782
+ /**
783
+ * Data exposed by the RecipientName component via render props
784
+ */
785
+ export interface GiftCardRecipientNameData {
786
+ /** Current name value */
787
+ value: string;
788
+ /** Function to update the name value */
789
+ setValue: (value: string) => void;
790
+ /** Whether the input should be visible (isGift is true) */
791
+ isVisible: boolean;
792
+ }
793
+ /**
794
+ * Props for the GiftCard RecipientName component
795
+ */
796
+ export interface RecipientNameProps {
797
+ /** Label for the name input */
798
+ label?: string;
799
+ /** Whether to render as a child component */
800
+ asChild?: boolean;
801
+ /** Custom render function when using asChild */
802
+ children?: AsChildChildren<GiftCardRecipientNameData>;
803
+ /** CSS classes to apply to the default element */
804
+ className?: string;
805
+ }
806
+ /**
807
+ * Input for entering recipient name.
808
+ * Only renders when isGift is true (purchasing for someone else).
809
+ * This field is optional - no validation is required.
810
+ *
811
+ * @component
812
+ * @example
813
+ * ```tsx
814
+ * // Default usage
815
+ * <GiftCard.RecipientName label="Recipient name" className="w-full p-3 border rounded-lg" />
816
+ *
817
+ * // asChild with primitive
818
+ * <GiftCard.RecipientName label="Recipient name" asChild>
819
+ * <input type="text" className="w-full p-3 border-2 rounded-lg" />
820
+ * </GiftCard.RecipientName>
821
+ *
822
+ * // asChild with react component
823
+ * <GiftCard.RecipientName>
824
+ * {React.forwardRef(({ value, setValue, isVisible, ...props }, ref) =>
825
+ * isVisible && (
826
+ * <div className="space-y-2">
827
+ * <label className="text-sm font-medium">Name (optional)</label>
828
+ * <input
829
+ * ref={ref}
830
+ * {...props}
831
+ * type="text"
832
+ * value={value}
833
+ * onChange={(e) => setValue(e.target.value)}
834
+ * className="w-full p-3 border-2 rounded-lg"
835
+ * />
836
+ * </div>
837
+ * )
838
+ * )}
839
+ * </GiftCard.RecipientName>
840
+ * ```
841
+ */
842
+ export declare const RecipientName: React.ForwardRefExoticComponent<RecipientNameProps & React.RefAttributes<HTMLInputElement>>;
843
+ /**
844
+ * Data exposed by the RecipientDate component via render props
845
+ */
846
+ export interface GiftCardRecipientDateData {
847
+ /** Current delivery date value */
848
+ value: Date;
849
+ /** Formatted date string according to locale (e.g., "Dec 25, 2025") */
850
+ formattedValue: string;
851
+ /** Date value formatted for HTML date input (YYYY-MM-DD) */
852
+ inputValue: string;
853
+ /** Function to update the delivery date */
854
+ setValue: (date: Date) => void;
855
+ /** Whether the input should be visible (isGift is true) */
856
+ isVisible: boolean;
857
+ }
858
+ /**
859
+ * Props for the GiftCard RecipientDate component
860
+ */
861
+ export interface RecipientDateProps {
862
+ /** Label for the date input */
863
+ label?: string;
864
+ /** Whether to render as a child component */
865
+ asChild?: boolean;
866
+ /** Custom render function when using asChild */
867
+ children?: AsChildChildren<GiftCardRecipientDateData>;
868
+ /** CSS classes to apply to the default element */
869
+ className?: string;
870
+ }
871
+ /**
872
+ * Input for selecting gift card delivery date.
873
+ * Only renders when isGift is true (purchasing for someone else).
874
+ * Provides both raw Date value and locale-formatted string.
875
+ *
876
+ * @component
877
+ * @example
878
+ * ```tsx
879
+ * // Default usage
880
+ * <GiftCard.RecipientDate label="Delivery date" className="w-full p-3 border rounded-lg" />
881
+ *
882
+ * // asChild with primitive
883
+ * <GiftCard.RecipientDate label="Delivery date" asChild>
884
+ * <input type="date" className="w-full p-3 border-2 rounded-lg" />
885
+ * </GiftCard.RecipientDate>
886
+ *
887
+ * // asChild with react component - using inputValue for date input and formattedValue for display
888
+ * <GiftCard.RecipientDate>
889
+ * {React.forwardRef(({ value, formattedValue, inputValue, setValue, isVisible, ...props }, ref) =>
890
+ * isVisible && (
891
+ * <div className="space-y-2">
892
+ * <label className="text-sm font-medium">Delivery date</label>
893
+ * <input
894
+ * ref={ref}
895
+ * {...props}
896
+ * type="date"
897
+ * value={inputValue}
898
+ * onChange={(e) => setValue(new Date(e.target.value))}
899
+ * className="w-full p-3 border-2 rounded-lg"
900
+ * />
901
+ * <p className="text-xs text-muted">Selected: {formattedValue}</p>
902
+ * </div>
903
+ * )
904
+ * )}
905
+ * </GiftCard.RecipientDate>
906
+ * ```
907
+ */
908
+ export declare const RecipientDate: React.ForwardRefExoticComponent<RecipientDateProps & React.RefAttributes<HTMLInputElement>>;
909
+ /**
910
+ * Data exposed by the RecipientMessage component via render props
911
+ */
912
+ export interface GiftCardRecipientMessageData {
913
+ /** Current message value */
914
+ value: string;
915
+ /** Function to update the message value */
916
+ setValue: (value: string) => void;
917
+ /** Whether the input should be visible (isGift is true) */
918
+ isVisible: boolean;
919
+ }
920
+ /**
921
+ * Props for the GiftCard RecipientMessage component
922
+ */
923
+ export interface RecipientMessageProps {
924
+ /** Label for the message textarea */
925
+ label?: string;
926
+ /** Whether to render as a child component */
927
+ asChild?: boolean;
928
+ /** Custom render function when using asChild */
929
+ children?: AsChildChildren<GiftCardRecipientMessageData>;
930
+ /** CSS classes to apply to the default element */
931
+ className?: string;
932
+ }
933
+ /**
934
+ * Textarea for entering a personal message to include with the gift card.
935
+ * Only renders when isGift is true (purchasing for someone else).
936
+ * This field is optional - no validation is required.
937
+ *
938
+ * @component
939
+ * @example
940
+ * ```tsx
941
+ * // Default usage
942
+ * <GiftCard.RecipientMessage label="Message" className="w-full p-3 border rounded-lg" />
943
+ *
944
+ * // asChild with primitive
945
+ * <GiftCard.RecipientMessage label="Message" asChild>
946
+ * <textarea className="w-full p-3 border-2 rounded-lg resize-none" rows={4} />
947
+ * </GiftCard.RecipientMessage>
948
+ *
949
+ * // asChild with react component
950
+ * <GiftCard.RecipientMessage>
951
+ * {React.forwardRef(({ value, setValue, isVisible, ...props }, ref) =>
952
+ * isVisible && (
953
+ * <div className="space-y-2">
954
+ * <label className="text-sm font-medium">Message (optional)</label>
955
+ * <textarea
956
+ * ref={ref}
957
+ * {...props}
958
+ * value={value}
959
+ * onChange={(e) => setValue(e.target.value)}
960
+ * className="w-full p-3 border-2 rounded-lg resize-none"
961
+ * rows={4}
962
+ * />
963
+ * </div>
964
+ * )
965
+ * )}
966
+ * </GiftCard.RecipientMessage>
967
+ * ```
968
+ */
969
+ export declare const RecipientMessage: React.ForwardRefExoticComponent<RecipientMessageProps & React.RefAttributes<HTMLTextAreaElement>>;
970
+ /**
971
+ * Data exposed by the RecipientForm component via render props
972
+ */
973
+ export interface GiftCardRecipientFormData {
974
+ /** Whether the form should be visible (isGift is true) */
975
+ isVisible: boolean;
976
+ /** Whether to show validation errors (e.g., after form submission attempt) */
977
+ showErrors: boolean;
978
+ /** Email field data */
979
+ email: {
980
+ /** Current email value */
981
+ value: string;
982
+ /** Function to update the email value */
983
+ setValue: (value: string) => void;
984
+ /** Whether the email is valid */
985
+ isValid: boolean;
986
+ };
987
+ /** Name field data */
988
+ name: {
989
+ /** Current name value */
990
+ value: string;
991
+ /** Function to update the name value */
992
+ setValue: (value: string) => void;
993
+ };
994
+ /** Delivery date field data */
995
+ deliverAt: {
996
+ /** Current delivery date value */
997
+ value: Date;
998
+ /** Formatted date string according to locale (e.g., "Dec 25, 2025") */
999
+ formattedValue: string;
1000
+ /** Date value formatted for HTML date input (YYYY-MM-DD) */
1001
+ inputValue: string;
1002
+ /** Function to update the delivery date */
1003
+ setValue: (date: Date) => void;
1004
+ };
1005
+ /** Message field data */
1006
+ message: {
1007
+ /** Current message value */
1008
+ value: string;
1009
+ /** Function to update the message value */
1010
+ setValue: (value: string) => void;
1011
+ };
1012
+ }
1013
+ /**
1014
+ * Props for the GiftCard RecipientForm component
1015
+ */
1016
+ export interface RecipientFormProps {
1017
+ /** Label for the email input */
1018
+ emailLabel?: string;
1019
+ /** Label for the name input */
1020
+ nameLabel?: string;
1021
+ /** Label for the date input */
1022
+ dateLabel?: string;
1023
+ /** Label for the message textarea */
1024
+ messageLabel?: string;
1025
+ /** Whether to render as a child component */
1026
+ asChild?: boolean;
1027
+ /** Custom render function when using asChild */
1028
+ children?: AsChildChildren<GiftCardRecipientFormData>;
1029
+ /** CSS classes to apply to the default element */
1030
+ className?: string;
1031
+ }
1032
+ /**
1033
+ * Form for entering recipient details when purchasing a gift card for someone else.
1034
+ * Only renders when isGift is true (purchasing for someone else).
1035
+ *
1036
+ * This is a convenience component that combines all recipient fields (email, name, date, message).
1037
+ * For granular control over layout and styling, use the individual components:
1038
+ * `GiftCard.RecipientEmail`, `GiftCard.RecipientName`, `GiftCard.RecipientDate`, `GiftCard.RecipientMessage`.
1039
+ *
1040
+ * @component
1041
+ * @example
1042
+ * ```tsx
1043
+ * // Default usage
1044
+ * <GiftCard.RecipientForm
1045
+ * emailLabel="Recipient email"
1046
+ * nameLabel="Recipient name"
1047
+ * dateLabel="Delivery date"
1048
+ * messageLabel="Message"
1049
+ * className="space-y-4"
1050
+ * />
1051
+ *
1052
+ * // asChild with primitive
1053
+ * <GiftCard.RecipientForm
1054
+ * emailLabel="Recipient email"
1055
+ * nameLabel="Recipient name"
1056
+ * dateLabel="Delivery date"
1057
+ * messageLabel="Message"
1058
+ * asChild
1059
+ * >
1060
+ * <div className="space-y-6 p-6 bg-surface-secondary rounded-xl" />
1061
+ * </GiftCard.RecipientForm>
1062
+ *
1063
+ * // asChild with react component
1064
+ * <GiftCard.RecipientForm>
1065
+ * {React.forwardRef(({
1066
+ * isVisible,
1067
+ * showErrors,
1068
+ * email,
1069
+ * name,
1070
+ * deliverAt,
1071
+ * message,
1072
+ * ...props
1073
+ * }, ref) =>
1074
+ * isVisible && (
1075
+ * <div ref={ref} {...props} className="space-y-6 p-6 bg-surface-secondary rounded-xl">
1076
+ * <h3 className="text-lg font-semibold">Recipient Details</h3>
1077
+ *
1078
+ * <div className="space-y-2">
1079
+ * <label className="text-sm font-medium">
1080
+ * Recipient email <span className="text-status-error">*</span>
1081
+ * </label>
1082
+ * <input
1083
+ * type="email"
1084
+ * value={email.value}
1085
+ * onChange={(e) => email.setValue(e.target.value)}
1086
+ * data-invalid={showErrors && !email.isValid}
1087
+ * className="w-full p-3 border-2 rounded-lg data-[invalid]:border-status-error"
1088
+ * />
1089
+ * {showErrors && !email.isValid && (
1090
+ * <p className="text-sm text-status-error">Please enter a valid email</p>
1091
+ * )}
1092
+ * </div>
1093
+ *
1094
+ * <div className="space-y-2">
1095
+ * <label className="text-sm font-medium">Recipient name (optional)</label>
1096
+ * <input
1097
+ * type="text"
1098
+ * value={name.value}
1099
+ * onChange={(e) => name.setValue(e.target.value)}
1100
+ * className="w-full p-3 border-2 rounded-lg"
1101
+ * />
1102
+ * </div>
1103
+ *
1104
+ * <div className="space-y-2">
1105
+ * <label className="text-sm font-medium">Delivery date</label>
1106
+ * <input
1107
+ * type="date"
1108
+ * value={deliverAt.inputValue}
1109
+ * onChange={(e) => deliverAt.setValue(new Date(e.target.value))}
1110
+ * className="w-full p-3 border-2 rounded-lg"
1111
+ * />
1112
+ * <p className="text-xs text-content-muted">
1113
+ * Scheduled for: {deliverAt.formattedValue}
1114
+ * </p>
1115
+ * </div>
1116
+ *
1117
+ * <div className="space-y-2">
1118
+ * <label className="text-sm font-medium">Message (optional)</label>
1119
+ * <textarea
1120
+ * value={message.value}
1121
+ * onChange={(e) => message.setValue(e.target.value)}
1122
+ * className="w-full p-3 border-2 rounded-lg resize-none"
1123
+ * rows={4}
1124
+ * />
1125
+ * </div>
1126
+ * </div>
1127
+ * )
1128
+ * )}
1129
+ * </GiftCard.RecipientForm>
1130
+ * ```
1131
+ */
1132
+ export declare const RecipientForm: React.ForwardRefExoticComponent<RecipientFormProps & React.RefAttributes<HTMLElement>>;
1133
+ /**
1134
+ * Data exposed by the GiftCard.Action.AddToCart component via render props
1135
+ */
1136
+ export interface GiftCardActionAddToCartData {
1137
+ /** Function to execute add to cart (validates first, then adds) */
1138
+ onClick: () => Promise<void>;
1139
+ /** Whether the add to cart action is currently loading */
1140
+ isLoading: boolean;
1141
+ }
1142
+ /**
1143
+ * Props for the GiftCard Action.AddToCart component
1144
+ */
1145
+ export interface ActionAddToCartProps {
1146
+ /** Label for the button */
1147
+ label?: string;
1148
+ /** Label to show while loading */
1149
+ loadingLabel?: string;
1150
+ /** Whether to render as a child component */
1151
+ asChild?: boolean;
1152
+ /** Custom render function when using asChild */
1153
+ children?: AsChildChildren<GiftCardActionAddToCartData>;
1154
+ /** CSS classes to apply to the default element */
1155
+ className?: string;
1156
+ /** Callback fired after successful add to cart */
1157
+ onSuccess?: () => void | Promise<void>;
1158
+ }
1159
+ /**
1160
+ * Add to cart button for gift cards.
1161
+ * Validates the form (triggers showErrors), then adds the gift card to cart.
1162
+ *
1163
+ * Validation flow:
1164
+ * 1. When clicked, sets showErrors to true (makes validation errors visible)
1165
+ * 2. Checks if form is valid (variant selected, valid custom amount, valid email if gift)
1166
+ * 3. If invalid, exits early (user sees validation errors)
1167
+ * 4. If valid, adds the gift card line items to cart
1168
+ *
1169
+ * @component
1170
+ * @example
1171
+ * ```tsx
1172
+ * // Default usage
1173
+ * <GiftCard.Action.AddToCart
1174
+ * label="Add to Cart"
1175
+ * loadingLabel="Adding..."
1176
+ * className="w-full py-4 bg-brand-primary text-white rounded-xl font-semibold"
1177
+ * />
1178
+ *
1179
+ * // asChild with primitive
1180
+ * <GiftCard.Action.AddToCart asChild>
1181
+ * <button className="w-full py-4 bg-brand-primary text-white rounded-xl font-semibold" />
1182
+ * </GiftCard.Action.AddToCart>
1183
+ *
1184
+ * // asChild with react component (full control)
1185
+ * <GiftCard.Action.AddToCart asChild>
1186
+ * {React.forwardRef(({ onClick, isLoading, ...props }, ref) => (
1187
+ * <button
1188
+ * ref={ref}
1189
+ * {...props}
1190
+ * onClick={onClick}
1191
+ * disabled={isLoading}
1192
+ * className="w-full py-4 bg-brand-primary text-white rounded-xl font-semibold disabled:opacity-50"
1193
+ * >
1194
+ * {isLoading ? (
1195
+ * <span className="flex items-center justify-center gap-2">
1196
+ * <Spinner className="w-5 h-5" />
1197
+ * Adding to cart...
1198
+ * </span>
1199
+ * ) : (
1200
+ * 'Add to Cart'
1201
+ * )}
1202
+ * </button>
1203
+ * ))}
1204
+ * </GiftCard.Action.AddToCart>
1205
+ *
1206
+ * // With success callback
1207
+ * <GiftCard.Action.AddToCart
1208
+ * label="Add to Cart"
1209
+ * onSuccess={() => {
1210
+ * toast.success('Added to cart!');
1211
+ * }}
1212
+ * />
1213
+ * ```
1214
+ */
1215
+ export declare const ActionAddToCart: React.ForwardRefExoticComponent<ActionAddToCartProps & React.RefAttributes<HTMLButtonElement>>;
1216
+ /**
1217
+ * Data exposed by the GiftCard.Action.BuyNow component via render props
1218
+ */
1219
+ export interface GiftCardActionBuyNowData {
1220
+ /** Function to execute buy now (validates first, then redirects to checkout) */
1221
+ onClick: () => Promise<void>;
1222
+ /** Whether the buy now action is currently loading */
1223
+ isLoading: boolean;
1224
+ }
1225
+ /**
1226
+ * Props for the GiftCard Action.BuyNow component
1227
+ */
1228
+ export interface ActionBuyNowProps {
1229
+ /** Label for the button */
1230
+ label?: string;
1231
+ /** Label to show while loading */
1232
+ loadingLabel?: string;
1233
+ /** Whether to render as a child component */
1234
+ asChild?: boolean;
1235
+ /** Custom render function when using asChild */
1236
+ children?: AsChildChildren<GiftCardActionBuyNowData>;
1237
+ /** CSS classes to apply to the default element */
1238
+ className?: string;
1239
+ }
1240
+ /**
1241
+ * Buy now button for gift cards.
1242
+ * Validates the form (triggers showErrors), then redirects to checkout.
1243
+ *
1244
+ * Validation flow:
1245
+ * 1. When clicked, sets showErrors to true (makes validation errors visible)
1246
+ * 2. Checks if form is valid (variant selected, valid custom amount, valid email if gift)
1247
+ * 3. If invalid, exits early (user sees validation errors)
1248
+ * 4. If valid, redirects to checkout with the gift card line items
1249
+ *
1250
+ * @component
1251
+ * @example
1252
+ * ```tsx
1253
+ * // Default usage
1254
+ * <GiftCard.Action.BuyNow
1255
+ * label="Buy Now"
1256
+ * loadingLabel="Processing..."
1257
+ * className="w-full py-4 bg-brand-primary text-white rounded-xl font-semibold"
1258
+ * />
1259
+ *
1260
+ * // asChild with primitive
1261
+ * <GiftCard.Action.BuyNow asChild>
1262
+ * <button className="w-full py-4 bg-brand-primary text-white rounded-xl font-semibold" />
1263
+ * </GiftCard.Action.BuyNow>
1264
+ *
1265
+ * // asChild with react component (full control)
1266
+ * <GiftCard.Action.BuyNow asChild>
1267
+ * {React.forwardRef(({ onClick, isLoading, ...props }, ref) => (
1268
+ * <button
1269
+ * ref={ref}
1270
+ * {...props}
1271
+ * onClick={onClick}
1272
+ * disabled={isLoading}
1273
+ * className="w-full py-4 bg-brand-primary text-white rounded-xl font-semibold disabled:opacity-50"
1274
+ * >
1275
+ * {isLoading ? (
1276
+ * <span className="flex items-center justify-center gap-2">
1277
+ * <Spinner className="w-5 h-5" />
1278
+ * Processing...
1279
+ * </span>
1280
+ * ) : (
1281
+ * 'Buy Now'
1282
+ * )}
1283
+ * </button>
1284
+ * ))}
1285
+ * </GiftCard.Action.BuyNow>
1286
+ * ```
1287
+ */
1288
+ export declare const ActionBuyNow: React.ForwardRefExoticComponent<ActionBuyNowProps & React.RefAttributes<HTMLButtonElement>>;
1289
+ /**
1290
+ * Namespace containing all gift card action components.
1291
+ * These components provide consistent interfaces for gift card purchase actions.
1292
+ *
1293
+ * @namespace
1294
+ * @example
1295
+ * ```tsx
1296
+ * // Add to cart with validation
1297
+ * <GiftCard.Action.AddToCart
1298
+ * label="Add to Cart"
1299
+ * loadingLabel="Adding..."
1300
+ * className="btn-primary"
1301
+ * />
1302
+ *
1303
+ * // Buy now with validation
1304
+ * <GiftCard.Action.BuyNow
1305
+ * label="Buy Now"
1306
+ * loadingLabel="Processing..."
1307
+ * className="btn-primary"
1308
+ * />
1309
+ * ```
1310
+ */
1311
+ export declare const Action: {
1312
+ /** Add to Cart button for adding gift card to the current cart */
1313
+ readonly AddToCart: React.ForwardRefExoticComponent<ActionAddToCartProps & React.RefAttributes<HTMLButtonElement>>;
1314
+ /** Buy Now button for immediate checkout with the gift card */
1315
+ readonly BuyNow: React.ForwardRefExoticComponent<ActionBuyNowProps & React.RefAttributes<HTMLButtonElement>>;
1316
+ };
1317
+ export {};
1318
+ //# sourceMappingURL=GiftCard.d.ts.map