@healthcloudai/hc-settings-connector 0.2.0 → 0.2.2

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
@@ -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. Deactivate the authenticated patient account.
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 and authenticated before calling Settings methods.
63
+ `HCLoginClient` must be configured before creating the Settings client. Most Settings methods require an authenticated patient session. `captureRegistrationDocument(...)` is intended for unauthenticated registration flows and does not send the auth token.
63
64
 
64
65
  ---
65
66
 
@@ -677,6 +678,77 @@ 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
+ ## Capture Registration Document
686
+
687
+ Public signature:
688
+
689
+ ```ts
690
+ settingsClient.captureRegistrationDocument(
691
+ fileKey,
692
+ type
693
+ )
694
+ ```
695
+
696
+ `type` must be one of:
697
+
698
+ ```ts
699
+ "identification" | "healthinsurance"
700
+ ```
701
+
702
+ Only `loginClient.configure(...)` is required for this method so the connector can resolve the API base URL.
703
+
704
+ ```ts
705
+ const response =
706
+ await settingsClient.captureRegistrationDocument(
707
+ "idcard_example.jpeg",
708
+ "identification"
709
+ );
710
+
711
+ console.log(response);
712
+ ```
713
+
714
+ ### API request
715
+
716
+ ```json
717
+ {
718
+ "Data": {
719
+ "Type": "identification",
720
+ "FileID": "idcard_example.jpeg"
721
+ }
722
+ }
723
+ ```
724
+
725
+ ### API response
726
+
727
+ ```json
728
+ {
729
+ "Data": {
730
+ "CapturedData": {
731
+ "FirstName": "John",
732
+ "LastName": "Doe",
733
+ "StreetAddress": "123 Main St",
734
+ "City": "Springfield",
735
+ "ZipCode": "90210",
736
+ "State": "California",
737
+ "IssuedDate": "01/01/2024",
738
+ "ExpiresDate": "01/01/2028",
739
+ "Dob": "01/01/1990",
740
+ "IDNumber": null
741
+ },
742
+ "IsCaptured": true,
743
+ "InsurancePackages": null
744
+ },
745
+ "ErrorMessage": null,
746
+ "IsOK": true
747
+ }
748
+ ```
749
+
750
+ ---
751
+
680
752
  # Account
681
753
 
682
754
  ## Deactivate User
@@ -726,6 +798,7 @@ console.log(response);
726
798
  * `captureDrivingLicense(...)` internally sends `Type: "identification"`.
727
799
  * `captureInsurance(...)` internally sends `Type: "healthinsurance"`.
728
800
  * `captureUserPhoto(...)` internally sends `Type: "userphoto"`.
801
+ * `captureRegistrationDocument(...)` does not send the patient auth token.
729
802
 
730
803
  ```
731
804
  ```
@@ -735,7 +808,7 @@ console.log(response);
735
808
 
736
809
  ## Prerequisites
737
810
 
738
- `HCLoginClient` must be configured and the patient must be logged in before calling any method on this connector.
811
+ `HCLoginClient` must be configured before using this connector. Most methods require the patient to be logged in. `captureRegistrationDocument(...)` is the unauthenticated exception and does not send the auth token.
739
812
 
