@webitel/ui-sdk 25.10.88 → 25.10.90
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/package.json +1 -1
- package/src/locale/en/en.js +1 -0
- package/src/locale/es/es.js +1 -0
- package/src/locale/kz/kz.js +1 -0
- package/src/locale/pl/pl.js +1 -0
- package/src/locale/ro/ro.js +1 -0
- package/src/locale/ru/ru.js +1 -0
- package/src/locale/uk/uk.js +1 -0
- package/src/locale/uz/uz.js +1 -0
- package/src/locale/vi/vi.js +1 -0
- package/src/modules/Appearance/components/wt-dark-mode-switcher.vue +9 -0
- package/src/modules/Appearance/pinia/store/AppearanceStore.ts +25 -0
- package/src/modules/Userinfo/v2/stores/accessStore.ts +1 -0
- package/src/modules/Userinfo/v2/stores/userinfoStore.ts +32 -6
- package/types/locale/en/en.d.ts +3 -0
- package/types/modules/Appearance/components/wt-dark-mode-switcher.vue.d.ts +1 -0
- package/types/modules/Appearance/pinia/store/AppearanceStore.d.ts +13 -0
- package/types/modules/Userinfo/v2/stores/userinfoStore.d.ts +16 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "25.10.
|
|
3
|
+
"version": "25.10.90",
|
|
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 lint:fix || true) && npm run publish-lib",
|
package/src/locale/en/en.js
CHANGED
package/src/locale/es/es.js
CHANGED
package/src/locale/kz/kz.js
CHANGED
package/src/locale/pl/pl.js
CHANGED
package/src/locale/ro/ro.js
CHANGED
package/src/locale/ru/ru.js
CHANGED
package/src/locale/uk/uk.js
CHANGED
package/src/locale/uz/uz.js
CHANGED
package/src/locale/vi/vi.js
CHANGED
|
@@ -12,11 +12,19 @@ const props = defineProps({
|
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
const emit = defineEmits(['changedMode'])
|
|
16
|
+
|
|
15
17
|
const store = useStore();
|
|
16
18
|
|
|
17
19
|
const mode = ref('light');
|
|
18
20
|
|
|
19
21
|
const setThemeToStore = (theme) => {
|
|
22
|
+
// @author @stanislav-kozak
|
|
23
|
+
// when vuex store is not initialize and we use pinia
|
|
24
|
+
if (!store) {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
store.dispatch(`${props.namespace}/SET_THEME`, theme);
|
|
21
29
|
};
|
|
22
30
|
|
|
@@ -30,6 +38,7 @@ const setMode = (value) => {
|
|
|
30
38
|
document.documentElement.classList.remove('theme--dark');
|
|
31
39
|
localStorage.setItem('theme', 'light');
|
|
32
40
|
}
|
|
41
|
+
emit('changedMode', value)
|
|
33
42
|
setThemeToStore(mode.value);
|
|
34
43
|
};
|
|
35
44
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineStore } from 'pinia';
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
export const createAppearanceStore = () => {
|
|
5
|
+
const namespace = 'appearance';
|
|
6
|
+
|
|
7
|
+
const store = defineStore(namespace, () => {
|
|
8
|
+
const theme = ref<null | string>(null);
|
|
9
|
+
|
|
10
|
+
const darkMode = computed(() => theme.value === 'dark')
|
|
11
|
+
|
|
12
|
+
const setTheme = (newTheme: string) => {
|
|
13
|
+
theme.value = newTheme
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
theme,
|
|
18
|
+
darkMode,
|
|
19
|
+
|
|
20
|
+
setTheme
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return store;
|
|
25
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import pick from 'lodash/pick';
|
|
1
2
|
import { defineStore } from 'pinia';
|
|
2
3
|
import { ref } from 'vue';
|
|
3
4
|
|
|
4
|
-
import { getSession, getUiVisibilityAccess } from '../api/UserinfoAPI';
|
|
5
|
+
import { getSession, getUiVisibilityAccess, logout } from '../api/UserinfoAPI';
|
|
5
6
|
import { createUserAccessStore } from './accessStore';
|
|
6
7
|
|
|
7
|
-
export const createUserinfoStore = () => {
|
|
8
|
+
export const createUserinfoStore = (thisApp: string = null) => {
|
|
8
9
|
const namespace = 'userinfo';
|
|
9
10
|
const useAccessStore = createUserAccessStore({
|
|
10
11
|
namespace,
|
|
@@ -21,25 +22,47 @@ export const createUserinfoStore = () => {
|
|
|
21
22
|
routeAccessGuard,
|
|
22
23
|
hasSpecialGlobalActionAccess,
|
|
23
24
|
hasSectionVisibility,
|
|
25
|
+
hasApplicationVisibility,
|
|
24
26
|
} = accessStore;
|
|
25
27
|
|
|
26
28
|
const userId = ref();
|
|
29
|
+
const userInfo = ref(null);
|
|
27
30
|
|
|
28
31
|
const initialize = async () => {
|
|
29
|
-
const
|
|
32
|
+
const session = await getSession();
|
|
30
33
|
const access = await getUiVisibilityAccess();
|
|
31
34
|
|
|
32
|
-
userId.value =
|
|
35
|
+
userId.value = session.userId;
|
|
36
|
+
userInfo.value = pick(session, [
|
|
37
|
+
'domainId',
|
|
38
|
+
'username',
|
|
39
|
+
'permissions',
|
|
40
|
+
'userId',
|
|
41
|
+
'scope',
|
|
42
|
+
'roles',
|
|
43
|
+
'license',
|
|
44
|
+
]);
|
|
33
45
|
|
|
34
46
|
initializeAccessStore({
|
|
35
|
-
scope,
|
|
36
|
-
permissions,
|
|
47
|
+
scope: session.scope,
|
|
48
|
+
permissions: session.permissions,
|
|
37
49
|
access,
|
|
38
50
|
});
|
|
39
51
|
};
|
|
40
52
|
|
|
53
|
+
const logoutUser = async () => {
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
const authUrl = import.meta.env.VITE_AUTH_URL;
|
|
57
|
+
if (!authUrl) throw new Error('No authUrl for LOGOUT provided');
|
|
58
|
+
await logout();
|
|
59
|
+
window.location.href = authUrl;
|
|
60
|
+
};
|
|
61
|
+
|
|
41
62
|
return {
|
|
42
63
|
userId,
|
|
64
|
+
thisApp,
|
|
65
|
+
userInfo,
|
|
43
66
|
initialize,
|
|
44
67
|
|
|
45
68
|
hasReadAccess,
|
|
@@ -50,9 +73,12 @@ export const createUserinfoStore = () => {
|
|
|
50
73
|
hasSectionVisibility,
|
|
51
74
|
routeAccessGuard,
|
|
52
75
|
hasSpecialGlobalActionAccess,
|
|
76
|
+
hasApplicationVisibility,
|
|
77
|
+
logoutUser,
|
|
53
78
|
};
|
|
54
79
|
});
|
|
55
80
|
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
56
82
|
// @ts-ignore
|
|
57
83
|
window._userinfoStore = store;
|
|
58
84
|
|
package/types/locale/en/en.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const createAppearanceStore: () => import("pinia").StoreDefinition<"appearance", Pick<{
|
|
2
|
+
theme: import("vue").Ref<string, string>;
|
|
3
|
+
darkMode: import("vue").ComputedRef<boolean>;
|
|
4
|
+
setTheme: (newTheme: string) => void;
|
|
5
|
+
}, "theme">, Pick<{
|
|
6
|
+
theme: import("vue").Ref<string, string>;
|
|
7
|
+
darkMode: import("vue").ComputedRef<boolean>;
|
|
8
|
+
setTheme: (newTheme: string) => void;
|
|
9
|
+
}, "darkMode">, Pick<{
|
|
10
|
+
theme: import("vue").Ref<string, string>;
|
|
11
|
+
darkMode: import("vue").ComputedRef<boolean>;
|
|
12
|
+
setTheme: (newTheme: string) => void;
|
|
13
|
+
}, "setTheme">>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export declare const createUserinfoStore: () => import("pinia").StoreDefinition<"userinfo", Pick<{
|
|
1
|
+
export declare const createUserinfoStore: (thisApp?: string) => import("pinia").StoreDefinition<"userinfo", Pick<{
|
|
2
2
|
userId: import("vue").Ref<any, any>;
|
|
3
|
+
thisApp: string;
|
|
4
|
+
userInfo: import("vue").Ref<any, any>;
|
|
3
5
|
initialize: () => Promise<void>;
|
|
4
6
|
hasReadAccess: (object?: import("../../../../enums").WtObject) => boolean;
|
|
5
7
|
hasCreateAccess: (object?: import("../../../../enums").WtObject) => boolean;
|
|
@@ -8,8 +10,12 @@ export declare const createUserinfoStore: () => import("pinia").StoreDefinition<
|
|
|
8
10
|
hasSectionVisibility: (section: import("../types/UserAccess").UiSection, object: import("../../../../enums").WtObject) => boolean;
|
|
9
11
|
routeAccessGuard: import("vue-router").NavigationGuard;
|
|
10
12
|
hasSpecialGlobalActionAccess: (id: import("../enums").SpecialGlobalAction) => boolean;
|
|
11
|
-
|
|
13
|
+
hasApplicationVisibility: any;
|
|
14
|
+
logoutUser: () => Promise<void>;
|
|
15
|
+
}, any>, Pick<{
|
|
12
16
|
userId: import("vue").Ref<any, any>;
|
|
17
|
+
thisApp: string;
|
|
18
|
+
userInfo: import("vue").Ref<any, any>;
|
|
13
19
|
initialize: () => Promise<void>;
|
|
14
20
|
hasReadAccess: (object?: import("../../../../enums").WtObject) => boolean;
|
|
15
21
|
hasCreateAccess: (object?: import("../../../../enums").WtObject) => boolean;
|
|
@@ -18,8 +24,12 @@ export declare const createUserinfoStore: () => import("pinia").StoreDefinition<
|
|
|
18
24
|
hasSectionVisibility: (section: import("../types/UserAccess").UiSection, object: import("../../../../enums").WtObject) => boolean;
|
|
19
25
|
routeAccessGuard: import("vue-router").NavigationGuard;
|
|
20
26
|
hasSpecialGlobalActionAccess: (id: import("../enums").SpecialGlobalAction) => boolean;
|
|
21
|
-
|
|
27
|
+
hasApplicationVisibility: any;
|
|
28
|
+
logoutUser: () => Promise<void>;
|
|
29
|
+
}, any>, Pick<{
|
|
22
30
|
userId: import("vue").Ref<any, any>;
|
|
31
|
+
thisApp: string;
|
|
32
|
+
userInfo: import("vue").Ref<any, any>;
|
|
23
33
|
initialize: () => Promise<void>;
|
|
24
34
|
hasReadAccess: (object?: import("../../../../enums").WtObject) => boolean;
|
|
25
35
|
hasCreateAccess: (object?: import("../../../../enums").WtObject) => boolean;
|
|
@@ -28,4 +38,6 @@ export declare const createUserinfoStore: () => import("pinia").StoreDefinition<
|
|
|
28
38
|
hasSectionVisibility: (section: import("../types/UserAccess").UiSection, object: import("../../../../enums").WtObject) => boolean;
|
|
29
39
|
routeAccessGuard: import("vue-router").NavigationGuard;
|
|
30
40
|
hasSpecialGlobalActionAccess: (id: import("../enums").SpecialGlobalAction) => boolean;
|
|
31
|
-
|
|
41
|
+
hasApplicationVisibility: any;
|
|
42
|
+
logoutUser: () => Promise<void>;
|
|
43
|
+
}, any>>;
|