@abcagency/hire-control-sdk 1.1.1 → 1.1.2
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/constants/cms.ts +60 -0
- package/controllers/categoryListsController.ts +29 -4
- package/controllers/content/blocksController.ts +62 -4
- package/controllers/content/contentEntriesController.ts +9 -4
- package/controllers/jobListingsController.ts +18 -0
- package/dist/constants/cms.d.ts +53 -0
- package/dist/controllers/categoryListsController.d.ts +12 -3
- package/dist/controllers/content/blocksController.d.ts +10 -0
- package/dist/controllers/jobListingsController.d.ts +6 -0
- package/dist/handlers/normalize-casing.d.ts +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +24 -4
- package/dist/types/JobListing.d.ts +1 -0
- package/dist/types/categoryList.d.ts +7 -2
- package/dist/types/content/blockUpdateImpact.d.ts +22 -0
- package/handlers/normalize-casing.ts +36 -0
- package/index.ts +23 -1
- package/package.json +1 -1
- package/types/JobListing.ts +1 -0
- package/types/categoryList.ts +8 -2
- package/types/content/blockUpdateImpact.ts +24 -0
package/constants/cms.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const BLOCK_KEYS = {
|
|
2
|
+
HERO: "hero",
|
|
3
|
+
VIDEO_BLOCK: "videoBlock",
|
|
4
|
+
CONTENT_CARD: "contentCard",
|
|
5
|
+
ICON_CARD: "iconCard",
|
|
6
|
+
LIST: "list",
|
|
7
|
+
CONTAINER: "container",
|
|
8
|
+
ACCORDION: "accordion",
|
|
9
|
+
TESTIMONIAL: "testimonial",
|
|
10
|
+
LARGE_TITLE_BLOCK: "largeTitleBlock",
|
|
11
|
+
BUTTON: "button",
|
|
12
|
+
RECRUITER: "recruiter",
|
|
13
|
+
BLOBS: "blobs",
|
|
14
|
+
TITLE_MODULAR_CONTENT_COPY: "titleModularContentCopy",
|
|
15
|
+
INTRO_WITH_CONTENT_CARD: "introWithContentCard",
|
|
16
|
+
CALLOUT_CARD: "calloutCard",
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export const BLOCK_KEY_ALIASES: Record<string, string> = {
|
|
20
|
+
"testimonial-block": BLOCK_KEYS.TESTIMONIAL,
|
|
21
|
+
"button-block": BLOCK_KEYS.BUTTON,
|
|
22
|
+
"recruiter-block": BLOCK_KEYS.RECRUITER,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const FIELD_TYPES = {
|
|
26
|
+
SINGLE_LINE_STRING: "SingleLineString",
|
|
27
|
+
MULTI_LINE_TEXT: "MultiLineText",
|
|
28
|
+
MULTIPLE_PARAGRAPH_TEXT: "MultipleParagraphText",
|
|
29
|
+
SLUG: "Slug",
|
|
30
|
+
STRUCTURED_TEXT: "StructuredText",
|
|
31
|
+
RICH_TEXT: "RichText",
|
|
32
|
+
INTEGER_NUMBER: "IntegerNumber",
|
|
33
|
+
FLOATING_POINT_NUMBER: "FloatingPointNumber",
|
|
34
|
+
BOOLEAN: "Boolean",
|
|
35
|
+
DATE: "Date",
|
|
36
|
+
DATE_TIME: "DateTime",
|
|
37
|
+
SINGLE_MEDIA: "SingleMedia",
|
|
38
|
+
MEDIA_GALLERY: "MediaGallery",
|
|
39
|
+
EXTERNAL_VIDEO: "ExternalVideo",
|
|
40
|
+
COLOR: "Color",
|
|
41
|
+
TAILWIND_COLOR_SELECTOR: "TailwindColorSelector",
|
|
42
|
+
SINGLE_LINK: "SingleLink",
|
|
43
|
+
MULTIPLE_LINKS: "MultipleLinks",
|
|
44
|
+
LOCATION: "Location",
|
|
45
|
+
JSON: "Json",
|
|
46
|
+
SEO: "Seo",
|
|
47
|
+
MODULAR_CONTENT: "ModularContent",
|
|
48
|
+
SINGLE_BLOCK: "SingleBlock",
|
|
49
|
+
JOB_FILTER: "JobFilter",
|
|
50
|
+
FORM: "Form",
|
|
51
|
+
SINGLE_CONTENT_REFERENCE: "SingleContentReference",
|
|
52
|
+
MULTIPLE_CONTENT_REFERENCE: "MultipleContentReference",
|
|
53
|
+
HIRE_CONTROL_MAP: "HireControlMap",
|
|
54
|
+
RECRUITER_SELECTOR: "RecruiterSelector",
|
|
55
|
+
TAGS: "Tags",
|
|
56
|
+
VARIANT_SELECTOR: "VariantSelector",
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
export type BlockKey = (typeof BLOCK_KEYS)[keyof typeof BLOCK_KEYS];
|
|
60
|
+
export type FieldType = (typeof FIELD_TYPES)[keyof typeof FIELD_TYPES];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import FetchHandler from "../handlers/fetchHandler";
|
|
2
2
|
import { API_URL } from "../constants/config";
|
|
3
|
-
import CategoryListDto, {
|
|
3
|
+
import CategoryListDto, {
|
|
4
|
+
AddValueRequest,
|
|
5
|
+
CategoryListValueDto,
|
|
6
|
+
} from "../types/categoryList";
|
|
4
7
|
|
|
5
8
|
const fetchHandler = new FetchHandler(API_URL);
|
|
6
9
|
|
|
@@ -181,22 +184,44 @@ class CategoryListsController {
|
|
|
181
184
|
/**
|
|
182
185
|
* Update values in a category list.
|
|
183
186
|
* @param {string} id - The category list ID.
|
|
184
|
-
* @param {Record<string, string>} values - The values to update.
|
|
187
|
+
* @param {Record<string, CategoryListDto["values"][string]>} values - The values to update.
|
|
185
188
|
* @param {string | null} authToken - Optional auth token.
|
|
186
189
|
* @returns {Promise<CategoryListDto>} - The updated category list data.
|
|
187
190
|
*/
|
|
188
191
|
async updateValues(
|
|
189
192
|
id: string,
|
|
190
|
-
values: Record<string, string>,
|
|
193
|
+
values: Record<string, CategoryListDto["values"][string]>,
|
|
191
194
|
authToken: string | null = null
|
|
192
195
|
): Promise<CategoryListDto> {
|
|
193
|
-
return fetchHandler.put<Record<string, string>, CategoryListDto>(
|
|
196
|
+
return fetchHandler.put<Record<string, CategoryListDto["values"][string]>, CategoryListDto>(
|
|
194
197
|
`/categorylist/${id}/values`,
|
|
195
198
|
values,
|
|
196
199
|
true,
|
|
197
200
|
authToken
|
|
198
201
|
);
|
|
199
202
|
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Update a single value in a category list.
|
|
206
|
+
* @param {string} id - The category list ID.
|
|
207
|
+
* @param {string} key - The value key to update.
|
|
208
|
+
* @param {CategoryListValueDto} value - The value payload.
|
|
209
|
+
* @param {string | null} authToken - Optional auth token.
|
|
210
|
+
* @returns {Promise<CategoryListDto>} - The updated category list data.
|
|
211
|
+
*/
|
|
212
|
+
async updateValue(
|
|
213
|
+
id: string,
|
|
214
|
+
key: string,
|
|
215
|
+
value: CategoryListValueDto,
|
|
216
|
+
authToken: string | null = null
|
|
217
|
+
): Promise<CategoryListDto> {
|
|
218
|
+
return fetchHandler.put<CategoryListValueDto, CategoryListDto>(
|
|
219
|
+
`/categorylist/${id}/values/${encodeURIComponent(key)}`,
|
|
220
|
+
value,
|
|
221
|
+
true,
|
|
222
|
+
authToken
|
|
223
|
+
);
|
|
224
|
+
}
|
|
200
225
|
}
|
|
201
226
|
|
|
202
227
|
export default new CategoryListsController();
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import FetchHandler from "../../handlers/fetchHandler";
|
|
2
|
+
import { normalizeToCamelCase } from "../../handlers/normalize-casing";
|
|
2
3
|
import Block from "../../types/content/block";
|
|
4
|
+
import {
|
|
5
|
+
BlockUpdateImpact,
|
|
6
|
+
BlockFieldMigration,
|
|
7
|
+
} from "../../types/content/blockUpdateImpact";
|
|
3
8
|
import { API_URL } from "../../constants/config";
|
|
4
9
|
|
|
5
10
|
const fetchHandler = new FetchHandler(API_URL);
|
|
@@ -11,7 +16,8 @@ class BlocksController {
|
|
|
11
16
|
* @returns {Promise<Block[]>} - A list of blocks.
|
|
12
17
|
*/
|
|
13
18
|
async getBlocks(authToken: string | null = null): Promise<Block[]> {
|
|
14
|
-
|
|
19
|
+
const response = await fetchHandler.get<Block[]>("/block", true, authToken);
|
|
20
|
+
return normalizeToCamelCase(response);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
/**
|
|
@@ -21,7 +27,8 @@ class BlocksController {
|
|
|
21
27
|
* @returns {Promise<Block>} - The block data.
|
|
22
28
|
*/
|
|
23
29
|
async getBlock(id: string, authToken: string | null = null): Promise<Block> {
|
|
24
|
-
|
|
30
|
+
const response = await fetchHandler.get<Block>(`/block/${id}`, true, authToken);
|
|
31
|
+
return normalizeToCamelCase(response);
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/**
|
|
@@ -34,7 +41,13 @@ class BlocksController {
|
|
|
34
41
|
block: Block,
|
|
35
42
|
authToken: string | null = null
|
|
36
43
|
): Promise<Block> {
|
|
37
|
-
|
|
44
|
+
const response = await fetchHandler.post<Block, Block>(
|
|
45
|
+
"/block",
|
|
46
|
+
block,
|
|
47
|
+
true,
|
|
48
|
+
authToken
|
|
49
|
+
);
|
|
50
|
+
return normalizeToCamelCase(response);
|
|
38
51
|
}
|
|
39
52
|
|
|
40
53
|
/**
|
|
@@ -57,6 +70,46 @@ class BlocksController {
|
|
|
57
70
|
);
|
|
58
71
|
}
|
|
59
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Update an existing block and apply optional field migrations.
|
|
75
|
+
* Backward compatible with the legacy PUT body.
|
|
76
|
+
*/
|
|
77
|
+
async updateBlockWithMigrations(
|
|
78
|
+
id: string,
|
|
79
|
+
block: Block,
|
|
80
|
+
fieldMigrations: BlockFieldMigration[] = [],
|
|
81
|
+
authToken: string | null = null
|
|
82
|
+
): Promise<void> {
|
|
83
|
+
const payload =
|
|
84
|
+
fieldMigrations.length > 0
|
|
85
|
+
? { block, fieldMigrations }
|
|
86
|
+
: block;
|
|
87
|
+
|
|
88
|
+
return fetchHandler.put<typeof payload, void>(
|
|
89
|
+
`/block/${id}`,
|
|
90
|
+
payload,
|
|
91
|
+
true,
|
|
92
|
+
authToken
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Preview the impact of updating a block definition before saving it.
|
|
98
|
+
*/
|
|
99
|
+
async previewBlockUpdate(
|
|
100
|
+
id: string,
|
|
101
|
+
block: Block,
|
|
102
|
+
authToken: string | null = null
|
|
103
|
+
): Promise<BlockUpdateImpact> {
|
|
104
|
+
const response = await fetchHandler.post<Block, BlockUpdateImpact>(
|
|
105
|
+
`/block/${id}/preview-update`,
|
|
106
|
+
block,
|
|
107
|
+
true,
|
|
108
|
+
authToken
|
|
109
|
+
);
|
|
110
|
+
return normalizeToCamelCase(response);
|
|
111
|
+
}
|
|
112
|
+
|
|
60
113
|
/**
|
|
61
114
|
* Delete an existing block.
|
|
62
115
|
* @param {string} id - The block ID to delete.
|
|
@@ -76,7 +129,12 @@ class BlocksController {
|
|
|
76
129
|
* @returns {Promise<Block[]>} - A list of template blocks.
|
|
77
130
|
*/
|
|
78
131
|
async getTemplateBlocks(authToken: string | null = null): Promise<Block[]> {
|
|
79
|
-
|
|
132
|
+
const response = await fetchHandler.get<Block[]>(
|
|
133
|
+
"/block/template-blocks",
|
|
134
|
+
true,
|
|
135
|
+
authToken
|
|
136
|
+
);
|
|
137
|
+
return normalizeToCamelCase(response);
|
|
80
138
|
}
|
|
81
139
|
}
|
|
82
140
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import FetchHandler from "../../handlers/fetchHandler";
|
|
2
|
+
import { normalizeToCamelCase } from "../../handlers/normalize-casing";
|
|
2
3
|
import ContentEntry from "../../types/content/contentEntry";
|
|
3
4
|
import Status from "../../types/content/status";
|
|
4
5
|
import { API_URL } from "../../constants/config";
|
|
@@ -22,7 +23,8 @@ class ContentEntriesController {
|
|
|
22
23
|
if (statusFilter !== null) {
|
|
23
24
|
url += `&statusFilter=${statusFilter}`;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
const response = await fetchHandler.get<ContentEntry[]>(url, true, authToken);
|
|
27
|
+
return normalizeToCamelCase(response);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -41,7 +43,8 @@ class ContentEntriesController {
|
|
|
41
43
|
if (statusFilter !== null) {
|
|
42
44
|
url += `?statusFilter=${statusFilter}`;
|
|
43
45
|
}
|
|
44
|
-
|
|
46
|
+
const response = await fetchHandler.get<ContentEntry>(url, true, authToken);
|
|
47
|
+
return normalizeToCamelCase(response);
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
/**
|
|
@@ -54,12 +57,13 @@ class ContentEntriesController {
|
|
|
54
57
|
entry: ContentEntry,
|
|
55
58
|
authToken: string | null = null,
|
|
56
59
|
): Promise<ContentEntry> {
|
|
57
|
-
|
|
60
|
+
const response = await fetchHandler.post<ContentEntry, ContentEntry>(
|
|
58
61
|
"/contententry",
|
|
59
62
|
entry,
|
|
60
63
|
true,
|
|
61
64
|
authToken,
|
|
62
65
|
);
|
|
66
|
+
return normalizeToCamelCase(response);
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -105,11 +109,12 @@ class ContentEntriesController {
|
|
|
105
109
|
id: string,
|
|
106
110
|
authToken: string | null = null,
|
|
107
111
|
): Promise<ContentEntry[]> {
|
|
108
|
-
|
|
112
|
+
const response = await fetchHandler.get<ContentEntry[]>(
|
|
109
113
|
`/contententry/${id}/versions`,
|
|
110
114
|
true,
|
|
111
115
|
authToken,
|
|
112
116
|
);
|
|
117
|
+
return normalizeToCamelCase(response);
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
/**
|
|
@@ -8,6 +8,24 @@ const fetchHandler = new FetchHandler(API_URL);
|
|
|
8
8
|
* Controller for handling job listing API requests.
|
|
9
9
|
*/
|
|
10
10
|
class JobListingsController {
|
|
11
|
+
async updateFieldVersionApproval(
|
|
12
|
+
id: string,
|
|
13
|
+
payload: {
|
|
14
|
+
fieldPath: string;
|
|
15
|
+
timestamp?: string;
|
|
16
|
+
listingVersionNumber?: number;
|
|
17
|
+
needsApproval: boolean;
|
|
18
|
+
},
|
|
19
|
+
authToken: string | null = null
|
|
20
|
+
): Promise<void> {
|
|
21
|
+
return fetchHandler.patch<typeof payload, void>(
|
|
22
|
+
`/joblistings/${id}/field-version-approval`,
|
|
23
|
+
payload,
|
|
24
|
+
true,
|
|
25
|
+
authToken
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
11
29
|
/**
|
|
12
30
|
* [GET /joblistings]
|
|
13
31
|
* Get all job listings for the authenticated user's company.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const BLOCK_KEYS: {
|
|
2
|
+
readonly HERO: "hero";
|
|
3
|
+
readonly VIDEO_BLOCK: "videoBlock";
|
|
4
|
+
readonly CONTENT_CARD: "contentCard";
|
|
5
|
+
readonly ICON_CARD: "iconCard";
|
|
6
|
+
readonly LIST: "list";
|
|
7
|
+
readonly CONTAINER: "container";
|
|
8
|
+
readonly ACCORDION: "accordion";
|
|
9
|
+
readonly TESTIMONIAL: "testimonial";
|
|
10
|
+
readonly LARGE_TITLE_BLOCK: "largeTitleBlock";
|
|
11
|
+
readonly BUTTON: "button";
|
|
12
|
+
readonly RECRUITER: "recruiter";
|
|
13
|
+
readonly BLOBS: "blobs";
|
|
14
|
+
readonly TITLE_MODULAR_CONTENT_COPY: "titleModularContentCopy";
|
|
15
|
+
readonly INTRO_WITH_CONTENT_CARD: "introWithContentCard";
|
|
16
|
+
readonly CALLOUT_CARD: "calloutCard";
|
|
17
|
+
};
|
|
18
|
+
export declare const BLOCK_KEY_ALIASES: Record<string, string>;
|
|
19
|
+
export declare const FIELD_TYPES: {
|
|
20
|
+
readonly SINGLE_LINE_STRING: "SingleLineString";
|
|
21
|
+
readonly MULTI_LINE_TEXT: "MultiLineText";
|
|
22
|
+
readonly MULTIPLE_PARAGRAPH_TEXT: "MultipleParagraphText";
|
|
23
|
+
readonly SLUG: "Slug";
|
|
24
|
+
readonly STRUCTURED_TEXT: "StructuredText";
|
|
25
|
+
readonly RICH_TEXT: "RichText";
|
|
26
|
+
readonly INTEGER_NUMBER: "IntegerNumber";
|
|
27
|
+
readonly FLOATING_POINT_NUMBER: "FloatingPointNumber";
|
|
28
|
+
readonly BOOLEAN: "Boolean";
|
|
29
|
+
readonly DATE: "Date";
|
|
30
|
+
readonly DATE_TIME: "DateTime";
|
|
31
|
+
readonly SINGLE_MEDIA: "SingleMedia";
|
|
32
|
+
readonly MEDIA_GALLERY: "MediaGallery";
|
|
33
|
+
readonly EXTERNAL_VIDEO: "ExternalVideo";
|
|
34
|
+
readonly COLOR: "Color";
|
|
35
|
+
readonly TAILWIND_COLOR_SELECTOR: "TailwindColorSelector";
|
|
36
|
+
readonly SINGLE_LINK: "SingleLink";
|
|
37
|
+
readonly MULTIPLE_LINKS: "MultipleLinks";
|
|
38
|
+
readonly LOCATION: "Location";
|
|
39
|
+
readonly JSON: "Json";
|
|
40
|
+
readonly SEO: "Seo";
|
|
41
|
+
readonly MODULAR_CONTENT: "ModularContent";
|
|
42
|
+
readonly SINGLE_BLOCK: "SingleBlock";
|
|
43
|
+
readonly JOB_FILTER: "JobFilter";
|
|
44
|
+
readonly FORM: "Form";
|
|
45
|
+
readonly SINGLE_CONTENT_REFERENCE: "SingleContentReference";
|
|
46
|
+
readonly MULTIPLE_CONTENT_REFERENCE: "MultipleContentReference";
|
|
47
|
+
readonly HIRE_CONTROL_MAP: "HireControlMap";
|
|
48
|
+
readonly RECRUITER_SELECTOR: "RecruiterSelector";
|
|
49
|
+
readonly TAGS: "Tags";
|
|
50
|
+
readonly VARIANT_SELECTOR: "VariantSelector";
|
|
51
|
+
};
|
|
52
|
+
export type BlockKey = (typeof BLOCK_KEYS)[keyof typeof BLOCK_KEYS];
|
|
53
|
+
export type FieldType = (typeof FIELD_TYPES)[keyof typeof FIELD_TYPES];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import CategoryListDto, { AddValueRequest } from "../types/categoryList";
|
|
1
|
+
import CategoryListDto, { AddValueRequest, CategoryListValueDto } from "../types/categoryList";
|
|
2
2
|
declare class CategoryListsController {
|
|
3
3
|
/**
|
|
4
4
|
* Get all category lists for the authenticated user's company.
|
|
@@ -75,11 +75,20 @@ declare class CategoryListsController {
|
|
|
75
75
|
/**
|
|
76
76
|
* Update values in a category list.
|
|
77
77
|
* @param {string} id - The category list ID.
|
|
78
|
-
* @param {Record<string, string>} values - The values to update.
|
|
78
|
+
* @param {Record<string, CategoryListDto["values"][string]>} values - The values to update.
|
|
79
79
|
* @param {string | null} authToken - Optional auth token.
|
|
80
80
|
* @returns {Promise<CategoryListDto>} - The updated category list data.
|
|
81
81
|
*/
|
|
82
|
-
updateValues(id: string, values: Record<string, string>, authToken?: string | null): Promise<CategoryListDto>;
|
|
82
|
+
updateValues(id: string, values: Record<string, CategoryListDto["values"][string]>, authToken?: string | null): Promise<CategoryListDto>;
|
|
83
|
+
/**
|
|
84
|
+
* Update a single value in a category list.
|
|
85
|
+
* @param {string} id - The category list ID.
|
|
86
|
+
* @param {string} key - The value key to update.
|
|
87
|
+
* @param {CategoryListValueDto} value - The value payload.
|
|
88
|
+
* @param {string | null} authToken - Optional auth token.
|
|
89
|
+
* @returns {Promise<CategoryListDto>} - The updated category list data.
|
|
90
|
+
*/
|
|
91
|
+
updateValue(id: string, key: string, value: CategoryListValueDto, authToken?: string | null): Promise<CategoryListDto>;
|
|
83
92
|
}
|
|
84
93
|
declare const _default: CategoryListsController;
|
|
85
94
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Block from "../../types/content/block";
|
|
2
|
+
import { BlockUpdateImpact, BlockFieldMigration } from "../../types/content/blockUpdateImpact";
|
|
2
3
|
declare class BlocksController {
|
|
3
4
|
/**
|
|
4
5
|
* Get all blocks for the current company.
|
|
@@ -28,6 +29,15 @@ declare class BlocksController {
|
|
|
28
29
|
* @returns {Promise<void>} - No return value.
|
|
29
30
|
*/
|
|
30
31
|
updateBlock(id: string, block: Block, authToken?: string | null): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Update an existing block and apply optional field migrations.
|
|
34
|
+
* Backward compatible with the legacy PUT body.
|
|
35
|
+
*/
|
|
36
|
+
updateBlockWithMigrations(id: string, block: Block, fieldMigrations?: BlockFieldMigration[], authToken?: string | null): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Preview the impact of updating a block definition before saving it.
|
|
39
|
+
*/
|
|
40
|
+
previewBlockUpdate(id: string, block: Block, authToken?: string | null): Promise<BlockUpdateImpact>;
|
|
31
41
|
/**
|
|
32
42
|
* Delete an existing block.
|
|
33
43
|
* @param {string} id - The block ID to delete.
|
|
@@ -3,6 +3,12 @@ import { type JobListing } from "../types/JobListing";
|
|
|
3
3
|
* Controller for handling job listing API requests.
|
|
4
4
|
*/
|
|
5
5
|
declare class JobListingsController {
|
|
6
|
+
updateFieldVersionApproval(id: string, payload: {
|
|
7
|
+
fieldPath: string;
|
|
8
|
+
timestamp?: string;
|
|
9
|
+
listingVersionNumber?: number;
|
|
10
|
+
needsApproval: boolean;
|
|
11
|
+
}, authToken?: string | null): Promise<void>;
|
|
6
12
|
/**
|
|
7
13
|
* [GET /joblistings]
|
|
8
14
|
* Get all job listings for the authenticated user's company.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeToCamelCase: <T>(value: T) => T;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t,this.isLocalhost=!1}getAuthToken(){return this.isLocalhost?sessionStorage.getItem("token"):null}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"GET",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"POST",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"PUT",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}patch(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){this.isLocalhost&&n&&!r&&(r=this.getAuthToken());const o=i,s={method:"PATCH",credentials:r?"omit":"include",headers:Object.assign(Object.assign({},r?{Authorization:`Bearer ${r}`}:{}),o?{}:{"Content-Type":"application/json"}),body:o?this.convertToFormData(e):JSON.stringify(e)};return n?this.fetchWithAuth(t,s,r):this.fetchWithoutAuth(t,s)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){this.isLocalhost&&e&&!n&&(n=this.getAuthToken());const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File?e.append(n||"file",t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t.toString()):Array.isArray(t)?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):"object"==typeof t&&null!==t&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}.${r}`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r?(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}),n.credentials="omit"):n.credentials="include";let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};this.isLocalhost&&(r=this.getAuthToken())&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`})),t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}if(204===e.status||205===e.status)return null;const t=yield e.text();if(!t)return null;try{return JSON.parse(t)}catch(e){return t}}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){if(!this.isLocalhost){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}{const t=sessionStorage.getItem("refreshToken");if(!t)return!1;const e=yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(!e.ok)return console.error("Failed to refresh token"),!1;try{const t=yield e.json();return t.token&&sessionStorage.setItem("token",t.token),t.refreshToken&&sessionStorage.setItem("refreshToken",t.refreshToken),!0}catch(t){return console.error("Failed to parse refresh token response:",t),!1}}}))}}const n=process.env.NEXT_PUBLIC_API_URL||process.env.VITE_API_URL||process.env.REACT_APP_API_URL||"https://api.myhirecontrol.com",r=new e(n),i="undefined"!=typeof window&&"localhost"===window.location.hostname;var o=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/nextLogin"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/refresh"+(i?"?localhost=true":""),e=yield r.post(t,{},!0);return e&&i&&(sessionStorage.setItem("token",e.token),sessionStorage.setItem("refreshToken",e.refreshToken),sessionStorage.setItem("expiration",e.expiration)),e}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/changeCompany"+(i?"?localhost=true":"");var n=yield r.post(t,e,!0);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.get("/auth/authenticated",!0);return t||(yield this.tryRefreshAndCheckAuth())}catch(t){return yield this.tryRefreshAndCheckAuth()}}))}tryRefreshAndCheckAuth(){return t.__awaiter(this,void 0,void 0,(function*(){try{yield this.refreshToken();return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const s=new e(n);var a=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return s.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/details/${t}`,!0,e)}))}getListingEvents(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/listingEvents/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return s.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.delete(`/events/${t}`,!0,e)}))}};const u=new e(n);var l=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return u.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return u.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.delete(`/roles/${t}`,!0,e)}))}};const d=new e(n);var c=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield d.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield d.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield d.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield d.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const g=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield g.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var _=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield p.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var v=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var y=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const m=new e(n);var C=new class{getSearchReadConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield m.get("/integrationconfig/search-read",!0,t)}catch(t){if(404===(null==t?void 0:t.statusCode)||204===(null==t?void 0:t.statusCode))return null;throw t}}))}};const b=new e(n);var A=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield b.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 b.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const S=new e(n);var $=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.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 S.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 S.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const L=new e(n);var F=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return L.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return L.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/filters/${t}`,!0,e)}))}};const k=new e(n);var T=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return k.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return k.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.delete(`/appendListings/${t}`,!0,e)}))}};const B=new e(n);var x=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return B.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return B.put(`/forms/${t}`,e,!0,n)}))}updateFormWithFieldRenames(e,n,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,n,r=null){return B.put(`/forms/${t}`,Object.assign(Object.assign({},e),n),!0,r)}))}getFormSubmissionCount(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.get(`/forms/${t}/submission-count`,!0,e)}))}getFormSubmissionFieldUsage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.get(`/forms/${t}/submission-fields`,!0,e)}))}migrateSubmissionFields(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return B.post(`/forms/${t}/migrate-submission-fields`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return B.post("/forms/jsonSchema",t,!0,e)}))}};const j=new e(n);var I=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,a=null){const u=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&u.append("status",r.toString()),n&&u.append("type",n),i&&u.append("from",i.toISOString()),o&&u.append("to",o.toISOString()),s&&s.length>0&&s.forEach((t=>u.append("columns",t)));const l=yield j.getFile(`/formsubmission/export-csv?${u.toString()}`,!0,a),d=window.URL.createObjectURL(l),c=document.createElement("a");c.href=d,c.download="HireControl_Form_Submissions.csv",document.body.appendChild(c),c.click(),window.URL.revokeObjectURL(d),document.body.removeChild(c)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return j.get("/formsubmission/types",!0,t)}))}};const E=new e(n);var R=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 M=new e(n);var P=new class{getJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return M.get("/joblistings",!0,t)}))}getMapJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){return e?M.get(`/joblistings/MapListings?filterId=${e}`,!0,t):M.get("/joblistings/MapListings",!0,t)}))}getJobListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.get(`/joblistings/${t}`,!0,e)}))}getMapListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.get(`/joblistings/MapListings/${t}`,!0,e)}))}createJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.post("/joblistings",t,!0,e)}))}updateJobListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return M.put(`/joblistings/${t}`,e,!0,n)}))}exportJobListingsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=10,e=1,n=null,r=null,i=null,o=null){const s=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});n&&s.append("status",n.toString()),r&&s.append("from",r.toISOString()),i&&s.append("to",i.toISOString());const a=yield M.getFile(`/joblistings/Export-csv?${s.toString()}`,!0,o),u=window.URL.createObjectURL(a),l=document.createElement("a");l.href=u,l.download="job_listings.csv",document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(u),document.body.removeChild(l)}))}deleteJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.delete(`/joblistings/${t}`,!0,e)}))}};const U=new e(n);var O=new class{getBlogs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return U.get("/blog",!0,t)}))}getBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return U.get(`/blog/${t}`,!0,e)}))}createBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return U.post("/blog",t,!0,e)}))}updateBlog(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return U.put(`/blog/${t}`,e,!0,n)}))}deleteBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return U.delete(`/blog/${t}`,!0,e)}))}};const W=new e(n);var J=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 W.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 W.get(`/categories/${t}${i}`,!0,n)}))}};const V=new e(n);var N=new class{getAllCategoryLists(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return V.get("/categorylist",!0,t)}))}getCategoryListById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/categorylist/${t}`,!0,e)}))}getCategoryListsByType(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/categorylist/type/${t}`,!0,e)}))}getActiveCategoryLists(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return V.get("/categorylist/active",!0,t)}))}getCategoryListByTypeAndName(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.get(`/categorylist/type/${t}/name/${e}`,!0,n)}))}createCategoryList(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.post("/categorylist",t,!0,e)}))}updateCategoryList(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.put(`/categorylist/${t}`,e,!0,n)}))}deleteCategoryList(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.delete(`/categorylist/${t}`,!0,e)}))}addValue(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.post(`/categorylist/${t}/values`,e,!0,n)}))}removeValue(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.delete(`/categorylist/${t}/values/${e}`,!0,n)}))}updateValues(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.put(`/categorylist/${t}/values`,e,!0,n)}))}};const D=new e(n);var H=new class{getByFeed(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.get(`/jobFeedFieldMappings/feed/${t}`,!0,e)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.get(`/jobFeedFieldMappings/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.post("/jobFeedFieldMappings",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return D.put(`/jobFeedFieldMappings/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.delete(`/jobFeedFieldMappings/${t}`,!0,e)}))}toggleActive(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.post("/jobFeedFieldMappings/toggle-active",t,!0,e)}))}discoverFields(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.get(`/jobFeedFieldMappings/discover-fields/${t}`,!0,e)}))}validate(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return D.get(`/jobFeedFieldMappings/validate/${t}`,!0,e)}))}};const z=new e(n);var q=new class{getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return z.get("/jobfeeds",!0,t)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return z.get(`/jobfeeds/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return z.post("/jobfeeds",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return z.put(`/jobfeeds/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return z.delete(`/jobfeeds/${t}`,!0,e)}))}sync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return z.post(`/jobfeeds/${t}/sync`,{},!0,e)}))}toggleActive(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return z.patch(`/jobfeeds/${t}/toggle-active`,e,!0,n)}))}};const G=new e(n);var K=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.get("/jobListingSettings",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return G.post("/jobListingSettings",t,!0,e)}))}delete(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.delete("/jobListingSettings",!0,t)}))}};const X=new e(n);var Q=new class{getAllSql(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;return e&&r.append("origin",e),X.post("/listingEntities"+(r.toString()?"?"+r.toString():""),t,!0,n)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return X.get("/listingEntities",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return X.post("/listingEntities/create",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){yield X.put(`/listingEntities/update/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){yield X.delete(`/listingEntities/delete/${t}`,!0,e)}))}};const Y=new e(n);var Z=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 Y.get(`/recruiters${r}`,!0,e)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return Y.get("/recruiters/all",!0,t)}))}sync(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return Y.post("/recruiters/sync",{},!0,t)}))}};const tt=new e(n);var et=new class{getFieldTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return tt.get("/field/types",!0,t)}))}};const nt=new e(n);var rt=new class{getValidatorTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return nt.get("/validator/types",!0,t)}))}};const it=new e(n);var ot=new class{getContentEntries(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){let r=`/contententry?contentId=${t}`;return null!==e&&(r+=`&statusFilter=${e}`),it.get(r,!0,n)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){let r=`/contententry/${t}`;return null!==e&&(r+=`?statusFilter=${e}`),it.get(r,!0,n)}))}createContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.post("/contententry",t,!0,e)}))}updateContentEntry(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return it.put(`/contententry/${t}`,e,!0,n)}))}deleteContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.delete(`/contententry/${t}`,!0,e)}))}getVersions(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.get(`/contententry/${t}/versions`,!0,e)}))}unpublishAll(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return it.post(`/contententry/${t}/unpublish`,void 0,!0,e)}))}};const st=new e(n);var at=new class{getBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return st.get("/block",!0,t)}))}getBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.get(`/block/${t}`,!0,e)}))}createBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.post("/block",t,!0,e)}))}updateBlock(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return st.put(`/block/${t}`,e,!0,n)}))}deleteBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.delete(`/block/${t}`,!0,e)}))}getTemplateBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return st.get("/block/template-blocks",!0,t)}))}};const ut=new e(n);var lt=new class{getModels(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return ut.get("/model",!0,t)}))}getModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ut.get(`/model/${t}`,!0,e)}))}createModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ut.post("/model",t,!0,e)}))}updateModel(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return ut.put(`/model/${t}`,e,!0,n)}))}deleteModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ut.delete(`/model/${t}`,!0,e)}))}previewSync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ut.get(`/model/${t}/sync/preview`,!0,e)}))}executeSync(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return ut.post(`/model/${t}/sync`,e,!0,n)}))}};const dt=new e(n);var ct,gt,ht,pt,_t=new class{getCompletion(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return dt.post("/openai/completion",t,!0,e)}))}};exports.EventType=void 0,(ct=exports.EventType||(exports.EventType={}))[ct.Virtual=0]="Virtual",ct[ct.InPerson=1]="InPerson",ct[ct.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(gt=exports.CallToActionType||(exports.CallToActionType={}))[gt.Button=0]="Button",gt[gt.Link=1]="Link",gt[gt.Download=2]="Download",gt[gt.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(ht=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[ht.Submitted=1]="Submitted",ht[ht.Hold=2]="Hold",ht[ht.Rejected=3]="Rejected",ht[ht.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(pt=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[pt.Replace=0]="Replace",pt[pt.Append=1]="Append",pt[pt.Custom=2]="Custom";const ft={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},vt={getAll:a.getEvents,get:a.getEvent,getBySlug:a.getEventBySlug,create:a.createEvent,update:a.updateEvent,delete:a.deleteEvent},wt={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},yt=c,mt=A,Ct={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},bt={get:_.getMapConfig,update:_.updateMapConfig,create:_.createMapConfig},At={get:y.getClientAuthConfigById,getAll:y.getAllClientAuthConfigs,update:y.updateClientAuthConfig,create:y.createClientAuthConfig,delete:y.deleteClientAuthConfig},St={getSearchRead:C.getSearchReadConfig},$t={upload:$.uploadMedia,uploadProfileImage:$.uploadProfileImage,get:$.listMedia,delete:$.deleteMedia},Lt={getList:F.getFilters,get:F.getFilter,update:F.updateFilter,create:F.createFilter,delete:F.deleteFilter},Ft={get:T.getAppendListings,getAppendListing:T.getAppendListing,create:T.createAppendListing,update:T.updateAppendListing,delete:T.deleteAppendListing},kt={getAll:O.getBlogs,getById:O.getBlog,create:O.createBlog,update:O.updateBlog,delete:O.deleteBlog},Tt={get:J.getCategories,getByCompany:J.getCategoriesByCompany},Bt={getAll:N.getAllCategoryLists,getById:N.getCategoryListById,getByType:N.getCategoryListsByType,getActive:N.getActiveCategoryLists,getByTypeAndName:N.getCategoryListByTypeAndName,create:N.createCategoryList,update:N.updateCategoryList,delete:N.deleteCategoryList,addValue:N.addValue,removeValue:N.removeValue,updateValues:N.updateValues},xt={getByFeed:H.getByFeed,get:H.get,create:H.create,update:H.update,delete:H.delete,toggleActive:H.toggleActive,discoverFields:H.discoverFields,validate:H.validate},jt={getAll:q.getAll,getById:q.get,create:q.create,update:q.update,delete:q.delete,sync:q.sync,toggleActive:q.toggleActive},It={get:K.get,create:K.create,delete:K.delete},Et={create:Q.create,get:Q.getAll,update:Q.update,delete:Q.delete,getAllSql:Q.getAllSql},Rt={get:Z.get,getAll:Z.getAll,sync:Z.sync},Mt={get:v.getAllPermissions},Pt={getAll:R.getCompanies,getById:R.getCompany,create:R.createCompany,update:R.updateCompany,delete:R.deleteCompany,sync:R.syncAllCompanies},Ut={getAll:P.getJobListingsByCompany,getMapListings:P.getMapJobListingsByCompany,getMapListing:P.getMapListingById,getById:P.getJobListingById,create:P.createJobListing,update:P.updateJobListing,delete:P.deleteJobListing},Ot={getTypes:et.getFieldTypes},Wt={getTypes:rt.getValidatorTypes},Jt={getAll:ot.getContentEntries,getById:ot.getContentEntry,create:ot.createContentEntry,update:ot.updateContentEntry,delete:ot.deleteContentEntry,unpublish:ot.unpublishAll},Vt={getAll:at.getBlocks,getById:at.getBlock,create:at.createBlock,update:at.updateBlock,delete:at.deleteBlock,getTemplateBlocks:at.getTemplateBlocks},Nt={getAll:lt.getModels,getById:lt.getModel,create:lt.createModel,update:lt.updateModel,delete:lt.deleteModel,previewSync:lt.previewSync,executeSync:lt.executeSync},Dt={getCompletion:_t.getCompletion},Ht=x,zt=I,qt={auth:ft,events:vt,roles:wt,users:yt,account:Ct,mapConfig:bt,permissions:Mt,clientAuthConfig:At,integrationConfig:St,filters:Lt,listings:mt,media:$t,appendListings:Ft,blogs:kt,categories:Tt,categoryLists:Bt,jobFeedFieldMappings:xt,jobFeeds:jt,jobListingSettings:It,listingEntities:Et,recruiters:Rt,forms:Ht,formSubmissions:zt,openAI:Dt,companies:Pt,jobListings:Ut};exports.account=Ct,exports.appendListings=Ft,exports.auth=ft,exports.blogs=kt,exports.categories=Tt,exports.categoryLists=Bt,exports.clientAuthConfig=At,exports.companies=Pt,exports.contentBlocks=Vt,exports.contentEntries=Jt,exports.contentField=Ot,exports.contentValidator=Wt,exports.default=qt,exports.events=vt,exports.filters=Lt,exports.formSubmissions=zt,exports.forms=Ht,exports.integrationConfig=St,exports.jobFeedFieldMappings=xt,exports.jobFeeds=jt,exports.jobListingSettings=It,exports.jobListings=Ut,exports.listingEntities=Et,exports.listings=mt,exports.mapConfig=bt,exports.media=$t,exports.model=Nt,exports.openAI=Dt,exports.permissions=Mt,exports.recruiters=Rt,exports.roles=wt,exports.users=yt;
|
|
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}}if(204===e.status||205===e.status)return null;const t=yield e.text();if(!t)return null;try{return JSON.parse(t)}catch(e){return t}}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){if(!this.isLocalhost){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}{const t=sessionStorage.getItem("refreshToken");if(!t)return!1;const e=yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(!e.ok)return console.error("Failed to refresh token"),!1;try{const t=yield e.json();return t.token&&sessionStorage.setItem("token",t.token),t.refreshToken&&sessionStorage.setItem("refreshToken",t.refreshToken),!0}catch(t){return console.error("Failed to parse refresh token response:",t),!1}}}))}}const n=process.env.NEXT_PUBLIC_API_URL||process.env.VITE_API_URL||process.env.REACT_APP_API_URL||"https://api.myhirecontrol.com",r=new e(n),i="undefined"!=typeof window&&"localhost"===window.location.hostname;var o=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/nextLogin"+(i?"?localhost=true":""),n=yield r.post(t,e,!1);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/refresh"+(i?"?localhost=true":""),e=yield r.post(t,{},!0);return e&&i&&(sessionStorage.setItem("token",e.token),sessionStorage.setItem("refreshToken",e.refreshToken),sessionStorage.setItem("expiration",e.expiration)),e}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){const t="/auth/changeCompany"+(i?"?localhost=true":"");var n=yield r.post(t,e,!0);return n&&(sessionStorage.setItem("token",n.token),sessionStorage.setItem("refreshToken",n.refreshToken),sessionStorage.setItem("expiration",n.expiration)),n}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.get("/auth/authenticated",!0);return t||(yield this.tryRefreshAndCheckAuth())}catch(t){return yield this.tryRefreshAndCheckAuth()}}))}tryRefreshAndCheckAuth(){return t.__awaiter(this,void 0,void 0,(function*(){try{yield this.refreshToken();return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const s=new e(n);var a=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return s.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/events/details/${t}`,!0,e)}))}getListingEvents(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.get(`/listingEvents/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return s.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return s.delete(`/events/${t}`,!0,e)}))}};const u=new e(n);var l=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return u.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return u.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return u.delete(`/roles/${t}`,!0,e)}))}};const c=new e(n);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield c.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.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 c.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 c.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 c.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield c.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const g=new e(n);var p=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield g.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield g.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const h=new e(n);var _=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield h.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return h.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return h.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var v=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var y=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const m=new e(n);var C=new class{getSearchReadConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield m.get("/integrationconfig/search-read",!0,t)}catch(t){if(404===(null==t?void 0:t.statusCode)||204===(null==t?void 0:t.statusCode))return null;throw t}}))}};const L=new e(n);var A=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield L.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 L.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const S=new e(n);var T=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.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 S.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 S.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const b=new e(n);var E=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return b.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return b.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.delete(`/filters/${t}`,!0,e)}))}};const $=new e(n);var I=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 R=new e(n);var F=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return R.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.put(`/forms/${t}`,e,!0,n)}))}updateFormWithFieldRenames(e,n,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,n,r=null){return R.put(`/forms/${t}`,Object.assign(Object.assign({},e),n),!0,r)}))}getFormSubmissionCount(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/forms/${t}/submission-count`,!0,e)}))}getFormSubmissionFieldUsage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.get(`/forms/${t}/submission-fields`,!0,e)}))}migrateSubmissionFields(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return R.post(`/forms/${t}/migrate-submission-fields`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return R.post("/forms/jsonSchema",t,!0,e)}))}};const k=new e(n);var B=new class{submitContactForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.post("/contactForm",t,!0,e,!0)}))}submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return k.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()),k.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null,a=null){const u=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&u.append("status",r.toString()),n&&u.append("type",n),i&&u.append("from",i.toISOString()),o&&u.append("to",o.toISOString()),s&&s.length>0&&s.forEach((t=>u.append("columns",t)));const l=yield k.getFile(`/formsubmission/export-csv?${u.toString()}`,!0,a),c=window.URL.createObjectURL(l),d=document.createElement("a");d.href=c,d.download="HireControl_Form_Submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(c),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return k.get("/formsubmission/types",!0,t)}))}};const O=new e(n);var x=new class{getCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return O.get("/companies",!0,t)}))}getCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return O.get(`/companies/${t}`,!0,e)}))}createCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return O.post("/companies",t,!0,e)}))}updateCompany(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return O.put(`/companies/${t}`,e,!0,n)}))}deleteCompany(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return O.delete(`/companies/${t}`,!0,e)}))}syncAllCompanies(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return O.get("/companies/syncall",!0,t)}))}};const M=new e(n);var j=new class{updateFieldVersionApproval(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return M.patch(`/joblistings/${t}/field-version-approval`,e,!0,n)}))}getJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return M.get("/joblistings",!0,t)}))}getMapJobListingsByCompany(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){return e?M.get(`/joblistings/MapListings?filterId=${e}`,!0,t):M.get("/joblistings/MapListings",!0,t)}))}getJobListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.get(`/joblistings/${t}`,!0,e)}))}getMapListingById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.get(`/joblistings/MapListings/${t}`,!0,e)}))}createJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.post("/joblistings",t,!0,e)}))}updateJobListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return M.put(`/joblistings/${t}`,e,!0,n)}))}exportJobListingsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=10,e=1,n=null,r=null,i=null,o=null){const s=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});n&&s.append("status",n.toString()),r&&s.append("from",r.toISOString()),i&&s.append("to",i.toISOString());const a=yield M.getFile(`/joblistings/Export-csv?${s.toString()}`,!0,o),u=window.URL.createObjectURL(a),l=document.createElement("a");l.href=u,l.download="job_listings.csv",document.body.appendChild(l),l.click(),window.URL.revokeObjectURL(u),document.body.removeChild(l)}))}deleteJobListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return M.delete(`/joblistings/${t}`,!0,e)}))}};const U=new e(n);var N=new class{getBlogs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return U.get("/blog",!0,t)}))}getBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return U.get(`/blog/${t}`,!0,e)}))}createBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return U.post("/blog",t,!0,e)}))}updateBlog(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return U.put(`/blog/${t}`,e,!0,n)}))}deleteBlog(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return U.delete(`/blog/${t}`,!0,e)}))}};const P=new e(n);var D=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 P.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 P.get(`/categories/${t}${i}`,!0,n)}))}};const V=new e(n);var W=new class{getAllCategoryLists(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return V.get("/categorylist",!0,t)}))}getCategoryListById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/categorylist/${t}`,!0,e)}))}getCategoryListsByType(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.get(`/categorylist/type/${t}`,!0,e)}))}getActiveCategoryLists(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return V.get("/categorylist/active",!0,t)}))}getCategoryListByTypeAndName(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.get(`/categorylist/type/${t}/name/${e}`,!0,n)}))}createCategoryList(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.post("/categorylist",t,!0,e)}))}updateCategoryList(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.put(`/categorylist/${t}`,e,!0,n)}))}deleteCategoryList(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return V.delete(`/categorylist/${t}`,!0,e)}))}addValue(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.post(`/categorylist/${t}/values`,e,!0,n)}))}removeValue(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.delete(`/categorylist/${t}/values/${e}`,!0,n)}))}updateValues(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return V.put(`/categorylist/${t}/values`,e,!0,n)}))}updateValue(e,n,r){return t.__awaiter(this,arguments,void 0,(function*(t,e,n,r=null){return V.put(`/categorylist/${t}/values/${encodeURIComponent(e)}`,n,!0,r)}))}};const J=new e(n);var H=new class{getByFeed(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return J.get(`/jobFeedFieldMappings/feed/${t}`,!0,e)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return J.get(`/jobFeedFieldMappings/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return J.post("/jobFeedFieldMappings",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return J.put(`/jobFeedFieldMappings/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return J.delete(`/jobFeedFieldMappings/${t}`,!0,e)}))}toggleActive(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return J.post("/jobFeedFieldMappings/toggle-active",t,!0,e)}))}discoverFields(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return J.get(`/jobFeedFieldMappings/discover-fields/${t}`,!0,e)}))}validate(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return J.get(`/jobFeedFieldMappings/validate/${t}`,!0,e)}))}};const G=new e(n);var z=new class{getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return G.get("/jobfeeds",!0,t)}))}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return G.get(`/jobfeeds/${t}`,!0,e)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return G.post("/jobfeeds",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return G.put(`/jobfeeds/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return G.delete(`/jobfeeds/${t}`,!0,e)}))}sync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return G.post(`/jobfeeds/${t}/sync`,{},!0,e)}))}toggleActive(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return G.patch(`/jobfeeds/${t}/toggle-active`,e,!0,n)}))}};const K=new e(n);var X=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return K.get("/jobListingSettings",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return K.post("/jobListingSettings",t,!0,e)}))}delete(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return K.delete("/jobListingSettings",!0,t)}))}};const q=new e(n);var Y=new class{getAllSql(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){const r=new URLSearchParams;return e&&r.append("origin",e),q.post("/listingEntities"+(r.toString()?"?"+r.toString():""),t,!0,n)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return q.get("/listingEntities",!0,t)}))}create(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return q.post("/listingEntities/create",t,!0,e)}))}update(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){yield q.put(`/listingEntities/update/${t}`,e,!0,n)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){yield q.delete(`/listingEntities/delete/${t}`,!0,e)}))}};const Z=new e(n);var Q=new class{get(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){const n=new URLSearchParams;t&&t.forEach((t=>n.append("recruiterIds",t.toString())));const r=n.toString()?`?${n.toString()}`:"";return Z.get(`/recruiters${r}`,!0,e)}))}getAll(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return Z.get("/recruiters/all",!0,t)}))}sync(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return Z.post("/recruiters/sync",{},!0,t)}))}};const tt=new e(n);var et=new class{getFieldTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return tt.get("/field/types",!0,t)}))}};const nt=new e(n);var rt=new class{getValidatorTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return nt.get("/validator/types",!0,t)}))}};const it=t=>t?/^[a-z][a-zA-Z0-9]*$/.test(t)?t:t.replace(/[^a-zA-Z0-9]+/g," ").trim().toLowerCase().replace(/\s+(.)/g,((t,e)=>e.toUpperCase())).replace(/\s/g,"").replace(/^(.)/,((t,e)=>e.toLowerCase())):t,ot=t=>{if(Array.isArray(t))return t.map((t=>ot(t)));if(!(t=>null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype)(t))return t;const e={};for(const[n,r]of Object.entries(t))e[it(n)]=ot(r);return e},st=new e(n);var at=new class{getContentEntries(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){let r=`/contententry?contentId=${t}`;null!==e&&(r+=`&statusFilter=${e}`);const i=yield st.get(r,!0,n);return ot(i)}))}getContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null,n=null){let r=`/contententry/${t}`;null!==e&&(r+=`?statusFilter=${e}`);const i=yield st.get(r,!0,n);return ot(i)}))}createContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=yield st.post("/contententry",t,!0,e);return ot(n)}))}updateContentEntry(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return st.put(`/contententry/${t}`,e,!0,n)}))}deleteContentEntry(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.delete(`/contententry/${t}`,!0,e)}))}getVersions(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=yield st.get(`/contententry/${t}/versions`,!0,e);return ot(n)}))}unpublishAll(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return st.post(`/contententry/${t}/unpublish`,void 0,!0,e)}))}};const ut=new e(n);var lt=new class{getBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){const e=yield ut.get("/block",!0,t);return ot(e)}))}getBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=yield ut.get(`/block/${t}`,!0,e);return ot(n)}))}createBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=yield ut.post("/block",t,!0,e);return ot(n)}))}updateBlock(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return ut.put(`/block/${t}`,e,!0,n)}))}updateBlockWithMigrations(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=[],r=null){const i=n.length>0?{block:e,fieldMigrations:n}:e;return ut.put(`/block/${t}`,i,!0,r)}))}previewBlockUpdate(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){const r=yield ut.post(`/block/${t}/preview-update`,e,!0,n);return ot(r)}))}deleteBlock(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ut.delete(`/block/${t}`,!0,e)}))}getTemplateBlocks(){return t.__awaiter(this,arguments,void 0,(function*(t=null){const e=yield ut.get("/block/template-blocks",!0,t);return ot(e)}))}};const ct=new e(n);var dt=new class{getModels(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return ct.get("/model",!0,t)}))}getModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ct.get(`/model/${t}`,!0,e)}))}createModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ct.post("/model",t,!0,e)}))}updateModel(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return ct.put(`/model/${t}`,e,!0,n)}))}deleteModel(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ct.delete(`/model/${t}`,!0,e)}))}previewSync(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return ct.get(`/model/${t}/sync/preview`,!0,e)}))}executeSync(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return ct.post(`/model/${t}/sync`,e,!0,n)}))}};const gt=new e(n);var pt,ht,_t,ft,vt=new class{getCompletion(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return gt.post("/openai/completion",t,!0,e)}))}};exports.EventType=void 0,(pt=exports.EventType||(exports.EventType={}))[pt.Virtual=0]="Virtual",pt[pt.InPerson=1]="InPerson",pt[pt.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(ht=exports.CallToActionType||(exports.CallToActionType={}))[ht.Button=0]="Button",ht[ht.Link=1]="Link",ht[ht.Download=2]="Download",ht[ht.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(_t=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[_t.Submitted=1]="Submitted",_t[_t.Hold=2]="Hold",_t[_t.Rejected=3]="Rejected",_t[_t.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(ft=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[ft.Replace=0]="Replace",ft[ft.Append=1]="Append",ft[ft.Custom=2]="Custom";const wt={HERO:"hero",VIDEO_BLOCK:"videoBlock",CONTENT_CARD:"contentCard",ICON_CARD:"iconCard",LIST:"list",CONTAINER:"container",ACCORDION:"accordion",TESTIMONIAL:"testimonial",LARGE_TITLE_BLOCK:"largeTitleBlock",BUTTON:"button",RECRUITER:"recruiter",BLOBS:"blobs",TITLE_MODULAR_CONTENT_COPY:"titleModularContentCopy",INTRO_WITH_CONTENT_CARD:"introWithContentCard",CALLOUT_CARD:"calloutCard"},yt={"testimonial-block":wt.TESTIMONIAL,"button-block":wt.BUTTON,"recruiter-block":wt.RECRUITER},mt={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},Lt={get:l.getAllRolesWithClaims,create:l.addRole,update:l.updateRole,delete:l.deleteRole},At=d,St=A,Tt={resetPassword:p.resetPassword,resetPasswordWithToken:p.resetPasswordWithToken,forgotPassword:p.forgotPassword},bt={get:_.getMapConfig,update:_.updateMapConfig,create:_.createMapConfig},Et={get:y.getClientAuthConfigById,getAll:y.getAllClientAuthConfigs,update:y.updateClientAuthConfig,create:y.createClientAuthConfig,delete:y.deleteClientAuthConfig},$t={getSearchRead:C.getSearchReadConfig},It={upload:T.uploadMedia,uploadProfileImage:T.uploadProfileImage,get:T.listMedia,delete:T.deleteMedia},Rt={getList:E.getFilters,get:E.getFilter,update:E.updateFilter,create:E.createFilter,delete:E.deleteFilter},Ft={get:I.getAppendListings,getAppendListing:I.getAppendListing,create:I.createAppendListing,update:I.updateAppendListing,delete:I.deleteAppendListing},kt={getAll:N.getBlogs,getById:N.getBlog,create:N.createBlog,update:N.updateBlog,delete:N.deleteBlog},Bt={get:D.getCategories,getByCompany:D.getCategoriesByCompany},Ot={getAll:W.getAllCategoryLists,getById:W.getCategoryListById,getByType:W.getCategoryListsByType,getActive:W.getActiveCategoryLists,getByTypeAndName:W.getCategoryListByTypeAndName,create:W.createCategoryList,update:W.updateCategoryList,delete:W.deleteCategoryList,addValue:W.addValue,removeValue:W.removeValue,updateValue:W.updateValue,updateValues:W.updateValues},xt={getByFeed:H.getByFeed,get:H.get,create:H.create,update:H.update,delete:H.delete,toggleActive:H.toggleActive,discoverFields:H.discoverFields,validate:H.validate},Mt={getAll:z.getAll,getById:z.get,create:z.create,update:z.update,delete:z.delete,sync:z.sync,toggleActive:z.toggleActive},jt={get:X.get,create:X.create,delete:X.delete},Ut={create:Y.create,get:Y.getAll,update:Y.update,delete:Y.delete,getAllSql:Y.getAllSql},Nt={get:Q.get,getAll:Q.getAll,sync:Q.sync},Pt={get:v.getAllPermissions},Dt={getAll:x.getCompanies,getById:x.getCompany,create:x.createCompany,update:x.updateCompany,delete:x.deleteCompany,sync:x.syncAllCompanies},Vt={getAll:j.getJobListingsByCompany,getMapListings:j.getMapJobListingsByCompany,getMapListing:j.getMapListingById,getById:j.getJobListingById,updateFieldVersionApproval:j.updateFieldVersionApproval,create:j.createJobListing,update:j.updateJobListing,delete:j.deleteJobListing},Wt={getTypes:et.getFieldTypes},Jt={getTypes:rt.getValidatorTypes},Ht={getAll:at.getContentEntries,getById:at.getContentEntry,create:at.createContentEntry,update:at.updateContentEntry,delete:at.deleteContentEntry,unpublish:at.unpublishAll},Gt={getAll:lt.getBlocks,getById:lt.getBlock,create:lt.createBlock,update:lt.updateBlock,updateWithMigrations:lt.updateBlockWithMigrations,previewUpdate:lt.previewBlockUpdate,delete:lt.deleteBlock,getTemplateBlocks:lt.getTemplateBlocks},zt={getAll:dt.getModels,getById:dt.getModel,create:dt.createModel,update:dt.updateModel,delete:dt.deleteModel,previewSync:dt.previewSync,executeSync:dt.executeSync},Kt={getCompletion:vt.getCompletion},Xt=F,qt=B,Yt={auth:mt,events:Ct,roles:Lt,users:At,account:Tt,mapConfig:bt,permissions:Pt,clientAuthConfig:Et,integrationConfig:$t,filters:Rt,listings:St,media:It,appendListings:Ft,blogs:kt,categories:Bt,categoryLists:Ot,jobFeedFieldMappings:xt,jobFeeds:Mt,jobListingSettings:jt,listingEntities:Ut,recruiters:Nt,forms:Xt,formSubmissions:qt,openAI:Kt,companies:Dt,jobListings:Vt};exports.BLOCK_KEYS=wt,exports.BLOCK_KEY_ALIASES=yt,exports.FIELD_TYPES={SINGLE_LINE_STRING:"SingleLineString",MULTI_LINE_TEXT:"MultiLineText",MULTIPLE_PARAGRAPH_TEXT:"MultipleParagraphText",SLUG:"Slug",STRUCTURED_TEXT:"StructuredText",RICH_TEXT:"RichText",INTEGER_NUMBER:"IntegerNumber",FLOATING_POINT_NUMBER:"FloatingPointNumber",BOOLEAN:"Boolean",DATE:"Date",DATE_TIME:"DateTime",SINGLE_MEDIA:"SingleMedia",MEDIA_GALLERY:"MediaGallery",EXTERNAL_VIDEO:"ExternalVideo",COLOR:"Color",TAILWIND_COLOR_SELECTOR:"TailwindColorSelector",SINGLE_LINK:"SingleLink",MULTIPLE_LINKS:"MultipleLinks",LOCATION:"Location",JSON:"Json",SEO:"Seo",MODULAR_CONTENT:"ModularContent",SINGLE_BLOCK:"SingleBlock",JOB_FILTER:"JobFilter",FORM:"Form",SINGLE_CONTENT_REFERENCE:"SingleContentReference",MULTIPLE_CONTENT_REFERENCE:"MultipleContentReference",HIRE_CONTROL_MAP:"HireControlMap",RECRUITER_SELECTOR:"RecruiterSelector",TAGS:"Tags",VARIANT_SELECTOR:"VariantSelector"},exports.account=Tt,exports.appendListings=Ft,exports.auth=mt,exports.blogs=kt,exports.categories=Bt,exports.categoryLists=Ot,exports.clientAuthConfig=Et,exports.companies=Dt,exports.contentBlocks=Gt,exports.contentEntries=Ht,exports.contentField=Wt,exports.contentValidator=Jt,exports.default=Yt,exports.events=Ct,exports.filters=Rt,exports.formSubmissions=qt,exports.forms=Xt,exports.integrationConfig=$t,exports.jobFeedFieldMappings=xt,exports.jobFeeds=Mt,exports.jobListingSettings=jt,exports.jobListings=Vt,exports.listingEntities=Ut,exports.listings=St,exports.mapConfig=bt,exports.media=It,exports.model=zt,exports.openAI=Kt,exports.permissions=Pt,exports.recruiters=Nt,exports.roles=Lt,exports.users=At;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -20,8 +20,9 @@ import ValidatorDefinition from "./types/content/validatorDefinition";
|
|
|
20
20
|
import ContentModel, { ModuleConfig, ModuleFieldMapping, ModuleIdentityMapping, WebPageTemplate, WebPageTemplateSection, WebPageTemplateBlock, ContentModuleSyncPreview, ContentModuleSyncExecuteRequest, ContentModuleSyncExecuteResult } from "./types/content/model";
|
|
21
21
|
import ContentBlock from "./types/content/block";
|
|
22
22
|
import ContentEntry from "./types/content/contentEntry";
|
|
23
|
+
import { BlockUpdateImpact, BlockFieldChange, BlockFieldMigration } from "./types/content/blockUpdateImpact";
|
|
23
24
|
import Blog from "./types/blog";
|
|
24
|
-
import CategoryListDto, { AddValueRequest } from "./types/categoryList";
|
|
25
|
+
import CategoryListDto, { AddValueRequest, CategoryListValueDto } from "./types/categoryList";
|
|
25
26
|
import JobFeed from "./types/jobFeed";
|
|
26
27
|
import JobFeedFieldMapping, { MultipleFieldConfig, ConditionalConfig, ConditionalRule } from "./types/jobFeedFieldMapping";
|
|
27
28
|
import JobListingSettings, { FeedHandlingOption } from "./types/jobListingSettings";
|
|
@@ -30,6 +31,7 @@ import RecruiterDto from "./types/recruiter";
|
|
|
30
31
|
import FocalPoint from "./types/focalPoint";
|
|
31
32
|
import CompletionRequest, { CompletionResponse } from "./types/completionRequest";
|
|
32
33
|
import SearchReadConfig from "./types/searchReadConfig";
|
|
34
|
+
import { BLOCK_KEYS, BLOCK_KEY_ALIASES, FIELD_TYPES, type BlockKey, type FieldType } from "./constants/cms";
|
|
33
35
|
export declare const auth: {
|
|
34
36
|
login: (clientLogInRequest: import("./types/clientLoginRequest").default) => Promise<any>;
|
|
35
37
|
nextLogin: (credentials: import("./types/credentials").default) => Promise<any>;
|
|
@@ -126,7 +128,8 @@ export declare const categoryLists: {
|
|
|
126
128
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
127
129
|
addValue: (id: string, request: AddValueRequest, authToken?: string | null) => Promise<CategoryListDto>;
|
|
128
130
|
removeValue: (id: string, key: string, authToken?: string | null) => Promise<CategoryListDto>;
|
|
129
|
-
|
|
131
|
+
updateValue: (id: string, key: string, value: CategoryListValueDto, authToken?: string | null) => Promise<CategoryListDto>;
|
|
132
|
+
updateValues: (id: string, values: Record<string, CategoryListDto["values"][string]>, authToken?: string | null) => Promise<CategoryListDto>;
|
|
130
133
|
};
|
|
131
134
|
export declare const jobFeedFieldMappings: {
|
|
132
135
|
getByFeed: (feedId: string, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
|
|
@@ -180,6 +183,12 @@ export declare const jobListings: {
|
|
|
180
183
|
getMapListings: (authToken?: string | null, filterId?: string | null) => Promise<any[]>;
|
|
181
184
|
getMapListing: (id: string, authToken?: string | null) => Promise<any>;
|
|
182
185
|
getById: (id: string, authToken?: string | null) => Promise<JobListing>;
|
|
186
|
+
updateFieldVersionApproval: (id: string, payload: {
|
|
187
|
+
fieldPath: string;
|
|
188
|
+
timestamp?: string;
|
|
189
|
+
listingVersionNumber?: number;
|
|
190
|
+
needsApproval: boolean;
|
|
191
|
+
}, authToken?: string | null) => Promise<void>;
|
|
183
192
|
create: (jobListing: JobListing, authToken?: string | null) => Promise<JobListing>;
|
|
184
193
|
update: (id: string, jobListing: JobListing, authToken?: string | null) => Promise<void>;
|
|
185
194
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
@@ -203,6 +212,8 @@ export declare const contentBlocks: {
|
|
|
203
212
|
getById: (id: string, authToken?: string | null) => Promise<ContentBlock>;
|
|
204
213
|
create: (block: ContentBlock, authToken?: string | null) => Promise<ContentBlock>;
|
|
205
214
|
update: (id: string, block: ContentBlock, authToken?: string | null) => Promise<void>;
|
|
215
|
+
updateWithMigrations: (id: string, block: ContentBlock, fieldMigrations?: BlockFieldMigration[], authToken?: string | null) => Promise<void>;
|
|
216
|
+
previewUpdate: (id: string, block: ContentBlock, authToken?: string | null) => Promise<BlockUpdateImpact>;
|
|
206
217
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
207
218
|
getTemplateBlocks: (authToken?: string | null) => Promise<ContentBlock[]>;
|
|
208
219
|
};
|
|
@@ -237,7 +248,9 @@ export declare const formSubmissions: {
|
|
|
237
248
|
exportFormSubmissionsCsv(pageSize?: number, pageNumber?: number, type?: string | null, status?: FormSubmissionStatus | null, from?: Date | null, to?: Date | null, columns?: string[] | null, authToken?: string | null): Promise<void>;
|
|
238
249
|
getFormSubmissionTypes(authToken?: string | null): Promise<string[]>;
|
|
239
250
|
};
|
|
240
|
-
export
|
|
251
|
+
export { BLOCK_KEYS, BLOCK_KEY_ALIASES, FIELD_TYPES };
|
|
252
|
+
export type { Register, User, Role, HireControlConfig, ClientAuthConfig, Event, Listing, EventDates, EventDateType, EventInstance, MediaType, Filters, AppendListing, Form, FormFieldMigrationRequest, FormUpdateOptions, FormSubmission, ResultsWrapper, Company, JobListing, FieldTypeDefinition, ValidatorDefinition, ContentModel, ModuleConfig, ModuleFieldMapping, ModuleIdentityMapping, WebPageTemplate, WebPageTemplateSection, WebPageTemplateBlock, ContentModuleSyncPreview, ContentModuleSyncExecuteRequest, ContentModuleSyncExecuteResult, ContentBlock, BlockUpdateImpact, BlockFieldChange, BlockFieldMigration, ContentEntry, Blog, CategoryListDto, AddValueRequest, CategoryListValueDto, JobFeed, JobFeedFieldMapping, MultipleFieldConfig, ConditionalConfig, ConditionalRule, JobListingSettings, ListingEntityDto, RecruiterDto, FocalPoint, CompletionRequest, CompletionResponse, SearchReadConfig, };
|
|
253
|
+
export type { BlockKey, FieldType };
|
|
241
254
|
export { EventType, CallToActionType, FormSubmissionStatus, FeedHandlingOption, };
|
|
242
255
|
declare const hcApi: {
|
|
243
256
|
auth: {
|
|
@@ -339,7 +352,8 @@ declare const hcApi: {
|
|
|
339
352
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
340
353
|
addValue: (id: string, request: AddValueRequest, authToken?: string | null) => Promise<CategoryListDto>;
|
|
341
354
|
removeValue: (id: string, key: string, authToken?: string | null) => Promise<CategoryListDto>;
|
|
342
|
-
|
|
355
|
+
updateValue: (id: string, key: string, value: CategoryListValueDto, authToken?: string | null) => Promise<CategoryListDto>;
|
|
356
|
+
updateValues: (id: string, values: Record<string, CategoryListDto["values"][string]>, authToken?: string | null) => Promise<CategoryListDto>;
|
|
343
357
|
};
|
|
344
358
|
jobFeedFieldMappings: {
|
|
345
359
|
getByFeed: (feedId: string, authToken?: string | null) => Promise<JobFeedFieldMapping[]>;
|
|
@@ -412,6 +426,12 @@ declare const hcApi: {
|
|
|
412
426
|
getMapListings: (authToken?: string | null, filterId?: string | null) => Promise<any[]>;
|
|
413
427
|
getMapListing: (id: string, authToken?: string | null) => Promise<any>;
|
|
414
428
|
getById: (id: string, authToken?: string | null) => Promise<JobListing>;
|
|
429
|
+
updateFieldVersionApproval: (id: string, payload: {
|
|
430
|
+
fieldPath: string;
|
|
431
|
+
timestamp?: string;
|
|
432
|
+
listingVersionNumber?: number;
|
|
433
|
+
needsApproval: boolean;
|
|
434
|
+
}, authToken?: string | null) => Promise<void>;
|
|
415
435
|
create: (jobListing: JobListing, authToken?: string | null) => Promise<JobListing>;
|
|
416
436
|
update: (id: string, jobListing: JobListing, authToken?: string | null) => Promise<void>;
|
|
417
437
|
delete: (id: string, authToken?: string | null) => Promise<void>;
|
|
@@ -4,13 +4,17 @@ export type ModifiedByDto = {
|
|
|
4
4
|
lastName: string;
|
|
5
5
|
dateTime: string;
|
|
6
6
|
};
|
|
7
|
+
export type CategoryListValueDto = {
|
|
8
|
+
displayValue: string;
|
|
9
|
+
displayInForms: boolean;
|
|
10
|
+
};
|
|
7
11
|
export type CategoryListDto = {
|
|
8
12
|
id: string;
|
|
9
13
|
companyId: string;
|
|
10
14
|
type: string;
|
|
11
15
|
name: string;
|
|
12
16
|
description?: string;
|
|
13
|
-
values: Record<string,
|
|
17
|
+
values: Record<string, CategoryListValueDto>;
|
|
14
18
|
isActive: boolean;
|
|
15
19
|
autoAddNewValues: boolean;
|
|
16
20
|
notifyOnNewValues: boolean;
|
|
@@ -21,6 +25,7 @@ export type CategoryListDto = {
|
|
|
21
25
|
};
|
|
22
26
|
export type AddValueRequest = {
|
|
23
27
|
key: string;
|
|
24
|
-
|
|
28
|
+
displayValue: string;
|
|
29
|
+
displayInForms: boolean;
|
|
25
30
|
};
|
|
26
31
|
export default CategoryListDto;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type BlockFieldChange = {
|
|
2
|
+
oldKey?: string;
|
|
3
|
+
newKey?: string;
|
|
4
|
+
key?: string;
|
|
5
|
+
affectedEntryCount?: number;
|
|
6
|
+
};
|
|
7
|
+
export type BlockUpdateImpact = {
|
|
8
|
+
renamedFields?: BlockFieldChange[];
|
|
9
|
+
removedFields?: BlockFieldChange[];
|
|
10
|
+
addedFields?: BlockFieldChange[];
|
|
11
|
+
affectedEntries?: Array<{
|
|
12
|
+
usedIn?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
export type BlockFieldMigration = {
|
|
17
|
+
type: "rename" | "remove";
|
|
18
|
+
oldKey?: string;
|
|
19
|
+
newKey?: string;
|
|
20
|
+
key?: string;
|
|
21
|
+
cleanup?: boolean;
|
|
22
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type UnknownRecord = Record<string, unknown>;
|
|
2
|
+
|
|
3
|
+
const isPlainObject = (value: unknown): value is UnknownRecord => {
|
|
4
|
+
if (value === null || typeof value !== "object") return false;
|
|
5
|
+
return Object.getPrototypeOf(value) === Object.prototype;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const toCamelCase = (value: string): string => {
|
|
9
|
+
if (!value) return value;
|
|
10
|
+
if (/^[a-z][a-zA-Z0-9]*$/.test(value)) return value;
|
|
11
|
+
|
|
12
|
+
return value
|
|
13
|
+
.replace(/[^a-zA-Z0-9]+/g, " ")
|
|
14
|
+
.trim()
|
|
15
|
+
.toLowerCase()
|
|
16
|
+
.replace(/\s+(.)/g, (_, char: string) => char.toUpperCase())
|
|
17
|
+
.replace(/\s/g, "")
|
|
18
|
+
.replace(/^(.)/, (_, char: string) => char.toLowerCase());
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const normalizeToCamelCase = <T>(value: T): T => {
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
return value.map(item => normalizeToCamelCase(item)) as T;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!isPlainObject(value)) {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const normalized: UnknownRecord = {};
|
|
31
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
32
|
+
normalized[toCamelCase(key)] = normalizeToCamelCase(nestedValue);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return normalized as T;
|
|
36
|
+
};
|
package/index.ts
CHANGED
|
@@ -69,8 +69,13 @@ import ContentModel, {
|
|
|
69
69
|
} from "./types/content/model";
|
|
70
70
|
import ContentBlock from "./types/content/block";
|
|
71
71
|
import ContentEntry from "./types/content/contentEntry";
|
|
72
|
+
import {
|
|
73
|
+
BlockUpdateImpact,
|
|
74
|
+
BlockFieldChange,
|
|
75
|
+
BlockFieldMigration,
|
|
76
|
+
} from "./types/content/blockUpdateImpact";
|
|
72
77
|
import Blog from "./types/blog";
|
|
73
|
-
import CategoryListDto, { AddValueRequest } from "./types/categoryList";
|
|
78
|
+
import CategoryListDto, { AddValueRequest, CategoryListValueDto } from "./types/categoryList";
|
|
74
79
|
import JobFeed from "./types/jobFeed";
|
|
75
80
|
import JobFeedFieldMapping, {
|
|
76
81
|
MultipleFieldConfig,
|
|
@@ -87,6 +92,13 @@ import CompletionRequest, {
|
|
|
87
92
|
CompletionResponse,
|
|
88
93
|
} from "./types/completionRequest";
|
|
89
94
|
import SearchReadConfig from "./types/searchReadConfig";
|
|
95
|
+
import {
|
|
96
|
+
BLOCK_KEYS,
|
|
97
|
+
BLOCK_KEY_ALIASES,
|
|
98
|
+
FIELD_TYPES,
|
|
99
|
+
type BlockKey,
|
|
100
|
+
type FieldType,
|
|
101
|
+
} from "./constants/cms";
|
|
90
102
|
|
|
91
103
|
export const auth = {
|
|
92
104
|
login: authController.login,
|
|
@@ -193,6 +205,7 @@ export const categoryLists = {
|
|
|
193
205
|
delete: categoryListsController.deleteCategoryList,
|
|
194
206
|
addValue: categoryListsController.addValue,
|
|
195
207
|
removeValue: categoryListsController.removeValue,
|
|
208
|
+
updateValue: categoryListsController.updateValue,
|
|
196
209
|
updateValues: categoryListsController.updateValues,
|
|
197
210
|
};
|
|
198
211
|
|
|
@@ -255,6 +268,7 @@ export const jobListings = {
|
|
|
255
268
|
getMapListings: JobListingsController.getMapJobListingsByCompany,
|
|
256
269
|
getMapListing: JobListingsController.getMapListingById,
|
|
257
270
|
getById: JobListingsController.getJobListingById,
|
|
271
|
+
updateFieldVersionApproval: JobListingsController.updateFieldVersionApproval,
|
|
258
272
|
create: JobListingsController.createJobListing,
|
|
259
273
|
update: JobListingsController.updateJobListing,
|
|
260
274
|
delete: JobListingsController.deleteJobListing,
|
|
@@ -282,6 +296,8 @@ export const contentBlocks = {
|
|
|
282
296
|
getById: blocksController.getBlock,
|
|
283
297
|
create: blocksController.createBlock,
|
|
284
298
|
update: blocksController.updateBlock,
|
|
299
|
+
updateWithMigrations: blocksController.updateBlockWithMigrations,
|
|
300
|
+
previewUpdate: blocksController.previewBlockUpdate,
|
|
285
301
|
delete: blocksController.deleteBlock,
|
|
286
302
|
getTemplateBlocks: blocksController.getTemplateBlocks,
|
|
287
303
|
};
|
|
@@ -302,6 +318,7 @@ export const openAI = {
|
|
|
302
318
|
|
|
303
319
|
export const forms = formsController;
|
|
304
320
|
export const formSubmissions = formSubmissionController;
|
|
321
|
+
export { BLOCK_KEYS, BLOCK_KEY_ALIASES, FIELD_TYPES };
|
|
305
322
|
//types
|
|
306
323
|
export type {
|
|
307
324
|
Register,
|
|
@@ -337,10 +354,14 @@ export type {
|
|
|
337
354
|
ContentModuleSyncExecuteRequest,
|
|
338
355
|
ContentModuleSyncExecuteResult,
|
|
339
356
|
ContentBlock,
|
|
357
|
+
BlockUpdateImpact,
|
|
358
|
+
BlockFieldChange,
|
|
359
|
+
BlockFieldMigration,
|
|
340
360
|
ContentEntry,
|
|
341
361
|
Blog,
|
|
342
362
|
CategoryListDto,
|
|
343
363
|
AddValueRequest,
|
|
364
|
+
CategoryListValueDto,
|
|
344
365
|
JobFeed,
|
|
345
366
|
JobFeedFieldMapping,
|
|
346
367
|
MultipleFieldConfig,
|
|
@@ -354,6 +375,7 @@ export type {
|
|
|
354
375
|
CompletionResponse,
|
|
355
376
|
SearchReadConfig,
|
|
356
377
|
};
|
|
378
|
+
export type { BlockKey, FieldType };
|
|
357
379
|
|
|
358
380
|
export {
|
|
359
381
|
EventType,
|
package/package.json
CHANGED
package/types/JobListing.ts
CHANGED
package/types/categoryList.ts
CHANGED
|
@@ -5,13 +5,18 @@ export type ModifiedByDto = {
|
|
|
5
5
|
dateTime: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
export type CategoryListValueDto = {
|
|
9
|
+
displayValue: string;
|
|
10
|
+
displayInForms: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
8
13
|
export type CategoryListDto = {
|
|
9
14
|
id: string;
|
|
10
15
|
companyId: string;
|
|
11
16
|
type: string;
|
|
12
17
|
name: string;
|
|
13
18
|
description?: string;
|
|
14
|
-
values: Record<string,
|
|
19
|
+
values: Record<string, CategoryListValueDto>;
|
|
15
20
|
isActive: boolean;
|
|
16
21
|
autoAddNewValues: boolean;
|
|
17
22
|
notifyOnNewValues: boolean;
|
|
@@ -23,7 +28,8 @@ export type CategoryListDto = {
|
|
|
23
28
|
|
|
24
29
|
export type AddValueRequest = {
|
|
25
30
|
key: string;
|
|
26
|
-
|
|
31
|
+
displayValue: string;
|
|
32
|
+
displayInForms: boolean;
|
|
27
33
|
};
|
|
28
34
|
|
|
29
35
|
export default CategoryListDto;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type BlockFieldChange = {
|
|
2
|
+
oldKey?: string;
|
|
3
|
+
newKey?: string;
|
|
4
|
+
key?: string;
|
|
5
|
+
affectedEntryCount?: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type BlockUpdateImpact = {
|
|
9
|
+
renamedFields?: BlockFieldChange[];
|
|
10
|
+
removedFields?: BlockFieldChange[];
|
|
11
|
+
addedFields?: BlockFieldChange[];
|
|
12
|
+
affectedEntries?: Array<{
|
|
13
|
+
usedIn?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type BlockFieldMigration = {
|
|
19
|
+
type: "rename" | "remove";
|
|
20
|
+
oldKey?: string;
|
|
21
|
+
newKey?: string;
|
|
22
|
+
key?: string;
|
|
23
|
+
cleanup?: boolean;
|
|
24
|
+
};
|