@localazy/strapi-plugin 1.4.0 → 1.6.0

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.
Files changed (61) hide show
  1. package/README.md +30 -0
  2. package/dist/_chunks/{FetchIdentity-Cor4ooZv.mjs → FetchIdentity-Bm7bc5bS.mjs} +36 -44
  3. package/dist/_chunks/{FetchIdentity-BpFOT163.js → FetchIdentity-CcEjakiz.js} +24 -32
  4. package/dist/_chunks/{LanguagesSelector-BbrMKwQY.mjs → LanguagesSelector-B1rwN7-Y.mjs} +4 -3
  5. package/dist/_chunks/{LanguagesSelector-CC1ecWnc.js → LanguagesSelector-DejYCwBl.js} +3 -2
  6. package/dist/_chunks/{LocalazyApp-DpFR8p10.mjs → LocalazyApp-C4kbsnQh.mjs} +70 -34
  7. package/dist/_chunks/{LocalazyApp-D0JGRQeF.js → LocalazyApp-jPO7Yr1S.js} +75 -39
  8. package/dist/_chunks/{LocalazyContentTransferSetup-Dael1Q4w.mjs → LocalazyContentTransferSetup-C1wDD9hA.mjs} +58 -22
  9. package/dist/_chunks/{LocalazyContentTransferSetup-Cr7D-BUi.js → LocalazyContentTransferSetup-DZh4ZdSi.js} +62 -26
  10. package/dist/_chunks/{LocalazyGlobalSettings-D3nG4zl7.js → LocalazyGlobalSettings-D76it6rn.js} +56 -25
  11. package/dist/_chunks/{LocalazyGlobalSettings-DzBI5M-K.mjs → LocalazyGlobalSettings-DOW5rjLn.mjs} +56 -25
  12. package/dist/_chunks/{LocalazyPanel-W6j8N1WC.mjs → LocalazyPanel-C_Z4W49T.mjs} +12 -6
  13. package/dist/_chunks/{LocalazyPanel-KQPLxTDz.js → LocalazyPanel-D2LQpqii.js} +14 -8
  14. package/dist/_chunks/{LocalazyStatusColumn-CrhsCjgp.mjs → LocalazyStatusColumn-C_ZCd_s7.mjs} +10 -4
  15. package/dist/_chunks/{LocalazyStatusColumn-B7Q_U2Lu.js → LocalazyStatusColumn-Dy6N4_X6.js} +10 -4
  16. package/dist/_chunks/{RequireLocalazyAuth-D3GeZPDh.js → RequireLocalazyAuth-BVwF0bRC.js} +30 -3
  17. package/dist/_chunks/{RequireLocalazyAuth-BwoGRfJq.mjs → RequireLocalazyAuth-DNhTZZ_6.mjs} +32 -5
  18. package/dist/_chunks/{entry-exclusion-service-D7gaRHPE.mjs → entry-exclusion-service-CF_yNCly.mjs} +1 -1
  19. package/dist/_chunks/{entry-exclusion-service-Bwruvyce.js → entry-exclusion-service-CH3ZoJQN.js} +1 -1
  20. package/dist/_chunks/{has-model-changed-Dp2Vkwjw.mjs → has-model-changed-CVJEuGxM.mjs} +2 -2
  21. package/dist/_chunks/{has-model-changed-5IV9WI_-.js → has-model-changed-DdYbyv0v.js} +2 -2
  22. package/dist/_chunks/{i18n-o24yXf-j.mjs → i18n-76ox2llT.mjs} +4 -1
  23. package/dist/_chunks/{i18n-C_5tJvr0.js → i18n-C5ucROBh.js} +4 -1
  24. package/dist/_chunks/{index-jAg6jjCu.js → index-CEGaWWh3.js} +33 -11
  25. package/dist/_chunks/{index-C9hN3KbD.mjs → index-DP2ugzc_.mjs} +34 -12
  26. package/dist/_chunks/{index-BjL9XpRh.mjs → index-shryj0jT.mjs} +16 -16
  27. package/dist/_chunks/{strapi-api-base-IG3Pe5Sg.js → strapi-api-base-CCUuu7EY.js} +1 -1
  28. package/dist/_chunks/{strapi-api-base-CAzGcwF6.mjs → strapi-api-base-IiMEtDoH.mjs} +1 -1
  29. package/dist/admin/index.js +1 -1
  30. package/dist/admin/index.mjs +1 -1
  31. package/dist/admin/src/components/LocalazyStatusColumn.d.ts +1 -1
  32. package/dist/admin/src/constants/permissions.d.ts +29 -0
  33. package/dist/admin/src/modules/@common/components/LanguagesSelector.d.ts +1 -0
  34. package/dist/admin/src/modules/login/locale/en.d.ts +1 -0
  35. package/dist/admin/src/modules/plugin-settings/components/Tree.d.ts +1 -0
  36. package/dist/admin/src/modules/plugin-settings/components/TreeItem.d.ts +1 -0
  37. package/dist/admin/src/modules/plugin-settings/components/WebhookSetup.d.ts +4 -1
  38. package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +2 -0
  39. package/dist/admin/src/modules/plugin-settings/services/plugin-settings-service.d.ts +4 -0
  40. package/dist/server/index.js +157 -36
  41. package/dist/server/index.mjs +157 -36
  42. package/dist/server/src/bootstrap.d.ts +1 -1
  43. package/dist/server/src/constants/permissions.d.ts +38 -0
  44. package/dist/server/src/controllers/index.d.ts +1 -0
  45. package/dist/server/src/controllers/plugin-settings-controller.d.ts +1 -0
  46. package/dist/server/src/core/index.d.ts +3 -1
  47. package/dist/server/src/index.d.ts +57 -8
  48. package/dist/server/src/routes/activity-logs-routes.d.ts +20 -3
  49. package/dist/server/src/routes/debug-bundle-routes.d.ts +6 -1
  50. package/dist/server/src/routes/entry-exclusion-routes.d.ts +20 -3
  51. package/dist/server/src/routes/index.d.ts +52 -6
  52. package/dist/server/src/routes/localazy-auth-routes.d.ts +6 -1
  53. package/dist/server/src/routes/localazy-project-routes.d.ts +20 -3
  54. package/dist/server/src/routes/localazy-transfer-routes.d.ts +6 -1
  55. package/dist/server/src/routes/localazy-user-routes.d.ts +20 -3
  56. package/dist/server/src/routes/plugin-settings-routes.d.ts +20 -3
  57. package/dist/server/src/routes/strapi-routes.d.ts +20 -3
  58. package/dist/server/src/services/index.d.ts +3 -1
  59. package/dist/server/src/services/localazy-transfer-download-service.d.ts +2 -1
  60. package/dist/server/src/services/plugin-settings-service.d.ts +4 -0
  61. package/package.json +1 -1
