@strapi/i18n 0.0.0-next.d8f8da8f5b333be4a20563a1a15cd61350139956 → 0.0.0-next.da19c0501ff87d14fb664b55b8e0630d3c548485

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 (189) hide show
  1. package/dist/admin/components/CMHeaderActions.js +132 -1
  2. package/dist/admin/components/CMHeaderActions.js.map +1 -1
  3. package/dist/admin/components/CMHeaderActions.mjs +135 -5
  4. package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
  5. package/dist/admin/components/CreateLocale.js +1 -1
  6. package/dist/admin/components/CreateLocale.js.map +1 -1
  7. package/dist/admin/components/CreateLocale.mjs +1 -1
  8. package/dist/admin/components/CreateLocale.mjs.map +1 -1
  9. package/dist/admin/components/EditLocale.js +1 -1
  10. package/dist/admin/components/EditLocale.js.map +1 -1
  11. package/dist/admin/components/EditLocale.mjs +1 -1
  12. package/dist/admin/components/EditLocale.mjs.map +1 -1
  13. package/dist/admin/components/LocaleListCell.js +65 -45
  14. package/dist/admin/components/LocaleListCell.js.map +1 -1
  15. package/dist/admin/components/LocaleListCell.mjs +66 -46
  16. package/dist/admin/components/LocaleListCell.mjs.map +1 -1
  17. package/dist/admin/components/LocalePicker.js +18 -11
  18. package/dist/admin/components/LocalePicker.js.map +1 -1
  19. package/dist/admin/components/LocalePicker.mjs +19 -12
  20. package/dist/admin/components/LocalePicker.mjs.map +1 -1
  21. package/dist/admin/contentManagerHooks/editView.js +6 -3
  22. package/dist/admin/contentManagerHooks/editView.js.map +1 -1
  23. package/dist/admin/contentManagerHooks/editView.mjs +7 -4
  24. package/dist/admin/contentManagerHooks/editView.mjs.map +1 -1
  25. package/dist/admin/contentManagerHooks/listView.js +2 -1
  26. package/dist/admin/contentManagerHooks/listView.js.map +1 -1
  27. package/dist/admin/contentManagerHooks/listView.mjs +2 -1
  28. package/dist/admin/contentManagerHooks/listView.mjs.map +1 -1
  29. package/dist/admin/hooks/useAILocalizationJobsPolling.js +91 -0
  30. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  31. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +70 -0
  32. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  33. package/dist/admin/index.js +1 -1
  34. package/dist/admin/index.js.map +1 -1
  35. package/dist/admin/index.mjs +2 -2
  36. package/dist/admin/index.mjs.map +1 -1
  37. package/dist/admin/middlewares/extendCTBAttributeInitialData.js +34 -24
  38. package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -1
  39. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +34 -24
  40. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -1
  41. package/dist/admin/pages/SettingsPage.js +121 -46
  42. package/dist/admin/pages/SettingsPage.js.map +1 -1
  43. package/dist/admin/pages/SettingsPage.mjs +124 -30
  44. package/dist/admin/pages/SettingsPage.mjs.map +1 -1
  45. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  46. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  47. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  48. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  49. package/dist/admin/services/api.js +4 -1
  50. package/dist/admin/services/api.js.map +1 -1
  51. package/dist/admin/services/api.mjs +4 -1
  52. package/dist/admin/services/api.mjs.map +1 -1
  53. package/dist/admin/services/locales.js +4 -2
  54. package/dist/admin/services/locales.js.map +1 -1
  55. package/dist/admin/services/locales.mjs +4 -2
  56. package/dist/admin/services/locales.mjs.map +1 -1
  57. package/dist/admin/services/settings.js +29 -0
  58. package/dist/admin/services/settings.js.map +1 -0
  59. package/dist/admin/services/settings.mjs +26 -0
  60. package/dist/admin/services/settings.mjs.map +1 -0
  61. package/dist/admin/src/components/CMHeaderActions.d.ts +7 -1
  62. package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
  63. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  64. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  65. package/dist/admin/src/services/api.d.ts +1 -1
  66. package/dist/admin/src/services/locales.d.ts +1 -1
  67. package/dist/admin/src/services/relations.d.ts +1 -1
  68. package/dist/admin/src/services/settings.d.ts +5 -0
  69. package/dist/admin/src/utils/schemas.d.ts +642 -16
  70. package/dist/admin/translations/en.json.js +9 -0
  71. package/dist/admin/translations/en.json.js.map +1 -1
  72. package/dist/admin/translations/en.json.mjs +9 -0
  73. package/dist/admin/translations/en.json.mjs.map +1 -1
  74. package/dist/admin/utils/clean.js +2 -2
  75. package/dist/admin/utils/clean.js.map +1 -1
  76. package/dist/admin/utils/clean.mjs +2 -2
  77. package/dist/admin/utils/clean.mjs.map +1 -1
  78. package/dist/admin/utils/fields.js +6 -1
  79. package/dist/admin/utils/fields.js.map +1 -1
  80. package/dist/admin/utils/fields.mjs +6 -1
  81. package/dist/admin/utils/fields.mjs.map +1 -1
  82. package/dist/admin/utils/schemas.js +19 -13
  83. package/dist/admin/utils/schemas.js.map +1 -1
  84. package/dist/admin/utils/schemas.mjs +19 -13
  85. package/dist/admin/utils/schemas.mjs.map +1 -1
  86. package/dist/server/bootstrap.js +2 -0
  87. package/dist/server/bootstrap.js.map +1 -1
  88. package/dist/server/bootstrap.mjs +2 -0
  89. package/dist/server/bootstrap.mjs.map +1 -1
  90. package/dist/server/constants/iso-locales.json.js +4 -0
  91. package/dist/server/constants/iso-locales.json.js.map +1 -1
  92. package/dist/server/constants/iso-locales.json.mjs +4 -0
  93. package/dist/server/constants/iso-locales.json.mjs.map +1 -1
  94. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  95. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  96. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  97. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  98. package/dist/server/controllers/index.js +5 -1
  99. package/dist/server/controllers/index.js.map +1 -1
  100. package/dist/server/controllers/index.mjs +5 -1
  101. package/dist/server/controllers/index.mjs.map +1 -1
  102. package/dist/server/controllers/settings.js +24 -0
  103. package/dist/server/controllers/settings.js.map +1 -0
  104. package/dist/server/controllers/settings.mjs +22 -0
  105. package/dist/server/controllers/settings.mjs.map +1 -0
  106. package/dist/server/models/ai-localization-job.js +60 -0
  107. package/dist/server/models/ai-localization-job.js.map +1 -0
  108. package/dist/server/models/ai-localization-job.mjs +57 -0
  109. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  110. package/dist/server/register.js +3 -1
  111. package/dist/server/register.js.map +1 -1
  112. package/dist/server/register.mjs +3 -1
  113. package/dist/server/register.mjs.map +1 -1
  114. package/dist/server/routes/admin.js +40 -0
  115. package/dist/server/routes/admin.js.map +1 -1
  116. package/dist/server/routes/admin.mjs +40 -0
  117. package/dist/server/routes/admin.mjs.map +1 -1
  118. package/dist/server/routes/content-api.js +11 -7
  119. package/dist/server/routes/content-api.js.map +1 -1
  120. package/dist/server/routes/content-api.mjs +11 -7
  121. package/dist/server/routes/content-api.mjs.map +1 -1
  122. package/dist/server/routes/index.mjs +2 -2
  123. package/dist/server/routes/validation/locale.js +57 -0
  124. package/dist/server/routes/validation/locale.js.map +1 -0
  125. package/dist/server/routes/validation/locale.mjs +36 -0
  126. package/dist/server/routes/validation/locale.mjs.map +1 -0
  127. package/dist/server/services/ai-localization-jobs.js +64 -0
  128. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  129. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  130. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  131. package/dist/server/services/ai-localizations.js +210 -0
  132. package/dist/server/services/ai-localizations.js.map +1 -0
  133. package/dist/server/services/ai-localizations.mjs +208 -0
  134. package/dist/server/services/ai-localizations.mjs.map +1 -0
  135. package/dist/server/services/index.js +7 -1
  136. package/dist/server/services/index.js.map +1 -1
  137. package/dist/server/services/index.mjs +7 -1
  138. package/dist/server/services/index.mjs.map +1 -1
  139. package/dist/server/services/settings.js +25 -0
  140. package/dist/server/services/settings.js.map +1 -0
  141. package/dist/server/services/settings.mjs +23 -0
  142. package/dist/server/services/settings.mjs.map +1 -0
  143. package/dist/server/src/bootstrap.d.ts.map +1 -1
  144. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  145. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  146. package/dist/server/src/controllers/index.d.ts +10 -0
  147. package/dist/server/src/controllers/index.d.ts.map +1 -1
  148. package/dist/server/src/controllers/settings.d.ts +7 -0
  149. package/dist/server/src/controllers/settings.d.ts.map +1 -0
  150. package/dist/server/src/index.d.ts +47 -8
  151. package/dist/server/src/index.d.ts.map +1 -1
  152. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  153. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  154. package/dist/server/src/models/index.d.ts +5 -0
  155. package/dist/server/src/models/index.d.ts.map +1 -0
  156. package/dist/server/src/register.d.ts +1 -1
  157. package/dist/server/src/register.d.ts.map +1 -1
  158. package/dist/server/src/routes/admin.d.ts.map +1 -1
  159. package/dist/server/src/routes/content-api.d.ts +5 -8
  160. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  161. package/dist/server/src/routes/index.d.ts +3 -7
  162. package/dist/server/src/routes/index.d.ts.map +1 -1
  163. package/dist/server/src/routes/validation/index.d.ts +2 -0
  164. package/dist/server/src/routes/validation/index.d.ts.map +1 -0
  165. package/dist/server/src/routes/validation/locale.d.ts +41 -0
  166. package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
  167. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  168. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  169. package/dist/server/src/services/ai-localizations.d.ts +18 -0
  170. package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
  171. package/dist/server/src/services/index.d.ts +33 -0
  172. package/dist/server/src/services/index.d.ts.map +1 -1
  173. package/dist/server/src/services/settings.d.ts +13 -0
  174. package/dist/server/src/services/settings.d.ts.map +1 -0
  175. package/dist/server/src/utils/index.d.ts +7 -1
  176. package/dist/server/src/utils/index.d.ts.map +1 -1
  177. package/dist/server/src/validation/settings.d.ts +12 -0
  178. package/dist/server/src/validation/settings.d.ts.map +1 -0
  179. package/dist/server/utils/index.js.map +1 -1
  180. package/dist/server/utils/index.mjs.map +1 -1
  181. package/dist/server/validation/settings.js +11 -0
  182. package/dist/server/validation/settings.js.map +1 -0
  183. package/dist/server/validation/settings.mjs +9 -0
  184. package/dist/server/validation/settings.mjs.map +1 -0
  185. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  186. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  187. package/dist/shared/contracts/settings.d.ts +40 -0
  188. package/dist/shared/contracts/shared.d.ts.map +1 -0
  189. package/package.json +12 -9
