@bizmap/sdk 0.0.92 → 0.0.93

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 +109 -200
  2. package/dist/main.js +78 -22
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -41,10 +41,10 @@ declare const companyServiceSelectors: z.ZodEnum<{
41
41
  doctor: "doctor";
42
42
  }>;
43
43
  type CompanyServiceSelector = z.infer<typeof companyServiceSelectors>;
44
- declare const companyTypes: z.ZodEnum<{
45
- MEDICAL: "MEDICAL";
44
+ declare const industries: z.ZodEnum<{
45
+ healthcare: "healthcare";
46
46
  }>;
47
- type CompanyType = z.infer<typeof companyTypes>;
47
+ type Industry = z.infer<typeof industries>;
48
48
  declare const companyUserStatus: z.ZodEnum<{
49
49
  inviteSent: "inviteSent";
50
50
  active: "active";
@@ -76,6 +76,10 @@ declare const nidClasses: z.ZodEnum<{
76
76
  nin: "nin";
77
77
  }>;
78
78
  type NidClass = z.infer<typeof nidClasses>;
79
+ declare const acceptedCurrencies: z.ZodEnum<{
80
+ JMD: "JMD";
81
+ }>;
82
+ type AcceptedCurrency = z.infer<typeof acceptedCurrencies>;
79
83
 
80
84
  declare const vitalKeys: z.ZodEnum<{
81
85
  heartRate: "heartRate";
@@ -89,15 +93,12 @@ declare const serviceProviders: z.ZodEnum<{
89
93
  physAsst: "physAsst";
90
94
  scheduler: "scheduler";
91
95
  doctor: "doctor";
92
- cashier: "cashier";
96
+ debtCollector: "debtCollector";
93
97
  }>;
94
98
 
95
99
  declare const CompanyDetails: z.ZodObject<{
96
100
  _id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
97
101
  identity: z.ZodObject<{
98
- type: z.ZodReadonly<z.ZodEnum<{
99
- MEDICAL: "MEDICAL";
100
- }>>;
101
102
  lastModified: z.ZodNullable<z.ZodInt>;
102
103
  version: z.ZodInt;
103
104
  alias: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -108,6 +109,9 @@ declare const CompanyDetails: z.ZodObject<{
108
109
  country: z.ZodString;
109
110
  }, z.core.$strip>>;
110
111
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ industry: z.ZodReadonly<z.ZodEnum<{
113
+ healthcare: "healthcare";
114
+ }>>;
111
115
  contact: z.ZodObject<{
112
116
  email: z.ZodEmail;
113
117
  phoneNumber: z.ZodOptional<z.ZodString>;
@@ -146,10 +150,6 @@ declare const CompanyDetails: z.ZodObject<{
146
150
  createdAt: z.ZodReadonly<z.ZodInt>;
147
151
  currency: z.ZodEnum<{
148
152
  JMD: "JMD";
149
- USD: "USD";
150
- EUR: "EUR";
151
- GBP: "GBP";
152
- CAD: "CAD";
153
153
  }>;
154
154
  item: z.ZodString;
155
155
  cost: z.ZodNumber;
@@ -194,15 +194,11 @@ declare const CompanyDetails: z.ZodObject<{
194
194
  additionalFees: z.ZodRecord<z.ZodUUID, z.ZodObject<{
195
195
  createdAt: z.ZodReadonly<z.ZodInt>;
196
196
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
197
- description: z.ZodOptional<z.ZodString>;
197
+ description: z.ZodString;
198
198
  fixedAmount: z.ZodObject<{
199
199
  value: z.ZodNumber;
200
200
  currency: z.ZodEnum<{
201
201
  JMD: "JMD";
202
- USD: "USD";
203
- EUR: "EUR";
204
- GBP: "GBP";
205
- CAD: "CAD";
206
202
  }>;
207
203
  }, z.core.$strip>;
208
204
  percentage: z.ZodNumber;
@@ -211,15 +207,11 @@ declare const CompanyDetails: z.ZodObject<{
211
207
  discounts: z.ZodRecord<z.ZodUUID, z.ZodObject<{
212
208
  createdAt: z.ZodReadonly<z.ZodInt>;
213
209
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
214
- description: z.ZodOptional<z.ZodString>;
210
+ description: z.ZodString;
215
211
  fixedAmount: z.ZodObject<{
216
212
  value: z.ZodNumber;
217
213
  currency: z.ZodEnum<{
218
214
  JMD: "JMD";
219
- USD: "USD";
220
- EUR: "EUR";
221
- GBP: "GBP";
222
- CAD: "CAD";
223
215
  }>;
224
216
  }, z.core.$strip>;
225
217
  percentage: z.ZodNumber;
@@ -228,15 +220,11 @@ declare const CompanyDetails: z.ZodObject<{
228
220
  prepayments: z.ZodRecord<z.ZodUUID, z.ZodObject<{
229
221
  createdAt: z.ZodReadonly<z.ZodInt>;
230
222
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
231
- description: z.ZodOptional<z.ZodString>;
223
+ description: z.ZodString;
232
224
  fixedAmount: z.ZodObject<{
233
225
  value: z.ZodNumber;
234
226
  currency: z.ZodEnum<{
235
227
  JMD: "JMD";
236
- USD: "USD";
237
- EUR: "EUR";
238
- GBP: "GBP";
239
- CAD: "CAD";
240
228
  }>;
241
229
  }, z.core.$strip>;
242
230
  percentage: z.ZodNumber;
@@ -249,10 +237,6 @@ declare const CompanyDetails: z.ZodObject<{
249
237
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
250
238
  currency: z.ZodEnum<{
251
239
  JMD: "JMD";
252
- USD: "USD";
253
- EUR: "EUR";
254
- GBP: "GBP";
255
- CAD: "CAD";
256
240
  }>;
257
241
  item: z.ZodString;
258
242
  cost: z.ZodNumber;
@@ -351,15 +335,11 @@ declare const MutableCompanyDetails: z.ZodObject<{
351
335
  additionalFees: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodObject<{
352
336
  createdAt: z.ZodReadonly<z.ZodInt>;
353
337
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
354
- description: z.ZodOptional<z.ZodString>;
338
+ description: z.ZodString;
355
339
  fixedAmount: z.ZodObject<{
356
340
  value: z.ZodNumber;
357
341
  currency: z.ZodEnum<{
358
342
  JMD: "JMD";
359
- USD: "USD";
360
- EUR: "EUR";
361
- GBP: "GBP";
362
- CAD: "CAD";
363
343
  }>;
364
344
  }, z.core.$strip>;
365
345
  percentage: z.ZodNumber;
@@ -368,15 +348,11 @@ declare const MutableCompanyDetails: z.ZodObject<{
368
348
  discounts: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodObject<{
369
349
  createdAt: z.ZodReadonly<z.ZodInt>;
370
350
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
371
- description: z.ZodOptional<z.ZodString>;
351
+ description: z.ZodString;
372
352
  fixedAmount: z.ZodObject<{
373
353
  value: z.ZodNumber;
374
354
  currency: z.ZodEnum<{
375
355
  JMD: "JMD";
376
- USD: "USD";
377
- EUR: "EUR";
378
- GBP: "GBP";
379
- CAD: "CAD";
380
356
  }>;
381
357
  }, z.core.$strip>;
382
358
  percentage: z.ZodNumber;
@@ -385,15 +361,11 @@ declare const MutableCompanyDetails: z.ZodObject<{
385
361
  prepayments: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodObject<{
386
362
  createdAt: z.ZodReadonly<z.ZodInt>;
387
363
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
388
- description: z.ZodOptional<z.ZodString>;
364
+ description: z.ZodString;
389
365
  fixedAmount: z.ZodObject<{
390
366
  value: z.ZodNumber;
391
367
  currency: z.ZodEnum<{
392
368
  JMD: "JMD";
393
- USD: "USD";
394
- EUR: "EUR";
395
- GBP: "GBP";
396
- CAD: "CAD";
397
369
  }>;
398
370
  }, z.core.$strip>;
399
371
  percentage: z.ZodNumber;
@@ -406,10 +378,6 @@ declare const MutableCompanyDetails: z.ZodObject<{
406
378
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
407
379
  currency: z.ZodEnum<{
408
380
  JMD: "JMD";
409
- USD: "USD";
410
- EUR: "EUR";
411
- GBP: "GBP";
412
- CAD: "CAD";
413
381
  }>;
414
382
  item: z.ZodString;
415
383
  cost: z.ZodNumber;
@@ -445,15 +413,11 @@ declare const CompanyBilling: z.ZodObject<{
445
413
  additionalFees: z.ZodRecord<z.ZodUUID, z.ZodObject<{
446
414
  createdAt: z.ZodReadonly<z.ZodInt>;
447
415
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
448
- description: z.ZodOptional<z.ZodString>;
416
+ description: z.ZodString;
449
417
  fixedAmount: z.ZodObject<{
450
418
  value: z.ZodNumber;
451
419
  currency: z.ZodEnum<{
452
420
  JMD: "JMD";
453
- USD: "USD";
454
- EUR: "EUR";
455
- GBP: "GBP";
456
- CAD: "CAD";
457
421
  }>;
458
422
  }, z.core.$strip>;
459
423
  percentage: z.ZodNumber;
@@ -462,15 +426,11 @@ declare const CompanyBilling: z.ZodObject<{
462
426
  discounts: z.ZodRecord<z.ZodUUID, z.ZodObject<{
463
427
  createdAt: z.ZodReadonly<z.ZodInt>;
464
428
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
465
- description: z.ZodOptional<z.ZodString>;
429
+ description: z.ZodString;
466
430
  fixedAmount: z.ZodObject<{
467
431
  value: z.ZodNumber;
468
432
  currency: z.ZodEnum<{
469
433
  JMD: "JMD";
470
- USD: "USD";
471
- EUR: "EUR";
472
- GBP: "GBP";
473
- CAD: "CAD";
474
434
  }>;
475
435
  }, z.core.$strip>;
476
436
  percentage: z.ZodNumber;
@@ -479,15 +439,11 @@ declare const CompanyBilling: z.ZodObject<{
479
439
  prepayments: z.ZodRecord<z.ZodUUID, z.ZodObject<{
480
440
  createdAt: z.ZodReadonly<z.ZodInt>;
481
441
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
482
- description: z.ZodOptional<z.ZodString>;
442
+ description: z.ZodString;
483
443
  fixedAmount: z.ZodObject<{
484
444
  value: z.ZodNumber;
485
445
  currency: z.ZodEnum<{
486
446
  JMD: "JMD";
487
- USD: "USD";
488
- EUR: "EUR";
489
- GBP: "GBP";
490
- CAD: "CAD";
491
447
  }>;
492
448
  }, z.core.$strip>;
493
449
  percentage: z.ZodNumber;
@@ -500,10 +456,6 @@ declare const CompanyBilling: z.ZodObject<{
500
456
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
501
457
  currency: z.ZodEnum<{
502
458
  JMD: "JMD";
503
- USD: "USD";
504
- EUR: "EUR";
505
- GBP: "GBP";
506
- CAD: "CAD";
507
459
  }>;
508
460
  item: z.ZodString;
509
461
  cost: z.ZodNumber;
@@ -519,15 +471,11 @@ declare const MutableCompanyBilling: z.ZodObject<{
519
471
  additionalFees: z.ZodRecord<z.ZodUUID, z.ZodObject<{
520
472
  createdAt: z.ZodReadonly<z.ZodInt>;
521
473
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
522
- description: z.ZodOptional<z.ZodString>;
474
+ description: z.ZodString;
523
475
  fixedAmount: z.ZodObject<{
524
476
  value: z.ZodNumber;
525
477
  currency: z.ZodEnum<{
526
478
  JMD: "JMD";
527
- USD: "USD";
528
- EUR: "EUR";
529
- GBP: "GBP";
530
- CAD: "CAD";
531
479
  }>;
532
480
  }, z.core.$strip>;
533
481
  percentage: z.ZodNumber;
@@ -536,15 +484,11 @@ declare const MutableCompanyBilling: z.ZodObject<{
536
484
  discounts: z.ZodRecord<z.ZodUUID, z.ZodObject<{
537
485
  createdAt: z.ZodReadonly<z.ZodInt>;
538
486
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
539
- description: z.ZodOptional<z.ZodString>;
487
+ description: z.ZodString;
540
488
  fixedAmount: z.ZodObject<{
541
489
  value: z.ZodNumber;
542
490
  currency: z.ZodEnum<{
543
491
  JMD: "JMD";
544
- USD: "USD";
545
- EUR: "EUR";
546
- GBP: "GBP";
547
- CAD: "CAD";
548
492
  }>;
549
493
  }, z.core.$strip>;
550
494
  percentage: z.ZodNumber;
@@ -553,15 +497,11 @@ declare const MutableCompanyBilling: z.ZodObject<{
553
497
  prepayments: z.ZodRecord<z.ZodUUID, z.ZodObject<{
554
498
  createdAt: z.ZodReadonly<z.ZodInt>;
555
499
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
556
- description: z.ZodOptional<z.ZodString>;
500
+ description: z.ZodString;
557
501
  fixedAmount: z.ZodObject<{
558
502
  value: z.ZodNumber;
559
503
  currency: z.ZodEnum<{
560
504
  JMD: "JMD";
561
- USD: "USD";
562
- EUR: "EUR";
563
- GBP: "GBP";
564
- CAD: "CAD";
565
505
  }>;
566
506
  }, z.core.$strip>;
567
507
  percentage: z.ZodNumber;
@@ -574,10 +514,6 @@ declare const MutableCompanyBilling: z.ZodObject<{
574
514
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
575
515
  currency: z.ZodEnum<{
576
516
  JMD: "JMD";
577
- USD: "USD";
578
- EUR: "EUR";
579
- GBP: "GBP";
580
- CAD: "CAD";
581
517
  }>;
582
518
  item: z.ZodString;
583
519
  cost: z.ZodNumber;
@@ -596,8 +532,8 @@ declare const CompanyIdentity: z.ZodObject<{
596
532
  country: z.ZodString;
597
533
  }, z.core.$strip>>;
598
534
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
599
- type: z.ZodReadonly<z.ZodEnum<{
600
- MEDICAL: "MEDICAL";
535
+ industry: z.ZodReadonly<z.ZodEnum<{
536
+ healthcare: "healthcare";
601
537
  }>>;
602
538
  contact: z.ZodObject<{
603
539
  email: z.ZodEmail;
@@ -862,8 +798,8 @@ declare const CompanyInviteList: z.ZodRecord<z.ZodEmail, z.ZodObject<{
862
798
  type CompanyInviteList = z.infer<typeof CompanyInviteList>;
863
799
 
864
800
  declare const CreateCompanyForm: z.ZodPipe<z.ZodObject<{
865
- type: z.ZodReadonly<z.ZodEnum<{
866
- MEDICAL: "MEDICAL";
801
+ industry: z.ZodReadonly<z.ZodEnum<{
802
+ healthcare: "healthcare";
867
803
  }>>;
868
804
  address: z.ZodOptional<z.ZodObject<{
869
805
  streetAddress: z.ZodString;
@@ -877,7 +813,7 @@ declare const CreateCompanyForm: z.ZodPipe<z.ZodObject<{
877
813
  alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
878
814
  picture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
879
815
  }, z.core.$strip>, z.ZodTransform<{
880
- type: "MEDICAL";
816
+ industry: "healthcare";
881
817
  email: string;
882
818
  domain: string;
883
819
  address?: {
@@ -890,7 +826,7 @@ declare const CreateCompanyForm: z.ZodPipe<z.ZodObject<{
890
826
  alias?: string | undefined;
891
827
  picture?: string | null | undefined;
892
828
  }, {
893
- type: "MEDICAL";
829
+ industry: "healthcare";
894
830
  email: string;
895
831
  domain: string;
896
832
  address?: {
@@ -937,15 +873,26 @@ declare const CreditCurrency: z.ZodObject<{
937
873
  value: z.ZodNumber;
938
874
  currency: z.ZodEnum<{
939
875
  JMD: "JMD";
940
- USD: "USD";
941
- EUR: "EUR";
942
- GBP: "GBP";
943
- CAD: "CAD";
944
876
  }>;
945
877
  }, z.core.$strip>;
946
878
  value: z.ZodInt;
947
879
  }, z.core.$strip>;
948
880
  type CreditCurrency = z.infer<typeof CreditCurrency>;
881
+ declare const PaymentDetails: z.ZodObject<{
882
+ createdAt: z.ZodReadonly<z.ZodInt>;
883
+ lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
884
+ uid: z.ZodUUID;
885
+ method: z.ZodEnum<{
886
+ cash: "cash";
887
+ card: "card";
888
+ insurance: "insurance";
889
+ }>;
890
+ currency: z.ZodEnum<{
891
+ JMD: "JMD";
892
+ }>;
893
+ amount: z.ZodNumber;
894
+ }, z.core.$strip>;
895
+ type PaymentDetails = z.infer<typeof PaymentDetails>;
949
896
 
950
897
  declare const Vitals: z.ZodRecord<z.ZodEnum<{
951
898
  heartRate: "heartRate";
@@ -1025,15 +972,11 @@ declare const Version: z.ZodInt;
1025
972
  declare const PriceAdjustment: z.ZodObject<{
1026
973
  createdAt: z.ZodReadonly<z.ZodInt>;
1027
974
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1028
- description: z.ZodOptional<z.ZodString>;
975
+ description: z.ZodString;
1029
976
  fixedAmount: z.ZodObject<{
1030
977
  value: z.ZodNumber;
1031
978
  currency: z.ZodEnum<{
1032
979
  JMD: "JMD";
1033
- USD: "USD";
1034
- EUR: "EUR";
1035
- GBP: "GBP";
1036
- CAD: "CAD";
1037
980
  }>;
1038
981
  }, z.core.$strip>;
1039
982
  percentage: z.ZodNumber;
@@ -1048,10 +991,6 @@ declare const PriceTag: z.ZodObject<{
1048
991
  cost: z.ZodNumber;
1049
992
  currency: z.ZodEnum<{
1050
993
  JMD: "JMD";
1051
- USD: "USD";
1052
- EUR: "EUR";
1053
- GBP: "GBP";
1054
- CAD: "CAD";
1055
994
  }>;
1056
995
  }, z.core.$strip>;
1057
996
  type PriceTag = z.infer<typeof PriceTag>;
@@ -1059,10 +998,6 @@ declare const Receipts: z.ZodArray<z.ZodObject<{
1059
998
  createdAt: z.ZodReadonly<z.ZodInt>;
1060
999
  currency: z.ZodEnum<{
1061
1000
  JMD: "JMD";
1062
- USD: "USD";
1063
- EUR: "EUR";
1064
- GBP: "GBP";
1065
- CAD: "CAD";
1066
1001
  }>;
1067
1002
  item: z.ZodString;
1068
1003
  cost: z.ZodNumber;
@@ -1165,28 +1100,21 @@ declare const MiniAppointmentDetails: z.ZodObject<{
1165
1100
  charges: z.ZodArray<z.ZodObject<{
1166
1101
  createdAt: z.ZodReadonly<z.ZodInt>;
1167
1102
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1103
+ uid: z.ZodUUID;
1104
+ item: z.ZodString;
1105
+ cost: z.ZodNumber;
1168
1106
  currency: z.ZodEnum<{
1169
1107
  JMD: "JMD";
1170
- USD: "USD";
1171
- EUR: "EUR";
1172
- GBP: "GBP";
1173
- CAD: "CAD";
1174
1108
  }>;
1175
- item: z.ZodString;
1176
- cost: z.ZodNumber;
1177
1109
  }, z.core.$strip>>;
1178
1110
  additionalFees: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1179
1111
  createdAt: z.ZodReadonly<z.ZodInt>;
1180
1112
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1181
- description: z.ZodOptional<z.ZodString>;
1113
+ description: z.ZodString;
1182
1114
  fixedAmount: z.ZodObject<{
1183
1115
  value: z.ZodNumber;
1184
1116
  currency: z.ZodEnum<{
1185
1117
  JMD: "JMD";
1186
- USD: "USD";
1187
- EUR: "EUR";
1188
- GBP: "GBP";
1189
- CAD: "CAD";
1190
1118
  }>;
1191
1119
  }, z.core.$strip>;
1192
1120
  percentage: z.ZodNumber;
@@ -1195,15 +1123,11 @@ declare const MiniAppointmentDetails: z.ZodObject<{
1195
1123
  discounts: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1196
1124
  createdAt: z.ZodReadonly<z.ZodInt>;
1197
1125
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1198
- description: z.ZodOptional<z.ZodString>;
1126
+ description: z.ZodString;
1199
1127
  fixedAmount: z.ZodObject<{
1200
1128
  value: z.ZodNumber;
1201
1129
  currency: z.ZodEnum<{
1202
1130
  JMD: "JMD";
1203
- USD: "USD";
1204
- EUR: "EUR";
1205
- GBP: "GBP";
1206
- CAD: "CAD";
1207
1131
  }>;
1208
1132
  }, z.core.$strip>;
1209
1133
  percentage: z.ZodNumber;
@@ -1212,15 +1136,11 @@ declare const MiniAppointmentDetails: z.ZodObject<{
1212
1136
  prepayments: z.ZodNullable<z.ZodArray<z.ZodObject<{
1213
1137
  createdAt: z.ZodReadonly<z.ZodInt>;
1214
1138
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1215
- description: z.ZodOptional<z.ZodString>;
1139
+ description: z.ZodString;
1216
1140
  fixedAmount: z.ZodObject<{
1217
1141
  value: z.ZodNumber;
1218
1142
  currency: z.ZodEnum<{
1219
1143
  JMD: "JMD";
1220
- USD: "USD";
1221
- EUR: "EUR";
1222
- GBP: "GBP";
1223
- CAD: "CAD";
1224
1144
  }>;
1225
1145
  }, z.core.$strip>;
1226
1146
  percentage: z.ZodNumber;
@@ -1273,11 +1193,15 @@ declare const MiniAppointmentDetails: z.ZodObject<{
1273
1193
  payments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1274
1194
  createdAt: z.ZodReadonly<z.ZodInt>;
1275
1195
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1196
+ uid: z.ZodUUID;
1276
1197
  method: z.ZodEnum<{
1277
1198
  cash: "cash";
1278
1199
  card: "card";
1279
1200
  insurance: "insurance";
1280
1201
  }>;
1202
+ currency: z.ZodEnum<{
1203
+ JMD: "JMD";
1204
+ }>;
1281
1205
  amount: z.ZodNumber;
1282
1206
  }, z.core.$strip>>>>;
1283
1207
  lockedBy: z.ZodOptional<z.ZodUUID>;
@@ -1294,10 +1218,11 @@ declare const MiniAppointmentDetails: z.ZodObject<{
1294
1218
  postedAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1295
1219
  userUid: z.ZodNonOptional<z.ZodUUID>;
1296
1220
  }, z.core.$strip>;
1297
- cashier: z.ZodNullable<z.ZodObject<{
1221
+ debtCollector: z.ZodNullable<z.ZodArray<z.ZodObject<{
1222
+ collectedPayments: z.ZodRecord<z.ZodUUID, z.ZodInt>;
1298
1223
  postedAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1299
1224
  userUid: z.ZodNonOptional<z.ZodUUID>;
1300
- }, z.core.$strip>>;
1225
+ }, z.core.$strip>>>;
1301
1226
  }, z.core.$strip>;
1302
1227
  }, z.core.$strip>;
1303
1228
  type MiniAppointmentDetails = z.infer<typeof MiniAppointmentDetails>;
@@ -1308,15 +1233,11 @@ declare const AppointmentDetails: z.ZodObject<{
1308
1233
  additionalFees: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1309
1234
  createdAt: z.ZodReadonly<z.ZodInt>;
1310
1235
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1311
- description: z.ZodOptional<z.ZodString>;
1236
+ description: z.ZodString;
1312
1237
  fixedAmount: z.ZodObject<{
1313
1238
  value: z.ZodNumber;
1314
1239
  currency: z.ZodEnum<{
1315
1240
  JMD: "JMD";
1316
- USD: "USD";
1317
- EUR: "EUR";
1318
- GBP: "GBP";
1319
- CAD: "CAD";
1320
1241
  }>;
1321
1242
  }, z.core.$strip>;
1322
1243
  percentage: z.ZodNumber;
@@ -1325,15 +1246,11 @@ declare const AppointmentDetails: z.ZodObject<{
1325
1246
  discounts: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1326
1247
  createdAt: z.ZodReadonly<z.ZodInt>;
1327
1248
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1328
- description: z.ZodOptional<z.ZodString>;
1249
+ description: z.ZodString;
1329
1250
  fixedAmount: z.ZodObject<{
1330
1251
  value: z.ZodNumber;
1331
1252
  currency: z.ZodEnum<{
1332
1253
  JMD: "JMD";
1333
- USD: "USD";
1334
- EUR: "EUR";
1335
- GBP: "GBP";
1336
- CAD: "CAD";
1337
1254
  }>;
1338
1255
  }, z.core.$strip>;
1339
1256
  percentage: z.ZodNumber;
@@ -1342,15 +1259,11 @@ declare const AppointmentDetails: z.ZodObject<{
1342
1259
  prepayments: z.ZodNullable<z.ZodArray<z.ZodObject<{
1343
1260
  createdAt: z.ZodReadonly<z.ZodInt>;
1344
1261
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1345
- description: z.ZodOptional<z.ZodString>;
1262
+ description: z.ZodString;
1346
1263
  fixedAmount: z.ZodObject<{
1347
1264
  value: z.ZodNumber;
1348
1265
  currency: z.ZodEnum<{
1349
1266
  JMD: "JMD";
1350
- USD: "USD";
1351
- EUR: "EUR";
1352
- GBP: "GBP";
1353
- CAD: "CAD";
1354
1267
  }>;
1355
1268
  }, z.core.$strip>;
1356
1269
  percentage: z.ZodNumber;
@@ -1399,15 +1312,12 @@ declare const AppointmentDetails: z.ZodObject<{
1399
1312
  charges: z.ZodArray<z.ZodObject<{
1400
1313
  createdAt: z.ZodReadonly<z.ZodInt>;
1401
1314
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1315
+ uid: z.ZodUUID;
1316
+ item: z.ZodString;
1317
+ cost: z.ZodNumber;
1402
1318
  currency: z.ZodEnum<{
1403
1319
  JMD: "JMD";
1404
- USD: "USD";
1405
- EUR: "EUR";
1406
- GBP: "GBP";
1407
- CAD: "CAD";
1408
1320
  }>;
1409
- item: z.ZodString;
1410
- cost: z.ZodNumber;
1411
1321
  }, z.core.$strip>>;
1412
1322
  cancelled: z.ZodOptional<z.ZodObject<{
1413
1323
  doneAt: z.ZodInt;
@@ -1423,11 +1333,15 @@ declare const AppointmentDetails: z.ZodObject<{
1423
1333
  payments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1424
1334
  createdAt: z.ZodReadonly<z.ZodInt>;
1425
1335
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1336
+ uid: z.ZodUUID;
1426
1337
  method: z.ZodEnum<{
1427
1338
  cash: "cash";
1428
1339
  card: "card";
1429
1340
  insurance: "insurance";
1430
1341
  }>;
1342
+ currency: z.ZodEnum<{
1343
+ JMD: "JMD";
1344
+ }>;
1431
1345
  amount: z.ZodNumber;
1432
1346
  }, z.core.$strip>>>>;
1433
1347
  lockedBy: z.ZodOptional<z.ZodUUID>;
@@ -1444,10 +1358,11 @@ declare const AppointmentDetails: z.ZodObject<{
1444
1358
  postedAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1445
1359
  userUid: z.ZodNonOptional<z.ZodUUID>;
1446
1360
  }, z.core.$strip>;
1447
- cashier: z.ZodNullable<z.ZodObject<{
1361
+ debtCollector: z.ZodNullable<z.ZodArray<z.ZodObject<{
1362
+ collectedPayments: z.ZodRecord<z.ZodUUID, z.ZodInt>;
1448
1363
  postedAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1449
1364
  userUid: z.ZodNonOptional<z.ZodUUID>;
1450
- }, z.core.$strip>>;
1365
+ }, z.core.$strip>>>;
1451
1366
  }, z.core.$strip>;
1452
1367
  client: z.ZodObject<{
1453
1368
  createdAt: z.ZodReadonly<z.ZodInt>;
@@ -1499,15 +1414,11 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1499
1414
  additionalFees: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1500
1415
  createdAt: z.ZodReadonly<z.ZodInt>;
1501
1416
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1502
- description: z.ZodOptional<z.ZodString>;
1417
+ description: z.ZodString;
1503
1418
  fixedAmount: z.ZodObject<{
1504
1419
  value: z.ZodNumber;
1505
1420
  currency: z.ZodEnum<{
1506
1421
  JMD: "JMD";
1507
- USD: "USD";
1508
- EUR: "EUR";
1509
- GBP: "GBP";
1510
- CAD: "CAD";
1511
1422
  }>;
1512
1423
  }, z.core.$strip>;
1513
1424
  percentage: z.ZodNumber;
@@ -1516,15 +1427,11 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1516
1427
  discounts: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1517
1428
  createdAt: z.ZodReadonly<z.ZodInt>;
1518
1429
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1519
- description: z.ZodOptional<z.ZodString>;
1430
+ description: z.ZodString;
1520
1431
  fixedAmount: z.ZodObject<{
1521
1432
  value: z.ZodNumber;
1522
1433
  currency: z.ZodEnum<{
1523
1434
  JMD: "JMD";
1524
- USD: "USD";
1525
- EUR: "EUR";
1526
- GBP: "GBP";
1527
- CAD: "CAD";
1528
1435
  }>;
1529
1436
  }, z.core.$strip>;
1530
1437
  percentage: z.ZodNumber;
@@ -1533,15 +1440,11 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1533
1440
  prepayments: z.ZodNullable<z.ZodArray<z.ZodObject<{
1534
1441
  createdAt: z.ZodReadonly<z.ZodInt>;
1535
1442
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1536
- description: z.ZodOptional<z.ZodString>;
1443
+ description: z.ZodString;
1537
1444
  fixedAmount: z.ZodObject<{
1538
1445
  value: z.ZodNumber;
1539
1446
  currency: z.ZodEnum<{
1540
1447
  JMD: "JMD";
1541
- USD: "USD";
1542
- EUR: "EUR";
1543
- GBP: "GBP";
1544
- CAD: "CAD";
1545
1448
  }>;
1546
1449
  }, z.core.$strip>;
1547
1450
  percentage: z.ZodNumber;
@@ -1590,15 +1493,12 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1590
1493
  charges: z.ZodArray<z.ZodObject<{
1591
1494
  createdAt: z.ZodReadonly<z.ZodInt>;
1592
1495
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1496
+ uid: z.ZodUUID;
1497
+ item: z.ZodString;
1498
+ cost: z.ZodNumber;
1593
1499
  currency: z.ZodEnum<{
1594
1500
  JMD: "JMD";
1595
- USD: "USD";
1596
- EUR: "EUR";
1597
- GBP: "GBP";
1598
- CAD: "CAD";
1599
1501
  }>;
1600
- item: z.ZodString;
1601
- cost: z.ZodNumber;
1602
1502
  }, z.core.$strip>>;
1603
1503
  cancelled: z.ZodOptional<z.ZodObject<{
1604
1504
  doneAt: z.ZodInt;
@@ -1614,11 +1514,15 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1614
1514
  payments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1615
1515
  createdAt: z.ZodReadonly<z.ZodInt>;
1616
1516
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1517
+ uid: z.ZodUUID;
1617
1518
  method: z.ZodEnum<{
1618
1519
  cash: "cash";
1619
1520
  card: "card";
1620
1521
  insurance: "insurance";
1621
1522
  }>;
1523
+ currency: z.ZodEnum<{
1524
+ JMD: "JMD";
1525
+ }>;
1622
1526
  amount: z.ZodNumber;
1623
1527
  }, z.core.$strip>>>>;
1624
1528
  lockedBy: z.ZodOptional<z.ZodUUID>;
@@ -1635,10 +1539,11 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1635
1539
  postedAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1636
1540
  userUid: z.ZodNonOptional<z.ZodUUID>;
1637
1541
  }, z.core.$strip>;
1638
- cashier: z.ZodNullable<z.ZodObject<{
1542
+ debtCollector: z.ZodNullable<z.ZodArray<z.ZodObject<{
1543
+ collectedPayments: z.ZodRecord<z.ZodUUID, z.ZodInt>;
1639
1544
  postedAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1640
1545
  userUid: z.ZodNonOptional<z.ZodUUID>;
1641
- }, z.core.$strip>>;
1546
+ }, z.core.$strip>>>;
1642
1547
  }, z.core.$strip>;
1643
1548
  client: z.ZodObject<{
1644
1549
  createdAt: z.ZodReadonly<z.ZodInt>;
@@ -1692,28 +1597,21 @@ declare const ScheduleAppointmentForm: z.ZodObject<{
1692
1597
  charges: z.ZodOptional<z.ZodArray<z.ZodObject<{
1693
1598
  createdAt: z.ZodReadonly<z.ZodInt>;
1694
1599
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1600
+ uid: z.ZodUUID;
1601
+ item: z.ZodString;
1602
+ cost: z.ZodNumber;
1695
1603
  currency: z.ZodEnum<{
1696
1604
  JMD: "JMD";
1697
- USD: "USD";
1698
- EUR: "EUR";
1699
- GBP: "GBP";
1700
- CAD: "CAD";
1701
1605
  }>;
1702
- item: z.ZodString;
1703
- cost: z.ZodNumber;
1704
1606
  }, z.core.$strip>>>;
1705
1607
  prepayments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1706
1608
  createdAt: z.ZodReadonly<z.ZodInt>;
1707
1609
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1708
- description: z.ZodOptional<z.ZodString>;
1610
+ description: z.ZodString;
1709
1611
  fixedAmount: z.ZodObject<{
1710
1612
  value: z.ZodNumber;
1711
1613
  currency: z.ZodEnum<{
1712
1614
  JMD: "JMD";
1713
- USD: "USD";
1714
- EUR: "EUR";
1715
- GBP: "GBP";
1716
- CAD: "CAD";
1717
1615
  }>;
1718
1616
  }, z.core.$strip>;
1719
1617
  percentage: z.ZodNumber;
@@ -1722,11 +1620,15 @@ declare const ScheduleAppointmentForm: z.ZodObject<{
1722
1620
  payments: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
1723
1621
  createdAt: z.ZodReadonly<z.ZodInt>;
1724
1622
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1623
+ uid: z.ZodUUID;
1725
1624
  method: z.ZodEnum<{
1726
1625
  cash: "cash";
1727
1626
  card: "card";
1728
1627
  insurance: "insurance";
1729
1628
  }>;
1629
+ currency: z.ZodEnum<{
1630
+ JMD: "JMD";
1631
+ }>;
1730
1632
  amount: z.ZodNumber;
1731
1633
  }, z.core.$strip>>>>>;
1732
1634
  }, z.core.$strip>;
@@ -1812,44 +1714,45 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1812
1714
  _id: string;
1813
1715
  additionalFees: readonly {
1814
1716
  createdAt: number;
1717
+ description: string;
1815
1718
  fixedAmount: {
1816
1719
  value: number;
1817
- currency: "JMD" | "USD" | "EUR" | "GBP" | "CAD";
1720
+ currency: "JMD";
1818
1721
  };
1819
1722
  percentage: number;
1820
1723
  isOptional: boolean;
1821
1724
  lastModified?: number | null | undefined;
1822
- description?: string | undefined;
1823
1725
  }[] | null;
1824
1726
  discounts: readonly {
1825
1727
  createdAt: number;
1728
+ description: string;
1826
1729
  fixedAmount: {
1827
1730
  value: number;
1828
- currency: "JMD" | "USD" | "EUR" | "GBP" | "CAD";
1731
+ currency: "JMD";
1829
1732
  };
1830
1733
  percentage: number;
1831
1734
  isOptional: boolean;
1832
1735
  lastModified?: number | null | undefined;
1833
- description?: string | undefined;
1834
1736
  }[] | null;
1835
1737
  prepayments: {
1836
1738
  createdAt: number;
1739
+ description: string;
1837
1740
  fixedAmount: {
1838
1741
  value: number;
1839
- currency: "JMD" | "USD" | "EUR" | "GBP" | "CAD";
1742
+ currency: "JMD";
1840
1743
  };
1841
1744
  percentage: number;
1842
1745
  isOptional: boolean;
1843
1746
  lastModified?: number | null | undefined;
1844
- description?: string | undefined;
1845
1747
  }[] | null;
1846
1748
  src: string;
1847
1749
  tkt: number;
1848
1750
  charges: {
1849
1751
  createdAt: number;
1850
- currency: "JMD" | "USD" | "EUR" | "GBP" | "CAD";
1752
+ uid: string;
1851
1753
  item: string;
1852
1754
  cost: number;
1755
+ currency: "JMD";
1853
1756
  lastModified?: number | null | undefined;
1854
1757
  }[];
1855
1758
  timeline: {
@@ -1865,10 +1768,11 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1865
1768
  userUid: string;
1866
1769
  postedAt?: number | null | undefined;
1867
1770
  };
1868
- cashier: {
1771
+ debtCollector: {
1772
+ collectedPayments: Record<string, number>;
1869
1773
  userUid: string;
1870
1774
  postedAt?: number | null | undefined;
1871
- } | null;
1775
+ }[] | null;
1872
1776
  };
1873
1777
  client: {
1874
1778
  createdAt: number;
@@ -1948,7 +1852,9 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1948
1852
  } | undefined;
1949
1853
  payments?: {
1950
1854
  createdAt: number;
1855
+ uid: string;
1951
1856
  method: "cash" | "card" | "insurance";
1857
+ currency: "JMD";
1952
1858
  amount: number;
1953
1859
  lastModified?: number | null | undefined;
1954
1860
  }[] | null | undefined;
@@ -1956,6 +1862,9 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1956
1862
  };
1957
1863
  }>;
1958
1864
 
1865
+ /** @disclaimer This doesn't handle currency conversion */
1866
+ declare function calcAppointmentFee(appointment: Pick<AppointmentDetails, "charges" | "discounts" | "additionalFees" | "prepayments">): number;
1867
+
1959
1868
  /**
1960
1869
  * @param {CompanyUserRole} role The role used to filter the staff members
1961
1870
  * @param {CompanyStaff} staff The staff object to query
@@ -2017,4 +1926,4 @@ declare function createNotifId(options?: {
2017
1926
  to: string;
2018
1927
  }): string;
2019
1928
 
2020
- export { AppointmentDetails, type AppointmentDistAlg, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, type CompanyType, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, type NidClass, Notification, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, adminRoles, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyTypes, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, healthcareProviderRoles, nidClasses, normalizeCompanyId, normalizeNidClass, parseClientName, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
1929
+ export { type AcceptedCurrency, AppointmentDetails, type AppointmentDistAlg, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, type Industry, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, type NidClass, Notification, PaymentDetails, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, acceptedCurrencies, adminRoles, appointmentDistAlgs, calcAppointmentFee, companyPartnerRoles, companyServiceSelectors, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, healthcareProviderRoles, industries, nidClasses, normalizeCompanyId, normalizeNidClass, parseClientName, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -21,15 +21,20 @@ var healthcareProviderRoles = companyUserRoles.extract([
21
21
  ]);
22
22
  var appointmentDistAlgs = z.enum(["RR", "LOR"]);
23
23
  var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
24
- var companyTypes = z.enum(["MEDICAL"]);
24
+ var industries = z.enum([
25
+ "healthcare"
26
+ // "Pharmaceutical",
27
+ ]);
25
28
  var companyUserStatus = z.enum(["inviteSent", "active", "inactive"]);
26
29
 
27
30
  // src/enums/Global.ts
31
+ import { currencies } from "@wavy/util";
28
32
  import * as z2 from "zod";
29
33
  var tiers = z2.enum(["basic", "pro", "premium", "gold"]);
30
34
  var paymentMethods = z2.enum(["cash", "card", "insurance"]);
31
35
  var genders = z2.enum(["male", "female"]);
32
36
  var nidClasses = z2.enum(["passportNo", "trn", "nin"]);
37
+ var acceptedCurrencies = currencies.extract(["JMD"]);
33
38
 
34
39
  // src/enums/Medical.ts
35
40
  import * as z3 from "zod";
@@ -47,7 +52,7 @@ var serviceProviders = z4.enum([
47
52
  "scheduler",
48
53
  "doctor",
49
54
  "physAsst",
50
- "cashier"
55
+ "debtCollector"
51
56
  ]);
52
57
 
53
58
  // src/schemas/company/CompanyDetails.ts
@@ -57,7 +62,6 @@ import * as z16 from "zod";
57
62
  import * as z8 from "zod";
58
63
 
59
64
  // src/schemas/utils/billing.ts
60
- import { currencies } from "@wavy/util";
61
65
  import * as z6 from "zod";
62
66
 
63
67
  // src/schemas/utils/core.ts
@@ -98,10 +102,15 @@ var Version = z5.int().min(1);
98
102
 
99
103
  // src/schemas/utils/billing.ts
100
104
  var PriceAdjustment = z6.object({
101
- description: z6.string().trim().min(3, "A description must have atleast (3) characters.").max(25, "A description can't have more that (25) characters.").optional(),
105
+ description: z6.string().trim().min(3, "A description must have atleast (3) characters.").max(25, "A description can't have more that (25) characters.").superRefine((data, ctx) => {
106
+ const invalidCharIdx = data.search(/[^a-zA-Z0-9-\.:\(\)]/);
107
+ if (invalidCharIdx > -1) {
108
+ ctx.addIssue("");
109
+ }
110
+ }),
102
111
  fixedAmount: z6.object({
103
112
  value: z6.number().min(0).max(1e6, "The max fixed amount is $1,000,000.00"),
104
- currency: currencies
113
+ currency: acceptedCurrencies
105
114
  }),
106
115
  percentage: z6.number().min(0).max(1e3, "The max percentage is 1,000%"),
107
116
  isOptional: z6.boolean(),
@@ -112,7 +121,7 @@ var PriceTag = z6.object({
112
121
  /**The name of the item that's being priced */
113
122
  item: z6.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."),
114
123
  cost: z6.number().min(1, "The minimum allowed cost is $1.00").max(1e9, "The max allowed cost is $1,000,000,000.00."),
115
- currency: currencies,
124
+ currency: acceptedCurrencies,
116
125
  ...TimeLog.shape
117
126
  });
118
127
  var Receipts = z6.array(
@@ -220,7 +229,7 @@ var CompanyIdentity = z9.object({
220
229
  }),
221
230
  address: Address.optional(),
222
231
  logo: z9.string().nullish(),
223
- type: companyTypes.readonly(),
232
+ industry: industries.readonly(),
224
233
  contact: z9.object({
225
234
  email: z9.email().max(25),
226
235
  phoneNumber: PhoneNumber.optional(),
@@ -260,7 +269,6 @@ var MutableCompanyIdentity = CompanyIdentity.pick({
260
269
  import * as z11 from "zod";
261
270
 
262
271
  // src/schemas/Global.ts
263
- import { currencies as currencies2 } from "@wavy/util";
264
272
  import * as z10 from "zod";
265
273
 
266
274
  // src/constants.ts
@@ -355,10 +363,20 @@ var Notification = z10.object({
355
363
  });
356
364
  var CreditCurrency = z10.object({
357
365
  uid: z10.uuidv4(),
358
- cost: z10.object({ value: z10.number().min(0), currency: currencies2 }),
366
+ cost: z10.object({ value: z10.number().min(0), currency: acceptedCurrencies }),
359
367
  value: z10.int().min(0),
360
368
  ...TimeLog.shape
361
369
  });
370
+ var PaymentDetails = z10.object({
371
+ // Used to track the payments recorded by each paymentCollector
372
+ uid: z10.uuidv4(),
373
+ method: paymentMethods,
374
+ currency: acceptedCurrencies,
375
+ amount: z10.number().min(1),
376
+ // Rate chart id (used to identify the rate chart used to convert the amount )
377
+ // rcid: z.uuidv4(),
378
+ ...TimeLog.shape
379
+ });
362
380
 
363
381
  // src/schemas/company/components/Notifications.ts
364
382
  var CompanyNotifications = z11.array(Notification).refine(
@@ -655,7 +673,7 @@ var CreateCompanyForm = z18.object({
655
673
  alias: CompanyIdentity.shape.alias.optional(),
656
674
  picture: CompanyIdentity.shape.logo,
657
675
  ...CompanyIdentity.shape.contact.pick({ email: true, phoneNumber: true }).shape,
658
- type: CompanyIdentity.shape.type,
676
+ industry: CompanyIdentity.shape.industry,
659
677
  address: CompanyIdentity.shape.address
660
678
  }).transform((data) => {
661
679
  if (!("alias" in data)) {
@@ -773,6 +791,28 @@ var ClientForm = ClientIdentity.pick({
773
791
 
774
792
  // src/schemas/appointment/Appointment.ts
775
793
  import * as z21 from "zod";
794
+ import { sumOf as sumOf2 } from "@wavy/fn";
795
+
796
+ // src/functions/calcAppointmentFee.ts
797
+ import { sumOf } from "@wavy/fn";
798
+ function calcAppointmentFee(appointment) {
799
+ const subtotal = sumOf(appointment.charges?.map((c) => c.cost));
800
+ const discount = calcAdjustment(appointment.discounts, subtotal);
801
+ const additionalFees = calcAdjustment(appointment.additionalFees, subtotal);
802
+ const prepayments = calcAdjustment(appointment.prepayments, subtotal);
803
+ console.log({ subtotal, discount, additionalFees, prepayments });
804
+ return subtotal + additionalFees - (discount + prepayments);
805
+ }
806
+ var calcAdjustment = (adjustments, subtotal) => {
807
+ if (!adjustments || adjustments.length < 1) return 0;
808
+ return sumOf(
809
+ adjustments?.map(
810
+ (d) => (d.fixedAmount?.value || 0) + (d.percentage ? d.percentage * 0.01 * subtotal : 0)
811
+ )
812
+ );
813
+ };
814
+
815
+ // src/schemas/appointment/Appointment.ts
776
816
  var TimelineActivity = z21.object({
777
817
  postedAt: Timestamp.nullish(),
778
818
  userUid: CompanyUser.shape._id.nonoptional()
@@ -797,7 +837,7 @@ var MiniAppointmentDetails = z21.object({
797
837
  */
798
838
  invoiceNo: InvoiceNo.optional(),
799
839
  /** The services that the client has done/will do. */
800
- charges: z21.array(PriceTag.omit({ uid: true })).max(4),
840
+ charges: z21.array(PriceTag).max(20),
801
841
  /**Required to calculate the accurate grandTotal of the charges */
802
842
  additionalFees: z21.array(PriceAdjustment).nullable().readonly(),
803
843
  /**Required to calculate the accurate grandTotal of the charges */
@@ -822,22 +862,34 @@ var MiniAppointmentDetails = z21.object({
822
862
  }).optional(),
823
863
  /** Add this after consulting with company owners about payment expectations */
824
864
  // paymentDueDate: Timestamp.nullish(),
825
- payments: z21.array(
826
- z21.object({
827
- method: paymentMethods,
828
- amount: z21.number().positive(),
829
- ...TimeLog.shape
830
- })
831
- ).max(100).nullish(),
865
+ payments: z21.array(PaymentDetails).max(100).nullish(),
832
866
  // The user that is currently modifying the appointment
833
867
  lockedBy: UserDetails.shape._id.optional(),
834
868
  timeline: z21.object({
835
869
  scheduler: TimelineActivity,
836
870
  physAsst: TimelineActivity.or(z21.literal("none")),
837
871
  doctor: TimelineActivity,
838
- cashier: TimelineActivity.nullable()
872
+ // Array used to accurately record payments made by the "a/r" and the "cshr"
873
+ debtCollector: z21.array(
874
+ z21.object({
875
+ ...TimelineActivity.shape,
876
+ // Payment uid -> collection time
877
+ collectedPayments: z21.record(z21.uuidv4(), Timestamp)
878
+ })
879
+ ).min(1).nullable()
839
880
  }),
840
881
  ...TimeLog.shape
882
+ }).superRefine((data, ctx) => {
883
+ if (data.payments && data.charges && sumOf2(data.payments.map((p) => p.amount)) >= calcAppointmentFee(data)) {
884
+ const untrackedPayment = data.payments.find(
885
+ (p) => !data.timeline.debtCollector?.some(
886
+ (d) => p.uid in d.collectedPayments
887
+ )
888
+ );
889
+ if (untrackedPayment) {
890
+ ctx.addIssue(`Untracked payment found (${untrackedPayment.uid})`);
891
+ }
892
+ }
841
893
  });
842
894
  var AppointmentDetails = MiniAppointmentDetails.omit({
843
895
  clientUid: true
@@ -1015,8 +1067,9 @@ async function scheduleAppointment(request) {
1015
1067
  scheduler: { userUid: request.sender._id, postedAt: today },
1016
1068
  doctor: { userUid: selectedDoctor },
1017
1069
  physAsst: selectedPhysAsst ? { userUid: selectedPhysAsst } : "none",
1018
- get cashier() {
1019
- if (request.preferences.enforcePaidAppointments) return this.scheduler;
1070
+ get debtCollector() {
1071
+ if (request.preferences.enforcePaidAppointments)
1072
+ return [{ ...this.scheduler, collectedPayments: {} }];
1020
1073
  return null;
1021
1074
  }
1022
1075
  },
@@ -1076,6 +1129,7 @@ export {
1076
1129
  MutableCompanyIdentity,
1077
1130
  MutableCompanyPreferences,
1078
1131
  Notification,
1132
+ PaymentDetails,
1079
1133
  PriceAdjustment,
1080
1134
  PriceTag,
1081
1135
  Reason,
@@ -1090,11 +1144,12 @@ export {
1090
1144
  UserDetails,
1091
1145
  Version,
1092
1146
  Vitals,
1147
+ acceptedCurrencies,
1093
1148
  adminRoles,
1094
1149
  appointmentDistAlgs,
1150
+ calcAppointmentFee,
1095
1151
  companyPartnerRoles,
1096
1152
  companyServiceSelectors,
1097
- companyTypes,
1098
1153
  companyUserRoles,
1099
1154
  companyUserStatus,
1100
1155
  createNotifId,
@@ -1105,6 +1160,7 @@ export {
1105
1160
  genders,
1106
1161
  getCompatibleRoles,
1107
1162
  healthcareProviderRoles,
1163
+ industries,
1108
1164
  nidClasses,
1109
1165
  normalizeCompanyId,
1110
1166
  normalizeNidClass,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",