@inploi/sdk 2.7.0 → 2.7.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 +6 -2
- package/cdn/index.js +1 -1
- package/dist/chunk-KC7FKSIJ.mjs +14 -0
- package/dist/chunk-KC7FKSIJ.mjs.map +1 -0
- package/dist/common.geo-transport-CJGUJXTA-TZLXVBMU.mjs +2 -0
- package/dist/common.geo-transport-CJGUJXTA-TZLXVBMU.mjs.map +1 -0
- package/dist/index.d.mts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/sdk.country-codes-W6HRF5SA.mjs +2 -0
- package/dist/sdk.country-codes-W6HRF5SA.mjs.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,8 +55,12 @@ instance when the persistence choice changes. Direct plugin storage and calls to
|
|
|
55
55
|
## Plugins
|
|
56
56
|
|
|
57
57
|
`getJobCountries(rpcClient)` reads the company's live-job countries from `GET /search/filters`
|
|
58
|
-
with `{ country: null }`. `jobCountryCodes` normalises feed names and
|
|
59
|
-
|
|
58
|
+
with `{ country: null }`. `jobCountryCodes` normalises feed country names, ISO2 and ISO3 codes, and ISO 3166-2
|
|
59
|
+
subdivision codes with a valid ISO2 prefix, without a default. The reported UK county values Lincolnshire and Surrey
|
|
60
|
+
alias to GB; other unknown place names, including cities, stay ignored.
|
|
61
|
+
Crown dependencies (Guernsey, Jersey and Isle of Man) retain their own ISO2 codes.
|
|
62
|
+
`addressSearchCountry(rpcClient)` starts that read once per client, loads the normaliser in the background after
|
|
63
|
+
metadata arrives, and returns the already available codes
|
|
60
64
|
as a lowercase comma-separated list of every hiring country. Pending, empty, invalid or failed country metadata
|
|
61
65
|
returns no filter immediately; address lookup never waits for it. The cache stays in memory and follows
|
|
62
66
|
the client's tenant and environment. Job search chooses its own UK fallback separately.
|
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 Wn=Object.defineProperty,Hn=Object.defineProperties;var Xn=Object.getOwnPropertyDescriptors;var yn=Object.getOwnPropertySymbols;var $n=Object.prototype.hasOwnProperty,Yn=Object.prototype.propertyIsEnumerable;var mn=(e,t,n)=>t in e?Wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t)=>{for(var n in t||(t={}))$n.call(t,n)&&mn(e,n,t[n]);if(yn)for(var n of yn(t))Yn.call(t,n)&&mn(e,n,t[n]);return e},B=(e,t)=>Hn(e,Xn(t));var O=(e,t,n)=>new Promise((r,s)=>{var o=u=>{try{c(n.next(u))}catch(f){s(f)}},a=u=>{try{c(n.throw(u))}catch(f){s(f)}},c=u=>u.done?r(u.value):Promise.resolve(u.value).then(o,a);c((n=n.apply(e,t)).next())});function Me(e,t){if(!e)throw new Error(t)}function oe(e,t){return t in e}var nr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var _e="%c[inploi SDK]",xe="color: #65BC67; font-weight: bold;",Ge={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)},Be={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Zn="Unauthenticated",Qn="This action is unauthorized.",ee=class extends Error{constructor(n,r){super(n);this.status=r,this.name="ErrorWithStatus"}},ye=class extends ee{constructor(t){super(t!=null?t:"Not found"),this.name="NotFoundError",this.status=404}},me=class extends ee{constructor(t,n){super(t!=null?t:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},Q=class extends ee{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 ee{constructor(n,r,s){super(n);this.data=s;this.name="ApiError",this.status=r!=null?r:500}};var he=class extends ee{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 Ue(e){return O(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 he(e);return e.json().catch(()=>{throw new he(e)})})}var et=["message","error","errors","exception","exceptions"];function nt(e){let t=[];if(typeof e=="object"&&e!==null){for(let n of et)if(oe(e,n)){let r=e[n];typeof r=="string"&&t.push(r),Array.isArray(r)&&r.every(s=>typeof s=="string")&&t.push(...r)}oe(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&oe(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&oe(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 Ve(e,t){if(t>=300){let n=nt(e);throw t===404?new ye(n):n===Zn?new me("You are not authenticated.",t):n===Qn?new me(n,t):new Ee(n,t,e)}}var hn=e=>{let t={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(s,...o)=>O(void 0,[s,...o],function*(n,r={}){let a=B(C({},r),{headers:C(C({},r.headers),t)}),c=yield fetch(`${e.baseUrl}${n}`,a);if(c.status===404)throw new ye;let u=yield Ue(c);return Ve(u,c.status),u})}};var dn="2.7.0";var Se={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},vn={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},gn=dn;var ne="isdk_session",we=`${ne}-candidate_id`,rt=`${ne}-consent`;var Ke="RFC3986",We={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},it="RFC1738";var st=Array.isArray,U=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var ze=1024,ot=(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(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let a="";for(let c=0;c<o.length;c+=ze){let u=o.length>=ze?o.slice(c,c+ze):o,f=[];for(let h=0;h<u.length;++h){let y=u.charCodeAt(h);if(y===45||y===46||y===95||y===126||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||s===it&&(y===40||y===41)){f[f.length]=u.charAt(h);continue}if(y<128){f[f.length]=U[y];continue}if(y<2048){f[f.length]=U[192|y>>6]+U[128|y&63];continue}if(y<55296||y>=57344){f[f.length]=U[224|y>>12]+U[128|y>>6&63]+U[128|y&63];continue}h+=1,y=65536+((y&1023)<<10|u.charCodeAt(h)&1023),f[f.length]=U[240|y>>18]+U[128|y>>12&63]+U[128|y>>6&63]+U[128|y&63]}a+=f.join("")}return a};function ut(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function bn(e,t){if(st(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var mr=Array.isArray;var at=Object.prototype.hasOwnProperty,kn={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},V=Array.isArray,lt=Array.prototype.push,_n=function(e,t){lt.apply(e,V(t)?t:[t])},ct=Date.prototype.toISOString,j={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ot,encodeValuesOnly:!1,format:Ke,formatter:We[Ke],indices:!1,serializeDate(e){return ct.call(e)},skipNulls:!1,strictNullHandling:!1};function pt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var Je={};function xn(e,t,n,r,s,o,a,c,u,f,h,y,p,v,E,T,w,P){let b=e,R=P,$=0,pe=!1;for(;(R=R.get(Je))!==void 0&&!pe;){let D=R.get(e);if($+=1,typeof D!="undefined"){if(D===$)throw new RangeError("Cyclic object value");pe=!0}typeof R.get(Je)=="undefined"&&($=0)}if(typeof f=="function"?b=f(t,b):b instanceof Date?b=p==null?void 0:p(b):n==="comma"&&V(b)&&(b=bn(b,function(D){return D instanceof Date?p==null?void 0:p(D):D})),b===null){if(o)return u&&!T?u(t,j.encoder,w,"key",v):t;b=""}if(pt(b)||ut(b)){if(u){let D=T?t:u(t,j.encoder,w,"key",v);return[(E==null?void 0:E(D))+"="+(E==null?void 0:E(u(b,j.encoder,w,"value",v)))]}return[(E==null?void 0:E(t))+"="+(E==null?void 0:E(String(b)))]}let fe=[];if(typeof b=="undefined")return fe;let x;if(n==="comma"&&V(b))T&&u&&(b=bn(b,u)),x=[{value:b.length>0?b.join(",")||null:void 0}];else if(V(f))x=f;else{let D=Object.keys(b);x=h?D.sort(h):D}let Y=c?String(t).replace(/\./g,"%2E"):String(t),se=r&&V(b)&&b.length===1?Y+"[]":Y;if(s&&V(b)&&b.length===0)return se+"[]";for(let D=0;D<x.length;++D){let K=x[D],Z=typeof K=="object"&&typeof K.value!="undefined"?K.value:b[K];if(a&&Z===null)continue;let W=y&&c?K.replace(/\./g,"%2E"):K,Kn=V(b)?typeof n=="function"?n(se,W):se:se+(y?"."+W:"["+W+"]");P.set(e,$);let fn=new WeakMap;fn.set(Je,P),_n(fe,xn(Z,Kn,n,r,s,o,a,c,n==="comma"&&T&&V(b)?null:u,f,h,y,p,v,E,T,w,fn))}return fe}function ft(e=j){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||j.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(!at.call(We,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let r=We[n],s=j.filter;(typeof e.filter=="function"||V(e.filter))&&(s=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in kn?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=j.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:j.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:j.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:j.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:j.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?j.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:j.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:j.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:j.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:j.encodeValuesOnly,filter:s,format:n,formatter:r,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:j.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:j.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:j.strictNullHandling}}function En(e,t={}){let n=e,r=ft(t),s,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):V(r.filter)&&(o=r.filter,s=o);let a=[];if(typeof n!="object"||n===null)return"";let c=kn[r.arrayFormat],u=c==="comma"&&r.commaRoundTrip;s||(s=Object.keys(n)),r.sort&&s.sort(r.sort);let f=new WeakMap;for(let p=0;p<s.length;++p){let v=s[p];r.skipNulls&&n[v]===null||_n(a,xn(n[v],v,c,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,f))}let h=a.join(r.delimiter),y=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),h.length>0?y+h:""}function He(e,t,n){let r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Async schema");if(r.issues)throw new Q(r.issues,n);return r.value}function yt(e,t,n){try{return{success:!0,output:He(e,t,n)}}catch(r){if(r instanceof Q)return{success:!1,issues:r.issues,source:r.source};throw r}}var de=class{constructor(t){if(this.baseUrl=Se[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?Sn(t,n):n,a=new URL(this.baseUrl),c=t.pathname;if("params"in n&&n.params)for(let[f,h]of Object.entries(n.params))c=c.replace(`:${f}`,String(h));return a.pathname=c,t.schema.searchParams&&(a.search=En(s)),[a.toString(),C({method:t.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(t,n){return O(this,null,function*(){var a;let r=yield Ue(n.response);if(Ve(r,n.response.status),!((a=n.validateOut)!=null?a:!0))return r;let o=yt(t.schema.response,r,"response");if(!o.success)throw new Q(o.issues,o.source);return o.output})}request(t,n){return O(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 Q?this.logger.error(r.message,r.issues):this.logger.error(r),r}})}};function te(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function Sn(e,t){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=He(e.schema.searchParams,"searchParams"in t?t.searchParams:{})),e.schema.body&&(n.body=He(e.schema.body,"body"in t?t.body:{})),n}var H;function An(e){var t,n,r;return{lang:(t=e==null?void 0:e.lang)!=null?t:H==null?void 0:H.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:H==null?void 0:H.abortEarly,abortPipeEarly:(r=e==null?void 0:e.abortPipeEarly)!=null?r:H==null?void 0:H.abortPipeEarly}}var Xe;function mt(e){return Xe==null?void 0:Xe.get(e)}var $e;function ht(e){return $e==null?void 0:$e.get(e)}var Ye;function dt(e,t){var n;return(n=Ye==null?void 0:Ye.get(e))==null?void 0:n.get(t)}function re(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 y,p,v,E,T,w,P,b;let o=s&&"input"in s?s.input:n.value,a=(p=(y=s==null?void 0:s.expected)!=null?y:e.expects)!=null?p:null,c=(v=s==null?void 0:s.received)!=null?v:re(o),u={kind:e.kind,type:e.type,input:o,expected:a,received:c,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${c}`,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},f=e.kind==="schema",h=(b=(P=(w=(T=(E=s==null?void 0:s.message)!=null?E:e.message)!=null?T:dt(e.reference,u.lang))!=null?w:f?ht(u.lang):null)!=null?P:r.message)!=null?b:mt(u.lang);h!==void 0&&(u.message=typeof h=="function"?h(u):h),f&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}function N(e){return{version:1,vendor:"valibot",validate(t){return e["~run"]({value:t},An())}}}function vt(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function Ze(e,t){var r;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:(r=n[0])!=null?r:"never"}var gt=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,Sr=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 Qe(e,t){return{kind:"validation",type:"check",reference:Qe,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 en(e){return{kind:"validation",type:"email",reference:en,expects:null,async:!1,requirement:gt,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&I(this,"email",t,n),t}}}function ue(e){return{kind:"validation",type:"integer",reference:ue,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 Ae(e,t){return{kind:"validation",type:"max_length",reference:Ae,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 nn(e,t){return{kind:"validation",type:"max_value",reference:nn,async:!1,expects:`<=${e instanceof Date?e.toJSON():re(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():re(n.value)}),n}}}function L(e,t){return{kind:"validation",type:"min_length",reference:L,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 ae(e,t){return{kind:"validation",type:"min_value",reference:ae,async:!1,expects:`>=${e instanceof Date?e.toJSON():re(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():re(n.value)}),n}}}function Ie(e){return{kind:"transformation",type:"transform",reference:Ie,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function Te(){return{kind:"transformation",type:"trim",reference:Te,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}function bt(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function Pe(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function F(e,t){return{kind:"schema",type:"array",reference:F,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return N(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 c=s[a],u=this.item["~run"]({value:c},r);if(u.issues){let f={type:"array",origin:"value",input:s,key:a,value:c};for(let h of u.issues)h.path?h.path.unshift(f):h.path=[f],(o=n.issues)==null||o.push(h);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 ve(e){return{kind:"schema",type:"boolean",reference:ve,expects:"boolean",async:!1,message:e,get"~standard"(){return N(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:re(e),async:!1,literal:e,message:t,get"~standard"(){return N(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 N(this)},"~run"(n,r){return n.value===null&&(this.default!==void 0&&(n.value=Pe(this,n,r)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function d(e,t){return{kind:"schema",type:"nullish",reference:d,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return N(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Pe(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function k(e){return{kind:"schema",type:"number",reference:k,expects:"number",async:!1,message:e,get"~standard"(){return N(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 N(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 c=this.entries[a];if(a in s||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){let u=a in s?s[a]:Pe(c),f=c["~run"]({value:u},r);if(f.issues){let h={type:"object",origin:"value",input:s,key:a,value:u};for(let y of f.issues)y.path?y.path.unshift(h):y.path=[h],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=f.issues),r.abortEarly){n.typed=!1;break}}f.typed||(n.typed=!1),n.value[a]=f.value}else if(c.fallback!==void 0)n.value[a]=bt(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.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 g(e,t){return{kind:"schema",type:"optional",reference:g,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return N(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Pe(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:Ze(e.map(re),"|"),async:!1,options:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){return this.options.includes(n.value)?n.typed=!0:I(this,"type",n,r),n}}}function z(e,t,n){return{kind:"schema",type:"record",reference:z,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return N(this)},"~run"(r,s){var a,c;let o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(let u in o)if(vt(o,u)){let f=o[u],h=this.key["~run"]({value:u},s);if(h.issues){let p={type:"object",origin:"key",input:o,key:u,value:f};for(let v of h.issues)v.path=[p],(a=r.issues)==null||a.push(v);if(r.issues||(r.issues=h.issues),s.abortEarly){r.typed=!1;break}}let y=this.value["~run"]({value:f},s);if(y.issues){let p={type:"object",origin:"value",input:o,key:u,value:f};for(let v of y.issues)v.path?v.path.unshift(p):v.path=[p],(c=r.issues)==null||c.push(v);if(r.issues||(r.issues=y.issues),s.abortEarly){r.typed=!1;break}}(!h.typed||!y.typed)&&(r.typed=!1),h.typed&&(r.value[h.value]=y.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 N(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)t?t.push(...n.issues):t=n.issues;return t}function ge(e,t){return{kind:"schema",type:"union",reference:ge,expects:Ze(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){let s,o,a;for(let c of this.options){let u=c["~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 tn(){return{kind:"schema",type:"unknown",reference:tn,expects:"unknown",async:!1,get"~standard"(){return N(this)},"~run"(e){return e.typed=!0,e}}}function le(e,t,n){return{kind:"schema",type:"variant",reference:le,expects:"Object",async:!1,key:e,options:t,message:n,get"~standard"(){return N(this)},"~run"(r,s){let o=r.value;if(o&&typeof o=="object"){let a,c=0,u=this.key,f=[],h=(y,p)=>{for(let v of y.options){if(v.type==="variant")h(v,new Set(p).add(v.key));else{let E=!0,T=0;for(let w of p){let P=v.entries[w];if(w in o?P["~run"]({typed:!1,value:o[w]},{abortEarly:!0}).issues:P.type!=="exact_optional"&&P.type!=="optional"&&P.type!=="nullish"){E=!1,u!==w&&(c<T||c===T&&w in o&&!(u in o))&&(c=T,u=w,f=[]),u===w&&f.push(v.entries[w].expects);break}T++}if(E){let w=v["~run"]({value:o},s);(!a||!a.typed&&w.typed)&&(a=w)}}if(a&&!a.issues)break}};if(h(this,new Set([this.key])),a)return a;I(this,"type",r,s,{input:o[u],expected:Ze(f,"|"),path:[{type:"object",origin:"value",input:o,key:u,value:o[u]}]})}else I(this,"type",r,s);return r}}}function S(...e){return B(C({},e[0]),{pipe:e,get"~standard"(){return N(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}})}function Re(e,t,n){let r=e["~run"]({value:t},An(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var kt=["agent","sdk","form","integration","migration"],_t=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var xt=["screening","cv_match","interview","overall"],Et=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],St=["job","company"],wt=["created_at","updated_at"],At=["asc","desc"],It=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Tt=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],Pt=["user","system","automation","integration","candidate"],De=A(kt),J=A(_t),M=S(i(),Te(),L(1),Ae(100)),je=A(xt),In=A(Et),Ar=A(St),Tn=A(wt),Pn=A(At),be=S(i(),Te(),L(1),Ae(100)),Oe=A(It),Rn=A(Tt),Dn=A(Pt);var q=le("type",[l({type:_("user"),id:S(i(),L(1)),email:S(i(),L(1)),name:S(i(),L(1))}),l({type:_("system"),id:S(i(),L(1)),name:g(i())}),l({type:_("automation"),id:S(i(),L(1)),name:g(i())}),l({type:_("integration"),id:S(i(),L(1)),name:g(i())}),l({type:_("candidate"),id:S(i(),L(1)),email:g(i())})]);var Rt=l({total:k(),page:k(),perPage:k(),lastPage:k()});function Ce(e){return l({data:F(e),pagination:Rt})}var ke=l({id:i(),email:m(i()),firstName:m(i()),lastName:m(i()),phone:m(i()),source:m(De),identifiedAt:m(i()),createdAt:i(),updatedAt:i()});var ce=S(i(),L(1)),jn=S(k(),ue(),ae(1)),X=z(i(),tn());var On=l({id:i(),applicationId:i(),status:In,scheduledAt:m(i()),completedAt:m(i()),meta:m(X),createdAt:i(),updatedAt:i()});var rn=l({score:k(),reason:i(),confidence:k()}),Cn=l({id:i(),candidateId:i(),jobId:k(),stage:M,stageGroup:J,stageEnteredAt:i(),rating:m(k()),disqualifiedAt:m(i()),disqualificationReason:m(be),disqualificationNote:m(i()),source:Oe,sourceDetail:m(i()),sessionId:m(k()),externalApplicationId:m(i()),meta:m(X),context:m(X),scoredAt:m(i()),createdAt:i(),updatedAt:i()}),Dt=l({id:i(),applicationId:i(),scoreType:je,score:m(k()),reason:m(i()),categories:m(z(i(),rn)),scoredBy:m(i()),createdAt:i()}),Ne=l(B(C({},Cn.entries),{candidate:m(ke),score:m(Dt),interview:m(On)})),jt=l(B(C({},ke.entries),{applications:F(Cn)})),Nn=l({id:i(),applicationId:i(),action:Rn,fromStage:m(M),fromStageGroup:m(J),toStage:m(M),toStageGroup:m(J),disqualificationReason:m(be),disqualificationNote:m(i()),actorId:m(i()),actorType:Dn,actorEmail:m(i()),actorName:m(i()),meta:m(X),schemaVersion:k(),createdAt:i()});var Ln=l({anonymousId:ce,email:ce,firstName:d(i()),lastName:d(i()),phone:d(i()),source:d(De)}),Fn=l({candidateId:i(),isNew:ve()});var Ot=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],Fe=A(Ot),qn=S(i(),Ie(e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0))),Ct=S(qn,F(M)),Nt=S(qn,F(J)),Mn=S(i(),Ie(e=>e.split(",").map(t=>Number(t.trim())).filter(t=>Number.isInteger(t)&&t>0))),Hr=l({stages:g(Ct),stage_groups:g(Nt),job_id:g(i()),job_ids:g(Mn),candidate_id:g(i()),is_disqualified:g(A(["true","false"])),created_from:g(i()),created_to:g(i()),updated_from:g(i()),updated_to:g(i()),entered_stage_from:g(i()),entered_stage_to:g(i()),from:g(i()),to:g(i()),q:g(i()),scored:g(A(["true","false"])),sort:g(Tn),order:g(Pn),page:g(i()),per_page:g(i())}),Xr=S(l({candidateId:ce,jobId:jn,meta:d(X),sessionId:d(k()),externalApplicationId:d(i()),context:d(X),source:d(Oe),sourceDetail:d(i()),stage:d(M),stageGroup:d(J),actor:d(q)}),Qe(e=>e.stage==null==(e.stageGroup==null),"stage and stageGroup must be supplied together")),Gn=l({id:i(),stageGroup:i(),createdAt:i()}),$r=ge([l({ok:_(!0),duplicate:_(!1),applicationId:i(),candidateId:i()}),l({ok:_(!0),duplicate:_(!0),existingApplication:Gn})]),Bn=l({isDuplicate:ve(),existingApplication:g(Gn)}),Yr=l({applicationId:ce,scoreType:je,score:k(),reason:d(i()),categories:d(z(i(),rn)),scoredBy:d(i()),actor:d(q)}),Zr=l({scoreId:i()}),Qr=Ce(Ne);var ei=A(["already_in_target_stage","not_in_source_stage","disqualified"]),ni=F(Nn),Le=l({stage:d(M),note:d(i())}),Lt=l({stage:d(M),startDate:d(i()),note:d(i())}),Ft=le("action",[l({action:_("shortlist"),actor:q,meta:d(Le)}),l({action:_("move_to_interview"),actor:q,meta:d(Le)}),l({action:_("make_offer"),actor:q,meta:d(Le)}),l({action:_("hire"),actor:q,meta:d(Lt)}),l({action:_("withdraw"),actor:q,meta:d(Le)}),l({action:_("move_to_stage"),actor:q,meta:l({stage:M,stageGroup:J,note:d(i())})}),l({action:_("stage_transition"),actor:q,meta:l({toStage:M,toStageGroup:J,note:d(i())})}),l({action:_("disqualify"),actor:q,meta:l({reason:be,note:d(i())})}),l({action:_("reinstate"),actor:q,meta:l({toStage:M,toStageGroup:J,note:d(i())})}),l({action:_("rate"),actor:q,meta:l({rating:m(S(k(),ue(),ae(1),nn(5)))})})]),ti=l({applicationIds:S(F(i()),L(1)),body:Ft}),Un=A(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),ri=le("kind",[l({kind:_("updated"),action:Fe,application:Ne}),l({kind:_("skipped"),action:Fe,applicationId:i(),reason:Un})]),ii=l({updated:F(l({kind:_("updated"),action:Fe,application:Ne})),skipped:F(l({kind:_("skipped"),action:Fe,applicationId:i(),reason:Un})),failed:F(l({applicationId:i(),error:i()}))}),ie=S(k(),ue(),ae(0)),qt=l({APPLIED:ie,SHORTLISTED:ie,INTERVIEWED:ie,OFFERED:ie,HIRED:ie,REJECTED:ie,WITHDRAWN:ie}),si=l({job_ids:Mn}),oi=l({counts:z(i(),qt)});var pi=Ce(ke);var yi=l({avg_score:m(k()),p90_score:m(k()),p85_score:m(k()),p80_score:m(k()),total_scores:k(),total_shortlists:k()});var sn=({environment:e,publishableKey:t,logger:n})=>{let r=vn[e];return{checkDuplicate(o){return O(this,null,function*(){try{let a=new URLSearchParams({email:o.email,scope:o.scope});o.scope==="job"&&o.jobId!=null&&a.set("job_id",String(o.jobId));let c=yield fetch(`${r}/applications/check-duplicate?${a}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":t}});if(!c.ok)return n.error(`[TalentBankClient] checkDuplicate failed with status ${c.status}`),{isDuplicate:!1};let u=yield c.json(),f=Re(Bn,u);return f.success?f.output:(n.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(a){return n.error("[TalentBankClient] checkDuplicate failed:",a),{isDuplicate:!1}}})},identify(o){return O(this,null,function*(){var a;try{if(!o.anonymousId)return n.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let c={email:o.email,firstName:o.firstName,lastName:o.lastName,phone:o.phone,anonymousId:o.anonymousId,source:(a=o.source)!=null?a:"sdk"},u=Re(Ln,c);if(!u.success)return n.error("[TalentBankClient] identify received invalid input"),null;let f=yield fetch(`${r}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":t},body:JSON.stringify(u.output)});if(!f.ok)return n.error(`[TalentBankClient] identify failed with status ${f.status}`),null;let h=Re(Fn,yield f.json());return h.success?h.output:(n.error("[TalentBankClient] identify returned an invalid response"),null)}catch(c){return n.error("[TalentBankClient] identify failed:",c),null}})}}};var qe=()=>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 on(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Vn=["DAILY","WEEKLY","MONTHLY"],Mt=z(i(),ge([i(),F(i()),l({type:_("provided"),lat:k(),lng:k(),radius:k(),unit:g(A(["miles","km"])),label:g(i())})])),Li={pathname:"/job/:id",method:"GET",schema:{response:l({id:k(),external_id:d(i()),city:d(i()),town:d(i()),category:d(i())})}};var Gt={pathname:"/search/save",method:"POST",schema:{response:te(),body:l({contact:l({email:S(g(i()),i(),en()),first_name:g(i()),last_name:g(i())}),alerts:S(g(i()),i(),A(Vn)),filters:Mt})}};var ln=e=>{let t=new Date;return t.setTime(t.getTime()+7*24*60*60*1e3),`${ne}=${e};expires=${t.toUTCString()};path=/`},Bt=(e,t)=>{let n=e.get("session_id");if(t||n)return n;let r=sessionStorage.getItem(`${ne}-session_id`);return typeof r=="string"?r:null},Ut=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(we);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Vt=e=>{if(typeof window!="undefined")try{e?window.localStorage.setItem(we,e):window.localStorage.removeItem(we)}catch(t){}},zt=new RegExp(`(?:^|;\\s*)${ne}=([^;]+)`),cn=e=>{var n,r;let t=e?e.headers.get("cookie"):document.cookie;return t&&(r=(n=zt.exec(t))==null?void 0:n[1])!=null?r:null},pn=e=>{var r;let t=e?e.url:location.href,{searchParams:n}=new URL(t);return{anonymous_id:(r=cn(e))!=null?r:n.get("anonymous_id"),session_id:Bt(n,typeof window=="undefined")}},zn=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=pn().anonymous_id;if(e)return e;let t=qe(),n=pn().anonymous_id;return n||(document.cookie=ln(t),t)},Jt=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},Kt=e=>e==="about:client"?"":e,Wt={pathname:"/log",method:"POST",schema:{response:te(),body:te()}},Jn=({rpcClient:e,logger:t,onEvent:n,talentBank:r,persistence:s="device"})=>{let o=null,a=0,c=0,u=p=>s==="none"?{anonymous_id:null,session_id:p?null:o}:pn(p),f=(p,v)=>O(void 0,null,function*(){var E,T;try{let w={library:{name:"inploi-sdk",version:gn},page:v},P=u(p.request);s==="device"&&p.event==="IDENTIFY"&&!P.anonymous_id&&!p.request&&typeof window!="undefined"&&(P=B(C({},P),{anonymous_id:zn()}));let b=s==="none"?null:Ut();if(p.event==="IDENTIFY"&&r&&(P.anonymous_id||s==="none")){let Z=p.properties,W=yield r.identify({email:(E=Z.email)!=null?E:Z.identifier,firstName:Z.first_name,lastName:Z.last_name,phone:Z.phone_number,anonymousId:(T=P.anonymous_id)!=null?T:qe(),source:"sdk"});W!=null&&W.candidateId&&s==="device"&&(b=W.candidateId,Vt(W.candidateId))}let R={anonymous_id:P.anonymous_id,session_id:P.session_id,candidate_id:b,event:p.event,sent_at:new Date().toISOString(),context:w,properties:p.properties,custom_properties:p.customProperties},$=s==="none"?null:cn(p.request),pe=++a,fe=yield e.request(Wt,C({body:R},p.keepalive&&{keepalive:!0})),x=Jt(fe);if(s==="none")return!p.request&&(x!=null&&x.session_id)&&pe>c&&(c=pe,x.session_id!==R.session_id&&(o=x.session_id)),R.session_id=p.request?(x==null?void 0:x.session_id)||null:o,n==null||n(R),{success:!0,data:R};let Y=p.request?$:cn(),se=Y!==null&&Y!==$,D=Y!=null?Y:$,K=!se&&(!D||!(x!=null&&x.anonymous_id)||D===x.anonymous_id);return K?(x!=null&&x.anonymous_id&&(R.anonymous_id=x.anonymous_id),x!=null&&x.session_id&&(R.session_id=x.session_id)):R.anonymous_id=D,!p.request&&typeof window!="undefined"&&R.anonymous_id&&(K&&R.session_id&&sessionStorage.setItem(`${ne}-session_id`,R.session_id.toString()),document.cookie=ln(R.anonymous_id)),n==null||n(R),{success:!0,data:R}}catch(w){return t.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:w}}}),h=Promise.resolve();return{log:p=>O(void 0,null,function*(){Me(p.request||typeof window!="undefined","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:Kt(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(s==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p=B(C({},p),{keepalive:!0})),s==="device"||p.request||o||p.keepalive)return f(p,v);let E=()=>f(p,v),T=h.then(E,E);return h=T,T}),getHeaders:p=>{let v=new Headers;return s==="none"||!(p!=null&&p.anonymous_id)||v.append("Set-Cookie",ln(p.anonymous_id)),v},getSessionInfo:u}};function an({publishableKey:e,env:t,logger:n=Ge,onEvent:r,persistence:s}){let o=hn({baseUrl:Se[t],publishableKey:e}),a=n===!1?Be:n,c=new de({environment:t,apiKey:{type:"publishable",key:e},logger:a}),u=sn({environment:t,publishableKey:e,logger:a}),f=Jn({rpcClient:c,logger:a,onEvent:r,talentBank:u,persistence:s});return{register:y=>y({logger:a,apiClient:o,analytics:f,rpcClient:c,publishableKey:e,env:t}),analytics:f,apiClient:o}}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=an;window.inploi.ready=on;})();
|
|
3
|
+
"use strict";(()=>{var Hn=Object.defineProperty,Xn=Object.defineProperties;var $n=Object.getOwnPropertyDescriptors;var yn=Object.getOwnPropertySymbols;var Yn=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable;var mn=(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)&&mn(e,n,t[n]);if(yn)for(var n of yn(t))Zn.call(t,n)&&mn(e,n,t[n]);return e},G=(e,t)=>Xn(e,$n(t));var Qn=(e,t)=>()=>(e&&(t=e(e=0)),t);var C=(e,t,n)=>new Promise((r,s)=>{var o=u=>{try{c(n.next(u))}catch(f){s(f)}},a=u=>{try{c(n.throw(u))}catch(f){s(f)}},c=u=>u.done?r(u.value):Promise.resolve(u.value).then(o,a);c((n=n.apply(e,t)).next())});var Vn=Qn(()=>{"use strict"});function Me(e,t){if(!e)throw new Error(t)}function oe(e,t){return t in e}var rr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var _e="%c[inploi SDK]",xe="color: #65BC67; font-weight: bold;",Ge={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)},ze={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var et="Unauthenticated",nt="This action is unauthorized.",ee=class extends Error{constructor(n,r){super(n);this.status=r,this.name="ErrorWithStatus"}},ye=class extends ee{constructor(t){super(t!=null?t:"Not found"),this.name="NotFoundError",this.status=404}},me=class extends ee{constructor(t,n){super(t!=null?t:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},Q=class extends ee{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 ee{constructor(n,r,s){super(n);this.data=s;this.name="ApiError",this.status=r!=null?r:500}};var de=class extends ee{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 C(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 de(e);return e.json().catch(()=>{throw new de(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(oe(e,n)){let r=e[n];typeof r=="string"&&t.push(r),Array.isArray(r)&&r.every(s=>typeof s=="string")&&t.push(...r)}oe(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&oe(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&oe(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 Ue(e,t){if(t>=300){let n=rt(e);throw t===404?new ye(n):n===et?new me("You are not authenticated.",t):n===nt?new me(n,t):new Ee(n,t,e)}}var dn=e=>{let t={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(s,...o)=>C(void 0,[s,...o],function*(n,r={}){let a=G(O({},r),{headers:O(O({},r.headers),t)}),c=yield fetch(`${e.baseUrl}${n}`,a);if(c.status===404)throw new ye;let u=yield Be(c);return Ue(u,c.status),u})}};var hn="2.7.1";var we={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},vn={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},gn=hn;var ne="isdk_session",Se=`${ne}-candidate_id`,st=`${ne}-consent`;var Ke="RFC3986",We={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 Ve=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(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let a="";for(let c=0;c<o.length;c+=Ve){let u=o.length>=Ve?o.slice(c,c+Ve):o,f=[];for(let d=0;d<u.length;++d){let y=u.charCodeAt(d);if(y===45||y===46||y===95||y===126||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||s===ot&&(y===40||y===41)){f[f.length]=u.charAt(d);continue}if(y<128){f[f.length]=B[y];continue}if(y<2048){f[f.length]=B[192|y>>6]+B[128|y&63];continue}if(y<55296||y>=57344){f[f.length]=B[224|y>>12]+B[128|y>>6&63]+B[128|y&63];continue}d+=1,y=65536+((y&1023)<<10|u.charCodeAt(d)&1023),f[f.length]=B[240|y>>18]+B[128|y>>12&63]+B[128|y>>6&63]+B[128|y&63]}a+=f.join("")}return a};function lt(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function bn(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 hr=Array.isArray;var ct=Object.prototype.hasOwnProperty,kn={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},U=Array.isArray,pt=Array.prototype.push,_n=function(e,t){pt.apply(e,U(t)?t:[t])},ft=Date.prototype.toISOString,D={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:We[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 Je={};function xn(e,t,n,r,s,o,a,c,u,f,d,y,p,v,E,T,S,P){let b=e,R=P,$=0,pe=!1;for(;(R=R.get(Je))!==void 0&&!pe;){let j=R.get(e);if($+=1,typeof j!="undefined"){if(j===$)throw new RangeError("Cyclic object value");pe=!0}typeof R.get(Je)=="undefined"&&($=0)}if(typeof f=="function"?b=f(t,b):b instanceof Date?b=p==null?void 0:p(b):n==="comma"&&U(b)&&(b=bn(b,function(j){return j instanceof Date?p==null?void 0:p(j):j})),b===null){if(o)return u&&!T?u(t,D.encoder,S,"key",v):t;b=""}if(yt(b)||lt(b)){if(u){let j=T?t:u(t,D.encoder,S,"key",v);return[(E==null?void 0:E(j))+"="+(E==null?void 0:E(u(b,D.encoder,S,"value",v)))]}return[(E==null?void 0:E(t))+"="+(E==null?void 0:E(String(b)))]}let fe=[];if(typeof b=="undefined")return fe;let x;if(n==="comma"&&U(b))T&&u&&(b=bn(b,u)),x=[{value:b.length>0?b.join(",")||null:void 0}];else if(U(f))x=f;else{let j=Object.keys(b);x=d?j.sort(d):j}let Y=c?String(t).replace(/\./g,"%2E"):String(t),se=r&&U(b)&&b.length===1?Y+"[]":Y;if(s&&U(b)&&b.length===0)return se+"[]";for(let j=0;j<x.length;++j){let K=x[j],Z=typeof K=="object"&&typeof K.value!="undefined"?K.value:b[K];if(a&&Z===null)continue;let W=y&&c?K.replace(/\./g,"%2E"):K,Wn=U(b)?typeof n=="function"?n(se,W):se:se+(y?"."+W:"["+W+"]");P.set(e,$);let fn=new WeakMap;fn.set(Je,P),_n(fe,xn(Z,Wn,n,r,s,o,a,c,n==="comma"&&T&&U(b)?null:u,f,d,y,p,v,E,T,S,fn))}return fe}function mt(e=D){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||D.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(We,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let r=We[n],s=D.filter;(typeof e.filter=="function"||U(e.filter))&&(s=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in kn?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=D.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:D.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:D.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:D.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:D.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?D.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:D.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:D.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:D.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:D.encodeValuesOnly,filter:s,format:n,formatter:r,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:D.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:D.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:D.strictNullHandling}}function En(e,t={}){let n=e,r=mt(t),s,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):U(r.filter)&&(o=r.filter,s=o);let a=[];if(typeof n!="object"||n===null)return"";let c=kn[r.arrayFormat],u=c==="comma"&&r.commaRoundTrip;s||(s=Object.keys(n)),r.sort&&s.sort(r.sort);let f=new WeakMap;for(let p=0;p<s.length;++p){let v=s[p];r.skipNulls&&n[v]===null||_n(a,xn(n[v],v,c,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,f))}let d=a.join(r.delimiter),y=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),d.length>0?y+d:""}function He(e,t,n){let r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Async schema");if(r.issues)throw new Q(r.issues,n);return r.value}function dt(e,t,n){try{return{success:!0,output:He(e,t,n)}}catch(r){if(r instanceof Q)return{success:!1,issues:r.issues,source:r.source};throw r}}var he=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?wn(t,n):n,a=new URL(this.baseUrl),c=t.pathname;if("params"in n&&n.params)for(let[f,d]of Object.entries(n.params))c=c.replace(`:${f}`,String(d));return a.pathname=c,t.schema.searchParams&&(a.search=En(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 C(this,null,function*(){var a;let r=yield Be(n.response);if(Ue(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 Q(o.issues,o.source);return o.output})}request(t,n){return C(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 Q?this.logger.error(r.message,r.issues):this.logger.error(r),r}})}};function te(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function wn(e,t){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=He(e.schema.searchParams,"searchParams"in t?t.searchParams:{})),e.schema.body&&(n.body=He(e.schema.body,"body"in t?t.body:{})),n}var H;function An(e){var t,n,r;return{lang:(t=e==null?void 0:e.lang)!=null?t:H==null?void 0:H.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:H==null?void 0:H.abortEarly,abortPipeEarly:(r=e==null?void 0:e.abortPipeEarly)!=null?r:H==null?void 0:H.abortPipeEarly}}var Xe;function ht(e){return Xe==null?void 0:Xe.get(e)}var $e;function vt(e){return $e==null?void 0:$e.get(e)}var Ye;function gt(e,t){var n;return(n=Ye==null?void 0:Ye.get(e))==null?void 0:n.get(t)}function re(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 y,p,v,E,T,S,P,b;let o=s&&"input"in s?s.input:n.value,a=(p=(y=s==null?void 0:s.expected)!=null?y:e.expects)!=null?p:null,c=(v=s==null?void 0:s.received)!=null?v:re(o),u={kind:e.kind,type:e.type,input:o,expected:a,received:c,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${c}`,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},f=e.kind==="schema",d=(b=(P=(S=(T=(E=s==null?void 0:s.message)!=null?E:e.message)!=null?T:gt(e.reference,u.lang))!=null?S:f?vt(u.lang):null)!=null?P:r.message)!=null?b:ht(u.lang);d!==void 0&&(u.message=typeof d=="function"?d(u):d),f&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}function N(e){return{version:1,vendor:"valibot",validate(t){return e["~run"]({value:t},An())}}}function bt(e,t){return Object.hasOwn(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function Ze(e,t){var r;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:(r=n[0])!=null?r:"never"}var kt=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,Ar=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 Qe(e,t){return{kind:"validation",type:"check",reference:Qe,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 en(e){return{kind:"validation",type:"email",reference:en,expects:null,async:!1,requirement:kt,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&I(this,"email",t,n),t}}}function ue(e){return{kind:"validation",type:"integer",reference:ue,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 Ae(e,t){return{kind:"validation",type:"max_length",reference:Ae,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 nn(e,t){return{kind:"validation",type:"max_value",reference:nn,async:!1,expects:`<=${e instanceof Date?e.toJSON():re(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():re(n.value)}),n}}}function L(e,t){return{kind:"validation",type:"min_length",reference:L,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 ae(e,t){return{kind:"validation",type:"min_value",reference:ae,async:!1,expects:`>=${e instanceof Date?e.toJSON():re(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():re(n.value)}),n}}}function Ie(e){return{kind:"transformation",type:"transform",reference:Ie,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function Te(){return{kind:"transformation",type:"trim",reference:Te,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}function _t(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function Pe(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function F(e,t){return{kind:"schema",type:"array",reference:F,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return N(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 c=s[a],u=this.item["~run"]({value:c},r);if(u.issues){let f={type:"array",origin:"value",input:s,key:a,value:c};for(let d of u.issues)d.path?d.path.unshift(f):d.path=[f],(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 ve(e){return{kind:"schema",type:"boolean",reference:ve,expects:"boolean",async:!1,message:e,get"~standard"(){return N(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:re(e),async:!1,literal:e,message:t,get"~standard"(){return N(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 N(this)},"~run"(n,r){return n.value===null&&(this.default!==void 0&&(n.value=Pe(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 N(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Pe(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function k(e){return{kind:"schema",type:"number",reference:k,expects:"number",async:!1,message:e,get"~standard"(){return N(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 N(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 c=this.entries[a];if(a in s||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){let u=a in s?s[a]:Pe(c),f=c["~run"]({value:u},r);if(f.issues){let d={type:"object",origin:"value",input:s,key:a,value:u};for(let y of f.issues)y.path?y.path.unshift(d):y.path=[d],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=f.issues),r.abortEarly){n.typed=!1;break}}f.typed||(n.typed=!1),n.value[a]=f.value}else if(c.fallback!==void 0)n.value[a]=_t(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.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 g(e,t){return{kind:"schema",type:"optional",reference:g,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return N(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Pe(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:Ze(e.map(re),"|"),async:!1,options:e,message:t,get"~standard"(){return N(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 N(this)},"~run"(r,s){var a,c;let o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(let u in o)if(bt(o,u)){let f=o[u],d=this.key["~run"]({value:u},s);if(d.issues){let p={type:"object",origin:"key",input:o,key:u,value:f};for(let v of d.issues)v.path=[p],(a=r.issues)==null||a.push(v);if(r.issues||(r.issues=d.issues),s.abortEarly){r.typed=!1;break}}let y=this.value["~run"]({value:f},s);if(y.issues){let p={type:"object",origin:"value",input:o,key:u,value:f};for(let v of y.issues)v.path?v.path.unshift(p):v.path=[p],(c=r.issues)==null||c.push(v);if(r.issues||(r.issues=y.issues),s.abortEarly){r.typed=!1;break}}(!d.typed||!y.typed)&&(r.typed=!1),d.typed&&(r.value[d.value]=y.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 N(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:I(this,"type",t,n),t}}}function Sn(e){let t;if(e)for(let n of e)t?t.push(...n.issues):t=n.issues;return t}function ge(e,t){return{kind:"schema",type:"union",reference:ge,expects:Ze(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){let s,o,a;for(let c of this.options){let u=c["~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:Sn(o)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];I(this,"type",n,r,{issues:Sn(a)})}return n}}}function tn(){return{kind:"schema",type:"unknown",reference:tn,expects:"unknown",async:!1,get"~standard"(){return N(this)},"~run"(e){return e.typed=!0,e}}}function le(e,t,n){return{kind:"schema",type:"variant",reference:le,expects:"Object",async:!1,key:e,options:t,message:n,get"~standard"(){return N(this)},"~run"(r,s){let o=r.value;if(o&&typeof o=="object"){let a,c=0,u=this.key,f=[],d=(y,p)=>{for(let v of y.options){if(v.type==="variant")d(v,new Set(p).add(v.key));else{let E=!0,T=0;for(let S of p){let P=v.entries[S];if(S in o?P["~run"]({typed:!1,value:o[S]},{abortEarly:!0}).issues:P.type!=="exact_optional"&&P.type!=="optional"&&P.type!=="nullish"){E=!1,u!==S&&(c<T||c===T&&S in o&&!(u in o))&&(c=T,u=S,f=[]),u===S&&f.push(v.entries[S].expects);break}T++}if(E){let S=v["~run"]({value:o},s);(!a||!a.typed&&S.typed)&&(a=S)}}if(a&&!a.issues)break}};if(d(this,new Set([this.key])),a)return a;I(this,"type",r,s,{input:o[u],expected:Ze(f,"|"),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 N(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}})}function Re(e,t,n){let r=e["~run"]({value:t},An(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var xt=["agent","sdk","form","integration","migration"],Et=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var wt=["screening","cv_match","interview","overall"],St=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],At=["job","company"],It=["created_at","updated_at"],Tt=["asc","desc"],Pt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Rt=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],jt=["user","system","automation","integration","candidate"],je=A(xt),J=A(Et),M=w(i(),Te(),L(1),Ae(100)),De=A(wt),In=A(St),Tr=A(At),Tn=A(It),Pn=A(Tt),be=w(i(),Te(),L(1),Ae(100)),Oe=A(Pt),Rn=A(Rt),jn=A(jt);var q=le("type",[l({type:_("user"),id:w(i(),L(1)),email:w(i(),L(1)),name:w(i(),L(1))}),l({type:_("system"),id:w(i(),L(1)),name:g(i())}),l({type:_("automation"),id:w(i(),L(1)),name:g(i())}),l({type:_("integration"),id:w(i(),L(1)),name:g(i())}),l({type:_("candidate"),id:w(i(),L(1)),email:g(i())})]);var Dt=l({total:k(),page:k(),perPage:k(),lastPage:k()});function Ce(e){return l({data:F(e),pagination:Dt})}var ke=l({id:i(),email:m(i()),firstName:m(i()),lastName:m(i()),phone:m(i()),source:m(je),identifiedAt:m(i()),createdAt:i(),updatedAt:i()});var ce=w(i(),L(1)),Dn=w(k(),ue(),ae(1)),X=V(i(),tn());var On=l({id:i(),applicationId:i(),status:In,scheduledAt:m(i()),completedAt:m(i()),meta:m(X),createdAt:i(),updatedAt:i()});var rn=l({score:k(),reason:i(),confidence:k()}),Cn=l({id:i(),candidateId:i(),jobId:k(),stage:M,stageGroup:J,stageEnteredAt:i(),rating:m(k()),disqualifiedAt:m(i()),disqualificationReason:m(be),disqualificationNote:m(i()),source:Oe,sourceDetail:m(i()),sessionId:m(k()),externalApplicationId:m(i()),meta:m(X),context:m(X),scoredAt:m(i()),createdAt:i(),updatedAt:i()}),Ot=l({id:i(),applicationId:i(),scoreType:De,score:m(k()),reason:m(i()),categories:m(V(i(),rn)),scoredBy:m(i()),createdAt:i()}),Ne=l(G(O({},Cn.entries),{candidate:m(ke),score:m(Ot),interview:m(On)})),Ct=l(G(O({},ke.entries),{applications:F(Cn)})),Nn=l({id:i(),applicationId:i(),action:Rn,fromStage:m(M),fromStageGroup:m(J),toStage:m(M),toStageGroup:m(J),disqualificationReason:m(be),disqualificationNote:m(i()),actorId:m(i()),actorType:jn,actorEmail:m(i()),actorName:m(i()),meta:m(X),schemaVersion:k(),createdAt:i()});var Ln=l({anonymousId:ce,email:ce,firstName:h(i()),lastName:h(i()),phone:h(i()),source:h(je)}),Fn=l({candidateId:i(),isNew:ve()});var Nt=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],Fe=A(Nt),qn=w(i(),Ie(e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0))),Lt=w(qn,F(M)),Ft=w(qn,F(J)),Mn=w(i(),Ie(e=>e.split(",").map(t=>Number(t.trim())).filter(t=>Number.isInteger(t)&&t>0))),$r=l({stages:g(Lt),stage_groups:g(Ft),job_id:g(i()),job_ids:g(Mn),candidate_id:g(i()),is_disqualified:g(A(["true","false"])),created_from:g(i()),created_to:g(i()),updated_from:g(i()),updated_to:g(i()),entered_stage_from:g(i()),entered_stage_to:g(i()),from:g(i()),to:g(i()),q:g(i()),scored:g(A(["true","false"])),sort:g(Tn),order:g(Pn),page:g(i()),per_page:g(i())}),Yr=w(l({candidateId:ce,jobId:Dn,meta:h(X),sessionId:h(k()),externalApplicationId:h(i()),context:h(X),source:h(Oe),sourceDetail:h(i()),stage:h(M),stageGroup:h(J),actor:h(q)}),Qe(e=>e.stage==null==(e.stageGroup==null),"stage and stageGroup must be supplied together")),Gn=l({id:i(),stageGroup:i(),createdAt:i()}),Zr=ge([l({ok:_(!0),duplicate:_(!1),applicationId:i(),candidateId:i()}),l({ok:_(!0),duplicate:_(!0),existingApplication:Gn})]),zn=l({isDuplicate:ve(),existingApplication:g(Gn)}),Qr=l({applicationId:ce,scoreType:De,score:k(),reason:h(i()),categories:h(V(i(),rn)),scoredBy:h(i()),actor:h(q)}),ei=l({scoreId:i()}),ni=Ce(Ne);var ti=A(["already_in_target_stage","not_in_source_stage","disqualified"]),ri=F(Nn),Le=l({stage:h(M),note:h(i())}),qt=l({stage:h(M),startDate:h(i()),note:h(i())}),Mt=le("action",[l({action:_("shortlist"),actor:q,meta:h(Le)}),l({action:_("move_to_interview"),actor:q,meta:h(Le)}),l({action:_("make_offer"),actor:q,meta:h(Le)}),l({action:_("hire"),actor:q,meta:h(qt)}),l({action:_("withdraw"),actor:q,meta:h(Le)}),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:be,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(k(),ue(),ae(1),nn(5)))})})]),ii=l({applicationIds:w(F(i()),L(1)),body:Mt}),Bn=A(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),si=le("kind",[l({kind:_("updated"),action:Fe,application:Ne}),l({kind:_("skipped"),action:Fe,applicationId:i(),reason:Bn})]),oi=l({updated:F(l({kind:_("updated"),action:Fe,application:Ne})),skipped:F(l({kind:_("skipped"),action:Fe,applicationId:i(),reason:Bn})),failed:F(l({applicationId:i(),error:i()}))}),ie=w(k(),ue(),ae(0)),Gt=l({APPLIED:ie,SHORTLISTED:ie,INTERVIEWED:ie,OFFERED:ie,HIRED:ie,REJECTED:ie,WITHDRAWN:ie}),ui=l({job_ids:Mn}),ai=l({counts:V(i(),Gt)});var yi=Ce(ke);var di=l({avg_score:m(k()),p90_score:m(k()),p85_score:m(k()),p80_score:m(k()),total_scores:k(),total_shortlists:k()});var sn=({environment:e,publishableKey:t,logger:n})=>{let r=vn[e];return{checkDuplicate(o){return C(this,null,function*(){try{let a=new URLSearchParams({email:o.email,scope:o.scope});o.scope==="job"&&o.jobId!=null&&a.set("job_id",String(o.jobId));let c=yield fetch(`${r}/applications/check-duplicate?${a}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":t}});if(!c.ok)return n.error(`[TalentBankClient] checkDuplicate failed with status ${c.status}`),{isDuplicate:!1};let u=yield c.json(),f=Re(zn,u);return f.success?f.output:(n.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(a){return n.error("[TalentBankClient] checkDuplicate failed:",a),{isDuplicate:!1}}})},identify(o){return C(this,null,function*(){var a;try{if(!o.anonymousId)return n.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let c={email:o.email,firstName:o.firstName,lastName:o.lastName,phone:o.phone,anonymousId:o.anonymousId,source:(a=o.source)!=null?a:"sdk"},u=Re(Ln,c);if(!u.success)return n.error("[TalentBankClient] identify received invalid input"),null;let f=yield fetch(`${r}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":t},body:JSON.stringify(u.output)});if(!f.ok)return n.error(`[TalentBankClient] identify failed with status ${f.status}`),null;let d=Re(Fn,yield f.json());return d.success?d.output:(n.error("[TalentBankClient] identify returned an invalid response"),null)}catch(c){return n.error("[TalentBankClient] identify failed:",c),null}})}}};var qe=()=>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 on(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Un=["DAILY","WEEKLY","MONTHLY"],zt=V(i(),ge([i(),F(i()),l({type:_("provided"),lat:k(),lng:k(),radius:k(),unit:g(A(["miles","km"])),label:g(i())})])),qi={pathname:"/job/:id",method:"GET",schema:{response:l({id:k(),external_id:h(i()),city:h(i()),town:h(i()),category:h(i())})}};var Bt={pathname:"/search/save",method:"POST",schema:{response:te(),body:l({contact:l({email:w(g(i()),i(),en()),first_name:g(i()),last_name:g(i())}),alerts:w(g(i()),i(),A(Un)),filters:zt})}};Vn();var ln=e=>{let t=new Date;return t.setTime(t.getTime()+7*24*60*60*1e3),`${ne}=${e};expires=${t.toUTCString()};path=/`},Ut=(e,t)=>{let n=e.get("session_id");if(t||n)return n;let r=sessionStorage.getItem(`${ne}-session_id`);return typeof r=="string"?r:null},Vt=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(Se);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Jt=e=>{if(typeof window!="undefined")try{e?window.localStorage.setItem(Se,e):window.localStorage.removeItem(Se)}catch(t){}},Kt=new RegExp(`(?:^|;\\s*)${ne}=([^;]+)`),cn=e=>{var n,r;let t=e?e.headers.get("cookie"):document.cookie;return t&&(r=(n=Kt.exec(t))==null?void 0:n[1])!=null?r:null},pn=e=>{var r;let t=e?e.url:location.href,{searchParams:n}=new URL(t);return{anonymous_id:(r=cn(e))!=null?r:n.get("anonymous_id"),session_id:Ut(n,typeof window=="undefined")}},Jn=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=pn().anonymous_id;if(e)return e;let t=qe(),n=pn().anonymous_id;return n||(document.cookie=ln(t),t)},Wt=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},Ht=e=>e==="about:client"?"":e,Xt={pathname:"/log",method:"POST",schema:{response:te(),body:te()}},Kn=({rpcClient:e,logger:t,onEvent:n,talentBank:r,persistence:s="device"})=>{let o=null,a=0,c=0,u=p=>s==="none"?{anonymous_id:null,session_id:p?null:o}:pn(p),f=(p,v)=>C(void 0,null,function*(){var E,T;try{let S={library:{name:"inploi-sdk",version:gn},page:v},P=u(p.request);s==="device"&&p.event==="IDENTIFY"&&!P.anonymous_id&&!p.request&&typeof window!="undefined"&&(P=G(O({},P),{anonymous_id:Jn()}));let b=s==="none"?null:Vt();if(p.event==="IDENTIFY"&&r&&(P.anonymous_id||s==="none")){let Z=p.properties,W=yield r.identify({email:(E=Z.email)!=null?E:Z.identifier,firstName:Z.first_name,lastName:Z.last_name,phone:Z.phone_number,anonymousId:(T=P.anonymous_id)!=null?T:qe(),source:"sdk"});W!=null&&W.candidateId&&s==="device"&&(b=W.candidateId,Jt(W.candidateId))}let R={anonymous_id:P.anonymous_id,session_id:P.session_id,candidate_id:b,event:p.event,sent_at:new Date().toISOString(),context:S,properties:p.properties,custom_properties:p.customProperties},$=s==="none"?null:cn(p.request),pe=++a,fe=yield e.request(Xt,O({body:R},p.keepalive&&{keepalive:!0})),x=Wt(fe);if(s==="none")return!p.request&&(x!=null&&x.session_id)&&pe>c&&(c=pe,x.session_id!==R.session_id&&(o=x.session_id)),R.session_id=p.request?(x==null?void 0:x.session_id)||null:o,n==null||n(R),{success:!0,data:R};let Y=p.request?$:cn(),se=Y!==null&&Y!==$,j=Y!=null?Y:$,K=!se&&(!j||!(x!=null&&x.anonymous_id)||j===x.anonymous_id);return K?(x!=null&&x.anonymous_id&&(R.anonymous_id=x.anonymous_id),x!=null&&x.session_id&&(R.session_id=x.session_id)):R.anonymous_id=j,!p.request&&typeof window!="undefined"&&R.anonymous_id&&(K&&R.session_id&&sessionStorage.setItem(`${ne}-session_id`,R.session_id.toString()),document.cookie=ln(R.anonymous_id)),n==null||n(R),{success:!0,data:R}}catch(S){return t.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:S}}}),d=Promise.resolve();return{log:p=>C(void 0,null,function*(){Me(p.request||typeof window!="undefined","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:Ht(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(s==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p=G(O({},p),{keepalive:!0})),s==="device"||p.request||o||p.keepalive)return f(p,v);let E=()=>f(p,v),T=d.then(E,E);return d=T,T}),getHeaders:p=>{let v=new Headers;return s==="none"||!(p!=null&&p.anonymous_id)||v.append("Set-Cookie",ln(p.anonymous_id)),v},getSessionInfo:u}};function an({publishableKey:e,env:t,logger:n=Ge,onEvent:r,persistence:s}){let o=dn({baseUrl:we[t],publishableKey:e}),a=n===!1?ze:n,c=new he({environment:t,apiKey:{type:"publishable",key:e},logger:a}),u=sn({environment:t,publishableKey:e,logger:a}),f=Kn({rpcClient:c,logger:a,onEvent:r,talentBank:u,persistence:s});return{register:y=>y({logger:a,apiClient:o,analytics:f,rpcClient:c,publishableKey:e,env:t}),analytics:f,apiClient:o}}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=an;window.inploi.ready=on;})();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var a={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"},m=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
|
|
2
|
+
bfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod
|
|
3
|
+
cfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma
|
|
4
|
+
dodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf
|
|
5
|
+
ggggy ghgha gigib glgrl gmgmb gngin gpglp gqgnq grgrc gssgs gtgtm gugum gwgnb gyguy hkhkg hmhmd hnhnd hrhrv hthti huhun
|
|
6
|
+
ididn ieirl ilisr imimn inind ioiot iqirq irirn isisl itita jejey jmjam jojor jpjpn keken kgkgz khkhm kikir kmcom knkna
|
|
7
|
+
kpprk krkor kwkwt kycym kzkaz lalao lblbn lclca lilie lklka lrlbr lslso ltltu lulux lvlva lylby mamar mcmco mdmda memne
|
|
8
|
+
mfmaf mgmdg mhmhl mkmkd mlmli mmmmr mnmng momac mpmnp mqmtq mrmrt msmsr mtmlt mumus mvmdv mwmwi mxmex mymys mzmoz nanam
|
|
9
|
+
ncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan peper pfpyf pgpng phphl pkpak plpol pmspm
|
|
10
|
+
pnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn
|
|
11
|
+
sjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl
|
|
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`,n,c=()=>{if(n)return n;n=new Map;let r=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let s of m.split(/\s+/)){let t=s.slice(0,2),e=r.of(t.toUpperCase());e&&n.set(e.toLowerCase(),t),n.set(t,t),n.set(s.slice(2),t)}return n},g=r=>{let s=r.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(a,s))return a[s];let t=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(s)?s.slice(0,2):s;return c().get(t)},o=r=>[...new Set(r.flatMap(t=>g(t)??[]))].sort();export{o as a};
|
|
14
|
+
//# sourceMappingURL=chunk-KC7FKSIJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk.country-codes.ts"],"sourcesContent":["/** Names ATS feeds use that are not a country's English name. */\nconst ALIASES: Record<string, string> = {\n\tuk: 'gb',\n\t'great britain': 'gb',\n\tengland: 'gb',\n\tscotland: 'gb',\n\twales: 'gb',\n\t'northern ireland': 'gb',\n\t// County values observed in Kisimul's job feed; do not infer GB for other unknown place names.\n\tlincolnshire: 'gb',\n\tsurrey: 'gb',\n\t'republic of ireland': 'ie',\n\teire: 'ie',\n\t'hong kong sar': 'hk',\n\t'united states of america': 'us',\n\tturkey: 'tr',\n\t'czech republic': 'cz',\n\tburma: 'mm',\n\t// Preserve Intl's existing Kosovo support without treating XK as an ISO subdivision prefix.\n\tkosovo: 'xk',\n\txk: 'xk',\n};\n\n/** All 249 ISO 3166-1 alpha-2 + alpha-3 pairs, packed to keep the browser table small.\n * Source: Unicode CLDR supplementalData.xml, territoryCodes (current ISO countries only).\n * https://raw.githubusercontent.com/unicode-org/cldr/main/common/supplemental/supplementalData.xml */\nconst ISO_COUNTRY_CODES = `adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel\nbfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod\ncfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma\ndodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf\nggggy ghgha gigib glgrl gmgmb gngin gpglp gqgnq grgrc gssgs gtgtm gugum gwgnb gyguy hkhkg hmhmd hnhnd hrhrv hthti huhun\nididn ieirl ilisr imimn inind ioiot iqirq irirn isisl itita jejey jmjam jojor jpjpn keken kgkgz khkhm kikir kmcom knkna\nkpprk krkor kwkwt kycym kzkaz lalao lblbn lclca lilie lklka lrlbr lslso ltltu lulux lvlva lylby mamar mcmco mdmda memne\nmfmaf mgmdg mhmhl mkmkd mlmli mmmmr mnmng momac mpmnp mqmtq mrmrt msmsr mtmlt mumus mvmdv mwmwi mxmex mymys mzmoz nanam\nncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan peper pfpyf pgpng phphl pkpak plpol pmspm\npnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn\nsjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl\ntltls tmtkm tntun toton trtur tttto tvtuv twtwn tztza uaukr uguga umumi ususa uyury uzuzb vavat vcvct veven vgvgb vivir\nvnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`;\n\n/** Each country's lower-case English name, ISO2 and ISO3 code, mapped to its ISO2 code. */\nlet codesByName: Map<string, string> | undefined;\nconst countryCodesByName = () => {\n\tif (codesByName) return codesByName;\n\tcodesByName = new Map();\n\tconst names = new Intl.DisplayNames(['en'], { type: 'region', fallback: 'none' });\n\tfor (const pair of ISO_COUNTRY_CODES.split(/\\s+/)) {\n\t\tconst code = pair.slice(0, 2);\n\t\tconst name = names.of(code.toUpperCase());\n\t\tif (name) codesByName.set(name.toLowerCase(), code);\n\t\tcodesByName.set(code, code);\n\t\tcodesByName.set(pair.slice(2), code);\n\t}\n\treturn codesByName;\n};\n\nconst toCountryCode = (value: string) => {\n\tconst name = value.trim().toLowerCase();\n\tif (Object.prototype.hasOwnProperty.call(ALIASES, name)) return ALIASES[name];\n\tconst country = /^[a-z]{2}-[a-z0-9]{1,3}$/.test(name) ? name.slice(0, 2) : name;\n\treturn countryCodesByName().get(country);\n};\n\n/**\n * The countries a hub's location search covers, as the geocoder's ISO codes, read from the free text its live\n * jobs give as their country (\"United Kingdom\", \"England\", \"GB\", \"GBR\", \"GB-CMA\", \"Republic of Ireland\"). Values\n * that name no country are left out. The caller chooses its own fallback when none is left.\n */\nexport const jobCountryCodes = (jobCountries: string[]): string[] => {\n\tconst codes = new Set(jobCountries.flatMap(value => toCountryCode(value) ?? []));\n\treturn [...codes].sort();\n};\n"],"mappings":"AACA,IAAMA,EAAkC,CACvC,GAAI,KACJ,gBAAiB,KACjB,QAAS,KACT,SAAU,KACV,MAAO,KACP,mBAAoB,KAEpB,aAAc,KACd,OAAQ,KACR,sBAAuB,KACvB,KAAM,KACN,gBAAiB,KACjB,2BAA4B,KAC5B,OAAQ,KACR,iBAAkB,KAClB,MAAO,KAEP,OAAQ,KACR,GAAI,IACL,EAKMC,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uDAetBC,EACEC,EAAqB,IAAM,CAChC,GAAID,EAAa,OAAOA,EACxBA,EAAc,IAAI,IAClB,IAAME,EAAQ,IAAI,KAAK,aAAa,CAAC,IAAI,EAAG,CAAE,KAAM,SAAU,SAAU,MAAO,CAAC,EAChF,QAAWC,KAAQJ,EAAkB,MAAM,KAAK,EAAG,CAClD,IAAMK,EAAOD,EAAK,MAAM,EAAG,CAAC,EACtBE,EAAOH,EAAM,GAAGE,EAAK,YAAY,CAAC,EACpCC,GAAML,EAAY,IAAIK,EAAK,YAAY,EAAGD,CAAI,EAClDJ,EAAY,IAAII,EAAMA,CAAI,EAC1BJ,EAAY,IAAIG,EAAK,MAAM,CAAC,EAAGC,CAAI,CACpC,CACA,OAAOJ,CACR,EAEMM,EAAiBC,GAAkB,CACxC,IAAMF,EAAOE,EAAM,KAAK,EAAE,YAAY,EACtC,GAAI,OAAO,UAAU,eAAe,KAAKT,EAASO,CAAI,EAAG,OAAOP,EAAQO,CAAI,EAC5E,IAAMG,EAAU,2BAA2B,KAAKH,CAAI,EAAIA,EAAK,MAAM,EAAG,CAAC,EAAIA,EAC3E,OAAOJ,EAAmB,EAAE,IAAIO,CAAO,CACxC,EAOaC,EAAmBC,GAExB,CAAC,GADM,IAAI,IAAIA,EAAa,QAAQH,GAASD,EAAcC,CAAK,GAAK,CAAC,CAAC,CAAC,CAC/D,EAAE,KAAK","names":["ALIASES","ISO_COUNTRY_CODES","codesByName","countryCodesByName","names","pair","code","name","toCountryCode","value","country","jobCountryCodes","jobCountries"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var y="https://maps.inploi.com",l=(r,e)=>{let t=new URL(`/${r}`,y);return t.search=new URLSearchParams({q:e.query,limit:"5",surface:e.surface,seed:e.seed}).toString(),e.country&&t.searchParams.set("country",e.country),t},a=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),g=r=>{if(!a(r)||typeof r.label!="string"||!a(r.address)||r.country!==void 0&&typeof r.country!="string")return;let e={};for(let t of["line1","line2","line3","city","state","postcode","country"]){let s=r.address[t];if(s!==void 0&&typeof s!="string")return;s!==void 0&&(e[t]=s)}return{id:r.label,label:r.label,country:r.country,address:e}},m=r=>{if(!(!a(r)||r.kind!=="place"&&r.kind!=="postcode"||typeof r.name!="string"||typeof r.label!="string"||typeof r.country!="string"||typeof r.lat!="number"||!Number.isFinite(r.lat)||r.lat<-90||r.lat>90||typeof r.lng!="number"||!Number.isFinite(r.lng)||r.lng<-180||r.lng>180))return{kind:r.kind,name:r.name,label:r.label,country:r.country,lat:r.lat,lng:r.lng}},d=async(r,e,t)=>{let s=await fetch(r.href,{signal:t});if(!s.ok)return;let c=s.headers.get("X-Geo-Arm"),n=await s.json();if(c!=="inploi"&&c!=="mapbox"||!a(n)||!Array.isArray(n.results)||n.source!=="photon"&&n.source!=="mapbox"&&n.source!=="places"||typeof n.attribution!="string")return;let i=[];for(let f of n.results){let o=e(f);if(o===void 0)return;i.push(o)}return{results:i,arm:c,source:n.source}},u=r=>{let e=l("address",{...r,seed:r.session});return e.searchParams.set("session",r.session),r.lat!==void 0&&r.lng!==void 0&&Number.isFinite(r.lat)&&Number.isFinite(r.lng)&&r.lat>=-90&&r.lat<=90&&r.lng>=-180&&r.lng<=180&&(e.searchParams.set("lat",String(r.lat)),e.searchParams.set("lng",String(r.lng))),d(e,g,r.signal)},b=r=>d(l("places",r),m,r.signal);export{u as lookupAddress,b as lookupPlaces};
|
|
2
|
+
//# sourceMappingURL=common.geo-transport-CJGUJXTA-TZLXVBMU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../core/src/common/common.geo-transport.ts"],"sourcesContent":["import type { GeoAddressSuggestion, GeoPlace, GeoSearchResult, GeoSurface } from './common.geo';\n\nconst GEO_ORIGIN = 'https://maps.inploi.com';\nexport type SearchOptions = { query: string; country?: string; seed: string; surface: GeoSurface; signal?: AbortSignal };\nexport type AddressOptions = Omit<SearchOptions, 'seed' | 'surface'> & {\n\tsession: string;\n\tsurface: 'candidate' | 'chatbot' | 'forms';\n\tlat?: number;\n\tlng?: number;\n};\n\nconst searchUrl = (kind: 'address' | 'places', options: SearchOptions) => {\n\tconst url = new URL(`/${kind}`, GEO_ORIGIN);\n\turl.search = new URLSearchParams({\n\t\tq: options.query,\n\t\tlimit: '5',\n\t\tsurface: options.surface,\n\t\tseed: options.seed,\n\t}).toString();\n\tif (options.country) url.searchParams.set('country', options.country);\n\treturn url;\n};\n\nconst record = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst parseAddress = (value: unknown): GeoAddressSuggestion | undefined => {\n\tif (!record(value) || typeof value.label !== 'string' || !record(value.address)) return;\n\tif (value.country !== undefined && typeof value.country !== 'string') return;\n\tconst address: GeoAddressSuggestion['address'] = {};\n\tfor (const key of ['line1', 'line2', 'line3', 'city', 'state', 'postcode', 'country'] as const) {\n\t\tconst field = value.address[key];\n\t\tif (field !== undefined && typeof field !== 'string') return;\n\t\tif (field !== undefined) address[key] = field;\n\t}\n\treturn { id: value.label, label: value.label, country: value.country, address };\n};\n\nconst parsePlace = (value: unknown): GeoPlace | undefined => {\n\tif (\n\t\t!record(value) ||\n\t\t(value.kind !== 'place' && value.kind !== 'postcode') ||\n\t\ttypeof value.name !== 'string' ||\n\t\ttypeof value.label !== 'string' ||\n\t\ttypeof value.country !== 'string' ||\n\t\ttypeof value.lat !== 'number' ||\n\t\t!Number.isFinite(value.lat) ||\n\t\tvalue.lat < -90 ||\n\t\tvalue.lat > 90 ||\n\t\ttypeof value.lng !== 'number' ||\n\t\t!Number.isFinite(value.lng) ||\n\t\tvalue.lng < -180 ||\n\t\tvalue.lng > 180\n\t)\n\t\treturn;\n\treturn {\n\t\tkind: value.kind,\n\t\tname: value.name,\n\t\tlabel: value.label,\n\t\tcountry: value.country,\n\t\tlat: value.lat,\n\t\tlng: value.lng,\n\t};\n};\n\nconst geoResponse = async <T>(\n\turl: URL,\n\tparse: (value: unknown) => T | undefined,\n\tsignal?: AbortSignal,\n): Promise<GeoSearchResult<T> | undefined> => {\n\tconst response = await fetch(url.href, { signal });\n\tif (!response.ok) return;\n\tconst arm = response.headers.get('X-Geo-Arm');\n\tconst data: unknown = await response.json();\n\tif (\n\t\t(arm !== 'inploi' && arm !== 'mapbox') ||\n\t\t!record(data) ||\n\t\t!Array.isArray(data.results) ||\n\t\t(data.source !== 'photon' && data.source !== 'mapbox' && data.source !== 'places') ||\n\t\ttypeof data.attribution !== 'string'\n\t)\n\t\treturn;\n\tconst results: T[] = [];\n\tfor (const item of data.results) {\n\t\tconst result = parse(item);\n\t\tif (result === undefined) return;\n\t\tresults.push(result);\n\t}\n\treturn { results, arm, source: data.source };\n};\n\nexport const lookupAddress = (options: AddressOptions) => {\n\tconst url = searchUrl('address', { ...options, seed: options.session });\n\turl.searchParams.set('session', options.session);\n\tif (\n\t\toptions.lat !== undefined &&\n\t\toptions.lng !== undefined &&\n\t\tNumber.isFinite(options.lat) &&\n\t\tNumber.isFinite(options.lng) &&\n\t\toptions.lat >= -90 &&\n\t\toptions.lat <= 90 &&\n\t\toptions.lng >= -180 &&\n\t\toptions.lng <= 180\n\t) {\n\t\turl.searchParams.set('lat', String(options.lat));\n\t\turl.searchParams.set('lng', String(options.lng));\n\t}\n\treturn geoResponse(url, parseAddress, options.signal);\n};\n\nexport const lookupPlaces = (options: SearchOptions) => geoResponse(searchUrl('places', options), parsePlace, options.signal);\n"],"mappings":"AAEA,IAAMA,EAAa,0BASbC,EAAY,CAACC,EAA4BC,IAA2B,CACzE,IAAMC,EAAM,IAAI,IAAI,IAAIF,CAAI,GAAIF,CAAU,EAC1C,OAAAI,EAAI,OAAS,IAAI,gBAAgB,CAChC,EAAGD,EAAQ,MACX,MAAO,IACP,QAASA,EAAQ,QACjB,KAAMA,EAAQ,IACf,CAAC,EAAE,SAAS,EACRA,EAAQ,SAASC,EAAI,aAAa,IAAI,UAAWD,EAAQ,OAAO,EAC7DC,CACR,EAEMC,EAAUC,GACf,OAAOA,GAAU,UAAYA,IAAU,MAAQ,CAAC,MAAM,QAAQA,CAAK,EAE9DC,EAAgBD,GAAqD,CAE1E,GADI,CAACD,EAAOC,CAAK,GAAK,OAAOA,EAAM,OAAU,UAAY,CAACD,EAAOC,EAAM,OAAO,GAC1EA,EAAM,UAAY,QAAa,OAAOA,EAAM,SAAY,SAAU,OACtE,IAAME,EAA2C,CAAC,EAClD,QAAWC,IAAO,CAAC,QAAS,QAAS,QAAS,OAAQ,QAAS,WAAY,SAAS,EAAY,CAC/F,IAAMC,EAAQJ,EAAM,QAAQG,CAAG,EAC/B,GAAIC,IAAU,QAAa,OAAOA,GAAU,SAAU,OAClDA,IAAU,SAAWF,EAAQC,CAAG,EAAIC,EACzC,CACA,MAAO,CAAE,GAAIJ,EAAM,MAAO,MAAOA,EAAM,MAAO,QAASA,EAAM,QAAS,QAAAE,CAAQ,CAC/E,EAEMG,EAAcL,GAAyC,CAC5D,GACC,GAACD,EAAOC,CAAK,GACZA,EAAM,OAAS,SAAWA,EAAM,OAAS,YAC1C,OAAOA,EAAM,MAAS,UACtB,OAAOA,EAAM,OAAU,UACvB,OAAOA,EAAM,SAAY,UACzB,OAAOA,EAAM,KAAQ,UACrB,CAAC,OAAO,SAASA,EAAM,GAAG,GAC1BA,EAAM,IAAM,KACZA,EAAM,IAAM,IACZ,OAAOA,EAAM,KAAQ,UACrB,CAAC,OAAO,SAASA,EAAM,GAAG,GAC1BA,EAAM,IAAM,MACZA,EAAM,IAAM,KAGb,MAAO,CACN,KAAMA,EAAM,KACZ,KAAMA,EAAM,KACZ,MAAOA,EAAM,MACb,QAASA,EAAM,QACf,IAAKA,EAAM,IACX,IAAKA,EAAM,GACZ,CACD,EAEMM,EAAc,MACnBR,EACAS,EACAC,IAC6C,CAC7C,IAAMC,EAAW,MAAM,MAAMX,EAAI,KAAM,CAAE,OAAAU,CAAO,CAAC,EACjD,GAAI,CAACC,EAAS,GAAI,OAClB,IAAMC,EAAMD,EAAS,QAAQ,IAAI,WAAW,EACtCE,EAAgB,MAAMF,EAAS,KAAK,EAC1C,GACEC,IAAQ,UAAYA,IAAQ,UAC7B,CAACX,EAAOY,CAAI,GACZ,CAAC,MAAM,QAAQA,EAAK,OAAO,GAC1BA,EAAK,SAAW,UAAYA,EAAK,SAAW,UAAYA,EAAK,SAAW,UACzE,OAAOA,EAAK,aAAgB,SAE5B,OACD,IAAMC,EAAe,CAAC,EACtB,QAAWC,KAAQF,EAAK,QAAS,CAChC,IAAMG,EAASP,EAAMM,CAAI,EACzB,GAAIC,IAAW,OAAW,OAC1BF,EAAQ,KAAKE,CAAM,CACpB,CACA,MAAO,CAAE,QAAAF,EAAS,IAAAF,EAAK,OAAQC,EAAK,MAAO,CAC5C,EAEaI,EAAiBlB,GAA4B,CACzD,IAAMC,EAAMH,EAAU,UAAW,CAAE,GAAGE,EAAS,KAAMA,EAAQ,OAAQ,CAAC,EACtE,OAAAC,EAAI,aAAa,IAAI,UAAWD,EAAQ,OAAO,EAE9CA,EAAQ,MAAQ,QAChBA,EAAQ,MAAQ,QAChB,OAAO,SAASA,EAAQ,GAAG,GAC3B,OAAO,SAASA,EAAQ,GAAG,GAC3BA,EAAQ,KAAO,KACfA,EAAQ,KAAO,IACfA,EAAQ,KAAO,MACfA,EAAQ,KAAO,MAEfC,EAAI,aAAa,IAAI,MAAO,OAAOD,EAAQ,GAAG,CAAC,EAC/CC,EAAI,aAAa,IAAI,MAAO,OAAOD,EAAQ,GAAG,CAAC,GAEzCS,EAAYR,EAAKG,EAAcJ,EAAQ,MAAM,CACrD,EAEamB,EAAgBnB,GAA2BS,EAAYX,EAAU,SAAUE,CAAO,EAAGQ,EAAYR,EAAQ,MAAM","names":["GEO_ORIGIN","searchUrl","kind","options","url","record","value","parseAddress","address","key","field","parsePlace","geoResponse","parse","signal","response","arm","data","results","item","result","lookupAddress","lookupPlaces"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -661,12 +661,6 @@ declare const saveSearchEndpoint: RpcEndpoint<"POST", "/search/save", Record<str
|
|
|
661
661
|
|
|
662
662
|
/** The countries the company's live jobs give, as their feeds spell them. */
|
|
663
663
|
declare const getJobCountries: (rpcClient: InploiRpcClient) => Promise<string[]>;
|
|
664
|
-
/**
|
|
665
|
-
* The countries a hub's location search covers, as the geocoder's ISO codes, read from the free text its live
|
|
666
|
-
* jobs give as their country ("United Kingdom", "England", "GB", "Republic of Ireland"). Values that name no
|
|
667
|
-
* country are left out. The caller chooses its own fallback when none is left.
|
|
668
|
-
*/
|
|
669
|
-
declare const jobCountryCodes: (jobCountries: string[]) => string[];
|
|
670
664
|
/**
|
|
671
665
|
* Starts one background read and returns only countries already available. A slow, empty or failed read must
|
|
672
666
|
* never delay or fail an address lookup: it keeps today's unfiltered suggestions, including on immediate Enter.
|
|
@@ -683,4 +677,11 @@ declare const blendAddressSuggestions: <T extends AddressSuggestion>(filtered: T
|
|
|
683
677
|
/** Both lookups share the caller's session token and signal; a non-empty list waits briefly for its partner. */
|
|
684
678
|
declare const searchAddressSuggestions: <T extends AddressSuggestion>(lookup: (country?: string) => Promise<T[]>, country: string | undefined, signal?: AbortSignal) => Promise<T[]>;
|
|
685
679
|
|
|
680
|
+
/**
|
|
681
|
+
* The countries a hub's location search covers, as the geocoder's ISO codes, read from the free text its live
|
|
682
|
+
* jobs give as their country ("United Kingdom", "England", "GB", "GBR", "GB-CMA", "Republic of Ireland"). Values
|
|
683
|
+
* that name no country are left out. The caller chooses its own fallback when none is left.
|
|
684
|
+
*/
|
|
685
|
+
declare const jobCountryCodes: (jobCountries: string[]) => string[];
|
|
686
|
+
|
|
686
687
|
export { AnalyticsLogEvent, AnalyticsLogParams, AnalyticsOnEventCallback, AnalyticsService, ApiClient, ApiError, ConsentConfig, FlowPathProperties, FlowPathStep, FlowPathTrigger, FlowType, InitialiseInploiSdkParams, InploiRpcClient, InploiSdk, InploiSdkEnvironment, InploiSdkPlugin, JOB_ALERT_FREQUENCIES, JobAlertsFilters, Logger, NotFoundError, JsonParsingError as ParsingError, PluginParams, RpcEndpoint, SchemaValidationError, SdkError, TalentBankCheckDuplicateResult, TalentBankClient, TalentBankIdentifyParams, TalentBankIdentifyResult, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -661,12 +661,6 @@ declare const saveSearchEndpoint: RpcEndpoint<"POST", "/search/save", Record<str
|
|
|
661
661
|
|
|
662
662
|
/** The countries the company's live jobs give, as their feeds spell them. */
|
|
663
663
|
declare const getJobCountries: (rpcClient: InploiRpcClient) => Promise<string[]>;
|
|
664
|
-
/**
|
|
665
|
-
* The countries a hub's location search covers, as the geocoder's ISO codes, read from the free text its live
|
|
666
|
-
* jobs give as their country ("United Kingdom", "England", "GB", "Republic of Ireland"). Values that name no
|
|
667
|
-
* country are left out. The caller chooses its own fallback when none is left.
|
|
668
|
-
*/
|
|
669
|
-
declare const jobCountryCodes: (jobCountries: string[]) => string[];
|
|
670
664
|
/**
|
|
671
665
|
* Starts one background read and returns only countries already available. A slow, empty or failed read must
|
|
672
666
|
* never delay or fail an address lookup: it keeps today's unfiltered suggestions, including on immediate Enter.
|
|
@@ -683,4 +677,11 @@ declare const blendAddressSuggestions: <T extends AddressSuggestion>(filtered: T
|
|
|
683
677
|
/** Both lookups share the caller's session token and signal; a non-empty list waits briefly for its partner. */
|
|
684
678
|
declare const searchAddressSuggestions: <T extends AddressSuggestion>(lookup: (country?: string) => Promise<T[]>, country: string | undefined, signal?: AbortSignal) => Promise<T[]>;
|
|
685
679
|
|
|
680
|
+
/**
|
|
681
|
+
* The countries a hub's location search covers, as the geocoder's ISO codes, read from the free text its live
|
|
682
|
+
* jobs give as their country ("United Kingdom", "England", "GB", "GBR", "GB-CMA", "Republic of Ireland"). Values
|
|
683
|
+
* that name no country are left out. The caller chooses its own fallback when none is left.
|
|
684
|
+
*/
|
|
685
|
+
declare const jobCountryCodes: (jobCountries: string[]) => string[];
|
|
686
|
+
|
|
686
687
|
export { AnalyticsLogEvent, AnalyticsLogParams, AnalyticsOnEventCallback, AnalyticsService, ApiClient, ApiError, ConsentConfig, FlowPathProperties, FlowPathStep, FlowPathTrigger, FlowType, InitialiseInploiSdkParams, InploiRpcClient, InploiSdk, InploiSdkEnvironment, InploiSdkPlugin, JOB_ALERT_FREQUENCIES, JobAlertsFilters, Logger, NotFoundError, JsonParsingError as ParsingError, PluginParams, RpcEndpoint, SchemaValidationError, SdkError, TalentBankCheckDuplicateResult, TalentBankClient, TalentBankIdentifyParams, TalentBankIdentifyResult, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
"use strict";var Et=Object.create;var Q=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var wt=(t,n)=>{for(var r in n)Q(t,r,{get:n[r],enumerable:!0})},qe=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of It(n))!Pt.call(t,a)&&a!==r&&Q(t,a,{get:()=>n[a],enumerable:!(o=xt(n,a))||o.enumerable});return t};var x=(t,n,r)=>(r=t!=null?Et(At(t)):{},qe(n||!t||!t.__esModule?Q(r,"default",{value:t,enumerable:!0}):r,t)),kt=t=>qe(Q({},"__esModule",{value:!0}),t);var vn={};wt(vn,{ApiError:()=>F,InploiRpcClient:()=>V,JOB_ALERT_FREQUENCIES:()=>Le,NotFoundError:()=>N,ParsingError:()=>B,SchemaValidationError:()=>k,SdkError:()=>xe,UnauthorisedError:()=>j,addressSearchCountry:()=>St,blendAddressSuggestions:()=>je,consentStorageKey:()=>ve,createPlugin:()=>Me,createTalentBankClient:()=>me,endpoint:()=>Y,generateUUID:()=>K,getConsentAcceptance:()=>gt,getJobCountries:()=>Oe,getOrCreateAnonymousId:()=>we,hashConsentConfig:()=>ge,initialiseSdk:()=>mt,inploiBrandedLogger:()=>te,isApiErrorWithData:()=>Ge,isSdkError:()=>$e,jobCountryCodes:()=>Ne,noLogging:()=>ne,ready:()=>ft,saveClosedRoleJobAlerts:()=>ht,saveSearchEndpoint:()=>De,searchAddressSuggestions:()=>bt,setConsentAcceptance:()=>vt,typed:()=>L,validateEndpointInputs:()=>Re});module.exports=kt(vn);var X="%c[inploi SDK]",ee="color: #65BC67; font-weight: bold;",te={warn:(...t)=>console.warn(X,ee,...t),error:(...t)=>console.error(X,ee,...t),info:(...t)=>console.info(X,ee,...t),log:(...t)=>console.log(X,ee,...t)},ne={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Me=t=>t;function _e(t,n){if(!t)throw new Error(n)}function G(t,n){return n in t}var In=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Rt="Unauthenticated",Ct="This action is unauthorized.",O=class extends Error{constructor(r,o){super(r);this.status=o,this.name="ErrorWithStatus"}},N=class extends O{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},j=class extends O{constructor(n,r){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=r??401}},k=class extends O{constructor(r,o){let a=o?` in ${o}`:"";super(`Schema validation failed${a}`);this.issues=r;this.source=o;this.name="SchemaValidationError",this.status=400}},F=class extends O{constructor(r,o,a){super(r);this.data=a;this.name="ApiError",this.status=o??500}},Ge=t=>t instanceof F&&t.data!==void 0,B=class extends O{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 Lt=["message","error","errors","exception","exceptions"];function Dt(t){let n=[];if(typeof t=="object"&&t!==null){for(let r of Lt)if(G(t,r)){let o=t[r];typeof o=="string"&&n.push(o),Array.isArray(o)&&o.every(a=>typeof a=="string")&&n.push(...o)}G(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&G(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&G(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 Ee(t,n){if(n>=300){let r=Dt(t);throw n===404?new N(r):r===Rt?new j("You are not authenticated.",n):r===Ct?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 a={...o,headers:{...o.headers,...n}},c=await fetch(`${t.baseUrl}${r}`,a);if(c.status===404)throw new N;let d=await Te(c);return Ee(d,c.status),d}}},xe={NotFound:N,Unauthorised:j,SchemaValidation:k,Api:F,JsonParsing:B};function $e(t){return Object.values(xe).some(n=>t instanceof n)}var He="2.7.0";var re={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},Je={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},We=He;var U="isdk_session",oe=`${U}-candidate_id`,Ke=`${U}-consent`;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 Ie=t=>{let n=new Date;return n.setTime(n.getTime()+7*24*60*60*1e3),`${U}=${t};expires=${n.toUTCString()};path=/`},Nt=(t,n)=>{let r=t.get("session_id");if(n||r)return r;let o=sessionStorage.getItem(`${U}-session_id`);return typeof o=="string"?o:null},jt=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(oe);return typeof t=="string"&&t!==""?t:null}catch{return null}},Ft=t=>{if(!(typeof window>"u"))try{t?window.localStorage.setItem(oe,t):window.localStorage.removeItem(oe)}catch{}},Bt=new RegExp(`(?:^|;\\s*)${U}=([^;]+)`),Ae=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?Bt.exec(n)?.[1]??null:null},Pe=t=>{let n=t?t.url:location.href,{searchParams:r}=new URL(n);return{anonymous_id:Ae(t)??r.get("anonymous_id"),session_id:Nt(r,typeof window>"u")}},we=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Pe().anonymous_id;if(t)return t;let n=K(),r=Pe().anonymous_id;return r||(document.cookie=Ie(n),n)},Ut=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},qt=t=>t==="about:client"?"":t,Mt={pathname:"/log",method:"POST",schema:{response:L(),body:L()}},Ye=({rpcClient:t,logger:n,onEvent:r,talentBank:o,persistence:a="device"})=>{let c=null,d=0,u=0,v=p=>a==="none"?{anonymous_id:null,session_id:p?null:c}:Pe(p),A=async(p,y)=>{try{let f={library:{name:"inploi-sdk",version:We},page:y},P=v(p.request);a==="device"&&p.event==="IDENTIFY"&&!P.anonymous_id&&!p.request&&typeof window<"u"&&(P={...P,anonymous_id:we()});let Fe=a==="none"?null:jt();if(p.event==="IDENTIFY"&&o&&(P.anonymous_id||a==="none")){let W=p.properties,be=await o.identify({email:W.email??W.identifier,firstName:W.first_name,lastName:W.last_name,phone:W.phone_number,anonymousId:P.anonymous_id??K(),source:"sdk"});be?.candidateId&&a==="device"&&(Fe=be.candidateId,Ft(be.candidateId))}let S={anonymous_id:P.anonymous_id,session_id:P.session_id,candidate_id:Fe,event:p.event,sent_at:new Date().toISOString(),context:f,properties:p.properties,custom_properties:p.customProperties},he=a==="none"?null:Ae(p.request),Be=++d,_t=await t.request(Mt,{body:S,...p.keepalive&&{keepalive:!0}}),w=Ut(_t);if(a==="none")return!p.request&&w?.session_id&&Be>u&&(u=Be,w.session_id!==S.session_id&&(c=w.session_id)),S.session_id=p.request?w?.session_id||null:c,r?.(S),{success:!0,data:S};let ye=p.request?he:Ae(),Tt=ye!==null&&ye!==he,Se=ye??he,Ue=!Tt&&(!Se||!w?.anonymous_id||Se===w.anonymous_id);return Ue?(w?.anonymous_id&&(S.anonymous_id=w.anonymous_id),w?.session_id&&(S.session_id=w.session_id)):S.anonymous_id=Se,!p.request&&typeof window<"u"&&S.anonymous_id&&(Ue&&S.session_id&&sessionStorage.setItem(`${U}-session_id`,S.session_id.toString()),document.cookie=Ie(S.anonymous_id)),r?.(S),{success:!0,data:S}}catch(f){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:f}}},M=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 y="request"in p&&p.request?{href:p.request.url,referrer:qt(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(a==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p={...p,keepalive:!0}),a==="device"||p.request||c||p.keepalive)return A(p,y);let f=()=>A(p,y),P=M.then(f,f);return M=P,P},getHeaders:p=>{let y=new Headers;return a==="none"||!p?.anonymous_id||y.append("Set-Cookie",Ie(p.anonymous_id)),y},getSessionInfo:v}};var ze=require("neoqs");function ke(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 Gt(t,n,r){try{return{success:!0,output:ke(t,n,r)}}catch(o){if(o instanceof k)return{success:!1,issues:o.issues,source:o.source};throw o}}var V=class{constructor(n){if(this.baseUrl=re[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:a,body:c}=o?Re(n,r):r,d=new URL(this.baseUrl),u=n.pathname;if("params"in r&&r.params)for(let[v,A]of Object.entries(r.params))u=u.replace(`:${v}`,String(A));return d.pathname=u,n.schema.searchParams&&(d.search=(0,ze.stringify)(a)),[d.toString(),{method:n.method,body:c?JSON.stringify(c):void 0,headers:this.headers,signal:r.signal,...r.keepalive&&{keepalive:!0}}]}async parseResponse(n,r){let o=await Te(r.response);if(Ee(o,r.response.status),!(r.validateOut??!0))return o;let c=Gt(n.schema.response,o,"response");if(!c.success)throw new k(c.issues,c.source);return c.output}async request(n,r){try{let o=this.getFetchParams(n,r),a=await fetch(...o);return await this.parseResponse(n,{response:a,validateOut:r.validateOut})}catch(o){throw o instanceof k?this.logger.error(o.message,o.issues):this.logger.error(o),o}}};function L(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function Y(t){return t}function Re(t,n){let r={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(r.searchParams=ke(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(r.body=ke(t.schema.body,"body"in n?n.body:{})),r}var s=x(require("valibot"),1),Vt=["agent","sdk","form","integration","migration"],$t=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var Ht=["screening","cv_match","interview","overall"],Jt=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],Wt=["job","company"],Kt=["created_at","updated_at"],Yt=["asc","desc"],zt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Zt=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],Qt=["user","system","automation","integration","candidate"],ie=s.picklist(Vt),R=s.picklist($t),I=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),se=s.picklist(Ht),Ze=s.picklist(Jt),$n=s.picklist(Wt),Qe=s.picklist(Kt),Xe=s.picklist(Yt),z=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),ae=s.picklist(zt),et=s.picklist(Zt),tt=s.picklist(Qt);var _=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 C=x(require("valibot"),1),Xt=C.object({total:C.number(),page:C.number(),perPage:C.number(),lastPage:C.number()});function le(t){return C.object({data:C.array(t),pagination:Xt})}var m=x(require("valibot"),1);var Z=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(ie),identifiedAt:m.nullable(m.string()),createdAt:m.string(),updatedAt:m.string()});var i=x(require("valibot"),1);var g=x(require("valibot"),1),$=g.pipe(g.string(),g.minLength(1)),nt=g.pipe(g.number(),g.integer(),g.minValue(1)),D=g.record(g.string(),g.unknown());var T=x(require("valibot"),1);var rt=T.object({id:T.string(),applicationId:T.string(),status:Ze,scheduledAt:T.nullable(T.string()),completedAt:T.nullable(T.string()),meta:T.nullable(D),createdAt:T.string(),updatedAt:T.string()});var Ce=i.object({score:i.number(),reason:i.string(),confidence:i.number()}),ot=i.object({id:i.string(),candidateId:i.string(),jobId:i.number(),stage:I,stageGroup:R,stageEnteredAt:i.string(),rating:i.nullable(i.number()),disqualifiedAt:i.nullable(i.string()),disqualificationReason:i.nullable(z),disqualificationNote:i.nullable(i.string()),source:ae,sourceDetail:i.nullable(i.string()),sessionId:i.nullable(i.number()),externalApplicationId:i.nullable(i.string()),meta:i.nullable(D),context:i.nullable(D),scoredAt:i.nullable(i.string()),createdAt:i.string(),updatedAt:i.string()}),en=i.object({id:i.string(),applicationId:i.string(),scoreType:se,score:i.nullable(i.number()),reason:i.nullable(i.string()),categories:i.nullable(i.record(i.string(),Ce)),scoredBy:i.nullable(i.string()),createdAt:i.string()}),ce=i.object({...ot.entries,candidate:i.nullable(Z),score:i.nullable(en),interview:i.nullable(rt)}),tn=i.object({...Z.entries,applications:i.array(ot)}),it=i.object({id:i.string(),applicationId:i.string(),action:et,fromStage:i.nullable(I),fromStageGroup:i.nullable(R),toStage:i.nullable(I),toStageGroup:i.nullable(R),disqualificationReason:i.nullable(z),disqualificationNote:i.nullable(i.string()),actorId:i.nullable(i.string()),actorType:tt,actorEmail:i.nullable(i.string()),actorName:i.nullable(i.string()),meta:i.nullable(D),schemaVersion:i.number(),createdAt:i.string()});var h=x(require("valibot"),1);var st=h.object({anonymousId:$,email:$,firstName:h.nullish(h.string()),lastName:h.nullish(h.string()),phone:h.nullish(h.string()),source:h.nullish(ie)}),at=h.object({candidateId:h.string(),isNew:h.boolean()});var e=x(require("valibot"),1);var nn=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],de=e.picklist(nn),lt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),rn=e.pipe(lt,e.array(I)),on=e.pipe(lt,e.array(R)),ct=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),dr=e.object({stages:e.optional(rn),stage_groups:e.optional(on),job_id:e.optional(e.string()),job_ids:e.optional(ct),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(Qe),order:e.optional(Xe),page:e.optional(e.string()),per_page:e.optional(e.string())}),ur=e.pipe(e.object({candidateId:$,jobId:nt,meta:e.nullish(D),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),context:e.nullish(D),source:e.nullish(ae),sourceDetail:e.nullish(e.string()),stage:e.nullish(I),stageGroup:e.nullish(R),actor:e.nullish(_)}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together")),pt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),mr=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:pt})]),dt=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(pt)}),gr=e.object({applicationId:$,scoreType:se,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Ce)),scoredBy:e.nullish(e.string()),actor:e.nullish(_)}),vr=e.object({scoreId:e.string()}),fr=le(ce);var hr=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),yr=e.array(it),pe=e.object({stage:e.nullish(I),note:e.nullish(e.string())}),sn=e.object({stage:e.nullish(I),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),an=e.variant("action",[e.object({action:e.literal("shortlist"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("move_to_interview"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("make_offer"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("hire"),actor:_,meta:e.nullish(sn)}),e.object({action:e.literal("withdraw"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("move_to_stage"),actor:_,meta:e.object({stage:I,stageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:_,meta:e.object({toStage:I,toStageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:_,meta:e.object({reason:z,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:_,meta:e.object({toStage:I,toStageGroup:R,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)))})})]),Sr=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:an}),ut=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),br=e.variant("kind",[e.object({kind:e.literal("updated"),action:de,application:ce}),e.object({kind:e.literal("skipped"),action:de,applicationId:e.string(),reason:ut})]),_r=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:de,application:ce})),skipped:e.array(e.object({kind:e.literal("skipped"),action:de,applicationId:e.string(),reason:ut})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),q=e.pipe(e.number(),e.integer(),e.minValue(0)),ln=e.object({APPLIED:q,SHORTLISTED:q,INTERVIEWED:q,OFFERED:q,HIRED:q,REJECTED:q,WITHDRAWN:q}),Tr=e.object({job_ids:ct}),Er=e.object({counts:e.record(e.string(),ln)});var wr=le(Z);var b=x(require("valibot"),1),Rr=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 ue=x(require("valibot"));var me=({environment:t,publishableKey:n,logger:r})=>{let o=Je[t];return{async checkDuplicate(a){try{let c=new URLSearchParams({email:a.email,scope:a.scope});a.scope==="job"&&a.jobId!=null&&c.set("job_id",String(a.jobId));let d=await fetch(`${o}/applications/check-duplicate?${c}`,{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(),v=ue.safeParse(dt,u);return v.success?v.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(c){return r.error("[TalentBankClient] checkDuplicate failed:",c),{isDuplicate:!1}}},async identify(a){try{if(!a.anonymousId)return r.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let c={email:a.email,firstName:a.firstName,lastName:a.lastName,phone:a.phone,anonymousId:a.anonymousId,source:a.source??"sdk"},d=ue.safeParse(st,c);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 v=ue.safeParse(at,await u.json());return v.success?v.output:(r.error("[TalentBankClient] identify returned an invalid response"),null)}catch(c){return r.error("[TalentBankClient] identify failed:",c),null}}}};function mt({publishableKey:t,env:n,logger:r=te,onEvent:o,persistence:a}){let c=Ve({baseUrl:re[n],publishableKey:t}),d=r===!1?ne:r,u=new V({environment:n,apiKey:{type:"publishable",key:t},logger:d}),v=me({environment:n,publishableKey:t,logger:d}),A=Ye({rpcClient:u,logger:d,onEvent:o,talentBank:v,persistence:a});return{register:J=>J({logger:d,apiClient:c,analytics:A,rpcClient:u,publishableKey:t,env:n}),analytics:A,apiClient:c}}function ge(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 ve(t,n){return`${Ke}:${t}:${n}`}function gt(t,n){if(typeof window>"u")return!1;try{let r=ve(t,ge(n));return window.localStorage.getItem(r)==="accepted"}catch{return!1}}function vt(t,n){if(!(typeof window>"u"))try{let r=ve(t,ge(n));window.localStorage.setItem(r,"accepted")}catch{}}function ft(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var l=x(require("valibot"));var Le=["DAILY","WEEKLY","MONTHLY"],cn=l.record(l.string(),l.union([l.string(),l.array(l.string()),l.object({type:l.literal("provided"),lat:l.number(),lng:l.number(),radius:l.number(),unit:l.optional(l.picklist(["miles","km"])),label:l.optional(l.string())})])),pn={pathname:"/job/:id",method:"GET",schema:{response:l.object({id:l.number(),external_id:l.nullish(l.string()),city:l.nullish(l.string()),town:l.nullish(l.string()),category:l.nullish(l.string())})}};async function ht(t,{contact:n,job:r}){let o={};if(r){let a=await t.request(pn,{params:{id:r.id}});if((r.id_type==="internal"?String(a.id):a.external_id)!==r.id)throw new Error("Job lookup returned a different role");for(let d of["city","town","category"]){let u=a[d]?.trim();u&&(o[d]=[u])}}await t.request(De,{body:{contact:n,alerts:"WEEKLY",filters:o}})}var De={pathname:"/search/save",method:"POST",schema:{response:L(),body:l.object({contact:l.object({email:l.pipe(l.optional(l.string()),l.string(),l.email()),first_name:l.optional(l.string()),last_name:l.optional(l.string())}),alerts:l.pipe(l.optional(l.string()),l.string(),l.picklist(Le)),filters:cn})}};var E=x(require("valibot"));var Oe=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:E.pipe(E.object({country:E.optional(E.array(E.object({value:E.string()})),[])}),E.transform(({country:r})=>r.map(({value:o})=>o))),searchParams:L()}};return t.request(n,{searchParams:{filters:{country:null}}})},yt={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk",usa:"us","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm"},dn=new Set(["AC","CP","CQ","DG","EA","EU","EZ","IC","QO","TA","UN","XA","XB","ZZ","AN","BU","CS","DD","DY","FX","HV","NH","RH","SU","TP","UK","VD","YD","YU","ZR"]),H,un=()=>{if(H)return H;H=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n=65;n<=90;n++)for(let r=65;r<=90;r++){let o=String.fromCharCode(n,r);if(dn.has(o))continue;let a=t.of(o);!a||a===o||(H.set(a.toLowerCase(),o.toLowerCase()),H.set(o.toLowerCase(),o.toLowerCase()))}return H},mn=t=>{let n=t.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(yt,n)?yt[n]:un().get(n)},Ne=t=>[...new Set(t.flatMap(r=>mn(r)??[]))].sort(),fe=new WeakMap,St=t=>(fe.has(t)||(fe.set(t,void 0),Oe(t).then(n=>{fe.set(t,Ne(n).join(",")||void 0)}).catch(()=>{})),fe.get(t)),je=(t,n)=>{let r=new Set,o=[];for(let a=0;a<Math.max(t.length,n.length);a++)for(let c of[t[a],n[a]]){if(!c)continue;let d=c.mapbox_id||c.full_address||[c.name,c.place_formatted].filter(Boolean).join(", ");if(!r.has(d)&&(r.add(d),o.push(c),o.length===5))return o}return o},gn=600,bt=async(t,n,r)=>{if(r?.throwIfAborted(),!n){let o=await t();return r?.throwIfAborted(),o}return new Promise((o,a)=>{let c,d,u,v=!1,A=()=>{v=!0,clearTimeout(u),r?.removeEventListener("abort",M)},M=()=>{A(),a(r?.reason)},J=()=>{A(),c?.status==="fulfilled"&&d?.status==="fulfilled"?o(je(c.value,d.value)):c?.status==="fulfilled"?o(c.value):d?.status==="fulfilled"?o(d.value):c?.status==="rejected"&&a(c.reason)},p=(y,f)=>{v||(y?c=f:d=f,c&&d?J():f.status==="fulfilled"&&f.value.length>0&&(u=setTimeout(J,gn)))};r?.addEventListener("abort",M,{once:!0});for(let y of[!0,!1])t(y?n:void 0).then(f=>p(y,{status:"fulfilled",value:f}),f=>p(y,{status:"rejected",reason:f}))})};0&&(module.exports={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});
|
|
1
|
+
"use strict";var wt=Object.create;var Z=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty;var Ct=(t,n)=>()=>(t&&(n=t(t=0)),n);var Me=(t,n)=>{for(var r in n)Z(t,r,{get:n[r],enumerable:!0})},Ge=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of At(n))!Rt.call(t,a)&&a!==r&&Z(t,a,{get:()=>n[a],enumerable:!(o=It(n,a))||o.enumerable});return t};var k=(t,n,r)=>(r=t!=null?wt(Pt(t)):{},Ge(n||!t||!t.__esModule?Z(r,"default",{value:t,enumerable:!0}):r,t)),Lt=t=>Ge(Z({},"__esModule",{value:!0}),t);var _t={};Me(_t,{jobCountryCodes:()=>Oe});var St,gn,M,vn,fn,Oe,je=Ct(()=>{"use strict";St={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"},gn=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
|
|
2
|
+
bfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod
|
|
3
|
+
cfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma
|
|
4
|
+
dodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf
|
|
5
|
+
ggggy ghgha gigib glgrl gmgmb gngin gpglp gqgnq grgrc gssgs gtgtm gugum gwgnb gyguy hkhkg hmhmd hnhnd hrhrv hthti huhun
|
|
6
|
+
ididn ieirl ilisr imimn inind ioiot iqirq irirn isisl itita jejey jmjam jojor jpjpn keken kgkgz khkhm kikir kmcom knkna
|
|
7
|
+
kpprk krkor kwkwt kycym kzkaz lalao lblbn lclca lilie lklka lrlbr lslso ltltu lulux lvlva lylby mamar mcmco mdmda memne
|
|
8
|
+
mfmaf mgmdg mhmhl mkmkd mlmli mmmmr mnmng momac mpmnp mqmtq mrmrt msmsr mtmlt mumus mvmdv mwmwi mxmex mymys mzmoz nanam
|
|
9
|
+
ncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan peper pfpyf pgpng phphl pkpak plpol pmspm
|
|
10
|
+
pnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn
|
|
11
|
+
sjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl
|
|
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`,vn=()=>{if(M)return M;M=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of gn.split(/\s+/)){let r=n.slice(0,2),o=t.of(r.toUpperCase());o&&M.set(o.toLowerCase(),r),M.set(r,r),M.set(n.slice(2),r)}return M},fn=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(St,n))return St[n];let r=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return vn().get(r)},Oe=t=>[...new Set(t.flatMap(r=>fn(r)??[]))].sort()});var yn={};Me(yn,{ApiError:()=>F,InploiRpcClient:()=>$,JOB_ALERT_FREQUENCIES:()=>Le,NotFoundError:()=>j,ParsingError:()=>q,SchemaValidationError:()=>P,SdkError:()=>ke,UnauthorisedError:()=>N,addressSearchCountry:()=>Tt,blendAddressSuggestions:()=>Fe,consentStorageKey:()=>ve,createPlugin:()=>Ve,createTalentBankClient:()=>me,endpoint:()=>K,generateUUID:()=>W,getConsentAcceptance:()=>ft,getJobCountries:()=>Ne,getOrCreateAnonymousId:()=>Ae,hashConsentConfig:()=>ge,initialiseSdk:()=>vt,inploiBrandedLogger:()=>te,isApiErrorWithData:()=>$e,isSdkError:()=>He,jobCountryCodes:()=>Oe,noLogging:()=>ne,ready:()=>yt,saveClosedRoleJobAlerts:()=>bt,saveSearchEndpoint:()=>De,searchAddressSuggestions:()=>xt,setConsentAcceptance:()=>ht,typed:()=>L,validateEndpointInputs:()=>Re});module.exports=Lt(yn);var X="%c[inploi SDK]",ee="color: #65BC67; font-weight: bold;",te={warn:(...t)=>console.warn(X,ee,...t),error:(...t)=>console.error(X,ee,...t),info:(...t)=>console.info(X,ee,...t),log:(...t)=>console.log(X,ee,...t)},ne={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Ve=t=>t;function _e(t,n){if(!t)throw new Error(n)}function V(t,n){return n in t}var An=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Dt="Unauthenticated",Ot="This action is unauthorized.",O=class extends Error{constructor(r,o){super(r);this.status=o,this.name="ErrorWithStatus"}},j=class extends O{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},N=class extends O{constructor(n,r){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=r??401}},P=class extends O{constructor(r,o){let a=o?` in ${o}`:"";super(`Schema validation failed${a}`);this.issues=r;this.source=o;this.name="SchemaValidationError",this.status=400}},F=class extends O{constructor(r,o,a){super(r);this.data=a;this.name="ApiError",this.status=o??500}},$e=t=>t instanceof F&&t.data!==void 0,q=class extends O{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 q(t);return t.json().catch(()=>{throw new q(t)})}var jt=["message","error","errors","exception","exceptions"];function Nt(t){let n=[];if(typeof t=="object"&&t!==null){for(let r of jt)if(V(t,r)){let o=t[r];typeof o=="string"&&n.push(o),Array.isArray(o)&&o.every(a=>typeof a=="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 xe(t,n){if(n>=300){let r=Nt(t);throw n===404?new j(r):r===Dt?new N("You are not authenticated.",n):r===Ot?new N(r,n):new F(r,n,t)}}var ze=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(r,o={})=>{let a={...o,headers:{...o.headers,...n}},l=await fetch(`${t.baseUrl}${r}`,a);if(l.status===404)throw new j;let d=await Te(l);return xe(d,l.status),d}}},ke={NotFound:j,Unauthorised:N,SchemaValidation:P,Api:F,JsonParsing:q};function He(t){return Object.values(ke).some(n=>t instanceof n)}var Je="2.7.1";var re={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},We={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},Ke=Je;var B="isdk_session",oe=`${B}-candidate_id`,Ye=`${B}-consent`;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 Ee=t=>{let n=new Date;return n.setTime(n.getTime()+7*24*60*60*1e3),`${B}=${t};expires=${n.toUTCString()};path=/`},qt=(t,n)=>{let r=t.get("session_id");if(n||r)return r;let o=sessionStorage.getItem(`${B}-session_id`);return typeof o=="string"?o:null},Bt=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(oe);return typeof t=="string"&&t!==""?t:null}catch{return null}},Ut=t=>{if(!(typeof window>"u"))try{t?window.localStorage.setItem(oe,t):window.localStorage.removeItem(oe)}catch{}},Mt=new RegExp(`(?:^|;\\s*)${B}=([^;]+)`),we=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?Mt.exec(n)?.[1]??null:null},Ie=t=>{let n=t?t.url:location.href,{searchParams:r}=new URL(n);return{anonymous_id:we(t)??r.get("anonymous_id"),session_id:qt(r,typeof window>"u")}},Ae=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Ie().anonymous_id;if(t)return t;let n=W(),r=Ie().anonymous_id;return r||(document.cookie=Ee(n),n)},Gt=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},Vt=t=>t==="about:client"?"":t,$t={pathname:"/log",method:"POST",schema:{response:L(),body:L()}},Qe=({rpcClient:t,logger:n,onEvent:r,talentBank:o,persistence:a="device"})=>{let l=null,d=0,u=0,v=p=>a==="none"?{anonymous_id:null,session_id:p?null:l}:Ie(p),w=async(p,y)=>{try{let f={library:{name:"inploi-sdk",version:Ke},page:y},I=v(p.request);a==="device"&&p.event==="IDENTIFY"&&!I.anonymous_id&&!p.request&&typeof window<"u"&&(I={...I,anonymous_id:Ae()});let qe=a==="none"?null:Bt();if(p.event==="IDENTIFY"&&o&&(I.anonymous_id||a==="none")){let J=p.properties,Se=await o.identify({email:J.email??J.identifier,firstName:J.first_name,lastName:J.last_name,phone:J.phone_number,anonymousId:I.anonymous_id??W(),source:"sdk"});Se?.candidateId&&a==="device"&&(qe=Se.candidateId,Ut(Se.candidateId))}let b={anonymous_id:I.anonymous_id,session_id:I.session_id,candidate_id:qe,event:p.event,sent_at:new Date().toISOString(),context:f,properties:p.properties,custom_properties:p.customProperties},he=a==="none"?null:we(p.request),Be=++d,kt=await t.request($t,{body:b,...p.keepalive&&{keepalive:!0}}),A=Gt(kt);if(a==="none")return!p.request&&A?.session_id&&Be>u&&(u=Be,A.session_id!==b.session_id&&(l=A.session_id)),b.session_id=p.request?A?.session_id||null:l,r?.(b),{success:!0,data:b};let ye=p.request?he:we(),Et=ye!==null&&ye!==he,be=ye??he,Ue=!Et&&(!be||!A?.anonymous_id||be===A.anonymous_id);return Ue?(A?.anonymous_id&&(b.anonymous_id=A.anonymous_id),A?.session_id&&(b.session_id=A.session_id)):b.anonymous_id=be,!p.request&&typeof window<"u"&&b.anonymous_id&&(Ue&&b.session_id&&sessionStorage.setItem(`${B}-session_id`,b.session_id.toString()),document.cookie=Ee(b.anonymous_id)),r?.(b),{success:!0,data:b}}catch(f){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:f}}},G=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 y="request"in p&&p.request?{href:p.request.url,referrer:Vt(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(a==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p={...p,keepalive:!0}),a==="device"||p.request||l||p.keepalive)return w(p,y);let f=()=>w(p,y),I=G.then(f,f);return G=I,I},getHeaders:p=>{let y=new Headers;return a==="none"||!p?.anonymous_id||y.append("Set-Cookie",Ee(p.anonymous_id)),y},getSessionInfo:v}};var Ze=require("neoqs");function Pe(t,n,r){let o=t["~standard"].validate(n);if(o instanceof Promise)throw new TypeError("Async schema");if(o.issues)throw new P(o.issues,r);return o.value}function zt(t,n,r){try{return{success:!0,output:Pe(t,n,r)}}catch(o){if(o instanceof P)return{success:!1,issues:o.issues,source:o.source};throw o}}var $=class{constructor(n){if(this.baseUrl=re[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:a,body:l}=o?Re(n,r):r,d=new URL(this.baseUrl),u=n.pathname;if("params"in r&&r.params)for(let[v,w]of Object.entries(r.params))u=u.replace(`:${v}`,String(w));return d.pathname=u,n.schema.searchParams&&(d.search=(0,Ze.stringify)(a)),[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(xe(o,r.response.status),!(r.validateOut??!0))return o;let l=zt(n.schema.response,o,"response");if(!l.success)throw new P(l.issues,l.source);return l.output}async request(n,r){try{let o=this.getFetchParams(n,r),a=await fetch(...o);return await this.parseResponse(n,{response:a,validateOut:r.validateOut})}catch(o){throw o instanceof P?this.logger.error(o.message,o.issues):this.logger.error(o),o}}};function L(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function K(t){return t}function Re(t,n){let r={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(r.searchParams=Pe(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(r.body=Pe(t.schema.body,"body"in n?n.body:{})),r}var s=k(require("valibot"),1),Ht=["agent","sdk","form","integration","migration"],Jt=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var Wt=["screening","cv_match","interview","overall"],Kt=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],Yt=["job","company"],Qt=["created_at","updated_at"],Zt=["asc","desc"],Xt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],en=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],tn=["user","system","automation","integration","candidate"],ie=s.picklist(Ht),R=s.picklist(Jt),E=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),se=s.picklist(Wt),Xe=s.picklist(Kt),Jn=s.picklist(Yt),et=s.picklist(Qt),tt=s.picklist(Zt),Y=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),ae=s.picklist(Xt),nt=s.picklist(en),rt=s.picklist(tn);var _=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 C=k(require("valibot"),1),nn=C.object({total:C.number(),page:C.number(),perPage:C.number(),lastPage:C.number()});function ce(t){return C.object({data:C.array(t),pagination:nn})}var m=k(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(ie),identifiedAt:m.nullable(m.string()),createdAt:m.string(),updatedAt:m.string()});var i=k(require("valibot"),1);var g=k(require("valibot"),1),z=g.pipe(g.string(),g.minLength(1)),ot=g.pipe(g.number(),g.integer(),g.minValue(1)),D=g.record(g.string(),g.unknown());var T=k(require("valibot"),1);var it=T.object({id:T.string(),applicationId:T.string(),status:Xe,scheduledAt:T.nullable(T.string()),completedAt:T.nullable(T.string()),meta:T.nullable(D),createdAt:T.string(),updatedAt:T.string()});var Ce=i.object({score:i.number(),reason:i.string(),confidence:i.number()}),st=i.object({id:i.string(),candidateId:i.string(),jobId:i.number(),stage:E,stageGroup:R,stageEnteredAt:i.string(),rating:i.nullable(i.number()),disqualifiedAt:i.nullable(i.string()),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),source:ae,sourceDetail:i.nullable(i.string()),sessionId:i.nullable(i.number()),externalApplicationId:i.nullable(i.string()),meta:i.nullable(D),context:i.nullable(D),scoredAt:i.nullable(i.string()),createdAt:i.string(),updatedAt:i.string()}),rn=i.object({id:i.string(),applicationId:i.string(),scoreType:se,score:i.nullable(i.number()),reason:i.nullable(i.string()),categories:i.nullable(i.record(i.string(),Ce)),scoredBy:i.nullable(i.string()),createdAt:i.string()}),le=i.object({...st.entries,candidate:i.nullable(Q),score:i.nullable(rn),interview:i.nullable(it)}),on=i.object({...Q.entries,applications:i.array(st)}),at=i.object({id:i.string(),applicationId:i.string(),action:nt,fromStage:i.nullable(E),fromStageGroup:i.nullable(R),toStage:i.nullable(E),toStageGroup:i.nullable(R),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),actorId:i.nullable(i.string()),actorType:rt,actorEmail:i.nullable(i.string()),actorName:i.nullable(i.string()),meta:i.nullable(D),schemaVersion:i.number(),createdAt:i.string()});var h=k(require("valibot"),1);var ct=h.object({anonymousId:z,email:z,firstName:h.nullish(h.string()),lastName:h.nullish(h.string()),phone:h.nullish(h.string()),source:h.nullish(ie)}),lt=h.object({candidateId:h.string(),isNew:h.boolean()});var e=k(require("valibot"),1);var sn=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],de=e.picklist(sn),pt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),an=e.pipe(pt,e.array(E)),cn=e.pipe(pt,e.array(R)),dt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),gr=e.object({stages:e.optional(an),stage_groups:e.optional(cn),job_id:e.optional(e.string()),job_ids:e.optional(dt),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(et),order:e.optional(tt),page:e.optional(e.string()),per_page:e.optional(e.string())}),vr=e.pipe(e.object({candidateId:z,jobId:ot,meta:e.nullish(D),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),context:e.nullish(D),source:e.nullish(ae),sourceDetail:e.nullish(e.string()),stage:e.nullish(E),stageGroup:e.nullish(R),actor:e.nullish(_)}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together")),ut=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:ut})]),mt=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(ut)}),hr=e.object({applicationId:z,scoreType:se,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Ce)),scoredBy:e.nullish(e.string()),actor:e.nullish(_)}),yr=e.object({scoreId:e.string()}),br=ce(le);var Sr=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),_r=e.array(at),pe=e.object({stage:e.nullish(E),note:e.nullish(e.string())}),ln=e.object({stage:e.nullish(E),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),pn=e.variant("action",[e.object({action:e.literal("shortlist"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("move_to_interview"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("make_offer"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("hire"),actor:_,meta:e.nullish(ln)}),e.object({action:e.literal("withdraw"),actor:_,meta:e.nullish(pe)}),e.object({action:e.literal("move_to_stage"),actor:_,meta:e.object({stage:E,stageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:_,meta:e.object({toStage:E,toStageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:_,meta:e.object({reason:Y,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:_,meta:e.object({toStage:E,toStageGroup:R,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)))})})]),Tr=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:pn}),gt=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),xr=e.variant("kind",[e.object({kind:e.literal("updated"),action:de,application:le}),e.object({kind:e.literal("skipped"),action:de,applicationId:e.string(),reason:gt})]),kr=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:de,application:le})),skipped:e.array(e.object({kind:e.literal("skipped"),action:de,applicationId:e.string(),reason:gt})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),U=e.pipe(e.number(),e.integer(),e.minValue(0)),dn=e.object({APPLIED:U,SHORTLISTED:U,INTERVIEWED:U,OFFERED:U,HIRED:U,REJECTED:U,WITHDRAWN:U}),Er=e.object({job_ids:dt}),wr=e.object({counts:e.record(e.string(),dn)});var Cr=ce(Q);var S=k(require("valibot"),1),Dr=S.object({avg_score:S.nullable(S.number()),p90_score:S.nullable(S.number()),p85_score:S.nullable(S.number()),p80_score:S.nullable(S.number()),total_scores:S.number(),total_shortlists:S.number()});var ue=k(require("valibot"));var me=({environment:t,publishableKey:n,logger:r})=>{let o=We[t];return{async checkDuplicate(a){try{let l=new URLSearchParams({email:a.email,scope:a.scope});a.scope==="job"&&a.jobId!=null&&l.set("job_id",String(a.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(),v=ue.safeParse(mt,u);return v.success?v.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(a){try{if(!a.anonymousId)return r.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let l={email:a.email,firstName:a.firstName,lastName:a.lastName,phone:a.phone,anonymousId:a.anonymousId,source:a.source??"sdk"},d=ue.safeParse(ct,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 v=ue.safeParse(lt,await u.json());return v.success?v.output:(r.error("[TalentBankClient] identify returned an invalid response"),null)}catch(l){return r.error("[TalentBankClient] identify failed:",l),null}}}};function vt({publishableKey:t,env:n,logger:r=te,onEvent:o,persistence:a}){let l=ze({baseUrl:re[n],publishableKey:t}),d=r===!1?ne:r,u=new $({environment:n,apiKey:{type:"publishable",key:t},logger:d}),v=me({environment:n,publishableKey:t,logger:d}),w=Qe({rpcClient:u,logger:d,onEvent:o,talentBank:v,persistence:a});return{register:H=>H({logger:d,apiClient:l,analytics:w,rpcClient:u,publishableKey:t,env:n}),analytics:w,apiClient:l}}function ge(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 ve(t,n){return`${Ye}:${t}:${n}`}function ft(t,n){if(typeof window>"u")return!1;try{let r=ve(t,ge(n));return window.localStorage.getItem(r)==="accepted"}catch{return!1}}function ht(t,n){if(!(typeof window>"u"))try{let r=ve(t,ge(n));window.localStorage.setItem(r,"accepted")}catch{}}function yt(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var c=k(require("valibot"));var Le=["DAILY","WEEKLY","MONTHLY"],un=c.record(c.string(),c.union([c.string(),c.array(c.string()),c.object({type:c.literal("provided"),lat:c.number(),lng:c.number(),radius:c.number(),unit:c.optional(c.picklist(["miles","km"])),label:c.optional(c.string())})])),mn={pathname:"/job/:id",method:"GET",schema:{response:c.object({id:c.number(),external_id:c.nullish(c.string()),city:c.nullish(c.string()),town:c.nullish(c.string()),category:c.nullish(c.string())})}};async function bt(t,{contact:n,job:r}){let o={};if(r){let a=await t.request(mn,{params:{id:r.id}});if((r.id_type==="internal"?String(a.id):a.external_id)!==r.id)throw new Error("Job lookup returned a different role");for(let d of["city","town","category"]){let u=a[d]?.trim();u&&(o[d]=[u])}}await t.request(De,{body:{contact:n,alerts:"WEEKLY",filters:o}})}var De={pathname:"/search/save",method:"POST",schema:{response:L(),body:c.object({contact:c.object({email:c.pipe(c.optional(c.string()),c.string(),c.email()),first_name:c.optional(c.string()),last_name:c.optional(c.string())}),alerts:c.pipe(c.optional(c.string()),c.string(),c.picklist(Le)),filters:un})}};var x=k(require("valibot"));var Ne=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:x.pipe(x.object({country:x.optional(x.array(x.object({value:x.string()})),[])}),x.transform(({country:r})=>r.map(({value:o})=>o))),searchParams:L()}};return t.request(n,{searchParams:{filters:{country:null}}})},fe=new WeakMap,Tt=t=>(fe.has(t)||(fe.set(t,void 0),Ne(t).then(async n=>{let{jobCountryCodes:r}=await Promise.resolve().then(()=>(je(),_t));fe.set(t,r(n).join(",")||void 0)}).catch(()=>{})),fe.get(t)),Fe=(t,n)=>{let r=new Set,o=[];for(let a=0;a<Math.max(t.length,n.length);a++)for(let l of[t[a],n[a]]){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},hn=600,xt=async(t,n,r)=>{if(r?.throwIfAborted(),!n){let o=await t();return r?.throwIfAborted(),o}return new Promise((o,a)=>{let l,d,u,v=!1,w=()=>{v=!0,clearTimeout(u),r?.removeEventListener("abort",G)},G=()=>{w(),a(r?.reason)},H=()=>{w(),l?.status==="fulfilled"&&d?.status==="fulfilled"?o(Fe(l.value,d.value)):l?.status==="fulfilled"?o(l.value):d?.status==="fulfilled"?o(d.value):l?.status==="rejected"&&a(l.reason)},p=(y,f)=>{v||(y?l=f:d=f,l&&d?H():f.status==="fulfilled"&&f.value.length>0&&(u=setTimeout(H,hn)))};r?.addEventListener("abort",G,{once:!0});for(let y of[!0,!1])t(y?n:void 0).then(f=>p(y,{status:"fulfilled",value:f}),f=>p(y,{status:"rejected",reason:f}))})};je();0&&(module.exports={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});
|
|
2
14
|
//# sourceMappingURL=index.js.map
|