@webitel/api-services 26.12.34 → 26.12.36

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/api-services",
3
- "version": "26.12.34",
3
+ "version": "26.12.36",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,4 @@
1
+ import { isAxiosError } from 'axios';
1
2
  import { getAgentWorkingConditionsService } from '../../../gen-wire';
2
3
  import {
3
4
  applyTransform,
@@ -24,6 +25,11 @@ const itemResponseHandler = (response: ApiParams) => ({
24
25
  ...response.item,
25
26
  });
26
27
 
28
+ const emptyPauseTemplateHandler = (item: ApiParams) => ({
29
+ ...item,
30
+ pauseTemplate: item.pauseTemplate?.id ? item.pauseTemplate : null,
31
+ });
32
+
27
33
  const getAgentWorkingConditions = async ({ itemId: id }: GetItemParams) => {
28
34
  try {
29
35
  const response =
@@ -35,6 +41,7 @@ const getAgentWorkingConditions = async ({ itemId: id }: GetItemParams) => {
35
41
  itemResponseHandler,
36
42
  ]);
37
43
  } catch (err) {
44
+ if (isAxiosError(err) && err.response?.status === 404) return {};
38
45
  throw applyTransform(err, [
39
46
  notify,
40
47
  ]);
@@ -47,6 +54,7 @@ const updateAgentWorkingConditions = async ({
47
54
  }: UpdateItemParams) => {
48
55
  const item = applyTransform(itemInstance, [
49
56
  sanitize(fieldsToSend),
57
+ emptyPauseTemplateHandler,
50
58
  camelToSnake(),
51
59
  ]);
52
60
  try {
@@ -31,5 +31,5 @@ export const agentSchema = z.object<ZodShape<EngineAgent>>({
31
31
  */
32
32
  export const agentWfmConditionsSchema = z.object({
33
33
  workingCondition: filledLookupSchema,
34
- pauseTemplate: flexibleLookupSchema.optional().default({}),
34
+ pauseTemplate: flexibleLookupSchema.optional(),
35
35
  });