@strapi/i18n 0.0.0-next.959c5589d0d3efa25d7ca014656d9ff48c173399 → 0.0.0-next.96a532b33a712f19b498ed0a82a84752247cd899

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