@gamifyio/react 0.1.0

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.
@@ -0,0 +1,892 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import { GamifyConfig, Gamify, SessionResponse, CartItem, LoyaltyProfile, LoyaltyHistoryResponse, AffiliateStats as AffiliateStats$1, LeaderboardResponse, QuestWithProgress, StreakWithProgress, StreaksResponse, FreezeResponse, BadgeWithStatus, BadgesResponse, RewardItem, RedemptionResult, LeaderboardEntry } from '@gamifyio/core';
4
+ export { AffiliateEarnings, AffiliateStats as AffiliateStatsData, AffiliateTier, AppliedEffect, BadgeRarity, BadgeWithStatus, BadgesResponse, CartItem, FreezeResponse, GamifyConfig, GamifyEvent, LeaderboardEntry, LeaderboardResponse, LoyaltyHistoryResponse, LoyaltyProfile, LoyaltyTier, LoyaltyTransaction, QuestStep, QuestWithProgress, QuestsResponse, RedemptionResult, RewardItem, RewardsStoreResponse, SessionResponse, StreakMilestone, StreakWithProgress, StreaksResponse, UserTraits } from '@gamifyio/core';
5
+
6
+ /**
7
+ * Context value for Gamify React SDK
8
+ */
9
+ interface GamifyContextValue {
10
+ /** The underlying Gamify client instance */
11
+ client: Gamify;
12
+ /** Track an event */
13
+ track: (eventType: string, properties?: Record<string, unknown>) => void;
14
+ /** Identify a user */
15
+ identify: (userId: string, traits?: Record<string, unknown>) => void;
16
+ /** Reset user identity */
17
+ reset: () => void;
18
+ /** Get current user ID */
19
+ getUserId: () => string | null;
20
+ /** Get anonymous ID */
21
+ getAnonymousId: () => string;
22
+ }
23
+ /**
24
+ * Props for GamifyProvider
25
+ */
26
+ interface GamifyProviderProps {
27
+ /** Gamify SDK configuration */
28
+ config: GamifyConfig;
29
+ /** Child components */
30
+ children: ReactNode;
31
+ }
32
+ /**
33
+ * GamifyProvider - Initializes and provides Gamify SDK to React components
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * <GamifyProvider config={{ apiKey: 'your-api-key' }}>
38
+ * <App />
39
+ * </GamifyProvider>
40
+ * ```
41
+ */
42
+ declare function GamifyProvider({ config, children }: GamifyProviderProps): react_jsx_runtime.JSX.Element;
43
+
44
+ /**
45
+ * useGamify - Hook to access Gamify SDK methods
46
+ *
47
+ * @throws Error if used outside of GamifyProvider
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * function MyComponent() {
52
+ * const { track, identify } = useGamify();
53
+ *
54
+ * const handleClick = () => {
55
+ * track('button_click', { buttonId: 'submit' });
56
+ * };
57
+ *
58
+ * return <button onClick={handleClick}>Submit</button>;
59
+ * }
60
+ * ```
61
+ */
62
+ declare function useGamify(): GamifyContextValue;
63
+ /**
64
+ * useTrack - Hook for tracking events
65
+ *
66
+ * Returns a memoized track function that can be safely used in dependencies.
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * function MyComponent() {
71
+ * const track = useTrack();
72
+ *
73
+ * useEffect(() => {
74
+ * track('component_viewed', { componentName: 'MyComponent' });
75
+ * }, [track]);
76
+ *
77
+ * return <div>...</div>;
78
+ * }
79
+ * ```
80
+ */
81
+ declare function useTrack(): (eventType: string, properties?: Record<string, unknown>) => void;
82
+ /**
83
+ * useIdentify - Hook for identifying users
84
+ *
85
+ * Returns a memoized identify function.
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * function LoginButton() {
90
+ * const identify = useIdentify();
91
+ *
92
+ * const handleLogin = async (user: User) => {
93
+ * await loginUser(user);
94
+ * identify(user.id, { email: user.email, name: user.name });
95
+ * };
96
+ *
97
+ * return <button onClick={handleLogin}>Login</button>;
98
+ * }
99
+ * ```
100
+ */
101
+ declare function useIdentify(): (userId: string, traits?: Record<string, unknown>) => void;
102
+ interface SessionState {
103
+ session: SessionResponse | null;
104
+ loading: boolean;
105
+ error: string | null;
106
+ }
107
+ interface SessionActions {
108
+ updateCart: (items: CartItem[], coupons?: string[], currency?: string) => Promise<void>;
109
+ applyCoupon: (code: string) => Promise<void>;
110
+ complete: () => Promise<void>;
111
+ clearSession: () => void;
112
+ refresh: () => Promise<void>;
113
+ }
114
+ /**
115
+ * useSession - Hook for managing cart sessions with discounts
116
+ *
117
+ * @example
118
+ * ```tsx
119
+ * function CartPage() {
120
+ * const { session, loading, updateCart, applyCoupon, complete } = useSession();
121
+ *
122
+ * const handleAddItem = async (item: CartItem) => {
123
+ * const items = [...(session?.items || []), item];
124
+ * await updateCart(items);
125
+ * };
126
+ *
127
+ * return (
128
+ * <div>
129
+ * {loading && <Spinner />}
130
+ * <p>Subtotal: ${session?.subtotal}</p>
131
+ * <p>Discount: ${session?.discount}</p>
132
+ * <p>Total: ${session?.total}</p>
133
+ * </div>
134
+ * );
135
+ * }
136
+ * ```
137
+ */
138
+ declare function useSession(): SessionState & SessionActions;
139
+ interface LoyaltyState {
140
+ profile: LoyaltyProfile | null;
141
+ history: LoyaltyHistoryResponse | null;
142
+ loading: boolean;
143
+ error: string | null;
144
+ }
145
+ interface LoyaltyActions {
146
+ refreshProfile: () => Promise<void>;
147
+ refreshHistory: (limit?: number, offset?: number) => Promise<void>;
148
+ }
149
+ /**
150
+ * useLoyalty - Hook for managing customer loyalty data
151
+ *
152
+ * @param options - Auto-refresh options
153
+ *
154
+ * @example
155
+ * ```tsx
156
+ * function LoyaltyDashboard() {
157
+ * const { profile, history, loading, refreshProfile } = useLoyalty({
158
+ * autoRefresh: true,
159
+ * });
160
+ *
161
+ * return (
162
+ * <div>
163
+ * {loading && <Spinner />}
164
+ * <p>Points: {profile?.points}</p>
165
+ * <p>Tier: {profile?.tier?.name}</p>
166
+ * <p>Next tier: {profile?.nextTier?.name} ({profile?.nextTier?.pointsNeeded} points needed)</p>
167
+ * </div>
168
+ * );
169
+ * }
170
+ * ```
171
+ */
172
+ declare function useLoyalty(options?: {
173
+ autoRefresh?: boolean;
174
+ }): LoyaltyState & LoyaltyActions;
175
+ interface ReferralState {
176
+ referrerCode: string | null;
177
+ hasReferrer: boolean;
178
+ }
179
+ interface ReferralActions {
180
+ setReferrer: (code: string) => void;
181
+ clearReferrer: () => void;
182
+ detectFromUrl: () => string | null;
183
+ }
184
+ /**
185
+ * useReferral - Hook for managing referral attribution
186
+ *
187
+ * Automatically detects `?ref=code` parameter from URLs and stores
188
+ * the referrer code in localStorage for attribution tracking.
189
+ *
190
+ * @example
191
+ * ```tsx
192
+ * function SignupPage() {
193
+ * const { referrerCode, hasReferrer, setReferrer } = useReferral();
194
+ *
195
+ * useEffect(() => {
196
+ * if (hasReferrer) {
197
+ * console.log('User was referred by:', referrerCode);
198
+ * }
199
+ * }, [hasReferrer, referrerCode]);
200
+ *
201
+ * return (
202
+ * <div>
203
+ * {hasReferrer && <p>Thanks for using referral code: {referrerCode}</p>}
204
+ * </div>
205
+ * );
206
+ * }
207
+ * ```
208
+ */
209
+ declare function useReferral(): ReferralState & ReferralActions;
210
+ interface AffiliateState {
211
+ stats: AffiliateStats$1 | null;
212
+ loading: boolean;
213
+ error: string | null;
214
+ }
215
+ interface AffiliateActions {
216
+ refreshStats: (forceRefresh?: boolean) => Promise<void>;
217
+ }
218
+ /**
219
+ * useAffiliateStats - Hook for fetching user affiliate statistics
220
+ *
221
+ * @param options - Configuration options
222
+ *
223
+ * @example
224
+ * ```tsx
225
+ * function AffiliateDashboard() {
226
+ * const { stats, loading, error, refreshStats } = useAffiliateStats({
227
+ * autoRefresh: true,
228
+ * });
229
+ *
230
+ * if (loading) return <Spinner />;
231
+ * if (error) return <Error message={error} />;
232
+ *
233
+ * return (
234
+ * <div>
235
+ * <p>Your referral code: {stats?.referralCode}</p>
236
+ * <p>Referrals: {stats?.referralCount}</p>
237
+ * <p>Total earnings: ${(stats?.earnings.totalEarned ?? 0) / 100}</p>
238
+ * <p>Current tier: {stats?.tier?.name ?? 'None'}</p>
239
+ * </div>
240
+ * );
241
+ * }
242
+ * ```
243
+ */
244
+ declare function useAffiliateStats(options?: {
245
+ autoRefresh?: boolean;
246
+ }): AffiliateState & AffiliateActions;
247
+ interface LeaderboardState {
248
+ leaderboard: LeaderboardResponse | null;
249
+ loading: boolean;
250
+ error: string | null;
251
+ }
252
+ interface LeaderboardActions {
253
+ refresh: (limit?: number) => Promise<void>;
254
+ }
255
+ /**
256
+ * useLeaderboard - Hook for fetching affiliate leaderboard data
257
+ *
258
+ * @param limit - Number of entries to fetch (default: 10)
259
+ *
260
+ * @example
261
+ * ```tsx
262
+ * function LeaderboardPage() {
263
+ * const { leaderboard, loading, error, refresh } = useLeaderboard(10);
264
+ *
265
+ * useEffect(() => {
266
+ * refresh();
267
+ * }, [refresh]);
268
+ *
269
+ * if (loading) return <Spinner />;
270
+ * if (error) return <Error message={error} />;
271
+ *
272
+ * return (
273
+ * <ol>
274
+ * {leaderboard?.entries.map((entry) => (
275
+ * <li key={entry.userId}>
276
+ * #{entry.rank} - {entry.displayName}: {entry.referralCount} referrals
277
+ * </li>
278
+ * ))}
279
+ * </ol>
280
+ * );
281
+ * }
282
+ * ```
283
+ */
284
+ declare function useLeaderboard(limit?: number): LeaderboardState & LeaderboardActions;
285
+ interface QuestsState {
286
+ quests: QuestWithProgress[];
287
+ loading: boolean;
288
+ error: string | null;
289
+ }
290
+ interface QuestsActions {
291
+ refresh: () => Promise<void>;
292
+ }
293
+ /**
294
+ * useQuests - Hook for fetching user's quest progress
295
+ *
296
+ * @param options - Configuration options
297
+ *
298
+ * @example
299
+ * ```tsx
300
+ * function QuestsPage() {
301
+ * const { quests, loading, error, refresh } = useQuests({ autoRefresh: true });
302
+ *
303
+ * if (loading) return <Spinner />;
304
+ * if (error) return <Error message={error} />;
305
+ *
306
+ * return (
307
+ * <div>
308
+ * {quests.map((quest) => (
309
+ * <div key={quest.id}>
310
+ * <h3>{quest.name}</h3>
311
+ * <p>Progress: {quest.percentComplete}%</p>
312
+ * <p>Status: {quest.status}</p>
313
+ * </div>
314
+ * ))}
315
+ * </div>
316
+ * );
317
+ * }
318
+ * ```
319
+ */
320
+ declare function useQuests(options?: {
321
+ autoRefresh?: boolean;
322
+ }): QuestsState & QuestsActions;
323
+ interface StreaksState {
324
+ streaks: StreakWithProgress[];
325
+ stats: StreaksResponse['stats'] | null;
326
+ loading: boolean;
327
+ error: string | null;
328
+ }
329
+ interface StreaksActions {
330
+ refresh: () => Promise<void>;
331
+ freeze: (ruleId: string) => Promise<FreezeResponse | null>;
332
+ }
333
+ /**
334
+ * useStreaks - Hook for managing user's streak progress
335
+ *
336
+ * @param options - Configuration options
337
+ *
338
+ * @example
339
+ * ```tsx
340
+ * function StreaksPage() {
341
+ * const { streaks, stats, loading, freeze } = useStreaks({ autoRefresh: true });
342
+ *
343
+ * return (
344
+ * <div>
345
+ * <p>Active streaks: {stats?.totalActive}</p>
346
+ * {streaks.map((streak) => (
347
+ * <div key={streak.id}>
348
+ * <span>🔥 {streak.currentCount}</span>
349
+ * <span>{streak.name}</span>
350
+ * {streak.freezeInventory > 0 && (
351
+ * <button onClick={() => freeze(streak.id)}>
352
+ * Use Freeze ({streak.freezeInventory} left)
353
+ * </button>
354
+ * )}
355
+ * </div>
356
+ * ))}
357
+ * </div>
358
+ * );
359
+ * }
360
+ * ```
361
+ */
362
+ declare function useStreaks(options?: {
363
+ autoRefresh?: boolean;
364
+ }): StreaksState & StreaksActions;
365
+ interface BadgesState {
366
+ badges: BadgeWithStatus[];
367
+ stats: BadgesResponse['stats'] | null;
368
+ earned: BadgeWithStatus[];
369
+ locked: BadgeWithStatus[];
370
+ loading: boolean;
371
+ error: string | null;
372
+ }
373
+ interface BadgesActions {
374
+ refresh: (category?: string) => Promise<void>;
375
+ }
376
+ /**
377
+ * useBadges - Hook for fetching user's badge collection
378
+ *
379
+ * @param options - Configuration options
380
+ *
381
+ * @example
382
+ * ```tsx
383
+ * function BadgesPage() {
384
+ * const { badges, earned, locked, stats, loading } = useBadges({ autoRefresh: true });
385
+ *
386
+ * return (
387
+ * <div>
388
+ * <p>Unlocked: {stats?.unlocked} / {stats?.total}</p>
389
+ * <div className="grid">
390
+ * {badges.map((badge) => (
391
+ * <div key={badge.id} className={badge.isUnlocked ? '' : 'grayscale'}>
392
+ * <img src={badge.iconUrl} alt={badge.name} />
393
+ * <span>{badge.name}</span>
394
+ * <span className={`rarity-${badge.rarity.toLowerCase()}`}>
395
+ * {badge.rarity}
396
+ * </span>
397
+ * </div>
398
+ * ))}
399
+ * </div>
400
+ * </div>
401
+ * );
402
+ * }
403
+ * ```
404
+ */
405
+ declare function useBadges(options?: {
406
+ autoRefresh?: boolean;
407
+ category?: string;
408
+ }): BadgesState & BadgesActions;
409
+ interface RewardsState {
410
+ items: RewardItem[];
411
+ userPoints: number;
412
+ available: RewardItem[];
413
+ unavailable: RewardItem[];
414
+ loading: boolean;
415
+ error: string | null;
416
+ }
417
+ interface RewardsActions {
418
+ refresh: () => Promise<void>;
419
+ redeem: (itemId: string) => Promise<RedemptionResult | null>;
420
+ }
421
+ /**
422
+ * useRewards - Hook for fetching and redeeming rewards
423
+ *
424
+ * @param options - Configuration options
425
+ *
426
+ * @example
427
+ * ```tsx
428
+ * function RewardsStore() {
429
+ * const { items, userPoints, loading, redeem } = useRewards({ autoRefresh: true });
430
+ *
431
+ * const handleRedeem = async (itemId: string) => {
432
+ * const result = await redeem(itemId);
433
+ * if (result?.success) {
434
+ * alert('Reward redeemed!');
435
+ * }
436
+ * };
437
+ *
438
+ * return (
439
+ * <div>
440
+ * <p>Your points: {userPoints}</p>
441
+ * <div className="grid">
442
+ * {items.map((item) => (
443
+ * <div key={item.id}>
444
+ * <img src={item.imageUrl} alt={item.name} />
445
+ * <span>{item.name}</span>
446
+ * <span>{item.pointsCost} points</span>
447
+ * <button
448
+ * disabled={!item.isAvailable}
449
+ * onClick={() => handleRedeem(item.id)}
450
+ * >
451
+ * {item.canAfford ? 'Redeem' : `Need ${item.pointsCost - userPoints} more`}
452
+ * </button>
453
+ * </div>
454
+ * ))}
455
+ * </div>
456
+ * </div>
457
+ * );
458
+ * }
459
+ * ```
460
+ */
461
+ declare function useRewards(options?: {
462
+ autoRefresh?: boolean;
463
+ }): RewardsState & RewardsActions;
464
+
465
+ /**
466
+ * Props for GamifyPageView component
467
+ */
468
+ interface GamifyPageViewProps {
469
+ /** Custom page name (defaults to document.title or window.location.pathname) */
470
+ pageName?: string;
471
+ /** Additional properties to include with page view events */
472
+ properties?: Record<string, unknown>;
473
+ /** Track on route changes (for SPAs) - requires pathname prop */
474
+ pathname?: string;
475
+ }
476
+ /**
477
+ * GamifyPageView - Component for automatic page view tracking
478
+ *
479
+ * Place this component in your layout or page components to automatically
480
+ * track page views. For SPAs using Next.js App Router, pass the pathname
481
+ * from usePathname() to track route changes.
482
+ *
483
+ * @example
484
+ * ```tsx
485
+ * // Basic usage - tracks on mount
486
+ * function Page() {
487
+ * return (
488
+ * <>
489
+ * <GamifyPageView />
490
+ * <div>Page content</div>
491
+ * </>
492
+ * );
493
+ * }
494
+ *
495
+ * // With Next.js App Router
496
+ * 'use client';
497
+ * import { usePathname } from 'next/navigation';
498
+ *
499
+ * function Layout({ children }) {
500
+ * const pathname = usePathname();
501
+ * return (
502
+ * <>
503
+ * <GamifyPageView pathname={pathname} />
504
+ * {children}
505
+ * </>
506
+ * );
507
+ * }
508
+ *
509
+ * // With custom properties
510
+ * function ProductPage({ productId }) {
511
+ * return (
512
+ * <>
513
+ * <GamifyPageView
514
+ * pageName="Product Detail"
515
+ * properties={{ productId, category: 'electronics' }}
516
+ * />
517
+ * <div>Product content</div>
518
+ * </>
519
+ * );
520
+ * }
521
+ * ```
522
+ */
523
+ declare function GamifyPageView({ pageName, properties, pathname, }: GamifyPageViewProps): null;
524
+ /**
525
+ * Props for GamifyTrackClick component
526
+ */
527
+ interface GamifyTrackClickProps {
528
+ /** Event type to track */
529
+ eventType: string;
530
+ /** Properties to include with the event */
531
+ properties?: Record<string, unknown>;
532
+ /** Child element (must accept onClick) */
533
+ children: React.ReactElement<{
534
+ onClick?: (e: React.MouseEvent) => void;
535
+ }>;
536
+ }
537
+ /**
538
+ * GamifyTrackClick - Component wrapper for click tracking
539
+ *
540
+ * Wraps a child element and tracks clicks automatically.
541
+ *
542
+ * @example
543
+ * ```tsx
544
+ * <GamifyTrackClick
545
+ * eventType="button_click"
546
+ * properties={{ buttonId: 'subscribe', location: 'header' }}
547
+ * >
548
+ * <button>Subscribe</button>
549
+ * </GamifyTrackClick>
550
+ * ```
551
+ */
552
+ declare function GamifyTrackClick({ eventType, properties, children, }: GamifyTrackClickProps): React.ReactElement<{
553
+ onClick?: (e: React.MouseEvent) => void;
554
+ }, string | React.JSXElementConstructor<any>>;
555
+ /**
556
+ * Props for AffiliateStats component
557
+ */
558
+ interface AffiliateStatsProps {
559
+ /** Custom CSS class name */
560
+ className?: string;
561
+ /** Custom styles override */
562
+ style?: React.CSSProperties;
563
+ /** Theme customization */
564
+ theme?: {
565
+ cardBackground?: string;
566
+ cardBorder?: string;
567
+ valueColor?: string;
568
+ labelColor?: string;
569
+ };
570
+ /** Auto-refresh stats on mount */
571
+ autoRefresh?: boolean;
572
+ /** Custom render for loading state */
573
+ renderLoading?: () => React.ReactNode;
574
+ /** Custom render for error state */
575
+ renderError?: (error: string) => React.ReactNode;
576
+ }
577
+ /**
578
+ * AffiliateStats - Display grid with affiliate statistics
579
+ *
580
+ * Shows referral count, clicks, and earnings in a card layout.
581
+ * Headless-first: unstyled by default but includes sensible defaults.
582
+ *
583
+ * @example
584
+ * ```tsx
585
+ * <AffiliateStats autoRefresh />
586
+ *
587
+ * // With custom theme
588
+ * <AffiliateStats
589
+ * theme={{ cardBackground: '#1a1a1a', valueColor: '#fff' }}
590
+ * />
591
+ * ```
592
+ */
593
+ declare function AffiliateStats({ className, style, theme, autoRefresh, renderLoading, renderError, }: AffiliateStatsProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
594
+ /**
595
+ * Props for Leaderboard component
596
+ */
597
+ interface LeaderboardProps {
598
+ /** Number of entries to display (default: 10) */
599
+ limit?: number;
600
+ /** Custom CSS class name */
601
+ className?: string;
602
+ /** Custom styles override */
603
+ style?: React.CSSProperties;
604
+ /** Current user ID for highlighting */
605
+ currentUserId?: string;
606
+ /** Custom empty state message */
607
+ emptyMessage?: string;
608
+ /** Theme customization */
609
+ theme?: {
610
+ rowBackground?: string;
611
+ highlightBackground?: string;
612
+ textColor?: string;
613
+ secondaryColor?: string;
614
+ };
615
+ /** Custom render for each row */
616
+ renderRow?: (entry: LeaderboardEntry, isCurrentUser: boolean) => React.ReactNode;
617
+ /** Custom render for loading state */
618
+ renderLoading?: () => React.ReactNode;
619
+ /** Custom render for error state */
620
+ renderError?: (error: string) => React.ReactNode;
621
+ }
622
+ /**
623
+ * Leaderboard - Ranked affiliate leaderboard display
624
+ *
625
+ * Shows ranked list of top affiliates with referral counts.
626
+ * Highlights the current user if their ID is provided.
627
+ *
628
+ * @example
629
+ * ```tsx
630
+ * <Leaderboard limit={10} currentUserId={userId} />
631
+ *
632
+ * // With custom render
633
+ * <Leaderboard
634
+ * renderRow={(entry, isCurrent) => (
635
+ * <div className={isCurrent ? 'highlight' : ''}>
636
+ * #{entry.rank} - {entry.displayName}
637
+ * </div>
638
+ * )}
639
+ * />
640
+ * ```
641
+ */
642
+ declare function Leaderboard({ limit, className, style, currentUserId, emptyMessage, theme, renderRow, renderLoading, renderError, }: LeaderboardProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
643
+ /**
644
+ * Props for ReferralLink component
645
+ */
646
+ interface ReferralLinkProps {
647
+ /** Base URL for referral link (defaults to current origin) */
648
+ baseUrl?: string;
649
+ /** Custom CSS class name */
650
+ className?: string;
651
+ /** Custom styles override */
652
+ style?: React.CSSProperties;
653
+ /** Text for copy button */
654
+ copyButtonText?: string;
655
+ /** Text shown after copying */
656
+ copiedText?: string;
657
+ /** Text for share button (mobile only) */
658
+ shareButtonText?: string;
659
+ /** Share title */
660
+ shareTitle?: string;
661
+ /** Share text */
662
+ shareText?: string;
663
+ /** Show share button on mobile */
664
+ showShareButton?: boolean;
665
+ /** Theme customization */
666
+ theme?: {
667
+ inputBackground?: string;
668
+ inputBorder?: string;
669
+ inputColor?: string;
670
+ buttonBackground?: string;
671
+ buttonColor?: string;
672
+ };
673
+ /** Callback when link is copied */
674
+ onCopy?: (link: string) => void;
675
+ /** Callback when link is shared */
676
+ onShare?: (link: string) => void;
677
+ }
678
+ /**
679
+ * ReferralLink - Input field with user's referral code and copy/share buttons
680
+ *
681
+ * Displays the user's unique referral link with easy copy functionality.
682
+ * Includes native share button for mobile devices.
683
+ *
684
+ * @example
685
+ * ```tsx
686
+ * <ReferralLink />
687
+ *
688
+ * // With custom base URL
689
+ * <ReferralLink
690
+ * baseUrl="https://myapp.com/signup"
691
+ * shareTitle="Join my app!"
692
+ * shareText="Sign up using my referral link"
693
+ * />
694
+ * ```
695
+ */
696
+ declare function ReferralLink({ baseUrl, className, style, copyButtonText, copiedText, shareButtonText, shareTitle, shareText, showShareButton, theme, onCopy, onShare, }: ReferralLinkProps): react_jsx_runtime.JSX.Element | null;
697
+ /**
698
+ * Props for QuestProgress component
699
+ */
700
+ interface QuestProgressProps {
701
+ /** Specific quest ID to display (shows all if not provided) */
702
+ questId?: string;
703
+ /** Hide completed quests */
704
+ hideCompleted?: boolean;
705
+ /** Custom CSS class name */
706
+ className?: string;
707
+ /** Custom styles override */
708
+ style?: React.CSSProperties;
709
+ /** Callback when a quest is completed */
710
+ onComplete?: (quest: QuestWithProgress) => void;
711
+ /** Theme customization */
712
+ theme?: {
713
+ cardBackground?: string;
714
+ cardBorder?: string;
715
+ progressColor?: string;
716
+ textColor?: string;
717
+ };
718
+ /** Custom render for loading state */
719
+ renderLoading?: () => React.ReactNode;
720
+ /** Custom render for error state */
721
+ renderError?: (error: string) => React.ReactNode;
722
+ /** Custom render for each quest */
723
+ renderQuest?: (quest: QuestWithProgress) => React.ReactNode;
724
+ }
725
+ /**
726
+ * QuestProgress - Display quest progress with step checklist
727
+ *
728
+ * Shows quest name, description, progress bar, and step completion status.
729
+ *
730
+ * @example
731
+ * ```tsx
732
+ * <QuestProgress hideCompleted onComplete={(quest) => console.log('Completed:', quest.name)} />
733
+ * ```
734
+ */
735
+ declare function QuestProgress({ questId, hideCompleted, className, style, onComplete, theme, renderLoading, renderError, renderQuest, }: QuestProgressProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
736
+ /**
737
+ * Props for StreakFlame component
738
+ */
739
+ interface StreakFlameProps {
740
+ /** Specific streak rule ID to display */
741
+ ruleId?: string;
742
+ /** Size variant */
743
+ size?: 'sm' | 'md' | 'lg';
744
+ /** Show freeze button */
745
+ showFreezeButton?: boolean;
746
+ /** Custom CSS class name */
747
+ className?: string;
748
+ /** Custom styles override */
749
+ style?: React.CSSProperties;
750
+ /** Callback when freeze is used */
751
+ onFreeze?: (ruleId: string, remainingFreezes: number) => void;
752
+ /** Theme customization */
753
+ theme?: {
754
+ flameColor?: string;
755
+ countColor?: string;
756
+ cardBackground?: string;
757
+ };
758
+ /** Custom render for loading state */
759
+ renderLoading?: () => React.ReactNode;
760
+ /** Custom render for error state */
761
+ renderError?: (error: string) => React.ReactNode;
762
+ }
763
+ /**
764
+ * StreakFlame - Display streak counter with flame icon
765
+ *
766
+ * Shows current streak count with status indicator and optional freeze button.
767
+ *
768
+ * @example
769
+ * ```tsx
770
+ * <StreakFlame showFreezeButton onFreeze={(id, remaining) => console.log('Freeze used')} />
771
+ * ```
772
+ */
773
+ declare function StreakFlame({ ruleId, size, showFreezeButton, className, style, onFreeze, theme, renderLoading, renderError, }: StreakFlameProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
774
+ /**
775
+ * Props for BadgeGrid component
776
+ */
777
+ interface BadgeGridProps {
778
+ /** Show locked (unearned) badges */
779
+ showLocked?: boolean;
780
+ /** Filter by category */
781
+ category?: string;
782
+ /** Number of grid columns */
783
+ columns?: number;
784
+ /** Custom CSS class name */
785
+ className?: string;
786
+ /** Custom styles override */
787
+ style?: React.CSSProperties;
788
+ /** Show stats header */
789
+ showStats?: boolean;
790
+ /** Callback when a badge is clicked */
791
+ onBadgeClick?: (badge: BadgeWithStatus) => void;
792
+ /** Theme customization */
793
+ theme?: {
794
+ cardBackground?: string;
795
+ cardBorder?: string;
796
+ };
797
+ /** Custom render for loading state */
798
+ renderLoading?: () => React.ReactNode;
799
+ /** Custom render for error state */
800
+ renderError?: (error: string) => React.ReactNode;
801
+ /** Custom render for each badge */
802
+ renderBadge?: (badge: BadgeWithStatus) => React.ReactNode;
803
+ }
804
+ /**
805
+ * BadgeGrid - Display badge collection in a grid
806
+ *
807
+ * Shows badges with unlock status, rarity indicators, and optional filtering.
808
+ *
809
+ * @example
810
+ * ```tsx
811
+ * <BadgeGrid showLocked showStats onBadgeClick={(badge) => showBadgeModal(badge)} />
812
+ * ```
813
+ */
814
+ declare function BadgeGrid({ showLocked, category, columns, className, style, showStats, onBadgeClick, theme, renderLoading, renderError, renderBadge, }: BadgeGridProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
815
+ /**
816
+ * Props for LevelProgress component
817
+ */
818
+ interface LevelProgressProps {
819
+ /** Show progress to next tier */
820
+ showNextTier?: boolean;
821
+ /** Show tier benefits */
822
+ showBenefits?: boolean;
823
+ /** Custom CSS class name */
824
+ className?: string;
825
+ /** Custom styles override */
826
+ style?: React.CSSProperties;
827
+ /** Theme customization */
828
+ theme?: {
829
+ cardBackground?: string;
830
+ progressGradient?: string;
831
+ textColor?: string;
832
+ };
833
+ /** Custom render for loading state */
834
+ renderLoading?: () => React.ReactNode;
835
+ /** Custom render for error state */
836
+ renderError?: (error: string) => React.ReactNode;
837
+ }
838
+ /**
839
+ * LevelProgress - Display tier/level progress
840
+ *
841
+ * Shows current tier, XP/points, and progress to next tier.
842
+ *
843
+ * @example
844
+ * ```tsx
845
+ * <LevelProgress showNextTier showBenefits />
846
+ * ```
847
+ */
848
+ declare function LevelProgress({ showNextTier, showBenefits, className, style, theme, renderLoading, renderError, }: LevelProgressProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
849
+ /**
850
+ * Props for RewardStore component
851
+ */
852
+ interface RewardStoreProps {
853
+ /** Show unavailable items */
854
+ showUnavailable?: boolean;
855
+ /** Custom CSS class name */
856
+ className?: string;
857
+ /** Custom styles override */
858
+ style?: React.CSSProperties;
859
+ /** Show points header */
860
+ showPointsHeader?: boolean;
861
+ /** Callback when item is redeemed */
862
+ onRedeem?: (item: RewardItem, result: RedemptionResult) => void;
863
+ /** Theme customization */
864
+ theme?: {
865
+ cardBackground?: string;
866
+ buttonColor?: string;
867
+ };
868
+ /** Custom render for loading state */
869
+ renderLoading?: () => React.ReactNode;
870
+ /** Custom render for error state */
871
+ renderError?: (error: string) => React.ReactNode;
872
+ /** Custom render for each item */
873
+ renderItem?: (item: RewardItem, onRedeem: () => void) => React.ReactNode;
874
+ }
875
+ /**
876
+ * RewardStore - Display reward catalog with redeem functionality
877
+ *
878
+ * Shows available rewards with point costs and redeem buttons.
879
+ *
880
+ * @example
881
+ * ```tsx
882
+ * <RewardStore
883
+ * showPointsHeader
884
+ * onRedeem={(item, result) => {
885
+ * if (result.success) toast.success(`Redeemed ${item.name}!`);
886
+ * }}
887
+ * />
888
+ * ```
889
+ */
890
+ declare function RewardStore({ showUnavailable, className, style, showPointsHeader, onRedeem, theme, renderLoading, renderError, renderItem, }: RewardStoreProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
891
+
892
+ export { AffiliateStats, type AffiliateStatsProps, BadgeGrid, type BadgeGridProps, type GamifyContextValue, GamifyPageView, type GamifyPageViewProps, GamifyProvider, type GamifyProviderProps, GamifyTrackClick, type GamifyTrackClickProps, Leaderboard, type LeaderboardProps, LevelProgress, type LevelProgressProps, QuestProgress, type QuestProgressProps, ReferralLink, type ReferralLinkProps, RewardStore, type RewardStoreProps, StreakFlame, type StreakFlameProps, useAffiliateStats, useBadges, useGamify, useIdentify, useLeaderboard, useLoyalty, useQuests, useReferral, useRewards, useSession, useStreaks, useTrack };