@@ -4,15 +4,15 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const reactRouterDom = require("react-router-dom");
5
5
  const index$1 = require("./index-CTkxoioB.js");
6
6
  const React = require("react");
7
- const FetchIdentity = require("./FetchIdentity-BpFOT163.js");
8
- const index = require("./index-jAg6jjCu.js");
7
+ const FetchIdentity = require("./FetchIdentity-CcEjakiz.js");
8
+ const index = require("./index-CEGaWWh3.js");
9
9
  const useTranslation = require("./useTranslation-BdIl-aLe.js");
10
10
  const _commonjsHelpers = require("./_commonjsHelpers-Bc2YnDe1.js");
11
- const strapiApiBase = require("./strapi-api-base-IG3Pe5Sg.js");
12
- const LanguagesSelector = require("./LanguagesSelector-CC1ecWnc.js");
13
11
  const admin = require("@strapi/strapi/admin");
14
- require("./i18n-C_5tJvr0.js");
15
- const hasModelChanged = require("./has-model-changed-5IV9WI_-.js");
12
+ const strapiApiBase = require("./strapi-api-base-CCUuu7EY.js");
13
+ const LanguagesSelector = require("./LanguagesSelector-DejYCwBl.js");
14
+ require("./i18n-C5ucROBh.js");
15
+ const hasModelChanged = require("./has-model-changed-DdYbyv0v.js");
16
16
  const styled = require("styled-components");
17
17
  const _interopDefault = (e2) => e2 && e2.__esModule ? e2 : { default: e2 };
18
18
  const React__default = /* @__PURE__ */ _interopDefault(React);
@@ -102,10 +102,6 @@ const useHeaderSubtitle = () => {
102
102
  const currentNavItem = navigation.find((navItem) => pluginSegment.includes(navItem.id));
103
103
  return currentNavItem?.description || "";
104
104
  };
105
- function PluginPageLoader() {
106
- const { t: t2 } = useTranslation.useTranslation();
107
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { marginTop: 10, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Loader, { children: t2("common.loading_content") }) });
108
- }
109
105
  var propTypes = { exports: {} };
110
106
  var reactIs = { exports: {} };
111
107
  var reactIs_production_min = {};
@@ -1262,6 +1258,8 @@ if (process.env.STRAPI_ADMIN_LOCALAZY_ENV === "development") {
1262
1258
  }
1263
1259
  const LoginButton = (props) => {
1264
1260
  const { t: t2 } = useTranslation.useTranslation();
1261
+ const { allowedActions } = admin.useRBAC(index.PERMISSIONS.SETTINGS_UPDATE);
1262
+ const canConnect = !!allowedActions.canUpdate;
1265
1263
  const [isLoading, setIsLoading] = React.useState(false);
1266
1264
  const login = async () => {
1267
1265
  setIsLoading(true);
@@ -1282,7 +1280,8 @@ const LoginButton = (props) => {
1282
1280
  setIsLoading(false);
1283
1281
  props.onResultFetched(pollResult);
1284
1282
  };
1285
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Button, { variant: "default", size: "L", loading: isLoading, onClick: login, children: t2("login.login_with_localazy") }) });
1283
+ const button = /* @__PURE__ */ jsxRuntime.jsx(index$1.Button, { variant: "default", size: "L", loading: isLoading, onClick: login, disabled: !canConnect, children: t2("login.login_with_localazy") });
1284
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: canConnect ? button : /* @__PURE__ */ jsxRuntime.jsx(index$1.TooltipImpl, { label: t2("login.requires_settings_update_permission"), children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: button }) }) });
1286
1285
  };
1287
1286
  LoginButton.propTypes = {
1288
1287
  onResultFetched: PropTypes.func.isRequired
@@ -1396,7 +1395,7 @@ const Login = ({ title, subtitle, isLoading = false }) => {
1396
1395
  }, [isLoggedIn, identity]);
1397
1396
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1398
1397
  /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Header, { title, subtitle, as: "h1" }),
1399
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
1398
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}),
1400
1399
  !isLoading && /* @__PURE__ */ jsxRuntime.jsxs(
1401
1400
  index$1.Box,
1402
1401
  {
@@ -1440,6 +1439,8 @@ const LogoutButton = (props) => {
1440
1439
  const { t: t2 } = useTranslation.useTranslation();
1441
1440
  const [isLoading, setIsLoading] = React.useState(false);
1442
1441
  const { setIdentity } = FetchIdentity.useLocalazyIdentity();
1442
+ const { allowedActions } = admin.useRBAC(index.PERMISSIONS.SETTINGS_UPDATE);
1443
+ const canDisconnect = !!allowedActions.canUpdate;
1443
1444
  const logout = async () => {
1444
1445
  setIsLoading(true);
1445
1446
  void FetchIdentity.LocalazyUserService.deleteIdentity();
@@ -1447,7 +1448,8 @@ const LogoutButton = (props) => {
1447
1448
  setIsLoading(false);
1448
1449
  props.onResultFetched();
1449
1450
  };
1450
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Button, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$L, {}), variant: "secondary", loading: isLoading, onClick: logout, children: t2("login.logout_from_localazy") }) });
1451
+ const button = /* @__PURE__ */ jsxRuntime.jsx(index$1.Button, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$L, {}), variant: "secondary", loading: isLoading, onClick: logout, disabled: !canDisconnect, children: t2("login.logout_from_localazy") });
1452
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: canDisconnect ? button : /* @__PURE__ */ jsxRuntime.jsx(index$1.TooltipImpl, { label: t2("login.requires_settings_update_permission"), children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: button }) }) });
1451
1453
  };
