@ory/elements-react 0.0.0-pr.14760211

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 (62) hide show
  1. package/CHANGELOG.md +617 -0
  2. package/DEVELOPMENT.md +94 -0
  3. package/LICENSE +201 -0
  4. package/README.md +503 -0
  5. package/babel.config.js +10 -0
  6. package/dist/client/config.d.mts +21 -0
  7. package/dist/client/config.d.ts +21 -0
  8. package/dist/client/config.js +77 -0
  9. package/dist/client/config.js.map +1 -0
  10. package/dist/client/config.mjs +51 -0
  11. package/dist/client/config.mjs.map +1 -0
  12. package/dist/client/frontendClient.d.mts +10 -0
  13. package/dist/client/frontendClient.d.ts +10 -0
  14. package/dist/client/frontendClient.js +75 -0
  15. package/dist/client/frontendClient.js.map +1 -0
  16. package/dist/client/frontendClient.mjs +54 -0
  17. package/dist/client/frontendClient.mjs.map +1 -0
  18. package/dist/client/index.d.mts +5 -0
  19. package/dist/client/index.d.ts +5 -0
  20. package/dist/client/index.js +33 -0
  21. package/dist/client/index.js.map +1 -0
  22. package/dist/client/index.mjs +10 -0
  23. package/dist/client/index.mjs.map +1 -0
  24. package/dist/client/session-provider.d.mts +62 -0
  25. package/dist/client/session-provider.d.ts +62 -0
  26. package/dist/client/session-provider.js +96 -0
  27. package/dist/client/session-provider.js.map +1 -0
  28. package/dist/client/session-provider.mjs +71 -0
  29. package/dist/client/session-provider.mjs.map +1 -0
  30. package/dist/client/useSession.d.mts +32 -0
  31. package/dist/client/useSession.d.ts +32 -0
  32. package/dist/client/useSession.js +37 -0
  33. package/dist/client/useSession.js.map +1 -0
  34. package/dist/client/useSession.mjs +13 -0
  35. package/dist/client/useSession.mjs.map +1 -0
  36. package/dist/index.d.mts +655 -0
  37. package/dist/index.d.ts +655 -0
  38. package/dist/index.js +4310 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/index.mjs +4287 -0
  41. package/dist/index.mjs.map +1 -0
  42. package/dist/theme/default/index.css +1580 -0
  43. package/dist/theme/default/index.css.map +1 -0
  44. package/dist/theme/default/index.d.mts +104 -0
  45. package/dist/theme/default/index.d.ts +104 -0
  46. package/dist/theme/default/index.js +6031 -0
  47. package/dist/theme/default/index.js.map +1 -0
  48. package/dist/theme/default/index.mjs +6104 -0
  49. package/dist/theme/default/index.mjs.map +1 -0
  50. package/dist/theme/default/tailwind/defaults.d.mts +737 -0
  51. package/dist/theme/default/tailwind/defaults.d.ts +737 -0
  52. package/dist/theme/default/tailwind/defaults.js +219 -0
  53. package/dist/theme/default/tailwind/defaults.js.map +1 -0
  54. package/dist/theme/default/tailwind/defaults.mjs +196 -0
  55. package/dist/theme/default/tailwind/defaults.mjs.map +1 -0
  56. package/package.json +97 -0
  57. package/tailwind/defaults.ts +34 -0
  58. package/tailwind/generated/README.md +2 -0
  59. package/tailwind/generated/default-variables.css +216 -0
  60. package/tailwind/generated/variables-processed.json +161 -0
  61. package/tsconfig.json +36 -0
  62. package/tsconfig.runtime.json +4 -0
