@draftlab/auth 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/adapters/node.d.ts +18 -0
  2. package/dist/adapters/node.js +71 -0
  3. package/dist/allow-CixonwTW.d.ts +59 -0
  4. package/dist/allow-DX5cehSc.js +63 -0
  5. package/dist/allow.d.ts +2 -0
  6. package/dist/allow.js +4 -0
  7. package/dist/base-DRutbxgL.js +422 -0
  8. package/dist/client.d.ts +413 -0
  9. package/dist/client.js +209 -0
  10. package/dist/code-l_uvMR1j.d.ts +212 -0
  11. package/dist/core-8WTqfnb4.d.ts +129 -0
  12. package/dist/core-CncE5rPg.js +498 -0
  13. package/dist/core.d.ts +9 -0
  14. package/dist/core.js +14 -0
  15. package/dist/error-CWAdNAzm.d.ts +243 -0
  16. package/dist/error-DgAKK7b2.js +237 -0
  17. package/dist/error.d.ts +2 -0
  18. package/dist/error.js +3 -0
  19. package/dist/form-6XKM_cOk.js +61 -0
  20. package/dist/icon-Ci5uqGB_.js +192 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +14 -0
  23. package/dist/keys-EEfxEGfO.js +140 -0
  24. package/dist/keys.d.ts +67 -0
  25. package/dist/keys.js +5 -0
  26. package/dist/oauth2-B7-6Z7Lc.js +155 -0
  27. package/dist/oauth2-DtKwtl8p.d.ts +176 -0
  28. package/dist/password-Cm0dRMwa.d.ts +385 -0
  29. package/dist/pkce-276Za_rZ.js +162 -0
  30. package/dist/pkce.d.ts +72 -0
  31. package/dist/pkce.js +3 -0
  32. package/dist/provider/code.d.ts +4 -0
  33. package/dist/provider/code.js +145 -0
  34. package/dist/provider/facebook.d.ts +137 -0
  35. package/dist/provider/facebook.js +85 -0
  36. package/dist/provider/github.d.ts +141 -0
  37. package/dist/provider/github.js +88 -0
  38. package/dist/provider/google.d.ts +113 -0
  39. package/dist/provider/google.js +62 -0
  40. package/dist/provider/oauth2.d.ts +4 -0
  41. package/dist/provider/oauth2.js +7 -0
  42. package/dist/provider/password.d.ts +4 -0
  43. package/dist/provider/password.js +366 -0
  44. package/dist/provider/provider.d.ts +3 -0
  45. package/dist/provider/provider.js +44 -0
  46. package/dist/provider-CwWMG-1l.d.ts +227 -0
  47. package/dist/random-SXMYlaVr.js +87 -0
  48. package/dist/random.d.ts +66 -0
  49. package/dist/random.js +3 -0
  50. package/dist/select-BjySLL8I.js +280 -0
  51. package/dist/storage/memory.d.ts +82 -0
  52. package/dist/storage/memory.js +127 -0
  53. package/dist/storage/storage.d.ts +2 -0
  54. package/dist/storage/storage.js +3 -0
  55. package/dist/storage/turso.d.ts +31 -0
  56. package/dist/storage/turso.js +117 -0
  57. package/dist/storage/unstorage.d.ts +38 -0
  58. package/dist/storage/unstorage.js +97 -0
  59. package/dist/storage-BEaqEPNQ.js +62 -0
  60. package/dist/storage-CxKerLlc.d.ts +162 -0
  61. package/dist/subject-DiQdRWGt.d.ts +62 -0
  62. package/dist/subject.d.ts +3 -0
  63. package/dist/subject.js +36 -0
  64. package/dist/theme-C9by7VXf.d.ts +209 -0
  65. package/dist/theme-CswaLtbW.js +120 -0
  66. package/dist/themes/theme.d.ts +2 -0
  67. package/dist/themes/theme.js +3 -0
  68. package/dist/types.d.ts +94 -0
  69. package/dist/types.js +0 -0
  70. package/dist/ui/base.d.ts +43 -0
  71. package/dist/ui/base.js +4 -0
  72. package/dist/ui/code.d.ts +158 -0
  73. package/dist/ui/code.js +197 -0
  74. package/dist/ui/form.d.ts +31 -0
  75. package/dist/ui/form.js +3 -0
  76. package/dist/ui/icon.d.ts +98 -0
  77. package/dist/ui/icon.js +3 -0
  78. package/dist/ui/password.d.ts +54 -0
  79. package/dist/ui/password.js +300 -0
  80. package/dist/ui/select.d.ts +233 -0
  81. package/dist/ui/select.js +6 -0
  82. package/dist/util-CSdHUFOo.js +108 -0
  83. package/dist/util-ChlgVqPN.d.ts +72 -0
  84. package/dist/util.d.ts +2 -0
  85. package/dist/util.js +3 -0
  86. package/package.json +63 -0
