@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.
Files changed (102) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +58 -0
  3. package/dist/components/auth/access-code-input.d.ts +24 -0
  4. package/dist/components/auth/auth-form.d.ts +39 -0
  5. package/dist/components/auth/auth-input.d.ts +28 -0
  6. package/dist/components/auth/email-input.d.ts +21 -0
  7. package/dist/components/auth/index.d.ts +19 -0
  8. package/dist/components/auth/otp-input.d.ts +32 -0
  9. package/dist/components/auth/phone-input.d.ts +22 -0
  10. package/dist/components/compositions/access-code-form.d.ts +29 -0
  11. package/dist/components/compositions/challenge-gate.d.ts +23 -0
  12. package/dist/components/compositions/ended-module.d.ts +26 -0
  13. package/dist/components/compositions/error-view.d.ts +58 -0
  14. package/dist/components/compositions/granted-panel.d.ts +35 -0
  15. package/dist/components/compositions/index.d.ts +15 -0
  16. package/dist/components/compositions/journey-gate.d.ts +48 -0
  17. package/dist/components/compositions/outcome-panel.d.ts +11 -0
  18. package/dist/components/index.d.ts +15 -0
  19. package/dist/components/journey/experience-journey-controller.d.ts +14 -0
  20. package/dist/components/journey/experience-journey-skeleton.d.ts +21 -0
  21. package/dist/components/module/alert-panel.d.ts +13 -0
  22. package/dist/components/module/index.d.ts +19 -0
  23. package/dist/components/module/info-panel.d.ts +9 -0
  24. package/dist/components/module/outcome-reason.d.ts +27 -0
  25. package/dist/components/module/panel-heading.d.ts +34 -0
  26. package/dist/components/module/panel-layout.d.ts +28 -0
  27. package/dist/components/primitives/badge.d.ts +18 -0
  28. package/dist/components/primitives/button.d.ts +23 -0
  29. package/dist/components/primitives/card.d.ts +20 -0
  30. package/dist/components/primitives/countdown.d.ts +42 -0
  31. package/dist/components/primitives/fade-presence.d.ts +28 -0
  32. package/dist/components/primitives/fanfare-logo.d.ts +12 -0
  33. package/dist/components/primitives/index.d.ts +30 -0
  34. package/dist/components/primitives/input.d.ts +46 -0
  35. package/dist/components/primitives/progress.d.ts +16 -0
  36. package/dist/components/primitives/skeleton.d.ts +9 -0
  37. package/dist/components/primitives/spinner.d.ts +10 -0
  38. package/dist/components/primitives/transition.d.ts +34 -0
  39. package/dist/components/shadow-dom-preview.d.ts +43 -0
  40. package/dist/components/widgets/appointment/appointment-booking-details.d.ts +18 -0
  41. package/dist/components/widgets/appointment/appointment-checked-in-view.d.ts +12 -0
  42. package/dist/components/widgets/appointment/appointment-day-tabs.d.ts +21 -0
  43. package/dist/components/widgets/appointment/appointment-slot-grid.d.ts +12 -0
  44. package/dist/components/widgets/appointment/appointment-slot-item.d.ts +12 -0
  45. package/dist/components/widgets/appointment/appointment-slot-picker.d.ts +16 -0
  46. package/dist/components/widgets/auction/auction-actions.d.ts +38 -0
  47. package/dist/components/widgets/auction/auction-bid-display.d.ts +35 -0
  48. package/dist/components/widgets/auction/index.d.ts +7 -0
  49. package/dist/components/widgets/draw/draw-actions.d.ts +40 -0
  50. package/dist/components/widgets/draw/index.d.ts +6 -0
  51. package/dist/components/widgets/experience-widget.d.ts +141 -0
  52. package/dist/components/widgets/index.d.ts +11 -0
  53. package/dist/components/widgets/internal/appointment-module.d.ts +28 -0
  54. package/dist/components/widgets/internal/auction-module.d.ts +33 -0
  55. package/dist/components/widgets/internal/draw-module.d.ts +43 -0
  56. package/dist/components/widgets/internal/index.d.ts +15 -0
  57. package/dist/components/widgets/internal/loading-view.d.ts +17 -0
  58. package/dist/components/widgets/internal/queue-module.d.ts +27 -0
  59. package/dist/components/widgets/internal/start-view.d.ts +25 -0
  60. package/dist/components/widgets/internal/timed-release-module.d.ts +27 -0
  61. package/dist/components/widgets/internal/upcoming-module.d.ts +29 -0
  62. package/dist/components/widgets/internal/waitlist-view.d.ts +18 -0
  63. package/dist/components/widgets/queue/index.d.ts +6 -0
  64. package/dist/components/widgets/queue/queue-actions.d.ts +36 -0
  65. package/dist/components/widgets/timed-release/index.d.ts +6 -0
  66. package/dist/components/widgets/timed-release/timed-release-actions.d.ts +38 -0
  67. package/dist/components/widgets/waitlist/index.d.ts +6 -0
  68. package/dist/components/widgets/waitlist/waitlist-actions.d.ts +40 -0
  69. package/dist/context.d.ts +5 -0
  70. package/dist/hooks/use-appointment-slots.d.ts +13 -0
  71. package/dist/hooks/use-auth.d.ts +22 -0
  72. package/dist/hooks/use-experience-journey.d.ts +20 -0
  73. package/dist/hooks/use-fanfare.d.ts +11 -0
  74. package/dist/hooks/use-journey-snapshot.d.ts +8 -0
  75. package/dist/hooks/use-nanostore.d.ts +6 -0
  76. package/dist/i18n/i18n-context.d.ts +73 -0
  77. package/dist/i18n/i18n-provider.d.ts +67 -0
  78. package/dist/i18n/index.d.ts +13 -0
  79. package/dist/index.d.ts +53 -0
  80. package/dist/index.js +4918 -0
  81. package/dist/internal-sdk.d.ts +2 -0
  82. package/dist/lib/animations.d.ts +94 -0
  83. package/dist/lib/appointment-format.d.ts +35 -0
  84. package/dist/lib/confetti.d.ts +17 -0
  85. package/dist/lib/currency.d.ts +9 -0
  86. package/dist/lib/index.d.ts +5 -0
  87. package/dist/lib/phone-formatter-lite.d.ts +26 -0
  88. package/dist/lib/use-grant-celebration.d.ts +12 -0
  89. package/dist/lib/utils.d.ts +13 -0
  90. package/dist/provider.d.ts +99 -0
  91. package/dist/styles/base.css +2254 -0
  92. package/dist/styles/index.d.ts +2 -0
  93. package/dist/styles/theme.css +143 -0
  94. package/dist/theme/index.d.ts +16 -0
  95. package/dist/theme/theme-context.d.ts +20 -0
  96. package/dist/theme/theme-provider.d.ts +20 -0
  97. package/dist/theme/theme-utils.d.ts +18 -0
  98. package/dist/theme/theme.types.d.ts +47 -0
  99. package/dist/theme/use-theme.d.ts +44 -0
  100. package/docs/SLOTS.md +89 -0
  101. package/docs/STYLING.md +61 -0
  102. package/package.json +145 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @fanfare-io/fanfare-sdk-react
