@ory/elements-react 1.0.0-next.13 → 1.0.0-next.14

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,4 +1,4 @@
1
- import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, FlowType, isUiNodeTextAttributes, UiNodeInputAttributesTypeEnum, handleFlowError, loginUrl, handleContinueWith, registrationUrl, verificationUrl, recoveryUrl, settingsUrl, Configuration, FrontendApi } from '@ory/client-fetch';
1
+ import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, FlowType, isUiNodeTextAttributes, UiNodeInputAttributesTypeEnum, handleFlowError, loginUrl, handleContinueWith, registrationUrl, verificationUrl, recoveryUrl, settingsUrl, isResponseError, Configuration, FrontendApi } from '@ory/client-fetch';
2
2
  import { createContext, useContext, useState, useMemo, useRef, useEffect } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useIntl, IntlProvider as IntlProvider$1 } from 'react-intl';
@@ -2580,7 +2580,17 @@ async function onSubmitSettings({ config, flow }, {
2580
2580
  },
2581
2581
  onRedirect
2582
2582
  })
2583
- );
2583
+ ).catch((err) => {
2584
+ if (isResponseError(err)) {
2585
+ if (err.response.status === 401) {
2586
+ return onRedirect(
2587
+ loginUrl(config) + "?return_to=" + settingsUrl(config),
2588
+ true
2589
+ );
2590
+ }
2591
+ throw err;
2592
+ }
2593
+ });
2584
2594
  }
2585
2595
  function OryForm({ children, onAfterSubmit, nodes }) {
2586
2596
  var _a;
@@ -2664,8 +2674,10 @@ function OryForm({ children, onAfterSubmit, nodes }) {
2664
2674
  if ("lookup_secret_confirm" in submitData || "lookup_secret_reveal" in submitData || "lookup_secret_regenerate" in submitData) {
2665
2675
  submitData.method = "lookup_secret";
2666
2676
  }
2667
- if ("link" in submitData || "unlink" in submitData) {
2668
- submitData.method = "oidc";
2677
+ if (submitData.method === "oidc") {
2678
+ submitData.upstream_parameters = {
2679
+ prompt: "select_account"
2680
+ };
2669
2681
  }
2670
2682
  if ("webauthn_remove" in submitData) {
2671
2683
  submitData.method = "webauthn";