@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
@@ -10,7 +10,6 @@ const styledComponents = require("styled-components");
|
|
10
10
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
11
11
|
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
12
12
|
const reactRouterDom = require("react-router-dom");
|
13
|
-
const react = require("@reduxjs/toolkit/query/react");
|
14
13
|
const qs = require("qs");
|
15
14
|
const omit = require("lodash/omit");
|
16
15
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
@@ -176,76 +175,8 @@ const useI18n = () => {
|
|
176
175
|
...actions
|
177
176
|
};
|
178
177
|
};
|
179
|
-
const
|
180
|
-
|
181
|
-
const { get: get2, post, del, put } = strapiAdmin.getFetchClient();
|
182
|
-
if (typeof query === "string") {
|
183
|
-
const result = await get2(query, { signal });
|
184
|
-
return { data: result.data };
|
185
|
-
} else {
|
186
|
-
const { url, method = "GET", data, config } = query;
|
187
|
-
if (method === "POST") {
|
188
|
-
const result2 = await post(url, data, {
|
189
|
-
...config,
|
190
|
-
signal
|
191
|
-
});
|
192
|
-
return { data: result2.data };
|
193
|
-
}
|
194
|
-
if (method === "DELETE") {
|
195
|
-
const result2 = await del(url, {
|
196
|
-
...config,
|
197
|
-
signal
|
198
|
-
});
|
199
|
-
return { data: result2.data };
|
200
|
-
}
|
201
|
-
if (method === "PUT") {
|
202
|
-
const result2 = await put(url, data, {
|
203
|
-
...config,
|
204
|
-
signal
|
205
|
-
});
|
206
|
-
return { data: result2.data };
|
207
|
-
}
|
208
|
-
const result = await get2(url, {
|
209
|
-
...config,
|
210
|
-
signal
|
211
|
-
});
|
212
|
-
return { data: result.data };
|
213
|
-
}
|
214
|
-
} catch (err) {
|
215
|
-
if (strapiAdmin.isFetchError(err)) {
|
216
|
-
if (typeof err.response?.data === "object" && err.response?.data !== null && "error" in err.response?.data) {
|
217
|
-
return { data: void 0, error: err.response?.data.error };
|
218
|
-
} else {
|
219
|
-
return {
|
220
|
-
data: void 0,
|
221
|
-
error: {
|
222
|
-
name: "UnknownError",
|
223
|
-
message: "There was an unknown error response from the API",
|
224
|
-
details: err.response,
|
225
|
-
status: err.status
|
226
|
-
}
|
227
|
-
};
|
228
|
-
}
|
229
|
-
}
|
230
|
-
const error = err;
|
231
|
-
return {
|
232
|
-
data: void 0,
|
233
|
-
error: {
|
234
|
-
name: error.name,
|
235
|
-
message: error.message,
|
236
|
-
stack: error.stack
|
237
|
-
}
|
238
|
-
};
|
239
|
-
}
|
240
|
-
};
|
241
|
-
const isBaseQueryError = (error) => {
|
242
|
-
return error.name !== void 0;
|
243
|
-
};
|
244
|
-
const i18nApi = react.createApi({
|
245
|
-
reducerPath: "i18nApi",
|
246
|
-
baseQuery: fetchBaseQuery(),
|
247
|
-
tagTypes: ["Locale"],
|
248
|
-
endpoints: () => ({})
|
178
|
+
const i18nApi = strapiAdmin.adminApi.enhanceEndpoints({
|
179
|
+
addTagTypes: ["Locale"]
|
249
180
|
});
|
250
181
|
const localesApi = i18nApi.injectEndpoints({
|
251
182
|
endpoints: (builder) => ({
|
@@ -294,6 +225,176 @@ const {
|
|
294
225
|
useGetDefaultLocalesQuery,
|
295
226
|
useUpdateLocaleMutation
|
296
227
|
} = localesApi;
|
228
|
+
const relationsApi = i18nApi.injectEndpoints({
|
229
|
+
overrideExisting: true,
|
230
|
+
endpoints: (builder) => ({
|
231
|
+
getManyDraftRelationCount: builder.query({
|
232
|
+
query: ({ model, ...params }) => ({
|
233
|
+
url: `/content-manager/collection-types/${model}/actions/countManyEntriesDraftRelations`,
|
234
|
+
method: "GET",
|
235
|
+
config: {
|
236
|
+
params
|
237
|
+
}
|
238
|
+
}),
|
239
|
+
transformResponse: (response) => response.data
|
240
|
+
})
|
241
|
+
})
|
242
|
+
});
|
243
|
+
const { useGetManyDraftRelationCountQuery } = relationsApi;
|
244
|
+
const isErrorMessageDescriptor = (object) => {
|
245
|
+
return typeof object === "object" && object !== null && "id" in object && "defaultMessage" in object;
|
246
|
+
};
|
247
|
+
const EntryValidationText = ({ status = "draft", validationErrors }) => {
|
248
|
+
const { formatMessage } = reactIntl.useIntl();
|
249
|
+
const getErrorStr = (key, value) => {
|
250
|
+
if (typeof value === "string") {
|
251
|
+
return `${key}: ${value}`;
|
252
|
+
} else if (isErrorMessageDescriptor(value)) {
|
253
|
+
return `${key}: ${formatMessage(value)}`;
|
254
|
+
} else if (Array.isArray(value)) {
|
255
|
+
return value.map((v) => getErrorStr(key, v)).join(" ");
|
256
|
+
} else if (typeof value === "object" && !Array.isArray(value)) {
|
257
|
+
return Object.entries(value).map(([k, v]) => getErrorStr(k, v)).join(" ");
|
258
|
+
} else {
|
259
|
+
return "";
|
260
|
+
}
|
261
|
+
};
|
262
|
+
if (validationErrors) {
|
263
|
+
const validationErrorsMessages = Object.entries(validationErrors).map(([key, value]) => {
|
264
|
+
return getErrorStr(key, value);
|
265
|
+
}).join(" ");
|
266
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
267
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
|
268
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
|
269
|
+
designSystem.Typography,
|
270
|
+
{
|
271
|
+
maxWidth: "30rem",
|
272
|
+
textColor: "danger600",
|
273
|
+
variant: "omega",
|
274
|
+
fontWeight: "semiBold",
|
275
|
+
ellipsis: true,
|
276
|
+
children: validationErrorsMessages
|
277
|
+
}
|
278
|
+
) })
|
279
|
+
] });
|
280
|
+
}
|
281
|
+
if (status === "published") {
|
282
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
285
|
+
id: "content-manager.bulk-publish.already-published",
|
286
|
+
defaultMessage: "Already Published"
|
287
|
+
}) })
|
288
|
+
] });
|
289
|
+
}
|
290
|
+
if (status === "modified") {
|
291
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
293
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
294
|
+
id: "app.utils.ready-to-publish-changes",
|
295
|
+
defaultMessage: "Ready to publish changes"
|
296
|
+
}) })
|
297
|
+
] });
|
298
|
+
}
|
299
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
300
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
|
301
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
|
302
|
+
id: "app.utils.ready-to-publish",
|
303
|
+
defaultMessage: "Ready to publish"
|
304
|
+
}) })
|
305
|
+
] });
|
306
|
+
};
|
307
|
+
const BoldChunk = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
|
308
|
+
const BulkLocaleActionModal = ({
|
309
|
+
headers,
|
310
|
+
rows,
|
311
|
+
localesMetadata,
|
312
|
+
validationErrors = {}
|
313
|
+
}) => {
|
314
|
+
const { formatMessage } = reactIntl.useIntl();
|
315
|
+
const selectedRows = strapiAdmin.useTable(
|
316
|
+
"BulkLocaleActionModal",
|
317
|
+
(state) => state.selectedRows
|
318
|
+
);
|
319
|
+
const getFormattedCountMessage = () => {
|
320
|
+
const currentStatusByLocale = rows.reduce((acc, { locale, status }) => {
|
321
|
+
acc[locale] = status;
|
322
|
+
return acc;
|
323
|
+
}, {});
|
324
|
+
const localesWithErrors = Object.keys(validationErrors);
|
325
|
+
const alreadyPublishedCount = selectedRows.filter(
|
326
|
+
({ locale }) => currentStatusByLocale[locale] === "published"
|
327
|
+
).length;
|
328
|
+
const readyToPublishCount = selectedRows.filter(
|
329
|
+
({ locale }) => (currentStatusByLocale[locale] === "draft" || currentStatusByLocale[locale] === "modified") && !localesWithErrors.includes(locale)
|
330
|
+
).length;
|
331
|
+
const withErrorsCount = localesWithErrors.length;
|
332
|
+
return formatMessage(
|
333
|
+
{
|
334
|
+
id: "content-manager.containers.list.selectedEntriesModal.selectedCount",
|
335
|
+
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."
|
336
|
+
},
|
337
|
+
{
|
338
|
+
withErrorsCount,
|
339
|
+
readyToPublishCount,
|
340
|
+
alreadyPublishedCount,
|
341
|
+
b: BoldChunk
|
342
|
+
}
|
343
|
+
);
|
344
|
+
};
|
345
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
|
346
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: getFormattedCountMessage() }),
|
347
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
|
348
|
+
/* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Head, { children: [
|
349
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCheckboxCell, {}),
|
350
|
+
headers.map((head) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { ...head }, head.name))
|
351
|
+
] }),
|
352
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: rows.map(({ locale, status }, index2) => {
|
353
|
+
const error = validationErrors?.[locale] ?? null;
|
354
|
+
const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
|
355
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Row, { children: [
|
356
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, { id: locale, "aria-label": `Select ${locale}` }),
|
357
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: Array.isArray(localesMetadata) ? localesMetadata.find((localeEntry) => localeEntry.code === locale)?.name : locale }) }),
|
358
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { display: "flex", children: /* @__PURE__ */ jsxRuntime.jsx(
|
359
|
+
designSystem.Status,
|
360
|
+
{
|
361
|
+
display: "flex",
|
362
|
+
paddingLeft: "6px",
|
363
|
+
paddingRight: "6px",
|
364
|
+
paddingTop: "2px",
|
365
|
+
paddingBottom: "2px",
|
366
|
+
showBullet: false,
|
367
|
+
size: "S",
|
368
|
+
variant: statusVariant,
|
369
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
370
|
+
}
|
371
|
+
) }) }),
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(EntryValidationText, { validationErrors: error, status }) }),
|
373
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
374
|
+
designSystem.IconButton,
|
375
|
+
{
|
376
|
+
tag: reactRouterDom.Link,
|
377
|
+
to: {
|
378
|
+
search: qs.stringify({ plugins: { i18n: { locale } } })
|
379
|
+
},
|
380
|
+
label: formatMessage(
|
381
|
+
{
|
382
|
+
id: getTranslation("Settings.list.actions.edit"),
|
383
|
+
defaultMessage: "Edit {name} locale"
|
384
|
+
},
|
385
|
+
{
|
386
|
+
name: locale
|
387
|
+
}
|
388
|
+
),
|
389
|
+
borderWidth: 0,
|
390
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {})
|
391
|
+
}
|
392
|
+
) })
|
393
|
+
] }, index2);
|
394
|
+
}) })
|
395
|
+
] }) })
|
396
|
+
] });
|
397
|
+
};
|
297
398
|
const LocalePickerAction = ({
|
298
399
|
document,
|
299
400
|
meta,
|
@@ -448,6 +549,228 @@ const DeleteLocaleAction = ({
|
|
448
549
|
}
|
449
550
|
};
|
450
551
|
};
|
552
|
+
const BulkLocalePublishAction = ({
|
553
|
+
document: baseDocument,
|
554
|
+
documentId,
|
555
|
+
model,
|
556
|
+
collectionType
|
557
|
+
}) => {
|
558
|
+
const baseLocale = baseDocument?.locale ?? null;
|
559
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
560
|
+
const params = React__namespace.useMemo(() => strapiAdmin$1.buildValidParams(query), [query]);
|
561
|
+
const isPublishedTab = query.status === "published";
|
562
|
+
const { formatMessage } = reactIntl.useIntl();
|
563
|
+
const { hasI18n, canPublish } = useI18n();
|
564
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
565
|
+
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
566
|
+
const [selectedRows, setSelectedRows] = React__namespace.useState([]);
|
567
|
+
const [isConfirmationOpen, setIsConfirmationOpen] = React__namespace.useState(false);
|
568
|
+
const { publishMany: publishManyAction } = strapiAdmin$1.unstable_useDocumentActions();
|
569
|
+
const {
|
570
|
+
document,
|
571
|
+
meta: documentMeta,
|
572
|
+
schema,
|
573
|
+
validate
|
574
|
+
} = strapiAdmin$1.unstable_useDocument({
|
575
|
+
model,
|
576
|
+
collectionType,
|
577
|
+
documentId,
|
578
|
+
params: {
|
579
|
+
locale: baseLocale
|
580
|
+
}
|
581
|
+
});
|
582
|
+
const { data: localesMetadata = [] } = useGetLocalesQuery();
|
583
|
+
const headers = [
|
584
|
+
{
|
585
|
+
label: formatMessage({
|
586
|
+
id: "global.name",
|
587
|
+
defaultMessage: "Name"
|
588
|
+
}),
|
589
|
+
name: "name"
|
590
|
+
},
|
591
|
+
{
|
592
|
+
label: formatMessage({
|
593
|
+
id: getTranslation("CMEditViewBulkLocale.status"),
|
594
|
+
defaultMessage: "Status"
|
595
|
+
}),
|
596
|
+
name: "status"
|
597
|
+
},
|
598
|
+
{
|
599
|
+
label: formatMessage({
|
600
|
+
id: getTranslation("CMEditViewBulkLocale.publication-status"),
|
601
|
+
defaultMessage: "Publication Status"
|
602
|
+
}),
|
603
|
+
name: "publication-status"
|
604
|
+
}
|
605
|
+
];
|
606
|
+
const [rows, validationErrors] = React__namespace.useMemo(() => {
|
607
|
+
if (!document || !documentMeta?.availableLocales) {
|
608
|
+
return [[], {}];
|
609
|
+
}
|
610
|
+
const rowsFromMeta = documentMeta?.availableLocales.map((doc) => {
|
611
|
+
const { locale, status } = doc;
|
612
|
+
return { locale, status };
|
613
|
+
});
|
614
|
+
rowsFromMeta.unshift({
|
615
|
+
locale: document.locale,
|
616
|
+
status: document.status
|
617
|
+
});
|
618
|
+
const allDocuments = [document, ...documentMeta?.availableLocales ?? []];
|
619
|
+
const errors = allDocuments.reduce((errs, document2) => {
|
620
|
+
if (!document2) {
|
621
|
+
return errs;
|
622
|
+
}
|
623
|
+
const validation = validate(document2);
|
624
|
+
if (validation !== null) {
|
625
|
+
errs[document2.locale] = validation;
|
626
|
+
}
|
627
|
+
return errs;
|
628
|
+
}, {});
|
629
|
+
return [rowsFromMeta, errors];
|
630
|
+
}, [document, documentMeta?.availableLocales, validate]);
|
631
|
+
const localesToPublish = selectedRows.reduce((acc, selectedRow) => {
|
632
|
+
if (selectedRow.status !== "published" && !Object.keys(validationErrors).includes(selectedRow.locale)) {
|
633
|
+
acc.push(selectedRow.locale);
|
634
|
+
}
|
635
|
+
return acc;
|
636
|
+
}, []);
|
637
|
+
const {
|
638
|
+
data: draftRelationsCount = 0,
|
639
|
+
isLoading: isDraftRelationsLoading,
|
640
|
+
error: isDraftRelationsError
|
641
|
+
} = useGetManyDraftRelationCountQuery(
|
642
|
+
{
|
643
|
+
model,
|
644
|
+
documentIds: [documentId],
|
645
|
+
locale: localesToPublish
|
646
|
+
},
|
647
|
+
{
|
648
|
+
skip: !documentId || localesToPublish.length === 0
|
649
|
+
}
|
650
|
+
);
|
651
|
+
React__namespace.useEffect(() => {
|
652
|
+
if (isDraftRelationsError) {
|
653
|
+
toggleNotification({
|
654
|
+
type: "danger",
|
655
|
+
message: formatAPIError(isDraftRelationsError)
|
656
|
+
});
|
657
|
+
}
|
658
|
+
}, [isDraftRelationsError, toggleNotification, formatAPIError]);
|
659
|
+
if (!schema?.options?.draftAndPublish) {
|
660
|
+
return null;
|
661
|
+
}
|
662
|
+
if (!hasI18n) {
|
663
|
+
return null;
|
664
|
+
}
|
665
|
+
if (!documentId) {
|
666
|
+
return null;
|
667
|
+
}
|
668
|
+
const publish = async () => {
|
669
|
+
await publishManyAction({
|
670
|
+
model,
|
671
|
+
documentIds: [documentId],
|
672
|
+
params: {
|
673
|
+
...params,
|
674
|
+
locale: localesToPublish
|
675
|
+
}
|
676
|
+
});
|
677
|
+
setSelectedRows([]);
|
678
|
+
};
|
679
|
+
const handleAction = async () => {
|
680
|
+
if (draftRelationsCount > 0) {
|
681
|
+
setIsConfirmationOpen(true);
|
682
|
+
} else {
|
683
|
+
await publish();
|
684
|
+
}
|
685
|
+
};
|
686
|
+
const isUnpublish = document?.status === "published";
|
687
|
+
if (isUnpublish) {
|
688
|
+
console.warn(["I18N"], "Bulk locale unpublish modal not implemented");
|
689
|
+
}
|
690
|
+
if (isConfirmationOpen) {
|
691
|
+
return {
|
692
|
+
label: formatMessage({
|
693
|
+
id: "app.components.ConfirmDialog.title",
|
694
|
+
defaultMessage: "Confirmation"
|
695
|
+
}),
|
696
|
+
variant: "danger",
|
697
|
+
dialog: {
|
698
|
+
onCancel: () => {
|
699
|
+
setIsConfirmationOpen(false);
|
700
|
+
},
|
701
|
+
onConfirm: async () => {
|
702
|
+
await publish();
|
703
|
+
setIsConfirmationOpen(false);
|
704
|
+
},
|
705
|
+
type: "dialog",
|
706
|
+
title: formatMessage({
|
707
|
+
id: getTranslation("actions.publish.dialog.title"),
|
708
|
+
defaultMessage: "Confirmation"
|
709
|
+
}),
|
710
|
+
content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 2, children: [
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { width: "2.4rem", height: "2.4rem", fill: "danger600" }),
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: formatMessage({
|
713
|
+
id: "content-manager.actions.discard.dialog.body",
|
714
|
+
defaultMessage: "Are you sure you want to discard the changes? This action is irreversible."
|
715
|
+
}) })
|
716
|
+
] })
|
717
|
+
}
|
718
|
+
};
|
719
|
+
}
|
720
|
+
return {
|
721
|
+
label: formatMessage({
|
722
|
+
id: getTranslation("CMEditViewBulkLocale.publish-title"),
|
723
|
+
defaultMessage: "Publish Multiple Locales"
|
724
|
+
}),
|
725
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ListPlus, {}),
|
726
|
+
disabled: isPublishedTab || !canPublish,
|
727
|
+
position: ["panel"],
|
728
|
+
variant: "secondary",
|
729
|
+
dialog: {
|
730
|
+
type: "modal",
|
731
|
+
title: formatMessage({
|
732
|
+
id: getTranslation("CMEditViewBulkLocale.publish-title"),
|
733
|
+
defaultMessage: "Publish Multiple Locales"
|
734
|
+
}),
|
735
|
+
content: () => {
|
736
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
737
|
+
strapiAdmin.Table.Root,
|
738
|
+
{
|
739
|
+
headers,
|
740
|
+
rows: rows.map((row) => ({
|
741
|
+
...row,
|
742
|
+
id: row.locale
|
743
|
+
})),
|
744
|
+
selectedRows,
|
745
|
+
onSelectedRowsChange: (tableSelectedRows) => setSelectedRows(tableSelectedRows),
|
746
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
747
|
+
BulkLocaleActionModal,
|
748
|
+
{
|
749
|
+
validationErrors,
|
750
|
+
headers,
|
751
|
+
rows,
|
752
|
+
localesMetadata
|
753
|
+
}
|
754
|
+
)
|
755
|
+
}
|
756
|
+
);
|
757
|
+
},
|
758
|
+
footer: () => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
759
|
+
designSystem.Button,
|
760
|
+
{
|
761
|
+
loading: isDraftRelationsLoading,
|
762
|
+
disabled: localesToPublish.length === 0,
|
763
|
+
variant: "default",
|
764
|
+
onClick: handleAction,
|
765
|
+
children: formatMessage({
|
766
|
+
id: "app.utils.publish",
|
767
|
+
defaultMessage: "Publish"
|
768
|
+
})
|
769
|
+
}
|
770
|
+
) })
|
771
|
+
}
|
772
|
+
};
|
773
|
+
};
|
451
774
|
const StyledTrash = styledComponents.styled(icons.Trash)`
|
452
775
|
path {
|
453
776
|
fill: currentColor;
|
@@ -943,7 +1266,7 @@ const index = {
|
|
943
1266
|
},
|
944
1267
|
id: "internationalization",
|
945
1268
|
to: "internationalization",
|
946
|
-
Component: () => Promise.resolve().then(() => require("./SettingsPage-
|
1269
|
+
Component: () => Promise.resolve().then(() => require("./SettingsPage-DnLLGeBa.js")).then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
947
1270
|
permissions: PERMISSIONS.accessMain
|
948
1271
|
});
|
949
1272
|
const contentManager = app.getPlugin("content-manager");
|
@@ -953,6 +1276,10 @@ const index = {
|
|
953
1276
|
actions.splice(indexOfDeleteAction, 0, DeleteLocaleAction);
|
954
1277
|
return actions;
|
955
1278
|
});
|
1279
|
+
contentManager.apis.addDocumentAction((actions) => {
|
1280
|
+
actions.splice(2, 0, BulkLocalePublishAction);
|
1281
|
+
return actions;
|
1282
|
+
});
|
956
1283
|
contentManager.injectComponent("listView", "actions", {
|
957
1284
|
name: "i18n-locale-filter",
|
958
1285
|
Component: LocalePicker
|
@@ -1056,7 +1383,7 @@ const index = {
|
|
1056
1383
|
async registerTrads({ locales }) {
|
1057
1384
|
const importedTrads = await Promise.all(
|
1058
1385
|
locales.map((locale) => {
|
1059
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
1386
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Kv6y9zPQ.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-DS-XFGSw.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BTjekDpq.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-DmcGUBQ3.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-Cn5RYonZ.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BMBgVL3s.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-CarUU76c.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-DSHIXAa3.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CukOviB0.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
1060
1387
|
return {
|
1061
1388
|
data: prefixPluginTranslations(data, pluginId),
|
1062
1389
|
locale
|
@@ -1075,10 +1402,9 @@ const index = {
|
|
1075
1402
|
exports.PERMISSIONS = PERMISSIONS;
|
1076
1403
|
exports.getTranslation = getTranslation;
|
1077
1404
|
exports.index = index;
|
1078
|
-
exports.isBaseQueryError = isBaseQueryError;
|
1079
1405
|
exports.useCreateLocaleMutation = useCreateLocaleMutation;
|
1080
1406
|
exports.useDeleteLocaleMutation = useDeleteLocaleMutation;
|
1081
1407
|
exports.useGetDefaultLocalesQuery = useGetDefaultLocalesQuery;
|
1082
1408
|
exports.useGetLocalesQuery = useGetLocalesQuery;
|
1083
1409
|
exports.useUpdateLocaleMutation = useUpdateLocaleMutation;
|
1084
|
-
//# sourceMappingURL=index-
|
1410
|
+
//# sourceMappingURL=index-DtEKsPcR.js.map
|