@ory/elements-react 1.0.0-rc.5 → 1.0.0-rc.6

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.
@@ -1,104 +1,470 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { OryCardContentProps, OryCardProps, OryNodeOidcButtonProps, OryFormRootProps, OryMessageContentProps, OryFlowComponentOverrides, OryFlowComponents, OryClientConfiguration } from '@ory/elements-react';
2
+ import { OryCardContentProps, OryCardProps, OryNodeSsoButtonProps, OryFormRootProps, OryMessageContentProps, OryFlowComponentOverrides, OryFlowComponents, OryClientConfiguration } from '@ory/elements-react';
3
3
  import * as react from 'react';
4
- import { PropsWithChildren, ElementType } from 'react';
4
+ import { ElementType, PropsWithChildren } from 'react';
5
5
  import { FlowError, GenericError, Session, LoginFlow, RecoveryFlow, RegistrationFlow, SettingsFlow, VerificationFlow, OAuth2ConsentRequest } from '@ory/client-fetch';
6
6
 
7
+ /**
8
+ * Simply renders the children passed to it.
9
+ *
10
+ * @param props - pass children to render instead of the default Ory Card components
11
+ * @returns
12
+ * @group Components
13
+ * @category Default Components
14
+ */
7
15
  declare function DefaultCardContent({ children }: OryCardContentProps): react.ReactNode;
8
16
 
17
+ /**
18
+ * DefaultCardFooter renders the default footer for the card component based on the current flow type.
19
+ *
20
+ * @returns The default card footer component that renders the appropriate footer based on the current flow type.
21
+ * @group Components
22
+ * @category Default Components
23
+ */
9
24
  declare function DefaultCardFooter(): react_jsx_runtime.JSX.Element | null;
10
25
 
26
+ /**
27
+ * Renders the default card header component.
28
+ *
29
+ * This component is used to display the header of a card, including the logo, title, description, and current identifier button.
30
+ *
31
+ * @returns the default card header component
32
+ * @group Components
33
+ * @category Default Components
34
+ */
11
35
  declare function DefaultCardHeader(): react_jsx_runtime.JSX.Element;
12
36
 
37
+ /**
38
+ * The DefaultCardLogo component renders the logo from the {@link @ory/elements-react!OryProvider} or falls back to the project name.
39
+ *
40
+ * @returns the default logo for the Ory Card component.
41
+ * @group Components
42
+ * @category Default Components
43
+ * @see {@link @ory/elements-react!OryProvider}
44
+ * @see {@link @ory/elements-react!OryElementsConfiguration}
45
+ */
13
46
  declare function DefaultCardLogo(): react_jsx_runtime.JSX.Element;
14
47
 
48
+ /**
49
+ * The `DefaultCurrentIdentifierButton` component renders a button that displays the current identifier
50
+ *
51
+ * The button can be used to restart the flow with the current identifier if appropriate.
52
+ *
53
+ * @returns
54
+ * @group Components
55
+ * @category Default Components
56
+ */
15
57
  declare function DefaultCurrentIdentifierButton(): react_jsx_runtime.JSX.Element | null;
16
58
 
