@localazy/strapi-plugin 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/_chunks/{App-BSFfgZKU.mjs → App-1cXVSnL0.mjs} +59 -32
  2. package/dist/_chunks/{App-D1QaIMHX.js → App-CU_T8iLT.js} +66 -39
  3. package/dist/_chunks/{ContentTransferSetup-DtjcF_jM.mjs → ContentTransferSetup-D2R15gJS.mjs} +27 -8
  4. package/dist/_chunks/{ContentTransferSetup-DHXJIxAp.js → ContentTransferSetup-DTcnul1w.js} +27 -8
  5. package/dist/_chunks/{GlobalSettings-BcdibqNS.mjs → GlobalSettings-7pI5vIna.mjs} +8 -5
  6. package/dist/_chunks/{GlobalSettings-BON3kjHK.js → GlobalSettings-D_jeqPWF.js} +8 -5
  7. package/dist/_chunks/{LanguagesSelector-fyAIUp7M.mjs → LanguagesSelector-D2AP7FE0.mjs} +2 -2
  8. package/dist/_chunks/{LanguagesSelector-BeijBEjg.js → LanguagesSelector-DU5YJVQa.js} +2 -2
  9. package/dist/_chunks/{has-model-changed-BMCQX2Dd.js → has-model-changed-9PCipZvK.js} +2 -2
  10. package/dist/_chunks/{has-model-changed-Dvtzpc9v.mjs → has-model-changed-wAFZY5Ma.mjs} +2 -2
  11. package/dist/_chunks/{index-CN3Gyh5F.mjs → index-CT0CH6N8.mjs} +19 -43
  12. package/dist/_chunks/{index-BQw2qi2G.js → index-Ca5_8RSo.js} +18 -42
  13. package/dist/_chunks/{isEqual-B-YVnzrp.js → isEqual--zmPN5yr.js} +1 -1
  14. package/dist/_chunks/{isEqual-CEyT97-3.mjs → isEqual-DPUlu6B0.mjs} +1 -1
  15. package/dist/_chunks/{set-DulHAQhq.mjs → set-BkLLlpnD.mjs} +4 -1
  16. package/dist/_chunks/{set-DUdH3vE5.js → set-DDy9ZASU.js} +4 -1
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/admin/src/modules/@common/utils/iso-locales-utils.d.ts +3 -3
  20. package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +3 -0
  21. package/dist/admin/src/modules/plugin-settings/models/admin-panel-user.d.ts +11 -0
  22. package/dist/admin/src/modules/plugin-settings/services/strapi-users-service.d.ts +2 -1
  23. package/dist/admin/src/state/localazy-identity.d.ts +2 -0
  24. package/dist/server/index.js +109 -32
  25. package/dist/server/index.mjs +109 -32
  26. package/dist/server/src/core/index.d.ts +3 -3
  27. package/dist/server/src/index.d.ts +20 -5
  28. package/dist/server/src/middlewares/index.d.ts +5 -1
  29. package/dist/server/src/middlewares/verify-webhook.d.ts +5 -0
  30. package/dist/server/src/routes/index.d.ts +12 -1
  31. package/dist/server/src/routes/localazy-public-transfer-routes.d.ts +11 -0
  32. package/dist/server/src/services/index.d.ts +3 -3
  33. package/dist/server/src/services/localazy-pubapi-service.d.ts +6 -5
  34. package/package.json +1 -1
  35. package/dist/admin/src/modules/@common/utils/is-plugin-route.d.ts +0 -2
@@ -1,16 +1,37 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useLocation, NavLink, Routes, Route } from "react-router-dom";
3
- import { u as useTranslation, F as ForwardRef$2H, a as ForwardRef$d, b as ForwardRef$3P, c as Flex, L as Loader, g as getDefaultExportFromCjs, B as Button, d as Box, T as Typography, e as Link, S as SubNav, f as SubNavHeader, h as SubNavSections, i as SubNavSection, j as SubNavLink, k as ForwardRef$L, G as Grid, D as Divider, P as PluginSettingsService, l as darkTheme, m as lightTheme, A as Alert, n as cloneDeep, s as set, o as DesignSystemProvider } from "./set-DulHAQhq.mjs";
2
+ import { useNavigate, useLocation, NavLink, Routes, Route } from "react-router-dom";
3
+ import { u as useTranslation, F as ForwardRef$2H, a as ForwardRef$d, b as ForwardRef$3P, c as Flex, L as Loader, g as getDefaultExportFromCjs, B as Button, d as Box, T as Typography, e as Link, S as SubNav, f as SubNavHeader, h as SubNavSections, i as SubNavSection, j as SubNavLink, k as ForwardRef$L, G as Grid, D as Divider, P as PluginSettingsService, l as darkTheme, m as lightTheme, A as Alert, n as cloneDeep, s as set, o as DesignSystemProvider } from "./set-BkLLlpnD.mjs";
4
4
  import { useState, useEffect } from "react";
