@eka-care/abha-stg 0.1.94 → 0.1.95
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 +351 -144
- package/dist/sdk/abha/css/abha.css +1 -1
- package/dist/sdk/abha/js/abha.js +51 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Get Started
|
|
3
|
+
description: "Complete implementation guide for the ABHA[Ayushman Bharat Digital Mission] SDK"
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# ABHA SDK Implementation
|
|
2
7
|
|
|
3
8
|
This guide provides everything you need to integrate the ABHA SDK into your application.
|
|
4
9
|
|
|
5
10
|
## Overview
|
|
6
11
|
|
|
7
|
-
The ABHA SDK allows you to integrate Create ABHA, Login with ABHA flows into your healthcare applications. It provides:
|
|
12
|
+
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:
|
|
8
13
|
|
|
9
|
-
- **Create ABHA**: Create a new ABHA using Mobile or Aadhaar
|
|
10
|
-
- **Login with ABHA**: Login
|
|
14
|
+
- **Create ABHA**: Create a new ABHA using Mobile or Aadhaar.
|
|
15
|
+
- **Login with ABHA**: Login to your exisiting ABHA using PHR Address, ABHA number, Aadhaar number or Mobile number.
|
|
16
|
+
- **ABHA Consent Management**: Manage Consent requests raised by healthcare providers to share medical records securely.
|
|
17
|
+
- **ABHA Profile KYC**: Get your ABHA address KYC verified.
|
|
11
18
|
|
|
12
19
|
## Installation
|
|
13
20
|
|
|
@@ -46,7 +53,6 @@ Add the following HTML and script tags to your webpage:
|
|
|
46
53
|
<!-- Include ABHA SDK JS -->
|
|
47
54
|
<script
|
|
48
55
|
type="module"
|
|
49
|
-
async
|
|
50
56
|
src="https://unpkg.com/@eka-care/abha/dist/sdk/abha/js/abha.js"
|
|
51
57
|
></script>
|
|
52
58
|
|
|
@@ -54,31 +60,44 @@ Add the following HTML and script tags to your webpage:
|
|
|
54
60
|
function mountABHASDK() {
|
|
55
61
|
window.initAbhaApp({
|
|
56
62
|
containerId: "sdk_container",
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
clientId: "ext",
|
|
64
|
+
theme:{
|
|
65
|
+
// if you want to customise sdk theme/colors
|
|
66
|
+
// pass the colors of your organisation design system
|
|
67
|
+
}
|
|
68
|
+
// data object
|
|
59
69
|
data: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
orgIcon: "<url_of_your_org_icon>", // Pass the url to your organisation icon which starts with for ex: https://cdn.eka.care/vagus/cl56w6zg3001f0scsaqrh16is.jpg
|
|
63
|
-
linkToOrgIcon: "<url_of_image_to_link_abha_to_your_org>", // Pass the url of an image which depicts linking abha to your organisation for ex https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp
|
|
64
|
-
},
|
|
70
|
+
// pass the required data as per the flow
|
|
71
|
+
},
|
|
65
72
|
|
|
66
73
|
// Success callback
|
|
67
|
-
onSuccess:
|
|
68
|
-
console.log("ABHA flow completed successfully:", params);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
onSuccess: (params) => {
|
|
75
|
+
console.log("ABHA Registration flow completed successfully:", params);
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
//KYC Successs callback
|
|
79
|
+
onKYCSuccess: (params) => {
|
|
80
|
+
console.log("ABHA KYC Verified successfully:", params);
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
//Consent Successs callback
|
|
84
|
+
onConsentSuccess: (params) => {
|
|
85
|
+
console.log("ABHA Consent flow completed successfully:", params);
|
|
74
86
|
},
|
|
75
87
|
|
|
76
88
|
// Error callback
|
|
77
89
|
onError: (params) => {
|
|
78
|
-
console.error("ABHA
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
console.error("ABHA SDK failed:", params);
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// Abha Close callback
|
|
94
|
+
onAbhaClose: () => {
|
|
95
|
+
console.log("ABHA SDK closed");
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// Skip ABHA callback
|
|
99
|
+
onSkipAbha: (params) => {
|
|
100
|
+
console.log("ABHA flow SKIPPED:", params);
|
|
82
101
|
},
|
|
83
102
|
});
|
|
84
103
|
}
|
|
@@ -97,35 +116,22 @@ Initializes and renders the ABHA SDK in your specified container.
|
|
|
97
116
|
| Name | Type | Required | Description |
|
|
98
117
|
| ------------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
99
118
|
| `containerId` | `string` | ✅ | The HTML element ID where the SDK will mount. |
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
accessToken: "your_access_token_here",
|
|
111
|
-
oid: "optional_oid_here",
|
|
112
|
-
orgIcon: "url_of_your_org_icon",
|
|
113
|
-
linkToOrgIcon: "url_of_image_to_link_abha_to_your_org",
|
|
114
|
-
},
|
|
115
|
-
onSuccess: (params) => {
|
|
116
|
-
console.log("ABHA created successfully!", params);
|
|
117
|
-
},
|
|
118
|
-
onError: (error) => {
|
|
119
|
-
console.error("ABHA flow failed:", error);
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
```
|
|
119
|
+
| `clientId` | `string` | ✅ | Provide clientId as `ext`. |
|
|
120
|
+
| `theme` | `string` | ⚙️ Optional | Provide theme object with your org design system colors. |
|
|
121
|
+
| `data` | `{`<br/>`accessToken: string;`<br/>`hipId: string;`<br/>`oid?: string;`<br/>`identifier?: string;`<br/>`identifier_type?: string;`<br/>`consent_id?: string;`<br/>`flow?: string;`<br/>`linkToOrgIcon?: string;`<br/>`orgIconUrl?: string;`<br/>`skipABHAEnable?: boolean;`<br/>`}` | ⚙️ Optional | Configuration data for initializing the ABHA flow. <br/><br/>- <strong>accessToken:</strong> Pass the access token you have generated from [Connect Login ](https://developer.eka.care/api-reference/authorization/client-login) API without the word `Bearer`. <br/>- <strong>hipId:</strong> Pass the HFR ID you have. <br/>- <strong>oid:</strong> Pass oid of patient if available / needed in the flow. <br/>- <strong>identifier:</strong> Pass the login identifier value i.e. mobile number / aadhaar number / phr address / abha number.<br/>- <strong>identifier_type:</strong> 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. <br/>- <strong>consent_id:</strong> Pass the consent_id of the consent request raised. <br/>- <strong>flow:</strong> Pass the type of flow for which you want to use SDK for i.e. `abha-kyc` for KYC flow / `consent` for Consent flow. <br/>- <strong>linkToOrgIcon:</strong> 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)<br/>- <strong>orgIconUrl:</strong> Public URL of your organization's logo. It is displayed in specific journey headers url should start with https://. [Example](https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp)<br/>- <strong>skipABHAEnable:</strong> Pass the boolean as true if you want Skip ABHA button to be enabled on login screen. <br/><br/> `keys with ? are optional and needs to be passed as per flow requirement.` |
|
|
122
|
+
| `onSuccess` | `(params: TOnAbhaSuccessParams) => void` | ✅ | Triggered when the user successfully creates or logs in to ABHA. |
|
|
123
|
+
| `onKYCSuccess` | `(params: TOnAbhaKycSuccessParams) => void` | ⚙️ Optional | Triggered when the user KYC verified successfully.
|
|
124
|
+
| `onConsentSuccess` | `(params: TOnAbhaConsentSuccessParams) => void` | ⚙️ Optional | Triggered when the consent flow completes successfully.
|
|
125
|
+
| `onError` | `(params: TOnAbhaFailureParams) => void` | ✅ | Triggered when an error occurs during the ABHA flow.
|
|
126
|
+
| `onAbhaClose` | `() => void` | ✅ | Triggered when SDK closes.
|
|
127
|
+
| `onSkipAbha` | `(params: TOnSkipABHA) => void` | ⚙️ Optional | Triggered if the ABHA flow is skipped. |
|
|
128
|
+
|
|
123
129
|
|
|
124
130
|
## Callback Parameters
|
|
125
131
|
|
|
126
132
|
### onSuccess Callback
|
|
127
133
|
|
|
128
|
-
The
|
|
134
|
+
The onSuccess callback is triggered when the ABHA flow completes successfully.
|
|
129
135
|
It returns verified user details and tokens, which can be used to log in or continue the user’s session.
|
|
130
136
|
|
|
131
137
|
**Callback Signature:**
|
|
@@ -137,11 +143,11 @@ onSuccess: (params: TOnAbhaSuccessParams) => void;
|
|
|
137
143
|
**Type Definitions**
|
|
138
144
|
|
|
139
145
|
```typescript
|
|
140
|
-
|
|
146
|
+
type TOnAbhaSuccessParams = {
|
|
141
147
|
response: TAuthVerifyV2Response;
|
|
142
148
|
};
|
|
143
149
|
|
|
144
|
-
|
|
150
|
+
type TAuthVerifyV2Response = {
|
|
145
151
|
skip_state: number;
|
|
146
152
|
method: AUTH_METHOD;
|
|
147
153
|
data?: {
|
|
@@ -157,6 +163,38 @@ export type TAuthVerifyV2Response = {
|
|
|
157
163
|
message: string;
|
|
158
164
|
};
|
|
159
165
|
};
|
|
166
|
+
|
|
167
|
+
enum AUTH_METHOD {
|
|
168
|
+
EMAIL = 1,
|
|
169
|
+
MOBILE = 2,
|
|
170
|
+
ABHA = 7,
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
type TProfileRecord = {
|
|
174
|
+
fln: string;
|
|
175
|
+
fn: string;
|
|
176
|
+
mn?: string;
|
|
177
|
+
ln?: string;
|
|
178
|
+
gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown'
|
|
179
|
+
dob?: string;
|
|
180
|
+
mobile?: string;
|
|
181
|
+
email?: string;
|
|
182
|
+
uuid?: string;
|
|
183
|
+
bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-";
|
|
184
|
+
pic?: string;
|
|
185
|
+
as?: string;
|
|
186
|
+
"dob-valid"?: boolean;
|
|
187
|
+
"is-d"?: boolean;
|
|
188
|
+
"is-d-s"?: boolean;
|
|
189
|
+
"is-p"?: boolean;
|
|
190
|
+
oid: string;
|
|
191
|
+
at: string;
|
|
192
|
+
type?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
193
|
+
"health-ids"?: Array<string>;
|
|
194
|
+
abha_number?: string;
|
|
195
|
+
kyc_verified?: boolean;
|
|
196
|
+
};
|
|
197
|
+
|
|
160
198
|
```
|
|
161
199
|
|
|
162
200
|
**Parameters**
|
|
@@ -177,13 +215,91 @@ const onSuccess = (params) => {
|
|
|
177
215
|
|
|
178
216
|
alert(`Welcome ${userName}! Your ABHA Number: ${abhaNumber}`);
|
|
179
217
|
|
|
180
|
-
// Optionally pass data to native bridge
|
|
218
|
+
// Optionally pass data to native bridge if available
|
|
181
219
|
if (window.EkaAbha) {
|
|
182
220
|
window.EkaAbha.onAbhaSuccess(JSON.stringify(params));
|
|
183
221
|
}
|
|
184
222
|
};
|
|
185
223
|
```
|
|
186
224
|
|
|
225
|
+
### onKYCSuccess Callback
|
|
226
|
+
|
|
227
|
+
The onKYCSuccess callback is triggered when the ABHA KYC flow completes successfully.
|
|
228
|
+
It returns a confirmation message indicating that the KYC has been verified.
|
|
229
|
+
|
|
230
|
+
**Callback Signature:**
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
onKYCSuccess: (params: TOnAbhaKycSuccessParams) => void;
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Type Definitions**
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
type TOnAbhaKycSuccess = string;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Parameters**
|
|
243
|
+
| | Type | Description |
|
|
244
|
+
| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
245
|
+
| `TOnAbhaKycSuccess` | `string` | A confirmation message from SDK post KYC verification |
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
**Example:**
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
const onKYCSuccess = (params) => {
|
|
253
|
+
console.log("KYC verification Success:", params);
|
|
254
|
+
|
|
255
|
+
alert("KYC was verified successfully!");
|
|
256
|
+
|
|
257
|
+
// Optionally pass data to native bridge if available
|
|
258
|
+
if (window.EkaAbha) {
|
|
259
|
+
window.EkaAbha.onAbhaKYCSuccess(params);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### onConsentSuccess Callback
|
|
265
|
+
|
|
266
|
+
The onConsentSuccess callback is triggered when the ABHA Consent flow completes successfully.
|
|
267
|
+
It returns a confirmation message indicating that the Consent flow ended successfully.
|
|
268
|
+
|
|
269
|
+
**Callback Signature:**
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
onConsentSuccess: (params: TOnAbhaConsentSuccessParams) => void;
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Type Definitions**
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
type TOnAbhaConsentSuccessParams = string;
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Parameters**
|
|
282
|
+
| | Type | Description |
|
|
283
|
+
| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
284
|
+
| `TOnAbhaConsentSuccessParams` | `string` | A confirmation message from SDK post Consent flow completion |
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
**Example:**
|
|
289
|
+
|
|
290
|
+
```javascript
|
|
291
|
+
const onConsentSuccess = (params) => {
|
|
292
|
+
console.log("Consent Flow completed:", params);
|
|
293
|
+
|
|
294
|
+
alert("Consent flow completed successfully!");
|
|
295
|
+
|
|
296
|
+
// Optionally pass data to native bridge if available
|
|
297
|
+
if (window.EkaAbha) {
|
|
298
|
+
window.EkaAbha.onAbhaConsentSuccess(params);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
```
|
|
302
|
+
|
|
187
303
|
### onError Callback
|
|
188
304
|
The onError callback is triggered whenever an ABHA flow fails or is interrupted.
|
|
189
305
|
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).
|
|
@@ -202,7 +318,7 @@ type TOnAbhaFailureParams = {
|
|
|
202
318
|
response?: TAuthVerifyV2Response;
|
|
203
319
|
};
|
|
204
320
|
|
|
205
|
-
|
|
321
|
+
type TAuthVerifyV2Response = {
|
|
206
322
|
skip_state: number;
|
|
207
323
|
method: AUTH_METHOD;
|
|
208
324
|
data?: {
|
|
@@ -218,6 +334,38 @@ export type TAuthVerifyV2Response = {
|
|
|
218
334
|
message: string;
|
|
219
335
|
};
|
|
220
336
|
};
|
|
337
|
+
|
|
338
|
+
enum AUTH_METHOD {
|
|
339
|
+
EMAIL = 1,
|
|
340
|
+
MOBILE = 2,
|
|
341
|
+
ABHA = 7,
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
type TProfileRecord = {
|
|
345
|
+
fln: string;
|
|
346
|
+
fn: string;
|
|
347
|
+
mn?: string;
|
|
348
|
+
ln?: string;
|
|
349
|
+
gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown'
|
|
350
|
+
dob?: string;
|
|
351
|
+
mobile?: string;
|
|
352
|
+
email?: string;
|
|
353
|
+
uuid?: string;
|
|
354
|
+
bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-";
|
|
355
|
+
pic?: string;
|
|
356
|
+
as?: string;
|
|
357
|
+
"dob-valid"?: boolean;
|
|
358
|
+
"is-d"?: boolean;
|
|
359
|
+
"is-d-s"?: boolean;
|
|
360
|
+
"is-p"?: boolean;
|
|
361
|
+
oid: string;
|
|
362
|
+
at: string;
|
|
363
|
+
type?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
364
|
+
"health-ids"?: Array<string>;
|
|
365
|
+
abha_number?: string;
|
|
366
|
+
kyc_verified?: boolean;
|
|
367
|
+
};
|
|
368
|
+
|
|
221
369
|
```
|
|
222
370
|
|
|
223
371
|
**Parameters**
|
|
@@ -248,111 +396,161 @@ const onError = (params) => {
|
|
|
248
396
|
};
|
|
249
397
|
```
|
|
250
398
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
399
|
+
### onAbhaClose Callback
|
|
400
|
+
|
|
401
|
+
The onAbhaClose callback is triggered when the ABHA SDK flow gets closed.
|
|
402
|
+
|
|
403
|
+
**Callback Signature:**
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
onAbhaClose: () => void;
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Example:**
|
|
410
|
+
|
|
256
411
|
```javascript
|
|
257
|
-
|
|
412
|
+
const onAbhaClose = () => {
|
|
413
|
+
console.log("ABHA SDK Closed");
|
|
414
|
+
};
|
|
258
415
|
```
|
|
259
416
|
|
|
260
|
-
###
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
417
|
+
### onSkipAbha Callback
|
|
418
|
+
|
|
419
|
+
The onSkipAbha callback is triggered when the ABHA SDK flow is skipped. The callback is functional when skipABHAEnable is set to true in the data parameter while initializing the SDK.
|
|
420
|
+
|
|
421
|
+
**Callback Signature:**
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
onSkipAbha: (params: TOnSkipABHA) => void;
|
|
267
425
|
```
|
|
268
426
|
|
|
269
|
-
|
|
427
|
+
**Example:**
|
|
270
428
|
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
rel="stylesheet"
|
|
278
|
-
href="https://unpkg.com/@eka-care/abha/dist/sdk/abha/css/abha.css"
|
|
279
|
-
/>
|
|
280
|
-
</head>
|
|
281
|
-
<body>
|
|
282
|
-
<h1>ABHA SDK Demo</h1>
|
|
429
|
+
```javascript
|
|
430
|
+
const onSkipAbha = (params) => {
|
|
431
|
+
console.log("ABHA SDK Skipped:", params);
|
|
432
|
+
};
|
|
433
|
+
```
|
|
434
|
+
**Type Definitions**
|
|
283
435
|
|
|
284
|
-
|
|
436
|
+
```typescript
|
|
437
|
+
type IdentifierType = "mobile" | "aadhaar_number" | "abha_number" | "phr_address";
|
|
285
438
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
439
|
+
type TOnSkipABHA = {
|
|
440
|
+
identifier?: string;
|
|
441
|
+
identifier_type?: IdentifierType[]; // No default value here
|
|
442
|
+
};
|
|
443
|
+
```
|
|
290
444
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
445
|
+
**Parameters**
|
|
446
|
+
| Key | Type | Description |
|
|
447
|
+
| ---------- | ------------------------ | ---------------------------------------------------------------- |
|
|
448
|
+
| `identifier` | `string?` | It will be login identifier value filled by user. |
|
|
449
|
+
| `identifier_type` | `IdentifierType[]?` | It will be type of login identifier. |
|
|
296
450
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
linkToOrgIcon: "<url_of_image_to_link_abha_to_your_org>",
|
|
306
|
-
},
|
|
307
|
-
onSuccess: (params) => {
|
|
308
|
-
console.log("ABHA flow completed successfully:", params);
|
|
309
|
-
},
|
|
310
|
-
onError: (params) => {
|
|
311
|
-
console.error("ABHA flow failed:", params);
|
|
312
|
-
},
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
</script>
|
|
316
|
-
</body>
|
|
317
|
-
</html>
|
|
451
|
+
|
|
452
|
+
**Suggest Handling**
|
|
453
|
+
-Always log the full error response (params) for debugging.
|
|
454
|
+
-Display friendly error messages for known error.code values.
|
|
455
|
+
-If params.response is present, inspect response.error.message for more detail.
|
|
456
|
+
-If integrating with native apps, forward the serialized error object:
|
|
457
|
+
```javascript
|
|
458
|
+
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
|
|
318
459
|
```
|
|
319
460
|
|
|
320
|
-
##
|
|
461
|
+
## Customizing the Theme
|
|
462
|
+
The ABHA SDK supports full color-token overriding. You can pass a theme object during initialization to match your application's branding.
|
|
463
|
+
|
|
464
|
+
### Default Theme Colors
|
|
465
|
+
If no theme is provided, the SDK uses the following default values:
|
|
321
466
|
|
|
322
467
|
```typescript
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
468
|
+
const defaultAbhaColors = {
|
|
469
|
+
semantic: {
|
|
470
|
+
error: '#BD0F0F',
|
|
471
|
+
warning: '#FCB069',
|
|
472
|
+
success: '#27B961',
|
|
473
|
+
},
|
|
474
|
+
primary: {
|
|
475
|
+
brand: '#6B5CE0', // Main buttons, radios, and active states
|
|
476
|
+
},
|
|
477
|
+
surface: {
|
|
478
|
+
base: '#FFFFFF', // Background of pages
|
|
479
|
+
subtle: '#F2F4F7', // Card backgrounds
|
|
480
|
+
muted: '#E4E7EC', // Dividers and borders
|
|
481
|
+
strong: '#BEC5D0',
|
|
482
|
+
success: '#D5F6E2', // Success background alerts
|
|
483
|
+
neutral: '#0000000D',
|
|
484
|
+
danger: '#DD3F3F',
|
|
485
|
+
abhaCard: '#232477', // Specific background for the ABHA ID card
|
|
486
|
+
},
|
|
487
|
+
content: {
|
|
488
|
+
primary: '#111B31', // Heading and main text
|
|
489
|
+
secondary: '#4B596D', // Subtext
|
|
490
|
+
muted: '#9EA8B8', // Disabled or placeholder text
|
|
491
|
+
success: '#1B7E43', // Success text
|
|
492
|
+
},
|
|
493
|
+
qrCodeColors: {
|
|
494
|
+
fgColor: '#000000', // Color of the QR code dots
|
|
495
|
+
bgColor: '#FFFFFF' // Background of the QR code
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
```
|
|
499
|
+
### Overriding the theme
|
|
500
|
+
To customize the look, add the `theme` key to your `initAbhaApp` configuration:
|
|
334
501
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
502
|
+
```typescript
|
|
503
|
+
window.initAbhaApp({
|
|
504
|
+
containerId: "sdk_container",
|
|
505
|
+
clientId: "ext",
|
|
506
|
+
theme: {
|
|
507
|
+
primary: {
|
|
508
|
+
brand: '<your_primary_color', // Change main brand color to bright blue
|
|
509
|
+
},
|
|
510
|
+
semantic: {
|
|
511
|
+
error: '<your_semantic_error_color>',
|
|
512
|
+
warning: '<your_semantic_warning_color>',
|
|
513
|
+
success: '<your_semantic_success_color>',
|
|
514
|
+
},
|
|
515
|
+
surface: {
|
|
516
|
+
base: '<your_base_color>', // Background of pages
|
|
517
|
+
subtle: '<your_subtle_color>', // Card backgrounds
|
|
518
|
+
muted: '<your_muted_color>', // Dividers and borders
|
|
519
|
+
strong: '<your_strong_color>',
|
|
520
|
+
success: '<your_success_color>', // Success background alerts
|
|
521
|
+
neutral: '<your_neutral_color>',
|
|
522
|
+
danger: '<your_danger_color>',
|
|
523
|
+
abhaCard: '<your_abhaCard_color>', // Specific background for the ABHA ID card
|
|
524
|
+
},
|
|
525
|
+
content: {
|
|
526
|
+
primary: '<your_content_primary_color>', // Heading and main text
|
|
527
|
+
secondary: '<your_content_secondary_color>', // Subtext
|
|
528
|
+
muted: '<your_content_muted_color>', // Disabled or placeholder text
|
|
529
|
+
success: '<your_content_success_color>', // Success text
|
|
530
|
+
},
|
|
531
|
+
qrCodeColors: {
|
|
532
|
+
fgColor: '<your_qrcode_dot_color>', // Color of the QR code dots
|
|
533
|
+
bgColor: '<your_qrcode_bg_color>' // Background of the QR code
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
data: {
|
|
537
|
+
orgIconUrl: "https://your-domain.com/logo.png",
|
|
538
|
+
// ... rest of your data
|
|
539
|
+
},
|
|
540
|
+
onSuccess: (params) => { /* ... */ },
|
|
541
|
+
onError: (params) => { /* ... */ }
|
|
542
|
+
...
|
|
543
|
+
});
|
|
544
|
+
```
|
|
349
545
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
546
|
+
|
|
547
|
+
## Container Styling
|
|
548
|
+
Ensure your container has sufficient space:
|
|
549
|
+
```html
|
|
550
|
+
<div
|
|
551
|
+
id="sdk_container"
|
|
552
|
+
style="width: 100%; height: 600px; border: 1px solid #ddd;"
|
|
553
|
+
></div>
|
|
356
554
|
```
|
|
357
555
|
|
|
358
556
|
## Troubleshooting
|
|
@@ -368,18 +566,27 @@ interface AbhaErrorParams {
|
|
|
368
566
|
- Verify the SDK JS and CSS are correctly loaded.
|
|
369
567
|
- Check browser console for errors.
|
|
370
568
|
|
|
371
|
-
#### 2.
|
|
569
|
+
#### 2. APIs Not Being Called
|
|
570
|
+
|
|
571
|
+
**Problem**: API requests are not triggered after the SDK is mounted.
|
|
572
|
+
|
|
573
|
+
**Solution**:
|
|
574
|
+
- Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired.
|
|
575
|
+
- To prevent CORS-related issues, ensure that your domain is whitelisted.
|
|
576
|
+
|
|
577
|
+
#### 3. Callback Not Triggered
|
|
372
578
|
|
|
373
|
-
**Problem**: onSuccess
|
|
579
|
+
**Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing.
|
|
374
580
|
|
|
375
581
|
**Solution**:
|
|
376
|
-
- Make sure
|
|
582
|
+
- Make sure callbacks are passed as valid functions.
|
|
377
583
|
- Avoid race conditions (e.g., calling before SDK fully loads).
|
|
378
584
|
|
|
379
|
-
####
|
|
585
|
+
#### 4. Styling Issues
|
|
380
586
|
|
|
381
587
|
**Problem**: SDK content appears misaligned or clipped.
|
|
382
588
|
|
|
383
589
|
**Solution**:
|
|
384
590
|
- Give your container a fixed height (e.g., 600px).
|
|
385
|
-
- Ensure no parent element uses overflow: hidden.
|
|
591
|
+
- Ensure no parent element uses overflow: hidden.
|
|
592
|
+
|