@abcagency/hire-control-sdk 1.0.22 → 1.0.23

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 +1 @@
1
- export const API_URL = "https://api.myhirecontrol.com";
1
+ export const API_URL = "http://localhost:5108";
@@ -0,0 +1,63 @@
1
+ import FetchHandler from "../handlers/fetchHandler";
2
+ import Form from "../types/form";
3
+ import { API_URL } from "../constants/config";
4
+
5
+ const fetchHandler = new FetchHandler(API_URL);
6
+
7
+ class FormsController {
8
+ /**
9
+ * Get all forms for the authenticated user’s company.
10
+ * @param {string | null} authToken - Optional auth token.
11
+ * @returns {Promise<Form[]>} - A list of forms.
12
+ */
13
+ async getForms(authToken: string | null = null): Promise<Form[]> {
14
+ return fetchHandler.get<Form[]>("/forms", true, authToken);
15
+ }
16
+
17
+ /**
18
+ * Get a specific form by ID.
19
+ * @param {string} id - The form ID.
20
+ * @param {string | null} authToken - Optional auth token.
21
+ * @returns {Promise<Form>} - The form data.
22
+ */
23
+ async getForm(id: string, authToken: string | null = null): Promise<Form> {
24
+ return fetchHandler.get<Form>(`/forms/${id}`, true, authToken);
25
+ }
26
+
27
+ /**
28
+ * Create a new form.
29
+ * @param {Form} form - The form data to create.
30
+ * @param {string | null} authToken - Optional auth token.
31
+ * @returns {Promise<Form>} - The newly created form data.
32
+ */
33
+ async createForm(form: Form, authToken: string | null = null): Promise<Form> {
34
+ return fetchHandler.post<Form, Form>("/forms", form, true, authToken);
35
+ }
36
+
37
+ /**
38
+ * Update an existing form.
39
+ * @param {string} id - The form ID to update.
40
+ * @param {Form} form - The updated form data.
41
+ * @param {string | null} authToken - Optional auth token.
42
+ * @returns {Promise<void>} - No return value.
43
+ */
44
+ async updateForm(
45
+ id: string,
46
+ form: Form,
47
+ authToken: string | null = null
48
+ ): Promise<void> {
49
+ return fetchHandler.put<Form, void>(`/forms/${id}`, form, true, authToken);
50
+ }
51
+
52
+ /**
53
+ * Delete an existing form.
54
+ * @param {string} id - The form ID to delete.
55
+ * @param {string | null} authToken - Optional auth token.
56
+ * @returns {Promise<void>} - No return value.
57
+ */
58
+ async deleteForm(id: string, authToken: string | null = null): Promise<void> {
59
+ return fetchHandler.delete(`/forms/${id}`, true, authToken);
60
+ }
61
+ }
62
+
63
+ export default new FormsController();
@@ -1 +1 @@
1
- export declare const API_URL = "https://api.myhirecontrol.com";
1
+ export declare const API_URL = "http://localhost:5108";
@@ -0,0 +1,40 @@
1
+ import Form from "../types/form";
2
+ declare class FormsController {
3
+ /**
4
+ * Get all forms for the authenticated user’s company.
5
+ * @param {string | null} authToken - Optional auth token.
6
+ * @returns {Promise<Form[]>} - A list of forms.
7
+ */
8
+ getForms(authToken?: string | null): Promise<Form[]>;
9
+ /**
10
+ * Get a specific form by ID.
11
+ * @param {string} id - The form ID.
12
+ * @param {string | null} authToken - Optional auth token.
13
+ * @returns {Promise<Form>} - The form data.
14
+ */
15
+ getForm(id: string, authToken?: string | null): Promise<Form>;
16
+ /**
17
+ * Create a new form.
18
+ * @param {Form} form - The form data to create.
19
+ * @param {string | null} authToken - Optional auth token.
20
+ * @returns {Promise<Form>} - The newly created form data.
21
+ */
22
+ createForm(form: Form, authToken?: string | null): Promise<Form>;
23
+ /**
24
+ * Update an existing form.
25
+ * @param {string} id - The form ID to update.
26
+ * @param {Form} form - The updated form data.
27
+ * @param {string | null} authToken - Optional auth token.
28
+ * @returns {Promise<void>} - No return value.
29
+ */
30
+ updateForm(id: string, form: Form, authToken?: string | null): Promise<void>;
31
+ /**
32
+ * Delete an existing form.
33
+ * @param {string} id - The form ID to delete.
34
+ * @param {string | null} authToken - Optional auth token.
35
+ * @returns {Promise<void>} - No return value.
36
+ */
37
+ deleteForm(id: string, authToken?: string | null): Promise<void>;
38
+ }
39
+ declare const _default: FormsController;
40
+ 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}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o={method:"POST",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),n?this.fetchWithAuth(t,o,r):this.fetchWithoutAuth(t,o)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o={method:"PUT",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),n?this.fetchWithAuth(t,o,r):this.fetchWithoutAuth(t,o)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"DELETE",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t):t instanceof Array?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):t instanceof Object&&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}`}));let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const n="https://api.myhirecontrol.com",r=new e(n);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield r.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield r.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(n);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return o.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(n);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return a.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(n);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield l.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const g=new e(n);var p=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield g.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const v=new e(n);var w=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield v.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield v.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return v.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return v.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return v.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const y=new e(n);var m=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield y.get("/listings",!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield y.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const A=new e(n);var C=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return A.post("/media/upload",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 T=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return T.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return T.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return T.delete(`/filters/${t}`,!0,e)}))}};const L=new e(n);var x,P,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)}))}};exports.EventType=void 0,(x=exports.EventType||(exports.EventType={}))[x.Virtual=0]="Virtual",x[x.InPerson=1]="InPerson",x[x.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(P=exports.CallToActionType||(exports.CallToActionType={}))[P.Button=0]="Button",P[P.Link=1]="Link",P[P.Download=2]="Download";const E={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},F={getAll:s.getEvents,get:s.getEvent,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},U={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},W=d,R=m,S={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},b={get:p.getMapConfig,update:p.updateMapConfig,create:p.createMapConfig},M={get:w.getClientAuthConfigById,getAll:w.getAllClientAuthConfigs,update:w.updateClientAuthConfig,create:w.createClientAuthConfig,delete:w.deleteClientAuthConfig},I={upload:C.uploadMedia,get:C.listMedia,delete:C.deleteMedia},j={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},D={get:k.getAppendListings,getAppendListing:k.getAppendListing,create:k.createAppendListing,update:k.updateAppendListing,delete:k.deleteAppendListing},O={get:_.getAllPermissions},B={auth:E,events:F,roles:U,users:W,account:S,mapConfig:b,permissions:O,clientAuthConfig:M,filters:j,listings:R,media:I,appendListings:D};exports.account=S,exports.appendListings=D,exports.auth=E,exports.clientAuthConfig=M,exports.default=B,exports.events=F,exports.filters=j,exports.listings=R,exports.mapConfig=b,exports.media=I,exports.permissions=O,exports.roles=U,exports.users=W;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,r=null){const n={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,n,r):this.fetchWithoutAuth(t,n)}))}post(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=!1,n=null,i=!1){const o={method:"POST",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),r?this.fetchWithAuth(t,o,n):this.fetchWithoutAuth(t,o)}))}put(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=!1,n=null,i=!1){const o={method:"PUT",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),r?this.fetchWithAuth(t,o,n):this.fetchWithoutAuth(t,o)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,r=null){const n={method:"DELETE",credentials:"include"};return e?this.fetchWithAuth(t,n,r):this.fetchWithoutAuth(t,n)}))}convertToFormData(t,e=new FormData,r=""){return t instanceof File||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(r,t):t instanceof Array?t.forEach(((t,n)=>{this.convertToFormData(t,e,`${r}[${n}]`)})):t instanceof Object&&Object.keys(t).forEach((n=>{const i=t[n],o=r?`${r}[${n}]`:n;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,r){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,r);return this.handleResponse(t)}))}fetchWithAuth(e,r,n){return t.__awaiter(this,void 0,void 0,(function*(){n&&(r.headers=Object.assign(Object.assign({},r.headers),{Authorization:`Bearer ${n}`}));let t=yield fetch(`${this.apiUrl}${e}`,r);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,r)}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 r=yield e.json();console.log(r),r&&r.message&&(t=r.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const r="http://localhost:5108",n=new e(r);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield n.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield n.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return n.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return n.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield n.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield n.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield n.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 n.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(r);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return o.put(`/events/${t}`,e,!0,r)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(r);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return a.put(`/roles/${t}`,e,!0,r)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(r);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){try{yield l.put(`/users/${t}`,e,!0,r)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(r);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const g=new e(r);var p=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield g.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return g.post("/mapconfig",t,!0,e)}))}};const f=new e(r);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(r);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return w.put(`/clientAuthConfig/${t}`,e,!0,r)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const y=new e(r);var m=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield y.get("/listings",!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(r);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)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const r=new URLSearchParams({folderKey:t});return C.get(`/media/list?${r.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const r=new URLSearchParams({key:t});return C.delete(`/media/delete?${r.toString()}`,!0,e)}))}};const $=new e(r);var T=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,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return $.put(`/filters/${t}`,e,!0,r)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.delete(`/filters/${t}`,!0,e)}))}};const L=new e(r);var x=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,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return L.put(`/appendListings/${t}`,e,!0,r)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/appendListings/${t}`,!0,e)}))}};const P=new e(r);var F,k,E=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return P.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return P.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return P.post("/forms",t,!0,e)}))}updateForm(e,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,r=null){return P.put(`/forms/${t}`,e,!0,r)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return P.delete(`/forms/${t}`,!0,e)}))}};exports.EventType=void 0,(F=exports.EventType||(exports.EventType={}))[F.Virtual=0]="Virtual",F[F.InPerson=1]="InPerson",F[F.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(k=exports.CallToActionType||(exports.CallToActionType={}))[k.Button=0]="Button",k[k.Link=1]="Link",k[k.Download=2]="Download",k[k.HireControlRegistration=3]="HireControlRegistration";const R={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},U={getAll:s.getEvents,get:s.getEvent,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},W={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},S=d,b=m,M={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},I={get:p.getMapConfig,update:p.updateMapConfig,create:p.createMapConfig},j={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},D={upload:A.uploadMedia,get:A.listMedia,delete:A.deleteMedia},O={getList:T.getFilters,get:T.getFilter,update:T.updateFilter,create:T.createFilter,delete:T.deleteFilter},B={get:x.getAppendListings,getAppendListing:x.getAppendListing,create:x.createAppendListing,update:x.updateAppendListing,delete:x.deleteAppendListing},H={get:_.getAllPermissions},J=E,N={auth:R,events:U,roles:W,users:S,account:M,mapConfig:I,permissions:H,clientAuthConfig:j,filters:O,listings:b,media:D,appendListings:B,forms:J};exports.account=M,exports.appendListings=B,exports.auth=R,exports.clientAuthConfig=j,exports.default=N,exports.events=U,exports.filters=O,exports.forms=J,exports.listings=b,exports.mapConfig=I,exports.media=D,exports.permissions=H,exports.roles=W,exports.users=S;
2
2
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import Event, { EventDates, EventDateType, EventInstance, EventType, CallToActio
11
11
  import { Listing } from "./types/listing";
12
12
  import Filters from "./types/filters/filters";
13
13
  import AppendListing from "./types/appendListing";
14
+ import Form from "./types/form";
14
15
  export declare const auth: {
15
16
  login: (clientLogInRequest: import("./types/clientLoginRequest").default) => Promise<any>;
16
17
  nextLogin: (credentials: import("./types/credentials").default) => Promise<any>;
@@ -81,7 +82,14 @@ export declare const appendListings: {
81
82
  export declare const permissions: {
82
83
  get: (authToken?: string | null) => Promise<string[]>;
83
84
  };
84
- export type { Register, User, Company, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing };
85
+ export declare const forms: {
86
+ getForms(authToken?: string | null): Promise<Form[]>;
87
+ getForm(id: string, authToken?: string | null): Promise<Form>;
88
+ createForm(form: Form, authToken?: string | null): Promise<Form>;
89
+ updateForm(id: string, form: Form, authToken?: string | null): Promise<void>;
90
+ deleteForm(id: string, authToken?: string | null): Promise<void>;
91
+ };
92
+ export type { Register, User, Company, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing, Form };
85
93
  export { EventType, CallToActionType };
86
94
  declare const hcApi: {
87
95
  auth: {
@@ -154,5 +162,12 @@ declare const hcApi: {
154
162
  update: (id: string, appendListingDto: AppendListing, authToken?: string | null) => Promise<void>;
155
163
  delete: (id: string, authToken?: string | null) => Promise<void>;
156
164
  };
165
+ forms: {
166
+ getForms(authToken?: string | null): Promise<Form[]>;
167
+ getForm(id: string, authToken?: string | null): Promise<Form>;
168
+ createForm(form: Form, authToken?: string | null): Promise<Form>;
169
+ updateForm(id: string, form: Form, authToken?: string | null): Promise<void>;
170
+ deleteForm(id: string, authToken?: string | null): Promise<void>;
171
+ };
157
172
  };
158
173
  export default hcApi;
@@ -1,7 +1,9 @@
1
1
  import FiltersDto from "./filters/filters";
2
+ import Form from "./form";
2
3
  type Event = {
3
4
  id?: string;
4
5
  title?: string;
6
+ slug?: string;
5
7
  subtitle?: string;
6
8
  description?: string;
7
9
  shortDescription?: string;
@@ -31,6 +33,11 @@ type Event = {
31
33
  companyId?: string;
32
34
  filters?: FiltersDto;
33
35
  filtersId?: string;
36
+ includeOnEventLeads?: boolean;
37
+ leadsFormId?: string;
38
+ leadsForm?: Form;
39
+ registrationFormId?: string;
40
+ registrationForm?: Form;
34
41
  };
35
42
  export type EventDates = {
36
43
  type: EventDateType;
@@ -58,6 +65,7 @@ export type CallToAction = {
58
65
  export declare enum CallToActionType {
59
66
  Button = 0,
60
67
  Link = 1,
61
- Download = 2
68
+ Download = 2,
69
+ HireControlRegistration = 3
62
70
  }
63
71
  export default Event;
@@ -0,0 +1,19 @@
1
+ interface Form {
2
+ id: string;
3
+ legacyFormId?: number;
4
+ companyId: number;
5
+ name?: string;
6
+ createdBy: {
7
+ userId: string;
8
+ firstName: string;
9
+ lastName: string;
10
+ dateTime: string;
11
+ };
12
+ lastUpdatedBy: {
13
+ userId: string;
14
+ firstName: string;
15
+ lastName: string;
16
+ dateTime: string;
17
+ };
18
+ }
19
+ export default Form;
package/index.ts CHANGED
@@ -13,6 +13,7 @@ import listingscontroller from "./controllers/listingsController";
13
13
  import mediaController from "./controllers/mediaController";
14
14
  import filtersController from "./controllers/filtersController";
15
15
  import appendListingsController from "./controllers/appendListingsController";
16
+ import formsController from "./controllers/formsController";
16
17
 
17
18
  import Register from "./types/register";
18
19
  import User from "./types/user";
@@ -25,6 +26,7 @@ import Event, { EventDates, EventDateType, EventInstance, EventType, CallToActio
25
26
  import { Listing } from "./types/listing";
26
27
  import Filters from "./types/filters/filters";
27
28
  import AppendListing from "./types/appendListing";
29
+ import Form from "./types/form";
28
30
 
29
31
  export const auth = {
30
32
  login: authController.login,
@@ -105,6 +107,8 @@ export const permissions = {
105
107
  get: permissionsController.getAllPermissions,
106
108
  };
107
109
 
110
+ export const forms = formsController;
111
+
108
112
  //types
109
113
  export type {
110
114
  Register,
@@ -120,7 +124,8 @@ export type {
120
124
  EventInstance,
121
125
  MediaType,
122
126
  Filters,
123
- AppendListing
127
+ AppendListing,
128
+ Form
124
129
  };
125
130
 
126
131
  export { EventType, CallToActionType };
@@ -138,6 +143,7 @@ const hcApi = {
138
143
  listings,
139
144
  media,
140
145
  appendListings,
146
+ forms
141
147
  };
142
148
 
143
149
  export default hcApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcagency/hire-control-sdk",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
package/types/event.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import FiltersDto from "./filters/filters";
2
+ import Form from "./form";
2
3
 
3
4
  type Event = {
4
5
  id?: string;
5
6
  title?: string;
7
+ slug?: string;
6
8
  subtitle?: string;
7
9
  description?: string;
8
10
  shortDescription?: string;
@@ -32,6 +34,11 @@ type Event = {
32
34
  companyId?: string;
33
35
  filters?: FiltersDto;
34
36
  filtersId?: string;
37
+ includeOnEventLeads?: boolean;
38
+ leadsFormId?: string;
39
+ leadsForm?: Form;
40
+ registrationFormId?: string;
41
+ registrationForm?: Form;
35
42
  };
36
43
 
37
44
  export type EventDates = {
@@ -62,11 +69,11 @@ export type CallToAction = {
62
69
  url?: string;
63
70
  };
64
71
 
65
-
66
72
  export enum CallToActionType {
67
73
  Button = 0,
68
74
  Link = 1,
69
75
  Download = 2,
76
+ HireControlRegistration = 3,
70
77
  }
71
78
 
72
79
 
package/types/form.ts ADDED
@@ -0,0 +1,20 @@
1
+ interface Form {
2
+ id: string;
3
+ legacyFormId?: number;
4
+ companyId: number;
5
+ name?: string;
6
+ createdBy: {
7
+ userId: string;
8
+ firstName: string;
9
+ lastName: string;
10
+ dateTime: string;
11
+ };
12
+ lastUpdatedBy: {
13
+ userId: string;
14
+ firstName: string;
15
+ lastName: string;
16
+ dateTime: string;
17
+ };
18
+ }
19
+
20
+ export default Form;