@hapl/api-queries 0.2.42 → 0.2.43
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/dist/api-queries.cjs.development.js +4 -1
- package/dist/api-queries.cjs.development.js.map +1 -1
- package/dist/api-queries.cjs.production.min.js +1 -1
- package/dist/api-queries.cjs.production.min.js.map +1 -1
- package/dist/api-queries.esm.js +4 -1
- package/dist/api-queries.esm.js.map +1 -1
- package/dist/clients/v1/api/callTask/createCallTask.d.ts +11 -1
- package/package.json +1 -1
- package/src/clients/v1/api/callTask/createCallTask.ts +3 -3
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
2
|
import { CallTask, CallTaskDirection } from '../../types';
|
|
3
|
-
declare type
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: CallTask;
|
|
6
|
+
meta?: {
|
|
7
|
+
reCaptchaScore: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
declare type ResultData = {
|
|
11
|
+
data: SuccessData['data'];
|
|
12
|
+
meta: SuccessData['meta'];
|
|
13
|
+
};
|
|
4
14
|
declare type ResultError = string;
|
|
5
15
|
export declare type CreateCallTaskHeaders = {
|
|
6
16
|
'x-auth-hc'?: string;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
|
|
2
2
|
import { CallTask, CallTaskDirection } from '../../types';
|
|
3
3
|
|
|
4
|
-
type SuccessData = { success: true; data: CallTask };
|
|
4
|
+
type SuccessData = { success: true; data: CallTask; meta?: { reCaptchaScore: number } };
|
|
5
5
|
type ErrorData = { success: false; data: { error: string } };
|
|
6
6
|
|
|
7
|
-
type ResultData =
|
|
7
|
+
type ResultData = { data: SuccessData['data']; meta: SuccessData['meta'] };
|
|
8
8
|
type ResultError = string;
|
|
9
9
|
|
|
10
10
|
export type CreateCallTaskHeaders = { 'x-auth-hc'?: string };
|
|
@@ -44,7 +44,7 @@ export function createCallTaskRequest({ baseURL = 'https://clients.homeapp.ru',
|
|
|
44
44
|
transformResponse: [
|
|
45
45
|
...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
|
|
46
46
|
(data: SuccessData | ErrorData): ResultData | ResultError => {
|
|
47
|
-
if (data.success) return data.data;
|
|
47
|
+
if (data.success) return { data: data.data, meta: data.meta };
|
|
48
48
|
|
|
49
49
|
return data.data.error;
|
|
50
50
|
},
|