1452
1454
  const OverviewItem = (props) => {
1453
1455
  return /* @__PURE__ */ jsxRuntime.jsxs(index$1.Grid.Root, { padding: 1, col: 6, s: 12, children: [
@@ -1478,7 +1480,7 @@ const Overview = ({ title, subtitle, isLoadingProp = false }) => {
1478
1480
  setIsLoading(true);
1479
1481
  const project = await LanguagesSelector.ProjectService.getConnectedProject();
1480
1482
  setConnectedProject(project);
1481
- void FetchIdentity.PluginSettingsService.updatePluginSettings({ defaultRoute: PLUGIN_ROUTES.OVERVIEW });
1483
+ void FetchIdentity.PluginSettingsService.updatePluginSettingsUiPrefs({ defaultRoute: PLUGIN_ROUTES.OVERVIEW });
1482
1484
  setIsLoading(false);
1483
1485
  }
1484
1486
  void initComponent();
@@ -1496,7 +1498,7 @@ const Overview = ({ title, subtitle, isLoadingProp = false }) => {
1496
1498
  primaryAction: /* @__PURE__ */ jsxRuntime.jsx(LogoutButton, { onResultFetched: onLoggedOut })
1497
1499
  }
1498
1500
  ),
1499
- (isLoadingProp || isLoading) && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
1501
+ (isLoadingProp || isLoading) && /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}),
1500
1502
  !(isLoadingProp || isLoading) && /* @__PURE__ */ jsxRuntime.jsx(index$1.Box, { paddingRight: 10, paddingLeft: 10, children: /* @__PURE__ */ jsxRuntime.jsxs(
1501
1503
  index$1.Box,
1502
1504
  {
@@ -5065,7 +5067,7 @@ const Upload = (props) => {
5065
5067
  setLocalazySourceLanguage(sourceLanguage);
5066
5068
  setModelChanged(modelChangedResult);
5067
5069
  setLocalesIncompatible(!localesCompatibleResult);
5068
- void FetchIdentity.PluginSettingsService.updatePluginSettings({ defaultRoute: PLUGIN_ROUTES.UPLOAD });
5070
+ void FetchIdentity.PluginSettingsService.updatePluginSettingsUiPrefs({ defaultRoute: PLUGIN_ROUTES.UPLOAD });
5069
5071
  setIsLoading(false);
5070
5072
  }
5071
5073
  void initComponent();
@@ -5088,7 +5090,7 @@ const Upload = (props) => {
5088
5090
  )
5089
5091
  }
5090
5092
  ),
5091
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
5093
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}),
5092
5094
  !isLoading && /* @__PURE__ */ jsxRuntime.jsxs(index$1.Box, { paddingRight: 10, paddingLeft: 10, children: [
5093
5095
  /* @__PURE__ */ jsxRuntime.jsxs(
5094
5096
  index$1.Box,
@@ -5198,16 +5200,9 @@ const Download = (props) => {
5198
5200
  window.open(identity.project.url, "_blank");
5199
5201
  };
5200
5202
  const [projectLanguages, setProjectLanguages] = React.useState([]);
5201
- const [formModel, setFormModel] = React.useState({});
5203
+ const [uiLanguages, setUiLanguages] = React.useState([]);
5202
5204
  const onDownloadLanguagesChange = (languages) => {
5203
- const newFormModel = FetchIdentity.cloneDeep(formModel);
5204
- FetchIdentity.set(newFormModel, "download.uiLanguages", languages);
5205
- setFormModel(newFormModel);
5206
- try {
5207
- void FetchIdentity.PluginSettingsService.updatePluginSettings(newFormModel);
5208
- } catch (e2) {
5209
- console.error(e2.message);
5210
- }
5205
+ setUiLanguages(languages);
5211
5206
  };
5212
5207
  const onDownloadClick = async (fullSync = false) => {
5213
5208
  setIsDownloading(true);
@@ -5216,7 +5211,7 @@ const Download = (props) => {
5216
5211
  success: false,
5217
5212
  report: []
5218
5213
  });
5219
- const result = await LocalazyDownloadService.download({ fullSync });
5214
+ const result = await LocalazyDownloadService.download({ fullSync, uiLanguages });
5220
5215
  const { streamIdentifier } = result;
5221
5216
  downloadAlertsService.setStreamIdentifier(streamIdentifier);
5222
5217
  downloadAlertsService.onDownload((data) => {
@@ -5257,8 +5252,8 @@ const Download = (props) => {
5257
5252
  setHasSyncCursor(syncCursor?.processedKeys !== void 0 && Object.keys(syncCursor.processedKeys).length > 0);
5258
5253
  const projectLanguagesWithoutDefaultLanguage = project?.languages?.filter((language) => language.id !== project.sourceLanguage) || [];
5259
5254
  setProjectLanguages(projectLanguagesWithoutDefaultLanguage);
5260
- setFormModel(globalSettings);
5261
- void FetchIdentity.PluginSettingsService.updatePluginSettings({ defaultRoute: PLUGIN_ROUTES.DOWNLOAD });
5255
+ setUiLanguages(Array.isArray(globalSettings?.download?.uiLanguages) ? globalSettings.download.uiLanguages : []);
5256
+ void FetchIdentity.PluginSettingsService.updatePluginSettingsUiPrefs({ defaultRoute: PLUGIN_ROUTES.DOWNLOAD });
5262
5257
  setIsLoading(false);
5263
5258
  }
5264
5259
  void initComponent();
@@ -5293,7 +5288,7 @@ const Download = (props) => {
5293
5288
  ] })
5294
5289
  }
5295
5290
  ),
5296
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
5291
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}),
5297
5292
  !isLoading && /* @__PURE__ */ jsxRuntime.jsxs(index$1.Box, { paddingRight: 10, paddingLeft: 10, children: [
5298
5293
  /* @__PURE__ */ jsxRuntime.jsxs(
5299
5294
  index$1.Box,
@@ -5316,7 +5311,7 @@ const Download = (props) => {
5316
5311
  /* @__PURE__ */ jsxRuntime.jsx(index$1.Box, { paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
5317
5312
  LanguagesSelector.LanguagesSelector,
5318
5313
  {
5319
- preselectedLanguages: formModel?.download?.uiLanguages || [],
5314
+ preselectedLanguages: uiLanguages,
5320
5315
  projectLanguages,
5321
5316
  onChange: (languages) => onDownloadLanguagesChange(languages),
5322
5317
  label: t2("download.ui_languages"),
@@ -5693,6 +5688,9 @@ const useDebouncedSearch = () => {
5693
5688
  const ActivityLogs = (props) => {
5694
5689
  const { t: t2 } = useTranslation.useTranslation();
5695
5690
  const navigate = reactRouterDom.useNavigate();
5691
+ const {
5692
+ allowedActions: { canTransfer }
5693
+ } = admin.useRBAC(index.PERMISSIONS.TRANSFER);
5696
5694
  const [isLoading, setIsLoading] = React.useState(true);
5697
5695
  const [sessions, setSessions] = React.useState([]);
5698
5696
  const [activeTab, setActiveTab] = React.useState("upload");
@@ -5706,7 +5704,7 @@ const ActivityLogs = (props) => {
5706
5704
  const debouncedSaveSortPrefs = React.useCallback((prefs) => {
5707
5705
  if (saveSortTimerRef.current) clearTimeout(saveSortTimerRef.current);
5708
5706
  saveSortTimerRef.current = setTimeout(() => {
5709
- void FetchIdentity.PluginSettingsService.updatePluginSettings({ activityLogsSort: prefs });
5707
+ void FetchIdentity.PluginSettingsService.updatePluginSettingsUiPrefs({ activityLogsSort: prefs });
5710
5708
  }, 1e3);
5711
5709
  }, []);
5712
5710
  const onSortChange = (eventType, key, direction) => {
@@ -5762,7 +5760,7 @@ const ActivityLogs = (props) => {
5762
5760
  void fetchSessions("upload");
5763
5761
  };
5764
5762
  void init();
5765
- void FetchIdentity.PluginSettingsService.updatePluginSettings({ defaultRoute: PLUGIN_ROUTES.ACTIVITY_LOGS });
5763
+ void FetchIdentity.PluginSettingsService.updatePluginSettingsUiPrefs({ defaultRoute: PLUGIN_ROUTES.ACTIVITY_LOGS });
5766
5764
  }, []);
5767
5765
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5768
5766
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5772,7 +5770,16 @@ const ActivityLogs = (props) => {
5772
5770
  subtitle: props.subtitle,
5773
5771
  primaryAction: /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { gap: 2, children: [
5774
5772
  /* @__PURE__ */ jsxRuntime.jsx(index$1.Button, { variant: "secondary", startIcon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$3P, {}), onClick: onExportLogs, children: t2("activity_logs.export_logs") }),
5775
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Button, { variant: "danger-light", startIcon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$j, {}), onClick: () => setShowClearConfirm(true), children: t2("activity_logs.clear_logs") })
5773
+ /* @__PURE__ */ jsxRuntime.jsx(
5774
+ index$1.Button,
5775
+ {
5776
+ variant: "danger-light",
5777
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$j, {}),
5778
+ disabled: !canTransfer,
5779
+ onClick: () => setShowClearConfirm(true),
5780
+ children: t2("activity_logs.clear_logs")
5781
+ }
5782
+ )
5776
5783
  ] })
5777
5784
  }
5778
5785
  ),
@@ -5780,7 +5787,7 @@ const ActivityLogs = (props) => {
5780
5787
  /* @__PURE__ */ jsxRuntime.jsx(index$1.ForwardRef$2x, { width: 14, height: 14, fill: "neutral500" }),
5781
5788
  /* @__PURE__ */ jsxRuntime.jsx(index$1.Typography, { variant: "pi", textColor: "neutral500", children: t2("activity_logs.retention_info") })
5782
5789
  ] }) }),
5783
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
5790
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}),
5784
5791
  !isLoading && /* @__PURE__ */ jsxRuntime.jsxs(index$1.Box, { paddingRight: 10, paddingLeft: 10, children: [
5785
5792
  clearSuccess && /* @__PURE__ */ jsxRuntime.jsx(index$1.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Alert, { onClose: () => setClearSuccess(false), closeLabel: t2("activity_logs.close"), variant: "success", children: t2("activity_logs.clear_logs_success") }) }),
5786
5793
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6043,7 +6050,7 @@ const ActivityLogDetail = (props) => {
6043
6050
  ) })
