@go-avro/avro-js 0.0.2-beta.141 → 0.0.2-beta.143

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.
@@ -46,16 +46,7 @@ AvroQueryClient.prototype.useUpdateUserCompany = function () {
46
46
  onMutate: async (data) => {
47
47
  await queryClient.cancelQueries({ queryKey: ['user'] });
48
48
  await queryClient.cancelQueries({ queryKey: ['company', this.companyId] });
49
- const previousUser = queryClient.getQueryData(['user']);
50
49
  const previousCompany = queryClient.getQueryData(['company', this.companyId]);
51
- if (previousUser) {
52
- let oldUserCompany = previousUser.companies?.find(c => c.company === this.companyId);
53
- if (oldUserCompany) {
54
- oldUserCompany = { ...oldUserCompany, ...data.data };
55
- const newCompanies = previousUser.companies?.map(c => c.company === this.companyId ? oldUserCompany : c) ?? [];
56
- queryClient.setQueryData(['user'], { ...previousUser, companies: newCompanies });
57
- }
58
- }
59
50
  if (previousCompany) {
60
51
  let oldCompanyUser = previousCompany.users?.find((u) => u.user.id === data.user_id);
61
52
  if (oldCompanyUser) {
@@ -64,14 +55,11 @@ AvroQueryClient.prototype.useUpdateUserCompany = function () {
64
55
  queryClient.setQueryData(['company', this.companyId], { ...previousCompany, users: newUsers });
65
56
  }
66
57
  }
67
- return { previousUser, previousCompany };
58
+ return { previousCompany };
68
59
  },
69
60
  onError: (err, _, context) => {
70
- if (context?.previousUser) {
71
- queryClient.setQueryData(['user'], context.previousUser);
72
- }
73
61
  if (context?.previousCompany) {
74
- queryClient.setQueryData(['company'], context.previousCompany);
62
+ queryClient.setQueryData(['company', this.companyId], context.previousCompany);
75
63
  }
76
64
  },
77
65
  onSettled: (data, error, variables) => {
@@ -117,10 +117,13 @@ export interface Chat {
117
117
  user_state: MemberState[];
118
118
  messages: Message[];
119
119
  }
120
- export interface TeamLocation {
120
+ export interface Location {
121
121
  accuracy: number;
122
122
  heading: number;
123
123
  id: string;
124
+ team_id: string | null;
125
+ user_company_id: string;
126
+ user_id: string;
124
127
  latitude: number;
125
128
  longitude: number;
126
129
  time_collected: number;
@@ -153,7 +156,7 @@ export interface Team {
153
156
  end_longitude: number;
154
157
  start_time: number;
155
158
  users: string[];
156
- current_location: TeamLocation;
159
+ current_location: Location | null;
157
160
  start_address: string;
158
161
  end_address: string;
159
162
  }
@@ -206,7 +209,6 @@ export interface User {
206
209
  username: string;
207
210
  name: string;
208
211
  verified: boolean;
209
- companies: UserCompanyAssociation[] | null;
210
212
  email: string | null;
211
213
  phone_number: string | null;
212
214
  time_created: number;
@@ -285,6 +287,7 @@ export interface UserCompanyAssociation {
285
287
  share_email_company_wide: boolean;
286
288
  notifications: Notification[];
287
289
  groups: string[];
290
+ last_location: Location | null;
288
291
  }
289
292
  export interface Email {
290
293
  id: string;
@@ -370,7 +373,7 @@ export interface Company {
370
373
  incomplete_payments: PlanPayment[];
371
374
  overdue_threshold: number;
372
375
  stripe_account_id: string;
373
- is_restricted: false;
376
+ is_restricted: boolean;
374
377
  disabled_reason: string;
375
378
  completed_onboarding: boolean;
376
379
  restricted_soon: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.141",
3
+ "version": "0.0.2-beta.143",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",