@strapi/i18n 0.0.0-next.88599e70ce0e4e804e2bad578aba4718c5a5304d → 0.0.0-next.88e2effa81cb9544dd09eb0536e39c3fed6ef4c9
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.
- package/dist/admin/components/CMHeaderActions.js +18 -2
- package/dist/admin/components/CMHeaderActions.js.map +1 -1
- package/dist/admin/components/CMHeaderActions.mjs +18 -2
- package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
- package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
- package/dist/admin/services/aiLocalizationJobs.js +26 -0
- package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
- package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
- package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
- package/dist/admin/services/api.js +2 -1
- package/dist/admin/services/api.js.map +1 -1
- package/dist/admin/services/api.mjs +2 -1
- package/dist/admin/services/api.mjs.map +1 -1
- package/dist/admin/src/components/CMHeaderActions.d.ts +1 -1
- package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
- package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/locales.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +1 -1
- package/dist/admin/src/services/settings.d.ts +2 -2
- package/dist/admin/translations/en.json.js +2 -0
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +2 -0
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/server/bootstrap.js +2 -0
- package/dist/server/bootstrap.js.map +1 -1
- package/dist/server/bootstrap.mjs +2 -0
- package/dist/server/bootstrap.mjs.map +1 -1
- package/dist/server/controllers/ai-localization-jobs.js +47 -0
- package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
- package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
- package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
- package/dist/server/controllers/index.js +3 -1
- package/dist/server/controllers/index.js.map +1 -1
- package/dist/server/controllers/index.mjs +3 -1
- package/dist/server/controllers/index.mjs.map +1 -1
- package/dist/server/models/ai-localization-job.js +60 -0
- package/dist/server/models/ai-localization-job.js.map +1 -0
- package/dist/server/models/ai-localization-job.mjs +57 -0
- package/dist/server/models/ai-localization-job.mjs.map +1 -0
- package/dist/server/register.js +3 -1
- package/dist/server/register.js.map +1 -1
- package/dist/server/register.mjs +3 -1
- package/dist/server/register.mjs.map +1 -1
- package/dist/server/routes/admin.js +20 -0
- package/dist/server/routes/admin.js.map +1 -1
- package/dist/server/routes/admin.mjs +20 -0
- package/dist/server/routes/admin.mjs.map +1 -1
- package/dist/server/services/ai-localization-jobs.js +64 -0
- package/dist/server/services/ai-localization-jobs.js.map +1 -0
- package/dist/server/services/ai-localization-jobs.mjs +62 -0
- package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
- package/dist/server/services/ai-localizations.js +209 -0
- package/dist/server/services/ai-localizations.js.map +1 -1
- package/dist/server/services/ai-localizations.mjs +209 -0
- package/dist/server/services/ai-localizations.mjs.map +1 -1
- package/dist/server/services/index.js +3 -1
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +3 -1
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
- package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +6 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +26 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/models/ai-localization-job.d.ts +5 -0
- package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
- package/dist/server/src/models/index.d.ts +5 -0
- package/dist/server/src/models/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/admin.d.ts.map +1 -1
- package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
- package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
- package/dist/server/src/services/ai-localizations.d.ts +11 -1
- package/dist/server/src/services/ai-localizations.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +19 -1
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +4 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
- package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
- package/dist/shared/contracts/shared.d.ts.map +1 -0
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CMHeaderActions.mjs","sources":["../../../admin/src/components/CMHeaderActions.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { skipToken } from '@reduxjs/toolkit/query';\nimport {\n useNotification,\n useQueryParams,\n Table,\n useAPIErrorHandler,\n FormErrors,\n useForm,\n} from '@strapi/admin/strapi-admin';\nimport { useAIAvailability } from '@strapi/admin/strapi-admin/ee';\nimport {\n type DocumentActionComponent,\n type DocumentActionProps,\n unstable_useDocument as useDocument,\n unstable_useDocumentActions as useDocumentActions,\n buildValidParams,\n HeaderActionProps,\n} from '@strapi/content-manager/strapi-admin';\nimport {\n Flex,\n Status,\n Typography,\n Button,\n Modal,\n Field,\n SingleSelect,\n SingleSelectOption,\n Dialog,\n type StatusVariant,\n Box,\n Link,\n} from '@strapi/design-system';\nimport { WarningCircle, ListPlus, Trash, Earth, Cross, Plus, Sparkle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { NavLink, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { useGetManyDraftRelationCountQuery } from '../services/relations';\nimport { useGetSettingsQuery } from '../services/settings';\nimport { cleanData } from '../utils/clean';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { BulkLocaleActionModal } from './BulkLocaleActionModal';\n\nimport type { Locale } from '../../../shared/contracts/locales';\nimport type { I18nBaseQuery } from '../types';\nimport type { Modules } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * LocalePickerAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LocaleOptionProps {\n isDraftAndPublishEnabled: boolean;\n locale: Locale;\n status: 'draft' | 'published' | 'modified';\n entryExists: boolean;\n}\n\nconst statusVariants: Record<LocaleOptionProps['status'], StatusVariant> = {\n draft: 'secondary',\n published: 'success',\n modified: 'alternative',\n};\n\nconst LocaleOption = ({\n isDraftAndPublishEnabled,\n locale,\n status,\n entryExists,\n}: LocaleOptionProps) => {\n const { formatMessage } = useIntl();\n\n if (!entryExists) {\n return formatMessage(\n {\n id: getTranslation('CMEditViewLocalePicker.locale.create'),\n defaultMessage: 'Create <bold>{locale}</bold> locale',\n },\n {\n bold: (locale: React.ReactNode) => <b>{locale}</b>,\n locale: locale.name,\n }\n );\n }\n\n return (\n <Flex width=\"100%\" gap={1} justifyContent=\"space-between\">\n <Typography>{locale.name}</Typography>\n {isDraftAndPublishEnabled ? (\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size=\"S\"\n variant={statusVariants[status]}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n ) : null}\n </Flex>\n );\n};\n\nconst LocalePickerAction = ({\n document,\n meta,\n model,\n collectionType,\n documentId,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<I18nBaseQuery>();\n const { hasI18n, canCreate, canRead } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const { schema } = useDocument({\n model,\n collectionType,\n documentId,\n params: { locale: currentDesiredLocale },\n });\n\n const handleSelect = React.useCallback(\n (value: string) => {\n setQuery({\n plugins: {\n ...query.plugins,\n i18n: {\n locale: value,\n },\n },\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 doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleSelect(defaultLocale.code);\n }\n }, [handleSelect, hasI18n, locales, currentDesiredLocale]);\n\n const currentLocale = Array.isArray(locales)\n ? locales.find((locale) => locale.code === currentDesiredLocale)\n : undefined;\n\n // Use meta.availableLocales instead of document.localizations\n // meta.availableLocales contains all locales for the document, even when creating new locales\n const availableLocales = meta?.availableLocales ?? [];\n const documentLocalizations = document?.localizations ?? [];\n\n // Prefer meta.availableLocales as it's more reliable, fallback to document.localizations\n const allLocalizations = availableLocales.length > 0 ? availableLocales : documentLocalizations;\n\n const allCurrentLocales = [\n { status: getDocumentStatus(document, meta), locale: currentLocale?.code },\n ...allLocalizations,\n ];\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 read we allow you to see the locale exists\n * otherwise the locale is hidden.\n */\n return canRead.includes(locale.code);\n });\n\n return {\n label: formatMessage({\n id: getTranslation('Settings.locales.modal.locales.label'),\n defaultMessage: 'Locales',\n }),\n options: displayedLocales.map((locale) => {\n const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);\n\n const currentLocaleDoc = allCurrentLocales.find((doc) =>\n 'locale' in doc ? doc.locale === locale.code : false\n );\n\n const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;\n\n return {\n disabled: !permissionsToCheck.includes(locale.code),\n value: locale.code,\n label: (\n <LocaleOption\n isDraftAndPublishEnabled={!!schema?.options?.draftAndPublish}\n locale={locale}\n status={currentLocaleDoc?.status}\n entryExists={entryWithLocaleExists}\n />\n ),\n startIcon: !entryWithLocaleExists ? <Plus /> : null,\n };\n }),\n customizeContent: () => currentLocale?.name,\n onSelect: handleSelect,\n value: currentLocale,\n };\n};\n\ntype UseDocument = typeof useDocument;\n\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AISettingsStatusAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst AITranslationStatusIcon = styled(Status)<{ $isAISettingEnabled: boolean }>`\n display: flex;\n gap: ${({ theme }) => theme.spaces[1]};\n justify-content: center;\n align-items: center;\n height: 100%;\n\n // Disabled state\n ${({ $isAISettingEnabled, theme }) =>\n !$isAISettingEnabled &&\n `\n background-color: ${theme.colors.neutral150};\n `}\n\n svg {\n ${({ $isAISettingEnabled, theme }) =>\n !$isAISettingEnabled &&\n `\n fill: ${theme.colors.neutral300};\n `}\n }\n`;\n\nconst AITranslationStatusAction = () => {\n const { formatMessage } = useIntl();\n const isAIAvailable = useAIAvailability();\n const { data: settings } = useGetSettingsQuery();\n const isAISettingEnabled = settings?.data?.aiLocalizations;\n const { hasI18n } = useI18n();\n\n // Do not display this action when i18n is not available\n if (!hasI18n) {\n return null;\n }\n\n // Do not display this action when AI is not available\n const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');\n if (!isAIAvailable || !hasAIFutureFlag) {\n return null;\n }\n\n return {\n status: {\n message: (\n <Box\n height=\"100%\"\n aria-label={formatMessage({\n id: getTranslation('CMEditViewAITranslation.status-aria-label'),\n defaultMessage: 'AI Translation Status',\n })}\n >\n <AITranslationStatusIcon\n $isAISettingEnabled={Boolean(isAISettingEnabled)}\n variant={isAISettingEnabled ? 'alternative' : 'neutral'}\n size=\"S\"\n >\n <Sparkle />\n </AITranslationStatusIcon>\n </Box>\n ),\n tooltip: (\n <Flex direction=\"column\" padding={4} alignItems=\"flex-start\" width=\"25rem\">\n <Typography variant=\"pi\" fontWeight=\"600\">\n {formatMessage(\n {\n id: getTranslation('CMEditViewAITranslation.status-title'),\n defaultMessage:\n '{enabled, select, true {AI translation enabled} false {AI translation disabled} other {AI translation disabled}}',\n },\n { enabled: isAISettingEnabled }\n )}\n </Typography>\n <Typography variant=\"pi\" paddingTop={1} paddingBottom={3}>\n {formatMessage({\n id: getTranslation('CMEditViewAITranslation.status-description'),\n defaultMessage:\n 'Our AI translates content in all locales each time you save a modification.',\n })}\n </Typography>\n <Link\n fontSize=\"inherit\"\n tag={NavLink}\n to=\"/settings/internationalization\"\n style={{ alignSelf: 'flex-end' }}\n >\n <Typography variant=\"pi\" textAlign=\"right\">\n {formatMessage(\n {\n id: getTranslation('CMEditViewAITranslation.settings-link'),\n defaultMessage:\n '{enabled, select, true {Disable it in settings} false {Enable it in settings} other {Enable it in settings}}',\n },\n { enabled: isAISettingEnabled }\n )}\n </Typography>\n </Link>\n </Flex>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FillFromAnotherLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst FillFromAnotherLocaleAction = ({\n documentId,\n meta,\n model,\n collectionType,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { hasI18n } = useI18n();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const [localeSelected, setLocaleSelected] = React.useState<string | null>(null);\n const setValues = useForm('FillFromAnotherLocale', (state) => state.setValues);\n\n const { getDocument } = useDocumentActions();\n const { schema, components } = useDocument({\n model,\n documentId,\n collectionType,\n params: { locale: currentDesiredLocale },\n });\n const { data: locales = [] } = useGetLocalesQuery();\n\n const isAIAvailable = useAIAvailability();\n const { data: settings } = useGetSettingsQuery();\n const isAISettingEnabled = settings?.data?.aiLocalizations;\n\n const availableLocales = Array.isArray(locales)\n ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code))\n : [];\n\n const fillFromLocale = (onClose: () => void) => async () => {\n const response = await getDocument({\n collectionType,\n model,\n documentId,\n params: { locale: localeSelected },\n });\n if (!response || !schema) {\n return;\n }\n\n const { data } = response;\n\n const cleanedData = cleanData(data, schema, components);\n\n setValues(cleanedData);\n\n onClose();\n };\n\n if (!hasI18n) {\n return null;\n }\n\n // Do not display this action when AI is available and AI translations are enabled\n const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');\n if (hasAIFutureFlag && isAIAvailable && isAISettingEnabled) {\n return null;\n }\n\n return {\n type: 'icon',\n icon: <Earth />,\n disabled: availableLocales.length === 0,\n label: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.copy-text'),\n defaultMessage: 'Fill in from another locale',\n }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: ({ onClose }: { onClose: () => void }) => (\n <>\n <Dialog.Body>\n <Flex direction=\"column\" gap={3}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.body'),\n defaultMessage:\n 'Your current content will be erased and filled by the content of the selected locale:',\n })}\n </Typography>\n <Field.Root width=\"100%\">\n <Field.Label>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.label'),\n defaultMessage: 'Locale',\n })}\n </Field.Label>\n <SingleSelect\n value={localeSelected}\n placeholder={formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.placeholder'),\n defaultMessage: 'Select one locale...',\n })}\n // @ts-expect-error – the DS will handle numbers, but we're not allowing the API.\n onChange={(value) => setLocaleSelected(value)}\n >\n {availableLocales.map((locale) => (\n <SingleSelectOption key={locale.code} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n </Field.Root>\n </Flex>\n </Dialog.Body>\n <Dialog.Footer>\n <Flex gap={2} width=\"100%\">\n <Button flex=\"auto\" variant=\"tertiary\" onClick={onClose}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.cancel-text'),\n defaultMessage: 'No, cancel',\n })}\n </Button>\n <Button flex=\"auto\" variant=\"success\" onClick={fillFromLocale(onClose)}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.submit-text'),\n defaultMessage: 'Yes, fill in',\n })}\n </Button>\n </Flex>\n </Dialog.Footer>\n </>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DeleteLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst DeleteLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n}) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const { toggleNotification } = useNotification();\n const { delete: deleteAction, isLoading } = useDocumentActions();\n const { hasI18n, canDelete } = useI18n();\n\n // Get the current locale object, using the URL instead of document so it works while creating\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const locale = !('error' in locales) && locales.find((loc) => loc.code === currentDesiredLocale);\n\n if (!hasI18n) {\n return null;\n }\n\n return {\n disabled:\n (document?.locale && !canDelete.includes(document.locale)) || !document || !document.id,\n position: ['header', 'table-row'],\n label: formatMessage(\n {\n id: getTranslation('actions.delete.label'),\n defaultMessage: 'Delete entry ({locale})',\n },\n { locale: locale && locale.name }\n ),\n icon: <StyledTrash />,\n variant: 'danger',\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.delete.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" gap={2}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography tag=\"p\" variant=\"omega\" textAlign=\"center\">\n {formatMessage({\n id: getTranslation('actions.delete.dialog.body'),\n defaultMessage: 'Are you sure?',\n })}\n </Typography>\n </Flex>\n ),\n loading: isLoading,\n onConfirm: async () => {\n const unableToDelete =\n // We are unable to delete a collection type without a document ID\n // & unable to delete generally if there is no document locale\n (collectionType !== 'single-types' && !documentId) || !document?.locale;\n\n if (unableToDelete) {\n console.error(\n \"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: getTranslation('actions.delete.error'),\n defaultMessage: 'An error occurred while trying to delete the document locale.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n const res = await deleteAction({\n documentId,\n model,\n collectionType,\n params: { locale: document.locale },\n });\n\n if (!('error' in res)) {\n navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });\n }\n },\n },\n };\n};\n\nexport type LocaleStatus = {\n locale: string;\n status: Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n};\n\ninterface ExtendedDocumentActionProps extends DocumentActionProps {\n action?: 'bulk-publish' | 'bulk-unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleAction\n *\n * This component is used to handle bulk publish and unpublish actions on locales.\n * -----------------------------------------------------------------------------------------------*/\n\nconst BulkLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n action,\n}: ExtendedDocumentActionProps) => {\n const locale = document?.locale ?? null;\n const [{ query }] = useQueryParams<{ status: 'draft' | 'published' }>();\n\n const params = React.useMemo(() => buildValidParams(query), [query]);\n const isOnPublishedTab = query.status === 'published';\n\n const { formatMessage } = useIntl();\n const { hasI18n, canPublish } = useI18n();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const [selectedRows, setSelectedRows] = React.useState<any[]>([]);\n const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] =\n React.useState<boolean>(false);\n\n const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } =\n useDocumentActions();\n\n const { schema, validate } = useDocument(\n {\n model,\n collectionType,\n documentId,\n params: {\n locale,\n },\n },\n {\n // No need to fetch the document, the data is already available in the `document` prop\n skip: true,\n }\n );\n\n const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? undefined : skipToken);\n\n const headers = [\n {\n label: formatMessage({\n id: 'global.name',\n defaultMessage: 'Name',\n }),\n name: 'name',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.status'),\n defaultMessage: 'Status',\n }),\n name: 'status',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.publication-status'),\n defaultMessage: 'Publication Status',\n }),\n name: 'publication-status',\n },\n ];\n\n // Extract the rows for the bulk locale publish modal and any validation\n // errors per locale\n const [rows, validationErrors] = React.useMemo(() => {\n if (!document) {\n return [[], {}];\n }\n\n const localizations = document.localizations ?? [];\n\n // Build the rows for the bulk locale publish modal by combining the current\n // document with all the available locales from the document meta\n const locales: LocaleStatus[] = localizations.map((doc: any) => {\n const { locale, status } = doc;\n return { locale, status };\n });\n\n // Add the current document locale\n locales.unshift({\n locale: document.locale,\n status: document.status,\n });\n\n // Build the validation errors for each locale.\n const allDocuments = [document, ...localizations];\n const errors = allDocuments.reduce<FormErrors>((errs, document) => {\n if (!document) {\n return errs;\n }\n\n // Validate each locale entry via the useDocument validate function and store any errors in a dictionary\n const validation = validate(document as Modules.Documents.AnyDocument);\n if (validation !== null) {\n errs[document.locale] = validation;\n }\n return errs;\n }, {});\n\n return [locales, errors];\n }, [document, validate]);\n\n const isBulkPublish = action === 'bulk-publish';\n const localesForAction = selectedRows.reduce((acc: string[], selectedRow: LocaleStatus) => {\n const isValidLocale =\n // Validation errors are irrelevant if we are trying to unpublish\n !isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale);\n\n const shouldAddLocale = isBulkPublish\n ? selectedRow.status !== 'published' && isValidLocale\n : selectedRow.status !== 'draft' && isValidLocale;\n\n if (shouldAddLocale) {\n acc.push(selectedRow.locale);\n }\n\n return acc;\n }, []);\n\n // TODO skipping this for now as there is a bug with the draft relation count that will be worked on separately\n // see https://www.notion.so/strapi/Count-draft-relations-56901b492efb45ab90d42fe975b32bd8?pvs=4\n const enableDraftRelationsCount = false;\n const {\n data: draftRelationsCount = 0,\n isLoading: isDraftRelationsLoading,\n error: isDraftRelationsError,\n } = useGetManyDraftRelationCountQuery(\n {\n model,\n documentIds: [documentId!],\n locale: localesForAction,\n },\n {\n skip: !enableDraftRelationsCount || !documentId || localesForAction.length === 0,\n }\n );\n\n React.useEffect(() => {\n if (isDraftRelationsError) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(isDraftRelationsError),\n });\n }\n }, [isDraftRelationsError, toggleNotification, formatAPIError]);\n\n if (!schema?.options?.draftAndPublish) {\n return null;\n }\n\n if (!hasI18n) {\n return null;\n }\n\n if (!documentId) {\n return null;\n }\n\n // This document action can be enabled given that draft and publish and i18n are\n // enabled and we can publish the current locale.\n\n const publish = async () => {\n await publishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const unpublish = async () => {\n await unpublishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const handleAction = async () => {\n if (draftRelationsCount > 0) {\n setIsDraftRelationConfirmationOpen(true);\n } else if (isBulkPublish) {\n await publish();\n } else {\n await unpublish();\n }\n };\n\n if (isDraftRelationConfirmationOpen) {\n return {\n label: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n variant: 'danger',\n dialog: {\n onCancel: () => {\n setIsDraftRelationConfirmationOpen(false);\n },\n onConfirm: async () => {\n await publish();\n\n setIsDraftRelationConfirmationOpen(false);\n },\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.publish.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" alignItems=\"center\" gap={2}>\n <WarningCircle width=\"2.4rem\" height=\"2.4rem\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.draft-relation-warning'),\n defaultMessage:\n 'Some locales are related to draft entries. Publishing them could leave broken links in your app.',\n })}\n </Typography>\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.continue-confirmation'),\n defaultMessage: 'Are you sure you want to continue?',\n })}\n </Typography>\n </Flex>\n ),\n },\n };\n }\n\n const hasPermission = selectedRows\n .map(({ locale }) => locale)\n .every((locale) => canPublish.includes(locale));\n\n return {\n label: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n variant: isBulkPublish ? 'secondary' : 'danger',\n icon: isBulkPublish ? <ListPlus /> : <Cross />,\n disabled: isOnPublishedTab || canPublish.length === 0,\n position: ['panel'],\n dialog: {\n type: 'modal',\n title: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n content: () => {\n return (\n <Table.Root\n headers={headers}\n rows={rows.map((row) => ({\n ...row,\n id: row.locale,\n }))}\n selectedRows={selectedRows}\n onSelectedRowsChange={(tableSelectedRows) => setSelectedRows(tableSelectedRows)}\n >\n <BulkLocaleActionModal\n validationErrors={validationErrors}\n headers={headers}\n rows={rows}\n localesMetadata={localesMetadata as Locale[]}\n action={action ?? 'bulk-publish'}\n />\n </Table.Root>\n );\n },\n footer: () => (\n <Modal.Footer justifyContent=\"flex-end\">\n <Button\n loading={isDraftRelationsLoading}\n disabled={!hasPermission || localesForAction.length === 0}\n variant=\"default\"\n onClick={handleAction}\n >\n {formatMessage({\n id: isBulkPublish ? 'app.utils.publish' : 'app.utils.unpublish',\n defaultMessage: isBulkPublish ? 'Publish' : 'Unpublish',\n })}\n </Button>\n </Modal.Footer>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocalePublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocalePublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-publish', ...props });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleUnpublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocaleUnpublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-unpublish', ...props });\n};\n\n/**\n * Because the icon system is completely broken, we have to do\n * this to remove the fill from the cog.\n */\nconst StyledTrash = styled(Trash)`\n path {\n fill: currentColor;\n }\n`;\n\nexport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n AITranslationStatusAction,\n};\n"],"names":["statusVariants","draft","published","modified","LocaleOption","isDraftAndPublishEnabled","locale","status","entryExists","formatMessage","useIntl","id","getTranslation","defaultMessage","bold","_jsx","b","name","_jsxs","Flex","width","gap","justifyContent","Typography","Status","display","paddingLeft","paddingRight","paddingTop","paddingBottom","size","variant","tag","fontWeight","capitalize","LocalePickerAction","document","meta","model","collectionType","documentId","query","setQuery","useQueryParams","hasI18n","canCreate","canRead","useI18n","data","locales","useGetLocalesQuery","currentDesiredLocale","plugins","i18n","schema","useDocument","params","handleSelect","React","useCallback","value","useEffect","Array","isArray","doesLocaleExist","find","loc","code","defaultLocale","isDefault","currentLocale","undefined","availableLocales","documentLocalizations","localizations","allLocalizations","length","allCurrentLocales","getDocumentStatus","displayedLocales","filter","includes","label","options","map","entryWithLocaleExists","some","doc","currentLocaleDoc","permissionsToCheck","disabled","draftAndPublish","startIcon","Plus","customizeContent","onSelect","docStatus","statuses","availableStatus","publishedAt","AITranslationStatusIcon","styled","theme","spaces","$isAISettingEnabled","colors","neutral150","neutral300","AITranslationStatusAction","isAIAvailable","useAIAvailability","settings","useGetSettingsQuery","isAISettingEnabled","aiLocalizations","hasAIFutureFlag","window","strapi","future","isEnabled","message","Box","height","aria-label","Boolean","Sparkle","tooltip","direction","padding","alignItems","enabled","Link","fontSize","NavLink","to","style","alignSelf","textAlign","FillFromAnotherLocaleAction","localeSelected","setLocaleSelected","useState","setValues","useForm","state","getDocument","useDocumentActions","components","l","fillFromLocale","onClose","response","cleanedData","cleanData","type","icon","Earth","dialog","title","content","_Fragment","Dialog","Body","WarningCircle","fill","Field","Root","Label","SingleSelect","placeholder","onChange","SingleSelectOption","Footer","Button","flex","onClick","DeleteLocaleAction","navigate","useNavigate","toggleNotification","useNotification","delete","deleteAction","isLoading","canDelete","position","StyledTrash","loading","onConfirm","unableToDelete","console","error","res","pathname","replace","BulkLocaleAction","action","useMemo","buildValidParams","isOnPublishedTab","canPublish","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","selectedRows","setSelectedRows","isDraftRelationConfirmationOpen","setIsDraftRelationConfirmationOpen","publishMany","publishManyAction","unpublishMany","unpublishManyAction","validate","skip","localesMetadata","skipToken","headers","rows","validationErrors","unshift","allDocuments","errors","reduce","errs","validation","isBulkPublish","localesForAction","acc","selectedRow","isValidLocale","Object","keys","shouldAddLocale","push","enableDraftRelationsCount","draftRelationsCount","isDraftRelationsLoading","isDraftRelationsError","useGetManyDraftRelationCountQuery","documentIds","publish","unpublish","handleAction","onCancel","hasPermission","every","ListPlus","Cross","Table","row","onSelectedRowsChange","tableSelectedRows","BulkLocaleActionModal","footer","Modal","BulkLocalePublishAction","props","BulkLocaleUnpublishAction","Trash"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgEA,MAAMA,cAAqE,GAAA;IACzEC,KAAO,EAAA,WAAA;IACPC,SAAW,EAAA,SAAA;IACXC,QAAU,EAAA;AACZ,CAAA;AAEA,MAAMC,YAAAA,GAAe,CAAC,EACpBC,wBAAwB,EACxBC,MAAM,EACNC,MAAM,EACNC,WAAW,EACO,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,IAAI,CAACF,WAAa,EAAA;AAChB,QAAA,OAAOC,aACL,CAAA;AACEE,YAAAA,EAAAA,EAAIC,cAAe,CAAA,sCAAA,CAAA;YACnBC,cAAgB,EAAA;SAElB,EAAA;YACEC,IAAM,EAAA,CAACR,uBAA4BS,GAACC,CAAAA,GAAAA,EAAAA;AAAGV,oBAAAA,QAAAA,EAAAA;;AACvCA,YAAAA,MAAAA,EAAQA,OAAOW;AACjB,SAAA,CAAA;AAEJ;AAEA,IAAA,qBACEC,IAACC,CAAAA,IAAAA,EAAAA;QAAKC,KAAM,EAAA,MAAA;QAAOC,GAAK,EAAA,CAAA;QAAGC,cAAe,EAAA,eAAA;;0BACxCP,GAACQ,CAAAA,UAAAA,EAAAA;AAAYjB,gBAAAA,QAAAA,EAAAA,MAAAA,CAAOW;;AACnBZ,YAAAA,wBAAAA,iBACCU,GAACS,CAAAA,MAAAA,EAAAA;gBACCC,OAAQ,EAAA,MAAA;gBACRC,WAAY,EAAA,KAAA;gBACZC,YAAa,EAAA,KAAA;gBACbC,UAAW,EAAA,KAAA;gBACXC,aAAc,EAAA,KAAA;gBACdC,IAAK,EA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;AACTlJ,wBAAAA,QAAAA,EAAU,CAAC0J,aAAAA,IAAiBlB,gBAAiBtJ,CAAAA,MAAM,KAAK,CAAA;wBACxD7C,OAAQ,EAAA,SAAA;wBACRgJ,OAASmE,EAAAA,YAAAA;kCAERzO,aAAc,CAAA;AACbE,4BAAAA,EAAAA,EAAIsN,gBAAgB,mBAAsB,GAAA,qBAAA;AAC1CpN,4BAAAA,cAAAA,EAAgBoN,gBAAgB,SAAY,GAAA;AAC9C,yBAAA;;;AAIR;AACF,KAAA;AACF,CAAA;AAEA;;qGAGA,MAAM8B,0BAAmD,CAACC,KAAAA,GAAAA;AACxD,IAAA,OAAO7D,gBAAiB,CAAA;QAAEC,MAAQ,EAAA,cAAA;AAAgB,QAAA,GAAG4D;AAAM,KAAA,CAAA;AAC7D;AAEA;;qGAGA,MAAMC,4BAAqD,CAACD,KAAAA,GAAAA;AAC1D,IAAA,OAAO7D,gBAAiB,CAAA;QAAEC,MAAQ,EAAA,gBAAA;AAAkB,QAAA,GAAG4D;AAAM,KAAA,CAAA;AAC/D;AAEA;;;AAGC,IACD,MAAMtE,WAAAA,GAAcrF,MAAO6J,CAAAA,KAAAA,CAAM;;;;AAIjC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"CMHeaderActions.mjs","sources":["../../../admin/src/components/CMHeaderActions.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { skipToken } from '@reduxjs/toolkit/query';\nimport {\n useNotification,\n useQueryParams,\n Table,\n useAPIErrorHandler,\n FormErrors,\n useForm,\n} from '@strapi/admin/strapi-admin';\nimport { useAIAvailability } from '@strapi/admin/strapi-admin/ee';\nimport {\n type DocumentActionComponent,\n type DocumentActionProps,\n unstable_useDocument as useDocument,\n unstable_useDocumentActions as useDocumentActions,\n buildValidParams,\n HeaderActionProps,\n} from '@strapi/content-manager/strapi-admin';\nimport {\n Flex,\n Status,\n Typography,\n Button,\n Modal,\n Field,\n SingleSelect,\n SingleSelectOption,\n Dialog,\n type StatusVariant,\n Box,\n Link,\n} from '@strapi/design-system';\nimport { WarningCircle, ListPlus, Trash, Earth, Cross, Plus, Sparkle } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { NavLink, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { useAILocalizationJobsPolling } from '../hooks/useAILocalizationJobsPolling';\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { useGetManyDraftRelationCountQuery } from '../services/relations';\nimport { useGetSettingsQuery } from '../services/settings';\nimport { cleanData } from '../utils/clean';\nimport { getTranslation } from '../utils/getTranslation';\nimport { capitalize } from '../utils/strings';\n\nimport { BulkLocaleActionModal } from './BulkLocaleActionModal';\n\nimport type { Locale } from '../../../shared/contracts/locales';\nimport type { I18nBaseQuery } from '../types';\nimport type { Modules } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * LocalePickerAction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface LocaleOptionProps {\n isDraftAndPublishEnabled: boolean;\n locale: Locale;\n status: 'draft' | 'published' | 'modified';\n entryExists: boolean;\n}\n\nconst statusVariants: Record<LocaleOptionProps['status'], StatusVariant> = {\n draft: 'secondary',\n published: 'success',\n modified: 'alternative',\n};\n\nconst LocaleOption = ({\n isDraftAndPublishEnabled,\n locale,\n status,\n entryExists,\n}: LocaleOptionProps) => {\n const { formatMessage } = useIntl();\n\n if (!entryExists) {\n return formatMessage(\n {\n id: getTranslation('CMEditViewLocalePicker.locale.create'),\n defaultMessage: 'Create <bold>{locale}</bold> locale',\n },\n {\n bold: (locale: React.ReactNode) => <b>{locale}</b>,\n locale: locale.name,\n }\n );\n }\n\n return (\n <Flex width=\"100%\" gap={1} justifyContent=\"space-between\">\n <Typography>{locale.name}</Typography>\n {isDraftAndPublishEnabled ? (\n <Status\n display=\"flex\"\n paddingLeft=\"6px\"\n paddingRight=\"6px\"\n paddingTop=\"2px\"\n paddingBottom=\"2px\"\n size=\"S\"\n variant={statusVariants[status]}\n >\n <Typography tag=\"span\" variant=\"pi\" fontWeight=\"bold\">\n {capitalize(status)}\n </Typography>\n </Status>\n ) : null}\n </Flex>\n );\n};\n\nconst LocalePickerAction = ({\n document,\n meta,\n model,\n collectionType,\n documentId,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<I18nBaseQuery>();\n const { hasI18n, canCreate, canRead } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const { schema } = useDocument({\n model,\n collectionType,\n documentId,\n params: { locale: currentDesiredLocale },\n });\n\n const handleSelect = React.useCallback(\n (value: string) => {\n setQuery({\n plugins: {\n ...query.plugins,\n i18n: {\n locale: value,\n },\n },\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 doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleSelect(defaultLocale.code);\n }\n }, [handleSelect, hasI18n, locales, currentDesiredLocale]);\n\n const currentLocale = Array.isArray(locales)\n ? locales.find((locale) => locale.code === currentDesiredLocale)\n : undefined;\n\n // Use meta.availableLocales instead of document.localizations\n // meta.availableLocales contains all locales for the document, even when creating new locales\n const availableLocales = meta?.availableLocales ?? [];\n const documentLocalizations = document?.localizations ?? [];\n\n // Prefer meta.availableLocales as it's more reliable, fallback to document.localizations\n const allLocalizations = availableLocales.length > 0 ? availableLocales : documentLocalizations;\n\n const allCurrentLocales = [\n { status: getDocumentStatus(document, meta), locale: currentLocale?.code },\n ...allLocalizations,\n ];\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 read we allow you to see the locale exists\n * otherwise the locale is hidden.\n */\n return canRead.includes(locale.code);\n });\n\n return {\n label: formatMessage({\n id: getTranslation('Settings.locales.modal.locales.label'),\n defaultMessage: 'Locales',\n }),\n options: displayedLocales.map((locale) => {\n const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);\n\n const currentLocaleDoc = allCurrentLocales.find((doc) =>\n 'locale' in doc ? doc.locale === locale.code : false\n );\n\n const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;\n\n return {\n disabled: !permissionsToCheck.includes(locale.code),\n value: locale.code,\n label: (\n <LocaleOption\n isDraftAndPublishEnabled={!!schema?.options?.draftAndPublish}\n locale={locale}\n status={currentLocaleDoc?.status}\n entryExists={entryWithLocaleExists}\n />\n ),\n startIcon: !entryWithLocaleExists ? <Plus /> : null,\n };\n }),\n customizeContent: () => currentLocale?.name,\n onSelect: handleSelect,\n value: currentLocale,\n };\n};\n\ntype UseDocument = typeof useDocument;\n\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AISettingsStatusAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst AITranslationStatusIcon = styled(Status)<{ $isAISettingEnabled: boolean }>`\n display: flex;\n gap: ${({ theme }) => theme.spaces[1]};\n justify-content: center;\n align-items: center;\n height: 100%;\n\n // Disabled state\n ${({ $isAISettingEnabled, theme }) =>\n !$isAISettingEnabled &&\n `\n background-color: ${theme.colors.neutral150};\n `}\n\n svg {\n ${({ $isAISettingEnabled, theme }) =>\n !$isAISettingEnabled &&\n `\n fill: ${theme.colors.neutral300};\n `}\n }\n`;\n\nconst AITranslationStatusAction = ({ documentId, model, collectionType }: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const isAIAvailable = useAIAvailability();\n const { data: settings } = useGetSettingsQuery();\n const isAISettingEnabled = settings?.data?.aiLocalizations;\n const { hasI18n } = useI18n();\n\n // Poll for AI localizations jobs when AI is enabled and we have a documentId\n const { status } = useAILocalizationJobsPolling({\n documentId,\n model,\n collectionType,\n });\n const statusVariant = (() => {\n if (status === 'failed') {\n return 'warning';\n }\n\n if (isAISettingEnabled) {\n return 'alternative';\n }\n\n return 'neutral';\n })();\n\n // Do not display this action when i18n is not available\n if (!hasI18n) {\n return null;\n }\n\n // Do not display this action when AI is not available\n const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');\n if (!isAIAvailable || !hasAIFutureFlag) {\n return null;\n }\n\n return {\n status: {\n message: (\n <Box\n height=\"100%\"\n aria-label={formatMessage({\n id: getTranslation('CMEditViewAITranslation.status-aria-label'),\n defaultMessage: 'AI Translation Status',\n })}\n >\n <AITranslationStatusIcon\n $isAISettingEnabled={Boolean(isAISettingEnabled)}\n variant={statusVariant}\n size=\"S\"\n >\n <Sparkle />\n </AITranslationStatusIcon>\n </Box>\n ),\n tooltip: (\n <Flex direction=\"column\" padding={4} alignItems=\"flex-start\" width=\"25rem\">\n <Typography variant=\"pi\" fontWeight=\"600\">\n {formatMessage(\n {\n id: getTranslation('CMEditViewAITranslation.status-title'),\n defaultMessage:\n '{enabled, select, true {AI translation enabled} false {AI translation disabled} other {AI translation disabled}}',\n },\n { enabled: isAISettingEnabled }\n )}\n </Typography>\n <Typography variant=\"pi\" paddingTop={1} paddingBottom={3}>\n {formatMessage({\n id: getTranslation('CMEditViewAITranslation.status-description'),\n defaultMessage:\n 'Our AI translates content in all locales each time you save a modification.',\n })}\n </Typography>\n <Link\n fontSize=\"inherit\"\n tag={NavLink}\n to=\"/settings/internationalization\"\n style={{ alignSelf: 'flex-end' }}\n >\n <Typography variant=\"pi\" textAlign=\"right\">\n {formatMessage(\n {\n id: getTranslation('CMEditViewAITranslation.settings-link'),\n defaultMessage:\n '{enabled, select, true {Disable it in settings} false {Enable it in settings} other {Enable it in settings}}',\n },\n { enabled: isAISettingEnabled }\n )}\n </Typography>\n </Link>\n </Flex>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FillFromAnotherLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst FillFromAnotherLocaleAction = ({\n documentId,\n meta,\n model,\n collectionType,\n}: HeaderActionProps) => {\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { hasI18n } = useI18n();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const [localeSelected, setLocaleSelected] = React.useState<string | null>(null);\n const setValues = useForm('FillFromAnotherLocale', (state) => state.setValues);\n\n const { getDocument } = useDocumentActions();\n const { schema, components } = useDocument({\n model,\n documentId,\n collectionType,\n params: { locale: currentDesiredLocale },\n });\n const { data: locales = [] } = useGetLocalesQuery();\n\n const isAIAvailable = useAIAvailability();\n const { data: settings } = useGetSettingsQuery();\n const isAISettingEnabled = settings?.data?.aiLocalizations;\n\n const availableLocales = Array.isArray(locales)\n ? locales.filter((locale) => meta?.availableLocales.some((l) => l.locale === locale.code))\n : [];\n\n const fillFromLocale = (onClose: () => void) => async () => {\n const response = await getDocument({\n collectionType,\n model,\n documentId,\n params: { locale: localeSelected },\n });\n if (!response || !schema) {\n return;\n }\n\n const { data } = response;\n\n const cleanedData = cleanData(data, schema, components);\n\n setValues(cleanedData);\n\n onClose();\n };\n\n if (!hasI18n) {\n return null;\n }\n\n // Do not display this action when AI is available and AI translations are enabled\n const hasAIFutureFlag = window.strapi.future.isEnabled('unstableAILocalizations');\n if (hasAIFutureFlag && isAIAvailable && isAISettingEnabled) {\n return null;\n }\n\n return {\n type: 'icon',\n icon: <Earth />,\n disabled: availableLocales.length === 0,\n label: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.copy-text'),\n defaultMessage: 'Fill in from another locale',\n }),\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: ({ onClose }: { onClose: () => void }) => (\n <>\n <Dialog.Body>\n <Flex direction=\"column\" gap={3}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.body'),\n defaultMessage:\n 'Your current content will be erased and filled by the content of the selected locale:',\n })}\n </Typography>\n <Field.Root width=\"100%\">\n <Field.Label>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.label'),\n defaultMessage: 'Locale',\n })}\n </Field.Label>\n <SingleSelect\n value={localeSelected}\n placeholder={formatMessage({\n id: getTranslation('CMEditViewCopyLocale.dialog.field.placeholder'),\n defaultMessage: 'Select one locale...',\n })}\n // @ts-expect-error – the DS will handle numbers, but we're not allowing the API.\n onChange={(value) => setLocaleSelected(value)}\n >\n {availableLocales.map((locale) => (\n <SingleSelectOption key={locale.code} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n </Field.Root>\n </Flex>\n </Dialog.Body>\n <Dialog.Footer>\n <Flex gap={2} width=\"100%\">\n <Button flex=\"auto\" variant=\"tertiary\" onClick={onClose}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.cancel-text'),\n defaultMessage: 'No, cancel',\n })}\n </Button>\n <Button flex=\"auto\" variant=\"success\" onClick={fillFromLocale(onClose)}>\n {formatMessage({\n id: getTranslation('CMEditViewCopyLocale.submit-text'),\n defaultMessage: 'Yes, fill in',\n })}\n </Button>\n </Flex>\n </Dialog.Footer>\n </>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DeleteLocaleAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst DeleteLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n}) => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const { toggleNotification } = useNotification();\n const { delete: deleteAction, isLoading } = useDocumentActions();\n const { hasI18n, canDelete } = useI18n();\n\n // Get the current locale object, using the URL instead of document so it works while creating\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const { data: locales = [] } = useGetLocalesQuery();\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const locale = !('error' in locales) && locales.find((loc) => loc.code === currentDesiredLocale);\n\n if (!hasI18n) {\n return null;\n }\n\n return {\n disabled:\n (document?.locale && !canDelete.includes(document.locale)) || !document || !document.id,\n position: ['header', 'table-row'],\n label: formatMessage(\n {\n id: getTranslation('actions.delete.label'),\n defaultMessage: 'Delete entry ({locale})',\n },\n { locale: locale && locale.name }\n ),\n icon: <StyledTrash />,\n variant: 'danger',\n dialog: {\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.delete.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" gap={2}>\n <WarningCircle width=\"24px\" height=\"24px\" fill=\"danger600\" />\n <Typography tag=\"p\" variant=\"omega\" textAlign=\"center\">\n {formatMessage({\n id: getTranslation('actions.delete.dialog.body'),\n defaultMessage: 'Are you sure?',\n })}\n </Typography>\n </Flex>\n ),\n loading: isLoading,\n onConfirm: async () => {\n const unableToDelete =\n // We are unable to delete a collection type without a document ID\n // & unable to delete generally if there is no document locale\n (collectionType !== 'single-types' && !documentId) || !document?.locale;\n\n if (unableToDelete) {\n console.error(\n \"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue.\"\n );\n\n toggleNotification({\n message: formatMessage({\n id: getTranslation('actions.delete.error'),\n defaultMessage: 'An error occurred while trying to delete the document locale.',\n }),\n type: 'danger',\n });\n\n return;\n }\n\n const res = await deleteAction({\n documentId,\n model,\n collectionType,\n params: { locale: document.locale },\n });\n\n if (!('error' in res)) {\n navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });\n }\n },\n },\n };\n};\n\nexport type LocaleStatus = {\n locale: string;\n status: Modules.Documents.Params.PublicationStatus.Kind | 'modified';\n};\n\ninterface ExtendedDocumentActionProps extends DocumentActionProps {\n action?: 'bulk-publish' | 'bulk-unpublish';\n}\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleAction\n *\n * This component is used to handle bulk publish and unpublish actions on locales.\n * -----------------------------------------------------------------------------------------------*/\n\nconst BulkLocaleAction: DocumentActionComponent = ({\n document,\n documentId,\n model,\n collectionType,\n action,\n}: ExtendedDocumentActionProps) => {\n const locale = document?.locale ?? null;\n const [{ query }] = useQueryParams<{ status: 'draft' | 'published' }>();\n\n const params = React.useMemo(() => buildValidParams(query), [query]);\n const isOnPublishedTab = query.status === 'published';\n\n const { formatMessage } = useIntl();\n const { hasI18n, canPublish } = useI18n();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const [selectedRows, setSelectedRows] = React.useState<any[]>([]);\n const [isDraftRelationConfirmationOpen, setIsDraftRelationConfirmationOpen] =\n React.useState<boolean>(false);\n\n const { publishMany: publishManyAction, unpublishMany: unpublishManyAction } =\n useDocumentActions();\n\n const { schema, validate } = useDocument(\n {\n model,\n collectionType,\n documentId,\n params: {\n locale,\n },\n },\n {\n // No need to fetch the document, the data is already available in the `document` prop\n skip: true,\n }\n );\n\n const { data: localesMetadata = [] } = useGetLocalesQuery(hasI18n ? undefined : skipToken);\n\n const headers = [\n {\n label: formatMessage({\n id: 'global.name',\n defaultMessage: 'Name',\n }),\n name: 'name',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.status'),\n defaultMessage: 'Status',\n }),\n name: 'status',\n },\n {\n label: formatMessage({\n id: getTranslation('CMEditViewBulkLocale.publication-status'),\n defaultMessage: 'Publication Status',\n }),\n name: 'publication-status',\n },\n ];\n\n // Extract the rows for the bulk locale publish modal and any validation\n // errors per locale\n const [rows, validationErrors] = React.useMemo(() => {\n if (!document) {\n return [[], {}];\n }\n\n const localizations = document.localizations ?? [];\n\n // Build the rows for the bulk locale publish modal by combining the current\n // document with all the available locales from the document meta\n const locales: LocaleStatus[] = localizations.map((doc: any) => {\n const { locale, status } = doc;\n return { locale, status };\n });\n\n // Add the current document locale\n locales.unshift({\n locale: document.locale,\n status: document.status,\n });\n\n // Build the validation errors for each locale.\n const allDocuments = [document, ...localizations];\n const errors = allDocuments.reduce<FormErrors>((errs, document) => {\n if (!document) {\n return errs;\n }\n\n // Validate each locale entry via the useDocument validate function and store any errors in a dictionary\n const validation = validate(document as Modules.Documents.AnyDocument);\n if (validation !== null) {\n errs[document.locale] = validation;\n }\n return errs;\n }, {});\n\n return [locales, errors];\n }, [document, validate]);\n\n const isBulkPublish = action === 'bulk-publish';\n const localesForAction = selectedRows.reduce((acc: string[], selectedRow: LocaleStatus) => {\n const isValidLocale =\n // Validation errors are irrelevant if we are trying to unpublish\n !isBulkPublish || !Object.keys(validationErrors).includes(selectedRow.locale);\n\n const shouldAddLocale = isBulkPublish\n ? selectedRow.status !== 'published' && isValidLocale\n : selectedRow.status !== 'draft' && isValidLocale;\n\n if (shouldAddLocale) {\n acc.push(selectedRow.locale);\n }\n\n return acc;\n }, []);\n\n // TODO skipping this for now as there is a bug with the draft relation count that will be worked on separately\n // see https://www.notion.so/strapi/Count-draft-relations-56901b492efb45ab90d42fe975b32bd8?pvs=4\n const enableDraftRelationsCount = false;\n const {\n data: draftRelationsCount = 0,\n isLoading: isDraftRelationsLoading,\n error: isDraftRelationsError,\n } = useGetManyDraftRelationCountQuery(\n {\n model,\n documentIds: [documentId!],\n locale: localesForAction,\n },\n {\n skip: !enableDraftRelationsCount || !documentId || localesForAction.length === 0,\n }\n );\n\n React.useEffect(() => {\n if (isDraftRelationsError) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(isDraftRelationsError),\n });\n }\n }, [isDraftRelationsError, toggleNotification, formatAPIError]);\n\n if (!schema?.options?.draftAndPublish) {\n return null;\n }\n\n if (!hasI18n) {\n return null;\n }\n\n if (!documentId) {\n return null;\n }\n\n // This document action can be enabled given that draft and publish and i18n are\n // enabled and we can publish the current locale.\n\n const publish = async () => {\n await publishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const unpublish = async () => {\n await unpublishManyAction({\n model,\n documentIds: [documentId],\n params: {\n ...params,\n locale: localesForAction,\n },\n });\n\n setSelectedRows([]);\n };\n\n const handleAction = async () => {\n if (draftRelationsCount > 0) {\n setIsDraftRelationConfirmationOpen(true);\n } else if (isBulkPublish) {\n await publish();\n } else {\n await unpublish();\n }\n };\n\n if (isDraftRelationConfirmationOpen) {\n return {\n label: formatMessage({\n id: 'app.components.ConfirmDialog.title',\n defaultMessage: 'Confirmation',\n }),\n variant: 'danger',\n dialog: {\n onCancel: () => {\n setIsDraftRelationConfirmationOpen(false);\n },\n onConfirm: async () => {\n await publish();\n\n setIsDraftRelationConfirmationOpen(false);\n },\n type: 'dialog',\n title: formatMessage({\n id: getTranslation('actions.publish.dialog.title'),\n defaultMessage: 'Confirmation',\n }),\n content: (\n <Flex direction=\"column\" alignItems=\"center\" gap={2}>\n <WarningCircle width=\"2.4rem\" height=\"2.4rem\" fill=\"danger600\" />\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.draft-relation-warning'),\n defaultMessage:\n 'Some locales are related to draft entries. Publishing them could leave broken links in your app.',\n })}\n </Typography>\n <Typography textAlign=\"center\">\n {formatMessage({\n id: getTranslation('CMEditViewBulkLocale.continue-confirmation'),\n defaultMessage: 'Are you sure you want to continue?',\n })}\n </Typography>\n </Flex>\n ),\n },\n };\n }\n\n const hasPermission = selectedRows\n .map(({ locale }) => locale)\n .every((locale) => canPublish.includes(locale));\n\n return {\n label: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n variant: isBulkPublish ? 'secondary' : 'danger',\n icon: isBulkPublish ? <ListPlus /> : <Cross />,\n disabled: isOnPublishedTab || canPublish.length === 0,\n position: ['panel'],\n dialog: {\n type: 'modal',\n title: formatMessage({\n id: getTranslation(`CMEditViewBulkLocale.${isBulkPublish ? 'publish' : 'unpublish'}-title`),\n defaultMessage: `${isBulkPublish ? 'Publish' : 'Unpublish'} Multiple Locales`,\n }),\n content: () => {\n return (\n <Table.Root\n headers={headers}\n rows={rows.map((row) => ({\n ...row,\n id: row.locale,\n }))}\n selectedRows={selectedRows}\n onSelectedRowsChange={(tableSelectedRows) => setSelectedRows(tableSelectedRows)}\n >\n <BulkLocaleActionModal\n validationErrors={validationErrors}\n headers={headers}\n rows={rows}\n localesMetadata={localesMetadata as Locale[]}\n action={action ?? 'bulk-publish'}\n />\n </Table.Root>\n );\n },\n footer: () => (\n <Modal.Footer justifyContent=\"flex-end\">\n <Button\n loading={isDraftRelationsLoading}\n disabled={!hasPermission || localesForAction.length === 0}\n variant=\"default\"\n onClick={handleAction}\n >\n {formatMessage({\n id: isBulkPublish ? 'app.utils.publish' : 'app.utils.unpublish',\n defaultMessage: isBulkPublish ? 'Publish' : 'Unpublish',\n })}\n </Button>\n </Modal.Footer>\n ),\n },\n };\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocalePublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocalePublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-publish', ...props });\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BulkLocaleUnpublishAction\n * -----------------------------------------------------------------------------------------------*/\nconst BulkLocaleUnpublishAction: DocumentActionComponent = (props: ExtendedDocumentActionProps) => {\n return BulkLocaleAction({ action: 'bulk-unpublish', ...props });\n};\n\n/**\n * Because the icon system is completely broken, we have to do\n * this to remove the fill from the cog.\n */\nconst StyledTrash = styled(Trash)`\n path {\n fill: currentColor;\n }\n`;\n\nexport {\n BulkLocalePublishAction,\n BulkLocaleUnpublishAction,\n DeleteLocaleAction,\n LocalePickerAction,\n FillFromAnotherLocaleAction,\n AITranslationStatusAction,\n};\n"],"names":["statusVariants","draft","published","modified","LocaleOption","isDraftAndPublishEnabled","locale","status","entryExists","formatMessage","useIntl","id","getTranslation","defaultMessage","bold","_jsx","b","name","_jsxs","Flex","width","gap","justifyContent","Typography","Status","display","paddingLeft","paddingRight","paddingTop","paddingBottom","size","variant","tag","fontWeight","capitalize","LocalePickerAction","document","meta","model","collectionType","documentId","query","setQuery","useQueryParams","hasI18n","canCreate","canRead","useI18n","data","locales","useGetLocalesQuery","currentDesiredLocale","plugins","i18n","schema","useDocument","params","handleSelect","React","useCallback","value","useEffect","Array","isArray","doesLocaleExist","find","loc","code","defaultLocale","isDefault","currentLocale","undefined","availableLocales","documentLocalizations","localizations","allLocalizations","length","allCurrentLocales","getDocumentStatus","displayedLocales","filter","includes","label","options","map","entryWithLocaleExists","some","doc","currentLocaleDoc","permissionsToCheck","disabled","draftAndPublish","startIcon","Plus","customizeContent","onSelect","docStatus","statuses","availableStatus","publishedAt","AITranslationStatusIcon","styled","theme","spaces","$isAISettingEnabled","colors","neutral150","neutral300","AITranslationStatusAction","isAIAvailable","useAIAvailability","settings","useGetSettingsQuery","isAISettingEnabled","aiLocalizations","useAILocalizationJobsPolling","statusVariant","hasAIFutureFlag","window","strapi","future","isEnabled","message","Box","height","aria-label","Boolean","Sparkle","tooltip","direction","padding","alignItems","enabled","Link","fontSize","NavLink","to","style","alignSelf","textAlign","FillFromAnotherLocaleAction","localeSelected","setLocaleSelected","useState","setValues","useForm","state","getDocument","useDocumentActions","components","l","fillFromLocale","onClose","response","cleanedData","cleanData","type","icon","Earth","dialog","title","content","_Fragment","Dialog","Body","WarningCircle","fill","Field","Root","Label","SingleSelect","placeholder","onChange","SingleSelectOption","Footer","Button","flex","onClick","DeleteLocaleAction","navigate","useNavigate","toggleNotification","useNotification","delete","deleteAction","isLoading","canDelete","position","StyledTrash","loading","onConfirm","unableToDelete","console","error","res","pathname","replace","BulkLocaleAction","action","useMemo","buildValidParams","isOnPublishedTab","canPublish","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","selectedRows","setSelectedRows","isDraftRelationConfirmationOpen","setIsDraftRelationConfirmationOpen","publishMany","publishManyAction","unpublishMany","unpublishManyAction","validate","skip","localesMetadata","skipToken","headers","rows","validationErrors","unshift","allDocuments","errors","reduce","errs","validation","isBulkPublish","localesForAction","acc","selectedRow","isValidLocale","Object","keys","shouldAddLocale","push","enableDraftRelationsCount","draftRelationsCount","isDraftRelationsLoading","isDraftRelationsError","useGetManyDraftRelationCountQuery","documentIds","publish","unpublish","handleAction","onCancel","hasPermission","every","ListPlus","Cross","Table","row","onSelectedRowsChange","tableSelectedRows","BulkLocaleActionModal","footer","Modal","BulkLocalePublishAction","props","BulkLocaleUnpublishAction","Trash"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiEA,MAAMA,cAAqE,GAAA;IACzEC,KAAO,EAAA,WAAA;IACPC,SAAW,EAAA,SAAA;IACXC,QAAU,EAAA;AACZ,CAAA;AAEA,MAAMC,YAAAA,GAAe,CAAC,EACpBC,wBAAwB,EACxBC,MAAM,EACNC,MAAM,EACNC,WAAW,EACO,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,IAAI,CAACF,WAAa,EAAA;AAChB,QAAA,OAAOC,aACL,CAAA;AACEE,YAAAA,EAAAA,EAAIC,cAAe,CAAA,sCAAA,CAAA;YACnBC,cAAgB,EAAA;SAElB,EAAA;YACEC,IAAM,EAAA,CAACR,uBAA4BS,GAACC,CAAAA,GAAAA,EAAAA;AAAGV,oBAAAA,QAAAA,EAAAA;;AACvCA,YAAAA,MAAAA,EAAQA,OAAOW;AACjB,SAAA,CAAA;AAEJ;AAEA,IAAA,qBACEC,IAACC,CAAAA,IAAAA,EAAAA;QAAKC,KAAM,EAA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AAAA,GAAAA;AAC1D,IAAA,OAAO7D,gBAAiB,CAAA;QAAEC,MAAQ,EAAA,gBAAA;AAAkB,QAAA,GAAG4D;AAAM,KAAA,CAAA;AAC/D;AAEA;;;AAGC,IACD,MAAMtE,WAAAA,GAAcvF,MAAO+J,CAAAA,KAAAA,CAAM;;;;AAIjC,CAAC;;;;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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 reactRedux = require('react-redux');
|
|
7
|
+
var aiLocalizationJobs = require('../services/aiLocalizationJobs.js');
|
|
8
|
+
var getTranslation = require('../utils/getTranslation.js');
|
|
9
|
+
|
|
10
|
+
function _interopNamespaceDefault(e) {
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
28
|
+
|
|
29
|
+
const useAILocalizationJobsPolling = ({ documentId, model, collectionType })=>{
|
|
30
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
31
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
32
|
+
const dispatch = reactRedux.useDispatch();
|
|
33
|
+
const [previousJobStatus, setPreviousJobStatus] = React__namespace.useState(null);
|
|
34
|
+
/**
|
|
35
|
+
* NOTE:
|
|
36
|
+
* Due to a limitation with RTK query it is not possible to dynamically update the polling interval
|
|
37
|
+
* @see https://github.com/reduxjs/redux-toolkit/issues/1651
|
|
38
|
+
*/ const { data: initialJobData } = aiLocalizationJobs.useGetAILocalizationJobsByDocumentQuery({
|
|
39
|
+
documentId: documentId,
|
|
40
|
+
model: model,
|
|
41
|
+
collectionType: collectionType
|
|
42
|
+
});
|
|
43
|
+
const shouldPoll = initialJobData?.data?.status === 'processing' || previousJobStatus === 'processing';
|
|
44
|
+
const { data: jobData } = aiLocalizationJobs.useGetAILocalizationJobsByDocumentQuery({
|
|
45
|
+
documentId: documentId,
|
|
46
|
+
model: model,
|
|
47
|
+
collectionType: collectionType
|
|
48
|
+
}, {
|
|
49
|
+
skip: !shouldPoll,
|
|
50
|
+
pollingInterval: 1000
|
|
51
|
+
});
|
|
52
|
+
const job = jobData?.data || initialJobData?.data;
|
|
53
|
+
const currentJobStatus = job?.status;
|
|
54
|
+
const invalidateDocument = React__namespace.useCallback(()=>{
|
|
55
|
+
dispatch(strapiAdmin.adminApi.util.invalidateTags([
|
|
56
|
+
{
|
|
57
|
+
// @ts-expect-error tag isn't available
|
|
58
|
+
type: 'Document',
|
|
59
|
+
id: collectionType !== 'single-types' ? `${model}_${documentId}` : model
|
|
60
|
+
}
|
|
61
|
+
]));
|
|
62
|
+
}, [
|
|
63
|
+
dispatch,
|
|
64
|
+
collectionType,
|
|
65
|
+
model,
|
|
66
|
+
documentId
|
|
67
|
+
]);
|
|
68
|
+
// Check for job status changes and trigger callbacks
|
|
69
|
+
React__namespace.useEffect(()=>{
|
|
70
|
+
if (!currentJobStatus) return;
|
|
71
|
+
// Detect transition from 'processing' to a terminal state
|
|
72
|
+
if (previousJobStatus === 'processing' && currentJobStatus === 'completed') {
|
|
73
|
+
toggleNotification({
|
|
74
|
+
type: 'success',
|
|
75
|
+
message: formatMessage({
|
|
76
|
+
id: getTranslation.getTranslation('CMEditViewAITranslation.job-completed'),
|
|
77
|
+
defaultMessage: 'AI translation completed successfully!'
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
invalidateDocument();
|
|
81
|
+
}
|
|
82
|
+
if (previousJobStatus === 'processing' && currentJobStatus === 'failed') {
|
|
83
|
+
toggleNotification({
|
|
84
|
+
type: 'warning',
|
|
85
|
+
message: formatMessage({
|
|
86
|
+
id: getTranslation.getTranslation('CMEditViewAITranslation.job-failed'),
|
|
87
|
+
defaultMessage: 'AI translation failed. Please try again.'
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
invalidateDocument();
|
|
91
|
+
}
|
|
92
|
+
// Update the previous status if it changed
|
|
93
|
+
if (previousJobStatus !== currentJobStatus) {
|
|
94
|
+
setPreviousJobStatus(currentJobStatus);
|
|
95
|
+
}
|
|
96
|
+
}, [
|
|
97
|
+
currentJobStatus,
|
|
98
|
+
previousJobStatus,
|
|
99
|
+
setPreviousJobStatus,
|
|
100
|
+
toggleNotification,
|
|
101
|
+
formatMessage,
|
|
102
|
+
invalidateDocument
|
|
103
|
+
]);
|
|
104
|
+
return {
|
|
105
|
+
status: job?.status
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
exports.useAILocalizationJobsPolling = useAILocalizationJobsPolling;
|
|
110
|
+
//# 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, adminApi } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useDispatch } from 'react-redux';\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 const dispatch = useDispatch();\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 const invalidateDocument = React.useCallback(() => {\n dispatch(\n adminApi.util.invalidateTags([\n {\n // @ts-expect-error tag isn't available\n type: 'Document',\n id: collectionType !== 'single-types' ? `${model}_${documentId}` : model,\n },\n ])\n );\n }, [dispatch, collectionType, model, documentId]);\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 invalidateDocument();\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 invalidateDocument();\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 invalidateDocument,\n ]);\n\n return {\n status: job?.status,\n };\n};\n"],"names":["useAILocalizationJobsPolling","documentId","model","collectionType","toggleNotification","useNotification","formatMessage","useIntl","dispatch","useDispatch","previousJobStatus","setPreviousJobStatus","React","useState","data","initialJobData","useGetAILocalizationJobsByDocumentQuery","shouldPoll","status","jobData","skip","pollingInterval","job","currentJobStatus","invalidateDocument","useCallback","adminApi","util","invalidateTags","type","id","useEffect","message","getTranslation","defaultMessage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,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;AAC1B,IAAA,MAAMC,QAAWC,GAAAA,sBAAAA,EAAAA;AAEjB,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;QACvEf,UAAYA,EAAAA,UAAAA;QACZC,KAAOA,EAAAA,KAAAA;QACPC,cAAgBA,EAAAA;AAClB,KAAA,CAAA;AAEA,IAAA,MAAMc,UACJF,GAAAA,cAAAA,EAAgBD,IAAMI,EAAAA,MAAAA,KAAW,gBAAgBR,iBAAsB,KAAA,YAAA;AACzE,IAAA,MAAM,EAAEI,IAAAA,EAAMK,OAAO,EAAE,GAAGH,0DACxB,CAAA;QAAEf,UAAYA,EAAAA,UAAAA;QAAaC,KAAOA,EAAAA,KAAAA;QAAQC,cAAgBA,EAAAA;KAC1D,EAAA;AACEiB,QAAAA,IAAAA,EAAM,CAACH,UAAAA;QACPI,eAAiB,EAAA;AACnB,KAA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,YAAAA,kBAAAA,EAAAA;AACF;;AAGA,QAAA,IAAId,sBAAsBa,gBAAkB,EAAA;YAC1CZ,oBAAqBY,CAAAA,gBAAAA,CAAAA;AACvB;KACC,EAAA;AACDA,QAAAA,gBAAAA;AACAb,QAAAA,iBAAAA;AACAC,QAAAA,oBAAAA;AACAP,QAAAA,kBAAAA;AACAE,QAAAA,aAAAA;AACAkB,QAAAA;AACD,KAAA,CAAA;IAED,OAAO;AACLN,QAAAA,MAAAA,EAAQI,GAAKJ,EAAAA;AACf,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useNotification, adminApi } from '@strapi/admin/strapi-admin';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import { useDispatch } from 'react-redux';
|
|
5
|
+
import { useGetAILocalizationJobsByDocumentQuery } from '../services/aiLocalizationJobs.mjs';
|
|
6
|
+
import { getTranslation } from '../utils/getTranslation.mjs';
|
|
7
|
+
|
|
8
|
+
const useAILocalizationJobsPolling = ({ documentId, model, collectionType })=>{
|
|
9
|
+
const { toggleNotification } = useNotification();
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
const dispatch = useDispatch();
|
|
12
|
+
const [previousJobStatus, setPreviousJobStatus] = React.useState(null);
|
|
13
|
+
/**
|
|
14
|
+
* NOTE:
|
|
15
|
+
* Due to a limitation with RTK query it is not possible to dynamically update the polling interval
|
|
16
|
+
* @see https://github.com/reduxjs/redux-toolkit/issues/1651
|
|
17
|
+
*/ const { data: initialJobData } = useGetAILocalizationJobsByDocumentQuery({
|
|
18
|
+
documentId: documentId,
|
|
19
|
+
model: model,
|
|
20
|
+
collectionType: collectionType
|
|
21
|
+
});
|
|
22
|
+
const shouldPoll = initialJobData?.data?.status === 'processing' || previousJobStatus === 'processing';
|
|
23
|
+
const { data: jobData } = useGetAILocalizationJobsByDocumentQuery({
|
|
24
|
+
documentId: documentId,
|
|
25
|
+
model: model,
|
|
26
|
+
collectionType: collectionType
|
|
27
|
+
}, {
|
|
28
|
+
skip: !shouldPoll,
|
|
29
|
+
pollingInterval: 1000
|
|
30
|
+
});
|
|
31
|
+
const job = jobData?.data || initialJobData?.data;
|
|
32
|
+
const currentJobStatus = job?.status;
|
|
33
|
+
const invalidateDocument = React.useCallback(()=>{
|
|
34
|
+
dispatch(adminApi.util.invalidateTags([
|
|
35
|
+
{
|
|
36
|
+
// @ts-expect-error tag isn't available
|
|
37
|
+
type: 'Document',
|
|
38
|
+
id: collectionType !== 'single-types' ? `${model}_${documentId}` : model
|
|
39
|
+
}
|
|
40
|
+
]));
|
|
41
|
+
}, [
|
|
42
|
+
dispatch,
|
|
43
|
+
collectionType,
|
|
44
|
+
model,
|
|
45
|
+
documentId
|
|
46
|
+
]);
|
|
47
|
+
// Check for job status changes and trigger callbacks
|
|
48
|
+
React.useEffect(()=>{
|
|
49
|
+
if (!currentJobStatus) return;
|
|
50
|
+
// Detect transition from 'processing' to a terminal state
|
|
51
|
+
if (previousJobStatus === 'processing' && currentJobStatus === 'completed') {
|
|
52
|
+
toggleNotification({
|
|
53
|
+
type: 'success',
|
|
54
|
+
message: formatMessage({
|
|
55
|
+
id: getTranslation('CMEditViewAITranslation.job-completed'),
|
|
56
|
+
defaultMessage: 'AI translation completed successfully!'
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
invalidateDocument();
|
|
60
|
+
}
|
|
61
|
+
if (previousJobStatus === 'processing' && currentJobStatus === 'failed') {
|
|
62
|
+
toggleNotification({
|
|
63
|
+
type: 'warning',
|
|
64
|
+
message: formatMessage({
|
|
65
|
+
id: getTranslation('CMEditViewAITranslation.job-failed'),
|
|
66
|
+
defaultMessage: 'AI translation failed. Please try again.'
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
invalidateDocument();
|
|
70
|
+
}
|
|
71
|
+
// Update the previous status if it changed
|
|
72
|
+
if (previousJobStatus !== currentJobStatus) {
|
|
73
|
+
setPreviousJobStatus(currentJobStatus);
|
|
74
|
+
}
|
|
75
|
+
}, [
|
|
76
|
+
currentJobStatus,
|
|
77
|
+
previousJobStatus,
|
|
78
|
+
setPreviousJobStatus,
|
|
79
|
+
toggleNotification,
|
|
80
|
+
formatMessage,
|
|
81
|
+
invalidateDocument
|
|
82
|
+
]);
|
|
83
|
+
return {
|
|
84
|
+
status: job?.status
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { useAILocalizationJobsPolling };
|
|
89
|
+
//# 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, adminApi } from '@strapi/admin/strapi-admin';\nimport { useIntl } from 'react-intl';\nimport { useDispatch } from 'react-redux';\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 const dispatch = useDispatch();\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 const invalidateDocument = React.useCallback(() => {\n dispatch(\n adminApi.util.invalidateTags([\n {\n // @ts-expect-error tag isn't available\n type: 'Document',\n id: collectionType !== 'single-types' ? `${model}_${documentId}` : model,\n },\n ])\n );\n }, [dispatch, collectionType, model, documentId]);\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 invalidateDocument();\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 invalidateDocument();\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 invalidateDocument,\n ]);\n\n return {\n status: job?.status,\n };\n};\n"],"names":["useAILocalizationJobsPolling","documentId","model","collectionType","toggleNotification","useNotification","formatMessage","useIntl","dispatch","useDispatch","previousJobStatus","setPreviousJobStatus","React","useState","data","initialJobData","useGetAILocalizationJobsByDocumentQuery","shouldPoll","status","jobData","skip","pollingInterval","job","currentJobStatus","invalidateDocument","useCallback","adminApi","util","invalidateTags","type","id","useEffect","message","getTranslation","defaultMessage"],"mappings":";;;;;;;AAgBO,MAAMA,+BAA+B,CAAC,EAC3CC,UAAU,EACVC,KAAK,EACLC,cAAc,EACsB,GAAA;IACpC,MAAM,EAAEC,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A,QAAAA;AAAUL,QAAAA,cAAAA;AAAgBD,QAAAA,KAAAA;AAAOD,QAAAA;AAAW,KAAA,CAAA;;AAGhDW,IAAAA,KAAAA,CAAMmB,SAAS,CAAC,IAAA;AACd,QAAA,IAAI,CAACR,gBAAkB,EAAA;;QAGvB,IAAIb,iBAAAA,KAAsB,YAAgBa,IAAAA,gBAAAA,KAAqB,WAAa,EAAA;YAC1EnB,kBAAmB,CAAA;gBACjByB,IAAM,EAAA,SAAA;AACNG,gBAAAA,OAAAA,EAAS1B,aAAc,CAAA;AACrBwB,oBAAAA,EAAAA,EAAIG,cAAe,CAAA,uCAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;AACF,aAAA,CAAA;AACAV,YAAAA,kBAAAA,EAAAA;AACF;QAEA,IAAId,iBAAAA,KAAsB,YAAgBa,IAAAA,gBAAAA,KAAqB,QAAU,EAAA;YACvEnB,kBAAmB,CAAA;gBACjByB,IAAM,EAAA,SAAA;AACNG,gBAAAA,OAAAA,EAAS1B,aAAc,CAAA;AACrBwB,oBAAAA,EAAAA,EAAIG,cAAe,CAAA,oCAAA,CAAA;oBACnBC,cAAgB,EAAA;AAClB,iBAAA;AACF,aAAA,CAAA;AACAV,YAAAA,kBAAAA,EAAAA;AACF;;AAGA,QAAA,IAAId,sBAAsBa,gBAAkB,EAAA;YAC1CZ,oBAAqBY,CAAAA,gBAAAA,CAAAA;AACvB;KACC,EAAA;AACDA,QAAAA,gBAAAA;AACAb,QAAAA,iBAAAA;AACAC,QAAAA,oBAAAA;AACAP,QAAAA,kBAAAA;AACAE,QAAAA,aAAAA;AACAkB,QAAAA;AACD,KAAA,CAAA;IAED,OAAO;AACLN,QAAAA,MAAAA,EAAQI,GAAKJ,EAAAA;AACf,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var api = require('./api.js');
|
|
4
|
+
|
|
5
|
+
// Import the same constant used by the documents service for consistency
|
|
6
|
+
const SINGLE_TYPES = 'single-types';
|
|
7
|
+
const aiLocalizationJobsApi = api.i18nApi.injectEndpoints({
|
|
8
|
+
endpoints: (builder)=>({
|
|
9
|
+
getAILocalizationJobsByDocument: builder.query({
|
|
10
|
+
query: ({ documentId, collectionType, model })=>({
|
|
11
|
+
url: collectionType === SINGLE_TYPES ? `/i18n/ai-localization-jobs/single-types/${model}` : `/i18n/ai-localization-jobs/collection-types/${model}/${documentId}`,
|
|
12
|
+
method: 'GET'
|
|
13
|
+
}),
|
|
14
|
+
providesTags: (result, error, { documentId, model, collectionType })=>[
|
|
15
|
+
{
|
|
16
|
+
type: 'AILocalizationJobs',
|
|
17
|
+
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
const { useGetAILocalizationJobsByDocumentQuery } = aiLocalizationJobsApi;
|
|
24
|
+
|
|
25
|
+
exports.useGetAILocalizationJobsByDocumentQuery = useGetAILocalizationJobsByDocumentQuery;
|
|
26
|
+
//# sourceMappingURL=aiLocalizationJobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiLocalizationJobs.js","sources":["../../../admin/src/services/aiLocalizationJobs.ts"],"sourcesContent":["import { i18nApi } from './api';\n\nimport type { GetAILocalizationJobsByDocument } from '../../../shared/contracts/ai-localization-jobs';\n\n// Import the same constant used by the documents service for consistency\nconst SINGLE_TYPES = 'single-types';\n\nconst aiLocalizationJobsApi = i18nApi.injectEndpoints({\n endpoints: (builder) => ({\n getAILocalizationJobsByDocument: builder.query<\n GetAILocalizationJobsByDocument.Response,\n {\n documentId: string;\n model: string;\n collectionType: string;\n }\n >({\n query: ({ documentId, collectionType, model }) => ({\n url:\n collectionType === SINGLE_TYPES\n ? `/i18n/ai-localization-jobs/single-types/${model}`\n : `/i18n/ai-localization-jobs/collection-types/${model}/${documentId}`,\n method: 'GET',\n }),\n providesTags: (result, error, { documentId, model, collectionType }) => [\n {\n type: 'AILocalizationJobs',\n id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model,\n },\n ],\n }),\n }),\n});\n\nexport const { useGetAILocalizationJobsByDocumentQuery } = aiLocalizationJobsApi;\n"],"names":["SINGLE_TYPES","aiLocalizationJobsApi","i18nApi","injectEndpoints","endpoints","builder","getAILocalizationJobsByDocument","query","documentId","collectionType","model","url","method","providesTags","result","error","type","id","useGetAILocalizationJobsByDocumentQuery"],"mappings":";;;;AAIA;AACA,MAAMA,YAAe,GAAA,cAAA;AAErB,MAAMC,qBAAAA,GAAwBC,WAAQC,CAAAA,eAAe,CAAC;IACpDC,SAAW,EAAA,CAACC,WAAa;YACvBC,+BAAiCD,EAAAA,OAAAA,CAAQE,KAAK,CAO5C;gBACAA,KAAO,EAAA,CAAC,EAAEC,UAAU,EAAEC,cAAc,EAAEC,KAAK,EAAE,IAAM;AACjDC,wBAAAA,GAAAA,EACEF,cAAmBT,KAAAA,YAAAA,GACf,CAAC,wCAAwC,EAAEU,KAAM,CAAA,CAAC,GAClD,CAAC,4CAA4C,EAAEA,KAAAA,CAAM,CAAC,EAAEF,WAAW,CAAC;wBAC1EI,MAAQ,EAAA;qBACV,CAAA;gBACAC,YAAc,EAAA,CAACC,MAAQC,EAAAA,KAAAA,EAAO,EAAEP,UAAU,EAAEE,KAAK,EAAED,cAAc,EAAE,GAAK;AACtE,wBAAA;4BACEO,IAAM,EAAA,oBAAA;4BACNC,EAAIR,EAAAA,cAAAA,KAAmBT,eAAe,CAAC,EAAEU,MAAM,CAAC,EAAEF,UAAW,CAAA,CAAC,GAAGE;AACnE;AACD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEa,MAAA,EAAEQ,uCAAuC,EAAE,GAAGjB;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { i18nApi } from './api.mjs';
|
|
2
|
+
|
|
3
|
+
// Import the same constant used by the documents service for consistency
|
|
4
|
+
const SINGLE_TYPES = 'single-types';
|
|
5
|
+
const aiLocalizationJobsApi = i18nApi.injectEndpoints({
|
|
6
|
+
endpoints: (builder)=>({
|
|
7
|
+
getAILocalizationJobsByDocument: builder.query({
|
|
8
|
+
query: ({ documentId, collectionType, model })=>({
|
|
9
|
+
url: collectionType === SINGLE_TYPES ? `/i18n/ai-localization-jobs/single-types/${model}` : `/i18n/ai-localization-jobs/collection-types/${model}/${documentId}`,
|
|
10
|
+
method: 'GET'
|
|
11
|
+
}),
|
|
12
|
+
providesTags: (result, error, { documentId, model, collectionType })=>[
|
|
13
|
+
{
|
|
14
|
+
type: 'AILocalizationJobs',
|
|
15
|
+
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
const { useGetAILocalizationJobsByDocumentQuery } = aiLocalizationJobsApi;
|
|
22
|
+
|
|
23
|
+
export { useGetAILocalizationJobsByDocumentQuery };
|
|
24
|
+
//# sourceMappingURL=aiLocalizationJobs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiLocalizationJobs.mjs","sources":["../../../admin/src/services/aiLocalizationJobs.ts"],"sourcesContent":["import { i18nApi } from './api';\n\nimport type { GetAILocalizationJobsByDocument } from '../../../shared/contracts/ai-localization-jobs';\n\n// Import the same constant used by the documents service for consistency\nconst SINGLE_TYPES = 'single-types';\n\nconst aiLocalizationJobsApi = i18nApi.injectEndpoints({\n endpoints: (builder) => ({\n getAILocalizationJobsByDocument: builder.query<\n GetAILocalizationJobsByDocument.Response,\n {\n documentId: string;\n model: string;\n collectionType: string;\n }\n >({\n query: ({ documentId, collectionType, model }) => ({\n url:\n collectionType === SINGLE_TYPES\n ? `/i18n/ai-localization-jobs/single-types/${model}`\n : `/i18n/ai-localization-jobs/collection-types/${model}/${documentId}`,\n method: 'GET',\n }),\n providesTags: (result, error, { documentId, model, collectionType }) => [\n {\n type: 'AILocalizationJobs',\n id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model,\n },\n ],\n }),\n }),\n});\n\nexport const { useGetAILocalizationJobsByDocumentQuery } = aiLocalizationJobsApi;\n"],"names":["SINGLE_TYPES","aiLocalizationJobsApi","i18nApi","injectEndpoints","endpoints","builder","getAILocalizationJobsByDocument","query","documentId","collectionType","model","url","method","providesTags","result","error","type","id","useGetAILocalizationJobsByDocumentQuery"],"mappings":";;AAIA;AACA,MAAMA,YAAe,GAAA,cAAA;AAErB,MAAMC,qBAAAA,GAAwBC,OAAQC,CAAAA,eAAe,CAAC;IACpDC,SAAW,EAAA,CAACC,WAAa;YACvBC,+BAAiCD,EAAAA,OAAAA,CAAQE,KAAK,CAO5C;gBACAA,KAAO,EAAA,CAAC,EAAEC,UAAU,EAAEC,cAAc,EAAEC,KAAK,EAAE,IAAM;AACjDC,wBAAAA,GAAAA,EACEF,cAAmBT,KAAAA,YAAAA,GACf,CAAC,wCAAwC,EAAEU,KAAM,CAAA,CAAC,GAClD,CAAC,4CAA4C,EAAEA,KAAAA,CAAM,CAAC,EAAEF,WAAW,CAAC;wBAC1EI,MAAQ,EAAA;qBACV,CAAA;gBACAC,YAAc,EAAA,CAACC,MAAQC,EAAAA,KAAAA,EAAO,EAAEP,UAAU,EAAEE,KAAK,EAAED,cAAc,EAAE,GAAK;AACtE,wBAAA;4BACEO,IAAM,EAAA,oBAAA;4BACNC,EAAIR,EAAAA,cAAAA,KAAmBT,eAAe,CAAC,EAAEU,MAAM,CAAC,EAAEF,UAAW,CAAA,CAAC,GAAGE;AACnE;AACD;AACH,aAAA;SACF;AACF,CAAA,CAAA;AAEa,MAAA,EAAEQ,uCAAuC,EAAE,GAAGjB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["../../../admin/src/services/api.ts"],"sourcesContent":["import { adminApi } from '@strapi/admin/strapi-admin';\n\nconst i18nApi = adminApi.enhanceEndpoints({\n addTagTypes: ['Locale', 'KeyStatistics', 'Settings'],\n});\n\nexport { i18nApi };\n"],"names":["i18nApi","adminApi","enhanceEndpoints","addTagTypes"],"mappings":";;;;AAEMA,MAAAA,OAAAA,GAAUC,oBAASC,CAAAA,gBAAgB,CAAC;IACxCC,WAAa,EAAA;AAAC,QAAA,QAAA;AAAU,QAAA,eAAA;AAAiB,QAAA;
|
|
1
|
+
{"version":3,"file":"api.js","sources":["../../../admin/src/services/api.ts"],"sourcesContent":["import { adminApi } from '@strapi/admin/strapi-admin';\n\nconst i18nApi = adminApi.enhanceEndpoints({\n addTagTypes: ['Locale', 'KeyStatistics', 'Settings', 'AILocalizationJobs'],\n});\n\nexport { i18nApi };\n"],"names":["i18nApi","adminApi","enhanceEndpoints","addTagTypes"],"mappings":";;;;AAEMA,MAAAA,OAAAA,GAAUC,oBAASC,CAAAA,gBAAgB,CAAC;IACxCC,WAAa,EAAA;AAAC,QAAA,QAAA;AAAU,QAAA,eAAA;AAAiB,QAAA,UAAA;AAAY,QAAA;AAAqB;AAC5E,CAAA;;;;"}
|