6044
6051
  }
6045
6052
  ),
6046
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
6053
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}),
6047
6054
  !isLoading && !session && /* @__PURE__ */ jsxRuntime.jsx(index$1.Box, { paddingRight: 10, paddingLeft: 10, children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Typography, { variant: "omega", children: t2("activity_logs.no_sessions") }) }),
6048
6055
  !isLoading && session && /* @__PURE__ */ jsxRuntime.jsxs(index$1.Box, { paddingRight: 10, paddingLeft: 10, children: [
6049
6056
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6140,6 +6147,10 @@ const App = () => {
6140
6147
  const { isLoggedIn, isFetchingIdentity } = FetchIdentity.useLocalazyIdentity();
6141
6148
  const headerTitle = useHeaderTitle();
6142
6149
  const headerSubtitle = useHeaderSubtitle();
6150
+ const {
6151
+ allowedActions: { canRead, canTransfer },
6152
+ isLoading: isLoadingPermissions
6153
+ } = admin.useRBAC([...index.PERMISSIONS.READ, ...index.PERMISSIONS.TRANSFER]);
6143
6154
  const normalizedPath = location2.pathname.replace(/\/+$/, "");
6144
6155
  const pluginRoot = `/plugins/${index.PLUGIN_ID}`;
6145
6156
  const isAtPluginRoot = normalizedPath === pluginRoot;
@@ -6161,10 +6172,23 @@ const App = () => {
6161
6172
  };
6162
6173
  void fetchData();
6163
6174
  }, [isLoggedIn, isFetchingIdentity, normalizedPath]);
6175
+ if (isLoadingPermissions) {
6176
+ return /* @__PURE__ */ jsxRuntime.jsxs(index$1.DesignSystemProvider, { theme: FetchIdentity.getDefaultTheme(), children: [
6177
+ /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.HeadingFixGlobalStyle, {}),
6178
+ /* @__PURE__ */ jsxRuntime.jsx(index$1.Box, { background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}) }) })
6179
+ ] });
6180
+ }
6181
+ if (!canRead) {
6182
+ return /* @__PURE__ */ jsxRuntime.jsxs(index$1.DesignSystemProvider, { theme: FetchIdentity.getDefaultTheme(), children: [
6183
+ /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.HeadingFixGlobalStyle, {}),
6184
+ /* @__PURE__ */ jsxRuntime.jsx(index$1.Box, { background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.NoPermissions, {}) }) })
6185
+ ] });
6186
+ }
6187
+ const transferElement = (page) => canTransfer ? page : /* @__PURE__ */ jsxRuntime.jsx(admin.Page.NoPermissions, {});
6164
6188
  return /* @__PURE__ */ jsxRuntime.jsxs(index$1.DesignSystemProvider, { theme: FetchIdentity.getDefaultTheme(), children: [
6165
6189
  /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.HeadingFixGlobalStyle, {}),
6166
6190
  /* @__PURE__ */ jsxRuntime.jsx(PluginErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Box, { background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Root, { sideNav: isLoggedIn && /* @__PURE__ */ jsxRuntime.jsx(SideNav, {}), children: [
6167
- isFetchingIdentity && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
6191
+ isFetchingIdentity && /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}),
6168
6192
  /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
6169
6193
  /* @__PURE__ */ jsxRuntime.jsx(
6170
6194
  reactRouterDom.Route,
@@ -6180,8 +6204,20 @@ const App = () => {
6180
6204
  element: /* @__PURE__ */ jsxRuntime.jsx(Overview, { title: headerTitle, subtitle: headerSubtitle, isLoadingProp: false })
6181
6205
  }
6182
6206
  ),
6183
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `upload`, element: /* @__PURE__ */ jsxRuntime.jsx(Upload, { title: headerTitle, subtitle: headerSubtitle }) }),
6184
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `download`, element: /* @__PURE__ */ jsxRuntime.jsx(Download, { title: headerTitle, subtitle: headerSubtitle }) }),
6207
+ /* @__PURE__ */ jsxRuntime.jsx(
6208
+ reactRouterDom.Route,
6209
+ {
6210
+ path: `upload`,
6211
+ element: transferElement(/* @__PURE__ */ jsxRuntime.jsx(Upload, { title: headerTitle, subtitle: headerSubtitle }))
6212
+ }
6213
+ ),
6214
+ /* @__PURE__ */ jsxRuntime.jsx(
6215
+ reactRouterDom.Route,
6216
+ {
6217
+ path: `download`,
6218
+ element: transferElement(/* @__PURE__ */ jsxRuntime.jsx(Download, { title: headerTitle, subtitle: headerSubtitle }))
6219
+ }
6220
+ ),
6185
6221
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `activity-logs`, element: /* @__PURE__ */ jsxRuntime.jsx(ActivityLogs, { title: headerTitle, subtitle: headerSubtitle }) }),
6186
6222
  /* @__PURE__ */ jsxRuntime.jsx(
6187
6223
  reactRouterDom.Route,
@@ -1,14 +1,15 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { C as CheckboxImpl, B as Box, m as Accordion, c as Flex, n as SwitchImpl, T as Typography, e as Button, d as ForwardRef$4z, A as Alert, j as Divider, l as DesignSystemProvider } from "./index-BjL9XpRh.mjs";
2
+ import { C as CheckboxImpl, B as Box, m as Accordion, c as Flex, n as SwitchImpl, T as Typography, e as Button, d as ForwardRef$4z, A as Alert, j as Divider, l as DesignSystemProvider } from "./index-shryj0jT.mjs";
3
+ import { useRBAC, Layouts, Page } from "@strapi/strapi/admin";
3
4
  import { forwardRef, useState, useEffect } from "react";
4
- import { i as isEqual, R as RequireLocalazyAuth } from "./RequireLocalazyAuth-BwoGRfJq.mjs";
5
- import { s as set, n as keys, o as isArrayLike, p as arrayEach, l as isArray, q as isObject, P as PluginSettingsService, c as cloneDeep, g as getDefaultTheme, H as HeadingFixGlobalStyle, L as LocalazyIdentityProvider, F as FetchIdentity } from "./FetchIdentity-Cor4ooZv.mjs";
6
- import { Layouts } from "@strapi/strapi/admin";
7
- import { S as SUPPORTED_CONTENT_TYPE_FIELDS, a as SUPPORTED_CUSTOM_FIELD_PLUGINS, g as getContentTransferSetupKeysSets, b as get, f as findModelValueByKey, c as StrapiModelService, d as getModelsTree, h as hasModelChanged } from "./has-model-changed-Dp2Vkwjw.mjs";
5
+ import { s as set, i as isEqual, R as RequireLocalazyAuth } from "./RequireLocalazyAuth-DNhTZZ_6.mjs";
6
+ import { r as keys, v as isArrayLike, w as arrayEach, l as isArray, n as isObject, P as PluginSettingsService, c as cloneDeep, g as getDefaultTheme, H as HeadingFixGlobalStyle, a as PluginPageLoader, L as LocalazyIdentityProvider, F as FetchIdentity } from "./FetchIdentity-Bm7bc5bS.mjs";
7
+ import { S as SUPPORTED_CONTENT_TYPE_FIELDS, a as SUPPORTED_CUSTOM_FIELD_PLUGINS, g as getContentTransferSetupKeysSets, b as get, f as findModelValueByKey, c as StrapiModelService, d as getModelsTree, h as hasModelChanged } from "./has-model-changed-CVJEuGxM.mjs";
8
8
  import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
9
9
  import styled from "styled-components";
10
10
  import { Trans } from "./index-BIbKC7-V.mjs";
11
- import "./i18n-o24yXf-j.mjs";
11
+ import { P as PERMISSIONS } from "./index-DP2ugzc_.mjs";
12
+ import "./i18n-76ox2llT.mjs";
12
13
  const getFilteredModelsSchemas = (models) => {
13
14
  if (!models) {
14
15
  return [];
@@ -763,12 +764,19 @@ const SvgX = (props, ref) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.
763
764
  )
764
765
  ] }) });
