@healthcloudai/hc-settings-connector 0.0.1 → 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 CHANGED
@@ -1,52 +1,129 @@
1
1
  # Healthcheck Settings Connector
2
2
 
3
- This library provides a client for accessing user settings and profile-related data from the Healthcheck API.
4
- It is built on top of the shared Healthcheck HTTP and Login connectors and can be used from TypeScript or JavaScript.
3
+ This library provides a client for accessing **user settings and profile-related data**
4
+ from the Healthcheck API.
5
+ It is built on top of the shared Healthcheck HTTP and Login connectors.
6
+ ---
5
7
 
6
8
  ## Features
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
7
14
 
8
- 1. Retrieve authenticated user information
9
- 2. Centralized access to user profile and settings data
10
- 3. Built on shared HttpClient and authentication layer
15
+ ---
11
16
 
12
17
  ## Installation
13
18
 
19
+ ```sh
14
20
  npm install @healthcloudai/hc-settings-connector \
15
21
  @healthcloudai/hc-login-connector \
16
22
  @healthcloudai/hc-http
23
+ ```
24
+
25
+ ---
17
26
 
18
27
  ## Import
19
28
 
29
+ ```ts
20
30
  import { HCSettingsClient } from "@healthcloudai/hc-settings-connector";
21
31
  import { HCLoginClient } from "@healthcloudai/hc-login-connector";
22
- import { HttpClient } from "@healthcloudai/hc-http";
32
+ import { FetchClient } from "@healthcloudai/hc-http";
33
+ ```
34
+
35
+ ---
23
36
 
24
37
  ## Usage
25
38
 
26
39
  ### Configuration
27
40
 
