@abcagency/hire-control-sdk 1.0.74 → 1.0.75

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.
@@ -0,0 +1,202 @@
1
+ import FetchHandler from "../handlers/fetchHandler";
2
+ import { API_URL } from "../constants/config";
3
+ import CategoryListDto, { AddValueRequest } from "../types/categoryList";
4
+
5
+ const fetchHandler = new FetchHandler(API_URL);
6
+
7
+ class CategoryListsController {
8
+ /**
9
+ * Get all category lists for the authenticated user's company.
10
+ * @param {string | null} authToken - Optional auth token.
11
+ * @returns {Promise<CategoryListDto[]>} - A list of category lists.
12
+ */
13
+ async getAllCategoryLists(
14
+ authToken: string | null = null
15
+ ): Promise<CategoryListDto[]> {
16
+ return fetchHandler.get<CategoryListDto[]>(
17
+ "/categorylist",
18
+ true,
19
+ authToken
20
+ );
21
+ }
22
+
23
+ /**
24
+ * Get a specific category list by ID.
25
+ * @param {string} id - The category list ID.
26
+ * @param {string | null} authToken - Optional auth token.
27
+ * @returns {Promise<CategoryListDto>} - The category list data.
28
+ */
29
+ async getCategoryListById(
30
+ id: string,
31
+ authToken: string | null = null
32
+ ): Promise<CategoryListDto> {
33
+ return fetchHandler.get<CategoryListDto>(
34
+ `/categorylist/${id}`,
35
+ true,
36
+ authToken
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Get category lists by type.
42
+ * @param {string} type - The category list type.
43
+ * @param {string | null} authToken - Optional auth token.
44
+ * @returns {Promise<CategoryListDto[]>} - A list of category lists of the specified type.
45
+ */
46
+ async getCategoryListsByType(
47
+ type: string,
48
+ authToken: string | null = null
49
+ ): Promise<CategoryListDto[]> {
50
+ return fetchHandler.get<CategoryListDto[]>(
51
+ `/categorylist/type/${type}`,
52
+ true,
53
+ authToken
54
+ );
55
+ }
56
+
57
+ /**
58
+ * Get active category lists for the authenticated user's company.
59
+ * @param {string | null} authToken - Optional auth token.
60
+ * @returns {Promise<CategoryListDto[]>} - A list of active category lists.
61
+ */
62
+ async getActiveCategoryLists(
63
+ authToken: string | null = null
64
+ ): Promise<CategoryListDto[]> {
65
+ return fetchHandler.get<CategoryListDto[]>(
66
+ "/categorylist/active",
67
+ true,
68
+ authToken
69
+ );
70
+ }
71
+
72
+ /**
73
+ * Get a category list by type and name.
74
+ * @param {string} type - The category list type.
75
+ * @param {string} name - The category list name.
76
+ * @param {string | null} authToken - Optional auth token.
77
+ * @returns {Promise<CategoryListDto>} - The category list data.
78
+ */
79
+ async getCategoryListByTypeAndName(
80
+ type: string,
81
+ name: string,
82
+ authToken: string | null = null
83
+ ): Promise<CategoryListDto> {
84
+ return fetchHandler.get<CategoryListDto>(
85
+ `/categorylist/type/${type}/name/${name}`,
86
+ true,
87
+ authToken
88
+ );
89
+ }
90
+
91
+ /**
92
+ * Create a new category list.
93
+ * @param {CategoryListDto} categoryList - The category list data to create.
94
+ * @param {string | null} authToken - Optional auth token.
95
+ * @returns {Promise<CategoryListDto>} - The newly created category list data.
96
+ */
97
+ async createCategoryList(
98
+ categoryList: CategoryListDto,
99
+ authToken: string | null = null
100
+ ): Promise<CategoryListDto> {
101
+ return fetchHandler.post<CategoryListDto, CategoryListDto>(
102
+ "/categorylist",
103
+ categoryList,
104
+ true,
105
+ authToken
106
+ );
107
+ }
108
+
109
+ /**
110
+ * Update an existing category list.
111
+ * @param {string} id - The category list ID to update.
112
+ * @param {CategoryListDto} categoryList - The updated category list data.
113
+ * @param {string | null} authToken - Optional auth token.
114
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
115
+ */
116
+ async updateCategoryList(
117
+ id: string,
118
+ categoryList: CategoryListDto,
119
+ authToken: string | null = null
120
+ ): Promise<CategoryListDto> {
121
+ return fetchHandler.put<CategoryListDto, CategoryListDto>(
122
+ `/categorylist/${id}`,
123
+ categoryList,
124
+ true,
125
+ authToken
126
+ );
127
+ }
128
+
129
+ /**
130
+ * Delete a category list by ID.
131
+ * @param {string} id - The ID of the category list to delete.
132
+ * @param {string | null} authToken - Optional auth token.
133
+ * @returns {Promise<void>} - No return value.
134
+ */
135
+ async deleteCategoryList(
136
+ id: string,
137
+ authToken: string | null = null
138
+ ): Promise<void> {
139
+ return fetchHandler.delete<void>(`/categorylist/${id}`, true, authToken);
140
+ }
141
+
142
+ /**
143
+ * Add a value to a category list.
144
+ * @param {string} id - The category list ID.
145
+ * @param {AddValueRequest} request - The key-value pair to add.
146
+ * @param {string | null} authToken - Optional auth token.
147
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
148
+ */
149
+ async addValue(
150
+ id: string,
151
+ request: AddValueRequest,
152
+ authToken: string | null = null
153
+ ): Promise<CategoryListDto> {
154
+ return fetchHandler.post<AddValueRequest, CategoryListDto>(
155
+ `/categorylist/${id}/values`,
156
+ request,
157
+ true,
158
+ authToken
159
+ );
160
+ }
161
+
162
+ /**
163
+ * Remove a value from a category list.
164
+ * @param {string} id - The category list ID.
165
+ * @param {string} key - The key of the value to remove.
166
+ * @param {string | null} authToken - Optional auth token.
167
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
168
+ */
169
+ async removeValue(
170
+ id: string,
171
+ key: string,
172
+ authToken: string | null = null
173
+ ): Promise<CategoryListDto> {
174
+ return fetchHandler.delete<CategoryListDto>(
175
+ `/categorylist/${id}/values/${key}`,
176
+ true,
177
+ authToken
178
+ );
179
+ }
180
+
181
+ /**
182
+ * Update values in a category list.
183
+ * @param {string} id - The category list ID.
184
+ * @param {Record<string, string>} values - The values to update.
185
+ * @param {string | null} authToken - Optional auth token.
186
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
187
+ */
188
+ async updateValues(
189
+ id: string,
190
+ values: Record<string, string>,
191
+ authToken: string | null = null
192
+ ): Promise<CategoryListDto> {
193
+ return fetchHandler.put<Record<string, string>, CategoryListDto>(
194
+ `/categorylist/${id}/values`,
195
+ values,
196
+ true,
197
+ authToken
198
+ );
199
+ }
200
+ }
201
+
202
+ export default new CategoryListsController();
@@ -0,0 +1,85 @@
1
+ import CategoryListDto, { AddValueRequest } from "../types/categoryList";
2
+ declare class CategoryListsController {
3
+ /**
4
+ * Get all category lists for the authenticated user's company.
5
+ * @param {string | null} authToken - Optional auth token.
6
+ * @returns {Promise<CategoryListDto[]>} - A list of category lists.
7
+ */
8
+ getAllCategoryLists(authToken?: string | null): Promise<CategoryListDto[]>;
9
+ /**
10
+ * Get a specific category list by ID.
11
+ * @param {string} id - The category list ID.
12
+ * @param {string | null} authToken - Optional auth token.
13
+ * @returns {Promise<CategoryListDto>} - The category list data.
14
+ */
15
+ getCategoryListById(id: string, authToken?: string | null): Promise<CategoryListDto>;
16
+ /**
17
+ * Get category lists by type.
18
+ * @param {string} type - The category list type.
19
+ * @param {string | null} authToken - Optional auth token.
20
+ * @returns {Promise<CategoryListDto[]>} - A list of category lists of the specified type.
21
+ */
22
+ getCategoryListsByType(type: string, authToken?: string | null): Promise<CategoryListDto[]>;
23
+ /**
24
+ * Get active category lists for the authenticated user's company.
25
+ * @param {string | null} authToken - Optional auth token.
26
+ * @returns {Promise<CategoryListDto[]>} - A list of active category lists.
27
+ */
28
+ getActiveCategoryLists(authToken?: string | null): Promise<CategoryListDto[]>;
29
+ /**
30
+ * Get a category list by type and name.
31
+ * @param {string} type - The category list type.
32
+ * @param {string} name - The category list name.
33
+ * @param {string | null} authToken - Optional auth token.
34
+ * @returns {Promise<CategoryListDto>} - The category list data.
35
+ */
36
+ getCategoryListByTypeAndName(type: string, name: string, authToken?: string | null): Promise<CategoryListDto>;
37
+ /**
38
+ * Create a new category list.
39
+ * @param {CategoryListDto} categoryList - The category list data to create.
40
+ * @param {string | null} authToken - Optional auth token.
41
+ * @returns {Promise<CategoryListDto>} - The newly created category list data.
42
+ */
43
+ createCategoryList(categoryList: CategoryListDto, authToken?: string | null): Promise<CategoryListDto>;
44
+ /**
45
+ * Update an existing category list.
46
+ * @param {string} id - The category list ID to update.
47
+ * @param {CategoryListDto} categoryList - The updated category list data.
48
+ * @param {string | null} authToken - Optional auth token.
49
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
50
+ */
51
+ updateCategoryList(id: string, categoryList: CategoryListDto, authToken?: string | null): Promise<CategoryListDto>;
52
+ /**
53
+ * Delete a category list by ID.
54
+ * @param {string} id - The ID of the category list to delete.
55
+ * @param {string | null} authToken - Optional auth token.
56
+ * @returns {Promise<void>} - No return value.
57
+ */
58
+ deleteCategoryList(id: string, authToken?: string | null): Promise<void>;
59
+ /**
60
+ * Add a value to a category list.
61
+ * @param {string} id - The category list ID.
62
+ * @param {AddValueRequest} request - The key-value pair to add.
63
+ * @param {string | null} authToken - Optional auth token.
64
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
65
+ */
66
+ addValue(id: string, request: AddValueRequest, authToken?: string | null): Promise<CategoryListDto>;
67
+ /**
68
+ * Remove a value from a category list.
69
+ * @param {string} id - The category list ID.
70
+ * @param {string} key - The key of the value to remove.
71
+ * @param {string | null} authToken - Optional auth token.
72
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
73
+ */
74
+ removeValue(id: string, key: string, authToken?: string | null): Promise<CategoryListDto>;
75
+ /**
76
+ * Update values in a category list.
77
+ * @param {string} id - The category list ID.
78
+ * @param {Record<string, string>} values - The values to update.
79
+ * @param {string | null} authToken - Optional auth token.
80
+ * @returns {Promise<CategoryListDto>} - The updated category list data.
81
+ */
82
+ updateValues(id: string, values: Record<string, string>, authToken?: string | null): Promise<CategoryListDto>;
83
+ }
84
+ declare const _default: CategoryListsController;
85
+ export default _default;
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,this.isLocalhost=!1}getAuthToken(){return this.isLocalhost?sessionStorage.getItem("token"):null}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"GET",credentials:n?"omit":"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){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());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){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());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)}))}patch(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"PATCH",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){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());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){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());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};this.isLocalhost&&(r=this.getAuthToken())&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`})),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*(){if(!this.isLocalhost){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 t=sessionStorage.getItem("refreshToken");if(!t)return!1;const e=yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(!e.ok)return console.error("Failed to refresh token"),!1;try{const t=yield e.json();return t.token&&sessionStorage.setItem("token",t.token),t.refreshToken&&sessionStorage.setItem("refreshToken",t.refreshToken),!0}catch(t){return console.error("Failed to parse refresh token response:",t),!1}}}))}}const n=process.env.NEXT_PUBLIC_API_URL||process.env.VITE_API_URL||process.env.REACT_APP_API_URL||"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":"");var n=yield r.post(t,e,!0);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}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)}))}getListingEvents(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/listingEvents/${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 g=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.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 g.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var _=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 v=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 m=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 y=new e(n);var b=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 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 L=new e(n);var F=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return L.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return L.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/appendListings/${t}`,!0,e)}))}};const k=new e(n);var T=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return k.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return k.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.post("/forms/jsonSchema",t,!0,e)}))}};const j=new e(n);var x=new class{submitContactForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return j.post("/contactForm",t,!0,e,!0)}))}submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return j.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()),j.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 j.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 j.get("/formsubmission/types",!0,t)}))}};const B=new e(n);var E=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return B.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return B.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.delete(`/companies/${t}`,!0,e)}))}syncAllCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return B.get("/companies/syncall",!0,t)}))}};const I=new e(n);var P=new class{getJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return I.get("/joblistings",!0,t)}))}getMapJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return I.get("/joblistings/MapListings",!0,t)}))}getJobListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return I.get(`/joblistings/${t}`,!0,e)}))}getMapListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return I.get(`/joblistings/MapListings/${t}`,!0,e)}))}createJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return I.post("/joblistings",t,!0,e)}))}updateJobListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return I.put(`/joblistings/${t}`,e,!0,n)}))}exportJobListingsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=10,e=1,n=null,r=null,i=null,o=null){const s=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});n&&s.append("status",n.toString()),r&&s.append("from",r.toISOString()),i&&s.append("to",i.toISOString());const a=yield I.getFile(`/joblistings/Export-csv?${s.toString()}`,!0,o),u=window.URL.createObjectURL(a),l=document.createElement("a");l.href=u,l.download="job_listings.csv",document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(u),document.body.removeChild(l)}))}deleteJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return I.delete(`/joblistings/${t}`,!0,e)}))}};const R=new e(n);var M=new class{getBlogs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return R.get("/blog",!0,t)}))}getBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/blog/${t}`,!0,e)}))}createBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/blog",t,!0,e)}))}updateBlog(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.put(`/blog/${t}`,e,!0,n)}))}deleteBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.delete(`/blog/${t}`,!0,e)}))}};const U=new e(n);var O=new class{getCategories(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){const n=new URLSearchParams;null!=t&&n.append("type",String(t));const r=n.toString()?`?${n.toString()}`:"";return U.get(`/categories${r}`,!0,e)}))}getCategoriesByCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;null!=e&&r.append("type",String(e));const i=r.toString()?`?${r.toString()}`:"";return U.get(`/categories/${t}${i}`,!0,n)}))}};const W=new e(n);var J=new class{getByFeed(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/feed/${t}`,!0,e)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.post("/jobFeedFieldMappings",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.put(`/jobFeedFieldMappings/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.delete(`/jobFeedFieldMappings/${t}`,!0,e)}))}toggleActive(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.post("/jobFeedFieldMappings/toggle-active",t,!0,e)}))}discoverFields(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/discover-fields/${t}`,!0,e)}))}validate(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/validate/${t}`,!0,e)}))}};const D=new e(n);var H=new class{getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return D.get("/jobfeeds",!0,t)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.get(`/jobfeeds/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.post("/jobfeeds",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return D.put(`/jobfeeds/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.delete(`/jobfeeds/${t}`,!0,e)}))}sync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.post(`/jobfeeds/${t}/sync`,{},!0,e)}))}toggleActive(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return D.patch(`/jobfeeds/${t}/toggle-active`,e,!0,n)}))}};const z=new e(n);var N=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return z.get("/jobListingSettings",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return z.post("/jobListingSettings",t,!0,e)}))}delete(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return z.delete("/jobListingSettings",!0,t)}))}};const V=new e(n);var q=new class{getAllSql(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;return e&&r.append("origin",e),V.post("/listingEntities"+(r.toString()?"?"+r.toString():""),t,!0,n)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return V.get("/listingEntities",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.post("/listingEntities/create",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){yield V.put(`/listingEntities/update/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){yield V.delete(`/listingEntities/delete/${t}`,!0,e)}))}};const G=new e(n);var K=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){const n=new URLSearchParams;t&&t.forEach((t=>n.append("recruiterIds",t.toString())));const r=n.toString()?`?${n.toString()}`:"";return G.get(`/recruiters${r}`,!0,e)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.get("/recruiters/all",!0,t)}))}sync(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.post("/recruiters/sync",{},!0,t)}))}};const X=new e(n);var Q=new class{getFieldTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return X.get("/field/types",!0,t)}))}};const Y=new e(n);var Z=new class{getValidatorTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return Y.get("/validator/types",!0,t)}))}};const tt=new e(n);var et=new class{getContentEntries(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.get(`/contententry?contentId=${t}`,!0,e)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.get(`/contententry/${t}`,!0,e)}))}createContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.post("/contententry",t,!0,e)}))}updateContentEntry(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return tt.put(`/contententry/${t}`,e,!0,n)}))}deleteContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.delete(`/contententry/${t}`,!0,e)}))}};const nt=new e(n);var rt=new class{getBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return nt.get("/block",!0,t)}))}getBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.get(`/block/${t}`,!0,e)}))}createBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.post("/block",t,!0,e)}))}updateBlock(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return nt.put(`/block/${t}`,e,!0,n)}))}deleteBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.delete(`/block/${t}`,!0,e)}))}};const it=new e(n);var ot,st,at,ut,lt=new class{getModels(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return it.get("/model",!0,t)}))}getModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.get(`/model/${t}`,!0,e)}))}createModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.post("/model",t,!0,e)}))}updateModel(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return it.put(`/model/${t}`,e,!0,n)}))}deleteModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.delete(`/model/${t}`,!0,e)}))}};exports.EventType=void 0,(ot=exports.EventType||(exports.EventType={}))[ot.Virtual=0]="Virtual",ot[ot.InPerson=1]="InPerson",ot[ot.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(st=exports.CallToActionType||(exports.CallToActionType={}))[st.Button=0]="Button",st[st.Link=1]="Link",st[st.Download=2]="Download",st[st.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(at=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[at.Submitted=1]="Submitted",at[at.Hold=2]="Hold",at[at.Rejected=3]="Rejected",at[at.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(ut=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[ut.Replace=0]="Replace",ut[ut.Append=1]="Append",ut[ut.Custom=2]="Custom";const dt={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},ct={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},gt={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},ht=c,pt=b,_t={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},ft={get:_.getMapConfig,update:_.updateMapConfig,create:_.createMapConfig},vt={get:m.getClientAuthConfigById,getAll:m.getAllClientAuthConfigs,update:m.updateClientAuthConfig,create:m.createClientAuthConfig,delete:m.deleteClientAuthConfig},wt={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},mt={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},yt={get:F.getAppendListings,getAppendListing:F.getAppendListing,create:F.createAppendListing,update:F.updateAppendListing,delete:F.deleteAppendListing},bt={getAll:M.getBlogs,getById:M.getBlog,create:M.createBlog,update:M.updateBlog,delete:M.deleteBlog},Ct={get:O.getCategories,getByCompany:O.getCategoriesByCompany},At={getByFeed:J.getByFeed,get:J.get,create:J.create,update:J.update,delete:J.delete,toggleActive:J.toggleActive,discoverFields:J.discoverFields,validate:J.validate},St={getAll:H.getAll,getById:H.get,create:H.create,update:H.update,delete:H.delete,sync:H.sync,toggleActive:H.toggleActive},$t={get:N.get,create:N.create,delete:N.delete},Lt={create:q.create,get:q.getAll,update:q.update,delete:q.delete,getAllSql:q.getAllSql},Ft={get:K.get,getAll:K.getAll,sync:K.sync},kt={get:v.getAllPermissions},Tt={getAll:E.getCompanies,getById:E.getCompany,create:E.createCompany,update:E.updateCompany,delete:E.deleteCompany,sync:E.syncAllCompanies},jt={getAll:P.getJobListingsByCompany,getMapListings:P.getMapJobListingsByCompany,getMapListing:P.getMapListingById,getById:P.getJobListingById,create:P.createJobListing,update:P.updateJobListing,delete:P.deleteJobListing,exportCsv:P.exportJobListingsCsv},xt={getTypes:Q.getFieldTypes},Bt={getTypes:Z.getValidatorTypes},Et={getAll:et.getContentEntries,getById:et.getContentEntry,create:et.createContentEntry,update:et.updateContentEntry,delete:et.deleteContentEntry},It={getAll:rt.getBlocks,getById:rt.getBlock,create:rt.createBlock,update:rt.updateBlock,delete:rt.deleteBlock},Pt={getAll:lt.getModels,getById:lt.getModel,create:lt.createModel,update:lt.updateModel,delete:lt.deleteModel},Rt=T,Mt=x,Ut={auth:dt,events:ct,roles:gt,users:ht,account:_t,mapConfig:ft,permissions:kt,clientAuthConfig:vt,filters:mt,listings:pt,media:wt,appendListings:yt,blogs:bt,categories:Ct,jobFeedFieldMappings:At,jobFeeds:St,jobListingSettings:$t,listingEntities:Lt,recruiters:Ft,forms:Rt,formSubmissions:Mt,companies:Tt,jobListings:jt};exports.account=_t,exports.appendListings=yt,exports.auth=dt,exports.blogs=bt,exports.categories=Ct,exports.clientAuthConfig=vt,exports.companies=Tt,exports.contentBlocks=It,exports.contentEntries=Et,exports.contentField=xt,exports.contentValidator=Bt,exports.default=Ut,exports.events=ct,exports.filters=mt,exports.formSubmissions=Mt,exports.forms=Rt,exports.jobFeedFieldMappings=At,exports.jobFeeds=St,exports.jobListingSettings=$t,exports.jobListings=jt,exports.listingEntities=Lt,exports.listings=pt,exports.mapConfig=ft,exports.media=wt,exports.model=Pt,exports.permissions=kt,exports.recruiters=Ft,exports.roles=gt,exports.users=ht;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t,this.isLocalhost=!1}getAuthToken(){return this.isLocalhost?sessionStorage.getItem("token"):null}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"GET",credentials:n?"omit":"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){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());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){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());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)}))}patch(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"PATCH",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){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());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){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());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};this.isLocalhost&&(r=this.getAuthToken())&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`})),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*(){if(!this.isLocalhost){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 t=sessionStorage.getItem("refreshToken");if(!t)return!1;const e=yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(!e.ok)return console.error("Failed to refresh token"),!1;try{const t=yield e.json();return t.token&&sessionStorage.setItem("token",t.token),t.refreshToken&&sessionStorage.setItem("refreshToken",t.refreshToken),!0}catch(t){return console.error("Failed to parse refresh token response:",t),!1}}}))}}const n=process.env.NEXT_PUBLIC_API_URL||process.env.VITE_API_URL||process.env.REACT_APP_API_URL||"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":"");var n=yield r.post(t,e,!0);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}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)}))}getListingEvents(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/listingEvents/${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 g=new e(n);var p=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.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 g.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const h=new e(n);var _=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield h.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return h.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return h.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var v=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 y=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 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 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 b=new e(n);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.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 b.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 b.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const L=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return L.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return L.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/filters/${t}`,!0,e)}))}};const S=new e(n);var F=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return S.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return S.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.delete(`/appendListings/${t}`,!0,e)}))}};const T=new e(n);var k=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return T.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return T.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.post("/forms/jsonSchema",t,!0,e)}))}};const B=new e(n);var j=new class{submitContactForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.post("/contactForm",t,!0,e,!0)}))}submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.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()),B.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 B.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 B.get("/formsubmission/types",!0,t)}))}};const x=new e(n);var I=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return x.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return x.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.delete(`/companies/${t}`,!0,e)}))}syncAllCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return x.get("/companies/syncall",!0,t)}))}};const E=new e(n);var P=new class{getJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return E.get("/joblistings",!0,t)}))}getMapJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return E.get("/joblistings/MapListings",!0,t)}))}getJobListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.get(`/joblistings/${t}`,!0,e)}))}getMapListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.get(`/joblistings/MapListings/${t}`,!0,e)}))}createJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.post("/joblistings",t,!0,e)}))}updateJobListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return E.put(`/joblistings/${t}`,e,!0,n)}))}exportJobListingsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=10,e=1,n=null,r=null,i=null,o=null){const s=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});n&&s.append("status",n.toString()),r&&s.append("from",r.toISOString()),i&&s.append("to",i.toISOString());const a=yield E.getFile(`/joblistings/Export-csv?${s.toString()}`,!0,o),u=window.URL.createObjectURL(a),l=document.createElement("a");l.href=u,l.download="job_listings.csv",document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(u),document.body.removeChild(l)}))}deleteJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.delete(`/joblistings/${t}`,!0,e)}))}};const R=new e(n);var M=new class{getBlogs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return R.get("/blog",!0,t)}))}getBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/blog/${t}`,!0,e)}))}createBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/blog",t,!0,e)}))}updateBlog(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.put(`/blog/${t}`,e,!0,n)}))}deleteBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.delete(`/blog/${t}`,!0,e)}))}};const U=new e(n);var O=new class{getCategories(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){const n=new URLSearchParams;null!=t&&n.append("type",String(t));const r=n.toString()?`?${n.toString()}`:"";return U.get(`/categories${r}`,!0,e)}))}getCategoriesByCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;null!=e&&r.append("type",String(e));const i=r.toString()?`?${r.toString()}`:"";return U.get(`/categories/${t}${i}`,!0,n)}))}};const W=new e(n);var J=new class{getAllCategoryLists(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return W.get("/categorylist",!0,t)}))}getCategoryListById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/categorylist/${t}`,!0,e)}))}getCategoryListsByType(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/categorylist/type/${t}`,!0,e)}))}getActiveCategoryLists(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return W.get("/categorylist/active",!0,t)}))}getCategoryListByTypeAndName(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.get(`/categorylist/type/${t}/name/${e}`,!0,n)}))}createCategoryList(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.post("/categorylist",t,!0,e)}))}updateCategoryList(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.put(`/categorylist/${t}`,e,!0,n)}))}deleteCategoryList(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.delete(`/categorylist/${t}`,!0,e)}))}addValue(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.post(`/categorylist/${t}/values`,e,!0,n)}))}removeValue(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.delete(`/categorylist/${t}/values/${e}`,!0,n)}))}updateValues(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.put(`/categorylist/${t}/values`,e,!0,n)}))}};const V=new e(n);var D=new class{getByFeed(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/jobFeedFieldMappings/feed/${t}`,!0,e)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/jobFeedFieldMappings/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.post("/jobFeedFieldMappings",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.put(`/jobFeedFieldMappings/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.delete(`/jobFeedFieldMappings/${t}`,!0,e)}))}toggleActive(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.post("/jobFeedFieldMappings/toggle-active",t,!0,e)}))}discoverFields(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/jobFeedFieldMappings/discover-fields/${t}`,!0,e)}))}validate(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/jobFeedFieldMappings/validate/${t}`,!0,e)}))}};const N=new e(n);var H=new class{getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return N.get("/jobfeeds",!0,t)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return N.get(`/jobfeeds/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return N.post("/jobfeeds",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return N.put(`/jobfeeds/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return N.delete(`/jobfeeds/${t}`,!0,e)}))}sync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return N.post(`/jobfeeds/${t}/sync`,{},!0,e)}))}toggleActive(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return N.patch(`/jobfeeds/${t}/toggle-active`,e,!0,n)}))}};const z=new e(n);var q=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return z.get("/jobListingSettings",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return z.post("/jobListingSettings",t,!0,e)}))}delete(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return z.delete("/jobListingSettings",!0,t)}))}};const G=new e(n);var K=new class{getAllSql(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;return e&&r.append("origin",e),G.post("/listingEntities"+(r.toString()?"?"+r.toString():""),t,!0,n)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.get("/listingEntities",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return G.post("/listingEntities/create",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){yield G.put(`/listingEntities/update/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){yield G.delete(`/listingEntities/delete/${t}`,!0,e)}))}};const X=new e(n);var Q=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){const n=new URLSearchParams;t&&t.forEach((t=>n.append("recruiterIds",t.toString())));const r=n.toString()?`?${n.toString()}`:"";return X.get(`/recruiters${r}`,!0,e)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return X.get("/recruiters/all",!0,t)}))}sync(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return X.post("/recruiters/sync",{},!0,t)}))}};const Y=new e(n);var Z=new class{getFieldTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return Y.get("/field/types",!0,t)}))}};const tt=new e(n);var et=new class{getValidatorTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return tt.get("/validator/types",!0,t)}))}};const nt=new e(n);var rt=new class{getContentEntries(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.get(`/contententry?contentId=${t}`,!0,e)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.get(`/contententry/${t}`,!0,e)}))}createContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.post("/contententry",t,!0,e)}))}updateContentEntry(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return nt.put(`/contententry/${t}`,e,!0,n)}))}deleteContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.delete(`/contententry/${t}`,!0,e)}))}};const it=new e(n);var ot=new class{getBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return it.get("/block",!0,t)}))}getBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.get(`/block/${t}`,!0,e)}))}createBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.post("/block",t,!0,e)}))}updateBlock(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return it.put(`/block/${t}`,e,!0,n)}))}deleteBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.delete(`/block/${t}`,!0,e)}))}};const st=new e(n);var at,ut,lt,dt,ct=new class{getModels(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return st.get("/model",!0,t)}))}getModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.get(`/model/${t}`,!0,e)}))}createModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.post("/model",t,!0,e)}))}updateModel(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return st.put(`/model/${t}`,e,!0,n)}))}deleteModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.delete(`/model/${t}`,!0,e)}))}};exports.EventType=void 0,(at=exports.EventType||(exports.EventType={}))[at.Virtual=0]="Virtual",at[at.InPerson=1]="InPerson",at[at.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(ut=exports.CallToActionType||(exports.CallToActionType={}))[ut.Button=0]="Button",ut[ut.Link=1]="Link",ut[ut.Download=2]="Download",ut[ut.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(lt=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[lt.Submitted=1]="Submitted",lt[lt.Hold=2]="Hold",lt[lt.Rejected=3]="Rejected",lt[lt.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(dt=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[dt.Replace=0]="Replace",dt[dt.Append=1]="Append",dt[dt.Custom=2]="Custom";const gt={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},pt={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},ht={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},_t=c,ft=C,vt={resetPassword:p.resetPassword,resetPasswordWithToken:p.resetPasswordWithToken,forgotPassword:p.forgotPassword},wt={get:_.getMapConfig,update:_.updateMapConfig,create:_.createMapConfig},yt={get:y.getClientAuthConfigById,getAll:y.getAllClientAuthConfigs,update:y.updateClientAuthConfig,create:y.createClientAuthConfig,delete:y.deleteClientAuthConfig},mt={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},Ct={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},bt={get:F.getAppendListings,getAppendListing:F.getAppendListing,create:F.createAppendListing,update:F.updateAppendListing,delete:F.deleteAppendListing},At={getAll:M.getBlogs,getById:M.getBlog,create:M.createBlog,update:M.updateBlog,delete:M.deleteBlog},Lt={get:O.getCategories,getByCompany:O.getCategoriesByCompany},$t={getAll:J.getAllCategoryLists,getById:J.getCategoryListById,getByType:J.getCategoryListsByType,getActive:J.getActiveCategoryLists,getByTypeAndName:J.getCategoryListByTypeAndName,create:J.createCategoryList,update:J.updateCategoryList,delete:J.deleteCategoryList,addValue:J.addValue,removeValue:J.removeValue,updateValues:J.updateValues},St={getByFeed:D.getByFeed,get:D.get,create:D.create,update:D.update,delete:D.delete,toggleActive:D.toggleActive,discoverFields:D.discoverFields,validate:D.validate},Ft={getAll:H.getAll,getById:H.get,create:H.create,update:H.update,delete:H.delete,sync:H.sync,toggleActive:H.toggleActive},Tt={get:q.get,create:q.create,delete:q.delete},kt={create:K.create,get:K.getAll,update:K.update,delete:K.delete,getAllSql:K.getAllSql},Bt={get:Q.get,getAll:Q.getAll,sync:Q.sync},jt={get:v.getAllPermissions},xt={getAll:I.getCompanies,getById:I.getCompany,create:I.createCompany,update:I.updateCompany,delete:I.deleteCompany,sync:I.syncAllCompanies},It={getAll:P.getJobListingsByCompany,getMapListings:P.getMapJobListingsByCompany,getMapListing:P.getMapListingById,getById:P.getJobListingById,create:P.createJobListing,update:P.updateJobListing,delete:P.deleteJobListing,exportCsv:P.exportJobListingsCsv},Et={getTypes:Z.getFieldTypes},Pt={getTypes:et.getValidatorTypes},Rt={getAll:rt.getContentEntries,getById:rt.getContentEntry,create:rt.createContentEntry,update:rt.updateContentEntry,delete:rt.deleteContentEntry},Mt={getAll:ot.getBlocks,getById:ot.getBlock,create:ot.createBlock,update:ot.updateBlock,delete:ot.deleteBlock},Ut={getAll:ct.getModels,getById:ct.getModel,create:ct.createModel,update:ct.updateModel,delete:ct.deleteModel},Ot=k,Wt=j,Jt={auth:gt,events:pt,roles:ht,users:_t,account:vt,mapConfig:wt,permissions:jt,clientAuthConfig:yt,filters:Ct,listings:ft,media:mt,appendListings:bt,blogs:At,categories:Lt,categoryLists:$t,jobFeedFieldMappings:St,jobFeeds:Ft,jobListingSettings:Tt,listingEntities:kt,recruiters:Bt,forms:Ot,formSubmissions:Wt,companies:xt,jobListings:It};exports.account=vt,exports.appendListings=bt,exports.auth=gt,exports.blogs=At,exports.categories=Lt,exports.categoryLists=$t,exports.clientAuthConfig=yt,exports.companies=xt,exports.contentBlocks=Mt,exports.contentEntries=Rt,exports.contentField=Et,exports.contentValidator=Pt,exports.default=Jt,exports.events=pt,exports.filters=Ct,exports.formSubmissions=Wt,exports.forms=Ot,exports.jobFeedFieldMappings=St,exports.jobFeeds=Ft,exports.jobListingSettings=Tt,exports.jobListings=It,exports.listingEntities=kt,exports.listings=ft,exports.mapConfig=wt,exports.media=mt,exports.model=Ut,exports.permissions=jt,exports.recruiters=Bt,exports.roles=ht,exports.users=_t;
2
2
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ import ContentModel from "./types/content/model";
21
21
  import ContentBlock from "./types/content/block";