765
766
  forwardRef(SvgX);
766
- const TreeItem = ({ label, value, children, passedKey = "", onTreeItemClick }) => {
767
+ const TreeItem = ({
768
+ label,
769
+ value,
770
+ children,
771
+ passedKey = "",
772
+ onTreeItemClick,
773
+ disabled = false
774
+ }) => {
767
775
  const onChange = (key, currentValue) => {
768
776
  onTreeItemClick(key, currentValue);
769
777
  };
770
778
  return /* @__PURE__ */ jsxs(Fragment, { children: [
771
- typeof value === "boolean" && /* @__PURE__ */ jsx(CheckboxImpl, { checked: value, onCheckedChange: () => onChange([passedKey], value), children: label || "-" }),
779
+ typeof value === "boolean" && /* @__PURE__ */ jsx(CheckboxImpl, { checked: value, disabled, onCheckedChange: () => onChange([passedKey], value), children: label || "-" }),
772
780
  value === null && /* @__PURE__ */ jsx(CheckboxImpl, { checked: false, disabled: true, children: label || "-" }),
773
781
  children && /* @__PURE__ */ jsx("div", { children }, passedKey)
774
782
  ] });
@@ -831,7 +839,7 @@ function flattenObject(obj, delimiter = ".") {
831
839
  });
832
840
  return nobj;
833
841
  }
