@hapl/api-queries 0.1.140 → 0.1.141
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/CHANGELOG.md +12 -0
- package/dist/api-queries.cjs.development.js +81 -0
- 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 +81 -0
- package/dist/api-queries.esm.js.map +1 -1
- package/dist/clients/v1/api/buyer/callbackBuyer/index.d.ts +29 -0
- package/dist/clients/v1/api/buyer/findBuyerClosingReason/index.d.ts +21 -0
- package/dist/clients/v1/api/buyer/findBuyers/index.d.ts +3 -1
- package/dist/clients/v1/api/index.d.ts +2 -0
- package/dist/clients/v1/index.d.ts +2 -0
- package/dist/clients/v1/types/Buyer.d.ts +10 -0
- package/dist/clients/v1/types/BuyerClosingReason.d.ts +13 -0
- package/dist/clients/v1/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/clients/v1/api/buyer/callbackBuyer/index.ts +42 -0
- package/src/clients/v1/api/buyer/findBuyerClosingReason/index.ts +49 -0
- package/src/clients/v1/api/buyer/findBuyers/index.ts +3 -1
- package/src/clients/v1/api/index.ts +2 -0
- package/src/clients/v1/index.ts +8 -0
- package/src/clients/v1/types/Buyer.ts +11 -0
- package/src/clients/v1/types/BuyerClosingReason.ts +14 -0
- package/src/clients/v1/types/index.ts +1 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { Call } from '../../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: Call;
|
|
6
|
+
};
|
|
7
|
+
declare type ErrorData = {
|
|
8
|
+
success: false;
|
|
9
|
+
data: {
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare type ResultData = SuccessData['data'];
|
|
14
|
+
declare type ResultError = ErrorData['data']['error'];
|
|
15
|
+
export declare type CallbackBuyerUrlParams = {
|
|
16
|
+
id: number;
|
|
17
|
+
};
|
|
18
|
+
export declare type CallbackBuyerHeaders = {
|
|
19
|
+
'x-auth-hc': string;
|
|
20
|
+
};
|
|
21
|
+
export declare type CallbackBuyerData = AxiosResponse<ResultData>;
|
|
22
|
+
export declare type CallbackBuyerError = AxiosError<ResultError>;
|
|
23
|
+
export declare type CallbackBuyerConfig = {
|
|
24
|
+
baseURL?: string;
|
|
25
|
+
urlParams: CallbackBuyerUrlParams;
|
|
26
|
+
headers: CallbackBuyerHeaders;
|
|
27
|
+
};
|
|
28
|
+
export declare function callbackBuyerRequest({ baseURL, urlParams, headers, }: CallbackBuyerConfig): Promise<CallbackBuyerData>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { BuyerClosingReason } from '../../../types';
|
|
3
|
+
declare type ResultData = {
|
|
4
|
+
ids: string[];
|
|
5
|
+
byId: Record<string, BuyerClosingReason>;
|
|
6
|
+
meta: {
|
|
7
|
+
total: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
declare type ResultError = string;
|
|
11
|
+
export declare type FindBuyerClosingReasonHeaders = {
|
|
12
|
+
'x-auth-hc': string;
|
|
13
|
+
};
|
|
14
|
+
export declare type FindBuyerClosingReasonData = AxiosResponse<ResultData>;
|
|
15
|
+
export declare type FindBuyerClosingReasonError = AxiosError<ResultError>;
|
|
16
|
+
export declare type FindBuyerClosingReasonConfig = {
|
|
17
|
+
baseURL?: string;
|
|
18
|
+
headers: FindBuyerClosingReasonHeaders;
|
|
19
|
+
};
|
|
20
|
+
export declare function findBuyerClosingReasonRequest({ baseURL, headers, }: FindBuyerClosingReasonConfig): Promise<FindBuyerClosingReasonData>;
|
|
21
|
+
export {};
|
|
@@ -14,15 +14,17 @@ export declare type FindBuyersHeaders = {
|
|
|
14
14
|
export declare type FindBuyersParams = {
|
|
15
15
|
filter?: {
|
|
16
16
|
'serviceRequest.id'?: number;
|
|
17
|
+
query?: string;
|
|
17
18
|
};
|
|
18
19
|
limits?: {
|
|
19
20
|
page: number;
|
|
20
21
|
count: number | 'all';
|
|
21
22
|
};
|
|
22
|
-
|
|
23
|
+
sorting?: {
|
|
23
24
|
type: 'createdAt';
|
|
24
25
|
direction: 'asc' | 'desc';
|
|
25
26
|
};
|
|
27
|
+
include?: Array<'sharing.fromExpert'>;
|
|
26
28
|
};
|
|
27
29
|
export declare type FindBuyersData = AxiosResponse<ResultData>;
|
|
28
30
|
export declare type FindBuyersError = AxiosError<ResultError>;
|
|
@@ -8,7 +8,9 @@ export * from './availableFunds/deleteAvailableFunds';
|
|
|
8
8
|
export * from './bill/createBill';
|
|
9
9
|
export * from './bill/findBills';
|
|
10
10
|
export * from './buyer/countBuyers';
|
|
11
|
+
export * from './buyer/callbackBuyer';
|
|
11
12
|
export * from './buyer/findBuyers';
|
|
13
|
+
export * from './buyer/findBuyerClosingReason';
|
|
12
14
|
export * from './call/findCalls';
|
|
13
15
|
export * from './call/findFirstSuccessOutgoingCalls';
|
|
14
16
|
export * from './call/markupCall';
|
|
@@ -11,8 +11,10 @@ export declare class Api {
|
|
|
11
11
|
deleteAvailableFunds: (urlParams: api.DeleteAvailableFundsUrlParams, headers: api.DeleteAvailableFundsHeaders) => Promise<api.DeleteAvailableFundsData>;
|
|
12
12
|
createBill: (body: api.CreateBillBody, headers: api.CreateBillHeaders) => Promise<api.CreateBillData>;
|
|
13
13
|
findBills: (params: api.FindBillsParams, headers: api.FindBillsHeaders) => Promise<api.FindBillsData>;
|
|
14
|
+
callbackBuyer: (urlParams: api.CallbackBuyerUrlParams, headers: api.CallbackBuyerHeaders) => Promise<api.CallbackBuyerData>;
|
|
14
15
|
countBuyers: (params: api.CountBuyersParams, headers: api.CountBuyersHeaders) => Promise<api.CountBuyersData>;
|
|
15
16
|
findBuyers: (params: api.FindBuyersParams, headers: api.FindBuyersHeaders) => Promise<api.FindBuyersData>;
|
|
17
|
+
findBuyerClosingReason: (headers: api.FindBuyerClosingReasonHeaders) => Promise<api.FindBuyerClosingReasonData>;
|
|
16
18
|
findCalls: (params: api.FindCallsParams, headers: api.FindCallsHeaders) => Promise<api.FindCallsData>;
|
|
17
19
|
findFirstSuccessOutgoingCalls: (params: api.FindFirstSuccessOutgoingCallsParams, headers: api.FindFirstSuccessOutgoingCallsHeaders) => Promise<api.FindFirstSuccessOutgoingCallsData>;
|
|
18
20
|
markupCall: (body: api.MarkupCallBody, headers: api.MarkupCallHeaders) => Promise<api.MarkupCallData>;
|
|
@@ -14,6 +14,10 @@ export declare enum BuyerRealtyShowStatus {
|
|
|
14
14
|
Cancelled = "cancelled",
|
|
15
15
|
Complete = "complete"
|
|
16
16
|
}
|
|
17
|
+
export declare enum BuyerQuestionType {
|
|
18
|
+
RejectionReason = "rejection-reason",
|
|
19
|
+
AdditionalServices = "additional-services"
|
|
20
|
+
}
|
|
17
21
|
export declare type Buyer = {
|
|
18
22
|
createdAt: string;
|
|
19
23
|
id: number;
|
|
@@ -23,6 +27,12 @@ export declare type Buyer = {
|
|
|
23
27
|
serviceRequests: Array<Partial<ServiceRequest> & Required<Pick<ServiceRequest, 'id'>>>;
|
|
24
28
|
status: BuyerStatus;
|
|
25
29
|
closedAt?: string;
|
|
30
|
+
closingQuestionaryAnswers?: Array<{
|
|
31
|
+
answerId: string;
|
|
32
|
+
questionId: string;
|
|
33
|
+
questionType: BuyerQuestionType;
|
|
34
|
+
comment?: string;
|
|
35
|
+
}>;
|
|
26
36
|
comment?: string;
|
|
27
37
|
offer?: string;
|
|
28
38
|
realtyShow?: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare type BuyerClosingAnswer = {
|
|
2
|
+
createdAt: string;
|
|
3
|
+
id: string;
|
|
4
|
+
isCommentingEnabled: boolean;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type BuyerClosingReason = {
|
|
8
|
+
createdAt: string;
|
|
9
|
+
id: string;
|
|
10
|
+
isRequired: boolean;
|
|
11
|
+
question: string;
|
|
12
|
+
answer: Array<BuyerClosingAnswer>;
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
|
|
2
|
+
import { Call } from '../../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: Call };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type CallbackBuyerUrlParams = { id: number };
|
|
11
|
+
export type CallbackBuyerHeaders = { 'x-auth-hc': string };
|
|
12
|
+
export type CallbackBuyerData = AxiosResponse<ResultData>;
|
|
13
|
+
export type CallbackBuyerError = AxiosError<ResultError>;
|
|
14
|
+
export type CallbackBuyerConfig = {
|
|
15
|
+
baseURL?: string;
|
|
16
|
+
urlParams: CallbackBuyerUrlParams;
|
|
17
|
+
headers: CallbackBuyerHeaders;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function callbackBuyerRequest({
|
|
21
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
22
|
+
urlParams,
|
|
23
|
+
headers,
|
|
24
|
+
}: CallbackBuyerConfig) {
|
|
25
|
+
return axios
|
|
26
|
+
.post(
|
|
27
|
+
`/api/buyer/callback/${urlParams.id}`,
|
|
28
|
+
{},
|
|
29
|
+
{
|
|
30
|
+
baseURL,
|
|
31
|
+
headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
|
|
32
|
+
transformResponse: [
|
|
33
|
+
...(axios.defaults.transformResponse as AxiosTransformer[]),
|
|
34
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
|
|
35
|
+
],
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
.then((res: CallbackBuyerData) => res)
|
|
39
|
+
.catch((err: CallbackBuyerError) => {
|
|
40
|
+
throw err;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
|
|
2
|
+
import { BuyerClosingReason } from '../../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: BuyerClosingReason[] };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = { ids: string[]; byId: Record<string, BuyerClosingReason>; meta: { total: number } };
|
|
8
|
+
type ResultError = string;
|
|
9
|
+
|
|
10
|
+
export type FindBuyerClosingReasonHeaders = { 'x-auth-hc': string };
|
|
11
|
+
export type FindBuyerClosingReasonData = AxiosResponse<ResultData>;
|
|
12
|
+
export type FindBuyerClosingReasonError = AxiosError<ResultError>;
|
|
13
|
+
export type FindBuyerClosingReasonConfig = {
|
|
14
|
+
baseURL?: string;
|
|
15
|
+
headers: FindBuyerClosingReasonHeaders;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function findBuyerClosingReasonRequest({
|
|
19
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
20
|
+
headers,
|
|
21
|
+
}: FindBuyerClosingReasonConfig) {
|
|
22
|
+
return axios
|
|
23
|
+
.get('/api/buyer/closing-reason', {
|
|
24
|
+
baseURL,
|
|
25
|
+
headers: { Accept: 'application/json', ...headers },
|
|
26
|
+
transformResponse: [
|
|
27
|
+
...(axios.defaults.transformResponse as AxiosTransformer[]),
|
|
28
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => {
|
|
29
|
+
if (data.success) {
|
|
30
|
+
const ids: ResultData['ids'] = [];
|
|
31
|
+
const byId: ResultData['byId'] = {};
|
|
32
|
+
|
|
33
|
+
data.data.forEach(entity => {
|
|
34
|
+
byId[entity.id] = entity;
|
|
35
|
+
ids.push(entity.id);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return { ids, byId, meta: { total: ids.length } };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return data.data.error;
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
})
|
|
45
|
+
.then((res: FindBuyerClosingReasonData) => res)
|
|
46
|
+
.catch((err: FindBuyerClosingReasonError) => {
|
|
47
|
+
throw err;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -12,15 +12,17 @@ export type FindBuyersHeaders = { 'x-auth-hc': string };
|
|
|
12
12
|
export type FindBuyersParams = {
|
|
13
13
|
filter?: {
|
|
14
14
|
'serviceRequest.id'?: number;
|
|
15
|
+
query?: string;
|
|
15
16
|
};
|
|
16
17
|
limits?: {
|
|
17
18
|
page: number;
|
|
18
19
|
count: number | 'all';
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
+
sorting?: {
|
|
21
22
|
type: 'createdAt';
|
|
22
23
|
direction: 'asc' | 'desc';
|
|
23
24
|
};
|
|
25
|
+
include?: Array<'sharing.fromExpert'>;
|
|
24
26
|
};
|
|
25
27
|
export type FindBuyersData = AxiosResponse<ResultData>;
|
|
26
28
|
export type FindBuyersError = AxiosError<ResultError>;
|
|
@@ -11,7 +11,9 @@ export * from './bill/createBill';
|
|
|
11
11
|
export * from './bill/findBills';
|
|
12
12
|
|
|
13
13
|
export * from './buyer/countBuyers';
|
|
14
|
+
export * from './buyer/callbackBuyer';
|
|
14
15
|
export * from './buyer/findBuyers';
|
|
16
|
+
export * from './buyer/findBuyerClosingReason';
|
|
15
17
|
|
|
16
18
|
export * from './call/findCalls';
|
|
17
19
|
export * from './call/findFirstSuccessOutgoingCalls';
|
package/src/clients/v1/index.ts
CHANGED
|
@@ -51,6 +51,10 @@ export class Api {
|
|
|
51
51
|
|
|
52
52
|
// buyer
|
|
53
53
|
|
|
54
|
+
callbackBuyer = (urlParams: api.CallbackBuyerUrlParams, headers: api.CallbackBuyerHeaders) => {
|
|
55
|
+
return api.callbackBuyerRequest({ urlParams, headers, baseURL: this.baseURL });
|
|
56
|
+
};
|
|
57
|
+
|
|
54
58
|
countBuyers = (params: api.CountBuyersParams, headers: api.CountBuyersHeaders) => {
|
|
55
59
|
return api.countBuyersRequest({ params, headers, baseURL: this.baseURL });
|
|
56
60
|
};
|
|
@@ -59,6 +63,10 @@ export class Api {
|
|
|
59
63
|
return api.findBuyersRequest({ params, headers, baseURL: this.baseURL });
|
|
60
64
|
};
|
|
61
65
|
|
|
66
|
+
findBuyerClosingReason = (headers: api.FindBuyerClosingReasonHeaders) => {
|
|
67
|
+
return api.findBuyerClosingReasonRequest({ headers, baseURL: this.baseURL });
|
|
68
|
+
};
|
|
69
|
+
|
|
62
70
|
// call
|
|
63
71
|
|
|
64
72
|
findCalls = (params: api.FindCallsParams, headers: api.FindCallsHeaders) => {
|
|
@@ -17,6 +17,11 @@ export enum BuyerRealtyShowStatus {
|
|
|
17
17
|
Complete = 'complete',
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
export enum BuyerQuestionType {
|
|
21
|
+
RejectionReason = 'rejection-reason',
|
|
22
|
+
AdditionalServices = 'additional-services',
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
export type Buyer = {
|
|
21
26
|
createdAt: string;
|
|
22
27
|
id: number;
|
|
@@ -27,6 +32,12 @@ export type Buyer = {
|
|
|
27
32
|
status: BuyerStatus;
|
|
28
33
|
|
|
29
34
|
closedAt?: string;
|
|
35
|
+
closingQuestionaryAnswers?: Array<{
|
|
36
|
+
answerId: string;
|
|
37
|
+
questionId: string;
|
|
38
|
+
questionType: BuyerQuestionType;
|
|
39
|
+
comment?: string;
|
|
40
|
+
}>;
|
|
30
41
|
comment?: string;
|
|
31
42
|
offer?: string;
|
|
32
43
|
realtyShow?: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type BuyerClosingAnswer = {
|
|
2
|
+
createdAt: string;
|
|
3
|
+
id: string;
|
|
4
|
+
isCommentingEnabled: boolean;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type BuyerClosingReason = {
|
|
9
|
+
createdAt: string;
|
|
10
|
+
id: string;
|
|
11
|
+
isRequired: boolean;
|
|
12
|
+
question: string;
|
|
13
|
+
answer: Array<BuyerClosingAnswer>;
|
|
14
|
+
};
|