@webitel/ui-sdk 26.4.30 → 26.4.31

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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/src/locale/en/en.js +1 -1
  3. package/src/locale/es/es.js +1 -1
  4. package/src/locale/kz/kz.js +1 -1
  5. package/src/locale/pl/pl.js +1 -1
  6. package/src/locale/ro/ro.js +1 -1
  7. package/src/locale/ru/ru.js +1 -1
  8. package/src/locale/uk/uk.js +1 -1
  9. package/src/locale/uz/uz.js +1 -1
  10. package/src/locale/vi/vi.js +1 -1
  11. package/src/modules/UserNotifications/api/UserNotifications.ts +18 -0
  12. package/src/modules/UserNotifications/maps/userNotificationConfigsMap.ts +16 -0
  13. package/src/modules/UserNotifications/stores/__tests__/userNotificationsStore.spec.ts +118 -0
  14. package/src/modules/UserNotifications/stores/userNotificationsStore.ts +76 -0
  15. package/src/modules/UserNotifications/types/UserNotifications.ts +15 -0
  16. package/src/modules/Userinfo/stores/__tests__/UserinfoAccessControl.spec.ts +19 -11
  17. package/src/modules/Userinfo/stores/userinfoStore.ts +10 -1
  18. package/types/locale/en/en.d.ts +1 -1
  19. package/types/locale/es/es.d.ts +1 -1
  20. package/types/locale/i18n.d.ts +9 -9
  21. package/types/locale/index.d.ts +9 -9
  22. package/types/locale/kz/kz.d.ts +1 -1
  23. package/types/locale/pl/pl.d.ts +1 -1
  24. package/types/locale/ro/ro.d.ts +1 -1
  25. package/types/locale/ru/ru.d.ts +1 -1
  26. package/types/locale/uk/uk.d.ts +1 -1
  27. package/types/locale/uz/uz.d.ts +1 -1
  28. package/types/locale/vi/vi.d.ts +1 -1
  29. package/types/modules/UserNotifications/api/UserNotifications.d.ts +2 -0
  30. package/types/modules/UserNotifications/maps/userNotificationConfigsMap.d.ts +1 -0
  31. package/types/modules/UserNotifications/stores/userNotificationsStore.d.ts +105 -0
  32. package/types/modules/UserNotifications/types/UserNotifications.d.ts +13 -0
  33. package/types/modules/Userinfo/stores/userinfoStore.d.ts +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.4.30",
3
+ "version": "26.4.31",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && npm run build && (npm run build:types || true) && (npm run biome:format:all || true) && npm run publish-lib",
@@ -851,7 +851,7 @@ export default deepmerge(
851
851
  delete: ({ named }) =>
852
852
  `The ${named('entity').toLowerCase()} was deleted`,
853
853
  },
854
- info: {
854
+ warnings: {
855
855
  passwordExpirationMessage: 'Your password will expire in { days } days',
856
856
  },
857
857
  },
@@ -837,7 +837,7 @@ export default {
837
837
  delete: ({ named }) =>
838
838
  `El ${named('entity').toLowerCase()} fue eliminado`,
839
839
  },
840
- info: {
840
+ warnings: {
841
841
  passwordExpirationMessage: 'Tu contraseña expirará en { days } días',
842
842
  },
843
843
  },
@@ -838,7 +838,7 @@ export default {
838
838
  create: ({ named }) => `${named('entity').toLowerCase()} сақталды`,
839
839
  delete: ({ named }) => `${named('entity').toLowerCase()} жойылды`,
840
840
  },
