@leancodepl/kratos 8.3.6 → 8.5.0

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.
Files changed (80) hide show
  1. package/README.md +368 -4
  2. package/package.json +43 -7
  3. package/index.cjs.d.ts +0 -1
  4. package/index.cjs.default.js +0 -1
  5. package/index.cjs.js +0 -4362
  6. package/index.cjs.mjs +0 -2
  7. package/index.esm.d.ts +0 -1
  8. package/index.esm.js +0 -4334
  9. package/src/index.d.ts +0 -12
  10. package/src/lib/cards/index.d.ts +0 -2
  11. package/src/lib/cards/userAuthCard.d.ts +0 -20
  12. package/src/lib/cards/userSettingsCard.d.ts +0 -10
  13. package/src/lib/createKratosClient.d.ts +0 -2
  14. package/src/lib/defaultComponents/DefaultButtonComponent/index.d.ts +0 -2
  15. package/src/lib/defaultComponents/DefaultCheckboxComponent/index.d.ts +0 -2
  16. package/src/lib/defaultComponents/DefaultImageComponent/index.d.ts +0 -2
  17. package/src/lib/defaultComponents/DefaultInputComponent/index.d.ts +0 -2
  18. package/src/lib/defaultComponents/DefaultLinkComponent/index.d.ts +0 -2
  19. package/src/lib/defaultComponents/DefaultMessageComponent/index.d.ts +0 -2
  20. package/src/lib/defaultComponents/DefaultMessageFormatComponent/index.d.ts +0 -2
  21. package/src/lib/defaultComponents/DefaultTextComponent/index.d.ts +0 -2
  22. package/src/lib/defaultComponents/DefaultUiMessagesComponent/index.d.ts +0 -2
  23. package/src/lib/defaultComponents.d.ts +0 -2
  24. package/src/lib/flows/index.d.ts +0 -7
  25. package/src/lib/flows/useLoginFlow.d.ts +0 -21
  26. package/src/lib/flows/useLogoutFlow.d.ts +0 -8
  27. package/src/lib/flows/useReauthenticationFlow.d.ts +0 -8
  28. package/src/lib/flows/useRecoveryFlow.d.ts +0 -20
  29. package/src/lib/flows/useRegistrationFlow.d.ts +0 -20
  30. package/src/lib/flows/useSettingsFlow.d.ts +0 -20
  31. package/src/lib/flows/useVerificationFlow.d.ts +0 -20
  32. package/src/lib/helpers/errorMessages.d.ts +0 -7
  33. package/src/lib/helpers/filterFlowNodes.d.ts +0 -7
  34. package/src/lib/helpers/formattedMessage.d.ts +0 -4
  35. package/src/lib/helpers/getNodeLabel.d.ts +0 -2
  36. package/src/lib/helpers/node.d.ts +0 -7
  37. package/src/lib/helpers/useScriptNodes.d.ts +0 -5
  38. package/src/lib/helpers/userAuthForm.d.ts +0 -31
  39. package/src/lib/kratosContext.d.ts +0 -11
  40. package/src/lib/kratosContextProvider.d.ts +0 -10
  41. package/src/lib/sections/authCodeSection.d.ts +0 -14
  42. package/src/lib/sections/identifierFirstLoginSection.d.ts +0 -8
  43. package/src/lib/sections/linkSection.d.ts +0 -14
  44. package/src/lib/sections/loginSection.d.ts +0 -8
  45. package/src/lib/sections/lookupSecretSettingsSection.d.ts +0 -8
  46. package/src/lib/sections/oidcSection.d.ts +0 -8
  47. package/src/lib/sections/oidcSettingsSection.d.ts +0 -8
  48. package/src/lib/sections/passkeySettingsSection.d.ts +0 -8
  49. package/src/lib/sections/passwordSettingsSection.d.ts +0 -8
  50. package/src/lib/sections/passwordlessSection.d.ts +0 -8
  51. package/src/lib/sections/profileLoginSection.d.ts +0 -8
  52. package/src/lib/sections/profileRegistrationSection.d.ts +0 -8
  53. package/src/lib/sections/profileSettingsSection.d.ts +0 -8
  54. package/src/lib/sections/registrationSection.d.ts +0 -8
  55. package/src/lib/sections/totpSettingsSection.d.ts +0 -8
  56. package/src/lib/sessionManager/baseSessionManager.d.ts +0 -13
  57. package/src/lib/types/components.d.ts +0 -78
  58. package/src/lib/types/enums/errorId.d.ts +0 -16
  59. package/src/lib/types/enums/errorValidation.d.ts +0 -30
  60. package/src/lib/types/enums/errorValidationLogin.d.ts +0 -9
  61. package/src/lib/types/enums/errorValidationRecovery.d.ts +0 -9
  62. package/src/lib/types/enums/errorValidationRegistration.d.ts +0 -4
  63. package/src/lib/types/enums/errorValidationSettings.d.ts +0 -4
  64. package/src/lib/types/enums/errorValidationVerification.d.ts +0 -9
  65. package/src/lib/types/enums/index.d.ts +0 -14
  66. package/src/lib/types/enums/infoNodeLabel.d.ts +0 -14
  67. package/src/lib/types/enums/infoSelfServiceLogin.d.ts +0 -16
  68. package/src/lib/types/enums/infoSelfServiceRecovery.d.ts +0 -6
  69. package/src/lib/types/enums/infoSelfServiceRegistration.d.ts +0 -7
  70. package/src/lib/types/enums/infoSelfServiceSettings.d.ts +0 -21
  71. package/src/lib/types/enums/infoSelfServiceVerification.d.ts +0 -6
  72. package/src/lib/types/enums/misc.d.ts +0 -10
  73. package/src/lib/types/responseError.d.ts +0 -2
  74. package/src/lib/types/useHandleFlowError.d.ts +0 -13
  75. package/src/lib/utils/filterNodesByGroups.d.ts +0 -22
  76. package/src/lib/utils/getNodeInputType.d.ts +0 -1
  77. package/src/lib/utils/handleCancelError.d.ts +0 -2
  78. package/src/lib/utils/helpers.d.ts +0 -11
  79. package/src/lib/utils/typeGuards.d.ts +0 -24
  80. package/src/lib/utils/variables.d.ts +0 -4
