@strapi/i18n 0.0.0-experimental.afa3b513b8f95459043f33fb94f4bac03af1474f → 0.0.0-experimental.b391efb8ce3832d4f280928b99ef5cb9c228fdee
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/_chunks/{SettingsPage-BjxjwEOb.mjs → SettingsPage-BHvunuIF.mjs} +4 -4
- package/dist/_chunks/SettingsPage-BHvunuIF.mjs.map +1 -0
- package/dist/_chunks/{SettingsPage-CfTmCkup.js → SettingsPage-Bcj7380u.js} +4 -4
- package/dist/_chunks/SettingsPage-Bcj7380u.js.map +1 -0
- package/dist/_chunks/{en-DWpfm8h5.js → en-BKBz3tro.js} +5 -4
- package/dist/_chunks/en-BKBz3tro.js.map +1 -0
- package/dist/_chunks/{en-2xztdZE1.mjs → en-DlXfy6Gy.mjs} +5 -4
- package/dist/_chunks/en-DlXfy6Gy.mjs.map +1 -0
- package/dist/_chunks/{index-5XLZwzwx.js → index-BKZbxhpm.js} +81 -30
- package/dist/_chunks/index-BKZbxhpm.js.map +1 -0
- package/dist/_chunks/{index-D-qx3tz4.mjs → index-DUdrr5PR.mjs} +82 -31
- package/dist/_chunks/index-DUdrr5PR.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/CMHeaderActions.d.ts +5 -3
- package/dist/admin/src/components/CreateLocale.d.ts +6 -6
- package/dist/server/index.js +389 -419
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +391 -421
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/index.d.ts +6 -0
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +6 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/sanitize/index.d.ts +11 -0
- package/dist/server/src/services/sanitize/index.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/_chunks/SettingsPage-BjxjwEOb.mjs.map +0 -1
- package/dist/_chunks/SettingsPage-CfTmCkup.js.map +0 -1
- package/dist/_chunks/en-2xztdZE1.mjs.map +0 -1
- package/dist/_chunks/en-DWpfm8h5.js.map +0 -1
- package/dist/_chunks/index-5XLZwzwx.js.map +0 -1
- package/dist/_chunks/index-D-qx3tz4.mjs.map +0 -1
- package/dist/server/src/migrations/content-type/disable/index.d.ts +0 -3
- package/dist/server/src/migrations/content-type/disable/index.d.ts.map +0 -1
- package/dist/server/src/migrations/content-type/enable/index.d.ts +0 -3
- package/dist/server/src/migrations/content-type/enable/index.d.ts.map +0 -1
@@ -6,7 +6,7 @@ import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
6
6
|
import { useIntl } from "react-intl";
|
7
7
|
import { Plus, Check, Trash, Pencil } from "@strapi/icons";
|
8
8
|
import * as yup from "yup";
|
9
|
-
import { g as getTranslation, u as useCreateLocaleMutation, a as useGetDefaultLocalesQuery, b as useDeleteLocaleMutation, c as useUpdateLocaleMutation, d as useGetLocalesQuery, P as PERMISSIONS } from "./index-
|
9
|
+
import { g as getTranslation, u as useCreateLocaleMutation, a as useGetDefaultLocalesQuery, b as useDeleteLocaleMutation, c as useUpdateLocaleMutation, d as useGetLocalesQuery, P as PERMISSIONS } from "./index-DUdrr5PR.mjs";
|
10
10
|
const isBaseQueryError = (error) => {
|
11
11
|
return error.name !== void 0;
|
12
12
|
};
|
@@ -32,11 +32,11 @@ const CreateLocale = ({ disabled, variant = "default" }) => {
|
|
32
32
|
] });
|
33
33
|
};
|
34
34
|
const LOCALE_SCHEMA = yup.object().shape({
|
35
|
-
code: yup.string().required({
|
35
|
+
code: yup.string().nullable().required({
|
36
36
|
id: "Settings.locales.modal.create.code.error",
|
37
37
|
defaultMessage: "Please select a locale"
|
38
38
|
}),
|
39
|
-
name: yup.string().max(50, {
|
39
|
+
name: yup.string().nullable().max(50, {
|
40
40
|
id: "Settings.locales.modal.create.name.error.min",
|
41
41
|
defaultMessage: "The locale display name can only be less than 50 characters."
|
42
42
|
}).required({
|
@@ -551,4 +551,4 @@ export {
|
|
551
551
|
ProtectedSettingsPage,
|
552
552
|
SettingsPage
|
553
553
|
};
|
554
|
-
//# sourceMappingURL=SettingsPage-
|
554
|
+
//# sourceMappingURL=SettingsPage-BHvunuIF.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SettingsPage-BHvunuIF.mjs","sources":["../../admin/src/utils/baseQuery.ts","../../admin/src/components/CreateLocale.tsx","../../admin/src/components/DeleteLocale.tsx","../../admin/src/components/EditLocale.tsx","../../admin/src/components/LocaleTable.tsx","../../admin/src/pages/SettingsPage.tsx"],"sourcesContent":["import { SerializedError } from '@reduxjs/toolkit';\nimport { type ApiError, type UnknownApiError } from '@strapi/admin/strapi-admin';\n\ntype BaseQueryError = ApiError | UnknownApiError | SerializedError;\n\nconst isBaseQueryError = (error: BaseQueryError): error is ApiError | UnknownApiError => {\n return error.name !== undefined;\n};\n\nexport { isBaseQueryError };\n","import * as React from 'react';\n\nimport {\n Form,\n type InputProps,\n InputRenderer,\n useField,\n type FormHelpers,\n useForm,\n useAPIErrorHandler,\n useNotification,\n useAuth,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n ButtonProps,\n Divider,\n Field,\n Flex,\n Grid,\n Modal,\n SingleSelect,\n SingleSelectOption,\n Tabs,\n Typography,\n useId,\n} from '@strapi/design-system';\nimport { Check, Plus } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport * as yup from 'yup';\n\nimport { CreateLocale } from '../../../shared/contracts/locales';\nimport { useCreateLocaleMutation, useGetDefaultLocalesQuery } from '../services/locales';\nimport { isBaseQueryError } from '../utils/baseQuery';\nimport { getTranslation } from '../utils/getTranslation';\n\n/* -------------------------------------------------------------------------------------------------\n * CreateLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CreateLocaleProps extends Pick<ButtonProps, 'disabled' | 'variant'> {}\n\nconst CreateLocale = ({ disabled, variant = 'default' }: CreateLocaleProps) => {\n const { formatMessage } = useIntl();\n const [visible, setVisible] = React.useState(false);\n\n return (\n <Modal.Root open={visible} onOpenChange={setVisible}>\n <Modal.Trigger>\n <Button\n variant={variant}\n disabled={disabled}\n startIcon={<Plus />}\n onClick={() => setVisible(true)}\n size=\"S\"\n >\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Button>\n </Modal.Trigger>\n <CreateModal onClose={() => setVisible(false)} />\n </Modal.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CreateModal\n * -----------------------------------------------------------------------------------------------*/\n\nconst LOCALE_SCHEMA = yup.object().shape({\n code: yup.string().nullable().required({\n id: 'Settings.locales.modal.create.code.error',\n defaultMessage: 'Please select a locale',\n }),\n name: yup\n .string()\n .nullable()\n .max(50, {\n id: 'Settings.locales.modal.create.name.error.min',\n defaultMessage: 'The locale display name can only be less than 50 characters.',\n })\n .required({\n id: 'Settings.locales.modal.create.name.error.required',\n defaultMessage: 'Please give the locale a display name',\n }),\n isDefault: yup.boolean(),\n});\n\ntype FormValues = CreateLocale.Request['body'];\n\nconst initialFormValues = {\n code: '',\n name: '',\n isDefault: false,\n} satisfies FormValues;\n\ntype ModalCreateProps = {\n onClose: () => void;\n};\n\nconst CreateModal = ({ onClose }: ModalCreateProps) => {\n const titleId = useId();\n const { toggleNotification } = useNotification();\n const {\n _unstableFormatAPIError: formatAPIError,\n _unstableFormatValidationErrors: formatValidationErrors,\n } = useAPIErrorHandler();\n const [createLocale] = useCreateLocaleMutation();\n const { formatMessage } = useIntl();\n const refetchPermissions = useAuth('CreateModal', (state) => state.refetchPermissions);\n\n const handleSubmit = async (values: FormValues, helpers: FormHelpers<FormValues>) => {\n try {\n const res = await createLocale(values);\n\n if ('error' in res) {\n if (isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n }\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.create.success'),\n defaultMessage: 'Created locale',\n }),\n });\n\n refetchPermissions();\n onClose();\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Modal.Content>\n <Form\n method=\"POST\"\n initialValues={initialFormValues}\n validationSchema={LOCALE_SCHEMA}\n onSubmit={handleSubmit}\n >\n <Modal.Header>\n <Modal.Title>\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <Tabs.Root variant=\"simple\" defaultValue=\"basic\">\n <Flex justifyContent=\"space-between\">\n <Typography tag=\"h2\" variant=\"beta\" id={titleId}>\n {formatMessage({\n id: getTranslation('Settings.locales.modal.title'),\n defaultMessage: 'Configuration',\n })}\n </Typography>\n <Tabs.List aria-labelledby={titleId}>\n <Tabs.Trigger value=\"basic\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.base'),\n defaultMessage: 'Basic settings',\n })}\n </Tabs.Trigger>\n <Tabs.Trigger value=\"advanced\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.advanced'),\n defaultMessage: 'Advanced settings',\n })}\n </Tabs.Trigger>\n </Tabs.List>\n </Flex>\n\n <Divider />\n\n <Box paddingTop={7} paddingBottom={7}>\n <Tabs.Content value=\"basic\">\n <BaseForm />\n </Tabs.Content>\n <Tabs.Content value=\"advanced\">\n <AdvancedForm />\n </Tabs.Content>\n </Box>\n </Tabs.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">\n {formatMessage({ id: 'app.components.Button.cancel', defaultMessage: 'Cancel' })}\n </Button>\n </Modal.Close>\n <SubmitButton />\n </Modal.Footer>\n </Form>\n </Modal.Content>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SubmitButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SubmitButton = () => {\n const { formatMessage } = useIntl();\n const isSubmitting = useForm('SubmitButton', (state) => state.isSubmitting);\n const modified = useForm('SubmitButton', (state) => state.modified);\n\n return (\n <Button type=\"submit\" startIcon={<Check />} disabled={isSubmitting || !modified}>\n {formatMessage({ id: 'global.save', defaultMessage: 'Save' })}\n </Button>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BaseForm\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BaseFormProps {\n mode?: 'create' | 'edit';\n}\n\nconst BaseForm = ({ mode = 'create' }: BaseFormProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { data: defaultLocales, error } = useGetDefaultLocalesQuery();\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n if (!Array.isArray(defaultLocales)) {\n return null;\n }\n\n const options = defaultLocales.map((locale) => ({\n label: locale.name,\n value: locale.code,\n }));\n\n const translatedForm = [\n {\n disabled: mode !== 'create',\n label: {\n id: getTranslation('Settings.locales.modal.create.code.label'),\n defaultMessage: 'Locales',\n },\n name: 'code',\n options,\n placeholder: {\n id: 'components.placeholder.select',\n defaultMessage: 'Select',\n },\n required: true,\n size: 6,\n type: 'enumeration' as const,\n },\n {\n hint: {\n id: getTranslation('Settings.locales.modal.create.name.label.description'),\n defaultMessage: 'Locale will be displayed under that name in the administration panel',\n },\n label: {\n id: getTranslation('Settings.locales.modal.create.name.label'),\n defaultMessage: 'Locale display name',\n },\n name: 'name',\n required: true,\n size: 6,\n type: 'string' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n placeholder: field.placeholder ? formatMessage(field.placeholder) : undefined,\n }));\n\n return (\n <Grid.Root gap={4}>\n {translatedForm.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AdvancedForm\n * -----------------------------------------------------------------------------------------------*/\n\ntype AdvancedFormProps = {\n isDefaultLocale?: boolean;\n};\n\nconst AdvancedForm = ({ isDefaultLocale }: AdvancedFormProps) => {\n const { formatMessage } = useIntl();\n\n const form = [\n {\n disabled: isDefaultLocale,\n hint: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault.hint'),\n defaultMessage: 'One default locale is required, change it by selecting another one',\n },\n label: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault'),\n defaultMessage: 'Set as default locale',\n },\n name: 'isDefault',\n size: 6,\n type: 'boolean' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n })) satisfies InputProps[];\n\n return (\n <Grid.Root gap={4}>\n {form.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FormRenderer\n * -----------------------------------------------------------------------------------------------*/\n\nconst FormRenderer = (field: InputProps) => {\n switch (field.type) {\n /**\n * This will override the default input renderer\n * choice for `enumeration`.\n */\n case 'enumeration':\n return <EnumerationInput {...field} />;\n default:\n return <InputRenderer {...field} />;\n }\n};\n\nconst EnumerationInput = ({\n disabled,\n hint,\n label,\n name,\n options,\n placeholder,\n required,\n}: Extract<InputProps, { type: 'enumeration' }>) => {\n const { value, error, onChange } = useField(name);\n const { data: defaultLocales = [] } = useGetDefaultLocalesQuery();\n\n const handleChange = (value: string) => {\n if (Array.isArray(defaultLocales)) {\n // We know it exists because the options are created from the list of default locales\n const locale = defaultLocales.find((locale) => locale.code === value)!;\n\n onChange(name, value);\n // This lets us automatically fill the name field with the locale name\n onChange('name', locale.name);\n } else {\n onChange(name, value);\n }\n };\n\n return (\n <Field.Root error={error} hint={hint} name={name} required={required}>\n <Field.Label>{label}</Field.Label>\n <SingleSelect\n disabled={disabled}\n // @ts-expect-error – This will dissapear when the DS removes support for numbers to be returned by SingleSelect.\n onChange={handleChange}\n placeholder={placeholder}\n value={value}\n >\n {options.map((option) => (\n <SingleSelectOption value={option.value} key={option.value}>\n {option.label}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n};\n\nexport { CreateLocale, BaseForm, AdvancedForm, SubmitButton, LOCALE_SCHEMA };\n","import * as React from 'react';\n\nimport { ConfirmDialog, useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { Dialog, IconButton } from '@strapi/design-system';\nimport { Trash } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { useDeleteLocaleMutation } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { Locale } from '../../../shared/contracts/locales';\n\n/* -------------------------------------------------------------------------------------------------\n * DeleteLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DeleteLocaleProps extends Locale {}\n\nconst DeleteLocale = ({ id, name }: DeleteLocaleProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const [visible, setVisible] = React.useState(false);\n\n const [deleteLocale] = useDeleteLocaleMutation();\n const handleConfirm = async () => {\n try {\n const res = await deleteLocale(id);\n\n if ('error' in res) {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.delete.success'),\n defaultMessage: 'Deleted locale',\n }),\n });\n\n setVisible(false);\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Dialog.Root open={visible} onOpenChange={setVisible}>\n <Dialog.Trigger>\n <IconButton\n onClick={() => setVisible(true)}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.delete'),\n defaultMessage: 'Delete {name} locale',\n },\n {\n name,\n }\n )}\n variant=\"ghost\"\n >\n <Trash />\n </IconButton>\n </Dialog.Trigger>\n <ConfirmDialog onConfirm={handleConfirm} />\n </Dialog.Root>\n );\n};\n\nexport { DeleteLocale };\n","import * as React from 'react';\n\nimport {\n useNotification,\n useAPIErrorHandler,\n Form,\n FormHelpers,\n useAuth,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n Divider,\n Flex,\n IconButton,\n Modal,\n Tabs,\n Typography,\n useId,\n} from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { Locale, UpdateLocale } from '../../../shared/contracts/locales';\nimport { useUpdateLocaleMutation } from '../services/locales';\nimport { isBaseQueryError } from '../utils/baseQuery';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport { AdvancedForm, BaseForm, LOCALE_SCHEMA, SubmitButton } from './CreateLocale';\n\n/* -------------------------------------------------------------------------------------------------\n * EditLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EditLocaleProps extends Omit<EditModalProps, 'open' | 'onOpenChange'> {}\n\nconst EditLocale = (props: EditLocaleProps) => {\n const { formatMessage } = useIntl();\n const [visible, setVisible] = React.useState(false);\n\n return (\n <>\n <IconButton\n onClick={() => setVisible(true)}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit {name} locale',\n },\n {\n name: props.name,\n }\n )}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n <EditModal {...props} open={visible} onOpenChange={setVisible} />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * EditModal\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EditModalProps extends Pick<Locale, 'id' | 'isDefault' | 'name' | 'code'> {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}\n\ntype FormValues = UpdateLocale.Request['body'] & { code: string };\n\n/**\n * @internal\n * @description Exported to be used when someone clicks on a table row.\n */\nconst EditModal = ({ id, code, isDefault, name, open, onOpenChange }: EditModalProps) => {\n const { toggleNotification } = useNotification();\n const {\n _unstableFormatAPIError: formatAPIError,\n _unstableFormatValidationErrors: formatValidationErrors,\n } = useAPIErrorHandler();\n const refetchPermissions = useAuth('EditModal', (state) => state.refetchPermissions);\n const { formatMessage } = useIntl();\n const titleId = useId();\n\n const [updateLocale] = useUpdateLocaleMutation();\n const handleSubmit = async (\n { code: _code, ...data }: FormValues,\n helpers: FormHelpers<FormValues>\n ) => {\n try {\n /**\n * We don't need to send the code, because the\n * code can never be changed.\n */\n const res = await updateLocale({\n id,\n ...data,\n });\n\n if ('error' in res) {\n if (isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n }\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.edit.success'),\n defaultMessage: 'Updated locale',\n }),\n });\n\n refetchPermissions();\n onOpenChange(false);\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Modal.Root open={open} onOpenChange={onOpenChange}>\n <Modal.Content>\n <Form\n method=\"PUT\"\n onSubmit={handleSubmit}\n initialValues={{\n code,\n name,\n isDefault,\n }}\n validationSchema={LOCALE_SCHEMA}\n >\n <Modal.Header>\n <Modal.Title>\n {formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit a locale',\n },\n {\n name,\n }\n )}\n </Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <Tabs.Root variant=\"simple\" defaultValue=\"basic\">\n <Flex justifyContent=\"space-between\">\n <Typography tag=\"h2\" variant=\"beta\" id={titleId}>\n {formatMessage({\n id: getTranslation('Settings.locales.modal.title'),\n defaultMessage: 'Configuration',\n })}\n </Typography>\n <Tabs.List aria-labelledby={titleId}>\n <Tabs.Trigger value=\"basic\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.base'),\n defaultMessage: 'Basic settings',\n })}\n </Tabs.Trigger>\n <Tabs.Trigger value=\"advanced\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.advanced'),\n defaultMessage: 'Advanced settings',\n })}\n </Tabs.Trigger>\n </Tabs.List>\n </Flex>\n <Divider />\n <Box paddingTop={7} paddingBottom={7}>\n <Tabs.Content value=\"basic\">\n <BaseForm mode=\"edit\" />\n </Tabs.Content>\n <Tabs.Content value=\"advanced\">\n <AdvancedForm isDefaultLocale={isDefault} />\n </Tabs.Content>\n </Box>\n </Tabs.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">\n {formatMessage({ id: 'app.components.Button.cancel', defaultMessage: 'Cancel' })}\n </Button>\n </Modal.Close>\n <SubmitButton />\n </Modal.Footer>\n </Form>\n </Modal.Content>\n </Modal.Root>\n );\n};\n\nexport { EditLocale, EditModal };\n","import * as React from 'react';\n\nimport {\n Flex,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n} from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport { DeleteLocale } from './DeleteLocale';\nimport { EditLocale, EditModal } from './EditLocale';\n\nimport type { Locale } from '../../../shared/contracts/locales';\n\n/* -------------------------------------------------------------------------------------------------\n * LocaleTable\n * -----------------------------------------------------------------------------------------------*/\n\ntype LocaleTableProps = {\n locales?: Locale[];\n canDelete?: boolean;\n canUpdate?: boolean;\n onDeleteLocale?: (locale: Locale) => void;\n onEditLocale?: (locale: Locale) => void;\n};\n\nconst LocaleTable = ({ locales = [], canDelete, canUpdate }: LocaleTableProps) => {\n const [editLocaleId, setEditLocaleId] = React.useState<Locale['id']>();\n const { formatMessage } = useIntl();\n\n const handleClick = (localeId: Locale['id']) => () => {\n if (canUpdate) {\n setEditLocaleId(localeId);\n }\n };\n\n return (\n <Table colCount={4} rowCount={locales.length + 1}>\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.id'),\n defaultMessage: 'ID',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.displayName'),\n defaultMessage: 'Display name',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.default-locale'),\n defaultMessage: 'Default locale',\n })}\n </Typography>\n </Th>\n <Th>\n <VisuallyHidden>Actions</VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n {locales.map((locale) => (\n <React.Fragment key={locale.id}>\n <Tr\n onClick={handleClick(locale.id)}\n style={{ cursor: canUpdate ? 'pointer' : 'default' }}\n >\n <Td>\n <Typography textColor=\"neutral800\">{locale.id}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{locale.name}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">\n {locale.isDefault\n ? formatMessage({\n id: getTranslation('Settings.locales.default'),\n defaultMessage: 'Default',\n })\n : null}\n </Typography>\n </Td>\n <Td>\n <Flex gap={1} justifyContent=\"flex-end\" onClick={(e) => e.stopPropagation()}>\n {canUpdate && <EditLocale {...locale} />}\n {canDelete && !locale.isDefault && <DeleteLocale {...locale} />}\n </Flex>\n </Td>\n </Tr>\n <EditModal\n {...locale}\n onOpenChange={() => setEditLocaleId(undefined)}\n open={editLocaleId === locale.id}\n />\n </React.Fragment>\n ))}\n </Tbody>\n </Table>\n );\n};\n\nexport { LocaleTable };\nexport type { LocaleTableProps };\n","import * as React from 'react';\n\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useRBAC,\n Layouts,\n} from '@strapi/admin/strapi-admin';\nimport { EmptyStateLayout } from '@strapi/design-system';\nimport { EmptyDocuments } from '@strapi/icons/symbols';\nimport { useIntl } from 'react-intl';\n\nimport { CreateLocale } from '../components/CreateLocale';\nimport { LocaleTable } from '../components/LocaleTable';\nimport { PERMISSIONS } from '../constants';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nconst SettingsPage = () => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { data: locales, isLoading: isLoadingLocales, error } = useGetLocalesQuery();\n const {\n isLoading: isLoadingRBAC,\n allowedActions: { canUpdate, canCreate, canDelete },\n } = useRBAC(PERMISSIONS);\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const isLoading = isLoadingLocales || isLoadingRBAC;\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !Array.isArray(locales)) {\n return <Page.Error />;\n }\n\n return (\n <Page.Main tabIndex={-1}>\n <Layouts.Header\n primaryAction={<CreateLocale disabled={!canCreate} />}\n title={formatMessage({\n id: getTranslation('plugin.name'),\n defaultMessage: 'Internationalization',\n })}\n subtitle={formatMessage({\n id: getTranslation('Settings.list.description'),\n defaultMessage: 'Configure the settings',\n })}\n />\n <Layouts.Content>\n {locales.length > 0 ? (\n <LocaleTable locales={locales} canDelete={canDelete} canUpdate={canUpdate} />\n ) : (\n <EmptyStateLayout\n icon={<EmptyDocuments width={undefined} height={undefined} />}\n content={formatMessage({\n id: getTranslation('Settings.list.empty.title'),\n defaultMessage: 'There are no locales',\n })}\n action={<CreateLocale disabled={!canCreate} variant=\"secondary\" />}\n />\n )}\n </Layouts.Content>\n </Page.Main>\n );\n};\n\nconst ProtectedSettingsPage = () => {\n return (\n <Page.Protect permissions={PERMISSIONS.read}>\n <SettingsPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedSettingsPage, SettingsPage };\n"],"names":["value","locale"],"mappings":";;;;;;;;;AAKA,MAAM,mBAAmB,CAAC,UAA+D;AACvF,SAAO,MAAM,SAAS;AACxB;ACoCA,MAAM,eAAe,CAAC,EAAE,UAAU,UAAU,gBAAmC;AACvE,QAAA,EAAE,kBAAkB;AAC1B,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,KAAK;AAElD,8BACG,MAAM,MAAN,EAAW,MAAM,SAAS,cAAc,YACvC,UAAA;AAAA,IAAC,oBAAA,MAAM,SAAN,EACC,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,+BAAY,MAAK,EAAA;AAAA,QACjB,SAAS,MAAM,WAAW,IAAI;AAAA,QAC9B,MAAK;AAAA,QAEJ,UAAc,cAAA;AAAA,UACb,IAAI,eAAe,2BAA2B;AAAA,UAC9C,gBAAgB;AAAA,QAAA,CACjB;AAAA,MAAA;AAAA,IAAA,GAEL;AAAA,wBACC,aAAY,EAAA,SAAS,MAAM,WAAW,KAAK,GAAG;AAAA,EACjD,EAAA,CAAA;AAEJ;AAMA,MAAM,gBAAgB,IAAI,OAAO,EAAE,MAAM;AAAA,EACvC,MAAM,IAAI,OAAS,EAAA,SAAA,EAAW,SAAS;AAAA,IACrC,IAAI;AAAA,IACJ,gBAAgB;AAAA,EAAA,CACjB;AAAA,EACD,MAAM,IACH,OAAA,EACA,SAAS,EACT,IAAI,IAAI;AAAA,IACP,IAAI;AAAA,IACJ,gBAAgB;AAAA,EACjB,CAAA,EACA,SAAS;AAAA,IACR,IAAI;AAAA,IACJ,gBAAgB;AAAA,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L,CAAa,CAAA;AAAA,EACvB;AAEA,MAAI,SAAS,CAAC,MAAM,QAAQ,OAAO,GAAG;AAC7B,WAAA,oBAAC,KAAK,OAAL,CAAW,CAAA;AAAA,EACrB;AAEA,SACG,qBAAA,KAAK,MAAL,EAAU,UAAU,IACnB,UAAA;AAAA,IAAA;AAAA,MAAC,QAAQ;AAAA,MAAR;AAAA,QACC,eAAe,oBAAC,cAAa,EAAA,UAAU,CAAC,UAAW,CAAA;AAAA,QACnD,OAAO,cAAc;AAAA,UACnB,IAAI,eAAe,aAAa;AAAA,UAChC,gBAAgB;AAAA,QAAA,CACjB;AAAA,QACD,UAAU,cAAc;AAAA,UACtB,IAAI,eAAe,2BAA2B;AAAA,UAC9C,gBAAgB;AAAA,QAAA,CACjB;AAAA,MAAA;AAAA,IACH;AAAA,IACC,oBAAA,QAAQ,SAAR,EACE,UAAQ,QAAA,SAAS,IAChB,oBAAC,aAAY,EAAA,SAAkB,WAAsB,UAAA,CAAsB,IAE3E;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAO,oBAAA,gBAAA,EAAe,OAAO,QAAW,QAAQ,QAAW;AAAA,QAC3D,SAAS,cAAc;AAAA,UACrB,IAAI,eAAe,2BAA2B;AAAA,UAC9C,gBAAgB;AAAA,QAAA,CACjB;AAAA,QACD,QAAS,oBAAA,cAAA,EAAa,UAAU,CAAC,WAAW,SAAQ,aAAY;AAAA,MAAA;AAAA,IAAA,GAGtE;AAAA,EACF,EAAA,CAAA;AAEJ;AAEA,MAAM,wBAAwB,MAAM;AAEhC,SAAA,oBAAC,KAAK,SAAL,EAAa,aAAa,YAAY,MACrC,UAAC,oBAAA,cAAA,CAAa,CAAA,EAChB,CAAA;AAEJ;"}
|
@@ -8,7 +8,7 @@ const symbols = require("@strapi/icons/symbols");
|
|
8
8
|
const reactIntl = require("react-intl");
|
9
9
|
const icons = require("@strapi/icons");
|
10
10
|
const yup = require("yup");
|
11
|
-
const index = require("./index-
|
11
|
+
const index = require("./index-BKZbxhpm.js");
|
12
12
|
function _interopNamespace(e) {
|
13
13
|
if (e && e.__esModule)
|
14
14
|
return e;
|
@@ -54,11 +54,11 @@ const CreateLocale = ({ disabled, variant = "default" }) => {
|
|
54
54
|
] });
|
55
55
|
};
|
56
56
|
const LOCALE_SCHEMA = yup__namespace.object().shape({
|
57
|
-
code: yup__namespace.string().required({
|
57
|
+
code: yup__namespace.string().nullable().required({
|
58
58
|
id: "Settings.locales.modal.create.code.error",
|
59
59
|
defaultMessage: "Please select a locale"
|
60
60
|
}),
|
61
|
-
name: yup__namespace.string().max(50, {
|
61
|
+
name: yup__namespace.string().nullable().max(50, {
|
62
62
|
id: "Settings.locales.modal.create.name.error.min",
|
63
63
|
defaultMessage: "The locale display name can only be less than 50 characters."
|
64
64
|
}).required({
|
@@ -571,4 +571,4 @@ const ProtectedSettingsPage = () => {
|
|
571
571
|
};
|
572
572
|
exports.ProtectedSettingsPage = ProtectedSettingsPage;
|
573
573
|
exports.SettingsPage = SettingsPage;
|
574
|
-
//# sourceMappingURL=SettingsPage-
|
574
|
+
//# sourceMappingURL=SettingsPage-Bcj7380u.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SettingsPage-Bcj7380u.js","sources":["../../admin/src/utils/baseQuery.ts","../../admin/src/components/CreateLocale.tsx","../../admin/src/components/DeleteLocale.tsx","../../admin/src/components/EditLocale.tsx","../../admin/src/components/LocaleTable.tsx","../../admin/src/pages/SettingsPage.tsx"],"sourcesContent":["import { SerializedError } from '@reduxjs/toolkit';\nimport { type ApiError, type UnknownApiError } from '@strapi/admin/strapi-admin';\n\ntype BaseQueryError = ApiError | UnknownApiError | SerializedError;\n\nconst isBaseQueryError = (error: BaseQueryError): error is ApiError | UnknownApiError => {\n return error.name !== undefined;\n};\n\nexport { isBaseQueryError };\n","import * as React from 'react';\n\nimport {\n Form,\n type InputProps,\n InputRenderer,\n useField,\n type FormHelpers,\n useForm,\n useAPIErrorHandler,\n useNotification,\n useAuth,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n ButtonProps,\n Divider,\n Field,\n Flex,\n Grid,\n Modal,\n SingleSelect,\n SingleSelectOption,\n Tabs,\n Typography,\n useId,\n} from '@strapi/design-system';\nimport { Check, Plus } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport * as yup from 'yup';\n\nimport { CreateLocale } from '../../../shared/contracts/locales';\nimport { useCreateLocaleMutation, useGetDefaultLocalesQuery } from '../services/locales';\nimport { isBaseQueryError } from '../utils/baseQuery';\nimport { getTranslation } from '../utils/getTranslation';\n\n/* -------------------------------------------------------------------------------------------------\n * CreateLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CreateLocaleProps extends Pick<ButtonProps, 'disabled' | 'variant'> {}\n\nconst CreateLocale = ({ disabled, variant = 'default' }: CreateLocaleProps) => {\n const { formatMessage } = useIntl();\n const [visible, setVisible] = React.useState(false);\n\n return (\n <Modal.Root open={visible} onOpenChange={setVisible}>\n <Modal.Trigger>\n <Button\n variant={variant}\n disabled={disabled}\n startIcon={<Plus />}\n onClick={() => setVisible(true)}\n size=\"S\"\n >\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Button>\n </Modal.Trigger>\n <CreateModal onClose={() => setVisible(false)} />\n </Modal.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * CreateModal\n * -----------------------------------------------------------------------------------------------*/\n\nconst LOCALE_SCHEMA = yup.object().shape({\n code: yup.string().nullable().required({\n id: 'Settings.locales.modal.create.code.error',\n defaultMessage: 'Please select a locale',\n }),\n name: yup\n .string()\n .nullable()\n .max(50, {\n id: 'Settings.locales.modal.create.name.error.min',\n defaultMessage: 'The locale display name can only be less than 50 characters.',\n })\n .required({\n id: 'Settings.locales.modal.create.name.error.required',\n defaultMessage: 'Please give the locale a display name',\n }),\n isDefault: yup.boolean(),\n});\n\ntype FormValues = CreateLocale.Request['body'];\n\nconst initialFormValues = {\n code: '',\n name: '',\n isDefault: false,\n} satisfies FormValues;\n\ntype ModalCreateProps = {\n onClose: () => void;\n};\n\nconst CreateModal = ({ onClose }: ModalCreateProps) => {\n const titleId = useId();\n const { toggleNotification } = useNotification();\n const {\n _unstableFormatAPIError: formatAPIError,\n _unstableFormatValidationErrors: formatValidationErrors,\n } = useAPIErrorHandler();\n const [createLocale] = useCreateLocaleMutation();\n const { formatMessage } = useIntl();\n const refetchPermissions = useAuth('CreateModal', (state) => state.refetchPermissions);\n\n const handleSubmit = async (values: FormValues, helpers: FormHelpers<FormValues>) => {\n try {\n const res = await createLocale(values);\n\n if ('error' in res) {\n if (isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n }\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.create.success'),\n defaultMessage: 'Created locale',\n }),\n });\n\n refetchPermissions();\n onClose();\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Modal.Content>\n <Form\n method=\"POST\"\n initialValues={initialFormValues}\n validationSchema={LOCALE_SCHEMA}\n onSubmit={handleSubmit}\n >\n <Modal.Header>\n <Modal.Title>\n {formatMessage({\n id: getTranslation('Settings.list.actions.add'),\n defaultMessage: 'Add new locale',\n })}\n </Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <Tabs.Root variant=\"simple\" defaultValue=\"basic\">\n <Flex justifyContent=\"space-between\">\n <Typography tag=\"h2\" variant=\"beta\" id={titleId}>\n {formatMessage({\n id: getTranslation('Settings.locales.modal.title'),\n defaultMessage: 'Configuration',\n })}\n </Typography>\n <Tabs.List aria-labelledby={titleId}>\n <Tabs.Trigger value=\"basic\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.base'),\n defaultMessage: 'Basic settings',\n })}\n </Tabs.Trigger>\n <Tabs.Trigger value=\"advanced\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.advanced'),\n defaultMessage: 'Advanced settings',\n })}\n </Tabs.Trigger>\n </Tabs.List>\n </Flex>\n\n <Divider />\n\n <Box paddingTop={7} paddingBottom={7}>\n <Tabs.Content value=\"basic\">\n <BaseForm />\n </Tabs.Content>\n <Tabs.Content value=\"advanced\">\n <AdvancedForm />\n </Tabs.Content>\n </Box>\n </Tabs.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">\n {formatMessage({ id: 'app.components.Button.cancel', defaultMessage: 'Cancel' })}\n </Button>\n </Modal.Close>\n <SubmitButton />\n </Modal.Footer>\n </Form>\n </Modal.Content>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * SubmitButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SubmitButton = () => {\n const { formatMessage } = useIntl();\n const isSubmitting = useForm('SubmitButton', (state) => state.isSubmitting);\n const modified = useForm('SubmitButton', (state) => state.modified);\n\n return (\n <Button type=\"submit\" startIcon={<Check />} disabled={isSubmitting || !modified}>\n {formatMessage({ id: 'global.save', defaultMessage: 'Save' })}\n </Button>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * BaseForm\n * -----------------------------------------------------------------------------------------------*/\n\ninterface BaseFormProps {\n mode?: 'create' | 'edit';\n}\n\nconst BaseForm = ({ mode = 'create' }: BaseFormProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { data: defaultLocales, error } = useGetDefaultLocalesQuery();\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n if (!Array.isArray(defaultLocales)) {\n return null;\n }\n\n const options = defaultLocales.map((locale) => ({\n label: locale.name,\n value: locale.code,\n }));\n\n const translatedForm = [\n {\n disabled: mode !== 'create',\n label: {\n id: getTranslation('Settings.locales.modal.create.code.label'),\n defaultMessage: 'Locales',\n },\n name: 'code',\n options,\n placeholder: {\n id: 'components.placeholder.select',\n defaultMessage: 'Select',\n },\n required: true,\n size: 6,\n type: 'enumeration' as const,\n },\n {\n hint: {\n id: getTranslation('Settings.locales.modal.create.name.label.description'),\n defaultMessage: 'Locale will be displayed under that name in the administration panel',\n },\n label: {\n id: getTranslation('Settings.locales.modal.create.name.label'),\n defaultMessage: 'Locale display name',\n },\n name: 'name',\n required: true,\n size: 6,\n type: 'string' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n placeholder: field.placeholder ? formatMessage(field.placeholder) : undefined,\n }));\n\n return (\n <Grid.Root gap={4}>\n {translatedForm.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * AdvancedForm\n * -----------------------------------------------------------------------------------------------*/\n\ntype AdvancedFormProps = {\n isDefaultLocale?: boolean;\n};\n\nconst AdvancedForm = ({ isDefaultLocale }: AdvancedFormProps) => {\n const { formatMessage } = useIntl();\n\n const form = [\n {\n disabled: isDefaultLocale,\n hint: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault.hint'),\n defaultMessage: 'One default locale is required, change it by selecting another one',\n },\n label: {\n id: getTranslation('Settings.locales.modal.advanced.setAsDefault'),\n defaultMessage: 'Set as default locale',\n },\n name: 'isDefault',\n size: 6,\n type: 'boolean' as const,\n },\n ].map((field) => ({\n ...field,\n hint: field.hint ? formatMessage(field.hint) : undefined,\n label: formatMessage(field.label),\n })) satisfies InputProps[];\n\n return (\n <Grid.Root gap={4}>\n {form.map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <FormRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * FormRenderer\n * -----------------------------------------------------------------------------------------------*/\n\nconst FormRenderer = (field: InputProps) => {\n switch (field.type) {\n /**\n * This will override the default input renderer\n * choice for `enumeration`.\n */\n case 'enumeration':\n return <EnumerationInput {...field} />;\n default:\n return <InputRenderer {...field} />;\n }\n};\n\nconst EnumerationInput = ({\n disabled,\n hint,\n label,\n name,\n options,\n placeholder,\n required,\n}: Extract<InputProps, { type: 'enumeration' }>) => {\n const { value, error, onChange } = useField(name);\n const { data: defaultLocales = [] } = useGetDefaultLocalesQuery();\n\n const handleChange = (value: string) => {\n if (Array.isArray(defaultLocales)) {\n // We know it exists because the options are created from the list of default locales\n const locale = defaultLocales.find((locale) => locale.code === value)!;\n\n onChange(name, value);\n // This lets us automatically fill the name field with the locale name\n onChange('name', locale.name);\n } else {\n onChange(name, value);\n }\n };\n\n return (\n <Field.Root error={error} hint={hint} name={name} required={required}>\n <Field.Label>{label}</Field.Label>\n <SingleSelect\n disabled={disabled}\n // @ts-expect-error – This will dissapear when the DS removes support for numbers to be returned by SingleSelect.\n onChange={handleChange}\n placeholder={placeholder}\n value={value}\n >\n {options.map((option) => (\n <SingleSelectOption value={option.value} key={option.value}>\n {option.label}\n </SingleSelectOption>\n ))}\n </SingleSelect>\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n};\n\nexport { CreateLocale, BaseForm, AdvancedForm, SubmitButton, LOCALE_SCHEMA };\n","import * as React from 'react';\n\nimport { ConfirmDialog, useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { Dialog, IconButton } from '@strapi/design-system';\nimport { Trash } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { useDeleteLocaleMutation } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { Locale } from '../../../shared/contracts/locales';\n\n/* -------------------------------------------------------------------------------------------------\n * DeleteLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DeleteLocaleProps extends Locale {}\n\nconst DeleteLocale = ({ id, name }: DeleteLocaleProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const [visible, setVisible] = React.useState(false);\n\n const [deleteLocale] = useDeleteLocaleMutation();\n const handleConfirm = async () => {\n try {\n const res = await deleteLocale(id);\n\n if ('error' in res) {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.delete.success'),\n defaultMessage: 'Deleted locale',\n }),\n });\n\n setVisible(false);\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Dialog.Root open={visible} onOpenChange={setVisible}>\n <Dialog.Trigger>\n <IconButton\n onClick={() => setVisible(true)}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.delete'),\n defaultMessage: 'Delete {name} locale',\n },\n {\n name,\n }\n )}\n variant=\"ghost\"\n >\n <Trash />\n </IconButton>\n </Dialog.Trigger>\n <ConfirmDialog onConfirm={handleConfirm} />\n </Dialog.Root>\n );\n};\n\nexport { DeleteLocale };\n","import * as React from 'react';\n\nimport {\n useNotification,\n useAPIErrorHandler,\n Form,\n FormHelpers,\n useAuth,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Button,\n Divider,\n Flex,\n IconButton,\n Modal,\n Tabs,\n Typography,\n useId,\n} from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { Locale, UpdateLocale } from '../../../shared/contracts/locales';\nimport { useUpdateLocaleMutation } from '../services/locales';\nimport { isBaseQueryError } from '../utils/baseQuery';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport { AdvancedForm, BaseForm, LOCALE_SCHEMA, SubmitButton } from './CreateLocale';\n\n/* -------------------------------------------------------------------------------------------------\n * EditLocale\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EditLocaleProps extends Omit<EditModalProps, 'open' | 'onOpenChange'> {}\n\nconst EditLocale = (props: EditLocaleProps) => {\n const { formatMessage } = useIntl();\n const [visible, setVisible] = React.useState(false);\n\n return (\n <>\n <IconButton\n onClick={() => setVisible(true)}\n label={formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit {name} locale',\n },\n {\n name: props.name,\n }\n )}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n <EditModal {...props} open={visible} onOpenChange={setVisible} />\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * EditModal\n * -----------------------------------------------------------------------------------------------*/\n\ninterface EditModalProps extends Pick<Locale, 'id' | 'isDefault' | 'name' | 'code'> {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}\n\ntype FormValues = UpdateLocale.Request['body'] & { code: string };\n\n/**\n * @internal\n * @description Exported to be used when someone clicks on a table row.\n */\nconst EditModal = ({ id, code, isDefault, name, open, onOpenChange }: EditModalProps) => {\n const { toggleNotification } = useNotification();\n const {\n _unstableFormatAPIError: formatAPIError,\n _unstableFormatValidationErrors: formatValidationErrors,\n } = useAPIErrorHandler();\n const refetchPermissions = useAuth('EditModal', (state) => state.refetchPermissions);\n const { formatMessage } = useIntl();\n const titleId = useId();\n\n const [updateLocale] = useUpdateLocaleMutation();\n const handleSubmit = async (\n { code: _code, ...data }: FormValues,\n helpers: FormHelpers<FormValues>\n ) => {\n try {\n /**\n * We don't need to send the code, because the\n * code can never be changed.\n */\n const res = await updateLocale({\n id,\n ...data,\n });\n\n if ('error' in res) {\n if (isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else {\n toggleNotification({ type: 'danger', message: formatAPIError(res.error) });\n }\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: getTranslation('Settings.locales.modal.edit.success'),\n defaultMessage: 'Updated locale',\n }),\n });\n\n refetchPermissions();\n onOpenChange(false);\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n }),\n });\n }\n };\n\n return (\n <Modal.Root open={open} onOpenChange={onOpenChange}>\n <Modal.Content>\n <Form\n method=\"PUT\"\n onSubmit={handleSubmit}\n initialValues={{\n code,\n name,\n isDefault,\n }}\n validationSchema={LOCALE_SCHEMA}\n >\n <Modal.Header>\n <Modal.Title>\n {formatMessage(\n {\n id: getTranslation('Settings.list.actions.edit'),\n defaultMessage: 'Edit a locale',\n },\n {\n name,\n }\n )}\n </Modal.Title>\n </Modal.Header>\n <Modal.Body>\n <Tabs.Root variant=\"simple\" defaultValue=\"basic\">\n <Flex justifyContent=\"space-between\">\n <Typography tag=\"h2\" variant=\"beta\" id={titleId}>\n {formatMessage({\n id: getTranslation('Settings.locales.modal.title'),\n defaultMessage: 'Configuration',\n })}\n </Typography>\n <Tabs.List aria-labelledby={titleId}>\n <Tabs.Trigger value=\"basic\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.base'),\n defaultMessage: 'Basic settings',\n })}\n </Tabs.Trigger>\n <Tabs.Trigger value=\"advanced\">\n {formatMessage({\n id: getTranslation('Settings.locales.modal.advanced'),\n defaultMessage: 'Advanced settings',\n })}\n </Tabs.Trigger>\n </Tabs.List>\n </Flex>\n <Divider />\n <Box paddingTop={7} paddingBottom={7}>\n <Tabs.Content value=\"basic\">\n <BaseForm mode=\"edit\" />\n </Tabs.Content>\n <Tabs.Content value=\"advanced\">\n <AdvancedForm isDefaultLocale={isDefault} />\n </Tabs.Content>\n </Box>\n </Tabs.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">\n {formatMessage({ id: 'app.components.Button.cancel', defaultMessage: 'Cancel' })}\n </Button>\n </Modal.Close>\n <SubmitButton />\n </Modal.Footer>\n </Form>\n </Modal.Content>\n </Modal.Root>\n );\n};\n\nexport { EditLocale, EditModal };\n","import * as React from 'react';\n\nimport {\n Flex,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n} from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport { DeleteLocale } from './DeleteLocale';\nimport { EditLocale, EditModal } from './EditLocale';\n\nimport type { Locale } from '../../../shared/contracts/locales';\n\n/* -------------------------------------------------------------------------------------------------\n * LocaleTable\n * -----------------------------------------------------------------------------------------------*/\n\ntype LocaleTableProps = {\n locales?: Locale[];\n canDelete?: boolean;\n canUpdate?: boolean;\n onDeleteLocale?: (locale: Locale) => void;\n onEditLocale?: (locale: Locale) => void;\n};\n\nconst LocaleTable = ({ locales = [], canDelete, canUpdate }: LocaleTableProps) => {\n const [editLocaleId, setEditLocaleId] = React.useState<Locale['id']>();\n const { formatMessage } = useIntl();\n\n const handleClick = (localeId: Locale['id']) => () => {\n if (canUpdate) {\n setEditLocaleId(localeId);\n }\n };\n\n return (\n <Table colCount={4} rowCount={locales.length + 1}>\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.id'),\n defaultMessage: 'ID',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.displayName'),\n defaultMessage: 'Display name',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.default-locale'),\n defaultMessage: 'Default locale',\n })}\n </Typography>\n </Th>\n <Th>\n <VisuallyHidden>Actions</VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n {locales.map((locale) => (\n <React.Fragment key={locale.id}>\n <Tr\n onClick={handleClick(locale.id)}\n style={{ cursor: canUpdate ? 'pointer' : 'default' }}\n >\n <Td>\n <Typography textColor=\"neutral800\">{locale.id}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{locale.name}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">\n {locale.isDefault\n ? formatMessage({\n id: getTranslation('Settings.locales.default'),\n defaultMessage: 'Default',\n })\n : null}\n </Typography>\n </Td>\n <Td>\n <Flex gap={1} justifyContent=\"flex-end\" onClick={(e) => e.stopPropagation()}>\n {canUpdate && <EditLocale {...locale} />}\n {canDelete && !locale.isDefault && <DeleteLocale {...locale} />}\n </Flex>\n </Td>\n </Tr>\n <EditModal\n {...locale}\n onOpenChange={() => setEditLocaleId(undefined)}\n open={editLocaleId === locale.id}\n />\n </React.Fragment>\n ))}\n </Tbody>\n </Table>\n );\n};\n\nexport { LocaleTable };\nexport type { LocaleTableProps };\n","import * as React from 'react';\n\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useRBAC,\n Layouts,\n} from '@strapi/admin/strapi-admin';\nimport { EmptyStateLayout } from '@strapi/design-system';\nimport { EmptyDocuments } from '@strapi/icons/symbols';\nimport { useIntl } from 'react-intl';\n\nimport { CreateLocale } from '../components/CreateLocale';\nimport { LocaleTable } from '../components/LocaleTable';\nimport { PERMISSIONS } from '../constants';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nconst SettingsPage = () => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { data: locales, isLoading: isLoadingLocales, error } = useGetLocalesQuery();\n const {\n isLoading: isLoadingRBAC,\n allowedActions: { canUpdate, canCreate, canDelete },\n } = useRBAC(PERMISSIONS);\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const isLoading = isLoadingLocales || isLoadingRBAC;\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !Array.isArray(locales)) {\n return <Page.Error />;\n }\n\n return (\n <Page.Main tabIndex={-1}>\n <Layouts.Header\n primaryAction={<CreateLocale disabled={!canCreate} />}\n title={formatMessage({\n id: getTranslation('plugin.name'),\n defaultMessage: 'Internationalization',\n })}\n subtitle={formatMessage({\n id: getTranslation('Settings.list.description'),\n defaultMessage: 'Configure the settings',\n })}\n />\n <Layouts.Content>\n {locales.length > 0 ? (\n <LocaleTable locales={locales} canDelete={canDelete} canUpdate={canUpdate} />\n ) : (\n <EmptyStateLayout\n icon={<EmptyDocuments width={undefined} height={undefined} />}\n content={formatMessage({\n id: getTranslation('Settings.list.empty.title'),\n defaultMessage: 'There are no locales',\n })}\n action={<CreateLocale disabled={!canCreate} variant=\"secondary\" />}\n />\n )}\n </Layouts.Content>\n </Page.Main>\n );\n};\n\nconst ProtectedSettingsPage = () => {\n return (\n <Page.Protect permissions={PERMISSIONS.read}>\n <SettingsPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedSettingsPage, SettingsPage };\n"],"names":["useIntl","React","Modal","jsx","Button","Plus","getTranslation","yup","useId","useNotification","useAPIErrorHandler","useCreateLocaleMutation","useAuth","jsxs","Form","Tabs","Flex","Typography","Divider","Box","useForm","Check","useGetDefaultLocalesQuery","Grid","InputRenderer","useField","value","locale","Field","SingleSelect","SingleSelectOption","useDeleteLocaleMutation","Dialog","IconButton","Trash","ConfirmDialog","Fragment","Pencil","useUpdateLocaleMutation","Table","Thead","Tr","Th","VisuallyHidden","Tbody","Td","useGetLocalesQuery","useRBAC","PERMISSIONS","Page","Layouts","EmptyStateLayout","EmptyDocuments"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,mBAAmB,CAAC,UAA+D;AACvF,SAAO,MAAM,SAAS;AACxB;ACoCA,MAAM,eAAe,CAAC,EAAE,UAAU,UAAU,gBAAmC;AACvE,QAAA,EAAE,kBAAkBA,UAAAA;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.delete.label": "Delete locale",
|
4
|
+
"actions.delete.label": "Delete entry ({locale})",
|
5
5
|
"actions.delete.dialog.title": "Confirmation",
|
6
6
|
"actions.delete.dialog.body": "Are you sure you want to delete this locale?",
|
7
7
|
"actions.delete.error": "An error occurred while trying to delete the document locale.",
|
@@ -14,12 +14,13 @@ const en = {
|
|
14
14
|
"CMEditViewCopyLocale.dialog.body": "Your current content will be erased and filled by the content of the selected locale:",
|
15
15
|
"CMEditViewCopyLocale.dialog.field.label": "Locale",
|
16
16
|
"CMEditViewCopyLocale.dialog.field.placeholder": "Select one locale...",
|
17
|
-
"CMEditViewBulkLocale.publish-title": "Publish
|
18
|
-
"CMEditViewBulkLocale.unpublish-title": "Unpublish
|
17
|
+
"CMEditViewBulkLocale.publish-title": "Publish multiple locales",
|
18
|
+
"CMEditViewBulkLocale.unpublish-title": "Unpublish multiple locales",
|
19
19
|
"CMEditViewBulkLocale.status": "Status",
|
20
20
|
"CMEditViewBulkLocale.publication-status": "Publication Status",
|
21
21
|
"CMEditViewBulkLocale.draft-relation-warning": "Some locales are related to draft entries. Publishing them could leave broken links in your app.",
|
22
22
|
"CMEditViewBulkLocale.continue-confirmation": "Are you sure you want to continue?",
|
23
|
+
"CMEditViewLocalePicker.locale.create": "Create <bold>{locale}</bold> locale",
|
23
24
|
"CMListView.popover.display-locales.label": "Display translated locales",
|
24
25
|
"CheckboxConfirmation.Modal.body": "Do you want to disable it?",
|
25
26
|
"CheckboxConfirmation.Modal.button-confirm": "Yes, disable",
|
@@ -77,4 +78,4 @@ const en = {
|
|
77
78
|
"plugin.schema.i18n.localized.label-field": "Enable localization for this field"
|
78
79
|
};
|
79
80
|
exports.default = en;
|
80
|
-
//# sourceMappingURL=en-
|
81
|
+
//# sourceMappingURL=en-BKBz3tro.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"en-BKBz3tro.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
const en = {
|
2
|
-
"actions.delete.label": "Delete locale",
|
2
|
+
"actions.delete.label": "Delete entry ({locale})",
|
3
3
|
"actions.delete.dialog.title": "Confirmation",
|
4
4
|
"actions.delete.dialog.body": "Are you sure you want to delete this locale?",
|
5
5
|
"actions.delete.error": "An error occurred while trying to delete the document locale.",
|
@@ -12,12 +12,13 @@ const en = {
|
|
12
12
|
"CMEditViewCopyLocale.dialog.body": "Your current content will be erased and filled by the content of the selected locale:",
|
13
13
|
"CMEditViewCopyLocale.dialog.field.label": "Locale",
|
14
14
|
"CMEditViewCopyLocale.dialog.field.placeholder": "Select one locale...",
|
15
|
-
"CMEditViewBulkLocale.publish-title": "Publish
|
16
|
-
"CMEditViewBulkLocale.unpublish-title": "Unpublish
|
15
|
+
"CMEditViewBulkLocale.publish-title": "Publish multiple locales",
|
16
|
+
"CMEditViewBulkLocale.unpublish-title": "Unpublish multiple locales",
|
17
17
|
"CMEditViewBulkLocale.status": "Status",
|
18
18
|
"CMEditViewBulkLocale.publication-status": "Publication Status",
|
19
19
|
"CMEditViewBulkLocale.draft-relation-warning": "Some locales are related to draft entries. Publishing them could leave broken links in your app.",
|
20
20
|
"CMEditViewBulkLocale.continue-confirmation": "Are you sure you want to continue?",
|
21
|
+
"CMEditViewLocalePicker.locale.create": "Create <bold>{locale}</bold> locale",
|
21
22
|
"CMListView.popover.display-locales.label": "Display translated locales",
|
22
23
|
"CheckboxConfirmation.Modal.body": "Do you want to disable it?",
|
23
24
|
"CheckboxConfirmation.Modal.button-confirm": "Yes, disable",
|
@@ -77,4 +78,4 @@ const en = {
|
|
77
78
|
export {
|
78
79
|
en as default
|
79
80
|
};
|
80
|
-
//# sourceMappingURL=en-
|
81
|
+
//# sourceMappingURL=en-DlXfy6Gy.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"en-DlXfy6Gy.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -252,7 +252,8 @@ const cleanData = (data, schema, components) => {
|
|
252
252
|
"publishedAt",
|
253
253
|
"strapi_stage",
|
254
254
|
"strapi_assignee",
|
255
|
-
"locale"
|
255
|
+
"locale",
|
256
|
+
"status"
|
256
257
|
]);
|
257
258
|
const cleanedDataWithoutPasswordAndRelation = recursiveRemoveFieldTypes(
|
258
259
|
cleanedData,
|
@@ -514,6 +515,48 @@ const BulkLocaleActionModal = ({
|
|
514
515
|
] }) })
|
515
516
|
] });
|
516
517
|
};
|
518
|
+
const statusVariants = {
|
519
|
+
draft: "secondary",
|
520
|
+
published: "success",
|
521
|
+
modified: "alternative"
|
522
|
+
};
|
523
|
+
const LocaleOption = ({
|
524
|
+
isDraftAndPublishEnabled,
|
525
|
+
locale,
|
526
|
+
status,
|
527
|
+
entryExists
|
528
|
+
}) => {
|
529
|
+
const { formatMessage } = reactIntl.useIntl();
|
530
|
+
if (!entryExists) {
|
531
|
+
return formatMessage(
|
532
|
+
{
|
533
|
+
id: getTranslation("CMEditViewLocalePicker.locale.create"),
|
534
|
+
defaultMessage: "Create <bold>{locale}</bold> locale"
|
535
|
+
},
|
536
|
+
{
|
537
|
+
bold: (locale2) => /* @__PURE__ */ jsxRuntime.jsx("b", { children: locale2 }),
|
538
|
+
locale: locale.name
|
539
|
+
}
|
540
|
+
);
|
541
|
+
}
|
542
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", gap: 1, justifyContent: "space-between", children: [
|
543
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: locale.name }),
|
544
|
+
isDraftAndPublishEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
545
|
+
designSystem.Status,
|
546
|
+
{
|
547
|
+
display: "flex",
|
548
|
+
paddingLeft: "6px",
|
549
|
+
paddingRight: "6px",
|
550
|
+
paddingTop: "2px",
|
551
|
+
paddingBottom: "2px",
|
552
|
+
showBullet: false,
|
553
|
+
size: "S",
|
554
|
+
variant: statusVariants[status],
|
555
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
556
|
+
}
|
557
|
+
) : null
|
558
|
+
] });
|
559
|
+
};
|
517
560
|
const LocalePickerAction = ({
|
518
561
|
document,
|
519
562
|
meta,
|
@@ -555,9 +598,9 @@ const LocalePickerAction = ({
|
|
555
598
|
handleSelect(defaultLocale.code);
|
556
599
|
}
|
557
600
|
}, [handleSelect, hasI18n, locales, currentDesiredLocale]);
|
558
|
-
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale)
|
601
|
+
const currentLocale = Array.isArray(locales) ? locales.find((locale) => locale.code === currentDesiredLocale) : void 0;
|
559
602
|
const allCurrentLocales = [
|
560
|
-
{ status: getDocumentStatus(document, meta), locale: currentLocale },
|
603
|
+
{ status: getDocumentStatus(document, meta), locale: currentLocale?.code },
|
561
604
|
...meta?.availableLocales ?? []
|
562
605
|
];
|
563
606
|
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
@@ -569,32 +612,27 @@ const LocalePickerAction = ({
|
|
569
612
|
defaultMessage: "Locales"
|
570
613
|
}),
|
571
614
|
options: locales.map((locale) => {
|
615
|
+
const entryWithLocaleExists = allCurrentLocales.some((doc) => doc.locale === locale.code);
|
572
616
|
const currentLocaleDoc = allCurrentLocales.find(
|
573
617
|
(doc) => "locale" in doc ? doc.locale === locale.code : false
|
574
618
|
);
|
575
|
-
const
|
576
|
-
const permissionsToCheck = currentLocaleDoc ? canCreate : canRead;
|
577
|
-
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
619
|
+
const permissionsToCheck = currentLocaleDoc ? canRead : canCreate;
|
578
620
|
return {
|
579
621
|
disabled: !permissionsToCheck.includes(locale.code),
|
580
622
|
value: locale.code,
|
581
|
-
label:
|
582
|
-
|
583
|
-
designSystem.Status,
|
623
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
624
|
+
LocaleOption,
|
584
625
|
{
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
paddingBottom: "2px",
|
590
|
-
showBullet: false,
|
591
|
-
size: "S",
|
592
|
-
variant: statusVariant,
|
593
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "pi", fontWeight: "bold", children: capitalize(status) })
|
626
|
+
isDraftAndPublishEnabled: !!schema?.options?.draftAndPublish,
|
627
|
+
locale,
|
628
|
+
status: currentLocaleDoc?.status,
|
629
|
+
entryExists: entryWithLocaleExists
|
594
630
|
}
|
595
|
-
)
|
631
|
+
),
|
632
|
+
startIcon: !entryWithLocaleExists ? /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}) : null
|
596
633
|
};
|
597
634
|
}),
|
635
|
+
customizeContent: () => currentLocale?.name,
|
598
636
|
onSelect: handleSelect,
|
599
637
|
value: currentLocale
|
600
638
|
};
|
@@ -618,6 +656,7 @@ const FillFromAnotherLocaleAction = ({
|
|
618
656
|
}) => {
|
619
657
|
const { formatMessage } = reactIntl.useIntl();
|
620
658
|
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
659
|
+
const { hasI18n } = useI18n();
|
621
660
|
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
622
661
|
const [localeSelected, setLocaleSelected] = React__namespace.useState(null);
|
623
662
|
const setValues = strapiAdmin.useForm("FillFromAnotherLocale", (state) => state.setValues);
|
@@ -645,6 +684,9 @@ const FillFromAnotherLocaleAction = ({
|
|
645
684
|
setValues(cleanedData);
|
646
685
|
onClose();
|
647
686
|
};
|
687
|
+
if (!hasI18n) {
|
688
|
+
return null;
|
689
|
+
}
|
648
690
|
return {
|
649
691
|
type: "icon",
|
650
692
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
@@ -710,16 +752,23 @@ const DeleteLocaleAction = ({
|
|
710
752
|
const { toggleNotification } = strapiAdmin.useNotification();
|
711
753
|
const { delete: deleteAction } = strapiAdmin$1.unstable_useDocumentActions();
|
712
754
|
const { hasI18n, canDelete } = useI18n();
|
755
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
756
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
757
|
+
const currentDesiredLocale = query2.plugins?.i18n?.locale;
|
758
|
+
const locale = !("error" in locales) && locales.find((loc) => loc.code === currentDesiredLocale);
|
713
759
|
if (!hasI18n) {
|
714
760
|
return null;
|
715
761
|
}
|
716
762
|
return {
|
717
763
|
disabled: document?.locale && !canDelete.includes(document.locale) || !document || !document.id,
|
718
764
|
position: ["header", "table-row"],
|
719
|
-
label: formatMessage(
|
720
|
-
|
721
|
-
|
722
|
-
|
765
|
+
label: formatMessage(
|
766
|
+
{
|
767
|
+
id: getTranslation("actions.delete.label"),
|
768
|
+
defaultMessage: "Delete entry ({locale})"
|
769
|
+
},
|
770
|
+
{ locale: locale && locale.name }
|
771
|
+
),
|
723
772
|
icon: /* @__PURE__ */ jsxRuntime.jsx(StyledTrash, {}),
|
724
773
|
variant: "danger",
|
725
774
|
dialog: {
|
@@ -736,7 +785,12 @@ const DeleteLocaleAction = ({
|
|
736
785
|
}) })
|
737
786
|
] }),
|
738
787
|
onConfirm: async () => {
|
739
|
-
|
788
|
+
const unableToDelete = (
|
789
|
+
// We are unable to delete a collection type without a document ID
|
790
|
+
// & unable to delete generally if there is no document locale
|
791
|
+
collectionType !== "single-types" && !documentId || !document?.locale
|
792
|
+
);
|
793
|
+
if (unableToDelete) {
|
740
794
|
console.error(
|
741
795
|
"You're trying to delete a document without an id or locale, this is likely a bug with Strapi. Please open an issue."
|
742
796
|
);
|
@@ -1369,9 +1423,6 @@ const localeMiddleware = (ctx) => (next) => (permissions) => {
|
|
1369
1423
|
return next(revisedPermissions);
|
1370
1424
|
};
|
1371
1425
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
1372
|
-
if (!pluginId2) {
|
1373
|
-
throw new TypeError("pluginId can't be empty");
|
1374
|
-
}
|
1375
1426
|
return Object.keys(trad).reduce((acc, current) => {
|
1376
1427
|
acc[`${pluginId2}.${current}`] = trad[current];
|
1377
1428
|
return acc;
|
@@ -1441,7 +1492,7 @@ const index = {
|
|
1441
1492
|
},
|
1442
1493
|
id: "internationalization",
|
1443
1494
|
to: "internationalization",
|
1444
|
-
Component: () => Promise.resolve().then(() => require("./SettingsPage-
|
1495
|
+
Component: () => Promise.resolve().then(() => require("./SettingsPage-Bcj7380u.js")).then((mod) => ({ default: mod.ProtectedSettingsPage })),
|
1445
1496
|
permissions: PERMISSIONS.accessMain
|
1446
1497
|
});
|
1447
1498
|
const contentManager = app.getPlugin("content-manager");
|
@@ -1559,7 +1610,7 @@ const index = {
|
|
1559
1610
|
async registerTrads({ locales }) {
|
1560
1611
|
const importedTrads = await Promise.all(
|
1561
1612
|
locales.map((locale) => {
|
1562
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
1613
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-DtWiGdHl.js")), "./translations/dk.json": () => Promise.resolve().then(() => require("./dk-D8C-casx.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BKBz3tro.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-DS-XFGSw.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BTjekDpq.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-DmcGUBQ3.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-Cn5RYonZ.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BMBgVL3s.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-CarUU76c.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-DSHIXAa3.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CukOviB0.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
1563
1614
|
return {
|
1564
1615
|
data: prefixPluginTranslations(data, pluginId),
|
1565
1616
|
locale
|
@@ -1583,4 +1634,4 @@ exports.useDeleteLocaleMutation = useDeleteLocaleMutation;
|
|
1583
1634
|
exports.useGetDefaultLocalesQuery = useGetDefaultLocalesQuery;
|
1584
1635
|
exports.useGetLocalesQuery = useGetLocalesQuery;
|
1585
1636
|
exports.useUpdateLocaleMutation = useUpdateLocaleMutation;
|
1586
|
-
//# sourceMappingURL=index-
|
1637
|
+
//# sourceMappingURL=index-BKZbxhpm.js.map
|