@inploi/sdk 3.0.1 → 3.1.1

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/README.md CHANGED
@@ -56,6 +56,18 @@ memory. The module-level `getOrCreateAnonymousId` always stores; plugins' other
56
56
  `ANALYTICS_EVENTS` (`src/sdk.events.ts`) lists every event the SDK and its plugins send to `/log`; each event's fields
57
57
  are its member of `AnalyticsLogParams`. A test fails if any package sends an event name the catalogue lacks.
58
58
 
59
+ `SEARCH_RESULTS` records a completed list search, including zero results, with a fresh `search_id`, `result_count`,
60
+ `has_keyword`, `mode`, sorted non-default `filter_keys`, coarse `geo` (`none`, `place`, `ip` or `map_area`) and arrival
61
+ `page`. It uses `analytics.log({ ..., page_context: 'no_query' })`: page href and referrer contain only origin plus
62
+ pathname, and title is omitted. It contains no query text, filter values, place label or coordinates.
63
+ Job search needs a host on `@inploi/sdk` 3.1.0 or later advertising `analytics.supportsNoQueryPageContext: true`;
64
+ otherwise SEARCH_RESULTS is silently not sent. Every analytics service created by this version advertises it,
65
+ including `persistence: 'none'`. The property is optional on `AnalyticsService` for older hosts.
66
+ See [search counting](../plugin-job-search/README.md#search-analytics).
67
+
68
+ The optional `page_context: 'no_query'` applies to one log call, including queued or server-request logs. Other calls
69
+ retain their full href, referrer and title. Host-authored filter keys must be non-sensitive configuration metadata.
70
+
59
71
  `SAVE_JOB` records a candidate saving or unsaving a job, with `{ job_id: number, saved: boolean }`. Job search
60
72
  sends it through the same injected `analytics.log` service as `SEARCH_JOB_CLICK`, so it follows the host's
61
73
  persistence lane and consent choices. It adds no title or candidate content. Bookmark storage is separate from
package/cdn/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // This is an inploi sdk script. Learn more at https://inploi.com
2
2
 
3
- "use strict";(()=>{var Hn=Object.defineProperty,Xn=Object.defineProperties;var $n=Object.getOwnPropertyDescriptors;var pn=Object.getOwnPropertySymbols;var Yn=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable;var fn=(e,t,n)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))Yn.call(t,n)&&fn(e,n,t[n]);if(pn)for(var n of pn(t))Zn.call(t,n)&&fn(e,n,t[n]);return e},G=(e,t)=>Xn(e,$n(t));var Qn=(e,t)=>()=>(e&&(t=e(e=0)),t);var F=(e,t,n)=>new Promise((r,s)=>{var o=u=>{try{p(n.next(u))}catch(y){s(y)}},a=u=>{try{p(n.throw(u))}catch(y){s(y)}},p=u=>u.done?r(u.value):Promise.resolve(u.value).then(o,a);p((n=n.apply(e,t)).next())});var Mn=Qn(()=>{"use strict"});function qe(e,t){if(!e)throw new Error(t)}function ie(e,t){return t in e}var lr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var _e="%c[inploi SDK]",xe="color: #65BC67; font-weight: bold;",Me={warn:(...e)=>console.warn(_e,xe,...e),error:(...e)=>console.error(_e,xe,...e),info:(...e)=>console.info(_e,xe,...e),log:(...e)=>console.log(_e,xe,...e)},Ge={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var et="Unauthenticated",nt="This action is unauthorized.",Q=class extends Error{constructor(n,r){super(n);this.status=r,this.name="ErrorWithStatus"}},pe=class extends Q{constructor(t){super(t!=null?t:"Not found"),this.name="NotFoundError",this.status=404}},fe=class extends Q{constructor(t,n){super(t!=null?t:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},Z=class extends Q{constructor(n,r){let s=r?` in ${r}`:"";super(`Schema validation failed${s}`);this.issues=n;this.source=r;this.name="SchemaValidationError",this.status=400}},Ee=class extends Q{constructor(n,r,s){super(n);this.data=s;this.name="ApiError",this.status=r!=null?r:500}};var ye=class extends Q{constructor(n){var r;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(r=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?r:void 0}};function Be(e){return F(this,null,function*(){let t=new Headers(e.headers).get("content-type"),n=t==null?void 0:t.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new ye(e);return e.json().catch(()=>{throw new ye(e)})})}var tt=["message","error","errors","exception","exceptions"];function rt(e){let t=[];if(typeof e=="object"&&e!==null){for(let n of tt)if(ie(e,n)){let r=e[n];typeof r=="string"&&t.push(r),Array.isArray(r)&&r.every(s=>typeof s=="string")&&t.push(...r)}ie(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&ie(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&ie(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&t.push(e.integration_response.error.message)}return t.length===0&&t.push("Unknown error"),[...new Set(t)].join(", ")}function ze(e,t){if(t>=300){let n=rt(e);throw t===404?new pe(n):n===et?new fe("You are not authenticated.",t):n===nt?new fe(n,t):new Ee(n,t,e)}}var yn=e=>{let t={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(s,...o)=>F(void 0,[s,...o],function*(n,r={}){let a=G(O({},r),{headers:O(O({},r.headers),t)}),p=yield fetch(`${e.baseUrl}${n}`,a);if(p.status===404)throw new pe;let u=yield Be(p);return ze(u,p.status),u})}};var mn="3.0.1";var we={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var dn=mn;var H="isdk_session",hn=`${H}-candidate_id`,st=`${H}-consent`;var Ke="RFC3986",Je={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},ot="RFC1738";var ut=Array.isArray,B=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var Ue=1024,at=(e,t,n,r,s)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});let a="";for(let p=0;p<o.length;p+=Ue){let u=o.length>=Ue?o.slice(p,p+Ue):o,y=[];for(let d=0;d<u.length;++d){let f=u.charCodeAt(d);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||s===ot&&(f===40||f===41)){y[y.length]=u.charAt(d);continue}if(f<128){y[y.length]=B[f];continue}if(f<2048){y[y.length]=B[192|f>>6]+B[128|f&63];continue}if(f<55296||f>=57344){y[y.length]=B[224|f>>12]+B[128|f>>6&63]+B[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|u.charCodeAt(d)&1023),y[y.length]=B[240|f>>18]+B[128|f>>12&63]+B[128|f>>6&63]+B[128|f&63]}a+=y.join("")}return a};function lt(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function vn(e,t){if(ut(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var Er=Array.isArray;var ct=Object.prototype.hasOwnProperty,gn={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},z=Array.isArray,pt=Array.prototype.push,bn=function(e,t){pt.apply(e,z(t)?t:[t])},ft=Date.prototype.toISOString,R={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:at,encodeValuesOnly:!1,format:Ke,formatter:Je[Ke],indices:!1,serializeDate(e){return ft.call(e)},skipNulls:!1,strictNullHandling:!1};function yt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var Ve={};function kn(e,t,n,r,s,o,a,p,u,y,d,f,S,c,k,j,x,D){let g=e,T=D,$=0,le=!1;for(;(T=T.get(Ve))!==void 0&&!le;){let P=T.get(e);if($+=1,typeof P!="undefined"){if(P===$)throw new RangeError("Cyclic object value");le=!0}typeof T.get(Ve)=="undefined"&&($=0)}if(typeof y=="function"?g=y(t,g):g instanceof Date?g=S==null?void 0:S(g):n==="comma"&&z(g)&&(g=vn(g,function(P){return P instanceof Date?S==null?void 0:S(P):P})),g===null){if(o)return u&&!j?u(t,R.encoder,x,"key",c):t;g=""}if(yt(g)||lt(g)){if(u){let P=j?t:u(t,R.encoder,x,"key",c);return[(k==null?void 0:k(P))+"="+(k==null?void 0:k(u(g,R.encoder,x,"value",c)))]}return[(k==null?void 0:k(t))+"="+(k==null?void 0:k(String(g)))]}let ce=[];if(typeof g=="undefined")return ce;let E;if(n==="comma"&&z(g))j&&u&&(g=vn(g,u)),E=[{value:g.length>0?g.join(",")||null:void 0}];else if(z(y))E=y;else{let P=Object.keys(g);E=d?P.sort(d):P}let Y=p?String(t).replace(/\./g,"%2E"):String(t),re=r&&z(g)&&g.length===1?Y+"[]":Y;if(s&&z(g)&&g.length===0)return re+"[]";for(let P=0;P<E.length;++P){let W=E[P],ln=typeof W=="object"&&typeof W.value!="undefined"?W.value:g[W];if(a&&ln===null)continue;let Fe=f&&p?W.replace(/\./g,"%2E"):W,Wn=z(g)?typeof n=="function"?n(re,Fe):re:re+(f?"."+Fe:"["+Fe+"]");D.set(e,$);let cn=new WeakMap;cn.set(Ve,D),bn(ce,kn(ln,Wn,n,r,s,o,a,p,n==="comma"&&j&&z(g)?null:u,y,d,f,S,c,k,j,x,cn))}return ce}function mt(e=R){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let t=e.charset||R.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=Ke;if(typeof e.format!="undefined"){if(!ct.call(Je,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let r=Je[n],s=R.filter;(typeof e.filter=="function"||z(e.filter))&&(s=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in gn?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=R.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:R.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:R.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:R.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:R.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?R.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:R.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:R.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:R.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:R.encodeValuesOnly,filter:s,format:n,formatter:r,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:R.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:R.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:R.strictNullHandling}}function _n(e,t={}){let n=e,r=mt(t),s,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):z(r.filter)&&(o=r.filter,s=o);let a=[];if(typeof n!="object"||n===null)return"";let p=gn[r.arrayFormat],u=p==="comma"&&r.commaRoundTrip;s||(s=Object.keys(n)),r.sort&&s.sort(r.sort);let y=new WeakMap;for(let S=0;S<s.length;++S){let c=s[S];r.skipNulls&&n[c]===null||bn(a,kn(n[c],c,p,u,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,y))}let d=a.join(r.delimiter),f=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),d.length>0?f+d:""}function We(e,t,n){let r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Async schema");if(r.issues)throw new Z(r.issues,n);return r.value}function dt(e,t,n){try{return{success:!0,output:We(e,t,n)}}catch(r){if(r instanceof Z)return{success:!1,issues:r.issues,source:r.source};throw r}}var me=class{constructor(t){if(this.baseUrl=we[t.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),t.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",t.apiKey.key)}else this.headers.set("x-publishable-key",t.apiKey.key);this.logger=t.logger,this._environment=t.environment}get environment(){return this._environment}getFetchParams(t,n){var u;let r=(u=n.validateIn)!=null?u:!0,{searchParams:s,body:o}=r?xn(t,n):n,a=new URL(this.baseUrl),p=t.pathname;if("params"in n&&n.params)for(let[y,d]of Object.entries(n.params))p=p.replace(`:${y}`,String(d));return a.pathname=p,t.schema.searchParams&&(a.search=_n(s)),[a.toString(),O({method:t.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(t,n){return F(this,null,function*(){var a;let r=yield Be(n.response);if(ze(r,n.response.status),!((a=n.validateOut)!=null?a:!0))return r;let o=dt(t.schema.response,r,"response");if(!o.success)throw new Z(o.issues,o.source);return o.output})}request(t,n){return F(this,null,function*(){try{let r=this.getFetchParams(t,n),s=yield fetch(...r);return yield this.parseResponse(t,{response:s,validateOut:n.validateOut})}catch(r){throw r instanceof Z?this.logger.error(r.message,r.issues):this.logger.error(r),r}})}};function ee(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function xn(e,t){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=We(e.schema.searchParams,"searchParams"in t?t.searchParams:{})),e.schema.body&&(n.body=We(e.schema.body,"body"in t?t.body:{})),n}var U,ht={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function vt(e){var t,n,r;return!e&&!U?ht:{lang:(t=e==null?void 0:e.lang)!=null?t:U==null?void 0:U.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:U==null?void 0:U.abortEarly,abortPipeEarly:(r=e==null?void 0:e.abortPipeEarly)!=null?r:U==null?void 0:U.abortPipeEarly}}var He;function gt(e){return He==null?void 0:He.get(e)}var Xe;function bt(e){return Xe==null?void 0:Xe.get(e)}var $e;function kt(e,t){var n;return(n=$e==null?void 0:$e.get(e))==null?void 0:n.get(t)}function ne(e){var n,r,s;let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(s=e&&((r=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:r.name))!=null?s:"null":t}function I(e,t,n,r,s){var f,S,c,k,j,x,D,g;let o=s&&"input"in s?s.input:n.value,a=(S=(f=s==null?void 0:s.expected)!=null?f:e.expects)!=null?S:null,p=(c=s==null?void 0:s.received)!=null?c:ne(o),u={kind:e.kind,type:e.type,input:o,expected:a,received:p,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${p}`,requirement:e.requirement,path:s==null?void 0:s.path,issues:s==null?void 0:s.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},y=e.kind==="schema",d=(g=(D=(x=(j=(k=s==null?void 0:s.message)!=null?k:e.message)!=null?j:kt(e.reference,u.lang))!=null?x:y?bt(u.lang):null)!=null?D:r.message)!=null?g:gt(u.lang);d!==void 0&&(u.message=typeof d=="function"?d(u):d),y&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}var En=new WeakMap;function C(e){let t=En.get(e);return t||(t={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},vt())}},En.set(e,t)),t}function _t(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function Ye(e,t){var r;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:(r=n[0])!=null?r:"never"}var xt=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,jr=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function Ze(e,t){return{kind:"validation",type:"check",reference:Ze,async:!1,expects:null,requirement:e,message:t,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&I(this,"input",n,r),n}}}function Qe(e){return{kind:"validation",type:"email",reference:Qe,expects:null,async:!1,requirement:xt,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&I(this,"email",t,n),t}}}function se(e){return{kind:"validation",type:"integer",reference:se,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&I(this,"integer",t,n),t}}}function Se(e,t){return{kind:"validation",type:"max_length",reference:Se,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length>this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function en(e,t){return{kind:"validation",type:"max_value",reference:en,async:!1,expects:`<=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value<=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function N(e,t){return{kind:"validation",type:"min_length",reference:N,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length<this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function oe(e,t){return{kind:"validation",type:"min_value",reference:oe,async:!1,expects:`>=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value>=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function Ae(e){return{kind:"transformation",type:"transform",reference:Ae,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function Ie(){return{kind:"transformation",type:"trim",reference:Ie,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}var Et={abortEarly:!0};function wt(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function Te(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function L(e,t){return{kind:"schema",type:"array",reference:L,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let a=0;a<s.length;a++){let p=s[a],u=this.item["~run"]({value:p},r);if(u.issues){let y={type:"array",origin:"value",input:s,key:a,value:p};for(let d of u.issues)d.path?d.path.unshift(y):d.path=[y],(o=n.issues)==null||o.push(d);if(n.issues||(n.issues=u.issues),r.abortEarly){n.typed=!1;break}}u.typed||(n.typed=!1),n.value.push(u.value)}}else I(this,"type",n,r);return n}}}function de(e){return{kind:"schema",type:"boolean",reference:de,expects:"boolean",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:I(this,"type",t,n),t}}}function _(e,t){return{kind:"schema",type:"literal",reference:_,expects:ne(e),async:!1,literal:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===this.literal?n.typed=!0:I(this,"type",n,r),n}}}function m(e,t){return{kind:"schema",type:"nullable",reference:m,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===null&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function h(e,t){return{kind:"schema",type:"nullish",reference:h,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function b(e){return{kind:"schema",type:"number",reference:b,expects:"number",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:I(this,"type",t,n),t}}}function l(e,t){return{kind:"schema",type:"object",reference:l,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let a in this.entries){let p=this.entries[a];if(a in s||(p.type==="exact_optional"||p.type==="optional"||p.type==="nullish")&&p.default!==void 0){let u=a in s?s[a]:Te(p),y=p["~run"]({value:u},r);if(y.issues){let d={type:"object",origin:"value",input:s,key:a,value:u};for(let f of y.issues)f.path?f.path.unshift(d):f.path=[d],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=y.issues),r.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value[a]=y.value}else if(p.fallback!==void 0)n.value[a]=wt(p);else if(p.type!=="exact_optional"&&p.type!=="optional"&&p.type!=="nullish"&&(I(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:s,key:a,value:s[a]}]}),r.abortEarly))break}}else I(this,"type",n,r);return n}}}function v(e,t){return{kind:"schema",type:"optional",reference:v,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function A(e,t){return{kind:"schema",type:"picklist",reference:A,expects:Ye(e.map(ne),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return this.options.includes(n.value)?n.typed=!0:I(this,"type",n,r),n}}}function V(e,t,n){return{kind:"schema",type:"record",reference:V,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){var a,p;let o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(let u in o)if(_t(o,u)){let y=o[u],d=this.key["~run"]({value:u},s);if(d.issues){let S={type:"object",origin:"key",input:o,key:u,value:y};for(let c of d.issues)c.path=[S],(a=r.issues)==null||a.push(c);if(r.issues||(r.issues=d.issues),s.abortEarly){r.typed=!1;break}}let f=this.value["~run"]({value:y},s);if(f.issues){let S={type:"object",origin:"value",input:o,key:u,value:y};for(let c of f.issues)c.path?c.path.unshift(S):c.path=[S],(p=r.issues)==null||p.push(c);if(r.issues||(r.issues=f.issues),s.abortEarly){r.typed=!1;break}}(!d.typed||!f.typed)&&(r.typed=!1),d.typed&&(r.value[d.value]=f.value)}}else I(this,"type",r,s);return r}}}function i(e){return{kind:"schema",type:"string",reference:i,expects:"string",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:I(this,"type",t,n),t}}}function wn(e){let t;if(e)for(let n of e)if(t)for(let r of n.issues)t.push(r);else t=n.issues;return t}function he(e,t){return{kind:"schema",type:"union",reference:he,expects:Ye(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){let s,o,a;for(let p of this.options){let u=p["~run"]({value:n.value},r);if(u.typed)if(u.issues)o?o.push(u):o=[u];else{s=u;break}else a?a.push(u):a=[u]}if(s)return s;if(o){if(o.length===1)return o[0];I(this,"type",n,r,{issues:wn(o)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];I(this,"type",n,r,{issues:wn(a)})}return n}}}function nn(){return{kind:"schema",type:"unknown",reference:nn,expects:"unknown",async:!1,get"~standard"(){return C(this)},"~run"(e){return e.typed=!0,e}}}function ue(e,t,n){return{kind:"schema",type:"variant",reference:ue,expects:"Object",async:!1,key:e,options:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){let o=r.value;if(o&&typeof o=="object"){let a,p=0,u=this.key,y=[],d=(f,S)=>{for(let c of f.options){if(c.type==="variant")d(c,new Set(S).add(c.key));else{let k=!0,j=0;for(let x of S){let D=c.entries[x];if(x in o?D["~run"]({typed:!1,value:o[x]},Et).issues:D.type!=="exact_optional"&&D.type!=="optional"&&D.type!=="nullish"){k=!1,u!==x&&(p<j||p===j&&x in o&&!(u in o))&&(p=j,u=x,y=[]),u===x&&y.push(c.entries[x].expects);break}j++}if(k){let x=c["~run"]({value:o},s);(!a||!a.typed&&x.typed)&&(a=x)}}if(a&&!a.issues)break}};if(d(this,new Set([this.key])),a)return a;I(this,"type",r,s,{input:o[u],expected:Ye(y,"|"),path:[{type:"object",origin:"value",input:o,key:u,value:o[u]}]})}else I(this,"type",r,s);return r}}}function w(...e){return G(O({},e[0]),{pipe:e,get"~standard"(){return C(this)},"~run"(t,n){for(let r of e)if(r.kind!=="metadata"){if(t.issues&&(r.kind==="schema"||r.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r["~run"](t,n))}return t}})}var St=["agent","sdk","form","integration","migration"],At=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var It=["screening","cv_match","interview","overall"],Tt=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],Pt=["job","company"],Rt=["created_at","updated_at"],jt=["asc","desc"],Dt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Ot=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],Ct=["user","system","automation","integration","candidate"],Pe=A(St),J=A(At),M=w(i(),Ie(),N(1),Se(100)),Re=A(It),Sn=A(Tt),Or=A(Pt),An=A(Rt),In=A(jt),ve=w(i(),Ie(),N(1),Se(100)),je=A(Dt),Tn=A(Ot),Pn=A(Ct);var q=ue("type",[l({type:_("user"),id:w(i(),N(1)),email:w(i(),N(1)),name:w(i(),N(1))}),l({type:_("system"),id:w(i(),N(1)),name:v(i())}),l({type:_("automation"),id:w(i(),N(1)),name:v(i())}),l({type:_("integration"),id:w(i(),N(1)),name:v(i())}),l({type:_("candidate"),id:w(i(),N(1)),email:v(i())})]);var Nt=l({total:b(),page:b(),perPage:b(),lastPage:b()});function De(e){return l({data:L(e),pagination:Nt})}var ge=l({id:i(),email:m(i()),firstName:m(i()),lastName:m(i()),phone:m(i()),source:m(Pe),identifiedAt:m(i()),createdAt:i(),updatedAt:i()});var ae=w(i(),N(1)),Rn=w(b(),se(),oe(1)),X=V(i(),nn());var jn=l({id:i(),applicationId:i(),status:Sn,scheduledAt:m(i()),completedAt:m(i()),meta:m(X),createdAt:i(),updatedAt:i()});var tn=l({score:b(),reason:i(),confidence:b()}),Dn=l({id:i(),candidateId:i(),jobId:b(),stage:M,stageGroup:J,stageEnteredAt:i(),rating:m(b()),disqualifiedAt:m(i()),disqualificationReason:m(ve),disqualificationNote:m(i()),source:je,sourceDetail:m(i()),sessionId:m(b()),externalApplicationId:m(i()),meta:m(X),context:m(X),scoredAt:m(i()),createdAt:i(),updatedAt:i()}),Lt=l({id:i(),applicationId:i(),scoreType:Re,score:m(b()),reason:m(i()),categories:m(V(i(),tn)),scoredBy:m(i()),createdAt:i()}),Oe=l(G(O({},Dn.entries),{candidate:m(ge),score:m(Lt),interview:m(jn)})),Ft=l(G(O({},ge.entries),{applications:L(Dn)})),On=l({id:i(),applicationId:i(),action:Tn,fromStage:m(M),fromStageGroup:m(J),toStage:m(M),toStageGroup:m(J),disqualificationReason:m(ve),disqualificationNote:m(i()),actorId:m(i()),actorType:Pn,actorEmail:m(i()),actorName:m(i()),meta:m(X),schemaVersion:b(),createdAt:i()});var qt=l({anonymousId:ae,email:ae,firstName:h(i()),lastName:h(i()),phone:h(i()),source:h(Pe)}),Mt=l({candidateId:i(),isNew:de()});var Gt=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],Ne=A(Gt),Cn=w(i(),Ae(e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0))),Bt=w(Cn,L(M)),zt=w(Cn,L(J)),Nn=w(i(),Ae(e=>e.split(",").map(t=>Number(t.trim())).filter(t=>Number.isInteger(t)&&t>0))),ni=l({stages:v(Bt),stage_groups:v(zt),job_id:v(i()),job_ids:v(Nn),candidate_id:v(i()),is_disqualified:v(A(["true","false"])),created_from:v(i()),created_to:v(i()),updated_from:v(i()),updated_to:v(i()),entered_stage_from:v(i()),entered_stage_to:v(i()),from:v(i()),to:v(i()),q:v(i()),scored:v(A(["true","false"])),sort:v(An),order:v(In),page:v(i()),per_page:v(i())}),ti=w(l({candidateId:ae,jobId:Rn,meta:h(X),sessionId:h(b()),externalApplicationId:h(i()),context:h(X),source:h(je),sourceDetail:h(i()),stage:h(M),stageGroup:h(J),actor:h(q)}),Ze(e=>e.stage==null==(e.stageGroup==null),"stage and stageGroup must be supplied together")),Ln=l({id:i(),stageGroup:i(),createdAt:i()}),ri=he([l({ok:_(!0),duplicate:_(!1),applicationId:i(),candidateId:i()}),l({ok:_(!0),duplicate:_(!0),existingApplication:Ln})]),Ut=l({isDuplicate:de(),existingApplication:v(Ln)}),ii=l({applicationId:ae,scoreType:Re,score:b(),reason:h(i()),categories:h(V(i(),tn)),scoredBy:h(i()),actor:h(q)}),si=l({scoreId:i()}),oi=De(Oe);var ui=A(["already_in_target_stage","not_in_source_stage","disqualified"]),ai=L(On),Ce=l({stage:h(M),note:h(i())}),Vt=l({stage:h(M),startDate:h(i()),note:h(i())}),Kt=ue("action",[l({action:_("shortlist"),actor:q,meta:h(Ce)}),l({action:_("move_to_interview"),actor:q,meta:h(Ce)}),l({action:_("make_offer"),actor:q,meta:h(Ce)}),l({action:_("hire"),actor:q,meta:h(Vt)}),l({action:_("withdraw"),actor:q,meta:h(Ce)}),l({action:_("move_to_stage"),actor:q,meta:l({stage:M,stageGroup:J,note:h(i())})}),l({action:_("stage_transition"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("disqualify"),actor:q,meta:l({reason:ve,note:h(i())})}),l({action:_("reinstate"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("rate"),actor:q,meta:l({rating:m(w(b(),se(),oe(1),en(5)))})})]),li=l({applicationIds:w(L(i()),N(1)),body:Kt}),Fn=A(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),ci=ue("kind",[l({kind:_("updated"),action:Ne,application:Oe}),l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Fn})]),pi=l({updated:L(l({kind:_("updated"),action:Ne,application:Oe})),skipped:L(l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Fn})),failed:L(l({applicationId:i(),error:i()}))}),te=w(b(),se(),oe(0)),Jt=l({APPLIED:te,SHORTLISTED:te,INTERVIEWED:te,OFFERED:te,HIRED:te,REJECTED:te,WITHDRAWN:te}),fi=l({job_ids:Nn}),yi=l({counts:V(i(),Jt)});var gi=De(ge);var ki=l({avg_score:m(b()),p90_score:m(b()),p85_score:m(b()),p80_score:m(b()),total_scores:b(),total_shortlists:b()});var be=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function rn(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var qn=["DAILY","WEEKLY","MONTHLY"],Wt=V(i(),he([i(),L(i()),l({type:_("provided"),lat:b(),lng:b(),radius:b(),unit:v(A(["miles","km"])),label:v(i())})])),Vi={pathname:"/job/:id",method:"GET",schema:{response:l({id:b(),external_id:h(i()),city:h(i()),town:h(i()),category:h(i())})}};var Ht={pathname:"/search/save",method:"POST",schema:{response:ee(),body:l({contact:l({email:w(v(i()),i(),Qe()),first_name:v(i()),last_name:v(i())}),alerts:w(v(i()),i(),A(qn)),filters:Wt})}};Mn();var Le=new Map,un={get:e=>{var t;if(Le.has(e))return(t=Le.get(e))!=null?t:null;try{return window.sessionStorage.getItem(e)}catch(n){return null}},set:(e,t)=>{try{window.sessionStorage.setItem(e,t),Le.delete(e)}catch(n){Le.set(e,t)}}};var zn=7*24*60*60*1e3,Un=e=>{let t=new Date;return t.setTime(t.getTime()+zn),`${H}=${e};expires=${t.toUTCString()};path=/`},Xt=(e,t)=>{let n=e.get("session_id");if(t||n)return n;let r=un.get(`${H}-session_id`);return typeof r=="string"?r:null},$t=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(hn);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Yt=new RegExp(`(?:^|;\\s*)${H}=([^;]+)`),ke=e=>{var n,r;let t=e?e.headers.get("cookie"):document.cookie;return t&&(r=(n=Yt.exec(t))==null?void 0:n[1])!=null?r:null},Vn=()=>{var e;try{let t=JSON.parse((e=window.localStorage.getItem(H))!=null?e:"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch(t){return null}},Bn=()=>{var e;return(e=ke())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:Vn()},Zt=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",Kn=e=>{if(document.cookie=Un(e)+Zt(),ke()!==e)try{window.localStorage.setItem(H,JSON.stringify({id:e,expires:Date.now()+zn}))}catch(t){}},an=e=>{var r,s,o;let t=e?e.url:location.href,{searchParams:n}=new URL(t);return{anonymous_id:e?(r=ke(e))!=null?r:n.get("anonymous_id"):(o=(s=ke())!=null?s:n.get("anonymous_id"))!=null?o:Vn(),session_id:Xt(n,typeof window=="undefined")}},Gn=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=an().anonymous_id;if(e)return e;let t=be(),n=an().anonymous_id;return n||(Kn(t),t)},Qt=e=>typeof e!="object"||e===null?null:{anonymous_id:"anonymous_id"in e&&typeof e.anonymous_id=="string"?e.anonymous_id:null,session_id:"session_id"in e&&typeof e.session_id=="string"?e.session_id:null},er=e=>e==="about:client"?"":e,nr={pathname:"/log",method:"POST",schema:{response:ee(),body:ee()}},Jn=({rpcClient:e,logger:t,onEvent:n,persistence:r="device",siteKind:s})=>{let o=null,a=null,p=0,u=0,y=c=>r==="none"?{anonymous_id:null,session_id:c?null:o}:an(c),d=(c,k,j)=>F(void 0,null,function*(){try{let x={library:{name:"inploi-sdk",version:dn},page:k},D=y(c.request),g=r==="none"?null:$t(),T={anonymous_id:D.anonymous_id,session_id:D.session_id,candidate_id:g,event:c.event,sent_at:new Date().toISOString(),context:x,properties:c.properties,custom_properties:O(O({},c.customProperties),j)},$=r==="none"?null:c.request?ke(c.request):Bn(),le=++p,ce=yield e.request(nr,O({body:T},c.keepalive&&{keepalive:!0})),E=Qt(ce);if(r==="none")return!c.request&&(E!=null&&E.session_id)&&le>u&&(u=le,E.session_id!==T.session_id&&(o=E.session_id)),T.session_id=c.request?(E==null?void 0:E.session_id)||null:o,n==null||n(T),{success:!0,data:T};let Y=c.request?$:Bn(),re=Y!==null&&Y!==$,P=Y!=null?Y:$,W=!re&&(!P||!(E!=null&&E.anonymous_id)||P===E.anonymous_id);return W?(E!=null&&E.anonymous_id&&(T.anonymous_id=E.anonymous_id),E!=null&&E.session_id&&(T.session_id=E.session_id)):T.anonymous_id=P,!c.request&&typeof window!="undefined"&&T.anonymous_id&&(W&&T.session_id&&un.set(`${H}-session_id`,T.session_id.toString()),Kn(T.anonymous_id)),n==null||n(T),{success:!0,data:T}}catch(x){return t.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:x}}}),f=Promise.resolve();return{log:c=>F(void 0,null,function*(){qe(c.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let k="request"in c&&c.request?{href:c.request.url,referrer:er(c.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};r==="none"&&c.event==="FLOW_NODE"&&c.properties&&"trigger"in c.properties&&(c.properties.trigger==="pagehide"||c.properties.trigger==="hidden")&&(c=G(O({},c),{keepalive:!0}));let j={event_id:be(),consent_lane:r,site_kind:s};if(r==="device"||c.request||o||c.keepalive)return d(c,k,j);let x=()=>d(c,k,j),D=f.then(x,x);return f=D,D}),getHeaders:c=>{let k=new Headers;return r==="none"||!(c!=null&&c.anonymous_id)||k.append("Set-Cookie",Un(c.anonymous_id)),k},getSessionInfo:y,getOrCreateAnonymousId:()=>r==="none"?a!=null?a:a=be():Gn()}};function on({publishableKey:e,env:t,logger:n=Me,onEvent:r,persistence:s,siteKind:o}){let a=yn({baseUrl:we[t],publishableKey:e}),p=n===!1?Ge:n,u=new me({environment:t,apiKey:{type:"publishable",key:e},logger:p}),y=Jn({rpcClient:u,logger:p,onEvent:r,persistence:s,siteKind:o});return{register:f=>f({logger:p,apiClient:a,analytics:y,rpcClient:u,publishableKey:e,env:t}),analytics:y,apiClient:a}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=on;window.inploi.ready=rn;})();
3
+ "use strict";(()=>{var on=Object.defineProperty,un=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var Ce=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable;var Ne=(e,r,n)=>r in e?on(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,w=(e,r)=>{for(var n in r||(r={}))ln.call(r,n)&&Ne(e,n,r[n]);if(Ce)for(var n of Ce(r))cn.call(r,n)&&Ne(e,n,r[n]);return e},F=(e,r)=>un(e,an(r));var pn=(e,r)=>()=>(e&&(r=e(e=0)),r);var x=(e,r,n)=>new Promise((t,i)=>{var o=s=>{try{c(n.next(s))}catch(p){i(p)}},u=s=>{try{c(n.throw(s))}catch(p){i(p)}},c=s=>s.done?t(s.value):Promise.resolve(s.value).then(o,u);c((n=n.apply(e,r)).next())});var $e=pn(()=>{"use strict"});function oe(e,r){if(!e)throw new Error(r)}function B(e,r){return r in e}var Qn=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Q="%c[inploi SDK]",ee="color: #65BC67; font-weight: bold;",ue={warn:(...e)=>console.warn(Q,ee,...e),error:(...e)=>console.error(Q,ee,...e),info:(...e)=>console.info(Q,ee,...e),log:(...e)=>console.log(Q,ee,...e)},ae={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var fn="Unauthenticated",yn="This action is unauthorized.",q=class extends Error{constructor(n,t){super(n);this.status=t,this.name="ErrorWithStatus"}},W=class extends q{constructor(r){super(r!=null?r:"Not found"),this.name="NotFoundError",this.status=404}},H=class extends q{constructor(r,n){super(r!=null?r:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},N=class extends q{constructor(n,t){let i=t?` in ${t}`:"";super(`Schema validation failed${i}`);this.issues=n;this.source=t;this.name="SchemaValidationError",this.status=400}},ne=class extends q{constructor(n,t,i){super(n);this.data=i;this.name="ApiError",this.status=t!=null?t:500}};var X=class extends q{constructor(n){var t;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(t=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?t:void 0}};function le(e){return x(this,null,function*(){let r=new Headers(e.headers).get("content-type"),n=r==null?void 0:r.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new X(e);return e.json().catch(()=>{throw new X(e)})})}var dn=["message","error","errors","exception","exceptions"];function hn(e){let r=[];if(typeof e=="object"&&e!==null){for(let n of dn)if(B(e,n)){let t=e[n];typeof t=="string"&&r.push(t),Array.isArray(t)&&t.every(i=>typeof i=="string")&&r.push(...t)}B(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&B(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&B(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&r.push(e.integration_response.error.message)}return r.length===0&&r.push("Unknown error"),[...new Set(r)].join(", ")}function ce(e,r){if(r>=300){let n=hn(e);throw r===404?new W(n):n===fn?new H("You are not authenticated.",r):n===yn?new H(n,r):new ne(n,r,e)}}var Le=e=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(i,...o)=>x(void 0,[i,...o],function*(n,t={}){let u=F(w({},t),{headers:w(w({},t.headers),r)}),c=yield fetch(`${e.baseUrl}${n}`,u);if(c.status===404)throw new W;let s=yield le(c);return ce(s,c.status),s})}};var Fe="3.1.1";var re={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var qe=Fe;var D="isdk_session",Me=`${D}-candidate_id`,vn=`${D}-consent`;var ye="RFC3986",de={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},gn="RFC1738";var bn=Array.isArray,T=(()=>{let e=[];for(let r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e})();var pe=1024,kn=(e,r,n,t,i)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let u="";for(let c=0;c<o.length;c+=pe){let s=o.length>=pe?o.slice(c,c+pe):o,p=[];for(let f=0;f<s.length;++f){let l=s.charCodeAt(f);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===gn&&(l===40||l===41)){p[p.length]=s.charAt(f);continue}if(l<128){p[p.length]=T[l];continue}if(l<2048){p[p.length]=T[192|l>>6]+T[128|l&63];continue}if(l<55296||l>=57344){p[p.length]=T[224|l>>12]+T[128|l>>6&63]+T[128|l&63];continue}f+=1,l=65536+((l&1023)<<10|s.charCodeAt(f)&1023),p[p.length]=T[240|l>>18]+T[128|l>>12&63]+T[128|l>>6&63]+T[128|l&63]}u+=p.join("")}return u};function _n(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function ze(e,r){if(bn(e)){let n=[];for(let t=0;t<e.length;t+=1)n.push(r(e[t]));return n}return r(e)}var yr=Array.isArray;var wn=Object.prototype.hasOwnProperty,Be={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,r){return String(e)+"["+r+"]"},repeat(e){return String(e)}},P=Array.isArray,xn=Array.prototype.push,Ge=function(e,r){xn.apply(e,P(r)?r:[r])},En=Date.prototype.toISOString,b={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:kn,encodeValuesOnly:!1,format:ye,formatter:de[ye],indices:!1,serializeDate(e){return En.call(e)},skipNulls:!1,strictNullHandling:!1};function An(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var fe={};function Ue(e,r,n,t,i,o,u,c,s,p,f,l,v,a,d,E,_,A){let y=e,m=A,R=0,K=!1;for(;(m=m.get(fe))!==void 0&&!K;){let g=m.get(e);if(R+=1,typeof g!="undefined"){if(g===R)throw new RangeError("Cyclic object value");K=!0}typeof m.get(fe)=="undefined"&&(R=0)}if(typeof p=="function"?y=p(r,y):y instanceof Date?y=v==null?void 0:v(y):n==="comma"&&P(y)&&(y=ze(y,function(g){return g instanceof Date?v==null?void 0:v(g):g})),y===null){if(o)return s&&!E?s(r,b.encoder,_,"key",a):r;y=""}if(An(y)||_n(y)){if(s){let g=E?r:s(r,b.encoder,_,"key",a);return[(d==null?void 0:d(g))+"="+(d==null?void 0:d(s(y,b.encoder,_,"value",a)))]}return[(d==null?void 0:d(r))+"="+(d==null?void 0:d(String(y)))]}let J=[];if(typeof y=="undefined")return J;let h;if(n==="comma"&&P(y))E&&s&&(y=ze(y,s)),h=[{value:y.length>0?y.join(",")||null:void 0}];else if(P(p))h=p;else{let g=Object.keys(y);h=f?g.sort(f):g}let C=c?String(r).replace(/\./g,"%2E"):String(r),z=t&&P(y)&&y.length===1?C+"[]":C;if(i&&P(y)&&y.length===0)return z+"[]";for(let g=0;g<h.length;++g){let j=h[g],De=typeof j=="object"&&typeof j.value!="undefined"?j.value:y[j];if(u&&De===null)continue;let se=l&&c?j.replace(/\./g,"%2E"):j,sn=P(y)?typeof n=="function"?n(z,se):z:z+(l?"."+se:"["+se+"]");A.set(e,R);let Re=new WeakMap;Re.set(fe,A),Ge(J,Ue(De,sn,n,t,i,o,u,c,n==="comma"&&E&&P(y)?null:s,p,f,l,v,a,d,E,_,Re))}return J}function Sn(e=b){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let r=e.charset||b.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=ye;if(typeof e.format!="undefined"){if(!wn.call(de,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let t=de[n],i=b.filter;(typeof e.filter=="function"||P(e.filter))&&(i=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in Be?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=b.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let u=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:b.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:b.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:b.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:b.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?b.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:b.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:b.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:b.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:b.encodeValuesOnly,filter:i,format:n,formatter:t,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:b.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:b.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:b.strictNullHandling}}function Ve(e,r={}){let n=e,t=Sn(r),i,o;typeof t.filter=="function"?(o=t.filter,n=o("",n)):P(t.filter)&&(o=t.filter,i=o);let u=[];if(typeof n!="object"||n===null)return"";let c=Be[t.arrayFormat],s=c==="comma"&&t.commaRoundTrip;i||(i=Object.keys(n)),t.sort&&i.sort(t.sort);let p=new WeakMap;for(let v=0;v<i.length;++v){let a=i[v];t.skipNulls&&n[a]===null||Ge(u,Ue(n[a],a,c,s,t.allowEmptyArrays,t.strictNullHandling,t.skipNulls,t.encodeDotInKeys,t.encode?t.encoder:null,t.filter,t.sort,t.allowDots,t.serializeDate,t.format,t.formatter,t.encodeValuesOnly,t.charset,p))}let f=u.join(t.delimiter),l=t.addQueryPrefix===!0?"?":"";return t.charsetSentinel&&(t.charset==="iso-8859-1"?l+="utf8=%26%2310003%3B&":l+="utf8=%E2%9C%93&"),f.length>0?l+f:""}function he(e,r,n){let t=e["~standard"].validate(r);if(t instanceof Promise)throw new TypeError("Async schema");if(t.issues)throw new N(t.issues,n);return t.value}function In(e,r,n){try{return{success:!0,output:he(e,r,n)}}catch(t){if(t instanceof N)return{success:!1,issues:t.issues,source:t.source};throw t}}var $=class{constructor(r){if(this.baseUrl=re[r.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),r.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",r.apiKey.key)}else this.headers.set("x-publishable-key",r.apiKey.key);this.logger=r.logger,this._environment=r.environment}get environment(){return this._environment}getFetchParams(r,n){var s;let t=(s=n.validateIn)!=null?s:!0,{searchParams:i,body:o}=t?Ke(r,n):n,u=new URL(this.baseUrl),c=r.pathname;if("params"in n&&n.params)for(let[p,f]of Object.entries(n.params))c=c.replace(`:${p}`,String(f));return u.pathname=c,r.schema.searchParams&&(u.search=Ve(i)),[u.toString(),w({method:r.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(r,n){return x(this,null,function*(){var u;let t=yield le(n.response);if(ce(t,n.response.status),!((u=n.validateOut)!=null?u:!0))return t;let o=In(r.schema.response,t,"response");if(!o.success)throw new N(o.issues,o.source);return o.output})}request(r,n){return x(this,null,function*(){try{let t=this.getFetchParams(r,n),i=yield fetch(...t);return yield this.parseResponse(r,{response:i,validateOut:n.validateOut})}catch(t){throw t instanceof N?this.logger.error(t.message,t.issues):this.logger.error(t),t}})}};function M(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function Ke(e,r){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=he(e.schema.searchParams,"searchParams"in r?r.searchParams:{})),e.schema.body&&(n.body=he(e.schema.body,"body"in r?r.body:{})),n}var O,Tn={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Pn(e){var r,n,t;return!e&&!O?Tn:{lang:(r=e==null?void 0:e.lang)!=null?r:O==null?void 0:O.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:O==null?void 0:O.abortEarly,abortPipeEarly:(t=e==null?void 0:e.abortPipeEarly)!=null?t:O==null?void 0:O.abortPipeEarly}}var me;function On(e){return me==null?void 0:me.get(e)}var ve;function jn(e){return ve==null?void 0:ve.get(e)}var ge;function Dn(e,r){var n;return(n=ge==null?void 0:ge.get(e))==null?void 0:n.get(r)}function be(e){var n,t,i;let r=typeof e;return r==="string"?`"${e}"`:r==="number"||r==="bigint"||r==="boolean"?`${e}`:r==="object"||r==="function"?(i=e&&((t=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:t.name))!=null?i:"null":r}function S(e,r,n,t,i){var l,v,a,d,E,_,A,y;let o=i&&"input"in i?i.input:n.value,u=(v=(l=i==null?void 0:i.expected)!=null?l:e.expects)!=null?v:null,c=(a=i==null?void 0:i.received)!=null?a:be(o),s={kind:e.kind,type:e.type,input:o,expected:u,received:c,message:`Invalid ${r}: ${u?`Expected ${u} but r`:"R"}eceived ${c}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:t.lang,abortEarly:t.abortEarly,abortPipeEarly:t.abortPipeEarly},p=e.kind==="schema",f=(y=(A=(_=(E=(d=i==null?void 0:i.message)!=null?d:e.message)!=null?E:Dn(e.reference,s.lang))!=null?_:p?jn(s.lang):null)!=null?A:t.message)!=null?y:On(s.lang);f!==void 0&&(s.message=typeof f=="function"?f(s):f),p&&(n.typed=!1),n.issues?n.issues.push(s):n.issues=[s]}var Je=new WeakMap;function I(e){let r=Je.get(e);return r||(r={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Pn())}},Je.set(e,r)),r}function Rn(e,r){return Object.prototype.hasOwnProperty.call(e,r)&&r!=="__proto__"&&r!=="prototype"&&r!=="constructor"}function He(e,r){var t;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${r} `)})`:(t=n[0])!=null?t:"never"}var Cn=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_r=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function ke(e){return{kind:"validation",type:"email",reference:ke,expects:null,async:!1,requirement:Cn,message:e,"~run"(r,n){return r.typed&&!this.requirement.test(r.value)&&S(this,"email",r,n),r}}}function Nn(e,r,n){return typeof e.fallback=="function"?e.fallback(r,n):e.fallback}function _e(e,r,n){return typeof e.default=="function"?e.default(r,n):e.default}function we(e,r){return{kind:"schema",type:"array",reference:we,expects:"Array",async:!1,item:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let u=0;u<i.length;u++){let c=i[u],s=this.item["~run"]({value:c},t);if(s.issues){let p={type:"array",origin:"value",input:i,key:u,value:c};for(let f of s.issues)f.path?f.path.unshift(p):f.path=[p],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=s.issues),t.abortEarly){n.typed=!1;break}}s.typed||(n.typed=!1),n.value.push(s.value)}}else S(this,"type",n,t);return n}}}function xe(e,r){return{kind:"schema",type:"literal",reference:xe,expects:be(e),async:!1,literal:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===this.literal?n.typed=!0:S(this,"type",n,t),n}}}function G(e,r){return{kind:"schema",type:"nullish",reference:G,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function U(e){return{kind:"schema",type:"number",reference:U,expects:"number",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="number"&&!isNaN(r.value)?r.typed=!0:S(this,"type",r,n),r}}}function V(e,r){return{kind:"schema",type:"object",reference:V,expects:"Object",async:!1,entries:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(let u in this.entries){let c=this.entries[u];if(u in i||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){let s=u in i?i[u]:_e(c),p=c["~run"]({value:s},t);if(p.issues){let f={type:"object",origin:"value",input:i,key:u,value:s};for(let l of p.issues)l.path?l.path.unshift(f):l.path=[f],(o=n.issues)==null||o.push(l);if(n.issues||(n.issues=p.issues),t.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[u]=p.value}else if(c.fallback!==void 0)n.value[u]=Nn(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.type!=="nullish"&&(S(this,"key",n,t,{input:void 0,expected:`"${u}"`,path:[{type:"object",origin:"key",input:i,key:u,value:i[u]}]}),t.abortEarly))break}}else S(this,"type",n,t);return n}}}function L(e,r){return{kind:"schema",type:"optional",reference:L,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===void 0&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function te(e,r){return{kind:"schema",type:"picklist",reference:te,expects:He(e.map(be),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return this.options.includes(n.value)?n.typed=!0:S(this,"type",n,t),n}}}function Ee(e,r,n){return{kind:"schema",type:"record",reference:Ee,expects:"Object",async:!1,key:e,value:r,message:n,get"~standard"(){return I(this)},"~run"(t,i){var u,c;let o=t.value;if(o&&typeof o=="object"){t.typed=!0,t.value={};for(let s in o)if(Rn(o,s)){let p=o[s],f=this.key["~run"]({value:s},i);if(f.issues){let v={type:"object",origin:"key",input:o,key:s,value:p};for(let a of f.issues)a.path=[v],(u=t.issues)==null||u.push(a);if(t.issues||(t.issues=f.issues),i.abortEarly){t.typed=!1;break}}let l=this.value["~run"]({value:p},i);if(l.issues){let v={type:"object",origin:"value",input:o,key:s,value:p};for(let a of l.issues)a.path?a.path.unshift(v):a.path=[v],(c=t.issues)==null||c.push(a);if(t.issues||(t.issues=l.issues),i.abortEarly){t.typed=!1;break}}(!f.typed||!l.typed)&&(t.typed=!1),f.typed&&(t.value[f.value]=l.value)}}else S(this,"type",t,i);return t}}}function k(e){return{kind:"schema",type:"string",reference:k,expects:"string",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="string"?r.typed=!0:S(this,"type",r,n),r}}}function We(e){let r;if(e)for(let n of e)if(r)for(let t of n.issues)r.push(t);else r=n.issues;return r}function Ae(e,r){return{kind:"schema",type:"union",reference:Ae,expects:He(e.map(n=>n.expects),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){let i,o,u;for(let c of this.options){let s=c["~run"]({value:n.value},t);if(s.typed)if(s.issues)o?o.push(s):o=[s];else{i=s;break}else u?u.push(s):u=[s]}if(i)return i;if(o){if(o.length===1)return o[0];S(this,"type",n,t,{issues:We(o)}),n.typed=!0}else{if((u==null?void 0:u.length)===1)return u[0];S(this,"type",n,t,{issues:We(u)})}return n}}}function Se(...e){return F(w({},e[0]),{pipe:e,get"~standard"(){return I(this)},"~run"(r,n){for(let t of e)if(t.kind!=="metadata"){if(r.issues&&(t.kind==="schema"||t.kind==="transformation")){r.typed=!1;break}(!r.issues||!n.abortEarly&&!n.abortPipeEarly)&&(r=t["~run"](r,n))}return r}})}var Y=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function Ie(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Xe=["DAILY","WEEKLY","MONTHLY"],Fn=Ee(k(),Ae([k(),we(k()),V({type:xe("provided"),lat:U(),lng:U(),radius:U(),unit:L(te(["miles","km"])),label:L(k())})])),Dr={pathname:"/job/:id",method:"GET",schema:{response:V({id:U(),external_id:G(k()),city:G(k()),town:G(k()),category:G(k())})}};var qn={pathname:"/search/save",method:"POST",schema:{response:M(),body:V({contact:V({email:Se(L(k()),k(),ke()),first_name:L(k()),last_name:L(k())}),alerts:Se(L(k()),k(),te(Xe)),filters:Fn})}};$e();var ie=new Map,Oe={get:e=>{var r;if(ie.has(e))return(r=ie.get(e))!=null?r:null;try{return window.sessionStorage.getItem(e)}catch(n){return null}},set:(e,r)=>{try{window.sessionStorage.setItem(e,r),ie.delete(e)}catch(n){ie.set(e,r)}}};var Qe=7*24*60*60*1e3,en=e=>{let r=new Date;return r.setTime(r.getTime()+Qe),`${D}=${e};expires=${r.toUTCString()};path=/`},Mn=(e,r)=>{let n=e.get("session_id");if(r||n)return n;let t=Oe.get(`${D}-session_id`);return typeof t=="string"?t:null},zn=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(Me);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Bn=new RegExp(`(?:^|;\\s*)${D}=([^;]+)`),Z=e=>{var n,t;let r=e?e.headers.get("cookie"):document.cookie;return r&&(t=(n=Bn.exec(r))==null?void 0:n[1])!=null?t:null},nn=()=>{var e;try{let r=JSON.parse((e=window.localStorage.getItem(D))!=null?e:"null");return typeof r!="object"||r===null||!("id"in r)||!("expires"in r)||typeof r.id!="string"||typeof r.expires!="number"?null:r.id!==""&&r.expires>Date.now()?r.id:null}catch(r){return null}},Ze=()=>{var e;return(e=Z())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:nn()},Gn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",rn=e=>{if(document.cookie=en(e)+Gn(),Z()!==e)try{window.localStorage.setItem(D,JSON.stringify({id:e,expires:Date.now()+Qe}))}catch(r){}},je=e=>{var t,i,o;let r=e?e.url:location.href,{searchParams:n}=new URL(r);return{anonymous_id:e?(t=Z(e))!=null?t:n.get("anonymous_id"):(o=(i=Z())!=null?i:n.get("anonymous_id"))!=null?o:nn(),session_id:Mn(n,typeof window=="undefined")}},Ye=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=je().anonymous_id;if(e)return e;let r=Y(),n=je().anonymous_id;return n||(rn(r),r)},Un=e=>typeof e!="object"||e===null?null:{anonymous_id:"anonymous_id"in e&&typeof e.anonymous_id=="string"?e.anonymous_id:null,session_id:"session_id"in e&&typeof e.session_id=="string"?e.session_id:null},Vn=e=>e==="about:client"?"":e,Kn={pathname:"/log",method:"POST",schema:{response:M(),body:M()}},tn=({rpcClient:e,logger:r,onEvent:n,persistence:t="device",siteKind:i})=>{let o=null,u=null,c=0,s=0,p=a=>t==="none"?{anonymous_id:null,session_id:a?null:o}:je(a),f=(a,d,E)=>x(void 0,null,function*(){try{let _={library:{name:"inploi-sdk",version:qe},page:d},A=p(a.request),y=t==="none"?null:zn(),m={anonymous_id:A.anonymous_id,session_id:A.session_id,candidate_id:y,event:a.event,sent_at:new Date().toISOString(),context:_,properties:a.properties,custom_properties:w(w({},a.customProperties),E)},R=t==="none"?null:a.request?Z(a.request):Ze(),K=++c,J=yield e.request(Kn,w({body:m},a.keepalive&&{keepalive:!0})),h=Un(J);if(t==="none")return!a.request&&(h!=null&&h.session_id)&&K>s&&(s=K,h.session_id!==m.session_id&&(o=h.session_id)),m.session_id=a.request?(h==null?void 0:h.session_id)||null:o,n==null||n(m),{success:!0,data:m};let C=a.request?R:Ze(),z=C!==null&&C!==R,g=C!=null?C:R,j=!z&&(!g||!(h!=null&&h.anonymous_id)||g===h.anonymous_id);return j?(h!=null&&h.anonymous_id&&(m.anonymous_id=h.anonymous_id),h!=null&&h.session_id&&(m.session_id=h.session_id)):m.anonymous_id=g,!a.request&&typeof window!="undefined"&&m.anonymous_id&&(j&&m.session_id&&Oe.set(`${D}-session_id`,m.session_id.toString()),rn(m.anonymous_id)),n==null||n(m),{success:!0,data:m}}catch(_){return r.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:_}}}),l=Promise.resolve();return{log:a=>x(void 0,null,function*(){oe(a.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let d="request"in a&&a.request?{href:a.request.url,referrer:Vn(a.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(a.page_context==="no_query"){let y=new URL(d.href),m=d.referrer?new URL(d.referrer):void 0;d={href:y.origin+y.pathname,referrer:m?m.origin+m.pathname:""}}t==="none"&&a.event==="FLOW_NODE"&&a.properties&&"trigger"in a.properties&&(a.properties.trigger==="pagehide"||a.properties.trigger==="hidden")&&(a=F(w({},a),{keepalive:!0}));let E={event_id:Y(),consent_lane:t,site_kind:i};if(t==="device"||a.request||o||a.keepalive)return f(a,d,E);let _=()=>f(a,d,E),A=l.then(_,_);return l=A,A}),supportsNoQueryPageContext:!0,getHeaders:a=>{let d=new Headers;return t==="none"||!(a!=null&&a.anonymous_id)||d.append("Set-Cookie",en(a.anonymous_id)),d},getSessionInfo:p,getOrCreateAnonymousId:()=>t==="none"?u!=null?u:u=Y():Ye()}};function Pe({publishableKey:e,env:r,logger:n=ue,onEvent:t,persistence:i,siteKind:o}){let u=Le({baseUrl:re[r],publishableKey:e}),c=n===!1?ae:n,s=new $({environment:r,apiKey:{type:"publishable",key:e},logger:c}),p=tn({rpcClient:s,logger:c,onEvent:t,persistence:i,siteKind:o});return{register:l=>l({logger:c,apiClient:u,analytics:p,rpcClient:s,publishableKey:e,env:r}),analytics:p,apiClient:u}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=Pe;window.inploi.ready=Ie;})();
package/dist/index.d.mts CHANGED
@@ -176,6 +176,20 @@ type AnalyticsLogParams = {
176
176
  | {
177
177
  event: 'PAGE_ENGAGEMENT';
178
178
  properties: PageEngagementProperties;
179
+ } | {
180
+ event: 'SEARCH_RESULTS';
181
+ properties: {
182
+ /** Random per search, minted when the event is emitted. */
183
+ search_id: string;
184
+ result_count: number;
185
+ has_keyword: boolean;
186
+ mode: 'query' | 'vector';
187
+ /** Sorted non-default filter keys, never values. */
188
+ filter_keys: string[];
189
+ /** Coarse location source, never a label or coordinates. */
190
+ geo: 'none' | 'place' | 'ip' | 'map_area';
191
+ page: number;
192
+ };
179
193
  } | {
180
194
  event: 'SEARCH_PAGINATE';
181
195
  properties: {
@@ -282,7 +296,7 @@ type AnalyticsContext = {
282
296
  page: {
283
297
  href: string;
284
298
  referrer: string;
285
- title: string;
299
+ title?: string;
286
300
  };
287
301
  };
288
302
  type TrackPayload<P = EventPropertyMap[keyof EventPropertyMap]['properties']> = {
@@ -307,10 +321,14 @@ type LogFnParams<T extends keyof EventPropertyMap> = {
307
321
  request?: Request;
308
322
  /** Sent so it survives the page being left (`fetch` keepalive): for a summary sent on pagehide. */
309
323
  keepalive?: boolean;
324
+ /** Omit title and send only origin + pathname for page and referrer URLs on this call. */
325
+ page_context?: 'no_query';
310
326
  } & EventPropertyMap[T];
311
327
  type LogFn = <TEvent extends keyof EventPropertyMap>(params: LogFnParams<TEvent>) => Promise<ResponseObj<TrackPayload<EventPropertyMap[TEvent]['properties']>>>;
312
328
  type AnalyticsService = {
313
329
  log: LogFn;
330
+ /** True when `page_context: 'no_query'` strips URL queries/fragments and title. Absent before SDK 3.1. */
331
+ supportsNoQueryPageContext?: boolean;
314
332
  /** From a log payload data, generate headers to use in server environments to update the anonymous_id */
315
333
  getHeaders: (payload?: TrackPayload) => Headers;
316
334
  getSessionInfo: typeof getSessionInfo;
package/dist/index.d.ts CHANGED
@@ -176,6 +176,20 @@ type AnalyticsLogParams = {
176
176
  | {
177
177
  event: 'PAGE_ENGAGEMENT';
178
178
  properties: PageEngagementProperties;
179
+ } | {
180
+ event: 'SEARCH_RESULTS';
181
+ properties: {
182
+ /** Random per search, minted when the event is emitted. */
183
+ search_id: string;
184
+ result_count: number;
185
+ has_keyword: boolean;
186
+ mode: 'query' | 'vector';
187
+ /** Sorted non-default filter keys, never values. */
188
+ filter_keys: string[];
189
+ /** Coarse location source, never a label or coordinates. */
190
+ geo: 'none' | 'place' | 'ip' | 'map_area';
191
+ page: number;
192
+ };
179
193
  } | {
180
194
  event: 'SEARCH_PAGINATE';
181
195
  properties: {
@@ -282,7 +296,7 @@ type AnalyticsContext = {
282
296
  page: {
283
297
  href: string;
284
298
  referrer: string;
285
- title: string;
299
+ title?: string;
286
300
  };
287
301
  };
288
302
  type TrackPayload<P = EventPropertyMap[keyof EventPropertyMap]['properties']> = {
@@ -307,10 +321,14 @@ type LogFnParams<T extends keyof EventPropertyMap> = {
307
321
  request?: Request;
308
322
  /** Sent so it survives the page being left (`fetch` keepalive): for a summary sent on pagehide. */
309
323
  keepalive?: boolean;
324
+ /** Omit title and send only origin + pathname for page and referrer URLs on this call. */
325
+ page_context?: 'no_query';
310
326
  } & EventPropertyMap[T];
311
327
  type LogFn = <TEvent extends keyof EventPropertyMap>(params: LogFnParams<TEvent>) => Promise<ResponseObj<TrackPayload<EventPropertyMap[TEvent]['properties']>>>;
312
328
  type AnalyticsService = {
313
329
  log: LogFn;
330
+ /** True when `page_context: 'no_query'` strips URL queries/fragments and title. Absent before SDK 3.1. */
331
+ supportsNoQueryPageContext?: boolean;
314
332
  /** From a log payload data, generate headers to use in server environments to update the anonymous_id */
315
333
  getHeaders: (payload?: TrackPayload) => Headers;
316
334
  getSessionInfo: typeof getSessionInfo;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ot=Object.create;var X=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var jt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var Bt=(t,n)=>()=>(t&&(n=t(t=0)),n);var Ue=(t,n)=>{for(var r in n)X(t,r,{get:n[r],enumerable:!0})},qe=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of Nt(n))!Ft.call(t,c)&&c!==r&&X(t,c,{get:()=>n[c],enumerable:!(o=Dt(n,c))||o.enumerable});return t};var A=(t,n,r)=>(r=t!=null?Ot(jt(t)):{},qe(n||!t||!t.__esModule?X(r,"default",{value:t,enumerable:!0}):r,t)),Ut=t=>qe(X({},"__esModule",{value:!0}),t);var kt={};Ue(kt,{jobCountryCodes:()=>Oe});var wt,_n,q,Tn,An,Oe,De=Bt(()=>{"use strict";wt={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb",lincolnshire:"gb",surrey:"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm",kosovo:"xk",xk:"xk"},_n=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
1
+ "use strict";var Ht=Object.create;var oe=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty;var Yt=(t,n)=>()=>(t&&(n=t(t=0)),n);var We=(t,n)=>{for(var r in n)oe(t,r,{get:n[r],enumerable:!0})},Je=(t,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of Wt(n))!zt.call(t,c)&&c!==r&&oe(t,c,{get:()=>n[c],enumerable:!(s=Kt(n,c))||s.enumerable});return t};var x=(t,n,r)=>(r=t!=null?Ht(Jt(t)):{},Je(n||!t||!t.__esModule?oe(r,"default",{value:t,enumerable:!0}):r,t)),Qt=t=>Je(oe({},"__esModule",{value:!0}),t);var qt={};We(qt,{jobCountryCodes:()=>Me});var Ft,Qn,V,Zn,Xn,Me,Ge=Yt(()=>{"use strict";Ft={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb",lincolnshire:"gb",surrey:"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm",kosovo:"xk",xk:"xk"},Qn=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
2
2
  bfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod
3
3
  cfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma
4
4
  dodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf
@@ -10,5 +10,5 @@ ncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan pe
10
10
  pnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn
11
11
  sjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl
12
12
  tltls tmtkm tntun toton trtur tttto tvtuv twtwn tztza uaukr uguga umumi ususa uyury uzuzb vavat vcvct veven vgvgb vivir
13
- vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,Tn=()=>{if(q)return q;q=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of _n.split(/\s+/)){let r=n.slice(0,2),o=t.of(r.toUpperCase());o&&q.set(o.toLowerCase(),r),q.set(r,r),q.set(n.slice(2),r)}return q},An=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(wt,n))return wt[n];let r=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return Tn().get(r)},Oe=t=>[...new Set(t.flatMap(r=>An(r)??[]))].sort()});var xn={};Ue(xn,{ANALYTICS_EVENTS:()=>ot,ApiError:()=>F,InploiRpcClient:()=>W,JOB_ALERT_FREQUENCIES:()=>Ce,NotFoundError:()=>N,ParsingError:()=>B,SchemaValidationError:()=>k,SdkError:()=>Ee,UnauthorisedError:()=>j,addressSearchCountry:()=>It,blendAddressSuggestions:()=>je,consentStorageKey:()=>ae,createPlugin:()=>Me,createTalentBankClient:()=>At,endpoint:()=>H,generateUUID:()=>K,getConsentAcceptance:()=>it,getJobCountries:()=>Ne,getOrCreateAnonymousId:()=>ke,hashConsentConfig:()=>se,initialiseSdk:()=>rt,inploiBrandedLogger:()=>ne,isApiErrorWithData:()=>Ge,isSdkError:()=>Ke,jobCountryCodes:()=>Oe,noLogging:()=>re,ready:()=>Et,saveClosedRoleJobAlerts:()=>xt,saveSearchEndpoint:()=>Le,searchAddressSuggestions:()=>Pt,setConsentAcceptance:()=>st,typed:()=>C,validateEndpointInputs:()=>Pe});module.exports=Ut(xn);var ee="%c[inploi SDK]",te="color: #65BC67; font-weight: bold;",ne={warn:(...t)=>console.warn(ee,te,...t),error:(...t)=>console.error(ee,te,...t),info:(...t)=>console.info(ee,te,...t),log:(...t)=>console.log(ee,te,...t)},re={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Me=t=>t;function _e(t,n){if(!t)throw new Error(n)}function V(t,n){return n in t}var Nn=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var qt="Unauthenticated",Mt="This action is unauthorized.",D=class extends Error{constructor(r,o){super(r);this.status=o,this.name="ErrorWithStatus"}},N=class extends D{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},j=class extends D{constructor(n,r){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=r??401}},k=class extends D{constructor(r,o){let c=o?` in ${o}`:"";super(`Schema validation failed${c}`);this.issues=r;this.source=o;this.name="SchemaValidationError",this.status=400}},F=class extends D{constructor(r,o,c){super(r);this.data=c;this.name="ApiError",this.status=o??500}},Ge=t=>t instanceof F&&t.data!==void 0,B=class extends D{constructor(r){super("Error parsing response into JSON.");this.response=r;this.name="ParsingError",this.status=r&&r.status>=300?r.status:500,this.contentType=new Headers(r?.headers).get("content-type")??void 0}};async function Te(t){let r=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(r&&r!=="application/json"&&!r.endsWith("+json"))throw new B(t);return t.json().catch(()=>{throw new B(t)})}var Gt=["message","error","errors","exception","exceptions"];function Vt(t){let n=[];if(typeof t=="object"&&t!==null){for(let r of Gt)if(V(t,r)){let o=t[r];typeof o=="string"&&n.push(o),Array.isArray(o)&&o.every(c=>typeof c=="string")&&n.push(...o)}V(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&V(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&V(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&n.push(t.integration_response.error.message)}return n.length===0&&n.push("Unknown error"),[...new Set(n)].join(", ")}function Ae(t,n){if(n>=300){let r=Vt(t);throw n===404?new N(r):r===qt?new j("You are not authenticated.",n):r===Mt?new j(r,n):new F(r,n,t)}}var Ve=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(r,o={})=>{let c={...o,headers:{...o.headers,...n}},l=await fetch(`${t.baseUrl}${r}`,c);if(l.status===404)throw new N;let d=await Te(l);return Ae(d,l.status),d}}},Ee={NotFound:N,Unauthorised:j,SchemaValidation:k,Api:F,JsonParsing:B};function Ke(t){return Object.values(Ee).some(n=>t instanceof n)}var We="3.0.1";var oe={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},$e={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},Je=We;var R="isdk_session",ze=`${R}-candidate_id`,He=`${R}-consent`;var ie=new Map,xe={get:t=>{if(ie.has(t))return ie.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,n)=>{try{window.sessionStorage.setItem(t,n),ie.delete(t)}catch{ie.set(t,n)}}};var K=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16));var Qe=7*24*60*60*1e3,Ze=t=>{let n=new Date;return n.setTime(n.getTime()+Qe),`${R}=${t};expires=${n.toUTCString()};path=/`},Wt=(t,n)=>{let r=t.get("session_id");if(n||r)return r;let o=xe.get(`${R}-session_id`);return typeof o=="string"?o:null},$t=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(ze);return typeof t=="string"&&t!==""?t:null}catch{return null}},Jt=new RegExp(`(?:^|;\\s*)${R}=([^;]+)`),z=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?Jt.exec(n)?.[1]??null:null},Xe=()=>{try{let t=JSON.parse(window.localStorage.getItem(R)??"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch{return null}},Ye=()=>z()??(new URL(location.href).searchParams.get("anonymous_id")?null:Xe()),zt=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",et=t=>{if(document.cookie=Ze(t)+zt(),z()!==t)try{window.localStorage.setItem(R,JSON.stringify({id:t,expires:Date.now()+Qe}))}catch{}},we=t=>{let n=t?t.url:location.href,{searchParams:r}=new URL(n);return{anonymous_id:t?z(t)??r.get("anonymous_id"):z()??r.get("anonymous_id")??Xe(),session_id:Wt(r,typeof window>"u")}},ke=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=we().anonymous_id;if(t)return t;let n=K(),r=we().anonymous_id;return r||(et(n),n)},Ht=t=>typeof t!="object"||t===null?null:{anonymous_id:"anonymous_id"in t&&typeof t.anonymous_id=="string"?t.anonymous_id:null,session_id:"session_id"in t&&typeof t.session_id=="string"?t.session_id:null},Yt=t=>t==="about:client"?"":t,Qt={pathname:"/log",method:"POST",schema:{response:C(),body:C()}},tt=({rpcClient:t,logger:n,onEvent:r,persistence:o="device",siteKind:c})=>{let l=null,d=null,u=0,f=0,x=p=>o==="none"?{anonymous_id:null,session_id:p?null:l}:we(p),M=async(p,v,Z)=>{try{let G={library:{name:"inploi-sdk",version:Je},page:v},J=x(p.request),Rt=o==="none"?null:$t(),y={anonymous_id:J.anonymous_id,session_id:J.session_id,candidate_id:Rt,event:p.event,sent_at:new Date().toISOString(),context:G,properties:p.properties,custom_properties:{...p.customProperties,...Z}},ye=o==="none"?null:p.request?z(p.request):Ye(),Fe=++u,Ct=await t.request(Qt,{body:y,...p.keepalive&&{keepalive:!0}}),w=Ht(Ct);if(o==="none")return!p.request&&w?.session_id&&Fe>f&&(f=Fe,w.session_id!==y.session_id&&(l=w.session_id)),y.session_id=p.request?w?.session_id||null:l,r?.(y),{success:!0,data:y};let be=p.request?ye:Ye(),Lt=be!==null&&be!==ye,Se=be??ye,Be=!Lt&&(!Se||!w?.anonymous_id||Se===w.anonymous_id);return Be?(w?.anonymous_id&&(y.anonymous_id=w.anonymous_id),w?.session_id&&(y.session_id=w.session_id)):y.anonymous_id=Se,!p.request&&typeof window<"u"&&y.anonymous_id&&(Be&&y.session_id&&xe.set(`${R}-session_id`,y.session_id.toString()),et(y.anonymous_id)),r?.(y),{success:!0,data:y}}catch(G){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:G}}},O=Promise.resolve();return{log:async p=>{_e(p.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let v="request"in p&&p.request?{href:p.request.url,referrer:Yt(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};o==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p={...p,keepalive:!0});let Z={event_id:K(),consent_lane:o,site_kind:c};if(o==="device"||p.request||l||p.keepalive)return M(p,v,Z);let G=()=>M(p,v,Z),J=O.then(G,G);return O=J,J},getHeaders:p=>{let v=new Headers;return o==="none"||!p?.anonymous_id||v.append("Set-Cookie",Ze(p.anonymous_id)),v},getSessionInfo:x,getOrCreateAnonymousId:()=>o==="none"?d??(d=K()):ke()}};var nt=require("neoqs");function Ie(t,n,r){let o=t["~standard"].validate(n);if(o instanceof Promise)throw new TypeError("Async schema");if(o.issues)throw new k(o.issues,r);return o.value}function Zt(t,n,r){try{return{success:!0,output:Ie(t,n,r)}}catch(o){if(o instanceof k)return{success:!1,issues:o.issues,source:o.source};throw o}}var W=class{constructor(n){if(this.baseUrl=oe[n.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),n.apiKey.type==="secret"){if(typeof window<"u")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",n.apiKey.key)}else this.headers.set("x-publishable-key",n.apiKey.key);this.logger=n.logger,this._environment=n.environment}get environment(){return this._environment}getFetchParams(n,r){let o=r.validateIn??!0,{searchParams:c,body:l}=o?Pe(n,r):r,d=new URL(this.baseUrl),u=n.pathname;if("params"in r&&r.params)for(let[f,x]of Object.entries(r.params))u=u.replace(`:${f}`,String(x));return d.pathname=u,n.schema.searchParams&&(d.search=(0,nt.stringify)(c)),[d.toString(),{method:n.method,body:l?JSON.stringify(l):void 0,headers:this.headers,signal:r.signal,...r.keepalive&&{keepalive:!0}}]}async parseResponse(n,r){let o=await Te(r.response);if(Ae(o,r.response.status),!(r.validateOut??!0))return o;let l=Zt(n.schema.response,o,"response");if(!l.success)throw new k(l.issues,l.source);return l.output}async request(n,r){try{let o=this.getFetchParams(n,r),c=await fetch(...o);return await this.parseResponse(n,{response:c,validateOut:r.validateOut})}catch(o){throw o instanceof k?this.logger.error(o.message,o.issues):this.logger.error(o),o}}};function C(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function H(t){return t}function Pe(t,n){let r={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(r.searchParams=Ie(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(r.body=Ie(t.schema.body,"body"in n?n.body:{})),r}function rt({publishableKey:t,env:n,logger:r=ne,onEvent:o,persistence:c,siteKind:l}){let d=Ve({baseUrl:oe[n],publishableKey:t}),u=r===!1?re:r,f=new W({environment:n,apiKey:{type:"publishable",key:t},logger:u}),x=tt({rpcClient:f,logger:u,onEvent:o,persistence:c,siteKind:l});return{register:O=>O({logger:u,apiClient:d,analytics:x,rpcClient:f,publishableKey:t,env:n}),analytics:x,apiClient:d}}var ot={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function se(t){let n=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),r=5381;for(let o=0;o<n.length;o++)r=r*33^n.charCodeAt(o);return(r>>>0).toString(36)}function ae(t,n){return`${He}:${t}:${n}`}function it(t,n){if(typeof window>"u")return!1;try{let r=ae(t,se(n));return window.localStorage.getItem(r)==="accepted"}catch{return!1}}function st(t,n){if(!(typeof window>"u"))try{let r=ae(t,se(n));window.localStorage.setItem(r,"accepted")}catch{}}var s=A(require("valibot"),1),Xt=["agent","sdk","form","integration","migration"],en=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var tn=["screening","cv_match","interview","overall"],nn=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],rn=["job","company"],on=["created_at","updated_at"],sn=["asc","desc"],an=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],cn=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],ln=["user","system","automation","integration","candidate"],ce=s.picklist(Xt),I=s.picklist(en),E=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),le=s.picklist(tn),at=s.picklist(nn),gr=s.picklist(rn),ct=s.picklist(on),lt=s.picklist(sn),Y=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),pe=s.picklist(an),pt=s.picklist(cn),dt=s.picklist(ln);var S=s.variant("type",[s.object({type:s.literal("user"),id:s.pipe(s.string(),s.minLength(1)),email:s.pipe(s.string(),s.minLength(1)),name:s.pipe(s.string(),s.minLength(1))}),s.object({type:s.literal("system"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("automation"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("integration"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("candidate"),id:s.pipe(s.string(),s.minLength(1)),email:s.optional(s.string())})]);var P=A(require("valibot"),1),pn=P.object({total:P.number(),page:P.number(),perPage:P.number(),lastPage:P.number()});function de(t){return P.object({data:P.array(t),pagination:pn})}var m=A(require("valibot"),1);var Q=m.object({id:m.string(),email:m.nullable(m.string()),firstName:m.nullable(m.string()),lastName:m.nullable(m.string()),phone:m.nullable(m.string()),source:m.nullable(ce),identifiedAt:m.nullable(m.string()),createdAt:m.string(),updatedAt:m.string()});var i=A(require("valibot"),1);var g=A(require("valibot"),1),$=g.pipe(g.string(),g.minLength(1)),ut=g.pipe(g.number(),g.integer(),g.minValue(1)),L=g.record(g.string(),g.unknown());var _=A(require("valibot"),1);var mt=_.object({id:_.string(),applicationId:_.string(),status:at,scheduledAt:_.nullable(_.string()),completedAt:_.nullable(_.string()),meta:_.nullable(L),createdAt:_.string(),updatedAt:_.string()});var Re=i.object({score:i.number(),reason:i.string(),confidence:i.number()}),gt=i.object({id:i.string(),candidateId:i.string(),jobId:i.number(),stage:E,stageGroup:I,stageEnteredAt:i.string(),rating:i.nullable(i.number()),disqualifiedAt:i.nullable(i.string()),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),source:pe,sourceDetail:i.nullable(i.string()),sessionId:i.nullable(i.number()),externalApplicationId:i.nullable(i.string()),meta:i.nullable(L),context:i.nullable(L),scoredAt:i.nullable(i.string()),createdAt:i.string(),updatedAt:i.string()}),dn=i.object({id:i.string(),applicationId:i.string(),scoreType:le,score:i.nullable(i.number()),reason:i.nullable(i.string()),categories:i.nullable(i.record(i.string(),Re)),scoredBy:i.nullable(i.string()),createdAt:i.string()}),ue=i.object({...gt.entries,candidate:i.nullable(Q),score:i.nullable(dn),interview:i.nullable(mt)}),un=i.object({...Q.entries,applications:i.array(gt)}),vt=i.object({id:i.string(),applicationId:i.string(),action:pt,fromStage:i.nullable(E),fromStageGroup:i.nullable(I),toStage:i.nullable(E),toStageGroup:i.nullable(I),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),actorId:i.nullable(i.string()),actorType:dt,actorEmail:i.nullable(i.string()),actorName:i.nullable(i.string()),meta:i.nullable(L),schemaVersion:i.number(),createdAt:i.string()});var h=A(require("valibot"),1);var ft=h.object({anonymousId:$,email:$,firstName:h.nullish(h.string()),lastName:h.nullish(h.string()),phone:h.nullish(h.string()),source:h.nullish(ce)}),ht=h.object({candidateId:h.string(),isNew:h.boolean()});var e=A(require("valibot"),1);var mn=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],ge=e.picklist(mn),yt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),gn=e.pipe(yt,e.array(E)),vn=e.pipe(yt,e.array(I)),bt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),Nr=e.object({stages:e.optional(gn),stage_groups:e.optional(vn),job_id:e.optional(e.string()),job_ids:e.optional(bt),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),sort:e.optional(ct),order:e.optional(lt),page:e.optional(e.string()),per_page:e.optional(e.string())}),jr=e.pipe(e.object({candidateId:$,jobId:ut,meta:e.nullish(L),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),context:e.nullish(L),source:e.nullish(pe),sourceDetail:e.nullish(e.string()),stage:e.nullish(E),stageGroup:e.nullish(I),actor:e.nullish(S)}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together")),St=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),Fr=e.union([e.object({ok:e.literal(!0),duplicate:e.literal(!1),applicationId:e.string(),candidateId:e.string()}),e.object({ok:e.literal(!0),duplicate:e.literal(!0),existingApplication:St})]),_t=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(St)}),Br=e.object({applicationId:$,scoreType:le,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Re)),scoredBy:e.nullish(e.string()),actor:e.nullish(S)}),Ur=e.object({scoreId:e.string()}),qr=de(ue);var Mr=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),Gr=e.array(vt),me=e.object({stage:e.nullish(E),note:e.nullish(e.string())}),fn=e.object({stage:e.nullish(E),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),hn=e.variant("action",[e.object({action:e.literal("shortlist"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("move_to_interview"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("make_offer"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("hire"),actor:S,meta:e.nullish(fn)}),e.object({action:e.literal("withdraw"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("move_to_stage"),actor:S,meta:e.object({stage:E,stageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:S,meta:e.object({toStage:E,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:S,meta:e.object({reason:Y,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:S,meta:e.object({toStage:E,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:S,meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),Vr=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:hn}),Tt=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),Kr=e.variant("kind",[e.object({kind:e.literal("updated"),action:ge,application:ue}),e.object({kind:e.literal("skipped"),action:ge,applicationId:e.string(),reason:Tt})]),Wr=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:ge,application:ue})),skipped:e.array(e.object({kind:e.literal("skipped"),action:ge,applicationId:e.string(),reason:Tt})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),U=e.pipe(e.number(),e.integer(),e.minValue(0)),yn=e.object({APPLIED:U,SHORTLISTED:U,INTERVIEWED:U,OFFERED:U,HIRED:U,REJECTED:U,WITHDRAWN:U}),$r=e.object({job_ids:bt}),Jr=e.object({counts:e.record(e.string(),yn)});var Zr=de(Q);var b=A(require("valibot"),1),eo=b.object({avg_score:b.nullable(b.number()),p90_score:b.nullable(b.number()),p85_score:b.nullable(b.number()),p80_score:b.nullable(b.number()),total_scores:b.number(),total_shortlists:b.number()});var ve=A(require("valibot"));var At=({environment:t,publishableKey:n,logger:r})=>{let o=$e[t];return{async checkDuplicate(c){try{let l=new URLSearchParams({email:c.email,scope:c.scope});c.scope==="job"&&c.jobId!=null&&l.set("job_id",String(c.jobId));let d=await fetch(`${o}/applications/check-duplicate?${l}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":n}});if(!d.ok)return r.error(`[TalentBankClient] checkDuplicate failed with status ${d.status}`),{isDuplicate:!1};let u=await d.json(),f=ve.safeParse(_t,u);return f.success?f.output:(r.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof u=="object"&&u!=null&&typeof u.isDuplicate=="boolean"?{isDuplicate:u.isDuplicate}:{isDuplicate:!1})}catch(l){return r.error("[TalentBankClient] checkDuplicate failed:",l),{isDuplicate:!1}}},async identify(c){try{if(!c.anonymousId)return r.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let l={email:c.email,firstName:c.firstName,lastName:c.lastName,phone:c.phone,anonymousId:c.anonymousId,source:c.source??"sdk"},d=ve.safeParse(ft,l);if(!d.success)return r.error("[TalentBankClient] identify received invalid input"),null;let u=await fetch(`${o}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(d.output)});if(!u.ok)return r.error(`[TalentBankClient] identify failed with status ${u.status}`),null;let f=ve.safeParse(ht,await u.json());return f.success?f.output:(r.error("[TalentBankClient] identify returned an invalid response"),null)}catch(l){return r.error("[TalentBankClient] identify failed:",l),null}}}};function Et(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var a=A(require("valibot"));var Ce=["DAILY","WEEKLY","MONTHLY"],bn=a.record(a.string(),a.union([a.string(),a.array(a.string()),a.object({type:a.literal("provided"),lat:a.number(),lng:a.number(),radius:a.number(),unit:a.optional(a.picklist(["miles","km"])),label:a.optional(a.string())})])),Sn={pathname:"/job/:id",method:"GET",schema:{response:a.object({id:a.number(),external_id:a.nullish(a.string()),city:a.nullish(a.string()),town:a.nullish(a.string()),category:a.nullish(a.string())})}};async function xt(t,{contact:n,job:r}){let o={};if(r){let c=await t.request(Sn,{params:{id:r.id}});if((r.id_type==="internal"?String(c.id):c.external_id)!==r.id)throw new Error("Job lookup returned a different role");for(let d of["city","town","category"]){let u=c[d]?.trim();u&&(o[d]=[u])}}await t.request(Le,{body:{contact:n,alerts:"WEEKLY",filters:o}})}var Le={pathname:"/search/save",method:"POST",schema:{response:C(),body:a.object({contact:a.object({email:a.pipe(a.optional(a.string()),a.string(),a.email()),first_name:a.optional(a.string()),last_name:a.optional(a.string())}),alerts:a.pipe(a.optional(a.string()),a.string(),a.picklist(Ce)),filters:bn})}};var T=A(require("valibot"));var Ne=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:T.pipe(T.object({country:T.optional(T.array(T.object({value:T.string()})),[])}),T.transform(({country:r})=>r.map(({value:o})=>o))),searchParams:C()}};return t.request(n,{searchParams:{filters:{country:null}}})},fe=new WeakMap,It=t=>(fe.has(t)||(fe.set(t,void 0),Ne(t).then(async n=>{let{jobCountryCodes:r}=await Promise.resolve().then(()=>(De(),kt));fe.set(t,r(n).join(",")||void 0)}).catch(()=>{})),fe.get(t)),je=(t,n)=>{let r=new Set,o=[];for(let c=0;c<Math.max(t.length,n.length);c++)for(let l of[t[c],n[c]]){if(!l)continue;let d=l.mapbox_id||l.full_address||[l.name,l.place_formatted].filter(Boolean).join(", ");if(!r.has(d)&&(r.add(d),o.push(l),o.length===5))return o}return o},En=600,Pt=async(t,n,r)=>{if(r?.throwIfAborted(),!n){let o=await t();return r?.throwIfAborted(),o}return new Promise((o,c)=>{let l,d,u,f=!1,x=()=>{f=!0,clearTimeout(u),r?.removeEventListener("abort",M)},M=()=>{x(),c(r?.reason)},O=()=>{x(),l?.status==="fulfilled"&&d?.status==="fulfilled"?o(je(l.value,d.value)):l?.status==="fulfilled"?o(l.value):d?.status==="fulfilled"?o(d.value):l?.status==="rejected"&&c(l.reason)},he=(p,v)=>{f||(p?l=v:d=v,l&&d?O():v.status==="fulfilled"&&v.value.length>0&&(u=setTimeout(O,En)))};r?.addEventListener("abort",M,{once:!0});for(let p of[!0,!1])t(p?n:void 0).then(v=>he(p,{status:"fulfilled",value:v}),v=>he(p,{status:"rejected",reason:v}))})};De();0&&(module.exports={ANALYTICS_EVENTS,ApiError,InploiRpcClient,JOB_ALERT_FREQUENCIES,NotFoundError,ParsingError,SchemaValidationError,SdkError,UnauthorisedError,addressSearchCountry,blendAddressSuggestions,consentStorageKey,createPlugin,createTalentBankClient,endpoint,generateUUID,getConsentAcceptance,getJobCountries,getOrCreateAnonymousId,hashConsentConfig,initialiseSdk,inploiBrandedLogger,isApiErrorWithData,isSdkError,jobCountryCodes,noLogging,ready,saveClosedRoleJobAlerts,saveSearchEndpoint,searchAddressSuggestions,setConsentAcceptance,typed,validateEndpointInputs});
13
+ vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,Zn=()=>{if(V)return V;V=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of Qn.split(/\s+/)){let r=n.slice(0,2),s=t.of(r.toUpperCase());s&&V.set(s.toLowerCase(),r),V.set(r,r),V.set(n.slice(2),r)}return V},Xn=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(Ft,n))return Ft[n];let r=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return Zn().get(r)},Me=t=>[...new Set(t.flatMap(r=>Xn(r)??[]))].sort()});var tr={};We(tr,{ANALYTICS_EVENTS:()=>ut,ApiError:()=>B,InploiRpcClient:()=>J,JOB_ALERT_FREQUENCIES:()=>Fe,NotFoundError:()=>N,ParsingError:()=>F,SchemaValidationError:()=>w,SdkError:()=>we,UnauthorisedError:()=>U,addressSearchCountry:()=>Mt,blendAddressSuggestions:()=>$e,consentStorageKey:()=>ue,createPlugin:()=>ze,createTalentBankClient:()=>Nt,endpoint:()=>X,generateUUID:()=>W,getConsentAcceptance:()=>mt,getJobCountries:()=>Ve,getOrCreateAnonymousId:()=>Pe,hashConsentConfig:()=>de,initialiseSdk:()=>dt,inploiBrandedLogger:()=>ae,isApiErrorWithData:()=>Ye,isSdkError:()=>Ze,jobCountryCodes:()=>Me,noLogging:()=>ce,ready:()=>Ut,saveClosedRoleJobAlerts:()=>Bt,saveSearchEndpoint:()=>qe,searchAddressSuggestions:()=>Gt,setConsentAcceptance:()=>vt,typed:()=>C,validateEndpointInputs:()=>Le});module.exports=Qt(tr);var se="%c[inploi SDK]",ie="color: #65BC67; font-weight: bold;",ae={warn:(...t)=>console.warn(se,ie,...t),error:(...t)=>console.error(se,ie,...t),info:(...t)=>console.info(se,ie,...t),log:(...t)=>console.log(se,ie,...t)},ce={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var ze=t=>t;function xe(t,n){if(!t)throw new Error(n)}function K(t,n){return n in t}var dr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Zt="Unauthenticated",Xt="This action is unauthorized.",D=class extends Error{constructor(r,s){super(r);this.status=s,this.name="ErrorWithStatus"}},N=class extends D{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},U=class extends D{constructor(n,r){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=r??401}},w=class extends D{constructor(r,s){let c=s?` in ${s}`:"";super(`Schema validation failed${c}`);this.issues=r;this.source=s;this.name="SchemaValidationError",this.status=400}},B=class extends D{constructor(r,s,c){super(r);this.data=c;this.name="ApiError",this.status=s??500}},Ye=t=>t instanceof B&&t.data!==void 0,F=class extends D{constructor(r){super("Error parsing response into JSON.");this.response=r;this.name="ParsingError",this.status=r&&r.status>=300?r.status:500,this.contentType=new Headers(r?.headers).get("content-type")??void 0}};async function Ee(t){let r=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(r&&r!=="application/json"&&!r.endsWith("+json"))throw new F(t);return t.json().catch(()=>{throw new F(t)})}var en=["message","error","errors","exception","exceptions"];function tn(t){let n=[];if(typeof t=="object"&&t!==null){for(let r of en)if(K(t,r)){let s=t[r];typeof s=="string"&&n.push(s),Array.isArray(s)&&s.every(c=>typeof c=="string")&&n.push(...s)}K(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&K(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&K(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&n.push(t.integration_response.error.message)}return n.length===0&&n.push("Unknown error"),[...new Set(n)].join(", ")}function Ie(t,n){if(n>=300){let r=tn(t);throw n===404?new N(r):r===Zt?new U("You are not authenticated.",n):r===Xt?new U(r,n):new B(r,n,t)}}var Qe=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(r,s={})=>{let c={...s,headers:{...s.headers,...n}},l=await fetch(`${t.baseUrl}${r}`,c);if(l.status===404)throw new N;let d=await Ee(l);return Ie(d,l.status),d}}},we={NotFound:N,Unauthorised:U,SchemaValidation:w,Api:B,JsonParsing:F};function Ze(t){return Object.values(we).some(n=>t instanceof n)}var Xe="3.1.1";var le={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},et={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},tt=Xe;var P="isdk_session",nt=`${P}-candidate_id`,rt=`${P}-consent`;var pe=new Map,ke={get:t=>{if(pe.has(t))return pe.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,n)=>{try{window.sessionStorage.setItem(t,n),pe.delete(t)}catch{pe.set(t,n)}}};var W=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16));var st=7*24*60*60*1e3,it=t=>{let n=new Date;return n.setTime(n.getTime()+st),`${P}=${t};expires=${n.toUTCString()};path=/`},rn=(t,n)=>{let r=t.get("session_id");if(n||r)return r;let s=ke.get(`${P}-session_id`);return typeof s=="string"?s:null},on=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(nt);return typeof t=="string"&&t!==""?t:null}catch{return null}},sn=new RegExp(`(?:^|;\\s*)${P}=([^;]+)`),Z=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?sn.exec(n)?.[1]??null:null},at=()=>{try{let t=JSON.parse(window.localStorage.getItem(P)??"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch{return null}},ot=()=>Z()??(new URL(location.href).searchParams.get("anonymous_id")?null:at()),an=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",ct=t=>{if(document.cookie=it(t)+an(),Z()!==t)try{window.localStorage.setItem(P,JSON.stringify({id:t,expires:Date.now()+st}))}catch{}},Re=t=>{let n=t?t.url:location.href,{searchParams:r}=new URL(n);return{anonymous_id:t?Z(t)??r.get("anonymous_id"):Z()??r.get("anonymous_id")??at(),session_id:rn(r,typeof window>"u")}},Pe=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Re().anonymous_id;if(t)return t;let n=W(),r=Re().anonymous_id;return r||(ct(n),n)},cn=t=>typeof t!="object"||t===null?null:{anonymous_id:"anonymous_id"in t&&typeof t.anonymous_id=="string"?t.anonymous_id:null,session_id:"session_id"in t&&typeof t.session_id=="string"?t.session_id:null},ln=t=>t==="about:client"?"":t,pn={pathname:"/log",method:"POST",schema:{response:C(),body:C()}},lt=({rpcClient:t,logger:n,onEvent:r,persistence:s="device",siteKind:c})=>{let l=null,d=null,u=0,b=0,E=p=>s==="none"?{anonymous_id:null,session_id:p?null:l}:Re(p),$=async(p,h,ne)=>{try{let H={library:{name:"inploi-sdk",version:tt},page:h},Q=E(p.request),re=s==="none"?null:on(),f={anonymous_id:Q.anonymous_id,session_id:Q.session_id,candidate_id:re,event:p.event,sent_at:new Date().toISOString(),context:H,properties:p.properties,custom_properties:{...p.customProperties,...ne}},_e=s==="none"?null:p.request?Z(p.request):ot(),He=++u,Vt=await t.request(pn,{body:f,...p.keepalive&&{keepalive:!0}}),I=cn(Vt);if(s==="none")return!p.request&&I?.session_id&&He>b&&(b=He,I.session_id!==f.session_id&&(l=I.session_id)),f.session_id=p.request?I?.session_id||null:l,r?.(f),{success:!0,data:f};let Ae=p.request?_e:ot(),$t=Ae!==null&&Ae!==_e,Te=Ae??_e,Ke=!$t&&(!Te||!I?.anonymous_id||Te===I.anonymous_id);return Ke?(I?.anonymous_id&&(f.anonymous_id=I.anonymous_id),I?.session_id&&(f.session_id=I.session_id)):f.anonymous_id=Te,!p.request&&typeof window<"u"&&f.anonymous_id&&(Ke&&f.session_id&&ke.set(`${P}-session_id`,f.session_id.toString()),ct(f.anonymous_id)),r?.(f),{success:!0,data:f}}catch(H){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:H}}},O=Promise.resolve();return{log:async p=>{xe(p.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let h="request"in p&&p.request?{href:p.request.url,referrer:ln(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(p.page_context==="no_query"){let re=new URL(h.href),f=h.referrer?new URL(h.referrer):void 0;h={href:re.origin+re.pathname,referrer:f?f.origin+f.pathname:""}}s==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p={...p,keepalive:!0});let ne={event_id:W(),consent_lane:s,site_kind:c};if(s==="device"||p.request||l||p.keepalive)return $(p,h,ne);let H=()=>$(p,h,ne),Q=O.then(H,H);return O=Q,Q},supportsNoQueryPageContext:!0,getHeaders:p=>{let h=new Headers;return s==="none"||!p?.anonymous_id||h.append("Set-Cookie",it(p.anonymous_id)),h},getSessionInfo:E,getOrCreateAnonymousId:()=>s==="none"?d??(d=W()):Pe()}};var pt=require("neoqs");function Ce(t,n,r){let s=t["~standard"].validate(n);if(s instanceof Promise)throw new TypeError("Async schema");if(s.issues)throw new w(s.issues,r);return s.value}function dn(t,n,r){try{return{success:!0,output:Ce(t,n,r)}}catch(s){if(s instanceof w)return{success:!1,issues:s.issues,source:s.source};throw s}}var J=class{constructor(n){if(this.baseUrl=le[n.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),n.apiKey.type==="secret"){if(typeof window<"u")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",n.apiKey.key)}else this.headers.set("x-publishable-key",n.apiKey.key);this.logger=n.logger,this._environment=n.environment}get environment(){return this._environment}getFetchParams(n,r){let s=r.validateIn??!0,{searchParams:c,body:l}=s?Le(n,r):r,d=new URL(this.baseUrl),u=n.pathname;if("params"in r&&r.params)for(let[b,E]of Object.entries(r.params))u=u.replace(`:${b}`,String(E));return d.pathname=u,n.schema.searchParams&&(d.search=(0,pt.stringify)(c)),[d.toString(),{method:n.method,body:l?JSON.stringify(l):void 0,headers:this.headers,signal:r.signal,...r.keepalive&&{keepalive:!0}}]}async parseResponse(n,r){let s=await Ee(r.response);if(Ie(s,r.response.status),!(r.validateOut??!0))return s;let l=dn(n.schema.response,s,"response");if(!l.success)throw new w(l.issues,l.source);return l.output}async request(n,r){try{let s=this.getFetchParams(n,r),c=await fetch(...s);return await this.parseResponse(n,{response:c,validateOut:r.validateOut})}catch(s){throw s instanceof w?this.logger.error(s.message,s.issues):this.logger.error(s),s}}};function C(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function X(t){return t}function Le(t,n){let r={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(r.searchParams=Ce(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(r.body=Ce(t.schema.body,"body"in n?n.body:{})),r}function dt({publishableKey:t,env:n,logger:r=ae,onEvent:s,persistence:c,siteKind:l}){let d=Qe({baseUrl:le[n],publishableKey:t}),u=r===!1?ce:r,b=new J({environment:n,apiKey:{type:"publishable",key:t},logger:u}),E=lt({rpcClient:b,logger:u,onEvent:s,persistence:c,siteKind:l});return{register:O=>O({logger:u,apiClient:d,analytics:E,rpcClient:b,publishableKey:t,env:n}),analytics:E,apiClient:d}}var ut={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_RESULTS:"A search whose results returned, zero included; once per distinct query, filters, place and order.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function de(t){let n=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),r=5381;for(let s=0;s<n.length;s++)r=r*33^n.charCodeAt(s);return(r>>>0).toString(36)}function ue(t,n){return`${rt}:${t}:${n}`}function mt(t,n){if(typeof window>"u")return!1;try{let r=ue(t,de(n));return window.localStorage.getItem(r)==="accepted"}catch{return!1}}function vt(t,n){if(!(typeof window>"u"))try{let r=ue(t,de(n));window.localStorage.setItem(r,"accepted")}catch{}}var i=x(require("valibot"),1),un=["agent","sdk","form","integration","migration"],mn=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var vn=["screening","cv_match","interview","overall"],gn=["PENDING","IN_PROGRESS","COMPLETED","CANCELLED"],hn=["agent"],fn=["job","company"],yn=["created_at","updated_at","score","interview_score"],bn=["asc","desc"],Sn=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],_n=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written","ats_submission_attempted","ats_submission_succeeded","ats_submission_failed","ats_retry_payload_purged"],An=["pending","submitted","failed","not_required"],Tn=["user","system","automation","integration","candidate"],me=i.picklist(un),k=i.picklist(mn),T=i.pipe(i.string(),i.trim(),i.minLength(1),i.maxLength(100)),ve=i.picklist(vn),gt=i.picklist(gn),ht=i.picklist(hn),$r=i.picklist(fn),ft=i.picklist(yn),yt=i.picklist(bn),ee=i.pipe(i.string(),i.trim(),i.minLength(1),i.maxLength(100)),ge=i.picklist(Sn),bt=i.picklist(_n),St=i.picklist(Tn),q=i.picklist(An);var _=i.variant("type",[i.object({type:i.literal("user"),id:i.pipe(i.string(),i.minLength(1)),email:i.pipe(i.string(),i.minLength(1)),name:i.pipe(i.string(),i.minLength(1))}),i.object({type:i.literal("system"),id:i.pipe(i.string(),i.minLength(1)),name:i.optional(i.string())}),i.object({type:i.literal("automation"),id:i.pipe(i.string(),i.minLength(1)),name:i.optional(i.string())}),i.object({type:i.literal("integration"),id:i.pipe(i.string(),i.minLength(1)),name:i.optional(i.string())}),i.object({type:i.literal("candidate"),id:i.pipe(i.string(),i.minLength(1)),email:i.optional(i.string())})]);var R=x(require("valibot"),1),xn=R.object({total:R.number(),page:R.number(),perPage:R.number(),lastPage:R.number()});function _t(t){return R.object({data:R.array(t),pagination:xn})}var y=x(require("valibot"),1);var je=y.object({id:y.string(),email:y.nullable(y.string()),firstName:y.nullable(y.string()),lastName:y.nullable(y.string()),phone:y.nullable(y.string()),source:y.nullable(me),identifiedAt:y.nullable(y.string()),createdAt:y.string(),updatedAt:y.string()});var o=x(require("valibot"),1);var g=x(require("valibot"),1),j=g.pipe(g.string(),g.minLength(1)),te=g.pipe(g.number(),g.integer(),g.minValue(1)),L=g.record(g.string(),g.unknown()),En="(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}",zr=g.pipe(g.string(),g.regex(new RegExp(`^${En}$`)));var S=x(require("valibot"),1);var At=S.object({id:S.string(),applicationId:S.string(),status:gt,conductedBy:ht,agentInterviewId:S.nullable(S.string()),generatedScore:S.nullable(S.number()),completedAt:S.nullable(S.string()),meta:S.nullable(L),createdAt:S.string(),updatedAt:S.string()});var In=o.object({quote:o.string(),source:o.picklist(["cv","answer"])}),Oe=o.object({score:o.number(),reason:o.string(),confidence:o.number(),share:o.optional(o.number()),evidence:o.optional(o.array(In))}),De=o.object({categoryId:o.string(),answerKey:o.string(),reason:o.picklist(["unanswered","unrecognised"])}),Tt=o.object({id:o.string(),candidateId:o.string(),jobId:o.number(),stage:T,stageGroup:k,stageEnteredAt:o.string(),rating:o.nullable(o.number()),disqualifiedAt:o.nullable(o.string()),disqualificationReason:o.nullable(ee),disqualificationNote:o.nullable(o.string()),source:ge,sourceDetail:o.nullable(o.string()),sessionId:o.nullable(o.number()),externalApplicationId:o.nullable(o.string()),meta:o.nullable(L),context:o.nullable(L),scoredAt:o.nullable(o.string()),atsSubmissionStatus:o.optional(o.nullable(q)),atsSubmissionAttempts:o.optional(o.number()),atsNextAttemptAt:o.optional(o.nullable(o.string())),atsSubmittedAt:o.optional(o.nullable(o.string())),atsLastErrorCode:o.optional(o.nullable(o.string())),atsLastErrorMessage:o.optional(o.nullable(o.string())),createdAt:o.string(),updatedAt:o.string()}),wn=o.object({id:o.string(),applicationId:o.string(),scoreType:ve,score:o.nullable(o.number()),reason:o.nullable(o.string()),categories:o.nullable(o.record(o.string(),Oe)),leftOut:o.optional(o.array(De)),scoredBy:o.nullable(o.string()),createdAt:o.string()}),M=o.object({...Tt.entries,candidate:o.nullable(je),score:o.nullable(wn),interview:o.nullable(At)}),oo=o.object({...je.entries,applications:o.array(Tt)}),xt=o.object({id:o.string(),applicationId:o.string(),action:bt,fromStage:o.nullable(T),fromStageGroup:o.nullable(k),toStage:o.nullable(T),toStageGroup:o.nullable(k),disqualificationReason:o.nullable(ee),disqualificationNote:o.nullable(o.string()),actorId:o.nullable(o.string()),actorType:St,actorEmail:o.nullable(o.string()),actorName:o.nullable(o.string()),meta:o.nullable(L),schemaVersion:o.number(),createdAt:o.string()});var v=x(require("valibot"),1);var Et=v.object({anonymousId:j,email:j,firstName:v.nullish(v.string()),lastName:v.nullish(v.string()),phone:v.nullish(v.string()),source:v.nullish(me),updateExisting:v.optional(v.boolean())}),Ne=v.object({candidateId:v.string(),isNew:v.boolean()}),co=v.union([v.object({ok:v.literal(!0)}),Ne]);var e=x(require("valibot"),1);var kn=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],fe=e.picklist(kn),Ue=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),Rn=e.pipe(Ue,e.array(T)),Pn=e.pipe(Ue,e.array(k)),It=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),Cn=e.pipe(Ue,e.array(q)),wt=e.object({stages:e.optional(Rn),stage_groups:e.optional(Pn),job_id:e.optional(e.string()),job_ids:e.optional(It),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),ats_submission_status:e.optional(Cn),sort:e.optional(ft),order:e.optional(yt),page:e.optional(e.string()),per_page:e.optional(e.string())}),z=e.pipe(j,e.maxLength(255)),Ln=e.object({status:e.picklist(["pending","not_required"]),integrationId:e.nullish(z)}),go=e.pipe(e.object({candidateId:j,jobId:te,meta:e.nullish(L),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),externalJobId:e.nullish(e.pipe(j,e.maxLength(255))),context:e.nullish(L),source:e.nullish(ge),sourceDetail:e.nullish(e.string()),stage:e.nullish(T),stageGroup:e.nullish(k),actor:e.nullish(_),atsSubmission:e.nullish(Ln),duplicateScope:e.nullish(e.picklist(["job","attempt"]))}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together"),e.check(t=>t.duplicateScope!=="attempt"||typeof t.meta?.attempt_id=="string"&&t.meta.attempt_id!=="","duplicateScope attempt needs meta.attempt_id")),kt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),ho=e.union([e.object({ok:e.literal(!0),duplicate:e.literal(!1),applicationId:e.string(),candidateId:e.string(),atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!0),duplicate:e.literal(!0),existingApplication:kt,atsHeld:e.optional(e.boolean())})]),Rt=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(kt)}),jn=Date.UTC(1e4,0,1),On=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})$/),e.check(t=>{let[n,r,s]=t.slice(0,10).split("-").map(Number),c=new Date(Date.UTC(n,r-1,s)),l=Date.parse(t);return c.getUTCMonth()===r-1&&c.getUTCDate()===s&&l>=0&&l<jn},"must be a real time")),Be=e.pipe(e.string(),e.regex(/^[A-Za-z0-9_.:-]{1,100}$/)),fo=e.object({status:e.picklist(["pending","submitted","failed"]),nextAttemptAt:e.nullish(On),errorCode:e.nullish(Be),errorMessage:e.nullish(e.pipe(e.string(),e.maxLength(1e4))),externalApplicationId:e.nullish(z),externalRunId:e.nullish(z),integrationId:e.nullish(z),answeredPending:e.optional(e.boolean())}),Dn=e.picklist(["invalid_transition","next_attempt_required","retry_hold_expired"]),yo=e.variant("kind",[e.object({kind:e.literal("recorded"),application:M}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),to:q,reason:Dn})]),Nn=e.object({integrationId:e.string(),state:e.picklist(["closed","open","half_open"]),coolingUntil:e.nullable(e.string()),transientCount:e.number(),held:e.boolean()}),bo=e.object({groups:e.array(e.object({integrationId:e.nullable(e.string()),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),count:e.number(),retryable:e.number(),sendable:e.optional(e.number()),nextRetryUntil:e.optional(e.nullable(e.string()))})),oldestPendingAgeSeconds:e.nullable(e.number()),breakers:e.array(Nn),restoreHold:e.optional(e.boolean())}),So=e.object({status:e.picklist(["pending","failed"]),integrationId:e.nullable(z),errorCode:e.nullable(Be)}),_o=e.object({rows:e.array(e.object({id:e.string(),jobId:e.number(),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),errorMessage:e.nullable(e.string()),attempts:e.number(),nextAttemptAt:e.nullable(e.string()),payloadHeld:e.boolean(),receivedAt:e.nullable(e.string()),retryUntil:e.nullable(e.string()),updatedAt:e.string()})),truncated:e.boolean()}),Ao=e.object({actor:_,expectedAtsLogCount:e.optional(e.pipe(e.number(),e.integer(),e.minValue(0)))}),Un=e.picklist(["invalid_transition","retry_payload_missing","retry_hold_expired","stale"]),To=e.variant("kind",[e.object({kind:e.literal("retried"),application:M}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),reason:Un})]),xo=e.object({status:e.optional(e.picklist(["pending","failed"])),integrationId:e.nullable(z),errorCode:e.nullable(Be),actor:_}),Eo=e.object({retried:e.number()});var Io=e.object({integrationId:e.string(),wasOpen:e.boolean()}),wo=e.object({integrationId:e.string(),wasHeld:e.boolean()}),ko=e.object({applicationId:j,scoreType:ve,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Oe)),leftOut:e.nullish(e.array(De)),scoredBy:e.nullish(e.string()),actor:e.nullish(_),idempotencyKey:e.nullish(e.pipe(e.string(),e.maxLength(255)))}),Ro=e.object({scoreId:e.string()}),Po=_t(M);var Co=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),Lo=e.array(xt),he=e.object({stage:e.nullish(T),note:e.nullish(e.string())}),Bn=e.object({stage:e.nullish(T),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),Fn=e.variant("action",[e.object({action:e.literal("shortlist"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("move_to_interview"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("make_offer"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("hire"),actor:_,meta:e.nullish(Bn)}),e.object({action:e.literal("withdraw"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("move_to_stage"),actor:_,meta:e.object({stage:T,stageGroup:k,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:_,meta:e.object({toStage:T,toStageGroup:k,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:_,meta:e.object({reason:ee,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:_,meta:e.object({toStage:T,toStageGroup:k,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:_,meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),jo=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:Fn}),Pt=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),Oo=e.variant("kind",[e.object({kind:e.literal("updated"),action:fe,application:M}),e.object({kind:e.literal("skipped"),action:fe,applicationId:e.string(),reason:Pt})]),Do=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:fe,application:M})),skipped:e.array(e.object({kind:e.literal("skipped"),action:fe,applicationId:e.string(),reason:Pt})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),m=e.pipe(e.number(),e.integer(),e.minValue(0)),Ct=e.object({APPLIED:m,SHORTLISTED:m,INTERVIEWED:m,OFFERED:m,HIRED:m,REJECTED:m,WITHDRAWN:m}),No=e.object({job_ids:It}),Uo=e.object({counts:e.record(e.string(),Ct)}),Bo=e.omit(wt,["sort","order","page","per_page"]),Fo=e.object({counts:Ct}),Lt=92,qn=864e5,Y=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}$/),e.check(t=>{let n=new Date(`${t}T00:00:00Z`);return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t},"must be a real calendar day"));function jt({from:t,to:n}){let r=(Date.parse(`${n}T00:00:00Z`)-Date.parse(`${t}T00:00:00Z`))/qn+1;return r>=1&&r<=Lt}var Ot=`to must be on or after from, and the range must span at most ${Lt} days`,qo=e.pipe(e.object({from:Y,to:Y}),e.check(jt,Ot)),Mn=e.object({job_id:te,date:Y,received:m,scored:m,shortlisted:m}),Mo=e.object({rows:e.array(Mn)}),Gn=5e3,Vn=e.pipe(e.object({from:Y,to:Y,jobIds:e.optional(e.pipe(e.array(te),e.maxLength(Gn)))}),e.check(jt,Ot)),Go=e.pipe(e.object({from:e.string(),to:e.string(),job_ids:e.optional(e.string())}),e.transform(({from:t,to:n,job_ids:r})=>({from:t,to:n,jobIds:r===void 0?void 0:r===""?[]:r.split(",").map(s=>/^\d+$/.test(s.trim())?Number(s):Number.NaN)})),Vn),Dt=e.pipe(e.array(m),e.length(5)),$n=e.object({received:m,scored:m,shortlisted:m,histogram:e.pipe(e.array(m),e.length(101)),median_lag_minutes:e.nullable(e.number()),scored_same_day:m}),Hn=e.object({job_id:te,received:m,scored:m,shortlisted:m,score_sum:e.number(),bands:Dt}),Kn=e.object({date:Y,received:m,scored:m,score_sum:e.number(),bands:Dt,scored_on_day:m}),Wn=e.object({id:e.string(),label:e.nullable(e.string()),sum:e.number(),count:m}),Jn=e.object({template_id:e.string(),scored:m,criteria:e.array(Wn)}),Vo=e.object({totals:$n,by_job:e.array(Hn),by_day:e.array(Kn),criteria:e.array(Jn)});var $o=e.object({...e.omit(wt,["page","per_page"]).entries,per_group:e.optional(e.string())}),G=e.object({data:e.array(M),total:m}),Ho=e.object({board:e.object({APPLIED:G,SHORTLISTED:G,INTERVIEWED:G,OFFERED:G,HIRED:G,REJECTED:G,WITHDRAWN:G})});var ye=x(require("valibot"));var Nt=({environment:t,publishableKey:n,logger:r})=>{let s=et[t];return{async checkDuplicate(c){try{let l=new URLSearchParams({email:c.email,scope:c.scope});c.scope==="job"&&c.jobId!=null&&l.set("job_id",String(c.jobId));let d=await fetch(`${s}/applications/check-duplicate?${l}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":n}});if(!d.ok)return r.error(`[TalentBankClient] checkDuplicate failed with status ${d.status}`),{isDuplicate:!1};let u=await d.json(),b=ye.safeParse(Rt,u);return b.success?b.output:(r.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof u=="object"&&u!=null&&typeof u.isDuplicate=="boolean"?{isDuplicate:u.isDuplicate}:{isDuplicate:!1})}catch(l){return r.error("[TalentBankClient] checkDuplicate failed:",l),{isDuplicate:!1}}},async identify(c){try{if(!c.anonymousId)return r.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let l={email:c.email,firstName:c.firstName,lastName:c.lastName,phone:c.phone,anonymousId:c.anonymousId,source:c.source??"sdk"},d=ye.safeParse(Et,l);if(!d.success)return r.error("[TalentBankClient] identify received invalid input"),null;let u=await fetch(`${s}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(d.output)});if(!u.ok)return r.error(`[TalentBankClient] identify failed with status ${u.status}`),null;let b=ye.safeParse(Ne,await u.json());return b.success?b.output:(r.error("[TalentBankClient] identify returned an invalid response"),null)}catch(l){return r.error("[TalentBankClient] identify failed:",l),null}}}};function Ut(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var a=x(require("valibot"));var Fe=["DAILY","WEEKLY","MONTHLY"],zn=a.record(a.string(),a.union([a.string(),a.array(a.string()),a.object({type:a.literal("provided"),lat:a.number(),lng:a.number(),radius:a.number(),unit:a.optional(a.picklist(["miles","km"])),label:a.optional(a.string())})])),Yn={pathname:"/job/:id",method:"GET",schema:{response:a.object({id:a.number(),external_id:a.nullish(a.string()),city:a.nullish(a.string()),town:a.nullish(a.string()),category:a.nullish(a.string())})}};async function Bt(t,{contact:n,job:r}){let s={};if(r){let c=await t.request(Yn,{params:{id:r.id}});if((r.id_type==="internal"?String(c.id):c.external_id)!==r.id)throw new Error("Job lookup returned a different role");for(let d of["city","town","category"]){let u=c[d]?.trim();u&&(s[d]=[u])}}await t.request(qe,{body:{contact:n,alerts:"WEEKLY",filters:s}})}var qe={pathname:"/search/save",method:"POST",schema:{response:C(),body:a.object({contact:a.object({email:a.pipe(a.optional(a.string()),a.string(),a.email()),first_name:a.optional(a.string()),last_name:a.optional(a.string())}),alerts:a.pipe(a.optional(a.string()),a.string(),a.picklist(Fe)),filters:zn})}};var A=x(require("valibot"));var Ve=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:A.pipe(A.object({country:A.optional(A.array(A.object({value:A.string()})),[])}),A.transform(({country:r})=>r.map(({value:s})=>s))),searchParams:C()}};return t.request(n,{searchParams:{filters:{country:null}}})},be=new WeakMap,Mt=t=>(be.has(t)||(be.set(t,void 0),Ve(t).then(async n=>{let{jobCountryCodes:r}=await Promise.resolve().then(()=>(Ge(),qt));be.set(t,r(n).join(",")||void 0)}).catch(()=>{})),be.get(t)),$e=(t,n)=>{let r=new Set,s=[];for(let c=0;c<Math.max(t.length,n.length);c++)for(let l of[t[c],n[c]]){if(!l)continue;let d=l.mapbox_id||l.full_address||[l.name,l.place_formatted].filter(Boolean).join(", ");if(!r.has(d)&&(r.add(d),s.push(l),s.length===5))return s}return s},er=600,Gt=async(t,n,r)=>{if(r?.throwIfAborted(),!n){let s=await t();return r?.throwIfAborted(),s}return new Promise((s,c)=>{let l,d,u,b=!1,E=()=>{b=!0,clearTimeout(u),r?.removeEventListener("abort",$)},$=()=>{E(),c(r?.reason)},O=()=>{E(),l?.status==="fulfilled"&&d?.status==="fulfilled"?s($e(l.value,d.value)):l?.status==="fulfilled"?s(l.value):d?.status==="fulfilled"?s(d.value):l?.status==="rejected"&&c(l.reason)},Se=(p,h)=>{b||(p?l=h:d=h,l&&d?O():h.status==="fulfilled"&&h.value.length>0&&(u=setTimeout(O,er)))};r?.addEventListener("abort",$,{once:!0});for(let p of[!0,!1])t(p?n:void 0).then(h=>Se(p,{status:"fulfilled",value:h}),h=>Se(p,{status:"rejected",reason:h}))})};Ge();0&&(module.exports={ANALYTICS_EVENTS,ApiError,InploiRpcClient,JOB_ALERT_FREQUENCIES,NotFoundError,ParsingError,SchemaValidationError,SdkError,UnauthorisedError,addressSearchCountry,blendAddressSuggestions,consentStorageKey,createPlugin,createTalentBankClient,endpoint,generateUUID,getConsentAcceptance,getJobCountries,getOrCreateAnonymousId,hashConsentConfig,initialiseSdk,inploiBrandedLogger,isApiErrorWithData,isSdkError,jobCountryCodes,noLogging,ready,saveClosedRoleJobAlerts,saveSearchEndpoint,searchAddressSuggestions,setConsentAcceptance,typed,validateEndpointInputs});
14
14
  //# sourceMappingURL=index.js.map