@go-avro/avro-js 0.0.2-beta.155 → 0.0.2-beta.157

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, QueryClient, UseInfiniteQueryResult, useMutation, UseQueryResult } from '@tanstack/react-query';
3
3
  import { AuthManager } from '../auth/AuthManager';
4
- import { _Event, ApiInfo, Avro, Bill, Break, Chat, Company, FinancialInsightData, Job, EventInsightData, LoginResponse, Message, Plan, Route, ServiceMonth, Session, Team, User, UserCompanyAssociation, Skill, Group, Label } from '../types/api';
4
+ import { _Event, ApiInfo, Avro, Bill, Break, Chat, Company, FinancialInsightData, Job, EventInsightData, LoginResponse, Message, Plan, Route, ServiceMonth, Session, Team, User, UserCompanyAssociation, Skill, Group, Label, RouteScheduleConfig } from '../types/api';
5
5
  import { AuthState, Tokens } from '../types/auth';
6
6
  import { CancelToken, RetryStrategy } from '../types/client';
7
7
  import { StandardError } from '../types/error';
@@ -193,6 +193,7 @@ declare module '../client/QueryClient' {
193
193
  }>>;
194
194
  useCreateSelf(): ReturnType<typeof useMutation<{
195
195
  msg: string;
196
+ id?: string;
196
197
  }, StandardError, {
197
198
  username: string;
198
199
  name: string;
@@ -208,6 +209,11 @@ declare module '../client/QueryClient' {
208
209
  sessionId: string;
209
210
  breakData: Partial<Break>;
210
211
  }>>;
212
+ useScheduleRoutes(): ReturnType<typeof useMutation<{
213
+ msg: string;
214
+ }, StandardError, {
215
+ schedule: RouteScheduleConfig;
216
+ }>>;
211
217
  useUpdateEvent(): ReturnType<typeof useMutation<{
212
218
  msg: string;
213
219
  }, StandardError, {
@@ -75,6 +75,13 @@ AvroQueryClient.prototype.useCreateRoute = function () {
75
75
  },
76
76
  });
77
77
  };
78
+ AvroQueryClient.prototype.useScheduleRoutes = function () {
79
+ return useMutation({
80
+ mutationFn: async ({ schedule }) => {
81
+ return this.post(`/company/${this.companyId}/schedule`, JSON.stringify(schedule), undefined, { "Content-Type": "application/json" });
82
+ },
83
+ });
84
+ };
78
85
  AvroQueryClient.prototype.useUpdateRoute = function () {
79
86
  const queryClient = this.getQueryClient();
80
87
  return useMutation({
@@ -57,6 +57,33 @@ export interface PaymentMethod {
57
57
  } | null;
58
58
  } | null;
59
59
  }
60
+ export type ScheduleItem = {
61
+ type: "location";
62
+ location: [number, number];
63
+ time_window: [number, number];
64
+ } | {
65
+ type: "break";
66
+ start: [number, number];
67
+ time_window: [number, number];
68
+ } | {
69
+ type: "job";
70
+ job_id: string;
71
+ task_ids: string[];
72
+ location: [number, number];
73
+ time_window: [number, number];
74
+ };
75
+ export type TeamSchedule = {
76
+ team_id: string;
77
+ schedule: ScheduleItem[];
78
+ name: string;
79
+ optimize: boolean;
80
+ };
81
+ export type RouteScheduleConfig = {
82
+ schedules: TeamSchedule[];
83
+ whitelist: string[];
84
+ blacklist: string[];
85
+ tasks: string[];
86
+ };
60
87
  export interface Avro {
61
88
  id: string;
62
89
  name: string;
@@ -207,7 +234,8 @@ export interface BillUser {
207
234
  export interface User {
208
235
  id: string;
209
236
  username: string;
210
- name: string;
237
+ first_name: string;
238
+ last_name: string;
211
239
  verified: boolean;
212
240
  email: string | null;
213
241
  phone_number: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.155",
3
+ "version": "0.0.2-beta.157",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",