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