@abcagency/hire-control-sdk 1.0.30 → 1.0.32
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/config.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const API_URL = "
|
|
1
|
+
export const API_URL = "https://api.myhirecontrol.com";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const API_URL = "
|
|
1
|
+
export declare const API_URL = "https://api.myhirecontrol.com";
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o={method:"POST",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),n?this.fetchWithAuth(t,o,r):this.fetchWithoutAuth(t,o)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o={method:"PUT",credentials:"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),n?this.fetchWithAuth(t,o,r):this.fetchWithoutAuth(t,o)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"DELETE",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:"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||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t):t instanceof Array?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):t instanceof Object&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}[${r}]`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}));let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const n="http://localhost:5108",r=new e(n);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield r.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield r.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(n);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/details/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return o.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(n);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return a.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(n);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield l.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var g=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield p.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const m=new e(n);var y=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield m.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield m.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const C=new e(n);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload-profile-image",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({folderKey:t});return C.get(`/media/list?${n.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({key:t});return C.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const S=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return S.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return S.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.delete(`/filters/${t}`,!0,e)}))}};const b=new e(n);var T=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return b.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return b.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.delete(`/appendListings/${t}`,!0,e)}))}};const L=new e(n);var x=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return L.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return L.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms/jsonSchema",t,!0,e)}))}};const F=new e(n);var P,R,k,E=new class{submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.post("/formsubmission",t,!0,e)}))}getFormSubmissions(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString()),F.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString());const u=yield F.getFile(`/formsubmission/export-csv?${a.toString()}`,!0,s),l=window.URL.createObjectURL(u),d=document.createElement("a");d.href=l,d.download="form_submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(l),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return F.get("/formsubmission/types",!0,t)}))}};exports.EventType=void 0,(P=exports.EventType||(exports.EventType={}))[P.Virtual=0]="Virtual",P[P.InPerson=1]="InPerson",P[P.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(R=exports.CallToActionType||(exports.CallToActionType={}))[R.Button=0]="Button",R[R.Link=1]="Link",R[R.Download=2]="Download",R[R.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(k=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[k.Submitted=1]="Submitted",k[k.Hold=2]="Hold",k[k.Rejected=3]="Rejected",k[k.Sent=4]="Sent";const U={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},I={getAll:s.getEvents,get:s.getEvent,getBySlug:s.getEventBySlug,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},W={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},j=d,O=y,M={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},D={get:g.getMapConfig,update:g.updateMapConfig,create:g.createMapConfig},B={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},H={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},z={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},N={get:T.getAppendListings,getAppendListing:T.getAppendListing,create:T.createAppendListing,update:T.updateAppendListing,delete:T.deleteAppendListing},q={get:_.getAllPermissions},G=x,J=E,V={auth:U,events:I,roles:W,users:j,account:M,mapConfig:D,permissions:q,clientAuthConfig:B,filters:z,listings:O,media:H,appendListings:N,forms:G};exports.account=M,exports.appendListings=N,exports.auth=U,exports.clientAuthConfig=B,exports.default=V,exports.events=I,exports.filters=z,exports.formSubmissions=J,exports.forms=G,exports.listings=O,exports.mapConfig=D,exports.media=H,exports.permissions=q,exports.roles=W,exports.users=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");class e{constructor(t){this.apiUrl=t}get(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}post(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o={method:"POST",credentials:r?"omit":"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),n?this.fetchWithAuth(t,o,r):this.fetchWithoutAuth(t,o)}))}put(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=!1,r=null,i=!1){const o={method:"PUT",credentials:r?"omit":"include"};return i?o.body=this.convertToFormData(e):(o.headers={"Content-Type":"application/json"},o.body=JSON.stringify(e)),n?this.fetchWithAuth(t,o,r):this.fetchWithoutAuth(t,o)}))}delete(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"DELETE",credentials:n?"omit":"include"};return e?this.fetchWithAuth(t,r,n):this.fetchWithoutAuth(t,r)}))}getFile(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=!1,n=null){const r={method:"GET",credentials:n?"omit":"include",headers:e&&n?{Authorization:`Bearer ${n}`}:{}},i=yield fetch(`${this.apiUrl}${t}`,r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);return i.blob()}))}convertToFormData(t,e=new FormData,n=""){return t instanceof File||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?e.append(n,t):t instanceof Array?t.forEach(((t,r)=>{this.convertToFormData(t,e,`${n}[${r}]`)})):t instanceof Object&&Object.keys(t).forEach((r=>{const i=t[r],o=n?`${n}[${r}]`:r;this.convertToFormData(i,e,o)})),e}fetchWithoutAuth(e,n){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield fetch(`${this.apiUrl}${e}`,n);return this.handleResponse(t)}))}fetchWithAuth(e,n,r){return t.__awaiter(this,void 0,void 0,(function*(){r&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:`Bearer ${r}`}));let t=yield fetch(`${this.apiUrl}${e}`,n);if(401===t.status){if(!(yield this.refreshToken()))throw{statusCode:t.status};t=yield fetch(`${this.apiUrl}${e}`,n)}return this.handleResponse(t)}))}handleResponse(e){return t.__awaiter(this,void 0,void 0,(function*(){if(!e.ok||!e.status.toString().startsWith("2")){let t=`Error: ${e.status} ${e.statusText}`;try{const n=yield e.json();console.log(n),n&&n.message&&(t=n.message)}catch(t){console.error("Failed to parse error response:",t)}throw{statusCode:e.status,errorMessage:t}}return 200===e.status?e.json():null}))}refreshToken(){return t.__awaiter(this,void 0,void 0,(function*(){return!!(yield fetch(`${this.apiUrl}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).ok||(console.error("Failed to refresh token"),!1)}))}}const n="https://api.myhirecontrol.com",r=new e(n);var i=new class{login(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/login",e,!1)}))}nextLogin(e){return t.__awaiter(this,void 0,void 0,(function*(){return yield r.post("/auth/nextLogin",e,!1)}))}refreshToken(e){return t.__awaiter(this,void 0,void 0,(function*(){const t=yield r.post("/auth/refresh",e,!1);return t&&(sessionStorage.setItem("token",t.token),sessionStorage.setItem("refreshToken",t.refreshToken),sessionStorage.setItem("expiration",t.expiration)),t}))}changeCompany(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/changeCompany",e,!0)}))}register(e){return t.__awaiter(this,void 0,void 0,(function*(){return r.post("/auth/register",e,!1)}))}getCompanies(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/companies",!0)}))}getCompany(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/company",!0)}))}getRoles(){return t.__awaiter(this,void 0,void 0,(function*(){return r.get("/auth/roles",!0)}))}isAuthenticated(){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield r.get("/auth/authenticated",!0)}catch(t){return!1}}))}getUser(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/user",!0,t)}catch(t){throw t}}))}logout(){return t.__awaiter(this,void 0,void 0,(function*(){try{const t=yield r.post("/auth/logout",{},!0);return sessionStorage.removeItem("token"),sessionStorage.removeItem("refreshToken"),sessionStorage.removeItem("expiration"),t}catch(t){throw t}}))}getPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield r.get("/auth/permissions",!0,t)}catch(t){throw t}}))}};const o=new e(n);var s=new class{getEvents(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return o.get("/events",!0,t)}))}getEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/${t}`,!0,e)}))}getEventBySlug(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.get(`/events/details/${t}`,!0,e)}))}createEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.post("/events",t,!0,e)}))}updateEvent(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return o.put(`/events/${t}`,e,!0,n)}))}deleteEvent(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return o.delete(`/events/${t}`,!0,e)}))}};const a=new e(n);var u=new class{getAllRolesWithClaims(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return a.get("/roles",!0,t)}))}addRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.post("/roles",t,!0,e)}))}updateRole(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return a.put(`/roles/${t}`,e,!0,n)}))}deleteRole(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return a.delete(`/roles/${t}`,!0,e)}))}};const l=new e(n);var d=new class{getAllUsers(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield l.get("/users",!0,t)}catch(t){throw t}}))}getUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.get(`/users/${t}`,!0,e)}catch(t){throw t}}))}createUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield l.post("/users",t,!0,e)}catch(t){throw t}}))}updateUser(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){try{yield l.put(`/users/${t}`,e,!0,n)}catch(t){throw t}}))}updateLoggedInUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.put("/users",t,!0,e)}catch(t){throw t}}))}deleteUser(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{yield l.delete(`/users/${t}`,!0,e)}catch(t){throw t}}))}};const c=new e(n);var h=new class{forgotPassword(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/forgotPassword",e,!1)}catch(t){throw t}}))}resetPasswordWithToken(e){return t.__awaiter(this,void 0,void 0,(function*(){try{return yield c.post("/account/resetPasswordWithToken",e,!1)}catch(t){throw t}}))}resetPassword(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield c.post("/account/resetPassword",t,!0,e)}catch(t){throw t}}))}};const p=new e(n);var g=new class{getMapConfig(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield p.get("/mapconfig",!0,t)}catch(t){throw t}}))}updateMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.put("/mapconfig",t,!0,e)}))}createMapConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return p.post("/mapconfig",t,!0,e)}))}};const f=new e(n);var _=new class{getAllPermissions(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return f.get("/permissions",!0,t)}))}};const w=new e(n);var v=new class{getClientAuthConfigById(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield w.get(`/clientAuthConfig/${t}`,!0,e)}catch(t){throw t}}))}getAllClientAuthConfigs(){return t.__awaiter(this,arguments,void 0,(function*(t=null){try{return yield w.get("/clientAuthConfig",!0,t)}catch(t){throw t}}))}createClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.post("/clientAuthConfig",t,!0,e)}))}updateClientAuthConfig(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return w.put(`/clientAuthConfig/${t}`,e,!0,n)}))}deleteClientAuthConfig(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return w.delete(`/clientAuthConfig/${t}`,!0,e)}))}};const m=new e(n);var y=new class{getListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null,e=null){try{const n=e?`?filterId=${encodeURIComponent(e)}`:"";return yield m.get(`/listings${n}`,!0,t)}catch(t){throw t}}))}getListingDetails(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){try{return yield m.get(`/listings/${t}`,!0,e)}catch(t){throw t}}))}};const C=new e(n);var A=new class{uploadMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload",t,!0,e,!0)}))}uploadProfileImage(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return C.post("/media/upload-profile-image",t,!0,e,!0)}))}listMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({folderKey:t});return C.get(`/media/list?${n.toString()}`,!0,e)}))}deleteMedia(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){const n=new URLSearchParams({key:t});return C.delete(`/media/delete?${n.toString()}`,!0,e)}))}};const S=new e(n);var $=new class{getFilters(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return S.get("/filters",!0,t)}))}getFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.get(`/filters/${t}`,!0,e)}))}createFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.post("/filters",t,!0,e)}))}updateFilter(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return S.put(`/filters/${t}`,e,!0,n)}))}deleteFilter(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return S.delete(`/filters/${t}`,!0,e)}))}};const b=new e(n);var T=new class{getAppendListings(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return b.get("/appendListings",!0,t)}))}getAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.get(`/appendListings/${t}`,!0,e)}))}createAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.post("/appendListings",t,!0,e)}))}updateAppendListing(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return b.put(`/appendListings/${t}`,e,!0,n)}))}deleteAppendListing(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return b.delete(`/appendListings/${t}`,!0,e)}))}};const L=new e(n);var x=new class{getForms(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return L.get("/forms",!0,t)}))}getForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.get(`/forms/${t}`,!0,e)}))}createForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms",t,!0,e)}))}updateForm(e,n){return t.__awaiter(this,arguments,void 0,(function*(t,e,n=null){return L.put(`/forms/${t}`,e,!0,n)}))}deleteForm(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.delete(`/forms/${t}`,!0,e)}))}processFormRequest(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return L.post("/forms/jsonSchema",t,!0,e)}))}};const F=new e(n);var P,R,k,E=new class{submitFormSubmission(e){return t.__awaiter(this,arguments,void 0,(function*(t,e=null){return F.post("/formsubmission",t,!0,e)}))}getFormSubmissions(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});return r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString()),F.get(`/formsubmission?${a.toString()}`,!0,s)}))}exportFormSubmissionsCsv(){return t.__awaiter(this,arguments,void 0,(function*(t=20,e=1,n=null,r=null,i=null,o=null,s=null){const a=new URLSearchParams({pageSize:t.toString(),pageNumber:e.toString()});r&&a.append("status",r.toString()),n&&a.append("type",n),i&&a.append("from",i.toISOString()),o&&a.append("to",o.toISOString());const u=yield F.getFile(`/formsubmission/export-csv?${a.toString()}`,!0,s),l=window.URL.createObjectURL(u),d=document.createElement("a");d.href=l,d.download="form_submissions.csv",document.body.appendChild(d),d.click(),window.URL.revokeObjectURL(l),document.body.removeChild(d)}))}getFormSubmissionTypes(){return t.__awaiter(this,arguments,void 0,(function*(t=null){return F.get("/formsubmission/types",!0,t)}))}};exports.EventType=void 0,(P=exports.EventType||(exports.EventType={}))[P.Virtual=0]="Virtual",P[P.InPerson=1]="InPerson",P[P.Hybrid=2]="Hybrid",exports.CallToActionType=void 0,(R=exports.CallToActionType||(exports.CallToActionType={}))[R.Button=0]="Button",R[R.Link=1]="Link",R[R.Download=2]="Download",R[R.HireControlRegistration=3]="HireControlRegistration",exports.FormSubmissionStatus=void 0,(k=exports.FormSubmissionStatus||(exports.FormSubmissionStatus={}))[k.Submitted=1]="Submitted",k[k.Hold=2]="Hold",k[k.Rejected=3]="Rejected",k[k.Sent=4]="Sent";const U={login:i.login,nextLogin:i.nextLogin,refreshToken:i.refreshToken,changeCompany:i.changeCompany,register:i.register,isAuthenticated:i.isAuthenticated,getCompany:i.getCompany,getCompanies:i.getCompanies,getRoles:i.getRoles,getPermissions:i.getPermissions,logout:i.logout,getUser:i.getUser},I={getAll:s.getEvents,get:s.getEvent,getBySlug:s.getEventBySlug,create:s.createEvent,update:s.updateEvent,delete:s.deleteEvent},W={get:u.getAllRolesWithClaims,create:u.addRole,update:u.updateRole,delete:u.deleteRole},j=d,O=y,M={resetPassword:h.resetPassword,resetPasswordWithToken:h.resetPasswordWithToken,forgotPassword:h.forgotPassword},D={get:g.getMapConfig,update:g.updateMapConfig,create:g.createMapConfig},B={get:v.getClientAuthConfigById,getAll:v.getAllClientAuthConfigs,update:v.updateClientAuthConfig,create:v.createClientAuthConfig,delete:v.deleteClientAuthConfig},H={upload:A.uploadMedia,uploadProfileImage:A.uploadProfileImage,get:A.listMedia,delete:A.deleteMedia},z={getList:$.getFilters,get:$.getFilter,update:$.updateFilter,create:$.createFilter,delete:$.deleteFilter},N={get:T.getAppendListings,getAppendListing:T.getAppendListing,create:T.createAppendListing,update:T.updateAppendListing,delete:T.deleteAppendListing},q={get:_.getAllPermissions},G=x,J=E,V={auth:U,events:I,roles:W,users:j,account:M,mapConfig:D,permissions:q,clientAuthConfig:B,filters:z,listings:O,media:H,appendListings:N,forms:G};exports.account=M,exports.appendListings=N,exports.auth=U,exports.clientAuthConfig=B,exports.default=V,exports.events=I,exports.filters=z,exports.formSubmissions=J,exports.forms=G,exports.listings=O,exports.mapConfig=D,exports.media=H,exports.permissions=q,exports.roles=W,exports.users=j;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/handlers/fetchHandler.ts
CHANGED
|
@@ -30,7 +30,7 @@ class FetchHandler {
|
|
|
30
30
|
): Promise<R> {
|
|
31
31
|
const options: RequestInit = {
|
|
32
32
|
method: "POST",
|
|
33
|
-
credentials: "include",
|
|
33
|
+
credentials: authToken ? "omit" : "include",
|
|
34
34
|
};
|
|
35
35
|
if (formData) {
|
|
36
36
|
options.body = this.convertToFormData(body);
|
|
@@ -53,7 +53,7 @@ class FetchHandler {
|
|
|
53
53
|
): Promise<R> {
|
|
54
54
|
const options: RequestInit = {
|
|
55
55
|
method: "PUT",
|
|
56
|
-
credentials: "include",
|
|
56
|
+
credentials: authToken ? "omit" : "include",
|
|
57
57
|
};
|
|
58
58
|
if (formData) {
|
|
59
59
|
options.body = this.convertToFormData(body);
|
|
@@ -74,7 +74,7 @@ class FetchHandler {
|
|
|
74
74
|
): Promise<T> {
|
|
75
75
|
const options: RequestInit = {
|
|
76
76
|
method: "DELETE",
|
|
77
|
-
credentials: "include",
|
|
77
|
+
credentials: authToken ? "omit" : "include",
|
|
78
78
|
};
|
|
79
79
|
return auth
|
|
80
80
|
? this.fetchWithAuth<T>(endpoint, options, authToken)
|
|
@@ -88,7 +88,7 @@ class FetchHandler {
|
|
|
88
88
|
): Promise<Blob> {
|
|
89
89
|
const options: RequestInit = {
|
|
90
90
|
method: "GET",
|
|
91
|
-
credentials: "include",
|
|
91
|
+
credentials: authToken ? "omit" : "include",
|
|
92
92
|
headers:
|
|
93
93
|
auth && authToken ? { Authorization: `Bearer ${authToken}` } : {},
|
|
94
94
|
};
|