@strapi/i18n 0.0.0-next.d9724d67b33363354d7171a9f2265e1c42485e13 → 0.0.0-next.da19c0501ff87d14fb664b55b8e0630d3c548485

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/admin/components/CMHeaderActions.js +132 -1
  2. package/dist/admin/components/CMHeaderActions.js.map +1 -1
  3. package/dist/admin/components/CMHeaderActions.mjs +135 -5
  4. package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
  5. package/dist/admin/components/CreateLocale.js +1 -1
  6. package/dist/admin/components/CreateLocale.js.map +1 -1
  7. package/dist/admin/components/CreateLocale.mjs +1 -1
  8. package/dist/admin/components/CreateLocale.mjs.map +1 -1
  9. package/dist/admin/components/EditLocale.js +1 -1
  10. package/dist/admin/components/EditLocale.js.map +1 -1
  11. package/dist/admin/components/EditLocale.mjs +1 -1
  12. package/dist/admin/components/EditLocale.mjs.map +1 -1
  13. package/dist/admin/components/LocaleListCell.js +65 -45
  14. package/dist/admin/components/LocaleListCell.js.map +1 -1
  15. package/dist/admin/components/LocaleListCell.mjs +66 -46
  16. package/dist/admin/components/LocaleListCell.mjs.map +1 -1
  17. package/dist/admin/components/LocalePicker.js +18 -11
  18. package/dist/admin/components/LocalePicker.js.map +1 -1
  19. package/dist/admin/components/LocalePicker.mjs +19 -12
  20. package/dist/admin/components/LocalePicker.mjs.map +1 -1
  21. package/dist/admin/contentManagerHooks/editView.js +6 -3
  22. package/dist/admin/contentManagerHooks/editView.js.map +1 -1
  23. package/dist/admin/contentManagerHooks/editView.mjs +7 -4
  24. package/dist/admin/contentManagerHooks/editView.mjs.map +1 -1
  25. package/dist/admin/contentManagerHooks/listView.js +2 -1
  26. package/dist/admin/contentManagerHooks/listView.js.map +1 -1
  27. package/dist/admin/contentManagerHooks/listView.mjs +2 -1
  28. package/dist/admin/contentManagerHooks/listView.mjs.map +1 -1
  29. package/dist/admin/hooks/useAILocalizationJobsPolling.js +91 -0
  30. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  31. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +70 -0
  32. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  33. package/dist/admin/index.js +1 -0
  34. package/dist/admin/index.js.map +1 -1
  35. package/dist/admin/index.mjs +2 -1
  36. package/dist/admin/index.mjs.map +1 -1
  37. package/dist/admin/pages/SettingsPage.js +121 -46
  38. package/dist/admin/pages/SettingsPage.js.map +1 -1
  39. package/dist/admin/pages/SettingsPage.mjs +124 -30
  40. package/dist/admin/pages/SettingsPage.mjs.map +1 -1
  41. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  42. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  43. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  44. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  45. package/dist/admin/services/api.js +3 -1
  46. package/dist/admin/services/api.js.map +1 -1
  47. package/dist/admin/services/api.mjs +3 -1
  48. package/dist/admin/services/api.mjs.map +1 -1
  49. package/dist/admin/services/settings.js +29 -0
  50. package/dist/admin/services/settings.js.map +1 -0
  51. package/dist/admin/services/settings.mjs +26 -0
  52. package/dist/admin/services/settings.mjs.map +1 -0
  53. package/dist/admin/src/components/CMHeaderActions.d.ts +7 -1
  54. package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
  55. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  56. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  57. package/dist/admin/src/services/api.d.ts +1 -1
  58. package/dist/admin/src/services/locales.d.ts +1 -1
  59. package/dist/admin/src/services/relations.d.ts +1 -1
  60. package/dist/admin/src/services/settings.d.ts +5 -0
  61. package/dist/admin/translations/en.json.js +9 -0
  62. package/dist/admin/translations/en.json.js.map +1 -1
  63. package/dist/admin/translations/en.json.mjs +9 -0
  64. package/dist/admin/translations/en.json.mjs.map +1 -1
  65. package/dist/admin/utils/clean.js +2 -2
  66. package/dist/admin/utils/clean.js.map +1 -1
  67. package/dist/admin/utils/clean.mjs +2 -2
  68. package/dist/admin/utils/clean.mjs.map +1 -1
  69. package/dist/server/bootstrap.js +2 -0
  70. package/dist/server/bootstrap.js.map +1 -1
  71. package/dist/server/bootstrap.mjs +2 -0
  72. package/dist/server/bootstrap.mjs.map +1 -1
  73. package/dist/server/constants/iso-locales.json.js +4 -0
  74. package/dist/server/constants/iso-locales.json.js.map +1 -1
  75. package/dist/server/constants/iso-locales.json.mjs +4 -0
  76. package/dist/server/constants/iso-locales.json.mjs.map +1 -1
  77. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  78. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  79. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  80. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  81. package/dist/server/controllers/index.js +5 -1
  82. package/dist/server/controllers/index.js.map +1 -1
  83. package/dist/server/controllers/index.mjs +5 -1
  84. package/dist/server/controllers/index.mjs.map +1 -1
  85. package/dist/server/controllers/settings.js +24 -0
  86. package/dist/server/controllers/settings.js.map +1 -0
  87. package/dist/server/controllers/settings.mjs +22 -0
  88. package/dist/server/controllers/settings.mjs.map +1 -0
  89. package/dist/server/models/ai-localization-job.js +60 -0
  90. package/dist/server/models/ai-localization-job.js.map +1 -0
  91. package/dist/server/models/ai-localization-job.mjs +57 -0
  92. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  93. package/dist/server/register.js +3 -1
  94. package/dist/server/register.js.map +1 -1
  95. package/dist/server/register.mjs +3 -1
  96. package/dist/server/register.mjs.map +1 -1
  97. package/dist/server/routes/admin.js +40 -0
  98. package/dist/server/routes/admin.js.map +1 -1
  99. package/dist/server/routes/admin.mjs +40 -0
  100. package/dist/server/routes/admin.mjs.map +1 -1
  101. package/dist/server/services/ai-localization-jobs.js +64 -0
  102. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  103. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  104. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  105. package/dist/server/services/ai-localizations.js +210 -0
  106. package/dist/server/services/ai-localizations.js.map +1 -0
  107. package/dist/server/services/ai-localizations.mjs +208 -0
  108. package/dist/server/services/ai-localizations.mjs.map +1 -0
  109. package/dist/server/services/index.js +7 -1
  110. package/dist/server/services/index.js.map +1 -1
  111. package/dist/server/services/index.mjs +7 -1
  112. package/dist/server/services/index.mjs.map +1 -1
  113. package/dist/server/services/settings.js +25 -0
  114. package/dist/server/services/settings.js.map +1 -0
  115. package/dist/server/services/settings.mjs +23 -0
  116. package/dist/server/services/settings.mjs.map +1 -0
  117. package/dist/server/src/bootstrap.d.ts.map +1 -1
  118. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  119. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  120. package/dist/server/src/controllers/index.d.ts +10 -0
  121. package/dist/server/src/controllers/index.d.ts.map +1 -1
  122. package/dist/server/src/controllers/settings.d.ts +7 -0
  123. package/dist/server/src/controllers/settings.d.ts.map +1 -0
  124. package/dist/server/src/index.d.ts +44 -1
  125. package/dist/server/src/index.d.ts.map +1 -1
  126. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  127. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  128. package/dist/server/src/models/index.d.ts +5 -0
  129. package/dist/server/src/models/index.d.ts.map +1 -0
  130. package/dist/server/src/register.d.ts +1 -1
  131. package/dist/server/src/register.d.ts.map +1 -1
  132. package/dist/server/src/routes/admin.d.ts.map +1 -1
  133. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  134. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  135. package/dist/server/src/services/ai-localizations.d.ts +18 -0
  136. package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
  137. package/dist/server/src/services/index.d.ts +33 -0
  138. package/dist/server/src/services/index.d.ts.map +1 -1
  139. package/dist/server/src/services/settings.d.ts +13 -0
  140. package/dist/server/src/services/settings.d.ts.map +1 -0
  141. package/dist/server/src/utils/index.d.ts +7 -1
  142. package/dist/server/src/utils/index.d.ts.map +1 -1
  143. package/dist/server/src/validation/settings.d.ts +12 -0
  144. package/dist/server/src/validation/settings.d.ts.map +1 -0
  145. package/dist/server/utils/index.js.map +1 -1
  146. package/dist/server/utils/index.mjs.map +1 -1
  147. package/dist/server/validation/settings.js +11 -0
  148. package/dist/server/validation/settings.js.map +1 -0
  149. package/dist/server/validation/settings.mjs +9 -0
  150. package/dist/server/validation/settings.mjs.map +1 -0
  151. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  152. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  153. package/dist/shared/contracts/settings.d.ts +40 -0
  154. package/dist/shared/contracts/shared.d.ts.map +1 -0
  155. package/package.json +10 -8
@@ -2,15 +2,18 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { skipToken } from '@reduxjs/toolkit/query';
4
4
  import { useQueryParams, useForm, useNotification, useAPIErrorHandler, Table } from '@strapi/admin/strapi-admin';
5
+ import { useAIAvailability } from '@strapi/admin/strapi-admin/ee';
5
6
  import { unstable_useDocument, unstable_useDocumentActions, buildValidParams } from '@strapi/content-manager/strapi-admin';
6
- import { Dialog, Flex, Typography, Field, SingleSelect, SingleSelectOption, Button, Status, Modal } from '@strapi/design-system';
7
- import { Trash, Plus, Earth, WarningCircle, ListPlus, Cross } from '@strapi/icons';
7
+ import { Status, Box, Flex, Typography, Link, Dialog, Field, SingleSelect, SingleSelectOption, Button, Modal } from '@strapi/design-system';
8
+ import { Trash, Plus, Sparkle, Earth, WarningCircle, ListPlus, Cross } from '@strapi/icons';
8
9
  import { useIntl } from 'react-intl';
9
- import { useNavigate } from 'react-router-dom';
10
+ import { NavLink, useNavigate } from 'react-router-dom';
10
11
  import { styled } from 'styled-components';
12
+ import { useAILocalizationJobsPolling } from '../hooks/useAILocalizationJobsPolling.mjs';
11
13
  import { useI18n } from '../hooks/useI18n.mjs';
12
14
  import { useGetLocalesQuery } from '../services/locales.mjs';
13
15
  import { useGetManyDraftRelationCountQuery } from '../services/relations.mjs';
16
+ import { useGetSettingsQuery } from '../services/settings.mjs';
14
17
  import { cleanData } from '../utils/clean.mjs';
15
18
  import { getTranslation } from '../utils/getTranslation.mjs';
16
19
  import { capitalize } from '../utils/strings.mjs';
@@ -106,12 +109,18 @@ const LocalePickerAction = ({ document, meta, model, collectionType, documentId
106
109
  currentDesiredLocale
107
110
  ]);
108
111
  const currentLocale = Array.isArray(locales) ? locales.find((locale)=>locale.code === currentDesiredLocale) : undefined;
112
+ // Use meta.availableLocales instead of document.localizations
113
+ // meta.availableLocales contains all locales for the document, even when creating new locales
114
+ const availableLocales = meta?.availableLocales ?? [];
115
+ const documentLocalizations = document?.localizations ?? [];
116
+ // Prefer meta.availableLocales as it's more reliable, fallback to document.localizations
117
+ const allLocalizations = availableLocales.length > 0 ? availableLocales : documentLocalizations;
109
118
  const allCurrentLocales = [
110
119
  {
111
120
  status: getDocumentStatus(document, meta),
112
121
  locale: currentLocale?.code
113
122
  },
114
- ...document?.localizations ?? []
123
+ ...allLocalizations
115
124
  ];
