medos-sdk 1.0.0 → 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,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, } from "../services/PatientService";
7
+ export { AppointmentService, } from "../services/AppointmentService";
8
+ export { AuthService } from "../services/AuthService";
@@ -0,0 +1,2 @@
1
+ export * from "../core";
2
+ export { AppointmentCalender } from "../components/AppointmentCalender";
@@ -0,0 +1,2 @@
1
+ export * from "../core";
2
+ export { AppointmentCalender } from "../components/AppointmentCalender";
@@ -20,11 +20,11 @@ type PatientPayload = {
20
20
  gender?: "MALE" | "FEMALE" | "OTHER";
21
21
  };
22
22
  type PatientAddressPayload = {
23
- addressLine1?: string;
24
- city?: string;
25
- state?: string;
26
- country?: string;
27
- zipcode?: string;
23
+ addressLine1: string;
24
+ city: string;
25
+ state: string;
26
+ country: string;
27
+ zipcode: string;
28
28
  landmark?: string;
29
29
  };
30
30
  type BookAppointmentPayload = {
@@ -39,7 +39,7 @@ type BookAppointmentPayload = {
39
39
  type?: "CONSULTATION" | string;
40
40
  source?: string;
41
41
  patientPayload: PatientPayload;
42
- patientAddress?: PatientAddressPayload;
42
+ patientAddress: PatientAddressPayload;
43
43
  attachments?: File[];
44
44
  };
45
45
  type AppointmentPayload = {
@@ -54,7 +54,7 @@ type AppointmentPayload = {
54
54
  type?: string;
55
55
  source?: string;
56
56
  patientPayload: PatientPayload;
57
- patientAddress?: PatientAddressPayload;
57
+ patientAddress: PatientAddressPayload;
58
58
  attachments?: File[];
59
59
  };
60
60
  type AddressItem = {
@@ -73,7 +73,6 @@ const AppointmentService = {
73
73
  },
74
74
  async createAppointment(payload) {
75
75
  const client = await MedosClient.ensureInitialized();
76
- const workspaceId = payload.workspaceId;
77
76
  const appointmentData = {
78
77
  workspaceAddressId: payload.workspaceAddressId,
79
78
  doctorId: payload.doctorId,
@@ -87,22 +86,24 @@ const AppointmentService = {
87
86
  patientPayload: payload.patientPayload,
88
87
  patientAddress: payload.patientAddress,
89
88
  };
90
- const formData = new FormData();
91
- const payloadString = JSON.stringify(appointmentData);
92
- formData.append("payload", payloadString);
93
89
  if (payload.attachments && payload.attachments.length > 0) {
90
+ const formData = new FormData();
91
+ const payloadString = JSON.stringify(appointmentData);
92
+ formData.append("payload", payloadString);
94
93
  payload.attachments.forEach((file) => {
95
94
  formData.append("attachments", file);
96
95
  });
96
+ const res = await client.post("/appointments/book-appointment", formData);
97
+ return res.data;
97
98
  }
98
- const config = {
99
- headers: {},
100
- };
101
- if (workspaceId) {
102
- config.headers["workspace-id"] = String(workspaceId);
99
+ else {
100
+ const res = await client.post("/appointments/book-appointment", appointmentData, {
101
+ headers: {
102
+ "Content-Type": "application/json",
103
+ },
104
+ });
105
+ return res.data;
103
106
  }
104
- const res = await client.post("/appointments/book-appointment", formData, config);
105
- return res.data;
106
107
  },
107
108
  };
108
109
  export { AppointmentService, };
@@ -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 };