@bizmap/sdk 0.0.74 → 0.0.75
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 +46 -1
- package/dist/main.js +64 -42
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -815,6 +815,50 @@ declare const CompanyInviteList: z.ZodRecord<z.ZodEmail, z.ZodObject<{
|
|
|
815
815
|
}, z.core.$strip>>;
|
|
816
816
|
type CompanyInviteList = z.infer<typeof CompanyInviteList>;
|
|
817
817
|
|
|
818
|
+
declare const CreateCompanyForm: z.ZodPipe<z.ZodObject<{
|
|
819
|
+
type: z.ZodReadonly<z.ZodEnum<{
|
|
820
|
+
MEDICAL: "MEDICAL";
|
|
821
|
+
}>>;
|
|
822
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
823
|
+
streetAddress: z.ZodString;
|
|
824
|
+
city: z.ZodOptional<z.ZodString>;
|
|
825
|
+
parish: z.ZodString;
|
|
826
|
+
country: z.ZodString;
|
|
827
|
+
}, z.core.$strip>>;
|
|
828
|
+
email: z.ZodEmail;
|
|
829
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
830
|
+
domain: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
831
|
+
alias: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
832
|
+
picture: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
833
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
834
|
+
type: "MEDICAL";
|
|
835
|
+
email: string;
|
|
836
|
+
domain: string;
|
|
837
|
+
address?: {
|
|
838
|
+
streetAddress: string;
|
|
839
|
+
parish: string;
|
|
840
|
+
country: string;
|
|
841
|
+
city?: string | undefined;
|
|
842
|
+
} | undefined;
|
|
843
|
+
phoneNumber?: string | undefined;
|
|
844
|
+
alias?: string | undefined;
|
|
845
|
+
picture?: string | null | undefined;
|
|
846
|
+
}, {
|
|
847
|
+
type: "MEDICAL";
|
|
848
|
+
email: string;
|
|
849
|
+
domain: string;
|
|
850
|
+
address?: {
|
|
851
|
+
streetAddress: string;
|
|
852
|
+
parish: string;
|
|
853
|
+
country: string;
|
|
854
|
+
city?: string | undefined;
|
|
855
|
+
} | undefined;
|
|
856
|
+
phoneNumber?: string | undefined;
|
|
857
|
+
alias?: string | undefined;
|
|
858
|
+
picture?: string | null | undefined;
|
|
859
|
+
}>>;
|
|
860
|
+
type CreateCompanyForm = z.infer<typeof CreateCompanyForm>;
|
|
861
|
+
|
|
818
862
|
declare const TierList: z.ZodRecord<z.ZodEnum<{
|
|
819
863
|
basic: "basic";
|
|
820
864
|
pro: "pro";
|
|
@@ -1800,10 +1844,11 @@ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyU
|
|
|
1800
1844
|
* @returns {CompanyUserRole[]} The roles that are compatible with the selected role.
|
|
1801
1845
|
* */
|
|
1802
1846
|
declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
|
|
1847
|
+
declare const normalizeCompanyId: (id: string) => string;
|
|
1803
1848
|
|
|
1804
1849
|
declare function createNotifId(options?: {
|
|
1805
1850
|
from: string;
|
|
1806
1851
|
to: string;
|
|
1807
1852
|
}): string;
|
|
1808
1853
|
|
|
1809
|
-
export { AppointmentDetails, type AppointmentDistAlg, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, type CompanyType, CompanyUser, type CompanyUserRole, CompanyUserSession, type CompanyUserStatus, 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, Version, Vitals, adminRoles, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyTypes, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
|
|
1854
|
+
export { AppointmentDetails, type AppointmentDistAlg, 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 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, Version, Vitals, adminRoles, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyTypes, companyUserRoles, companyUserStatus, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, getCompatibleRoles, healthcareProviderRoles, normalizeCompanyId, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
|
package/dist/main.js
CHANGED
|
@@ -373,6 +373,7 @@ import * as z15 from "zod";
|
|
|
373
373
|
import * as z14 from "zod";
|
|
374
374
|
|
|
375
375
|
// src/functions/helper-functions.ts
|
|
376
|
+
import { upperFirst } from "@wavy/fn";
|
|
376
377
|
var findConflictingPartners = (...partners) => {
|
|
377
378
|
let hasSingleDoctor = false;
|
|
378
379
|
const conflicts = [];
|
|
@@ -402,6 +403,9 @@ var getCompatibleRoles = (role) => {
|
|
|
402
403
|
}
|
|
403
404
|
return companyUserRoles.exclude([role]).options;
|
|
404
405
|
};
|
|
406
|
+
var normalizeCompanyId = (id) => {
|
|
407
|
+
return id.split("-").map((value) => upperFirst(value.toLowerCase())).join(" ");
|
|
408
|
+
};
|
|
405
409
|
|
|
406
410
|
// src/schemas/profiles/User.ts
|
|
407
411
|
import { UserModel } from "@wavy/util";
|
|
@@ -510,8 +514,8 @@ var RawCompanyStaff = z15.object({
|
|
|
510
514
|
...MiniRawCompanyStaff.shape,
|
|
511
515
|
members: z15.record(CompanyUser.shape._id, CompanyUser.omit({ _id: true }))
|
|
512
516
|
});
|
|
513
|
-
var transformStaff = (
|
|
514
|
-
return
|
|
517
|
+
var transformStaff = (object17) => {
|
|
518
|
+
return object17.transform((d) => {
|
|
515
519
|
const copy = structuredClone(d);
|
|
516
520
|
for (const uid of Object.keys(copy.updateQueue)) {
|
|
517
521
|
if (uid in copy.members) {
|
|
@@ -597,50 +601,66 @@ var CompanyInviteList = z17.record(
|
|
|
597
601
|
"Insufficient amount of members invited."
|
|
598
602
|
);
|
|
599
603
|
|
|
600
|
-
// src/schemas/
|
|
604
|
+
// src/schemas/company/utils/CreateCompanyForm.ts
|
|
601
605
|
import * as z18 from "zod";
|
|
602
|
-
var
|
|
606
|
+
var CreateCompanyForm = z18.object({
|
|
607
|
+
domain: CompanyIdentity.shape._id,
|
|
608
|
+
alias: CompanyIdentity.shape.alias.optional(),
|
|
609
|
+
picture: CompanyIdentity.shape.logo,
|
|
610
|
+
...CompanyIdentity.shape.contact.pick({ email: true, phoneNumber: true }).shape,
|
|
611
|
+
type: CompanyIdentity.shape.type,
|
|
612
|
+
address: CompanyIdentity.shape.address
|
|
613
|
+
}).transform((data) => {
|
|
614
|
+
if (!("alias" in data)) {
|
|
615
|
+
data.alias = normalizeCompanyId(data.domain);
|
|
616
|
+
}
|
|
617
|
+
return data;
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
// src/schemas/appointment/components/Medical.ts
|
|
621
|
+
import * as z19 from "zod";
|
|
622
|
+
var Vitals = z19.record(
|
|
603
623
|
vitalKeys,
|
|
604
|
-
|
|
605
|
-
value:
|
|
624
|
+
z19.object({
|
|
625
|
+
value: z19.string().trim().regex(/^\d{0,3}((\/|\.)\d{1,3})?/),
|
|
606
626
|
lastModified: Timestamp.nullable()
|
|
607
627
|
})
|
|
608
628
|
);
|
|
609
|
-
var Medicine =
|
|
610
|
-
brand:
|
|
629
|
+
var Medicine = z19.object({
|
|
630
|
+
brand: z19.string().trim(),
|
|
611
631
|
expiresAt: Timestamp.nullish(),
|
|
612
|
-
quantity:
|
|
632
|
+
quantity: z19.string().trim().regex(/^\d+(\.\d{1,3})? ?[a-zA-Z]{1,20}/, {
|
|
613
633
|
error: "Failed to match the pattern <number>+(.<number>{1,3})? ?[a-zA-Z]{1,20}"
|
|
614
634
|
}),
|
|
615
|
-
refills:
|
|
616
|
-
directions:
|
|
635
|
+
refills: z19.string().trim().regex(/^[0-8]/, { error: "Must be between 0 and 8" }),
|
|
636
|
+
directions: z19.string().trim().max(100, { error: "Must be 100 characters or less" }),
|
|
617
637
|
...TimeLog.shape
|
|
618
638
|
});
|
|
619
|
-
var MedicalDetails =
|
|
639
|
+
var MedicalDetails = z19.object({
|
|
620
640
|
vitals: Vitals,
|
|
621
|
-
prescriptions:
|
|
622
|
-
doctorNote:
|
|
623
|
-
value:
|
|
641
|
+
prescriptions: z19.array(z19.array(Medicine)).nullish(),
|
|
642
|
+
doctorNote: z19.object({
|
|
643
|
+
value: z19.string(),
|
|
624
644
|
lastModified: Timestamp.nullable()
|
|
625
645
|
}),
|
|
626
|
-
physAsstNotes:
|
|
627
|
-
|
|
628
|
-
title:
|
|
629
|
-
content:
|
|
646
|
+
physAsstNotes: z19.array(
|
|
647
|
+
z19.object({
|
|
648
|
+
title: z19.string(),
|
|
649
|
+
content: z19.string(),
|
|
630
650
|
...TimeLog.shape
|
|
631
651
|
})
|
|
632
652
|
).optional()
|
|
633
653
|
});
|
|
634
654
|
|
|
635
655
|
// src/schemas/profiles/Client.ts
|
|
636
|
-
import * as
|
|
656
|
+
import * as z20 from "zod";
|
|
637
657
|
import { Address as Address2 } from "@wavy/util";
|
|
638
658
|
var ClientIdentity = UserDetails.omit({
|
|
639
659
|
notifications: true,
|
|
640
660
|
publicKey: true,
|
|
641
661
|
email: true
|
|
642
662
|
}).safeExtend(
|
|
643
|
-
|
|
663
|
+
z20.object({
|
|
644
664
|
email: UserDetails.shape.email.optional(),
|
|
645
665
|
dob: Timestamp.optional(),
|
|
646
666
|
address: Address2.optional(),
|
|
@@ -649,20 +669,20 @@ var ClientIdentity = UserDetails.omit({
|
|
|
649
669
|
);
|
|
650
670
|
|
|
651
671
|
// src/schemas/appointment/Appointment.ts
|
|
652
|
-
import * as
|
|
653
|
-
var TimelineActivity =
|
|
672
|
+
import * as z21 from "zod";
|
|
673
|
+
var TimelineActivity = z21.object({
|
|
654
674
|
postedAt: Timestamp.nullish(),
|
|
655
675
|
userUid: CompanyUser.shape._id.nonoptional()
|
|
656
676
|
});
|
|
657
|
-
var MiniAppointmentDetails =
|
|
677
|
+
var MiniAppointmentDetails = z21.object({
|
|
658
678
|
/** A random uid that identifies the document. */
|
|
659
|
-
_id:
|
|
679
|
+
_id: z21.uuidv4(),
|
|
660
680
|
/** The company's uid */
|
|
661
681
|
src: CompanyState.shape._id,
|
|
662
682
|
/** The ticket number */
|
|
663
683
|
tkt: TicketNo,
|
|
664
684
|
/**The reason for the service */
|
|
665
|
-
reason:
|
|
685
|
+
reason: z21.object({
|
|
666
686
|
value: Reason.shape.value,
|
|
667
687
|
...TimeLog.shape
|
|
668
688
|
}).optional(),
|
|
@@ -674,24 +694,24 @@ var MiniAppointmentDetails = z20.object({
|
|
|
674
694
|
*/
|
|
675
695
|
invoiceNo: InvoiceNo.optional(),
|
|
676
696
|
/** The services that the client has done/will do. */
|
|
677
|
-
charges:
|
|
697
|
+
charges: z21.array(PriceTag.omit({ uid: true })).max(4),
|
|
678
698
|
/**Required to calculate the accurate grandTotal of the charges */
|
|
679
|
-
additionalFees:
|
|
699
|
+
additionalFees: z21.array(PriceAdjustment).nullable().readonly(),
|
|
680
700
|
/**Required to calculate the accurate grandTotal of the charges */
|
|
681
|
-
discounts:
|
|
682
|
-
prepayments:
|
|
701
|
+
discounts: z21.array(PriceAdjustment).nullable().readonly(),
|
|
702
|
+
prepayments: z21.array(PriceAdjustment).nullable(),
|
|
683
703
|
/** The client's identity */
|
|
684
704
|
clientUid: ClientIdentity.shape._id,
|
|
685
705
|
/**
|
|
686
706
|
* Data that is specific to the entity (for now it's just medical data).
|
|
687
707
|
* It will only be defined for the participants that have access to it.
|
|
688
708
|
*/
|
|
689
|
-
payload:
|
|
709
|
+
payload: z21.object({
|
|
690
710
|
...MedicalDetails.shape,
|
|
691
|
-
lastModified:
|
|
711
|
+
lastModified: z21.number().nullable()
|
|
692
712
|
}).nullish(),
|
|
693
713
|
/** Only defined when either the service provider or the client cancelled their appointment */
|
|
694
|
-
cancelled:
|
|
714
|
+
cancelled: z21.object({
|
|
695
715
|
/** The time that the confirm cancel button was clicked */
|
|
696
716
|
doneAt: Timestamp,
|
|
697
717
|
reason: Reason,
|
|
@@ -699,16 +719,16 @@ var MiniAppointmentDetails = z20.object({
|
|
|
699
719
|
}).optional(),
|
|
700
720
|
/** Add this after consulting with company owners about payment expectations */
|
|
701
721
|
// paymentDueDate: Timestamp.nullish(),
|
|
702
|
-
payments:
|
|
703
|
-
|
|
722
|
+
payments: z21.array(
|
|
723
|
+
z21.object({
|
|
704
724
|
method: paymentMethods,
|
|
705
|
-
amount:
|
|
725
|
+
amount: z21.number().positive(),
|
|
706
726
|
...TimeLog.shape
|
|
707
727
|
})
|
|
708
728
|
).max(100).nullish(),
|
|
709
|
-
timeline:
|
|
729
|
+
timeline: z21.object({
|
|
710
730
|
scheduler: TimelineActivity,
|
|
711
|
-
physAsst: TimelineActivity.or(
|
|
731
|
+
physAsst: TimelineActivity.or(z21.literal("none")),
|
|
712
732
|
doctor: TimelineActivity,
|
|
713
733
|
cashier: TimelineActivity.nullable()
|
|
714
734
|
}),
|
|
@@ -716,17 +736,17 @@ var MiniAppointmentDetails = z20.object({
|
|
|
716
736
|
});
|
|
717
737
|
var AppointmentDetails = MiniAppointmentDetails.omit({
|
|
718
738
|
clientUid: true
|
|
719
|
-
}).extend(
|
|
739
|
+
}).extend(z21.object({ client: ClientIdentity }).shape);
|
|
720
740
|
var MutableAppointmentDetails = AppointmentDetails.safeExtend(
|
|
721
|
-
|
|
741
|
+
z21.object({
|
|
722
742
|
/**
|
|
723
743
|
* @description An encrypted copy of the last state of the appointment.
|
|
724
744
|
* @note Used to accurately update the appointment without having to query the database
|
|
725
745
|
*/
|
|
726
|
-
_hash:
|
|
746
|
+
_hash: z21.string()
|
|
727
747
|
}).shape
|
|
728
748
|
);
|
|
729
|
-
var ScheduleAppointmentForm =
|
|
749
|
+
var ScheduleAppointmentForm = z21.object({
|
|
730
750
|
clientUid: ClientIdentity.shape._id,
|
|
731
751
|
/** A nullish value === next_available */
|
|
732
752
|
serviceProviderUid: CompanyUser.shape._id.nullish(),
|
|
@@ -936,6 +956,7 @@ export {
|
|
|
936
956
|
CompanyState,
|
|
937
957
|
CompanyUser,
|
|
938
958
|
CompanyUserSession,
|
|
959
|
+
CreateCompanyForm,
|
|
939
960
|
CreditCurrency,
|
|
940
961
|
InviteResponse,
|
|
941
962
|
InvoiceNo,
|
|
@@ -976,6 +997,7 @@ export {
|
|
|
976
997
|
findNextAvailableStaff,
|
|
977
998
|
getCompatibleRoles,
|
|
978
999
|
healthcareProviderRoles,
|
|
1000
|
+
normalizeCompanyId,
|
|
979
1001
|
paymentMethods,
|
|
980
1002
|
scheduleAppointment,
|
|
981
1003
|
serviceProviders,
|