22
22
  import ContentEntry from "./types/content/contentEntry";
23
23
  import Blog from "./types/blog";
24
+ import CategoryListDto, { AddValueRequest } from "./types/categoryList";
24
25
  import JobFeed from "./types/jobFeed";
25
26
  import JobFeedFieldMapping from "./types/jobFeedFieldMapping";
26
27
  import JobListingSettings, { FeedHandlingOption } from "./types/jobListingSettings";
@@ -109,6 +110,19 @@ export declare const categories: {
109
110
  get: (type?: number | null, authToken?: string | null) => Promise<string[]>;
110
111
  getByCompany: (companyId: number, type?: number | null, authToken?: string | null) => Promise<any[]>;
111
112
  };
113
+ export declare const categoryLists: {
114
+ getAll: (authToken?: string | null) => Promise<CategoryListDto[]>;
115
+ getById: (id: string, authToken?: string | null) => Promise<CategoryListDto>;
116
+ getByType: (type: string, authToken?: string | null) => Promise<CategoryListDto[]>;
117
+ getActive: (authToken?: string | null) => Promise<CategoryListDto[]>;
118
+ getByTypeAndName: (type: string, name: string, authToken?: string | null) => Promise<CategoryListDto>;
119
+ create: (categoryList: CategoryListDto, authToken?: string | null) => Promise<CategoryListDto>;
120
+ update: (id: string, categoryList: CategoryListDto, authToken?: string | null) => Promise<CategoryListDto>;
121
+ delete: (id: string, authToken?: string | null) => Promise<void>;
122
+ addValue: (id: string, request: AddValueRequest, authToken?: string | null) => Promise<CategoryListDto>;
123
+ removeValue: (id: string, key: string, authToken?: string | null) => Promise<CategoryListDto>;
124
+ updateValues: (id: string, values: Record<string, string>, authToken?: string | null) => Promise<CategoryListDto>;
125
+ };
112
126
  export declare const jobFeedFieldMappings: {
113
127
  getByFeed: (feedId: string, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
114
128
  get: (id: string, authToken?: string | null) => Promise<JobFeedFieldMapping>;
@@ -208,7 +222,7 @@ export declare const formSubmissions: {
208
222
  exportFormSubmissionsCsv(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<void>;
209
223
  getFormSubmissionTypes(authToken?: string | null): Promise<string[]>;
210
224
  };
211
- export type { Register, User, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing, Form, FormSubmission, ResultsWrapper, Company, JobListing, FieldTypeDefinition, ValidatorDefinition, ContentModel, ContentBlock, ContentEntry, Blog, JobFeed, JobFeedFieldMapping, JobListingSettings, ListingEntityDto, RecruiterDto, FocalPoint, };
225
+ export type { Register, User, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing, Form, FormSubmission, ResultsWrapper, Company, JobListing, FieldTypeDefinition, ValidatorDefinition, ContentModel, ContentBlock, ContentEntry, Blog, CategoryListDto, AddValueRequest, JobFeed, JobFeedFieldMapping, JobListingSettings, ListingEntityDto, RecruiterDto, FocalPoint, };
212
226
  export { EventType, CallToActionType, FormSubmissionStatus, FeedHandlingOption, };
213
227
  declare const hcApi: {
214
228
  auth: {
@@ -296,6 +310,19 @@ declare const hcApi: {
296
310
  get: (type?: number | null, authToken?: string | null) => Promise<string[]>;
297
311
  getByCompany: (companyId: number, type?: number | null, authToken?: string | null) => Promise<any[]>;
298
312
  };
313
+ categoryLists: {
314
+ getAll: (authToken?: string | null) => Promise<CategoryListDto[]>;
315
+ getById: (id: string, authToken?: string | null) => Promise<CategoryListDto>;
316
+ getByType: (type: string, authToken?: string | null) => Promise<CategoryListDto[]>;
317
+ getActive: (authToken?: string | null) => Promise<CategoryListDto[]>;
318
+ getByTypeAndName: (type: string, name: string, authToken?: string | null) => Promise<CategoryListDto>;
319
+ create: (categoryList: CategoryListDto, authToken?: string | null) => Promise<CategoryListDto>;
320
+ update: (id: string, categoryList: CategoryListDto, authToken?: string | null) => Promise<CategoryListDto>;
321
+ delete: (id: string, authToken?: string | null) => Promise<void>;
322
+ addValue: (id: string, request: AddValueRequest, authToken?: string | null) => Promise<CategoryListDto>;
323
+ removeValue: (id: string, key: string, authToken?: string | null) => Promise<CategoryListDto>;
324
+ updateValues: (id: string, values: Record<string, string>, authToken?: string | null) => Promise<CategoryListDto>;
325
+ };
299
326
  jobFeedFieldMappings: {
300
327
  getByFeed: (feedId: string, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
301
328
  get: (id: string, authToken?: string | null) => Promise<JobFeedFieldMapping>;
@@ -0,0 +1,24 @@
1
+ export type ModifiedByDto = {
2
+ userId: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ dateTime: string;
6
+ };
7
+ export type CategoryListDto = {
8
+ id: string;
9
+ companyId: string;
10
+ type: string;
11
+ name: string;
12
+ description?: string;
13
+ values: Record<string, string>;
14
+ isActive: boolean;
15
+ createdDate: string;
16
+ updatedDate?: string;
17
+ createdBy?: ModifiedByDto;
18
+ updatedBy?: ModifiedByDto;
19
+ };
20
+ export type AddValueRequest = {
21
+ key: string;
22
+ value: string;
23
+ };
24
+ export default CategoryListDto;
package/index.ts CHANGED
@@ -19,6 +19,7 @@ import CompaniesController from "./controllers/companiesController";
19
19
  import JobListingsController from "./controllers/jobListingsController";
20
20
  import blogController from "./controllers/blogController";
21
21
  import categoriesController from "./controllers/categoriesController";
22
+ import categoryListsController from "./controllers/categoryListsController";
22
23
  import jobFeedFieldMappingsController from "./controllers/jobFeedFieldMappingsController";
23
24
  import jobFeedsController from "./controllers/jobFeedsController";
24
25
  import jobListingSettingsController from "./controllers/jobListingSettingsController";
@@ -57,6 +58,7 @@ import ContentModel from "./types/content/model";
57
58
  import ContentBlock from "./types/content/block";
58
59
  import ContentEntry from "./types/content/contentEntry";
59
60
  import Blog from "./types/blog";
61
+ import CategoryListDto, { AddValueRequest } from "./types/categoryList";
60
62
  import JobFeed from "./types/jobFeed";
61
63
  import JobFeedFieldMapping from "./types/jobFeedFieldMapping";
62
64
  import JobListingSettings, {
@@ -156,6 +158,20 @@ export const categories = {
156
158
  getByCompany: categoriesController.getCategoriesByCompany,
157
159
  };
158
160
 
161
+ export const categoryLists = {
162
+ getAll: categoryListsController.getAllCategoryLists,
163
+ getById: categoryListsController.getCategoryListById,
164
+ getByType: categoryListsController.getCategoryListsByType,
165
+ getActive: categoryListsController.getActiveCategoryLists,
166
+ getByTypeAndName: categoryListsController.getCategoryListByTypeAndName,
167
+ create: categoryListsController.createCategoryList,
168
+ update: categoryListsController.updateCategoryList,
169
+ delete: categoryListsController.deleteCategoryList,
170
+ addValue: categoryListsController.addValue,
171
+ removeValue: categoryListsController.removeValue,
172
+ updateValues: categoryListsController.updateValues,
173
+ };
174
+
159
175
  export const jobFeedFieldMappings = {
160
176
  getByFeed: jobFeedFieldMappingsController.getByFeed,
161
177
  get: jobFeedFieldMappingsController.get,
@@ -281,6 +297,8 @@ export type {
281
297
  ContentBlock,
282
298
  ContentEntry,
283
299
  Blog,
300
+ CategoryListDto,
301
+ AddValueRequest,
284
302
  JobFeed,
285
303
  JobFeedFieldMapping,
286
304
  JobListingSettings,
@@ -311,6 +329,7 @@ const hcApi = {
311
329
  appendListings,
312
330
  blogs,
313
331
  categories,
332
+ categoryLists,
314
333
  jobFeedFieldMappings,
315
334
  jobFeeds,
316
335
  jobListingSettings,
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@abcagency/hire-control-sdk",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "rollup -c",
9
- "test": "echo \"Error: no test specified\" && exit 1"
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
+ "prepublishOnly": "npm run build",
11
+ "release": "npm version patch && npm publish",
12
+ "release:minor": "npm version minor && npm publish",
13
+ "release:major": "npm version major && npm publish"
10
14
  },
11
15
  "keywords": [],
12
16
  "author": "",
@@ -0,0 +1,27 @@
1
+ export type ModifiedByDto = {
2
+ userId: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ dateTime: string;
6
+ };
7
+
8
+ export type CategoryListDto = {
9
+ id: string;
10
+ companyId: string;
11
+ type: string;
12
+ name: string;
13
+ description?: string;
14
+ values: Record<string, string>;
15
+ isActive: boolean;
16
+ createdDate: string;
17
+ updatedDate?: string;
18
+ createdBy?: ModifiedByDto;
19
+ updatedBy?: ModifiedByDto;
20
+ };
21
+
22
+ export type AddValueRequest = {
23
+ key: string;
24
+ value: string;
25
+ };
26
+
27
+ export default CategoryListDto;