841
- info: {
841
+ warnings: {
842
842
  passwordExpirationMessage:
843
843
  'Сіздің құпия сөзіңіз { days } күннен кейін мерзімі аяқталады',
844
844
  },
@@ -838,7 +838,7 @@ export default {
838
838
  create: ({ named }) => `${named('entity').toLowerCase()} został zapisany`,
839
839
  delete: ({ named }) => `${named('entity').toLowerCase()} został usunięty`,
840
840
  },
841
- info: {
841
+ warnings: {
842
842
  passwordExpirationMessage: 'Twoje hasło wygaśnie za { days } dni',
843
843
  },
844
844
  },
@@ -843,7 +843,7 @@ export default {
843
843
  create: ({ named }) => `${named('entity').toLowerCase()} a fost salvat`,
844
844
  delete: ({ named }) => `${named('entity').toLowerCase()} a fost șters`,
845
845
  },
846
- info: {
846
+ warnings: {
847
847
  passwordExpirationMessage: 'Parola ta va expira în { days } zile',
848
848
  },
849
849
  },
@@ -833,7 +833,7 @@ export default {
833
833
  create: ({ named }) => `${named('entity')} был сохранён`,
834
834
  delete: ({ named }) => `${named('entity')} был удалён`,
835
835
  },
836
- info: {
836
+ warnings: {
837
837
  passwordExpirationMessage: 'Ваш пароль истечёт через { days } дн(я/ей)',
838
838
  },
839
839
  },
@@ -832,7 +832,7 @@ export default {
832
832
  create: ({ named }) => `${named('entity')} було збережено`,
833
833
  delete: ({ named }) => `${named('entity')} було видалено`,
834
834
  },
835
- info: {
835
+ warnings: {
836
836
  passwordExpirationMessage: 'Пароль спливе через { days } дн(і/ів)',
837
837
  },
838
838
  },
@@ -841,7 +841,7 @@ export default {
841
841
  create: ({ named }) => `${named('entity').toLowerCase()} saqlandi`,
842
842
  delete: ({ named }) => `${named('entity').toLowerCase()} o'chirildi`,
843
843
  },
844
- info: {
844
+ warnings: {
845
845
  passwordExpirationMessage:
846
846
  'Parolingiz { days } kundan keyin amal qilishdan chiqadi',
847
847
  },
@@ -841,7 +841,7 @@ export default {
841
841
  create: ({ named }) => `${named('entity').toLowerCase()} đã được lưu`,
842
842
  delete: ({ named }) => `${named('entity').toLowerCase()} đã bị xóa`,
843
843
  },
844
- info: {
844
+ warnings: {
845
845
  passwordExpirationMessage:
846
846
  'Mật khẩu của bạn sẽ hết hạn sau { days } ngày',
847
847
  },
@@ -0,0 +1,18 @@
1
+ import {
2
+ applyTransform,
3
+ snakeToCamel,
4
+ } from '@webitel/api-services/api/transformers';
5
+ import { getUsers } from '@webitel/api-services/gen';
6
+
7
+ const getUserWarnings = async () => {
8
+ try {
9
+ const response = await getUsers().getUserWarnings();
10
+ return applyTransform(response.data, [
11
+ snakeToCamel(),
12
+ ]);
13
+ } catch (err) {
14
+ throw applyTransform(err, []);
15
+ }
16
+ };
17
+
18
+ export { getUserWarnings };
@@ -0,0 +1,16 @@
1
+ import { ApiUserWarningId } from '@webitel/api-services/gen/models';
2
+ import type { UserNotificationsConfigsMap } from '../types/UserWarnings';
3
+
4
+ export const USER_NOTIFICATION_CONFIGS_MAP = new Map<
5
+ string,
6
+ UserNotificationsConfigsMap
7
+ >([
8
+ [
9
+ ApiUserWarningId.PasswordExpiresSoon,
10
+ {
11
+ type: 'info',
12
+ localeKey: 'passwordExpirationMessage',
13
+ getDays: (warningData) => warningData.passwordExpiry.daysRemaining || 0,
14
+ },
15
+ ],
16
+ ]);
@@ -0,0 +1,118 @@
1
+ import { ApiUserWarningId } from '@webitel/api-services/gen/models';
2
+ import { createPinia, setActivePinia } from 'pinia';
3
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
4
+ import { createApp } from 'vue';
5
+
6
+ type ViMock = ReturnType<typeof vi.fn>;
7
+
8
+ // Mocks for modules used by the store
9
+ vi.mock('../../api/UserNotifications', () => {
10
+ return {
11
+ getUserWarnings: vi.fn(),
12
+ };
13
+ });
14
+
15
+ vi.mock('../../../../locale/i18n', () => {
16
+ return {
17
+ default: {
18
+ global: {
19
+ t: (key: string, payload?: number) =>
20
+ `${key}:${JSON.stringify(payload)}`,
21
+ },
22
+ },
23
+ };
24
+ });
25
+
26
+ vi.mock('../../../../scripts/eventBus', () => {
27
+ const emitMock = vi.fn();
28
+ return {
29
+ default: {
30
+ $on: vi.fn(),
31
+ $off: vi.fn(),
32
+ $emit: emitMock,
33
+ },
34
+ };
35
+ });
36
+
37
+ import eventBus from '../../../../scripts/eventBus';
38
+ import { getUserWarnings } from '../../api/UserNotifications';
39
+ import { USER_NOTIFICATION_CONFIGS_MAP } from '../../maps/userNotificationConfigsMap';
40
+ import { createUserNotificationsStore } from '../userNotificationsStore';
41
+
42
+ describe('createUserNotificationsStore', () => {
43
+ let useStore: ReturnType<typeof createUserNotificationsStore>;
44
+ let pinia: ReturnType<typeof createPinia>;
45
+
46
+ beforeEach(() => {
47
+ vi.clearAllMocks();
48
+
49
+ pinia = createPinia();
50
+ const app = createApp({});
51
+ app.use(pinia);
52
+ setActivePinia(pinia);
53
+
54
+ useStore = createUserNotificationsStore();
55
+ });
56
+
57
+ it('fetch should call API and populate notifications', async () => {
58
+ // Arrange: mock API to return warnings
59
+ const notificationsResponse = {
60
+ warnings: [
61
+ {
62
+ id: ApiUserWarningId.PasswordExpiresSoon,
63
+ warningData: {
64
+ passwordExpiry: {
65
+ daysRemaining: 5,
66
+ },
67
+ },
68
+ },
69
+ ],
70
+ };
71
+
72
+ (getUserWarnings as ViMock).mockResolvedValue(notificationsResponse);
73
+
74
+ const store = useStore();
75
+
76
+ // Act
77
+ await store.initialize();
78
+
79
+ // Assert
80
+ expect(store.notifications.length).toBe(1);
81
+ expect(store.notifications[0].days).toBe(5);
82
+ expect(store.notifications[0].localeKey).toBe(
83
+ USER_NOTIFICATION_CONFIGS_MAP.get(ApiUserWarningId.PasswordExpiresSoon)
84
+ ?.localeKey,
85
+ );
86
+ expect(getUserWarnings).toHaveBeenCalledOnce();
87
+ });
88
+
89
+ it('show should emit notification for mapped warnings', async () => {
90
+ const notificationsResponse = {
91
+ warnings: [
92
+ {
93
+ id: ApiUserWarningId.PasswordExpiresSoon,
94
+ warningData: {
95
+ passwordExpiry: {
96
+ daysRemaining: 3,
97
+ },
98
+ },
99
+ },
100
+ ],
101
+ };
102
+
103
+ (getUserWarnings as ViMock).mockResolvedValue(notificationsResponse);
104
+
105
+ const store = useStore();
106
+ await store.initialize();
107
+
108
+ // Act: show should emit once
109
+ store.show();
110
+ expect(eventBus.$emit).toHaveBeenCalledOnce();
111
+ const [[eventName, payload]] = (eventBus.$emit as ViMock).mock.calls;
112
+ expect(eventName).toBe('notification');
113
+ expect(payload.type).toBe('info');
114
+ expect(payload.text).toContain(
115
+ 'systemNotifications.warnings.passwordExpirationMessage',
116
+ );
117
+ });
118
+ });
@@ -0,0 +1,76 @@
1
+ import type { ApiUserWarning } from '@webitel/api-services/gen/models';
2
+ import { defineStore } from 'pinia';
3
+ import { computed, ref } from 'vue';
4
+ import i18n from '../../../locale/i18n';
5
+ import eventBus from '../../../scripts/eventBus';
6
+ import { getUserWarnings } from '../api/UserNotifications';
7
+ import { USER_NOTIFICATION_CONFIGS_MAP } from '../maps/userNotificationConfigsMap';
8
+ import type {
9
+ NotificationsType,
10
+ UserNotificationsConfigsMap,
11
+ } from '../types/UserNotifications';
12
+
13
+ export const createUserNotificationsStore = () => {
14
+ const namespace = 'userNotifications';
15
+
16
+ const store = defineStore(namespace, () => {
17
+ const rawNotifications = ref<ApiUserWarning[]>([]);
18
+
19
+ const initialize = async () => {
20
+ await fetch();
21
+ };
22
+
23
+ const fetch = async () => {
24
+ const response = await getUserWarnings();
25
+ rawNotifications.value =
26
+ (response && (response.warnings as ApiUserWarning[])) ?? [];
27
+ };
28
+
29
+ const notifications = computed<NotificationsType[]>(() => {
30
+ return rawNotifications.value
31
+ .map((notification) => {
32
+ const config: UserNotificationsConfigsMap =
33
+ USER_NOTIFICATION_CONFIGS_MAP.get(notification.id);
34
+ if (!config) return null;
35
+
36
+ return {
37
+ type: config.type,
38
+ localeKey: config.localeKey,
39
+ days: config.getDays(notification.warningData),
40
+ shown: false,
41
+ };
42
+ })
43
+ .filter(Boolean) as NotificationsType[];
44
+ });
45
+
46
+ const show = () => {
47
+ notifications.value.forEach((notification) => {
48
+ // @author @Lera24
49
+ //notification should only be displayed the first time you visit the page
50
+ if (notification.shown) return;
51
+
52
+ eventBus.$emit('notification', {
53
+ type: notification.type,
54
+ text: i18n.global.t(
55
+ `systemNotifications.warnings.${notification.localeKey}`,
56
+ {
57
+ days: notification.days,
58
+ },
59
+ ),
60
+ });
61
+ notification.shown = true;
62
+ });
63
+ };
64
+
65
+ return {
66
+ initialize,
67
+ show,
68
+
69
+ /** internal for devtools/debug */
70
+ rawNotifications,
71
+ notifications,
72
+ };
73
+ });
74
+
75
+ return store;
76
+ };
@@ -0,0 +1,15 @@
1
+ interface UserNotificationsConfigsMap {
2
+ id: string;
3
+ type: 'info' | 'warning' | 'error';
4
+ localeKey: string;
5
+ getDays: (warningData: number) => number;
6
+ }
7
+
8
+ interface NotificationsType {
9
+ type: 'info' | 'warning' | 'error';
10
+ localeKey: string;
11
+ days: number;
12
+ shown?: boolean;
13
+ }
14
+
15
+ export type { NotificationsType, UserNotificationsConfigsMap };
@@ -3,6 +3,25 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { createUserinfoStore } from '../userinfoStore';
5
5
 
6
+ // Mock modules at top-level so vitest hoists them before imports
7
+ vi.mock('../../api/UserinfoAPI', () => ({
8
+ getSession: vi.fn().mockResolvedValue({
9
+ userId: 1,
10
+ username: 'test',
11
+ permissions: [],
12
+ scope: [],
13
+ access: {},
14
+ license: [],
15
+ }),
16
+ getUiVisibilityAccess: vi.fn().mockResolvedValue({}),
17
+ }));
18
+
19
+ vi.mock('../../../UserWarnings/api/UserWarnings', () => ({
20
+ getUserWarnings: vi.fn().mockResolvedValue({
21
+ warnings: [],
22
+ }),
23
+ }));
24
+
6
25
  describe('UserinfoAccessControl', () => {
7
26
  let useUserinfoStore: ReturnType<typeof createUserinfoStore>;
8
27
 
@@ -13,17 +32,6 @@ describe('UserinfoAccessControl', () => {
13
32
  });
14
33
 
15
34
  it('should be defined', async () => {
16
- vi.mock(import('../../api/UserinfoAPI'), () => ({
17
- getSession: vi.fn().mockResolvedValue({
18
- userId: 1,
19
- username: 'test',
20
- permissions: [],
21
- scope: [],
22
- access: {},
23
- license: [],
24
- }),
25
- getUiVisibilityAccess: vi.fn().mockResolvedValue({}),
26
- }));
27
35
  const userinfoStore = useUserinfoStore();
28
36
  const { initialize } = userinfoStore;
29
37
  const { userId } = storeToRefs(userinfoStore);
@@ -1,7 +1,7 @@
1
1
  import pick from 'lodash/pick';
2
2
  import { defineStore, storeToRefs } from 'pinia';
3
3
  import { ref } from 'vue';
4
-
4
+ import { createUserNotificationsStore } from '../../UserNotifications/stores/userNotificationsStore';
5
5
  import { getSession, getUiVisibilityAccess, logout } from '../api/UserinfoAPI';
6
6
  import { createUserAccessStore } from './accessStore';
7
7
  import { createSettingsStore } from './settingsStore';
@@ -15,6 +15,8 @@ export const createUserinfoStore = () => {
15
15
  namespace,
16
16
  });
17
17
 
18
+ const useUserNotificationsStore = createUserNotificationsStore();
19
+
18
20
  const store = defineStore(namespace, () => {
19
21
  const accessStore = useAccessStore();
20
22
  const {
@@ -34,6 +36,11 @@ export const createUserinfoStore = () => {
34
36
  const settingsStore = useSettingsStore();
35
37
  const { initialize: initializeSettingsStore } = settingsStore;
36
38
  const { timezone } = storeToRefs(settingsStore);
39
+ const userNotificationsStore = useUserNotificationsStore();
40
+ const {
41
+ initialize: initializeUserNotificationsStore,
42
+ show: showUserNotifications,
43
+ } = userNotificationsStore;
37
44
 
38
45
  const userId = ref();
39
46
  const userInfo = ref();
@@ -41,6 +48,7 @@ export const createUserinfoStore = () => {
41
48
  const initialize = async () => {
42
49
  const session = await getSession();
43
50
  const access = await getUiVisibilityAccess();
51
+ await initializeUserNotificationsStore();
44
52
 
45
53
  userId.value = session.userId;
46
54
  userInfo.value = pick(session, [
@@ -89,6 +97,7 @@ export const createUserinfoStore = () => {
89
97
  hasSpecialGlobalActionAccess,
90
98
  hasApplicationVisibility,
91
99
  logoutUser,
100
+ showUserNotifications,
92
101
  };
93
102
  });
94
103
 
@@ -798,7 +798,7 @@ declare const _default: {
798
798
  named: any;
799
799
  }) => string;
800
800
  };
801
- info: {
801
+ warnings: {
802
802
  passwordExpirationMessage: string;
803
803
  };
804
804
  };
@@ -915,7 +915,7 @@ declare namespace _default {
915
915
  export { _delete_2 as delete };
916
916
  }
917
917
  export { success_1 as success };
918
- export namespace info {
918
+ export namespace warnings {
919
919
  let passwordExpirationMessage: string;
920
920
  }
921
921
  }
@@ -799,7 +799,7 @@ declare const _default: import("vue-i18n").I18n<{
799
799
  named: any;
800
800
  }) => string;
801
801
  };
802
- info: {
802
+ warnings: {
803
803
  passwordExpirationMessage: string;
804
804
  };
805
805
  };
@@ -1623,7 +1623,7 @@ declare const _default: import("vue-i18n").I18n<{
1623
1623
  named: any;
1624
1624
  }) => string;
1625
1625
  };
1626
- info: {
1626
+ warnings: {
1627
1627
  passwordExpirationMessage: string;
1628
1628
  };
1629
1629
  };
@@ -2431,7 +2431,7 @@ declare const _default: import("vue-i18n").I18n<{
2431
2431
  named: any;
2432
2432
  }) => string;
2433
2433
  };
2434
- info: {
2434
+ warnings: {
2435
2435
  passwordExpirationMessage: string;
2436
2436
  };
2437
2437
  };
@@ -3241,7 +3241,7 @@ declare const _default: import("vue-i18n").I18n<{
3241
3241
  named: any;
3242
3242
  }) => string;
3243
3243
  };
3244
- info: {
3244
+ warnings: {
3245
3245
  passwordExpirationMessage: string;
3246
3246
  };
3247
3247
  };
@@ -4049,7 +4049,7 @@ declare const _default: import("vue-i18n").I18n<{
4049
4049
  named: any;
4050
4050
  }) => string;
4051
4051
  };
