bfg-common 1.3.580 → 1.3.582

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.
@@ -1,22 +1,32 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
-
3
- export function productNameLocal(
4
- localization: UI_I_Localization
5
- ): UI_I_Localization {
6
- const config = useRuntimeConfig()
7
-
8
- const keys = Object.keys(localization)
9
- const productName =
10
- config.public.LOCALIZATION_CODE === 'ru'
11
- ? config.public.PRODUCT_NAME_RU
12
- : config.public.PRODUCT_NAME_EN
13
-
14
- for (let key in localization) {
15
- localization[key] = localization[key].replaceAll(
16
- '{productName}',
17
- String(productName)
18
- )
19
- }
20
-
21
- return localization
22
- }
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+
3
+ export function productNameLocal(
4
+ localization: UI_I_Localization
5
+ ): UI_I_Localization {
6
+ const config = useRuntimeConfig()
7
+
8
+ const productName =
9
+ config.public.LOCALIZATION_CODE === 'ru'
10
+ ? config.public.PRODUCT_NAME_RU
11
+ : config.public.PRODUCT_NAME_EN
12
+
13
+ return replaceProductNameRecursion(localization, productName)
14
+ }
15
+
16
+ const replaceProductNameRecursion = (
17
+ obj: UI_I_Localization,
18
+ productName: any
19
+ ): UI_I_Localization => {
20
+ for (const key of Object.keys(obj)) {
21
+ if (typeof obj[key] === 'string') {
22
+ obj[key] = (obj[key] as string).replaceAll('{productName}', productName)
23
+ } else if (typeof obj[key] === 'object' && obj[key] !== null) {
24
+ obj[key] = replaceProductNameRecursion(
25
+ obj[key] as UI_I_Localization,
26
+ productName
27
+ )
28
+ }
29
+ }
30
+
31
+ return obj
32
+ }
@@ -1,4 +1,4 @@
1
- import { UI_T_NotificationStatus } from '~/components/atoms/alert/lib/models/types'
1
+ import type { UI_T_NotificationStatus } from '~/components/atoms/alert/lib/models/types'
2
2
  import { UI_E_State } from '~/lib/models/enums'
3
3
 
4
4
  export interface UI_I_ItemView {
@@ -13,8 +13,9 @@ export interface UI_I_ArbitraryObject<T> {
13
13
  [key: string]: T
14
14
  }
15
15
 
16
- export interface UI_I_Localization extends UI_I_ArbitraryObject<string> {}
17
-
16
+ export interface UI_I_Localization extends UI_I_ArbitraryObject<string | UI_I_ArbitraryObject<string>> {
17
+ auth: UI_I_ArbitraryObject<string>
18
+ }
18
19
  export interface UI_I_SendTaskParams {
19
20
  method: string
20
21
  target: string
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.580",
4
+ "version": "1.3.582",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",