@plasmicapp/react-web 0.2.163 → 0.2.165

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.
@@ -778,6 +778,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
778
778
  }
779
779
  });
780
780
 
781
+ // https://stackoverflow.com/a/2117523
782
+ function uuidv4() {
783
+ // @ts-ignore
784
+ return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
785
+ return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
786
+ });
787
+ }
781
788
  function triggerLogin(_x, _x2) {
782
789
  return _triggerLogin.apply(this, arguments);
783
790
  }
@@ -822,7 +829,7 @@ function _triggerLogin() {
822
829
  state = JSON.stringify({
823
830
  continueTo: continueTo
824
831
  });
825
- code_verifier = crypto.randomUUID();
832
+ code_verifier = uuidv4();
826
833
  localStorage.setItem("code_verifier", code_verifier);
827
834
  _context2.next = 8;
828
835
  return sha256(code_verifier);
@@ -854,11 +861,11 @@ function PlasmicPageGuard(props) {
854
861
  var dataSourceCtxValue = dataSourcesContext.usePlasmicDataSourceContext();
855
862
  React__default.useEffect(function () {
856
863
  if (canTriggerLogin) {
857
- if (dataSourceCtxValue && "isUserLoading" in dataSourceCtxValue && !dataSourceCtxValue.isUserLoading && !dataSourceCtxValue.user) {
864
+ if (minRole && dataSourceCtxValue && "isUserLoading" in dataSourceCtxValue && !dataSourceCtxValue.isUserLoading && !dataSourceCtxValue.user) {
858
865
  triggerLogin(appId, authorizeEndpoint);
859
866
  }
860
867
  }
861
- }, [dataSourceCtxValue, appId, authorizeEndpoint, canTriggerLogin]);
868
+ }, [dataSourceCtxValue, appId, authorizeEndpoint, canTriggerLogin, minRole]);
862
869
  function canUserViewPage() {
863
870
  if (!minRole) {
864
871
  return true;