@healthcloudai/hc-settings-connector 0.0.4 → 0.0.6

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 CHANGED
@@ -1,24 +1,22 @@
1
1
  # Healthcheck Settings Connector
2
2
 
3
- This library provides a client for accessing **user settings and profile-related data**
4
- from the Healthcheck API.
3
+ This library provides a client for authenticated user settings, profile image,
4
+ identification, insurance, and dashboard-related flows in Healthcheck.
5
5
  It is built on top of the shared Healthcheck HTTP and Login connectors.
6
+
6
7
  ---
7
8
 
8
9
  ## Features
9
- 1. Retrieve patient dashboard data
10
- 2. Generate a pre-signed URL for user selfie upload
11
- 3. Capture user selfie from uploaded file key
12
- 4. Generate a pre-signed URL for driving license / ID upload
13
- 5. Capture driving license / ID data from uploaded file key
14
- 6. Submit driving license / ID data
15
- 7. Generate a pre-signed URL for insurance upload
16
- 8. Capture insurance data from uploaded file key
17
- 9. Submit user insurance
18
- 10. Retrieve patient insurances
19
- 11. Update user profile image URL
20
- 12. Self deactivate user
21
- 13. Built on shared Healthcheck HttpClient and authentication layer
10
+ 1. Retrieve the authenticated patient profile
11
+ 2. Retrieve the authenticated patient dashboard
12
+ 3. Generate canned upload URLs for selfie, ID, and insurance images
13
+ 4. Capture selfie, identification, and insurance documents from uploaded file keys
14
+ 5. Update or submit driving license data through the resolved EHR route
15
+ 6. Submit patient insurance coverage details
16
+ 7. Retrieve patient insurances through the resolved EHR route
17
+ 8. Update the stored user image file reference
18
+ 9. Deactivate the authenticated user
19
+ 10. Built on the shared Healthcheck HttpClient and authentication layer
22
20
 
23
21
  ---
24
22
 
@@ -50,8 +48,8 @@ import { FetchClient } from "@healthcloudai/hc-http";
50
48
  const httpClient = new FetchClient();
51
49
  const authClient = new HCLoginClient(httpClient);
52
50
 
53
- authClient.configure("tenant-id", "dev");
54
- await authClient.login("john.doe@test.com", "password");
51
+ authClient.configure("demo-tenant", "dev");
52
+ await authClient.login("john.doe@example.com", "ExamplePassword123!");
55
53
 
