@healthcloudai/hc-settings-connector 0.2.1 → 0.2.3
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 +161 -3
- package/dist/index.cjs +48 -0
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ This connector gives authenticated patients access to account information and do
|
|
|
13
13
|
3. Submit uploaded identification and insurance images for capture.
|
|
14
14
|
4. Submit and retrieve insurance information.
|
|
15
15
|
5. Update the patient profile image.
|
|
16
|
-
6.
|
|
16
|
+
6. Capture registration documents before the patient is authenticated.
|
|
17
|
+
7. Deactivate the authenticated patient account.
|
|
17
18
|
|
|
18
19
|
---
|
|
19
20
|
|
|
@@ -59,7 +60,7 @@ const settingsClient = new HCSettingsClient(
|
|
|
59
60
|
);
|
|
60
61
|
```
|
|
61
62
|
|
|
62
|
-
`HCLoginClient` must be configured
|
|
63
|
+
`HCLoginClient` must be configured before creating the Settings client. Most Settings methods require an authenticated patient session. `getRegistrationDocumentCannedUrl(...)` and `captureRegistrationDocument(...)` are intended for unauthenticated registration flows and do not send the auth token.
|
|
63
64
|
|
|
64
65
|
---
|
|
65
66
|
|
|
@@ -677,6 +678,161 @@ console.log(response);
|
|
|
677
678
|
|
|
678
679
|
---
|
|
679
680
|
|
|
681
|
+
# Registration Document Capture
|
|
682
|
+
|
|
683
|
+
Registration document capture is used during registration, before the user is authenticated. It sends the same capture request shape as patient capture, but it does not attach the patient authorization token.
|
|
684
|
+
|
|
685
|
+
The full unauthenticated registration document flow is:
|
|
686
|
+
|
|
687
|
+
1. `getRegistrationDocumentCannedUrl(documentType, extension)` — get a presigned upload URL and a `fileKey` (`FileName`), without an auth token.
|
|
688
|
+
2. Upload the file directly to the returned `ImageURL` (`PUT`, with the **`x-amz-acl: public-read`** header — see warning below).
|
|
689
|
+
3. `captureRegistrationDocument(fileKey, type)` — submit the uploaded file's `fileKey` for OCR capture, also without an auth token.
|
|
690
|
+
|
|
691
|
+
## Get Registration Document Canned URL
|
|
692
|
+
|
|
693
|
+
Public signature:
|
|
694
|
+
|
|
695
|
+
```ts
|
|
696
|
+
settingsClient.getRegistrationDocumentCannedUrl(
|
|
697
|
+
documentType,
|
|
698
|
+
extension
|
|
699
|
+
)
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
`documentType` must be one of:
|
|
703
|
+
|
|
704
|
+
```ts
|
|
705
|
+
"identification" | "healthinsurance"
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
Returns a presigned upload URL (`ImageURL`) and a storage `FileName` (used as the `fileKey` for `captureRegistrationDocument`), without sending the patient auth token. Only `loginClient.configure(...)` is required.
|
|
709
|
+
|
|
710
|
+
```ts
|
|
711
|
+
const response =
|
|
712
|
+
await settingsClient.getRegistrationDocumentCannedUrl(
|
|
713
|
+
"identification",
|
|
714
|
+
"png"
|
|
715
|
+
);
|
|
716
|
+
|
|
717
|
+
console.log(response.Data?.ImageURL, response.Data?.FileName);
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
> ⚠️ **You MUST send the `x-amz-acl: public-read` header on the upload PUT request.** The presigned `ImageURL` is signed *with* an `x-amz-acl: public-read` header included in the signature. If your upload request to that URL omits this exact header, S3 recalculates a different signature and rejects the upload with:
|
|
721
|
+
>
|
|
722
|
+
> ```xml
|
|
723
|
+
> <Error>
|
|
724
|
+
> <Code>SignatureDoesNotMatch</Code>
|
|
725
|
+
> <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
|
|
726
|
+
> ...
|
|
727
|
+
> </Error>
|
|
728
|
+
> ```
|
|
729
|
+
>
|
|
730
|
+
> Example upload (must include the header):
|
|
731
|
+
>
|
|
732
|
+
> ```ts
|
|
733
|
+
> await fetch(response.Data!.ImageURL!, {
|
|
734
|
+
> method: "PUT",
|
|
735
|
+
> headers: {
|
|
736
|
+
> "Content-Type": "image/png",
|
|
737
|
+
> "x-amz-acl": "public-read",
|
|
738
|
+
> },
|
|
739
|
+
> body: fileBytes,
|
|
740
|
+
> });
|
|
741
|
+
> ```
|
|
742
|
+
|
|
743
|
+
### API request
|
|
744
|
+
|
|
745
|
+
```json
|
|
746
|
+
{
|
|
747
|
+
"Data": {
|
|
748
|
+
"Extension": "png"
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
### API response
|
|
754
|
+
|
|
755
|
+
```json
|
|
756
|
+
{
|
|
757
|
+
"Data": {
|
|
758
|
+
"ImageURL": "https://storage.example.com/idcard_example.png?X-Amz-Expires=300&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=example&X-Amz-Date=example&X-Amz-SignedHeaders=host%3Bx-amz-acl&X-Amz-Signature=example",
|
|
759
|
+
"FileName": "idcard_example.png",
|
|
760
|
+
"Extension": "png"
|
|
761
|
+
},
|
|
762
|
+
"ErrorMessage": null,
|
|
763
|
+
"IsOK": true
|
|
764
|
+
}
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
## Capture Registration Document
|
|
770
|
+
|
|
771
|
+
Public signature:
|
|
772
|
+
|
|
773
|
+
```ts
|
|
774
|
+
settingsClient.captureRegistrationDocument(
|
|
775
|
+
fileKey,
|
|
776
|
+
type
|
|
777
|
+
)
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
`type` must be one of:
|
|
781
|
+
|
|
782
|
+
```ts
|
|
783
|
+
"identification" | "healthinsurance"
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
Only `loginClient.configure(...)` is required for this method so the connector can resolve the API base URL.
|
|
787
|
+
|
|
788
|
+
```ts
|
|
789
|
+
const response =
|
|
790
|
+
await settingsClient.captureRegistrationDocument(
|
|
791
|
+
"idcard_example.jpeg",
|
|
792
|
+
"identification"
|
|
793
|
+
);
|
|
794
|
+
|
|
795
|
+
console.log(response);
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
### API request
|
|
799
|
+
|
|
800
|
+
```json
|
|
801
|
+
{
|
|
802
|
+
"Data": {
|
|
803
|
+
"Type": "identification",
|
|
804
|
+
"FileID": "idcard_example.jpeg"
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
### API response
|
|
810
|
+
|
|
811
|
+
```json
|
|
812
|
+
{
|
|
813
|
+
"Data": {
|
|
814
|
+
"CapturedData": {
|
|
815
|
+
"FirstName": "John",
|
|
816
|
+
"LastName": "Doe",
|
|
817
|
+
"StreetAddress": "123 Main St",
|
|
818
|
+
"City": "Springfield",
|
|
819
|
+
"ZipCode": "90210",
|
|
820
|
+
"State": "California",
|
|
821
|
+
"IssuedDate": "01/01/2024",
|
|
822
|
+
"ExpiresDate": "01/01/2028",
|
|
823
|
+
"Dob": "01/01/1990",
|
|
824
|
+
"IDNumber": null
|
|
825
|
+
},
|
|
826
|
+
"IsCaptured": true,
|
|
827
|
+
"InsurancePackages": null
|
|
828
|
+
},
|
|
829
|
+
"ErrorMessage": null,
|
|
830
|
+
"IsOK": true
|
|
831
|
+
}
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
---
|
|
835
|
+
|
|
680
836
|
# Account
|
|
681
837
|
|
|
682
838
|
## Deactivate User
|
|
@@ -726,6 +882,8 @@ console.log(response);
|
|
|
726
882
|
* `captureDrivingLicense(...)` internally sends `Type: "identification"`.
|
|
727
883
|
* `captureInsurance(...)` internally sends `Type: "healthinsurance"`.
|
|
728
884
|
* `captureUserPhoto(...)` internally sends `Type: "userphoto"`.
|
|
885
|
+
* `getRegistrationDocumentCannedUrl(...)` and `captureRegistrationDocument(...)` do not send the patient auth token.
|
|
886
|
+
* The `ImageURL` returned by `getRegistrationDocumentCannedUrl(...)` is signed with `x-amz-acl: public-read` — your upload PUT request **must** include that exact header or S3 rejects it with `SignatureDoesNotMatch`. See [Get Registration Document Canned URL](#get-registration-document-canned-url).
|
|
729
887
|
|
|
730
888
|
```
|
|
731
889
|
```
|
|
@@ -735,7 +893,7 @@ console.log(response);
|
|
|
735
893
|
|
|
736
894
|
## Prerequisites
|
|
737
895
|
|
|
738
|
-
`HCLoginClient` must be configured
|
|
896
|
+
`HCLoginClient` must be configured before using this connector. Most methods require the patient to be logged in. `getRegistrationDocumentCannedUrl(...)` and `captureRegistrationDocument(...)` are the unauthenticated exceptions — they do not send the auth token.
|
|
739
897
|
|
|
740
898
|
```ts
|
|
741
899
|
import { HCLoginClient } from "@healthcloudai/hc-login-connector";
|
package/dist/index.cjs
CHANGED
|
@@ -240,6 +240,54 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
|
|
|
240
240
|
);
|
|
241
241
|
}
|
|
242
242
|
// ===========================================================================
|
|
243
|
+
// Registration document capture
|
|
244
|
+
// ===========================================================================
|
|
245
|
+
/**
|
|
246
|
+
* Returns a canned URL for uploading a registration document image
|
|
247
|
+
* (driving licence or insurance card) before the user is authenticated.
|
|
248
|
+
* Does not send the patient auth token.
|
|
249
|
+
*
|
|
250
|
+
* The returned `ImageURL` is signed with an `x-amz-acl: public-read`
|
|
251
|
+
* header — the upload PUT request to that URL must include the exact
|
|
252
|
+
* same header (`x-amz-acl: public-read`) or S3 will reject it with
|
|
253
|
+
* `SignatureDoesNotMatch`.
|
|
254
|
+
*/
|
|
255
|
+
async getRegistrationDocumentCannedUrl(documentType, extension) {
|
|
256
|
+
const resolvedDocumentType = this.requireValue(documentType, "Document type", "documentType");
|
|
257
|
+
const resolvedExtension = this.requireValue(extension, "Extension", "extension");
|
|
258
|
+
const requestPayload = {
|
|
259
|
+
Data: { Extension: resolvedExtension }
|
|
260
|
+
};
|
|
261
|
+
return this.execute(
|
|
262
|
+
"getRegistrationDocumentCannedUrl",
|
|
263
|
+
() => this.http.put(
|
|
264
|
+
`${this.auth.getBaseUrl()}/api/patient/registration/document/cannedurl/${resolvedDocumentType}`,
|
|
265
|
+
requestPayload,
|
|
266
|
+
this.getHeaders()
|
|
267
|
+
)
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Submits an uploaded registration document for capture without sending
|
|
272
|
+
* an authenticated patient token.
|
|
273
|
+
* fileKey is the storage key of the uploaded image.
|
|
274
|
+
*/
|
|
275
|
+
async captureRegistrationDocument(fileKey, type) {
|
|
276
|
+
const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
|
|
277
|
+
const resolvedType = this.requireValue(type, "Capture type", "type");
|
|
278
|
+
const requestPayload = {
|
|
279
|
+
Data: { Type: resolvedType, FileID: resolvedFileKey }
|
|
280
|
+
};
|
|
281
|
+
return this.execute(
|
|
282
|
+
"captureRegistrationDocument",
|
|
283
|
+
() => this.http.post(
|
|
284
|
+
`${this.auth.getBaseUrl()}/api/registrationdocument/capture`,
|
|
285
|
+
requestPayload,
|
|
286
|
+
this.getHeaders()
|
|
287
|
+
)
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
// ===========================================================================
|
|
243
291
|
// Account
|
|
244
292
|
// ===========================================================================
|
|
245
293
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -51,7 +51,7 @@ interface PatientDashboard {
|
|
|
51
51
|
EHR: string | null;
|
|
52
52
|
PendingActions: string[];
|
|
53
53
|
}
|
|
54
|
-
type CaptureType = "healthinsurance" | "identification"
|
|
54
|
+
type CaptureType = "healthinsurance" | "identification";
|
|
55
55
|
interface InsuranceCaptureData {
|
|
56
56
|
FirstName: string | null;
|
|
57
57
|
LastName: string | null;
|
|
@@ -83,6 +83,7 @@ interface CaptureResult<T> {
|
|
|
83
83
|
IsCaptured: boolean;
|
|
84
84
|
InsurancePackages: object[] | null;
|
|
85
85
|
}
|
|
86
|
+
type RegistrationDocumentCaptureResult = CaptureResult<InsuranceCaptureData | IdentificationCaptureData>;
|
|
86
87
|
interface InsuranceRecord {
|
|
87
88
|
LastUpdatedBy: string | null;
|
|
88
89
|
IrcName: string | null;
|
|
@@ -164,6 +165,23 @@ declare class HCSettingsClient extends HCBaseConnector {
|
|
|
164
165
|
* fileKey is the storage key of the uploaded image.
|
|
165
166
|
*/
|
|
166
167
|
captureUserPhoto(fileKey: string): Promise<APIResponse<CaptureResult<UserPhotoCaptureData>>>;
|
|
168
|
+
/**
|
|
169
|
+
* Returns a canned URL for uploading a registration document image
|
|
170
|
+
* (driving licence or insurance card) before the user is authenticated.
|
|
171
|
+
* Does not send the patient auth token.
|
|
172
|
+
*
|
|
173
|
+
* The returned `ImageURL` is signed with an `x-amz-acl: public-read`
|
|
174
|
+
* header — the upload PUT request to that URL must include the exact
|
|
175
|
+
* same header (`x-amz-acl: public-read`) or S3 will reject it with
|
|
176
|
+
* `SignatureDoesNotMatch`.
|
|
177
|
+
*/
|
|
178
|
+
getRegistrationDocumentCannedUrl(documentType: CaptureType, extension: string): Promise<APIResponse<UserImage>>;
|
|
179
|
+
/**
|
|
180
|
+
* Submits an uploaded registration document for capture without sending
|
|
181
|
+
* an authenticated patient token.
|
|
182
|
+
* fileKey is the storage key of the uploaded image.
|
|
183
|
+
*/
|
|
184
|
+
captureRegistrationDocument(fileKey: string, type: CaptureType): Promise<APIResponse<RegistrationDocumentCaptureResult>>;
|
|
167
185
|
/**
|
|
168
186
|
* Soft-deactivates the current patient account.
|
|
169
187
|
* The patient record is not permanently deleted.
|
|
@@ -172,4 +190,4 @@ declare class HCSettingsClient extends HCBaseConnector {
|
|
|
172
190
|
private getAuthHeaders;
|
|
173
191
|
}
|
|
174
192
|
|
|
175
|
-
export { type CaptureResult, type CaptureType, type CoverageData, type Encounter, HCSettingsClient, type IdentificationCaptureData, type InsuranceCaptureData, type InsuranceRecord, type PatientDashboard, type PatientRecord, type UserImage, type UserPhotoCaptureData, UserStatus };
|
|
193
|
+
export { type CaptureResult, type CaptureType, type CoverageData, type Encounter, HCSettingsClient, type IdentificationCaptureData, type InsuranceCaptureData, type InsuranceRecord, type PatientDashboard, type PatientRecord, type RegistrationDocumentCaptureResult, type UserImage, type UserPhotoCaptureData, UserStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ interface PatientDashboard {
|
|
|
51
51
|
EHR: string | null;
|
|
52
52
|
PendingActions: string[];
|
|
53
53
|
}
|
|
54
|
-
type CaptureType = "healthinsurance" | "identification"
|
|
54
|
+
type CaptureType = "healthinsurance" | "identification";
|
|
55
55
|
interface InsuranceCaptureData {
|
|
56
56
|
FirstName: string | null;
|
|
57
57
|
LastName: string | null;
|
|
@@ -83,6 +83,7 @@ interface CaptureResult<T> {
|
|
|
83
83
|
IsCaptured: boolean;
|
|
84
84
|
InsurancePackages: object[] | null;
|
|
85
85
|
}
|
|
86
|
+
type RegistrationDocumentCaptureResult = CaptureResult<InsuranceCaptureData | IdentificationCaptureData>;
|
|
86
87
|
interface InsuranceRecord {
|
|
87
88
|
LastUpdatedBy: string | null;
|
|
88
89
|
IrcName: string | null;
|
|
@@ -164,6 +165,23 @@ declare class HCSettingsClient extends HCBaseConnector {
|
|
|
164
165
|
* fileKey is the storage key of the uploaded image.
|
|
165
166
|
*/
|
|
166
167
|
captureUserPhoto(fileKey: string): Promise<APIResponse<CaptureResult<UserPhotoCaptureData>>>;
|
|
168
|
+
/**
|
|
169
|
+
* Returns a canned URL for uploading a registration document image
|
|
170
|
+
* (driving licence or insurance card) before the user is authenticated.
|
|
171
|
+
* Does not send the patient auth token.
|
|
172
|
+
*
|
|
173
|
+
* The returned `ImageURL` is signed with an `x-amz-acl: public-read`
|
|
174
|
+
* header — the upload PUT request to that URL must include the exact
|
|
175
|
+
* same header (`x-amz-acl: public-read`) or S3 will reject it with
|
|
176
|
+
* `SignatureDoesNotMatch`.
|
|
177
|
+
*/
|
|
178
|
+
getRegistrationDocumentCannedUrl(documentType: CaptureType, extension: string): Promise<APIResponse<UserImage>>;
|
|
179
|
+
/**
|
|
180
|
+
* Submits an uploaded registration document for capture without sending
|
|
181
|
+
* an authenticated patient token.
|
|
182
|
+
* fileKey is the storage key of the uploaded image.
|
|
183
|
+
*/
|
|
184
|
+
captureRegistrationDocument(fileKey: string, type: CaptureType): Promise<APIResponse<RegistrationDocumentCaptureResult>>;
|
|
167
185
|
/**
|
|
168
186
|
* Soft-deactivates the current patient account.
|
|
169
187
|
* The patient record is not permanently deleted.
|
|
@@ -172,4 +190,4 @@ declare class HCSettingsClient extends HCBaseConnector {
|
|
|
172
190
|
private getAuthHeaders;
|
|
173
191
|
}
|
|
174
192
|
|
|
175
|
-
export { type CaptureResult, type CaptureType, type CoverageData, type Encounter, HCSettingsClient, type IdentificationCaptureData, type InsuranceCaptureData, type InsuranceRecord, type PatientDashboard, type PatientRecord, type UserImage, type UserPhotoCaptureData, UserStatus };
|
|
193
|
+
export { type CaptureResult, type CaptureType, type CoverageData, type Encounter, HCSettingsClient, type IdentificationCaptureData, type InsuranceCaptureData, type InsuranceRecord, type PatientDashboard, type PatientRecord, type RegistrationDocumentCaptureResult, type UserImage, type UserPhotoCaptureData, UserStatus };
|
package/dist/index.js
CHANGED
|
@@ -208,6 +208,54 @@ var HCSettingsClient = class extends HCBaseConnector {
|
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
210
|
// ===========================================================================
|
|
211
|
+
// Registration document capture
|
|
212
|
+
// ===========================================================================
|
|
213
|
+
/**
|
|
214
|
+
* Returns a canned URL for uploading a registration document image
|
|
215
|
+
* (driving licence or insurance card) before the user is authenticated.
|
|
216
|
+
* Does not send the patient auth token.
|
|
217
|
+
*
|
|
218
|
+
* The returned `ImageURL` is signed with an `x-amz-acl: public-read`
|
|
219
|
+
* header — the upload PUT request to that URL must include the exact
|
|
220
|
+
* same header (`x-amz-acl: public-read`) or S3 will reject it with
|
|
221
|
+
* `SignatureDoesNotMatch`.
|
|
222
|
+
*/
|
|
223
|
+
async getRegistrationDocumentCannedUrl(documentType, extension) {
|
|
224
|
+
const resolvedDocumentType = this.requireValue(documentType, "Document type", "documentType");
|
|
225
|
+
const resolvedExtension = this.requireValue(extension, "Extension", "extension");
|
|
226
|
+
const requestPayload = {
|
|
227
|
+
Data: { Extension: resolvedExtension }
|
|
228
|
+
};
|
|
229
|
+
return this.execute(
|
|
230
|
+
"getRegistrationDocumentCannedUrl",
|
|
231
|
+
() => this.http.put(
|
|
232
|
+
`${this.auth.getBaseUrl()}/api/patient/registration/document/cannedurl/${resolvedDocumentType}`,
|
|
233
|
+
requestPayload,
|
|
234
|
+
this.getHeaders()
|
|
235
|
+
)
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Submits an uploaded registration document for capture without sending
|
|
240
|
+
* an authenticated patient token.
|
|
241
|
+
* fileKey is the storage key of the uploaded image.
|
|
242
|
+
*/
|
|
243
|
+
async captureRegistrationDocument(fileKey, type) {
|
|
244
|
+
const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
|
|
245
|
+
const resolvedType = this.requireValue(type, "Capture type", "type");
|
|
246
|
+
const requestPayload = {
|
|
247
|
+
Data: { Type: resolvedType, FileID: resolvedFileKey }
|
|
248
|
+
};
|
|
249
|
+
return this.execute(
|
|
250
|
+
"captureRegistrationDocument",
|
|
251
|
+
() => this.http.post(
|
|
252
|
+
`${this.auth.getBaseUrl()}/api/registrationdocument/capture`,
|
|
253
|
+
requestPayload,
|
|
254
|
+
this.getHeaders()
|
|
255
|
+
)
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
// ===========================================================================
|
|
211
259
|
// Account
|
|
212
260
|
// ===========================================================================
|
|
213
261
|
/**
|