@hapl/api-queries 0.2.13 → 0.2.14--canary.134.eee23e4.0

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +0 -12
  2. package/dist/api-queries.cjs.development.js +3352 -1636
  3. package/dist/api-queries.cjs.development.js.map +1 -1
  4. package/dist/api-queries.cjs.production.min.js +1 -1
  5. package/dist/api-queries.cjs.production.min.js.map +1 -1
  6. package/dist/api-queries.esm.js +3352 -1636
  7. package/dist/api-queries.esm.js.map +1 -1
  8. package/dist/clients/v1/api/buyer/closeBuyer/index.d.ts +37 -0
  9. package/dist/clients/v1/api/buyer/findBuyerById/index.d.ts +33 -0
  10. package/dist/clients/v1/api/buyer/findBuyerStatuses/index.d.ts +36 -0
  11. package/dist/clients/v1/api/buyer/findBuyerUniquePhones/index.d.ts +23 -0
  12. package/dist/clients/v1/api/buyer/findBuyers/index.d.ts +15 -2
  13. package/dist/clients/v1/api/buyer/resetBuyerStatusTimer/index.d.ts +29 -0
  14. package/dist/clients/v1/api/buyer/shareBuyer/index.d.ts +33 -0
  15. package/dist/clients/v1/api/buyer/updateBuyer/index.d.ts +38 -0
  16. package/dist/clients/v1/api/call/createCallComment/index.d.ts +33 -0
  17. package/dist/clients/v1/api/call/findCallById/index.d.ts +29 -0
  18. package/dist/clients/v1/api/callTask/callCallTask.d.ts +29 -0
  19. package/dist/clients/v1/api/callTask/closeCallTask.d.ts +35 -0
  20. package/dist/clients/v1/api/callTask/findCallQualityAssessors.d.ts +35 -0
  21. package/dist/clients/v1/api/callTask/findCallTaskById.d.ts +29 -0
  22. package/dist/clients/v1/api/callTask/findCallTasks.d.ts +9 -3
  23. package/dist/clients/v1/api/callTask/updateCallTask.d.ts +24 -0
  24. package/dist/clients/v1/api/comment/findComments/index.d.ts +41 -0
  25. package/dist/clients/v1/api/deal/findDealExpertStatistics/index.d.ts +39 -0
  26. package/dist/clients/v1/api/index.d.ts +34 -7
  27. package/dist/clients/v1/api/messenger/findMessengerInviteLinks/index.d.ts +31 -0
  28. package/dist/clients/v1/api/motivationCalculator/createMotivationCalculatorRequest/index.d.ts +37 -0
  29. package/dist/clients/v1/api/motivationGlossary/findMotivationStatus/index.d.ts +29 -0
  30. package/dist/clients/v1/api/motivationStatus/findMotivationStatus/index.d.ts +35 -0
  31. package/dist/clients/v1/api/payslip/findPayslipById.d.ts +29 -0
  32. package/dist/clients/v1/api/payslip/findPayslips.d.ts +56 -0
  33. package/dist/clients/v1/api/payslip/updatePayslip.d.ts +35 -0
  34. package/dist/clients/v1/api/realty/findRealtyPriceHistory/index.d.ts +39 -0
  35. package/dist/clients/v1/api/serviceRequest/buyer/findBuyerRejectionReasonStatistic/index.d.ts +36 -0
  36. package/dist/clients/v1/api/serviceRequest/buyer/findBuyerStatusStatistic/index.d.ts +40 -0
  37. package/dist/clients/v1/api/serviceRequest/createServiceRequestSellerReport/index.d.ts +31 -0
  38. package/dist/clients/v1/api/serviceRequest/findServiceRequestCategoryById/index.d.ts +44 -0
  39. package/dist/clients/v1/dictionaries/CallTask.d.ts +4 -0
  40. package/dist/clients/v1/index.d.ts +27 -0
  41. package/dist/clients/v1/types/Buyer.d.ts +6 -0
  42. package/dist/clients/v1/types/BuyerStatusHistory.d.ts +11 -0
  43. package/dist/clients/v1/types/Call.d.ts +2 -2
  44. package/dist/clients/v1/types/CallTask.d.ts +5 -0
  45. package/dist/clients/v1/types/Comment.d.ts +11 -0
  46. package/dist/clients/v1/types/Motivation.d.ts +58 -0
  47. package/dist/clients/v1/types/Payslip.d.ts +61 -0
  48. package/dist/clients/v1/types/PriceHistory.d.ts +9 -0
  49. package/dist/clients/v1/types/index.d.ts +6 -1
  50. package/package.json +1 -1
  51. package/src/clients/v1/api/buyer/closeBuyer/index.ts +47 -0
  52. package/src/clients/v1/api/buyer/findBuyerById/index.ts +48 -0
  53. package/src/clients/v1/api/buyer/findBuyerStatuses/index.ts +61 -0
  54. package/src/clients/v1/api/buyer/findBuyerUniquePhones/index.ts +51 -0
  55. package/src/clients/v1/api/buyer/findBuyers/index.ts +17 -2
  56. package/src/clients/v1/api/buyer/resetBuyerStatusTimer/index.ts +42 -0
  57. package/src/clients/v1/api/buyer/shareBuyer/index.ts +40 -0
  58. package/src/clients/v1/api/buyer/updateBuyer/index.ts +48 -0
  59. package/src/clients/v1/api/call/createCallComment/index.ts +41 -0
  60. package/src/clients/v1/api/call/findCallById/index.ts +39 -0
  61. package/src/clients/v1/api/callTask/callCallTask.ts +46 -0
  62. package/src/clients/v1/api/callTask/closeCallTask.ts +45 -0
  63. package/src/clients/v1/api/callTask/findCallQualityAssessors.ts +59 -0
  64. package/src/clients/v1/api/callTask/findCallTaskById.ts +39 -0
  65. package/src/clients/v1/api/callTask/findCallTasks.ts +6 -3
  66. package/src/clients/v1/api/callTask/updateCallTask.ts +49 -0
  67. package/src/clients/v1/api/comment/findComments/index.ts +54 -0
  68. package/src/clients/v1/api/deal/findDealExpertStatistics/index.ts +43 -0
  69. package/src/clients/v1/api/index.ts +37 -7
  70. package/src/clients/v1/api/messenger/findMessengerInviteLinks/index.ts +40 -0
  71. package/src/clients/v1/api/motivationCalculator/createMotivationCalculatorRequest/index.ts +48 -0
  72. package/src/clients/v1/api/motivationGlossary/findMotivationStatus/index.ts +38 -0
  73. package/src/clients/v1/api/motivationStatus/findMotivationStatus/index.ts +47 -0
  74. package/src/clients/v1/api/payslip/findPayslipById.ts +39 -0
  75. package/src/clients/v1/api/payslip/findPayslips.ts +53 -0
  76. package/src/clients/v1/api/payslip/updatePayslip.ts +45 -0
  77. package/src/clients/v1/api/realty/findRealtyPriceHistory/index.ts +43 -0
  78. package/src/clients/v1/api/serviceRequest/buyer/findBuyerRejectionReasonStatistic/index.ts +44 -0
  79. package/src/clients/v1/api/serviceRequest/buyer/findBuyerStatusStatistic/index.ts +48 -0
  80. package/src/clients/v1/api/serviceRequest/createServiceRequestSellerReport/index.ts +42 -0
  81. package/src/clients/v1/api/serviceRequest/findServiceRequestCategoryById/index.ts +48 -0
  82. package/src/clients/v1/dictionaries/CallTask.ts +4 -0
  83. package/src/clients/v1/index.ts +223 -5
  84. package/src/clients/v1/types/Buyer.ts +7 -0
  85. package/src/clients/v1/types/BuyerStatusHistory.ts +12 -0
  86. package/src/clients/v1/types/Call.ts +2 -2
  87. package/src/clients/v1/types/CallTask.ts +5 -0
  88. package/src/clients/v1/types/Comment.ts +10 -0
  89. package/src/clients/v1/types/Motivation.ts +64 -0
  90. package/src/clients/v1/types/Payslip.ts +62 -0
  91. package/src/clients/v1/types/PriceHistory.ts +7 -0
  92. package/src/clients/v1/types/index.ts +6 -1
