@localazy/strapi-plugin 1.0.4 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/FetchIdentity-4kkW9N7Y.js +981 -0
- package/dist/_chunks/FetchIdentity-BWSQAXt-.mjs +983 -0
- package/dist/_chunks/{LanguagesSelector-CeB7tVcb.mjs → LanguagesSelector-DwAGgpcR.mjs} +4 -2
- package/dist/_chunks/{LanguagesSelector-Bd8VFHib.js → LanguagesSelector-yWC_Yb_S.js} +12 -10
- package/dist/_chunks/{App-NRmSxuW3.js → LocalazyApp-DnaA768k.js} +136 -117
- package/dist/_chunks/{App-CtS6CrNn.mjs → LocalazyApp-zySanVTu.mjs} +32 -13
- package/dist/_chunks/{ContentTransferSetup-CeKXlzw_.mjs → LocalazyContentTransferSetup-C7qVIeix.mjs} +49 -456
- package/dist/_chunks/{ContentTransferSetup-DGs8MZPj.js → LocalazyContentTransferSetup-CeOM6bYA.js} +113 -520
- package/dist/_chunks/{GlobalSettings-rOwd0Y0E.mjs → LocalazyGlobalSettings-QvuLdsLe.mjs} +17 -8
- package/dist/_chunks/{GlobalSettings-CRMPRA3Y.js → LocalazyGlobalSettings-ewETL3oG.js} +61 -52
- package/dist/_chunks/LocalazyPanel-BXVLvFgD.js +83 -0
- package/dist/_chunks/LocalazyPanel-BotUsX-y.mjs +83 -0
- package/dist/_chunks/LocalazyStatusColumn-C81HewMg.mjs +51 -0
- package/dist/_chunks/LocalazyStatusColumn-Dt96YcGQ.js +51 -0
- package/dist/_chunks/{isEqual-CC-cEPwY.mjs → RequireLocalazyAuth-CDuyGCrT.mjs} +22 -1
- package/dist/_chunks/{isEqual-0M0aSdTT.js → RequireLocalazyAuth-CWBWETzC.js} +50 -29
- package/dist/_chunks/_commonjsHelpers-Bc2YnDe1.js +7 -0
- package/dist/_chunks/_commonjsHelpers-DWwsNxpa.mjs +8 -0
- package/dist/_chunks/en-CMWcM0nM.js +10 -0
- package/dist/_chunks/en-RX915msK.mjs +10 -0
- package/dist/_chunks/entry-exclusion-service-BVPICve2.mjs +60 -0
- package/dist/_chunks/entry-exclusion-service-CGV6iOkB.js +60 -0
- package/dist/_chunks/{has-model-changed-gNSOSMBa.js → has-model-changed-DVYRxVhM.js} +33 -32
- package/dist/_chunks/{has-model-changed-DViUIQHk.mjs → has-model-changed-DZL36gWh.mjs} +3 -2
- package/dist/_chunks/i18n-0dV2P-Hm.js +2378 -0
- package/dist/_chunks/i18n-RoETLXdU.mjs +2378 -0
- package/dist/_chunks/index-1he9s_bs.js +430 -0
- package/dist/_chunks/index-BIbKC7-V.mjs +432 -0
- package/dist/_chunks/index-CCxXsn7Z.js +254 -0
- package/dist/_chunks/{set-Cbi1yYuW.js → index-CaY3BYnQ.js} +878 -4379
- package/dist/_chunks/{set-Dnhh_SyE.mjs → index-CgI_aKe_.mjs} +906 -4408
- package/dist/_chunks/index-DsrYI6aB.mjs +231 -0
- package/dist/_chunks/initReactI18next-B0H8_DlW.js +60 -0
- package/dist/_chunks/initReactI18next-MHHxeg_9.mjs +61 -0
- package/dist/_chunks/{index-Dj68Ixl2.mjs → strapi-api-base-BE8VMlaA.js} +7 -234
- package/dist/_chunks/{index-Bbwk3kp3.js → strapi-api-base-DjeKGUw7.mjs} +15 -242
- package/dist/_chunks/useTranslation-BdIl-aLe.js +188 -0
- package/dist/_chunks/useTranslation-CZQ4lU1m.mjs +189 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LocalazyPanel.d.ts +4 -0
- package/dist/admin/src/components/LocalazyStatusColumn.d.ts +3 -0
- package/dist/admin/src/components/RequireLocalazyAuth.d.ts +6 -0
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/modules/entry-exclusion/services/entry-exclusion-service.d.ts +18 -0
- package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +8 -0
- package/dist/admin/src/pages/LocalazyApp.d.ts +2 -0
- package/dist/admin/src/pages/LocalazyContentTransferSetup.d.ts +2 -0
- package/dist/admin/src/pages/LocalazyGlobalSettings.d.ts +2 -0
- package/dist/server/index.js +202 -35
- package/dist/server/index.mjs +202 -35
- package/dist/server/src/controllers/entry-exclusion-controller.d.ts +21 -0
- package/dist/server/src/controllers/index.d.ts +7 -0
- package/dist/server/src/core/index.d.ts +6 -0
- package/dist/server/src/index.d.ts +15 -0
- package/dist/server/src/routes/entry-exclusion-routes.d.ts +9 -0
- package/dist/server/src/services/entry-exclusion-service.d.ts +23 -0
- package/dist/server/src/services/index.d.ts +8 -0
- package/package.json +2 -2
- package/dist/_chunks/en-BTf8goGM.mjs +0 -8
- package/dist/_chunks/en-CRtsEFtl.js +0 -8
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { P as PluginSettingsService$1, c as cloneDeep, s as set, L as LocalazyIdentityProvider, F as FetchIdentity } from "./FetchIdentity-BWSQAXt-.mjs";
|
|
4
4
|
import { Layouts } from "@strapi/strapi/admin";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { c as Flex, B as Button, d as ForwardRef$4z, e as Box, A as Alert, T as Typography, F as Field, a as Toggle, M as MultiSelect, b as MultiSelectOption, D as Divider, S as SingleSelect, f as SingleSelectOption } from "./index-CgI_aKe_.mjs";
|
|
6
|
+
import { i as isEqual, R as RequireLocalazyAuth } from "./RequireLocalazyAuth-CDuyGCrT.mjs";
|
|
7
|
+
import { L as LanguagesSelector, P as ProjectService } from "./LanguagesSelector-DwAGgpcR.mjs";
|
|
8
|
+
import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-DjeKGUw7.mjs";
|
|
9
|
+
import "./i18n-RoETLXdU.mjs";
|
|
10
|
+
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
8
11
|
class PluginSettingsService {
|
|
9
12
|
static async getAdminPanelUsers() {
|
|
10
13
|
try {
|
|
@@ -57,13 +60,15 @@ const GlobalSettings = () => {
|
|
|
57
60
|
useEffect(() => {
|
|
58
61
|
async function fetchData() {
|
|
59
62
|
setIsLoading(true);
|
|
60
|
-
const project = await
|
|
63
|
+
const [project, globalSettings, users2] = await Promise.all([
|
|
64
|
+
ProjectService.getConnectedProject(),
|
|
65
|
+
PluginSettingsService$1.getPluginSettings(),
|
|
66
|
+
PluginSettingsService.getAdminPanelUsers()
|
|
67
|
+
]);
|
|
61
68
|
const projectLanguagesWithoutDefaultLanguage = project?.languages?.filter((language) => language.id !== project.sourceLanguage) || [];
|
|
62
69
|
setProjectLanguages(projectLanguagesWithoutDefaultLanguage);
|
|
63
|
-
const globalSettings = await PluginSettingsService$1.getPluginSettings();
|
|
64
70
|
setFormModel(globalSettings);
|
|
65
71
|
setOriginalFormModel(cloneDeep(globalSettings));
|
|
66
|
-
const users2 = await PluginSettingsService.getAdminPanelUsers();
|
|
67
72
|
setUsers(users2);
|
|
68
73
|
setIsLoading(false);
|
|
69
74
|
}
|
|
@@ -226,6 +231,10 @@ const GlobalSettings = () => {
|
|
|
226
231
|
] })
|
|
227
232
|
] });
|
|
228
233
|
};
|
|
234
|
+
const LocalazyGlobalSettings = () => /* @__PURE__ */ jsxs(LocalazyIdentityProvider, { children: [
|
|
235
|
+
/* @__PURE__ */ jsx(FetchIdentity, {}),
|
|
236
|
+
/* @__PURE__ */ jsx(RequireLocalazyAuth, { children: /* @__PURE__ */ jsx(GlobalSettings, {}) })
|
|
237
|
+
] });
|
|
229
238
|
export {
|
|
230
|
-
|
|
239
|
+
LocalazyGlobalSettings as default
|
|
231
240
|
};
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const FetchIdentity = require("./FetchIdentity-4kkW9N7Y.js");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const index = require("./index-CaY3BYnQ.js");
|
|
8
|
+
const RequireLocalazyAuth = require("./RequireLocalazyAuth-CWBWETzC.js");
|
|
9
|
+
const LanguagesSelector = require("./LanguagesSelector-yWC_Yb_S.js");
|
|
10
|
+
const strapiApiBase = require("./strapi-api-base-BE8VMlaA.js");
|
|
11
|
+
require("./i18n-0dV2P-Hm.js");
|
|
12
|
+
const useTranslation = require("./useTranslation-BdIl-aLe.js");
|
|
10
13
|
class PluginSettingsService {
|
|
11
14
|
static async getAdminPanelUsers() {
|
|
12
15
|
try {
|
|
13
|
-
const axiosInstance =
|
|
16
|
+
const axiosInstance = strapiApiBase.createStrapiApiAxiosInstance("/admin/users");
|
|
14
17
|
const result = await axiosInstance.get("", {
|
|
15
18
|
params: {
|
|
16
19
|
pageSize: 100,
|
|
@@ -25,7 +28,7 @@ class PluginSettingsService {
|
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
const GlobalSettings = () => {
|
|
28
|
-
const { t } =
|
|
31
|
+
const { t } = useTranslation.useTranslation();
|
|
29
32
|
const [projectLanguages, setProjectLanguages] = React.useState([]);
|
|
30
33
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
31
34
|
const [showSavedAlert, setShowSavedAlert] = React.useState(false);
|
|
@@ -34,13 +37,13 @@ const GlobalSettings = () => {
|
|
|
34
37
|
const [formModel, setFormModel] = React.useState({});
|
|
35
38
|
const [hasUnsavedChanges, setHasUnsavedChanges] = React.useState(false);
|
|
36
39
|
const onCancelClick = () => {
|
|
37
|
-
setFormModel(
|
|
40
|
+
setFormModel(FetchIdentity.cloneDeep(originalFormModel));
|
|
38
41
|
setHasUnsavedChanges(false);
|
|
39
42
|
};
|
|
40
43
|
const saveGlobalSettings = async (data) => {
|
|
41
44
|
try {
|
|
42
|
-
await
|
|
43
|
-
setOriginalFormModel(
|
|
45
|
+
await FetchIdentity.PluginSettingsService.updatePluginSettings(data);
|
|
46
|
+
setOriginalFormModel(FetchIdentity.cloneDeep(data));
|
|
44
47
|
setHasUnsavedChanges(false);
|
|
45
48
|
setShowSavedAlert(true);
|
|
46
49
|
} catch (e) {
|
|
@@ -48,10 +51,10 @@ const GlobalSettings = () => {
|
|
|
48
51
|
}
|
|
49
52
|
};
|
|
50
53
|
const patchFormModel = (key, value) => {
|
|
51
|
-
const newFormModel =
|
|
52
|
-
|
|
54
|
+
const newFormModel = FetchIdentity.cloneDeep(formModel);
|
|
55
|
+
FetchIdentity.set(newFormModel, key, value);
|
|
53
56
|
setFormModel(newFormModel);
|
|
54
|
-
setHasUnsavedChanges(!
|
|
57
|
+
setHasUnsavedChanges(!RequireLocalazyAuth.isEqual(originalFormModel, newFormModel));
|
|
55
58
|
};
|
|
56
59
|
const getUserLabel = (user) => {
|
|
57
60
|
return `${user.firstname} ${user.lastname || ""}${user.lastname ? " " : ""}(${user.email})`;
|
|
@@ -59,13 +62,15 @@ const GlobalSettings = () => {
|
|
|
59
62
|
React.useEffect(() => {
|
|
60
63
|
async function fetchData() {
|
|
61
64
|
setIsLoading(true);
|
|
62
|
-
const project = await
|
|
65
|
+
const [project, globalSettings, users2] = await Promise.all([
|
|
66
|
+
LanguagesSelector.ProjectService.getConnectedProject(),
|
|
67
|
+
FetchIdentity.PluginSettingsService.getPluginSettings(),
|
|
68
|
+
PluginSettingsService.getAdminPanelUsers()
|
|
69
|
+
]);
|
|
63
70
|
const projectLanguagesWithoutDefaultLanguage = project?.languages?.filter((language) => language.id !== project.sourceLanguage) || [];
|
|
64
71
|
setProjectLanguages(projectLanguagesWithoutDefaultLanguage);
|
|
65
|
-
const globalSettings = await set.PluginSettingsService.getPluginSettings();
|
|
66
72
|
setFormModel(globalSettings);
|
|
67
|
-
setOriginalFormModel(
|
|
68
|
-
const users2 = await PluginSettingsService.getAdminPanelUsers();
|
|
73
|
+
setOriginalFormModel(FetchIdentity.cloneDeep(globalSettings));
|
|
69
74
|
setUsers(users2);
|
|
70
75
|
setIsLoading(false);
|
|
71
76
|
}
|
|
@@ -77,12 +82,12 @@ const GlobalSettings = () => {
|
|
|
77
82
|
{
|
|
78
83
|
title: t("plugin_settings.global_settings"),
|
|
79
84
|
subtitle: t("plugin_settings.global_settings_description"),
|
|
80
|
-
primaryAction: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
81
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
85
|
+
primaryAction: /* @__PURE__ */ jsxRuntime.jsxs(index.Flex, { gap: 2, children: [
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Button, { variant: "secondary", disabled: !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
|
|
82
87
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
-
|
|
88
|
+
index.Button,
|
|
84
89
|
{
|
|
85
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$4z, {}),
|
|
86
91
|
disabled: !hasUnsavedChanges,
|
|
87
92
|
onClick: () => {
|
|
88
93
|
saveGlobalSettings(formModel);
|
|
@@ -94,9 +99,9 @@ const GlobalSettings = () => {
|
|
|
94
99
|
as: "h2"
|
|
95
100
|
}
|
|
96
101
|
),
|
|
97
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
98
|
-
!isLoading && showSavedAlert && /* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
-
|
|
102
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.Box, { marginRight: 10, marginLeft: 10, children: [
|
|
103
|
+
!isLoading && showSavedAlert && /* @__PURE__ */ jsxRuntime.jsx(index.Box, { marginBottom: 8, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
104
|
+
index.Alert,
|
|
100
105
|
{
|
|
101
106
|
onClose: () => setShowSavedAlert(false),
|
|
102
107
|
closeLabel: t("plugin_settings.close"),
|
|
@@ -105,20 +110,20 @@ const GlobalSettings = () => {
|
|
|
105
110
|
children: t("plugin_settings.global_settings_saved_successfully")
|
|
106
111
|
}
|
|
107
112
|
) }),
|
|
108
|
-
!isLoading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
109
|
-
|
|
113
|
+
!isLoading && /* @__PURE__ */ jsxRuntime.jsx(index.Box, { background: "neutral0", padding: 7, paddingTop: 6, shadow: "tableShadow", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
114
|
+
index.Box,
|
|
110
115
|
{
|
|
111
116
|
style: {
|
|
112
117
|
maxWidth: "500px"
|
|
113
118
|
},
|
|
114
119
|
children: [
|
|
115
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Typography, { variant: "delta", textColor: "neutral800", children: t("plugin_settings.upload_settings") }),
|
|
116
121
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
117
122
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
118
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.Field.Root, { hint: t("plugin_settings.allow_automated_upload_to_localazy_info"), children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Label, { children: t("plugin_settings.allow_automated_upload_to_localazy") }),
|
|
120
125
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
-
|
|
126
|
+
index.Toggle,
|
|
122
127
|
{
|
|
123
128
|
offLabel: t("plugin_settings.off"),
|
|
124
129
|
onLabel: t("plugin_settings.on"),
|
|
@@ -126,14 +131,14 @@ const GlobalSettings = () => {
|
|
|
126
131
|
onChange: (e) => patchFormModel("upload.allowAutomated", e.target.checked)
|
|
127
132
|
}
|
|
128
133
|
),
|
|
129
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Hint, {})
|
|
130
135
|
] }),
|
|
131
136
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
132
137
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
133
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
134
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.Field.Root, { hint: t("plugin_settings.automated_upload_triggers_info"), children: [
|
|
139
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Label, { children: t("plugin_settings.automated_upload_triggers") }),
|
|
135
140
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
136
|
-
|
|
141
|
+
index.MultiSelect,
|
|
137
142
|
{
|
|
138
143
|
label: t("plugin_settings.automated_upload_triggers"),
|
|
139
144
|
hint: t("plugin_settings.automated_upload_triggers_info"),
|
|
@@ -146,19 +151,19 @@ const GlobalSettings = () => {
|
|
|
146
151
|
multi: true,
|
|
147
152
|
withTags: true,
|
|
148
153
|
children: [
|
|
149
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
150
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
154
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.MultiSelectOption, { value: "created", children: t("plugin_settings.creating_new_data_entry") }),
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.MultiSelectOption, { value: "updated", children: t("plugin_settings.editing_data_entry") })
|
|
151
156
|
]
|
|
152
157
|
}
|
|
153
158
|
),
|
|
154
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Hint, {})
|
|
155
160
|
] }),
|
|
156
161
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
157
162
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
158
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
159
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.Field.Root, { hint: t("plugin_settings.deprecate_source_keys_on_delete_info"), children: [
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Label, { children: t("plugin_settings.deprecate_source_keys_on_delete") }),
|
|
160
165
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
161
|
-
|
|
166
|
+
index.Toggle,
|
|
162
167
|
{
|
|
163
168
|
hint: t("plugin_settings.deprecate_source_keys_on_delete_info"),
|
|
164
169
|
offLabel: t("plugin_settings.off"),
|
|
@@ -167,20 +172,20 @@ const GlobalSettings = () => {
|
|
|
167
172
|
onChange: (e) => patchFormModel("upload.allowDeprecate", e.target.checked)
|
|
168
173
|
}
|
|
169
174
|
),
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Hint, {})
|
|
171
176
|
] }),
|
|
172
177
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
173
178
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
174
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
179
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Divider, {}),
|
|
175
180
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
176
181
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
182
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Typography, { variant: "delta", textColor: "neutral800", children: t("plugin_settings.download_settings") }),
|
|
178
183
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
179
184
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
180
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
181
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.Field.Root, { hint: t("plugin_settings.processing_of_download_webhook_info"), children: [
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Label, { children: t("plugin_settings.processing_of_download_webhook") }),
|
|
182
187
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
-
|
|
188
|
+
index.Toggle,
|
|
184
189
|
{
|
|
185
190
|
hint: t("plugin_settings.processing_of_download_webhook_info"),
|
|
186
191
|
offLabel: t("plugin_settings.off"),
|
|
@@ -189,14 +194,14 @@ const GlobalSettings = () => {
|
|
|
189
194
|
onChange: (e) => patchFormModel("download.processDownloadWebhook", e.target.checked)
|
|
190
195
|
}
|
|
191
196
|
),
|
|
192
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Hint, {})
|
|
193
198
|
] }),
|
|
194
199
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
195
200
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
196
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
197
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.Field.Root, { hint: t("plugin_settings.webhook_author_info"), children: [
|
|
202
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Label, { children: t("plugin_settings.webhook_author") }),
|
|
198
203
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
199
|
-
|
|
204
|
+
index.SingleSelect,
|
|
200
205
|
{
|
|
201
206
|
hint: t("plugin_settings.webhook_author_info"),
|
|
202
207
|
clearLabel: t("plugin_settings.clear"),
|
|
@@ -204,10 +209,10 @@ const GlobalSettings = () => {
|
|
|
204
209
|
onClear: () => patchFormModel("download.webhookAuthorId", null),
|
|
205
210
|
value: formModel?.download?.webhookAuthorId || null,
|
|
206
211
|
onChange: (value) => patchFormModel("download.webhookAuthorId", value),
|
|
207
|
-
children: users.map((user) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
212
|
+
children: users.map((user) => /* @__PURE__ */ jsxRuntime.jsx(index.SingleSelectOption, { value: user.id, children: getUserLabel(user) }, user.id))
|
|
208
213
|
}
|
|
209
214
|
),
|
|
210
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.Field.Hint, {})
|
|
211
216
|
] }),
|
|
212
217
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
213
218
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
@@ -228,4 +233,8 @@ const GlobalSettings = () => {
|
|
|
228
233
|
] })
|
|
229
234
|
] });
|
|
230
235
|
};
|
|
231
|
-
|
|
236
|
+
const LocalazyGlobalSettings = () => /* @__PURE__ */ jsxRuntime.jsxs(FetchIdentity.LocalazyIdentityProvider, { children: [
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsx(FetchIdentity.FetchIdentity, {}),
|
|
238
|
+
/* @__PURE__ */ jsxRuntime.jsx(RequireLocalazyAuth.RequireLocalazyAuth, { children: /* @__PURE__ */ jsxRuntime.jsx(GlobalSettings, {}) })
|
|
239
|
+
] });
|
|
240
|
+
exports.default = LocalazyGlobalSettings;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const reactRouterDom = require("react-router-dom");
|
|
6
|
+
const index = require("./index-CaY3BYnQ.js");
|
|
7
|
+
const entryExclusionService = require("./entry-exclusion-service-CGV6iOkB.js");
|
|
8
|
+
require("./i18n-0dV2P-Hm.js");
|
|
9
|
+
const useTranslation = require("./useTranslation-BdIl-aLe.js");
|
|
10
|
+
const LocalazyPanel = () => {
|
|
11
|
+
const { t } = useTranslation.useTranslation();
|
|
12
|
+
const location = reactRouterDom.useLocation();
|
|
13
|
+
const [isExcluded, setIsExcluded] = React.useState(false);
|
|
14
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
15
|
+
const [contentType, setContentType] = React.useState(null);
|
|
16
|
+
const [documentId, setDocumentId] = React.useState(null);
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
const extractEntryInfo = () => {
|
|
19
|
+
const pathParts = location.pathname.split("/");
|
|
20
|
+
const contentManagerIndex = pathParts.indexOf("content-manager");
|
|
21
|
+
if (contentManagerIndex !== -1 && pathParts[contentManagerIndex + 1] === "collection-types") {
|
|
22
|
+
const extractedContentType = pathParts[contentManagerIndex + 2];
|
|
23
|
+
const extractedDocumentId = pathParts[contentManagerIndex + 3];
|
|
24
|
+
if (extractedContentType && extractedDocumentId) {
|
|
25
|
+
setContentType(extractedContentType);
|
|
26
|
+
setDocumentId(extractedDocumentId);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
extractEntryInfo();
|
|
31
|
+
}, [location.pathname]);
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
const loadExclusionState = async () => {
|
|
34
|
+
if (!contentType || !documentId) {
|
|
35
|
+
setIsLoading(false);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
setIsLoading(true);
|
|
40
|
+
const exclusionState = await entryExclusionService.default.getEntryExclusion(contentType, documentId);
|
|
41
|
+
setIsExcluded(exclusionState);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error("Failed to load entry exclusion state:", error);
|
|
44
|
+
setIsExcluded(false);
|
|
45
|
+
} finally {
|
|
46
|
+
setIsLoading(false);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
loadExclusionState();
|
|
50
|
+
}, [contentType, documentId]);
|
|
51
|
+
const handleToggleChange = async (event) => {
|
|
52
|
+
const { checked } = event.target;
|
|
53
|
+
const value = checked;
|
|
54
|
+
if (!contentType || !documentId) {
|
|
55
|
+
console.warn("Cannot save exclusion state: missing content type or document ID");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
await entryExclusionService.default.setEntryExclusion(contentType, documentId, value);
|
|
60
|
+
setIsExcluded(value);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error("Failed to save entry exclusion state:", error);
|
|
63
|
+
setIsExcluded(!value);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
title: "Localazy",
|
|
68
|
+
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") }) }),
|
|
70
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
+
index.Toggle,
|
|
72
|
+
{
|
|
73
|
+
checked: isExcluded,
|
|
74
|
+
onLabel: "True",
|
|
75
|
+
offLabel: "False",
|
|
76
|
+
disabled: isLoading || !contentType || !documentId,
|
|
77
|
+
onChange: handleToggleChange
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] })
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
exports.default = LocalazyPanel;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { useLocation } from "react-router-dom";
|
|
4
|
+
import { T as Typography, a as Toggle } from "./index-CgI_aKe_.mjs";
|
|
5
|
+
import EntryExclusionService from "./entry-exclusion-service-BVPICve2.mjs";
|
|
6
|
+
import "./i18n-RoETLXdU.mjs";
|
|
7
|
+
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
8
|
+
const LocalazyPanel = () => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const location = useLocation();
|
|
11
|
+
const [isExcluded, setIsExcluded] = useState(false);
|
|
12
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
13
|
+
const [contentType, setContentType] = useState(null);
|
|
14
|
+
const [documentId, setDocumentId] = useState(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const extractEntryInfo = () => {
|
|
17
|
+
const pathParts = location.pathname.split("/");
|
|
18
|
+
const contentManagerIndex = pathParts.indexOf("content-manager");
|
|
19
|
+
if (contentManagerIndex !== -1 && pathParts[contentManagerIndex + 1] === "collection-types") {
|
|
20
|
+
const extractedContentType = pathParts[contentManagerIndex + 2];
|
|
21
|
+
const extractedDocumentId = pathParts[contentManagerIndex + 3];
|
|
22
|
+
if (extractedContentType && extractedDocumentId) {
|
|
23
|
+
setContentType(extractedContentType);
|
|
24
|
+
setDocumentId(extractedDocumentId);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
extractEntryInfo();
|
|
29
|
+
}, [location.pathname]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const loadExclusionState = async () => {
|
|
32
|
+
if (!contentType || !documentId) {
|
|
33
|
+
setIsLoading(false);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
setIsLoading(true);
|
|
38
|
+
const exclusionState = await EntryExclusionService.getEntryExclusion(contentType, documentId);
|
|
39
|
+
setIsExcluded(exclusionState);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error("Failed to load entry exclusion state:", error);
|
|
42
|
+
setIsExcluded(false);
|
|
43
|
+
} finally {
|
|
44
|
+
setIsLoading(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
loadExclusionState();
|
|
48
|
+
}, [contentType, documentId]);
|
|
49
|
+
const handleToggleChange = async (event) => {
|
|
50
|
+
const { checked } = event.target;
|
|
51
|
+
const value = checked;
|
|
52
|
+
if (!contentType || !documentId) {
|
|
53
|
+
console.warn("Cannot save exclusion state: missing content type or document ID");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
await EntryExclusionService.setEntryExclusion(contentType, documentId, value);
|
|
58
|
+
setIsExcluded(value);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error("Failed to save entry exclusion state:", error);
|
|
61
|
+
setIsExcluded(!value);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
title: "Localazy",
|
|
66
|
+
content: /* @__PURE__ */ jsxs("div", { children: [
|
|
67
|
+
/* @__PURE__ */ jsx("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ jsx(Typography, { children: t("plugin_settings.exclude_from_translation") }) }),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
Toggle,
|
|
70
|
+
{
|
|
71
|
+
checked: isExcluded,
|
|
72
|
+
onLabel: "True",
|
|
73
|
+
offLabel: "False",
|
|
74
|
+
disabled: isLoading || !contentType || !documentId,
|
|
75
|
+
onChange: handleToggleChange
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] })
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
LocalazyPanel as default
|
|
83
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import EntryExclusionService from "./entry-exclusion-service-BVPICve2.mjs";
|
|
4
|
+
import "./i18n-RoETLXdU.mjs";
|
|
5
|
+
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
6
|
+
const LocalazyStatusColumn = ({ data, model }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const [isExcluded, setIsExcluded] = useState(null);
|
|
9
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const checkStatus = async () => {
|
|
12
|
+
if (!data?.documentId || !model) {
|
|
13
|
+
setIsLoading(false);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const excluded = await EntryExclusionService.getEntryExclusion(model, data.documentId);
|
|
18
|
+
setIsExcluded(excluded);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error("Error checking Localazy status:", error);
|
|
21
|
+
setIsExcluded(null);
|
|
22
|
+
} finally {
|
|
23
|
+
setIsLoading(false);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
checkStatus();
|
|
27
|
+
}, [data?.documentId, model]);
|
|
28
|
+
if (isLoading) {
|
|
29
|
+
return /* @__PURE__ */ jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "..." });
|
|
30
|
+
}
|
|
31
|
+
if (isExcluded === null) {
|
|
32
|
+
return /* @__PURE__ */ jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "-" });
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
style: {
|
|
38
|
+
padding: "4px 8px",
|
|
39
|
+
borderRadius: "4px",
|
|
40
|
+
fontSize: "12px",
|
|
41
|
+
fontWeight: "bold",
|
|
42
|
+
backgroundColor: isExcluded ? "#ff6b6b" : "#51cf66",
|
|
43
|
+
color: "white"
|
|
44
|
+
},
|
|
45
|
+
children: isExcluded ? t("plugin_settings.status_excluded") : t("plugin_settings.status_included")
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
LocalazyStatusColumn as default
|
|
51
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const entryExclusionService = require("./entry-exclusion-service-CGV6iOkB.js");
|
|
6
|
+
require("./i18n-0dV2P-Hm.js");
|
|
7
|
+
const useTranslation = require("./useTranslation-BdIl-aLe.js");
|
|
8
|
+
const LocalazyStatusColumn = ({ data, model }) => {
|
|
9
|
+
const { t } = useTranslation.useTranslation();
|
|
10
|
+
const [isExcluded, setIsExcluded] = React.useState(null);
|
|
11
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
const checkStatus = async () => {
|
|
14
|
+
if (!data?.documentId || !model) {
|
|
15
|
+
setIsLoading(false);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const excluded = await entryExclusionService.default.getEntryExclusion(model, data.documentId);
|
|
20
|
+
setIsExcluded(excluded);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error("Error checking Localazy status:", error);
|
|
23
|
+
setIsExcluded(null);
|
|
24
|
+
} finally {
|
|
25
|
+
setIsLoading(false);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
checkStatus();
|
|
29
|
+
}, [data?.documentId, model]);
|
|
30
|
+
if (isLoading) {
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "..." });
|
|
32
|
+
}
|
|
33
|
+
if (isExcluded === null) {
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "-" });
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
style: {
|
|
40
|
+
padding: "4px 8px",
|
|
41
|
+
borderRadius: "4px",
|
|
42
|
+
fontSize: "12px",
|
|
43
|
+
fontWeight: "bold",
|
|
44
|
+
backgroundColor: isExcluded ? "#ff6b6b" : "#51cf66",
|
|
45
|
+
color: "white"
|
|
46
|
+
},
|
|
47
|
+
children: isExcluded ? t("plugin_settings.status_excluded") : t("plugin_settings.status_included")
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
exports.default = LocalazyStatusColumn;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as SetCache, a as cacheHas, b as Symbol$1, e as eq, U as Uint8Array, d as setToArray, g as getAllKeys, f as getTag, i as isBuffer, h as Stack, j as isTypedArray, k as isArray, l as isObjectLike, u as useLocalazyIdentity } from "./FetchIdentity-BWSQAXt-.mjs";
|
|
2
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { P as PLUGIN_ID } from "./index-DsrYI6aB.mjs";
|
|
4
|
+
import { e as Box, T as Typography } from "./index-CgI_aKe_.mjs";
|
|
5
|
+
import { Layouts } from "@strapi/strapi/admin";
|
|
6
|
+
import "./i18n-RoETLXdU.mjs";
|
|
7
|
+
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
2
8
|
function arraySome(array, predicate) {
|
|
3
9
|
var index = -1, length = array == null ? 0 : array.length;
|
|
4
10
|
while (++index < length) {
|
|
@@ -201,6 +207,21 @@ function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
|
201
207
|
function isEqual(value, other) {
|
|
202
208
|
return baseIsEqual(value, other);
|
|
203
209
|
}
|
|
210
|
+
const RequireLocalazyAuth = ({ children }) => {
|
|
211
|
+
const { isLoggedIn, isFetchingIdentity } = useLocalazyIdentity();
|
|
212
|
+
const { t } = useTranslation();
|
|
213
|
+
if (!isFetchingIdentity && !isLoggedIn) {
|
|
214
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
215
|
+
/* @__PURE__ */ jsx(Layouts.Header, { title: t("common.localazy_plugin"), subtitle: t("common.localazy_plugin_description"), as: "h2" }),
|
|
216
|
+
/* @__PURE__ */ jsxs(Box, { marginLeft: 10, marginRight: 10, background: "neutral0", padding: 7, hasRadius: true, shadow: "tableShadow", children: [
|
|
217
|
+
/* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: t("login.you_have_to_own_account_for_the_plugin_to_work_properly") }),
|
|
218
|
+
/* @__PURE__ */ jsx(Box, { paddingTop: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: /* @__PURE__ */ jsx("a", { href: `/admin/plugins/${PLUGIN_ID}/`, children: t("login.login_with_localazy") }) }) })
|
|
219
|
+
] })
|
|
220
|
+
] });
|
|
221
|
+
}
|
|
222
|
+
return children;
|
|
223
|
+
};
|
|
204
224
|
export {
|
|
225
|
+
RequireLocalazyAuth as R,
|
|
205
226
|
isEqual as i
|
|
206
227
|
};
|