@@ -0,0 +1,655 @@
1
+ import { UiNodeInputAttributes, UiNode, UiNodeAnchorAttributes, UiNodeTextAttributes, UiNodeImageAttributes, UiNodeGroupEnum, UiText, ConfigurationParameters, AccountExperienceConfiguration, FlowType, LoginFlow, RegistrationFlow, RecoveryFlow, VerificationFlow, SettingsFlow, UiContainer, OAuth2ConsentRequest, Session, FlowError, UpdateLoginFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, UpdateRecoveryFlowBody, UpdateSettingsFlowBody, OnRedirectHandler } from '@ory/client-fetch';
2
+ import { ComponentPropsWithoutRef, FormEventHandler, MouseEventHandler, PropsWithChildren, DetailedHTMLProps, HTMLAttributes, ComponentType, Dispatch } from 'react';
3
+ import * as class_variance_authority_types from 'class-variance-authority/types';
4
+ import { VariantProps } from 'class-variance-authority';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import { IntlShape } from 'react-intl';
7
+
8
+ declare const buttonStyles: (props?: ({
9
+ intent?: "primary" | "secondary" | null | undefined;
10
+ defaultVariants?: "intent" | null | undefined;
11
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
12
+ type ButtonVariants = VariantProps<typeof buttonStyles>;
13
+
14
+ type OryNodeButtonProps = {
15
+ attributes: UiNodeInputAttributes;
16
+ node: UiNode;
17
+ } & Omit<ComponentPropsWithoutRef<"button">, "children"> & ButtonVariants;
18
+ type OryNodeAnchorProps = {
19
+ attributes: UiNodeAnchorAttributes;
20
+ node: UiNode;
21
+ } & Omit<ComponentPropsWithoutRef<"a">, "children">;
22
+ type OryNodeLabelProps = {
23
+ attributes: UiNodeInputAttributes;
24
+ node: UiNode;
25
+ } & ComponentPropsWithoutRef<"label">;
26
+ type OryNodeTextProps = {
27
+ attributes: UiNodeTextAttributes;
28
+ node: UiNode;
29
+ };
30
+ type OryCardLogoProps = Record<string, never>;
31
+ type OryNodeCaptchaProps = {
32
+ node: UiNode;
33
+ };
34
+ /**
35
+ * Props for the AuthMethodListItem component. This component is used
36
+ * to render a single auth method in the AuthMethodList component.
37
+ */
38
+ type OryCardAuthMethodListItemProps = {
39
+ onClick: () => void;
40
+ group: string;
41
+ title?: {
42
+ id: string;
43
+ values?: Record<string, string>;
44
+ };
45
+ };
46
+ type OryNodeImageProps = {
47
+ attributes: UiNodeImageAttributes;
48
+ node: UiNode;
49
+ };
50
+ /**
51
+ * A generic type for the form values.
52
+ */
53
+ type FormValues = Record<string, string | boolean | number | undefined>;
54
+ type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
55
+ onSubmit: FormEventHandler<HTMLFormElement>;
56
+ "data-testid"?: string;
57
+ };
58
+ type OryNodeInputProps = {
59
+ attributes: UiNodeInputAttributes;
60
+ node: UiNode;
61
+ onClick?: MouseEventHandler;
62
+ };
63
+ type OryNodeConsentScopeCheckboxProps = {
64
+ attributes: UiNodeInputAttributes;
65
+ node: UiNode;
66
+ onCheckedChange: (checked: boolean) => void;
67
+ };
68
+ type OryFormSectionContentProps = PropsWithChildren<{
69
+ title?: string;
70
+ description?: string;
71
+ }>;
72
+ type OryFormSectionFooterProps = PropsWithChildren<{
73
+ text?: string;
74
+ }>;
75
+
76
+ type OryCardHeaderProps = Record<string, never>;
77
+ declare function OryCardHeader(): react_jsx_runtime.JSX.Element;
78
+
79
+ type OryCardRootProps = PropsWithChildren;
80
+ /**
81
+ * The root component of the Ory Card.
82
+ *
83
+ * This can be used to build fully custom implementations of the Ory Flows.
84
+ *
85
+ * However, you most likely want to override the individual components instead.
86
+ *
87
+ * @param props - pass children to render instead of the default Ory Card components
88
+ * @returns
89
+ */
90
+ declare function OryCard({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
91
+
92
+ type OryCardFooterProps = Record<string, never>;
93
+ declare function OryCardFooter(): react_jsx_runtime.JSX.Element;
94
+
95
+ /**
96
+ * Props for the OryCardContent component.
97
+ */
98
+ type OryCardContentProps = PropsWithChildren;
99
+ /**
100
+ * A component that renders the content of the Ory Card.
101
+ * This is the main content of the card, such as the flow's form, with it's input fields and messages.
102
+ *
103
+ * You can use this component to build fully custom implementations of the Ory Flows.
104
+ *
105
+ * However, you most likely want to override the individual components instead.
106
+ *
107
+ * @param props - pass children to render instead of the default Ory Card components
108
+ * @returns
109
+ */
110
+ declare function OryCardContent({ children }: OryCardContentProps): react_jsx_runtime.JSX.Element;
111
+
112
+ declare function OryTwoStepCard(): react_jsx_runtime.JSX.Element;
113
+
114
+ declare function OryConsentCard(): react_jsx_runtime.JSX.Element;
115
+
116
+ /**
117
+ * Props type for the Form Group Divider component.
118
+ */
119
+ type OryCardDividerProps = Record<string, never>;
120
+ /**
121
+ * Renders the @see Card.Divider between the groups of nodes in the Ory Form.
122
+ *
123
+ * You can use this component to build fully custom implementations of the Ory Flows.
124
+ *
125
+ * However, you most likely want to override the individual components instead.
126
+ *
127
+ * @returns
128
+ */
129
+ declare function OryFormGroupDivider(): react_jsx_runtime.JSX.Element | null;
130
+
131
+ type OryPageHeaderProps = Record<never, never>;
132
+ declare const HeadlessPageHeader: () => react_jsx_runtime.JSX.Element;
133
+
134
+ declare function OrySettingsCard(): react_jsx_runtime.JSX.Element;
135
+
136
+ type OrySettingsRecoveryCodesProps = {
137
+ codes: string[];
138
+ regnerateButton: UiNode | undefined;
139
+ revealButton: UiNode | undefined;
140
+ onRegenerate: () => void;
141
+ onReveal: () => void;
142
+ };
143
+ type OrySettingsTotpProps = {
144
+ totpImage: UiNode | undefined;
145
+ totpSecret: UiNode | undefined;
146
+ totpInput: UiNode | undefined;
147
+ totpUnlink: UiNode | undefined;
148
+ onUnlink: () => void;
149
+ };
150
+ type OrySettingsOidcProps = {
151
+ linkButtons: (UiNode & {
152
+ onClick: () => void;
153
+ })[];
154
+ unlinkButtons: (UiNode & {
155
+ onClick: () => void;
156
+ })[];
157
+ };
158
+ type OrySettingsWebauthnProps = {
159
+ nameInput: UiNode;
160
+ triggerButton: UiNode & {
161
+ onClick: () => void;
162
+ };
163
+ removeButtons: (UiNode & {
164
+ onClick: () => void;
165
+ })[];
166
+ };
167
+ type OrySettingsPasskeyProps = {
168
+ triggerButton: UiNode & {
169
+ onClick: () => void;
170
+ };
171
+ removeButtons: (UiNode & {
172
+ onClick: () => void;
173
+ })[];
174
+ };
175
+
176
+ type OryFormGroupsProps = PropsWithChildren<{
177
+ groups: UiNodeGroupEnum[];
178
+ }>;
179
+ type OryFormGroupProps = PropsWithChildren;
180
+ declare function OryFormGroups({ groups }: OryFormGroupsProps): react_jsx_runtime.JSX.Element;
181
+
182
+ type OryMessageContentProps = {
183
+ message: UiText;
184
+ };
185
+ type OryMessageRootProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
186
+ declare function OryCardValidationMessages({ ...props }: OryMessageRootProps): react_jsx_runtime.JSX.Element | null;
187
+
188
+ type OryFormProps$1 = Omit<ComponentPropsWithoutRef<"form">, "action" | "method" | "onSubmit">;
189
+ type OryFormSectionProps = PropsWithChildren<OryFormProps$1 & {
190
+ nodes?: UiNode[];
191
+ }>;
192
+ type OryCardSettingsSectionProps = PropsWithChildren & {
193
+ action: string;
194
+ method: string;
195
+ onSubmit: FormEventHandler<HTMLFormElement>;
196
+ };
197
+ declare function OryFormSection({ children, nodes, ...rest }: OryFormSectionProps): react_jsx_runtime.JSX.Element;
198
+
199
+ type OryFormOidcRootProps = PropsWithChildren<{
200
+ nodes: UiNode[];
201
+ }>;
202
+ type OryNodeOidcButtonProps = {
203
+ node: UiNode;
204
+ attributes: UiNodeInputAttributes;
205
+ onClick?: () => void;
206
+ };
207
+ declare function OryFormOidcButtons(): react_jsx_runtime.JSX.Element | null;
208
+ declare function OryFormSocialButtonsForm(): react_jsx_runtime.JSX.Element | null;
209
+
210
+ /**
211
+ * A record of all the components that are used in the OryForm component.
212
+ */
213
+ type OryFlowComponents = {
214
+ Node: {
215
+ /**
216
+ * Button component, rendered whenever a button is encountered in the Ory UI Nodes.
217
+ */
218
+ Button: ComponentType<OryNodeButtonProps>;
219
+ /**
220
+ * The SocialButton component is rendered whenever a button of group "oidc" node is encountered.
221
+ *
222
+ * It renders the "Login with Google", "Login with Facebook" etc. buttons.
223
+ */
224
+ OidcButton: ComponentType<OryNodeOidcButtonProps>;
225
+ /**
226
+ * Anchor component, rendered whenever an "anchor" node is encountered
227
+ */
228
+ Anchor: ComponentType<OryNodeAnchorProps>;
229
+ /**
230
+ * The Input component is rendered whenever a "input" node is encountered.
231
+ */
232
+ Input: ComponentType<OryNodeInputProps>;
233
+ /**
234
+ * Special version of the Input component for OTP codes.
235
+ */
236
+ CodeInput: ComponentType<OryNodeInputProps>;
237
+ /**
238
+ * The Image component is rendered whenever an "image" node is encountered.
239
+ *
240
+ * For example used in the "Logo" node.
241
+ */
242
+ Image: ComponentType<OryNodeImageProps>;
243
+ /**
244
+ * The Label component is rendered around Input components and is used to render form labels.
245
+ */
246
+ Label: ComponentType<OryNodeLabelProps>;
247
+ /**
248
+ * The Checkbox component is rendered whenever an input node with of boolean type is encountered.
249
+ */
250
+ Checkbox: ComponentType<OryNodeInputProps>;
251
+ /**
252
+ * The Text component is rendered whenever a "text" node is encountered.
253
+ */
254
+ Text: ComponentType<OryNodeTextProps>;
255
+ /**
256
+ * The Captcha component is rendered whenever a "captcha" group is encountered.
257
+ */
258
+ Captcha: ComponentType<OryNodeCaptchaProps>;
259
+ /**
260
+ * Special version of the Input component for scopes in OAuth2 flows.
261
+ */
262
+ ConsentScopeCheckbox: ComponentType<OryNodeConsentScopeCheckboxProps>;
263
+ };
264
+ Card: {
265
+ /**
266
+ * The card container is the main container of the card.
267
+ */
268
+ Root: ComponentType<OryCardRootProps>;
269
+ /**
270
+ * The card footer is the footer of the card container.
271
+ */
272
+ Footer: ComponentType<OryCardFooterProps>;
273
+ /**
274
+ * The card header is the header of the card container.
275
+ */
276
+ Header: ComponentType<OryCardRootProps>;
277
+ /**
278
+ * The card content is the main content of the card container.
279
+ */
280
+ Content: ComponentType<OryCardContentProps>;
281
+ /**
282
+ * The card logo is the logo of the card container.
283
+ */
284
+ Logo: ComponentType<OryCardLogoProps>;
285
+ /**
286
+ * The HorizontalDivider component is rendered between groups.
287
+ */
288
+ Divider: ComponentType<OryCardDividerProps>;
289
+ /**
290
+ * The AuthMethodListContainer component is rendered around the "method" chooser step in the identifier_first login flow.
291
+ *
292
+ * This is only used, if login is configured to use identifier_first authentication.
293
+ */
294
+ AuthMethodListContainer: ComponentType<PropsWithChildren>;
295
+ /**
296
+ * The AuthMethodListItem component is rendered on the "method" chooser step in the identifier_first login flow.
297
+ *
298
+ * This is only used, if login is configured to use identifier_first authentication.
299
+ */
300
+ AuthMethodListItem: ComponentType<OryCardAuthMethodListItemProps>;
301
+ /**
302
+ * The SettingsSection component is rendered around each section of the settings.
303
+ */
304
+ SettingsSection: ComponentType<OryCardSettingsSectionProps>;
305
+ /**
306
+ * The SettingsSectionContent component is rendered around the content of each section of the settings.
307
+ */
308
+ SettingsSectionContent: ComponentType<OryFormSectionContentProps>;
309
+ /**
310
+ * The SettingsSectionFooter component is rendered around the footer of each section of the settings.
311
+ */
312
+ SettingsSectionFooter: ComponentType<OryFormSectionFooterProps>;
313
+ };
314
+ Form: {
315
+ /**
316
+ * The FormContainer component is the main container of the form.
317
+ *
318
+ * It should render its children.
319
+ *
320
+ * You most likely don't want to override this component directly.
321
+ */
322
+ Root: ComponentType<OryFormRootProps>;
323
+ /**
324
+ * A special form group container for the social buttons.
325
+ *
326
+ * This is required, because the social buttons need to be in its form, to not influence the other form groups.
327
+ *
328
+ * You most likely don't want to override this component directly.
329
+ */
330
+ OidcRoot: ComponentType<OryFormOidcRootProps>;
331
+ /**
332
+ * The FormGroup is rendered around each group of nodes in the UI nodes.
333
+ */
334
+ Group: ComponentType<OryFormGroupProps>;
335
+ /**
336
+ * The section on the settings page, rendering the OIDC settings
337
+ */
338
+ OidcSettings: ComponentType<OrySettingsOidcProps>;
339
+ /**
340
+ * The section on the settings page, rendering the Webauthn settings
341
+ */
342
+ WebauthnSettings: ComponentType<OrySettingsWebauthnProps>;
343
+ /**
344
+ * The section on the settings page, rendering the Passkey settings
345
+ */
346
+ PasskeySettings: ComponentType<OrySettingsPasskeyProps>;
347
+ /**
348
+ * The section on the settings page, rendering the TOTP settings
349
+ */
350
+ TotpSettings: ComponentType<OrySettingsTotpProps>;
351
+ /**
352
+ * The section on the settings page, rendering the recovery code settings
353
+ */
354
+ RecoveryCodesSettings: ComponentType<OrySettingsRecoveryCodesProps>;
355
+ };
356
+ Message: {
357
+ /**
358
+ * The MessageContainer is rendered around the messages.
359
+ */
360
+ Root: ComponentType<OryMessageRootProps>;
361
+ /**
362
+ * The Message component is rendered whenever a message is encountered.
363
+ */
364
+ Content: ComponentType<OryMessageContentProps>;
365
+ };
366
+ Page: {
367
+ Header: ComponentType<OryPageHeaderProps>;
368
+ };
369
+ };
370
+ type DeepPartialTwoLevels<T> = {
371
+ [P in keyof T]?: T[P] extends object ? {
372
+ [K in keyof T[P]]?: T[P][K];
373
+ } : T[P];
374
+ };
375
+ type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
376
+ type OryFormProps = PropsWithChildren<{
377
+ onAfterSubmit?: (method: string | number | boolean | undefined) => void;
378
+ "data-testid"?: string;
379
+ }>;
380
+ declare function OryForm({ children, onAfterSubmit, "data-testid": dataTestId, }: OryFormProps): react_jsx_runtime.JSX.Element;
381
+
382
+ declare function useComponents(): OryFlowComponents;
383
+ declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
384
+ flowType: string;
385
+ }) => number;
386
+
387
+ type LocaleMap = Record<string, Record<string, string>>;
388
+ declare const OryLocales: LocaleMap;
389
+
390
+ type Locale = keyof typeof OryLocales;
391
+ type IntlContextProps = {
392
+ locale: Locale;
393
+ customTranslations?: Partial<LocaleMap>;
394
+ };
395
+
396
+ type IntlConfig = IntlContextProps;
397
+ /**
398
+ * The configuration for Ory Elements.
399
+ *
400
+ * This configuration is used to customize the behavior and appearance of Ory Elements.
401
+ *
402
+ * By setting UI urls, you can override the default URLs for the login, registration, recovery, and verification flows.
403
+ *
404
+ * You can also set the name of the application, the logo URL, and the SDK configuration.
405
+ * By default, the name and logo are displayed in the card's header.
406
+ */
407
+ type OryClientConfiguration = {
408
+ /**
409
+ * An optional logo URL to display in the UI instead of the name.
410
+ * @deprecated Use `project.logo_light_url` instead.
411
+ */
412
+ logoUrl?: string;
413
+ /**
414
+ * The SDK configuration.
415
+ * This configuration is used to set the URL of the Ory SDK and any additional options used for the SDK client.
416
+ */
417
+ sdk: {
418
+ url: string;
419
+ options?: Partial<ConfigurationParameters>;
420
+ };
421
+ /**
422
+ * The internationalization configuration.
423
+ * This configuration is used to set the locale and any additional options used for the i18n library.
424
+ * The locale is used to determine the language of the UI.
425
+ * The default locale is "en".
426
+ */
427
+ intl?: IntlConfig;
428
+ } & ({
429
+ /**
430
+ * The name of the application the user is logging in to.
431
+ * @deprecated Use `project.name` instead.
432
+ */
433
+ name: string;
434
+ /**
435
+ * The configuration for the project.
436
+ */
437
+ project: Omit<AccountExperienceConfiguration, "name"> & {
438
+ name?: string;
439
+ };
440
+ } | {
441
+ /**
442
+ * The name of the application the user is logging in to.
443
+ * @deprecated Use `project.name` instead.
444
+ */
445
+ name?: string;
446
+ /**
447
+ * The configuration for the project.
448
+ */
449
+ project: AccountExperienceConfiguration;
450
+ });
451
+
452
+ /**
453
+ * A generic flow container, containing a flowType, the flow itself and the config object
454
+ *
455
+ * @see OryClientConfiguration
456
+ */
457
+ type OryFlow<TFlowType extends FlowType, TFlow> = {
458
+ flowType: TFlowType;
459
+ flow: TFlow;
460
+ config: OryClientConfiguration;
461
+ };
462
+ /**
463
+ * A flow container for the login flow
464
+ *
465
+ * @see OryFlow
466
+ * @see LoginFlow
467
+ */
468
+ type LoginFlowContainer = OryFlow<FlowType.Login, LoginFlow>;
469
+ /**
470
+ * A flow container for the registration flow
471
+ *
472
+ * @see OryFlow
473
+ * @see RegistrationFlow
474
+ */
475
+ type RegistrationFlowContainer = OryFlow<FlowType.Registration, RegistrationFlow>;
476
+ /**
477
+ * A flow container for the recovery flow
478
+ *
479
+ * @see OryFlow
480
+ * @see RecoveryFlow
481
+ */
482
+ type RecoveryFlowContainer = OryFlow<FlowType.Recovery, RecoveryFlow>;
483
+ /**
484
+ * A flow container for the verification flow
485
+ *
486
+ * @see OryFlow
487
+ * @see VerificationFlow
488
+ *
489
+ */
490
+ type VerificationFlowContainer = OryFlow<FlowType.Verification, VerificationFlow>;
491
+ /**
492
+ * A flow container for the settings flow
493
+ *
494
+ * @see OryFlow
495
+ * @see SettingsFlow
496
+ */
497
+ type SettingsFlowContainer = OryFlow<FlowType.Settings, SettingsFlow>;
498
+ /**
499
+ * A flow container for the error flow
500
+ *
501
+ * @see OryFlow
502
+ * @see FlowError (Error flow)
503
+ *
504
+ */
505
+ type ErrorFlowContainer = OryFlow<FlowType.Error, FlowError>;
506
+ type ConsentFlow = {
507
+ created_at: Date;
508
+ expires_at: Date;
509
+ id: string;
510
+ issued_at: Date;
511
+ state: "show_form" | "rejected" | "accepted";
512
+ active: string;
513
+ ui: UiContainer;
514
+ consent_request: OAuth2ConsentRequest;
515
+ session: Session;
516
+ return_to?: string;
517
+ };
518
+ type ConsentFlowContainer = OryFlow<FlowType.OAuth2Consent, ConsentFlow>;
519
+ /**
520
+ * A union type of all flow containers
521
+ */
522
+ type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer | ConsentFlowContainer;
523
+
524
+ /**
525
+ * Converts a UiText to a FormattedMessage.
526
+ * The UiText contains the id of the message and the context.
527
+ * The context is used to inject values into the message from Ory, e.g. a timestamp.
528
+ * For example a UI Node from Ory might look like this:
529
+ *
530
+ * \{
531
+ * "type":"input",
532
+ * "group":"default",
533
+ * "attributes": \{
534
+ * "name":"traits.email",
535
+ * "type":"email",
536
+ * "required":true,
537
+ * "autocomplete":"email",
538
+ * "disabled":false,
539
+ * "node_type":"input"
540
+ * \},
541
+ * "messages":[],
542
+ * "meta": \{
543
+ * "label": \{
544
+ * "id":1070002,
545
+ * "text":"E-Mail",
546
+ * "type":"info",
547
+ * "context":\{
548
+ * "title":"E-Mail"
549
+ * \},
550
+ * \}
551
+ * \}
552
+ * \}
553
+ *
554
+ * The context has the key "title" which matches the formatter template name "\{title\}"
555
+ * An example translation file would look like this:
556
+ * \{
557
+ * "identities.messages.1070002": "\{title\}"
558
+ * \}
559
+ *
560
+ * The formatter would then take the meta.label.id and look for the translation with the key matching the id.
561
+ * It would then replace the template "\{title\}" with the value from the context with the key "title".
562
+ *
563
+ * @param uiText - The UiText is part of the UiNode object sent by Kratos when performing a flow.
564
+ * @param intl - The intl object from react-intl
565
+ */
566
+ declare const uiTextToFormattedMessage: ({ id, context, text }: Omit<UiText, "type">, intl: IntlShape) => string;
567
+
568
+ /**
569
+ * Props for the submit handler
570
+ */
571
+ type OnSubmitHandlerProps<T extends UpdateLoginFlowBody | UpdateRegistrationFlowBody | UpdateVerificationFlowBody | UpdateRecoveryFlowBody | UpdateSettingsFlowBody> = {
572
+ /**
573
+ * This method is used to update the flow container when a validation error occurs, for example.
574
+ */
575
+ setFlowContainer: (flowContainer: OryFlowContainer) => void;
576
+ /**
577
+ * The form values to submit.
578
+ */
579
+ body: T;
580
+ /**
581
+ * This method is used to redirect the user to a different page.
582
+ */
583
+ onRedirect: OnRedirectHandler;
584
+ };
585
+
586
+ /**
587
+ * Helper function to generate a test id for a UiText message.
588
+ *
589
+ * @param message - the UiText message to generate a test id for
590
+ * @returns a unique, stable test id for the message
591
+ */
592
+ declare function messageTestId(message: {
593
+ id: number | string;
594
+ }): {
595
+ "data-testid": string;
596
+ };
597
+
598
+ type FormStateSelectMethod = {
599
+ current: "select_method";
600
+ };
601
+ type FormStateProvideIdentifier = {
602
+ current: "provide_identifier";
603
+ };
604
+ type FormStateMethodActive = {
605
+ current: "method_active";
606
+ method: UiNodeGroupEnum;
607
+ };
608
+ type FormState = FormStateSelectMethod | FormStateProvideIdentifier | FormStateMethodActive | {
609
+ current: "success_screen";
610
+ } | {
611
+ current: "settings";
612
+ };
613
+ type FormStateAction = {
614
+ type: "action_flow_update";
615
+ flow: OryFlowContainer;
616
+ } | {
617
+ type: "action_select_method";
618
+ method: UiNodeGroupEnum;
619
+ };
620
+
621
+ /**
622
+ * Returns an object that contains the current flow and the flow type, as well as the configuration.
623
+ *
624
+ * @returns The current flow container
625
+ */
626
+ declare function useOryFlow(): FlowContextValue;
627
+ /**
628
+ * Function to set the flow container.
629
+ */
630
+ type FlowContainerSetter = Dispatch<OryFlowContainer>;
631
+ /**
632
+ * The return value of the OryFlowContext.
633
+ */
634
+ type FlowContextValue = OryFlowContainer & {
635
+ /**
636
+ * Function to set the flow container.
637
+ */
638
+ setFlowContainer: FlowContainerSetter;
639
+ /**
640
+ * The current form state.
641
+ * @see FormState
642
+ */
643
+ formState: FormState;
644
+ /**
645
+ * Dispatch function to update the form state.
646
+ */
647
+ dispatchFormState: Dispatch<FormStateAction>;
648
+ };
649
+
650
+ type OryProviderProps = {
651
+ components: OryFlowComponents;
652
+ } & OryFlowContainer & PropsWithChildren;
653
+ declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
654
+
655
+ export { type ConsentFlow, type ConsentFlowContainer, type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, type FormStateMethodActive, type FormStateProvideIdentifier, type FormStateSelectMethod, type FormValues, HeadlessPageHeader, type IntlConfig, type LoginFlowContainer, type OnSubmitHandlerProps, OryCard, type OryCardAuthMethodListItemProps, OryCardContent, type OryCardContentProps, type OryCardDividerProps, OryCardFooter, type OryCardFooterProps, OryCardHeader, type OryCardHeaderProps, type OryCardLogoProps, type OryCardRootProps as OryCardProps, type OryCardSettingsSectionProps, OryCardValidationMessages, type OryClientConfiguration, OryConsentCard, type OryFlowComponentOverrides, type OryFlowComponents, type OryFlowContainer, OryForm, OryFormGroupDivider, type OryFormGroupProps, OryFormGroups, type OryFormGroupsProps, OryFormOidcButtons, type OryFormOidcRootProps, type OryFormProps, type OryFormRootProps, OryFormSection, type OryFormSectionContentProps, type OryFormSectionFooterProps, type OryFormSectionProps, OryFormSocialButtonsForm, OryLocales, type OryMessageContentProps, type OryMessageRootProps, type OryNodeAnchorProps, type OryNodeButtonProps, type OryNodeCaptchaProps, type OryNodeConsentScopeCheckboxProps, type OryNodeImageProps, type OryNodeInputProps, type OryNodeLabelProps, type OryNodeOidcButtonProps, type OryNodeTextProps, type OryPageHeaderProps, OryProvider, type OryProviderProps, OrySettingsCard, type OrySettingsOidcProps, type OrySettingsPasskeyProps, type OrySettingsRecoveryCodesProps, type OrySettingsTotpProps, type OrySettingsWebauthnProps, OryTwoStepCard, type RecoveryFlowContainer, type RegistrationFlowContainer, type SettingsFlowContainer, type VerificationFlowContainer, messageTestId, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };