@localazy/strapi-plugin 1.0.8 → 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.
Files changed (34) hide show
  1. package/dist/_chunks/{set-CmcBsVOP.js → FetchIdentity-4kkW9N7Y.js} +141 -51
  2. package/dist/_chunks/{set-BRyy4Ra6.mjs → FetchIdentity-BWSQAXt-.mjs} +97 -7
  3. package/dist/_chunks/{LanguagesSelector-u9iDsQqB.mjs → LanguagesSelector-DwAGgpcR.mjs} +3 -3
  4. package/dist/_chunks/{LanguagesSelector-Bfrsr3-P.js → LanguagesSelector-yWC_Yb_S.js} +10 -10
  5. package/dist/_chunks/{App-Dl58PZKy.js → LocalazyApp-DnaA768k.js} +49 -34
  6. package/dist/_chunks/{App-C0ogWaOz.mjs → LocalazyApp-zySanVTu.mjs} +29 -14
  7. package/dist/_chunks/{ContentTransferSetup-ClR8Nwv2.mjs → LocalazyContentTransferSetup-C7qVIeix.mjs} +12 -8
  8. package/dist/_chunks/{ContentTransferSetup-DWQg9zDj.js → LocalazyContentTransferSetup-CeOM6bYA.js} +26 -22
  9. package/dist/_chunks/{GlobalSettings-B_h5sPwa.mjs → LocalazyGlobalSettings-QvuLdsLe.mjs} +15 -9
  10. package/dist/_chunks/{GlobalSettings-BpY7BoXu.js → LocalazyGlobalSettings-ewETL3oG.js} +58 -52
  11. package/dist/_chunks/{LocalazyPanel-BedTxk3C.js → LocalazyPanel-BXVLvFgD.js} +1 -1
  12. package/dist/_chunks/{LocalazyPanel-CuvdSJYx.mjs → LocalazyPanel-BotUsX-y.mjs} +2 -2
  13. package/dist/_chunks/{LocalazyStatusColumn-955GpXAv.mjs → LocalazyStatusColumn-C81HewMg.mjs} +1 -1
  14. package/dist/_chunks/{LocalazyStatusColumn-Bf1ntoc7.js → LocalazyStatusColumn-Dt96YcGQ.js} +1 -1
  15. package/dist/_chunks/{isEqual-BazjlHGf.mjs → RequireLocalazyAuth-CDuyGCrT.mjs} +22 -1
  16. package/dist/_chunks/{isEqual-CrlZhAtq.js → RequireLocalazyAuth-CWBWETzC.js} +50 -29
  17. package/dist/_chunks/{entry-exclusion-service-BlyFqyBY.mjs → entry-exclusion-service-BVPICve2.mjs} +1 -1
  18. package/dist/_chunks/{entry-exclusion-service-bm-lp4za.js → entry-exclusion-service-CGV6iOkB.js} +2 -2
  19. package/dist/_chunks/{has-model-changed-B5SSh8XW.js → has-model-changed-DVYRxVhM.js} +31 -31
  20. package/dist/_chunks/{has-model-changed-DIHY9LBA.mjs → has-model-changed-DZL36gWh.mjs} +2 -2
  21. package/dist/_chunks/index-CCxXsn7Z.js +254 -0
  22. package/dist/_chunks/{index-DOCSzcPH.mjs → index-CgI_aKe_.mjs} +6 -6
  23. package/dist/_chunks/index-DsrYI6aB.mjs +231 -0
  24. package/dist/_chunks/{index-C15Goe6p.mjs → strapi-api-base-BE8VMlaA.js} +7 -350
  25. package/dist/_chunks/{index-Q3-srfXc.js → strapi-api-base-DjeKGUw7.mjs} +15 -380
  26. package/dist/admin/index.js +1 -1
  27. package/dist/admin/index.mjs +1 -1
  28. package/dist/admin/src/components/RequireLocalazyAuth.d.ts +6 -0
  29. package/dist/admin/src/pages/LocalazyApp.d.ts +2 -0
  30. package/dist/admin/src/pages/LocalazyContentTransferSetup.d.ts +2 -0
  31. package/dist/admin/src/pages/LocalazyGlobalSettings.d.ts +2 -0
  32. package/dist/server/index.js +1 -1
  33. package/dist/server/index.mjs +1 -1
  34. package/package.json +1 -1
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
- const set = require("./set-CmcBsVOP.js");
3
- const index = require("./index-Q3-srfXc.js");
2
+ const FetchIdentity = require("./FetchIdentity-4kkW9N7Y.js");
3
+ const strapiApiBase = require("./strapi-api-base-BE8VMlaA.js");
4
4
  const _commonjsHelpers = require("./_commonjsHelpers-Bc2YnDe1.js");
