@bizmap/sdk 0.0.63 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -38,7 +38,7 @@ declare const companyServiceSelectors: z.ZodEnum<{
38
38
  type CompanyServiceSelector = z.infer<typeof companyServiceSelectors>;
39
39
 
40
40
  declare const tiers: z.ZodEnum<{
41
- free: "free";
41
+ basic: "basic";
42
42
  pro: "pro";
43
43
  premium: "premium";
44
44
  gold: "gold";
@@ -67,7 +67,7 @@ declare const serviceProviders: z.ZodEnum<{
67
67
  }>;
68
68
 
69
69
  declare const CompanyDetails: z.ZodObject<{
70
- uid: z.ZodUUID;
70
+ _id: z.ZodUUID;
71
71
  identity: z.ZodObject<{
72
72
  lastModified: z.ZodNullable<z.ZodInt>;
73
73
  address: z.ZodObject<{
@@ -84,7 +84,7 @@ declare const CompanyDetails: z.ZodObject<{
84
84
  }, z.core.$strip>;
85
85
  tier: z.ZodObject<{
86
86
  current: z.ZodEnum<{
87
- free: "free";
87
+ basic: "basic";
88
88
  pro: "pro";
89
89
  premium: "premium";
90
90
  gold: "gold";
@@ -224,7 +224,7 @@ declare const CompanyDetails: z.ZodObject<{
224
224
  staff: z.ZodObject<{
225
225
  lastModified: z.ZodNullable<z.ZodInt>;
226
226
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
227
- uid: z.ZodUUID;
227
+ _id: z.ZodUUID;
228
228
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
229
229
  doc: "doc";
230
230
  physAsst: "physAsst";
@@ -250,6 +250,7 @@ declare const CompanyDetails: z.ZodObject<{
250
250
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
251
251
  email: z.ZodEmail;
252
252
  phoneNumber: z.ZodOptional<z.ZodString>;
253
+ uid: z.ZodString;
253
254
  }, z.core.$strip>>;
254
255
  partnerMap: z.ZodRecord<z.ZodUUID, z.ZodRecord<z.ZodUUID, z.ZodObject<{
255
256
  addedAt: z.ZodInt;
@@ -297,6 +298,7 @@ declare const MutableCompanyDetails: z.ZodObject<{
297
298
  }, z.core.$strip>>;
298
299
  }, z.core.$strip>>;
299
300
  preferences: z.ZodOptional<z.ZodObject<{
301
+ _id: z.ZodOptional<z.ZodUUID>;
300
302
  serviceSelector: z.ZodOptional<z.ZodEnum<{
301
303
  scheduler: "scheduler";
302
304
  doctor: "doctor";
@@ -308,6 +310,7 @@ declare const MutableCompanyDetails: z.ZodObject<{
308
310
  }>>>;
309
311
  }, z.core.$strip>>;
310
312
  billing: z.ZodOptional<z.ZodObject<{
313
+ _id: z.ZodOptional<z.ZodUUID>;
311
314
  additionalFees: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodObject<{
312
315
  createdAt: z.ZodReadonly<z.ZodInt>;
313
316
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -400,7 +403,7 @@ declare const MutableCompanyDetails: z.ZodObject<{
400
403
  type MutableCompanyDetails = z.infer<typeof MutableCompanyDetails>;
401
404
 
402
405
  declare const CompanyBilling: z.ZodObject<{
403
- uid: z.ZodUUID;
406
+ _id: z.ZodUUID;
404
407
  additionalFees: z.ZodRecord<z.ZodUUID, z.ZodObject<{
405
408
  createdAt: z.ZodReadonly<z.ZodInt>;
406
409
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -472,6 +475,7 @@ declare const CompanyBilling: z.ZodObject<{
472
475
  }, z.core.$strip>;
473
476
  type CompanyBilling = z.infer<typeof CompanyBilling>;
474
477
  declare const MutableCompanyBilling: z.ZodObject<{
478
+ _id: z.ZodUUID;
475
479
  additionalFees: z.ZodRecord<z.ZodUUID, z.ZodObject<{
476
480
  createdAt: z.ZodReadonly<z.ZodInt>;
477
481
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -543,7 +547,7 @@ declare const MutableCompanyBilling: z.ZodObject<{
543
547
  type MutableCompanyBilling = z.infer<typeof MutableCompanyBilling>;
544
548
 
545
549
  declare const CompanyIdentity: z.ZodObject<{
546
- uid: z.ZodUUID;
550
+ _id: z.ZodUUID;
547
551
  displayName: z.ZodString;
548
552
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
549
553
  contact: z.ZodObject<{
@@ -558,7 +562,7 @@ declare const CompanyIdentity: z.ZodObject<{
558
562
  }, z.core.$strip>;
559
563
  tier: z.ZodObject<{
560
564
  current: z.ZodEnum<{
561
- free: "free";
565
+ basic: "basic";
562
566
  pro: "pro";
563
567
  premium: "premium";
564
568
  gold: "gold";
@@ -607,7 +611,7 @@ declare const CompanyNotifications: z.ZodArray<z.ZodObject<{
607
611
  type CompanyNotifications = z.infer<typeof CompanyNotifications>;
608
612
 
609
613
  declare const CompanyPreferences: z.ZodObject<{
610
- uid: z.ZodUUID;
614
+ _id: z.ZodUUID;
611
615
  serviceSelector: z.ZodEnum<{
612
616
  scheduler: "scheduler";
613
617
  doctor: "doctor";
@@ -621,6 +625,7 @@ declare const CompanyPreferences: z.ZodObject<{
621
625
  }, z.core.$strip>;
622
626
  type CompanyPreferences = z.infer<typeof CompanyPreferences>;
623
627
  declare const MutableCompanyPreferences: z.ZodObject<{
628
+ _id: z.ZodUUID;
624
629
  serviceSelector: z.ZodEnum<{
625
630
  scheduler: "scheduler";
626
631
  doctor: "doctor";
@@ -635,7 +640,7 @@ type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
635
640
 
636
641
  declare const CompanyStaff: z.ZodObject<{
637
642
  members: z.ZodRecord<z.ZodUUID, z.ZodObject<{
638
- uid: z.ZodUUID;
643
+ _id: z.ZodUUID;
639
644
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
640
645
  doc: "doc";
641
646
  physAsst: "physAsst";
@@ -661,8 +666,9 @@ declare const CompanyStaff: z.ZodObject<{
661
666
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
662
667
  email: z.ZodEmail;
663
668
  phoneNumber: z.ZodOptional<z.ZodString>;
669
+ uid: z.ZodString;
664
670
  }, z.core.$strip>>;
665
- uid: z.ZodUUID;
671
+ _id: z.ZodUUID;
666
672
  partnerMap: z.ZodRecord<z.ZodUUID, z.ZodRecord<z.ZodUUID, z.ZodObject<{
667
673
  addedAt: z.ZodInt;
668
674
  }, z.core.$strip>>>;
@@ -691,7 +697,7 @@ type CompanyStaff = z.infer<typeof CompanyStaff>;
691
697
 
692
698
  /** Can only be modifiede by the server */
693
699
  declare const CompanyState: z.ZodObject<{
694
- uid: z.ZodUUID;
700
+ _id: z.ZodUUID;
695
701
  credits: z.ZodObject<{
696
702
  current: z.ZodNumber;
697
703
  lastModified: z.ZodNullable<z.ZodInt>;
@@ -713,7 +719,7 @@ declare const CompanyState: z.ZodObject<{
713
719
  type CompanyState = z.infer<typeof CompanyState>;
714
720
 
715
721
  declare const MiniCompanyUser: z.ZodObject<{
716
- uid: z.ZodUUID;
722
+ _id: z.ZodUUID;
717
723
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
718
724
  doc: "doc";
719
725
  physAsst: "physAsst";
@@ -735,7 +741,7 @@ declare const MiniCompanyUser: z.ZodObject<{
735
741
  }, z.core.$strip>;
736
742
  type MiniCompanyUser = z.infer<typeof MiniCompanyUser>;
737
743
  declare const CompanyUser: z.ZodObject<{
738
- uid: z.ZodUUID;
744
+ _id: z.ZodUUID;
739
745
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
740
746
  doc: "doc";
741
747
  physAsst: "physAsst";
@@ -761,6 +767,7 @@ declare const CompanyUser: z.ZodObject<{
761
767
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
762
768
  email: z.ZodEmail;
763
769
  phoneNumber: z.ZodOptional<z.ZodString>;
770
+ uid: z.ZodString;
764
771
  }, z.core.$strip>;
765
772
  type CompanyUser = z.infer<typeof CompanyUser>;
766
773
 
@@ -825,13 +832,10 @@ declare const Receipts: z.ZodArray<z.ZodObject<{
825
832
  declare const ClientIdentity: z.ZodObject<{
826
833
  createdAt: z.ZodReadonly<z.ZodInt>;
827
834
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
828
- uid: z.ZodUUID;
835
+ _id: z.ZodUUID;
829
836
  email: z.ZodEmail;
830
837
  phoneNumber: z.ZodOptional<z.ZodString>;
831
- name: z.ZodRecord<z.ZodEnum<{
832
- first: "first";
833
- last: "last";
834
- }>, z.ZodString>;
838
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
835
839
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
836
840
  linked: z.ZodBoolean;
837
841
  dob: z.ZodOptional<z.ZodInt>;
@@ -845,7 +849,7 @@ declare const ClientIdentity: z.ZodObject<{
845
849
  type ClientIdentity = z.infer<typeof ClientIdentity>;
846
850
 
847
851
  declare const TierList: z.ZodRecord<z.ZodEnum<{
848
- free: "free";
852
+ basic: "basic";
849
853
  pro: "pro";
850
854
  premium: "premium";
851
855
  gold: "gold";
@@ -941,8 +945,11 @@ type MedicalDetails = z.infer<typeof MedicalDetails>;
941
945
  declare const UserDetails: z.ZodObject<{
942
946
  createdAt: z.ZodReadonly<z.ZodInt>;
943
947
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
944
- uid: z.ZodUUID;
948
+ _id: z.ZodUUID;
945
949
  email: z.ZodEmail;
950
+ phoneNumber: z.ZodOptional<z.ZodString>;
951
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
952
+ photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
946
953
  publicKey: z.ZodNullable<z.ZodString>;
947
954
  notifications: z.ZodArray<z.ZodObject<{
948
955
  code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE" | "ALERT">;
@@ -956,12 +963,6 @@ declare const UserDetails: z.ZodObject<{
956
963
  createdAt: z.ZodInt;
957
964
  }, z.core.$strip>>;
958
965
  linked: z.ZodBoolean;
959
- name: z.ZodRecord<z.ZodEnum<{
960
- first: "first";
961
- last: "last";
962
- }>, z.ZodString>;
963
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
964
- phoneNumber: z.ZodOptional<z.ZodString>;
965
966
  }, z.core.$strip>;
966
967
  type UserDetails = z.infer<typeof UserDetails>;
967
968
 
@@ -1137,6 +1138,7 @@ type MiniAppointmentDetails = z.infer<typeof MiniAppointmentDetails>;
1137
1138
  declare const AppointmentDetails: z.ZodObject<{
1138
1139
  createdAt: z.ZodReadonly<z.ZodInt>;
1139
1140
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1141
+ _id: z.ZodUUID;
1140
1142
  additionalFees: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1141
1143
  createdAt: z.ZodReadonly<z.ZodInt>;
1142
1144
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -1240,7 +1242,6 @@ declare const AppointmentDetails: z.ZodObject<{
1240
1242
  }, z.core.$strip>>;
1241
1243
  }, z.core.$strip>;
1242
1244
  tkt: z.ZodReadonly<z.ZodInt>;
1243
- _id: z.ZodUUID;
1244
1245
  reason: z.ZodOptional<z.ZodObject<{
1245
1246
  createdAt: z.ZodReadonly<z.ZodInt>;
1246
1247
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -1284,13 +1285,10 @@ declare const AppointmentDetails: z.ZodObject<{
1284
1285
  client: z.ZodObject<{
1285
1286
  createdAt: z.ZodReadonly<z.ZodInt>;
1286
1287
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1287
- uid: z.ZodUUID;
1288
+ _id: z.ZodUUID;
1288
1289
  email: z.ZodEmail;
1289
1290
  phoneNumber: z.ZodOptional<z.ZodString>;
1290
- name: z.ZodRecord<z.ZodEnum<{
1291
- first: "first";
1292
- last: "last";
1293
- }>, z.ZodString>;
1291
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1294
1292
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1295
1293
  linked: z.ZodBoolean;
1296
1294
  dob: z.ZodOptional<z.ZodInt>;
@@ -1306,6 +1304,7 @@ type AppointmentDetails = z.infer<typeof AppointmentDetails>;
1306
1304
  declare const MutableAppointmentDetails: z.ZodObject<{
1307
1305
  createdAt: z.ZodReadonly<z.ZodInt>;
1308
1306
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1307
+ _id: z.ZodUUID;
1309
1308
  additionalFees: z.ZodReadonly<z.ZodNullable<z.ZodArray<z.ZodObject<{
1310
1309
  createdAt: z.ZodReadonly<z.ZodInt>;
1311
1310
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -1409,7 +1408,6 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1409
1408
  }, z.core.$strip>>;
1410
1409
  }, z.core.$strip>;
1411
1410
  tkt: z.ZodReadonly<z.ZodInt>;
1412
- _id: z.ZodUUID;
1413
1411
  reason: z.ZodOptional<z.ZodObject<{
1414
1412
  createdAt: z.ZodReadonly<z.ZodInt>;
1415
1413
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -1453,13 +1451,10 @@ declare const MutableAppointmentDetails: z.ZodObject<{
1453
1451
  client: z.ZodObject<{
1454
1452
  createdAt: z.ZodReadonly<z.ZodInt>;
1455
1453
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1456
- uid: z.ZodUUID;
1454
+ _id: z.ZodUUID;
1457
1455
  email: z.ZodEmail;
1458
1456
  phoneNumber: z.ZodOptional<z.ZodString>;
1459
- name: z.ZodRecord<z.ZodEnum<{
1460
- first: "first";
1461
- last: "last";
1462
- }>, z.ZodString>;
1457
+ name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
1463
1458
  photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1464
1459
  linked: z.ZodBoolean;
1465
1460
  dob: z.ZodOptional<z.ZodInt>;
@@ -1524,8 +1519,8 @@ type ScheduleAppointmentForm = z.infer<typeof ScheduleAppointmentForm>;
1524
1519
  type RequestParameter = {
1525
1520
  form: ScheduleAppointmentForm;
1526
1521
  sender: UserDetails;
1527
- billing: SafeOmit<CompanyBilling, "uid" | "prepayments" | "lastModified">;
1528
- preferences: SafeOmit<CompanyPreferences, "uid" | "lastModified">;
1522
+ billing: SafeOmit<CompanyBilling, "_id" | "prepayments" | "lastModified">;
1523
+ preferences: SafeOmit<CompanyPreferences, "_id" | "lastModified">;
1529
1524
  state: CompanyState;
1530
1525
  staff: CompanyStaff;
1531
1526
  cost: number;
@@ -1542,7 +1537,7 @@ type RequestParameter = {
1542
1537
  declare function scheduleAppointment(request: RequestParameter): Promise<{
1543
1538
  updates: {
1544
1539
  state: {
1545
- uid: string;
1540
+ _id: string;
1546
1541
  credits: {
1547
1542
  current: number;
1548
1543
  lastModified: number | null;
@@ -1563,7 +1558,7 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1563
1558
  };
1564
1559
  staffDetails: {
1565
1560
  members: Record<string, {
1566
- uid: string;
1561
+ _id: string;
1567
1562
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1568
1563
  isAvailable: boolean;
1569
1564
  isBusy: boolean;
@@ -1574,10 +1569,11 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1574
1569
  isBusyLastModified: number | null;
1575
1570
  name: Record<"first" | "last", string>;
1576
1571
  email: string;
1572
+ uid: string;
1577
1573
  photoUrl?: string | null | undefined;
1578
1574
  phoneNumber?: string | undefined;
1579
1575
  }>;
1580
- uid: string;
1576
+ _id: string;
1581
1577
  partnerMap: Record<string, Record<string, {
1582
1578
  addedAt: number;
1583
1579
  }>>;
@@ -1599,6 +1595,7 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1599
1595
  };
1600
1596
  appointment: {
1601
1597
  createdAt: number;
1598
+ _id: string;
1602
1599
  additionalFees: readonly {
1603
1600
  createdAt: number;
1604
1601
  fixedAmount: {
@@ -1652,7 +1649,6 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1652
1649
  } | null;
1653
1650
  };
1654
1651
  tkt: number;
1655
- _id: string;
1656
1652
  charges: {
1657
1653
  createdAt: number;
1658
1654
  currency: "JMD" | "USD" | "EUR" | "GBP" | "CAD";
@@ -1662,9 +1658,9 @@ declare function scheduleAppointment(request: RequestParameter): Promise<{
1662
1658
  }[];
1663
1659
  client: {
1664
1660
  createdAt: number;
1665
- uid: string;
1661
+ _id: string;
1666
1662
  email: string;
1667
- name: Record<"first" | "last", string>;
1663
+ name: string;
1668
1664
  linked: boolean;
1669
1665
  lastModified?: number | null | undefined;
1670
1666
  phoneNumber?: string | undefined;
@@ -1748,7 +1744,7 @@ declare function findNextAvailableStaff(userUids: string[], algorithm: CompanyPr
1748
1744
  * @returns {(CompanyUser|MiniCompanyUser)[]|null} an array of the users that have conflicting roles or roles that are
1749
1745
  * incompatible with the other partners, or null if none was found. */
1750
1746
  declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyUser)[]) => ({
1751
- uid: string;
1747
+ _id: string;
1752
1748
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1753
1749
  isAvailable: boolean;
1754
1750
  isBusy: boolean;
@@ -1759,10 +1755,11 @@ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyU
1759
1755
  isBusyLastModified: number | null;
1760
1756
  name: Record<"first" | "last", string>;
1761
1757
  email: string;
1758
+ uid: string;
1762
1759
  photoUrl?: string | null | undefined;
1763
1760
  phoneNumber?: string | undefined;
1764
1761
  } | {
1765
- uid: string;
1762
+ _id: string;
1766
1763
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1767
1764
  isAvailable: boolean;
1768
1765
  isBusy: boolean;
package/dist/main.js CHANGED
@@ -21,7 +21,7 @@ var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
21
21
 
22
22
  // src/enums/Global.ts
23
23
  import * as z2 from "zod";
24
- var tiers = z2.enum(["free", "pro", "premium", "gold"]);
24
+ var tiers = z2.enum(["basic", "pro", "premium", "gold"]);
25
25
  var paymentMethods = z2.enum(["cash", "card", "insurance"]);
26
26
 
27
27
  // src/enums/Medical.ts
@@ -107,7 +107,7 @@ import * as z8 from "zod";
107
107
  // src/schemas/company/components/State.ts
108
108
  import * as z7 from "zod";
109
109
  var CompanyState = z7.object({
110
- uid: z7.uuidv4(),
110
+ _id: z7.uuidv4(),
111
111
  credits: z7.object({
112
112
  current: z7.number(),
113
113
  lastModified: Timestamp.nullable()
@@ -143,7 +143,7 @@ var createAdjustments = (resource) => z8.record(z8.uuidv4(), PriceAdjustment).re
143
143
  `Adding more than 100 ${resource}s is prohibited.`
144
144
  );
145
145
  var CompanyBilling = z8.object({
146
- uid: CompanyState.shape.uid,
146
+ _id: CompanyState.shape._id,
147
147
  additionalFees: createAdjustments("additional fee"),
148
148
  discounts: createAdjustments("discount"),
149
149
  /** Optionally deductable from bills */
@@ -178,7 +178,7 @@ var MutableCompanyBilling = CompanyBilling.omit({
178
178
  import * as z9 from "zod";
179
179
  import { Address, PhoneNumber } from "@wavy/util";
180
180
  var CompanyIdentity = z9.object({
181
- uid: CompanyState.shape.uid,
181
+ _id: CompanyState.shape._id,
182
182
  displayName: z9.string().min(3).max(25),
183
183
  logo: z9.string().max(2500).nullish(),
184
184
  /** Hash this field */
@@ -221,8 +221,8 @@ var TierList = z10.record(
221
221
  perks: z10.array(z10.string()).min(1)
222
222
  })
223
223
  ).superRefine((data, ctx) => {
224
- if (data.free.cost !== 0) {
225
- ctx.addIssue("The free tier must always cost $0.00");
224
+ if (data.basic.cost !== 0) {
225
+ ctx.addIssue("The basic tier must always cost $0.00");
226
226
  }
227
227
  });
228
228
  var Notification = z10.object({
@@ -285,7 +285,7 @@ var CompanyNotifications = z11.array(Notification).refine(
285
285
  // src/schemas/company/components/Preferences.ts
286
286
  import * as z12 from "zod";
287
287
  var CompanyPreferences = z12.object({
288
- uid: CompanyState.shape.uid,
288
+ _id: CompanyState.shape._id,
289
289
  /** The user that's allowed to record the client's services. */
290
290
  serviceSelector: companyServiceSelectors,
291
291
  /** A record of the payments made must be attached before creating the
@@ -321,14 +321,28 @@ import { UserModel } from "@wavy/util";
321
321
  import * as z13 from "zod";
322
322
  var UserDetails = z13.object({
323
323
  ...UserModel.shape,
324
- uid: z13.uuidv4(),
324
+ _id: z13.uuidv4(),
325
+ name: z13.string().transform((data) => {
326
+ const [firstName = "", lastName = ""] = data.split(" ");
327
+ return firstName + lastName;
328
+ }).superRefine((data, ctx) => {
329
+ data.split(" ").forEach((name, idx) => {
330
+ const nty = idx === 0 ? "First" : "Last";
331
+ if (idx === 0 && name.length < 2) {
332
+ ctx.addIssue(`${nty} name must have at least (2) characters.`);
333
+ }
334
+ if (name.length > 25) {
335
+ ctx.addIssue(`${nty} name can't have more than (25) characters.`);
336
+ }
337
+ });
338
+ }),
325
339
  email: UserModel.shape.email,
326
340
  publicKey: z13.string().nullable(),
327
341
  notifications: z13.array(Notification),
328
342
  /** Only true when linked to a client */
329
343
  linked: z13.boolean(),
330
344
  ...TimeLog.shape
331
- });
345
+ }).omit({ uid: true });
332
346
 
333
347
  // src/functions/helper-functions.ts
334
348
  var findConflictingPartners = (...partners) => {
@@ -363,7 +377,7 @@ var getCompatibleRoles = (role) => {
363
377
 
364
378
  // src/schemas/company/components/User.ts
365
379
  var MiniCompanyUser2 = z14.object({
366
- uid: UserDetails.shape.uid,
380
+ _id: UserDetails.shape._id,
367
381
  roles: z14.array(companyUserRoles).transform((roles) => {
368
382
  const newRoles = [];
369
383
  for (const role of roles) {
@@ -400,25 +414,25 @@ var CompanyUser = z14.object({
400
414
  // src/schemas/company/components/Staff.ts
401
415
  var refineMembers = (data, ctx) => {
402
416
  for (const [uid, user] of Object.entries(data)) {
403
- if (uid !== user.uid) {
417
+ if (uid !== user._id) {
404
418
  ctx.addIssue(
405
- `User found with a uid that doesn't match their respective key. (${uid} !== ${user.uid}).`
419
+ `User found with a uid that doesn't match their respective key. (${uid} !== ${user._id}).`
406
420
  );
407
421
  }
408
422
  }
409
423
  };
410
424
  var MiniRawCompanyStaff = z15.object({
411
- uid: CompanyState.shape.uid,
412
- members: z15.record(MiniCompanyUser2.shape.uid, MiniCompanyUser2).superRefine(refineMembers),
425
+ _id: CompanyState.shape._id,
426
+ members: z15.record(MiniCompanyUser2.shape._id, MiniCompanyUser2).superRefine(refineMembers),
413
427
  /**
414
428
  * @relationship one -> many
415
429
  *@description A map of doctor `uids` to their assistants `uids` */
416
430
  partnerMap: z15.record(
417
- CompanyUser.shape.uid,
418
- z15.record(CompanyUser.shape.uid, z15.object({ addedAt: Timestamp }))
431
+ CompanyUser.shape._id,
432
+ z15.record(CompanyUser.shape._id, z15.object({ addedAt: Timestamp }))
419
433
  ),
420
434
  updateQueue: z15.record(
421
- CompanyUser.shape.uid,
435
+ CompanyUser.shape._id,
422
436
  z15.object({
423
437
  $REMOVE: z15.object({ addedAt: Timestamp }),
424
438
  $CHANGE_ROLES: z15.object({
@@ -428,7 +442,7 @@ var MiniRawCompanyStaff = z15.object({
428
442
  }).partial()
429
443
  ),
430
444
  timeline: z15.record(
431
- CompanyUser.shape.uid,
445
+ CompanyUser.shape._id,
432
446
  z15.object({
433
447
  inviteSent: Timestamp.nullable(),
434
448
  inviteAccepted: Timestamp.nullable()
@@ -438,7 +452,7 @@ var MiniRawCompanyStaff = z15.object({
438
452
  });
439
453
  var RawCompanyStaff = z15.object({
440
454
  ...MiniRawCompanyStaff.shape,
441
- members: z15.record(CompanyUser.shape.uid, CompanyUser).superRefine(refineMembers)
455
+ members: z15.record(CompanyUser.shape._id, CompanyUser).superRefine(refineMembers)
442
456
  });
443
457
  var transformStaff = (object16) => {
444
458
  return object16.transform((d) => {
@@ -471,24 +485,24 @@ var transformStaff = (object16) => {
471
485
  return copy;
472
486
  }).superRefine((details, ctx) => {
473
487
  for (const user of Object.values(details.members)) {
474
- if (user.roles.includes("doc") && user.uid in details.partnerMap) {
475
- for (const asstUid of Object.keys(details.partnerMap[user.uid])) {
488
+ if (user.roles.includes("doc") && user._id in details.partnerMap) {
489
+ for (const asstUid of Object.keys(details.partnerMap[user._id])) {
476
490
  if (!details.members[asstUid].roles.includes("physAsst")) {
477
491
  ctx.addIssue(
478
- `A partner group member must have the "physAsst" role (${user.uid}) -> (${asstUid}).`
492
+ `A partner group member must have the "physAsst" role (${user._id}) -> (${asstUid}).`
479
493
  );
480
494
  }
481
495
  }
482
- } else if (user.uid in details.partnerMap) {
496
+ } else if (user._id in details.partnerMap) {
483
497
  ctx.addIssue(
484
- `A partner group leader must have the "doc" role. (${user.uid})`
498
+ `A partner group leader must have the "doc" role. (${user._id})`
485
499
  );
486
500
  } else if (user.roles.includes("doc")) {
487
501
  ctx.addIssue(
488
- `All users that have the "doc" role must be the leader of a partner group. (${user.uid})`
502
+ `All users that have the "doc" role must be the leader of a partner group. (${user._id})`
489
503
  );
490
504
  }
491
- if (!user.isBusy && user.uid in details.updateQueue) {
505
+ if (!user.isBusy && user._id in details.updateQueue) {
492
506
  ctx.addIssue(
493
507
  `Having users that aren't busy in the update queue is prohibited.`
494
508
  );
@@ -505,17 +519,17 @@ var MutableCompanyStaff = RawCompanyStaff.pick({
505
519
 
506
520
  // src/schemas/company/CompanyDetails.ts
507
521
  var CompanyDetails = z16.object({
508
- uid: CompanyState.shape.uid,
509
- identity: CompanyIdentity.omit({ uid: true }),
522
+ _id: CompanyState.shape._id,
523
+ identity: CompanyIdentity.omit({ _id: true }),
510
524
  notifications: CompanyNotifications,
511
525
  receipts: Receipts,
512
- state: CompanyState.omit({ uid: true }),
513
- preferences: CompanyPreferences.omit({ uid: true }),
514
- billing: CompanyBilling.omit({ uid: true }),
515
- staff: RawCompanyStaff.omit({ uid: true })
526
+ state: CompanyState.omit({ _id: true }),
527
+ preferences: CompanyPreferences.omit({ _id: true }),
528
+ billing: CompanyBilling.omit({ _id: true }),
529
+ staff: RawCompanyStaff.omit({ _id: true })
516
530
  });
517
531
  var MutableCompanyDetails = z16.object({
518
- uid: CompanyDetails.shape.uid,
532
+ uid: CompanyDetails.shape._id,
519
533
  identity: MutableCompanyIdentity.partial().optional(),
520
534
  preferences: MutableCompanyPreferences.partial().optional(),
521
535
  billing: MutableCompanyBilling.partial().optional(),
@@ -584,13 +598,13 @@ var MedicalDetails = z19.object({
584
598
  import * as z20 from "zod";
585
599
  var TimelineActivity = z20.object({
586
600
  postedAt: Timestamp.nullish(),
587
- userUid: CompanyUser.shape.uid.nonoptional()
601
+ userUid: CompanyUser.shape._id.nonoptional()
588
602
  });
589
603
  var MiniAppointmentDetails = z20.object({
590
604
  /** A random uid that identifies the document. */
591
605
  _id: z20.uuidv4(),
592
606
  /** The company's uid */
593
- src: CompanyState.shape.uid,
607
+ src: CompanyState.shape._id,
594
608
  /** The ticket number */
595
609
  tkt: TicketNo,
596
610
  /**The reason for the service */
@@ -613,7 +627,7 @@ var MiniAppointmentDetails = z20.object({
613
627
  discounts: z20.array(PriceAdjustment).nullable().readonly(),
614
628
  prepayments: z20.array(PriceAdjustment).nullable(),
615
629
  /** The client's identity */
616
- clientUid: ClientIdentity.shape.uid,
630
+ clientUid: ClientIdentity.shape._id,
617
631
  /**
618
632
  * Data that is specific to the entity (for now it's just medical data).
619
633
  * It will only be defined for the participants that have access to it.
@@ -659,9 +673,9 @@ var MutableAppointmentDetails = AppointmentDetails.safeExtend(
659
673
  }).shape
660
674
  );
661
675
  var ScheduleAppointmentForm = z20.object({
662
- clientUid: ClientIdentity.shape.uid,
676
+ clientUid: ClientIdentity.shape._id,
663
677
  /** A nullish value === next_available */
664
- serviceProviderUid: CompanyUser.shape.uid.nullish(),
678
+ serviceProviderUid: CompanyUser.shape._id.nullish(),
665
679
  charges: AppointmentDetails.shape.charges.optional(),
666
680
  prepayments: AppointmentDetails.shape.prepayments.optional(),
667
681
  payments: AppointmentDetails.shape.payments.optional(),
@@ -722,7 +736,7 @@ async function scheduleAppointment(request) {
722
736
  prepayments: true,
723
737
  lastModified: true
724
738
  }).parse(request.billing);
725
- const companyUser = request.staff?.members[request.sender.uid];
739
+ const companyUser = request.staff?.members[request.sender._id];
726
740
  const staffDetailsCopy = CompanyStaff.parse(structuredClone(request.staff));
727
741
  const stateCopy = CompanyState.parse(structuredClone(request.state));
728
742
  let selectedDoctor = null;
@@ -804,7 +818,7 @@ async function scheduleAppointment(request) {
804
818
  staffDetailsCopy.lastModified = today;
805
819
  const appointment = {
806
820
  _id: v4(),
807
- src: stateCopy.uid,
821
+ src: stateCopy._id,
808
822
  tkt: request.state.tktNoCounter,
809
823
  discounts: Object.values(request.billing.discounts || {}).filter(
810
824
  (disc) => !disc.isOptional
@@ -819,7 +833,7 @@ async function scheduleAppointment(request) {
819
833
  _hash: "aa.aa.aa",
820
834
  lastModified: null,
821
835
  timeline: {
822
- scheduler: { userUid: request.sender.uid, postedAt: today },
836
+ scheduler: { userUid: request.sender._id, postedAt: today },
823
837
  doctor: { userUid: selectedDoctor },
824
838
  physAsst: selectedPhysAsst ? { userUid: selectedPhysAsst } : "none",
825
839
  get cashier() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",