@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 CHANGED
@@ -1,3 +1,30 @@
1
+ ## 1.0.0-next.16 (2024-11-26)
2
+
3
+
4
+ ### 🚀 Features
5
+
6
+ - allow overriding of field messages
7
+
8
+ - add test ids to components
9
+
10
+
11
+ ### 🩹 Fixes
12
+
13
+ - use --font-sans CSS variable for font
14
+
15
+ - registration & login flow form states
16
+
17
+ - missing resend button on login & registration
18
+
19
+ - password validation error form state
20
+
21
+ - current identifier button overflowing on long values
22
+
23
+
24
+ ### ❤️ Thank You
25
+
26
+ - Jonas Hungershausen
27
+
1
28
  ## 1.0.0-next.15 (2024-11-18)
2
29
 
3
30
 
package/dist/index.js CHANGED
@@ -107,20 +107,31 @@ function getFinalNodes(uniqueGroups, selectedGroup) {
107
107
  }
108
108
 
109
109
  // src/context/form-state.ts
110
+ function findMethodWithMessage(nodes) {
111
+ var _a;
112
+ return (_a = nodes == null ? void 0 : nodes.filter((n) => !["default", "identifier_first"].includes(n.group))) == null ? void 0 : _a.find((node) => {
113
+ var _a2;
114
+ return ((_a2 = node.messages) == null ? void 0 : _a2.length) > 0;
115
+ });
116
+ }
110
117
  function parseStateFromFlow(flow) {
111
118
  switch (flow.flowType) {
112
119
  case clientFetch.FlowType.Registration:
113
- case clientFetch.FlowType.Login:
120
+ case clientFetch.FlowType.Login: {
121
+ const methodWithMessage = findMethodWithMessage(flow.flow.ui.nodes);
114
122
  if (flow.flow.active == "link_recovery") {
115
123
  return { current: "method_active", method: "link" };
116
124
  } else if (flow.flow.active == "code_recovery") {
117
125
  return { current: "method_active", method: "code" };
126
+ } else if (methodWithMessage) {
127
+ return { current: "method_active", method: methodWithMessage.group };
128
+ } else if (flow.flow.active && !["default", "identifier_first"].includes(flow.flow.active)) {
129
+ return { current: "method_active", method: flow.flow.active };
118
130
  } else if (isChoosingMethod(flow.flow.ui.nodes)) {
119
131
  return { current: "select_method" };
120
- } else if (flow.flow.active) {
121
- return { current: "method_active", method: flow.flow.active };
122
132
  }
123
133
  return { current: "provide_identifier" };
134
+ }
124
135
  case clientFetch.FlowType.Recovery:
125
136
  case clientFetch.FlowType.Verification:
126
137
  if (flow.flow.active === "code" || flow.flow.active === "link") {
@@ -2779,6 +2790,12 @@ function OryForm({ children, onAfterSubmit }) {
2779
2790
  break;
2780
2791
  }
2781
2792
  }
2793
+ if ("password" in data) {
2794
+ methods.setValue("password", "");
2795
+ }
2796
+ if ("code" in data) {
2797
+ methods.setValue("code", "");
2798
+ }
2782
2799
  onAfterSubmit == null ? void 0 : onAfterSubmit(data.method);
2783
2800
  };
2784
2801
  const hasMethods = flowContainer.flow.ui.nodes.filter((node) => {