17
- declare function DefaultCardLayout({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
18
-
59
+ /**
60
+ * The DefaultCard component is a styled container that serves as the main card layout for Ory Elements.
61
+ *
62
+ * @param props - The properties for the DefaultCard component.
63
+ * @returns
64
+ * @group Components
65
+ * @category Default Components
66
+ */
19
67
  declare function DefaultCard({ children }: OryCardProps): react_jsx_runtime.JSX.Element;
20
68
 
21
- type DefaultSocialButtonProps = OryNodeOidcButtonProps & {
69
+ /**
70
+ * Props for the DefaultButtonSocial component.
71
+ *
72
+ * @inline
73
+ * @hidden
74
+ */
75
+ interface DefaultSocialButtonProps extends OryNodeSsoButtonProps {
76
+ /**
77
+ * Whether to show the label next to the logo.
78
+ * If not provided, it will be determined based on the number of SSO nodes.
79
+ */
22
80
  showLabel?: boolean;
81
+ /**
82
+ * Logos to use for the social buttons.
83
+ * If not provided, the default logos will be used.
84
+ */
23
85
  logos?: Record<string, ElementType>;
24
- };
86
+ }
87
+ /**
88
+ * The default implementation of a social button for Ory SSO.
89
+ * It renders a button with a logo and an optional label.
90
+ *
91
+ * @param props - The props for the DefaultButtonSocial component.
92
+ * @returns
93
+ * @category Default Components
94
+ * @group Components
95
+ * @inlineType OryNodeSsoButtonProps
96
+ */
25
97
  declare function DefaultButtonSocial({ attributes, node, onClick, showLabel: _showLabel, logos: providedLogos, }: DefaultSocialButtonProps): react_jsx_runtime.JSX.Element;
26
98
  declare namespace DefaultButtonSocial {
27
99
  var WithLogos: (logos: Record<string, ElementType>) => (props: DefaultSocialButtonProps) => react_jsx_runtime.JSX.Element;
28
100
  }
29
101
 
30
- declare function DefaultFormContainer({ children, onSubmit, action, method, "data-testid": dataTestId, }: PropsWithChildren<OryFormRootProps>): react_jsx_runtime.JSX.Element;
102
+ /**
103
+ * The default form container for Ory Elements.
104
+ *
105
+ * @param props - The properties for the DefaultFormContainer component.
106
+ * @returns
107
+ * @group Components
108
+ * @category Default Components
109
+ */
110
+ declare function DefaultFormContainer({ children, onSubmit, action, method, }: PropsWithChildren<OryFormRootProps>): react_jsx_runtime.JSX.Element;
111
+ /**
112
+ * The default message container for Ory Elements.
113
+ *
114
+ * @param props - The properties for the DefaultMessageContainer component.
115
+ * @returns
116
+ * @group Components
117
+ * @category Default Components
118
+ */
31
119
  declare function DefaultMessageContainer({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element | null;
120
+ /**
121
+ * The default message component for Ory Elements.
122
+ *
123
+ * @param props - The properties for the DefaultMessage component.
124
+ * @returns
125
+ * @group Components
126
+ * @category Default Components
127
+ * @see {@link @ory/elements-react!uiTextToFormattedMessage}
128
+ */
32
129
  declare function DefaultMessage({ message }: OryMessageContentProps): react_jsx_runtime.JSX.Element;
33
130
 
131
+ /**
132
+ * Merges the default Ory components with any provided overrides.
133
+ *
134
+ * The output of this function is a complete set of components that can be used in Ory flows.
135
+ *
136
+ * @param overrides - Optional overrides for the default components.
137
+ * @returns
138
+ *
139
+ * @category Utilities
140
+ */
34
141
  declare function getOryComponents(overrides?: OryFlowComponentOverrides): OryFlowComponents;
35
142
 
36
143
  /**
37
144
  * A union type of all possible errors that can be returned by the Ory SDK.
145
+ * @hidden
146
+ * @inline
38
147
  */
39
148
  type OryError = FlowError | OAuth2Error | {
40
149
  error: GenericError;
41
150
  };
42
151
  /**
43
152
  * An OAuth2 error response.
153
+ * @hidden
154
+ * @inline
44
155
  */
45
156
  type OAuth2Error = {
46
157
  error: string;
47
158
  error_description: string;
48
159
  };
160
+ /**
161
+ * Props for the Error component.
162
+ *
163
+ * @inline
164
+ * @hidden
165
+ */
49
166
  type ErrorFlowContextProps = {
167
+ /**
168
+ * The error object returned by the Ory SDK.
169
+ * This can be a FlowError, OAuth2Error, or a GenericError.
170
+ */
50
171
  error: OryError;
172
+ /**
173
+ * The components to override the default ones.
174
+ * This allows you to customize the appearance and behavior of the error flow.
175
+ */
51
176
  components?: OryFlowComponentOverrides;
177
+ /**
178
+ * The Ory client configuration object.
179
+ * This object contains the configuration for the Ory client, such as the base URL and project information.
180
+ */
52
181
  config: OryClientConfiguration;
182
+ /**
183
+ * The session object, if available.
184
+ * This is used to determine if the user is logged in and to provide appropriate actions.
185
+ */
53
186
  session?: Session;
54
187
  };
55
- declare function Error({ error, components: Components, config, session, }: PropsWithChildren<ErrorFlowContextProps>): react_jsx_runtime.JSX.Element;
188
+ /**
189
+ * The Error component is used to display an error message to the user.
190
+ *
191
+ * @param props - The props for the Error component.
192
+ * @returns
193
+ * @group Components
194
+ * @category Flows
195
+ */
196
+ declare function Error({ error, components: Components, config, session, }: ErrorFlowContextProps): react_jsx_runtime.JSX.Element;
56
197
 
198
+ /**
199
+ * Props for the Login component.
200
+ *
201
+ * @inline
202
+ * @hidden
203
+ */
57
204
  type LoginFlowContextProps = {
205
+ /**
206
+ * The login flow object containing the state and data for the login process.
207
+ */
58
208
  flow: LoginFlow;
209
+ /**
210
+ * Optional components to override the default ones.
211
+ *
212
+ * This allows you to customize the appearance and behavior of the login flow.
213
+ */
59
214
  components?: OryFlowComponentOverrides;
215
+ /**
216
+ * The Ory client configuration object.
217
+ *
218
+ * This object contains the configuration for the Ory client, such as the base URL and other settings.
219
+ */
60
220
  config: OryClientConfiguration;
221
+ /**
222
+ * Optional children to render
223
+ *
224
+ * If not provided, the default OrySelfServiceFlowCard will be rendered.
225
+ */
226
+ children?: React.ReactNode;
61
227
  };
62
- declare function Login({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<LoginFlowContextProps>): react_jsx_runtime.JSX.Element;
228
+ /**
229
+ * The `Login` component is used to render the login flow in Ory Elements.
230
+ *
231
+ * It provides the necessary context and components for the login flow, allowing you to customize the appearance and behavior of the login form.
232
+ *
233
+ * @param props - The props for the Login component.
234
+ * @group Components
235
+ * @category Flows
236
+ */
237
+ declare function Login({ flow, config, children, components: flowOverrideComponents, }: LoginFlowContextProps): react_jsx_runtime.JSX.Element;
63
238
 
239
+ /**
240
+ * Props for the Recovery component.
241
+ * @inline
242
+ * @hidden
243
+ */
64
244
  type RecoveryFlowContextProps = {
245
+ /**
246
+ * The recovery flow object containing the state and data for the recovery process.
247
+ */
65
248
  flow: RecoveryFlow;
249
+ /**
250
+ * Optional components to override the default ones.
251
+ *
252
+ * This allows you to customize the appearance and behavior of the recovery flow.
253
+ */
66
254
  components?: OryFlowComponentOverrides;
255
+ /**
256
+ * The Ory client configuration object.
257
+ *
258
+ * This object contains the configuration for the Ory client, such as the base URL and other settings.
259
+ */
67
260
  config: OryClientConfiguration;
261
+ /**
262
+ * Optional children to render
263
+ *
264
+ * If not provided, the default OrySelfServiceFlowCard will be rendered.
265
+ */
266
+ children?: React.ReactNode;
68
267
  };
69
- declare function Recovery({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<RecoveryFlowContextProps>): react_jsx_runtime.JSX.Element;
268
+ /**
269
+ * The `Recovery` component is used to render the recovery flow in Ory Elements.
270
+ *
271
+ * @param props - The props for the Recovery component.
272
+ * @returns the recovery flow component.
273
+ * @group Components
274
+ * @category Flows
275
+ */
276
+ declare function Recovery({ flow, config, children, components: flowOverrideComponents, }: RecoveryFlowContextProps): react_jsx_runtime.JSX.Element;
70
277
 
278
+ /**
279
+ * Props for the Registration component.
280
+ *
281
+ * @inline
282
+ * @hidden
283
+ */
71
284
  type RegistrationFlowContextProps = {
285
+ /**
286
+ * The registration flow object containing the state and data for the registration process.
287
+ */
72
288
  flow: RegistrationFlow;
289
+ /**
290
+ * Optional components to override the default ones.
291
+ *
292
+ * This allows you to customize the appearance and behavior of the registration flow.
293
+ */
73
294
  components?: OryFlowComponentOverrides;
295
+ /**
296
+ * The Ory client configuration object.
297
+ *
298
+ * This object contains the configuration for the Ory client, such as the base URL and other settings.
299
+ */
74
300
  config: OryClientConfiguration;
301
+ /**
302
+ * Optional children to render
303
+ *
304
+ * If not provided, the default OrySelfServiceFlowCard will be rendered.
305
+ */
306
+ children?: React.ReactNode;
75
307
  };
76
- declare function Registration({ flow, children, components: flowOverrideComponents, config, }: PropsWithChildren<RegistrationFlowContextProps>): react_jsx_runtime.JSX.Element;
308
+ /**
309
+ * The `Registration` component is used to render the registration flow in Ory Elements.
310
+ *
311
+ * @param props - The props for the Registration component.
312
+ * @returns
313
+ * @group Components
314
+ * @category Flows
315
+ */
316
+ declare function Registration({ flow, children, components: flowOverrideComponents, config, }: RegistrationFlowContextProps): react_jsx_runtime.JSX.Element;
77
317
 
318
+ /**
319
+ * Props for the Settings component.
320
+ *
321
+ * @inline
322
+ * @hidden
323
+ */
78
324
  type SettingsFlowContextProps = {
325
+ /**
326
+ * The settings flow object containing the state and data for the settings process.
327
+ */
79
328
  flow: SettingsFlow;
329
+ /**
330
+ * Optional components to override the default ones.
331
+ *
332
+ * This allows you to customize the appearance and behavior of the settings flow.
333
+ */
80
334
  components?: OryFlowComponentOverrides;
335
+ /**
336
+ * The Ory client configuration object.
337
+ *
338
+ * This object contains the configuration for the Ory client, such as the base URL and other settings.
339
+ */
81
340
  config: OryClientConfiguration;
341
+ /**
342
+ * Optional children to render
343
+ *
344
+ * If not provided, the default OrySettingsCard will be rendered.
345
+ */
346
+ children?: React.ReactNode;
82
347
  };
83
- declare function Settings({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<SettingsFlowContextProps>): react_jsx_runtime.JSX.Element;
348
+ /**
349
+ * The `Settings` component is used to render the settings flow in Ory Elements.
350
+ *
351
+ * It provides the necessary context and components for the settings flow, allowing you to customize the appearance and behavior of the settings form.
352
+ *
353
+ * @param props - The props for the Settings component.
354
+ * @group Components
355
+ * @category Flows
356
+ */
357
+ declare function Settings({ flow, config, children, components: flowOverrideComponents, }: SettingsFlowContextProps): react_jsx_runtime.JSX.Element;
84
358
 
359
+ /**
360
+ * Props for the Verification component.
361
+ *
362
+ * @inline
363
+ * @hidden
364
+ */
85
365
  type VerificationFlowContextProps = {
366
+ /**
367
+ * The verification flow object containing the state and data for the verification process.
368
+ */
86
369
  flow: VerificationFlow;
370
+ /**
371
+ * Optional components to override the default ones.
372
+ *
373
+ * This allows you to customize the appearance and behavior of the verification flow.
374
+ */
87
375
  components?: OryFlowComponentOverrides;
376
+ /**
377
+ * The Ory client configuration object.
378
+ *
379
+ * This object contains the configuration for the Ory client, such as the base URL and other settings.
380
+ */
88
381
  config: OryClientConfiguration;
382
+ /**
383
+ * Optional children to render
384
+ *
385
+ * If not provided, the default OrySelfServiceFlowCard will be rendered.
386
+ */
387
+ children?: React.ReactNode;
89
388
  };
90
- declare function Verification({ flow, config, children, components: flowOverrideComponents, }: PropsWithChildren<VerificationFlowContextProps>): react_jsx_runtime.JSX.Element;
389
+ /**
390
+ * The `Verification` component is used to render the verification flow in Ory Elements.
391
+ *
392
+ * It provides the necessary context and components for the verification flow, allowing you to customize the appearance and behavior of the verification form.
393
+ *
394
+ * @param props - The props for the Verification component.
395
+ * @group Components
396
+ * @category Flows
397
+ */
398
+ declare function Verification({ flow, config, children, components: flowOverrideComponents, }: VerificationFlowContextProps): react_jsx_runtime.JSX.Element;
91
399
 
92
- type PropsWithComponents = {
93
- components?: OryFlowComponentOverrides;
94
- };
95
- type ConsentFlowContextProps = {
400
+ /**
401
+ * All the props that are passed to the Consent component.
402
+ *
403
+ * @hidden
404
+ * @inline
405
+ */
406
+ type ConsentFlowProps = {
407
+ /**
408
+ * The OAuth2 consent request object.
409
+ */
96
410
  consentChallenge: OAuth2ConsentRequest;
411
+ /**
412
+ * The session object.
413
+ *
414
+ * Since the consent flow is used in the context of a logged-in user, the session object is required.
415
+ * It contains information about the user, such as their ID and any associated metadata.
416
+ * This information is used to accept or reject the consent request based on the user's preferences.
417
+ * The session object is typically obtained from the Ory Kratos session API.
418
+ */
97
419
  session: Session;
420
+ /**
421
+ * The Ory client configuration object.
422
+ *
423
+ * This object contains the configuration for the Ory client, such as the base URL
424
+ */
98
425
  config: OryClientConfiguration;
426
+ /**
427
+ * The CSRF token to protect against CSRF attacks.
428
+ *
429
+ * This token is used to prevent cross-site request forgery attacks by ensuring that the request
430
+ * is coming from the same origin as the consent flow.
431
+ */
99
432
  csrfToken: string;
433
+ /**
434
+ * The URL to submit the consent form to.
435
+ *
436
+ * This URL is typically an endpoint on the server that handles the consent request.
437
+ *
438
+ * Make sure that this endpoint handles CSRF protection. During the form submission
439
+ * the Consent component will send along the CSRF token passed in the props.
440
+ * The server should validate this token before processing the consent request.
441
+ */
100
442
  formActionUrl: string;
101
- } & PropsWithComponents;
102
- declare function Consent({ consentChallenge, session, config, components: Passed, children, csrfToken, formActionUrl, }: PropsWithChildren<ConsentFlowContextProps>): react_jsx_runtime.JSX.Element;
443
+ /**
444
+ * The components to override the default ones.
445
+ *
446
+ * This allows you to customize the appearance and behavior of the consent flow.
447
+ */
448
+ components?: OryFlowComponentOverrides;
449
+ /**
450
+ * Optional children to render inside the Consent component.
451
+ *
452
+ * If not provided, the default OryConsentCard will be rendered.
453
+ */
454
+ children?: React.ReactNode;
455
+ };
456
+ /**
457
+ * The Consent component allows you to render the consent flow for Ory OAuth2.
458
+ *
459
+ * It is used to request user consent for accessing their data and resources.
460
+ * The component takes in the OAuth2 consent request object, the session object,
461
+ * the Ory client configuration, a CSRF token, and the URL to submit the consent form to.
462
+ *
463
+ * @param props - The props for the Consent component.
464
+ * @returns the Consent component.
465
+ * @group Components
466
+ * @category Flows
467
+ */
468
+ declare function Consent({ consentChallenge, session, config, components: Passed, children, csrfToken, formActionUrl, }: ConsentFlowProps): react_jsx_runtime.JSX.Element;
103
469
 
104
- export { Consent, type ConsentFlowContextProps, DefaultButtonSocial, DefaultCard, DefaultCardContent, DefaultCardFooter, DefaultCardHeader, DefaultCardLayout, DefaultCardLogo, DefaultCurrentIdentifierButton, DefaultFormContainer, DefaultMessage, DefaultMessageContainer, Error, type ErrorFlowContextProps, Login, type LoginFlowContextProps, type OAuth2Error, type OryError, Recovery, type RecoveryFlowContextProps, Registration, Settings, type SettingsFlowContextProps, Verification, type VerificationFlowContextProps, getOryComponents };
470
+ export { Consent, type ConsentFlowProps, DefaultButtonSocial, DefaultCard, DefaultCardContent, DefaultCardFooter, DefaultCardHeader, DefaultCardLogo, DefaultCurrentIdentifierButton, DefaultFormContainer, DefaultMessage, DefaultMessageContainer, Error, type ErrorFlowContextProps, Login, type LoginFlowContextProps, type OAuth2Error, type OryError, Recovery, type RecoveryFlowContextProps, Registration, Settings, type SettingsFlowContextProps, Verification, type VerificationFlowContextProps, getOryComponents };