@webitel/api-services 0.0.60 → 0.0.62

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": "0.0.60",
3
+ "version": "0.0.62",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm run gen:api && npm version patch && (npm run build:types || true) && (npm run format:all || true) && npm run publish-lib",
@@ -0,0 +1,59 @@
1
+ import { getCallService } from '@webitel/api-services/gen';
2
+ import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
3
+ import {
4
+ applyTransform,
5
+ camelToSnake,
6
+ merge,
7
+ notify,
8
+ snakeToCamel,
9
+ starToSearch,
10
+ } from '../../transformers';
11
+
12
+ const getCallHistoryList = async ({ options, ...params }) => {
13
+ const listParams = applyTransform(params, [
14
+ merge(getDefaultGetParams()),
15
+ starToSearch('search'),
16
+ ]);
17
+ try {
18
+ const response = await getCallService().searchHistoryCall(
19
+ listParams,
20
+ options,
21
+ );
22
+ const { items, next } = applyTransform(response.data, [
23
+ snakeToCamel(),
24
+ merge(getDefaultGetListResponse()),
25
+ ]);
26
+ return { items, next };
27
+ } catch (err) {
28
+ throw applyTransform(err, [notify]);
29
+ }
30
+ };
31
+
32
+ const getCallHistoryListPost = async ({ data, options }) => {
33
+ const body = applyTransform(data, [camelToSnake()]);
34
+ try {
35
+ const response = await getCallService().searchHistoryCallPost(
36
+ body,
37
+ options,
38
+ );
39
+ const { items, next } = applyTransform(response.data, [
40
+ snakeToCamel(),
41
+ merge(getDefaultGetListResponse()),
42
+ ]);
43
+ return { items, next };
44
+ } catch (err) {
45
+ throw applyTransform(err, [notify]);
46
+ }
47
+ };
48
+
49
+ const getCallHistoryLookup = (params) =>
50
+ getCallHistoryList({
51
+ ...params,
52
+ fields: params?.fields || ['id', 'destination', 'state', 'created_at'],
53
+ });
54
+
55
+ export const CallHistoryAPI = {
56
+ getList: getCallHistoryList,
57
+ getListPost: getCallHistoryListPost,
58
+ getLookup: getCallHistoryLookup,
59
+ };
@@ -3,6 +3,7 @@ export * from './agents/agentChats';
3
3
  export * from './agents/agents';
4
4
  export * from './buckets/buckets';
5
5
  export * from './calendars/calendars';
6
+ export * from './callHistory/callHistory';
6
7
  export * from './caseCloseReasonGroups/caseCloseReasonGroups';
7
8
  export * from './caseCloseReasons/caseCloseReasons';
8
9
  export * from './casePriorities/casePriorities';
@@ -70,12 +70,14 @@ export const downloadMedia = async (id) => {
70
70
  };
71
71
 
72
72
  export const downloadFile = (id) => {
73
- const url = `${baseUrl}/storage/file/${id}/download?access_token=${token}`;
73
+ const accessToken = localStorage.getItem('access-token'); // after auth token variable is null
74
+ const url = `${baseUrl}/storage/file/${id}/download?access_token=${accessToken}`;
74
75
  window.open(url, '_blank');
75
76
  };
76
77
 
77
78
  export const getScreenRecordingMediaUrl = (id, isThumb = false) => {
78
- const url = `${baseUrl}/storage/file/${id}/stream?access_token=${token}&fetch_thumbnail=${isThumb}`;
79
+ const accessToken = localStorage.getItem('access-token'); // after auth token variable is null
80
+ const url = `${baseUrl}/storage/file/${id}/stream?access_token=${accessToken}&fetch_thumbnail=${isThumb}`;
79
81
  return url;
80
82
  };
81
83
 
@@ -43,7 +43,8 @@ const getAdjunctTypesList = async (
43
43
  next,
44
44
  };
45
45
  } catch (err) {
46
- throw applyTransform(err, [notify]);
46
+ const errTransformers = silent ? [] : [notify];
47
+ throw applyTransform(err, errTransformers);
47
48
  }
48
49
  };
49
50
 
@@ -0,0 +1,20 @@
1
+ export declare const CallHistoryAPI: {
2
+ getList: ({ options, ...params }: {
3
+ [x: string]: any;
4
+ options: any;
5
+ }) => Promise<{
6
+ items: any;
7
+ next: any;
8
+ }>;
9
+ getListPost: ({ data, options }: {
10
+ data: any;
11
+ options: any;
12
+ }) => Promise<{
13
+ items: any;
14
+ next: any;
15
+ }>;
16
+ getLookup: (params: any) => Promise<{
17
+ items: any;
18
+ next: any;
19
+ }>;
20
+ };
@@ -2,6 +2,7 @@ export * from './_shared/generatePermissionsApi';
2
2
  export * from './agents/agentChats';
3
3
  export * from './agents/agents';
4
4
  export * from './buckets/buckets';
5
+ export * from './callHistory/callHistory';
5
6
  export * from './calendars/calendars';
6
7
  export * from './caseCloseReasonGroups/caseCloseReasonGroups';
7
8
  export * from './caseCloseReasons/caseCloseReasons';
@@ -22,6 +23,7 @@ export * from './history/transcript/callTranscript';
22
23
  export * from './labels/labels';
23
24
  export * from './lists/blacklists';
24
25
  export * from './media/media';
26
+ export * from './messageService/messageService';
25
27
  export * from './object/object';
26
28
  export * from './pdfServices/pdfServices';
27
29
  export * from './phones/phones';
@@ -35,4 +37,3 @@ export * from './wtTypes/adjunctTypes/adjunctTypes';
35
37
  export * from './wtTypes/sysTypes/sysTypes';
36
38
  export * from './wtTypes/typeExtensions/typeExtensions';
37
39
  export * from './сontacts';
38
- export * from './messageService/messageService';