@ory/elements-react 1.0.0-next.15 → 1.0.0-next.17
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 +48 -0
- package/api-report/elements-react-theme.api.json +150 -0
- package/api-report/elements-react-theme.api.md +14 -2
- package/api-report/temp/elements-react-theme.api.md +14 -2
- package/dist/index.js +121 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -43
- 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.d.mts +12 -3
- package/dist/theme/default/index.d.ts +12 -3
- package/dist/theme/default/index.js +436 -405
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +495 -456
- package/dist/theme/default/index.mjs.map +1 -1
- package/jest.config.ts +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
## 1.0.0-next.17 (2024-11-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### 🚀 Features
|
|
5
|
+
|
|
6
|
+
- allow overriding OIDC logos
|
|
7
|
+
|
|
8
|
+
- enable proper account linking flows
|
|
9
|
+
|
|
10
|
+
- **core:** add react-hook form resolver
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### 🩹 Fixes
|
|
14
|
+
|
|
15
|
+
- handle recovery brute force protection
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### ❤️ Thank You
|
|
19
|
+
|
|
20
|
+
- Jonas Hungershausen
|
|
21
|
+
|
|
22
|
+
## 1.0.0-next.16 (2024-11-26)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### 🚀 Features
|
|
26
|
+
|
|
27
|
+
- allow overriding of field messages
|
|
28
|
+
|
|
29
|
+
- add test ids to components
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### 🩹 Fixes
|
|
33
|
+
|
|
34
|
+
- use --font-sans CSS variable for font
|
|
35
|
+
|
|
36
|
+
- registration & login flow form states
|
|
37
|
+
|
|
38
|
+
- missing resend button on login & registration
|
|
39
|
+
|
|
40
|
+
- password validation error form state
|
|
41
|
+
|
|
42
|
+
- current identifier button overflowing on long values
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### ❤️ Thank You
|
|
46
|
+
|
|
47
|
+
- Jonas Hungershausen
|
|
48
|
+
|
|
1
49
|
## 1.0.0-next.15 (2024-11-18)
|
|
2
50
|
|
|
3
51
|
|
|
@@ -172,6 +172,156 @@
|
|
|
172
172
|
"name": "",
|
|
173
173
|
"preserveMemberOrder": false,
|
|
174
174
|
"members": [
|
|
175
|
+
{
|
|
176
|
+
"kind": "Function",
|
|
177
|
+
"canonicalReference": "@ory/elements-react!DefaultButtonSocial:function(1)",
|
|
178
|
+
"docComment": "",
|
|
179
|
+
"excerptTokens": [
|
|
180
|
+
{
|
|
181
|
+
"kind": "Content",
|
|
182
|
+
"text": "declare function DefaultButtonSocial({ attributes, node, onClick, "
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"kind": "Reference",
|
|
186
|
+
"text": "showLabel",
|
|
187
|
+
"canonicalReference": "@ory/elements-react!~__type#showLabel"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"kind": "Content",
|
|
191
|
+
"text": ": _showLabel, "
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"kind": "Reference",
|
|
195
|
+
"text": "logos",
|
|
196
|
+
"canonicalReference": "@ory/elements-react!~__type#logos"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"kind": "Content",
|
|
200
|
+
"text": ": providedLogos, }: "
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"kind": "Reference",
|
|
204
|
+
"text": "DefaultSocialButtonProps",
|
|
205
|
+
"canonicalReference": "@ory/elements-react!~DefaultSocialButtonProps:type"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"kind": "Content",
|
|
209
|
+
"text": "): "
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"kind": "Reference",
|
|
213
|
+
"text": "react_jsx_runtime.JSX.Element",
|
|
214
|
+
"canonicalReference": "@types/react!JSX.Element:interface"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"kind": "Content",
|
|
218
|
+
"text": ";"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"fileUrlPath": "dist/theme/default/index.d.ts",
|
|
222
|
+
"returnTypeTokenRange": {
|
|
223
|
+
"startIndex": 7,
|
|
224
|
+
"endIndex": 8
|
|
225
|
+
},
|
|
226
|
+
"releaseTag": "Public",
|
|
227
|
+
"overloadIndex": 1,
|
|
228
|
+
"parameters": [
|
|
229
|
+
{
|
|
230
|
+
"parameterName": "{ attributes, node, onClick, showLabel: _showLabel, logos: providedLogos, }",
|
|
231
|
+
"parameterTypeTokenRange": {
|
|
232
|
+
"startIndex": 5,
|
|
233
|
+
"endIndex": 6
|
|
234
|
+
},
|
|
235
|
+
"isOptional": false
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"name": "DefaultButtonSocial"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"kind": "Namespace",
|
|
242
|
+
"canonicalReference": "@ory/elements-react!DefaultButtonSocial:namespace",
|
|
243
|
+
"docComment": "",
|
|
244
|
+
"excerptTokens": [
|
|
245
|
+
{
|
|
246
|
+
"kind": "Content",
|
|
247
|
+
"text": "declare namespace DefaultButtonSocial "
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"fileUrlPath": "dist/theme/default/index.d.ts",
|
|
251
|
+
"releaseTag": "Public",
|
|
252
|
+
"name": "DefaultButtonSocial",
|
|
253
|
+
"preserveMemberOrder": false,
|
|
254
|
+
"members": [
|
|
255
|
+
{
|
|
256
|
+
"kind": "Function",
|
|
257
|
+
"canonicalReference": "@ory/elements-react!DefaultButtonSocial.WithLogos:function(1)",
|
|
258
|
+
"docComment": "",
|
|
259
|
+
"excerptTokens": [
|
|
260
|
+
{
|
|
261
|
+
"kind": "Content",
|
|
262
|
+
"text": "WithLogos: (logos: "
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"kind": "Reference",
|
|
266
|
+
"text": "Record",
|
|
267
|
+
"canonicalReference": "!Record:type"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"kind": "Content",
|
|
271
|
+
"text": "<string, "
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"kind": "Reference",
|
|
275
|
+
"text": "ElementType",
|
|
276
|
+
"canonicalReference": "@types/react!React.ElementType:type"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"kind": "Content",
|
|
280
|
+
"text": ">"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"kind": "Content",
|
|
284
|
+
"text": ") => "
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"kind": "Content",
|
|
288
|
+
"text": "(props: "
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"kind": "Reference",
|
|
292
|
+
"text": "DefaultSocialButtonProps",
|
|
293
|
+
"canonicalReference": "@ory/elements-react!~DefaultSocialButtonProps:type"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"kind": "Content",
|
|
297
|
+
"text": ") => "
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"kind": "Reference",
|
|
301
|
+
"text": "react_jsx_runtime.JSX.Element",
|
|
302
|
+
"canonicalReference": "@types/react!JSX.Element:interface"
|
|
303
|
+
}
|
|
304
|
+
],
|
|
305
|
+
"returnTypeTokenRange": {
|
|
306
|
+
"startIndex": 6,
|
|
307
|
+
"endIndex": 10
|
|
308
|
+
},
|
|
309
|
+
"releaseTag": "Public",
|
|
310
|
+
"overloadIndex": 1,
|
|
311
|
+
"parameters": [
|
|
312
|
+
{
|
|
313
|
+
"parameterName": "logos",
|
|
314
|
+
"parameterTypeTokenRange": {
|
|
315
|
+
"startIndex": 1,
|
|
316
|
+
"endIndex": 5
|
|
317
|
+
},
|
|
318
|
+
"isOptional": false
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"name": "WithLogos"
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
},
|
|
175
325
|
{
|
|
176
326
|
"kind": "Function",
|
|
177
327
|
"canonicalReference": "@ory/elements-react!DefaultCard:function(1)",
|
|
@@ -8,6 +8,7 @@ import { ComponentPropsWithoutRef } from 'react';
|
|
|
8
8
|
import { ComponentType } from 'react';
|
|
9
9
|
import { ConfigurationParameters } from '@ory/client-fetch';
|
|
10
10
|
import { DetailedHTMLProps } from 'react';
|
|
11
|
+
import { ElementType } from 'react';
|
|
11
12
|
import { FlowError } from '@ory/client-fetch';
|
|
12
13
|
import { FormEventHandler } from 'react';
|
|
13
14
|
import { HTMLAttributes } from 'react';
|
|
@@ -28,6 +29,17 @@ import { UiText } from '@ory/client-fetch';
|
|
|
28
29
|
import { VariantProps } from 'class-variance-authority';
|
|
29
30
|
import { VerificationFlow } from '@ory/client-fetch';
|
|
30
31
|
|
|
32
|
+
// Warning: (ae-forgotten-export) The symbol "DefaultSocialButtonProps" needs to be exported by the entry point index.d.ts
|
|
33
|
+
//
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
export function DefaultButtonSocial({ attributes, node, onClick, showLabel: _showLabel, logos: providedLogos, }: DefaultSocialButtonProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
// @public (undocumented)
|
|
38
|
+
export namespace DefaultButtonSocial {
|
|
39
|
+
var // (undocumented)
|
|
40
|
+
WithLogos: (logos: Record<string, ElementType>) => (props: DefaultSocialButtonProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
}
|
|
42
|
+
|
|
31
43
|
// Warning: (ae-forgotten-export) The symbol "OryCardRootProps" needs to be exported by the entry point index.d.ts
|
|
32
44
|
//
|
|
33
45
|
// @public (undocumented)
|
|
@@ -126,8 +138,8 @@ export type VerificationFlowContextProps = {
|
|
|
126
138
|
|
|
127
139
|
// Warnings were encountered during analysis:
|
|
128
140
|
//
|
|
129
|
-
// dist/theme/default/index.d.ts:
|
|
130
|
-
// dist/theme/default/index.d.ts:
|
|
141
|
+
// dist/theme/default/index.d.ts:36:5 - (ae-forgotten-export) The symbol "OryFlowComponentOverrides" needs to be exported by the entry point index.d.ts
|
|
142
|
+
// dist/theme/default/index.d.ts:37:5 - (ae-forgotten-export) The symbol "OryClientConfiguration" needs to be exported by the entry point index.d.ts
|
|
131
143
|
|
|
132
144
|
// (No @packageDocumentation comment for this package)
|
|
133
145
|
|
|
@@ -8,6 +8,7 @@ import { ComponentPropsWithoutRef } from 'react';
|
|
|
8
8
|
import { ComponentType } from 'react';
|
|
9
9
|
import { ConfigurationParameters } from '@ory/client-fetch';
|
|
10
10
|
import { DetailedHTMLProps } from 'react';
|
|
11
|
+
import { ElementType } from 'react';
|
|
11
12
|
import { FlowError } from '@ory/client-fetch';
|
|
12
13
|
import { FormEventHandler } from 'react';
|
|
13
14
|
import { HTMLAttributes } from 'react';
|
|
@@ -28,6 +29,17 @@ import { UiText } from '@ory/client-fetch';
|
|
|
28
29
|
import { VariantProps } from 'class-variance-authority';
|
|
29
30
|
import { VerificationFlow } from '@ory/client-fetch';
|
|
30
31
|
|
|
32
|
+
// Warning: (ae-forgotten-export) The symbol "DefaultSocialButtonProps" needs to be exported by the entry point index.d.ts
|
|
33
|
+
//
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
export function DefaultButtonSocial({ attributes, node, onClick, showLabel: _showLabel, logos: providedLogos, }: DefaultSocialButtonProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
// @public (undocumented)
|
|
38
|
+
export namespace DefaultButtonSocial {
|
|
39
|
+
var // (undocumented)
|
|
40
|
+
WithLogos: (logos: Record<string, ElementType>) => (props: DefaultSocialButtonProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
}
|
|
42
|
+
|
|
31
43
|
// Warning: (ae-forgotten-export) The symbol "OryCardRootProps" needs to be exported by the entry point index.d.ts
|
|
32
44
|
//
|
|
33
45
|
// @public (undocumented)
|
|
@@ -126,8 +138,8 @@ export type VerificationFlowContextProps = {
|
|
|
126
138
|
|
|
127
139
|
// Warnings were encountered during analysis:
|
|
128
140
|
//
|
|
129
|
-
// dist/theme/default/index.d.ts:
|
|
130
|
-
// dist/theme/default/index.d.ts:
|
|
141
|
+
// dist/theme/default/index.d.ts:36:5 - (ae-forgotten-export) The symbol "OryFlowComponentOverrides" needs to be exported by the entry point index.d.ts
|
|
142
|
+
// dist/theme/default/index.d.ts:37:5 - (ae-forgotten-export) The symbol "OryClientConfiguration" needs to be exported by the entry point index.d.ts
|
|
131
143
|
|
|
132
144
|
// (No @packageDocumentation comment for this package)
|
|
133
145
|
|
package/dist/index.js
CHANGED
|
@@ -107,20 +107,34 @@ 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) {
|
|
118
|
+
var _a;
|
|
111
119
|
switch (flow.flowType) {
|
|
112
120
|
case clientFetch.FlowType.Registration:
|
|
113
|
-
case clientFetch.FlowType.Login:
|
|
121
|
+
case clientFetch.FlowType.Login: {
|
|
122
|
+
const methodWithMessage = findMethodWithMessage(flow.flow.ui.nodes);
|
|
114
123
|
if (flow.flow.active == "link_recovery") {
|
|
115
124
|
return { current: "method_active", method: "link" };
|
|
116
125
|
} else if (flow.flow.active == "code_recovery") {
|
|
117
126
|
return { current: "method_active", method: "code" };
|
|
127
|
+
} else if (methodWithMessage) {
|
|
128
|
+
return { current: "method_active", method: methodWithMessage.group };
|
|
129
|
+
} else if (flow.flow.active && !["default", "identifier_first", "oidc"].includes(flow.flow.active)) {
|
|
130
|
+
return { current: "method_active", method: flow.flow.active };
|
|
118
131
|
} else if (isChoosingMethod(flow.flow.ui.nodes)) {
|
|
119
132
|
return { current: "select_method" };
|
|
120
|
-
} else if (flow.flow.
|
|
121
|
-
return { current: "
|
|
133
|
+
} else if ((_a = flow.flow.ui.messages) == null ? void 0 : _a.some((m) => m.id === 1010016)) {
|
|
134
|
+
return { current: "select_method" };
|
|
122
135
|
}
|
|
123
136
|
return { current: "provide_identifier" };
|
|
137
|
+
}
|
|
124
138
|
case clientFetch.FlowType.Recovery:
|
|
125
139
|
case clientFetch.FlowType.Verification:
|
|
126
140
|
if (flow.flow.active === "code" || flow.flow.active === "link") {
|
|
@@ -427,7 +441,8 @@ var en_default = {
|
|
|
427
441
|
"settings.passkey.title": "Manage Passkeys",
|
|
428
442
|
"settings.passkey.description": "Manage your passkey settings",
|
|
429
443
|
"settings.passkey.info": "Manage your passkey settings",
|
|
430
|
-
"card.footer.select-another-method": "Select another method"
|
|
444
|
+
"card.footer.select-another-method": "Select another method",
|
|
445
|
+
"account-linking.title": "Link account"
|
|
431
446
|
};
|
|
432
447
|
|
|
433
448
|
// src/locales/de.json
|
|
@@ -673,7 +688,8 @@ var de_default = {
|
|
|
673
688
|
"settings.title-totp": "Verwalten Sie die 2FA TOTP Authenticator-App",
|
|
674
689
|
"settings.title-webauthn": "Hardware-Token verwalten",
|
|
675
690
|
"settings.webauthn.info": "Hardware-Tokens werden f\xFCr die Zweitfaktor-Authentifizierung oder als Erstfaktor-Authentifizierung mit Passkeys verwendet",
|
|
676
|
-
"card.footer.select-another-method": "Eine andere Methode verwenden"
|
|
691
|
+
"card.footer.select-another-method": "Eine andere Methode verwenden",
|
|
692
|
+
"account-linking.title": "Account Verbinden"
|
|
677
693
|
};
|
|
678
694
|
|
|
679
695
|
// src/locales/es.json
|
|
@@ -919,7 +935,8 @@ var es_default = {
|
|
|
919
935
|
"settings.title-totp": "",
|
|
920
936
|
"settings.title-webauthn": "",
|
|
921
937
|
"settings.webauthn.info": "",
|
|
922
|
-
"card.footer.select-another-method": ""
|
|
938
|
+
"card.footer.select-another-method": "",
|
|
939
|
+
"account-linking.title": ""
|
|
923
940
|
};
|
|
924
941
|
|
|
925
942
|
// src/locales/fr.json
|
|
@@ -1165,7 +1182,8 @@ var fr_default = {
|
|
|
1165
1182
|
"settings.webauthn.description": "",
|
|
1166
1183
|
"settings.webauthn.info": "",
|
|
1167
1184
|
"settings.webauthn.title": "",
|
|
1168
|
-
"card.footer.select-another-method": ""
|
|
1185
|
+
"card.footer.select-another-method": "",
|
|
1186
|
+
"account-linking.title": ""
|
|
1169
1187
|
};
|
|
1170
1188
|
|
|
1171
1189
|
// src/locales/nl.json
|
|
@@ -1411,7 +1429,8 @@ var nl_default = {
|
|
|
1411
1429
|
"settings.webauthn.description": "",
|
|
1412
1430
|
"settings.webauthn.info": "",
|
|
1413
1431
|
"settings.webauthn.title": "",
|
|
1414
|
-
"card.footer.select-another-method": ""
|
|
1432
|
+
"card.footer.select-another-method": "",
|
|
1433
|
+
"account-linking.title": ""
|
|
1415
1434
|
};
|
|
1416
1435
|
|
|
1417
1436
|
// src/locales/pl.json
|
|
@@ -1657,7 +1676,8 @@ var pl_default = {
|
|
|
1657
1676
|
"settings.webauthn.description": "",
|
|
1658
1677
|
"settings.webauthn.info": "",
|
|
1659
1678
|
"settings.webauthn.title": "",
|
|
1660
|
-
"card.footer.select-another-method": ""
|
|
1679
|
+
"card.footer.select-another-method": "",
|
|
1680
|
+
"account-linking.title": ""
|
|
1661
1681
|
};
|
|
1662
1682
|
|
|
1663
1683
|
// src/locales/pt.json
|
|
@@ -1903,7 +1923,8 @@ var pt_default = {
|
|
|
1903
1923
|
"settings.webauthn.description": "",
|
|
1904
1924
|
"settings.webauthn.info": "",
|
|
1905
1925
|
"settings.webauthn.title": "",
|
|
1906
|
-
"card.footer.select-another-method": ""
|
|
1926
|
+
"card.footer.select-another-method": "",
|
|
1927
|
+
"account-linking.title": ""
|
|
1907
1928
|
};
|
|
1908
1929
|
|
|
1909
1930
|
// src/locales/sv.json
|
|
@@ -2149,7 +2170,8 @@ var sv_default = {
|
|
|
2149
2170
|
"settings.webauthn.description": "Hantera inst\xE4llningarna f\xF6r din maskinvarutoken",
|
|
2150
2171
|
"settings.webauthn.info": "H\xE5rdvarutokens anv\xE4nds f\xF6r andrafaktorsautentisering eller som f\xF6rstafaktor med l\xF6senordsnycklar",
|
|
2151
2172
|
"settings.webauthn.title": "Hantera maskinvarutokens",
|
|
2152
|
-
"card.footer.select-another-method": "V\xE4lj en annan metod"
|
|
2173
|
+
"card.footer.select-another-method": "V\xE4lj en annan metod",
|
|
2174
|
+
"account-linking.title": "L\xE4nka ditt konto"
|
|
2153
2175
|
};
|
|
2154
2176
|
|
|
2155
2177
|
// src/locales/index.ts
|
|
@@ -2287,16 +2309,34 @@ async function onSubmitRecovery({ config, flow }, {
|
|
|
2287
2309
|
onRedirect(clientFetch.recoveryUrl(config), true);
|
|
2288
2310
|
},
|
|
2289
2311
|
onValidationError: (body2) => {
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2312
|
+
if ("error" in body2) {
|
|
2313
|
+
handleContinueWithRecoveryUIError(body2.error, config, onRedirect);
|
|
2314
|
+
return;
|
|
2315
|
+
} else {
|
|
2316
|
+
setFlowContainer({
|
|
2317
|
+
flow: body2,
|
|
2318
|
+
flowType: clientFetch.FlowType.Recovery,
|
|
2319
|
+
config
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2295
2322
|
},
|
|
2296
2323
|
onRedirect
|
|
2297
2324
|
})
|
|
2298
2325
|
);
|
|
2299
2326
|
}
|
|
2327
|
+
function handleContinueWithRecoveryUIError(error, config, onRedirect) {
|
|
2328
|
+
if ("continue_with" in error.details && Array.isArray(error.details.continue_with)) {
|
|
2329
|
+
const continueWithRecovery = error.details.continue_with.find(clientFetch.instanceOfContinueWithRecoveryUi);
|
|
2330
|
+
if ((continueWithRecovery == null ? void 0 : continueWithRecovery.action) === "show_recovery_ui") {
|
|
2331
|
+
onRedirect(
|
|
2332
|
+
config.project.recovery_ui_url + "?flow=" + (continueWithRecovery == null ? void 0 : continueWithRecovery.flow.id),
|
|
2333
|
+
false
|
|
2334
|
+
);
|
|
2335
|
+
return;
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
onRedirect(clientFetch.recoveryUrl(config), true);
|
|
2339
|
+
}
|
|
2300
2340
|
async function onSubmitRegistration({ config, flow }, {
|
|
2301
2341
|
setFlowContainer,
|
|
2302
2342
|
body,
|
|
@@ -2427,20 +2467,22 @@ function computeDefaultValues(nodes) {
|
|
|
2427
2467
|
return nodes.reduce((acc, node) => {
|
|
2428
2468
|
const attrs = node.attributes;
|
|
2429
2469
|
if (clientFetch.isUiNodeInputAttributes(attrs)) {
|
|
2430
|
-
if (attrs.name === "method" || attrs.type === "submit" || typeof attrs.value === "undefined")
|
|
2470
|
+
if (attrs.name === "method" || attrs.type === "submit" || typeof attrs.value === "undefined") {
|
|
2431
2471
|
return acc;
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2472
|
+
}
|
|
2473
|
+
return unrollTrait(
|
|
2474
|
+
{
|
|
2475
|
+
name: attrs.name,
|
|
2476
|
+
value: attrs.value
|
|
2477
|
+
},
|
|
2478
|
+
acc
|
|
2479
|
+
);
|
|
2437
2480
|
}
|
|
2438
2481
|
return acc;
|
|
2439
2482
|
}, {});
|
|
2440
2483
|
}
|
|
2441
2484
|
function unrollTrait(input, output = {}) {
|
|
2442
2485
|
const keys = input.name.split(".");
|
|
2443
|
-
if (!keys.length) return void 0;
|
|
2444
2486
|
let current = output;
|
|
2445
2487
|
keys.forEach((key, index) => {
|
|
2446
2488
|
if (!key) return;
|
|
@@ -2536,8 +2578,10 @@ var NodeInput = ({
|
|
|
2536
2578
|
//
|
|
2537
2579
|
...attrs
|
|
2538
2580
|
} = attributes;
|
|
2581
|
+
const isResendNode = ((_a = node.meta.label) == null ? void 0 : _a.id) === 1070008;
|
|
2582
|
+
const isScreenSelectionNode = "name" in node.attributes && node.attributes.name === "screen";
|
|
2539
2583
|
const setFormValue = () => {
|
|
2540
|
-
if (attrs.value) {
|
|
2584
|
+
if (attrs.value && !(isResendNode || isScreenSelectionNode)) {
|
|
2541
2585
|
setValue(attrs.name, attrs.value);
|
|
2542
2586
|
}
|
|
2543
2587
|
};
|
|
@@ -2562,8 +2606,6 @@ var NodeInput = ({
|
|
|
2562
2606
|
};
|
|
2563
2607
|
const isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === "oidc";
|
|
2564
2608
|
const isPinCodeInput = attrs.name === "code" && node.group === "code" || attrs.name === "totp_code" && node.group === "totp";
|
|
2565
|
-
const isResendNode = ((_a = node.meta.label) == null ? void 0 : _a.id) === 1070008;
|
|
2566
|
-
const isScreenSelectionNode = "name" in node.attributes && node.attributes.name === "screen";
|
|
2567
2609
|
switch (attributes.type) {
|
|
2568
2610
|
case clientFetch.UiNodeInputAttributesTypeEnum.Submit:
|
|
2569
2611
|
case clientFetch.UiNodeInputAttributesTypeEnum.Button:
|
|
@@ -2635,6 +2677,51 @@ function OryFormGroups({ children, groups }) {
|
|
|
2635
2677
|
return /* @__PURE__ */ jsxRuntime.jsx(Node, { node }, k);
|
|
2636
2678
|
}) });
|
|
2637
2679
|
}
|
|
2680
|
+
|
|
2681
|
+
// src/components/form/form-resolver.ts
|
|
2682
|
+
function isCodeResendRequest(data) {
|
|
2683
|
+
var _a;
|
|
2684
|
+
return (_a = data.email) != null ? _a : data.resend;
|
|
2685
|
+
}
|
|
2686
|
+
function useOryFormResolver() {
|
|
2687
|
+
const flowContainer = useOryFlow();
|
|
2688
|
+
return (data) => {
|
|
2689
|
+
if (flowContainer.formState.current === "method_active") {
|
|
2690
|
+
if (data.method === "code" && !data.code && !isCodeResendRequest(data)) {
|
|
2691
|
+
return {
|
|
2692
|
+
values: data,
|
|
2693
|
+
errors: {
|
|
2694
|
+
code: {
|
|
2695
|
+
id: 4000002,
|
|
2696
|
+
context: {
|
|
2697
|
+
property: "code"
|
|
2698
|
+
},
|
|
2699
|
+
type: "error",
|
|
2700
|
+
text: "Property code is missing"
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
};
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
return {
|
|
2707
|
+
values: data,
|
|
2708
|
+
errors: {}
|
|
2709
|
+
};
|
|
2710
|
+
};
|
|
2711
|
+
}
|
|
2712
|
+
function OryFormProvider({
|
|
2713
|
+
children,
|
|
2714
|
+
nodes
|
|
2715
|
+
}) {
|
|
2716
|
+
const flowContainer = useOryFlow();
|
|
2717
|
+
const defaultNodes = nodes ? flowContainer.flow.ui.nodes.filter((node) => node.group === clientFetch.UiNodeGroupEnum.Default).concat(nodes) : flowContainer.flow.ui.nodes;
|
|
2718
|
+
const methods = reactHookForm.useForm({
|
|
2719
|
+
// TODO: Generify this, so we have typesafety in the submit handler.
|
|
2720
|
+
defaultValues: computeDefaultValues(defaultNodes),
|
|
2721
|
+
resolver: useOryFormResolver()
|
|
2722
|
+
});
|
|
2723
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children });
|
|
2724
|
+
}
|
|
2638
2725
|
function OryFormOidcButtons({
|
|
2639
2726
|
children,
|
|
2640
2727
|
hideDivider
|
|
@@ -2680,7 +2767,7 @@ function OryFormSocialButtonsForm() {
|
|
|
2680
2767
|
if (filteredNodes.length === 0) {
|
|
2681
2768
|
return null;
|
|
2682
2769
|
}
|
|
2683
|
-
return /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) });
|
|
2770
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(OryFormOidcButtons, {}) }) });
|
|
2684
2771
|
}
|
|
2685
2772
|
function OryForm({ children, onAfterSubmit }) {
|
|
2686
2773
|
var _a;
|
|
@@ -2779,6 +2866,12 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
2779
2866
|
break;
|
|
2780
2867
|
}
|
|
2781
2868
|
}
|
|
2869
|
+
if ("password" in data) {
|
|
2870
|
+
methods.setValue("password", "");
|
|
2871
|
+
}
|
|
2872
|
+
if ("code" in data) {
|
|
2873
|
+
methods.setValue("code", "");
|
|
2874
|
+
}
|
|
2782
2875
|
onAfterSubmit == null ? void 0 : onAfterSubmit(data.method);
|
|
2783
2876
|
};
|
|
2784
2877
|
const hasMethods = flowContainer.flow.ui.nodes.filter((node) => {
|
|
@@ -2824,7 +2917,7 @@ function OryForm({ children, onAfterSubmit }) {
|
|
|
2824
2917
|
}
|
|
2825
2918
|
);
|
|
2826
2919
|
}
|
|
2827
|
-
var messageIdsToHide = [1040009, 1060003, 1080003, 1010014, 1040005];
|
|
2920
|
+
var messageIdsToHide = [1040009, 1060003, 1080003, 1010014, 1040005, 1010016];
|
|
2828
2921
|
function OryCardValidationMessages({ ...props }) {
|
|
2829
2922
|
var _a;
|
|
2830
2923
|
const { flow } = useOryFlow();
|
|
@@ -2837,18 +2930,6 @@ function OryCardValidationMessages({ ...props }) {
|
|
|
2837
2930
|
}
|
|
2838
2931
|
return /* @__PURE__ */ jsxRuntime.jsx(Message.Root, { ...props, children: messages == null ? void 0 : messages.map((message) => /* @__PURE__ */ jsxRuntime.jsx(Message.Content, { message }, message.id)) });
|
|
2839
2932
|
}
|
|
2840
|
-
function OryFormProvider({
|
|
2841
|
-
children,
|
|
2842
|
-
nodes
|
|
2843
|
-
}) {
|
|
2844
|
-
const flowContainer = useOryFlow();
|
|
2845
|
-
const defaultNodes = nodes ? flowContainer.flow.ui.nodes.filter((node) => node.group === clientFetch.UiNodeGroupEnum.Default).concat(nodes) : flowContainer.flow.ui.nodes;
|
|
2846
|
-
const methods = reactHookForm.useForm({
|
|
2847
|
-
// TODO: Generify this, so we have typesafety in the submit handler.
|
|
2848
|
-
defaultValues: computeDefaultValues(defaultNodes)
|
|
2849
|
-
});
|
|
2850
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children });
|
|
2851
|
-
}
|
|
2852
2933
|
function OryFormSection({ children, nodes }) {
|
|
2853
2934
|
const { Card } = useComponents();
|
|
2854
2935
|
return /* @__PURE__ */ jsxRuntime.jsx(OryFormProvider, { nodes, children: /* @__PURE__ */ jsxRuntime.jsx(OryForm, { children: /* @__PURE__ */ jsxRuntime.jsx(Card.SettingsSection, { children }) }) });
|