@go-avro/avro-js 0.0.3 → 0.0.4-beta.10

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 (84) hide show
  1. package/dist/client/QueryClient.d.ts +7 -0
  2. package/dist/client/QueryClient.js +9 -6
  3. package/dist/client/hooks/bills.js +1 -0
  4. package/dist/client/hooks/events.js +2 -0
  5. package/dist/client/hooks/jobs.js +8 -1
  6. package/dist/client/hooks/months.js +2 -0
  7. package/dist/client/hooks/prepayments.js +2 -0
  8. package/dist/client/hooks/proposal.js +8 -1
  9. package/dist/client/hooks/users.js +4 -1
  10. package/dist/types/api/AdditionalCharge.d.ts +5 -0
  11. package/dist/types/api/AdditionalCharge.js +1 -0
  12. package/dist/types/api/Avro.d.ts +11 -0
  13. package/dist/types/api/Avro.js +1 -0
  14. package/dist/types/api/Bill.d.ts +27 -0
  15. package/dist/types/api/Bill.js +1 -0
  16. package/dist/types/api/BillPayment.d.ts +13 -0
  17. package/dist/types/api/BillPayment.js +1 -0
  18. package/dist/types/api/BillUser.d.ts +11 -0
  19. package/dist/types/api/BillUser.js +1 -0
  20. package/dist/types/api/Break.d.ts +7 -0
  21. package/dist/types/api/Break.js +1 -0
  22. package/dist/types/api/CatalogItem.d.ts +16 -0
  23. package/dist/types/api/CatalogItem.js +1 -0
  24. package/dist/types/api/Chat.d.ts +12 -0
  25. package/dist/types/api/Chat.js +1 -0
  26. package/dist/types/api/Company.d.ts +58 -0
  27. package/dist/types/api/Company.js +1 -0
  28. package/dist/types/api/CustomLineItem.d.ts +4 -0
  29. package/dist/types/api/CustomLineItem.js +1 -0
  30. package/dist/types/api/Email.d.ts +21 -0
  31. package/dist/types/api/Email.js +1 -0
  32. package/dist/types/api/Friendship.d.ts +2 -0
  33. package/dist/types/api/Friendship.js +1 -0
  34. package/dist/types/api/Group.d.ts +12 -0
  35. package/dist/types/api/Group.js +1 -0
  36. package/dist/types/api/Job.d.ts +29 -0
  37. package/dist/types/api/Job.js +1 -0
  38. package/dist/types/api/Label.d.ts +7 -0
  39. package/dist/types/api/Label.js +1 -0
  40. package/dist/types/api/LineItem.d.ts +41 -0
  41. package/dist/types/api/LineItem.js +30 -0
  42. package/dist/types/api/MemberState.d.ts +7 -0
  43. package/dist/types/api/MemberState.js +1 -0
  44. package/dist/types/api/Message.d.ts +13 -0
  45. package/dist/types/api/Message.js +1 -0
  46. package/dist/types/api/PaymentMethod.d.ts +51 -0
  47. package/dist/types/api/PaymentMethod.js +1 -0
  48. package/dist/types/api/PaymentOption.d.ts +9 -0
  49. package/dist/types/api/PaymentOption.js +1 -0
  50. package/dist/types/api/PaymentType.d.ts +5 -0
  51. package/dist/types/api/PaymentType.js +5 -0
  52. package/dist/types/api/Plan.d.ts +13 -0
  53. package/dist/types/api/Plan.js +1 -0
  54. package/dist/types/api/PlanPayment.d.ts +10 -0
  55. package/dist/types/api/PlanPayment.js +1 -0
  56. package/dist/types/api/Prepayment.d.ts +15 -0
  57. package/dist/types/api/Prepayment.js +7 -0
  58. package/dist/types/api/Reaction.d.ts +8 -0
  59. package/dist/types/api/Reaction.js +1 -0
  60. package/dist/types/api/Route.d.ts +19 -0
  61. package/dist/types/api/Route.js +1 -0
  62. package/dist/types/api/RouteJob.d.ts +10 -0
  63. package/dist/types/api/RouteJob.js +1 -0
  64. package/dist/types/api/ServiceMonth.d.ts +7 -0
  65. package/dist/types/api/ServiceMonth.js +1 -0
  66. package/dist/types/api/Session.d.ts +13 -0
  67. package/dist/types/api/Session.js +1 -0
  68. package/dist/types/api/Skill.d.ts +7 -0
  69. package/dist/types/api/Skill.js +1 -0
  70. package/dist/types/api/Subscription.d.ts +8 -0
  71. package/dist/types/api/Subscription.js +1 -0
  72. package/dist/types/api/Task.d.ts +52 -0
  73. package/dist/types/api/Task.js +43 -0
  74. package/dist/types/api/User.d.ts +23 -0
  75. package/dist/types/api/User.js +1 -0
  76. package/dist/types/api/UserCompanyAssociation.d.ts +70 -0
  77. package/dist/types/api/UserCompanyAssociation.js +53 -0
  78. package/dist/types/api/UserEvent.d.ts +13 -0
  79. package/dist/types/api/UserEvent.js +1 -0
  80. package/dist/types/api/_Event.d.ts +19 -0
  81. package/dist/types/api/_Event.js +1 -0
  82. package/dist/types/api.d.ts +45 -586
  83. package/dist/types/api.js +36 -69
  84. package/package.json +1 -1
