@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
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
3
|
+
const htmlEntities = {
|
|
4
|
+
"&": "&",
|
|
5
|
+
"&": "&",
|
|
6
|
+
"<": "<",
|
|
7
|
+
"<": "<",
|
|
8
|
+
">": ">",
|
|
9
|
+
">": ">",
|
|
10
|
+
"'": "'",
|
|
11
|
+
"'": "'",
|
|
12
|
+
""": '"',
|
|
13
|
+
""": '"',
|
|
14
|
+
" ": " ",
|
|
15
|
+
" ": " ",
|
|
16
|
+
"©": "©",
|
|
17
|
+
"©": "©",
|
|
18
|
+
"®": "®",
|
|
19
|
+
"®": "®",
|
|
20
|
+
"…": "…",
|
|
21
|
+
"…": "…",
|
|
22
|
+
"/": "/",
|
|
23
|
+
"/": "/"
|
|
24
|
+
};
|
|
25
|
+
const unescapeHtmlEntity = (m) => htmlEntities[m];
|
|
26
|
+
const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
27
|
+
let defaultOptions = {
|
|
28
|
+
bindI18n: "languageChanged",
|
|
29
|
+
bindI18nStore: "",
|
|
30
|
+
transEmptyNodeValue: "",
|
|
31
|
+
transSupportBasicHtmlNodes: true,
|
|
32
|
+
transWrapTextNodes: "",
|
|
33
|
+
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
34
|
+
useSuspense: true,
|
|
35
|
+
unescape
|
|
36
|
+
};
|
|
37
|
+
const setDefaults = (options = {}) => {
|
|
38
|
+
defaultOptions = {
|
|
39
|
+
...defaultOptions,
|
|
40
|
+
...options
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const getDefaults = () => defaultOptions;
|
|
44
|
+
let i18nInstance;
|
|
45
|
+
const setI18n = (instance) => {
|
|
46
|
+
i18nInstance = instance;
|
|
47
|
+
};
|
|
48
|
+
const getI18n = () => i18nInstance;
|
|
49
|
+
const initReactI18next = {
|
|
50
|
+
type: "3rdParty",
|
|
51
|
+
init(instance) {
|
|
52
|
+
setDefaults(instance.options.react);
|
|
53
|
+
setI18n(instance);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.getDefaults = getDefaults;
|
|
57
|
+
exports.getI18n = getI18n;
|
|
58
|
+
exports.initReactI18next = initReactI18next;
|
|
59
|
+
exports.setDefaults = setDefaults;
|
|
60
|
+
exports.setI18n = setI18n;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
2
|
+
const htmlEntities = {
|
|
3
|
+
"&": "&",
|
|
4
|
+
"&": "&",
|
|
5
|
+
"<": "<",
|
|
6
|
+
"<": "<",
|
|
7
|
+
">": ">",
|
|
8
|
+
">": ">",
|
|
9
|
+
"'": "'",
|
|
10
|
+
"'": "'",
|
|
11
|
+
""": '"',
|
|
12
|
+
""": '"',
|
|
13
|
+
" ": " ",
|
|
14
|
+
" ": " ",
|
|
15
|
+
"©": "©",
|
|
16
|
+
"©": "©",
|
|
17
|
+
"®": "®",
|
|
18
|
+
"®": "®",
|
|
19
|
+
"…": "…",
|
|
20
|
+
"…": "…",
|
|
21
|
+
"/": "/",
|
|
22
|
+
"/": "/"
|
|
23
|
+
};
|
|
24
|
+
const unescapeHtmlEntity = (m) => htmlEntities[m];
|
|
25
|
+
const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
26
|
+
let defaultOptions = {
|
|
27
|
+
bindI18n: "languageChanged",
|
|
28
|
+
bindI18nStore: "",
|
|
29
|
+
transEmptyNodeValue: "",
|
|
30
|
+
transSupportBasicHtmlNodes: true,
|
|
31
|
+
transWrapTextNodes: "",
|
|
32
|
+
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
33
|
+
useSuspense: true,
|
|
34
|
+
unescape
|
|
35
|
+
};
|
|
36
|
+
const setDefaults = (options = {}) => {
|
|
37
|
+
defaultOptions = {
|
|
38
|
+
...defaultOptions,
|
|
39
|
+
...options
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const getDefaults = () => defaultOptions;
|
|
43
|
+
let i18nInstance;
|
|
44
|
+
const setI18n = (instance) => {
|
|
45
|
+
i18nInstance = instance;
|
|
46
|
+
};
|
|
47
|
+
const getI18n = () => i18nInstance;
|
|
48
|
+
const initReactI18next = {
|
|
49
|
+
type: "3rdParty",
|
|
50
|
+
init(instance) {
|
|
51
|
+
setDefaults(instance.options.react);
|
|
52
|
+
setI18n(instance);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
getDefaults as a,
|
|
57
|
+
setI18n as b,
|
|
58
|
+
getI18n as g,
|
|
59
|
+
initReactI18next as i,
|
|
60
|
+
setDefaults as s
|
|
61
|
+
};
|
|
@@ -1,81 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 getTranslation = (id) => `${PLUGIN_ID}.${id}`;
|
|
27
|
-
const Initializer = ({ setPlugin }) => {
|
|
28
|
-
const ref = useRef(setPlugin);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
ref.current(PLUGIN_ID);
|
|
31
|
-
}, []);
|
|
32
|
-
return null;
|
|
33
|
-
};
|
|
34
|
-
const Localazy = () => {
|
|
35
|
-
return /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "#8e8ea9", children: [
|
|
36
|
-
/* @__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" }),
|
|
37
|
-
/* @__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" })
|
|
38
|
-
] });
|
|
39
|
-
};
|
|
40
|
-
const emptyIdentity = {
|
|
41
|
-
accessToken: "",
|
|
42
|
-
project: {
|
|
43
|
-
id: "",
|
|
44
|
-
image: "",
|
|
45
|
-
name: "",
|
|
46
|
-
url: ""
|
|
47
|
-
},
|
|
48
|
-
scope: "",
|
|
49
|
-
user: {
|
|
50
|
-
id: "",
|
|
51
|
-
name: ""
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const LocalazyIdentityContextType = createContext(void 0);
|
|
55
|
-
const LocalazyIdentityProvider = ({ children }) => {
|
|
56
|
-
const [identity, setIdentity] = useState(emptyIdentity);
|
|
57
|
-
const [isFetchingIdentity, setIsFetchingIdentity] = useState(true);
|
|
58
|
-
const isLoggedIn = useMemo(() => !!identity.accessToken, [identity.accessToken]);
|
|
59
|
-
return /* @__PURE__ */ jsx(
|
|
60
|
-
LocalazyIdentityContextType.Provider,
|
|
61
|
-
{
|
|
62
|
-
value: { identity, setIdentity, isLoggedIn, isFetchingIdentity, setIsFetchingIdentity },
|
|
63
|
-
children
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
const useLocalazyIdentity = () => {
|
|
68
|
-
const context = useContext(LocalazyIdentityContextType);
|
|
69
|
-
if (context === void 0) {
|
|
70
|
-
throw new Error("useLocalazyIdentity must be used within a LocalazyIdentityProvider");
|
|
71
|
-
}
|
|
72
|
-
return context;
|
|
73
|
-
};
|
|
74
|
-
const localazyIdentity = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
75
|
-
__proto__: null,
|
|
76
|
-
LocalazyIdentityProvider,
|
|
77
|
-
useLocalazyIdentity
|
|
78
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1
|
+
"use strict";
|
|
2
|
+
const index = require("./index-CCxXsn7Z.js");
|
|
79
3
|
function bind(fn, thisArg) {
|
|
80
4
|
return function wrap() {
|
|
81
5
|
return fn.apply(thisArg, arguments);
|
|
@@ -2457,15 +2381,15 @@ const {
|
|
|
2457
2381
|
getAdapter,
|
|
2458
2382
|
mergeConfig
|
|
2459
2383
|
} = axios;
|
|
2460
|
-
const BASE_PLUGIN_PATH = `/${PLUGIN_ID}`;
|
|
2384
|
+
const BASE_PLUGIN_PATH = `/${index.PLUGIN_ID}`;
|
|
2461
2385
|
const JWT_TOKEN_NAME = "jwtToken";
|
|
2462
2386
|
const getToken = () => {
|
|
2463
2387
|
const jwtTokenCookie = document.cookie.split("; ").find((row) => row.startsWith(`${JWT_TOKEN_NAME}=`));
|
|
2464
2388
|
const jwtToken = jwtTokenCookie ? jwtTokenCookie.split("=")[1] : "";
|
|
2465
|
-
|
|
2389
|
+
const raw = jwtToken || localStorage.getItem(JWT_TOKEN_NAME) || sessionStorage.getItem(JWT_TOKEN_NAME) || "";
|
|
2390
|
+
return raw.replace(/^["']|["']$/g, "");
|
|
2466
2391
|
};
|
|
2467
2392
|
const createStrapiApiAxiosInstance = (baseUrl = null) => {
|
|
2468
|
-
const token = getToken();
|
|
2469
2393
|
if (baseUrl === null) {
|
|
2470
2394
|
baseUrl = `${BASE_PLUGIN_PATH}`;
|
|
2471
2395
|
}
|
|
@@ -2480,6 +2404,7 @@ const createStrapiApiAxiosInstance = (baseUrl = null) => {
|
|
|
2480
2404
|
// Add this header to identify the request as initiated by the plugin
|
|
2481
2405
|
"X-Localazy-Initiated-By": "strapi-plugin-localazy"
|
|
2482
2406
|
});
|
|
2407
|
+
const token = getToken();
|
|
2483
2408
|
if (token) {
|
|
2484
2409
|
config.headers.set("Authorization", `Bearer ${token}`);
|
|
2485
2410
|
}
|
|
@@ -2492,161 +2417,9 @@ const createStrapiApiAxiosInstance = (baseUrl = null) => {
|
|
|
2492
2417
|
instance.interceptors.response.use(
|
|
2493
2418
|
(response) => response,
|
|
2494
2419
|
(error) => {
|
|
2495
|
-
if (error.response?.status === 401) ;
|
|
2496
2420
|
throw error;
|
|
2497
2421
|
}
|
|
2498
2422
|
);
|
|
2499
2423
|
return instance;
|
|
2500
2424
|
};
|
|
2501
|
-
|
|
2502
|
-
const strapiApiInstance = createStrapiApiAxiosInstance();
|
|
2503
|
-
class LocalazyUserService {
|
|
2504
|
-
static async getIdentity() {
|
|
2505
|
-
try {
|
|
2506
|
-
const result = await strapiApiInstance.get(`${BASE_PATH}`);
|
|
2507
|
-
return result.data;
|
|
2508
|
-
} catch (e) {
|
|
2509
|
-
throw e;
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
static async updateIdentity(localazyIdentity2) {
|
|
2513
|
-
try {
|
|
2514
|
-
const result = await strapiApiInstance.put(`${BASE_PATH}`, localazyIdentity2);
|
|
2515
|
-
return result.data;
|
|
2516
|
-
} catch (e) {
|
|
2517
|
-
throw e;
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
static async deleteIdentity() {
|
|
2521
|
-
try {
|
|
2522
|
-
const result = await strapiApiInstance.delete(`${BASE_PATH}`);
|
|
2523
|
-
return result.data;
|
|
2524
|
-
} catch (e) {
|
|
2525
|
-
throw e;
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
const FetchIdentity = () => {
|
|
2530
|
-
const { setIdentity, setIsFetchingIdentity } = useLocalazyIdentity();
|
|
2531
|
-
useEffect(() => {
|
|
2532
|
-
const fetchIdentity = async () => {
|
|
2533
|
-
try {
|
|
2534
|
-
setIsFetchingIdentity(true);
|
|
2535
|
-
const fetchedIdentity = await LocalazyUserService.getIdentity();
|
|
2536
|
-
setIdentity(fetchedIdentity || emptyIdentity);
|
|
2537
|
-
} catch (error) {
|
|
2538
|
-
console.error("Error fetching identity:", error);
|
|
2539
|
-
} finally {
|
|
2540
|
-
setIsFetchingIdentity(false);
|
|
2541
|
-
}
|
|
2542
|
-
};
|
|
2543
|
-
fetchIdentity();
|
|
2544
|
-
}, [setIdentity, setIsFetchingIdentity]);
|
|
2545
|
-
return null;
|
|
2546
|
-
};
|
|
2547
|
-
const index = {
|
|
2548
|
-
register(app) {
|
|
2549
|
-
addMenuLink(app);
|
|
2550
|
-
addSettingsSection(app);
|
|
2551
|
-
addPlugin(app);
|
|
2552
|
-
},
|
|
2553
|
-
async registerTrads({ locales }) {
|
|
2554
|
-
return Promise.all(
|
|
2555
|
-
locales.map(async (locale) => {
|
|
2556
|
-
try {
|
|
2557
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-BTf8goGM.mjs"), "./translations/fr.json": () => import("./fr-hkSxFuzl.mjs") }), `./translations/${locale}.json`, 3);
|
|
2558
|
-
return { data, locale };
|
|
2559
|
-
} catch {
|
|
2560
|
-
return { data: {}, locale };
|
|
2561
|
-
}
|
|
2562
|
-
})
|
|
2563
|
-
);
|
|
2564
|
-
}
|
|
2565
|
-
};
|
|
2566
|
-
const addMenuLink = (app) => {
|
|
2567
|
-
app.addMenuLink({
|
|
2568
|
-
to: `plugins/${PLUGIN_ID}/`,
|
|
2569
|
-
icon: Localazy,
|
|
2570
|
-
intlLabel: {
|
|
2571
|
-
id: `${PLUGIN_ID}.name`,
|
|
2572
|
-
defaultMessage: getTranslation("name")
|
|
2573
|
-
},
|
|
2574
|
-
Component: async () => {
|
|
2575
|
-
const { App } = await import("./App-CtS6CrNn.mjs");
|
|
2576
|
-
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2577
|
-
const WrappedApp = () => React__default.createElement(LocalazyIdentityProvider2, {
|
|
2578
|
-
children: React__default.createElement(React__default.Fragment, {}, [
|
|
2579
|
-
React__default.createElement(FetchIdentity, {}),
|
|
2580
|
-
React__default.createElement(App, {})
|
|
2581
|
-
])
|
|
2582
|
-
});
|
|
2583
|
-
return WrappedApp;
|
|
2584
|
-
}
|
|
2585
|
-
});
|
|
2586
|
-
};
|
|
2587
|
-
const addSettingsSection = (app) => {
|
|
2588
|
-
app.createSettingSection(
|
|
2589
|
-
{
|
|
2590
|
-
id: `${PLUGIN_ID}-settings`,
|
|
2591
|
-
intlLabel: {
|
|
2592
|
-
id: `${PLUGIN_ID}.localazy_settings`,
|
|
2593
|
-
defaultMessage: getTranslation("localazy_settings")
|
|
2594
|
-
}
|
|
2595
|
-
},
|
|
2596
|
-
[
|
|
2597
|
-
// General
|
|
2598
|
-
{
|
|
2599
|
-
id: `${PLUGIN_ID}-settings-global`,
|
|
2600
|
-
intlLabel: {
|
|
2601
|
-
id: `${PLUGIN_ID}.localazy_settings`,
|
|
2602
|
-
defaultMessage: getTranslation("localazy_settings")
|
|
2603
|
-
},
|
|
2604
|
-
to: `/settings/${PLUGIN_ID}/global-settings`,
|
|
2605
|
-
Component: async () => {
|
|
2606
|
-
const { GlobalSettings } = await import("./GlobalSettings-rOwd0Y0E.mjs");
|
|
2607
|
-
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2608
|
-
const WrappedGlobalSettings = () => React__default.createElement(LocalazyIdentityProvider2, { children: React__default.createElement(GlobalSettings, {}) });
|
|
2609
|
-
return WrappedGlobalSettings;
|
|
2610
|
-
},
|
|
2611
|
-
permissions: []
|
|
2612
|
-
},
|
|
2613
|
-
// Content Transfer Setup
|
|
2614
|
-
{
|
|
2615
|
-
id: `${PLUGIN_ID}-settings-content-transfer-setup`,
|
|
2616
|
-
intlLabel: {
|
|
2617
|
-
id: `${PLUGIN_ID}.content_transfer_setup`,
|
|
2618
|
-
defaultMessage: getTranslation("content_transfer_setup")
|
|
2619
|
-
},
|
|
2620
|
-
to: `/settings/${PLUGIN_ID}/content-transfer-setup`,
|
|
2621
|
-
Component: async () => {
|
|
2622
|
-
const { ContentTransferSetup } = await import("./ContentTransferSetup-CeKXlzw_.mjs");
|
|
2623
|
-
const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
|
|
2624
|
-
const WrappedContentTransferSetup = () => React__default.createElement(LocalazyIdentityProvider2, {
|
|
2625
|
-
children: React__default.createElement(React__default.Fragment, {}, [
|
|
2626
|
-
React__default.createElement(FetchIdentity, {}),
|
|
2627
|
-
React__default.createElement(ContentTransferSetup, {})
|
|
2628
|
-
])
|
|
2629
|
-
});
|
|
2630
|
-
return WrappedContentTransferSetup;
|
|
2631
|
-
},
|
|
2632
|
-
permissions: []
|
|
2633
|
-
}
|
|
2634
|
-
]
|
|
2635
|
-
);
|
|
2636
|
-
};
|
|
2637
|
-
const addPlugin = (app) => {
|
|
2638
|
-
app.registerPlugin({
|
|
2639
|
-
id: PLUGIN_ID,
|
|
2640
|
-
initializer: Initializer,
|
|
2641
|
-
isReady: false,
|
|
2642
|
-
name: PLUGIN_ID
|
|
2643
|
-
});
|
|
2644
|
-
};
|
|
2645
|
-
export {
|
|
2646
|
-
LocalazyUserService as L,
|
|
2647
|
-
PLUGIN_ID as P,
|
|
2648
|
-
createStrapiApiAxiosInstance as c,
|
|
2649
|
-
emptyIdentity as e,
|
|
2650
|
-
index as i,
|
|
2651
|
-
useLocalazyIdentity as u
|
|
2652
|
-
};
|
|
2425
|
+
exports.createStrapiApiAxiosInstance = createStrapiApiAxiosInstance;
|