@ory/elements-react 0.0.0-pr.5cdcf132 → 0.0.0-pr.6a36702c

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, FlowType, getNodeId, isUiNodeTextAttributes, UiNodeInputAttributesTypeEnum, handleContinueWith, handleFlowError, settingsUrl, isResponseError, loginUrl, recoveryUrl, verificationUrl, registrationUrl, Configuration, FrontendApi, instanceOfContinueWithRecoveryUi } from '@ory/client-fetch';
2
- import { createContext, useContext, useState, useMemo, useReducer, useRef, useEffect } from 'react';
1
+ import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, FlowType, getNodeId, Configuration, FrontendApi, isUiNodeTextAttributes, UiNodeInputAttributesTypeEnum, handleContinueWith, isResponseError as isResponseError$1, loginUrl, settingsUrl, registrationUrl, FetchError, ResponseError, recoveryUrl, instanceOfContinueWithRecoveryUi, verificationUrl as verificationUrl$1 } from '@ory/client-fetch';
2
+ import { createContext, useContext, useRef, useState, useMemo, useReducer, useEffect } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useIntl, IntlProvider as IntlProvider$1 } from 'react-intl';
5
5
  import { useFormContext, useForm, FormProvider } from 'react-hook-form';
@@ -48,13 +48,18 @@ var defaultNodeOrder = [
48
48
  ];
49
49
  function defaultNodeSorter(a, b) {
50
50
  var _a, _b;
51
+ const aIsCaptcha = a.group === "captcha";
52
+ const bIsCaptcha = b.group === "captcha";
53
+ const aIsSubmit = isUiNodeInputAttributes(a.attributes) && a.attributes.type === "submit";
54
+ const bIsSubmit = isUiNodeInputAttributes(b.attributes) && b.attributes.type === "submit";
55
+ if (aIsCaptcha && bIsSubmit) {
56
+ return -1;
57
+ }
58
+ if (bIsCaptcha && aIsSubmit) {
59
+ return 1;
60
+ }
51
61
  const aGroupWeight = (_a = defaultNodeOrder.indexOf(a.group)) != null ? _a : 999;
52
62
  const bGroupWeight = (_b = defaultNodeOrder.indexOf(b.group)) != null ? _b : 999;
53
- if (b.group === "captcha" && isUiNodeInputAttributes(a.attributes) && a.attributes.type === "submit") {
54
- return aGroupWeight - (bGroupWeight - 2);
55
- } else if (a.group === "captcha" && isUiNodeInputAttributes(b.attributes) && b.attributes.type === "submit") {
56
- return aGroupWeight - 2 - bGroupWeight;
57
- }
58
63
  return aGroupWeight - bGroupWeight;
59
64
  }
