@bizmap/sdk 0.0.39 → 0.0.41

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/dist/main.d.ts CHANGED
@@ -25,73 +25,6 @@ declare const PriceTag: z.ZodObject<{
25
25
  }, z.core.$strip>;
26
26
  type PriceTag = z.infer<typeof PriceTag>;
27
27
 
28
- declare const RegisterCompanyForm: z.ZodObject<{
29
- regNo: z.ZodString;
30
- userProvisions: z.ZodNumber;
31
- slogan: z.ZodString;
32
- email: z.ZodEmail;
33
- phoneNumber: z.ZodString;
34
- logo: z.ZodObject<{
35
- lastModified: z.ZodNullable<z.ZodNumber>;
36
- uid: z.ZodOptional<z.ZodString>;
37
- uploadDate: z.ZodOptional<z.ZodNumber>;
38
- sizeInBytes: z.ZodNumber;
39
- name: z.ZodString;
40
- path: z.ZodString;
41
- extension: z.ZodString;
42
- description: z.ZodOptional<z.ZodString>;
43
- mime: z.ZodString;
44
- alias: z.ZodEnum<{
45
- pdf: "pdf";
46
- word: "word";
47
- excel: "excel";
48
- img: "img";
49
- txt: "txt";
50
- unknown: "unknown";
51
- }>;
52
- }, z.core.$strip>;
53
- receipt: z.ZodObject<{
54
- lastModified: z.ZodNullable<z.ZodNumber>;
55
- uid: z.ZodOptional<z.ZodString>;
56
- uploadDate: z.ZodOptional<z.ZodNumber>;
57
- sizeInBytes: z.ZodNumber;
58
- name: z.ZodString;
59
- path: z.ZodString;
60
- extension: z.ZodString;
61
- description: z.ZodOptional<z.ZodString>;
62
- mime: z.ZodString;
63
- alias: z.ZodEnum<{
64
- pdf: "pdf";
65
- word: "word";
66
- excel: "excel";
67
- img: "img";
68
- txt: "txt";
69
- unknown: "unknown";
70
- }>;
71
- }, z.core.$strip>;
72
- _claims: z.ZodString;
73
- }, z.core.$strip>;
74
- type RegisterCompanyForm = z.infer<typeof RegisterCompanyForm>;
75
- declare const CompanyRegistrationClaims: z.ZodObject<{
76
- createdAt: z.ZodReadonly<z.ZodInt>;
77
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
78
- sender: z.ZodObject<{
79
- name: z.ZodRecord<z.ZodEnum<{
80
- first: "first";
81
- last: "last";
82
- }>, z.ZodString>;
83
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
- email: z.ZodEmail;
85
- phoneNumber: z.ZodOptional<z.ZodString>;
86
- uid: z.ZodString;
87
- }, z.core.$strip>;
88
- pricingRate: z.ZodObject<{
89
- flatFee: z.ZodNumber;
90
- feePerUser: z.ZodNumber;
91
- lastModified: z.ZodInt;
92
- }, z.core.$strip>;
93
- }, z.core.$strip>;
94
- type CompanyRegistrationClaims = z.infer<typeof CompanyRegistrationClaims>;
95
28
  declare const CompanyUser: z.ZodObject<{
96
29
  createdAt: z.ZodReadonly<z.ZodInt>;
97
30
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -112,6 +45,7 @@ declare const CompanyUser: z.ZodObject<{
112
45
  cshr: "cshr";
113
46
  admin: "admin";
114
47
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
48
+ isBusy: z.ZodBoolean;
115
49
  appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
116
50
  lastActive: z.ZodInt;
117
51
  name: z.ZodRecord<z.ZodEnum<{
@@ -145,6 +79,15 @@ declare const CompanyDetails: z.ZodObject<{
145
79
  }, z.core.$strip>;
146
80
  lastModified: z.ZodNullable<z.ZodInt>;
147
81
  }, z.core.$strip>;
82
+ receipts: z.ZodArray<z.ZodObject<{
83
+ createdAt: z.ZodReadonly<z.ZodInt>;
84
+ item: z.ZodString;
85
+ cost: z.ZodNumber;
86
+ }, z.core.$strip>> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
87
+ createdAt: z.ZodReadonly<z.ZodInt>;
88
+ item: z.ZodString;
89
+ cost: z.ZodNumber;
90
+ }, z.core.$strip>>>>;
148
91
  state: z.ZodObject<{
149
92
  availableBalance: z.ZodNumber;
150
93
  totalUploads: z.ZodNumber;
@@ -269,6 +212,7 @@ declare const CompanyDetails: z.ZodObject<{
269
212
  cshr: "cshr";
270
213
  admin: "admin";
271
214
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
215
+ isBusy: z.ZodBoolean;
272
216
  appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
273
217
  lastActive: z.ZodInt;
274
218
  name: z.ZodRecord<z.ZodEnum<{
@@ -308,6 +252,7 @@ declare const CompanyDetails: z.ZodObject<{
308
252
  lastModified: number | null;
309
253
  };
310
254
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
255
+ isBusy: boolean;
311
256
  appointmentCounter: Record<"ongoing" | "completed", number>;
312
257
  lastActive: number;
313
258
  name: Record<"first" | "last", string>;
@@ -339,6 +284,7 @@ declare const CompanyDetails: z.ZodObject<{
339
284
  lastModified: number | null;
340
285
  };
341
286
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
287
+ isBusy: boolean;
342
288
  appointmentCounter: Record<"ongoing" | "completed", number>;
343
289
  lastActive: number;
344
290
  name: Record<"first" | "last", string>;
@@ -381,6 +327,7 @@ declare const CompanyDetails: z.ZodObject<{
381
327
  cshr: "cshr";
382
328
  admin: "admin";
383
329
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
330
+ isBusy: z.ZodBoolean;
384
331
  appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
385
332
  lastActive: z.ZodInt;
386
333
  name: z.ZodRecord<z.ZodEnum<{
@@ -420,6 +367,7 @@ declare const CompanyDetails: z.ZodObject<{
420
367
  lastModified: number | null;
421
368
  };
422
369
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
370
+ isBusy: boolean;
423
371
  appointmentCounter: Record<"ongoing" | "completed", number>;
424
372
  lastActive: number;
425
373
  name: Record<"first" | "last", string>;
@@ -451,6 +399,7 @@ declare const CompanyDetails: z.ZodObject<{
451
399
  lastModified: number | null;
452
400
  };
453
401
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
402
+ isBusy: boolean;
454
403
  appointmentCounter: Record<"ongoing" | "completed", number>;
455
404
  lastActive: number;
456
405
  name: Record<"first" | "last", string>;
@@ -498,6 +447,15 @@ declare const PartialCompanyDetails: z.ZodObject<{
498
447
  }, z.core.$strip>;
499
448
  lastModified: z.ZodNullable<z.ZodInt>;
500
449
  }, z.core.$strip>;
450
+ receipts: z.ZodArray<z.ZodObject<{
451
+ createdAt: z.ZodReadonly<z.ZodInt>;
452
+ item: z.ZodString;
453
+ cost: z.ZodNumber;
454
+ }, z.core.$strip>> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
455
+ createdAt: z.ZodReadonly<z.ZodInt>;
456
+ item: z.ZodString;
457
+ cost: z.ZodNumber;
458
+ }, z.core.$strip>>>>;
501
459
  state: z.ZodObject<{
502
460
  availableBalance: z.ZodNumber;
503
461
  totalUploads: z.ZodNumber;
@@ -622,6 +580,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
622
580
  cshr: "cshr";
623
581
  admin: "admin";
624
582
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
583
+ isBusy: z.ZodBoolean;
625
584
  appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
626
585
  lastActive: z.ZodInt;
627
586
  name: z.ZodRecord<z.ZodEnum<{
@@ -661,6 +620,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
661
620
  lastModified: number | null;
662
621
  };
663
622
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
623
+ isBusy: boolean;
664
624
  appointmentCounter: Record<"ongoing" | "completed", number>;
665
625
  lastActive: number;
666
626
  name: Record<"first" | "last", string>;
@@ -692,6 +652,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
692
652
  lastModified: number | null;
693
653
  };
694
654
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
655
+ isBusy: boolean;
695
656
  appointmentCounter: Record<"ongoing" | "completed", number>;
696
657
  lastActive: number;
697
658
  name: Record<"first" | "last", string>;
@@ -734,6 +695,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
734
695
  cshr: "cshr";
735
696
  admin: "admin";
736
697
  }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
698
+ isBusy: z.ZodBoolean;
737
699
  appointmentCounter: z.ZodRecord<z.ZodLiteral<"ongoing" | "completed">, z.ZodInt>;
738
700
  lastActive: z.ZodInt;
739
701
  name: z.ZodRecord<z.ZodEnum<{
@@ -773,6 +735,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
773
735
  lastModified: number | null;
774
736
  };
775
737
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
738
+ isBusy: boolean;
776
739
  appointmentCounter: Record<"ongoing" | "completed", number>;
777
740
  lastActive: number;
778
741
  name: Record<"first" | "last", string>;
@@ -804,6 +767,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
804
767
  lastModified: number | null;
805
768
  };
806
769
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
770
+ isBusy: boolean;
807
771
  appointmentCounter: Record<"ongoing" | "completed", number>;
808
772
  lastActive: number;
809
773
  name: Record<"first" | "last", string>;
@@ -887,6 +851,7 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
887
851
  lastModified: number | null;
888
852
  };
889
853
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
854
+ isBusy: boolean;
890
855
  appointmentCounter: Record<"ongoing" | "completed", number>;
891
856
  lastActive: number;
892
857
  name: Record<"first" | "last", string>;
@@ -898,4 +863,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
898
863
  /**@returns the roles that are compatible with the selected role. */
899
864
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
900
865
 
901
- export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, CompanyRegistrationClaims, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InvoiceNo, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
866
+ export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InvoiceNo, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
package/dist/main.js CHANGED
@@ -54,7 +54,6 @@ var PriceTag = z2.object({
54
54
  import {
55
55
  Address,
56
56
  currencies,
57
- FileDetails,
58
57
  PhoneNumber,
59
58
  UserModel
60
59
  } from "@wavy/util";
@@ -82,21 +81,6 @@ var appointmentDistAlgs = z3.enum(["RR", "LOR"]);
82
81
  var companyServiceSelectors = z3.enum(["scheduler", "doctor"]);
83
82
 
84
83
  // src/schemas/Company.ts
85
- var RegisterCompanyForm = z4.object({
86
- regNo: z4.string(),
87
- userProvisions: z4.number(),
88
- slogan: z4.string(),
89
- email: z4.email(),
90
- phoneNumber: PhoneNumber,
91
- logo: FileDetails,
92
- receipt: FileDetails,
93
- _claims: z4.string()
94
- });
95
- var CompanyRegistrationClaims = z4.object({
96
- sender: UserModel,
97
- pricingRate: PricingRate.shape.companyRegistration,
98
- ...TimeLog.shape
99
- });
100
84
  var CompanyUser = z4.object({
101
85
  ...UserModel.shape,
102
86
  uid: UuidV7,
@@ -116,6 +100,7 @@ var CompanyUser = z4.object({
116
100
  (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
117
101
  );
118
102
  }, "A user is not allowed to have conflicting roles."),
103
+ isBusy: z4.boolean(),
119
104
  /** This should reset at the end of every cycle. */
120
105
  appointmentCounter: z4.record(
121
106
  z4.literal(["ongoing", "completed"]),
@@ -133,7 +118,7 @@ var CompanyUser = z4.object({
133
118
  );
134
119
  }
135
120
  });
136
- var IdentityDetails = z4.object({
121
+ var Identity = z4.object({
137
122
  displayName: z4.string().min(3).max(20),
138
123
  logo: z4.string().max(2500).nullish(),
139
124
  contact: z4.object({
@@ -149,7 +134,7 @@ var IdentityDetails = z4.object({
149
134
  }),
150
135
  lastModified: Timestamp.nullable()
151
136
  });
152
- var StateDetails = z4.object({
137
+ var CompanyState = z4.object({
153
138
  // This can only be changed by the server/app admin
154
139
  availableBalance: z4.number(),
155
140
  /**
@@ -165,7 +150,7 @@ var StateDetails = z4.object({
165
150
  tktNoCounter: z4.int().min(1),
166
151
  lastModified: Timestamp.nullable()
167
152
  });
168
- var PreferenceDetails = z4.object({
153
+ var CompanyPreferences = z4.object({
169
154
  /** The amount of user provisions made for this company */
170
155
  userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
171
156
  (p) => !(p > 1 && p < 10),
@@ -178,7 +163,7 @@ var PreferenceDetails = z4.object({
178
163
  apptDistAlg: appointmentDistAlgs.default("RR"),
179
164
  lastModified: Timestamp.nullable()
180
165
  });
181
- var BillingDetails = z4.object({
166
+ var Billing = z4.object({
182
167
  preferences: z4.object({
183
168
  /** Forces service selectors to use the list of service(s) that you've created. */
184
169
  useCreatedServices: z4.boolean(),
@@ -217,7 +202,7 @@ var BillingDetails = z4.object({
217
202
  ctx.addIssue("At least (1) service must be added to the services list.");
218
203
  }
219
204
  });
220
- var StaffDetails = z4.object({
205
+ var Staff = z4.object({
221
206
  members: z4.record(CompanyUser.shape.uid, CompanyUser).superRefine((data, ctx) => {
222
207
  const emails = [];
223
208
  for (const [uid, user] of Object.entries(data)) {
@@ -257,15 +242,15 @@ var StaffDetails = z4.object({
257
242
  const copy = structuredClone(d);
258
243
  for (const uid of Object.keys(copy.updateQueue)) {
259
244
  if (uid in copy.members) {
260
- const user = copy.updateQueue[uid];
261
- if ("$REMOVE" in user) {
262
- copy.updateQueue[uid] = { $REMOVE: user.$REMOVE };
263
- } else if (user.$CHANGE_ROLES && user.$CHANGE_ROLES.newRoles.length === copy.members[uid].roles.length && user.$CHANGE_ROLES.newRoles.every(
245
+ const userUpdates = copy.updateQueue[uid];
246
+ if ("$REMOVE" in userUpdates) {
247
+ copy.updateQueue[uid] = { $REMOVE: userUpdates.$REMOVE };
248
+ } else if (userUpdates.$CHANGE_ROLES && userUpdates.$CHANGE_ROLES.newRoles.length === copy.members[uid].roles.length && userUpdates.$CHANGE_ROLES.newRoles.every(
264
249
  (role) => copy.members[uid].roles.includes(role)
265
250
  )) {
266
251
  delete copy.updateQueue[uid].$CHANGE_ROLES;
267
252
  }
268
- if (Object.keys(user).length < 1) delete copy.updateQueue[uid];
253
+ if (Object.keys(userUpdates).length < 1) delete copy.updateQueue[uid];
269
254
  } else {
270
255
  delete copy.updateQueue[uid];
271
256
  }
@@ -300,16 +285,23 @@ var StaffDetails = z4.object({
300
285
  `All users that have the "doc" role must be the leader of a partner group. (${user.uid})`
301
286
  );
302
287
  }
288
+ if (!user.isBusy && user.uid in details.updateQueue) {
289
+ ctx.addIssue(
290
+ `Having users that aren't busy in the update queue is prohibited.`
291
+ );
292
+ }
303
293
  }
304
294
  });
295
+ var Receipts = z4.array(PriceTag.omit({ uid: true, lastModified: true }));
305
296
  var createCompanyDetails = (options) => {
306
297
  return z4.object({
307
298
  uid: UuidV7,
308
- identity: IdentityDetails,
309
- state: options.partial ? StateDetails.nullish() : StateDetails,
310
- preferences: options.partial ? PreferenceDetails.nullish() : PreferenceDetails,
311
- billing: options.partial ? BillingDetails.nullish() : BillingDetails,
312
- staff: options.partial ? StaffDetails.nullish() : StaffDetails,
299
+ identity: Identity,
300
+ receipts: options.partial ? Receipts.nullish() : Receipts,
301
+ state: options.partial ? CompanyState.nullish() : CompanyState,
302
+ preferences: options.partial ? CompanyPreferences.nullish() : CompanyPreferences,
303
+ billing: options.partial ? Billing.nullish() : Billing,
304
+ staff: options.partial ? Staff.nullish() : Staff,
313
305
  createdAt: options.partial ? Timestamp.nullish() : Timestamp
314
306
  });
315
307
  };
@@ -348,14 +340,12 @@ var getCompatibleRoles = (role) => {
348
340
  };
349
341
  export {
350
342
  CompanyDetails,
351
- CompanyRegistrationClaims,
352
343
  CompanyUser,
353
344
  InvoiceNo,
354
345
  PartialCompanyDetails,
355
346
  PriceAdjustment,
356
347
  PriceTag,
357
348
  PricingRate,
358
- RegisterCompanyForm,
359
349
  StandardTime,
360
350
  TimeLog,
361
351
  Timestamp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",