2
+
3
+ React components and hooks for [Fanfare](https://www.fanfare.io) controlled-access experiences, built on [@fanfare-io/fanfare-sdk-core](https://www.npmjs.com/package/@fanfare-io/fanfare-sdk-core).
4
+
5
+ - `FanfareProvider` initializes the SDK and provides it to the tree
6
+ - `ExperienceWidget` renders the full journey UI
7
+ - `useExperienceJourney` exposes the same journey model for fully custom UI
8
+
9
+ ## States Covered
10
+
11
+ The component surface is derived from the SDK journey model: `journeyStage`, then `sequence.phase`, then `sequence.mechanism`. The server stays authoritative over what is permitted.
12
+
13
+ - `ready`: renders the start view and exposes `start(opts?)`.
14
+ - `routing`: renders loading UI while the route is selected.
15
+ - `gated`: renders auth, access-code, or challenge UI for the active gate.
16
+ - `routed`: renders the sequence UI for `unavailable`, `scheduled`, `enterable`, `participating`, `settling`, `granted`, and `ended`.
17
+
18
+ For routed journeys, the default widget renders `queue`, `draw`, `auction`, `timed_release`, and `appointment` modules across their supported phases. It renders waitlist entry through `UpcomingModule` and waitlist participation through `WaitlistView`. `settling` renders for `draw` and `auction`. `granted` renders for `queue`, `draw`, `auction`, and `timed_release`.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install @fanfare-io/fanfare-sdk-core @fanfare-io/fanfare-sdk-react motion
24
+ ```
25
+
26
+ Peer dependencies: `react`, `react-dom`, `motion`.
27
+
28
+ ## Usage
29
+
30
+ ```tsx
31
+ import { ExperienceWidget, FanfareProvider } from "@fanfare-io/fanfare-sdk-react";
32
+ import "@fanfare-io/fanfare-sdk-react/styles";
33
+
34
+ export function App() {
35
+ return (
36
+ <FanfareProvider organizationId="org_123" publishableKey="pk_live_123">
37
+ <ExperienceWidget experienceId="exp_123" autoStart checkoutUrl="/checkout" />
38
+ </FanfareProvider>
39
+ );
40
+ }
41
+ ```
42
+
43
+ Customization has four levels of increasing specificity: `theme`, `variant`, `slots`, and `children` or `useExperienceJourney`.
44
+
45
+ `slots` override targeted states while keeping the default widget flow. `children` receives `{ journey, view, snapshot, error, start, isStarting }` when you want to render the full state yourself.
46
+
47
+ ## Documentation
48
+
49
+ - [React components guide](https://docs.fanfare.io/sdk/components/react)
50
+ - [Theming](https://docs.fanfare.io/sdk/components/theming) · [Slots](https://docs.fanfare.io/sdk/components/slots)
51
+ - [Next.js / SSR integration](https://docs.fanfare.io/guides/integration-patterns/ssr-integration)
52
+ - [SDK overview](https://docs.fanfare.io/sdk/overview)
53
+ - [Website](https://www.fanfare.io)
54
+ - [Source & issues](https://github.com/fanfare-io/fanfare-sdk)
55
+
56
+ ## License
57
+
58
+ [Apache-2.0](./LICENSE)
@@ -0,0 +1,24 @@
1
+ import { InputProps } from '../primitives/input';
2
+ /**
3
+ * AccessCodeInput Component
4
+ *
5
+ * Simple text input for access/invite codes.
6
+ * Optionally auto-uppercases input for case-insensitive codes.
7
+ * Composes the Input primitive for consistent styling across variants.
8
+ */
9
+ import * as React from "react";
10
+ export interface AccessCodeInputProps extends Omit<InputProps, "onChange" | "type" | "value"> {
11
+ /** Current input value */
12
+ value: string;
13
+ /** Called when value changes */
14
+ onValueChange: (value: string) => void;
15
+ /** Called when Enter is pressed */
16
+ onSubmit?: () => void;
17
+ /** External error message */
18
+ error?: string;
19
+ /** Visual error state without inline text (e.g. when an AlertPanel owns the message). */
20
+ hasError?: boolean;
21
+ /** Auto-uppercase input */
22
+ autoUppercase?: boolean;
23
+ }
24
+ export declare const AccessCodeInput: React.ForwardRefExoticComponent<AccessCodeInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,39 @@
1
+ import { PanelHeadingVariant } from '../module';
2
+ import { AuthInputMode } from './auth-input';
3
+ /**
4
+ * AuthForm Component
5
+ *
6
+ * Complete two-step authentication flow: credential entry → OTP verification → success.
7
+ */
8
+ import * as React from "react";
9
+ export interface AuthFormProps {
10
+ onSubmit?: (credential: string, type: AuthInputMode) => Promise<void>;
11
+ onVerify?: (otp: string) => Promise<void>;
12
+ onSkip?: () => void;
13
+ onSuccess?: () => void;
14
+ /** Badge color/intent in the panel heading. */
15
+ variant?: PanelHeadingVariant;
16
+ /** Badge text in the panel heading. Defaults to `auth.badgeLabel`. */
17
+ label?: React.ReactNode;
18
+ title?: string;
19
+ description?: string;
20
+ /** When set, renders a countdown above the form. */
21
+ countdownTo?: Date;
22
+ submitLabel?: string;
23
+ verifyLabel?: string;
24
+ allowSkip?: boolean;
25
+ showBranding?: boolean;
26
+ /** Initial step when mounting. Useful for SSR-resume or storybook lanes that need the verify step. */
27
+ defaultStep?: "credential" | "verify";
28
+ /** Initial credential (email or E.164 phone) — pairs with `defaultStep="verify"`. */
29
+ defaultCredential?: string;
30
+ /** Initial credential type — pairs with `defaultStep="verify"`. */
31
+ defaultCredentialType?: AuthInputMode;
32
+ /** Initial error message when mounting. Cleared on the next input change. */
33
+ defaultError?: string;
34
+ className?: string;
35
+ }
36
+ export declare function AuthForm({ onSubmit, onVerify, onSkip, onSuccess, variant, label: labelProp, title: titleProp, description: descriptionProp, countdownTo, submitLabel: submitLabelProp, verifyLabel: verifyLabelProp, allowSkip, showBranding, defaultStep, defaultCredential, defaultCredentialType, defaultError, className, }: AuthFormProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare namespace AuthForm {
38
+ var displayName: string;
39
+ }
@@ -0,0 +1,28 @@
1
+ import { InputProps } from '../primitives/input';
2
+ /**
3
+ * AuthInput Component
4
+ *
5
+ * Smart input that handles both email and phone credentials.
6
+ * Can auto-detect input type or show a manual toggle.
7
+ * Composes the Input primitive for consistent styling across variants.
8
+ */
9
+ import * as React from "react";
10
+ export type AuthInputMode = "email" | "phone";
11
+ export interface AuthInputProps extends Omit<InputProps, "onChange" | "type" | "value"> {
12
+ /** Current input value */
13
+ value: string;
14
+ /** Called when value changes (returns email or E.164 phone) */
15
+ onValueChange: (value: string, mode: AuthInputMode) => void;
16
+ /** Called when validity changes */
17
+ onValidChange?: (isValid: boolean) => void;
18
+ /** Called when Enter is pressed */
19
+ onSubmit?: () => void;
20
+ /** Input mode: email, phone, or auto (shows toggle) */
21
+ type?: AuthInputMode | "auto";
22
+ /** External error message (overrides internal validation) */
23
+ error?: string;
24
+ /** Visual error state without inline text (e.g. when an AlertPanel owns the message). */
25
+ hasError?: boolean;
26
+ }
27
+ export declare function detectInputMode(value: string): AuthInputMode;
28
+ export declare const AuthInput: React.ForwardRefExoticComponent<AuthInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,21 @@
1
+ import { InputProps } from '../primitives/input';
2
+ /**
3
+ * EmailInput Component
4
+ *
5
+ * Validated email input with real-time validation feedback.
6
+ * Composes the Input primitive for consistent styling across variants.
7
+ */
8
+ import * as React from "react";
9
+ export interface EmailInputProps extends Omit<InputProps, "onChange" | "type" | "value"> {
10
+ /** Current input value */
11
+ value: string;
12
+ /** Called when value changes */
13
+ onValueChange: (value: string) => void;
14
+ /** Called when validity changes */
15
+ onValidChange?: (isValid: boolean) => void;
16
+ /** Called when Enter is pressed */
17
+ onSubmit?: () => void;
18
+ /** External error message (overrides internal validation) */
19
+ error?: string;
20
+ }
21
+ export declare const EmailInput: React.ForwardRefExoticComponent<EmailInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Authentication Components
3
+ *
4
+ * Input components for authentication flows including email, phone, OTP, and access codes.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ export { AccessCodeInput } from './access-code-input';
9
+ export type { AccessCodeInputProps } from './access-code-input';
10
+ export { AuthForm } from './auth-form';
11
+ export type { AuthFormProps } from './auth-form';
12
+ export { AuthInput } from './auth-input';
13
+ export type { AuthInputMode, AuthInputProps } from './auth-input';
14
+ export { EmailInput } from './email-input';
15
+ export type { EmailInputProps } from './email-input';
16
+ export { OTPInput } from './otp-input';
17
+ export type { OTPInputProps } from './otp-input';
18
+ export { PhoneInput } from './phone-input';
19
+ export type { PhoneInputProps } from './phone-input';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * OTPInput Component
3
+ *
4
+ * 6-digit verification code input with auto-advance.
5
+ * Supports keyboard navigation, paste handling, and iOS OTP autofill.
6
+ * Uses theme CSS variables for consistent styling.
7
+ */
8
+ import * as React from "react";
9
+ export interface OTPInputProps {
10
+ /** Current OTP value */
11
+ value?: string;
12
+ /** Called when value changes */
13
+ onChange?: (value: string) => void;
14
+ /** Called when all digits are filled */
15
+ onComplete?: (value: string) => void;
16
+ /** Number of digits */
17
+ length?: number;
18
+ /** Error message — when set, renders below the digits in red. */
19
+ error?: string;
20
+ /**
21
+ * Visual error state without inline text. Use when the message is rendered
22
+ * elsewhere (e.g. an AlertPanel) but the digits should still show danger styling.
23
+ */
24
+ hasError?: boolean;
25
+ /** Disabled state */
26
+ disabled?: boolean;
27
+ /** Auto focus first input */
28
+ autoFocus?: boolean;
29
+ /** Additional class name */
30
+ className?: string;
31
+ }
32
+ export declare const OTPInput: React.ForwardRefExoticComponent<OTPInputProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,22 @@
1
+ import { InputProps } from '../primitives/input';
2
+ /**
3
+ * PhoneInput Component
4
+ *
5
+ * Phone input with automatic formatting and E.164 normalization.
6
+ * Displays formatted phone number while returning E.164 format to parent.
7
+ * Composes the Input primitive for consistent styling across variants.
8
+ */
9
+ import * as React from "react";
10
+ export interface PhoneInputProps extends Omit<InputProps, "onChange" | "type" | "value"> {
11
+ /** Current value (E.164 format or raw digits) */
12
+ value: string;
13
+ /** Called when value changes (returns E.164 format when valid, raw otherwise) */
14
+ onValueChange: (value: string) => void;
15
+ /** Called when validity changes */
16
+ onValidChange?: (isValid: boolean) => void;
17
+ /** Called when Enter is pressed */
18
+ onSubmit?: () => void;
19
+ /** External error message (overrides internal validation) */
20
+ error?: string;
21
+ }
22
+ export declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,29 @@
1
+ import { PanelHeadingVariant } from '../module';
2
+ /**
3
+ * AccessCodeForm Component
4
+ *
5
+ * Access code entry with submit button for gated experiences.
6
+ */
7
+ import * as React from "react";
8
+ export interface AccessCodeFormProps {
9
+ onSubmit?: (code: string) => Promise<void>;
10
+ onSkip?: () => void;
11
+ /** Badge color/intent in the panel heading. */
12
+ variant?: PanelHeadingVariant;
13
+ /** Badge text in the panel heading. Defaults to `accessCode.badgeLabel`. */
14
+ label?: React.ReactNode;
15
+ title?: string;
16
+ description?: string;
17
+ /** When set, renders a countdown above the form. */
18
+ countdownTo?: Date;
19
+ submitLabel?: string;
20
+ allowSkip?: boolean;
21
+ autoUppercase?: boolean;
22
+ /** Initial error message when mounting. Cleared on the next input change. */
23
+ defaultError?: string;
24
+ className?: string;
25
+ }
26
+ export declare function AccessCodeForm({ onSubmit, onSkip, variant, label: labelProp, title: titleProp, description: descriptionProp, countdownTo, submitLabel: submitLabelProp, allowSkip, autoUppercase, defaultError, className, }: AccessCodeFormProps): import("react/jsx-runtime").JSX.Element;
27
+ export declare namespace AccessCodeForm {
28
+ var displayName: string;
29
+ }
@@ -0,0 +1,23 @@
1
+ import { BotMitigationState, RoutingChallenge } from '@fanfare-io/fanfare-sdk-core/challenges';
2
+ import { PanelHeadingVariant } from '../module';
3
+ import * as React from "react";
4
+ export interface ChallengeGateProps {
5
+ challenge: RoutingChallenge | null;
6
+ botMitigation?: BotMitigationState;
7
+ onVerifyToken: (token: string) => Promise<void>;
8
+ onRetry?: () => void;
9
+ /** Badge color/intent in the panel heading. */
10
+ variant?: PanelHeadingVariant;
11
+ /** Badge text in the panel heading. Defaults to `challenge.badgeLabel`. */
12
+ label?: React.ReactNode;
13
+ title?: string;
14
+ description?: string;
15
+ /** When set, renders a countdown above the challenge. */
16
+ countdownTo?: Date;
17
+ retryLabel?: string;
18
+ className?: string;
19
+ }
20
+ export declare function ChallengeGate({ challenge, botMitigation, onVerifyToken, onRetry, variant, label: labelProp, title, description, countdownTo, retryLabel, className, }: ChallengeGateProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare namespace ChallengeGate {
22
+ var displayName: string;
23
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * EndedModule
3
+ *
4
+ * Terminal-state fallback for journeys with no distribution to route to.
5
+ * Per-distribution modules own their own lost / outcome state; this module is the non-distribution
6
+ * edge case (the user landed on an experience that has no upcoming, active,
7
+ * or recent distribution).
8
+ */
9
+ export interface EndedModuleProps {
10
+ /** Title text */
11
+ title?: string;
12
+ /** Body message */
13
+ message?: string;
14
+ /** When the distribution ended */
15
+ endedAt?: Date | number;
16
+ /** CTA button label */
17
+ ctaLabel?: string;
18
+ /** CTA click handler */
19
+ onCtaClick?: () => void;
20
+ /** Additional class name */
21
+ className?: string;
22
+ }
23
+ export declare function EndedModule({ title, message, endedAt, ctaLabel, onCtaClick, className }: EndedModuleProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare namespace EndedModule {
25
+ var displayName: string;
26
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * ErrorView Composition
3
+ *
4
+ * Standard error panel. Same PanelLayout chrome as every other panel, with:
5
+ * - PanelHeading badge ("Error" by default, variant="danger")
6
+ * - AlertPanel callout containing title + description
7
+ * - Optional InfoPanel slot for structured context (caller provides children)
8
+ * - Optional retry CTA
9
+ *
10
+ * For the truly generic case, callers pass nothing — defaults from i18n
11
+ * (`error.label` / `error.title` / `error.description`) fill the panel.
12
+ *
13
+ * // Generic
14
+ * <ErrorView />
15
+ *
16
+ * // Generic with retry
17
+ * <ErrorView onRetry={refetch} />
18
+ *
19
+ * // Specific error with structured context (e.g. card declined)
20
+ * <ErrorView
21
+ * label={t("checkout.actionNeeded")}
22
+ * title={t("payment.cardDeclined")}
23
+ * error={t("payment.cardDeclinedDetail", { amount })}
24
+ * info={
25
+ * <>
26
+ * <InfoRow label="Attempted card" value="•••• 4242" />
27
+ * <InfoRow label="Decline code" value="generic_decline" />
28
+ * </>
29
+ * }
30
+ * ctaLabel={t("payment.tryDifferentCard")}
31
+ * onRetry={handleTryDifferentCard}
32
+ * />
33
+ *
34
+ * For structurally different layouts (e.g. needing a step indicator alongside
35
+ * the badge in the header), write a sibling composition that uses the same
36
+ * primitives directly — do not extend or wrap ErrorView.
37
+ */
38
+ import * as React from "react";
39
+ export interface ErrorViewProps {
40
+ /** Description shown inside the AlertPanel. Falls back to `t("error.description")`. */
41
+ error?: Error | string;
42
+ /** Title shown inside the AlertPanel. Falls back to `t("error.title")`. */
43
+ title?: React.ReactNode;
44
+ /** Badge text in the PanelHeading. Falls back to `t("error.label")`. */
45
+ label?: React.ReactNode;
46
+ /** Structured context to display below the AlertPanel. Omitted entirely when not provided. */
47
+ info?: React.ReactNode;
48
+ /** Retry button label. Falls back to `t("error.retry")`. */
49
+ ctaLabel?: React.ReactNode;
50
+ /** Retry callback. When provided, a CTA button is rendered. */
51
+ onRetry?: () => void | Promise<void>;
52
+ /** Additional class name */
53
+ className?: string;
54
+ }
55
+ export declare function ErrorView({ error, title, label, info, ctaLabel, onRetry, className }: ErrorViewProps): import("react/jsx-runtime").JSX.Element;
56
+ export declare namespace ErrorView {
57
+ var displayName: string;
58
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * GrantedPanel
3
+ *
4
+ * Shared granted composition for distribution modules. Renders the
5
+ * winning-state panel: status badge, expiry countdown (or fallback message
6
+ * when no expiry is known), and a checkout CTA. Used by queue / draw /
7
+ * auction / timed-release modules — the JSX is structurally identical
8
+ * across all four; only the i18n strings differ.
9
+ *
10
+ * <GrantedPanel
11
+ * label="Congratulations!"
12
+ * fallbackMessage="Proceed to checkout"
13
+ * ctaLabel="Continue"
14
+ * expiresAt={grantExpiry}
15
+ * onCtaClick={openCheckout}
16
+ * />
17
+ *
18
+ * `useGrantCelebration` fires the celebration animation against the
19
+ * hero region — must be invoked unconditionally per React hook rules,
20
+ * which is why this lives in its own component (each module's granted
21
+ * branch returns `<GrantedPanel ... />` instead of inlining the JSX).
22
+ */
23
+ import * as React from "react";
24
+ export interface GrantedPanelProps {
25
+ label: React.ReactNode;
26
+ fallbackMessage: React.ReactNode;
27
+ ctaLabel: React.ReactNode;
28
+ expiresAt?: Date;
29
+ onCtaClick: () => void;
30
+ className?: string;
31
+ }
32
+ export declare function GrantedPanel({ label, fallbackMessage, ctaLabel, expiresAt, onCtaClick, className, }: GrantedPanelProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare namespace GrantedPanel {
34
+ var displayName: string;
35
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Composition Components
3
+ *
4
+ * Reusable sections that combine primitives for common widget patterns.
5
+ * These handle journey gates, granted views, error states, and more.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export { JourneyGate, type JourneyGateProps, type JourneyGateStage } from './journey-gate';
10
+ export { ChallengeGate, type ChallengeGateProps } from './challenge-gate';
11
+ export { AccessCodeForm, type AccessCodeFormProps } from './access-code-form';
12
+ export { GrantedPanel, type GrantedPanelProps } from './granted-panel';
13
+ export { OutcomePanel, type OutcomePanelProps } from './outcome-panel';
14
+ export { EndedModule, type EndedModuleProps } from './ended-module';
15
+ export { ErrorView, type ErrorViewProps } from './error-view';