@eka-care/abha-stg 0.1.34 → 0.1.36
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/.turbo/daemon/7f0c6427972069cb-turbo.log.2025-11-12 +0 -0
- package/README.md +369 -101
- package/{dist/index.html → index.html} +1 -2
- package/package/styles/pds2/border.ts +69 -0
- package/package/styles/pds2/colors.ts +70 -0
- package/package/styles/pds2/spacing.ts +1007 -0
- package/package/tailwind/tailwind.config.ts +124 -0
- package/package.json +9 -8
- package/postcss.config.js +6 -0
- package/scripts/build-purged-css.cjs +70 -0
- package/src/App.css +0 -0
- package/src/App.tsx +43 -0
- package/src/api-queries/aorta-go/v3/get-profile-patient.ts +32 -0
- package/src/api-queries/aorta-go/v3/get-profiles-phr-user.ts +26 -0
- package/src/api-queries/aorta-go/v3/post-auth-init-v2.ts +34 -0
- package/src/api-queries/aorta-go/v3/post-auth-logout-v2.ts +32 -0
- package/src/api-queries/aorta-go/v3/post-auth-verify-v2.ts +38 -0
- package/src/api-queries/aorta-go/v3/post-profile-switch.ts +39 -0
- package/src/api-queries/ndhm/get-abdm-register-suggest.ts +37 -0
- package/src/api-queries/ndhm/get-pincode-details.ts +28 -0
- package/src/api-queries/ndhm/post-abdm-login-init.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-login-phr.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-login-verify.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-profile-eka-link-phr.ts +40 -0
- package/src/api-queries/ndhm/post-abdm-profile-eka.ts +66 -0
- package/src/api-queries/ndhm/post-abdm-register-abha-number-create-phr.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-register-mobile-create-phr.ts +66 -0
- package/src/api-queries/ndhm/post-abdm-register-mobile-resend-otp.ts +32 -0
- package/src/api-queries/ndhm/post-abdm-register-mobile-verify.ts +38 -0
- package/src/api-queries/ndhm/post-abdm-register-phr-check.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-create-phr.ts +37 -0
- package/src/api-queries/ndhm/post-register-aadhaar-init.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-mobile-resend-otp.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-mobile-verify.ts +37 -0
- package/src/api-queries/ndhm/post-register-aadhaar-resend-otp.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-verify.ts +40 -0
- package/src/api-queries/ndhm/post-register-mobile-init.ts +34 -0
- package/src/api-queries/use-get-profiles-patient.ts +12 -0
- package/src/api-queries/use-get-profiles-phr-user.ts +28 -0
- package/src/api-queries/use-post-abdm-login-verify-v1.ts +26 -0
- package/src/api-queries/use-post-auth-verify-v2.ts +50 -0
- package/src/api-queries/use-post-profile-switch.ts +58 -0
- package/src/api-queries/use-post-register-mobile-create-phr.ts +39 -0
- package/src/api-queries/user-post-abdm-profile-login-phr.ts +26 -0
- package/src/assets/Success.json +1 -0
- package/src/assets/react.svg +1 -0
- package/src/atoms/button/custom-button.tsx +32 -0
- package/src/atoms/button/index.tsx +40 -0
- package/src/atoms/button/types.d.ts +31 -0
- package/src/atoms/header.tsx +25 -0
- package/src/atoms/input-field/index.tsx +63 -0
- package/src/atoms/input-field/patient-input-field.tsx +16 -0
- package/src/atoms/input-field/types.ts +24 -0
- package/src/atoms/pds2-otp-input/index.tsx +35 -0
- package/src/atoms/pds2-otp-input/types.d.ts +3 -0
- package/src/atoms/single-input-chip/index.tsx +32 -0
- package/src/atoms/single-input-chip/types.ts +6 -0
- package/src/atoms/spinner.tsx +33 -0
- package/src/atoms/text-separator.tsx +11 -0
- package/src/atoms/ui/spinner.tsx +75 -0
- package/src/constants/constants.ts +376 -0
- package/src/fetch-client/index.ts +164 -0
- package/src/index.css +152 -0
- package/src/main.tsx +374 -0
- package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +40 -0
- package/src/molecules/abha/bottom-sheet/index.tsx +66 -0
- package/src/molecules/abha/spaced-input-component.tsx +168 -0
- package/src/molecules/copyright-year.tsx +16 -0
- package/src/molecules/exit-popup/index.tsx +101 -0
- package/src/molecules/pds2-otp-component/index.tsx +147 -0
- package/src/organisms/abha/abha-header.tsx +25 -0
- package/src/organisms/abha/abha-stepper.tsx +83 -0
- package/src/organisms/abha/error-bottom-sheet.tsx +27 -0
- package/src/organisms/abha/otp-card.tsx +99 -0
- package/src/organisms/abha/verification-status.tsx +30 -0
- package/src/organisms/choose-language/choose-language.tsx +53 -0
- package/src/organisms/choose-language/types.ts +10 -0
- package/src/organisms/screen-switcher/screen-switcher.tsx +80 -0
- package/src/routes/abha-aadhaar-verification-status-screen.tsx +246 -0
- package/src/routes/abha-created-screen.tsx +45 -0
- package/src/routes/abha-login-otp-verify-screen.tsx +519 -0
- package/src/routes/abha-mobile-linking-status-screen.tsx +267 -0
- package/src/routes/abha-otp-and-mobile-screen.tsx +435 -0
- package/src/routes/abha-phone-number-verification-screen.tsx +388 -0
- package/src/routes/create-abha-address-screen.tsx +928 -0
- package/src/routes/create-abha-with-aadhaar-screen.tsx +986 -0
- package/src/routes/create-eka-profile-screen.tsx +831 -0
- package/src/routes/get-all-profiles-screen.tsx +161 -0
- package/src/routes/login-or-create-abha-address-screen.tsx +1056 -0
- package/src/routes/login-with-abha-screen.tsx +454 -0
- package/src/routes/select-abha-from-list-screen.tsx +792 -0
- package/src/routes/select-eka-profile-screen.tsx +446 -0
- package/src/routes/utils/trackAbhaEvent.ts +41 -0
- package/src/stores/auth-abha-store/index.ts +152 -0
- package/src/stores/auth-abha-store/types.ts +217 -0
- package/src/utils/mock-auth-response.ts +29 -0
- package/src/utils/send-event-utils.ts +76 -0
- package/src/utils/validations.ts +89 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.ts +9 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/tsconfig.node.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.d.ts +2 -0
- package/vite.config.js +30 -0
- package/vite.config.ts +35 -0
- package/dist/sdk/abha/css/abha.css +0 -1
- package/dist/sdk/abha/js/abha.js +0 -146
- /package/{dist → public}/images/adhaar.webp +0 -0
- /package/{dist → public}/images/at-the-rate.webp +0 -0
- /package/{dist → public}/images/avatar.webp +0 -0
- /package/{dist → public}/images/ayushman-bharat.webp +0 -0
- /package/{dist → public}/images/circle-checkmark.webp +0 -0
- /package/{dist → public}/images/link-abha.webp +0 -0
- /package/{dist → public}/images/national-authority.webp +0 -0
- /package/{dist → public}/images/three-dots.webp +0 -0
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,114 +1,382 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: ABHA SDK
|
|
3
|
+
description: "Complete implementation guide for the ABHA[Ayushman Bharat Digital Mission] SDK"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# ABHA SDK Implementation
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
This guide provides everything you need to integrate the ABHA SDK into your application.
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
## Overview
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
Ensure that you have included the necessary scripts and styles in your HTML file.
|
|
12
|
+
The ABHA SDK allows you to integrate Create ABHA, Login with ABHA flows into your healthcare applications. It provides:
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<script type="module" src="https://login.eka.care/assets/js/lo-fe-main.js"></script>
|
|
15
|
-
```
|
|
14
|
+
- **Create ABHA**: Create a new ABHA using Mobile or Aadhaar
|
|
15
|
+
- **Login with ABHA**: Login with ABHA address[PHR Address], ABHA number, Adhaar number or Mobile number linked to your ABHA into your healthcare application.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
Create a container element in your HTML where the React app will be mounted.
|
|
17
|
+
## Installation
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
<div id="lofe_root"></div>
|
|
22
|
-
```
|
|
19
|
+
### Prerequisites
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
- A modern web browser.
|
|
22
|
+
- Your domain must be whitelisted with Eka Care to avoid CORS(Cross-Origin Resource Sharing) error.
|
|
23
|
+
(Contact Eka Care to request API access and domain whitelisting.)
|
|
24
|
+
- A valid HTML container element where the SDK will mount.
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
### Setup
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
function onSuccess(params) {
|
|
31
|
-
// Handle successful authentication
|
|
32
|
-
console.log('Authentication successful:', params);
|
|
33
|
-
// Redirect user or update UI accordingly
|
|
34
|
-
}
|
|
35
|
-
```
|
|
28
|
+
Add the following HTML and script tags to your webpage:
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
```html
|
|
31
|
+
<!DOCTYPE html>
|
|
32
|
+
<html>
|
|
33
|
+
<head>
|
|
34
|
+
<title>ABHA SDK Integration</title>
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
<!-- Include ABHA SDK CSS -->
|
|
37
|
+
<link
|
|
38
|
+
rel="stylesheet"
|
|
39
|
+
href="https://unpkg.com/@eka-care/abha/dist/sdk/abha/css/abha.css"
|
|
40
|
+
/>
|
|
41
|
+
</head>
|
|
42
|
+
<body>
|
|
43
|
+
<h1>ABHA SDK Demo</h1>
|
|
44
|
+
|
|
45
|
+
<!-- Mount Button -->
|
|
46
|
+
<button class="button" onclick="mountABHASDK()">Mount SDK</button>
|
|
47
|
+
|
|
48
|
+
<!-- Container for ABHA SDK -->
|
|
49
|
+
<div id="sdk_container"></div>
|
|
50
|
+
|
|
51
|
+
<!-- Include ABHA SDK JS -->
|
|
52
|
+
<script
|
|
53
|
+
type="module"
|
|
54
|
+
async
|
|
55
|
+
src="https://unpkg.com/@eka-care/abha/dist/sdk/abha/js/abha.js"
|
|
56
|
+
></script>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
function mountABHASDK() {
|
|
60
|
+
window.initAbhaApp({
|
|
61
|
+
containerId: "sdk_container",
|
|
62
|
+
|
|
63
|
+
// Pass access token and oid
|
|
64
|
+
data: {
|
|
65
|
+
accessToken: "<your_access_token>", // Pass the access token you have
|
|
66
|
+
oid: "<your_oid_if_available>", // Pass if you have the OID
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Success callback
|
|
70
|
+
onSuccess: async (params) => {
|
|
71
|
+
console.log("ABHA flow completed successfully:", params);
|
|
72
|
+
// Example: Store ABHA data in your app
|
|
73
|
+
dispatch({
|
|
74
|
+
type: "set-only-healthid-data",
|
|
75
|
+
healthIdData: formatter(params.response.data),
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// Error callback
|
|
80
|
+
onError: (params) => {
|
|
81
|
+
console.error("ABHA flow failed:", params);
|
|
82
|
+
if (window.EkaAbha) {
|
|
83
|
+
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
|
|
51
84
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
</body>
|
|
90
|
+
</html>
|
|
91
|
+
```
|
|
92
|
+
## Core Functions
|
|
93
|
+
|
|
94
|
+
### 1. initAbhaApp
|
|
95
|
+
|
|
96
|
+
Initializes and renders the ABHA SDK in your specified container.
|
|
97
|
+
|
|
98
|
+
**Parameters:**
|
|
99
|
+
|
|
100
|
+
| Name | Type | Required | Description |
|
|
101
|
+
| ------------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
102
|
+
| `containerId` | `string` | ✅ | The HTML element ID where the SDK will mount. |
|
|
103
|
+
| `data` | `{ accessToken: string; oid?: string }` | ⚙️ Optional | Configuration data for secure API integration. <br/>- `accessToken`: Pass the access token you have. <br/>- `oid`: Pass if available. |
|
|
104
|
+
| `onSuccess` | `(params: AbhaSuccessParams) => void` | ✅ | Triggered when the user successfully creates or logs in to ABHA. |
|
|
105
|
+
| `onError` | `(params: AbhaErrorParams) => void` | ✅ | Triggered when an error occurs during the ABHA flow. |
|
|
106
|
+
|
|
107
|
+
**Example:**
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
window.initAbhaApp({
|
|
111
|
+
containerId: "sdk_container",
|
|
112
|
+
data: {
|
|
113
|
+
accessToken: "your_access_token_here",
|
|
114
|
+
oid: "optional_oid_here",
|
|
115
|
+
},
|
|
116
|
+
onSuccess: (params) => {
|
|
117
|
+
console.log("ABHA created successfully!", params);
|
|
118
|
+
},
|
|
119
|
+
onError: (error) => {
|
|
120
|
+
console.error("ABHA flow failed:", error);
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Callback Parameters
|
|
126
|
+
|
|
127
|
+
### onSuccess Callback
|
|
128
|
+
|
|
129
|
+
The onAbhaSuccess callback is triggered when the ABHA flow completes successfully.
|
|
130
|
+
It returns verified user details and tokens, which can be used to log in or continue the user’s session.
|
|
131
|
+
|
|
132
|
+
**Callback Signature:**
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
onSuccess: (params: TOnAbhaSuccessParams) => void;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Type Definitions**
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
export type TOnAbhaSuccessParams = {
|
|
142
|
+
response: TAuthVerifyV2Response;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type TAuthVerifyV2Response = {
|
|
146
|
+
skip_state: number;
|
|
147
|
+
method: AUTH_METHOD;
|
|
148
|
+
data?: {
|
|
149
|
+
tokens: {
|
|
150
|
+
sess: string;
|
|
151
|
+
refresh: string;
|
|
152
|
+
};
|
|
153
|
+
profile: TProfileRecord;
|
|
154
|
+
};
|
|
155
|
+
txn_id: string;
|
|
156
|
+
error?: {
|
|
157
|
+
code: number;
|
|
158
|
+
message: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Parameters**
|
|
164
|
+
| Key | Type | Description |
|
|
165
|
+
| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
166
|
+
| `response` | `TAuthVerifyV2Response` | The complete ABHA verification response, containing session tokens, user profile, and transaction details. |
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
**Example:**
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
const onSuccess = (params) => {
|
|
174
|
+
console.log("ABHA Success:", params.response);
|
|
175
|
+
|
|
176
|
+
const abhaNumber = params.response.data?.profile?.abha_number;
|
|
177
|
+
const userName = params.response.data?.profile?.name;
|
|
178
|
+
|
|
179
|
+
alert(`Welcome ${userName}! Your ABHA Number: ${abhaNumber}`);
|
|
180
|
+
|
|
181
|
+
// Optionally pass data to native bridge
|
|
182
|
+
if (window.EkaAbha) {
|
|
183
|
+
window.EkaAbha.onAbhaSuccess(JSON.stringify(params));
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### onError Callback
|
|
189
|
+
The onError callback is triggered whenever an ABHA flow fails or is interrupted.
|
|
190
|
+
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).
|
|
191
|
+
|
|
192
|
+
**Callback Signature:**
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
onError: (params: TOnAbhaFailureParams) => void;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Type Definitions**
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
type TOnAbhaFailureParams = {
|
|
202
|
+
error?: string;
|
|
203
|
+
response?: TAuthVerifyV2Response;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export type TAuthVerifyV2Response = {
|
|
207
|
+
skip_state: number;
|
|
208
|
+
method: AUTH_METHOD;
|
|
209
|
+
data?: {
|
|
210
|
+
tokens: {
|
|
211
|
+
sess: string;
|
|
212
|
+
refresh: string;
|
|
213
|
+
};
|
|
214
|
+
profile: TProfileRecord;
|
|
215
|
+
};
|
|
216
|
+
txn_id: string;
|
|
217
|
+
error?: {
|
|
218
|
+
code: number;
|
|
219
|
+
message: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Parameters**
|
|
225
|
+
| Key | Type | Description |
|
|
226
|
+
| ---------- | ------------------------ | ---------------------------------------------------------------- |
|
|
227
|
+
| `error` | `string?` | Short description of the failure or error message. |
|
|
228
|
+
| `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. |
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
**Example:**
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
const onError = (params) => {
|
|
235
|
+
console.error("ABHA Error:", params);
|
|
236
|
+
|
|
237
|
+
if (params.response?.error?.code === 1001) {
|
|
238
|
+
alert("Authentication failed. Please try again.");
|
|
239
|
+
} else if (params.error === "NETWORK_ERROR") {
|
|
240
|
+
alert("Please check your internet connection.");
|
|
241
|
+
} else {
|
|
242
|
+
alert("Something went wrong. Please retry.");
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Forward the error to native handler if available
|
|
246
|
+
if (window.EkaAbha) {
|
|
247
|
+
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Suggest Handling**
|
|
253
|
+
-Always log the full error response (params) for debugging.
|
|
254
|
+
-Display friendly error messages for known error.code values.
|
|
255
|
+
-If params.response is present, inspect response.error.message for more detail.
|
|
256
|
+
-If integrating with native apps, forward the serialized error object:
|
|
257
|
+
```javascript
|
|
258
|
+
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Container Styling
|
|
262
|
+
Ensure your container has sufficient space:
|
|
263
|
+
```html
|
|
264
|
+
<div
|
|
265
|
+
id="sdk_container"
|
|
266
|
+
style="width: 100%; height: 600px; border: 1px solid #ddd;"
|
|
267
|
+
></div>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Complete Implementation Example
|
|
271
|
+
|
|
272
|
+
```html
|
|
273
|
+
<!DOCTYPE html>
|
|
274
|
+
<html>
|
|
275
|
+
<head>
|
|
276
|
+
<title>ABHA SDK Complete Example</title>
|
|
277
|
+
<link
|
|
278
|
+
rel="stylesheet"
|
|
279
|
+
href="https://unpkg.com/@eka-care/abha/dist/sdk/abha/css/abha.css"
|
|
280
|
+
/>
|
|
281
|
+
</head>
|
|
282
|
+
<body>
|
|
283
|
+
<h1>ABHA SDK Demo</h1>
|
|
284
|
+
|
|
285
|
+
<button onclick="mountABHASDK()">Launch ABHA SDK</button>
|
|
286
|
+
|
|
287
|
+
<div
|
|
288
|
+
id="sdk_container"
|
|
289
|
+
style="width: 100%; height: 600px; border: 1px solid #ccc;"
|
|
290
|
+
></div>
|
|
291
|
+
|
|
292
|
+
<script
|
|
293
|
+
type="module"
|
|
294
|
+
async
|
|
295
|
+
src="https://unpkg.com/@eka-care/abha/dist/sdk/abha/js/abha.js"
|
|
296
|
+
></script>
|
|
297
|
+
|
|
298
|
+
<script>
|
|
299
|
+
function mountABHASDK() {
|
|
300
|
+
window.initAbhaApp({
|
|
301
|
+
containerId: "sdk_container",
|
|
302
|
+
data: {
|
|
303
|
+
accessToken: "<your_access_token>",
|
|
304
|
+
oid: "<your_oid_if_available>",
|
|
305
|
+
},
|
|
306
|
+
onSuccess: (params) => {
|
|
307
|
+
console.log("ABHA flow completed successfully:", params);
|
|
308
|
+
},
|
|
309
|
+
onError: (params) => {
|
|
310
|
+
console.error("ABHA flow failed:", params);
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
</script>
|
|
315
|
+
</body>
|
|
316
|
+
</html>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Type Definitions
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
interface InitAbhaAppParams {
|
|
323
|
+
containerId: string;
|
|
324
|
+
data?: {
|
|
325
|
+
accessToken: string;
|
|
326
|
+
oid?: string;
|
|
327
|
+
};
|
|
328
|
+
onSuccess: (params: AbhaSuccessParams) => void;
|
|
329
|
+
onError: (params: AbhaErrorParams) => void;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
interface AbhaSuccessParams {
|
|
333
|
+
response: {
|
|
334
|
+
data: {
|
|
335
|
+
abha_number?: string;
|
|
336
|
+
abha_address?: string;
|
|
337
|
+
name?: string;
|
|
338
|
+
gender?: string;
|
|
339
|
+
yearOfBirth?: string;
|
|
340
|
+
mobile?: string;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
message: string;
|
|
344
|
+
status: "SUCCESS";
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
interface AbhaErrorParams {
|
|
348
|
+
status: "FAILED";
|
|
349
|
+
message: string;
|
|
350
|
+
error_code?: string;
|
|
351
|
+
details?: any;
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Troubleshooting
|
|
356
|
+
|
|
357
|
+
### Common Issues
|
|
358
|
+
|
|
359
|
+
#### 1. SDK Not Rendering
|
|
360
|
+
|
|
361
|
+
**Problem**: Nothing appears in the container.
|
|
362
|
+
|
|
363
|
+
**Solution**:
|
|
364
|
+
- Ensure containerId matches an existing HTML element.
|
|
365
|
+
- Verify the SDK JS and CSS are correctly loaded.
|
|
366
|
+
- Check browser console for errors.
|
|
367
|
+
|
|
368
|
+
#### 2. Callback Not Triggered
|
|
369
|
+
|
|
370
|
+
**Problem**: onSuccess or onError isn’t firing.
|
|
371
|
+
|
|
372
|
+
**Solution**:
|
|
373
|
+
- Make sure both callbacks are passed as valid functions.
|
|
374
|
+
- Avoid race conditions (e.g., calling before SDK fully loads).
|
|
375
|
+
|
|
376
|
+
#### 3. Styling Issues
|
|
377
|
+
|
|
378
|
+
**Problem**: SDK content appears misaligned or clipped.
|
|
379
|
+
|
|
380
|
+
**Solution**:
|
|
381
|
+
- Give your container a fixed height (e.g., 600px).
|
|
382
|
+
- Ensure no parent element uses overflow: hidden.
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<meta name="theme-color" content="#fff" />
|
|
8
8
|
<title>Vite + React + TS</title>
|
|
9
|
-
<script type="module" crossorigin src="/sdk/abha/js/abha.js"></script>
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/sdk/abha/css/abha.css">
|
|
11
9
|
</head>
|
|
12
10
|
<body>
|
|
13
11
|
<div id="lofe_root"></div>
|
|
12
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
14
13
|
</body>
|
|
15
14
|
</html>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const borders = {
|
|
2
|
+
none: "0px",
|
|
3
|
+
DEFAULT: "0.0625rem",
|
|
4
|
+
0.5: "0.03125rem",
|
|
5
|
+
1: "0.0625rem",
|
|
6
|
+
2: "0.125rem",
|
|
7
|
+
3: "0.1875rem",
|
|
8
|
+
4: "0.25rem",
|
|
9
|
+
5: "0.3125rem",
|
|
10
|
+
6: "0.375rem",
|
|
11
|
+
7: "0.4375rem",
|
|
12
|
+
8: "0.5rem",
|
|
13
|
+
9: "0.5625rem",
|
|
14
|
+
10: "0.625rem",
|
|
15
|
+
11: "0.6875rem",
|
|
16
|
+
12: "0.75rem",
|
|
17
|
+
13: "0.8125rem",
|
|
18
|
+
14: "0.875rem",
|
|
19
|
+
15: "0.9375rem",
|
|
20
|
+
16: "1.0rem",
|
|
21
|
+
17: "1.0625rem",
|
|
22
|
+
18: "1.125rem",
|
|
23
|
+
19: "1.1875rem",
|
|
24
|
+
20: "1.25rem",
|
|
25
|
+
21: "1.3125rem",
|
|
26
|
+
22: "1.375rem",
|
|
27
|
+
23: "1.4375rem",
|
|
28
|
+
24: "1.5rem",
|
|
29
|
+
25: "1.5625rem",
|
|
30
|
+
26: "1.625rem",
|
|
31
|
+
27: "1.6875rem",
|
|
32
|
+
28: "1.75rem",
|
|
33
|
+
29: "1.8125rem",
|
|
34
|
+
30: "1.875rem",
|
|
35
|
+
31: "1.9375rem",
|
|
36
|
+
32: "2.0rem",
|
|
37
|
+
33: "2.0625rem",
|
|
38
|
+
34: "2.125rem",
|
|
39
|
+
35: "2.1875rem",
|
|
40
|
+
36: "2.25rem",
|
|
41
|
+
37: "2.3125rem",
|
|
42
|
+
38: "2.375rem",
|
|
43
|
+
39: "2.4375rem",
|
|
44
|
+
40: "2.5rem",
|
|
45
|
+
41: "2.5625rem",
|
|
46
|
+
42: "2.625rem",
|
|
47
|
+
43: "2.6875rem",
|
|
48
|
+
44: "2.75rem",
|
|
49
|
+
45: "2.8125rem",
|
|
50
|
+
46: "2.875rem",
|
|
51
|
+
47: "2.9375rem",
|
|
52
|
+
48: "3.0rem",
|
|
53
|
+
49: "3.0625rem",
|
|
54
|
+
50: "3.125rem",
|
|
55
|
+
51: "3.1875rem",
|
|
56
|
+
52: "3.25rem",
|
|
57
|
+
53: "3.3125rem",
|
|
58
|
+
54: "3.375rem",
|
|
59
|
+
55: "3.4375rem",
|
|
60
|
+
56: "3.5rem",
|
|
61
|
+
57: "3.5625rem",
|
|
62
|
+
58: "3.625rem",
|
|
63
|
+
59: "3.6875rem",
|
|
64
|
+
60: "3.75rem",
|
|
65
|
+
circle: "50%",
|
|
66
|
+
full: "9999px",
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default borders;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const pdsColors = {
|
|
2
|
+
text: {
|
|
3
|
+
'01': '#111B31',
|
|
4
|
+
'02': '#39465B',
|
|
5
|
+
'03': '#4B596D',
|
|
6
|
+
'04': '#9EA8B8',
|
|
7
|
+
brand: '#6B5CE0',
|
|
8
|
+
black: '#000000',
|
|
9
|
+
doc: '#215FFF',
|
|
10
|
+
invert: '#FFFFFF',
|
|
11
|
+
primary: '#2D3142',
|
|
12
|
+
secondary: '#4C5980',
|
|
13
|
+
success: '#1B7E43',
|
|
14
|
+
white: '#FFFFFF',
|
|
15
|
+
info: '#3B5BFA',
|
|
16
|
+
error: '#BD0F0F',
|
|
17
|
+
'black-20': '#00000033',
|
|
18
|
+
'neutral-600-medium': '#767676',
|
|
19
|
+
'neutral-800-dark': '#484848',
|
|
20
|
+
'neutral-1000-black': '#1A1A1A',
|
|
21
|
+
'primary-500': '#215FFF',
|
|
22
|
+
'color-foreground-on-primary': '#FFFFFF',
|
|
23
|
+
},
|
|
24
|
+
border: {
|
|
25
|
+
'brand-01': '#6B5CE0',
|
|
26
|
+
'brand-02': '#E4E1FA',
|
|
27
|
+
'03': '#D9DDE3',
|
|
28
|
+
error: '#BD0F0F',
|
|
29
|
+
doc: '#215FFF',
|
|
30
|
+
'blue-100': '#CDD5FE',
|
|
31
|
+
info: '#3B5BFA',
|
|
32
|
+
'neutral-200-strokelight': '#D1D1D1',
|
|
33
|
+
},
|
|
34
|
+
bg: {
|
|
35
|
+
secondary: '#ABB7C2',
|
|
36
|
+
'02':'#E4E7EC',
|
|
37
|
+
'04': '#BEC5D0',
|
|
38
|
+
white: '#FFFFFF',
|
|
39
|
+
doc: '#215FFF',
|
|
40
|
+
'brand-01': '#6B5CE0',
|
|
41
|
+
'brand-02': '#E4E1FA',
|
|
42
|
+
'brand-03': '#F4F2FF',
|
|
43
|
+
'01': '#F2F4F7',
|
|
44
|
+
invert: '#111B31',
|
|
45
|
+
'seperator-dark': '#D6D9E0',
|
|
46
|
+
'fab-bg-brand-04': '#B3ABED',
|
|
47
|
+
'warning-03': '#FFFBE5',
|
|
48
|
+
'purple-800': '#1A1254',
|
|
49
|
+
'error-01': '#F15353',
|
|
50
|
+
'yellow-50': '#FDF7E7',
|
|
51
|
+
'primary-bg-light': '#E9EFFF',
|
|
52
|
+
'neutral-100-bg-dark': '#E8E8E8',
|
|
53
|
+
'button-danger-background-color': '#D92D20',
|
|
54
|
+
'color-foreground-heading': '#1A1A1A',
|
|
55
|
+
'color-foreground-warning': '#F79009',
|
|
56
|
+
'color-foreground-success': '#039855',
|
|
57
|
+
},
|
|
58
|
+
icon: {
|
|
59
|
+
'success-02': '#27B961',
|
|
60
|
+
'03': '#4B596D',
|
|
61
|
+
invert: '#FFFFFF',
|
|
62
|
+
'orange-500': '#E9673F',
|
|
63
|
+
'orange-400':'#FB9637',
|
|
64
|
+
'orange-300': '#FCB069',
|
|
65
|
+
brand: '#6B5CE0',
|
|
66
|
+
'01': '#F2F4F7',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default pdsColors;
|