@strapi/i18n 0.0.0-next.4afb25b82502b04f05bbc122b43e1e3a806e7600 → 0.0.0-next.4e3b7c0d7fa4aea6cd9c7de5f63e77d79e147a0f

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 (458) hide show
  1. package/dist/admin/components/BulkLocaleActionModal.js +262 -0
  2. package/dist/admin/components/BulkLocaleActionModal.js.map +1 -0
  3. package/dist/admin/components/BulkLocaleActionModal.mjs +260 -0
  4. package/dist/admin/components/BulkLocaleActionModal.mjs.map +1 -0
  5. package/dist/admin/components/CMHeaderActions.js +852 -0
  6. package/dist/admin/components/CMHeaderActions.js.map +1 -0
  7. package/dist/admin/components/CMHeaderActions.mjs +826 -0
  8. package/dist/admin/components/CMHeaderActions.mjs.map +1 -0
  9. package/dist/admin/components/CMListViewModalsAdditionalInformation.js +69 -0
  10. package/dist/admin/components/CMListViewModalsAdditionalInformation.js.map +1 -0
  11. package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs +65 -0
  12. package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs.map +1 -0
  13. package/dist/admin/components/CheckboxConfirmation.js +155 -0
  14. package/dist/admin/components/CheckboxConfirmation.js.map +1 -0
  15. package/dist/admin/components/CheckboxConfirmation.mjs +134 -0
  16. package/dist/admin/components/CheckboxConfirmation.mjs.map +1 -0
  17. package/dist/admin/components/CreateLocale.js +395 -0
  18. package/dist/admin/components/CreateLocale.js.map +1 -0
  19. package/dist/admin/components/CreateLocale.mjs +369 -0
  20. package/dist/admin/components/CreateLocale.mjs.map +1 -0
  21. package/dist/admin/components/DeleteLocale.js +90 -0
  22. package/dist/admin/components/DeleteLocale.js.map +1 -0
  23. package/dist/admin/components/DeleteLocale.mjs +69 -0
  24. package/dist/admin/components/DeleteLocale.mjs.map +1 -0
  25. package/dist/admin/components/EditLocale.js +212 -0
  26. package/dist/admin/components/EditLocale.js.map +1 -0
  27. package/dist/admin/components/EditLocale.mjs +190 -0
  28. package/dist/admin/components/EditLocale.mjs.map +1 -0
  29. package/dist/admin/components/LocaleListCell.js +102 -0
  30. package/dist/admin/components/LocaleListCell.js.map +1 -0
  31. package/dist/admin/components/LocaleListCell.mjs +100 -0
  32. package/dist/admin/components/LocaleListCell.mjs.map +1 -0
  33. package/dist/admin/components/LocalePicker.js +105 -0
  34. package/dist/admin/components/LocalePicker.js.map +1 -0
  35. package/dist/admin/components/LocalePicker.mjs +84 -0
  36. package/dist/admin/components/LocalePicker.mjs.map +1 -0
  37. package/dist/admin/components/LocaleTable.js +143 -0
  38. package/dist/admin/components/LocaleTable.js.map +1 -0
  39. package/dist/admin/components/LocaleTable.mjs +122 -0
  40. package/dist/admin/components/LocaleTable.mjs.map +1 -0
  41. package/dist/admin/constants.js +37 -0
  42. package/dist/admin/constants.js.map +1 -0
  43. package/dist/admin/constants.mjs +35 -0
  44. package/dist/admin/constants.mjs.map +1 -0
  45. package/dist/admin/contentManagerHooks/editView.js +109 -0
  46. package/dist/admin/contentManagerHooks/editView.js.map +1 -0
  47. package/dist/admin/contentManagerHooks/editView.mjs +88 -0
  48. package/dist/admin/contentManagerHooks/editView.mjs.map +1 -0
  49. package/dist/admin/contentManagerHooks/listView.js +44 -0
  50. package/dist/admin/contentManagerHooks/listView.js.map +1 -0
  51. package/dist/admin/contentManagerHooks/listView.mjs +42 -0
  52. package/dist/admin/contentManagerHooks/listView.mjs.map +1 -0
  53. package/dist/admin/contentReleasesHooks/releaseDetailsView.js +20 -0
  54. package/dist/admin/contentReleasesHooks/releaseDetailsView.js.map +1 -0
  55. package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs +18 -0
  56. package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs.map +1 -0
  57. package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
  58. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  59. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
  60. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  61. package/dist/admin/hooks/useI18n.js +78 -0
  62. package/dist/admin/hooks/useI18n.js.map +1 -0
  63. package/dist/admin/hooks/useI18n.mjs +57 -0
  64. package/dist/admin/hooks/useI18n.mjs.map +1 -0
  65. package/dist/admin/index.js +226 -5
  66. package/dist/admin/index.js.map +1 -1
  67. package/dist/admin/index.mjs +202 -5
  68. package/dist/admin/index.mjs.map +1 -1
  69. package/dist/admin/middlewares/extendCTBAttributeInitialData.js +71 -0
  70. package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -0
  71. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +69 -0
  72. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -0
  73. package/dist/admin/middlewares/extendCTBInitialData.js +40 -0
  74. package/dist/admin/middlewares/extendCTBInitialData.js.map +1 -0
  75. package/dist/admin/middlewares/extendCTBInitialData.mjs +38 -0
  76. package/dist/admin/middlewares/extendCTBInitialData.mjs.map +1 -0
  77. package/dist/admin/middlewares/rbac-middleware.js +49 -0
  78. package/dist/admin/middlewares/rbac-middleware.js.map +1 -0
  79. package/dist/admin/middlewares/rbac-middleware.mjs +28 -0
  80. package/dist/admin/middlewares/rbac-middleware.mjs.map +1 -0
  81. package/dist/admin/pages/SettingsPage.js +182 -0
  82. package/dist/admin/pages/SettingsPage.js.map +1 -0
  83. package/dist/admin/pages/SettingsPage.mjs +179 -0
  84. package/dist/admin/pages/SettingsPage.mjs.map +1 -0
  85. package/dist/admin/pluginId.js +6 -0
  86. package/dist/admin/pluginId.js.map +1 -0
  87. package/dist/admin/pluginId.mjs +4 -0
  88. package/dist/admin/pluginId.mjs.map +1 -0
  89. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  90. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  91. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  92. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  93. package/dist/admin/services/api.js +15 -0
  94. package/dist/admin/services/api.js.map +1 -0
  95. package/dist/admin/services/api.mjs +13 -0
  96. package/dist/admin/services/api.mjs.map +1 -0
  97. package/dist/admin/services/locales.js +72 -0
  98. package/dist/admin/services/locales.js.map +1 -0
  99. package/dist/admin/services/locales.mjs +66 -0
  100. package/dist/admin/services/locales.mjs.map +1 -0
  101. package/dist/admin/services/relations.js +23 -0
  102. package/dist/admin/services/relations.js.map +1 -0
  103. package/dist/admin/services/relations.mjs +21 -0
  104. package/dist/admin/services/relations.mjs.map +1 -0
  105. package/dist/admin/services/settings.js +29 -0
  106. package/dist/admin/services/settings.js.map +1 -0
  107. package/dist/admin/services/settings.mjs +26 -0
  108. package/dist/admin/services/settings.mjs.map +1 -0
  109. package/dist/admin/src/components/CMHeaderActions.d.ts +8 -2
  110. package/dist/admin/src/components/LocaleListCell.d.ts +5 -4
  111. package/dist/admin/src/components/tests/CreateLocale.test.d.ts +1 -0
  112. package/dist/admin/src/components/tests/DeleteLocale.test.d.ts +1 -0
  113. package/dist/admin/src/components/tests/EditLocale.test.d.ts +1 -0
  114. package/dist/admin/src/components/tests/LocaleListCell.test.d.ts +1 -0
  115. package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +1 -1
  116. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  117. package/dist/admin/src/pages/tests/SettingsPage.test.d.ts +1 -0
  118. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  119. package/dist/admin/src/services/api.d.ts +1 -1
  120. package/dist/admin/src/services/locales.d.ts +1 -1
  121. package/dist/admin/src/services/relations.d.ts +1 -1
  122. package/dist/admin/src/services/settings.d.ts +5 -0
  123. package/dist/admin/src/utils/schemas.d.ts +642 -16
  124. package/dist/admin/tests/server.d.ts +1 -0
  125. package/dist/admin/tests/utils.d.ts +6 -0
  126. package/dist/admin/translations/de.json.js +66 -0
  127. package/dist/admin/translations/de.json.js.map +1 -0
  128. package/dist/admin/translations/de.json.mjs +64 -0
  129. package/dist/admin/translations/de.json.mjs.map +1 -0
  130. package/dist/admin/translations/dk.json.js +66 -0
  131. package/dist/admin/translations/dk.json.js.map +1 -0
  132. package/dist/admin/translations/dk.json.mjs +64 -0
  133. package/dist/admin/translations/dk.json.mjs.map +1 -0
  134. package/dist/admin/translations/en.json.js +90 -0
  135. package/dist/admin/translations/en.json.js.map +1 -0
  136. package/dist/admin/translations/en.json.mjs +88 -0
  137. package/dist/admin/translations/en.json.mjs.map +1 -0
  138. package/dist/admin/translations/es.json.js +66 -0
  139. package/dist/admin/translations/es.json.js.map +1 -0
  140. package/dist/admin/translations/es.json.mjs +64 -0
  141. package/dist/admin/translations/es.json.mjs.map +1 -0
  142. package/dist/admin/translations/fr.json.js +66 -0
  143. package/dist/admin/translations/fr.json.js.map +1 -0
  144. package/dist/admin/translations/fr.json.mjs +64 -0
  145. package/dist/admin/translations/fr.json.mjs.map +1 -0
  146. package/dist/admin/translations/ko.json.js +65 -0
  147. package/dist/admin/translations/ko.json.js.map +1 -0
  148. package/dist/admin/translations/ko.json.mjs +63 -0
  149. package/dist/admin/translations/ko.json.mjs.map +1 -0
  150. package/dist/admin/translations/pl.json.js +66 -0
  151. package/dist/admin/translations/pl.json.js.map +1 -0
  152. package/dist/admin/translations/pl.json.mjs +64 -0
  153. package/dist/admin/translations/pl.json.mjs.map +1 -0
  154. package/dist/admin/translations/ru.json.js +68 -0
  155. package/dist/admin/translations/ru.json.js.map +1 -0
  156. package/dist/admin/translations/ru.json.mjs +66 -0
  157. package/dist/admin/translations/ru.json.mjs.map +1 -0
  158. package/dist/admin/translations/tr.json.js +66 -0
  159. package/dist/admin/translations/tr.json.js.map +1 -0
  160. package/dist/admin/translations/tr.json.mjs +64 -0
  161. package/dist/admin/translations/tr.json.mjs.map +1 -0
  162. package/dist/admin/translations/uk.json.js +82 -0
  163. package/dist/admin/translations/uk.json.js.map +1 -0
  164. package/dist/admin/translations/uk.json.mjs +80 -0
  165. package/dist/admin/translations/uk.json.mjs.map +1 -0
  166. package/dist/admin/translations/zh-Hans.json.js +57 -0
  167. package/dist/admin/translations/zh-Hans.json.js.map +1 -0
  168. package/dist/admin/translations/zh-Hans.json.mjs +55 -0
  169. package/dist/admin/translations/zh-Hans.json.mjs.map +1 -0
  170. package/dist/admin/translations/zh.json.js +66 -0
  171. package/dist/admin/translations/zh.json.js.map +1 -0
  172. package/dist/admin/translations/zh.json.mjs +64 -0
  173. package/dist/admin/translations/zh.json.mjs.map +1 -0
  174. package/dist/admin/utils/baseQuery.js +8 -0
  175. package/dist/admin/utils/baseQuery.js.map +1 -0
  176. package/dist/admin/utils/baseQuery.mjs +6 -0
  177. package/dist/admin/utils/baseQuery.mjs.map +1 -0
  178. package/dist/admin/utils/clean.js +70 -0
  179. package/dist/admin/utils/clean.js.map +1 -0
  180. package/dist/admin/utils/clean.mjs +68 -0
  181. package/dist/admin/utils/clean.mjs.map +1 -0
  182. package/dist/admin/utils/fields.js +34 -0
  183. package/dist/admin/utils/fields.js.map +1 -0
  184. package/dist/admin/utils/fields.mjs +31 -0
  185. package/dist/admin/utils/fields.mjs.map +1 -0
  186. package/dist/admin/utils/getTranslation.js +8 -0
  187. package/dist/admin/utils/getTranslation.js.map +1 -0
  188. package/dist/admin/utils/getTranslation.mjs +6 -0
  189. package/dist/admin/utils/getTranslation.mjs.map +1 -0
  190. package/dist/admin/utils/prefixPluginTranslations.js +11 -0
  191. package/dist/admin/utils/prefixPluginTranslations.js.map +1 -0
  192. package/dist/admin/utils/prefixPluginTranslations.mjs +9 -0
  193. package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -0
  194. package/dist/admin/utils/schemas.js +74 -0
  195. package/dist/admin/utils/schemas.js.map +1 -0
  196. package/dist/admin/utils/schemas.mjs +72 -0
  197. package/dist/admin/utils/schemas.mjs.map +1 -0
  198. package/dist/admin/utils/strings.js +6 -0
  199. package/dist/admin/utils/strings.js.map +1 -0
  200. package/dist/admin/utils/strings.mjs +4 -0
  201. package/dist/admin/utils/strings.mjs.map +1 -0
  202. package/dist/server/bootstrap.js +81 -0
  203. package/dist/server/bootstrap.js.map +1 -0
  204. package/dist/server/bootstrap.mjs +79 -0
  205. package/dist/server/bootstrap.mjs.map +1 -0
  206. package/dist/server/constants/index.js +29 -0
  207. package/dist/server/constants/index.js.map +1 -0
  208. package/dist/server/constants/index.mjs +25 -0
  209. package/dist/server/constants/index.mjs.map +1 -0
  210. package/dist/server/constants/iso-locales.json.js +2427 -0
  211. package/dist/server/constants/iso-locales.json.js.map +1 -0
  212. package/dist/server/constants/iso-locales.json.mjs +2425 -0
  213. package/dist/server/constants/iso-locales.json.mjs.map +1 -0
  214. package/dist/server/content-types/index.js +10 -0
  215. package/dist/server/content-types/index.js.map +1 -0
  216. package/dist/server/content-types/index.mjs +8 -0
  217. package/dist/server/content-types/index.mjs.map +1 -0
  218. package/dist/server/content-types/locale/index.js +10 -0
  219. package/dist/server/content-types/locale/index.js.map +1 -0
  220. package/dist/server/content-types/locale/index.mjs +8 -0
  221. package/dist/server/content-types/locale/index.mjs.map +1 -0
  222. package/dist/server/content-types/locale/schema.json.js +46 -0
  223. package/dist/server/content-types/locale/schema.json.js.map +1 -0
  224. package/dist/server/content-types/locale/schema.json.mjs +38 -0
  225. package/dist/server/content-types/locale/schema.json.mjs.map +1 -0
  226. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  227. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  228. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  229. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  230. package/dist/server/controllers/content-types.js +76 -0
  231. package/dist/server/controllers/content-types.js.map +1 -0
  232. package/dist/server/controllers/content-types.mjs +74 -0
  233. package/dist/server/controllers/content-types.mjs.map +1 -0
  234. package/dist/server/controllers/index.js +18 -0
  235. package/dist/server/controllers/index.js.map +1 -0
  236. package/dist/server/controllers/index.mjs +16 -0
  237. package/dist/server/controllers/index.mjs.map +1 -0
  238. package/dist/server/controllers/iso-locales.js +13 -0
  239. package/dist/server/controllers/iso-locales.js.map +1 -0
  240. package/dist/server/controllers/iso-locales.mjs +11 -0
  241. package/dist/server/controllers/iso-locales.mjs.map +1 -0
  242. package/dist/server/controllers/locales.js +108 -0
  243. package/dist/server/controllers/locales.js.map +1 -0
  244. package/dist/server/controllers/locales.mjs +87 -0
  245. package/dist/server/controllers/locales.mjs.map +1 -0
  246. package/dist/server/controllers/settings.js +24 -0
  247. package/dist/server/controllers/settings.js.map +1 -0
  248. package/dist/server/controllers/settings.mjs +22 -0
  249. package/dist/server/controllers/settings.mjs.map +1 -0
  250. package/dist/server/controllers/validate-locale-creation.js +47 -0
  251. package/dist/server/controllers/validate-locale-creation.js.map +1 -0
  252. package/dist/server/controllers/validate-locale-creation.mjs +45 -0
  253. package/dist/server/controllers/validate-locale-creation.mjs.map +1 -0
  254. package/dist/server/domain/locale.js +11 -0
  255. package/dist/server/domain/locale.js.map +1 -0
  256. package/dist/server/domain/locale.mjs +9 -0
  257. package/dist/server/domain/locale.mjs.map +1 -0
  258. package/dist/server/graphql.js +115 -0
  259. package/dist/server/graphql.js.map +1 -0
  260. package/dist/server/graphql.mjs +113 -0
  261. package/dist/server/graphql.mjs.map +1 -0
  262. package/dist/server/index.js +18 -3460
  263. package/dist/server/index.js.map +1 -1
  264. package/dist/server/index.mjs +17 -3443
  265. package/dist/server/index.mjs.map +1 -1
  266. package/dist/server/models/ai-localization-job.js +60 -0
  267. package/dist/server/models/ai-localization-job.js.map +1 -0
  268. package/dist/server/models/ai-localization-job.mjs +57 -0
  269. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  270. package/dist/server/register.js +81 -0
  271. package/dist/server/register.js.map +1 -0
  272. package/dist/server/register.mjs +79 -0
  273. package/dist/server/register.mjs.map +1 -0
  274. package/dist/server/routes/admin.js +142 -0
  275. package/dist/server/routes/admin.js.map +1 -0
  276. package/dist/server/routes/admin.mjs +140 -0
  277. package/dist/server/routes/admin.mjs.map +1 -0
  278. package/dist/server/routes/content-api.js +19 -0
  279. package/dist/server/routes/content-api.js.map +1 -0
  280. package/dist/server/routes/content-api.mjs +17 -0
  281. package/dist/server/routes/content-api.mjs.map +1 -0
  282. package/dist/server/routes/index.js +12 -0
  283. package/dist/server/routes/index.js.map +1 -0
  284. package/dist/server/routes/index.mjs +10 -0
  285. package/dist/server/routes/index.mjs.map +1 -0
  286. package/dist/server/routes/validation/locale.js +57 -0
  287. package/dist/server/routes/validation/locale.js.map +1 -0
  288. package/dist/server/routes/validation/locale.mjs +36 -0
  289. package/dist/server/routes/validation/locale.mjs.map +1 -0
  290. package/dist/server/services/ai-localization-jobs.js +64 -0
  291. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  292. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  293. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  294. package/dist/server/services/ai-localizations.js +222 -0
  295. package/dist/server/services/ai-localizations.js.map +1 -0
  296. package/dist/server/services/ai-localizations.mjs +220 -0
  297. package/dist/server/services/ai-localizations.mjs.map +1 -0
  298. package/dist/server/services/content-types.js +157 -0
  299. package/dist/server/services/content-types.js.map +1 -0
  300. package/dist/server/services/content-types.mjs +155 -0
  301. package/dist/server/services/content-types.mjs.map +1 -0
  302. package/dist/server/services/index.js +28 -0
  303. package/dist/server/services/index.js.map +1 -0
  304. package/dist/server/services/index.mjs +26 -0
  305. package/dist/server/services/index.mjs.map +1 -0
  306. package/dist/server/services/iso-locales.js +12 -0
  307. package/dist/server/services/iso-locales.js.map +1 -0
  308. package/dist/server/services/iso-locales.mjs +10 -0
  309. package/dist/server/services/iso-locales.mjs.map +1 -0
  310. package/dist/server/services/locales.js +114 -0
  311. package/dist/server/services/locales.js.map +1 -0
  312. package/dist/server/services/locales.mjs +112 -0
  313. package/dist/server/services/locales.mjs.map +1 -0
  314. package/dist/server/services/localizations.js +68 -0
  315. package/dist/server/services/localizations.js.map +1 -0
  316. package/dist/server/services/localizations.mjs +66 -0
  317. package/dist/server/services/localizations.mjs.map +1 -0
  318. package/dist/server/services/metrics.js +30 -0
  319. package/dist/server/services/metrics.js.map +1 -0
  320. package/dist/server/services/metrics.mjs +28 -0
  321. package/dist/server/services/metrics.mjs.map +1 -0
  322. package/dist/server/services/permissions/actions.js +136 -0
  323. package/dist/server/services/permissions/actions.js.map +1 -0
  324. package/dist/server/services/permissions/actions.mjs +134 -0
  325. package/dist/server/services/permissions/actions.mjs.map +1 -0
  326. package/dist/server/services/permissions/engine.js +52 -0
  327. package/dist/server/services/permissions/engine.js.map +1 -0
  328. package/dist/server/services/permissions/engine.mjs +50 -0
  329. package/dist/server/services/permissions/engine.mjs.map +1 -0
  330. package/dist/server/services/permissions/sections-builder.js +45 -0
  331. package/dist/server/services/permissions/sections-builder.js.map +1 -0
  332. package/dist/server/services/permissions/sections-builder.mjs +43 -0
  333. package/dist/server/services/permissions/sections-builder.mjs.map +1 -0
  334. package/dist/server/services/permissions.js +14 -0
  335. package/dist/server/services/permissions.js.map +1 -0
  336. package/dist/server/services/permissions.mjs +12 -0
  337. package/dist/server/services/permissions.mjs.map +1 -0
  338. package/dist/server/services/sanitize/index.js +34 -0
  339. package/dist/server/services/sanitize/index.js.map +1 -0
  340. package/dist/server/services/sanitize/index.mjs +32 -0
  341. package/dist/server/services/sanitize/index.mjs.map +1 -0
  342. package/dist/server/services/settings.js +25 -0
  343. package/dist/server/services/settings.js.map +1 -0
  344. package/dist/server/services/settings.mjs +23 -0
  345. package/dist/server/services/settings.mjs.map +1 -0
  346. package/dist/server/src/bootstrap.d.ts.map +1 -1
  347. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  348. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  349. package/dist/server/src/controllers/index.d.ts +10 -0
  350. package/dist/server/src/controllers/index.d.ts.map +1 -1
  351. package/dist/server/src/controllers/settings.d.ts +7 -0
  352. package/dist/server/src/controllers/settings.d.ts.map +1 -0
  353. package/dist/server/src/index.d.ts +47 -8
  354. package/dist/server/src/index.d.ts.map +1 -1
  355. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  356. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  357. package/dist/server/src/models/index.d.ts +5 -0
  358. package/dist/server/src/models/index.d.ts.map +1 -0
  359. package/dist/server/src/register.d.ts +1 -1
  360. package/dist/server/src/register.d.ts.map +1 -1
  361. package/dist/server/src/routes/admin.d.ts.map +1 -1
  362. package/dist/server/src/routes/content-api.d.ts +5 -8
  363. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  364. package/dist/server/src/routes/index.d.ts +3 -7
  365. package/dist/server/src/routes/index.d.ts.map +1 -1
  366. package/dist/server/src/routes/validation/index.d.ts +2 -0
  367. package/dist/server/src/routes/validation/index.d.ts.map +1 -0
  368. package/dist/server/src/routes/validation/locale.d.ts +41 -0
  369. package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
  370. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  371. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  372. package/dist/server/src/services/ai-localizations.d.ts +18 -0
  373. package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
  374. package/dist/server/src/services/index.d.ts +33 -0
  375. package/dist/server/src/services/index.d.ts.map +1 -1
  376. package/dist/server/src/services/localizations.d.ts +1 -1
  377. package/dist/server/src/services/localizations.d.ts.map +1 -1
  378. package/dist/server/src/services/settings.d.ts +13 -0
  379. package/dist/server/src/services/settings.d.ts.map +1 -0
  380. package/dist/server/src/utils/index.d.ts +7 -1
  381. package/dist/server/src/utils/index.d.ts.map +1 -1
  382. package/dist/server/src/validation/settings.d.ts +12 -0
  383. package/dist/server/src/validation/settings.d.ts.map +1 -0
  384. package/dist/server/utils/index.js +16 -0
  385. package/dist/server/utils/index.js.map +1 -0
  386. package/dist/server/utils/index.mjs +13 -0
  387. package/dist/server/utils/index.mjs.map +1 -0
  388. package/dist/server/validation/content-types.js +18 -0
  389. package/dist/server/validation/content-types.js.map +1 -0
  390. package/dist/server/validation/content-types.mjs +16 -0
  391. package/dist/server/validation/content-types.mjs.map +1 -0
  392. package/dist/server/validation/locales.js +23 -0
  393. package/dist/server/validation/locales.js.map +1 -0
  394. package/dist/server/validation/locales.mjs +20 -0
  395. package/dist/server/validation/locales.mjs.map +1 -0
  396. package/dist/server/validation/settings.js +11 -0
  397. package/dist/server/validation/settings.js.map +1 -0
  398. package/dist/server/validation/settings.mjs +9 -0
  399. package/dist/server/validation/settings.mjs.map +1 -0
  400. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  401. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  402. package/dist/shared/contracts/content-manager.d.ts +1 -1
  403. package/dist/shared/contracts/settings.d.ts +40 -0
  404. package/dist/shared/contracts/shared.d.ts +1 -1
  405. package/dist/shared/contracts/shared.d.ts.map +1 -0
  406. package/package.json +19 -14
  407. package/dist/_chunks/SettingsPage-BAx9nmep.mjs +0 -554
  408. package/dist/_chunks/SettingsPage-BAx9nmep.mjs.map +0 -1
  409. package/dist/_chunks/SettingsPage-BTgjb2KS.js +0 -573
  410. package/dist/_chunks/SettingsPage-BTgjb2KS.js.map +0 -1
  411. package/dist/_chunks/de-9eCAqqrB.mjs +0 -66
  412. package/dist/_chunks/de-9eCAqqrB.mjs.map +0 -1
  413. package/dist/_chunks/de-DtWiGdHl.js +0 -66
  414. package/dist/_chunks/de-DtWiGdHl.js.map +0 -1
  415. package/dist/_chunks/dk-2qBjxt-P.mjs +0 -66
  416. package/dist/_chunks/dk-2qBjxt-P.mjs.map +0 -1
  417. package/dist/_chunks/dk-D8C-casx.js +0 -66
  418. package/dist/_chunks/dk-D8C-casx.js.map +0 -1
  419. package/dist/_chunks/en-BKBz3tro.js +0 -81
  420. package/dist/_chunks/en-BKBz3tro.js.map +0 -1
  421. package/dist/_chunks/en-DlXfy6Gy.mjs +0 -81
  422. package/dist/_chunks/en-DlXfy6Gy.mjs.map +0 -1
  423. package/dist/_chunks/es-DS-XFGSw.js +0 -66
  424. package/dist/_chunks/es-DS-XFGSw.js.map +0 -1
  425. package/dist/_chunks/es-DlmMVaBG.mjs +0 -66
  426. package/dist/_chunks/es-DlmMVaBG.mjs.map +0 -1
  427. package/dist/_chunks/fr-3S6ke71d.mjs +0 -66
  428. package/dist/_chunks/fr-3S6ke71d.mjs.map +0 -1
  429. package/dist/_chunks/fr-BTjekDpq.js +0 -66
  430. package/dist/_chunks/fr-BTjekDpq.js.map +0 -1
  431. package/dist/_chunks/index-3yyF237r.js +0 -1644
  432. package/dist/_chunks/index-3yyF237r.js.map +0 -1
  433. package/dist/_chunks/index-B0NijiBB.mjs +0 -1623
  434. package/dist/_chunks/index-B0NijiBB.mjs.map +0 -1
  435. package/dist/_chunks/ko-DmcGUBQ3.js +0 -65
  436. package/dist/_chunks/ko-DmcGUBQ3.js.map +0 -1
  437. package/dist/_chunks/ko-qTjQ8IMw.mjs +0 -65
  438. package/dist/_chunks/ko-qTjQ8IMw.mjs.map +0 -1
  439. package/dist/_chunks/pl-B67TSHqT.mjs +0 -66
  440. package/dist/_chunks/pl-B67TSHqT.mjs.map +0 -1
  441. package/dist/_chunks/pl-Cn5RYonZ.js +0 -66
  442. package/dist/_chunks/pl-Cn5RYonZ.js.map +0 -1
  443. package/dist/_chunks/ru-BMBgVL3s.js +0 -68
  444. package/dist/_chunks/ru-BMBgVL3s.js.map +0 -1
  445. package/dist/_chunks/ru-hagMa57T.mjs +0 -68
  446. package/dist/_chunks/ru-hagMa57T.mjs.map +0 -1
  447. package/dist/_chunks/tr-CarUU76c.js +0 -66
  448. package/dist/_chunks/tr-CarUU76c.js.map +0 -1
  449. package/dist/_chunks/tr-Dw_jmkG-.mjs +0 -66
  450. package/dist/_chunks/tr-Dw_jmkG-.mjs.map +0 -1
  451. package/dist/_chunks/zh-57YM4amO.mjs +0 -66
  452. package/dist/_chunks/zh-57YM4amO.mjs.map +0 -1
  453. package/dist/_chunks/zh-CukOviB0.js +0 -66
  454. package/dist/_chunks/zh-CukOviB0.js.map +0 -1
  455. package/dist/_chunks/zh-Hans-DSHIXAa3.js +0 -57
  456. package/dist/_chunks/zh-Hans-DSHIXAa3.js.map +0 -1
  457. package/dist/_chunks/zh-Hans-Dyc-aR-h.mjs +0 -57
  458. package/dist/_chunks/zh-Hans-Dyc-aR-h.mjs.map +0 -1
