@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.
Files changed (69) hide show
  1. package/README.md +30 -0
  2. package/dist/_chunks/{FetchIdentity-BJGoZPpM.mjs → FetchIdentity-Bm7bc5bS.mjs} +36 -44
  3. package/dist/_chunks/{FetchIdentity-CtBRO-Cn.js → FetchIdentity-CcEjakiz.js} +25 -33
  4. package/dist/_chunks/{LanguagesSelector-DJxgCwgM.mjs → LanguagesSelector-B1rwN7-Y.mjs} +4 -3
  5. package/dist/_chunks/{LanguagesSelector-CNaKrS-m.js → LanguagesSelector-DejYCwBl.js} +4 -3
  6. package/dist/_chunks/{LocalazyApp-CJRpsTKr.mjs → LocalazyApp-C4kbsnQh.mjs} +148 -35
  7. package/dist/_chunks/{LocalazyApp-B1qCCEPe.js → LocalazyApp-jPO7Yr1S.js} +154 -41
  8. package/dist/_chunks/{LocalazyContentTransferSetup-CLAWn95U.mjs → LocalazyContentTransferSetup-C1wDD9hA.mjs} +58 -22
  9. package/dist/_chunks/{LocalazyContentTransferSetup-CCxiLHdG.js → LocalazyContentTransferSetup-DZh4ZdSi.js} +63 -27
  10. package/dist/_chunks/{LocalazyGlobalSettings-BJ5qfFfK.js → LocalazyGlobalSettings-D76it6rn.js} +57 -26
  11. package/dist/_chunks/{LocalazyGlobalSettings-Z-4Ykc_J.mjs → LocalazyGlobalSettings-DOW5rjLn.mjs} +56 -25
  12. package/dist/_chunks/{LocalazyPanel-CL_mzzfD.mjs → LocalazyPanel-C_Z4W49T.mjs} +12 -6
  13. package/dist/_chunks/{LocalazyPanel-DE3TtHOQ.js → LocalazyPanel-D2LQpqii.js} +14 -8
  14. package/dist/_chunks/{LocalazyStatusColumn-R5n6q_cx.mjs → LocalazyStatusColumn-C_ZCd_s7.mjs} +10 -4
  15. package/dist/_chunks/{LocalazyStatusColumn-BMLcklG-.js → LocalazyStatusColumn-Dy6N4_X6.js} +10 -4
  16. package/dist/_chunks/{RequireLocalazyAuth-WKKFdQlR.js → RequireLocalazyAuth-BVwF0bRC.js} +31 -4
  17. package/dist/_chunks/{RequireLocalazyAuth-Dzsu6UNS.mjs → RequireLocalazyAuth-DNhTZZ_6.mjs} +32 -5
  18. package/dist/_chunks/{entry-exclusion-service-DxqTlZFR.mjs → entry-exclusion-service-CF_yNCly.mjs} +1 -1
  19. package/dist/_chunks/{entry-exclusion-service-CggmAKxq.js → entry-exclusion-service-CH3ZoJQN.js} +1 -1
  20. package/dist/_chunks/{has-model-changed-FMGVcFHU.mjs → has-model-changed-CVJEuGxM.mjs} +2 -2
  21. package/dist/_chunks/{has-model-changed-BR53L6pA.js → has-model-changed-DdYbyv0v.js} +2 -2
  22. package/dist/_chunks/{i18n-QelOdIB2.mjs → i18n-76ox2llT.mjs} +9 -2
  23. package/dist/_chunks/{i18n-CAsbU4pi.js → i18n-C5ucROBh.js} +9 -2
  24. package/dist/_chunks/{index-BmxGKspv.js → index-CEGaWWh3.js} +33 -11
  25. package/dist/_chunks/{index-BK7lmZSN.js → index-CTkxoioB.js} +1 -0
  26. package/dist/_chunks/{index-toauQlIK.mjs → index-DP2ugzc_.mjs} +34 -12
  27. package/dist/_chunks/{index-CHjIMO9T.mjs → index-shryj0jT.mjs} +19 -18
  28. package/dist/_chunks/{strapi-api-base-CT9lknwW.js → strapi-api-base-CCUuu7EY.js} +1 -1
  29. package/dist/_chunks/{strapi-api-base-BflplVsH.mjs → strapi-api-base-IiMEtDoH.mjs} +1 -1
  30. package/dist/admin/index.js +1 -1
  31. package/dist/admin/index.mjs +1 -1
  32. package/dist/admin/src/components/LocalazyStatusColumn.d.ts +1 -1
  33. package/dist/admin/src/constants/permissions.d.ts +29 -0
  34. package/dist/admin/src/modules/@common/components/LanguagesSelector.d.ts +1 -0
  35. package/dist/admin/src/modules/activity-logs/locale/en.d.ts +4 -0
  36. package/dist/admin/src/modules/activity-logs/services/debug-bundle-service.d.ts +10 -0
  37. package/dist/admin/src/modules/login/locale/en.d.ts +1 -0
  38. package/dist/admin/src/modules/plugin-settings/components/Tree.d.ts +1 -0
  39. package/dist/admin/src/modules/plugin-settings/components/TreeItem.d.ts +1 -0
  40. package/dist/admin/src/modules/plugin-settings/components/WebhookSetup.d.ts +4 -1
  41. package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +2 -0
  42. package/dist/admin/src/modules/plugin-settings/services/plugin-settings-service.d.ts +4 -0
  43. package/dist/server/index.js +665 -38
  44. package/dist/server/index.mjs +665 -39
  45. package/dist/server/src/bootstrap.d.ts +1 -1
  46. package/dist/server/src/constants/permissions.d.ts +38 -0
  47. package/dist/server/src/controllers/debug-bundle-controller.d.ts +7 -0
  48. package/dist/server/src/controllers/index.d.ts +6 -0
  49. package/dist/server/src/controllers/plugin-settings-controller.d.ts +1 -0
  50. package/dist/server/src/core/index.d.ts +5 -1
  51. package/dist/server/src/db/model/activity-logs.d.ts +10 -0
  52. package/dist/server/src/index.d.ts +64 -8
  53. package/dist/server/src/routes/activity-logs-routes.d.ts +20 -3
  54. package/dist/server/src/routes/debug-bundle-routes.d.ts +14 -0
  55. package/dist/server/src/routes/entry-exclusion-routes.d.ts +20 -3
  56. package/dist/server/src/routes/index.d.ts +52 -6
  57. package/dist/server/src/routes/localazy-auth-routes.d.ts +6 -1
  58. package/dist/server/src/routes/localazy-project-routes.d.ts +20 -3
  59. package/dist/server/src/routes/localazy-transfer-routes.d.ts +6 -1
  60. package/dist/server/src/routes/localazy-user-routes.d.ts +20 -3
  61. package/dist/server/src/routes/plugin-settings-routes.d.ts +20 -3
  62. package/dist/server/src/routes/strapi-routes.d.ts +20 -3
  63. package/dist/server/src/services/activity-logs-service.d.ts +3 -1
  64. package/dist/server/src/services/index.d.ts +5 -1
  65. package/dist/server/src/services/localazy-transfer-download-service.d.ts +2 -1
  66. package/dist/server/src/services/plugin-settings-service.d.ts +4 -0
  67. package/dist/server/src/utils/build-debug-bundle.d.ts +68 -0
  68. package/dist/server/src/utils/sanitize-debug-bundle.d.ts +25 -0
  69. package/package.json +2 -1
