@go-avro/avro-js 0.0.2-beta.15 → 0.0.2-beta.151

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 (62) hide show
  1. package/README.md +1 -0
  2. package/dist/auth/AuthManager.d.ts +14 -5
  3. package/dist/auth/AuthManager.js +59 -23
  4. package/dist/auth/storage.d.ts +8 -8
  5. package/dist/auth/storage.js +19 -14
  6. package/dist/client/AvroQueryClientProvider.d.ts +14 -0
  7. package/dist/client/AvroQueryClientProvider.js +32 -0
  8. package/dist/client/QueryClient.d.ts +492 -16
  9. package/dist/client/QueryClient.js +396 -214
  10. package/dist/client/core/fetch.d.ts +1 -0
  11. package/dist/client/core/fetch.js +64 -0
  12. package/dist/client/core/utils.d.ts +1 -0
  13. package/dist/client/core/utils.js +14 -0
  14. package/dist/client/core/xhr.d.ts +1 -0
  15. package/dist/client/core/xhr.js +90 -0
  16. package/dist/client/hooks/analytics.d.ts +1 -0
  17. package/dist/client/hooks/analytics.js +26 -0
  18. package/dist/client/hooks/avro.d.ts +1 -0
  19. package/dist/client/hooks/avro.js +9 -0
  20. package/dist/client/hooks/bills.d.ts +1 -0
  21. package/dist/client/hooks/bills.js +165 -0
  22. package/dist/client/hooks/chats.d.ts +1 -0
  23. package/dist/client/hooks/chats.js +37 -0
  24. package/dist/client/hooks/companies.d.ts +1 -0
  25. package/dist/client/hooks/companies.js +152 -0
  26. package/dist/client/hooks/events.d.ts +1 -0
  27. package/dist/client/hooks/events.js +308 -0
  28. package/dist/client/hooks/groups.d.ts +1 -0
  29. package/dist/client/hooks/groups.js +130 -0
  30. package/dist/client/hooks/jobs.d.ts +1 -0
  31. package/dist/client/hooks/jobs.js +213 -0
  32. package/dist/client/hooks/labels.d.ts +1 -0
  33. package/dist/client/hooks/labels.js +130 -0
  34. package/dist/client/hooks/messages.d.ts +1 -0
  35. package/dist/client/hooks/messages.js +30 -0
  36. package/dist/client/hooks/months.d.ts +1 -0
  37. package/dist/client/hooks/months.js +93 -0
  38. package/dist/client/hooks/plans.d.ts +1 -0
  39. package/dist/client/hooks/plans.js +8 -0
  40. package/dist/client/hooks/proposal.d.ts +1 -0
  41. package/dist/client/hooks/proposal.js +22 -0
  42. package/dist/client/hooks/root.d.ts +1 -0
  43. package/dist/client/hooks/root.js +8 -0
  44. package/dist/client/hooks/routes.d.ts +1 -0
  45. package/dist/client/hooks/routes.js +167 -0
  46. package/dist/client/hooks/sessions.d.ts +1 -0
  47. package/dist/client/hooks/sessions.js +175 -0
  48. package/dist/client/hooks/skills.d.ts +1 -0
  49. package/dist/client/hooks/skills.js +123 -0
  50. package/dist/client/hooks/teams.d.ts +1 -0
  51. package/dist/client/hooks/teams.js +128 -0
  52. package/dist/client/hooks/users.d.ts +1 -0
  53. package/dist/client/hooks/users.js +118 -0
  54. package/dist/index.d.ts +26 -1
  55. package/dist/index.js +26 -1
  56. package/dist/types/api.d.ts +146 -38
  57. package/dist/types/api.js +10 -1
  58. package/dist/types/auth.d.ts +6 -5
  59. package/dist/types/auth.js +5 -1
  60. package/dist/types/cache.d.ts +9 -0
  61. package/dist/types/cache.js +1 -0
  62. package/package.json +6 -4
@@ -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;
@@ -104,10 +117,13 @@ export interface Chat {
104
117
  user_state: MemberState[];
105
118
  messages: Message[];
106
119
  }