@@ -0,0 +1,852 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+ var query = require('@reduxjs/toolkit/query');
6
+ var strapiAdmin = require('@strapi/admin/strapi-admin');
7
+ var ee = require('@strapi/admin/strapi-admin/ee');
8
+ var strapiAdmin$1 = require('@strapi/content-manager/strapi-admin');
9
+ var designSystem = require('@strapi/design-system');
10
+ var icons = require('@strapi/icons');
11
+ var reactIntl = require('react-intl');
12
+ var reactRouterDom = require('react-router-dom');
13
+ var styledComponents = require('styled-components');
14
+ var useAILocalizationJobsPolling = require('../hooks/useAILocalizationJobsPolling.js');
15
+ var useI18n = require('../hooks/useI18n.js');
16
+ var locales = require('../services/locales.js');
17
+ var relations = require('../services/relations.js');
18
+ var settings = require('../services/settings.js');
19
+ var clean = require('../utils/clean.js');
20
+ var getTranslation = require('../utils/getTranslation.js');
21
+ var strings = require('../utils/strings.js');
22
+ var BulkLocaleActionModal = require('./BulkLocaleActionModal.js');
23
+
24
+ function _interopNamespaceDefault(e) {
25
+ var n = Object.create(null);
26
+ if (e) {
27
+ Object.keys(e).forEach(function (k) {
28
+ if (k !== 'default') {
29
+ var d = Object.getOwnPropertyDescriptor(e, k);
30
+ Object.defineProperty(n, k, d.get ? d : {
31
+ enumerable: true,
32
+ get: function () { return e[k]; }
33
+ });
34
+ }
35
+ });
36
+ }
37
+ n.default = e;
38
+ return Object.freeze(n);
39
+ }
40
+
41
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
42
+
43
+ const statusVariants = {
44
+ draft: 'secondary',
45
+ published: 'success',
46
+ modified: 'alternative'
47
+ };
48
+ const LocaleOption = ({ isDraftAndPublishEnabled, locale, status, entryExists })=>{
49
+ const { formatMessage } = reactIntl.useIntl();
50
+ if (!entryExists) {
51
+ return formatMessage({
52
+ id: getTranslation.getTranslation('CMEditViewLocalePicker.locale.create'),
53
+ defaultMessage: 'Create <bold>{locale}</bold> locale'
54
+ }, {
55
+ bold: (locale)=>/*#__PURE__*/ jsxRuntime.jsx("b", {
56
+ children: locale
57
+ }),
58
+ locale: locale.name
59
+ });
60
+ }
61
+ return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
62
+ width: "100%",
63
+ gap: 1,
64
+ justifyContent: "space-between",
65
+ children: [
66
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
67
+ children: locale.name
68
+ }),
69
+ isDraftAndPublishEnabled ? /*#__PURE__*/ jsxRuntime.jsx(designSystem.Status, {
70
+ display: "flex",
71
+ paddingLeft: "6px",
72
+ paddingRight: "6px",
73
+ paddingTop: "2px",
74
+ paddingBottom: "2px",
75
+ size: "S",
76
+ variant: statusVariants[status],
77
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
78
+ tag: "span",
79
+ variant: "pi",
80
+ fontWeight: "bold",
81
+ children: strings.capitalize(status)
82
+ })
83
+ }) : null
84
+ ]
85
+ });
86
+ };
87
+ const LocalePickerAction = ({ document, meta, model, collectionType, documentId })=>{
88
+ const { formatMessage } = reactIntl.useIntl();
89
+ const [{ query }, setQuery] = strapiAdmin.useQueryParams();
90
+ const { hasI18n, canCreate, canRead } = useI18n.useI18n();
91
+ const { data: locales$1 = [] } = locales.useGetLocalesQuery();
92
+ const currentDesiredLocale = query.plugins?.i18n?.locale;
93
+ const { schema } = strapiAdmin$1.unstable_useDocument({
94
+ model,
95
+ collectionType,
96
+ documentId,
97
+ params: {
98
+ locale: currentDesiredLocale
99
+ }
100
+ });
101
+ const handleSelect = React__namespace.useCallback((value)=>{
102
+ setQuery({
103
+ plugins: {
104
+ ...query.plugins,
105
+ i18n: {
106
+ locale: value
107
+ }
108
+ }
109
+ });
110
+ }, [
111
+ query.plugins,
112
+ setQuery
113
+ ]);
114
+ React__namespace.useEffect(()=>{
115
+ if (!Array.isArray(locales$1) || !hasI18n) {
116
+ return;
117
+ }
118
+ /**
119
+ * Handle the case where the current locale query param doesn't exist
120
+ * in the list of available locales, so we redirect to the default locale.
121
+ */ const doesLocaleExist = locales$1.find((loc)=>loc.code === currentDesiredLocale);
122
+ const defaultLocale = locales$1.find((locale)=>locale.isDefault);
123
+ if (!doesLocaleExist && defaultLocale?.code) {
124
+ handleSelect(defaultLocale.code);
125
+ }
126
+ }, [
127
+ handleSelect,
128
+ hasI18n,
129
+ locales$1,
130
+ currentDesiredLocale
131
+ ]);
132
+ const currentLocale = Array.isArray(locales$1) ? locales$1.find((locale)=>locale.code === currentDesiredLocale) : undefined;
133
+ // Use meta.availableLocales instead of document.localizations
134
+ // meta.availableLocales contains all locales for the document, even when creating new locales
135
+ const availableLocales = meta?.availableLocales ?? [];
136
+ const documentLocalizations = document?.localizations ?? [];
137
+ // Prefer meta.availableLocales as it's more reliable, fallback to document.localizations
138
+ const allLocalizations = availableLocales.length > 0 ? availableLocales : documentLocalizations;
139
+ const allCurrentLocales = [
140
+ {
141
+ status: getDocumentStatus(document, meta),
142
+ locale: currentLocale?.code
143
+ },
144
+ ...allLocalizations
145
+ ];
146
+ if (!hasI18n || !Array.isArray(locales$1) || locales$1.length === 0) {
147
+ return null;
148
+ }
149
+ const displayedLocales = locales$1.filter((locale)=>{
150
+ /**
151
+ * If you can read we allow you to see the locale exists
152
+ * otherwise the locale is hidden.
153
+ */ return canRead.includes(locale.code);
154
+ });
155
+ return {
156
+ label: formatMessage({
157
+ id: getTranslation.getTranslation('Settings.locales.modal.locales.label'),
158
+ defaultMessage: 'Locales'
159
+ }),
160
+ options: displayedLocales.map((locale)=>{
161
+ const entryWithLocaleExists = allCurrentLocales.some((doc)=>doc.locale === locale.code);
162
+ const currentLocaleDoc = allCurrentLocales.find((doc)=>'locale' in doc ? doc.locale === locale.code : false);
163
+ const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
164
+ return {
165
+ disabled: !permissionsToCheck.includes(locale.code),
166
+ value: locale.code,
167
+ label: /*#__PURE__*/ jsxRuntime.jsx(LocaleOption, {
168
+ isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
169
+ locale: locale,
170
+ status: currentLocaleDoc?.status,
171
+ entryExists: entryWithLocaleExists
172
+ }),
173
+ startIcon: !entryWithLocaleExists ? /*#__PURE__*/ jsxRuntime.jsx(icons.Plus, {}) : null
174
+ };
175
+ }),
176
+ customizeContent: ()=>currentLocale?.name,
177
+ onSelect: handleSelect,
178
+ value: currentLocale
179
+ };
180
+ };
181
+ const getDocumentStatus = (document, meta)=>{
182
+ const docStatus = document?.status;
183
+ const statuses = meta?.availableStatus ?? [];
184
+ /**
185
+ * Creating an entry
186
+ */ if (!docStatus) {
187
+ return 'draft';
188
+ }
189
+ /**
190
+ * We're viewing a draft, but the document could have a published version
191
+ */ if (docStatus === 'draft' && statuses.find((doc)=>doc.publishedAt !== null)) {
192
+ return 'published';
193
+ }
194
+ return docStatus;
195
+ };
196
+ /* -------------------------------------------------------------------------------------------------
197
+ * AISettingsStatusAction
198
+ * -----------------------------------------------------------------------------------------------*/ const AITranslationStatusIcon = styledComponents.styled(designSystem.Status)`
199
+ display: flex;
200
+ gap: ${({ theme })=>theme.spaces[1]};
201
+ justify-content: center;
202
+ align-items: center;
203
+ height: 100%;
204
+
205
+ // Disabled state
206
+ ${({ $isAISettingEnabled, theme })=>!$isAISettingEnabled && `
207
+ background-color: ${theme.colors.neutral150};
208
+ `}
209
+
210
+ svg {
211
+ ${({ $isAISettingEnabled, theme })=>!$isAISettingEnabled && `
212
+ fill: ${theme.colors.neutral300};
213
+ `}
214
+ }
215
+ `;
216
+ const AITranslationStatusAction = ({ documentId, model, collectionType })=>{
217
+ const { formatMessage } = reactIntl.useIntl();
218
+ const isAIAvailable = ee.useAIAvailability();
219
+ const { data: settings$1 } = settings.useGetSettingsQuery();
220
+ const isAISettingEnabled = settings$1?.data?.aiLocalizations;
221
+ const { hasI18n } = useI18n.useI18n();
222
+ // Poll for AI localizations jobs when AI is enabled and we have a documentId
223
+ const { status } = useAILocalizationJobsPolling.useAILocalizationJobsPolling({
224
+ documentId,
225
+ model,
226
+ collectionType
227
+ });
228
+ const statusVariant = (()=>{
229
+ if (status === 'failed') {
230
+ return 'warning';
231
+ }
232
+ if (isAISettingEnabled) {
233
+ return 'alternative';
234
+ }
235
+ return 'neutral';
236
+ })();
237
+ // Do not display this action when i18n is not available
238
+ if (!hasI18n) {
239
+ return null;
240
+ }
241
+ // Do not display this action when AI is not available
242
+ const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');
243
+ if (!isAIAvailable || !hasAIFutureFlag) {
244
+ return null;
245
+ }
246
+ return {
247
+ status: {
248
+ message: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
249
+ height: "100%",
250
+ "aria-label": formatMessage({
251
+ id: getTranslation.getTranslation('CMEditViewAITranslation.status-aria-label'),
252
+ defaultMessage: 'AI Translation Status'
253
+ }),
254
+ children: /*#__PURE__*/ jsxRuntime.jsx(AITranslationStatusIcon, {
255
+ $isAISettingEnabled: Boolean(isAISettingEnabled),
256
+ variant: statusVariant,
257
+ size: "S",
258
+ children: /*#__PURE__*/ jsxRuntime.jsx(icons.Sparkle, {})
259
+ })
260
+ }),
261
+ tooltip: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
262
+ direction: "column",
263
+ padding: 4,
264
+ alignItems: "flex-start",
265
+ width: "25rem",
266
+ children: [
267
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
268
+ variant: "pi",
269
+ fontWeight: "600",
270
+ children: formatMessage({
271
+ id: getTranslation.getTranslation('CMEditViewAITranslation.status-title'),
272
+ defaultMessage: '{enabled, select, true {AI translation enabled} false {AI translation disabled} other {AI translation disabled}}'
273
+ }, {
274
+ enabled: isAISettingEnabled
275
+ })
276
+ }),
277
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
278
+ variant: "pi",
279
+ paddingTop: 1,
280
+ paddingBottom: 3,
281
+ children: formatMessage({
282
+ id: getTranslation.getTranslation('CMEditViewAITranslation.status-description'),
283
+ defaultMessage: 'Our AI translates content in all locales each time you save a modification.'
284
+ })
285
+ }),
286
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Link, {
287
+ fontSize: "inherit",
288
+ tag: reactRouterDom.NavLink,
289
+ to: "/settings/internationalization",
290
+ style: {
291
+ alignSelf: 'flex-end'
292
+ },
293
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
294
+ variant: "pi",
295
+ textAlign: "right",
296
+ children: formatMessage({
297
+ id: getTranslation.getTranslation('CMEditViewAITranslation.settings-link'),
298
+ defaultMessage: '{enabled, select, true {Disable it in settings} false {Enable it in settings} other {Enable it in settings}}'
299
+ }, {
300
+ enabled: isAISettingEnabled
301
+ })
302
+ })
303
+ })
304
+ ]
305
+ })
306
+ }
307
+ };
308
+ };
309
+ /* -------------------------------------------------------------------------------------------------
310
+ * FillFromAnotherLocaleAction
311
+ * -----------------------------------------------------------------------------------------------*/ const FillFromAnotherLocaleAction = ({ documentId, meta, model, collectionType })=>{
312
+ const { formatMessage } = reactIntl.useIntl();
313
+ const [{ query }] = strapiAdmin.useQueryParams();
314
+ const { hasI18n } = useI18n.useI18n();
315
+ const currentDesiredLocale = query.plugins?.i18n?.locale;
316
+ const [localeSelected, setLocaleSelected] = React__namespace.useState(null);
317
+ const setValues = strapiAdmin.useForm('FillFromAnotherLocale', (state)=>state.setValues);
318
+ const { getDocument } = strapiAdmin$1.unstable_useDocumentActions();
319
+ const { schema, components } = strapiAdmin$1.unstable_useDocument({
320
+ model,
321
+ documentId,
322
+ collectionType,
323
+ params: {
324
+ locale: currentDesiredLocale
325
+ }
326
+ });
327
+ const { data: locales$1 = [] } = locales.useGetLocalesQuery();
328
+ const isAIAvailable = ee.useAIAvailability();
329
+ const { data: settings$1 } = settings.useGetSettingsQuery();
330
+ const isAISettingEnabled = settings$1?.data?.aiLocalizations;
331
+ const availableLocales = Array.isArray(locales$1) ? locales$1.filter((locale)=>meta?.availableLocales.some((l)=>l.locale === locale.code)) : [];
332
+ const fillFromLocale = (onClose)=>async ()=>{
333
+ const response = await getDocument({
334
+ collectionType,
335
+ model,
336
+ documentId,
337
+ params: {
338
+ locale: localeSelected
339
+ }
340
+ });
341
+ if (!response || !schema) {
342
+ return;
343
+ }
344
+ const { data } = response;
345
+ const cleanedData = clean.cleanData(data, schema, components);
346
+ setValues(cleanedData);
347
+ onClose();
348
+ };
349
+ if (!hasI18n) {
350
+ return null;
351
+ }
352
+ // Do not display this action when AI is available and AI translations are enabled
353
+ const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');
354
+ if (hasAIFutureFlag && isAIAvailable && isAISettingEnabled) {
355
+ return null;
356
+ }
357
+ return {
358
+ type: 'icon',
359
+ icon: /*#__PURE__*/ jsxRuntime.jsx(icons.Earth, {}),
360
+ disabled: availableLocales.length === 0,
361
+ label: formatMessage({
362
+ id: getTranslation.getTranslation('CMEditViewCopyLocale.copy-text'),
363
+ defaultMessage: 'Fill in from another locale'
364
+ }),
365
+ dialog: {
366
+ type: 'dialog',
367
+ title: formatMessage({
368
+ id: getTranslation.getTranslation('CMEditViewCopyLocale.dialog.title'),
369
+ defaultMessage: 'Confirmation'
370
+ }),
371
+ content: ({ onClose })=>/*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
372
+ children: [
373
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Body, {
374
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
375
+ direction: "column",
376
+ gap: 3,
377
+ children: [
378
+ /*#__PURE__*/ jsxRuntime.jsx(icons.WarningCircle, {
379
+ width: "24px",
380
+ height: "24px",
381
+ fill: "danger600"
382
+ }),
383
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
384
+ textAlign: "center",
385
+ children: formatMessage({
386
+ id: getTranslation.getTranslation('CMEditViewCopyLocale.dialog.body'),
387
+ defaultMessage: 'Your current content will be erased and filled by the content of the selected locale:'
388
+ })
389
+ }),
390
+ /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Field.Root, {
391
+ width: "100%",
392
+ children: [
393
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Label, {
394
+ children: formatMessage({
395
+ id: getTranslation.getTranslation('CMEditViewCopyLocale.dialog.field.label'),
396
+ defaultMessage: 'Locale'
397
+ })
398
+ }),
399
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelect, {
400
+ value: localeSelected,
401
+ placeholder: formatMessage({
402
+ id: getTranslation.getTranslation('CMEditViewCopyLocale.dialog.field.placeholder'),
403
+ defaultMessage: 'Select one locale...'
404
+ }),
405
+ // @ts-expect-error – the DS will handle numbers, but we're not allowing the API.
406
+ onChange: (value)=>setLocaleSelected(value),
407
+ children: availableLocales.map((locale)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
408
+ value: locale.code,
409
+ children: locale.name
410
+ }, locale.code))
411
+ })
412
+ ]
413
+ })
414
+ ]
415
+ })
416
+ }),
417
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Footer, {
418
+ children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
419
+ gap: 2,
420
+ width: "100%",
421
+ children: [
422
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
423
+ flex: "auto",
424
+ variant: "tertiary",
425
+ onClick: onClose,
426
+ children: formatMessage({
427
+ id: getTranslation.getTranslation('CMEditViewCopyLocale.cancel-text'),
428
+ defaultMessage: 'No, cancel'
429
+ })
430
+ }),
431
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
432
+ flex: "auto",
433
+ variant: "success",
434
+ onClick: fillFromLocale(onClose),
435
+ children: formatMessage({
436
+ id: getTranslation.getTranslation('CMEditViewCopyLocale.submit-text'),
437
+ defaultMessage: 'Yes, fill in'
438
+ })
439
+ })
440
+ ]
441
+ })
442
+ })
443
+ ]
444
+ })
445
+ }
446
+ };
447
+ };
448
+ /* -------------------------------------------------------------------------------------------------
449
+ * DeleteLocaleAction
450
+ * -----------------------------------------------------------------------------------------------*/ const DeleteLocaleAction = ({ document, documentId, model, collectionType })=>{
451
+ const { formatMessage } = reactIntl.useIntl();
452
+ const navigate = reactRouterDom.useNavigate();
453
+ const { toggleNotification } = strapiAdmin.useNotification();
454
+ const { delete: deleteAction, isLoading } = strapiAdmin$1.unstable_useDocumentActions();
455
+ const { hasI18n, canDelete } = useI18n.useI18n();
456
+ // Get the current locale object, using the URL instead of document so it works while creating
457
+ const [{ query }] = strapiAdmin.useQueryParams();
458
+ const { data: locales$1 = [] } = locales.useGetLocalesQuery();
459
+ const currentDesiredLocale = query.plugins?.i18n?.locale;
460
+ const locale = !('error' in locales$1) && locales$1.find((loc)=>loc.code === currentDesiredLocale);
461
+ if (!hasI18n) {
462
+ return null;
463
+ }
464
+ return {
465
+ disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
466
+ position: [
467
+ 'header',
468
+ 'table-row'
469
+ ],
470
+ label: formatMessage({
471
+ id: getTranslation.getTranslation('actions.delete.label'),
472
+ defaultMessage: 'Delete entry ({locale})'
473
+ }, {
474
+ locale: locale && locale.name
475
+ }),
476
+ icon: /*#__PURE__*/ jsxRuntime.jsx(StyledTrash, {}),
477
+ variant: 'danger',
478
+ dialog: {
479
+ type: 'dialog',
480
+ title: formatMessage({
481
+ id: getTranslation.getTranslation('actions.delete.dialog.title'),
482
+ defaultMessage: 'Confirmation'
483
+ }),
484
+ content: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
485
+ direction: "column",
486
+ gap: 2,
487
+ children: [
488
+ /*#__PURE__*/ jsxRuntime.jsx(icons.WarningCircle, {
489
+ width: "24px",
490
+ height: "24px",
491
+ fill: "danger600"
492
+ }),
493
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
494
+ tag: "p",
495
+ variant: "omega",
496
+ textAlign: "center",
497
+ children: formatMessage({
498
+ id: getTranslation.getTranslation('actions.delete.dialog.body'),
499
+ defaultMessage: 'Are you sure?'
500
+ })
501
+ })
502
+ ]
503
+ }),
504
+ loading: isLoading,
505
+ onConfirm: async ()=>{
506
+ const unableToDelete = // We are unable to delete a collection type without a document ID
507
+ // & unable to delete generally if there is no document locale
508
+ collectionType !== 'single-types' && !documentId || !document?.locale;
509
+ if (unableToDelete) {
510
+ console.error("You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue.");
511
+ toggleNotification({
512
+ message: formatMessage({
513
+ id: getTranslation.getTranslation('actions.delete.error'),
514
+ defaultMessage: 'An error occurred while trying to delete the document locale.'
515
+ }),
516
+ type: 'danger'
517
+ });
518
+ return;
519
+ }
520
+ const res = await deleteAction({
521
+ documentId,
522
+ model,
523
+ collectionType,
524
+ params: {
525
+ locale: document.locale
526
+ }
527
+ });
528
+ if (!('error' in res)) {
529
+ navigate({
530
+ pathname: `../${collectionType}/${model}`
531
+ }, {
532
+ replace: true
533
+ });
534
+ }
535
+ }
536
+ }
537
+ };
538
+ };
539
+ /* -------------------------------------------------------------------------------------------------
540
+ * BulkLocaleAction
541
+ *
542
+ * This component is used to handle bulk publish and unpublish actions on locales.
543
+ * -----------------------------------------------------------------------------------------------*/ const BulkLocaleAction = ({ document, documentId, model, collectionType, action })=>{
544
+ const locale = document?.locale ?? null;
545
+ const [{ query: query$1 }] = strapiAdmin.useQueryParams();
546
+ const params = React__namespace.useMemo(()=>strapiAdmin$1.buildValidParams(query$1), [
547
+ query$1
548
+ ]);
549
+ const isOnPublishedTab = query$1.status === 'published';
550
+ const { formatMessage } = reactIntl.useIntl();
551
+ const { hasI18n, canPublish } = useI18n.useI18n();
552
+ const { toggleNotification } = strapiAdmin.useNotification();
553
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
554
+ const [selectedRows, setSelectedRows] = React__namespace.useState([]);
555
+ const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] = React__namespace.useState(false);
556
+ const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } = strapiAdmin$1.unstable_useDocumentActions();
557
+ const { schema, validate } = strapiAdmin$1.unstable_useDocument({
558
+ model,
559
+ collectionType,
560
+ documentId,
561
+ params: {
562
+ locale
563
+ }
564
+ }, {
565
+ // No need to fetch the document, the data is already available in the `document` prop
566
+ skip: true
567
+ });
568
+ const { data: localesMetadata = [] } = locales.useGetLocalesQuery(hasI18n ? undefined : query.skipToken);
569
+ const headers = [
570
+ {
571
+ label: formatMessage({
572
+ id: 'global.name',
573
+ defaultMessage: 'Name'
574
+ }),
575
+ name: 'name'
576
+ },
577
+ {
578
+ label: formatMessage({
579
+ id: getTranslation.getTranslation('CMEditViewBulkLocale.status'),
580
+ defaultMessage: 'Status'
581
+ }),
582
+ name: 'status'
583
+ },
584
+ {
585
+ label: formatMessage({
586
+ id: getTranslation.getTranslation('CMEditViewBulkLocale.publication-status'),
587
+ defaultMessage: 'Publication Status'
588
+ }),
589
+ name: 'publication-status'
590
+ }
591
+ ];
592
+ // Extract the rows for the bulk locale publish modal and any validation
593
+ // errors per locale
594
+ const [rows, validationErrors] = React__namespace.useMemo(()=>{
595
+ if (!document) {
596
+ return [
597
+ [],
598
+ {}
599
+ ];
600
+ }
601
+ const localizations = document.localizations ?? [];
602
+ // Build the rows for the bulk locale publish modal by combining the current
603
+ // document with all the available locales from the document meta
604
+ const locales = localizations.map((doc)=>{
605
+ const { locale, status } = doc;
606
+ return {
607
+ locale,
608
+ status
609
+ };
610
+ });
611
+ // Add the current document locale
612
+ locales.unshift({
613
+ locale: document.locale,
614
+ status: document.status
615
+ });
616
+ // Build the validation errors for each locale.
617
+ const allDocuments = [
618
+ document,
619
+ ...localizations
620
+ ];
621
+ const errors = allDocuments.reduce((errs, document)=>{
622
+ if (!document) {
623
+ return errs;
624
+ }
625
+ // Validate each locale entry via the useDocument validate function and store any errors in a dictionary
626
+ const validation = validate(document);
627
+ if (validation !== null) {
628
+ errs[document.locale] = validation;
629
+ }
630
+ return errs;
631
+ }, {});
632
+ return [
633
+ locales,
634
+ errors
635
+ ];
636
+ }, [
637
+ document,
638
+ validate
639
+ ]);
640
+ const isBulkPublish = action === 'bulk-publish';
641
+ const localesForAction = selectedRows.reduce((acc, selectedRow)=>{
642
+ const isValidLocale = // Validation errors are irrelevant if we are trying to unpublish
643
+ !isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale);
644
+ const shouldAddLocale = isBulkPublish ? selectedRow.status !== 'published' && isValidLocale : selectedRow.status !== 'draft' && isValidLocale;
645
+ if (shouldAddLocale) {
646
+ acc.push(selectedRow.locale);
647
+ }
648
+ return acc;
649
+ }, []);
650
+ // TODO skipping this for now as there is a bug with the draft relation count that will be worked on separately
651
+ // see https://www.notion.so/strapi/Count-draft-relations-56901b492efb45ab90d42fe975b32bd8?pvs=4
652
+ const enableDraftRelationsCount = false;
653
+ const { data: draftRelationsCount = 0, isLoading: isDraftRelationsLoading, error: isDraftRelationsError } = relations.useGetManyDraftRelationCountQuery({
654
+ model,
655
+ documentIds: [
656
+ documentId
657
+ ],
658
+ locale: localesForAction
659
+ }, {
660
+ skip: !enableDraftRelationsCount
661
+ });
662
+ React__namespace.useEffect(()=>{
663
+ if (isDraftRelationsError) {
664
+ toggleNotification({
665
+ type: 'danger',
666
+ message: formatAPIError(isDraftRelationsError)
667
+ });
668
+ }
669
+ }, [
670
+ isDraftRelationsError,
671
+ toggleNotification,
672
+ formatAPIError
673
+ ]);
674
+ if (!schema?.options?.draftAndPublish) {
675
+ return null;
676
+ }
677
+ if (!hasI18n) {
678
+ return null;
679
+ }
680
+ if (!documentId) {
681
+ return null;
682
+ }
683
+ // This document action can be enabled given that draft and publish and i18n are
684
+ // enabled and we can publish the current locale.
685
+ const publish = async ()=>{
686
+ await publishManyAction({
687
+ model,
688
+ documentIds: [
689
+ documentId
690
+ ],
691
+ params: {
692
+ ...params,
693
+ locale: localesForAction
694
+ }
695
+ });
696
+ setSelectedRows([]);
697
+ };
698
+ const unpublish = async ()=>{
699
+ await unpublishManyAction({
700
+ model,
701
+ documentIds: [
702
+ documentId
703
+ ],
704
+ params: {
705
+ ...params,
706
+ locale: localesForAction
707
+ }
708
+ });
709
+ setSelectedRows([]);
710
+ };
711
+ const handleAction = async ()=>{
712
+ if (draftRelationsCount > 0) {
713
+ setIsDraftRelationConfirmationOpen(true);
714
+ } else if (isBulkPublish) {
715
+ await publish();
716
+ } else {
717
+ await unpublish();
718
+ }
719
+ };
720
+ if (isDraftRelationConfirmationOpen) {
721
+ return {
722
+ label: formatMessage({
723
+ id: 'app.components.ConfirmDialog.title',
724
+ defaultMessage: 'Confirmation'
725
+ }),
726
+ variant: 'danger',
727
+ dialog: {
728
+ onCancel: ()=>{
729
+ setIsDraftRelationConfirmationOpen(false);
730
+ },
731
+ onConfirm: async ()=>{
732
+ await publish();
733
+ setIsDraftRelationConfirmationOpen(false);
734
+ },
735
+ type: 'dialog',
736
+ title: formatMessage({
737
+ id: getTranslation.getTranslation('actions.publish.dialog.title'),
738
+ defaultMessage: 'Confirmation'
739
+ }),
740
+ content: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
741
+ direction: "column",
742
+ alignItems: "center",
743
+ gap: 2,
744
+ children: [
745
+ /*#__PURE__*/ jsxRuntime.jsx(icons.WarningCircle, {
746
+ width: "2.4rem",
747
+ height: "2.4rem",
748
+ fill: "danger600"
749
+ }),
750
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
751
+ textAlign: "center",
752
+ children: formatMessage({
753
+ id: getTranslation.getTranslation('CMEditViewBulkLocale.draft-relation-warning'),
754
+ defaultMessage: 'Some locales are related to draft entries. Publishing them could leave broken links in your app.'
755
+ })
756
+ }),
757
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
758
+ textAlign: "center",
759
+ children: formatMessage({
760
+ id: getTranslation.getTranslation('CMEditViewBulkLocale.continue-confirmation'),
761
+ defaultMessage: 'Are you sure you want to continue?'
762
+ })
763
+ })
764
+ ]
765
+ })
766
+ }
767
+ };
768
+ }
769
+ const hasPermission = selectedRows.map(({ locale })=>locale).every((locale)=>canPublish.includes(locale));
770
+ return {
771
+ label: formatMessage({
772
+ id: getTranslation.getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),
773
+ defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`
774
+ }),
775
+ variant: isBulkPublish ? 'secondary' : 'danger',
776
+ icon: isBulkPublish ? /*#__PURE__*/ jsxRuntime.jsx(icons.ListPlus, {}) : /*#__PURE__*/ jsxRuntime.jsx(icons.Cross, {}),
777
+ disabled: isOnPublishedTab || canPublish.length === 0,
778
+ position: [
779
+ 'panel'
780
+ ],
781
+ dialog: {
782
+ type: 'modal',
783
+ title: formatMessage({
784
+ id: getTranslation.getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),
785
+ defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`
786
+ }),
787
+ content: ()=>{
788
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Table.Root, {
789
+ headers: headers,
790
+ rows: rows.map((row)=>({
791
+ ...row,
792
+ id: row.locale
793
+ })),
794
+ selectedRows: selectedRows,
795
+ onSelectedRowsChange: (tableSelectedRows)=>setSelectedRows(tableSelectedRows),
796
+ children: /*#__PURE__*/ jsxRuntime.jsx(BulkLocaleActionModal.BulkLocaleActionModal, {
797
+ validationErrors: validationErrors,
798
+ headers: headers,
799
+ rows: rows,
800
+ localesMetadata: localesMetadata,
801
+ action: action ?? 'bulk-publish'
802
+ })
803
+ });
804
+ },
805
+ footer: ()=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Footer, {
806
+ justifyContent: "flex-end",
807
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
808
+ loading: isDraftRelationsLoading,
809
+ disabled: !hasPermission || localesForAction.length === 0,
810
+ variant: "default",
811
+ onClick: handleAction,
812
+ children: formatMessage({
813
+ id: isBulkPublish ? 'app.utils.publish' : 'app.utils.unpublish',
814
+ defaultMessage: isBulkPublish ? 'Publish' : 'Unpublish'
815
+ })
816
+ })
817
+ })
818
+ }
819
+ };
820
+ };
821
+ /* -------------------------------------------------------------------------------------------------
822
+ * BulkLocalePublishAction
823
+ * -----------------------------------------------------------------------------------------------*/ const BulkLocalePublishAction = (props)=>{
824
+ return BulkLocaleAction({
825
+ action: 'bulk-publish',
826
+ ...props
827
+ });
828
+ };
829
+ /* -------------------------------------------------------------------------------------------------
830
+ * BulkLocaleUnpublishAction
831
+ * -----------------------------------------------------------------------------------------------*/ const BulkLocaleUnpublishAction = (props)=>{
832
+ return BulkLocaleAction({
833
+ action: 'bulk-unpublish',
834
+ ...props
835
+ });
836
+ };
837
+ /**
838
+ * Because the icon system is completely broken, we have to do
839
+ * this to remove the fill from the cog.
840
+ */ const StyledTrash = styledComponents.styled(icons.Trash)`
841
+ path {
842
+ fill: currentColor;
843
+ }
844
+ `;
845
+
846
+ exports.AITranslationStatusAction = AITranslationStatusAction;
847
+ exports.BulkLocalePublishAction = BulkLocalePublishAction;
848
+ exports.BulkLocaleUnpublishAction = BulkLocaleUnpublishAction;
849
+ exports.DeleteLocaleAction = DeleteLocaleAction;
850
+ exports.FillFromAnotherLocaleAction = FillFromAnotherLocaleAction;
851
+ exports.LocalePickerAction = LocalePickerAction;
852
+ //# sourceMappingURL=CMHeaderActions.js.map