@webitel/ui-sdk 24.12.95 → 24.12.96
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/CHANGELOG.md +30 -0
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +2120 -2154
- package/dist/ui-sdk.umd.cjs +16 -16
- package/package.json +14 -8
- package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +5 -2
- package/src/api/defaults/index.js +1 -1
- package/src/components/wt-dual-panel/wt-dual-panel.vue +1 -2
- package/src/components/wt-icon-action/iconMappings.js +1 -1
- package/src/composables/useAccessControl/v2/createUserAccessControl.ts +66 -0
- package/src/composables/useAccessControl/v2/types/CreateUserAccessControl.d.ts +21 -0
- package/src/enums/CrudAction/CrudAction.js +6 -0
- package/src/enums/CrudAction/CrudAction.ts +8 -0
- package/src/enums/WtObject/WtObject.js +51 -1
- package/src/enums/WtObject/WtObject.ts +51 -1
- package/src/enums/index.js +6 -19
- package/src/enums/index.ts +33 -0
- package/src/locale/en/en.js +1 -1
- package/src/locale/ru/ru.js +1 -1
- package/src/locale/ua/ua.js +1 -1
- package/src/modules/Userinfo/api/userinfo.js +21 -34
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +1 -1
- package/src/modules/Userinfo/v2/api/UserinfoAPI.ts +62 -0
- package/src/modules/Userinfo/v2/enums/GlobalActions/GlobalActions.ts +36 -0
- package/src/modules/Userinfo/v2/enums/ScopeClass/ScopeClass.ts +47 -0
- package/src/modules/Userinfo/v2/enums/index.ts +7 -0
- package/src/modules/Userinfo/v2/index.ts +0 -0
- package/src/modules/Userinfo/v2/mappings/mappings.ts +161 -0
- package/src/modules/Userinfo/v2/scripts/utils.ts +123 -0
- package/src/modules/Userinfo/v2/stores/__tests__/accessStore.spec.ts +136 -0
- package/src/modules/Userinfo/v2/stores/accessStore.ts +131 -0
- package/src/modules/Userinfo/v2/stores/userinfoStore.ts +56 -0
- package/src/modules/Userinfo/v2/types/UserAccess.d.ts +118 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "24.12.
|
|
3
|
+
"version": "24.12.96",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
"docs:dev": "vitepress dev docs --port 8080",
|
|
17
17
|
"docs:build": "vitepress build docs",
|
|
18
18
|
"docs:preview": "vitepress preview docs",
|
|
19
|
-
"tsc": "
|
|
20
|
-
"update-node": "nvm install --lts && nvm alias default node"
|
|
19
|
+
"tsc": "tsc -p tsconfig.json",
|
|
20
|
+
"update-node": "nvm install --lts && nvm alias default node",
|
|
21
|
+
"i": "npm install"
|
|
21
22
|
},
|
|
22
23
|
"main": "./dist/@webitel/ui-sdk.mjs",
|
|
23
24
|
"type": "module",
|
|
@@ -34,6 +35,10 @@
|
|
|
34
35
|
"import": "./src/enums/index.js",
|
|
35
36
|
"require": "./src/enums/index.js"
|
|
36
37
|
},
|
|
38
|
+
"./components": {
|
|
39
|
+
"import": "./src/components/index.js",
|
|
40
|
+
"require": "./src/components/index.js"
|
|
41
|
+
},
|
|
37
42
|
"./scripts": {
|
|
38
43
|
"import": "./src/scripts/index.js",
|
|
39
44
|
"require": "./src/scripts/index.js"
|
|
@@ -140,13 +145,13 @@
|
|
|
140
145
|
"devDependencies": {
|
|
141
146
|
"@eslint/js": "^9.17.0",
|
|
142
147
|
"@tsconfig/node22": "^22.0.0",
|
|
143
|
-
"@types/node": "^22.
|
|
148
|
+
"@types/node": "^22.12.0",
|
|
144
149
|
"@vitejs/plugin-vue": "^5.2.0",
|
|
145
150
|
"@vitest/coverage-v8": "^2.1.5",
|
|
146
151
|
"@vue/compat": "^3.5.13",
|
|
147
152
|
"@vue/compiler-sfc": "^3.5.13",
|
|
148
153
|
"@vue/test-utils": "^2.4.6",
|
|
149
|
-
"@vue/tsconfig": "^0.
|
|
154
|
+
"@vue/tsconfig": "^0.7.0",
|
|
150
155
|
"eslint": "^9.17.0",
|
|
151
156
|
"eslint-config-prettier": "^9.1.0",
|
|
152
157
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
@@ -162,8 +167,8 @@
|
|
|
162
167
|
"prettier": "^3.4.2",
|
|
163
168
|
"prismjs": "^1.29.0",
|
|
164
169
|
"sass": "^1.81.0",
|
|
165
|
-
"typescript": "5.
|
|
166
|
-
"typescript-eslint": "^8.
|
|
170
|
+
"typescript": "5.7.3",
|
|
171
|
+
"typescript-eslint": "^8.22.0",
|
|
167
172
|
"typescript-plugin-css-modules": "^5.1.0",
|
|
168
173
|
"vite": "^5.4.11",
|
|
169
174
|
"vite-plugin-checker": "^0.8.0",
|
|
@@ -175,7 +180,8 @@
|
|
|
175
180
|
"vitest": "^2.1.5",
|
|
176
181
|
"vue": "^3.5.13",
|
|
177
182
|
"vue-tsc": "^2.1.10",
|
|
178
|
-
"vuex": "^4.1.0"
|
|
183
|
+
"vuex": "^4.1.0",
|
|
184
|
+
"pinia": "^2.3.0"
|
|
179
185
|
},
|
|
180
186
|
"optionalDependencies": {
|
|
181
187
|
"@rollup/rollup-linux-x64-gnu": "4.9.5"
|
|
@@ -2,13 +2,16 @@ import generateInstance from '../../axios/generateInstance.js';
|
|
|
2
2
|
import updateTokenInterceptor from '../../interceptors/request/updateToken.interceptor.js';
|
|
3
3
|
import handleUnauthorizedInterceptor from '../../interceptors/response/handleUnauthorized.interceptor.js';
|
|
4
4
|
|
|
5
|
-
const getDefaultInstance = () =>
|
|
6
|
-
generateInstance({
|
|
5
|
+
const getDefaultInstance = () => {
|
|
6
|
+
return generateInstance({
|
|
7
7
|
interceptors: {
|
|
8
8
|
request: [updateTokenInterceptor],
|
|
9
9
|
response: [handleUnauthorizedInterceptor],
|
|
10
10
|
},
|
|
11
11
|
baseURL: import.meta.env.VITE_API_URL,
|
|
12
12
|
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { getDefaultInstance };
|
|
13
16
|
|
|
14
17
|
export default getDefaultInstance;
|
|
@@ -4,8 +4,8 @@ import getDefaultInstance from './getDefaultInstance/getDefaultInstance.js';
|
|
|
4
4
|
import getDefaultOpenAPIConfig from './getDefaultOpenAPIConfig/getDefaultOpenAPIConfig.js';
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
|
-
getDefaultGetParams,
|
|
8
7
|
getDefaultGetListResponse,
|
|
8
|
+
getDefaultGetParams,
|
|
9
9
|
getDefaultInstance,
|
|
10
10
|
getDefaultOpenAPIConfig,
|
|
11
11
|
};
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
<script setup>
|
|
34
34
|
import { computed, defineEmits, ref } from 'vue';
|
|
35
35
|
|
|
36
|
-
import IconAction from '../../enums
|
|
37
|
-
import { ComponentSize } from '../../enums/index.js';
|
|
36
|
+
import { ComponentSize, IconAction } from '../../enums';
|
|
38
37
|
|
|
39
38
|
const props = defineProps({
|
|
40
39
|
actionsPanel: {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useRoute } from 'vue-router';
|
|
3
|
+
|
|
4
|
+
import { _wtUiLog } from '../../../scripts/logger';
|
|
5
|
+
import type {
|
|
6
|
+
CreateUserAccessControlComposableParams,
|
|
7
|
+
UseAccessControlReturn,
|
|
8
|
+
} from './types/CreateUserAccessControl';
|
|
9
|
+
|
|
10
|
+
export const createUserAccessControlComposable = (
|
|
11
|
+
useUserinfoStore: CreateUserAccessControlComposableParams,
|
|
12
|
+
) => {
|
|
13
|
+
const useUserAccessControl = (
|
|
14
|
+
resource?: string,
|
|
15
|
+
// options: UseUserAccessControlComposableOptions = {},
|
|
16
|
+
): UseAccessControlReturn => {
|
|
17
|
+
const route = useRoute();
|
|
18
|
+
const object = resource || route?.meta?.WtObject;
|
|
19
|
+
|
|
20
|
+
const userinfoStore = useUserinfoStore();
|
|
21
|
+
|
|
22
|
+
if (!object) {
|
|
23
|
+
_wtUiLog.error({
|
|
24
|
+
module: 'access control',
|
|
25
|
+
entity: 'useUserAccessControl composable',
|
|
26
|
+
})(
|
|
27
|
+
'No WtObject found in route meta or passed as first param, cannot check access control',
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const hasReadAccess = computed(() => {
|
|
32
|
+
return userinfoStore.hasReadAccess(object);
|
|
33
|
+
});
|
|
34
|
+
const hasCreateAccess = computed(() => {
|
|
35
|
+
return userinfoStore.hasCreateAccess(object);
|
|
36
|
+
});
|
|
37
|
+
const hasUpdateAccess = computed(() => {
|
|
38
|
+
return userinfoStore.hasUpdateAccess(object);
|
|
39
|
+
});
|
|
40
|
+
const hasDeleteAccess = computed(() => {
|
|
41
|
+
return userinfoStore.hasDeleteAccess(object);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const hasSaveActionAccess = computed(() => {
|
|
45
|
+
if (route.params.id === 'new') return hasCreateAccess.value;
|
|
46
|
+
return hasUpdateAccess.value;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const disableUserInput = computed(() => {
|
|
50
|
+
if (route.params.id === 'new') return !hasCreateAccess.value;
|
|
51
|
+
return !hasUpdateAccess.value;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
hasReadAccess,
|
|
56
|
+
hasCreateAccess,
|
|
57
|
+
hasUpdateAccess,
|
|
58
|
+
hasDeleteAccess,
|
|
59
|
+
|
|
60
|
+
hasSaveActionAccess,
|
|
61
|
+
disableUserInput,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return useUserAccessControl;
|
|
66
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type { WtObject } from '../../../../enums';
|
|
4
|
+
import type { createUserAccessStore } from '../../../../modules/Userinfo/v2/stores/accessStore';
|
|
5
|
+
|
|
6
|
+
export type CreateUserAccessControlComposableParams =
|
|
7
|
+
ReturnType<createUserAccessStore>;
|
|
8
|
+
|
|
9
|
+
export type UseUserAccessControlComposableOptions = {
|
|
10
|
+
resource?: WtObject;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface UseAccessControlReturn {
|
|
14
|
+
hasReadAccess: Ref<boolean>;
|
|
15
|
+
hasCreateAccess: Ref<boolean>;
|
|
16
|
+
hasUpdateAccess: Ref<boolean>;
|
|
17
|
+
hasDeleteAccess: Ref<boolean>;
|
|
18
|
+
|
|
19
|
+
hasSaveActionAccess: Ref<boolean>;
|
|
20
|
+
disableUserInput: Ref<boolean>;
|
|
21
|
+
}
|
|
@@ -5,5 +5,55 @@ export const WtObject = {
|
|
|
5
5
|
Agent: 'agent',
|
|
6
6
|
Queue: 'queue',
|
|
7
7
|
Contact: 'contact',
|
|
8
|
-
|
|
8
|
+
Region: 'region',
|
|
9
|
+
User: 'user',
|
|
10
|
+
Resource: 'resource',
|
|
11
|
+
Device: 'device',
|
|
12
|
+
License: 'license',
|
|
13
|
+
Flow: 'flow',
|
|
14
|
+
Dialplan: 'dialplan',
|
|
15
|
+
Gateway: 'gateway',
|
|
16
|
+
Chatplan: 'chatplan',
|
|
17
|
+
ChatGateway: 'chatGateway',
|
|
18
|
+
Blacklist: 'blacklist',
|
|
19
|
+
Calendar: 'calendar',
|
|
20
|
+
Communication: 'communication',
|
|
21
|
+
PauseCause: 'pauseCause',
|
|
22
|
+
Media: 'media',
|
|
23
|
+
ShiftTemplate: 'shiftTemplate',
|
|
24
|
+
PauseTemplate: 'pauseTemplate',
|
|
25
|
+
WorkingCondition: 'workingCondition',
|
|
26
|
+
Skill: 'skill',
|
|
27
|
+
Bucket: 'bucket',
|
|
28
|
+
Member: 'member',
|
|
29
|
+
ResourceGroup: 'resourceGroup',
|
|
30
|
+
Team: 'team',
|
|
31
|
+
Storage: 'storage',
|
|
32
|
+
CognitiveProfile: 'cognitiveProfile',
|
|
33
|
+
EmailProfile: 'emailProfile',
|
|
34
|
+
SingleSignOn: 'singleSignOn',
|
|
35
|
+
ImportCsv: 'importCsv',
|
|
36
|
+
Trigger: 'trigger',
|
|
37
|
+
Role: 'role',
|
|
38
|
+
Object: 'object',
|
|
39
|
+
ChangeLog: 'changelog',
|
|
40
|
+
Configuration: 'configuration',
|
|
41
|
+
GlobalVariable: 'globalVariable',
|
|
42
|
+
ActiveCall: 'activeCall',
|
|
43
|
+
Scorecard: 'scorecard',
|
|
44
|
+
Logger: 'logger',
|
|
45
|
+
Call: 'call',
|
|
46
|
+
RecordFile: 'recordFile',
|
|
47
|
+
ContactGroup: 'contactGroup',
|
|
48
|
+
ChatBot: 'chatBot',
|
|
49
|
+
Cases: 'cases',
|
|
50
|
+
CaseComment: 'caseComment',
|
|
51
|
+
Slas: 'slas',
|
|
52
|
+
ServiceCatalog: 'serviceCatalog',
|
|
53
|
+
CaseSource: 'caseSource',
|
|
54
|
+
CloseReasonGroup: 'closeReasonGroup',
|
|
55
|
+
Priorities: 'priorities',
|
|
56
|
+
Status: 'status',
|
|
57
|
+
Source: 'source',
|
|
58
|
+
CustomLookup: 'customLookup',
|
|
9
59
|
};
|
|
@@ -5,7 +5,57 @@ export const WtObject = {
|
|
|
5
5
|
Agent: 'agent',
|
|
6
6
|
Queue: 'queue',
|
|
7
7
|
Contact: 'contact',
|
|
8
|
-
|
|
8
|
+
Region: 'region',
|
|
9
|
+
User: 'user',
|
|
10
|
+
Resource: 'resource',
|
|
11
|
+
Device: 'device',
|
|
12
|
+
License: 'license',
|
|
13
|
+
Flow: 'flow',
|
|
14
|
+
Dialplan: 'dialplan',
|
|
15
|
+
Gateway: 'gateway',
|
|
16
|
+
Chatplan: 'chatplan',
|
|
17
|
+
ChatGateway: 'chatGateway',
|
|
18
|
+
Blacklist: 'blacklist',
|
|
19
|
+
Calendar: 'calendar',
|
|
20
|
+
Communication: 'communication',
|
|
21
|
+
PauseCause: 'pauseCause',
|
|
22
|
+
Media: 'media',
|
|
23
|
+
ShiftTemplate: 'shiftTemplate',
|
|
24
|
+
PauseTemplate: 'pauseTemplate',
|
|
25
|
+
WorkingCondition: 'workingCondition',
|
|
26
|
+
Skill: 'skill',
|
|
27
|
+
Bucket: 'bucket',
|
|
28
|
+
Member: 'member',
|
|
29
|
+
ResourceGroup: 'resourceGroup',
|
|
30
|
+
Team: 'team',
|
|
31
|
+
Storage: 'storage',
|
|
32
|
+
CognitiveProfile: 'cognitiveProfile',
|
|
33
|
+
EmailProfile: 'emailProfile',
|
|
34
|
+
SingleSignOn: 'singleSignOn',
|
|
35
|
+
ImportCsv: 'importCsv',
|
|
36
|
+
Trigger: 'trigger',
|
|
37
|
+
Role: 'role',
|
|
38
|
+
Object: 'object',
|
|
39
|
+
ChangeLog: 'changelog',
|
|
40
|
+
Configuration: 'configuration',
|
|
41
|
+
GlobalVariable: 'globalVariable',
|
|
42
|
+
ActiveCall: 'activeCall',
|
|
43
|
+
Scorecard: 'scorecard',
|
|
44
|
+
Logger: 'logger',
|
|
45
|
+
Call: 'call',
|
|
46
|
+
RecordFile: 'recordFile',
|
|
47
|
+
ContactGroup: 'contactGroup',
|
|
48
|
+
ChatBot: 'chatBot',
|
|
49
|
+
Cases: 'cases',
|
|
50
|
+
CaseComment: 'caseComment',
|
|
51
|
+
Slas: 'slas',
|
|
52
|
+
ServiceCatalog: 'serviceCatalog',
|
|
53
|
+
CaseSource: 'caseSource',
|
|
54
|
+
CloseReasonGroup: 'closeReasonGroup',
|
|
55
|
+
Priorities: 'priorities',
|
|
56
|
+
Status: 'status',
|
|
57
|
+
Source: 'source',
|
|
58
|
+
CustomLookup: 'customLookup',
|
|
9
59
|
} as const;
|
|
10
60
|
|
|
11
61
|
export type WtObject = (typeof WtObject)[keyof typeof WtObject];
|
package/src/enums/index.js
CHANGED
|
@@ -2,28 +2,15 @@ import AbstractUserStatus from './AbstractUserStatus/AbstractUserStatus.enum.js'
|
|
|
2
2
|
import AgentStatus from './AgentStatus/AgentStatus.enum.js';
|
|
3
3
|
import ChatGatewayProvider from './ChatGatewayProvider/ChatGatewayProvider.enum.js';
|
|
4
4
|
import { ComponentSize } from './ComponentSize/ComponentSize';
|
|
5
|
+
import { CrudAction } from './CrudAction/CrudAction';
|
|
5
6
|
import IconAction from './IconAction/IconAction.enum.js';
|
|
6
7
|
import QueueType from './QueueType/QueueType.enum.js';
|
|
7
8
|
import TypesExportedSettings from './TypesExportedSettings/TypesExportedSettings.enum.js';
|
|
8
9
|
import { AdminSections } from './WebitelApplications/AdminSections';
|
|
9
|
-
import AuditorSections from './WebitelApplications/AuditorSections
|
|
10
|
-
import CrmSections from './WebitelApplications/CrmSections
|
|
11
|
-
import SupervisorSections from './WebitelApplications/SupervisorSections
|
|
10
|
+
import { AuditorSections } from './WebitelApplications/AuditorSections';
|
|
11
|
+
import { CrmSections } from './WebitelApplications/CrmSections';
|
|
12
|
+
import { SupervisorSections } from './WebitelApplications/SupervisorSections';
|
|
12
13
|
import WebitelApplications from './WebitelApplications/WebitelApplications.enum.js';
|
|
14
|
+
import { WtApplication } from './WebitelApplications/WtApplication';
|
|
13
15
|
import { WtObject } from './WtObject/WtObject';
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
AbstractUserStatus,
|
|
17
|
-
AdminSections,
|
|
18
|
-
AgentStatus,
|
|
19
|
-
AuditorSections,
|
|
20
|
-
ChatGatewayProvider,
|
|
21
|
-
ComponentSize,
|
|
22
|
-
CrmSections,
|
|
23
|
-
IconAction,
|
|
24
|
-
QueueType,
|
|
25
|
-
SupervisorSections,
|
|
26
|
-
TypesExportedSettings,
|
|
27
|
-
WebitelApplications,
|
|
28
|
-
WtObject,
|
|
29
|
-
};
|
|
16
|
+
export { AbstractUserStatus, AdminSections, AgentStatus, AuditorSections, ChatGatewayProvider, ComponentSize, CrmSections, CrudAction, IconAction, QueueType, SupervisorSections, TypesExportedSettings, WebitelApplications, WtApplication, WtObject, };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import AbstractUserStatus from './AbstractUserStatus/AbstractUserStatus.enum.js';
|
|
2
|
+
import AgentStatus from './AgentStatus/AgentStatus.enum.js';
|
|
3
|
+
import ChatGatewayProvider from './ChatGatewayProvider/ChatGatewayProvider.enum.js';
|
|
4
|
+
import { ComponentSize } from './ComponentSize/ComponentSize';
|
|
5
|
+
import { CrudAction } from './CrudAction/CrudAction';
|
|
6
|
+
import IconAction from './IconAction/IconAction.enum.js';
|
|
7
|
+
import QueueType from './QueueType/QueueType.enum.js';
|
|
8
|
+
import TypesExportedSettings from './TypesExportedSettings/TypesExportedSettings.enum.js';
|
|
9
|
+
import { AdminSections } from './WebitelApplications/AdminSections';
|
|
10
|
+
import { AuditorSections } from './WebitelApplications/AuditorSections';
|
|
11
|
+
import { CrmSections } from './WebitelApplications/CrmSections';
|
|
12
|
+
import { SupervisorSections } from './WebitelApplications/SupervisorSections';
|
|
13
|
+
import WebitelApplications from './WebitelApplications/WebitelApplications.enum.js';
|
|
14
|
+
import { WtApplication } from './WebitelApplications/WtApplication';
|
|
15
|
+
import { WtObject } from './WtObject/WtObject';
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
AbstractUserStatus,
|
|
19
|
+
AdminSections,
|
|
20
|
+
AgentStatus,
|
|
21
|
+
AuditorSections,
|
|
22
|
+
ChatGatewayProvider,
|
|
23
|
+
ComponentSize,
|
|
24
|
+
CrmSections,
|
|
25
|
+
CrudAction,
|
|
26
|
+
IconAction,
|
|
27
|
+
QueueType,
|
|
28
|
+
SupervisorSections,
|
|
29
|
+
TypesExportedSettings,
|
|
30
|
+
WebitelApplications,
|
|
31
|
+
WtApplication,
|
|
32
|
+
WtObject,
|
|
33
|
+
};
|
package/src/locale/en/en.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
EngineRoutingSchemaType,
|
|
7
7
|
} from 'webitel-sdk';
|
|
8
8
|
|
|
9
|
+
import { IconAction } from '../../enums';
|
|
9
10
|
import ChatGatewayProvider from '../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
|
|
10
|
-
import { IconAction } from '../../enums/index.js';
|
|
11
11
|
import QueueType from '../../enums/QueueType/QueueType.enum.js';
|
|
12
12
|
import AdminSections from '../../enums/WebitelApplications/AdminSections.enum.js';
|
|
13
13
|
import AuditorSections from '../../enums/WebitelApplications/AuditorSections.enum.js';
|
package/src/locale/ru/ru.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
EngineRoutingSchemaType,
|
|
7
7
|
} from 'webitel-sdk';
|
|
8
8
|
|
|
9
|
+
import { IconAction } from '../../enums';
|
|
9
10
|
import ChatGatewayProvider from '../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
|
|
10
|
-
import { IconAction } from '../../enums/index.js';
|
|
11
11
|
import QueueType from '../../enums/QueueType/QueueType.enum.js';
|
|
12
12
|
import AdminSections from '../../enums/WebitelApplications/AdminSections.enum.js';
|
|
13
13
|
import AuditorSections from '../../enums/WebitelApplications/AuditorSections.enum.js';
|
package/src/locale/ua/ua.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
EngineRoutingSchemaType,
|
|
7
7
|
} from 'webitel-sdk';
|
|
8
8
|
|
|
9
|
+
import { IconAction } from '../../enums';
|
|
9
10
|
import ChatGatewayProvider from '../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
|
|
10
|
-
import { IconAction } from '../../enums/index.js';
|
|
11
11
|
import QueueType from '../../enums/QueueType/QueueType.enum.js';
|
|
12
12
|
import AdminSections from '../../enums/WebitelApplications/AdminSections.enum.js';
|
|
13
13
|
import AuditorSections from '../../enums/WebitelApplications/AuditorSections.enum.js';
|
|
@@ -1,38 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
getSession,
|
|
3
|
+
getUiVisibilityAccess,
|
|
4
|
+
logout,
|
|
5
|
+
setInstance,
|
|
6
|
+
} from '../v2/api/UserinfoAPI';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated remove after v25.06 release
|
|
10
|
+
* @description
|
|
11
|
+
* backward compat
|
|
12
|
+
* */
|
|
13
|
+
const userinfo = (instance) => {
|
|
14
|
+
if (instance) {
|
|
15
|
+
setInstance(instance);
|
|
16
|
+
}
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
throw applyTransform(err, [notify]);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
async logout() {
|
|
28
|
-
const url = '/logout';
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
return await instance.post(url, {});
|
|
32
|
-
} catch (err) {
|
|
33
|
-
throw applyTransform(err, [notify]);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
});
|
|
18
|
+
return {
|
|
19
|
+
getSession,
|
|
20
|
+
logout,
|
|
21
|
+
getUiVisibilityAccess,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
37
24
|
|
|
38
25
|
export default userinfo;
|
|
@@ -117,7 +117,7 @@ export default class UserinfoStoreModule extends BaseStoreModule {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
await context.dispatch('SET_SESSION', session);
|
|
120
|
-
const access = await userinfo.
|
|
120
|
+
const access = await userinfo.getUiVisibilityAccess();
|
|
121
121
|
await context.dispatch(
|
|
122
122
|
'SET_APPLICATIONS_ACCESS',
|
|
123
123
|
new ApplicationsAccess({ access }).getAccess(),
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
|
|
3
|
+
import getDefaultInstance from '../../../../api/defaults/getDefaultInstance/getDefaultInstance';
|
|
4
|
+
import applyTransform, {
|
|
5
|
+
merge,
|
|
6
|
+
notify,
|
|
7
|
+
snakeToCamel,
|
|
8
|
+
} from '../../../../api/transformers/index.js';
|
|
9
|
+
import type {
|
|
10
|
+
GlobalAccessApiResponseItem,
|
|
11
|
+
ScopeAccessApiResponseItem,
|
|
12
|
+
VisibilityAccess,
|
|
13
|
+
} from '../types/UserAccess';
|
|
14
|
+
|
|
15
|
+
let instance = getDefaultInstance();
|
|
16
|
+
|
|
17
|
+
const setInstance = (newInstance: AxiosInstance) => {
|
|
18
|
+
instance = newInstance;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const getSession = async (): Promise<{
|
|
22
|
+
scope: ScopeAccessApiResponseItem[];
|
|
23
|
+
permissions: GlobalAccessApiResponseItem[];
|
|
24
|
+
userId: string;
|
|
25
|
+
}> => {
|
|
26
|
+
const url = '/userinfo';
|
|
27
|
+
try {
|
|
28
|
+
const defaultObject = () => ({
|
|
29
|
+
scope: [],
|
|
30
|
+
permissions: [],
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const response = await instance.get(url);
|
|
34
|
+
return applyTransform(response.data, [
|
|
35
|
+
merge(defaultObject()),
|
|
36
|
+
snakeToCamel(),
|
|
37
|
+
]);
|
|
38
|
+
} catch (err) {
|
|
39
|
+
throw applyTransform(err, [notify]);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const getUiVisibilityAccess = async (): Promise<VisibilityAccess> => {
|
|
44
|
+
const url = 'role/metadata/access';
|
|
45
|
+
try {
|
|
46
|
+
const response = await instance.get(url);
|
|
47
|
+
return applyTransform(response.data, [snakeToCamel()]);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
throw applyTransform(err, [notify]);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const logout = async () => {
|
|
54
|
+
const url = '/logout';
|
|
55
|
+
try {
|
|
56
|
+
return await instance.post(url, {});
|
|
57
|
+
} catch (err) {
|
|
58
|
+
throw applyTransform(err, [notify]);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { getSession, getUiVisibilityAccess, logout, setInstance };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* @description
|
|
4
|
+
* Represents backend response
|
|
5
|
+
* format for Global Access to Crud Actions.
|
|
6
|
+
* Should be converted to {@link CrudAction}
|
|
7
|
+
* */
|
|
8
|
+
export const CrudGlobalAction = {
|
|
9
|
+
Read: 'read',
|
|
10
|
+
Write: 'write',
|
|
11
|
+
Delete: 'delete',
|
|
12
|
+
Add: 'add',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type CrudGlobalAction =
|
|
16
|
+
(typeof CrudGlobalAction)[keyof typeof CrudGlobalAction];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description
|
|
20
|
+
* Represents access to global specific actions
|
|
21
|
+
* like downloading files or exporting data
|
|
22
|
+
* */
|
|
23
|
+
export const SpecialGlobalAction = {
|
|
24
|
+
PlaybackRecordFile: 'playbackRecordFile',
|
|
25
|
+
ManageUserLicense: 'manageUserLicense',
|
|
26
|
+
SchemeVariables: 'schemeVariables',
|
|
27
|
+
SystemSetting: 'systemSetting',
|
|
28
|
+
ManageUserRoles: 'manageUserRoles',
|
|
29
|
+
ExportDataGrid: 'exportDataGrid',
|
|
30
|
+
ViewCdrPhoneNumbers: 'viewCdrPhoneNumbers',
|
|
31
|
+
ChangeUserPassword: 'changeUserPassword',
|
|
32
|
+
EavesdropCall: 'eavesdropCall',
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
export type SpecialGlobalAction =
|
|
36
|
+
(typeof SpecialGlobalAction)[keyof typeof SpecialGlobalAction];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* backend `scope` field userinfo response classes
|
|
4
|
+
* `class` represents a group of entities, managed by this one class
|
|
5
|
+
*/
|
|
6
|
+
export const ScopeClass = {
|
|
7
|
+
/**
|
|
8
|
+
* Includes:
|
|
9
|
+
* - {@link WtObject.Agent}
|
|
10
|
+
* - {@link }
|
|
11
|
+
*/
|
|
12
|
+
Agent: 'cc_agent',
|
|
13
|
+
Queue: 'cc_queue',
|
|
14
|
+
Dictionaries: 'dictionaries',
|
|
15
|
+
EmailProfile: 'email_profile',
|
|
16
|
+
|
|
17
|
+
Skills: 'cc_skill',
|
|
18
|
+
Users: 'users',
|
|
19
|
+
Devices: 'devices',
|
|
20
|
+
AcrRouting: 'acr_routing',
|
|
21
|
+
Gateways: 'gateways',
|
|
22
|
+
AcrChatPlan: 'acr_chat_plan',
|
|
23
|
+
Chats: 'chats',
|
|
24
|
+
List: 'cc_list',
|
|
25
|
+
Calendars: 'calendars',
|
|
26
|
+
Team: 'cc_team',
|
|
27
|
+
ResourceGroup: 'cc_resource_group',
|
|
28
|
+
Resource: 'cc_resource',
|
|
29
|
+
StorageProfile: 'storage_profile',
|
|
30
|
+
CognitiveProfile: 'cognitive_profile',
|
|
31
|
+
SingleSignOn: 'single_sign_on',
|
|
32
|
+
ImportTemplate: 'import_template',
|
|
33
|
+
Trigger: 'trigger',
|
|
34
|
+
Schema: 'schema',
|
|
35
|
+
Role: 'roles',
|
|
36
|
+
Contacts: 'contacts',
|
|
37
|
+
MediaFile: 'media_file',
|
|
38
|
+
Logger: 'logger',
|
|
39
|
+
Calls: 'calls',
|
|
40
|
+
RecordFile: 'record_file',
|
|
41
|
+
ContactGroups: 'contact_groups',
|
|
42
|
+
ChatBots: 'chat_bots',
|
|
43
|
+
Cases: 'cases',
|
|
44
|
+
CaseComments: 'case_comments',
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
47
|
+
export type ScopeClass = (typeof ScopeClass)[keyof typeof ScopeClass];
|
|
File without changes
|