@fanfare-io/fanfare-sdk-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.
- package/LICENSE +202 -0
- package/README.md +58 -0
- package/dist/components/auth/access-code-input.d.ts +24 -0
- package/dist/components/auth/auth-form.d.ts +39 -0
- package/dist/components/auth/auth-input.d.ts +28 -0
- package/dist/components/auth/email-input.d.ts +21 -0
- package/dist/components/auth/index.d.ts +19 -0
- package/dist/components/auth/otp-input.d.ts +32 -0
- package/dist/components/auth/phone-input.d.ts +22 -0
- package/dist/components/compositions/access-code-form.d.ts +29 -0
- package/dist/components/compositions/challenge-gate.d.ts +23 -0
- package/dist/components/compositions/ended-module.d.ts +26 -0
- package/dist/components/compositions/error-view.d.ts +58 -0
- package/dist/components/compositions/granted-panel.d.ts +35 -0
- package/dist/components/compositions/index.d.ts +15 -0
- package/dist/components/compositions/journey-gate.d.ts +48 -0
- package/dist/components/compositions/outcome-panel.d.ts +11 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/journey/experience-journey-controller.d.ts +14 -0
- package/dist/components/journey/experience-journey-skeleton.d.ts +21 -0
- package/dist/components/module/alert-panel.d.ts +13 -0
- package/dist/components/module/index.d.ts +19 -0
- package/dist/components/module/info-panel.d.ts +9 -0
- package/dist/components/module/outcome-reason.d.ts +27 -0
- package/dist/components/module/panel-heading.d.ts +34 -0
- package/dist/components/module/panel-layout.d.ts +28 -0
- package/dist/components/primitives/badge.d.ts +18 -0
- package/dist/components/primitives/button.d.ts +23 -0
- package/dist/components/primitives/card.d.ts +20 -0
- package/dist/components/primitives/countdown.d.ts +42 -0
- package/dist/components/primitives/fade-presence.d.ts +28 -0
- package/dist/components/primitives/fanfare-logo.d.ts +12 -0
- package/dist/components/primitives/index.d.ts +30 -0
- package/dist/components/primitives/input.d.ts +46 -0
- package/dist/components/primitives/progress.d.ts +16 -0
- package/dist/components/primitives/skeleton.d.ts +9 -0
- package/dist/components/primitives/spinner.d.ts +10 -0
- package/dist/components/primitives/transition.d.ts +34 -0
- package/dist/components/shadow-dom-preview.d.ts +43 -0
- package/dist/components/widgets/appointment/appointment-booking-details.d.ts +18 -0
- package/dist/components/widgets/appointment/appointment-checked-in-view.d.ts +12 -0
- package/dist/components/widgets/appointment/appointment-day-tabs.d.ts +21 -0
- package/dist/components/widgets/appointment/appointment-slot-grid.d.ts +12 -0
- package/dist/components/widgets/appointment/appointment-slot-item.d.ts +12 -0
- package/dist/components/widgets/appointment/appointment-slot-picker.d.ts +16 -0
- package/dist/components/widgets/auction/auction-actions.d.ts +38 -0
- package/dist/components/widgets/auction/auction-bid-display.d.ts +35 -0
- package/dist/components/widgets/auction/index.d.ts +7 -0
- package/dist/components/widgets/draw/draw-actions.d.ts +40 -0
- package/dist/components/widgets/draw/index.d.ts +6 -0
- package/dist/components/widgets/experience-widget.d.ts +141 -0
- package/dist/components/widgets/index.d.ts +11 -0
- package/dist/components/widgets/internal/appointment-module.d.ts +28 -0
- package/dist/components/widgets/internal/auction-module.d.ts +33 -0
- package/dist/components/widgets/internal/draw-module.d.ts +43 -0
- package/dist/components/widgets/internal/index.d.ts +15 -0
- package/dist/components/widgets/internal/loading-view.d.ts +17 -0
- package/dist/components/widgets/internal/queue-module.d.ts +27 -0
- package/dist/components/widgets/internal/start-view.d.ts +25 -0
- package/dist/components/widgets/internal/timed-release-module.d.ts +27 -0
- package/dist/components/widgets/internal/upcoming-module.d.ts +29 -0
- package/dist/components/widgets/internal/waitlist-view.d.ts +18 -0
- package/dist/components/widgets/queue/index.d.ts +6 -0
- package/dist/components/widgets/queue/queue-actions.d.ts +36 -0
- package/dist/components/widgets/timed-release/index.d.ts +6 -0
- package/dist/components/widgets/timed-release/timed-release-actions.d.ts +38 -0
- package/dist/components/widgets/waitlist/index.d.ts +6 -0
- package/dist/components/widgets/waitlist/waitlist-actions.d.ts +40 -0
- package/dist/context.d.ts +5 -0
- package/dist/hooks/use-appointment-slots.d.ts +13 -0
- package/dist/hooks/use-auth.d.ts +22 -0
- package/dist/hooks/use-experience-journey.d.ts +20 -0
- package/dist/hooks/use-fanfare.d.ts +11 -0
- package/dist/hooks/use-journey-snapshot.d.ts +8 -0
- package/dist/hooks/use-nanostore.d.ts +6 -0
- package/dist/i18n/i18n-context.d.ts +73 -0
- package/dist/i18n/i18n-provider.d.ts +67 -0
- package/dist/i18n/index.d.ts +13 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +4918 -0
- package/dist/internal-sdk.d.ts +2 -0
- package/dist/lib/animations.d.ts +94 -0
- package/dist/lib/appointment-format.d.ts +35 -0
- package/dist/lib/confetti.d.ts +17 -0
- package/dist/lib/currency.d.ts +9 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/phone-formatter-lite.d.ts +26 -0
- package/dist/lib/use-grant-celebration.d.ts +12 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/provider.d.ts +99 -0
- package/dist/styles/base.css +2254 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/theme.css +143 -0
- package/dist/theme/index.d.ts +16 -0
- package/dist/theme/theme-context.d.ts +20 -0
- package/dist/theme/theme-provider.d.ts +20 -0
- package/dist/theme/theme-utils.d.ts +18 -0
- package/dist/theme/theme.types.d.ts +47 -0
- package/dist/theme/use-theme.d.ts +44 -0
- package/docs/SLOTS.md +89 -0
- package/docs/STYLING.md +61 -0
- package/package.json +145 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QueueActions Component
|
|
3
|
+
*
|
|
4
|
+
* Action buttons for queue operations (enter, leave, share).
|
|
5
|
+
*/
|
|
6
|
+
export type QueueStatus = "enterable" | "queued" | "granted" | "error";
|
|
7
|
+
export interface QueueActionsProps {
|
|
8
|
+
/** Current queue status */
|
|
9
|
+
status: QueueStatus;
|
|
10
|
+
/** Enter queue handler */
|
|
11
|
+
onEnter?: () => void;
|
|
12
|
+
/** Leave queue handler */
|
|
13
|
+
onLeave?: () => void;
|
|
14
|
+
/** Share position handler */
|
|
15
|
+
onShare?: () => void;
|
|
16
|
+
/** Whether enter is in progress */
|
|
17
|
+
isEntering?: boolean;
|
|
18
|
+
/** Whether leave is in progress */
|
|
19
|
+
isLeaving?: boolean;
|
|
20
|
+
/** Enter button label */
|
|
21
|
+
enterLabel?: string;
|
|
22
|
+
/** Leave button label */
|
|
23
|
+
leaveLabel?: string;
|
|
24
|
+
/** Share position button label */
|
|
25
|
+
shareLabel?: string;
|
|
26
|
+
/** Show share button */
|
|
27
|
+
showShare?: boolean;
|
|
28
|
+
/** Layout direction */
|
|
29
|
+
layout?: "horizontal" | "vertical";
|
|
30
|
+
/** Additional class name */
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function QueueActions({ status, onEnter, onLeave, onShare, isEntering, isLeaving, enterLabel, leaveLabel, shareLabel, showShare, layout, className, }: QueueActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare namespace QueueActions {
|
|
35
|
+
var displayName: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimedReleaseActions Component
|
|
3
|
+
*
|
|
4
|
+
* Action buttons for timed release operations (enter, shop, exit).
|
|
5
|
+
*/
|
|
6
|
+
export type TimedReleaseStatus = "open" | "entered" | "shopping" | "completed" | "expired" | "ended";
|
|
7
|
+
export interface TimedReleaseActionsProps {
|
|
8
|
+
/** Current status */
|
|
9
|
+
status: TimedReleaseStatus;
|
|
10
|
+
/** Enter sale handler */
|
|
11
|
+
onEnter?: () => void;
|
|
12
|
+
/** Shop/continue handler */
|
|
13
|
+
onShop?: () => void;
|
|
14
|
+
/** Complete purchase handler */
|
|
15
|
+
onComplete?: () => void;
|
|
16
|
+
/** Exit sale handler */
|
|
17
|
+
onExit?: () => void;
|
|
18
|
+
/** Whether enter is in progress */
|
|
19
|
+
isEntering?: boolean;
|
|
20
|
+
/** Whether exit is in progress */
|
|
21
|
+
isExiting?: boolean;
|
|
22
|
+
/** Enter button label */
|
|
23
|
+
enterLabel?: string;
|
|
24
|
+
/** Shop button label */
|
|
25
|
+
shopLabel?: string;
|
|
26
|
+
/** Complete button label */
|
|
27
|
+
completeLabel?: string;
|
|
28
|
+
/** Exit button label */
|
|
29
|
+
exitLabel?: string;
|
|
30
|
+
/** Layout direction */
|
|
31
|
+
layout?: "horizontal" | "vertical";
|
|
32
|
+
/** Additional class name */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function TimedReleaseActions({ status, onEnter, onShop, onComplete, onExit, isEntering, isExiting, enterLabel, shopLabel, completeLabel, exitLabel, layout, className, }: TimedReleaseActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare namespace TimedReleaseActions {
|
|
37
|
+
var displayName: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WaitlistActions Component
|
|
3
|
+
*
|
|
4
|
+
* Action buttons for waitlist operations (enter, leave, share).
|
|
5
|
+
*/
|
|
6
|
+
export type WaitlistStatus = "available" | "entered" | "opening" | "opened";
|
|
7
|
+
export interface WaitlistActionsProps {
|
|
8
|
+
/** Current waitlist status */
|
|
9
|
+
status: WaitlistStatus;
|
|
10
|
+
/** Enter waitlist handler */
|
|
11
|
+
onEnter?: () => void;
|
|
12
|
+
/** Leave waitlist handler */
|
|
13
|
+
onLeave?: () => void;
|
|
14
|
+
/** Share position handler */
|
|
15
|
+
onShare?: () => void;
|
|
16
|
+
/** Proceed handler (when opened) */
|
|
17
|
+
onProceed?: () => void;
|
|
18
|
+
/** Whether enter is in progress */
|
|
19
|
+
isEntering?: boolean;
|
|
20
|
+
/** Whether leave is in progress */
|
|
21
|
+
isLeaving?: boolean;
|
|
22
|
+
/** Enter button label */
|
|
23
|
+
enterLabel?: string;
|
|
24
|
+
/** Leave button label */
|
|
25
|
+
leaveLabel?: string;
|
|
26
|
+
/** Share button label */
|
|
27
|
+
shareLabel?: string;
|
|
28
|
+
/** Proceed button label */
|
|
29
|
+
proceedLabel?: string;
|
|
30
|
+
/** Show share button */
|
|
31
|
+
showShare?: boolean;
|
|
32
|
+
/** Layout direction */
|
|
33
|
+
layout?: "horizontal" | "vertical";
|
|
34
|
+
/** Additional class name */
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function WaitlistActions({ status, onEnter, onLeave, onShare, onProceed, isEntering, isLeaving, enterLabel, leaveLabel, shareLabel, proceedLabel, showShare, layout, className, }: WaitlistActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare namespace WaitlistActions {
|
|
39
|
+
var displayName: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AppointmentSlot } from '@fanfare-io/fanfare-sdk-core/appointments';
|
|
2
|
+
interface UseAppointmentSlotsResult {
|
|
3
|
+
slots: AppointmentSlot[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
refresh(): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useAppointmentSlots(appointmentId: string | undefined, range: {
|
|
9
|
+
startDate?: string;
|
|
10
|
+
endDate?: string;
|
|
11
|
+
timezone?: string;
|
|
12
|
+
}): UseAppointmentSlotsResult;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OtpRequest, OtpVerify } from '@fanfare-io/fanfare-sdk-core/auth';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for authentication state and operations
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const { isAuthenticated, session, guest, requestOtp } = useFanfareAuth();
|
|
8
|
+
*
|
|
9
|
+
* if (!isAuthenticated) {
|
|
10
|
+
* await guest();
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function useFanfareAuth(): {
|
|
15
|
+
guest: () => Promise<import('@fanfare-io/fanfare-sdk-core/auth').GuestSession>;
|
|
16
|
+
requestOtp: (options: OtpRequest) => Promise<void>;
|
|
17
|
+
verifyOtp: (options: OtpVerify) => Promise<import('@fanfare-io/fanfare-sdk-core/auth').AuthenticatedSession>;
|
|
18
|
+
logout: () => Promise<void>;
|
|
19
|
+
isAuthenticated: boolean;
|
|
20
|
+
isGuest?: boolean;
|
|
21
|
+
session?: import('@fanfare-io/fanfare-sdk-core/auth').Session;
|
|
22
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JourneyHandle, JourneySnapshot, JourneyView } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
2
|
+
export interface ExperienceJourneyOptions {
|
|
3
|
+
accessCode?: string;
|
|
4
|
+
autoEnterWaitlist?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface UseExperienceJourneyOptions extends ExperienceJourneyOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Automatically start the journey when the hook mounts
|
|
9
|
+
* and an experienceId is provided.
|
|
10
|
+
*/
|
|
11
|
+
autoStart?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UseExperienceJourneyResult {
|
|
14
|
+
journey: JourneyHandle | null;
|
|
15
|
+
view: JourneyView | null;
|
|
16
|
+
snapshot: JourneySnapshot | null;
|
|
17
|
+
error: string | null;
|
|
18
|
+
start: (options?: ExperienceJourneyOptions) => Promise<JourneyView>;
|
|
19
|
+
}
|
|
20
|
+
export declare function useExperienceJourney(experienceId: string | undefined, options?: UseExperienceJourneyOptions): UseExperienceJourneyResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AdapterRuntimeSDK } from '../internal-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access the Fanfare SDK instance
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const fanfare = useFanfare();
|
|
8
|
+
* await fanfare.auth.guest();
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFanfare(): AdapterRuntimeSDK;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JourneyHandle, JourneySnapshot } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribe to the full journey snapshot. Re-renders on every snapshot change.
|
|
4
|
+
* Use this for exhaustive DU switching (e.g. ExperienceWidget) or when you
|
|
5
|
+
* need the complete snapshot object. Prefer `useNanostore(handle.view$)`
|
|
6
|
+
* for view-level subscriptions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useJourneySnapshot(handle: JourneyHandle): JourneySnapshot;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReadableAtom } from 'nanostores';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribe to a nanostores `ReadableAtom` using React's `useSyncExternalStore`.
|
|
4
|
+
* Returns the current value and re-renders only when the atom's value changes.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useNanostore<T>(atom: ReadableAtom<T>): T;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Locale, PartialTranslationMessages, TextDirection, TranslateFunction, TranslationKey, TranslationMessageKey, TranslationMessages } from '@fanfare-io/fanfare-sdk-i18n';
|
|
2
|
+
/**
|
|
3
|
+
* Context value for i18n state.
|
|
4
|
+
*/
|
|
5
|
+
export interface I18nContextValue {
|
|
6
|
+
/** Current locale code */
|
|
7
|
+
locale: Locale;
|
|
8
|
+
/** Resolved messages (merged from all providers) */
|
|
9
|
+
messages: TranslationMessages<TranslationMessageKey>;
|
|
10
|
+
/** Whether this is the root i18n provider */
|
|
11
|
+
isRoot: boolean;
|
|
12
|
+
/** Translate function */
|
|
13
|
+
t: TranslateFunction<TranslationKey>;
|
|
14
|
+
/** Text direction based on locale */
|
|
15
|
+
dir: TextDirection;
|
|
16
|
+
/** Experience-level translation overrides */
|
|
17
|
+
experienceTranslations: PartialTranslationMessages<TranslationMessageKey> | null;
|
|
18
|
+
/** Update experience-level translations (called by useExperienceJourney) */
|
|
19
|
+
setExperienceTranslations: (translations: PartialTranslationMessages<TranslationMessageKey> | null) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const I18nContext: import('react').Context<I18nContextValue>;
|
|
22
|
+
/**
|
|
23
|
+
* Hook to access the current i18n context.
|
|
24
|
+
* Returns the translate function and locale from the nearest I18nProvider.
|
|
25
|
+
*
|
|
26
|
+
* @returns The i18n context value with translate function and locale
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* function MyComponent() {
|
|
31
|
+
* const { t, locale } = useI18nContext();
|
|
32
|
+
* return <span>{t("queue.position")}</span>;
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function useI18nContext(): I18nContextValue;
|
|
37
|
+
/**
|
|
38
|
+
* Hook to get the translate function.
|
|
39
|
+
* Convenience wrapper around useI18nContext.
|
|
40
|
+
*
|
|
41
|
+
* @returns Object containing the translate function, locale, and text direction
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* function QueuePosition({ position }: { position: number }) {
|
|
46
|
+
* const { t, dir } = useTranslations();
|
|
47
|
+
* return (
|
|
48
|
+
* <div dir={dir}>
|
|
49
|
+
* <span>{t("queue.position")}</span>
|
|
50
|
+
* <span>{t("queue.positionValue", { values: { position } })}</span>
|
|
51
|
+
* </div>
|
|
52
|
+
* );
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function useTranslations(): {
|
|
57
|
+
t: TranslateFunction<TranslationKey>;
|
|
58
|
+
locale: Locale;
|
|
59
|
+
dir: TextDirection;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Hook to create merged translations for a nested provider.
|
|
63
|
+
* Merges custom translations over the parent translations.
|
|
64
|
+
*
|
|
65
|
+
* Merge order: SDK defaults → experience translations → consumer props
|
|
66
|
+
*
|
|
67
|
+
* @param locale - Optional locale override
|
|
68
|
+
* @param translations - Optional translation overrides
|
|
69
|
+
* @param experienceTranslations - Experience-level translations (from useExperienceJourney)
|
|
70
|
+
* @param setExperienceTranslations - Function to update experience translations
|
|
71
|
+
* @returns The merged i18n context value
|
|
72
|
+
*/
|
|
73
|
+
export declare function useMergedTranslations(locale?: Locale, translations?: PartialTranslationMessages<TranslationMessageKey>, experienceTranslations?: PartialTranslationMessages<TranslationMessageKey> | null, setExperienceTranslations?: (translations: PartialTranslationMessages<TranslationMessageKey> | null) => void): I18nContextValue;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Locale, PartialTranslationMessages, TranslationMessageKey } from '@fanfare-io/fanfare-sdk-i18n';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the I18nProvider component.
|
|
5
|
+
*/
|
|
6
|
+
export interface I18nProviderProps {
|
|
7
|
+
/**
|
|
8
|
+
* The locale to use for translations.
|
|
9
|
+
* @default "en"
|
|
10
|
+
*/
|
|
11
|
+
locale?: Locale;
|
|
12
|
+
/**
|
|
13
|
+
* Custom translations to merge with or override defaults.
|
|
14
|
+
* Keys should match the default translation keys.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <I18nProvider translations={{ "queue.enter": "Join the Line" }}>
|
|
19
|
+
* <App />
|
|
20
|
+
* </I18nProvider>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
translations?: PartialTranslationMessages<TranslationMessageKey>;
|
|
24
|
+
/**
|
|
25
|
+
* Child components that will have access to translations.
|
|
26
|
+
*/
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Provider component for internationalization.
|
|
31
|
+
*
|
|
32
|
+
* Provides translation context to child components. Supports nesting with
|
|
33
|
+
* message overrides - child providers merge their translations over parent values.
|
|
34
|
+
*
|
|
35
|
+
* @param props - Provider configuration
|
|
36
|
+
* @returns A provider component that distributes translations
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* Basic usage with defaults:
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <I18nProvider>
|
|
42
|
+
* <App />
|
|
43
|
+
* </I18nProvider>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* With custom locale:
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <I18nProvider locale="es">
|
|
50
|
+
* <App />
|
|
51
|
+
* </I18nProvider>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* With translation overrides:
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <I18nProvider
|
|
58
|
+
* translations={{
|
|
59
|
+
* "queue.enter": "Join the Queue",
|
|
60
|
+
* "queue.leave": "Exit the Queue",
|
|
61
|
+
* }}
|
|
62
|
+
* >
|
|
63
|
+
* <App />
|
|
64
|
+
* </I18nProvider>
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function I18nProvider({ locale, translations, children }: I18nProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* i18n Module
|
|
3
|
+
*
|
|
4
|
+
* Internationalization system for the Fanfare SDK React components.
|
|
5
|
+
* Re-exports core i18n utilities from @fanfare-io/fanfare-sdk-i18n.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { RTL_LOCALES, TRANSLATION_KEYS, createTranslateFunction, en, interpolate, isRTLLocale, mergeTranslations, type I18nConfig, type Locale, type PartialTranslationMessages, type RTLLocale, type TextDirection, type TranslateFunction, type TranslateOptions, type TranslationKey, type TranslationMessageKey, type TranslationMessages, } from '@fanfare-io/fanfare-sdk-i18n';
|
|
10
|
+
export { I18nContext, useI18nContext, useMergedTranslations, useTranslations } from './i18n-context';
|
|
11
|
+
export type { I18nContextValue } from './i18n-context';
|
|
12
|
+
export { I18nProvider } from './i18n-provider';
|
|
13
|
+
export type { I18nProviderProps } from './i18n-provider';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fanfare SDK React Adapter
|
|
3
|
+
*
|
|
4
|
+
* React hooks and components for integrating Fanfare SDK
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { FanfareProvider } from './provider';
|
|
9
|
+
export type { FanfareProviderProps } from './provider';
|
|
10
|
+
export { useFanfareAuth } from './hooks/use-auth';
|
|
11
|
+
export { useExperienceJourney } from './hooks/use-experience-journey';
|
|
12
|
+
export { useFanfare } from './hooks/use-fanfare';
|
|
13
|
+
export { useJourneySnapshot } from './hooks/use-journey-snapshot';
|
|
14
|
+
export { useNanostore } from './hooks/use-nanostore';
|
|
15
|
+
export { ExperienceJourneyController } from './components/journey/experience-journey-controller';
|
|
16
|
+
export { ExperienceJourneySkeleton } from './components/journey/experience-journey-skeleton';
|
|
17
|
+
export { FanfareContext } from './context';
|
|
18
|
+
export { AuthInput } from './components/auth/auth-input';
|
|
19
|
+
export type { AuthInputProps } from './components/auth/auth-input';
|
|
20
|
+
export { OTPInput } from './components/auth/otp-input';
|
|
21
|
+
export { Button, buttonVariants, type ButtonProps } from './components/primitives/button';
|
|
22
|
+
export { Input } from './components/primitives/input';
|
|
23
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './components/primitives/card';
|
|
24
|
+
export { InfoPanel, PanelBody, PanelFooter, PanelHeading, PanelLayout, normalizeOutcomeReason, } from './components/module';
|
|
25
|
+
export type { InfoPanelProps, OutcomeReason, PanelBodyProps, PanelFooterProps, PanelHeadingProps, PanelHeadingVariant, PanelLayoutProps, } from './components/module';
|
|
26
|
+
export { ThemeProvider } from './theme/theme-provider';
|
|
27
|
+
export type { ThemeProviderProps } from './theme/theme-provider';
|
|
28
|
+
export { buildThemeCssVars } from './theme/theme-utils';
|
|
29
|
+
export { THEME_CSS_VARS } from './theme/theme.types';
|
|
30
|
+
export type { ResolvedTheme, ThemeCssVar, WidgetThemeConfig, WidgetVariant } from './theme/theme.types';
|
|
31
|
+
export { I18nProvider, RTL_LOCALES, isRTLLocale, useTranslations } from './i18n';
|
|
32
|
+
export type { I18nConfig, I18nProviderProps, Locale, PartialTranslationMessages, RTLLocale, TextDirection, TranslateFunction, TranslateOptions, TranslationKey, TranslationMessageKey, TranslationMessages, } from './i18n';
|
|
33
|
+
export { AuthForm } from './components/auth/auth-form';
|
|
34
|
+
export type { AuthFormProps } from './components/auth/auth-form';
|
|
35
|
+
export { AccessCodeForm } from './components/compositions/access-code-form';
|
|
36
|
+
export type { AccessCodeFormProps } from './components/compositions/access-code-form';
|
|
37
|
+
export { ChallengeGate } from './components/compositions/challenge-gate';
|
|
38
|
+
export type { ChallengeGateProps } from './components/compositions/challenge-gate';
|
|
39
|
+
export { EndedModule } from './components/compositions/ended-module';
|
|
40
|
+
export type { EndedModuleProps } from './components/compositions/ended-module';
|
|
41
|
+
export { ErrorView } from './components/compositions/error-view';
|
|
42
|
+
export type { ErrorViewProps } from './components/compositions/error-view';
|
|
43
|
+
export { GrantedPanel } from './components/compositions/granted-panel';
|
|
44
|
+
export type { GrantedPanelProps } from './components/compositions/granted-panel';
|
|
45
|
+
export { OutcomePanel } from './components/compositions/outcome-panel';
|
|
46
|
+
export type { OutcomePanelProps } from './components/compositions/outcome-panel';
|
|
47
|
+
export { ExperienceWidget, type AccessCodeSlotProps, type AuthSlotProps, type ChallengeSlotProps, type EndedSlotProps, type EnterableSlotProps, type ErrorSlotProps, type ExperienceRenderProps, type ExperienceWidgetProps, type ExperienceWidgetSlots, type ExpiredSlotProps, type GrantedSlotProps, type LoadingSlotProps, type ParticipatingSlotProps, type SlotProps, type StartSlotProps, type UpcomingSlotProps, type WaitlistSlotProps, } from './components/widgets/experience-widget';
|
|
48
|
+
export { LoadingView, StartView, UpcomingModule, WaitlistView } from './components/widgets/internal';
|
|
49
|
+
export type { LoadingViewProps, StartViewProps, UpcomingModuleProps, WaitlistViewProps, } from './components/widgets/internal';
|
|
50
|
+
export { AuctionModule, DrawModule, QueueModule, TimedReleaseModule } from './components/widgets/internal';
|
|
51
|
+
export type { AuctionModuleProps, DrawModuleProps, QueueModuleProps, TimedReleaseModuleProps, } from './components/widgets/internal';
|
|
52
|
+
export { ShadowDOMPreview } from './components/shadow-dom-preview';
|
|
53
|
+
export type { ShadowDOMPreviewProps } from './components/shadow-dom-preview';
|