diff --git a/.DS_Store b/.DS_Store
index a16219e6..74b86ac8 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/SDKs/web-sdk/abha-sdk/abha-consent.mdx b/SDKs/web-sdk/abha-sdk/abha-consent.mdx
new file mode 100644
index 00000000..4ff81ff4
--- /dev/null
+++ b/SDKs/web-sdk/abha-sdk/abha-consent.mdx
@@ -0,0 +1,351 @@
+---
+title: ABHA Consent Management
+description: "Complete implementation guide for the ABHA SDK to be used for ABHA Consent Management Flow."
+---
+
+
+# ABHA SDK - Consent Management Implementation
+
+This guide provides everything you need to integrate the ABHA SDK into your application for ABHA Consent Management.
+- **ABHA Consent Management**: Manage Consent requests raised by healthcare providers to share medical records securely.
+
+### Implementation Example
+
+Add the following HTML and script tags to your webpage:
+
+```html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+## Core Functions
+
+### 1. initAbhaApp
+
+Initializes and renders the ABHA SDK in your specified container.
+
+**Parameters:**
+
+| Name | Type | Required | Description |
+| ------------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
+| `containerId` | `string` | ✅ | The HTML element ID where the SDK will mount. |
+| `clientId` | `string` | ✅ | Provide clientId as `ext`. |
+| `data` | `{` `identifier: string;` `identifier_type: string;` `consent_id: string;` `flow: string;` `orgIcon?: string;` `linkToOrgIcon?: string;` `}` | ⚙️ Optional | Configuration data for initializing the ABHA flow. - identifier: Pass the identifier value i.e. phr address to get it kyced. - identifier_type: Pass the type of identifier which you passed in `identifier` key i.e. "phr_address". - consent_id: Pass the consent_id of the consent request raised. - flow: Pass the type of flow for which you want to use SDK for i.e. `consent` for Consent flow. - orgIcon: Public CDN URL of your organisation's icon to display inside the SDK url should start with https://. [Example](https://cdn.eka.care/vagus/cl56w6zg3001f0scsaqrh16is.jpg) - linkToOrgIcon: Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp)
`keys with ? are optional.` |
+| `onConsentSuccess` | `(params: TOnAbhaConsentSuccessParams) => void` | ✅ | Triggered when the consent flow completes successfully.
+| `onError` | `(params: TOnAbhaFailureParams) => void` | ✅ | Triggered when an error occurs during the ABHA flow.
+| `onAbhaClose` | `() => void` | ✅ | Triggered when SDK closes. |
+
+**Example:**
+
+```javascript
+window.initAbhaApp({
+ containerId: "sdk_container",
+ data: {
+ accessToken: "your_access_token_here",
+ identifier: "phr_address_of_the_patient"
+ identifier_type: "phr_address"
+ consent_id: "id_of_the_consent_raised_by_healthcare_provider"
+ flow: "consent"
+ orgIcon: "url_of_your_org_icon",
+ linkToOrgIcon: "url_of_image_to_link_abha_to_your_org",
+ },
+ onConsentSuccess: (params) => {
+ console.log("ABHA consent flow completed successfully!", params);
+ },
+ onError: (error) => {
+ console.error("ABHA flow failed:", error);
+ },
+ onAbhaClose: (error) => {
+ console.error("ABHA SDK closed");
+ },
+});
+```
+
+## Callback Parameters
+
+
+### onConsentSuccess Callback
+
+The onConsentSuccess callback is triggered when the ABHA Consent flow completes successfully.
+It returns a confirmation message indicating that the Consent flow ended successfully.
+
+**Callback Signature:**
+
+```typescript
+onConsentSuccess: (params: TOnAbhaConsentSuccessParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaConsentSuccessParams = string;
+```
+
+**Parameters**
+| | Type | Description |
+| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
+| `TOnAbhaConsentSuccessParams` | `string` | A confirmation message from SDK post Consent flow completion |
+
+
+
+**Example:**
+
+```javascript
+const onConsentSuccess = (params) => {
+ console.log("Consent Flow completed:", params);
+
+ alert("Consent flow completed successfully!");
+
+ // Optionally pass data to native bridge if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaConsentSuccess(params);
+ }
+};
+```
+
+### onError Callback
+The onError callback is triggered whenever an ABHA flow fails or is interrupted.
+It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools).
+
+**Callback Signature:**
+
+```typescript
+onError: (params: TOnAbhaFailureParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaFailureParams = {
+ error?: string;
+ response?: TAuthVerifyV2Response;
+};
+
+type TAuthVerifyV2Response = {
+ skip_state: number;
+ method: AUTH_METHOD;
+ data?: {
+ tokens: {
+ sess: string;
+ refresh: string;
+ };
+ profile: TProfileRecord;
+ };
+ txn_id: string;
+ error?: {
+ code: number;
+ message: string;
+ };
+};
+
+enum AUTH_METHOD {
+ EMAIL = 1,
+ MOBILE = 2,
+ ABHA = 7,
+}
+
+type TProfileRecord = {
+ fln: string;
+ fn: string;
+ mn?: string;
+ ln?: string;
+ gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown'
+ dob?: string;
+ mobile?: string;
+ email?: string;
+ uuid?: string;
+ bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-";
+ pic?: string;
+ as?: string;
+ "dob-valid"?: boolean;
+ "is-d"?: boolean;
+ "is-d-s"?: boolean;
+ "is-p"?: boolean;
+ oid: string;
+ at: string;
+ type?: 1 | 2 | 3 | 4 | 5 | 6;
+ "health-ids"?: Array;
+ abha_number?: string;
+ kyc_verified?: boolean;
+};
+
+```
+
+**Parameters**
+| Key | Type | Description |
+| ---------- | ------------------------ | ---------------------------------------------------------------- |
+| `error` | `string?` | Short description of the failure or error message. |
+| `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. |
+
+
+**Example:**
+
+```javascript
+const onError = (params) => {
+ console.error("ABHA Error:", params);
+
+ if (params.response?.error?.code === 1001) {
+ alert("Authentication failed. Please try again.");
+ } else if (params.error === "NETWORK_ERROR") {
+ alert("Please check your internet connection.");
+ } else {
+ alert("Something went wrong. Please retry.");
+ }
+
+ // Forward the error to native handler if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+ }
+};
+```
+
+### onAbhaClose Callback
+
+The onAbhaClose callback is triggered when the ABHA SDK flow gets closed.
+
+**Callback Signature:**
+
+```typescript
+onAbhaClose: () => void;
+```
+
+**Example:**
+
+```javascript
+const onAbhaClose = () => {
+ console.log("ABHA SDK Closed");
+};
+```
+
+**Suggest Handling**
+-Always log the full error response (params) for debugging.
+-Display friendly error messages for known error.code values.
+-If params.response is present, inspect response.error.message for more detail.
+-If integrating with native apps, forward the serialized error object:
+```javascript
+window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+```
+
+**Suggest Handling**
+-Always log the full error response (params) for debugging.
+-Display friendly error messages for known error.code values.
+-If params.response is present, inspect response.error.message for more detail.
+-If integrating with native apps, forward the serialized error object:
+```javascript
+window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+```
+
+## Container Styling
+Ensure your container has sufficient space:
+```html
+
+```
+
+## Troubleshooting
+
+### Common Issues
+
+#### 1. SDK Not Rendering
+
+**Problem**: Nothing appears in the container.
+
+**Solution**:
+- Ensure containerId matches an existing HTML element.
+- Verify the SDK JS and CSS are correctly loaded.
+- Check browser console for errors.
+
+#### 2. APIs Not Being Called
+
+**Problem**: API requests are not triggered after the SDK is mounted.
+
+**Solution**:
+- Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired.
+- To prevent CORS-related issues, ensure that your domain is whitelisted.
+
+#### 3. Callback Not Triggered
+
+**Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing.
+
+**Solution**:
+- Make sure callbacks are passed as valid functions.
+- Avoid race conditions (e.g., calling before SDK fully loads).
+
+#### 4. Styling Issues
+
+**Problem**: SDK content appears misaligned or clipped.
+
+**Solution**:
+- Give your container a fixed height (e.g., 600px).
+- Ensure no parent element uses overflow: hidden.
+
diff --git a/SDKs/web-sdk/abha-sdk/abha-kyc.mdx b/SDKs/web-sdk/abha-sdk/abha-kyc.mdx
new file mode 100644
index 00000000..a9540e39
--- /dev/null
+++ b/SDKs/web-sdk/abha-sdk/abha-kyc.mdx
@@ -0,0 +1,349 @@
+---
+title: ABHA Profile KYC
+description: "Complete implementation guide for the ABHA SDK to be used for ABHA KYC Verification Flow."
+---
+
+# ABHA SDK - Profile KYC Implementation
+
+This guide provides everything you need to integrate the ABHA SDK into your application for ABHA Profile KYC Verification.
+- **ABHA Profile KYC**: Get your ABHA address KYC verified.
+
+### Implementation Example
+
+Add the following HTML and script tags to your webpage:
+
+```html
+
+
+
+ ABHA SDK Integration for ABHA Profile KYC
+
+
+
+
+
+
ABHA SDK Demo
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+## Core Functions
+
+### 1. initAbhaApp
+
+Initializes and renders the ABHA SDK in your specified container.
+
+**Parameters:**
+
+| Name | Type | Required | Description |
+| ------------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
+| `containerId` | `string` | ✅ | The HTML element ID where the SDK will mount. |
+| `clientId` | `string` | ✅ | Provide clientId as `ext`. |
+| `data` | `{` `accessToken: string;` `identifier: string;` `identifier_type: string;` `flow: string;` `orgIcon?: string;` `linkToOrgIcon?: string;` `}` | ⚙️ Optional | Configuration data for initializing the ABHA flow.
- accessToken: Pass the access token you have generated from [Connect Login ](https://developer.eka.care/api-reference/authorization/client-login) API without the word `Bearer`. - identifier: Pass the identifier value i.e. phr address to get it kyced. - identifier_type: Pass the type of identifier which you passed in `identifier` key i.e. "phr_address". - flow: Pass the type of flow for which you want to use SDK for i.e. `abha-kyc` for KYC flow. - orgIcon: Public CDN URL of your organisation's icon to display inside the SDK url should start with https://. [Example](https://cdn.eka.care/vagus/cl56w6zg3001f0scsaqrh16is.jpg) - linkToOrgIcon: Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp)
`keys with ? are optional.` |
+| `onKYCSuccess` | `(params: TOnAbhaKycSuccessParams) => void` | ✅ | Triggered when the user KYC verified successfully.
+| `onError` | `(params: TOnAbhaFailureParams) => void` | ✅ | Triggered when an error occurs during the ABHA flow.
+| `onAbhaClose` | `() => void` | ✅ | Triggered when SDK closes. |
+
+**Example:**
+
+```javascript
+window.initAbhaApp({
+ containerId: "sdk_container",
+ data: {
+ accessToken: "your_access_token_here",
+ identifier: "phr_address_of_the_patient_to_be_kyced"
+ identifier_type: "phr_address"
+ flow: "abha-kyc"
+ orgIcon: "url_of_your_org_icon",
+ linkToOrgIcon: "url_of_image_to_link_abha_to_your_org",
+ },
+ onKYCSuccess: (params) => {
+ console.log("ABHA KYC verification successful!", params);
+ },
+ onError: (error) => {
+ console.error("ABHA flow failed:", error);
+ },
+ onAbhaClose: (error) => {
+ console.error("ABHA SDK closed");
+ },
+});
+```
+
+## Callback Parameters
+
+
+### onKYCSuccess Callback
+
+The onKYCSuccess callback is triggered when the ABHA KYC flow completes successfully.
+It returns a confirmation message indicating that the KYC has been verified.
+
+**Callback Signature:**
+
+```typescript
+onKYCSuccess: (params: TOnAbhaKycSuccessParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaKycSuccess = string;
+```
+
+**Parameters**
+| | Type | Description |
+| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
+| `TOnAbhaKycSuccess` | `string` | A confirmation message from SDK post KYC verification |
+
+
+
+**Example:**
+
+```javascript
+const onKYCSuccess = (params) => {
+ console.log("KYC verification Success:", params);
+
+ alert("KYC was verified successfully!");
+
+ // Optionally pass data to native bridge if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaKYCSuccess(params);
+ }
+};
+```
+
+### onError Callback
+The onError callback is triggered whenever an ABHA flow fails or is interrupted.
+It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools).
+
+**Callback Signature:**
+
+```typescript
+onError: (params: TOnAbhaFailureParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaFailureParams = {
+ error?: string;
+ response?: TAuthVerifyV2Response;
+};
+
+type TAuthVerifyV2Response = {
+ skip_state: number;
+ method: AUTH_METHOD;
+ data?: {
+ tokens: {
+ sess: string;
+ refresh: string;
+ };
+ profile: TProfileRecord;
+ };
+ txn_id: string;
+ error?: {
+ code: number;
+ message: string;
+ };
+};
+
+enum AUTH_METHOD {
+ EMAIL = 1,
+ MOBILE = 2,
+ ABHA = 7,
+}
+
+type TProfileRecord = {
+ fln: string;
+ fn: string;
+ mn?: string;
+ ln?: string;
+ gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown'
+ dob?: string;
+ mobile?: string;
+ email?: string;
+ uuid?: string;
+ bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-";
+ pic?: string;
+ as?: string;
+ "dob-valid"?: boolean;
+ "is-d"?: boolean;
+ "is-d-s"?: boolean;
+ "is-p"?: boolean;
+ oid: string;
+ at: string;
+ type?: 1 | 2 | 3 | 4 | 5 | 6;
+ "health-ids"?: Array;
+ abha_number?: string;
+ kyc_verified?: boolean;
+};
+
+```
+
+**Parameters**
+| Key | Type | Description |
+| ---------- | ------------------------ | ---------------------------------------------------------------- |
+| `error` | `string?` | Short description of the failure or error message. |
+| `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. |
+
+
+**Example:**
+
+```javascript
+const onError = (params) => {
+ console.error("ABHA Error:", params);
+
+ if (params.response?.error?.code === 1001) {
+ alert("Authentication failed. Please try again.");
+ } else if (params.error === "NETWORK_ERROR") {
+ alert("Please check your internet connection.");
+ } else {
+ alert("Something went wrong. Please retry.");
+ }
+
+ // Forward the error to native handler if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+ }
+};
+```
+
+### onAbhaClose Callback
+
+The onAbhaClose callback is triggered when the ABHA SDK flow gets closed.
+
+**Callback Signature:**
+
+```typescript
+onAbhaClose: () => void;
+```
+
+**Example:**
+
+```javascript
+const onAbhaClose = () => {
+ console.log("ABHA SDK Closed");
+};
+```
+
+**Suggest Handling**
+-Always log the full error response (params) for debugging.
+-Display friendly error messages for known error.code values.
+-If params.response is present, inspect response.error.message for more detail.
+-If integrating with native apps, forward the serialized error object:
+```javascript
+window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+```
+
+**Suggest Handling**
+-Always log the full error response (params) for debugging.
+-Display friendly error messages for known error.code values.
+-If params.response is present, inspect response.error.message for more detail.
+-If integrating with native apps, forward the serialized error object:
+```javascript
+window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+```
+
+## Container Styling
+Ensure your container has sufficient space:
+```html
+
+```
+
+## Troubleshooting
+
+### Common Issues
+
+#### 1. SDK Not Rendering
+
+**Problem**: Nothing appears in the container.
+
+**Solution**:
+- Ensure containerId matches an existing HTML element.
+- Verify the SDK JS and CSS are correctly loaded.
+- Check browser console for errors.
+
+#### 2. APIs Not Being Called
+
+**Problem**: API requests are not triggered after the SDK is mounted.
+
+**Solution**:
+- Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired.
+- To prevent CORS-related issues, ensure that your domain is whitelisted.
+
+#### 3. Callback Not Triggered
+
+**Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing.
+
+**Solution**:
+- Make sure callbacks are passed as valid functions.
+- Avoid race conditions (e.g., calling before SDK fully loads).
+
+#### 4. Styling Issues
+
+**Problem**: SDK content appears misaligned or clipped.
+
+**Solution**:
+- Give your container a fixed height (e.g., 600px).
+- Ensure no parent element uses overflow: hidden.
+
diff --git a/SDKs/web-sdk/abha-sdk.mdx b/SDKs/web-sdk/abha-sdk/abha-login-create.mdx
similarity index 58%
rename from SDKs/web-sdk/abha-sdk.mdx
rename to SDKs/web-sdk/abha-sdk/abha-login-create.mdx
index 824f4396..39a3ac7d 100644
--- a/SDKs/web-sdk/abha-sdk.mdx
+++ b/SDKs/web-sdk/abha-sdk/abha-login-create.mdx
@@ -1,29 +1,16 @@
---
-title: ABHA SDK
-description: "Complete implementation guide for the ABHA[Ayushman Bharat Digital Mission] SDK"
+title: ABHA Registration
+description: "Complete implementation guide for the ABHA SDK to be used for ABHA Login or Create."
---
-# ABHA SDK Implementation
+# ABHA SDK Login or Create
-This guide provides everything you need to integrate the ABHA SDK into your application.
+This guide provides everything you need to integrate the ABHA SDK into your application for Create ABHA, Login with ABHA flows into your healthcare applications. It provides:
-## Overview
+- **Create ABHA**: Create a new ABHA using Mobile or Aadhaar.
+- **Login with ABHA**: Login to your exisiting ABHA using PHR Address, ABHA number, Aadhaar number or Mobile number.
-The ABHA SDK allows you to integrate Create ABHA, Login with ABHA flows into your healthcare applications. It provides:
-
-- **Create ABHA**: Create a new ABHA using Mobile or Aadhaar
-- **Login with ABHA**: Login with ABHA address[PHR Address], ABHA number, Adhaar number or Mobile number linked to your ABHA into your healthcare application.
-
-## Installation
-
-### Prerequisites
-
-- A modern web browser.
-- Your domain must be whitelisted with Eka Care to avoid CORS(Cross-Origin Resource Sharing) error.
- (Contact Eka Care to request API access and domain whitelisting.)
-- A valid HTML container element where the SDK will mount.
-
-### Setup
+### Implementation Example
Add the following HTML and script tags to your webpage:
@@ -51,7 +38,6 @@ Add the following HTML and script tags to your webpage:
@@ -59,6 +45,7 @@ Add the following HTML and script tags to your webpage:
function mountABHASDK() {
window.initAbhaApp({
containerId: "sdk_container",
+ clientId: 'ext',
// Pass access token and oid
data: {
@@ -69,22 +56,29 @@ Add the following HTML and script tags to your webpage:
},
// Success callback
- onSuccess: async (params) => {
- console.log("ABHA flow completed successfully:", params);
+ onSuccess: (params) => {
+ console.log("ABHA Registration flow completed successfully:", params);
+
// Example: Store ABHA data in your app
- dispatch({
- type: "set-only-healthid-data",
- healthIdData: formatter(params.response.data),
- });
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaSuccess(JSON.stringify(params));
+ }
},
// Error callback
onError: (params) => {
- console.error("ABHA flow failed:", params);
+ console.error("ABHA SDK failed:", params);
+
+ // Example: Store ABHA data in your app
if (window.EkaAbha) {
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
}
},
+
+ // Abha Close callback
+ onAbhaClose: () => {
+ console.log("ABHA SDK closed");
+ },
});
}
@@ -102,9 +96,11 @@ Initializes and renders the ABHA SDK in your specified container.
| Name | Type | Required | Description |
| ------------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `containerId` | `string` | ✅ | The HTML element ID where the SDK will mount. |
-| `data` | `{ accessToken: string; oid?: string; orgIcon?: string; linkToOrgIcon?: string }` | ⚙️ Optional | Configuration data for initializing the ABHA flow. - accessToken: Pass the access token you have. - oid: Pass if available. - orgIcon: URL of your organisation's icon to display inside the SDK url should start with https://. - linkToOrgIcon: URL of the icon representing “Link ABHA to your organisation” url should start with https://. |
-| `onSuccess` | `(params: AbhaSuccessParams) => void` | ✅ | Triggered when the user successfully creates or logs in to ABHA. |
-| `onError` | `(params: AbhaErrorParams) => void` | ✅ | Triggered when an error occurs during the ABHA flow. |
+| `clientId` | `string` | ✅ | Provide clientId as `ext`. |
+| `data` | `{` `accessToken: string;` `orgIcon?: string;` `linkToOrgIcon?: string;` `}` | ⚙️ Optional | Configuration data for initializing the ABHA flow.
- accessToken: Pass the access token you have generated from [Connect Login ](https://developer.eka.care/api-reference/authorization/client-login) API without the word `Bearer`. - orgIcon: Public CDN URL of your organisation's icon to display inside the SDK url should start with https://. [Example](https://cdn.eka.care/vagus/cl56w6zg3001f0scsaqrh16is.jpg) - linkToOrgIcon: Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp)
-
-
-
-
-
-
-
-
-
-
-```
-
-## Type Definitions
-
-```typescript
-interface InitAbhaAppParams {
- containerId: string;
- data?: {
- accessToken: string;
- oid?: string;
- orgIcon?: string;
- linkToOrgIcon?: string;
- };
- onSuccess: (params: AbhaSuccessParams) => void;
- onError: (params: AbhaErrorParams) => void;
-}
-
-interface AbhaSuccessParams {
- response: {
- data: {
- abha_number?: string;
- abha_address?: string;
- name?: string;
- gender?: string;
- yearOfBirth?: string;
- mobile?: string;
- };
- };
- message: string;
- status: "SUCCESS";
-}
-
-interface AbhaErrorParams {
- status: "FAILED";
- message: string;
- error_code?: string;
- details?: any;
-}
-```
-
## Troubleshooting
### Common Issues
@@ -373,19 +373,26 @@ interface AbhaErrorParams {
- Verify the SDK JS and CSS are correctly loaded.
- Check browser console for errors.
-#### 2. Callback Not Triggered
+#### 2. APIs Not Being Called
+
+**Problem**: API requests are not triggered after the SDK is mounted.
+
+**Solution**:
+- Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired.
+- To prevent CORS-related issues, ensure that your domain is whitelisted.
+
+#### 3. Callback Not Triggered
-**Problem**: onSuccess or onError isn’t firing.
+**Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing.
**Solution**:
-- Make sure both callbacks are passed as valid functions.
+- Make sure callbacks are passed as valid functions.
- Avoid race conditions (e.g., calling before SDK fully loads).
-#### 3. Styling Issues
+#### 4. Styling Issues
**Problem**: SDK content appears misaligned or clipped.
**Solution**:
- Give your container a fixed height (e.g., 600px).
-- Ensure no parent element uses overflow: hidden.
-
+- Ensure no parent element uses overflow: hidden.
\ No newline at end of file
diff --git a/SDKs/web-sdk/abha-sdk/get-started.mdx b/SDKs/web-sdk/abha-sdk/get-started.mdx
new file mode 100644
index 00000000..704f73fb
--- /dev/null
+++ b/SDKs/web-sdk/abha-sdk/get-started.mdx
@@ -0,0 +1,461 @@
+---
+title: Get Started
+description: "Complete implementation guide for the ABHA[Ayushman Bharat Digital Mission] SDK"
+---
+
+# ABHA SDK Implementation
+
+This guide provides everything you need to integrate the ABHA SDK into your application.
+
+## Overview
+
+The ABHA SDK allows you to integrate Create ABHA, Login with ABHA, ABHA Consent Management, ABHA Profile KYC flows into your healthcare applications. It provides:
+
+- **Create ABHA**: Create a new ABHA using Mobile or Aadhaar.
+- **Login with ABHA**: Login to your exisiting ABHA using PHR Address, ABHA number, Aadhaar number or Mobile number.
+- **ABHA Consent Management**: Manage Consent requests raised by healthcare providers to share medical records securely.
+- **ABHA Profile KYC**: Get your ABHA address KYC verified.
+
+## Installation
+
+### Prerequisites
+
+- A modern web browser.
+- Your domain must be whitelisted with Eka Care to avoid CORS(Cross-Origin Resource Sharing) error.
+ (Contact Eka Care to request API access and domain whitelisting.)
+- A valid HTML container element where the SDK will mount.
+
+### Setup
+
+Add the following HTML and script tags to your webpage:
+
+```html
+
+
+
+ ABHA SDK Integration
+
+
+
+
+
+
ABHA SDK Demo
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+## Core Functions
+
+### 1. initAbhaApp
+
+Initializes and renders the ABHA SDK in your specified container.
+
+**Parameters:**
+
+| Name | Type | Required | Description |
+| ------------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
+| `containerId` | `string` | ✅ | The HTML element ID where the SDK will mount. |
+| `clientId` | `string` | ✅ | Provide clientId as `ext`. |
+| `data` | `{` `accessToken: string;` `oid?: string;` `identifier?: string;` `identifier_type?: string;` `consent_id?: string;` `flow?: string;` `orgIcon?: string;` `linkToOrgIcon?: string;` `}` | ⚙️ Optional | Configuration data for initializing the ABHA flow.
- accessToken: Pass the access token you have generated from [Connect Login ](https://developer.eka.care/api-reference/authorization/client-login) API without the word `Bearer`. - oid: Pass oid of patient if available / needed in the flow. - identifier: Pass the login identifier value i.e. mobile number / aadhaar number / phr address / abha number. - identifier_type: Pass the type of identifier which you passed in `identifier` key i.e. "mobile" / "aadhaar_number" / "phr_address" / "abha_number" /. If not known pass undefined. - consent_id: Pass the consent_id of the consent request raised. - flow: Pass the type of flow for which you want to use SDK for i.e. `abha-kyc` for KYC flow / `consent` for Consent flow. - orgIcon: Public CDN URL of your organisation's icon to display inside the SDK url should start with https://. [Example](https://cdn.eka.care/vagus/cl56w6zg3001f0scsaqrh16is.jpg) - linkToOrgIcon: Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp)
`keys with ? are optional and needs to be passed as per flow requirement.` |
+| `onSuccess` | `(params: TOnAbhaSuccessParams) => void` | ✅ | Triggered when the user successfully creates or logs in to ABHA. |
+| `onKYCSuccess` | `(params: TOnAbhaKycSuccessParams) => void` | ⚙️ Optional | Triggered when the user KYC verified successfully.
+| `onConsentSuccess` | `(params: TOnAbhaConsentSuccessParams) => void` | ⚙️ Optional | Triggered when the consent flow completes successfully.
+| `onError` | `(params: TOnAbhaFailureParams) => void` | ✅ | Triggered when an error occurs during the ABHA flow.
+| `onAbhaClose` | `() => void` | ✅ | Triggered when SDK closes. |
+
+
+## Callback Parameters
+
+### onSuccess Callback
+
+The onSuccess callback is triggered when the ABHA flow completes successfully.
+It returns verified user details and tokens, which can be used to log in or continue the user’s session.
+
+**Callback Signature:**
+
+```typescript
+onSuccess: (params: TOnAbhaSuccessParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaSuccessParams = {
+ response: TAuthVerifyV2Response;
+};
+
+type TAuthVerifyV2Response = {
+ skip_state: number;
+ method: AUTH_METHOD;
+ data?: {
+ tokens: {
+ sess: string;
+ refresh: string;
+ };
+ profile: TProfileRecord;
+ };
+ txn_id: string;
+ error?: {
+ code: number;
+ message: string;
+ };
+};
+
+enum AUTH_METHOD {
+ EMAIL = 1,
+ MOBILE = 2,
+ ABHA = 7,
+}
+
+type TProfileRecord = {
+ fln: string;
+ fn: string;
+ mn?: string;
+ ln?: string;
+ gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown'
+ dob?: string;
+ mobile?: string;
+ email?: string;
+ uuid?: string;
+ bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-";
+ pic?: string;
+ as?: string;
+ "dob-valid"?: boolean;
+ "is-d"?: boolean;
+ "is-d-s"?: boolean;
+ "is-p"?: boolean;
+ oid: string;
+ at: string;
+ type?: 1 | 2 | 3 | 4 | 5 | 6;
+ "health-ids"?: Array;
+ abha_number?: string;
+ kyc_verified?: boolean;
+};
+
+```
+
+**Parameters**
+| Key | Type | Description |
+| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
+| `response` | `TAuthVerifyV2Response` | The complete ABHA verification response, containing session tokens, user profile, and transaction details. |
+
+
+
+**Example:**
+
+```javascript
+const onSuccess = (params) => {
+ console.log("ABHA Success:", params.response);
+
+ const abhaNumber = params.response.data?.profile?.abha_number;
+ const userName = params.response.data?.profile?.name;
+
+ alert(`Welcome ${userName}! Your ABHA Number: ${abhaNumber}`);
+
+ // Optionally pass data to native bridge if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaSuccess(JSON.stringify(params));
+ }
+};
+```
+
+### onKYCSuccess Callback
+
+The onKYCSuccess callback is triggered when the ABHA KYC flow completes successfully.
+It returns a confirmation message indicating that the KYC has been verified.
+
+**Callback Signature:**
+
+```typescript
+onKYCSuccess: (params: TOnAbhaKycSuccessParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaKycSuccess = string;
+```
+
+**Parameters**
+| | Type | Description |
+| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
+| `TOnAbhaKycSuccess` | `string` | A confirmation message from SDK post KYC verification |
+
+
+
+**Example:**
+
+```javascript
+const onKYCSuccess = (params) => {
+ console.log("KYC verification Success:", params);
+
+ alert("KYC was verified successfully!");
+
+ // Optionally pass data to native bridge if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaKYCSuccess(params);
+ }
+};
+```
+
+### onConsentSuccess Callback
+
+The onConsentSuccess callback is triggered when the ABHA Consent flow completes successfully.
+It returns a confirmation message indicating that the Consent flow ended successfully.
+
+**Callback Signature:**
+
+```typescript
+onConsentSuccess: (params: TOnAbhaConsentSuccessParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaConsentSuccessParams = string;
+```
+
+**Parameters**
+| | Type | Description |
+| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
+| `TOnAbhaConsentSuccessParams` | `string` | A confirmation message from SDK post Consent flow completion |
+
+
+
+**Example:**
+
+```javascript
+const onConsentSuccess = (params) => {
+ console.log("Consent Flow completed:", params);
+
+ alert("Consent flow completed successfully!");
+
+ // Optionally pass data to native bridge if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaConsentSuccess(params);
+ }
+};
+```
+
+### onError Callback
+The onError callback is triggered whenever an ABHA flow fails or is interrupted.
+It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools).
+
+**Callback Signature:**
+
+```typescript
+onError: (params: TOnAbhaFailureParams) => void;
+```
+
+**Type Definitions**
+
+```typescript
+type TOnAbhaFailureParams = {
+ error?: string;
+ response?: TAuthVerifyV2Response;
+};
+
+type TAuthVerifyV2Response = {
+ skip_state: number;
+ method: AUTH_METHOD;
+ data?: {
+ tokens: {
+ sess: string;
+ refresh: string;
+ };
+ profile: TProfileRecord;
+ };
+ txn_id: string;
+ error?: {
+ code: number;
+ message: string;
+ };
+};
+
+enum AUTH_METHOD {
+ EMAIL = 1,
+ MOBILE = 2,
+ ABHA = 7,
+}
+
+type TProfileRecord = {
+ fln: string;
+ fn: string;
+ mn?: string;
+ ln?: string;
+ gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown'
+ dob?: string;
+ mobile?: string;
+ email?: string;
+ uuid?: string;
+ bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-";
+ pic?: string;
+ as?: string;
+ "dob-valid"?: boolean;
+ "is-d"?: boolean;
+ "is-d-s"?: boolean;
+ "is-p"?: boolean;
+ oid: string;
+ at: string;
+ type?: 1 | 2 | 3 | 4 | 5 | 6;
+ "health-ids"?: Array;
+ abha_number?: string;
+ kyc_verified?: boolean;
+};
+
+```
+
+**Parameters**
+| Key | Type | Description |
+| ---------- | ------------------------ | ---------------------------------------------------------------- |
+| `error` | `string?` | Short description of the failure or error message. |
+| `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. |
+
+
+**Example:**
+
+```javascript
+const onError = (params) => {
+ console.error("ABHA Error:", params);
+
+ if (params.response?.error?.code === 1001) {
+ alert("Authentication failed. Please try again.");
+ } else if (params.error === "NETWORK_ERROR") {
+ alert("Please check your internet connection.");
+ } else {
+ alert("Something went wrong. Please retry.");
+ }
+
+ // Forward the error to native handler if available
+ if (window.EkaAbha) {
+ window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+ }
+};
+```
+
+### onAbhaClose Callback
+
+The onAbhaClose callback is triggered when the ABHA SDK flow gets closed.
+
+**Callback Signature:**
+
+```typescript
+onAbhaClose: () => void;
+```
+
+**Example:**
+
+```javascript
+const onAbhaClose = () => {
+ console.log("ABHA SDK Closed");
+};
+```
+
+**Suggest Handling**
+-Always log the full error response (params) for debugging.
+-Display friendly error messages for known error.code values.
+-If params.response is present, inspect response.error.message for more detail.
+-If integrating with native apps, forward the serialized error object:
+```javascript
+window.EkaAbha.onAbhaFailure(JSON.stringify(params));
+```
+
+## Container Styling
+Ensure your container has sufficient space:
+```html
+
+```
+
+## Troubleshooting
+
+### Common Issues
+
+#### 1. SDK Not Rendering
+
+**Problem**: Nothing appears in the container.
+
+**Solution**:
+- Ensure containerId matches an existing HTML element.
+- Verify the SDK JS and CSS are correctly loaded.
+- Check browser console for errors.
+
+#### 2. APIs Not Being Called
+
+**Problem**: API requests are not triggered after the SDK is mounted.
+
+**Solution**:
+- Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired.
+- To prevent CORS-related issues, ensure that your domain is whitelisted.
+
+#### 3. Callback Not Triggered
+
+**Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing.
+
+**Solution**:
+- Make sure callbacks are passed as valid functions.
+- Avoid race conditions (e.g., calling before SDK fully loads).
+
+#### 4. Styling Issues
+
+**Problem**: SDK content appears misaligned or clipped.
+
+**Solution**:
+- Give your container a fixed height (e.g., 600px).
+- Ensure no parent element uses overflow: hidden.
+
diff --git a/docs.json b/docs.json
index 7be9445d..d4993bd9 100644
--- a/docs.json
+++ b/docs.json
@@ -901,12 +901,20 @@
]
},
{
- "group": "Web SDK",
- "pages": [
- "SDKs/web-sdk/getting-started",
- "SDKs/web-sdk/self-assessment-sdk",
- "SDKs/web-sdk/abha-sdk"
- ]
+ "group": "Web SDK",
+ "pages": [
+ "SDKs/web-sdk/getting-started",
+ "SDKs/web-sdk/self-assessment-sdk",
+ {
+ "group": "ABHA SDK",
+ "pages": [
+ "SDKs/web-sdk/abha-sdk/get-started",
+ "SDKs/web-sdk/abha-sdk/abha-login-create",
+ "SDKs/web-sdk/abha-sdk/abha-consent",
+ "SDKs/web-sdk/abha-sdk/abha-kyc"
+ ]
+ }
+ ]
},
{
"group": "Backend",