834
- const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
842
+ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false, disabled = false }) => {
835
843
  const { t } = useTranslation();
836
844
  const [, setIsExpanded] = useState(initiallyExpanded);
837
845
  useEffect(() => {
@@ -884,7 +892,7 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
884
892
  isSubbranchObject && /* @__PURE__ */ jsx(
885
893
  CheckboxImpl,
886
894
  {
887
- disabled: hasAllNullValue,
895
+ disabled: disabled || hasAllNullValue,
888
896
  checked: getCheckedState(hasTruthyValue, hasFalsyValue),
889
897
  onCheckedChange: () => onTreeItemClick(flattenedKeys, hasTruthyValue),
890
898
  children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", children: [
@@ -893,11 +901,21 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
893
901
  ] })
894
902
  }
895
903
  ),
896
- /* @__PURE__ */ jsx(TreeItem, { onTreeItemClick, passedKey, children: createTree(key, value, passedKey) })
904
+ /* @__PURE__ */ jsx(TreeItem, { onTreeItemClick, passedKey, disabled, children: createTree(key, value, passedKey) })
897
905
  ] }, passedKey);
898
906
  }) });
899
907
  }
900
- return /* @__PURE__ */ jsx(TreeItem, { onTreeItemClick, passedKey: path, label: name, value: branch }, path);
908
+ return /* @__PURE__ */ jsx(
909
+ TreeItem,
910
+ {
911
+ onTreeItemClick,
912
+ passedKey: path,
913
+ label: name,
914
+ value: branch,
915
+ disabled
916
+ },
917
+ path
918
+ );
901
919
  };
