@veripass/react-sdk 1.0.22 → 1.0.23

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.
@@ -568,14 +568,11 @@ var AuthContext = /*#__PURE__*/React.createContext();
568
568
  */
569
569
  var AuthProvider = function AuthProvider(_ref) {
570
570
  var children = _ref.children;
571
- var _useState = React.useState(),
571
+ var publicUrlsList = defaultPublicUrlList;
572
+ var _useState = React.useState(false),
572
573
  _useState2 = _slicedToArray(_useState, 2),
573
- publicUrlsList = _useState2[0],
574
- setPublicUrlsList = _useState2[1];
575
- var _useState3 = React.useState(false),
576
- _useState4 = _slicedToArray(_useState3, 2),
577
- isInitialized = _useState4[0],
578
- setIsInitialized = _useState4[1];
574
+ isInitialized = _useState2[0],
575
+ setIsInitialized = _useState2[1];
579
576
 
580
577
  // State to manage user data, persisted in local storage
581
578
  var _useLocalStorage = useLocalStorage('veripass-user-data', null),
@@ -583,13 +580,12 @@ var AuthProvider = function AuthProvider(_ref) {
583
580
  user = _useLocalStorage2[0],
584
581
  setUser = _useLocalStorage2[1];
585
582
  React.useEffect(function () {
586
- var publicPaths = new Set(defaultPublicUrlList);
587
583
  var extractPublicPaths = function extractPublicPaths(child) {
588
584
  var parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
589
585
  if (/*#__PURE__*/React.isValidElement(child)) {
590
586
  var currentPath = "".concat(parentPath).concat(child.props.path ? "/".concat(child.props.path) : '').replace(/\/+/g, '/');
591
- if (child.props.isPublic) {
592
- publicPaths.add(currentPath);
587
+ if (child.props.isPublic && !publicUrlsList.includes(currentPath)) {
588
+ publicUrlsList.push(currentPath);
593
589
  }
594
590
  if (child.props.children) {
595
591
  React.Children.forEach(child.props.children, function (grandchild) {
@@ -601,7 +597,6 @@ var AuthProvider = function AuthProvider(_ref) {
601
597
  React.Children.forEach(children, function (child) {
602
598
  return extractPublicPaths(child);
603
599
  });
604
- setPublicUrlsList(publicPaths);
605
600
  setIsInitialized(true);
606
601
  }, [children]);
607
602
 
@@ -661,7 +656,7 @@ var AuthProvider = function AuthProvider(_ref) {
661
656
  //window.location.replace('/auth/login');
662
657
  }
663
658
  }
664
- }, [user, publicUrlsList, isInitialized]);
659
+ }, [user, isInitialized]);
665
660
 
666
661
  /**
667
662
  * Memoized value containing the user data and authentication functions.