4052
- info: {
4052
+ warnings: {
4053
4053
  passwordExpirationMessage: string;
4054
4054
  };
4055
4055
  };
@@ -4859,7 +4859,7 @@ declare const _default: import("vue-i18n").I18n<{
4859
4859
  named: any;
4860
4860
  }) => string;
4861
4861
  };
4862
- info: {
4862
+ warnings: {
4863
4863
  passwordExpirationMessage: string;
4864
4864
  };
4865
4865
  };
@@ -5669,7 +5669,7 @@ declare const _default: import("vue-i18n").I18n<{
5669
5669
  named: any;
5670
5670
  }) => string;
5671
5671
  };
5672
- info: {
5672
+ warnings: {
5673
5673
  passwordExpirationMessage: string;
5674
5674
  };
5675
5675
  };
@@ -6480,7 +6480,7 @@ declare const _default: import("vue-i18n").I18n<{
6480
6480
  named: any;
6481
6481
  }) => string;
6482
6482
  };
6483
- info: {
6483
+ warnings: {
6484
6484
  passwordExpirationMessage: string;
6485
6485
  };
6486
6486
  };
@@ -7290,7 +7290,7 @@ declare const _default: import("vue-i18n").I18n<{
7290
7290
  named: any;
7291
7291
  }) => string;
