@localazy/strapi-plugin 1.3.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.
- package/README.md +30 -0
- package/dist/_chunks/{FetchIdentity-BJGoZPpM.mjs → FetchIdentity-Bm7bc5bS.mjs} +36 -44
- package/dist/_chunks/{FetchIdentity-CtBRO-Cn.js → FetchIdentity-CcEjakiz.js} +25 -33
- package/dist/_chunks/{LanguagesSelector-DJxgCwgM.mjs → LanguagesSelector-B1rwN7-Y.mjs} +4 -3
- package/dist/_chunks/{LanguagesSelector-CNaKrS-m.js → LanguagesSelector-DejYCwBl.js} +4 -3
- package/dist/_chunks/{LocalazyApp-CJRpsTKr.mjs → LocalazyApp-C4kbsnQh.mjs} +148 -35
- package/dist/_chunks/{LocalazyApp-B1qCCEPe.js → LocalazyApp-jPO7Yr1S.js} +154 -41
- package/dist/_chunks/{LocalazyContentTransferSetup-CLAWn95U.mjs → LocalazyContentTransferSetup-C1wDD9hA.mjs} +58 -22
- package/dist/_chunks/{LocalazyContentTransferSetup-CCxiLHdG.js → LocalazyContentTransferSetup-DZh4ZdSi.js} +63 -27
- package/dist/_chunks/{LocalazyGlobalSettings-BJ5qfFfK.js → LocalazyGlobalSettings-D76it6rn.js} +57 -26
- package/dist/_chunks/{LocalazyGlobalSettings-Z-4Ykc_J.mjs → LocalazyGlobalSettings-DOW5rjLn.mjs} +56 -25
- package/dist/_chunks/{LocalazyPanel-CL_mzzfD.mjs → LocalazyPanel-C_Z4W49T.mjs} +12 -6
- package/dist/_chunks/{LocalazyPanel-DE3TtHOQ.js → LocalazyPanel-D2LQpqii.js} +14 -8
- package/dist/_chunks/{LocalazyStatusColumn-R5n6q_cx.mjs → LocalazyStatusColumn-C_ZCd_s7.mjs} +10 -4
- package/dist/_chunks/{LocalazyStatusColumn-BMLcklG-.js → LocalazyStatusColumn-Dy6N4_X6.js} +10 -4
- package/dist/_chunks/{RequireLocalazyAuth-WKKFdQlR.js → RequireLocalazyAuth-BVwF0bRC.js} +31 -4
- package/dist/_chunks/{RequireLocalazyAuth-Dzsu6UNS.mjs → RequireLocalazyAuth-DNhTZZ_6.mjs} +32 -5
- package/dist/_chunks/{entry-exclusion-service-DxqTlZFR.mjs → entry-exclusion-service-CF_yNCly.mjs} +1 -1
- package/dist/_chunks/{entry-exclusion-service-CggmAKxq.js → entry-exclusion-service-CH3ZoJQN.js} +1 -1
- package/dist/_chunks/{has-model-changed-FMGVcFHU.mjs → has-model-changed-CVJEuGxM.mjs} +2 -2
- package/dist/_chunks/{has-model-changed-BR53L6pA.js → has-model-changed-DdYbyv0v.js} +2 -2
- package/dist/_chunks/{i18n-QelOdIB2.mjs → i18n-76ox2llT.mjs} +9 -2
- package/dist/_chunks/{i18n-CAsbU4pi.js → i18n-C5ucROBh.js} +9 -2
- package/dist/_chunks/{index-BmxGKspv.js → index-CEGaWWh3.js} +33 -11
- package/dist/_chunks/{index-BK7lmZSN.js → index-CTkxoioB.js} +1 -0
- package/dist/_chunks/{index-toauQlIK.mjs → index-DP2ugzc_.mjs} +34 -12
- package/dist/_chunks/{index-CHjIMO9T.mjs → index-shryj0jT.mjs} +19 -18
- package/dist/_chunks/{strapi-api-base-CT9lknwW.js → strapi-api-base-CCUuu7EY.js} +1 -1
- package/dist/_chunks/{strapi-api-base-BflplVsH.mjs → strapi-api-base-IiMEtDoH.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/activity-logs/locale/en.d.ts +4 -0
- package/dist/admin/src/modules/activity-logs/services/debug-bundle-service.d.ts +10 -0
- 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 +665 -38
- package/dist/server/index.mjs +665 -39
- package/dist/server/src/bootstrap.d.ts +1 -1
- package/dist/server/src/constants/permissions.d.ts +38 -0
- package/dist/server/src/controllers/debug-bundle-controller.d.ts +7 -0
- package/dist/server/src/controllers/index.d.ts +6 -0
- package/dist/server/src/controllers/plugin-settings-controller.d.ts +1 -0
- package/dist/server/src/core/index.d.ts +5 -1
- package/dist/server/src/db/model/activity-logs.d.ts +10 -0
- package/dist/server/src/index.d.ts +64 -8
- package/dist/server/src/routes/activity-logs-routes.d.ts +20 -3
- package/dist/server/src/routes/debug-bundle-routes.d.ts +14 -0
- 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/activity-logs-service.d.ts +3 -1
- package/dist/server/src/services/index.d.ts +5 -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/build-debug-bundle.d.ts +68 -0
- package/dist/server/src/utils/sanitize-debug-bundle.d.ts +25 -0
- package/package.json +2 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const index = require("./index-
|
|
5
|
-
const React = require("react");
|
|
6
|
-
const RequireLocalazyAuth = require("./RequireLocalazyAuth-WKKFdQlR.js");
|
|
7
|
-
const FetchIdentity = require("./FetchIdentity-CtBRO-Cn.js");
|
|
4
|
+
const index = require("./index-CTkxoioB.js");
|
|
8
5
|
const admin = require("@strapi/strapi/admin");
|
|
9
|
-
const
|
|
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("./
|
|
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
|
-
|
|
46
|
+
RequireLocalazyAuth.set(destinationObject, key, null);
|
|
46
47
|
} else if (localizableTreeValueToSet !== null) {
|
|
47
|
-
|
|
48
|
+
RequireLocalazyAuth.set(destinationObject, key, localizableTreeValueToSet);
|
|
48
49
|
} else {
|
|
49
50
|
const newValueToSet = hasModelChanged.findModelValueByKey(allModelsTree, key);
|
|
50
|
-
|
|
51
|
+
RequireLocalazyAuth.set(destinationObject, key, newValueToSet);
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
54
|
newKeys.forEach((key) => {
|
|
54
|
-
|
|
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 = ({
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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 = () =>
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
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;
|
package/dist/_chunks/{LocalazyGlobalSettings-BJ5qfFfK.js → LocalazyGlobalSettings-D76it6rn.js}
RENAMED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const index = require("./index-
|
|
5
|
-
const React = require("react");
|
|
6
|
-
const FetchIdentity = require("./FetchIdentity-CtBRO-Cn.js");
|
|
4
|
+
const index = require("./index-CTkxoioB.js");
|
|
7
5
|
const admin = require("@strapi/strapi/admin");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const FetchIdentity = require("./FetchIdentity-CcEjakiz.js");
|
|
8
|
+
const RequireLocalazyAuth = require("./RequireLocalazyAuth-BVwF0bRC.js");
|
|
9
|
+
const LanguagesSelector = require("./LanguagesSelector-DejYCwBl.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-CCUuu7EY.js");
|
|
12
|
+
const index$1 = require("./index-CEGaWWh3.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-Z-4Ykc_J.mjs → LocalazyGlobalSettings-DOW5rjLn.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-DJxgCwgM.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-Bm7bc5bS.mjs";
|
|
6
|
+
import { s as set, i as isEqual, R as RequireLocalazyAuth } from "./RequireLocalazyAuth-DNhTZZ_6.mjs";
|
|
7
|
+
import { P as ProjectService, L as LanguagesSelector } from "./LanguagesSelector-B1rwN7-Y.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-IiMEtDoH.mjs";
|
|
10
|
+
import { P as PERMISSIONS } from "./index-DP2ugzc_.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
|
};
|