116
125
  if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
117
126
  return null;
@@ -163,6 +172,119 @@ const getDocumentStatus = (document, meta)=>{
163
172
  }
164
173
  return docStatus;
165
174
  };
175
+ /* -------------------------------------------------------------------------------------------------
176
+ * AISettingsStatusAction
177
+ * -----------------------------------------------------------------------------------------------*/ const AITranslationStatusIcon = styled(Status)`
178
+ display: flex;
179
+ gap: ${({ theme })=>theme.spaces[1]};
180
+ justify-content: center;
181
+ align-items: center;
182
+ height: 100%;
183
+
184
+ // Disabled state
185
+ ${({ $isAISettingEnabled, theme })=>!$isAISettingEnabled && `
186
+ background-color: ${theme.colors.neutral150};
187
+ `}
188
+
189
+ svg {
190
+ ${({ $isAISettingEnabled, theme })=>!$isAISettingEnabled && `
191
+ fill: ${theme.colors.neutral300};
192
+ `}
193
+ }
194
+ `;
195
+ const AITranslationStatusAction = ({ documentId, model, collectionType })=>{
196
+ const { formatMessage } = useIntl();
197
+ const isAIAvailable = useAIAvailability();
198
+ const { data: settings } = useGetSettingsQuery();
199
+ const isAISettingEnabled = settings?.data?.aiLocalizations;
200
+ const { hasI18n } = useI18n();
201
+ // Poll for AI localizations jobs when AI is enabled and we have a documentId
202
+ const { status } = useAILocalizationJobsPolling({
203
+ documentId,
204
+ model,
205
+ collectionType
206
+ });
207
+ const statusVariant = (()=>{
208
+ if (status === 'failed') {
209
+ return 'warning';
210
+ }
211
+ if (isAISettingEnabled) {
212
+ return 'alternative';
213
+ }
214
+ return 'neutral';
215
+ })();
216
+ // Do not display this action when i18n is not available
217
+ if (!hasI18n) {
218
+ return null;
219
+ }
220
+ // Do not display this action when AI is not available
221
+ const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');
222
+ if (!isAIAvailable || !hasAIFutureFlag) {
223
+ return null;
224
+ }
225
+ return {
226
+ status: {
227
+ message: /*#__PURE__*/ jsx(Box, {
228
+ height: "100%",
229
+ "aria-label": formatMessage({
230
+ id: getTranslation('CMEditViewAITranslation.status-aria-label'),
231
+ defaultMessage: 'AI Translation Status'
232
+ }),
233
+ children: /*#__PURE__*/ jsx(AITranslationStatusIcon, {
234
+ $isAISettingEnabled: Boolean(isAISettingEnabled),
235
+ variant: statusVariant,
236
+ size: "S",
237
+ children: /*#__PURE__*/ jsx(Sparkle, {})
238
+ })
239
+ }),
240
+ tooltip: /*#__PURE__*/ jsxs(Flex, {
241
+ direction: "column",
242
+ padding: 4,
243
+ alignItems: "flex-start",
244
+ width: "25rem",
245
+ children: [
246
+ /*#__PURE__*/ jsx(Typography, {
247
+ variant: "pi",
248
+ fontWeight: "600",
249
+ children: formatMessage({
250
+ id: getTranslation('CMEditViewAITranslation.status-title'),
251
+ defaultMessage: '{enabled, select, true {AI translation enabled} false {AI translation disabled} other {AI translation disabled}}'
252
+ }, {
253
+ enabled: isAISettingEnabled
254
+ })
255
+ }),
256
+ /*#__PURE__*/ jsx(Typography, {
257
+ variant: "pi",
258
+ paddingTop: 1,
259
+ paddingBottom: 3,
260
+ children: formatMessage({
261
+ id: getTranslation('CMEditViewAITranslation.status-description'),
262
+ defaultMessage: 'Our AI translates content in all locales each time you save a modification.'
263
+ })
264
+ }),
265
+ /*#__PURE__*/ jsx(Link, {
266
+ fontSize: "inherit",
267
+ tag: NavLink,
268
+ to: "/settings/internationalization",
269
+ style: {
270
+ alignSelf: 'flex-end'
271
+ },
272
+ children: /*#__PURE__*/ jsx(Typography, {
273
+ variant: "pi",
274
+ textAlign: "right",
275
+ children: formatMessage({
276
+ id: getTranslation('CMEditViewAITranslation.settings-link'),
277
+ defaultMessage: '{enabled, select, true {Disable it in settings} false {Enable it in settings} other {Enable it in settings}}'
278
+ }, {
279
+ enabled: isAISettingEnabled
280
+ })
281
+ })
282
+ })
283
+ ]
284
+ })
285
+ }
286
+ };
287
+ };
166
288
  /* -------------------------------------------------------------------------------------------------
167
289
  * FillFromAnotherLocaleAction
168
290
  * -----------------------------------------------------------------------------------------------*/ const FillFromAnotherLocaleAction = ({ documentId, meta, model, collectionType })=>{
@@ -182,6 +304,9 @@ const getDocumentStatus = (document, meta)=>{
182
304
  }
183
305
  });
184
306
  const { data: locales = [] } = useGetLocalesQuery();
307
+ const isAIAvailable = useAIAvailability();
308
+ const { data: settings } = useGetSettingsQuery();
309
+ const isAISettingEnabled = settings?.data?.aiLocalizations;
185
310
  const availableLocales = Array.isArray(locales) ? locales.filter((locale)=>meta?.availableLocales.some((l)=>l.locale === locale.code)) : [];