107
- export interface TeamLocation {
120
+ export interface Location {
108
121
  accuracy: number;
109
122
  heading: number;
110
123
  id: string;
124
+ team_id: string | null;
125
+ user_company_id: string;
126
+ user_id: string;
111
127
  latitude: number;
112
128
  longitude: number;
113
129
  time_collected: number;
@@ -140,14 +156,13 @@ export interface Team {
140
156
  end_longitude: number;
141
157
  start_time: number;
142
158
  users: string[];
143
- current_location: TeamLocation;
159
+ current_location: Location | null;
144
160
  start_address: string;
145
161
  end_address: string;
146
162
  }
147
163
  export interface Subscription {
148
164
  time_created: number;
149
165
  time_updated: string;
150
- user: User;
151
166
  user_company_id: string;
152
167
  job_id: string;
153
168
  id: string;
@@ -163,10 +178,14 @@ export interface Plan {
163
178
  trial_period_days: number;
164
179
  time_created: number;
165
180
  time_updated: number;
181
+ available_to_new_companies?: boolean;
182
+ available_to?: string[];
166
183
  }
167
184
  export interface BillPayment {
168
185
  id: string;
169
186
  amount: number;
187
+ avro_fees: number;
188
+ stripe_fees: number;
170
189
  stripe_pi_id: string;
171
190
  bill_user_id: string;
172
191
  status: "created" | "processing" | "succeeded" | "failed" | "canceled" | "requires_action";
@@ -190,17 +209,18 @@ export interface User {
190
209
  username: string;
191
210
  name: string;
192
211
  verified: boolean;
193
- companies: UserCompanyAssociation[] | null;
194
212
  email: string | null;
195
213
  phone_number: string | null;
196
- time_created: string | null;
197
- time_updated: string | null;
214
+ time_created: number;
215
+ time_updated: number | null;
216
+ share_location: boolean;
198
217
  can_send_emails: boolean | null;
199
218
  payment_methods: PaymentMethod[];
200
219
  autopay_payment_types: string[];
201
220
  autopay: boolean | null;
202
221
  chats: Chat[];
203
222
  bills: BillUser[];
223
+ is_root: boolean;
204
224
  }
205
225
  export interface Break {
206
226
  id: string;
@@ -209,20 +229,20 @@ export interface Break {
209
229
  company_billable: boolean;
210
230
  client_billable: boolean;
211
231
  }
212
- export interface ServiceMonth {
213
- id: string;
232
+ export interface ServiceMonth extends LineItem {
233
+ line_item_type: "SERVICE_MONTH";
214
234
  job_name: string;
215
235
  job_id: string | null;
236
+ job_address: string;
237
+ job_labels: string[];
216
238
  bill_id: string | null;
217
- cost: number;
218
239
  billed: boolean;
219
240
  paid: boolean;
220
- amount: number;
221
- time_created: number;
241
+ tasks: string[];
222
242
  time_updated: number | null;
223
243
  }
224
244
  export interface Session {
225
- session_id: string;
245
+ id: string;
226
246
  user_id: string;
227
247
  company_id: string;
228
248
  time_started: number;
@@ -230,7 +250,7 @@ export interface Session {
230
250
  break_id: string;
231
251
  is_paused: boolean;
232
252
  team_id: string;
233
- current_route_id: string;
253
+ route_id: string;
234
254
  breaks: Break[];
235
255
  }
236
256
  export interface Group {
@@ -244,6 +264,18 @@ export interface Group {
244
264
  time_created: number;
245
265
  time_updated: number;
246
266
  }
267
+ export declare const NotificationLevel: {
268
+ readonly IN_APP: 0;
269
+ readonly EMAIL: 1;
270
+ readonly SMS: 2;
271
+ readonly PUSH: 3;
272
+ };
273
+ export type NotificationLevel = typeof NotificationLevel[keyof typeof NotificationLevel];
274
+ export declare const LoginResponse: {
275
+ readonly SUCCESS: "SUCCESS";
276
+ readonly NEEDS_TOTP: "NEEDS_TOTP";
277
+ };
278
+ export type LoginResponse = typeof LoginResponse[keyof typeof LoginResponse];
247
279
  export interface UserCompanyAssociation {
248
280
  id: string;
249
281
  user: User;
@@ -252,10 +284,11 @@ export interface UserCompanyAssociation {
252
284
  effective_permissions: string[];
253
285
  time_created: number | null;
254
286
  time_updated: number | null;
255
- notification_setting: number[];
287
+ notification_setting: NotificationLevel[];
256
288
  share_email_company_wide: boolean;
257
- notifications: number[];
289
+ notifications: Notification[];
258
290
  groups: string[];
291
+ last_location: Location | null;
259
292
  }
260
293
  export interface Email {
261
294
  id: string;
@@ -294,6 +327,7 @@ export interface Bill {
294
327
  customer_email: string | null;
295
328
  manual_emails: string[][];
296
329
  users: BillUser[];
330
+ paid: boolean;
297
331
  paid_at: number;
298
332
  time_created: number;
299
333
  time_updated: number;
@@ -301,7 +335,7 @@ export interface Bill {
301
335
  intent_created_at: number;
302
336
  intent_last_created_at: number;
303
337
  payment: BillPayment | null;
304
- line_items: LineItem[];
338
+ line_items: CustomLineItem[];
305
339
  months: string[];
306
340
  due_date: number;
307
341
  }
@@ -323,18 +357,13 @@ export interface PlanPayment {
323
357
  time_updated: number;
324
358
  }
325
359
  export interface Company {
326
- events: _Event[];
327
- months: ServiceMonth[];
328
360
  id: string;
329
- jobs: Job[];
330
361
  name: string;
331
362
  email: string;
332
- routes: Route[];
333
- teams: Team[];
334
363
  emails: Email[];
335
364
  skills: Skill[];
336
- time_created: string;
337
- time_updated: string | null;
365
+ time_created: number;
366
+ time_updated: number | null;
338
367
  users: UserCompanyAssociation[];
339
368
  use_client_side_customer_start_billing: boolean;
340
369
  use_client_side_customer_stop_billing: boolean;
@@ -345,7 +374,7 @@ export interface Company {
345
374
  incomplete_payments: PlanPayment[];
346
375
  overdue_threshold: number;
347
376
  stripe_account_id: string;
348
- is_restricted: false;
377
+ is_restricted: boolean;
349
378
  disabled_reason: string;
350
379
  completed_onboarding: boolean;
351
380
  restricted_soon: boolean;
@@ -353,6 +382,9 @@ export interface Company {
353
382
  billing_email_id: string;
354
383
  num_events: number;
355
384
  num_jobs: number;
385
+ num_routes: number;
386
+ num_teams: number;
387
+ num_skills: number;
356
388
  bills: Bill[];
357
389
  enabled_payment_methods: string[];
358
390
  sessions: Session[];
@@ -416,8 +448,9 @@ export interface Job {
416
448
  routes: RouteJob[];
417
449
  subscribers: Subscription[];
418
450
  manual_emails: string[][];
451
+ overdue_time: number;
419
452
  last_completed_event: _Event | null;
420
- last_event: _Event | null;
453
+ current_event: _Event | null;
421
454
  labels: string[];
422
455
  owner: string;
423
456
  }
@@ -438,7 +471,8 @@ export interface Task {
438
471
  created_by: UserCompanyAssociation | null;
439
472
  overdueness: number | null;
440
473
  overdue_time: number;
441
- last_event: _Event | null;
474
+ last_completed_event: _Event | null;
475
+ current_event: _Event | null;
442
476
  delay: number;
443
477
  skills: string[];
444
478
  service: number;
@@ -450,6 +484,7 @@ export interface Task {
450
484
  services_prepaid: number;
451
485
  months_prepaid: number;
452
486
  priority: boolean;
487
+ route_ids: string[];
453
488
  }
454
489
  export interface TaskWrapper {
455
490
  latestEvent: number;
@@ -471,23 +506,31 @@ export interface taskEndInfo {
471
506
  internal_notes: string;
472
507
  external_notes: string;
473
508
  }
474
- export interface AdditionalCharge {
509
+ export interface AdditionalCharge extends LineItem {
510
+ line_item_type: "ADDITIONAL_CHARGE";
511
+ time_updated: number | null;
512
+ }
513
+ export interface UserEvent {
475
514
  id: string;
476
- time_created: number;
515
+ session_id: string;
516
+ event_id: string;
517
+ user_id: string | null;
518
+ team_id: string | null;
519
+ user_name: string | null;
520
+ team_name: string | null;
521
+ time_started: number | null;
522
+ time_ended: number | null;
523
+ time_created: number | null;
477
524
  time_updated: number | null;
478
- name: string;
479
- amount: number;
480
525
  }
481
- export interface _Event {
526
+ export interface _Event extends LineItem {
482
527
  breaks: string[];
483
- id: string;
484
- name: string;
528
+ line_item_type: "EVENT";
485
529
  internal_notes: string;
486
530
  external_notes: string;
487
531
  proofs: string[];
488
532
  tasks: string[];
489
- time_created: number;
490
- time_ended: number;
533
+ time_ended: number | null;
491
534
  time_started: number;
492
535
  time_updated: number | null;
493
536
  job_id: string;
@@ -496,11 +539,76 @@ export interface _Event {
496
539
  bill_id: string;
497
540
  billed_amount: number;
498
541
  additional_charges: AdditionalCharge[];
499
- user_id: string;
500
- team_id: string;
501
- cost: number;
542
+ users: UserEvent[];
502
543
  billed: boolean;
503
544
  paid: boolean;
504
545
  autostart: boolean;
505
546
  job_labels: string[];
506
547
  }
548
+ export interface FinancialInsightData {
549
+ start: number;
550
+ end: number;
551
+ unbilled: {
552
+ events: {
553
+ count: number;
554
+ amount: number;
555
+ };
556
+ service_months: {
557
+ count: number;
558
+ amount: number;
559
+ };
560
+ total: number;
561
+ };
562
+ billed_unbilled: {
563
+ events: {
564
+ count: number;
565
+ amount: number;
566
+ };
567
+ service_months: {
568
+ count: number;
569
+ amount: number;
570
+ };
571
+ total: number;
572
+ };
573
+ paid_unbilled: {
574
+ events: {
575
+ count: number;
576
+ amount: number;
577
+ };
578
+ service_months: {
579
+ count: number;
580
+ amount: number;
581
+ };
582
+ total: number;
583
+ };
584
+ prepaid: {
585
+ events: {
586
+ count: number;
587
+ amount: number;
588
+ };
589
+ service_months: {
590
+ count: number;
591
+ amount: number;
592
+ };
593
+ total: number;
594
+ };
595
+ accounts_receivable: {
596
+ overdue: number;
597
+ not_overdue: number;
598
+ };
599
+ cash: number;
600
+ }
601
+ export interface EventInsightData {
602
+ start: number;
603
+ end: number;
604
+ events_per_job: {
605
+ id: string;
606
+ name: string;
607
+ event_count: number;
608
+ }[];
609
+ events_per_team: {
610
+ team_id: string;
611
+ event_count: number;
612
+ }[];
613
+ total_events: number;
614
+ }
package/dist/types/api.js CHANGED
@@ -1 +1,10 @@
1
- export {};
1
+ export const NotificationLevel = {
2
+ IN_APP: 0,
3
+ EMAIL: 1,
4
+ SMS: 2,
5
+ PUSH: 3
6
+ };
7
+ export const LoginResponse = {
8
+ SUCCESS: "SUCCESS",
9
+ NEEDS_TOTP: "NEEDS_TOTP",
10
+ };
@@ -2,8 +2,9 @@ export interface Tokens {
2
2
  access_token: string;
3
3
  refresh_token: string;
4
4
  }
5
- export interface TokenStorage {
6
- get(): Promise<Tokens | null>;
7
- set(tokens: Tokens): Promise<void>;
8
- clear(): Promise<void>;
9
- }
5
+ export declare const AuthState: {
6
+ readonly AUTHENTICATED: 1;
7
+ readonly UNAUTHENTICATED: 2;
8
+ readonly UNKNOWN: 3;
9
+ };
10
+ export type AuthState = typeof AuthState[keyof typeof AuthState];
@@ -1 +1,5 @@
1
- export {};
1
+ export const AuthState = {
2
+ AUTHENTICATED: 1,
3
+ UNAUTHENTICATED: 2,
4
+ UNKNOWN: 3,
5
+ };
@@ -0,0 +1,9 @@
1
+ import { Tokens } from "../types/auth";
2
+ export interface CacheData extends Tokens {
3
+ companyId: string;
4
+ }
5
+ export interface Cache {
6
+ get(key?: keyof CacheData): Promise<CacheData | string | null>;
7
+ set(data: Partial<CacheData>): Promise<void>;
8
+ clear(): Promise<void>;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.15",
3
+ "version": "0.0.2-beta.151",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,15 +32,13 @@
32
32
  "author": "Avro <info@goavro.com>",
33
33
  "license": "CC-BY-SA-4.0",
34
34
  "devDependencies": {
35
- "@types/jest": "^29.0.0",
35
+ "@types/react": "^19.2.2",
36
36
  "@typescript-eslint/eslint-plugin": "^8.38.0",
37
37
  "@typescript-eslint/parser": "^8.38.0",
38
38
  "eslint": "^8.57.1",
39
39
  "eslint-plugin-import": "^2.32.0",
40
40
  "eslint-plugin-jsx-a11y": "^6.10.2",
41
41
  "eslint-plugin-react": "^7.37.5",
42
- "jest": "^29.0.0",
43
- "ts-jest": "^29.0.0",
44
42
  "tsc-alias": "^1.8.16",
45
43
  "typescript": "^5.8.3",
46
44
  "typescript-eslint": "^8.38.0"
@@ -50,5 +48,9 @@
50
48
  ],
51
49
  "publishConfig": {
52
50
  "access": "public"
51
+ },
52
+ "dependencies": {
53
+ "@tanstack/react-query": "^5.90.2",
54
+ "socket.io-client": "^4.8.1"
53
55
  }
54
56
  }