@healthcloudai/hc-settings-connector 0.0.2 → 0.0.4

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
@@ -6,10 +6,19 @@ It is built on top of the shared Healthcheck HTTP and Login connectors.
6
6
  ---
7
7
 
8
8
  ## Features
9
-
10
- 1. Retrieve authenticated user information
11
- 2. Centralized access to user profile and settings data
12
- 3. Built on shared Healthcheck HttpClient and authentication layer
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
13
22
 
14
23
  ---
15
24
 
@@ -28,7 +37,7 @@ npm install @healthcloudai/hc-settings-connector \
28
37
  ```ts
29
38
  import { HCSettingsClient } from "@healthcloudai/hc-settings-connector";
30
39
  import { HCLoginClient } from "@healthcloudai/hc-login-connector";
31
- import { HttpClient } from "@healthcloudai/hc-http";
40
+ import { FetchClient } from "@healthcloudai/hc-http";
32
41
  ```
33
42
 
34
43
  ---
@@ -38,8 +47,11 @@ import { HttpClient } from "@healthcloudai/hc-http";
38
47
  ### Configuration
39
48
 
40
49
  ```ts
41
- const httpClient = new HttpClient();
42
- const authClient = new HCLoginClient(/* auth configuration */);
50
+ const httpClient = new FetchClient();
51
+ const authClient = new HCLoginClient(httpClient);
52
+
53
+ authClient.configure("tenant-id", "dev");
54
+ await authClient.login("john.doe@test.com", "password");
43
55
 
44
56
  const settingsClient = new HCSettingsClient(
45
57
  httpClient,
@@ -53,22 +65,161 @@ const settingsClient = new HCSettingsClient(
53
65
 
54
66
  ### Get User Info
55
67
 
56
- Retrieves information about the authenticated user, including profile and settings data.
68
+ Public signature: `settingsClient.getUserInfo()`
69
+
70
+ Returns the current patient profile data.
71
+
72
+ ```ts
73
+ const userInfo = await settingsClient.getUserInfo();
74
+ ```
75
+
76
+ ---
77
+
78
+ ### Get Dashboard
79
+
80
+ Public signature: `settingsClient.getDashboard()`
81
+
82
+ Returns the current patient dashboard response.
83
+
84
+ ```ts
85
+ const dashboard = await settingsClient.getDashboard();
86
+ ```
87
+
88
+ ---
89
+
90
+ ### Submit Insurance
91
+
92
+ Public signature: `settingsClient.submitInsurance(payload)`
93
+
94
+ Submits patient insurance coverage details.
95
+
96
+ ```ts
97
+ await settingsClient.submitInsurance({
98
+ InsurancePackageId: "693245",
99
+ MemberId: "096304628",
100
+ FirstName: "John",
101
+ LastName: "Smith",
102
+ Sex: "",
103
+ Image: "1765886686136.png"
104
+ });
105
+ ```
106
+
107
+ ### Get User Image Canned URL
108
+
109
+ Public signature: `settingsClient.getUserImageCannedUrl(extension)`
110
+
111
+ Generates a pre-signed upload URL for a user selfie file.
112
+
113
+ ```ts
114
+ const selfieUpload = await settingsClient.getUserImageCannedUrl("jpg");
115
+ ```
116
+
117
+ ### Capture User Photo
118
+
119
+ Public signature: `settingsClient.captureUserPhoto(fileKey)`
120
+
121
+ Captures a user selfie through `POST /patient/capture`.
122
+ The client internally sends `Type: "userphoto"` and `FileID: fileKey`.
123
+
124
+ ```ts
125
+ const capturedSelfie = await settingsClient.captureUserPhoto(
126
+ "selfie_639064123637965380.jpg"
127
+ );
128
+ ```
129
+
130
+ ### Get Driving License Canned URL
131
+
132
+ Public signature: `settingsClient.getDrivingLicenseCannedUrl(extension)`
133
+
134
+ Generates a pre-signed upload URL for a driving license / ID file.
135
+
136
+ ```ts
137
+ const idUpload = await settingsClient.getDrivingLicenseCannedUrl("jpg");
138
+ ```
139
+
140
+ ### Capture Driving License
141
+
142
+ Public signature: `settingsClient.captureDrivingLicense(fileKey)`
143
+
144
+ Captures and extracts patient identification data through `POST /patient/capture`.
145
+ The client internally sends `Type: "identification"` and `FileID: fileKey`.
57
146
 
58
147
  ```ts
