@localazy/strapi-plugin 1.0.4 → 1.0.8
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/{App-CtS6CrNn.mjs → App-C0ogWaOz.mjs} +8 -4
- package/dist/_chunks/{App-NRmSxuW3.js → App-Dl58PZKy.js} +91 -87
- package/dist/_chunks/{ContentTransferSetup-CeKXlzw_.mjs → ContentTransferSetup-ClR8Nwv2.mjs} +41 -452
- package/dist/_chunks/{ContentTransferSetup-DGs8MZPj.js → ContentTransferSetup-DWQg9zDj.js} +91 -502
- package/dist/_chunks/{GlobalSettings-rOwd0Y0E.mjs → GlobalSettings-B_h5sPwa.mjs} +7 -4
- package/dist/_chunks/{GlobalSettings-CRMPRA3Y.js → GlobalSettings-BpY7BoXu.js} +43 -40
- package/dist/_chunks/{LanguagesSelector-Bd8VFHib.js → LanguagesSelector-Bfrsr3-P.js} +10 -8
- package/dist/_chunks/{LanguagesSelector-CeB7tVcb.mjs → LanguagesSelector-u9iDsQqB.mjs} +4 -2
- package/dist/_chunks/LocalazyPanel-BedTxk3C.js +83 -0
- package/dist/_chunks/LocalazyPanel-CuvdSJYx.mjs +83 -0
- package/dist/_chunks/LocalazyStatusColumn-955GpXAv.mjs +51 -0
- package/dist/_chunks/LocalazyStatusColumn-Bf1ntoc7.js +51 -0
- 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-BlyFqyBY.mjs +60 -0
- package/dist/_chunks/entry-exclusion-service-bm-lp4za.js +60 -0
- package/dist/_chunks/{has-model-changed-gNSOSMBa.js → has-model-changed-B5SSh8XW.js} +4 -3
- package/dist/_chunks/{has-model-changed-DViUIQHk.mjs → has-model-changed-DIHY9LBA.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-Dj68Ixl2.mjs → index-C15Goe6p.mjs} +120 -4
- package/dist/_chunks/{set-Cbi1yYuW.js → index-CaY3BYnQ.js} +878 -4379
- package/dist/_chunks/{set-Dnhh_SyE.mjs → index-DOCSzcPH.mjs} +907 -4409
- package/dist/_chunks/{index-Bbwk3kp3.js → index-Q3-srfXc.js} +142 -4
- package/dist/_chunks/initReactI18next-B0H8_DlW.js +60 -0
- package/dist/_chunks/initReactI18next-MHHxeg_9.mjs +61 -0
- package/dist/_chunks/{isEqual-CC-cEPwY.mjs → isEqual-BazjlHGf.mjs} +1 -1
- package/dist/_chunks/{isEqual-0M0aSdTT.js → isEqual-CrlZhAtq.js} +1 -1
- package/dist/_chunks/set-BRyy4Ra6.mjs +893 -0
- package/dist/_chunks/set-CmcBsVOP.js +891 -0
- 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/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/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
package/dist/_chunks/{ContentTransferSetup-CeKXlzw_.mjs → ContentTransferSetup-ClR8Nwv2.mjs}
RENAMED
|
@@ -1,425 +1,14 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment
|
|
2
|
-
import {
|
|
3
|
-
import { i as isEqual } from "./isEqual-
|
|
4
|
-
import {
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useEffect } from "react";
|
|
3
|
+
import { i as isEqual } from "./isEqual-BazjlHGf.mjs";
|
|
4
|
+
import { s as set, m as keys, n as isArrayLike, o as arrayEach, k as isArray, p as isObject, P as PluginSettingsService, c as cloneDeep } from "./set-BRyy4Ra6.mjs";
|
|
5
5
|
import { Layouts } from "@strapi/strapi/admin";
|
|
6
|
-
import {
|
|
6
|
+
import { C as CheckboxImpl, c as Box, g as Accordion, F as Flex, h as SwitchImpl, T as Typography, B as Button, b as ForwardRef$4z, A as Alert, D as Divider } from "./index-DOCSzcPH.mjs";
|
|
7
|
+
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-DIHY9LBA.mjs";
|
|
8
|
+
import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs";
|
|
7
9
|
import styled from "styled-components";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"base": true,
|
|
11
|
-
"br": true,
|
|
12
|
-
"col": true,
|
|
13
|
-
"embed": true,
|
|
14
|
-
"hr": true,
|
|
15
|
-
"img": true,
|
|
16
|
-
"input": true,
|
|
17
|
-
"link": true,
|
|
18
|
-
"meta": true,
|
|
19
|
-
"param": true,
|
|
20
|
-
"source": true,
|
|
21
|
-
"track": true,
|
|
22
|
-
"wbr": true
|
|
23
|
-
};
|
|
24
|
-
const e = /* @__PURE__ */ getDefaultExportFromCjs(voidElements);
|
|
25
|
-
var t = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
|
|
26
|
-
function n(n2) {
|
|
27
|
-
var r2 = { type: "tag", name: "", voidElement: false, attrs: {}, children: [] }, i2 = n2.match(/<\/?([^\s]+?)[/\s>]/);
|
|
28
|
-
if (i2 && (r2.name = i2[1], (e[i2[1]] || "/" === n2.charAt(n2.length - 2)) && (r2.voidElement = true), r2.name.startsWith("!--"))) {
|
|
29
|
-
var s2 = n2.indexOf("-->");
|
|
30
|
-
return { type: "comment", comment: -1 !== s2 ? n2.slice(4, s2) : "" };
|
|
31
|
-
}
|
|
32
|
-
for (var a2 = new RegExp(t), c2 = null; null !== (c2 = a2.exec(n2)); ) if (c2[0].trim()) if (c2[1]) {
|
|
33
|
-
var o = c2[1].trim(), l = [o, ""];
|
|
34
|
-
o.indexOf("=") > -1 && (l = o.split("=")), r2.attrs[l[0]] = l[1], a2.lastIndex--;
|
|
35
|
-
} else c2[2] && (r2.attrs[c2[2]] = c2[3].trim().substring(1, c2[3].length - 1));
|
|
36
|
-
return r2;
|
|
37
|
-
}
|
|
38
|
-
var r = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, i = /^\s*$/, s = /* @__PURE__ */ Object.create(null);
|
|
39
|
-
function a(e2, t2) {
|
|
40
|
-
switch (t2.type) {
|
|
41
|
-
case "text":
|
|
42
|
-
return e2 + t2.content;
|
|
43
|
-
case "tag":
|
|
44
|
-
return e2 += "<" + t2.name + (t2.attrs ? function(e3) {
|
|
45
|
-
var t3 = [];
|
|
46
|
-
for (var n2 in e3) t3.push(n2 + '="' + e3[n2] + '"');
|
|
47
|
-
return t3.length ? " " + t3.join(" ") : "";
|
|
48
|
-
}(t2.attrs) : "") + (t2.voidElement ? "/>" : ">"), t2.voidElement ? e2 : e2 + t2.children.reduce(a, "") + "</" + t2.name + ">";
|
|
49
|
-
case "comment":
|
|
50
|
-
return e2 + "<!--" + t2.comment + "-->";
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
var c = { parse: function(e2, t2) {
|
|
54
|
-
t2 || (t2 = {}), t2.components || (t2.components = s);
|
|
55
|
-
var a2, c2 = [], o = [], l = -1, m = false;
|
|
56
|
-
if (0 !== e2.indexOf("<")) {
|
|
57
|
-
var u = e2.indexOf("<");
|
|
58
|
-
c2.push({ type: "text", content: -1 === u ? e2 : e2.substring(0, u) });
|
|
59
|
-
}
|
|
60
|
-
return e2.replace(r, function(r2, s2) {
|
|
61
|
-
if (m) {
|
|
62
|
-
if (r2 !== "</" + a2.name + ">") return;
|
|
63
|
-
m = false;
|
|
64
|
-
}
|
|
65
|
-
var u2, f = "/" !== r2.charAt(1), h = r2.startsWith("<!--"), p = s2 + r2.length, d = e2.charAt(p);
|
|
66
|
-
if (h) {
|
|
67
|
-
var v = n(r2);
|
|
68
|
-
return l < 0 ? (c2.push(v), c2) : ((u2 = o[l]).children.push(v), c2);
|
|
69
|
-
}
|
|
70
|
-
if (f && (l++, "tag" === (a2 = n(r2)).type && t2.components[a2.name] && (a2.type = "component", m = true), a2.voidElement || m || !d || "<" === d || a2.children.push({ type: "text", content: e2.slice(p, e2.indexOf("<", p)) }), 0 === l && c2.push(a2), (u2 = o[l - 1]) && u2.children.push(a2), o[l] = a2), (!f || a2.voidElement) && (l > -1 && (a2.voidElement || a2.name === r2.slice(2, -1)) && (l--, a2 = -1 === l ? c2 : o[l]), !m && "<" !== d && d)) {
|
|
71
|
-
u2 = -1 === l ? c2 : o[l].children;
|
|
72
|
-
var x = e2.indexOf("<", p), g = e2.slice(p, -1 === x ? void 0 : x);
|
|
73
|
-
i.test(g) && (g = " "), (x > -1 && l + u2.length >= 0 || " " !== g) && u2.push({ type: "text", content: g });
|
|
74
|
-
}
|
|
75
|
-
}), c2;
|
|
76
|
-
}, stringify: function(e2) {
|
|
77
|
-
return e2.reduce(function(e3, t2) {
|
|
78
|
-
return e3 + a("", t2);
|
|
79
|
-
}, "");
|
|
80
|
-
} };
|
|
81
|
-
const hasChildren = (node, checkLength) => {
|
|
82
|
-
if (!node) return false;
|
|
83
|
-
const base = node.props?.children ?? node.children;
|
|
84
|
-
if (checkLength) return base.length > 0;
|
|
85
|
-
return !!base;
|
|
86
|
-
};
|
|
87
|
-
const getChildren = (node) => {
|
|
88
|
-
if (!node) return [];
|
|
89
|
-
const children = node.props?.children ?? node.children;
|
|
90
|
-
return node.props?.i18nIsDynamicList ? getAsArray(children) : children;
|
|
91
|
-
};
|
|
92
|
-
const hasValidReactChildren = (children) => Array.isArray(children) && children.every(isValidElement);
|
|
93
|
-
const getAsArray = (data) => Array.isArray(data) ? data : [data];
|
|
94
|
-
const mergeProps = (source, target) => {
|
|
95
|
-
const newTarget = {
|
|
96
|
-
...target
|
|
97
|
-
};
|
|
98
|
-
newTarget.props = Object.assign(source.props, target.props);
|
|
99
|
-
return newTarget;
|
|
100
|
-
};
|
|
101
|
-
const nodesToString = (children, i18nOptions, i18n, i18nKey) => {
|
|
102
|
-
if (!children) return "";
|
|
103
|
-
let stringNode = "";
|
|
104
|
-
const childrenArray = getAsArray(children);
|
|
105
|
-
const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : [];
|
|
106
|
-
childrenArray.forEach((child, childIndex) => {
|
|
107
|
-
if (isString(child)) {
|
|
108
|
-
stringNode += `${child}`;
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (isValidElement(child)) {
|
|
112
|
-
const {
|
|
113
|
-
props,
|
|
114
|
-
type
|
|
115
|
-
} = child;
|
|
116
|
-
const childPropsCount = Object.keys(props).length;
|
|
117
|
-
const shouldKeepChild = keepArray.indexOf(type) > -1;
|
|
118
|
-
const childChildren = props.children;
|
|
119
|
-
if (!childChildren && shouldKeepChild && !childPropsCount) {
|
|
120
|
-
stringNode += `<${type}/>`;
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) {
|
|
124
|
-
stringNode += `<${childIndex}></${childIndex}>`;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (shouldKeepChild && childPropsCount === 1 && isString(childChildren)) {
|
|
128
|
-
stringNode += `<${type}>${childChildren}</${type}>`;
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey);
|
|
132
|
-
stringNode += `<${childIndex}>${content}</${childIndex}>`;
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (child === null) {
|
|
136
|
-
warn(i18n, "TRANS_NULL_VALUE", `Passed in a null value as child`, {
|
|
137
|
-
i18nKey
|
|
138
|
-
});
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (isObject(child)) {
|
|
142
|
-
const {
|
|
143
|
-
format,
|
|
144
|
-
...clone
|
|
145
|
-
} = child;
|
|
146
|
-
const keys2 = Object.keys(clone);
|
|
147
|
-
if (keys2.length === 1) {
|
|
148
|
-
const value = format ? `${keys2[0]}, ${format}` : keys2[0];
|
|
149
|
-
stringNode += `{{${value}}}`;
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
warn(i18n, "TRANS_INVALID_OBJ", `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, {
|
|
153
|
-
i18nKey,
|
|
154
|
-
child
|
|
155
|
-
});
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
warn(i18n, "TRANS_INVALID_VAR", `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, {
|
|
159
|
-
i18nKey,
|
|
160
|
-
child
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
return stringNode;
|
|
164
|
-
};
|
|
165
|
-
const renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) => {
|
|
166
|
-
if (targetString === "") return [];
|
|
167
|
-
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
168
|
-
const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.map((keep) => `<${keep}`).join("|")).test(targetString);
|
|
169
|
-
if (!children && !emptyChildrenButNeedsHandling && !shouldUnescape) return [targetString];
|
|
170
|
-
const data = {};
|
|
171
|
-
const getData = (childs) => {
|
|
172
|
-
const childrenArray = getAsArray(childs);
|
|
173
|
-
childrenArray.forEach((child) => {
|
|
174
|
-
if (isString(child)) return;
|
|
175
|
-
if (hasChildren(child)) getData(getChildren(child));
|
|
176
|
-
else if (isObject(child) && !isValidElement(child)) Object.assign(data, child);
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
getData(children);
|
|
180
|
-
const ast = c.parse(`<0>${targetString}</0>`);
|
|
181
|
-
const opts = {
|
|
182
|
-
...data,
|
|
183
|
-
...combinedTOpts
|
|
184
|
-
};
|
|
185
|
-
const renderInner = (child, node, rootReactNode) => {
|
|
186
|
-
const childs = getChildren(child);
|
|
187
|
-
const mappedChildren = mapAST(childs, node.children, rootReactNode);
|
|
188
|
-
return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren;
|
|
189
|
-
};
|
|
190
|
-
const pushTranslatedJSX = (child, inner, mem, i2, isVoid) => {
|
|
191
|
-
if (child.dummy) {
|
|
192
|
-
child.children = inner;
|
|
193
|
-
mem.push(cloneElement(child, {
|
|
194
|
-
key: i2
|
|
195
|
-
}, isVoid ? void 0 : inner));
|
|
196
|
-
} else {
|
|
197
|
-
mem.push(...Children.map([child], (c2) => {
|
|
198
|
-
const props = {
|
|
199
|
-
...c2.props
|
|
200
|
-
};
|
|
201
|
-
delete props.i18nIsDynamicList;
|
|
202
|
-
return createElement(c2.type, {
|
|
203
|
-
...props,
|
|
204
|
-
key: i2,
|
|
205
|
-
ref: c2.ref
|
|
206
|
-
}, isVoid ? null : inner);
|
|
207
|
-
}));
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
const mapAST = (reactNode, astNode, rootReactNode) => {
|
|
211
|
-
const reactNodes = getAsArray(reactNode);
|
|
212
|
-
const astNodes = getAsArray(astNode);
|
|
213
|
-
return astNodes.reduce((mem, node, i2) => {
|
|
214
|
-
const translationContent = node.children?.[0]?.content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
|
|
215
|
-
if (node.type === "tag") {
|
|
216
|
-
let tmp = reactNodes[parseInt(node.name, 10)];
|
|
217
|
-
if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name];
|
|
218
|
-
if (!tmp) tmp = {};
|
|
219
|
-
const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
|
|
220
|
-
props: node.attrs
|
|
221
|
-
}, tmp) : tmp;
|
|
222
|
-
const isElement = isValidElement(child);
|
|
223
|
-
const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
|
|
224
|
-
const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && isObject(child) && child.dummy && !isElement;
|
|
225
|
-
const isKnownComponent = isObject(children) && Object.hasOwnProperty.call(children, node.name);
|
|
226
|
-
if (isString(child)) {
|
|
227
|
-
const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
|
|
228
|
-
mem.push(value);
|
|
229
|
-
} else if (hasChildren(child) || isValidTranslationWithChildren) {
|
|
230
|
-
const inner = renderInner(child, node, rootReactNode);
|
|
231
|
-
pushTranslatedJSX(child, inner, mem, i2);
|
|
232
|
-
} else if (isEmptyTransWithHTML) {
|
|
233
|
-
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
234
|
-
pushTranslatedJSX(child, inner, mem, i2);
|
|
235
|
-
} else if (Number.isNaN(parseFloat(node.name))) {
|
|
236
|
-
if (isKnownComponent) {
|
|
237
|
-
const inner = renderInner(child, node, rootReactNode);
|
|
238
|
-
pushTranslatedJSX(child, inner, mem, i2, node.voidElement);
|
|
239
|
-
} else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
|
|
240
|
-
if (node.voidElement) {
|
|
241
|
-
mem.push(createElement(node.name, {
|
|
242
|
-
key: `${node.name}-${i2}`
|
|
243
|
-
}));
|
|
244
|
-
} else {
|
|
245
|
-
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
246
|
-
mem.push(createElement(node.name, {
|
|
247
|
-
key: `${node.name}-${i2}`
|
|
248
|
-
}, inner));
|
|
249
|
-
}
|
|
250
|
-
} else if (node.voidElement) {
|
|
251
|
-
mem.push(`<${node.name} />`);
|
|
252
|
-
} else {
|
|
253
|
-
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
254
|
-
mem.push(`<${node.name}>${inner}</${node.name}>`);
|
|
255
|
-
}
|
|
256
|
-
} else if (isObject(child) && !isElement) {
|
|
257
|
-
const content = node.children[0] ? translationContent : null;
|
|
258
|
-
if (content) mem.push(content);
|
|
259
|
-
} else {
|
|
260
|
-
pushTranslatedJSX(child, translationContent, mem, i2, node.children.length !== 1 || !translationContent);
|
|
261
|
-
}
|
|
262
|
-
} else if (node.type === "text") {
|
|
263
|
-
const wrapTextNodes = i18nOptions.transWrapTextNodes;
|
|
264
|
-
const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
|
|
265
|
-
if (wrapTextNodes) {
|
|
266
|
-
mem.push(createElement(wrapTextNodes, {
|
|
267
|
-
key: `${node.name}-${i2}`
|
|
268
|
-
}, content));
|
|
269
|
-
} else {
|
|
270
|
-
mem.push(content);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return mem;
|
|
274
|
-
}, []);
|
|
275
|
-
};
|
|
276
|
-
const result = mapAST([{
|
|
277
|
-
dummy: true,
|
|
278
|
-
children: children || []
|
|
279
|
-
}], ast, getAsArray(children || []));
|
|
280
|
-
return getChildren(result[0]);
|
|
281
|
-
};
|
|
282
|
-
const fixComponentProps = (component, index, translation) => {
|
|
283
|
-
const componentKey = component.key || index;
|
|
284
|
-
const comp = cloneElement(component, {
|
|
285
|
-
key: componentKey
|
|
286
|
-
});
|
|
287
|
-
if (!comp.props || !comp.props.children || translation.indexOf(`${index}/>`) < 0 && translation.indexOf(`${index} />`) < 0) {
|
|
288
|
-
return comp;
|
|
289
|
-
}
|
|
290
|
-
function Componentized() {
|
|
291
|
-
return createElement(Fragment, null, comp);
|
|
292
|
-
}
|
|
293
|
-
return createElement(Componentized);
|
|
294
|
-
};
|
|
295
|
-
const generateArrayComponents = (components, translation) => components.map((c2, index) => fixComponentProps(c2, index, translation));
|
|
296
|
-
const generateObjectComponents = (components, translation) => {
|
|
297
|
-
const componentMap = {};
|
|
298
|
-
Object.keys(components).forEach((c2) => {
|
|
299
|
-
Object.assign(componentMap, {
|
|
300
|
-
[c2]: fixComponentProps(components[c2], c2, translation)
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
return componentMap;
|
|
304
|
-
};
|
|
305
|
-
const generateComponents = (components, translation, i18n, i18nKey) => {
|
|
306
|
-
if (!components) return null;
|
|
307
|
-
if (Array.isArray(components)) {
|
|
308
|
-
return generateArrayComponents(components, translation);
|
|
309
|
-
}
|
|
310
|
-
if (isObject(components)) {
|
|
311
|
-
return generateObjectComponents(components, translation);
|
|
312
|
-
}
|
|
313
|
-
warnOnce(i18n, "TRANS_INVALID_COMPONENTS", `<Trans /> "components" prop expects an object or array`, {
|
|
314
|
-
i18nKey
|
|
315
|
-
});
|
|
316
|
-
return null;
|
|
317
|
-
};
|
|
318
|
-
function Trans$1({
|
|
319
|
-
children,
|
|
320
|
-
count,
|
|
321
|
-
parent,
|
|
322
|
-
i18nKey,
|
|
323
|
-
context,
|
|
324
|
-
tOptions = {},
|
|
325
|
-
values,
|
|
326
|
-
defaults,
|
|
327
|
-
components,
|
|
328
|
-
ns,
|
|
329
|
-
i18n: i18nFromProps,
|
|
330
|
-
t: tFromProps,
|
|
331
|
-
shouldUnescape,
|
|
332
|
-
...additionalProps
|
|
333
|
-
}) {
|
|
334
|
-
const i18n = i18nFromProps || getI18n();
|
|
335
|
-
if (!i18n) {
|
|
336
|
-
warnOnce(i18n, "NO_I18NEXT_INSTANCE", `Trans: You need to pass in an i18next instance using i18nextReactModule`, {
|
|
337
|
-
i18nKey
|
|
338
|
-
});
|
|
339
|
-
return children;
|
|
340
|
-
}
|
|
341
|
-
const t2 = tFromProps || i18n.t.bind(i18n) || ((k) => k);
|
|
342
|
-
const reactI18nextOptions = {
|
|
343
|
-
...getDefaults(),
|
|
344
|
-
...i18n.options?.react
|
|
345
|
-
};
|
|
346
|
-
let namespaces = ns || t2.ns || i18n.options?.defaultNS;
|
|
347
|
-
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
348
|
-
const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey);
|
|
349
|
-
const defaultValue = defaults || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey;
|
|
350
|
-
const {
|
|
351
|
-
hashTransKey
|
|
352
|
-
} = reactI18nextOptions;
|
|
353
|
-
const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue);
|
|
354
|
-
if (i18n.options?.interpolation?.defaultVariables) {
|
|
355
|
-
values = values && Object.keys(values).length > 0 ? {
|
|
356
|
-
...values,
|
|
357
|
-
...i18n.options.interpolation.defaultVariables
|
|
358
|
-
} : {
|
|
359
|
-
...i18n.options.interpolation.defaultVariables
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
const interpolationOverride = values || count !== void 0 && !i18n.options?.interpolation?.alwaysFormat || !children ? tOptions.interpolation : {
|
|
363
|
-
interpolation: {
|
|
364
|
-
...tOptions.interpolation,
|
|
365
|
-
prefix: "#$?",
|
|
366
|
-
suffix: "?$#"
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
const combinedTOpts = {
|
|
370
|
-
...tOptions,
|
|
371
|
-
context: context || tOptions.context,
|
|
372
|
-
count,
|
|
373
|
-
...values,
|
|
374
|
-
...interpolationOverride,
|
|
375
|
-
defaultValue,
|
|
376
|
-
ns: namespaces
|
|
377
|
-
};
|
|
378
|
-
const translation = key ? t2(key, combinedTOpts) : defaultValue;
|
|
379
|
-
const generatedComponents = generateComponents(components, translation, i18n, i18nKey);
|
|
380
|
-
const content = renderNodes(generatedComponents || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
|
|
381
|
-
const useAsParent = parent ?? reactI18nextOptions.defaultTransParent;
|
|
382
|
-
return useAsParent ? createElement(useAsParent, additionalProps, content) : content;
|
|
383
|
-
}
|
|
384
|
-
function Trans({
|
|
385
|
-
children,
|
|
386
|
-
count,
|
|
387
|
-
parent,
|
|
388
|
-
i18nKey,
|
|
389
|
-
context,
|
|
390
|
-
tOptions = {},
|
|
391
|
-
values,
|
|
392
|
-
defaults,
|
|
393
|
-
components,
|
|
394
|
-
ns,
|
|
395
|
-
i18n: i18nFromProps,
|
|
396
|
-
t: tFromProps,
|
|
397
|
-
shouldUnescape,
|
|
398
|
-
...additionalProps
|
|
399
|
-
}) {
|
|
400
|
-
const {
|
|
401
|
-
i18n: i18nFromContext,
|
|
402
|
-
defaultNS: defaultNSFromContext
|
|
403
|
-
} = useContext(I18nContext) || {};
|
|
404
|
-
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
405
|
-
const t2 = tFromProps || i18n?.t.bind(i18n);
|
|
406
|
-
return Trans$1({
|
|
407
|
-
children,
|
|
408
|
-
count,
|
|
409
|
-
parent,
|
|
410
|
-
i18nKey,
|
|
411
|
-
context,
|
|
412
|
-
tOptions,
|
|
413
|
-
values,
|
|
414
|
-
defaults,
|
|
415
|
-
components,
|
|
416
|
-
ns: ns || t2?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
|
|
417
|
-
i18n,
|
|
418
|
-
t: tFromProps,
|
|
419
|
-
shouldUnescape,
|
|
420
|
-
...additionalProps
|
|
421
|
-
});
|
|
422
|
-
}
|
|
10
|
+
import { Trans } from "./index-BIbKC7-V.mjs";
|
|
11
|
+
import "./i18n-RoETLXdU.mjs";
|
|
423
12
|
const getFilteredModelsSchemas = (models) => {
|
|
424
13
|
if (!models) {
|
|
425
14
|
return [];
|
|
@@ -461,9 +50,9 @@ const buildContentTransferSetupSchema = (localizableTree = [], storedSetupSchema
|
|
|
461
50
|
set(destinationObject, key, get(oLocalizableTree, key));
|
|
462
51
|
});
|
|
463
52
|
const destinationArray = [];
|
|
464
|
-
const sortedDestinationObjectKeys = Object.keys(destinationObject).sort((
|
|
465
|
-
if (
|
|
466
|
-
if (
|
|
53
|
+
const sortedDestinationObjectKeys = Object.keys(destinationObject).sort((a, b) => {
|
|
54
|
+
if (a < b) return -1;
|
|
55
|
+
if (a > b) return 1;
|
|
467
56
|
return 0;
|
|
468
57
|
});
|
|
469
58
|
for (const key of sortedDestinationObjectKeys) {
|
|
@@ -1178,7 +767,7 @@ const TreeItem = ({ label, value, children, passedKey = "", onTreeItemClick }) =
|
|
|
1178
767
|
const onChange = (key, currentValue) => {
|
|
1179
768
|
onTreeItemClick(key, currentValue);
|
|
1180
769
|
};
|
|
1181
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
770
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1182
771
|
typeof value === "boolean" && /* @__PURE__ */ jsx(CheckboxImpl, { checked: value, onCheckedChange: () => onChange([passedKey], value), children: label || "-" }),
|
|
1183
772
|
value === null && /* @__PURE__ */ jsx(CheckboxImpl, { checked: false, disabled: true, children: label || "-" }),
|
|
1184
773
|
children && /* @__PURE__ */ jsx("div", { children }, passedKey)
|
|
@@ -1231,7 +820,7 @@ function forEach(collection, iteratee) {
|
|
|
1231
820
|
function flattenObject(obj, delimiter = ".") {
|
|
1232
821
|
const nobj = {};
|
|
1233
822
|
forEach(obj, (val, key) => {
|
|
1234
|
-
if (isObject
|
|
823
|
+
if (isObject(val) && !isArray(val)) {
|
|
1235
824
|
const strip = flattenObject(val, delimiter);
|
|
1236
825
|
forEach(strip, (v, k) => {
|
|
1237
826
|
nobj[key + delimiter + k] = v;
|
|
@@ -1243,7 +832,7 @@ function flattenObject(obj, delimiter = ".") {
|
|
|
1243
832
|
return nobj;
|
|
1244
833
|
}
|
|
1245
834
|
const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
|
|
1246
|
-
const { t
|
|
835
|
+
const { t } = useTranslation();
|
|
1247
836
|
const [, setIsExpanded] = useState(initiallyExpanded);
|
|
1248
837
|
useEffect(() => {
|
|
1249
838
|
setIsExpanded(initiallyExpanded);
|
|
@@ -1278,7 +867,7 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
|
|
|
1278
867
|
const createTree = (name, branch, path = "") => {
|
|
1279
868
|
const isBranchObject = typeof branch === "object" && branch !== null;
|
|
1280
869
|
if (isBranchObject) {
|
|
1281
|
-
return /* @__PURE__ */ jsx(Fragment
|
|
870
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Object.entries(branch).map(([key, value]) => {
|
|
1282
871
|
const isSubbranchObject = typeof value === "object" && value !== null;
|
|
1283
872
|
let flattened = flattenObject(value);
|
|
1284
873
|
flattened = Object.fromEntries(Object.entries(flattened).filter(([key2]) => !key2.includes("__component__")));
|
|
@@ -1316,7 +905,7 @@ const Tree = ({ objects, onTreeItemClick, initiallyExpanded = false }) => {
|
|
|
1316
905
|
/* @__PURE__ */ jsx(Accordion.Header, { style: { flex: 1 }, children: /* @__PURE__ */ jsxs(Accordion.Trigger, { description: key, children: [
|
|
1317
906
|
key,
|
|
1318
907
|
" ",
|
|
1319
|
-
|
|
908
|
+
t("plugin_settings.tree_item_count", { count: getCheckedStateCount(value) })
|
|
1320
909
|
] }) }),
|
|
1321
910
|
/* @__PURE__ */ jsx(
|
|
1322
911
|
SwitchImpl,
|
|
@@ -1340,12 +929,12 @@ const CustomBullet = styled.div`
|
|
|
1340
929
|
border-radius: 50%;
|
|
1341
930
|
`;
|
|
1342
931
|
function ContentTransferSetupEmpty() {
|
|
1343
|
-
const { t
|
|
932
|
+
const { t } = useTranslation();
|
|
1344
933
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1345
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "beta", children:
|
|
934
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "beta", children: t("plugin_settings.there_is_nothing_to_transfer") }),
|
|
1346
935
|
/* @__PURE__ */ jsx("br", {}),
|
|
1347
936
|
/* @__PURE__ */ jsx("br", {}),
|
|
1348
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "omega", children:
|
|
937
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "omega", children: t("plugin_settings.please_check_that_you_have_entered_a_valid_collection") }),
|
|
1349
938
|
/* @__PURE__ */ jsx("br", {}),
|
|
1350
939
|
/* @__PURE__ */ jsxs(Flex, { marginTop: 1, alignItems: "center", children: [
|
|
1351
940
|
/* @__PURE__ */ jsx(CustomBullet, {}),
|
|
@@ -1400,17 +989,17 @@ function ContentTransferSetupEmpty() {
|
|
|
1400
989
|
] });
|
|
1401
990
|
}
|
|
1402
991
|
const ContentTransferSetup = () => {
|
|
1403
|
-
const { t
|
|
992
|
+
const { t } = useTranslation();
|
|
1404
993
|
const [isLoading, setIsLoading] = useState(true);
|
|
1405
994
|
const [showAlert, setShowAlert] = useState(false);
|
|
1406
995
|
const [showModalChangedAlert, setShowModalChangedAlert] = useState(false);
|
|
1407
996
|
const [, setItemsExpandedModel] = useState([]);
|
|
1408
997
|
const buildItemsExpandedModel = (models) => {
|
|
1409
|
-
const
|
|
998
|
+
const r = {};
|
|
1410
999
|
getFilteredModelsSchemas(models).forEach((model, index) => {
|
|
1411
|
-
|
|
1000
|
+
r[model.modelUid] = index === 0;
|
|
1412
1001
|
});
|
|
1413
|
-
return
|
|
1002
|
+
return r;
|
|
1414
1003
|
};
|
|
1415
1004
|
const [, setTreeModelsSchemas] = useState([]);
|
|
1416
1005
|
const [originalFormModel, setOriginalFormModel] = useState([]);
|
|
@@ -1427,8 +1016,8 @@ const ContentTransferSetup = () => {
|
|
|
1427
1016
|
setHasUnsavedChanges(false);
|
|
1428
1017
|
setShowAlert(true);
|
|
1429
1018
|
setShowModalChangedAlert(false);
|
|
1430
|
-
} catch (
|
|
1431
|
-
throw
|
|
1019
|
+
} catch (e) {
|
|
1020
|
+
throw e.data;
|
|
1432
1021
|
}
|
|
1433
1022
|
};
|
|
1434
1023
|
const onTreeItemClick = (keys2, currentValue) => {
|
|
@@ -1491,14 +1080,14 @@ const ContentTransferSetup = () => {
|
|
|
1491
1080
|
}
|
|
1492
1081
|
fetchData();
|
|
1493
1082
|
}, []);
|
|
1494
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
1083
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1495
1084
|
/* @__PURE__ */ jsx(
|
|
1496
1085
|
Layouts.Header,
|
|
1497
1086
|
{
|
|
1498
|
-
title:
|
|
1499
|
-
subtitle:
|
|
1087
|
+
title: t("plugin_settings.content_transfer_setup"),
|
|
1088
|
+
subtitle: t("plugin_settings.content_transfer_setup_description"),
|
|
1500
1089
|
primaryAction: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
1501
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !hasUnsavedChanges, onClick: onCancelClick, children:
|
|
1090
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", disabled: !hasUnsavedChanges, onClick: onCancelClick, children: t("plugin_settings.cancel") }),
|
|
1502
1091
|
/* @__PURE__ */ jsx(
|
|
1503
1092
|
Button,
|
|
1504
1093
|
{
|
|
@@ -1507,7 +1096,7 @@ const ContentTransferSetup = () => {
|
|
|
1507
1096
|
onClick: () => {
|
|
1508
1097
|
saveContentTransferSetup(formModel);
|
|
1509
1098
|
},
|
|
1510
|
-
children:
|
|
1099
|
+
children: t("plugin_settings.save")
|
|
1511
1100
|
}
|
|
1512
1101
|
)
|
|
1513
1102
|
] }),
|
|
@@ -1519,20 +1108,20 @@ const ContentTransferSetup = () => {
|
|
|
1519
1108
|
Alert,
|
|
1520
1109
|
{
|
|
1521
1110
|
onClose: () => setShowAlert(false),
|
|
1522
|
-
closeLabel:
|
|
1523
|
-
title:
|
|
1111
|
+
closeLabel: t("plugin_settings.close"),
|
|
1112
|
+
title: t("plugin_settings.content_transfer_setup_saved"),
|
|
1524
1113
|
variant: "success",
|
|
1525
|
-
children:
|
|
1114
|
+
children: t("plugin_settings.content_transfer_setup_saved_successfully")
|
|
1526
1115
|
}
|
|
1527
1116
|
) }),
|
|
1528
1117
|
!isLoading && showModalChangedAlert && /* @__PURE__ */ jsx(Box, { marginBottom: 8, children: /* @__PURE__ */ jsx(
|
|
1529
1118
|
Alert,
|
|
1530
1119
|
{
|
|
1531
1120
|
onClose: () => setShowModalChangedAlert(false),
|
|
1532
|
-
closeLabel:
|
|
1533
|
-
title:
|
|
1121
|
+
closeLabel: t("plugin_settings.close"),
|
|
1122
|
+
title: t("plugin_settings.content_types_model_changed"),
|
|
1534
1123
|
variant: "default",
|
|
1535
|
-
children:
|
|
1124
|
+
children: t("plugin_settings.please_update_your_content")
|
|
1536
1125
|
}
|
|
1537
1126
|
) }),
|
|
1538
1127
|
!isLoading && /* @__PURE__ */ jsxs(Box, { background: "neutral0", padding: 7, paddingTop: 6, shadow: "tableShadow", hasRadius: true, children: [
|
|
@@ -1543,11 +1132,11 @@ const ContentTransferSetup = () => {
|
|
|
1543
1132
|
}),
|
|
1544
1133
|
!!formModel.length && /* @__PURE__ */ jsxs(Box, { children: [
|
|
1545
1134
|
/* @__PURE__ */ jsx(Box, { paddingTop: 6, paddingBottom: 6, children: /* @__PURE__ */ jsx(Divider, {}) }),
|
|
1546
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", children:
|
|
1547
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children:
|
|
1135
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: t("plugin_settings.you_can_upload_download") }),
|
|
1136
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: t("plugin_settings.only_text_based_content") }),
|
|
1548
1137
|
/* @__PURE__ */ jsx("br", {}),
|
|
1549
1138
|
/* @__PURE__ */ jsx("br", {}),
|
|
1550
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", children:
|
|
1139
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: t("plugin_settings.learn_more_in_docs_message_a") }),
|
|
1551
1140
|
/* @__PURE__ */ jsx(
|
|
1552
1141
|
Typography,
|
|
1553
1142
|
{
|
|
@@ -1556,7 +1145,7 @@ const ContentTransferSetup = () => {
|
|
|
1556
1145
|
fontWeight: "semiBold",
|
|
1557
1146
|
textColor: "primary600",
|
|
1558
1147
|
style: { cursor: "pointer" },
|
|
1559
|
-
children:
|
|
1148
|
+
children: t("plugin_settings.learn_more_in_docs_message_b")
|
|
1560
1149
|
}
|
|
1561
1150
|
)
|
|
1562
1151
|
] })
|