7292
7292
  };
7293
- info: {
7293
+ warnings: {
7294
7294
  passwordExpirationMessage: string;
7295
7295
  };
7296
7296
  };
@@ -809,7 +809,7 @@ export declare const messages: {
809
809
  named: any;
810
810
  }) => string;
811
811
  };
812
- info: {
812
+ warnings: {
813
813
  passwordExpirationMessage: string;
814
814
  };
815
815
  };
@@ -1633,7 +1633,7 @@ export declare const messages: {
1633
1633
  named: any;
1634
1634
  }) => string;
1635
1635
  };
1636
- info: {
1636
+ warnings: {
1637
1637
  passwordExpirationMessage: string;
1638
1638
  };
1639
1639
  };
@@ -2441,7 +2441,7 @@ export declare const messages: {
2441
2441
  named: any;
2442
2442
  }) => string;
2443
2443
  };
2444
- info: {
2444
+ warnings: {
2445
2445
  passwordExpirationMessage: string;
2446
2446
  };
2447
2447
  };
@@ -3251,7 +3251,7 @@ export declare const messages: {
3251
3251
  named: any;
3252
3252
  }) => string;
3253
3253
  };
3254
- info: {
3254
+ warnings: {
3255
3255
  passwordExpirationMessage: string;
3256
3256
  };
3257
3257
  };