186
311
  const fillFromLocale = (onClose)=>async ()=>{
187
312
  const response = await getDocument({
@@ -203,6 +328,11 @@ const getDocumentStatus = (document, meta)=>{
203
328
  if (!hasI18n) {
204
329
  return null;
205
330
  }
331
+ // Do not display this action when AI is available and AI translations are enabled
332
+ const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');
333
+ if (hasAIFutureFlag && isAIAvailable && isAISettingEnabled) {
334
+ return null;
335
+ }
206
336
  return {
207
337
  type: 'icon',
208
338
  icon: /*#__PURE__*/ jsx(Earth, {}),
@@ -692,5 +822,5 @@ const getDocumentStatus = (document, meta)=>{
692
822
  }
693
823
  `;
694
824
 
695
- export { BulkLocalePublishAction, BulkLocaleUnpublishAction, DeleteLocaleAction, FillFromAnotherLocaleAction, LocalePickerAction };
825
+ export { AITranslationStatusAction, BulkLocalePublishAction, BulkLocaleUnpublishAction, DeleteLocaleAction, FillFromAnotherLocaleAction, LocalePickerAction };
696
826
  //# sourceMappingURL=CMHeaderActions.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CMHeaderActions.mjs","sources":["../../../admin/src/components/CMHeaderActions.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { skipToken } from '@reduxjs/toolkit/query';\nimport {\n useNotification,\n useQueryParams,\n Table,\n useAPIErrorHandler,\n FormErrors,\n useForm,\n} from '@strapi/admin/strapi-admin';\nimport {\n type DocumentActionComponent,\n type DocumentActionProps,\n unstable_useDocument as useDocument,\n unstable_useDocumentActions as useDocumentActions,\n buildValidParams,\n HeaderActionProps,\n} from '@strapi/content-manager/strapi-admin';\nimport {\n Flex,\n Status,\n Typography,\n Button,\n Modal,\n Field,\n SingleSelect,\n SingleSelectOption,\n Dialog,\n type StatusVariant,\n} from '@strapi/design-system';\nimport { WarningCircle, ListPlus, Trash, Earth, Cross, Plus } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { useGetManyDraftRelationCountQuery } from '../services/relations';\nimport { cleanData } from '../utils/clean';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { BulkLocaleActionModal } from './BulkLocaleActionModal';\n\nimport type { Locale } from '../../../shared/contracts/locales';\nimport type { I18nBaseQuery } from '../types';\nimport type { Modules } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * LocalePickerAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LocaleOptionProps {\n isDraftAndPublishEnabled: boolean;\n locale: Locale;\n status: 'draft' | 'published' | 'modified';\n entryExists: boolean;\n}\n\nconst statusVariants: Record<LocaleOptionProps['status'], StatusVariant> = {\n draft: 'secondary',\n published: 'success',\n modified: 'alternative',\n};\n\nconst LocaleOption = ({\n isDraftAndPublishEnabled,\n locale,\n status,\n entryExists,\n}: LocaleOptionProps) => {\n const { formatMessage } = useIntl();\n\n if (!entryExists) {\n return formatMessage(\n {\n id: getTranslation('CMEditViewLocalePicker.locale.create'),\n defaultMessage: 'Create <bold>{locale}</bold> locale',\n },\n {\n bold: (locale: React.ReactNode) => <b>{locale}</b>,\n locale: locale.name,\n }\n );\n }\n\n return (\n <Flex width=\"100%\" gap={1} justifyContent=\"space-between\">\n <Typography>{locale.name}</Typography>\n {isDraftAndPublishEnabled ? (\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size=\"S\"\n variant={statusVariants[status]}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n ) : null}\n </Flex>\n );\n};\n\nconst LocalePickerAction = ({\n document,\n meta,\n model,\n collectionType,\n documentId,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<I18nBaseQuery>();\n const { hasI18n, canCreate, canRead } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const { schema } = useDocument({\n model,\n collectionType,\n documentId,\n params: { locale: currentDesiredLocale },\n });\n\n const handleSelect = React.useCallback(\n (value: string) => {\n setQuery({\n plugins: {\n ...query.plugins,\n i18n: {\n locale: value,\n },\n },\n });\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleSelect(defaultLocale.code);\n }\n }, [handleSelect, hasI18n, locales, currentDesiredLocale]);\n\n const currentLocale = Array.isArray(locales)\n ? locales.find((locale) => locale.code === currentDesiredLocale)\n : undefined;\n\n const allCurrentLocales = [\n { status: getDocumentStatus(document, meta), locale: currentLocale?.code },\n ...(document?.localizations ?? []),\n ];\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n const displayedLocales = locales.filter((locale) => {\n /**\n * If you can read we allow you to see the locale exists\n * otherwise the locale is hidden.\n */\n return canRead.includes(locale.code);\n });\n\n return {\n label: formatMessage({\n id: getTranslation('Settings.locales.modal.locales.label'),\n defaultMessage: 'Locales',\n }),\n options: displayedLocales.map((locale) => {\n const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);\n\n const currentLocaleDoc = allCurrentLocales.find((doc) =>\n 'locale' in doc ? doc.locale === locale.code : false\n );\n\n const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;\n\n return {\n disabled: !permissionsToCheck.includes(locale.code),\n value: locale.code,\n label: (\n <LocaleOption\n isDraftAndPublishEnabled={!!schema?.options?.draftAndPublish}\n locale={locale}\n status={currentLocaleDoc?.status}\n entryExists={entryWithLocaleExists}\n />\n ),\n startIcon: !entryWithLocaleExists ? <Plus /> : null,\n };\n }),\n customizeContent: () => currentLocale?.name,\n onSelect: handleSelect,\n value: currentLocale,\n };\n};\n\ntype UseDocument = typeof useDocument;\n\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FillFromAnotherLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst FillFromAnotherLocaleAction = ({\n documentId,\n meta,\n model,\n collectionType,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { hasI18n } = useI18n();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const [localeSelected, setLocaleSelected] = React.useState<string | null>(null);\n const setValues = useForm('FillFromAnotherLocale', (state) => state.setValues);\n\n const { getDocument } = useDocumentActions();\n const { schema, components } = useDocument({\n model,\n documentId,\n collectionType,\n params: { locale: currentDesiredLocale },\n });\n const { data: locales = [] } = useGetLocalesQuery();\n\n const availableLocales = Array.isArray(locales)\n ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code))\n : [];\n\n const fillFromLocale = (onClose: () => void) => async () => {\n const response = await getDocument({\n collectionType,\n model,\n documentId,\n params: { locale: localeSelected },\n });\n if (!response || !schema) {\n return;\n }\n\n const { data } = response;\n\n const cleanedData = cleanData(data, schema, components);\n\n setValues(cleanedData);\n\n onClose();\n };\n\n if (!hasI18n) {\n return null;\n }\n\n return {\n type: 'icon',\n icon: <Earth />,\n disabled: availableLocales.length === 0,\n label: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.copy-text'),\n defaultMessage: 'Fill in from another locale',\n }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: ({ onClose }: { onClose: () => void }) => (\n <>\n <Dialog.Body>\n <Flex direction=\"column\" gap={3}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.body'),\n defaultMessage:\n 'Your current content will be erased and filled by the content of the selected locale:',\n })}\n </Typography>\n <Field.Root width=\"100%\">\n <Field.Label>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.label'),\n defaultMessage: 'Locale',\n })}\n </Field.Label>\n <SingleSelect\n value={localeSelected}\n placeholder={formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.placeholder'),\n defaultMessage: 'Select one locale...',\n })}\n // @ts-expect-error – the DS will handle numbers, but we're not allowing the API.\n onChange={(value) => setLocaleSelected(value)}\n >\n {availableLocales.map((locale) => (\n <SingleSelectOption key={locale.code} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n </Field.Root>\n </Flex>\n </Dialog.Body>\n <Dialog.Footer>\n <Flex gap={2} width=\"100%\">\n <Button flex=\"auto\" variant=\"tertiary\" onClick={onClose}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.cancel-text'),\n defaultMessage: 'No, cancel',\n })}\n </Button>\n <Button flex=\"auto\" variant=\"success\" onClick={fillFromLocale(onClose)}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.submit-text'),\n defaultMessage: 'Yes, fill in',\n })}\n </Button>\n </Flex>\n </Dialog.Footer>\n </>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DeleteLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst DeleteLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n}) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const { toggleNotification } = useNotification();\n const { delete: deleteAction, isLoading } = useDocumentActions();\n const { hasI18n, canDelete } = useI18n();\n\n // Get the current locale object, using the URL instead of document so it works while creating\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const locale = !('error' in locales) && locales.find((loc) => loc.code === currentDesiredLocale);\n\n if (!hasI18n) {\n return null;\n }\n\n return {\n disabled:\n (document?.locale && !canDelete.includes(document.locale)) || !document || !document.id,\n position: ['header', 'table-row'],\n label: formatMessage(\n {\n id: getTranslation('actions.delete.label'),\n defaultMessage: 'Delete entry ({locale})',\n },\n { locale: locale && locale.name }\n ),\n icon: <StyledTrash />,\n variant: 'danger',\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.delete.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" gap={2}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography tag=\"p\" variant=\"omega\" textAlign=\"center\">\n {formatMessage({\n id: getTranslation('actions.delete.dialog.body'),\n defaultMessage: 'Are you sure?',\n })}\n </Typography>\n </Flex>\n ),\n loading: isLoading,\n onConfirm: async () => {\n const unableToDelete =\n // We are unable to delete a collection type without a document ID\n // & unable to delete generally if there is no document locale\n (collectionType !== 'single-types' && !documentId) || !document?.locale;\n\n if (unableToDelete) {\n console.error(\n \"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: getTranslation('actions.delete.error'),\n defaultMessage: 'An error occurred while trying to delete the document locale.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n const res = await deleteAction({\n documentId,\n model,\n collectionType,\n params: { locale: document.locale },\n });\n\n if (!('error' in res)) {\n navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });\n }\n },\n },\n };\n};\n\nexport type LocaleStatus = {\n locale: string;\n status: Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n};\n\ninterface ExtendedDocumentActionProps extends DocumentActionProps {\n action?: 'bulk-publish' | 'bulk-unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleAction\n *\n * This component is used to handle bulk publish and unpublish actions on locales.\n * -----------------------------------------------------------------------------------------------*/\n\nconst BulkLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n action,\n}: ExtendedDocumentActionProps) => {\n const locale = document?.locale ?? null;\n const [{ query }] = useQueryParams<{ status: 'draft' | 'published' }>();\n\n const params = React.useMemo(() => buildValidParams(query), [query]);\n const isOnPublishedTab = query.status === 'published';\n\n const { formatMessage } = useIntl();\n const { hasI18n, canPublish } = useI18n();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const [selectedRows, setSelectedRows] = React.useState<any[]>([]);\n const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] =\n React.useState<boolean>(false);\n\n const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } =\n useDocumentActions();\n\n const { schema, validate } = useDocument(\n {\n model,\n collectionType,\n documentId,\n params: {\n locale,\n },\n },\n {\n // No need to fetch the document, the data is already available in the `document` prop\n skip: true,\n }\n );\n\n const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? undefined : skipToken);\n\n const headers = [\n {\n label: formatMessage({\n id: 'global.name',\n defaultMessage: 'Name',\n }),\n name: 'name',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.status'),\n defaultMessage: 'Status',\n }),\n name: 'status',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.publication-status'),\n defaultMessage: 'Publication Status',\n }),\n name: 'publication-status',\n },\n ];\n\n // Extract the rows for the bulk locale publish modal and any validation\n // errors per locale\n const [rows, validationErrors] = React.useMemo(() => {\n if (!document) {\n return [[], {}];\n }\n\n const localizations = document.localizations ?? [];\n\n // Build the rows for the bulk locale publish modal by combining the current\n // document with all the available locales from the document meta\n const locales: LocaleStatus[] = localizations.map((doc: any) => {\n const { locale, status } = doc;\n return { locale, status };\n });\n\n // Add the current document locale\n locales.unshift({\n locale: document.locale,\n status: document.status,\n });\n\n // Build the validation errors for each locale.\n const allDocuments = [document, ...localizations];\n const errors = allDocuments.reduce<FormErrors>((errs, document) => {\n if (!document) {\n return errs;\n }\n\n // Validate each locale entry via the useDocument validate function and store any errors in a dictionary\n const validation = validate(document as Modules.Documents.AnyDocument);\n if (validation !== null) {\n errs[document.locale] = validation;\n }\n return errs;\n }, {});\n\n return [locales, errors];\n }, [document, validate]);\n\n const isBulkPublish = action === 'bulk-publish';\n const localesForAction = selectedRows.reduce((acc: string[], selectedRow: LocaleStatus) => {\n const isValidLocale =\n // Validation errors are irrelevant if we are trying to unpublish\n !isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale);\n\n const shouldAddLocale = isBulkPublish\n ? selectedRow.status !== 'published' && isValidLocale\n : selectedRow.status !== 'draft' && isValidLocale;\n\n if (shouldAddLocale) {\n acc.push(selectedRow.locale);\n }\n\n return acc;\n }, []);\n\n // TODO skipping this for now as there is a bug with the draft relation count that will be worked on separately\n // see https://www.notion.so/strapi/Count-draft-relations-56901b492efb45ab90d42fe975b32bd8?pvs=4\n const enableDraftRelationsCount = false;\n const {\n data: draftRelationsCount = 0,\n isLoading: isDraftRelationsLoading,\n error: isDraftRelationsError,\n } = useGetManyDraftRelationCountQuery(\n {\n model,\n documentIds: [documentId!],\n locale: localesForAction,\n },\n {\n skip: !enableDraftRelationsCount || !documentId || localesForAction.length === 0,\n }\n );\n\n React.useEffect(() => {\n if (isDraftRelationsError) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(isDraftRelationsError),\n });\n }\n }, [isDraftRelationsError, toggleNotification, formatAPIError]);\n\n if (!schema?.options?.draftAndPublish) {\n return null;\n }\n\n if (!hasI18n) {\n return null;\n }\n\n if (!documentId) {\n return null;\n }\n\n // This document action can be enabled given that draft and publish and i18n are\n // enabled and we can publish the current locale.\n\n const publish = async () => {\n await publishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const unpublish = async () => {\n await unpublishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const handleAction = async () => {\n if (draftRelationsCount > 0) {\n setIsDraftRelationConfirmationOpen(true);\n } else if (isBulkPublish) {\n await publish();\n } else {\n await unpublish();\n }\n };\n\n if (isDraftRelationConfirmationOpen) {\n return {\n label: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n variant: 'danger',\n dialog: {\n onCancel: () => {\n setIsDraftRelationConfirmationOpen(false);\n },\n onConfirm: async () => {\n await publish();\n\n setIsDraftRelationConfirmationOpen(false);\n },\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.publish.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" alignItems=\"center\" gap={2}>\n <WarningCircle width=\"2.4rem\" height=\"2.4rem\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.draft-relation-warning'),\n defaultMessage:\n 'Some locales are related to draft entries. Publishing them could leave broken links in your app.',\n })}\n </Typography>\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.continue-confirmation'),\n defaultMessage: 'Are you sure you want to continue?',\n })}\n </Typography>\n </Flex>\n ),\n },\n };\n }\n\n const hasPermission = selectedRows\n .map(({ locale }) => locale)\n .every((locale) => canPublish.includes(locale));\n\n return {\n label: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n variant: isBulkPublish ? 'secondary' : 'danger',\n icon: isBulkPublish ? <ListPlus /> : <Cross />,\n disabled: isOnPublishedTab || canPublish.length === 0,\n position: ['panel'],\n dialog: {\n type: 'modal',\n title: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n content: () => {\n return (\n <Table.Root\n headers={headers}\n rows={rows.map((row) => ({\n ...row,\n id: row.locale,\n }))}\n selectedRows={selectedRows}\n onSelectedRowsChange={(tableSelectedRows) => setSelectedRows(tableSelectedRows)}\n >\n <BulkLocaleActionModal\n validationErrors={validationErrors}\n headers={headers}\n rows={rows}\n localesMetadata={localesMetadata as Locale[]}\n action={action ?? 'bulk-publish'}\n />\n </Table.Root>\n );\n },\n footer: () => (\n <Modal.Footer justifyContent=\"flex-end\">\n <Button\n loading={isDraftRelationsLoading}\n disabled={!hasPermission || localesForAction.length === 0}\n variant=\"default\"\n onClick={handleAction}\n >\n {formatMessage({\n id: isBulkPublish ? 'app.utils.publish' : 'app.utils.unpublish',\n defaultMessage: isBulkPublish ? 'Publish' : 'Unpublish',\n })}\n </Button>\n </Modal.Footer>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocalePublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocalePublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-publish', ...props });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleUnpublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocaleUnpublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-unpublish', ...props });\n};\n\n/**\n * Because the icon system is completely broken, we have to do\n * this to remove the fill from the cog.\n */\nconst StyledTrash = styled(Trash)`\n path {\n fill: currentColor;\n }\n`;\n\nexport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n};\n"],"names":["statusVariants","draft","published","modified","LocaleOption","isDraftAndPublishEnabled","locale","status","entryExists","formatMessage","useIntl","id","getTranslation","defaultMessage","bold","_jsx","b","name","_jsxs","Flex","width","gap","justifyContent","Typography","Status","display","paddingLeft","paddingRight","paddingTop","paddingBottom","size","variant","tag","fontWeight","capitalize","LocalePickerAction","document","meta","model","collectionType","documentId","query","setQuery","useQueryParams","hasI18n","canCreate","canRead","useI18n","data","locales","useGetLocalesQuery","currentDesiredLocale","plugins","i18n","schema","useDocument","params","handleSelect","React","useCallback","value","useEffect","Array","isArray","doesLocaleExist","find","loc","code","defaultLocale","isDefault","currentLocale","undefined","allCurrentLocales","getDocumentStatus","localizations","length","displayedLocales","filter","includes","label","options","map","entryWithLocaleExists","some","doc","currentLocaleDoc","permissionsToCheck","disabled","draftAndPublish","startIcon","Plus","customizeContent","onSelect","docStatus","statuses","availableStatus","publishedAt","FillFromAnotherLocaleAction","localeSelected","setLocaleSelected","useState","setValues","useForm","state","getDocument","useDocumentActions","components","availableLocales","l","fillFromLocale","onClose","response","cleanedData","cleanData","type","icon","Earth","dialog","title","content","_Fragment","Dialog","Body","direction","WarningCircle","height","fill","textAlign","Field","Root","Label","SingleSelect","placeholder","onChange","SingleSelectOption","Footer","Button","flex","onClick","DeleteLocaleAction","navigate","useNavigate","toggleNotification","useNotification","delete","deleteAction","isLoading","canDelete","position","StyledTrash","loading","onConfirm","unableToDelete","console","error","message","res","pathname","replace","BulkLocaleAction","action","useMemo","buildValidParams","isOnPublishedTab","canPublish","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","selectedRows","setSelectedRows","isDraftRelationConfirmationOpen","setIsDraftRelationConfirmationOpen","publishMany","publishManyAction","unpublishMany","unpublishManyAction","validate","skip","localesMetadata","skipToken","headers","rows","validationErrors","unshift","allDocuments","errors","reduce","errs","validation","isBulkPublish","localesForAction","acc","selectedRow","isValidLocale","Object","keys","shouldAddLocale","push","enableDraftRelationsCount","draftRelationsCount","isDraftRelationsLoading","isDraftRelationsError","useGetManyDraftRelationCountQuery","documentIds","publish","unpublish","handleAction","onCancel","alignItems","hasPermission","every","ListPlus","Cross","Table","row","onSelectedRowsChange","tableSelectedRows","BulkLocaleActionModal","footer","Modal","BulkLocalePublishAction","props","BulkLocaleUnpublishAction","styled","Trash"],"mappings":";;;;;;;;;;;;;;;;;;AA4DA,MAAMA,cAAqE,GAAA;IACzEC,KAAO,EAAA,WAAA;IACPC,SAAW,EAAA,SAAA;IACXC,QAAU,EAAA;AACZ,CAAA;AAEA,MAAMC,YAAAA,GAAe,CAAC,EACpBC,wBAAwB,EACxBC,MAAM,EACNC,MAAM,EACNC,WAAW,EACO,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,IAAI,CAACF,WAAa,EAAA;AAChB,QAAA,OAAOC,aACL,CAAA;AACEE,YAAAA,EAAAA,EAAIC,cAAe,CAAA,sCAAA,CAAA;YACnBC,cAAgB,EAAA;SAElB,EAAA;YACEC,IAAM,EAAA,CAACR,uBAA4BS,GAACC,CAAAA,GAAAA,EAAAA;AAAGV,oBAAAA,QAAAA,EAAAA;;AACvCA,YAAAA,MAAAA,EAAQA,OAAOW;AACjB,SAAA,CAAA;AAEJ;AAEA,IAAA,qBACEC,IAACC,CAAAA,IAAAA,EAAAA;QAAKC,KAAM,EAAA,MAAA;QAAOC,GAAK,EAAA,CAAA;QAAGC,cAAe,EAAA,eAAA;;0BACxCP,GAACQ,CAAAA,UAAAA,EAAAA;AAAYjB,gBAAAA,QAAAA,EAAAA,MAAAA,CAAOW;;AACnBZ,YAAAA,wBAAAA,iBACCU,GAACS,CAAAA,MAAAA,EAAAA;gBACCC,OAAQ,EAAA,MAAA;gBACRC,WAAY,EAAA,KAAA;gBACZC,YAAa,EAAA,KAAA;gBACbC,UAAW,EAAA,KAAA;gBACXC,aAAc,EAAA,KAAA;gBACdC,IAAK,EAAA,GAAA;gBACLC,OAAS/B,EAAAA,cAAc,CAACO,MAAO,CAAA;AAE/B,gBAAA,QAAA,gBAAAQ,GAACQ,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A;wBACNH,eAAiBA,EAAAA,eAAAA;AACjBlB,wBAAAA,MAAAA,EAAQA,MAAU,IAAA;;;AAI1B,aAAA;YACA0D,MAAQ,EAAA,kBACN3M,GAAC4M,CAAAA,KAAAA,CAAMpF,MAAM,EAAA;oBAACjH,cAAe,EAAA,UAAA;AAC3B,oBAAA,QAAA,gBAAAP,GAACyH,CAAAA,MAAAA,EAAAA;wBACCc,OAASkD,EAAAA,uBAAAA;AACTjH,wBAAAA,QAAAA,EAAU,CAAC0H,aAAAA,IAAiBnB,gBAAiBnH,CAAAA,MAAM,KAAK,CAAA;wBACxD5C,OAAQ,EAAA,SAAA;wBACR2G,OAASoE,EAAAA,YAAAA;kCAERrM,aAAc,CAAA;AACbE,4BAAAA,EAAAA,EAAIkL,gBAAgB,mBAAsB,GAAA,qBAAA;AAC1ChL,4BAAAA,cAAAA,EAAgBgL,gBAAgB,SAAY,GAAA;AAC9C,yBAAA;;;AAIR;AACF,KAAA;AACF,CAAA;AAEA;;qGAGA,MAAM+B,0BAAmD,CAACC,KAAAA,GAAAA;AACxD,IAAA,OAAO9D,gBAAiB,CAAA;QAAEC,MAAQ,EAAA,cAAA;AAAgB,QAAA,GAAG6D;AAAM,KAAA,CAAA;AAC7D;AAEA;;qGAGA,MAAMC,4BAAqD,CAACD,KAAAA,GAAAA;AAC1D,IAAA,OAAO9D,gBAAiB,CAAA;QAAEC,MAAQ,EAAA,gBAAA;AAAkB,QAAA,GAAG6D;AAAM,KAAA,CAAA;AAC/D;AAEA;;;AAGC,IACD,MAAMxE,WAAAA,GAAc0E,MAAOC,CAAAA,KAAAA,CAAM;;;;AAIjC,CAAC;;;;"}
1
+ {"version":3,"file":"CMHeaderActions.mjs","sources":["../../../admin/src/components/CMHeaderActions.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { skipToken } from '@reduxjs/toolkit/query';\nimport {\n useNotification,\n useQueryParams,\n Table,\n useAPIErrorHandler,\n FormErrors,\n useForm,\n} from '@strapi/admin/strapi-admin';\nimport { useAIAvailability } from '@strapi/admin/strapi-admin/ee';\nimport {\n type DocumentActionComponent,\n type DocumentActionProps,\n unstable_useDocument as useDocument,\n unstable_useDocumentActions as useDocumentActions,\n buildValidParams,\n HeaderActionProps,\n} from '@strapi/content-manager/strapi-admin';\nimport {\n Flex,\n Status,\n Typography,\n Button,\n Modal,\n Field,\n SingleSelect,\n SingleSelectOption,\n Dialog,\n type StatusVariant,\n Box,\n Link,\n} from '@strapi/design-system';\nimport { WarningCircle, ListPlus, Trash, Earth, Cross, Plus, Sparkle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { NavLink, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { useAILocalizationJobsPolling } from '../hooks/useAILocalizationJobsPolling';\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { useGetManyDraftRelationCountQuery } from '../services/relations';\nimport { useGetSettingsQuery } from '../services/settings';\nimport { cleanData } from '../utils/clean';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { BulkLocaleActionModal } from './BulkLocaleActionModal';\n\nimport type { Locale } from '../../../shared/contracts/locales';\nimport type { I18nBaseQuery } from '../types';\nimport type { Modules } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * LocalePickerAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LocaleOptionProps {\n isDraftAndPublishEnabled: boolean;\n locale: Locale;\n status: 'draft' | 'published' | 'modified';\n entryExists: boolean;\n}\n\nconst statusVariants: Record<LocaleOptionProps['status'], StatusVariant> = {\n draft: 'secondary',\n published: 'success',\n modified: 'alternative',\n};\n\nconst LocaleOption = ({\n isDraftAndPublishEnabled,\n locale,\n status,\n entryExists,\n}: LocaleOptionProps) => {\n const { formatMessage } = useIntl();\n\n if (!entryExists) {\n return formatMessage(\n {\n id: getTranslation('CMEditViewLocalePicker.locale.create'),\n defaultMessage: 'Create <bold>{locale}</bold> locale',\n },\n {\n bold: (locale: React.ReactNode) => <b>{locale}</b>,\n locale: locale.name,\n }\n );\n }\n\n return (\n <Flex width=\"100%\" gap={1} justifyContent=\"space-between\">\n <Typography>{locale.name}</Typography>\n {isDraftAndPublishEnabled ? (\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size=\"S\"\n variant={statusVariants[status]}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n ) : null}\n </Flex>\n );\n};\n\nconst LocalePickerAction = ({\n document,\n meta,\n model,\n collectionType,\n documentId,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<I18nBaseQuery>();\n const { hasI18n, canCreate, canRead } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const { schema } = useDocument({\n model,\n collectionType,\n documentId,\n params: { locale: currentDesiredLocale },\n });\n\n const handleSelect = React.useCallback(\n (value: string) => {\n setQuery({\n plugins: {\n ...query.plugins,\n i18n: {\n locale: value,\n },\n },\n });\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleSelect(defaultLocale.code);\n }\n }, [handleSelect, hasI18n, locales, currentDesiredLocale]);\n\n const currentLocale = Array.isArray(locales)\n ? locales.find((locale) => locale.code === currentDesiredLocale)\n : undefined;\n\n // Use meta.availableLocales instead of document.localizations\n // meta.availableLocales contains all locales for the document, even when creating new locales\n const availableLocales = meta?.availableLocales ?? [];\n const documentLocalizations = document?.localizations ?? [];\n\n // Prefer meta.availableLocales as it's more reliable, fallback to document.localizations\n const allLocalizations = availableLocales.length > 0 ? availableLocales : documentLocalizations;\n\n const allCurrentLocales = [\n { status: getDocumentStatus(document, meta), locale: currentLocale?.code },\n ...allLocalizations,\n ];\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n const displayedLocales = locales.filter((locale) => {\n /**\n * If you can read we allow you to see the locale exists\n * otherwise the locale is hidden.\n */\n return canRead.includes(locale.code);\n });\n\n return {\n label: formatMessage({\n id: getTranslation('Settings.locales.modal.locales.label'),\n defaultMessage: 'Locales',\n }),\n options: displayedLocales.map((locale) => {\n const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);\n\n const currentLocaleDoc = allCurrentLocales.find((doc) =>\n 'locale' in doc ? doc.locale === locale.code : false\n );\n\n const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;\n\n return {\n disabled: !permissionsToCheck.includes(locale.code),\n value: locale.code,\n label: (\n <LocaleOption\n isDraftAndPublishEnabled={!!schema?.options?.draftAndPublish}\n locale={locale}\n status={currentLocaleDoc?.status}\n entryExists={entryWithLocaleExists}\n />\n ),\n startIcon: !entryWithLocaleExists ? <Plus /> : null,\n };\n }),\n customizeContent: () => currentLocale?.name,\n onSelect: handleSelect,\n value: currentLocale,\n };\n};\n\ntype UseDocument = typeof useDocument;\n\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AISettingsStatusAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst AITranslationStatusIcon = styled(Status)<{ $isAISettingEnabled: boolean }>`\n display: flex;\n gap: ${({ theme }) => theme.spaces[1]};\n justify-content: center;\n align-items: center;\n height: 100%;\n\n // Disabled state\n ${({ $isAISettingEnabled, theme }) =>\n !$isAISettingEnabled &&\n `\n background-color: ${theme.colors.neutral150};\n `}\n\n svg {\n ${({ $isAISettingEnabled, theme }) =>\n !$isAISettingEnabled &&\n `\n fill: ${theme.colors.neutral300};\n `}\n }\n`;\n\nconst AITranslationStatusAction = ({ documentId, model, collectionType }: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const isAIAvailable = useAIAvailability();\n const { data: settings } = useGetSettingsQuery();\n const isAISettingEnabled = settings?.data?.aiLocalizations;\n const { hasI18n } = useI18n();\n\n // Poll for AI localizations jobs when AI is enabled and we have a documentId\n const { status } = useAILocalizationJobsPolling({\n documentId,\n model,\n collectionType,\n });\n const statusVariant = (() => {\n if (status === 'failed') {\n return 'warning';\n }\n\n if (isAISettingEnabled) {\n return 'alternative';\n }\n\n return 'neutral';\n })();\n\n // Do not display this action when i18n is not available\n if (!hasI18n) {\n return null;\n }\n\n // Do not display this action when AI is not available\n const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');\n if (!isAIAvailable || !hasAIFutureFlag) {\n return null;\n }\n\n return {\n status: {\n message: (\n <Box\n height=\"100%\"\n aria-label={formatMessage({\n id: getTranslation('CMEditViewAITranslation.status-aria-label'),\n defaultMessage: 'AI Translation Status',\n })}\n >\n <AITranslationStatusIcon\n $isAISettingEnabled={Boolean(isAISettingEnabled)}\n variant={statusVariant}\n size=\"S\"\n >\n <Sparkle />\n </AITranslationStatusIcon>\n </Box>\n ),\n tooltip: (\n <Flex direction=\"column\" padding={4} alignItems=\"flex-start\" width=\"25rem\">\n <Typography variant=\"pi\" fontWeight=\"600\">\n {formatMessage(\n {\n id: getTranslation('CMEditViewAITranslation.status-title'),\n defaultMessage:\n '{enabled, select, true {AI translation enabled} false {AI translation disabled} other {AI translation disabled}}',\n },\n { enabled: isAISettingEnabled }\n )}\n </Typography>\n <Typography variant=\"pi\" paddingTop={1} paddingBottom={3}>\n {formatMessage({\n id: getTranslation('CMEditViewAITranslation.status-description'),\n defaultMessage:\n 'Our AI translates content in all locales each time you save a modification.',\n })}\n </Typography>\n <Link\n fontSize=\"inherit\"\n tag={NavLink}\n to=\"/settings/internationalization\"\n style={{ alignSelf: 'flex-end' }}\n >\n <Typography variant=\"pi\" textAlign=\"right\">\n {formatMessage(\n {\n id: getTranslation('CMEditViewAITranslation.settings-link'),\n defaultMessage:\n '{enabled, select, true {Disable it in settings} false {Enable it in settings} other {Enable it in settings}}',\n },\n { enabled: isAISettingEnabled }\n )}\n </Typography>\n </Link>\n </Flex>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FillFromAnotherLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst FillFromAnotherLocaleAction = ({\n documentId,\n meta,\n model,\n collectionType,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { hasI18n } = useI18n();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const [localeSelected, setLocaleSelected] = React.useState<string | null>(null);\n const setValues = useForm('FillFromAnotherLocale', (state) => state.setValues);\n\n const { getDocument } = useDocumentActions();\n const { schema, components } = useDocument({\n model,\n documentId,\n collectionType,\n params: { locale: currentDesiredLocale },\n });\n const { data: locales = [] } = useGetLocalesQuery();\n\n const isAIAvailable = useAIAvailability();\n const { data: settings } = useGetSettingsQuery();\n const isAISettingEnabled = settings?.data?.aiLocalizations;\n\n const availableLocales = Array.isArray(locales)\n ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code))\n : [];\n\n const fillFromLocale = (onClose: () => void) => async () => {\n const response = await getDocument({\n collectionType,\n model,\n documentId,\n params: { locale: localeSelected },\n });\n if (!response || !schema) {\n return;\n }\n\n const { data } = response;\n\n const cleanedData = cleanData(data, schema, components);\n\n setValues(cleanedData);\n\n onClose();\n };\n\n if (!hasI18n) {\n return null;\n }\n\n // Do not display this action when AI is available and AI translations are enabled\n const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');\n if (hasAIFutureFlag && isAIAvailable && isAISettingEnabled) {\n return null;\n }\n\n return {\n type: 'icon',\n icon: <Earth />,\n disabled: availableLocales.length === 0,\n label: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.copy-text'),\n defaultMessage: 'Fill in from another locale',\n }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: ({ onClose }: { onClose: () => void }) => (\n <>\n <Dialog.Body>\n <Flex direction=\"column\" gap={3}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.body'),\n defaultMessage:\n 'Your current content will be erased and filled by the content of the selected locale:',\n })}\n </Typography>\n <Field.Root width=\"100%\">\n <Field.Label>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.label'),\n defaultMessage: 'Locale',\n })}\n </Field.Label>\n <SingleSelect\n value={localeSelected}\n placeholder={formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.placeholder'),\n defaultMessage: 'Select one locale...',\n })}\n // @ts-expect-error – the DS will handle numbers, but we're not allowing the API.\n onChange={(value) => setLocaleSelected(value)}\n >\n {availableLocales.map((locale) => (\n <SingleSelectOption key={locale.code} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n </Field.Root>\n </Flex>\n </Dialog.Body>\n <Dialog.Footer>\n <Flex gap={2} width=\"100%\">\n <Button flex=\"auto\" variant=\"tertiary\" onClick={onClose}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.cancel-text'),\n defaultMessage: 'No, cancel',\n })}\n </Button>\n <Button flex=\"auto\" variant=\"success\" onClick={fillFromLocale(onClose)}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.submit-text'),\n defaultMessage: 'Yes, fill in',\n })}\n </Button>\n </Flex>\n </Dialog.Footer>\n </>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DeleteLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst DeleteLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n}) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const { toggleNotification } = useNotification();\n const { delete: deleteAction, isLoading } = useDocumentActions();\n const { hasI18n, canDelete } = useI18n();\n\n // Get the current locale object, using the URL instead of document so it works while creating\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const locale = !('error' in locales) && locales.find((loc) => loc.code === currentDesiredLocale);\n\n if (!hasI18n) {\n return null;\n }\n\n return {\n disabled:\n (document?.locale && !canDelete.includes(document.locale)) || !document || !document.id,\n position: ['header', 'table-row'],\n label: formatMessage(\n {\n id: getTranslation('actions.delete.label'),\n defaultMessage: 'Delete entry ({locale})',\n },\n { locale: locale && locale.name }\n ),\n icon: <StyledTrash />,\n variant: 'danger',\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.delete.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" gap={2}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography tag=\"p\" variant=\"omega\" textAlign=\"center\">\n {formatMessage({\n id: getTranslation('actions.delete.dialog.body'),\n defaultMessage: 'Are you sure?',\n })}\n </Typography>\n </Flex>\n ),\n loading: isLoading,\n onConfirm: async () => {\n const unableToDelete =\n // We are unable to delete a collection type without a document ID\n // & unable to delete generally if there is no document locale\n (collectionType !== 'single-types' && !documentId) || !document?.locale;\n\n if (unableToDelete) {\n console.error(\n \"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: getTranslation('actions.delete.error'),\n defaultMessage: 'An error occurred while trying to delete the document locale.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n const res = await deleteAction({\n documentId,\n model,\n collectionType,\n params: { locale: document.locale },\n });\n\n if (!('error' in res)) {\n navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });\n }\n },\n },\n };\n};\n\nexport type LocaleStatus = {\n locale: string;\n status: Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n};\n\ninterface ExtendedDocumentActionProps extends DocumentActionProps {\n action?: 'bulk-publish' | 'bulk-unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleAction\n *\n * This component is used to handle bulk publish and unpublish actions on locales.\n * -----------------------------------------------------------------------------------------------*/\n\nconst BulkLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n action,\n}: ExtendedDocumentActionProps) => {\n const locale = document?.locale ?? null;\n const [{ query }] = useQueryParams<{ status: 'draft' | 'published' }>();\n\n const params = React.useMemo(() => buildValidParams(query), [query]);\n const isOnPublishedTab = query.status === 'published';\n\n const { formatMessage } = useIntl();\n const { hasI18n, canPublish } = useI18n();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const [selectedRows, setSelectedRows] = React.useState<any[]>([]);\n const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] =\n React.useState<boolean>(false);\n\n const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } =\n useDocumentActions();\n\n const { schema, validate } = useDocument(\n {\n model,\n collectionType,\n documentId,\n params: {\n locale,\n },\n },\n {\n // No need to fetch the document, the data is already available in the `document` prop\n skip: true,\n }\n );\n\n const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? undefined : skipToken);\n\n const headers = [\n {\n label: formatMessage({\n id: 'global.name',\n defaultMessage: 'Name',\n }),\n name: 'name',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.status'),\n defaultMessage: 'Status',\n }),\n name: 'status',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.publication-status'),\n defaultMessage: 'Publication Status',\n }),\n name: 'publication-status',\n },\n ];\n\n // Extract the rows for the bulk locale publish modal and any validation\n // errors per locale\n const [rows, validationErrors] = React.useMemo(() => {\n if (!document) {\n return [[], {}];\n }\n\n const localizations = document.localizations ?? [];\n\n // Build the rows for the bulk locale publish modal by combining the current\n // document with all the available locales from the document meta\n const locales: LocaleStatus[] = localizations.map((doc: any) => {\n const { locale, status } = doc;\n return { locale, status };\n });\n\n // Add the current document locale\n locales.unshift({\n locale: document.locale,\n status: document.status,\n });\n\n // Build the validation errors for each locale.\n const allDocuments = [document, ...localizations];\n const errors = allDocuments.reduce<FormErrors>((errs, document) => {\n if (!document) {\n return errs;\n }\n\n // Validate each locale entry via the useDocument validate function and store any errors in a dictionary\n const validation = validate(document as Modules.Documents.AnyDocument);\n if (validation !== null) {\n errs[document.locale] = validation;\n }\n return errs;\n }, {});\n\n return [locales, errors];\n }, [document, validate]);\n\n const isBulkPublish = action === 'bulk-publish';\n const localesForAction = selectedRows.reduce((acc: string[], selectedRow: LocaleStatus) => {\n const isValidLocale =\n // Validation errors are irrelevant if we are trying to unpublish\n !isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale);\n\n const shouldAddLocale = isBulkPublish\n ? selectedRow.status !== 'published' && isValidLocale\n : selectedRow.status !== 'draft' && isValidLocale;\n\n if (shouldAddLocale) {\n acc.push(selectedRow.locale);\n }\n\n return acc;\n }, []);\n\n // TODO skipping this for now as there is a bug with the draft relation count that will be worked on separately\n // see https://www.notion.so/strapi/Count-draft-relations-56901b492efb45ab90d42fe975b32bd8?pvs=4\n const enableDraftRelationsCount = false;\n const {\n data: draftRelationsCount = 0,\n isLoading: isDraftRelationsLoading,\n error: isDraftRelationsError,\n } = useGetManyDraftRelationCountQuery(\n {\n model,\n documentIds: [documentId!],\n locale: localesForAction,\n },\n {\n skip: !enableDraftRelationsCount || !documentId || localesForAction.length === 0,\n }\n );\n\n React.useEffect(() => {\n if (isDraftRelationsError) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(isDraftRelationsError),\n });\n }\n }, [isDraftRelationsError, toggleNotification, formatAPIError]);\n\n if (!schema?.options?.draftAndPublish) {\n return null;\n }\n\n if (!hasI18n) {\n return null;\n }\n\n if (!documentId) {\n return null;\n }\n\n // This document action can be enabled given that draft and publish and i18n are\n // enabled and we can publish the current locale.\n\n const publish = async () => {\n await publishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const unpublish = async () => {\n await unpublishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const handleAction = async () => {\n if (draftRelationsCount > 0) {\n setIsDraftRelationConfirmationOpen(true);\n } else if (isBulkPublish) {\n await publish();\n } else {\n await unpublish();\n }\n };\n\n if (isDraftRelationConfirmationOpen) {\n return {\n label: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n variant: 'danger',\n dialog: {\n onCancel: () => {\n setIsDraftRelationConfirmationOpen(false);\n },\n onConfirm: async () => {\n await publish();\n\n setIsDraftRelationConfirmationOpen(false);\n },\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.publish.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" alignItems=\"center\" gap={2}>\n <WarningCircle width=\"2.4rem\" height=\"2.4rem\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.draft-relation-warning'),\n defaultMessage:\n 'Some locales are related to draft entries. Publishing them could leave broken links in your app.',\n })}\n </Typography>\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.continue-confirmation'),\n defaultMessage: 'Are you sure you want to continue?',\n })}\n </Typography>\n </Flex>\n ),\n },\n };\n }\n\n const hasPermission = selectedRows\n .map(({ locale }) => locale)\n .every((locale) => canPublish.includes(locale));\n\n return {\n label: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n variant: isBulkPublish ? 'secondary' : 'danger',\n icon: isBulkPublish ? <ListPlus /> : <Cross />,\n disabled: isOnPublishedTab || canPublish.length === 0,\n position: ['panel'],\n dialog: {\n type: 'modal',\n title: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n content: () => {\n return (\n <Table.Root\n headers={headers}\n rows={rows.map((row) => ({\n ...row,\n id: row.locale,\n }))}\n selectedRows={selectedRows}\n onSelectedRowsChange={(tableSelectedRows) => setSelectedRows(tableSelectedRows)}\n >\n <BulkLocaleActionModal\n validationErrors={validationErrors}\n headers={headers}\n rows={rows}\n localesMetadata={localesMetadata as Locale[]}\n action={action ?? 'bulk-publish'}\n />\n </Table.Root>\n );\n },\n footer: () => (\n <Modal.Footer justifyContent=\"flex-end\">\n <Button\n loading={isDraftRelationsLoading}\n disabled={!hasPermission || localesForAction.length === 0}\n variant=\"default\"\n onClick={handleAction}\n >\n {formatMessage({\n id: isBulkPublish ? 'app.utils.publish' : 'app.utils.unpublish',\n defaultMessage: isBulkPublish ? 'Publish' : 'Unpublish',\n })}\n </Button>\n </Modal.Footer>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocalePublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocalePublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-publish', ...props });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleUnpublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocaleUnpublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-unpublish', ...props });\n};\n\n/**\n * Because the icon system is completely broken, we have to do\n * this to remove the fill from the cog.\n */\nconst StyledTrash = styled(Trash)`\n path {\n fill: currentColor;\n }\n`;\n\nexport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n AITranslationStatusAction,\n};\n"],"names":["statusVariants","draft","published","modified","LocaleOption","isDraftAndPublishEnabled","locale","status","entryExists","formatMessage","useIntl","id","getTranslation","defaultMessage","bold","_jsx","b","name","_jsxs","Flex","width","gap","justifyContent","Typography","Status","display","paddingLeft","paddingRight","paddingTop","paddingBottom","size","variant","tag","fontWeight","capitalize","LocalePickerAction","document","meta","model","collectionType","documentId","query","setQuery","useQueryParams","hasI18n","canCreate","canRead","useI18n","data","locales","useGetLocalesQuery","currentDesiredLocale","plugins","i18n","schema","useDocument","params","handleSelect","React","useCallback","value","useEffect","Array","isArray","doesLocaleExist","find","loc","code","defaultLocale","isDefault","currentLocale","undefined","availableLocales","documentLocalizations","localizations","allLocalizations","length","allCurrentLocales","getDocumentStatus","displayedLocales","filter","includes","label","options","map","entryWithLocaleExists","some","doc","currentLocaleDoc","permissionsToCheck","disabled","draftAndPublish","startIcon","Plus","customizeContent","onSelect","docStatus","statuses","availableStatus","publishedAt","AITranslationStatusIcon","styled","theme","spaces","$isAISettingEnabled","colors","neutral150","neutral300","AITranslationStatusAction","isAIAvailable","useAIAvailability","settings","useGetSettingsQuery","isAISettingEnabled","aiLocalizations","useAILocalizationJobsPolling","statusVariant","hasAIFutureFlag","window","strapi","future","isEnabled","message","Box","height","aria-label","Boolean","Sparkle","tooltip","direction","padding","alignItems","enabled","Link","fontSize","NavLink","to","style","alignSelf","textAlign","FillFromAnotherLocaleAction","localeSelected","setLocaleSelected","useState","setValues","useForm","state","getDocument","useDocumentActions","components","l","fillFromLocale","onClose","response","cleanedData","cleanData","type","icon","Earth","dialog","title","content","_Fragment","Dialog","Body","WarningCircle","fill","Field","Root","Label","SingleSelect","placeholder","onChange","SingleSelectOption","Footer","Button","flex","onClick","DeleteLocaleAction","navigate","useNavigate","toggleNotification","useNotification","delete","deleteAction","isLoading","canDelete","position","StyledTrash","loading","onConfirm","unableToDelete","console","error","res","pathname","replace","BulkLocaleAction","action","useMemo","buildValidParams","isOnPublishedTab","canPublish","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","selectedRows","setSelectedRows","isDraftRelationConfirmationOpen","setIsDraftRelationConfirmationOpen","publishMany","publishManyAction","unpublishMany","unpublishManyAction","validate","skip","localesMetadata","skipToken","headers","rows","validationErrors","unshift","allDocuments","errors","reduce","errs","validation","isBulkPublish","localesForAction","acc","selectedRow","isValidLocale","Object","keys","shouldAddLocale","push","enableDraftRelationsCount","draftRelationsCount","isDraftRelationsLoading","isDraftRelationsError","useGetManyDraftRelationCountQuery","documentIds","publish","unpublish","handleAction","onCancel","hasPermission","every","ListPlus","Cross","Table","row","onSelectedRowsChange","tableSelectedRows","BulkLocaleActionModal","footer","Modal","BulkLocalePublishAction","props","BulkLocaleUnpublishAction","Trash"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiEA,MAAMA,cAAqE,GAAA;IACzEC,KAAO,EAAA,WAAA;IACPC,SAAW,EAAA,SAAA;IACXC,QAAU,EAAA;AACZ,CAAA;AAEA,MAAMC,YAAAA,GAAe,CAAC,EACpBC,wBAAwB,EACxBC,MAAM,EACNC,MAAM,EACNC,WAAW,EACO,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,IAAI,CAACF,WAAa,EAAA;AAChB,QAAA,OAAOC,aACL,CAAA;AACEE,YAAAA,EAAAA,EAAIC,cAAe,CAAA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N,gBAAgB,SAAY,GAAA;AAC9C,yBAAA;;;AAIR;AACF,KAAA;AACF,CAAA;AAEA;;qGAGA,MAAM8B,0BAAmD,CAACC,KAAAA,GAAAA;AACxD,IAAA,OAAO7D,gBAAiB,CAAA;QAAEC,MAAQ,EAAA,cAAA;AAAgB,QAAA,GAAG4D;AAAM,KAAA,CAAA;AAC7D;AAEA;;qGAGA,MAAMC,4BAAqD,CAACD,KAAAA,GAAAA;AAC1D,IAAA,OAAO7D,gBAAiB,CAAA;QAAEC,MAAQ,EAAA,gBAAA;AAAkB,QAAA,GAAG4D;AAAM,KAAA,CAAA;AAC/D;AAEA;;;AAGC,IACD,MAAMtE,WAAAA,GAAcvF,MAAO+J,CAAAA,KAAAA,CAAM;;;;AAIjC,CAAC;;;;"}
@@ -103,7 +103,7 @@ const CreateModal = ({ onClose })=>{
103
103
  type: 'success',
104
104
  message: formatMessage({
105
105
  id: getTranslation.getTranslation('Settings.locales.modal.create.success'),
106
- defaultMessage: 'Created locale'
106
+ defaultMessage: 'Locale successfully added'
107
107
  })
108
108
  });
109
109
  refetchPermissions();
@@ -1 +1 @@
1
- {"version":3,"file":"CreateLocale.js","sources":["../../../admin/src/components/CreateLocale.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Form,\n type InputProps,\n InputRenderer,\n useField,\n type FormHelpers,\n useForm,\n useAPIErrorHandler,\n useNotification,\n useAuth,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n ButtonProps,\n Divider,\n Field,\n Flex,\n Grid,\n Modal,\n SingleSelect,\n SingleSelectOption,\n Tabs,\n Typography,\n useId,\n} from '@strapi/design-system';\nimport { Check, Plus } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport * as yup from 'yup';\n\nimport { CreateLocale } from '../../../shared/contracts/locales';\nimport { useCreateLocaleMutation, useGetDefaultLocalesQuery } from '../services/locales';\nimport { isBaseQueryError } from '../utils/baseQuery';\nimport { getTranslation } from '../utils/getTranslation';\n\n/* -------------------------------------------------------------------------------------------------\n * CreateLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CreateLocaleProps extends Pick<ButtonProps, 'disabled' | 'variant'> {}\n\nconst CreateLocale = ({ disabled, variant = 'default' }: CreateLocaleProps) => {\n const { formatMessage } = useIntl();\n const [visible, setVisible] = React.useState(false);\n\n return (\n <Modal.Root open={visible} onOpenChange={setVisible}>\n <Modal.Trigger>\n <Button\n variant={variant}\n disabled={disabled}\n startIcon={<Plus />}\n onClick={() => setVisible(true)}\n size=\"S\"\n >\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Button>\n </Modal.Trigger>\n <CreateModal onClose={() => setVisible(false)} />\n </Modal.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CreateModal\n * -----------------------------------------------------------------------------------------------*/\n\nconst LOCALE_SCHEMA = yup.object().shape({\n code: yup.string().nullable().required({\n id: 'Settings.locales.modal.create.code.error',\n defaultMessage: 'Please select a locale',\n }),\n name: yup\n .string()\n .nullable()\n .max(50, {\n id: 'Settings.locales.modal.create.name.error.min',\n defaultMessage: 'The locale display name can only be less than 50 characters.',\n })\n .required({\n id: 'Settings.locales.modal.create.name.error.required',\n defaultMessage: 'Please give the locale a display name',\n }),\n isDefault: yup.boolean(),\n});\n\ntype FormValues = CreateLocale.Request['body'];\n\nconst initialFormValues = {\n code: '',\n name: '',\n isDefault: false,\n} satisfies FormValues;\n\ntype ModalCreateProps = {\n onClose: () => void;\n};\n\nconst CreateModal = ({ onClose }: ModalCreateProps) => {\n const titleId = useId();\n const { toggleNotification } = useNotification();\n const {\n _unstableFormatAPIError: formatAPIError,\n _unstableFormatValidationErrors: formatValidationErrors,\n } = useAPIErrorHandler();\n const [createLocale] = useCreateLocaleMutation();\n const { formatMessage } = useIntl();\n const refetchPermissions = useAuth('CreateModal', (state) => state.refetchPermissions);\n\n const handleSubmit = async (values: FormValues, helpers: FormHelpers<FormValues>) => {\n try {\n const res = await createLocale(values);\n\n if ('error' in res) {\n if (isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n }\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.create.success'),\n defaultMessage: 'Created locale',\n }),\n });\n\n refetchPermissions();\n onClose();\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Modal.Content>\n <Form\n method=\"POST\"\n initialValues={initialFormValues}\n validationSchema={LOCALE_SCHEMA}\n onSubmit={handleSubmit}\n >\n <Modal.Header>\n <Modal.Title>\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <Tabs.Root variant=\"simple\" defaultValue=\"basic\">\n <Flex justifyContent=\"space-between\">\n <Typography tag=\"h2\" variant=\"beta\" id={titleId}>\n {formatMessage({\n id: getTranslation('Settings.locales.modal.title'),\n defaultMessage: 'Configuration',\n })}\n </Typography>\n <Tabs.List aria-labelledby={titleId}>\n <Tabs.Trigger value=\"basic\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.base'),\n defaultMessage: 'Basic settings',\n })}\n </Tabs.Trigger>\n <Tabs.Trigger value=\"advanced\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.advanced'),\n defaultMessage: 'Advanced settings',\n })}\n </Tabs.Trigger>\n </Tabs.List>\n </Flex>\n\n <Divider />\n\n <Box paddingTop={7} paddingBottom={7}>\n <Tabs.Content value=\"basic\">\n <BaseForm />\n </Tabs.Content>\n <Tabs.Content value=\"advanced\">\n <AdvancedForm />\n </Tabs.Content>\n </Box>\n </Tabs.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">\n {formatMessage({ id: 'app.components.Button.cancel', defaultMessage: 'Cancel' })}\n </Button>\n </Modal.Close>\n <SubmitButton />\n </Modal.Footer>\n </Form>\n </Modal.Content>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SubmitButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SubmitButton = () => {\n const { formatMessage } = useIntl();\n const isSubmitting = useForm('SubmitButton', (state) => state.isSubmitting);\n const modified = useForm('SubmitButton', (state) => state.modified);\n\n return (\n <Button type=\"submit\" startIcon={<Check />} disabled={isSubmitting || !modified}>\n {formatMessage({ id: 'global.save', defaultMessage: 'Save' })}\n </Button>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BaseForm\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BaseFormProps {\n mode?: 'create' | 'edit';\n}\n\nconst BaseForm = ({ mode = 'create' }: BaseFormProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { data: defaultLocales, error } = useGetDefaultLocalesQuery();\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n if (!Array.isArray(defaultLocales)) {\n return null;\n }\n\n const options = defaultLocales.map((locale) => ({\n label: locale.name,\n value: locale.code,\n }));\n\n const translatedForm = [\n {\n disabled: mode !== 'create',\n label: {\n id: getTranslation('Settings.locales.modal.create.code.label'),\n defaultMessage: 'Locales',\n },\n name: 'code',\n options,\n placeholder: {\n id: 'components.placeholder.select',\n defaultMessage: 'Select',\n },\n required: true,\n size: 6,\n type: 'enumeration' as const,\n },\n {\n hint: {\n id: getTranslation('Settings.locales.modal.create.name.label.description'),\n defaultMessage: 'Locale will be displayed under that name in the administration panel',\n },\n label: {\n id: getTranslation('Settings.locales.modal.create.name.label'),\n defaultMessage: 'Locale display name',\n },\n name: 'name',\n required: true,\n size: 6,\n type: 'string' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n placeholder: field.placeholder ? formatMessage(field.placeholder) : undefined,\n }));\n\n return (\n <Grid.Root gap={4}>\n {translatedForm.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AdvancedForm\n * -----------------------------------------------------------------------------------------------*/\n\ntype AdvancedFormProps = {\n isDefaultLocale?: boolean;\n};\n\nconst AdvancedForm = ({ isDefaultLocale }: AdvancedFormProps) => {\n const { formatMessage } = useIntl();\n\n const form = [\n {\n disabled: isDefaultLocale,\n hint: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault.hint'),\n defaultMessage: 'One default locale is required, change it by selecting another one',\n },\n label: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault'),\n defaultMessage: 'Set as default locale',\n },\n name: 'isDefault',\n size: 6,\n type: 'boolean' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n })) satisfies InputProps[];\n\n return (\n <Grid.Root gap={4}>\n {form.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FormRenderer\n * -----------------------------------------------------------------------------------------------*/\n\nconst FormRenderer = (field: InputProps) => {\n switch (field.type) {\n /**\n * This will override the default input renderer\n * choice for `enumeration`.\n */\n case 'enumeration':\n return <EnumerationInput {...field} />;\n default:\n return <InputRenderer {...field} />;\n }\n};\n\nconst EnumerationInput = ({\n disabled,\n hint,\n label,\n name,\n options,\n placeholder,\n required,\n}: Extract<InputProps, { type: 'enumeration' }>) => {\n const { value, error, onChange } = useField(name);\n const { data: defaultLocales = [] } = useGetDefaultLocalesQuery();\n\n const handleChange = (value: string) => {\n if (Array.isArray(defaultLocales)) {\n // We know it exists because the options are created from the list of default locales\n const locale = defaultLocales.find((locale) => locale.code === value)!;\n\n onChange(name, value);\n // This lets us automatically fill the name field with the locale name\n onChange('name', locale.name);\n } else {\n onChange(name, value);\n }\n };\n\n return (\n <Field.Root error={error} hint={hint} name={name} required={required}>\n <Field.Label>{label}</Field.Label>\n <SingleSelect\n disabled={disabled}\n // @ts-expect-error – This will dissapear when the DS removes support for numbers to be returned by SingleSelect.\n onChange={handleChange}\n placeholder={placeholder}\n value={value}\n >\n {options.map((option) => (\n <SingleSelectOption value={option.value} key={option.value}>\n {option.label}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n};\n\nexport { CreateLocale, BaseForm, AdvancedForm, SubmitButton, LOCALE_SCHEMA };\n"],"names":["CreateLocale","disabled","variant","formatMessage","useIntl","visible","setVisible","React","useState","_jsxs","Modal","Root","open","onOpenChange","_jsx","Trigger","Button","startIcon","Plus","onClick","size","id","getTranslation","defaultMessage","CreateModal","onClose","LOCALE_SCHEMA","yup","object","shape","code","string","nullable","required","name","max","isDefault","boolean","initialFormValues","titleId","useId","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","_unstableFormatValidationErrors","formatValidationErrors","useAPIErrorHandler","createLocale","useCreateLocaleMutation","refetchPermissions","useAuth","state","handleSubmit","values","helpers","res","isBaseQueryError","error","setErrors","type","message","err","Content","Form","method","initialValues","validationSchema","onSubmit","Header","Title","Body","Tabs","defaultValue","Flex","justifyContent","Typography","tag","List","aria-labelledby","value","Divider","Box","paddingTop","paddingBottom","BaseForm","AdvancedForm","Footer","Close","SubmitButton","isSubmitting","useForm","modified","Check","mode","data","defaultLocales","useGetDefaultLocalesQuery","useEffect","Array","isArray","options","map","locale","label","translatedForm","placeholder","hint","field","undefined","Grid","gap","Item","col","direction","alignItems","FormRenderer","isDefaultLocale","form","EnumerationInput","InputRenderer","onChange","useField","handleChange","find","Field","Label","SingleSelect","option","SingleSelectOption","Error","Hint"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAMA,eAAe,CAAC,EAAEC,QAAQ,EAAEC,OAAAA,GAAU,SAAS,EAAqB,GAAA;IACxE,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAC1B,IAAA,MAAM,CAACC,OAASC,EAAAA,UAAAA,CAAW,GAAGC,gBAAAA,CAAMC,QAAQ,CAAC,KAAA,CAAA;IAE7C,qBACEC,eAAA,CAACC,mBAAMC,IAAI,EAAA;QAACC,IAAMP,EAAAA,OAAAA;QAASQ,YAAcP,EAAAA,UAAAA;;AACvC,0BAAAQ,cAAA,CAACJ,mBAAMK,OAAO,EAAA;AACZ,gBAAA,QAAA,gBAAAD,cAACE,CAAAA,mBAAAA,EAAAA;oBACCd,OAASA,EAAAA,OAAAA;oBACTD,QAAUA,EAAAA,QAAAA;AACVgB,oBAAAA,SAAAA,gBAAWH,cAACI,CAAAA,UAAAA,EAAAA,EAAAA,CAAAA;AACZC,oBAAAA,OAAAA,EAAS,IAAMb,UAAW,CAAA,IAAA,CAAA;oBAC1Bc,IAAK,EAAA,GAAA;8BAEJjB,aAAc,CAAA;AACbkB,wBAAAA,EAAAA,EAAIC,6BAAe,CAAA,2BAAA,CAAA;wBACnBC,cAAgB,EAAA;AAClB,qBAAA;;;0BAGJT,cAACU,CAAAA,WAAAA,EAAAA;AAAYC,gBAAAA,OAAAA,EAAS,IAAMnB,UAAW,CAAA,KAAA;;;;AAG7C;AAEA;;AAEkG,2GAE5FoB,aAAgBC,GAAAA,cAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AACvCC,IAAAA,IAAAA,EAAMH,eAAII,MAAM,EAAA,CAAGC,QAAQ,EAAA,CAAGC,QAAQ,CAAC;QACrCZ,EAAI,EAAA,0CAAA;QACJE,cAAgB,EA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AAK;AACpCgD,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOxB;AADoCwB,qBAAAA,EAAAA,MAAAA,CAAOhD,KAAK,CAAA;;AAK9D,0BAAAlE,cAAA,CAAC+G,mBAAMK,KAAK,EAAA,EAAA,CAAA;AACZ,0BAAApH,cAAA,CAAC+G,mBAAMM,IAAI,EAAA,EAAA;;;AAGjB,CAAA;;;;;;;;"}
1
+ {"version":3,"file":"CreateLocale.js","sources":["../../../admin/src/components/CreateLocale.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Form,\n type InputProps,\n InputRenderer,\n useField,\n type FormHelpers,\n useForm,\n useAPIErrorHandler,\n useNotification,\n useAuth,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n ButtonProps,\n Divider,\n Field,\n Flex,\n Grid,\n Modal,\n SingleSelect,\n SingleSelectOption,\n Tabs,\n Typography,\n useId,\n} from '@strapi/design-system';\nimport { Check, Plus } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport * as yup from 'yup';\n\nimport { CreateLocale } from '../../../shared/contracts/locales';\nimport { useCreateLocaleMutation, useGetDefaultLocalesQuery } from '../services/locales';\nimport { isBaseQueryError } from '../utils/baseQuery';\nimport { getTranslation } from '../utils/getTranslation';\n\n/* -------------------------------------------------------------------------------------------------\n * CreateLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CreateLocaleProps extends Pick<ButtonProps, 'disabled' | 'variant'> {}\n\nconst CreateLocale = ({ disabled, variant = 'default' }: CreateLocaleProps) => {\n const { formatMessage } = useIntl();\n const [visible, setVisible] = React.useState(false);\n\n return (\n <Modal.Root open={visible} onOpenChange={setVisible}>\n <Modal.Trigger>\n <Button\n variant={variant}\n disabled={disabled}\n startIcon={<Plus />}\n onClick={() => setVisible(true)}\n size=\"S\"\n >\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Button>\n </Modal.Trigger>\n <CreateModal onClose={() => setVisible(false)} />\n </Modal.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CreateModal\n * -----------------------------------------------------------------------------------------------*/\n\nconst LOCALE_SCHEMA = yup.object().shape({\n code: yup.string().nullable().required({\n id: 'Settings.locales.modal.create.code.error',\n defaultMessage: 'Please select a locale',\n }),\n name: yup\n .string()\n .nullable()\n .max(50, {\n id: 'Settings.locales.modal.create.name.error.min',\n defaultMessage: 'The locale display name can only be less than 50 characters.',\n })\n .required({\n id: 'Settings.locales.modal.create.name.error.required',\n defaultMessage: 'Please give the locale a display name',\n }),\n isDefault: yup.boolean(),\n});\n\ntype FormValues = CreateLocale.Request['body'];\n\nconst initialFormValues = {\n code: '',\n name: '',\n isDefault: false,\n} satisfies FormValues;\n\ntype ModalCreateProps = {\n onClose: () => void;\n};\n\nconst CreateModal = ({ onClose }: ModalCreateProps) => {\n const titleId = useId();\n const { toggleNotification } = useNotification();\n const {\n _unstableFormatAPIError: formatAPIError,\n _unstableFormatValidationErrors: formatValidationErrors,\n } = useAPIErrorHandler();\n const [createLocale] = useCreateLocaleMutation();\n const { formatMessage } = useIntl();\n const refetchPermissions = useAuth('CreateModal', (state) => state.refetchPermissions);\n\n const handleSubmit = async (values: FormValues, helpers: FormHelpers<FormValues>) => {\n try {\n const res = await createLocale(values);\n\n if ('error' in res) {\n if (isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n }\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.create.success'),\n defaultMessage: 'Locale successfully added',\n }),\n });\n\n refetchPermissions();\n onClose();\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Modal.Content>\n <Form\n method=\"POST\"\n initialValues={initialFormValues}\n validationSchema={LOCALE_SCHEMA}\n onSubmit={handleSubmit}\n >\n <Modal.Header>\n <Modal.Title>\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <Tabs.Root variant=\"simple\" defaultValue=\"basic\">\n <Flex justifyContent=\"space-between\">\n <Typography tag=\"h2\" variant=\"beta\" id={titleId}>\n {formatMessage({\n id: getTranslation('Settings.locales.modal.title'),\n defaultMessage: 'Configuration',\n })}\n </Typography>\n <Tabs.List aria-labelledby={titleId}>\n <Tabs.Trigger value=\"basic\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.base'),\n defaultMessage: 'Basic settings',\n })}\n </Tabs.Trigger>\n <Tabs.Trigger value=\"advanced\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.advanced'),\n defaultMessage: 'Advanced settings',\n })}\n </Tabs.Trigger>\n </Tabs.List>\n </Flex>\n\n <Divider />\n\n <Box paddingTop={7} paddingBottom={7}>\n <Tabs.Content value=\"basic\">\n <BaseForm />\n </Tabs.Content>\n <Tabs.Content value=\"advanced\">\n <AdvancedForm />\n </Tabs.Content>\n </Box>\n </Tabs.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">\n {formatMessage({ id: 'app.components.Button.cancel', defaultMessage: 'Cancel' })}\n </Button>\n </Modal.Close>\n <SubmitButton />\n </Modal.Footer>\n </Form>\n </Modal.Content>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SubmitButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SubmitButton = () => {\n const { formatMessage } = useIntl();\n const isSubmitting = useForm('SubmitButton', (state) => state.isSubmitting);\n const modified = useForm('SubmitButton', (state) => state.modified);\n\n return (\n <Button type=\"submit\" startIcon={<Check />} disabled={isSubmitting || !modified}>\n {formatMessage({ id: 'global.save', defaultMessage: 'Save' })}\n </Button>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BaseForm\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BaseFormProps {\n mode?: 'create' | 'edit';\n}\n\nconst BaseForm = ({ mode = 'create' }: BaseFormProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { data: defaultLocales, error } = useGetDefaultLocalesQuery();\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n if (!Array.isArray(defaultLocales)) {\n return null;\n }\n\n const options = defaultLocales.map((locale) => ({\n label: locale.name,\n value: locale.code,\n }));\n\n const translatedForm = [\n {\n disabled: mode !== 'create',\n label: {\n id: getTranslation('Settings.locales.modal.create.code.label'),\n defaultMessage: 'Locales',\n },\n name: 'code',\n options,\n placeholder: {\n id: 'components.placeholder.select',\n defaultMessage: 'Select',\n },\n required: true,\n size: 6,\n type: 'enumeration' as const,\n },\n {\n hint: {\n id: getTranslation('Settings.locales.modal.create.name.label.description'),\n defaultMessage: 'Locale will be displayed under that name in the administration panel',\n },\n label: {\n id: getTranslation('Settings.locales.modal.create.name.label'),\n defaultMessage: 'Locale display name',\n },\n name: 'name',\n required: true,\n size: 6,\n type: 'string' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n placeholder: field.placeholder ? formatMessage(field.placeholder) : undefined,\n }));\n\n return (\n <Grid.Root gap={4}>\n {translatedForm.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AdvancedForm\n * -----------------------------------------------------------------------------------------------*/\n\ntype AdvancedFormProps = {\n isDefaultLocale?: boolean;\n};\n\nconst AdvancedForm = ({ isDefaultLocale }: AdvancedFormProps) => {\n const { formatMessage } = useIntl();\n\n const form = [\n {\n disabled: isDefaultLocale,\n hint: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault.hint'),\n defaultMessage: 'One default locale is required, change it by selecting another one',\n },\n label: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault'),\n defaultMessage: 'Set as default locale',\n },\n name: 'isDefault',\n size: 6,\n type: 'boolean' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n })) satisfies InputProps[];\n\n return (\n <Grid.Root gap={4}>\n {form.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FormRenderer\n * -----------------------------------------------------------------------------------------------*/\n\nconst FormRenderer = (field: InputProps) => {\n switch (field.type) {\n /**\n * This will override the default input renderer\n * choice for `enumeration`.\n */\n case 'enumeration':\n return <EnumerationInput {...field} />;\n default:\n return <InputRenderer {...field} />;\n }\n};\n\nconst EnumerationInput = ({\n disabled,\n hint,\n label,\n name,\n options,\n placeholder,\n required,\n}: Extract<InputProps, { type: 'enumeration' }>) => {\n const { value, error, onChange } = useField(name);\n const { data: defaultLocales = [] } = useGetDefaultLocalesQuery();\n\n const handleChange = (value: string) => {\n if (Array.isArray(defaultLocales)) {\n // We know it exists because the options are created from the list of default locales\n const locale = defaultLocales.find((locale) => locale.code === value)!;\n\n onChange(name, value);\n // This lets us automatically fill the name field with the locale name\n onChange('name', locale.name);\n } else {\n onChange(name, value);\n }\n };\n\n return (\n <Field.Root error={error} hint={hint} name={name} required={required}>\n <Field.Label>{label}</Field.Label>\n <SingleSelect\n disabled={disabled}\n // @ts-expect-error – This will dissapear when the DS removes support for numbers to be returned by SingleSelect.\n onChange={handleChange}\n placeholder={placeholder}\n value={value}\n >\n {options.map((option) => (\n <SingleSelectOption value={option.value} key={option.value}>\n {option.label}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n};\n\nexport { CreateLocale, BaseForm, AdvancedForm, SubmitButton, LOCALE_SCHEMA };\n"],"names":["CreateLocale","disabled","variant","formatMessage","useIntl","visible","setVisible","React","useState","_jsxs","Modal","Root","open","onOpenChange","_jsx","Trigger","Button","startIcon","Plus","onClick","size","id","getTranslation","defaultMessage","CreateModal","onClose","LOCALE_SCHEMA","yup","object","shape","code","string","nullable","required","name","max","isDefault","boolean","initialFormValues","titleId","useId","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","_unstableFormatValidationErrors","formatValidationErrors","useAPIErrorHandler","createLocale","useCreateLocaleMutation","refetchPermissions","useAuth","state","handleSubmit","values","helpers","res","isBaseQueryError","error","setErrors","type","message","err","Content","Form","method","initialValues","validationSchema","onSubmit","Header","Title","Body","Tabs","defaultValue","Flex","justifyContent","Typography","tag","List","aria-labelledby","value","Divider","Box","paddingTop","paddingBottom","BaseForm","AdvancedForm","Footer","Close","SubmitButton","isSubmitting","useForm","modified","Check","mode","data","defaultLocales","useGetDefaultLocalesQuery","useEffect","Array","isArray","options","map","locale","label","translatedForm","placeholder","hint","field","undefined","Grid","gap","Item","col","direction","alignItems","FormRenderer","isDefaultLocale","form","EnumerationInput","InputRenderer","onChange","useField","handleChange","find","Field","Label","SingleSelect","option","SingleSelectOption","Error","Hint"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAMA,eAAe,CAAC,EAAEC,QAAQ,EAAEC,OAAAA,GAAU,SAAS,EAAqB,GAAA;IACxE,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAC1B,IAAA,MAAM,CAACC,OAASC,EAAAA,UAAAA,CAAW,GAAGC,gBAAAA,CAAMC,QAAQ,CAAC,KAAA,CAAA;IAE7C,qBACEC,eAAA,CAACC,mBAAMC,IAAI,EAAA;QAACC,IAAMP,EAAAA,OAA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kD,KAAAA,CAAAA;AAE/DyC,YAAAA,QAAAA,CAASvF,IAAM8C,EAAAA,KAAAA,CAAAA;;YAEfyC,QAAS,CAAA,MAAA,EAAQlB,OAAOrE,IAAI,CAAA;SACvB,MAAA;AACLuF,YAAAA,QAAAA,CAASvF,IAAM8C,EAAAA,KAAAA,CAAAA;AACjB;AACF,KAAA;IAEA,qBACEvE,eAAA,CAACoH,mBAAMlH,IAAI,EAAA;QAAC+C,KAAOA,EAAAA,KAAAA;QAAOiD,IAAMA,EAAAA,IAAAA;QAAMzE,IAAMA,EAAAA,IAAAA;QAAMD,QAAUA,EAAAA,QAAAA;;AAC1D,0BAAAnB,cAAA,CAAC+G,mBAAMC,KAAK,EAAA;AAAEtB,gBAAAA,QAAAA,EAAAA;;0BACd1F,cAACiH,CAAAA,yBAAAA,EAAAA;gBACC9H,QAAUA,EAAAA,QAAAA;;gBAEVwH,QAAUE,EAAAA,YAAAA;gBACVjB,WAAaA,EAAAA,WAAAA;gBACb1B,KAAOA,EAAAA,KAAAA;AAENqB,gBAAAA,QAAAA,EAAAA,OAAAA,CAAQC,GAAG,CAAC,CAAC0B,MAAAA,iBACZlH,cAACmH,CAAAA,+BAAAA,EAAAA;AAAmBjD,wBAAAA,KAAAA,EAAOgD,OAAOhD,KAAK;AACpCgD,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOxB;AADoCwB,qBAAAA,EAAAA,MAAAA,CAAOhD,KAAK,CAAA;;AAK9D,0BAAAlE,cAAA,CAAC+G,mBAAMK,KAAK,EAAA,EAAA,CAAA;AACZ,0BAAApH,cAAA,CAAC+G,mBAAMM,IAAI,EAAA,EAAA;;;AAGjB,CAAA;;;;;;;;"}
@@ -81,7 +81,7 @@ const CreateModal = ({ onClose })=>{
81
81
  type: 'success',
82
82
  message: formatMessage({
83
83
  id: getTranslation('Settings.locales.modal.create.success'),
84
- defaultMessage: 'Created locale'
84
+ defaultMessage: 'Locale successfully added'
85
85
  })
86
86
  });
87
87
  refetchPermissions();