@veripass/react-sdk 1.0.14 → 1.0.16

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.
@@ -543,7 +543,7 @@ var useLocalStorage = function useLocalStorage(keyName, defaultValue) {
543
543
  return [storedValue, setValue];
544
544
  };
545
545
 
546
- var defaulPublicUrlList = ['/auth/login', '/auth/signup'];
546
+ var defaultPublicUrlList = ['/auth/login', '/auth/signup'];
547
547
 
548
548
  /**
549
549
  * Authentication context used to provide user authentication data and functions.
@@ -562,7 +562,7 @@ var AuthProvider = function AuthProvider(_ref) {
562
562
  var children = _ref.children,
563
563
  _ref$publicUrls = _ref.publicUrls,
564
564
  publicUrls = _ref$publicUrls === void 0 ? [] : _ref$publicUrls;
565
- var _useState = useState(defaulPublicUrlList),
565
+ var _useState = useState(defaultPublicUrlList),
566
566
  _useState2 = _slicedToArray(_useState, 2),
567
567
  publicUrlsList = _useState2[0],
568
568
  setPublicUrlsList = _useState2[1];
@@ -574,14 +574,21 @@ var AuthProvider = function AuthProvider(_ref) {
574
574
  setUser = _useLocalStorage2[1];
575
575
  useEffect(function () {
576
576
  console.log(children);
577
+ var publicPaths = new Set(defaultPublicUrlList);
578
+ var extractPublicPaths = function extractPublicPaths(child) {
579
+ if (/*#__PURE__*/React__default.isValidElement(child)) {
580
+ if (child.props.isPublic && child.props.path) {
581
+ publicPaths.add(child.props.path);
582
+ }
583
+ if (child.props.children) {
584
+ React__default.Children.forEach(child.props.children, extractPublicPaths);
585
+ }
586
+ }
587
+ };
588
+ React__default.Children.forEach(children, extractPublicPaths);
589
+ debugger;
590
+ setPublicPathSet(publicPaths);
577
591
  }, [children]);
578
- React__default.Children.forEach(children, function (child) {
579
- // Check if child is a valid React element
580
- if (/*#__PURE__*/React__default.isValidElement(child) && child.props.isPublic) {
581
- debugger;
582
- publicPaths.add(child.props.path); // Assumes `path` is passed as prop
583
- }
584
- });
585
592
 
586
593
  /**
587
594
  * Logs in the user by saving their data to local storage and navigating to the admin page.
@@ -629,7 +636,7 @@ var AuthProvider = function AuthProvider(_ref) {
629
636
 
630
637
  // Effect to update public URLs whenever publicUrls prop changes
631
638
  useEffect(function () {
632
- setPublicUrlsList([].concat(_toConsumableArray(defaultPublicUrlList), _toConsumableArray(publicUrls)));
639
+ setPublicUrlsList([].concat(defaultPublicUrlList, _toConsumableArray(publicUrls)));
633
640
  }, [publicUrls]);
634
641
 
635
642
  // Effect to redirect if user is null