@@ -4059,7 +4059,7 @@ export declare const messages: {
4059
4059
  named: any;
4060
4060
  }) => string;
4061
4061
  };
4062
- info: {
4062
+ warnings: {
4063
4063
  passwordExpirationMessage: string;
4064
4064
  };
4065
4065
  };
@@ -4869,7 +4869,7 @@ export declare const messages: {
4869
4869
  named: any;
4870
4870
  }) => string;
4871
4871
  };
4872
- info: {
4872
+ warnings: {
4873
4873
  passwordExpirationMessage: string;
4874
4874
  };
4875
4875
  };
@@ -5679,7 +5679,7 @@ export declare const messages: {
5679
5679
  named: any;
5680
5680
  }) => string;
5681
5681
  };
5682
- info: {
5682
+ warnings: {
5683
5683
  passwordExpirationMessage: string;
5684
5684
  };
5685
5685
  };
@@ -6490,7 +6490,7 @@ export declare const messages: {
6490
6490
  named: any;
6491
6491
  }) => string;
6492
6492
  };
6493
- info: {
6493
+ warnings: {
6494
6494
  passwordExpirationMessage: string;
6495
6495
  };
6496
6496
  };
@@ -7300,7 +7300,7 @@ export declare const messages: {
7300
7300
  named: any;
7301
7301
  }) => string;
