@strapi/i18n 0.0.0-next.e21fe90bf2ab9906267ea6e6ca620bdcc729906c → 0.0.0-next.e2e3ca14971ee768e1a227a209362264fd0132d4

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 (203) hide show
  1. package/dist/admin/components/BulkLocaleActionModal.js +2 -2
  2. package/dist/admin/components/BulkLocaleActionModal.js.map +1 -1
  3. package/dist/admin/components/BulkLocaleActionModal.mjs +2 -2
  4. package/dist/admin/components/BulkLocaleActionModal.mjs.map +1 -1
  5. package/dist/admin/components/CMHeaderActions.js +294 -20
  6. package/dist/admin/components/CMHeaderActions.js.map +1 -1
  7. package/dist/admin/components/CMHeaderActions.mjs +298 -25
  8. package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
  9. package/dist/admin/components/CreateLocale.js +12 -6
  10. package/dist/admin/components/CreateLocale.js.map +1 -1
  11. package/dist/admin/components/CreateLocale.mjs +13 -7
  12. package/dist/admin/components/CreateLocale.mjs.map +1 -1
  13. package/dist/admin/components/EditLocale.js +1 -1
  14. package/dist/admin/components/EditLocale.js.map +1 -1
  15. package/dist/admin/components/EditLocale.mjs +1 -1
  16. package/dist/admin/components/EditLocale.mjs.map +1 -1
  17. package/dist/admin/components/LocaleListCell.js +65 -45
  18. package/dist/admin/components/LocaleListCell.js.map +1 -1
  19. package/dist/admin/components/LocaleListCell.mjs +66 -46
  20. package/dist/admin/components/LocaleListCell.mjs.map +1 -1
  21. package/dist/admin/components/LocalePicker.js +18 -11
  22. package/dist/admin/components/LocalePicker.js.map +1 -1
  23. package/dist/admin/components/LocalePicker.mjs +19 -12
  24. package/dist/admin/components/LocalePicker.mjs.map +1 -1
  25. package/dist/admin/contentManagerHooks/editView.js +6 -3
  26. package/dist/admin/contentManagerHooks/editView.js.map +1 -1
  27. package/dist/admin/contentManagerHooks/editView.mjs +7 -4
  28. package/dist/admin/contentManagerHooks/editView.mjs.map +1 -1
  29. package/dist/admin/contentManagerHooks/listView.js +2 -1
  30. package/dist/admin/contentManagerHooks/listView.js.map +1 -1
  31. package/dist/admin/contentManagerHooks/listView.mjs +2 -1
  32. package/dist/admin/contentManagerHooks/listView.mjs.map +1 -1
  33. package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
  34. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  35. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
  36. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  37. package/dist/admin/hooks/useI18n.js +4 -4
  38. package/dist/admin/hooks/useI18n.js.map +1 -1
  39. package/dist/admin/hooks/useI18n.mjs +4 -4
  40. package/dist/admin/hooks/useI18n.mjs.map +1 -1
  41. package/dist/admin/index.js +1 -1
  42. package/dist/admin/index.js.map +1 -1
  43. package/dist/admin/index.mjs +2 -2
  44. package/dist/admin/index.mjs.map +1 -1
  45. package/dist/admin/middlewares/extendCTBAttributeInitialData.js +34 -24
  46. package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -1
  47. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +34 -24
  48. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -1
  49. package/dist/admin/pages/SettingsPage.js +121 -46
  50. package/dist/admin/pages/SettingsPage.js.map +1 -1
  51. package/dist/admin/pages/SettingsPage.mjs +124 -30
  52. package/dist/admin/pages/SettingsPage.mjs.map +1 -1
  53. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  54. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  55. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  56. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  57. package/dist/admin/services/api.js +4 -1
  58. package/dist/admin/services/api.js.map +1 -1
  59. package/dist/admin/services/api.mjs +4 -1
  60. package/dist/admin/services/api.mjs.map +1 -1
  61. package/dist/admin/services/locales.js +4 -2
  62. package/dist/admin/services/locales.js.map +1 -1
  63. package/dist/admin/services/locales.mjs +4 -2
  64. package/dist/admin/services/locales.mjs.map +1 -1
  65. package/dist/admin/services/settings.js +30 -0
  66. package/dist/admin/services/settings.js.map +1 -0
  67. package/dist/admin/services/settings.mjs +27 -0
  68. package/dist/admin/services/settings.mjs.map +1 -0
  69. package/dist/admin/src/components/CMHeaderActions.d.ts +17 -4
  70. package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
  71. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  72. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  73. package/dist/admin/src/services/api.d.ts +1 -1
  74. package/dist/admin/src/services/locales.d.ts +1 -1
  75. package/dist/admin/src/services/relations.d.ts +1 -1
  76. package/dist/admin/src/services/settings.d.ts +5 -0
  77. package/dist/admin/src/utils/schemas.d.ts +642 -16
  78. package/dist/admin/translations/en.json.js +10 -0
  79. package/dist/admin/translations/en.json.js.map +1 -1
  80. package/dist/admin/translations/en.json.mjs +10 -0
  81. package/dist/admin/translations/en.json.mjs.map +1 -1
  82. package/dist/admin/utils/clean.js +2 -2
  83. package/dist/admin/utils/clean.js.map +1 -1
  84. package/dist/admin/utils/clean.mjs +2 -2
  85. package/dist/admin/utils/clean.mjs.map +1 -1
  86. package/dist/admin/utils/fields.js +6 -1
  87. package/dist/admin/utils/fields.js.map +1 -1
  88. package/dist/admin/utils/fields.mjs +6 -1
  89. package/dist/admin/utils/fields.mjs.map +1 -1
  90. package/dist/admin/utils/getTranslation.js.map +1 -1
  91. package/dist/admin/utils/getTranslation.mjs.map +1 -1
  92. package/dist/admin/utils/prefixPluginTranslations.js.map +1 -1
  93. package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -1
  94. package/dist/admin/utils/schemas.js +19 -13
  95. package/dist/admin/utils/schemas.js.map +1 -1
  96. package/dist/admin/utils/schemas.mjs +19 -13
  97. package/dist/admin/utils/schemas.mjs.map +1 -1
  98. package/dist/server/bootstrap.js +24 -8
  99. package/dist/server/bootstrap.js.map +1 -1
  100. package/dist/server/bootstrap.mjs +24 -8
  101. package/dist/server/bootstrap.mjs.map +1 -1
  102. package/dist/server/constants/iso-locales.json.js +4 -0
  103. package/dist/server/constants/iso-locales.json.js.map +1 -1
  104. package/dist/server/constants/iso-locales.json.mjs +4 -0
  105. package/dist/server/constants/iso-locales.json.mjs.map +1 -1
  106. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  107. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  108. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  109. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  110. package/dist/server/controllers/index.js +5 -1
  111. package/dist/server/controllers/index.js.map +1 -1
  112. package/dist/server/controllers/index.mjs +5 -1
  113. package/dist/server/controllers/index.mjs.map +1 -1
  114. package/dist/server/controllers/settings.js +24 -0
  115. package/dist/server/controllers/settings.js.map +1 -0
  116. package/dist/server/controllers/settings.mjs +22 -0
  117. package/dist/server/controllers/settings.mjs.map +1 -0
  118. package/dist/server/models/ai-localization-job.js +60 -0
  119. package/dist/server/models/ai-localization-job.js.map +1 -0
  120. package/dist/server/models/ai-localization-job.mjs +57 -0
  121. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  122. package/dist/server/register.js +3 -1
  123. package/dist/server/register.js.map +1 -1
  124. package/dist/server/register.mjs +3 -1
  125. package/dist/server/register.mjs.map +1 -1
  126. package/dist/server/routes/admin.js +40 -0
  127. package/dist/server/routes/admin.js.map +1 -1
  128. package/dist/server/routes/admin.mjs +40 -0
  129. package/dist/server/routes/admin.mjs.map +1 -1
  130. package/dist/server/routes/content-api.js +11 -7
  131. package/dist/server/routes/content-api.js.map +1 -1
  132. package/dist/server/routes/content-api.mjs +11 -7
  133. package/dist/server/routes/content-api.mjs.map +1 -1
  134. package/dist/server/routes/index.mjs +2 -2
  135. package/dist/server/routes/validation/locale.js +57 -0
  136. package/dist/server/routes/validation/locale.js.map +1 -0
  137. package/dist/server/routes/validation/locale.mjs +36 -0
  138. package/dist/server/routes/validation/locale.mjs.map +1 -0
  139. package/dist/server/services/ai-localization-jobs.js +64 -0
  140. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  141. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  142. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  143. package/dist/server/services/ai-localizations.js +268 -0
  144. package/dist/server/services/ai-localizations.js.map +1 -0
  145. package/dist/server/services/ai-localizations.mjs +266 -0
  146. package/dist/server/services/ai-localizations.mjs.map +1 -0
  147. package/dist/server/services/content-types.js.map +1 -1
  148. package/dist/server/services/content-types.mjs.map +1 -1
  149. package/dist/server/services/index.js +7 -1
  150. package/dist/server/services/index.js.map +1 -1
  151. package/dist/server/services/index.mjs +7 -1
  152. package/dist/server/services/index.mjs.map +1 -1
  153. package/dist/server/services/settings.js +25 -0
  154. package/dist/server/services/settings.js.map +1 -0
  155. package/dist/server/services/settings.mjs +23 -0
  156. package/dist/server/services/settings.mjs.map +1 -0
  157. package/dist/server/src/bootstrap.d.ts.map +1 -1
  158. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  159. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  160. package/dist/server/src/controllers/index.d.ts +10 -0
  161. package/dist/server/src/controllers/index.d.ts.map +1 -1
  162. package/dist/server/src/controllers/settings.d.ts +7 -0
  163. package/dist/server/src/controllers/settings.d.ts.map +1 -0
  164. package/dist/server/src/index.d.ts +47 -8
  165. package/dist/server/src/index.d.ts.map +1 -1
  166. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  167. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  168. package/dist/server/src/models/index.d.ts +5 -0
  169. package/dist/server/src/models/index.d.ts.map +1 -0
  170. package/dist/server/src/register.d.ts +1 -1
  171. package/dist/server/src/register.d.ts.map +1 -1
  172. package/dist/server/src/routes/admin.d.ts.map +1 -1
  173. package/dist/server/src/routes/content-api.d.ts +5 -8
  174. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  175. package/dist/server/src/routes/index.d.ts +3 -7
  176. package/dist/server/src/routes/index.d.ts.map +1 -1
  177. package/dist/server/src/routes/validation/index.d.ts +2 -0
  178. package/dist/server/src/routes/validation/index.d.ts.map +1 -0
  179. package/dist/server/src/routes/validation/locale.d.ts +41 -0
  180. package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
  181. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  182. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  183. package/dist/server/src/services/ai-localizations.d.ts +18 -0
  184. package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
  185. package/dist/server/src/services/index.d.ts +33 -0
  186. package/dist/server/src/services/index.d.ts.map +1 -1
  187. package/dist/server/src/services/settings.d.ts +13 -0
  188. package/dist/server/src/services/settings.d.ts.map +1 -0
  189. package/dist/server/src/utils/index.d.ts +7 -1
  190. package/dist/server/src/utils/index.d.ts.map +1 -1
  191. package/dist/server/src/validation/settings.d.ts +12 -0
  192. package/dist/server/src/validation/settings.d.ts.map +1 -0
  193. package/dist/server/utils/index.js.map +1 -1
  194. package/dist/server/utils/index.mjs.map +1 -1
  195. package/dist/server/validation/settings.js +11 -0
  196. package/dist/server/validation/settings.js.map +1 -0
  197. package/dist/server/validation/settings.mjs +9 -0
  198. package/dist/server/validation/settings.mjs.map +1 -0
  199. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  200. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  201. package/dist/shared/contracts/settings.d.ts +40 -0
  202. package/dist/shared/contracts/shared.d.ts.map +1 -0
  203. package/package.json +13 -10