28
- import { HCSettingsClient } from "@healthcloudai/hc-settings-connector";
29
- import { HCLoginClient } from "@healthcloudai/hc-login-connector";
30
- import { HttpClient } from "@healthcloudai/hc-http";
31
-
32
- const httpClient = new HttpClient();
41
+ ```ts
42
+ const httpClient = new FetchClient();
33
43
  const authClient = new HCLoginClient(/* auth configuration */);
34
44
 
35
45
  const settingsClient = new HCSettingsClient(
36
46
  httpClient,
37
47
  authClient
38
48
  );
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Methods
39
54
 
40
55
  ### Get User Info
41
56
 
42
- await settingsClient.getUserInfo();
57
+ Public signature: `settingsClient.getUserInfo()`
58
+
59
+ Returns the current patient profile data.
60
+
61
+ ```ts
62
+ const userInfo = await settingsClient.getUserInfo();
63
+ ```
64
+
65
+ ---
66
+
67
+ ### Submit Insurance
68
+
69
+ Public signature: `settingsClient.submitInsurance(payload)`
70
+
71
+ Submits patient insurance coverage details.
72
+
73
+ ```ts
74
+ await settingsClient.submitInsurance({
75
+ InsurancePackageId: "693245",
76
+ MemberId: "096304628",
77
+ FirstName: "John",
78
+ LastName: "Smith",
79
+ Sex: "",
80
+ Image: "1765886686136.png"
81
+ });
82
+ ```
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
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
+ ---
43
115
 
44
116
  ## How It Works
45
117
 
46
- - HCLoginClient handles authentication, base URL resolution, and authorization headers
47
- - HttpClient performs all HTTP requests
48
- - HCSettingsClient exposes user-related settings and profile APIs
49
- - All requests automatically include authentication headers
118
+ - **HCLoginClient**
119
+ - Handles authentication
120
+ - Resolves base API URL
121
+ - Provides authorization headers
122
+
123
+ - **HttpClient**
124
+ - Performs all HTTP requests
50
125
 
126
+ - **HCSettingsClient**
127
+ - Exposes user settings and profile-related endpoints
51
128
 
52
129
 
package/dist/index.cjs CHANGED
@@ -35,10 +35,70 @@ var HCSettingsClient = class {
35
35
  }
36
36
  async getUserInfo() {
37
37
  return this.http.get(
38
- `${this.auth.getBaseUrl()}/user/info`,
38
+ `${this.auth.getBaseUrl()}/patient/header`,
39
39
  this.auth.getAuthHeader()
40
40
  );
41
41
  }
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) {
56
+ var _a;
57
+ const payload = {
58
+ Data: {
59
+ Extension: extension
60
+ }
61
+ };
62
+ const response = await this.http.put(
63
+ `${this.auth.getBaseUrl()}/patient/image/cannedurl`,
64
+ payload,
65
+ {
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,
82
+ {
83
+ ...this.auth.getAuthHeader(),
84
+ "Content-Type": "application/json"
85
+ }
86
+ );
87
+ return (_a = response.Data) != null ? _a : response;
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
+ }
42
102
  };
43
103
 
44
104
  // src/errors.ts
package/dist/index.d.cts CHANGED
@@ -2,18 +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 HCLoginConfig {
6
- tenantID: string;
7
- environment: Environment;
8
- baseUrl: string;
9
- }
10
- interface AuthTokens {
11
- accessToken: string;
12
- refreshToken: string;
13
- idToken: string;
14
- expiresIn: number;
15
- }
16
- interface HCUserInfo {
5
+ interface UserImage {
6
+ imageUrl: string;
7
+ fileName: string;
8
+ extension: string;
9
+ }
10
+ interface UserInfo {
17
11
  ID?: string;
18
12
  Email?: string;
19
13
  TenantID?: string;
@@ -22,12 +16,44 @@ interface HCUserInfo {
22
16
  HasSelfie?: boolean;
23
17
  Attributes?: Record<string, any>;
24
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;
25
47
 
26
48
  declare class HCSettingsClient {
27
49
  private http;
28
50
  private auth;
29
51
  constructor(httpClient: HttpClient, authClient: HCLoginClient);
30
- getUserInfo(): Promise<HCUserInfo>;
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>;
31
57
  }
32
58
 
33
59
  declare class ConfigError extends Error {
@@ -41,4 +67,4 @@ declare class HttpError extends Error {
41
67
  constructor(status: number, message: string);
42
68
  }
43
69
 
44
- export { AuthError, type AuthTokens, ConfigError, type Environment, type HCLoginConfig, HCSettingsClient, 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,18 +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 HCLoginConfig {
6
- tenantID: string;
7
- environment: Environment;
8
- baseUrl: string;
9
- }
10
- interface AuthTokens {
11
- accessToken: string;
12
- refreshToken: string;
13
- idToken: string;
14
- expiresIn: number;
15
- }
16
- interface HCUserInfo {
5
+ interface UserImage {
6
+ imageUrl: string;
7
+ fileName: string;
8
+ extension: string;
9
+ }
10
+ interface UserInfo {
17
11
  ID?: string;
18
12
  Email?: string;
19
13
  TenantID?: string;
@@ -22,12 +16,44 @@ interface HCUserInfo {
22
16
  HasSelfie?: boolean;
23
17
  Attributes?: Record<string, any>;
24
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;
25
47
 
26
48
  declare class HCSettingsClient {
27
49
  private http;
28
50
  private auth;
29
51
  constructor(httpClient: HttpClient, authClient: HCLoginClient);
30
- getUserInfo(): Promise<HCUserInfo>;
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>;
31
57
  }
32
58
 
33
59
  declare class ConfigError extends Error {
@@ -41,4 +67,4 @@ declare class HttpError extends Error {
41
67
  constructor(status: number, message: string);
42
68
  }
43
69
 
44
- export { AuthError, type AuthTokens, ConfigError, type Environment, type HCLoginConfig, HCSettingsClient, 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,10 +6,70 @@ var HCSettingsClient = class {
6
6
  }
7
7
  async getUserInfo() {
8
8
  return this.http.get(
9
- `${this.auth.getBaseUrl()}/user/info`,
9
+ `${this.auth.getBaseUrl()}/patient/header`,
10
10
  this.auth.getAuthHeader()
11
11
  );
12
12
  }
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) {
27
+ var _a;
28
+ const payload = {
29
+ Data: {
30
+ Extension: extension
31
+ }
32
+ };
33
+ const response = await this.http.put(
34
+ `${this.auth.getBaseUrl()}/patient/image/cannedurl`,
35
+ payload,
36
+ {
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,
53
+ {
54
+ ...this.auth.getAuthHeader(),
55
+ "Content-Type": "application/json"
56
+ }
57
+ );
58
+ return (_a = response.Data) != null ? _a : response;
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
+ }
13
73
  };
14
74
 
15
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.1",
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.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,8 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "axios": "^1.13.4",
39
- "@healthcloudai/hc-login-connector": "^0.0.1",
40
- "@healthcloudai/hc-http": "^0.0.1"
39
+ "@healthcloudai/hc-login-connector": "^0.0.2",
40
+ "@healthcloudai/hc-http": "^0.0.3"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react-native": ">=0.70.0"