@@ -1 +1 @@
1
- {"version":3,"file":"LocaleListCell.mjs","sources":["../../../admin/src/components/LocaleListCell.tsx"],"sourcesContent":["import { Box, Flex, Popover, Typography, useCollator, Button } from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { Locale } from '../../../shared/contracts/locales';\nimport { useGetLocalesQuery } from '../services/locales';\n\ninterface LocaleListCellProps {\n localizations: { locale: string }[];\n locale: string;\n}\n\nconst LocaleListCell = ({ locale: currentLocale, localizations }: LocaleListCellProps) => {\n const { locale: language } = useIntl();\n const { data: locales = [] } = useGetLocalesQuery();\n const formatter = useCollator(language, {\n sensitivity: 'base',\n });\n\n if (!Array.isArray(locales) || !localizations) {\n return null;\n }\n\n const availableLocales = localizations.map((loc) => loc.locale);\n\n const localesForDocument = locales\n .reduce<Locale[]>((acc, locale) => {\n const createdLocale = [currentLocale, ...availableLocales].find((loc) => {\n return loc === locale.code;\n });\n\n if (createdLocale) {\n acc.push(locale);\n }\n\n return acc;\n }, [])\n .map((locale) => {\n if (locale.isDefault) {\n return `${locale.name} (default)`;\n }\n\n return locale.name;\n })\n .toSorted((a, b) => formatter.compare(a, b));\n\n return (\n <Popover.Root>\n <Popover.Trigger>\n <Button variant=\"ghost\" type=\"button\" onClick={(e) => e.stopPropagation()}>\n <Flex minWidth=\"100%\" alignItems=\"center\" justifyContent=\"center\" fontWeight=\"regular\">\n <Typography textColor=\"neutral800\" ellipsis marginRight={2}>\n {localesForDocument.join(', ')}\n </Typography>\n <Flex>\n <CaretDown width=\"1.2rem\" height=\"1.2rem\" />\n </Flex>\n </Flex>\n </Button>\n </Popover.Trigger>\n <Popover.Content sideOffset={16}>\n <ul>\n {localesForDocument.map((name) => (\n <Box key={name} padding={3} tag=\"li\">\n <Typography>{name}</Typography>\n </Box>\n ))}\n </ul>\n </Popover.Content>\n </Popover.Root>\n );\n};\n\nexport { LocaleListCell };\nexport type { LocaleListCellProps };\n"],"names":["LocaleListCell","locale","currentLocale","localizations","language","useIntl","data","locales","useGetLocalesQuery","formatter","useCollator","sensitivity","Array","isArray","availableLocales","map","loc","localesForDocument","reduce","acc","createdLocale","find","code","push","isDefault","name","toSorted","a","b","compare","_jsxs","Popover","Root","_jsx","Trigger","Button","variant","type","onClick","e","stopPropagation","Flex","minWidth","alignItems","justifyContent","fontWeight","Typography","textColor","ellipsis","marginRight","join","CaretDown","width","height","Content","sideOffset","ul","Box","padding","tag"],"mappings":";;;;;;AAYA,MAAMA,iBAAiB,CAAC,EAAEC,QAAQC,aAAa,EAAEC,aAAa,EAAuB,GAAA;AACnF,IAAA,MAAM,EAAEF,MAAAA,EAAQG,QAAQ,EAAE,GAAGC,OAAAA,EAAAA;AAC7B,IAAA,MAAM,EAAEC,IAAAA,EAAMC,OAAU,GAAA,EAAE,EAAE,GAAGC,kBAAAA,EAAAA;IAC/B,MAAMC,SAAAA,GAAYC,YAAYN,QAAU,EAAA;QACtCO,WAAa,EAAA;AACf,KAAA,CAAA;AAEA,IAAA,IAAI,CAACC,KAAMC,CAAAA,OAAO,CAACN,OAAAA,CAAAA,IAAY,CAACJ,aAAe,EAAA;QAC7C,OAAO,IAAA;A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cAAe,EAAA,QAAA;wBAASC,UAAW,EAAA,SAAA;;0CAC3EZ,GAACa,CAAAA,UAAAA,EAAAA;gCAAWC,SAAU,EAAA,YAAA;gCAAaC,QAAQ,EAAA,IAAA;gCAACC,WAAa,EAAA,CAAA;AACtDhC,gCAAAA,QAAAA,EAAAA,kBAAAA,CAAmBiC,IAAI,CAAC,IAAA;;0CAE3BjB,GAACQ,CAAAA,IAAAA,EAAAA;AACC,gCAAA,QAAA,gBAAAR,GAACkB,CAAAA,SAAAA,EAAAA;oCAAUC,KAAM,EAAA,QAAA;oCAASC,MAAO,EAAA;;;;;;;AAKzC,0BAAApB,GAAA,CAACF,QAAQuB,OAAO,EAAA;gBAACC,UAAY,EAAA,EAAA;AAC3B,gBAAA,QAAA,gBAAAtB,GAACuB,CAAAA,IAAAA,EAAAA;AACEvC,oBAAAA,QAAAA,EAAAA,kBAAAA,CAAmBF,GAAG,CAAC,CAACU,IAAAA,iBACvBQ,GAACwB,CAAAA,GAAAA,EAAAA;4BAAeC,OAAS,EAAA,CAAA;4BAAGC,GAAI,EAAA,IAAA;AAC9B,4BAAA,QAAA,gBAAA1B,GAACa,CAAAA,UAAAA,EAAAA;AAAYrB,gCAAAA,QAAAA,EAAAA;;AADLA,yBAAAA,EAAAA,IAAAA,CAAAA;;;;;AAQtB;;;;"}
1
+ {"version":3,"file":"LocaleListCell.mjs","sources":["../../../admin/src/components/LocaleListCell.tsx"],"sourcesContent":["import { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { Flex, Menu, Typography, useCollator } from '@strapi/design-system';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { useNavigate } from 'react-router-dom';\n\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface LocaleListCellProps {\n localizations: { locale: string }[];\n locale: string;\n documentId: string;\n}\n\nconst LocaleListCell = ({\n locale: currentLocale,\n localizations,\n documentId,\n}: LocaleListCellProps) => {\n const { locale: language, formatMessage } = useIntl();\n const { data: locales = [] } = useGetLocalesQuery();\n const navigate = useNavigate();\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const formatter = useCollator(language, {\n sensitivity: 'base',\n });\n\n if (!Array.isArray(locales) || !localizations) {\n return null;\n }\n\n const availableLocales = localizations.map((loc) => loc.locale);\n\n const localesForDocument = locales\n .reduce<Array<{ code: string; name: string }>>((acc, locale) => {\n const createdLocale = [currentLocale, ...availableLocales].find((loc) => {\n return loc === locale.code;\n });\n\n if (createdLocale) {\n const name = locale.isDefault ? `${locale.name} (default)` : locale.name;\n acc.push({ code: locale.code, name });\n }\n\n return acc;\n }, [])\n .toSorted((a, b) => formatter.compare(a.name, b.name));\n\n const getDisplayText = () => {\n const displayedLocales = localesForDocument.slice(0, 2);\n const remainingCount = localesForDocument.length - 2;\n\n const baseText = displayedLocales.map(({ name }) => name).join(', ');\n\n if (remainingCount <= 0) {\n return baseText;\n }\n\n return formatMessage(\n {\n id: getTranslation('CMListView.popover.display-locales.more'),\n defaultMessage: '{locales} + {count} more',\n },\n { locales: baseText, count: remainingCount }\n );\n };\n\n const handleLocaleClick = (localeCode: string) => {\n navigate({\n pathname: documentId,\n search: stringify({\n plugins: {\n ...query.plugins,\n i18n: { locale: localeCode },\n },\n }),\n });\n };\n\n return (\n <Menu.Root>\n <Menu.Trigger>\n <Flex minWidth=\"100%\" alignItems=\"center\" justifyContent=\"center\" fontWeight=\"regular\">\n <Typography textColor=\"neutral800\" ellipsis marginRight={2}>\n {getDisplayText()}\n </Typography>\n </Flex>\n </Menu.Trigger>\n <Menu.Content>\n {localesForDocument.map(({ code, name }) => (\n <Menu.Item\n key={code}\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n handleLocaleClick(code);\n }}\n >\n <Typography textColor=\"neutral800\" fontWeight=\"regular\">\n {name}\n </Typography>\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu.Root>\n );\n};\n\nexport { LocaleListCell };\nexport type { LocaleListCellProps };\n"],"names":["LocaleListCell","locale","currentLocale","localizations","documentId","language","formatMessage","useIntl","data","locales","useGetLocalesQuery","navigate","useNavigate","query","useQueryParams","formatter","useCollator","sensitivity","Array","isArray","availableLocales","map","loc","localesForDocument","reduce","acc","createdLocale","find","code","name","isDefault","push","toSorted","a","b","compare","getDisplayText","displayedLocales","slice","remainingCount","length","baseText","join","id","getTranslation","defaultMessage","count","handleLocaleClick","localeCode","pathname","search","stringify","plugins","i18n","_jsxs","Menu","Root","_jsx","Trigger","Flex","minWidth","alignItems","justifyContent","fontWeight","Typography","textColor","ellipsis","marginRight","Content","Item","onClick","e","stopPropagation"],"mappings":";;;;;;;;;AAiBMA,MAAAA,cAAAA,GAAiB,CAAC,EACtBC,MAAAA,EAAQC,aAAa,EACrBC,aAAa,EACbC,UAAU,EACU,GAAA;AACpB,IAAA,MAAM,EAAEH,MAAQI,EAAAA,QAAQ,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAC5C,IAAA,MAAM,EAAEC,IAAAA,EAAMC,OAAU,GAAA,EAAE,EAAE,GAAGC,kBAAAA,EAAAA;AAC/B,IAAA,MAAMC,QAAWC,GAAAA,WAAAA,EAAAA;AACjB,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,CAAC,GAAGC,cAAAA,EAAAA;IACpB,MAAMC,SAAAA,GAAYC,YAAYX,QAAU,EAAA;QACtCY,WAAa,EAAA;AACf,KAAA,CAAA;AAEA,IAAA,IAAI,CAACC,KAAMC,CAAAA,OAAO,CAACV,OAAAA,CAAAA,IAAY,CAACN,aAAe,EAAA;QAC7C,OAAO,IAAA;AACT;AAEA,IAAA,MAAMiB,mBAAmBjB,aAAckB,CAAAA,GAAG,CAAC,CAACC,GAAAA,GAAQA,IAAIrB,MAAM,CAAA;AAE9D,IAAA,MAAMsB,kBAAqBd,GAAAA,OAAAA,CACxBe,MAAM,CAAwC,CAACC,GAAKxB,EAAAA,MAAAA,GAAAA;AACnD,QAAA,MA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IAAAA,CAAAA;;;;AAcjB;;;;"}
@@ -68,16 +68,26 @@ const LocalePicker = ()=>{
68
68
  locales$1,
69
69
  query.plugins?.i18n?.locale
70
70
  ]);
71
+ const sortedLocaleOptions = React__namespace.useMemo(()=>{
72
+ const displayedLocales = Array.isArray(locales$1) ? locales$1.filter((locale)=>{
73
+ /**
74
+ * If you can create or read we allow you to see the locale exists
75
+ * this is because in the ListView, you may be able to create a new entry
76
+ * in a locale you can't read.
77
+ */ return canCreate.includes(locale.code) || canRead.includes(locale.code);
78
+ }) : [];
79
+ return displayedLocales.sort((a, b)=>a.name.localeCompare(b.name)).map((locale)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
80
+ value: locale.code,
81
+ children: locale.name
82
+ }, locale.id));
83
+ }, [
84
+ locales$1,
85
+ canCreate,
86
+ canRead
87
+ ]);
71
88
  if (!hasI18n || !Array.isArray(locales$1) || locales$1.length === 0) {
72
89
  return null;
73
90
  }
74
- const displayedLocales = locales$1.filter((locale)=>{
75
- /**
76
- * If you can create or read we allow you to see the locale exists
77
- * this is because in the ListView, you may be able to create a new entry
78
- * in a locale you can't read.
79
- */ return canCreate.includes(locale.code) || canRead.includes(locale.code);
80
- });
81
91
  return /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelect, {
82
92
  size: "S",
83
93
  "aria-label": formatMessage({
@@ -87,10 +97,7 @@ const LocalePicker = ()=>{
87
97
  value: query.plugins?.i18n?.locale || locales$1.find((locale)=>locale.isDefault)?.code,
88
98
  // @ts-expect-error – This can be removed in V2 of the DS.
89
99
  onChange: handleChange,
90
- children: displayedLocales.map((locale)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
91
- value: locale.code,
92
- children: locale.name
93
- }, locale.id))
100
+ children: sortedLocaleOptions
94
101
  });
95
102
  };
96
103
 
