@abcagency/hire-control-sdk 1.0.102 → 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.
@@ -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,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
- return fetchHandler.get<Block[]>("/block", true, authToken);
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
- return fetchHandler.get<Block>(`/block/${id}`, true, authToken);
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
- return fetchHandler.post<Block, Block>("/block", block, true, authToken);
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
- return fetchHandler.get<Block[]>("/block/template-blocks", true, authToken);
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
- return fetchHandler.get<ContentEntry[]>(url, true, authToken);
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
- return fetchHandler.get<ContentEntry>(url, true, authToken);
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
- return fetchHandler.post<ContentEntry, ContentEntry>(
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
- return fetchHandler.get<ContentEntry[]>(
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
  /**
@@ -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,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.
@@ -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";function t(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{l(r.next(t))}catch(t){o(t)}}function u(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,u)}l((r=r.apply(t,e||[])).next())})}Object.defineProperty(exports,"__esModule",{value:!0}),"function"==typeof SuppressedError&&SuppressedError;class e{constructor(t){this.apiUrl=t,this.isLocalhost=!1}getAuthToken(){return this.isLocalhost?sessionStorage.getItem("token"):null}get(e){return t(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(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(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(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(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(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(this,void 0,void 0,function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)})}fetchWithAuth(e,n,r){return t(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(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(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(this,void 0,void 0,function*(){return r.post("/auth/login",e,!1)})}nextLogin(e){return t(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(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(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(this,void 0,void 0,function*(){return r.post("/auth/register",e,!1)})}getCompanies(){return t(this,void 0,void 0,function*(){return r.get("/auth/companies",!0)})}getCompany(){return t(this,void 0,void 0,function*(){return r.get("/auth/company",!0)})}getRoles(){return t(this,void 0,void 0,function*(){return r.get("/auth/roles",!0)})}isAuthenticated(){return t(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(this,void 0,void 0,function*(){try{yield this.refreshToken();return yield r.get("/auth/authenticated",!0)}catch(t){return!1}})}getUser(){return t(this,arguments,void 0,function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}})}logout(){return t(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(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 u=new class{getEvents(){return t(this,arguments,void 0,function*(t=null){return s.get("/events",!0,t)})}getEvent(e){return t(this,arguments,void 0,function*(t,e=null){return s.get(`/events/${t}`,!0,e)})}getEventBySlug(e){return t(this,arguments,void 0,function*(t,e=null){return s.get(`/events/details/${t}`,!0,e)})}getListingEvents(e){return t(this,arguments,void 0,function*(t,e=null){return s.get(`/listingEvents/${t}`,!0,e)})}createEvent(e){return t(this,arguments,void 0,function*(t,e=null){return s.post("/events",t,!0,e)})}updateEvent(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return s.put(`/events/${t}`,e,!0,n)})}deleteEvent(e){return t(this,arguments,void 0,function*(t,e=null){return s.delete(`/events/${t}`,!0,e)})}};const l=new e(n);var a=new class{getAllRolesWithClaims(){return t(this,arguments,void 0,function*(t=null){return l.get("/roles",!0,t)})}addRole(e){return t(this,arguments,void 0,function*(t,e=null){return l.post("/roles",t,!0,e)})}updateRole(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return l.put(`/roles/${t}`,e,!0,n)})}deleteRole(e){return t(this,arguments,void 0,function*(t,e=null){return l.delete(`/roles/${t}`,!0,e)})}};const d=new e(n);var c=new class{getAllUsers(){return t(this,arguments,void 0,function*(t=null){try{return yield d.get("/users",!0,t)}catch(t){throw t}})}getUser(e){return t(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(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(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(this,arguments,void 0,function*(t,e=null){try{yield d.put("/users",t,!0,e)}catch(t){throw t}})}deleteUser(e){return t(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 p=new class{forgotPassword(e){return t(this,void 0,void 0,function*(){try{return yield g.post("/account/forgotPassword",e,!1)}catch(t){throw t}})}resetPasswordWithToken(e){return t(this,void 0,void 0,function*(){try{return yield g.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}})}resetPassword(e){return t(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 f=new class{getMapConfig(){return t(this,arguments,void 0,function*(t=null){try{return yield h.get("/mapconfig",!0,t)}catch(t){throw t}})}updateMapConfig(e){return t(this,arguments,void 0,function*(t,e=null){return h.put("/mapconfig",t,!0,e)})}createMapConfig(e){return t(this,arguments,void 0,function*(t,e=null){return h.post("/mapconfig",t,!0,e)})}};const v=new e(n);var y=new class{getAllPermissions(){return t(this,arguments,void 0,function*(t=null){return v.get("/permissions",!0,t)})}};const m=new e(n);var C=new class{getClientAuthConfigById(e){return t(this,arguments,void 0,function*(t,e=null){try{return yield m.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}})}getAllClientAuthConfigs(){return t(this,arguments,void 0,function*(t=null){try{return yield m.get("/clientAuthConfig",!0,t)}catch(t){throw t}})}createClientAuthConfig(e){return t(this,arguments,void 0,function*(t,e=null){return m.post("/clientAuthConfig",t,!0,e)})}updateClientAuthConfig(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return m.put(`/clientAuthConfig/${t}`,e,!0,n)})}deleteClientAuthConfig(e){return t(this,arguments,void 0,function*(t,e=null){return m.delete(`/clientAuthConfig/${t}`,!0,e)})}};const w=new e(n);var b=new class{getSearchReadConfig(){return t(this,arguments,void 0,function*(t=null){try{return yield w.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 A=new e(n);var S=new class{getListings(){return t(this,arguments,void 0,function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield A.get(`/listings${n}`,!0,t)}catch(t){throw t}})}getListingDetails(e){return t(this,arguments,void 0,function*(t,e=null){try{return yield A.get(`/listings/${t}`,!0,e)}catch(t){throw t}})}};const $=new e(n);var L=new class{uploadMedia(e){return t(this,arguments,void 0,function*(t,e=null){return $.post("/media/upload",t,!0,e,!0)})}uploadProfileImage(e){return t(this,arguments,void 0,function*(t,e=null){return $.post("/media/upload-profile-image",t,!0,e,!0)})}listMedia(e){return t(this,arguments,void 0,function*(t,e=null){const n=new URLSearchParams({folderKey:t});return $.get(`/media/list?${n.toString()}`,!0,e)})}deleteMedia(e){return t(this,arguments,void 0,function*(t,e=null){const n=new URLSearchParams({key:t});return $.delete(`/media/delete?${n.toString()}`,!0,e)})}};const F=new e(n);var k=new class{getFilters(){return t(this,arguments,void 0,function*(t=null){return F.get("/filters",!0,t)})}getFilter(e){return t(this,arguments,void 0,function*(t,e=null){return F.get(`/filters/${t}`,!0,e)})}createFilter(e){return t(this,arguments,void 0,function*(t,e=null){return F.post("/filters",t,!0,e)})}updateFilter(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return F.put(`/filters/${t}`,e,!0,n)})}deleteFilter(e){return t(this,arguments,void 0,function*(t,e=null){return F.delete(`/filters/${t}`,!0,e)})}};const T=new e(n);var x=new class{getAppendListings(){return t(this,arguments,void 0,function*(t=null){return T.get("/appendListings",!0,t)})}getAppendListing(e){return t(this,arguments,void 0,function*(t,e=null){return T.get(`/appendListings/${t}`,!0,e)})}createAppendListing(e){return t(this,arguments,void 0,function*(t,e=null){return T.post("/appendListings",t,!0,e)})}updateAppendListing(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return T.put(`/appendListings/${t}`,e,!0,n)})}deleteAppendListing(e){return t(this,arguments,void 0,function*(t,e=null){return T.delete(`/appendListings/${t}`,!0,e)})}};const B=new e(n);var j=new class{getForms(){return t(this,arguments,void 0,function*(t=null){return B.get("/forms",!0,t)})}getForm(e){return t(this,arguments,void 0,function*(t,e=null){return B.get(`/forms/${t}`,!0,e)})}createForm(e){return t(this,arguments,void 0,function*(t,e=null){return B.post("/forms",t,!0,e)})}updateForm(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return B.put(`/forms/${t}`,e,!0,n)})}updateFormWithFieldRenames(e,n,r){return t(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(this,arguments,void 0,function*(t,e=null){return B.get(`/forms/${t}/submission-count`,!0,e)})}getFormSubmissionFieldUsage(e){return t(this,arguments,void 0,function*(t,e=null){return B.get(`/forms/${t}/submission-fields`,!0,e)})}migrateSubmissionFields(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return B.post(`/forms/${t}/migrate-submission-fields`,e,!0,n)})}deleteForm(e){return t(this,arguments,void 0,function*(t,e=null){return B.delete(`/forms/${t}`,!0,e)})}processFormRequest(e){return t(this,arguments,void 0,function*(t,e=null){return B.post("/forms/jsonSchema",t,!0,e)})}};const I=new e(n);var E=new class{submitContactForm(e){return t(this,arguments,void 0,function*(t,e=null){return I.post("/contactForm",t,!0,e,!0)})}submitFormSubmission(e){return t(this,arguments,void 0,function*(t,e=null){return I.post("/formsubmission",t,!0,e)})}getFormSubmissions(){return t(this,arguments,void 0,function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const u=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&u.append("status",r.toString()),n&&u.append("type",n),i&&u.append("from",i.toISOString()),o&&u.append("to",o.toISOString()),I.get(`/formsubmission?${u.toString()}`,!0,s)})}exportFormSubmissionsCsv(){return t(this,arguments,void 0,function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null,u=null){const l=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&l.append("status",r.toString()),n&&l.append("type",n),i&&l.append("from",i.toISOString()),o&&l.append("to",o.toISOString()),s&&s.length>0&&s.forEach(t=>l.append("columns",t));const a=yield I.getFile(`/formsubmission/export-csv?${l.toString()}`,!0,u),d=window.URL.createObjectURL(a),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(this,arguments,void 0,function*(t=null){return I.get("/formsubmission/types",!0,t)})}};const R=new e(n);var P=new class{getCompanies(){return t(this,arguments,void 0,function*(t=null){return R.get("/companies",!0,t)})}getCompany(e){return t(this,arguments,void 0,function*(t,e=null){return R.get(`/companies/${t}`,!0,e)})}createCompany(e){return t(this,arguments,void 0,function*(t,e=null){return R.post("/companies",t,!0,e)})}updateCompany(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return R.put(`/companies/${t}`,e,!0,n)})}deleteCompany(e){return t(this,arguments,void 0,function*(t,e=null){return R.delete(`/companies/${t}`,!0,e)})}syncAllCompanies(){return t(this,arguments,void 0,function*(t=null){return R.get("/companies/syncall",!0,t)})}};const M=new e(n);var U=new class{updateFieldVersionApproval(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return M.patch(`/joblistings/${t}/field-version-approval`,e,!0,n)})}getJobListingsByCompany(){return t(this,arguments,void 0,function*(t=null){return M.get("/joblistings",!0,t)})}getMapJobListingsByCompany(){return t(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(this,arguments,void 0,function*(t,e=null){return M.get(`/joblistings/${t}`,!0,e)})}getMapListingById(e){return t(this,arguments,void 0,function*(t,e=null){return M.get(`/joblistings/MapListings/${t}`,!0,e)})}createJobListing(e){return t(this,arguments,void 0,function*(t,e=null){return M.post("/joblistings",t,!0,e)})}updateJobListing(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return M.put(`/joblistings/${t}`,e,!0,n)})}exportJobListingsCsv(){return t(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 u=yield M.getFile(`/joblistings/Export-csv?${s.toString()}`,!0,o),l=window.URL.createObjectURL(u),a=document.createElement("a");a.href=l,a.download="job_listings.csv",document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(l),document.body.removeChild(a)})}deleteJobListing(e){return t(this,arguments,void 0,function*(t,e=null){return M.delete(`/joblistings/${t}`,!0,e)})}};const O=new e(n);var V=new class{getBlogs(){return t(this,arguments,void 0,function*(t=null){return O.get("/blog",!0,t)})}getBlog(e){return t(this,arguments,void 0,function*(t,e=null){return O.get(`/blog/${t}`,!0,e)})}createBlog(e){return t(this,arguments,void 0,function*(t,e=null){return O.post("/blog",t,!0,e)})}updateBlog(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return O.put(`/blog/${t}`,e,!0,n)})}deleteBlog(e){return t(this,arguments,void 0,function*(t,e=null){return O.delete(`/blog/${t}`,!0,e)})}};const W=new e(n);var J=new class{getCategories(){return t(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(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 _=new e(n);var N=new class{getAllCategoryLists(){return t(this,arguments,void 0,function*(t=null){return _.get("/categorylist",!0,t)})}getCategoryListById(e){return t(this,arguments,void 0,function*(t,e=null){return _.get(`/categorylist/${t}`,!0,e)})}getCategoryListsByType(e){return t(this,arguments,void 0,function*(t,e=null){return _.get(`/categorylist/type/${t}`,!0,e)})}getActiveCategoryLists(){return t(this,arguments,void 0,function*(t=null){return _.get("/categorylist/active",!0,t)})}getCategoryListByTypeAndName(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return _.get(`/categorylist/type/${t}/name/${e}`,!0,n)})}createCategoryList(e){return t(this,arguments,void 0,function*(t,e=null){return _.post("/categorylist",t,!0,e)})}updateCategoryList(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return _.put(`/categorylist/${t}`,e,!0,n)})}deleteCategoryList(e){return t(this,arguments,void 0,function*(t,e=null){return _.delete(`/categorylist/${t}`,!0,e)})}addValue(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return _.post(`/categorylist/${t}/values`,e,!0,n)})}removeValue(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return _.delete(`/categorylist/${t}/values/${e}`,!0,n)})}updateValues(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return _.put(`/categorylist/${t}/values`,e,!0,n)})}updateValue(e,n,r){return t(this,arguments,void 0,function*(t,e,n,r=null){return _.put(`/categorylist/${t}/values/${encodeURIComponent(e)}`,n,!0,r)})}};const D=new e(n);var H=new class{getByFeed(e){return t(this,arguments,void 0,function*(t,e=null){return D.get(`/jobFeedFieldMappings/feed/${t}`,!0,e)})}get(e){return t(this,arguments,void 0,function*(t,e=null){return D.get(`/jobFeedFieldMappings/${t}`,!0,e)})}create(e){return t(this,arguments,void 0,function*(t,e=null){return D.post("/jobFeedFieldMappings",t,!0,e)})}update(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return D.put(`/jobFeedFieldMappings/${t}`,e,!0,n)})}delete(e){return t(this,arguments,void 0,function*(t,e=null){return D.delete(`/jobFeedFieldMappings/${t}`,!0,e)})}toggleActive(e){return t(this,arguments,void 0,function*(t,e=null){return D.post("/jobFeedFieldMappings/toggle-active",t,!0,e)})}discoverFields(e){return t(this,arguments,void 0,function*(t,e=null){return D.get(`/jobFeedFieldMappings/discover-fields/${t}`,!0,e)})}validate(e){return t(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(this,arguments,void 0,function*(t=null){return z.get("/jobfeeds",!0,t)})}get(e){return t(this,arguments,void 0,function*(t,e=null){return z.get(`/jobfeeds/${t}`,!0,e)})}create(e){return t(this,arguments,void 0,function*(t,e=null){return z.post("/jobfeeds",t,!0,e)})}update(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return z.put(`/jobfeeds/${t}`,e,!0,n)})}delete(e){return t(this,arguments,void 0,function*(t,e=null){return z.delete(`/jobfeeds/${t}`,!0,e)})}sync(e){return t(this,arguments,void 0,function*(t,e=null){return z.post(`/jobfeeds/${t}/sync`,{},!0,e)})}toggleActive(e,n){return t(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(this,arguments,void 0,function*(t=null){return G.get("/jobListingSettings",!0,t)})}create(e){return t(this,arguments,void 0,function*(t,e=null){return G.post("/jobListingSettings",t,!0,e)})}delete(){return t(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(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(this,arguments,void 0,function*(t=null){return X.get("/listingEntities",!0,t)})}create(e){return t(this,arguments,void 0,function*(t,e=null){return X.post("/listingEntities/create",t,!0,e)})}update(e,n){return t(this,arguments,void 0,function*(t,e,n=null){yield X.put(`/listingEntities/update/${t}`,e,!0,n)})}delete(e){return t(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(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(this,arguments,void 0,function*(t=null){return Y.get("/recruiters/all",!0,t)})}sync(){return t(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(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(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(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(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(this,arguments,void 0,function*(t,e=null){return it.post("/contententry",t,!0,e)})}updateContentEntry(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return it.put(`/contententry/${t}`,e,!0,n)})}deleteContentEntry(e){return t(this,arguments,void 0,function*(t,e=null){return it.delete(`/contententry/${t}`,!0,e)})}getVersions(e){return t(this,arguments,void 0,function*(t,e=null){return it.get(`/contententry/${t}/versions`,!0,e)})}unpublishAll(e){return t(this,arguments,void 0,function*(t,e=null){return it.post(`/contententry/${t}/unpublish`,void 0,!0,e)})}};const st=new e(n);var ut=new class{getBlocks(){return t(this,arguments,void 0,function*(t=null){return st.get("/block",!0,t)})}getBlock(e){return t(this,arguments,void 0,function*(t,e=null){return st.get(`/block/${t}`,!0,e)})}createBlock(e){return t(this,arguments,void 0,function*(t,e=null){return st.post("/block",t,!0,e)})}updateBlock(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return st.put(`/block/${t}`,e,!0,n)})}deleteBlock(e){return t(this,arguments,void 0,function*(t,e=null){return st.delete(`/block/${t}`,!0,e)})}getTemplateBlocks(){return t(this,arguments,void 0,function*(t=null){return st.get("/block/template-blocks",!0,t)})}};const lt=new e(n);var at=new class{getModels(){return t(this,arguments,void 0,function*(t=null){return lt.get("/model",!0,t)})}getModel(e){return t(this,arguments,void 0,function*(t,e=null){return lt.get(`/model/${t}`,!0,e)})}createModel(e){return t(this,arguments,void 0,function*(t,e=null){return lt.post("/model",t,!0,e)})}updateModel(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return lt.put(`/model/${t}`,e,!0,n)})}deleteModel(e){return t(this,arguments,void 0,function*(t,e=null){return lt.delete(`/model/${t}`,!0,e)})}previewSync(e){return t(this,arguments,void 0,function*(t,e=null){return lt.get(`/model/${t}/sync/preview`,!0,e)})}executeSync(e,n){return t(this,arguments,void 0,function*(t,e,n=null){return lt.post(`/model/${t}/sync`,e,!0,n)})}};const dt=new e(n);var ct,gt,pt,ht,ft=new class{getCompletion(e){return t(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,(pt=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[pt.Submitted=1]="Submitted",pt[pt.Hold=2]="Hold",pt[pt.Rejected=3]="Rejected",pt[pt.Sent=4]="Sent",exports.FeedHandlingOption=void 0,(ht=exports.FeedHandlingOption||(exports.FeedHandlingOption={}))[ht.Replace=0]="Replace",ht[ht.Append=1]="Append",ht[ht.Custom=2]="Custom";const vt={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},yt={getAll:u.getEvents,get:u.getEvent,getBySlug:u.getEventBySlug,create:u.createEvent,update:u.updateEvent,delete:u.deleteEvent},mt={get:a.getAllRolesWithClaims,create:a.addRole,update:a.updateRole,delete:a.deleteRole},Ct=c,wt=S,bt={resetPassword:p.resetPassword,resetPasswordWithToken:p.resetPasswordWithToken,forgotPassword:p.forgotPassword},At={get:f.getMapConfig,update:f.updateMapConfig,create:f.createMapConfig},St={get:C.getClientAuthConfigById,getAll:C.getAllClientAuthConfigs,update:C.updateClientAuthConfig,create:C.createClientAuthConfig,delete:C.deleteClientAuthConfig},$t={getSearchRead:b.getSearchReadConfig},Lt={upload:L.uploadMedia,uploadProfileImage:L.uploadProfileImage,get:L.listMedia,delete:L.deleteMedia},Ft={getList:k.getFilters,get:k.getFilter,update:k.updateFilter,create:k.createFilter,delete:k.deleteFilter},kt={get:x.getAppendListings,getAppendListing:x.getAppendListing,create:x.createAppendListing,update:x.updateAppendListing,delete:x.deleteAppendListing},Tt={getAll:V.getBlogs,getById:V.getBlog,create:V.createBlog,update:V.updateBlog,delete:V.deleteBlog},xt={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,updateValue:N.updateValue,updateValues:N.updateValues},jt={getByFeed:H.getByFeed,get:H.get,create:H.create,update:H.update,delete:H.delete,toggleActive:H.toggleActive,discoverFields:H.discoverFields,validate:H.validate},It={getAll:q.getAll,getById:q.get,create:q.create,update:q.update,delete:q.delete,sync:q.sync,toggleActive:q.toggleActive},Et={get:K.get,create:K.create,delete:K.delete},Rt={create:Q.create,get:Q.getAll,update:Q.update,delete:Q.delete,getAllSql:Q.getAllSql},Pt={get:Z.get,getAll:Z.getAll,sync:Z.sync},Mt={get:y.getAllPermissions},Ut={getAll:P.getCompanies,getById:P.getCompany,create:P.createCompany,update:P.updateCompany,delete:P.deleteCompany,sync:P.syncAllCompanies},Ot={getAll:U.getJobListingsByCompany,getMapListings:U.getMapJobListingsByCompany,getMapListing:U.getMapListingById,getById:U.getJobListingById,updateFieldVersionApproval:U.updateFieldVersionApproval,create:U.createJobListing,update:U.updateJobListing,delete:U.deleteJobListing},Vt={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},_t={getAll:ut.getBlocks,getById:ut.getBlock,create:ut.createBlock,update:ut.updateBlock,delete:ut.deleteBlock,getTemplateBlocks:ut.getTemplateBlocks},Nt={getAll:at.getModels,getById:at.getModel,create:at.createModel,update:at.updateModel,delete:at.deleteModel,previewSync:at.previewSync,executeSync:at.executeSync},Dt={getCompletion:ft.getCompletion},Ht=j,zt=E,qt={auth:vt,events:yt,roles:mt,users:Ct,account:bt,mapConfig:At,permissions:Mt,clientAuthConfig:St,integrationConfig:$t,filters:Ft,listings:wt,media:Lt,appendListings:kt,blogs:Tt,categories:xt,categoryLists:Bt,jobFeedFieldMappings:jt,jobFeeds:It,jobListingSettings:Et,listingEntities:Rt,recruiters:Pt,forms:Ht,formSubmissions:zt,openAI:Dt,companies:Ut,jobListings:Ot};exports.account=bt,exports.appendListings=kt,exports.auth=vt,exports.blogs=Tt,exports.categories=xt,exports.categoryLists=Bt,exports.clientAuthConfig=St,exports.companies=Ut,exports.contentBlocks=_t,exports.contentEntries=Jt,exports.contentField=Vt,exports.contentValidator=Wt,exports.default=qt,exports.events=yt,exports.filters=Ft,exports.formSubmissions=zt,exports.forms=Ht,exports.integrationConfig=$t,exports.jobFeedFieldMappings=jt,exports.jobFeeds=It,exports.jobListingSettings=Et,exports.jobListings=Ot,exports.listingEntities=Rt,exports.listings=wt,exports.mapConfig=At,exports.media=Lt,exports.model=Nt,exports.openAI=Dt,exports.permissions=Mt,exports.recruiters=Pt,exports.roles=mt,exports.users=Ct;
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,6 +20,7 @@ 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
25
  import CategoryListDto, { AddValueRequest, CategoryListValueDto } from "./types/categoryList";
25
26
  import JobFeed from "./types/jobFeed";
@@ -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>;
@@ -210,6 +212,8 @@ export declare const contentBlocks: {
210
212
  getById: (id: string, authToken?: string | null) => Promise<ContentBlock>;
211
213
  create: (block: ContentBlock, authToken?: string | null) => Promise<ContentBlock>;
212
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>;
213
217
  delete: (id: string, authToken?: string | null) => Promise<void>;
214
218
  getTemplateBlocks: (authToken?: string | null) => Promise<ContentBlock[]>;
215
219
  };
@@ -244,7 +248,9 @@ export declare const formSubmissions: {
244
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>;
245
249
  getFormSubmissionTypes(authToken?: string | null): Promise<string[]>;
246
250
  };
247
- 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, ContentEntry, Blog, CategoryListDto, AddValueRequest, CategoryListValueDto, JobFeed, JobFeedFieldMapping, MultipleFieldConfig, ConditionalConfig, ConditionalRule, JobListingSettings, ListingEntityDto, RecruiterDto, FocalPoint, CompletionRequest, CompletionResponse, SearchReadConfig, };
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 };
248
254
  export { EventType, CallToActionType, FormSubmissionStatus, FeedHandlingOption, };
249
255
  declare const hcApi: {
250
256
  auth: {
@@ -68,6 +68,7 @@ export type FieldVersion = {
68
68
  source: string | null;
69
69
  user: string | null;
70
70
  needsApproval: boolean;
71
+ listingVersionNumber?: number;
71
72
  };
72
73
  export type AuditTrailEntry = {
73
74
  timestamp: string;
@@ -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,6 +69,11 @@ 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
78
  import CategoryListDto, { AddValueRequest, CategoryListValueDto } from "./types/categoryList";
74
79
  import JobFeed from "./types/jobFeed";
@@ -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,
@@ -284,6 +296,8 @@ export const contentBlocks = {
284
296
  getById: blocksController.getBlock,
285
297
  create: blocksController.createBlock,
286
298
  update: blocksController.updateBlock,
299
+ updateWithMigrations: blocksController.updateBlockWithMigrations,
300
+ previewUpdate: blocksController.previewBlockUpdate,
287
301
  delete: blocksController.deleteBlock,
288
302
  getTemplateBlocks: blocksController.getTemplateBlocks,
289
303
  };
@@ -304,6 +318,7 @@ export const openAI = {
304
318
 
305
319
  export const forms = formsController;
306
320
  export const formSubmissions = formSubmissionController;
321
+ export { BLOCK_KEYS, BLOCK_KEY_ALIASES, FIELD_TYPES };
307
322
  //types
308
323
  export type {
309
324
  Register,
@@ -339,6 +354,9 @@ export type {
339
354
  ContentModuleSyncExecuteRequest,
340
355
  ContentModuleSyncExecuteResult,
341
356
  ContentBlock,
357
+ BlockUpdateImpact,
358
+ BlockFieldChange,
359
+ BlockFieldMigration,
342
360
  ContentEntry,
343
361
  Blog,
344
362
  CategoryListDto,
@@ -357,6 +375,7 @@ export type {
357
375
  CompletionResponse,
358
376
  SearchReadConfig,
359
377
  };
378
+ export type { BlockKey, FieldType };
360
379
 
361
380
  export {
362
381
  EventType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcagency/hire-control-sdk",
3
- "version": "1.0.102",
3
+ "version": "1.1.2",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -74,6 +74,7 @@ export type FieldVersion = {
74
74
  source: string | null;
75
75
  user: string | null;
76
76
  needsApproval: boolean;
77
+ listingVersionNumber?: number;
77
78
  };
78
79
 
79
80
  export type AuditTrailEntry = {
@@ -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
+ };
package/.gitattributes DELETED
@@ -1 +0,0 @@
1
- * text=auto eol=lf