7302
7302
  };
7303
- info: {
7303
+ warnings: {
7304
7304
  passwordExpirationMessage: string;
7305
7305
  };
7306
7306
  };
@@ -915,7 +915,7 @@ declare namespace _default {
915
915
  export { _delete_2 as delete };
916
916
  }
917
917
  export { success_1 as success };
918
- export namespace info {
918
+ export namespace warnings {
919
919
  let passwordExpirationMessage: string;
920
920
  }
921
921
  }
@@ -915,7 +915,7 @@ declare namespace _default {
915
915
  export { _delete_2 as delete };
916
916
  }
917
917
  export { success_1 as success };
918
- export namespace info {
918
+ export namespace warnings {
919
919
  let passwordExpirationMessage: string;
920
920
  }
921
921
  }
@@ -915,7 +915,7 @@ declare namespace _default {
915
915
  export { _delete_2 as delete };
916
916
  }
917
917
  export { success_1 as success };
918
- export namespace info {
918
+ export namespace warnings {
919
919
  let passwordExpirationMessage: string;
920
920
  }
921
921
  }
@@ -913,7 +913,7 @@ declare namespace _default {
913
913
  export { _delete_2 as delete };
914
914
  }
915
915
  export { success_1 as success };
916
- export namespace info {
916
+ export namespace warnings {
917
917
  let passwordExpirationMessage: string;
918
918
  }
919
919
  }