@@ -185,7 +185,7 @@ const BulkLocaleActionModal = ({ headers, rows, localesMetadata, validationError
185
185
  children: rows.map(({ locale, status }, index)=>{
186
186
  const error = validationErrors?.[locale] ?? null;
187
187
  const statusVariant = status === 'draft' ? 'primary' : status === 'published' ? 'success' : 'alternative';
188
- return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Row, {
188
+ return status && locale ? /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Table.Row, {
189
189
  children: [
190
190
  /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, {
191
191
  id: locale,
@@ -248,7 +248,7 @@ const BulkLocaleActionModal = ({ headers, rows, localesMetadata, validationError
248
248
  })
249
249
  })
250
250
  ]
251
- }, index);
251
+ }, index) : null;
252
252
  })
253
253
  })
254
254
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"BulkLocaleActionModal.js","sources":["../../../admin/src/components/BulkLocaleActionModal.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { FormErrors, Table, useTable } from '@strapi/admin/strapi-admin';\nimport { Box, Typography, IconButton, Flex, Tooltip, Status, Modal } from '@strapi/design-system';\nimport { Pencil, CheckCircle, CrossCircle, ArrowsCounterClockwise } from '@strapi/icons';\nimport { stringify } from 'qs';\nimport { type MessageDescriptor, useIntl, PrimitiveType } from 'react-intl';\nimport { Link } from 'react-router-dom';\n\nimport { Locale } from '../../../shared/contracts/locales';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { LocaleStatus } from './CMHeaderActions';\n\nimport type { Modules } from '@strapi/types';\n\ntype Status = Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n\n/* -------------------------------------------------------------------------------------------------\n * EntryValidationText\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EntryValidationTextProps {\n status: Status;\n validationErrors: FormErrors[string] | null;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\ninterface TranslationMessage extends MessageDescriptor {\n values?: Record<string, PrimitiveType>;\n}\n\nconst isErrorMessageDescriptor = (object?: string | object): object is TranslationMessage => {\n return (\n typeof object === 'object' && object !== null && 'id' in object && 'defaultMessage' in object\n );\n};\n\nconst EntryValidationText = ({\n status = 'draft',\n validationErrors,\n action,\n}: EntryValidationTextProps) => {\n const { formatMessage } = useIntl();\n\n /**\n * TODO: Should this be extracted an made into a factory to recursively get\n * error messages??\n */\n const getErrorStr = (key: string, value?: FormErrors[string]): string => {\n if (typeof value === 'string') {\n return `${key}: ${value}`;\n } else if (isErrorMessageDescriptor(value)) {\n return `${key}: ${formatMessage(value)}`;\n } else if (Array.isArray(value)) {\n return value.map((v) => getErrorStr(key, v)).join(' ');\n } else if (typeof value === 'object' && !Array.isArray(value)) {\n return Object.entries(value)\n .map(([k, v]) => getErrorStr(k, v))\n .join(' ');\n } else {\n /**\n * unlikely to happen, but we need to return something\n */\n return '';\n }\n };\n\n if (validationErrors) {\n const validationErrorsMessages = Object.entries(validationErrors)\n .map(([key, value]) => {\n return getErrorStr(key, value);\n })\n .join(' ');\n\n return (\n <Flex gap={2}>\n <CrossCircle fill=\"danger600\" />\n <Tooltip label={validationErrorsMessages}>\n <Typography\n maxWidth={'30rem'}\n textColor=\"danger600\"\n variant=\"omega\"\n fontWeight=\"semiBold\"\n ellipsis\n >\n {validationErrorsMessages}\n </Typography>\n </Tooltip>\n </Flex>\n );\n }\n\n const getStatusMessage = () => {\n if (action === 'bulk-publish') {\n if (status === 'published') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-publish.already-published',\n defaultMessage: 'Already Published',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else if (status === 'modified') {\n return {\n icon: <ArrowsCounterClockwise fill=\"alternative600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish-changes',\n defaultMessage: 'Ready to publish changes',\n }),\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n }),\n };\n }\n } else {\n if (status === 'draft') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-unpublish.already-unpublished',\n defaultMessage: 'Already Unpublished',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-unpublish-changes',\n defaultMessage: 'Ready to unpublish',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n }\n }\n };\n\n const { icon, text, textColor = 'success600', fontWeight = 'normal' } = getStatusMessage();\n\n return (\n <Flex gap={2}>\n {icon}\n <Typography textColor={textColor} fontWeight={fontWeight}>\n {text}\n </Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BoldChunk\n * -----------------------------------------------------------------------------------------------*/\n\nconst BoldChunk = (chunks: React.ReactNode) => <Typography fontWeight=\"bold\">{chunks}</Typography>;\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleActionModal\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BulkLocaleActionModalProps {\n rows: LocaleStatus[];\n headers: {\n label: string;\n name: string;\n }[];\n localesMetadata: Locale[];\n validationErrors?: FormErrors;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\nconst BulkLocaleActionModal = ({\n headers,\n rows,\n localesMetadata,\n validationErrors = {},\n action,\n}: BulkLocaleActionModalProps) => {\n const { formatMessage } = useIntl();\n\n const selectedRows = useTable<LocaleStatus[]>(\n 'BulkLocaleActionModal',\n (state) => state.selectedRows\n );\n\n const getFormattedCountMessage = () => {\n const currentStatusByLocale = rows.reduce<Record<string, string>>((acc, { locale, status }) => {\n acc[locale] = status;\n return acc;\n }, {});\n const localesWithErrors = Object.keys(validationErrors);\n\n const publishedCount = selectedRows.filter(\n ({ locale }) => currentStatusByLocale[locale] === 'published'\n ).length;\n\n const draftCount = selectedRows.filter(\n ({ locale }) =>\n (currentStatusByLocale[locale] === 'draft' ||\n currentStatusByLocale[locale] === 'modified') &&\n !localesWithErrors.includes(locale)\n ).length;\n\n const withErrorsCount = localesWithErrors.length;\n const messageId =\n action === 'bulk-publish'\n ? 'content-manager.containers.list.selectedEntriesModal.selectedCount.publish'\n : 'content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish';\n\n const defaultMessage =\n action === 'bulk-publish'\n ? '<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action.'\n : '<b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} already unpublished. <b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} ready to unpublish.';\n\n return formatMessage(\n {\n id: messageId,\n defaultMessage,\n },\n {\n withErrorsCount,\n draftCount,\n publishedCount,\n b: BoldChunk,\n }\n );\n };\n\n return (\n <Modal.Body>\n <Typography>{getFormattedCountMessage()}</Typography>\n <Box marginTop={5}>\n <Table.Content>\n <Table.Head>\n <Table.HeaderCheckboxCell />\n {headers.map((head) => (\n <Table.HeaderCell key={head.name} {...head} />\n ))}\n </Table.Head>\n <Table.Body>\n {rows.map(({ locale, status }, index) => {\n const error = validationErrors?.[locale] ?? null;\n\n const statusVariant =\n status === 'draft' ? 'primary' : status === 'published' ? 'success' : 'alternative';\n\n return (\n <Table.Row key={index}>\n <Table.CheckboxCell id={locale} aria-label={`Select ${locale}`} />\n <Table.Cell>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {Array.isArray(localesMetadata)\n ? localesMetadata.find((localeEntry) => localeEntry.code === locale)?.name\n : locale}\n </Typography>\n </Table.Cell>\n <Table.Cell>\n <Box display=\"flex\">\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size={'S'}\n variant={statusVariant}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n </Box>\n </Table.Cell>\n <Table.Cell>\n <EntryValidationText validationErrors={error} status={status} action={action} />\n </Table.Cell>\n <Table.Cell>\n <IconButton\n tag={Link}\n to={{\n search: stringify({ plugins: { i18n: { locale } } }),\n }}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit {name} locale',\n },\n {\n name: locale,\n }\n )}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Table.Cell>\n </Table.Row>\n );\n })}\n </Table.Body>\n </Table.Content>\n </Box>\n </Modal.Body>\n );\n};\n\nexport { BulkLocaleActionModal };\nexport type { BulkLocaleActionModalProps };\n"],"names":["isErrorMessageDescriptor","object","EntryValidationText","status","validationErrors","action","formatMessage","useIntl","getErrorStr","key","value","Array","isArray","map","v","join","Object","entries","k","validationErrorsMessages","_jsxs","Flex","gap","_jsx","CrossCircle","fill","Tooltip","label","Typography","maxWidth","textColor","variant","fontWeight","ellipsis","getStatusMessage","icon","CheckCircle","text","id","defaultMessage","ArrowsCounterClockwise","BoldChunk","chunks","BulkLocaleActionModal","headers","rows","localesMetadata","selectedRows","useTable","state","getFormattedCountMessage","currentStatusByLocale","reduce","acc","locale","localesWithErrors","keys","publishedCount","filter","length","draftCount","includes","withErrorsCount","messageId","b","Modal","Body","Box","marginTop","Table","Content","Head","HeaderCheckboxCell","head","HeaderCell","name","index","error","statusVariant","Row","CheckboxCell","aria-label","Cell","find","localeEntry","code","display","Status","paddingLeft","paddingRight","paddingTop","paddingBottom","size","tag","capitalize","IconButton","Link","to","search","stringify","plugins","i18n","getTranslation","Pencil"],"mappings":";;;;;;;;;;;;;AAiCA,MAAMA,2BAA2B,CAACC,MAAAA,GAAAA;AAChC,IAAA,OACE,OAAOA,MAAW,KAAA,QAAA,IAAYA,WAAW,IAAQ,IAAA,IAAA,IAAQA,UAAU,gBAAoBA,IAAAA,MAAAA;AAE3F,CAAA;AAEA,MAAMC,mBAAAA,GAAsB,CAAC,EAC3BC,MAAAA,GAAS,OAAO,EAChBC,gBAAgB,EAChBC,MAAM,EACmB,GAAA;IACzB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iB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AAA;AAAO;AAAE;AAAE,qDAAA;AACpD,iDAAA;AACA3B,gDAAAA,KAAAA,EAAOrB,aACL,CAAA;AACEgC,oDAAAA,EAAAA,EAAIgE,6BAAe,CAAA,4BAAA,CAAA;oDACnB/D,cAAgB,EAAA;iDAElB,EAAA;oDACEoC,IAAMrB,EAAAA;AACR,iDAAA,CAAA;gDAEFvB,OAAQ,EAAA,OAAA;AAER,gDAAA,QAAA,gBAAAR,cAACgF,CAAAA,YAAAA,EAAAA,EAAAA;;;;AA9CS3B,iCAAAA,EAAAA,KAAAA,CAAAA;AAmDpB,6BAAA;;;;;;;AAMZ;;;;"}
1
+ {"version":3,"file":"BulkLocaleActionModal.js","sources":["../../../admin/src/components/BulkLocaleActionModal.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { FormErrors, Table, useTable } from '@strapi/admin/strapi-admin';\nimport { Box, Typography, IconButton, Flex, Tooltip, Status, Modal } from '@strapi/design-system';\nimport { Pencil, CheckCircle, CrossCircle, ArrowsCounterClockwise } from '@strapi/icons';\nimport { stringify } from 'qs';\nimport { type MessageDescriptor, useIntl, PrimitiveType } from 'react-intl';\nimport { Link } from 'react-router-dom';\n\nimport { Locale } from '../../../shared/contracts/locales';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { LocaleStatus } from './CMHeaderActions';\n\nimport type { Modules } from '@strapi/types';\n\ntype Status = Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n\n/* -------------------------------------------------------------------------------------------------\n * EntryValidationText\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EntryValidationTextProps {\n status: Status;\n validationErrors: FormErrors[string] | null;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\ninterface TranslationMessage extends MessageDescriptor {\n values?: Record<string, PrimitiveType>;\n}\n\nconst isErrorMessageDescriptor = (object?: string | object): object is TranslationMessage => {\n return (\n typeof object === 'object' && object !== null && 'id' in object && 'defaultMessage' in object\n );\n};\n\nconst EntryValidationText = ({\n status = 'draft',\n validationErrors,\n action,\n}: EntryValidationTextProps) => {\n const { formatMessage } = useIntl();\n\n /**\n * TODO: Should this be extracted an made into a factory to recursively get\n * error messages??\n */\n const getErrorStr = (key: string, value?: FormErrors[string]): string => {\n if (typeof value === 'string') {\n return `${key}: ${value}`;\n } else if (isErrorMessageDescriptor(value)) {\n return `${key}: ${formatMessage(value)}`;\n } else if (Array.isArray(value)) {\n return value.map((v) => getErrorStr(key, v)).join(' ');\n } else if (typeof value === 'object' && !Array.isArray(value)) {\n return Object.entries(value)\n .map(([k, v]) => getErrorStr(k, v))\n .join(' ');\n } else {\n /**\n * unlikely to happen, but we need to return something\n */\n return '';\n }\n };\n\n if (validationErrors) {\n const validationErrorsMessages = Object.entries(validationErrors)\n .map(([key, value]) => {\n return getErrorStr(key, value);\n })\n .join(' ');\n\n return (\n <Flex gap={2}>\n <CrossCircle fill=\"danger600\" />\n <Tooltip label={validationErrorsMessages}>\n <Typography\n maxWidth={'30rem'}\n textColor=\"danger600\"\n variant=\"omega\"\n fontWeight=\"semiBold\"\n ellipsis\n >\n {validationErrorsMessages}\n </Typography>\n </Tooltip>\n </Flex>\n );\n }\n\n const getStatusMessage = () => {\n if (action === 'bulk-publish') {\n if (status === 'published') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-publish.already-published',\n defaultMessage: 'Already Published',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else if (status === 'modified') {\n return {\n icon: <ArrowsCounterClockwise fill=\"alternative600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish-changes',\n defaultMessage: 'Ready to publish changes',\n }),\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n }),\n };\n }\n } else {\n if (status === 'draft') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-unpublish.already-unpublished',\n defaultMessage: 'Already Unpublished',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-unpublish-changes',\n defaultMessage: 'Ready to unpublish',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n }\n }\n };\n\n const { icon, text, textColor = 'success600', fontWeight = 'normal' } = getStatusMessage();\n\n return (\n <Flex gap={2}>\n {icon}\n <Typography textColor={textColor} fontWeight={fontWeight}>\n {text}\n </Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BoldChunk\n * -----------------------------------------------------------------------------------------------*/\n\nconst BoldChunk = (chunks: React.ReactNode) => <Typography fontWeight=\"bold\">{chunks}</Typography>;\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleActionModal\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BulkLocaleActionModalProps {\n rows: LocaleStatus[];\n headers: {\n label: string;\n name: string;\n }[];\n localesMetadata: Locale[];\n validationErrors?: FormErrors;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\nconst BulkLocaleActionModal = ({\n headers,\n rows,\n localesMetadata,\n validationErrors = {},\n action,\n}: BulkLocaleActionModalProps) => {\n const { formatMessage } = useIntl();\n\n const selectedRows = useTable<LocaleStatus[]>(\n 'BulkLocaleActionModal',\n (state) => state.selectedRows\n );\n\n const getFormattedCountMessage = () => {\n const currentStatusByLocale = rows.reduce<Record<string, string>>((acc, { locale, status }) => {\n acc[locale] = status;\n return acc;\n }, {});\n const localesWithErrors = Object.keys(validationErrors);\n\n const publishedCount = selectedRows.filter(\n ({ locale }) => currentStatusByLocale[locale] === 'published'\n ).length;\n\n const draftCount = selectedRows.filter(\n ({ locale }) =>\n (currentStatusByLocale[locale] === 'draft' ||\n currentStatusByLocale[locale] === 'modified') &&\n !localesWithErrors.includes(locale)\n ).length;\n\n const withErrorsCount = localesWithErrors.length;\n const messageId =\n action === 'bulk-publish'\n ? 'content-manager.containers.list.selectedEntriesModal.selectedCount.publish'\n : 'content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish';\n\n const defaultMessage =\n action === 'bulk-publish'\n ? '<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action.'\n : '<b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} already unpublished. <b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} ready to unpublish.';\n\n return formatMessage(\n {\n id: messageId,\n defaultMessage,\n },\n {\n withErrorsCount,\n draftCount,\n publishedCount,\n b: BoldChunk,\n }\n );\n };\n\n return (\n <Modal.Body>\n <Typography>{getFormattedCountMessage()}</Typography>\n <Box marginTop={5}>\n <Table.Content>\n <Table.Head>\n <Table.HeaderCheckboxCell />\n {headers.map((head) => (\n <Table.HeaderCell key={head.name} {...head} />\n ))}\n </Table.Head>\n <Table.Body>\n {rows.map(({ locale, status }, index) => {\n const error = validationErrors?.[locale] ?? null;\n\n const statusVariant =\n status === 'draft' ? 'primary' : status === 'published' ? 'success' : 'alternative';\n\n return status && locale ? (\n <Table.Row key={index}>\n <Table.CheckboxCell id={locale} aria-label={`Select ${locale}`} />\n <Table.Cell>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {Array.isArray(localesMetadata)\n ? localesMetadata.find((localeEntry) => localeEntry.code === locale)?.name\n : locale}\n </Typography>\n </Table.Cell>\n <Table.Cell>\n <Box display=\"flex\">\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size={'S'}\n variant={statusVariant}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n </Box>\n </Table.Cell>\n <Table.Cell>\n <EntryValidationText validationErrors={error} status={status} action={action} />\n </Table.Cell>\n <Table.Cell>\n <IconButton\n tag={Link}\n to={{\n search: stringify({ plugins: { i18n: { locale } } }),\n }}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit {name} locale',\n },\n {\n name: locale,\n }\n )}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Table.Cell>\n </Table.Row>\n ) : null;\n })}\n </Table.Body>\n </Table.Content>\n </Box>\n </Modal.Body>\n );\n};\n\nexport { BulkLocaleActionModal };\nexport type { BulkLocaleActionModalProps };\n"],"names":["isErrorMessageDescriptor","object","EntryValidationText","status","validationErrors","action","formatMessage","useIntl","getErrorStr","key","value","Array","isArray","map","v","join","Object","entries","k","validationErrorsMessages","_jsxs","Flex","gap","_jsx","CrossCircle","fill","Tooltip","label","Typography","maxWidth","textColor","variant","fontWeight","ellipsis","getStatusMessage","icon","CheckCircle","text","id","defaultMessage","ArrowsCounterClockwise","BoldChunk","chunks","BulkLocaleActionModal","headers","rows","localesMetadata","selectedRows","useTable","state","getFormattedCountMessage","currentStatusByLocale","reduce","acc","locale","localesWithErrors","keys","publishedCount","filter","length","draftCount","includes","withErrorsCount","messageId","b","Modal","Body","Box","marginTop","Table","Content","Head","HeaderCheckboxCell","head","HeaderCell","name","index","error","statusVariant","Row","CheckboxCell","aria-label","Cell","find","localeEntry","code","display","Status","paddingLeft","paddingRight","paddingTop","paddingBottom","size","tag","capitalize","IconButton","Link","to","search","stringify","plugins","i18n","getTranslation","Pencil"],"mappings":";;;;;;;;;;;;;AAiCA,MAAMA,2BAA2B,CAACC,MAAAA,GAAAA;AAChC,IAAA,OACE,OAAOA,MAAW,KAAA,QAAA,IAAYA,WAAW,IAAQ,IAAA,IAAA,IAAQA,UAAU,gBAAoBA,IAAAA,MAAAA;AAE3F,CAAA;AAEA,MAAMC,mBAAAA,GAAsB,CAAC,EAC3BC,MAAAA,GAAS,OAAO,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AKG,EAAAA,mBAAAA;gDACLC,EAAI,EAAA;AACFC,oDAAAA,MAAAA,EAAQC,YAAU,CAAA;wDAAEC,OAAS,EAAA;4DAAEC,IAAM,EAAA;AAAE/C,gEAAAA;AAAO;AAAE;AAAE,qDAAA;AACpD,iDAAA;AACA3B,gDAAAA,KAAAA,EAAOrB,aACL,CAAA;AACEgC,oDAAAA,EAAAA,EAAIgE,6BAAe,CAAA,4BAAA,CAAA;oDACnB/D,cAAgB,EAAA;iDAElB,EAAA;oDACEoC,IAAMrB,EAAAA;AACR,iDAAA,CAAA;gDAEFvB,OAAQ,EAAA,OAAA;AAER,gDAAA,QAAA,gBAAAR,cAACgF,CAAAA,YAAAA,EAAAA,EAAAA;;;;mCA9CS3B,KAkDd,CAAA,GAAA,IAAA;AACN,6BAAA;;;;;;;AAMZ;;;;"}
@@ -183,7 +183,7 @@ const BulkLocaleActionModal = ({ headers, rows, localesMetadata, validationError
183
183
  children: rows.map(({ locale, status }, index)=>{
184
184
  const error = validationErrors?.[locale] ?? null;
185
185
  const statusVariant = status === 'draft' ? 'primary' : status === 'published' ? 'success' : 'alternative';
186
- return /*#__PURE__*/ jsxs(Table.Row, {
186
+ return status && locale ? /*#__PURE__*/ jsxs(Table.Row, {
187
187
  children: [
188
188
  /*#__PURE__*/ jsx(Table.CheckboxCell, {
189
189
  id: locale,
@@ -246,7 +246,7 @@ const BulkLocaleActionModal = ({ headers, rows, localesMetadata, validationError
246
246
  })
247
247
  })
248
248
  ]
249
- }, index);
249
+ }, index) : null;
250
250
  })
251
251
  })
