@healthcloudai/hc-settings-connector 0.0.2 → 0.0.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 +54 -11
- package/dist/index.cjs +51 -7
- package/dist/index.d.cts +36 -5
- package/dist/index.d.ts +36 -5
- package/dist/index.js +51 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -6,10 +6,11 @@ It is built on top of the shared Healthcheck HTTP and Login connectors.
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Features
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
1. Submit user insurance
|
|
10
|
+
2. Generate a pre-signed URL for user image upload
|
|
11
|
+
3. Update user profile image URL
|
|
12
|
+
4. Self deactivate user
|
|
13
|
+
5. Built on shared Healthcheck HttpClient and authentication layer
|
|
13
14
|
|
|
14
15
|
---
|
|
15
16
|
|
|
@@ -28,7 +29,7 @@ npm install @healthcloudai/hc-settings-connector \
|
|
|
28
29
|
```ts
|
|
29
30
|
import { HCSettingsClient } from "@healthcloudai/hc-settings-connector";
|
|
30
31
|
import { HCLoginClient } from "@healthcloudai/hc-login-connector";
|
|
31
|
-
import {
|
|
32
|
+
import { FetchClient } from "@healthcloudai/hc-http";
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
---
|
|
@@ -38,7 +39,7 @@ import { HttpClient } from "@healthcloudai/hc-http";
|
|
|
38
39
|
### Configuration
|
|
39
40
|
|
|
40
41
|
```ts
|
|
41
|
-
const httpClient = new
|
|
42
|
+
const httpClient = new FetchClient();
|
|
42
43
|
const authClient = new HCLoginClient(/* auth configuration */);
|
|
43
44
|
|
|
44
45
|
const settingsClient = new HCSettingsClient(
|
|
@@ -53,22 +54,64 @@ const settingsClient = new HCSettingsClient(
|
|
|
53
54
|
|
|
54
55
|
### Get User Info
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
Public signature: `settingsClient.getUserInfo()`
|
|
58
|
+
|
|
59
|
+
Returns the current patient profile data.
|
|
57
60
|
|
|
58
61
|
```ts
|
|
59
|
-
await settingsClient.getUserInfo();
|
|
62
|
+
const userInfo = await settingsClient.getUserInfo();
|
|
60
63
|
```
|
|
61
64
|
|
|
65
|
+
---
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
### Submit Insurance
|
|
68
|
+
|
|
69
|
+
Public signature: `settingsClient.submitInsurance(payload)`
|
|
70
|
+
|
|
71
|
+
Submits patient insurance coverage details.
|
|
64
72
|
|
|
65
73
|
```ts
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
await settingsClient.submitInsurance({
|
|
75
|
+
InsurancePackageId: "693245",
|
|
76
|
+
MemberId: "096304628",
|
|
77
|
+
FirstName: "John",
|
|
78
|
+
LastName: "Smith",
|
|
79
|
+
Sex: "",
|
|
80
|
+
Image: "1765886686136.png"
|
|
68
81
|
});
|
|
69
82
|
```
|
|
70
83
|
|
|
84
|
+
### Upload User Image
|
|
85
|
+
|
|
86
|
+
Public signature: `settingsClient.uploadUserImage(extension)`
|
|
87
|
+
|
|
88
|
+
Generates a pre-signed upload URL for uploading a user profile image.
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const image = await settingsClient.uploadUserImage("jpg");
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Update User Image URL
|
|
71
95
|
|
|
96
|
+
Public signature: `settingsClient.updateUserImage(fileName)`
|
|
97
|
+
|
|
98
|
+
Updates the user profile image URL using a file name.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
await settingsClient.updateUserImage("selfie_639064123637965380.jpg");
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Deactivate User
|
|
105
|
+
|
|
106
|
+
Public signature: `settingsClient.deactivateUser()`
|
|
107
|
+
|
|
108
|
+
Deactivates the current user.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
await settingsClient.deactivateUser();
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
72
115
|
|
|
73
116
|
## How It Works
|
|
74
117
|
|
package/dist/index.cjs
CHANGED
|
@@ -35,19 +35,50 @@ var HCSettingsClient = class {
|
|
|
35
35
|
}
|
|
36
36
|
async getUserInfo() {
|
|
37
37
|
return this.http.get(
|
|
38
|
-
`${this.auth.getBaseUrl()}/
|
|
38
|
+
`${this.auth.getBaseUrl()}/patient/header`,
|
|
39
39
|
this.auth.getAuthHeader()
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
-
async
|
|
42
|
+
async submitInsurance(payload) {
|
|
43
|
+
const requestPayload = {
|
|
44
|
+
Data: payload
|
|
45
|
+
};
|
|
46
|
+
return this.http.put(
|
|
47
|
+
`${this.auth.getBaseUrl()}/patient/coverage`,
|
|
48
|
+
requestPayload,
|
|
49
|
+
{
|
|
50
|
+
...this.auth.getAuthHeader(),
|
|
51
|
+
"Content-Type": "application/json"
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
async uploadUserImage(extension) {
|
|
43
56
|
var _a;
|
|
57
|
+
const payload = {
|
|
58
|
+
Data: {
|
|
59
|
+
Extension: extension
|
|
60
|
+
}
|
|
61
|
+
};
|
|
44
62
|
const response = await this.http.put(
|
|
45
|
-
`${this.auth.getBaseUrl()}/
|
|
63
|
+
`${this.auth.getBaseUrl()}/patient/image/cannedurl`,
|
|
64
|
+
payload,
|
|
46
65
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
...this.auth.getAuthHeader(),
|
|
67
|
+
"Content-Type": "application/json"
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
return (_a = response.Data) != null ? _a : response;
|
|
71
|
+
}
|
|
72
|
+
async updateUserImage(fileName) {
|
|
73
|
+
var _a;
|
|
74
|
+
const payload = {
|
|
75
|
+
Data: {
|
|
76
|
+
FileName: fileName
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const response = await this.http.put(
|
|
80
|
+
`${this.auth.getBaseUrl()}/patient/image/url`,
|
|
81
|
+
payload,
|
|
51
82
|
{
|
|
52
83
|
...this.auth.getAuthHeader(),
|
|
53
84
|
"Content-Type": "application/json"
|
|
@@ -55,6 +86,19 @@ var HCSettingsClient = class {
|
|
|
55
86
|
);
|
|
56
87
|
return (_a = response.Data) != null ? _a : response;
|
|
57
88
|
}
|
|
89
|
+
async deactivateUser() {
|
|
90
|
+
const payload = {
|
|
91
|
+
Data: {}
|
|
92
|
+
};
|
|
93
|
+
return this.http.put(
|
|
94
|
+
`${this.auth.getBaseUrl()}/patient/deactivate`,
|
|
95
|
+
payload,
|
|
96
|
+
{
|
|
97
|
+
...this.auth.getAuthHeader(),
|
|
98
|
+
"Content-Type": "application/json"
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}
|
|
58
102
|
};
|
|
59
103
|
|
|
60
104
|
// 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
|
|
5
|
+
interface UserImage {
|
|
6
6
|
imageUrl: string;
|
|
7
7
|
fileName: string;
|
|
8
8
|
extension: string;
|
|
9
9
|
}
|
|
10
|
-
interface
|
|
10
|
+
interface UserInfo {
|
|
11
11
|
ID?: string;
|
|
12
12
|
Email?: string;
|
|
13
13
|
TenantID?: string;
|
|
@@ -16,13 +16,44 @@ interface HCUserInfo {
|
|
|
16
16
|
HasSelfie?: boolean;
|
|
17
17
|
Attributes?: Record<string, any>;
|
|
18
18
|
}
|
|
19
|
+
interface CoverageRequest {
|
|
20
|
+
InsurancePackageId: string;
|
|
21
|
+
MemberId: string;
|
|
22
|
+
FirstName: string;
|
|
23
|
+
LastName: string;
|
|
24
|
+
Sex: string;
|
|
25
|
+
Image: string;
|
|
26
|
+
}
|
|
27
|
+
interface CoveragePayload {
|
|
28
|
+
Data: CoverageRequest;
|
|
29
|
+
}
|
|
30
|
+
interface UploadImageData {
|
|
31
|
+
Extension: string;
|
|
32
|
+
}
|
|
33
|
+
interface UploadImageRequest {
|
|
34
|
+
Data: UploadImageData;
|
|
35
|
+
}
|
|
36
|
+
interface UpdateImageData {
|
|
37
|
+
FileName: string;
|
|
38
|
+
}
|
|
39
|
+
interface UpdateImageRequest {
|
|
40
|
+
Data: UpdateImageData;
|
|
41
|
+
}
|
|
42
|
+
interface EmptyRequest {
|
|
43
|
+
Data: Record<string, never>;
|
|
44
|
+
}
|
|
45
|
+
type HCUserImage = UserImage;
|
|
46
|
+
type HCUserInfo = UserInfo;
|
|
19
47
|
|
|
20
48
|
declare class HCSettingsClient {
|
|
21
49
|
private http;
|
|
22
50
|
private auth;
|
|
23
51
|
constructor(httpClient: HttpClient, authClient: HCLoginClient);
|
|
24
|
-
getUserInfo(): Promise<
|
|
25
|
-
|
|
52
|
+
getUserInfo(): Promise<any>;
|
|
53
|
+
submitInsurance(payload: CoverageRequest): Promise<any>;
|
|
54
|
+
uploadUserImage(extension: string): Promise<UserImage>;
|
|
55
|
+
updateUserImage(fileName: string): Promise<UserImage>;
|
|
56
|
+
deactivateUser(): Promise<any>;
|
|
26
57
|
}
|
|
27
58
|
|
|
28
59
|
declare class ConfigError extends Error {
|
|
@@ -36,4 +67,4 @@ declare class HttpError extends Error {
|
|
|
36
67
|
constructor(status: number, message: string);
|
|
37
68
|
}
|
|
38
69
|
|
|
39
|
-
export { AuthError, ConfigError, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError };
|
|
70
|
+
export { AuthError, ConfigError, type CoveragePayload, type CoverageRequest, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo };
|
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
|
|
5
|
+
interface UserImage {
|
|
6
6
|
imageUrl: string;
|
|
7
7
|
fileName: string;
|
|
8
8
|
extension: string;
|
|
9
9
|
}
|
|
10
|
-
interface
|
|
10
|
+
interface UserInfo {
|
|
11
11
|
ID?: string;
|
|
12
12
|
Email?: string;
|
|
13
13
|
TenantID?: string;
|
|
@@ -16,13 +16,44 @@ interface HCUserInfo {
|
|
|
16
16
|
HasSelfie?: boolean;
|
|
17
17
|
Attributes?: Record<string, any>;
|
|
18
18
|
}
|
|
19
|
+
interface CoverageRequest {
|
|
20
|
+
InsurancePackageId: string;
|
|
21
|
+
MemberId: string;
|
|
22
|
+
FirstName: string;
|
|
23
|
+
LastName: string;
|
|
24
|
+
Sex: string;
|
|
25
|
+
Image: string;
|
|
26
|
+
}
|
|
27
|
+
interface CoveragePayload {
|
|
28
|
+
Data: CoverageRequest;
|
|
29
|
+
}
|
|
30
|
+
interface UploadImageData {
|
|
31
|
+
Extension: string;
|
|
32
|
+
}
|
|
33
|
+
interface UploadImageRequest {
|
|
34
|
+
Data: UploadImageData;
|
|
35
|
+
}
|
|
36
|
+
interface UpdateImageData {
|
|
37
|
+
FileName: string;
|
|
38
|
+
}
|
|
39
|
+
interface UpdateImageRequest {
|
|
40
|
+
Data: UpdateImageData;
|
|
41
|
+
}
|
|
42
|
+
interface EmptyRequest {
|
|
43
|
+
Data: Record<string, never>;
|
|
44
|
+
}
|
|
45
|
+
type HCUserImage = UserImage;
|
|
46
|
+
type HCUserInfo = UserInfo;
|
|
19
47
|
|
|
20
48
|
declare class HCSettingsClient {
|
|
21
49
|
private http;
|
|
22
50
|
private auth;
|
|
23
51
|
constructor(httpClient: HttpClient, authClient: HCLoginClient);
|
|
24
|
-
getUserInfo(): Promise<
|
|
25
|
-
|
|
52
|
+
getUserInfo(): Promise<any>;
|
|
53
|
+
submitInsurance(payload: CoverageRequest): Promise<any>;
|
|
54
|
+
uploadUserImage(extension: string): Promise<UserImage>;
|
|
55
|
+
updateUserImage(fileName: string): Promise<UserImage>;
|
|
56
|
+
deactivateUser(): Promise<any>;
|
|
26
57
|
}
|
|
27
58
|
|
|
28
59
|
declare class ConfigError extends Error {
|
|
@@ -36,4 +67,4 @@ declare class HttpError extends Error {
|
|
|
36
67
|
constructor(status: number, message: string);
|
|
37
68
|
}
|
|
38
69
|
|
|
39
|
-
export { AuthError, ConfigError, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError };
|
|
70
|
+
export { AuthError, ConfigError, type CoveragePayload, type CoverageRequest, type EmptyRequest, type Environment, HCSettingsClient, type HCUserImage, type HCUserInfo, HttpError, type UpdateImageData, type UpdateImageRequest, type UploadImageData, type UploadImageRequest, type UserImage, type UserInfo };
|
package/dist/index.js
CHANGED
|
@@ -6,19 +6,50 @@ var HCSettingsClient = class {
|
|
|
6
6
|
}
|
|
7
7
|
async getUserInfo() {
|
|
8
8
|
return this.http.get(
|
|
9
|
-
`${this.auth.getBaseUrl()}/
|
|
9
|
+
`${this.auth.getBaseUrl()}/patient/header`,
|
|
10
10
|
this.auth.getAuthHeader()
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
async
|
|
13
|
+
async submitInsurance(payload) {
|
|
14
|
+
const requestPayload = {
|
|
15
|
+
Data: payload
|
|
16
|
+
};
|
|
17
|
+
return this.http.put(
|
|
18
|
+
`${this.auth.getBaseUrl()}/patient/coverage`,
|
|
19
|
+
requestPayload,
|
|
20
|
+
{
|
|
21
|
+
...this.auth.getAuthHeader(),
|
|
22
|
+
"Content-Type": "application/json"
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
async uploadUserImage(extension) {
|
|
14
27
|
var _a;
|
|
28
|
+
const payload = {
|
|
29
|
+
Data: {
|
|
30
|
+
Extension: extension
|
|
31
|
+
}
|
|
32
|
+
};
|
|
15
33
|
const response = await this.http.put(
|
|
16
|
-
`${this.auth.getBaseUrl()}/
|
|
34
|
+
`${this.auth.getBaseUrl()}/patient/image/cannedurl`,
|
|
35
|
+
payload,
|
|
17
36
|
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
37
|
+
...this.auth.getAuthHeader(),
|
|
38
|
+
"Content-Type": "application/json"
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return (_a = response.Data) != null ? _a : response;
|
|
42
|
+
}
|
|
43
|
+
async updateUserImage(fileName) {
|
|
44
|
+
var _a;
|
|
45
|
+
const payload = {
|
|
46
|
+
Data: {
|
|
47
|
+
FileName: fileName
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const response = await this.http.put(
|
|
51
|
+
`${this.auth.getBaseUrl()}/patient/image/url`,
|
|
52
|
+
payload,
|
|
22
53
|
{
|
|
23
54
|
...this.auth.getAuthHeader(),
|
|
24
55
|
"Content-Type": "application/json"
|
|
@@ -26,6 +57,19 @@ var HCSettingsClient = class {
|
|
|
26
57
|
);
|
|
27
58
|
return (_a = response.Data) != null ? _a : response;
|
|
28
59
|
}
|
|
60
|
+
async deactivateUser() {
|
|
61
|
+
const payload = {
|
|
62
|
+
Data: {}
|
|
63
|
+
};
|
|
64
|
+
return this.http.put(
|
|
65
|
+
`${this.auth.getBaseUrl()}/patient/deactivate`,
|
|
66
|
+
payload,
|
|
67
|
+
{
|
|
68
|
+
...this.auth.getAuthHeader(),
|
|
69
|
+
"Content-Type": "application/json"
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
29
73
|
};
|
|
30
74
|
|
|
31
75
|
// src/errors.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@healthcloudai/hc-settings-connector",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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
|
|
18
|
-
"module": "dist/index.
|
|
17
|
+
"main": "dist/index.cjs",
|
|
18
|
+
"module": "dist/index.js",
|
|
19
19
|
"types": "dist/index.d.ts",
|
|
20
|
-
"react-native": "dist/index.
|
|
20
|
+
"react-native": "dist/index.js",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
|
-
"import": "./dist/index.
|
|
25
|
-
"require": "./dist/index.cjs
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"require": "./dist/index.cjs"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"files": [
|