medos-sdk 1.0.2 → 1.1.0
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/README.md +39 -0
- package/dist/client/MedosClient.d.ts +3 -5
- package/dist/client/MedosClient.js +4 -4
- package/dist/components/AppointmentCalender.d.ts +1 -4
- package/dist/components/AppointmentCalender.js +323 -530
- package/dist/components/AppointmentDateTimeModal.d.ts +14 -0
- package/dist/components/AppointmentDateTimeModal.js +220 -0
- package/dist/components/ConfigurableCard.d.ts +12 -0
- package/dist/components/ConfigurableCard.js +29 -0
- package/dist/components/ContactInformationStep.d.ts +13 -0
- package/dist/components/ContactInformationStep.js +14 -0
- package/dist/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/components/ContactPreferenceStep.js +16 -0
- package/dist/components/DoctorSelectModal.d.ts +7 -0
- package/dist/components/DoctorSelectModal.js +93 -0
- package/dist/components/EnquiryForm.d.ts +7 -0
- package/dist/components/EnquiryForm.js +212 -0
- package/dist/components/Icons/Check.d.ts +6 -0
- package/dist/components/Icons/Check.js +2 -0
- package/dist/components/Icons/ChevronDownIcon.d.ts +4 -0
- package/dist/components/Icons/ChevronDownIcon.js +2 -0
- package/dist/components/Icons/ChevronLeft.d.ts +3 -0
- package/dist/components/Icons/ChevronLeft.js +3 -0
- package/dist/components/Icons/ChevronRight.d.ts +3 -0
- package/dist/components/Icons/ChevronRight.js +3 -0
- package/dist/components/Icons/ConfirmationCheck.d.ts +1 -0
- package/dist/components/Icons/ConfirmationCheck.js +9 -0
- package/dist/components/Icons/ConsultationType.d.ts +1 -0
- package/dist/components/Icons/ConsultationType.js +2 -0
- package/dist/components/Icons/Date&TimeIcon.d.ts +1 -0
- package/dist/components/Icons/Date&TimeIcon.js +2 -0
- package/dist/components/Icons/MapIcon.d.ts +1 -0
- package/dist/components/Icons/MapIcon.js +2 -0
- package/dist/components/Icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/components/Icons/PaymentMethodIcon.js +2 -0
- package/dist/components/Icons/UserIcon.d.ts +1 -0
- package/dist/components/Icons/UserIcon.js +2 -0
- package/dist/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/components/InquiryDetailsStep.js +15 -0
- package/dist/components/PatientDetailsStep.d.ts +3 -0
- package/dist/components/PatientDetailsStep.js +84 -0
- package/dist/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/components/PhoneVerificationStep.js +49 -0
- package/dist/components/SuccessStep.d.ts +5 -0
- package/dist/components/SuccessStep.js +9 -0
- package/dist/components/custom-calendar.d.ts +5 -0
- package/dist/components/custom-calendar.js +171 -0
- package/dist/components/styles.d.ts +6 -0
- package/dist/components/styles.js +257 -0
- package/dist/components/theme-styles.d.ts +12 -0
- package/dist/components/theme-styles.js +319 -0
- package/dist/components/types.d.ts +181 -0
- package/dist/components/types.js +55 -0
- package/dist/components/ui/select.d.ts +10 -0
- package/dist/components/ui/select.js +21 -0
- package/dist/components/uiComponents/SelectDropdown.d.ts +41 -0
- package/dist/components/uiComponents/SelectDropdown.js +302 -0
- package/dist/components/utils.d.ts +5 -0
- package/dist/components/utils.js +15 -0
- package/dist/components/validation.d.ts +2 -0
- package/dist/components/validation.js +7 -0
- package/dist/context/TemplateContext.d.ts +12 -0
- package/dist/context/TemplateContext.js +19 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +4 -0
- package/dist/core/theme/index.d.ts +3 -0
- package/dist/core/theme/index.js +3 -0
- package/dist/core/theme/themes.d.ts +8 -0
- package/dist/core/theme/themes.js +178 -0
- package/dist/core/theme/types.d.ts +106 -0
- package/dist/core/theme/types.js +1 -0
- package/dist/core/theme/utils.d.ts +8 -0
- package/dist/core/theme/utils.js +135 -0
- package/dist/enquiry-form/index.d.ts +4 -0
- package/dist/enquiry-form/index.js +4 -0
- package/dist/enquiry-form/provider.d.ts +3 -0
- package/dist/enquiry-form/provider.js +9 -0
- package/dist/enquiry-form/serialization.d.ts +4 -0
- package/dist/enquiry-form/serialization.js +57 -0
- package/dist/enquiry-form/types.d.ts +38 -0
- package/dist/enquiry-form/types.js +1 -0
- package/dist/enquiry-form/validation.d.ts +6 -0
- package/dist/enquiry-form/validation.js +21 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/dist/lib/templateUtils.d.ts +3 -0
- package/dist/lib/templateUtils.js +28 -0
- package/dist/react/ThemeProvider.d.ts +18 -0
- package/dist/react/ThemeProvider.js +45 -0
- package/dist/react/hooks/useTheme.d.ts +1 -0
- package/dist/react/hooks/useTheme.js +1 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +3 -0
- package/dist/services/AppointmentService.d.ts +4 -5
- package/dist/services/AppointmentService.js +12 -10
- package/dist/services/EnquiryService.d.ts +5 -0
- package/dist/services/EnquiryService.js +30 -0
- package/dist/templates/registry.d.ts +12 -0
- package/dist/templates/registry.js +58 -0
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +2 -34
- package/dist/vanilla/AppointmentCalendarWidget.js +264 -275
- package/dist/vanilla/EnquiryFormWidget.d.ts +35 -0
- package/dist/vanilla/EnquiryFormWidget.js +425 -0
- package/dist/vanilla/client/MedosClient.d.ts +3 -5
- package/dist/vanilla/components/AppointmentCalender.d.ts +1 -4
- package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +14 -0
- package/dist/vanilla/components/ConfigurableCard.d.ts +12 -0
- package/dist/vanilla/components/ContactInformationStep.d.ts +13 -0
- package/dist/vanilla/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/vanilla/components/DoctorSelectModal.d.ts +7 -0
- package/dist/vanilla/components/EnquiryForm.d.ts +7 -0
- package/dist/vanilla/components/Icons/Check.d.ts +6 -0
- package/dist/vanilla/components/Icons/ChevronDownIcon.d.ts +4 -0
- package/dist/vanilla/components/Icons/ChevronLeft.d.ts +3 -0
- package/dist/vanilla/components/Icons/ChevronRight.d.ts +3 -0
- package/dist/vanilla/components/Icons/ConfirmationCheck.d.ts +1 -0
- package/dist/vanilla/components/Icons/ConsultationType.d.ts +1 -0
- package/dist/vanilla/components/Icons/Date&TimeIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/MapIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/vanilla/components/Icons/UserIcon.d.ts +1 -0
- package/dist/vanilla/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/vanilla/components/PatientDetailsStep.d.ts +3 -0
- package/dist/vanilla/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/vanilla/components/SuccessStep.d.ts +5 -0
- package/dist/vanilla/components/custom-calendar.d.ts +5 -0
- package/dist/vanilla/components/styles.d.ts +6 -0
- package/dist/vanilla/components/theme-styles.d.ts +12 -0
- package/dist/vanilla/components/types.d.ts +181 -0
- package/dist/vanilla/components/ui/select.d.ts +10 -0
- package/dist/vanilla/components/uiComponents/SelectDropdown.d.ts +41 -0
- package/dist/vanilla/components/utils.d.ts +5 -0
- package/dist/vanilla/components/validation.d.ts +2 -0
- package/dist/vanilla/context/TemplateContext.d.ts +12 -0
- package/dist/vanilla/core/index.d.ts +4 -0
- package/dist/vanilla/core/theme/index.d.ts +3 -0
- package/dist/vanilla/core/theme/themes.d.ts +8 -0
- package/dist/vanilla/core/theme/types.d.ts +106 -0
- package/dist/vanilla/core/theme/utils.d.ts +8 -0
- package/dist/vanilla/enquiry-form/index.d.ts +4 -0
- package/dist/vanilla/enquiry-form/provider.d.ts +3 -0
- package/dist/vanilla/enquiry-form/serialization.d.ts +4 -0
- package/dist/vanilla/enquiry-form/types.d.ts +38 -0
- package/dist/vanilla/enquiry-form/validation.d.ts +6 -0
- package/dist/vanilla/enquiry-widget.js +4650 -0
- package/dist/vanilla/index.d.ts +9 -0
- package/dist/vanilla/index.js +3 -1
- package/dist/vanilla/lib/templateUtils.d.ts +3 -0
- package/dist/vanilla/react/ThemeProvider.d.ts +18 -0
- package/dist/vanilla/react/hooks/useTheme.d.ts +1 -0
- package/dist/vanilla/react/index.d.ts +5 -0
- package/dist/vanilla/services/AppointmentService.d.ts +4 -5
- package/dist/vanilla/services/EnquiryService.d.ts +5 -0
- package/dist/vanilla/templates/alternative.css +13 -0
- package/dist/vanilla/templates/default.css +13 -0
- package/dist/vanilla/templates/registry.d.ts +12 -0
- package/dist/vanilla/theme-injector.d.ts +6 -0
- package/dist/vanilla/theme-injector.js +44 -0
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +2 -34
- package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +35 -0
- package/dist/vanilla/vanilla/index.d.ts +3 -1
- package/dist/vanilla/vanilla/theme-injector.d.ts +6 -0
- package/dist/vanilla/vanilla/widget.d.ts +6 -1
- package/dist/vanilla/widget.css +173 -0
- package/dist/vanilla/widget.d.ts +6 -1
- package/dist/vanilla/widget.js +813 -288
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -2,12 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
A JavaScript/TypeScript SDK for integrating healthcare appointment booking into your applications. Built for clinics, hospitals, and healthcare platforms.
|
|
4
4
|
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Powerful Theming System** - Customize appearance with built-in themes or create your own
|
|
8
|
+
- ⚛️ **React & Vanilla JS** - Works with React or pure JavaScript
|
|
9
|
+
- 🔒 **Secure Authentication** - API key and session token support
|
|
10
|
+
- 📱 **Responsive Design** - Mobile-first, works on all screen sizes
|
|
11
|
+
- 🎯 **TypeScript-First** - Full type safety and IntelliSense support
|
|
12
|
+
- ♿ **Accessible** - WCAG compliant components
|
|
13
|
+
|
|
5
14
|
## Installation
|
|
6
15
|
|
|
7
16
|
```bash
|
|
8
17
|
npm install medos-sdk
|
|
9
18
|
```
|
|
10
19
|
|
|
20
|
+
## Quick Start with Theming
|
|
21
|
+
|
|
22
|
+
### React
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { MedosThemeProvider, AppointmentCalender } from "medos-sdk/react";
|
|
26
|
+
|
|
27
|
+
function App() {
|
|
28
|
+
return (
|
|
29
|
+
<MedosThemeProvider theme="modern">
|
|
30
|
+
<AppointmentCalender onError={(err) => console.error(err)} />
|
|
31
|
+
</MedosThemeProvider>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Vanilla JavaScript
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import { initAppointmentCalendar } from "medos-sdk/vanilla";
|
|
40
|
+
|
|
41
|
+
initAppointmentCalendar({
|
|
42
|
+
containerId: "appointment-widget",
|
|
43
|
+
apiKey: "your-api-key",
|
|
44
|
+
theme: "modern", // or 'default'
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**📚 [Complete Theming Guide](./docs/THEMING.md)** - Learn about custom themes, color tokens, and advanced customization
|
|
49
|
+
|
|
11
50
|
## Getting Started
|
|
12
51
|
|
|
13
52
|
### Authentication
|
|
@@ -3,11 +3,9 @@ import { AddressesResponse } from "../services/AppointmentService";
|
|
|
3
3
|
import { SendPhoneVerificationOtpPayload, VerifyPhoneVerificationOtpPayload } from "../services/PatientService";
|
|
4
4
|
interface MedosClientConfig {
|
|
5
5
|
apiKey: string;
|
|
6
|
-
baseURL?: string;
|
|
7
6
|
}
|
|
8
7
|
interface MedosClientSessionConfig {
|
|
9
8
|
sessionToken: string;
|
|
10
|
-
baseURL?: string;
|
|
11
9
|
}
|
|
12
10
|
declare class MedosClient {
|
|
13
11
|
private static instance;
|
|
@@ -16,11 +14,11 @@ declare class MedosClient {
|
|
|
16
14
|
private static isRefreshing;
|
|
17
15
|
private static pendingRequests;
|
|
18
16
|
private static initPromise;
|
|
19
|
-
static init({ apiKey
|
|
20
|
-
static initWithSession({ sessionToken
|
|
17
|
+
static init({ apiKey }: MedosClientConfig): Promise<void>;
|
|
18
|
+
static initWithSession({ sessionToken }: MedosClientSessionConfig): Promise<void>;
|
|
21
19
|
private static initializeAxiosInstance;
|
|
22
20
|
static fetchAllAddressesAndDoctors(): Promise<AddressesResponse>;
|
|
23
|
-
static fetchAppointments(workspaceId:
|
|
21
|
+
static fetchAppointments(workspaceId: number, addressId: number, doctorId: number, appointmentDate: string): Promise<any[]>;
|
|
24
22
|
static sendPhoneVerificationOtp(payload: SendPhoneVerificationOtpPayload): Promise<any>;
|
|
25
23
|
static verifyPhoneVerificationOtp(payload: VerifyPhoneVerificationOtpPayload): Promise<any>;
|
|
26
24
|
static get client(): AxiosInstance;
|
|
@@ -3,7 +3,7 @@ import { AuthService } from "../services/AuthService";
|
|
|
3
3
|
import { AppointmentService, } from "../services/AppointmentService";
|
|
4
4
|
import { PatientService, } from "../services/PatientService";
|
|
5
5
|
class MedosClient {
|
|
6
|
-
static async init({ apiKey
|
|
6
|
+
static async init({ apiKey }) {
|
|
7
7
|
if (!apiKey) {
|
|
8
8
|
throw new Error("MedosClient.init() requires 'apiKey'");
|
|
9
9
|
}
|
|
@@ -13,7 +13,7 @@ class MedosClient {
|
|
|
13
13
|
this.initPromise = (async () => {
|
|
14
14
|
try {
|
|
15
15
|
const sessionToken = await AuthService.init(apiKey);
|
|
16
|
-
this.initializeAxiosInstance(sessionToken,
|
|
16
|
+
this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
|
|
17
17
|
}
|
|
18
18
|
catch (e) {
|
|
19
19
|
this.initPromise = null;
|
|
@@ -22,7 +22,7 @@ class MedosClient {
|
|
|
22
22
|
})();
|
|
23
23
|
return this.initPromise;
|
|
24
24
|
}
|
|
25
|
-
static async initWithSession({ sessionToken
|
|
25
|
+
static async initWithSession({ sessionToken }) {
|
|
26
26
|
if (!sessionToken) {
|
|
27
27
|
throw new Error("MedosClient.initWithSession() requires 'sessionToken'");
|
|
28
28
|
}
|
|
@@ -31,7 +31,7 @@ class MedosClient {
|
|
|
31
31
|
}
|
|
32
32
|
this.initPromise = (async () => {
|
|
33
33
|
try {
|
|
34
|
-
this.initializeAxiosInstance(sessionToken,
|
|
34
|
+
this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
37
|
this.initPromise = null;
|