5
5
  function baseGet(object, path) {
6
- path = set.castPath(path, object);
7
- var index2 = 0, length = path.length;
8
- while (object != null && index2 < length) {
9
- object = object[set.toKey(path[index2++])];
6
+ path = FetchIdentity.castPath(path, object);
7
+ var index = 0, length = path.length;
8
+ while (object != null && index < length) {
9
+ object = object[FetchIdentity.toKey(path[index++])];
10
10
  }
11
- return index2 && index2 == length ? object : void 0;
11
+ return index && index == length ? object : void 0;
12
12
  }
13
13
  function get(object, path, defaultValue) {
14
14
  var result = object == null ? void 0 : baseGet(object, path);
15
15
  return result === void 0 ? defaultValue : result;
16
16
  }
17
17
  const BASE_PATH = "/strapi";
18
- const strapiApiAxiosInstance = index.createStrapiApiAxiosInstance();
18
+ const strapiApiAxiosInstance = strapiApiBase.createStrapiApiAxiosInstance();
19
19
  class StrapiModelService {
20
20
  static async getModels() {
21
21
  try {
@@ -114,10 +114,10 @@ const findModelValueByKey = (allModelsTree, key) => {
114
114
  return get(objectivizedModelsTree, key);
115
115
  };
116
116
  function baseFindIndex(array, predicate, fromIndex, fromRight) {
117
- var length = array.length, index2 = fromIndex + -1;
118
- while (++index2 < length) {
119
- if (predicate(array[index2], index2, array)) {
120
- return index2;
117
+ var length = array.length, index = fromIndex + -1;
118
+ while (++index < length) {
119
+ if (predicate(array[index], index, array)) {
120
+ return index;
121
121
  }
122
122
  }
123
123
  return -1;
@@ -126,10 +126,10 @@ function baseIsNaN(value) {
126
126
  return value !== value;
127
127
  }
128
128
  function strictIndexOf(array, value, fromIndex) {
129
- var index2 = fromIndex - 1, length = array.length;
130
- while (++index2 < length) {
131
- if (array[index2] === value) {
132
- return index2;
129
+ var index = fromIndex - 1, length = array.length;
130
+ while (++index < length) {
131
+ if (array[index] === value) {
132
+ return index;
133
133
  }
134
134
  }
135
135
  return -1;
@@ -144,26 +144,26 @@ function arrayIncludes(array, value) {
144
144
  function noop() {
145
145
  }
146
146
  var INFINITY = 1 / 0;
147
- var createSet = !(set.Set && 1 / set.setToArray(new set.Set([, -0]))[1] == INFINITY) ? noop : function(values) {
148
- return new set.Set(values);
147
+ var createSet = !(FetchIdentity.Set && 1 / FetchIdentity.setToArray(new FetchIdentity.Set([, -0]))[1] == INFINITY) ? noop : function(values) {
148
+ return new FetchIdentity.Set(values);
149
149
  };
150
150
  var LARGE_ARRAY_SIZE = 200;
151
151
  function baseUniq(array, iteratee, comparator) {
152
- var index2 = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
152
+ var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
153
153
  if (length >= LARGE_ARRAY_SIZE) {
154
- var set$1 = createSet(array);
155
- if (set$1) {
156
- return set.setToArray(set$1);
154
+ var set = createSet(array);
155
+ if (set) {
156
+ return FetchIdentity.setToArray(set);
157
157
  }
158
158
  isCommon = false;
159
- includes = set.cacheHas;
160
- seen = new set.SetCache();
159
+ includes = FetchIdentity.cacheHas;
160
+ seen = new FetchIdentity.SetCache();
161
161
  } else {
162
162
  seen = result;
163
163
  }
164
164
  outer:
165
- while (++index2 < length) {
166
- var value = array[index2], computed = value;
165
+ while (++index < length) {
166
+ var value = array[index], computed = value;
167
167
  value = value !== 0 ? value : 0;
168
168
  if (isCommon && computed === computed) {
169
169
  var seenIndex = seen.length;
@@ -197,10 +197,10 @@ function deepKeys(obj, stack, parent, intermediate) {
197
197
  if (intermediate) stack.push(parent ? p : escaped);
198
198
  deepKeys(obj[el], stack, p || escaped, intermediate);
199
199
  } else if (isArray(obj[el])) {
200
- obj[el].forEach((item, index2) => {
201
- var p2 = parent ? parent + `.${escaped}.${index2}` : parent;
202
- if (intermediate) stack.push(parent ? p2 : `${escaped}.${index2}`);
203
- deepKeys(item, stack, p2 || `${escaped}.${index2}`, intermediate);
200
+ obj[el].forEach((item, index) => {
201
+ var p2 = parent ? parent + `.${escaped}.${index}` : parent;
202
+ if (intermediate) stack.push(parent ? p2 : `${escaped}.${index}`);
203
+ deepKeys(item, stack, p2 || `${escaped}.${index}`, intermediate);
204
204
  });
205
205
  } else {
206
206
  var key = parent ? parent + "." + escaped : escaped;
@@ -283,7 +283,7 @@ const hasModelChanged = async (localizableTree = null, storedSetupSchema = null,
283
283
  localizableTree = getModelsTree(models, localizableModels);
284
284
  }
285
285
  if (!storedSetupSchema) {
286
- storedSetupSchema = (await set.PluginSettingsService.getContentTransferSetup()).setup;
286
+ storedSetupSchema = (await FetchIdentity.PluginSettingsService.getContentTransferSetup()).setup;
287
287
  }
288
288
  if (!allModelsTree) {
289
289
  allModelsTree = getModelsTree(models, models);
@@ -1,5 +1,5 @@
1
- import { q as castPath, t as toKey, r as Set, d as setToArray, S as SetCache, a as cacheHas, P as PluginSettingsService } from "./set-BRyy4Ra6.mjs";
2
- import { c as createStrapiApiAxiosInstance } from "./index-C15Goe6p.mjs";
1
+ import { q as castPath, t as toKey, r as Set, d as setToArray, S as SetCache, a as cacheHas, P as PluginSettingsService } from "./FetchIdentity-BWSQAXt-.mjs";
2
+ import { c as createStrapiApiAxiosInstance } from "./strapi-api-base-DjeKGUw7.mjs";
3
3
  import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-DWwsNxpa.mjs";
4
4
  function baseGet(object, path) {
5
5
  path = castPath(path, object);
@@ -0,0 +1,254 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ const React = require("react");
25
+ const jsxRuntime = require("react/jsx-runtime");
26
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
27
+ const React__default = /* @__PURE__ */ _interopDefault(React);
28
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
29
+ const v = glob[path];
30
+ if (v) {
31
+ return typeof v === "function" ? v() : Promise.resolve(v);
32
+ }
33
+ return new Promise((_, reject) => {
34
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
35
+ reject.bind(
36
+ null,
37
+ new Error(
38
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
39
+ )
40
+ )
41
+ );
42
+ });
43
+ };
44
+ const strapi = {
45
+ name: "localazy"
46
+ };
47
+ const pluginPkg = {
48
+ strapi
49
+ };
50
+ const PLUGIN_ID = pluginPkg.strapi.name;
51
+ const Initializer = ({ setPlugin }) => {
52
+ const ref = React.useRef(setPlugin);
53
+ React.useEffect(() => {
54
+ ref.current(PLUGIN_ID);
55
+ }, []);
56
+ return null;
57
+ };
58
+ const Localazy = () => {
59
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "#8e8ea9", children: [
60
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.4517 2.56643L16.3247 2.87501L15.5632 4.67576H7.49071C7.18595 4.67576 6.98278 4.98434 7.1013 5.26333L9.05259 9.91314C9.12031 10.0695 9.27269 10.171 9.442 10.171H12.6211C12.9216 10.171 13.1247 10.4753 13.0147 10.7501L12.8919 11.046L12.1353 12.8468H10.9192C10.6187 12.8468 10.4113 13.1553 10.5298 13.4343L13.8229 21.2925C13.9626 21.6265 13.7171 21.9942 13.353 21.9942H11.3256C11.1224 21.9942 10.9362 21.8716 10.8557 21.6814L3.1056 3.17091C2.8728 2.61293 3.27915 2 3.88443 2H16.0538C16.3501 2 16.5533 2.29167 16.4517 2.56643Z" }),
61
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17.2937 13.5315L21.0354 4.63345C21.2724 4.07548 20.8619 3.45832 20.2566 3.46255L17.2267 3.46255L16.4794 5.23793C16.4794 5.24638 16.4752 5.25484 16.4709 5.26329L16.4709 5.26329L16.3482 5.55074C16.2297 5.82973 16.4371 6.1383 16.7376 6.1383H16.8069C17.1074 6.1383 17.3148 6.44688 17.1963 6.72587L15.2408 11.3757C15.1773 11.5321 15.0207 11.6335 14.8514 11.6335H13.7902L12.9112 13.7217C12.7927 14.0007 13.0001 14.3093 13.3006 14.3093H16.1212C16.6334 14.3093 17.0947 14.0007 17.2937 13.5315Z" })
62
+ ] });
63
+ };
64
+ const index = {
65
+ register(app) {
66
+ addMenuLink(app);
67
+ addSettingsSection(app);
68
+ addPlugin(app);
69
+ },
70
+ async registerTrads({ locales }) {
71
+ return Promise.all(
72
+ locales.map(async (locale) => {
73
+ try {
74
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-CMWcM0nM.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-C8Qw4iPZ.js")) }), `./translations/${locale}.json`, 3);
75
+ return { data, locale };
76
+ } catch {
77
+ return { data: {}, locale };
78
+ }
79
+ })
80
+ );
81
+ },
82
+ async bootstrap(app) {
83
+ try {
84
+ const contentManagerPlugin = app.getPlugin("content-manager");
85
+ if (contentManagerPlugin?.apis?.addEditViewSidePanel) {
86
+ const { default: LocalazyPanel } = await Promise.resolve().then(() => require("./LocalazyPanel-BXVLvFgD.js"));
87
+ const apis = contentManagerPlugin.apis;
88
+ apis.addEditViewSidePanel([LocalazyPanel]);
89
+ } else {
90
+ console.warn('Localazy Plugin: Content Manager "addEditViewSidePanel" API not available');
91
+ }
92
+ const { default: LocalazyStatusColumn } = await Promise.resolve().then(() => require("./LocalazyStatusColumn-Dt96YcGQ.js"));
93
+ app.registerHook("Admin/CM/pages/ListView/inject-column-in-table", (params) => {
94
+ try {
95
+ console.log("Localazy: Hook called with params:", params);
96
+ const { displayedHeaders, layout } = params;
97
+ if (!Array.isArray(displayedHeaders)) {
98
+ return params;
99
+ }
100
+ const localazyStatusColumn = {
101
+ name: "localazy_status",
102
+ label: "Localazy Status",
103
+ searchable: false,
104
+ sortable: false,
105
+ attribute: { type: "custom" },
106
+ cellFormatter: (data, header, context) => {
107
+ return React__default.default.createElement(LocalazyStatusColumn, {
108
+ data,
109
+ model: context?.model || ""
110
+ });
111
+ }
112
+ };
113
+ const updatedHeaders = [...displayedHeaders, localazyStatusColumn];
114
+ return {
115
+ displayedHeaders: updatedHeaders,
116
+ layout
117
+ };
118
+ } catch (error) {
119
+ console.error("Localazy: Error in hook:", error);
120
+ return params;
121
+ }
122
+ });
123
+ if (contentManagerPlugin?.apis?.addBulkAction) {
124
+ const { useNotification } = await import("@strapi/strapi/admin");
125
+ await Promise.resolve().then(() => require("./i18n-0dV2P-Hm.js"));
126
+ const { useTranslation } = await Promise.resolve().then(() => require("./index-1he9s_bs.js"));
127
+ const ExcludeFromTranslationAction = (props) => {
128
+ const { documents, model } = props;
129
+ const { toggleNotification } = useNotification();
130
+ const { t } = useTranslation();
131
+ return {
132
+ label: t("plugin_settings.bulk_action_exclude_from_translation"),
133
+ variant: "secondary",
134
+ onClick: async () => {
135
+ try {
136
+ toggleNotification({
137
+ type: "info",
138
+ message: t("plugin_settings.bulk_action_updating_entries")
139
+ });
140
+ const { default: EntryExclusionService } = await Promise.resolve().then(() => require("./entry-exclusion-service-CGV6iOkB.js"));
141
+ const documentIds = documents.map((doc) => doc.documentId);
142
+ await EntryExclusionService.setMultipleEntriesExclusion(model, documentIds, true);
143
+ toggleNotification({
144
+ type: "success",
145
+ message: t("plugin_settings.bulk_action_success_message"),
146
+ timeout: 5e3
147
+ });
148
+ } catch (error) {
149
+ console.error("Failed to exclude entries from translation:", error);
150
+ toggleNotification({
151
+ type: "danger",
152
+ message: t("plugin_settings.bulk_action_failed_message")
153
+ });
154
+ }
155
+ }
156
+ };
157
+ };
158
+ ExcludeFromTranslationAction.type = "exclude-translation";
159
+ const IncludeToTranslationAction = ({ documents, model }) => {
160
+ const { toggleNotification } = useNotification();
161
+ const { t } = useTranslation();
162
+ return {
163
+ label: t("plugin_settings.bulk_action_include_to_translation"),
164
+ variant: "secondary",
165
+ onClick: async () => {
166
+ try {
167
+ toggleNotification({
168
+ type: "info",
169
+ message: t("plugin_settings.bulk_action_updating_entries")
170
+ });
171
+ const { default: EntryExclusionService } = await Promise.resolve().then(() => require("./entry-exclusion-service-CGV6iOkB.js"));
172
+ const documentIds = documents.map((doc) => doc.documentId);
173
+ await EntryExclusionService.setMultipleEntriesExclusion(model, documentIds, false);
174
+ toggleNotification({
175
+ type: "success",
176
+ message: t("plugin_settings.bulk_action_success_message"),
177
+ timeout: 5e3
178
+ });
179
+ } catch (error) {
180
+ console.error("Failed to include entries to translation:", error);
181
+ toggleNotification({
182
+ type: "danger",
183
+ message: t("plugin_settings.bulk_action_failed_message")
184
+ });
185
+ }
186
+ }
187
+ };
188
+ };
189
+ IncludeToTranslationAction.type = "include-translation";
190
+ contentManagerPlugin.apis.addBulkAction([ExcludeFromTranslationAction, IncludeToTranslationAction]);
191
+ } else {
192
+ console.warn('Localazy Plugin: Content Manager "addBulkAction" API not available');
193
+ }
194
+ } catch (error) {
195
+ console.error("Localazy Plugin: Error adding side panel:", error);
196
+ }
197
+ }
198
+ };
199
+ const addMenuLink = (app) => {
200
+ app.addMenuLink({
201
+ to: `plugins/${PLUGIN_ID}/`,
202
+ icon: Localazy,
203
+ intlLabel: {
204
+ id: `${PLUGIN_ID}.name`,
205
+ defaultMessage: "Localazy"
206
+ },
207
+ Component: () => Promise.resolve().then(() => require("./LocalazyApp-DnaA768k.js"))
208
+ });
209
+ };
210
+ const addSettingsSection = (app) => {
211
+ app.addSettingsLink(
212
+ {
213
+ id: `${PLUGIN_ID}-settings`,
214
+ intlLabel: {
215
+ id: `${PLUGIN_ID}.localazy_settings`,
216
+ defaultMessage: "Localazy Settings"
217
+ }
218
+ },
219
+ [
220
+ // General
221
+ {
222
+ id: `${PLUGIN_ID}-settings-global`,
223
+ intlLabel: {
224
+ id: `${PLUGIN_ID}.localazy_settings`,
225
+ defaultMessage: "Localazy Settings"
226
+ },
227
+ to: `${PLUGIN_ID}/global-settings`,
228
+ Component: () => Promise.resolve().then(() => require("./LocalazyGlobalSettings-ewETL3oG.js")),
229
+ permissions: []
230
+ },
231
+ // Content Transfer Setup
232
+ {
233
+ id: `${PLUGIN_ID}-settings-content-transfer-setup`,
234
+ intlLabel: {
235
+ id: `${PLUGIN_ID}.content_transfer_setup`,
236
+ defaultMessage: "Content Transfer Setup"
237
+ },
238
+ to: `${PLUGIN_ID}/content-transfer-setup`,
239
+ Component: () => Promise.resolve().then(() => require("./LocalazyContentTransferSetup-CeOM6bYA.js")),
240
+ permissions: []
241
+ }
242
+ ]
243
+ );
244
+ };
245
+ const addPlugin = (app) => {
246
+ app.registerPlugin({
247
+ id: PLUGIN_ID,
248
+ initializer: Initializer,
249
+ isReady: false,
250
+ name: PLUGIN_ID
251
+ });
252
+ };
253
+ exports.PLUGIN_ID = PLUGIN_ID;
254
+ exports.index = index;
@@ -3,7 +3,7 @@ import React__default, { useRef, useEffect, useMemo, useCallback, createContext
3
3
  import { jsxs, Fragment as Fragment$1, jsx } from "react/jsx-runtime";
4
4
  import * as ReactDOM from "react-dom";
5
5
  import ReactDOM__default, { flushSync, createPortal } from "react-dom";
6
- import { useTheme, styled, ThemeProvider, css, createGlobalStyle, keyframes } from "styled-components";
6
+ import { useTheme, styled, css, ThemeProvider, createGlobalStyle, keyframes } from "styled-components";
7
7
  import { c as commonjsGlobal } from "./_commonjsHelpers-DWwsNxpa.mjs";
8
8
  function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
9
9
  const callbackRef = useRef(callback);
@@ -51011,17 +51011,17 @@ export {
51011
51011
  Button as B,
51012
51012
  CheckboxImpl as C,
51013
51013
  Divider as D,
51014
- Flex as F,
51014
+ Field as F,
51015
51015
  Grid as G,
51016
51016
  Loader as L,
51017
51017
  MultiSelect as M,
51018
51018
  SingleSelect as S,
51019
51019
  Typography as T,
51020
51020
  Toggle as a,
51021
- ForwardRef$4z as b,
51022
- Box as c,
51023
- Field as d,
51024
- MultiSelectOption as e,
51021
+ MultiSelectOption as b,
51022
+ Flex as c,
51023
+ ForwardRef$4z as d,
51024
+ Box as e,
51025
51025
  SingleSelectOption as f,
51026
51026
  Accordion as g,
51027
51027
  SwitchImpl as h,
@@ -0,0 +1,231 @@
1
+ import React__default, { useRef, useEffect } from "react";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
4
+ const v = glob[path];
5
+ if (v) {
6
+ return typeof v === "function" ? v() : Promise.resolve(v);
7
+ }
8
+ return new Promise((_, reject) => {
9
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
10
+ reject.bind(
11
+ null,
12
+ new Error(
13
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
14
+ )
15
+ )
16
+ );
17
+ });
18
+ };
19
+ const strapi = {
20
+ name: "localazy"
21
+ };
22
+ const pluginPkg = {
23
+ strapi
24
+ };
25
+ const PLUGIN_ID = pluginPkg.strapi.name;
26
+ const Initializer = ({ setPlugin }) => {
27
+ const ref = useRef(setPlugin);
28
+ useEffect(() => {
29
+ ref.current(PLUGIN_ID);
30
+ }, []);
31
+ return null;
32
+ };
33
+ const Localazy = () => {
34
+ return /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "#8e8ea9", children: [
35
+ /* @__PURE__ */ jsx("path", { d: "M16.4517 2.56643L16.3247 2.87501L15.5632 4.67576H7.49071C7.18595 4.67576 6.98278 4.98434 7.1013 5.26333L9.05259 9.91314C9.12031 10.0695 9.27269 10.171 9.442 10.171H12.6211C12.9216 10.171 13.1247 10.4753 13.0147 10.7501L12.8919 11.046L12.1353 12.8468H10.9192C10.6187 12.8468 10.4113 13.1553 10.5298 13.4343L13.8229 21.2925C13.9626 21.6265 13.7171 21.9942 13.353 21.9942H11.3256C11.1224 21.9942 10.9362 21.8716 10.8557 21.6814L3.1056 3.17091C2.8728 2.61293 3.27915 2 3.88443 2H16.0538C16.3501 2 16.5533 2.29167 16.4517 2.56643Z" }),
36
+ /* @__PURE__ */ jsx("path", { d: "M17.2937 13.5315L21.0354 4.63345C21.2724 4.07548 20.8619 3.45832 20.2566 3.46255L17.2267 3.46255L16.4794 5.23793C16.4794 5.24638 16.4752 5.25484 16.4709 5.26329L16.4709 5.26329L16.3482 5.55074C16.2297 5.82973 16.4371 6.1383 16.7376 6.1383H16.8069C17.1074 6.1383 17.3148 6.44688 17.1963 6.72587L15.2408 11.3757C15.1773 11.5321 15.0207 11.6335 14.8514 11.6335H13.7902L12.9112 13.7217C12.7927 14.0007 13.0001 14.3093 13.3006 14.3093H16.1212C16.6334 14.3093 17.0947 14.0007 17.2937 13.5315Z" })
37
+ ] });
38
+ };
39
+ const index = {
40
+ register(app) {
41
+ addMenuLink(app);
42
+ addSettingsSection(app);
43
+ addPlugin(app);
44
+ },
45
+ async registerTrads({ locales }) {
46
+ return Promise.all(
47
+ locales.map(async (locale) => {
48
+ try {
49
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-RX915msK.mjs"), "./translations/fr.json": () => import("./fr-hkSxFuzl.mjs") }), `./translations/${locale}.json`, 3);
50
+ return { data, locale };
51
+ } catch {
52
+ return { data: {}, locale };
53
+ }
54
+ })
55
+ );
56
+ },
57
+ async bootstrap(app) {
58
+ try {
59
+ const contentManagerPlugin = app.getPlugin("content-manager");
60
+ if (contentManagerPlugin?.apis?.addEditViewSidePanel) {
61
+ const { default: LocalazyPanel } = await import("./LocalazyPanel-BotUsX-y.mjs");
62
+ const apis = contentManagerPlugin.apis;
63
+ apis.addEditViewSidePanel([LocalazyPanel]);
64
+ } else {
65
+ console.warn('Localazy Plugin: Content Manager "addEditViewSidePanel" API not available');
66
+ }
67
+ const { default: LocalazyStatusColumn } = await import("./LocalazyStatusColumn-C81HewMg.mjs");
68
+ app.registerHook("Admin/CM/pages/ListView/inject-column-in-table", (params) => {
69
+ try {
70
+ console.log("Localazy: Hook called with params:", params);
71
+ const { displayedHeaders, layout } = params;
72
+ if (!Array.isArray(displayedHeaders)) {
73
+ return params;
74
+ }
75
+ const localazyStatusColumn = {
76
+ name: "localazy_status",
77
+ label: "Localazy Status",
78
+ searchable: false,
79
+ sortable: false,
80
+ attribute: { type: "custom" },
81
+ cellFormatter: (data, header, context) => {
82
+ return React__default.createElement(LocalazyStatusColumn, {
83
+ data,
84
+ model: context?.model || ""
85
+ });
86
+ }
87
+ };
88
+ const updatedHeaders = [...displayedHeaders, localazyStatusColumn];
89
+ return {
90
+ displayedHeaders: updatedHeaders,
91
+ layout
92
+ };
93
+ } catch (error) {
94
+ console.error("Localazy: Error in hook:", error);
95
+ return params;
96
+ }
97
+ });
98
+ if (contentManagerPlugin?.apis?.addBulkAction) {
99
+ const { useNotification } = await import("@strapi/strapi/admin");
100
+ await import("./i18n-RoETLXdU.mjs");
101
+ const { useTranslation } = await import("./index-BIbKC7-V.mjs");
102
+ const ExcludeFromTranslationAction = (props) => {
103
+ const { documents, model } = props;
104
+ const { toggleNotification } = useNotification();
105
+ const { t } = useTranslation();
106
+ return {
107
+ label: t("plugin_settings.bulk_action_exclude_from_translation"),
108
+ variant: "secondary",
109
+ onClick: async () => {
110
+ try {
111
+ toggleNotification({
112
+ type: "info",
113
+ message: t("plugin_settings.bulk_action_updating_entries")
114
+ });
115
+ const { default: EntryExclusionService } = await import("./entry-exclusion-service-BVPICve2.mjs");
116
+ const documentIds = documents.map((doc) => doc.documentId);
117
+ await EntryExclusionService.setMultipleEntriesExclusion(model, documentIds, true);
118
+ toggleNotification({
119
+ type: "success",
120
+ message: t("plugin_settings.bulk_action_success_message"),
121
+ timeout: 5e3
122
+ });
123
+ } catch (error) {
124
+ console.error("Failed to exclude entries from translation:", error);
125
+ toggleNotification({
126
+ type: "danger",
127
+ message: t("plugin_settings.bulk_action_failed_message")
128
+ });
129
+ }
130
+ }
131
+ };
132
+ };
133
+ ExcludeFromTranslationAction.type = "exclude-translation";
134
+ const IncludeToTranslationAction = ({ documents, model }) => {
135
+ const { toggleNotification } = useNotification();
136
+ const { t } = useTranslation();
137
+ return {
138
+ label: t("plugin_settings.bulk_action_include_to_translation"),
139
+ variant: "secondary",
140
+ onClick: async () => {
141
+ try {
142
+ toggleNotification({
143
+ type: "info",
144
+ message: t("plugin_settings.bulk_action_updating_entries")
145
+ });
146
+ const { default: EntryExclusionService } = await import("./entry-exclusion-service-BVPICve2.mjs");
147
+ const documentIds = documents.map((doc) => doc.documentId);
148
+ await EntryExclusionService.setMultipleEntriesExclusion(model, documentIds, false);
149
+ toggleNotification({
150
+ type: "success",
151
+ message: t("plugin_settings.bulk_action_success_message"),
152
+ timeout: 5e3
153
+ });
154
+ } catch (error) {
155
+ console.error("Failed to include entries to translation:", error);
156
+ toggleNotification({
157
+ type: "danger",
158
+ message: t("plugin_settings.bulk_action_failed_message")
159
+ });
160
+ }
161
+ }
162
+ };
163
+ };
164
+ IncludeToTranslationAction.type = "include-translation";
165
+ contentManagerPlugin.apis.addBulkAction([ExcludeFromTranslationAction, IncludeToTranslationAction]);
166
+ } else {
167
+ console.warn('Localazy Plugin: Content Manager "addBulkAction" API not available');
168
+ }
169
+ } catch (error) {
170
+ console.error("Localazy Plugin: Error adding side panel:", error);
171
+ }
172
+ }
173
+ };
174
+ const addMenuLink = (app) => {
175
+ app.addMenuLink({
176
+ to: `plugins/${PLUGIN_ID}/`,
177
+ icon: Localazy,
178
+ intlLabel: {
179
+ id: `${PLUGIN_ID}.name`,
180
+ defaultMessage: "Localazy"
181
+ },
182
+ Component: () => import("./LocalazyApp-zySanVTu.mjs")
183
+ });
184
+ };
185
+ const addSettingsSection = (app) => {
186
+ app.addSettingsLink(
187
+ {
188
+ id: `${PLUGIN_ID}-settings`,
189
+ intlLabel: {
190
+ id: `${PLUGIN_ID}.localazy_settings`,
191
+ defaultMessage: "Localazy Settings"
192
+ }
193
+ },
194
+ [
195
+ // General
196
+ {
197
+ id: `${PLUGIN_ID}-settings-global`,
198
+ intlLabel: {
199
+ id: `${PLUGIN_ID}.localazy_settings`,
200
+ defaultMessage: "Localazy Settings"
201
+ },
202
+ to: `${PLUGIN_ID}/global-settings`,
203
+ Component: () => import("./LocalazyGlobalSettings-QvuLdsLe.mjs"),
204
+ permissions: []
205
+ },
206
+ // Content Transfer Setup
207
+ {
208
+ id: `${PLUGIN_ID}-settings-content-transfer-setup`,
209
+ intlLabel: {
210
+ id: `${PLUGIN_ID}.content_transfer_setup`,
211
+ defaultMessage: "Content Transfer Setup"
212
+ },
213
+ to: `${PLUGIN_ID}/content-transfer-setup`,
214
+ Component: () => import("./LocalazyContentTransferSetup-C7qVIeix.mjs"),
215
+ permissions: []
216
+ }
217
+ ]
218
+ );
219
+ };
220
+ const addPlugin = (app) => {
221
+ app.registerPlugin({
222
+ id: PLUGIN_ID,
223
+ initializer: Initializer,
224
+ isReady: false,
225
+ name: PLUGIN_ID
226
+ });
227
+ };
228
+ export {
229
+ PLUGIN_ID as P,
230
+ index as i
231
+ };