@ory/elements-react 0.0.0-pr.8e964fc1 → 0.0.0-pr.c124ca4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { UiNodeInputAttributes, UiNode, UiNodeAnchorAttributes, UiNodeTextAttributes, UiNodeImageAttributes, UiNodeGroupEnum, UiText, ConfigurationParameters, FlowType, LoginFlow, RegistrationFlow, RecoveryFlow, VerificationFlow, SettingsFlow, FlowError, UpdateLoginFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, UpdateRecoveryFlowBody, UpdateSettingsFlowBody, OnRedirectHandler } from '@ory/client-fetch';
1
+ import { UiNodeInputAttributes, UiNode, UiNodeAnchorAttributes, UiNodeTextAttributes, UiNodeImageAttributes, UiNodeGroupEnum, UiText, ConfigurationParameters, FlowType, LoginFlow, RegistrationFlow, RecoveryFlow, VerificationFlow, SettingsFlow, UiContainer, OAuth2ConsentRequest, Session, FlowError, UpdateLoginFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, UpdateRecoveryFlowBody, UpdateSettingsFlowBody, OnRedirectHandler } from '@ory/client-fetch';
2
2
  import { ComponentPropsWithoutRef, FormEventHandler, MouseEventHandler, PropsWithChildren, DetailedHTMLProps, HTMLAttributes, ComponentType, Dispatch } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
@@ -28,6 +28,9 @@ type OryNodeTextProps = {
28
28
  node: UiNode;
29
29
  };
30
30
  type OryCardLogoProps = Record<string, never>;
31
+ type OryNodeCaptchaProps = {
32
+ node: UiNode;
33
+ };
31
34
  /**
32
35
  * Props for the AuthMethodListItem component. This component is used
33
36
  * to render a single auth method in the AuthMethodList component.
@@ -35,6 +38,10 @@ type OryCardLogoProps = Record<string, never>;
35
38
  type OryCardAuthMethodListItemProps = {
36
39
  onClick: () => void;
37
40
  group: string;
41
+ title?: {
42
+ id: string;
43
+ values?: Record<string, string>;
44
+ };
38
45
  };
39
46
  type OryNodeImageProps = {
40
47
  attributes: UiNodeImageAttributes;
@@ -46,12 +53,18 @@ type OryNodeImageProps = {
46
53
  type FormValues = Record<string, string | boolean | number | undefined>;
47
54
  type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
48
55
  onSubmit: FormEventHandler<HTMLFormElement>;
56
+ "data-testid"?: string;
49
57
  };
50
58
  type OryNodeInputProps = {
51
59
  attributes: UiNodeInputAttributes;
52
60
  node: UiNode;
53
61
  onClick?: MouseEventHandler;
54
62
  };
63
+ type OryNodeConsentScopeCheckboxProps = {
64
+ attributes: UiNodeInputAttributes;
65
+ node: UiNode;
66
+ onCheckedChange: (checked: boolean) => void;
67
+ };
55
68
  type OryFormSectionContentProps = PropsWithChildren<{
56
69
  title?: string;
57
70
  description?: string;
@@ -98,6 +111,8 @@ declare function OryCardContent({ children }: OryCardContentProps): react_jsx_ru
98
111
 
99
112
  declare function OryTwoStepCard(): react_jsx_runtime.JSX.Element;
100
113
 
114
+ declare function OryConsentCard(): react_jsx_runtime.JSX.Element;
115
+
101
116
  /**
102
117
  * Props type for the Form Group Divider component.
103
118
  */
@@ -237,6 +252,14 @@ type OryFlowComponents = {
237
252
  * The Text component is rendered whenever a "text" node is encountered.
238
253
  */
239
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>;
240
263
  };
