@inploi/sdk 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +3 -3
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 on=Object.defineProperty,un=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var Ce=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable;var Ne=(e,r,n)=>r in e?on(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,w=(e,r)=>{for(var n in r||(r={}))ln.call(r,n)&&Ne(e,n,r[n]);if(Ce)for(var n of Ce(r))cn.call(r,n)&&Ne(e,n,r[n]);return e},F=(e,r)=>un(e,an(r));var pn=(e,r)=>()=>(e&&(r=e(e=0)),r);var x=(e,r,n)=>new Promise((t,i)=>{var o=s=>{try{c(n.next(s))}catch(p){i(p)}},u=s=>{try{c(n.throw(s))}catch(p){i(p)}},c=s=>s.done?t(s.value):Promise.resolve(s.value).then(o,u);c((n=n.apply(e,r)).next())});var $e=pn(()=>{"use strict"});function oe(e,r){if(!e)throw new Error(r)}function B(e,r){return r in e}var Qn=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Q="%c[inploi SDK]",ee="color: #65BC67; font-weight: bold;",ue={warn:(...e)=>console.warn(Q,ee,...e),error:(...e)=>console.error(Q,ee,...e),info:(...e)=>console.info(Q,ee,...e),log:(...e)=>console.log(Q,ee,...e)},ae={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var fn="Unauthenticated",yn="This action is unauthorized.",q=class extends Error{constructor(n,t){super(n);this.status=t,this.name="ErrorWithStatus"}},W=class extends q{constructor(r){super(r!=null?r:"Not found"),this.name="NotFoundError",this.status=404}},H=class extends q{constructor(r,n){super(r!=null?r:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},N=class extends q{constructor(n,t){let i=t?` in ${t}`:"";super(`Schema validation failed${i}`);this.issues=n;this.source=t;this.name="SchemaValidationError",this.status=400}},ne=class extends q{constructor(n,t,i){super(n);this.data=i;this.name="ApiError",this.status=t!=null?t:500}};var X=class extends q{constructor(n){var t;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(t=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?t:void 0}};function le(e){return x(this,null,function*(){let r=new Headers(e.headers).get("content-type"),n=r==null?void 0:r.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new X(e);return e.json().catch(()=>{throw new X(e)})})}var dn=["message","error","errors","exception","exceptions"];function hn(e){let r=[];if(typeof e=="object"&&e!==null){for(let n of dn)if(B(e,n)){let t=e[n];typeof t=="string"&&r.push(t),Array.isArray(t)&&t.every(i=>typeof i=="string")&&r.push(...t)}B(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&B(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&B(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&r.push(e.integration_response.error.message)}return r.length===0&&r.push("Unknown error"),[...new Set(r)].join(", ")}function ce(e,r){if(r>=300){let n=hn(e);throw r===404?new W(n):n===fn?new H("You are not authenticated.",r):n===yn?new H(n,r):new ne(n,r,e)}}var Le=e=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(i,...o)=>x(void 0,[i,...o],function*(n,t={}){let u=F(w({},t),{headers:w(w({},t.headers),r)}),c=yield fetch(`${e.baseUrl}${n}`,u);if(c.status===404)throw new W;let s=yield le(c);return ce(s,c.status),s})}};var Fe="3.1.1";var re={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var qe=Fe;var D="isdk_session",Me=`${D}-candidate_id`,vn=`${D}-consent`;var ye="RFC3986",de={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},gn="RFC1738";var bn=Array.isArray,T=(()=>{let e=[];for(let r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e})();var pe=1024,kn=(e,r,n,t,i)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let u="";for(let c=0;c<o.length;c+=pe){let s=o.length>=pe?o.slice(c,c+pe):o,p=[];for(let f=0;f<s.length;++f){let l=s.charCodeAt(f);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===gn&&(l===40||l===41)){p[p.length]=s.charAt(f);continue}if(l<128){p[p.length]=T[l];continue}if(l<2048){p[p.length]=T[192|l>>6]+T[128|l&63];continue}if(l<55296||l>=57344){p[p.length]=T[224|l>>12]+T[128|l>>6&63]+T[128|l&63];continue}f+=1,l=65536+((l&1023)<<10|s.charCodeAt(f)&1023),p[p.length]=T[240|l>>18]+T[128|l>>12&63]+T[128|l>>6&63]+T[128|l&63]}u+=p.join("")}return u};function _n(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function ze(e,r){if(bn(e)){let n=[];for(let t=0;t<e.length;t+=1)n.push(r(e[t]));return n}return r(e)}var yr=Array.isArray;var wn=Object.prototype.hasOwnProperty,Be={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,r){return String(e)+"["+r+"]"},repeat(e){return String(e)}},P=Array.isArray,xn=Array.prototype.push,Ge=function(e,r){xn.apply(e,P(r)?r:[r])},En=Date.prototype.toISOString,b={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:kn,encodeValuesOnly:!1,format:ye,formatter:de[ye],indices:!1,serializeDate(e){return En.call(e)},skipNulls:!1,strictNullHandling:!1};function An(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var fe={};function Ue(e,r,n,t,i,o,u,c,s,p,f,l,v,a,d,E,_,A){let y=e,m=A,R=0,K=!1;for(;(m=m.get(fe))!==void 0&&!K;){let g=m.get(e);if(R+=1,typeof g!="undefined"){if(g===R)throw new RangeError("Cyclic object value");K=!0}typeof m.get(fe)=="undefined"&&(R=0)}if(typeof p=="function"?y=p(r,y):y instanceof Date?y=v==null?void 0:v(y):n==="comma"&&P(y)&&(y=ze(y,function(g){return g instanceof Date?v==null?void 0:v(g):g})),y===null){if(o)return s&&!E?s(r,b.encoder,_,"key",a):r;y=""}if(An(y)||_n(y)){if(s){let g=E?r:s(r,b.encoder,_,"key",a);return[(d==null?void 0:d(g))+"="+(d==null?void 0:d(s(y,b.encoder,_,"value",a)))]}return[(d==null?void 0:d(r))+"="+(d==null?void 0:d(String(y)))]}let J=[];if(typeof y=="undefined")return J;let h;if(n==="comma"&&P(y))E&&s&&(y=ze(y,s)),h=[{value:y.length>0?y.join(",")||null:void 0}];else if(P(p))h=p;else{let g=Object.keys(y);h=f?g.sort(f):g}let C=c?String(r).replace(/\./g,"%2E"):String(r),z=t&&P(y)&&y.length===1?C+"[]":C;if(i&&P(y)&&y.length===0)return z+"[]";for(let g=0;g<h.length;++g){let j=h[g],De=typeof j=="object"&&typeof j.value!="undefined"?j.value:y[j];if(u&&De===null)continue;let se=l&&c?j.replace(/\./g,"%2E"):j,sn=P(y)?typeof n=="function"?n(z,se):z:z+(l?"."+se:"["+se+"]");A.set(e,R);let Re=new WeakMap;Re.set(fe,A),Ge(J,Ue(De,sn,n,t,i,o,u,c,n==="comma"&&E&&P(y)?null:s,p,f,l,v,a,d,E,_,Re))}return J}function Sn(e=b){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let r=e.charset||b.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=ye;if(typeof e.format!="undefined"){if(!wn.call(de,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let t=de[n],i=b.filter;(typeof e.filter=="function"||P(e.filter))&&(i=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in Be?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=b.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let u=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:b.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:b.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:b.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:b.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?b.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:b.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:b.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:b.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:b.encodeValuesOnly,filter:i,format:n,formatter:t,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:b.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:b.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:b.strictNullHandling}}function Ve(e,r={}){let n=e,t=Sn(r),i,o;typeof t.filter=="function"?(o=t.filter,n=o("",n)):P(t.filter)&&(o=t.filter,i=o);let u=[];if(typeof n!="object"||n===null)return"";let c=Be[t.arrayFormat],s=c==="comma"&&t.commaRoundTrip;i||(i=Object.keys(n)),t.sort&&i.sort(t.sort);let p=new WeakMap;for(let v=0;v<i.length;++v){let a=i[v];t.skipNulls&&n[a]===null||Ge(u,Ue(n[a],a,c,s,t.allowEmptyArrays,t.strictNullHandling,t.skipNulls,t.encodeDotInKeys,t.encode?t.encoder:null,t.filter,t.sort,t.allowDots,t.serializeDate,t.format,t.formatter,t.encodeValuesOnly,t.charset,p))}let f=u.join(t.delimiter),l=t.addQueryPrefix===!0?"?":"";return t.charsetSentinel&&(t.charset==="iso-8859-1"?l+="utf8=%26%2310003%3B&":l+="utf8=%E2%9C%93&"),f.length>0?l+f:""}function he(e,r,n){let t=e["~standard"].validate(r);if(t instanceof Promise)throw new TypeError("Async schema");if(t.issues)throw new N(t.issues,n);return t.value}function In(e,r,n){try{return{success:!0,output:he(e,r,n)}}catch(t){if(t instanceof N)return{success:!1,issues:t.issues,source:t.source};throw t}}var $=class{constructor(r){if(this.baseUrl=re[r.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),r.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",r.apiKey.key)}else this.headers.set("x-publishable-key",r.apiKey.key);this.logger=r.logger,this._environment=r.environment}get environment(){return this._environment}getFetchParams(r,n){var s;let t=(s=n.validateIn)!=null?s:!0,{searchParams:i,body:o}=t?Ke(r,n):n,u=new URL(this.baseUrl),c=r.pathname;if("params"in n&&n.params)for(let[p,f]of Object.entries(n.params))c=c.replace(`:${p}`,String(f));return u.pathname=c,r.schema.searchParams&&(u.search=Ve(i)),[u.toString(),w({method:r.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(r,n){return x(this,null,function*(){var u;let t=yield le(n.response);if(ce(t,n.response.status),!((u=n.validateOut)!=null?u:!0))return t;let o=In(r.schema.response,t,"response");if(!o.success)throw new N(o.issues,o.source);return o.output})}request(r,n){return x(this,null,function*(){try{let t=this.getFetchParams(r,n),i=yield fetch(...t);return yield this.parseResponse(r,{response:i,validateOut:n.validateOut})}catch(t){throw t instanceof N?this.logger.error(t.message,t.issues):this.logger.error(t),t}})}};function M(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function Ke(e,r){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=he(e.schema.searchParams,"searchParams"in r?r.searchParams:{})),e.schema.body&&(n.body=he(e.schema.body,"body"in r?r.body:{})),n}var O,Tn={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Pn(e){var r,n,t;return!e&&!O?Tn:{lang:(r=e==null?void 0:e.lang)!=null?r:O==null?void 0:O.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:O==null?void 0:O.abortEarly,abortPipeEarly:(t=e==null?void 0:e.abortPipeEarly)!=null?t:O==null?void 0:O.abortPipeEarly}}var me;function On(e){return me==null?void 0:me.get(e)}var ve;function jn(e){return ve==null?void 0:ve.get(e)}var ge;function Dn(e,r){var n;return(n=ge==null?void 0:ge.get(e))==null?void 0:n.get(r)}function be(e){var n,t,i;let r=typeof e;return r==="string"?`"${e}"`:r==="number"||r==="bigint"||r==="boolean"?`${e}`:r==="object"||r==="function"?(i=e&&((t=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:t.name))!=null?i:"null":r}function S(e,r,n,t,i){var l,v,a,d,E,_,A,y;let o=i&&"input"in i?i.input:n.value,u=(v=(l=i==null?void 0:i.expected)!=null?l:e.expects)!=null?v:null,c=(a=i==null?void 0:i.received)!=null?a:be(o),s={kind:e.kind,type:e.type,input:o,expected:u,received:c,message:`Invalid ${r}: ${u?`Expected ${u} but r`:"R"}eceived ${c}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:t.lang,abortEarly:t.abortEarly,abortPipeEarly:t.abortPipeEarly},p=e.kind==="schema",f=(y=(A=(_=(E=(d=i==null?void 0:i.message)!=null?d:e.message)!=null?E:Dn(e.reference,s.lang))!=null?_:p?jn(s.lang):null)!=null?A:t.message)!=null?y:On(s.lang);f!==void 0&&(s.message=typeof f=="function"?f(s):f),p&&(n.typed=!1),n.issues?n.issues.push(s):n.issues=[s]}var Je=new WeakMap;function I(e){let r=Je.get(e);return r||(r={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Pn())}},Je.set(e,r)),r}function Rn(e,r){return Object.prototype.hasOwnProperty.call(e,r)&&r!=="__proto__"&&r!=="prototype"&&r!=="constructor"}function He(e,r){var t;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${r} `)})`:(t=n[0])!=null?t:"never"}var Cn=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_r=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function ke(e){return{kind:"validation",type:"email",reference:ke,expects:null,async:!1,requirement:Cn,message:e,"~run"(r,n){return r.typed&&!this.requirement.test(r.value)&&S(this,"email",r,n),r}}}function Nn(e,r,n){return typeof e.fallback=="function"?e.fallback(r,n):e.fallback}function _e(e,r,n){return typeof e.default=="function"?e.default(r,n):e.default}function we(e,r){return{kind:"schema",type:"array",reference:we,expects:"Array",async:!1,item:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let u=0;u<i.length;u++){let c=i[u],s=this.item["~run"]({value:c},t);if(s.issues){let p={type:"array",origin:"value",input:i,key:u,value:c};for(let f of s.issues)f.path?f.path.unshift(p):f.path=[p],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=s.issues),t.abortEarly){n.typed=!1;break}}s.typed||(n.typed=!1),n.value.push(s.value)}}else S(this,"type",n,t);return n}}}function xe(e,r){return{kind:"schema",type:"literal",reference:xe,expects:be(e),async:!1,literal:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===this.literal?n.typed=!0:S(this,"type",n,t),n}}}function G(e,r){return{kind:"schema",type:"nullish",reference:G,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function U(e){return{kind:"schema",type:"number",reference:U,expects:"number",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="number"&&!isNaN(r.value)?r.typed=!0:S(this,"type",r,n),r}}}function V(e,r){return{kind:"schema",type:"object",reference:V,expects:"Object",async:!1,entries:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(let u in this.entries){let c=this.entries[u];if(u in i||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){let s=u in i?i[u]:_e(c),p=c["~run"]({value:s},t);if(p.issues){let f={type:"object",origin:"value",input:i,key:u,value:s};for(let l of p.issues)l.path?l.path.unshift(f):l.path=[f],(o=n.issues)==null||o.push(l);if(n.issues||(n.issues=p.issues),t.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[u]=p.value}else if(c.fallback!==void 0)n.value[u]=Nn(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.type!=="nullish"&&(S(this,"key",n,t,{input:void 0,expected:`"${u}"`,path:[{type:"object",origin:"key",input:i,key:u,value:i[u]}]}),t.abortEarly))break}}else S(this,"type",n,t);return n}}}function L(e,r){return{kind:"schema",type:"optional",reference:L,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===void 0&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function te(e,r){return{kind:"schema",type:"picklist",reference:te,expects:He(e.map(be),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return this.options.includes(n.value)?n.typed=!0:S(this,"type",n,t),n}}}function Ee(e,r,n){return{kind:"schema",type:"record",reference:Ee,expects:"Object",async:!1,key:e,value:r,message:n,get"~standard"(){return I(this)},"~run"(t,i){var u,c;let o=t.value;if(o&&typeof o=="object"){t.typed=!0,t.value={};for(let s in o)if(Rn(o,s)){let p=o[s],f=this.key["~run"]({value:s},i);if(f.issues){let v={type:"object",origin:"key",input:o,key:s,value:p};for(let a of f.issues)a.path=[v],(u=t.issues)==null||u.push(a);if(t.issues||(t.issues=f.issues),i.abortEarly){t.typed=!1;break}}let l=this.value["~run"]({value:p},i);if(l.issues){let v={type:"object",origin:"value",input:o,key:s,value:p};for(let a of l.issues)a.path?a.path.unshift(v):a.path=[v],(c=t.issues)==null||c.push(a);if(t.issues||(t.issues=l.issues),i.abortEarly){t.typed=!1;break}}(!f.typed||!l.typed)&&(t.typed=!1),f.typed&&(t.value[f.value]=l.value)}}else S(this,"type",t,i);return t}}}function k(e){return{kind:"schema",type:"string",reference:k,expects:"string",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="string"?r.typed=!0:S(this,"type",r,n),r}}}function We(e){let r;if(e)for(let n of e)if(r)for(let t of n.issues)r.push(t);else r=n.issues;return r}function Ae(e,r){return{kind:"schema",type:"union",reference:Ae,expects:He(e.map(n=>n.expects),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){let i,o,u;for(let c of this.options){let s=c["~run"]({value:n.value},t);if(s.typed)if(s.issues)o?o.push(s):o=[s];else{i=s;break}else u?u.push(s):u=[s]}if(i)return i;if(o){if(o.length===1)return o[0];S(this,"type",n,t,{issues:We(o)}),n.typed=!0}else{if((u==null?void 0:u.length)===1)return u[0];S(this,"type",n,t,{issues:We(u)})}return n}}}function Se(...e){return F(w({},e[0]),{pipe:e,get"~standard"(){return I(this)},"~run"(r,n){for(let t of e)if(t.kind!=="metadata"){if(r.issues&&(t.kind==="schema"||t.kind==="transformation")){r.typed=!1;break}(!r.issues||!n.abortEarly&&!n.abortPipeEarly)&&(r=t["~run"](r,n))}return r}})}var Y=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function Ie(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Xe=["DAILY","WEEKLY","MONTHLY"],Fn=Ee(k(),Ae([k(),we(k()),V({type:xe("provided"),lat:U(),lng:U(),radius:U(),unit:L(te(["miles","km"])),label:L(k())})])),Dr={pathname:"/job/:id",method:"GET",schema:{response:V({id:U(),external_id:G(k()),city:G(k()),town:G(k()),category:G(k())})}};var qn={pathname:"/search/save",method:"POST",schema:{response:M(),body:V({contact:V({email:Se(L(k()),k(),ke()),first_name:L(k()),last_name:L(k())}),alerts:Se(L(k()),k(),te(Xe)),filters:Fn})}};$e();var ie=new Map,Oe={get:e=>{var r;if(ie.has(e))return(r=ie.get(e))!=null?r:null;try{return window.sessionStorage.getItem(e)}catch(n){return null}},set:(e,r)=>{try{window.sessionStorage.setItem(e,r),ie.delete(e)}catch(n){ie.set(e,r)}}};var Qe=7*24*60*60*1e3,en=e=>{let r=new Date;return r.setTime(r.getTime()+Qe),`${D}=${e};expires=${r.toUTCString()};path=/`},Mn=(e,r)=>{let n=e.get("session_id");if(r||n)return n;let t=Oe.get(`${D}-session_id`);return typeof t=="string"?t:null},zn=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(Me);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Bn=new RegExp(`(?:^|;\\s*)${D}=([^;]+)`),Z=e=>{var n,t;let r=e?e.headers.get("cookie"):document.cookie;return r&&(t=(n=Bn.exec(r))==null?void 0:n[1])!=null?t:null},nn=()=>{var e;try{let r=JSON.parse((e=window.localStorage.getItem(D))!=null?e:"null");return typeof r!="object"||r===null||!("id"in r)||!("expires"in r)||typeof r.id!="string"||typeof r.expires!="number"?null:r.id!==""&&r.expires>Date.now()?r.id:null}catch(r){return null}},Ze=()=>{var e;return(e=Z())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:nn()},Gn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",rn=e=>{if(document.cookie=en(e)+Gn(),Z()!==e)try{window.localStorage.setItem(D,JSON.stringify({id:e,expires:Date.now()+Qe}))}catch(r){}},je=e=>{var t,i,o;let r=e?e.url:location.href,{searchParams:n}=new URL(r);return{anonymous_id:e?(t=Z(e))!=null?t:n.get("anonymous_id"):(o=(i=Z())!=null?i:n.get("anonymous_id"))!=null?o:nn(),session_id:Mn(n,typeof window=="undefined")}},Ye=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=je().anonymous_id;if(e)return e;let r=Y(),n=je().anonymous_id;return n||(rn(r),r)},Un=e=>typeof e!="object"||e===null?null:{anonymous_id:"anonymous_id"in e&&typeof e.anonymous_id=="string"?e.anonymous_id:null,session_id:"session_id"in e&&typeof e.session_id=="string"?e.session_id:null},Vn=e=>e==="about:client"?"":e,Kn={pathname:"/log",method:"POST",schema:{response:M(),body:M()}},tn=({rpcClient:e,logger:r,onEvent:n,persistence:t="device",siteKind:i})=>{let o=null,u=null,c=0,s=0,p=a=>t==="none"?{anonymous_id:null,session_id:a?null:o}:je(a),f=(a,d,E)=>x(void 0,null,function*(){try{let _={library:{name:"inploi-sdk",version:qe},page:d},A=p(a.request),y=t==="none"?null:zn(),m={anonymous_id:A.anonymous_id,session_id:A.session_id,candidate_id:y,event:a.event,sent_at:new Date().toISOString(),context:_,properties:a.properties,custom_properties:w(w({},a.customProperties),E)},R=t==="none"?null:a.request?Z(a.request):Ze(),K=++c,J=yield e.request(Kn,w({body:m},a.keepalive&&{keepalive:!0})),h=Un(J);if(t==="none")return!a.request&&(h!=null&&h.session_id)&&K>s&&(s=K,h.session_id!==m.session_id&&(o=h.session_id)),m.session_id=a.request?(h==null?void 0:h.session_id)||null:o,n==null||n(m),{success:!0,data:m};let C=a.request?R:Ze(),z=C!==null&&C!==R,g=C!=null?C:R,j=!z&&(!g||!(h!=null&&h.anonymous_id)||g===h.anonymous_id);return j?(h!=null&&h.anonymous_id&&(m.anonymous_id=h.anonymous_id),h!=null&&h.session_id&&(m.session_id=h.session_id)):m.anonymous_id=g,!a.request&&typeof window!="undefined"&&m.anonymous_id&&(j&&m.session_id&&Oe.set(`${D}-session_id`,m.session_id.toString()),rn(m.anonymous_id)),n==null||n(m),{success:!0,data:m}}catch(_){return r.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:_}}}),l=Promise.resolve();return{log:a=>x(void 0,null,function*(){oe(a.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let d="request"in a&&a.request?{href:a.request.url,referrer:Vn(a.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(a.page_context==="no_query"){let y=new URL(d.href),m=d.referrer?new URL(d.referrer):void 0;d={href:y.origin+y.pathname,referrer:m?m.origin+m.pathname:""}}t==="none"&&a.event==="FLOW_NODE"&&a.properties&&"trigger"in a.properties&&(a.properties.trigger==="pagehide"||a.properties.trigger==="hidden")&&(a=F(w({},a),{keepalive:!0}));let E={event_id:Y(),consent_lane:t,site_kind:i};if(t==="device"||a.request||o||a.keepalive)return f(a,d,E);let _=()=>f(a,d,E),A=l.then(_,_);return l=A,A}),supportsNoQueryPageContext:!0,getHeaders:a=>{let d=new Headers;return t==="none"||!(a!=null&&a.anonymous_id)||d.append("Set-Cookie",en(a.anonymous_id)),d},getSessionInfo:p,getOrCreateAnonymousId:()=>t==="none"?u!=null?u:u=Y():Ye()}};function Pe({publishableKey:e,env:r,logger:n=ue,onEvent:t,persistence:i,siteKind:o}){let u=Le({baseUrl:re[r],publishableKey:e}),c=n===!1?ae:n,s=new $({environment:r,apiKey:{type:"publishable",key:e},logger:c}),p=tn({rpcClient:s,logger:c,onEvent:t,persistence:i,siteKind:o});return{register:l=>l({logger:c,apiClient:u,analytics:p,rpcClient:s,publishableKey:e,env:r}),analytics:p,apiClient:u}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=Pe;window.inploi.ready=Ie;})();
|
|
3
|
+
"use strict";(()=>{var on=Object.defineProperty,un=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var Re=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable;var Ne=(e,r,n)=>r in e?on(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,_=(e,r)=>{for(var n in r||(r={}))ln.call(r,n)&&Ne(e,n,r[n]);if(Re)for(var n of Re(r))cn.call(r,n)&&Ne(e,n,r[n]);return e},F=(e,r)=>un(e,an(r));var pn=(e,r)=>()=>(e&&(r=e(e=0)),r);var x=(e,r,n)=>new Promise((t,i)=>{var o=s=>{try{c(n.next(s))}catch(p){i(p)}},u=s=>{try{c(n.throw(s))}catch(p){i(p)}},c=s=>s.done?t(s.value):Promise.resolve(s.value).then(o,u);c((n=n.apply(e,r)).next())});var $e=pn(()=>{"use strict"});function oe(e,r){if(!e)throw new Error(r)}function B(e,r){return r in e}var Qn=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Q="%c[inploi SDK]",ee="color: #65BC67; font-weight: bold;",ue={warn:(...e)=>console.warn(Q,ee,...e),error:(...e)=>console.error(Q,ee,...e),info:(...e)=>console.info(Q,ee,...e),log:(...e)=>console.log(Q,ee,...e)},ae={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var fn="Unauthenticated",yn="This action is unauthorized.",q=class extends Error{constructor(n,t){super(n);this.status=t,this.name="ErrorWithStatus"}},W=class extends q{constructor(r){super(r!=null?r:"Not found"),this.name="NotFoundError",this.status=404}},H=class extends q{constructor(r,n){super(r!=null?r:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},N=class extends q{constructor(n,t){let i=t?` in ${t}`:"";super(`Schema validation failed${i}`);this.issues=n;this.source=t;this.name="SchemaValidationError",this.status=400}},ne=class extends q{constructor(n,t,i){super(n);this.data=i;this.name="ApiError",this.status=t!=null?t:500}};var X=class extends q{constructor(n){var t;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(t=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?t:void 0}};function le(e){return x(this,null,function*(){let r=new Headers(e.headers).get("content-type"),n=r==null?void 0:r.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new X(e);return e.json().catch(()=>{throw new X(e)})})}var dn=["message","error","errors","exception","exceptions"];function hn(e){let r=[];if(typeof e=="object"&&e!==null){for(let n of dn)if(B(e,n)){let t=e[n];typeof t=="string"&&r.push(t),Array.isArray(t)&&t.every(i=>typeof i=="string")&&r.push(...t)}B(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&B(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&B(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&r.push(e.integration_response.error.message)}return r.length===0&&r.push("Unknown error"),[...new Set(r)].join(", ")}function ce(e,r){if(r>=300){let n=hn(e);throw r===404?new W(n):n===fn?new H("You are not authenticated.",r):n===yn?new H(n,r):new ne(n,r,e)}}var Le=e=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(i,...o)=>x(void 0,[i,...o],function*(n,t={}){let u=F(_({},t),{headers:_(_({},t.headers),r)}),c=yield fetch(`${e.baseUrl}${n}`,u);if(c.status===404)throw new W;let s=yield le(c);return ce(s,c.status),s})}};var Fe="3.1.2";var re={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var qe=Fe;var C="isdk_session",Me=`${C}-candidate_id`,vn=`${C}-consent`;var ye="RFC3986",de={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},gn="RFC1738";var bn=Array.isArray,T=(()=>{let e=[];for(let r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e})();var pe=1024,kn=(e,r,n,t,i)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let u="";for(let c=0;c<o.length;c+=pe){let s=o.length>=pe?o.slice(c,c+pe):o,p=[];for(let f=0;f<s.length;++f){let l=s.charCodeAt(f);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===gn&&(l===40||l===41)){p[p.length]=s.charAt(f);continue}if(l<128){p[p.length]=T[l];continue}if(l<2048){p[p.length]=T[192|l>>6]+T[128|l&63];continue}if(l<55296||l>=57344){p[p.length]=T[224|l>>12]+T[128|l>>6&63]+T[128|l&63];continue}f+=1,l=65536+((l&1023)<<10|s.charCodeAt(f)&1023),p[p.length]=T[240|l>>18]+T[128|l>>12&63]+T[128|l>>6&63]+T[128|l&63]}u+=p.join("")}return u};function _n(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function ze(e,r){if(bn(e)){let n=[];for(let t=0;t<e.length;t+=1)n.push(r(e[t]));return n}return r(e)}var yr=Array.isArray;var wn=Object.prototype.hasOwnProperty,Be={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,r){return String(e)+"["+r+"]"},repeat(e){return String(e)}},P=Array.isArray,xn=Array.prototype.push,Ge=function(e,r){xn.apply(e,P(r)?r:[r])},En=Date.prototype.toISOString,b={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:kn,encodeValuesOnly:!1,format:ye,formatter:de[ye],indices:!1,serializeDate(e){return En.call(e)},skipNulls:!1,strictNullHandling:!1};function An(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var fe={};function Ve(e,r,n,t,i,o,u,c,s,p,f,l,v,a,d,E,w,A){let y=e,m=A,j=0,K=!1;for(;(m=m.get(fe))!==void 0&&!K;){let g=m.get(e);if(j+=1,typeof g!="undefined"){if(g===j)throw new RangeError("Cyclic object value");K=!0}typeof m.get(fe)=="undefined"&&(j=0)}if(typeof p=="function"?y=p(r,y):y instanceof Date?y=v==null?void 0:v(y):n==="comma"&&P(y)&&(y=ze(y,function(g){return g instanceof Date?v==null?void 0:v(g):g})),y===null){if(o)return s&&!E?s(r,b.encoder,w,"key",a):r;y=""}if(An(y)||_n(y)){if(s){let g=E?r:s(r,b.encoder,w,"key",a);return[(d==null?void 0:d(g))+"="+(d==null?void 0:d(s(y,b.encoder,w,"value",a)))]}return[(d==null?void 0:d(r))+"="+(d==null?void 0:d(String(y)))]}let J=[];if(typeof y=="undefined")return J;let h;if(n==="comma"&&P(y))E&&s&&(y=ze(y,s)),h=[{value:y.length>0?y.join(",")||null:void 0}];else if(P(p))h=p;else{let g=Object.keys(y);h=f?g.sort(f):g}let R=c?String(r).replace(/\./g,"%2E"):String(r),z=t&&P(y)&&y.length===1?R+"[]":R;if(i&&P(y)&&y.length===0)return z+"[]";for(let g=0;g<h.length;++g){let D=h[g],Ce=typeof D=="object"&&typeof D.value!="undefined"?D.value:y[D];if(u&&Ce===null)continue;let se=l&&c?D.replace(/\./g,"%2E"):D,sn=P(y)?typeof n=="function"?n(z,se):z:z+(l?"."+se:"["+se+"]");A.set(e,j);let je=new WeakMap;je.set(fe,A),Ge(J,Ve(Ce,sn,n,t,i,o,u,c,n==="comma"&&E&&P(y)?null:s,p,f,l,v,a,d,E,w,je))}return J}function Sn(e=b){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let r=e.charset||b.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=ye;if(typeof e.format!="undefined"){if(!wn.call(de,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let t=de[n],i=b.filter;(typeof e.filter=="function"||P(e.filter))&&(i=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in Be?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=b.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let u=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:b.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:b.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:b.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:b.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?b.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:b.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:b.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:b.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:b.encodeValuesOnly,filter:i,format:n,formatter:t,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:b.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:b.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:b.strictNullHandling}}function Ue(e,r={}){let n=e,t=Sn(r),i,o;typeof t.filter=="function"?(o=t.filter,n=o("",n)):P(t.filter)&&(o=t.filter,i=o);let u=[];if(typeof n!="object"||n===null)return"";let c=Be[t.arrayFormat],s=c==="comma"&&t.commaRoundTrip;i||(i=Object.keys(n)),t.sort&&i.sort(t.sort);let p=new WeakMap;for(let v=0;v<i.length;++v){let a=i[v];t.skipNulls&&n[a]===null||Ge(u,Ve(n[a],a,c,s,t.allowEmptyArrays,t.strictNullHandling,t.skipNulls,t.encodeDotInKeys,t.encode?t.encoder:null,t.filter,t.sort,t.allowDots,t.serializeDate,t.format,t.formatter,t.encodeValuesOnly,t.charset,p))}let f=u.join(t.delimiter),l=t.addQueryPrefix===!0?"?":"";return t.charsetSentinel&&(t.charset==="iso-8859-1"?l+="utf8=%26%2310003%3B&":l+="utf8=%E2%9C%93&"),f.length>0?l+f:""}function he(e,r,n){let t=e["~standard"].validate(r);if(t instanceof Promise)throw new TypeError("Async schema");if(t.issues)throw new N(t.issues,n);return t.value}function In(e,r,n){try{return{success:!0,output:he(e,r,n)}}catch(t){if(t instanceof N)return{success:!1,issues:t.issues,source:t.source};throw t}}var $=class{constructor(r){if(this.baseUrl=re[r.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),r.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",r.apiKey.key)}else this.headers.set("x-publishable-key",r.apiKey.key);this.logger=r.logger,this._environment=r.environment}get environment(){return this._environment}getFetchParams(r,n){var s;let t=(s=n.validateIn)!=null?s:!0,{searchParams:i,body:o}=t?Ke(r,n):n,u=new URL(this.baseUrl),c=r.pathname;if("params"in n&&n.params)for(let[p,f]of Object.entries(n.params))c=c.replace(`:${p}`,String(f));return u.pathname=c,r.schema.searchParams&&(u.search=Ue(i)),[u.toString(),_({method:r.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(r,n){return x(this,null,function*(){var u;let t=yield le(n.response);if(ce(t,n.response.status),!((u=n.validateOut)!=null?u:!0))return t;let o=In(r.schema.response,t,"response");if(!o.success)throw new N(o.issues,o.source);return o.output})}request(r,n){return x(this,null,function*(){try{let t=this.getFetchParams(r,n),i=yield fetch(...t);return yield this.parseResponse(r,{response:i,validateOut:n.validateOut})}catch(t){throw t instanceof N?this.logger.error(t.message,t.issues):this.logger.error(t),t}})}};function M(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function Ke(e,r){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=he(e.schema.searchParams,"searchParams"in r?r.searchParams:{})),e.schema.body&&(n.body=he(e.schema.body,"body"in r?r.body:{})),n}var O,Tn={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Pn(e){var r,n,t;return!e&&!O?Tn:{lang:(r=e==null?void 0:e.lang)!=null?r:O==null?void 0:O.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:O==null?void 0:O.abortEarly,abortPipeEarly:(t=e==null?void 0:e.abortPipeEarly)!=null?t:O==null?void 0:O.abortPipeEarly}}var me;function On(e){return me==null?void 0:me.get(e)}var ve;function Dn(e){return ve==null?void 0:ve.get(e)}var ge;function Cn(e,r){var n;return(n=ge==null?void 0:ge.get(e))==null?void 0:n.get(r)}function be(e){var n,t,i;let r=typeof e;return r==="string"?`"${e}"`:r==="number"||r==="bigint"||r==="boolean"?`${e}`:r==="object"||r==="function"?(i=e&&((t=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:t.name))!=null?i:"null":r}function S(e,r,n,t,i){var l,v,a,d,E,w,A,y;let o=i&&"input"in i?i.input:n.value,u=(v=(l=i==null?void 0:i.expected)!=null?l:e.expects)!=null?v:null,c=(a=i==null?void 0:i.received)!=null?a:be(o),s={kind:e.kind,type:e.type,input:o,expected:u,received:c,message:`Invalid ${r}: ${u?`Expected ${u} but r`:"R"}eceived ${c}`,requirement:e.requirement,path:i==null?void 0:i.path,issues:i==null?void 0:i.issues,lang:t.lang,abortEarly:t.abortEarly,abortPipeEarly:t.abortPipeEarly},p=e.kind==="schema",f=(y=(A=(w=(E=(d=i==null?void 0:i.message)!=null?d:e.message)!=null?E:Cn(e.reference,s.lang))!=null?w:p?Dn(s.lang):null)!=null?A:t.message)!=null?y:On(s.lang);f!==void 0&&(s.message=typeof f=="function"?f(s):f),p&&(n.typed=!1),n.issues?n.issues.push(s):n.issues=[s]}var Je=new WeakMap;function I(e){let r=Je.get(e);return r||(r={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Pn())}},Je.set(e,r)),r}function jn(e,r){return Object.prototype.hasOwnProperty.call(e,r)&&r!=="__proto__"&&r!=="prototype"&&r!=="constructor"}function He(e,r){var t;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${r} `)})`:(t=n[0])!=null?t:"never"}var Rn=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,_r=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function ke(e){return{kind:"validation",type:"email",reference:ke,expects:null,async:!1,requirement:Rn,message:e,"~run"(r,n){return r.typed&&!this.requirement.test(r.value)&&S(this,"email",r,n),r}}}function Nn(e,r,n){return typeof e.fallback=="function"?e.fallback(r,n):e.fallback}function _e(e,r,n){return typeof e.default=="function"?e.default(r,n):e.default}function we(e,r){return{kind:"schema",type:"array",reference:we,expects:"Array",async:!1,item:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(Array.isArray(i)){n.typed=!0,n.value=[];for(let u=0;u<i.length;u++){let c=i[u],s=this.item["~run"]({value:c},t);if(s.issues){let p={type:"array",origin:"value",input:i,key:u,value:c};for(let f of s.issues)f.path?f.path.unshift(p):f.path=[p],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=s.issues),t.abortEarly){n.typed=!1;break}}s.typed||(n.typed=!1),n.value.push(s.value)}}else S(this,"type",n,t);return n}}}function xe(e,r){return{kind:"schema",type:"literal",reference:xe,expects:be(e),async:!1,literal:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===this.literal?n.typed=!0:S(this,"type",n,t),n}}}function G(e,r){return{kind:"schema",type:"nullish",reference:G,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function V(e){return{kind:"schema",type:"number",reference:V,expects:"number",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="number"&&!isNaN(r.value)?r.typed=!0:S(this,"type",r,n),r}}}function U(e,r){return{kind:"schema",type:"object",reference:U,expects:"Object",async:!1,entries:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){var o;let i=n.value;if(i&&typeof i=="object"){n.typed=!0,n.value={};for(let u in this.entries){let c=this.entries[u];if(u in i||(c.type==="exact_optional"||c.type==="optional"||c.type==="nullish")&&c.default!==void 0){let s=u in i?i[u]:_e(c),p=c["~run"]({value:s},t);if(p.issues){let f={type:"object",origin:"value",input:i,key:u,value:s};for(let l of p.issues)l.path?l.path.unshift(f):l.path=[f],(o=n.issues)==null||o.push(l);if(n.issues||(n.issues=p.issues),t.abortEarly){n.typed=!1;break}}p.typed||(n.typed=!1),n.value[u]=p.value}else if(c.fallback!==void 0)n.value[u]=Nn(c);else if(c.type!=="exact_optional"&&c.type!=="optional"&&c.type!=="nullish"&&(S(this,"key",n,t,{input:void 0,expected:`"${u}"`,path:[{type:"object",origin:"key",input:i,key:u,value:i[u]}]}),t.abortEarly))break}}else S(this,"type",n,t);return n}}}function L(e,r){return{kind:"schema",type:"optional",reference:L,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:r,get"~standard"(){return I(this)},"~run"(n,t){return n.value===void 0&&(this.default!==void 0&&(n.value=_e(this,n,t)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,t)}}}function te(e,r){return{kind:"schema",type:"picklist",reference:te,expects:He(e.map(be),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){return this.options.includes(n.value)?n.typed=!0:S(this,"type",n,t),n}}}function Ee(e,r,n){return{kind:"schema",type:"record",reference:Ee,expects:"Object",async:!1,key:e,value:r,message:n,get"~standard"(){return I(this)},"~run"(t,i){var u,c;let o=t.value;if(o&&typeof o=="object"){t.typed=!0,t.value={};for(let s in o)if(jn(o,s)){let p=o[s],f=this.key["~run"]({value:s},i);if(f.issues){let v={type:"object",origin:"key",input:o,key:s,value:p};for(let a of f.issues)a.path=[v],(u=t.issues)==null||u.push(a);if(t.issues||(t.issues=f.issues),i.abortEarly){t.typed=!1;break}}let l=this.value["~run"]({value:p},i);if(l.issues){let v={type:"object",origin:"value",input:o,key:s,value:p};for(let a of l.issues)a.path?a.path.unshift(v):a.path=[v],(c=t.issues)==null||c.push(a);if(t.issues||(t.issues=l.issues),i.abortEarly){t.typed=!1;break}}(!f.typed||!l.typed)&&(t.typed=!1),f.typed&&(t.value[f.value]=l.value)}}else S(this,"type",t,i);return t}}}function k(e){return{kind:"schema",type:"string",reference:k,expects:"string",async:!1,message:e,get"~standard"(){return I(this)},"~run"(r,n){return typeof r.value=="string"?r.typed=!0:S(this,"type",r,n),r}}}function We(e){let r;if(e)for(let n of e)if(r)for(let t of n.issues)r.push(t);else r=n.issues;return r}function Ae(e,r){return{kind:"schema",type:"union",reference:Ae,expects:He(e.map(n=>n.expects),"|"),async:!1,options:e,message:r,get"~standard"(){return I(this)},"~run"(n,t){let i,o,u;for(let c of this.options){let s=c["~run"]({value:n.value},t);if(s.typed)if(s.issues)o?o.push(s):o=[s];else{i=s;break}else u?u.push(s):u=[s]}if(i)return i;if(o){if(o.length===1)return o[0];S(this,"type",n,t,{issues:We(o)}),n.typed=!0}else{if((u==null?void 0:u.length)===1)return u[0];S(this,"type",n,t,{issues:We(u)})}return n}}}function Se(...e){return F(_({},e[0]),{pipe:e,get"~standard"(){return I(this)},"~run"(r,n){for(let t of e)if(t.kind!=="metadata"){if(r.issues&&(t.kind==="schema"||t.kind==="transformation")){r.typed=!1;break}(!r.issues||!n.abortEarly&&!n.abortPipeEarly)&&(r=t["~run"](r,n))}return r}})}var Y=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function Ie(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Xe=["DAILY","WEEKLY","MONTHLY"],Fn=Ee(k(),Ae([k(),we(k()),U({type:xe("provided"),lat:V(),lng:V(),radius:V(),unit:L(te(["miles","km"])),label:L(k())})])),Cr={pathname:"/job/:id",method:"GET",schema:{response:U({id:V(),external_id:G(k()),city:G(k()),town:G(k()),category:G(k())})}};var qn={pathname:"/search/save",method:"POST",schema:{response:M(),body:U({contact:U({email:Se(L(k()),k(),ke()),first_name:L(k()),last_name:L(k())}),alerts:Se(L(k()),k(),te(Xe)),filters:Fn})}};$e();var ie=new Map,Oe={get:e=>{var r;if(ie.has(e))return(r=ie.get(e))!=null?r:null;try{return window.sessionStorage.getItem(e)}catch(n){return null}},set:(e,r)=>{try{window.sessionStorage.setItem(e,r),ie.delete(e)}catch(n){ie.set(e,r)}}};var Qe=7*24*60*60*1e3,en=e=>{let r=new Date;return r.setTime(r.getTime()+Qe),`${C}=${e};expires=${r.toUTCString()};path=/`},Mn=(e,r)=>{let n=e.get("session_id");if(r||n)return n;let t=Oe.get(`${C}-session_id`);return typeof t=="string"?t:null},zn=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(Me);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Bn=new RegExp(`(?:^|;\\s*)${C}=([^;]+)`),Z=e=>{var n,t;let r=e?e.headers.get("cookie"):document.cookie;return r&&(t=(n=Bn.exec(r))==null?void 0:n[1])!=null?t:null},nn=()=>{var e;try{let r=JSON.parse((e=window.localStorage.getItem(C))!=null?e:"null");return typeof r!="object"||r===null||!("id"in r)||!("expires"in r)||typeof r.id!="string"||typeof r.expires!="number"?null:r.id!==""&&r.expires>Date.now()?r.id:null}catch(r){return null}},Ze=()=>{var e;return(e=Z())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:nn()},Gn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",rn=e=>{if(document.cookie=en(e)+Gn(),Z()!==e)try{window.localStorage.setItem(C,JSON.stringify({id:e,expires:Date.now()+Qe}))}catch(r){}},De=e=>{var t,i,o;let r=e?e.url:location.href,{searchParams:n}=new URL(r);return{anonymous_id:e?(t=Z(e))!=null?t:n.get("anonymous_id"):(o=(i=Z())!=null?i:n.get("anonymous_id"))!=null?o:nn(),session_id:Mn(n,typeof window=="undefined")}},Ye=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=De().anonymous_id;if(e)return e;let r=Y(),n=De().anonymous_id;return n||(rn(r),r)},Vn=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},Un=e=>e==="about:client"?"":e,Kn={pathname:"/log",method:"POST",schema:{response:M(),body:M()}},tn=({rpcClient:e,logger:r,onEvent:n,persistence:t="device",siteKind:i})=>{let o=null,u=null,c=0,s=0,p=a=>t==="none"?{anonymous_id:null,session_id:a?null:o}:De(a),f=(a,d,E)=>x(void 0,null,function*(){try{let w={library:{name:"inploi-sdk",version:qe},page:d},A=p(a.request),y=t==="none"?null:zn(),m={anonymous_id:A.anonymous_id,session_id:A.session_id,candidate_id:y,event:a.event,sent_at:new Date().toISOString(),context:w,properties:a.properties,custom_properties:_(_({},a.customProperties),E)},j=t==="none"?null:a.request?Z(a.request):Ze(),K=++c,J=yield e.request(Kn,_({body:m},a.keepalive&&{keepalive:!0})),h=Vn(J);if(t==="none")return!a.request&&(h!=null&&h.session_id)&&K>s&&(s=K,h.session_id!==m.session_id&&(o=h.session_id)),m.session_id=a.request?(h==null?void 0:h.session_id)||null:o,n==null||n(m),{success:!0,data:m};let R=a.request?j:Ze(),z=R!==null&&R!==j,g=R!=null?R:j,D=!z&&(!g||!(h!=null&&h.anonymous_id)||g===h.anonymous_id);return D?(h!=null&&h.anonymous_id&&(m.anonymous_id=h.anonymous_id),h!=null&&h.session_id&&(m.session_id=h.session_id)):m.anonymous_id=g,!a.request&&typeof window!="undefined"&&m.anonymous_id&&(D&&m.session_id&&Oe.set(`${C}-session_id`,m.session_id.toString()),rn(m.anonymous_id)),n==null||n(m),{success:!0,data:m}}catch(w){return r.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:w}}}),l=Promise.resolve();return{log:a=>x(void 0,null,function*(){oe(a.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let d="request"in a&&a.request?{href:a.request.url,referrer:Un(a.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(a.page_context==="no_query"){let y=new URL(d.href),m=d.referrer?new URL(d.referrer):void 0;d={href:y.origin+y.pathname,referrer:m?m.origin+m.pathname:""}}t==="none"&&a.event==="FLOW_NODE"&&a.properties&&"trigger"in a.properties&&(a.properties.trigger==="pagehide"||a.properties.trigger==="hidden")&&(a=F(_({},a),{keepalive:!0}));let E={event_id:Y(),consent_lane:t,site_kind:i};if(t==="device"||a.request||o||a.keepalive)return f(a,d,E);let w=()=>f(a,d,E),A=l.then(w,w);return l=A,A}),supportsNoQueryPageContext:!0,getHeaders:a=>{let d=new Headers;return t==="none"||!(a!=null&&a.anonymous_id)||d.append("Set-Cookie",en(a.anonymous_id)),d},getSessionInfo:p,getOrCreateAnonymousId:()=>t==="none"?u!=null?u:u=Y():Ye()}};function Pe({publishableKey:e,env:r,logger:n=ue,onEvent:t,persistence:i,siteKind:o}){let u=Le({baseUrl:re[r],publishableKey:e}),c=n===!1?ae:n,s=new $({environment:r,apiKey:{type:"publishable",key:e},logger:c}),p=tn({rpcClient:s,logger:c,onEvent:t,persistence:i,siteKind:o});return{register:l=>l({logger:c,apiClient:u,analytics:p,rpcClient:s,publishableKey:e,env:r}),analytics:p,apiClient:u}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=Pe;window.inploi.ready=Ie;})();
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var on=Object.create;var ae=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames;var cn=Object.getPrototypeOf,ln=Object.prototype.hasOwnProperty;var pn=(t,n)=>()=>(t&&(n=t(t=0)),n);var et=(t,n)=>{for(var o in n)ae(t,o,{get:n[o],enumerable:!0})},tt=(t,n,o,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of an(n))!ln.call(t,l)&&l!==o&&ae(t,l,{get:()=>n[l],enumerable:!(s=sn(n,l))||s.enumerable});return t};var E=(t,n,o)=>(o=t!=null?on(cn(t)):{},tt(n||!t||!t.__esModule?ae(o,"default",{value:t,enumerable:!0}):o,t)),dn=t=>tt(ae({},"__esModule",{value:!0}),t);var Xt={};et(Xt,{jobCountryCodes:()=>We});var Qt,Or,H,Lr,Dr,We,ze=pn(()=>{"use strict";Qt={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"},Or=`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`,Zn=()=>{if(V)return V;V=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of Qn.split(/\s+/)){let r=n.slice(0,2),s=t.of(r.toUpperCase());s&&V.set(s.toLowerCase(),r),V.set(r,r),V.set(n.slice(2),r)}return V},Xn=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(Ft,n))return Ft[n];let r=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return Zn().get(r)},Me=t=>[...new Set(t.flatMap(r=>Xn(r)??[]))].sort()});var tr={};We(tr,{ANALYTICS_EVENTS:()=>ut,ApiError:()=>B,InploiRpcClient:()=>J,JOB_ALERT_FREQUENCIES:()=>Fe,NotFoundError:()=>N,ParsingError:()=>F,SchemaValidationError:()=>w,SdkError:()=>we,UnauthorisedError:()=>U,addressSearchCountry:()=>Mt,blendAddressSuggestions:()=>$e,consentStorageKey:()=>ue,createPlugin:()=>ze,createTalentBankClient:()=>Nt,endpoint:()=>X,generateUUID:()=>W,getConsentAcceptance:()=>mt,getJobCountries:()=>Ve,getOrCreateAnonymousId:()=>Pe,hashConsentConfig:()=>de,initialiseSdk:()=>dt,inploiBrandedLogger:()=>ae,isApiErrorWithData:()=>Ye,isSdkError:()=>Ze,jobCountryCodes:()=>Me,noLogging:()=>ce,ready:()=>Ut,saveClosedRoleJobAlerts:()=>Bt,saveSearchEndpoint:()=>qe,searchAddressSuggestions:()=>Gt,setConsentAcceptance:()=>vt,typed:()=>C,validateEndpointInputs:()=>Le});module.exports=Qt(tr);var se="%c[inploi SDK]",ie="color: #65BC67; font-weight: bold;",ae={warn:(...t)=>console.warn(se,ie,...t),error:(...t)=>console.error(se,ie,...t),info:(...t)=>console.info(se,ie,...t),log:(...t)=>console.log(se,ie,...t)},ce={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var ze=t=>t;function xe(t,n){if(!t)throw new Error(n)}function K(t,n){return n in t}var dr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Zt="Unauthenticated",Xt="This action is unauthorized.",D=class extends Error{constructor(r,s){super(r);this.status=s,this.name="ErrorWithStatus"}},N=class extends D{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},U=class extends D{constructor(n,r){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=r??401}},w=class extends D{constructor(r,s){let c=s?` in ${s}`:"";super(`Schema validation failed${c}`);this.issues=r;this.source=s;this.name="SchemaValidationError",this.status=400}},B=class extends D{constructor(r,s,c){super(r);this.data=c;this.name="ApiError",this.status=s??500}},Ye=t=>t instanceof B&&t.data!==void 0,F=class extends D{constructor(r){super("Error parsing response into JSON.");this.response=r;this.name="ParsingError",this.status=r&&r.status>=300?r.status:500,this.contentType=new Headers(r?.headers).get("content-type")??void 0}};async function Ee(t){let r=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(r&&r!=="application/json"&&!r.endsWith("+json"))throw new F(t);return t.json().catch(()=>{throw new F(t)})}var en=["message","error","errors","exception","exceptions"];function tn(t){let n=[];if(typeof t=="object"&&t!==null){for(let r of en)if(K(t,r)){let s=t[r];typeof s=="string"&&n.push(s),Array.isArray(s)&&s.every(c=>typeof c=="string")&&n.push(...s)}K(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&K(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&K(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&n.push(t.integration_response.error.message)}return n.length===0&&n.push("Unknown error"),[...new Set(n)].join(", ")}function Ie(t,n){if(n>=300){let r=tn(t);throw n===404?new N(r):r===Zt?new U("You are not authenticated.",n):r===Xt?new U(r,n):new B(r,n,t)}}var Qe=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(r,s={})=>{let c={...s,headers:{...s.headers,...n}},l=await fetch(`${t.baseUrl}${r}`,c);if(l.status===404)throw new N;let d=await Ee(l);return Ie(d,l.status),d}}},we={NotFound:N,Unauthorised:U,SchemaValidation:w,Api:B,JsonParsing:F};function Ze(t){return Object.values(we).some(n=>t instanceof n)}var Xe="3.1.1";var le={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},et={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},tt=Xe;var P="isdk_session",nt=`${P}-candidate_id`,rt=`${P}-consent`;var pe=new Map,ke={get:t=>{if(pe.has(t))return pe.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,n)=>{try{window.sessionStorage.setItem(t,n),pe.delete(t)}catch{pe.set(t,n)}}};var W=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16));var st=7*24*60*60*1e3,it=t=>{let n=new Date;return n.setTime(n.getTime()+st),`${P}=${t};expires=${n.toUTCString()};path=/`},rn=(t,n)=>{let r=t.get("session_id");if(n||r)return r;let s=ke.get(`${P}-session_id`);return typeof s=="string"?s:null},on=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(nt);return typeof t=="string"&&t!==""?t:null}catch{return null}},sn=new RegExp(`(?:^|;\\s*)${P}=([^;]+)`),Z=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?sn.exec(n)?.[1]??null:null},at=()=>{try{let t=JSON.parse(window.localStorage.getItem(P)??"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch{return null}},ot=()=>Z()??(new URL(location.href).searchParams.get("anonymous_id")?null:at()),an=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",ct=t=>{if(document.cookie=it(t)+an(),Z()!==t)try{window.localStorage.setItem(P,JSON.stringify({id:t,expires:Date.now()+st}))}catch{}},Re=t=>{let n=t?t.url:location.href,{searchParams:r}=new URL(n);return{anonymous_id:t?Z(t)??r.get("anonymous_id"):Z()??r.get("anonymous_id")??at(),session_id:rn(r,typeof window>"u")}},Pe=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Re().anonymous_id;if(t)return t;let n=W(),r=Re().anonymous_id;return r||(ct(n),n)},cn=t=>typeof t!="object"||t===null?null:{anonymous_id:"anonymous_id"in t&&typeof t.anonymous_id=="string"?t.anonymous_id:null,session_id:"session_id"in t&&typeof t.session_id=="string"?t.session_id:null},ln=t=>t==="about:client"?"":t,pn={pathname:"/log",method:"POST",schema:{response:C(),body:C()}},lt=({rpcClient:t,logger:n,onEvent:r,persistence:s="device",siteKind:c})=>{let l=null,d=null,u=0,b=0,E=p=>s==="none"?{anonymous_id:null,session_id:p?null:l}:Re(p),$=async(p,h,ne)=>{try{let H={library:{name:"inploi-sdk",version:tt},page:h},Q=E(p.request),re=s==="none"?null:on(),f={anonymous_id:Q.anonymous_id,session_id:Q.session_id,candidate_id:re,event:p.event,sent_at:new Date().toISOString(),context:H,properties:p.properties,custom_properties:{...p.customProperties,...ne}},_e=s==="none"?null:p.request?Z(p.request):ot(),He=++u,Vt=await t.request(pn,{body:f,...p.keepalive&&{keepalive:!0}}),I=cn(Vt);if(s==="none")return!p.request&&I?.session_id&&He>b&&(b=He,I.session_id!==f.session_id&&(l=I.session_id)),f.session_id=p.request?I?.session_id||null:l,r?.(f),{success:!0,data:f};let Ae=p.request?_e:ot(),$t=Ae!==null&&Ae!==_e,Te=Ae??_e,Ke=!$t&&(!Te||!I?.anonymous_id||Te===I.anonymous_id);return Ke?(I?.anonymous_id&&(f.anonymous_id=I.anonymous_id),I?.session_id&&(f.session_id=I.session_id)):f.anonymous_id=Te,!p.request&&typeof window<"u"&&f.anonymous_id&&(Ke&&f.session_id&&ke.set(`${P}-session_id`,f.session_id.toString()),ct(f.anonymous_id)),r?.(f),{success:!0,data:f}}catch(H){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:H}}},O=Promise.resolve();return{log:async p=>{xe(p.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let h="request"in p&&p.request?{href:p.request.url,referrer:ln(p.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(p.page_context==="no_query"){let re=new URL(h.href),f=h.referrer?new URL(h.referrer):void 0;h={href:re.origin+re.pathname,referrer:f?f.origin+f.pathname:""}}s==="none"&&p.event==="FLOW_NODE"&&p.properties&&"trigger"in p.properties&&(p.properties.trigger==="pagehide"||p.properties.trigger==="hidden")&&(p={...p,keepalive:!0});let ne={event_id:W(),consent_lane:s,site_kind:c};if(s==="device"||p.request||l||p.keepalive)return $(p,h,ne);let H=()=>$(p,h,ne),Q=O.then(H,H);return O=Q,Q},supportsNoQueryPageContext:!0,getHeaders:p=>{let h=new Headers;return s==="none"||!p?.anonymous_id||h.append("Set-Cookie",it(p.anonymous_id)),h},getSessionInfo:E,getOrCreateAnonymousId:()=>s==="none"?d??(d=W()):Pe()}};var pt=require("neoqs");function Ce(t,n,r){let s=t["~standard"].validate(n);if(s instanceof Promise)throw new TypeError("Async schema");if(s.issues)throw new w(s.issues,r);return s.value}function dn(t,n,r){try{return{success:!0,output:Ce(t,n,r)}}catch(s){if(s instanceof w)return{success:!1,issues:s.issues,source:s.source};throw s}}var J=class{constructor(n){if(this.baseUrl=le[n.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),n.apiKey.type==="secret"){if(typeof window<"u")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",n.apiKey.key)}else this.headers.set("x-publishable-key",n.apiKey.key);this.logger=n.logger,this._environment=n.environment}get environment(){return this._environment}getFetchParams(n,r){let s=r.validateIn??!0,{searchParams:c,body:l}=s?Le(n,r):r,d=new URL(this.baseUrl),u=n.pathname;if("params"in r&&r.params)for(let[b,E]of Object.entries(r.params))u=u.replace(`:${b}`,String(E));return d.pathname=u,n.schema.searchParams&&(d.search=(0,pt.stringify)(c)),[d.toString(),{method:n.method,body:l?JSON.stringify(l):void 0,headers:this.headers,signal:r.signal,...r.keepalive&&{keepalive:!0}}]}async parseResponse(n,r){let s=await Ee(r.response);if(Ie(s,r.response.status),!(r.validateOut??!0))return s;let l=dn(n.schema.response,s,"response");if(!l.success)throw new w(l.issues,l.source);return l.output}async request(n,r){try{let s=this.getFetchParams(n,r),c=await fetch(...s);return await this.parseResponse(n,{response:c,validateOut:r.validateOut})}catch(s){throw s instanceof w?this.logger.error(s.message,s.issues):this.logger.error(s),s}}};function C(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function X(t){return t}function Le(t,n){let r={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(r.searchParams=Ce(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(r.body=Ce(t.schema.body,"body"in n?n.body:{})),r}function dt({publishableKey:t,env:n,logger:r=ae,onEvent:s,persistence:c,siteKind:l}){let d=Qe({baseUrl:le[n],publishableKey:t}),u=r===!1?ce:r,b=new J({environment:n,apiKey:{type:"publishable",key:t},logger:u}),E=lt({rpcClient:b,logger:u,onEvent:s,persistence:c,siteKind:l});return{register:O=>O({logger:u,apiClient:d,analytics:E,rpcClient:b,publishableKey:t,env:n}),analytics:E,apiClient:d}}var ut={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_RESULTS:"A search whose results returned, zero included; once per distinct query, filters, place and order.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function de(t){let n=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),r=5381;for(let s=0;s<n.length;s++)r=r*33^n.charCodeAt(s);return(r>>>0).toString(36)}function ue(t,n){return`${rt}:${t}:${n}`}function mt(t,n){if(typeof window>"u")return!1;try{let r=ue(t,de(n));return window.localStorage.getItem(r)==="accepted"}catch{return!1}}function vt(t,n){if(!(typeof window>"u"))try{let r=ue(t,de(n));window.localStorage.setItem(r,"accepted")}catch{}}var i=x(require("valibot"),1),un=["agent","sdk","form","integration","migration"],mn=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var vn=["screening","cv_match","interview","overall"],gn=["PENDING","IN_PROGRESS","COMPLETED","CANCELLED"],hn=["agent"],fn=["job","company"],yn=["created_at","updated_at","score","interview_score"],bn=["asc","desc"],Sn=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],_n=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written","ats_submission_attempted","ats_submission_succeeded","ats_submission_failed","ats_retry_payload_purged"],An=["pending","submitted","failed","not_required"],Tn=["user","system","automation","integration","candidate"],me=i.picklist(un),k=i.picklist(mn),T=i.pipe(i.string(),i.trim(),i.minLength(1),i.maxLength(100)),ve=i.picklist(vn),gt=i.picklist(gn),ht=i.picklist(hn),$r=i.picklist(fn),ft=i.picklist(yn),yt=i.picklist(bn),ee=i.pipe(i.string(),i.trim(),i.minLength(1),i.maxLength(100)),ge=i.picklist(Sn),bt=i.picklist(_n),St=i.picklist(Tn),q=i.picklist(An);var _=i.variant("type",[i.object({type:i.literal("user"),id:i.pipe(i.string(),i.minLength(1)),email:i.pipe(i.string(),i.minLength(1)),name:i.pipe(i.string(),i.minLength(1))}),i.object({type:i.literal("system"),id:i.pipe(i.string(),i.minLength(1)),name:i.optional(i.string())}),i.object({type:i.literal("automation"),id:i.pipe(i.string(),i.minLength(1)),name:i.optional(i.string())}),i.object({type:i.literal("integration"),id:i.pipe(i.string(),i.minLength(1)),name:i.optional(i.string())}),i.object({type:i.literal("candidate"),id:i.pipe(i.string(),i.minLength(1)),email:i.optional(i.string())})]);var R=x(require("valibot"),1),xn=R.object({total:R.number(),page:R.number(),perPage:R.number(),lastPage:R.number()});function _t(t){return R.object({data:R.array(t),pagination:xn})}var y=x(require("valibot"),1);var je=y.object({id:y.string(),email:y.nullable(y.string()),firstName:y.nullable(y.string()),lastName:y.nullable(y.string()),phone:y.nullable(y.string()),source:y.nullable(me),identifiedAt:y.nullable(y.string()),createdAt:y.string(),updatedAt:y.string()});var o=x(require("valibot"),1);var g=x(require("valibot"),1),j=g.pipe(g.string(),g.minLength(1)),te=g.pipe(g.number(),g.integer(),g.minValue(1)),L=g.record(g.string(),g.unknown()),En="(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}",zr=g.pipe(g.string(),g.regex(new RegExp(`^${En}$`)));var S=x(require("valibot"),1);var At=S.object({id:S.string(),applicationId:S.string(),status:gt,conductedBy:ht,agentInterviewId:S.nullable(S.string()),generatedScore:S.nullable(S.number()),completedAt:S.nullable(S.string()),meta:S.nullable(L),createdAt:S.string(),updatedAt:S.string()});var In=o.object({quote:o.string(),source:o.picklist(["cv","answer"])}),Oe=o.object({score:o.number(),reason:o.string(),confidence:o.number(),share:o.optional(o.number()),evidence:o.optional(o.array(In))}),De=o.object({categoryId:o.string(),answerKey:o.string(),reason:o.picklist(["unanswered","unrecognised"])}),Tt=o.object({id:o.string(),candidateId:o.string(),jobId:o.number(),stage:T,stageGroup:k,stageEnteredAt:o.string(),rating:o.nullable(o.number()),disqualifiedAt:o.nullable(o.string()),disqualificationReason:o.nullable(ee),disqualificationNote:o.nullable(o.string()),source:ge,sourceDetail:o.nullable(o.string()),sessionId:o.nullable(o.number()),externalApplicationId:o.nullable(o.string()),meta:o.nullable(L),context:o.nullable(L),scoredAt:o.nullable(o.string()),atsSubmissionStatus:o.optional(o.nullable(q)),atsSubmissionAttempts:o.optional(o.number()),atsNextAttemptAt:o.optional(o.nullable(o.string())),atsSubmittedAt:o.optional(o.nullable(o.string())),atsLastErrorCode:o.optional(o.nullable(o.string())),atsLastErrorMessage:o.optional(o.nullable(o.string())),createdAt:o.string(),updatedAt:o.string()}),wn=o.object({id:o.string(),applicationId:o.string(),scoreType:ve,score:o.nullable(o.number()),reason:o.nullable(o.string()),categories:o.nullable(o.record(o.string(),Oe)),leftOut:o.optional(o.array(De)),scoredBy:o.nullable(o.string()),createdAt:o.string()}),M=o.object({...Tt.entries,candidate:o.nullable(je),score:o.nullable(wn),interview:o.nullable(At)}),oo=o.object({...je.entries,applications:o.array(Tt)}),xt=o.object({id:o.string(),applicationId:o.string(),action:bt,fromStage:o.nullable(T),fromStageGroup:o.nullable(k),toStage:o.nullable(T),toStageGroup:o.nullable(k),disqualificationReason:o.nullable(ee),disqualificationNote:o.nullable(o.string()),actorId:o.nullable(o.string()),actorType:St,actorEmail:o.nullable(o.string()),actorName:o.nullable(o.string()),meta:o.nullable(L),schemaVersion:o.number(),createdAt:o.string()});var v=x(require("valibot"),1);var Et=v.object({anonymousId:j,email:j,firstName:v.nullish(v.string()),lastName:v.nullish(v.string()),phone:v.nullish(v.string()),source:v.nullish(me),updateExisting:v.optional(v.boolean())}),Ne=v.object({candidateId:v.string(),isNew:v.boolean()}),co=v.union([v.object({ok:v.literal(!0)}),Ne]);var e=x(require("valibot"),1);var kn=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],fe=e.picklist(kn),Ue=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),Rn=e.pipe(Ue,e.array(T)),Pn=e.pipe(Ue,e.array(k)),It=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),Cn=e.pipe(Ue,e.array(q)),wt=e.object({stages:e.optional(Rn),stage_groups:e.optional(Pn),job_id:e.optional(e.string()),job_ids:e.optional(It),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),ats_submission_status:e.optional(Cn),sort:e.optional(ft),order:e.optional(yt),page:e.optional(e.string()),per_page:e.optional(e.string())}),z=e.pipe(j,e.maxLength(255)),Ln=e.object({status:e.picklist(["pending","not_required"]),integrationId:e.nullish(z)}),go=e.pipe(e.object({candidateId:j,jobId:te,meta:e.nullish(L),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),externalJobId:e.nullish(e.pipe(j,e.maxLength(255))),context:e.nullish(L),source:e.nullish(ge),sourceDetail:e.nullish(e.string()),stage:e.nullish(T),stageGroup:e.nullish(k),actor:e.nullish(_),atsSubmission:e.nullish(Ln),duplicateScope:e.nullish(e.picklist(["job","attempt"]))}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together"),e.check(t=>t.duplicateScope!=="attempt"||typeof t.meta?.attempt_id=="string"&&t.meta.attempt_id!=="","duplicateScope attempt needs meta.attempt_id")),kt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),ho=e.union([e.object({ok:e.literal(!0),duplicate:e.literal(!1),applicationId:e.string(),candidateId:e.string(),atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!0),duplicate:e.literal(!0),existingApplication:kt,atsHeld:e.optional(e.boolean())})]),Rt=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(kt)}),jn=Date.UTC(1e4,0,1),On=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})$/),e.check(t=>{let[n,r,s]=t.slice(0,10).split("-").map(Number),c=new Date(Date.UTC(n,r-1,s)),l=Date.parse(t);return c.getUTCMonth()===r-1&&c.getUTCDate()===s&&l>=0&&l<jn},"must be a real time")),Be=e.pipe(e.string(),e.regex(/^[A-Za-z0-9_.:-]{1,100}$/)),fo=e.object({status:e.picklist(["pending","submitted","failed"]),nextAttemptAt:e.nullish(On),errorCode:e.nullish(Be),errorMessage:e.nullish(e.pipe(e.string(),e.maxLength(1e4))),externalApplicationId:e.nullish(z),externalRunId:e.nullish(z),integrationId:e.nullish(z),answeredPending:e.optional(e.boolean())}),Dn=e.picklist(["invalid_transition","next_attempt_required","retry_hold_expired"]),yo=e.variant("kind",[e.object({kind:e.literal("recorded"),application:M}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),to:q,reason:Dn})]),Nn=e.object({integrationId:e.string(),state:e.picklist(["closed","open","half_open"]),coolingUntil:e.nullable(e.string()),transientCount:e.number(),held:e.boolean()}),bo=e.object({groups:e.array(e.object({integrationId:e.nullable(e.string()),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),count:e.number(),retryable:e.number(),sendable:e.optional(e.number()),nextRetryUntil:e.optional(e.nullable(e.string()))})),oldestPendingAgeSeconds:e.nullable(e.number()),breakers:e.array(Nn),restoreHold:e.optional(e.boolean())}),So=e.object({status:e.picklist(["pending","failed"]),integrationId:e.nullable(z),errorCode:e.nullable(Be)}),_o=e.object({rows:e.array(e.object({id:e.string(),jobId:e.number(),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),errorMessage:e.nullable(e.string()),attempts:e.number(),nextAttemptAt:e.nullable(e.string()),payloadHeld:e.boolean(),receivedAt:e.nullable(e.string()),retryUntil:e.nullable(e.string()),updatedAt:e.string()})),truncated:e.boolean()}),Ao=e.object({actor:_,expectedAtsLogCount:e.optional(e.pipe(e.number(),e.integer(),e.minValue(0)))}),Un=e.picklist(["invalid_transition","retry_payload_missing","retry_hold_expired","stale"]),To=e.variant("kind",[e.object({kind:e.literal("retried"),application:M}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),reason:Un})]),xo=e.object({status:e.optional(e.picklist(["pending","failed"])),integrationId:e.nullable(z),errorCode:e.nullable(Be),actor:_}),Eo=e.object({retried:e.number()});var Io=e.object({integrationId:e.string(),wasOpen:e.boolean()}),wo=e.object({integrationId:e.string(),wasHeld:e.boolean()}),ko=e.object({applicationId:j,scoreType:ve,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Oe)),leftOut:e.nullish(e.array(De)),scoredBy:e.nullish(e.string()),actor:e.nullish(_),idempotencyKey:e.nullish(e.pipe(e.string(),e.maxLength(255)))}),Ro=e.object({scoreId:e.string()}),Po=_t(M);var Co=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),Lo=e.array(xt),he=e.object({stage:e.nullish(T),note:e.nullish(e.string())}),Bn=e.object({stage:e.nullish(T),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),Fn=e.variant("action",[e.object({action:e.literal("shortlist"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("move_to_interview"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("make_offer"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("hire"),actor:_,meta:e.nullish(Bn)}),e.object({action:e.literal("withdraw"),actor:_,meta:e.nullish(he)}),e.object({action:e.literal("move_to_stage"),actor:_,meta:e.object({stage:T,stageGroup:k,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:_,meta:e.object({toStage:T,toStageGroup:k,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:_,meta:e.object({reason:ee,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:_,meta:e.object({toStage:T,toStageGroup:k,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:_,meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),jo=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:Fn}),Pt=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),Oo=e.variant("kind",[e.object({kind:e.literal("updated"),action:fe,application:M}),e.object({kind:e.literal("skipped"),action:fe,applicationId:e.string(),reason:Pt})]),Do=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:fe,application:M})),skipped:e.array(e.object({kind:e.literal("skipped"),action:fe,applicationId:e.string(),reason:Pt})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),m=e.pipe(e.number(),e.integer(),e.minValue(0)),Ct=e.object({APPLIED:m,SHORTLISTED:m,INTERVIEWED:m,OFFERED:m,HIRED:m,REJECTED:m,WITHDRAWN:m}),No=e.object({job_ids:It}),Uo=e.object({counts:e.record(e.string(),Ct)}),Bo=e.omit(wt,["sort","order","page","per_page"]),Fo=e.object({counts:Ct}),Lt=92,qn=864e5,Y=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}$/),e.check(t=>{let n=new Date(`${t}T00:00:00Z`);return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t},"must be a real calendar day"));function jt({from:t,to:n}){let r=(Date.parse(`${n}T00:00:00Z`)-Date.parse(`${t}T00:00:00Z`))/qn+1;return r>=1&&r<=Lt}var Ot=`to must be on or after from, and the range must span at most ${Lt} days`,qo=e.pipe(e.object({from:Y,to:Y}),e.check(jt,Ot)),Mn=e.object({job_id:te,date:Y,received:m,scored:m,shortlisted:m}),Mo=e.object({rows:e.array(Mn)}),Gn=5e3,Vn=e.pipe(e.object({from:Y,to:Y,jobIds:e.optional(e.pipe(e.array(te),e.maxLength(Gn)))}),e.check(jt,Ot)),Go=e.pipe(e.object({from:e.string(),to:e.string(),job_ids:e.optional(e.string())}),e.transform(({from:t,to:n,job_ids:r})=>({from:t,to:n,jobIds:r===void 0?void 0:r===""?[]:r.split(",").map(s=>/^\d+$/.test(s.trim())?Number(s):Number.NaN)})),Vn),Dt=e.pipe(e.array(m),e.length(5)),$n=e.object({received:m,scored:m,shortlisted:m,histogram:e.pipe(e.array(m),e.length(101)),median_lag_minutes:e.nullable(e.number()),scored_same_day:m}),Hn=e.object({job_id:te,received:m,scored:m,shortlisted:m,score_sum:e.number(),bands:Dt}),Kn=e.object({date:Y,received:m,scored:m,score_sum:e.number(),bands:Dt,scored_on_day:m}),Wn=e.object({id:e.string(),label:e.nullable(e.string()),sum:e.number(),count:m}),Jn=e.object({template_id:e.string(),scored:m,criteria:e.array(Wn)}),Vo=e.object({totals:$n,by_job:e.array(Hn),by_day:e.array(Kn),criteria:e.array(Jn)});var $o=e.object({...e.omit(wt,["page","per_page"]).entries,per_group:e.optional(e.string())}),G=e.object({data:e.array(M),total:m}),Ho=e.object({board:e.object({APPLIED:G,SHORTLISTED:G,INTERVIEWED:G,OFFERED:G,HIRED:G,REJECTED:G,WITHDRAWN:G})});var ye=x(require("valibot"));var Nt=({environment:t,publishableKey:n,logger:r})=>{let s=et[t];return{async checkDuplicate(c){try{let l=new URLSearchParams({email:c.email,scope:c.scope});c.scope==="job"&&c.jobId!=null&&l.set("job_id",String(c.jobId));let d=await fetch(`${s}/applications/check-duplicate?${l}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":n}});if(!d.ok)return r.error(`[TalentBankClient] checkDuplicate failed with status ${d.status}`),{isDuplicate:!1};let u=await d.json(),b=ye.safeParse(Rt,u);return b.success?b.output:(r.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof u=="object"&&u!=null&&typeof u.isDuplicate=="boolean"?{isDuplicate:u.isDuplicate}:{isDuplicate:!1})}catch(l){return r.error("[TalentBankClient] checkDuplicate failed:",l),{isDuplicate:!1}}},async identify(c){try{if(!c.anonymousId)return r.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let l={email:c.email,firstName:c.firstName,lastName:c.lastName,phone:c.phone,anonymousId:c.anonymousId,source:c.source??"sdk"},d=ye.safeParse(Et,l);if(!d.success)return r.error("[TalentBankClient] identify received invalid input"),null;let u=await fetch(`${s}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(d.output)});if(!u.ok)return r.error(`[TalentBankClient] identify failed with status ${u.status}`),null;let b=ye.safeParse(Ne,await u.json());return b.success?b.output:(r.error("[TalentBankClient] identify returned an invalid response"),null)}catch(l){return r.error("[TalentBankClient] identify failed:",l),null}}}};function Ut(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var a=x(require("valibot"));var Fe=["DAILY","WEEKLY","MONTHLY"],zn=a.record(a.string(),a.union([a.string(),a.array(a.string()),a.object({type:a.literal("provided"),lat:a.number(),lng:a.number(),radius:a.number(),unit:a.optional(a.picklist(["miles","km"])),label:a.optional(a.string())})])),Yn={pathname:"/job/:id",method:"GET",schema:{response:a.object({id:a.number(),external_id:a.nullish(a.string()),city:a.nullish(a.string()),town:a.nullish(a.string()),category:a.nullish(a.string())})}};async function Bt(t,{contact:n,job:r}){let s={};if(r){let c=await t.request(Yn,{params:{id:r.id}});if((r.id_type==="internal"?String(c.id):c.external_id)!==r.id)throw new Error("Job lookup returned a different role");for(let d of["city","town","category"]){let u=c[d]?.trim();u&&(s[d]=[u])}}await t.request(qe,{body:{contact:n,alerts:"WEEKLY",filters:s}})}var qe={pathname:"/search/save",method:"POST",schema:{response:C(),body:a.object({contact:a.object({email:a.pipe(a.optional(a.string()),a.string(),a.email()),first_name:a.optional(a.string()),last_name:a.optional(a.string())}),alerts:a.pipe(a.optional(a.string()),a.string(),a.picklist(Fe)),filters:zn})}};var A=x(require("valibot"));var Ve=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:A.pipe(A.object({country:A.optional(A.array(A.object({value:A.string()})),[])}),A.transform(({country:r})=>r.map(({value:s})=>s))),searchParams:C()}};return t.request(n,{searchParams:{filters:{country:null}}})},be=new WeakMap,Mt=t=>(be.has(t)||(be.set(t,void 0),Ve(t).then(async n=>{let{jobCountryCodes:r}=await Promise.resolve().then(()=>(Ge(),qt));be.set(t,r(n).join(",")||void 0)}).catch(()=>{})),be.get(t)),$e=(t,n)=>{let r=new Set,s=[];for(let c=0;c<Math.max(t.length,n.length);c++)for(let l of[t[c],n[c]]){if(!l)continue;let d=l.mapbox_id||l.full_address||[l.name,l.place_formatted].filter(Boolean).join(", ");if(!r.has(d)&&(r.add(d),s.push(l),s.length===5))return s}return s},er=600,Gt=async(t,n,r)=>{if(r?.throwIfAborted(),!n){let s=await t();return r?.throwIfAborted(),s}return new Promise((s,c)=>{let l,d,u,b=!1,E=()=>{b=!0,clearTimeout(u),r?.removeEventListener("abort",$)},$=()=>{E(),c(r?.reason)},O=()=>{E(),l?.status==="fulfilled"&&d?.status==="fulfilled"?s($e(l.value,d.value)):l?.status==="fulfilled"?s(l.value):d?.status==="fulfilled"?s(d.value):l?.status==="rejected"&&c(l.reason)},Se=(p,h)=>{b||(p?l=h:d=h,l&&d?O():h.status==="fulfilled"&&h.value.length>0&&(u=setTimeout(O,er)))};r?.addEventListener("abort",$,{once:!0});for(let p of[!0,!1])t(p?n:void 0).then(h=>Se(p,{status:"fulfilled",value:h}),h=>Se(p,{status:"rejected",reason:h}))})};Ge();0&&(module.exports={ANALYTICS_EVENTS,ApiError,InploiRpcClient,JOB_ALERT_FREQUENCIES,NotFoundError,ParsingError,SchemaValidationError,SdkError,UnauthorisedError,addressSearchCountry,blendAddressSuggestions,consentStorageKey,createPlugin,createTalentBankClient,endpoint,generateUUID,getConsentAcceptance,getJobCountries,getOrCreateAnonymousId,hashConsentConfig,initialiseSdk,inploiBrandedLogger,isApiErrorWithData,isSdkError,jobCountryCodes,noLogging,ready,saveClosedRoleJobAlerts,saveSearchEndpoint,searchAddressSuggestions,setConsentAcceptance,typed,validateEndpointInputs});
|
|
13
|
+
vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,Lr=()=>{if(H)return H;H=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let n of Or.split(/\s+/)){let o=n.slice(0,2),s=t.of(o.toUpperCase());s&&H.set(s.toLowerCase(),o),H.set(o,o),H.set(n.slice(2),o)}return H},Dr=t=>{let n=t.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(Qt,n))return Qt[n];let o=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(n)?n.slice(0,2):n;return Lr().get(o)},We=t=>[...new Set(t.flatMap(o=>Dr(o)??[]))].sort()});var Br={};et(Br,{ANALYTICS_EVENTS:()=>yt,ApiError:()=>F,InploiRpcClient:()=>Z,JOB_ALERT_FREQUENCIES:()=>He,NotFoundError:()=>B,ParsingError:()=>M,SchemaValidationError:()=>k,SdkError:()=>Re,UnauthorisedError:()=>U,addressSearchCountry:()=>en,blendAddressSuggestions:()=>Ze,consentStorageKey:()=>ge,createPlugin:()=>nt,createTalentBankClient:()=>zt,endpoint:()=>ne,generateUUID:()=>Y,getConsentAcceptance:()=>St,getJobCountries:()=>Ye,getOrCreateAnonymousId:()=>je,hashConsentConfig:()=>me,initialiseSdk:()=>bt,inploiBrandedLogger:()=>pe,isApiErrorWithData:()=>rt,isSdkError:()=>it,jobCountryCodes:()=>We,noLogging:()=>de,ready:()=>Yt,saveClosedRoleJobAlerts:()=>Zt,saveSearchEndpoint:()=>Ke,searchAddressSuggestions:()=>tn,setConsentAcceptance:()=>_t,typed:()=>O,validateEndpointInputs:()=>Le});module.exports=dn(Br);var ce="%c[inploi SDK]",le="color: #65BC67; font-weight: bold;",pe={warn:(...t)=>console.warn(ce,le,...t),error:(...t)=>console.error(ce,le,...t),info:(...t)=>console.info(ce,le,...t),log:(...t)=>console.log(ce,le,...t)},de={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var nt=t=>t;function Ie(t,n){if(!t)throw new Error(n)}function z(t,n){return n in t}var Kr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var un="Unauthenticated",vn="This action is unauthorized.",N=class extends Error{constructor(o,s){super(o);this.status=s,this.name="ErrorWithStatus"}},B=class extends N{constructor(n){super(n??"Not found"),this.name="NotFoundError",this.status=404}},U=class extends N{constructor(n,o){super(n??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=o??401}},k=class extends N{constructor(o,s){let l=s?` in ${s}`:"";super(`Schema validation failed${l}`);this.issues=o;this.source=s;this.name="SchemaValidationError",this.status=400}},F=class extends N{constructor(o,s,l){super(o);this.data=l;this.name="ApiError",this.status=s??500}},rt=t=>t instanceof F&&t.data!==void 0,M=class extends N{constructor(o){super("Error parsing response into JSON.");this.response=o;this.name="ParsingError",this.status=o&&o.status>=300?o.status:500,this.contentType=new Headers(o?.headers).get("content-type")??void 0}};async function we(t){let o=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(o&&o!=="application/json"&&!o.endsWith("+json"))throw new M(t);return t.json().catch(()=>{throw new M(t)})}var mn=["message","error","errors","exception","exceptions"];function gn(t){let n=[];if(typeof t=="object"&&t!==null){for(let o of mn)if(z(t,o)){let s=t[o];typeof s=="string"&&n.push(s),Array.isArray(s)&&s.every(l=>typeof l=="string")&&n.push(...s)}z(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&z(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&z(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 ke(t,n){if(n>=300){let o=gn(t);throw n===404?new B(o):o===un?new U("You are not authenticated.",n):o===vn?new U(o,n):new F(o,n,t)}}var ot=t=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(o,s={})=>{let l={...s,headers:{...s.headers,...n}},p=await fetch(`${t.baseUrl}${o}`,l);if(p.status===404)throw new B;let u=await we(p);return ke(u,p.status),u}}},Re={NotFound:B,Unauthorised:U,SchemaValidation:k,Api:F,JsonParsing:M};function it(t){return Object.values(Re).some(n=>t instanceof n)}var st="3.1.2";var ue={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},at={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},ct=st;var j="isdk_session",lt=`${j}-candidate_id`,pt=`${j}-consent`;var ve=new Map,Pe={get:t=>{if(ve.has(t))return ve.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,n)=>{try{window.sessionStorage.setItem(t,n),ve.delete(t)}catch{ve.set(t,n)}}};var Y=()=>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 ut=7*24*60*60*1e3,vt=t=>{let n=new Date;return n.setTime(n.getTime()+ut),`${j}=${t};expires=${n.toUTCString()};path=/`},fn=(t,n)=>{let o=t.get("session_id");if(n||o)return o;let s=Pe.get(`${j}-session_id`);return typeof s=="string"?s:null},bn=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(lt);return typeof t=="string"&&t!==""?t:null}catch{return null}},yn=new RegExp(`(?:^|;\\s*)${j}=([^;]+)`),te=t=>{let n=t?t.headers.get("cookie"):document.cookie;return n?yn.exec(n)?.[1]??null:null},mt=()=>{try{let t=JSON.parse(window.localStorage.getItem(j)??"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}},dt=()=>te()??(new URL(location.href).searchParams.get("anonymous_id")?null:mt()),Sn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",gt=t=>{if(document.cookie=vt(t)+Sn(),te()!==t)try{window.localStorage.setItem(j,JSON.stringify({id:t,expires:Date.now()+ut}))}catch{}},Ce=t=>{let n=t?t.url:location.href,{searchParams:o}=new URL(n);return{anonymous_id:t?te(t)??o.get("anonymous_id"):te()??o.get("anonymous_id")??mt(),session_id:fn(o,typeof window>"u")}},je=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Ce().anonymous_id;if(t)return t;let n=Y(),o=Ce().anonymous_id;return o||(gt(n),n)},_n=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},xn=t=>t==="about:client"?"":t,An={pathname:"/log",method:"POST",schema:{response:O(),body:O()}},ht=({rpcClient:t,logger:n,onEvent:o,persistence:s="device",siteKind:l})=>{let p=null,u=null,m=0,S=0,I=d=>s==="none"?{anonymous_id:null,session_id:d?null:p}:Ce(d),K=async(d,b,ie)=>{try{let W={library:{name:"inploi-sdk",version:ct},page:b},ee=I(d.request),se=s==="none"?null:bn(),y={anonymous_id:ee.anonymous_id,session_id:ee.session_id,candidate_id:se,event:d.event,sent_at:new Date().toISOString(),context:W,properties:d.properties,custom_properties:{...d.customProperties,...ie}},Ae=s==="none"?null:d.request?te(d.request):dt(),Qe=++m,nn=await t.request(An,{body:y,...d.keepalive&&{keepalive:!0}}),w=_n(nn);if(s==="none")return!d.request&&w?.session_id&&Qe>S&&(S=Qe,w.session_id!==y.session_id&&(p=w.session_id)),y.session_id=d.request?w?.session_id||null:p,o?.(y),{success:!0,data:y};let Te=d.request?Ae:dt(),rn=Te!==null&&Te!==Ae,Ee=Te??Ae,Xe=!rn&&(!Ee||!w?.anonymous_id||Ee===w.anonymous_id);return Xe?(w?.anonymous_id&&(y.anonymous_id=w.anonymous_id),w?.session_id&&(y.session_id=w.session_id)):y.anonymous_id=Ee,!d.request&&typeof window<"u"&&y.anonymous_id&&(Xe&&y.session_id&&Pe.set(`${j}-session_id`,y.session_id.toString()),gt(y.anonymous_id)),o?.(y),{success:!0,data:y}}catch(W){return n.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:W}}},D=Promise.resolve();return{log:async d=>{Ie(d.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let b="request"in d&&d.request?{href:d.request.url,referrer:xn(d.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(d.page_context==="no_query"){let se=new URL(b.href),y=b.referrer?new URL(b.referrer):void 0;b={href:se.origin+se.pathname,referrer:y?y.origin+y.pathname:""}}s==="none"&&d.event==="FLOW_NODE"&&d.properties&&"trigger"in d.properties&&(d.properties.trigger==="pagehide"||d.properties.trigger==="hidden")&&(d={...d,keepalive:!0});let ie={event_id:Y(),consent_lane:s,site_kind:l};if(s==="device"||d.request||p||d.keepalive)return K(d,b,ie);let W=()=>K(d,b,ie),ee=D.then(W,W);return D=ee,ee},supportsNoQueryPageContext:!0,getHeaders:d=>{let b=new Headers;return s==="none"||!d?.anonymous_id||b.append("Set-Cookie",vt(d.anonymous_id)),b},getSessionInfo:I,getOrCreateAnonymousId:()=>s==="none"?u??(u=Y()):je()}};var ft=require("neoqs");function Oe(t,n,o){let s=t["~standard"].validate(n);if(s instanceof Promise)throw new TypeError("Async schema");if(s.issues)throw new k(s.issues,o);return s.value}function Tn(t,n,o){try{return{success:!0,output:Oe(t,n,o)}}catch(s){if(s instanceof k)return{success:!1,issues:s.issues,source:s.source};throw s}}var Z=class{constructor(n){if(this.baseUrl=ue[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,o){let s=o.validateIn??!0,{searchParams:l,body:p}=s?Le(n,o):o,u=new URL(this.baseUrl),m=n.pathname;if("params"in o&&o.params)for(let[S,I]of Object.entries(o.params))m=m.replace(`:${S}`,String(I));return u.pathname=m,n.schema.searchParams&&(u.search=(0,ft.stringify)(l)),[u.toString(),{method:n.method,body:p?JSON.stringify(p):void 0,headers:this.headers,signal:o.signal,...o.keepalive&&{keepalive:!0}}]}async parseResponse(n,o){let s=await we(o.response);if(ke(s,o.response.status),!(o.validateOut??!0))return s;let p=Tn(n.schema.response,s,"response");if(!p.success)throw new k(p.issues,p.source);return p.output}async request(n,o){try{let s=this.getFetchParams(n,o),l=await fetch(...s);return await this.parseResponse(n,{response:l,validateOut:o.validateOut})}catch(s){throw s instanceof k?this.logger.error(s.message,s.issues):this.logger.error(s),s}}};function O(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function ne(t){return t}function Le(t,n){let o={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(o.searchParams=Oe(t.schema.searchParams,"searchParams"in n?n.searchParams:{})),t.schema.body&&(o.body=Oe(t.schema.body,"body"in n?n.body:{})),o}function bt({publishableKey:t,env:n,logger:o=pe,onEvent:s,persistence:l,siteKind:p}){let u=ot({baseUrl:ue[n],publishableKey:t}),m=o===!1?de:o,S=new Z({environment:n,apiKey:{type:"publishable",key:t},logger:m}),I=ht({rpcClient:S,logger:m,onEvent:s,persistence:l,siteKind:p});return{register:D=>D({logger:m,apiClient:u,analytics:I,rpcClient:S,publishableKey:t,env:n}),analytics:I,apiClient:u}}var yt={VIEW_PAGE:"A careers-site page shown (not a job page).",VIEW_JOB:"A job's own page shown; one per job id the page names.",PAGE_ENGAGEMENT:"A page view's attention summary, sent when the view is hidden or left.",VIEW_SEARCH:"A job search seen for two seconds.",SEARCH_SETTLE:"A searched query or filter with results, unchanged for five seconds.",SEARCH_RESULTS:"A search whose results returned, zero included; once per distinct query, filters, place and order.",SEARCH_PAGINATE:"A move to another page of search results.",SEARCH_JOB_CLICK:"A job opened from search results.",SAVE_JOB:"A job saved or unsaved by the candidate.",LINK_CLICK:"A tracked link clicked.",INTERACTION:"A tagged interaction (`tag` names it).",FLOW_START:"An application flow started.",FLOW_INTERACT:"The candidate's first answer in a flow.",FLOW_END:"An application flow ended.",FLOW_NODE:"The candidate's path through an application, summarised when it pauses or ends.",FLOW_SUBMIT:"An application submitted, with the outcome.",FLOW_REDIRECT:"A flow sent the candidate to an external apply page.",FEEDBACK:"A rating or comment.",ADDRESS_SHADOW_COMPARED:"Engineering telemetry: the address lookup's shadow comparison.",SUBMIT_FORM:"Declared but sent by nothing."};function me(t){let n=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),o=5381;for(let s=0;s<n.length;s++)o=o*33^n.charCodeAt(s);return(o>>>0).toString(36)}function ge(t,n){return`${pt}:${t}:${n}`}function St(t,n){if(typeof window>"u")return!1;try{let o=ge(t,me(n));return window.localStorage.getItem(o)==="accepted"}catch{return!1}}function _t(t,n){if(!(typeof window>"u"))try{let o=ge(t,me(n));window.localStorage.setItem(o,"accepted")}catch{}}var a=E(require("valibot"),1),En=["agent","sdk","form","integration","migration"],In=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var wn=["screening","cv_match","interview","overall"],kn=["PENDING","IN_PROGRESS","COMPLETED","CANCELLED"],Rn=["agent"],Pn=["job","company"],Cn=["created_at","updated_at","score","interview_score"],jn=["asc","desc"],On=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Ln=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written","ats_submission_attempted","ats_submission_succeeded","ats_submission_failed","ats_retry_payload_purged","note","share","verdict","offer_terms","offer_sent","offer_accepted","offer_declined","offer_withdrawn","exported","message_held","message_sent","message_delivered","message_failed","message_uncertain","message_cancelled","message_not_sent","score_override"],Dn=["interview","not_for_me"],xt=a.picklist(Dn),Nn=["accept","reject"],At=a.picklist(Nn),Bn=["transient_pass_through","failed_ats_submission_hold","retention","erasure","demo_reset"],wo=a.picklist(Bn),Un=["pending","submitted","failed","not_required"],Fn=["user","system","automation","integration","candidate"],he=a.picklist(En),R=a.picklist(In),A=a.pipe(a.string(),a.trim(),a.minLength(1),a.maxLength(100)),fe=a.picklist(wn),Tt=a.picklist(kn),Et=a.picklist(Rn),It=a.picklist(Pn),wt=a.picklist(Cn),kt=a.picklist(jn),re=a.pipe(a.string(),a.trim(),a.minLength(1),a.maxLength(100)),be=a.picklist(On),De=a.picklist(Ln),Rt=a.picklist(Fn),q=a.picklist(Un);var h=a.variant("type",[a.object({type:a.literal("user"),id:a.pipe(a.string(),a.minLength(1)),email:a.pipe(a.string(),a.minLength(1)),name:a.pipe(a.string(),a.minLength(1))}),a.object({type:a.literal("system"),id:a.pipe(a.string(),a.minLength(1)),name:a.optional(a.string())}),a.object({type:a.literal("automation"),id:a.pipe(a.string(),a.minLength(1)),name:a.optional(a.string())}),a.object({type:a.literal("integration"),id:a.pipe(a.string(),a.minLength(1)),name:a.optional(a.string())}),a.object({type:a.literal("candidate"),id:a.pipe(a.string(),a.minLength(1)),email:a.optional(a.string())})]);var P=E(require("valibot"),1),Mn=P.object({total:P.number(),page:P.number(),perPage:P.number(),lastPage:P.number()});function Pt(t){return P.object({data:P.array(t),pagination:Mn})}var i=E(require("valibot"),1);function Ct(t){return/^\p{Zs}*\(?\p{Zs}*(\+|00)[\p{Zs}().-]*\d/u.test(t)}var Ne=i.object({id:i.string(),email:i.nullable(i.string()),firstName:i.nullable(i.string()),lastName:i.nullable(i.string()),phone:i.nullable(i.string()),source:i.nullable(he),identifiedAt:i.nullable(i.string()),createdAt:i.string(),updatedAt:i.string()}),qn=i.pipe(i.string(),i.trim(),i.minLength(1)),jt=64*1024,oe=i.pipe(i.string(),i.trim(),i.minLength(1),i.maxLength(500)),Vn=i.pipe(i.string(),i.regex(/^[A-Z]{2}$/)),Gn=i.pipe(i.string(),i.maxLength(500),i.check(t=>Ct(t.trim()),"phone must start with its country code (+ or 00)")),$n=i.pipe(i.string(),i.regex(/^[\w:-]+$/)),Jn=new Set(["__proto__","constructor","prototype"]),Hn=i.custom(t=>Yn(t),"custom answer must be a JSON value"),Oo=i.strictObject({firstName:i.nullable(i.string()),lastName:i.nullable(i.string()),email:i.string(),phone:i.nullable(i.string()),country:i.nullable(i.string()),postcode:i.nullable(i.string()),currentTitle:i.nullable(i.string()),currentEmployer:i.nullable(i.string()),custom:i.record(i.string(),i.unknown())});var Ot=i.strictObject({firstName:i.optional(oe),lastName:i.optional(oe),phone:i.optional(i.nullable(Gn)),country:i.optional(i.nullable(Vn)),postcode:i.optional(i.nullable(oe)),currentTitle:i.optional(i.nullable(oe)),currentEmployer:i.optional(i.nullable(oe)),custom:i.optional(i.pipe(i.custom(t=>Be(t)&&Object.keys(t).every(n=>!Jn.has(n))&&Zn(t)<=jt,`custom must be a JSON object of at most ${jt} bytes`),i.record($n,i.nullable(Hn))))}),Kn=i.pipe(i.custom(t=>Be(t)&&Object.keys(t).every(n=>Object.hasOwn(Ot.entries,n)),"set must be an object of profile fields"),Ot),Wn=i.strictObject({email:qn}),Lo=i.strictObject({identity:Wn,set:Kn,ifVersion:i.optional(i.pipe(i.number(),i.integer(),i.minValue(0))),disclosures:i.optional(i.unknown())}),zn=i.strictObject({noticeId:i.pipe(i.string(),i.minLength(1),i.maxLength(200)),version:i.pipe(i.string(),i.minLength(1),i.maxLength(64)),wordingHash:i.pipe(i.string(),i.minLength(1),i.maxLength(128))}),Do=i.variant("withdrawTalentPool",[i.strictObject({withdrawTalentPool:i.literal(!1)}),i.strictObject({withdrawTalentPool:i.literal(!0),notice:zn})]);function Be(t){if(typeof t!="object"||t===null)return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function Yn(t){try{return Lt(t,JSON.parse(JSON.stringify(t)))}catch{return!1}}function Lt(t,n){if(t===n)return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null||Array.isArray(t)!==Array.isArray(n)||!Array.isArray(t)&&!Be(t))return!1;let o=Object.keys(t);return o.length!==Object.keys(n).length?!1:o.every(s=>Object.hasOwn(n,s)&&Lt(t[s],n[s]))}function Zn(t){try{return new TextEncoder().encode(JSON.stringify(t)).length}catch{return Number.POSITIVE_INFINITY}}var r=E(require("valibot"),1);var f=E(require("valibot"),1),T=f.pipe(f.string(),f.minLength(1)),V=f.pipe(f.number(),f.integer(),f.minValue(1)),L=f.record(f.string(),f.unknown()),Qn="(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}",Bo=f.pipe(f.string(),f.regex(new RegExp(`^${Qn}$`)));var _=E(require("valibot"),1);var Dt=_.object({id:_.string(),applicationId:_.string(),status:Tt,conductedBy:Et,agentInterviewId:_.nullable(_.string()),generatedScore:_.nullable(_.number()),completedAt:_.nullable(_.string()),meta:_.nullable(L),createdAt:_.string(),updatedAt:_.string()});var Xn=r.object({quote:r.string(),source:r.picklist(["cv","answer"])}),Ue=r.object({score:r.number(),reason:r.string(),confidence:r.number(),share:r.optional(r.number()),evidence:r.optional(r.array(Xn))}),Fe=r.object({categoryId:r.string(),answerKey:r.string(),reason:r.picklist(["unanswered","unrecognised"])}),Nt=r.object({id:r.string(),candidateId:r.string(),jobId:r.number(),stage:A,stageGroup:R,stageEnteredAt:r.string(),rating:r.nullable(r.number()),disqualifiedAt:r.nullable(r.string()),disqualificationReason:r.nullable(re),disqualificationNote:r.nullable(r.string()),source:be,sourceDetail:r.nullable(r.string()),sessionId:r.nullable(r.number()),externalApplicationId:r.nullable(r.string()),meta:r.nullable(L),context:r.nullable(L),scoredAt:r.nullable(r.string()),atsSubmissionStatus:r.optional(r.nullable(q)),atsSubmissionAttempts:r.optional(r.number()),atsNextAttemptAt:r.optional(r.nullable(r.string())),atsSubmittedAt:r.optional(r.nullable(r.string())),atsLastErrorCode:r.optional(r.nullable(r.string())),atsLastErrorMessage:r.optional(r.nullable(r.string())),createdAt:r.string(),updatedAt:r.string()}),er=r.object({id:r.string(),applicationId:r.string(),scoreType:fe,score:r.nullable(r.number()),reason:r.nullable(r.string()),categories:r.nullable(r.record(r.string(),Ue)),leftOut:r.optional(r.array(Fe)),scoredBy:r.nullable(r.string()),createdAt:r.string()}),G=r.object({...Nt.entries,candidate:r.nullable(Ne),score:r.nullable(er),interview:r.nullable(Dt)}),Ho=r.object({...Ne.entries,applications:r.array(Nt)}),Bt=r.object({id:r.string(),applicationId:r.string(),action:De,fromStage:r.nullable(A),fromStageGroup:r.nullable(R),toStage:r.nullable(A),toStageGroup:r.nullable(R),disqualificationReason:r.nullable(re),disqualificationNote:r.nullable(r.string()),actorId:r.nullable(r.string()),actorType:Rt,actorEmail:r.nullable(r.string()),actorName:r.nullable(r.string()),meta:r.nullable(L),schemaVersion:r.number(),createdAt:r.string()}),tr=500,Ut=r.object({scoreId:r.pipe(r.string(),r.minLength(1),r.maxLength(255)),scoredBy:r.pipe(r.string(),r.regex(/^scoring:[^:\s]{1,128}:[^:\s]{1,128}$/)),decision:At,reason:r.pipe(r.string(),r.maxLength(tr),r.check(t=>t.trim().length>0,"reason must not be blank")),score:r.pipe(r.number(),r.finite())}),nr=500,rr=200,Ko=r.strictObject({from:r.pipe(r.string(),r.isoTimestamp()),to:r.pipe(r.string(),r.isoTimestamp()),jobIds:r.pipe(r.array(r.pipe(r.number(),r.integer(),r.minValue(1))),r.minLength(1),r.maxLength(nr)),actions:r.optional(r.pipe(r.array(De),r.minLength(1))),cursor:r.nullable(r.pipe(r.string(),r.regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\|.{1,255}$/))),limit:r.pipe(r.number(),r.integer(),r.minValue(1),r.maxValue(rr))});var g=E(require("valibot"),1);var Ft=g.object({anonymousId:T,email:T,firstName:g.nullish(g.string()),lastName:g.nullish(g.string()),phone:g.nullish(g.string()),source:g.nullish(he),updateExisting:g.optional(g.boolean())}),Me=g.object({candidateId:g.string(),isNew:g.boolean()}),Zo=g.union([g.object({ok:g.literal(!0)}),Me]);var e=E(require("valibot"),1);var or=["note","share","verdict","offer_terms","offer_sent","offer_accepted","offer_declined","offer_withdrawn","exported","score_override"],ir=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate",...or],Se=e.picklist(ir),qe=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>n.trim()).filter(n=>n.length>0))),sr=e.pipe(qe,e.array(A)),ar=e.pipe(qe,e.array(R)),Mt=e.pipe(e.string(),e.transform(t=>t.split(",").map(n=>Number(n.trim())).filter(n=>Number.isInteger(n)&&n>0))),cr=e.pipe(qe,e.array(q)),qt=e.object({stages:e.optional(sr),stage_groups:e.optional(ar),job_id:e.optional(e.string()),job_ids:e.optional(Mt),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),ats_submission_status:e.optional(cr),sort:e.optional(wt),order:e.optional(kt),page:e.optional(e.string()),per_page:e.optional(e.string())}),Q=e.pipe(T,e.maxLength(255)),lr=e.object({status:e.picklist(["pending","not_required"]),integrationId:e.nullish(Q)}),ri=e.pipe(e.object({candidateId:T,disclosures:e.optional(e.unknown()),jobLocation:e.optional(e.unknown()),jobId:V,meta:e.nullish(L),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),externalJobId:e.nullish(e.pipe(T,e.maxLength(255))),context:e.nullish(L),source:e.nullish(be),sourceDetail:e.nullish(e.string()),stage:e.nullish(A),stageGroup:e.nullish(R),actor:e.nullish(h),atsSubmission:e.nullish(lr),duplicateScope:e.nullish(e.picklist(["job","attempt"]))}),e.check(t=>t.stage==null==(t.stageGroup==null),"stage and stageGroup must be supplied together"),e.check(t=>t.duplicateScope!=="attempt"||typeof t.meta?.attempt_id=="string"&&t.meta.attempt_id!=="","duplicateScope attempt needs meta.attempt_id")),Vt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),oi=e.union([e.object({ok:e.literal(!0),duplicate:e.literal(!1),applicationId:e.string(),candidateId:e.string(),atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!0),duplicate:e.literal(!0),existingApplication:Vt,atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!1),refused:e.literal("pass_through_untracked")})]),Gt=e.object({email:e.pipe(e.string(),e.minLength(1),e.maxLength(320)),scope:e.optional(It,"job"),jobId:e.optional(e.union([e.string(),e.number()]))}),$t=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(Vt)}),pr=Date.UTC(1e4,0,1),Jt=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})$/),e.check(t=>{let[n,o,s]=t.slice(0,10).split("-").map(Number),l=new Date(Date.UTC(n,o-1,s)),p=Date.parse(t);return l.getUTCMonth()===o-1&&l.getUTCDate()===s&&p>=0&&p<pr},"must be a real time")),Ve=e.pipe(e.string(),e.regex(/^[A-Za-z0-9_.:-]{1,100}$/)),ii=e.object({status:e.picklist(["pending","submitted","failed"]),nextAttemptAt:e.nullish(Jt),errorCode:e.nullish(Ve),errorMessage:e.nullish(e.pipe(e.string(),e.maxLength(1e4))),externalApplicationId:e.nullish(Q),externalRunId:e.nullish(Q),integrationId:e.nullish(Q),answeredPending:e.optional(e.boolean())}),dr=e.picklist(["invalid_transition","next_attempt_required","retry_hold_expired"]),si=e.variant("kind",[e.object({kind:e.literal("recorded"),application:G}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),to:q,reason:dr})]),ur=e.object({integrationId:e.string(),state:e.picklist(["closed","open","half_open"]),coolingUntil:e.nullable(e.string()),transientCount:e.number(),held:e.boolean()}),ai=e.object({groups:e.array(e.object({integrationId:e.nullable(e.string()),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),count:e.number(),retryable:e.number(),sendable:e.optional(e.number()),nextRetryUntil:e.optional(e.nullable(e.string()))})),oldestPendingAgeSeconds:e.nullable(e.number()),breakers:e.array(ur),restoreHold:e.optional(e.boolean())}),ci=e.object({status:e.picklist(["pending","failed"]),integrationId:e.nullable(Q),errorCode:e.nullable(Ve)}),li=e.object({rows:e.array(e.object({id:e.string(),jobId:e.number(),status:e.picklist(["pending","failed"]),errorCode:e.nullable(e.string()),errorMessage:e.nullable(e.string()),attempts:e.number(),nextAttemptAt:e.nullable(e.string()),payloadHeld:e.boolean(),receivedAt:e.nullable(e.string()),retryUntil:e.nullable(e.string()),updatedAt:e.string()})),truncated:e.boolean()}),pi=e.object({actor:h,expectedAtsLogCount:e.optional(e.pipe(e.number(),e.integer(),e.minValue(0)))}),vr=e.picklist(["invalid_transition","retry_payload_missing","retry_hold_expired","stale"]),di=e.variant("kind",[e.object({kind:e.literal("retried"),application:G}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(q),reason:vr})]),ui=e.object({status:e.optional(e.picklist(["pending","failed"])),integrationId:e.nullable(Q),errorCode:e.nullable(Ve),actor:h}),vi=e.object({retried:e.number()});var mi=e.object({integrationId:e.string(),wasOpen:e.boolean()}),gi=e.object({integrationId:e.string(),wasHeld:e.boolean()}),hi=e.object({applicationId:T,scoreType:fe,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Ue)),leftOut:e.nullish(e.array(Fe)),scoredBy:e.nullish(e.string()),actor:e.nullish(h),idempotencyKey:e.nullish(e.pipe(e.string(),e.maxLength(255)))}),fi=e.object({scoreId:e.string()}),bi=Pt(G);var yi=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),Si=e.array(Bt),ye=e.object({stage:e.nullish(A),note:e.nullish(e.string())}),mr=e.object({stage:e.nullish(A),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),gr=e.pipe(e.string(),e.regex(/^[a-z0-9_.:-]{1,64}$/));var $=e.pipe(e.object({mode:e.picklist(["send","hold","none"]),templateKey:e.pipe(e.string(),e.regex(/^(received|rejection|interest_confirmation|campaign:invite|stage:[a-z0-9_-]{1,48})$/)),templateVersion:e.pipe(e.number(),e.integer(),e.minValue(1)),configVersionId:T,voice:e.optional(e.picklist(["casual","formal"])),holdUntil:e.optional(e.pipe(Jt,e.endsWith("Z","must be UTC with a Z suffix"),e.check(t=>Date.parse(t)>Date.now(),"must be in the future"))),subject:e.optional(e.pipe(e.string(),e.maxLength(200))),body:e.optional(e.pipe(e.string(),e.maxLength(2e4)))}),e.check(t=>t.mode==="hold"||t.holdUntil===void 0,"holdUntil is only for hold mode"),e.transform(({subject:t,body:n,...o})=>({...o,...t===void 0||t===""?{}:{subject:t},...n===void 0||n===""?{}:{body:n}}))),hr=e.variant("action",[e.object({action:e.literal("note"),actor:h,message:e.optional(e.never()),meta:e.object({note:T})}),e.object({action:e.literal("share"),actor:h,message:e.optional(e.never()),meta:e.object({subjectUserIds:e.pipe(e.array(T),e.minLength(1),e.maxLength(20)),comment:e.optional(e.string())})}),e.object({action:e.literal("verdict"),actor:h,message:e.optional(e.never()),meta:e.object({code:xt,comment:e.optional(e.string())})}),e.object({action:e.literal("offer_terms"),actor:h,message:e.optional(e.never()),meta:e.object({salary:e.optional(e.string()),startDate:e.optional(e.string()),hours:e.optional(e.string())})}),...["offer_sent","offer_accepted","offer_declined","offer_withdrawn"].map(t=>e.object({action:e.literal(t),actor:h,message:e.optional(e.never()),meta:e.object({reason:e.optional(e.string())})})),e.object({action:e.literal("exported"),actor:h,message:e.optional(e.never()),meta:e.object({presetId:gr,exportId:T})}),e.object({action:e.literal("score_override"),actor:h,message:e.optional(e.never()),meta:e.pipe(Ut,e.transform(t=>({...t,reason:t.reason.trim()})))})]),fr=e.variant("action",[hr,e.object({action:e.literal("shortlist"),actor:h,message:e.optional($),meta:e.nullish(ye)}),e.object({action:e.literal("move_to_interview"),actor:h,message:e.optional($),meta:e.nullish(ye)}),e.object({action:e.literal("make_offer"),actor:h,message:e.optional($),meta:e.nullish(ye)}),e.object({action:e.literal("hire"),actor:h,message:e.optional($),meta:e.nullish(mr)}),e.object({action:e.literal("withdraw"),actor:h,message:e.optional(e.never()),meta:e.nullish(ye)}),e.object({action:e.literal("move_to_stage"),actor:h,message:e.optional(e.never()),meta:e.object({stage:A,stageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:h,message:e.optional($),meta:e.object({toStage:A,toStageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:h,message:e.optional($),meta:e.object({reason:re,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:h,message:e.optional($),meta:e.object({toStage:A,toStageGroup:R,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:h,message:e.optional(e.never()),meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),_i=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:fr}),Ht=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),xi=e.variant("kind",[e.object({kind:e.literal("updated"),action:Se,application:G}),e.object({kind:e.literal("skipped"),action:Se,applicationId:e.string(),reason:Ht})]),Ai=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:Se,application:G})),skipped:e.array(e.object({kind:e.literal("skipped"),action:Se,applicationId:e.string(),reason:Ht})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),v=e.pipe(e.number(),e.integer(),e.minValue(0)),Kt=e.object({APPLIED:v,SHORTLISTED:v,INTERVIEWED:v,OFFERED:v,HIRED:v,REJECTED:v,WITHDRAWN:v}),br=e.pipe(e.string(),e.minLength(1),e.maxLength(255)),Ti=e.object({pendingShares:e.optional(e.boolean())}),Ei=e.object({job_ids:Mt,verdict_by:e.optional(br),pending_shares:e.optional(e.literal("1"))}),Ii=e.object({counts:e.record(e.string(),Kt),existingAppliedCounts:e.optional(e.record(e.string(),v)),awaitingVerdictCounts:e.optional(e.record(e.string(),v)),pendingShareCounts:e.optional(e.record(e.string(),v))}),wi=e.omit(qt,["sort","order","page","per_page"]),ki=e.object({counts:Kt}),Wt=92,yr=864e5,C=e.pipe(e.string(),e.regex(/^\d{4}-\d{2}-\d{2}$/),e.check(t=>{let n=new Date(`${t}T00:00:00Z`);return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===t},"must be a real calendar day"));function Ge({from:t,to:n}){let o=(Date.parse(`${n}T00:00:00Z`)-Date.parse(`${t}T00:00:00Z`))/yr+1;return o>=1&&o<=Wt}var $e=`to must be on or after from, and the range must span at most ${Wt} days`,Ri=e.pipe(e.object({from:C,to:C}),e.check(Ge,$e)),Sr=e.object({job_id:V,date:C,received:v,scored:v,shortlisted:v}),Pi=e.object({rows:e.array(Sr)}),_r=5e3,Ci=e.pipe(e.object({from:C,to:C,jobIds:e.pipe(e.array(V),e.maxLength(_r))}),e.check(Ge,$e)),xr=e.object({job_id:V,date:C,received:v}),ji=e.object({rows:e.array(xr)}),Ar=5e3,Tr=e.pipe(e.object({from:C,to:C,jobIds:e.optional(e.pipe(e.array(V),e.maxLength(Ar)))}),e.check(Ge,$e)),Oi=e.pipe(e.object({from:e.string(),to:e.string(),job_ids:e.optional(e.string())}),e.transform(({from:t,to:n,job_ids:o})=>({from:t,to:n,jobIds:o===void 0?void 0:o===""?[]:o.split(",").map(s=>/^\d+$/.test(s.trim())?Number(s):Number.NaN)})),Tr),Je=e.pipe(e.array(v),e.length(5)),Er=e.object({received:v,scored:v,shortlisted:v,histogram:e.pipe(e.array(v),e.length(101)),median_lag_minutes:e.nullable(e.number()),scored_same_day:v}),Ir=e.object({job_id:V,received:v,scored:v,shortlisted:v,score_sum:e.number(),bands:Je}),wr=e.object({date:C,received:v,scored:v,score_sum:e.number(),bands:Je,scored_on_day:v}),kr=e.object({id:e.string(),label:e.nullable(e.string()),sum:e.number(),count:v}),Rr=e.object({template_id:e.string(),scored:v,criteria:e.array(kr)}),Li=e.object({totals:Er,by_job:e.array(Ir),by_day:e.array(wr),criteria:e.array(Rr)}),Pr=e.object({date:C,scored:v,bands:Je}),Di=e.object({rows:e.array(Pr)});var Ni=e.object({...e.omit(qt,["page","per_page"]).entries,per_group:e.optional(e.string())}),J=e.object({data:e.array(G),total:v}),Bi=e.object({board:e.object({APPLIED:J,SHORTLISTED:J,INTERVIEWED:J,OFFERED:J,HIRED:J,REJECTED:J,WITHDRAWN:J})});var X=E(require("valibot"));var zt=({environment:t,publishableKey:n,logger:o})=>{let s=at[t];return{async checkDuplicate(l){let p;try{p=X.parse(Gt,{email:l.email,scope:l.scope,...l.scope==="job"&&l.jobId!=null?{jobId:l.jobId}:{}})}catch{return o.error("[TalentBankClient] checkDuplicate input failed validation"),{isDuplicate:!1}}try{let u=await fetch(`${s}/applications/check-duplicate`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(p)});if(!u.ok)return o.error(`[TalentBankClient] checkDuplicate failed with status ${u.status}`),{isDuplicate:!1};let m=await u.json(),S=X.safeParse($t,m);return S.success?S.output:(o.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof m=="object"&&m!=null&&typeof m.isDuplicate=="boolean"?{isDuplicate:m.isDuplicate}:{isDuplicate:!1})}catch(u){return o.error("[TalentBankClient] checkDuplicate failed:",u),{isDuplicate:!1}}},async identify(l){try{if(!l.anonymousId)return o.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let p={email:l.email,firstName:l.firstName,lastName:l.lastName,phone:l.phone,anonymousId:l.anonymousId,source:l.source??"sdk"},u=X.safeParse(Ft,p);if(!u.success)return o.error("[TalentBankClient] identify received invalid input"),null;let m=await fetch(`${s}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":n},body:JSON.stringify(u.output)});if(!m.ok)return o.error(`[TalentBankClient] identify failed with status ${m.status}`),null;let S=X.safeParse(Me,await m.json());return S.success?S.output:(o.error("[TalentBankClient] identify returned an invalid response"),null)}catch(p){return o.error("[TalentBankClient] identify failed:",p),null}}}};function Yt(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var c=E(require("valibot"));var He=["DAILY","WEEKLY","MONTHLY"],Cr=c.record(c.string(),c.union([c.string(),c.array(c.string()),c.object({type:c.literal("provided"),lat:c.number(),lng:c.number(),radius:c.number(),unit:c.optional(c.picklist(["miles","km"])),label:c.optional(c.string())})])),jr={pathname:"/job/:id",method:"GET",schema:{response:c.object({id:c.number(),external_id:c.nullish(c.string()),city:c.nullish(c.string()),town:c.nullish(c.string()),category:c.nullish(c.string())})}};async function Zt(t,{contact:n,job:o}){let s={};if(o){let l=await t.request(jr,{params:{id:o.id}});if((o.id_type==="internal"?String(l.id):l.external_id)!==o.id)throw new Error("Job lookup returned a different role");for(let u of["city","town","category"]){let m=l[u]?.trim();m&&(s[u]=[m])}}await t.request(Ke,{body:{contact:n,alerts:"WEEKLY",filters:s}})}var Ke={pathname:"/search/save",method:"POST",schema:{response:O(),body:c.object({contact:c.object({email:c.pipe(c.optional(c.string()),c.string(),c.email()),first_name:c.optional(c.string()),last_name:c.optional(c.string())}),alerts:c.pipe(c.optional(c.string()),c.string(),c.picklist(He)),filters:Cr})}};var x=E(require("valibot"));var Ye=async t=>{let n={method:"GET",pathname:"/search/filters",schema:{response:x.pipe(x.object({country:x.optional(x.array(x.object({value:x.string()})),[])}),x.transform(({country:o})=>o.map(({value:s})=>s))),searchParams:O()}};return t.request(n,{searchParams:{filters:{country:null}}})},_e=new WeakMap,en=t=>(_e.has(t)||(_e.set(t,void 0),Ye(t).then(async n=>{let{jobCountryCodes:o}=await Promise.resolve().then(()=>(ze(),Xt));_e.set(t,o(n).join(",")||void 0)}).catch(()=>{})),_e.get(t)),Ze=(t,n)=>{let o=new Set,s=[];for(let l=0;l<Math.max(t.length,n.length);l++)for(let p of[t[l],n[l]]){if(!p)continue;let u=p.mapbox_id||p.full_address||[p.name,p.place_formatted].filter(Boolean).join(", ");if(!o.has(u)&&(o.add(u),s.push(p),s.length===5))return s}return s},Nr=600,tn=async(t,n,o)=>{if(o?.throwIfAborted(),!n){let s=await t();return o?.throwIfAborted(),s}return new Promise((s,l)=>{let p,u,m,S=!1,I=()=>{S=!0,clearTimeout(m),o?.removeEventListener("abort",K)},K=()=>{I(),l(o?.reason)},D=()=>{I(),p?.status==="fulfilled"&&u?.status==="fulfilled"?s(Ze(p.value,u.value)):p?.status==="fulfilled"?s(p.value):u?.status==="fulfilled"?s(u.value):p?.status==="rejected"&&l(p.reason)},xe=(d,b)=>{S||(d?p=b:u=b,p&&u?D():b.status==="fulfilled"&&b.value.length>0&&(m=setTimeout(D,Nr)))};o?.addEventListener("abort",K,{once:!0});for(let d of[!0,!1])t(d?n:void 0).then(b=>xe(d,{status:"fulfilled",value:b}),b=>xe(d,{status:"rejected",reason:b}))})};ze();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
|