package/README.md CHANGED
@@ -71,6 +71,36 @@ localazy: {
71
71
  },
72
72
  ```
73
73
 
74
+ ## 🔐 Access control (RBAC)
75
+
76
+ The plugin registers four Strapi permission actions, all visible under
77
+ **Settings → Administration Panel → Roles → Plugins → Localazy** (grouped
78
+ by `General` and `Settings` sub-categories):
79
+
80
+ | Action | Unlocks |
81
+ | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82
+ | `Localazy → Read` (`plugin::localazy.read`) | Localazy menu link, Overview, Activity Logs (list + detail), Content-Manager side panel & Localazy status column, read endpoints (identity, project, models, plugin settings, **content-transfer-setup**, sync cursor, activity logs, troubleshooting bundle, entry-exclusion state). |
83
+ | `Localazy → Transfer` (`plugin::localazy.transfer`) | Upload, Download, Entry Exclusion mutations (incl. Content-Manager bulk actions), Activity Log session clearing. Reading the content-transfer-setup is bundled under `Read` above so transfer-only roles can still open the Upload/Download pages. |
84
+ | `Localazy → Settings → Read` (`plugin::localazy.settings.read`) | Adds the Localazy Settings menu links (Global Settings, Content Transfer Setup) to the admin sidebar. Form controls render read-only — Save, Cancel, the Content Transfer Setup tree, and the webhook setup buttons are disabled without `Settings → Update`. |
85
+ | `Localazy → Settings → Update` (`plugin::localazy.settings.update`) | **Connecting / disconnecting the Localazy account**, webhook setup, updating Content Transfer Setup, and updating Global Settings. |
86
+
87
+ > **Note:** the **Webhook author** picker in _Localazy Settings → Global
88
+ > Settings_ populates from Strapi's core `/admin/users` endpoint, which is
89
+ > gated by Strapi's own `admin::users.read` permission — independent of the
90
+ > plugin's actions. A role with only the plugin's `Settings → Read` will
91
+ > still see the rest of the page; the author dropdown silently falls back
92
+ > to an empty list.
93
+
94
+ Server is the enforcement perimeter — all admin-typed plugin routes are
95
+ gated by `admin::hasPermissions`, so UI gates are convenience only.
96
+
97
+ ### Upgrade note
98
+
99
+ Strapi grants new actions to the **Super Admin** role automatically. **Other
100
+ roles (Editor, Author, custom roles) keep no Localazy access until an admin
101
+ re-grants the actions** under _Settings → Administration Panel → Roles →
102
+ Plugins → Localazy_. Plan this step when upgrading from `<= 1.4.x`.
103
+
74
104
  ## 🛟 Support
75
105
 
76
106
  If you encounter any issues or have questions, feel free to contact us through whichever channel suits you best:
@@ -1,8 +1,9 @@
1
- import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-BflplVsH.mjs";
2
- import { U as darkTheme, V as lightTheme } from "./index-CHjIMO9T.mjs";
1
+ import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-IiMEtDoH.mjs";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { c as Flex, L as Loader, V as darkTheme, W as lightTheme } from "./index-shryj0jT.mjs";
4
+ import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
3
5
  import { createGlobalStyle } from "styled-components";
4
6
  import { useState, useMemo, createContext, useContext, useEffect } from "react";
5
- import { jsx } from "react/jsx-runtime";
6
7
  const emptyIdentity = {
7
8
  accessToken: "",
8
9
  project: {
@@ -72,6 +73,17 @@ class PluginSettingsService {
72
73
  throw e;
73
74
  }
74
75
  }
76
+ // Read-gated counterpart for per-user UI prefs (last visited route, sort
77
+ // prefs). Server filters the body to a fixed allowlist; sending anything else
78
+ // is silently dropped, so callers must only pass UI-pref fields here.
79
+ static async updatePluginSettingsUiPrefs(data) {
80
+ try {
81
+ const result = await axiosInstance.put(`${BASE_PATH$1}/ui-prefs`, data);
82
+ return result.data;
83
+ } catch (e) {
84
+ throw e;
85
+ }
86
+ }
75
87
  static async getSyncCursor() {
76
88
  try {
77
89
  const result = await axiosInstance.get(`${BASE_PATH$1}/sync-cursor`);
@@ -81,6 +93,10 @@ class PluginSettingsService {
81
93
  }
82
94
  }
83
95
  }
96
+ function PluginPageLoader() {
97
+ const { t } = useTranslation();
98
+ return /* @__PURE__ */ jsx(Flex, { marginTop: 10, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx(Loader, { children: t("common.loading_content") }) });
99
+ }
84
100
  const BASE_PATH = "/user";
85
101
  const strapiApiInstance = createStrapiApiAxiosInstance();
86
102
  class LocalazyUserService {
@@ -501,9 +517,9 @@ function cacheHas(cache, key) {
501
517
  return cache.has(key);
502
518
  }
503
519
  var Set = getNative(root, "Set");
504
- function setToArray(set2) {
505
- var index = -1, result = Array(set2.size);
506
- set2.forEach(function(value) {
520
+ function setToArray(set) {
521
+ var index = -1, result = Array(set.size);
522
+ set.forEach(function(value) {
507
523
  result[++index] = value;
508
524
  });
509
525
  return result;
@@ -937,32 +953,6 @@ var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
937
953
  function cloneDeep(value) {
938
954
  return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
939
955
  }
940
- function baseSet(object, path, value, customizer) {
941
- if (!isObject(object)) {
942
- return object;
943
- }
944
- path = castPath(path, object);
945
- var index = -1, length = path.length, lastIndex = length - 1, nested = object;
946
- while (nested != null && ++index < length) {
947
- var key = toKey(path[index]), newValue = value;
948
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
949
- return object;
950
- }
951
- if (index != lastIndex) {
952
- var objValue = nested[key];
953
- newValue = void 0;
954
- if (newValue === void 0) {
955
- newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
956
- }
957
- }
958
- assignValue(nested, key, newValue);
959
- nested = nested[key];
960
- }
961
- return object;
962
- }
963
- function set(object, path, value) {
964
- return object == null ? object : baseSet(object, path, value);
965
- }
966
956
  const FetchIdentity = () => {
967
957
  const { setIdentity, setIsFetchingIdentity } = useLocalazyIdentity();
968
958
  useEffect(() => {
@@ -991,10 +981,10 @@ export {
991
981
  PluginSettingsService as P,
992
982
  SetCache as S,
993
983
  Uint8Array as U,
994
- cacheHas as a,
995
- Symbol$1 as b,
984
+ PluginPageLoader as a,
985
+ cacheHas as b,
996
986
  cloneDeep as c,
997
- setToArray as d,
987
+ Symbol$1 as d,
998
988
  eq as e,
999
989
  getAllKeys as f,
1000
990
  getDefaultTheme as g,
@@ -1004,15 +994,17 @@ export {
1004
994
  isTypedArray as k,
1005
995
  isArray as l,
1006
996
  isObjectLike as m,
1007
- keys as n,
1008
- isArrayLike as o,
1009
- arrayEach as p,
1010
- isObject as q,
1011
- castPath as r,
1012
- set as s,
997
+ isObject as n,
998
+ castPath as o,
999
+ isIndex as p,
1000
+ assignValue as q,
1001
+ keys as r,
1002
+ setToArray as s,
1013
1003
  toKey as t,
1014
1004
  useLocalazyIdentity as u,
1015
- Set as v,
1016
- LocalazyUserService as w,
1017
- emptyIdentity as x
1005
+ isArrayLike as v,
1006
+ arrayEach as w,
1007
+ Set as x,
1008
+ LocalazyUserService as y,
1009
+ emptyIdentity as z
1018
1010
  };
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
- const strapiApiBase = require("./strapi-api-base-CT9lknwW.js");
3
- const index = require("./index-BK7lmZSN.js");
2
+ const strapiApiBase = require("./strapi-api-base-CCUuu7EY.js");
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const index = require("./index-CTkxoioB.js");
5
+ const useTranslation = require("./useTranslation-BdIl-aLe.js");
4
6
  const styled = require("styled-components");
5
7
  const React = require("react");
6
- const jsxRuntime = require("react/jsx-runtime");
7
8
  const emptyIdentity = {
8
9
  accessToken: "",
9
10
  project: {
@@ -73,6 +74,17 @@ class PluginSettingsService {
73
74
  throw e;
74
75
  }
75
76
  }
77
+ // Read-gated counterpart for per-user UI prefs (last visited route, sort
78
+ // prefs). Server filters the body to a fixed allowlist; sending anything else
79
+ // is silently dropped, so callers must only pass UI-pref fields here.
80
+ static async updatePluginSettingsUiPrefs(data) {
81
+ try {
82
+ const result = await axiosInstance.put(`${BASE_PATH$1}/ui-prefs`, data);
83
+ return result.data;
84
+ } catch (e) {
85
+ throw e;
86
+ }
87
+ }
76
88
  static async getSyncCursor() {
77
89
  try {
78
90
  const result = await axiosInstance.get(`${BASE_PATH$1}/sync-cursor`);
@@ -82,6 +94,10 @@ class PluginSettingsService {
82
94
  }
83
95
  }
84
96
  }
97
+ function PluginPageLoader() {
98
+ const { t } = useTranslation.useTranslation();
99
+ return /* @__PURE__ */ jsxRuntime.jsx(index.Flex, { marginTop: 10, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(index.Loader, { children: t("common.loading_content") }) });
100
+ }
85
101
  const BASE_PATH = "/user";
86
102
  const strapiApiInstance = strapiApiBase.createStrapiApiAxiosInstance();
87
103
  class LocalazyUserService {
@@ -502,9 +518,9 @@ function cacheHas(cache, key) {
502
518
  return cache.has(key);
503
519
  }
504
520
  var Set = getNative(root, "Set");
505
- function setToArray(set2) {
506
- var index2 = -1, result = Array(set2.size);
507
- set2.forEach(function(value) {
521
+ function setToArray(set) {
522
+ var index2 = -1, result = Array(set.size);
523
+ set.forEach(function(value) {
508
524
  result[++index2] = value;
509
525
  });
510
526
  return result;
@@ -938,32 +954,6 @@ var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
938
954
  function cloneDeep(value) {
939
955
  return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
940
956
  }
941
- function baseSet(object, path, value, customizer) {
942
- if (!isObject(object)) {
943
- return object;
944
- }
945
- path = castPath(path, object);
946
- var index2 = -1, length = path.length, lastIndex = length - 1, nested = object;
947
- while (nested != null && ++index2 < length) {
948
- var key = toKey(path[index2]), newValue = value;
949
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
950
- return object;
951
- }
952
- if (index2 != lastIndex) {
953
- var objValue = nested[key];
954
- newValue = void 0;
955
- if (newValue === void 0) {
956
- newValue = isObject(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
957
- }
958
- }
959
- assignValue(nested, key, newValue);
960
- nested = nested[key];
961
- }
962
- return object;
963
- }
964
- function set(object, path, value) {
965
- return object == null ? object : baseSet(object, path, value);
966
- }
967
957
  const FetchIdentity = () => {
968
958
  const { setIdentity, setIsFetchingIdentity } = useLocalazyIdentity();
969
959
  React.useEffect(() => {
@@ -989,6 +979,7 @@ exports.FetchIdentity = FetchIdentity;
989
979
  exports.HeadingFixGlobalStyle = HeadingFixGlobalStyle;
990
980
  exports.LocalazyIdentityProvider = LocalazyIdentityProvider;
991
981
  exports.LocalazyUserService = LocalazyUserService;
982
+ exports.PluginPageLoader = PluginPageLoader;
992
983
  exports.PluginSettingsService = PluginSettingsService;
993
984
  exports.Set = Set;
994
985
  exports.SetCache = SetCache;
@@ -996,6 +987,7 @@ exports.Stack = Stack;
996
987
  exports.Symbol = Symbol$1;
997
988
  exports.Uint8Array = Uint8Array;
998
989
  exports.arrayEach = arrayEach;
990
+ exports.assignValue = assignValue;
999
991
  exports.cacheHas = cacheHas;
1000
992
  exports.castPath = castPath;
1001
993
  exports.cloneDeep = cloneDeep;
@@ -1006,11 +998,11 @@ exports.getDefaultTheme = getDefaultTheme;
1006
998
  exports.isArray = isArray;
1007
999
  exports.isArrayLike = isArrayLike;
1008
1000
  exports.isBuffer = isBuffer;
1001
+ exports.isIndex = isIndex;
1009
1002
  exports.isObject = isObject;
1010
1003
  exports.isObjectLike = isObjectLike;
1011
1004
  exports.isTypedArray = isTypedArray;
1012
1005
  exports.keys = keys;
1013
- exports.set = set;
1014
1006
  exports.setToArray = setToArray;
1015
1007
  exports.toKey = toKey;
1016
1008
  exports.useLocalazyIdentity = useLocalazyIdentity;
@@ -1,8 +1,8 @@
1
- import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-BflplVsH.mjs";
1
+ import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-IiMEtDoH.mjs";
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { useState, useEffect } from "react";
4
- import { c as cloneDeep } from "./FetchIdentity-BJGoZPpM.mjs";
5
- import { F as Field, M as MultiSelect, b as MultiSelectOption } from "./index-CHjIMO9T.mjs";
4
+ import { c as cloneDeep } from "./FetchIdentity-Bm7bc5bS.mjs";
5
+ import { F as Field, M as MultiSelect, b as MultiSelectOption } from "./index-shryj0jT.mjs";
6
6
  import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
7
7
  const strapiApiInstance = createStrapiApiAxiosInstance();
8
8
  class ProjectService {
@@ -48,6 +48,7 @@ const LanguagesSelector = (props) => {
48
48
  onClear: () => setSelectedLanguages([]),
49
49
  value: selectedLanguages || [],
50
50
  onChange: (values) => onChange(values),
51
+ disabled: props.disabled,
51
52
  multi: true,
52
53
  withTags: true,
53
54
  children: props.projectLanguages.map((lang) => /* @__PURE__ */ jsx(MultiSelectOption, { value: lang.code, children: `${lang.name} (${lang.code})` }, lang.id))
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- const strapiApiBase = require("./strapi-api-base-CT9lknwW.js");
2
+ const strapiApiBase = require("./strapi-api-base-CCUuu7EY.js");
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
- const FetchIdentity = require("./FetchIdentity-CtBRO-Cn.js");
6
- const index = require("./index-BK7lmZSN.js");
5
+ const FetchIdentity = require("./FetchIdentity-CcEjakiz.js");
6
+ const index = require("./index-CTkxoioB.js");
7
7
  const useTranslation = require("./useTranslation-BdIl-aLe.js");
8
8
  const strapiApiInstance = strapiApiBase.createStrapiApiAxiosInstance();
9
9
  class ProjectService {
@@ -49,6 +49,7 @@ const LanguagesSelector = (props) => {
49
49
  onClear: () => setSelectedLanguages([]),
50
50
  value: selectedLanguages || [],
51
51
  onChange: (values) => onChange(values),
52
+ disabled: props.disabled,
52
53
  multi: true,
53
54
  withTags: true,
54
55
  children: props.projectLanguages.map((lang) => /* @__PURE__ */ jsxRuntime.jsx(index.MultiSelectOption, { value: lang.code, children: `${lang.name} (${lang.code})` }, lang.id))