241
264
  Card: {
242
265
  /**
@@ -352,8 +375,9 @@ type DeepPartialTwoLevels<T> = {
352
375
  type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
353
376
  type OryFormProps = PropsWithChildren<{
354
377
  onAfterSubmit?: (method: string | number | boolean | undefined) => void;
378
+ "data-testid"?: string;
355
379
  }>;
356
- declare function OryForm({ children, onAfterSubmit }: OryFormProps): string | react_jsx_runtime.JSX.Element;
380
+ declare function OryForm({ children, onAfterSubmit, "data-testid": dataTestId, }: OryFormProps): react_jsx_runtime.JSX.Element;
357
381
 
358
382
  declare function useComponents(): OryFlowComponents;
359
383
  declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
@@ -393,6 +417,7 @@ type OryClientConfiguration = {
393
417
  registration_ui_url: string;
394
418
  verification_ui_url: string;
395
419
  login_ui_url: string;
420
+ default_redirect_url?: string;
396
421
  };
397
422
  intl?: IntlConfig;
398
423
  };
@@ -402,7 +427,7 @@ type OryClientConfiguration = {
402
427
  *
403
428
  * @see OryClientConfiguration
404
429
  */
405
- type OryFlow<TFlowType, TFlow> = {
430
+ type OryFlow<TFlowType extends FlowType, TFlow> = {
406
431
  flowType: TFlowType;
407
432
  flow: TFlow;
408
433
  config: OryClientConfiguration;
@@ -451,10 +476,22 @@ type SettingsFlowContainer = OryFlow<FlowType.Settings, SettingsFlow>;
451
476
  *
452
477
  */
453
478
  type ErrorFlowContainer = OryFlow<FlowType.Error, FlowError>;
479
+ type ConsentFlow = {
480
+ created_at: Date;
481
+ expires_at: Date;
482
+ id: string;
483
+ issued_at: Date;
484
+ state: "show_form" | "rejected" | "accepted";
485
+ active: string;
486
+ ui: UiContainer;
487
+ consent_request: OAuth2ConsentRequest;
488
+ session: Session;
489
+ };
490
+ type ConsentFlowContainer = OryFlow<FlowType.OAuth2Consent, ConsentFlow>;
454
491
  /**
455
492
  * A union type of all flow containers
456
493
  */
457
- type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer;
494
+ type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer | ConsentFlowContainer;
458
495
 
459
496
  /**
460
497
  * Converts a UiText to a FormattedMessage.
@@ -582,4 +619,4 @@ type OryProviderProps = {
582
619
  } & OryFlowContainer & PropsWithChildren;
583
620
  declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
584
621
 
585
- export { type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, 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, 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 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 };
622
+ export { type ConsentFlow, type ConsentFlowContainer, type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, 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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { UiNodeInputAttributes, UiNode, UiNodeAnchorAttributes, UiNodeTextAttributes, UiNodeImageAttributes, UiNodeGroupEnum, UiText, ConfigurationParameters, FlowType, LoginFlow, RegistrationFlow, RecoveryFlow, VerificationFlow, SettingsFlow, FlowError, UpdateLoginFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, UpdateRecoveryFlowBody, UpdateSettingsFlowBody, OnRedirectHandler } from '@ory/client-fetch';
1
+ import { UiNodeInputAttributes, UiNode, UiNodeAnchorAttributes, UiNodeTextAttributes, UiNodeImageAttributes, UiNodeGroupEnum, UiText, ConfigurationParameters, FlowType, LoginFlow, RegistrationFlow, RecoveryFlow, VerificationFlow, SettingsFlow, UiContainer, OAuth2ConsentRequest, Session, FlowError, UpdateLoginFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, UpdateRecoveryFlowBody, UpdateSettingsFlowBody, OnRedirectHandler } from '@ory/client-fetch';
2
2
  import { ComponentPropsWithoutRef, FormEventHandler, MouseEventHandler, PropsWithChildren, DetailedHTMLProps, HTMLAttributes, ComponentType, Dispatch } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
@@ -28,6 +28,9 @@ type OryNodeTextProps = {
28
28
  node: UiNode;
29
29
  };
30
30
  type OryCardLogoProps = Record<string, never>;
31
+ type OryNodeCaptchaProps = {
32
+ node: UiNode;
33
+ };
31
34
  /**
32
35
  * Props for the AuthMethodListItem component. This component is used
33
36
  * to render a single auth method in the AuthMethodList component.
@@ -35,6 +38,10 @@ type OryCardLogoProps = Record<string, never>;
35
38
  type OryCardAuthMethodListItemProps = {
36
39
  onClick: () => void;
37
40
  group: string;
41
+ title?: {
42
+ id: string;
43
+ values?: Record<string, string>;
44
+ };
38
45
  };
39
46
  type OryNodeImageProps = {
40
47
  attributes: UiNodeImageAttributes;
@@ -46,12 +53,18 @@ type OryNodeImageProps = {
46
53
  type FormValues = Record<string, string | boolean | number | undefined>;
47
54
  type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
48
55
  onSubmit: FormEventHandler<HTMLFormElement>;
56
+ "data-testid"?: string;
49
57
  };
50
58
  type OryNodeInputProps = {
51
59
  attributes: UiNodeInputAttributes;
52
60
  node: UiNode;
53
61
  onClick?: MouseEventHandler;
54
62
  };
63
+ type OryNodeConsentScopeCheckboxProps = {
64
+ attributes: UiNodeInputAttributes;
65
+ node: UiNode;
66
+ onCheckedChange: (checked: boolean) => void;
67
+ };
55
68
  type OryFormSectionContentProps = PropsWithChildren<{
56
69
  title?: string;
57
70
  description?: string;
@@ -98,6 +111,8 @@ declare function OryCardContent({ children }: OryCardContentProps): react_jsx_ru
98
111
 
99
112
  declare function OryTwoStepCard(): react_jsx_runtime.JSX.Element;
100
113
 
114
+ declare function OryConsentCard(): react_jsx_runtime.JSX.Element;
115
+
101
116
  /**
102
117
  * Props type for the Form Group Divider component.
103
118
  */
@@ -237,6 +252,14 @@ type OryFlowComponents = {
237
252
  * The Text component is rendered whenever a "text" node is encountered.
238
253
  */
239
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>;
240
263
  };
241
264
  Card: {
242
265
  /**
@@ -352,8 +375,9 @@ type DeepPartialTwoLevels<T> = {
352
375
  type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
353
376
  type OryFormProps = PropsWithChildren<{
354
377
  onAfterSubmit?: (method: string | number | boolean | undefined) => void;
378
+ "data-testid"?: string;
355
379
  }>;
356
- declare function OryForm({ children, onAfterSubmit }: OryFormProps): string | react_jsx_runtime.JSX.Element;
380
+ declare function OryForm({ children, onAfterSubmit, "data-testid": dataTestId, }: OryFormProps): react_jsx_runtime.JSX.Element;
357
381
 
358
382
  declare function useComponents(): OryFlowComponents;
359
383
  declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
@@ -393,6 +417,7 @@ type OryClientConfiguration = {
393
417
  registration_ui_url: string;
394
418
  verification_ui_url: string;
395
419
  login_ui_url: string;
420
+ default_redirect_url?: string;
396
421
  };
397
422
  intl?: IntlConfig;
398
423
  };
@@ -402,7 +427,7 @@ type OryClientConfiguration = {
402
427
  *
403
428
  * @see OryClientConfiguration
404
429
  */
405
- type OryFlow<TFlowType, TFlow> = {
430
+ type OryFlow<TFlowType extends FlowType, TFlow> = {
406
431
  flowType: TFlowType;
407
432
  flow: TFlow;
408
433
  config: OryClientConfiguration;
@@ -451,10 +476,22 @@ type SettingsFlowContainer = OryFlow<FlowType.Settings, SettingsFlow>;
451
476
  *
452
477
  */
453
478
  type ErrorFlowContainer = OryFlow<FlowType.Error, FlowError>;
479
+ type ConsentFlow = {
480
+ created_at: Date;
481
+ expires_at: Date;
482
+ id: string;
483
+ issued_at: Date;
484
+ state: "show_form" | "rejected" | "accepted";
485
+ active: string;
486
+ ui: UiContainer;
487
+ consent_request: OAuth2ConsentRequest;
488
+ session: Session;
489
+ };
490
+ type ConsentFlowContainer = OryFlow<FlowType.OAuth2Consent, ConsentFlow>;
454
491
  /**
455
492
  * A union type of all flow containers
456
493
  */
457
- type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer;
494
+ type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer | ConsentFlowContainer;
458
495
 
459
496
  /**
460
497
  * Converts a UiText to a FormattedMessage.
@@ -582,4 +619,4 @@ type OryProviderProps = {
582
619
  } & OryFlowContainer & PropsWithChildren;
583
620
  declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
584
621
 
585
- export { type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, 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, 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 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 };
622
+ export { type ConsentFlow, type ConsentFlowContainer, type ErrorFlowContainer, type FlowContainerSetter, type FlowContextValue, type FormState, type FormStateAction, 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 };