@ory/elements-react 0.0.0-pr.f3c2f07 → 0.0.0-pr.fd92d9ce

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, UiContainer, OAuth2ConsentRequest, Session, FlowError, UpdateLoginFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, UpdateRecoveryFlowBody, UpdateSettingsFlowBody, OnRedirectHandler } from '@ory/client-fetch';
1
+ import { UiNodeInputAttributes, UiNode, UiNodeAnchorAttributes, UiNodeTextAttributes, UiNodeImageAttributes, UiNodeGroupEnum, UiText, FlowType, LoginFlow, RegistrationFlow, RecoveryFlow, VerificationFlow, SettingsFlow, UiContainer, OAuth2ConsentRequest, Session, FlowError, ConfigurationParameters, AccountExperienceConfiguration, UpdateLoginFlowBody, UpdateRegistrationFlowBody, UpdateVerificationFlowBody, UpdateRecoveryFlowBody, UpdateSettingsFlowBody, OnRedirectHandler, FrontendApi } 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,6 +53,7 @@ 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;
@@ -374,52 +375,15 @@ type DeepPartialTwoLevels<T> = {
374
375
  type OryFlowComponentOverrides = DeepPartialTwoLevels<OryFlowComponents>;
375
376
  type OryFormProps = PropsWithChildren<{
376
377
  onAfterSubmit?: (method: string | number | boolean | undefined) => void;
378
+ "data-testid"?: string;
377
379
  }>;
378
- 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;
379
381
 
380
382
  declare function useComponents(): OryFlowComponents;
381
383
  declare function useNodeSorter(): (a: UiNode, b: UiNode, ctx: {
382
384
  flowType: string;
383
385
  }) => number;
384
386
 
385
- type LocaleMap = Record<string, Record<string, string>>;
386
- declare const OryLocales: LocaleMap;
387
-
388
- type Locale = keyof typeof OryLocales;
389
- type IntlContextProps = {
390
- locale: Locale;
391
- customTranslations?: Partial<LocaleMap>;
392
- };
393
-
394
- type IntlConfig = IntlContextProps;
395
- type OryClientConfiguration = {
396
- /**
397
- * The name of the application the user is logging in to.
398
- */
399
- name: string;
400
- /**
401
- * An optional logo URL to display in the UI instead of the name.
402
- */
403
- logoUrl?: string;
404
- stylesheet?: string;
405
- favicon?: string;
406
- sdk: {
407
- url: string;
408
- options?: Partial<ConfigurationParameters>;
409
- };
410
- project: {
411
- registration_enabled: boolean;
412
- verification_enabled: boolean;
413
- recovery_enabled: boolean;
414
- recovery_ui_url: string;
415
- registration_ui_url: string;
416
- verification_ui_url: string;
417
- login_ui_url: string;
418
- default_redirect_url?: string;
419
- };
420
- intl?: IntlConfig;
421
- };
422
-
423
387
  /**
424
388
  * A generic flow container, containing a flowType, the flow itself and the config object
425
389
  *
@@ -428,7 +392,6 @@ type OryClientConfiguration = {
428
392
  type OryFlow<TFlowType extends FlowType, TFlow> = {
429
393
  flowType: TFlowType;
430
394
  flow: TFlow;
431
- config: OryClientConfiguration;
432
395
  };
433
396
  /**
434
397
  * A flow container for the login flow
@@ -484,6 +447,7 @@ type ConsentFlow = {
484
447
  ui: UiContainer;
485
448
  consent_request: OAuth2ConsentRequest;
486
449
  session: Session;
450
+ return_to?: string;
487
451
  };
488
452
  type ConsentFlowContainer = OryFlow<FlowType.OAuth2Consent, ConsentFlow>;
489
453
  /**
@@ -491,6 +455,48 @@ type ConsentFlowContainer = OryFlow<FlowType.OAuth2Consent, ConsentFlow>;
491
455
  */
492
456
  type OryFlowContainer = LoginFlowContainer | RegistrationFlowContainer | RecoveryFlowContainer | VerificationFlowContainer | SettingsFlowContainer | ConsentFlowContainer;
493
457
 
458
+ type LocaleMap = Record<string, Record<string, string>>;
459
+ declare const OryLocales: LocaleMap;
460
+
461
+ type Locale = keyof typeof OryLocales;
462
+ type IntlContextProps = {
463
+ locale: Locale;
464
+ customTranslations?: Partial<LocaleMap>;
465
+ };
466
+
467
+ type IntlConfig = IntlContextProps;
468
+ /**
469
+ * The configuration for Ory Elements.
470
+ *
471
+ * This configuration is used to customize the behavior and appearance of Ory Elements.
472
+ *
473
+ * By setting UI urls, you can override the default URLs for the login, registration, recovery, and verification flows.
474
+ *
475
+ * You can also set the name of the application, the logo URL, and the SDK configuration.
476
+ * By default, the name and logo are displayed in the card's header.
477
+ */
478
+ type OryClientConfiguration = {
479
+ /**
480
+ * The SDK configuration.
481
+ * This configuration is used to set the URL of the Ory SDK and any additional options used for the SDK client.
482
+ */
483
+ sdk?: {
484
+ url?: string;
485
+ options?: Partial<ConfigurationParameters>;
486
+ };
487
+ /**
488
+ * The internationalization configuration.
489
+ * This configuration is used to set the locale and any additional options used for the i18n library.
490
+ * The locale is used to determine the language of the UI.
491
+ * The default locale is "en".
492
+ */
493
+ intl?: IntlConfig;
494
+ /**
495
+ * The configuration for the project.
496
+ */
497
+ project: AccountExperienceConfiguration;
498
+ };
499
+
494
500
  /**
495
501
  * Converts a UiText to a FormattedMessage.
496
502
  * The UiText contains the id of the message and the context.
@@ -559,18 +565,23 @@ type OnSubmitHandlerProps<T extends UpdateLoginFlowBody | UpdateRegistrationFlow
559
565
  * @param message - the UiText message to generate a test id for
560
566
  * @returns a unique, stable test id for the message
561
567
  */
562
- declare function messageTestId(message: UiText): {
568
+ declare function messageTestId(message: {
569
+ id: number | string;
570
+ }): {
563
571
  "data-testid": string;
564
572
  };
565
573
 
566
- type FormState = {
567
- current: "provide_identifier";
568
- } | {
574
+ type FormStateSelectMethod = {
569
575
  current: "select_method";
570
- } | {
576
+ };
577
+ type FormStateProvideIdentifier = {
578
+ current: "provide_identifier";
579
+ };
580
+ type FormStateMethodActive = {
571
581
  current: "method_active";
572
582
  method: UiNodeGroupEnum;
573
- } | {
583
+ };
584
+ type FormState = FormStateSelectMethod | FormStateProvideIdentifier | FormStateMethodActive | {
574
585
  current: "success_screen";
575
586
  } | {
576
587
  current: "settings";
@@ -581,6 +592,8 @@ type FormStateAction = {
581
592
  } | {
582
593
  type: "action_select_method";
583
594
  method: UiNodeGroupEnum;
595
+ } | {
596
+ type: "action_clear_active_method";
584
597
  };
585
598
 
586
599
  /**
@@ -614,7 +627,33 @@ type FlowContextValue = OryFlowContainer & {
614
627
 
615
628
  type OryProviderProps = {
616
629
  components: OryFlowComponents;
630
+ config: OryClientConfiguration;
617
631
  } & OryFlowContainer & PropsWithChildren;
618
- declare function OryProvider({ children, components: Components, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
632
+ declare function OryProvider({ children, components: Components, config, ...oryFlowProps }: OryProviderProps): react_jsx_runtime.JSX.Element;
633
+
634
+ type OryElementsConfiguration = {
635
+ sdk: OrySDK;
636
+ project: AccountExperienceConfiguration;
637
+ };
638
+ declare function useOryConfiguration(): OryElementsConfiguration;
639
+ type OrySDK = SDKConfig & {
640
+ /**
641
+ * The frontend client for the Ory SDK.
642
+ * This client is used to interact with the Ory SDK and should be used to make API calls.
643
+ */
644
+ frontend: FrontendApi;
645
+ };
646
+ type SDKConfig = {
647
+ /**
648
+ * The URL of the Ory SDK.
649
+ * This URL is used to connect to the Ory SDK and should be set to the base URL of your Ory instance.
650
+ */
651
+ url: string;
652
+ options?: Partial<ConfigurationParameters>;
653
+ };
654
+ declare function OryConfigurationProvider({ children, sdk: initialConfig, project, }: PropsWithChildren<{
655
+ sdk?: Partial<OryClientConfiguration["sdk"]>;
656
+ project?: Partial<AccountExperienceConfiguration>;
657
+ }>): react_jsx_runtime.JSX.Element;
619
658
 
620
- 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 };
659
+ 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, OryConfigurationProvider, OryConsentCard, type OryElementsConfiguration, 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, useOryConfiguration, useOryFlow };