@webitel/api-services 26.8.78 → 26.8.79
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/agentWorkingConditions/agentWorkingConditions.ts +74 -0
- package/src/api/clients/index.ts +1 -0
- package/src/validations/agent/agent.validations.ts +10 -0
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/agentWorkingConditions/agentWorkingConditions.d.ts +5 -0
- package/types/api/clients/index.d.ts +1 -0
- package/types/validations/agent/agent.validations.d.ts +15 -0
package/package.json
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getAgentWorkingConditionsService } from '../../../gen-wire';
|
|
2
|
+
import {
|
|
3
|
+
applyTransform,
|
|
4
|
+
camelToSnake,
|
|
5
|
+
notify,
|
|
6
|
+
sanitize,
|
|
7
|
+
snakeToCamel,
|
|
8
|
+
} from '../../transformers';
|
|
9
|
+
import type {
|
|
10
|
+
ApiParams,
|
|
11
|
+
GetItemParams,
|
|
12
|
+
UpdateItemParams,
|
|
13
|
+
} from '../_shared/types';
|
|
14
|
+
|
|
15
|
+
const fieldsToSend = [
|
|
16
|
+
'workingCondition',
|
|
17
|
+
'pauseTemplate',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* [Claude] WFM services wrap both request and response payloads in an `item` envelope.
|
|
22
|
+
*/
|
|
23
|
+
const itemResponseHandler = (response: ApiParams) => ({
|
|
24
|
+
...response.item,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const getAgentWorkingConditions = async ({ itemId: id }: GetItemParams) => {
|
|
28
|
+
try {
|
|
29
|
+
const response =
|
|
30
|
+
await getAgentWorkingConditionsService().agentWorkingConditionsServiceReadAgentWorkingConditions(
|
|
31
|
+
String(id),
|
|
32
|
+
);
|
|
33
|
+
return applyTransform(response.data, [
|
|
34
|
+
snakeToCamel(),
|
|
35
|
+
itemResponseHandler,
|
|
36
|
+
]);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
throw applyTransform(err, [
|
|
39
|
+
notify,
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const updateAgentWorkingConditions = async ({
|
|
45
|
+
itemInstance,
|
|
46
|
+
itemId: id,
|
|
47
|
+
}: UpdateItemParams) => {
|
|
48
|
+
const item = applyTransform(itemInstance, [
|
|
49
|
+
sanitize(fieldsToSend),
|
|
50
|
+
camelToSnake(),
|
|
51
|
+
]);
|
|
52
|
+
try {
|
|
53
|
+
const response =
|
|
54
|
+
await getAgentWorkingConditionsService().agentWorkingConditionsServiceUpdateAgentWorkingConditions(
|
|
55
|
+
String(id),
|
|
56
|
+
{
|
|
57
|
+
item,
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
return applyTransform(response.data, [
|
|
61
|
+
snakeToCamel(),
|
|
62
|
+
itemResponseHandler,
|
|
63
|
+
]);
|
|
64
|
+
} catch (err) {
|
|
65
|
+
throw applyTransform(err, [
|
|
66
|
+
notify,
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const AgentWorkingConditionsAPI = {
|
|
72
|
+
get: getAgentWorkingConditions,
|
|
73
|
+
update: updateAgentWorkingConditions,
|
|
74
|
+
};
|
package/src/api/clients/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './agentSkills/agentSkills';
|
|
|
6
6
|
export * from './agents/agentAbsence';
|
|
7
7
|
export * from './agents/agentChats';
|
|
8
8
|
export * from './agents/agents';
|
|
9
|
+
export * from './agentWorkingConditions/agentWorkingConditions';
|
|
9
10
|
export * from './auditForms/auditForms';
|
|
10
11
|
export * from './auditForms/auditRates';
|
|
11
12
|
export * from './backendProfiles/backendProfiles';
|
|
@@ -23,3 +23,13 @@ export const agentSchema = z.object<ZodShape<EngineAgent>>({
|
|
|
23
23
|
screenControl: z.boolean().optional().default(false),
|
|
24
24
|
allowSetScreenControl: z.boolean().optional(),
|
|
25
25
|
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* [Claude] WFM part of the agent card, stored apart from the agent itself
|
|
29
|
+
* (`/wfm/agents/{id}/conditions`). Merge it into {@link agentSchema} only
|
|
30
|
+
* when the user has a WFM license.
|
|
31
|
+
*/
|
|
32
|
+
export const agentWfmConditionsSchema = z.object({
|
|
33
|
+
workingCondition: filledLookupSchema,
|
|
34
|
+
pauseTemplate: flexibleLookupSchema.optional().default({}),
|
|
35
|
+
});
|