@@ -1 +1 @@
1
- {"version":3,"file":"LocalePicker.js","sources":["../../../admin/src/components/LocalePicker.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { SingleSelect, SingleSelectOption } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface Query extends I18nBaseQuery {\n page?: number;\n}\n\nconst LocalePicker = () => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<Query>();\n\n const { hasI18n, canRead, canCreate } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery(undefined, {\n skip: !hasI18n,\n });\n\n const handleChange = React.useCallback(\n (code: string, replace = false) => {\n setQuery(\n {\n page: 1,\n plugins: { ...query.plugins, i18n: { locale: code } },\n },\n 'push',\n replace\n );\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleChange(defaultLocale.code, true);\n }\n }, [hasI18n, handleChange, locales, query.plugins?.i18n?.locale]);\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n const displayedLocales = locales.filter((locale) => {\n /**\n * If you can create or read we allow you to see the locale exists\n * this is because in the ListView, you may be able to create a new entry\n * in a locale you can't read.\n */\n return canCreate.includes(locale.code) || canRead.includes(locale.code);\n });\n\n return (\n <SingleSelect\n size=\"S\"\n aria-label={formatMessage({\n id: getTranslation('actions.select-locale'),\n defaultMessage: 'Select locale',\n })}\n value={query.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code}\n // @ts-expect-error – This can be removed in V2 of the DS.\n onChange={handleChange}\n >\n {displayedLocales.map((locale) => (\n <SingleSelectOption key={locale.id} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n );\n};\n\nexport { LocalePicker };\n"],"names":["LocalePicker","formatMessage","useIntl","query","setQuery","useQueryParams","hasI18n","canRead","canCreate","useI18n","data","locales","useGetLocalesQuery","undefined","skip","handleChange","React","useCallback","code","replace","page","plugins","i18n","locale","useEffect","Array","isArray","currentDesiredLocale","doesLocaleExist","find","loc","defaultLocale","isDefault","length","displayedLocales","filter","includes","_jsx","SingleSelect","size","aria-label","id","getTranslation","defaultMessage","value","onChange","map","SingleSelectOption","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAC1B,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,EAAEC,SAAS,GAAGC,0BAAAA,EAAAA;AAE9B,IAAA,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGC,eAAAA,EAAAA;AACxC,IAAA,MAAM,EAAEC,IAAMC,EAAAA,SAAAA,GAAU,EAAE,EAAE,GAAGC,2BAAmBC,SAAW,EAAA;AAC3DC,QAAAA,IAAAA,EAAM,CAACR;AACT,KAAA,CAAA;AAEA,IAAA,MAAMS,eAAeC,gBAAMC,CAAAA,WAAW,CACpC,CAACC,IAAAA,EAAcC,UAAU,KAAK,GAAA;QAC5Bf,QACE,CAAA;YACEgB,IAAM,EAAA,CAAA;YACNC,OAAS,EAAA;AAAE,gBAAA,GAAGlB,MAAMkB,OAAO;gBAAEC,IAAM,EAAA;oBAAEC,MAAQL,EAAAA;AAAK;AAAE;AACtD,SAAA,EACA,MACAC,EAAAA,OAAAA,CAAAA;KAGJ,EAAA;AAAChB,QAAAA,KAAAA,CAAMkB,OAAO;AAAEjB,QAAAA;AAAS,KAAA,CAAA;AAG3BY,IA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,CAAA;AACxBwC,YAAAA,EAAAA,EAAIC,6BAAe,CAAA,uBAAA,CAAA;YACnBC,cAAgB,EAAA;AAClB,SAAA,CAAA;AACAC,QAAAA,KAAAA,EAAOzC,KAAMkB,CAAAA,OAAO,EAAEC,IAAAA,EAAMC,MAAUZ,IAAAA,SAAAA,CAAQkB,IAAI,CAAC,CAACN,MAAAA,GAAWA,MAAOS,CAAAA,SAAS,CAAGd,EAAAA,IAAAA;;QAElF2B,QAAU9B,EAAAA,YAAAA;AAETmB,QAAAA,QAAAA,EAAAA,gBAAAA,CAAiBY,GAAG,CAAC,CAACvB,MAAAA,iBACrBc,cAACU,CAAAA,+BAAAA,EAAAA;AAAmCH,gBAAAA,KAAAA,EAAOrB,OAAOL,IAAI;AACnDK,gBAAAA,QAAAA,EAAAA,MAAAA,CAAOyB;AADezB,aAAAA,EAAAA,MAAAA,CAAOkB,EAAE,CAAA;;AAM1C;;;;"}
1
+ {"version":3,"file":"LocalePicker.js","sources":["../../../admin/src/components/LocalePicker.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { SingleSelect, SingleSelectOption } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface Query extends I18nBaseQuery {\n page?: number;\n}\n\nconst LocalePicker = () => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<Query>();\n\n const { hasI18n, canRead, canCreate } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery(undefined, {\n skip: !hasI18n,\n });\n\n const handleChange = React.useCallback(\n (code: string, replace = false) => {\n setQuery(\n {\n page: 1,\n plugins: { ...query.plugins, i18n: { locale: code } },\n },\n 'push',\n replace\n );\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleChange(defaultLocale.code, true);\n }\n }, [hasI18n, handleChange, locales, query.plugins?.i18n?.locale]);\n\n const sortedLocaleOptions = React.useMemo(() => {\n const displayedLocales = Array.isArray(locales)\n ? locales.filter((locale) => {\n /**\n * If you can create or read we allow you to see the locale exists\n * this is because in the ListView, you may be able to create a new entry\n * in a locale you can't read.\n */\n return canCreate.includes(locale.code) || canRead.includes(locale.code);\n })\n : [];\n\n return displayedLocales\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((locale) => (\n <SingleSelectOption key={locale.id} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ));\n }, [locales, canCreate, canRead]);\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n return (\n <SingleSelect\n size=\"S\"\n aria-label={formatMessage({\n id: getTranslation('actions.select-locale'),\n defaultMessage: 'Select locale',\n })}\n value={query.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code}\n // @ts-expect-error – This can be removed in V2 of the DS.\n onChange={handleChange}\n >\n {sortedLocaleOptions}\n </SingleSelect>\n );\n};\n\nexport { LocalePicker };\n"],"names":["LocalePicker","formatMessage","useIntl","query","setQuery","useQueryParams","hasI18n","canRead","canCreate","useI18n","data","locales","useGetLocalesQuery","undefined","skip","handleChange","React","useCallback","code","replace","page","plugins","i18n","locale","useEffect","Array","isArray","currentDesiredLocale","doesLocaleExist","find","loc","defaultLocale","isDefault","sortedLocaleOptions","useMemo","displayedLocales","filter","includes","sort","a","b","name","localeCompare","map","_jsx","SingleSelectOption","value","id","length","SingleSelect","size","aria-label","getTranslation","defaultMessage","onChange"],"mappings":";;;;;;;;;;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,IAAA,qBACEJ,cAACK,CAAAA,yBAAAA,EAAAA;QACCC,IAAK,EAAA,GAAA;AACLC,QAAAA,YAAAA,EAAYlD,aAAc,CAAA;AACxB8C,YAAAA,EAAAA,EAAIK,6BAAe,CAAA,uBAAA,CAAA;YACnBC,cAAgB,EAAA;AAClB,SAAA,CAAA;AACAP,QAAAA,KAAAA,EAAO3C,KAAMkB,CAAAA,OAAO,EAAEC,IAAAA,EAAMC,MAAUZ,IAAAA,SAAAA,CAAQkB,IAAI,CAAC,CAACN,MAAAA,GAAWA,MAAOS,CAAAA,SAAS,CAAGd,EAAAA,IAAAA;;QAElFoC,QAAUvC,EAAAA,YAAAA;AAETkB,QAAAA,QAAAA,EAAAA;;AAGP;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { useQueryParams } from '@strapi/admin/strapi-admin';
4
- import { SingleSelect, SingleSelectOption } from '@strapi/design-system';
4
+ import { SingleSelectOption, SingleSelect } from '@strapi/design-system';
5
5
  import { useIntl } from 'react-intl';
6
6
  import { useI18n } from '../hooks/useI18n.mjs';
7
7
  import { useGetLocalesQuery } from '../services/locales.mjs';
@@ -47,16 +47,26 @@ const LocalePicker = ()=>{
47
47
  locales,
48
48
  query.plugins?.i18n?.locale
49
49
  ]);
50
+ const sortedLocaleOptions = React.useMemo(()=>{
51
+ const displayedLocales = Array.isArray(locales) ? locales.filter((locale)=>{
52
+ /**
53
+ * If you can create or read we allow you to see the locale exists
54
+ * this is because in the ListView, you may be able to create a new entry
55
+ * in a locale you can't read.
56
+ */ return canCreate.includes(locale.code) || canRead.includes(locale.code);
57
+ }) : [];
58
+ return displayedLocales.sort((a, b)=>a.name.localeCompare(b.name)).map((locale)=>/*#__PURE__*/ jsx(SingleSelectOption, {
59
+ value: locale.code,
60
+ children: locale.name
61
+ }, locale.id));
62
+ }, [
63
+ locales,
64
+ canCreate,
65
+ canRead
66
+ ]);
50
67
  if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
51
68
  return null;
52
69
  }