@@ -0,0 +1,209 @@
1
+ //#region src/themes/theme.d.ts
2
+ /**
3
+ * Use one of the built-in themes.
4
+ *
5
+ * @example
6
+ *
7
+ * ```ts
8
+ * import { THEME_SST } from "@draftauth/core/themes/theme"
9
+ *
10
+ * export default issuer({
11
+ * theme: THEME_SST,
12
+ * // ...
13
+ * })
14
+ * ```
15
+ *
16
+ * Or define your own.
17
+ *
18
+ * ```ts
19
+ * import type { Theme } from "@draftauth/core/themes/theme"
20
+ *
21
+ * const MY_THEME: Theme = {
22
+ * title: "Acne",
23
+ * radius: "none",
24
+ * favicon: "https://www.example.com/favicon.svg",
25
+ * // ...
26
+ * }
27
+ *
28
+ * export default issuer({
29
+ * theme: MY_THEME,
30
+ * // ...
31
+ * })
32
+ * ```
33
+ *
34
+ * @packageDocumentation
35
+ */
36
+ /**
37
+ * A type to define values for light and dark mode.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * {
42
+ * light: "#FFF",
43
+ * dark: "#000"
44
+ * }
45
+ * ```
46
+ */
47
+ interface ColorScheme {
48
+ /**
49
+ * The value for dark mode.
50
+ */
51
+ dark: string;
52
+ /**
53
+ * The value for light mode.
54
+ */
55
+ light: string;
56
+ }
57
+ /**
58
+ * A type to define your custom theme.
59
+ */
60
+ interface Theme {
61
+ /**
62
+ * The name of your app. Also used as the title of the page.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * {
67
+ * title: "Acne"
68
+ * }
69
+ * ```
70
+ */
71
+ title?: string;
72
+ /**
73
+ * A URL to the favicon of your app.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * {
78
+ * favicon: "https://www.example.com/favicon.svg"
79
+ * }
80
+ * ```
81
+ */
82
+ favicon?: string;
83
+ /**
84
+ * The border radius of the UI elements.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * {
89
+ * radius: "none"
90
+ * }
91
+ * ```
92
+ */
93
+ radius?: "none" | "sm" | "md" | "lg" | "full";
94
+ /**
95
+ * The primary color of the theme.
96
+ *
97
+ * Takes a color or both light and dark colors.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * {
102
+ * primary: "#FF5E00"
103
+ * }
104
+ * ```
105
+ */
106
+ primary: string | ColorScheme;
107
+ /**
108
+ * The background color of the theme.
109
+ *
110
+ * Takes a color or both light and dark colors.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * {
115
+ * background: "#FFF"
116
+ * }
117
+ * ```
118
+ */
119
+ background?: string | ColorScheme;
120
+ /**
121
+ * A URL to the logo of your app.
122
+ *
123
+ * Takes a single image or both light and dark mode versions.
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * {
128
+ * logo: "https://www.example.com/logo.svg"
129
+ * }
130
+ * ```
131
+ */
132
+ logo?: string | ColorScheme;
133
+ /**
134
+ * The font family and scale of the theme.
135
+ */
136
+ font?: {
137
+ /**
138
+ * The font family of the theme.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * {
143
+ * font: {
144
+ * family: "Geist Mono, monospace"
145
+ * }
146
+ * }
147
+ * ```
148
+ */
149
+ family?: string;
150
+ /**
151
+ * The font scale of the theme. Can be used to increase or decrease the font sizes across
152
+ * the UI.
153
+ *
154
+ * @default "1"
155
+ * @example
156
+ * ```ts
157
+ * {
158
+ * font: {
159
+ * scale: "1.25"
160
+ * }
161
+ * }
162
+ * ```
163
+ */
164
+ scale?: string;
165
+ };
166
+ /**
167
+ * Custom CSS that's added to the page in a `<style>` tag.
168
+ *
169
+ * This can be used to import custom fonts.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * {
174
+ * css: `@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@100;200;300;400;500;600;700;800;900&display=swap');`
175
+ * }
176
+ * ```
177
+ */
178
+ css?: string;
179
+ }
180
+ /**
181
+ * Built-in default Draft Auth theme.
182
+ */
183
+ declare const THEME_DRAFTAUTH: Theme;
184
+ /**
185
+ * Built-in theme based on [Terminal](https://terminal.shop).
186
+ */
187
+ declare const THEME_TERMINAL: Theme;
188
+ /**
189
+ * Built-in theme based on [SST](https://sst.dev).
190
+ */
191
+ declare const THEME_SST: Theme;
192
+ /**
193
+ * Built-in theme based on [Supabase](https://supabase.com).
194
+ */
195
+ declare const THEME_SUPABASE: Theme;
196
+ /**
197
+ * Built-in theme based on [Vercel](https://vercel.com).
198
+ */
199
+ declare const THEME_VERCEL: Theme;
200
+ /**
201
+ * @internal
202
+ */
203
+ declare const setTheme: (value: Theme) => void;
204
+ /**
205
+ * @internal
206
+ */
207
+ declare const getTheme: () => any;
208
+ //#endregion
209
+ export { ColorScheme, THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, Theme, getTheme, setTheme };
@@ -0,0 +1,120 @@
1
+ //#region src/themes/theme.ts
2
+ /**
3
+ * Built-in default Draft Auth theme.
4
+ */
5
+ const THEME_DRAFTAUTH = {
6
+ title: "Draft Auth",
7
+ radius: "none",
8
+ background: {
9
+ dark: "black",
10
+ light: "white"
11
+ },
12
+ primary: {
13
+ dark: "white",
14
+ light: "black"
15
+ },
16
+ font: { family: "IBM Plex Sans, sans-serif" },
17
+ css: `
18
+ @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@100;200;300;400;500;600;700&display=swap');
19
+ `
20
+ };
21
+ /**
22
+ * Built-in theme based on [Terminal](https://terminal.shop).
23
+ */
24
+ const THEME_TERMINAL = {
25
+ title: "terminal",
26
+ radius: "none",
27
+ favicon: "https://www.terminal.shop/favicon.svg",
28
+ logo: {
29
+ dark: "https://www.terminal.shop/images/logo-white.svg",
30
+ light: "https://www.terminal.shop/images/logo-black.svg"
31
+ },
32
+ primary: "#ff5e00",
33
+ background: {
34
+ dark: "rgb(0, 0, 0)",
35
+ light: "rgb(255, 255, 255)"
36
+ },
37
+ font: { family: "Geist Mono, monospace" },
38
+ css: `
39
+ @import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100;200;300;400;500;600;700;800;900&display=swap');
40
+ `
41
+ };
42
+ /**
43
+ * Built-in theme based on [SST](https://sst.dev).
44
+ */
45
+ const THEME_SST = {
46
+ title: "SST",
47
+ favicon: "https://sst.dev/favicon.svg",
48
+ logo: {
49
+ dark: "https://sst.dev/favicon.svg",
50
+ light: "https://sst.dev/favicon.svg"
51
+ },
52
+ background: {
53
+ dark: "#1a1a2d",
54
+ light: "rgb(255, 255, 255)"
55
+ },
56
+ primary: "#f3663f",
57
+ font: { family: "Rubik, sans-serif" },
58
+ css: `
59
+ @import url('https://fonts.googleapis.com/css2?family=Rubik:wght@100;200;300;400;500;600;700;800;900&display=swap');
60
+ `
61
+ };
62
+ /**
63
+ * Built-in theme based on [Supabase](https://supabase.com).
64
+ */
65
+ const THEME_SUPABASE = {
66
+ title: "Supabase",
67
+ logo: {
68
+ dark: "https://supabase.com/dashboard/_next/image?url=%2Fdashboard%2Fimg%2Fsupabase-dark.svg&w=128&q=75",
69
+ light: "https://supabase.com/dashboard/_next/image?url=%2Fdashboard%2Fimg%2Fsupabase-light.svg&w=128&q=75"
70
+ },
71
+ background: {
72
+ dark: "#171717",
73
+ light: "#f8f8f8"
74
+ },
75
+ primary: {
76
+ dark: "#006239",
77
+ light: "#72e3ad"
78
+ },
79
+ font: { family: "Varela Round, sans-serif" },
80
+ css: `
81
+ @import url('https://fonts.googleapis.com/css2?family=Varela+Round:wght@100;200;300;400;500;600;700;800;900&display=swap');
82
+ `
83
+ };
84
+ /**
85
+ * Built-in theme based on [Vercel](https://vercel.com).
86
+ */
87
+ const THEME_VERCEL = {
88
+ title: "Vercel",
89
+ logo: {
90
+ dark: "https://vercel.com/mktng/_next/static/media/vercel-logotype-dark.e8c0a742.svg",
91
+ light: "https://vercel.com/mktng/_next/static/media/vercel-logotype-light.700a8d26.svg"
92
+ },
93
+ background: {
94
+ dark: "black",
95
+ light: "white"
96
+ },
97
+ primary: {
98
+ dark: "white",
99
+ light: "black"
100
+ },
101
+ font: { family: "Geist, sans-serif" },
102
+ css: `
103
+ @import url('https://fonts.googleapis.com/css2?family=Geist:wght@100;200;300;400;500;600;700;800;900&display=swap');
104
+ `
105
+ };
106
+ /**
107
+ * @internal
108
+ */
109
+ const setTheme = (value) => {
110
+ globalThis.DRAFTAUTH_THEME = value;
111
+ };
112
+ /**
113
+ * @internal
114
+ */
115
+ const getTheme = () => {
116
+ return globalThis.DRAFTAUTH_THEME || THEME_DRAFTAUTH;
117
+ };
118
+
119
+ //#endregion
120
+ export { THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, getTheme, setTheme };
@@ -0,0 +1,2 @@
1
+ import { ColorScheme, THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, Theme, getTheme, setTheme } from "../theme-C9by7VXf.js";
2
+ export { ColorScheme, THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, Theme, getTheme, setTheme };
@@ -0,0 +1,3 @@
1
+ import { THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, getTheme, setTheme } from "../theme-CswaLtbW.js";
2
+
3
+ export { THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, getTheme, setTheme };
@@ -0,0 +1,94 @@
1
+ //#region src/types.d.ts
2
+ /**
3
+ * Shared type definitions for Draft Auth core.
4
+ */
5
+ /**
6
+ * Authorization state for OAuth 2.0 flows.
7
+ */
8
+ interface AuthorizationState {
9
+ /** OAuth redirect URI */
10
+ redirect_uri?: string;
11
+ /** OAuth response type (code, token) */
12
+ response_type?: string;
13
+ /** OAuth state parameter for CSRF protection */
14
+ state?: string;
15
+ /** OAuth client identifier */
16
+ client_id?: string;
17
+ /** OAuth audience parameter */
18
+ audience?: string;
19
+ /** Raw scope string from request */
20
+ scope?: string;
21
+ /** Parsed OAuth scopes array */
22
+ scopes?: string[];
23
+ /** PKCE challenge data for code verification */
24
+ pkce?: PKCEChallenge;
25
+ }
26
+ /**
27
+ * Token generation result for OAuth 2.0.
28
+ */
29
+ interface TokenGenerationResult {
30
+ /** OAuth access token */
31
+ access: string;
32
+ /** Token expiration time in seconds */
33
+ expiresIn: number;
34
+ /** OAuth refresh token */
35
+ refresh: string;
36
+ }
37
+ /**
38
+ * PKCE challenge data for OAuth flows.
39
+ */
40
+ interface PKCEChallenge {
41
+ challenge: string;
42
+ method: "S256";
43
+ }
44
+ /**
45
+ * TTL configuration for tokens and sessions.
46
+ */
47
+ interface TtlConfiguration {
48
+ /** Access token TTL in seconds */
49
+ access: number;
50
+ /** Refresh token TTL in seconds */
51
+ refresh: number;
52
+ }
53
+ /**
54
+ * Refresh token storage payload structure.
55
+ * Contains metadata about issued refresh tokens.
56
+ */
57
+ interface RefreshTokenStoragePayload {
58
+ /** Subject type identifier */
59
+ type: string;
60
+ /** Subject properties/claims */
61
+ properties: unknown;
62
+ /** Resolved subject identifier for JWT */
63
+ subject: string;
64
+ /** Client identifier that owns this refresh token */
65
+ clientID: string;
66
+ /** OAuth scopes associated with this token */
67
+ scopes?: string[];
68
+ /** Timestamp when the refresh token was first used */
69
+ timeUsed?: number;
70
+ }
71
+ /**
72
+ * Code storage payload for authorization code grant.
73
+ * Used for storing authorization code data during OAuth flows.
74
+ */
75
+ interface CodeStoragePayload {
76
+ /** Subject type identifier */
77
+ type: string;
78
+ /** Subject properties/claims */
79
+ properties: unknown;
80
+ /** Resolved subject identifier for JWT */
81
+ subject: string;
82
+ /** Redirect URI used in authorization request */
83
+ redirectURI: string;
84
+ /** Client identifier */
85
+ clientID: string;
86
+ /** OAuth scopes */
87
+ scopes?: string[];
88
+ /** Token TTL configuration */
89
+ ttl: TtlConfiguration;
90
+ /** PKCE challenge data */
91
+ pkce?: PKCEChallenge;
92
+ }
93
+ //#endregion
94
+ export { AuthorizationState, CodeStoragePayload, PKCEChallenge, RefreshTokenStoragePayload, TokenGenerationResult, TtlConfiguration };
package/dist/types.js ADDED
File without changes
@@ -0,0 +1,43 @@
1
+ //#region src/ui/base.d.ts
2
+ type PropsWithChildren<P = {}> = P & {
3
+ children?: string;
4
+ };
5
+ /**
6
+ * Base layout component for Draft Auth UI.
7
+ * Provides theming, responsive design, and consistent styling across all auth screens.
8
+ *
9
+ * ## Features
10
+ *
11
+ * - **Theme Support**: Light/dark mode with custom colors and fonts
12
+ * - **Responsive Design**: Adapts to different screen sizes
13
+ * - **Custom Branding**: Support for custom logos and styling
14
+ * - **CSS Variables**: Uses CSS custom properties for theming
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * <Layout size="small">
19
+ *   <div>Your auth form content</div>
20
+ * </Layout>
21
+ * ```
22
+ */
23
+ /**
24
+ * Props for the Layout component.
25
+ */
26
+ interface LayoutProps {
27
+ /**
28
+ * Optional size variant for the layout container.
29
+ *
30
+ * @default undefined (normal size)
31
+ */
32
+ readonly size?: "small";
33
+ }
34
+ /**
35
+ * Main layout component that wraps all authentication UI screens.
36
+ * Handles theming, logo display, and provides consistent styling.
37
+ *
38
+ * @param props - Layout props including children and optional size
39
+ * @returns Complete HTML document as a string with theming and branding applied
40
+ */
41
+ declare const Layout: (props: PropsWithChildren<LayoutProps>) => string;
42
+ //#endregion
43
+ export { Layout, LayoutProps };
@@ -0,0 +1,4 @@
1
+ import "../theme-CswaLtbW.js";
2
+ import { Layout } from "../base-DRutbxgL.js";
3
+
4
+ export { Layout };
@@ -0,0 +1,158 @@
1
+ import "../storage-CxKerLlc.js";
2
+ import "../provider-CwWMG-1l.js";
3
+ import { CodeProviderError, CodeProviderOptions } from "../code-l_uvMR1j.js";
4
+
5
+ //#region src/ui/code.d.ts
6
+
7
+ /**
8
+ * Default text copy for the PIN code authentication UI.
9
+ * All text can be customized via the copy prop.
10
+ */
11
+ declare const DEFAULT_COPY: {
12
+ /** Placeholder text for the email/contact input field */
13
+ email_placeholder: string;
14
+ /** Error message displayed when the entered email/contact is invalid */
15
+ email_invalid: string;
16
+ /** Text for the primary action button */
17
+ button_continue: string;
18
+ /** Informational text explaining that a PIN code will be sent */
19
+ code_info: string;
20
+ /** Placeholder text for the PIN code input field */
21
+ code_placeholder: string;
22
+ /** Error message displayed when the entered PIN code is incorrect */
23
+ code_invalid: string;
24
+ /** Success message prefix when code is initially sent */
25
+ code_sent: string;
26
+ /** Success message prefix when code is resent */
27
+ code_resent: string;
28
+ /** Text asking if user didn't receive the code */
29
+ code_didnt_get: string;
30
+ /** Text for the resend code button */
31
+ code_resend: string;
32
+ };
33
+ /**
34
+ * Type for customizable UI copy text.
35
+ * All properties are optional to allow partial customization.
36
+ */
37
+ type CodeUICopy = typeof DEFAULT_COPY;
38
+ /**
39
+ * Input mode for the contact field.
40
+ * Determines the input type and validation behavior.
41
+ */
42
+ type CodeUIMode = "email" | "phone";
43
+ /**
44
+ * Configuration options for the CodeUI component.
45
+ */
46
+ interface CodeUIOptions {
47
+ /**
48
+ * Callback function for sending PIN codes to users.
49
+ * Should handle delivery via email, SMS, or other channels based on the claims.
50
+ *
51
+ * @param claims - User contact information (email, phone, etc.)
52
+ * @param code - The generated PIN code to send
53
+ * @returns Promise resolving to undefined on success, or error object on failure
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * sendCode: async (claims, code) => {
58
+ * if (claims.email) {
59
+ * await emailService.send({
60
+ * to: claims.email,
61
+ * subject: 'Your verification code',
62
+ * text: `Your PIN code is: ${code}`
63
+ * })
64
+ * } else if (claims.phone) {
65
+ * await smsService.send(claims.phone, `PIN: ${code}`)
66
+ * } else {
67
+ * return {
68
+ * type: "invalid_claim",
69
+ * key: "contact",
70
+ * value: "Email or phone required"
71
+ * }
72
+ * }
73
+ * }
74
+ * ```
75
+ */
76
+ sendCode: (claims: Record<string, string>, code: string) => Promise<CodeProviderError | undefined>;
77
+ /**
78
+ * Custom text copy for UI labels and messages.
79
+ * Allows full customization of all displayed text.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * copy: {
84
+ * email_placeholder: "Enter your email address",
85
+ * code_info: "Check your email for a 6-digit verification code",
86
+ * button_continue: "Verify",
87
+ * code_invalid: "The code you entered is incorrect"
88
+ * }
89
+ * ```
90
+ */
91
+ readonly copy?: Partial<CodeUICopy>;
92
+ /**
93
+ * Input mode determining the type of contact information to collect.
94
+ *
95
+ * @default "email"
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * mode: "phone" // Collect phone numbers instead of emails
100
+ * ```
101
+ */
102
+ readonly mode?: CodeUIMode;
103
+ }
104
+ /**
105
+ * Creates a complete UI configuration for PIN code authentication.
106
+ * Provides pre-built forms for collecting user contact info and verifying PIN codes.
107
+ *
108
+ * @param options - Configuration options for the UI
109
+ * @returns Complete CodeProvider configuration with UI handlers
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * // Basic email-based PIN authentication
114
+ * const emailCodeUI = CodeUI({
115
+ * sendCode: async (claims, code) => {
116
+ * await emailService.send(claims.email, `Code: ${code}`)
117
+ * }
118
+ * })
119
+ *
120
+ * // Phone-based PIN authentication with custom copy
121
+ * const phoneCodeUI = CodeUI({
122
+ * mode: "phone",
123
+ * copy: {
124
+ * email_placeholder: "Phone number",
125
+ * code_info: "We'll send a verification code via SMS",
126
+ * email_invalid: "Please enter a valid phone number"
127
+ * },
128
+ * sendCode: async (claims, code) => {
129
+ * await smsService.send(claims.phone, `Verification: ${code}`)
130
+ * }
131
+ * })
132
+ *
133
+ * // Multi-mode authentication
134
+ * const flexibleCodeUI = CodeUI({
135
+ * copy: {
136
+ * email_placeholder: "Email or phone number",
137
+ * code_info: "We'll send a code to your email or phone"
138
+ * },
139
+ * sendCode: async (claims, code) => {
140
+ * if (claims.email && claims.email.includes('@')) {
141
+ * await emailService.send(claims.email, `Code: ${code}`)
142
+ * } else if (claims.email) {
143
+ * // Treat as phone number if no @ symbol
144
+ * await smsService.send(claims.email, `Code: ${code}`)
145
+ * } else {
146
+ * return {
147
+ * type: "invalid_claim",
148
+ * key: "contact",
149
+ * value: "Email or phone required"
150
+ * }
151
+ * }
152
+ * }
153
+ * })
154
+ * ```
155
+ */
156
+ declare const CodeUI: (options: CodeUIOptions) => CodeProviderOptions;
157
+ //#endregion
158
+ export { CodeUI, CodeUICopy, CodeUIMode, CodeUIOptions };