@abcagency/hire-control-sdk 1.0.44 → 1.0.46

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.
@@ -1,14 +1,16 @@
1
- import FetchHandler from '../handlers/fetchHandler';
2
- import ClientLogInRequest from '../types/clientLoginRequest';
3
- import Credentials from '../types/credentials';
4
- import RefreshTokenRequest from '../types/refreshTokenRequest';
5
- import ChangeCompanyRequest from '../types/changeCompanyRequest';
6
- import AuthResponse from '../types/authResponse';
7
- import Register from '../types/register';
8
- import User from '../types/user';
9
- import { API_URL } from '../constants/config';
1
+ import FetchHandler from "../handlers/fetchHandler";
2
+ import ClientLogInRequest from "../types/clientLoginRequest";
3
+ import Credentials from "../types/credentials";
4
+ import RefreshTokenRequest from "../types/refreshTokenRequest";
5
+ import ChangeCompanyRequest from "../types/changeCompanyRequest";
6
+ import AuthResponse from "../types/authResponse";
7
+ import Register from "../types/register";
8
+ import User from "../types/user";
9
+ import { API_URL } from "../constants/config";
10
10
 
11
11
  const fetchHandler = new FetchHandler(API_URL);
12
+ const isLocalhost =
13
+ typeof window !== "undefined" && window.location.hostname === "localhost";
12
14
 
13
15
  /**
14
16
  * AuthController class that handles all the authentication API calls.
@@ -20,50 +22,69 @@ class AuthController {
20
22
  * @returns {Promise<any>} - The response from the server.
21
23
  */
22
24
  async login(clientLogInRequest: ClientLogInRequest): Promise<any> {
23
- return fetchHandler.post<ClientLogInRequest, any>('/auth/login', clientLogInRequest, false);
25
+ return fetchHandler.post<ClientLogInRequest, any>(
26
+ "/auth/login",
27
+ clientLogInRequest,
28
+ false
29
+ );
24
30
  }
25
31
 
26
- /**
27
- * Login for existing users with username and password.
28
- * @param {Credentials} credentials - The credentials object containing username and password.
29
- * @returns {Promise<any>} - The response containing the authentication token.
30
- */
31
- async nextLogin(credentials: Credentials): Promise<any> {
32
- const response = await fetchHandler.post<Credentials, AuthResponse>('/auth/nextLogin', credentials, false);
33
-
34
- // if (response) {
35
- // sessionStorage.setItem('token', response.token);
36
- // sessionStorage.setItem('refreshToken', response.refreshToken);
37
- // sessionStorage.setItem('expiration', response.expiration);
38
- // }
39
-
40
- return response;
41
- }
32
+ /**
33
+ * Login for existing users with username and password.
34
+ * @param {Credentials} credentials - The credentials object containing username and password.
35
+ * @returns {Promise<any>} - The response containing the authentication token.
36
+ */
37
+ async nextLogin(credentials: Credentials): Promise<any> {
38
+ const url = `/auth/nextLogin${isLocalhost ? "?localhost=true" : ""}`;
39
+ const response = await fetchHandler.post<Credentials, AuthResponse>(
40
+ url,
41
+ credentials,
42
+ false
43
+ );
44
+ if (response) {
45
+ sessionStorage.setItem("token", response.token);
46
+ sessionStorage.setItem("refreshToken", response.refreshToken);
47
+ sessionStorage.setItem("expiration", response.expiration);
48
+ }
49
+ return response;
50
+ }
42
51
 
