@abcagency/hire-control-sdk 1.0.95 → 1.0.97

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,5 +1,9 @@
1
1
  import FetchHandler from "../../handlers/fetchHandler";
2
- import Model from "../../types/content/model";
2
+ import Model, {
3
+ ContentModuleSyncExecuteRequest,
4
+ ContentModuleSyncExecuteResult,
5
+ ContentModuleSyncPreview,
6
+ } from "../../types/content/model";
3
7
  import { API_URL } from "../../constants/config";
4
8
 
5
9
  const fetchHandler = new FetchHandler(API_URL);
@@ -69,6 +73,41 @@ class ModelsController {
69
73
  ): Promise<void> {
70
74
  return fetchHandler.delete(`/model/${id}`, true, authToken);
71
75
  }
76
+
77
+ /**
78
+ * Preview content module sync state for a model.
79
+ * @param {string} id - The model ID.
80
+ * @param {string | null} authToken - Optional auth token.
81
+ * @returns {Promise<ContentModuleSyncPreview>} - Sync preview details.
82
+ */
83
+ async previewSync(
84
+ id: string,
85
+ authToken: string | null = null
86
+ ): Promise<ContentModuleSyncPreview> {
87
+ return fetchHandler.get<ContentModuleSyncPreview>(
88
+ `/model/${id}/sync/preview`,
89
+ true,
90
+ authToken
91
+ );
92
+ }
93
+
94
+ /**
95
+ * Execute content module sync for a model.
96
+ * @param {string} id - The model ID.
97
+ * @param {ContentModuleSyncExecuteRequest} request - Sync mode and optional source keys.
98
+ * @param {string | null} authToken - Optional auth token.
99
+ * @returns {Promise<ContentModuleSyncExecuteResult>} - Sync execution result.
100
+ */
101
+ async executeSync(
102
+ id: string,
103
+ request: ContentModuleSyncExecuteRequest,
104
+ authToken: string | null = null
105
+ ): Promise<ContentModuleSyncExecuteResult> {
106
+ return fetchHandler.post<
107
+ ContentModuleSyncExecuteRequest,
108
+ ContentModuleSyncExecuteResult
109
+ >(`/model/${id}/sync`, request, true, authToken);
110
+ }
72
111
  }
73
112
 
74
113
  export default new ModelsController();
@@ -1,4 +1,4 @@
1
- import Model from "../../types/content/model";
1
+ import Model, { ContentModuleSyncExecuteRequest, ContentModuleSyncExecuteResult, ContentModuleSyncPreview } from "../../types/content/model";
2
2
  declare class ModelsController {
3
3
  /**
4
4
  * Get all models for the current company.
@@ -35,6 +35,21 @@ declare class ModelsController {
35
35
  * @returns {Promise<void>} - No return value.
36
36
  */
37
37
  deleteModel(id: string, authToken?: string | null): Promise<void>;
38
+ /**
39
+ * Preview content module sync state for a model.
40
+ * @param {string} id - The model ID.
41
+ * @param {string | null} authToken - Optional auth token.
42
+ * @returns {Promise<ContentModuleSyncPreview>} - Sync preview details.
43
+ */
44
+ previewSync(id: string, authToken?: string | null): Promise<ContentModuleSyncPreview>;
45
+ /**
46
+ * Execute content module sync for a model.
47
+ * @param {string} id - The model ID.
48
+ * @param {ContentModuleSyncExecuteRequest} request - Sync mode and optional source keys.
49
+ * @param {string | null} authToken - Optional auth token.
50
+ * @returns {Promise<ContentModuleSyncExecuteResult>} - Sync execution result.
51
+ */
52
+ executeSync(id: string, request: ContentModuleSyncExecuteRequest, authToken?: string | null): Promise<ContentModuleSyncExecuteResult>;
38
53
  }
39
54
  declare const _default: ModelsController;
