@bizmap/sdk 0.0.61 → 0.0.62

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
@@ -733,6 +733,7 @@ declare const MiniCompanyUser: z.ZodObject<{
733
733
  isAvailableLastModified: z.ZodNullable<z.ZodInt>;
734
734
  isBusyLastModified: z.ZodNullable<z.ZodInt>;
735
735
  }, z.core.$strip>;
736
+ type MiniCompanyUser = z.infer<typeof MiniCompanyUser>;
736
737
  declare const CompanyUser: z.ZodObject<{
737
738
  uid: z.ZodUUID;
738
739
  roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
@@ -1520,7 +1521,7 @@ declare const ScheduleAppointmentForm: z.ZodObject<{
1520
1521
  }, z.core.$strip>;
1521
1522
  type ScheduleAppointmentForm = z.infer<typeof ScheduleAppointmentForm>;
1522
1523
 
1523
- declare function scheduleAppointment(request: {
1524
+ type RequestParameter = {
1524
1525
  form: ScheduleAppointmentForm;
1525
1526
  sender: UserDetails;
1526
1527
  billing: SafeOmit<CompanyBilling, "uid" | "prepayments" | "lastModified">;
@@ -1533,7 +1534,12 @@ declare function scheduleAppointment(request: {
1533
1534
  options?: Partial<{
1534
1535
  ignoreBalanceCheck: boolean;
1535
1536
  }>;
1536
- }): Promise<{
1537
+ };
1538
+ /**
1539
+ * @param {RequestParameter} request
1540
+ * @returns {Promise<{updates: {state:CompanyState, staffDetails: CompanyStaff}, appointment: AppointmentDetails}>}
1541
+ * */
1542
+ declare function scheduleAppointment(request: RequestParameter): Promise<{
1537
1543
  updates: {
1538
1544
  state: {
1539
1545
  uid: string;
@@ -1722,12 +1728,26 @@ declare function scheduleAppointment(request: {
1722
1728
  };
1723
1729
  }>;
1724
1730
 
1731
+ /**
1732
+ * @param {CompanyUserRole} role The role used to filter the staff members
1733
+ * @param {CompanyStaff} staff The staff object to query
1734
+ * @returns {string[]} The uids of the available staff members
1735
+ */
1725
1736
  declare function findAvailableStaff(role: CompanyUserRole, staff: CompanyStaff): string[];
1726
1737
 
1738
+ /**
1739
+ * @param {string[]} userUids The uids of the members we should query
1740
+ * @param {CompanyPreferences["apptDistAlg"]} algorithm The algorithm we should use to find the staff
1741
+ * @param {CompanyStaff} staff
1742
+ * @returns {string|null}
1743
+ */
1727
1744
  declare function findNextAvailableStaff(userUids: string[], algorithm: CompanyPreferences["apptDistAlg"], staff: CompanyStaff): string | null;
1728
1745
 
1729
- /**@returns an array of the users that have conflicting roles or are incompatible with the other partners, or null if none was found. */
1730
- declare const findConflictingPartners: (...partners: CompanyUser[]) => {
1746
+ /**
1747
+ * @param {...CompanyUser|MiniCompanyUser} partners
1748
+ * @returns {(CompanyUser|MiniCompanyUser)[]|null} an array of the users that have conflicting roles or roles that are
1749
+ * incompatible with the other partners, or null if none was found. */
1750
+ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyUser)[]) => ({
1731
1751
  uid: string;
1732
1752
  roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1733
1753
  isAvailable: boolean;
@@ -1741,8 +1761,21 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
1741
1761
  email: string;
1742
1762
  photoUrl?: string | null | undefined;
1743
1763
  phoneNumber?: string | undefined;
1744
- }[] | null;
1745
- /**@returns the roles that are compatible with the selected role. */
1764
+ } | {
1765
+ uid: string;
1766
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
1767
+ isAvailable: boolean;
1768
+ isBusy: boolean;
1769
+ status: "inviteSent" | "active" | "inactive";
1770
+ appointments: Record<"ongoing" | "completed", number>;
1771
+ lastActive: number | null;
1772
+ isAvailableLastModified: number | null;
1773
+ isBusyLastModified: number | null;
1774
+ })[] | null;
1775
+ /**
1776
+ * @param {CompanyUserRole} role
1777
+ * @returns {CompanyUserRole[]} The roles that are compatible with the selected role.
1778
+ * */
1746
1779
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
1747
1780
 
1748
1781
  export { AppointmentDetails, type AppointmentDistAlg, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CreditCurrency, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, type PaymentMethod, PriceAdjustment, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, UserDetails, Vitals, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -362,7 +362,7 @@ var getCompatibleRoles = (role) => {
362
362
  };
363
363
 
364
364
  // src/schemas/company/components/User.ts
365
- var MiniCompanyUser = z14.object({
365
+ var MiniCompanyUser2 = z14.object({
366
366
  uid: UserDetails.shape.uid,
367
367
  roles: z14.array(companyUserRoles).transform((roles) => {
368
368
  const newRoles = [];
@@ -394,7 +394,7 @@ var MiniCompanyUser = z14.object({
394
394
  });
395
395
  var CompanyUser = z14.object({
396
396
  ...UserModel2.shape,
397
- ...MiniCompanyUser.shape
397
+ ...MiniCompanyUser2.shape
398
398
  });
399
399
 
400
400
  // src/schemas/company/components/Staff.ts
@@ -409,7 +409,7 @@ var refineMembers = (data, ctx) => {
409
409
  };
410
410
  var MiniRawCompanyStaff = z15.object({
411
411
  uid: CompanyState.shape.uid,
412
- members: z15.record(MiniCompanyUser.shape.uid, MiniCompanyUser).superRefine(refineMembers),
412
+ members: z15.record(MiniCompanyUser2.shape.uid, MiniCompanyUser2).superRefine(refineMembers),
413
413
  /**
414
414
  * @relationship one -> many
415
415
  *@description A map of doctor `uids` to their assistants `uids` */
@@ -534,14 +534,14 @@ var CompanyInviteList = z17.record(
534
534
 
535
535
  // src/schemas/appointment/components/Client.ts
536
536
  import * as z18 from "zod";
537
- import { Address as Address3 } from "@wavy/util";
537
+ import { Address as Address2 } from "@wavy/util";
538
538
  var ClientIdentity = UserDetails.omit({
539
539
  notifications: true,
540
540
  publicKey: true
541
541
  }).safeExtend(
542
542
  z18.object({
543
543
  dob: Timestamp.optional(),
544
- address: Address3.optional()
544
+ address: Address2.optional()
545
545
  }).shape
546
546
  );
547
547
 
@@ -685,7 +685,7 @@ function findAvailableStaff(role, staff) {
685
685
  // src/functions/findNextAvailableStaff.ts
686
686
  function findNextAvailableStaff(userUids, algorithm, staff) {
687
687
  let nextAvailable = null;
688
- if (userUids.length === 1) return userUids[0];
688
+ if (userUids.length <= 1) return userUids[0] ?? null;
689
689
  switch (algorithm) {
690
690
  case "RR": {
691
691
  nextAvailable = userUids.find((uid) => {
@@ -856,7 +856,7 @@ export {
856
856
  MedicalDetails,
857
857
  Medicine,
858
858
  MiniAppointmentDetails,
859
- MiniCompanyUser,
859
+ MiniCompanyUser2 as MiniCompanyUser,
860
860
  MutableAppointmentDetails,
861
861
  MutableCompanyBilling,
862
862
  MutableCompanyDetails,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",