@go-avro/avro-js 0.0.2-beta.7 → 0.0.2-beta.71
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/README.md +1 -0
- package/dist/auth/AuthManager.d.ts +2 -0
- package/dist/auth/AuthManager.js +8 -0
- package/dist/client/QueryClient.d.ts +314 -12
- package/dist/client/QueryClient.js +211 -186
- package/dist/client/core/fetch.d.ts +1 -0
- package/dist/client/core/fetch.js +67 -0
- package/dist/client/core/utils.d.ts +1 -0
- package/dist/client/core/utils.js +13 -0
- package/dist/client/core/xhr.d.ts +1 -0
- package/dist/client/core/xhr.js +87 -0
- package/dist/client/hooks/analytics.d.ts +1 -0
- package/dist/client/hooks/analytics.js +10 -0
- package/dist/client/hooks/avro.d.ts +1 -0
- package/dist/client/hooks/avro.js +9 -0
- package/dist/client/hooks/bills.d.ts +1 -0
- package/dist/client/hooks/bills.js +141 -0
- package/dist/client/hooks/chats.d.ts +1 -0
- package/dist/client/hooks/chats.js +37 -0
- package/dist/client/hooks/companies.d.ts +1 -0
- package/dist/client/hooks/companies.js +79 -0
- package/dist/client/hooks/events.d.ts +1 -0
- package/dist/client/hooks/events.js +307 -0
- package/dist/client/hooks/jobs.d.ts +1 -0
- package/dist/client/hooks/jobs.js +184 -0
- package/dist/client/hooks/messages.d.ts +1 -0
- package/dist/client/hooks/messages.js +30 -0
- package/dist/client/hooks/months.d.ts +1 -0
- package/dist/client/hooks/months.js +92 -0
- package/dist/client/hooks/plans.d.ts +1 -0
- package/dist/client/hooks/plans.js +9 -0
- package/dist/client/hooks/root.d.ts +1 -0
- package/dist/client/hooks/root.js +8 -0
- package/dist/client/hooks/routes.d.ts +1 -0
- package/dist/client/hooks/routes.js +123 -0
- package/dist/client/hooks/sessions.d.ts +1 -0
- package/dist/client/hooks/sessions.js +154 -0
- package/dist/client/hooks/teams.d.ts +1 -0
- package/dist/client/hooks/teams.js +71 -0
- package/dist/client/hooks/users.d.ts +1 -0
- package/dist/client/hooks/users.js +104 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/types/api.d.ts +117 -29
- package/dist/types/api.js +10 -1
- package/package.json +6 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { AvroQueryClient } from "../../client/QueryClient";
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
AvroQueryClient.prototype.useGetTeams = function (companyGuid, body, total, onProgress) {
|
|
4
|
+
return useQuery({
|
|
5
|
+
queryKey: ['teams', companyGuid, body.amt ?? 50, body.query ?? ""],
|
|
6
|
+
queryFn: async () => {
|
|
7
|
+
if (typeof total !== "number") {
|
|
8
|
+
return this.fetchTeams(companyGuid, { ...body, offset: 0 });
|
|
9
|
+
}
|
|
10
|
+
onProgress?.(0);
|
|
11
|
+
const pageCount = body.amt ? Math.ceil(total / body.amt) : 0;
|
|
12
|
+
let completed = 0;
|
|
13
|
+
const promises = Array.from({ length: pageCount }, (_, i) => this.fetchTeams(companyGuid, {
|
|
14
|
+
...body,
|
|
15
|
+
offset: i * (body.amt ?? 0),
|
|
16
|
+
}));
|
|
17
|
+
const trackedPromises = promises.map((promise) => promise.then((result) => {
|
|
18
|
+
completed++;
|
|
19
|
+
const fraction = completed / pageCount;
|
|
20
|
+
onProgress?.(fraction);
|
|
21
|
+
return result;
|
|
22
|
+
}));
|
|
23
|
+
const pages = await Promise.all(trackedPromises);
|
|
24
|
+
const routes = pages.flat();
|
|
25
|
+
return routes;
|
|
26
|
+
},
|
|
27
|
+
enabled: Boolean(companyGuid) && companyGuid.length > 0,
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
AvroQueryClient.prototype.useDeleteTeam = function () {
|
|
31
|
+
const queryClient = useQueryClient();
|
|
32
|
+
return useMutation({
|
|
33
|
+
mutationFn: async ({ teamId, }) => {
|
|
34
|
+
return this.delete(`/team/${teamId}`);
|
|
35
|
+
},
|
|
36
|
+
onMutate: async ({ teamId }) => {
|
|
37
|
+
await queryClient.cancelQueries({ queryKey: ['teams'] });
|
|
38
|
+
await queryClient.cancelQueries({ queryKey: ['team', teamId] });
|
|
39
|
+
const previousRoutes = queryClient.getQueryData(['teams']);
|
|
40
|
+
const previousRoute = queryClient.getQueryData(['team', teamId]);
|
|
41
|
+
queryClient.setQueryData(['team', teamId], undefined);
|
|
42
|
+
queryClient.setQueriesData({ queryKey: ['teams'] }, (oldData) => {
|
|
43
|
+
if (!oldData)
|
|
44
|
+
return oldData;
|
|
45
|
+
if (oldData.pages) {
|
|
46
|
+
const updatedPages = oldData.pages.map((page) => page.filter((team) => team.id !== teamId));
|
|
47
|
+
return { ...oldData, pages: updatedPages };
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(oldData)) {
|
|
50
|
+
return oldData.filter((team) => team.id !== teamId);
|
|
51
|
+
}
|
|
52
|
+
return oldData;
|
|
53
|
+
});
|
|
54
|
+
return { previousRoutes, previousRoute };
|
|
55
|
+
},
|
|
56
|
+
onError: (_err, variables, context) => {
|
|
57
|
+
const { teamId } = variables;
|
|
58
|
+
if (context?.previousRoutes) {
|
|
59
|
+
queryClient.setQueryData(['teams'], context.previousRoutes);
|
|
60
|
+
}
|
|
61
|
+
if (context?.previousRoute) {
|
|
62
|
+
queryClient.setQueryData(['team', teamId], context.previousRoute);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
onSettled: (_data, _error, variables) => {
|
|
66
|
+
const { teamId } = variables;
|
|
67
|
+
queryClient.invalidateQueries({ queryKey: ['teams'] });
|
|
68
|
+
queryClient.invalidateQueries({ queryKey: ['team', teamId] });
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { AvroQueryClient } from "../../client/QueryClient";
|
|
3
|
+
AvroQueryClient.prototype.useGetUser = function (userId) {
|
|
4
|
+
return useQuery({
|
|
5
|
+
queryKey: ['user', userId],
|
|
6
|
+
queryFn: () => this.get(`/user/${userId}`),
|
|
7
|
+
enabled: Boolean(userId),
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
AvroQueryClient.prototype.useSearchUsers = function (searchUsername) {
|
|
11
|
+
return useQuery({
|
|
12
|
+
queryKey: ['user', 'search', searchUsername],
|
|
13
|
+
queryFn: () => {
|
|
14
|
+
if (!searchUsername)
|
|
15
|
+
return Promise.resolve([]);
|
|
16
|
+
return this.get(`/user/search/${searchUsername}`);
|
|
17
|
+
},
|
|
18
|
+
enabled: Boolean(searchUsername),
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
AvroQueryClient.prototype.useGetSelf = function () {
|
|
22
|
+
return useQuery({
|
|
23
|
+
queryKey: ['user'],
|
|
24
|
+
queryFn: () => this.get(`/user`),
|
|
25
|
+
enabled: Boolean(this),
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
AvroQueryClient.prototype.useCreateSelf = function () {
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
return useMutation({
|
|
31
|
+
mutationFn: async (data) => {
|
|
32
|
+
return this.post('/user', JSON.stringify(data), undefined, { "Content-Type": "application/json" });
|
|
33
|
+
},
|
|
34
|
+
onSettled: () => {
|
|
35
|
+
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
AvroQueryClient.prototype.useUpdateUserCompany = function () {
|
|
40
|
+
const queryClient = useQueryClient();
|
|
41
|
+
return useMutation({
|
|
42
|
+
mutationFn: async ({ company_id, user_id, data }) => {
|
|
43
|
+
return this.put(`/company/${company_id}/user/${user_id}`, JSON.stringify(data), undefined, { "Content-Type": "application/json" });
|
|
44
|
+
},
|
|
45
|
+
// Optimistically update the user data and company data in the cache
|
|
46
|
+
onMutate: async (data) => {
|
|
47
|
+
await queryClient.cancelQueries({ queryKey: ['user'] });
|
|
48
|
+
await queryClient.cancelQueries({ queryKey: ['company', data.company_id] });
|
|
49
|
+
const previousUser = queryClient.getQueryData(['user']);
|
|
50
|
+
const previousCompany = queryClient.getQueryData(['company', data.company_id]);
|
|
51
|
+
if (previousUser) {
|
|
52
|
+
let oldUserCompany = previousUser.companies?.find(c => c.company === data.company_id);
|
|
53
|
+
if (oldUserCompany) {
|
|
54
|
+
oldUserCompany = { ...oldUserCompany, ...data.data };
|
|
55
|
+
const newCompanies = previousUser.companies?.map(c => c.company === data.company_id ? oldUserCompany : c) ?? [];
|
|
56
|
+
queryClient.setQueryData(['user'], { ...previousUser, companies: newCompanies });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (previousCompany) {
|
|
60
|
+
let oldCompanyUser = previousCompany.users?.find((u) => u.user.id === data.user_id);
|
|
61
|
+
if (oldCompanyUser) {
|
|
62
|
+
oldCompanyUser = { ...oldCompanyUser, ...data.data };
|
|
63
|
+
const newUsers = previousCompany.users?.map((u) => u.user.id === data.user_id ? oldCompanyUser : u) ?? [];
|
|
64
|
+
queryClient.setQueryData(['company', data.company_id], { ...previousCompany, users: newUsers });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { previousUser, previousCompany };
|
|
68
|
+
},
|
|
69
|
+
onError: (err, _, context) => {
|
|
70
|
+
if (context?.previousUser) {
|
|
71
|
+
queryClient.setQueryData(['user'], context.previousUser);
|
|
72
|
+
}
|
|
73
|
+
if (context?.previousCompany) {
|
|
74
|
+
queryClient.setQueryData(['company'], context.previousCompany);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
onSettled: (data, error, variables) => {
|
|
78
|
+
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
79
|
+
queryClient.invalidateQueries({ queryKey: ['company', variables.company_id] });
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
AvroQueryClient.prototype.useDeleteSelf = function () {
|
|
84
|
+
const queryClient = useQueryClient();
|
|
85
|
+
return useMutation({
|
|
86
|
+
mutationFn: async () => {
|
|
87
|
+
return this.delete(`/user`);
|
|
88
|
+
},
|
|
89
|
+
onMutate: async () => {
|
|
90
|
+
await queryClient.cancelQueries({ queryKey: ['user'] });
|
|
91
|
+
const previousUser = queryClient.getQueryData(['user']);
|
|
92
|
+
queryClient.removeQueries({ queryKey: ['user'] });
|
|
93
|
+
return { previousUser };
|
|
94
|
+
},
|
|
95
|
+
onError: (err, _, context) => {
|
|
96
|
+
if (context?.previousUser) {
|
|
97
|
+
queryClient.setQueryData(['user'], context.previousUser);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onSettled: () => {
|
|
101
|
+
queryClient.invalidateQueries({ queryKey: ['user'] });
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
export { AvroQueryClientConfig, AvroQueryClient } from './client/QueryClient';
|
|
2
2
|
export { AuthManager } from './auth/AuthManager';
|
|
3
3
|
export { MemoryStorage, LocalStorage } from './auth/storage';
|
|
4
|
+
import './client/core/xhr';
|
|
5
|
+
import './client/core/fetch';
|
|
6
|
+
import './client/core/utils';
|
|
7
|
+
import './client/hooks/root';
|
|
8
|
+
import './client/hooks/jobs';
|
|
9
|
+
import './client/hooks/routes';
|
|
10
|
+
import './client/hooks/events';
|
|
11
|
+
import './client/hooks/months';
|
|
12
|
+
import './client/hooks/bills';
|
|
13
|
+
import './client/hooks/companies';
|
|
14
|
+
import './client/hooks/users';
|
|
15
|
+
import './client/hooks/sessions';
|
|
16
|
+
import './client/hooks/chats';
|
|
17
|
+
import './client/hooks/messages';
|
|
18
|
+
import './client/hooks/plans';
|
|
19
|
+
import './client/hooks/analytics';
|
|
20
|
+
import './client/hooks/avro';
|
|
21
|
+
import './client/hooks/teams';
|
|
4
22
|
export * from './types/api';
|
|
23
|
+
export * from './types/auth';
|
|
5
24
|
export * from './types/error';
|
|
6
25
|
export * from './types/client';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
export { AvroQueryClient } from './client/QueryClient';
|
|
2
2
|
export { AuthManager } from './auth/AuthManager';
|
|
3
3
|
export { MemoryStorage, LocalStorage } from './auth/storage';
|
|
4
|
+
import './client/core/xhr';
|
|
5
|
+
import './client/core/fetch';
|
|
6
|
+
import './client/core/utils';
|
|
7
|
+
import './client/hooks/root';
|
|
8
|
+
import './client/hooks/jobs';
|
|
9
|
+
import './client/hooks/routes';
|
|
10
|
+
import './client/hooks/events';
|
|
11
|
+
import './client/hooks/months';
|
|
12
|
+
import './client/hooks/bills';
|
|
13
|
+
import './client/hooks/companies';
|
|
14
|
+
import './client/hooks/users';
|
|
15
|
+
import './client/hooks/sessions';
|
|
16
|
+
import './client/hooks/chats';
|
|
17
|
+
import './client/hooks/messages';
|
|
18
|
+
import './client/hooks/plans';
|
|
19
|
+
import './client/hooks/analytics';
|
|
20
|
+
import './client/hooks/avro';
|
|
21
|
+
import './client/hooks/teams';
|
|
4
22
|
export * from './types/api';
|
|
23
|
+
export * from './types/auth';
|
|
5
24
|
export * from './types/error';
|
|
6
25
|
export * from './types/client';
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export interface ApiInfo {
|
|
2
|
+
app_semver: string;
|
|
3
|
+
db_healthy: boolean;
|
|
4
|
+
logged_in_as: string;
|
|
5
|
+
ors_healthy: string;
|
|
6
|
+
pelias_healthy: boolean;
|
|
7
|
+
version: string;
|
|
8
|
+
vroom_healthy: boolean;
|
|
9
|
+
}
|
|
1
10
|
export interface PaymentMethod {
|
|
2
11
|
allow_redisplay: string;
|
|
3
12
|
autopay: boolean;
|
|
@@ -68,12 +77,16 @@ export interface MemberState {
|
|
|
68
77
|
}
|
|
69
78
|
export interface LineItem {
|
|
70
79
|
id: string;
|
|
80
|
+
line_item_type: "CUSTOM" | "ADDITIONAL_CHARGE" | "EVENT" | "SERVICE_MONTH";
|
|
71
81
|
name: string;
|
|
72
82
|
description: string;
|
|
73
83
|
cost: number | null;
|
|
74
84
|
amount: number | null;
|
|
75
85
|
time_created: number;
|
|
76
86
|
}
|
|
87
|
+
export interface CustomLineItem extends LineItem {
|
|
88
|
+
line_item_type: "CUSTOM";
|
|
89
|
+
}
|
|
77
90
|
export interface Reaction {
|
|
78
91
|
id: string;
|
|
79
92
|
message_id: string;
|
|
@@ -163,6 +176,8 @@ export interface Plan {
|
|
|
163
176
|
trial_period_days: number;
|
|
164
177
|
time_created: number;
|
|
165
178
|
time_updated: number;
|
|
179
|
+
available_to_new_companies?: boolean;
|
|
180
|
+
available_to?: string[];
|
|
166
181
|
}
|
|
167
182
|
export interface BillPayment {
|
|
168
183
|
id: string;
|
|
@@ -193,8 +208,8 @@ export interface User {
|
|
|
193
208
|
companies: UserCompanyAssociation[] | null;
|
|
194
209
|
email: string | null;
|
|
195
210
|
phone_number: string | null;
|
|
196
|
-
time_created:
|
|
197
|
-
time_updated:
|
|
211
|
+
time_created: number;
|
|
212
|
+
time_updated: number | null;
|
|
198
213
|
can_send_emails: boolean | null;
|
|
199
214
|
payment_methods: PaymentMethod[];
|
|
200
215
|
autopay_payment_types: string[];
|
|
@@ -209,20 +224,20 @@ export interface Break {
|
|
|
209
224
|
company_billable: boolean;
|
|
210
225
|
client_billable: boolean;
|
|
211
226
|
}
|
|
212
|
-
export interface ServiceMonth {
|
|
213
|
-
|
|
227
|
+
export interface ServiceMonth extends LineItem {
|
|
228
|
+
line_item_type: "SERVICE_MONTH";
|
|
214
229
|
job_name: string;
|
|
215
230
|
job_id: string | null;
|
|
231
|
+
job_address: string;
|
|
232
|
+
job_labels: string[];
|
|
216
233
|
bill_id: string | null;
|
|
217
|
-
cost: number;
|
|
218
234
|
billed: boolean;
|
|
219
235
|
paid: boolean;
|
|
220
|
-
|
|
221
|
-
time_created: number;
|
|
236
|
+
tasks: string[];
|
|
222
237
|
time_updated: number | null;
|
|
223
238
|
}
|
|
224
239
|
export interface Session {
|
|
225
|
-
|
|
240
|
+
id: string;
|
|
226
241
|
user_id: string;
|
|
227
242
|
company_id: string;
|
|
228
243
|
time_started: number;
|
|
@@ -230,7 +245,7 @@ export interface Session {
|
|
|
230
245
|
break_id: string;
|
|
231
246
|
is_paused: boolean;
|
|
232
247
|
team_id: string;
|
|
233
|
-
|
|
248
|
+
route_id: string;
|
|
234
249
|
breaks: Break[];
|
|
235
250
|
}
|
|
236
251
|
export interface Group {
|
|
@@ -244,6 +259,18 @@ export interface Group {
|
|
|
244
259
|
time_created: number;
|
|
245
260
|
time_updated: number;
|
|
246
261
|
}
|
|
262
|
+
export declare const NotificationLevel: {
|
|
263
|
+
readonly IN_APP: 0;
|
|
264
|
+
readonly EMAIL: 1;
|
|
265
|
+
readonly SMS: 2;
|
|
266
|
+
readonly PUSH: 3;
|
|
267
|
+
};
|
|
268
|
+
export type NotificationLevel = typeof NotificationLevel[keyof typeof NotificationLevel];
|
|
269
|
+
export declare const LoginResponse: {
|
|
270
|
+
readonly SUCCESS: "SUCCESS";
|
|
271
|
+
readonly NEEDS_TOTP: "NEEDS_TOTP";
|
|
272
|
+
};
|
|
273
|
+
export type LoginResponse = typeof LoginResponse[keyof typeof LoginResponse];
|
|
247
274
|
export interface UserCompanyAssociation {
|
|
248
275
|
id: string;
|
|
249
276
|
user: User;
|
|
@@ -252,9 +279,9 @@ export interface UserCompanyAssociation {
|
|
|
252
279
|
effective_permissions: string[];
|
|
253
280
|
time_created: number | null;
|
|
254
281
|
time_updated: number | null;
|
|
255
|
-
notification_setting:
|
|
282
|
+
notification_setting: NotificationLevel[];
|
|
256
283
|
share_email_company_wide: boolean;
|
|
257
|
-
notifications:
|
|
284
|
+
notifications: Notification[];
|
|
258
285
|
groups: string[];
|
|
259
286
|
}
|
|
260
287
|
export interface Email {
|
|
@@ -294,6 +321,7 @@ export interface Bill {
|
|
|
294
321
|
customer_email: string | null;
|
|
295
322
|
manual_emails: string[][];
|
|
296
323
|
users: BillUser[];
|
|
324
|
+
paid: boolean;
|
|
297
325
|
paid_at: number;
|
|
298
326
|
time_created: number;
|
|
299
327
|
time_updated: number;
|
|
@@ -301,7 +329,7 @@ export interface Bill {
|
|
|
301
329
|
intent_created_at: number;
|
|
302
330
|
intent_last_created_at: number;
|
|
303
331
|
payment: BillPayment | null;
|
|
304
|
-
line_items:
|
|
332
|
+
line_items: CustomLineItem[];
|
|
305
333
|
months: string[];
|
|
306
334
|
due_date: number;
|
|
307
335
|
}
|
|
@@ -323,18 +351,13 @@ export interface PlanPayment {
|
|
|
323
351
|
time_updated: number;
|
|
324
352
|
}
|
|
325
353
|
export interface Company {
|
|
326
|
-
events: _Event[];
|
|
327
|
-
months: ServiceMonth[];
|
|
328
354
|
id: string;
|
|
329
|
-
jobs: Job[];
|
|
330
355
|
name: string;
|
|
331
356
|
email: string;
|
|
332
|
-
routes: Route[];
|
|
333
|
-
teams: Team[];
|
|
334
357
|
emails: Email[];
|
|
335
358
|
skills: Skill[];
|
|
336
|
-
time_created:
|
|
337
|
-
time_updated:
|
|
359
|
+
time_created: number;
|
|
360
|
+
time_updated: number | null;
|
|
338
361
|
users: UserCompanyAssociation[];
|
|
339
362
|
use_client_side_customer_start_billing: boolean;
|
|
340
363
|
use_client_side_customer_stop_billing: boolean;
|
|
@@ -353,6 +376,8 @@ export interface Company {
|
|
|
353
376
|
billing_email_id: string;
|
|
354
377
|
num_events: number;
|
|
355
378
|
num_jobs: number;
|
|
379
|
+
num_routes: number;
|
|
380
|
+
num_teams: number;
|
|
356
381
|
bills: Bill[];
|
|
357
382
|
enabled_payment_methods: string[];
|
|
358
383
|
sessions: Session[];
|
|
@@ -416,6 +441,7 @@ export interface Job {
|
|
|
416
441
|
routes: RouteJob[];
|
|
417
442
|
subscribers: Subscription[];
|
|
418
443
|
manual_emails: string[][];
|
|
444
|
+
overdue_time: number;
|
|
419
445
|
last_completed_event: _Event | null;
|
|
420
446
|
last_event: _Event | null;
|
|
421
447
|
labels: string[];
|
|
@@ -438,6 +464,7 @@ export interface Task {
|
|
|
438
464
|
created_by: UserCompanyAssociation | null;
|
|
439
465
|
overdueness: number | null;
|
|
440
466
|
overdue_time: number;
|
|
467
|
+
last_completed_event: _Event | null;
|
|
441
468
|
last_event: _Event | null;
|
|
442
469
|
delay: number;
|
|
443
470
|
skills: string[];
|
|
@@ -471,22 +498,17 @@ export interface taskEndInfo {
|
|
|
471
498
|
internal_notes: string;
|
|
472
499
|
external_notes: string;
|
|
473
500
|
}
|
|
474
|
-
export interface AdditionalCharge {
|
|
475
|
-
|
|
476
|
-
time_created: number;
|
|
501
|
+
export interface AdditionalCharge extends LineItem {
|
|
502
|
+
line_item_type: "ADDITIONAL_CHARGE";
|
|
477
503
|
time_updated: number | null;
|
|
478
|
-
name: string;
|
|
479
|
-
amount: number;
|
|
480
504
|
}
|
|
481
|
-
export interface _Event {
|
|
505
|
+
export interface _Event extends LineItem {
|
|
482
506
|
breaks: string[];
|
|
483
|
-
|
|
484
|
-
name: string;
|
|
507
|
+
line_item_type: "EVENT";
|
|
485
508
|
internal_notes: string;
|
|
486
509
|
external_notes: string;
|
|
487
510
|
proofs: string[];
|
|
488
511
|
tasks: string[];
|
|
489
|
-
time_created: number;
|
|
490
512
|
time_ended: number;
|
|
491
513
|
time_started: number;
|
|
492
514
|
time_updated: number | null;
|
|
@@ -498,9 +520,75 @@ export interface _Event {
|
|
|
498
520
|
additional_charges: AdditionalCharge[];
|
|
499
521
|
user_id: string;
|
|
500
522
|
team_id: string;
|
|
501
|
-
cost: number;
|
|
502
523
|
billed: boolean;
|
|
503
524
|
paid: boolean;
|
|
504
525
|
autostart: boolean;
|
|
505
526
|
job_labels: string[];
|
|
506
527
|
}
|
|
528
|
+
export interface FinancialInsightData {
|
|
529
|
+
start: number;
|
|
530
|
+
end: number;
|
|
531
|
+
unbilled: {
|
|
532
|
+
events: {
|
|
533
|
+
count: number;
|
|
534
|
+
amount: number;
|
|
535
|
+
};
|
|
536
|
+
service_months: {
|
|
537
|
+
count: number;
|
|
538
|
+
amount: number;
|
|
539
|
+
};
|
|
540
|
+
total: number;
|
|
541
|
+
};
|
|
542
|
+
billed_unbilled: {
|
|
543
|
+
events: {
|
|
544
|
+
count: number;
|
|
545
|
+
amount: number;
|
|
546
|
+
};
|
|
547
|
+
service_months: {
|
|
548
|
+
count: number;
|
|
549
|
+
amount: number;
|
|
550
|
+
};
|
|
551
|
+
total: number;
|
|
552
|
+
};
|
|
553
|
+
paid_unbilled: {
|
|
554
|
+
events: {
|
|
555
|
+
count: number;
|
|
556
|
+
amount: number;
|
|
557
|
+
};
|
|
558
|
+
service_months: {
|
|
559
|
+
count: number;
|
|
560
|
+
amount: number;
|
|
561
|
+
};
|
|
562
|
+
total: number;
|
|
563
|
+
};
|
|
564
|
+
prepaid: {
|
|
565
|
+
events: {
|
|
566
|
+
count: number;
|
|
567
|
+
amount: number;
|
|
568
|
+
};
|
|
569
|
+
service_months: {
|
|
570
|
+
count: number;
|
|
571
|
+
amount: number;
|
|
572
|
+
};
|
|
573
|
+
total: number;
|
|
574
|
+
};
|
|
575
|
+
accounts_receivable: {
|
|
576
|
+
overdue: number;
|
|
577
|
+
not_overdue: number;
|
|
578
|
+
};
|
|
579
|
+
cash: number;
|
|
580
|
+
}
|
|
581
|
+
export interface EventInsightData {
|
|
582
|
+
start: number;
|
|
583
|
+
end: number;
|
|
584
|
+
events_per_job: {
|
|
585
|
+
id: string;
|
|
586
|
+
name: string;
|
|
587
|
+
event_count: number;
|
|
588
|
+
}[];
|
|
589
|
+
events_per_team: {
|
|
590
|
+
team_id: string;
|
|
591
|
+
event_count: number;
|
|
592
|
+
}[];
|
|
593
|
+
total_events: number;
|
|
594
|
+
}
|
package/dist/types/api.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@go-avro/avro-js",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.71",
|
|
4
4
|
"description": "JS client for Avro backend integration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"license": "CC-BY-SA-4.0",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/jest": "^29.0.0",
|
|
36
|
+
"@types/react": "^19.2.2",
|
|
36
37
|
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
37
38
|
"@typescript-eslint/parser": "^8.38.0",
|
|
38
39
|
"eslint": "^8.57.1",
|
|
@@ -50,5 +51,9 @@
|
|
|
50
51
|
],
|
|
51
52
|
"publishConfig": {
|
|
52
53
|
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@tanstack/react-query": "^5.90.2",
|
|
57
|
+
"socket.io-client": "^4.8.1"
|
|
53
58
|
}
|
|
54
59
|
}
|