package/index.esm.js DELETED
@@ -1,4334 +0,0 @@
1
- import { FrontendApi, Configuration, AuthenticatorAssuranceLevel, UiNodeGroupEnum } from '@ory/client';
2
- import axios from 'axios';
3
- import { createContext, useContext, useMemo, useState, useCallback, useEffect } from 'react';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { ReplaySubject, map, shareReplay, Subject, switchMap, from, catchError, of } from 'rxjs';
6
- import yn from 'yn';
7
-
8
- function createKratosClient(configuration) {
9
- return new FrontendApi(new Configuration(configuration), undefined, axios.create({
10
- withCredentials: true
11
- }));
12
- }
13
-
14
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
15
- try {
16
- var info = gen[key](arg);
17
- var value = info.value;
18
- } catch (error) {
19
- reject(error);
20
- return;
21
- }
22
- if (info.done) {
23
- resolve(value);
24
- } else {
25
- Promise.resolve(value).then(_next, _throw);
26
- }
27
- }
28
- function _async_to_generator$2(fn) {
29
- return function() {
30
- var self = this, args = arguments;
31
- return new Promise(function(resolve, reject) {
32
- var gen = fn.apply(self, args);
33
- function _next(value) {
34
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
35
- }
36
- function _throw(err) {
37
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
38
- }
39
- _next(undefined);
40
- });
41
- };
42
- }
43
- function _ts_generator$2(thisArg, body) {
44
- var f, y, t, g, _ = {
45
- label: 0,
46
- sent: function() {
47
- if (t[0] & 1) throw t[1];
48
- return t[1];
49
- },
50
- trys: [],
51
- ops: []
52
- };
53
- return g = {
54
- next: verb(0),
55
- "throw": verb(1),
56
- "return": verb(2)
57
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
58
- return this;
59
- }), g;
60
- function verb(n) {
61
- return function(v) {
62
- return step([
63
- n,
64
- v
65
- ]);
66
- };
67
- }
68
- function step(op) {
69
- if (f) throw new TypeError("Generator is already executing.");
70
- while(_)try {
71
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
72
- if (y = 0, t) op = [
73
- op[0] & 2,
74
- t.value
75
- ];
76
- switch(op[0]){
77
- case 0:
78
- case 1:
79
- t = op;
80
- break;
81
- case 4:
82
- _.label++;
83
- return {
84
- value: op[1],
85
- done: false
86
- };
87
- case 5:
88
- _.label++;
89
- y = op[1];
90
- op = [
91
- 0
92
- ];
93
- continue;
94
- case 7:
95
- op = _.ops.pop();
96
- _.trys.pop();
97
- continue;
98
- default:
99
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
100
- _ = 0;
101
- continue;
102
- }
103
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
104
- _.label = op[1];
105
- break;
106
- }
107
- if (op[0] === 6 && _.label < t[1]) {
108
- _.label = t[1];
109
- t = op;
110
- break;
111
- }
112
- if (t && _.label < t[2]) {
113
- _.label = t[2];
114
- _.ops.push(op);
115
- break;
116
- }
117
- if (t[2]) _.ops.pop();
118
- _.trys.pop();
119
- continue;
120
- }
121
- op = body.call(thisArg, _);
122
- } catch (e) {
123
- op = [
124
- 6,
125
- e
126
- ];
127
- y = 0;
128
- } finally{
129
- f = t = 0;
130
- }
131
- if (op[0] & 5) throw op[1];
132
- return {
133
- value: op[0] ? op[1] : void 0,
134
- done: true
135
- };
136
- }
137
- }
138
- var kratosContext = /*#__PURE__*/ createContext({
139
- components: undefined,
140
- useHandleFlowError: function() {
141
- return /*#__PURE__*/ _async_to_generator$2(function() {
142
- return _ts_generator$2(this, function(_state) {
143
- return [
144
- 2,
145
- undefined
146
- ];
147
- });
148
- });
149
- },
150
- excludeScripts: false
151
- });
152
- function useKratosContext() {
153
- var context = useContext(kratosContext);
154
- if (context.components === undefined) {
155
- throw new Error("Kratos context components were not initialized");
156
- }
157
- return context;
158
- }
159
-
160
- function _define_property$p(obj, key, value) {
161
- if (key in obj) {
162
- Object.defineProperty(obj, key, {
163
- value: value,
164
- enumerable: true,
165
- configurable: true,
166
- writable: true
167
- });
168
- } else {
169
- obj[key] = value;
170
- }
171
- return obj;
172
- }
173
- function _object_spread$o(target) {
174
- for(var i = 1; i < arguments.length; i++){
175
- var source = arguments[i] != null ? arguments[i] : {};
176
- var ownKeys = Object.keys(source);
177
- if (typeof Object.getOwnPropertySymbols === "function") {
178
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
179
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
180
- }));
181
- }
182
- ownKeys.forEach(function(key) {
183
- _define_property$p(target, key, source[key]);
184
- });
185
- }
186
- return target;
187
- }
188
- function ownKeys$f(object, enumerableOnly) {
189
- var keys = Object.keys(object);
190
- if (Object.getOwnPropertySymbols) {
191
- var symbols = Object.getOwnPropertySymbols(object);
192
- keys.push.apply(keys, symbols);
193
- }
194
- return keys;
195
- }
196
- function _object_spread_props$f(target, source) {
197
- source = source != null ? source : {};
198
- if (Object.getOwnPropertyDescriptors) {
199
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
200
- } else {
201
- ownKeys$f(Object(source)).forEach(function(key) {
202
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
203
- });
204
- }
205
- return target;
206
- }
207
- function _object_without_properties$b(source, excluded) {
208
- if (source == null) return {};
209
- var target = _object_without_properties_loose$b(source, excluded);
210
- var key, i;
211
- if (Object.getOwnPropertySymbols) {
212
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
213
- for(i = 0; i < sourceSymbolKeys.length; i++){
214
- key = sourceSymbolKeys[i];
215
- if (excluded.indexOf(key) >= 0) continue;
216
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
217
- target[key] = source[key];
218
- }
219
- }
220
- return target;
221
- }
222
- function _object_without_properties_loose$b(source, excluded) {
223
- if (source == null) return {};
224
- var target = {};
225
- var sourceKeys = Object.keys(source);
226
- var key, i;
227
- for(i = 0; i < sourceKeys.length; i++){
228
- key = sourceKeys[i];
229
- if (excluded.indexOf(key) >= 0) continue;
230
- target[key] = source[key];
231
- }
232
- return target;
233
- }
234
- function DefaultButtonComponent(_param) {
235
- var header = _param.header, props = _object_without_properties$b(_param, [
236
- "header"
237
- ]);
238
- return /*#__PURE__*/ jsx("button", _object_spread_props$f(_object_spread$o({}, props), {
239
- children: header
240
- }));
241
- }
242
-
243
- function _define_property$o(obj, key, value) {
244
- if (key in obj) {
245
- Object.defineProperty(obj, key, {
246
- value: value,
247
- enumerable: true,
248
- configurable: true,
249
- writable: true
250
- });
251
- } else {
252
- obj[key] = value;
253
- }
254
- return obj;
255
- }
256
- function _object_spread$n(target) {
257
- for(var i = 1; i < arguments.length; i++){
258
- var source = arguments[i] != null ? arguments[i] : {};
259
- var ownKeys = Object.keys(source);
260
- if (typeof Object.getOwnPropertySymbols === "function") {
261
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
262
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
263
- }));
264
- }
265
- ownKeys.forEach(function(key) {
266
- _define_property$o(target, key, source[key]);
267
- });
268
- }
269
- return target;
270
- }
271
- function ownKeys$e(object, enumerableOnly) {
272
- var keys = Object.keys(object);
273
- if (Object.getOwnPropertySymbols) {
274
- var symbols = Object.getOwnPropertySymbols(object);
275
- keys.push.apply(keys, symbols);
276
- }
277
- return keys;
278
- }
279
- function _object_spread_props$e(target, source) {
280
- source = source != null ? source : {};
281
- if (Object.getOwnPropertyDescriptors) {
282
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
283
- } else {
284
- ownKeys$e(Object(source)).forEach(function(key) {
285
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
286
- });
287
- }
288
- return target;
289
- }
290
- function _object_without_properties$a(source, excluded) {
291
- if (source == null) return {};
292
- var target = _object_without_properties_loose$a(source, excluded);
293
- var key, i;
294
- if (Object.getOwnPropertySymbols) {
295
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
296
- for(i = 0; i < sourceSymbolKeys.length; i++){
297
- key = sourceSymbolKeys[i];
298
- if (excluded.indexOf(key) >= 0) continue;
299
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
300
- target[key] = source[key];
301
- }
302
- }
303
- return target;
304
- }
305
- function _object_without_properties_loose$a(source, excluded) {
306
- if (source == null) return {};
307
- var target = {};
308
- var sourceKeys = Object.keys(source);
309
- var key, i;
310
- for(i = 0; i < sourceKeys.length; i++){
311
- key = sourceKeys[i];
312
- if (excluded.indexOf(key) >= 0) continue;
313
- target[key] = source[key];
314
- }
315
- return target;
316
- }
317
- function DefaultCheckboxComponent(_param) {
318
- var label = _param.label, helperMessage = _param.helperMessage, props = _object_without_properties$a(_param, [
319
- "label",
320
- "helperMessage"
321
- ]);
322
- return /*#__PURE__*/ jsxs("div", {
323
- children: [
324
- /*#__PURE__*/ jsxs("label", {
325
- children: [
326
- /*#__PURE__*/ jsx("input", _object_spread_props$e(_object_spread$n({}, props), {
327
- type: "checkbox"
328
- })),
329
- label
330
- ]
331
- }),
332
- helperMessage
333
- ]
334
- });
335
- }
336
-
337
- function _define_property$n(obj, key, value) {
338
- if (key in obj) {
339
- Object.defineProperty(obj, key, {
340
- value: value,
341
- enumerable: true,
342
- configurable: true,
343
- writable: true
344
- });
345
- } else {
346
- obj[key] = value;
347
- }
348
- return obj;
349
- }
350
- function _object_spread$m(target) {
351
- for(var i = 1; i < arguments.length; i++){
352
- var source = arguments[i] != null ? arguments[i] : {};
353
- var ownKeys = Object.keys(source);
354
- if (typeof Object.getOwnPropertySymbols === "function") {
355
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
356
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
357
- }));
358
- }
359
- ownKeys.forEach(function(key) {
360
- _define_property$n(target, key, source[key]);
361
- });
362
- }
363
- return target;
364
- }
365
- function _object_without_properties$9(source, excluded) {
366
- if (source == null) return {};
367
- var target = _object_without_properties_loose$9(source, excluded);
368
- var key, i;
369
- if (Object.getOwnPropertySymbols) {
370
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
371
- for(i = 0; i < sourceSymbolKeys.length; i++){
372
- key = sourceSymbolKeys[i];
373
- if (excluded.indexOf(key) >= 0) continue;
374
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
375
- target[key] = source[key];
376
- }
377
- }
378
- return target;
379
- }
380
- function _object_without_properties_loose$9(source, excluded) {
381
- if (source == null) return {};
382
- var target = {};
383
- var sourceKeys = Object.keys(source);
384
- var key, i;
385
- for(i = 0; i < sourceKeys.length; i++){
386
- key = sourceKeys[i];
387
- if (excluded.indexOf(key) >= 0) continue;
388
- target[key] = source[key];
389
- }
390
- return target;
391
- }
392
- function DefaultImageComponent(_param) {
393
- var header = _param.header, props = _object_without_properties$9(_param, [
394
- "header"
395
- ]);
396
- return /*#__PURE__*/ jsxs("div", {
397
- children: [
398
- header && /*#__PURE__*/ jsx("p", {
399
- children: header
400
- }),
401
- /*#__PURE__*/ jsx("img", _object_spread$m({}, props))
402
- ]
403
- });
404
- }
405
-
406
- function _define_property$m(obj, key, value) {
407
- if (key in obj) {
408
- Object.defineProperty(obj, key, {
409
- value: value,
410
- enumerable: true,
411
- configurable: true,
412
- writable: true
413
- });
414
- } else {
415
- obj[key] = value;
416
- }
417
- return obj;
418
- }
419
- function _object_spread$l(target) {
420
- for(var i = 1; i < arguments.length; i++){
421
- var source = arguments[i] != null ? arguments[i] : {};
422
- var ownKeys = Object.keys(source);
423
- if (typeof Object.getOwnPropertySymbols === "function") {
424
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
425
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
426
- }));
427
- }
428
- ownKeys.forEach(function(key) {
429
- _define_property$m(target, key, source[key]);
430
- });
431
- }
432
- return target;
433
- }
434
- function _object_without_properties$8(source, excluded) {
435
- if (source == null) return {};
436
- var target = _object_without_properties_loose$8(source, excluded);
437
- var key, i;
438
- if (Object.getOwnPropertySymbols) {
439
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
440
- for(i = 0; i < sourceSymbolKeys.length; i++){
441
- key = sourceSymbolKeys[i];
442
- if (excluded.indexOf(key) >= 0) continue;
443
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
444
- target[key] = source[key];
445
- }
446
- }
447
- return target;
448
- }
449
- function _object_without_properties_loose$8(source, excluded) {
450
- if (source == null) return {};
451
- var target = {};
452
- var sourceKeys = Object.keys(source);
453
- var key, i;
454
- for(i = 0; i < sourceKeys.length; i++){
455
- key = sourceKeys[i];
456
- if (excluded.indexOf(key) >= 0) continue;
457
- target[key] = source[key];
458
- }
459
- return target;
460
- }
461
- function DefaultInputComponent(_param) {
462
- var helperMessage = _param.helperMessage, header = _param.header, props = _object_without_properties$8(_param, [
463
- "helperMessage",
464
- "header"
465
- ]);
466
- return /*#__PURE__*/ jsxs("div", {
467
- children: [
468
- /*#__PURE__*/ jsxs("label", {
469
- children: [
470
- header && /*#__PURE__*/ jsx("p", {
471
- children: header
472
- }),
473
- /*#__PURE__*/ jsx("input", _object_spread$l({}, props))
474
- ]
475
- }),
476
- helperMessage
477
- ]
478
- });
479
- }
480
-
481
- function _define_property$l(obj, key, value) {
482
- if (key in obj) {
483
- Object.defineProperty(obj, key, {
484
- value: value,
485
- enumerable: true,
486
- configurable: true,
487
- writable: true
488
- });
489
- } else {
490
- obj[key] = value;
491
- }
492
- return obj;
493
- }
494
- function _object_spread$k(target) {
495
- for(var i = 1; i < arguments.length; i++){
496
- var source = arguments[i] != null ? arguments[i] : {};
497
- var ownKeys = Object.keys(source);
498
- if (typeof Object.getOwnPropertySymbols === "function") {
499
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
500
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
501
- }));
502
- }
503
- ownKeys.forEach(function(key) {
504
- _define_property$l(target, key, source[key]);
505
- });
506
- }
507
- return target;
508
- }
509
- function _object_without_properties$7(source, excluded) {
510
- if (source == null) return {};
511
- var target = _object_without_properties_loose$7(source, excluded);
512
- var key, i;
513
- if (Object.getOwnPropertySymbols) {
514
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
515
- for(i = 0; i < sourceSymbolKeys.length; i++){
516
- key = sourceSymbolKeys[i];
517
- if (excluded.indexOf(key) >= 0) continue;
518
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
519
- target[key] = source[key];
520
- }
521
- }
522
- return target;
523
- }
524
- function _object_without_properties_loose$7(source, excluded) {
525
- if (source == null) return {};
526
- var target = {};
527
- var sourceKeys = Object.keys(source);
528
- var key, i;
529
- for(i = 0; i < sourceKeys.length; i++){
530
- key = sourceKeys[i];
531
- if (excluded.indexOf(key) >= 0) continue;
532
- target[key] = source[key];
533
- }
534
- return target;
535
- }
536
- function DefaultLinkComponent(_param) {
537
- _param.href; var props = _object_without_properties$7(_param, [
538
- "href"
539
- ]);
540
- // eslint-disable-next-line jsx-a11y/anchor-has-content
541
- return /*#__PURE__*/ jsx("a", _object_spread$k({}, props));
542
- }
543
-
544
- function DefaultMessageComponent(param) {
545
- var children = param.children;
546
- return /*#__PURE__*/ jsx(Fragment, {
547
- children: children
548
- });
549
- }
550
-
551
- function DefaultMessageFormatComponent(param) {
552
- var text = param.text;
553
- return /*#__PURE__*/ jsx("span", {
554
- children: text
555
- });
556
- }
557
-
558
- function _define_property$k(obj, key, value) {
559
- if (key in obj) {
560
- Object.defineProperty(obj, key, {
561
- value: value,
562
- enumerable: true,
563
- configurable: true,
564
- writable: true
565
- });
566
- } else {
567
- obj[key] = value;
568
- }
569
- return obj;
570
- }
571
- function _object_spread$j(target) {
572
- for(var i = 1; i < arguments.length; i++){
573
- var source = arguments[i] != null ? arguments[i] : {};
574
- var ownKeys = Object.keys(source);
575
- if (typeof Object.getOwnPropertySymbols === "function") {
576
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
577
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
578
- }));
579
- }
580
- ownKeys.forEach(function(key) {
581
- _define_property$k(target, key, source[key]);
582
- });
583
- }
584
- return target;
585
- }
586
- function FormattedMessage(param) {
587
- var message = param.message;
588
- var _useKratosContext = useKratosContext(), MessageFormat = _useKratosContext.components.MessageFormat;
589
- if (!message) return null;
590
- return /*#__PURE__*/ jsx(MessageFormat, _object_spread$j({}, message));
591
- }
592
-
593
- function DefaultTextComponent(param) {
594
- var label = param.label, codes = param.codes;
595
- return /*#__PURE__*/ jsxs("div", {
596
- children: [
597
- /*#__PURE__*/ jsx("span", {
598
- children: label
599
- }),
600
- codes === null || codes === void 0 ? void 0 : codes.map(function(code) {
601
- return /*#__PURE__*/ jsx("pre", {
602
- children: /*#__PURE__*/ jsx("code", {
603
- children: /*#__PURE__*/ jsx(FormattedMessage, {
604
- message: code
605
- })
606
- })
607
- }, code.text);
608
- })
609
- ]
610
- });
611
- }
612
-
613
- function _array_like_to_array$7(arr, len) {
614
- if (len == null || len > arr.length) len = arr.length;
615
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
616
- return arr2;
617
- }
618
- function _array_without_holes$1(arr) {
619
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
620
- }
621
- function _define_property$j(obj, key, value) {
622
- if (key in obj) {
623
- Object.defineProperty(obj, key, {
624
- value: value,
625
- enumerable: true,
626
- configurable: true,
627
- writable: true
628
- });
629
- } else {
630
- obj[key] = value;
631
- }
632
- return obj;
633
- }
634
- function _iterable_to_array$1(iter) {
635
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
636
- }
637
- function _non_iterable_spread$1() {
638
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
639
- }
640
- function _object_spread$i(target) {
641
- for(var i = 1; i < arguments.length; i++){
642
- var source = arguments[i] != null ? arguments[i] : {};
643
- var ownKeys = Object.keys(source);
644
- if (typeof Object.getOwnPropertySymbols === "function") {
645
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
646
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
647
- }));
648
- }
649
- ownKeys.forEach(function(key) {
650
- _define_property$j(target, key, source[key]);
651
- });
652
- }
653
- return target;
654
- }
655
- function ownKeys$d(object, enumerableOnly) {
656
- var keys = Object.keys(object);
657
- if (Object.getOwnPropertySymbols) {
658
- var symbols = Object.getOwnPropertySymbols(object);
659
- keys.push.apply(keys, symbols);
660
- }
661
- return keys;
662
- }
663
- function _object_spread_props$d(target, source) {
664
- source = source != null ? source : {};
665
- if (Object.getOwnPropertyDescriptors) {
666
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
667
- } else {
668
- ownKeys$d(Object(source)).forEach(function(key) {
669
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
670
- });
671
- }
672
- return target;
673
- }
674
- function _object_without_properties$6(source, excluded) {
675
- if (source == null) return {};
676
- var target = _object_without_properties_loose$6(source, excluded);
677
- var key, i;
678
- if (Object.getOwnPropertySymbols) {
679
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
680
- for(i = 0; i < sourceSymbolKeys.length; i++){
681
- key = sourceSymbolKeys[i];
682
- if (excluded.indexOf(key) >= 0) continue;
683
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
684
- target[key] = source[key];
685
- }
686
- }
687
- return target;
688
- }
689
- function _object_without_properties_loose$6(source, excluded) {
690
- if (source == null) return {};
691
- var target = {};
692
- var sourceKeys = Object.keys(source);
693
- var key, i;
694
- for(i = 0; i < sourceKeys.length; i++){
695
- key = sourceKeys[i];
696
- if (excluded.indexOf(key) >= 0) continue;
697
- target[key] = source[key];
698
- }
699
- return target;
700
- }
701
- function _to_consumable_array$1(arr) {
702
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$1();
703
- }
704
- function _unsupported_iterable_to_array$7(o, minLen) {
705
- if (!o) return;
706
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
707
- var n = Object.prototype.toString.call(o).slice(8, -1);
708
- if (n === "Object" && o.constructor) n = o.constructor.name;
709
- if (n === "Map" || n === "Set") return Array.from(n);
710
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
711
- }
712
- function NodeMessage(_param) {
713
- var message = _param.message, props = _object_without_properties$6(_param, [
714
- "message"
715
- ]);
716
- var _useKratosContext = useKratosContext(), Message = _useKratosContext.components.Message;
717
- return /*#__PURE__*/ jsx(Message, _object_spread_props$d(_object_spread$i({
718
- message: message,
719
- severity: message.type
720
- }, props), {
721
- children: /*#__PURE__*/ jsx(FormattedMessage, {
722
- message: message
723
- })
724
- }));
725
- }
726
- function NodeMessages(param) {
727
- var nodes = param.nodes, uiMessages = param.uiMessages;
728
- var _nodes_reduce;
729
- var $groupMessages = (_nodes_reduce = nodes === null || nodes === void 0 ? void 0 : nodes.reduce(function(groups, param) {
730
- var messages = param.messages;
731
- var _groups;
732
- (_groups = groups).push.apply(_groups, _to_consumable_array$1(messages.map(function(message, key) {
733
- return /*#__PURE__*/ jsx(NodeMessage, {
734
- message: message
735
- }, "node-group-message-".concat(message.id, "-").concat(key));
736
- }).filter(Boolean)));
737
- return groups;
738
- }, [])) !== null && _nodes_reduce !== void 0 ? _nodes_reduce : [];
739
- var _uiMessages_map;
740
- var $messages = (_uiMessages_map = uiMessages === null || uiMessages === void 0 ? void 0 : uiMessages.map(function(message, key) {
741
- return /*#__PURE__*/ jsx(NodeMessage, {
742
- message: message
743
- }, "ui-message-".concat(message.id, "-").concat(key));
744
- })) !== null && _uiMessages_map !== void 0 ? _uiMessages_map : [];
745
- var $allMessages = _to_consumable_array$1($groupMessages).concat(_to_consumable_array$1($messages));
746
- if ($allMessages.length <= 0) return null;
747
- return /*#__PURE__*/ jsx("div", {
748
- children: $allMessages
749
- });
750
- }
751
-
752
- function _define_property$i(obj, key, value) {
753
- if (key in obj) {
754
- Object.defineProperty(obj, key, {
755
- value: value,
756
- enumerable: true,
757
- configurable: true,
758
- writable: true
759
- });
760
- } else {
761
- obj[key] = value;
762
- }
763
- return obj;
764
- }
765
- function _object_spread$h(target) {
766
- for(var i = 1; i < arguments.length; i++){
767
- var source = arguments[i] != null ? arguments[i] : {};
768
- var ownKeys = Object.keys(source);
769
- if (typeof Object.getOwnPropertySymbols === "function") {
770
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
771
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
772
- }));
773
- }
774
- ownKeys.forEach(function(key) {
775
- _define_property$i(target, key, source[key]);
776
- });
777
- }
778
- return target;
779
- }
780
- function DefaultUiMessagesComponent(props) {
781
- return /*#__PURE__*/ jsx(NodeMessages, _object_spread$h({}, props));
782
- }
783
-
784
- var defaultComponents = {
785
- Image: DefaultImageComponent,
786
- Text: DefaultTextComponent,
787
- Link: DefaultLinkComponent,
788
- Input: DefaultInputComponent,
789
- Message: DefaultMessageComponent,
790
- Button: DefaultButtonComponent,
791
- Checkbox: DefaultCheckboxComponent,
792
- UiMessages: DefaultUiMessagesComponent,
793
- MessageFormat: DefaultMessageFormatComponent,
794
- OidcSectionWrapper: "div",
795
- PasswordlessSectionWrapper: "div",
796
- AuthCodeSectionWrapper: "div",
797
- LoginSectionWrapper: "div",
798
- RegistrationSectionWrapper: "div",
799
- LinkSectionWrapper: "div",
800
- ProfileSettingsSectionWrapper: "div",
801
- PasswordSettingsSectionWrapper: "div",
802
- WebAuthnSettingsSectionWrapper: "div",
803
- LookupSecretSettingsSectionWrapper: "div",
804
- OidcSettingsSectionWrapper: "div",
805
- TotpSettingsSectionWrapper: "div",
806
- IdentifierFirstLoginSectionWrapper: "div",
807
- ProfileLoginSectionWrapper: "div",
808
- ProfileRegistrationSectionWrapper: "div"
809
- };
810
-
811
- function _define_property$h(obj, key, value) {
812
- if (key in obj) {
813
- Object.defineProperty(obj, key, {
814
- value: value,
815
- enumerable: true,
816
- configurable: true,
817
- writable: true
818
- });
819
- } else {
820
- obj[key] = value;
821
- }
822
- return obj;
823
- }
824
- function _object_spread$g(target) {
825
- for(var i = 1; i < arguments.length; i++){
826
- var source = arguments[i] != null ? arguments[i] : {};
827
- var ownKeys = Object.keys(source);
828
- if (typeof Object.getOwnPropertySymbols === "function") {
829
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
830
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
831
- }));
832
- }
833
- ownKeys.forEach(function(key) {
834
- _define_property$h(target, key, source[key]);
835
- });
836
- }
837
- return target;
838
- }
839
- function KratosContextProvider(param) {
840
- var _param_components = param.components, components = _param_components === void 0 ? {} : _param_components, useHandleFlowError = param.useHandleFlowError, excludeScripts = param.excludeScripts, children = param.children;
841
- var _useContext = useContext(kratosContext), baseComponents = _useContext.components, baseUseHandleFlowError = _useContext.useHandleFlowError, baseExcludeScripts = _useContext.excludeScripts;
842
- var value = useMemo(function() {
843
- return {
844
- components: _object_spread$g({}, baseComponents !== null && baseComponents !== void 0 ? baseComponents : defaultComponents, components),
845
- useHandleFlowError: useHandleFlowError !== null && useHandleFlowError !== void 0 ? useHandleFlowError : baseUseHandleFlowError,
846
- excludeScripts: excludeScripts !== null && excludeScripts !== void 0 ? excludeScripts : baseExcludeScripts
847
- };
848
- }, [
849
- baseComponents,
850
- components,
851
- useHandleFlowError,
852
- baseUseHandleFlowError,
853
- excludeScripts,
854
- baseExcludeScripts
855
- ]);
856
- return /*#__PURE__*/ jsx(kratosContext.Provider, {
857
- value: value,
858
- children: children
859
- });
860
- }
861
-
862
- var returnToParameterName = "return_to";
863
- var aalParameterName = "aal";
864
- var flowIdParameterName = "flow";
865
- var refreshParameterName = "refresh";
866
-
867
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
868
- var ErrorId;
869
- (function(ErrorId) {
870
- ErrorId["ErrIDNeedsPrivilegedSession"] = "session_refresh_required";
871
- ErrorId["ErrIDSelfServiceFlowExpired"] = "self_service_flow_expired";
872
- ErrorId["ErrIDSelfServiceFlowDisabled"] = "self_service_flow_disabled";
873
- ErrorId["ErrIDSelfServiceBrowserLocationChangeRequiredError"] = "browser_location_change_required";
874
- ErrorId["ErrIDSelfServiceFlowReplaced"] = "self_service_flow_replaced";
875
- ErrorId["ErrIDAlreadyLoggedIn"] = "session_already_available";
876
- ErrorId["ErrIDAddressNotVerified"] = "session_verified_address_required";
877
- ErrorId["ErrIDSessionHasAALAlready"] = "session_aal_already_fulfilled";
878
- ErrorId["ErrIDSessionRequiredForHigherAAL"] = "session_aal1_required";
879
- ErrorId["ErrIDHigherAALRequired"] = "session_aal2_required";
880
- ErrorId["ErrNoActiveSession"] = "session_inactive";
881
- ErrorId["ErrIDRedirectURLNotAllowed"] = "self_service_flow_return_to_forbidden";
882
- ErrorId["ErrIDInitiatedBySomeoneElse"] = "security_identity_mismatch";
883
- ErrorId["ErrIDCSRF"] = "security_csrf_violation";
884
- })(ErrorId || (ErrorId = {}));
885
-
886
- function _class_call_check(instance, Constructor) {
887
- if (!(instance instanceof Constructor)) {
888
- throw new TypeError("Cannot call a class as a function");
889
- }
890
- }
891
- function _defineProperties(target, props) {
892
- for(var i = 0; i < props.length; i++){
893
- var descriptor = props[i];
894
- descriptor.enumerable = descriptor.enumerable || false;
895
- descriptor.configurable = true;
896
- if ("value" in descriptor) descriptor.writable = true;
897
- Object.defineProperty(target, descriptor.key, descriptor);
898
- }
899
- }
900
- function _create_class(Constructor, protoProps, staticProps) {
901
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
902
- return Constructor;
903
- }
904
- function _define_property$g(obj, key, value) {
905
- if (key in obj) {
906
- Object.defineProperty(obj, key, {
907
- value: value,
908
- enumerable: true,
909
- configurable: true,
910
- writable: true
911
- });
912
- } else {
913
- obj[key] = value;
914
- }
915
- return obj;
916
- }
917
- var BaseSessionManager = /*#__PURE__*/ function() {
918
- function BaseSessionManager(authUrl, loginRoute) {
919
- var _this = this;
920
- _class_call_check(this, BaseSessionManager);
921
- _define_property$g(this, "authUrl", void 0);
922
- _define_property$g(this, "loginRoute", void 0);
923
- _define_property$g(this, "session$", new ReplaySubject(1));
924
- _define_property$g(this, "isLoggedIn", this.session$.pipe(map(function(session) {
925
- return !!(session === null || session === void 0 ? void 0 : session.active);
926
- }), shareReplay(1)));
927
- _define_property$g(this, "identity$", this.session$.pipe(map(function(session) {
928
- return session === null || session === void 0 ? void 0 : session.identity;
929
- }), shareReplay(1)));
930
- _define_property$g(this, "userId$", this.identity$.pipe(map(function(identity) {
931
- return identity === null || identity === void 0 ? void 0 : identity.id;
932
- }), shareReplay(1)));
933
- _define_property$g(this, "checkIfLoggedIn", function() {
934
- var fetchSubject = new Subject();
935
- fetchSubject.pipe(switchMap(function() {
936
- return from(axios.get("".concat(_this.authUrl, "/sessions/whoami"), {
937
- withCredentials: true
938
- })).pipe(map(function(response) {
939
- var returnTo = new URLSearchParams(window.location.search).get(returnToParameterName);
940
- if (returnTo) {
941
- window.location.href = returnTo;
942
- }
943
- return response.data;
944
- }), catchError(function(err) {
945
- switch(err.response.status){
946
- case 403:
947
- case 422:
948
- var _err_response_data_error;
949
- if (((_err_response_data_error = err.response.data.error) === null || _err_response_data_error === void 0 ? void 0 : _err_response_data_error.id) === ErrorId.ErrIDHigherAALRequired) {
950
- var searchParams = new URLSearchParams(window.location.search);
951
- if (searchParams.get(aalParameterName)) {
952
- break;
953
- }
954
- var redirectUrl = new URL(_this.loginRoute, window.location.href);
955
- if (window.location.pathname === _this.loginRoute) {
956
- var searchParams1 = new URLSearchParams(window.location.search);
957
- searchParams1.append(aalParameterName, AuthenticatorAssuranceLevel.Aal2);
958
- redirectUrl.search = searchParams1.toString();
959
- } else {
960
- var _obj;
961
- redirectUrl.search = new URLSearchParams((_obj = {}, _define_property$g(_obj, aalParameterName, AuthenticatorAssuranceLevel.Aal2), _define_property$g(_obj, returnToParameterName, "".concat(window.location.pathname).concat(window.location.search)), _obj)).toString();
962
- }
963
- window.location.href = redirectUrl.toString();
964
- }
965
- break;
966
- }
967
- return of(undefined);
968
- }));
969
- })).subscribe({
970
- next: function(session) {
971
- return _this.session$.next(session);
972
- }
973
- });
974
- return function() {
975
- return fetchSubject.next(undefined);
976
- };
977
- }());
978
- this.authUrl = authUrl;
979
- this.loginRoute = loginRoute;
980
- this.checkIfLoggedIn();
981
- }
982
- _create_class(BaseSessionManager, [
983
- {
984
- key: "setSession",
985
- value: function setSession(session) {
986
- this.session$.next(session);
987
- if (!session) this.checkIfLoggedIn();
988
- }
989
- }
990
- ]);
991
- return BaseSessionManager;
992
- }();
993
-
994
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
995
- var ErrorValidation;
996
- (function(ErrorValidation) {
997
- ErrorValidation[ErrorValidation["ErrorValidation"] = 4000000] = "ErrorValidation";
998
- ErrorValidation[ErrorValidation["ErrorValidationGeneric"] = 4000001] = "ErrorValidationGeneric";
999
- ErrorValidation[ErrorValidation["ErrorValidationRequired"] = 4000002] = "ErrorValidationRequired";
1000
- ErrorValidation[ErrorValidation["ErrorValidationMinLength"] = 4000003] = "ErrorValidationMinLength";
1001
- ErrorValidation[ErrorValidation["ErrorValidationInvalidFormat"] = 4000004] = "ErrorValidationInvalidFormat";
1002
- ErrorValidation[ErrorValidation["ErrorValidationPasswordPolicyViolation"] = 4000005] = "ErrorValidationPasswordPolicyViolation";
1003
- ErrorValidation[ErrorValidation["ErrorValidationInvalidCredentials"] = 4000006] = "ErrorValidationInvalidCredentials";
1004
- ErrorValidation[ErrorValidation["ErrorValidationDuplicateCredentials"] = 4000007] = "ErrorValidationDuplicateCredentials";
1005
- ErrorValidation[ErrorValidation["ErrorValidationTOTPVerifierWrong"] = 4000008] = "ErrorValidationTOTPVerifierWrong";
1006
- ErrorValidation[ErrorValidation["ErrorValidationIdentifierMissing"] = 4000009] = "ErrorValidationIdentifierMissing";
1007
- ErrorValidation[ErrorValidation["ErrorValidationAddressNotVerified"] = 4000010] = "ErrorValidationAddressNotVerified";
1008
- ErrorValidation[ErrorValidation["ErrorValidationNoTOTPDevice"] = 4000011] = "ErrorValidationNoTOTPDevice";
1009
- ErrorValidation[ErrorValidation["ErrorValidationLookupAlreadyUsed"] = 4000012] = "ErrorValidationLookupAlreadyUsed";
1010
- ErrorValidation[ErrorValidation["ErrorValidationNoWebAuthnDevice"] = 4000013] = "ErrorValidationNoWebAuthnDevice";
1011
- ErrorValidation[ErrorValidation["ErrorValidationNoLookup"] = 4000014] = "ErrorValidationNoLookup";
1012
- ErrorValidation[ErrorValidation["ErrorValidationSuchNoWebAuthnUser"] = 4000015] = "ErrorValidationSuchNoWebAuthnUser";
1013
- ErrorValidation[ErrorValidation["ErrorValidationLookupInvalid"] = 4000016] = "ErrorValidationLookupInvalid";
1014
- ErrorValidation[ErrorValidation["ErrorValidationMaxLength"] = 4000017] = "ErrorValidationMaxLength";
1015
- ErrorValidation[ErrorValidation["ErrorValidationMinimum"] = 4000018] = "ErrorValidationMinimum";
1016
- ErrorValidation[ErrorValidation["ErrorValidationExclusiveMinimum"] = 4000019] = "ErrorValidationExclusiveMinimum";
1017
- ErrorValidation[ErrorValidation["ErrorValidationMaximum"] = 4000020] = "ErrorValidationMaximum";
1018
- ErrorValidation[ErrorValidation["ErrorValidationExclusiveMaximum"] = 4000021] = "ErrorValidationExclusiveMaximum";
1019
- ErrorValidation[ErrorValidation["ErrorValidationMultipleOf"] = 4000022] = "ErrorValidationMultipleOf";
1020
- ErrorValidation[ErrorValidation["ErrorValidationMaxItems"] = 4000023] = "ErrorValidationMaxItems";
1021
- ErrorValidation[ErrorValidation["ErrorValidationMinItems"] = 4000024] = "ErrorValidationMinItems";
1022
- ErrorValidation[ErrorValidation["ErrorValidationUniqueItems"] = 4000025] = "ErrorValidationUniqueItems";
1023
- ErrorValidation[ErrorValidation["ErrorValidationWrongType"] = 4000026] = "ErrorValidationWrongType";
1024
- ErrorValidation[ErrorValidation["ErrorValidationDuplicateCredentialsOnOIDCLink"] = 4000027] = "ErrorValidationDuplicateCredentialsOnOIDCLink";
1025
- })(ErrorValidation || (ErrorValidation = {}));
1026
-
1027
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1028
- var ErrorValidationLogin;
1029
- (function(ErrorValidationLogin) {
1030
- ErrorValidationLogin[ErrorValidationLogin["ErrorValidationLogin"] = 4010000] = "ErrorValidationLogin";
1031
- ErrorValidationLogin[ErrorValidationLogin["ErrorValidationLoginFlowExpired"] = 4010001] = "ErrorValidationLoginFlowExpired";
1032
- ErrorValidationLogin[ErrorValidationLogin["ErrorValidationLoginNoStrategyFound"] = 4010002] = "ErrorValidationLoginNoStrategyFound";
1033
- ErrorValidationLogin[ErrorValidationLogin["ErrorValidationRegistrationNoStrategyFound"] = 4010003] = "ErrorValidationRegistrationNoStrategyFound";
1034
- ErrorValidationLogin[ErrorValidationLogin["ErrorValidationSettingsNoStrategyFound"] = 4010004] = "ErrorValidationSettingsNoStrategyFound";
1035
- ErrorValidationLogin[ErrorValidationLogin["ErrorValidationRecoveryNoStrategyFound"] = 4010005] = "ErrorValidationRecoveryNoStrategyFound";
1036
- ErrorValidationLogin[ErrorValidationLogin["ErrorValidationVerificationNoStrategyFound"] = 4010006] = "ErrorValidationVerificationNoStrategyFound";
1037
- })(ErrorValidationLogin || (ErrorValidationLogin = {}));
1038
-
1039
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1040
- var ErrorValidationRecovery;
1041
- (function(ErrorValidationRecovery) {
1042
- ErrorValidationRecovery[ErrorValidationRecovery["ErrorValidationRecovery"] = 4060000] = "ErrorValidationRecovery";
1043
- ErrorValidationRecovery[ErrorValidationRecovery["ErrorValidationRecoveryRetrySuccess"] = 4060001] = "ErrorValidationRecoveryRetrySuccess";
1044
- ErrorValidationRecovery[ErrorValidationRecovery["ErrorValidationRecoveryStateFailure"] = 4060002] = "ErrorValidationRecoveryStateFailure";
1045
- ErrorValidationRecovery[ErrorValidationRecovery["ErrorValidationRecoveryMissingRecoveryToken"] = 4060003] = "ErrorValidationRecoveryMissingRecoveryToken";
1046
- ErrorValidationRecovery[ErrorValidationRecovery["ErrorValidationRecoveryTokenInvalidOrAlreadyUsed"] = 4060004] = "ErrorValidationRecoveryTokenInvalidOrAlreadyUsed";
1047
- ErrorValidationRecovery[ErrorValidationRecovery["ErrorValidationRecoveryFlowExpired"] = 4060005] = "ErrorValidationRecoveryFlowExpired";
1048
- ErrorValidationRecovery[ErrorValidationRecovery["ErrorValidationRecoveryCodeInvalidOrAlreadyUsed"] = 4060006] = "ErrorValidationRecoveryCodeInvalidOrAlreadyUsed";
1049
- })(ErrorValidationRecovery || (ErrorValidationRecovery = {}));
1050
-
1051
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1052
- var ErrorValidationRegistration;
1053
- (function(ErrorValidationRegistration) {
1054
- ErrorValidationRegistration[ErrorValidationRegistration["ErrorValidationRegistration"] = 4040000] = "ErrorValidationRegistration";
1055
- ErrorValidationRegistration[ErrorValidationRegistration["ErrorValidationRegistrationFlowExpired"] = 4040001] = "ErrorValidationRegistrationFlowExpired";
1056
- })(ErrorValidationRegistration || (ErrorValidationRegistration = {}));
1057
-
1058
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1059
- var ErrorValidationSettings;
1060
- (function(ErrorValidationSettings) {
1061
- ErrorValidationSettings[ErrorValidationSettings["ErrorValidationSettings"] = 4050000] = "ErrorValidationSettings";
1062
- ErrorValidationSettings[ErrorValidationSettings["ErrorValidationSettingsFlowExpired"] = 4050001] = "ErrorValidationSettingsFlowExpired";
1063
- })(ErrorValidationSettings || (ErrorValidationSettings = {}));
1064
-
1065
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1066
- var ErrorValidationVerification;
1067
- (function(ErrorValidationVerification) {
1068
- ErrorValidationVerification[ErrorValidationVerification["ErrorValidationVerification"] = 4070000] = "ErrorValidationVerification";
1069
- ErrorValidationVerification[ErrorValidationVerification["ErrorValidationVerificationTokenInvalidOrAlreadyUsed"] = 4070001] = "ErrorValidationVerificationTokenInvalidOrAlreadyUsed";
1070
- ErrorValidationVerification[ErrorValidationVerification["ErrorValidationVerificationRetrySuccess"] = 4070002] = "ErrorValidationVerificationRetrySuccess";
1071
- ErrorValidationVerification[ErrorValidationVerification["ErrorValidationVerificationStateFailure"] = 4070003] = "ErrorValidationVerificationStateFailure";
1072
- ErrorValidationVerification[ErrorValidationVerification["ErrorValidationVerificationMissingVerificationToken"] = 4070004] = "ErrorValidationVerificationMissingVerificationToken";
1073
- ErrorValidationVerification[ErrorValidationVerification["ErrorValidationVerificationFlowExpired"] = 4070005] = "ErrorValidationVerificationFlowExpired";
1074
- ErrorValidationVerification[ErrorValidationVerification["ErrorValidationVerificationCodeInvalidOrAlreadyUsed"] = 4070006] = "ErrorValidationVerificationCodeInvalidOrAlreadyUsed";
1075
- })(ErrorValidationVerification || (ErrorValidationVerification = {}));
1076
-
1077
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1078
- var InfoNodeLabel;
1079
- (function(InfoNodeLabel) {
1080
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabel"] = 1070000] = "InfoNodeLabel";
1081
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelInputPassword"] = 1070001] = "InfoNodeLabelInputPassword";
1082
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelGenerated"] = 1070002] = "InfoNodeLabelGenerated";
1083
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelSave"] = 1070003] = "InfoNodeLabelSave";
1084
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelID"] = 1070004] = "InfoNodeLabelID";
1085
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelSubmit"] = 1070005] = "InfoNodeLabelSubmit";
1086
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelVerifyOTP"] = 1070006] = "InfoNodeLabelVerifyOTP";
1087
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelEmail"] = 1070007] = "InfoNodeLabelEmail";
1088
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelResendOTP"] = 1070008] = "InfoNodeLabelResendOTP";
1089
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelContinue"] = 1070009] = "InfoNodeLabelContinue";
1090
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelRecoveryCode"] = 1070010] = "InfoNodeLabelRecoveryCode";
1091
- InfoNodeLabel[InfoNodeLabel["InfoNodeLabelVerificationCode"] = 1070011] = "InfoNodeLabelVerificationCode";
1092
- })(InfoNodeLabel || (InfoNodeLabel = {}));
1093
-
1094
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1095
- var InfoSelfServiceLogin;
1096
- (function(InfoSelfServiceLogin) {
1097
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginRoot"] = 1010000] = "InfoSelfServiceLoginRoot";
1098
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLogin"] = 1010001] = "InfoSelfServiceLogin";
1099
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginWith"] = 1010002] = "InfoSelfServiceLoginWith";
1100
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginReAuth"] = 1010003] = "InfoSelfServiceLoginReAuth";
1101
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginMFA"] = 1010004] = "InfoSelfServiceLoginMFA";
1102
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginVerify"] = 1010005] = "InfoSelfServiceLoginVerify";
1103
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginTOTPLabel"] = 1010006] = "InfoSelfServiceLoginTOTPLabel";
1104
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoLoginLookupLabel"] = 1010007] = "InfoLoginLookupLabel";
1105
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginWebAuthn"] = 1010008] = "InfoSelfServiceLoginWebAuthn";
1106
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoLoginTOTP"] = 1010009] = "InfoLoginTOTP";
1107
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoLoginLookup"] = 1010010] = "InfoLoginLookup";
1108
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginContinueWebAuthn"] = 1010011] = "InfoSelfServiceLoginContinueWebAuthn";
1109
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginWebAuthnPasswordless"] = 1010012] = "InfoSelfServiceLoginWebAuthnPasswordless";
1110
- InfoSelfServiceLogin[InfoSelfServiceLogin["InfoSelfServiceLoginContinue"] = 1010013] = "InfoSelfServiceLoginContinue";
1111
- })(InfoSelfServiceLogin || (InfoSelfServiceLogin = {}));
1112
-
1113
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1114
- var InfoSelfServiceRecovery;
1115
- (function(InfoSelfServiceRecovery) {
1116
- InfoSelfServiceRecovery[InfoSelfServiceRecovery["InfoSelfServiceRecovery"] = 1060000] = "InfoSelfServiceRecovery";
1117
- InfoSelfServiceRecovery[InfoSelfServiceRecovery["InfoSelfServiceRecoverySuccessful"] = 1060001] = "InfoSelfServiceRecoverySuccessful";
1118
- InfoSelfServiceRecovery[InfoSelfServiceRecovery["InfoSelfServiceRecoveryEmailSent"] = 1060002] = "InfoSelfServiceRecoveryEmailSent";
1119
- InfoSelfServiceRecovery[InfoSelfServiceRecovery["InfoSelfServiceRecoveryEmailWithCodeSent"] = 1060003] = "InfoSelfServiceRecoveryEmailWithCodeSent";
1120
- })(InfoSelfServiceRecovery || (InfoSelfServiceRecovery = {}));
1121
-
1122
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1123
- var InfoSelfServiceRegistration;
1124
- (function(InfoSelfServiceRegistration) {
1125
- InfoSelfServiceRegistration[InfoSelfServiceRegistration["InfoSelfServiceRegistrationRoot"] = 1040000] = "InfoSelfServiceRegistrationRoot";
1126
- InfoSelfServiceRegistration[InfoSelfServiceRegistration["InfoSelfServiceRegistration"] = 1040001] = "InfoSelfServiceRegistration";
1127
- InfoSelfServiceRegistration[InfoSelfServiceRegistration["InfoSelfServiceRegistrationWith"] = 1040002] = "InfoSelfServiceRegistrationWith";
1128
- InfoSelfServiceRegistration[InfoSelfServiceRegistration["InfoSelfServiceRegistrationContinue"] = 1040003] = "InfoSelfServiceRegistrationContinue";
1129
- InfoSelfServiceRegistration[InfoSelfServiceRegistration["InfoSelfServiceRegistrationRegisterWebAuthn"] = 1040004] = "InfoSelfServiceRegistrationRegisterWebAuthn";
1130
- })(InfoSelfServiceRegistration || (InfoSelfServiceRegistration = {}));
1131
-
1132
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1133
- var InfoSelfServiceSettings;
1134
- (function(InfoSelfServiceSettings) {
1135
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettings"] = 1050000] = "InfoSelfServiceSettings";
1136
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsUpdateSuccess"] = 1050001] = "InfoSelfServiceSettingsUpdateSuccess";
1137
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsUpdateLinkOidc"] = 1050002] = "InfoSelfServiceSettingsUpdateLinkOidc";
1138
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsUpdateUnlinkOidc"] = 1050003] = "InfoSelfServiceSettingsUpdateUnlinkOidc";
1139
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsUpdateUnlinkTOTP"] = 1050004] = "InfoSelfServiceSettingsUpdateUnlinkTOTP";
1140
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsTOTPQRCode"] = 1050005] = "InfoSelfServiceSettingsTOTPQRCode";
1141
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsTOTPSecret"] = 1050006] = "InfoSelfServiceSettingsTOTPSecret";
1142
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsRevealLookup"] = 1050007] = "InfoSelfServiceSettingsRevealLookup";
1143
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsRegenerateLookup"] = 1050008] = "InfoSelfServiceSettingsRegenerateLookup";
1144
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsLookupSecret"] = 1050009] = "InfoSelfServiceSettingsLookupSecret";
1145
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsLookupSecretLabel"] = 1050010] = "InfoSelfServiceSettingsLookupSecretLabel";
1146
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsLookupConfirm"] = 1050011] = "InfoSelfServiceSettingsLookupConfirm";
1147
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsRegisterWebAuthn"] = 1050012] = "InfoSelfServiceSettingsRegisterWebAuthn";
1148
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsRegisterWebAuthnDisplayName"] = 1050013] = "InfoSelfServiceSettingsRegisterWebAuthnDisplayName";
1149
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsLookupSecretUsed"] = 1050014] = "InfoSelfServiceSettingsLookupSecretUsed";
1150
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsLookupSecretList"] = 1050015] = "InfoSelfServiceSettingsLookupSecretList";
1151
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsDisableLookup"] = 1050016] = "InfoSelfServiceSettingsDisableLookup";
1152
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsTOTPSecretLabel"] = 1050017] = "InfoSelfServiceSettingsTOTPSecretLabel";
1153
- InfoSelfServiceSettings[InfoSelfServiceSettings["InfoSelfServiceSettingsRemoveWebAuthn"] = 1050018] = "InfoSelfServiceSettingsRemoveWebAuthn";
1154
- })(InfoSelfServiceSettings || (InfoSelfServiceSettings = {}));
1155
-
1156
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1157
- var InfoSelfServiceVerification;
1158
- (function(InfoSelfServiceVerification) {
1159
- InfoSelfServiceVerification[InfoSelfServiceVerification["InfoSelfServiceVerification"] = 1080000] = "InfoSelfServiceVerification";
1160
- InfoSelfServiceVerification[InfoSelfServiceVerification["InfoSelfServiceVerificationEmailSent"] = 1080001] = "InfoSelfServiceVerificationEmailSent";
1161
- InfoSelfServiceVerification[InfoSelfServiceVerification["InfoSelfServiceVerificationSuccessful"] = 1080002] = "InfoSelfServiceVerificationSuccessful";
1162
- InfoSelfServiceVerification[InfoSelfServiceVerification["InfoSelfServiceVerificationEmailWithCodeSent"] = 1080003] = "InfoSelfServiceVerificationEmailWithCodeSent";
1163
- })(InfoSelfServiceVerification || (InfoSelfServiceVerification = {}));
1164
-
1165
- // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
1166
- var ErrorSystem;
1167
- (function(ErrorSystem) {
1168
- ErrorSystem[ErrorSystem["ErrorSystem"] = 5000000] = "ErrorSystem";
1169
- ErrorSystem[ErrorSystem["ErrorSystemGeneric"] = 5000001] = "ErrorSystemGeneric";
1170
- })(ErrorSystem || (ErrorSystem = {}));
1171
- var InfoSelfServiceLogout;
1172
- (function(InfoSelfServiceLogout) {
1173
- InfoSelfServiceLogout[InfoSelfServiceLogout["InfoSelfServiceLogout"] = 1020000] = "InfoSelfServiceLogout";
1174
- })(InfoSelfServiceLogout || (InfoSelfServiceLogout = {}));
1175
- var InfoSelfServiceMFA;
1176
- (function(InfoSelfServiceMFA) {
1177
- InfoSelfServiceMFA[InfoSelfServiceMFA["InfoSelfServiceMFA"] = 1030000] = "InfoSelfServiceMFA";
1178
- })(InfoSelfServiceMFA || (InfoSelfServiceMFA = {}));
1179
-
1180
- function isUiNodeAnchorAttributes(attrs) {
1181
- return attrs.node_type === "a";
1182
- }
1183
- function isUiNodeImageAttributes(attrs) {
1184
- return attrs.node_type === "img";
1185
- }
1186
- function isUiNodeInputAttributes(attrs) {
1187
- return attrs.node_type === "input";
1188
- }
1189
- function isUiNodeTextAttributes(attrs) {
1190
- return attrs.node_type === "text";
1191
- }
1192
- function isUiNodeScriptAttributes(attrs) {
1193
- return attrs.node_type === "script";
1194
- }
1195
- function isUiNodeTextSecretsAttributes(attributes) {
1196
- return attributes.text.id === 1050015;
1197
- }
1198
-
1199
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1200
- try {
1201
- var info = gen[key](arg);
1202
- var value = info.value;
1203
- } catch (error) {
1204
- reject(error);
1205
- return;
1206
- }
1207
- if (info.done) {
1208
- resolve(value);
1209
- } else {
1210
- Promise.resolve(value).then(_next, _throw);
1211
- }
1212
- }
1213
- function _async_to_generator$1(fn) {
1214
- return function() {
1215
- var self = this, args = arguments;
1216
- return new Promise(function(resolve, reject) {
1217
- var gen = fn.apply(self, args);
1218
- function _next(value) {
1219
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
1220
- }
1221
- function _throw(err) {
1222
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
1223
- }
1224
- _next(undefined);
1225
- });
1226
- };
1227
- }
1228
- function _ts_generator$1(thisArg, body) {
1229
- var f, y, t, g, _ = {
1230
- label: 0,
1231
- sent: function() {
1232
- if (t[0] & 1) throw t[1];
1233
- return t[1];
1234
- },
1235
- trys: [],
1236
- ops: []
1237
- };
1238
- return g = {
1239
- next: verb(0),
1240
- "throw": verb(1),
1241
- "return": verb(2)
1242
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1243
- return this;
1244
- }), g;
1245
- function verb(n) {
1246
- return function(v) {
1247
- return step([
1248
- n,
1249
- v
1250
- ]);
1251
- };
1252
- }
1253
- function step(op) {
1254
- if (f) throw new TypeError("Generator is already executing.");
1255
- while(_)try {
1256
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1257
- if (y = 0, t) op = [
1258
- op[0] & 2,
1259
- t.value
1260
- ];
1261
- switch(op[0]){
1262
- case 0:
1263
- case 1:
1264
- t = op;
1265
- break;
1266
- case 4:
1267
- _.label++;
1268
- return {
1269
- value: op[1],
1270
- done: false
1271
- };
1272
- case 5:
1273
- _.label++;
1274
- y = op[1];
1275
- op = [
1276
- 0
1277
- ];
1278
- continue;
1279
- case 7:
1280
- op = _.ops.pop();
1281
- _.trys.pop();
1282
- continue;
1283
- default:
1284
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1285
- _ = 0;
1286
- continue;
1287
- }
1288
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1289
- _.label = op[1];
1290
- break;
1291
- }
1292
- if (op[0] === 6 && _.label < t[1]) {
1293
- _.label = t[1];
1294
- t = op;
1295
- break;
1296
- }
1297
- if (t && _.label < t[2]) {
1298
- _.label = t[2];
1299
- _.ops.push(op);
1300
- break;
1301
- }
1302
- if (t[2]) _.ops.pop();
1303
- _.trys.pop();
1304
- continue;
1305
- }
1306
- op = body.call(thisArg, _);
1307
- } catch (e) {
1308
- op = [
1309
- 6,
1310
- e
1311
- ];
1312
- y = 0;
1313
- } finally{
1314
- f = t = 0;
1315
- }
1316
- if (op[0] & 5) throw op[1];
1317
- return {
1318
- value: op[0] ? op[1] : void 0,
1319
- done: true
1320
- };
1321
- }
1322
- }
1323
- function handleCancelError(err) {
1324
- return _handleCancelError.apply(this, arguments);
1325
- }
1326
- function _handleCancelError() {
1327
- _handleCancelError = _async_to_generator$1(function(err) {
1328
- return _ts_generator$1(this, function(_state) {
1329
- if (err.code !== "ERR_CANCELED") {
1330
- throw err;
1331
- }
1332
- return [
1333
- 2
1334
- ];
1335
- });
1336
- });
1337
- return _handleCancelError.apply(this, arguments);
1338
- }
1339
-
1340
- function _array_like_to_array$6(arr, len) {
1341
- if (len == null || len > arr.length) len = arr.length;
1342
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1343
- return arr2;
1344
- }
1345
- function _array_with_holes$5(arr) {
1346
- if (Array.isArray(arr)) return arr;
1347
- }
1348
- function _iterable_to_array_limit$5(arr, i) {
1349
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1350
- if (_i == null) return;
1351
- var _arr = [];
1352
- var _n = true;
1353
- var _d = false;
1354
- var _s, _e;
1355
- try {
1356
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1357
- _arr.push(_s.value);
1358
- if (i && _arr.length === i) break;
1359
- }
1360
- } catch (err) {
1361
- _d = true;
1362
- _e = err;
1363
- } finally{
1364
- try {
1365
- if (!_n && _i["return"] != null) _i["return"]();
1366
- } finally{
1367
- if (_d) throw _e;
1368
- }
1369
- }
1370
- return _arr;
1371
- }
1372
- function _non_iterable_rest$5() {
1373
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1374
- }
1375
- function _sliced_to_array$5(arr, i) {
1376
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$5();
1377
- }
1378
- function _unsupported_iterable_to_array$6(o, minLen) {
1379
- if (!o) return;
1380
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
1381
- var n = Object.prototype.toString.call(o).slice(8, -1);
1382
- if (n === "Object" && o.constructor) n = o.constructor.name;
1383
- if (n === "Map" || n === "Set") return Array.from(n);
1384
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
1385
- }
1386
- function useReauthenticationFlow(param) {
1387
- var kratosClient = param.kratosClient, onReauthenticated = param.onReauthenticated;
1388
- var useHandleFlowError = useKratosContext().useHandleFlowError;
1389
- var _useState = _sliced_to_array$5(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1390
- var handleFlowError = useHandleFlowError({
1391
- resetFlow: useCallback(function() {
1392
- return void setFlow(undefined);
1393
- }, [])
1394
- });
1395
- useEffect(function() {
1396
- if (flow) return;
1397
- var controller = new AbortController();
1398
- kratosClient.createBrowserLoginFlow({
1399
- refresh: true
1400
- }, {
1401
- signal: controller.signal
1402
- }).then(function(param) {
1403
- var data = param.data;
1404
- return setFlow(data);
1405
- }).catch(handleFlowError);
1406
- return function() {
1407
- controller.abort();
1408
- };
1409
- }, [
1410
- flow,
1411
- handleFlowError,
1412
- kratosClient
1413
- ]);
1414
- var submit = useCallback(function(values) {
1415
- if (!flow) return;
1416
- return kratosClient.updateLoginFlow({
1417
- flow: flow.id,
1418
- updateLoginFlowBody: values
1419
- }).then(function(param) {
1420
- var data = param.data;
1421
- return onReauthenticated(data.session);
1422
- }).catch(handleCancelError).catch(handleFlowError).catch(function(err) {
1423
- var _err_response;
1424
- if (((_err_response = err.response) === null || _err_response === void 0 ? void 0 : _err_response.status) === 400) {
1425
- var _err_response1;
1426
- var flow = err === null || err === void 0 ? void 0 : (_err_response1 = err.response) === null || _err_response1 === void 0 ? void 0 : _err_response1.data;
1427
- setFlow(flow);
1428
- return;
1429
- }
1430
- return Promise.reject(err);
1431
- });
1432
- }, [
1433
- flow,
1434
- kratosClient,
1435
- handleFlowError,
1436
- onReauthenticated
1437
- ]);
1438
- return {
1439
- flow: flow,
1440
- submit: submit
1441
- };
1442
- }
1443
-
1444
- function _array_like_to_array$5(arr, len) {
1445
- if (len == null || len > arr.length) len = arr.length;
1446
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1447
- return arr2;
1448
- }
1449
- function _array_with_holes$4(arr) {
1450
- if (Array.isArray(arr)) return arr;
1451
- }
1452
- function _define_property$f(obj, key, value) {
1453
- if (key in obj) {
1454
- Object.defineProperty(obj, key, {
1455
- value: value,
1456
- enumerable: true,
1457
- configurable: true,
1458
- writable: true
1459
- });
1460
- } else {
1461
- obj[key] = value;
1462
- }
1463
- return obj;
1464
- }
1465
- function _iterable_to_array_limit$4(arr, i) {
1466
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1467
- if (_i == null) return;
1468
- var _arr = [];
1469
- var _n = true;
1470
- var _d = false;
1471
- var _s, _e;
1472
- try {
1473
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1474
- _arr.push(_s.value);
1475
- if (i && _arr.length === i) break;
1476
- }
1477
- } catch (err) {
1478
- _d = true;
1479
- _e = err;
1480
- } finally{
1481
- try {
1482
- if (!_n && _i["return"] != null) _i["return"]();
1483
- } finally{
1484
- if (_d) throw _e;
1485
- }
1486
- }
1487
- return _arr;
1488
- }
1489
- function _non_iterable_rest$4() {
1490
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1491
- }
1492
- function _object_spread$f(target) {
1493
- for(var i = 1; i < arguments.length; i++){
1494
- var source = arguments[i] != null ? arguments[i] : {};
1495
- var ownKeys = Object.keys(source);
1496
- if (typeof Object.getOwnPropertySymbols === "function") {
1497
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1498
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1499
- }));
1500
- }
1501
- ownKeys.forEach(function(key) {
1502
- _define_property$f(target, key, source[key]);
1503
- });
1504
- }
1505
- return target;
1506
- }
1507
- function ownKeys$c(object, enumerableOnly) {
1508
- var keys = Object.keys(object);
1509
- if (Object.getOwnPropertySymbols) {
1510
- var symbols = Object.getOwnPropertySymbols(object);
1511
- keys.push.apply(keys, symbols);
1512
- }
1513
- return keys;
1514
- }
1515
- function _object_spread_props$c(target, source) {
1516
- source = source != null ? source : {};
1517
- if (Object.getOwnPropertyDescriptors) {
1518
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1519
- } else {
1520
- ownKeys$c(Object(source)).forEach(function(key) {
1521
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1522
- });
1523
- }
1524
- return target;
1525
- }
1526
- function _object_without_properties$5(source, excluded) {
1527
- if (source == null) return {};
1528
- var target = _object_without_properties_loose$5(source, excluded);
1529
- var key, i;
1530
- if (Object.getOwnPropertySymbols) {
1531
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1532
- for(i = 0; i < sourceSymbolKeys.length; i++){
1533
- key = sourceSymbolKeys[i];
1534
- if (excluded.indexOf(key) >= 0) continue;
1535
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1536
- target[key] = source[key];
1537
- }
1538
- }
1539
- return target;
1540
- }
1541
- function _object_without_properties_loose$5(source, excluded) {
1542
- if (source == null) return {};
1543
- var target = {};
1544
- var sourceKeys = Object.keys(source);
1545
- var key, i;
1546
- for(i = 0; i < sourceKeys.length; i++){
1547
- key = sourceKeys[i];
1548
- if (excluded.indexOf(key) >= 0) continue;
1549
- target[key] = source[key];
1550
- }
1551
- return target;
1552
- }
1553
- function _sliced_to_array$4(arr, i) {
1554
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$4();
1555
- }
1556
- function _to_primitive$3(input, hint) {
1557
- if (_type_of$3(input) !== "object" || input === null) return input;
1558
- var prim = input[Symbol.toPrimitive];
1559
- if (prim !== undefined) {
1560
- var res = prim.call(input, hint);
1561
- if (_type_of$3(res) !== "object") return res;
1562
- throw new TypeError("@@toPrimitive must return a primitive value.");
1563
- }
1564
- return (String )(input);
1565
- }
1566
- function _to_property_key$3(arg) {
1567
- var key = _to_primitive$3(arg, "string");
1568
- return _type_of$3(key) === "symbol" ? key : String(key);
1569
- }
1570
- function _type_of$3(obj) {
1571
- "@swc/helpers - typeof";
1572
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1573
- }
1574
- function _unsupported_iterable_to_array$5(o, minLen) {
1575
- if (!o) return;
1576
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
1577
- var n = Object.prototype.toString.call(o).slice(8, -1);
1578
- if (n === "Object" && o.constructor) n = o.constructor.name;
1579
- if (n === "Map" || n === "Set") return Array.from(n);
1580
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
1581
- }
1582
- function useRecoveryFlow(param) {
1583
- var kratosClient = param.kratosClient, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable, onContinueWith = param.onContinueWith, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
1584
- var useHandleFlowError = useKratosContext().useHandleFlowError;
1585
- var _useState = _sliced_to_array$4(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1586
- var flowId = searchParams[flowIdParameterName], returnTo = searchParams[returnToParameterName];
1587
- var _obj;
1588
- var handleFlowError = useHandleFlowError((_obj = {}, _define_property$f(_obj, "resetFlow", useCallback(function() {
1589
- searchParams[flowIdParameterName]; var newParams = _object_without_properties$5(searchParams, [
1590
- flowIdParameterName
1591
- ].map(_to_property_key$3));
1592
- updateSearchParams(newParams);
1593
- setFlow(undefined);
1594
- }, [
1595
- searchParams,
1596
- updateSearchParams
1597
- ])), _define_property$f(_obj, "onSessionAlreadyAvailable", onSessionAlreadyAvailable), _obj));
1598
- useEffect(function() {
1599
- if (flow) return;
1600
- var controller = new AbortController();
1601
- if (flowId) {
1602
- kratosClient.getRecoveryFlow({
1603
- id: flowId
1604
- }, {
1605
- signal: controller.signal
1606
- }).then(function(param) {
1607
- var data = param.data;
1608
- return setFlow(data);
1609
- }).catch(handleCancelError).catch(handleFlowError);
1610
- return;
1611
- } else {
1612
- kratosClient.createBrowserRecoveryFlow({
1613
- returnTo: returnTo
1614
- }, {
1615
- signal: controller.signal
1616
- }).then(function(param) {
1617
- var data = param.data;
1618
- return setFlow(data);
1619
- }).catch(handleCancelError).catch(handleFlowError);
1620
- }
1621
- return function() {
1622
- controller.abort();
1623
- };
1624
- }, [
1625
- flowId,
1626
- returnTo,
1627
- flow,
1628
- handleFlowError,
1629
- kratosClient
1630
- ]);
1631
- var submit = useCallback(function(param) {
1632
- var body = param.body;
1633
- if (!flow) return;
1634
- updateSearchParams(_object_spread_props$c(_object_spread$f({}, searchParams), _define_property$f({}, flowIdParameterName, flow.id)));
1635
- return kratosClient.updateRecoveryFlow({
1636
- flow: flow.id,
1637
- updateRecoveryFlowBody: body
1638
- }).then(function(param) {
1639
- var data = param.data;
1640
- setFlow(data);
1641
- if (data.continue_with) {
1642
- onContinueWith === null || onContinueWith === void 0 ? void 0 : onContinueWith(data.continue_with);
1643
- }
1644
- }).catch(handleFlowError).catch(function(err) {
1645
- var _err_response;
1646
- if (((_err_response = err.response) === null || _err_response === void 0 ? void 0 : _err_response.status) === 400) {
1647
- var _err_response1;
1648
- setFlow((_err_response1 = err.response) === null || _err_response1 === void 0 ? void 0 : _err_response1.data);
1649
- return;
1650
- }
1651
- return Promise.reject(err);
1652
- });
1653
- }, [
1654
- flow,
1655
- updateSearchParams,
1656
- searchParams,
1657
- kratosClient,
1658
- handleFlowError,
1659
- onContinueWith
1660
- ]);
1661
- return {
1662
- flow: flow,
1663
- submit: submit,
1664
- isRecovering: (flow === null || flow === void 0 ? void 0 : flow.state) === "sent_email"
1665
- };
1666
- }
1667
-
1668
- function _array_like_to_array$4(arr, len) {
1669
- if (len == null || len > arr.length) len = arr.length;
1670
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1671
- return arr2;
1672
- }
1673
- function _array_with_holes$3(arr) {
1674
- if (Array.isArray(arr)) return arr;
1675
- }
1676
- function _define_property$e(obj, key, value) {
1677
- if (key in obj) {
1678
- Object.defineProperty(obj, key, {
1679
- value: value,
1680
- enumerable: true,
1681
- configurable: true,
1682
- writable: true
1683
- });
1684
- } else {
1685
- obj[key] = value;
1686
- }
1687
- return obj;
1688
- }
1689
- function _iterable_to_array_limit$3(arr, i) {
1690
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1691
- if (_i == null) return;
1692
- var _arr = [];
1693
- var _n = true;
1694
- var _d = false;
1695
- var _s, _e;
1696
- try {
1697
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1698
- _arr.push(_s.value);
1699
- if (i && _arr.length === i) break;
1700
- }
1701
- } catch (err) {
1702
- _d = true;
1703
- _e = err;
1704
- } finally{
1705
- try {
1706
- if (!_n && _i["return"] != null) _i["return"]();
1707
- } finally{
1708
- if (_d) throw _e;
1709
- }
1710
- }
1711
- return _arr;
1712
- }
1713
- function _non_iterable_rest$3() {
1714
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1715
- }
1716
- function _object_spread$e(target) {
1717
- for(var i = 1; i < arguments.length; i++){
1718
- var source = arguments[i] != null ? arguments[i] : {};
1719
- var ownKeys = Object.keys(source);
1720
- if (typeof Object.getOwnPropertySymbols === "function") {
1721
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1722
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1723
- }));
1724
- }
1725
- ownKeys.forEach(function(key) {
1726
- _define_property$e(target, key, source[key]);
1727
- });
1728
- }
1729
- return target;
1730
- }
1731
- function ownKeys$b(object, enumerableOnly) {
1732
- var keys = Object.keys(object);
1733
- if (Object.getOwnPropertySymbols) {
1734
- var symbols = Object.getOwnPropertySymbols(object);
1735
- keys.push.apply(keys, symbols);
1736
- }
1737
- return keys;
1738
- }
1739
- function _object_spread_props$b(target, source) {
1740
- source = source != null ? source : {};
1741
- if (Object.getOwnPropertyDescriptors) {
1742
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1743
- } else {
1744
- ownKeys$b(Object(source)).forEach(function(key) {
1745
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1746
- });
1747
- }
1748
- return target;
1749
- }
1750
- function _object_without_properties$4(source, excluded) {
1751
- if (source == null) return {};
1752
- var target = _object_without_properties_loose$4(source, excluded);
1753
- var key, i;
1754
- if (Object.getOwnPropertySymbols) {
1755
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1756
- for(i = 0; i < sourceSymbolKeys.length; i++){
1757
- key = sourceSymbolKeys[i];
1758
- if (excluded.indexOf(key) >= 0) continue;
1759
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1760
- target[key] = source[key];
1761
- }
1762
- }
1763
- return target;
1764
- }
1765
- function _object_without_properties_loose$4(source, excluded) {
1766
- if (source == null) return {};
1767
- var target = {};
1768
- var sourceKeys = Object.keys(source);
1769
- var key, i;
1770
- for(i = 0; i < sourceKeys.length; i++){
1771
- key = sourceKeys[i];
1772
- if (excluded.indexOf(key) >= 0) continue;
1773
- target[key] = source[key];
1774
- }
1775
- return target;
1776
- }
1777
- function _sliced_to_array$3(arr, i) {
1778
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$3();
1779
- }
1780
- function _to_primitive$2(input, hint) {
1781
- if (_type_of$2(input) !== "object" || input === null) return input;
1782
- var prim = input[Symbol.toPrimitive];
1783
- if (prim !== undefined) {
1784
- var res = prim.call(input, hint);
1785
- if (_type_of$2(res) !== "object") return res;
1786
- throw new TypeError("@@toPrimitive must return a primitive value.");
1787
- }
1788
- return (String )(input);
1789
- }
1790
- function _to_property_key$2(arg) {
1791
- var key = _to_primitive$2(arg, "string");
1792
- return _type_of$2(key) === "symbol" ? key : String(key);
1793
- }
1794
- function _type_of$2(obj) {
1795
- "@swc/helpers - typeof";
1796
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1797
- }
1798
- function _unsupported_iterable_to_array$4(o, minLen) {
1799
- if (!o) return;
1800
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
1801
- var n = Object.prototype.toString.call(o).slice(8, -1);
1802
- if (n === "Object" && o.constructor) n = o.constructor.name;
1803
- if (n === "Map" || n === "Set") return Array.from(n);
1804
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
1805
- }
1806
- function useSettingsFlow(param) {
1807
- var kratosClient = param.kratosClient, params = param.params, onContinueWith = param.onContinueWith, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
1808
- var useHandleFlowError = useKratosContext().useHandleFlowError;
1809
- var _useState = _sliced_to_array$3(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1810
- var flowId = searchParams[flowIdParameterName], returnTo = searchParams[returnToParameterName];
1811
- var handleFlowError = useHandleFlowError(_define_property$e({}, "resetFlow", useCallback(function() {
1812
- searchParams[flowIdParameterName]; var newParams = _object_without_properties$4(searchParams, [
1813
- flowIdParameterName
1814
- ].map(_to_property_key$2));
1815
- updateSearchParams(newParams);
1816
- setFlow(undefined);
1817
- }, [
1818
- searchParams,
1819
- updateSearchParams
1820
- ])));
1821
- useEffect(function() {
1822
- if (flow) return;
1823
- var controller = new AbortController();
1824
- if (flowId) {
1825
- kratosClient.getSettingsFlow({
1826
- id: flowId
1827
- }, {
1828
- signal: controller.signal
1829
- }).then(function(param) {
1830
- var data = param.data;
1831
- return setFlow(data);
1832
- }).catch(handleCancelError).catch(handleFlowError);
1833
- } else {
1834
- kratosClient.createBrowserSettingsFlow({
1835
- returnTo: returnTo
1836
- }, {
1837
- params: params,
1838
- signal: controller.signal
1839
- }).then(function(param) {
1840
- var data = param.data;
1841
- return setFlow(data);
1842
- }).catch(handleCancelError).catch(handleFlowError);
1843
- }
1844
- return function() {
1845
- controller.abort();
1846
- };
1847
- }, [
1848
- flow,
1849
- flowId,
1850
- handleFlowError,
1851
- kratosClient,
1852
- params,
1853
- returnTo
1854
- ]);
1855
- var submit = useCallback(function(param) {
1856
- var body = param.body;
1857
- if (!flow) return;
1858
- updateSearchParams(_object_spread_props$b(_object_spread$e({}, searchParams), _define_property$e({}, flowIdParameterName, flow.id)));
1859
- return kratosClient.updateSettingsFlow({
1860
- flow: flow.id,
1861
- updateSettingsFlowBody: body
1862
- }).then(function(param) {
1863
- var data = param.data;
1864
- if (flow.return_to) {
1865
- window.location.href = flow.return_to;
1866
- return;
1867
- }
1868
- setFlow(data);
1869
- if (data.continue_with) {
1870
- onContinueWith === null || onContinueWith === void 0 ? void 0 : onContinueWith(data.continue_with);
1871
- }
1872
- }).catch(handleFlowError).catch(function(err) {
1873
- var _err_response;
1874
- if (((_err_response = err.response) === null || _err_response === void 0 ? void 0 : _err_response.status) === 400) {
1875
- var _err_response1;
1876
- setFlow((_err_response1 = err.response) === null || _err_response1 === void 0 ? void 0 : _err_response1.data);
1877
- return;
1878
- }
1879
- return Promise.reject(err);
1880
- });
1881
- }, [
1882
- flow,
1883
- updateSearchParams,
1884
- searchParams,
1885
- kratosClient,
1886
- handleFlowError,
1887
- onContinueWith
1888
- ]);
1889
- return {
1890
- flow: flow,
1891
- submit: submit
1892
- };
1893
- }
1894
-
1895
- function _array_like_to_array$3(arr, len) {
1896
- if (len == null || len > arr.length) len = arr.length;
1897
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1898
- return arr2;
1899
- }
1900
- function _array_with_holes$2(arr) {
1901
- if (Array.isArray(arr)) return arr;
1902
- }
1903
- function _define_property$d(obj, key, value) {
1904
- if (key in obj) {
1905
- Object.defineProperty(obj, key, {
1906
- value: value,
1907
- enumerable: true,
1908
- configurable: true,
1909
- writable: true
1910
- });
1911
- } else {
1912
- obj[key] = value;
1913
- }
1914
- return obj;
1915
- }
1916
- function _iterable_to_array_limit$2(arr, i) {
1917
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1918
- if (_i == null) return;
1919
- var _arr = [];
1920
- var _n = true;
1921
- var _d = false;
1922
- var _s, _e;
1923
- try {
1924
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1925
- _arr.push(_s.value);
1926
- if (i && _arr.length === i) break;
1927
- }
1928
- } catch (err) {
1929
- _d = true;
1930
- _e = err;
1931
- } finally{
1932
- try {
1933
- if (!_n && _i["return"] != null) _i["return"]();
1934
- } finally{
1935
- if (_d) throw _e;
1936
- }
1937
- }
1938
- return _arr;
1939
- }
1940
- function _non_iterable_rest$2() {
1941
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1942
- }
1943
- function _object_spread$d(target) {
1944
- for(var i = 1; i < arguments.length; i++){
1945
- var source = arguments[i] != null ? arguments[i] : {};
1946
- var ownKeys = Object.keys(source);
1947
- if (typeof Object.getOwnPropertySymbols === "function") {
1948
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1949
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1950
- }));
1951
- }
1952
- ownKeys.forEach(function(key) {
1953
- _define_property$d(target, key, source[key]);
1954
- });
1955
- }
1956
- return target;
1957
- }
1958
- function ownKeys$a(object, enumerableOnly) {
1959
- var keys = Object.keys(object);
1960
- if (Object.getOwnPropertySymbols) {
1961
- var symbols = Object.getOwnPropertySymbols(object);
1962
- keys.push.apply(keys, symbols);
1963
- }
1964
- return keys;
1965
- }
1966
- function _object_spread_props$a(target, source) {
1967
- source = source != null ? source : {};
1968
- if (Object.getOwnPropertyDescriptors) {
1969
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1970
- } else {
1971
- ownKeys$a(Object(source)).forEach(function(key) {
1972
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1973
- });
1974
- }
1975
- return target;
1976
- }
1977
- function _object_without_properties$3(source, excluded) {
1978
- if (source == null) return {};
1979
- var target = _object_without_properties_loose$3(source, excluded);
1980
- var key, i;
1981
- if (Object.getOwnPropertySymbols) {
1982
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1983
- for(i = 0; i < sourceSymbolKeys.length; i++){
1984
- key = sourceSymbolKeys[i];
1985
- if (excluded.indexOf(key) >= 0) continue;
1986
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1987
- target[key] = source[key];
1988
- }
1989
- }
1990
- return target;
1991
- }
1992
- function _object_without_properties_loose$3(source, excluded) {
1993
- if (source == null) return {};
1994
- var target = {};
1995
- var sourceKeys = Object.keys(source);
1996
- var key, i;
1997
- for(i = 0; i < sourceKeys.length; i++){
1998
- key = sourceKeys[i];
1999
- if (excluded.indexOf(key) >= 0) continue;
2000
- target[key] = source[key];
2001
- }
2002
- return target;
2003
- }
2004
- function _sliced_to_array$2(arr, i) {
2005
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$2();
2006
- }
2007
- function _to_primitive$1(input, hint) {
2008
- if (_type_of$1(input) !== "object" || input === null) return input;
2009
- var prim = input[Symbol.toPrimitive];
2010
- if (prim !== undefined) {
2011
- var res = prim.call(input, hint);
2012
- if (_type_of$1(res) !== "object") return res;
2013
- throw new TypeError("@@toPrimitive must return a primitive value.");
2014
- }
2015
- return (String )(input);
2016
- }
2017
- function _to_property_key$1(arg) {
2018
- var key = _to_primitive$1(arg, "string");
2019
- return _type_of$1(key) === "symbol" ? key : String(key);
2020
- }
2021
- function _type_of$1(obj) {
2022
- "@swc/helpers - typeof";
2023
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2024
- }
2025
- function _unsupported_iterable_to_array$3(o, minLen) {
2026
- if (!o) return;
2027
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
2028
- var n = Object.prototype.toString.call(o).slice(8, -1);
2029
- if (n === "Object" && o.constructor) n = o.constructor.name;
2030
- if (n === "Map" || n === "Set") return Array.from(n);
2031
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
2032
- }
2033
- function useLoginFlow(param) {
2034
- var kratosClient = param.kratosClient, returnTo = param.returnTo, onLoggedIn = param.onLoggedIn, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
2035
- var useHandleFlowError = useKratosContext().useHandleFlowError;
2036
- var _useState = _sliced_to_array$2(useState(), 2), flow = _useState[0], setFlow = _useState[1];
2037
- var flowId = searchParams[flowIdParameterName], returnToFromSearch = searchParams[returnToParameterName], refresh = searchParams[refreshParameterName], authorizationAssuranceLevel = searchParams[aalParameterName];
2038
- useEffect(function() {
2039
- setFlow(undefined);
2040
- }, [
2041
- authorizationAssuranceLevel
2042
- ]);
2043
- var _obj;
2044
- var handleFlowError = useHandleFlowError((_obj = {}, _define_property$d(_obj, "resetFlow", useCallback(function() {
2045
- searchParams[flowIdParameterName]; searchParams[aalParameterName]; var newParams = _object_without_properties$3(searchParams, [
2046
- flowIdParameterName,
2047
- aalParameterName
2048
- ].map(_to_property_key$1));
2049
- updateSearchParams(newParams);
2050
- setFlow(undefined);
2051
- }, [
2052
- searchParams,
2053
- updateSearchParams
2054
- ])), _define_property$d(_obj, "onSessionAlreadyAvailable", onSessionAlreadyAvailable), _obj));
2055
- useEffect(function() {
2056
- if (flow) return;
2057
- var controller = new AbortController();
2058
- if (flowId) {
2059
- kratosClient.getLoginFlow({
2060
- id: flowId
2061
- }, {
2062
- signal: controller.signal
2063
- }).then(function(param) {
2064
- var data = param.data;
2065
- return setFlow(data);
2066
- }).catch(handleCancelError).catch(handleFlowError);
2067
- } else {
2068
- kratosClient.createBrowserLoginFlow({
2069
- aal: authorizationAssuranceLevel,
2070
- refresh: yn(refresh),
2071
- returnTo: returnTo !== null && returnTo !== void 0 ? returnTo : returnToFromSearch
2072
- }, {
2073
- signal: controller.signal
2074
- }).then(function(param) {
2075
- var data = param.data;
2076
- return setFlow(data);
2077
- }).catch(handleCancelError).catch(handleFlowError);
2078
- }
2079
- return function() {
2080
- controller.abort();
2081
- };
2082
- }, [
2083
- authorizationAssuranceLevel,
2084
- flow,
2085
- flowId,
2086
- handleFlowError,
2087
- kratosClient,
2088
- refresh,
2089
- returnTo,
2090
- returnToFromSearch
2091
- ]);
2092
- var submit = useCallback(function(param) {
2093
- var body = param.body;
2094
- if (!flow) return;
2095
- updateSearchParams(_object_spread_props$a(_object_spread$d({}, searchParams), _define_property$d({}, flowIdParameterName, flow.id)));
2096
- kratosClient.updateLoginFlow({
2097
- flow: flow.id,
2098
- updateLoginFlowBody: body
2099
- }).then(function(param) {
2100
- var data = param.data;
2101
- if (flow.return_to) {
2102
- window.location.href = flow.return_to;
2103
- return;
2104
- }
2105
- onLoggedIn === null || onLoggedIn === void 0 ? void 0 : onLoggedIn(data.session);
2106
- }).catch(handleFlowError).catch(function(err) {
2107
- var _err_response;
2108
- if (((_err_response = err.response) === null || _err_response === void 0 ? void 0 : _err_response.status) === 400) {
2109
- var _err_response1;
2110
- setFlow(err === null || err === void 0 ? void 0 : (_err_response1 = err.response) === null || _err_response1 === void 0 ? void 0 : _err_response1.data);
2111
- return;
2112
- }
2113
- return Promise.reject(err);
2114
- });
2115
- }, [
2116
- flow,
2117
- updateSearchParams,
2118
- searchParams,
2119
- kratosClient,
2120
- handleFlowError,
2121
- onLoggedIn
2122
- ]);
2123
- return {
2124
- flow: flow,
2125
- submit: submit
2126
- };
2127
- }
2128
-
2129
- function _array_like_to_array$2(arr, len) {
2130
- if (len == null || len > arr.length) len = arr.length;
2131
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2132
- return arr2;
2133
- }
2134
- function _array_with_holes$1(arr) {
2135
- if (Array.isArray(arr)) return arr;
2136
- }
2137
- function _define_property$c(obj, key, value) {
2138
- if (key in obj) {
2139
- Object.defineProperty(obj, key, {
2140
- value: value,
2141
- enumerable: true,
2142
- configurable: true,
2143
- writable: true
2144
- });
2145
- } else {
2146
- obj[key] = value;
2147
- }
2148
- return obj;
2149
- }
2150
- function _iterable_to_array_limit$1(arr, i) {
2151
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2152
- if (_i == null) return;
2153
- var _arr = [];
2154
- var _n = true;
2155
- var _d = false;
2156
- var _s, _e;
2157
- try {
2158
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2159
- _arr.push(_s.value);
2160
- if (i && _arr.length === i) break;
2161
- }
2162
- } catch (err) {
2163
- _d = true;
2164
- _e = err;
2165
- } finally{
2166
- try {
2167
- if (!_n && _i["return"] != null) _i["return"]();
2168
- } finally{
2169
- if (_d) throw _e;
2170
- }
2171
- }
2172
- return _arr;
2173
- }
2174
- function _non_iterable_rest$1() {
2175
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2176
- }
2177
- function _object_spread$c(target) {
2178
- for(var i = 1; i < arguments.length; i++){
2179
- var source = arguments[i] != null ? arguments[i] : {};
2180
- var ownKeys = Object.keys(source);
2181
- if (typeof Object.getOwnPropertySymbols === "function") {
2182
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2183
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2184
- }));
2185
- }
2186
- ownKeys.forEach(function(key) {
2187
- _define_property$c(target, key, source[key]);
2188
- });
2189
- }
2190
- return target;
2191
- }
2192
- function ownKeys$9(object, enumerableOnly) {
2193
- var keys = Object.keys(object);
2194
- if (Object.getOwnPropertySymbols) {
2195
- var symbols = Object.getOwnPropertySymbols(object);
2196
- keys.push.apply(keys, symbols);
2197
- }
2198
- return keys;
2199
- }
2200
- function _object_spread_props$9(target, source) {
2201
- source = source != null ? source : {};
2202
- if (Object.getOwnPropertyDescriptors) {
2203
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2204
- } else {
2205
- ownKeys$9(Object(source)).forEach(function(key) {
2206
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2207
- });
2208
- }
2209
- return target;
2210
- }
2211
- function _object_without_properties$2(source, excluded) {
2212
- if (source == null) return {};
2213
- var target = _object_without_properties_loose$2(source, excluded);
2214
- var key, i;
2215
- if (Object.getOwnPropertySymbols) {
2216
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2217
- for(i = 0; i < sourceSymbolKeys.length; i++){
2218
- key = sourceSymbolKeys[i];
2219
- if (excluded.indexOf(key) >= 0) continue;
2220
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2221
- target[key] = source[key];
2222
- }
2223
- }
2224
- return target;
2225
- }
2226
- function _object_without_properties_loose$2(source, excluded) {
2227
- if (source == null) return {};
2228
- var target = {};
2229
- var sourceKeys = Object.keys(source);
2230
- var key, i;
2231
- for(i = 0; i < sourceKeys.length; i++){
2232
- key = sourceKeys[i];
2233
- if (excluded.indexOf(key) >= 0) continue;
2234
- target[key] = source[key];
2235
- }
2236
- return target;
2237
- }
2238
- function _sliced_to_array$1(arr, i) {
2239
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
2240
- }
2241
- function _to_primitive(input, hint) {
2242
- if (_type_of(input) !== "object" || input === null) return input;
2243
- var prim = input[Symbol.toPrimitive];
2244
- if (prim !== undefined) {
2245
- var res = prim.call(input, hint);
2246
- if (_type_of(res) !== "object") return res;
2247
- throw new TypeError("@@toPrimitive must return a primitive value.");
2248
- }
2249
- return (String )(input);
2250
- }
2251
- function _to_property_key(arg) {
2252
- var key = _to_primitive(arg, "string");
2253
- return _type_of(key) === "symbol" ? key : String(key);
2254
- }
2255
- function _type_of(obj) {
2256
- "@swc/helpers - typeof";
2257
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2258
- }
2259
- function _unsupported_iterable_to_array$2(o, minLen) {
2260
- if (!o) return;
2261
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
2262
- var n = Object.prototype.toString.call(o).slice(8, -1);
2263
- if (n === "Object" && o.constructor) n = o.constructor.name;
2264
- if (n === "Map" || n === "Set") return Array.from(n);
2265
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
2266
- }
2267
- function useRegisterFlow(param) {
2268
- var kratosClient = param.kratosClient, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable, onContinueWith = param.onContinueWith, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
2269
- var useHandleFlowError = useKratosContext().useHandleFlowError;
2270
- var _useState = _sliced_to_array$1(useState(), 2), flow = _useState[0], setFlow = _useState[1];
2271
- var _useState1 = _sliced_to_array$1(useState(false), 2), isRegistered = _useState1[0], setIsRegistered = _useState1[1];
2272
- var flowId = searchParams[flowIdParameterName], returnTo = searchParams[returnToParameterName];
2273
- var _obj;
2274
- var handleFlowError = useHandleFlowError((_obj = {}, _define_property$c(_obj, "resetFlow", useCallback(function() {
2275
- searchParams[flowIdParameterName]; var newParams = _object_without_properties$2(searchParams, [
2276
- flowIdParameterName
2277
- ].map(_to_property_key));
2278
- updateSearchParams(newParams);
2279
- setFlow(undefined);
2280
- }, [
2281
- searchParams,
2282
- updateSearchParams
2283
- ])), _define_property$c(_obj, "onSessionAlreadyAvailable", onSessionAlreadyAvailable), _obj));
2284
- useEffect(function() {
2285
- if (flow) return;
2286
- var controller = new AbortController();
2287
- if (flowId) {
2288
- kratosClient.getRegistrationFlow({
2289
- id: flowId
2290
- }, {
2291
- signal: controller.signal
2292
- }).then(function(param) {
2293
- var data = param.data;
2294
- return setFlow(data);
2295
- }).catch(handleCancelError).catch(handleFlowError);
2296
- } else {
2297
- kratosClient.createBrowserRegistrationFlow({
2298
- returnTo: returnTo
2299
- }, {
2300
- signal: controller.signal
2301
- }).then(function(param) {
2302
- var data = param.data;
2303
- return setFlow(data);
2304
- }).catch(handleCancelError).catch(handleFlowError);
2305
- }
2306
- return function() {
2307
- controller.abort();
2308
- };
2309
- }, [
2310
- flowId,
2311
- returnTo,
2312
- flow,
2313
- handleFlowError,
2314
- kratosClient
2315
- ]);
2316
- var submit = useCallback(function(param) {
2317
- var body = param.body;
2318
- if (!flow) return;
2319
- updateSearchParams(_object_spread_props$9(_object_spread$c({}, searchParams), _define_property$c({}, flowIdParameterName, flow.id)));
2320
- return kratosClient.updateRegistrationFlow({
2321
- flow: flow.id,
2322
- updateRegistrationFlowBody: body
2323
- }).then(function(data) {
2324
- setIsRegistered(true);
2325
- if (data.data.continue_with) {
2326
- onContinueWith === null || onContinueWith === void 0 ? void 0 : onContinueWith(data.data.continue_with);
2327
- }
2328
- }).catch(handleFlowError).catch(function(err) {
2329
- var _err_response;
2330
- if (((_err_response = err.response) === null || _err_response === void 0 ? void 0 : _err_response.status) === 400) {
2331
- var _err_response1;
2332
- setFlow((_err_response1 = err.response) === null || _err_response1 === void 0 ? void 0 : _err_response1.data);
2333
- return;
2334
- }
2335
- return Promise.reject(err);
2336
- });
2337
- }, [
2338
- flow,
2339
- updateSearchParams,
2340
- searchParams,
2341
- kratosClient,
2342
- handleFlowError,
2343
- onContinueWith
2344
- ]);
2345
- return {
2346
- flow: flow,
2347
- submit: submit,
2348
- isRegistered: isRegistered
2349
- };
2350
- }
2351
-
2352
- function _array_like_to_array$1(arr, len) {
2353
- if (len == null || len > arr.length) len = arr.length;
2354
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2355
- return arr2;
2356
- }
2357
- function _array_with_holes(arr) {
2358
- if (Array.isArray(arr)) return arr;
2359
- }
2360
- function _define_property$b(obj, key, value) {
2361
- if (key in obj) {
2362
- Object.defineProperty(obj, key, {
2363
- value: value,
2364
- enumerable: true,
2365
- configurable: true,
2366
- writable: true
2367
- });
2368
- } else {
2369
- obj[key] = value;
2370
- }
2371
- return obj;
2372
- }
2373
- function _iterable_to_array_limit(arr, i) {
2374
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2375
- if (_i == null) return;
2376
- var _arr = [];
2377
- var _n = true;
2378
- var _d = false;
2379
- var _s, _e;
2380
- try {
2381
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2382
- _arr.push(_s.value);
2383
- if (i && _arr.length === i) break;
2384
- }
2385
- } catch (err) {
2386
- _d = true;
2387
- _e = err;
2388
- } finally{
2389
- try {
2390
- if (!_n && _i["return"] != null) _i["return"]();
2391
- } finally{
2392
- if (_d) throw _e;
2393
- }
2394
- }
2395
- return _arr;
2396
- }
2397
- function _non_iterable_rest() {
2398
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2399
- }
2400
- function _object_spread$b(target) {
2401
- for(var i = 1; i < arguments.length; i++){
2402
- var source = arguments[i] != null ? arguments[i] : {};
2403
- var ownKeys = Object.keys(source);
2404
- if (typeof Object.getOwnPropertySymbols === "function") {
2405
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2406
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2407
- }));
2408
- }
2409
- ownKeys.forEach(function(key) {
2410
- _define_property$b(target, key, source[key]);
2411
- });
2412
- }
2413
- return target;
2414
- }
2415
- function ownKeys$8(object, enumerableOnly) {
2416
- var keys = Object.keys(object);
2417
- if (Object.getOwnPropertySymbols) {
2418
- var symbols = Object.getOwnPropertySymbols(object);
2419
- keys.push.apply(keys, symbols);
2420
- }
2421
- return keys;
2422
- }
2423
- function _object_spread_props$8(target, source) {
2424
- source = source != null ? source : {};
2425
- if (Object.getOwnPropertyDescriptors) {
2426
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2427
- } else {
2428
- ownKeys$8(Object(source)).forEach(function(key) {
2429
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2430
- });
2431
- }
2432
- return target;
2433
- }
2434
- function _sliced_to_array(arr, i) {
2435
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest();
2436
- }
2437
- function _unsupported_iterable_to_array$1(o, minLen) {
2438
- if (!o) return;
2439
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
2440
- var n = Object.prototype.toString.call(o).slice(8, -1);
2441
- if (n === "Object" && o.constructor) n = o.constructor.name;
2442
- if (n === "Map" || n === "Set") return Array.from(n);
2443
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
2444
- }
2445
- function useVerificationFlow(param) {
2446
- var initialFlowId = param.initialFlowId, kratosClient = param.kratosClient, onVerified = param.onVerified, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
2447
- var useHandleFlowError = useKratosContext().useHandleFlowError;
2448
- var _useState = _sliced_to_array(useState(), 2), flow = _useState[0], setFlow = _useState[1];
2449
- var tmp = searchParams[flowIdParameterName], flowId = tmp === void 0 ? initialFlowId : tmp, returnTo = searchParams[returnToParameterName];
2450
- var resetFlow = useCallback(function(flowId) {
2451
- updateSearchParams(_object_spread_props$8(_object_spread$b({}, searchParams), _define_property$b({}, flowIdParameterName, flowId)));
2452
- setFlow(undefined);
2453
- }, [
2454
- searchParams,
2455
- updateSearchParams
2456
- ]);
2457
- var reset = function() {
2458
- resetFlow();
2459
- };
2460
- var handleFlowError = useHandleFlowError({
2461
- resetFlow: resetFlow
2462
- });
2463
- useEffect(function() {
2464
- if ((flow === null || flow === void 0 ? void 0 : flow.state) === "passed_challenge") onVerified();
2465
- }, [
2466
- flow === null || flow === void 0 ? void 0 : flow.state,
2467
- onVerified
2468
- ]);
2469
- useEffect(function() {
2470
- if (flow) return;
2471
- var controller = new AbortController();
2472
- if (flowId) {
2473
- kratosClient.getVerificationFlow({
2474
- id: flowId
2475
- }, {
2476
- signal: controller.signal
2477
- }).then(function(param) {
2478
- var data = param.data;
2479
- return setFlow(data);
2480
- }).catch(handleCancelError).catch(handleFlowError);
2481
- } else {
2482
- kratosClient.createBrowserVerificationFlow({
2483
- returnTo: returnTo
2484
- }, {
2485
- signal: controller.signal
2486
- }).then(function(param) {
2487
- var data = param.data;
2488
- return setFlow(data);
2489
- }).catch(handleCancelError).catch(handleFlowError);
2490
- }
2491
- return function() {
2492
- controller.abort();
2493
- };
2494
- }, [
2495
- flowId,
2496
- returnTo,
2497
- flow,
2498
- handleFlowError,
2499
- kratosClient,
2500
- onVerified
2501
- ]);
2502
- var submit = useCallback(function(param) {
2503
- var body = param.body;
2504
- if (!flow) return;
2505
- updateSearchParams(_object_spread_props$8(_object_spread$b({}, searchParams), _define_property$b({}, flowIdParameterName, flow.id)));
2506
- return kratosClient.updateVerificationFlow({
2507
- flow: flow.id,
2508
- updateVerificationFlowBody: body
2509
- }).then(function(param) {
2510
- var data = param.data;
2511
- return setFlow(data);
2512
- }).catch(handleFlowError).catch(function(err) {
2513
- var _err_response;
2514
- if (((_err_response = err.response) === null || _err_response === void 0 ? void 0 : _err_response.status) === 400) {
2515
- var _err_response1;
2516
- setFlow((_err_response1 = err.response) === null || _err_response1 === void 0 ? void 0 : _err_response1.data);
2517
- return;
2518
- }
2519
- return Promise.reject(err);
2520
- });
2521
- }, [
2522
- flow,
2523
- updateSearchParams,
2524
- searchParams,
2525
- kratosClient,
2526
- handleFlowError
2527
- ]);
2528
- return {
2529
- flow: flow,
2530
- submit: submit,
2531
- reset: reset
2532
- };
2533
- }
2534
-
2535
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2536
- try {
2537
- var info = gen[key](arg);
2538
- var value = info.value;
2539
- } catch (error) {
2540
- reject(error);
2541
- return;
2542
- }
2543
- if (info.done) {
2544
- resolve(value);
2545
- } else {
2546
- Promise.resolve(value).then(_next, _throw);
2547
- }
2548
- }
2549
- function _async_to_generator(fn) {
2550
- return function() {
2551
- var self = this, args = arguments;
2552
- return new Promise(function(resolve, reject) {
2553
- var gen = fn.apply(self, args);
2554
- function _next(value) {
2555
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2556
- }
2557
- function _throw(err) {
2558
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2559
- }
2560
- _next(undefined);
2561
- });
2562
- };
2563
- }
2564
- function _ts_generator(thisArg, body) {
2565
- var f, y, t, g, _ = {
2566
- label: 0,
2567
- sent: function() {
2568
- if (t[0] & 1) throw t[1];
2569
- return t[1];
2570
- },
2571
- trys: [],
2572
- ops: []
2573
- };
2574
- return g = {
2575
- next: verb(0),
2576
- "throw": verb(1),
2577
- "return": verb(2)
2578
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
2579
- return this;
2580
- }), g;
2581
- function verb(n) {
2582
- return function(v) {
2583
- return step([
2584
- n,
2585
- v
2586
- ]);
2587
- };
2588
- }
2589
- function step(op) {
2590
- if (f) throw new TypeError("Generator is already executing.");
2591
- while(_)try {
2592
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2593
- if (y = 0, t) op = [
2594
- op[0] & 2,
2595
- t.value
2596
- ];
2597
- switch(op[0]){
2598
- case 0:
2599
- case 1:
2600
- t = op;
2601
- break;
2602
- case 4:
2603
- _.label++;
2604
- return {
2605
- value: op[1],
2606
- done: false
2607
- };
2608
- case 5:
2609
- _.label++;
2610
- y = op[1];
2611
- op = [
2612
- 0
2613
- ];
2614
- continue;
2615
- case 7:
2616
- op = _.ops.pop();
2617
- _.trys.pop();
2618
- continue;
2619
- default:
2620
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
2621
- _ = 0;
2622
- continue;
2623
- }
2624
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
2625
- _.label = op[1];
2626
- break;
2627
- }
2628
- if (op[0] === 6 && _.label < t[1]) {
2629
- _.label = t[1];
2630
- t = op;
2631
- break;
2632
- }
2633
- if (t && _.label < t[2]) {
2634
- _.label = t[2];
2635
- _.ops.push(op);
2636
- break;
2637
- }
2638
- if (t[2]) _.ops.pop();
2639
- _.trys.pop();
2640
- continue;
2641
- }
2642
- op = body.call(thisArg, _);
2643
- } catch (e) {
2644
- op = [
2645
- 6,
2646
- e
2647
- ];
2648
- y = 0;
2649
- } finally{
2650
- f = t = 0;
2651
- }
2652
- if (op[0] & 5) throw op[1];
2653
- return {
2654
- value: op[0] ? op[1] : void 0,
2655
- done: true
2656
- };
2657
- }
2658
- }
2659
- function useLogoutFlow(param) {
2660
- var kratosClient = param.kratosClient, returnTo = param.returnTo, onLoggedOut = param.onLoggedOut;
2661
- var logout = useCallback(/*#__PURE__*/ _async_to_generator(function() {
2662
- var flow;
2663
- return _ts_generator(this, function(_state) {
2664
- switch(_state.label){
2665
- case 0:
2666
- return [
2667
- 4,
2668
- kratosClient.createBrowserLogoutFlow(undefined, {
2669
- params: {
2670
- return_url: "/"
2671
- }
2672
- })
2673
- ];
2674
- case 1:
2675
- flow = _state.sent();
2676
- kratosClient.updateLogoutFlow({
2677
- returnTo: returnTo,
2678
- token: flow.data.logout_token
2679
- }).then(function() {
2680
- onLoggedOut === null || onLoggedOut === void 0 ? void 0 : onLoggedOut();
2681
- }).catch(function(err) {
2682
- var _err_response;
2683
- if (((_err_response = err.response) === null || _err_response === void 0 ? void 0 : _err_response.status) === 400) {
2684
- return;
2685
- }
2686
- return Promise.reject(err);
2687
- });
2688
- return [
2689
- 2
2690
- ];
2691
- }
2692
- });
2693
- }), [
2694
- kratosClient,
2695
- returnTo,
2696
- onLoggedOut
2697
- ]);
2698
- return {
2699
- logout: logout
2700
- };
2701
- }
2702
-
2703
- function getNodeInputType(attr) {
2704
- return attr && typeof attr === "object" && "type" in attr && attr.type && typeof attr.type === "string" ? attr.type : "";
2705
- }
2706
-
2707
- /**
2708
- * Filters nodes by their groups and attributes.
2709
- * If no filtering options are specified, all nodes are returned.
2710
- * Will always add default nodes unless `withoutDefaultGroup` is true.
2711
- * Will always add default attributes unless `withoutDefaultAttributes` is true.
2712
- * @param {Object} filterNodesByGroups - An object containing the nodes and the filtering options.
2713
- * @param {Array<UiNode>} filterNodesByGroups.nodes - An array of nodes.
2714
- * @param {Array<UiNodeGroupEnum | string> | string} filterNodesByGroups.groups - An array or comma seperated strings of groups to filter by.
2715
- * @param {boolean} filterNodesByGroups.withoutDefaultGroup - If true, will not add default nodes under the 'default' category.
2716
- * @param {Array<UiNodeInputAttributesTypeEnum | string> | string} filterNodesByGroups.attributes - An array or comma seperated strings of attributes to filter by.
2717
- * @param {boolean} filterNodesByGroups.withoutDefaultAttributes - If true, will not add default attributes such as 'hidden' and 'script'.
2718
- */ var filterNodesByGroups = function(param) {
2719
- var nodes = param.nodes, groups = param.groups, withoutDefaultGroup = param.withoutDefaultGroup, attributes = param.attributes, withoutDefaultAttributes = param.withoutDefaultAttributes, excludeAttributes = param.excludeAttributes;
2720
- return nodes.filter(function(param) {
2721
- var group = param.group, attr = param.attributes;
2722
- // if we have not specified any group or attribute filters, return all nodes
2723
- if (!groups && !attributes && !excludeAttributes) return true;
2724
- var g = search(groups);
2725
- if (!withoutDefaultGroup) {
2726
- g.push(UiNodeGroupEnum.Default);
2727
- }
2728
- // filter the attributes
2729
- var a = search(attributes);
2730
- if (!withoutDefaultAttributes) {
2731
- // always add hidden fields e.g. csrf
2732
- if (group.includes(UiNodeGroupEnum.Default)) {
2733
- a.push("hidden");
2734
- }
2735
- // automatically add the necessary fields for webauthn and totp
2736
- if (group.includes(UiNodeGroupEnum.Webauthn) || group.includes(UiNodeGroupEnum.Totp)) {
2737
- a.push("input", "script");
2738
- }
2739
- }
2740
- // filter the attributes to exclude
2741
- var ea = search(excludeAttributes);
2742
- var filterGroup = groups ? g.includes(group) : true;
2743
- var filterAttributes = attributes ? a.includes(getNodeInputType(attr)) : true;
2744
- var filterExcludeAttributes = excludeAttributes ? !ea.includes(getNodeInputType(attr)) : true;
2745
- return filterGroup && filterAttributes && filterExcludeAttributes;
2746
- });
2747
- };
2748
- function search(s) {
2749
- if (s !== undefined && typeof s === "string") return s.split(",");
2750
- return s !== null && s !== void 0 ? s : [];
2751
- }
2752
-
2753
- var getNodeLabel = function(node) {
2754
- var attributes = node.attributes;
2755
- if (isUiNodeAnchorAttributes(attributes)) {
2756
- return attributes.title;
2757
- }
2758
- if (isUiNodeImageAttributes(attributes)) {
2759
- return node.meta.label;
2760
- }
2761
- if (isUiNodeInputAttributes(attributes) && attributes.label) {
2762
- return attributes.label;
2763
- }
2764
- return node.meta.label;
2765
- };
2766
-
2767
- function _define_property$a(obj, key, value) {
2768
- if (key in obj) {
2769
- Object.defineProperty(obj, key, {
2770
- value: value,
2771
- enumerable: true,
2772
- configurable: true,
2773
- writable: true
2774
- });
2775
- } else {
2776
- obj[key] = value;
2777
- }
2778
- return obj;
2779
- }
2780
- function _object_spread$a(target) {
2781
- for(var i = 1; i < arguments.length; i++){
2782
- var source = arguments[i] != null ? arguments[i] : {};
2783
- var ownKeys = Object.keys(source);
2784
- if (typeof Object.getOwnPropertySymbols === "function") {
2785
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2786
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2787
- }));
2788
- }
2789
- ownKeys.forEach(function(key) {
2790
- _define_property$a(target, key, source[key]);
2791
- });
2792
- }
2793
- return target;
2794
- }
2795
- function Node(param) {
2796
- var node = param.node, className = param.className;
2797
- var _useKratosContext = useKratosContext(), _useKratosContext_components = _useKratosContext.components, Image = _useKratosContext_components.Image, Text = _useKratosContext_components.Text, Link = _useKratosContext_components.Link, Input = _useKratosContext_components.Input, Button = _useKratosContext_components.Button, Checkbox = _useKratosContext_components.Checkbox;
2798
- if (isUiNodeImageAttributes(node.attributes)) {
2799
- return /*#__PURE__*/ jsx(Image, {
2800
- header: /*#__PURE__*/ jsx(FormattedMessage, {
2801
- message: node.meta.label
2802
- }),
2803
- height: node.attributes.height,
2804
- node: node,
2805
- src: node.attributes.src,
2806
- width: node.attributes.width
2807
- });
2808
- } else if (isUiNodeTextAttributes(node.attributes)) {
2809
- return /*#__PURE__*/ jsx(Text, {
2810
- attributes: node.attributes,
2811
- codes: isUiNodeTextSecretsAttributes(node.attributes) ? node.attributes.text.context.secrets.map(function(text) {
2812
- return text;
2813
- }) : [
2814
- node.attributes.text
2815
- ],
2816
- id: node.attributes.id,
2817
- label: /*#__PURE__*/ jsx(FormattedMessage, {
2818
- message: node.meta.label
2819
- }),
2820
- node: node
2821
- });
2822
- } else if (isUiNodeInputAttributes(node.attributes)) {
2823
- var attrs = node.attributes;
2824
- var nodeType = attrs.type;
2825
- switch(nodeType){
2826
- case "button":
2827
- case "submit":
2828
- {
2829
- var _node_meta_label;
2830
- var isSocial = (attrs.name === "provider" || attrs.name === "link") && node.group === UiNodeGroupEnum.Oidc;
2831
- var submit = {
2832
- type: attrs.type,
2833
- name: attrs.name
2834
- };
2835
- if (attrs.value) {
2836
- submit.value = attrs.value;
2837
- }
2838
- if (isSocial) {
2839
- submit.formNoValidate = true;
2840
- submit.onClick = function(e) {
2841
- e.currentTarget.type = "submit";
2842
- e.currentTarget.dispatchEvent(new Event("submit", {
2843
- cancelable: true,
2844
- bubbles: true
2845
- }));
2846
- };
2847
- }
2848
- if (attrs.onclick) {
2849
- // This is a bit hacky but it wouldn't work otherwise.
2850
- var oc = attrs.onclick;
2851
- submit.onClick = function() {
2852
- // eslint-disable-next-line no-eval
2853
- eval(oc);
2854
- };
2855
- }
2856
- // the recovery code resend button
2857
- if (((_node_meta_label = node.meta.label) === null || _node_meta_label === void 0 ? void 0 : _node_meta_label.id) === 1070008) {
2858
- // on html forms the required flag on an input field will prevent the form from submitting.
2859
- // we disable validation for this form since the resend button does not rely on any input fields
2860
- submit.formNoValidate = true;
2861
- }
2862
- return /*#__PURE__*/ jsx(Button, _object_spread$a({
2863
- fullWidth: true,
2864
- className: className,
2865
- disabled: attrs.disabled,
2866
- header: /*#__PURE__*/ jsx(FormattedMessage, {
2867
- message: getNodeLabel(node)
2868
- }),
2869
- node: node,
2870
- social: isSocial ? attrs.value.toLowerCase() : undefined
2871
- }, submit));
2872
- }
2873
- case "datetime-local":
2874
- case "checkbox":
2875
- return /*#__PURE__*/ jsx(Checkbox, {
2876
- className: className,
2877
- defaultChecked: Boolean(attrs.value),
2878
- disabled: attrs.disabled,
2879
- helperMessage: /*#__PURE__*/ jsx(NodeMessages, {
2880
- nodes: [
2881
- node
2882
- ]
2883
- }),
2884
- isError: node.messages.length > 0,
2885
- label: /*#__PURE__*/ jsx(FormattedMessage, {
2886
- message: getNodeLabel(node)
2887
- }),
2888
- name: attrs.name,
2889
- node: node,
2890
- required: attrs.required,
2891
- value: "true"
2892
- });
2893
- default:
2894
- var _attrs_autocomplete;
2895
- return /*#__PURE__*/ jsx(Input, {
2896
- autoComplete: (_attrs_autocomplete = attrs.autocomplete) !== null && _attrs_autocomplete !== void 0 ? _attrs_autocomplete : attrs.name === "identifier" ? "username" : undefined,
2897
- className: className,
2898
- defaultValue: attrs.value,
2899
- disabled: attrs.disabled,
2900
- header: /*#__PURE__*/ jsx(FormattedMessage, {
2901
- message: getNodeLabel(node)
2902
- }),
2903
- helperMessage: /*#__PURE__*/ jsx(NodeMessages, {
2904
- nodes: [
2905
- node
2906
- ]
2907
- }),
2908
- isError: node.messages.length > 0,
2909
- name: attrs.name,
2910
- node: node,
2911
- pattern: attrs.pattern,
2912
- required: attrs.required,
2913
- type: attrs.type
2914
- });
2915
- }
2916
- } else if (isUiNodeAnchorAttributes(node.attributes)) {
2917
- return /*#__PURE__*/ jsx(Link, {
2918
- className: className,
2919
- href: node.attributes.href,
2920
- node: node,
2921
- children: /*#__PURE__*/ jsx(FormattedMessage, {
2922
- message: node.attributes.title
2923
- })
2924
- });
2925
- }
2926
- return null;
2927
- }
2928
-
2929
- function _define_property$9(obj, key, value) {
2930
- if (key in obj) {
2931
- Object.defineProperty(obj, key, {
2932
- value: value,
2933
- enumerable: true,
2934
- configurable: true,
2935
- writable: true
2936
- });
2937
- } else {
2938
- obj[key] = value;
2939
- }
2940
- return obj;
2941
- }
2942
- function _object_spread$9(target) {
2943
- for(var i = 1; i < arguments.length; i++){
2944
- var source = arguments[i] != null ? arguments[i] : {};
2945
- var ownKeys = Object.keys(source);
2946
- if (typeof Object.getOwnPropertySymbols === "function") {
2947
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2948
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2949
- }));
2950
- }
2951
- ownKeys.forEach(function(key) {
2952
- _define_property$9(target, key, source[key]);
2953
- });
2954
- }
2955
- return target;
2956
- }
2957
- function _object_without_properties$1(source, excluded) {
2958
- if (source == null) return {};
2959
- var target = _object_without_properties_loose$1(source, excluded);
2960
- var key, i;
2961
- if (Object.getOwnPropertySymbols) {
2962
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2963
- for(i = 0; i < sourceSymbolKeys.length; i++){
2964
- key = sourceSymbolKeys[i];
2965
- if (excluded.indexOf(key) >= 0) continue;
2966
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2967
- target[key] = source[key];
2968
- }
2969
- }
2970
- return target;
2971
- }
2972
- function _object_without_properties_loose$1(source, excluded) {
2973
- if (source == null) return {};
2974
- var target = {};
2975
- var sourceKeys = Object.keys(source);
2976
- var key, i;
2977
- for(i = 0; i < sourceKeys.length; i++){
2978
- key = sourceKeys[i];
2979
- if (excluded.indexOf(key) >= 0) continue;
2980
- target[key] = source[key];
2981
- }
2982
- return target;
2983
- }
2984
- function FilterFlowNodes(_param) {
2985
- var filter = _param.filter, includeCSRF = _param.includeCSRF, overrides = _object_without_properties$1(_param, [
2986
- "filter",
2987
- "includeCSRF"
2988
- ]);
2989
- var getInputName = function(node) {
2990
- return isUiNodeInputAttributes(node.attributes) ? node.attributes.name : "";
2991
- };
2992
- var nodes = filterNodesByGroups(filter)// we don't want to map the csrf token every time, only on the form level
2993
- .filter(function(node) {
2994
- return includeCSRF || !(getInputName(node) === "csrf_token");
2995
- }).map(function(node, k) {
2996
- return {
2997
- node: /*#__PURE__*/ jsx(Node, _object_spread$9({
2998
- node: node
2999
- }, overrides), isUiNodeInputAttributes(node.attributes) ? (node.attributes.type === "button" || node.attributes.type === "submit") && node.attributes.value ? "".concat(node.attributes.name, "_").concat(node.attributes.value) : node.attributes.name : isUiNodeImageAttributes(node.attributes) ? node.attributes.src : isUiNodeAnchorAttributes(node.attributes) || isUiNodeTextAttributes(node.attributes) || isUiNodeScriptAttributes(node.attributes) ? node.attributes.id : k),
3000
- hidden: getNodeInputType(node.attributes) === "hidden"
3001
- };
3002
- });
3003
- if (nodes.length === 0) return null;
3004
- return /*#__PURE__*/ jsx(Fragment, {
3005
- children: nodes.map(function(node) {
3006
- return node.node;
3007
- })
3008
- });
3009
- }
3010
-
3011
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ function _define_property$8(obj, key, value) {
3012
- if (key in obj) {
3013
- Object.defineProperty(obj, key, {
3014
- value: value,
3015
- enumerable: true,
3016
- configurable: true,
3017
- writable: true
3018
- });
3019
- } else {
3020
- obj[key] = value;
3021
- }
3022
- return obj;
3023
- }
3024
- function _object_spread$8(target) {
3025
- for(var i = 1; i < arguments.length; i++){
3026
- var source = arguments[i] != null ? arguments[i] : {};
3027
- var ownKeys = Object.keys(source);
3028
- if (typeof Object.getOwnPropertySymbols === "function") {
3029
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3030
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3031
- }));
3032
- }
3033
- ownKeys.forEach(function(key) {
3034
- _define_property$8(target, key, source[key]);
3035
- });
3036
- }
3037
- return target;
3038
- }
3039
- function ownKeys$7(object, enumerableOnly) {
3040
- var keys = Object.keys(object);
3041
- if (Object.getOwnPropertySymbols) {
3042
- var symbols = Object.getOwnPropertySymbols(object);
3043
- keys.push.apply(keys, symbols);
3044
- }
3045
- return keys;
3046
- }
3047
- function _object_spread_props$7(target, source) {
3048
- source = source != null ? source : {};
3049
- if (Object.getOwnPropertyDescriptors) {
3050
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3051
- } else {
3052
- ownKeys$7(Object(source)).forEach(function(key) {
3053
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3054
- });
3055
- }
3056
- return target;
3057
- }
3058
- function _object_without_properties(source, excluded) {
3059
- if (source == null) return {};
3060
- var target = _object_without_properties_loose(source, excluded);
3061
- var key, i;
3062
- if (Object.getOwnPropertySymbols) {
3063
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
3064
- for(i = 0; i < sourceSymbolKeys.length; i++){
3065
- key = sourceSymbolKeys[i];
3066
- if (excluded.indexOf(key) >= 0) continue;
3067
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3068
- target[key] = source[key];
3069
- }
3070
- }
3071
- return target;
3072
- }
3073
- function _object_without_properties_loose(source, excluded) {
3074
- if (source == null) return {};
3075
- var target = {};
3076
- var sourceKeys = Object.keys(source);
3077
- var key, i;
3078
- for(i = 0; i < sourceKeys.length; i++){
3079
- key = sourceKeys[i];
3080
- if (excluded.indexOf(key) >= 0) continue;
3081
- target[key] = source[key];
3082
- }
3083
- return target;
3084
- }
3085
- /**
3086
- * UserAuthForm is a component that renders a form for a given Ory flow.
3087
- * It automatically adds the form action and method and adds csrf tokens to the form.
3088
- * When the `onSubmit` parameter is passed, it also automatically maps the form data to the request body and prevents native form submits.
3089
- * @see UserAuthFormProps
3090
- * @returns JSX.Element
3091
- */ function UserAuthForm(_param) {
3092
- var flow = _param.flow, children = _param.children, submitOnEnter = _param.submitOnEnter, onSubmit = _param.onSubmit, formFilterOverride = _param.formFilterOverride, props = _object_without_properties(_param, [
3093
- "flow",
3094
- "children",
3095
- "submitOnEnter",
3096
- "onSubmit",
3097
- "formFilterOverride"
3098
- ]);
3099
- return /*#__PURE__*/ jsxs("form", _object_spread_props$7(_object_spread$8({
3100
- noValidate: true,
3101
- action: flow.ui.action,
3102
- method: flow.ui.method,
3103
- onKeyDown: function(e) {
3104
- if (e.key === "Enter" && !submitOnEnter) {
3105
- e.stopPropagation();
3106
- e.preventDefault();
3107
- }
3108
- }
3109
- }, onSubmit && {
3110
- onSubmit: function(event) {
3111
- event.preventDefault();
3112
- var form = event.currentTarget;
3113
- var formData = new FormData(form);
3114
- // map the entire form data to JSON for the request body
3115
- var body = Object.fromEntries(formData);
3116
- // We need the method specified from the name and value of the submit button.
3117
- // when multiple submit buttons are present, the clicked one's value is used.
3118
- if ("submitter" in event.nativeEvent) {
3119
- var method = event.nativeEvent.submitter;
3120
- body = _object_spread$8({}, body, _define_property$8({}, method.name, method.value));
3121
- }
3122
- onSubmit({
3123
- body: body,
3124
- event: event
3125
- });
3126
- }
3127
- }, props), {
3128
- children: [
3129
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3130
- includeCSRF: true,
3131
- filter: formFilterOverride !== null && formFilterOverride !== void 0 ? formFilterOverride : {
3132
- nodes: flow.ui.nodes,
3133
- groups: UiNodeGroupEnum.Default,
3134
- attributes: "hidden"
3135
- }
3136
- }),
3137
- children
3138
- ]
3139
- }));
3140
- }
3141
-
3142
- function _array_like_to_array(arr, len) {
3143
- if (len == null || len > arr.length) len = arr.length;
3144
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3145
- return arr2;
3146
- }
3147
- function _array_without_holes(arr) {
3148
- if (Array.isArray(arr)) return _array_like_to_array(arr);
3149
- }
3150
- function _iterable_to_array(iter) {
3151
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3152
- }
3153
- function _non_iterable_spread() {
3154
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3155
- }
3156
- function _to_consumable_array(arr) {
3157
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
3158
- }
3159
- function _unsupported_iterable_to_array(o, minLen) {
3160
- if (!o) return;
3161
- if (typeof o === "string") return _array_like_to_array(o, minLen);
3162
- var n = Object.prototype.toString.call(o).slice(8, -1);
3163
- if (n === "Object" && o.constructor) n = o.constructor.name;
3164
- if (n === "Map" || n === "Set") return Array.from(n);
3165
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
3166
- }
3167
- function useScriptNodes(param) {
3168
- var nodes = param.nodes, excludeScripts = param.excludeScripts;
3169
- useEffect(function() {
3170
- if (excludeScripts) {
3171
- return;
3172
- }
3173
- var scriptNodes = filterNodesByGroups({
3174
- nodes: nodes,
3175
- groups: UiNodeGroupEnum.Webauthn,
3176
- attributes: "text/javascript",
3177
- withoutDefaultGroup: true,
3178
- withoutDefaultAttributes: true
3179
- }).reduce(function(accumulator, node) {
3180
- var attr = node.attributes;
3181
- if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
3182
- return accumulator;
3183
- }
3184
- var script = document.createElement("script");
3185
- script.src = attr.src;
3186
- script.type = attr.type;
3187
- script.async = attr.async;
3188
- script.referrerPolicy = attr.referrerpolicy;
3189
- script.crossOrigin = attr.crossorigin;
3190
- script.integrity = attr.integrity;
3191
- document.body.appendChild(script);
3192
- return _to_consumable_array(accumulator).concat([
3193
- script
3194
- ]);
3195
- }, []);
3196
- return function() {
3197
- scriptNodes.forEach(function(script) {
3198
- document.body.removeChild(script);
3199
- });
3200
- };
3201
- }, [
3202
- excludeScripts,
3203
- nodes
3204
- ]);
3205
- }
3206
-
3207
- function hasOidc(nodes) {
3208
- return nodes.some(function(param) {
3209
- var group = param.group;
3210
- return group === UiNodeGroupEnum.Oidc;
3211
- });
3212
- }
3213
- function hasPassword(nodes) {
3214
- return nodes.some(function(param) {
3215
- var group = param.group;
3216
- return group === UiNodeGroupEnum.Password;
3217
- });
3218
- }
3219
- function hasDefault(nodes) {
3220
- return nodes.some(function(param) {
3221
- var group = param.group;
3222
- return group === UiNodeGroupEnum.Default;
3223
- });
3224
- }
3225
- function hasProfile(nodes) {
3226
- return nodes.some(function(param) {
3227
- var group = param.group;
3228
- return group === UiNodeGroupEnum.Profile;
3229
- });
3230
- }
3231
- function hasPasskey(nodes) {
3232
- return nodes.some(function(param) {
3233
- var group = param.group;
3234
- return group === UiNodeGroupEnum.Passkey;
3235
- });
3236
- }
3237
- function hasIdentifierFirst(nodes) {
3238
- return nodes.some(function(param) {
3239
- var group = param.group;
3240
- return group === UiNodeGroupEnum.IdentifierFirst;
3241
- });
3242
- }
3243
- function hasLookupSecret(nodes) {
3244
- return nodes.some(function(param) {
3245
- var group = param.group;
3246
- return group === UiNodeGroupEnum.LookupSecret;
3247
- });
3248
- }
3249
- function hasTotp(nodes) {
3250
- return nodes.some(function(param) {
3251
- var group = param.group;
3252
- return group === UiNodeGroupEnum.Totp;
3253
- });
3254
- }
3255
- function hasCode(nodes) {
3256
- return nodes.some(function(param) {
3257
- var group = param.group;
3258
- return group === UiNodeGroupEnum.Code;
3259
- });
3260
- }
3261
-
3262
- /**
3263
- * AuthCodeSection renders the fields for login and registration via one-time code.
3264
- * Please see the Ory docs for more information: https://www.ory.sh/docs/kratos/passwordless/one-time-code
3265
- * @param nodes - Ory UiNode[]
3266
- * @see AuthCodeSectionProps
3267
- */ function AuthCodeSection(param) {
3268
- var nodes = param.nodes, AuthCodeSectionWrapper = param.AuthCodeSectionWrapper;
3269
- if (!hasCode(nodes)) return null;
3270
- return /*#__PURE__*/ jsxs(AuthCodeSectionWrapper, {
3271
- children: [
3272
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3273
- filter: {
3274
- nodes: nodes,
3275
- groups: UiNodeGroupEnum.Code,
3276
- // we don't want to map the default group twice
3277
- // the form already maps hidden fields under the default group
3278
- // we are only interested in hidden fields that are under the code group
3279
- withoutDefaultGroup: true,
3280
- withoutDefaultAttributes: true,
3281
- attributes: [
3282
- "hidden"
3283
- ]
3284
- }
3285
- }),
3286
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3287
- filter: {
3288
- nodes: nodes,
3289
- groups: UiNodeGroupEnum.Code,
3290
- withoutDefaultAttributes: true,
3291
- excludeAttributes: [
3292
- "hidden",
3293
- "button",
3294
- "submit"
3295
- ]
3296
- }
3297
- }),
3298
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3299
- filter: {
3300
- nodes: nodes,
3301
- groups: UiNodeGroupEnum.Code,
3302
- withoutDefaultAttributes: true,
3303
- attributes: [
3304
- "button",
3305
- "submit"
3306
- ]
3307
- }
3308
- })
3309
- ]
3310
- });
3311
- }
3312
-
3313
- function IdentifierFirstLoginSection(param) {
3314
- var nodes = param.nodes, IdentifierFirstLoginSectionWrapper = param.IdentifierFirstLoginSectionWrapper;
3315
- return /*#__PURE__*/ jsxs(IdentifierFirstLoginSectionWrapper, {
3316
- children: [
3317
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3318
- filter: {
3319
- nodes: nodes,
3320
- groups: [
3321
- UiNodeGroupEnum.Default,
3322
- UiNodeGroupEnum.IdentifierFirst
3323
- ],
3324
- excludeAttributes: [
3325
- "submit",
3326
- "hidden"
3327
- ]
3328
- }
3329
- }),
3330
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3331
- filter: {
3332
- nodes: nodes,
3333
- groups: UiNodeGroupEnum.IdentifierFirst,
3334
- attributes: "submit"
3335
- }
3336
- })
3337
- ]
3338
- });
3339
- }
3340
-
3341
- /**
3342
- * LinkSection renders the fields for recovery and verification
3343
- * Please see the Ory docs for more information:
3344
- * - https://www.ory.sh/docs/kratos/self-service/flows/account-recovery-password-reset
3345
- * - https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation
3346
- */ function LinkSection(param) {
3347
- var nodes = param.nodes, LinkSectionWrapper = param.LinkSectionWrapper;
3348
- return /*#__PURE__*/ jsxs(LinkSectionWrapper, {
3349
- children: [
3350
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3351
- filter: {
3352
- nodes: nodes,
3353
- groups: [
3354
- UiNodeGroupEnum.Link,
3355
- UiNodeGroupEnum.Code
3356
- ],
3357
- excludeAttributes: "submit"
3358
- }
3359
- }),
3360
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3361
- filter: {
3362
- nodes: nodes,
3363
- groups: [
3364
- UiNodeGroupEnum.Link,
3365
- UiNodeGroupEnum.Code
3366
- ],
3367
- attributes: "submit"
3368
- }
3369
- })
3370
- ]
3371
- });
3372
- }
3373
-
3374
- function LoginSection(param) {
3375
- var nodes = param.nodes, LoginSectionWrapper = param.LoginSectionWrapper;
3376
- if (!hasPassword(nodes)) return null;
3377
- return /*#__PURE__*/ jsxs(LoginSectionWrapper, {
3378
- children: [
3379
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3380
- filter: {
3381
- nodes: nodes,
3382
- groups: [
3383
- UiNodeGroupEnum.Default,
3384
- UiNodeGroupEnum.Password
3385
- ],
3386
- excludeAttributes: [
3387
- "submit",
3388
- "hidden"
3389
- ]
3390
- }
3391
- }),
3392
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3393
- filter: {
3394
- nodes: nodes,
3395
- groups: UiNodeGroupEnum.Password,
3396
- attributes: "submit"
3397
- }
3398
- })
3399
- ]
3400
- });
3401
- }
3402
-
3403
- function OidcSection(param) {
3404
- var flow = param.flow, OidcSectionWrapper = param.OidcSectionWrapper;
3405
- if (!hasOidc(flow.ui.nodes)) return null;
3406
- var hasOidcTraits = filterNodesByGroups({
3407
- nodes: flow.ui.nodes,
3408
- groups: UiNodeGroupEnum.Oidc,
3409
- withoutDefaultGroup: true,
3410
- excludeAttributes: "submit"
3411
- }).length > 0;
3412
- return /*#__PURE__*/ jsxs(OidcSectionWrapper, {
3413
- children: [
3414
- hasOidcTraits && /*#__PURE__*/ jsx(FilterFlowNodes, {
3415
- filter: {
3416
- nodes: flow.ui.nodes,
3417
- groups: UiNodeGroupEnum.Oidc,
3418
- withoutDefaultGroup: true,
3419
- excludeAttributes: "submit"
3420
- }
3421
- }),
3422
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3423
- filter: {
3424
- nodes: flow.ui.nodes,
3425
- groups: UiNodeGroupEnum.Oidc,
3426
- attributes: "submit"
3427
- }
3428
- })
3429
- ]
3430
- });
3431
- }
3432
-
3433
- function _define_property$7(obj, key, value) {
3434
- if (key in obj) {
3435
- Object.defineProperty(obj, key, {
3436
- value: value,
3437
- enumerable: true,
3438
- configurable: true,
3439
- writable: true
3440
- });
3441
- } else {
3442
- obj[key] = value;
3443
- }
3444
- return obj;
3445
- }
3446
- function _object_spread$7(target) {
3447
- for(var i = 1; i < arguments.length; i++){
3448
- var source = arguments[i] != null ? arguments[i] : {};
3449
- var ownKeys = Object.keys(source);
3450
- if (typeof Object.getOwnPropertySymbols === "function") {
3451
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3452
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3453
- }));
3454
- }
3455
- ownKeys.forEach(function(key) {
3456
- _define_property$7(target, key, source[key]);
3457
- });
3458
- }
3459
- return target;
3460
- }
3461
- function ownKeys$6(object, enumerableOnly) {
3462
- var keys = Object.keys(object);
3463
- if (Object.getOwnPropertySymbols) {
3464
- var symbols = Object.getOwnPropertySymbols(object);
3465
- keys.push.apply(keys, symbols);
3466
- }
3467
- return keys;
3468
- }
3469
- function _object_spread_props$6(target, source) {
3470
- source = source != null ? source : {};
3471
- if (Object.getOwnPropertyDescriptors) {
3472
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3473
- } else {
3474
- ownKeys$6(Object(source)).forEach(function(key) {
3475
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3476
- });
3477
- }
3478
- return target;
3479
- }
3480
- function PasswordlessSection(param) {
3481
- var flow = param.flow, PasswordlessSectionWrapper = param.PasswordlessSectionWrapper;
3482
- if (!hasPasskey(flow.ui.nodes)) return null;
3483
- var filter = {
3484
- nodes: flow.ui.nodes,
3485
- groups: UiNodeGroupEnum.Passkey,
3486
- withoutDefaultAttributes: true
3487
- };
3488
- return /*#__PURE__*/ jsxs(PasswordlessSectionWrapper, {
3489
- children: [
3490
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3491
- filter: _object_spread_props$6(_object_spread$7({}, filter), {
3492
- groups: [
3493
- "identifier_first",
3494
- "passkey"
3495
- ],
3496
- attributes: [
3497
- "hidden"
3498
- ]
3499
- })
3500
- }),
3501
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3502
- filter: _object_spread_props$6(_object_spread$7({}, filter), {
3503
- excludeAttributes: [
3504
- "hidden",
3505
- "button",
3506
- "submit"
3507
- ]
3508
- })
3509
- }),
3510
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3511
- filter: _object_spread_props$6(_object_spread$7({}, filter), {
3512
- attributes: [
3513
- "button",
3514
- "submit"
3515
- ],
3516
- excludeAttributes: [
3517
- "hidden"
3518
- ]
3519
- })
3520
- })
3521
- ]
3522
- });
3523
- }
3524
-
3525
- function ProfileLoginSection(param) {
3526
- var nodes = param.nodes, ProfileLoginSectionWrapper = param.ProfileLoginSectionWrapper;
3527
- return /*#__PURE__*/ jsxs(ProfileLoginSectionWrapper, {
3528
- children: [
3529
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3530
- filter: {
3531
- nodes: nodes,
3532
- groups: UiNodeGroupEnum.Profile,
3533
- excludeAttributes: "submit,hidden"
3534
- }
3535
- }),
3536
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3537
- filter: {
3538
- nodes: nodes,
3539
- groups: UiNodeGroupEnum.Profile,
3540
- excludeAttributes: "hidden",
3541
- attributes: "submit"
3542
- }
3543
- })
3544
- ]
3545
- });
3546
- }
3547
-
3548
- function ProfileRegistrationSection(param) {
3549
- var nodes = param.nodes, ProfileRegistrationSectionWrapper = param.ProfileRegistrationSectionWrapper;
3550
- return /*#__PURE__*/ jsxs(ProfileRegistrationSectionWrapper, {
3551
- children: [
3552
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3553
- filter: {
3554
- nodes: nodes,
3555
- groups: UiNodeGroupEnum.Profile,
3556
- excludeAttributes: "submit,hidden"
3557
- }
3558
- }),
3559
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3560
- filter: {
3561
- nodes: nodes,
3562
- groups: UiNodeGroupEnum.Profile,
3563
- excludeAttributes: "hidden",
3564
- attributes: "submit"
3565
- }
3566
- })
3567
- ]
3568
- });
3569
- }
3570
-
3571
- function _define_property$6(obj, key, value) {
3572
- if (key in obj) {
3573
- Object.defineProperty(obj, key, {
3574
- value: value,
3575
- enumerable: true,
3576
- configurable: true,
3577
- writable: true
3578
- });
3579
- } else {
3580
- obj[key] = value;
3581
- }
3582
- return obj;
3583
- }
3584
- function _object_spread$6(target) {
3585
- for(var i = 1; i < arguments.length; i++){
3586
- var source = arguments[i] != null ? arguments[i] : {};
3587
- var ownKeys = Object.keys(source);
3588
- if (typeof Object.getOwnPropertySymbols === "function") {
3589
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3590
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3591
- }));
3592
- }
3593
- ownKeys.forEach(function(key) {
3594
- _define_property$6(target, key, source[key]);
3595
- });
3596
- }
3597
- return target;
3598
- }
3599
- function ownKeys$5(object, enumerableOnly) {
3600
- var keys = Object.keys(object);
3601
- if (Object.getOwnPropertySymbols) {
3602
- var symbols = Object.getOwnPropertySymbols(object);
3603
- keys.push.apply(keys, symbols);
3604
- }
3605
- return keys;
3606
- }
3607
- function _object_spread_props$5(target, source) {
3608
- source = source != null ? source : {};
3609
- if (Object.getOwnPropertyDescriptors) {
3610
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3611
- } else {
3612
- ownKeys$5(Object(source)).forEach(function(key) {
3613
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3614
- });
3615
- }
3616
- return target;
3617
- }
3618
- function RegistrationSection(param) {
3619
- var nodes = param.nodes, RegistrationSectionWrapper = param.RegistrationSectionWrapper;
3620
- if (!hasPassword(nodes)) return null;
3621
- var filter = {
3622
- nodes: nodes,
3623
- groups: UiNodeGroupEnum.Password
3624
- };
3625
- return /*#__PURE__*/ jsxs(RegistrationSectionWrapper, {
3626
- children: [
3627
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3628
- filter: _object_spread_props$5(_object_spread$6({}, filter), {
3629
- excludeAttributes: "submit,hidden"
3630
- })
3631
- }),
3632
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3633
- filter: _object_spread_props$5(_object_spread$6({}, filter), {
3634
- excludeAttributes: "hidden",
3635
- attributes: "submit"
3636
- })
3637
- })
3638
- ]
3639
- });
3640
- }
3641
-
3642
- function _define_property$5(obj, key, value) {
3643
- if (key in obj) {
3644
- Object.defineProperty(obj, key, {
3645
- value: value,
3646
- enumerable: true,
3647
- configurable: true,
3648
- writable: true
3649
- });
3650
- } else {
3651
- obj[key] = value;
3652
- }
3653
- return obj;
3654
- }
3655
- function _extends() {
3656
- _extends = Object.assign || function(target) {
3657
- for(var i = 1; i < arguments.length; i++){
3658
- var source = arguments[i];
3659
- for(var key in source){
3660
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3661
- target[key] = source[key];
3662
- }
3663
- }
3664
- }
3665
- return target;
3666
- };
3667
- return _extends.apply(this, arguments);
3668
- }
3669
- function _object_destructuring_empty(o) {
3670
- if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
3671
- return o;
3672
- }
3673
- function _object_spread$5(target) {
3674
- for(var i = 1; i < arguments.length; i++){
3675
- var source = arguments[i] != null ? arguments[i] : {};
3676
- var ownKeys = Object.keys(source);
3677
- if (typeof Object.getOwnPropertySymbols === "function") {
3678
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3679
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3680
- }));
3681
- }
3682
- ownKeys.forEach(function(key) {
3683
- _define_property$5(target, key, source[key]);
3684
- });
3685
- }
3686
- return target;
3687
- }
3688
- /**
3689
- * UserAuthCard renders a login, registration, verification or recovery flow
3690
- * it can also handle multi factor authentication on login flows
3691
- * @param UserAuthCardProps - a card that renders a login, registration, verification or recovery flow
3692
- * @returns JSX.Element
3693
- */ function UserAuthCard(param) {
3694
- var flow = param.flow, flowType = param.flowType, onSubmit = param.onSubmit, className = param.className;
3695
- var _useKratosContext = useKratosContext(), _useKratosContext_components = _useKratosContext.components, PasswordlessSectionWrapper = _useKratosContext_components.PasswordlessSectionWrapper, OidcSectionWrapper = _useKratosContext_components.OidcSectionWrapper, AuthCodeSectionWrapper = _useKratosContext_components.AuthCodeSectionWrapper, LoginSectionWrapper = _useKratosContext_components.LoginSectionWrapper, RegistrationSectionWrapper = _useKratosContext_components.RegistrationSectionWrapper, UiMessages = _useKratosContext_components.UiMessages, LinkSectionWrapper = _useKratosContext_components.LinkSectionWrapper, IdentifierFirstLoginSectionWrapper = _useKratosContext_components.IdentifierFirstLoginSectionWrapper, ProfileLoginSectionWrapper = _useKratosContext_components.ProfileLoginSectionWrapper, ProfileRegistrationSectionWrapper = _useKratosContext_components.ProfileRegistrationSectionWrapper, excludeScripts = _useKratosContext.excludeScripts;
3696
- useScriptNodes({
3697
- nodes: flow.ui.nodes,
3698
- excludeScripts: excludeScripts
3699
- });
3700
- var $flow = undefined;
3701
- var $oidc = undefined;
3702
- var $code = undefined;
3703
- var $passkey = undefined;
3704
- var $twoStep = undefined;
3705
- var $profile = undefined;
3706
- // the current flow is a two factor flow if the user is logged in and has any of the second factor methods enabled.
3707
- var isTwoFactor = flowType === "login" && isLoggedIn(flow) && (hasTotp(flow.ui.nodes) || hasPasskey(flow.ui.nodes) || hasLookupSecret(flow.ui.nodes));
3708
- // This array contains all the 2fa flows mapped to their own respective forms.
3709
- var twoFactorFlows = isTwoFactor && [
3710
- hasPasskey(flow.ui.nodes) && /*#__PURE__*/ jsx(UserAuthForm, {
3711
- flow: flow,
3712
- children: /*#__PURE__*/ jsx(FilterFlowNodes, {
3713
- filter: {
3714
- nodes: flow.ui.nodes,
3715
- groups: UiNodeGroupEnum.Passkey,
3716
- withoutDefaultGroup: true
3717
- }
3718
- })
3719
- }),
3720
- hasPassword(flow.ui.nodes) && /*#__PURE__*/ jsx(UserAuthForm, {
3721
- flow: flow,
3722
- children: /*#__PURE__*/ jsx(FilterFlowNodes, {
3723
- filter: {
3724
- nodes: flow.ui.nodes,
3725
- groups: UiNodeGroupEnum.Password,
3726
- withoutDefaultGroup: true
3727
- }
3728
- })
3729
- }),
3730
- hasProfile(flow.ui.nodes) && /*#__PURE__*/ jsx(UserAuthForm, {
3731
- flow: flow,
3732
- children: /*#__PURE__*/ jsx(FilterFlowNodes, {
3733
- filter: {
3734
- nodes: flow.ui.nodes,
3735
- groups: UiNodeGroupEnum.Profile,
3736
- withoutDefaultGroup: true
3737
- }
3738
- })
3739
- }),
3740
- hasTotp(flow.ui.nodes) && /*#__PURE__*/ jsxs(UserAuthForm, {
3741
- submitOnEnter: true,
3742
- flow: flow,
3743
- onSubmit: onSubmit,
3744
- children: [
3745
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3746
- filter: {
3747
- nodes: flow.ui.nodes,
3748
- groups: UiNodeGroupEnum.Totp,
3749
- withoutDefaultGroup: true,
3750
- excludeAttributes: "submit"
3751
- }
3752
- }),
3753
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3754
- filter: {
3755
- nodes: flow.ui.nodes,
3756
- groups: UiNodeGroupEnum.Totp,
3757
- withoutDefaultGroup: true,
3758
- attributes: "submit"
3759
- }
3760
- })
3761
- ]
3762
- }),
3763
- hasLookupSecret(flow.ui.nodes) && /*#__PURE__*/ jsx(UserAuthForm, {
3764
- submitOnEnter: true,
3765
- flow: flow,
3766
- onSubmit: onSubmit,
3767
- children: /*#__PURE__*/ jsx(FilterFlowNodes, {
3768
- filter: {
3769
- nodes: flow.ui.nodes,
3770
- groups: UiNodeGroupEnum.LookupSecret,
3771
- withoutDefaultGroup: true
3772
- }
3773
- })
3774
- })
3775
- ].filter(Boolean) // remove nulls
3776
- ;
3777
- switch(flowType){
3778
- case "login":
3779
- $oidc = hasOidc(flow.ui.nodes) ? /*#__PURE__*/ jsx(OidcSection, {
3780
- flow: flow,
3781
- OidcSectionWrapper: OidcSectionWrapper
3782
- }) : undefined;
3783
- $passkey = hasPasskey(flow.ui.nodes) ? /*#__PURE__*/ jsx(PasswordlessSection, {
3784
- flow: flow,
3785
- PasswordlessSectionWrapper: PasswordlessSectionWrapper
3786
- }) : undefined;
3787
- $twoStep = hasIdentifierFirst(flow.ui.nodes) ? /*#__PURE__*/ jsx(IdentifierFirstLoginSection, {
3788
- IdentifierFirstLoginSectionWrapper: IdentifierFirstLoginSectionWrapper,
3789
- nodes: flow.ui.nodes
3790
- }) : undefined;
3791
- $profile = hasProfile(flow.ui.nodes) ? /*#__PURE__*/ jsx(ProfileLoginSection, {
3792
- nodes: flow.ui.nodes,
3793
- ProfileLoginSectionWrapper: ProfileLoginSectionWrapper
3794
- }) : undefined;
3795
- $flow = hasPassword(flow.ui.nodes) ? /*#__PURE__*/ jsx(LoginSection, {
3796
- LoginSectionWrapper: LoginSectionWrapper,
3797
- nodes: flow.ui.nodes
3798
- }) : undefined;
3799
- $code = hasCode(flow.ui.nodes) ? /*#__PURE__*/ jsx(AuthCodeSection, {
3800
- AuthCodeSectionWrapper: AuthCodeSectionWrapper,
3801
- nodes: flow.ui.nodes
3802
- }) : undefined;
3803
- break;
3804
- case "registration":
3805
- $passkey = hasPasskey(flow.ui.nodes) ? /*#__PURE__*/ jsx(PasswordlessSection, {
3806
- flow: flow,
3807
- PasswordlessSectionWrapper: PasswordlessSectionWrapper
3808
- }) : undefined;
3809
- $profile = hasProfile(flow.ui.nodes) ? /*#__PURE__*/ jsx(ProfileRegistrationSection, {
3810
- nodes: flow.ui.nodes,
3811
- ProfileRegistrationSectionWrapper: ProfileRegistrationSectionWrapper
3812
- }) : undefined;
3813
- $oidc = hasOidc(flow.ui.nodes) ? /*#__PURE__*/ jsx(OidcSection, {
3814
- flow: flow,
3815
- OidcSectionWrapper: OidcSectionWrapper
3816
- }) : undefined;
3817
- $code = hasCode(flow.ui.nodes) ? /*#__PURE__*/ jsx(AuthCodeSection, {
3818
- AuthCodeSectionWrapper: AuthCodeSectionWrapper,
3819
- nodes: flow.ui.nodes
3820
- }) : undefined;
3821
- $flow = hasDefault(flow.ui.nodes) || hasPassword(flow.ui.nodes) ? /*#__PURE__*/ jsx(RegistrationSection, {
3822
- nodes: flow.ui.nodes,
3823
- RegistrationSectionWrapper: RegistrationSectionWrapper
3824
- }) : undefined;
3825
- break;
3826
- // both verification and recovery use the same flow.
3827
- case "recovery":
3828
- case "verification":
3829
- $flow = /*#__PURE__*/ jsx(LinkSection, {
3830
- LinkSectionWrapper: LinkSectionWrapper,
3831
- nodes: flow.ui.nodes
3832
- });
3833
- break;
3834
- }
3835
- var canShowPasskey = !!$passkey && (!isLoggedIn(flow) || flowType === "registration");
3836
- var canShowProfile = !!$profile && hasProfile(flow.ui.nodes);
3837
- return /*#__PURE__*/ jsxs("div", {
3838
- className: className,
3839
- children: [
3840
- /*#__PURE__*/ jsx(UiMessages, {
3841
- uiMessages: flow.ui.messages
3842
- }),
3843
- $oidc && /*#__PURE__*/ jsx(UserAuthForm, {
3844
- flow: flow,
3845
- children: $oidc
3846
- }),
3847
- $twoStep && /*#__PURE__*/ jsx(UserAuthForm, {
3848
- flow: flow,
3849
- children: $twoStep
3850
- }),
3851
- canShowPasskey && /*#__PURE__*/ jsx(UserAuthForm, {
3852
- submitOnEnter: true,
3853
- flow: flow,
3854
- onSubmit: onSubmit,
3855
- children: $passkey
3856
- }),
3857
- $code && /*#__PURE__*/ jsx(UserAuthForm, {
3858
- flow: flow,
3859
- children: $code
3860
- }),
3861
- $flow && !isTwoFactor && /*#__PURE__*/ jsx(UserAuthForm, {
3862
- submitOnEnter: true,
3863
- flow: flow,
3864
- onSubmit: onSubmit,
3865
- children: $flow
3866
- }),
3867
- isTwoFactor && /*#__PURE__*/ jsxs(Fragment, {
3868
- children: [
3869
- /*#__PURE__*/ jsx(NodeMessages, {
3870
- nodes: filterNodesByGroups({
3871
- nodes: flow.ui.nodes,
3872
- groups: [
3873
- UiNodeGroupEnum.Password,
3874
- UiNodeGroupEnum.Webauthn,
3875
- UiNodeGroupEnum.Passkey,
3876
- UiNodeGroupEnum.Totp,
3877
- UiNodeGroupEnum.LookupSecret
3878
- ]
3879
- })
3880
- }),
3881
- twoFactorFlows
3882
- ]
3883
- }),
3884
- canShowProfile && /*#__PURE__*/ jsx(UserAuthForm, {
3885
- flow: flow,
3886
- children: $profile
3887
- })
3888
- ]
3889
- });
3890
- }
3891
- function mkCard(flowType) {
3892
- return function(_param) {
3893
- var props = _extends({}, _object_destructuring_empty(_param));
3894
- return /*#__PURE__*/ jsx(UserAuthCard, _object_spread$5({
3895
- flowType: flowType
3896
- }, props));
3897
- };
3898
- }
3899
- var LoginCard = mkCard("login");
3900
- var VerificationCard = mkCard("verification");
3901
- var RegistrationCard = mkCard("registration");
3902
- var RecoveryCard = mkCard("recovery");
3903
- // the user might need to logout on the second factor page.
3904
- function isLoggedIn(flow) {
3905
- if ("requested_aal" in flow && flow.requested_aal === AuthenticatorAssuranceLevel.Aal2) {
3906
- return true;
3907
- } else if ("refresh" in flow && flow.refresh) {
3908
- return true;
3909
- }
3910
- return false;
3911
- }
3912
-
3913
- function _define_property$4(obj, key, value) {
3914
- if (key in obj) {
3915
- Object.defineProperty(obj, key, {
3916
- value: value,
3917
- enumerable: true,
3918
- configurable: true,
3919
- writable: true
3920
- });
3921
- } else {
3922
- obj[key] = value;
3923
- }
3924
- return obj;
3925
- }
3926
- function _object_spread$4(target) {
3927
- for(var i = 1; i < arguments.length; i++){
3928
- var source = arguments[i] != null ? arguments[i] : {};
3929
- var ownKeys = Object.keys(source);
3930
- if (typeof Object.getOwnPropertySymbols === "function") {
3931
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3932
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3933
- }));
3934
- }
3935
- ownKeys.forEach(function(key) {
3936
- _define_property$4(target, key, source[key]);
3937
- });
3938
- }
3939
- return target;
3940
- }
3941
- function ownKeys$4(object, enumerableOnly) {
3942
- var keys = Object.keys(object);
3943
- if (Object.getOwnPropertySymbols) {
3944
- var symbols = Object.getOwnPropertySymbols(object);
3945
- keys.push.apply(keys, symbols);
3946
- }
3947
- return keys;
3948
- }
3949
- function _object_spread_props$4(target, source) {
3950
- source = source != null ? source : {};
3951
- if (Object.getOwnPropertyDescriptors) {
3952
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3953
- } else {
3954
- ownKeys$4(Object(source)).forEach(function(key) {
3955
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3956
- });
3957
- }
3958
- return target;
3959
- }
3960
- function LookupSecretSettingsSection(param) {
3961
- var flow = param.flow, LookupSecretSettingsSectionWrapper = param.LookupSecretSettingsSectionWrapper;
3962
- var filter = {
3963
- nodes: flow.ui.nodes,
3964
- groups: UiNodeGroupEnum.LookupSecret,
3965
- withoutDefaultGroup: true
3966
- };
3967
- if (!hasLookupSecret(flow.ui.nodes)) return null;
3968
- return /*#__PURE__*/ jsxs(LookupSecretSettingsSectionWrapper, {
3969
- children: [
3970
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3971
- filter: _object_spread_props$4(_object_spread$4({}, filter), {
3972
- excludeAttributes: "submit,button"
3973
- })
3974
- }),
3975
- /*#__PURE__*/ jsx(FilterFlowNodes, {
3976
- filter: _object_spread_props$4(_object_spread$4({}, filter), {
3977
- attributes: "submit,button"
3978
- })
3979
- })
3980
- ]
3981
- });
3982
- }
3983
-
3984
- function OidcSettingsSection(param) {
3985
- var flow = param.flow, OidcSettingsSectionWrapper = param.OidcSettingsSectionWrapper;
3986
- if (!hasOidc(flow.ui.nodes)) return null;
3987
- return /*#__PURE__*/ jsx(OidcSettingsSectionWrapper, {
3988
- children: /*#__PURE__*/ jsx(FilterFlowNodes, {
3989
- filter: {
3990
- nodes: flow.ui.nodes,
3991
- groups: UiNodeGroupEnum.Oidc,
3992
- withoutDefaultGroup: true
3993
- }
3994
- })
3995
- });
3996
- }
3997
-
3998
- function _define_property$3(obj, key, value) {
3999
- if (key in obj) {
4000
- Object.defineProperty(obj, key, {
4001
- value: value,
4002
- enumerable: true,
4003
- configurable: true,
4004
- writable: true
4005
- });
4006
- } else {
4007
- obj[key] = value;
4008
- }
4009
- return obj;
4010
- }
4011
- function _object_spread$3(target) {
4012
- for(var i = 1; i < arguments.length; i++){
4013
- var source = arguments[i] != null ? arguments[i] : {};
4014
- var ownKeys = Object.keys(source);
4015
- if (typeof Object.getOwnPropertySymbols === "function") {
4016
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4017
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4018
- }));
4019
- }
4020
- ownKeys.forEach(function(key) {
4021
- _define_property$3(target, key, source[key]);
4022
- });
4023
- }
4024
- return target;
4025
- }
4026
- function ownKeys$3(object, enumerableOnly) {
4027
- var keys = Object.keys(object);
4028
- if (Object.getOwnPropertySymbols) {
4029
- var symbols = Object.getOwnPropertySymbols(object);
4030
- keys.push.apply(keys, symbols);
4031
- }
4032
- return keys;
4033
- }
4034
- function _object_spread_props$3(target, source) {
4035
- source = source != null ? source : {};
4036
- if (Object.getOwnPropertyDescriptors) {
4037
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4038
- } else {
4039
- ownKeys$3(Object(source)).forEach(function(key) {
4040
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4041
- });
4042
- }
4043
- return target;
4044
- }
4045
- function PasskeySettingsSection(param) {
4046
- var flow = param.flow, PasskeySettingsSectionWrapper = param.PasskeySettingsSectionWrapper;
4047
- if (!hasPasskey(flow.ui.nodes)) return null;
4048
- var filter = {
4049
- nodes: flow.ui.nodes,
4050
- groups: UiNodeGroupEnum.Passkey,
4051
- withoutDefaultGroup: true
4052
- };
4053
- return /*#__PURE__*/ jsxs(PasskeySettingsSectionWrapper, {
4054
- children: [
4055
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4056
- filter: _object_spread_props$3(_object_spread$3({}, filter), {
4057
- excludeAttributes: "submit,button"
4058
- })
4059
- }),
4060
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4061
- filter: _object_spread_props$3(_object_spread$3({}, filter), {
4062
- attributes: "submit,button"
4063
- })
4064
- })
4065
- ]
4066
- });
4067
- }
4068
-
4069
- function _define_property$2(obj, key, value) {
4070
- if (key in obj) {
4071
- Object.defineProperty(obj, key, {
4072
- value: value,
4073
- enumerable: true,
4074
- configurable: true,
4075
- writable: true
4076
- });
4077
- } else {
4078
- obj[key] = value;
4079
- }
4080
- return obj;
4081
- }
4082
- function _object_spread$2(target) {
4083
- for(var i = 1; i < arguments.length; i++){
4084
- var source = arguments[i] != null ? arguments[i] : {};
4085
- var ownKeys = Object.keys(source);
4086
- if (typeof Object.getOwnPropertySymbols === "function") {
4087
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4088
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4089
- }));
4090
- }
4091
- ownKeys.forEach(function(key) {
4092
- _define_property$2(target, key, source[key]);
4093
- });
4094
- }
4095
- return target;
4096
- }
4097
- function ownKeys$2(object, enumerableOnly) {
4098
- var keys = Object.keys(object);
4099
- if (Object.getOwnPropertySymbols) {
4100
- var symbols = Object.getOwnPropertySymbols(object);
4101
- keys.push.apply(keys, symbols);
4102
- }
4103
- return keys;
4104
- }
4105
- function _object_spread_props$2(target, source) {
4106
- source = source != null ? source : {};
4107
- if (Object.getOwnPropertyDescriptors) {
4108
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4109
- } else {
4110
- ownKeys$2(Object(source)).forEach(function(key) {
4111
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4112
- });
4113
- }
4114
- return target;
4115
- }
4116
- function PasswordSettingsSection(param) {
4117
- var flow = param.flow, PasswordSettingsSectionWrapper = param.PasswordSettingsSectionWrapper;
4118
- if (!hasPassword(flow.ui.nodes)) return null;
4119
- var filter = {
4120
- nodes: flow.ui.nodes,
4121
- groups: UiNodeGroupEnum.Password,
4122
- withoutDefaultGroup: true
4123
- };
4124
- return /*#__PURE__*/ jsxs(PasswordSettingsSectionWrapper, {
4125
- children: [
4126
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4127
- filter: _object_spread_props$2(_object_spread$2({}, filter), {
4128
- excludeAttributes: "submit,button"
4129
- })
4130
- }),
4131
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4132
- filter: _object_spread_props$2(_object_spread$2({}, filter), {
4133
- attributes: "submit,button"
4134
- })
4135
- })
4136
- ]
4137
- });
4138
- }
4139
-
4140
- function _define_property$1(obj, key, value) {
4141
- if (key in obj) {
4142
- Object.defineProperty(obj, key, {
4143
- value: value,
4144
- enumerable: true,
4145
- configurable: true,
4146
- writable: true
4147
- });
4148
- } else {
4149
- obj[key] = value;
4150
- }
4151
- return obj;
4152
- }
4153
- function _object_spread$1(target) {
4154
- for(var i = 1; i < arguments.length; i++){
4155
- var source = arguments[i] != null ? arguments[i] : {};
4156
- var ownKeys = Object.keys(source);
4157
- if (typeof Object.getOwnPropertySymbols === "function") {
4158
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4159
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4160
- }));
4161
- }
4162
- ownKeys.forEach(function(key) {
4163
- _define_property$1(target, key, source[key]);
4164
- });
4165
- }
4166
- return target;
4167
- }
4168
- function ownKeys$1(object, enumerableOnly) {
4169
- var keys = Object.keys(object);
4170
- if (Object.getOwnPropertySymbols) {
4171
- var symbols = Object.getOwnPropertySymbols(object);
4172
- keys.push.apply(keys, symbols);
4173
- }
4174
- return keys;
4175
- }
4176
- function _object_spread_props$1(target, source) {
4177
- source = source != null ? source : {};
4178
- if (Object.getOwnPropertyDescriptors) {
4179
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4180
- } else {
4181
- ownKeys$1(Object(source)).forEach(function(key) {
4182
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4183
- });
4184
- }
4185
- return target;
4186
- }
4187
- function ProfileSettingsSection(param) {
4188
- var flow = param.flow, ProfileSettingsSectionWrapper = param.ProfileSettingsSectionWrapper;
4189
- var filter = {
4190
- nodes: flow.ui.nodes,
4191
- groups: UiNodeGroupEnum.Profile
4192
- };
4193
- return /*#__PURE__*/ jsxs(ProfileSettingsSectionWrapper, {
4194
- children: [
4195
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4196
- filter: _object_spread_props$1(_object_spread$1({}, filter), {
4197
- excludeAttributes: "submit,button"
4198
- })
4199
- }),
4200
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4201
- filter: _object_spread_props$1(_object_spread$1({}, filter), {
4202
- attributes: "submit,button"
4203
- })
4204
- })
4205
- ]
4206
- });
4207
- }
4208
-
4209
- function _define_property(obj, key, value) {
4210
- if (key in obj) {
4211
- Object.defineProperty(obj, key, {
4212
- value: value,
4213
- enumerable: true,
4214
- configurable: true,
4215
- writable: true
4216
- });
4217
- } else {
4218
- obj[key] = value;
4219
- }
4220
- return obj;
4221
- }
4222
- function _object_spread(target) {
4223
- for(var i = 1; i < arguments.length; i++){
4224
- var source = arguments[i] != null ? arguments[i] : {};
4225
- var ownKeys = Object.keys(source);
4226
- if (typeof Object.getOwnPropertySymbols === "function") {
4227
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4228
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4229
- }));
4230
- }
4231
- ownKeys.forEach(function(key) {
4232
- _define_property(target, key, source[key]);
4233
- });
4234
- }
4235
- return target;
4236
- }
4237
- function ownKeys(object, enumerableOnly) {
4238
- var keys = Object.keys(object);
4239
- if (Object.getOwnPropertySymbols) {
4240
- var symbols = Object.getOwnPropertySymbols(object);
4241
- keys.push.apply(keys, symbols);
4242
- }
4243
- return keys;
4244
- }
4245
- function _object_spread_props(target, source) {
4246
- source = source != null ? source : {};
4247
- if (Object.getOwnPropertyDescriptors) {
4248
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4249
- } else {
4250
- ownKeys(Object(source)).forEach(function(key) {
4251
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4252
- });
4253
- }
4254
- return target;
4255
- }
4256
- function TotpSettingsSection(param) {
4257
- var flow = param.flow, TotpSettingsSectionWrapper = param.TotpSettingsSectionWrapper;
4258
- if (!hasTotp(flow.ui.nodes)) return null;
4259
- var filter = {
4260
- nodes: flow.ui.nodes,
4261
- groups: UiNodeGroupEnum.Totp,
4262
- withoutDefaultGroup: true
4263
- };
4264
- return /*#__PURE__*/ jsxs(TotpSettingsSectionWrapper, {
4265
- children: [
4266
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4267
- filter: _object_spread_props(_object_spread({}, filter), {
4268
- excludeAttributes: "submit,button"
4269
- })
4270
- }),
4271
- /*#__PURE__*/ jsx(FilterFlowNodes, {
4272
- filter: _object_spread_props(_object_spread({}, filter), {
4273
- attributes: "submit,button"
4274
- })
4275
- })
4276
- ]
4277
- });
4278
- }
4279
-
4280
- function UserSettingsCard(param) {
4281
- var flow = param.flow, flowType = param.flowType, onSubmit = param.onSubmit, className = param.className;
4282
- var _useKratosContext = useKratosContext(), _useKratosContext_components = _useKratosContext.components, ProfileSettingsSectionWrapper = _useKratosContext_components.ProfileSettingsSectionWrapper, PasswordSettingsSectionWrapper = _useKratosContext_components.PasswordSettingsSectionWrapper, WebAuthnSettingsSectionWrapper = _useKratosContext_components.WebAuthnSettingsSectionWrapper, LookupSecretSettingsSectionWrapper = _useKratosContext_components.LookupSecretSettingsSectionWrapper, OidcSettingsSectionWrapper = _useKratosContext_components.OidcSettingsSectionWrapper, TotpSettingsSectionWrapper = _useKratosContext_components.TotpSettingsSectionWrapper, UiMessages = _useKratosContext_components.UiMessages, excludeScripts = _useKratosContext.excludeScripts;
4283
- useScriptNodes({
4284
- nodes: flow.ui.nodes,
4285
- excludeScripts: excludeScripts
4286
- });
4287
- var $flow = function() {
4288
- if (flowType === UiNodeGroupEnum.Profile) {
4289
- return /*#__PURE__*/ jsx(ProfileSettingsSection, {
4290
- flow: flow,
4291
- ProfileSettingsSectionWrapper: ProfileSettingsSectionWrapper
4292
- });
4293
- } else if (flowType === UiNodeGroupEnum.Password && hasPassword(flow.ui.nodes)) {
4294
- return /*#__PURE__*/ jsx(PasswordSettingsSection, {
4295
- flow: flow,
4296
- PasswordSettingsSectionWrapper: PasswordSettingsSectionWrapper
4297
- });
4298
- } else if (flowType === UiNodeGroupEnum.Passkey && hasPasskey(flow.ui.nodes)) {
4299
- return /*#__PURE__*/ jsx(PasskeySettingsSection, {
4300
- flow: flow,
4301
- PasskeySettingsSectionWrapper: WebAuthnSettingsSectionWrapper
4302
- });
4303
- } else if (flowType === UiNodeGroupEnum.LookupSecret && hasLookupSecret(flow.ui.nodes)) {
4304
- return /*#__PURE__*/ jsx(LookupSecretSettingsSection, {
4305
- flow: flow,
4306
- LookupSecretSettingsSectionWrapper: LookupSecretSettingsSectionWrapper
4307
- });
4308
- } else if (flowType === UiNodeGroupEnum.Oidc && hasOidc(flow.ui.nodes)) {
4309
- return /*#__PURE__*/ jsx(OidcSettingsSection, {
4310
- flow: flow,
4311
- OidcSettingsSectionWrapper: OidcSettingsSectionWrapper
4312
- });
4313
- } else if (flowType === UiNodeGroupEnum.Totp && hasTotp(flow.ui.nodes)) {
4314
- return /*#__PURE__*/ jsx(TotpSettingsSection, {
4315
- flow: flow,
4316
- TotpSettingsSectionWrapper: TotpSettingsSectionWrapper
4317
- });
4318
- }
4319
- }();
4320
- if (!$flow) return null;
4321
- return /*#__PURE__*/ jsxs(UserAuthForm, {
4322
- className: className,
4323
- flow: flow,
4324
- onSubmit: onSubmit,
4325
- children: [
4326
- /*#__PURE__*/ jsx(UiMessages, {
4327
- uiMessages: flow.ui.messages
4328
- }),
4329
- $flow
4330
- ]
4331
- });
4332
- }
4333
-
4334
- export { BaseSessionManager, ErrorId, ErrorSystem, ErrorValidation, ErrorValidationLogin, ErrorValidationRecovery, ErrorValidationRegistration, ErrorValidationSettings, ErrorValidationVerification, InfoNodeLabel, InfoSelfServiceLogin, InfoSelfServiceLogout, InfoSelfServiceMFA, InfoSelfServiceRecovery, InfoSelfServiceRegistration, InfoSelfServiceSettings, InfoSelfServiceVerification, KratosContextProvider, LoginCard, RecoveryCard, RegistrationCard, UserSettingsCard, VerificationCard, aalParameterName, createKratosClient, flowIdParameterName, isUiNodeAnchorAttributes, isUiNodeImageAttributes, isUiNodeInputAttributes, isUiNodeScriptAttributes, isUiNodeTextAttributes, isUiNodeTextSecretsAttributes, kratosContext, refreshParameterName, returnToParameterName, useKratosContext, useLoginFlow, useLogoutFlow, useReauthenticationFlow, useRecoveryFlow, useRegisterFlow, useSettingsFlow, useVerificationFlow };