5
- import { P as PLUGIN_ID, c as createStrapiApiAxiosInstance, u as useRedirectToPluginRoute, a as useLocalazyIdentity, b as PLUGIN_ROUTES, L as LocalazyUserService, e as emptyIdentity } from "./index-CN3Gyh5F.mjs";
6
- import { P as ProjectService, L as LanguagesSelector } from "./LanguagesSelector-fyAIUp7M.mjs";
7
- import { Layouts } from "@strapi/strapi/admin";
8
- import { h as hasModelChanged } from "./has-model-changed-Dvtzpc9v.mjs";
9
- const isPluginRoute = (location2, path = "") => {
10
- if (path) {
11
- return location2.pathname.endsWith(`${PLUGIN_ID}/${path}`) || location2.pathname.endsWith(`${PLUGIN_ID}/${path}/`);
12
- }
13
- return location2.pathname.endsWith(PLUGIN_ID) || location2.pathname.endsWith(`${PLUGIN_ID}/`);
5
+ import { P as PLUGIN_ID, c as createStrapiApiAxiosInstance, u as useLocalazyIdentity, L as LocalazyUserService, e as emptyIdentity } from "./index-CT0CH6N8.mjs";
6
+ import { P as ProjectService, L as LanguagesSelector } from "./LanguagesSelector-D2AP7FE0.mjs";
7
+ import { Layouts, Page } from "@strapi/strapi/admin";
8
+ import { h as hasModelChanged } from "./has-model-changed-wAFZY5Ma.mjs";
9
+ var PLUGIN_ROUTES = /* @__PURE__ */ ((PLUGIN_ROUTES2) => {
10
+ PLUGIN_ROUTES2["ROOT"] = "";
11
+ PLUGIN_ROUTES2["LOGIN"] = "login";
12
+ PLUGIN_ROUTES2["UPLOAD"] = "upload";
13
+ PLUGIN_ROUTES2["DOWNLOAD"] = "download";
14
+ PLUGIN_ROUTES2["OVERVIEW"] = "overview";
15
+ PLUGIN_ROUTES2["CONTENT_TRANSFER_SETUP"] = "content-transfer-setup";
16
+ PLUGIN_ROUTES2["GLOBAL_SETTINGS"] = "global-settings";
17
+ return PLUGIN_ROUTES2;
18
+ })(PLUGIN_ROUTES || {});
19
+ const useRedirectToPluginRoute = () => {
20
+ const navigate = useNavigate();
21
+ const navigateToPluginRoute = (route) => {
22
+ if ([
23
+ "content-transfer-setup",
24
+ "global-settings"
25
+ /* GLOBAL_SETTINGS */
26
+ ].includes(route)) {
27
+ navigate(`/settings/${PLUGIN_ID}/${route}`);
28
+ return;
29
+ }
30
+ navigate(`/plugins/${PLUGIN_ID}/${route}`);
31
+ };
32
+ return {
33
+ navigateToPluginRoute
34
+ };
14
35
  };
15
36
  const useNav = () => {
16
37
  const { t: t2 } = useTranslation();
@@ -1142,7 +1163,7 @@ async function getLocalazySourceLanguage() {
1142
1163
  }
1143
1164
  const isoStrapiToLocalazy = (isoStrapi) => {
1144
1165
  if (!isoStrapi) {
1145
- return "";
1166
+ return null;
1146
1167
  }
1147
1168
  const split = isoStrapi.split("-");
1148
1169
  const language = split[0];
@@ -1162,7 +1183,7 @@ const isoStrapiToLocalazy = (isoStrapi) => {
1162
1183
  };
1163
1184
  const isoLocalazyToStrapi = (isoLocalazy) => {
1164
1185
  if (!isoLocalazy) {
1165
- return "";
1186
+ return null;
1166
1187
  }
1167
1188
  const scriptIndex = isoLocalazy.indexOf("#");
1168
1189
  const hasScript = scriptIndex > -1;
@@ -1342,7 +1363,6 @@ class ProductAnalyticsService {
1342
1363
  }
1343
1364
  const Login = ({ title, subtitle, isLoading = false }) => {
1344
1365
  const { t: t2 } = useTranslation();
1345
- const { navigateToPluginRoute } = useRedirectToPluginRoute();
1346
1366
  const localazyStrapiDocsLink = "https://localazy.com/docs/strapi";
1347
1367
  const { setIdentity, identity, isLoggedIn } = useLocalazyIdentity();
1348
1368
  const onLoginResultFetched = async (result) => {
@@ -1352,9 +1372,8 @@ const Login = ({ title, subtitle, isLoading = false }) => {
1352
1372
  useEffect(() => {
1353
1373
  if (isLoggedIn && identity.user && identity.project) {
1354
1374
  ProductAnalyticsService.trackAppConnected(identity.user.id, identity.project);
1355
- navigateToPluginRoute(PLUGIN_ROUTES.DOWNLOAD);
1356
1375
  }
1357
- }, [isLoggedIn, identity, navigateToPluginRoute]);
1376
+ }, [isLoggedIn, identity]);
1358
1377
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1359
1378
  /* @__PURE__ */ jsx(Layouts.Header, { title, subtitle, as: "h1" }),
1360
1379
  isLoading && /* @__PURE__ */ jsx(PluginPageLoader, {}),
@@ -5246,32 +5265,40 @@ const Download = (props) => {
5246
5265
  ] });
5247
5266
  };
5248
5267
  const App = () => {
5249
- const location2 = useLocation();
5250
5268
  const { navigateToPluginRoute } = useRedirectToPluginRoute();
5251
- const { setIdentity, isLoggedIn } = useLocalazyIdentity();
5269
+ const { isLoggedIn, isFetchingIdentity } = useLocalazyIdentity();
5252
5270
  const headerTitle = useHeaderTitle();
5253
5271
  const headerSubtitle = useHeaderSubtitle();
5254
5272
  useEffect(() => {
5255
5273
  const fetchData = async () => {
5256
- if (isPluginRoute(location2)) {
5274
+ if (isFetchingIdentity) {
5275
+ return;
5276
+ }
5277
+ if (!isLoggedIn) {
5278
+ navigateToPluginRoute(PLUGIN_ROUTES.LOGIN);
5279
+ } else {
5257
5280
  const lastRoute = (await PluginSettingsService.getPluginSettings()).defaultRoute || PLUGIN_ROUTES.UPLOAD;
5258
5281
  navigateToPluginRoute(lastRoute);
5259
5282
  }
5260
5283
  };
5261
5284
  fetchData();
5262
- }, [setIdentity]);
5263
- return /* @__PURE__ */ jsx(DesignSystemProvider, { theme: getDefaultTheme(), children: /* @__PURE__ */ jsx(Box, { background: "neutral100", children: /* @__PURE__ */ jsx(Layouts.Root, { sideNav: isLoggedIn && /* @__PURE__ */ jsx(SideNav, {}), children: /* @__PURE__ */ jsxs(Routes, { children: [
5264
- /* @__PURE__ */ jsx(Route, { path: `login`, element: /* @__PURE__ */ jsx(Login, { title: headerTitle, subtitle: headerSubtitle, isLoading: false }) }),
5265
- /* @__PURE__ */ jsx(
5266
- Route,
5267
- {
5268
- path: `overview`,
5269
- element: /* @__PURE__ */ jsx(Overview, { title: headerTitle, subtitle: headerSubtitle, isLoadingProp: false })
5270
- }
5271
- ),
5272
- /* @__PURE__ */ jsx(Route, { path: `upload`, element: /* @__PURE__ */ jsx(Upload, { title: headerTitle, subtitle: headerSubtitle }) }),
5273
- /* @__PURE__ */ jsx(Route, { path: `download`, element: /* @__PURE__ */ jsx(Download, { title: headerTitle, subtitle: headerSubtitle }) })
5274
- ] }) }) }) });
5285
+ }, [isLoggedIn, isFetchingIdentity]);
5286
+ return /* @__PURE__ */ jsx(DesignSystemProvider, { theme: getDefaultTheme(), children: /* @__PURE__ */ jsx(Box, { background: "neutral100", children: /* @__PURE__ */ jsxs(Layouts.Root, { sideNav: isLoggedIn && /* @__PURE__ */ jsx(SideNav, {}), children: [
5287
+ isFetchingIdentity && /* @__PURE__ */ jsx(PluginPageLoader, {}),
5288
+ /* @__PURE__ */ jsxs(Routes, { children: [
5289
+ /* @__PURE__ */ jsx(Route, { path: `login`, element: /* @__PURE__ */ jsx(Login, { title: headerTitle, subtitle: headerSubtitle, isLoading: false }) }),
5290
+ /* @__PURE__ */ jsx(
5291
+ Route,
5292
+ {
5293
+ path: `overview`,
5294
+ element: /* @__PURE__ */ jsx(Overview, { title: headerTitle, subtitle: headerSubtitle, isLoadingProp: false })
5295
+ }
5296
+ ),
5297
+ /* @__PURE__ */ jsx(Route, { path: `upload`, element: /* @__PURE__ */ jsx(Upload, { title: headerTitle, subtitle: headerSubtitle }) }),
5298
+ /* @__PURE__ */ jsx(Route, { path: `download`, element: /* @__PURE__ */ jsx(Download, { title: headerTitle, subtitle: headerSubtitle }) }),
5299
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
5300
+ ] })
5301
+ ] }) }) });
5275
5302
  };
5276
5303
  export {
5277
5304
  App
@@ -2,17 +2,38 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const reactRouterDom = require("react-router-dom");
5
- const set = require("./set-DUdH3vE5.js");
5
+ const set = require("./set-DDy9ZASU.js");
6
6
  const React = require("react");
7
- const index = require("./index-BQw2qi2G.js");
8
- const LanguagesSelector = require("./LanguagesSelector-BeijBEjg.js");
7
+ const index = require("./index-Ca5_8RSo.js");
8
+ const LanguagesSelector = require("./LanguagesSelector-DU5YJVQa.js");
9
9
  const admin = require("@strapi/strapi/admin");
10
- const hasModelChanged = require("./has-model-changed-BMCQX2Dd.js");
11
- const isPluginRoute = (location2, path = "") => {
12
- if (path) {
13
- return location2.pathname.endsWith(`${index.PLUGIN_ID}/${path}`) || location2.pathname.endsWith(`${index.PLUGIN_ID}/${path}/`);
14
- }
15
- return location2.pathname.endsWith(index.PLUGIN_ID) || location2.pathname.endsWith(`${index.PLUGIN_ID}/`);
10
+ const hasModelChanged = require("./has-model-changed-9PCipZvK.js");
11
+ var PLUGIN_ROUTES = /* @__PURE__ */ ((PLUGIN_ROUTES2) => {
12
+ PLUGIN_ROUTES2["ROOT"] = "";
13
+ PLUGIN_ROUTES2["LOGIN"] = "login";
14
+ PLUGIN_ROUTES2["UPLOAD"] = "upload";
15
+ PLUGIN_ROUTES2["DOWNLOAD"] = "download";
16
+ PLUGIN_ROUTES2["OVERVIEW"] = "overview";
17
+ PLUGIN_ROUTES2["CONTENT_TRANSFER_SETUP"] = "content-transfer-setup";
18
+ PLUGIN_ROUTES2["GLOBAL_SETTINGS"] = "global-settings";
19
+ return PLUGIN_ROUTES2;
20
+ })(PLUGIN_ROUTES || {});
21
+ const useRedirectToPluginRoute = () => {
22
+ const navigate = reactRouterDom.useNavigate();
23
+ const navigateToPluginRoute = (route) => {
24
+ if ([
25
+ "content-transfer-setup",
26
+ "global-settings"
27
+ /* GLOBAL_SETTINGS */
28
+ ].includes(route)) {
29
+ navigate(`/settings/${index.PLUGIN_ID}/${route}`);
30
+ return;
31
+ }
32
+ navigate(`/plugins/${index.PLUGIN_ID}/${route}`);
33
+ };
34
+ return {
35
+ navigateToPluginRoute
36
+ };
16
37
  };
17
38
  const useNav = () => {
18
39
  const { t: t2 } = set.useTranslation();
@@ -1144,7 +1165,7 @@ async function getLocalazySourceLanguage() {
1144
1165
  }
1145
1166
  const isoStrapiToLocalazy = (isoStrapi) => {
1146
1167
  if (!isoStrapi) {
1147
- return "";
1168
+ return null;
1148
1169
  }
1149
1170
  const split = isoStrapi.split("-");
1150
1171
  const language = split[0];
@@ -1164,7 +1185,7 @@ const isoStrapiToLocalazy = (isoStrapi) => {
1164
1185
  };
1165
1186
  const isoLocalazyToStrapi = (isoLocalazy) => {
1166
1187
  if (!isoLocalazy) {
1167
- return "";
1188
+ return null;
1168
1189
  }
1169
1190
  const scriptIndex = isoLocalazy.indexOf("#");
1170
1191
  const hasScript = scriptIndex > -1;
@@ -1344,7 +1365,6 @@ class ProductAnalyticsService {
1344
1365
  }
1345
1366
  const Login = ({ title, subtitle, isLoading = false }) => {
1346
1367
  const { t: t2 } = set.useTranslation();
1347
- const { navigateToPluginRoute } = index.useRedirectToPluginRoute();
1348
1368
  const localazyStrapiDocsLink = "https://localazy.com/docs/strapi";
1349
1369
  const { setIdentity, identity, isLoggedIn } = index.useLocalazyIdentity();
1350
1370
  const onLoginResultFetched = async (result) => {
@@ -1354,9 +1374,8 @@ const Login = ({ title, subtitle, isLoading = false }) => {
1354
1374
  React.useEffect(() => {
1355
1375
  if (isLoggedIn && identity.user && identity.project) {
1356
1376
  ProductAnalyticsService.trackAppConnected(identity.user.id, identity.project);
1357
- navigateToPluginRoute(index.PLUGIN_ROUTES.DOWNLOAD);
1358
1377
  }
1359
- }, [isLoggedIn, identity, navigateToPluginRoute]);
1378
+ }, [isLoggedIn, identity]);
1360
1379
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1361
1380
  /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Header, { title, subtitle, as: "h1" }),
1362
1381
  isLoading && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
@@ -1434,7 +1453,7 @@ const PrerequisitiesInfo = () => {
1434
1453
  const formatNumber = (value2, options = void 0) => new Intl.NumberFormat("en-GB", options).format(value2);
1435
1454
  const Overview = ({ title, subtitle, isLoadingProp = false }) => {
1436
1455
  const { t: t2 } = set.useTranslation();
1437
- const { navigateToPluginRoute } = index.useRedirectToPluginRoute();
1456
+ const { navigateToPluginRoute } = useRedirectToPluginRoute();
1438
1457
  const [isLoading, setIsLoading] = React.useState(true);
1439
1458
  const { identity } = index.useLocalazyIdentity();
1440
1459
  const projectUrl = identity.project.url;
@@ -1444,14 +1463,14 @@ const Overview = ({ title, subtitle, isLoadingProp = false }) => {
1444
1463
  setIsLoading(true);
1445
1464
  const project = await LanguagesSelector.ProjectService.getConnectedProject();
1446
1465
  setConnectedProject(project);
1447
- set.PluginSettingsService.updatePluginSettings({ defaultRoute: index.PLUGIN_ROUTES.OVERVIEW });
1466
+ set.PluginSettingsService.updatePluginSettings({ defaultRoute: PLUGIN_ROUTES.OVERVIEW });
1448
1467
  setIsLoading(false);
1449
1468
  }
1450
1469
  initComponent();
1451
1470
  }, []);
1452
1471
  const onLoggedOut = () => {
1453
1472
  ProductAnalyticsService.trackAppDisconnected(identity.user.id, identity.project);
1454
- navigateToPluginRoute(index.PLUGIN_ROUTES.LOGIN);
1473
+ navigateToPluginRoute(PLUGIN_ROUTES.LOGIN);
1455
1474
  };
1456
1475
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1457
1476
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4914,7 +4933,7 @@ const uploadAlertsService = new UploadAlertsService();
4914
4933
  const Upload = (props) => {
4915
4934
  const { t: t2 } = set.useTranslation();
4916
4935
  const { identity } = index.useLocalazyIdentity();
4917
- const { navigateToPluginRoute } = index.useRedirectToPluginRoute();
4936
+ const { navigateToPluginRoute } = useRedirectToPluginRoute();
4918
4937
  const [isLoading, setIsLoading] = React.useState(true);
4919
4938
  const [modelChanged, setModelChanged] = React.useState(false);
4920
4939
  const [localesIncompatible, setLocalesIncompatible] = React.useState(false);
@@ -4927,7 +4946,7 @@ const Upload = (props) => {
4927
4946
  const [strapiDefaultLocale, setStrapiDefaultLocale] = React.useState(null);
4928
4947
  const [localazySourceLanguage, setLocalazySourceLanguage] = React.useState(null);
4929
4948
  const onChangeSettingsClick = () => {
4930
- navigateToPluginRoute(index.PLUGIN_ROUTES.CONTENT_TRANSFER_SETUP);
4949
+ navigateToPluginRoute(PLUGIN_ROUTES.CONTENT_TRANSFER_SETUP);
4931
4950
  };
4932
4951
  const onUploadClick = async () => {
4933
4952
  setIsUploading(true);
@@ -4968,7 +4987,7 @@ const Upload = (props) => {
4968
4987
  setLocalazySourceLanguage(await getLocalazySourceLanguage());
4969
4988
  setModelChanged(await hasModelChanged.hasModelChanged());
4970
4989
  setLocalesIncompatible(!await areLocalesCompatible(strapiDefaultLocale, localazySourceLanguage));
4971
- set.PluginSettingsService.updatePluginSettings({ defaultRoute: index.PLUGIN_ROUTES.UPLOAD });
4990
+ set.PluginSettingsService.updatePluginSettings({ defaultRoute: PLUGIN_ROUTES.UPLOAD });
4972
4991
  setIsLoading(false);
4973
4992
  }
4974
4993
  initComponent();
@@ -5149,7 +5168,7 @@ const Download = (props) => {
5149
5168
  setProjectLanguages(projectLanguagesWithoutDefaultLanguage);
5150
5169
  const globalSettings = await set.PluginSettingsService.getPluginSettings();
5151
5170
  setFormModel(globalSettings);
5152
- set.PluginSettingsService.updatePluginSettings({ defaultRoute: index.PLUGIN_ROUTES.DOWNLOAD });
5171
+ set.PluginSettingsService.updatePluginSettings({ defaultRoute: PLUGIN_ROUTES.DOWNLOAD });
5153
5172
  setIsLoading(false);
5154
5173
  }
5155
5174
  initComponent();
@@ -5248,31 +5267,39 @@ const Download = (props) => {
5248
5267
  ] });
5249
5268
  };
5250
5269
  const App = () => {
5251
- const location2 = reactRouterDom.useLocation();
5252
- const { navigateToPluginRoute } = index.useRedirectToPluginRoute();
5253
- const { setIdentity, isLoggedIn } = index.useLocalazyIdentity();
5270
+ const { navigateToPluginRoute } = useRedirectToPluginRoute();
5271
+ const { isLoggedIn, isFetchingIdentity } = index.useLocalazyIdentity();
5254
5272
  const headerTitle = useHeaderTitle();
5255
5273
  const headerSubtitle = useHeaderSubtitle();
5256
5274
  React.useEffect(() => {
5257
5275
  const fetchData = async () => {
5258
- if (isPluginRoute(location2)) {
5259
- const lastRoute = (await set.PluginSettingsService.getPluginSettings()).defaultRoute || index.PLUGIN_ROUTES.UPLOAD;
5276
+ if (isFetchingIdentity) {
5277
+ return;
5278
+ }
5279
+ if (!isLoggedIn) {
5280
+ navigateToPluginRoute(PLUGIN_ROUTES.LOGIN);
5281
+ } else {
5282
+ const lastRoute = (await set.PluginSettingsService.getPluginSettings()).defaultRoute || PLUGIN_ROUTES.UPLOAD;
5260
5283
  navigateToPluginRoute(lastRoute);
5261
5284
  }
5262
5285
  };
5263
5286
  fetchData();
5264
- }, [setIdentity]);
5265
- return /* @__PURE__ */ jsxRuntime.jsx(set.DesignSystemProvider, { theme: getDefaultTheme(), children: /* @__PURE__ */ jsxRuntime.jsx(set.Box, { background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Root, { sideNav: isLoggedIn && /* @__PURE__ */ jsxRuntime.jsx(SideNav, {}), children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
5266
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `login`, element: /* @__PURE__ */ jsxRuntime.jsx(Login, { title: headerTitle, subtitle: headerSubtitle, isLoading: false }) }),
5267
- /* @__PURE__ */ jsxRuntime.jsx(
5268
- reactRouterDom.Route,
5269
- {
5270
- path: `overview`,
5271
- element: /* @__PURE__ */ jsxRuntime.jsx(Overview, { title: headerTitle, subtitle: headerSubtitle, isLoadingProp: false })
5272
- }
5273
- ),
5274
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `upload`, element: /* @__PURE__ */ jsxRuntime.jsx(Upload, { title: headerTitle, subtitle: headerSubtitle }) }),
5275
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `download`, element: /* @__PURE__ */ jsxRuntime.jsx(Download, { title: headerTitle, subtitle: headerSubtitle }) })
5276
- ] }) }) }) });
5287
+ }, [isLoggedIn, isFetchingIdentity]);
5288
+ return /* @__PURE__ */ jsxRuntime.jsx(set.DesignSystemProvider, { theme: getDefaultTheme(), children: /* @__PURE__ */ jsxRuntime.jsx(set.Box, { background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsxs(admin.Layouts.Root, { sideNav: isLoggedIn && /* @__PURE__ */ jsxRuntime.jsx(SideNav, {}), children: [
5289
+ isFetchingIdentity && /* @__PURE__ */ jsxRuntime.jsx(PluginPageLoader, {}),
5290
+ /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
5291
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `login`, element: /* @__PURE__ */ jsxRuntime.jsx(Login, { title: headerTitle, subtitle: headerSubtitle, isLoading: false }) }),
5292
+ /* @__PURE__ */ jsxRuntime.jsx(
5293
+ reactRouterDom.Route,
5294
+ {
5295
+ path: `overview`,
5296
+ element: /* @__PURE__ */ jsxRuntime.jsx(Overview, { title: headerTitle, subtitle: headerSubtitle, isLoadingProp: false })
5297
+ }
5298
+ ),
5299
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `upload`, element: /* @__PURE__ */ jsxRuntime.jsx(Upload, { title: headerTitle, subtitle: headerSubtitle }) }),
5300
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `download`, element: /* @__PURE__ */ jsxRuntime.jsx(Download, { title: headerTitle, subtitle: headerSubtitle }) }),
5301
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
5302
+ ] })
5303
+ ] }) }) });
5277
5304
  };
