@ory/elements-react 0.0.0-pr.3a98de9 → 0.0.0-pr.5cdcf132

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';
@@ -53,12 +53,18 @@ type OryNodeImageProps = {
53
53
  type FormValues = Record<string, string | boolean | number | undefined>;
54
54
  type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
55
55
  onSubmit: FormEventHandler<HTMLFormElement>;
56
+ "data-testid"?: string;
56
57
  };
57
58
  type OryNodeInputProps = {
58
59
  attributes: UiNodeInputAttributes;
59
60
  node: UiNode;
60
61
  onClick?: MouseEventHandler;
61
62
  };
63
+ type OryNodeConsentScopeCheckboxProps = {
64
+ attributes: UiNodeInputAttributes;
65
+ node: UiNode;
66
+ onCheckedChange: (checked: boolean) => void;
67
+ };
62
68
  type OryFormSectionContentProps = PropsWithChildren<{
63
69
  title?: string;
64
70
  description?: string;
@@ -105,6 +111,8 @@ declare function OryCardContent({ children }: OryCardContentProps): react_jsx_ru
105
111
 
106
112
  declare function OryTwoStepCard(): react_jsx_runtime.JSX.Element;
107
113
 
114
+ declare function OryConsentCard(): react_jsx_runtime.JSX.Element;
115
+
108
116
  /**
109
117
  * Props type for the Form Group Divider component.
110
118
  */
@@ -248,6 +256,10 @@ type OryFlowComponents = {
248
256
  * The Captcha component is rendered whenever a "captcha" group is encountered.
249
257
  */
250
258
  Captcha: ComponentType<OryNodeCaptchaProps>;
259
+ /**
260
+ * Special version of the Input component for scopes in OAuth2 flows.
261
+ */
262
+ ConsentScopeCheckbox: ComponentType<OryNodeConsentScopeCheckboxProps>;
251
263
  };
252
264
  Card: {
253
265
  /**
@@ -363,8 +375,9 @@ type DeepPartialTwoLevels<T> = {
363
375
  type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
364
376
  type OryFormProps = PropsWithChildren<{
365
377
  onAfterSubmit?: (method: string | number | boolean | undefined) => void;
378
+ "data-testid"?: string;
366
379
  }>;
367
- declare function OryForm({ children, onAfterSubmit }: OryFormProps): react_jsx_runtime.JSX.Element;
380
+ declare function OryForm({ children, onAfterSubmit, "data-testid": dataTestId, }: OryFormProps): react_jsx_runtime.JSX.Element;
368
381
 
369
382
  declare function useComponents(): OryFlowComponents;
370
383
  declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
@@ -404,6 +417,7 @@ type OryClientConfiguration = {
404
417
  registration_ui_url: string;
405
418
  verification_ui_url: string;
406
419
  login_ui_url: string;
420
+ default_redirect_url?: string;
407
421
  };
408
422
  intl?: IntlConfig;
409
423
  };
@@ -413,7 +427,7 @@ type OryClientConfiguration = {
413
427
  *
414
428
  * @see OryClientConfiguration
415
429
  */
416
- type OryFlow<TFlowType, TFlow> = {
430
+ type OryFlow<TFlowType extends FlowType, TFlow> = {
417
431
  flowType: TFlowType;
418
432
  flow: TFlow;
419
433
  config: OryClientConfiguration;
@@ -462,10 +476,23 @@ type SettingsFlowContainer = OryFlow<FlowType.Settings, SettingsFlow>;
462
476
  *
463
477
  */
464
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
+ return_to?: string;
490
+ };
491
+ type ConsentFlowContainer = OryFlow<FlowType.OAuth2Consent, ConsentFlow>;
465
492
  /**
466
493
  * A union type of all flow containers
467
494
  */
468
- type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer;
495
+ type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer | ConsentFlowContainer;
469
496
 
470
497
  /**
471
498
  * Converts a UiText to a FormattedMessage.
@@ -535,18 +562,23 @@ type OnSubmitHandlerProps<T extends UpdateLoginFlowBody | UpdateRegistrationFlow
535
562
  * @param message - the UiText message to generate a test id for
536
563
  * @returns a unique, stable test id for the message
537
564
  */
538
- declare function messageTestId(message: UiText): {
565
+ declare function messageTestId(message: {
566
+ id: number | string;
567
+ }): {
539
568
  "data-testid": string;
540
569
  };
541
570
 
542
- type FormState = {
543
- current: "provide_identifier";
544
- } | {
571
+ type FormStateSelectMethod = {
545
572
  current: "select_method";
546
- } | {
573
+ };
574
+ type FormStateProvideIdentifier = {
575
+ current: "provide_identifier";
576
+ };
577
+ type FormStateMethodActive = {
547
578
  current: "method_active";
548
579
  method: UiNodeGroupEnum;
549
- } | {
580
+ };
581
+ type FormState = FormStateSelectMethod | FormStateProvideIdentifier | FormStateMethodActive | {
550
582
  current: "success_screen";
551
583
  } | {
552
584
  current: "settings";
@@ -593,4 +625,4 @@ type OryProviderProps = {
593
625
  } & OryFlowContainer & PropsWithChildren;
594
626
  declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
595
627
 
596
- 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 OryNodeCaptchaProps, 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 };
628
+ 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 };
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';
@@ -53,12 +53,18 @@ type OryNodeImageProps = {
53
53
  type FormValues = Record<string, string | boolean | number | undefined>;
54
54
  type OryFormRootProps = ComponentPropsWithoutRef<"form"> & {
55
55
  onSubmit: FormEventHandler<HTMLFormElement>;
56
+ "data-testid"?: string;
56
57
  };
57
58
  type OryNodeInputProps = {
58
59
  attributes: UiNodeInputAttributes;
59
60
  node: UiNode;
60
61
  onClick?: MouseEventHandler;
61
62
  };
63
+ type OryNodeConsentScopeCheckboxProps = {
64
+ attributes: UiNodeInputAttributes;
65
+ node: UiNode;
66
+ onCheckedChange: (checked: boolean) => void;
67
+ };
62
68
  type OryFormSectionContentProps = PropsWithChildren<{
63
69
  title?: string;
64
70
  description?: string;
@@ -105,6 +111,8 @@ declare function OryCardContent({ children }: OryCardContentProps): react_jsx_ru
105
111
 
106
112
  declare function OryTwoStepCard(): react_jsx_runtime.JSX.Element;
107
113
 
114
+ declare function OryConsentCard(): react_jsx_runtime.JSX.Element;
115
+
108
116
  /**
109
117
  * Props type for the Form Group Divider component.
110
118
  */
@@ -248,6 +256,10 @@ type OryFlowComponents = {
248
256
  * The Captcha component is rendered whenever a "captcha" group is encountered.
249
257
  */
250
258
  Captcha: ComponentType<OryNodeCaptchaProps>;
259
+ /**
260
+ * Special version of the Input component for scopes in OAuth2 flows.
261
+ */
262
+ ConsentScopeCheckbox: ComponentType<OryNodeConsentScopeCheckboxProps>;
251
263
  };
252
264
  Card: {
253
265
  /**
@@ -363,8 +375,9 @@ type DeepPartialTwoLevels<T> = {
363
375
  type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
364
376
  type OryFormProps = PropsWithChildren<{
365
377
  onAfterSubmit?: (method: string | number | boolean | undefined) => void;
378
+ "data-testid"?: string;
366
379
  }>;
367
- declare function OryForm({ children, onAfterSubmit }: OryFormProps): react_jsx_runtime.JSX.Element;
380
+ declare function OryForm({ children, onAfterSubmit, "data-testid": dataTestId, }: OryFormProps): react_jsx_runtime.JSX.Element;
368
381
 
369
382
  declare function useComponents(): OryFlowComponents;
370
383
  declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
@@ -404,6 +417,7 @@ type OryClientConfiguration = {
404
417
  registration_ui_url: string;
405
418
  verification_ui_url: string;
406
419
  login_ui_url: string;
420
+ default_redirect_url?: string;
407
421
  };
408
422
  intl?: IntlConfig;
409
423
  };
@@ -413,7 +427,7 @@ type OryClientConfiguration = {
413
427
  *
414
428
  * @see OryClientConfiguration
415
429
  */
416
- type OryFlow<TFlowType, TFlow> = {
430
+ type OryFlow<TFlowType extends FlowType, TFlow> = {
417
431
  flowType: TFlowType;
418
432
  flow: TFlow;
419
433
  config: OryClientConfiguration;
@@ -462,10 +476,23 @@ type SettingsFlowContainer = OryFlow<FlowType.Settings, SettingsFlow>;
462
476
  *
463
477
  */
464
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
+ return_to?: string;
490
+ };
491
+ type ConsentFlowContainer = OryFlow<FlowType.OAuth2Consent, ConsentFlow>;
465
492
  /**
466
493
  * A union type of all flow containers
467
494
  */
468
- type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer;
495
+ type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer | ConsentFlowContainer;
469
496
 
470
497
  /**
471
498
  * Converts a UiText to a FormattedMessage.
@@ -535,18 +562,23 @@ type OnSubmitHandlerProps<T extends UpdateLoginFlowBody | UpdateRegistrationFlow
535
562
  * @param message - the UiText message to generate a test id for
536
563
  * @returns a unique, stable test id for the message
537
564
  */
538
- declare function messageTestId(message: UiText): {
565
+ declare function messageTestId(message: {
566
+ id: number | string;
567
+ }): {
539
568
  "data-testid": string;
540
569
  };
541
570
 
542
- type FormState = {
543
- current: "provide_identifier";
544
- } | {
571
+ type FormStateSelectMethod = {
545
572
  current: "select_method";
546
- } | {
573
+ };
574
+ type FormStateProvideIdentifier = {
575
+ current: "provide_identifier";
576
+ };
577
+ type FormStateMethodActive = {
547
578
  current: "method_active";
548
579
  method: UiNodeGroupEnum;
549
- } | {
580
+ };
581
+ type FormState = FormStateSelectMethod | FormStateProvideIdentifier | FormStateMethodActive | {
550
582
  current: "success_screen";
551
583
  } | {
552
584
  current: "settings";
@@ -593,4 +625,4 @@ type OryProviderProps = {
593
625
  } & OryFlowContainer & PropsWithChildren;
594
626
  declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
595
627
 
596
- 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 OryNodeCaptchaProps, 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 };
628
+ 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 };