@webitel/ui-sdk 25.10.88 → 25.10.89

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "25.10.88",
3
+ "version": "25.10.89",
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",
@@ -376,6 +376,7 @@ export default deepmerge({
376
376
  [AdminSections.QuickReplies]: 'Quick replies',
377
377
  },
378
378
  },
379
+ [WebitelApplications.WFM]: { name: 'WFM' },
379
380
  },
380
381
  validation: {
381
382
  required: 'Field is required',
@@ -370,6 +370,7 @@ export default {
370
370
  [AdminSections.QuickReplies]: 'Respuestas rápidas',
371
371
  },
372
372
  },
373
+ [WebitelApplications.WFM]: { name: 'WFM' },
373
374
  },
374
375
  validation: {
375
376
  required: 'Campo requerido',
@@ -374,6 +374,7 @@ export default {
374
374
  [AdminSections.QuickReplies]: 'Жылдам жауаптар',
375
375
  },
376
376
  },
377
+ [WebitelApplications.WFM]: { name: 'WFM' },
377
378
  },
378
379
  validation: {
379
380
  required: 'Өріс міндетті',
@@ -374,6 +374,7 @@ export default {
374
374
  [AdminSections.QuickReplies]: 'Szybkie odpowiedzi',
375
375
  },
376
376
  },
377
+ [WebitelApplications.WFM]: { name: 'WFM' },
377
378
  },
378
379
  validation: {
379
380
  required: 'Pole jest wymagane',
@@ -375,6 +375,7 @@ export default {
375
375
  [AdminSections.QuickReplies]: 'Răspunsuri rapide',
376
376
  },
377
377
  },
378
+ [WebitelApplications.WFM]: { name: 'WFM' },
378
379
  },
379
380
  validation: {
380
381
  required: 'Câmpul este obligatoriu',
@@ -374,6 +374,7 @@ export default {
374
374
  [AdminSections.QuickReplies]: 'Быстрые ответы',
375
375
  },
376
376
  },
377
+ [WebitelApplications.WFM]: { name: 'WFM' },
377
378
  },
378
379
  validation: {
379
380
  required: 'Обязательное поле',
@@ -373,6 +373,7 @@ export default {
373
373
  [AdminSections.QuickReplies]: 'Швидкі відповіді',
374
374
  },
375
375
  },
376
+ [WebitelApplications.WFM]: { name: 'WFM' },
376
377
  },
377
378
  validation: {
378
379
  required: "Обов'язкове поле",
@@ -377,6 +377,7 @@ export default {
377
377
  [AdminSections.QuickReplies]: 'Tezkor javoblar',
378
378
  },
379
379
  },
380
+ [WebitelApplications.WFM]: { name: 'WFM' },
380
381
  },
381
382
  validation: {
382
383
  required: "Maydon to'ldirilishi shart",
@@ -377,6 +377,7 @@ export default {
377
377
  [AdminSections.QuickReplies]: 'Trả lời nhanh',
378
378
  },
379
379
  },
380
+ [WebitelApplications.WFM]: { name: 'WFM' },
380
381
  },
381
382
  validation: {
382
383
  required: 'Trường bắt buộc',
@@ -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
+ };
@@ -148,6 +148,7 @@ export const createUserAccessStore = ({
148
148
 
149
149
  routeAccessGuard,
150
150
  hasSpecialGlobalActionAccess,
151
+ hasApplicationVisibility,
151
152
 
152
153
  /**
153
154
  * @internal
@@ -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 { scope, permissions, ...userinfo } = await getSession();
32
+ const session = await getSession();
30
33
  const access = await getUiVisibilityAccess();
31
34
 
32
- userId.value = userinfo.userId;
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
 
@@ -333,6 +333,9 @@ declare const _default: {
333
333
  "quick-replies": string;
334
334
  };
335
335
  };
336
+ [WebitelApplications.WFM]: {
337
+ name: string;
338
+ };
336
339
  overrideApplicationsAccess: {
337
340
  [WebitelApplications.CRM]: {
338
341
  sections: {
@@ -1,4 +1,5 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "changedMode", ...args: any[]) => void;
2
3
  namespace: string;
3
4
  $props: {
4
5
  readonly namespace?: string;
@@ -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
- }, "userId">, Pick<{
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
- }, never>, Pick<{
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
- }, "initialize" | "hasReadAccess" | "hasCreateAccess" | "hasUpdateAccess" | "hasDeleteAccess" | "routeAccessGuard" | "hasSpecialGlobalActionAccess" | "hasSectionVisibility">>;
41
+ hasApplicationVisibility: any;
42
+ logoutUser: () => Promise<void>;
43
+ }, any>>;