5278
5305
  exports.App = App;
@@ -1,9 +1,9 @@
1
1
  import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { createElement, isValidElement, cloneElement, Children, Fragment, useContext, forwardRef, useState, useEffect } from "react";
3
- import { i as isEqual } from "./isEqual-CEyT97-3.mjs";
4
- import { g as getDefaultExportFromCjs, x as warnOnce, y as getI18n, z as getDefaults, C as isString, E as warn, H as isObject, I as I18nContext, s as set, J as CheckboxImpl, K as keys, N as isArrayLike, O as arrayEach, Q as isArray, R as isObject$1, d as Box, U as Accordion, c as Flex, V as SwitchImpl, u as useTranslation, T as Typography, B as Button, p as ForwardRef$4z, A as Alert, D as Divider, P as PluginSettingsService, n as cloneDeep } from "./set-DulHAQhq.mjs";
3
+ import { i as isEqual } from "./isEqual-DPUlu6B0.mjs";
4
+ import { g as getDefaultExportFromCjs, x as warnOnce, y as getI18n, z as getDefaults, C as isString, E as warn, H as isObject, I as I18nContext, s as set, J as CheckboxImpl, K as keys, N as isArrayLike, O as arrayEach, Q as isArray, R as isObject$1, u as useTranslation, d as Box, U as Accordion, c as Flex, V as SwitchImpl, T as Typography, B as Button, p as ForwardRef$4z, A as Alert, D as Divider, P as PluginSettingsService, n as cloneDeep } from "./set-BkLLlpnD.mjs";
5
5
  import { Layouts } from "@strapi/strapi/admin";
