@plasmicapp/react-web 0.2.296 → 0.2.298
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/index.cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var classNames$1 = require('classnames');
|
|
5
5
|
var dataSourcesContext = require('@plasmicapp/data-sources-context');
|
|
6
|
+
var plasmicQuery = require('@plasmicapp/query');
|
|
6
7
|
var React = require('react');
|
|
7
8
|
var get = require('dlv');
|
|
8
9
|
var host = require('@plasmicapp/host');
|
|
@@ -43,6 +44,7 @@ function _interopNamespaceDefault(e) {
|
|
|
43
44
|
return Object.freeze(n);
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
var plasmicQuery__namespace = /*#__PURE__*/_interopNamespaceDefault(plasmicQuery);
|
|
46
48
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
47
49
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
|
|
48
50
|
|
|
@@ -242,6 +244,7 @@ function triggerLogin(appId, authorizeEndpoint, redirectUri) {
|
|
|
242
244
|
});
|
|
243
245
|
}
|
|
244
246
|
function PlasmicPageGuard(props) {
|
|
247
|
+
var _a;
|
|
245
248
|
var appId = props.appId, authorizeEndpoint = props.authorizeEndpoint, minRole = props.minRole, canTriggerLogin = props.canTriggerLogin, children = props.children, unauthorizedComp = props.unauthorizedComp;
|
|
246
249
|
var dataSourceCtxValue = dataSourcesContext.usePlasmicDataSourceContext();
|
|
247
250
|
React.useEffect(function () {
|
|
@@ -273,6 +276,12 @@ function PlasmicPageGuard(props) {
|
|
|
273
276
|
}
|
|
274
277
|
return dataSourceCtxValue.user.roleIds.includes(minRole);
|
|
275
278
|
}
|
|
279
|
+
// If we are in prepass, PlasmicPageGuard should not render anything
|
|
280
|
+
// it's expected that pages are only equipped with PlasmicPageGuard
|
|
281
|
+
// when it's known that it will disable prepass/prefetching
|
|
282
|
+
if ((_a = plasmicQuery__namespace.isPlasmicPrepass) === null || _a === void 0 ? void 0 : _a.call(plasmicQuery__namespace)) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
276
285
|
/*
|
|
277
286
|
PlasmicPageGuard has three cases:
|
|
278
287
|
1. No value of dataSourceCtxValue, user is loading or a trigger login should be performed.
|