@strapi/i18n 0.0.0-next.820adfc37c687bbcc4a213ae6929c541358b71e8 → 0.0.0-next.83367b80833204c0744701aef452a8d8d2ce25b6

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