@leancodepl/kratos 8.0.0 → 8.1.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.
package/index.esm.js CHANGED
@@ -3,7 +3,6 @@ import axios from 'axios';
3
3
  import { createContext, useContext, useMemo, useState, useCallback, useEffect } from 'react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { ReplaySubject, map, shareReplay, Subject, switchMap, from, catchError, of } from 'rxjs';
6
- import { useLocation, useNavigate } from 'react-router';
7
6
  import { omit, isObject, isString } from 'lodash';
8
7
  import yn from 'yn';
9
8
 
@@ -159,7 +158,7 @@ function useKratosContext() {
159
158
  return context;
160
159
  }
161
160
 
162
- function _define_property$l(obj, key, value) {
161
+ function _define_property$p(obj, key, value) {
163
162
  if (key in obj) {
164
163
  Object.defineProperty(obj, key, {
165
164
  value: value,
@@ -172,7 +171,7 @@ function _define_property$l(obj, key, value) {
172
171
  }
173
172
  return obj;
174
173
  }
175
- function _object_spread$k(target) {
174
+ function _object_spread$o(target) {
176
175
  for(var i = 1; i < arguments.length; i++){
177
176
  var source = arguments[i] != null ? arguments[i] : {};
178
177
  var ownKeys = Object.keys(source);
@@ -182,12 +181,12 @@ function _object_spread$k(target) {
182
181
  }));
183
182
  }
184
183
  ownKeys.forEach(function(key) {
185
- _define_property$l(target, key, source[key]);
184
+ _define_property$p(target, key, source[key]);
186
185
  });
187
186
  }
188
187
  return target;
189
188
  }
190
- function ownKeys$b(object, enumerableOnly) {
189
+ function ownKeys$f(object, enumerableOnly) {
191
190
  var keys = Object.keys(object);
192
191
  if (Object.getOwnPropertySymbols) {
193
192
  var symbols = Object.getOwnPropertySymbols(object);
@@ -195,12 +194,12 @@ function ownKeys$b(object, enumerableOnly) {
195
194
  }
196
195
  return keys;
197
196
  }
198
- function _object_spread_props$b(target, source) {
197
+ function _object_spread_props$f(target, source) {
199
198
  source = source != null ? source : {};
200
199
  if (Object.getOwnPropertyDescriptors) {
201
200
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
202
201
  } else {
203
- ownKeys$b(Object(source)).forEach(function(key) {
202
+ ownKeys$f(Object(source)).forEach(function(key) {
204
203
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
205
204
  });
206
205
  }
@@ -237,12 +236,12 @@ function DefaultButtonComponent(_param) {
237
236
  var header = _param.header, props = _object_without_properties$7(_param, [
238
237
  "header"
239
238
  ]);
240
- return /*#__PURE__*/ jsx("button", _object_spread_props$b(_object_spread$k({}, props), {
239
+ return /*#__PURE__*/ jsx("button", _object_spread_props$f(_object_spread$o({}, props), {
241
240
  children: header
242
241
  }));
243
242
  }
244
243
 
245
- function _define_property$k(obj, key, value) {
244
+ function _define_property$o(obj, key, value) {
246
245
  if (key in obj) {
247
246
  Object.defineProperty(obj, key, {
248
247
  value: value,
@@ -255,7 +254,7 @@ function _define_property$k(obj, key, value) {
255
254
  }
256
255
  return obj;
257
256
  }
258
- function _object_spread$j(target) {
257
+ function _object_spread$n(target) {
259
258
  for(var i = 1; i < arguments.length; i++){
260
259
  var source = arguments[i] != null ? arguments[i] : {};
261
260
  var ownKeys = Object.keys(source);
@@ -265,12 +264,12 @@ function _object_spread$j(target) {
265
264
  }));
266
265
  }
267
266
  ownKeys.forEach(function(key) {
268
- _define_property$k(target, key, source[key]);
267
+ _define_property$o(target, key, source[key]);
269
268
  });
270
269
  }
271
270
  return target;
272
271
  }
273
- function ownKeys$a(object, enumerableOnly) {
272
+ function ownKeys$e(object, enumerableOnly) {
274
273
  var keys = Object.keys(object);
275
274
  if (Object.getOwnPropertySymbols) {
276
275
  var symbols = Object.getOwnPropertySymbols(object);
@@ -278,12 +277,12 @@ function ownKeys$a(object, enumerableOnly) {
278
277
  }
279
278
  return keys;
280
279
  }
281
- function _object_spread_props$a(target, source) {
280
+ function _object_spread_props$e(target, source) {
282
281
  source = source != null ? source : {};
283
282
  if (Object.getOwnPropertyDescriptors) {
284
283
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
285
284
  } else {
286
- ownKeys$a(Object(source)).forEach(function(key) {
285
+ ownKeys$e(Object(source)).forEach(function(key) {
287
286
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
288
287
  });
289
288
  }
@@ -325,7 +324,7 @@ function DefaultCheckboxComponent(_param) {
325
324
  children: [
326
325
  /*#__PURE__*/ jsxs("label", {
327
326
  children: [
328
- /*#__PURE__*/ jsx("input", _object_spread_props$a(_object_spread$j({}, props), {
327
+ /*#__PURE__*/ jsx("input", _object_spread_props$e(_object_spread$n({}, props), {
329
328
  type: "checkbox"
330
329
  })),
331
330
  label
@@ -336,7 +335,7 @@ function DefaultCheckboxComponent(_param) {
336
335
  });
337
336
  }
338
337
 
339
- function _define_property$j(obj, key, value) {
338
+ function _define_property$n(obj, key, value) {
340
339
  if (key in obj) {
341
340
  Object.defineProperty(obj, key, {
342
341
  value: value,
@@ -349,7 +348,7 @@ function _define_property$j(obj, key, value) {
349
348
  }
350
349
  return obj;
351
350
  }
352
- function _object_spread$i(target) {
351
+ function _object_spread$m(target) {
353
352
  for(var i = 1; i < arguments.length; i++){
354
353
  var source = arguments[i] != null ? arguments[i] : {};
355
354
  var ownKeys = Object.keys(source);
@@ -359,7 +358,7 @@ function _object_spread$i(target) {
359
358
  }));
360
359
  }
361
360
  ownKeys.forEach(function(key) {
362
- _define_property$j(target, key, source[key]);
361
+ _define_property$n(target, key, source[key]);
363
362
  });
364
363
  }
365
364
  return target;
@@ -400,12 +399,12 @@ function DefaultImageComponent(_param) {
400
399
  header && /*#__PURE__*/ jsx("p", {
401
400
  children: header
402
401
  }),
403
- /*#__PURE__*/ jsx("img", _object_spread$i({}, props))
402
+ /*#__PURE__*/ jsx("img", _object_spread$m({}, props))
404
403
  ]
405
404
  });
406
405
  }
407
406
 
408
- function _define_property$i(obj, key, value) {
407
+ function _define_property$m(obj, key, value) {
409
408
  if (key in obj) {
410
409
  Object.defineProperty(obj, key, {
411
410
  value: value,
@@ -418,7 +417,7 @@ function _define_property$i(obj, key, value) {
418
417
  }
419
418
  return obj;
420
419
  }
421
- function _object_spread$h(target) {
420
+ function _object_spread$l(target) {
422
421
  for(var i = 1; i < arguments.length; i++){
423
422
  var source = arguments[i] != null ? arguments[i] : {};
424
423
  var ownKeys = Object.keys(source);
@@ -428,7 +427,7 @@ function _object_spread$h(target) {
428
427
  }));
429
428
  }
430
429
  ownKeys.forEach(function(key) {
431
- _define_property$i(target, key, source[key]);
430
+ _define_property$m(target, key, source[key]);
432
431
  });
433
432
  }
434
433
  return target;
@@ -472,7 +471,7 @@ function DefaultInputComponent(_param) {
472
471
  header && /*#__PURE__*/ jsx("p", {
473
472
  children: header
474
473
  }),
475
- /*#__PURE__*/ jsx("input", _object_spread$h({}, props))
474
+ /*#__PURE__*/ jsx("input", _object_spread$l({}, props))
476
475
  ]
477
476
  }),
478
477
  helperMessage
@@ -480,7 +479,7 @@ function DefaultInputComponent(_param) {
480
479
  });
481
480
  }
482
481
 
483
- function _define_property$h(obj, key, value) {
482
+ function _define_property$l(obj, key, value) {
484
483
  if (key in obj) {
485
484
  Object.defineProperty(obj, key, {
486
485
  value: value,
@@ -493,7 +492,7 @@ function _define_property$h(obj, key, value) {
493
492
  }
494
493
  return obj;
495
494
  }
496
- function _object_spread$g(target) {
495
+ function _object_spread$k(target) {
497
496
  for(var i = 1; i < arguments.length; i++){
498
497
  var source = arguments[i] != null ? arguments[i] : {};
499
498
  var ownKeys = Object.keys(source);
@@ -503,7 +502,7 @@ function _object_spread$g(target) {
503
502
  }));
504
503
  }
505
504
  ownKeys.forEach(function(key) {
506
- _define_property$h(target, key, source[key]);
505
+ _define_property$l(target, key, source[key]);
507
506
  });
508
507
  }
509
508
  return target;
@@ -540,7 +539,7 @@ function DefaultLinkComponent(_param) {
540
539
  "href"
541
540
  ]);
542
541
  // eslint-disable-next-line jsx-a11y/anchor-has-content
543
- return /*#__PURE__*/ jsx("a", _object_spread$g({}, props));
542
+ return /*#__PURE__*/ jsx("a", _object_spread$k({}, props));
544
543
  }
545
544
 
546
545
  function DefaultMessageComponent(param) {
@@ -557,7 +556,7 @@ function DefaultMessageFormatComponent(param) {
557
556
  });
558
557
  }
559
558
 
560
- function _define_property$g(obj, key, value) {
559
+ function _define_property$k(obj, key, value) {
561
560
  if (key in obj) {
562
561
  Object.defineProperty(obj, key, {
563
562
  value: value,
@@ -570,7 +569,7 @@ function _define_property$g(obj, key, value) {
570
569
  }
571
570
  return obj;
572
571
  }
573
- function _object_spread$f(target) {
572
+ function _object_spread$j(target) {
574
573
  for(var i = 1; i < arguments.length; i++){
575
574
  var source = arguments[i] != null ? arguments[i] : {};
576
575
  var ownKeys = Object.keys(source);
@@ -580,7 +579,7 @@ function _object_spread$f(target) {
580
579
  }));
581
580
  }
582
581
  ownKeys.forEach(function(key) {
583
- _define_property$g(target, key, source[key]);
582
+ _define_property$k(target, key, source[key]);
584
583
  });
585
584
  }
586
585
  return target;
@@ -589,7 +588,7 @@ function FormattedMessage(param) {
589
588
  var message = param.message;
590
589
  var _useKratosContext = useKratosContext(), MessageFormat = _useKratosContext.components.MessageFormat;
591
590
  if (!message) return null;
592
- return /*#__PURE__*/ jsx(MessageFormat, _object_spread$f({}, message));
591
+ return /*#__PURE__*/ jsx(MessageFormat, _object_spread$j({}, message));
593
592
  }
594
593
 
595
594
  function DefaultTextComponent(param) {
@@ -612,15 +611,15 @@ function DefaultTextComponent(param) {
612
611
  });
613
612
  }
614
613
 
615
- function _array_like_to_array$8(arr, len) {
614
+ function _array_like_to_array$7(arr, len) {
616
615
  if (len == null || len > arr.length) len = arr.length;
617
616
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
618
617
  return arr2;
619
618
  }
620
619
  function _array_without_holes$1(arr) {
621
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
620
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
622
621
  }
623
- function _define_property$f(obj, key, value) {
622
+ function _define_property$j(obj, key, value) {
624
623
  if (key in obj) {
625
624
  Object.defineProperty(obj, key, {
626
625
  value: value,
@@ -639,7 +638,7 @@ function _iterable_to_array$1(iter) {
639
638
  function _non_iterable_spread$1() {
640
639
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
641
640
  }
642
- function _object_spread$e(target) {
641
+ function _object_spread$i(target) {
643
642
  for(var i = 1; i < arguments.length; i++){
644
643
  var source = arguments[i] != null ? arguments[i] : {};
645
644
  var ownKeys = Object.keys(source);
@@ -649,12 +648,12 @@ function _object_spread$e(target) {
649
648
  }));
650
649
  }
651
650
  ownKeys.forEach(function(key) {
652
- _define_property$f(target, key, source[key]);
651
+ _define_property$j(target, key, source[key]);
653
652
  });
654
653
  }
655
654
  return target;
656
655
  }
657
- function ownKeys$9(object, enumerableOnly) {
656
+ function ownKeys$d(object, enumerableOnly) {
658
657
  var keys = Object.keys(object);
659
658
  if (Object.getOwnPropertySymbols) {
660
659
  var symbols = Object.getOwnPropertySymbols(object);
@@ -662,12 +661,12 @@ function ownKeys$9(object, enumerableOnly) {
662
661
  }
663
662
  return keys;
664
663
  }
665
- function _object_spread_props$9(target, source) {
664
+ function _object_spread_props$d(target, source) {
666
665
  source = source != null ? source : {};
667
666
  if (Object.getOwnPropertyDescriptors) {
668
667
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
669
668
  } else {
670
- ownKeys$9(Object(source)).forEach(function(key) {
669
+ ownKeys$d(Object(source)).forEach(function(key) {
671
670
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
672
671
  });
673
672
  }
@@ -701,22 +700,22 @@ function _object_without_properties_loose$2(source, excluded) {
701
700
  return target;
702
701
  }
703
702
  function _to_consumable_array$1(arr) {
704
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$1();
703
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$1();
705
704
  }
706
- function _unsupported_iterable_to_array$8(o, minLen) {
705
+ function _unsupported_iterable_to_array$7(o, minLen) {
707
706
  if (!o) return;
708
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
707
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
709
708
  var n = Object.prototype.toString.call(o).slice(8, -1);
710
709
  if (n === "Object" && o.constructor) n = o.constructor.name;
711
710
  if (n === "Map" || n === "Set") return Array.from(n);
712
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
711
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
713
712
  }
714
713
  function NodeMessage(_param) {
715
714
  var message = _param.message, props = _object_without_properties$2(_param, [
716
715
  "message"
717
716
  ]);
718
717
  var _useKratosContext = useKratosContext(), Message = _useKratosContext.components.Message;
719
- return /*#__PURE__*/ jsx(Message, _object_spread_props$9(_object_spread$e({
718
+ return /*#__PURE__*/ jsx(Message, _object_spread_props$d(_object_spread$i({
720
719
  message: message,
721
720
  severity: message.type
722
721
  }, props), {
@@ -751,7 +750,7 @@ function NodeMessages(param) {
751
750
  });
752
751
  }
753
752
 
754
- function _define_property$e(obj, key, value) {
753
+ function _define_property$i(obj, key, value) {
755
754
  if (key in obj) {
756
755
  Object.defineProperty(obj, key, {
757
756
  value: value,
@@ -764,7 +763,7 @@ function _define_property$e(obj, key, value) {
764
763
  }
765
764
  return obj;
766
765
  }
767
- function _object_spread$d(target) {
766
+ function _object_spread$h(target) {
768
767
  for(var i = 1; i < arguments.length; i++){
769
768
  var source = arguments[i] != null ? arguments[i] : {};
770
769
  var ownKeys = Object.keys(source);
@@ -774,13 +773,13 @@ function _object_spread$d(target) {
774
773
  }));
775
774
  }
776
775
  ownKeys.forEach(function(key) {
777
- _define_property$e(target, key, source[key]);
776
+ _define_property$i(target, key, source[key]);
778
777
  });
779
778
  }
780
779
  return target;
781
780
  }
782
781
  function DefaultUiMessagesComponent(props) {
783
- return /*#__PURE__*/ jsx(NodeMessages, _object_spread$d({}, props));
782
+ return /*#__PURE__*/ jsx(NodeMessages, _object_spread$h({}, props));
784
783
  }
785
784
 
786
785
  var defaultComponents = {
@@ -810,7 +809,7 @@ var defaultComponents = {
810
809
  ProfileRegistrationSectionWrapper: "div"
811
810
  };
812
811
 
813
- function _define_property$d(obj, key, value) {
812
+ function _define_property$h(obj, key, value) {
814
813
  if (key in obj) {
815
814
  Object.defineProperty(obj, key, {
816
815
  value: value,
@@ -823,7 +822,7 @@ function _define_property$d(obj, key, value) {
823
822
  }
824
823
  return obj;
825
824
  }
826
- function _object_spread$c(target) {
825
+ function _object_spread$g(target) {
827
826
  for(var i = 1; i < arguments.length; i++){
828
827
  var source = arguments[i] != null ? arguments[i] : {};
829
828
  var ownKeys = Object.keys(source);
@@ -833,7 +832,7 @@ function _object_spread$c(target) {
833
832
  }));
834
833
  }
835
834
  ownKeys.forEach(function(key) {
836
- _define_property$d(target, key, source[key]);
835
+ _define_property$h(target, key, source[key]);
837
836
  });
838
837
  }
839
838
  return target;
@@ -843,7 +842,7 @@ function KratosContextProvider(param) {
843
842
  var _useContext = useContext(kratosContext), baseComponents = _useContext.components, baseUseHandleFlowError = _useContext.useHandleFlowError, baseExcludeScripts = _useContext.excludeScripts;
844
843
  var value = useMemo(function() {
845
844
  return {
846
- components: _object_spread$c({}, baseComponents !== null && baseComponents !== void 0 ? baseComponents : defaultComponents, components),
845
+ components: _object_spread$g({}, baseComponents !== null && baseComponents !== void 0 ? baseComponents : defaultComponents, components),
847
846
  useHandleFlowError: useHandleFlowError !== null && useHandleFlowError !== void 0 ? useHandleFlowError : baseUseHandleFlowError,
848
847
  excludeScripts: excludeScripts !== null && excludeScripts !== void 0 ? excludeScripts : baseExcludeScripts
849
848
  };
@@ -864,6 +863,7 @@ function KratosContextProvider(param) {
864
863
  var returnToParameterName = "return_to";
865
864
  var aalParameterName = "aal";
866
865
  var flowIdParameterName = "flow";
866
+ var refreshParameterName = "refresh";
867
867
 
868
868
  // https://pkg.go.dev/github.com/ory/kratos/text#pkg-types
869
869
  var ErrorId;
@@ -902,7 +902,7 @@ function _create_class(Constructor, protoProps, staticProps) {
902
902
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
903
903
  return Constructor;
904
904
  }
905
- function _define_property$c(obj, key, value) {
905
+ function _define_property$g(obj, key, value) {
906
906
  if (key in obj) {
907
907
  Object.defineProperty(obj, key, {
908
908
  value: value,
@@ -919,19 +919,19 @@ var BaseSessionManager = /*#__PURE__*/ function() {
919
919
  function BaseSessionManager(authUrl, loginRoute) {
920
920
  var _this = this;
921
921
  _class_call_check(this, BaseSessionManager);
922
- _define_property$c(this, "authUrl", void 0);
923
- _define_property$c(this, "loginRoute", void 0);
924
- _define_property$c(this, "session$", new ReplaySubject(1));
925
- _define_property$c(this, "isLoggedIn", this.session$.pipe(map(function(session) {
922
+ _define_property$g(this, "authUrl", void 0);
923
+ _define_property$g(this, "loginRoute", void 0);
924
+ _define_property$g(this, "session$", new ReplaySubject(1));
925
+ _define_property$g(this, "isLoggedIn", this.session$.pipe(map(function(session) {
926
926
  return !!(session === null || session === void 0 ? void 0 : session.active);
927
927
  }), shareReplay(1)));
928
- _define_property$c(this, "identity$", this.session$.pipe(map(function(session) {
928
+ _define_property$g(this, "identity$", this.session$.pipe(map(function(session) {
929
929
  return session === null || session === void 0 ? void 0 : session.identity;
930
930
  }), shareReplay(1)));
931
- _define_property$c(this, "userId$", this.identity$.pipe(map(function(identity) {
931
+ _define_property$g(this, "userId$", this.identity$.pipe(map(function(identity) {
932
932
  return identity === null || identity === void 0 ? void 0 : identity.id;
933
933
  }), shareReplay(1)));
934
- _define_property$c(this, "checkIfLoggedIn", function() {
934
+ _define_property$g(this, "checkIfLoggedIn", function() {
935
935
  var fetchSubject = new Subject();
936
936
  fetchSubject.pipe(switchMap(function() {
937
937
  return from(axios.get("".concat(_this.authUrl, "/sessions/whoami"), {
@@ -959,7 +959,7 @@ var BaseSessionManager = /*#__PURE__*/ function() {
959
959
  redirectUrl.search = searchParams1.toString();
960
960
  } else {
961
961
  var _obj;
962
- redirectUrl.search = new URLSearchParams((_obj = {}, _define_property$c(_obj, aalParameterName, AuthenticatorAssuranceLevel.Aal2), _define_property$c(_obj, returnToParameterName, "".concat(window.location.pathname).concat(window.location.search)), _obj)).toString();
962
+ 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();
963
963
  }
964
964
  window.location.href = redirectUrl.toString();
965
965
  }
@@ -1338,15 +1338,15 @@ function _handleCancelError() {
1338
1338
  return _handleCancelError.apply(this, arguments);
1339
1339
  }
1340
1340
 
1341
- function _array_like_to_array$7(arr, len) {
1341
+ function _array_like_to_array$6(arr, len) {
1342
1342
  if (len == null || len > arr.length) len = arr.length;
1343
1343
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1344
1344
  return arr2;
1345
1345
  }
1346
- function _array_with_holes$6(arr) {
1346
+ function _array_with_holes$5(arr) {
1347
1347
  if (Array.isArray(arr)) return arr;
1348
1348
  }
1349
- function _iterable_to_array_limit$6(arr, i) {
1349
+ function _iterable_to_array_limit$5(arr, i) {
1350
1350
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1351
1351
  if (_i == null) return;
1352
1352
  var _arr = [];
@@ -1370,24 +1370,24 @@ function _iterable_to_array_limit$6(arr, i) {
1370
1370
  }
1371
1371
  return _arr;
1372
1372
  }
1373
- function _non_iterable_rest$6() {
1373
+ function _non_iterable_rest$5() {
1374
1374
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1375
1375
  }
1376
- function _sliced_to_array$6(arr, i) {
1377
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$6();
1376
+ function _sliced_to_array$5(arr, i) {
1377
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$5();
1378
1378
  }
1379
- function _unsupported_iterable_to_array$7(o, minLen) {
1379
+ function _unsupported_iterable_to_array$6(o, minLen) {
1380
1380
  if (!o) return;
1381
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
1381
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
1382
1382
  var n = Object.prototype.toString.call(o).slice(8, -1);
1383
1383
  if (n === "Object" && o.constructor) n = o.constructor.name;
1384
1384
  if (n === "Map" || n === "Set") return Array.from(n);
1385
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
1385
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
1386
1386
  }
1387
1387
  function useReauthenticationFlow(param) {
1388
1388
  var kratosClient = param.kratosClient, onReauthenticated = param.onReauthenticated;
1389
1389
  var useHandleFlowError = useKratosContext().useHandleFlowError;
1390
- var _useState = _sliced_to_array$6(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1390
+ var _useState = _sliced_to_array$5(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1391
1391
  var handleFlowError = useHandleFlowError({
1392
1392
  resetFlow: useCallback(function() {
1393
1393
  return void setFlow(undefined);
@@ -1442,15 +1442,28 @@ function useReauthenticationFlow(param) {
1442
1442
  };
1443
1443
  }
1444
1444
 
1445
- function _array_like_to_array$6(arr, len) {
1445
+ function _array_like_to_array$5(arr, len) {
1446
1446
  if (len == null || len > arr.length) len = arr.length;
1447
1447
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1448
1448
  return arr2;
1449
1449
  }
1450
- function _array_with_holes$5(arr) {
1450
+ function _array_with_holes$4(arr) {
1451
1451
  if (Array.isArray(arr)) return arr;
1452
1452
  }
1453
- function _iterable_to_array_limit$5(arr, i) {
1453
+ function _define_property$f(obj, key, value) {
1454
+ if (key in obj) {
1455
+ Object.defineProperty(obj, key, {
1456
+ value: value,
1457
+ enumerable: true,
1458
+ configurable: true,
1459
+ writable: true
1460
+ });
1461
+ } else {
1462
+ obj[key] = value;
1463
+ }
1464
+ return obj;
1465
+ }
1466
+ function _iterable_to_array_limit$4(arr, i) {
1454
1467
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1455
1468
  if (_i == null) return;
1456
1469
  var _arr = [];
@@ -1474,80 +1487,42 @@ function _iterable_to_array_limit$5(arr, i) {
1474
1487
  }
1475
1488
  return _arr;
1476
1489
  }
1477
- function _non_iterable_rest$5() {
1490
+ function _non_iterable_rest$4() {
1478
1491
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1479
1492
  }
1480
- function _sliced_to_array$5(arr, i) {
1481
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$5();
1482
- }
1483
- function _unsupported_iterable_to_array$6(o, minLen) {
1484
- if (!o) return;
1485
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
1486
- var n = Object.prototype.toString.call(o).slice(8, -1);
1487
- if (n === "Object" && o.constructor) n = o.constructor.name;
1488
- if (n === "Map" || n === "Set") return Array.from(n);
1489
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
1490
- }
1491
- function parseSearchParams(search) {
1492
- var resultObject = {};
1493
- var searchParams = new URLSearchParams(search);
1494
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1495
- try {
1496
- for(var _iterator = searchParams.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1497
- var _step_value = _sliced_to_array$5(_step.value, 2), key = _step_value[0], value = _step_value[1];
1498
- resultObject[key] = value;
1499
- }
1500
- } catch (err) {
1501
- _didIteratorError = true;
1502
- _iteratorError = err;
1503
- } finally{
1504
- try {
1505
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1506
- _iterator.return();
1507
- }
1508
- } finally{
1509
- if (_didIteratorError) {
1510
- throw _iteratorError;
1511
- }
1493
+ function _object_spread$f(target) {
1494
+ for(var i = 1; i < arguments.length; i++){
1495
+ var source = arguments[i] != null ? arguments[i] : {};
1496
+ var ownKeys = Object.keys(source);
1497
+ if (typeof Object.getOwnPropertySymbols === "function") {
1498
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1499
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1500
+ }));
1512
1501
  }
1502
+ ownKeys.forEach(function(key) {
1503
+ _define_property$f(target, key, source[key]);
1504
+ });
1513
1505
  }
1514
- return resultObject;
1515
- }
1516
-
1517
- function _array_like_to_array$5(arr, len) {
1518
- if (len == null || len > arr.length) len = arr.length;
1519
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1520
- return arr2;
1521
- }
1522
- function _array_with_holes$4(arr) {
1523
- if (Array.isArray(arr)) return arr;
1506
+ return target;
1524
1507
  }
1525
- function _iterable_to_array_limit$4(arr, i) {
1526
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1527
- if (_i == null) return;
1528
- var _arr = [];
1529
- var _n = true;
1530
- var _d = false;
1531
- var _s, _e;
1532
- try {
1533
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1534
- _arr.push(_s.value);
1535
- if (i && _arr.length === i) break;
1536
- }
1537
- } catch (err) {
1538
- _d = true;
1539
- _e = err;
1540
- } finally{
1541
- try {
1542
- if (!_n && _i["return"] != null) _i["return"]();
1543
- } finally{
1544
- if (_d) throw _e;
1545
- }
1508
+ function ownKeys$c(object, enumerableOnly) {
1509
+ var keys = Object.keys(object);
1510
+ if (Object.getOwnPropertySymbols) {
1511
+ var symbols = Object.getOwnPropertySymbols(object);
1512
+ keys.push.apply(keys, symbols);
1546
1513
  }
1547
- return _arr;
1514
+ return keys;
1548
1515
  }
1549
- function _non_iterable_rest$4() {
1550
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1516
+ function _object_spread_props$c(target, source) {
1517
+ source = source != null ? source : {};
1518
+ if (Object.getOwnPropertyDescriptors) {
1519
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1520
+ } else {
1521
+ ownKeys$c(Object(source)).forEach(function(key) {
1522
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1523
+ });
1524
+ }
1525
+ return target;
1551
1526
  }
1552
1527
  function _sliced_to_array$4(arr, i) {
1553
1528
  return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$4();
@@ -1561,25 +1536,20 @@ function _unsupported_iterable_to_array$5(o, minLen) {
1561
1536
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
1562
1537
  }
1563
1538
  function useRecoveryFlow(param) {
1564
- var kratosClient = param.kratosClient, recoveryRoute = param.recoveryRoute, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable, onContinueWith = param.onContinueWith;
1539
+ var kratosClient = param.kratosClient, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable, onContinueWith = param.onContinueWith, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
1565
1540
  var useHandleFlowError = useKratosContext().useHandleFlowError;
1566
1541
  var _useState = _sliced_to_array$4(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1567
- var search = useLocation().search;
1568
- var nav = useNavigate();
1569
- var _useMemo = useMemo(function() {
1570
- return parseSearchParams(search);
1571
- }, [
1572
- search
1573
- ]), flowId = _useMemo[flowIdParameterName], returnTo = _useMemo[returnToParameterName];
1542
+ var flowId = searchParams[flowIdParameterName], returnTo = searchParams[returnToParameterName];
1574
1543
  var handleFlowError = useHandleFlowError({
1575
1544
  resetFlow: useCallback(function() {
1576
- nav(recoveryRoute, {
1577
- replace: true
1578
- });
1545
+ var newParams = omit(_object_spread$f({}, searchParams), [
1546
+ flowIdParameterName
1547
+ ]);
1548
+ updateSearchParams(newParams);
1579
1549
  setFlow(undefined);
1580
1550
  }, [
1581
- nav,
1582
- recoveryRoute
1551
+ searchParams,
1552
+ updateSearchParams
1583
1553
  ]),
1584
1554
  onSessionAlreadyAvailable: onSessionAlreadyAvailable
1585
1555
  });
@@ -1614,15 +1584,12 @@ function useRecoveryFlow(param) {
1614
1584
  returnTo,
1615
1585
  flow,
1616
1586
  handleFlowError,
1617
- kratosClient,
1618
- nav
1587
+ kratosClient
1619
1588
  ]);
1620
1589
  var submit = useCallback(function(param) {
1621
1590
  var body = param.body;
1622
1591
  if (!flow) return;
1623
- nav("".concat(recoveryRoute, "?").concat(flowIdParameterName, "=").concat(flow.id), {
1624
- replace: true
1625
- });
1592
+ updateSearchParams(_object_spread_props$c(_object_spread$f({}, searchParams), _define_property$f({}, flowIdParameterName, flow.id)));
1626
1593
  return kratosClient.updateRecoveryFlow({
1627
1594
  flow: flow.id,
1628
1595
  updateRecoveryFlowBody: body
@@ -1643,8 +1610,8 @@ function useRecoveryFlow(param) {
1643
1610
  });
1644
1611
  }, [
1645
1612
  flow,
1646
- nav,
1647
- recoveryRoute,
1613
+ updateSearchParams,
1614
+ searchParams,
1648
1615
  kratosClient,
1649
1616
  handleFlowError,
1650
1617
  onContinueWith
@@ -1664,6 +1631,19 @@ function _array_like_to_array$4(arr, len) {
1664
1631
  function _array_with_holes$3(arr) {
1665
1632
  if (Array.isArray(arr)) return arr;
1666
1633
  }
1634
+ function _define_property$e(obj, key, value) {
1635
+ if (key in obj) {
1636
+ Object.defineProperty(obj, key, {
1637
+ value: value,
1638
+ enumerable: true,
1639
+ configurable: true,
1640
+ writable: true
1641
+ });
1642
+ } else {
1643
+ obj[key] = value;
1644
+ }
1645
+ return obj;
1646
+ }
1667
1647
  function _iterable_to_array_limit$3(arr, i) {
1668
1648
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1669
1649
  if (_i == null) return;
@@ -1691,6 +1671,40 @@ function _iterable_to_array_limit$3(arr, i) {
1691
1671
  function _non_iterable_rest$3() {
1692
1672
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1693
1673
  }
1674
+ function _object_spread$e(target) {
1675
+ for(var i = 1; i < arguments.length; i++){
1676
+ var source = arguments[i] != null ? arguments[i] : {};
1677
+ var ownKeys = Object.keys(source);
1678
+ if (typeof Object.getOwnPropertySymbols === "function") {
1679
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1680
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1681
+ }));
1682
+ }
1683
+ ownKeys.forEach(function(key) {
1684
+ _define_property$e(target, key, source[key]);
1685
+ });
1686
+ }
1687
+ return target;
1688
+ }
1689
+ function ownKeys$b(object, enumerableOnly) {
1690
+ var keys = Object.keys(object);
1691
+ if (Object.getOwnPropertySymbols) {
1692
+ var symbols = Object.getOwnPropertySymbols(object);
1693
+ keys.push.apply(keys, symbols);
1694
+ }
1695
+ return keys;
1696
+ }
1697
+ function _object_spread_props$b(target, source) {
1698
+ source = source != null ? source : {};
1699
+ if (Object.getOwnPropertyDescriptors) {
1700
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1701
+ } else {
1702
+ ownKeys$b(Object(source)).forEach(function(key) {
1703
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1704
+ });
1705
+ }
1706
+ return target;
1707
+ }
1694
1708
  function _sliced_to_array$3(arr, i) {
1695
1709
  return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$3();
1696
1710
  }
@@ -1703,25 +1717,20 @@ function _unsupported_iterable_to_array$4(o, minLen) {
1703
1717
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
1704
1718
  }
1705
1719
  function useSettingsFlow(param) {
1706
- var kratosClient = param.kratosClient, settingsRoute = param.settingsRoute, params = param.params, onContinueWith = param.onContinueWith;
1720
+ var kratosClient = param.kratosClient, params = param.params, onContinueWith = param.onContinueWith, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
1707
1721
  var useHandleFlowError = useKratosContext().useHandleFlowError;
1708
1722
  var _useState = _sliced_to_array$3(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1709
- var search = useLocation().search;
1710
- var nav = useNavigate();
1711
- var _useMemo = useMemo(function() {
1712
- return parseSearchParams(search);
1713
- }, [
1714
- search
1715
- ]), flowId = _useMemo[flowIdParameterName], returnTo = _useMemo[returnToParameterName];
1723
+ var flowId = searchParams[flowIdParameterName], returnTo = searchParams[returnToParameterName];
1716
1724
  var handleFlowError = useHandleFlowError({
1717
1725
  resetFlow: useCallback(function() {
1718
- nav(settingsRoute, {
1719
- replace: true
1720
- });
1726
+ var newParams = omit(_object_spread$e({}, searchParams), [
1727
+ flowIdParameterName
1728
+ ]);
1729
+ updateSearchParams(newParams);
1721
1730
  setFlow(undefined);
1722
1731
  }, [
1723
- nav,
1724
- settingsRoute
1732
+ searchParams,
1733
+ updateSearchParams
1725
1734
  ])
1726
1735
  });
1727
1736
  useEffect(function() {
@@ -1756,15 +1765,12 @@ function useSettingsFlow(param) {
1756
1765
  handleFlowError,
1757
1766
  kratosClient,
1758
1767
  params,
1759
- returnTo,
1760
- settingsRoute
1768
+ returnTo
1761
1769
  ]);
1762
1770
  var submit = useCallback(function(param) {
1763
1771
  var body = param.body;
1764
1772
  if (!flow) return;
1765
- nav("".concat(settingsRoute, "?").concat(flowIdParameterName, "=").concat(flow.id), {
1766
- replace: true
1767
- });
1773
+ updateSearchParams(_object_spread_props$b(_object_spread$e({}, searchParams), _define_property$e({}, flowIdParameterName, flow.id)));
1768
1774
  return kratosClient.updateSettingsFlow({
1769
1775
  flow: flow.id,
1770
1776
  updateSettingsFlowBody: body
@@ -1789,8 +1795,8 @@ function useSettingsFlow(param) {
1789
1795
  });
1790
1796
  }, [
1791
1797
  flow,
1792
- nav,
1793
- settingsRoute,
1798
+ updateSearchParams,
1799
+ searchParams,
1794
1800
  kratosClient,
1795
1801
  handleFlowError,
1796
1802
  onContinueWith
@@ -1809,7 +1815,7 @@ function _array_like_to_array$3(arr, len) {
1809
1815
  function _array_with_holes$2(arr) {
1810
1816
  if (Array.isArray(arr)) return arr;
1811
1817
  }
1812
- function _define_property$b(obj, key, value) {
1818
+ function _define_property$d(obj, key, value) {
1813
1819
  if (key in obj) {
1814
1820
  Object.defineProperty(obj, key, {
1815
1821
  value: value,
@@ -1849,7 +1855,7 @@ function _iterable_to_array_limit$2(arr, i) {
1849
1855
  function _non_iterable_rest$2() {
1850
1856
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1851
1857
  }
1852
- function _object_spread$b(target) {
1858
+ function _object_spread$d(target) {
1853
1859
  for(var i = 1; i < arguments.length; i++){
1854
1860
  var source = arguments[i] != null ? arguments[i] : {};
1855
1861
  var ownKeys = Object.keys(source);
@@ -1859,12 +1865,12 @@ function _object_spread$b(target) {
1859
1865
  }));
1860
1866
  }
1861
1867
  ownKeys.forEach(function(key) {
1862
- _define_property$b(target, key, source[key]);
1868
+ _define_property$d(target, key, source[key]);
1863
1869
  });
1864
1870
  }
1865
1871
  return target;
1866
1872
  }
1867
- function ownKeys$8(object, enumerableOnly) {
1873
+ function ownKeys$a(object, enumerableOnly) {
1868
1874
  var keys = Object.keys(object);
1869
1875
  if (Object.getOwnPropertySymbols) {
1870
1876
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1872,12 +1878,12 @@ function ownKeys$8(object, enumerableOnly) {
1872
1878
  }
1873
1879
  return keys;
1874
1880
  }
1875
- function _object_spread_props$8(target, source) {
1881
+ function _object_spread_props$a(target, source) {
1876
1882
  source = source != null ? source : {};
1877
1883
  if (Object.getOwnPropertyDescriptors) {
1878
1884
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1879
1885
  } else {
1880
- ownKeys$8(Object(source)).forEach(function(key) {
1886
+ ownKeys$a(Object(source)).forEach(function(key) {
1881
1887
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1882
1888
  });
1883
1889
  }
@@ -1895,17 +1901,10 @@ function _unsupported_iterable_to_array$3(o, minLen) {
1895
1901
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
1896
1902
  }
1897
1903
  function useLoginFlow(param) {
1898
- var kratosClient = param.kratosClient, loginRoute = param.loginRoute, returnTo = param.returnTo, onLoggedIn = param.onLoggedIn, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable;
1904
+ 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;
1899
1905
  var useHandleFlowError = useKratosContext().useHandleFlowError;
1900
1906
  var _useState = _sliced_to_array$2(useState(), 2), flow = _useState[0], setFlow = _useState[1];
1901
- var search = useLocation().search;
1902
- var nav = useNavigate();
1903
- var searchParams = useMemo(function() {
1904
- return parseSearchParams(search);
1905
- }, [
1906
- search
1907
- ]);
1908
- var flowId = searchParams[flowIdParameterName], returnToFromSearch = searchParams[returnToParameterName], refresh = searchParams.refresh, authorizationAssuranceLevel = searchParams[aalParameterName];
1907
+ var flowId = searchParams[flowIdParameterName], returnToFromSearch = searchParams[returnToParameterName], refresh = searchParams[refreshParameterName], authorizationAssuranceLevel = searchParams[aalParameterName];
1909
1908
  useEffect(function() {
1910
1909
  setFlow(undefined);
1911
1910
  }, [
@@ -1913,18 +1912,15 @@ function useLoginFlow(param) {
1913
1912
  ]);
1914
1913
  var handleFlowError = useHandleFlowError({
1915
1914
  resetFlow: useCallback(function() {
1916
- var newParams = omit(_object_spread$b({}, searchParams), [
1915
+ var newParams = omit(_object_spread$d({}, searchParams), [
1917
1916
  flowIdParameterName,
1918
1917
  aalParameterName
1919
1918
  ]);
1920
- nav("".concat(loginRoute, "?").concat(new URLSearchParams(newParams)), {
1921
- replace: true
1922
- });
1919
+ updateSearchParams(newParams);
1923
1920
  setFlow(undefined);
1924
1921
  }, [
1925
- nav,
1926
1922
  searchParams,
1927
- loginRoute
1923
+ updateSearchParams
1928
1924
  ]),
1929
1925
  onSessionAlreadyAvailable: onSessionAlreadyAvailable
1930
1926
  });
@@ -1968,9 +1964,7 @@ function useLoginFlow(param) {
1968
1964
  var submit = useCallback(function(param) {
1969
1965
  var body = param.body;
1970
1966
  if (!flow) return;
1971
- nav("".concat(loginRoute, "?").concat(new URLSearchParams(_object_spread_props$8(_object_spread$b({}, searchParams), _define_property$b({}, flowIdParameterName, flow.id)))), {
1972
- replace: true
1973
- });
1967
+ updateSearchParams(_object_spread_props$a(_object_spread$d({}, searchParams), _define_property$d({}, flowIdParameterName, flow.id)));
1974
1968
  kratosClient.updateLoginFlow({
1975
1969
  flow: flow.id,
1976
1970
  updateLoginFlowBody: body
@@ -1992,8 +1986,7 @@ function useLoginFlow(param) {
1992
1986
  });
1993
1987
  }, [
1994
1988
  flow,
1995
- nav,
1996
- loginRoute,
1989
+ updateSearchParams,
1997
1990
  searchParams,
1998
1991
  kratosClient,
1999
1992
  handleFlowError,
@@ -2013,6 +2006,19 @@ function _array_like_to_array$2(arr, len) {
2013
2006
  function _array_with_holes$1(arr) {
2014
2007
  if (Array.isArray(arr)) return arr;
2015
2008
  }
2009
+ function _define_property$c(obj, key, value) {
2010
+ if (key in obj) {
2011
+ Object.defineProperty(obj, key, {
2012
+ value: value,
2013
+ enumerable: true,
2014
+ configurable: true,
2015
+ writable: true
2016
+ });
2017
+ } else {
2018
+ obj[key] = value;
2019
+ }
2020
+ return obj;
2021
+ }
2016
2022
  function _iterable_to_array_limit$1(arr, i) {
2017
2023
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2018
2024
  if (_i == null) return;
@@ -2040,6 +2046,40 @@ function _iterable_to_array_limit$1(arr, i) {
2040
2046
  function _non_iterable_rest$1() {
2041
2047
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2042
2048
  }
2049
+ function _object_spread$c(target) {
2050
+ for(var i = 1; i < arguments.length; i++){
2051
+ var source = arguments[i] != null ? arguments[i] : {};
2052
+ var ownKeys = Object.keys(source);
2053
+ if (typeof Object.getOwnPropertySymbols === "function") {
2054
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2055
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2056
+ }));
2057
+ }
2058
+ ownKeys.forEach(function(key) {
2059
+ _define_property$c(target, key, source[key]);
2060
+ });
2061
+ }
2062
+ return target;
2063
+ }
2064
+ function ownKeys$9(object, enumerableOnly) {
2065
+ var keys = Object.keys(object);
2066
+ if (Object.getOwnPropertySymbols) {
2067
+ var symbols = Object.getOwnPropertySymbols(object);
2068
+ keys.push.apply(keys, symbols);
2069
+ }
2070
+ return keys;
2071
+ }
2072
+ function _object_spread_props$9(target, source) {
2073
+ source = source != null ? source : {};
2074
+ if (Object.getOwnPropertyDescriptors) {
2075
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2076
+ } else {
2077
+ ownKeys$9(Object(source)).forEach(function(key) {
2078
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2079
+ });
2080
+ }
2081
+ return target;
2082
+ }
2043
2083
  function _sliced_to_array$1(arr, i) {
2044
2084
  return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
2045
2085
  }
@@ -2052,26 +2092,21 @@ function _unsupported_iterable_to_array$2(o, minLen) {
2052
2092
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
2053
2093
  }
2054
2094
  function useRegisterFlow(param) {
2055
- var kratosClient = param.kratosClient, registrationRoute = param.registrationRoute, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable, onContinueWith = param.onContinueWith;
2095
+ var kratosClient = param.kratosClient, onSessionAlreadyAvailable = param.onSessionAlreadyAvailable, onContinueWith = param.onContinueWith, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
2056
2096
  var useHandleFlowError = useKratosContext().useHandleFlowError;
2057
2097
  var _useState = _sliced_to_array$1(useState(), 2), flow = _useState[0], setFlow = _useState[1];
2058
2098
  var _useState1 = _sliced_to_array$1(useState(false), 2), isRegistered = _useState1[0], setIsRegistered = _useState1[1];
2059
- var search = useLocation().search;
2060
- var nav = useNavigate();
2061
- var _useMemo = useMemo(function() {
2062
- return parseSearchParams(search);
2063
- }, [
2064
- search
2065
- ]), flowId = _useMemo[flowIdParameterName], returnTo = _useMemo[returnToParameterName];
2099
+ var flowId = searchParams[flowIdParameterName], returnTo = searchParams[returnToParameterName];
2066
2100
  var handleFlowError = useHandleFlowError({
2067
2101
  resetFlow: useCallback(function() {
2068
- nav(registrationRoute, {
2069
- replace: true
2070
- });
2102
+ var newParams = omit(_object_spread$c({}, searchParams), [
2103
+ flowIdParameterName
2104
+ ]);
2105
+ updateSearchParams(newParams);
2071
2106
  setFlow(undefined);
2072
2107
  }, [
2073
- nav,
2074
- registrationRoute
2108
+ searchParams,
2109
+ updateSearchParams
2075
2110
  ]),
2076
2111
  onSessionAlreadyAvailable: onSessionAlreadyAvailable
2077
2112
  });
@@ -2110,9 +2145,7 @@ function useRegisterFlow(param) {
2110
2145
  var submit = useCallback(function(param) {
2111
2146
  var body = param.body;
2112
2147
  if (!flow) return;
2113
- nav("".concat(registrationRoute, "?").concat(flowIdParameterName, "=").concat(flow.id), {
2114
- replace: true
2115
- });
2148
+ updateSearchParams(_object_spread_props$9(_object_spread$c({}, searchParams), _define_property$c({}, flowIdParameterName, flow.id)));
2116
2149
  return kratosClient.updateRegistrationFlow({
2117
2150
  flow: flow.id,
2118
2151
  updateRegistrationFlowBody: body
@@ -2132,8 +2165,8 @@ function useRegisterFlow(param) {
2132
2165
  });
2133
2166
  }, [
2134
2167
  flow,
2135
- nav,
2136
- registrationRoute,
2168
+ updateSearchParams,
2169
+ searchParams,
2137
2170
  kratosClient,
2138
2171
  handleFlowError,
2139
2172
  onContinueWith
@@ -2153,6 +2186,19 @@ function _array_like_to_array$1(arr, len) {
2153
2186
  function _array_with_holes(arr) {
2154
2187
  if (Array.isArray(arr)) return arr;
2155
2188
  }
2189
+ function _define_property$b(obj, key, value) {
2190
+ if (key in obj) {
2191
+ Object.defineProperty(obj, key, {
2192
+ value: value,
2193
+ enumerable: true,
2194
+ configurable: true,
2195
+ writable: true
2196
+ });
2197
+ } else {
2198
+ obj[key] = value;
2199
+ }
2200
+ return obj;
2201
+ }
2156
2202
  function _iterable_to_array_limit(arr, i) {
2157
2203
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2158
2204
  if (_i == null) return;
@@ -2180,6 +2226,40 @@ function _iterable_to_array_limit(arr, i) {
2180
2226
  function _non_iterable_rest() {
2181
2227
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2182
2228
  }
2229
+ function _object_spread$b(target) {
2230
+ for(var i = 1; i < arguments.length; i++){
2231
+ var source = arguments[i] != null ? arguments[i] : {};
2232
+ var ownKeys = Object.keys(source);
2233
+ if (typeof Object.getOwnPropertySymbols === "function") {
2234
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2235
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2236
+ }));
2237
+ }
2238
+ ownKeys.forEach(function(key) {
2239
+ _define_property$b(target, key, source[key]);
2240
+ });
2241
+ }
2242
+ return target;
2243
+ }
2244
+ function ownKeys$8(object, enumerableOnly) {
2245
+ var keys = Object.keys(object);
2246
+ if (Object.getOwnPropertySymbols) {
2247
+ var symbols = Object.getOwnPropertySymbols(object);
2248
+ keys.push.apply(keys, symbols);
2249
+ }
2250
+ return keys;
2251
+ }
2252
+ function _object_spread_props$8(target, source) {
2253
+ source = source != null ? source : {};
2254
+ if (Object.getOwnPropertyDescriptors) {
2255
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2256
+ } else {
2257
+ ownKeys$8(Object(source)).forEach(function(key) {
2258
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2259
+ });
2260
+ }
2261
+ return target;
2262
+ }
2183
2263
  function _sliced_to_array(arr, i) {
2184
2264
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest();
2185
2265
  }
@@ -2192,32 +2272,16 @@ function _unsupported_iterable_to_array$1(o, minLen) {
2192
2272
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
2193
2273
  }
2194
2274
  function useVerificationFlow(param) {
2195
- var initialFlowId = param.initialFlowId, kratosClient = param.kratosClient, onVerified = param.onVerified;
2275
+ var initialFlowId = param.initialFlowId, kratosClient = param.kratosClient, onVerified = param.onVerified, _param_searchParams = param.searchParams, searchParams = _param_searchParams === void 0 ? {} : _param_searchParams, updateSearchParams = param.updateSearchParams;
2196
2276
  var useHandleFlowError = useKratosContext().useHandleFlowError;
2197
2277
  var _useState = _sliced_to_array(useState(), 2), flow = _useState[0], setFlow = _useState[1];
2198
- var search = useLocation().search;
2199
- var nav = useNavigate();
2200
- var _useMemo = useMemo(function() {
2201
- return parseSearchParams(search);
2202
- }, [
2203
- search
2204
- ]), tmp = _useMemo[flowIdParameterName], flowId = tmp === void 0 ? initialFlowId : tmp, returnTo = _useMemo[returnToParameterName];
2278
+ var tmp = searchParams[flowIdParameterName], flowId = tmp === void 0 ? initialFlowId : tmp, returnTo = searchParams[returnToParameterName];
2205
2279
  var resetFlow = useCallback(function(flowId) {
2206
- var params = new URLSearchParams(search);
2207
- if (flowId) {
2208
- params.set(flowIdParameterName, flowId);
2209
- } else {
2210
- params.delete(flowIdParameterName);
2211
- }
2212
- nav({
2213
- search: params.toString()
2214
- }, {
2215
- replace: true
2216
- });
2280
+ updateSearchParams(_object_spread_props$8(_object_spread$b({}, searchParams), _define_property$b({}, flowIdParameterName, flowId)));
2217
2281
  setFlow(undefined);
2218
2282
  }, [
2219
- nav,
2220
- search
2283
+ searchParams,
2284
+ updateSearchParams
2221
2285
  ]);
2222
2286
  var reset = function() {
2223
2287
  resetFlow();
@@ -2262,19 +2326,12 @@ function useVerificationFlow(param) {
2262
2326
  flow,
2263
2327
  handleFlowError,
2264
2328
  kratosClient,
2265
- nav,
2266
2329
  onVerified
2267
2330
  ]);
2268
2331
  var submit = useCallback(function(param) {
2269
2332
  var body = param.body;
2270
2333
  if (!flow) return;
2271
- var params = new URLSearchParams(search);
2272
- params.set(flowIdParameterName, flow.id);
2273
- nav({
2274
- search: params.toString()
2275
- }, {
2276
- replace: true
2277
- });
2334
+ updateSearchParams(_object_spread_props$8(_object_spread$b({}, searchParams), _define_property$b({}, flowIdParameterName, flow.id)));
2278
2335
  return kratosClient.updateVerificationFlow({
2279
2336
  flow: flow.id,
2280
2337
  updateVerificationFlowBody: body
@@ -2292,8 +2349,8 @@ function useVerificationFlow(param) {
2292
2349
  });
2293
2350
  }, [
2294
2351
  flow,
2295
- search,
2296
- nav,
2352
+ updateSearchParams,
2353
+ searchParams,
2297
2354
  kratosClient,
2298
2355
  handleFlowError
2299
2356
  ]);
@@ -4102,4 +4159,4 @@ function UserSettingsCard(param) {
4102
4159
  });
4103
4160
  }
4104
4161
 
4105
- 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, returnToParameterName, useKratosContext, useLoginFlow, useLogoutFlow, useReauthenticationFlow, useRecoveryFlow, useRegisterFlow, useSettingsFlow, useVerificationFlow };
4162
+ 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 };