740
813
  ```ts
741
814
  import { HCLoginClient } from "@healthcloudai/hc-login-connector";
package/dist/index.cjs CHANGED
@@ -60,7 +60,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
60
60
  * Extension must be a valid file extension such as "jpg" or "png".
61
61
  */
62
62
  async getUserImageCannedUrl(extension) {
63
- const resolvedExtension = this.requireValue(extension, "Extension");
63
+ const resolvedExtension = this.requireValue(extension, "Extension", "extension");
64
64
  const requestPayload = {
65
65
  Data: { Extension: resolvedExtension }
66
66
  };
@@ -77,7 +77,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
77
77
  * Updates the patient's profile image by confirming the uploaded file name.
78
78
  */
79
79
  async updateUserImage(fileName) {
80
- const resolvedFileName = this.requireValue(fileName, "File name");
80
+ const resolvedFileName = this.requireValue(fileName, "File name", "fileName");
81
81
  const requestPayload = {
82
82
  Data: { FileName: resolvedFileName }
83
83
  };
@@ -97,7 +97,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
97
97
  * Returns a canned URL for uploading the patient's driving licence image.
98
98
  */
99
99
  async getDrivingLicenseCannedUrl(extension) {
100
- const resolvedExtension = this.requireValue(extension, "Extension");
100
+ const resolvedExtension = this.requireValue(extension, "Extension", "extension");
101
101
  const requestPayload = {
102
102
  Data: { Extension: resolvedExtension }
103
103
  };
@@ -115,7 +115,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
115
115
  * fileKey is the storage key of the uploaded image.
116
116
  */
117
117
  async captureDrivingLicense(fileKey) {
118
- const resolvedFileKey = this.requireValue(fileKey, "File key");
118
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
119
119
  const requestPayload = {
120
120
  Data: { Type: "identification", FileID: resolvedFileKey }
121
121
  };
@@ -132,7 +132,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
132
132
  * Submits a base64-encoded driving licence image to the EHR.
133
133
  */
134
134
  async submitDrivingLicense(image) {
135
- const resolvedImage = this.requireValue(image, "Image");
135
+ const resolvedImage = this.requireValue(image, "Image", "image");
136
136
  const requestPayload = {
137
137
  Data: { Image: resolvedImage }
138
138
  };
@@ -152,7 +152,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
152
152
  * Returns a canned URL for uploading the insurance card image.
153
153
  */
154
154
  async getInsuranceCannedUrl(extension) {
155
- const resolvedExtension = this.requireValue(extension, "Extension");
155
+ const resolvedExtension = this.requireValue(extension, "Extension", "extension");
156
156
  const requestPayload = {
157
157
  Data: { Extension: resolvedExtension }
158
158
  };
@@ -170,7 +170,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
170
170
  * fileKey is the storage key of the uploaded image.
171
171
  */
172
172
  async captureInsurance(fileKey) {
173
- const resolvedFileKey = this.requireValue(fileKey, "File key");
173
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
174
174
  const requestPayload = {
175
175
  Data: { Type: "healthinsurance", FileID: resolvedFileKey }
176
176
  };
@@ -226,7 +226,7 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
226
226
  * fileKey is the storage key of the uploaded image.
227
227
  */
228
228
  async captureUserPhoto(fileKey) {
229
- const resolvedFileKey = this.requireValue(fileKey, "File key");
229
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
230
230
  const requestPayload = {
231
231
  Data: { Type: "userphoto", FileID: resolvedFileKey }
232
232
  };
@@ -240,6 +240,29 @@ var HCSettingsClient = class extends import_hc_http.HCBaseConnector {
240
240
  );
241
241
  }
242
242
  // ===========================================================================
243
+ // Registration document capture
244
+ // ===========================================================================
245
+ /**
246
+ * Submits an uploaded registration document for capture without sending
247
+ * an authenticated patient token.
248
+ * fileKey is the storage key of the uploaded image.
249
+ */
250
+ async captureRegistrationDocument(fileKey, type) {
251
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
252
+ const resolvedType = this.requireValue(type, "Capture type", "type");
253
+ const requestPayload = {
254
+ Data: { Type: resolvedType, FileID: resolvedFileKey }
255
+ };
256
+ return this.execute(
257
+ "captureRegistrationDocument",
258
+ () => this.http.post(
259
+ `${this.auth.getBaseUrl()}/api/registrationdocument/capture`,
260
+ requestPayload,
261
+ this.getHeaders()
262
+ )
263
+ );
264
+ }
265
+ // ===========================================================================
243
266
  // Account
244
267
  // ===========================================================================
245
268
  /**
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" | "userphoto";
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,12 @@ 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
+ * Submits an uploaded registration document for capture without sending
170
+ * an authenticated patient token.
171
+ * fileKey is the storage key of the uploaded image.
172
+ */
173
+ captureRegistrationDocument(fileKey: string, type: CaptureType): Promise<APIResponse<RegistrationDocumentCaptureResult>>;
167
174
  /**
168
175
  * Soft-deactivates the current patient account.
169
176
  * The patient record is not permanently deleted.
@@ -172,4 +179,4 @@ declare class HCSettingsClient extends HCBaseConnector {
172
179
  private getAuthHeaders;
173
180
  }
174
181
 
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 };
182
+ 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" | "userphoto";
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,12 @@ 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
+ * Submits an uploaded registration document for capture without sending
170
+ * an authenticated patient token.
171
+ * fileKey is the storage key of the uploaded image.
172
+ */
173
+ captureRegistrationDocument(fileKey: string, type: CaptureType): Promise<APIResponse<RegistrationDocumentCaptureResult>>;
167
174
  /**
168
175
  * Soft-deactivates the current patient account.
169
176
  * The patient record is not permanently deleted.
@@ -172,4 +179,4 @@ declare class HCSettingsClient extends HCBaseConnector {
172
179
  private getAuthHeaders;
173
180
  }
174
181
 
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 };
182
+ 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
@@ -28,7 +28,7 @@ var HCSettingsClient = class extends HCBaseConnector {
28
28
  * Extension must be a valid file extension such as "jpg" or "png".
29
29
  */
30
30
  async getUserImageCannedUrl(extension) {
31
- const resolvedExtension = this.requireValue(extension, "Extension");
31
+ const resolvedExtension = this.requireValue(extension, "Extension", "extension");
32
32
  const requestPayload = {
33
33
  Data: { Extension: resolvedExtension }
34
34
  };
@@ -45,7 +45,7 @@ var HCSettingsClient = class extends HCBaseConnector {
45
45
  * Updates the patient's profile image by confirming the uploaded file name.
46
46
  */
47
47
  async updateUserImage(fileName) {
48
- const resolvedFileName = this.requireValue(fileName, "File name");
48
+ const resolvedFileName = this.requireValue(fileName, "File name", "fileName");
49
49
  const requestPayload = {
50
50
  Data: { FileName: resolvedFileName }
51
51
  };
@@ -65,7 +65,7 @@ var HCSettingsClient = class extends HCBaseConnector {
65
65
  * Returns a canned URL for uploading the patient's driving licence image.
66
66
  */
67
67
  async getDrivingLicenseCannedUrl(extension) {
68
- const resolvedExtension = this.requireValue(extension, "Extension");
68
+ const resolvedExtension = this.requireValue(extension, "Extension", "extension");
69
69
  const requestPayload = {
70
70
  Data: { Extension: resolvedExtension }
71
71
  };
@@ -83,7 +83,7 @@ var HCSettingsClient = class extends HCBaseConnector {
83
83
  * fileKey is the storage key of the uploaded image.
84
84
  */
85
85
  async captureDrivingLicense(fileKey) {
86
- const resolvedFileKey = this.requireValue(fileKey, "File key");
86
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
87
87
  const requestPayload = {
88
88
  Data: { Type: "identification", FileID: resolvedFileKey }
89
89
  };
@@ -100,7 +100,7 @@ var HCSettingsClient = class extends HCBaseConnector {
100
100
  * Submits a base64-encoded driving licence image to the EHR.
101
101
  */
102
102
  async submitDrivingLicense(image) {
103
- const resolvedImage = this.requireValue(image, "Image");
103
+ const resolvedImage = this.requireValue(image, "Image", "image");
104
104
  const requestPayload = {
105
105
  Data: { Image: resolvedImage }
106
106
  };
@@ -120,7 +120,7 @@ var HCSettingsClient = class extends HCBaseConnector {
120
120
  * Returns a canned URL for uploading the insurance card image.
121
121
  */
122
122
  async getInsuranceCannedUrl(extension) {
123
- const resolvedExtension = this.requireValue(extension, "Extension");
123
+ const resolvedExtension = this.requireValue(extension, "Extension", "extension");
124
124
  const requestPayload = {
125
125
  Data: { Extension: resolvedExtension }
126
126
  };
@@ -138,7 +138,7 @@ var HCSettingsClient = class extends HCBaseConnector {
138
138
  * fileKey is the storage key of the uploaded image.
139
139
  */
140
140
  async captureInsurance(fileKey) {
141
- const resolvedFileKey = this.requireValue(fileKey, "File key");
141
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
142
142
  const requestPayload = {
143
143
  Data: { Type: "healthinsurance", FileID: resolvedFileKey }
144
144
  };
@@ -194,7 +194,7 @@ var HCSettingsClient = class extends HCBaseConnector {
194
194
  * fileKey is the storage key of the uploaded image.
195
195
  */
196
196
  async captureUserPhoto(fileKey) {
197
- const resolvedFileKey = this.requireValue(fileKey, "File key");
197
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
198
198
  const requestPayload = {
199
199
  Data: { Type: "userphoto", FileID: resolvedFileKey }
200
200
  };
@@ -208,6 +208,29 @@ var HCSettingsClient = class extends HCBaseConnector {
208
208
  );
209
209
  }
210
210
  // ===========================================================================
211
+ // Registration document capture
212
+ // ===========================================================================
213
+ /**
214
+ * Submits an uploaded registration document for capture without sending
215
+ * an authenticated patient token.
216
+ * fileKey is the storage key of the uploaded image.
217
+ */
218
+ async captureRegistrationDocument(fileKey, type) {
219
+ const resolvedFileKey = this.requireValue(fileKey, "File key", "fileKey");
220
+ const resolvedType = this.requireValue(type, "Capture type", "type");
221
+ const requestPayload = {
222
+ Data: { Type: resolvedType, FileID: resolvedFileKey }
223
+ };
224
+ return this.execute(
225
+ "captureRegistrationDocument",
226
+ () => this.http.post(
227
+ `${this.auth.getBaseUrl()}/api/registrationdocument/capture`,
228
+ requestPayload,
229
+ this.getHeaders()
230
+ )
231
+ );
232
+ }
233
+ // ===========================================================================
211
234
  // Account
212
235
  // ===========================================================================
213
236
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthcloudai/hc-settings-connector",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Healthcheck Settings SDK with TypeScript",
5
5
  "author": "Healthcheck Systems Inc",
6
6
  "license": "MIT",
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "axios": "^1.13.4",
39
- "@healthcloudai/hc-login-connector": "^0.3.0",
40
- "@healthcloudai/hc-http": "^0.2.0"
39
+ "@healthcloudai/hc-login-connector": "^0.3.1",
40
+ "@healthcloudai/hc-http": "^0.2.1"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react-native": ">=0.70.0"