@ory/elements-react 0.0.0-pr.4a28a8f → 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.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: {
@@ -414,7 +427,7 @@ type OryClientConfiguration = {
414
427
  *
415
428
  * @see OryClientConfiguration
416
429
  */
417
- type OryFlow<TFlowType, TFlow> = {
430
+ type OryFlow<TFlowType extends FlowType, TFlow> = {
418
431
  flowType: TFlowType;
419
432
  flow: TFlow;
420
433
  config: OryClientConfiguration;
@@ -463,10 +476,23 @@ type SettingsFlowContainer = OryFlow<FlowType.Settings, SettingsFlow>;
463
476
  *
464
477
  */
465
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>;
466
492
  /**
467
493
  * A union type of all flow containers
468
494
  */
469
- type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer;
495
+ type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer | ConsentFlowContainer;
470
496
 
471
497
  /**
472
498
  * Converts a UiText to a FormattedMessage.
@@ -536,18 +562,23 @@ type OnSubmitHandlerProps<T extends UpdateLoginFlowBody | UpdateRegistrationFlow
536
562
  * @param message - the UiText message to generate a test id for
537
563
  * @returns a unique, stable test id for the message
538
564
  */
539
- declare function messageTestId(message: UiText): {
565
+ declare function messageTestId(message: {
566
+ id: number | string;
567
+ }): {
540
568
  "data-testid": string;
541
569
  };
542
570
 
543
- type FormState = {
544
- current: "provide_identifier";
545
- } | {
571
+ type FormStateSelectMethod = {
546
572
  current: "select_method";
547
- } | {
573
+ };
574
+ type FormStateProvideIdentifier = {
575
+ current: "provide_identifier";
576
+ };
577
+ type FormStateMethodActive = {
548
578
  current: "method_active";
549
579
  method: UiNodeGroupEnum;
550
- } | {
580
+ };
581
+ type FormState = FormStateSelectMethod | FormStateProvideIdentifier | FormStateMethodActive | {
551
582
  current: "success_screen";
552
583
  } | {
553
584
  current: "settings";
@@ -594,4 +625,4 @@ type OryProviderProps = {
594
625
  } & OryFlowContainer & PropsWithChildren;
595
626
  declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
596
627
 
597
- 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 };