@bizmap/sdk 0.0.14 → 0.0.16
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 +212 -26
- package/dist/main.js +159 -11
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const PricingRate: z.ZodObject<{
|
|
|
10
10
|
type PricingRate = z.infer<typeof PricingRate>;
|
|
11
11
|
declare const PriceAdjustment: z.ZodObject<{
|
|
12
12
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
13
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
13
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
14
14
|
description: z.ZodOptional<z.ZodString>;
|
|
15
15
|
fixedAmount: z.ZodNumber;
|
|
16
16
|
percentage: z.ZodNumber;
|
|
@@ -18,7 +18,7 @@ declare const PriceAdjustment: z.ZodObject<{
|
|
|
18
18
|
type PriceAdjustment = z.infer<typeof PriceAdjustment>;
|
|
19
19
|
declare const PriceTag: z.ZodObject<{
|
|
20
20
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
21
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
21
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
22
22
|
uid: z.ZodString;
|
|
23
23
|
item: z.ZodString;
|
|
24
24
|
cost: z.ZodNumber;
|
|
@@ -27,7 +27,7 @@ type PriceTag = z.infer<typeof PriceTag>;
|
|
|
27
27
|
|
|
28
28
|
declare const CompanyIdentity: z.ZodObject<{
|
|
29
29
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
30
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
30
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
31
31
|
uid: z.ZodReadonly<z.ZodString>;
|
|
32
32
|
displayName: z.ZodString;
|
|
33
33
|
logo: z.ZodOptional<z.ZodString>;
|
|
@@ -50,12 +50,12 @@ declare const CompanyIdentity: z.ZodObject<{
|
|
|
50
50
|
type CompanyIdentity = z.infer<typeof CompanyIdentity>;
|
|
51
51
|
declare const CompanyOpState: z.ZodObject<{
|
|
52
52
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
53
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
53
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
uid: z.ZodReadonly<z.ZodString>;
|
|
55
55
|
availableBalance: z.ZodNumber;
|
|
56
56
|
preferences: z.ZodObject<{
|
|
57
57
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
58
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
58
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
59
59
|
userProvisions: z.ZodNumber;
|
|
60
60
|
apptDistAlg: z.ZodEnum<{
|
|
61
61
|
RR: "RR";
|
|
@@ -66,13 +66,13 @@ declare const CompanyOpState: z.ZodObject<{
|
|
|
66
66
|
type CompanyOpState = z.infer<typeof CompanyOpState>;
|
|
67
67
|
declare const CompanyBillingModel: z.ZodObject<{
|
|
68
68
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
69
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
69
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
70
70
|
uid: z.ZodReadonly<z.ZodString>;
|
|
71
71
|
preferences: z.ZodObject<{
|
|
72
72
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
73
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
73
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
74
74
|
allowInvoiceDist: z.ZodBoolean;
|
|
75
|
-
|
|
75
|
+
serviceSelector: z.ZodEnum<{
|
|
76
76
|
scheduler: "scheduler";
|
|
77
77
|
doctor: "doctor";
|
|
78
78
|
}>;
|
|
@@ -86,21 +86,21 @@ declare const CompanyBillingModel: z.ZodObject<{
|
|
|
86
86
|
}, z.core.$strip>;
|
|
87
87
|
additionalFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
88
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
89
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
89
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
90
90
|
description: z.ZodOptional<z.ZodString>;
|
|
91
91
|
fixedAmount: z.ZodNumber;
|
|
92
92
|
percentage: z.ZodNumber;
|
|
93
93
|
}, z.core.$strip>>>;
|
|
94
94
|
discounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
95
95
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
96
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
96
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
97
97
|
description: z.ZodOptional<z.ZodString>;
|
|
98
98
|
fixedAmount: z.ZodNumber;
|
|
99
99
|
percentage: z.ZodNumber;
|
|
100
100
|
}, z.core.$strip>>>;
|
|
101
101
|
services: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
102
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
103
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
103
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
104
104
|
item: z.ZodString;
|
|
105
105
|
cost: z.ZodNumber;
|
|
106
106
|
}, z.core.$strip>>>;
|
|
@@ -155,7 +155,7 @@ declare const RegisterCompanyForm: z.ZodObject<{
|
|
|
155
155
|
type RegisterCompanyForm = z.infer<typeof RegisterCompanyForm>;
|
|
156
156
|
declare const CompanyRegistrationClaims: z.ZodObject<{
|
|
157
157
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
158
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
158
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
159
159
|
sender: z.ZodObject<{
|
|
160
160
|
name: z.ZodRecord<z.ZodEnum<{
|
|
161
161
|
first: "first";
|
|
@@ -175,20 +175,20 @@ declare const CompanyRegistrationClaims: z.ZodObject<{
|
|
|
175
175
|
type CompanyRegistrationClaims = z.infer<typeof CompanyRegistrationClaims>;
|
|
176
176
|
declare const CompanyUser: z.ZodObject<{
|
|
177
177
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
178
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
179
|
-
lastActive: z.ZodNumber;
|
|
178
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
180
179
|
status: z.ZodEnum<{
|
|
181
180
|
inviteSent: "inviteSent";
|
|
182
181
|
active: "active";
|
|
183
182
|
inactive: "inactive";
|
|
184
183
|
}>;
|
|
185
|
-
roles: z.ZodArray<z.ZodEnum<{
|
|
184
|
+
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
186
185
|
doc: "doc";
|
|
187
186
|
physAsst: "physAsst";
|
|
188
187
|
rcpst: "rcpst";
|
|
189
188
|
cshr: "cshr";
|
|
190
189
|
admin: "admin";
|
|
191
|
-
}>>;
|
|
190
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
191
|
+
lastActive: z.ZodNumber;
|
|
192
192
|
name: z.ZodRecord<z.ZodEnum<{
|
|
193
193
|
first: "first";
|
|
194
194
|
last: "last";
|
|
@@ -199,25 +199,55 @@ declare const CompanyUser: z.ZodObject<{
|
|
|
199
199
|
uid: z.ZodString;
|
|
200
200
|
}, z.core.$strip>;
|
|
201
201
|
type CompanyUser = z.infer<typeof CompanyUser>;
|
|
202
|
-
|
|
203
|
-
declare const StaffDetails: z.ZodObject<{
|
|
202
|
+
declare const _staffDetails: z.ZodObject<{
|
|
204
203
|
uid: z.ZodReadonly<z.ZodString>;
|
|
205
204
|
members: z.ZodArray<z.ZodObject<{
|
|
206
205
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
207
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
206
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
207
|
+
status: z.ZodEnum<{
|
|
208
|
+
inviteSent: "inviteSent";
|
|
209
|
+
active: "active";
|
|
210
|
+
inactive: "inactive";
|
|
211
|
+
}>;
|
|
212
|
+
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
213
|
+
doc: "doc";
|
|
214
|
+
physAsst: "physAsst";
|
|
215
|
+
rcpst: "rcpst";
|
|
216
|
+
cshr: "cshr";
|
|
217
|
+
admin: "admin";
|
|
218
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
208
219
|
lastActive: z.ZodNumber;
|
|
220
|
+
name: z.ZodRecord<z.ZodEnum<{
|
|
221
|
+
first: "first";
|
|
222
|
+
last: "last";
|
|
223
|
+
}>, z.ZodString>;
|
|
224
|
+
photoUrl: z.ZodOptional<z.ZodString>;
|
|
225
|
+
email: z.ZodEmail;
|
|
226
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
227
|
+
uid: z.ZodString;
|
|
228
|
+
}, z.core.$strip>>;
|
|
229
|
+
partnerMap: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
|
|
230
|
+
blackList: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>;
|
|
231
|
+
}, z.core.$strip>;
|
|
232
|
+
/** The unpacked Staff Details */
|
|
233
|
+
declare const StaffDetails: z.ZodPipe<z.ZodObject<{
|
|
234
|
+
uid: z.ZodReadonly<z.ZodString>;
|
|
235
|
+
members: z.ZodArray<z.ZodObject<{
|
|
236
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
237
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
209
238
|
status: z.ZodEnum<{
|
|
210
239
|
inviteSent: "inviteSent";
|
|
211
240
|
active: "active";
|
|
212
241
|
inactive: "inactive";
|
|
213
242
|
}>;
|
|
214
|
-
roles: z.ZodArray<z.ZodEnum<{
|
|
243
|
+
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
215
244
|
doc: "doc";
|
|
216
245
|
physAsst: "physAsst";
|
|
217
246
|
rcpst: "rcpst";
|
|
218
247
|
cshr: "cshr";
|
|
219
248
|
admin: "admin";
|
|
220
|
-
}>>;
|
|
249
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
250
|
+
lastActive: z.ZodNumber;
|
|
221
251
|
name: z.ZodRecord<z.ZodEnum<{
|
|
222
252
|
first: "first";
|
|
223
253
|
last: "last";
|
|
@@ -227,14 +257,154 @@ declare const StaffDetails: z.ZodObject<{
|
|
|
227
257
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
228
258
|
uid: z.ZodString;
|
|
229
259
|
}, z.core.$strip>>;
|
|
230
|
-
partnerMap: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString
|
|
231
|
-
blackList: z.ZodArray<z.ZodString
|
|
260
|
+
partnerMap: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
|
|
261
|
+
blackList: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>;
|
|
262
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
263
|
+
uid: string;
|
|
264
|
+
members: {
|
|
265
|
+
createdAt: number;
|
|
266
|
+
status: "inviteSent" | "active" | "inactive";
|
|
267
|
+
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
268
|
+
lastActive: number;
|
|
269
|
+
name: Record<"first" | "last", string>;
|
|
270
|
+
email: string;
|
|
271
|
+
uid: string;
|
|
272
|
+
lastModified?: number | null | undefined;
|
|
273
|
+
photoUrl?: string | undefined;
|
|
274
|
+
phoneNumber?: string | undefined;
|
|
275
|
+
}[];
|
|
276
|
+
partnerMap: Record<string, string[]>;
|
|
277
|
+
blackList: string[];
|
|
278
|
+
}, {
|
|
279
|
+
uid: string;
|
|
280
|
+
members: {
|
|
281
|
+
createdAt: number;
|
|
282
|
+
status: "inviteSent" | "active" | "inactive";
|
|
283
|
+
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
284
|
+
lastActive: number;
|
|
285
|
+
name: Record<"first" | "last", string>;
|
|
286
|
+
email: string;
|
|
287
|
+
uid: string;
|
|
288
|
+
lastModified?: number | null | undefined;
|
|
289
|
+
photoUrl?: string | undefined;
|
|
290
|
+
phoneNumber?: string | undefined;
|
|
291
|
+
}[];
|
|
292
|
+
partnerMap: Record<string, string[]>;
|
|
293
|
+
blackList: string[];
|
|
294
|
+
}>>;
|
|
295
|
+
type StaffDetails = z.infer<typeof _staffDetails>;
|
|
296
|
+
declare const CompanyDetails: z.ZodObject<{
|
|
297
|
+
uid: z.ZodString;
|
|
298
|
+
identity: z.ZodObject<{
|
|
299
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
300
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
301
|
+
address: z.ZodRecord<z.ZodEnum<{
|
|
302
|
+
streetAddress: "streetAddress";
|
|
303
|
+
city: "city";
|
|
304
|
+
parish: "parish";
|
|
305
|
+
country: "country";
|
|
306
|
+
}>, z.ZodString>;
|
|
307
|
+
displayName: z.ZodString;
|
|
308
|
+
logo: z.ZodOptional<z.ZodString>;
|
|
309
|
+
contact: z.ZodObject<{
|
|
310
|
+
email: z.ZodEmail;
|
|
311
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
312
|
+
}, z.core.$strip>;
|
|
313
|
+
legal: z.ZodObject<{
|
|
314
|
+
regNo: z.ZodReadonly<z.ZodString>;
|
|
315
|
+
trn: z.ZodOptional<z.ZodString>;
|
|
316
|
+
gctRegNo: z.ZodOptional<z.ZodString>;
|
|
317
|
+
}, z.core.$strip>;
|
|
318
|
+
}, z.core.$strip>;
|
|
319
|
+
opState: z.ZodObject<{
|
|
320
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
321
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
322
|
+
availableBalance: z.ZodNumber;
|
|
323
|
+
preferences: z.ZodObject<{
|
|
324
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
325
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
326
|
+
userProvisions: z.ZodNumber;
|
|
327
|
+
apptDistAlg: z.ZodEnum<{
|
|
328
|
+
RR: "RR";
|
|
329
|
+
LOR: "LOR";
|
|
330
|
+
}>;
|
|
331
|
+
}, z.core.$strip>;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
billing: z.ZodObject<{
|
|
334
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
335
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
336
|
+
preferences: z.ZodObject<{
|
|
337
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
338
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
339
|
+
allowInvoiceDist: z.ZodBoolean;
|
|
340
|
+
serviceSelector: z.ZodEnum<{
|
|
341
|
+
scheduler: "scheduler";
|
|
342
|
+
doctor: "doctor";
|
|
343
|
+
}>;
|
|
344
|
+
enforcePaidAppts: z.ZodBoolean;
|
|
345
|
+
primaryCurrency: z.ZodEnum<{
|
|
346
|
+
JMD: "JMD";
|
|
347
|
+
}>;
|
|
348
|
+
acceptedCurrencies: z.ZodArray<z.ZodEnum<{
|
|
349
|
+
JMD: "JMD";
|
|
350
|
+
}>>;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
additionalFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
353
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
354
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
355
|
+
description: z.ZodOptional<z.ZodString>;
|
|
356
|
+
fixedAmount: z.ZodNumber;
|
|
357
|
+
percentage: z.ZodNumber;
|
|
358
|
+
}, z.core.$strip>>>;
|
|
359
|
+
discounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
360
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
361
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
362
|
+
description: z.ZodOptional<z.ZodString>;
|
|
363
|
+
fixedAmount: z.ZodNumber;
|
|
364
|
+
percentage: z.ZodNumber;
|
|
365
|
+
}, z.core.$strip>>>;
|
|
366
|
+
services: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
367
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
368
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
369
|
+
item: z.ZodString;
|
|
370
|
+
cost: z.ZodNumber;
|
|
371
|
+
}, z.core.$strip>>>;
|
|
372
|
+
}, z.core.$strip>;
|
|
373
|
+
staffDetails: z.ZodObject<{
|
|
374
|
+
members: z.ZodArray<z.ZodObject<{
|
|
375
|
+
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
376
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
377
|
+
status: z.ZodEnum<{
|
|
378
|
+
inviteSent: "inviteSent";
|
|
379
|
+
active: "active";
|
|
380
|
+
inactive: "inactive";
|
|
381
|
+
}>;
|
|
382
|
+
roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
383
|
+
doc: "doc";
|
|
384
|
+
physAsst: "physAsst";
|
|
385
|
+
rcpst: "rcpst";
|
|
386
|
+
cshr: "cshr";
|
|
387
|
+
admin: "admin";
|
|
388
|
+
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
389
|
+
lastActive: z.ZodNumber;
|
|
390
|
+
name: z.ZodRecord<z.ZodEnum<{
|
|
391
|
+
first: "first";
|
|
392
|
+
last: "last";
|
|
393
|
+
}>, z.ZodString>;
|
|
394
|
+
photoUrl: z.ZodOptional<z.ZodString>;
|
|
395
|
+
email: z.ZodEmail;
|
|
396
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
397
|
+
uid: z.ZodString;
|
|
398
|
+
}, z.core.$strip>>;
|
|
399
|
+
partnerMap: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
|
|
400
|
+
blackList: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>;
|
|
401
|
+
}, z.core.$strip>;
|
|
232
402
|
}, z.core.$strip>;
|
|
233
|
-
type
|
|
403
|
+
type CompanyDetails = z.infer<typeof CompanyDetails>;
|
|
234
404
|
|
|
235
405
|
declare const TimeLog: z.ZodObject<{
|
|
236
406
|
createdAt: z.ZodReadonly<z.ZodNumber>;
|
|
237
|
-
lastModified: z.ZodNullable<z.ZodNumber
|
|
407
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
238
408
|
}, z.core.$strip>;
|
|
239
409
|
type TimeLog = z.infer<typeof TimeLog>;
|
|
240
410
|
declare const Time: z.ZodString;
|
|
@@ -265,4 +435,20 @@ declare const appointmentDistAlgs: z.ZodEnum<{
|
|
|
265
435
|
}>;
|
|
266
436
|
type AppointmentDistAlg = z.infer<typeof appointmentDistAlgs>;
|
|
267
437
|
|
|
268
|
-
|
|
438
|
+
/**@returns an array of the users that have conflicting roles or are incompatible with the other partners, or null if none was found. */
|
|
439
|
+
declare const findConflictingPartners: (...partners: CompanyUser[]) => {
|
|
440
|
+
createdAt: number;
|
|
441
|
+
status: "inviteSent" | "active" | "inactive";
|
|
442
|
+
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
443
|
+
lastActive: number;
|
|
444
|
+
name: Record<"first" | "last", string>;
|
|
445
|
+
email: string;
|
|
446
|
+
uid: string;
|
|
447
|
+
lastModified?: number | null | undefined;
|
|
448
|
+
photoUrl?: string | undefined;
|
|
449
|
+
phoneNumber?: string | undefined;
|
|
450
|
+
}[] | null;
|
|
451
|
+
/**@returns the roles that are compatible with the selected role. */
|
|
452
|
+
declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
|
|
453
|
+
|
|
454
|
+
export { type AppointmentDistAlg, CompanyBillingModel, CompanyDetails, CompanyIdentity, CompanyOpState, type CompanyPartnerRole, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StaffDetails, Time, TimeLog, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles };
|
package/dist/main.js
CHANGED
|
@@ -5,9 +5,11 @@ import * as z2 from "zod";
|
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
var TimeLog = z.object({
|
|
7
7
|
createdAt: z.number().readonly(),
|
|
8
|
-
lastModified: z.number().
|
|
8
|
+
lastModified: z.number().nullish()
|
|
9
|
+
});
|
|
10
|
+
var Time = z.string().regex(/^[0-9]{1,2}:[0-9]{2} (am|AM|pm|PM)/, {
|
|
11
|
+
error: "Must match the pattern hh:mm A"
|
|
9
12
|
});
|
|
10
|
-
var Time = z.string().regex(/^[0-9]{1,2}:[0-9]{2} (am|AM|pm|PM)/, { error: "Must match the pattern hh:mm A" });
|
|
11
13
|
|
|
12
14
|
// src/schemas/Billing.ts
|
|
13
15
|
var PricingRate = z2.object({
|
|
@@ -100,7 +102,7 @@ var CompanyBillingModel = z4.object({
|
|
|
100
102
|
/** Allows the serviceDecider to distribute invoices. */
|
|
101
103
|
allowInvoiceDist: z4.boolean(),
|
|
102
104
|
/** The user that's allowed to record the client's services. */
|
|
103
|
-
|
|
105
|
+
serviceSelector: z4.enum(["scheduler", "doctor"]),
|
|
104
106
|
/** A record of the payments made must be attached before creating the
|
|
105
107
|
* appointment
|
|
106
108
|
* @note
|
|
@@ -112,7 +114,7 @@ var CompanyBillingModel = z4.object({
|
|
|
112
114
|
acceptedCurrencies: z4.array(currencies),
|
|
113
115
|
...TimeLog.shape
|
|
114
116
|
}).superRefine((data, ctx) => {
|
|
115
|
-
if (data.enforcePaidAppts && data.
|
|
117
|
+
if (data.enforcePaidAppts && data.serviceSelector !== "scheduler") {
|
|
116
118
|
ctx.addIssue(
|
|
117
119
|
"serviceDecider must be scheduler when enforcePaidAppts is true."
|
|
118
120
|
);
|
|
@@ -140,22 +142,166 @@ var CompanyRegistrationClaims = z4.object({
|
|
|
140
142
|
});
|
|
141
143
|
var CompanyUser = z4.object({
|
|
142
144
|
...UserModel.shape,
|
|
143
|
-
lastActive: z4.number(),
|
|
144
145
|
status: z4.enum(["inviteSent", "active", "inactive"]),
|
|
145
|
-
roles: z4.array(companyUserRoles)
|
|
146
|
+
roles: z4.array(companyUserRoles).transform((roles) => {
|
|
147
|
+
const newRoles = [];
|
|
148
|
+
for (const role of roles) {
|
|
149
|
+
if (!role || typeof role !== "string") continue;
|
|
150
|
+
if (!newRoles.includes(role)) newRoles.push(role);
|
|
151
|
+
}
|
|
152
|
+
return newRoles;
|
|
153
|
+
}).refine((roles) => {
|
|
154
|
+
const compatibleRoles = getCompatibleRoles(roles[0]);
|
|
155
|
+
return roles.every(
|
|
156
|
+
(role, i) => i === 0 || compatibleRoles.includes(role)
|
|
157
|
+
);
|
|
158
|
+
}, "A user is not allowed to have conflicting roles."),
|
|
159
|
+
lastActive: z4.number(),
|
|
146
160
|
...TimeLog.shape
|
|
147
161
|
});
|
|
148
|
-
var
|
|
162
|
+
var _staffDetails = z4.object({
|
|
149
163
|
uid: CompanyIdentity.shape.uid,
|
|
150
|
-
members: z4.array(CompanyUser),
|
|
164
|
+
members: z4.array(CompanyUser).superRefine((users, ctx) => {
|
|
165
|
+
const duplicateUids = [];
|
|
166
|
+
const duplicateEmails = [];
|
|
167
|
+
const uids = [];
|
|
168
|
+
const emails = [];
|
|
169
|
+
for (const user of users) {
|
|
170
|
+
if (uids.includes(user.uid)) {
|
|
171
|
+
duplicateUids.push(user.uid);
|
|
172
|
+
} else {
|
|
173
|
+
uids.push(user.uid);
|
|
174
|
+
}
|
|
175
|
+
if (emails.includes(user.email)) {
|
|
176
|
+
duplicateEmails.push(user.email);
|
|
177
|
+
} else {
|
|
178
|
+
emails.push(user.email);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (duplicateUids.length > 0) {
|
|
182
|
+
ctx.addIssue(
|
|
183
|
+
`Having multiple members with the same uid is prohibited (${duplicateUids.join()}).`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
if (duplicateEmails.length > 0) {
|
|
187
|
+
ctx.addIssue(
|
|
188
|
+
`Having multiple members with the same email is prohibited (${duplicateEmails.join()}).`
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
151
192
|
/**
|
|
152
193
|
* @relationship one -> many
|
|
153
194
|
*@description A map of doctor `uids` to their assistants `uids` */
|
|
154
|
-
partnerMap: z4.record(
|
|
155
|
-
|
|
195
|
+
partnerMap: z4.record(
|
|
196
|
+
CompanyUser.shape.uid,
|
|
197
|
+
z4.array(CompanyUser.shape.uid).min(
|
|
198
|
+
1,
|
|
199
|
+
"At least (1) partner, excluding the leader, is required to create a partner group."
|
|
200
|
+
).transform((pUids) => {
|
|
201
|
+
const partners = [];
|
|
202
|
+
for (const uid of pUids) {
|
|
203
|
+
if (!uid || typeof uid !== "string") continue;
|
|
204
|
+
if (!partners.some((p) => p.toLowerCase() === uid.toLowerCase())) {
|
|
205
|
+
partners.push(uid);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return partners;
|
|
209
|
+
})
|
|
210
|
+
),
|
|
211
|
+
blackList: z4.array(CompanyUser.shape.uid).transform((list) => {
|
|
212
|
+
const newList = [];
|
|
213
|
+
for (const uid of list) {
|
|
214
|
+
if (!uid || typeof uid !== "string") continue;
|
|
215
|
+
if (!newList.some(
|
|
216
|
+
(newUid) => newUid.toLowerCase() === uid.toLowerCase()
|
|
217
|
+
)) {
|
|
218
|
+
newList.push(uid);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return newList;
|
|
222
|
+
})
|
|
223
|
+
// ...TimeLog.shape,
|
|
156
224
|
});
|
|
225
|
+
var StaffDetails = _staffDetails.transform((d) => {
|
|
226
|
+
let blackListWithExisitingUsers = [];
|
|
227
|
+
for (const uid of d.blackList) {
|
|
228
|
+
if (!uid || typeof uid !== "string") continue;
|
|
229
|
+
if (d.members.find((m) => m.uid.toLowerCase() === uid.toLowerCase())) {
|
|
230
|
+
blackListWithExisitingUsers.push(uid);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (blackListWithExisitingUsers.length !== d.blackList.length) {
|
|
234
|
+
d.blackList = blackListWithExisitingUsers;
|
|
235
|
+
}
|
|
236
|
+
return d;
|
|
237
|
+
}).superRefine((details, ctx) => {
|
|
238
|
+
const findMember = (uid) => details.members.find((m) => m.uid === uid);
|
|
239
|
+
for (const [docUid, physAssts] of Object.entries(details.partnerMap)) {
|
|
240
|
+
const queriedDoc = findMember(docUid);
|
|
241
|
+
if (!queriedDoc) {
|
|
242
|
+
ctx.addIssue(
|
|
243
|
+
`Only existing members of a company are allowed to be leaders of a partner group (${docUid}).`
|
|
244
|
+
);
|
|
245
|
+
} else if (!queriedDoc?.roles?.includes?.("doc")) {
|
|
246
|
+
ctx.addIssue(
|
|
247
|
+
`A partner group leader must have the "doc" role (${docUid}).`
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
for (const asstUid of physAssts) {
|
|
251
|
+
const queriedAsst = findMember(asstUid);
|
|
252
|
+
if (!queriedAsst) {
|
|
253
|
+
ctx.addIssue(
|
|
254
|
+
`Only existing members of a company are allowed to be apart of a partner group (${asstUid}).`
|
|
255
|
+
);
|
|
256
|
+
} else if (!queriedAsst?.roles?.includes?.("physAsst")) {
|
|
257
|
+
ctx.addIssue(
|
|
258
|
+
`A partner group member must have the "physAsst" role (${asstUid}).`
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
var CompanyDetails = z4.object({
|
|
265
|
+
uid: z4.string(),
|
|
266
|
+
identity: CompanyIdentity.omit({ uid: true }),
|
|
267
|
+
opState: CompanyOpState.omit({ uid: true }),
|
|
268
|
+
billing: CompanyBillingModel.omit({ uid: true }),
|
|
269
|
+
staffDetails: _staffDetails.omit({ uid: true })
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// src/functions/helper-functions.ts
|
|
273
|
+
var findConflictingPartners = (...partners) => {
|
|
274
|
+
let hasSingleDoctor = false;
|
|
275
|
+
const conflicts = [];
|
|
276
|
+
if (!partners) return partners;
|
|
277
|
+
for (const partner of partners) {
|
|
278
|
+
if (!partner.roles || partner.roles.some(
|
|
279
|
+
(r) => !companyPartnerRoles.options.includes(r)
|
|
280
|
+
) || !CompanyUser.shape.roles.safeParse(partner.roles).success) {
|
|
281
|
+
conflicts.push(partner);
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (partner.roles.includes("doc") && !hasSingleDoctor) {
|
|
285
|
+
hasSingleDoctor = true;
|
|
286
|
+
} else if (partner.roles.includes("doc")) {
|
|
287
|
+
conflicts.push(partner);
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return conflicts.length === 0 ? null : conflicts;
|
|
292
|
+
};
|
|
293
|
+
var getCompatibleRoles = (role) => {
|
|
294
|
+
if (role === "physAsst") {
|
|
295
|
+
return companyUserRoles.exclude(["admin", "doc", role]).options;
|
|
296
|
+
}
|
|
297
|
+
if (role === "admin" || role === "doc") {
|
|
298
|
+
return companyUserRoles.exclude(["physAsst", role]).options;
|
|
299
|
+
}
|
|
300
|
+
return companyUserRoles.exclude([role]).options;
|
|
301
|
+
};
|
|
157
302
|
export {
|
|
158
303
|
CompanyBillingModel,
|
|
304
|
+
CompanyDetails,
|
|
159
305
|
CompanyIdentity,
|
|
160
306
|
CompanyOpState,
|
|
161
307
|
CompanyRegistrationClaims,
|
|
@@ -170,5 +316,7 @@ export {
|
|
|
170
316
|
appointmentDistAlgs,
|
|
171
317
|
companyPartnerRoles,
|
|
172
318
|
companyUserRoles,
|
|
173
|
-
employeeRoles
|
|
319
|
+
employeeRoles,
|
|
320
|
+
findConflictingPartners,
|
|
321
|
+
getCompatibleRoles
|
|
174
322
|
};
|