902
920
  return /* @__PURE__ */ jsx(Box, { children: Object.entries(objects).map(([key, value]) => {
903
921
  return value.__model__ !== void 0 && /* @__PURE__ */ jsx(Box, { borderColor: "neutral200", hasRadius: true, children: /* @__PURE__ */ jsx(Accordion.Root, { size: "S", children: /* @__PURE__ */ jsxs(Accordion.Item, { value: key, children: [
@@ -913,6 +931,7 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
913
931
  label: `switch_tree_${key}`,
914
932
  onCheckedChange: () => onTreeItemClick([`${key}.__model__`], value.__model__),
915
933
  checked: !!value.__model__,
934
+ disabled,
916
935
  style: { marginRight: "1rem" }
917
936
  }
918
937
  )
@@ -990,6 +1009,9 @@ function ContentTransferSetupEmpty() {
990
1009
  }
991
1010
  const ContentTransferSetup = () => {
992
1011
  const { t } = useTranslation();
1012
+ const {
1013
+ allowedActions: { canUpdate: canUpdateSettings }
1014
+ } = useRBAC(PERMISSIONS.SETTINGS_UPDATE);
993
1015
  const [isLoading, setIsLoading] = useState(true);
994
1016
  const [showAlert, setShowAlert] = useState(false);
995
1017
  const [showModalChangedAlert, setShowModalChangedAlert] = useState(false);
@@ -1087,12 +1109,12 @@ const ContentTransferSetup = () => {
1087
1109
  title: t("plugin_settings.content_transfer_setup"),
1088
1110
  subtitle: t("plugin_settings.content_transfer_setup_description"),
1089
1111
  primaryAction: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
1090
- /* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
1112
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !canUpdateSettings || !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
1091
1113
  /* @__PURE__ */ jsx(
1092
1114
  Button,
1093
1115
  {
1094
1116
  startIcon: /* @__PURE__ */ jsx(ForwardRef$4z, {}),
1095
- disabled: !hasUnsavedChanges,
1117
+ disabled: !canUpdateSettings || !hasUnsavedChanges,
1096
1118
  onClick: () => {
1097
1119
  void saveContentTransferSetup(formModel);
1098
1120
  },
@@ -1128,7 +1150,15 @@ const ContentTransferSetup = () => {
1128
1150
  !formModel.length && // empty state
1129
1151
  /* @__PURE__ */ jsx(ContentTransferSetupEmpty, {}),
1130
1152
  formModel.map((tree, index) => {
1131
- return /* @__PURE__ */ jsx(Box, { marginBottom: 3, children: /* @__PURE__ */ jsx(Tree, { onTreeItemClick, objects: tree, initiallyExpanded: index === 0 }) }, `box_tree_${index}`);
1153
+ return /* @__PURE__ */ jsx(Box, { marginBottom: 3, children: /* @__PURE__ */ jsx(
1154
+ Tree,
1155
+ {
1156
+ onTreeItemClick,
1157
+ objects: tree,
1158
+ initiallyExpanded: index === 0,
1159
+ disabled: !canUpdateSettings
1160
+ }
1161
+ ) }, `box_tree_${index}`);
1132
1162
  }),
1133
1163
  !!formModel.length && /* @__PURE__ */ jsxs(Box, { children: [
1134
1164
  /* @__PURE__ */ jsx(Box, { paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsx(Divider, {}) }),
@@ -1153,13 +1183,19 @@ const ContentTransferSetup = () => {
1153
1183
  ] })
1154
1184
  ] });
1155
1185
  };
1156
- const LocalazyContentTransferSetup = () => /* @__PURE__ */ jsxs(DesignSystemProvider, { theme: getDefaultTheme(), children: [
1157
- /* @__PURE__ */ jsx(HeadingFixGlobalStyle, {}),
1158
- /* @__PURE__ */ jsxs(LocalazyIdentityProvider, { children: [
1159
- /* @__PURE__ */ jsx(FetchIdentity, {}),
1160
- /* @__PURE__ */ jsx(RequireLocalazyAuth, { children: /* @__PURE__ */ jsx(ContentTransferSetup, {}) })
1161
- ] })
1162
- ] });
1186
+ const LocalazyContentTransferSetup = () => {
1187
+ const {
1188
+ allowedActions: { canRead: canReadSettings },
1189
+ isLoading: isLoadingPermissions
1190
+ } = useRBAC(PERMISSIONS.SETTINGS_READ);
1191
+ return /* @__PURE__ */ jsxs(DesignSystemProvider, { theme: getDefaultTheme(), children: [
1192
+ /* @__PURE__ */ jsx(HeadingFixGlobalStyle, {}),
1193
+ isLoadingPermissions ? /* @__PURE__ */ jsx(PluginPageLoader, {}) : !canReadSettings ? /* @__PURE__ */ jsx(Page.NoPermissions, {}) : /* @__PURE__ */ jsxs(LocalazyIdentityProvider, { children: [
1194
+ /* @__PURE__ */ jsx(FetchIdentity, {}),
1195
+ /* @__PURE__ */ jsx(RequireLocalazyAuth, { children: /* @__PURE__ */ jsx(ContentTransferSetup, {}) })
1196
+ ] })
1197
+ ] });
1198
+ };
1163
1199
  export {
1164
1200
  LocalazyContentTransferSetup as default
1165
1201
  };
@@ -2,15 +2,16 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const index = require("./index-CTkxoioB.js");
5
- const React = require("react");
6
- const RequireLocalazyAuth = require("./RequireLocalazyAuth-D3GeZPDh.js");
7
- const FetchIdentity = require("./FetchIdentity-BpFOT163.js");
8
5
  const admin = require("@strapi/strapi/admin");
9
- const hasModelChanged = require("./has-model-changed-5IV9WI_-.js");
6
+ const React = require("react");
7
+ const RequireLocalazyAuth = require("./RequireLocalazyAuth-BVwF0bRC.js");
8
+ const FetchIdentity = require("./FetchIdentity-CcEjakiz.js");
9
+ const hasModelChanged = require("./has-model-changed-DdYbyv0v.js");
10
10
  const useTranslation = require("./useTranslation-BdIl-aLe.js");
11
11
  const styled = require("styled-components");
12
12
  const index$1 = require("./index-1he9s_bs.js");
13
- require("./i18n-C_5tJvr0.js");
13
+ const index$2 = require("./index-CEGaWWh3.js");
14
+ require("./i18n-C5ucROBh.js");
14
15
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
15
16
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
16
17
  const getFilteredModelsSchemas = (models) => {
@@ -42,16 +43,16 @@ const buildContentTransferSetupSchema = (localizableTree = [], storedSetupSchema
42
43
  const localizableTreeValueToSet = hasModelChanged.get(oStoredSetupSchema, key);
43
44
  const allModelsTreeValueToSet = hasModelChanged.findModelValueByKey(allModelsTree, key);
44
45
  if (allModelsTreeValueToSet === null) {
45
- FetchIdentity.set(destinationObject, key, null);
46
+ RequireLocalazyAuth.set(destinationObject, key, null);
46
47
  } else if (localizableTreeValueToSet !== null) {
47
- FetchIdentity.set(destinationObject, key, localizableTreeValueToSet);
48
+ RequireLocalazyAuth.set(destinationObject, key, localizableTreeValueToSet);
48
49
  } else {
49
50
  const newValueToSet = hasModelChanged.findModelValueByKey(allModelsTree, key);
50
- FetchIdentity.set(destinationObject, key, newValueToSet);
51
+ RequireLocalazyAuth.set(destinationObject, key, newValueToSet);
51
52
  }
52
53
  });
53
54
  newKeys.forEach((key) => {
54
- FetchIdentity.set(destinationObject, key, hasModelChanged.get(oLocalizableTree, key));
55
+ RequireLocalazyAuth.set(destinationObject, key, hasModelChanged.get(oLocalizableTree, key));
55
56
  });
56
57
  const destinationArray = [];
57
58
  const sortedDestinationObjectKeys = Object.keys(destinationObject).sort((a, b) => {
@@ -767,12 +768,19 @@ const SvgX = (props, ref) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "htt
767
768
  )
768
769
  ] }) });
769
770
  React.forwardRef(SvgX);
770
- const TreeItem = ({ label, value, children, passedKey = "", onTreeItemClick }) => {
771
+ const TreeItem = ({
772
+ label,
773
+ value,
774
+ children,
775
+ passedKey = "",
776
+ onTreeItemClick,
777
+ disabled = false
778
+ }) => {
771
779
  const onChange = (key, currentValue) => {
772
780
  onTreeItemClick(key, currentValue);
773
781
  };
774
782
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
775
- typeof value === "boolean" && /* @__PURE__ */ jsxRuntime.jsx(index.CheckboxImpl, { checked: value, onCheckedChange: () => onChange([passedKey], value), children: label || "-" }),
783
+ typeof value === "boolean" && /* @__PURE__ */ jsxRuntime.jsx(index.CheckboxImpl, { checked: value, disabled, onCheckedChange: () => onChange([passedKey], value), children: label || "-" }),
776
784
  value === null && /* @__PURE__ */ jsxRuntime.jsx(index.CheckboxImpl, { checked: false, disabled: true, children: label || "-" }),
777
785
  children && /* @__PURE__ */ jsxRuntime.jsx("div", { children }, passedKey)
778
786
  ] });
@@ -835,7 +843,7 @@ function flattenObject(obj, delimiter = ".") {
835
843
  });
836
844
  return nobj;
837
845
  }
838
- const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
846
+ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false, disabled = false }) => {
839
847
  const { t } = useTranslation.useTranslation();
840
848
  const [, setIsExpanded] = React.useState(initiallyExpanded);
841
849
  React.useEffect(() => {
@@ -888,7 +896,7 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
888
896
  isSubbranchObject && /* @__PURE__ */ jsxRuntime.jsx(
889
897
  index.CheckboxImpl,
890
898
  {
891
- disabled: hasAllNullValue,
899
+ disabled: disabled || hasAllNullValue,
892
900
  checked: getCheckedState(hasTruthyValue, hasFalsyValue),
893
901
  onCheckedChange: () => onTreeItemClick(flattenedKeys, hasTruthyValue),
894
902
  children: /* @__PURE__ */ jsxRuntime.jsxs(index.Flex, { alignItems: "center", children: [
@@ -897,11 +905,21 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
897
905
  ] })
898
906
  }
899
907
  ),
900
- /* @__PURE__ */ jsxRuntime.jsx(TreeItem, { onTreeItemClick, passedKey, children: createTree(key, value, passedKey) })
908
+ /* @__PURE__ */ jsxRuntime.jsx(TreeItem, { onTreeItemClick, passedKey, disabled, children: createTree(key, value, passedKey) })
901
909
  ] }, passedKey);
902
910
  }) });
903
911
  }
904
- return /* @__PURE__ */ jsxRuntime.jsx(TreeItem, { onTreeItemClick, passedKey: path, label: name, value: branch }, path);
912
+ return /* @__PURE__ */ jsxRuntime.jsx(
913
+ TreeItem,
914
+ {
915
+ onTreeItemClick,
916
+ passedKey: path,
917
+ label: name,
918
+ value: branch,
919
+ disabled
920
+ },
921
+ path
922
+ );
905
923
  };