6
- import { S as SUPPORTED_CONTENT_TYPE_FIELDS, a as SUPPORTED_CUSTOM_FIELD_PLUGINS, g as getContentTransferSetupKeysSets, b as get, f as findModelValueByKey, c as StrapiModelService, d as getModelsTree, h as hasModelChanged } from "./has-model-changed-Dvtzpc9v.mjs";
6
+ import { S as SUPPORTED_CONTENT_TYPE_FIELDS, a as SUPPORTED_CUSTOM_FIELD_PLUGINS, g as getContentTransferSetupKeysSets, b as get, f as findModelValueByKey, c as StrapiModelService, d as getModelsTree, h as hasModelChanged } from "./has-model-changed-wAFZY5Ma.mjs";
7
7
  import styled from "styled-components";
8
8
  var voidElements = {
9
9
  "area": true,
@@ -1243,6 +1243,7 @@ function flattenObject(obj, delimiter = ".") {
1243
1243
  return nobj;
1244
1244
  }
1245
1245
  const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
1246
+ const { t: t2 } = useTranslation();
1246
1247
  const [, setIsExpanded] = useState(initiallyExpanded);
1247
1248
  useEffect(() => {
1248
1249
  setIsExpanded(initiallyExpanded);
@@ -1256,6 +1257,24 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
1256
1257
  }
1257
1258
  return false;
1258
1259
  };
1260
+ const getCheckedStateCount = (value) => {
1261
+ if (typeof value === "undefined" || value === null) {
1262
+ return 0;
1263
+ }
1264
+ if (typeof value === "boolean") {
1265
+ return value ? 1 : 0;
1266
+ }
1267
+ if (Array.isArray(value)) {
1268
+ return value.reduce((acc, v) => acc + getCheckedStateCount(v), 0);
1269
+ }
1270
+ if (typeof value === "object") {
1271
+ const filteredValue = Object.fromEntries(
1272
+ Object.entries(value).filter(([key]) => !["__model__", "__component__"].includes(key))
1273
+ );
1274
+ return Object.values(filteredValue).reduce((acc, v) => acc + getCheckedStateCount(v), 0);
1275
+ }
1276
+ return 0;
1277
+ };
1259
1278
  const createTree = (name, branch, path = "") => {
1260
1279
  const isBranchObject = typeof branch === "object" && branch !== null;
1261
1280
  if (isBranchObject) {
@@ -1294,7 +1313,11 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
1294
1313
  return /* @__PURE__ */ jsx(Box, { children: Object.entries(objects).map(([key, value]) => {
1295
1314
  return value.__model__ !== void 0 && /* @__PURE__ */ jsx(Box, { borderColor: "neutral200", hasRadius: true, children: /* @__PURE__ */ jsx(Accordion.Root, { size: "S", children: /* @__PURE__ */ jsxs(Accordion.Item, { value: key, children: [
1296
1315
  /* @__PURE__ */ jsxs(Flex, { alignItems: "center", justifyContent: "space-between", children: [
1297
- /* @__PURE__ */ jsx(Accordion.Header, { style: { flex: 1 }, children: /* @__PURE__ */ jsx(Accordion.Trigger, { description: key, children: key }) }),
1316
+ /* @__PURE__ */ jsx(Accordion.Header, { style: { flex: 1 }, children: /* @__PURE__ */ jsxs(Accordion.Trigger, { description: key, children: [
1317
+ key,
1318
+ " ",
1319
+ t2("plugin_settings.tree_item_count", { count: getCheckedStateCount(value) })
1320
+ ] }) }),
1298
1321
  /* @__PURE__ */ jsx(
1299
1322
  SwitchImpl,
1300
1323
  {
@@ -1409,8 +1432,6 @@ const ContentTransferSetup = () => {
1409
1432
  }
1410
1433
  };
1411
1434
  const onTreeItemClick = (keys2, currentValue) => {
1412
- console.log("keys", keys2);
1413
- console.log("currentValue", currentValue);
1414
1435
  setFormModel((prevState) => {
1415
1436
  const modelName = keys2[0].split(".")[0];
1416
1437
  let arrayIndex;
@@ -1463,8 +1484,6 @@ const ContentTransferSetup = () => {
1463
1484
  );
1464
1485
  setFormModel(computedFormModel);
1465
1486
  setOriginalFormModel(cloneDeep(computedFormModel));
1466
- console.log("computedFormModel");
1467
- console.log(computedFormModel);
1468
1487
  const localHasModelChanged = await hasModelChanged(localizableTree, storedContentTransferSetup.setup);
1469
1488
  setShowModalChangedAlert(localHasModelChanged);
1470
1489
  setHasUnsavedChanges(localHasModelChanged);
@@ -2,10 +2,10 @@
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 isEqual = require("./isEqual-B-YVnzrp.js");
6
- const set = require("./set-DUdH3vE5.js");
5
+ const isEqual = require("./isEqual--zmPN5yr.js");
6
+ const set = require("./set-DDy9ZASU.js");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const hasModelChanged = require("./has-model-changed-BMCQX2Dd.js");
8
+ const hasModelChanged = require("./has-model-changed-9PCipZvK.js");
9
9
  const styled = require("styled-components");
10
10
  const _interopDefault = (e2) => e2 && e2.__esModule ? e2 : { default: e2 };
11
11
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -1247,6 +1247,7 @@ function flattenObject(obj, delimiter = ".") {
1247
1247
  return nobj;
1248
1248
  }
1249
1249
  const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
1250
+ const { t: t2 } = set.useTranslation();
1250
1251
  const [, setIsExpanded] = React.useState(initiallyExpanded);
1251
1252
  React.useEffect(() => {
1252
1253
  setIsExpanded(initiallyExpanded);
@@ -1260,6 +1261,24 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
1260
1261
  }
1261
1262
  return false;
1262
1263
  };
1264
+ const getCheckedStateCount = (value) => {
1265
+ if (typeof value === "undefined" || value === null) {
1266
+ return 0;
1267
+ }
1268
+ if (typeof value === "boolean") {
1269
+ return value ? 1 : 0;
1270
+ }
1271
+ if (Array.isArray(value)) {
1272
+ return value.reduce((acc, v) => acc + getCheckedStateCount(v), 0);
1273
+ }
1274
+ if (typeof value === "object") {
1275
+ const filteredValue = Object.fromEntries(
1276
+ Object.entries(value).filter(([key]) => !["__model__", "__component__"].includes(key))
1277
+ );
1278
+ return Object.values(filteredValue).reduce((acc, v) => acc + getCheckedStateCount(v), 0);
1279
+ }
1280
+ return 0;
1281
+ };
1263
1282
  const createTree = (name, branch, path = "") => {
1264
1283
  const isBranchObject = typeof branch === "object" && branch !== null;
1265
1284
  if (isBranchObject) {
@@ -1298,7 +1317,11 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
1298
1317
  return /* @__PURE__ */ jsxRuntime.jsx(set.Box, { children: Object.entries(objects).map(([key, value]) => {
1299
1318
  return value.__model__ !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(set.Box, { borderColor: "neutral200", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(set.Accordion.Root, { size: "S", children: /* @__PURE__ */ jsxRuntime.jsxs(set.Accordion.Item, { value: key, children: [
1300
1319
  /* @__PURE__ */ jsxRuntime.jsxs(set.Flex, { alignItems: "center", justifyContent: "space-between", children: [
1301
- /* @__PURE__ */ jsxRuntime.jsx(set.Accordion.Header, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(set.Accordion.Trigger, { description: key, children: key }) }),
1320
+ /* @__PURE__ */ jsxRuntime.jsx(set.Accordion.Header, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs(set.Accordion.Trigger, { description: key, children: [
1321
+ key,
1322
+ " ",
1323
+ t2("plugin_settings.tree_item_count", { count: getCheckedStateCount(value) })
1324
+ ] }) }),
1302
1325
  /* @__PURE__ */ jsxRuntime.jsx(
1303
1326
  set.SwitchImpl,
1304
1327
  {
@@ -1413,8 +1436,6 @@ const ContentTransferSetup = () => {
1413
1436
  }
1414
1437
  };
1415
1438
  const onTreeItemClick = (keys, currentValue) => {
1416
- console.log("keys", keys);
1417
- console.log("currentValue", currentValue);
1418
1439
  setFormModel((prevState) => {
1419
1440
  const modelName = keys[0].split(".")[0];
1420
1441
  let arrayIndex;
@@ -1467,8 +1488,6 @@ const ContentTransferSetup = () => {
1467
1488
  );
1468
1489
  setFormModel(computedFormModel);
1469
1490
  setOriginalFormModel(set.cloneDeep(computedFormModel));
1470
- console.log("computedFormModel");
1471
- console.log(computedFormModel);
1472
1491
  const localHasModelChanged = await hasModelChanged.hasModelChanged(localizableTree, storedContentTransferSetup.setup);
1473
1492
  setShowModalChangedAlert(localHasModelChanged);
1474
1493
  setHasUnsavedChanges(localHasModelChanged);
@@ -1,10 +1,10 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
- import { u as useTranslation, c as Flex, B as Button, p as ForwardRef$4z, d as Box, A as Alert, T as Typography, q as Field, r as Toggle, M as MultiSelect, t as MultiSelectOption, D as Divider, v as SingleSelect, w as SingleSelectOption, P as PluginSettingsService$1, n as cloneDeep, s as set } from "./set-DulHAQhq.mjs";
3
+ import { u as useTranslation, c as Flex, B as Button, p as ForwardRef$4z, d as Box, A as Alert, T as Typography, q as Field, r as Toggle, M as MultiSelect, t as MultiSelectOption, D as Divider, v as SingleSelect, w as SingleSelectOption, P as PluginSettingsService$1, n as cloneDeep, s as set } from "./set-BkLLlpnD.mjs";
4
4
  import { Layouts } from "@strapi/strapi/admin";
5
- import { i as isEqual } from "./isEqual-CEyT97-3.mjs";
6
- import { L as LanguagesSelector, P as ProjectService } from "./LanguagesSelector-fyAIUp7M.mjs";
7
- import { c as createStrapiApiAxiosInstance } from "./index-CN3Gyh5F.mjs";
5
+ import { i as isEqual } from "./isEqual-DPUlu6B0.mjs";
6
+ import { L as LanguagesSelector, P as ProjectService } from "./LanguagesSelector-D2AP7FE0.mjs";
7
+ import { c as createStrapiApiAxiosInstance } from "./index-CT0CH6N8.mjs";
8
8
  class PluginSettingsService {
9
9
  static async getAdminPanelUsers() {
10
10
  try {
@@ -51,6 +51,9 @@ const GlobalSettings = () => {
51
51
  setFormModel(newFormModel);
52
52
  setHasUnsavedChanges(!isEqual(originalFormModel, newFormModel));
53
53
  };
54
+ const getUserLabel = (user) => {
55
+ return `${user.firstname} ${user.lastname || ""}${user.lastname ? " " : ""}(${user.email})`;
56
+ };
54
57
  useEffect(() => {
55
58
  async function fetchData() {
56
59
  setIsLoading(true);
@@ -199,7 +202,7 @@ const GlobalSettings = () => {
199
202
  onClear: () => patchFormModel("download.webhookAuthorId", null),
200
203
  value: formModel?.download?.webhookAuthorId || null,
201
204
  onChange: (value) => patchFormModel("download.webhookAuthorId", value),
202
- children: users.map((user) => /* @__PURE__ */ jsx(SingleSelectOption, { value: user.id, children: `${user.firstname} ${user.lastname} (${user.email})` }, user.id))
205
+ children: users.map((user) => /* @__PURE__ */ jsx(SingleSelectOption, { value: user.id, children: getUserLabel(user) }, user.id))
203
206
  }
204
207
  ),
205
208
  /* @__PURE__ */ jsx(Field.Hint, {})
@@ -2,11 +2,11 @@
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 set = require("./set-DUdH3vE5.js");
5
+ const set = require("./set-DDy9ZASU.js");
6
6
  const admin = require("@strapi/strapi/admin");
7
- const isEqual = require("./isEqual-B-YVnzrp.js");
8
- const LanguagesSelector = require("./LanguagesSelector-BeijBEjg.js");
9
- const index = require("./index-BQw2qi2G.js");
7
+ const isEqual = require("./isEqual--zmPN5yr.js");
8
+ const LanguagesSelector = require("./LanguagesSelector-DU5YJVQa.js");
9
+ const index = require("./index-Ca5_8RSo.js");
10
10
  class PluginSettingsService {
11
11
  static async getAdminPanelUsers() {
12
12
  try {
@@ -53,6 +53,9 @@ const GlobalSettings = () => {
53
53
  setFormModel(newFormModel);
54
54
  setHasUnsavedChanges(!isEqual.isEqual(originalFormModel, newFormModel));
55
55
  };
56
+ const getUserLabel = (user) => {
57
+ return `${user.firstname} ${user.lastname || ""}${user.lastname ? " " : ""}(${user.email})`;
58
+ };
56
59
  React.useEffect(() => {
57
60
  async function fetchData() {
58
61
  setIsLoading(true);
@@ -201,7 +204,7 @@ const GlobalSettings = () => {
201
204
  onClear: () => patchFormModel("download.webhookAuthorId", null),
202
205
  value: formModel?.download?.webhookAuthorId || null,
203
206
  onChange: (value) => patchFormModel("download.webhookAuthorId", value),
204
- children: users.map((user) => /* @__PURE__ */ jsxRuntime.jsx(set.SingleSelectOption, { value: user.id, children: `${user.firstname} ${user.lastname} (${user.email})` }, user.id))
207
+ children: users.map((user) => /* @__PURE__ */ jsxRuntime.jsx(set.SingleSelectOption, { value: user.id, children: getUserLabel(user) }, user.id))
205
208
  }
206
209
  ),
207
210
  /* @__PURE__ */ jsxRuntime.jsx(set.Field.Hint, {})
@@ -1,7 +1,7 @@
1
- import { c as createStrapiApiAxiosInstance } from "./index-CN3Gyh5F.mjs";
1
+ import { c as createStrapiApiAxiosInstance } from "./index-CT0CH6N8.mjs";
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { useState, useEffect } from "react";
4
- import { u as useTranslation, q as Field, M as MultiSelect, t as MultiSelectOption, n as cloneDeep } from "./set-DulHAQhq.mjs";
4
+ import { u as useTranslation, q as Field, M as MultiSelect, t as MultiSelectOption, n as cloneDeep } from "./set-BkLLlpnD.mjs";
5
5
  const strapiApiInstance = createStrapiApiAxiosInstance();
6
6
  class ProjectService {
7
7
  static async getConnectedProject() {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const index = require("./index-BQw2qi2G.js");
2
+ const index = require("./index-Ca5_8RSo.js");
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
- const set = require("./set-DUdH3vE5.js");
5
+ const set = require("./set-DDy9ZASU.js");
6
6
  const strapiApiInstance = index.createStrapiApiAxiosInstance();
7
7
  class ProjectService {
8
8
  static async getConnectedProject() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const set = require("./set-DUdH3vE5.js");
3
- const index = require("./index-BQw2qi2G.js");
2
+ const set = require("./set-DDy9ZASU.js");
3
+ const index = require("./index-Ca5_8RSo.js");
4
4
  function baseGet(object, path) {
5
5
  path = set.castPath(path, object);
6
6
  var index2 = 0, length = path.length;
@@ -1,5 +1,5 @@
1
- import { W as castPath, X as toKey, Y as Set, Z as setToArray, _ as SetCache, $ as cacheHas, g as getDefaultExportFromCjs, P as PluginSettingsService } from "./set-DulHAQhq.mjs";
2
- import { c as createStrapiApiAxiosInstance } from "./index-CN3Gyh5F.mjs";
1
+ import { W as castPath, X as toKey, Y as Set, Z as setToArray, _ as SetCache, $ as cacheHas, g as getDefaultExportFromCjs, P as PluginSettingsService } from "./set-BkLLlpnD.mjs";
2
+ import { c as createStrapiApiAxiosInstance } from "./index-CT0CH6N8.mjs";
3
3
  function baseGet(object, path) {
4
4
  path = castPath(path, object);
5
5
  var index = 0, length = path.length;