@leancodepl/kratos 7.3.7 → 7.4.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
@@ -2500,6 +2500,55 @@ function useLogoutFlow(param) {
2500
2500
  };
2501
2501
  }
2502
2502
 
2503
+ function getNodeInputType(attr) {
2504
+ return lodash.isObject(attr) && "type" in attr && lodash.isString(attr.type) ? attr.type : "";
2505
+ }
2506
+
2507
+ /**
2508
+ * Filters nodes by their groups and attributes.
2509
+ * If no filtering options are specified, all nodes are returned.
2510
+ * Will always add default nodes unless `withoutDefaultGroup` is true.
2511
+ * Will always add default attributes unless `withoutDefaultAttributes` is true.
2512
+ * @param {Object} filterNodesByGroups - An object containing the nodes and the filtering options.
2513
+ * @param {Array<UiNode>} filterNodesByGroups.nodes - An array of nodes.
2514
+ * @param {Array<UiNodeGroupEnum | string> | string} filterNodesByGroups.groups - An array or comma seperated strings of groups to filter by.
2515
+ * @param {boolean} filterNodesByGroups.withoutDefaultGroup - If true, will not add default nodes under the 'default' category.
2516
+ * @param {Array<UiNodeInputAttributesTypeEnum | string> | string} filterNodesByGroups.attributes - An array or comma seperated strings of attributes to filter by.
2517
+ * @param {boolean} filterNodesByGroups.withoutDefaultAttributes - If true, will not add default attributes such as 'hidden' and 'script'.
2518
+ */ var filterNodesByGroups = function(param) {
2519
+ var nodes = param.nodes, groups = param.groups, withoutDefaultGroup = param.withoutDefaultGroup, attributes = param.attributes, withoutDefaultAttributes = param.withoutDefaultAttributes, excludeAttributes = param.excludeAttributes;
2520
+ return nodes.filter(function(param) {
2521
+ var group = param.group, attr = param.attributes;
2522
+ // if we have not specified any group or attribute filters, return all nodes
2523
+ if (!groups && !attributes && !excludeAttributes) return true;
2524
+ var g = search(groups);
2525
+ if (!withoutDefaultGroup) {
2526
+ g.push("default");
2527
+ }
2528
+ // filter the attributes
2529
+ var a = search(attributes);
2530
+ if (!withoutDefaultAttributes) {
2531
+ // always add hidden fields e.g. csrf
2532
+ if (group.includes("default")) {
2533
+ a.push("hidden");
2534
+ }
2535
+ // automatically add the necessary fields for webauthn and totp
2536
+ if (group.includes("webauthn") || group.includes("totp")) {
2537
+ a.push("input", "script");
2538
+ }
2539
+ }
2540
+ // filter the attributes to exclude
2541
+ var ea = search(excludeAttributes);
2542
+ var filterGroup = groups ? g.includes(group) : true;
2543
+ var filterAttributes = attributes ? a.includes(getNodeInputType(attr)) : true;
2544
+ var filterExcludeAttributes = excludeAttributes ? !ea.includes(getNodeInputType(attr)) : true;
2545
+ return filterGroup && filterAttributes && filterExcludeAttributes;
2546
+ });
2547
+ };
2548
+ function search(s) {
2549
+ return (lodash.isString(s) ? s.split(",") : s) || [];
2550
+ }
2551
+
2503
2552
  var getNodeLabel = function(node) {
2504
2553
  var attributes = node.attributes;
2505
2554
  if (isUiNodeAnchorAttributes(attributes)) {
@@ -2558,8 +2607,8 @@ function Node(param) {
2558
2607
  } else if (isUiNodeTextAttributes(node.attributes)) {
2559
2608
  return /*#__PURE__*/ jsxRuntime.jsx(Text, {
2560
2609
  attributes: node.attributes,
2561
- codes: isUiNodeTextSecretsAttributes(node.attributes) ? node.attributes.text.context.secrets.map(function(text1) {
2562
- return text1;
2610
+ codes: isUiNodeTextSecretsAttributes(node.attributes) ? node.attributes.text.context.secrets.map(function(text) {
2611
+ return text;
2563
2612
  }) : [
2564
2613
  node.attributes.text
2565
2614
  ],
@@ -2587,9 +2636,9 @@ function Node(param) {
2587
2636
  }
2588
2637
  if (isSocial) {
2589
2638
  submit.formNoValidate = true;
2590
- submit.onClick = function(e1) {
2591
- e1.currentTarget.type = "submit";
2592
- e1.currentTarget.dispatchEvent(new Event("submit", {
2639
+ submit.onClick = function(e) {
2640
+ e.currentTarget.type = "submit";
2641
+ e.currentTarget.dispatchEvent(new Event("submit", {
2593
2642
  cancelable: true,
2594
2643
  bubbles: true
2595
2644
  }));
@@ -2676,55 +2725,6 @@ function Node(param) {
2676
2725
  return null;
2677
2726
  }
2678
2727
 
2679
- function getNodeInputType(attr) {
2680
- return lodash.isObject(attr) && "type" in attr && lodash.isString(attr.type) ? attr.type : "";
2681
- }
2682
-
2683
- /**
2684
- * Filters nodes by their groups and attributes.
2685
- * If no filtering options are specified, all nodes are returned.
2686
- * Will always add default nodes unless `withoutDefaultGroup` is true.
2687
- * Will always add default attributes unless `withoutDefaultAttributes` is true.
2688
- * @param {Object} filterNodesByGroups - An object containing the nodes and the filtering options.
2689
- * @param {Array<UiNode>} filterNodesByGroups.nodes - An array of nodes.
2690
- * @param {Array<UiNodeGroupEnum | string> | string} filterNodesByGroups.groups - An array or comma seperated strings of groups to filter by.
2691
- * @param {boolean} filterNodesByGroups.withoutDefaultGroup - If true, will not add default nodes under the 'default' category.
2692
- * @param {Array<UiNodeInputAttributesTypeEnum | string> | string} filterNodesByGroups.attributes - An array or comma seperated strings of attributes to filter by.
2693
- * @param {boolean} filterNodesByGroups.withoutDefaultAttributes - If true, will not add default attributes such as 'hidden' and 'script'.
2694
- */ var filterNodesByGroups = function(param) {
2695
- var nodes = param.nodes, groups = param.groups, withoutDefaultGroup = param.withoutDefaultGroup, attributes = param.attributes, withoutDefaultAttributes = param.withoutDefaultAttributes, excludeAttributes = param.excludeAttributes;
2696
- return nodes.filter(function(param) {
2697
- var group = param.group, attr = param.attributes;
2698
- // if we have not specified any group or attribute filters, return all nodes
2699
- if (!groups && !attributes && !excludeAttributes) return true;
2700
- var g = search(groups);
2701
- if (!withoutDefaultGroup) {
2702
- g.push("default");
2703
- }
2704
- // filter the attributes
2705
- var a = search(attributes);
2706
- if (!withoutDefaultAttributes) {
2707
- // always add hidden fields e.g. csrf
2708
- if (group.includes("default")) {
2709
- a.push("hidden");
2710
- }
2711
- // automatically add the necessary fields for webauthn and totp
2712
- if (group.includes("webauthn") || group.includes("totp")) {
2713
- a.push("input", "script");
2714
- }
2715
- }
2716
- // filter the attributes to exclude
2717
- var ea = search(excludeAttributes);
2718
- var filterGroup = groups ? g.includes(group) : true;
2719
- var filterAttributes = attributes ? a.includes(getNodeInputType(attr)) : true;
2720
- var filterExcludeAttributes = excludeAttributes ? !ea.includes(getNodeInputType(attr)) : true;
2721
- return filterGroup && filterAttributes && filterExcludeAttributes;
2722
- });
2723
- };
2724
- function search(s) {
2725
- return (lodash.isString(s) ? s.split(",") : s) || [];
2726
- }
2727
-
2728
2728
  function _define_property$9(obj, key, value) {
2729
2729
  if (key in obj) {
2730
2730
  Object.defineProperty(obj, key, {
@@ -2807,6 +2807,71 @@ function FilterFlowNodes(_param) {
2807
2807
  });
2808
2808
  }
2809
2809
 
2810
+ function _array_like_to_array(arr, len) {
2811
+ if (len == null || len > arr.length) len = arr.length;
2812
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2813
+ return arr2;
2814
+ }
2815
+ function _array_without_holes(arr) {
2816
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
2817
+ }
2818
+ function _iterable_to_array(iter) {
2819
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2820
+ }
2821
+ function _non_iterable_spread() {
2822
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2823
+ }
2824
+ function _to_consumable_array(arr) {
2825
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2826
+ }
2827
+ function _unsupported_iterable_to_array(o, minLen) {
2828
+ if (!o) return;
2829
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
2830
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2831
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2832
+ if (n === "Map" || n === "Set") return Array.from(n);
2833
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2834
+ }
2835
+ function useScriptNodes(param) {
2836
+ var nodes = param.nodes, excludeScripts = param.excludeScripts;
2837
+ react.useEffect(function() {
2838
+ if (excludeScripts) {
2839
+ return;
2840
+ }
2841
+ var scriptNodes = filterNodesByGroups({
2842
+ nodes: nodes,
2843
+ groups: "webauthn",
2844
+ attributes: "text/javascript",
2845
+ withoutDefaultGroup: true,
2846
+ withoutDefaultAttributes: true
2847
+ }).reduce(function(accumulator, node) {
2848
+ var attr = node.attributes;
2849
+ if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2850
+ return accumulator;
2851
+ }
2852
+ var script = document.createElement("script");
2853
+ script.src = attr.src;
2854
+ script.type = attr.type;
2855
+ script.async = attr.async;
2856
+ script.referrerPolicy = attr.referrerpolicy;
2857
+ script.crossOrigin = attr.crossorigin;
2858
+ script.integrity = attr.integrity;
2859
+ document.body.appendChild(script);
2860
+ return _to_consumable_array(accumulator).concat([
2861
+ script
2862
+ ]);
2863
+ }, []);
2864
+ return function() {
2865
+ scriptNodes.forEach(function(script) {
2866
+ document.body.removeChild(script);
2867
+ });
2868
+ };
2869
+ }, [
2870
+ excludeScripts,
2871
+ nodes
2872
+ ]);
2873
+ }
2874
+
2810
2875
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ function _define_property$8(obj, key, value) {
2811
2876
  if (key in obj) {
2812
2877
  Object.defineProperty(obj, key, {
@@ -2944,71 +3009,6 @@ function _object_without_properties_loose(source, excluded) {
2944
3009
  }));
2945
3010
  }
2946
3011
 
2947
- function _array_like_to_array(arr, len) {
2948
- if (len == null || len > arr.length) len = arr.length;
2949
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2950
- return arr2;
2951
- }
2952
- function _array_without_holes(arr) {
2953
- if (Array.isArray(arr)) return _array_like_to_array(arr);
2954
- }
2955
- function _iterable_to_array(iter) {
2956
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2957
- }
2958
- function _non_iterable_spread() {
2959
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2960
- }
2961
- function _to_consumable_array(arr) {
2962
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2963
- }
2964
- function _unsupported_iterable_to_array(o, minLen) {
2965
- if (!o) return;
2966
- if (typeof o === "string") return _array_like_to_array(o, minLen);
2967
- var n = Object.prototype.toString.call(o).slice(8, -1);
2968
- if (n === "Object" && o.constructor) n = o.constructor.name;
2969
- if (n === "Map" || n === "Set") return Array.from(n);
2970
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2971
- }
2972
- function useScriptNodes(param) {
2973
- var nodes = param.nodes, excludeScripts = param.excludeScripts;
2974
- react.useEffect(function() {
2975
- if (excludeScripts) {
2976
- return;
2977
- }
2978
- var scriptNodes = filterNodesByGroups({
2979
- nodes: nodes,
2980
- groups: "webauthn",
2981
- attributes: "text/javascript",
2982
- withoutDefaultGroup: true,
2983
- withoutDefaultAttributes: true
2984
- }).reduce(function(accumulator, node) {
2985
- var attr = node.attributes;
2986
- if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2987
- return accumulator;
2988
- }
2989
- var script = document.createElement("script");
2990
- script.src = attr.src;
2991
- script.type = attr.type;
2992
- script.async = attr.async;
2993
- script.referrerPolicy = attr.referrerpolicy;
2994
- script.crossOrigin = attr.crossorigin;
2995
- script.integrity = attr.integrity;
2996
- document.body.appendChild(script);
2997
- return _to_consumable_array(accumulator).concat([
2998
- script
2999
- ]);
3000
- }, []);
3001
- return function() {
3002
- scriptNodes.forEach(function(script) {
3003
- document.body.removeChild(script);
3004
- });
3005
- };
3006
- }, [
3007
- excludeScripts,
3008
- nodes
3009
- ]);
3010
- }
3011
-
3012
3012
  function hasOidc(nodes) {
3013
3013
  return nodes.some(function(param) {
3014
3014
  var group = param.group;
@@ -3477,7 +3477,8 @@ function _object_spread$5(target) {
3477
3477
  }
3478
3478
  })
3479
3479
  })
3480
- ].filter(Boolean); // remove nulls
3480
+ ].filter(Boolean) // remove nulls
3481
+ ;
3481
3482
  switch(flowType){
3482
3483
  case "login":
3483
3484
  $passwordless = hasWebauthn(flow.ui.nodes) ? /*#__PURE__*/ jsxRuntime.jsx(PasswordlessSection, {
package/index.esm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.esm.js CHANGED
@@ -2491,6 +2491,55 @@ function useLogoutFlow(param) {
2491
2491
  };
2492
2492
  }
2493
2493
 
2494
+ function getNodeInputType(attr) {
2495
+ return isObject(attr) && "type" in attr && isString(attr.type) ? attr.type : "";
2496
+ }
2497
+
2498
+ /**
2499
+ * Filters nodes by their groups and attributes.
2500
+ * If no filtering options are specified, all nodes are returned.
2501
+ * Will always add default nodes unless `withoutDefaultGroup` is true.
2502
+ * Will always add default attributes unless `withoutDefaultAttributes` is true.
2503
+ * @param {Object} filterNodesByGroups - An object containing the nodes and the filtering options.
2504
+ * @param {Array<UiNode>} filterNodesByGroups.nodes - An array of nodes.
2505
+ * @param {Array<UiNodeGroupEnum | string> | string} filterNodesByGroups.groups - An array or comma seperated strings of groups to filter by.
2506
+ * @param {boolean} filterNodesByGroups.withoutDefaultGroup - If true, will not add default nodes under the 'default' category.
2507
+ * @param {Array<UiNodeInputAttributesTypeEnum | string> | string} filterNodesByGroups.attributes - An array or comma seperated strings of attributes to filter by.
2508
+ * @param {boolean} filterNodesByGroups.withoutDefaultAttributes - If true, will not add default attributes such as 'hidden' and 'script'.
2509
+ */ var filterNodesByGroups = function(param) {
2510
+ var nodes = param.nodes, groups = param.groups, withoutDefaultGroup = param.withoutDefaultGroup, attributes = param.attributes, withoutDefaultAttributes = param.withoutDefaultAttributes, excludeAttributes = param.excludeAttributes;
2511
+ return nodes.filter(function(param) {
2512
+ var group = param.group, attr = param.attributes;
2513
+ // if we have not specified any group or attribute filters, return all nodes
2514
+ if (!groups && !attributes && !excludeAttributes) return true;
2515
+ var g = search(groups);
2516
+ if (!withoutDefaultGroup) {
2517
+ g.push("default");
2518
+ }
2519
+ // filter the attributes
2520
+ var a = search(attributes);
2521
+ if (!withoutDefaultAttributes) {
2522
+ // always add hidden fields e.g. csrf
2523
+ if (group.includes("default")) {
2524
+ a.push("hidden");
2525
+ }
2526
+ // automatically add the necessary fields for webauthn and totp
2527
+ if (group.includes("webauthn") || group.includes("totp")) {
2528
+ a.push("input", "script");
2529
+ }
2530
+ }
2531
+ // filter the attributes to exclude
2532
+ var ea = search(excludeAttributes);
2533
+ var filterGroup = groups ? g.includes(group) : true;
2534
+ var filterAttributes = attributes ? a.includes(getNodeInputType(attr)) : true;
2535
+ var filterExcludeAttributes = excludeAttributes ? !ea.includes(getNodeInputType(attr)) : true;
2536
+ return filterGroup && filterAttributes && filterExcludeAttributes;
2537
+ });
2538
+ };
2539
+ function search(s) {
2540
+ return (isString(s) ? s.split(",") : s) || [];
2541
+ }
2542
+
2494
2543
  var getNodeLabel = function(node) {
2495
2544
  var attributes = node.attributes;
2496
2545
  if (isUiNodeAnchorAttributes(attributes)) {
@@ -2549,8 +2598,8 @@ function Node(param) {
2549
2598
  } else if (isUiNodeTextAttributes(node.attributes)) {
2550
2599
  return /*#__PURE__*/ jsx(Text, {
2551
2600
  attributes: node.attributes,
2552
- codes: isUiNodeTextSecretsAttributes(node.attributes) ? node.attributes.text.context.secrets.map(function(text1) {
2553
- return text1;
2601
+ codes: isUiNodeTextSecretsAttributes(node.attributes) ? node.attributes.text.context.secrets.map(function(text) {
2602
+ return text;
2554
2603
  }) : [
2555
2604
  node.attributes.text
2556
2605
  ],
@@ -2578,9 +2627,9 @@ function Node(param) {
2578
2627
  }
2579
2628
  if (isSocial) {
2580
2629
  submit.formNoValidate = true;
2581
- submit.onClick = function(e1) {
2582
- e1.currentTarget.type = "submit";
2583
- e1.currentTarget.dispatchEvent(new Event("submit", {
2630
+ submit.onClick = function(e) {
2631
+ e.currentTarget.type = "submit";
2632
+ e.currentTarget.dispatchEvent(new Event("submit", {
2584
2633
  cancelable: true,
2585
2634
  bubbles: true
2586
2635
  }));
@@ -2667,55 +2716,6 @@ function Node(param) {
2667
2716
  return null;
2668
2717
  }
2669
2718
 
2670
- function getNodeInputType(attr) {
2671
- return isObject(attr) && "type" in attr && isString(attr.type) ? attr.type : "";
2672
- }
2673
-
2674
- /**
2675
- * Filters nodes by their groups and attributes.
2676
- * If no filtering options are specified, all nodes are returned.
2677
- * Will always add default nodes unless `withoutDefaultGroup` is true.
2678
- * Will always add default attributes unless `withoutDefaultAttributes` is true.
2679
- * @param {Object} filterNodesByGroups - An object containing the nodes and the filtering options.
2680
- * @param {Array<UiNode>} filterNodesByGroups.nodes - An array of nodes.
2681
- * @param {Array<UiNodeGroupEnum | string> | string} filterNodesByGroups.groups - An array or comma seperated strings of groups to filter by.
2682
- * @param {boolean} filterNodesByGroups.withoutDefaultGroup - If true, will not add default nodes under the 'default' category.
2683
- * @param {Array<UiNodeInputAttributesTypeEnum | string> | string} filterNodesByGroups.attributes - An array or comma seperated strings of attributes to filter by.
2684
- * @param {boolean} filterNodesByGroups.withoutDefaultAttributes - If true, will not add default attributes such as 'hidden' and 'script'.
2685
- */ var filterNodesByGroups = function(param) {
2686
- var nodes = param.nodes, groups = param.groups, withoutDefaultGroup = param.withoutDefaultGroup, attributes = param.attributes, withoutDefaultAttributes = param.withoutDefaultAttributes, excludeAttributes = param.excludeAttributes;
2687
- return nodes.filter(function(param) {
2688
- var group = param.group, attr = param.attributes;
2689
- // if we have not specified any group or attribute filters, return all nodes
2690
- if (!groups && !attributes && !excludeAttributes) return true;
2691
- var g = search(groups);
2692
- if (!withoutDefaultGroup) {
2693
- g.push("default");
2694
- }
2695
- // filter the attributes
2696
- var a = search(attributes);
2697
- if (!withoutDefaultAttributes) {
2698
- // always add hidden fields e.g. csrf
2699
- if (group.includes("default")) {
2700
- a.push("hidden");
2701
- }
2702
- // automatically add the necessary fields for webauthn and totp
2703
- if (group.includes("webauthn") || group.includes("totp")) {
2704
- a.push("input", "script");
2705
- }
2706
- }
2707
- // filter the attributes to exclude
2708
- var ea = search(excludeAttributes);
2709
- var filterGroup = groups ? g.includes(group) : true;
2710
- var filterAttributes = attributes ? a.includes(getNodeInputType(attr)) : true;
2711
- var filterExcludeAttributes = excludeAttributes ? !ea.includes(getNodeInputType(attr)) : true;
2712
- return filterGroup && filterAttributes && filterExcludeAttributes;
2713
- });
2714
- };
2715
- function search(s) {
2716
- return (isString(s) ? s.split(",") : s) || [];
2717
- }
2718
-
2719
2719
  function _define_property$9(obj, key, value) {
2720
2720
  if (key in obj) {
2721
2721
  Object.defineProperty(obj, key, {
@@ -2798,6 +2798,71 @@ function FilterFlowNodes(_param) {
2798
2798
  });
2799
2799
  }
2800
2800
 
2801
+ function _array_like_to_array(arr, len) {
2802
+ if (len == null || len > arr.length) len = arr.length;
2803
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2804
+ return arr2;
2805
+ }
2806
+ function _array_without_holes(arr) {
2807
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
2808
+ }
2809
+ function _iterable_to_array(iter) {
2810
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2811
+ }
2812
+ function _non_iterable_spread() {
2813
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2814
+ }
2815
+ function _to_consumable_array(arr) {
2816
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2817
+ }
2818
+ function _unsupported_iterable_to_array(o, minLen) {
2819
+ if (!o) return;
2820
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
2821
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2822
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2823
+ if (n === "Map" || n === "Set") return Array.from(n);
2824
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2825
+ }
2826
+ function useScriptNodes(param) {
2827
+ var nodes = param.nodes, excludeScripts = param.excludeScripts;
2828
+ useEffect(function() {
2829
+ if (excludeScripts) {
2830
+ return;
2831
+ }
2832
+ var scriptNodes = filterNodesByGroups({
2833
+ nodes: nodes,
2834
+ groups: "webauthn",
2835
+ attributes: "text/javascript",
2836
+ withoutDefaultGroup: true,
2837
+ withoutDefaultAttributes: true
2838
+ }).reduce(function(accumulator, node) {
2839
+ var attr = node.attributes;
2840
+ if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2841
+ return accumulator;
2842
+ }
2843
+ var script = document.createElement("script");
2844
+ script.src = attr.src;
2845
+ script.type = attr.type;
2846
+ script.async = attr.async;
2847
+ script.referrerPolicy = attr.referrerpolicy;
2848
+ script.crossOrigin = attr.crossorigin;
2849
+ script.integrity = attr.integrity;
2850
+ document.body.appendChild(script);
2851
+ return _to_consumable_array(accumulator).concat([
2852
+ script
2853
+ ]);
2854
+ }, []);
2855
+ return function() {
2856
+ scriptNodes.forEach(function(script) {
2857
+ document.body.removeChild(script);
2858
+ });
2859
+ };
2860
+ }, [
2861
+ excludeScripts,
2862
+ nodes
2863
+ ]);
2864
+ }
2865
+
2801
2866
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ function _define_property$8(obj, key, value) {
2802
2867
  if (key in obj) {
2803
2868
  Object.defineProperty(obj, key, {
@@ -2935,71 +3000,6 @@ function _object_without_properties_loose(source, excluded) {
2935
3000
  }));
2936
3001
  }
2937
3002
 
2938
- function _array_like_to_array(arr, len) {
2939
- if (len == null || len > arr.length) len = arr.length;
2940
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2941
- return arr2;
2942
- }
2943
- function _array_without_holes(arr) {
2944
- if (Array.isArray(arr)) return _array_like_to_array(arr);
2945
- }
2946
- function _iterable_to_array(iter) {
2947
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2948
- }
2949
- function _non_iterable_spread() {
2950
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2951
- }
2952
- function _to_consumable_array(arr) {
2953
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2954
- }
2955
- function _unsupported_iterable_to_array(o, minLen) {
2956
- if (!o) return;
2957
- if (typeof o === "string") return _array_like_to_array(o, minLen);
2958
- var n = Object.prototype.toString.call(o).slice(8, -1);
2959
- if (n === "Object" && o.constructor) n = o.constructor.name;
2960
- if (n === "Map" || n === "Set") return Array.from(n);
2961
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2962
- }
2963
- function useScriptNodes(param) {
2964
- var nodes = param.nodes, excludeScripts = param.excludeScripts;
2965
- useEffect(function() {
2966
- if (excludeScripts) {
2967
- return;
2968
- }
2969
- var scriptNodes = filterNodesByGroups({
2970
- nodes: nodes,
2971
- groups: "webauthn",
2972
- attributes: "text/javascript",
2973
- withoutDefaultGroup: true,
2974
- withoutDefaultAttributes: true
2975
- }).reduce(function(accumulator, node) {
2976
- var attr = node.attributes;
2977
- if (document.querySelector('script[src="'.concat(attr.src, '"]'))) {
2978
- return accumulator;
2979
- }
2980
- var script = document.createElement("script");
2981
- script.src = attr.src;
2982
- script.type = attr.type;
2983
- script.async = attr.async;
2984
- script.referrerPolicy = attr.referrerpolicy;
2985
- script.crossOrigin = attr.crossorigin;
2986
- script.integrity = attr.integrity;
2987
- document.body.appendChild(script);
2988
- return _to_consumable_array(accumulator).concat([
2989
- script
2990
- ]);
2991
- }, []);
2992
- return function() {
2993
- scriptNodes.forEach(function(script) {
2994
- document.body.removeChild(script);
2995
- });
2996
- };
2997
- }, [
2998
- excludeScripts,
2999
- nodes
3000
- ]);
3001
- }
3002
-
3003
3003
  function hasOidc(nodes) {
3004
3004
  return nodes.some(function(param) {
3005
3005
  var group = param.group;
@@ -3468,7 +3468,8 @@ function _object_spread$5(target) {
3468
3468
  }
3469
3469
  })
3470
3470
  })
3471
- ].filter(Boolean); // remove nulls
3471
+ ].filter(Boolean) // remove nulls
3472
+ ;
3472
3473
  switch(flowType){
3473
3474
  case "login":
3474
3475
  $passwordless = hasWebauthn(flow.ui.nodes) ? /*#__PURE__*/ jsx(PasswordlessSection, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leancodepl/kratos",
3
- "version": "7.3.7",
3
+ "version": "7.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "dependencies": {
6
6
  "@ory/client": ">=1.4.3",
@@ -2,19 +2,19 @@ import { LoginFlow, RecoveryFlow, RegistrationFlow, UpdateLoginFlowBody, UpdateR
2
2
  import { UserAuthFormAdditionalProps } from "../helpers/userAuthForm";
3
3
  type UserAuthCardProps<TBody> = {
4
4
  className?: string;
5
- flow: LoginFlow | RegistrationFlow | RecoveryFlow | VerificationFlow;
6
- flowType: "login" | "registration" | "recovery" | "verification";
5
+ flow: LoginFlow | RecoveryFlow | RegistrationFlow | VerificationFlow;
6
+ flowType: "login" | "recovery" | "registration" | "verification";
7
7
  } & UserAuthFormAdditionalProps<TBody>;
8
- export declare const LoginCard: ({ ...props }: Omit<UserAuthCardProps<UpdateLoginFlowBody>, "flow" | "flowType"> & {
8
+ export declare const LoginCard: ({ ...props }: {
9
9
  flow: LoginFlow;
10
- }) => import("react/jsx-runtime").JSX.Element;
11
- export declare const VerificationCard: ({ ...props }: Omit<UserAuthCardProps<UpdateVerificationFlowBody>, "flow" | "flowType"> & {
10
+ } & Omit<UserAuthCardProps<UpdateLoginFlowBody>, "flow" | "flowType">) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const VerificationCard: ({ ...props }: {
12
12
  flow: VerificationFlow;
13
- }) => import("react/jsx-runtime").JSX.Element;
14
- export declare const RegistrationCard: ({ ...props }: Omit<UserAuthCardProps<UpdateRegistrationFlowBody>, "flow" | "flowType"> & {
13
+ } & Omit<UserAuthCardProps<UpdateVerificationFlowBody>, "flow" | "flowType">) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const RegistrationCard: ({ ...props }: {
15
15
  flow: RegistrationFlow;
16
- }) => import("react/jsx-runtime").JSX.Element;
17
- export declare const RecoveryCard: ({ ...props }: Omit<UserAuthCardProps<UpdateRecoveryFlowBody>, "flow" | "flowType"> & {
16
+ } & Omit<UserAuthCardProps<UpdateRegistrationFlowBody>, "flow" | "flowType">) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const RecoveryCard: ({ ...props }: {
18
18
  flow: RecoveryFlow;
19
- }) => import("react/jsx-runtime").JSX.Element;
19
+ } & Omit<UserAuthCardProps<UpdateRecoveryFlowBody>, "flow" | "flowType">) => import("react/jsx-runtime").JSX.Element;
20
20
  export {};
@@ -1,7 +1,7 @@
1
1
  import { JSX } from "react";
2
2
  import { SettingsFlow, UpdateSettingsFlowBody } from "@ory/client";
3
3
  import { UserAuthFormAdditionalProps } from "../helpers/userAuthForm";
4
- export type UserSettingsFlowType = "profile" | "password" | "totp" | "webauthn" | "oidc" | "lookupSecret";
4
+ export type UserSettingsFlowType = "lookupSecret" | "oidc" | "password" | "profile" | "totp" | "webauthn";
5
5
  export type UserSettingsCardProps = {
6
6
  flow: SettingsFlow;
7
7
  flowType: UserSettingsFlowType;
@@ -7,6 +7,6 @@ export type KratosContextData = {
7
7
  excludeScripts: boolean;
8
8
  };
9
9
  export declare const kratosContext: import("react").Context<KratosContextData>;
10
- export declare function useKratosContext(): KratosContextData & {
10
+ export declare function useKratosContext(): {
11
11
  components: KratosComponents;
12
- };
12
+ } & KratosContextData;
@@ -3,10 +3,10 @@ import { UiNode, UiNodeTextAttributes, UiText, UiTextTypeEnum } from "@ory/clien
3
3
  type Node = {
4
4
  node: UiNode;
5
5
  };
6
- export type ImageComponentProps = React.ImgHTMLAttributes<HTMLImageElement> & {
6
+ export type ImageComponentProps = {
7
7
  header?: ReactNode;
8
8
  className?: string;
9
- } & Node;
9
+ } & Node & React.ImgHTMLAttributes<HTMLImageElement>;
10
10
  export type TextComponentProps = {
11
11
  label?: ReactNode;
12
12
  id: string;
@@ -18,29 +18,29 @@ export type LinkComponentProps = {
18
18
  href?: string;
19
19
  icon?: string;
20
20
  className?: string;
21
- } & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & Node;
21
+ } & Node & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">;
22
22
  export type InputComponentProps = {
23
23
  header: ReactNode;
24
24
  helperMessage?: ReactNode;
25
25
  isError?: boolean;
26
- } & React.InputHTMLAttributes<HTMLInputElement> & Node;
26
+ } & Node & React.InputHTMLAttributes<HTMLInputElement>;
27
27
  export type MessageComponentProps = {
28
28
  message: UiText;
29
29
  key: string;
30
30
  severity: Severity;
31
31
  children?: ReactNode;
32
32
  };
33
- export type Severity = UiTextTypeEnum | "disabled" | "default";
33
+ export type Severity = "default" | "disabled" | UiTextTypeEnum;
34
34
  export type ButtonComponentProps = {
35
35
  header?: ReactNode;
36
36
  fullWidth?: boolean;
37
37
  social?: string;
38
- } & React.ButtonHTMLAttributes<HTMLButtonElement> & Node;
38
+ } & Node & React.ButtonHTMLAttributes<HTMLButtonElement>;
39
39
  export type CheckboxComponentProps = {
40
40
  label?: ReactNode;
41
41
  helperMessage?: ReactNode;
42
42
  isError?: boolean;
43
- } & React.InputHTMLAttributes<HTMLInputElement> & Node;
43
+ } & Node & React.InputHTMLAttributes<HTMLInputElement>;
44
44
  export type MessageFormatComponentProps = {
45
45
  id: number;
46
46
  text: string;
@@ -1,24 +1,24 @@
1
1
  import { UiNodeAnchorAttributes, UiNodeAttributes, UiNodeImageAttributes, UiNodeInputAttributes, UiNodeScriptAttributes, UiNodeTextAttributes, UiText } from "@ory/client";
2
- export declare function isUiNodeAnchorAttributes(attrs: UiNodeAttributes): attrs is UiNodeAnchorAttributes & {
2
+ export declare function isUiNodeAnchorAttributes(attrs: UiNodeAttributes): attrs is {
3
3
  node_type: "a";
4
- };
5
- export declare function isUiNodeImageAttributes(attrs: UiNodeAttributes): attrs is UiNodeImageAttributes & {
4
+ } & UiNodeAnchorAttributes;
5
+ export declare function isUiNodeImageAttributes(attrs: UiNodeAttributes): attrs is {
6
6
  node_type: "img";
7
- };
8
- export declare function isUiNodeInputAttributes(attrs: UiNodeAttributes): attrs is UiNodeInputAttributes & {
7
+ } & UiNodeImageAttributes;
8
+ export declare function isUiNodeInputAttributes(attrs: UiNodeAttributes): attrs is {
9
9
  node_type: "input";
10
- };
11
- export declare function isUiNodeTextAttributes(attrs: UiNodeAttributes): attrs is UiNodeTextAttributes & {
10
+ } & UiNodeInputAttributes;
11
+ export declare function isUiNodeTextAttributes(attrs: UiNodeAttributes): attrs is {
12
12
  node_type: "text";
13
- };
14
- export declare function isUiNodeScriptAttributes(attrs: UiNodeAttributes): attrs is UiNodeScriptAttributes & {
13
+ } & UiNodeTextAttributes;
14
+ export declare function isUiNodeScriptAttributes(attrs: UiNodeAttributes): attrs is {
15
15
  node_type: "script";
16
- };
17
- export type UiNodeTextSecretsAttributes = Omit<UiNodeTextAttributes, "text"> & {
18
- text: Omit<UiText, "context"> & {
16
+ } & UiNodeScriptAttributes;
17
+ export type UiNodeTextSecretsAttributes = {
18
+ text: {
19
19
  context: {
20
20
  secrets: UiText[];
21
21
  };
22
- };
23
- };
22
+ } & Omit<UiText, "context">;
23
+ } & Omit<UiNodeTextAttributes, "text">;
24
24
  export declare function isUiNodeTextSecretsAttributes(attributes: UiNodeTextAttributes): attributes is UiNodeTextSecretsAttributes;