@ory/elements-react 1.0.0-next.15 → 1.0.0-next.16
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/CHANGELOG.md +27 -0
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -6
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.css +9 -0
- package/dist/theme/default/index.css.map +1 -1
- package/dist/theme/default/index.js +39 -29
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +47 -35
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +2 -2
- package/api-report/temp/elements-react-client.api.md +0 -22
- package/api-report/temp/elements-react-theme.api.md +0 -134
- package/api-report/temp/elements-react.api.md +0 -421
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, isUiNodeTextAttributes,
|
|
2
|
-
import { createContext, useContext,
|
|
1
|
+
import { UiNodeGroupEnum, isUiNodeInputAttributes, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeScriptAttributes, isUiNodeTextAttributes, FlowType, handleFlowError, loginUrl, handleContinueWith, recoveryUrl, registrationUrl, settingsUrl, isResponseError, verificationUrl, UiNodeInputAttributesTypeEnum, Configuration, FrontendApi } from '@ory/client-fetch';
|
|
2
|
+
import { createContext, useContext, useState, useMemo, useReducer, 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';
|
|
5
|
-
import { useForm, FormProvider
|
|
5
|
+
import { useFormContext, useForm, FormProvider } from 'react-hook-form';
|
|
6
6
|
|
|
7
7
|
// src/context/component.tsx
|
|
8
8
|
var ComponentContext = createContext({
|
|
@@ -105,20 +105,31 @@ function getFinalNodes(uniqueGroups, selectedGroup) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// src/context/form-state.ts
|
|
108
|
+
function findMethodWithMessage(nodes) {
|
|
109
|
+
var _a;
|
|
110
|
+
return (_a = nodes == null ? void 0 : nodes.filter((n) => !["default", "identifier_first"].includes(n.group))) == null ? void 0 : _a.find((node) => {
|
|
111
|
+
var _a2;
|
|
112
|
+
return ((_a2 = node.messages) == null ? void 0 : _a2.length) > 0;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
108
115
|
function parseStateFromFlow(flow) {
|
|
109
116
|
switch (flow.flowType) {
|
|
110
117
|
case FlowType.Registration:
|
|
111
|
-
case FlowType.Login:
|
|
118
|
+
case FlowType.Login: {
|
|
119
|
+
const methodWithMessage = findMethodWithMessage(flow.flow.ui.nodes);
|
|
112
120
|
if (flow.flow.active == "link_recovery") {
|
|
113
121
|
return { current: "method_active", method: "link" };
|
|
114
122
|
} else if (flow.flow.active == "code_recovery") {
|
|
115
123
|
return { current: "method_active", method: "code" };
|
|
124
|
+
} else if (methodWithMessage) {
|
|
125
|
+
return { current: "method_active", method: methodWithMessage.group };
|
|
126
|
+
} else if (flow.flow.active && !["default", "identifier_first"].includes(flow.flow.active)) {
|
|
127
|
+
return { current: "method_active", method: flow.flow.active };
|
|
116
128
|
} else if (isChoosingMethod(flow.flow.ui.nodes)) {
|
|
117
129
|
return { current: "select_method" };
|
|
118
|
-
} else if (flow.flow.active) {
|
|
119
|
-
return { current: "method_active", method: flow.flow.active };
|
|
120
130
|
}
|
|
121
131
|
return { current: "provide_identifier" };
|
|
132
|
+
}
|
|
122
133
|
case FlowType.Recovery:
|
|
123
134
|
case FlowType.Verification:
|
|
124
135
|
if (flow.flow.active === "code" || flow.flow.active === "link") {
|
|
@@ -2777,6 +2788,12 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
2777
2788
|
break;
|
|
2778
2789
|
}
|
|
2779
2790
|
}
|
|
2791
|
+
if ("password" in data) {
|
|
2792
|
+
methods.setValue("password", "");
|
|
2793
|
+
}
|
|
2794
|
+
if ("code" in data) {
|
|
2795
|
+
methods.setValue("code", "");
|
|
2796
|
+
}
|
|
2780
2797
|
onAfterSubmit == null ? void 0 : onAfterSubmit(data.method);
|
|
2781
2798
|
};
|
|
2782
2799
|
const hasMethods = flowContainer.flow.ui.nodes.filter((node) => {
|