@@ -52,6 +52,7 @@ declare module '../client/QueryClient' {
52
52
  billed?: boolean;
53
53
  paid?: boolean;
54
54
  jobId?: string;
55
+ enabled?: boolean;
55
56
  }): UseInfiniteQueryResult<InfiniteData<_Event[], unknown>, StandardError>;
56
57
  useGetSessions(body: {
57
58
  amt?: number;
@@ -72,6 +73,7 @@ declare module '../client/QueryClient' {
72
73
  billed?: boolean;
73
74
  paid?: boolean;
74
75
  taskId?: string;
76
+ enabled?: boolean;
75
77
  }): UseInfiniteQueryResult<InfiniteData<Prepayment[], unknown>, StandardError>;
76
78
  useGetMessages(chatId: string, body: {
77
79
  amt?: number;
@@ -88,6 +90,7 @@ declare module '../client/QueryClient' {
88
90
  billed?: boolean;
89
91
  paid?: boolean;
90
92
  jobId?: string;
93
+ enabled?: boolean;
91
94
  }): UseInfiniteQueryResult<InfiniteData<ServiceMonth[], unknown>, StandardError>;
92
95
  useGetBills(body: {
93
96
  amt?: number;
@@ -210,10 +213,13 @@ declare module '../client/QueryClient' {
210
213
  useCreateSelf(): ReturnType<typeof useMutation<{
211
214
  msg: string;
212
215
  id?: string;
216
+ access_token?: string;
217
+ refresh_token?: string;
213
218
  }, StandardError, Partial<User> & {
214
219
  code?: string;
215
220
  invite_token?: string;
216
221
  password?: string;
222
+ company_id?: string;
217
223
  }>>;
218
224
  useCreateSessionBreak(): ReturnType<typeof useMutation<{
219
225
  id: string;
@@ -415,6 +421,7 @@ export declare class AvroQueryClient {
415
421
  post<T>(path: string, data: any, cancelToken?: CancelToken, headers?: Record<string, string>, progressUpdateCallback?: (loaded: number, total: number) => void): Promise<T>;
416
422
  put<T>(path: string, data: any, cancelToken?: CancelToken, headers?: Record<string, string>, progressUpdateCallback?: (loaded: number, total: number) => void): Promise<T>;
417
423
  delete<T>(path: string, cancelToken?: CancelToken, headers?: Record<string, string>, progressUpdateCallback?: (loaded: number, total: number) => void): Promise<T>;
424
+ loginSuccess(tokens: Tokens): Promise<void>;
418
425
  useLogin(): ReturnType<typeof useMutation<LoginResponse, StandardError, {
419
426
  username: string;
420
427
  password?: string;
@@ -82,6 +82,14 @@ export class AvroQueryClient {
82
82
  delete(path, cancelToken, headers = {}, progressUpdateCallback) {
83
83
  return this._xhr('DELETE', path, null, cancelToken, headers, false, this.config.maxRetries, progressUpdateCallback);
84
84
  }
85
+ loginSuccess(tokens) {
86
+ this.setAuthState(AuthState.AUTHENTICATED);
87
+ this.socket.auth = { token: tokens.access_token };
88
+ if (!this.socket.connected) {
89
+ this.socket.connect();
90
+ }
91
+ return this.config.authManager.setTokens(tokens);
92
+ }
85
93
  useLogin() {
86
94
  const queryClient = this.getQueryClient();
87
95
  return useMutation({
@@ -93,12 +101,7 @@ export class AvroQueryClient {
93
101
  }
94
102
  throw new StandardError(401, 'Invalid login response');
95
103
  }
96
- this.setAuthState(AuthState.AUTHENTICATED);
97
- this.socket.auth = { token: resp.access_token };
98
- if (!this.socket.connected) {
99
- this.socket.connect();
100
- }
101
- await this.config.authManager.setTokens({ access_token: resp.access_token, refresh_token: resp.refresh_token });
104
+ await this.loginSuccess({ access_token: resp.access_token, refresh_token: resp.refresh_token });
102
105
  return LoginResponse.SUCCESS;
103
106
  },
104
107
  onSettled: () => {
@@ -45,6 +45,7 @@ AvroQueryClient.prototype.useCreateBill = function () {
45
45
  line_items: data.line_items ?? [],
46
46
  manual_emails: data.manual_emails ?? [],
47
47
  prepayments: data.prepayments ?? [],
48
+ enabled_payment_methods: data.enabled_payment_methods ?? [],
48
49
  users: data.users,
49
50
  due_date: data.due_date,
50
51
  };
@@ -15,6 +15,7 @@ AvroQueryClient.prototype.useGetEvents = function (body) {
15
15
  body.billed ?? true,
16
16
  body.paid ?? true,
17
17
  body.jobId ?? '',
18
+ body.enabled ?? true,
18
19
  ],
19
20
  initialPageParam: 0,
20
21
  getNextPageParam: (lastPage, allPages) => {
@@ -23,6 +24,7 @@ AvroQueryClient.prototype.useGetEvents = function (body) {
23
24
  return allPages.flat().length; // next offset
24
25
  },
25
26
  queryFn: ({ pageParam = 0 }) => this.fetchEvents({ ...body, offset: pageParam }),
27
+ enabled: body.enabled ?? true,
26
28
  });
27
29
  if (result.data) {
28
30
  result.data.pages.forEach((data_page) => {
@@ -1,5 +1,6 @@
1
1
  import { useMutation, useQuery, useInfiniteQuery } from '@tanstack/react-query';
2
2
  import { AvroQueryClient } from '../../client/QueryClient';
3
+ import { Task } from '../../types/api';
3
4
  AvroQueryClient.prototype.getJobsFromCache = function (queryClient) {
4
5
  if (!queryClient) {
5
6
  queryClient = this.getQueryClient();
@@ -27,6 +28,7 @@ AvroQueryClient.prototype.useGetJobs = function (params) {
27
28
  const pages = await Promise.all(trackedPromises);
28
29
  const jobs = pages.flat();
29
30
  jobs.forEach((job) => {
31
+ job.tasks = job.tasks.map((task) => new Task(task));
30
32
  job.current_event = job.tasks.reduce((latest, task) => {
31
33
  return task.current_event && (!latest || task.current_event.time_started > latest.time_started) ? task.current_event : latest;
32
34
  }, job.current_event);
@@ -64,6 +66,7 @@ AvroQueryClient.prototype.useGetInfiniteJobs = function (body, onProgress) {
64
66
  if (result.data) {
65
67
  result.data.pages.forEach((data_page) => {
66
68
  data_page.forEach((job) => {
69
+ job.tasks = job.tasks.map((task) => new Task(task));
67
70
  job.overdue_time = (job.tasks || []).reduce((maxOverdue, task) => {
68
71
  return (task.overdue_time && task.overdue_time > maxOverdue) ? task.overdue_time : maxOverdue;
69
72
  }, 0);
@@ -76,7 +79,11 @@ AvroQueryClient.prototype.useGetInfiniteJobs = function (body, onProgress) {
76
79
  AvroQueryClient.prototype.useGetJob = function (jobId) {
77
80
  return useQuery({
78
81
  queryKey: ['job', jobId],
79
- queryFn: () => this.get(`/job/${jobId}`),
82
+ queryFn: async () => {
83
+ const job = await this.get(`/job/${jobId}`);
84
+ job.tasks = job.tasks.map((task) => new Task(task));
85
+ return job;
86
+ },
80
87
  enabled: Boolean(jobId),
81
88
  });
82
89
  };
@@ -15,6 +15,7 @@ AvroQueryClient.prototype.useGetMonths = function (body) {
15
15
  body.billed ?? true,
16
16
  body.paid ?? true,
17
17
  body.jobId ?? '',
18
+ body.enabled ?? true,
18
19
  ],
19
20
  initialPageParam: 0,
20
21
  getNextPageParam: (lastPage, allPages) => {
@@ -23,6 +24,7 @@ AvroQueryClient.prototype.useGetMonths = function (body) {
23
24
  return allPages.flat().length; // next offset
24
25
  },
25
26
  queryFn: ({ pageParam = 0 }) => this.fetchMonths({ ...body, offset: pageParam }),
27
+ enabled: body.enabled ?? true,
26
28
  });
27
29
  if (result.data) {
28
30
  result.data.pages.forEach((data_page) => {
@@ -14,6 +14,7 @@ AvroQueryClient.prototype.useGetPrepayments = function (body) {
14
14
  body.billed ?? true,
15
15
  body.paid ?? true,
16
16
  body.taskId ?? '',
17
+ body.enabled ?? true,
17
18
  ],
18
19
  initialPageParam: 0,
19
20
  getNextPageParam: (lastPage, allPages) => {
@@ -22,6 +23,7 @@ AvroQueryClient.prototype.useGetPrepayments = function (body) {
22
23
  return allPages.flat().length; // next offset
23
24
  },
24
25
  queryFn: ({ pageParam = 0 }) => this.fetchPrepayments({ ...body, offset: pageParam }),
26
+ enabled: body.enabled ?? true,
25
27
  });
26
28
  if (result.data) {
27
29
  result.data.pages.forEach((data_page) => {
@@ -1,5 +1,6 @@
1
1
  import { useMutation, useQuery } from "@tanstack/react-query";
2
2
  import { AvroQueryClient } from "../../client/QueryClient";
3
+ import { Task } from "../../types/api/Task";
3
4
  AvroQueryClient.prototype.useCreateProposal = function () {
4
5
  return useMutation({
5
6
  mutationFn: async ({ job_id, data }) => {
@@ -17,6 +18,12 @@ AvroQueryClient.prototype.useAcceptProposal = function (proposal_id) {
17
18
  AvroQueryClient.prototype.useGetProposal = function (proposal_id) {
18
19
  return useQuery({
19
20
  queryKey: ['proposal', proposal_id],
20
- queryFn: async () => this.get(`/proposal/${proposal_id}`),
21
+ queryFn: async () => {
22
+ const proposal = await this.get(`/proposal/${proposal_id}`);
23
+ if (proposal && Array.isArray(proposal.tasks)) {
24
+ proposal.tasks = proposal.tasks.map((task) => new Task(task));
25
+ }
26
+ return proposal;
27
+ },
21
28
  });
22
29
  };
@@ -32,8 +32,11 @@ AvroQueryClient.prototype.useCreateSelf = function () {
32
32
  mutationFn: async (data) => {
33
33
  return this.post('/user', JSON.stringify(data), undefined, { "Content-Type": "application/json" });
34
34
  },
35
- onSettled: () => {
35
+ onSettled: (data) => {
36
36
  queryClient.invalidateQueries({ queryKey: ['user'] });
37
+ if (data?.access_token && data?.refresh_token) {
38
+ return this.loginSuccess({ access_token: data.access_token, refresh_token: data.refresh_token });
39
+ }
37
40
  },
38
41
  });
39
42
  };
@@ -0,0 +1,5 @@
1
+ import { LineItem } from "../../types/api/LineItem";
2
+ export interface AdditionalCharge extends LineItem {
3
+ line_item_type: "ADDITIONAL_CHARGE";
4
+ time_updated: number | null;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Email } from "../../types/api/Email";
2
+ export interface Avro {
3
+ id: string;
4
+ name: string;
5
+ time_created: number;
6
+ time_updated: number;
7
+ emails: Email[];
8
+ totp_email_id: string;
9
+ billing_email_id: string;
10
+ join_email_id: string;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { BillPayment } from "../../types/api/BillPayment";
2
+ import { BillUser } from "../../types/api/BillUser";
3
+ import { CustomLineItem } from "../../types/api/CustomLineItem";
4
+ import { PaymentType } from "../../types/api/PaymentType";
5
+ export interface Bill {
6
+ id: string;
7
+ invoice_id: number;
8
+ intuit_id: string | null;
9
+ name: string;
10
+ amount: number;
11
+ billed_by: string;
12
+ customer_email: string | null;
13
+ manual_emails: string[][];
14
+ users: BillUser[];
15
+ status: "SENT" | "PAID" | "PARTIALLY_PAID" | "MANUALLY_PAID";
16
+ enabled_payment_methods: PaymentType[];
17
+ time_created: number;
18
+ time_updated: number;
19
+ events: string[];
20
+ intent_created_at: number;
21
+ intent_last_created_at: number;
22
+ payments: BillPayment[];
23
+ line_items: CustomLineItem[];
24
+ prepayments: string[];
25
+ months: string[];
26
+ due_date: number;
27
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export interface BillPayment {
2
+ id: string;
3
+ amount: number;
4
+ avro_fees: number;
5
+ stripe_fees: number;
6
+ stripe_pi_id: string;
7
+ bill_user_id: string;
8
+ status: "created" | "processing" | "succeeded" | "failed" | "canceled" | "requires_action";
9
+ type: "us_bank_account" | "card";
10
+ action_required_at: number;
11
+ time_created: number;
12
+ time_updated: number | null;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { BillPayment } from "../../types/api/BillPayment";
2
+ export interface BillUser {
3
+ id: string;
4
+ user_id: string;
5
+ bill_id: string;
6
+ invoice_id: string;
7
+ payment_attempts: BillPayment[];
8
+ time_created: number;
9
+ time_updated: number | null;
10
+ amount: number;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface Break {
2
+ id: string;
3
+ time_started: number;
4
+ time_ended: number;
5
+ company_billable: boolean;
6
+ client_billable: boolean;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { PaymentOption } from "../../types/api/PaymentOption";
2
+ export interface CatalogItem {
3
+ id: string;
4
+ name: string;
5
+ company_id: string;
6
+ description: string;
7
+ industry: string;
8
+ price_format: string;
9
+ payment_options: PaymentOption[];
10
+ recommended_frequency?: number | null;
11
+ recommended_activate_on?: number | null;
12
+ recommended_expire_on?: number | null;
13
+ time_created: number;
14
+ time_updated: number | null;
15
+ skills: string[];
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Message } from "../../types/api/Message";
2
+ import { MemberState } from "../../types/api/MemberState";
3
+ export interface Chat {
4
+ id: string;
5
+ name: string;
6
+ company_id: string;
7
+ time_created: number;
8
+ time_updated: number;
9
+ last_message: Message;
10
+ user_state: MemberState[];
11
+ messages: Message[];
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,58 @@
1
+ import { Bill } from "../../types/api/Bill";
2
+ import { Email } from "../../types/api/Email";
3
+ import { Group } from "../../types/api/Group";
4
+ import { Label } from "../../types/api/Label";
5
+ import { PaymentMethod } from "../../types/api/PaymentMethod";
6
+ import { PaymentType } from "../../types/api/PaymentType";
7
+ import { Plan } from "../../types/api/Plan";
8
+ import { PlanPayment } from "../../types/api/PlanPayment";
9
+ import { Session } from "../../types/api/Session";
10
+ import { Skill } from "../../types/api/Skill";
11
+ import { UserCompanyAssociation } from "../../types/api/UserCompanyAssociation";
12
+ import { CatalogItem } from "../../types/api/CatalogItem";
13
+ export interface Company {
14
+ id: string;
15
+ name: string;
16
+ email: string;
17
+ emails: Email[];
18
+ skills: Skill[];
19
+ catalog_items: CatalogItem[];
20
+ time_created: number;
21
+ time_updated: number | null;
22
+ users: UserCompanyAssociation[];
23
+ use_client_side_customer_start_billing: boolean;
24
+ use_client_side_customer_stop_billing: boolean;
25
+ use_client_side_employee_start_billing: boolean;
26
+ use_client_side_employee_stop_billing: boolean;
27
+ logo_url: string;
28
+ delay_scalar: number;
29
+ payments: PlanPayment[];
30
+ overdue_threshold: number;
31
+ stripe_account_id: string;
32
+ is_restricted: boolean;
33
+ disabled_reason: string;
34
+ completed_onboarding: boolean;
35
+ restricted_soon: boolean;
36
+ service_email_id: string;
37
+ billing_email_id: string;
38
+ num_events: number;
39
+ num_jobs: number;
40
+ num_routes: number;
41
+ num_teams: number;
42
+ num_skills: number;
43
+ bills: Bill[];
44
+ enabled_payment_methods: PaymentType[];
45
+ sessions: Session[];
46
+ num_sessions: number;
47
+ labels: Label[];
48
+ groups: Group[];
49
+ indicator_lifetime: number;
50
+ available_plans: Plan[];
51
+ last_payment: number;
52
+ last_charged: number;
53
+ balance: number;
54
+ plan_id: string;
55
+ payment_methods: PaymentMethod[];
56
+ intuit_connected: boolean;
57
+ next_payment_due: number | null;
58
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { LineItem } from "../../types/api/LineItem";
2
+ export interface CustomLineItem extends LineItem {
3
+ line_item_type: "CUSTOM";
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { User } from "../../types/api/User";
2
+ export interface Email {
3
+ id: string;
4
+ company_id: string;
5
+ name: string;
6
+ mail_server: string;
7
+ mail_port: number;
8
+ mail_username: string;
9
+ mail_password: string | null;
10
+ mail_default_sender: string;
11
+ mail_use_tls: boolean;
12
+ mail_use_ssl: boolean;
13
+ mail_api_key: string;
14
+ is_company_wide: boolean;
15
+ users: User[];
16
+ type: "OUTLOOK" | "SMTP" | "GMAIL";
17
+ access_token?: string;
18
+ access_token_expiry?: number;
19
+ refresh_token?: string;
20
+ refresh_token_expiry?: number;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export interface Friendship {
2
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Permission } from "../../types/api/UserCompanyAssociation";
2
+ export interface Group {
3
+ id: string;
4
+ name: string;
5
+ is_active: boolean;
6
+ is_user_type: boolean;
7
+ users: string[];
8
+ permissions: Permission[];
9
+ company_id: string;
10
+ time_created: number;
11
+ time_updated: number;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { Task } from "../../types/api/Task";
2
+ import { _Event } from "../../types/api/_Event";
3
+ import { RouteJob } from "../../types/api/RouteJob";
4
+ import { Subscription } from "../../types/api/Subscription";
5
+ export interface Job {
6
+ address: string;
7
+ company: string;
8
+ description: string;
9
+ id: string;
10
+ is_one_time: boolean;
11
+ autostart_radius: number;
12
+ latitude: number;
13
+ longitude: number;
14
+ name: string;
15
+ internal_notes: string;
16
+ external_notes: string;
17
+ priority: number;
18
+ tasks: Partial<Task>[];
19
+ time_created: number;
20
+ time_updated: number | null;
21
+ routes: RouteJob[];
22
+ subscribers: Subscription[];
23
+ manual_emails: string[][];
24
+ overdue_time: number;
25
+ last_completed_event: _Event | null;
26
+ current_event: _Event | null;
27
+ labels: string[];
28
+ owner: string;
29
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface Label {
2
+ name: string;
3
+ id: string;
4
+ company_id: string;
5
+ color: string;
6
+ jobs: string[];
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ export declare const LineItemStatus: {
2
+ readonly CREATED: "CREATED";
3
+ readonly EXTERNALLY_BILLED: "EXTERNALLY_BILLED";
4
+ readonly BILLED: "BILLED";
5
+ readonly PROCESSING: "PROCESSING";
6
+ readonly EXTERNALLY_PAID: "EXTERNALLY_PAID";
7
+ readonly PREPAID: "PREPAID";
8
+ readonly PAID: "PAID";
9
+ };
10
+ export type LineItemStatus = typeof LineItemStatus[keyof typeof LineItemStatus];
11
+ export declare const LineItemType: {
12
+ readonly CUSTOM: "CUSTOM";
13
+ readonly ADDITIONAL_CHARGE: "ADDITIONAL_CHARGE";
14
+ readonly EVENT: "EVENT";
15
+ readonly SERVICE_MONTH: "SERVICE_MONTH";
16
+ readonly PREPAYMENT: "PREPAYMENT";
17
+ };
18
+ export type LineItemType = typeof LineItemType[keyof typeof LineItemType];
19
+ declare module '../../types/api/LineItem' {
20
+ interface LineItem {
21
+ id: string;
22
+ line_item_type: LineItemType;
23
+ name: string;
24
+ description: string;
25
+ cost: number;
26
+ amount: number;
27
+ status: LineItemStatus;
28
+ job_id: string;
29
+ job_name: string;
30
+ job_address: string;
31
+ job_labels: string[];
32
+ company_id: string;
33
+ time_created: number;
34
+ }
35
+ }
36
+ export declare class LineItem {
37
+ constructor(init?: Partial<LineItem>);
38
+ isPaid: () => boolean;
39
+ isBilled: () => boolean;
40
+ isUnbilled: () => boolean;
41
+ }
@@ -0,0 +1,30 @@
1
+ export const LineItemStatus = {
2
+ CREATED: "CREATED",
3
+ EXTERNALLY_BILLED: "EXTERNALLY_BILLED",
4
+ BILLED: "BILLED",
5
+ PROCESSING: "PROCESSING",
6
+ EXTERNALLY_PAID: "EXTERNALLY_PAID",
7
+ PREPAID: "PREPAID",
8
+ PAID: "PAID",
9
+ };
10
+ export const LineItemType = {
11
+ CUSTOM: "CUSTOM",
12
+ ADDITIONAL_CHARGE: "ADDITIONAL_CHARGE",
13
+ EVENT: "EVENT",
14
+ SERVICE_MONTH: "SERVICE_MONTH",
15
+ PREPAYMENT: "PREPAYMENT",
16
+ };
17
+ export class LineItem {
18
+ constructor(init) {
19
+ this.isPaid = () => {
20
+ return this.status === LineItemStatus.PAID || this.status === LineItemStatus.PREPAID || this.status === LineItemStatus.EXTERNALLY_PAID;
21
+ };
22
+ this.isBilled = () => {
23
+ return this.status === LineItemStatus.BILLED || this.status === LineItemStatus.EXTERNALLY_BILLED;
24
+ };
25
+ this.isUnbilled = () => {
26
+ return !this.isBilled() && !this.isPaid();
27
+ };
28
+ Object.assign(this, init);
29
+ }
30
+ }
@@ -0,0 +1,7 @@
1
+ import { Friendship } from "../../types/api/Friendship";
2
+ export interface MemberState {
3
+ id: string;
4
+ state: string;
5
+ friendship: Friendship | null;
6
+ last_message_read_at: number | null;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { Reaction } from "../../types/api/Reaction";
2
+ export interface Message {
3
+ id: string;
4
+ chat_id: string;
5
+ sender_id: string;
6
+ reply_to_id: string;
7
+ content: string;
8
+ reactions: Reaction[];
9
+ time_created: number;
10
+ time_updated: number;
11
+ time_sent: number;
12
+ message: string;
13
+ }
@@ -0,0 +1 @@
1
+ export {};