@abcagency/hire-control-sdk 1.0.43 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/companiesController.ts +82 -0
- package/dist/controllers/companiesController.d.ts +40 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/types/changeCompanyRequest.d.ts +1 -1
- package/dist/types/company.d.ts +15 -1
- package/index.ts +13 -2
- package/package.json +1 -1
- package/types/changeCompanyRequest.ts +2 -2
- package/types/company.ts +16 -1
- /package/dist/types/{AppendListing.d.ts → appendListing.d.ts} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import FetchHandler from "../handlers/fetchHandler";
|
|
2
|
+
import Company from "../types/company";
|
|
3
|
+
import { API_URL } from "../constants/config";
|
|
4
|
+
|
|
5
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
6
|
+
|
|
7
|
+
class CompaniesController {
|
|
8
|
+
/**
|
|
9
|
+
* Get all companies.
|
|
10
|
+
* @param {string | null} authToken - Optional auth token.
|
|
11
|
+
* @returns {Promise<Company[]>} - A list of companies.
|
|
12
|
+
*/
|
|
13
|
+
async getCompanies(authToken: string | null = null): Promise<Company[]> {
|
|
14
|
+
return fetchHandler.get<Company[]>("/companies", true, authToken);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get a specific company by ID.
|
|
19
|
+
* @param {string} id - The company ID.
|
|
20
|
+
* @param {string | null} authToken - Optional auth token.
|
|
21
|
+
* @returns {Promise<Company>} - The company data.
|
|
22
|
+
*/
|
|
23
|
+
async getCompany(
|
|
24
|
+
id: string,
|
|
25
|
+
authToken: string | null = null
|
|
26
|
+
): Promise<Company> {
|
|
27
|
+
return fetchHandler.get<Company>(`/companies/${id}`, true, authToken);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Create a new company.
|
|
32
|
+
* @param {Company} company - The company data to create.
|
|
33
|
+
* @param {string | null} authToken - Optional auth token.
|
|
34
|
+
* @returns {Promise<Company>} - The newly created company data.
|
|
35
|
+
*/
|
|
36
|
+
async createCompany(
|
|
37
|
+
company: Company,
|
|
38
|
+
authToken: string | null = null
|
|
39
|
+
): Promise<Company> {
|
|
40
|
+
return fetchHandler.post<Company, Company>(
|
|
41
|
+
"/companies",
|
|
42
|
+
company,
|
|
43
|
+
true,
|
|
44
|
+
authToken
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Update an existing company.
|
|
50
|
+
* @param {string} id - The company ID to update.
|
|
51
|
+
* @param {Company} company - The updated company data.
|
|
52
|
+
* @param {string | null} authToken - Optional auth token.
|
|
53
|
+
* @returns {Promise<void>} - No return value.
|
|
54
|
+
*/
|
|
55
|
+
async updateCompany(
|
|
56
|
+
id: string,
|
|
57
|
+
company: Company,
|
|
58
|
+
authToken: string | null = null
|
|
59
|
+
): Promise<void> {
|
|
60
|
+
return fetchHandler.put<Company, void>(
|
|
61
|
+
`/companies/${id}`,
|
|
62
|
+
company,
|
|
63
|
+
true,
|
|
64
|
+
authToken
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Delete an existing company.
|
|
70
|
+
* @param {string} id - The company ID to delete.
|
|
71
|
+
* @param {string | null} authToken - Optional auth token.
|
|
72
|
+
* @returns {Promise<void>} - No return value.
|
|
73
|
+
*/
|
|
74
|
+
async deleteCompany(
|
|
75
|
+
id: string,
|
|
76
|
+
authToken: string | null = null
|
|
77
|
+
): Promise<void> {
|
|
78
|
+
return fetchHandler.delete(`/companies/${id}`, true, authToken);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default new CompaniesController();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Company from "../types/company";
|
|
2
|
+
declare class CompaniesController {
|
|
3
|
+
/**
|
|
4
|
+
* Get all companies.
|
|
5
|
+
* @param {string | null} authToken - Optional auth token.
|
|
6
|
+
* @returns {Promise<Company[]>} - A list of companies.
|
|
7
|
+
*/
|
|
8
|
+
getCompanies(authToken?: string | null): Promise<Company[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Get a specific company by ID.
|
|
11
|
+
* @param {string} id - The company ID.
|
|
12
|
+
* @param {string | null} authToken - Optional auth token.
|
|
13
|
+
* @returns {Promise<Company>} - The company data.
|
|
14
|
+
*/
|
|
15
|
+
getCompany(id: string, authToken?: string | null): Promise<Company>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new company.
|
|
18
|
+
* @param {Company} company - The company data to create.
|
|
19
|
+
* @param {string | null} authToken - Optional auth token.
|
|
20
|
+
* @returns {Promise<Company>} - The newly created company data.
|
|
21
|
+
*/
|
|
22
|
+
createCompany(company: Company, authToken?: string | null): Promise<Company>;
|
|
23
|
+
/**
|
|
24
|
+
* Update an existing company.
|
|
25
|
+
* @param {string} id - The company ID to update.
|
|
26
|
+
* @param {Company} company - The updated company data.
|
|
27
|
+
* @param {string | null} authToken - Optional auth token.
|
|
28
|
+
* @returns {Promise<void>} - No return value.
|
|
29
|
+
*/
|
|
30
|
+
updateCompany(id: string, company: Company, authToken?: string | null): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Delete an existing company.
|
|
33
|
+
* @param {string} id - The company ID to delete.
|
|
34
|
+
* @param {string | null} authToken - Optional auth token.
|
|
35
|
+
* @returns {Promise<void>} - No return value.
|
|
36
|
+
*/
|
|
37
|
+
deleteCompany(id: string, authToken?: string | null): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
declare const _default: CompaniesController;
|
|
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=i,s={method:"POST",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o=i,s={method:"PUT",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File?e.append(n||"file",t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t.toString()):Array.isArray(t)?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):"object"==typeof t&&null!==t&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}.${r}`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r?(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}),n.credentials="omit"):n.credentials="include";let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const n="https://api.myhirecontrol.com",r=new e(n);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield r.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield r.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(n);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/details/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return o.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(n);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return a.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(n);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield l.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var g=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield p.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const m=new e(n);var y=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield m.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield m.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const C=new e(n);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload-profile-image",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({folderKey:t});return C.get(`/media/list?${n.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({key:t});return C.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const S=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return S.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return S.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.delete(`/filters/${t}`,!0,e)}))}};const b=new e(n);var T=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return b.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return b.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.delete(`/appendListings/${t}`,!0,e)}))}};const L=new e(n);var x=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return L.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return L.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms/jsonSchema",t,!0,e)}))}};const F=new e(n);var P,R,k,E=new class{submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.post("/formsubmission",t,!0,e)}))}getFormSubmissions(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString()),F.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString());const u=yield F.getFile(`/formsubmission/export-csv?${a.toString()}`,!0,s),l=window.URL.createObjectURL(u),d=document.createElement("a");d.href=l,d.download="form_submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(l),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return F.get("/formsubmission/types",!0,t)}))}};exports.EventType=void 0,(P=exports.EventType||(exports.EventType={}))[P.Virtual=0]="Virtual",P[P.InPerson=1]="InPerson",P[P.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(R=exports.CallToActionType||(exports.CallToActionType={}))[R.Button=0]="Button",R[R.Link=1]="Link",R[R.Download=2]="Download",R[R.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(k=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[k.Submitted=1]="Submitted",k[k.Hold=2]="Hold",k[k.Rejected=3]="Rejected",k[k.Sent=4]="Sent";const U={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},I={getAll:s.getEvents,get:s.getEvent,getBySlug:s.getEventBySlug,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},j={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},O=d,W=y,M={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},B={get:g.getMapConfig,update:g.updateMapConfig,create:g.createMapConfig},D={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},z={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},H={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},N={get:T.getAppendListings,getAppendListing:T.getAppendListing,create:T.createAppendListing,update:T.updateAppendListing,delete:T.deleteAppendListing},q={get:_.getAllPermissions},G=x,J=E,V={auth:U,events:I,roles:j,users:O,account:M,mapConfig:B,permissions:q,clientAuthConfig:D,filters:H,listings:W,media:z,appendListings:N,forms:G};exports.account=M,exports.appendListings=N,exports.auth=U,exports.clientAuthConfig=D,exports.default=V,exports.events=I,exports.filters=H,exports.formSubmissions=J,exports.forms=G,exports.listings=W,exports.mapConfig=B,exports.media=z,exports.permissions=q,exports.roles=j,exports.users=O;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o=i,s={method:"POST",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o=i,s={method:"PUT",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File?e.append(n||"file",t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t.toString()):Array.isArray(t)?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):"object"==typeof t&&null!==t&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}.${r}`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r?(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}),n.credentials="omit"):n.credentials="include";let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const n="https://api.myhirecontrol.com",r=new e(n);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield r.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield r.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(n);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/details/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return o.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(n);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return a.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(n);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield l.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var g=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield p.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const m=new e(n);var y=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield m.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield m.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const C=new e(n);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload-profile-image",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({folderKey:t});return C.get(`/media/list?${n.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({key:t});return C.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const S=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return S.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return S.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.delete(`/filters/${t}`,!0,e)}))}};const b=new e(n);var T=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return b.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return b.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.delete(`/appendListings/${t}`,!0,e)}))}};const x=new e(n);var L=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return x.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return x.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return x.post("/forms/jsonSchema",t,!0,e)}))}};const F=new e(n);var P=new class{submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.post("/formsubmission",t,!0,e)}))}getFormSubmissions(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString()),F.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString());const u=yield F.getFile(`/formsubmission/export-csv?${a.toString()}`,!0,s),l=window.URL.createObjectURL(u),d=document.createElement("a");d.href=l,d.download="form_submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(l),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return F.get("/formsubmission/types",!0,t)}))}};const R=new e(n);var k,E,U,I=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return R.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.delete(`/companies/${t}`,!0,e)}))}};exports.EventType=void 0,(k=exports.EventType||(exports.EventType={}))[k.Virtual=0]="Virtual",k[k.InPerson=1]="InPerson",k[k.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(E=exports.CallToActionType||(exports.CallToActionType={}))[E.Button=0]="Button",E[E.Link=1]="Link",E[E.Download=2]="Download",E[E.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(U=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[U.Submitted=1]="Submitted",U[U.Hold=2]="Hold",U[U.Rejected=3]="Rejected",U[U.Sent=4]="Sent";const j={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},O={getAll:s.getEvents,get:s.getEvent,getBySlug:s.getEventBySlug,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},W={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},M=d,B=y,D={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},z={get:g.getMapConfig,update:g.updateMapConfig,create:g.createMapConfig},H={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},N={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},q={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},G={get:T.getAppendListings,getAppendListing:T.getAppendListing,create:T.createAppendListing,update:T.updateAppendListing,delete:T.deleteAppendListing},J={get:_.getAllPermissions},V={getAll:I.getCompanies,getById:I.getCompany,create:I.createCompany,update:I.updateCompany,delete:I.deleteCompany},K=L,Q=P,X={auth:j,events:O,roles:W,users:M,account:D,mapConfig:z,permissions:J,clientAuthConfig:H,filters:q,listings:B,media:N,appendListings:G,forms:K,formSubmissions:Q,companies:V};exports.account=D,exports.appendListings=G,exports.auth=j,exports.clientAuthConfig=H,exports.companies=V,exports.default=X,exports.events=O,exports.filters=q,exports.formSubmissions=Q,exports.forms=K,exports.listings=B,exports.mapConfig=z,exports.media=N,exports.permissions=J,exports.roles=W,exports.users=M;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import UsersControllerType from "./types/controllers/usersControllerType";
|
|
2
2
|
import ListingsControllerType from "./types/controllers/listingsControllerType";
|
|
3
|
+
import Company from "./types/company";
|
|
3
4
|
import Register from "./types/register";
|
|
4
5
|
import User from "./types/user";
|
|
5
6
|
import Role from "./types/role";
|
|
6
|
-
import Company from "./types/company";
|
|
7
7
|
import HireControlConfig from "./types/hireControlConfig";
|
|
8
8
|
import ClientAuthConfig from "./types/clientAuthConfig";
|
|
9
9
|
import MediaType from "./types/media/media";
|
|
@@ -88,6 +88,13 @@ export declare const appendListings: {
|
|
|
88
88
|
export declare const permissions: {
|
|
89
89
|
get: (authToken?: string | null) => Promise<string[]>;
|
|
90
90
|
};
|
|
91
|
+
export declare const companies: {
|
|
92
|
+
getAll: (authToken?: string | null) => Promise<Company[]>;
|
|
93
|
+
getById: (id: string, authToken?: string | null) => Promise<Company>;
|
|
94
|
+
create: (company: Company, authToken?: string | null) => Promise<Company>;
|
|
95
|
+
update: (id: string, company: Company, authToken?: string | null) => Promise<void>;
|
|
96
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
97
|
+
};
|
|
91
98
|
export declare const forms: {
|
|
92
99
|
getForms(authToken?: string | null): Promise<Form[]>;
|
|
93
100
|
getForm(id: string, authToken?: string | null): Promise<Form>;
|
|
@@ -102,7 +109,7 @@ export declare const formSubmissions: {
|
|
|
102
109
|
exportFormSubmissionsCsv(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<void>;
|
|
103
110
|
getFormSubmissionTypes(authToken?: string | null): Promise<string[]>;
|
|
104
111
|
};
|
|
105
|
-
export type { Register, User,
|
|
112
|
+
export type { Register, User, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing, Form, FormSubmission, ResultsWrapper, Company, };
|
|
106
113
|
export { EventType, CallToActionType, FormSubmissionStatus };
|
|
107
114
|
declare const hcApi: {
|
|
108
115
|
auth: {
|
|
@@ -187,5 +194,18 @@ declare const hcApi: {
|
|
|
187
194
|
deleteForm(id: string, authToken?: string | null): Promise<void>;
|
|
188
195
|
processFormRequest(formRequest: string, authToken?: string | null): Promise<string>;
|
|
189
196
|
};
|
|
197
|
+
formSubmissions: {
|
|
198
|
+
submitFormSubmission(formSubmission: FormSubmission, authToken?: string | null): Promise<string>;
|
|
199
|
+
getFormSubmissions(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<ResultsWrapper<FormSubmission>>;
|
|
200
|
+
exportFormSubmissionsCsv(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<void>;
|
|
201
|
+
getFormSubmissionTypes(authToken?: string | null): Promise<string[]>;
|
|
202
|
+
};
|
|
203
|
+
companies: {
|
|
204
|
+
getAll: (authToken?: string | null) => Promise<Company[]>;
|
|
205
|
+
getById: (id: string, authToken?: string | null) => Promise<Company>;
|
|
206
|
+
create: (company: Company, authToken?: string | null) => Promise<Company>;
|
|
207
|
+
update: (id: string, company: Company, authToken?: string | null) => Promise<void>;
|
|
208
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
209
|
+
};
|
|
190
210
|
};
|
|
191
211
|
export default hcApi;
|
package/dist/types/company.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
export type Address = {
|
|
2
|
+
street: string;
|
|
3
|
+
city: string;
|
|
4
|
+
state: string;
|
|
5
|
+
zip: string;
|
|
6
|
+
};
|
|
1
7
|
type Company = {
|
|
2
|
-
|
|
8
|
+
id: string;
|
|
9
|
+
sqlId?: number;
|
|
10
|
+
address: Address;
|
|
11
|
+
billingAddress: Address;
|
|
12
|
+
billingContact: string;
|
|
3
13
|
name: string;
|
|
14
|
+
nameShort: string;
|
|
15
|
+
eoeStatement: string;
|
|
16
|
+
url: string;
|
|
17
|
+
socialMediaLinks: string[];
|
|
4
18
|
};
|
|
5
19
|
export default Company;
|
package/index.ts
CHANGED
|
@@ -15,11 +15,12 @@ import filtersController from "./controllers/filtersController";
|
|
|
15
15
|
import appendListingsController from "./controllers/appendListingsController";
|
|
16
16
|
import formsController from "./controllers/formsController";
|
|
17
17
|
import formSubmissionController from "./controllers/formSubmissionsController";
|
|
18
|
+
import CompaniesController from "./controllers/companiesController";
|
|
18
19
|
|
|
20
|
+
import Company from "./types/company";
|
|
19
21
|
import Register from "./types/register";
|
|
20
22
|
import User from "./types/user";
|
|
21
23
|
import Role from "./types/role";
|
|
22
|
-
import Company from "./types/company";
|
|
23
24
|
import HireControlConfig from "./types/hireControlConfig";
|
|
24
25
|
import ClientAuthConfig from "./types/clientAuthConfig";
|
|
25
26
|
import MediaType from "./types/media/media";
|
|
@@ -118,13 +119,20 @@ export const permissions = {
|
|
|
118
119
|
get: permissionsController.getAllPermissions,
|
|
119
120
|
};
|
|
120
121
|
|
|
122
|
+
export const companies = {
|
|
123
|
+
getAll: CompaniesController.getCompanies,
|
|
124
|
+
getById: CompaniesController.getCompany,
|
|
125
|
+
create: CompaniesController.createCompany,
|
|
126
|
+
update: CompaniesController.updateCompany,
|
|
127
|
+
delete: CompaniesController.deleteCompany,
|
|
128
|
+
};
|
|
129
|
+
|
|
121
130
|
export const forms = formsController;
|
|
122
131
|
export const formSubmissions = formSubmissionController;
|
|
123
132
|
//types
|
|
124
133
|
export type {
|
|
125
134
|
Register,
|
|
126
135
|
User,
|
|
127
|
-
Company,
|
|
128
136
|
Role,
|
|
129
137
|
HireControlConfig,
|
|
130
138
|
ClientAuthConfig,
|
|
@@ -139,6 +147,7 @@ export type {
|
|
|
139
147
|
Form,
|
|
140
148
|
FormSubmission,
|
|
141
149
|
ResultsWrapper,
|
|
150
|
+
Company,
|
|
142
151
|
};
|
|
143
152
|
|
|
144
153
|
export { EventType, CallToActionType, FormSubmissionStatus };
|
|
@@ -157,6 +166,8 @@ const hcApi = {
|
|
|
157
166
|
media,
|
|
158
167
|
appendListings,
|
|
159
168
|
forms,
|
|
169
|
+
formSubmissions,
|
|
170
|
+
companies,
|
|
160
171
|
};
|
|
161
172
|
|
|
162
173
|
export default hcApi;
|
package/package.json
CHANGED
package/types/company.ts
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
export type Address = {
|
|
2
|
+
street: string;
|
|
3
|
+
city: string;
|
|
4
|
+
state: string;
|
|
5
|
+
zip: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
type Company = {
|
|
2
|
-
|
|
9
|
+
id: string;
|
|
10
|
+
sqlId?: number;
|
|
11
|
+
address: Address;
|
|
12
|
+
billingAddress: Address;
|
|
13
|
+
billingContact: string;
|
|
3
14
|
name: string;
|
|
15
|
+
nameShort: string;
|
|
16
|
+
eoeStatement: string;
|
|
17
|
+
url: string;
|
|
18
|
+
socialMediaLinks: string[];
|
|
4
19
|
};
|
|
5
20
|
|
|
6
21
|
export default Company;
|
|
File without changes
|