56
54
  const settingsClient = new HCSettingsClient(
57
55
  httpClient,
@@ -67,24 +65,120 @@ const settingsClient = new HCSettingsClient(
67
65
 
68
66
  Public signature: `settingsClient.getUserInfo()`
69
67
 
70
- Returns the current patient profile data.
68
+ Returns the current authenticated patient profile.
71
69
 
72
70
  ```ts
73
71
  const userInfo = await settingsClient.getUserInfo();
74
72
  ```
75
73
 
74
+ #### Full API request
75
+
76
+ This method performs an authenticated request internally and does not send a request body.
77
+
78
+ #### API response
79
+
80
+ Status:
81
+
82
+ ```txt
83
+ 200
84
+ ```
85
+
86
+ ```json
87
+ {
88
+ "Data": {
89
+ "Record": {
90
+ "ID": "record-id-example",
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
+ ```
127
+
76
128
  ---
77
129
 
78
130
  ### Get Dashboard
79
131
 
80
132
  Public signature: `settingsClient.getDashboard()`
81
133
 
82
- Returns the current patient dashboard response.
134
+ Returns the current authenticated patient dashboard response.
83
135
 
84
136
  ```ts
85
137
  const dashboard = await settingsClient.getDashboard();
86
138
  ```
87
139
 
140
+ #### Full API request
141
+
142
+ This method performs an authenticated request internally and does not send a request body.
143
+
144
+ #### API response
145
+
146
+ Status:
147
+
148
+ ```txt
149
+ 200
150
+ ```
151
+
152
+ ```json
153
+ {
154
+ "Data": {
155
+ "Record": {
156
+ "ID": "record-id-example",
157
+ "TenantID": "demo-tenant",
158
+ "FirstName": "John",
159
+ "LastName": "Doe",
160
+ "Email": "john.doe@example.com",
161
+ "HasInsurance": false,
162
+ "HasIDCard": false,
163
+ "HasSelfie": true,
164
+ "Attributes": {
165
+ "FHIRPatientID": "patient-id-example",
166
+ "CompositeID": "composite-id-example",
167
+ "PatientImageURL": "https://storage.example.com/selfie_example.jpeg"
168
+ }
169
+ },
170
+ "Encounters": [],
171
+ "EHR": "fhir",
172
+ "PendingActions": [
173
+ "ADD_ID",
174
+ "IMPORT_VITALS"
175
+ ]
176
+ },
177
+ "ErrorMessage": null,
178
+ "IsOK": true
179
+ }
180
+ ```
181
+
88
182
  ---
89
183
 
90
184
  ### Submit Insurance
@@ -92,160 +186,546 @@ const dashboard = await settingsClient.getDashboard();
92
186
  Public signature: `settingsClient.submitInsurance(payload)`
93
187
 
94
188
  Submits patient insurance coverage details.
189
+ The client forwards the provided payload into the backend `Data` wrapper.
95
190
 
96
191
  ```ts
97
192
  await settingsClient.submitInsurance({
98
193
  InsurancePackageId: "693245",
99
- MemberId: "096304628",
194
+ MemberId: "member-id-example",
100
195
  FirstName: "John",
101
- LastName: "Smith",
196
+ LastName: "Doe",
102
197
  Sex: "",
103
- Image: "1765886686136.png"
198
+ Image: "insurancecard_example.jpeg"
104
199
  });
105
200
  ```
106
201
 
202
+ #### Full API request
203
+
204
+ ```json
205
+ {
206
+ "Data": {
207
+ "InsurancePackageId": "693245",
208
+ "MemberId": "member-id-example",
209
+ "FirstName": "John",
210
+ "LastName": "Doe",
211
+ "Sex": "",
212
+ "Image": "insurancecard_example.jpeg"
213
+ }
214
+ }
215
+ ```
216
+
217
+ #### API response
218
+
219
+ Status:
220
+
221
+ ```txt
222
+ 200
223
+ ```
224
+
225
+ ```json
226
+ {
227
+ "Data": {
228
+ "InsuranceId": "insurance-id-example",
229
+ "InsurancePackageId": 693245,
230
+ "InsurancePolicyHolder": "John Doe",
231
+ "InsuranceType": "Insurance",
232
+ "IssueDate": "01/01/2030",
233
+ "MemberId": "member-id-example",
234
+ "Image": "insurancecard_example.jpeg"
235
+ },
236
+ "ErrorMessage": null,
237
+ "IsOK": true
238
+ }
239
+ ```
240
+
241
+ ---
242
+
107
243
  ### Get User Image Canned URL
108
244
 
109
245
  Public signature: `settingsClient.getUserImageCannedUrl(extension)`
110
246
 
111
- Generates a pre-signed upload URL for a user selfie file.
247
+ Generates a canned upload URL for a user selfie file.
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`.
112
252
 
113
253
  ```ts
114
- const selfieUpload = await settingsClient.getUserImageCannedUrl("jpg");
254
+ const selfieUpload = await settingsClient.getUserImageCannedUrl("jpeg");
115
255
  ```
116
256
 
257
+ #### Full API request
258
+
259
+ ```json
260
+ {
261
+ "Data": {
262
+ "Extension": "jpeg"
263
+ }
264
+ }
265
+ ```
266
+
267
+ #### API response
268
+
269
+ Status:
270
+
271
+ ```txt
272
+ 200
273
+ ```
274
+
275
+ ```json
276
+ {
277
+ "ImageURL": "https://storage.example.com/selfie_example.jpeg?signature=example",
278
+ "FileName": "selfie_example.jpeg",
279
+ "Extension": "jpeg"
280
+ }
281
+ ```
282
+
283
+ ---
284
+
117
285
  ### Capture User Photo
118
286
 
119
287
  Public signature: `settingsClient.captureUserPhoto(fileKey)`
120
288
 
121
- Captures a user selfie through `POST /patient/capture`.
122
- The client internally sends `Type: "userphoto"` and `FileID: fileKey`.
289
+ Convenience wrapper around the patient capture endpoint.
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.
123
293
 
124
294
  ```ts
125
295
  const capturedSelfie = await settingsClient.captureUserPhoto(
126
- "selfie_639064123637965380.jpg"
296
+ "selfie_example.jpeg"
127
297
  );
128
298
  ```
129
299
 
300
+ #### Full API request
301
+
302
+ ```json
303
+ {
304
+ "Data": {
305
+ "Type": "userphoto",
306
+ "FileID": "selfie_example.jpeg"
307
+ }
308
+ }
309
+ ```
310
+
311
+ #### API response
312
+
313
+ Direct success response for a selfie image was not verified in the latest live run.
314
+ The same upload prerequisite applies here as for the ID and insurance flows: the file must exist at the canned URL upload target, and any signed S3 headers such as `x-amz-acl: public-read` must be preserved during upload.
315
+
316
+ ---
317
+
130
318
  ### Get Driving License Canned URL
131
319
 
132
320
  Public signature: `settingsClient.getDrivingLicenseCannedUrl(extension)`
133
321
 
134
- Generates a pre-signed upload URL for a driving license / ID file.
322
+ Generates a canned upload URL for a driving license or identification file.
323
+ The package does not upload the file bytes for you.
324
+ When you upload to the returned S3 URL, you must preserve any signed headers that the URL expects.
325
+ In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
135
326
 
136
327
  ```ts
137
- const idUpload = await settingsClient.getDrivingLicenseCannedUrl("jpg");
328
+ const idUpload = await settingsClient.getDrivingLicenseCannedUrl("jpeg");
329
+ ```
330
+
331
+ #### Full API request
332
+
333
+ ```json
334
+ {
335
+ "Data": {
336
+ "Extension": "jpeg"
337
+ }
338
+ }
138
339
  ```
139
340
 
341
+ #### API response
342
+
343
+ Status:
344
+
345
+ ```txt
346
+ 200
347
+ ```
348
+
349
+ ```json
350
+ {
351
+ "ImageURL": "https://storage.example.com/idcard_example.jpeg?signature=example",
352
+ "FileName": "idcard_example.jpeg",
353
+ "Extension": "jpeg"
354
+ }
355
+ ```
356
+
357
+ ---
358
+
140
359
  ### Capture Driving License
141
360
 
142
361
  Public signature: `settingsClient.captureDrivingLicense(fileKey)`
143
362
 
144
- Captures and extracts patient identification data through `POST /patient/capture`.
145
- The client internally sends `Type: "identification"` and `FileID: fileKey`.
363
+ Convenience wrapper around the patient capture endpoint.
364
+ The client sends `Type: "identification"` and the uploaded file key inside the backend `Data` wrapper.
365
+ This method expects the file to have already been uploaded to the canned URL returned by `getDrivingLicenseCannedUrl(...)`.
146
366
 
147
367
  ```ts
148
368
  const capturedLicense = await settingsClient.captureDrivingLicense(
149
- "drivers-license-front.jpg"
369
+ "idcard_example.jpeg"
150
370
  );
151
371
  ```
152
372
 
373
+ #### Full API request
374
+
375
+ ```json
376
+ {
377
+ "Data": {
378
+ "Type": "identification",
379
+ "FileID": "idcard_example.jpeg"
380
+ }
381
+ }
382
+ ```
383
+
384
+ #### API response
385
+
386
+ Status:
387
+
388
+ ```txt
389
+ 200
390
+ ```
391
+
392
+ ```json
393
+ {
394
+ "Data": {
395
+ "CapturedData": {
396
+ "FirstName": "John",
397
+ "LastName": "Doe",
398
+ "StreetAddress": "123 Main St",
399
+ "City": "Springfield",
400
+ "ZipCode": "90210",
401
+ "State": "California",
402
+ "IssuedDate": "01/01/2024",
403
+ "ExpiresDate": "01/01/2028",
404
+ "Dob": "01/01/1990",
405
+ "IDNumber": null
406
+ },
407
+ "IsCaptured": true,
408
+ "InsurancePackages": null
409
+ },
410
+ "ErrorMessage": null,
411
+ "IsOK": true
412
+ }
413
+ ```
414
+
415
+ ---
416
+
417
+ ### Update Driving License
418
+
419
+ Public signature: `settingsClient.updateDrivingLicense(payload)`
420
+
421
+ Updates patient driving license data through the EHR-backed route.
422
+ The client resolves the current `EHR` internally from `authClient.getUserInfo()` and sends the payload inside the backend `Data` wrapper.
423
+
424
+ ```ts
425
+ const response = await settingsClient.updateDrivingLicense({
426
+ Image: "idcard_example.jpeg"
427
+ });
428
+ ```
429
+
430
+ #### Full API request
431
+
432
+ ```json
433
+ {
434
+ "Data": {
435
+ "Image": "idcard_example.jpeg"
436
+ }
437
+ }
438
+ ```
439
+
440
+ #### API response
441
+
442
+ Status:
443
+
444
+ ```txt
445
+ 200
446
+ ```
447
+
448
+ ```json
449
+ {
450
+ "Data": "true",
451
+ "ErrorMessage": null,
452
+ "IsOK": true
453
+ }
454
+ ```
455
+
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
+ ---
461
+
153
462
  ### Submit Driving License
154
463
 
155
464
  Public signature: `settingsClient.submitDrivingLicense(payload)`
156
465
 
157
- Submits patient driving license data through the wrapper-backed EHR route.
158
- The client resolves the current patient's `EHR` internally from `authClient.getUserInfo()`
159
- and sends the payload inside the backend `Data` wrapper.
466
+ Backward-compatible alias for `updateDrivingLicense(payload)`.
467
+ It sends the same request payload and currently calls the same implementation internally.
160
468
 
161
469
  ```ts
162
- await settingsClient.submitDrivingLicense({
163
- Number: "DL-123456",
164
- State: "CA"
470
+ const response = await settingsClient.submitDrivingLicense({
471
+ Image: "idcard_example.jpeg"
165
472
  });
166
473
  ```
167
474
 
475
+ #### Full API request
476
+
477
+ ```json
478
+ {
479
+ "Data": {
480
+ "Image": "idcard_example.jpeg"
481
+ }
482
+ }
483
+ ```
484
+
485
+ #### API response
486
+
487
+ Status:
488
+
489
+ ```txt
490
+ 200
491
+ ```
492
+
493
+ ```json
494
+ {
495
+ "Data": "true",
496
+ "ErrorMessage": null,
497
+ "IsOK": true
498
+ }
499
+ ```
500
+
501
+ ---
502
+
168
503
  ### Get Insurance Canned URL
169
504
 
170
505
  Public signature: `settingsClient.getInsuranceCannedUrl(extension)`
171
506
 
172
- Generates a pre-signed upload URL for an insurance file.
507
+ Generates a canned upload URL for an insurance file.
508
+ The package does not upload the file bytes for you.
509
+ When you upload to the returned S3 URL, you must preserve any signed headers that the URL expects.
510
+ In live verification, uploads succeeded only when the S3 request included `x-amz-acl: public-read`.
173
511
 
174
512
  ```ts
175
- const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpg");
513
+ const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpeg");
514
+ ```
515
+
516
+ #### Full API request
517
+
518
+ ```json
519
+ {
520
+ "Data": {
521
+ "Extension": "jpeg"
522
+ }
523
+ }
524
+ ```
525
+
526
+ #### API response
527
+
528
+ Status:
529
+
530
+ ```txt
531
+ 200
176
532
  ```
177
533
 
534
+ ```json
535
+ {
536
+ "ImageURL": "https://storage.example.com/insurancecard_example.jpeg?signature=example",
537
+ "FileName": "insurancecard_example.jpeg",
538
+ "Extension": "jpeg"
539
+ }
540
+ ```
541
+
542
+ ---
543
+
178
544
  ### Capture Insurance
179
545
 
180
546
  Public signature: `settingsClient.captureInsurance(fileKey)`
181
547
 
182
- Captures and extracts insurance data through `POST /patient/capture`.
183
- The client internally sends `Type: "healthinsurance"` and `FileID: fileKey`.
548
+ Convenience wrapper around the patient capture endpoint.
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(...)`.
184
551
 
185
552
  ```ts
186
553
  const capturedInsurance = await settingsClient.captureInsurance(
187
- "insurance-card-front.jpg"
554
+ "insurancecard_example.jpeg"
188
555
  );
189
556
  ```
190
557
 
558
+ #### Full API request
559
+
560
+ ```json
561
+ {
562
+ "Data": {
563
+ "Type": "healthinsurance",
564
+ "FileID": "insurancecard_example.jpeg"
565
+ }
566
+ }
567
+ ```
568
+
569
+ #### API response
570
+
571
+ Status:
572
+
573
+ ```txt
574
+ 200
575
+ ```
576
+
577
+ ```json
578
+ {
579
+ "Data": {
580
+ "CapturedData": {
581
+ "FirstName": "John",
582
+ "LastName": "Doe",
583
+ "MemberId": "member-id-example",
584
+ "GroupNumber": "group-number-example",
585
+ "EffectiveDate": "",
586
+ "RxBIN": "",
587
+ "RxPCN": "",
588
+ "RxGRP": "",
589
+ "Carrier": "Carrier Example"
590
+ },
591
+ "IsCaptured": true,
592
+ "InsurancePackages": null
593
+ },
594
+ "ErrorMessage": null,
595
+ "IsOK": true
596
+ }
597
+ ```
598
+
599
+ ---
600
+
191
601
  ### Get Insurances
192
602
 
193
603
  Public signature: `settingsClient.getInsurances()`
194
604
 
195
- Returns patient insurances through the wrapper-backed EHR route.
196
- The client resolves the current patient's `EHR` internally from `authClient.getUserInfo()`.
605
+ Returns patient insurances through the EHR-backed route.
606
+ The client resolves the current `EHR` internally from `authClient.getUserInfo()`.
197
607
 
198
608
  ```ts
199
609
  const insurances = await settingsClient.getInsurances();
200
610
  ```
201
611
 
612
+ #### Full API request
613
+
614
+ This method performs an authenticated request internally and does not send a request body.
615
+
616
+ #### API response
617
+
618
+ Status:
619
+
620
+ ```txt
621
+ 200
622
+ ```
623
+
624
+ ```json
625
+ {
626
+ "Data": [
627
+ {
628
+ "InsuranceId": "insurance-id-example",
629
+ "InsurancePackageId": 693245,
630
+ "InsurancePolicyHolderFirstName": "John",
631
+ "InsurancePolicyHolderLastName": "Doe",
632
+ "InsurancePolicyHolder": "John Doe",
633
+ "RelationshipToInsured": "Self",
634
+ "EligibilityStatus": "Active",
635
+ "InsurancePlanName": " - ",
636
+ "InsuranceType": "FHIR",
637
+ "MemberId": "member-id-example",
638
+ "Image": "insurancecard_example.jpeg"
639
+ }
640
+ ],
641
+ "ErrorMessage": null,
642
+ "IsOK": true
643
+ }
644
+ ```
645
+
646
+ ---
647
+
202
648
  ### Update User Image URL
203
649
 
204
650
  Public signature: `settingsClient.updateUserImage(fileName)`
205
651
 
206
- Updates the user profile image URL using a file name.
652
+ Updates the stored user image file reference using a file name returned from `getUserImageCannedUrl(...)`.
207
653
 
208
654
  ```ts
209
- await settingsClient.updateUserImage("selfie_639064123637965380.jpg");
655
+ const updated = await settingsClient.updateUserImage(
656
+ "selfie_example.jpeg"
657
+ );
210
658
  ```
211
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
+ ---
683
+
212
684
  ### Deactivate User
213
685
 
214
686
  Public signature: `settingsClient.deactivateUser()`
215
687
 
216
- Deactivates the current user.
688
+ Deactivates the current authenticated user.
217
689
 
218
690
  ```ts
219
691
  await settingsClient.deactivateUser();
220
692
  ```
221
693
 
222
- ---
223
-
224
- ## How It Works
694
+ #### Full API request
225
695
 
226
- - **HCLoginClient**
227
- - Handles authentication
228
- - Resolves base API URL
229
- - Provides authorization headers
230
- - Resolves the current user's `EHR` for EHR-backed settings methods
696
+ ```json
697
+ {
698
+ "Data": {}
699
+ }
700
+ ```
231
701
 
232
- - **HttpClient**
233
- - Performs all HTTP requests
702
+ #### API response
234
703
 
235
- - **HCSettingsClient**
236
- - Exposes user settings and profile-related endpoints
704
+ This method was not directly verified in the live environment because it would deactivate the authenticated test user.
705
+ The client returns the raw backend response from the authenticated `PUT` request.
237
706
 
238
707
  ---
239
708
 
240
- ## Notes
709
+ ## How It Works
710
+
711
+ - `HCLoginClient` handles tenant configuration, authentication, and authenticated headers.
712
+ - `HCSettingsClient` uses the authenticated login client to call patient settings and profile-related endpoints.
713
+ - Canned URL methods return a backend-generated upload URL and file name, but the caller is responsible for uploading the file bytes and preserving any signed S3 headers required by that URL.
714
+ - Capture, insurance, and EHR-backed settings methods all use the authenticated patient context from the shared login client.
715
+ - `getInsurances()`, `updateDrivingLicense()`, and `submitDrivingLicense()` resolve the active patient's `EHR` internally before building the final route.
241
716
 
242
- - `HCLoginClient` must be configured and logged in before calling settings methods
243
- - `getUserImageCannedUrl()` uses `PUT /patient/image/cannedurl`
244
- - `getDrivingLicenseCannedUrl()` uses `PUT /patient/id/cannedurl`
245
- - `getInsuranceCannedUrl()` uses `PUT /patient/insurance/cannedurl`
246
- - `captureUserPhoto()` sends `Type: "userphoto"` and `FileID` to `/patient/capture`
247
- - `captureDrivingLicense()` sends `Type: "identification"` and `FileID` to `/patient/capture`
248
- - `captureInsurance()` sends `Type: "healthinsurance"` and `FileID` to `/patient/capture`
249
- - `getInsurances()` and `submitDrivingLicense()` internally resolve the current patient's `EHR`
717
+ ---
250
718
 
719
+ ## Notes
251
720
 
721
+ - `HCLoginClient` must be configured and logged in before calling settings methods.
722
+ - `getUserImageCannedUrl()`, `getDrivingLicenseCannedUrl()`, and `getInsuranceCannedUrl()` return the backend canned URL response and do not upload the file contents.
723
+ - After requesting a canned URL, the file must be uploaded outside this package before capture methods can succeed.
724
+ - Live verification showed that the S3 upload must preserve signed headers from the canned URL; when `x-amz-acl` was signed, uploads succeeded with `x-amz-acl: public-read`.
725
+ - `captureUserPhoto()` sends `Type: "userphoto"` and `FileID` to the patient capture endpoint.
726
+ - `captureDrivingLicense()` sends `Type: "identification"` and `FileID` to the patient capture endpoint.
727
+ - `captureInsurance()` sends `Type: "healthinsurance"` and `FileID` to the patient capture endpoint.
728
+ - `updateDrivingLicense()` and `submitDrivingLicense()` send `{ "Data": { "Image": "..." } }` to the resolved EHR patient route.
729
+ - `submitDrivingLicense()` is a backward-compatible alias of `updateDrivingLicense()`.
730
+ - `getInsurances()`, `updateDrivingLicense()`, and `submitDrivingLicense()` internally resolve the current patient's `EHR`.
731
+ - Live verification showed the canned URL methods returning `ImageURL`, `FileName`, and `Extension` keys from the backend response.
package/dist/index.cjs CHANGED
@@ -164,7 +164,7 @@ var HCSettingsClient = class {
164
164
  this.auth.getAuthHeader()
165
165
  );
166
166
  }
167
- async submitDrivingLicense(payload) {
167
+ async updateDrivingLicense(payload) {
168
168
  const requestPayload = {
169
169
  Data: payload
170
170
  };
@@ -177,6 +177,9 @@ var HCSettingsClient = class {
177
177
  }
178
178
  );
179
179
  }
180
+ async submitDrivingLicense(payload) {
181
+ return this.updateDrivingLicense(payload);
182
+ }
180
183
  async updateUserImage(fileName) {
181
184
  var _a;
182
185
  const payload = {
package/dist/index.d.cts CHANGED
@@ -3,9 +3,12 @@ import { HttpClient } from '@healthcloudai/hc-http';
3
3
 
4
4
  type Environment = "dev" | "uat" | "prod";
5
5
  interface UserImage {
6
- imageUrl: string;
7
- fileName: string;
8
- extension: string;
6
+ ImageURL: string;
7
+ FileName: string;
8
+ Extension: string;
9
+ imageUrl?: string;
10
+ fileName?: string;
11
+ extension?: string;
9
12
  }
10
13
  interface UserInfo {
11
14
  ID?: string;
@@ -22,6 +25,14 @@ interface UserInfoResponse {
22
25
  };
23
26
  EHR?: string;
24
27
  }
28
+ interface APIRequest<T> {
29
+ Data: T;
30
+ }
31
+ interface APIResponse<T> {
32
+ Data: T;
33
+ IsOK: boolean;
34
+ ErrorMessage?: string | null;
35
+ }
25
36
  interface CoverageRequest {
26
37
  InsurancePackageId: string;
27
38
  MemberId: string;
@@ -30,36 +41,27 @@ interface CoverageRequest {
30
41
  Sex: string;
31
42
  Image: string;
32
43
  }
33
- interface CoveragePayload {
34
- Data: CoverageRequest;
35
- }
44
+ type CoveragePayload = APIRequest<CoverageRequest>;
36
45
  type CaptureType = "identification" | "healthinsurance" | "userphoto";
37
46
  interface CaptureData {
38
47
  Type: CaptureType;
39
48
  FileID: string;
40
49
  }
41
- interface CaptureRequest {
42
- Data: CaptureData;
43
- }
50
+ type CaptureRequest = APIRequest<CaptureData>;
44
51
  interface UploadImageData {
45
52
  Extension: string;
46
53
  }
47
- interface UploadImageRequest {
48
- Data: UploadImageData;
49
- }
54
+ type UploadImageRequest = APIRequest<UploadImageData>;
50
55
  interface UpdateImageData {
51
56
  FileName: string;
52
57
  }
53
- interface UpdateImageRequest {
54
- Data: UpdateImageData;
55
- }
56
- interface EmptyRequest {
57
- Data: Record<string, never>;
58
- }
59
- type DrivingLicenseData = Record<string, string | number | boolean | null>;
60
- interface DrivingLicenseRequest {
61
- Data: DrivingLicenseData;
58
+ type UpdateImageRequest = APIRequest<UpdateImageData>;
59
+ type EmptyRequest = APIRequest<Record<string, never>>;
60
+ interface DrivingLicenseData {
61
+ Image: string;
62
62
  }
63
+ type DrivingLicenseRequest = APIRequest<DrivingLicenseData>;
64
+ type DrivingLicenseResponse = APIResponse<string>;
63
65
  type HCUserImage = UserImage;
64
66
  type HCUserInfo = UserInfo;
65
67
 
@@ -78,8 +80,9 @@ declare class HCSettingsClient {
78
80
  captureInsurance(fileKey: string): Promise<any>;
79
81
  submitInsurance(payload: CoverageRequest): Promise<any>;
80
82
  getInsurances(): Promise<any>;
81
- submitDrivingLicense(payload: DrivingLicenseData): Promise<any>;
82
- updateUserImage(fileName: string): Promise<UserImage>;
83
+ updateDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
84
+ submitDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
85
+ updateUserImage(fileName: string): Promise<any>;
83
86
  deactivateUser(): Promise<any>;
84
87
  private buildEhrPatientUrl;
85
88
  private getResolvedEhr;
@@ -96,4 +99,4 @@ declare class HttpError extends Error {
96
99
  constructor(status: number, message: string);
97
100
  }
98
101
 
99
- export { AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo, type UserInfoResponse };
102
+ 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, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo, type UserInfoResponse };
package/dist/index.d.ts CHANGED
@@ -3,9 +3,12 @@ import { HttpClient } from '@healthcloudai/hc-http';
3
3
 
4
4
  type Environment = "dev" | "uat" | "prod";
5
5
  interface UserImage {
6
- imageUrl: string;
7
- fileName: string;
8
- extension: string;
6
+ ImageURL: string;
7
+ FileName: string;
8
+ Extension: string;
9
+ imageUrl?: string;
10
+ fileName?: string;
11
+ extension?: string;
9
12
  }
10
13
  interface UserInfo {
11
14
  ID?: string;
@@ -22,6 +25,14 @@ interface UserInfoResponse {
22
25
  };
23
26
  EHR?: string;
24
27
  }
28
+ interface APIRequest<T> {
29
+ Data: T;
30
+ }
31
+ interface APIResponse<T> {
32
+ Data: T;
33
+ IsOK: boolean;
34
+ ErrorMessage?: string | null;
35
+ }
25
36
  interface CoverageRequest {
26
37
  InsurancePackageId: string;
27
38
  MemberId: string;
@@ -30,36 +41,27 @@ interface CoverageRequest {
30
41
  Sex: string;
31
42
  Image: string;
32
43
  }
33
- interface CoveragePayload {
34
- Data: CoverageRequest;
35
- }
44
+ type CoveragePayload = APIRequest<CoverageRequest>;
36
45
  type CaptureType = "identification" | "healthinsurance" | "userphoto";
37
46
  interface CaptureData {
38
47
  Type: CaptureType;
39
48
  FileID: string;
40
49
  }
41
- interface CaptureRequest {
42
- Data: CaptureData;
43
- }
50
+ type CaptureRequest = APIRequest<CaptureData>;
44
51
  interface UploadImageData {
45
52
  Extension: string;
46
53
  }
47
- interface UploadImageRequest {
48
- Data: UploadImageData;
49
- }
54
+ type UploadImageRequest = APIRequest<UploadImageData>;
50
55
  interface UpdateImageData {
51
56
  FileName: string;
52
57
  }
53
- interface UpdateImageRequest {
54
- Data: UpdateImageData;
55
- }
56
- interface EmptyRequest {
57
- Data: Record<string, never>;
58
- }
59
- type DrivingLicenseData = Record<string, string | number | boolean | null>;
60
- interface DrivingLicenseRequest {
61
- Data: DrivingLicenseData;
58
+ type UpdateImageRequest = APIRequest<UpdateImageData>;
59
+ type EmptyRequest = APIRequest<Record<string, never>>;
60
+ interface DrivingLicenseData {
61
+ Image: string;
62
62
  }
63
+ type DrivingLicenseRequest = APIRequest<DrivingLicenseData>;
64
+ type DrivingLicenseResponse = APIResponse<string>;
63
65
  type HCUserImage = UserImage;
64
66
  type HCUserInfo = UserInfo;
65
67
 
@@ -78,8 +80,9 @@ declare class HCSettingsClient {
78
80
  captureInsurance(fileKey: string): Promise<any>;
79
81
  submitInsurance(payload: CoverageRequest): Promise<any>;
80
82
  getInsurances(): Promise<any>;
81
- submitDrivingLicense(payload: DrivingLicenseData): Promise<any>;
82
- updateUserImage(fileName: string): Promise<UserImage>;
83
+ updateDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
84
+ submitDrivingLicense(payload: DrivingLicenseData): Promise<DrivingLicenseResponse>;
85
+ updateUserImage(fileName: string): Promise<any>;
83
86
  deactivateUser(): Promise<any>;
84
87
  private buildEhrPatientUrl;
85
88
  private getResolvedEhr;
@@ -96,4 +99,4 @@ declare class HttpError extends Error {
96
99
  constructor(status: number, message: string);
97
100
  }
98
101
 
99
- export { AuthError, type CaptureData, type CaptureRequest, type CaptureType, ConfigError, type CoveragePayload, type CoverageRequest, type DrivingLicenseData, type DrivingLicenseRequest, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo, type UserInfoResponse };
102
+ 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, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo, type UserInfoResponse };
package/dist/index.js CHANGED
@@ -135,7 +135,7 @@ var HCSettingsClient = class {
135
135
  this.auth.getAuthHeader()
136
136
  );
137
137
  }
138
- async submitDrivingLicense(payload) {
138
+ async updateDrivingLicense(payload) {
139
139
  const requestPayload = {
140
140
  Data: payload
141
141
  };
@@ -148,6 +148,9 @@ var HCSettingsClient = class {
148
148
  }
149
149
  );
150
150
  }
151
+ async submitDrivingLicense(payload) {
152
+ return this.updateDrivingLicense(payload);
153
+ }
151
154
  async updateUserImage(fileName) {
152
155
  var _a;
153
156
  const payload = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthcloudai/hc-settings-connector",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Healthcheck Settings SDK with TypeScript",
5
5
  "author": "Healthcheck Systems Inc",
6
6
  "license": "MIT",