@@ -913,7 +913,7 @@ declare namespace _default {
913
913
  export { _delete_2 as delete };
914
914
  }
915
915
  export { success_1 as success };
916
- export namespace info {
916
+ export namespace warnings {
917
917
  let passwordExpirationMessage: string;
918
918
  }
919
919
  }
@@ -916,7 +916,7 @@ declare namespace _default {
916
916
  export { _delete_2 as delete };
917
917
  }
918
918
  export { success_1 as success };
919
- export namespace info {
919
+ export namespace warnings {
920
920
  let passwordExpirationMessage: string;
921
921
  }
922
922
  }
@@ -915,7 +915,7 @@ declare namespace _default {
915
915
  export { _delete_2 as delete };
916
916
  }
917
917
  export { success_1 as success };
918
- export namespace info {
918
+ export namespace warnings {
919
919
  let passwordExpirationMessage: string;
920
920
  }
921
921
  }
@@ -0,0 +1,2 @@
1
+ declare const getUserWarnings: () => Promise<any>;
2
+ export { getUserWarnings };
@@ -0,0 +1 @@
1
+ export declare const USER_NOTIFICATION_CONFIGS_MAP: Map<string, UserNotificationsConfigsMap>;
@@ -0,0 +1,105 @@
1
+ import type { ApiUserWarning } from '@webitel/api-services/gen/models';
2
+ import type { NotificationsType } from '../types/UserNotifications';
3
+ export declare const createUserNotificationsStore: () => import("pinia").StoreDefinition<"userNotifications", Pick<{
4
+ initialize: () => Promise<void>;
5
+ show: () => void;
6
+ /** internal for devtools/debug */
7
+ rawNotifications: import("vue").Ref<{
8
+ detail?: string;
9
+ id?: import("@webitel/api-services/gen/models").ApiUserWarningId;
10
+ warningData?: {
11
+ licenseExpiry?: {
12
+ daysRemaining?: string;
13
+ expiresAt?: string;
14
+ licenseName?: string;
15
+ };
16
+ passwordExpiry?: {
17
+ daysRemaining?: string;
18
+ expiresAt?: string;
19
+ };
20
+ };
21
+ }[], ApiUserWarning[] | {
22
+ detail?: string;
23
+ id?: import("@webitel/api-services/gen/models").ApiUserWarningId;
24
+ warningData?: {
25
+ licenseExpiry?: {
26
+ daysRemaining?: string;
27
+ expiresAt?: string;
28
+ licenseName?: string;
29
+ };
30
+ passwordExpiry?: {
31
+ daysRemaining?: string;
32
+ expiresAt?: string;
33
+ };
34
+ };
35
+ }[]>;
36
+ notifications: import("vue").ComputedRef<NotificationsType[]>;
37
+ }, "rawNotifications">, Pick<{
38
+ initialize: () => Promise<void>;
39
+ show: () => void;
40
+ /** internal for devtools/debug */
41
+ rawNotifications: import("vue").Ref<{
42
+ detail?: string;
43
+ id?: import("@webitel/api-services/gen/models").ApiUserWarningId;
44
+ warningData?: {
45
+ licenseExpiry?: {
46
+ daysRemaining?: string;
47
+ expiresAt?: string;
48
+ licenseName?: string;
49
+ };
50
+ passwordExpiry?: {
51
+ daysRemaining?: string;
52
+ expiresAt?: string;
53
+ };
54
+ };
55
+ }[], ApiUserWarning[] | {
56
+ detail?: string;
57
+ id?: import("@webitel/api-services/gen/models").ApiUserWarningId;
58
+ warningData?: {
59
+ licenseExpiry?: {
60
+ daysRemaining?: string;
61
+ expiresAt?: string;
62
+ licenseName?: string;
63
+ };
64
+ passwordExpiry?: {
65
+ daysRemaining?: string;
66
+ expiresAt?: string;
67
+ };
68
+ };
69
+ }[]>;
70
+ notifications: import("vue").ComputedRef<NotificationsType[]>;
71
+ }, "notifications">, Pick<{
72
+ initialize: () => Promise<void>;
73
+ show: () => void;
74
+ /** internal for devtools/debug */
75
+ rawNotifications: import("vue").Ref<{
76
+ detail?: string;
77
+ id?: import("@webitel/api-services/gen/models").ApiUserWarningId;
78
+ warningData?: {
79
+ licenseExpiry?: {
80
+ daysRemaining?: string;
81
+ expiresAt?: string;
82
+ licenseName?: string;
83
+ };
84
+ passwordExpiry?: {
85
+ daysRemaining?: string;
86
+ expiresAt?: string;
87
+ };
88
+ };
89
+ }[], ApiUserWarning[] | {
90
+ detail?: string;
91
+ id?: import("@webitel/api-services/gen/models").ApiUserWarningId;
92
+ warningData?: {
93
+ licenseExpiry?: {
94
+ daysRemaining?: string;
95
+ expiresAt?: string;
96
+ licenseName?: string;
97
+ };
98
+ passwordExpiry?: {
99
+ daysRemaining?: string;
100
+ expiresAt?: string;
101
+ };
102
+ };
103
+ }[]>;
104
+ notifications: import("vue").ComputedRef<NotificationsType[]>;
105
+ }, "show" | "initialize">>;
@@ -0,0 +1,13 @@
1
+ interface UserNotificationsConfigsMap {
2
+ id: string;
3
+ type: 'info' | 'warning' | 'error';
4
+ localeKey: string;
5
+ getDays: (warningData: number) => number;
6
+ }
7
+ interface NotificationsType {
8
+ type: 'info' | 'warning' | 'error';
9
+ localeKey: string;
10
+ days: number;
11
+ shown?: boolean;
12
+ }
13
+ export type { NotificationsType, UserNotificationsConfigsMap };
@@ -19,6 +19,7 @@ export declare const createUserinfoStore: () => import("pinia").StoreDefinition<
19
19
  hasSpecialGlobalActionAccess: (id: import("..").SpecialGlobalAction) => boolean;
