medos-sdk 1.0.1 → 1.0.3

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.
Files changed (113) hide show
  1. package/README.md +208 -73
  2. package/dist/client/MedosClient.d.ts +1 -1
  3. package/dist/client/MedosClient.js +1 -1
  4. package/dist/components/AppointmentCalender.d.ts +1 -4
  5. package/dist/components/AppointmentCalender.js +282 -486
  6. package/dist/components/AppointmentDateTimeModal.d.ts +14 -0
  7. package/dist/components/AppointmentDateTimeModal.js +206 -0
  8. package/dist/components/ConfigurableCard.d.ts +12 -0
  9. package/dist/components/ConfigurableCard.js +29 -0
  10. package/dist/components/DoctorSelectModal.d.ts +7 -0
  11. package/dist/components/DoctorSelectModal.js +80 -0
  12. package/dist/components/Icons/Check.d.ts +6 -0
  13. package/dist/components/Icons/Check.js +2 -0
  14. package/dist/components/Icons/ChevronDownIcon.d.ts +4 -0
  15. package/dist/components/Icons/ChevronDownIcon.js +2 -0
  16. package/dist/components/Icons/ChevronLeft.d.ts +3 -0
  17. package/dist/components/Icons/ChevronLeft.js +3 -0
  18. package/dist/components/Icons/ChevronRight.d.ts +3 -0
  19. package/dist/components/Icons/ChevronRight.js +3 -0
  20. package/dist/components/Icons/ConfirmationCheck.d.ts +1 -0
  21. package/dist/components/Icons/ConfirmationCheck.js +9 -0
  22. package/dist/components/Icons/ConsultationType.d.ts +1 -0
  23. package/dist/components/Icons/ConsultationType.js +2 -0
  24. package/dist/components/Icons/Date&TimeIcon.d.ts +1 -0
  25. package/dist/components/Icons/Date&TimeIcon.js +2 -0
  26. package/dist/components/Icons/MapIcon.d.ts +1 -0
  27. package/dist/components/Icons/MapIcon.js +2 -0
  28. package/dist/components/Icons/PaymentMethodIcon.d.ts +1 -0
  29. package/dist/components/Icons/PaymentMethodIcon.js +2 -0
  30. package/dist/components/Icons/UserIcon.d.ts +1 -0
  31. package/dist/components/Icons/UserIcon.js +2 -0
  32. package/dist/components/PatientDetailsStep.d.ts +3 -0
  33. package/dist/components/PatientDetailsStep.js +76 -0
  34. package/dist/components/PhoneVerificationStep.d.ts +3 -0
  35. package/dist/components/PhoneVerificationStep.js +39 -0
  36. package/dist/components/SuccessStep.d.ts +3 -0
  37. package/dist/components/SuccessStep.js +17 -0
  38. package/dist/components/custom-calendar.d.ts +5 -0
  39. package/dist/components/custom-calendar.js +153 -0
  40. package/dist/components/styles.d.ts +6 -0
  41. package/dist/components/styles.js +257 -0
  42. package/dist/components/types.d.ts +182 -0
  43. package/dist/components/types.js +55 -0
  44. package/dist/components/ui/select.d.ts +10 -0
  45. package/dist/components/ui/select.js +21 -0
  46. package/dist/components/uiComponents/SelectDropdown.d.ts +41 -0
  47. package/dist/components/uiComponents/SelectDropdown.js +302 -0
  48. package/dist/components/utils.d.ts +5 -0
  49. package/dist/components/utils.js +15 -0
  50. package/dist/components/validation.d.ts +2 -0
  51. package/dist/components/validation.js +7 -0
  52. package/dist/context/TemplateContext.d.ts +12 -0
  53. package/dist/context/TemplateContext.js +19 -0
  54. package/dist/core/index.d.ts +8 -0
  55. package/dist/core/index.js +8 -0
  56. package/dist/lib/templateUtils.d.ts +3 -0
  57. package/dist/lib/templateUtils.js +28 -0
  58. package/dist/react/index.d.ts +2 -0
  59. package/dist/react/index.js +2 -0
  60. package/dist/services/AppointmentService.d.ts +9 -10
  61. package/dist/services/AppointmentService.js +12 -10
  62. package/dist/templates/registry.d.ts +12 -0
  63. package/dist/templates/registry.js +58 -0
  64. package/dist/vanilla/AppointmentCalendarWidget.d.ts +41 -0
  65. package/dist/vanilla/AppointmentCalendarWidget.js +848 -0
  66. package/dist/vanilla/appointment-calendar/provider.d.ts +13 -0
  67. package/dist/vanilla/appointment-calendar/types.d.ts +144 -0
  68. package/dist/vanilla/appointments/provider.d.ts +13 -0
  69. package/dist/vanilla/appointments/types.d.ts +81 -0
  70. package/dist/vanilla/client/MedosClient.d.ts +32 -0
  71. package/dist/vanilla/components/AppointmentCalender.d.ts +3 -0
  72. package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +14 -0
  73. package/dist/vanilla/components/ConfigurableCard.d.ts +12 -0
  74. package/dist/vanilla/components/DoctorSelectModal.d.ts +7 -0
  75. package/dist/vanilla/components/Icons/Check.d.ts +6 -0
  76. package/dist/vanilla/components/Icons/ChevronDownIcon.d.ts +4 -0
  77. package/dist/vanilla/components/Icons/ChevronLeft.d.ts +3 -0
  78. package/dist/vanilla/components/Icons/ChevronRight.d.ts +3 -0
  79. package/dist/vanilla/components/Icons/ConfirmationCheck.d.ts +1 -0
  80. package/dist/vanilla/components/Icons/ConsultationType.d.ts +1 -0
  81. package/dist/vanilla/components/Icons/Date&TimeIcon.d.ts +1 -0
  82. package/dist/vanilla/components/Icons/MapIcon.d.ts +1 -0
  83. package/dist/vanilla/components/Icons/PaymentMethodIcon.d.ts +1 -0
  84. package/dist/vanilla/components/Icons/UserIcon.d.ts +1 -0
  85. package/dist/vanilla/components/PatientDetailsStep.d.ts +3 -0
  86. package/dist/vanilla/components/PhoneVerificationStep.d.ts +3 -0
  87. package/dist/vanilla/components/SuccessStep.d.ts +3 -0
  88. package/dist/vanilla/components/custom-calendar.d.ts +5 -0
  89. package/dist/vanilla/components/styles.d.ts +6 -0
  90. package/dist/vanilla/components/types.d.ts +182 -0
  91. package/dist/vanilla/components/ui/select.d.ts +10 -0
  92. package/dist/vanilla/components/uiComponents/SelectDropdown.d.ts +41 -0
  93. package/dist/vanilla/components/utils.d.ts +5 -0
  94. package/dist/vanilla/components/validation.d.ts +2 -0
  95. package/dist/vanilla/context/TemplateContext.d.ts +12 -0
  96. package/dist/vanilla/core/index.d.ts +8 -0
  97. package/dist/vanilla/index.d.ts +7 -0
  98. package/dist/vanilla/index.js +2 -0
  99. package/dist/vanilla/lib/templateUtils.d.ts +3 -0
  100. package/dist/vanilla/react/index.d.ts +2 -0
  101. package/dist/vanilla/services/AppointmentService.d.ts +85 -0
  102. package/dist/vanilla/services/AuthService.d.ts +6 -0
  103. package/dist/vanilla/services/PatientService.d.ts +14 -0
  104. package/dist/vanilla/templates/alternative.css +13 -0
  105. package/dist/vanilla/templates/default.css +13 -0
  106. package/dist/vanilla/templates/registry.d.ts +12 -0
  107. package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +41 -0
  108. package/dist/vanilla/vanilla/index.d.ts +2 -0
  109. package/dist/vanilla/vanilla/widget.d.ts +10 -0
  110. package/dist/vanilla/widget.css +217 -0
  111. package/dist/vanilla/widget.d.ts +10 -0
  112. package/dist/vanilla/widget.js +5084 -0
  113. package/package.json +40 -5