906
924
  return /* @__PURE__ */ jsxRuntime.jsx(index.Box, { children: Object.entries(objects).map(([key, value]) => {
907
925
  return value.__model__ !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(index.Box, { borderColor: "neutral200", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(index.Accordion.Root, { size: "S", children: /* @__PURE__ */ jsxRuntime.jsxs(index.Accordion.Item, { value: key, children: [
@@ -917,6 +935,7 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
917
935
  label: `switch_tree_${key}`,
918
936
  onCheckedChange: () => onTreeItemClick([`${key}.__model__`], value.__model__),
919
937
  checked: !!value.__model__,
938
+ disabled,
920
939
  style: { marginRight: "1rem" }
921
940
  }
922
941
  )
@@ -994,6 +1013,9 @@ function ContentTransferSetupEmpty() {
994
1013
  }
995
1014
  const ContentTransferSetup = () => {
996
1015
  const { t } = useTranslation.useTranslation();
1016
+ const {
1017
+ allowedActions: { canUpdate: canUpdateSettings }
1018
+ } = admin.useRBAC(index$2.PERMISSIONS.SETTINGS_UPDATE);
997
1019
  const [isLoading, setIsLoading] = React.useState(true);
998
1020
  const [showAlert, setShowAlert] = React.useState(false);
999
1021
  const [showModalChangedAlert, setShowModalChangedAlert] = React.useState(false);
@@ -1045,7 +1067,7 @@ const ContentTransferSetup = () => {
1045
1067
  }
1046
1068
  const isEditable = hasModelChanged.get(model, key) !== null;
1047
1069
  if (isEditable) {
1048
- FetchIdentity.set(model, key, !currentValue);
1070
+ RequireLocalazyAuth.set(model, key, !currentValue);
1049
1071
  }
1050
1072
  });
1051
1073
  newState.splice(arrayIndex, 1, model);
@@ -1091,12 +1113,12 @@ const ContentTransferSetup = () => {
1091
1113
  title: t("plugin_settings.content_transfer_setup"),
1092
1114
  subtitle: t("plugin_settings.content_transfer_setup_description"),
1093
1115
  primaryAction: /* @__PURE__ */ jsxRuntime.jsxs(index.Flex, { gap: 2, children: [
1094
- /* @__PURE__ */ jsxRuntime.jsx(index.Button, { variant: "secondary", disabled: !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
1116
+ /* @__PURE__ */ jsxRuntime.jsx(index.Button, { variant: "secondary", disabled: !canUpdateSettings || !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
1095
1117
  /* @__PURE__ */ jsxRuntime.jsx(
1096
1118
  index.Button,
1097
1119
  {
1098
1120
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$4z, {}),
1099
- disabled: !hasUnsavedChanges,
1121
+ disabled: !canUpdateSettings || !hasUnsavedChanges,
1100
1122
  onClick: () => {
1101
1123
  void saveContentTransferSetup(formModel);
1102
1124
  },
@@ -1132,7 +1154,15 @@ const ContentTransferSetup = () => {
1132
1154
  !formModel.length && // empty state
1133
1155
  /* @__PURE__ */ jsxRuntime.jsx(ContentTransferSetupEmpty, {}),
1134
1156
  formModel.map((tree, index$12) => {
1135
- return /* @__PURE__ */ jsxRuntime.jsx(index.Box, { marginBottom: 3, children: /* @__PURE__ */ jsxRuntime.jsx(Tree, { onTreeItemClick, objects: tree, initiallyExpanded: index$12 === 0 }) }, `box_tree_${index$12}`);
1157
+ return /* @__PURE__ */ jsxRuntime.jsx(index.Box, { marginBottom: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
1158
+ Tree,
1159
+ {
1160
+ onTreeItemClick,
1161
+ objects: tree,
1162
+ initiallyExpanded: index$12 === 0,
1163
+ disabled: !canUpdateSettings
1164
+ }
1165
+ ) }, `box_tree_${index$12}`);
1136
1166
  }),
1137
1167
  !!formModel.length && /* @__PURE__ */ jsxRuntime.jsxs(index.Box, { children: [
1138
1168
  /* @__PURE__ */ jsxRuntime.jsx(index.Box, { paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(index.Divider, {}) }),
@@ -1157,11 +1187,17 @@ const ContentTransferSetup = () => {
1157
1187
  ] })
1158
1188
  ] });
1159
1189
  };
1160
- const LocalazyContentTransferSetup = () => /* @__PURE__ */ jsxRuntime.jsxs(index.DesignSystemProvider, { theme: FetchIdentity.getDefaultTheme(), children: [
1161
- /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.HeadingFixGlobalStyle, {}),
1162
- /* @__PURE__ */ jsxRuntime.jsxs(FetchIdentity.LocalazyIdentityProvider, { children: [
1163
- /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.FetchIdentity, {}),
1164
- /* @__PURE__ */ jsxRuntime.jsx(RequireLocalazyAuth.RequireLocalazyAuth, { children: /* @__PURE__ */ jsxRuntime.jsx(ContentTransferSetup, {}) })
1165
- ] })
1166
- ] });
1190
+ const LocalazyContentTransferSetup = () => {
1191
+ const {
1192
+ allowedActions: { canRead: canReadSettings },
1193
+ isLoading: isLoadingPermissions
1194
+ } = admin.useRBAC(index$2.PERMISSIONS.SETTINGS_READ);
1195
+ return /* @__PURE__ */ jsxRuntime.jsxs(index.DesignSystemProvider, { theme: FetchIdentity.getDefaultTheme(), children: [
1196
+ /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.HeadingFixGlobalStyle, {}),
1197
+ isLoadingPermissions ? /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}) : !canReadSettings ? /* @__PURE__ */ jsxRuntime.jsx(admin.Page.NoPermissions, {}) : /* @__PURE__ */ jsxRuntime.jsxs(FetchIdentity.LocalazyIdentityProvider, { children: [
1198
+ /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.FetchIdentity, {}),
1199
+ /* @__PURE__ */ jsxRuntime.jsx(RequireLocalazyAuth.RequireLocalazyAuth, { children: /* @__PURE__ */ jsxRuntime.jsx(ContentTransferSetup, {}) })
1200
+ ] })
1201
+ ] });
1202
+ };
1167
1203
  exports.default = LocalazyContentTransferSetup;