@strapi/i18n 0.0.0-next.8f0cdd4f9e4697ffed86c783465297fe532713f8 → 0.0.0-next.913e7071c9410ff8af2e776e25f9fb1c38cb59dd
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 +116 -1
- package/dist/admin/components/CMHeaderActions.js.map +1 -1
- package/dist/admin/components/CMHeaderActions.mjs +119 -5
- package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
- package/dist/admin/components/CreateLocale.js +1 -1
- package/dist/admin/components/CreateLocale.js.map +1 -1
- package/dist/admin/components/CreateLocale.mjs +1 -1
- package/dist/admin/components/CreateLocale.mjs.map +1 -1
- package/dist/admin/components/EditLocale.js +1 -1
- package/dist/admin/components/EditLocale.js.map +1 -1
- package/dist/admin/components/EditLocale.mjs +1 -1
- package/dist/admin/components/EditLocale.mjs.map +1 -1
- package/dist/admin/components/LocaleListCell.js +65 -45
- package/dist/admin/components/LocaleListCell.js.map +1 -1
- package/dist/admin/components/LocaleListCell.mjs +66 -46
- package/dist/admin/components/LocaleListCell.mjs.map +1 -1
- package/dist/admin/components/LocalePicker.js +18 -11
- package/dist/admin/components/LocalePicker.js.map +1 -1
- package/dist/admin/components/LocalePicker.mjs +19 -12
- package/dist/admin/components/LocalePicker.mjs.map +1 -1
- package/dist/admin/contentManagerHooks/editView.js +6 -3
- package/dist/admin/contentManagerHooks/editView.js.map +1 -1
- package/dist/admin/contentManagerHooks/editView.mjs +7 -4
- package/dist/admin/contentManagerHooks/editView.mjs.map +1 -1
- package/dist/admin/contentManagerHooks/listView.js +2 -1
- package/dist/admin/contentManagerHooks/listView.js.map +1 -1
- package/dist/admin/contentManagerHooks/listView.mjs +2 -1
- package/dist/admin/contentManagerHooks/listView.mjs.map +1 -1
- package/dist/admin/index.js +1 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/pages/SettingsPage.js +121 -46
- package/dist/admin/pages/SettingsPage.js.map +1 -1
- package/dist/admin/pages/SettingsPage.mjs +124 -30
- package/dist/admin/pages/SettingsPage.mjs.map +1 -1
- package/dist/admin/services/api.js +3 -1
- package/dist/admin/services/api.js.map +1 -1
- package/dist/admin/services/api.mjs +3 -1
- package/dist/admin/services/api.mjs.map +1 -1
- package/dist/admin/services/locales.js +4 -2
- package/dist/admin/services/locales.js.map +1 -1
- package/dist/admin/services/locales.mjs +4 -2
- package/dist/admin/services/locales.mjs.map +1 -1
- package/dist/admin/services/settings.js +29 -0
- package/dist/admin/services/settings.js.map +1 -0
- package/dist/admin/services/settings.mjs +26 -0
- package/dist/admin/services/settings.mjs.map +1 -0
- package/dist/admin/src/components/CMHeaderActions.d.ts +7 -1
- package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
- 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 +5 -0
- package/dist/admin/translations/en.json.js +7 -0
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +7 -0
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/utils/clean.js +2 -2
- package/dist/admin/utils/clean.js.map +1 -1
- package/dist/admin/utils/clean.mjs +2 -2
- package/dist/admin/utils/clean.mjs.map +1 -1
- package/dist/server/constants/iso-locales.json.js +4 -0
- package/dist/server/constants/iso-locales.json.js.map +1 -1
- package/dist/server/constants/iso-locales.json.mjs +4 -0
- package/dist/server/constants/iso-locales.json.mjs.map +1 -1
- 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/controllers/settings.js +24 -0
- package/dist/server/controllers/settings.js.map +1 -0
- package/dist/server/controllers/settings.mjs +22 -0
- package/dist/server/controllers/settings.mjs.map +1 -0
- 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/routes/content-api.js +11 -13
- package/dist/server/routes/content-api.js.map +1 -1
- package/dist/server/routes/content-api.mjs +11 -13
- package/dist/server/routes/content-api.mjs.map +1 -1
- package/dist/server/routes/index.mjs +2 -2
- package/dist/server/services/ai-localizations.js +143 -0
- package/dist/server/services/ai-localizations.js.map +1 -0
- package/dist/server/services/ai-localizations.mjs +141 -0
- package/dist/server/services/ai-localizations.mjs.map +1 -0
- package/dist/server/services/index.js +5 -1
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +5 -1
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/services/settings.js +25 -0
- package/dist/server/services/settings.js.map +1 -0
- package/dist/server/services/settings.mjs +23 -0
- package/dist/server/services/settings.mjs.map +1 -0
- package/dist/server/src/controllers/index.d.ts +4 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/settings.d.ts +7 -0
- package/dist/server/src/controllers/settings.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +27 -1
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/admin.d.ts.map +1 -1
- package/dist/server/src/routes/content-api.d.ts +5 -2
- package/dist/server/src/routes/content-api.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +4 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/ai-localizations.d.ts +17 -0
- package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +19 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts +13 -0
- package/dist/server/src/services/settings.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +5 -1
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/src/validation/settings.d.ts +12 -0
- package/dist/server/src/validation/settings.d.ts.map +1 -0
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/dist/server/validation/settings.js +11 -0
- package/dist/server/validation/settings.js.map +1 -0
- package/dist/server/validation/settings.mjs +9 -0
- package/dist/server/validation/settings.mjs.map +1 -0
- package/dist/shared/contracts/settings.d.ts +40 -0
- package/package.json +9 -8
|
@@ -1,55 +1,65 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
|
|
4
|
+
require('react');
|
|
5
5
|
var strapiAdmin = require('@strapi/admin/strapi-admin');
|
|
6
|
+
var ee = require('@strapi/admin/strapi-admin/ee');
|
|
6
7
|
var designSystem = require('@strapi/design-system');
|
|
8
|
+
var icons = require('@strapi/icons');
|
|
7
9
|
var symbols = require('@strapi/icons/symbols');
|
|
8
10
|
var reactIntl = require('react-intl');
|
|
9
11
|
var CreateLocale = require('../components/CreateLocale.js');
|
|
10
12
|
var LocaleTable = require('../components/LocaleTable.js');
|
|
11
13
|
var constants = require('../constants.js');
|
|
12
14
|
var locales = require('../services/locales.js');
|
|
15
|
+
var settings = require('../services/settings.js');
|
|
13
16
|
var getTranslation = require('../utils/getTranslation.js');
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const SettingsErrrorTooltip = ({ children, error })=>{
|
|
19
|
+
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
20
|
+
if (error) {
|
|
21
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
|
|
22
|
+
label: formatAPIError(error),
|
|
23
|
+
style: {
|
|
24
|
+
maxWidth: '200px'
|
|
25
|
+
},
|
|
26
|
+
children: children
|
|
24
27
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
n.default = e;
|
|
29
|
-
return Object.freeze(n);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
33
|
-
|
|
28
|
+
}
|
|
29
|
+
return children;
|
|
30
|
+
};
|
|
34
31
|
const SettingsPage = ()=>{
|
|
35
32
|
const { formatMessage } = reactIntl.useIntl();
|
|
36
33
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
37
|
-
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
38
34
|
const { data: locales$1, isLoading: isLoadingLocales, error } = locales.useGetLocalesQuery();
|
|
39
35
|
const { isLoading: isLoadingRBAC, allowedActions: { canUpdate, canCreate, canDelete } } = strapiAdmin.useRBAC(constants.PERMISSIONS);
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const isAIAvailable = ee.useAIAvailability();
|
|
37
|
+
// Settings state management
|
|
38
|
+
const { data: settings$1, isLoading: isLoadingSettings, error: settingsError } = settings.useGetSettingsQuery();
|
|
39
|
+
const [updateSettings] = settings.useUpdatei18nSettingsMutation();
|
|
40
|
+
const handleToggleChange = async (checked)=>{
|
|
41
|
+
try {
|
|
42
|
+
await updateSettings({
|
|
43
|
+
aiLocalizations: checked
|
|
44
|
+
}).unwrap();
|
|
45
|
+
toggleNotification({
|
|
46
|
+
type: 'success',
|
|
47
|
+
message: formatMessage({
|
|
48
|
+
id: 'notification.form.success.fields'
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
} catch (err) {
|
|
52
|
+
console.error(err);
|
|
42
53
|
toggleNotification({
|
|
43
54
|
type: 'danger',
|
|
44
|
-
message:
|
|
55
|
+
message: formatMessage({
|
|
56
|
+
id: 'notification.error',
|
|
57
|
+
defaultMessage: 'An error occurred'
|
|
58
|
+
})
|
|
45
59
|
});
|
|
46
60
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
formatAPIError,
|
|
50
|
-
toggleNotification
|
|
51
|
-
]);
|
|
52
|
-
const isLoading = isLoadingLocales || isLoadingRBAC;
|
|
61
|
+
};
|
|
62
|
+
const isLoading = isLoadingLocales || isLoadingRBAC || isLoadingSettings;
|
|
53
63
|
if (isLoading) {
|
|
54
64
|
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
|
55
65
|
}
|
|
@@ -72,25 +82,90 @@ const SettingsPage = ()=>{
|
|
|
72
82
|
defaultMessage: 'Configure the settings'
|
|
73
83
|
})
|
|
74
84
|
}),
|
|
75
|
-
/*#__PURE__*/ jsxRuntime.
|
|
76
|
-
children:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
/*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Layouts.Content, {
|
|
86
|
+
children: [
|
|
87
|
+
isAIAvailable && window.strapi.future.isEnabled('unstableAILocalizations') && /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
88
|
+
background: "neutral0",
|
|
89
|
+
padding: 6,
|
|
90
|
+
marginBottom: 6,
|
|
91
|
+
shadow: "filterShadow",
|
|
92
|
+
hasRadius: true,
|
|
93
|
+
children: [
|
|
94
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
95
|
+
direction: "column",
|
|
96
|
+
alignItems: "stretch",
|
|
97
|
+
gap: 1,
|
|
98
|
+
flex: 1,
|
|
99
|
+
children: [
|
|
100
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
101
|
+
gap: 1,
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
104
|
+
color: "alternative700",
|
|
105
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(icons.Sparkle, {})
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
108
|
+
variant: "delta",
|
|
109
|
+
tag: "h2",
|
|
110
|
+
children: formatMessage({
|
|
111
|
+
id: getTranslation.getTranslation('Settings.aiLocalizations.label'),
|
|
112
|
+
defaultMessage: 'AI Translations'
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
}),
|
|
117
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
118
|
+
variant: "pi",
|
|
119
|
+
textColor: "neutral600",
|
|
120
|
+
fontSize: "14px",
|
|
121
|
+
children: formatMessage({
|
|
122
|
+
id: getTranslation.getTranslation('Settings.aiLocalizations.description'),
|
|
123
|
+
defaultMessage: 'Everytime you save in the Content Manager, our AI will use your default locale to translate all other locales automatically.'
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
}),
|
|
128
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Root, {
|
|
129
|
+
name: "aiLocalizations",
|
|
130
|
+
minWidth: "200px",
|
|
131
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(SettingsErrrorTooltip, {
|
|
132
|
+
error: settingsError,
|
|
133
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Toggle, {
|
|
134
|
+
disabled: Boolean(settingsError),
|
|
135
|
+
checked: settings$1?.data?.aiLocalizations ?? false,
|
|
136
|
+
offLabel: formatMessage({
|
|
137
|
+
id: 'app.components.ToggleCheckbox.disabled-label',
|
|
138
|
+
defaultMessage: 'Disabled'
|
|
139
|
+
}),
|
|
140
|
+
onLabel: formatMessage({
|
|
141
|
+
id: 'app.components.ToggleCheckbox.enabled-label',
|
|
142
|
+
defaultMessage: 'Enabled'
|
|
143
|
+
}),
|
|
144
|
+
onChange: (e)=>handleToggleChange(e.target.checked)
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
]
|
|
88
149
|
}),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
150
|
+
locales$1.length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(LocaleTable.LocaleTable, {
|
|
151
|
+
locales: locales$1,
|
|
152
|
+
canDelete: canDelete,
|
|
153
|
+
canUpdate: canUpdate
|
|
154
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
|
|
155
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(symbols.EmptyDocuments, {
|
|
156
|
+
width: undefined,
|
|
157
|
+
height: undefined
|
|
158
|
+
}),
|
|
159
|
+
content: formatMessage({
|
|
160
|
+
id: getTranslation.getTranslation('Settings.list.empty.title'),
|
|
161
|
+
defaultMessage: 'There are no locales'
|
|
162
|
+
}),
|
|
163
|
+
action: /*#__PURE__*/ jsxRuntime.jsx(CreateLocale.CreateLocale, {
|
|
164
|
+
disabled: !canCreate,
|
|
165
|
+
variant: "secondary"
|
|
166
|
+
})
|
|
92
167
|
})
|
|
93
|
-
|
|
168
|
+
]
|
|
94
169
|
})
|
|
95
170
|
]
|
|
96
171
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.js","sources":["../../../admin/src/pages/SettingsPage.tsx"],"sourcesContent":["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":["SettingsPage","formatMessage","useIntl","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","data","locales","isLoading","isLoadingLocales","error","useGetLocalesQuery","isLoadingRBAC","allowedActions","canUpdate","canCreate","canDelete","useRBAC","PERMISSIONS","React","useEffect","type","message","_jsx","Page","Loading","Array","isArray","Error","_jsxs","Main","tabIndex","Layouts","Header","primaryAction","CreateLocale","disabled","title","id","getTranslation","defaultMessage","subtitle","Content","length","LocaleTable","EmptyStateLayout","icon","EmptyDocuments","width","undefined","height","content","action","variant","ProtectedSettingsPage","Protect","permissions","read"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAMA,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAC1B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,2BAAAA,EAAAA;AAC/B,IAAA,MAAM,EAAEC,uBAAAA,EAAyBC,cAAc,EAAE,GAAGC,8BAAAA,EAAAA;IACpD,MAAM,EAAEC,MAAMC,SAAO,EAAEC,WAAWC,gBAAgB,EAAEC,KAAK,EAAE,GAAGC,0BAAAA,EAAAA;AAC9D,IAAA,MAAM,EACJH,SAAAA,EAAWI,aAAa,EACxBC,gBAAgB,EAAEC,SAAS,EAAEC,SAAS,EAAEC,SAAS,EAAE,EACpD,GAAGC,mBAAQC,CAAAA,qBAAAA,CAAAA;AAEZC,IAAAA,gBAAAA,CAAMC,SAAS,CAAC,IAAA;AACd,QAAA,IAAIV,KAAO,EAAA;YACTT,kBAAmB,CAAA;gBACjBoB,IAAM,EAAA,QAAA;AACNC,gBAAAA,OAAAA,EAASlB,cAAeM,CAAAA,KAAAA;AAC1B,aAAA,CAAA;AACF;KACC,EAAA;AAACA,QAAAA,KAAAA;AAAON,QAAAA,cAAAA;AAAgBH,QAAAA;AAAmB,KAAA,CAAA;AAE9C,IAAA,MAAMO,YAAYC,gBAAoBG,IAAAA,aAAAA;AAEtC,IAAA,IAAIJ,SAAW,EAAA;QACb,qBAAOe,cAAA,CAACC,iBAAKC,OAAO,EAAA,EAAA,CAAA;AACtB;AAEA,IAAA,IAAIf,KAAS,IAAA,CAACgB,KAAMC,CAAAA,OAAO,CAACpB,SAAU,CAAA,EAAA;QACpC,qBAAOgB,cAAA,CAACC,iBAAKI,KAAK,EAAA,EAAA,CAAA;AACpB;IAEA,qBACEC,eAAA,CAACL,iBAAKM,IAAI,EAAA;AAACC,QAAAA,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,QAAA,gBAAAlC,cAACzB,CAAAA,YAAAA,EAAAA,EAAAA;;AAGP;;;;;"}
|
|
1
|
+
{"version":3,"file":"SettingsPage.js","sources":["../../../admin/src/pages/SettingsPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { SerializedError } from '@reduxjs/toolkit';\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useRBAC,\n Layouts,\n BaseQueryError,\n} from '@strapi/admin/strapi-admin';\nimport { useAIAvailability } from '@strapi/admin/strapi-admin/ee';\nimport {\n Box,\n EmptyStateLayout,\n Field,\n Flex,\n Tooltip,\n Toggle,\n Typography,\n} from '@strapi/design-system';\nimport { Sparkle } from '@strapi/icons';\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 { useGetSettingsQuery, useUpdatei18nSettingsMutation } from '../services/settings';\nimport { getTranslation } from '../utils/getTranslation';\n\nconst SettingsErrrorTooltip = ({\n children,\n error,\n}: {\n children: React.ReactNode;\n error: BaseQueryError | SerializedError | undefined;\n}) => {\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n if (error) {\n return (\n <Tooltip label={formatAPIError(error)} style={{ maxWidth: '200px' }}>\n {children}\n </Tooltip>\n );\n }\n\n return children;\n};\n\nconst SettingsPage = () => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { data: locales, isLoading: isLoadingLocales, error } = useGetLocalesQuery();\n const {\n isLoading: isLoadingRBAC,\n allowedActions: { canUpdate, canCreate, canDelete },\n } = useRBAC(PERMISSIONS);\n const isAIAvailable = useAIAvailability();\n\n // Settings state management\n const {\n data: settings,\n isLoading: isLoadingSettings,\n error: settingsError,\n } = useGetSettingsQuery();\n const [updateSettings] = useUpdatei18nSettingsMutation();\n\n const handleToggleChange = async (checked: boolean) => {\n try {\n await updateSettings({ aiLocalizations: checked }).unwrap();\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.form.success.fields' }),\n });\n } catch (err) {\n console.error(err);\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred',\n }),\n });\n }\n };\n\n const isLoading = isLoadingLocales || isLoadingRBAC || isLoadingSettings;\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 {isAIAvailable && window.strapi.future.isEnabled('unstableAILocalizations') && (\n <Flex background=\"neutral0\" padding={6} marginBottom={6} shadow=\"filterShadow\" hasRadius>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1} flex={1}>\n <Flex gap={1}>\n <Box color=\"alternative700\">\n <Sparkle />\n </Box>\n <Typography variant=\"delta\" tag=\"h2\">\n {formatMessage({\n id: getTranslation('Settings.aiLocalizations.label'),\n defaultMessage: 'AI Translations',\n })}\n </Typography>\n </Flex>\n <Typography variant=\"pi\" textColor=\"neutral600\" fontSize=\"14px\">\n {formatMessage({\n id: getTranslation('Settings.aiLocalizations.description'),\n defaultMessage:\n 'Everytime you save in the Content Manager, our AI will use your default locale to translate all other locales automatically.',\n })}\n </Typography>\n </Flex>\n <Field.Root name=\"aiLocalizations\" minWidth=\"200px\">\n <SettingsErrrorTooltip error={settingsError}>\n <Toggle\n disabled={Boolean(settingsError)}\n checked={settings?.data?.aiLocalizations ?? false}\n offLabel={formatMessage({\n id: 'app.components.ToggleCheckbox.disabled-label',\n defaultMessage: 'Disabled',\n })}\n onLabel={formatMessage({\n id: 'app.components.ToggleCheckbox.enabled-label',\n defaultMessage: 'Enabled',\n })}\n onChange={(e) => handleToggleChange(e.target.checked)}\n />\n </SettingsErrrorTooltip>\n </Field.Root>\n </Flex>\n )}\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":["SettingsErrrorTooltip","children","error","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","_jsx","Tooltip","label","style","maxWidth","SettingsPage","formatMessage","useIntl","toggleNotification","useNotification","data","locales","isLoading","isLoadingLocales","useGetLocalesQuery","isLoadingRBAC","allowedActions","canUpdate","canCreate","canDelete","useRBAC","PERMISSIONS","isAIAvailable","useAIAvailability","settings","isLoadingSettings","settingsError","useGetSettingsQuery","updateSettings","useUpdatei18nSettingsMutation","handleToggleChange","checked","aiLocalizations","unwrap","type","message","id","err","console","defaultMessage","Page","Loading","Array","isArray","Error","_jsxs","Main","tabIndex","Layouts","Header","primaryAction","CreateLocale","disabled","title","getTranslation","subtitle","Content","window","strapi","future","isEnabled","Flex","background","padding","marginBottom","shadow","hasRadius","direction","alignItems","gap","flex","Box","color","Sparkle","Typography","variant","tag","textColor","fontSize","Field","Root","name","minWidth","Toggle","Boolean","offLabel","onLabel","onChange","e","target","length","LocaleTable","EmptyStateLayout","icon","EmptyDocuments","width","undefined","height","content","action","ProtectedSettingsPage","Protect","permissions","read"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAMA,wBAAwB,CAAC,E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ACC,QAAAA,WAAAA,EAAajF,sBAAYkF,IAAI;AACzC,QAAA,QAAA,gBAAAvG,cAACK,CAAAA,YAAAA,EAAAA,EAAAA;;AAGP;;;;;"}
|
|
@@ -1,34 +1,63 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import { useNotification,
|
|
4
|
-
import {
|
|
2
|
+
import 'react';
|
|
3
|
+
import { useNotification, useRBAC, Page, Layouts, useAPIErrorHandler } from '@strapi/admin/strapi-admin';
|
|
4
|
+
import { useAIAvailability } from '@strapi/admin/strapi-admin/ee';
|
|
5
|
+
import { Flex, Box, Typography, Field, Toggle, EmptyStateLayout, Tooltip } from '@strapi/design-system';
|
|
6
|
+
import { Sparkle } from '@strapi/icons';
|
|
5
7
|
import { EmptyDocuments } from '@strapi/icons/symbols';
|
|
6
8
|
import { useIntl } from 'react-intl';
|
|
7
9
|
import { CreateLocale } from '../components/CreateLocale.mjs';
|
|
8
10
|
import { LocaleTable } from '../components/LocaleTable.mjs';
|
|
9
11
|
import { PERMISSIONS } from '../constants.mjs';
|
|
10
12
|
import { useGetLocalesQuery } from '../services/locales.mjs';
|
|
13
|
+
import { useGetSettingsQuery, useUpdatei18nSettingsMutation } from '../services/settings.mjs';
|
|
11
14
|
import { getTranslation } from '../utils/getTranslation.mjs';
|
|
12
15
|
|
|
16
|
+
const SettingsErrrorTooltip = ({ children, error })=>{
|
|
17
|
+
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
|
18
|
+
if (error) {
|
|
19
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
20
|
+
label: formatAPIError(error),
|
|
21
|
+
style: {
|
|
22
|
+
maxWidth: '200px'
|
|
23
|
+
},
|
|
24
|
+
children: children
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return children;
|
|
28
|
+
};
|
|
13
29
|
const SettingsPage = ()=>{
|
|
14
30
|
const { formatMessage } = useIntl();
|
|
15
31
|
const { toggleNotification } = useNotification();
|
|
16
|
-
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
|
17
32
|
const { data: locales, isLoading: isLoadingLocales, error } = useGetLocalesQuery();
|
|
18
33
|
const { isLoading: isLoadingRBAC, allowedActions: { canUpdate, canCreate, canDelete } } = useRBAC(PERMISSIONS);
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
const isAIAvailable = useAIAvailability();
|
|
35
|
+
// Settings state management
|
|
36
|
+
const { data: settings, isLoading: isLoadingSettings, error: settingsError } = useGetSettingsQuery();
|
|
37
|
+
const [updateSettings] = useUpdatei18nSettingsMutation();
|
|
38
|
+
const handleToggleChange = async (checked)=>{
|
|
39
|
+
try {
|
|
40
|
+
await updateSettings({
|
|
41
|
+
aiLocalizations: checked
|
|
42
|
+
}).unwrap();
|
|
43
|
+
toggleNotification({
|
|
44
|
+
type: 'success',
|
|
45
|
+
message: formatMessage({
|
|
46
|
+
id: 'notification.form.success.fields'
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
} catch (err) {
|
|
50
|
+
console.error(err);
|
|
21
51
|
toggleNotification({
|
|
22
52
|
type: 'danger',
|
|
23
|
-
message:
|
|
53
|
+
message: formatMessage({
|
|
54
|
+
id: 'notification.error',
|
|
55
|
+
defaultMessage: 'An error occurred'
|
|
56
|
+
})
|
|
24
57
|
});
|
|
25
58
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
formatAPIError,
|
|
29
|
-
toggleNotification
|
|
30
|
-
]);
|
|
31
|
-
const isLoading = isLoadingLocales || isLoadingRBAC;
|
|
59
|
+
};
|
|
60
|
+
const isLoading = isLoadingLocales || isLoadingRBAC || isLoadingSettings;
|
|
32
61
|
if (isLoading) {
|
|
33
62
|
return /*#__PURE__*/ jsx(Page.Loading, {});
|
|
34
63
|
}
|
|
@@ -51,25 +80,90 @@ const SettingsPage = ()=>{
|
|
|
51
80
|
defaultMessage: 'Configure the settings'
|
|
52
81
|
})
|
|
53
82
|
}),
|
|
54
|
-
/*#__PURE__*/
|
|
55
|
-
children:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
/*#__PURE__*/ jsxs(Layouts.Content, {
|
|
84
|
+
children: [
|
|
85
|
+
isAIAvailable && window.strapi.future.isEnabled('unstableAILocalizations') && /*#__PURE__*/ jsxs(Flex, {
|
|
86
|
+
background: "neutral0",
|
|
87
|
+
padding: 6,
|
|
88
|
+
marginBottom: 6,
|
|
89
|
+
shadow: "filterShadow",
|
|
90
|
+
hasRadius: true,
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ jsxs(Flex, {
|
|
93
|
+
direction: "column",
|
|
94
|
+
alignItems: "stretch",
|
|
95
|
+
gap: 1,
|
|
96
|
+
flex: 1,
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ jsxs(Flex, {
|
|
99
|
+
gap: 1,
|
|
100
|
+
children: [
|
|
101
|
+
/*#__PURE__*/ jsx(Box, {
|
|
102
|
+
color: "alternative700",
|
|
103
|
+
children: /*#__PURE__*/ jsx(Sparkle, {})
|
|
104
|
+
}),
|
|
105
|
+
/*#__PURE__*/ jsx(Typography, {
|
|
106
|
+
variant: "delta",
|
|
107
|
+
tag: "h2",
|
|
108
|
+
children: formatMessage({
|
|
109
|
+
id: getTranslation('Settings.aiLocalizations.label'),
|
|
110
|
+
defaultMessage: 'AI Translations'
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ jsx(Typography, {
|
|
116
|
+
variant: "pi",
|
|
117
|
+
textColor: "neutral600",
|
|
118
|
+
fontSize: "14px",
|
|
119
|
+
children: formatMessage({
|
|
120
|
+
id: getTranslation('Settings.aiLocalizations.description'),
|
|
121
|
+
defaultMessage: 'Everytime you save in the Content Manager, our AI will use your default locale to translate all other locales automatically.'
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ jsx(Field.Root, {
|
|
127
|
+
name: "aiLocalizations",
|
|
128
|
+
minWidth: "200px",
|
|
129
|
+
children: /*#__PURE__*/ jsx(SettingsErrrorTooltip, {
|
|
130
|
+
error: settingsError,
|
|
131
|
+
children: /*#__PURE__*/ jsx(Toggle, {
|
|
132
|
+
disabled: Boolean(settingsError),
|
|
133
|
+
checked: settings?.data?.aiLocalizations ?? false,
|
|
134
|
+
offLabel: formatMessage({
|
|
135
|
+
id: 'app.components.ToggleCheckbox.disabled-label',
|
|
136
|
+
defaultMessage: 'Disabled'
|
|
137
|
+
}),
|
|
138
|
+
onLabel: formatMessage({
|
|
139
|
+
id: 'app.components.ToggleCheckbox.enabled-label',
|
|
140
|
+
defaultMessage: 'Enabled'
|
|
141
|
+
}),
|
|
142
|
+
onChange: (e)=>handleToggleChange(e.target.checked)
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
]
|
|
63
147
|
}),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
148
|
+
locales.length > 0 ? /*#__PURE__*/ jsx(LocaleTable, {
|
|
149
|
+
locales: locales,
|
|
150
|
+
canDelete: canDelete,
|
|
151
|
+
canUpdate: canUpdate
|
|
152
|
+
}) : /*#__PURE__*/ jsx(EmptyStateLayout, {
|
|
153
|
+
icon: /*#__PURE__*/ jsx(EmptyDocuments, {
|
|
154
|
+
width: undefined,
|
|
155
|
+
height: undefined
|
|
156
|
+
}),
|
|
157
|
+
content: formatMessage({
|
|
158
|
+
id: getTranslation('Settings.list.empty.title'),
|
|
159
|
+
defaultMessage: 'There are no locales'
|
|
160
|
+
}),
|
|
161
|
+
action: /*#__PURE__*/ jsx(CreateLocale, {
|
|
162
|
+
disabled: !canCreate,
|
|
163
|
+
variant: "secondary"
|
|
164
|
+
})
|
|
71
165
|
})
|
|
72
|
-
|
|
166
|
+
]
|
|
73
167
|
})
|
|
74
168
|
]
|
|
75
169
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.mjs","sources":["../../../admin/src/pages/SettingsPage.tsx"],"sourcesContent":["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":["SettingsPage","formatMessage","useIntl","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","data","locales","isLoading","isLoadingLocales","error","useGetLocalesQuery","isLoadingRBAC","allowedActions","canUpdate","canCreate","canDelete","useRBAC","PERMISSIONS","React","useEffect","type","message","_jsx","Page","Loading","Array","isArray","Error","_jsxs","Main","tabIndex","Layouts","Header","primaryAction","CreateLocale","disabled","title","id","getTranslation","defaultMessage","subtitle","Content","length","LocaleTable","EmptyStateLayout","icon","EmptyDocuments","width","undefined","height","content","action","variant","ProtectedSettingsPage","Protect","permissions","read"],"mappings":";;;;;;;;;;;;AAmBA,MAAMA,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,eAAAA,EAAAA;AAC/B,IAAA,MAAM,EAAEC,uBAAAA,EAAyBC,cAAc,EAAE,GAAGC,kBAAAA,EAAAA;IACpD,MAAM,EAAEC,MAAMC,OAAO,EAAEC,WAAWC,gBAAgB,EAAEC,KAAK,EAAE,GAAGC,kBAAAA,EAAAA;AAC9D,IAAA,MAAM,EACJH,SAAAA,EAAWI,aAAa,EACxBC,gBAAgB,EAAEC,SAAS,EAAEC,SAAS,EAAEC,SAAS,EAAE,EACpD,GAAGC,OAAQC,CAAAA,WAAAA,CAAAA;AAEZC,IAAAA,KAAAA,CAAMC,SAAS,CAAC,IAAA;AACd,QAAA,IAAIV,KAAO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GAACsB,CAAAA,gBAAAA,EAAAA;AACCC,oBAAAA,IAAAA,gBAAMvB,GAACwB,CAAAA,cAAAA,EAAAA;wBAAeC,KAAOC,EAAAA,SAAAA;wBAAWC,MAAQD,EAAAA;;AAChDE,oBAAAA,OAAAA,EAASpD,aAAc,CAAA;AACrBuC,wBAAAA,EAAAA,EAAIC,cAAe,CAAA,2BAAA,CAAA;wBACnBC,cAAgB,EAAA;AAClB,qBAAA,CAAA;AACAY,oBAAAA,MAAAA,gBAAQ7B,GAACY,CAAAA,YAAAA,EAAAA;AAAaC,wBAAAA,QAAAA,EAAU,CAACrB,SAAAA;wBAAWsC,OAAQ,EAAA;;;;;;AAMhE;AAEA,MAAMC,qBAAwB,GAAA,IAAA;IAC5B,qBACE/B,GAAA,CAACC,KAAK+B,OAAO,EAAA;AAACC,QAAAA,WAAAA,EAAatC,YAAYuC,IAAI;AACzC,QAAA,QAAA,gBAAAlC,GAACzB,CAAAA,YAAAA,EAAAA,EAAAA;;AAGP;;;;"}
|
|
1
|
+
{"version":3,"file":"SettingsPage.mjs","sources":["../../../admin/src/pages/SettingsPage.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { SerializedError } from '@reduxjs/toolkit';\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useRBAC,\n Layouts,\n BaseQueryError,\n} from '@strapi/admin/strapi-admin';\nimport { useAIAvailability } from '@strapi/admin/strapi-admin/ee';\nimport {\n Box,\n EmptyStateLayout,\n Field,\n Flex,\n Tooltip,\n Toggle,\n Typography,\n} from '@strapi/design-system';\nimport { Sparkle } from '@strapi/icons';\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 { useGetSettingsQuery, useUpdatei18nSettingsMutation } from '../services/settings';\nimport { getTranslation } from '../utils/getTranslation';\n\nconst SettingsErrrorTooltip = ({\n children,\n error,\n}: {\n children: React.ReactNode;\n error: BaseQueryError | SerializedError | undefined;\n}) => {\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n if (error) {\n return (\n <Tooltip label={formatAPIError(error)} style={{ maxWidth: '200px' }}>\n {children}\n </Tooltip>\n );\n }\n\n return children;\n};\n\nconst SettingsPage = () => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const { data: locales, isLoading: isLoadingLocales, error } = useGetLocalesQuery();\n const {\n isLoading: isLoadingRBAC,\n allowedActions: { canUpdate, canCreate, canDelete },\n } = useRBAC(PERMISSIONS);\n const isAIAvailable = useAIAvailability();\n\n // Settings state management\n const {\n data: settings,\n isLoading: isLoadingSettings,\n error: settingsError,\n } = useGetSettingsQuery();\n const [updateSettings] = useUpdatei18nSettingsMutation();\n\n const handleToggleChange = async (checked: boolean) => {\n try {\n await updateSettings({ aiLocalizations: checked }).unwrap();\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.form.success.fields' }),\n });\n } catch (err) {\n console.error(err);\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred',\n }),\n });\n }\n };\n\n const isLoading = isLoadingLocales || isLoadingRBAC || isLoadingSettings;\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 {isAIAvailable && window.strapi.future.isEnabled('unstableAILocalizations') && (\n <Flex background=\"neutral0\" padding={6} marginBottom={6} shadow=\"filterShadow\" hasRadius>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1} flex={1}>\n <Flex gap={1}>\n <Box color=\"alternative700\">\n <Sparkle />\n </Box>\n <Typography variant=\"delta\" tag=\"h2\">\n {formatMessage({\n id: getTranslation('Settings.aiLocalizations.label'),\n defaultMessage: 'AI Translations',\n })}\n </Typography>\n </Flex>\n <Typography variant=\"pi\" textColor=\"neutral600\" fontSize=\"14px\">\n {formatMessage({\n id: getTranslation('Settings.aiLocalizations.description'),\n defaultMessage:\n 'Everytime you save in the Content Manager, our AI will use your default locale to translate all other locales automatically.',\n })}\n </Typography>\n </Flex>\n <Field.Root name=\"aiLocalizations\" minWidth=\"200px\">\n <SettingsErrrorTooltip error={settingsError}>\n <Toggle\n disabled={Boolean(settingsError)}\n checked={settings?.data?.aiLocalizations ?? false}\n offLabel={formatMessage({\n id: 'app.components.ToggleCheckbox.disabled-label',\n defaultMessage: 'Disabled',\n })}\n onLabel={formatMessage({\n id: 'app.components.ToggleCheckbox.enabled-label',\n defaultMessage: 'Enabled',\n })}\n onChange={(e) => handleToggleChange(e.target.checked)}\n />\n </SettingsErrrorTooltip>\n </Field.Root>\n </Flex>\n )}\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":["SettingsErrrorTooltip","children","error","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","_jsx","Tooltip","label","style","maxWidth","SettingsPage","formatMessage","useIntl","toggleNotification","useNotification","data","locales","isLoading","isLoadingLocales","useGetLocalesQuery","isLoadingRBAC","allowedActions","canUpdate","canCreate","canDelete","useRBAC","PERMISSIONS","isAIAvailable","useAIAvailability","settings","isLoadingSettings","settingsError","useGetSettingsQuery","updateSettings","useUpdatei18nSettingsMutation","handleToggleChange","checked","aiLocalizations","unwrap","type","message","id","err","console","defaultMessage","Page","Loading","Array","isArray","Error","_jsxs","Main","tabIndex","Layouts","Header","primaryAction","CreateLocale","disabled","title","getTranslation","subtitle","Content","window","strapi","future","isEnabled","Flex","background","padding","marginBottom","shadow","hasRadius","direction","alignItems","gap","flex","Box","color","Sparkle","Typography","variant","tag","textColor","fontSize","Field","Root","name","minWidth","Toggle","Boolean","offLabel","onLabel","onChange","e","target","length","LocaleTable","EmptyStateLayout","icon","EmptyDocuments","width","undefined","height","content","action","ProtectedSettingsPage","Protect","permissions","read"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAMA,wBAAwB,CAAC,EAC7BC,QAAQ,EACRC,KAAK,EAIN,GAAA;AACC,IAAA,MAAM,EAAEC,uBAAAA,EAAyBC,cAAc,EAAE,GAAGC,kBAAAA,EAAAA;AAEpD,IAAA,IAAIH,KAAO,EAAA;AACT,QAAA,qBACEI,GAACC,CAAAA,OAAAA,EAAAA;AAAQC,YAAAA,KAAAA,EAAOJ,cAAeF,CAAAA,KAAAA,CAAAA;YAAQO,KAAO,EAAA;gBAAEC,QAAU,EAAA;AAAQ,aAAA;AAC/DT,YAAAA,QAAAA,EAAAA;;AAGP;IAEA,OAAOA,QAAAA;AACT,CAAA;AAEA,MAAMU,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,kBAAkB,EAAE,GAAGC,eAAAA,EAAAA;IAC/B,MAAM,EAAEC,MAAMC,OAAO,EAAEC,WAAWC,gBAAgB,EAAEjB,KAAK,EAAE,GAAGkB,kBAAAA,EAAAA;AAC9D,IAAA,MAAM,EACJF,SAAAA,EAAWG,aAAa,EACxBC,gBAAgB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hEjB,GAAC4F,CAAAA,gBAAAA,EAAAA;AACCC,wBAAAA,IAAAA,gBAAM7F,GAAC8F,CAAAA,cAAAA,EAAAA;4BAAeC,KAAOC,EAAAA,SAAAA;4BAAWC,MAAQD,EAAAA;;AAChDE,wBAAAA,OAAAA,EAAS5F,aAAc,CAAA;AACrB8B,4BAAAA,EAAAA,EAAIkB,cAAe,CAAA,2BAAA,CAAA;4BACnBf,cAAgB,EAAA;AAClB,yBAAA,CAAA;AACA4D,wBAAAA,MAAAA,gBAAQnG,GAACmD,CAAAA,YAAAA,EAAAA;AAAaC,4BAAAA,QAAAA,EAAU,CAAClC,SAAAA;4BAAWyD,OAAQ,EAAA;;;;;;;AAMhE;AAEA,MAAMyB,qBAAwB,GAAA,IAAA;IAC5B,qBACEpG,GAAA,CAACwC,KAAK6D,OAAO,EAAA;AAACC,QAAAA,WAAAA,EAAajF,YAAYkF,IAAI;AACzC,QAAA,QAAA,gBAAAvG,GAACK,CAAAA,YAAAA,EAAAA,EAAAA;;AAGP;;;;"}
|
|
@@ -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'],\n});\n\nexport { i18nApi };\n"],"names":["i18nApi","adminApi","enhanceEndpoints","addTagTypes"],"mappings":";;;;AAEMA,MAAAA,OAAAA,GAAUC,oBAASC,CAAAA,gBAAgB,CAAC;IACxCC,WAAa,EAAA;AAAC,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'],\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;AAAW;AACtD,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.mjs","sources":["../../../admin/src/services/api.ts"],"sourcesContent":["import { adminApi } from '@strapi/admin/strapi-admin';\n\nconst i18nApi = adminApi.enhanceEndpoints({\n addTagTypes: ['Locale'],\n});\n\nexport { i18nApi };\n"],"names":["i18nApi","adminApi","enhanceEndpoints","addTagTypes"],"mappings":";;AAEMA,MAAAA,OAAAA,GAAUC,QAASC,CAAAA,gBAAgB,CAAC;IACxCC,WAAa,EAAA;AAAC,QAAA;
|
|
1
|
+
{"version":3,"file":"api.mjs","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,QAASC,CAAAA,gBAAgB,CAAC;IACxCC,WAAa,EAAA;AAAC,QAAA,QAAA;AAAU,QAAA,eAAA;AAAiB,QAAA;AAAW;AACtD,CAAA;;;;"}
|
|
@@ -14,7 +14,8 @@ const localesApi = api.i18nApi.injectEndpoints({
|
|
|
14
14
|
{
|
|
15
15
|
type: 'Locale',
|
|
16
16
|
id: 'LIST'
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
'HomepageKeyStatistics'
|
|
18
19
|
]
|
|
19
20
|
}),
|
|
20
21
|
deleteLocale: builder.mutation({
|
|
@@ -26,7 +27,8 @@ const localesApi = api.i18nApi.injectEndpoints({
|
|
|
26
27
|
{
|
|
27
28
|
type: 'Locale',
|
|
28
29
|
id
|
|
29
|
-
}
|
|
30
|
+
},
|
|
31
|
+
'HomepageKeyStatistics'
|
|
30
32
|
]
|
|
31
33
|
}),
|
|
32
34
|
getLocales: builder.query({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.js","sources":["../../../admin/src/services/locales.ts"],"sourcesContent":["import { i18nApi } from './api';\n\nimport type { GetISOLocales } from '../../../shared/contracts/iso-locales';\nimport type {\n GetLocales,\n CreateLocale,\n DeleteLocale,\n UpdateLocale,\n} from '../../../shared/contracts/locales';\n\nconst localesApi = i18nApi.injectEndpoints({\n endpoints: (builder) => ({\n createLocale: builder.mutation<CreateLocale.Response, CreateLocale.Request['body']>({\n query: (data) => ({\n url: '/i18n/locales',\n method: 'POST',\n data,\n }),\n invalidatesTags: [{ type: 'Locale', id: 'LIST' }],\n }),\n deleteLocale: builder.mutation<DeleteLocale.Response, DeleteLocale.Params['id']>({\n query: (id) => ({\n url: `/i18n/locales/${id}`,\n method: 'DELETE',\n }),\n invalidatesTags: (result, error, id) => [{ type: 'Locale', id }],\n }),\n getLocales: builder.query<GetLocales.Response, void>({\n query: () => '/i18n/locales',\n providesTags: (res) => [\n { type: 'Locale', id: 'LIST' },\n ...(Array.isArray(res)\n ? res.map((locale) => ({\n type: 'Locale' as const,\n id: locale.id,\n }))\n : []),\n ],\n }),\n getDefaultLocales: builder.query<GetISOLocales.Response, void>({\n query: () => '/i18n/iso-locales',\n }),\n updateLocale: builder.mutation<\n UpdateLocale.Response,\n UpdateLocale.Request['body'] & UpdateLocale.Params\n >({\n query: ({ id, ...data }) => ({\n url: `/i18n/locales/${id}`,\n method: 'PUT',\n data,\n }),\n invalidatesTags: (result, error, { id }) => [{ type: 'Locale', id }],\n }),\n }),\n});\n\nconst {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n} = localesApi;\n\nexport {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n};\n"],"names":["localesApi","i18nApi","injectEndpoints","endpoints","builder","createLocale","mutation","query","data","url","method","invalidatesTags","type","id","deleteLocale","result","error","getLocales","providesTags","res","Array","isArray","map","locale","getDefaultLocales","updateLocale","useCreateLocaleMutation","useDeleteLocaleMutation","useGetLocalesQuery","useGetDefaultLocalesQuery","useUpdateLocaleMutation"],"mappings":";;;;AAUA,MAAMA,UAAAA,GAAaC,WAAQC,CAAAA,eAAe,CAAC;IACzCC,SAAW,EAAA,CAACC,WAAa;YACvBC,YAAcD,EAAAA,OAAAA,CAAQE,QAAQ,CAAsD;gBAClFC,KAAO,EAAA,CAACC,QAAU;wBAChBC,GAAK,EAAA,eAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA;qBACF,CAAA;gBACAG,eAAiB,EAAA;AAAC,oBAAA;wBAAEC,IAAM,EAAA,QAAA;wBAAUC,EAAI,EAAA;AAAO;
|
|
1
|
+
{"version":3,"file":"locales.js","sources":["../../../admin/src/services/locales.ts"],"sourcesContent":["import { i18nApi } from './api';\n\nimport type { GetISOLocales } from '../../../shared/contracts/iso-locales';\nimport type {\n GetLocales,\n CreateLocale,\n DeleteLocale,\n UpdateLocale,\n} from '../../../shared/contracts/locales';\n\nconst localesApi = i18nApi.injectEndpoints({\n endpoints: (builder) => ({\n createLocale: builder.mutation<CreateLocale.Response, CreateLocale.Request['body']>({\n query: (data) => ({\n url: '/i18n/locales',\n method: 'POST',\n data,\n }),\n invalidatesTags: [{ type: 'Locale', id: 'LIST' }, 'HomepageKeyStatistics'],\n }),\n deleteLocale: builder.mutation<DeleteLocale.Response, DeleteLocale.Params['id']>({\n query: (id) => ({\n url: `/i18n/locales/${id}`,\n method: 'DELETE',\n }),\n invalidatesTags: (result, error, id) => [{ type: 'Locale', id }, 'HomepageKeyStatistics'],\n }),\n getLocales: builder.query<GetLocales.Response, void>({\n query: () => '/i18n/locales',\n providesTags: (res) => [\n { type: 'Locale', id: 'LIST' },\n ...(Array.isArray(res)\n ? res.map((locale) => ({\n type: 'Locale' as const,\n id: locale.id,\n }))\n : []),\n ],\n }),\n getDefaultLocales: builder.query<GetISOLocales.Response, void>({\n query: () => '/i18n/iso-locales',\n }),\n updateLocale: builder.mutation<\n UpdateLocale.Response,\n UpdateLocale.Request['body'] & UpdateLocale.Params\n >({\n query: ({ id, ...data }) => ({\n url: `/i18n/locales/${id}`,\n method: 'PUT',\n data,\n }),\n invalidatesTags: (result, error, { id }) => [{ type: 'Locale', id }],\n }),\n }),\n});\n\nconst {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n} = localesApi;\n\nexport {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n};\n"],"names":["localesApi","i18nApi","injectEndpoints","endpoints","builder","createLocale","mutation","query","data","url","method","invalidatesTags","type","id","deleteLocale","result","error","getLocales","providesTags","res","Array","isArray","map","locale","getDefaultLocales","updateLocale","useCreateLocaleMutation","useDeleteLocaleMutation","useGetLocalesQuery","useGetDefaultLocalesQuery","useUpdateLocaleMutation"],"mappings":";;;;AAUA,MAAMA,UAAAA,GAAaC,WAAQC,CAAAA,eAAe,CAAC;IACzCC,SAAW,EAAA,CAACC,WAAa;YACvBC,YAAcD,EAAAA,OAAAA,CAAQE,QAAQ,CAAsD;gBAClFC,KAAO,EAAA,CAACC,QAAU;wBAChBC,GAAK,EAAA,eAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA;qBACF,CAAA;gBACAG,eAAiB,EAAA;AAAC,oBAAA;wBAAEC,IAAM,EAAA,QAAA;wBAAUC,EAAI,EAAA;AAAO,qBAAA;AAAG,oBAAA;AAAwB;AAC5E,aAAA,CAAA;YACAC,YAAcV,EAAAA,OAAAA,CAAQE,QAAQ,CAAmD;gBAC/EC,KAAO,EAAA,CAACM,MAAQ;AACdJ,wBAAAA,GA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AuB,EACvBC,uBAAuB,EACvBC,kBAAkB,EAClBC,yBAAyB,EACzBC,uBAAuB,EACxB,GAAG9B;;;;;;;;"}
|
|
@@ -12,7 +12,8 @@ const localesApi = i18nApi.injectEndpoints({
|
|
|
12
12
|
{
|
|
13
13
|
type: 'Locale',
|
|
14
14
|
id: 'LIST'
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
'HomepageKeyStatistics'
|
|
16
17
|
]
|
|
17
18
|
}),
|
|
18
19
|
deleteLocale: builder.mutation({
|
|
@@ -24,7 +25,8 @@ const localesApi = i18nApi.injectEndpoints({
|
|
|
24
25
|
{
|
|
25
26
|
type: 'Locale',
|
|
26
27
|
id
|
|
27
|
-
}
|
|
28
|
+
},
|
|
29
|
+
'HomepageKeyStatistics'
|
|
28
30
|
]
|
|
29
31
|
}),
|
|
30
32
|
getLocales: builder.query({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.mjs","sources":["../../../admin/src/services/locales.ts"],"sourcesContent":["import { i18nApi } from './api';\n\nimport type { GetISOLocales } from '../../../shared/contracts/iso-locales';\nimport type {\n GetLocales,\n CreateLocale,\n DeleteLocale,\n UpdateLocale,\n} from '../../../shared/contracts/locales';\n\nconst localesApi = i18nApi.injectEndpoints({\n endpoints: (builder) => ({\n createLocale: builder.mutation<CreateLocale.Response, CreateLocale.Request['body']>({\n query: (data) => ({\n url: '/i18n/locales',\n method: 'POST',\n data,\n }),\n invalidatesTags: [{ type: 'Locale', id: 'LIST' }],\n }),\n deleteLocale: builder.mutation<DeleteLocale.Response, DeleteLocale.Params['id']>({\n query: (id) => ({\n url: `/i18n/locales/${id}`,\n method: 'DELETE',\n }),\n invalidatesTags: (result, error, id) => [{ type: 'Locale', id }],\n }),\n getLocales: builder.query<GetLocales.Response, void>({\n query: () => '/i18n/locales',\n providesTags: (res) => [\n { type: 'Locale', id: 'LIST' },\n ...(Array.isArray(res)\n ? res.map((locale) => ({\n type: 'Locale' as const,\n id: locale.id,\n }))\n : []),\n ],\n }),\n getDefaultLocales: builder.query<GetISOLocales.Response, void>({\n query: () => '/i18n/iso-locales',\n }),\n updateLocale: builder.mutation<\n UpdateLocale.Response,\n UpdateLocale.Request['body'] & UpdateLocale.Params\n >({\n query: ({ id, ...data }) => ({\n url: `/i18n/locales/${id}`,\n method: 'PUT',\n data,\n }),\n invalidatesTags: (result, error, { id }) => [{ type: 'Locale', id }],\n }),\n }),\n});\n\nconst {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n} = localesApi;\n\nexport {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n};\n"],"names":["localesApi","i18nApi","injectEndpoints","endpoints","builder","createLocale","mutation","query","data","url","method","invalidatesTags","type","id","deleteLocale","result","error","getLocales","providesTags","res","Array","isArray","map","locale","getDefaultLocales","updateLocale","useCreateLocaleMutation","useDeleteLocaleMutation","useGetLocalesQuery","useGetDefaultLocalesQuery","useUpdateLocaleMutation"],"mappings":";;AAUA,MAAMA,UAAAA,GAAaC,OAAQC,CAAAA,eAAe,CAAC;IACzCC,SAAW,EAAA,CAACC,WAAa;YACvBC,YAAcD,EAAAA,OAAAA,CAAQE,QAAQ,CAAsD;gBAClFC,KAAO,EAAA,CAACC,QAAU;wBAChBC,GAAK,EAAA,eAAA;wBACLC,MAAQ,EAAA,MAAA;AACRF,wBAAAA;qBACF,CAAA;gBACAG,eAAiB,EAAA;AAAC,oBAAA;wBAAEC,IAAM,EAAA,QAAA;wBAAUC,EAAI,EAAA;AAAO;
|
|
1
|
+
{"version":3,"file":"locales.mjs","sources":["../../../admin/src/services/locales.ts"],"sourcesContent":["import { i18nApi } from './api';\n\nimport type { GetISOLocales } from '../../../shared/contracts/iso-locales';\nimport type {\n GetLocales,\n CreateLocale,\n DeleteLocale,\n UpdateLocale,\n} from '../../../shared/contracts/locales';\n\nconst localesApi = i18nApi.injectEndpoints({\n endpoints: (builder) => ({\n createLocale: builder.mutation<CreateLocale.Response, CreateLocale.Request['body']>({\n query: (data) => ({\n url: '/i18n/locales',\n method: 'POST',\n data,\n }),\n invalidatesTags: [{ type: 'Locale', id: 'LIST' }, 'HomepageKeyStatistics'],\n }),\n deleteLocale: builder.mutation<DeleteLocale.Response, DeleteLocale.Params['id']>({\n query: (id) => ({\n url: `/i18n/locales/${id}`,\n method: 'DELETE',\n }),\n invalidatesTags: (result, error, id) => [{ type: 'Locale', id }, 'HomepageKeyStatistics'],\n }),\n getLocales: builder.query<GetLocales.Response, void>({\n query: () => '/i18n/locales',\n providesTags: (res) => [\n { type: 'Locale', id: 'LIST' },\n ...(Array.isArray(res)\n ? res.map((locale) => ({\n type: 'Locale' as const,\n id: locale.id,\n }))\n : []),\n ],\n }),\n getDefaultLocales: builder.query<GetISOLocales.Response, void>({\n query: () => '/i18n/iso-locales',\n }),\n updateLocale: builder.mutation<\n UpdateLocale.Response,\n UpdateLocale.Request['body'] & UpdateLocale.Params\n >({\n query: ({ id, ...data }) => ({\n url: `/i18n/locales/${id}`,\n method: 'PUT',\n data,\n }),\n invalidatesTags: (result, error, { id }) => [{ type: 'Locale', id }],\n }),\n }),\n});\n\nconst {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n} = localesApi;\n\nexport {\n useCreateLocaleMutation,\n useDeleteLocaleMutation,\n useGetLocalesQuery,\n useGetDefaultLocalesQuery,\n useUpdateLocaleMutation,\n};\n"],"names":["localesApi","i18nApi","injectEndpoints","endpoints","builder","createLocale","mutation","query","data","url","method","invalidatesTags","type","id","deleteLocale","result","error","getLocales","providesTags","res","Array","isArray","map","locale","getDefaultLocales","updateLocale","useCreateLocaleMutation","useDeleteLocaleMutation","useGetLocalesQuery","useGetDefaultLocalesQuery","useUpdateLocaleMutation"],"mappings":";;AAUA,MAA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