@@ -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,3 @@
1
+ import type { TemplateId } from "../core";
2
+ export declare function injectTemplateStyles(templateId: TemplateId): void;
3
+ export declare function removeTemplateStyles(): void;
@@ -0,0 +1,2 @@
1
+ export * from "../core";
2
+ export { AppointmentCalender } from "../components/AppointmentCalender";
@@ -0,0 +1,85 @@
1
+ export type Doctor = {
2
+ id: number;
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;
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
+ };
71
+ type AddressesResponse = {
72
+ totalAddresses?: number;
73
+ totalDoctors?: number;
74
+ totalConfiguredAppointments?: number;
75
+ totalPartialConfiguredAppointments?: number;
76
+ totalNotConfiguredAppointments?: number;
77
+ workspaceId?: number;
78
+ addresses: AddressItem[];
79
+ };
80
+ declare const AppointmentService: {
81
+ getAddresses(): Promise<AddressesResponse>;
82
+ fetchSlots(workspaceId: number, addressId: number, doctorId: number, appointmentDate: string): Promise<Slot[]>;
83
+ createAppointment(payload: BookAppointmentPayload): Promise<any>;
84
+ };
85
+ 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,13 @@
1
+ /* Alternative Green Template */
2
+
3
+ :root {
4
+ --medos-primary-color: #10b981;
5
+ --medos-secondary-color: #d1fae5;
6
+ --medos-accent-color: #059669;
7
+ --medos-background-color: #f0fdf4;
8
+ --medos-text-color: #1f2937;
9
+ --medos-border-color: #d1d5db;
10
+ --medos-muted-text: #6b7280;
11
+ --medos-success-color: #059669;
12
+ --medos-error-color: #dc2626;
13
+ }
@@ -0,0 +1,13 @@
1
+ /* Default Blue Template */
2
+
3
+ :root {
4
+ --medos-primary-color: #0b79f7;
5
+ --medos-secondary-color: #eef2ff;
6
+ --medos-accent-color: #0b79f7;
7
+ --medos-background-color: #f6f8fa;
8
+ --medos-text-color: #333;
9
+ --medos-border-color: #e6e9ef;
10
+ --medos-muted-text: #6b7280;
11
+ --medos-success-color: #10b981;
12
+ --medos-error-color: #ef4444;
13
+ }
@@ -0,0 +1,12 @@
1
+ import type { TemplateId, TemplateConfig } from "../core";
2
+ export declare class TemplateRegistry {
3
+ private static instance;
4
+ private readonly templates;
5
+ private constructor();
6
+ static getInstance(): TemplateRegistry;
7
+ getTemplate(id: TemplateId): TemplateConfig;
8
+ getAllTemplates(): Record<TemplateId, TemplateConfig>;
9
+ hasTemplate(id: TemplateId): boolean;
10
+ private initializeTemplates;
11
+ }
12
+ export declare const templateRegistry: TemplateRegistry;
@@ -0,0 +1,41 @@
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 state;
14
+ private doctors;
15
+ constructor(container: HTMLElement | string, options: AppointmentCalendarWidgetOptions);
16
+ private init;
17
+ private loadAddresses;
18
+ private handleAddressChange;
19
+ private loadSlots;
20
+ private canProceedFromMergedStep;
21
+ private sendOtp;
22
+ private verifyOtp;
23
+ private submitAppointment;
24
+ private goToNext;
25
+ private goBack;
26
+ private reset;
27
+ private setState;
28
+ private render;
29
+ private renderStep;
30
+ private renderStep0;
31
+ private renderStep1;
32
+ private renderStep2;
33
+ private renderStep3;
34
+ private renderStep4;
35
+ private renderStep5;
36
+ private attachEventListeners;
37
+ private escapeHtml;
38
+ destroy(): void;
39
+ }
40
+ export declare function initAppointmentCalendar(options: AppointmentCalendarWidgetOptions): AppointmentCalendarWidget;
41
+ 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 };
@@ -0,0 +1,217 @@
1
+ /* Medos Appointment Calendar Widget Styles */
2
+
3
+ .medos-appointment-container {
4
+ display: flex;
5
+ justify-content: center;
6
+ padding: 20px;
7
+ font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
8
+ background: #f6f8fa;
9
+ }
10
+
11
+ .medos-appointment-card {
12
+ width: 100%;
13
+ max-width: 720px;
14
+ background: #fff;
15
+ border-radius: 12px;
16
+ box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
17
+ padding: 24px;
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ .medos-appointment-header {
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: space-between;
25
+ margin-bottom: 16px;
26
+ }
27
+
28
+ .medos-appointment-title {
29
+ margin: 0;
30
+ font-size: 20px;
31
+ font-weight: 600;
32
+ }
33
+
34
+ .medos-appointment-stepper {
35
+ display: flex;
36
+ gap: 8px;
37
+ align-items: center;
38
+ }
39
+
40
+ .medos-appointment-step-pill {
41
+ padding: 6px 10px;
42
+ border-radius: 999px;
43
+ font-size: 12px;
44
+ font-weight: 600;
45
+ background: #eef2ff;
46
+ color: #333;
47
+ }
48
+
49
+ .medos-appointment-step-pill.active {
50
+ background: #0b79f7;
51
+ color: #fff;
52
+ }
53
+
54
+ .medos-appointment-section {
55
+ margin-top: 12px;
56
+ }
57
+
58
+ .medos-appointment-label {
59
+ display: block;
60
+ font-size: 13px;
61
+ margin-bottom: 6px;
62
+ color: #374151;
63
+ }
64
+
65
+ .medos-appointment-input,
66
+ .medos-appointment-select,
67
+ .medos-appointment-textarea {
68
+ width: 100%;
69
+ padding: 10px 12px;
70
+ border-radius: 8px;
71
+ border: 1px solid #e6e9ef;
72
+ outline: none;
73
+ font-size: 14px;
74
+ box-sizing: border-box;
75
+ font-family: inherit;
76
+ }
77
+
78
+ .medos-appointment-select {
79
+ background: #fff;
80
+ }
81
+
82
+ .medos-appointment-textarea {
83
+ min-height: 80px;
84
+ resize: vertical;
85
+ }
86
+
87
+ .medos-appointment-actions {
88
+ display: flex;
89
+ gap: 8px;
90
+ margin-top: 16px;
91
+ justify-content: flex-end;
92
+ }
93
+
94
+ .medos-appointment-btn {
95
+ padding: 10px 14px;
96
+ border-radius: 8px;
97
+ cursor: pointer;
98
+ font-weight: 600;
99
+ font-size: 14px;
100
+ border: none;
101
+ font-family: inherit;
102
+ }
103
+
104
+ .medos-appointment-btn-primary {
105
+ background: #0b79f7;
106
+ color: #fff;
107
+ }
108
+
109
+ .medos-appointment-btn-primary:disabled {
110
+ opacity: 0.6;
111
+ cursor: not-allowed;
112
+ }
113
+
114
+ .medos-appointment-btn-secondary {
115
+ background: #fff;
116
+ color: #0b254a;
117
+ border: 1px solid #e6e9ef;
118
+ }
119
+
120
+ .medos-appointment-slot-grid {
121
+ display: grid;
122
+ grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
123
+ gap: 12px;
124
+ margin-top: 12px;
125
+ }
126
+
127
+ .medos-appointment-slot-card {
128
+ padding: 12px;
129
+ border-radius: 10px;
130
+ border: 1px solid #e6e9ef;
131
+ background: #fff;
132
+ cursor: pointer;
133
+ text-align: center;
134
+ transition: all 0.2s;
135
+ }
136
+
137
+ .medos-appointment-slot-card:hover {
138
+ border-color: #0b79f7;
139
+ }
140
+
141
+ .medos-appointment-slot-card.selected {
142
+ border: 2px solid #0b79f7;
143
+ background: linear-gradient(180deg, #f0f6ff, #e9f2ff);
144
+ }
145
+
146
+ .medos-appointment-slot-time {
147
+ font-weight: 700;
148
+ font-size: 14px;
149
+ }
150
+
151
+ .medos-appointment-small-muted {
152
+ font-size: 12px;
153
+ color: #6b7280;
154
+ }
155
+
156
+ .medos-appointment-success-card {
157
+ padding: 20px;
158
+ border-radius: 12px;
159
+ background: linear-gradient(90deg, #ecfdf5, #eff6ff);
160
+ text-align: center;
161
+ }
162
+
163
+ .medos-appointment-success-icon {
164
+ font-size: 32px;
165
+ color: #10b981;
166
+ margin-bottom: 8px;
167
+ }
168
+
169
+ .medos-appointment-success-title {
170
+ font-weight: 700;
171
+ margin-bottom: 6px;
172
+ }
173
+
174
+ .medos-appointment-loading {
175
+ margin-bottom: 12px;
176
+ }
177
+
178
+ .medos-appointment-error {
179
+ margin-bottom: 12px;
180
+ color: #ef4444;
181
+ font-weight: 600;
182
+ }
183
+
184
+ .medos-appointment-verified {
185
+ margin-top: 12px;
186
+ padding: 12px;
187
+ border-radius: 8px;
188
+ background: #ecfdf5;
189
+ color: #10b981;
190
+ font-weight: 600;
191
+ }
192
+
193
+ .medos-appointment-form-grid {
194
+ display: grid;
195
+ grid-template-columns: 1fr 1fr;
196
+ gap: 12px;
197
+ margin-top: 12px;
198
+ }
199
+
200
+ .medos-appointment-form-grid-2col {
201
+ display: grid;
202
+ grid-template-columns: 1fr 1fr;
203
+ gap: 16px;
204
+ }
205
+
206
+ .medos-appointment-validation-error {
207
+ margin-top: 4px;
208
+ font-size: 12px;
209
+ color: #ef4444;
210
+ }
211
+
212
+ .medos-appointment-otp-info {
213
+ margin-top: 8px;
214
+ font-size: 12px;
215
+ color: #6b7280;
216
+ }
217
+
@@ -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 };