medos-sdk 1.1.0 → 1.1.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.
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Medos SDK
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/medos-sdk.svg)](https://www.npmjs.com/package/medos-sdk)
4
+ [![License](https://img.shields.io/badge/license-UNLICENSED-red.svg)](LICENSE)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9%2B-blue.svg)](https://www.typescriptlang.org/)
6
+
3
7
  A JavaScript/TypeScript SDK for integrating healthcare appointment booking into your applications. Built for clinics, hospitals, and healthcare platforms.
4
8
 
5
9
  ## ✨ Features
@@ -17,7 +21,19 @@ A JavaScript/TypeScript SDK for integrating healthcare appointment booking into
17
21
  npm install medos-sdk
18
22
  ```
19
23
 
20
- ## Quick Start with Theming
24
+ ## Table of Contents
25
+
26
+ - [Quick Start](#quick-start)
27
+ - [Getting Started](#getting-started)
28
+ - [Usage](#usage)
29
+ - [React Integration](#react-integration)
30
+ - [Vanilla JavaScript](#vanilla-javascript--html-integration)
31
+ - [TypeScript](#typescript)
32
+ - [API Reference](#api-reference)
33
+ - [Error Handling](#error-handling)
34
+ - [Requirements](#requirements)
35
+
36
+ ## Quick Start
21
37
 
22
38
  ### React
23
39
 
@@ -45,7 +61,26 @@ initAppointmentCalendar({
45
61
  });
46
62
  ```
47
63
 
48
- **📚 [Complete Theming Guide](./docs/THEMING.md)** - Learn about custom themes, color tokens, and advanced customization
64
+ ### HTML/CSS/JS
65
+
66
+ ```html
67
+ <!DOCTYPE html>
68
+ <html>
69
+ <head>
70
+ <link rel="stylesheet" href="path/to/widget.css" />
71
+ </head>
72
+ <body>
73
+ <div id="appointment-calendar"></div>
74
+ <script src="path/to/widget.js"></script>
75
+ <script>
76
+ window.MedosAppointmentCalendar.init({
77
+ containerId: "appointment-calendar",
78
+ apiKey: "your-api-key",
79
+ });
80
+ </script>
81
+ </body>
82
+ </html>
83
+ ```
49
84
 
50
85
  ## Getting Started
51
86
 
@@ -371,7 +406,7 @@ For better security, obtain the session token server-side:
371
406
  window.MedosAppointmentCalendar.init({
372
407
  containerId: "appointment-calendar",
373
408
  sessionToken: "your-session-token", // Obtained from your server
374
- baseURL: "https://api-dev.medapi.in/v1",
409
+ baseURL: "https://api.medos.one/v1",
375
410
  onError: (err) => console.error(err),
376
411
  });
377
412
  </script>
@@ -411,7 +446,7 @@ $sessionToken = getSessionTokenFromBackend();
411
446
  - `containerId` (string, required) - ID of the HTML element where the widget will be rendered
412
447
  - `apiKey` (string, optional) - Your Medos API key (if not using sessionToken)
413
448
  - `sessionToken` (string, optional) - Session token obtained from your server (if not using apiKey)
414
- - `baseURL` (string, optional) - API base URL (defaults to `https://api-dev.medapi.in/v1`)
449
+ - `baseURL` (string, optional) - API base URL (defaults to `https://api.medos.one/v1`)
415
450
  - `onError` (function, optional) - Callback function for error handling
416
451
  - `onSuccess` (function, optional) - Callback function called when appointment is successfully booked
417
452
 
@@ -433,7 +468,7 @@ See `dist/vanilla/widget.css` for all available classes.
433
468
 
434
469
  ### Package Exports
435
470
 
436
- The SDK provides multiple entry points:
471
+ The SDK provides multiple entry points for different use cases:
437
472
 
438
473
  - `medos-sdk` - Default export (includes React components)
439
474
  - `medos-sdk/react` - React-specific exports
@@ -441,8 +476,6 @@ The SDK provides multiple entry points:
441
476
  - `medos-sdk/core` - Core services only (no framework dependencies)
442
477
  - `medos-sdk/widget` - Widget bundle with CSS
443
478
 
444
- For more details, see [Vanilla Widget Documentation](./docs/VANILLA_WIDGET.md).
445
-
446
479
  ## API Reference
447
480
 
448
481
  ### MedosClient
@@ -590,18 +623,18 @@ try {
590
623
  - **React:** v19 or higher (only required for React components, not for vanilla widget)
591
624
  - **TypeScript:** v5 or higher (optional)
592
625
 
593
- ## License
594
-
595
- UNLICENSED
596
-
597
626
  ## Support
598
627
 
599
628
  For bug reports and feature requests, please visit our [GitHub Issues](https://github.com/MediLaunch/medos-sdk-react/issues).
600
629
 
630
+ ## License
631
+
632
+ UNLICENSED
633
+
601
634
  ## Author
602
635
 
603
636
  Pooranjoy Bhattacharya
604
637
 
605
638
  ---
606
639
 
607
- _Built for healthcare providers worldwide._
640
+ **Built for healthcare providers worldwide.**
@@ -2,6 +2,7 @@ import axios from "axios";
2
2
  import { AuthService } from "../services/AuthService";
3
3
  import { AppointmentService, } from "../services/AppointmentService";
4
4
  import { PatientService, } from "../services/PatientService";
5
+ import { API_BASE_URL } from "../constants";
5
6
  class MedosClient {
6
7
  static async init({ apiKey }) {
7
8
  if (!apiKey) {
@@ -13,7 +14,7 @@ class MedosClient {
13
14
  this.initPromise = (async () => {
14
15
  try {
15
16
  const sessionToken = await AuthService.init(apiKey);
16
- this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
17
+ this.initializeAxiosInstance(sessionToken, API_BASE_URL);
17
18
  }
18
19
  catch (e) {
19
20
  this.initPromise = null;
@@ -31,7 +32,7 @@ class MedosClient {
31
32
  }
32
33
  this.initPromise = (async () => {
33
34
  try {
34
- this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
35
+ this.initializeAxiosInstance(sessionToken, API_BASE_URL);
35
36
  }
36
37
  catch (e) {
37
38
  this.initPromise = null;
@@ -0,0 +1 @@
1
+ export declare const API_BASE_URL = "https://api.medos.one";
@@ -0,0 +1 @@
1
+ export const API_BASE_URL = "https://api.medos.one";
@@ -1,9 +1,10 @@
1
1
  import axios from "axios";
2
+ import { API_BASE_URL } from "../constants";
2
3
  let sessionToken = null;
3
4
  const AuthService = {
4
5
  async init(apiKey) {
5
6
  try {
6
- const res = await axios.post(`https://api-dev.medapi.in/v1/auth/session?api_key=${apiKey}`, {});
7
+ const res = await axios.post(`${API_BASE_URL}/v1/auth/session?api_key=${apiKey}`, {});
7
8
  const token = res.data?.access_token;
8
9
  if (!token || typeof token !== "string") {
9
10
  throw new Error("Invalid session token response");
@@ -0,0 +1 @@
1
+ export declare const API_BASE_URL = "https://api.medos.one";
@@ -3847,11 +3847,13 @@
3847
3847
  mergeConfig
3848
3848
  } = axios;
3849
3849
 
3850
+ const API_BASE_URL = "https://api.medos.one";
3851
+
3850
3852
  let sessionToken = null;
3851
3853
  const AuthService = {
3852
3854
  async init(apiKey) {
3853
3855
  try {
3854
- const res = await axios.post(`https://api-dev.medapi.in/v1/auth/session?api_key=${apiKey}`, {});
3856
+ const res = await axios.post(`${API_BASE_URL}/v1/auth/session?api_key=${apiKey}`, {});
3855
3857
  const token = res.data?.access_token;
3856
3858
  if (!token || typeof token !== "string") {
3857
3859
  throw new Error("Invalid session token response");
@@ -4005,7 +4007,7 @@
4005
4007
  this.initPromise = (async () => {
4006
4008
  try {
4007
4009
  const sessionToken = await AuthService.init(apiKey);
4008
- this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
4010
+ this.initializeAxiosInstance(sessionToken, API_BASE_URL);
4009
4011
  }
4010
4012
  catch (e) {
4011
4013
  this.initPromise = null;
@@ -4023,7 +4025,7 @@
4023
4025
  }
4024
4026
  this.initPromise = (async () => {
4025
4027
  try {
4026
- this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
4028
+ this.initializeAxiosInstance(sessionToken, API_BASE_URL);
4027
4029
  }
4028
4030
  catch (e) {
4029
4031
  this.initPromise = null;
@@ -3847,11 +3847,13 @@
3847
3847
  mergeConfig
3848
3848
  } = axios;
3849
3849
 
3850
+ const API_BASE_URL = "https://api.medos.one";
3851
+
3850
3852
  let sessionToken = null;
3851
3853
  const AuthService = {
3852
3854
  async init(apiKey) {
3853
3855
  try {
3854
- const res = await axios.post(`https://api-dev.medapi.in/v1/auth/session?api_key=${apiKey}`, {});
3856
+ const res = await axios.post(`${API_BASE_URL}/v1/auth/session?api_key=${apiKey}`, {});
3855
3857
  const token = res.data?.access_token;
3856
3858
  if (!token || typeof token !== "string") {
3857
3859
  throw new Error("Invalid session token response");
@@ -3895,7 +3897,7 @@
3895
3897
  this.initPromise = (async () => {
3896
3898
  try {
3897
3899
  const sessionToken = await AuthService.init(apiKey);
3898
- this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
3900
+ this.initializeAxiosInstance(sessionToken, API_BASE_URL);
3899
3901
  }
3900
3902
  catch (e) {
3901
3903
  this.initPromise = null;
@@ -3913,7 +3915,7 @@
3913
3915
  }
3914
3916
  this.initPromise = (async () => {
3915
3917
  try {
3916
- this.initializeAxiosInstance(sessionToken, "https://api.medos.one");
3918
+ this.initializeAxiosInstance(sessionToken, API_BASE_URL);
3917
3919
  }
3918
3920
  catch (e) {
3919
3921
  this.initPromise = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medos-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Medos SDK for managing appointments, meetings, and calendars in apps",
5
5
  "homepage": "https://github.com/MediLaunch/medos-sdk-react#readme",
6
6
  "bugs": {
@@ -74,6 +74,17 @@
74
74
  "vitest": "^4.0.14"
75
75
  },
76
76
  "keywords": [
77
- "medos"
77
+ "medos",
78
+ "healthcare",
79
+ "appointment",
80
+ "booking",
81
+ "calendar",
82
+ "clinic",
83
+ "hospital",
84
+ "medical",
85
+ "react",
86
+ "typescript",
87
+ "sdk",
88
+ "widget"
78
89
  ]
79
90
  }