40
55
  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?yield 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(){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/refresh"+(i?"?localhost=true":""),e=yield r.post(t,{},!0);return e&&i&&(sessionStorage.setItem("token",e.token),sessionStorage.setItem("refreshToken",e.refreshToken),sessionStorage.setItem("expiration",e.expiration)),e}))}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{const t=yield r.get("/auth/authenticated",!0);return t||(yield this.tryRefreshAndCheckAuth())}catch(t){return yield this.tryRefreshAndCheckAuth()}}))}tryRefreshAndCheckAuth(){return t.__awaiter(this,void 0,void 0,(function*(){try{yield this.refreshToken();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 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 A=new e(n);var b=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 L=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 S=new e(n);var k=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 F=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,a=null){const u=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&u.append("status",r.toString()),n&&u.append("type",n),i&&u.append("from",i.toISOString()),o&&u.append("to",o.toISOString()),s&&s.length>0&&s.forEach((t=>u.append("columns",t)));const l=yield B.getFile(`/formsubmission/export-csv?${u.toString()}`,!0,a),d=window.URL.createObjectURL(l),c=document.createElement("a");c.href=d,c.download="HireControl_Form_Submissions.csv",document.body.appendChild(c),c.click(),window.URL.revokeObjectURL(d),document.body.removeChild(c)}))}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 R=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,e=null){return e?E.get(`/joblistings/MapListings?filterId=${e}`,!0,t):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 M=new e(n);var P=new class{getBlogs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return M.get("/blog",!0,t)}))}getBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.get(`/blog/${t}`,!0,e)}))}createBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.post("/blog",t,!0,e)}))}updateBlog(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return M.put(`/blog/${t}`,e,!0,n)}))}deleteBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.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 H=new e(n);var N=new class{getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return H.get("/jobfeeds",!0,t)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.get(`/jobfeeds/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.post("/jobfeeds",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return H.put(`/jobfeeds/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.delete(`/jobfeeds/${t}`,!0,e)}))}sync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.post(`/jobfeeds/${t}/sync`,{},!0,e)}))}toggleActive(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return H.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,n=null){let r=`/contententry?contentId=${t}`;return null!==e&&(r+=`&statusFilter=${e}`),nt.get(r,!0,n)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){let r=`/contententry/${t}`;return null!==e&&(r+=`?statusFilter=${e}`),nt.get(r,!0,n)}))}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)}))}getVersions(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.get(`/contententry/${t}/versions`,!0,e)}))}unpublishAll(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.post(`/contententry/${t}/unpublish`,void 0,!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)}))}getTemplateBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return it.get("/block/template-blocks",!0,t)}))}};const st=new e(n);var at=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)}))}};const ut=new e(n);var lt,dt,ct,gt,ht=new class{getCompletion(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ut.post("/openai/completion",t,!0,e)}))}};exports.EventType=void 0,(lt=exports.EventType||(exports.EventType={}))[lt.Virtual=0]="Virtual",lt[lt.InPerson=1]="InPerson",lt[lt.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(dt=exports.CallToActionType||(exports.CallToActionType={}))[dt.Button=0]="Button",dt[dt.Link=1]="Link",dt[dt.Download=2]="Download",dt[dt.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(ct=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[ct.Submitted=1]="Submitted",ct[ct.Hold=2]="Hold",ct[ct.Rejected=3]="Rejected",ct[ct.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(gt=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[gt.Replace=0]="Replace",gt[gt.Append=1]="Append",gt[gt.Custom=2]="Custom";const pt={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},_t={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},ft={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},vt=c,wt=C,yt={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},mt={get:_.getMapConfig,update:_.updateMapConfig,create:_.createMapConfig},Ct={get:y.getClientAuthConfigById,getAll:y.getAllClientAuthConfigs,update:y.updateClientAuthConfig,create:y.createClientAuthConfig,delete:y.deleteClientAuthConfig},At={upload:b.uploadMedia,uploadProfileImage:b.uploadProfileImage,get:b.listMedia,delete:b.deleteMedia},bt={getList:L.getFilters,get:L.getFilter,update:L.updateFilter,create:L.createFilter,delete:L.deleteFilter},$t={get:k.getAppendListings,getAppendListing:k.getAppendListing,create:k.createAppendListing,update:k.updateAppendListing,delete:k.deleteAppendListing},Lt={getAll:P.getBlogs,getById:P.getBlog,create:P.createBlog,update:P.updateBlog,delete:P.deleteBlog},St={get:O.getCategories,getByCompany:O.getCategoriesByCompany},kt={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},Tt={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:N.getAll,getById:N.get,create:N.create,update:N.update,delete:N.delete,sync:N.sync,toggleActive:N.toggleActive},Bt={get:q.get,create:q.create,delete:q.delete},jt={create:K.create,get:K.getAll,update:K.update,delete:K.delete,getAllSql:K.getAllSql},xt={get:Q.get,getAll:Q.getAll,sync:Q.sync},It={get:v.getAllPermissions},Et={getAll:I.getCompanies,getById:I.getCompany,create:I.createCompany,update:I.updateCompany,delete:I.deleteCompany,sync:I.syncAllCompanies},Rt={getAll:R.getJobListingsByCompany,getMapListings:R.getMapJobListingsByCompany,getMapListing:R.getMapListingById,getById:R.getJobListingById,create:R.createJobListing,update:R.updateJobListing,delete:R.deleteJobListing},Mt={getTypes:Z.getFieldTypes},Pt={getTypes:et.getValidatorTypes},Ut={getAll:rt.getContentEntries,getById:rt.getContentEntry,create:rt.createContentEntry,update:rt.updateContentEntry,delete:rt.deleteContentEntry,unpublish:rt.unpublishAll},Ot={getAll:ot.getBlocks,getById:ot.getBlock,create:ot.createBlock,update:ot.updateBlock,delete:ot.deleteBlock,getTemplateBlocks:ot.getTemplateBlocks},Wt={getAll:at.getModels,getById:at.getModel,create:at.createModel,update:at.updateModel,delete:at.deleteModel},Jt={getCompletion:ht.getCompletion},Vt=F,Dt=j,Ht={auth:pt,events:_t,roles:ft,users:vt,account:yt,mapConfig:mt,permissions:It,clientAuthConfig:Ct,filters:bt,listings:wt,media:At,appendListings:$t,blogs:Lt,categories:St,categoryLists:kt,jobFeedFieldMappings:Tt,jobFeeds:Ft,jobListingSettings:Bt,listingEntities:jt,recruiters:xt,forms:Vt,formSubmissions:Dt,openAI:Jt,companies:Et,jobListings:Rt};exports.account=yt,exports.appendListings=$t,exports.auth=pt,exports.blogs=Lt,exports.categories=St,exports.categoryLists=kt,exports.clientAuthConfig=Ct,exports.companies=Et,exports.contentBlocks=Ot,exports.contentEntries=Ut,exports.contentField=Mt,exports.contentValidator=Pt,exports.default=Ht,exports.events=_t,exports.filters=bt,exports.formSubmissions=Dt,exports.forms=Vt,exports.jobFeedFieldMappings=Tt,exports.jobFeeds=Ft,exports.jobListingSettings=Bt,exports.jobListings=Rt,exports.listingEntities=jt,exports.listings=wt,exports.mapConfig=mt,exports.media=At,exports.model=Wt,exports.openAI=Jt,exports.permissions=It,exports.recruiters=xt,exports.roles=ft,exports.users=vt;
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?yield 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(){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/refresh"+(i?"?localhost=true":""),e=yield r.post(t,{},!0);return e&&i&&(sessionStorage.setItem("token",e.token),sessionStorage.setItem("refreshToken",e.refreshToken),sessionStorage.setItem("expiration",e.expiration)),e}))}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{const t=yield r.get("/auth/authenticated",!0);return t||(yield this.tryRefreshAndCheckAuth())}catch(t){return yield this.tryRefreshAndCheckAuth()}}))}tryRefreshAndCheckAuth(){return t.__awaiter(this,void 0,void 0,(function*(){try{yield this.refreshToken();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 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 A=new e(n);var b=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 S=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 L=new e(n);var k=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 T=new e(n);var F=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,a=null){const u=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&u.append("status",r.toString()),n&&u.append("type",n),i&&u.append("from",i.toISOString()),o&&u.append("to",o.toISOString()),s&&s.length>0&&s.forEach((t=>u.append("columns",t)));const l=yield B.getFile(`/formsubmission/export-csv?${u.toString()}`,!0,a),d=window.URL.createObjectURL(l),c=document.createElement("a");c.href=d,c.download="HireControl_Form_Submissions.csv",document.body.appendChild(c),c.click(),window.URL.revokeObjectURL(d),document.body.removeChild(c)}))}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 R=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,e=null){return e?E.get(`/joblistings/MapListings?filterId=${e}`,!0,t):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 M=new e(n);var P=new class{getBlogs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return M.get("/blog",!0,t)}))}getBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.get(`/blog/${t}`,!0,e)}))}createBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.post("/blog",t,!0,e)}))}updateBlog(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return M.put(`/blog/${t}`,e,!0,n)}))}deleteBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.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 H=new e(n);var N=new class{getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return H.get("/jobfeeds",!0,t)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.get(`/jobfeeds/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.post("/jobfeeds",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return H.put(`/jobfeeds/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.delete(`/jobfeeds/${t}`,!0,e)}))}sync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.post(`/jobfeeds/${t}/sync`,{},!0,e)}))}toggleActive(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return H.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,n=null){let r=`/contententry?contentId=${t}`;return null!==e&&(r+=`&statusFilter=${e}`),nt.get(r,!0,n)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){let r=`/contententry/${t}`;return null!==e&&(r+=`?statusFilter=${e}`),nt.get(r,!0,n)}))}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)}))}getVersions(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.get(`/contententry/${t}/versions`,!0,e)}))}unpublishAll(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.post(`/contententry/${t}/unpublish`,void 0,!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)}))}getTemplateBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return it.get("/block/template-blocks",!0,t)}))}};const st=new e(n);var at=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)}))}previewSync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.get(`/model/${t}/sync/preview`,!0,e)}))}executeSync(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return st.post(`/model/${t}/sync`,e,!0,n)}))}};const ut=new e(n);var lt,dt,ct,gt,ht=new class{getCompletion(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ut.post("/openai/completion",t,!0,e)}))}};exports.EventType=void 0,(lt=exports.EventType||(exports.EventType={}))[lt.Virtual=0]="Virtual",lt[lt.InPerson=1]="InPerson",lt[lt.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(dt=exports.CallToActionType||(exports.CallToActionType={}))[dt.Button=0]="Button",dt[dt.Link=1]="Link",dt[dt.Download=2]="Download",dt[dt.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(ct=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[ct.Submitted=1]="Submitted",ct[ct.Hold=2]="Hold",ct[ct.Rejected=3]="Rejected",ct[ct.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(gt=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[gt.Replace=0]="Replace",gt[gt.Append=1]="Append",gt[gt.Custom=2]="Custom";const pt={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},_t={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},ft={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},vt=c,wt=C,yt={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},mt={get:_.getMapConfig,update:_.updateMapConfig,create:_.createMapConfig},Ct={get:y.getClientAuthConfigById,getAll:y.getAllClientAuthConfigs,update:y.updateClientAuthConfig,create:y.createClientAuthConfig,delete:y.deleteClientAuthConfig},At={upload:b.uploadMedia,uploadProfileImage:b.uploadProfileImage,get:b.listMedia,delete:b.deleteMedia},bt={getList:S.getFilters,get:S.getFilter,update:S.updateFilter,create:S.createFilter,delete:S.deleteFilter},$t={get:k.getAppendListings,getAppendListing:k.getAppendListing,create:k.createAppendListing,update:k.updateAppendListing,delete:k.deleteAppendListing},St={getAll:P.getBlogs,getById:P.getBlog,create:P.createBlog,update:P.updateBlog,delete:P.deleteBlog},Lt={get:O.getCategories,getByCompany:O.getCategoriesByCompany},kt={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},Tt={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:N.getAll,getById:N.get,create:N.create,update:N.update,delete:N.delete,sync:N.sync,toggleActive:N.toggleActive},Bt={get:q.get,create:q.create,delete:q.delete},jt={create:K.create,get:K.getAll,update:K.update,delete:K.delete,getAllSql:K.getAllSql},xt={get:Q.get,getAll:Q.getAll,sync:Q.sync},It={get:v.getAllPermissions},Et={getAll:I.getCompanies,getById:I.getCompany,create:I.createCompany,update:I.updateCompany,delete:I.deleteCompany,sync:I.syncAllCompanies},Rt={getAll:R.getJobListingsByCompany,getMapListings:R.getMapJobListingsByCompany,getMapListing:R.getMapListingById,getById:R.getJobListingById,create:R.createJobListing,update:R.updateJobListing,delete:R.deleteJobListing},Mt={getTypes:Z.getFieldTypes},Pt={getTypes:et.getValidatorTypes},Ut={getAll:rt.getContentEntries,getById:rt.getContentEntry,create:rt.createContentEntry,update:rt.updateContentEntry,delete:rt.deleteContentEntry,unpublish:rt.unpublishAll},Ot={getAll:ot.getBlocks,getById:ot.getBlock,create:ot.createBlock,update:ot.updateBlock,delete:ot.deleteBlock,getTemplateBlocks:ot.getTemplateBlocks},Wt={getAll:at.getModels,getById:at.getModel,create:at.createModel,update:at.updateModel,delete:at.deleteModel,previewSync:at.previewSync,executeSync:at.executeSync},Jt={getCompletion:ht.getCompletion},Vt=F,Dt=j,Ht={auth:pt,events:_t,roles:ft,users:vt,account:yt,mapConfig:mt,permissions:It,clientAuthConfig:Ct,filters:bt,listings:wt,media:At,appendListings:$t,blogs:St,categories:Lt,categoryLists:kt,jobFeedFieldMappings:Tt,jobFeeds:Ft,jobListingSettings:Bt,listingEntities:jt,recruiters:xt,forms:Vt,formSubmissions:Dt,openAI:Jt,companies:Et,jobListings:Rt};exports.account=yt,exports.appendListings=$t,exports.auth=pt,exports.blogs=St,exports.categories=Lt,exports.categoryLists=kt,exports.clientAuthConfig=Ct,exports.companies=Et,exports.contentBlocks=Ot,exports.contentEntries=Ut,exports.contentField=Mt,exports.contentValidator=Pt,exports.default=Ht,exports.events=_t,exports.filters=bt,exports.formSubmissions=Dt,exports.forms=Vt,exports.jobFeedFieldMappings=Tt,exports.jobFeeds=Ft,exports.jobListingSettings=Bt,exports.jobListings=Rt,exports.listingEntities=jt,exports.listings=wt,exports.mapConfig=mt,exports.media=At,exports.model=Wt,exports.openAI=Jt,exports.permissions=It,exports.recruiters=xt,exports.roles=ft,exports.users=vt;
2
2
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ import ResultsWrapper from "./types/resultsWrapper";
17
17
  import { JobListing } from "./types/JobListing";
18
18
  import FieldTypeDefinition from "./types/content/fieldDefinition";
19
19
  import ValidatorDefinition from "./types/content/validatorDefinition";
20
- import ContentModel from "./types/content/model";
20
+ import ContentModel, { ModuleConfig, ModuleFieldMapping, ModuleIdentityMapping, WebPageTemplate, WebPageTemplateSection, WebPageTemplateBlock, ContentModuleSyncPreview, ContentModuleSyncExecuteRequest, ContentModuleSyncExecuteResult } 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";
@@ -208,6 +208,8 @@ export declare const model: {
208
208
  create: (model: ContentModel, authToken?: string | null) => Promise<ContentModel>;
209
209
  update: (id: string, model: ContentModel, authToken?: string | null) => Promise<ContentModel>;
210
210
  delete: (id: string, authToken?: string | null) => Promise<void>;
211
+ previewSync: (id: string, authToken?: string | null) => Promise<ContentModuleSyncPreview>;
212
+ executeSync: (id: string, request: ContentModuleSyncExecuteRequest, authToken?: string | null) => Promise<ContentModuleSyncExecuteResult>;
211
213
  };
212
214
  export declare const openAI: {
213
215
  getCompletion: (request: CompletionRequest, authToken?: string | null) => Promise<CompletionResponse>;
@@ -227,7 +229,7 @@ export declare const formSubmissions: {
227
229
  exportFormSubmissionsCsv(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, columns?: string[] | null, authToken?: string | null): Promise<void>;
228
230
  getFormSubmissionTypes(authToken?: string | null): Promise<string[]>;
229
231
  };
230
- 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, MultipleFieldConfig, ConditionalConfig, ConditionalRule, JobListingSettings, ListingEntityDto, RecruiterDto, FocalPoint, CompletionRequest, CompletionResponse, };
232
+ export type { Register, User, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing, Form, FormSubmission, ResultsWrapper, Company, JobListing, FieldTypeDefinition, ValidatorDefinition, ContentModel, ModuleConfig, ModuleFieldMapping, ModuleIdentityMapping, WebPageTemplate, WebPageTemplateSection, WebPageTemplateBlock, ContentModuleSyncPreview, ContentModuleSyncExecuteRequest, ContentModuleSyncExecuteResult, ContentBlock, ContentEntry, Blog, CategoryListDto, AddValueRequest, JobFeed, JobFeedFieldMapping, MultipleFieldConfig, ConditionalConfig, ConditionalRule, JobListingSettings, ListingEntityDto, RecruiterDto, FocalPoint, CompletionRequest, CompletionResponse, };
231
233
  export { EventType, CallToActionType, FormSubmissionStatus, FeedHandlingOption, };
232
234
  declare const hcApi: {
233
235
  auth: {
@@ -12,6 +12,8 @@ export type CategoryListDto = {
12
12
  description?: string;
13
13
  values: Record<string, string>;
14
14
  isActive: boolean;
15
+ autoAddNewValues: boolean;
16
+ notifyOnNewValues: boolean;
15
17
  createdDate: string;
16
18
  updatedDate?: string;
17
19
  createdBy?: ModifiedByDto;
@@ -4,6 +4,7 @@ export type ContentEntry = {
4
4
  id: string;
5
5
  contentId?: string;
6
6
  contentName?: string;
7
+ displayName?: string;
7
8
  companyId: string;
8
9
  fields: {
9
10
  [key: string]: any;
@@ -4,12 +4,84 @@ export type Field = {
4
4
  category: string;
5
5
  [key: string]: any;
6
6
  };
7
+ export type ModuleIdentityMapping = {
8
+ sourcePath?: string;
9
+ };
10
+ export type ModuleFieldMapping = {
11
+ targetField?: string;
12
+ sourcePath?: string;
13
+ applyOnSync?: boolean;
14
+ };
15
+ export type ModuleSourceFilter = {
16
+ combinator?: "and" | "or" | string;
17
+ rules?: Array<any>;
18
+ not?: boolean;
19
+ };
20
+ export type WebPageTemplateBlock = {
21
+ id?: string;
22
+ blockKey?: string;
23
+ defaultValues?: Record<string, any>;
24
+ };
25
+ export type WebPageTemplateSection = {
26
+ id?: string;
27
+ title?: string;
28
+ slug?: string;
29
+ showInNav?: boolean;
30
+ blocks?: WebPageTemplateBlock[];
31
+ };
32
+ export type WebPageTemplate = {
33
+ sections?: WebPageTemplateSection[];
34
+ };
35
+ export type ModuleConfig = {
36
+ sourceType?: "listingEntities" | "jobListings" | "categoryLists" | string;
37
+ autoSetupEntries?: boolean;
38
+ identityMapping?: ModuleIdentityMapping;
39
+ fieldMappings?: ModuleFieldMapping[];
40
+ sourceFilter?: ModuleSourceFilter;
41
+ webPageTemplate?: WebPageTemplate;
42
+ };
43
+ export type ContentModuleSyncPreview = {
44
+ modelId: string;
45
+ sourceRecordCount: number;
46
+ entryCount: number;
47
+ missingEntries: Array<{
48
+ sourceKey: string;
49
+ displayName: string;
50
+ }>;
51
+ orphanedEntries: Array<{
52
+ entryId: string;
53
+ sourceKey: string;
54
+ displayName: string;
55
+ sourceExists: boolean;
56
+ }>;
57
+ staleEntries: Array<{
58
+ entryId: string;
59
+ sourceKey: string;
60
+ displayName: string;
61
+ sourceExists: boolean;
62
+ }>;
63
+ };
64
+ export type ContentModuleSyncExecuteRequest = {
65
+ mode?: "create-missing" | "sync-existing" | "full";
66
+ sourceKeys?: string[];
67
+ };
68
+ export type ContentModuleSyncExecuteResult = {
69
+ modelId: string;
70
+ mode: string;
71
+ createdCount: number;
72
+ updatedCount: number;
73
+ skippedCount: number;
74
+ createdEntryIds: string[];
75
+ updatedEntryIds: string[];
76
+ };
7
77
  export type Model = {
8
78
  id: string;
9
79
  companyId: string;
10
80
  name?: string;
11
81
  key?: string;
12
82
  description?: string;
83
+ modelKind?: "webPage" | "contentModule" | string;
84
+ moduleConfig?: ModuleConfig;
13
85
  fields: Field[];
14
86
  };
15
87
  export default Model;
@@ -65,6 +65,14 @@ export type ListingEntity = {
65
65
  entityDisplayName?: string;
66
66
  address?: Address;
67
67
  travelTime?: string;
68
+ logoUrl?: string;
69
+ photoUrl?: string;
70
+ descriptionJson?: string;
71
+ descriptionHtml?: string;
72
+ descriptionPlainText?: string;
73
+ communityJson?: string;
74
+ communityHtml?: string;
75
+ communityPlainText?: string;
68
76
  };
69
77
  export type Address = {
70
78
  location?: string;
@@ -8,5 +8,13 @@ export type ListingEntityDto = {
8
8
  address: Address;
9
9
  travelTime?: string;
10
10
  staticMapUrl?: string;
11
+ logoUrl?: string;
12
+ photoUrl?: string;
13
+ descriptionJson?: string;
14
+ descriptionHtml?: string;
15
+ descriptionPlainText?: string;
16
+ communityJson?: string;
17
+ communityHtml?: string;
18
+ communityPlainText?: string;
11
19
  };
12
20
  export default ListingEntityDto;
@@ -9,6 +9,14 @@ export type mongoListingEntity = {
9
9
  travelTime?: string;
10
10
  staticMapUrl?: string;
11
11
  entityKey?: string;
12
+ logoUrl?: string;
13
+ photoUrl?: string;
14
+ descriptionJson?: string;
15
+ descriptionHtml?: string;
16
+ descriptionPlainText?: string;
17
+ communityJson?: string;
18
+ communityHtml?: string;
19
+ communityPlainText?: string;
12
20
  comapnyId?: string;
13
21
  DateAdded?: Date | null;
14
22
  DateCreated?: Date | null;
package/index.ts CHANGED
@@ -55,7 +55,17 @@ import ResultsWrapper from "./types/resultsWrapper";
55
55
  import { JobListing } from "./types/JobListing";
56
56
  import FieldTypeDefinition from "./types/content/fieldDefinition";
57
57
  import ValidatorDefinition from "./types/content/validatorDefinition";
58
- import ContentModel from "./types/content/model";
58
+ import ContentModel, {
59
+ ModuleConfig,
60
+ ModuleFieldMapping,
61
+ ModuleIdentityMapping,
62
+ WebPageTemplate,
63
+ WebPageTemplateSection,
64
+ WebPageTemplateBlock,
65
+ ContentModuleSyncPreview,
66
+ ContentModuleSyncExecuteRequest,
67
+ ContentModuleSyncExecuteResult,
68
+ } from "./types/content/model";
59
69
  import ContentBlock from "./types/content/block";
60
70
  import ContentEntry from "./types/content/contentEntry";
61
71
  import Blog from "./types/blog";
@@ -276,6 +286,8 @@ export const model = {
276
286
  create: modelController.createModel,
277
287
  update: modelController.updateModel,
278
288
  delete: modelController.deleteModel,
289
+ previewSync: modelController.previewSync,
290
+ executeSync: modelController.executeSync,
279
291
  };
280
292
 
281
293
  export const openAI = {
@@ -307,6 +319,15 @@ export type {
307
319
  FieldTypeDefinition,
308
320
  ValidatorDefinition,
309
321
  ContentModel,
322
+ ModuleConfig,
323
+ ModuleFieldMapping,
324
+ ModuleIdentityMapping,
325
+ WebPageTemplate,
326
+ WebPageTemplateSection,
327
+ WebPageTemplateBlock,
328
+ ContentModuleSyncPreview,
329
+ ContentModuleSyncExecuteRequest,
330
+ ContentModuleSyncExecuteResult,
310
331
  ContentBlock,
311
332
  ContentEntry,
312
333
  Blog,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@abcagency/hire-control-sdk",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
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
+ "build:watch": "rollup -c --watch",
9
10
  "test": "echo \"Error: no test specified\" && exit 1",
10
11
  "prepublishOnly": "npm run build",
11
12
  "release": "npm version patch && npm publish",
@@ -13,6 +13,8 @@ export type CategoryListDto = {
13
13
  description?: string;
14
14
  values: Record<string, string>;
15
15
  isActive: boolean;
16
+ autoAddNewValues: boolean;
17
+ notifyOnNewValues: boolean;
16
18
  createdDate: string;
17
19
  updatedDate?: string;
18
20
  createdBy?: ModifiedByDto;
@@ -5,6 +5,7 @@ export type ContentEntry = {
5
5
  id: string;
6
6
  contentId?: string;
7
7
  contentName?: string;
8
+ displayName?: string;
8
9
  companyId: string;
9
10
  fields: {
10
11
  [key: string]: any;
@@ -5,12 +5,94 @@ export type Field = {
5
5
  [key: string]: any;
6
6
  };
7
7
 
8
+ export type ModuleIdentityMapping = {
9
+ sourcePath?: string;
10
+ };
11
+
12
+ export type ModuleFieldMapping = {
13
+ targetField?: string;
14
+ sourcePath?: string;
15
+ applyOnSync?: boolean;
16
+ };
17
+
18
+ export type ModuleSourceFilter = {
19
+ combinator?: "and" | "or" | string;
20
+ rules?: Array<any>;
21
+ not?: boolean;
22
+ };
23
+
24
+ export type WebPageTemplateBlock = {
25
+ id?: string;
26
+ blockKey?: string;
27
+ defaultValues?: Record<string, any>;
28
+ };
29
+
30
+ export type WebPageTemplateSection = {
31
+ id?: string;
32
+ title?: string;
33
+ slug?: string;
34
+ showInNav?: boolean;
35
+ blocks?: WebPageTemplateBlock[];
36
+ };
37
+
38
+ export type WebPageTemplate = {
39
+ sections?: WebPageTemplateSection[];
40
+ };
41
+
42
+ export type ModuleConfig = {
43
+ sourceType?: "listingEntities" | "jobListings" | "categoryLists" | string;
44
+ autoSetupEntries?: boolean;
45
+ identityMapping?: ModuleIdentityMapping;
46
+ fieldMappings?: ModuleFieldMapping[];
47
+ sourceFilter?: ModuleSourceFilter;
48
+ webPageTemplate?: WebPageTemplate;
49
+ };
50
+
51
+ export type ContentModuleSyncPreview = {
52
+ modelId: string;
53
+ sourceRecordCount: number;
54
+ entryCount: number;
55
+ missingEntries: Array<{
56
+ sourceKey: string;
57
+ displayName: string;
58
+ }>;
59
+ orphanedEntries: Array<{
60
+ entryId: string;
61
+ sourceKey: string;
62
+ displayName: string;
63
+ sourceExists: boolean;
64
+ }>;
65
+ staleEntries: Array<{
66
+ entryId: string;
67
+ sourceKey: string;
68
+ displayName: string;
69
+ sourceExists: boolean;
70
+ }>;
71
+ };
72
+
73
+ export type ContentModuleSyncExecuteRequest = {
74
+ mode?: "create-missing" | "sync-existing" | "full";
75
+ sourceKeys?: string[];
76
+ };
77
+
78
+ export type ContentModuleSyncExecuteResult = {
79
+ modelId: string;
80
+ mode: string;
81
+ createdCount: number;
82
+ updatedCount: number;
83
+ skippedCount: number;
84
+ createdEntryIds: string[];
85
+ updatedEntryIds: string[];
86
+ };
87
+
8
88
  export type Model = {
9
89
  id: string;
10
90
  companyId: string;
11
91
  name?: string;
12
92
  key?: string;
13
93
  description?: string;
94
+ modelKind?: "webPage" | "contentModule" | string;
95
+ moduleConfig?: ModuleConfig;
14
96
  fields: Field[];
15
97
  };
16
98
 
package/types/listing.ts CHANGED
@@ -76,6 +76,14 @@ export type ListingEntity = {
76
76
  entityDisplayName?: string;
77
77
  address?: Address;
78
78
  travelTime?: string;
79
+ logoUrl?: string;
80
+ photoUrl?: string;
81
+ descriptionJson?: string;
82
+ descriptionHtml?: string;
83
+ descriptionPlainText?: string;
84
+ communityJson?: string;
85
+ communityHtml?: string;
86
+ communityPlainText?: string;
79
87
  };
80
88
 
81
89
  export type Address = {
@@ -9,6 +9,14 @@ export type ListingEntityDto = {
9
9
  address: Address;
10
10
  travelTime?: string;
11
11
  staticMapUrl?: string;
12
+ logoUrl?: string;
13
+ photoUrl?: string;
14
+ descriptionJson?: string;
15
+ descriptionHtml?: string;
16
+ descriptionPlainText?: string;
17
+ communityJson?: string;
18
+ communityHtml?: string;
19
+ communityPlainText?: string;
12
20
  };
13
21
 
14
22
  export default ListingEntityDto;
@@ -10,6 +10,14 @@ export type mongoListingEntity = {
10
10
  travelTime?: string;
11
11
  staticMapUrl?: string;
12
12
  entityKey?: string;
13
+ logoUrl?: string;
14
+ photoUrl?: string;
15
+ descriptionJson?: string;
16
+ descriptionHtml?: string;
17
+ descriptionPlainText?: string;
18
+ communityJson?: string;
19
+ communityHtml?: string;
20
+ communityPlainText?: string;
13
21
  comapnyId?: string;
14
22
  DateAdded?: Date | null;
15
23
  DateCreated?: Date | null;