@strapi/i18n 0.0.0-next.80103017ad0134c4681c5b742cfd24091a839446 → 0.0.0-next.807d2d1373c0c4b2c9c8a23debef0bf1b6af5fc1

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