60
65
  var defaultGroupOrder = [
@@ -355,14 +360,20 @@ function useFormStateReducer(flow) {
355
360
  const formStateReducer = (state, action2) => {
356
361
  switch (action2.type) {
357
362
  case "action_flow_update": {
358
- if (selectedMethod)
363
+ if (selectedMethod) {
359
364
  return { current: "method_active", method: selectedMethod };
365
+ }
360
366
  return parseStateFromFlow(action2.flow);
361
367
  }
362
368
  case "action_select_method": {
363
369
  setSelectedMethod(action2.method);
364
370
  return { current: "method_active", method: action2.method };
365
371
  }
372
+ case "action_clear_active_method": {
373
+ return {
374
+ current: "select_method"
375
+ };
376
+ }
366
377
  }
367
378
  return state;
368
379
  };
@@ -401,6 +412,110 @@ function OryFlowProvider({
401
412
  }
402
413
  );
403
414
  }
415
+
416
+ // src/client/config.ts
417
+ function isProduction() {
418
+ var _a, _b;
419
+ return ["production", "prod"].indexOf(
420
+ (_b = (_a = process.env.VERCEL_ENV) != null ? _a : process.env.NODE_ENV) != null ? _b : ""
421
+ ) > -1;
422
+ }
423
+ function frontendClient(sdkUrl, opts = {}) {
424
+ const config = new Configuration({
425
+ ...opts,
426
+ basePath: sdkUrl,
427
+ credentials: "include",
428
+ headers: {
429
+ Accept: "application/json",
430
+ ...opts.headers
431
+ }
432
+ });
433
+ return new FrontendApi(config);
434
+ }
435
+ var defaultProject = {
436
+ name: "Ory",
437
+ registration_enabled: true,
438
+ verification_enabled: true,
439
+ recovery_enabled: true,
440
+ recovery_ui_url: "/ui/recovery",
441
+ registration_ui_url: "/ui/registration",
442
+ verification_ui_url: "/ui/verification",
443
+ login_ui_url: "/ui/login",
444
+ settings_ui_url: "/ui/settings",
445
+ default_redirect_url: "/ui/welcome",
446
+ error_ui_url: "/ui/error",
447
+ default_locale: "en",
448
+ locale_behavior: "force_default"
449
+ };
450
+ function useOryConfiguration() {
451
+ const configCtx = useContext(OryConfigurationContext);
452
+ return {
453
+ sdk: {
454
+ ...configCtx.sdk,
455
+ frontend: frontendClient(configCtx.sdk.url, configCtx.sdk.options)
456
+ },
457
+ project: {
458
+ ...configCtx.project
459
+ }
460
+ };
461
+ }
462
+ var OryConfigurationContext = createContext({
463
+ sdk: computeSdkConfig({}),
464
+ project: defaultProject
465
+ });
466
+ function OryConfigurationProvider({
467
+ children,
468
+ sdk: initialConfig,
469
+ project
470
+ }) {
471
+ const configRef = useRef({
472
+ sdk: computeSdkConfig(initialConfig),
473
+ project: {
474
+ ...defaultProject,
475
+ ...project
476
+ }
477
+ });
478
+ return /* @__PURE__ */ jsx(OryConfigurationContext.Provider, { value: configRef.current, children });
479
+ }
480
+ function computeSdkConfig(config) {
481
+ if ((config == null ? void 0 : config.url) && typeof config.url === "string") {
482
+ console.debug("Using sdk url from config");
483
+ return {
484
+ url: config.url.replace(/\/$/, ""),
485
+ options: config.options || {}
486
+ };
487
+ }
488
+ return {
489
+ url: getSDKUrl(),
490
+ options: (config == null ? void 0 : config.options) || {}
491
+ };
492
+ }
493
+ function getSDKUrl() {
494
+ var _a;
495
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
496
+ if (isProduction()) {
497
+ const sdkUrl = (_a = process.env["NEXT_PUBLIC_ORY_SDK_URL"]) != null ? _a : process.env["ORY_SDK_URL"];
498
+ if (!sdkUrl) {
499
+ throw new Error(
500
+ "Unable to determine SDK URL. Please set NEXT_PUBLIC_ORY_SDK_URL and/or ORY_SDK_URL in production environments."
501
+ );
502
+ }
503
+ return sdkUrl.replace(/\/$/, "");
504
+ } else {
505
+ if (process.env["__NEXT_PRIVATE_ORIGIN"]) {
506
+ return process.env["__NEXT_PRIVATE_ORIGIN"].replace(/\/$/, "");
507
+ } else if (process.env["VERCEL_URL"]) {
508
+ return `https://${process.env["VERCEL_URL"]}`.replace(/\/$/, "");
509
+ }
510
+ }
511
+ }
512
+ if (typeof window !== "undefined") {
513
+ return window.location.origin;
514
+ }
515
+ throw new Error(
516
+ "Unable to determine SDK URL. Please set NEXT_PUBLIC_ORY_SDK_URL and/or ORY_SDK_URL or supply the sdk.url parameter in the Ory configuration."
517
+ );
518
+ }
404
519
  function mergeTranslations(customTranslations) {
405
520
  return Object.keys(customTranslations).reduce((acc, key) => {
406
521
  acc[key] = { ...OryLocales[key], ...customTranslations[key] };
@@ -430,17 +545,18 @@ var IntlProvider = ({
430
545
  function OryProvider({
431
546
  children,
432
547
  components: Components,
548
+ config,
433
549
  ...oryFlowProps
434
550
  }) {
435
551
  var _a, _b, _c;
436
- return /* @__PURE__ */ jsx(
552
+ return /* @__PURE__ */ jsx(OryConfigurationProvider, { sdk: config.sdk, project: config.project, children: /* @__PURE__ */ jsx(
437
553
  IntlProvider,
438
554
  {
439
- locale: (_b = (_a = oryFlowProps.config.intl) == null ? void 0 : _a.locale) != null ? _b : "en",
440
- customTranslations: (_c = oryFlowProps.config.intl) == null ? void 0 : _c.customTranslations,
555
+ locale: (_b = (_a = config.intl) == null ? void 0 : _a.locale) != null ? _b : "en",
556
+ customTranslations: (_c = config.intl) == null ? void 0 : _c.customTranslations,
441
557
  children: /* @__PURE__ */ jsx(OryFlowProvider, { ...oryFlowProps, children: /* @__PURE__ */ jsx(OryComponentProvider, { components: Components, children }) })
442
558
  }
443
- );
559
+ ) });
444
560
  }
445
561
  function OryCardHeader() {
446
562
  const { Card } = useComponents();
@@ -559,17 +675,6 @@ function OryCardContent({ children }) {
559
675
  const { Card } = useComponents();
560
676
  return /* @__PURE__ */ jsx(Card.Content, { children });
561
677
  }
562
- function frontendClient(sdkUrl, opts = {}) {
563
- const config = new Configuration({
564
- ...opts,
565
- basePath: sdkUrl,
566
- headers: {
567
- Accept: "application/json",
568
- ...opts.headers
569
- }
570
- });
571
- return new FrontendApi(config);
572
- }
573
678
 
574
679
  // src/util/internal.ts
575
680
  function replaceWindowFlowId(flow) {
@@ -577,9 +682,137 @@ function replaceWindowFlowId(flow) {
577
682
  url.searchParams.set("flow", flow);
578
683
  window.location.href = url.toString();
579
684
  }
685
+ function isGenericErrorResponse(response) {
686
+ return typeof response === "object" && !!response && "error" in response && typeof response.error === "object" && !!response.error && "id" in response.error;
687
+ }
688
+ function isNeedsPrivilegedSessionError(response) {
689
+ return isGenericErrorResponse(response) && response.error.id === "session_refresh_required";
690
+ }
691
+ function isSelfServiceFlowExpiredError(response) {
692
+ return isGenericErrorResponse(response) && response.error.id === "self_service_flow_expired";
693
+ }
694
+ function isBrowserLocationChangeRequired(response) {
695
+ return isGenericErrorResponse(response) && isGenericErrorResponse(response) && response.error.id === "browser_location_change_required";
696
+ }
697
+ function isAddressNotVerified(response) {
698
+ return isGenericErrorResponse(response) && response.error.id === "session_verified_address_required";
699
+ }
700
+ function isCsrfError(response) {
701
+ return isGenericErrorResponse(response) && response.error.id === "security_csrf_violation";
702
+ }
703
+ var isResponseError = (err) => {
704
+ if (err instanceof ResponseError) {
705
+ return true;
706
+ }
707
+ return typeof err === "object" && !!err && "name" in err && err.name === "ResponseError";
708
+ };
709
+ var isFetchError = (err) => {
710
+ return err instanceof FetchError;
711
+ };
712
+
713
+ // src/util/sdk-helpers/urlHelpers.ts
714
+ var verificationUrl = (config) => config.sdk.url + "/self-service/verification/browser";
715
+ var handleFlowError = (opts) => async (err) => {
716
+ var _a;
717
+ if (!isResponseError(err)) {
718
+ if (isFetchError(err)) {
719
+ throw new FetchError(
720
+ err,
721
+ "Unable to call the API endpoint. Ensure that CORS is set up correctly and that you have provided a valid SDK URL to Ory Elements."
722
+ );
723
+ }
724
+ throw err;
725
+ }
726
+ const contentType = err.response.headers.get("content-type") || "";
727
+ if (contentType.includes("application/json")) {
728
+ const body = await toBody(err.response);
729
+ if (isSelfServiceFlowExpiredError(body)) {
730
+ opts.onRestartFlow(body.use_flow_id);
731
+ return;
732
+ } else if (isAddressNotVerified(body)) {
733
+ for (const continueWith of ((_a = body.error.details) == null ? void 0 : _a.continue_with) || []) {
734
+ if (continueWith.action === "show_verification_ui" && continueWith.flow.url) {
735
+ opts.onRedirect(continueWith.flow.url, true);
736
+ return;
737
+ }
738
+ }
739
+ opts.onRedirect(verificationUrl(opts.config), true);
740
+ return;
741
+ } else if (isBrowserLocationChangeRequired(body) && body.redirect_browser_to) {
742
+ opts.onRedirect(body.redirect_browser_to, true);
743
+ return;
744
+ } else if (isNeedsPrivilegedSessionError(body)) {
745
+ opts.onRedirect(body.redirect_browser_to, true);
746
+ return;
747
+ } else if (isCsrfError(body)) {
748
+ opts.onRestartFlow();
749
+ return;
750
+ }
751
+ switch (err.response.status) {
752
+ case 404:
753
+ opts.onRestartFlow();
754
+ return;
755
+ case 410:
756
+ opts.onRestartFlow();
757
+ return;
758
+ case 400:
759
+ return opts.onValidationError(
760
+ await err.response.json()
761
+ );
762
+ case 403:
763
+ opts.onRestartFlow();
764
+ return;
765
+ case 422: {
766
+ throw new ResponseError(
767
+ err.response,
768
+ "The API returned an error code indicating a required redirect, but the SDK is outdated and does not know how to handle the action. Received response: " + await err.response.json()
769
+ );
770
+ }
771
+ }
772
+ throw new ResponseError(
773
+ err.response,
774
+ "The Ory API endpoint returned a response code the SDK does not know how to handle. Please check the network tab for more information. Received response: " + await err.response.json()
775
+ );
776
+ } else if (
777
+ // Not a JSON response? If it's a text response we will return an error informing the user that the response is not JSON.
778
+ contentType.includes("text/") || contentType.includes("html") || contentType.includes("xml")
779
+ ) {
780
+ await logResponseError(err.response, true);
781
+ throw new ResponseError(
782
+ err.response,
783
+ `The Ory API endpoint returned an unexpected HTML or text response. Check your console output for details.`
784
+ );
785
+ }
786
+ await logResponseError(err.response, false);
787
+ throw new ResponseError(
788
+ err.response,
789
+ "The Ory API endpoint returned unexpected content type `" + contentType + "`. Check your console output for details."
790
+ );
791
+ };
792
+ async function toBody(response) {
793
+ try {
794
+ return await response.clone().json();
795
+ } catch (e) {
796
+ await logResponseError(response, true, [e]);
797
+ throw new ResponseError(
798
+ response,
799
+ "Unable to decode API response using JSON."
800
+ );
801
+ }
802
+ }
803
+ async function logResponseError(response, printBody, wrap) {
804
+ console.error("Unable to decode API response", {
805
+ response: {
806
+ status: response.status,
807
+ headers: Object.fromEntries(response.headers.entries()),
808
+ body: printBody ? await response.clone().text() : void 0
809
+ },
810
+ errors: wrap
811
+ });
812
+ }
580
813
 
581
814
  // src/util/onSubmitLogin.ts
582
- async function onSubmitLogin({ config, flow }, {
815
+ async function onSubmitLogin({ flow }, config, {
583
816
  setFlowContainer,
584
817
  body,
585
818
  onRedirect
@@ -608,27 +841,21 @@ async function onSubmitLogin({ config, flow }, {
608
841
  },
609
842
  onValidationError: (body2) => {
610
843
  setFlowContainer({
611
- config,
612
844
  flow: body2,
613
845
  flowType: FlowType.Login
614
846
  });
615
847
  },
616
- onRedirect
848
+ onRedirect,
849
+ config
617
850
  })
618
851
  );
619
852
  }
620
- async function onSubmitRecovery({ config, flow }, {
853
+ async function onSubmitRecovery({ flow }, config, {
621
854
  setFlowContainer,
622
855
  body,
623
856
  onRedirect
624
857
  }) {
625
- var _a;
626
- if (!config.sdk.url) {
627
- throw new Error(
628
- `Please supply your Ory Network SDK url to the Ory Elements configuration.`
629
- );
630
- }
631
- await frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {}).updateRecoveryFlowRaw({
858
+ await config.sdk.frontend.updateRecoveryFlowRaw({
632
859
  flow: flow.id,
633
860
  updateRecoveryFlowBody: body
634
861
  }).then(async (res) => {
@@ -641,8 +868,7 @@ async function onSubmitRecovery({ config, flow }, {
641
868
  }
642
869
  setFlowContainer({
643
870
  flow: flow2,
644
- flowType: FlowType.Recovery,
645
- config
871
+ flowType: FlowType.Recovery
646
872
  });
647
873
  }).catch(
648
874
  handleFlowError({
@@ -660,12 +886,12 @@ async function onSubmitRecovery({ config, flow }, {
660
886
  } else {
661
887
  setFlowContainer({
662
888
  flow: body2,
663
- flowType: FlowType.Recovery,
664
- config
889
+ flowType: FlowType.Recovery
665
890
  });
666
891
  }
667
892
  },
668
- onRedirect
893
+ onRedirect,
894
+ config
669
895
  })
670
896
  );
671
897
  }
@@ -682,19 +908,12 @@ function handleContinueWithRecoveryUIError(error, config, onRedirect) {
682
908
  }
683
909
  onRedirect(recoveryUrl(config), true);
684
910
  }
685
- async function onSubmitRegistration({ config, flow }, {
911
+ async function onSubmitRegistration({ flow }, config, {
686
912
  setFlowContainer,
687
913
  body,
688
914
  onRedirect
689
915
  }) {
690
- var _a;
691
- if (!config.sdk.url) {
692
- throw new Error(
693
- `Please supply your Ory Network SDK url to the Ory Elements configuration.`
694
- );
695
- }
696
- const client = frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {});
697
- await client.updateRegistrationFlowRaw({
916
+ await config.sdk.frontend.updateRegistrationFlowRaw({
698
917
  flow: flow.id,
699
918
  updateRegistrationFlowBody: body
700
919
  }).then(async (res) => {
@@ -718,27 +937,20 @@ async function onSubmitRegistration({ config, flow }, {
718
937
  onValidationError: (body2) => {
719
938
  setFlowContainer({
720
939
  flow: body2,
721
- flowType: FlowType.Registration,
722
- config
940
+ flowType: FlowType.Registration
723
941
  });
724
942
  },
725
- onRedirect
943
+ onRedirect,
944
+ config
726
945
  })
727
946
  );
728
947
  }
729
- async function onSubmitSettings({ config, flow }, {
948
+ async function onSubmitSettings({ flow }, config, {
730
949
  setFlowContainer,
731
950
  body,
732
951
  onRedirect
733
952
  }) {
734
- var _a;
735
- if (!config.sdk.url) {
736
- throw new Error(
737
- `Please supply your Ory Network SDK url to the Ory Elements configuration.`
738
- );
739
- }
740
- const client = frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {});
741
- await client.updateSettingsFlowRaw({
953
+ await config.sdk.frontend.updateSettingsFlowRaw({
742
954
  flow: flow.id,
743
955
  updateSettingsFlowBody: body
744
956
  }).then(async (res) => {
@@ -751,8 +963,7 @@ async function onSubmitSettings({ config, flow }, {
751
963
  }
752
964
  setFlowContainer({
753
965
  flow: body2,
754
- flowType: FlowType.Settings,
755
- config
966
+ flowType: FlowType.Settings
756
967
  });
757
968
  }).catch(
758
969
  handleFlowError({
@@ -766,14 +977,14 @@ async function onSubmitSettings({ config, flow }, {
766
977
  onValidationError: (body2) => {
767
978
  setFlowContainer({
768
979
  flow: body2,
769
- flowType: FlowType.Settings,
770
- config
980
+ flowType: FlowType.Settings
771
981
  });
772
982
  },
773
- onRedirect
983
+ onRedirect,
984
+ config
774
985
  })
775
986
  ).catch((err) => {
776
- if (isResponseError(err)) {
987
+ if (isResponseError$1(err)) {
777
988
  if (err.response.status === 401) {
778
989
  return onRedirect(
779
990
  loginUrl(config) + "?return_to=" + settingsUrl(config),
@@ -784,25 +995,18 @@ async function onSubmitSettings({ config, flow }, {
784
995
  }
785
996
  });
786
997
  }
787
- async function onSubmitVerification({ config, flow }, {
998
+ async function onSubmitVerification({ flow }, config, {
788
999
  setFlowContainer,
789
1000
  body,
790
1001
  onRedirect
791
1002
  }) {
792
- var _a;
793
- if (!config.sdk.url) {
794
- throw new Error(
795
- `Please supply your Ory Network SDK URL to the Ory Elements configuration.`
796
- );
797
- }
798
- await frontendClient(config.sdk.url, (_a = config.sdk.options) != null ? _a : {}).updateVerificationFlowRaw({
1003
+ await config.sdk.frontend.updateVerificationFlowRaw({
799
1004
  flow: flow.id,
800
1005
  updateVerificationFlowBody: body
801
1006
  }).then(
802
1007
  async (res) => setFlowContainer({
803
1008
  flow: await res.value(),
804
- flowType: FlowType.Verification,
805
- config
1009
+ flowType: FlowType.Verification
806
1010
  })
807
1011
  ).catch(
808
1012
  handleFlowError({
@@ -810,17 +1014,17 @@ async function onSubmitVerification({ config, flow }, {
810
1014
  if (useFlowId) {
811
1015
  replaceWindowFlowId(useFlowId);
812
1016
  } else {
813
- onRedirect(verificationUrl(config), true);
1017
+ onRedirect(verificationUrl$1(config), true);
814
1018
  }
815
1019
  },
816
1020
  onValidationError: (body2) => {
817
1021
  setFlowContainer({
818
1022
  flow: body2,
819
- flowType: FlowType.Verification,
820
- config
1023
+ flowType: FlowType.Verification
821
1024
  });
822
1025
  },
823
- onRedirect
1026
+ onRedirect,
1027
+ config
824
1028
  })
825
1029
  );
826
1030
  }
@@ -830,6 +1034,7 @@ var supportsSelectAccountPrompt = ["google", "github"];
830
1034
  function useOryFormSubmit(onAfterSubmit) {
831
1035
  const flowContainer = useOryFlow();
832
1036
  const methods = useFormContext();
1037
+ const config = useOryConfiguration();
833
1038
  const handleSuccess = (flow) => {
834
1039
  flowContainer.setFlowContainer(flow);
835
1040
  methods.reset(computeDefaultValues(flow.flow.ui.nodes));
@@ -846,7 +1051,7 @@ function useOryFormSubmit(onAfterSubmit) {
846
1051
  if (submitData.method === "code" && data.code) {
847
1052
  submitData.resend = "";
848
1053
  }
849
- await onSubmitLogin(flowContainer, {
1054
+ await onSubmitLogin(flowContainer, config, {
850
1055
  onRedirect,
851
1056
  setFlowContainer: handleSuccess,
852
1057
  body: submitData
@@ -860,7 +1065,7 @@ function useOryFormSubmit(onAfterSubmit) {
860
1065
  if (submitData.method === "code" && submitData.code) {
861
1066
  submitData.resend = "";
862
1067
  }
863
- await onSubmitRegistration(flowContainer, {
1068
+ await onSubmitRegistration(flowContainer, config, {
864
1069
  onRedirect,
865
1070
  setFlowContainer: handleSuccess,
866
1071
  body: submitData
@@ -868,7 +1073,7 @@ function useOryFormSubmit(onAfterSubmit) {
868
1073
  break;
869
1074
  }
870
1075
  case FlowType.Verification:
871
- await onSubmitVerification(flowContainer, {
1076
+ await onSubmitVerification(flowContainer, config, {
872
1077
  onRedirect,
873
1078
  setFlowContainer: handleSuccess,
874
1079
  body: data
@@ -881,7 +1086,7 @@ function useOryFormSubmit(onAfterSubmit) {
881
1086
  if (data.code) {
882
1087
  submitData.email = "";
883
1088
  }
884
- await onSubmitRecovery(flowContainer, {
1089
+ await onSubmitRecovery(flowContainer, config, {
885
1090
  onRedirect,
886
1091
  setFlowContainer: handleSuccess,
887
1092
  body: submitData
@@ -909,7 +1114,7 @@ function useOryFormSubmit(onAfterSubmit) {
909
1114
  if ("passkey_remove" in submitData) {
910
1115
  submitData.method = "passkey";
911
1116
  }
912
- await onSubmitSettings(flowContainer, {
1117
+ await onSubmitSettings(flowContainer, config, {
913
1118
  onRedirect,
914
1119
  setFlowContainer: handleSuccess,
915
1120
  body: submitData
@@ -1229,7 +1434,7 @@ function OryTwoStepCardStateMethodActive({
1229
1434
  onAfterSubmit: handleAfterFormSubmit(dispatchFormState),
1230
1435
  children: /* @__PURE__ */ jsxs(Form.Group, { children: [
1231
1436
  ui.nodes.filter(
1232
- (n) => isUiNodeScriptAttributes(n.attributes) || n.group === UiNodeGroupEnum.Captcha || n.group === UiNodeGroupEnum.Default || n.group === UiNodeGroupEnum.Profile
1437
+ (n) => isUiNodeScriptAttributes(n.attributes) || n.group === UiNodeGroupEnum.Default || n.group === UiNodeGroupEnum.Profile
1233
1438
  ).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k)),
1234
1439
  finalNodes.sort(sortNodes).map((node, k) => /* @__PURE__ */ jsx(Node, { node }, k))
1235
1440
  ] })
@@ -4298,6 +4503,6 @@ var OryLocales = {
4298
4503
  sv: sv_default
4299
4504
  };
4300
4505
 
4301
- export { HeadlessPageHeader, OryCard, OryCardContent, OryCardFooter, OryCardHeader, OryCardValidationMessages, OryConsentCard, OryForm, OryFormGroupDivider, OryFormGroups, OryFormOidcButtons, OryFormSection, OryFormSocialButtonsForm, OryLocales, OryProvider, OrySettingsCard, OryTwoStepCard, messageTestId, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryFlow };
4506
+ export { HeadlessPageHeader, OryCard, OryCardContent, OryCardFooter, OryCardHeader, OryCardValidationMessages, OryConfigurationProvider, OryConsentCard, OryForm, OryFormGroupDivider, OryFormGroups, OryFormOidcButtons, OryFormSection, OryFormSocialButtonsForm, OryLocales, OryProvider, OrySettingsCard, OryTwoStepCard, messageTestId, uiTextToFormattedMessage, useComponents, useNodeSorter, useOryConfiguration, useOryFlow };
4302
4507
  //# sourceMappingURL=index.mjs.map
4303
4508
  //# sourceMappingURL=index.mjs.map