@webitel/api-services 26.8.63 → 26.8.65
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/agents/agents.ts +28 -56
- package/src/enums/AgentStatus/AgentStatus.ts +8 -0
- package/src/enums/ChannelState/ChannelState.ts +16 -0
- package/src/enums/ChannelType/ChannelType.ts +10 -0
- package/src/enums/index.ts +6 -0
- package/src/scripts/convertDuration/convertDuration.ts +0 -6
- package/src/utils/formatDate.ts +2 -1
- package/src/validations/agent/__tests__/agent.validations.spec.ts +96 -0
- package/src/validations/agent/agent.validations.ts +25 -0
- package/src/validations/agentSubordinate/__tests__/agentSubordinate.validations.spec.ts +24 -0
- package/src/validations/agentSubordinate/agentSubordinate.validations.ts +7 -0
- package/src/validations/case/__tests__/case.validations.spec.ts +73 -0
- package/src/validations/case/case.validations.ts +36 -29
- package/src/validations/index.ts +2 -0
- package/types/.tsbuildinfo +1 -1
- package/types/enums/AgentStatus/AgentStatus.d.ts +7 -0
- package/types/enums/ChannelState/ChannelState.d.ts +15 -0
- package/types/enums/ChannelType/ChannelType.d.ts +9 -0
- package/types/enums/index.d.ts +4 -1
- package/types/gen-wire/call-service/call-service.zod.d.ts +3 -3
- package/types/gen-wire/case-timeline/case-timeline.zod.d.ts +3 -3
- package/types/gen-wire/routing-schema-service/routing-schema-service.zod.d.ts +11 -11
- package/types/gen-wire/timeline/timeline.zod.d.ts +3 -3
- package/types/gen-wire/trigger-service/trigger-service.zod.d.ts +12 -12
- package/types/utils/formatDate.d.ts +2 -0
- package/types/validations/agent/agent.validations.d.ts +28 -0
- package/types/validations/agentSubordinate/agentSubordinate.validations.d.ts +7 -0
- package/types/validations/case/case.validations.d.ts +3 -1
- package/types/validations/index.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
1
2
|
import { FormatDateMode } from '../../../enums';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import {
|
|
4
|
+
CreateAgentBody,
|
|
5
|
+
getAgentService,
|
|
6
|
+
PatchAgentBody,
|
|
7
|
+
SearchAgentQueryParams,
|
|
8
|
+
SearchUserStatusQueryParams,
|
|
9
|
+
UpdateAgentBody,
|
|
10
|
+
} from '../../../gen-wire';
|
|
7
11
|
import { convertDuration, normalizeDatetimeRange } from '../../../scripts';
|
|
8
12
|
import { formatDate } from '../../../utils';
|
|
9
13
|
import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
|
|
@@ -13,7 +17,7 @@ import {
|
|
|
13
17
|
merge,
|
|
14
18
|
mergeEach,
|
|
15
19
|
notify,
|
|
16
|
-
|
|
20
|
+
sanitizeToWire,
|
|
17
21
|
snakeToCamel,
|
|
18
22
|
starToSearch,
|
|
19
23
|
} from '../../transformers';
|
|
@@ -42,27 +46,9 @@ const getAgentsList = async (params: ApiParams) => {
|
|
|
42
46
|
statusDuration: convertStatusDuration(item.statusDuration),
|
|
43
47
|
}));
|
|
44
48
|
};
|
|
45
|
-
const fieldsToSend =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'q',
|
|
49
|
-
'sort',
|
|
50
|
-
'fields',
|
|
51
|
-
'id',
|
|
52
|
-
'allow_channels',
|
|
53
|
-
'team_id',
|
|
54
|
-
'region_id',
|
|
55
|
-
'auditor_id',
|
|
56
|
-
'skill_id',
|
|
57
|
-
'queue_id',
|
|
58
|
-
'is_supervisor',
|
|
59
|
-
'not_supervisor',
|
|
60
|
-
'user_id',
|
|
61
|
-
'not_team_id',
|
|
62
|
-
'supervisor_id',
|
|
63
|
-
'not_skill_id',
|
|
64
|
-
'not_user_id',
|
|
65
|
-
];
|
|
49
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
50
|
+
SearchAgentQueryParams,
|
|
51
|
+
);
|
|
66
52
|
const requestParams = applyTransform(params, [
|
|
67
53
|
camelToSnake(),
|
|
68
54
|
merge(getDefaultGetParams()),
|
|
@@ -78,7 +64,7 @@ const getAgentsList = async (params: ApiParams) => {
|
|
|
78
64
|
skill_id: params.skill_id ?? params.skill,
|
|
79
65
|
not_supervisor: params.not_supervisor ?? params.is_not_supervisor,
|
|
80
66
|
}),
|
|
81
|
-
|
|
67
|
+
sanitizeToWire(fieldsToSend),
|
|
82
68
|
]);
|
|
83
69
|
|
|
84
70
|
try {
|
|
@@ -138,24 +124,9 @@ const getAgent = async ({
|
|
|
138
124
|
}
|
|
139
125
|
};
|
|
140
126
|
|
|
141
|
-
const fieldsToSend = [
|
|
142
|
-
'user',
|
|
143
|
-
'team',
|
|
144
|
-
'supervisor',
|
|
145
|
-
'auditor',
|
|
146
|
-
'region',
|
|
147
|
-
'greetingMedia',
|
|
148
|
-
'progressiveCount',
|
|
149
|
-
'chatCount',
|
|
150
|
-
'taskCount',
|
|
151
|
-
'isSupervisor',
|
|
152
|
-
'screenControl',
|
|
153
|
-
'extraChatCount',
|
|
154
|
-
];
|
|
155
|
-
|
|
156
127
|
const addAgent = async ({ itemInstance }: AddItemParams) => {
|
|
157
128
|
const item = applyTransform(itemInstance, [
|
|
158
|
-
|
|
129
|
+
sanitizeToWire(getShallowFieldsToSendFromZodSchema(CreateAgentBody)),
|
|
159
130
|
camelToSnake(),
|
|
160
131
|
]);
|
|
161
132
|
try {
|
|
@@ -172,7 +143,7 @@ const addAgent = async ({ itemInstance }: AddItemParams) => {
|
|
|
172
143
|
|
|
173
144
|
const patchAgent = async ({ changes, id }: PatchItemParams) => {
|
|
174
145
|
const body = applyTransform(changes, [
|
|
175
|
-
|
|
146
|
+
sanitizeToWire(getShallowFieldsToSendFromZodSchema(PatchAgentBody)),
|
|
176
147
|
camelToSnake(),
|
|
177
148
|
]);
|
|
178
149
|
try {
|
|
@@ -189,7 +160,7 @@ const patchAgent = async ({ changes, id }: PatchItemParams) => {
|
|
|
189
160
|
|
|
190
161
|
const updateAgent = async ({ itemInstance, itemId: id }: UpdateItemParams) => {
|
|
191
162
|
const item = applyTransform(itemInstance, [
|
|
192
|
-
|
|
163
|
+
sanitizeToWire(getShallowFieldsToSendFromZodSchema(UpdateAgentBody)),
|
|
193
164
|
camelToSnake(),
|
|
194
165
|
]);
|
|
195
166
|
try {
|
|
@@ -380,7 +351,13 @@ const getAgentQueues = async (params: ApiParams) => {
|
|
|
380
351
|
merge(getDefaultGetListResponse()),
|
|
381
352
|
]);
|
|
382
353
|
return {
|
|
383
|
-
items,
|
|
354
|
+
items: applyTransform(items, [
|
|
355
|
+
mergeEach({
|
|
356
|
+
countMembers: 0,
|
|
357
|
+
waitingMembers: 0,
|
|
358
|
+
type: 0,
|
|
359
|
+
}),
|
|
360
|
+
]),
|
|
384
361
|
next,
|
|
385
362
|
};
|
|
386
363
|
} catch (err) {
|
|
@@ -519,14 +496,9 @@ const getAgentUsersOptions = async (params: ApiParams) => {
|
|
|
519
496
|
};
|
|
520
497
|
|
|
521
498
|
const getUsersStatus = async (params: ApiParams) => {
|
|
522
|
-
const fieldsToSend =
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
'q',
|
|
526
|
-
'sort',
|
|
527
|
-
'fields',
|
|
528
|
-
'not_user_id',
|
|
529
|
-
];
|
|
499
|
+
const fieldsToSend = getShallowFieldsToSendFromZodSchema(
|
|
500
|
+
SearchUserStatusQueryParams,
|
|
501
|
+
);
|
|
530
502
|
const requestParams = applyTransform(params, [
|
|
531
503
|
camelToSnake(),
|
|
532
504
|
merge(getDefaultGetParams()),
|
|
@@ -535,7 +507,7 @@ const getUsersStatus = async (params: ApiParams) => {
|
|
|
535
507
|
...params,
|
|
536
508
|
q: params.search,
|
|
537
509
|
}),
|
|
538
|
-
|
|
510
|
+
sanitizeToWire(fieldsToSend),
|
|
539
511
|
]);
|
|
540
512
|
|
|
541
513
|
try {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const ChannelState = {
|
|
2
|
+
Waiting: 'waiting',
|
|
3
|
+
Distribute: 'distribute',
|
|
4
|
+
Offering: 'offering',
|
|
5
|
+
Answered: 'answered',
|
|
6
|
+
Active: 'active',
|
|
7
|
+
Bridged: 'bridged',
|
|
8
|
+
Hold: 'hold',
|
|
9
|
+
Missed: 'missed',
|
|
10
|
+
WrapTime: 'wrap_time',
|
|
11
|
+
Processing: 'processing',
|
|
12
|
+
Transfer: 'transfer',
|
|
13
|
+
Form: 'form',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type ChannelState = (typeof ChannelState)[keyof typeof ChannelState];
|
package/src/enums/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { AgentStatus } from './AgentStatus/AgentStatus';
|
|
1
2
|
import { CallReportingStatus } from './CallReportingStatus/CallReportingStatus';
|
|
3
|
+
import { ChannelState } from './ChannelState/ChannelState';
|
|
4
|
+
import { ChannelType } from './ChannelType/ChannelType';
|
|
2
5
|
import { ChatGatewayProvider } from './ChatGatewayProvider/ChatGatewayPrivider';
|
|
3
6
|
import { FormatDateMode } from './FormatDateMode/FormatDateMode';
|
|
4
7
|
import { MemberStopCause } from './MemberStopCause/MemberStopCause';
|
|
@@ -15,7 +18,10 @@ import { UrlProtocol } from './UrlProtocol/UrlProtocol';
|
|
|
15
18
|
import { UserPresenceStatus } from './UserPresenceStatus/UserPresenceStatus';
|
|
16
19
|
|
|
17
20
|
export {
|
|
21
|
+
AgentStatus,
|
|
18
22
|
CallReportingStatus,
|
|
23
|
+
ChannelState,
|
|
24
|
+
ChannelType,
|
|
19
25
|
ChatGatewayProvider,
|
|
20
26
|
FormatDateMode,
|
|
21
27
|
MemberStopCause,
|
package/src/utils/formatDate.ts
CHANGED
|
@@ -11,7 +11,8 @@ import type { FormatDateMode } from '../enums/FormatDateMode/FormatDateMode';
|
|
|
11
11
|
*/
|
|
12
12
|
const TIMEZONE_STORAGE_KEY = 'user-timezone-setting';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/** The operator's chosen time zone, falling back to the browser's. */
|
|
15
|
+
export function getUserTimeZone(): string {
|
|
15
16
|
return (
|
|
16
17
|
localStorage.getItem(TIMEZONE_STORAGE_KEY) ||
|
|
17
18
|
Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { getDefaultsFromZodSchema } from '@webitel/api-services/gen/utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { agentSchema } from '../agent.validations';
|
|
5
|
+
|
|
6
|
+
const filledAgent = {
|
|
7
|
+
user: {
|
|
8
|
+
id: '1',
|
|
9
|
+
name: 'John',
|
|
10
|
+
},
|
|
11
|
+
team: {
|
|
12
|
+
id: 2,
|
|
13
|
+
name: 'Support',
|
|
14
|
+
},
|
|
15
|
+
chatCount: 1,
|
|
16
|
+
taskCount: 1,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const issuePaths = (value: Record<string, unknown>) =>
|
|
20
|
+
agentSchema
|
|
21
|
+
.safeParse(value)
|
|
22
|
+
.error?.issues.map((issue) => issue.path.join('.')) ?? [];
|
|
23
|
+
|
|
24
|
+
describe('agentSchema', () => {
|
|
25
|
+
it('seeds a new agent with the defaults the form expects', () => {
|
|
26
|
+
expect(getDefaultsFromZodSchema(agentSchema, {})).toMatchObject({
|
|
27
|
+
supervisor: [],
|
|
28
|
+
auditor: [],
|
|
29
|
+
region: {},
|
|
30
|
+
greetingMedia: {},
|
|
31
|
+
progressiveCount: null,
|
|
32
|
+
chatCount: 1,
|
|
33
|
+
taskCount: 1,
|
|
34
|
+
extraChatCount: 0,
|
|
35
|
+
isSupervisor: false,
|
|
36
|
+
screenControl: false,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('requires a user and a team', () => {
|
|
41
|
+
const paths = issuePaths({
|
|
42
|
+
user: {},
|
|
43
|
+
team: {},
|
|
44
|
+
chatCount: 1,
|
|
45
|
+
taskCount: 1,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
expect(paths).toContain('user');
|
|
49
|
+
expect(paths).toContain('team');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('requires chat and task counts of at least 1', () => {
|
|
53
|
+
const paths = issuePaths({
|
|
54
|
+
...filledAgent,
|
|
55
|
+
chatCount: 0,
|
|
56
|
+
taskCount: null,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(paths).toContain('chatCount');
|
|
60
|
+
expect(paths).toContain('taskCount');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('accepts an emptied progressive count, rejects one below 1', () => {
|
|
64
|
+
expect(
|
|
65
|
+
issuePaths({
|
|
66
|
+
...filledAgent,
|
|
67
|
+
progressiveCount: null,
|
|
68
|
+
}),
|
|
69
|
+
).not.toContain('progressiveCount');
|
|
70
|
+
expect(
|
|
71
|
+
issuePaths({
|
|
72
|
+
...filledAgent,
|
|
73
|
+
progressiveCount: 0,
|
|
74
|
+
}),
|
|
75
|
+
).toContain('progressiveCount');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('accepts an emptied extra chat count, rejects a negative one', () => {
|
|
79
|
+
expect(
|
|
80
|
+
issuePaths({
|
|
81
|
+
...filledAgent,
|
|
82
|
+
extraChatCount: null,
|
|
83
|
+
}),
|
|
84
|
+
).not.toContain('extraChatCount');
|
|
85
|
+
expect(
|
|
86
|
+
issuePaths({
|
|
87
|
+
...filledAgent,
|
|
88
|
+
extraChatCount: -1,
|
|
89
|
+
}),
|
|
90
|
+
).toContain('extraChatCount');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('accepts a valid agent', () => {
|
|
94
|
+
expect(agentSchema.safeParse(filledAgent).success).toBe(true);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EngineAgent } from '@webitel/api-services/gen/models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
filledLookupSchema,
|
|
6
|
+
flexibleLookupSchema,
|
|
7
|
+
} from '../_shared/lookup.validations';
|
|
8
|
+
import type { ZodShape } from '../types';
|
|
9
|
+
|
|
10
|
+
export const agentSchema = z.object<ZodShape<EngineAgent>>({
|
|
11
|
+
id: z.string().optional(),
|
|
12
|
+
user: filledLookupSchema,
|
|
13
|
+
team: filledLookupSchema,
|
|
14
|
+
supervisor: z.array(flexibleLookupSchema).optional().default([]),
|
|
15
|
+
auditor: z.array(flexibleLookupSchema).optional().default([]),
|
|
16
|
+
region: flexibleLookupSchema.optional().default({}),
|
|
17
|
+
greetingMedia: flexibleLookupSchema.optional().default({}),
|
|
18
|
+
progressiveCount: z.number().min(1).nullable().optional().default(null),
|
|
19
|
+
chatCount: z.number().min(1).default(1),
|
|
20
|
+
taskCount: z.number().min(1).default(1),
|
|
21
|
+
extraChatCount: z.number().min(0).nullable().optional().default(0),
|
|
22
|
+
isSupervisor: z.boolean().optional().default(false),
|
|
23
|
+
screenControl: z.boolean().optional().default(false),
|
|
24
|
+
allowSetScreenControl: z.boolean().optional(),
|
|
25
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { agentSubordinateSchema } from '../agentSubordinate.validations';
|
|
4
|
+
|
|
5
|
+
describe('agentSubordinateSchema', () => {
|
|
6
|
+
it('requires an agent', () => {
|
|
7
|
+
expect(
|
|
8
|
+
agentSubordinateSchema.safeParse({
|
|
9
|
+
agent: {},
|
|
10
|
+
}).success,
|
|
11
|
+
).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('accepts a picked agent', () => {
|
|
15
|
+
expect(
|
|
16
|
+
agentSubordinateSchema.safeParse({
|
|
17
|
+
agent: {
|
|
18
|
+
id: '1',
|
|
19
|
+
name: 'John',
|
|
20
|
+
},
|
|
21
|
+
}).success,
|
|
22
|
+
).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { filledLookupSchema } from '../../_shared/lookup.validations';
|
|
5
|
+
import { caseCloseFieldsChecks, caseSchema } from '../case.validations';
|
|
6
|
+
|
|
7
|
+
const schema = caseSchema
|
|
8
|
+
.extend({
|
|
9
|
+
source: filledLookupSchema,
|
|
10
|
+
service: filledLookupSchema,
|
|
11
|
+
})
|
|
12
|
+
.check(...caseCloseFieldsChecks);
|
|
13
|
+
|
|
14
|
+
const issuePaths = (value: unknown) =>
|
|
15
|
+
schema.safeParse(value).error?.issues.map(({ path }) => path.join('.')) ?? [];
|
|
16
|
+
|
|
17
|
+
describe('caseCloseFieldsChecks', () => {
|
|
18
|
+
const finalStatusCondition = {
|
|
19
|
+
id: '6',
|
|
20
|
+
name: 'Closed',
|
|
21
|
+
final: true,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
it('requires close fields on a final case while other fields are still unset', () => {
|
|
25
|
+
const paths = issuePaths({
|
|
26
|
+
statusCondition: finalStatusCondition,
|
|
27
|
+
closeReason: null,
|
|
28
|
+
closeResult: '',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(paths).toEqual(
|
|
32
|
+
expect.arrayContaining([
|
|
33
|
+
'source',
|
|
34
|
+
'service',
|
|
35
|
+
'closeReason',
|
|
36
|
+
'closeResult',
|
|
37
|
+
]),
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('points an empty close reason object at its id', () => {
|
|
42
|
+
expect(
|
|
43
|
+
issuePaths({
|
|
44
|
+
statusCondition: finalStatusCondition,
|
|
45
|
+
closeReason: {},
|
|
46
|
+
closeResult: 'a result',
|
|
47
|
+
}),
|
|
48
|
+
).toContain('closeReason.id');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('does not require close fields on a non-final case', () => {
|
|
52
|
+
const paths = issuePaths({
|
|
53
|
+
statusCondition: {
|
|
54
|
+
id: '5',
|
|
55
|
+
name: 'New',
|
|
56
|
+
initial: true,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(paths).not.toContain('closeReason');
|
|
61
|
+
expect(paths).not.toContain('closeResult');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('does not throw when the parsed value is not an object', () => {
|
|
65
|
+
expect(() => schema.safeParse(undefined)).not.toThrow();
|
|
66
|
+
expect(() =>
|
|
67
|
+
z
|
|
68
|
+
.object({})
|
|
69
|
+
.check(...caseCloseFieldsChecks)
|
|
70
|
+
.safeParse(null),
|
|
71
|
+
).not.toThrow();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -33,35 +33,42 @@ export const caseSchema = z.object({
|
|
|
33
33
|
closeResult: z.string().default(''),
|
|
34
34
|
} satisfies Partial<Record<keyof WebitelCasesCase, z.ZodType>>);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>,
|
|
41
|
-
ctx: z.RefinementCtx,
|
|
42
|
-
) => {
|
|
43
|
-
if (!data.statusCondition?.final) return;
|
|
36
|
+
type CaseCloseFields = Pick<
|
|
37
|
+
z.infer<typeof caseSchema>,
|
|
38
|
+
'statusCondition' | 'closeReason' | 'closeResult'
|
|
39
|
+
>;
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'closeReason',
|
|
55
|
-
],
|
|
41
|
+
const requiredOnFinalCase = (
|
|
42
|
+
isFilled: (data: CaseCloseFields) => boolean,
|
|
43
|
+
path: string[],
|
|
44
|
+
) =>
|
|
45
|
+
z.refine<CaseCloseFields>(
|
|
46
|
+
(data) => !data?.statusCondition?.final || isFilled(data),
|
|
47
|
+
{
|
|
48
|
+
path,
|
|
49
|
+
when: () => true,
|
|
56
50
|
...i18nIssue('required'),
|
|
57
|
-
}
|
|
51
|
+
},
|
|
52
|
+
);
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
export const caseCloseFieldsChecks = [
|
|
55
|
+
requiredOnFinalCase(
|
|
56
|
+
(data) => Boolean(data.closeReason),
|
|
57
|
+
[
|
|
58
|
+
'closeReason',
|
|
59
|
+
],
|
|
60
|
+
),
|
|
61
|
+
requiredOnFinalCase(
|
|
62
|
+
(data) => !data.closeReason || Boolean(data.closeReason.id),
|
|
63
|
+
[
|
|
64
|
+
'closeReason',
|
|
65
|
+
'id',
|
|
66
|
+
],
|
|
67
|
+
),
|
|
68
|
+
requiredOnFinalCase(
|
|
69
|
+
(data) => Boolean(data.closeResult),
|
|
70
|
+
[
|
|
71
|
+
'closeResult',
|
|
72
|
+
],
|
|
73
|
+
),
|
|
74
|
+
];
|
package/src/validations/index.ts
CHANGED
|
@@ -5,8 +5,10 @@ export * from './_shared/lookup.validations';
|
|
|
5
5
|
export * from './_shared/phoneNumber.validations';
|
|
6
6
|
export * from './_shared/variablePair.validations';
|
|
7
7
|
export * from './adjunctType/adjunctType.validations';
|
|
8
|
+
export * from './agent/agent.validations';
|
|
8
9
|
export * from './agentPauseCause/agentPauseCause.validations';
|
|
9
10
|
export * from './agentSkill/agentSkill.validations';
|
|
11
|
+
export * from './agentSubordinate/agentSubordinate.validations';
|
|
10
12
|
export * from './auditForm/auditForm.validations';
|
|
11
13
|
export * from './bucket/bucket.validations';
|
|
12
14
|
export * from './calendar/calendar.validations';
|