@abcagency/hire-control-sdk 1.0.55 → 1.0.56
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/blogController.ts +29 -0
- package/controllers/categoriesController.ts +22 -0
- package/controllers/eventsController.ts +7 -0
- package/controllers/formSubmissionsController.ts +12 -0
- package/controllers/jobFeedFieldMappingsController.ts +47 -0
- package/controllers/jobFeedsController.ts +68 -0
- package/controllers/jobListingSettingsController.ts +21 -0
- package/controllers/listingEntitiesController.ts +15 -0
- package/controllers/recruitersController.ts +39 -0
- package/dist/controllers/blogController.d.ts +10 -0
- package/dist/controllers/categoriesController.d.ts +6 -0
- package/dist/controllers/eventsController.d.ts +4 -0
- package/dist/controllers/formSubmissionsController.d.ts +4 -0
- package/dist/controllers/jobFeedFieldMappingsController.d.ts +14 -0
- package/dist/controllers/jobFeedsController.d.ts +12 -0
- package/dist/controllers/jobListingSettingsController.d.ts +8 -0
- package/dist/controllers/listingEntitiesController.d.ts +6 -0
- package/dist/controllers/recruitersController.d.ts +8 -0
- package/dist/handlers/fetchHandler.d.ts +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +97 -2
- package/dist/types/blog.d.ts +7 -0
- package/dist/types/focalPoint.d.ts +5 -0
- package/dist/types/jobFeed.d.ts +23 -0
- package/dist/types/jobFeedFieldMapping.d.ts +15 -0
- package/dist/types/jobFeedFieldMappingToggle.d.ts +5 -0
- package/dist/types/jobListingSettings.d.ts +17 -0
- package/dist/types/listingEntity.d.ts +12 -0
- package/dist/types/recruiter.d.ts +16 -0
- package/handlers/fetchHandler.ts +32 -4
- package/index.ts +79 -1
- package/package.json +1 -1
- package/types/blog.ts +8 -0
- package/types/focalPoint.ts +6 -0
- package/types/jobFeed.ts +25 -0
- package/types/jobFeedFieldMapping.ts +17 -0
- package/types/jobFeedFieldMappingToggle.ts +6 -0
- package/types/jobListingSettings.ts +20 -0
- package/types/listingEntity.ts +14 -0
- package/types/recruiter.ts +18 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import FetchHandler from '../handlers/fetchHandler';
|
|
2
|
+
import { API_URL } from '../constants/config';
|
|
3
|
+
import Blog from '../types/blog';
|
|
4
|
+
|
|
5
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
6
|
+
|
|
7
|
+
class BlogController {
|
|
8
|
+
async getBlogs(authToken: string | null = null): Promise<Blog[]> {
|
|
9
|
+
return fetchHandler.get<Blog[]>('/blog', true, authToken);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getBlog(blogId: string, authToken: string | null = null): Promise<Blog> {
|
|
13
|
+
return fetchHandler.get<Blog>(`/blog/${blogId}`, true, authToken);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async createBlog(blog: Blog, authToken: string | null = null): Promise<Blog> {
|
|
17
|
+
return fetchHandler.post<Blog, Blog>('/blog', blog, true, authToken);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async updateBlog(blogId: string, blog: Blog, authToken: string | null = null): Promise<void> {
|
|
21
|
+
return fetchHandler.put<Blog, void>(`/blog/${blogId}`, blog, true, authToken);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async deleteBlog(blogId: string, authToken: string | null = null): Promise<void> {
|
|
25
|
+
return fetchHandler.delete(`/blog/${blogId}`, true, authToken);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default new BlogController();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import FetchHandler from '../handlers/fetchHandler';
|
|
2
|
+
import { API_URL } from '../constants/config';
|
|
3
|
+
|
|
4
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
5
|
+
|
|
6
|
+
class CategoriesController {
|
|
7
|
+
async getCategories(type: number | null = null, authToken: string | null = null): Promise<string[]> {
|
|
8
|
+
const params = new URLSearchParams();
|
|
9
|
+
if (type !== null && type !== undefined) params.append('type', String(type));
|
|
10
|
+
const query = params.toString() ? `?${params.toString()}` : '';
|
|
11
|
+
return fetchHandler.get<string[]>(`/categories${query}`, true, authToken);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async getCategoriesByCompany(companyId: number, type: number | null = null, authToken: string | null = null): Promise<any[]> {
|
|
15
|
+
const params = new URLSearchParams();
|
|
16
|
+
if (type !== null && type !== undefined) params.append('type', String(type));
|
|
17
|
+
const query = params.toString() ? `?${params.toString()}` : '';
|
|
18
|
+
return fetchHandler.get<any[]>(`/categories/${companyId}${query}`, true, authToken);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default new CategoriesController();
|
|
@@ -33,6 +33,13 @@ class EventsController {
|
|
|
33
33
|
return fetchHandler.get<Event>(`/events/details/${slug}`, true, authToken);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Get events for a specific listing ID.
|
|
38
|
+
*/
|
|
39
|
+
async getListingEvents(id: number, authToken: string | null = null): Promise<Event[]> {
|
|
40
|
+
return fetchHandler.get<Event[]>(`/listingEvents/${id}`, true, authToken);
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
/**
|
|
37
44
|
* Create a new event (only for SuperAdmin/Admin roles).
|
|
38
45
|
* @param {Event} Event - The event data to create.
|
|
@@ -6,6 +6,18 @@ import ResultsWrapper from "../types/resultsWrapper";
|
|
|
6
6
|
const fetchHandler = new FetchHandler(API_URL);
|
|
7
7
|
|
|
8
8
|
class FormSubmissionsController {
|
|
9
|
+
/**
|
|
10
|
+
* Submit a contact form with multipart data.
|
|
11
|
+
*/
|
|
12
|
+
async submitContactForm(form: any, authToken: string | null = null): Promise<string> {
|
|
13
|
+
return fetchHandler.post<any, string>(
|
|
14
|
+
'/contactForm',
|
|
15
|
+
form,
|
|
16
|
+
true,
|
|
17
|
+
authToken,
|
|
18
|
+
true
|
|
19
|
+
);
|
|
20
|
+
}
|
|
9
21
|
/**
|
|
10
22
|
* Submit a new form via a POST request.
|
|
11
23
|
* @param {FormSubmission} formSubmission - The form submission data.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import FetchHandler from '../handlers/fetchHandler';
|
|
2
|
+
import { API_URL } from '../constants/config';
|
|
3
|
+
import JobFeedFieldMapping from '../types/jobFeedFieldMapping';
|
|
4
|
+
import ToggleMappingsActiveRequest from '../types/jobFeedFieldMappingToggle';
|
|
5
|
+
|
|
6
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
7
|
+
|
|
8
|
+
class JobFeedFieldMappingsController {
|
|
9
|
+
async getByFeed(feedId: string, authToken: string | null = null): Promise<JobFeedFieldMapping[]> {
|
|
10
|
+
return fetchHandler.get<JobFeedFieldMapping[]>(`/jobFeedFieldMappings/feed/${feedId}`, true, authToken);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async get(id: string, authToken: string | null = null): Promise<JobFeedFieldMapping> {
|
|
14
|
+
return fetchHandler.get<JobFeedFieldMapping>(`/jobFeedFieldMappings/${id}`, true, authToken);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async create(mapping: JobFeedFieldMapping, authToken: string | null = null): Promise<JobFeedFieldMapping> {
|
|
18
|
+
return fetchHandler.post<JobFeedFieldMapping, JobFeedFieldMapping>('/jobFeedFieldMappings', mapping, true, authToken);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async update(id: string, mapping: JobFeedFieldMapping, authToken: string | null = null): Promise<JobFeedFieldMapping> {
|
|
22
|
+
return fetchHandler.put<JobFeedFieldMapping, JobFeedFieldMapping>(`/jobFeedFieldMappings/${id}`, mapping, true, authToken);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async delete(id: string, authToken: string | null = null): Promise<void> {
|
|
26
|
+
return fetchHandler.delete(`/jobFeedFieldMappings/${id}`, true, authToken);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async toggleActive(request: ToggleMappingsActiveRequest, authToken: string | null = null): Promise<JobFeedFieldMapping[]> {
|
|
30
|
+
return fetchHandler.post<ToggleMappingsActiveRequest, JobFeedFieldMapping[]>(
|
|
31
|
+
'/jobFeedFieldMappings/toggle-active',
|
|
32
|
+
request,
|
|
33
|
+
true,
|
|
34
|
+
authToken
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async discoverFields(feedId: string, authToken: string | null = null): Promise<string[]> {
|
|
39
|
+
return fetchHandler.get<string[]>(`/jobFeedFieldMappings/discover-fields/${feedId}`, true, authToken);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async validate(feedId: string, authToken: string | null = null): Promise<Record<string, string[]>> {
|
|
43
|
+
return fetchHandler.get<Record<string, string[]>>(`/jobFeedFieldMappings/validate/${feedId}`, true, authToken);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default new JobFeedFieldMappingsController();
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import FetchHandler from "../handlers/fetchHandler";
|
|
2
|
+
import { API_URL } from "../constants/config";
|
|
3
|
+
import JobFeed from "../types/jobFeed";
|
|
4
|
+
|
|
5
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
6
|
+
|
|
7
|
+
class JobFeedsController {
|
|
8
|
+
async getAll(authToken: string | null = null): Promise<JobFeed[]> {
|
|
9
|
+
return fetchHandler.get<JobFeed[]>("/jobfeeds", true, authToken);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async get(id: string, authToken: string | null = null): Promise<JobFeed> {
|
|
13
|
+
return fetchHandler.get<JobFeed>(`/jobfeeds/${id}`, true, authToken);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async create(
|
|
17
|
+
jobFeed: JobFeed,
|
|
18
|
+
authToken: string | null = null
|
|
19
|
+
): Promise<JobFeed> {
|
|
20
|
+
return fetchHandler.post<JobFeed, JobFeed>(
|
|
21
|
+
"/jobfeeds",
|
|
22
|
+
jobFeed,
|
|
23
|
+
true,
|
|
24
|
+
authToken
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async update(
|
|
29
|
+
id: string,
|
|
30
|
+
jobFeed: JobFeed,
|
|
31
|
+
authToken: string | null = null
|
|
32
|
+
): Promise<JobFeed> {
|
|
33
|
+
return fetchHandler.put<JobFeed, JobFeed>(
|
|
34
|
+
`/jobfeeds/${id}`,
|
|
35
|
+
jobFeed,
|
|
36
|
+
true,
|
|
37
|
+
authToken
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async delete(id: string, authToken: string | null = null): Promise<void> {
|
|
42
|
+
return fetchHandler.delete(`/jobfeeds/${id}`, true, authToken);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async sync(id: string, authToken: string | null = null): Promise<JobFeed> {
|
|
46
|
+
return fetchHandler.post<void, JobFeed>(
|
|
47
|
+
`/jobfeeds/${id}/sync`,
|
|
48
|
+
{} as any,
|
|
49
|
+
true,
|
|
50
|
+
authToken
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async toggleActive(
|
|
55
|
+
id: string,
|
|
56
|
+
active: boolean,
|
|
57
|
+
authToken: string | null = null
|
|
58
|
+
): Promise<JobFeed> {
|
|
59
|
+
return fetchHandler.patch<boolean, JobFeed>(
|
|
60
|
+
`/jobfeeds/${id}/toggle-active`,
|
|
61
|
+
active,
|
|
62
|
+
true,
|
|
63
|
+
authToken
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default new JobFeedsController();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import FetchHandler from '../handlers/fetchHandler';
|
|
2
|
+
import { API_URL } from '../constants/config';
|
|
3
|
+
import JobListingSettings from '../types/jobListingSettings';
|
|
4
|
+
|
|
5
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
6
|
+
|
|
7
|
+
class JobListingSettingsController {
|
|
8
|
+
async get(authToken: string | null = null): Promise<JobListingSettings> {
|
|
9
|
+
return fetchHandler.get<JobListingSettings>('/jobListingSettings', true, authToken);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async create(settings: JobListingSettings, authToken: string | null = null): Promise<JobListingSettings> {
|
|
13
|
+
return fetchHandler.post<JobListingSettings, JobListingSettings>('/jobListingSettings', settings, true, authToken);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async delete(authToken: string | null = null): Promise<void> {
|
|
17
|
+
return fetchHandler.delete('/jobListingSettings', true, authToken);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default new JobListingSettingsController();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import FetchHandler from '../handlers/fetchHandler';
|
|
2
|
+
import { API_URL } from '../constants/config';
|
|
3
|
+
import ListingEntityDto from '../types/listingEntity';
|
|
4
|
+
|
|
5
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
6
|
+
|
|
7
|
+
class ListingEntitiesController {
|
|
8
|
+
async create(ids: number[], origin: string | null = null, authToken: string | null = null): Promise<Record<string, ListingEntityDto>> {
|
|
9
|
+
const params = new URLSearchParams();
|
|
10
|
+
if (origin) params.append('origin', origin);
|
|
11
|
+
return fetchHandler.post<number[], Record<string, ListingEntityDto>>(`/listingEntities${params.toString() ? '?' + params.toString() : ''}`, ids, true, authToken);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default new ListingEntitiesController();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import FetchHandler from "../handlers/fetchHandler";
|
|
2
|
+
import { API_URL } from "../constants/config";
|
|
3
|
+
import RecruiterDto from "../types/recruiter";
|
|
4
|
+
|
|
5
|
+
const fetchHandler = new FetchHandler(API_URL);
|
|
6
|
+
|
|
7
|
+
class RecruitersController {
|
|
8
|
+
async get(
|
|
9
|
+
recruiterIds: number[] | null = null,
|
|
10
|
+
authToken: string | null = null
|
|
11
|
+
): Promise<Record<string, RecruiterDto>> {
|
|
12
|
+
const params = new URLSearchParams();
|
|
13
|
+
if (recruiterIds)
|
|
14
|
+
recruiterIds.forEach((id) =>
|
|
15
|
+
params.append("recruiterIds", id.toString())
|
|
16
|
+
);
|
|
17
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
18
|
+
return fetchHandler.get<Record<string, RecruiterDto>>(
|
|
19
|
+
`/recruiters${query}`,
|
|
20
|
+
true,
|
|
21
|
+
authToken
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async getAll(authToken: string | null = null): Promise<RecruiterDto> {
|
|
26
|
+
return fetchHandler.get<RecruiterDto>("/recruiters/all", true, authToken);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async sync(authToken: string | null = null): Promise<void> {
|
|
30
|
+
return fetchHandler.post<void, void>(
|
|
31
|
+
"/recruiters/sync",
|
|
32
|
+
{} as any,
|
|
33
|
+
true,
|
|
34
|
+
authToken
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default new RecruitersController();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Blog from '../types/blog';
|
|
2
|
+
declare class BlogController {
|
|
3
|
+
getBlogs(authToken?: string | null): Promise<Blog[]>;
|
|
4
|
+
getBlog(blogId: string, authToken?: string | null): Promise<Blog>;
|
|
5
|
+
createBlog(blog: Blog, authToken?: string | null): Promise<Blog>;
|
|
6
|
+
updateBlog(blogId: string, blog: Blog, authToken?: string | null): Promise<void>;
|
|
7
|
+
deleteBlog(blogId: string, authToken?: string | null): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: BlogController;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare class CategoriesController {
|
|
2
|
+
getCategories(type?: number | null, authToken?: string | null): Promise<string[]>;
|
|
3
|
+
getCategoriesByCompany(companyId: number, type?: number | null, authToken?: string | null): Promise<any[]>;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: CategoriesController;
|
|
6
|
+
export default _default;
|
|
@@ -19,6 +19,10 @@ declare class EventsController {
|
|
|
19
19
|
* @returns {Promise<Event>} - The event data.
|
|
20
20
|
*/
|
|
21
21
|
getEventBySlug(slug: string, authToken?: string | null): Promise<Event>;
|
|
22
|
+
/**
|
|
23
|
+
* Get events for a specific listing ID.
|
|
24
|
+
*/
|
|
25
|
+
getListingEvents(id: number, authToken?: string | null): Promise<Event[]>;
|
|
22
26
|
/**
|
|
23
27
|
* Create a new event (only for SuperAdmin/Admin roles).
|
|
24
28
|
* @param {Event} Event - The event data to create.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import FormSubmission, { FormSubmissionStatus } from "../types/formSubmission";
|
|
2
2
|
import ResultsWrapper from "../types/resultsWrapper";
|
|
3
3
|
declare class FormSubmissionsController {
|
|
4
|
+
/**
|
|
5
|
+
* Submit a contact form with multipart data.
|
|
6
|
+
*/
|
|
7
|
+
submitContactForm(form: any, authToken?: string | null): Promise<string>;
|
|
4
8
|
/**
|
|
5
9
|
* Submit a new form via a POST request.
|
|
6
10
|
* @param {FormSubmission} formSubmission - The form submission data.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import JobFeedFieldMapping from '../types/jobFeedFieldMapping';
|
|
2
|
+
import ToggleMappingsActiveRequest from '../types/jobFeedFieldMappingToggle';
|
|
3
|
+
declare class JobFeedFieldMappingsController {
|
|
4
|
+
getByFeed(feedId: string, authToken?: string | null): Promise<JobFeedFieldMapping[]>;
|
|
5
|
+
get(id: string, authToken?: string | null): Promise<JobFeedFieldMapping>;
|
|
6
|
+
create(mapping: JobFeedFieldMapping, authToken?: string | null): Promise<JobFeedFieldMapping>;
|
|
7
|
+
update(id: string, mapping: JobFeedFieldMapping, authToken?: string | null): Promise<JobFeedFieldMapping>;
|
|
8
|
+
delete(id: string, authToken?: string | null): Promise<void>;
|
|
9
|
+
toggleActive(request: ToggleMappingsActiveRequest, authToken?: string | null): Promise<JobFeedFieldMapping[]>;
|
|
10
|
+
discoverFields(feedId: string, authToken?: string | null): Promise<string[]>;
|
|
11
|
+
validate(feedId: string, authToken?: string | null): Promise<Record<string, string[]>>;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: JobFeedFieldMappingsController;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import JobFeed from "../types/jobFeed";
|
|
2
|
+
declare class JobFeedsController {
|
|
3
|
+
getAll(authToken?: string | null): Promise<JobFeed[]>;
|
|
4
|
+
get(id: string, authToken?: string | null): Promise<JobFeed>;
|
|
5
|
+
create(jobFeed: JobFeed, authToken?: string | null): Promise<JobFeed>;
|
|
6
|
+
update(id: string, jobFeed: JobFeed, authToken?: string | null): Promise<JobFeed>;
|
|
7
|
+
delete(id: string, authToken?: string | null): Promise<void>;
|
|
8
|
+
sync(id: string, authToken?: string | null): Promise<JobFeed>;
|
|
9
|
+
toggleActive(id: string, active: boolean, authToken?: string | null): Promise<JobFeed>;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: JobFeedsController;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import JobListingSettings from '../types/jobListingSettings';
|
|
2
|
+
declare class JobListingSettingsController {
|
|
3
|
+
get(authToken?: string | null): Promise<JobListingSettings>;
|
|
4
|
+
create(settings: JobListingSettings, authToken?: string | null): Promise<JobListingSettings>;
|
|
5
|
+
delete(authToken?: string | null): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: JobListingSettingsController;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import ListingEntityDto from '../types/listingEntity';
|
|
2
|
+
declare class ListingEntitiesController {
|
|
3
|
+
create(ids: number[], origin?: string | null, authToken?: string | null): Promise<Record<string, ListingEntityDto>>;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: ListingEntitiesController;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import RecruiterDto from "../types/recruiter";
|
|
2
|
+
declare class RecruitersController {
|
|
3
|
+
get(recruiterIds?: number[] | null, authToken?: string | null): Promise<Record<string, RecruiterDto>>;
|
|
4
|
+
getAll(authToken?: string | null): Promise<RecruiterDto>;
|
|
5
|
+
sync(authToken?: string | null): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: RecruitersController;
|
|
8
|
+
export default _default;
|
|
@@ -6,6 +6,7 @@ declare class FetchHandler {
|
|
|
6
6
|
get<T>(endpoint: string, auth?: boolean, authToken?: string | null): Promise<T>;
|
|
7
7
|
post<T, R>(endpoint: string, body: T, auth?: boolean, authToken?: string | null, formData?: boolean): Promise<R>;
|
|
8
8
|
put<T, R>(endpoint: string, body: T, auth?: boolean, authToken?: string | null, formData?: boolean): Promise<R>;
|
|
9
|
+
patch<T, R>(endpoint: string, body: T, auth?: boolean, authToken?: string | null, formData?: boolean): Promise<R>;
|
|
9
10
|
delete<T>(endpoint: string, auth?: boolean, authToken?: string | null): Promise<T>;
|
|
10
11
|
getFile(endpoint: string, auth?: boolean, authToken?: string | null): Promise<Blob>;
|
|
11
12
|
private convertToFormData;
|
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="undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)}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)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File?e.append(n||"file",t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t.toString()):Array.isArray(t)?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):"object"==typeof t&&null!==t&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}.${r}`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r?(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}),n.credentials="omit"):n.credentials="include";let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};this.isLocalhost&&(r=this.getAuthToken())&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`})),t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){if(!this.isLocalhost){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}{const t=sessionStorage.getItem("refreshToken");if(!t)return!1;const e=yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(!e.ok)return console.error("Failed to refresh token"),!1;try{const t=yield e.json();return t.token&&sessionStorage.setItem("token",t.token),t.refreshToken&&sessionStorage.setItem("refreshToken",t.refreshToken),!0}catch(t){return console.error("Failed to parse refresh token response:",t),!1}}}))}}const n=process.env.NEXT_PUBLIC_API_URL||process.env.VITE_API_URL||process.env.REACT_APP_API_URL||"https://api.myhirecontrol.com",r=new e(n),i="undefined"!=typeof window&&"localhost"===window.location.hostname;var o=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/nextLogin"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/refresh"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/changeCompany"+(i?"?localhost=true":"");var n=yield r.post(t,e,!0);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const s=new e(n);var a=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return s.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/details/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return s.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.delete(`/events/${t}`,!0,e)}))}};const u=new e(n);var l=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return u.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return u.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.delete(`/roles/${t}`,!0,e)}))}};const d=new e(n);var c=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield d.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield d.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const h=new e(n);var g=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield h.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield h.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield h.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var f=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 _=new e(n);var w=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return _.get("/permissions",!0,t)}))}};const v=new e(n);var m=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield v.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield v.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return v.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return v.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return v.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const y=new e(n);var C=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield y.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield y.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const A=new e(n);var k=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 S=new e(n);var b=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 $=new e(n);var T=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return $.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return $.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return $.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 I=new e(n);var F=new class{submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return I.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()),I.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 I.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 I.get("/formsubmission/types",!0,t)}))}};const E=new e(n);var P=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return E.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return E.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.delete(`/companies/${t}`,!0,e)}))}syncAllCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return E.get("/companies/syncall",!0,t)}))}};const B=new e(n);var R=new class{getJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return B.get("/joblistings",!0,t)}))}getJobListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.get(`/joblistings/${t}`,!0,e)}))}createJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.post("/joblistings",t,!0,e)}))}updateJobListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return B.put(`/joblistings/${t}`,e,!0,n)}))}deleteJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.delete(`/joblistings/${t}`,!0,e)}))}};const j=new e(n);var U=new class{getFieldTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return j.get("/field/types",!0,t)}))}};const M=new e(n);var O=new class{getValidatorTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return M.get("/validator/types",!0,t)}))}};const W=new e(n);var J=new class{getContentEntries(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/contententry?contentId=${t}`,!0,e)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/contententry/${t}`,!0,e)}))}createContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.post("/contententry",t,!0,e)}))}updateContentEntry(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.put(`/contententry/${t}`,e,!0,n)}))}deleteContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.delete(`/contententry/${t}`,!0,e)}))}};const D=new e(n);var z=new class{getBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return D.get("/block",!0,t)}))}getBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.get(`/block/${t}`,!0,e)}))}createBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.post("/block",t,!0,e)}))}updateBlock(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return D.put(`/block/${t}`,e,!0,n)}))}deleteBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.delete(`/block/${t}`,!0,e)}))}};const H=new e(n);var N,V,q,G=new class{getModels(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return H.get("/model",!0,t)}))}getModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.get(`/model/${t}`,!0,e)}))}createModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.post("/model",t,!0,e)}))}updateModel(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return H.put(`/model/${t}`,e,!0,n)}))}deleteModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return H.delete(`/model/${t}`,!0,e)}))}};exports.EventType=void 0,(N=exports.EventType||(exports.EventType={}))[N.Virtual=0]="Virtual",N[N.InPerson=1]="InPerson",N[N.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(V=exports.CallToActionType||(exports.CallToActionType={}))[V.Button=0]="Button",V[V.Link=1]="Link",V[V.Download=2]="Download",V[V.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(q=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[q.Submitted=1]="Submitted",q[q.Hold=2]="Hold",q[q.Rejected=3]="Rejected",q[q.Sent=4]="Sent";const K={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},X={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},Q={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},Y=c,Z=C,tt={resetPassword:g.resetPassword,resetPasswordWithToken:g.resetPasswordWithToken,forgotPassword:g.forgotPassword},et={get:f.getMapConfig,update:f.updateMapConfig,create:f.createMapConfig},nt={get:m.getClientAuthConfigById,getAll:m.getAllClientAuthConfigs,update:m.updateClientAuthConfig,create:m.createClientAuthConfig,delete:m.deleteClientAuthConfig},rt={upload:k.uploadMedia,uploadProfileImage:k.uploadProfileImage,get:k.listMedia,delete:k.deleteMedia},it={getList:b.getFilters,get:b.getFilter,update:b.updateFilter,create:b.createFilter,delete:b.deleteFilter},ot={get:T.getAppendListings,getAppendListing:T.getAppendListing,create:T.createAppendListing,update:T.updateAppendListing,delete:T.deleteAppendListing},st={get:w.getAllPermissions},at={getAll:P.getCompanies,getById:P.getCompany,create:P.createCompany,update:P.updateCompany,delete:P.deleteCompany,sync:P.syncAllCompanies},ut={getAll:R.getJobListingsByCompany,getById:R.getJobListingById,create:R.createJobListing,update:R.updateJobListing,delete:R.deleteJobListing},lt={getTypes:U.getFieldTypes},dt={getTypes:O.getValidatorTypes},ct={getAll:J.getContentEntries,getById:J.getContentEntry,create:J.createContentEntry,update:J.updateContentEntry,delete:J.deleteContentEntry},ht={getAll:z.getBlocks,getById:z.getBlock,create:z.createBlock,update:z.updateBlock,delete:z.deleteBlock},gt={getAll:G.getModels,getById:G.getModel,create:G.createModel,update:G.updateModel,delete:G.deleteModel},pt=x,ft=F,_t={auth:K,events:X,roles:Q,users:Y,account:tt,mapConfig:et,permissions:st,clientAuthConfig:nt,filters:it,listings:Z,media:rt,appendListings:ot,forms:pt,formSubmissions:ft,companies:at,jobListings:ut};exports.account=tt,exports.appendListings=ot,exports.auth=K,exports.clientAuthConfig=nt,exports.companies=at,exports.contentBlocks=ht,exports.contentEntries=ct,exports.contentField=lt,exports.contentValidator=dt,exports.default=_t,exports.events=X,exports.filters=it,exports.formSubmissions=ft,exports.forms=pt,exports.jobListings=ut,exports.listings=Z,exports.mapConfig=et,exports.media=rt,exports.model=gt,exports.permissions=st,exports.roles=Q,exports.users=Y;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t,this.isLocalhost=!1}getAuthToken(){return this.isLocalhost?sessionStorage.getItem("token"):null}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"GET",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"POST",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"PUT",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}patch(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"PATCH",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File?e.append(n||"file",t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t.toString()):Array.isArray(t)?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):"object"==typeof t&&null!==t&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}.${r}`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r?(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}),n.credentials="omit"):n.credentials="include";let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};this.isLocalhost&&(r=this.getAuthToken())&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`})),t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){if(!this.isLocalhost){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}{const t=sessionStorage.getItem("refreshToken");if(!t)return!1;const e=yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(!e.ok)return console.error("Failed to refresh token"),!1;try{const t=yield e.json();return t.token&&sessionStorage.setItem("token",t.token),t.refreshToken&&sessionStorage.setItem("refreshToken",t.refreshToken),!0}catch(t){return console.error("Failed to parse refresh token response:",t),!1}}}))}}const n=process.env.NEXT_PUBLIC_API_URL||process.env.VITE_API_URL||process.env.REACT_APP_API_URL||"https://api.myhirecontrol.com",r=new e(n),i="undefined"!=typeof window&&"localhost"===window.location.hostname;var o=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/nextLogin"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/refresh"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/changeCompany"+(i?"?localhost=true":"");var n=yield r.post(t,e,!0);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const s=new e(n);var a=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return s.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/details/${t}`,!0,e)}))}getListingEvents(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/listingEvents/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return s.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.delete(`/events/${t}`,!0,e)}))}};const u=new e(n);var l=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return u.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return u.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.delete(`/roles/${t}`,!0,e)}))}};const d=new e(n);var c=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield d.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield d.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const g=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield g.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var _=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield p.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var v=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var m=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const y=new e(n);var b=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield y.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield y.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const C=new e(n);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload-profile-image",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({folderKey:t});return C.get(`/media/list?${n.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({key:t});return C.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const S=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return S.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return S.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.delete(`/filters/${t}`,!0,e)}))}};const F=new e(n);var L=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return F.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return F.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.delete(`/appendListings/${t}`,!0,e)}))}};const k=new e(n);var T=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return k.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return k.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.post("/forms/jsonSchema",t,!0,e)}))}};const j=new e(n);var x=new class{submitContactForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return j.post("/contactForm",t,!0,e,!0)}))}submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return j.post("/formsubmission",t,!0,e)}))}getFormSubmissions(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString()),j.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString());const u=yield j.getFile(`/formsubmission/export-csv?${a.toString()}`,!0,s),l=window.URL.createObjectURL(u),d=document.createElement("a");d.href=l,d.download="form_submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(l),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return j.get("/formsubmission/types",!0,t)}))}};const B=new e(n);var I=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return B.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return B.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.delete(`/companies/${t}`,!0,e)}))}syncAllCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return B.get("/companies/syncall",!0,t)}))}};const E=new e(n);var P=new class{getJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return E.get("/joblistings",!0,t)}))}getJobListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.get(`/joblistings/${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)}))}deleteJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return E.delete(`/joblistings/${t}`,!0,e)}))}};const R=new e(n);var M=new class{getBlogs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return R.get("/blog",!0,t)}))}getBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/blog/${t}`,!0,e)}))}createBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/blog",t,!0,e)}))}updateBlog(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.put(`/blog/${t}`,e,!0,n)}))}deleteBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.delete(`/blog/${t}`,!0,e)}))}};const U=new e(n);var O=new class{getCategories(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){const n=new URLSearchParams;null!=t&&n.append("type",String(t));const r=n.toString()?`?${n.toString()}`:"";return U.get(`/categories${r}`,!0,e)}))}getCategoriesByCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;null!=e&&r.append("type",String(e));const i=r.toString()?`?${r.toString()}`:"";return U.get(`/categories/${t}${i}`,!0,n)}))}};const W=new e(n);var J=new class{getByFeed(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/feed/${t}`,!0,e)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.post("/jobFeedFieldMappings",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return W.put(`/jobFeedFieldMappings/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.delete(`/jobFeedFieldMappings/${t}`,!0,e)}))}toggleActive(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.post("/jobFeedFieldMappings/toggle-active",t,!0,e)}))}discoverFields(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/discover-fields/${t}`,!0,e)}))}validate(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return W.get(`/jobFeedFieldMappings/validate/${t}`,!0,e)}))}};const D=new e(n);var H=new class{getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return D.get("/jobfeeds",!0,t)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.get(`/jobfeeds/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.post("/jobfeeds",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return D.put(`/jobfeeds/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.delete(`/jobfeeds/${t}`,!0,e)}))}sync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.post(`/jobfeeds/${t}/sync`,{},!0,e)}))}toggleActive(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return D.patch(`/jobfeeds/${t}/toggle-active`,e,!0,n)}))}};const z=new e(n);var N=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return z.get("/jobListingSettings",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return z.post("/jobListingSettings",t,!0,e)}))}delete(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return z.delete("/jobListingSettings",!0,t)}))}};const V=new e(n);var q=new class{create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;return e&&r.append("origin",e),V.post("/listingEntities"+(r.toString()?"?"+r.toString():""),t,!0,n)}))}};const G=new e(n);var K=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){const n=new URLSearchParams;t&&t.forEach((t=>n.append("recruiterIds",t.toString())));const r=n.toString()?`?${n.toString()}`:"";return G.get(`/recruiters${r}`,!0,e)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.get("/recruiters/all",!0,t)}))}sync(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.post("/recruiters/sync",{},!0,t)}))}};const X=new e(n);var Q=new class{getFieldTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return X.get("/field/types",!0,t)}))}};const Y=new e(n);var Z=new class{getValidatorTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return Y.get("/validator/types",!0,t)}))}};const tt=new e(n);var et=new class{getContentEntries(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.get(`/contententry?contentId=${t}`,!0,e)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.get(`/contententry/${t}`,!0,e)}))}createContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.post("/contententry",t,!0,e)}))}updateContentEntry(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return tt.put(`/contententry/${t}`,e,!0,n)}))}deleteContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return tt.delete(`/contententry/${t}`,!0,e)}))}};const nt=new e(n);var rt=new class{getBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return nt.get("/block",!0,t)}))}getBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.get(`/block/${t}`,!0,e)}))}createBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.post("/block",t,!0,e)}))}updateBlock(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return nt.put(`/block/${t}`,e,!0,n)}))}deleteBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return nt.delete(`/block/${t}`,!0,e)}))}};const it=new e(n);var ot,st,at,ut,lt=new class{getModels(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return it.get("/model",!0,t)}))}getModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.get(`/model/${t}`,!0,e)}))}createModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.post("/model",t,!0,e)}))}updateModel(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return it.put(`/model/${t}`,e,!0,n)}))}deleteModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.delete(`/model/${t}`,!0,e)}))}};exports.EventType=void 0,(ot=exports.EventType||(exports.EventType={}))[ot.Virtual=0]="Virtual",ot[ot.InPerson=1]="InPerson",ot[ot.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(st=exports.CallToActionType||(exports.CallToActionType={}))[st.Button=0]="Button",st[st.Link=1]="Link",st[st.Download=2]="Download",st[st.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(at=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[at.Submitted=1]="Submitted",at[at.Hold=2]="Hold",at[at.Rejected=3]="Rejected",at[at.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(ut=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[ut.Replace=0]="Replace",ut[ut.Append=1]="Append",ut[ut.Custom=2]="Custom";const dt={login:o.login,nextLogin:o.nextLogin,refreshToken:o.refreshToken,changeCompany:o.changeCompany,register:o.register,isAuthenticated:o.isAuthenticated,getCompany:o.getCompany,getCompanies:o.getCompanies,getRoles:o.getRoles,getPermissions:o.getPermissions,logout:o.logout,getUser:o.getUser},ct={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},gt={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},ht=c,pt=b,_t={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},ft={get:_.getMapConfig,update:_.updateMapConfig,create:_.createMapConfig},vt={get:m.getClientAuthConfigById,getAll:m.getAllClientAuthConfigs,update:m.updateClientAuthConfig,create:m.createClientAuthConfig,delete:m.deleteClientAuthConfig},wt={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},mt={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},yt={get:L.getAppendListings,getAppendListing:L.getAppendListing,create:L.createAppendListing,update:L.updateAppendListing,delete:L.deleteAppendListing},bt={getAll:M.getBlogs,getById:M.getBlog,create:M.createBlog,update:M.updateBlog,delete:M.deleteBlog},Ct={get:O.getCategories,getByCompany:O.getCategoriesByCompany},At={getByFeed:J.getByFeed,get:J.get,create:J.create,update:J.update,delete:J.delete,toggleActive:J.toggleActive,discoverFields:J.discoverFields,validate:J.validate},St={getAll:H.getAll,getById:H.get,create:H.create,update:H.update,delete:H.delete,sync:H.sync,toggleActive:H.toggleActive},$t={get:N.get,create:N.create,delete:N.delete},Ft={create:q.create},Lt={get:K.get,getAll:K.getAll,sync:K.sync},kt={get:v.getAllPermissions},Tt={getAll:I.getCompanies,getById:I.getCompany,create:I.createCompany,update:I.updateCompany,delete:I.deleteCompany,sync:I.syncAllCompanies},jt={getAll:P.getJobListingsByCompany,getById:P.getJobListingById,create:P.createJobListing,update:P.updateJobListing,delete:P.deleteJobListing},xt={getTypes:Q.getFieldTypes},Bt={getTypes:Z.getValidatorTypes},It={getAll:et.getContentEntries,getById:et.getContentEntry,create:et.createContentEntry,update:et.updateContentEntry,delete:et.deleteContentEntry},Et={getAll:rt.getBlocks,getById:rt.getBlock,create:rt.createBlock,update:rt.updateBlock,delete:rt.deleteBlock},Pt={getAll:lt.getModels,getById:lt.getModel,create:lt.createModel,update:lt.updateModel,delete:lt.deleteModel},Rt=T,Mt=x,Ut={auth:dt,events:ct,roles:gt,users:ht,account:_t,mapConfig:ft,permissions:kt,clientAuthConfig:vt,filters:mt,listings:pt,media:wt,appendListings:yt,blogs:bt,categories:Ct,jobFeedFieldMappings:At,jobFeeds:St,jobListingSettings:$t,listingEntities:Ft,recruiters:Lt,forms:Rt,formSubmissions:Mt,companies:Tt,jobListings:jt};exports.account=_t,exports.appendListings=yt,exports.auth=dt,exports.blogs=bt,exports.categories=Ct,exports.clientAuthConfig=vt,exports.companies=Tt,exports.contentBlocks=Et,exports.contentEntries=It,exports.contentField=xt,exports.contentValidator=Bt,exports.default=Ut,exports.events=ct,exports.filters=mt,exports.formSubmissions=Mt,exports.forms=Rt,exports.jobFeedFieldMappings=At,exports.jobFeeds=St,exports.jobListingSettings=$t,exports.jobListings=jt,exports.listingEntities=Ft,exports.listings=pt,exports.mapConfig=ft,exports.media=wt,exports.model=Pt,exports.permissions=kt,exports.recruiters=Lt,exports.roles=gt,exports.users=ht;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,13 @@ import ValidatorDefinition from "./types/content/validatorDefinition";
|
|
|
20
20
|
import ContentModel from "./types/content/model";
|
|
21
21
|
import ContentBlock from "./types/content/block";
|
|
22
22
|
import ContentEntry from "./types/content/contentEntry";
|
|
23
|
+
import Blog from "./types/blog";
|
|
24
|
+
import JobFeed from "./types/jobFeed";
|
|
25
|
+
import JobFeedFieldMapping from "./types/jobFeedFieldMapping";
|
|
26
|
+
import JobListingSettings, { FeedHandlingOption } from "./types/jobListingSettings";
|
|
27
|
+
import ListingEntityDto from "./types/listingEntity";
|
|
28
|
+
import RecruiterDto from "./types/recruiter";
|
|
29
|
+
import FocalPoint from "./types/focalPoint";
|
|
23
30
|
export declare const auth: {
|
|
24
31
|
login: (clientLogInRequest: import("./types/clientLoginRequest").default) => Promise<any>;
|
|
25
32
|
nextLogin: (credentials: import("./types/credentials").default) => Promise<any>;
|
|
@@ -91,6 +98,49 @@ export declare const appendListings: {
|
|
|
91
98
|
update: (id: string, appendListingDto: AppendListing, authToken?: string | null) => Promise<void>;
|
|
92
99
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
93
100
|
};
|
|
101
|
+
export declare const blogs: {
|
|
102
|
+
getAll: (authToken?: string | null) => Promise<Blog[]>;
|
|
103
|
+
getById: (blogId: string, authToken?: string | null) => Promise<Blog>;
|
|
104
|
+
create: (blog: Blog, authToken?: string | null) => Promise<Blog>;
|
|
105
|
+
update: (blogId: string, blog: Blog, authToken?: string | null) => Promise<void>;
|
|
106
|
+
delete: (blogId: string, authToken?: string | null) => Promise<void>;
|
|
107
|
+
};
|
|
108
|
+
export declare const categories: {
|
|
109
|
+
get: (type?: number | null, authToken?: string | null) => Promise<string[]>;
|
|
110
|
+
getByCompany: (companyId: number, type?: number | null, authToken?: string | null) => Promise<any[]>;
|
|
111
|
+
};
|
|
112
|
+
export declare const jobFeedFieldMappings: {
|
|
113
|
+
getByFeed: (feedId: string, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
|
|
114
|
+
get: (id: string, authToken?: string | null) => Promise<JobFeedFieldMapping>;
|
|
115
|
+
create: (mapping: JobFeedFieldMapping, authToken?: string | null) => Promise<JobFeedFieldMapping>;
|
|
116
|
+
update: (id: string, mapping: JobFeedFieldMapping, authToken?: string | null) => Promise<JobFeedFieldMapping>;
|
|
117
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
118
|
+
toggleActive: (request: import("./types/jobFeedFieldMappingToggle").ToggleMappingsActiveRequest, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
|
|
119
|
+
discoverFields: (feedId: string, authToken?: string | null) => Promise<string[]>;
|
|
120
|
+
validate: (feedId: string, authToken?: string | null) => Promise<Record<string, string[]>>;
|
|
121
|
+
};
|
|
122
|
+
export declare const jobFeeds: {
|
|
123
|
+
getAll: (authToken?: string | null) => Promise<JobFeed[]>;
|
|
124
|
+
getById: (id: string, authToken?: string | null) => Promise<JobFeed>;
|
|
125
|
+
create: (jobFeed: JobFeed, authToken?: string | null) => Promise<JobFeed>;
|
|
126
|
+
update: (id: string, jobFeed: JobFeed, authToken?: string | null) => Promise<JobFeed>;
|
|
127
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
128
|
+
sync: (id: string, authToken?: string | null) => Promise<JobFeed>;
|
|
129
|
+
toggleActive: (id: string, active: boolean, authToken?: string | null) => Promise<JobFeed>;
|
|
130
|
+
};
|
|
131
|
+
export declare const jobListingSettings: {
|
|
132
|
+
get: (authToken?: string | null) => Promise<JobListingSettings>;
|
|
133
|
+
create: (settings: JobListingSettings, authToken?: string | null) => Promise<JobListingSettings>;
|
|
134
|
+
delete: (authToken?: string | null) => Promise<void>;
|
|
135
|
+
};
|
|
136
|
+
export declare const listingEntities: {
|
|
137
|
+
create: (ids: number[], origin?: string | null, authToken?: string | null) => Promise<Record<string, ListingEntityDto>>;
|
|
138
|
+
};
|
|
139
|
+
export declare const recruiters: {
|
|
140
|
+
get: (recruiterIds?: number[] | null, authToken?: string | null) => Promise<Record<string, RecruiterDto>>;
|
|
141
|
+
getAll: (authToken?: string | null) => Promise<RecruiterDto>;
|
|
142
|
+
sync: (authToken?: string | null) => Promise<void>;
|
|
143
|
+
};
|
|
94
144
|
export declare const permissions: {
|
|
95
145
|
get: (authToken?: string | null) => Promise<string[]>;
|
|
96
146
|
};
|
|
@@ -145,13 +195,14 @@ export declare const forms: {
|
|
|
145
195
|
processFormRequest(formRequest: string, authToken?: string | null): Promise<string>;
|
|
146
196
|
};
|
|
147
197
|
export declare const formSubmissions: {
|
|
198
|
+
submitContactForm(form: any, authToken?: string | null): Promise<string>;
|
|
148
199
|
submitFormSubmission(formSubmission: FormSubmission, authToken?: string | null): Promise<string>;
|
|
149
200
|
getFormSubmissions(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<ResultsWrapper<FormSubmission>>;
|
|
150
201
|
exportFormSubmissionsCsv(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<void>;
|
|
151
202
|
getFormSubmissionTypes(authToken?: string | null): Promise<string[]>;
|
|
152
203
|
};
|
|
153
|
-
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, };
|
|
154
|
-
export { EventType, CallToActionType, FormSubmissionStatus };
|
|
204
|
+
export type { Register, User, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing, Form, FormSubmission, ResultsWrapper, Company, JobListing, FieldTypeDefinition, ValidatorDefinition, ContentModel, ContentBlock, ContentEntry, Blog, JobFeed, JobFeedFieldMapping, JobListingSettings, ListingEntityDto, RecruiterDto, FocalPoint, };
|
|
205
|
+
export { EventType, CallToActionType, FormSubmissionStatus, FeedHandlingOption };
|
|
155
206
|
declare const hcApi: {
|
|
156
207
|
auth: {
|
|
157
208
|
login: (clientLogInRequest: import("./types/clientLoginRequest").default) => Promise<any>;
|
|
@@ -227,6 +278,49 @@ declare const hcApi: {
|
|
|
227
278
|
update: (id: string, appendListingDto: AppendListing, authToken?: string | null) => Promise<void>;
|
|
228
279
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
229
280
|
};
|
|
281
|
+
blogs: {
|
|
282
|
+
getAll: (authToken?: string | null) => Promise<Blog[]>;
|
|
283
|
+
getById: (blogId: string, authToken?: string | null) => Promise<Blog>;
|
|
284
|
+
create: (blog: Blog, authToken?: string | null) => Promise<Blog>;
|
|
285
|
+
update: (blogId: string, blog: Blog, authToken?: string | null) => Promise<void>;
|
|
286
|
+
delete: (blogId: string, authToken?: string | null) => Promise<void>;
|
|
287
|
+
};
|
|
288
|
+
categories: {
|
|
289
|
+
get: (type?: number | null, authToken?: string | null) => Promise<string[]>;
|
|
290
|
+
getByCompany: (companyId: number, type?: number | null, authToken?: string | null) => Promise<any[]>;
|
|
291
|
+
};
|
|
292
|
+
jobFeedFieldMappings: {
|
|
293
|
+
getByFeed: (feedId: string, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
|
|
294
|
+
get: (id: string, authToken?: string | null) => Promise<JobFeedFieldMapping>;
|
|
295
|
+
create: (mapping: JobFeedFieldMapping, authToken?: string | null) => Promise<JobFeedFieldMapping>;
|
|
296
|
+
update: (id: string, mapping: JobFeedFieldMapping, authToken?: string | null) => Promise<JobFeedFieldMapping>;
|
|
297
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
298
|
+
toggleActive: (request: import("./types/jobFeedFieldMappingToggle").ToggleMappingsActiveRequest, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
|
|
299
|
+
discoverFields: (feedId: string, authToken?: string | null) => Promise<string[]>;
|
|
300
|
+
validate: (feedId: string, authToken?: string | null) => Promise<Record<string, string[]>>;
|
|
301
|
+
};
|
|
302
|
+
jobFeeds: {
|
|
303
|
+
getAll: (authToken?: string | null) => Promise<JobFeed[]>;
|
|
304
|
+
getById: (id: string, authToken?: string | null) => Promise<JobFeed>;
|
|
305
|
+
create: (jobFeed: JobFeed, authToken?: string | null) => Promise<JobFeed>;
|
|
306
|
+
update: (id: string, jobFeed: JobFeed, authToken?: string | null) => Promise<JobFeed>;
|
|
307
|
+
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
308
|
+
sync: (id: string, authToken?: string | null) => Promise<JobFeed>;
|
|
309
|
+
toggleActive: (id: string, active: boolean, authToken?: string | null) => Promise<JobFeed>;
|
|
310
|
+
};
|
|
311
|
+
jobListingSettings: {
|
|
312
|
+
get: (authToken?: string | null) => Promise<JobListingSettings>;
|
|
313
|
+
create: (settings: JobListingSettings, authToken?: string | null) => Promise<JobListingSettings>;
|
|
314
|
+
delete: (authToken?: string | null) => Promise<void>;
|
|
315
|
+
};
|
|
316
|
+
listingEntities: {
|
|
317
|
+
create: (ids: number[], origin?: string | null, authToken?: string | null) => Promise<Record<string, ListingEntityDto>>;
|
|
318
|
+
};
|
|
319
|
+
recruiters: {
|
|
320
|
+
get: (recruiterIds?: number[] | null, authToken?: string | null) => Promise<Record<string, RecruiterDto>>;
|
|
321
|
+
getAll: (authToken?: string | null) => Promise<RecruiterDto>;
|
|
322
|
+
sync: (authToken?: string | null) => Promise<void>;
|
|
323
|
+
};
|
|
230
324
|
forms: {
|
|
231
325
|
getForms(authToken?: string | null): Promise<Form[]>;
|
|
232
326
|
getForm(id: string, authToken?: string | null): Promise<Form>;
|
|
@@ -236,6 +330,7 @@ declare const hcApi: {
|
|
|
236
330
|
processFormRequest(formRequest: string, authToken?: string | null): Promise<string>;
|
|
237
331
|
};
|
|
238
332
|
formSubmissions: {
|
|
333
|
+
submitContactForm(form: any, authToken?: string | null): Promise<string>;
|
|
239
334
|
submitFormSubmission(formSubmission: FormSubmission, authToken?: string | null): Promise<string>;
|
|
240
335
|
getFormSubmissions(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<ResultsWrapper<FormSubmission>>;
|
|
241
336
|
exportFormSubmissionsCsv(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, authToken?: string | null): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type AuditTrailEntry = {
|
|
2
|
+
timestamp?: string;
|
|
3
|
+
action?: string;
|
|
4
|
+
user?: string;
|
|
5
|
+
details?: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
};
|
|
8
|
+
export type JobFeed = {
|
|
9
|
+
id: string;
|
|
10
|
+
companyId: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
format?: string;
|
|
14
|
+
active: boolean;
|
|
15
|
+
isCustom: boolean;
|
|
16
|
+
lastSyncAt?: string;
|
|
17
|
+
lastSyncStatus?: string;
|
|
18
|
+
jobCount: number;
|
|
19
|
+
auditTrail?: AuditTrailEntry[];
|
|
20
|
+
createdAt: string;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
};
|
|
23
|
+
export default JobFeed;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AuditTrailEntry } from './jobFeed';
|
|
2
|
+
export type JobFeedFieldMapping = {
|
|
3
|
+
id: string;
|
|
4
|
+
companyId: string;
|
|
5
|
+
feedId: string;
|
|
6
|
+
externalField?: string;
|
|
7
|
+
internalField?: string;
|
|
8
|
+
transformationRule?: string;
|
|
9
|
+
active: boolean;
|
|
10
|
+
status?: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
auditTrail?: AuditTrailEntry[];
|
|
14
|
+
};
|
|
15
|
+
export default JobFeedFieldMapping;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AuditTrailEntry } from './jobFeed';
|
|
2
|
+
export declare enum FeedHandlingOption {
|
|
3
|
+
Replace = 0,
|
|
4
|
+
Append = 1,
|
|
5
|
+
Custom = 2
|
|
6
|
+
}
|
|
7
|
+
export type JobListingSettings = {
|
|
8
|
+
id: string;
|
|
9
|
+
companyId: string;
|
|
10
|
+
feedHandling: FeedHandlingOption;
|
|
11
|
+
syncInterval?: string;
|
|
12
|
+
syncEnabled: boolean;
|
|
13
|
+
defaultStatus?: string;
|
|
14
|
+
lastUpdated: string;
|
|
15
|
+
auditTrail?: AuditTrailEntry[];
|
|
16
|
+
};
|
|
17
|
+
export default JobListingSettings;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Address } from './company';
|
|
2
|
+
export type ListingEntityDto = {
|
|
3
|
+
id: number;
|
|
4
|
+
listingId: number;
|
|
5
|
+
latitude: number;
|
|
6
|
+
longitude: number;
|
|
7
|
+
entityDisplayName?: string;
|
|
8
|
+
address: Address;
|
|
9
|
+
travelTime?: string;
|
|
10
|
+
staticMapUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
export default ListingEntityDto;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import FocalPoint from './focalPoint';
|
|
2
|
+
export type RecruiterDto = {
|
|
3
|
+
id?: number;
|
|
4
|
+
title?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
firstName?: string;
|
|
7
|
+
lastName?: string;
|
|
8
|
+
linkedInUrl?: string;
|
|
9
|
+
mobilePhone?: string;
|
|
10
|
+
phone?: string;
|
|
11
|
+
headshot?: string;
|
|
12
|
+
imageFocalPoint?: FocalPoint;
|
|
13
|
+
comments?: string;
|
|
14
|
+
additionalFields?: Record<string, any>;
|
|
15
|
+
};
|
|
16
|
+
export default RecruiterDto;
|
package/handlers/fetchHandler.ts
CHANGED
|
@@ -5,10 +5,10 @@ class FetchHandler {
|
|
|
5
5
|
constructor(apiUrl: string) {
|
|
6
6
|
this.apiUrl = apiUrl;
|
|
7
7
|
// Check if running on localhost
|
|
8
|
-
this.isLocalhost =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
this.isLocalhost = false;
|
|
9
|
+
// typeof window !== "undefined" &&
|
|
10
|
+
// (window.location.hostname === "localhost" ||
|
|
11
|
+
// window.location.hostname === "127.0.0.1");
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// Get auth token based on environment
|
|
@@ -100,6 +100,34 @@ class FetchHandler {
|
|
|
100
100
|
: this.fetchWithoutAuth<R>(endpoint, options);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
// PATCH request
|
|
104
|
+
public async patch<T, R>(
|
|
105
|
+
endpoint: string,
|
|
106
|
+
body: T,
|
|
107
|
+
auth = false,
|
|
108
|
+
authToken: string | null = null,
|
|
109
|
+
formData = false
|
|
110
|
+
): Promise<R> {
|
|
111
|
+
if (this.isLocalhost && auth && !authToken) {
|
|
112
|
+
authToken = this.getAuthToken();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const isFormData = formData;
|
|
116
|
+
const options: RequestInit = {
|
|
117
|
+
method: "PATCH",
|
|
118
|
+
credentials: authToken ? "omit" : "include",
|
|
119
|
+
headers: {
|
|
120
|
+
...(authToken ? { Authorization: `Bearer ${authToken}` } : {}),
|
|
121
|
+
...(isFormData ? {} : { "Content-Type": "application/json" }),
|
|
122
|
+
},
|
|
123
|
+
body: isFormData ? this.convertToFormData(body) : JSON.stringify(body),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return auth
|
|
127
|
+
? this.fetchWithAuth<R>(endpoint, options, authToken)
|
|
128
|
+
: this.fetchWithoutAuth<R>(endpoint, options);
|
|
129
|
+
}
|
|
130
|
+
|
|
103
131
|
// DELETE request with/without auth
|
|
104
132
|
public async delete<T>(
|
|
105
133
|
endpoint: string,
|
package/index.ts
CHANGED
|
@@ -17,6 +17,13 @@ import formsController from "./controllers/formsController";
|
|
|
17
17
|
import formSubmissionController from "./controllers/formSubmissionsController";
|
|
18
18
|
import CompaniesController from "./controllers/companiesController";
|
|
19
19
|
import JobListingsController from "./controllers/jobListingsController";
|
|
20
|
+
import blogController from "./controllers/blogController";
|
|
21
|
+
import categoriesController from "./controllers/categoriesController";
|
|
22
|
+
import jobFeedFieldMappingsController from "./controllers/jobFeedFieldMappingsController";
|
|
23
|
+
import jobFeedsController from "./controllers/jobFeedsController";
|
|
24
|
+
import jobListingSettingsController from "./controllers/jobListingSettingsController";
|
|
25
|
+
import listingEntitiesController from "./controllers/listingEntitiesController";
|
|
26
|
+
import recruitersController from "./controllers/recruitersController";
|
|
20
27
|
import fieldController from "./controllers/content/fieldController";
|
|
21
28
|
import ValidatorsController from "./controllers/content/validatorController";
|
|
22
29
|
import contentEntriesController from "./controllers/content/contentEntriesController";
|
|
@@ -49,6 +56,13 @@ import ValidatorDefinition from "./types/content/validatorDefinition";
|
|
|
49
56
|
import ContentModel from "./types/content/model";
|
|
50
57
|
import ContentBlock from "./types/content/block";
|
|
51
58
|
import ContentEntry from "./types/content/contentEntry";
|
|
59
|
+
import Blog from "./types/blog";
|
|
60
|
+
import JobFeed from "./types/jobFeed";
|
|
61
|
+
import JobFeedFieldMapping from "./types/jobFeedFieldMapping";
|
|
62
|
+
import JobListingSettings, { FeedHandlingOption } from "./types/jobListingSettings";
|
|
63
|
+
import ListingEntityDto from "./types/listingEntity";
|
|
64
|
+
import RecruiterDto from "./types/recruiter";
|
|
65
|
+
import FocalPoint from "./types/focalPoint";
|
|
52
66
|
|
|
53
67
|
export const auth = {
|
|
54
68
|
login: authController.login,
|
|
@@ -127,6 +141,56 @@ export const appendListings = {
|
|
|
127
141
|
delete: appendListingsController.deleteAppendListing,
|
|
128
142
|
};
|
|
129
143
|
|
|
144
|
+
export const blogs = {
|
|
145
|
+
getAll: blogController.getBlogs,
|
|
146
|
+
getById: blogController.getBlog,
|
|
147
|
+
create: blogController.createBlog,
|
|
148
|
+
update: blogController.updateBlog,
|
|
149
|
+
delete: blogController.deleteBlog,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const categories = {
|
|
153
|
+
get: categoriesController.getCategories,
|
|
154
|
+
getByCompany: categoriesController.getCategoriesByCompany,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const jobFeedFieldMappings = {
|
|
158
|
+
getByFeed: jobFeedFieldMappingsController.getByFeed,
|
|
159
|
+
get: jobFeedFieldMappingsController.get,
|
|
160
|
+
create: jobFeedFieldMappingsController.create,
|
|
161
|
+
update: jobFeedFieldMappingsController.update,
|
|
162
|
+
delete: jobFeedFieldMappingsController.delete,
|
|
163
|
+
toggleActive: jobFeedFieldMappingsController.toggleActive,
|
|
164
|
+
discoverFields: jobFeedFieldMappingsController.discoverFields,
|
|
165
|
+
validate: jobFeedFieldMappingsController.validate,
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const jobFeeds = {
|
|
169
|
+
getAll: jobFeedsController.getAll,
|
|
170
|
+
getById: jobFeedsController.get,
|
|
171
|
+
create: jobFeedsController.create,
|
|
172
|
+
update: jobFeedsController.update,
|
|
173
|
+
delete: jobFeedsController.delete,
|
|
174
|
+
sync: jobFeedsController.sync,
|
|
175
|
+
toggleActive: jobFeedsController.toggleActive,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const jobListingSettings = {
|
|
179
|
+
get: jobListingSettingsController.get,
|
|
180
|
+
create: jobListingSettingsController.create,
|
|
181
|
+
delete: jobListingSettingsController.delete,
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const listingEntities = {
|
|
185
|
+
create: listingEntitiesController.create,
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const recruiters = {
|
|
189
|
+
get: recruitersController.get,
|
|
190
|
+
getAll: recruitersController.getAll,
|
|
191
|
+
sync: recruitersController.sync,
|
|
192
|
+
};
|
|
193
|
+
|
|
130
194
|
export const permissions = {
|
|
131
195
|
get: permissionsController.getAllPermissions,
|
|
132
196
|
};
|
|
@@ -207,9 +271,16 @@ export type {
|
|
|
207
271
|
ContentModel,
|
|
208
272
|
ContentBlock,
|
|
209
273
|
ContentEntry,
|
|
274
|
+
Blog,
|
|
275
|
+
JobFeed,
|
|
276
|
+
JobFeedFieldMapping,
|
|
277
|
+
JobListingSettings,
|
|
278
|
+
ListingEntityDto,
|
|
279
|
+
RecruiterDto,
|
|
280
|
+
FocalPoint,
|
|
210
281
|
};
|
|
211
282
|
|
|
212
|
-
export { EventType, CallToActionType, FormSubmissionStatus };
|
|
283
|
+
export { EventType, CallToActionType, FormSubmissionStatus, FeedHandlingOption };
|
|
213
284
|
|
|
214
285
|
const hcApi = {
|
|
215
286
|
auth,
|
|
@@ -224,6 +295,13 @@ const hcApi = {
|
|
|
224
295
|
listings,
|
|
225
296
|
media,
|
|
226
297
|
appendListings,
|
|
298
|
+
blogs,
|
|
299
|
+
categories,
|
|
300
|
+
jobFeedFieldMappings,
|
|
301
|
+
jobFeeds,
|
|
302
|
+
jobListingSettings,
|
|
303
|
+
listingEntities,
|
|
304
|
+
recruiters,
|
|
227
305
|
forms,
|
|
228
306
|
formSubmissions,
|
|
229
307
|
companies,
|
package/package.json
CHANGED
package/types/blog.ts
ADDED
package/types/jobFeed.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type AuditTrailEntry = {
|
|
2
|
+
timestamp?: string;
|
|
3
|
+
action?: string;
|
|
4
|
+
user?: string;
|
|
5
|
+
details?: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type JobFeed = {
|
|
10
|
+
id: string;
|
|
11
|
+
companyId: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
format?: string;
|
|
15
|
+
active: boolean;
|
|
16
|
+
isCustom: boolean;
|
|
17
|
+
lastSyncAt?: string;
|
|
18
|
+
lastSyncStatus?: string;
|
|
19
|
+
jobCount: number;
|
|
20
|
+
auditTrail?: AuditTrailEntry[];
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default JobFeed;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AuditTrailEntry } from './jobFeed';
|
|
2
|
+
|
|
3
|
+
export type JobFeedFieldMapping = {
|
|
4
|
+
id: string;
|
|
5
|
+
companyId: string;
|
|
6
|
+
feedId: string;
|
|
7
|
+
externalField?: string;
|
|
8
|
+
internalField?: string;
|
|
9
|
+
transformationRule?: string;
|
|
10
|
+
active: boolean;
|
|
11
|
+
status?: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
auditTrail?: AuditTrailEntry[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default JobFeedFieldMapping;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuditTrailEntry } from './jobFeed';
|
|
2
|
+
|
|
3
|
+
export enum FeedHandlingOption {
|
|
4
|
+
Replace = 0,
|
|
5
|
+
Append = 1,
|
|
6
|
+
Custom = 2,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type JobListingSettings = {
|
|
10
|
+
id: string;
|
|
11
|
+
companyId: string;
|
|
12
|
+
feedHandling: FeedHandlingOption;
|
|
13
|
+
syncInterval?: string;
|
|
14
|
+
syncEnabled: boolean;
|
|
15
|
+
defaultStatus?: string;
|
|
16
|
+
lastUpdated: string;
|
|
17
|
+
auditTrail?: AuditTrailEntry[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default JobListingSettings;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Address } from './company';
|
|
2
|
+
|
|
3
|
+
export type ListingEntityDto = {
|
|
4
|
+
id: number;
|
|
5
|
+
listingId: number;
|
|
6
|
+
latitude: number;
|
|
7
|
+
longitude: number;
|
|
8
|
+
entityDisplayName?: string;
|
|
9
|
+
address: Address;
|
|
10
|
+
travelTime?: string;
|
|
11
|
+
staticMapUrl?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default ListingEntityDto;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import FocalPoint from './focalPoint';
|
|
2
|
+
|
|
3
|
+
export type RecruiterDto = {
|
|
4
|
+
id?: number;
|
|
5
|
+
title?: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
firstName?: string;
|
|
8
|
+
lastName?: string;
|
|
9
|
+
linkedInUrl?: string;
|
|
10
|
+
mobilePhone?: string;
|
|
11
|
+
phone?: string;
|
|
12
|
+
headshot?: string;
|
|
13
|
+
imageFocalPoint?: FocalPoint;
|
|
14
|
+
comments?: string;
|
|
15
|
+
additionalFields?: Record<string, any>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default RecruiterDto;
|