@@ -0,0 +1,40 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+
3
+ type SuccessData = {
4
+ success: true;
5
+ data: { type: 'telegram'; uri: string }[];
6
+ };
7
+ type ErrorData = { success: false; data: { error: string } };
8
+
9
+ type ResultData = SuccessData['data'];
10
+ type ResultError = ErrorData['data']['error'];
11
+
12
+ export type FindMessengerInviteLinksHeaders = { 'x-auth-hc': string };
13
+ export type FindMessengerInviteLinksUrlParams = { id: number };
14
+ export type FindMessengerInviteLinksData = AxiosResponse<ResultData>;
15
+ export type FindMessengerInviteLinksError = AxiosError<ResultError>;
16
+ export type FindMessengerInviteLinksConfig = {
17
+ baseURL?: string;
18
+ headers: FindMessengerInviteLinksHeaders;
19
+ urlParams: FindMessengerInviteLinksUrlParams;
20
+ };
21
+
22
+ export function findMessengerInviteLinksRequest({
23
+ baseURL = 'https://clients.homeapp.ru',
24
+ urlParams,
25
+ headers,
26
+ }: FindMessengerInviteLinksConfig) {
27
+ return axios
28
+ .get(`/api/motivation-status/${urlParams.id}`, {
29
+ baseURL,
30
+ headers: { Accept: 'application/json', ...headers },
31
+ transformResponse: [
32
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
33
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
34
+ ],
35
+ })
36
+ .then((res: FindMessengerInviteLinksData) => res)
37
+ .catch((err: FindMessengerInviteLinksError) => {
38
+ throw err;
39
+ });
40
+ }
@@ -0,0 +1,48 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { MotivationCommission, MotivationServiceTypeValues } from '../../../types';
3
+
4
+ type SuccessData = { success: true; data: MotivationCommission };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type CreateMotivationCalculatorRequestHeaders = { 'x-auth-hc': string };
11
+ export type CreateMotivationCalculatorRequestBody = {
12
+ serviceType: MotivationServiceTypeValues;
13
+ price: number;
14
+ commission: number;
15
+ val: number;
16
+ partnerCommission?: number;
17
+ developerCommission?: number;
18
+ legalDiligenceCount?: number;
19
+ isLowCommissionBonusFineByROP?: boolean;
20
+ isTrainee?: boolean;
21
+ };
22
+ export type CreateMotivationCalculatorRequestData = AxiosResponse<ResultData>;
23
+ export type CreateMotivationCalculatorRequestError = AxiosError<ResultError>;
24
+ export type CreateMotivationCalculatorRequestConfig = {
25
+ baseURL?: string;
26
+ body: CreateMotivationCalculatorRequestBody;
27
+ headers: CreateMotivationCalculatorRequestHeaders;
28
+ };
29
+
30
+ export function createMotivationCalculatorRequest({
31
+ baseURL = 'https://clients.homeapp.ru',
32
+ body,
33
+ headers,
34
+ }: CreateMotivationCalculatorRequestConfig) {
35
+ return axios
36
+ .post('/api/motivation-calculator', body, {
37
+ baseURL,
38
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
39
+ transformResponse: [
40
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
41
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
42
+ ],
43
+ })
44
+ .then((res: CreateMotivationCalculatorRequestData) => res)
45
+ .catch((err: CreateMotivationCalculatorRequestError) => {
46
+ throw err;
47
+ });
48
+ }
@@ -0,0 +1,38 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { MotivationMinCommission, MotivationStep } from '../../../types';
3
+
4
+ type SuccessData = {
5
+ success: true;
6
+ data: { minCommission: MotivationMinCommission; highCommissionBonusPercent: number; steps: MotivationStep[] };
7
+ };
8
+ type ErrorData = { success: false; data: { error: string } };
9
+
10
+ type ResultData = SuccessData['data'];
11
+ type ResultError = ErrorData['data']['error'];
12
+
13
+ export type FindMotivationStatusHeaders = { 'x-auth-hc': string };
14
+ export type FindMotivationStatusData = AxiosResponse<ResultData>;
15
+ export type FindMotivationStatusError = AxiosError<ResultError>;
16
+ export type FindMotivationStatusConfig = {
17
+ baseURL?: string;
18
+ headers: FindMotivationStatusHeaders;
19
+ };
20
+
21
+ export function findMotivationStatusRequest({
22
+ baseURL = 'https://clients.homeapp.ru',
23
+ headers,
24
+ }: FindMotivationStatusConfig) {
25
+ return axios
26
+ .get('/api/motivation-glossary', {
27
+ baseURL,
28
+ headers: { Accept: 'application/json', ...headers },
29
+ transformResponse: [
30
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
31
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
32
+ ],
33
+ })
34
+ .then((res: FindMotivationStatusData) => res)
35
+ .catch((err: FindMotivationStatusError) => {
36
+ throw err;
37
+ });
38
+ }
@@ -0,0 +1,47 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+
3
+ type SuccessData = {
4
+ success: true;
5
+ data: {
6
+ count: number; // количество закрытых сделок за 3 месяца + текущий месяц
7
+ val: number; // суммарная комиссия по сделкам, закрытым за последние 3 месяца + текущий месяц, в руб.
8
+ step: string;
9
+ bonus: number;
10
+ nextBonus?: number;
11
+ neededVal?: number; // необходимая комиссия до следующей ступени, в руб.
12
+ };
13
+ };
14
+ type ErrorData = { success: false; data: { error: string } };
15
+
16
+ type ResultData = SuccessData['data'];
17
+ type ResultError = ErrorData['data']['error'];
18
+
19
+ export type FindMotivationStatusHeaders = { 'x-auth-hc': string };
20
+ export type FindMotivationStatusUrlParams = { id: number };
21
+ export type FindMotivationStatusData = AxiosResponse<ResultData>;
22
+ export type FindMotivationStatusError = AxiosError<ResultError>;
23
+ export type FindMotivationStatusConfig = {
24
+ baseURL?: string;
25
+ headers: FindMotivationStatusHeaders;
26
+ urlParams: FindMotivationStatusUrlParams;
27
+ };
28
+
29
+ export function findMotivationStatusRequest({
30
+ baseURL = 'https://clients.homeapp.ru',
31
+ urlParams,
32
+ headers,
33
+ }: FindMotivationStatusConfig) {
34
+ return axios
35
+ .get(`/api/motivation-status/${urlParams.id}`, {
36
+ baseURL,
37
+ headers: { Accept: 'application/json', ...headers },
38
+ transformResponse: [
39
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
40
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
41
+ ],
42
+ })
43
+ .then((res: FindMotivationStatusData) => res)
44
+ .catch((err: FindMotivationStatusError) => {
45
+ throw err;
46
+ });
47
+ }
@@ -0,0 +1,39 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { Payslip } from '../../types';
3
+
4
+ type SuccessData = { success: true; data: Payslip };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type FindPayslipByIdUrlParams = { id: number };
11
+ export type FindPayslipByIdHeaders = { 'x-auth-hc': string };
12
+ export type FindPayslipByIdData = AxiosResponse<ResultData>;
13
+ export type FindPayslipByIdError = AxiosError<ResultError>;
14
+
15
+ export type FindPayslipByIdConfig = {
16
+ baseURL?: string;
17
+ urlParams: FindPayslipByIdUrlParams;
18
+ headers: FindPayslipByIdHeaders;
19
+ };
20
+
21
+ export function findPayslipByIdRequest({
22
+ baseURL = 'https://clients.homeapp.ru',
23
+ urlParams,
24
+ headers,
25
+ }: FindPayslipByIdConfig) {
26
+ return axios
27
+ .get(`/api/payslip/${urlParams.id}`, {
28
+ baseURL,
29
+ headers: { Accept: 'application/json', ...headers },
30
+ transformResponse: [
31
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
32
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
33
+ ],
34
+ })
35
+ .then((res: FindPayslipByIdData) => res)
36
+ .catch((err: FindPayslipByIdError) => {
37
+ throw err;
38
+ });
39
+ }
@@ -0,0 +1,53 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+ import { Payslip } from '../../types';
4
+
5
+ type SuccessData = { success: true; data: Payslip[]; pageParams: { page: number; length: number } };
6
+ type ErrorData = { success: false; data: { error: string } };
7
+
8
+ type ResultData = { data: SuccessData['data']; meta: { total: number } };
9
+ type ResultError = ErrorData['data']['error'];
10
+
11
+ export type FindPayslipsParams = {
12
+ filter?: {
13
+ dealId?: string | string[];
14
+ 'serviceRequest.id'?: string | string[];
15
+ 'serviceRequest.contract.formalId'?: string;
16
+ 'serviceRequest.curator.id'?: string;
17
+ 'serviceRequest.curator.supervisor.id'?: string;
18
+ closingDate?: string | { from?: string; to?: string };
19
+ };
20
+ sorting?: { type: 'closingDate'; direction: 'asc' | 'desc' };
21
+ limits?: { page?: number; count?: number | 'all' };
22
+ };
23
+
24
+ export type FindPayslipsHeaders = { 'x-auth-hc': string };
25
+ export type FindPayslipsData = AxiosResponse<ResultData>;
26
+ export type FindPayslipsError = AxiosError<ResultError>;
27
+ export type FindPayslipsConfig = {
28
+ baseURL?: string;
29
+ params: FindPayslipsParams;
30
+ headers: FindPayslipsHeaders;
31
+ };
32
+
33
+ export function findPayslipsRequest({ baseURL = 'https://clients.homeapp.ru', headers, params }: FindPayslipsConfig) {
34
+ return axios
35
+ .get('/api/payslip', {
36
+ baseURL,
37
+ params,
38
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
39
+ headers: { Accept: 'application/json', ...headers },
40
+ transformResponse: [
41
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
42
+ (data: SuccessData | ErrorData): ResultData | ResultError => {
43
+ if (!data.success) return data.data.error;
44
+
45
+ return { data: data.data, meta: { total: data.pageParams.length } };
46
+ },
47
+ ],
48
+ })
49
+ .then((res: FindPayslipsData) => res)
50
+ .catch((err: FindPayslipsError) => {
51
+ throw err;
52
+ });
53
+ }
@@ -0,0 +1,45 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { Payslip } from '../../types';
3
+
4
+ type SuccessData = { success: true; data: Payslip };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type UpdatePayslipHeaders = { 'x-auth-hc': string };
11
+ export type UpdatePayslipUrlParams = { id: number };
12
+ export type UpdatePayslipBody = {
13
+ financeAdjustment?: string;
14
+ financeComment?: string;
15
+ ifFinalNotification: boolean;
16
+ };
17
+ export type UpdatePayslipData = AxiosResponse<ResultData>;
18
+ export type UpdatePayslipError = AxiosError<ResultError>;
19
+ export type UpdatePayslipConfig = {
20
+ baseURL?: string;
21
+ body: UpdatePayslipBody;
22
+ urlParams: UpdatePayslipUrlParams;
23
+ headers: UpdatePayslipHeaders;
24
+ };
25
+
26
+ export function updatePayslipRequest({
27
+ baseURL = 'https://clients.homeapp.ru',
28
+ urlParams,
29
+ body,
30
+ headers,
31
+ }: UpdatePayslipConfig) {
32
+ return axios
33
+ .post(`/api/payslip/${urlParams.id}`, body, {
34
+ baseURL,
35
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
36
+ transformResponse: [
37
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
38
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
39
+ ],
40
+ })
41
+ .then((res: UpdatePayslipData) => res)
42
+ .catch((err: UpdatePayslipError) => {
43
+ throw err;
44
+ });
45
+ }
@@ -0,0 +1,43 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { PriceHistory } from '../../../types';
3
+ import qs from 'qs';
4
+
5
+ type SuccessData = { success: true; data: PriceHistory[] };
6
+ type ErrorData = { success: false; data: { error: string } };
7
+
8
+ type ResultData = SuccessData['data'];
9
+ type ResultError = ErrorData['data']['error'];
10
+
11
+ export type FindRealtyPriceHistoryParams = {
12
+ filter?: { realtyId?: number | number[]; dateCreated?: { from?: string; to?: string } };
13
+ limits?: { page?: number; count?: number | 'all' };
14
+ sorting?: { type?: 'id' | 'realtyId' | 'dateCreated'; direction?: 'asc' | 'desc' };
15
+ };
16
+
17
+ export type FindRealtyPriceHistoryData = AxiosResponse<ResultData>;
18
+ export type FindRealtyPriceHistoryError = AxiosError<ResultError>;
19
+ export type FindRealtyPriceHistoryConfig = {
20
+ baseURL?: string;
21
+ params: FindRealtyPriceHistoryParams;
22
+ };
23
+
24
+ export function findRealtyPriceHistoryRequest({
25
+ baseURL = 'https://clients.homeapp.ru',
26
+ params,
27
+ }: FindRealtyPriceHistoryConfig) {
28
+ return axios
29
+ .get('/api/crud/price-history', {
30
+ baseURL,
31
+ params,
32
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
33
+ headers: { Accept: 'application/json' },
34
+ transformResponse: [
35
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
36
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
37
+ ],
38
+ })
39
+ .then((res: FindRealtyPriceHistoryData) => res)
40
+ .catch((err: FindRealtyPriceHistoryError) => {
41
+ throw err;
42
+ });
43
+ }
@@ -0,0 +1,44 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+
4
+ type SuccessData = { success: true; data: { text: string; count: number }[] };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type FindBuyerRejectionReasonStatisticUrlParams = { id: number };
11
+ export type FindBuyerRejectionReasonStatisticParams = { from?: string; to?: string };
12
+ export type FindBuyerRejectionReasonStatisticHeaders = { 'x-auth-hc': string };
13
+ export type FindBuyerRejectionReasonStatisticData = AxiosResponse<ResultData>;
14
+ export type FindBuyerRejectionReasonStatisticError = AxiosError<ResultError>;
15
+
16
+ export type FindBuyerRejectionReasonStatisticConfig = {
17
+ baseURL?: string;
18
+ urlParams: FindBuyerRejectionReasonStatisticUrlParams;
19
+ params: FindBuyerRejectionReasonStatisticParams;
20
+ headers: FindBuyerRejectionReasonStatisticHeaders;
21
+ };
22
+
23
+ export function findBuyerRejectionReasonStatisticRequest({
24
+ baseURL = 'https://clients.homeapp.ru',
25
+ urlParams,
26
+ params,
27
+ headers,
28
+ }: FindBuyerRejectionReasonStatisticConfig) {
29
+ return axios
30
+ .get(`/api/service-request/${urlParams.id}/buyer/closing/rejection-reason/statistic`, {
31
+ baseURL,
32
+ params,
33
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
34
+ headers: { Accept: 'application/json', ...headers },
35
+ transformResponse: [
36
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
37
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data ?? [] : data.data.error),
38
+ ],
39
+ })
40
+ .then((res: FindBuyerRejectionReasonStatisticData) => res)
41
+ .catch((err: FindBuyerRejectionReasonStatisticError) => {
42
+ throw err;
43
+ });
44
+ }
@@ -0,0 +1,48 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { BuyerStatus } from '../../../../types';
3
+ import qs from 'qs';
4
+
5
+ type SuccessData = {
6
+ success: true;
7
+ data: { status: BuyerStatus; values: { buyerId: number; count: number }[] }[];
8
+ };
9
+ type ErrorData = { success: false; data: { error: string } };
10
+
11
+ type ResultData = SuccessData['data'];
12
+ type ResultError = ErrorData['data']['error'];
13
+
14
+ export type FindBuyerStatusStatisticUrlParams = { id: number };
15
+ export type FindBuyerStatusStatisticParams = { from?: string; to?: string };
16
+ export type FindBuyerStatusStatisticHeaders = { 'x-auth-hc': string };
17
+ export type FindBuyerStatusStatisticData = AxiosResponse<ResultData>;
18
+ export type FindBuyerStatusStatisticError = AxiosError<ResultError>;
19
+
20
+ export type FindBuyerStatusStatisticConfig = {
21
+ baseURL?: string;
22
+ urlParams: FindBuyerStatusStatisticUrlParams;
23
+ params: FindBuyerStatusStatisticParams;
24
+ headers: FindBuyerStatusStatisticHeaders;
25
+ };
26
+
27
+ export function findBuyerStatusStatisticRequest({
28
+ baseURL = 'https://clients.homeapp.ru',
29
+ urlParams,
30
+ params,
31
+ headers,
32
+ }: FindBuyerStatusStatisticConfig) {
33
+ return axios
34
+ .get(`/api/service-request/${urlParams.id}/buyer/status/statistic`, {
35
+ baseURL,
36
+ params,
37
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
38
+ headers: { Accept: 'application/json', ...headers },
39
+ transformResponse: [
40
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
41
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
42
+ ],
43
+ })
44
+ .then((res: FindBuyerStatusStatisticData) => res)
45
+ .catch((err: FindBuyerStatusStatisticError) => {
46
+ throw err;
47
+ });
48
+ }
@@ -0,0 +1,42 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { ServiceRequestSellerReport } from '../../../types';
3
+
4
+ type SuccessData = { success: true; data: ServiceRequestSellerReport };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type CreateServiceRequestSellerReportHeaders = { 'x-auth-hc': string };
11
+ export type CreateServiceRequestSellerReportUrlParams = { id: number };
12
+ export type CreateServiceRequestSellerReportBody = Partial<ServiceRequestSellerReport>;
13
+
14
+ export type CreateServiceRequestSellerReportData = AxiosResponse<ResultData>;
15
+ export type CreateServiceRequestSellerReportError = AxiosError<ResultError>;
16
+ export type CreateServiceRequestSellerReportConfig = {
17
+ baseURL?: string;
18
+ headers: CreateServiceRequestSellerReportHeaders;
19
+ body: CreateServiceRequestSellerReportBody;
20
+ urlParams: CreateServiceRequestSellerReportUrlParams;
21
+ };
22
+
23
+ export function createServiceRequestSellerReportRequest({
24
+ baseURL = 'https://clients.homeapp.ru',
25
+ body,
26
+ headers,
27
+ urlParams,
28
+ }: CreateServiceRequestSellerReportConfig) {
29
+ return axios
30
+ .post(`/api/service-request/${urlParams.id}/report-for-seller`, body, {
31
+ baseURL,
32
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
33
+ transformResponse: [
34
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
35
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
36
+ ],
37
+ })
38
+ .then((res: CreateServiceRequestSellerReportData) => res)
39
+ .catch((err: CreateServiceRequestSellerReportError) => {
40
+ throw err;
41
+ });
42
+ }
@@ -0,0 +1,48 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+ import { ServiceRequestCategory } from '../../../types';
4
+
5
+ type SuccessData = { success: true; data: { category: ServiceRequestCategory; movedAt: string }[] };
6
+ type ErrorData = { success: false; data: Record<'error' | 'message', string> };
7
+
8
+ type ResultData = SuccessData['data'];
9
+ type ResultError = ErrorData['data']['error'];
10
+
11
+ export type FindServiceRequestCategoryByIdHeaders = { 'x-auth-hc': string };
12
+ export type FindServiceRequestCategoryByIdUrlParams = { id: number };
13
+ export type FindServiceRequestCategoryByIdParams = {
14
+ filter?: { category?: ServiceRequestCategory };
15
+ limits?: { page?: number; count: number | 'all' };
16
+ sorting?: { direction: 'asc' | 'desc'; type: 'createdAt' };
17
+ };
18
+ export type FindServiceRequestCategoryByIdData = AxiosResponse<ResultData>;
19
+ export type FindServiceRequestCategoryByIdError = AxiosError<ResultError>;
20
+ export type FindServiceRequestCategoryByIdConfig = {
21
+ baseURL?: string;
22
+ params?: FindServiceRequestCategoryByIdParams;
23
+ urlParams: FindServiceRequestCategoryByIdUrlParams;
24
+ headers: FindServiceRequestCategoryByIdHeaders;
25
+ };
26
+
27
+ export function findServiceRequestCategoryByIdRequest({
28
+ baseURL = 'https://clients.homeapp.ru',
29
+ headers,
30
+ urlParams,
31
+ params,
32
+ }: FindServiceRequestCategoryByIdConfig) {
33
+ return axios
34
+ .get(`/api/service-request-category/${urlParams.id}/grouped`, {
35
+ baseURL,
36
+ params,
37
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
38
+ headers: { Accept: 'application/json', ...headers },
39
+ transformResponse: [
40
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
41
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
42
+ ],
43
+ })
44
+ .then((res: FindServiceRequestCategoryByIdData) => res)
45
+ .catch((err: FindServiceRequestCategoryByIdError) => {
46
+ throw err;
47
+ });
48
+ }
@@ -44,6 +44,10 @@ export const CallTaskDictionary = {
44
44
  [CallTaskReason.Complaint]: 'Жалоба',
45
45
  [CallTaskReason.Commercial]: 'Коммерческое предложение',
46
46
  [CallTaskReason.Test]: 'Тест',
47
+ [CallTaskReason.HasOwnRealtor]: 'Есть свой реэлтор',
48
+ [CallTaskReason.Rent]: 'Аренда',
49
+ [CallTaskReason.NewComplex]: 'Новостройка',
50
+ [CallTaskReason.QualityAssurance]: 'Отдел качества',
47
51
  [CallTaskReason.Other]: 'Другое',
48
52
  },
49
53
  ColdReason: {