53
- const displayedLocales = locales.filter((locale)=>{
54
- /**
55
- * If you can create or read we allow you to see the locale exists
56
- * this is because in the ListView, you may be able to create a new entry
57
- * in a locale you can't read.
58
- */ return canCreate.includes(locale.code) || canRead.includes(locale.code);
59
- });
60
70
  return /*#__PURE__*/ jsx(SingleSelect, {
61
71
  size: "S",
62
72
  "aria-label": formatMessage({
@@ -66,10 +76,7 @@ const LocalePicker = ()=>{
66
76
  value: query.plugins?.i18n?.locale || locales.find((locale)=>locale.isDefault)?.code,
67
77
  // @ts-expect-error – This can be removed in V2 of the DS.
68
78
  onChange: handleChange,
69
- children: displayedLocales.map((locale)=>/*#__PURE__*/ jsx(SingleSelectOption, {
70
- value: locale.code,
71
- children: locale.name
72
- }, locale.id))
79
+ children: sortedLocaleOptions
73
80
  });
74
81
  };
75
82
 
@@ -1 +1 @@
1
- {"version":3,"file":"LocalePicker.mjs","sources":["../../../admin/src/components/LocalePicker.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { SingleSelect, SingleSelectOption } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface Query extends I18nBaseQuery {\n page?: number;\n}\n\nconst LocalePicker = () => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<Query>();\n\n const { hasI18n, canRead, canCreate } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery(undefined, {\n skip: !hasI18n,\n });\n\n const handleChange = React.useCallback(\n (code: string, replace = false) => {\n setQuery(\n {\n page: 1,\n plugins: { ...query.plugins, i18n: { locale: code } },\n },\n 'push',\n replace\n );\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleChange(defaultLocale.code, true);\n }\n }, [hasI18n, handleChange, locales, query.plugins?.i18n?.locale]);\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n const displayedLocales = locales.filter((locale) => {\n /**\n * If you can create or read we allow you to see the locale exists\n * this is because in the ListView, you may be able to create a new entry\n * in a locale you can't read.\n */\n return canCreate.includes(locale.code) || canRead.includes(locale.code);\n });\n\n return (\n <SingleSelect\n size=\"S\"\n aria-label={formatMessage({\n id: getTranslation('actions.select-locale'),\n defaultMessage: 'Select locale',\n })}\n value={query.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code}\n // @ts-expect-error – This can be removed in V2 of the DS.\n onChange={handleChange}\n >\n {displayedLocales.map((locale) => (\n <SingleSelectOption key={locale.id} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n );\n};\n\nexport { LocalePicker };\n"],"names":["LocalePicker","formatMessage","useIntl","query","setQuery","useQueryParams","hasI18n","canRead","canCreate","useI18n","data","locales","useGetLocalesQuery","undefined","skip","handleChange","React","useCallback","code","replace","page","plugins","i18n","locale","useEffect","Array","isArray","currentDesiredLocale","doesLocaleExist","find","loc","defaultLocale","isDefault","length","displayedLocales","filter","includes","_jsx","SingleSelect","size","aria-label","id","getTranslation","defaultMessage","value","onChange","map","SingleSelectOption","name"],"mappings":";;;;;;;;;AAgBA,MAAMA,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAC1B,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,EAAEC,SAAS,GAAGC,cAAAA,EAAAA;AAE9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/LocalePicker.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { SingleSelect, SingleSelectOption } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface Query extends I18nBaseQuery {\n page?: number;\n}\n\nconst LocalePicker = () => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<Query>();\n\n const { hasI18n, canRead, canCreate } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery(undefined, {\n skip: !hasI18n,\n });\n\n const handleChange = React.useCallback(\n (code: string, replace = false) => {\n setQuery(\n {\n page: 1,\n plugins: { ...query.plugins, i18n: { locale: code } },\n },\n 'push',\n replace\n );\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleChange(defaultLocale.code, true);\n }\n }, [hasI18n, handleChange, locales, query.plugins?.i18n?.locale]);\n\n const sortedLocaleOptions = React.useMemo(() => {\n const displayedLocales = Array.isArray(locales)\n ? locales.filter((locale) => {\n /**\n * If you can create or read we allow you to see the locale exists\n * this is because in the ListView, you may be able to create a new entry\n * in a locale you can't read.\n */\n return canCreate.includes(locale.code) || canRead.includes(locale.code);\n })\n : [];\n\n return displayedLocales\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((locale) => (\n <SingleSelectOption key={locale.id} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ));\n }, [locales, canCreate, canRead]);\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n return (\n <SingleSelect\n size=\"S\"\n aria-label={formatMessage({\n id: getTranslation('actions.select-locale'),\n defaultMessage: 'Select locale',\n })}\n value={query.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code}\n // @ts-expect-error – This can be removed in V2 of the DS.\n onChange={handleChange}\n >\n {sortedLocaleOptions}\n </SingleSelect>\n );\n};\n\nexport { LocalePicker };\n"],"names":["LocalePicker","formatMessage","useIntl","query","setQuery","useQueryParams","hasI18n","canRead","canCreate","useI18n","data","locales","useGetLocalesQuery","undefined","skip","handleChange","React","useCallback","code","replace","page","plugins","i18n","locale","useEffect","Array","isArray","currentDesiredLocale","doesLocaleExist","find","loc","defaultLocale","isDefault","sortedLocaleOptions","useMemo","displayedLocales","filter","includes","sort","a","b","name","localeCompare","map","_jsx","SingleSelectOption","value","id","length","SingleSelect","size","aria-label","getTranslation","defaultMessage","onChange"],"mappings":";;;;;;;;;AAgBA,MAAMA,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAC1B,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,EAAEC,SAAS,GAAGC,cAAAA,EAAAA;AAE9B,IAAA,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGC,OAAAA,EAAAA;AACxC,IAAA,MAAM,EAAEC,IAAMC,EAAAA,OAAAA,GAAU,EAAE,EAAE,GAAGC,mBAAmBC,SAAW,EAAA;AAC3DC,QAAAA,IAAAA,EAAM,CAACR;AACT,KAAA,CAAA;AAEA,IAAA,MAAMS,eAAeC,KAAMC,CAAAA,WAAW,CACpC,CAACC,IAAAA,EAAcC,UAAU,KAAK,GAAA;QAC5Bf,QACE,CAAA;YACEgB,IAAM,EAAA,CAAA;YACNC,OAAS,EAAA;AAAE,gBAAA,GAAGlB,MAAMkB,OAAO;gBAAEC,IAAM,EAAA;oBAAEC,MAAQ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QAAA,OAAOiB,iBACJG,IAAI,CAAC,CAACC,CAAGC,EAAAA,CAAAA,GAAMD,EAAEE,IAAI,CAACC,aAAa,CAACF,EAAEC,IAAI,CAAA,CAAA,CAC1CE,GAAG,CAAC,CAACpB,uBACJqB,GAACC,CAAAA,kBAAAA,EAAAA;AAAmCC,gBAAAA,KAAAA,EAAOvB,OAAOL,IAAI;AACnDK,gBAAAA,QAAAA,EAAAA,MAAAA,CAAOkB;AADelB,aAAAA,EAAAA,MAAAA,CAAOwB,EAAE,CAAA,CAAA;KAIrC,EAAA;AAACpC,QAAAA,OAAAA;AAASH,QAAAA,SAAAA;AAAWD,QAAAA;AAAQ,KAAA,CAAA;IAEhC,IAAI,CAACD,OAAW,IAAA,CAACmB,KAAMC,CAAAA,OAAO,CAACf,OAAYA,CAAAA,IAAAA,OAAAA,CAAQqC,MAAM,KAAK,CAAG,EAAA;QAC/D,OAAO,IAAA;AACT;AAEA,IAAA,qBACEJ,GAACK,CAAAA,YAAAA,EAAAA;QACCC,IAAK,EAAA,GAAA;AACLC,QAAAA,YAAAA,EAAYlD,aAAc,CAAA;AACxB8C,YAAAA,EAAAA,EAAIK,cAAe,CAAA,uBAAA,CAAA;YACnBC,cAAgB,EAAA;AAClB,SAAA,CAAA;AACAP,QAAAA,KAAAA,EAAO3C,KAAMkB,CAAAA,OAAO,EAAEC,IAAAA,EAAMC,MAAUZ,IAAAA,OAAAA,CAAQkB,IAAI,CAAC,CAACN,MAAAA,GAAWA,MAAOS,CAAAA,SAAS,CAAGd,EAAAA,IAAAA;;QAElFoC,QAAUvC,EAAAA,YAAAA;AAETkB,QAAAA,QAAAA,EAAAA;;AAGP;;;;"}
@@ -82,9 +82,12 @@ const LabelAction = ({ title, icon })=>{
82
82
  tag: "span",
83
83
  children: formatMessage(title)
84
84
  }),
85
- /*#__PURE__*/ React__namespace.cloneElement(icon, {
86
- 'aria-hidden': true,
87
- focusable: false
85
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
86
+ label: formatMessage(title),
87
+ children: /*#__PURE__*/ React__namespace.cloneElement(icon, {
88
+ 'aria-hidden': true,
89
+ focusable: false
90
+ })
88
91
  })
89
92
  ]
90
93
  });