59
- await settingsClient.getUserInfo();
148
+ const capturedLicense = await settingsClient.captureDrivingLicense(
149
+ "drivers-license-front.jpg"
150
+ );
60
151
  ```
61
152
 
153
+ ### Submit Driving License
154
+
155
+ Public signature: `settingsClient.submitDrivingLicense(payload)`
62
156
 
63
- Generates a pre-signed upload URL for uploading a user profile image.
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.
64
160
 
65
161
  ```ts
66
- const image = await settingsClient.uploadUserImage({
67
- extension: "jpg"
162
+ await settingsClient.submitDrivingLicense({
163
+ Number: "DL-123456",
164
+ State: "CA"
68
165
  });
69
166
  ```
70
167
 
168
+ ### Get Insurance Canned URL
169
+
170
+ Public signature: `settingsClient.getInsuranceCannedUrl(extension)`
171
+
172
+ Generates a pre-signed upload URL for an insurance file.
173
+
174
+ ```ts
175
+ const insuranceUpload = await settingsClient.getInsuranceCannedUrl("jpg");
176
+ ```
71
177
 
178
+ ### Capture Insurance
179
+
180
+ Public signature: `settingsClient.captureInsurance(fileKey)`
181
+
182
+ Captures and extracts insurance data through `POST /patient/capture`.
183
+ The client internally sends `Type: "healthinsurance"` and `FileID: fileKey`.
184
+
185
+ ```ts
186
+ const capturedInsurance = await settingsClient.captureInsurance(
187
+ "insurance-card-front.jpg"
188
+ );
189
+ ```
190
+
191
+ ### Get Insurances
192
+
193
+ Public signature: `settingsClient.getInsurances()`
194
+
195
+ Returns patient insurances through the wrapper-backed EHR route.
196
+ The client resolves the current patient's `EHR` internally from `authClient.getUserInfo()`.
197
+
198
+ ```ts
199
+ const insurances = await settingsClient.getInsurances();
200
+ ```
201
+
202
+ ### Update User Image URL
203
+
204
+ Public signature: `settingsClient.updateUserImage(fileName)`
205
+
206
+ Updates the user profile image URL using a file name.
207
+
208
+ ```ts
209
+ await settingsClient.updateUserImage("selfie_639064123637965380.jpg");
210
+ ```
211
+
212
+ ### Deactivate User
213
+
214
+ Public signature: `settingsClient.deactivateUser()`
215
+
216
+ Deactivates the current user.
217
+
218
+ ```ts
219
+ await settingsClient.deactivateUser();
220
+ ```
221
+
222
+ ---
72
223
 
73
224
  ## How It Works
74
225
 
@@ -76,6 +227,7 @@ const image = await settingsClient.uploadUserImage({
76
227
  - Handles authentication
77
228
  - Resolves base API URL
78
229
  - Provides authorization headers
230
+ - Resolves the current user's `EHR` for EHR-backed settings methods
79
231
 
80
232
  - **HttpClient**
81
233
  - Performs all HTTP requests
@@ -83,4 +235,17 @@ const image = await settingsClient.uploadUserImage({
83
235
  - **HCSettingsClient**
84
236
  - Exposes user settings and profile-related endpoints
85
237
 
238
+ ---
239
+
240
+ ## Notes
241
+
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`
250
+
86
251
 
package/dist/index.cjs CHANGED
@@ -30,24 +30,66 @@ module.exports = __toCommonJS(index_exports);
30
30
  // src/client.ts
31
31
  var HCSettingsClient = class {
32
32
  constructor(httpClient, authClient) {
33
+ this.resolvedEhr = null;
33
34
  this.http = httpClient;
34
35
  this.auth = authClient;
35
36
  }
36
37
  async getUserInfo() {
37
38
  return this.http.get(
38
- `${this.auth.getBaseUrl()}/user/info`,
39
+ `${this.auth.getBaseUrl()}/patient/header`,
39
40
  this.auth.getAuthHeader()
40
41
  );
41
42
  }
42
- async uploadUserImage(payload) {
43
+ async getDashboard() {
44
+ return this.http.get(
45
+ `${this.auth.getBaseUrl()}/patient/dashboard`,
46
+ this.auth.getAuthHeader()
47
+ );
48
+ }
49
+ async getUserImageCannedUrl(extension) {
50
+ var _a;
51
+ const payload = {
52
+ Data: {
53
+ Extension: extension
54
+ }
55
+ };
56
+ const response = await this.http.put(
57
+ `${this.auth.getBaseUrl()}/patient/image/cannedurl`,
58
+ payload,
59
+ {
60
+ ...this.auth.getAuthHeader(),
61
+ "Content-Type": "application/json"
62
+ }
63
+ );
64
+ return (_a = response.Data) != null ? _a : response;
65
+ }
66
+ async getDrivingLicenseCannedUrl(extension) {
43
67
  var _a;
68
+ const payload = {
69
+ Data: {
70
+ Extension: extension
71
+ }
72
+ };
44
73
  const response = await this.http.put(
45
- `${this.auth.getBaseUrl()}/api/patient/image/cannedurl`,
74
+ `${this.auth.getBaseUrl()}/patient/id/cannedurl`,
75
+ payload,
46
76
  {
47
- Data: {
48
- Extension: payload.extension
49
- }
50
- },
77
+ ...this.auth.getAuthHeader(),
78
+ "Content-Type": "application/json"
79
+ }
80
+ );
81
+ return (_a = response.Data) != null ? _a : response;
82
+ }
83
+ async getInsuranceCannedUrl(extension) {
84
+ var _a;
85
+ const payload = {
86
+ Data: {
87
+ Extension: extension
88
+ }
89
+ };
90
+ const response = await this.http.put(
91
+ `${this.auth.getBaseUrl()}/patient/insurance/cannedurl`,
92
+ payload,
51
93
  {
52
94
  ...this.auth.getAuthHeader(),
53
95
  "Content-Type": "application/json"
@@ -55,6 +97,133 @@ var HCSettingsClient = class {
55
97
  );
56
98
  return (_a = response.Data) != null ? _a : response;
57
99
  }
100
+ async captureUserPhoto(fileKey) {
101
+ const payload = {
102
+ Data: {
103
+ Type: "userphoto",
104
+ FileID: fileKey
105
+ }
106
+ };
107
+ return this.http.post(
108
+ `${this.auth.getBaseUrl()}/patient/capture`,
109
+ payload,
110
+ {
111
+ ...this.auth.getAuthHeader(),
112
+ "Content-Type": "application/json"
113
+ }
114
+ );
115
+ }
116
+ async captureDrivingLicense(fileKey) {
117
+ const payload = {
118
+ Data: {
119
+ Type: "identification",
120
+ FileID: fileKey
121
+ }
122
+ };
123
+ return this.http.post(
124
+ `${this.auth.getBaseUrl()}/patient/capture`,
125
+ payload,
126
+ {
127
+ ...this.auth.getAuthHeader(),
128
+ "Content-Type": "application/json"
129
+ }
130
+ );
131
+ }
132
+ async captureInsurance(fileKey) {
133
+ const payload = {
134
+ Data: {
135
+ Type: "healthinsurance",
136
+ FileID: fileKey
137
+ }
138
+ };
139
+ return this.http.post(
140
+ `${this.auth.getBaseUrl()}/patient/capture`,
141
+ payload,
142
+ {
143
+ ...this.auth.getAuthHeader(),
144
+ "Content-Type": "application/json"
145
+ }
146
+ );
147
+ }
148
+ async submitInsurance(payload) {
149
+ const requestPayload = {
150
+ Data: payload
151
+ };
152
+ return this.http.put(
153
+ `${this.auth.getBaseUrl()}/patient/coverage`,
154
+ requestPayload,
155
+ {
156
+ ...this.auth.getAuthHeader(),
157
+ "Content-Type": "application/json"
158
+ }
159
+ );
160
+ }
161
+ async getInsurances() {
162
+ return this.http.get(
163
+ await this.buildEhrPatientUrl("insurances"),
164
+ this.auth.getAuthHeader()
165
+ );
166
+ }
167
+ async submitDrivingLicense(payload) {
168
+ const requestPayload = {
169
+ Data: payload
170
+ };
171
+ return this.http.put(
172
+ await this.buildEhrPatientUrl("drivinglicense"),
173
+ requestPayload,
174
+ {
175
+ ...this.auth.getAuthHeader(),
176
+ "Content-Type": "application/json"
177
+ }
178
+ );
179
+ }
180
+ async updateUserImage(fileName) {
181
+ var _a;
182
+ const payload = {
183
+ Data: {
184
+ FileName: fileName
185
+ }
186
+ };
187
+ const response = await this.http.put(
188
+ `${this.auth.getBaseUrl()}/patient/image/url`,
189
+ payload,
190
+ {
191
+ ...this.auth.getAuthHeader(),
192
+ "Content-Type": "application/json"
193
+ }
194
+ );
195
+ return (_a = response.Data) != null ? _a : response;
196
+ }
197
+ async deactivateUser() {
198
+ const payload = {
199
+ Data: {}
200
+ };
201
+ return this.http.put(
202
+ `${this.auth.getBaseUrl()}/patient/deactivate`,
203
+ payload,
204
+ {
205
+ ...this.auth.getAuthHeader(),
206
+ "Content-Type": "application/json"
207
+ }
208
+ );
209
+ }
210
+ async buildEhrPatientUrl(path) {
211
+ const ehr = await this.getResolvedEhr();
212
+ return `${this.auth.getBaseUrl()}/ehr/${ehr}/patient/${path}`;
213
+ }
214
+ async getResolvedEhr() {
215
+ var _a, _b, _c;
216
+ if (this.resolvedEhr) {
217
+ return this.resolvedEhr;
218
+ }
219
+ const userInfo = await this.auth.getUserInfo();
220
+ 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());
221
+ if (!ehr) {
222
+ throw new Error("Could not resolve EHR from loginClient.getUserInfo()");
223
+ }
224
+ this.resolvedEhr = ehr;
225
+ return ehr;
226
+ }
58
227
  };
59
228
 
60
229
  // src/errors.ts
package/dist/index.d.cts CHANGED
@@ -2,12 +2,12 @@ import { HCLoginClient } from '@healthcloudai/hc-login-connector';
2
2
  import { HttpClient } from '@healthcloudai/hc-http';
3
3
 
4
4
  type Environment = "dev" | "uat" | "prod";
5
- interface HCUserImage {
5
+ interface UserImage {
6
6
  imageUrl: string;
7
7
  fileName: string;
8
8
  extension: string;
9
9
  }
10
- interface HCUserInfo {
10
+ interface UserInfo {
11
11
  ID?: string;
12
12
  Email?: string;
13
13
  TenantID?: string;
@@ -16,13 +16,73 @@ interface HCUserInfo {
16
16
  HasSelfie?: boolean;
17
17
  Attributes?: Record<string, any>;
18
18
  }
19
+ interface UserInfoResponse {
20
+ Data?: {
21
+ EHR?: string;
22
+ };
23
+ EHR?: string;
24
+ }
25
+ interface CoverageRequest {
26
+ InsurancePackageId: string;
27
+ MemberId: string;
28
+ FirstName: string;
29
+ LastName: string;
30
+ Sex: string;
31
+ Image: string;
32
+ }
33
+ interface CoveragePayload {
34
+ Data: CoverageRequest;
35
+ }
36
+ type CaptureType = "identification" | "healthinsurance" | "userphoto";
37
+ interface CaptureData {
38
+ Type: CaptureType;
39
+ FileID: string;
40
+ }
41
+ interface CaptureRequest {
42
+ Data: CaptureData;
43
+ }
44
+ interface UploadImageData {
45
+ Extension: string;
46
+ }
47
+ interface UploadImageRequest {
48
+ Data: UploadImageData;
49
+ }
50
+ interface UpdateImageData {
51
+ FileName: string;
52
+ }
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;
62
+ }
63
+ type HCUserImage = UserImage;
64
+ type HCUserInfo = UserInfo;
19
65
 
20
66
  declare class HCSettingsClient {
21
67
  private http;
22
68
  private auth;
69
+ private resolvedEhr;
23
70
  constructor(httpClient: HttpClient, authClient: HCLoginClient);
24
- getUserInfo(): Promise<HCUserInfo>;
25
- uploadUserImage(payload: any): Promise<HCUserImage>;
71
+ getUserInfo(): Promise<any>;
72
+ getDashboard(): Promise<any>;
73
+ getUserImageCannedUrl(extension: string): Promise<UserImage>;
74
+ getDrivingLicenseCannedUrl(extension: string): Promise<UserImage>;
75
+ getInsuranceCannedUrl(extension: string): Promise<UserImage>;
76
+ captureUserPhoto(fileKey: string): Promise<any>;
77
+ captureDrivingLicense(fileKey: string): Promise<any>;
78
+ captureInsurance(fileKey: string): Promise<any>;
79
+ submitInsurance(payload: CoverageRequest): Promise<any>;
80
+ getInsurances(): Promise<any>;
81
+ submitDrivingLicense(payload: DrivingLicenseData): Promise<any>;
82
+ updateUserImage(fileName: string): Promise<UserImage>;
83
+ deactivateUser(): Promise<any>;
84
+ private buildEhrPatientUrl;
85
+ private getResolvedEhr;
26
86
  }
27
87
 
28
88
  declare class ConfigError extends Error {
@@ -36,4 +96,4 @@ declare class HttpError extends Error {
36
96
  constructor(status: number, message: string);
37
97
  }
38
98
 
39
- export { AuthError, ConfigError, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError };
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 };
package/dist/index.d.ts CHANGED
@@ -2,12 +2,12 @@ import { HCLoginClient } from '@healthcloudai/hc-login-connector';
2
2
  import { HttpClient } from '@healthcloudai/hc-http';
3
3
 
4
4
  type Environment = "dev" | "uat" | "prod";
5
- interface HCUserImage {
5
+ interface UserImage {
6
6
  imageUrl: string;
7
7
  fileName: string;
8
8
  extension: string;
9
9
  }
10
- interface HCUserInfo {
10
+ interface UserInfo {
11
11
  ID?: string;
12
12
  Email?: string;
13
13
  TenantID?: string;
@@ -16,13 +16,73 @@ interface HCUserInfo {
16
16
  HasSelfie?: boolean;
17
17
  Attributes?: Record<string, any>;
18
18
  }
19
+ interface UserInfoResponse {
20
+ Data?: {
21
+ EHR?: string;
22
+ };
23
+ EHR?: string;
24
+ }
25
+ interface CoverageRequest {
26
+ InsurancePackageId: string;
27
+ MemberId: string;
28
+ FirstName: string;
29
+ LastName: string;
30
+ Sex: string;
31
+ Image: string;
32
+ }
33
+ interface CoveragePayload {
34
+ Data: CoverageRequest;
35
+ }
36
+ type CaptureType = "identification" | "healthinsurance" | "userphoto";
37
+ interface CaptureData {
38
+ Type: CaptureType;
39
+ FileID: string;
40
+ }
41
+ interface CaptureRequest {
42
+ Data: CaptureData;
43
+ }
44
+ interface UploadImageData {
45
+ Extension: string;
46
+ }
47
+ interface UploadImageRequest {
48
+ Data: UploadImageData;
49
+ }
50
+ interface UpdateImageData {
51
+ FileName: string;
52
+ }
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;
62
+ }
63
+ type HCUserImage = UserImage;
64
+ type HCUserInfo = UserInfo;
19
65
 
20
66
  declare class HCSettingsClient {
21
67
  private http;
22
68
  private auth;
69
+ private resolvedEhr;
23
70
  constructor(httpClient: HttpClient, authClient: HCLoginClient);
24
- getUserInfo(): Promise<HCUserInfo>;
25
- uploadUserImage(payload: any): Promise<HCUserImage>;
71
+ getUserInfo(): Promise<any>;
72
+ getDashboard(): Promise<any>;
73
+ getUserImageCannedUrl(extension: string): Promise<UserImage>;
74
+ getDrivingLicenseCannedUrl(extension: string): Promise<UserImage>;
75
+ getInsuranceCannedUrl(extension: string): Promise<UserImage>;
76
+ captureUserPhoto(fileKey: string): Promise<any>;
77
+ captureDrivingLicense(fileKey: string): Promise<any>;
78
+ captureInsurance(fileKey: string): Promise<any>;
79
+ submitInsurance(payload: CoverageRequest): Promise<any>;
80
+ getInsurances(): Promise<any>;
81
+ submitDrivingLicense(payload: DrivingLicenseData): Promise<any>;
82
+ updateUserImage(fileName: string): Promise<UserImage>;
83
+ deactivateUser(): Promise<any>;
84
+ private buildEhrPatientUrl;
85
+ private getResolvedEhr;
26
86
  }
27
87
 
28
88
  declare class ConfigError extends Error {
@@ -36,4 +96,4 @@ declare class HttpError extends Error {
36
96
  constructor(status: number, message: string);
37
97
  }
38
98
 
39
- export { AuthError, ConfigError, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError };
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 };
package/dist/index.js CHANGED
@@ -1,24 +1,66 @@
1
1
  // src/client.ts
2
2
  var HCSettingsClient = class {
3
3
  constructor(httpClient, authClient) {
4
+ this.resolvedEhr = null;
4
5
  this.http = httpClient;
5
6
  this.auth = authClient;
6
7
  }
7
8
  async getUserInfo() {
8
9
  return this.http.get(
9
- `${this.auth.getBaseUrl()}/user/info`,
10
+ `${this.auth.getBaseUrl()}/patient/header`,
10
11
  this.auth.getAuthHeader()
11
12
  );
12
13
  }
13
- async uploadUserImage(payload) {
14
+ async getDashboard() {
15
+ return this.http.get(
16
+ `${this.auth.getBaseUrl()}/patient/dashboard`,
17
+ this.auth.getAuthHeader()
18
+ );
19
+ }
20
+ async getUserImageCannedUrl(extension) {
21
+ var _a;
22
+ const payload = {
23
+ Data: {
24
+ Extension: extension
25
+ }
26
+ };
27
+ const response = await this.http.put(
28
+ `${this.auth.getBaseUrl()}/patient/image/cannedurl`,
29
+ payload,
30
+ {
31
+ ...this.auth.getAuthHeader(),
32
+ "Content-Type": "application/json"
33
+ }
34
+ );
35
+ return (_a = response.Data) != null ? _a : response;
36
+ }
37
+ async getDrivingLicenseCannedUrl(extension) {
14
38
  var _a;
39
+ const payload = {
40
+ Data: {
41
+ Extension: extension
42
+ }
43
+ };
15
44
  const response = await this.http.put(
16
- `${this.auth.getBaseUrl()}/api/patient/image/cannedurl`,
45
+ `${this.auth.getBaseUrl()}/patient/id/cannedurl`,
46
+ payload,
17
47
  {
18
- Data: {
19
- Extension: payload.extension
20
- }
21
- },
48
+ ...this.auth.getAuthHeader(),
49
+ "Content-Type": "application/json"
50
+ }
51
+ );
52
+ return (_a = response.Data) != null ? _a : response;
53
+ }
54
+ async getInsuranceCannedUrl(extension) {
55
+ var _a;
56
+ const payload = {
57
+ Data: {
58
+ Extension: extension
59
+ }
60
+ };
61
+ const response = await this.http.put(
62
+ `${this.auth.getBaseUrl()}/patient/insurance/cannedurl`,
63
+ payload,
22
64
  {
23
65
  ...this.auth.getAuthHeader(),
24
66
  "Content-Type": "application/json"
@@ -26,6 +68,133 @@ var HCSettingsClient = class {
26
68
  );
27
69
  return (_a = response.Data) != null ? _a : response;
28
70
  }
71
+ async captureUserPhoto(fileKey) {
72
+ const payload = {
73
+ Data: {
74
+ Type: "userphoto",
75
+ FileID: fileKey
76
+ }
77
+ };
78
+ return this.http.post(
79
+ `${this.auth.getBaseUrl()}/patient/capture`,
80
+ payload,
81
+ {
82
+ ...this.auth.getAuthHeader(),
83
+ "Content-Type": "application/json"
84
+ }
85
+ );
86
+ }
87
+ async captureDrivingLicense(fileKey) {
88
+ const payload = {
89
+ Data: {
90
+ Type: "identification",
91
+ FileID: fileKey
92
+ }
93
+ };
94
+ return this.http.post(
95
+ `${this.auth.getBaseUrl()}/patient/capture`,
96
+ payload,
97
+ {
98
+ ...this.auth.getAuthHeader(),
99
+ "Content-Type": "application/json"
100
+ }
101
+ );
102
+ }
103
+ async captureInsurance(fileKey) {
104
+ const payload = {
105
+ Data: {
106
+ Type: "healthinsurance",
107
+ FileID: fileKey
108
+ }
109
+ };
110
+ return this.http.post(
111
+ `${this.auth.getBaseUrl()}/patient/capture`,
112
+ payload,
113
+ {
114
+ ...this.auth.getAuthHeader(),
115
+ "Content-Type": "application/json"
116
+ }
117
+ );
118
+ }
119
+ async submitInsurance(payload) {
120
+ const requestPayload = {
121
+ Data: payload
122
+ };
123
+ return this.http.put(
124
+ `${this.auth.getBaseUrl()}/patient/coverage`,
125
+ requestPayload,
126
+ {
127
+ ...this.auth.getAuthHeader(),
128
+ "Content-Type": "application/json"
129
+ }
130
+ );
131
+ }
132
+ async getInsurances() {
133
+ return this.http.get(
134
+ await this.buildEhrPatientUrl("insurances"),
135
+ this.auth.getAuthHeader()
136
+ );
137
+ }
138
+ async submitDrivingLicense(payload) {
139
+ const requestPayload = {
140
+ Data: payload
141
+ };
142
+ return this.http.put(
143
+ await this.buildEhrPatientUrl("drivinglicense"),
144
+ requestPayload,
145
+ {
146
+ ...this.auth.getAuthHeader(),
147
+ "Content-Type": "application/json"
148
+ }
149
+ );
150
+ }
151
+ async updateUserImage(fileName) {
152
+ var _a;
153
+ const payload = {
154
+ Data: {
155
+ FileName: fileName
156
+ }
157
+ };
158
+ const response = await this.http.put(
159
+ `${this.auth.getBaseUrl()}/patient/image/url`,
160
+ payload,
161
+ {
162
+ ...this.auth.getAuthHeader(),
163
+ "Content-Type": "application/json"
164
+ }
165
+ );
166
+ return (_a = response.Data) != null ? _a : response;
167
+ }
168
+ async deactivateUser() {
169
+ const payload = {
170
+ Data: {}
171
+ };
172
+ return this.http.put(
173
+ `${this.auth.getBaseUrl()}/patient/deactivate`,
174
+ payload,
175
+ {
176
+ ...this.auth.getAuthHeader(),
177
+ "Content-Type": "application/json"
178
+ }
179
+ );
180
+ }
181
+ async buildEhrPatientUrl(path) {
182
+ const ehr = await this.getResolvedEhr();
183
+ return `${this.auth.getBaseUrl()}/ehr/${ehr}/patient/${path}`;
184
+ }
185
+ async getResolvedEhr() {
186
+ var _a, _b, _c;
187
+ if (this.resolvedEhr) {
188
+ return this.resolvedEhr;
189
+ }
190
+ const userInfo = await this.auth.getUserInfo();
191
+ 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());
192
+ if (!ehr) {
193
+ throw new Error("Could not resolve EHR from loginClient.getUserInfo()");
194
+ }
195
+ this.resolvedEhr = ehr;
196
+ return ehr;
197
+ }
29
198
  };
30
199
 
31
200
  // src/errors.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthcloudai/hc-settings-connector",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Healthcheck Settings SDK with TypeScript",
5
5
  "author": "Healthcheck Systems Inc",
6
6
  "license": "MIT",
@@ -14,15 +14,15 @@
14
14
  "axios"
15
15
  ],
16
16
  "type": "module",
17
- "main": "dist/index.cjs.js",
18
- "module": "dist/index.esm.js",
17
+ "main": "dist/index.cjs",
18
+ "module": "dist/index.js",
19
19
  "types": "dist/index.d.ts",
20
- "react-native": "dist/index.esm.js",
20
+ "react-native": "dist/index.js",
21
21
  "exports": {
22
22
  ".": {
23
23
  "types": "./dist/index.d.ts",
24
- "import": "./dist/index.esm.js",
25
- "require": "./dist/index.cjs.js"
24
+ "import": "./dist/index.js",
25
+ "require": "./dist/index.cjs"
26
26
  }
27
27
  },
28
28
  "files": [
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "axios": "^1.13.4",
39
- "@healthcloudai/hc-login-connector": "^0.0.2",
39
+ "@healthcloudai/hc-login-connector": "^0.0.7",
40
40
  "@healthcloudai/hc-http": "^0.0.3"
41
41
  },
42
42
  "peerDependencies": {