@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.
@@ -548,14 +548,11 @@ var AuthContext = /*#__PURE__*/createContext();
548
548
  */
549
549
  var AuthProvider = function AuthProvider(_ref) {
550
550
  var children = _ref.children;
551
- var _useState = useState(),
551
+ var publicUrlsList = defaultPublicUrlList;
552
+ var _useState = useState(false),
552
553
  _useState2 = _slicedToArray(_useState, 2),
553
- publicUrlsList = _useState2[0],
554
- setPublicUrlsList = _useState2[1];
555
- var _useState3 = useState(false),
556
- _useState4 = _slicedToArray(_useState3, 2),
557
- isInitialized = _useState4[0],
558
- setIsInitialized = _useState4[1];
554
+ isInitialized = _useState2[0],
555
+ setIsInitialized = _useState2[1];
559
556
 
560
557
  // State to manage user data, persisted in local storage
561
558
  var _useLocalStorage = useLocalStorage('veripass-user-data', null),
@@ -563,13 +560,12 @@ var AuthProvider = function AuthProvider(_ref) {
563
560
  user = _useLocalStorage2[0],
564
561
  setUser = _useLocalStorage2[1];
565
562
  useEffect(function () {
566
- var publicPaths = new Set(defaultPublicUrlList);
567
563
  var extractPublicPaths = function extractPublicPaths(child) {
568
564
  var parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
569
565
  if (/*#__PURE__*/React__default.isValidElement(child)) {
570
566
  var currentPath = "".concat(parentPath).concat(child.props.path ? "/".concat(child.props.path) : '').replace(/\/+/g, '/');
571
- if (child.props.isPublic) {
572
- publicPaths.add(currentPath);
567
+ if (child.props.isPublic && !publicUrlsList.includes(currentPath)) {
568
+ publicUrlsList.push(currentPath);
573
569
  }
574
570
  if (child.props.children) {
575
571
  React__default.Children.forEach(child.props.children, function (grandchild) {
@@ -581,7 +577,6 @@ var AuthProvider = function AuthProvider(_ref) {
581
577
  React__default.Children.forEach(children, function (child) {
582
578
  return extractPublicPaths(child);
583
579
  });
584
- setPublicUrlsList(publicPaths);
585
580
  setIsInitialized(true);
586
581
  }, [children]);
587
582
 
@@ -641,7 +636,7 @@ var AuthProvider = function AuthProvider(_ref) {
641
636
  //window.location.replace('/auth/login');
642
637
  }
643
638
  }
644
- }, [user, publicUrlsList, isInitialized]);
639
+ }, [user, isInitialized]);
645
640
 
646
641
  /**
647
642
  * Memoized value containing the user data and authentication functions.