@@ -1 +1 @@
1
- {"version":3,"file":"editView.js","sources":["../../../admin/src/contentManagerHooks/editView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as React from 'react';\n\nimport { Flex, VisuallyHidden } from '@strapi/design-system';\nimport { Earth, EarthStriked } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { EditFieldLayout, EditLayout } from '@strapi/content-manager/strapi-admin';\n\ninterface MutateEditViewArgs {\n layout: EditLayout;\n}\n\nconst mutateEditViewHook = ({ layout }: MutateEditViewArgs): MutateEditViewArgs => {\n // If i18n isn't explicitly enabled on the content type, then no field can be localized\n if (\n !('i18n' in layout.options) ||\n (typeof layout.options.i18n === 'object' &&\n layout.options.i18n !== null &&\n 'localized' in layout.options.i18n &&\n !layout.options.i18n.localized)\n ) {\n return { layout };\n }\n\n const components = Object.entries(layout.components).reduce<EditLayout['components']>(\n (acc, [key, componentLayout]) => {\n return {\n ...acc,\n [key]: {\n ...componentLayout,\n layout: componentLayout.layout.map((row) => row.map(addLabelActionToField)),\n },\n };\n },\n {}\n );\n\n return {\n layout: {\n ...layout,\n components,\n layout: layout.layout.map((panel) => panel.map((row) => row.map(addLabelActionToField))),\n },\n } satisfies Pick<MutateEditViewArgs, 'layout'>;\n};\n\nconst addLabelActionToField = (field: EditFieldLayout) => {\n const isFieldLocalized = doesFieldHaveI18nPluginOpt(field.attribute.pluginOptions)\n ? field.attribute.pluginOptions.i18n.localized\n : true || ['uid', 'relation'].includes(field.attribute.type);\n\n const labelActionProps = {\n title: {\n id: isFieldLocalized\n ? getTranslation('Field.localized')\n : getTranslation('Field.not-localized'),\n defaultMessage: isFieldLocalized\n ? 'This value is unique for the selected locale'\n : 'This value is the same across all locales',\n },\n icon: isFieldLocalized ? <Earth /> : null,\n };\n\n return {\n ...field,\n labelAction: isFieldLocalized ? <LabelAction {...labelActionProps} /> : null,\n };\n};\n\nconst doesFieldHaveI18nPluginOpt = (\n pluginOpts?: object\n): pluginOpts is { i18n: { localized: boolean } } => {\n if (!pluginOpts) {\n return false;\n }\n\n return (\n 'i18n' in pluginOpts &&\n typeof pluginOpts.i18n === 'object' &&\n pluginOpts.i18n !== null &&\n 'localized' in pluginOpts.i18n\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LabelAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LabelActionProps {\n title: MessageDescriptor;\n icon: React.ReactNode;\n}\n\nconst LabelAction = ({ title, icon }: LabelActionProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Span tag=\"span\">\n <VisuallyHidden tag=\"span\">{formatMessage(title)}</VisuallyHidden>\n {React.cloneElement(icon as React.ReactElement, {\n 'aria-hidden': true,\n focusable: false, // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable\n })}\n </Span>\n );\n};\n\nconst Span = styled(Flex)`\n svg {\n width: 12px;\n height: 12px;\n\n fill: ${({ theme }) => theme.colors.neutral500};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral500};\n }\n }\n`;\n\nexport { mutateEditViewHook };\n"],"names":["mutateEditViewHook","layout","options","i18n","localized","components","Object","entries","reduce","acc","key","componentLayout","map","row","addLabelActionToField","panel","field","isFieldLocalized","doesFieldHaveI18nPluginOpt","attribute","pluginOptions","labelActionProps","title","id","getTranslation","defaultMessage","icon","_jsx","Earth","labelAction","LabelAction","pluginOpts","formatMessage","useIntl","_jsxs","Span","tag","VisuallyHidden","React","cloneElement","focusable","styled","Flex","theme","colors","neutral500"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,kBAAqB,GAAA,CAAC,EAAEC,MAAM,EAAsB,GAAA;;AAExD,IAAA,IACE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KA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;YAGvC,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;AAGrD,CAAC;;;;"}
1
+ {"version":3,"file":"editView.js","sources":["../../../admin/src/contentManagerHooks/editView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as React from 'react';\n\nimport { Flex, Tooltip, VisuallyHidden } from '@strapi/design-system';\nimport { Earth, EarthStriked } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { EditFieldLayout, EditLayout } from '@strapi/content-manager/strapi-admin';\n\ninterface MutateEditViewArgs {\n layout: EditLayout;\n}\n\nconst mutateEditViewHook = ({ layout }: MutateEditViewArgs): MutateEditViewArgs => {\n // If i18n isn't explicitly enabled on the content type, then no field can be localized\n if (\n !('i18n' in layout.options) ||\n (typeof layout.options.i18n === 'object' &&\n layout.options.i18n !== null &&\n 'localized' in layout.options.i18n &&\n !layout.options.i18n.localized)\n ) {\n return { layout };\n }\n\n const components = Object.entries(layout.components).reduce<EditLayout['components']>(\n (acc, [key, componentLayout]) => {\n return {\n ...acc,\n [key]: {\n ...componentLayout,\n layout: componentLayout.layout.map((row) => row.map(addLabelActionToField)),\n },\n };\n },\n {}\n );\n\n return {\n layout: {\n ...layout,\n components,\n layout: layout.layout.map((panel) => panel.map((row) => row.map(addLabelActionToField))),\n },\n } satisfies Pick<MutateEditViewArgs, 'layout'>;\n};\n\nconst addLabelActionToField = (field: EditFieldLayout) => {\n const isFieldLocalized = doesFieldHaveI18nPluginOpt(field.attribute.pluginOptions)\n ? field.attribute.pluginOptions.i18n.localized\n : true || ['uid', 'relation'].includes(field.attribute.type);\n\n const labelActionProps = {\n title: {\n id: isFieldLocalized\n ? getTranslation('Field.localized')\n : getTranslation('Field.not-localized'),\n defaultMessage: isFieldLocalized\n ? 'This value is unique for the selected locale'\n : 'This value is the same across all locales',\n },\n icon: isFieldLocalized ? <Earth /> : null,\n };\n\n return {\n ...field,\n labelAction: isFieldLocalized ? <LabelAction {...labelActionProps} /> : null,\n };\n};\n\nconst doesFieldHaveI18nPluginOpt = (\n pluginOpts?: object\n): pluginOpts is { i18n: { localized: boolean } } => {\n if (!pluginOpts) {\n return false;\n }\n\n return (\n 'i18n' in pluginOpts &&\n typeof pluginOpts.i18n === 'object' &&\n pluginOpts.i18n !== null &&\n 'localized' in pluginOpts.i18n\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LabelAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LabelActionProps {\n title: MessageDescriptor;\n icon: React.ReactNode;\n}\n\nconst LabelAction = ({ title, icon }: LabelActionProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Span tag=\"span\">\n <VisuallyHidden tag=\"span\">{formatMessage(title)}</VisuallyHidden>\n <Tooltip label={formatMessage(title)}>\n {React.cloneElement(icon as React.ReactElement, {\n 'aria-hidden': true,\n focusable: false, // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable\n })}\n </Tooltip>\n </Span>\n );\n};\n\nconst Span = styled(Flex)`\n svg {\n width: 12px;\n height: 12px;\n\n fill: ${({ theme }) => theme.colors.neutral500};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral500};\n }\n }\n`;\n\nexport { mutateEditViewHook };\n"],"names":["mutateEditViewHook","layout","options","i18n","localized","components","Object","entries","reduce","acc","key","componentLayout","map","row","addLabelActionToField","panel","field","isFieldLocalized","doesFieldHaveI18nPluginOpt","attribute","pluginOptions","labelActionProps","title","id","getTranslation","defaultMessage","icon","_jsx","Earth","labelAction","LabelAction","pluginOpts","formatMessage","useIntl","_jsxs","Span","tag","VisuallyHidden","Tooltip","label","React","cloneElement","focusable","styled","Flex","theme","colors","neutral500"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,k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e,EAAA,IAAA;oBACfgB,SAAW,EAAA;AACb,iBAAA;;;;AAIR,CAAA;AAEA,MAAMP,IAAAA,GAAOQ,uBAAOC,CAAAA,iBAAAA,CAAK;;;;;UAKf,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;YAGvC,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;AAGrD,CAAC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { Flex, VisuallyHidden } from '@strapi/design-system';
3
+ import { Flex, VisuallyHidden, Tooltip } from '@strapi/design-system';
4
4
  import { Earth } from '@strapi/icons';
5
5
  import { useIntl } from 'react-intl';
6
6
  import { styled } from 'styled-components';
@@ -61,9 +61,12 @@ const LabelAction = ({ title, icon })=>{
61
61
  tag: "span",
62
62
  children: formatMessage(title)
63
63
  }),
64
- /*#__PURE__*/ React.cloneElement(icon, {
65
- 'aria-hidden': true,
66
- focusable: false
64
+ /*#__PURE__*/ jsx(Tooltip, {
65
+ label: formatMessage(title),
66
+ children: /*#__PURE__*/ React.cloneElement(icon, {
67
+ 'aria-hidden': true,
68
+ focusable: false
69
+ })
67
70
  })
68
71
  ]
69
72
  });
@@ -1 +1 @@
1
- {"version":3,"file":"editView.mjs","sources":["../../../admin/src/contentManagerHooks/editView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as React from 'react';\n\nimport { Flex, VisuallyHidden } from '@strapi/design-system';\nimport { Earth, EarthStriked } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { EditFieldLayout, EditLayout } from '@strapi/content-manager/strapi-admin';\n\ninterface MutateEditViewArgs {\n layout: EditLayout;\n}\n\nconst mutateEditViewHook = ({ layout }: MutateEditViewArgs): MutateEditViewArgs => {\n // If i18n isn't explicitly enabled on the content type, then no field can be localized\n if (\n !('i18n' in layout.options) ||\n (typeof layout.options.i18n === 'object' &&\n layout.options.i18n !== null &&\n 'localized' in layout.options.i18n &&\n !layout.options.i18n.localized)\n ) {\n return { layout };\n }\n\n const components = Object.entries(layout.components).reduce<EditLayout['components']>(\n (acc, [key, componentLayout]) => {\n return {\n ...acc,\n [key]: {\n ...componentLayout,\n layout: componentLayout.layout.map((row) => row.map(addLabelActionToField)),\n },\n };\n },\n {}\n );\n\n return {\n layout: {\n ...layout,\n components,\n layout: layout.layout.map((panel) => panel.map((row) => row.map(addLabelActionToField))),\n },\n } satisfies Pick<MutateEditViewArgs, 'layout'>;\n};\n\nconst addLabelActionToField = (field: EditFieldLayout) => {\n const isFieldLocalized = doesFieldHaveI18nPluginOpt(field.attribute.pluginOptions)\n ? field.attribute.pluginOptions.i18n.localized\n : true || ['uid', 'relation'].includes(field.attribute.type);\n\n const labelActionProps = {\n title: {\n id: isFieldLocalized\n ? getTranslation('Field.localized')\n : getTranslation('Field.not-localized'),\n defaultMessage: isFieldLocalized\n ? 'This value is unique for the selected locale'\n : 'This value is the same across all locales',\n },\n icon: isFieldLocalized ? <Earth /> : null,\n };\n\n return {\n ...field,\n labelAction: isFieldLocalized ? <LabelAction {...labelActionProps} /> : null,\n };\n};\n\nconst doesFieldHaveI18nPluginOpt = (\n pluginOpts?: object\n): pluginOpts is { i18n: { localized: boolean } } => {\n if (!pluginOpts) {\n return false;\n }\n\n return (\n 'i18n' in pluginOpts &&\n typeof pluginOpts.i18n === 'object' &&\n pluginOpts.i18n !== null &&\n 'localized' in pluginOpts.i18n\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LabelAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LabelActionProps {\n title: MessageDescriptor;\n icon: React.ReactNode;\n}\n\nconst LabelAction = ({ title, icon }: LabelActionProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Span tag=\"span\">\n <VisuallyHidden tag=\"span\">{formatMessage(title)}</VisuallyHidden>\n {React.cloneElement(icon as React.ReactElement, {\n 'aria-hidden': true,\n focusable: false, // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable\n })}\n </Span>\n );\n};\n\nconst Span = styled(Flex)`\n svg {\n width: 12px;\n height: 12px;\n\n fill: ${({ theme }) => theme.colors.neutral500};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral500};\n }\n }\n`;\n\nexport { mutateEditViewHook };\n"],"names":["mutateEditViewHook","layout","options","i18n","localized","components","Object","entries","reduce","acc","key","componentLayout","map","row","addLabelActionToField","panel","field","isFieldLocalized","doesFieldHaveI18nPluginOpt","attribute","pluginOptions","labelActionProps","title","id","getTranslation","defaultMessage","icon","_jsx","Earth","labelAction","LabelAction","pluginOpts","formatMessage","useIntl","_jsxs","Span","tag","VisuallyHidden","React","cloneElement","focusable","styled","Flex","theme","colors","neutral500"],"mappings":";;;;;;;;AAgBA,MAAMA,kBAAqB,GAAA,CAAC,EAAEC,MAAM,EAAsB,GAAA;;AAExD,IAAA,IACE,EAAE,MAAUA,IAAAA,MAAAA,CAAOC,OAAO,CAAD,IACxB,OAAOD,MAAAA,CAAOC,OAAO,CAACC,IAAI,KAAK,YAC9BF,MAAOC,CAAAA,OAAO,CAACC,IAAI,KAAK,IAAA,IACxB,WAAeF,IAAAA,MAAAA,CAAOC,OAAO,CAACC,IAAI,IAClC,CAACF,OAAOC,OAAO,CAACC,IAAI,CAACC,SAAS,EAChC;QACA,OAAO;AAAEH,YAAAA;AAAO,SAAA;AAClB;AAEA,IAAA,MAAMI,UAAaC,GAAAA,MAAAA,CAAOC,OAAO,CAACN,MAAOI,CAAAA,UAAU,CAAEG,CAAAA,MAAM,CACzD,CAACC,GAAK,EAAA,CAACC,KAAKC,eAAgB,CAAA,GAAA;QAC1B,OAAO;AACL,YAAA,GAAGF,GAAG;AACN,YAAA,CAACC,MAAM;AACL,gBAAA,GA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AACT;AAEA,IAAA,OACE,MAAUA,IAAAA,UAAAA,IACV,OAAOA,UAAAA,CAAW5B,IAAI,KAAK,QAC3B4B,IAAAA,UAAAA,CAAW5B,IAAI,KAAK,IACpB,IAAA,WAAA,IAAe4B,WAAW5B,IAAI;AAElC,CAAA;AAWA,MAAM2B,cAAc,CAAC,EAAER,KAAK,EAAEI,IAAI,EAAoB,GAAA;IACpD,MAAM,EAAEM,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,qBACEC,IAACC,CAAAA,IAAAA,EAAAA;QAAKC,GAAI,EAAA,MAAA;;0BACRT,GAACU,CAAAA,cAAAA,EAAAA;gBAAeD,GAAI,EAAA,MAAA;0BAAQJ,aAAcV,CAAAA,KAAAA;;0BACzCgB,KAAMC,CAAAA,YAAY,CAACb,IAA4B,EAAA;gBAC9C,aAAe,EAAA,IAAA;gBACfc,SAAW,EAAA;AACb,aAAA;;;AAGN,CAAA;AAEA,MAAML,IAAAA,GAAOM,MAAOC,CAAAA,IAAAA,CAAK;;;;;UAKf,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;YAGvC,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;AAGrD,CAAC;;;;"}
1
+ {"version":3,"file":"editView.mjs","sources":["../../../admin/src/contentManagerHooks/editView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as React from 'react';\n\nimport { Flex, Tooltip, VisuallyHidden } from '@strapi/design-system';\nimport { Earth, EarthStriked } from '@strapi/icons';\nimport { MessageDescriptor, useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { EditFieldLayout, EditLayout } from '@strapi/content-manager/strapi-admin';\n\ninterface MutateEditViewArgs {\n layout: EditLayout;\n}\n\nconst mutateEditViewHook = ({ layout }: MutateEditViewArgs): MutateEditViewArgs => {\n // If i18n isn't explicitly enabled on the content type, then no field can be localized\n if (\n !('i18n' in layout.options) ||\n (typeof layout.options.i18n === 'object' &&\n layout.options.i18n !== null &&\n 'localized' in layout.options.i18n &&\n !layout.options.i18n.localized)\n ) {\n return { layout };\n }\n\n const components = Object.entries(layout.components).reduce<EditLayout['components']>(\n (acc, [key, componentLayout]) => {\n return {\n ...acc,\n [key]: {\n ...componentLayout,\n layout: componentLayout.layout.map((row) => row.map(addLabelActionToField)),\n },\n };\n },\n {}\n );\n\n return {\n layout: {\n ...layout,\n components,\n layout: layout.layout.map((panel) => panel.map((row) => row.map(addLabelActionToField))),\n },\n } satisfies Pick<MutateEditViewArgs, 'layout'>;\n};\n\nconst addLabelActionToField = (field: EditFieldLayout) => {\n const isFieldLocalized = doesFieldHaveI18nPluginOpt(field.attribute.pluginOptions)\n ? field.attribute.pluginOptions.i18n.localized\n : true || ['uid', 'relation'].includes(field.attribute.type);\n\n const labelActionProps = {\n title: {\n id: isFieldLocalized\n ? getTranslation('Field.localized')\n : getTranslation('Field.not-localized'),\n defaultMessage: isFieldLocalized\n ? 'This value is unique for the selected locale'\n : 'This value is the same across all locales',\n },\n icon: isFieldLocalized ? <Earth /> : null,\n };\n\n return {\n ...field,\n labelAction: isFieldLocalized ? <LabelAction {...labelActionProps} /> : null,\n };\n};\n\nconst doesFieldHaveI18nPluginOpt = (\n pluginOpts?: object\n): pluginOpts is { i18n: { localized: boolean } } => {\n if (!pluginOpts) {\n return false;\n }\n\n return (\n 'i18n' in pluginOpts &&\n typeof pluginOpts.i18n === 'object' &&\n pluginOpts.i18n !== null &&\n 'localized' in pluginOpts.i18n\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LabelAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LabelActionProps {\n title: MessageDescriptor;\n icon: React.ReactNode;\n}\n\nconst LabelAction = ({ title, icon }: LabelActionProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Span tag=\"span\">\n <VisuallyHidden tag=\"span\">{formatMessage(title)}</VisuallyHidden>\n <Tooltip label={formatMessage(title)}>\n {React.cloneElement(icon as React.ReactElement, {\n 'aria-hidden': true,\n focusable: false, // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable\n })}\n </Tooltip>\n </Span>\n );\n};\n\nconst Span = styled(Flex)`\n svg {\n width: 12px;\n height: 12px;\n\n fill: ${({ theme }) => theme.colors.neutral500};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral500};\n }\n }\n`;\n\nexport { mutateEditViewHook };\n"],"names":["mutateEditViewHook","layout","options","i18n","localized","components","Object","entries","reduce","acc","key","componentLayout","map","row","addLabelActionToField","panel","field","isFieldLocalized","doesFieldHaveI18nPluginOpt","attribute","pluginOptions","labelActionProps","title","id","getTranslation","defaultMessage","icon","_jsx","Earth","labelAction","LabelAction","pluginOpts","formatMessage","useIntl","_jsxs","Span","tag","VisuallyHidden","Tooltip","label","React","cloneElement","focusable","styled","Flex","theme","colors","neutral500"],"mappings":";;;;;;;;AAgBA,MAAMA,kBAAqB,GAAA,CAAC,EAAEC,MAAM,EAAsB,GAAA;;AAExD,IAAA,IACE,EAAE,MAAUA,IAAAA,MAAAA,CAAOC,OAAO,CAAD,IACxB,OAAOD,MAAAA,CAAOC,OAAO,CAACC,IAAI,KAAK,YAC9BF,MAAOC,CAAAA,OAAO,CAACC,IAAI,KAAK,IAAA,IACxB,WAAeF,IAAAA,MAAAA,CAAOC,OAAO,CAACC,IAAI,IAClC,CAACF,OAAOC,OAAO,CAACC,IAAI,CAACC,SAAS,EAChC;QACA,OAAO;AAAEH,YAAAA;AAAO,SAAA;AAClB;AAEA,IAAA,MAAMI,UAAaC,GAAAA,MAAAA,CAAOC,OAAO,CAACN,MAAOI,CAAAA,UAAU,CAAEG,CAAAA,MAAM,CACzD,CAACC,GAAK,EAAA,CAACC,KAAKC,eAAgB,CAAA,GAAA;QAC1B,OAAO;AACL,YAAA,GAAGF,GAAG;AACN,Y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A,UAAY,EAAA;QACf,OAAO,KAAA;AACT;AAEA,IAAA,OACE,MAAUA,IAAAA,UAAAA,IACV,OAAOA,UAAAA,CAAW5B,IAAI,KAAK,QAC3B4B,IAAAA,UAAAA,CAAW5B,IAAI,KAAK,IACpB,IAAA,WAAA,IAAe4B,WAAW5B,IAAI;AAElC,CAAA;AAWA,MAAM2B,cAAc,CAAC,EAAER,KAAK,EAAEI,IAAI,EAAoB,GAAA;IACpD,MAAM,EAAEM,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,qBACEC,IAACC,CAAAA,IAAAA,EAAAA;QAAKC,GAAI,EAAA,MAAA;;0BACRT,GAACU,CAAAA,cAAAA,EAAAA;gBAAeD,GAAI,EAAA,MAAA;0BAAQJ,aAAcV,CAAAA,KAAAA;;0BAC1CK,GAACW,CAAAA,OAAAA,EAAAA;AAAQC,gBAAAA,KAAAA,EAAOP,aAAcV,CAAAA,KAAAA,CAAAA;wCAC3BkB,KAAAA,CAAMC,YAAY,CAACf,IAA4B,EAAA;oBAC9C,aAAe,EAAA,IAAA;oBACfgB,SAAW,EAAA;AACb,iBAAA;;;;AAIR,CAAA;AAEA,MAAMP,IAAAA,GAAOQ,MAAOC,CAAAA,IAAAA,CAAK;;;;;UAKf,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;YAGvC,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;;;AAGrD,CAAC;;;;"}
@@ -31,7 +31,8 @@ const addColumnToTableHook = ({ displayedHeaders, layout })=>{
31
31
  // @ts-expect-error – ID is seen as number | string; this will change when we move the type over.
32
32
  cellFormatter: (props, _header, meta)=>/*#__PURE__*/ jsxRuntime.jsx(LocaleListCell.LocaleListCell, {
33
33
  ...props,
34
- ...meta
34
+ ...meta,
35
+ documentId: props.documentId
35
36
  })
36
37
  }
37
38
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"listView.js","sources":["../../../admin/src/contentManagerHooks/listView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { LocaleListCell } from '../components/LocaleListCell';\nimport { doesPluginOptionsHaveI18nLocalized } from '../utils/fields';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { ListFieldLayout, ListLayout } from '@strapi/content-manager/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * addColumnToTableHook\n * -----------------------------------------------------------------------------------------------*/\ninterface AddColumnToTableHookArgs {\n layout: ListLayout;\n displayedHeaders: ListFieldLayout[];\n}\n\nconst addColumnToTableHook = ({ displayedHeaders, layout }: AddColumnToTableHookArgs) => {\n const { options } = layout;\n\n const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options)\n ? options.i18n.localized\n : false;\n\n if (!isFieldLocalized) {\n return { displayedHeaders, layout };\n }\n\n return {\n displayedHeaders: [\n ...displayedHeaders,\n {\n attribute: { type: 'string' },\n label: {\n id: getTranslation('list-view.table.header.label'),\n defaultMessage: 'Available in',\n },\n searchable: false,\n sortable: false,\n name: 'locales',\n // @ts-expect-error – ID is seen as number | string; this will change when we move the type over.\n cellFormatter: (props, _header, meta) => <LocaleListCell {...props} {...meta} />,\n },\n ],\n layout,\n };\n};\n\nexport { addColumnToTableHook };\n"],"names":["addColumnToTableHook","displayedHeaders","layout","options","isFieldLocalized","doesPluginOptionsHaveI18nLocalized","i18n","localized","attribute","type","label","id","getTranslation","defaultMessage","searchable","sortable","name","cellFormatter","props","_header","meta","_jsx","LocaleListCell"],"mappings":";;;;;;;AAeA,MAAMA,uBAAuB,CAAC,EAAEC,gBAAgB,EAAEC,MAAM,EAA4B,GAAA;IAClF,MAAM,EAAEC,OAAO,EAAE,GAAGD,MAAAA;AAEpB,IAAA,MAAME,mBAAmBC,yCAAmCF,CAAAA,OAAAA,CAAAA,GACxDA,QAAQG,IAAI,CAACC,SAAS,GACtB,KAAA;AAEJ,IAAA,IAAI,CAACH,gBAAkB,EAAA;QACrB,OAAO;AAAEH,YAAAA,gBAAAA;AAAkBC,YAAAA;AAAO,SAAA;AACpC;IAEA,OAAO;QACLD,gBAAkB,EAAA;AACbA,YAAAA,GAAAA,gBAAAA;AACH,YAAA;gBACEO,SAAW,EAAA;oBAAEC,IAAM,EAAA;AAAS,iBAAA;gBAC5BC,KAAO,EAAA;AACLC,oBAAAA,EAAAA,EAAIC,6BAAe,CAAA,8BAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;gBACAC,UAAY,EAAA,KAAA;gBACZC,QAAU,EAAA,KAAA;gBACVC,IAAM,EAAA,SAAA;;AAENC,gBAAAA,aAAAA,EAAe,CAACC,KAAAA,EAAOC,OAASC,EAAAA,IAAAA,iBAASC,cAACC,CAAAA,6BAAAA,EAAAA;AAAgB,wBAAA,GAAGJ,KAAK;AAAG,wBAAA,GAAGE;;AAC1E;AACD,SAAA;AACDlB,QAAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"listView.js","sources":["../../../admin/src/contentManagerHooks/listView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { LocaleListCell } from '../components/LocaleListCell';\nimport { doesPluginOptionsHaveI18nLocalized } from '../utils/fields';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { ListFieldLayout, ListLayout } from '@strapi/content-manager/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * addColumnToTableHook\n * -----------------------------------------------------------------------------------------------*/\ninterface AddColumnToTableHookArgs {\n layout: ListLayout;\n displayedHeaders: ListFieldLayout[];\n}\n\nconst addColumnToTableHook = ({ displayedHeaders, layout }: AddColumnToTableHookArgs) => {\n const { options } = layout;\n\n const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options)\n ? options.i18n.localized\n : false;\n\n if (!isFieldLocalized) {\n return { displayedHeaders, layout };\n }\n\n return {\n displayedHeaders: [\n ...displayedHeaders,\n {\n attribute: { type: 'string' },\n label: {\n id: getTranslation('list-view.table.header.label'),\n defaultMessage: 'Available in',\n },\n searchable: false,\n sortable: false,\n name: 'locales',\n // @ts-expect-error – ID is seen as number | string; this will change when we move the type over.\n cellFormatter: (props, _header, meta) => (\n <LocaleListCell {...props} {...meta} documentId={props.documentId} />\n ),\n },\n ],\n layout,\n };\n};\n\nexport { addColumnToTableHook };\n"],"names":["addColumnToTableHook","displayedHeaders","layout","options","isFieldLocalized","doesPluginOptionsHaveI18nLocalized","i18n","localized","attribute","type","label","id","getTranslation","defaultMessage","searchable","sortable","name","cellFormatter","props","_header","meta","_jsx","LocaleListCell","documentId"],"mappings":";;;;;;;AAeA,MAAMA,uBAAuB,CAAC,EAAEC,gBAAgB,EAAEC,MAAM,EAA4B,GAAA;IAClF,MAAM,EAAEC,OAAO,EAAE,GAAGD,MAAAA;AAEpB,IAAA,MAAME,mBAAmBC,yCAAmCF,CAAAA,OAAAA,CAAAA,GACxDA,QAAQG,IAAI,CAACC,SAAS,GACtB,KAAA;AAEJ,IAAA,IAAI,CAACH,gBAAkB,EAAA;QACrB,OAAO;AAAEH,YAAAA,gBAAAA;AAAkBC,YAAAA;AAAO,SAAA;AACpC;IAEA,OAAO;QACLD,gBAAkB,EAAA;AACbA,YAAAA,GAAAA,gBAAAA;AACH,YAAA;gBACEO,SAAW,EAAA;oBAAEC,IAAM,EAAA;AAAS,iBAAA;gBAC5BC,KAAO,EAAA;AACLC,oBAAAA,EAAAA,EAAIC,6BAAe,CAAA,8BAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;gBACAC,UAAY,EAAA,KAAA;gBACZC,QAAU,EAAA,KAAA;gBACVC,IAAM,EAAA,SAAA;;AAENC,gBAAAA,aAAAA,EAAe,CAACC,KAAAA,EAAOC,OAASC,EAAAA,IAAAA,iBAC9BC,cAACC,CAAAA,6BAAAA,EAAAA;AAAgB,wBAAA,GAAGJ,KAAK;AAAG,wBAAA,GAAGE,IAAI;AAAEG,wBAAAA,UAAAA,EAAYL,MAAMK;;AAE3D;AACD,SAAA;AACDrB,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -29,7 +29,8 @@ const addColumnToTableHook = ({ displayedHeaders, layout })=>{
29
29
  // @ts-expect-error – ID is seen as number | string; this will change when we move the type over.
30
30
  cellFormatter: (props, _header, meta)=>/*#__PURE__*/ jsx(LocaleListCell, {
31
31
  ...props,
32
- ...meta
32
+ ...meta,
33
+ documentId: props.documentId
33
34
  })
34
35
  }
35
36
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"listView.mjs","sources":["../../../admin/src/contentManagerHooks/listView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { LocaleListCell } from '../components/LocaleListCell';\nimport { doesPluginOptionsHaveI18nLocalized } from '../utils/fields';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { ListFieldLayout, ListLayout } from '@strapi/content-manager/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * addColumnToTableHook\n * -----------------------------------------------------------------------------------------------*/\ninterface AddColumnToTableHookArgs {\n layout: ListLayout;\n displayedHeaders: ListFieldLayout[];\n}\n\nconst addColumnToTableHook = ({ displayedHeaders, layout }: AddColumnToTableHookArgs) => {\n const { options } = layout;\n\n const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options)\n ? options.i18n.localized\n : false;\n\n if (!isFieldLocalized) {\n return { displayedHeaders, layout };\n }\n\n return {\n displayedHeaders: [\n ...displayedHeaders,\n {\n attribute: { type: 'string' },\n label: {\n id: getTranslation('list-view.table.header.label'),\n defaultMessage: 'Available in',\n },\n searchable: false,\n sortable: false,\n name: 'locales',\n // @ts-expect-error – ID is seen as number | string; this will change when we move the type over.\n cellFormatter: (props, _header, meta) => <LocaleListCell {...props} {...meta} />,\n },\n ],\n layout,\n };\n};\n\nexport { addColumnToTableHook };\n"],"names":["addColumnToTableHook","displayedHeaders","layout","options","isFieldLocalized","doesPluginOptionsHaveI18nLocalized","i18n","localized","attribute","type","label","id","getTranslation","defaultMessage","searchable","sortable","name","cellFormatter","props","_header","meta","_jsx","LocaleListCell"],"mappings":";;;;;AAeA,MAAMA,uBAAuB,CAAC,EAAEC,gBAAgB,EAAEC,MAAM,EAA4B,GAAA;IAClF,MAAM,EAAEC,OAAO,EAAE,GAAGD,MAAAA;AAEpB,IAAA,MAAME,mBAAmBC,kCAAmCF,CAAAA,OAAAA,CAAAA,GACxDA,QAAQG,IAAI,CAACC,SAAS,GACtB,KAAA;AAEJ,IAAA,IAAI,CAACH,gBAAkB,EAAA;QACrB,OAAO;AAAEH,YAAAA,gBAAAA;AAAkBC,YAAAA;AAAO,SAAA;AACpC;IAEA,OAAO;QACLD,gBAAkB,EAAA;AACbA,YAAAA,GAAAA,gBAAAA;AACH,YAAA;gBACEO,SAAW,EAAA;oBAAEC,IAAM,EAAA;AAAS,iBAAA;gBAC5BC,KAAO,EAAA;AACLC,oBAAAA,EAAAA,EAAIC,cAAe,CAAA,8BAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;gBACAC,UAAY,EAAA,KAAA;gBACZC,QAAU,EAAA,KAAA;gBACVC,IAAM,EAAA,SAAA;;AAENC,gBAAAA,aAAAA,EAAe,CAACC,KAAAA,EAAOC,OAASC,EAAAA,IAAAA,iBAASC,GAACC,CAAAA,cAAAA,EAAAA;AAAgB,wBAAA,GAAGJ,KAAK;AAAG,wBAAA,GAAGE;;AAC1E;AACD,SAAA;AACDlB,QAAAA;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"listView.mjs","sources":["../../../admin/src/contentManagerHooks/listView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { LocaleListCell } from '../components/LocaleListCell';\nimport { doesPluginOptionsHaveI18nLocalized } from '../utils/fields';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { ListFieldLayout, ListLayout } from '@strapi/content-manager/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * addColumnToTableHook\n * -----------------------------------------------------------------------------------------------*/\ninterface AddColumnToTableHookArgs {\n layout: ListLayout;\n displayedHeaders: ListFieldLayout[];\n}\n\nconst addColumnToTableHook = ({ displayedHeaders, layout }: AddColumnToTableHookArgs) => {\n const { options } = layout;\n\n const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options)\n ? options.i18n.localized\n : false;\n\n if (!isFieldLocalized) {\n return { displayedHeaders, layout };\n }\n\n return {\n displayedHeaders: [\n ...displayedHeaders,\n {\n attribute: { type: 'string' },\n label: {\n id: getTranslation('list-view.table.header.label'),\n defaultMessage: 'Available in',\n },\n searchable: false,\n sortable: false,\n name: 'locales',\n // @ts-expect-error – ID is seen as number | string; this will change when we move the type over.\n cellFormatter: (props, _header, meta) => (\n <LocaleListCell {...props} {...meta} documentId={props.documentId} />\n ),\n },\n ],\n layout,\n };\n};\n\nexport { addColumnToTableHook };\n"],"names":["addColumnToTableHook","displayedHeaders","layout","options","isFieldLocalized","doesPluginOptionsHaveI18nLocalized","i18n","localized","attribute","type","label","id","getTranslation","defaultMessage","searchable","sortable","name","cellFormatter","props","_header","meta","_jsx","LocaleListCell","documentId"],"mappings":";;;;;AAeA,MAAMA,uBAAuB,CAAC,EAAEC,gBAAgB,EAAEC,MAAM,EAA4B,GAAA;IAClF,MAAM,EAAEC,OAAO,EAAE,GAAGD,MAAAA;AAEpB,IAAA,MAAME,mBAAmBC,kCAAmCF,CAAAA,OAAAA,CAAAA,GACxDA,QAAQG,IAAI,CAACC,SAAS,GACtB,KAAA;AAEJ,IAAA,IAAI,CAACH,gBAAkB,EAAA;QACrB,OAAO;AAAEH,YAAAA,gBAAAA;AAAkBC,YAAAA;AAAO,SAAA;AACpC;IAEA,OAAO;QACLD,gBAAkB,EAAA;AACbA,YAAAA,GAAAA,gBAAAA;AACH,YAAA;gBACEO,SAAW,EAAA;oBAAEC,IAAM,EAAA;AAAS,iBAAA;gBAC5BC,KAAO,EAAA;AACLC,oBAAAA,EAAAA,EAAIC,cAAe,CAAA,8BAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;gBACAC,UAAY,EAAA,KAAA;gBACZC,QAAU,EAAA,KAAA;gBACVC,IAAM,EAAA,SAAA;;AAENC,gBAAAA,aAAAA,EAAe,CAACC,KAAAA,EAAOC,OAASC,EAAAA,IAAAA,iBAC9BC,GAACC,CAAAA,cAAAA,EAAAA;AAAgB,wBAAA,GAAGJ,KAAK;AAAG,wBAAA,GAAGE,IAAI;AAAEG,wBAAAA,UAAAA,EAAYL,MAAMK;;AAE3D;AACD,SAAA;AACDrB,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var strapiAdmin = require('@strapi/admin/strapi-admin');
5
+ var reactIntl = require('react-intl');
6
+ var aiLocalizationJobs = require('../services/aiLocalizationJobs.js');
7
+ var getTranslation = require('../utils/getTranslation.js');
8
+
9
+ function _interopNamespaceDefault(e) {
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
27
+
28
+ const useAILocalizationJobsPolling = ({ documentId, model, collectionType })=>{
29
+ const { toggleNotification } = strapiAdmin.useNotification();
30
+ const { formatMessage } = reactIntl.useIntl();
31
+ const [previousJobStatus, setPreviousJobStatus] = React__namespace.useState(null);
32
+ /**
33
+ * NOTE:
34
+ * Due to a limitation with RTK query it is not possible to dynamically update the polling interval
35
+ * @see https://github.com/reduxjs/redux-toolkit/issues/1651
36
+ */ const { data: initialJobData } = aiLocalizationJobs.useGetAILocalizationJobsByDocumentQuery({
37
+ documentId: documentId,
38
+ model: model,
39
+ collectionType: collectionType
40
+ });
41
+ const shouldPoll = initialJobData?.data?.status === 'processing' || previousJobStatus === 'processing';
42
+ const { data: jobData } = aiLocalizationJobs.useGetAILocalizationJobsByDocumentQuery({
43
+ documentId: documentId,
44
+ model: model,
45
+ collectionType: collectionType
46
+ }, {
47
+ skip: !shouldPoll,
48
+ pollingInterval: 1000
49
+ });
50
+ const job = jobData?.data || initialJobData?.data;
51
+ const currentJobStatus = job?.status;
52
+ // Check for job status changes and trigger callbacks
53
+ React__namespace.useEffect(()=>{
54
+ if (!currentJobStatus) return;
55
+ // Detect transition from 'processing' to a terminal state
56
+ if (previousJobStatus === 'processing' && currentJobStatus === 'completed') {
57
+ toggleNotification({
58
+ type: 'success',
59
+ message: formatMessage({
60
+ id: getTranslation.getTranslation('CMEditViewAITranslation.job-completed'),
61
+ defaultMessage: 'AI translation completed successfully!'
62
+ })
63
+ });
64
+ }
65
+ if (previousJobStatus === 'processing' && currentJobStatus === 'failed') {
66
+ toggleNotification({
67
+ type: 'warning',
68
+ message: formatMessage({
69
+ id: getTranslation.getTranslation('CMEditViewAITranslation.job-failed'),
70
+ defaultMessage: 'AI translation failed. Please try again.'
71
+ })
72
+ });
73
+ }
74
+ // Update the previous status if it changed
75
+ if (previousJobStatus !== currentJobStatus) {
76
+ setPreviousJobStatus(currentJobStatus);
77
+ }
78
+ }, [
79
+ currentJobStatus,
80
+ previousJobStatus,
81
+ setPreviousJobStatus,
82
+ toggleNotification,
83
+ formatMessage
84
+ ]);
85
+ return {
86
+ status: job?.status
87
+ };
88
+ };
89
+
90
+ exports.useAILocalizationJobsPolling = useAILocalizationJobsPolling;
91
+ //# sourceMappingURL=useAILocalizationJobsPolling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAILocalizationJobsPolling.js","sources":["../../../admin/src/hooks/useAILocalizationJobsPolling.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { useNotification } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { AILocalizationJobs } from '../../../shared/contracts/ai-localization-jobs';\nimport { useGetAILocalizationJobsByDocumentQuery } from '../services/aiLocalizationJobs';\nimport { getTranslation } from '../utils/getTranslation';\n\ninterface UseAILocalizationJobsPollingOptions {\n documentId?: string;\n model?: string;\n collectionType?: string;\n}\n\nexport const useAILocalizationJobsPolling = ({\n documentId,\n model,\n collectionType,\n}: UseAILocalizationJobsPollingOptions) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n\n const [previousJobStatus, setPreviousJobStatus] = React.useState<\n AILocalizationJobs['status'] | null\n >(null);\n\n /**\n * NOTE:\n * Due to a limitation with RTK query it is not possible to dynamically update the polling interval\n * @see https://github.com/reduxjs/redux-toolkit/issues/1651\n */\n const { data: initialJobData } = useGetAILocalizationJobsByDocumentQuery({\n documentId: documentId!,\n model: model!,\n collectionType: collectionType!,\n });\n\n const shouldPoll =\n initialJobData?.data?.status === 'processing' || previousJobStatus === 'processing';\n const { data: jobData } = useGetAILocalizationJobsByDocumentQuery(\n { documentId: documentId!, model: model!, collectionType: collectionType! },\n {\n skip: !shouldPoll,\n pollingInterval: 1000,\n }\n );\n\n const job = jobData?.data || initialJobData?.data;\n const currentJobStatus = job?.status;\n\n // Check for job status changes and trigger callbacks\n React.useEffect(() => {\n if (!currentJobStatus) return;\n\n // Detect transition from 'processing' to a terminal state\n if (previousJobStatus === 'processing' && currentJobStatus === 'completed') {\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('CMEditViewAITranslation.job-completed'),\n defaultMessage: 'AI translation completed successfully!',\n }),\n });\n }\n\n if (previousJobStatus === 'processing' && currentJobStatus === 'failed') {\n toggleNotification({\n type: 'warning',\n message: formatMessage({\n id: getTranslation('CMEditViewAITranslation.job-failed'),\n defaultMessage: 'AI translation failed. Please try again.',\n }),\n });\n }\n\n // Update the previous status if it changed\n if (previousJobStatus !== currentJobStatus) {\n setPreviousJobStatus(currentJobStatus);\n }\n }, [\n currentJobStatus,\n previousJobStatus,\n setPreviousJobStatus,\n toggleNotification,\n formatMessage,\n ]);\n\n return {\n status: job?.status,\n };\n};\n"],"names":["useAILocalizationJobsPolling","documentId","model","collectionType","toggleNotification","useNotification","formatMessage","useIntl","previousJobStatus","setPreviousJobStatus","React","useState","data","initialJobData","useGetAILocalizationJobsByDocumentQuery","shouldPoll","status","jobData","skip","pollingInterval","job","currentJobStatus","useEffect","type","message","id","getTranslation","defaultMessage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAeO,MAAMA,+BAA+B,CAAC,EAC3CC,UAAU,EACVC,KAAK,EACLC,cAAc,EACsB,GAAA;IACpC,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,2BAAAA,EAAAA;IAC/B,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAE1B,IAAA,MAAM,CAACC,iBAAmBC,EAAAA,oBAAAA,CAAqB,GAAGC,gBAAAA,CAAMC,QAAQ,CAE9D,IAAA,CAAA;AAEF;;;;AAIC,MACD,MAAM,EAAEC,IAAAA,EAAMC,cAAc,EAAE,GAAGC,0DAAwC,CAAA;QACvEb,UAAYA,EAAAA,UAAAA;QACZC,KAAOA,EAAAA,KAAAA;QACPC,cAAgBA,EAAAA;AAClB,KAAA,CAAA;AAEA,IAAA,MAAMY,UACJF,GAAAA,cAAAA,EAAgBD,IAAMI,EAAAA,MAAAA,KAAW,gBAAgBR,iBAAsB,KAAA,YAAA;AACzE,IAAA,MAAM,EAAEI,IAAAA,EAAMK,OAAO,EAAE,GAAGH,0DACxB,CAAA;QAAEb,UAAYA,EAAAA,UAAAA;QAAaC,KAAOA,EAAAA,KAAAA;QAAQC,cAAgBA,EAAAA;KAC1D,EAAA;AACEe,QAAAA,IAAAA,EAAM,CAACH,UAAAA;QACPI,eAAiB,EAAA;AACnB,KAAA,CAAA;IAGF,MAAMC,GAAAA,GAAMH,OAASL,EAAAA,IAAAA,IAAQC,cAAgBD,EAAAA,IAAAA;AAC7C,IAAA,MAAMS,mBAAmBD,GAAKJ,EAAAA,MAAAA;;AAG9BN,IAAAA,gBAAAA,CAAMY,SAAS,CAAC,IAAA;AACd,QAAA,IAAI,CAACD,gBAAkB,EAAA;;QAGvB,IAAIb,iBAAAA,KAAsB,YAAgBa,IAAAA,gBAAAA,KAAqB,WAAa,EAAA;YAC1EjB,kBAAmB,CAAA;gBACjBmB,IAAM,EAAA,SAAA;AACNC,gBAAAA,OAAAA,EAASlB,aAAc,CAAA;AACrBmB,oBAAAA,EAAAA,EAAIC,6BAAe,CAAA,uCAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;AACF,aAAA,CAAA;AACF;QAEA,IAAInB,iBAAAA,KAAsB,YAAgBa,IAAAA,gBAAAA,KAAqB,QAAU,EAAA;YACvEjB,kBAAmB,CAAA;gBACjBmB,IAAM,EAAA,SAAA;AACNC,gBAAAA,OAAAA,EAASlB,aAAc,CAAA;AACrBmB,oBAAAA,EAAAA,EAAIC,6BAAe,CAAA,oCAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;AACF,aAAA,CAAA;AACF;;AAGA,QAAA,IAAInB,sBAAsBa,gBAAkB,EAAA;YAC1CZ,oBAAqBY,CAAAA,gBAAAA,CAAAA;AACvB;KACC,EAAA;AACDA,QAAAA,gBAAAA;AACAb,QAAAA,iBAAAA;AACAC,QAAAA,oBAAAA;AACAL,QAAAA,kBAAAA;AACAE,QAAAA;AACD,KAAA,CAAA;IAED,OAAO;AACLU,QAAAA,MAAAA,EAAQI,GAAKJ,EAAAA;AACf,KAAA;AACF;;;;"}
@@ -0,0 +1,70 @@
1
+ import * as React from 'react';
2
+ import { useNotification } from '@strapi/admin/strapi-admin';
3
+ import { useIntl } from 'react-intl';
4
+ import { useGetAILocalizationJobsByDocumentQuery } from '../services/aiLocalizationJobs.mjs';
5
+ import { getTranslation } from '../utils/getTranslation.mjs';
6
+
7
+ const useAILocalizationJobsPolling = ({ documentId, model, collectionType })=>{
8
+ const { toggleNotification } = useNotification();
9
+ const { formatMessage } = useIntl();
10
+ const [previousJobStatus, setPreviousJobStatus] = React.useState(null);
11
+ /**
12
+ * NOTE:
13
+ * Due to a limitation with RTK query it is not possible to dynamically update the polling interval
14
+ * @see https://github.com/reduxjs/redux-toolkit/issues/1651
15
+ */ const { data: initialJobData } = useGetAILocalizationJobsByDocumentQuery({
16
+ documentId: documentId,
17
+ model: model,
18
+ collectionType: collectionType
19
+ });
20
+ const shouldPoll = initialJobData?.data?.status === 'processing' || previousJobStatus === 'processing';
21
+ const { data: jobData } = useGetAILocalizationJobsByDocumentQuery({
22
+ documentId: documentId,
23
+ model: model,
24
+ collectionType: collectionType
25
+ }, {
26
+ skip: !shouldPoll,
27
+ pollingInterval: 1000
28
+ });
29
+ const job = jobData?.data || initialJobData?.data;
30
+ const currentJobStatus = job?.status;
31
+ // Check for job status changes and trigger callbacks
32
+ React.useEffect(()=>{
33
+ if (!currentJobStatus) return;
34
+ // Detect transition from 'processing' to a terminal state
35
+ if (previousJobStatus === 'processing' && currentJobStatus === 'completed') {
36
+ toggleNotification({
37
+ type: 'success',
38
+ message: formatMessage({
39
+ id: getTranslation('CMEditViewAITranslation.job-completed'),
40
+ defaultMessage: 'AI translation completed successfully!'
41
+ })
42
+ });
43
+ }
44
+ if (previousJobStatus === 'processing' && currentJobStatus === 'failed') {
45
+ toggleNotification({
46
+ type: 'warning',
47
+ message: formatMessage({
48
+ id: getTranslation('CMEditViewAITranslation.job-failed'),
49
+ defaultMessage: 'AI translation failed. Please try again.'
50
+ })
51
+ });
52
+ }
53
+ // Update the previous status if it changed
54
+ if (previousJobStatus !== currentJobStatus) {
55
+ setPreviousJobStatus(currentJobStatus);
56
+ }
57
+ }, [
58
+ currentJobStatus,
59
+ previousJobStatus,
60
+ setPreviousJobStatus,
61
+ toggleNotification,
62
+ formatMessage
63
+ ]);
64
+ return {
65
+ status: job?.status
66
+ };
67
+ };
68
+
69
+ export { useAILocalizationJobsPolling };
70
+ //# sourceMappingURL=useAILocalizationJobsPolling.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAILocalizationJobsPolling.mjs","sources":["../../../admin/src/hooks/useAILocalizationJobsPolling.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { useNotification } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\n\nimport { AILocalizationJobs } from '../../../shared/contracts/ai-localization-jobs';\nimport { useGetAILocalizationJobsByDocumentQuery } from '../services/aiLocalizationJobs';\nimport { getTranslation } from '../utils/getTranslation';\n\ninterface UseAILocalizationJobsPollingOptions {\n documentId?: string;\n model?: string;\n collectionType?: string;\n}\n\nexport const useAILocalizationJobsPolling = ({\n documentId,\n model,\n collectionType,\n}: UseAILocalizationJobsPollingOptions) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n\n const [previousJobStatus, setPreviousJobStatus] = React.useState<\n AILocalizationJobs['status'] | null\n >(null);\n\n /**\n * NOTE:\n * Due to a limitation with RTK query it is not possible to dynamically update the polling interval\n * @see https://github.com/reduxjs/redux-toolkit/issues/1651\n */\n const { data: initialJobData } = useGetAILocalizationJobsByDocumentQuery({\n documentId: documentId!,\n model: model!,\n collectionType: collectionType!,\n });\n\n const shouldPoll =\n initialJobData?.data?.status === 'processing' || previousJobStatus === 'processing';\n const { data: jobData } = useGetAILocalizationJobsByDocumentQuery(\n { documentId: documentId!, model: model!, collectionType: collectionType! },\n {\n skip: !shouldPoll,\n pollingInterval: 1000,\n }\n );\n\n const job = jobData?.data || initialJobData?.data;\n const currentJobStatus = job?.status;\n\n // Check for job status changes and trigger callbacks\n React.useEffect(() => {\n if (!currentJobStatus) return;\n\n // Detect transition from 'processing' to a terminal state\n if (previousJobStatus === 'processing' && currentJobStatus === 'completed') {\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('CMEditViewAITranslation.job-completed'),\n defaultMessage: 'AI translation completed successfully!',\n }),\n });\n }\n\n if (previousJobStatus === 'processing' && currentJobStatus === 'failed') {\n toggleNotification({\n type: 'warning',\n message: formatMessage({\n id: getTranslation('CMEditViewAITranslation.job-failed'),\n defaultMessage: 'AI translation failed. Please try again.',\n }),\n });\n }\n\n // Update the previous status if it changed\n if (previousJobStatus !== currentJobStatus) {\n setPreviousJobStatus(currentJobStatus);\n }\n }, [\n currentJobStatus,\n previousJobStatus,\n setPreviousJobStatus,\n toggleNotification,\n formatMessage,\n ]);\n\n return {\n status: job?.status,\n };\n};\n"],"names":["useAILocalizationJobsPolling","documentId","model","collectionType","toggleNotification","useNotification","formatMessage","useIntl","previousJobStatus","setPreviousJobStatus","React","useState","data","initialJobData","useGetAILocalizationJobsByDocumentQuery","shouldPoll","status","jobData","skip","pollingInterval","job","currentJobStatus","useEffect","type","message","id","getTranslation","defaultMessage"],"mappings":";;;;;;AAeO,MAAMA,+BAA+B,CAAC,EAC3CC,UAAU,EACVC,KAAK,EACLC,cAAc,EACsB,GAAA;IACpC,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,eAAAA,EAAAA;IAC/B,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,MAAM,CAACC,iBAAmBC,EAAAA,oBAAAA,CAAqB,GAAGC,KAAAA,CAAMC,QAAQ,CAE9D,IAAA,CAAA;AAEF;;;;AAIC,MACD,MAAM,EAAEC,IAAAA,EAAMC,cAAc,EAAE,GAAGC,uCAAwC,CAAA;QACvEb,UAAYA,EAAAA,UAAAA;QACZC,KAAOA,EAAAA,KAAAA;QACPC,cAAgBA,EAAAA;AAClB,KAAA,CAAA;AAEA,IAAA,MAAMY,UACJF,GAAAA,cAAAA,EAAgBD,IAAMI,EAAAA,MAAAA,KAAW,gBAAgBR,iBAAsB,KAAA,YAAA;AACzE,IAAA,MAAM,EAAEI,IAAAA,EAAMK,OAAO,EAAE,GAAGH,uCACxB,CAAA;QAAEb,UAAYA,EAAAA,UAAAA;QAAaC,KAAOA,EAAAA,KAAAA;QAAQC,cAAgBA,EAAAA;KAC1D,EAAA;AACEe,QAAAA,IAAAA,EAAM,CAACH,UAAAA;QACPI,eAAiB,EAAA;AACnB,KAAA,CAAA;IAGF,MAAMC,GAAAA,GAAMH,OAASL,EAAAA,IAAAA,IAAQC,cAAgBD,EAAAA,IAAAA;AAC7C,IAAA,MAAMS,mBAAmBD,GAAKJ,EAAAA,MAAAA;;AAG9BN,IAAAA,KAAAA,CAAMY,SAAS,CAAC,IAAA;AACd,QAAA,IAAI,CAACD,gBAAkB,EAAA;;QAGvB,IAAIb,iBAAAA,KAAsB,YAAgBa,IAAAA,gBAAAA,KAAqB,WAAa,EAAA;YAC1EjB,kBAAmB,CAAA;gBACjBmB,IAAM,EAAA,SAAA;AACNC,gBAAAA,OAAAA,EAASlB,aAAc,CAAA;AACrBmB,oBAAAA,EAAAA,EAAIC,cAAe,CAAA,uCAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;AACF,aAAA,CAAA;AACF;QAEA,IAAInB,iBAAAA,KAAsB,YAAgBa,IAAAA,gBAAAA,KAAqB,QAAU,EAAA;YACvEjB,kBAAmB,CAAA;gBACjBmB,IAAM,EAAA,SAAA;AACNC,gBAAAA,OAAAA,EAASlB,aAAc,CAAA;AACrBmB,oBAAAA,EAAAA,EAAIC,cAAe,CAAA,oCAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;AACF,aAAA,CAAA;AACF;;AAGA,QAAA,IAAInB,sBAAsBa,gBAAkB,EAAA;YAC1CZ,oBAAqBY,CAAAA,gBAAAA,CAAAA;AACvB;KACC,EAAA;AACDA,QAAAA,gBAAAA;AACAb,QAAAA,iBAAAA;AACAC,QAAAA,oBAAAA;AACAL,QAAAA,kBAAAA;AACAE,QAAAA;AACD,KAAA,CAAA;IAED,OAAO;AACLU,QAAAA,MAAAA,EAAQI,GAAKJ,EAAAA;AACf,KAAA;AACF;;;;"}
@@ -104,6 +104,7 @@ var index = {
104
104
  });
105
105
  const contentManager = app.getPlugin('content-manager');
106
106
  contentManager.apis.addDocumentHeaderAction([
107
+ CMHeaderActions.AITranslationStatusAction,
107
108
  CMHeaderActions.LocalePickerAction,
108
109
  CMHeaderActions.FillFromAnotherLocaleAction
109
110
  ]);
@@ -175,7 +176,6 @@ var index = {
175
176
  return [];
176
177
  }
177
178
  const hasI18nEnabled = get(contentTypeSchema, [
178
- 'schema',
179
179
  'pluginOptions',
180
180
  'i18n',
181
181
  'localized'