@bizmap/sdk 0.0.54 → 0.0.56
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 +737 -27
- package/dist/main.js +260 -79
- package/package.json +8 -3
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/enums/
|
|
1
|
+
// src/enums/Company.ts
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
var companyUserRoles = z.enum([
|
|
4
4
|
"doc",
|
|
@@ -19,33 +19,21 @@ var healthcareProviderRoles = companyUserRoles.extract([
|
|
|
19
19
|
var appointmentDistAlgs = z.enum(["RR", "LOR"]);
|
|
20
20
|
var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
|
|
21
21
|
|
|
22
|
-
// src/enums/
|
|
22
|
+
// src/enums/App.ts
|
|
23
23
|
import * as z2 from "zod";
|
|
24
24
|
var tiers = z2.enum(["free", "pro", "premium", "gold"]);
|
|
25
|
+
var paymentMethods = z2.enum(["cash", "card", "insurance"]);
|
|
25
26
|
|
|
26
27
|
// src/schemas/Billing.ts
|
|
27
28
|
import { currencies } from "@wavy/util";
|
|
28
29
|
import * as z4 from "zod";
|
|
29
30
|
|
|
30
31
|
// src/schemas/utils.ts
|
|
31
|
-
import { validate, version } from "uuid";
|
|
32
32
|
import * as z3 from "zod";
|
|
33
33
|
var InvoiceNo = z3.string().regex(
|
|
34
34
|
/^[0-9]{4}-(01|(0[2-9])|(1[0-2]))-(30|31|([1-2][0-9])|0[1-9])-[0-9]{7}/,
|
|
35
35
|
'An invoice no. must match the pattern "yyyy-mm-dd-9999999".'
|
|
36
36
|
);
|
|
37
|
-
var UuidV4 = z3.string().readonly().refine(
|
|
38
|
-
(uid) => validate(uid) && version(uid) === 4,
|
|
39
|
-
"Expected a v4 uuid but received an invalid uuid."
|
|
40
|
-
);
|
|
41
|
-
var UuidV7 = z3.string().readonly().refine(
|
|
42
|
-
(uid) => validate(uid) && version(uid) === 7,
|
|
43
|
-
"Expected a v7 uuid but received an invalid uuid."
|
|
44
|
-
);
|
|
45
|
-
var Jwt = z3.string().regex(
|
|
46
|
-
/^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/,
|
|
47
|
-
"An invalid jwt token was used."
|
|
48
|
-
);
|
|
49
37
|
var StandardTime = z3.string().regex(
|
|
50
38
|
/^(01|(0[2-9])|(1[0-2])):(([1-5][0-9])|0[0-9]) (am|pm)/i,
|
|
51
39
|
"A standard time must match the pattern hh:mm A."
|
|
@@ -59,6 +47,14 @@ var TimeLog = z3.object({
|
|
|
59
47
|
createdAt: Timestamp.readonly(),
|
|
60
48
|
lastModified: Timestamp.nullish()
|
|
61
49
|
});
|
|
50
|
+
var TicketNo = z3.int().positive().refine(
|
|
51
|
+
(t) => t.toString().length <= 10,
|
|
52
|
+
"A ticket no. can only have (10) max digits."
|
|
53
|
+
).readonly();
|
|
54
|
+
var Reason = z3.object({
|
|
55
|
+
value: z3.string().trim().max(150),
|
|
56
|
+
lastModified: Timestamp
|
|
57
|
+
});
|
|
62
58
|
|
|
63
59
|
// src/schemas/Billing.ts
|
|
64
60
|
var PriceAdjustment = z4.object({
|
|
@@ -71,7 +67,7 @@ var PriceAdjustment = z4.object({
|
|
|
71
67
|
...TimeLog.shape
|
|
72
68
|
});
|
|
73
69
|
var PriceTag = z4.object({
|
|
74
|
-
uid:
|
|
70
|
+
uid: z4.uuidv4(),
|
|
75
71
|
/**The name of the item that's being priced */
|
|
76
72
|
item: z4.string().trim().min(3, "The price item must be atleast (3) characters long.").max(50, "The price item can't be more than (50) characters long."),
|
|
77
73
|
cost: z4.number().min(1, "The minimum allowed cost is $1.00").max(1e9, "The max allowed cost is $1,000,000,000.00."),
|
|
@@ -80,8 +76,8 @@ var PriceTag = z4.object({
|
|
|
80
76
|
});
|
|
81
77
|
|
|
82
78
|
// src/schemas/Company.ts
|
|
83
|
-
import { Address, PhoneNumber, UserModel } from "@wavy/util";
|
|
84
|
-
import * as
|
|
79
|
+
import { Address as Address2, PhoneNumber, UserModel as UserModel2 } from "@wavy/util";
|
|
80
|
+
import * as z7 from "zod";
|
|
85
81
|
|
|
86
82
|
// src/functions/helper-functions.ts
|
|
87
83
|
var findConflictingPartners = (...partners) => {
|
|
@@ -114,7 +110,7 @@ var getCompatibleRoles = (role) => {
|
|
|
114
110
|
return companyUserRoles.exclude([role]).options;
|
|
115
111
|
};
|
|
116
112
|
|
|
117
|
-
// src/schemas/
|
|
113
|
+
// src/schemas/App.ts
|
|
118
114
|
import * as z5 from "zod";
|
|
119
115
|
import { currencies as currencies2 } from "@wavy/util";
|
|
120
116
|
var TierList = z5.record(
|
|
@@ -151,7 +147,7 @@ var Notification = z5.object({
|
|
|
151
147
|
};
|
|
152
148
|
switch (data.code) {
|
|
153
149
|
case "COMPANY_INVITE":
|
|
154
|
-
if (!
|
|
150
|
+
if (!z5.jwt().safeParse(data.payload).success) {
|
|
155
151
|
ctx.addIssue("The payload of company invite must be a valid jwt.");
|
|
156
152
|
}
|
|
157
153
|
break;
|
|
@@ -172,23 +168,47 @@ var Notification = z5.object({
|
|
|
172
168
|
return data.code;
|
|
173
169
|
}
|
|
174
170
|
});
|
|
175
|
-
var
|
|
176
|
-
uid:
|
|
171
|
+
var CreditCurrency = z5.object({
|
|
172
|
+
uid: z5.uuidv4(),
|
|
177
173
|
cost: z5.object({ value: z5.number().min(0), currency: currencies2 }),
|
|
178
174
|
value: z5.int().min(0),
|
|
179
175
|
...TimeLog.shape
|
|
180
176
|
});
|
|
181
177
|
|
|
182
|
-
// src/schemas/
|
|
183
|
-
|
|
178
|
+
// src/schemas/User.ts
|
|
179
|
+
import { Address, UserModel } from "@wavy/util";
|
|
180
|
+
import * as z6 from "zod";
|
|
181
|
+
var UserDetails = z6.object({
|
|
184
182
|
...UserModel.shape,
|
|
185
|
-
uid:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
uid: z6.uuidv4(),
|
|
184
|
+
email: UserModel.shape.email.nullish(),
|
|
185
|
+
dob: Timestamp.optional(),
|
|
186
|
+
address: Address.optional(),
|
|
187
|
+
publicKey: z6.string().nullable(),
|
|
188
|
+
notifications: z6.array(Notification),
|
|
189
|
+
activated: z6.boolean(),
|
|
190
|
+
...TimeLog.shape
|
|
191
|
+
}).superRefine((data, ctx) => {
|
|
192
|
+
if (data.activated && data.publicKey === null) {
|
|
193
|
+
ctx.addIssue("An activated user must have a valid public key.");
|
|
194
|
+
} else if (!data.activated && data.publicKey !== null) {
|
|
195
|
+
ctx.addIssue("An inactive user can't have a public key.");
|
|
196
|
+
}
|
|
197
|
+
if (data.activated && !data.email) {
|
|
198
|
+
ctx.addIssue("An activated user must have a valid email.");
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// src/schemas/Company.ts
|
|
203
|
+
var CompanyUser = z7.object({
|
|
204
|
+
...UserModel2.shape,
|
|
205
|
+
uid: UserDetails.shape.uid,
|
|
206
|
+
status: z7.enum(["inviteSent", "active", "inactive"]),
|
|
207
|
+
availability: z7.object({
|
|
208
|
+
isAvailable: z7.boolean().default(true),
|
|
189
209
|
lastModified: Timestamp.nullable().default(null)
|
|
190
210
|
}),
|
|
191
|
-
roles:
|
|
211
|
+
roles: z7.array(companyUserRoles).transform((roles) => {
|
|
192
212
|
const newRoles = [];
|
|
193
213
|
for (const role of roles) {
|
|
194
214
|
if (!!role && !newRoles.includes(role)) newRoles.push(role);
|
|
@@ -199,11 +219,11 @@ var CompanyUser = z6.object({
|
|
|
199
219
|
(role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
|
|
200
220
|
);
|
|
201
221
|
}, "A user is not allowed to have conflicting roles."),
|
|
202
|
-
isBusy:
|
|
222
|
+
isBusy: z7.boolean(),
|
|
203
223
|
/** This should reset at the end of every cycle. */
|
|
204
|
-
appointmentCounter:
|
|
205
|
-
|
|
206
|
-
|
|
224
|
+
appointmentCounter: z7.record(
|
|
225
|
+
z7.literal(["ongoing", "completed"]),
|
|
226
|
+
z7.int().min(0)
|
|
207
227
|
),
|
|
208
228
|
lastActive: Timestamp.nullable(),
|
|
209
229
|
inviteSent: Timestamp.nullable(),
|
|
@@ -224,43 +244,49 @@ var CompanyUser = z6.object({
|
|
|
224
244
|
);
|
|
225
245
|
}
|
|
226
246
|
});
|
|
227
|
-
var CompanyInviteList =
|
|
247
|
+
var CompanyInviteList = z7.record(
|
|
228
248
|
CompanyUser.shape.email,
|
|
229
|
-
|
|
249
|
+
z7.object({ createdAt: Timestamp, roles: CompanyUser.shape.roles })
|
|
230
250
|
).refine(
|
|
231
251
|
(data) => Object.keys(data).length > 0,
|
|
232
252
|
"Insufficient amount of members invited."
|
|
233
253
|
);
|
|
234
|
-
var CompanyIdentity =
|
|
235
|
-
displayName:
|
|
236
|
-
logo:
|
|
237
|
-
|
|
238
|
-
|
|
254
|
+
var CompanyIdentity = z7.object({
|
|
255
|
+
displayName: z7.string().min(3).max(25),
|
|
256
|
+
logo: z7.string().max(2500).nullish(),
|
|
257
|
+
/** Hash this field */
|
|
258
|
+
// password: z.string(),
|
|
259
|
+
contact: z7.object({
|
|
260
|
+
email: z7.email().max(25),
|
|
239
261
|
phoneNumber: PhoneNumber.optional()
|
|
240
262
|
}),
|
|
241
|
-
address:
|
|
263
|
+
address: Address2,
|
|
242
264
|
// Can only be changed by the server
|
|
243
|
-
tier:
|
|
265
|
+
tier: z7.object({
|
|
244
266
|
current: tiers,
|
|
245
267
|
lastModified: Timestamp.nullable()
|
|
246
268
|
}),
|
|
247
|
-
legal:
|
|
248
|
-
regNo:
|
|
269
|
+
legal: z7.object({
|
|
270
|
+
regNo: z7.string().max(20).readonly(),
|
|
249
271
|
// The company's registration number
|
|
250
|
-
trn:
|
|
251
|
-
gctRegNo:
|
|
272
|
+
trn: z7.string().regex(/[0-9]{3}-[0-9]{3}-[0-9]{3}/).nullish(),
|
|
273
|
+
gctRegNo: z7.string().max(15).nullish()
|
|
252
274
|
}),
|
|
253
275
|
lastModified: Timestamp.nullable()
|
|
254
276
|
});
|
|
255
|
-
var CompanyState =
|
|
256
|
-
credits:
|
|
257
|
-
current:
|
|
277
|
+
var CompanyState = z7.object({
|
|
278
|
+
credits: z7.object({
|
|
279
|
+
current: z7.number(),
|
|
280
|
+
lastModified: Timestamp.nullable()
|
|
281
|
+
}),
|
|
282
|
+
maxStaff: z7.object({
|
|
283
|
+
current: z7.int().min(1),
|
|
258
284
|
lastModified: Timestamp.nullable()
|
|
259
285
|
}),
|
|
260
|
-
storageInBytes:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
current:
|
|
286
|
+
storageInBytes: z7.record(
|
|
287
|
+
z7.literal(["used", "max"]),
|
|
288
|
+
z7.object({
|
|
289
|
+
current: z7.number(),
|
|
264
290
|
lastModified: Timestamp.nullable()
|
|
265
291
|
})
|
|
266
292
|
).refine(
|
|
@@ -270,13 +296,13 @@ var CompanyState = z6.object({
|
|
|
270
296
|
/** A counter for the company's invoice no.
|
|
271
297
|
* @note This should only be null when the cycle resets
|
|
272
298
|
*/
|
|
273
|
-
invoiceNoCounter:
|
|
299
|
+
invoiceNoCounter: z7.int().min(1),
|
|
274
300
|
/** A counter for the company's ticket no. */
|
|
275
|
-
tktNoCounter:
|
|
301
|
+
tktNoCounter: z7.int().min(1),
|
|
276
302
|
lastSavedAt: Timestamp.nullable(),
|
|
277
303
|
lastModified: Timestamp.nullable()
|
|
278
304
|
});
|
|
279
|
-
var CompanyPreferences =
|
|
305
|
+
var CompanyPreferences = z7.object({
|
|
280
306
|
/** The user that's allowed to record the client's services. */
|
|
281
307
|
serviceSelector: companyServiceSelectors,
|
|
282
308
|
/** A record of the payments made must be attached before creating the
|
|
@@ -284,7 +310,7 @@ var CompanyPreferences = z6.object({
|
|
|
284
310
|
* @note
|
|
285
311
|
* - only allowed when `serviceDecider === "scheduler"`
|
|
286
312
|
* */
|
|
287
|
-
enforcePaidAppts:
|
|
313
|
+
enforcePaidAppts: z7.boolean(),
|
|
288
314
|
/**
|
|
289
315
|
* @property RR (Round Robin): Even distribution.
|
|
290
316
|
* @property LOR (Least Outstanding Requests): Distribute based on availability.
|
|
@@ -295,13 +321,16 @@ var CompanyPreferences = z6.object({
|
|
|
295
321
|
(data) => !data.enforcePaidAppts || data.enforcePaidAppts && data.serviceSelector === "scheduler",
|
|
296
322
|
'Enforcing paid appointments is only allowed when the service selector is the "scheduler".'
|
|
297
323
|
);
|
|
298
|
-
var Billing =
|
|
299
|
-
additionalFees:
|
|
300
|
-
|
|
301
|
-
|
|
324
|
+
var Billing = z7.object({
|
|
325
|
+
additionalFees: z7.array(PriceAdjustment).max(100).default([]),
|
|
326
|
+
/** Automatically deducted from ALL bills */
|
|
327
|
+
discounts: z7.array(PriceAdjustment).max(100).default([]),
|
|
328
|
+
/** Optionally deductable from bills */
|
|
329
|
+
prepayments: z7.array(PriceAdjustment).max(100).default([]),
|
|
330
|
+
services: z7.object({
|
|
302
331
|
/** Forces service selectors to use the list of service(s) that you've created. */
|
|
303
|
-
deployed:
|
|
304
|
-
value:
|
|
332
|
+
deployed: z7.boolean(),
|
|
333
|
+
value: z7.record(z7.string(), PriceTag.omit({ uid: true }))
|
|
305
334
|
}).superRefine((data, ctx) => {
|
|
306
335
|
const services = Object.entries(data.value);
|
|
307
336
|
if (services.length > 150) {
|
|
@@ -324,8 +353,8 @@ var Billing = z6.object({
|
|
|
324
353
|
}),
|
|
325
354
|
lastModified: Timestamp.nullable()
|
|
326
355
|
});
|
|
327
|
-
var Staff =
|
|
328
|
-
members:
|
|
356
|
+
var Staff = z7.object({
|
|
357
|
+
members: z7.record(CompanyUser.shape.uid, CompanyUser).superRefine((data, ctx) => {
|
|
329
358
|
const emails = [];
|
|
330
359
|
for (const [uid, user] of Object.entries(data)) {
|
|
331
360
|
if (uid !== user.uid) {
|
|
@@ -345,15 +374,15 @@ var Staff = z6.object({
|
|
|
345
374
|
/**
|
|
346
375
|
* @relationship one -> many
|
|
347
376
|
*@description A map of doctor `uids` to their assistants `uids` */
|
|
348
|
-
partnerMap:
|
|
377
|
+
partnerMap: z7.record(
|
|
349
378
|
CompanyUser.shape.uid,
|
|
350
|
-
|
|
379
|
+
z7.record(CompanyUser.shape.uid, z7.object({ addedAt: Timestamp }))
|
|
351
380
|
),
|
|
352
|
-
updateQueue:
|
|
381
|
+
updateQueue: z7.record(
|
|
353
382
|
CompanyUser.shape.uid,
|
|
354
|
-
|
|
355
|
-
$REMOVE:
|
|
356
|
-
$CHANGE_ROLES:
|
|
383
|
+
z7.object({
|
|
384
|
+
$REMOVE: z7.object({ addedAt: Timestamp }),
|
|
385
|
+
$CHANGE_ROLES: z7.object({
|
|
357
386
|
newRoles: CompanyUser.shape.roles,
|
|
358
387
|
addedAt: Timestamp
|
|
359
388
|
})
|
|
@@ -414,14 +443,14 @@ var Staff = z6.object({
|
|
|
414
443
|
}
|
|
415
444
|
}
|
|
416
445
|
});
|
|
417
|
-
var CompanyNotifications =
|
|
446
|
+
var CompanyNotifications = z7.array(Notification).refine(
|
|
418
447
|
(data) => data.every((notif) => notif.code !== "COMPANY_INVITE"),
|
|
419
448
|
"A company can't receive a company invite."
|
|
420
449
|
);
|
|
421
|
-
var Receipts =
|
|
450
|
+
var Receipts = z7.array(PriceTag.omit({ uid: true, lastModified: true }));
|
|
422
451
|
var createCompanyDetails = (options) => {
|
|
423
|
-
return
|
|
424
|
-
uid:
|
|
452
|
+
return z7.object({
|
|
453
|
+
uid: z7.uuidv4(),
|
|
425
454
|
identity: CompanyIdentity,
|
|
426
455
|
notifications: options.partial ? CompanyNotifications.nullish() : CompanyNotifications,
|
|
427
456
|
receipts: options.partial ? Receipts.nullish() : Receipts,
|
|
@@ -434,24 +463,175 @@ var createCompanyDetails = (options) => {
|
|
|
434
463
|
};
|
|
435
464
|
var CompanyDetails = createCompanyDetails({ partial: false });
|
|
436
465
|
var PartialCompanyDetails = createCompanyDetails({ partial: true });
|
|
466
|
+
|
|
467
|
+
// src/schemas/Medical.ts
|
|
468
|
+
import * as z9 from "zod";
|
|
469
|
+
|
|
470
|
+
// src/enums/Medical.ts
|
|
471
|
+
import * as z8 from "zod";
|
|
472
|
+
var vitalKeys = z8.enum([
|
|
473
|
+
"heartRate",
|
|
474
|
+
"respiratoryRate",
|
|
475
|
+
"bloodPressure",
|
|
476
|
+
"bloodOxygen",
|
|
477
|
+
"bodyTemp"
|
|
478
|
+
]);
|
|
479
|
+
|
|
480
|
+
// src/schemas/Medical.ts
|
|
481
|
+
var Vitals = z9.record(
|
|
482
|
+
vitalKeys,
|
|
483
|
+
z9.object({
|
|
484
|
+
value: z9.string().trim().regex(/^\d{0,3}((\/|\.)\d{1,3})?/),
|
|
485
|
+
lastModified: Timestamp.nullable()
|
|
486
|
+
})
|
|
487
|
+
);
|
|
488
|
+
var Medicine = z9.object({
|
|
489
|
+
brand: z9.string().trim(),
|
|
490
|
+
expiresAt: Timestamp.nullish(),
|
|
491
|
+
quantity: z9.string().trim().regex(/^\d+(\.\d{1,3})? ?[a-zA-Z]{1,20}/, {
|
|
492
|
+
error: "Failed to match the pattern <number>+(.<number>{1,3})? ?[a-zA-Z]{1,20}"
|
|
493
|
+
}),
|
|
494
|
+
refills: z9.string().trim().regex(/^[0-8]/, { error: "Must be between 0 and 8" }),
|
|
495
|
+
directions: z9.string().trim().max(100, { error: "Must be 100 characters or less" }),
|
|
496
|
+
...TimeLog.shape
|
|
497
|
+
});
|
|
498
|
+
var MedicalDetails = z9.object({
|
|
499
|
+
vitals: Vitals,
|
|
500
|
+
prescriptions: z9.array(z9.array(Medicine)).nullish(),
|
|
501
|
+
doctorNote: z9.object({
|
|
502
|
+
value: z9.string(),
|
|
503
|
+
lastModified: Timestamp.nullable()
|
|
504
|
+
}),
|
|
505
|
+
physAsstNotes: z9.array(
|
|
506
|
+
z9.object({
|
|
507
|
+
title: z9.string(),
|
|
508
|
+
content: z9.string(),
|
|
509
|
+
...TimeLog.shape
|
|
510
|
+
})
|
|
511
|
+
).optional()
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// src/schemas/mini/Services.ts
|
|
515
|
+
import * as z10 from "zod";
|
|
516
|
+
|
|
517
|
+
// src/schemas/Client.ts
|
|
518
|
+
var ClientIdentity = UserDetails.omit({ notifications: true });
|
|
519
|
+
|
|
520
|
+
// src/schemas/mini/Services.ts
|
|
521
|
+
var TimelineActivity = z10.object({
|
|
522
|
+
postedAt: Timestamp.nullish(),
|
|
523
|
+
userUid: CompanyUser.shape.uid.nonoptional()
|
|
524
|
+
});
|
|
525
|
+
var MiniServiceDetails = z10.object({
|
|
526
|
+
/** A random uid that identifies the document. */
|
|
527
|
+
_id: z10.uuidv4(),
|
|
528
|
+
/** The company's uid */
|
|
529
|
+
src: CompanyDetails.shape.uid,
|
|
530
|
+
/** The ticket number */
|
|
531
|
+
tkt: TicketNo,
|
|
532
|
+
/**The reason for the service */
|
|
533
|
+
reason: z10.object({
|
|
534
|
+
value: Reason.shape.value,
|
|
535
|
+
...TimeLog.shape
|
|
536
|
+
}).optional(),
|
|
537
|
+
/**
|
|
538
|
+
* This gets resolved after the service provider attaches an invoice and posts the client
|
|
539
|
+
* (resolving after posting the client is required for consistency - if it's added when the
|
|
540
|
+
* appointment is created and the appointment get cancelled, then there would be a missing
|
|
541
|
+
* invoiceNo, which will seem a bit suspicious...)
|
|
542
|
+
*/
|
|
543
|
+
invoiceNo: InvoiceNo.optional(),
|
|
544
|
+
/** The services that the client has done/will do. */
|
|
545
|
+
charges: z10.array(PriceTag.omit({ uid: true })).max(4),
|
|
546
|
+
/**Required to calculate the accurate grandTotal of the charges */
|
|
547
|
+
additionalFees: z10.array(PriceAdjustment).nullable().readonly(),
|
|
548
|
+
/**Required to calculate the accurate grandTotal of the charges */
|
|
549
|
+
discounts: z10.array(PriceAdjustment).nullable().readonly(),
|
|
550
|
+
prepayments: z10.array(PriceAdjustment).nullable(),
|
|
551
|
+
/** The client's identity */
|
|
552
|
+
clientUid: ClientIdentity.shape.uid,
|
|
553
|
+
/**
|
|
554
|
+
* Data that is specific to the entity (for now it's just medical data).
|
|
555
|
+
* It will only be defined for the participants that have access to it.
|
|
556
|
+
*/
|
|
557
|
+
payload: z10.object({
|
|
558
|
+
...MedicalDetails.shape,
|
|
559
|
+
lastModified: z10.number().nullable()
|
|
560
|
+
}).nullish(),
|
|
561
|
+
/** Only defined when either the service provider or the client cancelled their appointment */
|
|
562
|
+
cancelled: z10.object({
|
|
563
|
+
/** The time that the confirm cancel button was clicked */
|
|
564
|
+
doneAt: Timestamp,
|
|
565
|
+
reason: Reason,
|
|
566
|
+
doneBy: companyUserRoles.extract(["doc", "physAsst"])
|
|
567
|
+
}).optional(),
|
|
568
|
+
/** Add this after consulting with company owners about payment expectations */
|
|
569
|
+
// paymentDueDate: Timestamp.nullish(),
|
|
570
|
+
payments: z10.array(
|
|
571
|
+
z10.object({
|
|
572
|
+
method: paymentMethods,
|
|
573
|
+
amount: z10.number().positive(),
|
|
574
|
+
...TimeLog.shape
|
|
575
|
+
})
|
|
576
|
+
).max(100).nullish(),
|
|
577
|
+
timeline: z10.object({
|
|
578
|
+
scheduler: TimelineActivity,
|
|
579
|
+
physAsst: TimelineActivity.or(z10.literal("none")),
|
|
580
|
+
doctor: TimelineActivity,
|
|
581
|
+
cashier: TimelineActivity.nullable()
|
|
582
|
+
}),
|
|
583
|
+
...TimeLog.shape
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
// src/schemas/unpacked/Services.ts
|
|
587
|
+
import { nameKeys } from "@wavy/util";
|
|
588
|
+
import * as z11 from "zod";
|
|
589
|
+
var ServiceDetails = MiniServiceDetails.omit({
|
|
590
|
+
clientUid: true
|
|
591
|
+
}).extend(z11.object({ client: ClientIdentity }).shape);
|
|
592
|
+
var MutableServiceDetails = ServiceDetails.safeExtend(
|
|
593
|
+
z11.object({
|
|
594
|
+
/**
|
|
595
|
+
* @description An encrypted copy of the last state of the service.
|
|
596
|
+
* @note Used to accurately update the service without having to query the database
|
|
597
|
+
*/
|
|
598
|
+
_hash: z11.string()
|
|
599
|
+
}).shape
|
|
600
|
+
);
|
|
601
|
+
var CreateServiceForm = z11.object({
|
|
602
|
+
clientName: z11.record(nameKeys, z11.string().trim().min(2)),
|
|
603
|
+
/** A nullish value === next_available */
|
|
604
|
+
providerUid: CompanyUser.shape.uid.nullish(),
|
|
605
|
+
charges: ServiceDetails.shape.charges.optional(),
|
|
606
|
+
prepayments: ServiceDetails.shape.prepayments.optional(),
|
|
607
|
+
payments: ServiceDetails.shape.payments.optional(),
|
|
608
|
+
...TimeLog.shape
|
|
609
|
+
});
|
|
437
610
|
export {
|
|
438
611
|
CompanyDetails,
|
|
439
612
|
CompanyInviteList,
|
|
440
613
|
CompanyUser,
|
|
441
|
-
|
|
614
|
+
CreateServiceForm,
|
|
615
|
+
CreditCurrency,
|
|
442
616
|
InviteResponse,
|
|
443
617
|
InvoiceNo,
|
|
444
|
-
|
|
618
|
+
MedicalDetails,
|
|
619
|
+
Medicine,
|
|
620
|
+
MiniServiceDetails,
|
|
621
|
+
MutableServiceDetails,
|
|
445
622
|
Notification,
|
|
446
623
|
PartialCompanyDetails,
|
|
447
624
|
PriceAdjustment,
|
|
448
625
|
PriceTag,
|
|
626
|
+
Reason,
|
|
627
|
+
ServiceDetails,
|
|
449
628
|
StandardTime,
|
|
629
|
+
TicketNo,
|
|
450
630
|
TierList,
|
|
451
631
|
TimeLog,
|
|
452
632
|
Timestamp,
|
|
453
|
-
|
|
454
|
-
|
|
633
|
+
UserDetails,
|
|
634
|
+
Vitals,
|
|
455
635
|
appointmentDistAlgs,
|
|
456
636
|
companyPartnerRoles,
|
|
457
637
|
companyServiceSelectors,
|
|
@@ -460,5 +640,6 @@ export {
|
|
|
460
640
|
findConflictingPartners,
|
|
461
641
|
getCompatibleRoles,
|
|
462
642
|
healthcareProviderRoles,
|
|
643
|
+
paymentMethods,
|
|
463
644
|
tiers
|
|
464
645
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bizmap/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"main": "./dist/main.js",
|
|
5
5
|
"types": "./dist/main.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,12 +16,17 @@
|
|
|
16
16
|
"author": "",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@wavy/
|
|
19
|
+
"@wavy/fn": "^0.0.40",
|
|
20
|
+
"@wavy/util": "^0.0.12",
|
|
21
|
+
"jsonwebtoken": "^9.0.3",
|
|
20
22
|
"zod": "^4.2.1"
|
|
21
23
|
},
|
|
22
24
|
"description": "",
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
"@
|
|
26
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
27
|
+
"@wavy/fn": "^0.0.40",
|
|
28
|
+
"@wavy/util": "^0.0.12",
|
|
29
|
+
"jsonwebtoken": "^9.0.3",
|
|
25
30
|
"tsup": "^8.5.0",
|
|
26
31
|
"typescript": "^5.9.2",
|
|
27
32
|
"zod": "^4.2.1"
|