@webitel/api-services 26.12.21 → 26.12.22
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/api/clients/_shared/appUrls.ts +11 -0
- package/src/api/clients/chatGateways/__tests__/chatGatewayChannels.spec.ts +84 -0
- package/src/api/clients/chatGateways/__tests__/chatGateways.spec.ts +115 -0
- package/src/api/clients/chatGateways/chatGatewayChannels.ts +162 -0
- package/src/api/clients/chatGateways/chatGateways.ts +66 -25
- package/src/api/clients/chatGateways/defaults/chatGatewayProviderDefaults.ts +91 -0
- package/src/api/clients/chatGateways/defaults/defaultChatGateway.ts +3 -1
- package/src/api/clients/chatGateways/defaults/webChatGateway.ts +8 -5
- package/src/api/clients/cognitiveProfiles/cognitiveProfiles.ts +8 -32
- package/src/api/clients/cognitiveProfiles/defaults/cognitiveProfileDefaults.ts +39 -0
- package/src/api/clients/gateways/__tests__/gateways.spec.ts +138 -0
- package/src/api/clients/gateways/gateways.ts +60 -52
- package/src/api/clients/index.ts +2 -0
- package/src/enums/ChatGatewayChannelSetup/ChatGatewayChannelSetup.ts +10 -0
- package/src/enums/GatewayIpAclProtocol/GatewayIpAclProtocol.ts +8 -0
- package/src/enums/GatewayRegisterState/GatewayRegisterState.ts +17 -0
- package/src/enums/StorageType/StorageType.ts +10 -0
- package/src/enums/WebchatAlternativeChannel/WebchatAlternativeChannel.ts +15 -0
- package/src/enums/index.ts +10 -0
- package/src/locale/en/en.ts +8 -0
- package/src/locale/es/es.ts +8 -0
- package/src/locale/kz/kz.ts +8 -0
- package/src/locale/pl/pl.ts +8 -0
- package/src/locale/ro/ro.ts +8 -0
- package/src/locale/ru/ru.ts +8 -0
- package/src/locale/uk/uk.ts +8 -0
- package/src/locale/uz/uz.ts +8 -0
- package/src/locale/vi/vi.ts +8 -0
- package/src/validations/_shared/ip.validations.ts +10 -0
- package/src/validations/backendProfile/__tests__/backendProfile.validations.spec.ts +104 -0
- package/src/validations/backendProfile/backendProfile.validations.ts +79 -0
- package/src/validations/chatGateway/__tests__/chatGateway.validations.spec.ts +189 -0
- package/src/validations/chatGateway/chatGateway.validations.ts +452 -0
- package/src/validations/cognitiveProfile/__tests__/cognitiveProfile.validations.spec.ts +83 -0
- package/src/validations/cognitiveProfile/cognitiveProfile.validations.ts +74 -0
- package/src/validations/device/device.validations.ts +2 -8
- package/src/validations/gateway/__tests__/gateway.validations.spec.ts +168 -0
- package/src/validations/gateway/gateway.validations.ts +138 -0
- package/src/validations/index.ts +4 -0
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/_shared/appUrls.d.ts +11 -0
- package/types/api/clients/chatGateways/chatGatewayChannels.d.ts +62 -0
- package/types/api/clients/chatGateways/chatGateways.d.ts +4 -4
- package/types/api/clients/chatGateways/defaults/chatGatewayProviderDefaults.d.ts +21 -0
- package/types/api/clients/chatGateways/defaults/defaultChatGateway.d.ts +3 -1
- package/types/api/clients/chatGateways/defaults/webChatGateway.d.ts +5 -4
- package/types/api/clients/cognitiveProfiles/cognitiveProfiles.d.ts +1 -1
- package/types/api/clients/cognitiveProfiles/defaults/cognitiveProfileDefaults.d.ts +13 -0
- package/types/api/clients/index.d.ts +2 -0
- package/types/enums/ChatGatewayChannelSetup/ChatGatewayChannelSetup.d.ts +8 -0
- package/types/enums/GatewayIpAclProtocol/GatewayIpAclProtocol.d.ts +6 -0
- package/types/enums/GatewayRegisterState/GatewayRegisterState.d.ts +15 -0
- package/types/enums/StorageType/StorageType.d.ts +9 -0
- package/types/enums/WebchatAlternativeChannel/WebchatAlternativeChannel.d.ts +13 -0
- package/types/enums/index.d.ts +6 -1
- package/types/locale/en/en.d.ts +7 -0
- package/types/locale/es/es.d.ts +7 -0
- package/types/locale/index.d.ts +63 -0
- package/types/locale/kz/kz.d.ts +7 -0
- package/types/locale/pl/pl.d.ts +7 -0
- package/types/locale/ro/ro.d.ts +7 -0
- package/types/locale/ru/ru.d.ts +7 -0
- package/types/locale/uk/uk.d.ts +7 -0
- package/types/locale/uz/uz.d.ts +7 -0
- package/types/locale/vi/vi.d.ts +7 -0
- package/types/validations/_shared/ip.validations.d.ts +4 -0
- package/types/validations/backendProfile/backendProfile.validations.d.ts +24 -0
- package/types/validations/chatGateway/chatGateway.validations.d.ts +165 -0
- package/types/validations/cognitiveProfile/cognitiveProfile.validations.d.ts +28 -0
- package/types/validations/gateway/gateway.validations.d.ts +48 -0
- package/types/validations/index.d.ts +4 -0
- package/src/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.ts +0 -12
- package/src/api/clients/gateways/defaults/defaultGateway.ts +0 -9
- package/src/api/clients/gateways/defaults/registerGateway.ts +0 -12
- package/src/api/clients/gateways/defaults/trunkingGateway.ts +0 -16
- package/types/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.d.ts +0 -12
- package/types/api/clients/gateways/defaults/defaultGateway.d.ts +0 -8
- package/types/api/clients/gateways/defaults/registerGateway.d.ts +0 -13
- package/types/api/clients/gateways/defaults/trunkingGateway.d.ts +0 -16
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
2
|
+
import { cognitiveProfileSchema } from '@webitel/api-services/validations';
|
|
1
3
|
import { getCognitiveProfileService } from '../../../gen-wire';
|
|
2
4
|
import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
|
|
3
5
|
import {
|
|
@@ -22,36 +24,10 @@ import type {
|
|
|
22
24
|
|
|
23
25
|
const baseUrl = '/storage/cognitive_profiles';
|
|
24
26
|
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
const fieldsToSend = [
|
|
31
|
-
'name',
|
|
32
|
-
'default',
|
|
33
|
-
'enabled',
|
|
34
|
-
'provider',
|
|
35
|
-
'service',
|
|
36
|
-
'description',
|
|
37
|
-
'properties',
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
/** The form binds `service` and `properties.region` as option objects. */
|
|
41
|
-
const preRequestHandler = (item: ApiParams) => {
|
|
42
|
-
const result = {
|
|
43
|
-
...item,
|
|
44
|
-
service: item.service?.value ?? item.service,
|
|
45
|
-
properties: {
|
|
46
|
-
...item.properties,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
if (result.properties.region) {
|
|
50
|
-
result.properties.region =
|
|
51
|
-
item.properties.region?.id ?? item.properties.region;
|
|
52
|
-
}
|
|
53
|
-
return result;
|
|
54
|
-
};
|
|
27
|
+
/** [Claude] the card schema's fields; `id` goes in the url, not the body */
|
|
28
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
29
|
+
cognitiveProfileSchema,
|
|
30
|
+
).filter((field) => field !== 'id');
|
|
55
31
|
|
|
56
32
|
const getCognitiveProfilesList = async (params: ApiParams) => {
|
|
57
33
|
const defaultObject = {
|
|
@@ -116,7 +92,6 @@ const getCognitiveProfile = async ({ itemId: id }: GetItemParams) => {
|
|
|
116
92
|
|
|
117
93
|
const addCognitiveProfile = async ({ itemInstance }: AddItemParams) => {
|
|
118
94
|
const item = applyTransform(itemInstance, [
|
|
119
|
-
preRequestHandler,
|
|
120
95
|
sanitize(fieldsToSend),
|
|
121
96
|
camelToSnake(),
|
|
122
97
|
]);
|
|
@@ -158,7 +133,6 @@ const updateCognitiveProfile = async ({
|
|
|
158
133
|
itemId: id,
|
|
159
134
|
}: UpdateItemParams) => {
|
|
160
135
|
const item = applyTransform(itemInstance, [
|
|
161
|
-
preRequestHandler,
|
|
162
136
|
sanitize(fieldsToSend),
|
|
163
137
|
camelToSnake(),
|
|
164
138
|
]);
|
|
@@ -212,3 +186,5 @@ export const CognitiveProfilesAPI = {
|
|
|
212
186
|
|
|
213
187
|
...generatePermissionsApi(baseUrl),
|
|
214
188
|
};
|
|
189
|
+
|
|
190
|
+
export { getCognitiveProfileDefaults } from './defaults/cognitiveProfileDefaults';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StorageProviderType,
|
|
3
|
+
StorageServiceType,
|
|
4
|
+
} from '@webitel/api-services/gen/models';
|
|
5
|
+
|
|
6
|
+
const DEFAULT_LOCALE = 'en-US';
|
|
7
|
+
|
|
8
|
+
/** [Claude] the settings each provider starts with, in `properties` */
|
|
9
|
+
const providerProperties: Partial<
|
|
10
|
+
Record<StorageProviderType, Record<string, string>>
|
|
11
|
+
> = {
|
|
12
|
+
[StorageProviderType.Microsoft]: {
|
|
13
|
+
key: '',
|
|
14
|
+
region: '',
|
|
15
|
+
locale: DEFAULT_LOCALE,
|
|
16
|
+
},
|
|
17
|
+
[StorageProviderType.Google]: {
|
|
18
|
+
key: '',
|
|
19
|
+
locale: DEFAULT_LOCALE,
|
|
20
|
+
},
|
|
21
|
+
[StorageProviderType.ElevenLabs]: {
|
|
22
|
+
key: '',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** [Claude] a new cognitive profile of the provider chosen in the create popup */
|
|
27
|
+
export const getCognitiveProfileDefaults = (
|
|
28
|
+
provider?: StorageProviderType,
|
|
29
|
+
) => ({
|
|
30
|
+
name: '',
|
|
31
|
+
default: false,
|
|
32
|
+
enabled: true,
|
|
33
|
+
provider,
|
|
34
|
+
service: StorageServiceType.Tts,
|
|
35
|
+
description: '',
|
|
36
|
+
properties: {
|
|
37
|
+
...(provider && providerProperties[provider]),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
const instance = vi.hoisted(() => ({
|
|
4
|
+
get: vi.fn(),
|
|
5
|
+
post: vi.fn(),
|
|
6
|
+
put: vi.fn(),
|
|
7
|
+
patch: vi.fn(),
|
|
8
|
+
delete: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
vi.mock('../../../defaults', async (importOriginal) => ({
|
|
12
|
+
...(await importOriginal<typeof import('../../../defaults')>()),
|
|
13
|
+
getDefaultInstance: () => instance,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
import { GatewaysAPI } from '../gateways';
|
|
17
|
+
|
|
18
|
+
const common = {
|
|
19
|
+
name: 'gw',
|
|
20
|
+
proxy: 'sip.example.com',
|
|
21
|
+
schema: {
|
|
22
|
+
id: '1',
|
|
23
|
+
name: 'flow',
|
|
24
|
+
},
|
|
25
|
+
usage: '',
|
|
26
|
+
enable: true,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
describe('GatewaysAPI', () => {
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
vi.clearAllMocks();
|
|
32
|
+
for (const method of Object.values(instance)) {
|
|
33
|
+
method.mockResolvedValue({
|
|
34
|
+
data: {},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('sends only registration fields for a register gateway', async () => {
|
|
40
|
+
await GatewaysAPI.add({
|
|
41
|
+
itemInstance: {
|
|
42
|
+
...common,
|
|
43
|
+
register: true,
|
|
44
|
+
account: 'user',
|
|
45
|
+
username: 'auth',
|
|
46
|
+
password: 'secret',
|
|
47
|
+
expires: 600,
|
|
48
|
+
host: 'leftover',
|
|
49
|
+
ipacl: [],
|
|
50
|
+
rState: 3,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
expect(instance.post).toHaveBeenCalledWith('/sip/gateways', {
|
|
55
|
+
...common,
|
|
56
|
+
register: true,
|
|
57
|
+
account: 'user',
|
|
58
|
+
username: 'auth',
|
|
59
|
+
password: 'secret',
|
|
60
|
+
expires: 600,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('sends only trunking fields for a trunking gateway', async () => {
|
|
65
|
+
await GatewaysAPI.update({
|
|
66
|
+
itemId: '5',
|
|
67
|
+
itemInstance: {
|
|
68
|
+
...common,
|
|
69
|
+
register: false,
|
|
70
|
+
host: '10.0.0.2',
|
|
71
|
+
ipacl: [
|
|
72
|
+
{
|
|
73
|
+
ip: '10.0.0.3',
|
|
74
|
+
proto: 'any',
|
|
75
|
+
port: null,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
account: 'leftover',
|
|
79
|
+
expires: 600,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
expect(instance.put).toHaveBeenCalledWith('/sip/gateways/5', {
|
|
84
|
+
...common,
|
|
85
|
+
register: false,
|
|
86
|
+
host: '10.0.0.2',
|
|
87
|
+
ipacl: [
|
|
88
|
+
{
|
|
89
|
+
ip: '10.0.0.3',
|
|
90
|
+
proto: 'any',
|
|
91
|
+
port: null,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('patches the changed field only', async () => {
|
|
98
|
+
await GatewaysAPI.patch({
|
|
99
|
+
id: '5',
|
|
100
|
+
changes: {
|
|
101
|
+
enable: false,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
expect(instance.patch).toHaveBeenCalledWith('/sip/gateways/5', {
|
|
106
|
+
enable: false,
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('fills trunking defaults on get', async () => {
|
|
111
|
+
instance.get.mockResolvedValue({
|
|
112
|
+
data: {
|
|
113
|
+
id: '5',
|
|
114
|
+
register: false,
|
|
115
|
+
ipacl: [
|
|
116
|
+
{
|
|
117
|
+
ip: '10.0.0.3',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
expect(
|
|
124
|
+
await GatewaysAPI.get({
|
|
125
|
+
itemId: '5',
|
|
126
|
+
}),
|
|
127
|
+
).toMatchObject({
|
|
128
|
+
host: '',
|
|
129
|
+
ipacl: [
|
|
130
|
+
{
|
|
131
|
+
ip: '10.0.0.3',
|
|
132
|
+
proto: 'any',
|
|
133
|
+
port: null,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GatewayIpAclProtocol } from '../../../enums/GatewayIpAclProtocol/GatewayIpAclProtocol';
|
|
1
2
|
import {
|
|
2
3
|
getDefaultGetListResponse,
|
|
3
4
|
getDefaultGetParams,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
sanitize,
|
|
14
15
|
snakeToCamel,
|
|
15
16
|
starToSearch,
|
|
17
|
+
translateError,
|
|
16
18
|
} from '../../transformers';
|
|
17
19
|
import type {
|
|
18
20
|
AddItemParams,
|
|
@@ -22,8 +24,6 @@ import type {
|
|
|
22
24
|
PatchItemParams,
|
|
23
25
|
UpdateItemParams,
|
|
24
26
|
} from '../_shared/types';
|
|
25
|
-
import registerGateway from './defaults/registerGateway';
|
|
26
|
-
import trunkingGateway from './defaults/trunkingGateway';
|
|
27
27
|
|
|
28
28
|
const instance = getDefaultInstance();
|
|
29
29
|
|
|
@@ -78,45 +78,41 @@ const getGatewayList = async (params: ApiParams) => {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const getGateway = async ({ itemId: id }: GetItemParams) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
...acl,
|
|
95
|
-
}));
|
|
96
|
-
return result;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const coerceRegisterResponse = (response: ApiParams) => {
|
|
100
|
-
const result = {
|
|
101
|
-
...registerGateway(),
|
|
102
|
-
...response,
|
|
103
|
-
};
|
|
104
|
-
return result;
|
|
81
|
+
/** [Claude] one set for both types: on save each type sends only its own fields */
|
|
82
|
+
const defaultObject = {
|
|
83
|
+
name: '',
|
|
84
|
+
usage: '',
|
|
85
|
+
proxy: '',
|
|
86
|
+
schema: {},
|
|
87
|
+
enable: true,
|
|
88
|
+
account: '',
|
|
89
|
+
username: '',
|
|
90
|
+
password: '',
|
|
91
|
+
expires: 600,
|
|
92
|
+
host: '',
|
|
93
|
+
ipacl: [],
|
|
105
94
|
};
|
|
106
95
|
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
const defaultIpAcl = {
|
|
97
|
+
ip: '',
|
|
98
|
+
proto: GatewayIpAclProtocol.Any,
|
|
99
|
+
port: null,
|
|
110
100
|
};
|
|
111
101
|
|
|
112
102
|
const url = `${baseUrl}/${id}`;
|
|
113
103
|
|
|
114
104
|
try {
|
|
115
105
|
const response = await instance.get(url);
|
|
116
|
-
|
|
106
|
+
const item = applyTransform(response.data, [
|
|
117
107
|
snakeToCamel(),
|
|
118
|
-
|
|
108
|
+
merge(defaultObject),
|
|
119
109
|
]);
|
|
110
|
+
return {
|
|
111
|
+
...item,
|
|
112
|
+
ipacl: applyTransform(item.ipacl, [
|
|
113
|
+
mergeEach(defaultIpAcl),
|
|
114
|
+
]),
|
|
115
|
+
};
|
|
120
116
|
} catch (err) {
|
|
121
117
|
throw applyTransform(err, [
|
|
122
118
|
notify,
|
|
@@ -124,37 +120,46 @@ const getGateway = async ({ itemId: id }: GetItemParams) => {
|
|
|
124
120
|
}
|
|
125
121
|
};
|
|
126
122
|
|
|
127
|
-
const
|
|
123
|
+
const commonFieldsToSend = [
|
|
128
124
|
'name',
|
|
129
125
|
'proxy',
|
|
130
|
-
'
|
|
131
|
-
'
|
|
132
|
-
'
|
|
126
|
+
'register',
|
|
127
|
+
'schema',
|
|
128
|
+
'usage',
|
|
129
|
+
'enable',
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
const registerFieldsToSend = [
|
|
133
|
+
...commonFieldsToSend,
|
|
133
134
|
'account',
|
|
134
135
|
'username',
|
|
135
136
|
'expires',
|
|
136
|
-
'account',
|
|
137
137
|
'registrar',
|
|
138
|
-
'name',
|
|
139
|
-
'register',
|
|
140
138
|
'password',
|
|
141
|
-
'schema',
|
|
142
|
-
'usage',
|
|
143
|
-
'enable',
|
|
144
139
|
];
|
|
145
140
|
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
const trunkingFieldsToSend = [
|
|
142
|
+
...commonFieldsToSend,
|
|
143
|
+
'host',
|
|
144
|
+
'ipacl',
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
/** [Claude] each gateway type sends only its own fields */
|
|
148
|
+
const toRequestItem = (item: ApiParams) =>
|
|
149
|
+
applyTransform(item, [
|
|
150
|
+
sanitize(item.register ? registerFieldsToSend : trunkingFieldsToSend),
|
|
149
151
|
camelToSnake(),
|
|
150
152
|
]);
|
|
153
|
+
|
|
154
|
+
const addGateway = async ({ itemInstance }: AddItemParams) => {
|
|
151
155
|
try {
|
|
152
|
-
const response = await instance.post(baseUrl,
|
|
156
|
+
const response = await instance.post(baseUrl, toRequestItem(itemInstance));
|
|
153
157
|
return applyTransform(response.data, [
|
|
154
158
|
snakeToCamel(),
|
|
155
159
|
]);
|
|
156
160
|
} catch (err) {
|
|
157
161
|
throw applyTransform(err, [
|
|
162
|
+
translateError,
|
|
158
163
|
notify,
|
|
159
164
|
]);
|
|
160
165
|
}
|
|
@@ -163,27 +168,29 @@ const updateGateway = async ({
|
|
|
163
168
|
itemInstance,
|
|
164
169
|
itemId: id,
|
|
165
170
|
}: UpdateItemParams) => {
|
|
166
|
-
const item = applyTransform(itemInstance, [
|
|
167
|
-
sanitize(fieldsToSend),
|
|
168
|
-
camelToSnake(),
|
|
169
|
-
]);
|
|
170
|
-
|
|
171
171
|
const url = `${baseUrl}/${id}`;
|
|
172
172
|
try {
|
|
173
|
-
const response = await instance.put(url,
|
|
173
|
+
const response = await instance.put(url, toRequestItem(itemInstance));
|
|
174
174
|
return applyTransform(response.data, [
|
|
175
175
|
snakeToCamel(),
|
|
176
176
|
]);
|
|
177
177
|
} catch (err) {
|
|
178
178
|
throw applyTransform(err, [
|
|
179
|
+
translateError,
|
|
179
180
|
notify,
|
|
180
181
|
]);
|
|
181
182
|
}
|
|
182
183
|
};
|
|
183
184
|
|
|
185
|
+
/** [Claude] a patch carries only the changed fields, so the type is unknown here */
|
|
184
186
|
const patchGateway = async ({ changes, id }: PatchItemParams) => {
|
|
185
187
|
const body = applyTransform(changes, [
|
|
186
|
-
sanitize(
|
|
188
|
+
sanitize([
|
|
189
|
+
...new Set([
|
|
190
|
+
...registerFieldsToSend,
|
|
191
|
+
...trunkingFieldsToSend,
|
|
192
|
+
]),
|
|
193
|
+
]),
|
|
187
194
|
camelToSnake(),
|
|
188
195
|
]);
|
|
189
196
|
const url = `${baseUrl}/${id}`;
|
|
@@ -194,6 +201,7 @@ const patchGateway = async ({ changes, id }: PatchItemParams) => {
|
|
|
194
201
|
]);
|
|
195
202
|
} catch (err) {
|
|
196
203
|
throw applyTransform(err, [
|
|
204
|
+
translateError,
|
|
197
205
|
notify,
|
|
198
206
|
]);
|
|
199
207
|
}
|
package/src/api/clients/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './_shared/appUrls';
|
|
1
2
|
export * from './_shared/generatePermissionsApi';
|
|
2
3
|
export * from './activeCalls/activeCalls';
|
|
3
4
|
export * from './agentCalls/agentCalls';
|
|
@@ -32,6 +33,7 @@ export * from './cases/cases';
|
|
|
32
33
|
export * from './catalog/catalog';
|
|
33
34
|
export * from './changelogs/changelogs';
|
|
34
35
|
export * from './chatDialogs/chatDialogs';
|
|
36
|
+
export * from './chatGateways/chatGatewayChannels';
|
|
35
37
|
export * from './chatGateways/chatGateways';
|
|
36
38
|
export * from './chatMessagesHistory/chatMessagesHistory';
|
|
37
39
|
export * from './chatplans/chatplans';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** [Claude] the chat service page where a channel is set up, opened in a popup */
|
|
2
|
+
export const ChatGatewayChannelSetup = {
|
|
3
|
+
Facebook: 'pages=setup',
|
|
4
|
+
Instagram: 'instagram=setup',
|
|
5
|
+
Whatsapp: 'whatsapp=setup',
|
|
6
|
+
TelegramApp: 'auth',
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export type ChatGatewayChannelSetup =
|
|
10
|
+
(typeof ChatGatewayChannelSetup)[keyof typeof ChatGatewayChannelSetup];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** [Claude] gateway `rState`: FreeSWITCH sofia registration states, in their numeric order */
|
|
2
|
+
export const GatewayRegisterState = {
|
|
3
|
+
Unregistered: 0,
|
|
4
|
+
Trying: 1,
|
|
5
|
+
Register: 2,
|
|
6
|
+
Registered: 3,
|
|
7
|
+
Unregister: 4,
|
|
8
|
+
Failed: 5,
|
|
9
|
+
FailWait: 6,
|
|
10
|
+
Expired: 7,
|
|
11
|
+
NoReg: 8,
|
|
12
|
+
Down: 9,
|
|
13
|
+
Timeout: 10,
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type GatewayRegisterState =
|
|
17
|
+
(typeof GatewayRegisterState)[keyof typeof GatewayRegisterState];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** [Claude] the `type` of a file storage backend ("storage" in the admin ui) */
|
|
2
|
+
export const StorageType = {
|
|
3
|
+
Local: 'local',
|
|
4
|
+
S3: 's3',
|
|
5
|
+
Backblaze: 'backblaze',
|
|
6
|
+
Dropbox: 'dropbox',
|
|
7
|
+
Drive: 'drive',
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
export type StorageType = (typeof StorageType)[keyof typeof StorageType];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Difference between MessangerType enum and WebchatAlternativeChannel:
|
|
3
|
+
* MessangerType - backend fields naming, provider
|
|
4
|
+
* WebchatAlternativeChannel - front-end only "simple" channel naming
|
|
5
|
+
*/
|
|
6
|
+
export const WebchatAlternativeChannel = {
|
|
7
|
+
Viber: 'viber',
|
|
8
|
+
Whatsapp: 'whatsapp',
|
|
9
|
+
Telegram: 'telegram',
|
|
10
|
+
Messenger: 'messenger',
|
|
11
|
+
Email: 'email',
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export type WebchatAlternativeChannel =
|
|
15
|
+
(typeof WebchatAlternativeChannel)[keyof typeof WebchatAlternativeChannel];
|
package/src/enums/index.ts
CHANGED
|
@@ -2,8 +2,11 @@ import { AgentStatus } from './AgentStatus/AgentStatus';
|
|
|
2
2
|
import { CallReportingStatus } from './CallReportingStatus/CallReportingStatus';
|
|
3
3
|
import { ChannelState } from './ChannelState/ChannelState';
|
|
4
4
|
import { ChannelType } from './ChannelType/ChannelType';
|
|
5
|
+
import { ChatGatewayChannelSetup } from './ChatGatewayChannelSetup/ChatGatewayChannelSetup';
|
|
5
6
|
import { ChatGatewayProvider } from './ChatGatewayProvider/ChatGatewayPrivider';
|
|
6
7
|
import { FormatDateMode } from './FormatDateMode/FormatDateMode';
|
|
8
|
+
import { GatewayIpAclProtocol } from './GatewayIpAclProtocol/GatewayIpAclProtocol';
|
|
9
|
+
import { GatewayRegisterState } from './GatewayRegisterState/GatewayRegisterState';
|
|
7
10
|
import { MemberStopCause } from './MemberStopCause/MemberStopCause';
|
|
8
11
|
import { QueuePeriod } from './QueuePeriod/QueuePeriod';
|
|
9
12
|
import {
|
|
@@ -14,6 +17,7 @@ import { QueueType, QueueTypeName } from './QueueType/QueueType';
|
|
|
14
17
|
import { RelativeDatetimeValue } from './RelativeDatetimeValue/RelativeDatetimeValue';
|
|
15
18
|
import { ResourceCidType } from './ResourceCidType/ResourceCidType';
|
|
16
19
|
import { ResourceIgnoreEarlyMedia } from './ResourceIgnoreEarlyMedia/ResourceIgnoreEarlyMedia';
|
|
20
|
+
import { StorageType } from './StorageType/StorageType';
|
|
17
21
|
import { TimeBaseScore } from './TimeBaseScore/TimeBaseScore';
|
|
18
22
|
import { TtsGoogleVoiceList } from './TtsGoogleVoice/TtsGoogleVoice';
|
|
19
23
|
import { TtsMicrosoftVoice } from './TtsMicrosoftVoice/TtsMicrosoftVoice';
|
|
@@ -21,6 +25,7 @@ import { TtsTextType } from './TtsTextType/TtsTextType';
|
|
|
21
25
|
import { TypesResourceStrategy } from './TypesResourceStrategy/TypesResourceStrategy';
|
|
22
26
|
import { UrlProtocol } from './UrlProtocol/UrlProtocol';
|
|
23
27
|
import { UserPresenceStatus } from './UserPresenceStatus/UserPresenceStatus';
|
|
28
|
+
import { WebchatAlternativeChannel } from './WebchatAlternativeChannel/WebchatAlternativeChannel';
|
|
24
29
|
|
|
25
30
|
export type { TtsGoogleVoice } from './TtsGoogleVoice/TtsGoogleVoice';
|
|
26
31
|
export {
|
|
@@ -28,8 +33,11 @@ export {
|
|
|
28
33
|
CallReportingStatus,
|
|
29
34
|
ChannelState,
|
|
30
35
|
ChannelType,
|
|
36
|
+
ChatGatewayChannelSetup,
|
|
31
37
|
ChatGatewayProvider,
|
|
32
38
|
FormatDateMode,
|
|
39
|
+
GatewayIpAclProtocol,
|
|
40
|
+
GatewayRegisterState,
|
|
33
41
|
MemberStopCause,
|
|
34
42
|
QueuePeriod,
|
|
35
43
|
QueueStrategy,
|
|
@@ -39,6 +47,7 @@ export {
|
|
|
39
47
|
RelativeDatetimeValue,
|
|
40
48
|
ResourceCidType,
|
|
41
49
|
ResourceIgnoreEarlyMedia,
|
|
50
|
+
StorageType,
|
|
42
51
|
TimeBaseScore,
|
|
43
52
|
TtsGoogleVoiceList,
|
|
44
53
|
TtsMicrosoftVoice,
|
|
@@ -46,4 +55,5 @@ export {
|
|
|
46
55
|
TypesResourceStrategy,
|
|
47
56
|
UrlProtocol,
|
|
48
57
|
UserPresenceStatus,
|
|
58
|
+
WebchatAlternativeChannel,
|
|
49
59
|
};
|
package/src/locale/en/en.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { MessageContext } from 'vue-i18n';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
backendErrors: {
|
|
5
|
+
sip: {
|
|
6
|
+
gateway: {
|
|
7
|
+
password: {
|
|
8
|
+
invalid:
|
|
9
|
+
"Password contains forbidden characters. Reserved URI symbols, whitespace, and special characters like (! * ' ( ) & $) are not allowed.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
ccOutboundResource: {
|
|
6
14
|
validatePhoneNumber: ({ linked }: MessageContext) =>
|
|
7
15
|
`File contains invalid numbers. ${linked('validation.phoneNumberSymbolsValidator')}`,
|
package/src/locale/es/es.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { MessageContext } from 'vue-i18n';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
backendErrors: {
|
|
5
|
+
sip: {
|
|
6
|
+
gateway: {
|
|
7
|
+
password: {
|
|
8
|
+
invalid:
|
|
9
|
+
"La contraseña contiene caracteres no permitidos. No se permiten símbolos reservados de URI, espacios en blanco ni caracteres especiales como (! * ' ( ) & $).",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
ccOutboundResource: {
|
|
6
14
|
validatePhoneNumber: ({ linked }: MessageContext) =>
|
|
7
15
|
`El archivo contiene números incorrectos. ${linked('validation.phoneNumberSymbolsValidator')}`,
|
package/src/locale/kz/kz.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { MessageContext } from 'vue-i18n';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
backendErrors: {
|
|
5
|
+
sip: {
|
|
6
|
+
gateway: {
|
|
7
|
+
password: {
|
|
8
|
+
invalid:
|
|
9
|
+
"Құпия сөзде рұқсат етілмеген таңбалар бар. Резервтелген URI таңбалары, бос орындар және (! * ' ( ) & $) сияқты арнайы таңбаларды пайдалануға болмайды.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
ccOutboundResource: {
|
|
6
14
|
validatePhoneNumber: ({ linked }: MessageContext) =>
|
|
7
15
|
`Файлда қате нөмірлер бар. ${linked('validation.phoneNumberSymbolsValidator')}`,
|
package/src/locale/pl/pl.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { MessageContext } from 'vue-i18n';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
backendErrors: {
|
|
5
|
+
sip: {
|
|
6
|
+
gateway: {
|
|
7
|
+
password: {
|
|
8
|
+
invalid:
|
|
9
|
+
"Hasło zawiera niedozwolone znaki. Zarezerwowane symbole URI, spacje oraz znaki specjalne takie jak (! * ' ( ) & $) są niedozwolone.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
ccOutboundResource: {
|
|
6
14
|
validatePhoneNumber: ({ linked }: MessageContext) =>
|
|
7
15
|
`Plik zawiera nieprawidłowe numery. ${linked('validation.phoneNumberSymbolsValidator')}`,
|
package/src/locale/ro/ro.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { MessageContext } from 'vue-i18n';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
backendErrors: {
|
|
5
|
+
sip: {
|
|
6
|
+
gateway: {
|
|
7
|
+
password: {
|
|
8
|
+
invalid:
|
|
9
|
+
"Parola conține caractere interzise. Simbolurile URI rezervate, spațiile și caracterele speciale precum (! * ' ( ) & $) nu sunt permise.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
ccOutboundResource: {
|
|
6
14
|
validatePhoneNumber: ({ linked }: MessageContext) =>
|
|
7
15
|
`Fișierul conține numere incorecte. ${linked('validation.phoneNumberSymbolsValidator')}`,
|
package/src/locale/ru/ru.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { MessageContext } from 'vue-i18n';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
backendErrors: {
|
|
5
|
+
sip: {
|
|
6
|
+
gateway: {
|
|
7
|
+
password: {
|
|
8
|
+
invalid:
|
|
9
|
+
"Пароль содержит запрещенные символы. Зарезервированные символы URI, пробелы, спецсимволы !*'()&$ не поддерживаются.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
ccOutboundResource: {
|
|
6
14
|
validatePhoneNumber: ({ linked }: MessageContext) =>
|
|
7
15
|
`Файл содержит некорректные номера. ${linked('validation.phoneNumberSymbolsValidator')}`,
|
package/src/locale/uk/uk.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { MessageContext } from 'vue-i18n';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
backendErrors: {
|
|
5
|
+
sip: {
|
|
6
|
+
gateway: {
|
|
7
|
+
password: {
|
|
8
|
+
invalid:
|
|
9
|
+
"Пароль містить заборонені символи. Зарезервовані символи URI, пробіли, спецсимволи !*'()&$ не підтримуються.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
ccOutboundResource: {
|
|
6
14
|
validatePhoneNumber: ({ linked }: MessageContext) =>
|
|
7
15
|
`Файл містить некоректні номери. ${linked('validation.phoneNumberSymbolsValidator')}`,
|