@localazy/strapi-plugin 1.4.0 → 1.7.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.
- package/README.md +30 -0
- package/dist/_chunks/{FetchIdentity-BpFOT163.js → FetchIdentity-D89DgpbN.js} +24 -32
- package/dist/_chunks/{FetchIdentity-Cor4ooZv.mjs → FetchIdentity-DkHj24S5.mjs} +36 -44
- package/dist/_chunks/{LanguagesSelector-CC1ecWnc.js → LanguagesSelector-638KGQYw.js} +3 -2
- package/dist/_chunks/{LanguagesSelector-BbrMKwQY.mjs → LanguagesSelector-CR_7I2R1.mjs} +4 -3
- package/dist/_chunks/{LocalazyApp-D0JGRQeF.js → LocalazyApp-Benn8pkA.js} +75 -39
- package/dist/_chunks/{LocalazyApp-DpFR8p10.mjs → LocalazyApp-DM3zg5E4.mjs} +70 -34
- package/dist/_chunks/{LocalazyContentTransferSetup-Dael1Q4w.mjs → LocalazyContentTransferSetup-BA_rtSBM.mjs} +58 -22
- package/dist/_chunks/{LocalazyContentTransferSetup-Cr7D-BUi.js → LocalazyContentTransferSetup-CWchyGdD.js} +62 -26
- package/dist/_chunks/{LocalazyGlobalSettings-D3nG4zl7.js → LocalazyGlobalSettings-88jqQbD4.js} +56 -25
- package/dist/_chunks/{LocalazyGlobalSettings-DzBI5M-K.mjs → LocalazyGlobalSettings-BWF0s9tM.mjs} +56 -25
- package/dist/_chunks/{LocalazyPanel-W6j8N1WC.mjs → LocalazyPanel-4HRa1jNl.mjs} +12 -6
- package/dist/_chunks/{LocalazyPanel-KQPLxTDz.js → LocalazyPanel-D0w9JSIS.js} +14 -8
- package/dist/_chunks/{LocalazyStatusColumn-B7Q_U2Lu.js → LocalazyStatusColumn-BR3f8rKp.js} +10 -4
- package/dist/_chunks/{LocalazyStatusColumn-CrhsCjgp.mjs → LocalazyStatusColumn-D4-rZZUK.mjs} +10 -4
- package/dist/_chunks/{RequireLocalazyAuth-D3GeZPDh.js → RequireLocalazyAuth-C442750b.js} +30 -3
- package/dist/_chunks/{RequireLocalazyAuth-BwoGRfJq.mjs → RequireLocalazyAuth-DbNjEOq-.mjs} +32 -5
- package/dist/_chunks/{entry-exclusion-service-D7gaRHPE.mjs → entry-exclusion-service-Bd3mUDde.mjs} +1 -1
- package/dist/_chunks/{entry-exclusion-service-Bwruvyce.js → entry-exclusion-service-CAIcybXX.js} +1 -1
- package/dist/_chunks/{has-model-changed-Dp2Vkwjw.mjs → has-model-changed-BNs3d9q5.mjs} +4 -3
- package/dist/_chunks/{has-model-changed-5IV9WI_-.js → has-model-changed-BrDeyHFt.js} +4 -3
- package/dist/_chunks/{i18n-o24yXf-j.mjs → i18n-76ox2llT.mjs} +4 -1
- package/dist/_chunks/{i18n-C_5tJvr0.js → i18n-C5ucROBh.js} +4 -1
- package/dist/_chunks/{index-C9hN3KbD.mjs → index-C9Px4v-A.mjs} +34 -12
- package/dist/_chunks/{index-jAg6jjCu.js → index-DwFm1TyM.js} +33 -11
- package/dist/_chunks/{index-BjL9XpRh.mjs → index-shryj0jT.mjs} +16 -16
- package/dist/_chunks/{strapi-api-base-IG3Pe5Sg.js → strapi-api-base-BWZYbxxj.js} +1 -1
- package/dist/_chunks/{strapi-api-base-CAzGcwF6.mjs → strapi-api-base-lPo7wq6I.mjs} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LocalazyStatusColumn.d.ts +1 -1
- package/dist/admin/src/constants/permissions.d.ts +29 -0
- package/dist/admin/src/modules/@common/components/LanguagesSelector.d.ts +1 -0
- package/dist/admin/src/modules/@common/models/supported-content-type-fields.d.ts +1 -1
- package/dist/admin/src/modules/login/locale/en.d.ts +1 -0
- package/dist/admin/src/modules/plugin-settings/components/Tree.d.ts +1 -0
- package/dist/admin/src/modules/plugin-settings/components/TreeItem.d.ts +1 -0
- package/dist/admin/src/modules/plugin-settings/components/WebhookSetup.d.ts +4 -1
- package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +2 -0
- package/dist/admin/src/modules/plugin-settings/services/plugin-settings-service.d.ts +4 -0
- package/dist/server/index.js +422 -213
- package/dist/server/index.mjs +422 -213
- package/dist/server/src/bootstrap.d.ts +1 -1
- package/dist/server/src/constants/permissions.d.ts +38 -0
- package/dist/server/src/controllers/index.d.ts +1 -0
- package/dist/server/src/controllers/plugin-settings-controller.d.ts +1 -0
- package/dist/server/src/core/index.d.ts +3 -1
- package/dist/server/src/index.d.ts +57 -8
- package/dist/server/src/routes/activity-logs-routes.d.ts +20 -3
- package/dist/server/src/routes/debug-bundle-routes.d.ts +6 -1
- package/dist/server/src/routes/entry-exclusion-routes.d.ts +20 -3
- package/dist/server/src/routes/index.d.ts +52 -6
- package/dist/server/src/routes/localazy-auth-routes.d.ts +6 -1
- package/dist/server/src/routes/localazy-project-routes.d.ts +20 -3
- package/dist/server/src/routes/localazy-transfer-routes.d.ts +6 -1
- package/dist/server/src/routes/localazy-user-routes.d.ts +20 -3
- package/dist/server/src/routes/plugin-settings-routes.d.ts +20 -3
- package/dist/server/src/routes/strapi-routes.d.ts +20 -3
- package/dist/server/src/services/index.d.ts +3 -1
- package/dist/server/src/services/localazy-transfer-download-service.d.ts +2 -1
- package/dist/server/src/services/plugin-settings-service.d.ts +4 -0
- package/dist/server/src/utils/blocks-to-translatable.d.ts +34 -0
- package/dist/server/src/utils/model-utils.d.ts +2 -1
- package/package.json +1 -1
package/dist/_chunks/{LocalazyGlobalSettings-D3nG4zl7.js → LocalazyGlobalSettings-88jqQbD4.js}
RENAMED
|
@@ -2,17 +2,18 @@
|
|
|
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 FetchIdentity = require("./FetchIdentity-BpFOT163.js");
|
|
7
5
|
const admin = require("@strapi/strapi/admin");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const FetchIdentity = require("./FetchIdentity-D89DgpbN.js");
|
|
8
|
+
const RequireLocalazyAuth = require("./RequireLocalazyAuth-C442750b.js");
|
|
9
|
+
const LanguagesSelector = require("./LanguagesSelector-638KGQYw.js");
|
|
10
10
|
const useTranslation = require("./useTranslation-BdIl-aLe.js");
|
|
11
|
-
const strapiApiBase = require("./strapi-api-base-
|
|
12
|
-
require("./
|
|
11
|
+
const strapiApiBase = require("./strapi-api-base-BWZYbxxj.js");
|
|
12
|
+
const index$1 = require("./index-DwFm1TyM.js");
|
|
13
|
+
require("./i18n-C5ucROBh.js");
|
|
13
14
|
const WEBHOOK_PATH = "/api/localazy/public/transfer/download";
|
|
14
15
|
const LOCALAZY_DOCS_URL = "https://localazy.com/docs/general/webhooks";
|
|
15
|
-
function WebhookSetup() {
|
|
16
|
+
function WebhookSetup({ disabled = false } = {}) {
|
|
16
17
|
const { t } = useTranslation.useTranslation();
|
|
17
18
|
const [state, setState] = React.useState("loading");
|
|
18
19
|
const [configuredUrl, setConfiguredUrl] = React.useState("");
|
|
@@ -73,7 +74,7 @@ function WebhookSetup() {
|
|
|
73
74
|
/* @__PURE__ */ jsxRuntime.jsx(index.Typography, { textColor: "success600", variant: "omega", fontWeight: "semiBold", children: t("plugin_settings.webhook_setup_already_configured") })
|
|
74
75
|
] }),
|
|
75
76
|
/* @__PURE__ */ jsxRuntime.jsx(index.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { textColor: "neutral500", variant: "pi", children: configuredUrl }) }),
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.Box, { marginTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(index.Button, { variant: "tertiary", onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_reconfigure") }) })
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Box, { marginTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(index.Button, { variant: "tertiary", disabled, onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_reconfigure") }) })
|
|
77
78
|
] }),
|
|
78
79
|
state === "not_configured" && /* @__PURE__ */ jsxRuntime.jsxs(index.Box, { children: [
|
|
79
80
|
/* @__PURE__ */ jsxRuntime.jsxs(index.Flex, { alignItems: "center", gap: 2, marginBottom: 2, children: [
|
|
@@ -82,7 +83,7 @@ function WebhookSetup() {
|
|
|
82
83
|
] }),
|
|
83
84
|
/* @__PURE__ */ jsxRuntime.jsx(index.Typography, { textColor: "neutral600", variant: "pi", children: t("plugin_settings.webhook_setup_description") }),
|
|
84
85
|
/* @__PURE__ */ jsxRuntime.jsxs(index.Flex, { gap: 3, marginTop: 3, alignItems: "center", children: [
|
|
85
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.Button, { onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_button") }),
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Button, { disabled, onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_button") }),
|
|
86
87
|
/* @__PURE__ */ jsxRuntime.jsx(index.Link, { href: LOCALAZY_DOCS_URL, isExternal: true, startIcon: /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$2l, {}), children: t("plugin_settings.webhook_setup_docs_link") })
|
|
87
88
|
] })
|
|
88
89
|
] }),
|
|
@@ -152,6 +153,13 @@ class PluginSettingsService {
|
|
|
152
153
|
}
|
|
153
154
|
const GlobalSettings = () => {
|
|
154
155
|
const { t } = useTranslation.useTranslation();
|
|
156
|
+
const {
|
|
157
|
+
allowedActions: { canUpdate: canUpdateSettings }
|
|
158
|
+
} = admin.useRBAC(index$1.PERMISSIONS.SETTINGS_UPDATE);
|
|
159
|
+
const {
|
|
160
|
+
allowedActions: { canRead: canReadAdminUsers },
|
|
161
|
+
isLoading: isLoadingAdminUsersRBAC
|
|
162
|
+
} = admin.useRBAC([{ action: "admin::users.read", subject: null }]);
|
|
155
163
|
const [projectLanguages, setProjectLanguages] = React.useState([]);
|
|
156
164
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
157
165
|
const [showSavedAlert, setShowSavedAlert] = React.useState(false);
|
|
@@ -175,7 +183,7 @@ const GlobalSettings = () => {
|
|
|
175
183
|
};
|
|
176
184
|
const patchFormModel = (key, value) => {
|
|
177
185
|
const newFormModel = FetchIdentity.cloneDeep(formModel);
|
|
178
|
-
|
|
186
|
+
RequireLocalazyAuth.set(newFormModel, key, value);
|
|
179
187
|
setFormModel(newFormModel);
|
|
180
188
|
setHasUnsavedChanges(!RequireLocalazyAuth.isEqual(originalFormModel, newFormModel));
|
|
181
189
|
};
|
|
@@ -183,12 +191,15 @@ const GlobalSettings = () => {
|
|
|
183
191
|
return `${user.firstname} ${user.lastname || ""}${user.lastname ? " " : ""}(${user.email})`;
|
|
184
192
|
};
|
|
185
193
|
React.useEffect(() => {
|
|
194
|
+
if (isLoadingAdminUsersRBAC) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
186
197
|
async function fetchData() {
|
|
187
198
|
setIsLoading(true);
|
|
188
199
|
const [project, globalSettings, users2] = await Promise.all([
|
|
189
200
|
LanguagesSelector.ProjectService.getConnectedProject(),
|
|
190
201
|
FetchIdentity.PluginSettingsService.getPluginSettings(),
|
|
191
|
-
PluginSettingsService.getAdminPanelUsers()
|
|
202
|
+
canReadAdminUsers ? PluginSettingsService.getAdminPanelUsers().catch(() => []) : Promise.resolve([])
|
|
192
203
|
]);
|
|
193
204
|
const projectLanguagesWithoutDefaultLanguage = project?.languages?.filter((language) => language.id !== project.sourceLanguage) || [];
|
|
194
205
|
setProjectLanguages(projectLanguagesWithoutDefaultLanguage);
|
|
@@ -198,7 +209,7 @@ const GlobalSettings = () => {
|
|
|
198
209
|
setIsLoading(false);
|
|
199
210
|
}
|
|
200
211
|
void fetchData();
|
|
201
|
-
}, []);
|
|
212
|
+
}, [isLoadingAdminUsersRBAC]);
|
|
202
213
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
203
214
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
204
215
|
admin.Layouts.Header,
|
|
@@ -206,12 +217,12 @@ const GlobalSettings = () => {
|
|
|
206
217
|
title: t("plugin_settings.global_settings"),
|
|
207
218
|
subtitle: t("plugin_settings.global_settings_description"),
|
|
208
219
|
primaryAction: /* @__PURE__ */ jsxRuntime.jsxs(index.Flex, { gap: 2, children: [
|
|
209
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.Button, { variant: "secondary", disabled: !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Button, { variant: "secondary", disabled: !canUpdateSettings || !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
|
|
210
221
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
211
222
|
index.Button,
|
|
212
223
|
{
|
|
213
224
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$4z, {}),
|
|
214
|
-
disabled: !hasUnsavedChanges,
|
|
225
|
+
disabled: !canUpdateSettings || !hasUnsavedChanges,
|
|
215
226
|
onClick: () => {
|
|
216
227
|
void saveGlobalSettings(formModel);
|
|
217
228
|
},
|
|
@@ -250,6 +261,7 @@ const GlobalSettings = () => {
|
|
|
250
261
|
{
|
|
251
262
|
offLabel: t("plugin_settings.off"),
|
|
252
263
|
onLabel: t("plugin_settings.on"),
|
|
264
|
+
disabled: !canUpdateSettings,
|
|
253
265
|
checked: typeof formModel?.upload?.allowAutomated === "boolean" ? formModel.upload.allowAutomated : false,
|
|
254
266
|
onChange: (e) => patchFormModel("upload.allowAutomated", e.target.checked)
|
|
255
267
|
}
|
|
@@ -270,7 +282,7 @@ const GlobalSettings = () => {
|
|
|
270
282
|
onClear: () => patchFormModel("upload.automatedTriggers", []),
|
|
271
283
|
value: formModel?.upload?.automatedTriggers || [],
|
|
272
284
|
onChange: (values) => patchFormModel("upload.automatedTriggers", values),
|
|
273
|
-
disabled: typeof formModel?.upload?.allowAutomated === "boolean" ? !formModel.upload.allowAutomated : true,
|
|
285
|
+
disabled: !canUpdateSettings || (typeof formModel?.upload?.allowAutomated === "boolean" ? !formModel.upload.allowAutomated : true),
|
|
274
286
|
multi: true,
|
|
275
287
|
withTags: true,
|
|
276
288
|
children: [
|
|
@@ -291,6 +303,7 @@ const GlobalSettings = () => {
|
|
|
291
303
|
hint: t("plugin_settings.deprecate_source_keys_on_delete_info"),
|
|
292
304
|
offLabel: t("plugin_settings.off"),
|
|
293
305
|
onLabel: t("plugin_settings.on"),
|
|
306
|
+
disabled: !canUpdateSettings,
|
|
294
307
|
checked: typeof formModel?.upload?.allowDeprecate === "boolean" ? formModel.upload.allowDeprecate : false,
|
|
295
308
|
onChange: (e) => patchFormModel("upload.allowDeprecate", e.target.checked)
|
|
296
309
|
}
|
|
@@ -307,7 +320,7 @@ const GlobalSettings = () => {
|
|
|
307
320
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
308
321
|
/* @__PURE__ */ jsxRuntime.jsx(index.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: t("plugin_settings.webhook_setup_title") }),
|
|
309
322
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
310
|
-
/* @__PURE__ */ jsxRuntime.jsx(WebhookSetup, {}),
|
|
323
|
+
/* @__PURE__ */ jsxRuntime.jsx(WebhookSetup, { disabled: !canUpdateSettings }),
|
|
311
324
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
312
325
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
313
326
|
/* @__PURE__ */ jsxRuntime.jsx(index.Divider, {}),
|
|
@@ -324,6 +337,7 @@ const GlobalSettings = () => {
|
|
|
324
337
|
hint: t("plugin_settings.processing_of_download_webhook_info"),
|
|
325
338
|
offLabel: t("plugin_settings.off"),
|
|
326
339
|
onLabel: t("plugin_settings.on"),
|
|
340
|
+
disabled: !canUpdateSettings,
|
|
327
341
|
checked: typeof formModel?.download?.processDownloadWebhook === "boolean" ? formModel.download.processDownloadWebhook : true,
|
|
328
342
|
onChange: (e) => patchFormModel("download.processDownloadWebhook", e.target.checked)
|
|
329
343
|
}
|
|
@@ -343,11 +357,20 @@ const GlobalSettings = () => {
|
|
|
343
357
|
onClear: () => patchFormModel("download.webhookAuthorId", null),
|
|
344
358
|
value: formModel?.download?.webhookAuthorId || null,
|
|
345
359
|
onChange: (value) => patchFormModel("download.webhookAuthorId", value),
|
|
346
|
-
|
|
360
|
+
disabled: !canUpdateSettings || !canReadAdminUsers,
|
|
361
|
+
children: (() => {
|
|
362
|
+
const savedAuthorId = formModel?.download?.webhookAuthorId;
|
|
363
|
+
const needsFallback = savedAuthorId != null && !users.some((user) => String(user.id) === String(savedAuthorId));
|
|
364
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
365
|
+
needsFallback && /* @__PURE__ */ jsxRuntime.jsx(index.SingleSelectOption, { value: savedAuthorId, children: t("plugin_settings.webhook_author_unknown_user", { id: savedAuthorId }) }, `fallback-${savedAuthorId}`),
|
|
366
|
+
users.map((user) => /* @__PURE__ */ jsxRuntime.jsx(index.SingleSelectOption, { value: user.id, children: getUserLabel(user) }, user.id))
|
|
367
|
+
] });
|
|
368
|
+
})()
|
|
347
369
|
}
|
|
348
370
|
),
|
|
349
371
|
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Hint, {})
|
|
350
372
|
] }),
|
|
373
|
+
!canReadAdminUsers && /* @__PURE__ */ jsxRuntime.jsx(index.Box, { paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { variant: "pi", textColor: "warning600", children: t("plugin_settings.webhook_author_permission_required") }) }),
|
|
351
374
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
352
375
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
353
376
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -358,7 +381,8 @@ const GlobalSettings = () => {
|
|
|
358
381
|
onChange: (languages) => patchFormModel("download.webhookLanguages", languages),
|
|
359
382
|
label: t("plugin_settings.webhook_languages"),
|
|
360
383
|
hint: t("plugin_settings.webhook_languages_info"),
|
|
361
|
-
placeholder: t("plugin_settings.webhook_languages_placeholder")
|
|
384
|
+
placeholder: t("plugin_settings.webhook_languages_placeholder"),
|
|
385
|
+
disabled: !canUpdateSettings
|
|
362
386
|
}
|
|
363
387
|
),
|
|
364
388
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
@@ -370,6 +394,7 @@ const GlobalSettings = () => {
|
|
|
370
394
|
{
|
|
371
395
|
offLabel: t("plugin_settings.off"),
|
|
372
396
|
onLabel: t("plugin_settings.on"),
|
|
397
|
+
disabled: !canUpdateSettings,
|
|
373
398
|
checked: typeof formModel?.download?.webhookIncrementalSync === "boolean" ? formModel.download.webhookIncrementalSync : true,
|
|
374
399
|
onChange: (e) => patchFormModel("download.webhookIncrementalSync", e.target.checked)
|
|
375
400
|
}
|
|
@@ -382,11 +407,17 @@ const GlobalSettings = () => {
|
|
|
382
407
|
] })
|
|
383
408
|
] });
|
|
384
409
|
};
|
|
385
|
-
const LocalazyGlobalSettings = () =>
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
410
|
+
const LocalazyGlobalSettings = () => {
|
|
411
|
+
const {
|
|
412
|
+
allowedActions: { canRead: canReadSettings },
|
|
413
|
+
isLoading: isLoadingPermissions
|
|
414
|
+
} = admin.useRBAC(index$1.PERMISSIONS.SETTINGS_READ);
|
|
415
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(index.DesignSystemProvider, { theme: FetchIdentity.getDefaultTheme(), children: [
|
|
416
|
+
/* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.HeadingFixGlobalStyle, {}),
|
|
417
|
+
isLoadingPermissions ? /* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.PluginPageLoader, {}) : !canReadSettings ? /* @__PURE__ */ jsxRuntime.jsx(admin.Page.NoPermissions, {}) : /* @__PURE__ */ jsxRuntime.jsxs(FetchIdentity.LocalazyIdentityProvider, { children: [
|
|
418
|
+
/* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.FetchIdentity, {}),
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsx(RequireLocalazyAuth.RequireLocalazyAuth, { children: /* @__PURE__ */ jsxRuntime.jsx(GlobalSettings, {}) })
|
|
420
|
+
] })
|
|
421
|
+
] });
|
|
422
|
+
};
|
|
392
423
|
exports.default = LocalazyGlobalSettings;
|
package/dist/_chunks/{LocalazyGlobalSettings-DzBI5M-K.mjs → LocalazyGlobalSettings-BWF0s9tM.mjs}
RENAMED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { c as Flex, L as Loader, T as Typography, B as Box, A as Alert, d as ForwardRef$4z, e as Button, f as ForwardRef$3, g as Link, h as ForwardRef$2l, D as Dialog, F as Field, i as ForwardRef$2x, a as Toggle, M as MultiSelect, b as MultiSelectOption, j as Divider, S as SingleSelect, k as SingleSelectOption, l as DesignSystemProvider } from "./index-
|
|
2
|
+
import { c as Flex, L as Loader, T as Typography, B as Box, A as Alert, d as ForwardRef$4z, e as Button, f as ForwardRef$3, g as Link, h as ForwardRef$2l, D as Dialog, F as Field, i as ForwardRef$2x, a as Toggle, M as MultiSelect, b as MultiSelectOption, j as Divider, S as SingleSelect, k as SingleSelectOption, l as DesignSystemProvider } from "./index-shryj0jT.mjs";
|
|
3
|
+
import { useRBAC, Layouts, Page } from "@strapi/strapi/admin";
|
|
3
4
|
import { useState, useEffect } from "react";
|
|
4
|
-
import { P as PluginSettingsService$1, c as cloneDeep,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { P as ProjectService, L as LanguagesSelector } from "./LanguagesSelector-BbrMKwQY.mjs";
|
|
5
|
+
import { P as PluginSettingsService$1, c as cloneDeep, g as getDefaultTheme, H as HeadingFixGlobalStyle, a as PluginPageLoader, L as LocalazyIdentityProvider, F as FetchIdentity } from "./FetchIdentity-DkHj24S5.mjs";
|
|
6
|
+
import { s as set, i as isEqual, R as RequireLocalazyAuth } from "./RequireLocalazyAuth-DbNjEOq-.mjs";
|
|
7
|
+
import { P as ProjectService, L as LanguagesSelector } from "./LanguagesSelector-CR_7I2R1.mjs";
|
|
8
8
|
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
9
|
-
import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-
|
|
10
|
-
import "./
|
|
9
|
+
import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-lPo7wq6I.mjs";
|
|
10
|
+
import { P as PERMISSIONS } from "./index-C9Px4v-A.mjs";
|
|
11
|
+
import "./i18n-76ox2llT.mjs";
|
|
11
12
|
const WEBHOOK_PATH = "/api/localazy/public/transfer/download";
|
|
12
13
|
const LOCALAZY_DOCS_URL = "https://localazy.com/docs/general/webhooks";
|
|
13
|
-
function WebhookSetup() {
|
|
14
|
+
function WebhookSetup({ disabled = false } = {}) {
|
|
14
15
|
const { t } = useTranslation();
|
|
15
16
|
const [state, setState] = useState("loading");
|
|
16
17
|
const [configuredUrl, setConfiguredUrl] = useState("");
|
|
@@ -71,7 +72,7 @@ function WebhookSetup() {
|
|
|
71
72
|
/* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "semiBold", children: t("plugin_settings.webhook_setup_already_configured") })
|
|
72
73
|
] }),
|
|
73
74
|
/* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", variant: "pi", children: configuredUrl }) }),
|
|
74
|
-
/* @__PURE__ */ jsx(Box, { marginTop: 3, children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_reconfigure") }) })
|
|
75
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 3, children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", disabled, onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_reconfigure") }) })
|
|
75
76
|
] }),
|
|
76
77
|
state === "not_configured" && /* @__PURE__ */ jsxs(Box, { children: [
|
|
77
78
|
/* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, marginBottom: 2, children: [
|
|
@@ -80,7 +81,7 @@ function WebhookSetup() {
|
|
|
80
81
|
] }),
|
|
81
82
|
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "pi", children: t("plugin_settings.webhook_setup_description") }),
|
|
82
83
|
/* @__PURE__ */ jsxs(Flex, { gap: 3, marginTop: 3, alignItems: "center", children: [
|
|
83
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_button") }),
|
|
84
|
+
/* @__PURE__ */ jsx(Button, { disabled, onClick: () => setShowModal(true), children: t("plugin_settings.webhook_setup_button") }),
|
|
84
85
|
/* @__PURE__ */ jsx(Link, { href: LOCALAZY_DOCS_URL, isExternal: true, startIcon: /* @__PURE__ */ jsx(ForwardRef$2l, {}), children: t("plugin_settings.webhook_setup_docs_link") })
|
|
85
86
|
] })
|
|
86
87
|
] }),
|
|
@@ -150,6 +151,13 @@ class PluginSettingsService {
|
|
|
150
151
|
}
|
|
151
152
|
const GlobalSettings = () => {
|
|
152
153
|
const { t } = useTranslation();
|
|
154
|
+
const {
|
|
155
|
+
allowedActions: { canUpdate: canUpdateSettings }
|
|
156
|
+
} = useRBAC(PERMISSIONS.SETTINGS_UPDATE);
|
|
157
|
+
const {
|
|
158
|
+
allowedActions: { canRead: canReadAdminUsers },
|
|
159
|
+
isLoading: isLoadingAdminUsersRBAC
|
|
160
|
+
} = useRBAC([{ action: "admin::users.read", subject: null }]);
|
|
153
161
|
const [projectLanguages, setProjectLanguages] = useState([]);
|
|
154
162
|
const [isLoading, setIsLoading] = useState(true);
|
|
155
163
|
const [showSavedAlert, setShowSavedAlert] = useState(false);
|
|
@@ -181,12 +189,15 @@ const GlobalSettings = () => {
|
|
|
181
189
|
return `${user.firstname} ${user.lastname || ""}${user.lastname ? " " : ""}(${user.email})`;
|
|
182
190
|
};
|
|
183
191
|
useEffect(() => {
|
|
192
|
+
if (isLoadingAdminUsersRBAC) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
184
195
|
async function fetchData() {
|
|
185
196
|
setIsLoading(true);
|
|
186
197
|
const [project, globalSettings, users2] = await Promise.all([
|
|
187
198
|
ProjectService.getConnectedProject(),
|
|
188
199
|
PluginSettingsService$1.getPluginSettings(),
|
|
189
|
-
PluginSettingsService.getAdminPanelUsers()
|
|
200
|
+
canReadAdminUsers ? PluginSettingsService.getAdminPanelUsers().catch(() => []) : Promise.resolve([])
|
|
190
201
|
]);
|
|
191
202
|
const projectLanguagesWithoutDefaultLanguage = project?.languages?.filter((language) => language.id !== project.sourceLanguage) || [];
|
|
192
203
|
setProjectLanguages(projectLanguagesWithoutDefaultLanguage);
|
|
@@ -196,7 +207,7 @@ const GlobalSettings = () => {
|
|
|
196
207
|
setIsLoading(false);
|
|
197
208
|
}
|
|
198
209
|
void fetchData();
|
|
199
|
-
}, []);
|
|
210
|
+
}, [isLoadingAdminUsersRBAC]);
|
|
200
211
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
201
212
|
/* @__PURE__ */ jsx(
|
|
202
213
|
Layouts.Header,
|
|
@@ -204,12 +215,12 @@ const GlobalSettings = () => {
|
|
|
204
215
|
title: t("plugin_settings.global_settings"),
|
|
205
216
|
subtitle: t("plugin_settings.global_settings_description"),
|
|
206
217
|
primaryAction: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
207
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
|
|
218
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !canUpdateSettings || !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
|
|
208
219
|
/* @__PURE__ */ jsx(
|
|
209
220
|
Button,
|
|
210
221
|
{
|
|
211
222
|
startIcon: /* @__PURE__ */ jsx(ForwardRef$4z, {}),
|
|
212
|
-
disabled: !hasUnsavedChanges,
|
|
223
|
+
disabled: !canUpdateSettings || !hasUnsavedChanges,
|
|
213
224
|
onClick: () => {
|
|
214
225
|
void saveGlobalSettings(formModel);
|
|
215
226
|
},
|
|
@@ -248,6 +259,7 @@ const GlobalSettings = () => {
|
|
|
248
259
|
{
|
|
249
260
|
offLabel: t("plugin_settings.off"),
|
|
250
261
|
onLabel: t("plugin_settings.on"),
|
|
262
|
+
disabled: !canUpdateSettings,
|
|
251
263
|
checked: typeof formModel?.upload?.allowAutomated === "boolean" ? formModel.upload.allowAutomated : false,
|
|
252
264
|
onChange: (e) => patchFormModel("upload.allowAutomated", e.target.checked)
|
|
253
265
|
}
|
|
@@ -268,7 +280,7 @@ const GlobalSettings = () => {
|
|
|
268
280
|
onClear: () => patchFormModel("upload.automatedTriggers", []),
|
|
269
281
|
value: formModel?.upload?.automatedTriggers || [],
|
|
270
282
|
onChange: (values) => patchFormModel("upload.automatedTriggers", values),
|
|
271
|
-
disabled: typeof formModel?.upload?.allowAutomated === "boolean" ? !formModel.upload.allowAutomated : true,
|
|
283
|
+
disabled: !canUpdateSettings || (typeof formModel?.upload?.allowAutomated === "boolean" ? !formModel.upload.allowAutomated : true),
|
|
272
284
|
multi: true,
|
|
273
285
|
withTags: true,
|
|
274
286
|
children: [
|
|
@@ -289,6 +301,7 @@ const GlobalSettings = () => {
|
|
|
289
301
|
hint: t("plugin_settings.deprecate_source_keys_on_delete_info"),
|
|
290
302
|
offLabel: t("plugin_settings.off"),
|
|
291
303
|
onLabel: t("plugin_settings.on"),
|
|
304
|
+
disabled: !canUpdateSettings,
|
|
292
305
|
checked: typeof formModel?.upload?.allowDeprecate === "boolean" ? formModel.upload.allowDeprecate : false,
|
|
293
306
|
onChange: (e) => patchFormModel("upload.allowDeprecate", e.target.checked)
|
|
294
307
|
}
|
|
@@ -305,7 +318,7 @@ const GlobalSettings = () => {
|
|
|
305
318
|
/* @__PURE__ */ jsx("br", {}),
|
|
306
319
|
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: t("plugin_settings.webhook_setup_title") }),
|
|
307
320
|
/* @__PURE__ */ jsx("br", {}),
|
|
308
|
-
/* @__PURE__ */ jsx(WebhookSetup, {}),
|
|
321
|
+
/* @__PURE__ */ jsx(WebhookSetup, { disabled: !canUpdateSettings }),
|
|
309
322
|
/* @__PURE__ */ jsx("br", {}),
|
|
310
323
|
/* @__PURE__ */ jsx("br", {}),
|
|
311
324
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
@@ -322,6 +335,7 @@ const GlobalSettings = () => {
|
|
|
322
335
|
hint: t("plugin_settings.processing_of_download_webhook_info"),
|
|
323
336
|
offLabel: t("plugin_settings.off"),
|
|
324
337
|
onLabel: t("plugin_settings.on"),
|
|
338
|
+
disabled: !canUpdateSettings,
|
|
325
339
|
checked: typeof formModel?.download?.processDownloadWebhook === "boolean" ? formModel.download.processDownloadWebhook : true,
|
|
326
340
|
onChange: (e) => patchFormModel("download.processDownloadWebhook", e.target.checked)
|
|
327
341
|
}
|
|
@@ -341,11 +355,20 @@ const GlobalSettings = () => {
|
|
|
341
355
|
onClear: () => patchFormModel("download.webhookAuthorId", null),
|
|
342
356
|
value: formModel?.download?.webhookAuthorId || null,
|
|
343
357
|
onChange: (value) => patchFormModel("download.webhookAuthorId", value),
|
|
344
|
-
|
|
358
|
+
disabled: !canUpdateSettings || !canReadAdminUsers,
|
|
359
|
+
children: (() => {
|
|
360
|
+
const savedAuthorId = formModel?.download?.webhookAuthorId;
|
|
361
|
+
const needsFallback = savedAuthorId != null && !users.some((user) => String(user.id) === String(savedAuthorId));
|
|
362
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
363
|
+
needsFallback && /* @__PURE__ */ jsx(SingleSelectOption, { value: savedAuthorId, children: t("plugin_settings.webhook_author_unknown_user", { id: savedAuthorId }) }, `fallback-${savedAuthorId}`),
|
|
364
|
+
users.map((user) => /* @__PURE__ */ jsx(SingleSelectOption, { value: user.id, children: getUserLabel(user) }, user.id))
|
|
365
|
+
] });
|
|
366
|
+
})()
|
|
345
367
|
}
|
|
346
368
|
),
|
|
347
369
|
/* @__PURE__ */ jsx(Field.Hint, {})
|
|
348
370
|
] }),
|
|
371
|
+
!canReadAdminUsers && /* @__PURE__ */ jsx(Box, { paddingTop: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "warning600", children: t("plugin_settings.webhook_author_permission_required") }) }),
|
|
349
372
|
/* @__PURE__ */ jsx("br", {}),
|
|
350
373
|
/* @__PURE__ */ jsx("br", {}),
|
|
351
374
|
/* @__PURE__ */ jsx(
|
|
@@ -356,7 +379,8 @@ const GlobalSettings = () => {
|
|
|
356
379
|
onChange: (languages) => patchFormModel("download.webhookLanguages", languages),
|
|
357
380
|
label: t("plugin_settings.webhook_languages"),
|
|
358
381
|
hint: t("plugin_settings.webhook_languages_info"),
|
|
359
|
-
placeholder: t("plugin_settings.webhook_languages_placeholder")
|
|
382
|
+
placeholder: t("plugin_settings.webhook_languages_placeholder"),
|
|
383
|
+
disabled: !canUpdateSettings
|
|
360
384
|
}
|
|
361
385
|
),
|
|
362
386
|
/* @__PURE__ */ jsx("br", {}),
|
|
@@ -368,6 +392,7 @@ const GlobalSettings = () => {
|
|
|
368
392
|
{
|
|
369
393
|
offLabel: t("plugin_settings.off"),
|
|
370
394
|
onLabel: t("plugin_settings.on"),
|
|
395
|
+
disabled: !canUpdateSettings,
|
|
371
396
|
checked: typeof formModel?.download?.webhookIncrementalSync === "boolean" ? formModel.download.webhookIncrementalSync : true,
|
|
372
397
|
onChange: (e) => patchFormModel("download.webhookIncrementalSync", e.target.checked)
|
|
373
398
|
}
|
|
@@ -380,13 +405,19 @@ const GlobalSettings = () => {
|
|
|
380
405
|
] })
|
|
381
406
|
] });
|
|
382
407
|
};
|
|
383
|
-
const LocalazyGlobalSettings = () =>
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
408
|
+
const LocalazyGlobalSettings = () => {
|
|
409
|
+
const {
|
|
410
|
+
allowedActions: { canRead: canReadSettings },
|
|
411
|
+
isLoading: isLoadingPermissions
|
|
412
|
+
} = useRBAC(PERMISSIONS.SETTINGS_READ);
|
|
413
|
+
return /* @__PURE__ */ jsxs(DesignSystemProvider, { theme: getDefaultTheme(), children: [
|
|
414
|
+
/* @__PURE__ */ jsx(HeadingFixGlobalStyle, {}),
|
|
415
|
+
isLoadingPermissions ? /* @__PURE__ */ jsx(PluginPageLoader, {}) : !canReadSettings ? /* @__PURE__ */ jsx(Page.NoPermissions, {}) : /* @__PURE__ */ jsxs(LocalazyIdentityProvider, { children: [
|
|
416
|
+
/* @__PURE__ */ jsx(FetchIdentity, {}),
|
|
417
|
+
/* @__PURE__ */ jsx(RequireLocalazyAuth, { children: /* @__PURE__ */ jsx(GlobalSettings, {}) })
|
|
418
|
+
] })
|
|
419
|
+
] });
|
|
420
|
+
};
|
|
390
421
|
export {
|
|
391
422
|
LocalazyGlobalSettings as default
|
|
392
423
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { useLocation } from "react-router-dom";
|
|
4
|
-
import { T as Typography, a as Toggle } from "./index-
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
4
|
+
import { T as Typography, a as Toggle } from "./index-shryj0jT.mjs";
|
|
5
|
+
import { useRBAC } from "@strapi/strapi/admin";
|
|
6
|
+
import EntryExclusionService from "./entry-exclusion-service-Bd3mUDde.mjs";
|
|
7
|
+
import { P as PERMISSIONS } from "./index-C9Px4v-A.mjs";
|
|
8
|
+
import "./i18n-76ox2llT.mjs";
|
|
7
9
|
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
8
10
|
const LocalazyPanel = () => {
|
|
9
11
|
const { t } = useTranslation();
|
|
12
|
+
const { allowedActions } = useRBAC([...PERMISSIONS.READ, ...PERMISSIONS.TRANSFER]);
|
|
10
13
|
const location = useLocation();
|
|
11
14
|
const [isExcluded, setIsExcluded] = useState(false);
|
|
12
15
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -29,7 +32,7 @@ const LocalazyPanel = () => {
|
|
|
29
32
|
}, [location.pathname]);
|
|
30
33
|
useEffect(() => {
|
|
31
34
|
const loadExclusionState = async () => {
|
|
32
|
-
if (!contentType || !documentId) {
|
|
35
|
+
if (!contentType || !documentId || !allowedActions.canRead) {
|
|
33
36
|
setIsLoading(false);
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
@@ -45,7 +48,10 @@ const LocalazyPanel = () => {
|
|
|
45
48
|
}
|
|
46
49
|
};
|
|
47
50
|
void loadExclusionState();
|
|
48
|
-
}, [contentType, documentId]);
|
|
51
|
+
}, [contentType, documentId, allowedActions.canRead]);
|
|
52
|
+
if (!allowedActions.canRead) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
49
55
|
const handleToggleChange = async (event) => {
|
|
50
56
|
const { checked } = event.target;
|
|
51
57
|
const value = checked;
|
|
@@ -71,7 +77,7 @@ const LocalazyPanel = () => {
|
|
|
71
77
|
checked: isExcluded,
|
|
72
78
|
onLabel: "True",
|
|
73
79
|
offLabel: "False",
|
|
74
|
-
disabled: isLoading || !contentType || !documentId,
|
|
80
|
+
disabled: isLoading || !contentType || !documentId || !allowedActions.canTransfer,
|
|
75
81
|
onChange: handleToggleChange
|
|
76
82
|
}
|
|
77
83
|
)
|
|
@@ -3,12 +3,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-CTkxoioB.js");
|
|
7
|
-
const
|
|
8
|
-
require("./
|
|
6
|
+
const index$1 = require("./index-CTkxoioB.js");
|
|
7
|
+
const admin = require("@strapi/strapi/admin");
|
|
8
|
+
const entryExclusionService = require("./entry-exclusion-service-CAIcybXX.js");
|
|
9
|
+
const index = require("./index-DwFm1TyM.js");
|
|
10
|
+
require("./i18n-C5ucROBh.js");
|
|
9
11
|
const useTranslation = require("./useTranslation-BdIl-aLe.js");
|
|
10
12
|
const LocalazyPanel = () => {
|
|
11
13
|
const { t } = useTranslation.useTranslation();
|
|
14
|
+
const { allowedActions } = admin.useRBAC([...index.PERMISSIONS.READ, ...index.PERMISSIONS.TRANSFER]);
|
|
12
15
|
const location = reactRouterDom.useLocation();
|
|
13
16
|
const [isExcluded, setIsExcluded] = React.useState(false);
|
|
14
17
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
@@ -31,7 +34,7 @@ const LocalazyPanel = () => {
|
|
|
31
34
|
}, [location.pathname]);
|
|
32
35
|
React.useEffect(() => {
|
|
33
36
|
const loadExclusionState = async () => {
|
|
34
|
-
if (!contentType || !documentId) {
|
|
37
|
+
if (!contentType || !documentId || !allowedActions.canRead) {
|
|
35
38
|
setIsLoading(false);
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
@@ -47,7 +50,10 @@ const LocalazyPanel = () => {
|
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
52
|
void loadExclusionState();
|
|
50
|
-
}, [contentType, documentId]);
|
|
53
|
+
}, [contentType, documentId, allowedActions.canRead]);
|
|
54
|
+
if (!allowedActions.canRead) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
51
57
|
const handleToggleChange = async (event) => {
|
|
52
58
|
const { checked } = event.target;
|
|
53
59
|
const value = checked;
|
|
@@ -66,14 +72,14 @@ const LocalazyPanel = () => {
|
|
|
66
72
|
return {
|
|
67
73
|
title: "Localazy",
|
|
68
74
|
content: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
69
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { children: t("plugin_settings.exclude_from_translation") }) }),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Typography, { children: t("plugin_settings.exclude_from_translation") }) }),
|
|
70
76
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
-
index.Toggle,
|
|
77
|
+
index$1.Toggle,
|
|
72
78
|
{
|
|
73
79
|
checked: isExcluded,
|
|
74
80
|
onLabel: "True",
|
|
75
81
|
offLabel: "False",
|
|
76
|
-
disabled: isLoading || !contentType || !documentId,
|
|
82
|
+
disabled: isLoading || !contentType || !documentId || !allowedActions.canTransfer,
|
|
77
83
|
onChange: handleToggleChange
|
|
78
84
|
}
|
|
79
85
|
)
|
|
@@ -3,17 +3,20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const styled = require("styled-components");
|
|
6
|
-
const
|
|
7
|
-
require("./
|
|
6
|
+
const admin = require("@strapi/strapi/admin");
|
|
7
|
+
const entryExclusionService = require("./entry-exclusion-service-CAIcybXX.js");
|
|
8
|
+
const index = require("./index-DwFm1TyM.js");
|
|
9
|
+
require("./i18n-C5ucROBh.js");
|
|
8
10
|
const useTranslation = require("./useTranslation-BdIl-aLe.js");
|
|
9
11
|
const LocalazyStatusColumn = ({ data, model }) => {
|
|
10
12
|
const { t } = useTranslation.useTranslation();
|
|
11
13
|
const theme = styled.useTheme();
|
|
14
|
+
const { allowedActions } = admin.useRBAC(index.PERMISSIONS.READ);
|
|
12
15
|
const [isExcluded, setIsExcluded] = React.useState(null);
|
|
13
16
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
14
17
|
React.useEffect(() => {
|
|
15
18
|
const checkStatus = async () => {
|
|
16
|
-
if (!data?.documentId || !model) {
|
|
19
|
+
if (!data?.documentId || !model || !allowedActions.canRead) {
|
|
17
20
|
setIsLoading(false);
|
|
18
21
|
return;
|
|
19
22
|
}
|
|
@@ -28,7 +31,10 @@ const LocalazyStatusColumn = ({ data, model }) => {
|
|
|
28
31
|
}
|
|
29
32
|
};
|
|
30
33
|
void checkStatus();
|
|
31
|
-
}, [data?.documentId, model]);
|
|
34
|
+
}, [data?.documentId, model, allowedActions.canRead]);
|
|
35
|
+
if (!allowedActions.canRead) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
32
38
|
if (isLoading) {
|
|
33
39
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: theme.colors.neutral600, fontSize: "12px" }, children: "..." });
|
|
34
40
|
}
|
package/dist/_chunks/{LocalazyStatusColumn-CrhsCjgp.mjs → LocalazyStatusColumn-D4-rZZUK.mjs}
RENAMED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { useTheme } from "styled-components";
|
|
4
|
-
import
|
|
5
|
-
import "./
|
|
4
|
+
import { useRBAC } from "@strapi/strapi/admin";
|
|
5
|
+
import EntryExclusionService from "./entry-exclusion-service-Bd3mUDde.mjs";
|
|
6
|
+
import { P as PERMISSIONS } from "./index-C9Px4v-A.mjs";
|
|
7
|
+
import "./i18n-76ox2llT.mjs";
|
|
6
8
|
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
7
9
|
const LocalazyStatusColumn = ({ data, model }) => {
|
|
8
10
|
const { t } = useTranslation();
|
|
9
11
|
const theme = useTheme();
|
|
12
|
+
const { allowedActions } = useRBAC(PERMISSIONS.READ);
|
|
10
13
|
const [isExcluded, setIsExcluded] = useState(null);
|
|
11
14
|
const [isLoading, setIsLoading] = useState(true);
|
|
12
15
|
useEffect(() => {
|
|
13
16
|
const checkStatus = async () => {
|
|
14
|
-
if (!data?.documentId || !model) {
|
|
17
|
+
if (!data?.documentId || !model || !allowedActions.canRead) {
|
|
15
18
|
setIsLoading(false);
|
|
16
19
|
return;
|
|
17
20
|
}
|
|
@@ -26,7 +29,10 @@ const LocalazyStatusColumn = ({ data, model }) => {
|
|
|
26
29
|
}
|
|
27
30
|
};
|
|
28
31
|
void checkStatus();
|
|
29
|
-
}, [data?.documentId, model]);
|
|
32
|
+
}, [data?.documentId, model, allowedActions.canRead]);
|
|
33
|
+
if (!allowedActions.canRead) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
30
36
|
if (isLoading) {
|
|
31
37
|
return /* @__PURE__ */ jsx("span", { style: { color: theme.colors.neutral600, fontSize: "12px" }, children: "..." });
|
|
32
38
|
}
|