@inploi/sdk 3.0.0 → 3.0.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/cdn/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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 Jn=Object.defineProperty,Wn=Object.defineProperties;var Hn=Object.getOwnPropertyDescriptors;var ln=Object.getOwnPropertySymbols;var Xn=Object.prototype.hasOwnProperty,$n=Object.prototype.propertyIsEnumerable;var cn=(e,t,n)=>t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))Xn.call(t,n)&&cn(e,n,t[n]);if(ln)for(var n of ln(t))$n.call(t,n)&&cn(e,n,t[n]);return e},G=(e,t)=>Wn(e,Hn(t));var Yn=(e,t)=>()=>(e&&(t=e(e=0)),t);var F=(e,t,n)=>new Promise((r,s)=>{var o=u=>{try{p(n.next(u))}catch(y){s(y)}},a=u=>{try{p(n.throw(u))}catch(y){s(y)}},p=u=>u.done?r(u.value):Promise.resolve(u.value).then(o,a);p((n=n.apply(e,t)).next())});var Fn=Yn(()=>{"use strict"});function Fe(e,t){if(!e)throw new Error(t)}function ie(e,t){return t in e}var ur=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var _e="%c[inploi SDK]",xe="color: #65BC67; font-weight: bold;",qe={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)},Me={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Zn="Unauthenticated",Qn="This action is unauthorized.",Q=class extends Error{constructor(n,r){super(n);this.status=r,this.name="ErrorWithStatus"}},pe=class extends Q{constructor(t){super(t!=null?t:"Not found"),this.name="NotFoundError",this.status=404}},fe=class extends Q{constructor(t,n){super(t!=null?t:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},Z=class extends Q{constructor(n,r){let s=r?` in ${r}`:"";super(`Schema validation failed${s}`);this.issues=n;this.source=r;this.name="SchemaValidationError",this.status=400}},Ee=class extends Q{constructor(n,r,s){super(n);this.data=s;this.name="ApiError",this.status=r!=null?r:500}};var ye=class extends Q{constructor(n){var r;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(r=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?r:void 0}};function Ge(e){return F(this,null,function*(){let t=new Headers(e.headers).get("content-type"),n=t==null?void 0:t.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new ye(e);return e.json().catch(()=>{throw new ye(e)})})}var et=["message","error","errors","exception","exceptions"];function nt(e){let t=[];if(typeof e=="object"&&e!==null){for(let n of et)if(ie(e,n)){let r=e[n];typeof r=="string"&&t.push(r),Array.isArray(r)&&r.every(s=>typeof s=="string")&&t.push(...r)}ie(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&ie(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&ie(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&t.push(e.integration_response.error.message)}return t.length===0&&t.push("Unknown error"),[...new Set(t)].join(", ")}function Be(e,t){if(t>=300){let n=nt(e);throw t===404?new pe(n):n===Zn?new fe("You are not authenticated.",t):n===Qn?new fe(n,t):new Ee(n,t,e)}}var pn=e=>{let t={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(s,...o)=>F(void 0,[s,...o],function*(n,r={}){let a=G(O({},r),{headers:O(O({},r.headers),t)}),p=yield fetch(`${e.baseUrl}${n}`,a);if(p.status===404)throw new pe;let u=yield Ge(p);return Be(u,p.status),u})}};var fn="3.0.0";var we={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var yn=fn;var H="isdk_session",mn=`${H}-candidate_id`,rt=`${H}-consent`;var Ve="RFC3986",Ke={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},it="RFC1738";var st=Array.isArray,B=(()=>{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(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});let a="";for(let p=0;p<o.length;p+=ze){let u=o.length>=ze?o.slice(p,p+ze):o,y=[];for(let d=0;d<u.length;++d){let f=u.charCodeAt(d);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||s===it&&(f===40||f===41)){y[y.length]=u.charAt(d);continue}if(f<128){y[y.length]=B[f];continue}if(f<2048){y[y.length]=B[192|f>>6]+B[128|f&63];continue}if(f<55296||f>=57344){y[y.length]=B[224|f>>12]+B[128|f>>6&63]+B[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|u.charCodeAt(d)&1023),y[y.length]=B[240|f>>18]+B[128|f>>12&63]+B[128|f>>6&63]+B[128|f&63]}a+=y.join("")}return a};function ut(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function dn(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 _r=Array.isArray;var at=Object.prototype.hasOwnProperty,hn={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},z=Array.isArray,lt=Array.prototype.push,vn=function(e,t){lt.apply(e,z(t)?t:[t])},ct=Date.prototype.toISOString,R={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ot,encodeValuesOnly:!1,format:Ve,formatter:Ke[Ve],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 Ue={};function gn(e,t,n,r,s,o,a,p,u,y,d,f,S,c,k,j,x,D){let g=e,T=D,$=0,le=!1;for(;(T=T.get(Ue))!==void 0&&!le;){let P=T.get(e);if($+=1,typeof P!="undefined"){if(P===$)throw new RangeError("Cyclic object value");le=!0}typeof T.get(Ue)=="undefined"&&($=0)}if(typeof y=="function"?g=y(t,g):g instanceof Date?g=S==null?void 0:S(g):n==="comma"&&z(g)&&(g=dn(g,function(P){return P instanceof Date?S==null?void 0:S(P):P})),g===null){if(o)return u&&!j?u(t,R.encoder,x,"key",c):t;g=""}if(pt(g)||ut(g)){if(u){let P=j?t:u(t,R.encoder,x,"key",c);return[(k==null?void 0:k(P))+"="+(k==null?void 0:k(u(g,R.encoder,x,"value",c)))]}return[(k==null?void 0:k(t))+"="+(k==null?void 0:k(String(g)))]}let ce=[];if(typeof g=="undefined")return ce;let E;if(n==="comma"&&z(g))j&&u&&(g=dn(g,u)),E=[{value:g.length>0?g.join(",")||null:void 0}];else if(z(y))E=y;else{let P=Object.keys(g);E=d?P.sort(d):P}let Y=p?String(t).replace(/\./g,"%2E"):String(t),re=r&&z(g)&&g.length===1?Y+"[]":Y;if(s&&z(g)&&g.length===0)return re+"[]";for(let P=0;P<E.length;++P){let W=E[P],un=typeof W=="object"&&typeof W.value!="undefined"?W.value:g[W];if(a&&un===null)continue;let Le=f&&p?W.replace(/\./g,"%2E"):W,Kn=z(g)?typeof n=="function"?n(re,Le):re:re+(f?"."+Le:"["+Le+"]");D.set(e,$);let an=new WeakMap;an.set(Ue,D),vn(ce,gn(un,Kn,n,r,s,o,a,p,n==="comma"&&j&&z(g)?null:u,y,d,f,S,c,k,j,x,an))}return ce}function ft(e=R){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let t=e.charset||R.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=Ve;if(typeof e.format!="undefined"){if(!at.call(Ke,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let r=Ke[n],s=R.filter;(typeof e.filter=="function"||z(e.filter))&&(s=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in hn?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=R.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:R.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:R.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:R.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:R.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?R.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:R.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:R.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:R.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:R.encodeValuesOnly,filter:s,format:n,formatter:r,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:R.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:R.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:R.strictNullHandling}}function bn(e,t={}){let n=e,r=ft(t),s,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):z(r.filter)&&(o=r.filter,s=o);let a=[];if(typeof n!="object"||n===null)return"";let p=hn[r.arrayFormat],u=p==="comma"&&r.commaRoundTrip;s||(s=Object.keys(n)),r.sort&&s.sort(r.sort);let y=new WeakMap;for(let S=0;S<s.length;++S){let c=s[S];r.skipNulls&&n[c]===null||vn(a,gn(n[c],c,p,u,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,y))}let d=a.join(r.delimiter),f=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),d.length>0?f+d:""}function Je(e,t,n){let r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Async schema");if(r.issues)throw new Z(r.issues,n);return r.value}function yt(e,t,n){try{return{success:!0,output:Je(e,t,n)}}catch(r){if(r instanceof Z)return{success:!1,issues:r.issues,source:r.source};throw r}}var me=class{constructor(t){if(this.baseUrl=we[t.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),t.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",t.apiKey.key)}else this.headers.set("x-publishable-key",t.apiKey.key);this.logger=t.logger,this._environment=t.environment}get environment(){return this._environment}getFetchParams(t,n){var u;let r=(u=n.validateIn)!=null?u:!0,{searchParams:s,body:o}=r?kn(t,n):n,a=new URL(this.baseUrl),p=t.pathname;if("params"in n&&n.params)for(let[y,d]of Object.entries(n.params))p=p.replace(`:${y}`,String(d));return a.pathname=p,t.schema.searchParams&&(a.search=bn(s)),[a.toString(),O({method:t.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(t,n){return F(this,null,function*(){var a;let r=yield Ge(n.response);if(Be(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 Z(o.issues,o.source);return o.output})}request(t,n){return F(this,null,function*(){try{let r=this.getFetchParams(t,n),s=yield fetch(...r);return yield this.parseResponse(t,{response:s,validateOut:n.validateOut})}catch(r){throw r instanceof Z?this.logger.error(r.message,r.issues):this.logger.error(r),r}})}};function ee(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function kn(e,t){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=Je(e.schema.searchParams,"searchParams"in t?t.searchParams:{})),e.schema.body&&(n.body=Je(e.schema.body,"body"in t?t.body:{})),n}var U,mt={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function dt(e){var t,n,r;return!e&&!U?mt:{lang:(t=e==null?void 0:e.lang)!=null?t:U==null?void 0:U.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:U==null?void 0:U.abortEarly,abortPipeEarly:(r=e==null?void 0:e.abortPipeEarly)!=null?r:U==null?void 0:U.abortPipeEarly}}var We;function ht(e){return We==null?void 0:We.get(e)}var He;function vt(e){return He==null?void 0:He.get(e)}var Xe;function gt(e,t){var n;return(n=Xe==null?void 0:Xe.get(e))==null?void 0:n.get(t)}function ne(e){var n,r,s;let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(s=e&&((r=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:r.name))!=null?s:"null":t}function I(e,t,n,r,s){var f,S,c,k,j,x,D,g;let o=s&&"input"in s?s.input:n.value,a=(S=(f=s==null?void 0:s.expected)!=null?f:e.expects)!=null?S:null,p=(c=s==null?void 0:s.received)!=null?c:ne(o),u={kind:e.kind,type:e.type,input:o,expected:a,received:p,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${p}`,requirement:e.requirement,path:s==null?void 0:s.path,issues:s==null?void 0:s.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},y=e.kind==="schema",d=(g=(D=(x=(j=(k=s==null?void 0:s.message)!=null?k:e.message)!=null?j:gt(e.reference,u.lang))!=null?x:y?vt(u.lang):null)!=null?D:r.message)!=null?g:ht(u.lang);d!==void 0&&(u.message=typeof d=="function"?d(u):d),y&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}var _n=new WeakMap;function C(e){let t=_n.get(e);return t||(t={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},dt())}},_n.set(e,t)),t}function bt(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function $e(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,Pr=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 Ye(e,t){return{kind:"validation",type:"check",reference:Ye,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 Ze(e){return{kind:"validation",type:"email",reference:Ze,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 se(e){return{kind:"validation",type:"integer",reference:se,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&I(this,"integer",t,n),t}}}function Se(e,t){return{kind:"validation",type:"max_length",reference:Se,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length>this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function Qe(e,t){return{kind:"validation",type:"max_value",reference:Qe,async:!1,expects:`<=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value<=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function N(e,t){return{kind:"validation",type:"min_length",reference:N,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length<this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function oe(e,t){return{kind:"validation",type:"min_value",reference:oe,async:!1,expects:`>=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value>=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function Ae(e){return{kind:"transformation",type:"transform",reference:Ae,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function Ie(){return{kind:"transformation",type:"trim",reference:Ie,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}var _t={abortEarly:!0};function xt(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function Te(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function L(e,t){return{kind:"schema",type:"array",reference:L,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let a=0;a<s.length;a++){let p=s[a],u=this.item["~run"]({value:p},r);if(u.issues){let y={type:"array",origin:"value",input:s,key:a,value:p};for(let d of u.issues)d.path?d.path.unshift(y):d.path=[y],(o=n.issues)==null||o.push(d);if(n.issues||(n.issues=u.issues),r.abortEarly){n.typed=!1;break}}u.typed||(n.typed=!1),n.value.push(u.value)}}else I(this,"type",n,r);return n}}}function de(e){return{kind:"schema",type:"boolean",reference:de,expects:"boolean",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:I(this,"type",t,n),t}}}function _(e,t){return{kind:"schema",type:"literal",reference:_,expects:ne(e),async:!1,literal:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===this.literal?n.typed=!0:I(this,"type",n,r),n}}}function m(e,t){return{kind:"schema",type:"nullable",reference:m,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===null&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function h(e,t){return{kind:"schema",type:"nullish",reference:h,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function b(e){return{kind:"schema",type:"number",reference:b,expects:"number",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:I(this,"type",t,n),t}}}function l(e,t){return{kind:"schema",type:"object",reference:l,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let a in this.entries){let p=this.entries[a];if(a in s||(p.type==="exact_optional"||p.type==="optional"||p.type==="nullish")&&p.default!==void 0){let u=a in s?s[a]:Te(p),y=p["~run"]({value:u},r);if(y.issues){let d={type:"object",origin:"value",input:s,key:a,value:u};for(let f of y.issues)f.path?f.path.unshift(d):f.path=[d],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=y.issues),r.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value[a]=y.value}else if(p.fallback!==void 0)n.value[a]=xt(p);else if(p.type!=="exact_optional"&&p.type!=="optional"&&p.type!=="nullish"&&(I(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:s,key:a,value:s[a]}]}),r.abortEarly))break}}else I(this,"type",n,r);return n}}}function v(e,t){return{kind:"schema",type:"optional",reference:v,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function A(e,t){return{kind:"schema",type:"picklist",reference:A,expects:$e(e.map(ne),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return this.options.includes(n.value)?n.typed=!0:I(this,"type",n,r),n}}}function V(e,t,n){return{kind:"schema",type:"record",reference:V,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){var a,p;let o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(let u in o)if(bt(o,u)){let y=o[u],d=this.key["~run"]({value:u},s);if(d.issues){let S={type:"object",origin:"key",input:o,key:u,value:y};for(let c of d.issues)c.path=[S],(a=r.issues)==null||a.push(c);if(r.issues||(r.issues=d.issues),s.abortEarly){r.typed=!1;break}}let f=this.value["~run"]({value:y},s);if(f.issues){let S={type:"object",origin:"value",input:o,key:u,value:y};for(let c of f.issues)c.path?c.path.unshift(S):c.path=[S],(p=r.issues)==null||p.push(c);if(r.issues||(r.issues=f.issues),s.abortEarly){r.typed=!1;break}}(!d.typed||!f.typed)&&(r.typed=!1),d.typed&&(r.value[d.value]=f.value)}}else I(this,"type",r,s);return r}}}function i(e){return{kind:"schema",type:"string",reference:i,expects:"string",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:I(this,"type",t,n),t}}}function xn(e){let t;if(e)for(let n of e)if(t)for(let r of n.issues)t.push(r);else t=n.issues;return t}function he(e,t){return{kind:"schema",type:"union",reference:he,expects:$e(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){let s,o,a;for(let p of this.options){let u=p["~run"]({value:n.value},r);if(u.typed)if(u.issues)o?o.push(u):o=[u];else{s=u;break}else a?a.push(u):a=[u]}if(s)return s;if(o){if(o.length===1)return o[0];I(this,"type",n,r,{issues:xn(o)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];I(this,"type",n,r,{issues:xn(a)})}return n}}}function en(){return{kind:"schema",type:"unknown",reference:en,expects:"unknown",async:!1,get"~standard"(){return C(this)},"~run"(e){return e.typed=!0,e}}}function ue(e,t,n){return{kind:"schema",type:"variant",reference:ue,expects:"Object",async:!1,key:e,options:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){let o=r.value;if(o&&typeof o=="object"){let a,p=0,u=this.key,y=[],d=(f,S)=>{for(let c of f.options){if(c.type==="variant")d(c,new Set(S).add(c.key));else{let k=!0,j=0;for(let x of S){let D=c.entries[x];if(x in o?D["~run"]({typed:!1,value:o[x]},_t).issues:D.type!=="exact_optional"&&D.type!=="optional"&&D.type!=="nullish"){k=!1,u!==x&&(p<j||p===j&&x in o&&!(u in o))&&(p=j,u=x,y=[]),u===x&&y.push(c.entries[x].expects);break}j++}if(k){let x=c["~run"]({value:o},s);(!a||!a.typed&&x.typed)&&(a=x)}}if(a&&!a.issues)break}};if(d(this,new Set([this.key])),a)return a;I(this,"type",r,s,{input:o[u],expected:$e(y,"|"),path:[{type:"object",origin:"value",input:o,key:u,value:o[u]}]})}else I(this,"type",r,s);return r}}}function w(...e){return G(O({},e[0]),{pipe:e,get"~standard"(){return C(this)},"~run"(t,n){for(let r of e)if(r.kind!=="metadata"){if(t.issues&&(r.kind==="schema"||r.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r["~run"](t,n))}return t}})}var Et=["agent","sdk","form","integration","migration"],wt=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var St=["screening","cv_match","interview","overall"],At=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],It=["job","company"],Tt=["created_at","updated_at"],Pt=["asc","desc"],Rt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],jt=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],Dt=["user","system","automation","integration","candidate"],Pe=A(Et),J=A(wt),M=w(i(),Ie(),N(1),Se(100)),Re=A(St),En=A(At),jr=A(It),wn=A(Tt),Sn=A(Pt),ve=w(i(),Ie(),N(1),Se(100)),je=A(Rt),An=A(jt),In=A(Dt);var q=ue("type",[l({type:_("user"),id:w(i(),N(1)),email:w(i(),N(1)),name:w(i(),N(1))}),l({type:_("system"),id:w(i(),N(1)),name:v(i())}),l({type:_("automation"),id:w(i(),N(1)),name:v(i())}),l({type:_("integration"),id:w(i(),N(1)),name:v(i())}),l({type:_("candidate"),id:w(i(),N(1)),email:v(i())})]);var Ot=l({total:b(),page:b(),perPage:b(),lastPage:b()});function De(e){return l({data:L(e),pagination:Ot})}var ge=l({id:i(),email:m(i()),firstName:m(i()),lastName:m(i()),phone:m(i()),source:m(Pe),identifiedAt:m(i()),createdAt:i(),updatedAt:i()});var ae=w(i(),N(1)),Tn=w(b(),se(),oe(1)),X=V(i(),en());var Pn=l({id:i(),applicationId:i(),status:En,scheduledAt:m(i()),completedAt:m(i()),meta:m(X),createdAt:i(),updatedAt:i()});var nn=l({score:b(),reason:i(),confidence:b()}),Rn=l({id:i(),candidateId:i(),jobId:b(),stage:M,stageGroup:J,stageEnteredAt:i(),rating:m(b()),disqualifiedAt:m(i()),disqualificationReason:m(ve),disqualificationNote:m(i()),source:je,sourceDetail:m(i()),sessionId:m(b()),externalApplicationId:m(i()),meta:m(X),context:m(X),scoredAt:m(i()),createdAt:i(),updatedAt:i()}),Ct=l({id:i(),applicationId:i(),scoreType:Re,score:m(b()),reason:m(i()),categories:m(V(i(),nn)),scoredBy:m(i()),createdAt:i()}),Oe=l(G(O({},Rn.entries),{candidate:m(ge),score:m(Ct),interview:m(Pn)})),Nt=l(G(O({},ge.entries),{applications:L(Rn)})),jn=l({id:i(),applicationId:i(),action:An,fromStage:m(M),fromStageGroup:m(J),toStage:m(M),toStageGroup:m(J),disqualificationReason:m(ve),disqualificationNote:m(i()),actorId:m(i()),actorType:In,actorEmail:m(i()),actorName:m(i()),meta:m(X),schemaVersion:b(),createdAt:i()});var Lt=l({anonymousId:ae,email:ae,firstName:h(i()),lastName:h(i()),phone:h(i()),source:h(Pe)}),Ft=l({candidateId:i(),isNew:de()});var qt=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],Ne=A(qt),Dn=w(i(),Ae(e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0))),Mt=w(Dn,L(M)),Gt=w(Dn,L(J)),On=w(i(),Ae(e=>e.split(",").map(t=>Number(t.trim())).filter(t=>Number.isInteger(t)&&t>0))),Qr=l({stages:v(Mt),stage_groups:v(Gt),job_id:v(i()),job_ids:v(On),candidate_id:v(i()),is_disqualified:v(A(["true","false"])),created_from:v(i()),created_to:v(i()),updated_from:v(i()),updated_to:v(i()),entered_stage_from:v(i()),entered_stage_to:v(i()),from:v(i()),to:v(i()),q:v(i()),scored:v(A(["true","false"])),sort:v(wn),order:v(Sn),page:v(i()),per_page:v(i())}),ei=w(l({candidateId:ae,jobId:Tn,meta:h(X),sessionId:h(b()),externalApplicationId:h(i()),context:h(X),source:h(je),sourceDetail:h(i()),stage:h(M),stageGroup:h(J),actor:h(q)}),Ye(e=>e.stage==null==(e.stageGroup==null),"stage and stageGroup must be supplied together")),Cn=l({id:i(),stageGroup:i(),createdAt:i()}),ni=he([l({ok:_(!0),duplicate:_(!1),applicationId:i(),candidateId:i()}),l({ok:_(!0),duplicate:_(!0),existingApplication:Cn})]),Bt=l({isDuplicate:de(),existingApplication:v(Cn)}),ti=l({applicationId:ae,scoreType:Re,score:b(),reason:h(i()),categories:h(V(i(),nn)),scoredBy:h(i()),actor:h(q)}),ri=l({scoreId:i()}),ii=De(Oe);var si=A(["already_in_target_stage","not_in_source_stage","disqualified"]),oi=L(jn),Ce=l({stage:h(M),note:h(i())}),zt=l({stage:h(M),startDate:h(i()),note:h(i())}),Ut=ue("action",[l({action:_("shortlist"),actor:q,meta:h(Ce)}),l({action:_("move_to_interview"),actor:q,meta:h(Ce)}),l({action:_("make_offer"),actor:q,meta:h(Ce)}),l({action:_("hire"),actor:q,meta:h(zt)}),l({action:_("withdraw"),actor:q,meta:h(Ce)}),l({action:_("move_to_stage"),actor:q,meta:l({stage:M,stageGroup:J,note:h(i())})}),l({action:_("stage_transition"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("disqualify"),actor:q,meta:l({reason:ve,note:h(i())})}),l({action:_("reinstate"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("rate"),actor:q,meta:l({rating:m(w(b(),se(),oe(1),Qe(5)))})})]),ui=l({applicationIds:w(L(i()),N(1)),body:Ut}),Nn=A(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),ai=ue("kind",[l({kind:_("updated"),action:Ne,application:Oe}),l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Nn})]),li=l({updated:L(l({kind:_("updated"),action:Ne,application:Oe})),skipped:L(l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Nn})),failed:L(l({applicationId:i(),error:i()}))}),te=w(b(),se(),oe(0)),Vt=l({APPLIED:te,SHORTLISTED:te,INTERVIEWED:te,OFFERED:te,HIRED:te,REJECTED:te,WITHDRAWN:te}),ci=l({job_ids:On}),pi=l({counts:V(i(),Vt)});var hi=De(ge);var gi=l({avg_score:m(b()),p90_score:m(b()),p85_score:m(b()),p80_score:m(b()),total_scores:b(),total_shortlists:b()});var be=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function tn(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Ln=["DAILY","WEEKLY","MONTHLY"],Kt=V(i(),he([i(),L(i()),l({type:_("provided"),lat:b(),lng:b(),radius:b(),unit:v(A(["miles","km"])),label:v(i())})])),zi={pathname:"/job/:id",method:"GET",schema:{response:l({id:b(),external_id:h(i()),city:h(i()),town:h(i()),category:h(i())})}};var Jt={pathname:"/search/save",method:"POST",schema:{response:ee(),body:l({contact:l({email:w(v(i()),i(),Ze()),first_name:v(i()),last_name:v(i())}),alerts:w(v(i()),i(),A(Ln)),filters:Kt})}};Fn();var Gn=7*24*60*60*1e3,Bn=e=>{let t=new Date;return t.setTime(t.getTime()+Gn),`${H}=${e};expires=${t.toUTCString()};path=/`},Wt=(e,t)=>{let n=e.get("session_id");if(t||n)return n;let r=sessionStorage.getItem(`${H}-session_id`);return typeof r=="string"?r:null},Ht=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(mn);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Xt=new RegExp(`(?:^|;\\s*)${H}=([^;]+)`),ke=e=>{var n,r;let t=e?e.headers.get("cookie"):document.cookie;return t&&(r=(n=Xt.exec(t))==null?void 0:n[1])!=null?r:null},zn=()=>{var e;try{let t=JSON.parse((e=window.localStorage.getItem(H))!=null?e:"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch(t){return null}},Mn=()=>{var e;return(e=ke())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:zn()},$t=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",Un=e=>{if(document.cookie=Bn(e)+$t(),ke()!==e)try{window.localStorage.setItem(H,JSON.stringify({id:e,expires:Date.now()+Gn}))}catch(t){}},on=e=>{var r,s,o;let t=e?e.url:location.href,{searchParams:n}=new URL(t);return{anonymous_id:e?(r=ke(e))!=null?r:n.get("anonymous_id"):(o=(s=ke())!=null?s:n.get("anonymous_id"))!=null?o:zn(),session_id:Wt(n,typeof window=="undefined")}},qn=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=on().anonymous_id;if(e)return e;let t=be(),n=on().anonymous_id;return n||(Un(t),t)},Yt=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},Zt=e=>e==="about:client"?"":e,Qt={pathname:"/log",method:"POST",schema:{response:ee(),body:ee()}},Vn=({rpcClient:e,logger:t,onEvent:n,persistence:r="device",siteKind:s})=>{let o=null,a=null,p=0,u=0,y=c=>r==="none"?{anonymous_id:null,session_id:c?null:o}:on(c),d=(c,k,j)=>F(void 0,null,function*(){try{let x={library:{name:"inploi-sdk",version:yn},page:k},D=y(c.request),g=r==="none"?null:Ht(),T={anonymous_id:D.anonymous_id,session_id:D.session_id,candidate_id:g,event:c.event,sent_at:new Date().toISOString(),context:x,properties:c.properties,custom_properties:O(O({},c.customProperties),j)},$=r==="none"?null:c.request?ke(c.request):Mn(),le=++p,ce=yield e.request(Qt,O({body:T},c.keepalive&&{keepalive:!0})),E=Yt(ce);if(r==="none")return!c.request&&(E!=null&&E.session_id)&&le>u&&(u=le,E.session_id!==T.session_id&&(o=E.session_id)),T.session_id=c.request?(E==null?void 0:E.session_id)||null:o,n==null||n(T),{success:!0,data:T};let Y=c.request?$:Mn(),re=Y!==null&&Y!==$,P=Y!=null?Y:$,W=!re&&(!P||!(E!=null&&E.anonymous_id)||P===E.anonymous_id);return W?(E!=null&&E.anonymous_id&&(T.anonymous_id=E.anonymous_id),E!=null&&E.session_id&&(T.session_id=E.session_id)):T.anonymous_id=P,!c.request&&typeof window!="undefined"&&T.anonymous_id&&(W&&T.session_id&&sessionStorage.setItem(`${H}-session_id`,T.session_id.toString()),Un(T.anonymous_id)),n==null||n(T),{success:!0,data:T}}catch(x){return t.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:x}}}),f=Promise.resolve();return{log:c=>F(void 0,null,function*(){Fe(c.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let k="request"in c&&c.request?{href:c.request.url,referrer:Zt(c.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};r==="none"&&c.event==="FLOW_NODE"&&c.properties&&"trigger"in c.properties&&(c.properties.trigger==="pagehide"||c.properties.trigger==="hidden")&&(c=G(O({},c),{keepalive:!0}));let j={event_id:be(),consent_lane:r,site_kind:s};if(r==="device"||c.request||o||c.keepalive)return d(c,k,j);let x=()=>d(c,k,j),D=f.then(x,x);return f=D,D}),getHeaders:c=>{let k=new Headers;return r==="none"||!(c!=null&&c.anonymous_id)||k.append("Set-Cookie",Bn(c.anonymous_id)),k},getSessionInfo:y,getOrCreateAnonymousId:()=>r==="none"?a!=null?a:a=be():qn()}};function sn({publishableKey:e,env:t,logger:n=qe,onEvent:r,persistence:s,siteKind:o}){let a=pn({baseUrl:we[t],publishableKey:e}),p=n===!1?Me:n,u=new me({environment:t,apiKey:{type:"publishable",key:e},logger:p}),y=Vn({rpcClient:u,logger:p,onEvent:r,persistence:s,siteKind:o});return{register:f=>f({logger:p,apiClient:a,analytics:y,rpcClient:u,publishableKey:e,env:t}),analytics:y,apiClient:a}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=sn;window.inploi.ready=tn;})();
|
|
3
|
+
"use strict";(()=>{var Hn=Object.defineProperty,Xn=Object.defineProperties;var $n=Object.getOwnPropertyDescriptors;var pn=Object.getOwnPropertySymbols;var Yn=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable;var fn=(e,t,n)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))Yn.call(t,n)&&fn(e,n,t[n]);if(pn)for(var n of pn(t))Zn.call(t,n)&&fn(e,n,t[n]);return e},G=(e,t)=>Xn(e,$n(t));var Qn=(e,t)=>()=>(e&&(t=e(e=0)),t);var F=(e,t,n)=>new Promise((r,s)=>{var o=u=>{try{p(n.next(u))}catch(y){s(y)}},a=u=>{try{p(n.throw(u))}catch(y){s(y)}},p=u=>u.done?r(u.value):Promise.resolve(u.value).then(o,a);p((n=n.apply(e,t)).next())});var Mn=Qn(()=>{"use strict"});function qe(e,t){if(!e)throw new Error(t)}function ie(e,t){return t in e}var lr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var _e="%c[inploi SDK]",xe="color: #65BC67; font-weight: bold;",Me={warn:(...e)=>console.warn(_e,xe,...e),error:(...e)=>console.error(_e,xe,...e),info:(...e)=>console.info(_e,xe,...e),log:(...e)=>console.log(_e,xe,...e)},Ge={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var et="Unauthenticated",nt="This action is unauthorized.",Q=class extends Error{constructor(n,r){super(n);this.status=r,this.name="ErrorWithStatus"}},pe=class extends Q{constructor(t){super(t!=null?t:"Not found"),this.name="NotFoundError",this.status=404}},fe=class extends Q{constructor(t,n){super(t!=null?t:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},Z=class extends Q{constructor(n,r){let s=r?` in ${r}`:"";super(`Schema validation failed${s}`);this.issues=n;this.source=r;this.name="SchemaValidationError",this.status=400}},Ee=class extends Q{constructor(n,r,s){super(n);this.data=s;this.name="ApiError",this.status=r!=null?r:500}};var ye=class extends Q{constructor(n){var r;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(r=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?r:void 0}};function Be(e){return F(this,null,function*(){let t=new Headers(e.headers).get("content-type"),n=t==null?void 0:t.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new ye(e);return e.json().catch(()=>{throw new ye(e)})})}var tt=["message","error","errors","exception","exceptions"];function rt(e){let t=[];if(typeof e=="object"&&e!==null){for(let n of tt)if(ie(e,n)){let r=e[n];typeof r=="string"&&t.push(r),Array.isArray(r)&&r.every(s=>typeof s=="string")&&t.push(...r)}ie(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&ie(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&ie(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&t.push(e.integration_response.error.message)}return t.length===0&&t.push("Unknown error"),[...new Set(t)].join(", ")}function ze(e,t){if(t>=300){let n=rt(e);throw t===404?new pe(n):n===et?new fe("You are not authenticated.",t):n===nt?new fe(n,t):new Ee(n,t,e)}}var yn=e=>{let t={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(s,...o)=>F(void 0,[s,...o],function*(n,r={}){let a=G(O({},r),{headers:O(O({},r.headers),t)}),p=yield fetch(`${e.baseUrl}${n}`,a);if(p.status===404)throw new pe;let u=yield Be(p);return ze(u,p.status),u})}};var mn="3.0.1";var we={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var dn=mn;var H="isdk_session",hn=`${H}-candidate_id`,st=`${H}-consent`;var Ke="RFC3986",Je={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},ot="RFC1738";var ut=Array.isArray,B=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var Ue=1024,at=(e,t,n,r,s)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});let a="";for(let p=0;p<o.length;p+=Ue){let u=o.length>=Ue?o.slice(p,p+Ue):o,y=[];for(let d=0;d<u.length;++d){let f=u.charCodeAt(d);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||s===ot&&(f===40||f===41)){y[y.length]=u.charAt(d);continue}if(f<128){y[y.length]=B[f];continue}if(f<2048){y[y.length]=B[192|f>>6]+B[128|f&63];continue}if(f<55296||f>=57344){y[y.length]=B[224|f>>12]+B[128|f>>6&63]+B[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|u.charCodeAt(d)&1023),y[y.length]=B[240|f>>18]+B[128|f>>12&63]+B[128|f>>6&63]+B[128|f&63]}a+=y.join("")}return a};function lt(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function vn(e,t){if(ut(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var Er=Array.isArray;var ct=Object.prototype.hasOwnProperty,gn={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},z=Array.isArray,pt=Array.prototype.push,bn=function(e,t){pt.apply(e,z(t)?t:[t])},ft=Date.prototype.toISOString,R={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:at,encodeValuesOnly:!1,format:Ke,formatter:Je[Ke],indices:!1,serializeDate(e){return ft.call(e)},skipNulls:!1,strictNullHandling:!1};function yt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var Ve={};function kn(e,t,n,r,s,o,a,p,u,y,d,f,S,c,k,j,x,D){let g=e,T=D,$=0,le=!1;for(;(T=T.get(Ve))!==void 0&&!le;){let P=T.get(e);if($+=1,typeof P!="undefined"){if(P===$)throw new RangeError("Cyclic object value");le=!0}typeof T.get(Ve)=="undefined"&&($=0)}if(typeof y=="function"?g=y(t,g):g instanceof Date?g=S==null?void 0:S(g):n==="comma"&&z(g)&&(g=vn(g,function(P){return P instanceof Date?S==null?void 0:S(P):P})),g===null){if(o)return u&&!j?u(t,R.encoder,x,"key",c):t;g=""}if(yt(g)||lt(g)){if(u){let P=j?t:u(t,R.encoder,x,"key",c);return[(k==null?void 0:k(P))+"="+(k==null?void 0:k(u(g,R.encoder,x,"value",c)))]}return[(k==null?void 0:k(t))+"="+(k==null?void 0:k(String(g)))]}let ce=[];if(typeof g=="undefined")return ce;let E;if(n==="comma"&&z(g))j&&u&&(g=vn(g,u)),E=[{value:g.length>0?g.join(",")||null:void 0}];else if(z(y))E=y;else{let P=Object.keys(g);E=d?P.sort(d):P}let Y=p?String(t).replace(/\./g,"%2E"):String(t),re=r&&z(g)&&g.length===1?Y+"[]":Y;if(s&&z(g)&&g.length===0)return re+"[]";for(let P=0;P<E.length;++P){let W=E[P],ln=typeof W=="object"&&typeof W.value!="undefined"?W.value:g[W];if(a&&ln===null)continue;let Fe=f&&p?W.replace(/\./g,"%2E"):W,Wn=z(g)?typeof n=="function"?n(re,Fe):re:re+(f?"."+Fe:"["+Fe+"]");D.set(e,$);let cn=new WeakMap;cn.set(Ve,D),bn(ce,kn(ln,Wn,n,r,s,o,a,p,n==="comma"&&j&&z(g)?null:u,y,d,f,S,c,k,j,x,cn))}return ce}function mt(e=R){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let t=e.charset||R.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=Ke;if(typeof e.format!="undefined"){if(!ct.call(Je,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let r=Je[n],s=R.filter;(typeof e.filter=="function"||z(e.filter))&&(s=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in gn?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=R.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:R.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:R.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:R.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:R.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?R.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:R.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:R.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:R.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:R.encodeValuesOnly,filter:s,format:n,formatter:r,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:R.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:R.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:R.strictNullHandling}}function _n(e,t={}){let n=e,r=mt(t),s,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):z(r.filter)&&(o=r.filter,s=o);let a=[];if(typeof n!="object"||n===null)return"";let p=gn[r.arrayFormat],u=p==="comma"&&r.commaRoundTrip;s||(s=Object.keys(n)),r.sort&&s.sort(r.sort);let y=new WeakMap;for(let S=0;S<s.length;++S){let c=s[S];r.skipNulls&&n[c]===null||bn(a,kn(n[c],c,p,u,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,y))}let d=a.join(r.delimiter),f=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),d.length>0?f+d:""}function We(e,t,n){let r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Async schema");if(r.issues)throw new Z(r.issues,n);return r.value}function dt(e,t,n){try{return{success:!0,output:We(e,t,n)}}catch(r){if(r instanceof Z)return{success:!1,issues:r.issues,source:r.source};throw r}}var me=class{constructor(t){if(this.baseUrl=we[t.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),t.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",t.apiKey.key)}else this.headers.set("x-publishable-key",t.apiKey.key);this.logger=t.logger,this._environment=t.environment}get environment(){return this._environment}getFetchParams(t,n){var u;let r=(u=n.validateIn)!=null?u:!0,{searchParams:s,body:o}=r?xn(t,n):n,a=new URL(this.baseUrl),p=t.pathname;if("params"in n&&n.params)for(let[y,d]of Object.entries(n.params))p=p.replace(`:${y}`,String(d));return a.pathname=p,t.schema.searchParams&&(a.search=_n(s)),[a.toString(),O({method:t.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(t,n){return F(this,null,function*(){var a;let r=yield Be(n.response);if(ze(r,n.response.status),!((a=n.validateOut)!=null?a:!0))return r;let o=dt(t.schema.response,r,"response");if(!o.success)throw new Z(o.issues,o.source);return o.output})}request(t,n){return F(this,null,function*(){try{let r=this.getFetchParams(t,n),s=yield fetch(...r);return yield this.parseResponse(t,{response:s,validateOut:n.validateOut})}catch(r){throw r instanceof Z?this.logger.error(r.message,r.issues):this.logger.error(r),r}})}};function ee(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function xn(e,t){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=We(e.schema.searchParams,"searchParams"in t?t.searchParams:{})),e.schema.body&&(n.body=We(e.schema.body,"body"in t?t.body:{})),n}var U,ht={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function vt(e){var t,n,r;return!e&&!U?ht:{lang:(t=e==null?void 0:e.lang)!=null?t:U==null?void 0:U.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:U==null?void 0:U.abortEarly,abortPipeEarly:(r=e==null?void 0:e.abortPipeEarly)!=null?r:U==null?void 0:U.abortPipeEarly}}var He;function gt(e){return He==null?void 0:He.get(e)}var Xe;function bt(e){return Xe==null?void 0:Xe.get(e)}var $e;function kt(e,t){var n;return(n=$e==null?void 0:$e.get(e))==null?void 0:n.get(t)}function ne(e){var n,r,s;let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(s=e&&((r=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:r.name))!=null?s:"null":t}function I(e,t,n,r,s){var f,S,c,k,j,x,D,g;let o=s&&"input"in s?s.input:n.value,a=(S=(f=s==null?void 0:s.expected)!=null?f:e.expects)!=null?S:null,p=(c=s==null?void 0:s.received)!=null?c:ne(o),u={kind:e.kind,type:e.type,input:o,expected:a,received:p,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${p}`,requirement:e.requirement,path:s==null?void 0:s.path,issues:s==null?void 0:s.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},y=e.kind==="schema",d=(g=(D=(x=(j=(k=s==null?void 0:s.message)!=null?k:e.message)!=null?j:kt(e.reference,u.lang))!=null?x:y?bt(u.lang):null)!=null?D:r.message)!=null?g:gt(u.lang);d!==void 0&&(u.message=typeof d=="function"?d(u):d),y&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}var En=new WeakMap;function C(e){let t=En.get(e);return t||(t={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},vt())}},En.set(e,t)),t}function _t(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function Ye(e,t){var r;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:(r=n[0])!=null?r:"never"}var xt=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,jr=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function Ze(e,t){return{kind:"validation",type:"check",reference:Ze,async:!1,expects:null,requirement:e,message:t,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&I(this,"input",n,r),n}}}function Qe(e){return{kind:"validation",type:"email",reference:Qe,expects:null,async:!1,requirement:xt,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&I(this,"email",t,n),t}}}function se(e){return{kind:"validation",type:"integer",reference:se,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&I(this,"integer",t,n),t}}}function Se(e,t){return{kind:"validation",type:"max_length",reference:Se,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length>this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function en(e,t){return{kind:"validation",type:"max_value",reference:en,async:!1,expects:`<=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value<=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function N(e,t){return{kind:"validation",type:"min_length",reference:N,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length<this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function oe(e,t){return{kind:"validation",type:"min_value",reference:oe,async:!1,expects:`>=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value>=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function Ae(e){return{kind:"transformation",type:"transform",reference:Ae,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function Ie(){return{kind:"transformation",type:"trim",reference:Ie,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}var Et={abortEarly:!0};function wt(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function Te(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function L(e,t){return{kind:"schema",type:"array",reference:L,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let a=0;a<s.length;a++){let p=s[a],u=this.item["~run"]({value:p},r);if(u.issues){let y={type:"array",origin:"value",input:s,key:a,value:p};for(let d of u.issues)d.path?d.path.unshift(y):d.path=[y],(o=n.issues)==null||o.push(d);if(n.issues||(n.issues=u.issues),r.abortEarly){n.typed=!1;break}}u.typed||(n.typed=!1),n.value.push(u.value)}}else I(this,"type",n,r);return n}}}function de(e){return{kind:"schema",type:"boolean",reference:de,expects:"boolean",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:I(this,"type",t,n),t}}}function _(e,t){return{kind:"schema",type:"literal",reference:_,expects:ne(e),async:!1,literal:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===this.literal?n.typed=!0:I(this,"type",n,r),n}}}function m(e,t){return{kind:"schema",type:"nullable",reference:m,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===null&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function h(e,t){return{kind:"schema",type:"nullish",reference:h,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function b(e){return{kind:"schema",type:"number",reference:b,expects:"number",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:I(this,"type",t,n),t}}}function l(e,t){return{kind:"schema",type:"object",reference:l,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let a in this.entries){let p=this.entries[a];if(a in s||(p.type==="exact_optional"||p.type==="optional"||p.type==="nullish")&&p.default!==void 0){let u=a in s?s[a]:Te(p),y=p["~run"]({value:u},r);if(y.issues){let d={type:"object",origin:"value",input:s,key:a,value:u};for(let f of y.issues)f.path?f.path.unshift(d):f.path=[d],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=y.issues),r.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value[a]=y.value}else if(p.fallback!==void 0)n.value[a]=wt(p);else if(p.type!=="exact_optional"&&p.type!=="optional"&&p.type!=="nullish"&&(I(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:s,key:a,value:s[a]}]}),r.abortEarly))break}}else I(this,"type",n,r);return n}}}function v(e,t){return{kind:"schema",type:"optional",reference:v,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function A(e,t){return{kind:"schema",type:"picklist",reference:A,expects:Ye(e.map(ne),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return this.options.includes(n.value)?n.typed=!0:I(this,"type",n,r),n}}}function V(e,t,n){return{kind:"schema",type:"record",reference:V,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){var a,p;let o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(let u in o)if(_t(o,u)){let y=o[u],d=this.key["~run"]({value:u},s);if(d.issues){let S={type:"object",origin:"key",input:o,key:u,value:y};for(let c of d.issues)c.path=[S],(a=r.issues)==null||a.push(c);if(r.issues||(r.issues=d.issues),s.abortEarly){r.typed=!1;break}}let f=this.value["~run"]({value:y},s);if(f.issues){let S={type:"object",origin:"value",input:o,key:u,value:y};for(let c of f.issues)c.path?c.path.unshift(S):c.path=[S],(p=r.issues)==null||p.push(c);if(r.issues||(r.issues=f.issues),s.abortEarly){r.typed=!1;break}}(!d.typed||!f.typed)&&(r.typed=!1),d.typed&&(r.value[d.value]=f.value)}}else I(this,"type",r,s);return r}}}function i(e){return{kind:"schema",type:"string",reference:i,expects:"string",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:I(this,"type",t,n),t}}}function wn(e){let t;if(e)for(let n of e)if(t)for(let r of n.issues)t.push(r);else t=n.issues;return t}function he(e,t){return{kind:"schema",type:"union",reference:he,expects:Ye(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){let s,o,a;for(let p of this.options){let u=p["~run"]({value:n.value},r);if(u.typed)if(u.issues)o?o.push(u):o=[u];else{s=u;break}else a?a.push(u):a=[u]}if(s)return s;if(o){if(o.length===1)return o[0];I(this,"type",n,r,{issues:wn(o)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];I(this,"type",n,r,{issues:wn(a)})}return n}}}function nn(){return{kind:"schema",type:"unknown",reference:nn,expects:"unknown",async:!1,get"~standard"(){return C(this)},"~run"(e){return e.typed=!0,e}}}function ue(e,t,n){return{kind:"schema",type:"variant",reference:ue,expects:"Object",async:!1,key:e,options:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){let o=r.value;if(o&&typeof o=="object"){let a,p=0,u=this.key,y=[],d=(f,S)=>{for(let c of f.options){if(c.type==="variant")d(c,new Set(S).add(c.key));else{let k=!0,j=0;for(let x of S){let D=c.entries[x];if(x in o?D["~run"]({typed:!1,value:o[x]},Et).issues:D.type!=="exact_optional"&&D.type!=="optional"&&D.type!=="nullish"){k=!1,u!==x&&(p<j||p===j&&x in o&&!(u in o))&&(p=j,u=x,y=[]),u===x&&y.push(c.entries[x].expects);break}j++}if(k){let x=c["~run"]({value:o},s);(!a||!a.typed&&x.typed)&&(a=x)}}if(a&&!a.issues)break}};if(d(this,new Set([this.key])),a)return a;I(this,"type",r,s,{input:o[u],expected:Ye(y,"|"),path:[{type:"object",origin:"value",input:o,key:u,value:o[u]}]})}else I(this,"type",r,s);return r}}}function w(...e){return G(O({},e[0]),{pipe:e,get"~standard"(){return C(this)},"~run"(t,n){for(let r of e)if(r.kind!=="metadata"){if(t.issues&&(r.kind==="schema"||r.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r["~run"](t,n))}return t}})}var St=["agent","sdk","form","integration","migration"],At=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var It=["screening","cv_match","interview","overall"],Tt=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],Pt=["job","company"],Rt=["created_at","updated_at"],jt=["asc","desc"],Dt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Ot=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],Ct=["user","system","automation","integration","candidate"],Pe=A(St),J=A(At),M=w(i(),Ie(),N(1),Se(100)),Re=A(It),Sn=A(Tt),Or=A(Pt),An=A(Rt),In=A(jt),ve=w(i(),Ie(),N(1),Se(100)),je=A(Dt),Tn=A(Ot),Pn=A(Ct);var q=ue("type",[l({type:_("user"),id:w(i(),N(1)),email:w(i(),N(1)),name:w(i(),N(1))}),l({type:_("system"),id:w(i(),N(1)),name:v(i())}),l({type:_("automation"),id:w(i(),N(1)),name:v(i())}),l({type:_("integration"),id:w(i(),N(1)),name:v(i())}),l({type:_("candidate"),id:w(i(),N(1)),email:v(i())})]);var Nt=l({total:b(),page:b(),perPage:b(),lastPage:b()});function De(e){return l({data:L(e),pagination:Nt})}var ge=l({id:i(),email:m(i()),firstName:m(i()),lastName:m(i()),phone:m(i()),source:m(Pe),identifiedAt:m(i()),createdAt:i(),updatedAt:i()});var ae=w(i(),N(1)),Rn=w(b(),se(),oe(1)),X=V(i(),nn());var jn=l({id:i(),applicationId:i(),status:Sn,scheduledAt:m(i()),completedAt:m(i()),meta:m(X),createdAt:i(),updatedAt:i()});var tn=l({score:b(),reason:i(),confidence:b()}),Dn=l({id:i(),candidateId:i(),jobId:b(),stage:M,stageGroup:J,stageEnteredAt:i(),rating:m(b()),disqualifiedAt:m(i()),disqualificationReason:m(ve),disqualificationNote:m(i()),source:je,sourceDetail:m(i()),sessionId:m(b()),externalApplicationId:m(i()),meta:m(X),context:m(X),scoredAt:m(i()),createdAt:i(),updatedAt:i()}),Lt=l({id:i(),applicationId:i(),scoreType:Re,score:m(b()),reason:m(i()),categories:m(V(i(),tn)),scoredBy:m(i()),createdAt:i()}),Oe=l(G(O({},Dn.entries),{candidate:m(ge),score:m(Lt),interview:m(jn)})),Ft=l(G(O({},ge.entries),{applications:L(Dn)})),On=l({id:i(),applicationId:i(),action:Tn,fromStage:m(M),fromStageGroup:m(J),toStage:m(M),toStageGroup:m(J),disqualificationReason:m(ve),disqualificationNote:m(i()),actorId:m(i()),actorType:Pn,actorEmail:m(i()),actorName:m(i()),meta:m(X),schemaVersion:b(),createdAt:i()});var qt=l({anonymousId:ae,email:ae,firstName:h(i()),lastName:h(i()),phone:h(i()),source:h(Pe)}),Mt=l({candidateId:i(),isNew:de()});var Gt=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],Ne=A(Gt),Cn=w(i(),Ae(e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0))),Bt=w(Cn,L(M)),zt=w(Cn,L(J)),Nn=w(i(),Ae(e=>e.split(",").map(t=>Number(t.trim())).filter(t=>Number.isInteger(t)&&t>0))),ni=l({stages:v(Bt),stage_groups:v(zt),job_id:v(i()),job_ids:v(Nn),candidate_id:v(i()),is_disqualified:v(A(["true","false"])),created_from:v(i()),created_to:v(i()),updated_from:v(i()),updated_to:v(i()),entered_stage_from:v(i()),entered_stage_to:v(i()),from:v(i()),to:v(i()),q:v(i()),scored:v(A(["true","false"])),sort:v(An),order:v(In),page:v(i()),per_page:v(i())}),ti=w(l({candidateId:ae,jobId:Rn,meta:h(X),sessionId:h(b()),externalApplicationId:h(i()),context:h(X),source:h(je),sourceDetail:h(i()),stage:h(M),stageGroup:h(J),actor:h(q)}),Ze(e=>e.stage==null==(e.stageGroup==null),"stage and stageGroup must be supplied together")),Ln=l({id:i(),stageGroup:i(),createdAt:i()}),ri=he([l({ok:_(!0),duplicate:_(!1),applicationId:i(),candidateId:i()}),l({ok:_(!0),duplicate:_(!0),existingApplication:Ln})]),Ut=l({isDuplicate:de(),existingApplication:v(Ln)}),ii=l({applicationId:ae,scoreType:Re,score:b(),reason:h(i()),categories:h(V(i(),tn)),scoredBy:h(i()),actor:h(q)}),si=l({scoreId:i()}),oi=De(Oe);var ui=A(["already_in_target_stage","not_in_source_stage","disqualified"]),ai=L(On),Ce=l({stage:h(M),note:h(i())}),Vt=l({stage:h(M),startDate:h(i()),note:h(i())}),Kt=ue("action",[l({action:_("shortlist"),actor:q,meta:h(Ce)}),l({action:_("move_to_interview"),actor:q,meta:h(Ce)}),l({action:_("make_offer"),actor:q,meta:h(Ce)}),l({action:_("hire"),actor:q,meta:h(Vt)}),l({action:_("withdraw"),actor:q,meta:h(Ce)}),l({action:_("move_to_stage"),actor:q,meta:l({stage:M,stageGroup:J,note:h(i())})}),l({action:_("stage_transition"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("disqualify"),actor:q,meta:l({reason:ve,note:h(i())})}),l({action:_("reinstate"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("rate"),actor:q,meta:l({rating:m(w(b(),se(),oe(1),en(5)))})})]),li=l({applicationIds:w(L(i()),N(1)),body:Kt}),Fn=A(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),ci=ue("kind",[l({kind:_("updated"),action:Ne,application:Oe}),l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Fn})]),pi=l({updated:L(l({kind:_("updated"),action:Ne,application:Oe})),skipped:L(l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Fn})),failed:L(l({applicationId:i(),error:i()}))}),te=w(b(),se(),oe(0)),Jt=l({APPLIED:te,SHORTLISTED:te,INTERVIEWED:te,OFFERED:te,HIRED:te,REJECTED:te,WITHDRAWN:te}),fi=l({job_ids:Nn}),yi=l({counts:V(i(),Jt)});var gi=De(ge);var ki=l({avg_score:m(b()),p90_score:m(b()),p85_score:m(b()),p80_score:m(b()),total_scores:b(),total_shortlists:b()});var be=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function rn(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var qn=["DAILY","WEEKLY","MONTHLY"],Wt=V(i(),he([i(),L(i()),l({type:_("provided"),lat:b(),lng:b(),radius:b(),unit:v(A(["miles","km"])),label:v(i())})])),Vi={pathname:"/job/:id",method:"GET",schema:{response:l({id:b(),external_id:h(i()),city:h(i()),town:h(i()),category:h(i())})}};var Ht={pathname:"/search/save",method:"POST",schema:{response:ee(),body:l({contact:l({email:w(v(i()),i(),Qe()),first_name:v(i()),last_name:v(i())}),alerts:w(v(i()),i(),A(qn)),filters:Wt})}};Mn();var Le=new Map,un={get:e=>{var t;if(Le.has(e))return(t=Le.get(e))!=null?t:null;try{return window.sessionStorage.getItem(e)}catch(n){return null}},set:(e,t)=>{try{window.sessionStorage.setItem(e,t),Le.delete(e)}catch(n){Le.set(e,t)}}};var zn=7*24*60*60*1e3,Un=e=>{let t=new Date;return t.setTime(t.getTime()+zn),`${H}=${e};expires=${t.toUTCString()};path=/`},Xt=(e,t)=>{let n=e.get("session_id");if(t||n)return n;let r=un.get(`${H}-session_id`);return typeof r=="string"?r:null},$t=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(hn);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Yt=new RegExp(`(?:^|;\\s*)${H}=([^;]+)`),ke=e=>{var n,r;let t=e?e.headers.get("cookie"):document.cookie;return t&&(r=(n=Yt.exec(t))==null?void 0:n[1])!=null?r:null},Vn=()=>{var e;try{let t=JSON.parse((e=window.localStorage.getItem(H))!=null?e:"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch(t){return null}},Bn=()=>{var e;return(e=ke())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:Vn()},Zt=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",Kn=e=>{if(document.cookie=Un(e)+Zt(),ke()!==e)try{window.localStorage.setItem(H,JSON.stringify({id:e,expires:Date.now()+zn}))}catch(t){}},an=e=>{var r,s,o;let t=e?e.url:location.href,{searchParams:n}=new URL(t);return{anonymous_id:e?(r=ke(e))!=null?r:n.get("anonymous_id"):(o=(s=ke())!=null?s:n.get("anonymous_id"))!=null?o:Vn(),session_id:Xt(n,typeof window=="undefined")}},Gn=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=an().anonymous_id;if(e)return e;let t=be(),n=an().anonymous_id;return n||(Kn(t),t)},Qt=e=>typeof e!="object"||e===null?null:{anonymous_id:"anonymous_id"in e&&typeof e.anonymous_id=="string"?e.anonymous_id:null,session_id:"session_id"in e&&typeof e.session_id=="string"?e.session_id:null},er=e=>e==="about:client"?"":e,nr={pathname:"/log",method:"POST",schema:{response:ee(),body:ee()}},Jn=({rpcClient:e,logger:t,onEvent:n,persistence:r="device",siteKind:s})=>{let o=null,a=null,p=0,u=0,y=c=>r==="none"?{anonymous_id:null,session_id:c?null:o}:an(c),d=(c,k,j)=>F(void 0,null,function*(){try{let x={library:{name:"inploi-sdk",version:dn},page:k},D=y(c.request),g=r==="none"?null:$t(),T={anonymous_id:D.anonymous_id,session_id:D.session_id,candidate_id:g,event:c.event,sent_at:new Date().toISOString(),context:x,properties:c.properties,custom_properties:O(O({},c.customProperties),j)},$=r==="none"?null:c.request?ke(c.request):Bn(),le=++p,ce=yield e.request(nr,O({body:T},c.keepalive&&{keepalive:!0})),E=Qt(ce);if(r==="none")return!c.request&&(E!=null&&E.session_id)&&le>u&&(u=le,E.session_id!==T.session_id&&(o=E.session_id)),T.session_id=c.request?(E==null?void 0:E.session_id)||null:o,n==null||n(T),{success:!0,data:T};let Y=c.request?$:Bn(),re=Y!==null&&Y!==$,P=Y!=null?Y:$,W=!re&&(!P||!(E!=null&&E.anonymous_id)||P===E.anonymous_id);return W?(E!=null&&E.anonymous_id&&(T.anonymous_id=E.anonymous_id),E!=null&&E.session_id&&(T.session_id=E.session_id)):T.anonymous_id=P,!c.request&&typeof window!="undefined"&&T.anonymous_id&&(W&&T.session_id&&un.set(`${H}-session_id`,T.session_id.toString()),Kn(T.anonymous_id)),n==null||n(T),{success:!0,data:T}}catch(x){return t.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:x}}}),f=Promise.resolve();return{log:c=>F(void 0,null,function*(){qe(c.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let k="request"in c&&c.request?{href:c.request.url,referrer:er(c.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};r==="none"&&c.event==="FLOW_NODE"&&c.properties&&"trigger"in c.properties&&(c.properties.trigger==="pagehide"||c.properties.trigger==="hidden")&&(c=G(O({},c),{keepalive:!0}));let j={event_id:be(),consent_lane:r,site_kind:s};if(r==="device"||c.request||o||c.keepalive)return d(c,k,j);let x=()=>d(c,k,j),D=f.then(x,x);return f=D,D}),getHeaders:c=>{let k=new Headers;return r==="none"||!(c!=null&&c.anonymous_id)||k.append("Set-Cookie",Un(c.anonymous_id)),k},getSessionInfo:y,getOrCreateAnonymousId:()=>r==="none"?a!=null?a:a=be():Gn()}};function on({publishableKey:e,env:t,logger:n=Me,onEvent:r,persistence:s,siteKind:o}){let a=yn({baseUrl:we[t],publishableKey:e}),p=n===!1?Ge:n,u=new me({environment:t,apiKey:{type:"publishable",key:e},logger:p}),y=Jn({rpcClient:u,logger:p,onEvent:r,persistence:s,siteKind:o});return{register:f=>f({logger:p,apiClient:a,analytics:y,rpcClient:u,publishableKey:e,env:t}),analytics:y,apiClient:a}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=on;window.inploi.ready=rn;})();
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ot=Object.create;var X=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var jt=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var Bt=(t,n)=>()=>(t&&(n=t(t=0)),n);var Ue=(t,n)=>{for(var r in n)X(t,r,{get:n[r],enumerable:!0})},qe=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of Nt(n))!Ft.call(t,c)&&c!==r&&X(t,c,{get:()=>n[c],enumerable:!(o=Dt(n,c))||o.enumerable});return t};var A=(t,n,r)=>(r=t!=null?Ot(jt(t)):{},qe(n||!t||!t.__esModule?X(r,"default",{value:t,enumerable:!0}):r,t)),Ut=t=>qe(X({},"__esModule",{value:!0}),t);var kt={};Ue(kt,{jobCountryCodes:()=>Oe});var wt,_n,q,Tn,An,Oe,De=Bt(()=>{"use strict";wt={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"gb",lincolnshire:"gb",surrey:"gb","republic of ireland":"ie",eire:"ie","hong kong sar":"hk","united states of america":"us",turkey:"tr","czech republic":"cz",burma:"mm",kosovo:"xk",xk:"xk"},_n=`adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel
|
|
2
2
|
bfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod
|
|
3
3
|
cfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma
|
|
4
4
|
dodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf
|
|
@@ -10,5 +10,5 @@ ncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan pe
|
|
|
10
10
|
pnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn
|
|
11
11
|
sjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl
|
|
12
12
|
tltls tmtkm tntun toton trtur tttto tvtuv twtwn tztza uaukr uguga umumi ususa uyury uzuzb vavat vcvct veven vgvgb vivir
|
|
13
|
-
vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,Sn=()=>{if(q)return q;q=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of bn.split(/\s+/)){let r=n.slice(0,2),o=t.of(r.toUpperCase());o&&q.set(o.toLowerCase(),r),q.set(r,r),q.set(n.slice(2),r)}return q},_n=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(Et,n))return Et[n];let r=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return Sn().get(r)},Ce=t=>[...new Set(t.flatMap(r=>_n(r)??[]))].sort()});var An={};Fe(An,{ANALYTICS_EVENTS:()=>nt,ApiError:()=>F,InploiRpcClient:()=>W,JOB_ALERT_FREQUENCIES:()=>Pe,NotFoundError:()=>N,ParsingError:()=>B,SchemaValidationError:()=>k,SdkError:()=>Ae,UnauthorisedError:()=>j,addressSearchCountry:()=>wt,blendAddressSuggestions:()=>De,consentStorageKey:()=>se,createPlugin:()=>Ue,createTalentBankClient:()=>_t,endpoint:()=>H,generateUUID:()=>K,getConsentAcceptance:()=>rt,getJobCountries:()=>Oe,getOrCreateAnonymousId:()=>xe,hashConsentConfig:()=>ie,initialiseSdk:()=>tt,inploiBrandedLogger:()=>ne,isApiErrorWithData:()=>qe,isSdkError:()=>Ge,jobCountryCodes:()=>Ce,noLogging:()=>re,ready:()=>Tt,saveClosedRoleJobAlerts:()=>At,saveSearchEndpoint:()=>Re,searchAddressSuggestions:()=>kt,setConsentAcceptance:()=>ot,typed:()=>C,validateEndpointInputs:()=>ke});module.exports=Ft(An);var ee="%c[inploi SDK]",te="color: #65BC67; font-weight: bold;",ne={warn:(...t)=>console.warn(ee,te,...t),error:(...t)=>console.error(ee,te,...t),info:(...t)=>console.info(ee,te,...t),log:(...t)=>console.log(ee,te,...t)},re={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Ue=t=>t;function Se(t,n){if(!t)throw new Error(n)}function V(t,n){return n in t}var On=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Bt="Unauthenticated",Ut="This action is unauthorized.",D=class extends Error{constructor(r,o){super(r);this.status=o,this.name="ErrorWithStatus"}},N=class extends D{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},j=class extends D{constructor(n,r){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=r??401}},k=class extends D{constructor(r,o){let c=o?` in ${o}`:"";super(`Schema validation failed${c}`);this.issues=r;this.source=o;this.name="SchemaValidationError",this.status=400}},F=class extends D{constructor(r,o,c){super(r);this.data=c;this.name="ApiError",this.status=o??500}},qe=t=>t instanceof F&&t.data!==void 0,B=class extends D{constructor(r){super("Error parsing response into JSON.");this.response=r;this.name="ParsingError",this.status=r&&r.status>=300?r.status:500,this.contentType=new Headers(r?.headers).get("content-type")??void 0}};async function _e(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 qt=["message","error","errors","exception","exceptions"];function Mt(t){let n=[];if(typeof t=="object"&&t!==null){for(let r of qt)if(V(t,r)){let o=t[r];typeof o=="string"&&n.push(o),Array.isArray(o)&&o.every(c=>typeof c=="string")&&n.push(...o)}V(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&V(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&V(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&n.push(t.integration_response.error.message)}return n.length===0&&n.push("Unknown error"),[...new Set(n)].join(", ")}function Te(t,n){if(n>=300){let r=Mt(t);throw n===404?new N(r):r===Bt?new j("You are not authenticated.",n):r===Ut?new j(r,n):new F(r,n,t)}}var Me=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(r,o={})=>{let c={...o,headers:{...o.headers,...n}},l=await fetch(`${t.baseUrl}${r}`,c);if(l.status===404)throw new N;let d=await _e(l);return Te(d,l.status),d}}},Ae={NotFound:N,Unauthorised:j,SchemaValidation:k,Api:F,JsonParsing:B};function Ge(t){return Object.values(Ae).some(n=>t instanceof n)}var Ve="3.0.0";var oe={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},Ke={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},We=Ve;var R="isdk_session",$e=`${R}-candidate_id`,Je=`${R}-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 He=7*24*60*60*1e3,Ye=t=>{let n=new Date;return n.setTime(n.getTime()+He),`${R}=${t};expires=${n.toUTCString()};path=/`},Vt=(t,n)=>{let r=t.get("session_id");if(n||r)return r;let o=sessionStorage.getItem(`${R}-session_id`);return typeof o=="string"?o:null},Kt=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem($e);return typeof t=="string"&&t!==""?t:null}catch{return null}},Wt=new RegExp(`(?:^|;\\s*)${R}=([^;]+)`),z=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?Wt.exec(n)?.[1]??null:null},Qe=()=>{try{let t=JSON.parse(window.localStorage.getItem(R)??"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch{return null}},ze=()=>z()??(new URL(location.href).searchParams.get("anonymous_id")?null:Qe()),$t=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",Ze=t=>{if(document.cookie=Ye(t)+$t(),z()!==t)try{window.localStorage.setItem(R,JSON.stringify({id:t,expires:Date.now()+He}))}catch{}},Ee=t=>{let n=t?t.url:location.href,{searchParams:r}=new URL(n);return{anonymous_id:t?z(t)??r.get("anonymous_id"):z()??r.get("anonymous_id")??Qe(),session_id:Vt(r,typeof window>"u")}},xe=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Ee().anonymous_id;if(t)return t;let n=K(),r=Ee().anonymous_id;return r||(Ze(n),n)},Jt=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},zt=t=>t==="about:client"?"":t,Ht={pathname:"/log",method:"POST",schema:{response:C(),body:C()}},Xe=({rpcClient:t,logger:n,onEvent:r,persistence:o="device",siteKind:c})=>{let l=null,d=null,u=0,f=0,x=p=>o==="none"?{anonymous_id:null,session_id:p?null:l}:Ee(p),M=async(p,v,Z)=>{try{let G={library:{name:"inploi-sdk",version:We},page:v},J=x(p.request),It=o==="none"?null:Kt(),y={anonymous_id:J.anonymous_id,session_id:J.session_id,candidate_id:It,event:p.event,sent_at:new Date().toISOString(),context:G,properties:p.properties,custom_properties:{...p.customProperties,...Z}},he=o==="none"?null:p.request?z(p.request):ze(),Ne=++u,Pt=await t.request(Ht,{body:y,...p.keepalive&&{keepalive:!0}}),w=Jt(Pt);if(o==="none")return!p.request&&w?.session_id&&Ne>f&&(f=Ne,w.session_id!==y.session_id&&(l=w.session_id)),y.session_id=p.request?w?.session_id||null:l,r?.(y),{success:!0,data:y};let ye=p.request?he:ze(),Rt=ye!==null&&ye!==he,be=ye??he,je=!Rt&&(!be||!w?.anonymous_id||be===w.anonymous_id);return je?(w?.anonymous_id&&(y.anonymous_id=w.anonymous_id),w?.session_id&&(y.session_id=w.session_id)):y.anonymous_id=be,!p.request&&typeof window<"u"&&y.anonymous_id&&(je&&y.session_id&&sessionStorage.setItem(`${R}-session_id`,y.session_id.toString()),Ze(y.anonymous_id)),r?.(y),{success:!0,data:y}}catch(G){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:G}}},O=Promise.resolve();return{log:async p=>{Se(p.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let v="request"in p&&p.request?{href:p.request.url,referrer:zt(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};o==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p={...p,keepalive:!0});let Z={event_id:K(),consent_lane:o,site_kind:c};if(o==="device"||p.request||l||p.keepalive)return M(p,v,Z);let G=()=>M(p,v,Z),J=O.then(G,G);return O=J,J},getHeaders:p=>{let v=new Headers;return o==="none"||!p?.anonymous_id||v.append("Set-Cookie",Ye(p.anonymous_id)),v},getSessionInfo:x,getOrCreateAnonymousId:()=>o==="none"?d??(d=K()):xe()}};var et=require("neoqs");function we(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 Yt(t,n,r){try{return{success:!0,output:we(t,n,r)}}catch(o){if(o instanceof k)return{success:!1,issues:o.issues,source:o.source};throw o}}var W=class{constructor(n){if(this.baseUrl=oe[n.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),n.apiKey.type==="secret"){if(typeof window<"u")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",n.apiKey.key)}else this.headers.set("x-publishable-key",n.apiKey.key);this.logger=n.logger,this._environment=n.environment}get environment(){return this._environment}getFetchParams(n,r){let o=r.validateIn??!0,{searchParams:c,body:l}=o?ke(n,r):r,d=new URL(this.baseUrl),u=n.pathname;if("params"in r&&r.params)for(let[f,x]of Object.entries(r.params))u=u.replace(`:${f}`,String(x));return d.pathname=u,n.schema.searchParams&&(d.search=(0,et.stringify)(c)),[d.toString(),{method:n.method,body:l?JSON.stringify(l):void 0,headers:this.headers,signal:r.signal,...r.keepalive&&{keepalive:!0}}]}async parseResponse(n,r){let o=await _e(r.response);if(Te(o,r.response.status),!(r.validateOut??!0))return o;let l=Yt(n.schema.response,o,"response");if(!l.success)throw new k(l.issues,l.source);return l.output}async request(n,r){try{let o=this.getFetchParams(n,r),c=await fetch(...o);return await this.parseResponse(n,{response:c,validateOut:r.validateOut})}catch(o){throw o instanceof k?this.logger.error(o.message,o.issues):this.logger.error(o),o}}};function C(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function H(t){return t}function ke(t,n){let r={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(r.searchParams=we(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(r.body=we(t.schema.body,"body"in n?n.body:{})),r}function tt({publishableKey:t,env:n,logger:r=ne,onEvent:o,persistence:c,siteKind:l}){let d=Me({baseUrl:oe[n],publishableKey:t}),u=r===!1?re:r,f=new W({environment:n,apiKey:{type:"publishable",key:t},logger:u}),x=Xe({rpcClient:f,logger:u,onEvent:o,persistence:c,siteKind:l});return{register:O=>O({logger:u,apiClient:d,analytics:x,rpcClient:f,publishableKey:t,env:n}),analytics:x,apiClient:d}}var nt={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function ie(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 se(t,n){return`${Je}:${t}:${n}`}function rt(t,n){if(typeof window>"u")return!1;try{let r=se(t,ie(n));return window.localStorage.getItem(r)==="accepted"}catch{return!1}}function ot(t,n){if(!(typeof window>"u"))try{let r=se(t,ie(n));window.localStorage.setItem(r,"accepted")}catch{}}var s=A(require("valibot"),1),Qt=["agent","sdk","form","integration","migration"],Zt=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var Xt=["screening","cv_match","interview","overall"],en=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],tn=["job","company"],nn=["created_at","updated_at"],rn=["asc","desc"],on=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],sn=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],an=["user","system","automation","integration","candidate"],ae=s.picklist(Qt),I=s.picklist(Zt),E=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),ce=s.picklist(Xt),it=s.picklist(en),pr=s.picklist(tn),st=s.picklist(nn),at=s.picklist(rn),Y=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),le=s.picklist(on),ct=s.picklist(sn),lt=s.picklist(an);var S=s.variant("type",[s.object({type:s.literal("user"),id:s.pipe(s.string(),s.minLength(1)),email:s.pipe(s.string(),s.minLength(1)),name:s.pipe(s.string(),s.minLength(1))}),s.object({type:s.literal("system"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("automation"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("integration"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("candidate"),id:s.pipe(s.string(),s.minLength(1)),email:s.optional(s.string())})]);var P=A(require("valibot"),1),cn=P.object({total:P.number(),page:P.number(),perPage:P.number(),lastPage:P.number()});function pe(t){return P.object({data:P.array(t),pagination:cn})}var m=A(require("valibot"),1);var Q=m.object({id:m.string(),email:m.nullable(m.string()),firstName:m.nullable(m.string()),lastName:m.nullable(m.string()),phone:m.nullable(m.string()),source:m.nullable(ae),identifiedAt:m.nullable(m.string()),createdAt:m.string(),updatedAt:m.string()});var i=A(require("valibot"),1);var g=A(require("valibot"),1),$=g.pipe(g.string(),g.minLength(1)),pt=g.pipe(g.number(),g.integer(),g.minValue(1)),L=g.record(g.string(),g.unknown());var _=A(require("valibot"),1);var dt=_.object({id:_.string(),applicationId:_.string(),status:it,scheduledAt:_.nullable(_.string()),completedAt:_.nullable(_.string()),meta:_.nullable(L),createdAt:_.string(),updatedAt:_.string()});var Ie=i.object({score:i.number(),reason:i.string(),confidence:i.number()}),ut=i.object({id:i.string(),candidateId:i.string(),jobId:i.number(),stage:E,stageGroup:I,stageEnteredAt:i.string(),rating:i.nullable(i.number()),disqualifiedAt:i.nullable(i.string()),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),source:le,sourceDetail:i.nullable(i.string()),sessionId:i.nullable(i.number()),externalApplicationId:i.nullable(i.string()),meta:i.nullable(L),context:i.nullable(L),scoredAt:i.nullable(i.string()),createdAt:i.string(),updatedAt:i.string()}),ln=i.object({id:i.string(),applicationId:i.string(),scoreType:ce,score:i.nullable(i.number()),reason:i.nullable(i.string()),categories:i.nullable(i.record(i.string(),Ie)),scoredBy:i.nullable(i.string()),createdAt:i.string()}),de=i.object({...ut.entries,candidate:i.nullable(Q),score:i.nullable(ln),interview:i.nullable(dt)}),pn=i.object({...Q.entries,applications:i.array(ut)}),mt=i.object({id:i.string(),applicationId:i.string(),action:ct,fromStage:i.nullable(E),fromStageGroup:i.nullable(I),toStage:i.nullable(E),toStageGroup:i.nullable(I),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),actorId:i.nullable(i.string()),actorType:lt,actorEmail:i.nullable(i.string()),actorName:i.nullable(i.string()),meta:i.nullable(L),schemaVersion:i.number(),createdAt:i.string()});var h=A(require("valibot"),1);var gt=h.object({anonymousId:$,email:$,firstName:h.nullish(h.string()),lastName:h.nullish(h.string()),phone:h.nullish(h.string()),source:h.nullish(ae)}),vt=h.object({candidateId:h.string(),isNew:h.boolean()});var e=A(require("valibot"),1);var dn=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],me=e.picklist(dn),ft=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),un=e.pipe(ft,e.array(E)),mn=e.pipe(ft,e.array(I)),ht=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),Cr=e.object({stages:e.optional(un),stage_groups:e.optional(mn),job_id:e.optional(e.string()),job_ids:e.optional(ht),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(st),order:e.optional(at),page:e.optional(e.string()),per_page:e.optional(e.string())}),Lr=e.pipe(e.object({candidateId:$,jobId:pt,meta:e.nullish(L),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),context:e.nullish(L),source:e.nullish(le),sourceDetail:e.nullish(e.string()),stage:e.nullish(E),stageGroup:e.nullish(I),actor:e.nullish(S)}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together")),yt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),Or=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:yt})]),bt=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(yt)}),Dr=e.object({applicationId:$,scoreType:ce,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Ie)),scoredBy:e.nullish(e.string()),actor:e.nullish(S)}),Nr=e.object({scoreId:e.string()}),jr=pe(de);var Fr=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),Br=e.array(mt),ue=e.object({stage:e.nullish(E),note:e.nullish(e.string())}),gn=e.object({stage:e.nullish(E),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),vn=e.variant("action",[e.object({action:e.literal("shortlist"),actor:S,meta:e.nullish(ue)}),e.object({action:e.literal("move_to_interview"),actor:S,meta:e.nullish(ue)}),e.object({action:e.literal("make_offer"),actor:S,meta:e.nullish(ue)}),e.object({action:e.literal("hire"),actor:S,meta:e.nullish(gn)}),e.object({action:e.literal("withdraw"),actor:S,meta:e.nullish(ue)}),e.object({action:e.literal("move_to_stage"),actor:S,meta:e.object({stage:E,stageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:S,meta:e.object({toStage:E,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:S,meta:e.object({reason:Y,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:S,meta:e.object({toStage:E,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:S,meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),Ur=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:vn}),St=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),qr=e.variant("kind",[e.object({kind:e.literal("updated"),action:me,application:de}),e.object({kind:e.literal("skipped"),action:me,applicationId:e.string(),reason:St})]),Mr=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:me,application:de})),skipped:e.array(e.object({kind:e.literal("skipped"),action:me,applicationId:e.string(),reason:St})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),U=e.pipe(e.number(),e.integer(),e.minValue(0)),fn=e.object({APPLIED:U,SHORTLISTED:U,INTERVIEWED:U,OFFERED:U,HIRED:U,REJECTED:U,WITHDRAWN:U}),Gr=e.object({job_ids:ht}),Vr=e.object({counts:e.record(e.string(),fn)});var zr=pe(Q);var b=A(require("valibot"),1),Yr=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 ge=A(require("valibot"));var _t=({environment:t,publishableKey:n,logger:r})=>{let o=Ke[t];return{async checkDuplicate(c){try{let l=new URLSearchParams({email:c.email,scope:c.scope});c.scope==="job"&&c.jobId!=null&&l.set("job_id",String(c.jobId));let d=await fetch(`${o}/applications/check-duplicate?${l}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":n}});if(!d.ok)return r.error(`[TalentBankClient] checkDuplicate failed with status ${d.status}`),{isDuplicate:!1};let u=await d.json(),f=ge.safeParse(bt,u);return f.success?f.output:(r.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof u=="object"&&u!=null&&typeof u.isDuplicate=="boolean"?{isDuplicate:u.isDuplicate}:{isDuplicate:!1})}catch(l){return r.error("[TalentBankClient] checkDuplicate failed:",l),{isDuplicate:!1}}},async identify(c){try{if(!c.anonymousId)return r.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let l={email:c.email,firstName:c.firstName,lastName:c.lastName,phone:c.phone,anonymousId:c.anonymousId,source:c.source??"sdk"},d=ge.safeParse(gt,l);if(!d.success)return r.error("[TalentBankClient] identify received invalid input"),null;let u=await fetch(`${o}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(d.output)});if(!u.ok)return r.error(`[TalentBankClient] identify failed with status ${u.status}`),null;let f=ge.safeParse(vt,await u.json());return f.success?f.output:(r.error("[TalentBankClient] identify returned an invalid response"),null)}catch(l){return r.error("[TalentBankClient] identify failed:",l),null}}}};function Tt(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var a=A(require("valibot"));var Pe=["DAILY","WEEKLY","MONTHLY"],hn=a.record(a.string(),a.union([a.string(),a.array(a.string()),a.object({type:a.literal("provided"),lat:a.number(),lng:a.number(),radius:a.number(),unit:a.optional(a.picklist(["miles","km"])),label:a.optional(a.string())})])),yn={pathname:"/job/:id",method:"GET",schema:{response:a.object({id:a.number(),external_id:a.nullish(a.string()),city:a.nullish(a.string()),town:a.nullish(a.string()),category:a.nullish(a.string())})}};async function At(t,{contact:n,job:r}){let o={};if(r){let c=await t.request(yn,{params:{id:r.id}});if((r.id_type==="internal"?String(c.id):c.external_id)!==r.id)throw new Error("Job lookup returned a different role");for(let d of["city","town","category"]){let u=c[d]?.trim();u&&(o[d]=[u])}}await t.request(Re,{body:{contact:n,alerts:"WEEKLY",filters:o}})}var Re={pathname:"/search/save",method:"POST",schema:{response:C(),body:a.object({contact:a.object({email:a.pipe(a.optional(a.string()),a.string(),a.email()),first_name:a.optional(a.string()),last_name:a.optional(a.string())}),alerts:a.pipe(a.optional(a.string()),a.string(),a.picklist(Pe)),filters:hn})}};var T=A(require("valibot"));var Oe=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:T.pipe(T.object({country:T.optional(T.array(T.object({value:T.string()})),[])}),T.transform(({country:r})=>r.map(({value:o})=>o))),searchParams:C()}};return t.request(n,{searchParams:{filters:{country:null}}})},ve=new WeakMap,wt=t=>(ve.has(t)||(ve.set(t,void 0),Oe(t).then(async n=>{let{jobCountryCodes:r}=await Promise.resolve().then(()=>(Le(),xt));ve.set(t,r(n).join(",")||void 0)}).catch(()=>{})),ve.get(t)),De=(t,n)=>{let r=new Set,o=[];for(let c=0;c<Math.max(t.length,n.length);c++)for(let l of[t[c],n[c]]){if(!l)continue;let d=l.mapbox_id||l.full_address||[l.name,l.place_formatted].filter(Boolean).join(", ");if(!r.has(d)&&(r.add(d),o.push(l),o.length===5))return o}return o},Tn=600,kt=async(t,n,r)=>{if(r?.throwIfAborted(),!n){let o=await t();return r?.throwIfAborted(),o}return new Promise((o,c)=>{let l,d,u,f=!1,x=()=>{f=!0,clearTimeout(u),r?.removeEventListener("abort",M)},M=()=>{x(),c(r?.reason)},O=()=>{x(),l?.status==="fulfilled"&&d?.status==="fulfilled"?o(De(l.value,d.value)):l?.status==="fulfilled"?o(l.value):d?.status==="fulfilled"?o(d.value):l?.status==="rejected"&&c(l.reason)},fe=(p,v)=>{f||(p?l=v:d=v,l&&d?O():v.status==="fulfilled"&&v.value.length>0&&(u=setTimeout(O,Tn)))};r?.addEventListener("abort",M,{once:!0});for(let p of[!0,!1])t(p?n:void 0).then(v=>fe(p,{status:"fulfilled",value:v}),v=>fe(p,{status:"rejected",reason:v}))})};Le();0&&(module.exports={ANALYTICS_EVENTS,ApiError,InploiRpcClient,JOB_ALERT_FREQUENCIES,NotFoundError,ParsingError,SchemaValidationError,SdkError,UnauthorisedError,addressSearchCountry,blendAddressSuggestions,consentStorageKey,createPlugin,createTalentBankClient,endpoint,generateUUID,getConsentAcceptance,getJobCountries,getOrCreateAnonymousId,hashConsentConfig,initialiseSdk,inploiBrandedLogger,isApiErrorWithData,isSdkError,jobCountryCodes,noLogging,ready,saveClosedRoleJobAlerts,saveSearchEndpoint,searchAddressSuggestions,setConsentAcceptance,typed,validateEndpointInputs});
|
|
13
|
+
vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,Tn=()=>{if(q)return q;q=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of _n.split(/\s+/)){let r=n.slice(0,2),o=t.of(r.toUpperCase());o&&q.set(o.toLowerCase(),r),q.set(r,r),q.set(n.slice(2),r)}return q},An=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(wt,n))return wt[n];let r=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return Tn().get(r)},Oe=t=>[...new Set(t.flatMap(r=>An(r)??[]))].sort()});var xn={};Ue(xn,{ANALYTICS_EVENTS:()=>ot,ApiError:()=>F,InploiRpcClient:()=>W,JOB_ALERT_FREQUENCIES:()=>Ce,NotFoundError:()=>N,ParsingError:()=>B,SchemaValidationError:()=>k,SdkError:()=>Ee,UnauthorisedError:()=>j,addressSearchCountry:()=>It,blendAddressSuggestions:()=>je,consentStorageKey:()=>ae,createPlugin:()=>Me,createTalentBankClient:()=>At,endpoint:()=>H,generateUUID:()=>K,getConsentAcceptance:()=>it,getJobCountries:()=>Ne,getOrCreateAnonymousId:()=>ke,hashConsentConfig:()=>se,initialiseSdk:()=>rt,inploiBrandedLogger:()=>ne,isApiErrorWithData:()=>Ge,isSdkError:()=>Ke,jobCountryCodes:()=>Oe,noLogging:()=>re,ready:()=>Et,saveClosedRoleJobAlerts:()=>xt,saveSearchEndpoint:()=>Le,searchAddressSuggestions:()=>Pt,setConsentAcceptance:()=>st,typed:()=>C,validateEndpointInputs:()=>Pe});module.exports=Ut(xn);var ee="%c[inploi SDK]",te="color: #65BC67; font-weight: bold;",ne={warn:(...t)=>console.warn(ee,te,...t),error:(...t)=>console.error(ee,te,...t),info:(...t)=>console.info(ee,te,...t),log:(...t)=>console.log(ee,te,...t)},re={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Me=t=>t;function _e(t,n){if(!t)throw new Error(n)}function V(t,n){return n in t}var Nn=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var qt="Unauthenticated",Mt="This action is unauthorized.",D=class extends Error{constructor(r,o){super(r);this.status=o,this.name="ErrorWithStatus"}},N=class extends D{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},j=class extends D{constructor(n,r){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=r??401}},k=class extends D{constructor(r,o){let c=o?` in ${o}`:"";super(`Schema validation failed${c}`);this.issues=r;this.source=o;this.name="SchemaValidationError",this.status=400}},F=class extends D{constructor(r,o,c){super(r);this.data=c;this.name="ApiError",this.status=o??500}},Ge=t=>t instanceof F&&t.data!==void 0,B=class extends D{constructor(r){super("Error parsing response into JSON.");this.response=r;this.name="ParsingError",this.status=r&&r.status>=300?r.status:500,this.contentType=new Headers(r?.headers).get("content-type")??void 0}};async function Te(t){let r=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(r&&r!=="application/json"&&!r.endsWith("+json"))throw new B(t);return t.json().catch(()=>{throw new B(t)})}var Gt=["message","error","errors","exception","exceptions"];function Vt(t){let n=[];if(typeof t=="object"&&t!==null){for(let r of Gt)if(V(t,r)){let o=t[r];typeof o=="string"&&n.push(o),Array.isArray(o)&&o.every(c=>typeof c=="string")&&n.push(...o)}V(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&V(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&V(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&n.push(t.integration_response.error.message)}return n.length===0&&n.push("Unknown error"),[...new Set(n)].join(", ")}function Ae(t,n){if(n>=300){let r=Vt(t);throw n===404?new N(r):r===qt?new j("You are not authenticated.",n):r===Mt?new j(r,n):new F(r,n,t)}}var Ve=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(r,o={})=>{let c={...o,headers:{...o.headers,...n}},l=await fetch(`${t.baseUrl}${r}`,c);if(l.status===404)throw new N;let d=await Te(l);return Ae(d,l.status),d}}},Ee={NotFound:N,Unauthorised:j,SchemaValidation:k,Api:F,JsonParsing:B};function Ke(t){return Object.values(Ee).some(n=>t instanceof n)}var We="3.0.1";var oe={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},$e={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},Je=We;var R="isdk_session",ze=`${R}-candidate_id`,He=`${R}-consent`;var ie=new Map,xe={get:t=>{if(ie.has(t))return ie.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,n)=>{try{window.sessionStorage.setItem(t,n),ie.delete(t)}catch{ie.set(t,n)}}};var K=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16));var Qe=7*24*60*60*1e3,Ze=t=>{let n=new Date;return n.setTime(n.getTime()+Qe),`${R}=${t};expires=${n.toUTCString()};path=/`},Wt=(t,n)=>{let r=t.get("session_id");if(n||r)return r;let o=xe.get(`${R}-session_id`);return typeof o=="string"?o:null},$t=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(ze);return typeof t=="string"&&t!==""?t:null}catch{return null}},Jt=new RegExp(`(?:^|;\\s*)${R}=([^;]+)`),z=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?Jt.exec(n)?.[1]??null:null},Xe=()=>{try{let t=JSON.parse(window.localStorage.getItem(R)??"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch{return null}},Ye=()=>z()??(new URL(location.href).searchParams.get("anonymous_id")?null:Xe()),zt=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",et=t=>{if(document.cookie=Ze(t)+zt(),z()!==t)try{window.localStorage.setItem(R,JSON.stringify({id:t,expires:Date.now()+Qe}))}catch{}},we=t=>{let n=t?t.url:location.href,{searchParams:r}=new URL(n);return{anonymous_id:t?z(t)??r.get("anonymous_id"):z()??r.get("anonymous_id")??Xe(),session_id:Wt(r,typeof window>"u")}},ke=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=we().anonymous_id;if(t)return t;let n=K(),r=we().anonymous_id;return r||(et(n),n)},Ht=t=>typeof t!="object"||t===null?null:{anonymous_id:"anonymous_id"in t&&typeof t.anonymous_id=="string"?t.anonymous_id:null,session_id:"session_id"in t&&typeof t.session_id=="string"?t.session_id:null},Yt=t=>t==="about:client"?"":t,Qt={pathname:"/log",method:"POST",schema:{response:C(),body:C()}},tt=({rpcClient:t,logger:n,onEvent:r,persistence:o="device",siteKind:c})=>{let l=null,d=null,u=0,f=0,x=p=>o==="none"?{anonymous_id:null,session_id:p?null:l}:we(p),M=async(p,v,Z)=>{try{let G={library:{name:"inploi-sdk",version:Je},page:v},J=x(p.request),Rt=o==="none"?null:$t(),y={anonymous_id:J.anonymous_id,session_id:J.session_id,candidate_id:Rt,event:p.event,sent_at:new Date().toISOString(),context:G,properties:p.properties,custom_properties:{...p.customProperties,...Z}},ye=o==="none"?null:p.request?z(p.request):Ye(),Fe=++u,Ct=await t.request(Qt,{body:y,...p.keepalive&&{keepalive:!0}}),w=Ht(Ct);if(o==="none")return!p.request&&w?.session_id&&Fe>f&&(f=Fe,w.session_id!==y.session_id&&(l=w.session_id)),y.session_id=p.request?w?.session_id||null:l,r?.(y),{success:!0,data:y};let be=p.request?ye:Ye(),Lt=be!==null&&be!==ye,Se=be??ye,Be=!Lt&&(!Se||!w?.anonymous_id||Se===w.anonymous_id);return Be?(w?.anonymous_id&&(y.anonymous_id=w.anonymous_id),w?.session_id&&(y.session_id=w.session_id)):y.anonymous_id=Se,!p.request&&typeof window<"u"&&y.anonymous_id&&(Be&&y.session_id&&xe.set(`${R}-session_id`,y.session_id.toString()),et(y.anonymous_id)),r?.(y),{success:!0,data:y}}catch(G){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:G}}},O=Promise.resolve();return{log:async p=>{_e(p.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let v="request"in p&&p.request?{href:p.request.url,referrer:Yt(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};o==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p={...p,keepalive:!0});let Z={event_id:K(),consent_lane:o,site_kind:c};if(o==="device"||p.request||l||p.keepalive)return M(p,v,Z);let G=()=>M(p,v,Z),J=O.then(G,G);return O=J,J},getHeaders:p=>{let v=new Headers;return o==="none"||!p?.anonymous_id||v.append("Set-Cookie",Ze(p.anonymous_id)),v},getSessionInfo:x,getOrCreateAnonymousId:()=>o==="none"?d??(d=K()):ke()}};var nt=require("neoqs");function Ie(t,n,r){let o=t["~standard"].validate(n);if(o instanceof Promise)throw new TypeError("Async schema");if(o.issues)throw new k(o.issues,r);return o.value}function Zt(t,n,r){try{return{success:!0,output:Ie(t,n,r)}}catch(o){if(o instanceof k)return{success:!1,issues:o.issues,source:o.source};throw o}}var W=class{constructor(n){if(this.baseUrl=oe[n.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),n.apiKey.type==="secret"){if(typeof window<"u")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",n.apiKey.key)}else this.headers.set("x-publishable-key",n.apiKey.key);this.logger=n.logger,this._environment=n.environment}get environment(){return this._environment}getFetchParams(n,r){let o=r.validateIn??!0,{searchParams:c,body:l}=o?Pe(n,r):r,d=new URL(this.baseUrl),u=n.pathname;if("params"in r&&r.params)for(let[f,x]of Object.entries(r.params))u=u.replace(`:${f}`,String(x));return d.pathname=u,n.schema.searchParams&&(d.search=(0,nt.stringify)(c)),[d.toString(),{method:n.method,body:l?JSON.stringify(l):void 0,headers:this.headers,signal:r.signal,...r.keepalive&&{keepalive:!0}}]}async parseResponse(n,r){let o=await Te(r.response);if(Ae(o,r.response.status),!(r.validateOut??!0))return o;let l=Zt(n.schema.response,o,"response");if(!l.success)throw new k(l.issues,l.source);return l.output}async request(n,r){try{let o=this.getFetchParams(n,r),c=await fetch(...o);return await this.parseResponse(n,{response:c,validateOut:r.validateOut})}catch(o){throw o instanceof k?this.logger.error(o.message,o.issues):this.logger.error(o),o}}};function C(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function H(t){return t}function Pe(t,n){let r={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(r.searchParams=Ie(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(r.body=Ie(t.schema.body,"body"in n?n.body:{})),r}function rt({publishableKey:t,env:n,logger:r=ne,onEvent:o,persistence:c,siteKind:l}){let d=Ve({baseUrl:oe[n],publishableKey:t}),u=r===!1?re:r,f=new W({environment:n,apiKey:{type:"publishable",key:t},logger:u}),x=tt({rpcClient:f,logger:u,onEvent:o,persistence:c,siteKind:l});return{register:O=>O({logger:u,apiClient:d,analytics:x,rpcClient:f,publishableKey:t,env:n}),analytics:x,apiClient:d}}var ot={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function se(t){let n=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),r=5381;for(let o=0;o<n.length;o++)r=r*33^n.charCodeAt(o);return(r>>>0).toString(36)}function ae(t,n){return`${He}:${t}:${n}`}function it(t,n){if(typeof window>"u")return!1;try{let r=ae(t,se(n));return window.localStorage.getItem(r)==="accepted"}catch{return!1}}function st(t,n){if(!(typeof window>"u"))try{let r=ae(t,se(n));window.localStorage.setItem(r,"accepted")}catch{}}var s=A(require("valibot"),1),Xt=["agent","sdk","form","integration","migration"],en=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var tn=["screening","cv_match","interview","overall"],nn=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],rn=["job","company"],on=["created_at","updated_at"],sn=["asc","desc"],an=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],cn=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],ln=["user","system","automation","integration","candidate"],ce=s.picklist(Xt),I=s.picklist(en),E=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),le=s.picklist(tn),at=s.picklist(nn),gr=s.picklist(rn),ct=s.picklist(on),lt=s.picklist(sn),Y=s.pipe(s.string(),s.trim(),s.minLength(1),s.maxLength(100)),pe=s.picklist(an),pt=s.picklist(cn),dt=s.picklist(ln);var S=s.variant("type",[s.object({type:s.literal("user"),id:s.pipe(s.string(),s.minLength(1)),email:s.pipe(s.string(),s.minLength(1)),name:s.pipe(s.string(),s.minLength(1))}),s.object({type:s.literal("system"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("automation"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("integration"),id:s.pipe(s.string(),s.minLength(1)),name:s.optional(s.string())}),s.object({type:s.literal("candidate"),id:s.pipe(s.string(),s.minLength(1)),email:s.optional(s.string())})]);var P=A(require("valibot"),1),pn=P.object({total:P.number(),page:P.number(),perPage:P.number(),lastPage:P.number()});function de(t){return P.object({data:P.array(t),pagination:pn})}var m=A(require("valibot"),1);var Q=m.object({id:m.string(),email:m.nullable(m.string()),firstName:m.nullable(m.string()),lastName:m.nullable(m.string()),phone:m.nullable(m.string()),source:m.nullable(ce),identifiedAt:m.nullable(m.string()),createdAt:m.string(),updatedAt:m.string()});var i=A(require("valibot"),1);var g=A(require("valibot"),1),$=g.pipe(g.string(),g.minLength(1)),ut=g.pipe(g.number(),g.integer(),g.minValue(1)),L=g.record(g.string(),g.unknown());var _=A(require("valibot"),1);var mt=_.object({id:_.string(),applicationId:_.string(),status:at,scheduledAt:_.nullable(_.string()),completedAt:_.nullable(_.string()),meta:_.nullable(L),createdAt:_.string(),updatedAt:_.string()});var Re=i.object({score:i.number(),reason:i.string(),confidence:i.number()}),gt=i.object({id:i.string(),candidateId:i.string(),jobId:i.number(),stage:E,stageGroup:I,stageEnteredAt:i.string(),rating:i.nullable(i.number()),disqualifiedAt:i.nullable(i.string()),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),source:pe,sourceDetail:i.nullable(i.string()),sessionId:i.nullable(i.number()),externalApplicationId:i.nullable(i.string()),meta:i.nullable(L),context:i.nullable(L),scoredAt:i.nullable(i.string()),createdAt:i.string(),updatedAt:i.string()}),dn=i.object({id:i.string(),applicationId:i.string(),scoreType:le,score:i.nullable(i.number()),reason:i.nullable(i.string()),categories:i.nullable(i.record(i.string(),Re)),scoredBy:i.nullable(i.string()),createdAt:i.string()}),ue=i.object({...gt.entries,candidate:i.nullable(Q),score:i.nullable(dn),interview:i.nullable(mt)}),un=i.object({...Q.entries,applications:i.array(gt)}),vt=i.object({id:i.string(),applicationId:i.string(),action:pt,fromStage:i.nullable(E),fromStageGroup:i.nullable(I),toStage:i.nullable(E),toStageGroup:i.nullable(I),disqualificationReason:i.nullable(Y),disqualificationNote:i.nullable(i.string()),actorId:i.nullable(i.string()),actorType:dt,actorEmail:i.nullable(i.string()),actorName:i.nullable(i.string()),meta:i.nullable(L),schemaVersion:i.number(),createdAt:i.string()});var h=A(require("valibot"),1);var ft=h.object({anonymousId:$,email:$,firstName:h.nullish(h.string()),lastName:h.nullish(h.string()),phone:h.nullish(h.string()),source:h.nullish(ce)}),ht=h.object({candidateId:h.string(),isNew:h.boolean()});var e=A(require("valibot"),1);var mn=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],ge=e.picklist(mn),yt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),gn=e.pipe(yt,e.array(E)),vn=e.pipe(yt,e.array(I)),bt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),Nr=e.object({stages:e.optional(gn),stage_groups:e.optional(vn),job_id:e.optional(e.string()),job_ids:e.optional(bt),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),sort:e.optional(ct),order:e.optional(lt),page:e.optional(e.string()),per_page:e.optional(e.string())}),jr=e.pipe(e.object({candidateId:$,jobId:ut,meta:e.nullish(L),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),context:e.nullish(L),source:e.nullish(pe),sourceDetail:e.nullish(e.string()),stage:e.nullish(E),stageGroup:e.nullish(I),actor:e.nullish(S)}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together")),St=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),Fr=e.union([e.object({ok:e.literal(!0),duplicate:e.literal(!1),applicationId:e.string(),candidateId:e.string()}),e.object({ok:e.literal(!0),duplicate:e.literal(!0),existingApplication:St})]),_t=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(St)}),Br=e.object({applicationId:$,scoreType:le,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Re)),scoredBy:e.nullish(e.string()),actor:e.nullish(S)}),Ur=e.object({scoreId:e.string()}),qr=de(ue);var Mr=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),Gr=e.array(vt),me=e.object({stage:e.nullish(E),note:e.nullish(e.string())}),fn=e.object({stage:e.nullish(E),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),hn=e.variant("action",[e.object({action:e.literal("shortlist"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("move_to_interview"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("make_offer"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("hire"),actor:S,meta:e.nullish(fn)}),e.object({action:e.literal("withdraw"),actor:S,meta:e.nullish(me)}),e.object({action:e.literal("move_to_stage"),actor:S,meta:e.object({stage:E,stageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:S,meta:e.object({toStage:E,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:S,meta:e.object({reason:Y,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:S,meta:e.object({toStage:E,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:S,meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),Vr=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:hn}),Tt=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),Kr=e.variant("kind",[e.object({kind:e.literal("updated"),action:ge,application:ue}),e.object({kind:e.literal("skipped"),action:ge,applicationId:e.string(),reason:Tt})]),Wr=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:ge,application:ue})),skipped:e.array(e.object({kind:e.literal("skipped"),action:ge,applicationId:e.string(),reason:Tt})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),U=e.pipe(e.number(),e.integer(),e.minValue(0)),yn=e.object({APPLIED:U,SHORTLISTED:U,INTERVIEWED:U,OFFERED:U,HIRED:U,REJECTED:U,WITHDRAWN:U}),$r=e.object({job_ids:bt}),Jr=e.object({counts:e.record(e.string(),yn)});var Zr=de(Q);var b=A(require("valibot"),1),eo=b.object({avg_score:b.nullable(b.number()),p90_score:b.nullable(b.number()),p85_score:b.nullable(b.number()),p80_score:b.nullable(b.number()),total_scores:b.number(),total_shortlists:b.number()});var ve=A(require("valibot"));var At=({environment:t,publishableKey:n,logger:r})=>{let o=$e[t];return{async checkDuplicate(c){try{let l=new URLSearchParams({email:c.email,scope:c.scope});c.scope==="job"&&c.jobId!=null&&l.set("job_id",String(c.jobId));let d=await fetch(`${o}/applications/check-duplicate?${l}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":n}});if(!d.ok)return r.error(`[TalentBankClient] checkDuplicate failed with status ${d.status}`),{isDuplicate:!1};let u=await d.json(),f=ve.safeParse(_t,u);return f.success?f.output:(r.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof u=="object"&&u!=null&&typeof u.isDuplicate=="boolean"?{isDuplicate:u.isDuplicate}:{isDuplicate:!1})}catch(l){return r.error("[TalentBankClient] checkDuplicate failed:",l),{isDuplicate:!1}}},async identify(c){try{if(!c.anonymousId)return r.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let l={email:c.email,firstName:c.firstName,lastName:c.lastName,phone:c.phone,anonymousId:c.anonymousId,source:c.source??"sdk"},d=ve.safeParse(ft,l);if(!d.success)return r.error("[TalentBankClient] identify received invalid input"),null;let u=await fetch(`${o}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(d.output)});if(!u.ok)return r.error(`[TalentBankClient] identify failed with status ${u.status}`),null;let f=ve.safeParse(ht,await u.json());return f.success?f.output:(r.error("[TalentBankClient] identify returned an invalid response"),null)}catch(l){return r.error("[TalentBankClient] identify failed:",l),null}}}};function Et(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var a=A(require("valibot"));var Ce=["DAILY","WEEKLY","MONTHLY"],bn=a.record(a.string(),a.union([a.string(),a.array(a.string()),a.object({type:a.literal("provided"),lat:a.number(),lng:a.number(),radius:a.number(),unit:a.optional(a.picklist(["miles","km"])),label:a.optional(a.string())})])),Sn={pathname:"/job/:id",method:"GET",schema:{response:a.object({id:a.number(),external_id:a.nullish(a.string()),city:a.nullish(a.string()),town:a.nullish(a.string()),category:a.nullish(a.string())})}};async function xt(t,{contact:n,job:r}){let o={};if(r){let c=await t.request(Sn,{params:{id:r.id}});if((r.id_type==="internal"?String(c.id):c.external_id)!==r.id)throw new Error("Job lookup returned a different role");for(let d of["city","town","category"]){let u=c[d]?.trim();u&&(o[d]=[u])}}await t.request(Le,{body:{contact:n,alerts:"WEEKLY",filters:o}})}var Le={pathname:"/search/save",method:"POST",schema:{response:C(),body:a.object({contact:a.object({email:a.pipe(a.optional(a.string()),a.string(),a.email()),first_name:a.optional(a.string()),last_name:a.optional(a.string())}),alerts:a.pipe(a.optional(a.string()),a.string(),a.picklist(Ce)),filters:bn})}};var T=A(require("valibot"));var Ne=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:T.pipe(T.object({country:T.optional(T.array(T.object({value:T.string()})),[])}),T.transform(({country:r})=>r.map(({value:o})=>o))),searchParams:C()}};return t.request(n,{searchParams:{filters:{country:null}}})},fe=new WeakMap,It=t=>(fe.has(t)||(fe.set(t,void 0),Ne(t).then(async n=>{let{jobCountryCodes:r}=await Promise.resolve().then(()=>(De(),kt));fe.set(t,r(n).join(",")||void 0)}).catch(()=>{})),fe.get(t)),je=(t,n)=>{let r=new Set,o=[];for(let c=0;c<Math.max(t.length,n.length);c++)for(let l of[t[c],n[c]]){if(!l)continue;let d=l.mapbox_id||l.full_address||[l.name,l.place_formatted].filter(Boolean).join(", ");if(!r.has(d)&&(r.add(d),o.push(l),o.length===5))return o}return o},En=600,Pt=async(t,n,r)=>{if(r?.throwIfAborted(),!n){let o=await t();return r?.throwIfAborted(),o}return new Promise((o,c)=>{let l,d,u,f=!1,x=()=>{f=!0,clearTimeout(u),r?.removeEventListener("abort",M)},M=()=>{x(),c(r?.reason)},O=()=>{x(),l?.status==="fulfilled"&&d?.status==="fulfilled"?o(je(l.value,d.value)):l?.status==="fulfilled"?o(l.value):d?.status==="fulfilled"?o(d.value):l?.status==="rejected"&&c(l.reason)},he=(p,v)=>{f||(p?l=v:d=v,l&&d?O():v.status==="fulfilled"&&v.value.length>0&&(u=setTimeout(O,En)))};r?.addEventListener("abort",M,{once:!0});for(let p of[!0,!1])t(p?n:void 0).then(v=>he(p,{status:"fulfilled",value:v}),v=>he(p,{status:"rejected",reason:v}))})};De();0&&(module.exports={ANALYTICS_EVENTS,ApiError,InploiRpcClient,JOB_ALERT_FREQUENCIES,NotFoundError,ParsingError,SchemaValidationError,SdkError,UnauthorisedError,addressSearchCountry,blendAddressSuggestions,consentStorageKey,createPlugin,createTalentBankClient,endpoint,generateUUID,getConsentAcceptance,getJobCountries,getOrCreateAnonymousId,hashConsentConfig,initialiseSdk,inploiBrandedLogger,isApiErrorWithData,isSdkError,jobCountryCodes,noLogging,ready,saveClosedRoleJobAlerts,saveSearchEndpoint,searchAddressSuggestions,setConsentAcceptance,typed,validateEndpointInputs});
|
|
14
14
|
//# sourceMappingURL=index.js.map
|