@bizmap/sdk 0.0.27 → 0.0.28

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 (3) hide show
  1. package/dist/main.d.ts +94 -211
  2. package/dist/main.js +64 -72
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -25,90 +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 CompanyIdentity: z.ZodObject<{
29
- createdAt: z.ZodReadonly<z.ZodInt>;
30
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
31
- uid: z.ZodReadonly<z.ZodString>;
32
- displayName: z.ZodString;
33
- logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
- contact: z.ZodObject<{
35
- email: z.ZodEmail;
36
- phoneNumber: z.ZodOptional<z.ZodString>;
37
- }, z.core.$strip>;
38
- address: z.ZodObject<{
39
- streetAddress: z.ZodString;
40
- city: z.ZodOptional<z.ZodString>;
41
- parish: z.ZodString;
42
- country: z.ZodString;
43
- }, z.core.$strip>;
44
- legal: z.ZodObject<{
45
- regNo: z.ZodReadonly<z.ZodString>;
46
- trn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
- gctRegNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
- }, z.core.$strip>;
49
- }, z.core.$strip>;
50
- type CompanyIdentity = z.infer<typeof CompanyIdentity>;
51
- declare const CompanyOpState: z.ZodObject<{
52
- createdAt: z.ZodReadonly<z.ZodInt>;
53
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
54
- uid: z.ZodReadonly<z.ZodString>;
55
- availableBalance: z.ZodNumber;
56
- invoiceNoRef: z.ZodNullable<z.ZodString>;
57
- totalUploads: z.ZodNumber;
58
- preferences: z.ZodObject<{
59
- createdAt: z.ZodReadonly<z.ZodInt>;
60
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
61
- userProvisions: z.ZodNumber;
62
- apptDistAlg: z.ZodDefault<z.ZodEnum<{
63
- RR: "RR";
64
- LOR: "LOR";
65
- }>>;
66
- }, z.core.$strip>;
67
- }, z.core.$strip>;
68
- type CompanyOpState = z.infer<typeof CompanyOpState>;
69
- declare const CompanyBillingModel: z.ZodObject<{
70
- createdAt: z.ZodReadonly<z.ZodInt>;
71
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
72
- uid: z.ZodReadonly<z.ZodString>;
73
- preferences: z.ZodObject<{
74
- createdAt: z.ZodReadonly<z.ZodInt>;
75
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
76
- allowInvoiceDist: z.ZodBoolean;
77
- useCreatedServices: z.ZodBoolean;
78
- serviceSelector: z.ZodEnum<{
79
- scheduler: "scheduler";
80
- doctor: "doctor";
81
- }>;
82
- enforcePaidAppts: z.ZodBoolean;
83
- primaryCurrency: z.ZodEnum<{
84
- JMD: "JMD";
85
- }>;
86
- acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
87
- JMD: "JMD";
88
- }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
89
- }, z.core.$strip>;
90
- additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
91
- createdAt: z.ZodReadonly<z.ZodInt>;
92
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
93
- description: z.ZodOptional<z.ZodString>;
94
- fixedAmount: z.ZodNumber;
95
- percentage: z.ZodNumber;
96
- }, z.core.$strip>>>;
97
- discounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
98
- createdAt: z.ZodReadonly<z.ZodInt>;
99
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
100
- description: z.ZodOptional<z.ZodString>;
101
- fixedAmount: z.ZodNumber;
102
- percentage: z.ZodNumber;
103
- }, z.core.$strip>>>;
104
- services: z.ZodDefault<z.ZodArray<z.ZodObject<{
105
- createdAt: z.ZodReadonly<z.ZodInt>;
106
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
107
- item: z.ZodString;
108
- cost: z.ZodNumber;
109
- }, z.core.$strip>>>;
110
- }, z.core.$strip>;
111
- type CompanyBillingModel = z.infer<typeof CompanyBillingModel>;
112
28
  declare const RegisterCompanyForm: z.ZodObject<{
113
29
  regNo: z.ZodString;
114
30
  userProvisions: z.ZodNumber;
@@ -202,150 +118,84 @@ declare const CompanyUser: z.ZodObject<{
202
118
  phoneNumber: z.ZodOptional<z.ZodString>;
203
119
  }, z.core.$strip>;
204
120
  type CompanyUser = z.infer<typeof CompanyUser>;
205
- declare const _staffDetails: z.ZodObject<{
206
- createdAt: z.ZodReadonly<z.ZodInt>;
207
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
208
- uid: z.ZodReadonly<z.ZodString>;
209
- members: z.ZodArray<z.ZodObject<{
121
+ type CompanyBillingModel = z.infer<typeof CompanyBillingModel>;
122
+ declare const CompanyBillingModel: z.ZodObject<{
123
+ preferences: z.ZodObject<{
210
124
  createdAt: z.ZodReadonly<z.ZodInt>;
211
125
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
212
- uid: z.ZodReadonly<z.ZodString>;
213
- status: z.ZodEnum<{
214
- inviteSent: "inviteSent";
215
- active: "active";
216
- inactive: "inactive";
126
+ allowInvoiceDist: z.ZodBoolean;
127
+ useCreatedServices: z.ZodBoolean;
128
+ serviceSelector: z.ZodEnum<{
129
+ scheduler: "scheduler";
130
+ doctor: "doctor";
217
131
  }>;
218
- roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
219
- doc: "doc";
220
- physAsst: "physAsst";
221
- rcpst: "rcpst";
222
- cshr: "cshr";
223
- admin: "admin";
224
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
225
- lastActive: z.ZodInt;
226
- name: z.ZodRecord<z.ZodEnum<{
227
- first: "first";
228
- last: "last";
229
- }>, z.ZodString>;
230
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
- email: z.ZodEmail;
232
- phoneNumber: z.ZodOptional<z.ZodString>;
233
- }, z.core.$strip>>;
234
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
235
- blackList: z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>;
236
- }, z.core.$strip>;
237
- /** The unpacked Staff Details */
238
- declare const StaffDetails: z.ZodPipe<z.ZodObject<{
239
- createdAt: z.ZodReadonly<z.ZodInt>;
240
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
241
- uid: z.ZodReadonly<z.ZodString>;
242
- members: z.ZodArray<z.ZodObject<{
132
+ enforcePaidAppts: z.ZodBoolean;
133
+ primaryCurrency: z.ZodEnum<{
134
+ JMD: "JMD";
135
+ }>;
136
+ acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
137
+ JMD: "JMD";
138
+ }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
139
+ }, z.core.$strip>;
140
+ additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
243
141
  createdAt: z.ZodReadonly<z.ZodInt>;
244
142
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
245
- uid: z.ZodReadonly<z.ZodString>;
246
- status: z.ZodEnum<{
247
- inviteSent: "inviteSent";
248
- active: "active";
249
- inactive: "inactive";
250
- }>;
251
- roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
252
- doc: "doc";
253
- physAsst: "physAsst";
254
- rcpst: "rcpst";
255
- cshr: "cshr";
256
- admin: "admin";
257
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
258
- lastActive: z.ZodInt;
259
- name: z.ZodRecord<z.ZodEnum<{
260
- first: "first";
261
- last: "last";
262
- }>, z.ZodString>;
263
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
264
- email: z.ZodEmail;
265
- phoneNumber: z.ZodOptional<z.ZodString>;
266
- }, z.core.$strip>>;
267
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
268
- blackList: z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>;
269
- }, z.core.$strip>, z.ZodTransform<{
270
- createdAt: number;
271
- uid: string;
272
- members: {
273
- createdAt: number;
274
- uid: string;
275
- status: "inviteSent" | "active" | "inactive";
276
- roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
277
- lastActive: number;
278
- name: Record<"first" | "last", string>;
279
- email: string;
280
- lastModified?: number | null | undefined;
281
- photoUrl?: string | null | undefined;
282
- phoneNumber?: string | undefined;
283
- }[];
284
- partnerMap: Record<string, string[]>;
285
- blackList: string[];
286
- lastModified?: number | null | undefined;
287
- }, {
288
- createdAt: number;
289
- uid: string;
290
- members: {
291
- createdAt: number;
292
- uid: string;
293
- status: "inviteSent" | "active" | "inactive";
294
- roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
295
- lastActive: number;
296
- name: Record<"first" | "last", string>;
297
- email: string;
298
- lastModified?: number | null | undefined;
299
- photoUrl?: string | null | undefined;
300
- phoneNumber?: string | undefined;
301
- }[];
302
- partnerMap: Record<string, string[]>;
303
- blackList: string[];
304
- lastModified?: number | null | undefined;
305
- }>>;
306
- type StaffDetails = z.infer<typeof _staffDetails>;
143
+ description: z.ZodOptional<z.ZodString>;
144
+ fixedAmount: z.ZodNumber;
145
+ percentage: z.ZodNumber;
146
+ }, z.core.$strip>>>;
147
+ discounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
148
+ createdAt: z.ZodReadonly<z.ZodInt>;
149
+ lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
150
+ description: z.ZodOptional<z.ZodString>;
151
+ fixedAmount: z.ZodNumber;
152
+ percentage: z.ZodNumber;
153
+ }, z.core.$strip>>>;
154
+ services: z.ZodDefault<z.ZodArray<z.ZodObject<{
155
+ createdAt: z.ZodReadonly<z.ZodInt>;
156
+ lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
157
+ item: z.ZodString;
158
+ cost: z.ZodNumber;
159
+ }, z.core.$strip>>>;
160
+ lastModified: z.ZodNullable<z.ZodInt>;
161
+ }, z.core.$strip>;
307
162
  declare const CompanyDetails: z.ZodObject<{
308
163
  uid: z.ZodReadonly<z.ZodString>;
164
+ state: z.ZodObject<{
165
+ availableBalance: z.ZodNumber;
166
+ invoiceNoRef: z.ZodNullable<z.ZodString>;
167
+ totalUploads: z.ZodNumber;
168
+ lastModified: z.ZodNullable<z.ZodInt>;
169
+ }, z.core.$strip>;
309
170
  identity: z.ZodObject<{
310
- createdAt: z.ZodReadonly<z.ZodInt>;
311
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
312
- address: z.ZodObject<{
313
- streetAddress: z.ZodString;
314
- city: z.ZodOptional<z.ZodString>;
315
- parish: z.ZodString;
316
- country: z.ZodString;
317
- }, z.core.$strip>;
318
171
  displayName: z.ZodString;
319
172
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
320
173
  contact: z.ZodObject<{
321
174
  email: z.ZodEmail;
322
175
  phoneNumber: z.ZodOptional<z.ZodString>;
323
176
  }, z.core.$strip>;
177
+ address: z.ZodObject<{
178
+ streetAddress: z.ZodString;
179
+ city: z.ZodOptional<z.ZodString>;
180
+ parish: z.ZodString;
181
+ country: z.ZodString;
182
+ }, z.core.$strip>;
324
183
  legal: z.ZodObject<{
325
184
  regNo: z.ZodReadonly<z.ZodString>;
326
185
  trn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
186
  gctRegNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
187
  }, z.core.$strip>;
188
+ lastModified: z.ZodNullable<z.ZodInt>;
329
189
  }, z.core.$strip>;
330
- opState: z.ZodObject<{
331
- createdAt: z.ZodReadonly<z.ZodInt>;
332
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
333
- availableBalance: z.ZodNumber;
334
- invoiceNoRef: z.ZodNullable<z.ZodString>;
335
- totalUploads: z.ZodNumber;
336
- preferences: z.ZodObject<{
337
- createdAt: z.ZodReadonly<z.ZodInt>;
338
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
339
- userProvisions: z.ZodNumber;
340
- apptDistAlg: z.ZodDefault<z.ZodEnum<{
341
- RR: "RR";
342
- LOR: "LOR";
343
- }>>;
344
- }, z.core.$strip>;
190
+ preferences: z.ZodObject<{
191
+ userProvisions: z.ZodNumber;
192
+ apptDistAlg: z.ZodDefault<z.ZodEnum<{
193
+ RR: "RR";
194
+ LOR: "LOR";
195
+ }>>;
196
+ lastModified: z.ZodNullable<z.ZodInt>;
345
197
  }, z.core.$strip>;
346
198
  billing: z.ZodObject<{
347
- createdAt: z.ZodReadonly<z.ZodInt>;
348
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
349
199
  preferences: z.ZodObject<{
350
200
  createdAt: z.ZodReadonly<z.ZodInt>;
351
201
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -383,10 +233,9 @@ declare const CompanyDetails: z.ZodObject<{
383
233
  item: z.ZodString;
384
234
  cost: z.ZodNumber;
385
235
  }, z.core.$strip>>>;
236
+ lastModified: z.ZodNullable<z.ZodInt>;
386
237
  }, z.core.$strip>;
387
- staffDetails: z.ZodObject<{
388
- createdAt: z.ZodReadonly<z.ZodInt>;
389
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
238
+ staffDetails: z.ZodPipe<z.ZodObject<{
390
239
  members: z.ZodArray<z.ZodObject<{
391
240
  createdAt: z.ZodReadonly<z.ZodInt>;
392
241
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -414,7 +263,41 @@ declare const CompanyDetails: z.ZodObject<{
414
263
  }, z.core.$strip>>;
415
264
  partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
416
265
  blackList: z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>;
417
- }, z.core.$strip>;
266
+ lastModified: z.ZodNullable<z.ZodInt>;
267
+ }, z.core.$strip>, z.ZodTransform<{
268
+ members: {
269
+ createdAt: number;
270
+ uid: string;
271
+ status: "inviteSent" | "active" | "inactive";
272
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
273
+ lastActive: number;
274
+ name: Record<"first" | "last", string>;
275
+ email: string;
276
+ lastModified?: number | null | undefined;
277
+ photoUrl?: string | null | undefined;
278
+ phoneNumber?: string | undefined;
279
+ }[];
280
+ partnerMap: Record<string, string[]>;
281
+ blackList: string[];
282
+ lastModified: number | null;
283
+ }, {
284
+ members: {
285
+ createdAt: number;
286
+ uid: string;
287
+ status: "inviteSent" | "active" | "inactive";
288
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
289
+ lastActive: number;
290
+ name: Record<"first" | "last", string>;
291
+ email: string;
292
+ lastModified?: number | null | undefined;
293
+ photoUrl?: string | null | undefined;
294
+ phoneNumber?: string | undefined;
295
+ }[];
296
+ partnerMap: Record<string, string[]>;
297
+ blackList: string[];
298
+ lastModified: number | null;
299
+ }>>;
300
+ createdAt: z.ZodInt;
418
301
  }, z.core.$strip>;
419
302
  type CompanyDetails = z.infer<typeof CompanyDetails>;
420
303
 
@@ -471,4 +354,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
471
354
  /**@returns the roles that are compatible with the selected role. */
472
355
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
473
356
 
474
- export { type AppointmentDistAlg, CompanyBillingModel, CompanyDetails, CompanyIdentity, CompanyOpState, type CompanyPartnerRole, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, InvoiceNo, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StaffDetails, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles };
357
+ export { type AppointmentDistAlg, CompanyBillingModel, CompanyDetails, type CompanyPartnerRole, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, InvoiceNo, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles };
package/dist/main.js CHANGED
@@ -71,9 +71,41 @@ var employeeRoles = companyUserRoles.exclude(["admin"]);
71
71
  var appointmentDistAlgs = z3.enum(["RR", "LOR"]);
72
72
 
73
73
  // src/schemas/Company.ts
74
- var CompanyIdentity = z4.object({
74
+ var RegisterCompanyForm = z4.object({
75
+ regNo: z4.string(),
76
+ userProvisions: z4.number(),
77
+ slogan: z4.string(),
78
+ email: z4.email(),
79
+ phoneNumber: PhoneNumber,
80
+ logo: FileDetails,
81
+ receipt: FileDetails,
82
+ _claims: z4.string()
83
+ });
84
+ var CompanyRegistrationClaims = z4.object({
85
+ sender: UserModel,
86
+ pricingRate: PricingRate.shape.companyRegistration,
87
+ ...TimeLog.shape
88
+ });
89
+ var CompanyUser = z4.object({
90
+ ...UserModel.shape,
75
91
  uid: UuidV7,
76
- // The company's uid
92
+ status: z4.enum(["inviteSent", "active", "inactive"]),
93
+ roles: z4.array(companyUserRoles).transform((roles) => {
94
+ const newRoles = [];
95
+ for (const role of roles) {
96
+ if (!!role && !newRoles.includes(role)) newRoles.push(role);
97
+ }
98
+ return newRoles.sort();
99
+ }).refine((roles) => {
100
+ const compatibleRoles = getCompatibleRoles(roles[0]);
101
+ return roles.every(
102
+ (role, i) => i === 0 || compatibleRoles.includes(role)
103
+ );
104
+ }, "A user is not allowed to have conflicting roles."),
105
+ lastActive: Timestamp,
106
+ ...TimeLog.shape
107
+ });
108
+ var CompanyIdentity = z4.object({
77
109
  displayName: z4.string().min(3).max(20),
78
110
  logo: z4.string().max(2500).nullish(),
79
111
  contact: z4.object({
@@ -87,11 +119,9 @@ var CompanyIdentity = z4.object({
87
119
  trn: z4.string().regex(/[0-9]{3}-[0-9]{3}-[0-9]{3}/).nullish(),
88
120
  gctRegNo: z4.string().max(15).nullish()
89
121
  }),
90
- ...TimeLog.shape
122
+ lastModified: Timestamp.nullable()
91
123
  });
92
- var CompanyOpState = z4.object({
93
- // The company's uid
94
- uid: UuidV7,
124
+ var CompanyState = z4.object({
95
125
  // This can only be changed by the server/app admin
96
126
  availableBalance: z4.number(),
97
127
  /** A counter for the company's invoice numbers. */
@@ -101,24 +131,22 @@ var CompanyOpState = z4.object({
101
131
  * @note - This should be refreshed daily.
102
132
  */
103
133
  totalUploads: z4.number(),
104
- // This can be changed by the company's admin
105
- preferences: z4.object({
106
- /** The amount of user provisions made for this company */
107
- userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
108
- (p) => !(p > 1 && p < 10),
109
- "The total user provisions must either be 1 or at least 10."
110
- ),
111
- /**
112
- * @property RR (Round Robin): Even distribution.
113
- * @property LOR (Least Outstanding Requests): Distribute based on availability.
114
- */
115
- apptDistAlg: appointmentDistAlgs.default("RR"),
116
- ...TimeLog.shape
117
- }),
118
- ...TimeLog.shape
134
+ lastModified: Timestamp.nullable()
135
+ });
136
+ var CompanyPreferences = z4.object({
137
+ /** The amount of user provisions made for this company */
138
+ userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
139
+ (p) => !(p > 1 && p < 10),
140
+ "The total user provisions must either be 1 or at least 10."
141
+ ),
142
+ /**
143
+ * @property RR (Round Robin): Even distribution.
144
+ * @property LOR (Least Outstanding Requests): Distribute based on availability.
145
+ */
146
+ apptDistAlg: appointmentDistAlgs.default("RR"),
147
+ lastModified: Timestamp.nullable()
119
148
  });
120
149
  var CompanyBillingModel = z4.object({
121
- uid: UuidV7,
122
150
  preferences: z4.object({
123
151
  /** Allows the serviceDecider to distribute invoices. */
124
152
  allowInvoiceDist: z4.boolean(),
@@ -152,49 +180,14 @@ var CompanyBillingModel = z4.object({
152
180
  additionalFees: z4.array(PriceAdjustment).default([]),
153
181
  discounts: z4.array(PriceAdjustment).default([]),
154
182
  services: z4.array(PriceTag.omit({ uid: true })).max(100).default([]),
155
- ...TimeLog.shape
183
+ lastModified: Timestamp.nullable()
156
184
  }).superRefine((billing, ctx) => {
157
185
  const totalServices = billing?.services?.length ?? 0;
158
186
  if (billing?.preferences?.useCreatedServices && totalServices < 1) {
159
187
  ctx.addIssue("At least (1) service must be added to the services list.");
160
188
  }
161
189
  });
162
- var RegisterCompanyForm = z4.object({
163
- regNo: z4.string(),
164
- userProvisions: z4.number(),
165
- slogan: z4.string(),
166
- email: z4.email(),
167
- phoneNumber: PhoneNumber,
168
- logo: FileDetails,
169
- receipt: FileDetails,
170
- _claims: z4.string()
171
- });
172
- var CompanyRegistrationClaims = z4.object({
173
- sender: UserModel,
174
- pricingRate: PricingRate.shape.companyRegistration,
175
- ...TimeLog.shape
176
- });
177
- var CompanyUser = z4.object({
178
- ...UserModel.shape,
179
- uid: UuidV7,
180
- status: z4.enum(["inviteSent", "active", "inactive"]),
181
- roles: z4.array(companyUserRoles).transform((roles) => {
182
- const newRoles = [];
183
- for (const role of roles) {
184
- if (!!role && !newRoles.includes(role)) newRoles.push(role);
185
- }
186
- return newRoles.sort();
187
- }).refine((roles) => {
188
- const compatibleRoles = getCompatibleRoles(roles[0]);
189
- return roles.every(
190
- (role, i) => i === 0 || compatibleRoles.includes(role)
191
- );
192
- }, "A user is not allowed to have conflicting roles."),
193
- lastActive: Timestamp,
194
- ...TimeLog.shape
195
- });
196
- var _staffDetails = z4.object({
197
- uid: UuidV7,
190
+ var StaffDetails = z4.object({
198
191
  members: z4.array(CompanyUser).superRefine((users, ctx) => {
199
192
  const duplicateUids = [];
200
193
  const duplicateEmails = [];
@@ -246,15 +239,16 @@ var _staffDetails = z4.object({
246
239
  const newList = [];
247
240
  for (const uid of list) {
248
241
  if (!uid || typeof uid !== "string") continue;
249
- if (!newList.some((newUid) => newUid.toLowerCase() === uid.toLowerCase())) {
242
+ if (!newList.some(
243
+ (newUid) => newUid.toLowerCase() === uid.toLowerCase()
244
+ )) {
250
245
  newList.push(uid);
251
246
  }
252
247
  }
253
248
  return newList.sort();
254
249
  }),
255
- ...TimeLog.shape
256
- });
257
- var StaffDetails = _staffDetails.transform((d) => {
250
+ lastModified: Timestamp.nullable()
251
+ }).transform((d) => {
258
252
  let blackListWithExisitingUsers = [];
259
253
  for (const uid of d.blackList) {
260
254
  if (!uid || typeof uid !== "string") continue;
@@ -294,11 +288,13 @@ var StaffDetails = _staffDetails.transform((d) => {
294
288
  }
295
289
  });
296
290
  var CompanyDetails = z4.object({
297
- uid: CompanyIdentity.shape.uid,
298
- identity: CompanyIdentity.omit({ uid: true }),
299
- opState: CompanyOpState.omit({ uid: true }),
300
- billing: CompanyBillingModel.omit({ uid: true }),
301
- staffDetails: _staffDetails.omit({ uid: true })
291
+ uid: UuidV7,
292
+ state: CompanyState,
293
+ identity: CompanyIdentity,
294
+ preferences: CompanyPreferences,
295
+ billing: CompanyBillingModel,
296
+ staffDetails: StaffDetails,
297
+ createdAt: Timestamp
302
298
  });
303
299
 
304
300
  // src/functions/helper-functions.ts
@@ -332,10 +328,7 @@ var getCompatibleRoles = (role) => {
332
328
  return companyUserRoles.exclude([role]).options;
333
329
  };
334
330
  export {
335
- CompanyBillingModel,
336
331
  CompanyDetails,
337
- CompanyIdentity,
338
- CompanyOpState,
339
332
  CompanyRegistrationClaims,
340
333
  CompanyUser,
341
334
  InvoiceNo,
@@ -343,7 +336,6 @@ export {
343
336
  PriceTag,
344
337
  PricingRate,
345
338
  RegisterCompanyForm,
346
- StaffDetails,
347
339
  StandardTime,
348
340
  TimeLog,
349
341
  Timestamp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",