@go-avro/avro-js 0.0.2-beta.102 → 0.0.2-beta.103
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Socket } from 'socket.io-client';
|
|
2
2
|
import { InfiniteData, UseInfiniteQueryResult, useMutation, UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import { AuthManager } from '../auth/AuthManager';
|
|
4
|
-
import { _Event, ApiInfo, Avro, Bill, Break, Chat, Company, Job,
|
|
4
|
+
import { _Event, ApiInfo, Avro, Bill, Break, Chat, Company, Job, LoginResponse, Message, Plan, Route, ServiceMonth, Session, Team, User, UserCompanyAssociation } from '../types/api';
|
|
5
5
|
import { Tokens } from '../types/auth';
|
|
6
6
|
import { CancelToken, RetryStrategy } from '../types/client';
|
|
7
7
|
import { StandardError } from '../types/error';
|
|
@@ -111,12 +111,7 @@ declare module '../client/QueryClient' {
|
|
|
111
111
|
id: string;
|
|
112
112
|
invoice_id: number;
|
|
113
113
|
}, StandardError, {
|
|
114
|
-
data:
|
|
115
|
-
line_items: LineItem[];
|
|
116
|
-
due_date: number;
|
|
117
|
-
users: string[];
|
|
118
|
-
custom_emails: [string, string][];
|
|
119
|
-
};
|
|
114
|
+
data: Partial<Bill>;
|
|
120
115
|
}>>;
|
|
121
116
|
useCreateCompany(): ReturnType<typeof useMutation<{
|
|
122
117
|
id: string;
|
|
@@ -376,5 +371,4 @@ export declare class AvroQueryClient {
|
|
|
376
371
|
offset?: number;
|
|
377
372
|
}, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
|
|
378
373
|
sendEmail(emailId: string, formData: FormData, progressUpdateCallback?: (loaded: number, total: number) => void): Promise<void>;
|
|
379
|
-
createBill(data: Partial<Bill>, cancelToken?: CancelToken): Promise<any>;
|
|
380
374
|
}
|
|
@@ -380,25 +380,4 @@ export class AvroQueryClient {
|
|
|
380
380
|
throw new StandardError(500, `Failed to send email: ${error}`);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
|
-
createBill(data, cancelToken) {
|
|
384
|
-
if (!this.companyId || this.companyId.trim() === '') {
|
|
385
|
-
throw new StandardError(400, 'Company ID is required');
|
|
386
|
-
}
|
|
387
|
-
const body = {
|
|
388
|
-
events: data.events ?? [],
|
|
389
|
-
months: data.months ?? [],
|
|
390
|
-
line_items: data.line_items ?? [],
|
|
391
|
-
manual_emails: data.manual_emails ?? [],
|
|
392
|
-
users: data.users ?? [],
|
|
393
|
-
due_date: data.due_date,
|
|
394
|
-
};
|
|
395
|
-
try {
|
|
396
|
-
return this._xhr('POST', `/company/${this.companyId}/bill`, JSON.stringify(body), cancelToken, {
|
|
397
|
-
'Content-Type': 'application/json',
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
catch (error) {
|
|
401
|
-
throw new StandardError(500, `Failed to create bill: ${error}`);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
383
|
}
|
|
@@ -38,12 +38,12 @@ AvroQueryClient.prototype.useGetBill = function (billId) {
|
|
|
38
38
|
AvroQueryClient.prototype.useCreateBill = function () {
|
|
39
39
|
const queryClient = useQueryClient();
|
|
40
40
|
return useMutation({
|
|
41
|
-
mutationFn: async ({ data
|
|
41
|
+
mutationFn: async ({ data }) => {
|
|
42
42
|
const body = {
|
|
43
|
-
events: data.
|
|
44
|
-
months: data.
|
|
45
|
-
line_items: data.line_items
|
|
46
|
-
manual_emails: data.
|
|
43
|
+
events: data.events ?? [],
|
|
44
|
+
months: data.months ?? [],
|
|
45
|
+
line_items: data.line_items ?? [],
|
|
46
|
+
manual_emails: data.manual_emails,
|
|
47
47
|
users: data.users,
|
|
48
48
|
due_date: data.due_date,
|
|
49
49
|
};
|