@leancodepl/kratos 7.8.2 → 8.0.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.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var client = require('@ory/client');
6
4
  var axios = require('axios');
7
5
  var react = require('react');
@@ -11,13 +9,8 @@ var reactRouter = require('react-router');
11
9
  var lodash = require('lodash');
12
10
  var yn = require('yn');
13
11
 
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
-
16
- var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
17
- var yn__default = /*#__PURE__*/_interopDefaultLegacy(yn);
18
-
19
12
  function createKratosClient(configuration) {
20
- return new client.FrontendApi(new client.Configuration(configuration), undefined, axios__default["default"].create({
13
+ return new client.FrontendApi(new client.Configuration(configuration), undefined, axios.create({
21
14
  withCredentials: true
22
15
  }));
23
16
  }
@@ -200,11 +193,6 @@ function ownKeys$b(object, enumerableOnly) {
200
193
  var keys = Object.keys(object);
201
194
  if (Object.getOwnPropertySymbols) {
202
195
  var symbols = Object.getOwnPropertySymbols(object);
203
- if (enumerableOnly) {
204
- symbols = symbols.filter(function(sym) {
205
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
206
- });
207
- }
208
196
  keys.push.apply(keys, symbols);
209
197
  }
210
198
  return keys;
@@ -288,11 +276,6 @@ function ownKeys$a(object, enumerableOnly) {
288
276
  var keys = Object.keys(object);
289
277
  if (Object.getOwnPropertySymbols) {
290
278
  var symbols = Object.getOwnPropertySymbols(object);
291
- if (enumerableOnly) {
292
- symbols = symbols.filter(function(sym) {
293
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
294
- });
295
- }
296
279
  keys.push.apply(keys, symbols);
297
280
  }
298
281
  return keys;
@@ -564,7 +547,6 @@ function DefaultLinkComponent(_param) {
564
547
 
565
548
  function DefaultMessageComponent(param) {
566
549
  var children = param.children;
567
- // eslint-disable-next-line react/jsx-no-useless-fragment
568
550
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
569
551
  children: children
570
552
  });
@@ -678,11 +660,6 @@ function ownKeys$9(object, enumerableOnly) {
678
660
  var keys = Object.keys(object);
679
661
  if (Object.getOwnPropertySymbols) {
680
662
  var symbols = Object.getOwnPropertySymbols(object);
681
- if (enumerableOnly) {
682
- symbols = symbols.filter(function(sym) {
683
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
684
- });
685
- }
686
663
  keys.push.apply(keys, symbols);
687
664
  }
688
665
  return keys;
@@ -925,7 +902,6 @@ function _defineProperties(target, props) {
925
902
  }
926
903
  function _create_class(Constructor, protoProps, staticProps) {
927
904
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
928
- if (staticProps) _defineProperties(Constructor, staticProps);
929
905
  return Constructor;
930
906
  }
931
907
  function _define_property$c(obj, key, value) {
@@ -960,7 +936,7 @@ var BaseSessionManager = /*#__PURE__*/ function() {
960
936
  _define_property$c(this, "checkIfLoggedIn", function() {
961
937
  var fetchSubject = new rxjs.Subject();
962
938
  fetchSubject.pipe(rxjs.switchMap(function() {
963
- return rxjs.from(axios__default["default"].get("".concat(_this.authUrl, "/sessions/whoami"), {
939
+ return rxjs.from(axios.get("".concat(_this.authUrl, "/sessions/whoami"), {
964
940
  withCredentials: true
965
941
  })).pipe(rxjs.map(function(response) {
966
942
  var returnTo = new URLSearchParams(window.location.search).get(returnToParameterName);
@@ -1894,11 +1870,6 @@ function ownKeys$8(object, enumerableOnly) {
1894
1870
  var keys = Object.keys(object);
1895
1871
  if (Object.getOwnPropertySymbols) {
1896
1872
  var symbols = Object.getOwnPropertySymbols(object);
1897
- if (enumerableOnly) {
1898
- symbols = symbols.filter(function(sym) {
1899
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1900
- });
1901
- }
1902
1873
  keys.push.apply(keys, symbols);
1903
1874
  }
1904
1875
  return keys;
@@ -1974,7 +1945,7 @@ function useLoginFlow(param) {
1974
1945
  } else {
1975
1946
  kratosClient.createBrowserLoginFlow({
1976
1947
  aal: authorizationAssuranceLevel,
1977
- refresh: yn__default["default"](refresh),
1948
+ refresh: yn(refresh),
1978
1949
  returnTo: returnTo !== null && returnTo !== void 0 ? returnTo : returnToFromSearch
1979
1950
  }, {
1980
1951
  signal: controller.signal
@@ -2257,7 +2228,7 @@ function useVerificationFlow(param) {
2257
2228
  resetFlow: resetFlow
2258
2229
  });
2259
2230
  react.useEffect(function() {
2260
- (flow === null || flow === void 0 ? void 0 : flow.state) === "passed_challenge" && onVerified();
2231
+ if ((flow === null || flow === void 0 ? void 0 : flow.state) === "passed_challenge") onVerified();
2261
2232
  }, [
2262
2233
  flow === null || flow === void 0 ? void 0 : flow.state,
2263
2234
  onVerified
@@ -2810,71 +2781,6 @@ function FilterFlowNodes(_param) {
2810
2781
  });
2811
2782
  }
2812
2783
 
2813
- function _array_like_to_array(arr, len) {
2814
- if (len == null || len > arr.length) len = arr.length;
2815
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2816
- return arr2;
2817
- }
2818
- function _array_without_holes(arr) {
2819
- if (Array.isArray(arr)) return _array_like_to_array(arr);
2820
- }
2821
- function _iterable_to_array(iter) {
2822
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2823
- }
2824
- function _non_iterable_spread() {
2825
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2826
- }
2827
- function _to_consumable_array(arr) {
2828
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2829
- }
2830
- function _unsupported_iterable_to_array(o, minLen) {
2831
- if (!o) return;
2832
- if (typeof o === "string") return _array_like_to_array(o, minLen);
2833
- var n = Object.prototype.toString.call(o).slice(8, -1);
2834
- if (n === "Object" && o.constructor) n = o.constructor.name;
2835
- if (n === "Map" || n === "Set") return Array.from(n);
2836
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2837
- }
2838
- function useScriptNodes(param) {
2839
- var nodes = param.nodes, excludeScripts = param.excludeScripts;
2840
- react.useEffect(function() {
2841
- if (excludeScripts) {
2842
- return;
2843
- }
2844
- var scriptNodes = filterNodesByGroups({
2845
- nodes: nodes,
2846
- groups: client.UiNodeGroupEnum.Webauthn,
2847
- attributes: "text/javascript",
2848
- withoutDefaultGroup: true,
2849
- withoutDefaultAttributes: true
2850
- }).reduce(function(accumulator, node) {
2851
- var attr = node.attributes;
2852
- if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2853
- return accumulator;
2854
- }
2855
- var script = document.createElement("script");
2856
- script.src = attr.src;
2857
- script.type = attr.type;
2858
- script.async = attr.async;
2859
- script.referrerPolicy = attr.referrerpolicy;
2860
- script.crossOrigin = attr.crossorigin;
2861
- script.integrity = attr.integrity;
2862
- document.body.appendChild(script);
2863
- return _to_consumable_array(accumulator).concat([
2864
- script
2865
- ]);
2866
- }, []);
2867
- return function() {
2868
- scriptNodes.forEach(function(script) {
2869
- document.body.removeChild(script);
2870
- });
2871
- };
2872
- }, [
2873
- excludeScripts,
2874
- nodes
2875
- ]);
2876
- }
2877
-
2878
2784
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ function _define_property$8(obj, key, value) {
2879
2785
  if (key in obj) {
2880
2786
  Object.defineProperty(obj, key, {
@@ -2907,11 +2813,6 @@ function ownKeys$7(object, enumerableOnly) {
2907
2813
  var keys = Object.keys(object);
2908
2814
  if (Object.getOwnPropertySymbols) {
2909
2815
  var symbols = Object.getOwnPropertySymbols(object);
2910
- if (enumerableOnly) {
2911
- symbols = symbols.filter(function(sym) {
2912
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2913
- });
2914
- }
2915
2816
  keys.push.apply(keys, symbols);
2916
2817
  }
2917
2818
  return keys;
@@ -2984,7 +2885,6 @@ function _object_without_properties_loose(source, excluded) {
2984
2885
  var form = event.currentTarget;
2985
2886
  var formData = new FormData(form);
2986
2887
  // map the entire form data to JSON for the request body
2987
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2988
2888
  var body = Object.fromEntries(formData);
2989
2889
  // We need the method specified from the name and value of the submit button.
2990
2890
  // when multiple submit buttons are present, the clicked one's value is used.
@@ -3012,6 +2912,71 @@ function _object_without_properties_loose(source, excluded) {
3012
2912
  }));
3013
2913
  }
3014
2914
 
2915
+ function _array_like_to_array(arr, len) {
2916
+ if (len == null || len > arr.length) len = arr.length;
2917
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2918
+ return arr2;
2919
+ }
2920
+ function _array_without_holes(arr) {
2921
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
2922
+ }
2923
+ function _iterable_to_array(iter) {
2924
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2925
+ }
2926
+ function _non_iterable_spread() {
2927
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2928
+ }
2929
+ function _to_consumable_array(arr) {
2930
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2931
+ }
2932
+ function _unsupported_iterable_to_array(o, minLen) {
2933
+ if (!o) return;
2934
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
2935
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2936
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2937
+ if (n === "Map" || n === "Set") return Array.from(n);
2938
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2939
+ }
2940
+ function useScriptNodes(param) {
2941
+ var nodes = param.nodes, excludeScripts = param.excludeScripts;
2942
+ react.useEffect(function() {
2943
+ if (excludeScripts) {
2944
+ return;
2945
+ }
2946
+ var scriptNodes = filterNodesByGroups({
2947
+ nodes: nodes,
2948
+ groups: client.UiNodeGroupEnum.Webauthn,
2949
+ attributes: "text/javascript",
2950
+ withoutDefaultGroup: true,
2951
+ withoutDefaultAttributes: true
2952
+ }).reduce(function(accumulator, node) {
2953
+ var attr = node.attributes;
2954
+ if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2955
+ return accumulator;
2956
+ }
2957
+ var script = document.createElement("script");
2958
+ script.src = attr.src;
2959
+ script.type = attr.type;
2960
+ script.async = attr.async;
2961
+ script.referrerPolicy = attr.referrerpolicy;
2962
+ script.crossOrigin = attr.crossorigin;
2963
+ script.integrity = attr.integrity;
2964
+ document.body.appendChild(script);
2965
+ return _to_consumable_array(accumulator).concat([
2966
+ script
2967
+ ]);
2968
+ }, []);
2969
+ return function() {
2970
+ scriptNodes.forEach(function(script) {
2971
+ document.body.removeChild(script);
2972
+ });
2973
+ };
2974
+ }, [
2975
+ excludeScripts,
2976
+ nodes
2977
+ ]);
2978
+ }
2979
+
3015
2980
  function hasOidc(nodes) {
3016
2981
  return nodes.some(function(param) {
3017
2982
  var group = param.group;
@@ -3270,11 +3235,6 @@ function ownKeys$6(object, enumerableOnly) {
3270
3235
  var keys = Object.keys(object);
3271
3236
  if (Object.getOwnPropertySymbols) {
3272
3237
  var symbols = Object.getOwnPropertySymbols(object);
3273
- if (enumerableOnly) {
3274
- symbols = symbols.filter(function(sym) {
3275
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3276
- });
3277
- }
3278
3238
  keys.push.apply(keys, symbols);
3279
3239
  }
3280
3240
  return keys;
@@ -3413,11 +3373,6 @@ function ownKeys$5(object, enumerableOnly) {
3413
3373
  var keys = Object.keys(object);
3414
3374
  if (Object.getOwnPropertySymbols) {
3415
3375
  var symbols = Object.getOwnPropertySymbols(object);
3416
- if (enumerableOnly) {
3417
- symbols = symbols.filter(function(sym) {
3418
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3419
- });
3420
- }
3421
3376
  keys.push.apply(keys, symbols);
3422
3377
  }
3423
3378
  return keys;
@@ -3760,11 +3715,6 @@ function ownKeys$4(object, enumerableOnly) {
3760
3715
  var keys = Object.keys(object);
3761
3716
  if (Object.getOwnPropertySymbols) {
3762
3717
  var symbols = Object.getOwnPropertySymbols(object);
3763
- if (enumerableOnly) {
3764
- symbols = symbols.filter(function(sym) {
3765
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3766
- });
3767
- }
3768
3718
  keys.push.apply(keys, symbols);
3769
3719
  }
3770
3720
  return keys;
@@ -3850,11 +3800,6 @@ function ownKeys$3(object, enumerableOnly) {
3850
3800
  var keys = Object.keys(object);
3851
3801
  if (Object.getOwnPropertySymbols) {
3852
3802
  var symbols = Object.getOwnPropertySymbols(object);
3853
- if (enumerableOnly) {
3854
- symbols = symbols.filter(function(sym) {
3855
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3856
- });
3857
- }
3858
3803
  keys.push.apply(keys, symbols);
3859
3804
  }
3860
3805
  return keys;
@@ -3926,11 +3871,6 @@ function ownKeys$2(object, enumerableOnly) {
3926
3871
  var keys = Object.keys(object);
3927
3872
  if (Object.getOwnPropertySymbols) {
3928
3873
  var symbols = Object.getOwnPropertySymbols(object);
3929
- if (enumerableOnly) {
3930
- symbols = symbols.filter(function(sym) {
3931
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3932
- });
3933
- }
3934
3874
  keys.push.apply(keys, symbols);
3935
3875
  }
3936
3876
  return keys;
@@ -4002,11 +3942,6 @@ function ownKeys$1(object, enumerableOnly) {
4002
3942
  var keys = Object.keys(object);
4003
3943
  if (Object.getOwnPropertySymbols) {
4004
3944
  var symbols = Object.getOwnPropertySymbols(object);
4005
- if (enumerableOnly) {
4006
- symbols = symbols.filter(function(sym) {
4007
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
4008
- });
4009
- }
4010
3945
  keys.push.apply(keys, symbols);
4011
3946
  }
4012
3947
  return keys;
@@ -4076,11 +4011,6 @@ function ownKeys(object, enumerableOnly) {
4076
4011
  var keys = Object.keys(object);
4077
4012
  if (Object.getOwnPropertySymbols) {
4078
4013
  var symbols = Object.getOwnPropertySymbols(object);
4079
- if (enumerableOnly) {
4080
- symbols = symbols.filter(function(sym) {
4081
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
4082
- });
4083
- }
4084
4014
  keys.push.apply(keys, symbols);
4085
4015
  }
4086
4016
  return keys;
package/index.esm.js CHANGED
@@ -191,11 +191,6 @@ function ownKeys$b(object, enumerableOnly) {
191
191
  var keys = Object.keys(object);
192
192
  if (Object.getOwnPropertySymbols) {
193
193
  var symbols = Object.getOwnPropertySymbols(object);
194
- if (enumerableOnly) {
195
- symbols = symbols.filter(function(sym) {
196
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
197
- });
198
- }
199
194
  keys.push.apply(keys, symbols);
200
195
  }
201
196
  return keys;
@@ -279,11 +274,6 @@ function ownKeys$a(object, enumerableOnly) {
279
274
  var keys = Object.keys(object);
280
275
  if (Object.getOwnPropertySymbols) {
281
276
  var symbols = Object.getOwnPropertySymbols(object);
282
- if (enumerableOnly) {
283
- symbols = symbols.filter(function(sym) {
284
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
285
- });
286
- }
287
277
  keys.push.apply(keys, symbols);
288
278
  }
289
279
  return keys;
@@ -555,7 +545,6 @@ function DefaultLinkComponent(_param) {
555
545
 
556
546
  function DefaultMessageComponent(param) {
557
547
  var children = param.children;
558
- // eslint-disable-next-line react/jsx-no-useless-fragment
559
548
  return /*#__PURE__*/ jsx(Fragment, {
560
549
  children: children
561
550
  });
@@ -669,11 +658,6 @@ function ownKeys$9(object, enumerableOnly) {
669
658
  var keys = Object.keys(object);
670
659
  if (Object.getOwnPropertySymbols) {
671
660
  var symbols = Object.getOwnPropertySymbols(object);
672
- if (enumerableOnly) {
673
- symbols = symbols.filter(function(sym) {
674
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
675
- });
676
- }
677
661
  keys.push.apply(keys, symbols);
678
662
  }
679
663
  return keys;
@@ -916,7 +900,6 @@ function _defineProperties(target, props) {
916
900
  }
917
901
  function _create_class(Constructor, protoProps, staticProps) {
918
902
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
919
- if (staticProps) _defineProperties(Constructor, staticProps);
920
903
  return Constructor;
921
904
  }
922
905
  function _define_property$c(obj, key, value) {
@@ -1885,11 +1868,6 @@ function ownKeys$8(object, enumerableOnly) {
1885
1868
  var keys = Object.keys(object);
1886
1869
  if (Object.getOwnPropertySymbols) {
1887
1870
  var symbols = Object.getOwnPropertySymbols(object);
1888
- if (enumerableOnly) {
1889
- symbols = symbols.filter(function(sym) {
1890
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1891
- });
1892
- }
1893
1871
  keys.push.apply(keys, symbols);
1894
1872
  }
1895
1873
  return keys;
@@ -2248,7 +2226,7 @@ function useVerificationFlow(param) {
2248
2226
  resetFlow: resetFlow
2249
2227
  });
2250
2228
  useEffect(function() {
2251
- (flow === null || flow === void 0 ? void 0 : flow.state) === "passed_challenge" && onVerified();
2229
+ if ((flow === null || flow === void 0 ? void 0 : flow.state) === "passed_challenge") onVerified();
2252
2230
  }, [
2253
2231
  flow === null || flow === void 0 ? void 0 : flow.state,
2254
2232
  onVerified
@@ -2801,71 +2779,6 @@ function FilterFlowNodes(_param) {
2801
2779
  });
2802
2780
  }
2803
2781
 
2804
- function _array_like_to_array(arr, len) {
2805
- if (len == null || len > arr.length) len = arr.length;
2806
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2807
- return arr2;
2808
- }
2809
- function _array_without_holes(arr) {
2810
- if (Array.isArray(arr)) return _array_like_to_array(arr);
2811
- }
2812
- function _iterable_to_array(iter) {
2813
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2814
- }
2815
- function _non_iterable_spread() {
2816
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2817
- }
2818
- function _to_consumable_array(arr) {
2819
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2820
- }
2821
- function _unsupported_iterable_to_array(o, minLen) {
2822
- if (!o) return;
2823
- if (typeof o === "string") return _array_like_to_array(o, minLen);
2824
- var n = Object.prototype.toString.call(o).slice(8, -1);
2825
- if (n === "Object" && o.constructor) n = o.constructor.name;
2826
- if (n === "Map" || n === "Set") return Array.from(n);
2827
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2828
- }
2829
- function useScriptNodes(param) {
2830
- var nodes = param.nodes, excludeScripts = param.excludeScripts;
2831
- useEffect(function() {
2832
- if (excludeScripts) {
2833
- return;
2834
- }
2835
- var scriptNodes = filterNodesByGroups({
2836
- nodes: nodes,
2837
- groups: UiNodeGroupEnum.Webauthn,
2838
- attributes: "text/javascript",
2839
- withoutDefaultGroup: true,
2840
- withoutDefaultAttributes: true
2841
- }).reduce(function(accumulator, node) {
2842
- var attr = node.attributes;
2843
- if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2844
- return accumulator;
2845
- }
2846
- var script = document.createElement("script");
2847
- script.src = attr.src;
2848
- script.type = attr.type;
2849
- script.async = attr.async;
2850
- script.referrerPolicy = attr.referrerpolicy;
2851
- script.crossOrigin = attr.crossorigin;
2852
- script.integrity = attr.integrity;
2853
- document.body.appendChild(script);
2854
- return _to_consumable_array(accumulator).concat([
2855
- script
2856
- ]);
2857
- }, []);
2858
- return function() {
2859
- scriptNodes.forEach(function(script) {
2860
- document.body.removeChild(script);
2861
- });
2862
- };
2863
- }, [
2864
- excludeScripts,
2865
- nodes
2866
- ]);
2867
- }
2868
-
2869
2782
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ function _define_property$8(obj, key, value) {
2870
2783
  if (key in obj) {
2871
2784
  Object.defineProperty(obj, key, {
@@ -2898,11 +2811,6 @@ function ownKeys$7(object, enumerableOnly) {
2898
2811
  var keys = Object.keys(object);
2899
2812
  if (Object.getOwnPropertySymbols) {
2900
2813
  var symbols = Object.getOwnPropertySymbols(object);
2901
- if (enumerableOnly) {
2902
- symbols = symbols.filter(function(sym) {
2903
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2904
- });
2905
- }
2906
2814
  keys.push.apply(keys, symbols);
2907
2815
  }
2908
2816
  return keys;
@@ -2975,7 +2883,6 @@ function _object_without_properties_loose(source, excluded) {
2975
2883
  var form = event.currentTarget;
2976
2884
  var formData = new FormData(form);
2977
2885
  // map the entire form data to JSON for the request body
2978
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2979
2886
  var body = Object.fromEntries(formData);
2980
2887
  // We need the method specified from the name and value of the submit button.
2981
2888
  // when multiple submit buttons are present, the clicked one's value is used.
@@ -3003,6 +2910,71 @@ function _object_without_properties_loose(source, excluded) {
3003
2910
  }));
3004
2911
  }
3005
2912
 
2913
+ function _array_like_to_array(arr, len) {
2914
+ if (len == null || len > arr.length) len = arr.length;
2915
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2916
+ return arr2;
2917
+ }
2918
+ function _array_without_holes(arr) {
2919
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
2920
+ }
2921
+ function _iterable_to_array(iter) {
2922
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2923
+ }
2924
+ function _non_iterable_spread() {
2925
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2926
+ }
2927
+ function _to_consumable_array(arr) {
2928
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2929
+ }
2930
+ function _unsupported_iterable_to_array(o, minLen) {
2931
+ if (!o) return;
2932
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
2933
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2934
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2935
+ if (n === "Map" || n === "Set") return Array.from(n);
2936
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2937
+ }
2938
+ function useScriptNodes(param) {
2939
+ var nodes = param.nodes, excludeScripts = param.excludeScripts;
2940
+ useEffect(function() {
2941
+ if (excludeScripts) {
2942
+ return;
2943
+ }
2944
+ var scriptNodes = filterNodesByGroups({
2945
+ nodes: nodes,
2946
+ groups: UiNodeGroupEnum.Webauthn,
2947
+ attributes: "text/javascript",
2948
+ withoutDefaultGroup: true,
2949
+ withoutDefaultAttributes: true
2950
+ }).reduce(function(accumulator, node) {
2951
+ var attr = node.attributes;
2952
+ if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2953
+ return accumulator;
2954
+ }
2955
+ var script = document.createElement("script");
2956
+ script.src = attr.src;
2957
+ script.type = attr.type;
2958
+ script.async = attr.async;
2959
+ script.referrerPolicy = attr.referrerpolicy;
2960
+ script.crossOrigin = attr.crossorigin;
2961
+ script.integrity = attr.integrity;
2962
+ document.body.appendChild(script);
2963
+ return _to_consumable_array(accumulator).concat([
2964
+ script
2965
+ ]);
2966
+ }, []);
2967
+ return function() {
2968
+ scriptNodes.forEach(function(script) {
2969
+ document.body.removeChild(script);
2970
+ });
2971
+ };
2972
+ }, [
2973
+ excludeScripts,
2974
+ nodes
2975
+ ]);
2976
+ }
2977
+
3006
2978
  function hasOidc(nodes) {
3007
2979
  return nodes.some(function(param) {
3008
2980
  var group = param.group;
@@ -3261,11 +3233,6 @@ function ownKeys$6(object, enumerableOnly) {
3261
3233
  var keys = Object.keys(object);
3262
3234
  if (Object.getOwnPropertySymbols) {
3263
3235
  var symbols = Object.getOwnPropertySymbols(object);
3264
- if (enumerableOnly) {
3265
- symbols = symbols.filter(function(sym) {
3266
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3267
- });
3268
- }
3269
3236
  keys.push.apply(keys, symbols);
3270
3237
  }
3271
3238
  return keys;
@@ -3404,11 +3371,6 @@ function ownKeys$5(object, enumerableOnly) {
3404
3371
  var keys = Object.keys(object);
3405
3372
  if (Object.getOwnPropertySymbols) {
3406
3373
  var symbols = Object.getOwnPropertySymbols(object);
3407
- if (enumerableOnly) {
3408
- symbols = symbols.filter(function(sym) {
3409
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3410
- });
3411
- }
3412
3374
  keys.push.apply(keys, symbols);
3413
3375
  }
3414
3376
  return keys;
@@ -3751,11 +3713,6 @@ function ownKeys$4(object, enumerableOnly) {
3751
3713
  var keys = Object.keys(object);
3752
3714
  if (Object.getOwnPropertySymbols) {
3753
3715
  var symbols = Object.getOwnPropertySymbols(object);
3754
- if (enumerableOnly) {
3755
- symbols = symbols.filter(function(sym) {
3756
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3757
- });
3758
- }
3759
3716
  keys.push.apply(keys, symbols);
3760
3717
  }
3761
3718
  return keys;
@@ -3841,11 +3798,6 @@ function ownKeys$3(object, enumerableOnly) {
3841
3798
  var keys = Object.keys(object);
3842
3799
  if (Object.getOwnPropertySymbols) {
3843
3800
  var symbols = Object.getOwnPropertySymbols(object);
3844
- if (enumerableOnly) {
3845
- symbols = symbols.filter(function(sym) {
3846
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3847
- });
3848
- }
3849
3801
  keys.push.apply(keys, symbols);
3850
3802
  }
3851
3803
  return keys;
@@ -3917,11 +3869,6 @@ function ownKeys$2(object, enumerableOnly) {
3917
3869
  var keys = Object.keys(object);
3918
3870
  if (Object.getOwnPropertySymbols) {
3919
3871
  var symbols = Object.getOwnPropertySymbols(object);
3920
- if (enumerableOnly) {
3921
- symbols = symbols.filter(function(sym) {
3922
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3923
- });
3924
- }
3925
3872
  keys.push.apply(keys, symbols);
3926
3873
  }
3927
3874
  return keys;
@@ -3993,11 +3940,6 @@ function ownKeys$1(object, enumerableOnly) {
3993
3940
  var keys = Object.keys(object);
3994
3941
  if (Object.getOwnPropertySymbols) {
3995
3942
  var symbols = Object.getOwnPropertySymbols(object);
3996
- if (enumerableOnly) {
3997
- symbols = symbols.filter(function(sym) {
3998
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3999
- });
4000
- }
4001
3943
  keys.push.apply(keys, symbols);
4002
3944
  }
4003
3945
  return keys;
@@ -4067,11 +4009,6 @@ function ownKeys(object, enumerableOnly) {
4067
4009
  var keys = Object.keys(object);
4068
4010
  if (Object.getOwnPropertySymbols) {
4069
4011
  var symbols = Object.getOwnPropertySymbols(object);
4070
- if (enumerableOnly) {
4071
- symbols = symbols.filter(function(sym) {
4072
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
4073
- });
4074
- }
4075
4012
  keys.push.apply(keys, symbols);
4076
4013
  }
4077
4014
  return keys;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leancodepl/kratos",
3
- "version": "7.8.2",
3
+ "version": "8.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "dependencies": {
6
6
  "@ory/client": ">=1.14.3",
@@ -11,14 +11,22 @@
11
11
  "rxjs": ">=7.0.0",
12
12
  "yn": ">=5.0.0"
13
13
  },
14
+ "devDependencies": {
15
+ "react": "18.3.1"
16
+ },
17
+ "peerDependencies": {
18
+ "react": "*"
19
+ },
14
20
  "exports": {
15
21
  "./package.json": "./package.json",
16
22
  ".": {
17
23
  "module": "./index.esm.js",
24
+ "types": "./index.esm.d.ts",
18
25
  "import": "./index.cjs.mjs",
19
26
  "default": "./index.cjs.js"
20
27
  }
21
28
  },
22
29
  "module": "./index.esm.js",
23
- "main": "./index.cjs.js"
30
+ "main": "./index.cjs.js",
31
+ "types": "./index.esm.d.ts"
24
32
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { KratosComponents } from "./types/components";
3
2
  import type { UseHandleFlowError } from "./types/useHandleFlowError";
4
3
  export type KratosContextData = {
@@ -1,11 +1,11 @@
1
1
  import { UiNode, UiNodeGroupEnum, UiNodeInputAttributesTypeEnum } from "@ory/client";
2
2
  export type FilterNodesByGroups = {
3
3
  nodes: Array<UiNode>;
4
- groups?: Array<UiNodeGroupEnum | string> | UiNodeGroupEnum | string;
4
+ groups?: Array<string | UiNodeGroupEnum> | string | UiNodeGroupEnum;
5
5
  withoutDefaultGroup?: boolean;
6
- attributes?: Array<UiNodeInputAttributesTypeEnum | string> | UiNodeInputAttributesTypeEnum | string;
6
+ attributes?: Array<string | UiNodeInputAttributesTypeEnum> | string | UiNodeInputAttributesTypeEnum;
7
7
  withoutDefaultAttributes?: boolean;
8
- excludeAttributes?: Array<UiNodeInputAttributesTypeEnum | string> | UiNodeInputAttributesTypeEnum | string;
8
+ excludeAttributes?: Array<string | UiNodeInputAttributesTypeEnum> | string | UiNodeInputAttributesTypeEnum;
9
9
  };
10
10
  /**
11
11
  * Filters nodes by their groups and attributes.