@inploi/sdk 3.1.1 → 3.1.3
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/{chunk-KC7FKSIJ.mjs → chunk-U6WFJKHV.mjs} +3 -3
- package/dist/chunk-U6WFJKHV.mjs.map +1 -0
- 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/dist/sdk.country-codes-R6CUZ3IG.mjs +2 -0
- package/package.json +4 -3
- package/dist/chunk-KC7FKSIJ.mjs.map +0 -1
- package/dist/sdk.country-codes-W6HRF5SA.mjs +0 -2
- /package/dist/{sdk.country-codes-W6HRF5SA.mjs.map → sdk.country-codes-R6CUZ3IG.mjs.map} +0 -0
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 je=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(je)for(var n of je(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.3";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,w,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,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 j=c?String(r).replace(/\./g,"%2E"):String(r),z=t&&P(y)&&y.length===1?j+"[]":j;if(i&&P(y)&&y.length===0)return z+"[]";for(let g=0;g<h.length;++g){let C=h[g],De=typeof C=="object"&&typeof C.value!="undefined"?C.value:y[C];if(u&&De===null)continue;let se=l&&c?C.replace(/\./g,"%2E"):C,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,w,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(),_({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 Cn(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,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:Dn(e.reference,s.lang))!=null?w:p?Cn(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 jn=/^[\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:jn,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(_({},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){}},Ce=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=Ce().anonymous_id;if(e)return e;let r=Y(),n=Ce().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}:Ce(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)},R=t==="none"?null:a.request?Z(a.request):Ze(),K=++c,J=yield e.request(Kn,_({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 j=a.request?R:Ze(),z=j!==null&&j!==R,g=j!=null?j:R,C=!z&&(!g||!(h!=null&&h.anonymous_id)||g===h.anonymous_id);return C?(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&&(C&&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(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: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(_({},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;})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"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"},o={lincolnshire:"gb",surrey:"gb"},g=`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`,
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
vnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`,r,i=()=>{if(r)return r;r=new Map;let s=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let t of g.split(/\s+/)){let n=t.slice(0,2),e=s.of(n.toUpperCase());e&&r.set(e.toLowerCase(),n),r.set(n,n),r.set(t.slice(2),n)}return r},a=(s,t)=>Object.prototype.hasOwnProperty.call(s,t)?s[t]:void 0,m=s=>{let t=s.trim().toLowerCase(),n=a(c,t);if(n)return n;let e=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(t)?t.slice(0,2):t;return i().get(e)},l=s=>m(s)?.toUpperCase(),b=s=>[...new Set(s.flatMap(n=>a(o,n.trim().toLowerCase())??m(n)??[]))].sort();export{l as a,b};
|
|
14
|
+
//# sourceMappingURL=chunk-U6WFJKHV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk.country-codes.ts"],"sourcesContent":["/** Names for a country that are not its English name. */\nconst COUNTRY_ALIASES: Record<string, string> = {\n\tuk: 'gb',\n\t'great britain': 'gb',\n\tengland: 'gb',\n\tscotland: 'gb',\n\twales: 'gb',\n\t'northern ireland': 'gb',\n\t'republic of ireland': 'ie',\n\teire: 'ie',\n\t'hong kong sar': 'hk',\n\t'united states of america': 'us',\n\tturkey: 'tr',\n\t'czech republic': 'cz',\n\tburma: 'mm',\n\t// Preserve Intl's existing Kosovo support without treating XK as an ISO subdivision prefix.\n\tkosovo: 'xk',\n\txk: 'xk',\n};\n\n/** Places below country level that one ATS feed gives as a job's country. Hub search only: never a job's country. */\nconst FEED_PLACE_ALIASES: Record<string, string> = {\n\t// County values observed in Kisimul's job feed; do not infer GB for other unknown place names.\n\tlincolnshire: 'gb',\n\tsurrey: 'gb',\n};\n\n/** All 249 ISO 3166-1 alpha-2 + alpha-3 pairs, packed to keep the browser table small.\n * Source: Unicode CLDR supplementalData.xml, territoryCodes (current ISO countries only).\n * https://raw.githubusercontent.com/unicode-org/cldr/main/common/supplemental/supplementalData.xml */\nconst ISO_COUNTRY_CODES = `adand aeare afafg agatg aiaia alalb amarm aoago aqata ararg asasm ataut auaus awabw axala azaze babih bbbrb bdbgd bebel\nbfbfa bgbgr bhbhr bibdi bjben blblm bmbmu bnbrn bobol bqbes brbra bsbhs btbtn bvbvt bwbwa byblr bzblz cacan cccck cdcod\ncfcaf cgcog chche ciciv ckcok clchl cmcmr cnchn cocol crcri cucub cvcpv cwcuw cxcxr cycyp czcze dedeu djdji dkdnk dmdma\ndodom dzdza ececu eeest egegy ehesh ereri esesp eteth fifin fjfji fkflk fmfsm fofro frfra gagab gbgbr gdgrd gegeo gfguf\nggggy ghgha gigib glgrl gmgmb gngin gpglp gqgnq grgrc gssgs gtgtm gugum gwgnb gyguy hkhkg hmhmd hnhnd hrhrv hthti huhun\nididn ieirl ilisr imimn inind ioiot iqirq irirn isisl itita jejey jmjam jojor jpjpn keken kgkgz khkhm kikir kmcom knkna\nkpprk krkor kwkwt kycym kzkaz lalao lblbn lclca lilie lklka lrlbr lslso ltltu lulux lvlva lylby mamar mcmco mdmda memne\nmfmaf mgmdg mhmhl mkmkd mlmli mmmmr mnmng momac mpmnp mqmtq mrmrt msmsr mtmlt mumus mvmdv mwmwi mxmex mymys mzmoz nanam\nncncl nener nfnfk ngnga ninic nlnld nonor npnpl nrnru nuniu nznzl omomn papan peper pfpyf pgpng phphl pkpak plpol pmspm\npnpcn prpri pspse ptprt pwplw pypry qaqat rereu rorou rssrb rurus rwrwa sasau sbslb scsyc sdsdn seswe sgsgp shshn sisvn\nsjsjm sksvk slsle smsmr snsen sosom srsur ssssd ststp svslv sxsxm sysyr szswz tctca tdtcd tfatf tgtgo ththa tjtjk tktkl\ntltls tmtkm tntun toton trtur tttto tvtuv twtwn tztza uaukr uguga umumi ususa uyury uzuzb vavat vcvct veven vgvgb vivir\nvnvnm vuvut wfwlf wswsm yeyem ytmyt zazaf zmzmb zwzwe`;\n\n/** Each country's lower-case English name, ISO2 and ISO3 code, mapped to its ISO2 code. */\nlet codesByName: Map<string, string> | undefined;\nconst countryCodesByName = () => {\n\tif (codesByName) return codesByName;\n\tcodesByName = new Map();\n\tconst names = new Intl.DisplayNames(['en'], { type: 'region', fallback: 'none' });\n\tfor (const pair of ISO_COUNTRY_CODES.split(/\\s+/)) {\n\t\tconst code = pair.slice(0, 2);\n\t\tconst name = names.of(code.toUpperCase());\n\t\tif (name) codesByName.set(name.toLowerCase(), code);\n\t\tcodesByName.set(code, code);\n\t\tcodesByName.set(pair.slice(2), code);\n\t}\n\treturn codesByName;\n};\n\nconst alias = (aliases: Record<string, string>, name: string) =>\n\tObject.prototype.hasOwnProperty.call(aliases, name) ? aliases[name] : undefined;\n\nconst toCountryCode = (value: string) => {\n\tconst name = value.trim().toLowerCase();\n\tconst aliased = alias(COUNTRY_ALIASES, name);\n\tif (aliased) return aliased;\n\tconst country = /^[a-z]{2}-[a-z0-9]{1,3}$/.test(name) ? name.slice(0, 2) : name;\n\treturn countryCodesByName().get(country);\n};\n\n/**\n * The upper-case ISO2 code of the country a value names: its English name, an ISO2, ISO3 or subdivision code in any\n * case, or another name for it (\"UK\", \"England\", \"Republic of Ireland\"). Undefined for anything else, including\n * places within a country (\"Essex\"): the caller never guesses.\n */\nexport const countryCodeOf = (value: string): string | undefined => toCountryCode(value)?.toUpperCase();\n\n/**\n * The countries a hub's location search covers, as the geocoder's ISO codes, read from the free text its live\n * jobs give as their country (\"United Kingdom\", \"England\", \"GB\", \"GBR\", \"GB-CMA\", \"Republic of Ireland\"). Values\n * that name no country are left out. The caller chooses its own fallback when none is left.\n */\nexport const jobCountryCodes = (jobCountries: string[]): string[] => {\n\tconst codes = new Set(\n\t\tjobCountries.flatMap(value => alias(FEED_PLACE_ALIASES, value.trim().toLowerCase()) ?? toCountryCode(value) ?? []),\n\t);\n\treturn [...codes].sort();\n};\n"],"mappings":"AACA,IAAMA,EAA0C,CAC/C,GAAI,KACJ,gBAAiB,KACjB,QAAS,KACT,SAAU,KACV,MAAO,KACP,mBAAoB,KACpB,sBAAuB,KACvB,KAAM,KACN,gBAAiB,KACjB,2BAA4B,KAC5B,OAAQ,KACR,iBAAkB,KAClB,MAAO,KAEP,OAAQ,KACR,GAAI,IACL,EAGMC,EAA6C,CAElD,aAAc,KACd,OAAQ,IACT,EAKMC,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uDAetBC,EACEC,EAAqB,IAAM,CAChC,GAAID,EAAa,OAAOA,EACxBA,EAAc,IAAI,IAClB,IAAME,EAAQ,IAAI,KAAK,aAAa,CAAC,IAAI,EAAG,CAAE,KAAM,SAAU,SAAU,MAAO,CAAC,EAChF,QAAWC,KAAQJ,EAAkB,MAAM,KAAK,EAAG,CAClD,IAAMK,EAAOD,EAAK,MAAM,EAAG,CAAC,EACtBE,EAAOH,EAAM,GAAGE,EAAK,YAAY,CAAC,EACpCC,GAAML,EAAY,IAAIK,EAAK,YAAY,EAAGD,CAAI,EAClDJ,EAAY,IAAII,EAAMA,CAAI,EAC1BJ,EAAY,IAAIG,EAAK,MAAM,CAAC,EAAGC,CAAI,CACpC,CACA,OAAOJ,CACR,EAEMM,EAAQ,CAACC,EAAiCF,IAC/C,OAAO,UAAU,eAAe,KAAKE,EAASF,CAAI,EAAIE,EAAQF,CAAI,EAAI,OAEjEG,EAAiBC,GAAkB,CACxC,IAAMJ,EAAOI,EAAM,KAAK,EAAE,YAAY,EAChCC,EAAUJ,EAAMT,EAAiBQ,CAAI,EAC3C,GAAIK,EAAS,OAAOA,EACpB,IAAMC,EAAU,2BAA2B,KAAKN,CAAI,EAAIA,EAAK,MAAM,EAAG,CAAC,EAAIA,EAC3E,OAAOJ,EAAmB,EAAE,IAAIU,CAAO,CACxC,EAOaC,EAAiBH,GAAsCD,EAAcC,CAAK,GAAG,YAAY,EAOzFI,EAAmBC,GAIxB,CAAC,GAHM,IAAI,IACjBA,EAAa,QAAQL,GAASH,EAAMR,EAAoBW,EAAM,KAAK,EAAE,YAAY,CAAC,GAAKD,EAAcC,CAAK,GAAK,CAAC,CAAC,CAClH,CACgB,EAAE,KAAK","names":["COUNTRY_ALIASES","FEED_PLACE_ALIASES","ISO_COUNTRY_CODES","codesByName","countryCodesByName","names","pair","code","name","alias","aliases","toCountryCode","value","aliased","country","countryCodeOf","jobCountryCodes","jobCountries"]}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var un=Object.create;var le=Object.defineProperty;var mn=Object.getOwnPropertyDescriptor;var gn=Object.getOwnPropertyNames;var hn=Object.getPrototypeOf,fn=Object.prototype.hasOwnProperty;var bn=(t,r)=>()=>(t&&(r=t(t=0)),r);var tt=(t,r)=>{for(var i in r)le(t,i,{get:r[i],enumerable:!0})},nt=(t,r,i,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of gn(r))!fn.call(t,p)&&p!==i&&le(t,p,{get:()=>r[p],enumerable:!(s=mn(r,p))||s.enumerable});return t};var w=(t,r,i)=>(i=t!=null?un(hn(t)):{},nt(r||!t||!t.__esModule?le(i,"default",{value:t,enumerable:!0}):i,t)),yn=t=>nt(le({},"__esModule",{value:!0}),t);var cn={};tt(cn,{countryCodeOf:()=>to,jobCountryCodes:()=>ze});var Qr,Zr,Xr,H,eo,sn,an,to,ze,Ye=bn(()=>{"use strict";Qr={uk:"gb","great britain":"gb",england:"gb",scotland:"gb",wales:"gb","northern ireland":"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"},Zr={lincolnshire:"gb",surrey:"gb"},Xr=`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`,eo=()=>{if(H)return H;H=new Map;let t=new Intl.DisplayNames(["en"],{type:"region",fallback:"none"});for(let r of Xr.split(/\s+/)){let i=r.slice(0,2),s=t.of(i.toUpperCase());s&&H.set(s.toLowerCase(),i),H.set(i,i),H.set(r.slice(2),i)}return H},sn=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)?t[r]:void 0,an=t=>{let r=t.trim().toLowerCase(),i=sn(Qr,r);if(i)return i;let s=/^[a-z]{2}-[a-z0-9]{1,3}$/.test(r)?r.slice(0,2):r;return eo().get(s)},to=t=>an(t)?.toUpperCase(),ze=t=>[...new Set(t.flatMap(i=>sn(Zr,i.trim().toLowerCase())??an(i)??[]))].sort()});var ro={};tt(ro,{ANALYTICS_EVENTS:()=>St,ApiError:()=>V,InploiRpcClient:()=>Z,JOB_ALERT_FREQUENCIES:()=>He,NotFoundError:()=>U,ParsingError:()=>q,SchemaValidationError:()=>C,SdkError:()=>Ce,UnauthorisedError:()=>F,addressSearchCountry:()=>ln,blendAddressSuggestions:()=>Ze,consentStorageKey:()=>fe,createPlugin:()=>rt,createTalentBankClient:()=>nn,endpoint:()=>ne,generateUUID:()=>Q,getConsentAcceptance:()=>_t,getJobCountries:()=>Qe,getOrCreateAnonymousId:()=>Le,hashConsentConfig:()=>he,initialiseSdk:()=>yt,inploiBrandedLogger:()=>ve,isApiErrorWithData:()=>ot,isSdkError:()=>st,jobCountryCodes:()=>ze,noLogging:()=>ue,ready:()=>rn,saveClosedRoleJobAlerts:()=>on,saveSearchEndpoint:()=>Ke,searchAddressSuggestions:()=>pn,setConsentAcceptance:()=>xt,typed:()=>L,validateEndpointInputs:()=>Ne});module.exports=yn(ro);var pe="%c[inploi SDK]",de="color: #65BC67; font-weight: bold;",ve={warn:(...t)=>console.warn(pe,de,...t),error:(...t)=>console.error(pe,de,...t),info:(...t)=>console.info(pe,de,...t),log:(...t)=>console.log(pe,de,...t)},ue={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var rt=t=>t;function ke(t,r){if(!t)throw new Error(r)}function Y(t,r){return r in t}var mo=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Sn="Unauthenticated",_n="This action is unauthorized.",B=class extends Error{constructor(i,s){super(i);this.status=s,this.name="ErrorWithStatus"}},U=class extends B{constructor(r){super(r??"Not found"),this.name="NotFoundError",this.status=404}},F=class extends B{constructor(r,i){super(r??"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=i??401}},C=class extends B{constructor(i,s){let p=s?` in ${s}`:"";super(`Schema validation failed${p}`);this.issues=i;this.source=s;this.name="SchemaValidationError",this.status=400}},V=class extends B{constructor(i,s,p){super(i);this.data=p;this.name="ApiError",this.status=s??500}},ot=t=>t instanceof V&&t.data!==void 0,q=class extends B{constructor(i){super("Error parsing response into JSON.");this.response=i;this.name="ParsingError",this.status=i&&i.status>=300?i.status:500,this.contentType=new Headers(i?.headers).get("content-type")??void 0}};async function Re(t){let i=new Headers(t.headers).get("content-type")?.replace(/;.*/,"").trim().toLowerCase();if(i&&i!=="application/json"&&!i.endsWith("+json"))throw new q(t);return t.json().catch(()=>{throw new q(t)})}var xn=["message","error","errors","exception","exceptions"];function An(t){let r=[];if(typeof t=="object"&&t!==null){for(let i of xn)if(Y(t,i)){let s=t[i];typeof s=="string"&&r.push(s),Array.isArray(s)&&s.every(p=>typeof p=="string")&&r.push(...s)}Y(t,"integration_response")&&typeof t.integration_response=="object"&&t.integration_response!==null&&Y(t.integration_response,"error")&&typeof t.integration_response.error=="object"&&t.integration_response.error!==null&&Y(t.integration_response.error,"message")&&typeof t.integration_response.error.message=="string"&&r.push(t.integration_response.error.message)}return r.length===0&&r.push("Unknown error"),[...new Set(r)].join(", ")}function Pe(t,r){if(r>=300){let i=An(t);throw r===404?new U(i):i===Sn?new F("You are not authenticated.",r):i===_n?new F(i,r):new V(i,r,t)}}var it=t=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":t.publishableKey};return{fetch:async(i,s={})=>{let p={...s,headers:{...s.headers,...r}},d=await fetch(`${t.baseUrl}${i}`,p);if(d.status===404)throw new U;let u=await Re(d);return Pe(u,d.status),u}}},Ce={NotFound:U,Unauthorised:F,SchemaValidation:C,Api:V,JsonParsing:q};function st(t){return Object.values(Ce).some(r=>t instanceof r)}var at="3.1.3";var me={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},ct={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},lt=at;var O="isdk_session",pt=`${O}-candidate_id`,dt=`${O}-consent`;var ge=new Map,je={get:t=>{if(ge.has(t))return ge.get(t)??null;try{return window.sessionStorage.getItem(t)}catch{return null}},set:(t,r)=>{try{window.sessionStorage.setItem(t,r),ge.delete(t)}catch{ge.set(t,r)}}};var Q=()=>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,mt=t=>{let r=new Date;return r.setTime(r.getTime()+ut),`${O}=${t};expires=${r.toUTCString()};path=/`},In=(t,r)=>{let i=t.get("session_id");if(r||i)return i;let s=je.get(`${O}-session_id`);return typeof s=="string"?s:null},En=()=>{if(typeof window>"u")return null;try{let t=window.localStorage.getItem(pt);return typeof t=="string"&&t!==""?t:null}catch{return null}},wn=new RegExp(`(?:^|;\\s*)${O}=([^;]+)`),te=t=>{let r=t?t.headers.get("cookie"):document.cookie;return r?wn.exec(r)?.[1]??null:null},gt=()=>{try{let t=JSON.parse(window.localStorage.getItem(O)??"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}},vt=()=>te()??(new URL(location.href).searchParams.get("anonymous_id")?null:gt()),kn=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",ht=t=>{if(document.cookie=mt(t)+kn(),te()!==t)try{window.localStorage.setItem(O,JSON.stringify({id:t,expires:Date.now()+ut}))}catch{}},Oe=t=>{let r=t?t.url:location.href,{searchParams:i}=new URL(r);return{anonymous_id:t?te(t)??i.get("anonymous_id"):te()??i.get("anonymous_id")??gt(),session_id:In(i,typeof window>"u")}},Le=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let t=Oe().anonymous_id;if(t)return t;let r=Q(),i=Oe().anonymous_id;return i||(ht(r),r)},Rn=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},Pn=t=>t==="about:client"?"":t,Cn={pathname:"/log",method:"POST",schema:{response:L(),body:L()}},ft=({rpcClient:t,logger:r,onEvent:i,persistence:s="device",siteKind:p})=>{let d=null,u=null,h=0,_=0,R=v=>s==="none"?{anonymous_id:null,session_id:v?null:d}:Oe(v),K=async(v,y,ae)=>{try{let z={library:{name:"inploi-sdk",version:lt},page:y},ee=R(v.request),ce=s==="none"?null:En(),S={anonymous_id:ee.anonymous_id,session_id:ee.session_id,candidate_id:ce,event:v.event,sent_at:new Date().toISOString(),context:z,properties:v.properties,custom_properties:{...v.customProperties,...ae}},Ie=s==="none"?null:v.request?te(v.request):vt(),Xe=++h,dn=await t.request(Cn,{body:S,...v.keepalive&&{keepalive:!0}}),P=Rn(dn);if(s==="none")return!v.request&&P?.session_id&&Xe>_&&(_=Xe,P.session_id!==S.session_id&&(d=P.session_id)),S.session_id=v.request?P?.session_id||null:d,i?.(S),{success:!0,data:S};let Ee=v.request?Ie:vt(),vn=Ee!==null&&Ee!==Ie,we=Ee??Ie,et=!vn&&(!we||!P?.anonymous_id||we===P.anonymous_id);return et?(P?.anonymous_id&&(S.anonymous_id=P.anonymous_id),P?.session_id&&(S.session_id=P.session_id)):S.anonymous_id=we,!v.request&&typeof window<"u"&&S.anonymous_id&&(et&&S.session_id&&je.set(`${O}-session_id`,S.session_id.toString()),ht(S.anonymous_id)),i?.(S),{success:!0,data:S}}catch(z){return r.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:z}}},N=Promise.resolve();return{log:async v=>{ke(v.request||typeof window<"u","Cannot log on the server without a request. Please pass a request to `log`.");let y="request"in v&&v.request?{href:v.request.url,referrer:Pn(v.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(v.page_context==="no_query"){let ce=new URL(y.href),S=y.referrer?new URL(y.referrer):void 0;y={href:ce.origin+ce.pathname,referrer:S?S.origin+S.pathname:""}}s==="none"&&v.event==="FLOW_NODE"&&v.properties&&"trigger"in v.properties&&(v.properties.trigger==="pagehide"||v.properties.trigger==="hidden")&&(v={...v,keepalive:!0});let ae={event_id:Q(),consent_lane:s,site_kind:p};if(s==="device"||v.request||d||v.keepalive)return K(v,y,ae);let z=()=>K(v,y,ae),ee=N.then(z,z);return N=ee,ee},supportsNoQueryPageContext:!0,getHeaders:v=>{let y=new Headers;return s==="none"||!v?.anonymous_id||y.append("Set-Cookie",mt(v.anonymous_id)),y},getSessionInfo:R,getOrCreateAnonymousId:()=>s==="none"?u??(u=Q()):Le()}};var bt=require("neoqs");function De(t,r,i){let s=t["~standard"].validate(r);if(s instanceof Promise)throw new TypeError("Async schema");if(s.issues)throw new C(s.issues,i);return s.value}function jn(t,r,i){try{return{success:!0,output:De(t,r,i)}}catch(s){if(s instanceof C)return{success:!1,issues:s.issues,source:s.source};throw s}}var Z=class{constructor(r){if(this.baseUrl=me[r.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),r.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",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,i){let s=i.validateIn??!0,{searchParams:p,body:d}=s?Ne(r,i):i,u=new URL(this.baseUrl),h=r.pathname;if("params"in i&&i.params)for(let[_,R]of Object.entries(i.params))h=h.replace(`:${_}`,String(R));return u.pathname=h,r.schema.searchParams&&(u.search=(0,bt.stringify)(p)),[u.toString(),{method:r.method,body:d?JSON.stringify(d):void 0,headers:this.headers,signal:i.signal,...i.keepalive&&{keepalive:!0}}]}async parseResponse(r,i){let s=await Re(i.response);if(Pe(s,i.response.status),!(i.validateOut??!0))return s;let d=jn(r.schema.response,s,"response");if(!d.success)throw new C(d.issues,d.source);return d.output}async request(r,i){try{let s=this.getFetchParams(r,i),p=await fetch(...s);return await this.parseResponse(r,{response:p,validateOut:i.validateOut})}catch(s){throw s instanceof C?this.logger.error(s.message,s.issues):this.logger.error(s),s}}};function L(){return{"~standard":{vendor:"inploi",version:1,validate:t=>({value:t})}}}function ne(t){return t}function Ne(t,r){let i={searchParams:void 0,body:void 0,validateIn:!1};return t.schema.searchParams&&(i.searchParams=De(t.schema.searchParams,"searchParams"in r?r.searchParams:{})),t.schema.body&&(i.body=De(t.schema.body,"body"in r?r.body:{})),i}function yt({publishableKey:t,env:r,logger:i=ve,onEvent:s,persistence:p,siteKind:d}){let u=it({baseUrl:me[r],publishableKey:t}),h=i===!1?ue:i,_=new Z({environment:r,apiKey:{type:"publishable",key:t},logger:h}),R=ft({rpcClient:_,logger:h,onEvent:s,persistence:p,siteKind:d});return{register:N=>N({logger:h,apiClient:u,analytics:R,rpcClient:_,publishableKey:t,env:r}),analytics:R,apiClient:u}}var St={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 he(t){let r=JSON.stringify({message:t.message,acceptLabel:t.acceptLabel??"",declineLabel:t.declineLabel??""}),i=5381;for(let s=0;s<r.length;s++)i=i*33^r.charCodeAt(s);return(i>>>0).toString(36)}function fe(t,r){return`${dt}:${t}:${r}`}function _t(t,r){if(typeof window>"u")return!1;try{let i=fe(t,he(r));return window.localStorage.getItem(i)==="accepted"}catch{return!1}}function xt(t,r){if(!(typeof window>"u"))try{let i=fe(t,he(r));window.localStorage.setItem(i,"accepted")}catch{}}var c=w(require("valibot"),1),On=["agent","sdk","form","integration","migration"],Ln=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var Dn=["screening","cv_match","interview","overall"],Nn=["PENDING","IN_PROGRESS","COMPLETED","CANCELLED"],Bn=["agent"],Un=["job","company"],Fn=["created_at","updated_at","score","interview_score"],Vn=["asc","desc"],qn=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Mn=["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"],Gn=["interview","not_for_me"],At=c.picklist(Gn),Jn=["accept","reject"],Tt=c.picklist(Jn),$n=["transient_pass_through","failed_ats_submission_hold","retention","erasure","demo_reset"],Ho=c.picklist($n),Wn=["pending","submitted","failed","not_required"],Hn=["user","system","automation","integration","candidate"],be=c.picklist(On),I=c.picklist(Ln),x=c.pipe(c.string(),c.trim(),c.minLength(1),c.maxLength(100)),ye=c.picklist(Dn),It=c.picklist(Nn),Et=c.picklist(Bn),wt=c.picklist(Un),kt=c.picklist(Fn),Rt=c.picklist(Vn),re=c.pipe(c.string(),c.trim(),c.minLength(1),c.maxLength(100)),Se=c.picklist(qn),oe=c.picklist(Mn),Pt=c.picklist(Hn),M=c.picklist(Wn);var b=c.variant("type",[c.object({type:c.literal("user"),id:c.pipe(c.string(),c.minLength(1)),email:c.pipe(c.string(),c.minLength(1)),name:c.pipe(c.string(),c.minLength(1))}),c.object({type:c.literal("system"),id:c.pipe(c.string(),c.minLength(1)),name:c.optional(c.string())}),c.object({type:c.literal("automation"),id:c.pipe(c.string(),c.minLength(1)),name:c.optional(c.string())}),c.object({type:c.literal("integration"),id:c.pipe(c.string(),c.minLength(1)),name:c.optional(c.string())}),c.object({type:c.literal("candidate"),id:c.pipe(c.string(),c.minLength(1)),email:c.optional(c.string())})]);var j=w(require("valibot"),1),Kn=j.object({total:j.number(),page:j.number(),perPage:j.number(),lastPage:j.number()});function Ct(t){return j.object({data:j.array(t),pagination:Kn})}var o=w(require("valibot"),1);var m=w(require("valibot"),1),E=m.pipe(m.string(),m.minLength(1)),G=m.pipe(m.number(),m.integer(),m.minValue(1)),k=m.record(m.string(),m.unknown()),D=m.pipe(E,m.maxLength(255)),zn="(?!\\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}",Yo=m.pipe(m.string(),m.regex(new RegExp(`^${zn}$`))),A=m.pipe(m.string(),m.regex(/^\d{4}-\d{2}-\d{2}$/),m.check(t=>{let r=new Date(`${t}T00:00:00Z`);return!Number.isNaN(r.getTime())&&r.toISOString().slice(0,10)===t},"must be a real calendar day"));function jt(t){return/^\p{Zs}*\(?\p{Zs}*(\+|00)[\p{Zs}().-]*\d/u.test(t)}var Be=o.object({id:o.string(),email:o.nullable(o.string()),firstName:o.nullable(o.string()),lastName:o.nullable(o.string()),phone:o.nullable(o.string()),source:o.nullable(be),identifiedAt:o.nullable(o.string()),createdAt:o.string(),updatedAt:o.string()}),Yn=o.pipe(o.string(),o.trim(),o.minLength(1)),Ot=64*1024,ie=o.pipe(o.string(),o.trim(),o.minLength(1),o.maxLength(500)),Qn=o.pipe(o.string(),o.regex(/^[A-Z]{2}$/)),Zn=o.pipe(o.string(),o.maxLength(500),o.check(t=>jt(t.trim()),"phone must start with its country code (+ or 00)")),Xn=o.pipe(o.string(),o.regex(/^[\w:-]+$/)),er=new Set(["__proto__","constructor","prototype"]),tr=o.custom(t=>sr(t),"custom answer must be a JSON value"),nr=["full_time","part_time","weekends","evenings","flexible","bank"],Dt=o.picklist(nr),ni=o.strictObject({firstName:o.nullable(o.string()),lastName:o.nullable(o.string()),email:o.string(),phone:o.nullable(o.string()),country:o.nullable(o.string()),postcode:o.nullable(o.string()),currentTitle:o.nullable(o.string()),currentEmployer:o.nullable(o.string()),openToRelocation:o.nullable(o.boolean()),availableFrom:o.nullable(o.string()),workingPatterns:o.array(Dt),custom:o.record(o.string(),o.unknown())});var Lt=o.strictObject({firstName:o.optional(ie),lastName:o.optional(ie),phone:o.optional(o.nullable(Zn)),country:o.optional(o.nullable(Qn)),postcode:o.optional(o.nullable(ie)),currentTitle:o.optional(o.nullable(ie)),currentEmployer:o.optional(o.nullable(ie)),openToRelocation:o.optional(o.nullable(o.boolean())),availableFrom:o.optional(o.nullable(A)),workingPatterns:o.optional(o.nullable(o.array(Dt))),custom:o.optional(o.pipe(o.custom(t=>Ue(t)&&Object.keys(t).every(r=>!er.has(r))&&ar(t)<=Ot,`custom must be a JSON object of at most ${Ot} bytes`),o.record(Xn,o.nullable(tr))))}),rr=o.pipe(o.custom(t=>Ue(t)&&Object.keys(t).every(r=>Object.hasOwn(Lt.entries,r)),"set must be an object of profile fields"),Lt),or=o.strictObject({email:Yn}),ri=o.strictObject({talentPool:o.optional(o.boolean())}),oi=o.strictObject({identity:or,set:rr,ifVersion:o.optional(o.pipe(o.number(),o.integer(),o.minValue(0))),disclosures:o.optional(o.unknown())}),ir=o.strictObject({noticeId:o.pipe(o.string(),o.minLength(1),o.maxLength(200)),version:o.pipe(o.string(),o.minLength(1),o.maxLength(64)),wordingHash:o.pipe(o.string(),o.minLength(1),o.maxLength(128))}),ii=o.variant("withdrawTalentPool",[o.strictObject({withdrawTalentPool:o.literal(!1),actorUserId:o.optional(o.pipe(o.string(),o.minLength(1),o.maxLength(200)))}),o.strictObject({withdrawTalentPool:o.literal(!0),notice:ir})]);function Ue(t){if(typeof t!="object"||t===null)return!1;let r=Object.getPrototypeOf(t);return r===Object.prototype||r===null}function sr(t){try{return Nt(t,JSON.parse(JSON.stringify(t)))}catch{return!1}}function Nt(t,r){if(t===r)return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null||Array.isArray(t)!==Array.isArray(r)||!Array.isArray(t)&&!Ue(t))return!1;let i=Object.keys(t);return i.length!==Object.keys(r).length?!1:i.every(s=>Object.hasOwn(r,s)&&Nt(t[s],r[s]))}function ar(t){try{return new TextEncoder().encode(JSON.stringify(t)).length}catch{return Number.POSITIVE_INFINITY}}var n=w(require("valibot"),1);var a=w(require("valibot"),1);var Ut=a.object({id:a.string(),applicationId:a.string(),status:It,conductedBy:Et,agentInterviewId:a.nullable(a.string()),generatedScore:a.nullable(a.number()),completedAt:a.nullable(a.string()),meta:a.nullable(k),createdAt:a.string(),updatedAt:a.string()}),cr=/^[A-Za-z0-9_.:-]{1,128}$/,se=a.pipe(a.string(),a.regex(cr)),lr=["audio/webm","audio/ogg","audio/mp4","audio/mpeg","audio/wav"],Ft=a.pipe(a.string(),a.maxLength(255),a.regex(/^[\x20-\x7e]+$/),a.check(t=>lr.includes(t.split(";")[0].trim().toLowerCase()))),Vt=30*1024*1024,pr=100,li=1.5*1024*1024,qt=a.pipe(a.string(),a.regex(/^[0-9a-f]{64}$/)),pi=a.object({questionId:se,contentType:Ft,sha256:qt,body:a.pipe(a.instance(ArrayBuffer),a.check(t=>t.byteLength>=1&&t.byteLength<=Vt))}),dr=a.object({questionId:se,text:a.string(),questionType:a.string(),isFollowUp:a.boolean(),parentQuestionId:a.nullable(se)}),vr=a.object({questionId:se,transcript:a.string(),evaluation:a.nullable(k)}),ur=a.object({questionId:se,contentType:Ft,byteLength:a.pipe(a.number(),a.integer(),a.minValue(1),a.maxValue(Vt)),sha256:qt}),Bt=t=>new Set(t.map(r=>r.questionId)).size===t.length,di=a.pipe(a.object({questions:a.pipe(a.array(dr),a.maxLength(pr)),answers:a.array(vr),evaluation:a.nullable(k),generatedScore:a.nullable(a.pipe(a.number(),a.minValue(0),a.maxValue(100))),display:a.object({jobTitle:a.string(),companyName:a.string()}),recordings:a.array(ur),recordingsWithheld:a.nullable(a.literal("jurisdiction")),completedAt:a.pipe(a.string(),a.isoTimestamp())}),a.check(t=>{let r=new Set(t.questions.map(i=>i.questionId));return r.size===t.questions.length&&Bt(t.answers)&&Bt(t.recordings)&&[...t.answers,...t.recordings].every(i=>r.has(i.questionId))}));var mr=n.object({quote:n.string(),source:n.picklist(["cv","answer"])}),Fe=n.object({score:n.number(),reason:n.string(),confidence:n.number(),share:n.optional(n.number()),evidence:n.optional(n.array(mr))}),Ve=n.object({categoryId:n.string(),answerKey:n.string(),reason:n.picklist(["unanswered","unrecognised"])}),Gt=n.object({id:n.string(),candidateId:n.string(),jobId:n.number(),stage:x,stageGroup:I,stageEnteredAt:n.string(),rating:n.nullable(n.number()),disqualifiedAt:n.nullable(n.string()),disqualificationReason:n.nullable(re),disqualificationNote:n.nullable(n.string()),source:Se,sourceDetail:n.nullable(n.string()),sessionId:n.nullable(n.number()),externalApplicationId:n.nullable(n.string()),meta:n.nullable(k),context:n.nullable(k),scoredAt:n.nullable(n.string()),atsSubmissionStatus:n.optional(n.nullable(M)),atsSubmissionAttempts:n.optional(n.number()),atsNextAttemptAt:n.optional(n.nullable(n.string())),atsSubmittedAt:n.optional(n.nullable(n.string())),atsLastErrorCode:n.optional(n.nullable(n.string())),atsLastErrorMessage:n.optional(n.nullable(n.string())),createdAt:n.string(),updatedAt:n.string()}),gr=n.object({id:n.string(),applicationId:n.string(),scoreType:ye,score:n.nullable(n.number()),reason:n.nullable(n.string()),categories:n.nullable(n.record(n.string(),Fe)),leftOut:n.optional(n.array(Ve)),reasonsWrittenBlind:n.optional(n.literal(!0)),scoredBy:n.nullable(n.string()),createdAt:n.string()}),J=n.object({...Gt.entries,candidate:n.nullable(Be),score:n.nullable(gr),interview:n.nullable(Ut)}),fi=n.object({...Be.entries,applications:n.array(Gt)}),Jt=n.object({id:n.string(),applicationId:n.string(),action:oe,fromStage:n.nullable(x),fromStageGroup:n.nullable(I),toStage:n.nullable(x),toStageGroup:n.nullable(I),disqualificationReason:n.nullable(re),disqualificationNote:n.nullable(n.string()),actorId:n.nullable(n.string()),actorType:Pt,actorEmail:n.nullable(n.string()),actorName:n.nullable(n.string()),meta:n.nullable(k),schemaVersion:n.number(),createdAt:n.string()}),hr=500,$t=n.object({scoreId:n.pipe(n.string(),n.minLength(1),n.maxLength(255)),scoredBy:n.pipe(n.string(),n.regex(/^scoring:[^:\s]{1,128}:[^:\s]{1,128}$/)),decision:Tt,reason:n.pipe(n.string(),n.maxLength(hr),n.check(t=>t.trim().length>0,"reason must not be blank")),score:n.pipe(n.number(),n.finite())}),fr=500,br=200,Mt={from:n.pipe(n.string(),n.isoTimestamp()),to:n.pipe(n.string(),n.isoTimestamp()),actions:n.optional(n.pipe(n.array(oe),n.minLength(1))),cursor:n.nullable(n.pipe(n.string(),n.regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\|.{1,255}$/))),limit:n.pipe(n.number(),n.integer(),n.minValue(1),n.maxValue(br))},bi=n.union([n.strictObject({...Mt,jobIds:n.pipe(n.array(n.pipe(n.number(),n.integer(),n.minValue(1))),n.minLength(1),n.maxLength(fr))}),n.strictObject({...Mt,allJobs:n.literal(!0)})]),yr=500,yi=n.pipe(n.number(),n.integer(),n.minValue(1)),Si=n.strictObject({cursor:n.nullable(n.pipe(n.string(),n.regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}\|.{1,255}$/))),limit:n.pipe(n.number(),n.integer(),n.minValue(1),n.maxValue(yr)),actions:n.optional(n.pipe(n.array(oe),n.minLength(1))),maxApplications:n.optional(n.pipe(n.number(),n.integer(),n.minValue(0)))}),Sr=n.object({id:n.string(),applicationId:n.string(),action:oe,fromStage:n.nullable(x),fromStageGroup:n.nullable(I),toStage:n.nullable(x),toStageGroup:n.nullable(I),createdAt:n.string()}),_i=n.object({rows:n.array(Sr),nextCursor:n.nullable(n.string()),total:n.nullable(n.pipe(n.number(),n.integer(),n.minValue(0))),applications:n.pipe(n.number(),n.integer(),n.minValue(0))});var f=w(require("valibot"),1);var Wt=f.object({anonymousId:E,email:E,firstName:f.nullish(f.string()),lastName:f.nullish(f.string()),phone:f.nullish(f.string()),source:f.nullish(be),updateExisting:f.optional(f.boolean())}),qe=f.object({candidateId:f.string(),isNew:f.boolean()}),Ii=f.union([f.object({ok:f.literal(!0)}),qe]);var e=w(require("valibot"),1);var _r=["note","share","verdict","offer_terms","offer_sent","offer_accepted","offer_declined","offer_withdrawn","exported","score_override"],xr=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate",..._r],xe=e.picklist(xr),Me=e.pipe(e.string(),e.transform(t=>t.split(",").map(r=>r.trim()).filter(r=>r.length>0))),Ar=e.pipe(Me,e.array(x)),Tr=e.pipe(Me,e.array(I)),Ht=e.pipe(e.string(),e.transform(t=>t.split(",").map(r=>Number(r.trim())).filter(r=>Number.isInteger(r)&&r>0))),Ir=e.pipe(Me,e.array(M)),Kt=e.object({stages:e.optional(Ar),stage_groups:e.optional(Tr),job_id:e.optional(e.string()),job_ids:e.optional(Ht),candidate_id:e.optional(e.string()),is_disqualified:e.optional(e.picklist(["true","false"])),created_from:e.optional(e.string()),created_to:e.optional(e.string()),updated_from:e.optional(e.string()),updated_to:e.optional(e.string()),entered_stage_from:e.optional(e.string()),entered_stage_to:e.optional(e.string()),from:e.optional(e.string()),to:e.optional(e.string()),q:e.optional(e.string()),scored:e.optional(e.picklist(["true","false"])),ats_submission_status:e.optional(Ir),sort:e.optional(kt),order:e.optional(Rt),page:e.optional(e.string()),per_page:e.optional(e.string())}),Er=e.object({status:e.picklist(["pending","not_required"]),integrationId:e.nullish(D)}),Ci=e.pipe(e.object({candidateId:E,disclosures:e.optional(e.unknown()),jobLocation:e.optional(e.unknown()),jobId:G,meta:e.nullish(k),sessionId:e.nullish(e.number()),externalApplicationId:e.nullish(e.string()),externalJobId:e.nullish(e.pipe(E,e.maxLength(255))),context:e.nullish(k),source:e.nullish(Se),sourceDetail:e.nullish(e.string()),stage:e.nullish(x),stageGroup:e.nullish(I),actor:e.nullish(b),atsSubmission:e.nullish(Er),duplicateScope:e.nullish(e.picklist(["job","attempt"])),anonymousId:e.nullish(D)}),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")),zt=e.object({id:e.string(),stageGroup:e.string(),createdAt:e.string()}),ji=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:zt,atsHeld:e.optional(e.boolean())}),e.object({ok:e.literal(!1),refused:e.literal("pass_through_untracked")})]),Yt=e.object({email:e.pipe(e.string(),e.minLength(1),e.maxLength(320)),scope:e.optional(wt,"job"),jobId:e.optional(e.union([e.string(),e.number()]))}),Qt=e.object({isDuplicate:e.boolean(),existingApplication:e.optional(zt)}),wr=Date.UTC(1e4,0,1),Zt=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[r,i,s]=t.slice(0,10).split("-").map(Number),p=new Date(Date.UTC(r,i-1,s)),d=Date.parse(t);return p.getUTCMonth()===i-1&&p.getUTCDate()===s&&d>=0&&d<wr},"must be a real time")),Ge=e.pipe(e.string(),e.regex(/^[A-Za-z0-9_.:-]{1,100}$/)),Oi=e.object({status:e.picklist(["pending","submitted","failed"]),nextAttemptAt:e.nullish(Zt),errorCode:e.nullish(Ge),errorMessage:e.nullish(e.pipe(e.string(),e.maxLength(1e4))),externalApplicationId:e.nullish(D),externalRunId:e.nullish(D),integrationId:e.nullish(D),answeredPending:e.optional(e.boolean())}),kr=e.picklist(["invalid_transition","next_attempt_required","retry_hold_expired"]),Li=e.variant("kind",[e.object({kind:e.literal("recorded"),application:J}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(M),to:M,reason:kr})]),Rr=e.object({integrationId:e.string(),state:e.picklist(["closed","open","half_open"]),coolingUntil:e.nullable(e.string()),transientCount:e.number(),held:e.boolean()}),Di=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(Rr),restoreHold:e.optional(e.boolean())}),Ni=e.object({status:e.picklist(["pending","failed"]),integrationId:e.nullable(D),errorCode:e.nullable(Ge)}),Bi=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()}),Ui=e.object({actor:b,expectedAtsLogCount:e.optional(e.pipe(e.number(),e.integer(),e.minValue(0)))}),Pr=e.picklist(["invalid_transition","retry_payload_missing","retry_hold_expired","stale"]),Fi=e.variant("kind",[e.object({kind:e.literal("retried"),application:J}),e.object({kind:e.literal("rejected"),applicationId:e.string(),from:e.nullable(M),reason:Pr})]),Vi=e.object({status:e.optional(e.picklist(["pending","failed"])),integrationId:e.nullable(D),errorCode:e.nullable(Ge),actor:b}),qi=e.object({retried:e.number()}),Cr=D,Mi=e.object({integrationIds:e.optional(e.pipe(e.array(Cr),e.maxLength(100)))}),Gi=e.object({integrationId:e.string(),wasOpen:e.boolean()}),Ji=e.object({integrationId:e.string(),wasHeld:e.boolean()}),$i=e.object({applicationId:E,scoreType:ye,score:e.number(),reason:e.nullish(e.string()),categories:e.nullish(e.record(e.string(),Fe)),leftOut:e.nullish(e.array(Ve)),reasonsWrittenBlind:e.nullish(e.boolean()),scoredBy:e.nullish(e.string()),actor:e.nullish(b),idempotencyKey:e.nullish(e.pipe(e.string(),e.maxLength(255)))}),Wi=e.object({scoreId:e.string()}),Hi=Ct(J);var Ki=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified"]),zi=e.array(Jt),_e=e.object({stage:e.nullish(x),note:e.nullish(e.string())}),jr=e.object({stage:e.nullish(x),startDate:e.nullish(e.string()),note:e.nullish(e.string())}),Or=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:E,voice:e.optional(e.picklist(["casual","formal"])),holdUntil:e.optional(e.pipe(Zt,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:r,...i})=>({...i,...t===void 0||t===""?{}:{subject:t},...r===void 0||r===""?{}:{body:r}}))),Lr=e.variant("action",[e.object({action:e.literal("note"),actor:b,message:e.optional(e.never()),meta:e.object({note:E})}),e.object({action:e.literal("share"),actor:b,message:e.optional(e.never()),meta:e.object({subjectUserIds:e.pipe(e.array(E),e.minLength(1),e.maxLength(20)),comment:e.optional(e.string())})}),e.object({action:e.literal("verdict"),actor:b,message:e.optional(e.never()),meta:e.object({code:At,comment:e.optional(e.string())})}),e.object({action:e.literal("offer_terms"),actor:b,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:b,message:e.optional(e.never()),meta:e.object({reason:e.optional(e.string())})})),e.object({action:e.literal("exported"),actor:b,message:e.optional(e.never()),meta:e.object({presetId:Or,exportId:E})}),e.object({action:e.literal("score_override"),actor:b,message:e.optional(e.never()),meta:e.pipe($t,e.transform(t=>({...t,reason:t.reason.trim()})))})]),Dr=e.variant("action",[Lr,e.object({action:e.literal("shortlist"),actor:b,message:e.optional($),meta:e.nullish(_e)}),e.object({action:e.literal("move_to_interview"),actor:b,message:e.optional($),meta:e.nullish(_e)}),e.object({action:e.literal("make_offer"),actor:b,message:e.optional($),meta:e.nullish(_e)}),e.object({action:e.literal("hire"),actor:b,message:e.optional($),meta:e.nullish(jr)}),e.object({action:e.literal("withdraw"),actor:b,message:e.optional(e.never()),meta:e.nullish(_e)}),e.object({action:e.literal("move_to_stage"),actor:b,message:e.optional(e.never()),meta:e.object({stage:x,stageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("stage_transition"),actor:b,message:e.optional($),meta:e.object({toStage:x,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("disqualify"),actor:b,message:e.optional($),meta:e.object({reason:re,note:e.nullish(e.string())})}),e.object({action:e.literal("reinstate"),actor:b,message:e.optional($),meta:e.object({toStage:x,toStageGroup:I,note:e.nullish(e.string())})}),e.object({action:e.literal("rate"),actor:b,message:e.optional(e.never()),meta:e.object({rating:e.nullable(e.pipe(e.number(),e.integer(),e.minValue(1),e.maxValue(5)))})})]),Yi=e.object({applicationIds:e.pipe(e.array(e.string()),e.minLength(1)),body:Dr}),Xt=e.picklist(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),Qi=e.variant("kind",[e.object({kind:e.literal("updated"),action:xe,application:J}),e.object({kind:e.literal("skipped"),action:xe,applicationId:e.string(),reason:Xt})]),Zi=e.object({updated:e.array(e.object({kind:e.literal("updated"),action:xe,application:J})),skipped:e.array(e.object({kind:e.literal("skipped"),action:xe,applicationId:e.string(),reason:Xt})),failed:e.array(e.object({applicationId:e.string(),error:e.string()}))}),g=e.pipe(e.number(),e.integer(),e.minValue(0)),en=e.object({APPLIED:g,SHORTLISTED:g,INTERVIEWED:g,OFFERED:g,HIRED:g,REJECTED:g,WITHDRAWN:g}),Nr=e.pipe(e.string(),e.minLength(1),e.maxLength(255)),Xi=e.object({pendingShares:e.optional(e.boolean())}),es=e.object({job_ids:Ht,verdict_by:e.optional(Nr),pending_shares:e.optional(e.literal("1"))}),ts=e.object({counts:e.record(e.string(),en),existingAppliedCounts:e.optional(e.record(e.string(),g)),awaitingVerdictCounts:e.optional(e.record(e.string(),g)),pendingShareCounts:e.optional(e.record(e.string(),g))}),ns=e.omit(Kt,["sort","order","page","per_page"]),rs=e.object({counts:en}),tn=92,Br=864e5;function Je({from:t,to:r}){let i=(Date.parse(`${r}T00:00:00Z`)-Date.parse(`${t}T00:00:00Z`))/Br+1;return i>=1&&i<=tn}var $e=`to must be on or after from, and the range must span at most ${tn} days`,os=e.pipe(e.object({from:A,to:A}),e.check(Je,$e)),Ur=e.object({job_id:G,date:A,received:g,scored:g,shortlisted:g}),is=e.object({rows:e.array(Ur)}),Fr=5e3,ss=e.pipe(e.object({from:A,to:A,jobIds:e.pipe(e.array(G),e.maxLength(Fr))}),e.check(Je,$e)),Vr=e.object({job_id:G,date:A,received:g}),as=e.object({rows:e.array(Vr)}),qr=5e3,Mr=e.pipe(e.object({from:A,to:A,jobIds:e.optional(e.pipe(e.array(G),e.maxLength(qr)))}),e.check(Je,$e)),cs=e.pipe(e.object({from:e.string(),to:e.string(),job_ids:e.optional(e.string())}),e.transform(({from:t,to:r,job_ids:i})=>({from:t,to:r,jobIds:i===void 0?void 0:i===""?[]:i.split(",").map(s=>/^\d+$/.test(s.trim())?Number(s):Number.NaN)})),Mr),We=e.pipe(e.array(g),e.length(5)),Gr=e.object({received:g,scored:g,shortlisted:g,histogram:e.pipe(e.array(g),e.length(101)),median_lag_minutes:e.nullable(e.number()),scored_same_day:g}),Jr=e.object({job_id:G,received:g,scored:g,shortlisted:g,score_sum:e.number(),bands:We}),$r=e.object({date:A,received:g,scored:g,score_sum:e.number(),bands:We,scored_on_day:g}),Wr=e.object({id:e.string(),label:e.nullable(e.string()),sum:e.number(),count:g}),Hr=e.object({template_id:e.string(),scored:g,criteria:e.array(Wr)}),ls=e.object({totals:Gr,by_job:e.array(Jr),by_day:e.array($r),criteria:e.array(Hr)}),Kr=e.object({date:A,scored:g,bands:We}),ps=e.object({rows:e.array(Kr)});var ds=e.object({...e.omit(Kt,["page","per_page"]).entries,per_group:e.optional(e.string())}),W=e.object({data:e.array(J),total:g}),vs=e.object({board:e.object({APPLIED:W,SHORTLISTED:W,INTERVIEWED:W,OFFERED:W,HIRED:W,REJECTED:W,WITHDRAWN:W})});var X=w(require("valibot"));var nn=({environment:t,publishableKey:r,logger:i})=>{let s=ct[t];return{async checkDuplicate(p){let d;try{d=X.parse(Yt,{email:p.email,scope:p.scope,...p.scope==="job"&&p.jobId!=null?{jobId:p.jobId}:{}})}catch{return i.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":r},body:JSON.stringify(d)});if(!u.ok)return i.error(`[TalentBankClient] checkDuplicate failed with status ${u.status}`),{isDuplicate:!1};let h=await u.json(),_=X.safeParse(Qt,h);return _.success?_.output:(i.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof h=="object"&&h!=null&&typeof h.isDuplicate=="boolean"?{isDuplicate:h.isDuplicate}:{isDuplicate:!1})}catch(u){return i.error("[TalentBankClient] checkDuplicate failed:",u),{isDuplicate:!1}}},async identify(p){try{if(!p.anonymousId)return i.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let d={email:p.email,firstName:p.firstName,lastName:p.lastName,phone:p.phone,anonymousId:p.anonymousId,source:p.source??"sdk"},u=X.safeParse(Wt,d);if(!u.success)return i.error("[TalentBankClient] identify received invalid input"),null;let h=await fetch(`${s}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":r},body:JSON.stringify(u.output)});if(!h.ok)return i.error(`[TalentBankClient] identify failed with status ${h.status}`),null;let _=X.safeParse(qe,await h.json());return _.success?_.output:(i.error("[TalentBankClient] identify returned an invalid response"),null)}catch(d){return i.error("[TalentBankClient] identify failed:",d),null}}}};function rn(t){if(!(typeof document>"u")){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",t,{once:!0});return}Promise.resolve().then(t)}}var l=w(require("valibot"));var He=["DAILY","WEEKLY","MONTHLY"],zr=l.record(l.string(),l.union([l.string(),l.array(l.string()),l.object({type:l.literal("provided"),lat:l.number(),lng:l.number(),radius:l.number(),unit:l.optional(l.picklist(["miles","km"])),label:l.optional(l.string())})])),Yr={pathname:"/job/:id",method:"GET",schema:{response:l.object({id:l.number(),external_id:l.nullish(l.string()),city:l.nullish(l.string()),town:l.nullish(l.string()),category:l.nullish(l.string())})}};async function on(t,{contact:r,job:i}){let s={};if(i){let p=await t.request(Yr,{params:{id:i.id}});if((i.id_type==="internal"?String(p.id):p.external_id)!==i.id)throw new Error("Job lookup returned a different role");for(let u of["city","town","category"]){let h=p[u]?.trim();h&&(s[u]=[h])}}await t.request(Ke,{body:{contact:r,alerts:"WEEKLY",filters:s}})}var Ke={pathname:"/search/save",method:"POST",schema:{response:L(),body:l.object({contact:l.object({email:l.pipe(l.optional(l.string()),l.string(),l.email()),first_name:l.optional(l.string()),last_name:l.optional(l.string())}),alerts:l.pipe(l.optional(l.string()),l.string(),l.picklist(He)),filters:zr})}};var T=w(require("valibot"));var Qe=async t=>{let r={method:"GET",pathname:"/search/filters",schema:{response:T.pipe(T.object({country:T.optional(T.array(T.object({value:T.string()})),[])}),T.transform(({country:i})=>i.map(({value:s})=>s))),searchParams:L()}};return t.request(r,{searchParams:{filters:{country:null}}})},Ae=new WeakMap,ln=t=>(Ae.has(t)||(Ae.set(t,void 0),Qe(t).then(async r=>{let{jobCountryCodes:i}=await Promise.resolve().then(()=>(Ye(),cn));Ae.set(t,i(r).join(",")||void 0)}).catch(()=>{})),Ae.get(t)),Ze=(t,r)=>{let i=new Set,s=[];for(let p=0;p<Math.max(t.length,r.length);p++)for(let d of[t[p],r[p]]){if(!d)continue;let u=d.mapbox_id||d.full_address||[d.name,d.place_formatted].filter(Boolean).join(", ");if(!i.has(u)&&(i.add(u),s.push(d),s.length===5))return s}return s},no=600,pn=async(t,r,i)=>{if(i?.throwIfAborted(),!r){let s=await t();return i?.throwIfAborted(),s}return new Promise((s,p)=>{let d,u,h,_=!1,R=()=>{_=!0,clearTimeout(h),i?.removeEventListener("abort",K)},K=()=>{R(),p(i?.reason)},N=()=>{R(),d?.status==="fulfilled"&&u?.status==="fulfilled"?s(Ze(d.value,u.value)):d?.status==="fulfilled"?s(d.value):u?.status==="fulfilled"?s(u.value):d?.status==="rejected"&&p(d.reason)},Te=(v,y)=>{_||(v?d=y:u=y,d&&u?N():y.status==="fulfilled"&&y.value.length>0&&(h=setTimeout(N,no)))};i?.addEventListener("abort",K,{once:!0});for(let v of[!0,!1])t(v?r:void 0).then(y=>Te(v,{status:"fulfilled",value:y}),y=>Te(v,{status:"rejected",reason:y}))})};Ye();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
|