20
20
  hasApplicationVisibility: (app: pick) => boolean;
21
21
  logoutUser: () => Promise<void>;
22
+ showUserNotifications: () => void;
22
23
  }, "timezone" | "userId" | "userInfo">, Pick<{
23
24
  userId: import("vue").Ref<any, any>;
24
25
  userInfo: import("vue").Ref<any, any>;
@@ -39,6 +40,7 @@ export declare const createUserinfoStore: () => import("pinia").StoreDefinition<
39
40
  hasSpecialGlobalActionAccess: (id: import("..").SpecialGlobalAction) => boolean;
40
41
  hasApplicationVisibility: (app: pick) => boolean;
41
42
  logoutUser: () => Promise<void>;
43
+ showUserNotifications: () => void;
42
44
  }, never>, Pick<{
43
45
  userId: import("vue").Ref<any, any>;
44
46
  userInfo: import("vue").Ref<any, any>;
@@ -59,4 +61,5 @@ export declare const createUserinfoStore: () => import("pinia").StoreDefinition<
59
61
  hasSpecialGlobalActionAccess: (id: import("..").SpecialGlobalAction) => boolean;
60
62
  hasApplicationVisibility: (app: pick) => boolean;
61
63
  logoutUser: () => Promise<void>;
62
- }, "initialize" | "hasReadAccess" | "hasCreateAccess" | "hasUpdateAccess" | "hasDeleteAccess" | "routeAccessGuard" | "hasSpecialGlobalActionAccess" | "hasGlobalCrudActionAccess" | "hasLicense" | "hasApplicationVisibility" | "hasSectionVisibility" | "logoutUser">>;
64
+ showUserNotifications: () => void;
65
+ }, "initialize" | "hasReadAccess" | "hasCreateAccess" | "hasUpdateAccess" | "hasDeleteAccess" | "routeAccessGuard" | "hasSpecialGlobalActionAccess" | "hasGlobalCrudActionAccess" | "hasLicense" | "hasApplicationVisibility" | "hasSectionVisibility" | "logoutUser" | "showUserNotifications">>;