252
252
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"BulkLocaleActionModal.mjs","sources":["../../../admin/src/components/BulkLocaleActionModal.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { FormErrors, Table, useTable } from '@strapi/admin/strapi-admin';\nimport { Box, Typography, IconButton, Flex, Tooltip, Status, Modal } from '@strapi/design-system';\nimport { Pencil, CheckCircle, CrossCircle, ArrowsCounterClockwise } from '@strapi/icons';\nimport { stringify } from 'qs';\nimport { type MessageDescriptor, useIntl, PrimitiveType } from 'react-intl';\nimport { Link } from 'react-router-dom';\n\nimport { Locale } from '../../../shared/contracts/locales';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { LocaleStatus } from './CMHeaderActions';\n\nimport type { Modules } from '@strapi/types';\n\ntype Status = Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n\n/* -------------------------------------------------------------------------------------------------\n * EntryValidationText\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EntryValidationTextProps {\n status: Status;\n validationErrors: FormErrors[string] | null;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\ninterface TranslationMessage extends MessageDescriptor {\n values?: Record<string, PrimitiveType>;\n}\n\nconst isErrorMessageDescriptor = (object?: string | object): object is TranslationMessage => {\n return (\n typeof object === 'object' && object !== null && 'id' in object && 'defaultMessage' in object\n );\n};\n\nconst EntryValidationText = ({\n status = 'draft',\n validationErrors,\n action,\n}: EntryValidationTextProps) => {\n const { formatMessage } = useIntl();\n\n /**\n * TODO: Should this be extracted an made into a factory to recursively get\n * error messages??\n */\n const getErrorStr = (key: string, value?: FormErrors[string]): string => {\n if (typeof value === 'string') {\n return `${key}: ${value}`;\n } else if (isErrorMessageDescriptor(value)) {\n return `${key}: ${formatMessage(value)}`;\n } else if (Array.isArray(value)) {\n return value.map((v) => getErrorStr(key, v)).join(' ');\n } else if (typeof value === 'object' && !Array.isArray(value)) {\n return Object.entries(value)\n .map(([k, v]) => getErrorStr(k, v))\n .join(' ');\n } else {\n /**\n * unlikely to happen, but we need to return something\n */\n return '';\n }\n };\n\n if (validationErrors) {\n const validationErrorsMessages = Object.entries(validationErrors)\n .map(([key, value]) => {\n return getErrorStr(key, value);\n })\n .join(' ');\n\n return (\n <Flex gap={2}>\n <CrossCircle fill=\"danger600\" />\n <Tooltip label={validationErrorsMessages}>\n <Typography\n maxWidth={'30rem'}\n textColor=\"danger600\"\n variant=\"omega\"\n fontWeight=\"semiBold\"\n ellipsis\n >\n {validationErrorsMessages}\n </Typography>\n </Tooltip>\n </Flex>\n );\n }\n\n const getStatusMessage = () => {\n if (action === 'bulk-publish') {\n if (status === 'published') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-publish.already-published',\n defaultMessage: 'Already Published',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else if (status === 'modified') {\n return {\n icon: <ArrowsCounterClockwise fill=\"alternative600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish-changes',\n defaultMessage: 'Ready to publish changes',\n }),\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n }),\n };\n }\n } else {\n if (status === 'draft') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-unpublish.already-unpublished',\n defaultMessage: 'Already Unpublished',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-unpublish-changes',\n defaultMessage: 'Ready to unpublish',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n }\n }\n };\n\n const { icon, text, textColor = 'success600', fontWeight = 'normal' } = getStatusMessage();\n\n return (\n <Flex gap={2}>\n {icon}\n <Typography textColor={textColor} fontWeight={fontWeight}>\n {text}\n </Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BoldChunk\n * -----------------------------------------------------------------------------------------------*/\n\nconst BoldChunk = (chunks: React.ReactNode) => <Typography fontWeight=\"bold\">{chunks}</Typography>;\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleActionModal\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BulkLocaleActionModalProps {\n rows: LocaleStatus[];\n headers: {\n label: string;\n name: string;\n }[];\n localesMetadata: Locale[];\n validationErrors?: FormErrors;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\nconst BulkLocaleActionModal = ({\n headers,\n rows,\n localesMetadata,\n validationErrors = {},\n action,\n}: BulkLocaleActionModalProps) => {\n const { formatMessage } = useIntl();\n\n const selectedRows = useTable<LocaleStatus[]>(\n 'BulkLocaleActionModal',\n (state) => state.selectedRows\n );\n\n const getFormattedCountMessage = () => {\n const currentStatusByLocale = rows.reduce<Record<string, string>>((acc, { locale, status }) => {\n acc[locale] = status;\n return acc;\n }, {});\n const localesWithErrors = Object.keys(validationErrors);\n\n const publishedCount = selectedRows.filter(\n ({ locale }) => currentStatusByLocale[locale] === 'published'\n ).length;\n\n const draftCount = selectedRows.filter(\n ({ locale }) =>\n (currentStatusByLocale[locale] === 'draft' ||\n currentStatusByLocale[locale] === 'modified') &&\n !localesWithErrors.includes(locale)\n ).length;\n\n const withErrorsCount = localesWithErrors.length;\n const messageId =\n action === 'bulk-publish'\n ? 'content-manager.containers.list.selectedEntriesModal.selectedCount.publish'\n : 'content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish';\n\n const defaultMessage =\n action === 'bulk-publish'\n ? '<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action.'\n : '<b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} already unpublished. <b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} ready to unpublish.';\n\n return formatMessage(\n {\n id: messageId,\n defaultMessage,\n },\n {\n withErrorsCount,\n draftCount,\n publishedCount,\n b: BoldChunk,\n }\n );\n };\n\n return (\n <Modal.Body>\n <Typography>{getFormattedCountMessage()}</Typography>\n <Box marginTop={5}>\n <Table.Content>\n <Table.Head>\n <Table.HeaderCheckboxCell />\n {headers.map((head) => (\n <Table.HeaderCell key={head.name} {...head} />\n ))}\n </Table.Head>\n <Table.Body>\n {rows.map(({ locale, status }, index) => {\n const error = validationErrors?.[locale] ?? null;\n\n const statusVariant =\n status === 'draft' ? 'primary' : status === 'published' ? 'success' : 'alternative';\n\n return (\n <Table.Row key={index}>\n <Table.CheckboxCell id={locale} aria-label={`Select ${locale}`} />\n <Table.Cell>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {Array.isArray(localesMetadata)\n ? localesMetadata.find((localeEntry) => localeEntry.code === locale)?.name\n : locale}\n </Typography>\n </Table.Cell>\n <Table.Cell>\n <Box display=\"flex\">\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size={'S'}\n variant={statusVariant}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n </Box>\n </Table.Cell>\n <Table.Cell>\n <EntryValidationText validationErrors={error} status={status} action={action} />\n </Table.Cell>\n <Table.Cell>\n <IconButton\n tag={Link}\n to={{\n search: stringify({ plugins: { i18n: { locale } } }),\n }}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit {name} locale',\n },\n {\n name: locale,\n }\n )}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Table.Cell>\n </Table.Row>\n );\n })}\n </Table.Body>\n </Table.Content>\n </Box>\n </Modal.Body>\n );\n};\n\nexport { BulkLocaleActionModal };\nexport type { BulkLocaleActionModalProps };\n"],"names":["isErrorMessageDescriptor","object","EntryValidationText","status","validationErrors","action","formatMessage","useIntl","getErrorStr","key","value","Array","isArray","map","v","join","Object","entries","k","validationErrorsMessages","_jsxs","Flex","gap","_jsx","CrossCircle","fill","Tooltip","label","Typography","maxWidth","textColor","variant","fontWeight","ellipsis","getStatusMessage","icon","CheckCircle","text","id","defaultMessage","ArrowsCounterClockwise","BoldChunk","chunks","BulkLocaleActionModal","headers","rows","localesMetadata","selectedRows","useTable","state","getFormattedCountMessage","currentStatusByLocale","reduce","acc","locale","localesWithErrors","keys","publishedCount","filter","length","draftCount","includes","withErrorsCount","messageId","b","Modal","Body","Box","marginTop","Table","Content","Head","HeaderCheckboxCell","head","HeaderCell","name","index","error","statusVariant","Row","CheckboxCell","aria-label","Cell","find","localeEntry","code","display","Status","paddingLeft","paddingRight","paddingTop","paddingBottom","size","tag","capitalize","IconButton","Link","to","search","stringify","plugins","i18n","getTranslation","Pencil"],"mappings":";;;;;;;;;;;AAiCA,MAAMA,2BAA2B,CAACC,MAAAA,GAAAA;AAChC,IAAA,OACE,OAAOA,MAAW,KAAA,QAAA,IAAYA,WAAW,IAAQ,IAAA,IAAA,IAAQA,UAAU,gBAAoBA,IAAAA,MAAAA;AAE3F,CAAA;AAEA,MAAMC,mBAAAA,GAAsB,CAAC,EAC3BC,MAAAA,GAAS,OAAO,EAChBC,gBAAgB,EAChBC,MAAM,EACmB,GAAA;IACzB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B;;;MAIA,MAAMC,WAAc,GAAA,CAACC,GAAaC,EAAAA,KAAAA,GAAAA;QAChC,IAAI,OAAOA,UAAU,QAAU,EAAA;AAC7B,YAAA,OAAO,CAAC,EAAED,GAAAA,CAAI,EAAE,EAAEC,MAAM,CAAC;SACpB,MAAA,IAAIV,yBAAyBU,KAAQ,CAAA,EAAA;AAC1C,YAAA,OAAO,CAAC,EAAED,GAAAA,CAAI,EAAE,EAAEH,aAAAA,CAAcI,OAAO,CAAC;AAC1C,SAAA,MAAO,IAAIC,KAAAA,CAAMC,OAAO,CAACF,KAAQ,CAAA,EAAA;YAC/B,OAAOA,KAAAA,CAAMG,GAAG,CAAC,CAACC,IAAMN,WAAYC,CAAAA,GAAAA,EAAKK,CAAIC,CAAAA,CAAAA,CAAAA,IAAI,CAAC,GAAA,CAAA;SAC7C,MAAA,IAAI,OAAOL,KAAU,KAAA,QA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,oDAAA,QAAA,gBAAAvD,GAACK,CAAAA,UAAAA,EAAAA;wDAAWiE,GAAI,EAAA,MAAA;wDAAO9D,OAAQ,EAAA,IAAA;wDAAKC,UAAW,EAAA,MAAA;kEAC5C8D,UAAW3F,CAAAA,MAAAA;;;;;AAKpB,sDAAAoB,GAAA,CAAC8C,MAAMa,IAAI,EAAA;AACT,4CAAA,QAAA,gBAAA3D,GAACrB,CAAAA,mBAAAA,EAAAA;gDAAoBE,gBAAkByE,EAAAA,KAAAA;gDAAO1E,MAAQA,EAAAA,MAAAA;gDAAQE,MAAQA,EAAAA;;;AAExE,sDAAAkB,GAAA,CAAC8C,MAAMa,IAAI,EAAA;AACT,4CAAA,QAAA,gBAAA3D,GAACwE,CAAAA,UAAAA,EAAAA;gDACCF,GAAKG,EAAAA,IAAAA;gDACLC,EAAI,EAAA;AACFC,oDAAAA,MAAAA,EAAQC,SAAU,CAAA;wDAAEC,OAAS,EAAA;4DAAEC,IAAM,EAAA;AAAE/C,gEAAAA;AAAO;AAAE;AAAE,qDAAA;AACpD,iDAAA;AACA3B,gDAAAA,KAAAA,EAAOrB,aACL,CAAA;AACEgC,oDAAAA,EAAAA,EAAIgE,cAAe,CAAA,4BAAA,CAAA;oDACnB/D,cAAgB,EAAA;iDAElB,EAAA;oDACEoC,IAAMrB,EAAAA;AACR,iDAAA,CAAA;gDAEFvB,OAAQ,EAAA,OAAA;AAER,gDAAA,QAAA,gBAAAR,GAACgF,CAAAA,MAAAA,EAAAA,EAAAA;;;;AA9CS3B,iCAAAA,EAAAA,KAAAA,CAAAA;AAmDpB,6BAAA;;;;;;;AAMZ;;;;"}
1
+ {"version":3,"file":"BulkLocaleActionModal.mjs","sources":["../../../admin/src/components/BulkLocaleActionModal.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { FormErrors, Table, useTable } from '@strapi/admin/strapi-admin';\nimport { Box, Typography, IconButton, Flex, Tooltip, Status, Modal } from '@strapi/design-system';\nimport { Pencil, CheckCircle, CrossCircle, ArrowsCounterClockwise } from '@strapi/icons';\nimport { stringify } from 'qs';\nimport { type MessageDescriptor, useIntl, PrimitiveType } from 'react-intl';\nimport { Link } from 'react-router-dom';\n\nimport { Locale } from '../../../shared/contracts/locales';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { LocaleStatus } from './CMHeaderActions';\n\nimport type { Modules } from '@strapi/types';\n\ntype Status = Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n\n/* -------------------------------------------------------------------------------------------------\n * EntryValidationText\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EntryValidationTextProps {\n status: Status;\n validationErrors: FormErrors[string] | null;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\ninterface TranslationMessage extends MessageDescriptor {\n values?: Record<string, PrimitiveType>;\n}\n\nconst isErrorMessageDescriptor = (object?: string | object): object is TranslationMessage => {\n return (\n typeof object === 'object' && object !== null && 'id' in object && 'defaultMessage' in object\n );\n};\n\nconst EntryValidationText = ({\n status = 'draft',\n validationErrors,\n action,\n}: EntryValidationTextProps) => {\n const { formatMessage } = useIntl();\n\n /**\n * TODO: Should this be extracted an made into a factory to recursively get\n * error messages??\n */\n const getErrorStr = (key: string, value?: FormErrors[string]): string => {\n if (typeof value === 'string') {\n return `${key}: ${value}`;\n } else if (isErrorMessageDescriptor(value)) {\n return `${key}: ${formatMessage(value)}`;\n } else if (Array.isArray(value)) {\n return value.map((v) => getErrorStr(key, v)).join(' ');\n } else if (typeof value === 'object' && !Array.isArray(value)) {\n return Object.entries(value)\n .map(([k, v]) => getErrorStr(k, v))\n .join(' ');\n } else {\n /**\n * unlikely to happen, but we need to return something\n */\n return '';\n }\n };\n\n if (validationErrors) {\n const validationErrorsMessages = Object.entries(validationErrors)\n .map(([key, value]) => {\n return getErrorStr(key, value);\n })\n .join(' ');\n\n return (\n <Flex gap={2}>\n <CrossCircle fill=\"danger600\" />\n <Tooltip label={validationErrorsMessages}>\n <Typography\n maxWidth={'30rem'}\n textColor=\"danger600\"\n variant=\"omega\"\n fontWeight=\"semiBold\"\n ellipsis\n >\n {validationErrorsMessages}\n </Typography>\n </Tooltip>\n </Flex>\n );\n }\n\n const getStatusMessage = () => {\n if (action === 'bulk-publish') {\n if (status === 'published') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-publish.already-published',\n defaultMessage: 'Already Published',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else if (status === 'modified') {\n return {\n icon: <ArrowsCounterClockwise fill=\"alternative600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish-changes',\n defaultMessage: 'Ready to publish changes',\n }),\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-publish',\n defaultMessage: 'Ready to publish',\n }),\n };\n }\n } else {\n if (status === 'draft') {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'content-manager.bulk-unpublish.already-unpublished',\n defaultMessage: 'Already Unpublished',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n } else {\n return {\n icon: <CheckCircle fill=\"success600\" />,\n text: formatMessage({\n id: 'app.utils.ready-to-unpublish-changes',\n defaultMessage: 'Ready to unpublish',\n }),\n textColor: 'success600',\n fontWeight: 'bold',\n };\n }\n }\n };\n\n const { icon, text, textColor = 'success600', fontWeight = 'normal' } = getStatusMessage();\n\n return (\n <Flex gap={2}>\n {icon}\n <Typography textColor={textColor} fontWeight={fontWeight}>\n {text}\n </Typography>\n </Flex>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BoldChunk\n * -----------------------------------------------------------------------------------------------*/\n\nconst BoldChunk = (chunks: React.ReactNode) => <Typography fontWeight=\"bold\">{chunks}</Typography>;\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleActionModal\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BulkLocaleActionModalProps {\n rows: LocaleStatus[];\n headers: {\n label: string;\n name: string;\n }[];\n localesMetadata: Locale[];\n validationErrors?: FormErrors;\n action: 'bulk-publish' | 'bulk-unpublish';\n}\n\nconst BulkLocaleActionModal = ({\n headers,\n rows,\n localesMetadata,\n validationErrors = {},\n action,\n}: BulkLocaleActionModalProps) => {\n const { formatMessage } = useIntl();\n\n const selectedRows = useTable<LocaleStatus[]>(\n 'BulkLocaleActionModal',\n (state) => state.selectedRows\n );\n\n const getFormattedCountMessage = () => {\n const currentStatusByLocale = rows.reduce<Record<string, string>>((acc, { locale, status }) => {\n acc[locale] = status;\n return acc;\n }, {});\n const localesWithErrors = Object.keys(validationErrors);\n\n const publishedCount = selectedRows.filter(\n ({ locale }) => currentStatusByLocale[locale] === 'published'\n ).length;\n\n const draftCount = selectedRows.filter(\n ({ locale }) =>\n (currentStatusByLocale[locale] === 'draft' ||\n currentStatusByLocale[locale] === 'modified') &&\n !localesWithErrors.includes(locale)\n ).length;\n\n const withErrorsCount = localesWithErrors.length;\n const messageId =\n action === 'bulk-publish'\n ? 'content-manager.containers.list.selectedEntriesModal.selectedCount.publish'\n : 'content-manager.containers.list.selectedEntriesModal.selectedCount.unpublish';\n\n const defaultMessage =\n action === 'bulk-publish'\n ? '<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action.'\n : '<b>{draftCount}</b> {draftCount, plural, =0 {entries} one {entry} other {entries}} already unpublished. <b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} ready to unpublish.';\n\n return formatMessage(\n {\n id: messageId,\n defaultMessage,\n },\n {\n withErrorsCount,\n draftCount,\n publishedCount,\n b: BoldChunk,\n }\n );\n };\n\n return (\n <Modal.Body>\n <Typography>{getFormattedCountMessage()}</Typography>\n <Box marginTop={5}>\n <Table.Content>\n <Table.Head>\n <Table.HeaderCheckboxCell />\n {headers.map((head) => (\n <Table.HeaderCell key={head.name} {...head} />\n ))}\n </Table.Head>\n <Table.Body>\n {rows.map(({ locale, status }, index) => {\n const error = validationErrors?.[locale] ?? null;\n\n const statusVariant =\n status === 'draft' ? 'primary' : status === 'published' ? 'success' : 'alternative';\n\n return status && locale ? (\n <Table.Row key={index}>\n <Table.CheckboxCell id={locale} aria-label={`Select ${locale}`} />\n <Table.Cell>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {Array.isArray(localesMetadata)\n ? localesMetadata.find((localeEntry) => localeEntry.code === locale)?.name\n : locale}\n </Typography>\n </Table.Cell>\n <Table.Cell>\n <Box display=\"flex\">\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size={'S'}\n variant={statusVariant}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n </Box>\n </Table.Cell>\n <Table.Cell>\n <EntryValidationText validationErrors={error} status={status} action={action} />\n </Table.Cell>\n <Table.Cell>\n <IconButton\n tag={Link}\n to={{\n search: stringify({ plugins: { i18n: { locale } } }),\n }}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit {name} locale',\n },\n {\n name: locale,\n }\n )}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Table.Cell>\n </Table.Row>\n ) : null;\n })}\n </Table.Body>\n </Table.Content>\n </Box>\n </Modal.Body>\n );\n};\n\nexport { BulkLocaleActionModal };\nexport type { BulkLocaleActionModalProps };\n"],"names":["isErrorMessageDescriptor","object","EntryValidationText","status","validationErrors","action","formatMessage","useIntl","getErrorStr","key","value","Array","isArray","map","v","join","Object","entries","k","validationErrorsMessages","_jsxs","Flex","gap","_jsx","CrossCircle","fill","Tooltip","label","Typography","maxWidth","textColor","variant","fontWeight","ellipsis","getStatusMessage","icon","CheckCircle","text","id","defaultMessage","ArrowsCounterClockwise","BoldChunk","chunks","BulkLocaleActionModal","headers","rows","localesMetadata","selectedRows","useTable","state","getFormattedCountMessage","currentStatusByLocale","reduce","acc","locale","localesWithErrors","keys","publishedCount","filter","length","draftCount","includes","withErrorsCount","messageId","b","Modal","Body","Box","marginTop","Table","Content","Head","HeaderCheckboxCell","head","HeaderCell","name","index","error","statusVariant","Row","CheckboxCell","aria-label","Cell","find","localeEntry","code","display","Status","paddingLeft","paddingRight","paddingTop","paddingBottom","size","tag","capitalize","IconButton","Link","to","search","stringify","plugins","i18n","getTranslation","Pencil"],"mappings":";;;;;;;;;;;AAiCA,MAAMA,2BAA2B,CAACC,MAAAA,GAAAA;AAChC,IAAA,OACE,OAAOA,MAAW,KAAA,QAAA,IAAYA,WAAW,IAAQ,IAAA,IAAA,IAAQA,UAAU,gBAAoBA,IAAAA,MAAAA;AAE3F,CAAA;AAEA,MAAMC,mBAAAA,GAAsB,CAAC,EAC3BC,MAAAA,GAAS,OAAO,EAChBC,gBAAgB,EAChBC,MAAM,EACmB,GAAA;IACzB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B;;;MAIA,MAAMC,WAAc,GAAA,CAACC,GAAaC,EAAAA,KAAAA,GAAAA;QAChC,IAAI,OAAOA,UAAU,QAAU,EAAA;AAC7B,YAAA,OAAO,CAAGD,EAAAA,GAAAA,CAAI,EAAE,EAAEC,KAAO,CAAA,CAAA;SACpB,MAAA,IAAIV,yBAAyBU,KAAQ,CAAA,EAAA;AAC1C,YAAA,OAAO,CAAGD,EAAAA,GAAAA,CAAI,EAAE,EAAEH,cAAcI,KAAQ,CAAA,CAAA,CAAA;AAC1C,SAAA,MAAO,IAAIC,KAAAA,CAAMC,OAAO,CAACF,KAAQ,CAAA,EAAA;YAC/B,OAAOA,KAAAA,CAAMG,GAAG,CAAC,CAACC,IAAMN,WAAYC,CAAAA,GAAAA,EAAKK,CAAIC,CAAAA,CAAAA,CAAAA,IAAI,CAA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