@strapi/i18n 5.0.0-beta.7 → 5.0.0-beta.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/{SettingsPage-CB5yd4O3.mjs → SettingsPage-0FFSTUW2.mjs} +9 -6
- package/dist/_chunks/SettingsPage-0FFSTUW2.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-BvzzUueI.js → SettingsPage-DnLLGeBa.js} +11 -8
- package/dist/_chunks/SettingsPage-DnLLGeBa.js.map +1 -0
- package/dist/_chunks/{en-CnrTsjWS.mjs → en-18tWw4P6.mjs} +4 -1
- package/dist/_chunks/en-18tWw4P6.mjs.map +1 -0
- package/dist/_chunks/{en-BuBc6LKZ.js → en-Kv6y9zPQ.js} +4 -1
- package/dist/_chunks/en-Kv6y9zPQ.js.map +1 -0
- package/dist/_chunks/{index-aiqKWFfV.mjs → index-BddUXwss.mjs} +408 -81
- package/dist/_chunks/index-BddUXwss.mjs.map +1 -0
- package/dist/_chunks/{index-DRjoX_5r.js → index-DtEKsPcR.js} +401 -75
- package/dist/_chunks/index-DtEKsPcR.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/BulkLocaleActionModal.d.ts +15 -0
- package/dist/admin/src/components/CMHeaderActions.d.ts +7 -1
- package/dist/admin/src/services/api.d.ts +2 -3
- package/dist/admin/src/services/locales.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +7 -0
- package/dist/admin/src/utils/baseQuery.d.ts +3 -17
- package/dist/shared/contracts/content-manager.d.ts +20 -1
- package/package.json +13 -13
- package/dist/_chunks/SettingsPage-BvzzUueI.js.map +0 -1
- package/dist/_chunks/SettingsPage-CB5yd4O3.mjs.map +0 -1
- package/dist/_chunks/en-BuBc6LKZ.js.map +0 -1
- package/dist/_chunks/en-CnrTsjWS.mjs.map +0 -1
- package/dist/_chunks/index-DRjoX_5r.js.map +0 -1
- package/dist/_chunks/index-aiqKWFfV.mjs.map +0 -1
@@ -2,15 +2,15 @@ import get from "lodash/get";
|
|
2
2
|
import * as yup from "yup";
|
3
3
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
4
4
|
import * as React from "react";
|
5
|
-
import { Typography, Field, Checkbox, Dialog, DialogBody, Flex, DialogFooter, Button as Button$1, Status, SingleSelect, SingleSelectOption, VisuallyHidden, useCollator, Popover
|
6
|
-
import { WarningCircle, Trash, Earth, EarthStriked, CaretDown } from "@strapi/icons";
|
5
|
+
import { Typography, Field, Checkbox, Dialog, DialogBody, Flex, DialogFooter, Button as Button$1, Box, Status, IconButton, Tooltip, SingleSelect, SingleSelectOption, VisuallyHidden, useCollator, Popover } from "@strapi/design-system";
|
6
|
+
import { WarningCircle, Pencil, CrossCircle, CheckCircle, ArrowsCounterClockwise, Trash, ListPlus, Earth, EarthStriked, CaretDown } from "@strapi/icons";
|
7
7
|
import { useIntl } from "react-intl";
|
8
8
|
import { styled } from "styled-components";
|
9
|
-
import { useAuth,
|
10
|
-
import { unstable_useDocument, unstable_useDocumentActions } from "@strapi/content-manager/strapi-admin";
|
11
|
-
import { useParams, useNavigate, matchPath } from "react-router-dom";
|
12
|
-
import { createApi } from "@reduxjs/toolkit/query/react";
|
9
|
+
import { useAuth, adminApi, useTable, Table, useQueryParams, useNotification, useAPIErrorHandler } from "@strapi/admin/strapi-admin";
|
10
|
+
import { unstable_useDocument, unstable_useDocumentActions, buildValidParams } from "@strapi/content-manager/strapi-admin";
|
11
|
+
import { useParams, Link, useNavigate, matchPath } from "react-router-dom";
|
13
12
|
import * as qs from "qs";
|
13
|
+
import { stringify } from "qs";
|
14
14
|
import omit from "lodash/omit";
|
15
15
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
16
16
|
const v = glob[path];
|
@@ -151,76 +151,8 @@ const useI18n = () => {
|
|
151
151
|
...actions
|
152
152
|
};
|
153
153
|
};
|
154
|
-
const
|
155
|
-
|
156
|
-
const { get: get2, post, del, put } = getFetchClient();
|
157
|
-
if (typeof query === "string") {
|
158
|
-
const result = await get2(query, { signal });
|
159
|
-
return { data: result.data };
|
160
|
-
} else {
|
161
|
-
const { url, method = "GET", data, config } = query;
|
162
|
-
if (method === "POST") {
|
163
|
-
const result2 = await post(url, data, {
|
164
|
-
...config,
|
165
|
-
signal
|
166
|
-
});
|
167
|
-
return { data: result2.data };
|
168
|
-
}
|
169
|
-
if (method === "DELETE") {
|
170
|
-
const result2 = await del(url, {
|
171
|
-
...config,
|
172
|
-
signal
|
173
|
-
});
|
174
|
-
return { data: result2.data };
|
175
|
-
}
|
176
|
-
if (method === "PUT") {
|
177
|
-
const result2 = await put(url, data, {
|
178
|
-
...config,
|
179
|
-
signal
|
180
|
-
});
|
181
|
-
return { data: result2.data };
|
182
|
-
}
|
183
|
-
const result = await get2(url, {
|
184
|
-
...config,
|
185
|
-
signal
|
186
|
-
});
|
187
|
-
return { data: result.data };
|
188
|
-
}
|
189
|
-
} catch (err) {
|
190
|
-
if (isFetchError(err)) {
|
191
|
-
if (typeof err.response?.data === "object" && err.response?.data !== null && "error" in err.response?.data) {
|
192
|
-
return { data: void 0, error: err.response?.data.error };
|
193
|
-
} else {
|
194
|
-
return {
|
195
|
-
data: void 0,
|
196
|
-
error: {
|
197
|
-
name: "UnknownError",
|
198
|
-
message: "There was an unknown error response from the API",
|
199
|
-
details: err.response,
|
200
|
-
status: err.status
|
201
|
-
}
|
202
|
-
};
|
203
|
-
}
|
204
|
-
}
|
205
|
-
const error = err;
|
206
|
-
return {
|
207
|
-
data: void 0,
|
208
|
-
error: {
|
209
|
-
name: error.name,
|
210
|
-
message: error.message,
|
211
|
-
stack: error.stack
|
212
|
-
}
|
213
|
-
};
|
214
|
-
}
|
215
|
-
};
|
216
|
-
const isBaseQueryError = (error) => {
|
217
|
-
return error.name !== void 0;
|
218
|
-
};
|
219
|
-
const i18nApi = createApi({
|
220
|
-
reducerPath: "i18nApi",
|
221
|
-
baseQuery: fetchBaseQuery(),
|
222
|
-
tagTypes: ["Locale"],
|
223
|
-
endpoints: () => ({})
|
154
|
+
const i18nApi = adminApi.enhanceEndpoints({
|
155
|
+
addTagTypes: ["Locale"]
|
224
156
|
});
|
225
157
|
const localesApi = i18nApi.injectEndpoints({
|
226
158
|
endpoints: (builder) => ({
|
@@ -269,6 +201,176 @@ const {
|
|
269
201
|
useGetDefaultLocalesQuery,
|
270
202
|
useUpdateLocaleMutation
|
271
203
|
} = localesApi;
|
204
|
+
const relationsApi = i18nApi.injectEndpoints({
|
205
|
+
overrideExisting: true,
|
206
|
+
endpoints: (builder) => ({
|
207
|
+
getManyDraftRelationCount: builder.query({
|
208
|
+
query: ({ model, ...params }) => ({
|
209
|
+
url: `/content-manager/collection-types/${model}/actions/countManyEntriesDraftRelations`,
|
210
|
+
method: "GET",
|
211
|
+
config: {
|
212
|
+
params
|
213
|
+
}
|
214
|
+
}),
|
215
|
+
transformResponse: (response) => response.data
|
216
|
+
})
|
217
|
+
})
|
218
|
+
});
|
219
|
+
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
220
|
+
const isErrorMessageDescriptor = (object) => {
|
221
|
+
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
222
|
+
};
|
223
|
+
const EntryValidationText = ({ status = "draft", validationErrors }) => {
|
224
|
+
const { formatMessage } = useIntl();
|
225
|
+
const getErrorStr = (key, value) => {
|
226
|
+
if (typeof value === "string") {
|
227
|
+
return `${key}: ${value}`;
|
228
|
+
} else if (isErrorMessageDescriptor(value)) {
|
229
|
+
return `${key}: ${formatMessage(value)}`;
|
230
|
+
} else if (Array.isArray(value)) {
|
231
|
+
return value.map((v) => getErrorStr(key, v)).join(" ");
|
232
|
+
} else if (typeof value === "object" && !Array.isArray(value)) {
|
233
|
+
return Object.entries(value).map(([k, v]) => getErrorStr(k, v)).join(" ");
|
234
|
+
} else {
|
235
|
+
return "";
|
236
|
+
}
|
237
|
+
};
|
238
|
+
if (validationErrors) {
|
239
|
+
const validationErrorsMessages = Object.entries(validationErrors).map(([key, value]) => {
|
240
|
+
return getErrorStr(key, value);
|
241
|
+
}).join(" ");
|
242
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
243
|
+
/* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
|
244
|
+
/* @__PURE__ */ jsx(Tooltip, { label: validationErrorsMessages, children: /* @__PURE__ */ jsx(
|
245
|
+
Typography,
|
246
|
+
{
|
247
|
+
maxWidth: "30rem",
|
248
|
+
textColor: "danger600",
|
249
|
+
variant: "omega",
|
250
|
+
fontWeight: "semiBold",
|
251
|
+
ellipsis: true,
|
252
|
+
children: validationErrorsMessages
|
253
|
+
}
|
254
|
+
) })
|
255
|
+
] });
|
256
|
+
}
|
257
|
+
if (status === "published") {
|
258
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
259
|
+
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
260
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
261
|
+
id: "content-manager.bulk-publish.already-published",
|
262
|
+
defaultMessage: "Already Published"
|
263
|
+
}) })
|
264
|
+
] });
|
265
|
+
}
|
266
|
+
if (status === "modified") {
|
267
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
268
|
+
/* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
269
|
+
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
270
|
+
id: "app.utils.ready-to-publish-changes",
|
271
|
+
defaultMessage: "Ready to publish changes"
|
272
|
+
}) })
|
273
|
+
] });
|
274
|
+
}
|
275
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
276
|
+
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
277
|
+
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
278
|
+
id: "app.utils.ready-to-publish",
|
279
|
+
defaultMessage: "Ready to publish"
|
280
|
+
}) })
|
281
|
+
] });
|
282
|
+
};
|
283
|
+
const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
|
284
|
+
const BulkLocaleActionModal = ({
|
285
|
+
headers,
|
286
|
+
rows,
|
287
|
+
localesMetadata,
|
288
|
+
validationErrors = {}
|
289
|
+
}) => {
|
290
|
+
const { formatMessage } = useIntl();
|
291
|
+
const selectedRows = useTable(
|
292
|
+
"BulkLocaleActionModal",
|
293
|
+
(state) => state.selectedRows
|
294
|
+
);
|
295
|
+
const getFormattedCountMessage = () => {
|
296
|
+
const currentStatusByLocale = rows.reduce((acc, { locale, status }) => {
|
297
|
+
acc[locale] = status;
|
298
|
+
return acc;
|
299
|
+
}, {});
|
300
|
+
const localesWithErrors = Object.keys(validationErrors);
|
301
|
+
const alreadyPublishedCount = selectedRows.filter(
|
302
|
+
({ locale }) => currentStatusByLocale[locale] === "published"
|
303
|
+
).length;
|
304
|
+
const readyToPublishCount = selectedRows.filter(
|
305
|
+
({ locale }) => (currentStatusByLocale[locale] === "draft" || currentStatusByLocale[locale] === "modified") && !localesWithErrors.includes(locale)
|
306
|
+
).length;
|
307
|
+
const withErrorsCount = localesWithErrors.length;
|
308
|
+
return formatMessage(
|
309
|
+
{
|
310
|
+
id: "content-manager.containers.list.selectedEntriesModal.selectedCount",
|
311
|
+
defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
|
312
|
+
},
|
313
|
+
{
|
314
|
+
withErrorsCount,
|
315
|
+
readyToPublishCount,
|
316
|
+
alreadyPublishedCount,
|
317
|
+
b: BoldChunk
|
318
|
+
}
|
319
|
+
);
|
320
|
+
};
|
321
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
322
|
+
/* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
|
323
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Table.Content, { children: [
|
324
|
+
/* @__PURE__ */ jsxs(Table.Head, { children: [
|
325
|
+
/* @__PURE__ */ jsx(Table.HeaderCheckboxCell, {}),
|
326
|
+
headers.map((head) => /* @__PURE__ */ jsx(Table.HeaderCell, { ...head }, head.name))
|
327
|
+
] }),
|
328
|
+
/* @__PURE__ */ jsx(Table.Body, { children: rows.map(({ locale, status }, index2) => {
|
329
|
+
const error = validationErrors?.[locale] ?? null;
|
330
|
+
const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
|
331
|
+
return /* @__PURE__ */ jsxs(Table.Row, { children: [
|
332
|
+
/* @__PURE__ */ jsx(Table.CheckboxCell, { id: locale, "aria-label": `Select ${locale}` }),
|
333
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: Array.isArray(localesMetadata) ? localesMetadata.find((localeEntry) => localeEntry.code === locale)?.name : locale }) }),
|
334
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(
|
335
|
+
Status,
|
336
|
+
{
|
337
|
+
display: "flex",
|
338
|
+
paddingLeft: "6px",
|
339
|
+
paddingRight: "6px",
|
340
|
+
paddingTop: "2px",
|
341
|
+
paddingBottom: "2px",
|
342
|
+
showBullet: false,
|
343
|
+
size: "S",
|
344
|
+
variant: statusVariant,
|
345
|
+
children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
346
|
+
}
|
347
|
+
) }) }),
|
348
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(EntryValidationText, { validationErrors: error, status }) }),
|
349
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
|
350
|
+
IconButton,
|
351
|
+
{
|
352
|
+
tag: Link,
|
353
|
+
to: {
|
354
|
+
search: stringify({ plugins: { i18n: { locale } } })
|
355
|
+
},
|
356
|
+
label: formatMessage(
|
357
|
+
{
|
358
|
+
id: getTranslation("Settings.list.actions.edit"),
|
359
|
+
defaultMessage: "Edit {name} locale"
|
360
|
+
},
|
361
|
+
{
|
362
|
+
name: locale
|
363
|
+
}
|
364
|
+
),
|
365
|
+
borderWidth: 0,
|
366
|
+
children: /* @__PURE__ */ jsx(Pencil, {})
|
367
|
+
}
|
368
|
+
) })
|
369
|
+
] }, index2);
|
370
|
+
}) })
|
371
|
+
] }) })
|
372
|
+
] });
|
373
|
+
};
|
272
374
|
const LocalePickerAction = ({
|
273
375
|
document,
|
274
376
|
meta,
|
@@ -423,6 +525,228 @@ const DeleteLocaleAction = ({
|
|
423
525
|
}
|
424
526
|
};
|
425
527
|
};
|
528
|
+
const BulkLocalePublishAction = ({
|
529
|
+
document: baseDocument,
|
530
|
+
documentId,
|
531
|
+
model,
|
532
|
+
collectionType
|
533
|
+
}) => {
|
534
|
+
const baseLocale = baseDocument?.locale ?? null;
|
535
|
+
const [{ query }] = useQueryParams();
|
536
|
+
const params = React.useMemo(() => buildValidParams(query), [query]);
|
537
|
+
const isPublishedTab = query.status === "published";
|
538
|
+
const { formatMessage } = useIntl();
|
539
|
+
const { hasI18n, canPublish } = useI18n();
|
540
|
+
const { toggleNotification } = useNotification();
|
541
|
+
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
542
|
+
const [selectedRows, setSelectedRows] = React.useState([]);
|
543
|
+
const [isConfirmationOpen, setIsConfirmationOpen] = React.useState(false);
|
544
|
+
const { publishMany: publishManyAction } = unstable_useDocumentActions();
|
545
|
+
const {
|
546
|
+
document,
|
547
|
+
meta: documentMeta,
|
548
|
+
schema,
|
549
|
+
validate
|
550
|
+
} = unstable_useDocument({
|
551
|
+
model,
|
552
|
+
collectionType,
|
553
|
+
documentId,
|
554
|
+
params: {
|
555
|
+
locale: baseLocale
|
556
|
+
}
|
557
|
+
});
|
558
|
+
const { data: localesMetadata = [] } = useGetLocalesQuery();
|
559
|
+
const headers = [
|
560
|
+
{
|
561
|
+
label: formatMessage({
|
562
|
+
id: "global.name",
|
563
|
+
defaultMessage: "Name"
|
564
|
+
}),
|
565
|
+
name: "name"
|
566
|
+
},
|
567
|
+
{
|
568
|
+
label: formatMessage({
|
569
|
+
id: getTranslation("CMEditViewBulkLocale.status"),
|
570
|
+
defaultMessage: "Status"
|
571
|
+
}),
|
572
|
+
name: "status"
|
573
|
+
},
|
574
|
+
{
|
575
|
+
label: formatMessage({
|
576
|
+
id: getTranslation("CMEditViewBulkLocale.publication-status"),
|
577
|
+
defaultMessage: "Publication Status"
|
578
|
+
}),
|
579
|
+
name: "publication-status"
|
580
|
+
}
|
581
|
+
];
|
582
|
+
const [rows, validationErrors] = React.useMemo(() => {
|
583
|
+
if (!document || !documentMeta?.availableLocales) {
|
584
|
+
return [[], {}];
|
585
|
+
}
|
586
|
+
const rowsFromMeta = documentMeta?.availableLocales.map((doc) => {
|
587
|
+
const { locale, status } = doc;
|
588
|
+
return { locale, status };
|
589
|
+
});
|
590
|
+
rowsFromMeta.unshift({
|
591
|
+
locale: document.locale,
|
592
|
+
status: document.status
|
593
|
+
});
|
594
|
+
const allDocuments = [document, ...documentMeta?.availableLocales ?? []];
|
595
|
+
const errors = allDocuments.reduce((errs, document2) => {
|
596
|
+
if (!document2) {
|
597
|
+
return errs;
|
598
|
+
}
|
599
|
+
const validation = validate(document2);
|
600
|
+
if (validation !== null) {
|
601
|
+
errs[document2.locale] = validation;
|
602
|
+
}
|
603
|
+
return errs;
|
604
|
+
}, {});
|
605
|
+
return [rowsFromMeta, errors];
|
606
|
+
}, [document, documentMeta?.availableLocales, validate]);
|
607
|
+
const localesToPublish = selectedRows.reduce((acc, selectedRow) => {
|
608
|
+
if (selectedRow.status !== "published" && !Object.keys(validationErrors).includes(selectedRow.locale)) {
|
609
|
+
acc.push(selectedRow.locale);
|
610
|
+
}
|
611
|
+
return acc;
|
612
|
+
}, []);
|
613
|
+
const {
|
614
|
+
data: draftRelationsCount = 0,
|
615
|
+
isLoading: isDraftRelationsLoading,
|
616
|
+
error: isDraftRelationsError
|
617
|
+
} = useGetManyDraftRelationCountQuery(
|
618
|
+
{
|
619
|
+
model,
|
620
|
+
documentIds: [documentId],
|
621
|
+
locale: localesToPublish
|
622
|
+
},
|
623
|
+
{
|
624
|
+
skip: !documentId || localesToPublish.length === 0
|
625
|
+
}
|
626
|
+
);
|
627
|
+
React.useEffect(() => {
|
628
|
+
if (isDraftRelationsError) {
|
629
|
+
toggleNotification({
|
630
|
+
type: "danger",
|
631
|
+
message: formatAPIError(isDraftRelationsError)
|
632
|
+
});
|
633
|
+
}
|
634
|
+
}, [isDraftRelationsError, toggleNotification, formatAPIError]);
|
635
|
+
if (!schema?.options?.draftAndPublish) {
|
636
|
+
return null;
|
637
|
+
}
|
638
|
+
if (!hasI18n) {
|
639
|
+
return null;
|
640
|
+
}
|
641
|
+
if (!documentId) {
|
642
|
+
return null;
|
643
|
+
}
|
644
|
+
const publish = async () => {
|
645
|
+
await publishManyAction({
|
646
|
+
model,
|
647
|
+
documentIds: [documentId],
|
648
|
+
params: {
|
649
|
+
...params,
|
650
|
+
locale: localesToPublish
|
651
|
+
}
|
652
|
+
});
|
653
|
+
setSelectedRows([]);
|
654
|
+
};
|
655
|
+
const handleAction = async () => {
|
656
|
+
if (draftRelationsCount > 0) {
|
657
|
+
setIsConfirmationOpen(true);
|
658
|
+
} else {
|
659
|
+
await publish();
|
660
|
+
}
|
661
|
+
};
|
662
|
+
const isUnpublish = document?.status === "published";
|
663
|
+
if (isUnpublish) {
|
664
|
+
console.warn(["I18N"], "Bulk locale unpublish modal not implemented");
|
665
|
+
}
|
666
|
+
if (isConfirmationOpen) {
|
667
|
+
return {
|
668
|
+
label: formatMessage({
|
669
|
+
id: "app.components.ConfirmDialog.title",
|
670
|
+
defaultMessage: "Confirmation"
|
671
|
+
}),
|
672
|
+
variant: "danger",
|
673
|
+
dialog: {
|
674
|
+
onCancel: () => {
|
675
|
+
setIsConfirmationOpen(false);
|
676
|
+
},
|
677
|
+
onConfirm: async () => {
|
678
|
+
await publish();
|
679
|
+
setIsConfirmationOpen(false);
|
680
|
+
},
|
681
|
+
type: "dialog",
|
682
|
+
title: formatMessage({
|
683
|
+
id: getTranslation("actions.publish.dialog.title"),
|
684
|
+
defaultMessage: "Confirmation"
|
685
|
+
}),
|
686
|
+
content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", gap: 2, children: [
|
687
|
+
/* @__PURE__ */ jsx(WarningCircle, { width: "2.4rem", height: "2.4rem", fill: "danger600" }),
|
688
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: formatMessage({
|
689
|
+
id: "content-manager.actions.discard.dialog.body",
|
690
|
+
defaultMessage: "Are you sure you want to discard the changes? This action is irreversible."
|
691
|
+
}) })
|
692
|
+
] })
|
693
|
+
}
|
694
|
+
};
|
695
|
+
}
|
696
|
+
return {
|
697
|
+
label: formatMessage({
|
698
|
+
id: getTranslation("CMEditViewBulkLocale.publish-title"),
|
699
|
+
defaultMessage: "Publish Multiple Locales"
|
700
|
+
}),
|
701
|
+
icon: /* @__PURE__ */ jsx(ListPlus, {}),
|
702
|
+
disabled: isPublishedTab || !canPublish,
|
703
|
+
position: ["panel"],
|
704
|
+
variant: "secondary",
|
705
|
+
dialog: {
|
706
|
+
type: "modal",
|
707
|
+
title: formatMessage({
|
708
|
+
id: getTranslation("CMEditViewBulkLocale.publish-title"),
|
709
|
+
defaultMessage: "Publish Multiple Locales"
|
710
|
+
}),
|
711
|
+
content: () => {
|
712
|
+
return /* @__PURE__ */ jsx(
|
713
|
+
Table.Root,
|
714
|
+
{
|
715
|
+
headers,
|
716
|
+
rows: rows.map((row) => ({
|
717
|
+
...row,
|
718
|
+
id: row.locale
|
719
|
+
})),
|
720
|
+
selectedRows,
|
721
|
+
onSelectedRowsChange: (tableSelectedRows) => setSelectedRows(tableSelectedRows),
|
722
|
+
children: /* @__PURE__ */ jsx(
|
723
|
+
BulkLocaleActionModal,
|
724
|
+
{
|
725
|
+
validationErrors,
|
726
|
+
headers,
|
727
|
+
rows,
|
728
|
+
localesMetadata
|
729
|
+
}
|
730
|
+
)
|
731
|
+
}
|
732
|
+
);
|
733
|
+
},
|
734
|
+
footer: () => /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsx(
|
735
|
+
Button$1,
|
736
|
+
{
|
737
|
+
loading: isDraftRelationsLoading,
|
738
|
+
disabled: localesToPublish.length === 0,
|
739
|
+
variant: "default",
|
740
|
+
onClick: handleAction,
|
741
|
+
children: formatMessage({
|
742
|
+
id: "app.utils.publish",
|
743
|
+
defaultMessage: "Publish"
|
744
|
+
})
|
745
|
+
}
|
746
|
+
) })
|
747
|
+
}
|
748
|
+
};
|
749
|
+
};
|
426
750
|
const StyledTrash = styled(Trash)`
|
427
751
|
path {
|
428
752
|
fill: currentColor;
|
@@ -918,7 +1242,7 @@ const index = {
|
|
918
1242
|
},
|
919
1243
|
id: "internationalization",
|
920
1244
|
to: "internationalization",
|
921
|
-
Component: () => import("./SettingsPage-
|
1245
|
+
Component: () => import("./SettingsPage-0FFSTUW2.mjs").then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
922
1246
|
permissions: PERMISSIONS.accessMain
|
923
1247
|
});
|
924
1248
|
const contentManager = app.getPlugin("content-manager");
|
@@ -928,6 +1252,10 @@ const index = {
|
|
928
1252
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
929
1253
|
return actions;
|
930
1254
|
});
|
1255
|
+
contentManager.apis.addDocumentAction((actions) => {
|
1256
|
+
actions.splice(2, 0, BulkLocalePublishAction);
|
1257
|
+
return actions;
|
1258
|
+
});
|
931
1259
|
contentManager.injectComponent("listView", "actions", {
|
932
1260
|
name: "i18n-locale-filter",
|
933
1261
|
Component: LocalePicker
|
@@ -1031,7 +1359,7 @@ const index = {
|
|
1031
1359
|
async registerTrads({ locales }) {
|
1032
1360
|
const importedTrads = await Promise.all(
|
1033
1361
|
locales.map((locale) => {
|
1034
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-9eCAqqrB.mjs"), "./translations/dk.json": () => import("./dk-2qBjxt-P.mjs"), "./translations/en.json": () => import("./en-
|
1362
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => import("./de-9eCAqqrB.mjs"), "./translations/dk.json": () => import("./dk-2qBjxt-P.mjs"), "./translations/en.json": () => import("./en-18tWw4P6.mjs"), "./translations/es.json": () => import("./es-DlmMVaBG.mjs"), "./translations/fr.json": () => import("./fr-3S6ke71d.mjs"), "./translations/ko.json": () => import("./ko-qTjQ8IMw.mjs"), "./translations/pl.json": () => import("./pl-B67TSHqT.mjs"), "./translations/ru.json": () => import("./ru-hagMa57T.mjs"), "./translations/tr.json": () => import("./tr-Dw_jmkG-.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-Dyc-aR-h.mjs"), "./translations/zh.json": () => import("./zh-57YM4amO.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
1035
1363
|
return {
|
1036
1364
|
data: prefixPluginTranslations(data, pluginId),
|
1037
1365
|
locale
|
@@ -1053,9 +1381,8 @@ export {
|
|
1053
1381
|
useDeleteLocaleMutation as b,
|
1054
1382
|
useUpdateLocaleMutation as c,
|
1055
1383
|
useGetLocalesQuery as d,
|
1056
|
-
index as e,
|
1057
1384
|
getTranslation as g,
|
1058
|
-
|
1385
|
+
index as i,
|
1059
1386
|
useCreateLocaleMutation as u
|
1060
1387
|
};
|
1061
|
-
//# sourceMappingURL=index-
|
1388
|
+
//# sourceMappingURL=index-BddUXwss.mjs.map
|