openxiangda 1.0.49 → 1.0.50

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.
@@ -3546,6 +3546,9 @@ var mountBrowserPageRuntime = async (options) => {
3546
3546
  fetchImpl: options.fetchImpl,
3547
3547
  servicePrefix: options.servicePrefix
3548
3548
  });
3549
+ if (bootstrap.permissions?.canView === false) {
3550
+ throw new Error(String(bootstrap.permissions.message || "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u8BE5\u9875\u9762"));
3551
+ }
3549
3552
  const assets = await resolveRuntimeAssets(bootstrap, options.fetchImpl || fetch);
3550
3553
  if (!assets.entryUrl) {
3551
3554
  throw new Error("\u4EE3\u7801\u9875\u9762\u7F3A\u5C11 entryUrl");
@@ -49205,6 +49208,14 @@ var BuiltinRouteError = ({
49205
49208
  action: /* @__PURE__ */ jsx97(Button16, { size: "small", onClick: onRetry, children: "\u91CD\u8BD5" })
49206
49209
  }
49207
49210
  ) });
49211
+ var getRuntimePermission = (route) => {
49212
+ const permission = route?.runtime?.permission;
49213
+ return permission && typeof permission === "object" ? permission : void 0;
49214
+ };
49215
+ var isRuntimePermissionDenied = (route) => getRuntimePermission(route)?.canView === false;
49216
+ var getRuntimePermissionMessage = (route) => String(
49217
+ route.message || getRuntimePermission(route)?.message || "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u5F53\u524D\u9875\u9762"
49218
+ );
49208
49219
  function BuiltinRouteRenderer({
49209
49220
  route,
49210
49221
  appType: appTypeProp,
@@ -49242,12 +49253,13 @@ function BuiltinRouteRenderer({
49242
49253
  () => route ? resolveRouteConfig(route, config3) : {},
49243
49254
  [config3, route]
49244
49255
  );
49256
+ const permissionDenied = isRuntimePermissionDenied(route);
49245
49257
  const reload = useCallback36(() => setReloadKey((value) => value + 1), []);
49246
49258
  useEffect98(() => {
49247
49259
  let cancelled = false;
49248
49260
  setSchema(void 0);
49249
49261
  setError("");
49250
- if (!route || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
49262
+ if (!route || permissionDenied || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
49251
49263
  setLoading(false);
49252
49264
  return () => {
49253
49265
  cancelled = true;
@@ -49289,8 +49301,19 @@ function BuiltinRouteRenderer({
49289
49301
  return () => {
49290
49302
  cancelled = true;
49291
49303
  };
49292
- }, [api, appType, formUuid, reloadKey, request, route, routeConfig]);
49304
+ }, [api, appType, formUuid, permissionDenied, reloadKey, request, route, routeConfig]);
49293
49305
  if (!route) return null;
49306
+ if (permissionDenied) {
49307
+ return /* @__PURE__ */ jsx97("div", { className, style: style2, "data-openxiangda-builtin-route": route.kind, children: /* @__PURE__ */ jsx97(
49308
+ Alert3,
49309
+ {
49310
+ type: "warning",
49311
+ showIcon: true,
49312
+ message: getRuntimePermissionMessage(route),
49313
+ style: { margin: 16 }
49314
+ }
49315
+ ) });
49316
+ }
49294
49317
  if (route.mode !== "builtin-route") {
49295
49318
  return route.message ? /* @__PURE__ */ jsx97(Alert3, { type: "info", showIcon: true, message: route.message, style: { margin: 16 } }) : null;
49296
49319
  }