43
- /**
44
- * Refresh the access token using the refresh token.
45
- * @param {RefreshTokenRequest} refreshTokenRequest - The refresh token request object containing the refresh token and companyId.
46
- * @returns {Promise<any>} - The response with the new token.
47
- */
48
- async refreshToken(refreshTokenRequest: RefreshTokenRequest): Promise<any> {
49
- const response = await fetchHandler.post<RefreshTokenRequest, AuthResponse>('/auth/refresh', refreshTokenRequest, false);
52
+ /**
53
+ * Refresh the access token using the refresh token.
54
+ * @param {RefreshTokenRequest} refreshTokenRequest - The refresh token request object containing the refresh token and companyId.
55
+ * @returns {Promise<any>} - The response with the new token.
56
+ */
57
+ async refreshToken(refreshTokenRequest: RefreshTokenRequest): Promise<any> {
58
+ const url = `/auth/refresh${isLocalhost ? "?localhost=true" : ""}`;
59
+ const response = await fetchHandler.post<RefreshTokenRequest, AuthResponse>(
60
+ url,
61
+ refreshTokenRequest,
62
+ false
63
+ );
64
+
65
+ if (response) {
66
+ sessionStorage.setItem("token", response.token);
67
+ sessionStorage.setItem("refreshToken", response.refreshToken);
68
+ sessionStorage.setItem("expiration", response.expiration);
69
+ }
50
70
 
51
- if (response) {
52
- sessionStorage.setItem('token', response.token);
53
- sessionStorage.setItem('refreshToken', response.refreshToken);
54
- sessionStorage.setItem('expiration', response.expiration);
71
+ return response;
55
72
  }
56
73
 
57
- return response;
58
- }
59
-
60
74
  /**
61
75
  * Change the company for the current authenticated user.
62
76
  * @param {ChangeCompanyRequest} changeCompanyRequest - The request object containing the new company ID.
63
77
  * @returns {Promise<any>} - The response from the server.
64
78
  */
65
- async changeCompany(changeCompanyRequest: ChangeCompanyRequest): Promise<any> {
66
- return fetchHandler.post<ChangeCompanyRequest, any>('/auth/changeCompany', changeCompanyRequest, true);
79
+ async changeCompany(
80
+ changeCompanyRequest: ChangeCompanyRequest
81
+ ): Promise<any> {
82
+ const url = `/auth/changeCompany${isLocalhost ? "?localhost=true" : ""}`;
83
+ return fetchHandler.post<ChangeCompanyRequest, any>(
84
+ url,
85
+ changeCompanyRequest,
86
+ true
87
+ );
67
88
  }
68
89
 
69
90
  /**
@@ -72,81 +93,96 @@ async refreshToken(refreshTokenRequest: RefreshTokenRequest): Promise<any> {
72
93
  * @returns {Promise<any>} - The response after registering the user.
73
94
  */
74
95
  async register(register: Register): Promise<any> {
75
- return fetchHandler.post<Register, any>('/auth/register', register, false);
96
+ return fetchHandler.post<Register, any>("/auth/register", register, false);
76
97
  }
77
98
 
78
- /**
99
+ /**
79
100
  * Fetch the authorized companies for the current user.
80
101
  * @returns {Promise<any>} - The response containing the list of companies.
81
102
  */
82
- async getCompanies(): Promise<any> {
83
- return fetchHandler.get<any>('/auth/companies', true); // 'true' for authenticated endpoint
103
+ async getCompanies(): Promise<any> {
104
+ return fetchHandler.get<any>("/auth/companies", true); // 'true' for authenticated endpoint
84
105
  }
85
106
 
86
- /**
107
+ /**
87
108
  * Get the current company details for the authenticated user.
88
109
  * @returns {Promise<any>} - The response containing the company name and company ID.
89
110
  */
90
111
  async getCompany(): Promise<any> {
91
- return fetchHandler.get<any>('/auth/company', true); // 'true' for authenticated endpoint
112
+ return fetchHandler.get<any>("/auth/company", true); // 'true' for authenticated endpoint
92
113
  }
93
114
 
94
- /**
115
+ /**
95
116
  * Get the roles for the authenticated user.
96
117
  * @returns {Promise<any>} - The response containing the list of roles.
97
118
  */
98
119
  async getRoles(): Promise<any> {
99
- return fetchHandler.get<any>('/auth/roles', true); // 'true' for authenticated endpoint
120
+ return fetchHandler.get<any>("/auth/roles", true); // 'true' for authenticated endpoint
100
121
  }
101
122
 
102
- /**
103
- * Check if the user is authenticated.
104
- * @returns {Promise<boolean>} - True if the user is authenticated, false otherwise.
105
- */
106
- async isAuthenticated(): Promise<boolean> {
107
- try {
108
- const response = await fetchHandler.get<boolean>('/auth/authenticated', true);
109
- return response; // Return the boolean response directly from the API
110
- } catch (error) {
111
- return false; // Return false if there's an error (e.g., unauthorized)
123
+ /**
124
+ * Check if the user is authenticated.
125
+ * @returns {Promise<boolean>} - True if the user is authenticated, false otherwise.
126
+ */
127
+ async isAuthenticated(): Promise<boolean> {
128
+ try {
129
+ const response = await fetchHandler.get<boolean>(
130
+ "/auth/authenticated",
131
+ true
132
+ );
133
+ return response; // Return the boolean response directly from the API
134
+ } catch (error) {
135
+ return false; // Return false if there's an error (e.g., unauthorized)
136
+ }
112
137
  }
113
- }
114
138
 
115
- /**
139
+ /**
116
140
  * Get logged in user.
117
141
  * @param {string | null} authToken - Optional auth token.
118
142
  * @returns {Promise<User | null>} - The user data or null if not found.
119
143
  */
120
144
  async getUser(authToken: string | null = null): Promise<User | null> {
121
145
  try {
122
- const response = await fetchHandler.get<User>(`/auth/user`, true, authToken);
146
+ const response = await fetchHandler.get<User>(
147
+ `/auth/user`,
148
+ true,
149
+ authToken
150
+ );
123
151
  return response;
124
152
  } catch (error) {
125
153
  throw error;
126
154
  }
127
155
  }
128
156
 
129
- /**
130
- * Logout the authenticated user.
131
- * @returns {Promise<any>} - The response from the server.
132
- */
133
- async logout(): Promise<any> {
134
- try {
135
- const response = await fetchHandler.post<any, any>('/auth/logout', {}, true); // Assuming auth token is handled in fetchHandler
136
- // Clear tokens or session storage
137
- sessionStorage.removeItem('token');
138
- sessionStorage.removeItem('refreshToken');
139
- sessionStorage.removeItem('expiration');
140
-
141
- return response;
142
- } catch (error) {
143
- throw error;
157
+ /**
158
+ * Logout the authenticated user.
159
+ * @returns {Promise<any>} - The response from the server.
160
+ */
161
+ async logout(): Promise<any> {
162
+ try {
163
+ const response = await fetchHandler.post<any, any>(
164
+ "/auth/logout",
165
+ {},
166
+ true
167
+ ); // Assuming auth token is handled in fetchHandler
168
+ // Clear tokens or session storage
169
+ sessionStorage.removeItem("token");
170
+ sessionStorage.removeItem("refreshToken");
171
+ sessionStorage.removeItem("expiration");
172
+
173
+ return response;
174
+ } catch (error) {
175
+ throw error;
176
+ }
144
177
  }
145
- }
146
178
 
147
179
  async getPermissions(authToken: string | null = null): Promise<string[]> {
148
180
  try {
149
- const response = await fetchHandler.get<string[]>('/auth/permissions', true, authToken);
181
+ const response = await fetchHandler.get<string[]>(
182
+ "/auth/permissions",
183
+ true,
184
+ authToken
185
+ );
150
186
  return response;
151
187
  } catch (error) {
152
188
  throw error;
@@ -154,6 +190,4 @@ async logout(): Promise<any> {
154
190
  }
155
191
  }
156
192
 
157
-
158
-
159
- export default new AuthController();
193
+ export default new AuthController();
@@ -1,9 +1,9 @@
1
- import ClientLogInRequest from '../types/clientLoginRequest';
2
- import Credentials from '../types/credentials';
3
- import RefreshTokenRequest from '../types/refreshTokenRequest';
4
- import ChangeCompanyRequest from '../types/changeCompanyRequest';
5
- import Register from '../types/register';
6
- import User from '../types/user';
1
+ import ClientLogInRequest from "../types/clientLoginRequest";
2
+ import Credentials from "../types/credentials";
3
+ import RefreshTokenRequest from "../types/refreshTokenRequest";
4
+ import ChangeCompanyRequest from "../types/changeCompanyRequest";
5
+ import Register from "../types/register";
6
+ import User from "../types/user";
7
7
  /**
8
8
  * AuthController class that handles all the authentication API calls.
9
9
  */
@@ -39,19 +39,19 @@ declare class AuthController {
39
39
  */
40
40
  register(register: Register): Promise<any>;
41
41
  /**
42
- * Fetch the authorized companies for the current user.
43
- * @returns {Promise<any>} - The response containing the list of companies.
44
- */
42
+ * Fetch the authorized companies for the current user.
43
+ * @returns {Promise<any>} - The response containing the list of companies.
44
+ */
45
45
  getCompanies(): Promise<any>;
46
46
  /**
47
- * Get the current company details for the authenticated user.
48
- * @returns {Promise<any>} - The response containing the company name and company ID.
49
- */
47
+ * Get the current company details for the authenticated user.
48
+ * @returns {Promise<any>} - The response containing the company name and company ID.
49
+ */
50
50
  getCompany(): Promise<any>;
51
51
  /**
52
- * Get the roles for the authenticated user.
53
- * @returns {Promise<any>} - The response containing the list of roles.
54
- */
52
+ * Get the roles for the authenticated user.
53
+ * @returns {Promise<any>} - The response containing the list of roles.
54
+ */
55
55
  getRoles(): Promise<any>;
56
56
  /**
57
57
  * Check if the user is authenticated.
@@ -59,10 +59,10 @@ declare class AuthController {
59
59
  */
60
60
  isAuthenticated(): Promise<boolean>;
61
61
  /**
62
- * Get logged in user.
63
- * @param {string | null} authToken - Optional auth token.
64
- * @returns {Promise<User | null>} - The user data or null if not found.
65
- */
62
+ * Get logged in user.
63
+ * @param {string | null} authToken - Optional auth token.
64
+ * @returns {Promise<User | null>} - The user data or null if not found.
65
+ */
66
66
  getUser(authToken?: string | null): Promise<User | null>;
67
67
  /**
68
68
  * Logout the authenticated user.
package/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o=i,s={method:"POST",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o=i,s={method:"PUT",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File?e.append(n||"file",t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t.toString()):Array.isArray(t)?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):"object"==typeof t&&null!==t&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}.${r}`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r?(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}),n.credentials="omit"):n.credentials="include";let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const n="https://api.myhirecontrol.com",r=new e(n);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield r.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield r.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(n);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/details/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return o.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(n);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return a.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(n);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield l.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var g=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield p.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const m=new e(n);var y=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield m.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield m.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const C=new e(n);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload-profile-image",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({folderKey:t});return C.get(`/media/list?${n.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({key:t});return C.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const S=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return S.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return S.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.delete(`/filters/${t}`,!0,e)}))}};const b=new e(n);var T=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return b.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return b.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.delete(`/appendListings/${t}`,!0,e)}))}};const x=new e(n);var L=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return x.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return x.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.post("/forms/jsonSchema",t,!0,e)}))}};const F=new e(n);var P=new class{submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.post("/formsubmission",t,!0,e)}))}getFormSubmissions(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString()),F.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString());const u=yield F.getFile(`/formsubmission/export-csv?${a.toString()}`,!0,s),l=window.URL.createObjectURL(u),d=document.createElement("a");d.href=l,d.download="form_submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(l),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return F.get("/formsubmission/types",!0,t)}))}};const R=new e(n);var k,E,U,I=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return R.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.delete(`/companies/${t}`,!0,e)}))}};exports.EventType=void 0,(k=exports.EventType||(exports.EventType={}))[k.Virtual=0]="Virtual",k[k.InPerson=1]="InPerson",k[k.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(E=exports.CallToActionType||(exports.CallToActionType={}))[E.Button=0]="Button",E[E.Link=1]="Link",E[E.Download=2]="Download",E[E.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(U=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[U.Submitted=1]="Submitted",U[U.Hold=2]="Hold",U[U.Rejected=3]="Rejected",U[U.Sent=4]="Sent";const j={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},O={getAll:s.getEvents,get:s.getEvent,getBySlug:s.getEventBySlug,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},W={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},M=d,B=y,D={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},z={get:g.getMapConfig,update:g.updateMapConfig,create:g.createMapConfig},H={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},N={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},q={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},G={get:T.getAppendListings,getAppendListing:T.getAppendListing,create:T.createAppendListing,update:T.updateAppendListing,delete:T.deleteAppendListing},J={get:_.getAllPermissions},V={getAll:I.getCompanies,getById:I.getCompany,create:I.createCompany,update:I.updateCompany,delete:I.deleteCompany},K=L,Q=P,X={auth:j,events:O,roles:W,users:M,account:D,mapConfig:z,permissions:J,clientAuthConfig:H,filters:q,listings:B,media:N,appendListings:G,forms:K,formSubmissions:Q,companies:V};exports.account=D,exports.appendListings=G,exports.auth=j,exports.clientAuthConfig=H,exports.companies=V,exports.default=X,exports.events=O,exports.filters=q,exports.formSubmissions=Q,exports.forms=K,exports.listings=B,exports.mapConfig=z,exports.media=N,exports.permissions=J,exports.roles=W,exports.users=M;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o=i,s={method:"POST",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o=i,s={method:"PUT",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File?e.append(n||"file",t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t.toString()):Array.isArray(t)?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):"object"==typeof t&&null!==t&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}.${r}`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r?(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}),n.credentials="omit"):n.credentials="include";let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const n="https://api.myhirecontrol.com",r=new e(n),i="undefined"!=typeof window&&"localhost"===window.location.hostname;var o=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/nextLogin"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/refresh"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/changeCompany"+(i?"?localhost=true":"");return r.post(t,e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const s=new e(n);var a=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return s.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/details/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return s.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.delete(`/events/${t}`,!0,e)}))}};const u=new e(n);var l=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return u.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return u.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.delete(`/roles/${t}`,!0,e)}))}};const d=new e(n);var c=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield d.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield d.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const h=new e(n);var p=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield h.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield h.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield h.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const g=new e(n);var f=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield g.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.post("/mapconfig",t,!0,e)}))}};const _=new e(n);var w=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return _.get("/permissions",!0,t)}))}};const v=new e(n);var m=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield v.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield v.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return v.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return v.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return v.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const y=new e(n);var C=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield y.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield y.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const A=new e(n);var S=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return A.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return A.post("/media/upload-profile-image",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({folderKey:t});return A.get(`/media/list?${n.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({key:t});return A.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const $=new e(n);var b=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return $.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return $.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.delete(`/filters/${t}`,!0,e)}))}};const T=new e(n);var x=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return T.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return T.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.delete(`/appendListings/${t}`,!0,e)}))}};const L=new e(n);var F=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return L.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return L.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms/jsonSchema",t,!0,e)}))}};const P=new e(n);var k=new class{submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return P.post("/formsubmission",t,!0,e)}))}getFormSubmissions(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString()),P.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString());const u=yield P.getFile(`/formsubmission/export-csv?${a.toString()}`,!0,s),l=window.URL.createObjectURL(u),d=document.createElement("a");d.href=l,d.download="form_submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(l),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return P.get("/formsubmission/types",!0,t)}))}};const R=new e(n);var E,U,I,j=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return R.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.delete(`/companies/${t}`,!0,e)}))}};exports.EventType=void 0,(E=exports.EventType||(exports.EventType={}))[E.Virtual=0]="Virtual",E[E.InPerson=1]="InPerson",E[E.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(U=exports.CallToActionType||(exports.CallToActionType={}))[U.Button=0]="Button",U[U.Link=1]="Link",U[U.Download=2]="Download",U[U.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(I=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[I.Submitted=1]="Submitted",I[I.Hold=2]="Hold",I[I.Rejected=3]="Rejected",I[I.Sent=4]="Sent";const O={login:o.login,nextLogin:o.nextLogin,refreshToken:o.refreshToken,changeCompany:o.changeCompany,register:o.register,isAuthenticated:o.isAuthenticated,getCompany:o.getCompany,getCompanies:o.getCompanies,getRoles:o.getRoles,getPermissions:o.getPermissions,logout:o.logout,getUser:o.getUser},W={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},M={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},B=c,D=C,z={resetPassword:p.resetPassword,resetPasswordWithToken:p.resetPasswordWithToken,forgotPassword:p.forgotPassword},H={get:f.getMapConfig,update:f.updateMapConfig,create:f.createMapConfig},N={get:m.getClientAuthConfigById,getAll:m.getAllClientAuthConfigs,update:m.updateClientAuthConfig,create:m.createClientAuthConfig,delete:m.deleteClientAuthConfig},q={upload:S.uploadMedia,uploadProfileImage:S.uploadProfileImage,get:S.listMedia,delete:S.deleteMedia},G={getList:b.getFilters,get:b.getFilter,update:b.updateFilter,create:b.createFilter,delete:b.deleteFilter},J={get:x.getAppendListings,getAppendListing:x.getAppendListing,create:x.createAppendListing,update:x.updateAppendListing,delete:x.deleteAppendListing},V={get:w.getAllPermissions},K={getAll:j.getCompanies,getById:j.getCompany,create:j.createCompany,update:j.updateCompany,delete:j.deleteCompany},Q=F,X=k,Y={auth:O,events:W,roles:M,users:B,account:z,mapConfig:H,permissions:V,clientAuthConfig:N,filters:G,listings:D,media:q,appendListings:J,forms:Q,formSubmissions:X,companies:K};exports.account=z,exports.appendListings=J,exports.auth=O,exports.clientAuthConfig=N,exports.companies=K,exports.default=Y,exports.events=W,exports.filters=G,exports.formSubmissions=X,exports.forms=Q,exports.listings=D,exports.mapConfig=H,exports.media=q,exports.permissions=V,exports.roles=M,exports.users=B;
2
2
  //# sourceMappingURL=index.cjs.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcagency/hire-control-sdk",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",