@healthcloudai/hc-settings-connector 0.0.8 → 0.0.10
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 +221 -267
- package/dist/index.cjs +39 -69
- package/dist/index.d.cts +1 -22
- package/dist/index.d.ts +1 -22
- package/dist/index.js +39 -69
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,16 +7,15 @@ It is built on top of the shared Healthcheck HTTP and Login connectors.
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
|
-
1. Retrieve the authenticated patient
|
|
11
|
-
2.
|
|
12
|
-
3.
|
|
13
|
-
4.
|
|
14
|
-
5.
|
|
15
|
-
6. Submit
|
|
16
|
-
7.
|
|
17
|
-
8.
|
|
18
|
-
9.
|
|
19
|
-
10. Built on the shared Healthcheck HttpClient and authentication layer
|
|
10
|
+
1. Retrieve the authenticated patient dashboard
|
|
11
|
+
2. Generate canned upload URLs for selfie, ID, and insurance images
|
|
12
|
+
3. Submit uploaded selfie, identification, and insurance file keys to backend capture endpoints
|
|
13
|
+
4. Submit patient insurance coverage details
|
|
14
|
+
5. Retrieve patient insurances
|
|
15
|
+
6. Submit driving license data
|
|
16
|
+
7. Update the stored user image file reference
|
|
17
|
+
8. Deactivate the authenticated user
|
|
18
|
+
9. Built on the shared Healthcheck HttpClient and authentication layer
|
|
20
19
|
|
|
21
20
|
---
|
|
22
21
|
|
|
@@ -59,79 +58,42 @@ const settingsClient = new HCSettingsClient(
|
|
|
59
58
|
|
|
60
59
|
---
|
|
61
60
|
|
|
62
|
-
## Methods
|
|
63
|
-
|
|
64
|
-
### Get User Info
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
## API Key
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
Use `setApiKey(...)` to attach an API key header to requests from `HCSettingsClient`.
|
|
69
65
|
|
|
70
66
|
```ts
|
|
71
|
-
const
|
|
72
|
-
```
|
|
67
|
+
const apiKey = process.env.HEALTHCLOUD_API_KEY;
|
|
73
68
|
|
|
74
|
-
|
|
69
|
+
if (!apiKey) {
|
|
70
|
+
throw new Error("HEALTHCLOUD_API_KEY is required.");
|
|
71
|
+
}
|
|
75
72
|
|
|
76
|
-
|
|
73
|
+
settingsClient.setApiKey("x-api-key", apiKey);
|
|
74
|
+
```
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
- Header name should be `x-api-key`.
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
## Methods
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
200
|
|
84
|
-
```
|
|
80
|
+
The Settings connector methods are grouped by the main usage flow:
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"TenantID": "demo-tenant",
|
|
92
|
-
"FirstName": "John",
|
|
93
|
-
"LastName": "Doe",
|
|
94
|
-
"Email": "john.doe@example.com",
|
|
95
|
-
"Phone": null,
|
|
96
|
-
"BirthDate": "0001-01-01T00:00:00",
|
|
97
|
-
"HasInsurance": false,
|
|
98
|
-
"HasIDCard": false,
|
|
99
|
-
"HasSelfie": true,
|
|
100
|
-
"Address": {
|
|
101
|
-
"StreetAndNumber": null,
|
|
102
|
-
"Extension": null,
|
|
103
|
-
"City": null,
|
|
104
|
-
"State": null,
|
|
105
|
-
"PostalCode": null,
|
|
106
|
-
"Country": null
|
|
107
|
-
},
|
|
108
|
-
"Attributes": {
|
|
109
|
-
"FHIRPatientID": "patient-id-example",
|
|
110
|
-
"CompositeID": "composite-id-example",
|
|
111
|
-
"PatientImageURL": "https://storage.example.com/selfie_example.jpeg"
|
|
112
|
-
},
|
|
113
|
-
"CompositeID": "composite-id-example",
|
|
114
|
-
"FHIRID": "fhir-id-example"
|
|
115
|
-
},
|
|
116
|
-
"Encounters": null,
|
|
117
|
-
"EHR": "fhir",
|
|
118
|
-
"PendingActions": [
|
|
119
|
-
"ADD_ID",
|
|
120
|
-
"IMPORT_VITALS"
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
"ErrorMessage": null,
|
|
124
|
-
"IsOK": true
|
|
125
|
-
}
|
|
126
|
-
```
|
|
82
|
+
1. Dashboard
|
|
83
|
+
2. Profile image upload and update
|
|
84
|
+
3. ID document upload, capture, and submit
|
|
85
|
+
4. Insurance upload, capture, submit, and retrieval
|
|
86
|
+
5. Account actions
|
|
127
87
|
|
|
128
88
|
---
|
|
129
89
|
|
|
90
|
+
## Dashboard methods
|
|
91
|
+
|
|
130
92
|
### Get Dashboard
|
|
131
93
|
|
|
132
94
|
Public signature: `settingsClient.getDashboard()`
|
|
133
95
|
|
|
134
|
-
Returns the
|
|
96
|
+
Returns the authenticated patient dashboard.
|
|
135
97
|
|
|
136
98
|
```ts
|
|
137
99
|
const dashboard = await settingsClient.getDashboard();
|
|
@@ -153,50 +115,74 @@ Status:
|
|
|
153
115
|
{
|
|
154
116
|
"Data": {
|
|
155
117
|
"Record": {
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"HasInsurance": false,
|
|
162
|
-
"HasIDCard": false,
|
|
118
|
+
"Status": 0,
|
|
119
|
+
"Sex": "Male",
|
|
120
|
+
"GenderIdentity": "Male",
|
|
121
|
+
"HasInsurance": true,
|
|
122
|
+
"HasIDCard": true,
|
|
163
123
|
"HasSelfie": true,
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"PatientImageURL": "https://storage.example.com/selfie_example.jpeg"
|
|
124
|
+
"Flags": {
|
|
125
|
+
"IsVerified": "true",
|
|
126
|
+
"NeedsInsurance": "false"
|
|
168
127
|
}
|
|
169
128
|
},
|
|
170
|
-
"Encounters": [
|
|
171
|
-
|
|
129
|
+
"Encounters": [
|
|
130
|
+
{
|
|
131
|
+
"FHIRID": "test-fhir-id-001",
|
|
132
|
+
"AthenaID": "test-athena-id-001",
|
|
133
|
+
"Status": 0,
|
|
134
|
+
"Patient": null,
|
|
135
|
+
"EncounterClass": "ambulatory",
|
|
136
|
+
"EHR": "athena",
|
|
137
|
+
"EHRType": "Athena Health",
|
|
138
|
+
"EHRVisitName": "Office Visit",
|
|
139
|
+
"EHRAppointmentID": "test-appointment-id-001",
|
|
140
|
+
"EHRProviderID": "test-provider-id-001",
|
|
141
|
+
"EHRProviderName": "Test Provider",
|
|
142
|
+
"EHRDate": "04/22/2026",
|
|
143
|
+
"EHRStatus": "Finished",
|
|
144
|
+
"EHRStage": "completed"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"EHR": "athena",
|
|
172
148
|
"PendingActions": [
|
|
149
|
+
"ADD_INSURANCE",
|
|
173
150
|
"ADD_ID",
|
|
174
151
|
"IMPORT_VITALS"
|
|
175
152
|
]
|
|
176
153
|
},
|
|
177
|
-
"
|
|
178
|
-
"
|
|
154
|
+
"IsOK": true,
|
|
155
|
+
"ErrorMessage": null
|
|
179
156
|
}
|
|
180
157
|
```
|
|
181
158
|
|
|
182
159
|
---
|
|
183
160
|
|
|
184
|
-
|
|
161
|
+
## Upload and capture flow
|
|
185
162
|
|
|
186
|
-
|
|
163
|
+
Image-related methods follow the same upload flow:
|
|
187
164
|
|
|
188
|
-
|
|
189
|
-
|
|
165
|
+
1. Request upload information by calling the matching canned URL method.
|
|
166
|
+
2. Upload the file bytes to the returned upload URL outside this package.
|
|
167
|
+
3. Include any signed headers required by the upload URL, such as `x-amz-acl: public-read` when provided.
|
|
168
|
+
4. Submit the returned file name or file key through the matching capture or update method.
|
|
169
|
+
|
|
170
|
+
The connector does not upload file bytes. It requests upload information and then submits the uploaded file reference after the upload is complete.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Profile image methods
|
|
175
|
+
|
|
176
|
+
### Get User Image Canned URL
|
|
177
|
+
|
|
178
|
+
Public signature: `settingsClient.getUserImageCannedUrl(extension)`
|
|
179
|
+
|
|
180
|
+
Generates upload information for a user profile image.
|
|
181
|
+
|
|
182
|
+
Use the returned upload information to upload the image file outside this package. If the upload URL requires signed headers, include them in the upload request.
|
|
190
183
|
|
|
191
184
|
```ts
|
|
192
|
-
await settingsClient.
|
|
193
|
-
InsurancePackageId: "693245",
|
|
194
|
-
MemberId: "member-id-example",
|
|
195
|
-
FirstName: "John",
|
|
196
|
-
LastName: "Doe",
|
|
197
|
-
Sex: "",
|
|
198
|
-
Image: "insurancecard_example.jpeg"
|
|
199
|
-
});
|
|
185
|
+
const selfieUpload = await settingsClient.getUserImageCannedUrl("jpeg");
|
|
200
186
|
```
|
|
201
187
|
|
|
202
188
|
#### Full API request
|
|
@@ -204,12 +190,7 @@ await settingsClient.submitInsurance({
|
|
|
204
190
|
```json
|
|
205
191
|
{
|
|
206
192
|
"Data": {
|
|
207
|
-
"
|
|
208
|
-
"MemberId": "member-id-example",
|
|
209
|
-
"FirstName": "John",
|
|
210
|
-
"LastName": "Doe",
|
|
211
|
-
"Sex": "",
|
|
212
|
-
"Image": "insurancecard_example.jpeg"
|
|
193
|
+
"Extension": "jpeg"
|
|
213
194
|
}
|
|
214
195
|
}
|
|
215
196
|
```
|
|
@@ -225,13 +206,9 @@ Status:
|
|
|
225
206
|
```json
|
|
226
207
|
{
|
|
227
208
|
"Data": {
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"InsuranceType": "Insurance",
|
|
232
|
-
"IssueDate": "01/01/2030",
|
|
233
|
-
"MemberId": "member-id-example",
|
|
234
|
-
"Image": "insurancecard_example.jpeg"
|
|
209
|
+
"ImageURL": "https://storage.example.com/selfie_example.jpeg?signature=example",
|
|
210
|
+
"FileName": "selfie_example.jpeg",
|
|
211
|
+
"Extension": "jpeg"
|
|
235
212
|
},
|
|
236
213
|
"ErrorMessage": null,
|
|
237
214
|
"IsOK": true
|
|
@@ -240,18 +217,18 @@ Status:
|
|
|
240
217
|
|
|
241
218
|
---
|
|
242
219
|
|
|
243
|
-
###
|
|
220
|
+
### Capture User Photo
|
|
244
221
|
|
|
245
|
-
Public signature: `settingsClient.
|
|
222
|
+
Public signature: `settingsClient.captureUserPhoto(fileKey)`
|
|
223
|
+
|
|
224
|
+
Submits the uploaded profile image file key after the image has been uploaded.
|
|
246
225
|
|
|
247
|
-
|
|
248
|
-
The connector returns the raw backend response object for the generated file.
|
|
249
|
-
The package does not upload the file bytes for you.
|
|
250
|
-
When you upload to the returned S3 URL, you must preserve any signed headers that the URL expects.
|
|
251
|
-
In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
|
|
226
|
+
This method should be called after uploading the file using the upload information returned by `getUserImageCannedUrl(...)`.
|
|
252
227
|
|
|
253
228
|
```ts
|
|
254
|
-
const
|
|
229
|
+
const capturedSelfie = await settingsClient.captureUserPhoto(
|
|
230
|
+
"selfie_example.jpeg"
|
|
231
|
+
);
|
|
255
232
|
```
|
|
256
233
|
|
|
257
234
|
#### Full API request
|
|
@@ -259,40 +236,38 @@ const selfieUpload = await settingsClient.getUserImageCannedUrl("jpeg");
|
|
|
259
236
|
```json
|
|
260
237
|
{
|
|
261
238
|
"Data": {
|
|
262
|
-
"
|
|
239
|
+
"Type": "userphoto",
|
|
240
|
+
"FileID": "selfie_example.jpeg"
|
|
263
241
|
}
|
|
264
242
|
}
|
|
265
243
|
```
|
|
266
244
|
|
|
267
245
|
#### API response
|
|
268
246
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
```txt
|
|
272
|
-
200
|
|
273
|
-
```
|
|
247
|
+
The client returns the backend response from the capture request.
|
|
274
248
|
|
|
275
249
|
```json
|
|
276
250
|
{
|
|
277
|
-
"
|
|
278
|
-
|
|
279
|
-
|
|
251
|
+
"Data": {
|
|
252
|
+
"CapturedData": null,
|
|
253
|
+
"IsCaptured": true,
|
|
254
|
+
"InsurancePackages": null
|
|
255
|
+
},
|
|
256
|
+
"ErrorMessage": null,
|
|
257
|
+
"IsOK": true
|
|
280
258
|
}
|
|
281
259
|
```
|
|
282
260
|
|
|
283
261
|
---
|
|
284
262
|
|
|
285
|
-
###
|
|
263
|
+
### Update User Image URL
|
|
286
264
|
|
|
287
|
-
Public signature: `settingsClient.
|
|
265
|
+
Public signature: `settingsClient.updateUserImage(fileName)`
|
|
288
266
|
|
|
289
|
-
|
|
290
|
-
The client sends `Type: "userphoto"` and the uploaded file key inside the backend `Data` wrapper.
|
|
291
|
-
This method expects the file to have already been uploaded to the canned URL returned by `getUserImageCannedUrl(...)`.
|
|
292
|
-
If the canned URL requires signed S3 headers, the upload must include them before capture can succeed.
|
|
267
|
+
Updates the stored user image reference using a file name returned from `getUserImageCannedUrl(...)`.
|
|
293
268
|
|
|
294
269
|
```ts
|
|
295
|
-
const
|
|
270
|
+
const updated = await settingsClient.updateUserImage(
|
|
296
271
|
"selfie_example.jpeg"
|
|
297
272
|
);
|
|
298
273
|
```
|
|
@@ -302,27 +277,34 @@ const capturedSelfie = await settingsClient.captureUserPhoto(
|
|
|
302
277
|
```json
|
|
303
278
|
{
|
|
304
279
|
"Data": {
|
|
305
|
-
"
|
|
306
|
-
"FileID": "selfie_example.jpeg"
|
|
280
|
+
"FileName": "selfie_example.jpeg"
|
|
307
281
|
}
|
|
308
282
|
}
|
|
309
283
|
```
|
|
310
284
|
|
|
311
285
|
#### API response
|
|
312
286
|
|
|
313
|
-
|
|
314
|
-
|
|
287
|
+
Status:
|
|
288
|
+
|
|
289
|
+
```txt
|
|
290
|
+
200
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
true
|
|
295
|
+
```
|
|
315
296
|
|
|
316
297
|
---
|
|
317
298
|
|
|
299
|
+
## ID document methods
|
|
300
|
+
|
|
318
301
|
### Get Driving License Canned URL
|
|
319
302
|
|
|
320
303
|
Public signature: `settingsClient.getDrivingLicenseCannedUrl(extension)`
|
|
321
304
|
|
|
322
|
-
Generates
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
|
|
305
|
+
Generates upload information for an ID document image.
|
|
306
|
+
|
|
307
|
+
Use the returned upload information to upload the image file outside this package. If the upload URL requires signed headers, include them in the upload request.
|
|
326
308
|
|
|
327
309
|
```ts
|
|
328
310
|
const idUpload = await settingsClient.getDrivingLicenseCannedUrl("jpeg");
|
|
@@ -348,9 +330,13 @@ Status:
|
|
|
348
330
|
|
|
349
331
|
```json
|
|
350
332
|
{
|
|
351
|
-
"
|
|
352
|
-
|
|
353
|
-
|
|
333
|
+
"Data": {
|
|
334
|
+
"ImageURL": "https://storage.example.com/idcard_example.jpeg?signature=example",
|
|
335
|
+
"FileName": "idcard_example.jpeg",
|
|
336
|
+
"Extension": "jpeg"
|
|
337
|
+
},
|
|
338
|
+
"ErrorMessage": null,
|
|
339
|
+
"IsOK": true
|
|
354
340
|
}
|
|
355
341
|
```
|
|
356
342
|
|
|
@@ -360,9 +346,9 @@ Status:
|
|
|
360
346
|
|
|
361
347
|
Public signature: `settingsClient.captureDrivingLicense(fileKey)`
|
|
362
348
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
This method
|
|
349
|
+
Submits the uploaded ID document file key after the image has been uploaded.
|
|
350
|
+
|
|
351
|
+
This method should be called after uploading the file using the upload information returned by `getDrivingLicenseCannedUrl(...)`.
|
|
366
352
|
|
|
367
353
|
```ts
|
|
368
354
|
const capturedLicense = await settingsClient.captureDrivingLicense(
|
|
@@ -414,15 +400,14 @@ Status:
|
|
|
414
400
|
|
|
415
401
|
---
|
|
416
402
|
|
|
417
|
-
###
|
|
403
|
+
### Submit Driving License
|
|
418
404
|
|
|
419
|
-
Public signature: `settingsClient.
|
|
405
|
+
Public signature: `settingsClient.submitDrivingLicense(payload)`
|
|
420
406
|
|
|
421
|
-
|
|
422
|
-
The client resolves the current `EHR` internally from `authClient.getUserInfo()` and sends the payload inside the backend `Data` wrapper.
|
|
407
|
+
Submits patient driving license data.
|
|
423
408
|
|
|
424
409
|
```ts
|
|
425
|
-
const response = await settingsClient.
|
|
410
|
+
const response = await settingsClient.submitDrivingLicense({
|
|
426
411
|
Image: "idcard_example.jpeg"
|
|
427
412
|
});
|
|
428
413
|
```
|
|
@@ -453,23 +438,19 @@ Status:
|
|
|
453
438
|
}
|
|
454
439
|
```
|
|
455
440
|
|
|
456
|
-
`Data` was observed as the string `"true"` in the live test environment after a successful upload and capture flow.
|
|
457
|
-
|
|
458
|
-
`submitDrivingLicense(payload)` is still available as a backward-compatible alias.
|
|
459
|
-
|
|
460
441
|
---
|
|
442
|
+
## Insurance methods
|
|
461
443
|
|
|
462
|
-
###
|
|
444
|
+
### Get Insurance Canned URL
|
|
463
445
|
|
|
464
|
-
Public signature: `settingsClient.
|
|
446
|
+
Public signature: `settingsClient.getInsuranceCannedUrl(extension)`
|
|
465
447
|
|
|
466
|
-
|
|
467
|
-
|
|
448
|
+
Generates upload information for an insurance card image.
|
|
449
|
+
|
|
450
|
+
Use the returned upload information to upload the image file outside this package. If the upload URL requires signed headers, include them in the upload request.
|
|
468
451
|
|
|
469
452
|
```ts
|
|
470
|
-
const
|
|
471
|
-
Image: "idcard_example.jpeg"
|
|
472
|
-
});
|
|
453
|
+
const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpeg");
|
|
473
454
|
```
|
|
474
455
|
|
|
475
456
|
#### Full API request
|
|
@@ -477,7 +458,7 @@ const response = await settingsClient.submitDrivingLicense({
|
|
|
477
458
|
```json
|
|
478
459
|
{
|
|
479
460
|
"Data": {
|
|
480
|
-
"
|
|
461
|
+
"Extension": "jpeg"
|
|
481
462
|
}
|
|
482
463
|
}
|
|
483
464
|
```
|
|
@@ -492,7 +473,11 @@ Status:
|
|
|
492
473
|
|
|
493
474
|
```json
|
|
494
475
|
{
|
|
495
|
-
"Data":
|
|
476
|
+
"Data": {
|
|
477
|
+
"ImageURL": "https://storage.example.com/insurancecard_example.jpeg?signature=example",
|
|
478
|
+
"FileName": "insurancecard_example.jpeg",
|
|
479
|
+
"Extension": "jpeg"
|
|
480
|
+
},
|
|
496
481
|
"ErrorMessage": null,
|
|
497
482
|
"IsOK": true
|
|
498
483
|
}
|
|
@@ -500,17 +485,18 @@ Status:
|
|
|
500
485
|
|
|
501
486
|
---
|
|
502
487
|
|
|
503
|
-
###
|
|
488
|
+
### Capture Insurance
|
|
504
489
|
|
|
505
|
-
Public signature: `settingsClient.
|
|
490
|
+
Public signature: `settingsClient.captureInsurance(fileKey)`
|
|
506
491
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
|
|
492
|
+
Submits the uploaded insurance file key after the image has been uploaded.
|
|
493
|
+
|
|
494
|
+
This method should be called after uploading the file using the upload information returned by `getInsuranceCannedUrl(...)`.
|
|
511
495
|
|
|
512
496
|
```ts
|
|
513
|
-
const
|
|
497
|
+
const capturedInsurance = await settingsClient.captureInsurance(
|
|
498
|
+
"insurancecard_example.jpeg"
|
|
499
|
+
);
|
|
514
500
|
```
|
|
515
501
|
|
|
516
502
|
#### Full API request
|
|
@@ -518,7 +504,8 @@ const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpeg");
|
|
|
518
504
|
```json
|
|
519
505
|
{
|
|
520
506
|
"Data": {
|
|
521
|
-
"
|
|
507
|
+
"Type": "healthinsurance",
|
|
508
|
+
"FileID": "insurancecard_example.jpeg"
|
|
522
509
|
}
|
|
523
510
|
}
|
|
524
511
|
```
|
|
@@ -533,26 +520,43 @@ Status:
|
|
|
533
520
|
|
|
534
521
|
```json
|
|
535
522
|
{
|
|
536
|
-
"
|
|
537
|
-
|
|
538
|
-
|
|
523
|
+
"Data": {
|
|
524
|
+
"CapturedData": {
|
|
525
|
+
"FirstName": "John",
|
|
526
|
+
"LastName": "Doe",
|
|
527
|
+
"MemberId": "member-id-example",
|
|
528
|
+
"GroupNumber": "group-number-example",
|
|
529
|
+
"EffectiveDate": "",
|
|
530
|
+
"RxBIN": "",
|
|
531
|
+
"RxPCN": "",
|
|
532
|
+
"RxGRP": "",
|
|
533
|
+
"Carrier": "Carrier Example"
|
|
534
|
+
},
|
|
535
|
+
"IsCaptured": true,
|
|
536
|
+
"InsurancePackages": null
|
|
537
|
+
},
|
|
538
|
+
"ErrorMessage": null,
|
|
539
|
+
"IsOK": true
|
|
539
540
|
}
|
|
540
541
|
```
|
|
541
542
|
|
|
542
543
|
---
|
|
543
544
|
|
|
544
|
-
###
|
|
545
|
+
### Submit Insurance
|
|
545
546
|
|
|
546
|
-
Public signature: `settingsClient.
|
|
547
|
+
Public signature: `settingsClient.submitInsurance(payload)`
|
|
547
548
|
|
|
548
|
-
|
|
549
|
-
The client sends `Type: "healthinsurance"` and the uploaded file key inside the backend `Data` wrapper.
|
|
550
|
-
This method expects the file to have already been uploaded to the canned URL returned by `getInsuranceCannedUrl(...)`.
|
|
549
|
+
Submits patient insurance coverage details.
|
|
551
550
|
|
|
552
551
|
```ts
|
|
553
|
-
|
|
554
|
-
"
|
|
555
|
-
|
|
552
|
+
await settingsClient.submitInsurance({
|
|
553
|
+
InsurancePackageId: "693245",
|
|
554
|
+
MemberId: "member-id-example",
|
|
555
|
+
FirstName: "John",
|
|
556
|
+
LastName: "Doe",
|
|
557
|
+
Sex: "",
|
|
558
|
+
Image: "insurancecard_example.jpeg"
|
|
559
|
+
});
|
|
556
560
|
```
|
|
557
561
|
|
|
558
562
|
#### Full API request
|
|
@@ -560,8 +564,12 @@ const capturedInsurance = await settingsClient.captureInsurance(
|
|
|
560
564
|
```json
|
|
561
565
|
{
|
|
562
566
|
"Data": {
|
|
563
|
-
"
|
|
564
|
-
"
|
|
567
|
+
"InsurancePackageId": "693245",
|
|
568
|
+
"MemberId": "member-id-example",
|
|
569
|
+
"FirstName": "John",
|
|
570
|
+
"LastName": "Doe",
|
|
571
|
+
"Sex": "",
|
|
572
|
+
"Image": "insurancecard_example.jpeg"
|
|
565
573
|
}
|
|
566
574
|
}
|
|
567
575
|
```
|
|
@@ -577,19 +585,13 @@ Status:
|
|
|
577
585
|
```json
|
|
578
586
|
{
|
|
579
587
|
"Data": {
|
|
580
|
-
"
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
"RxPCN": "",
|
|
588
|
-
"RxGRP": "",
|
|
589
|
-
"Carrier": "Carrier Example"
|
|
590
|
-
},
|
|
591
|
-
"IsCaptured": true,
|
|
592
|
-
"InsurancePackages": null
|
|
588
|
+
"InsuranceId": "insurance-id-example",
|
|
589
|
+
"InsurancePackageId": 693245,
|
|
590
|
+
"InsurancePolicyHolder": "John Doe",
|
|
591
|
+
"InsuranceType": "Insurance",
|
|
592
|
+
"IssueDate": "01/01/2030",
|
|
593
|
+
"MemberId": "member-id-example",
|
|
594
|
+
"Image": "insurancecard_example.jpeg"
|
|
593
595
|
},
|
|
594
596
|
"ErrorMessage": null,
|
|
595
597
|
"IsOK": true
|
|
@@ -602,8 +604,7 @@ Status:
|
|
|
602
604
|
|
|
603
605
|
Public signature: `settingsClient.getInsurances()`
|
|
604
606
|
|
|
605
|
-
Returns patient insurances
|
|
606
|
-
The client resolves the current `EHR` internally from `authClient.getUserInfo()`.
|
|
607
|
+
Returns patient insurances.
|
|
607
608
|
|
|
608
609
|
```ts
|
|
609
610
|
const insurances = await settingsClient.getInsurances();
|
|
@@ -645,41 +646,7 @@ Status:
|
|
|
645
646
|
|
|
646
647
|
---
|
|
647
648
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
Public signature: `settingsClient.updateUserImage(fileName)`
|
|
651
|
-
|
|
652
|
-
Updates the stored user image file reference using a file name returned from `getUserImageCannedUrl(...)`.
|
|
653
|
-
|
|
654
|
-
```ts
|
|
655
|
-
const updated = await settingsClient.updateUserImage(
|
|
656
|
-
"selfie_example.jpeg"
|
|
657
|
-
);
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
#### Full API request
|
|
661
|
-
|
|
662
|
-
```json
|
|
663
|
-
{
|
|
664
|
-
"Data": {
|
|
665
|
-
"FileName": "selfie_example.jpeg"
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
```
|
|
669
|
-
|
|
670
|
-
#### API response
|
|
671
|
-
|
|
672
|
-
Status:
|
|
673
|
-
|
|
674
|
-
```txt
|
|
675
|
-
200
|
|
676
|
-
```
|
|
677
|
-
|
|
678
|
-
```json
|
|
679
|
-
true
|
|
680
|
-
```
|
|
681
|
-
|
|
682
|
-
---
|
|
649
|
+
## Account methods
|
|
683
650
|
|
|
684
651
|
### Deactivate User
|
|
685
652
|
|
|
@@ -701,48 +668,35 @@ await settingsClient.deactivateUser();
|
|
|
701
668
|
|
|
702
669
|
#### API response
|
|
703
670
|
|
|
704
|
-
|
|
705
|
-
|
|
671
|
+
The client returns the backend response from the authenticated request.
|
|
672
|
+
|
|
673
|
+
```json
|
|
674
|
+
{
|
|
675
|
+
"Data": true,
|
|
676
|
+
"ErrorMessage": null,
|
|
677
|
+
"IsOK": true
|
|
678
|
+
}
|
|
679
|
+
```
|
|
706
680
|
|
|
707
681
|
---
|
|
708
682
|
|
|
709
683
|
## How It Works
|
|
710
684
|
|
|
711
685
|
- `HCLoginClient` handles tenant configuration, authentication, and authenticated headers.
|
|
712
|
-
- `HCSettingsClient` uses the authenticated login client
|
|
713
|
-
-
|
|
714
|
-
-
|
|
715
|
-
-
|
|
686
|
+
- `HCSettingsClient` uses the authenticated login client for the base API URL and authenticated request headers.
|
|
687
|
+
- If configured through `setApiKey(...)`, `HCSettingsClient` also includes its configured API key header with Settings connector requests.
|
|
688
|
+
- Upload URL methods return generated upload information. The caller is responsible for uploading the actual file bytes outside this package.
|
|
689
|
+
- Capture methods submit the uploaded file key after the file has already been uploaded.
|
|
716
690
|
|
|
717
691
|
---
|
|
718
692
|
|
|
719
693
|
## Notes
|
|
720
694
|
|
|
721
|
-
- `HCLoginClient` must be configured and logged in before calling
|
|
722
|
-
-
|
|
723
|
-
- After requesting
|
|
724
|
-
-
|
|
725
|
-
- `captureUserPhoto()` sends `Type: "userphoto"` and `FileID`
|
|
726
|
-
- `captureDrivingLicense()` sends `Type: "identification"` and `FileID`
|
|
727
|
-
- `captureInsurance()` sends `Type: "healthinsurance"` and `FileID`
|
|
728
|
-
- `
|
|
729
|
-
- `submitDrivingLicense()` is a backward-compatible alias of `updateDrivingLicense()`.
|
|
730
|
-
- `getInsurances()`, `updateDrivingLicense()`, and `submitDrivingLicense()` internally resolve the current patient's `EHR`.
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
## API Key
|
|
734
|
-
|
|
735
|
-
All outgoing requests from `HCSettingsClient` can include an optional API key header.
|
|
736
|
-
|
|
737
|
-
```ts
|
|
738
|
-
const apiKey = process.env.HEALTHCLOUD_API_KEY;
|
|
739
|
-
|
|
740
|
-
if (apiKey) {
|
|
741
|
-
settingsClient.setApiKey("x-api-key", apiKey);
|
|
742
|
-
}
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
- Header name should be `x-api-key`.
|
|
746
|
-
- API key is optional unless required by the backend.
|
|
747
|
-
- If not set, behavior remains unchanged and the header is omitted.
|
|
748
|
-
- The API key is also included on the internal patient header lookup used to resolve the active `EHR`.
|
|
695
|
+
- `HCLoginClient` must be configured and logged in before calling Settings connector methods.
|
|
696
|
+
- Canned URL methods return the backend response containing upload information in `Data`.
|
|
697
|
+
- After requesting upload information, the file must be uploaded outside this package before capture methods can succeed.
|
|
698
|
+
- When uploading to the returned storage URL, include any signed headers required by that URL, such as `x-amz-acl: public-read` when provided.
|
|
699
|
+
- `captureUserPhoto()` sends `Type: "userphoto"` and `FileID` inside the request body.
|
|
700
|
+
- `captureDrivingLicense()` sends the ID document file key using `Type: "identification"` and `FileID` inside the request body.
|
|
701
|
+
- `captureInsurance()` sends `Type: "healthinsurance"` and `FileID` inside the request body.
|
|
702
|
+
- `submitDrivingLicense()` submits the driving license data payload.
|
package/dist/index.cjs
CHANGED
|
@@ -27,22 +27,44 @@ __export(index_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
30
|
+
// src/errors.ts
|
|
31
|
+
var ConfigError = class extends Error {
|
|
32
|
+
constructor(message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = "ConfigError";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var AuthError = class extends Error {
|
|
38
|
+
constructor(message) {
|
|
39
|
+
super(message);
|
|
40
|
+
this.name = "AuthError";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var HttpError = class extends Error {
|
|
44
|
+
constructor(status, message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.name = "HttpError";
|
|
47
|
+
this.status = status;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
30
51
|
// src/client.ts
|
|
31
52
|
var HCSettingsClient = class {
|
|
32
53
|
constructor(httpClient, authClient) {
|
|
33
|
-
this.resolvedEhr = null;
|
|
34
54
|
this.http = httpClient;
|
|
35
55
|
this.auth = authClient;
|
|
36
56
|
}
|
|
37
57
|
setApiKey(headerName, value) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
const trimmedHeaderName = headerName == null ? void 0 : headerName.trim();
|
|
59
|
+
const trimmedValue = value == null ? void 0 : value.trim();
|
|
60
|
+
if (!trimmedHeaderName) {
|
|
61
|
+
throw new ConfigError("API key header name is required.");
|
|
62
|
+
}
|
|
63
|
+
if (!trimmedValue) {
|
|
64
|
+
throw new ConfigError("API key value is required.");
|
|
65
|
+
}
|
|
66
|
+
this.apiKeyHeaderName = trimmedHeaderName;
|
|
67
|
+
this.apiKeyValue = trimmedValue;
|
|
46
68
|
}
|
|
47
69
|
async getDashboard() {
|
|
48
70
|
return this.http.get(
|
|
@@ -51,46 +73,40 @@ var HCSettingsClient = class {
|
|
|
51
73
|
);
|
|
52
74
|
}
|
|
53
75
|
async getUserImageCannedUrl(extension) {
|
|
54
|
-
var _a;
|
|
55
76
|
const payload = {
|
|
56
77
|
Data: {
|
|
57
78
|
Extension: extension
|
|
58
79
|
}
|
|
59
80
|
};
|
|
60
|
-
|
|
81
|
+
return this.http.put(
|
|
61
82
|
`${this.getBaseUrl()}/patient/image/cannedurl`,
|
|
62
83
|
payload,
|
|
63
84
|
this.getJsonHeaders()
|
|
64
85
|
);
|
|
65
|
-
return (_a = response.Data) != null ? _a : response;
|
|
66
86
|
}
|
|
67
87
|
async getDrivingLicenseCannedUrl(extension) {
|
|
68
|
-
var _a;
|
|
69
88
|
const payload = {
|
|
70
89
|
Data: {
|
|
71
90
|
Extension: extension
|
|
72
91
|
}
|
|
73
92
|
};
|
|
74
|
-
|
|
93
|
+
return this.http.put(
|
|
75
94
|
`${this.getBaseUrl()}/patient/id/cannedurl`,
|
|
76
95
|
payload,
|
|
77
96
|
this.getJsonHeaders()
|
|
78
97
|
);
|
|
79
|
-
return (_a = response.Data) != null ? _a : response;
|
|
80
98
|
}
|
|
81
99
|
async getInsuranceCannedUrl(extension) {
|
|
82
|
-
var _a;
|
|
83
100
|
const payload = {
|
|
84
101
|
Data: {
|
|
85
102
|
Extension: extension
|
|
86
103
|
}
|
|
87
104
|
};
|
|
88
|
-
|
|
105
|
+
return this.http.put(
|
|
89
106
|
`${this.getBaseUrl()}/patient/insurance/cannedurl`,
|
|
90
107
|
payload,
|
|
91
108
|
this.getJsonHeaders()
|
|
92
109
|
);
|
|
93
|
-
return (_a = response.Data) != null ? _a : response;
|
|
94
110
|
}
|
|
95
111
|
async captureUserPhoto(fileKey) {
|
|
96
112
|
const payload = {
|
|
@@ -143,36 +159,31 @@ var HCSettingsClient = class {
|
|
|
143
159
|
}
|
|
144
160
|
async getInsurances() {
|
|
145
161
|
return this.http.get(
|
|
146
|
-
|
|
162
|
+
`${this.getBaseUrl()}/ehr/patient/insurances`,
|
|
147
163
|
this.getAuthHeaders()
|
|
148
164
|
);
|
|
149
165
|
}
|
|
150
|
-
async
|
|
166
|
+
async submitDrivingLicense(payload) {
|
|
151
167
|
const requestPayload = {
|
|
152
168
|
Data: payload
|
|
153
169
|
};
|
|
154
170
|
return this.http.put(
|
|
155
|
-
|
|
171
|
+
`${this.getBaseUrl()}/ehr/patient/drivinglicense`,
|
|
156
172
|
requestPayload,
|
|
157
173
|
this.getJsonHeaders()
|
|
158
174
|
);
|
|
159
175
|
}
|
|
160
|
-
async submitDrivingLicense(payload) {
|
|
161
|
-
return this.updateDrivingLicense(payload);
|
|
162
|
-
}
|
|
163
176
|
async updateUserImage(fileName) {
|
|
164
|
-
var _a;
|
|
165
177
|
const payload = {
|
|
166
178
|
Data: {
|
|
167
179
|
FileName: fileName
|
|
168
180
|
}
|
|
169
181
|
};
|
|
170
|
-
|
|
182
|
+
return this.http.put(
|
|
171
183
|
`${this.getBaseUrl()}/patient/image/url`,
|
|
172
184
|
payload,
|
|
173
185
|
this.getJsonHeaders()
|
|
174
186
|
);
|
|
175
|
-
return (_a = response.Data) != null ? _a : response;
|
|
176
187
|
}
|
|
177
188
|
async deactivateUser() {
|
|
178
189
|
const payload = {
|
|
@@ -184,26 +195,6 @@ var HCSettingsClient = class {
|
|
|
184
195
|
this.getJsonHeaders()
|
|
185
196
|
);
|
|
186
197
|
}
|
|
187
|
-
async buildEhrPatientUrl(path) {
|
|
188
|
-
const ehr = await this.getResolvedEhr();
|
|
189
|
-
return `${this.getBaseUrl()}/ehr/${ehr}/patient/${path}`;
|
|
190
|
-
}
|
|
191
|
-
async getResolvedEhr() {
|
|
192
|
-
var _a, _b, _c;
|
|
193
|
-
if (this.resolvedEhr) {
|
|
194
|
-
return this.resolvedEhr;
|
|
195
|
-
}
|
|
196
|
-
const userInfo = await this.http.get(
|
|
197
|
-
`${this.getBaseUrl()}/patient/header`,
|
|
198
|
-
this.getAuthHeaders()
|
|
199
|
-
);
|
|
200
|
-
const ehr = ((_b = (_a = userInfo == null ? void 0 : userInfo.Data) == null ? void 0 : _a.EHR) == null ? void 0 : _b.trim()) || ((_c = userInfo == null ? void 0 : userInfo.EHR) == null ? void 0 : _c.trim());
|
|
201
|
-
if (!ehr) {
|
|
202
|
-
throw new Error("Could not resolve EHR from patient header response.");
|
|
203
|
-
}
|
|
204
|
-
this.resolvedEhr = ehr;
|
|
205
|
-
return ehr;
|
|
206
|
-
}
|
|
207
198
|
getBaseUrl() {
|
|
208
199
|
return this.auth.getBaseUrl();
|
|
209
200
|
}
|
|
@@ -224,31 +215,10 @@ var HCSettingsClient = class {
|
|
|
224
215
|
return {};
|
|
225
216
|
}
|
|
226
217
|
return {
|
|
227
|
-
|
|
218
|
+
[this.apiKeyHeaderName]: this.apiKeyValue
|
|
228
219
|
};
|
|
229
220
|
}
|
|
230
221
|
};
|
|
231
|
-
|
|
232
|
-
// src/errors.ts
|
|
233
|
-
var ConfigError = class extends Error {
|
|
234
|
-
constructor(message) {
|
|
235
|
-
super(message);
|
|
236
|
-
this.name = "ConfigError";
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
var AuthError = class extends Error {
|
|
240
|
-
constructor(message) {
|
|
241
|
-
super(message);
|
|
242
|
-
this.name = "AuthError";
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
var HttpError = class extends Error {
|
|
246
|
-
constructor(status, message) {
|
|
247
|
-
super(message);
|
|
248
|
-
this.name = "HttpError";
|
|
249
|
-
this.status = status;
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
222
|
// Annotate the CommonJS export names for ESM import in node:
|
|
253
223
|
0 && (module.exports = {
|
|
254
224
|
AuthError,
|
package/dist/index.d.cts
CHANGED
|
@@ -10,21 +10,6 @@ interface UserImage {
|
|
|
10
10
|
fileName?: string;
|
|
11
11
|
extension?: string;
|
|
12
12
|
}
|
|
13
|
-
interface UserInfo {
|
|
14
|
-
ID?: string;
|
|
15
|
-
Email?: string;
|
|
16
|
-
TenantID?: string;
|
|
17
|
-
HasInsurance?: boolean;
|
|
18
|
-
HasIDCard?: boolean;
|
|
19
|
-
HasSelfie?: boolean;
|
|
20
|
-
Attributes?: Record<string, any>;
|
|
21
|
-
}
|
|
22
|
-
interface UserInfoResponse {
|
|
23
|
-
Data?: {
|
|
24
|
-
EHR?: string;
|
|
25
|
-
};
|
|
26
|
-
EHR?: string;
|
|
27
|
-
}
|
|
28
13
|
interface APIRequest<T> {
|
|
29
14
|
Data: T;
|
|
30
15
|
}
|
|
@@ -63,17 +48,14 @@ interface DrivingLicenseData {
|
|
|
63
48
|
type DrivingLicenseRequest = APIRequest<DrivingLicenseData>;
|
|
64
49
|
type DrivingLicenseResponse = APIResponse<string>;
|
|
65
50
|
type HCUserImage = UserImage;
|
|
66
|
-
type HCUserInfo = UserInfo;
|
|
67
51
|
|
|
68
52
|
declare class HCSettingsClient {
|
|
69
53
|
private http;
|
|
70
54
|
private auth;
|
|
71
|
-
private resolvedEhr;
|
|
72
55
|
private apiKeyHeaderName?;
|
|
73
56
|
private apiKeyValue?;
|
|
74
57
|
constructor(httpClient: HttpClient, authClient: HCLoginClient);
|
|
75
58
|
setApiKey(headerName: string, value: string): void;
|
|
76
|
-
getUserInfo(): Promise<any>;
|
|
77
59
|
getDashboard(): Promise<any>;
|
|
78
60
|
getUserImageCannedUrl(extension: string): Promise<UserImage>;
|
|
79
61
|
getDrivingLicenseCannedUrl(extension: string): Promise<UserImage>;
|
|
@@ -83,12 +65,9 @@ declare class HCSettingsClient {
|
|
|
83
65
|
captureInsurance(fileKey: string): Promise<any>;
|
|
84
66
|
submitInsurance(payload: CoverageRequest): Promise<any>;
|
|
85
67
|
getInsurances(): Promise<any>;
|
|
86
|
-
updateDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
|
|
87
68
|
submitDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
|
|
88
69
|
updateUserImage(fileName: string): Promise<any>;
|
|
89
70
|
deactivateUser(): Promise<any>;
|
|
90
|
-
private buildEhrPatientUrl;
|
|
91
|
-
private getResolvedEhr;
|
|
92
71
|
private getBaseUrl;
|
|
93
72
|
private getAuthHeaders;
|
|
94
73
|
private getJsonHeaders;
|
|
@@ -106,4 +85,4 @@ declare class HttpError extends Error {
|
|
|
106
85
|
constructor(status: number, message: string);
|
|
107
86
|
}
|
|
108
87
|
|
|
109
|
-
export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage,
|
|
88
|
+
export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,21 +10,6 @@ interface UserImage {
|
|
|
10
10
|
fileName?: string;
|
|
11
11
|
extension?: string;
|
|
12
12
|
}
|
|
13
|
-
interface UserInfo {
|
|
14
|
-
ID?: string;
|
|
15
|
-
Email?: string;
|
|
16
|
-
TenantID?: string;
|
|
17
|
-
HasInsurance?: boolean;
|
|
18
|
-
HasIDCard?: boolean;
|
|
19
|
-
HasSelfie?: boolean;
|
|
20
|
-
Attributes?: Record<string, any>;
|
|
21
|
-
}
|
|
22
|
-
interface UserInfoResponse {
|
|
23
|
-
Data?: {
|
|
24
|
-
EHR?: string;
|
|
25
|
-
};
|
|
26
|
-
EHR?: string;
|
|
27
|
-
}
|
|
28
13
|
interface APIRequest<T> {
|
|
29
14
|
Data: T;
|
|
30
15
|
}
|
|
@@ -63,17 +48,14 @@ interface DrivingLicenseData {
|
|
|
63
48
|
type DrivingLicenseRequest = APIRequest<DrivingLicenseData>;
|
|
64
49
|
type DrivingLicenseResponse = APIResponse<string>;
|
|
65
50
|
type HCUserImage = UserImage;
|
|
66
|
-
type HCUserInfo = UserInfo;
|
|
67
51
|
|
|
68
52
|
declare class HCSettingsClient {
|
|
69
53
|
private http;
|
|
70
54
|
private auth;
|
|
71
|
-
private resolvedEhr;
|
|
72
55
|
private apiKeyHeaderName?;
|
|
73
56
|
private apiKeyValue?;
|
|
74
57
|
constructor(httpClient: HttpClient, authClient: HCLoginClient);
|
|
75
58
|
setApiKey(headerName: string, value: string): void;
|
|
76
|
-
getUserInfo(): Promise<any>;
|
|
77
59
|
getDashboard(): Promise<any>;
|
|
78
60
|
getUserImageCannedUrl(extension: string): Promise<UserImage>;
|
|
79
61
|
getDrivingLicenseCannedUrl(extension: string): Promise<UserImage>;
|
|
@@ -83,12 +65,9 @@ declare class HCSettingsClient {
|
|
|
83
65
|
captureInsurance(fileKey: string): Promise<any>;
|
|
84
66
|
submitInsurance(payload: CoverageRequest): Promise<any>;
|
|
85
67
|
getInsurances(): Promise<any>;
|
|
86
|
-
updateDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
|
|
87
68
|
submitDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
|
|
88
69
|
updateUserImage(fileName: string): Promise<any>;
|
|
89
70
|
deactivateUser(): Promise<any>;
|
|
90
|
-
private buildEhrPatientUrl;
|
|
91
|
-
private getResolvedEhr;
|
|
92
71
|
private getBaseUrl;
|
|
93
72
|
private getAuthHeaders;
|
|
94
73
|
private getJsonHeaders;
|
|
@@ -106,4 +85,4 @@ declare class HttpError extends Error {
|
|
|
106
85
|
constructor(status: number, message: string);
|
|
107
86
|
}
|
|
108
87
|
|
|
109
|
-
export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage,
|
|
88
|
+
export { type APIRequest, type APIResponse, AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type DrivingLicenseResponse, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
1
|
+
// src/errors.ts
|
|
2
|
+
var ConfigError = class extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "ConfigError";
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
var AuthError = class extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "AuthError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var HttpError = class extends Error {
|
|
15
|
+
constructor(status, message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = "HttpError";
|
|
18
|
+
this.status = status;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
1
22
|
// src/client.ts
|
|
2
23
|
var HCSettingsClient = class {
|
|
3
24
|
constructor(httpClient, authClient) {
|
|
4
|
-
this.resolvedEhr = null;
|
|
5
25
|
this.http = httpClient;
|
|
6
26
|
this.auth = authClient;
|
|
7
27
|
}
|
|
8
28
|
setApiKey(headerName, value) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
const trimmedHeaderName = headerName == null ? void 0 : headerName.trim();
|
|
30
|
+
const trimmedValue = value == null ? void 0 : value.trim();
|
|
31
|
+
if (!trimmedHeaderName) {
|
|
32
|
+
throw new ConfigError("API key header name is required.");
|
|
33
|
+
}
|
|
34
|
+
if (!trimmedValue) {
|
|
35
|
+
throw new ConfigError("API key value is required.");
|
|
36
|
+
}
|
|
37
|
+
this.apiKeyHeaderName = trimmedHeaderName;
|
|
38
|
+
this.apiKeyValue = trimmedValue;
|
|
17
39
|
}
|
|
18
40
|
async getDashboard() {
|
|
19
41
|
return this.http.get(
|
|
@@ -22,46 +44,40 @@ var HCSettingsClient = class {
|
|
|
22
44
|
);
|
|
23
45
|
}
|
|
24
46
|
async getUserImageCannedUrl(extension) {
|
|
25
|
-
var _a;
|
|
26
47
|
const payload = {
|
|
27
48
|
Data: {
|
|
28
49
|
Extension: extension
|
|
29
50
|
}
|
|
30
51
|
};
|
|
31
|
-
|
|
52
|
+
return this.http.put(
|
|
32
53
|
`${this.getBaseUrl()}/patient/image/cannedurl`,
|
|
33
54
|
payload,
|
|
34
55
|
this.getJsonHeaders()
|
|
35
56
|
);
|
|
36
|
-
return (_a = response.Data) != null ? _a : response;
|
|
37
57
|
}
|
|
38
58
|
async getDrivingLicenseCannedUrl(extension) {
|
|
39
|
-
var _a;
|
|
40
59
|
const payload = {
|
|
41
60
|
Data: {
|
|
42
61
|
Extension: extension
|
|
43
62
|
}
|
|
44
63
|
};
|
|
45
|
-
|
|
64
|
+
return this.http.put(
|
|
46
65
|
`${this.getBaseUrl()}/patient/id/cannedurl`,
|
|
47
66
|
payload,
|
|
48
67
|
this.getJsonHeaders()
|
|
49
68
|
);
|
|
50
|
-
return (_a = response.Data) != null ? _a : response;
|
|
51
69
|
}
|
|
52
70
|
async getInsuranceCannedUrl(extension) {
|
|
53
|
-
var _a;
|
|
54
71
|
const payload = {
|
|
55
72
|
Data: {
|
|
56
73
|
Extension: extension
|
|
57
74
|
}
|
|
58
75
|
};
|
|
59
|
-
|
|
76
|
+
return this.http.put(
|
|
60
77
|
`${this.getBaseUrl()}/patient/insurance/cannedurl`,
|
|
61
78
|
payload,
|
|
62
79
|
this.getJsonHeaders()
|
|
63
80
|
);
|
|
64
|
-
return (_a = response.Data) != null ? _a : response;
|
|
65
81
|
}
|
|
66
82
|
async captureUserPhoto(fileKey) {
|
|
67
83
|
const payload = {
|
|
@@ -114,36 +130,31 @@ var HCSettingsClient = class {
|
|
|
114
130
|
}
|
|
115
131
|
async getInsurances() {
|
|
116
132
|
return this.http.get(
|
|
117
|
-
|
|
133
|
+
`${this.getBaseUrl()}/ehr/patient/insurances`,
|
|
118
134
|
this.getAuthHeaders()
|
|
119
135
|
);
|
|
120
136
|
}
|
|
121
|
-
async
|
|
137
|
+
async submitDrivingLicense(payload) {
|
|
122
138
|
const requestPayload = {
|
|
123
139
|
Data: payload
|
|
124
140
|
};
|
|
125
141
|
return this.http.put(
|
|
126
|
-
|
|
142
|
+
`${this.getBaseUrl()}/ehr/patient/drivinglicense`,
|
|
127
143
|
requestPayload,
|
|
128
144
|
this.getJsonHeaders()
|
|
129
145
|
);
|
|
130
146
|
}
|
|
131
|
-
async submitDrivingLicense(payload) {
|
|
132
|
-
return this.updateDrivingLicense(payload);
|
|
133
|
-
}
|
|
134
147
|
async updateUserImage(fileName) {
|
|
135
|
-
var _a;
|
|
136
148
|
const payload = {
|
|
137
149
|
Data: {
|
|
138
150
|
FileName: fileName
|
|
139
151
|
}
|
|
140
152
|
};
|
|
141
|
-
|
|
153
|
+
return this.http.put(
|
|
142
154
|
`${this.getBaseUrl()}/patient/image/url`,
|
|
143
155
|
payload,
|
|
144
156
|
this.getJsonHeaders()
|
|
145
157
|
);
|
|
146
|
-
return (_a = response.Data) != null ? _a : response;
|
|
147
158
|
}
|
|
148
159
|
async deactivateUser() {
|
|
149
160
|
const payload = {
|
|
@@ -155,26 +166,6 @@ var HCSettingsClient = class {
|
|
|
155
166
|
this.getJsonHeaders()
|
|
156
167
|
);
|
|
157
168
|
}
|
|
158
|
-
async buildEhrPatientUrl(path) {
|
|
159
|
-
const ehr = await this.getResolvedEhr();
|
|
160
|
-
return `${this.getBaseUrl()}/ehr/${ehr}/patient/${path}`;
|
|
161
|
-
}
|
|
162
|
-
async getResolvedEhr() {
|
|
163
|
-
var _a, _b, _c;
|
|
164
|
-
if (this.resolvedEhr) {
|
|
165
|
-
return this.resolvedEhr;
|
|
166
|
-
}
|
|
167
|
-
const userInfo = await this.http.get(
|
|
168
|
-
`${this.getBaseUrl()}/patient/header`,
|
|
169
|
-
this.getAuthHeaders()
|
|
170
|
-
);
|
|
171
|
-
const ehr = ((_b = (_a = userInfo == null ? void 0 : userInfo.Data) == null ? void 0 : _a.EHR) == null ? void 0 : _b.trim()) || ((_c = userInfo == null ? void 0 : userInfo.EHR) == null ? void 0 : _c.trim());
|
|
172
|
-
if (!ehr) {
|
|
173
|
-
throw new Error("Could not resolve EHR from patient header response.");
|
|
174
|
-
}
|
|
175
|
-
this.resolvedEhr = ehr;
|
|
176
|
-
return ehr;
|
|
177
|
-
}
|
|
178
169
|
getBaseUrl() {
|
|
179
170
|
return this.auth.getBaseUrl();
|
|
180
171
|
}
|
|
@@ -195,31 +186,10 @@ var HCSettingsClient = class {
|
|
|
195
186
|
return {};
|
|
196
187
|
}
|
|
197
188
|
return {
|
|
198
|
-
|
|
189
|
+
[this.apiKeyHeaderName]: this.apiKeyValue
|
|
199
190
|
};
|
|
200
191
|
}
|
|
201
192
|
};
|
|
202
|
-
|
|
203
|
-
// src/errors.ts
|
|
204
|
-
var ConfigError = class extends Error {
|
|
205
|
-
constructor(message) {
|
|
206
|
-
super(message);
|
|
207
|
-
this.name = "ConfigError";
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
var AuthError = class extends Error {
|
|
211
|
-
constructor(message) {
|
|
212
|
-
super(message);
|
|
213
|
-
this.name = "AuthError";
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
var HttpError = class extends Error {
|
|
217
|
-
constructor(status, message) {
|
|
218
|
-
super(message);
|
|
219
|
-
this.name = "HttpError";
|
|
220
|
-
this.status = status;
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
193
|
export {
|
|
224
194
|
AuthError,
|
|
225
195
|
ConfigError,
|