-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathemployeeMobile.tsx
42 lines (32 loc) · 1.3 KB
/
employeeMobile.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-FileCopyrightText: 2017-2022 City of Espoo
//
// SPDX-License-Identifier: LGPL-2.1-or-later
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import defaultsUntyped from '@evaka/customizations/employeeMobile'
import mergeWith from 'lodash/mergeWith'
import { JsonOf } from 'lib-common/json'
import { mergeCustomizer } from './common'
import { fi } from './defaults/employee-mobile-frontend/i18n/fi'
import type { EmployeeMobileCustomizations } from './types'
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const defaults: EmployeeMobileCustomizations = defaultsUntyped
declare global {
interface EvakaWindowConfig {
employeeMobileCustomizations?: Partial<JsonOf<EmployeeMobileCustomizations>>
}
}
const overrides =
typeof window !== 'undefined'
? window.evaka?.employeeMobileCustomizations
: undefined
const customizations: EmployeeMobileCustomizations = overrides
? mergeWith({}, defaults, overrides, mergeCustomizer)
: defaults
const { appConfig, featureFlags }: EmployeeMobileCustomizations = customizations
export { appConfig, featureFlags }
export type Lang = 'fi'
export type Translations = typeof fi
export const translations: Record<Lang, Translations> = {
fi: mergeWith({}, fi, customizations.translations.fi, mergeCustomizer)
}