medos-sdk 1.0.1 → 1.0.2

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.
@@ -0,0 +1,13 @@
1
+ import { CreateAppointmentPayload, AppointmentListPayload, AppointmentListResponse, AvailableSlotsPayload, UpdateAppointmentPayload, AvailableSlot, RescheduleAppointmentPayload, CreateMeetingPayload, CreateMeetingResponse, EndMeetingPayload } from "./types";
2
+ export declare const createAppointment: (appointmentPayload: Partial<CreateAppointmentPayload>) => Promise<any>;
3
+ export declare const updateAppointment: (appointmentPayload: UpdateAppointmentPayload) => Promise<any>;
4
+ export declare const rescheduleAppointment: (appointmentPayload: RescheduleAppointmentPayload) => Promise<any>;
5
+ export declare const deleteAppointment: (payload: {
6
+ appointmentId: number;
7
+ workspaceId: number;
8
+ addressId: number;
9
+ }) => Promise<any>;
10
+ export declare const fetchAppointments: (payload: AppointmentListPayload) => Promise<AppointmentListResponse[]>;
11
+ export declare const fetchAvailableSlots: (payload: AvailableSlotsPayload) => Promise<AvailableSlot[]>;
12
+ export declare const createMeeting: (payload: CreateMeetingPayload) => Promise<CreateMeetingResponse>;
13
+ export declare const endMeeting: (payload: EndMeetingPayload) => Promise<any>;
@@ -0,0 +1,144 @@
1
+ export declare enum PaymentMode {
2
+ CASH = "CASH",
3
+ CARD = "CARD",
4
+ UPI = "UPI"
5
+ }
6
+ export declare enum AppointmentType {
7
+ CONSULTATION = "CONSULTATION",
8
+ FOLLOW_UP = "FOLLOW_UP",
9
+ LAB_TEST = "LAB_TEST",
10
+ SURGERY = "SURGERY",
11
+ VIRTUAL = "VIRTUAL",
12
+ IN_PERSON = "IN_PERSON"
13
+ }
14
+ export declare enum AppointmentStatus {
15
+ SCHEDULED = "SCHEDULED",
16
+ CANCELLED = "CANCELLED",
17
+ COMPLETED = "COMPLETED",
18
+ NO_SHOW = "NO_SHOW"
19
+ }
20
+ export declare enum AppointmentMode {
21
+ ONLINE = "ONLINE",
22
+ OFFLINE = "OFFLINE"
23
+ }
24
+ export declare enum AppointmentAction {
25
+ EDIT = "EDIT",
26
+ RESCHEDULE = "RESCHEDULE",
27
+ CANCEL = "CANCEL"
28
+ }
29
+ export declare enum AppointmentSource {
30
+ MEDOS_WEBSITE = "MEDOS_WEBSITE",
31
+ WEBSITE = "WEBSITE",
32
+ ANDROID = "ANDROID",
33
+ IOS = "IOS",
34
+ MEDOS_APP_ANDROID = "MEDOS_APP_ANDROID",
35
+ MEDOS_APP_IOS = "MEDOS_APP_IOS"
36
+ }
37
+ export interface CreateAppointmentPayload {
38
+ workspaceId: number;
39
+ addressId: number;
40
+ doctorId: number;
41
+ patientId: number;
42
+ mode: AppointmentMode;
43
+ appointmentDate: string;
44
+ fromDateTimeTs: string;
45
+ toDateTimeTs: string;
46
+ consultationCharge: number;
47
+ appointmentNotes?: string;
48
+ paymentMode: PaymentMode;
49
+ type: AppointmentType;
50
+ patientCheckedIn?: boolean;
51
+ isNoShow?: boolean;
52
+ source: AppointmentSource;
53
+ attachments?: File[];
54
+ }
55
+ export interface UpdateAppointmentPayload {
56
+ id: number;
57
+ workspaceId: number;
58
+ addressId: number;
59
+ mode: AppointmentMode;
60
+ consultationCharge: number;
61
+ appointmentNotes?: string;
62
+ paymentMode: PaymentMode;
63
+ type: AppointmentType;
64
+ patientCheckedIn?: boolean;
65
+ isNoShow?: boolean;
66
+ source: AppointmentSource;
67
+ }
68
+ export interface RescheduleAppointmentPayload {
69
+ id: number;
70
+ workspaceId: number;
71
+ addressId: number;
72
+ doctorId: number;
73
+ appointmentDate: string;
74
+ fromDateTimeTs: string;
75
+ toDateTimeTs: string;
76
+ }
77
+ export interface AppointmentListPayload {
78
+ workspaceId: number;
79
+ addressId: number;
80
+ doctorId?: number;
81
+ patientId?: number;
82
+ appointmentDate: string;
83
+ startDate: string;
84
+ endDate: string;
85
+ status: string;
86
+ }
87
+ export interface Appointment {
88
+ id: number;
89
+ createdAt: string;
90
+ deleted: boolean;
91
+ createdAtEpoch: number;
92
+ workspaceId: number;
93
+ addressId: number;
94
+ doctorId: number;
95
+ patientId: number;
96
+ fromDateTimeTs: number;
97
+ toDateTimeTs: number;
98
+ appointmentDate: string;
99
+ status: AppointmentStatus;
100
+ appointmentNotes: string;
101
+ type: string;
102
+ durationInSeconds: number;
103
+ mode: AppointmentMode;
104
+ reminderSent: boolean;
105
+ paymentMode: string;
106
+ patientCheckedIn: boolean;
107
+ consultationCharge: number;
108
+ isNoShow: boolean;
109
+ source: AppointmentSource;
110
+ }
111
+ export interface AppointmentListResponse {
112
+ appointment: Appointment;
113
+ patient?: any;
114
+ }
115
+ export interface AvailableSlot {
116
+ appointmentDate: string;
117
+ fromDateTimeTs: string;
118
+ toDateTimeTs: string;
119
+ }
120
+ export interface AvailableSlotsPayload {
121
+ workspaceId: number;
122
+ addressId: number;
123
+ doctorId: number;
124
+ appointmentDate?: string;
125
+ }
126
+ export interface CreateMeetingPayload {
127
+ hostId: number;
128
+ channelName: string;
129
+ appointmentId: number;
130
+ joinerId: number;
131
+ }
132
+ export interface CreateMeetingResponse {
133
+ meetingId: number;
134
+ hostToken: string;
135
+ appId: string;
136
+ channelName: string;
137
+ joinerTokens: {
138
+ userId: number;
139
+ token: string;
140
+ }[];
141
+ }
142
+ export interface EndMeetingPayload {
143
+ id: number;
144
+ }
@@ -0,0 +1,13 @@
1
+ import { FetchWorkspaceAddressDoctorResponse, AppointmentConfig } from "./types";
2
+ export declare const createAppointmentConfig: (payload: AppointmentConfig) => Promise<AppointmentConfig>;
3
+ export declare const updateAppointmentConfig: ({ id, payload, }: {
4
+ id: string;
5
+ payload: Omit<AppointmentConfig, "userId" | "workspaceId" | "addressId">;
6
+ }) => Promise<AppointmentConfig>;
7
+ export declare const deleteAppointmentConfig: ({ id, }: {
8
+ id: number;
9
+ workspaceId?: number;
10
+ addressId?: number;
11
+ userId?: number;
12
+ }) => Promise<void>;
13
+ export declare const fetchWorkspaceAddressesDoctor: (workspaceId: string) => Promise<FetchWorkspaceAddressDoctorResponse>;
@@ -0,0 +1,81 @@
1
+ export interface DoctorAddress {
2
+ id: number;
3
+ completeAddress: string;
4
+ phoneNumber: string;
5
+ doctorsCount: number;
6
+ totalConfiguredAppointments: number;
7
+ doctors: Doctor[];
8
+ }
9
+ export interface AppointmentFeeConfigurationDTO {
10
+ offlineConsultationFee: number;
11
+ onlineConsultationFee: number;
12
+ currency: string;
13
+ }
14
+ export interface AppointmentTypeAndPermissionDTO {
15
+ allowOnline: boolean;
16
+ allowOffline: boolean;
17
+ allowCancellation: boolean;
18
+ allowRescheduling: boolean;
19
+ cancellationAllowedBeforeInHours: number;
20
+ }
21
+ export interface BasicAppointmentSettingDTO {
22
+ defaultDuration: number;
23
+ bufferTime: number;
24
+ bookingLimitPerDay: number;
25
+ maximumConsecutiveAppointment: number;
26
+ }
27
+ export interface AppointmentConsultationValidityAndFollowUpPolicyDTO {
28
+ enableConsultationValidity: boolean;
29
+ consultationValidityDays: number;
30
+ followUpConsultationFee: number;
31
+ maximumFollowUpVisits: number;
32
+ followUpFeeType: string;
33
+ followUpFeePercentage: number;
34
+ validityAppliesToSameComplaint: boolean;
35
+ validityResetOnNewComplaint: boolean;
36
+ }
37
+ export interface AppointmentWorkingHourSlot {
38
+ id?: number;
39
+ startTime: string;
40
+ endTime: string;
41
+ duration: number;
42
+ }
43
+ export interface AppointmentConfigWorkingHours {
44
+ id?: number;
45
+ dayOfWeek: string;
46
+ workingHours: AppointmentWorkingHourSlot[];
47
+ }
48
+ export interface SpecialDayConfig {
49
+ eventDayDate: string;
50
+ eventDayType: string;
51
+ eventDayName: string;
52
+ }
53
+ export interface AppointmentConfig {
54
+ id?: number;
55
+ workspaceId: number;
56
+ addressId: number;
57
+ userId: number;
58
+ status?: string;
59
+ appointmentConfigWorkingHours: AppointmentConfigWorkingHours[];
60
+ appointmentConsultationValidityAndFollowUpPolicyDTO: AppointmentConsultationValidityAndFollowUpPolicyDTO;
61
+ appointmentFeeConfigurationDTO: AppointmentFeeConfigurationDTO;
62
+ appointmentTypeAndPermissionDTO: AppointmentTypeAndPermissionDTO;
63
+ basicAppointmentSettingDTO: BasicAppointmentSettingDTO;
64
+ specialDayConfigs: SpecialDayConfig[];
65
+ }
66
+ export interface Doctor {
67
+ id: number;
68
+ email: string;
69
+ name: string;
70
+ specialization: string[];
71
+ phoneNumber: string;
72
+ profilePic: string | null;
73
+ appointmentConfig: AppointmentConfig | null;
74
+ }
75
+ export interface FetchWorkspaceAddressDoctorResponse {
76
+ totalAddresses: number;
77
+ totalConfiguredAppointments: number;
78
+ totalPartialConfiguredAppointments: number;
79
+ totalNotConfiguredAppointments: number;
80
+ addresses: DoctorAddress[];
81
+ }
@@ -0,0 +1,32 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { AddressesResponse } from "../services/AppointmentService";
3
+ import { SendPhoneVerificationOtpPayload, VerifyPhoneVerificationOtpPayload } from "../services/PatientService";
4
+ interface MedosClientConfig {
5
+ apiKey: string;
6
+ baseURL?: string;
7
+ }
8
+ interface MedosClientSessionConfig {
9
+ sessionToken: string;
10
+ baseURL?: string;
11
+ }
12
+ declare class MedosClient {
13
+ private static instance;
14
+ private static token;
15
+ private static refreshHandler;
16
+ private static isRefreshing;
17
+ private static pendingRequests;
18
+ private static initPromise;
19
+ static init({ apiKey, baseURL, }: MedosClientConfig): Promise<void>;
20
+ static initWithSession({ sessionToken, baseURL, }: MedosClientSessionConfig): Promise<void>;
21
+ private static initializeAxiosInstance;
22
+ static fetchAllAddressesAndDoctors(): Promise<AddressesResponse>;
23
+ static fetchAppointments(workspaceId: string | number, addressId: string | number, doctorId: string | number, appointmentDate: string): Promise<any[]>;
24
+ static sendPhoneVerificationOtp(payload: SendPhoneVerificationOtpPayload): Promise<any>;
25
+ static verifyPhoneVerificationOtp(payload: VerifyPhoneVerificationOtpPayload): Promise<any>;
26
+ static get client(): AxiosInstance;
27
+ static ensureInitialized(): Promise<AxiosInstance>;
28
+ static isInitialized(): boolean;
29
+ private static setToken;
30
+ static setRefreshHandler(handler: () => Promise<string | null>): void;
31
+ }
32
+ export { MedosClient };
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ type AppointmentCalenderProps = {
3
+ onError?: (err: Error) => void;
4
+ };
5
+ export declare const AppointmentCalender: React.FC<AppointmentCalenderProps>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ export { MedosClient } from "../client/MedosClient";
2
+ export * from "../appointments/provider";
3
+ export * from "../appointments/types";
4
+ export * from "../appointment-calendar/provider";
5
+ export * from "../appointment-calendar/types";
6
+ export { PatientService, SendPhoneVerificationOtpPayload, VerifyPhoneVerificationOtpPayload, } from "../services/PatientService";
7
+ export { AppointmentService, type BookAppointmentPayload, type PatientPayload, type PatientAddressPayload, type AddressesResponse, type AddressItem, } from "../services/AppointmentService";
8
+ export { AuthService } from "../services/AuthService";
@@ -0,0 +1,7 @@
1
+ export { MedosClient } from "./client/MedosClient";
2
+ export { AppointmentCalender } from "./components/AppointmentCalender";
3
+ export * from "./appointments/provider";
4
+ export * from "./appointments/types";
5
+ export * from "./appointment-calendar/provider";
6
+ export * from "./appointment-calendar/types";
7
+ export { PatientService, SendPhoneVerificationOtpPayload, VerifyPhoneVerificationOtpPayload, } from "./services/PatientService";
@@ -0,0 +1,2 @@
1
+ export * from "../core";
2
+ export { AppointmentCalendarWidget, initAppointmentCalendar } from "./AppointmentCalendarWidget";
@@ -0,0 +1,2 @@
1
+ export * from "../core";
2
+ export { AppointmentCalender } from "../components/AppointmentCalender";
@@ -0,0 +1,86 @@
1
+ export type Doctor = {
2
+ id: string;
3
+ name: string;
4
+ specialty?: string;
5
+ [key: string]: any;
6
+ };
7
+ export type Slot = {
8
+ start: string;
9
+ end: string;
10
+ id?: string;
11
+ [key: string]: any;
12
+ };
13
+ type PatientPayload = {
14
+ firstName: string;
15
+ lastName: string;
16
+ email?: string;
17
+ countryCode: string;
18
+ phoneNumber: string;
19
+ age?: number;
20
+ gender?: "MALE" | "FEMALE" | "OTHER";
21
+ };
22
+ type PatientAddressPayload = {
23
+ addressLine1: string;
24
+ city: string;
25
+ state: string;
26
+ country: string;
27
+ zipcode: string;
28
+ landmark?: string;
29
+ };
30
+ type BookAppointmentPayload = {
31
+ workspaceId?: string | number;
32
+ workspaceAddressId: string | number;
33
+ doctorId: string | number;
34
+ mode?: "OFFLINE" | "ONLINE";
35
+ appointmentDate: string;
36
+ fromDateTimeTs: string;
37
+ toDateTimeTs: string;
38
+ consultationCharge?: string;
39
+ type?: "CONSULTATION" | string;
40
+ source?: string;
41
+ patientPayload: PatientPayload;
42
+ patientAddress: PatientAddressPayload;
43
+ attachments?: File[];
44
+ };
45
+ type AppointmentPayload = {
46
+ workspaceId?: string | number;
47
+ workspaceAddressId: string | number;
48
+ doctorId: string | number;
49
+ mode?: "OFFLINE" | "ONLINE";
50
+ appointmentDate: string;
51
+ fromDateTimeTs: string;
52
+ toDateTimeTs: string;
53
+ consultationCharge?: string;
54
+ type?: string;
55
+ source?: string;
56
+ patientPayload: PatientPayload;
57
+ patientAddress: PatientAddressPayload;
58
+ attachments?: File[];
59
+ };
60
+ type AddressItem = {
61
+ id: number | string;
62
+ completeAddress?: string;
63
+ label?: string;
64
+ address?: string;
65
+ countryCode?: string | null;
66
+ phoneNumber?: string | null;
67
+ doctorsCount?: number;
68
+ totalConfiguredAppointments?: number;
69
+ doctors?: Doctor[];
70
+ [key: string]: any;
71
+ };
72
+ type AddressesResponse = {
73
+ totalAddresses?: number;
74
+ totalDoctors?: number;
75
+ totalConfiguredAppointments?: number;
76
+ totalPartialConfiguredAppointments?: number;
77
+ totalNotConfiguredAppointments?: number;
78
+ workspaceId?: number | string;
79
+ addresses: AddressItem[];
80
+ };
81
+ declare const AppointmentService: {
82
+ getAddresses(): Promise<AddressesResponse>;
83
+ fetchSlots(workspaceId: string | number, addressId: string | number, doctorId: string | number, appointmentDate: string): Promise<Slot[]>;
84
+ createAppointment(payload: BookAppointmentPayload): Promise<any>;
85
+ };
86
+ export { AppointmentService, AppointmentPayload, BookAppointmentPayload, PatientPayload, PatientAddressPayload, AddressesResponse, AddressItem, };
@@ -0,0 +1,6 @@
1
+ declare const AuthService: {
2
+ init(apiKey: string): Promise<string>;
3
+ getToken(): string | null;
4
+ clear(): void;
5
+ };
6
+ export { AuthService };
@@ -0,0 +1,14 @@
1
+ type SendPhoneVerificationOtpPayload = {
2
+ countryCode: string;
3
+ phoneNumber: string;
4
+ };
5
+ type VerifyPhoneVerificationOtpPayload = {
6
+ countryCode: string;
7
+ phoneNumber: string;
8
+ otpCode: string;
9
+ };
10
+ declare const PatientService: {
11
+ sendPhoneVerificationOtp(payload: SendPhoneVerificationOtpPayload): Promise<any>;
12
+ verifyPhoneVerificationOtp(payload: VerifyPhoneVerificationOtpPayload): Promise<any>;
13
+ };
14
+ export { PatientService, SendPhoneVerificationOtpPayload, VerifyPhoneVerificationOtpPayload, };
@@ -0,0 +1,73 @@
1
+ interface AppointmentCalendarWidgetOptions {
2
+ containerId: string;
3
+ apiKey?: string;
4
+ sessionToken?: string;
5
+ baseURL?: string;
6
+ onError?: (err: Error) => void;
7
+ onSuccess?: () => void;
8
+ }
9
+ declare class AppointmentCalendarWidget {
10
+ private container;
11
+ private options;
12
+ private mounted;
13
+ private step;
14
+ private addresses;
15
+ private addressDoctorsMap;
16
+ private selectedAddress;
17
+ private workspaceId;
18
+ private doctors;
19
+ private selectedDoctor;
20
+ private date;
21
+ private slots;
22
+ private selectedSlot;
23
+ private loading;
24
+ private error;
25
+ private patientName;
26
+ private patientAge;
27
+ private patientAddress;
28
+ private patientCity;
29
+ private patientState;
30
+ private patientCountry;
31
+ private patientZipcode;
32
+ private patientLandmark;
33
+ private patientEmail;
34
+ private patientGender;
35
+ private problemFacing;
36
+ private consultationCharge;
37
+ private countryCode;
38
+ private patientPhone;
39
+ private otpCode;
40
+ private otpSent;
41
+ private otpVerified;
42
+ private otpSending;
43
+ private otpVerifying;
44
+ constructor(container: HTMLElement | string, options: AppointmentCalendarWidgetOptions);
45
+ private init;
46
+ private loadAddresses;
47
+ private handleAddressChange;
48
+ private loadSlots;
49
+ private validatePhoneNumber;
50
+ private validateCountryCode;
51
+ private canProceedFromMergedStep;
52
+ private sendOtp;
53
+ private verifyOtp;
54
+ private submitAppointment;
55
+ private goToNext;
56
+ private goBack;
57
+ private reset;
58
+ private setLoading;
59
+ private setError;
60
+ private render;
61
+ private renderStep;
62
+ private renderStep0;
63
+ private renderStep1;
64
+ private renderStep2;
65
+ private renderStep3;
66
+ private renderStep4;
67
+ private renderStep5;
68
+ private attachEventListeners;
69
+ private escapeHtml;
70
+ destroy(): void;
71
+ }
72
+ export declare function initAppointmentCalendar(options: AppointmentCalendarWidgetOptions): AppointmentCalendarWidget;
73
+ export { AppointmentCalendarWidget };
@@ -0,0 +1,2 @@
1
+ export * from "../core";
2
+ export { AppointmentCalendarWidget, initAppointmentCalendar } from "./AppointmentCalendarWidget";
@@ -0,0 +1,10 @@
1
+ import { initAppointmentCalendar, AppointmentCalendarWidget } from "./AppointmentCalendarWidget";
2
+ declare global {
3
+ interface Window {
4
+ MedosAppointmentCalendar: {
5
+ init: typeof initAppointmentCalendar;
6
+ Widget: typeof AppointmentCalendarWidget;
7
+ };
8
+ }
9
+ }
10
+ export { initAppointmentCalendar, AppointmentCalendarWidget };