@plasmicapp/react-web 0.2.295 → 0.2.297
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/dist/all.d.ts +4 -2
- package/dist/index.cjs.js +9 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +8 -0
- package/dist/react-web.esm.js.map +1 -1
- package/package.json +9 -9
- package/skinny/dist/index.js +8 -0
- package/skinny/dist/index.js.map +1 -1
package/dist/react-web.esm.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import classNames$1 from 'classnames';
|
|
3
3
|
import { usePlasmicDataSourceContext, PlasmicDataSourceContextProvider } from '@plasmicapp/data-sources-context';
|
|
4
4
|
export { PlasmicDataSourceContextProvider, useCurrentUser } from '@plasmicapp/data-sources-context';
|
|
5
|
+
import * as plasmicQuery from '@plasmicapp/query';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import React__default, { useLayoutEffect, useEffect } from 'react';
|
|
7
8
|
import get from 'dlv';
|
|
@@ -224,6 +225,7 @@ function triggerLogin(appId, authorizeEndpoint, redirectUri) {
|
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
227
|
function PlasmicPageGuard(props) {
|
|
228
|
+
var _a;
|
|
227
229
|
var appId = props.appId, authorizeEndpoint = props.authorizeEndpoint, minRole = props.minRole, canTriggerLogin = props.canTriggerLogin, children = props.children, unauthorizedComp = props.unauthorizedComp;
|
|
228
230
|
var dataSourceCtxValue = usePlasmicDataSourceContext();
|
|
229
231
|
React__default.useEffect(function () {
|
|
@@ -255,6 +257,12 @@ function PlasmicPageGuard(props) {
|
|
|
255
257
|
}
|
|
256
258
|
return dataSourceCtxValue.user.roleIds.includes(minRole);
|
|
257
259
|
}
|
|
260
|
+
// If we are in prepass, PlasmicPageGuard should not render anything
|
|
261
|
+
// it's expected that pages are only equipped with PlasmicPageGuard
|
|
262
|
+
// when it's known that it will disable prepass/prefetching
|
|
263
|
+
if ((_a = plasmicQuery.isPlasmicPrepass) === null || _a === void 0 ? void 0 : _a.call(plasmicQuery)) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
258
266
|
/*
|
|
259
267
|
PlasmicPageGuard has three cases:
|
|
260
268
|
1. No value of dataSourceCtxValue, user is loading or a trigger login should be performed.
|