@inploi/sdk 2.10.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -4
- package/cdn/index.js +1 -1
- package/dist/index.d.mts +98 -73
- package/dist/index.d.ts +98 -73
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,10 +42,8 @@ A new instance or hard navigation starts over.
|
|
|
42
42
|
Explicit server `request` logs stay isolated and never adopt the browser session
|
|
43
43
|
or return a `Set-Cookie` header.
|
|
44
44
|
|
|
45
|
-
`IDENTIFY`
|
|
46
|
-
|
|
47
|
-
Job-alert subscriptions remain independent server writes. The default,
|
|
48
|
-
`persistence: 'device'`, preserves existing analytics behaviour.
|
|
45
|
+
The job-alerts plugin sends no `IDENTIFY` event, and the SDK has no `IDENTIFY` type or Talent Bank side call; a job-alert subscription identifies the candidate server-side from its own request.
|
|
46
|
+
The default, `persistence: 'device'`, preserves existing analytics behaviour.
|
|
49
47
|
|
|
50
48
|
This option covers analytics only. Hosts own consent changes, clearing previously
|
|
51
49
|
stored identifiers, experiment cookies and rollout seeds, and replacing their SDK
|
|
@@ -53,6 +51,24 @@ instance when the persistence choice changes. The agent widgets' visitor id foll
|
|
|
53
51
|
`analytics.getOrCreateAnonymousId()` when the host's SDK has it, which with `none` keeps one id for the page in
|
|
54
52
|
memory. The module-level `getOrCreateAnonymousId` always stores; plugins' other storage is outside this option.
|
|
55
53
|
|
|
54
|
+
### Event catalogue and envelope
|
|
55
|
+
|
|
56
|
+
`ANALYTICS_EVENTS` (`src/sdk.events.ts`) lists every event the SDK and its plugins send to `/log`; each event's fields
|
|
57
|
+
are its member of `AnalyticsLogParams`. A test fails if any package sends an event name the catalogue lacks.
|
|
58
|
+
|
|
59
|
+
`SAVE_JOB` records a candidate saving or unsaving a job, with `{ job_id: number, saved: boolean }`. Job search
|
|
60
|
+
sends it through the same injected `analytics.log` service as `SEARCH_JOB_CLICK`, so it follows the host's
|
|
61
|
+
persistence lane and consent choices. It adds no title or candidate content. Bookmark storage is separate from
|
|
62
|
+
analytics; see [saved jobs](../plugin-job-search/README.md#saved-jobs-opt-in).
|
|
63
|
+
|
|
64
|
+
Every event also carries an envelope in `custom_properties`, beside the caller's own: `event_id` (a UUID made when
|
|
65
|
+
`log()` is called, kept if the event waits for the first session), `consent_lane` (the `persistence` lane, `device`
|
|
66
|
+
or `none`) and `site_kind` (`hub` or `embedded`, from `initialiseSdk({ siteKind })`; absent when the host does not
|
|
67
|
+
set it). The api stores `custom_properties` as sent and replaces it wholesale above 1 KB.
|
|
68
|
+
|
|
69
|
+
`VIEW_PAGE` and `VIEW_JOB` take an optional `navigation_id`: one id per navigation (document load, in-app route change,
|
|
70
|
+
back/forward-cache restore), minted by the page with `generateUUID()`.
|
|
71
|
+
|
|
56
72
|
## Plugins
|
|
57
73
|
|
|
58
74
|
`getJobCountries(rpcClient)` reads the company's live-job countries from `GET /search/filters`
|
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 Qn=Object.defineProperty,et=Object.defineProperties;var nt=Object.getOwnPropertyDescriptors;var mn=Object.getOwnPropertySymbols;var tt=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var dn=(e,t,n)=>t in e?Qn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||(t={}))tt.call(t,n)&&dn(e,n,t[n]);if(mn)for(var n of mn(t))rt.call(t,n)&&dn(e,n,t[n]);return e},G=(e,t)=>et(e,nt(t));var it=(e,t)=>()=>(e&&(t=e(e=0)),t);var O=(e,t,n)=>new Promise((r,s)=>{var o=u=>{try{p(n.next(u))}catch(f){s(f)}},a=u=>{try{p(n.throw(u))}catch(f){s(f)}},p=u=>u.done?r(u.value):Promise.resolve(u.value).then(o,a);p((n=n.apply(e,t)).next())});var Wn=it(()=>{"use strict"});function Be(e,t){if(!e)throw new Error(t)}function ae(e,t){return t in e}var pr=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var Ee="%c[inploi SDK]",Se="color: #65BC67; font-weight: bold;",ze={warn:(...e)=>console.warn(Ee,Se,...e),error:(...e)=>console.error(Ee,Se,...e),info:(...e)=>console.info(Ee,Se,...e),log:(...e)=>console.log(Ee,Se,...e)},Ue={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var st="Unauthenticated",ot="This action is unauthorized.",te=class extends Error{constructor(n,r){super(n);this.status=r,this.name="ErrorWithStatus"}},me=class extends te{constructor(t){super(t!=null?t:"Not found"),this.name="NotFoundError",this.status=404}},de=class extends te{constructor(t,n){super(t!=null?t:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},Z=class extends te{constructor(n,r){let s=r?` in ${r}`:"";super(`Schema validation failed${s}`);this.issues=n;this.source=r;this.name="SchemaValidationError",this.status=400}},Ae=class extends te{constructor(n,r,s){super(n);this.data=s;this.name="ApiError",this.status=r!=null?r:500}};var he=class extends te{constructor(n){var r;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(r=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?r:void 0}};function Ve(e){return O(this,null,function*(){let t=new Headers(e.headers).get("content-type"),n=t==null?void 0:t.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new he(e);return e.json().catch(()=>{throw new he(e)})})}var ut=["message","error","errors","exception","exceptions"];function at(e){let t=[];if(typeof e=="object"&&e!==null){for(let n of ut)if(ae(e,n)){let r=e[n];typeof r=="string"&&t.push(r),Array.isArray(r)&&r.every(s=>typeof s=="string")&&t.push(...r)}ae(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&ae(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&ae(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&t.push(e.integration_response.error.message)}return t.length===0&&t.push("Unknown error"),[...new Set(t)].join(", ")}function Je(e,t){if(t>=300){let n=at(e);throw t===404?new me(n):n===st?new de("You are not authenticated.",t):n===ot?new de(n,t):new Ae(n,t,e)}}var hn=e=>{let t={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(s,...o)=>O(void 0,[s,...o],function*(n,r={}){let a=G(j({},r),{headers:j(j({},r.headers),t)}),p=yield fetch(`${e.baseUrl}${n}`,a);if(p.status===404)throw new me;let u=yield Ve(p);return Je(u,p.status),u})}};var vn="2.10.0";var Ie={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"},gn={sandbox:"https://talent-bank.staging.inploi.com",production:"https://talent-bank.inploi.com",_internal_local:"http://localhost:8787"},bn=vn;var $="isdk_session",Te=`${$}-candidate_id`,ct=`${$}-consent`;var He="RFC3986",Xe={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},pt="RFC1738";var ft=Array.isArray,V=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var We=1024,yt=(e,t,n,r,s)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});let a="";for(let p=0;p<o.length;p+=We){let u=o.length>=We?o.slice(p,p+We):o,f=[];for(let d=0;d<u.length;++d){let y=u.charCodeAt(d);if(y===45||y===46||y===95||y===126||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||s===pt&&(y===40||y===41)){f[f.length]=u.charAt(d);continue}if(y<128){f[f.length]=V[y];continue}if(y<2048){f[f.length]=V[192|y>>6]+V[128|y&63];continue}if(y<55296||y>=57344){f[f.length]=V[224|y>>12]+V[128|y>>6&63]+V[128|y&63];continue}d+=1,y=65536+((y&1023)<<10|u.charCodeAt(d)&1023),f[f.length]=V[240|y>>18]+V[128|y>>12&63]+V[128|y>>6&63]+V[128|y&63]}a+=f.join("")}return a};function mt(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function kn(e,t){if(ft(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var Er=Array.isArray;var dt=Object.prototype.hasOwnProperty,_n={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},J=Array.isArray,ht=Array.prototype.push,xn=function(e,t){ht.apply(e,J(t)?t:[t])},vt=Date.prototype.toISOString,R={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:yt,encodeValuesOnly:!1,format:He,formatter:Xe[He],indices:!1,serializeDate(e){return vt.call(e)},skipNulls:!1,strictNullHandling:!1};function gt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var Ke={};function wn(e,t,n,r,s,o,a,p,u,f,d,y,E,l,k,T,x,C){let h=e,Q=C,P=0,oe=!1;for(;(Q=Q.get(Ke))!==void 0&&!oe;){let D=Q.get(e);if(P+=1,typeof D!="undefined"){if(D===P)throw new RangeError("Cyclic object value");oe=!0}typeof Q.get(Ke)=="undefined"&&(P=0)}if(typeof f=="function"?h=f(t,h):h instanceof Date?h=E==null?void 0:E(h):n==="comma"&&J(h)&&(h=kn(h,function(D){return D instanceof Date?E==null?void 0:E(D):D})),h===null){if(o)return u&&!T?u(t,R.encoder,x,"key",l):t;h=""}if(gt(h)||mt(h)){if(u){let D=T?t:u(t,R.encoder,x,"key",l);return[(k==null?void 0:k(D))+"="+(k==null?void 0:k(u(h,R.encoder,x,"value",l)))]}return[(k==null?void 0:k(t))+"="+(k==null?void 0:k(String(h)))]}let ue=[];if(typeof h=="undefined")return ue;let ee;if(n==="comma"&&J(h))T&&u&&(h=kn(h,u)),ee=[{value:h.length>0?h.join(",")||null:void 0}];else if(J(f))ee=f;else{let D=Object.keys(h);ee=d?D.sort(d):D}let S=p?String(t).replace(/\./g,"%2E"):String(t),z=r&&J(h)&&h.length===1?S+"[]":S;if(s&&J(h)&&h.length===0)return z+"[]";for(let D=0;D<ee.length;++D){let U=ee[D],ye=typeof U=="object"&&typeof U.value!="undefined"?U.value:h[U];if(a&&ye===null)continue;let X=y&&p?U.replace(/\./g,"%2E"):U,ne=J(h)?typeof n=="function"?n(z,X):z:z+(y?"."+X:"["+X+"]");C.set(e,P);let yn=new WeakMap;yn.set(Ke,C),xn(ue,wn(ye,ne,n,r,s,o,a,p,n==="comma"&&T&&J(h)?null:u,f,d,y,E,l,k,T,x,yn))}return ue}function bt(e=R){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let t=e.charset||R.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=He;if(typeof e.format!="undefined"){if(!dt.call(Xe,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let r=Xe[n],s=R.filter;(typeof e.filter=="function"||J(e.filter))&&(s=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in _n?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=R.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:R.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:R.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:R.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:R.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?R.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:R.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:R.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:R.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:R.encodeValuesOnly,filter:s,format:n,formatter:r,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:R.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:R.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:R.strictNullHandling}}function En(e,t={}){let n=e,r=bt(t),s,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):J(r.filter)&&(o=r.filter,s=o);let a=[];if(typeof n!="object"||n===null)return"";let p=_n[r.arrayFormat],u=p==="comma"&&r.commaRoundTrip;s||(s=Object.keys(n)),r.sort&&s.sort(r.sort);let f=new WeakMap;for(let E=0;E<s.length;++E){let l=s[E];r.skipNulls&&n[l]===null||xn(a,wn(n[l],l,p,u,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,f))}let d=a.join(r.delimiter),y=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),d.length>0?y+d:""}function $e(e,t,n){let r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Async schema");if(r.issues)throw new Z(r.issues,n);return r.value}function kt(e,t,n){try{return{success:!0,output:$e(e,t,n)}}catch(r){if(r instanceof Z)return{success:!1,issues:r.issues,source:r.source};throw r}}var ve=class{constructor(t){if(this.baseUrl=Ie[t.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),t.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",t.apiKey.key)}else this.headers.set("x-publishable-key",t.apiKey.key);this.logger=t.logger,this._environment=t.environment}get environment(){return this._environment}getFetchParams(t,n){var u;let r=(u=n.validateIn)!=null?u:!0,{searchParams:s,body:o}=r?Sn(t,n):n,a=new URL(this.baseUrl),p=t.pathname;if("params"in n&&n.params)for(let[f,d]of Object.entries(n.params))p=p.replace(`:${f}`,String(d));return a.pathname=p,t.schema.searchParams&&(a.search=En(s)),[a.toString(),j({method:t.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(t,n){return O(this,null,function*(){var a;let r=yield Ve(n.response);if(Je(r,n.response.status),!((a=n.validateOut)!=null?a:!0))return r;let o=kt(t.schema.response,r,"response");if(!o.success)throw new Z(o.issues,o.source);return o.output})}request(t,n){return O(this,null,function*(){try{let r=this.getFetchParams(t,n),s=yield fetch(...r);return yield this.parseResponse(t,{response:s,validateOut:n.validateOut})}catch(r){throw r instanceof Z?this.logger.error(r.message,r.issues):this.logger.error(r),r}})}};function re(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function Sn(e,t){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=$e(e.schema.searchParams,"searchParams"in t?t.searchParams:{})),e.schema.body&&(n.body=$e(e.schema.body,"body"in t?t.body:{})),n}var W,_t={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Tn(e){var t,n,r;return!e&&!W?_t:{lang:(t=e==null?void 0:e.lang)!=null?t:W==null?void 0:W.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:W==null?void 0:W.abortEarly,abortPipeEarly:(r=e==null?void 0:e.abortPipeEarly)!=null?r:W==null?void 0:W.abortPipeEarly}}var Ye;function xt(e){return Ye==null?void 0:Ye.get(e)}var Ze;function wt(e){return Ze==null?void 0:Ze.get(e)}var Qe;function Et(e,t){var n;return(n=Qe==null?void 0:Qe.get(e))==null?void 0:n.get(t)}function ie(e){var n,r,s;let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(s=e&&((r=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:r.name))!=null?s:"null":t}function I(e,t,n,r,s){var y,E,l,k,T,x,C,h;let o=s&&"input"in s?s.input:n.value,a=(E=(y=s==null?void 0:s.expected)!=null?y:e.expects)!=null?E:null,p=(l=s==null?void 0:s.received)!=null?l:ie(o),u={kind:e.kind,type:e.type,input:o,expected:a,received:p,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${p}`,requirement:e.requirement,path:s==null?void 0:s.path,issues:s==null?void 0:s.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},f=e.kind==="schema",d=(h=(C=(x=(T=(k=s==null?void 0:s.message)!=null?k:e.message)!=null?T:Et(e.reference,u.lang))!=null?x:f?wt(u.lang):null)!=null?C:r.message)!=null?h:xt(u.lang);d!==void 0&&(u.message=typeof d=="function"?d(u):d),f&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}var An=new WeakMap;function N(e){let t=An.get(e);return t||(t={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Tn())}},An.set(e,t)),t}function St(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function en(e,t){var r;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:(r=n[0])!=null?r:"never"}var At=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,jr=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function nn(e,t){return{kind:"validation",type:"check",reference:nn,async:!1,expects:null,requirement:e,message:t,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&I(this,"input",n,r),n}}}function tn(e){return{kind:"validation",type:"email",reference:tn,expects:null,async:!1,requirement:At,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&I(this,"email",t,n),t}}}function le(e){return{kind:"validation",type:"integer",reference:le,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&I(this,"integer",t,n),t}}}function Pe(e,t){return{kind:"validation",type:"max_length",reference:Pe,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length>this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function rn(e,t){return{kind:"validation",type:"max_value",reference:rn,async:!1,expects:`<=${e instanceof Date?e.toJSON():ie(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value<=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ie(n.value)}),n}}}function L(e,t){return{kind:"validation",type:"min_length",reference:L,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length<this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function ce(e,t){return{kind:"validation",type:"min_value",reference:ce,async:!1,expects:`>=${e instanceof Date?e.toJSON():ie(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value>=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ie(n.value)}),n}}}function Re(e){return{kind:"transformation",type:"transform",reference:Re,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function De(){return{kind:"transformation",type:"trim",reference:De,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}var It={abortEarly:!0};function Tt(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function je(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function F(e,t){return{kind:"schema",type:"array",reference:F,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){var o;let s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let a=0;a<s.length;a++){let p=s[a],u=this.item["~run"]({value:p},r);if(u.issues){let f={type:"array",origin:"value",input:s,key:a,value:p};for(let d of u.issues)d.path?d.path.unshift(f):d.path=[f],(o=n.issues)==null||o.push(d);if(n.issues||(n.issues=u.issues),r.abortEarly){n.typed=!1;break}}u.typed||(n.typed=!1),n.value.push(u.value)}}else I(this,"type",n,r);return n}}}function ge(e){return{kind:"schema",type:"boolean",reference:ge,expects:"boolean",async:!1,message:e,get"~standard"(){return N(this)},"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:I(this,"type",t,n),t}}}function _(e,t){return{kind:"schema",type:"literal",reference:_,expects:ie(e),async:!1,literal:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){return n.value===this.literal?n.typed=!0:I(this,"type",n,r),n}}}function m(e,t){return{kind:"schema",type:"nullable",reference:m,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return N(this)},"~run"(n,r){return n.value===null&&(this.default!==void 0&&(n.value=je(this,n,r)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function v(e,t){return{kind:"schema",type:"nullish",reference:v,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return N(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=je(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function b(e){return{kind:"schema",type:"number",reference:b,expects:"number",async:!1,message:e,get"~standard"(){return N(this)},"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:I(this,"type",t,n),t}}}function c(e,t){return{kind:"schema",type:"object",reference:c,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){var o;let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let a in this.entries){let p=this.entries[a];if(a in s||(p.type==="exact_optional"||p.type==="optional"||p.type==="nullish")&&p.default!==void 0){let u=a in s?s[a]:je(p),f=p["~run"]({value:u},r);if(f.issues){let d={type:"object",origin:"value",input:s,key:a,value:u};for(let y of f.issues)y.path?y.path.unshift(d):y.path=[d],(o=n.issues)==null||o.push(y);if(n.issues||(n.issues=f.issues),r.abortEarly){n.typed=!1;break}}f.typed||(n.typed=!1),n.value[a]=f.value}else if(p.fallback!==void 0)n.value[a]=Tt(p);else if(p.type!=="exact_optional"&&p.type!=="optional"&&p.type!=="nullish"&&(I(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:s,key:a,value:s[a]}]}),r.abortEarly))break}}else I(this,"type",n,r);return n}}}function g(e,t){return{kind:"schema",type:"optional",reference:g,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return N(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=je(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function A(e,t){return{kind:"schema",type:"picklist",reference:A,expects:en(e.map(ie),"|"),async:!1,options:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){return this.options.includes(n.value)?n.typed=!0:I(this,"type",n,r),n}}}function K(e,t,n){return{kind:"schema",type:"record",reference:K,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return N(this)},"~run"(r,s){var a,p;let o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(let u in o)if(St(o,u)){let f=o[u],d=this.key["~run"]({value:u},s);if(d.issues){let E={type:"object",origin:"key",input:o,key:u,value:f};for(let l of d.issues)l.path=[E],(a=r.issues)==null||a.push(l);if(r.issues||(r.issues=d.issues),s.abortEarly){r.typed=!1;break}}let y=this.value["~run"]({value:f},s);if(y.issues){let E={type:"object",origin:"value",input:o,key:u,value:f};for(let l of y.issues)l.path?l.path.unshift(E):l.path=[E],(p=r.issues)==null||p.push(l);if(r.issues||(r.issues=y.issues),s.abortEarly){r.typed=!1;break}}(!d.typed||!y.typed)&&(r.typed=!1),d.typed&&(r.value[d.value]=y.value)}}else I(this,"type",r,s);return r}}}function i(e){return{kind:"schema",type:"string",reference:i,expects:"string",async:!1,message:e,get"~standard"(){return N(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:I(this,"type",t,n),t}}}function In(e){let t;if(e)for(let n of e)if(t)for(let r of n.issues)t.push(r);else t=n.issues;return t}function be(e,t){return{kind:"schema",type:"union",reference:be,expects:en(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return N(this)},"~run"(n,r){let s,o,a;for(let p of this.options){let u=p["~run"]({value:n.value},r);if(u.typed)if(u.issues)o?o.push(u):o=[u];else{s=u;break}else a?a.push(u):a=[u]}if(s)return s;if(o){if(o.length===1)return o[0];I(this,"type",n,r,{issues:In(o)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];I(this,"type",n,r,{issues:In(a)})}return n}}}function sn(){return{kind:"schema",type:"unknown",reference:sn,expects:"unknown",async:!1,get"~standard"(){return N(this)},"~run"(e){return e.typed=!0,e}}}function pe(e,t,n){return{kind:"schema",type:"variant",reference:pe,expects:"Object",async:!1,key:e,options:t,message:n,get"~standard"(){return N(this)},"~run"(r,s){let o=r.value;if(o&&typeof o=="object"){let a,p=0,u=this.key,f=[],d=(y,E)=>{for(let l of y.options){if(l.type==="variant")d(l,new Set(E).add(l.key));else{let k=!0,T=0;for(let x of E){let C=l.entries[x];if(x in o?C["~run"]({typed:!1,value:o[x]},It).issues:C.type!=="exact_optional"&&C.type!=="optional"&&C.type!=="nullish"){k=!1,u!==x&&(p<T||p===T&&x in o&&!(u in o))&&(p=T,u=x,f=[]),u===x&&f.push(l.entries[x].expects);break}T++}if(k){let x=l["~run"]({value:o},s);(!a||!a.typed&&x.typed)&&(a=x)}}if(a&&!a.issues)break}};if(d(this,new Set([this.key])),a)return a;I(this,"type",r,s,{input:o[u],expected:en(f,"|"),path:[{type:"object",origin:"value",input:o,key:u,value:o[u]}]})}else I(this,"type",r,s);return r}}}function w(...e){return G(j({},e[0]),{pipe:e,get"~standard"(){return N(this)},"~run"(t,n){for(let r of e)if(r.kind!=="metadata"){if(t.issues&&(r.kind==="schema"||r.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r["~run"](t,n))}return t}})}function Oe(e,t,n){let r=e["~run"]({value:t},Tn(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var Pt=["agent","sdk","form","integration","migration"],Rt=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var Dt=["screening","cv_match","interview","overall"],jt=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],Ot=["job","company"],Ct=["created_at","updated_at"],Nt=["asc","desc"],Lt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],Ft=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],qt=["user","system","automation","integration","candidate"],Ce=A(Pt),H=A(Rt),M=w(i(),De(),L(1),Pe(100)),Ne=A(Dt),Pn=A(jt),Cr=A(Ot),Rn=A(Ct),Dn=A(Nt),ke=w(i(),De(),L(1),Pe(100)),Le=A(Lt),jn=A(Ft),On=A(qt);var q=pe("type",[c({type:_("user"),id:w(i(),L(1)),email:w(i(),L(1)),name:w(i(),L(1))}),c({type:_("system"),id:w(i(),L(1)),name:g(i())}),c({type:_("automation"),id:w(i(),L(1)),name:g(i())}),c({type:_("integration"),id:w(i(),L(1)),name:g(i())}),c({type:_("candidate"),id:w(i(),L(1)),email:g(i())})]);var Mt=c({total:b(),page:b(),perPage:b(),lastPage:b()});function Fe(e){return c({data:F(e),pagination:Mt})}var _e=c({id:i(),email:m(i()),firstName:m(i()),lastName:m(i()),phone:m(i()),source:m(Ce),identifiedAt:m(i()),createdAt:i(),updatedAt:i()});var fe=w(i(),L(1)),Cn=w(b(),le(),ce(1)),Y=K(i(),sn());var Nn=c({id:i(),applicationId:i(),status:Pn,scheduledAt:m(i()),completedAt:m(i()),meta:m(Y),createdAt:i(),updatedAt:i()});var on=c({score:b(),reason:i(),confidence:b()}),Ln=c({id:i(),candidateId:i(),jobId:b(),stage:M,stageGroup:H,stageEnteredAt:i(),rating:m(b()),disqualifiedAt:m(i()),disqualificationReason:m(ke),disqualificationNote:m(i()),source:Le,sourceDetail:m(i()),sessionId:m(b()),externalApplicationId:m(i()),meta:m(Y),context:m(Y),scoredAt:m(i()),createdAt:i(),updatedAt:i()}),Gt=c({id:i(),applicationId:i(),scoreType:Ne,score:m(b()),reason:m(i()),categories:m(K(i(),on)),scoredBy:m(i()),createdAt:i()}),qe=c(G(j({},Ln.entries),{candidate:m(_e),score:m(Gt),interview:m(Nn)})),Bt=c(G(j({},_e.entries),{applications:F(Ln)})),Fn=c({id:i(),applicationId:i(),action:jn,fromStage:m(M),fromStageGroup:m(H),toStage:m(M),toStageGroup:m(H),disqualificationReason:m(ke),disqualificationNote:m(i()),actorId:m(i()),actorType:On,actorEmail:m(i()),actorName:m(i()),meta:m(Y),schemaVersion:b(),createdAt:i()});var qn=c({anonymousId:fe,email:fe,firstName:v(i()),lastName:v(i()),phone:v(i()),source:v(Ce)}),Mn=c({candidateId:i(),isNew:ge()});var zt=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],Ge=A(zt),Gn=w(i(),Re(e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0))),Ut=w(Gn,F(M)),Vt=w(Gn,F(H)),Bn=w(i(),Re(e=>e.split(",").map(t=>Number(t.trim())).filter(t=>Number.isInteger(t)&&t>0))),ti=c({stages:g(Ut),stage_groups:g(Vt),job_id:g(i()),job_ids:g(Bn),candidate_id:g(i()),is_disqualified:g(A(["true","false"])),created_from:g(i()),created_to:g(i()),updated_from:g(i()),updated_to:g(i()),entered_stage_from:g(i()),entered_stage_to:g(i()),from:g(i()),to:g(i()),q:g(i()),scored:g(A(["true","false"])),sort:g(Rn),order:g(Dn),page:g(i()),per_page:g(i())}),ri=w(c({candidateId:fe,jobId:Cn,meta:v(Y),sessionId:v(b()),externalApplicationId:v(i()),context:v(Y),source:v(Le),sourceDetail:v(i()),stage:v(M),stageGroup:v(H),actor:v(q)}),nn(e=>e.stage==null==(e.stageGroup==null),"stage and stageGroup must be supplied together")),zn=c({id:i(),stageGroup:i(),createdAt:i()}),ii=be([c({ok:_(!0),duplicate:_(!1),applicationId:i(),candidateId:i()}),c({ok:_(!0),duplicate:_(!0),existingApplication:zn})]),Un=c({isDuplicate:ge(),existingApplication:g(zn)}),si=c({applicationId:fe,scoreType:Ne,score:b(),reason:v(i()),categories:v(K(i(),on)),scoredBy:v(i()),actor:v(q)}),oi=c({scoreId:i()}),ui=Fe(qe);var ai=A(["already_in_target_stage","not_in_source_stage","disqualified"]),li=F(Fn),Me=c({stage:v(M),note:v(i())}),Jt=c({stage:v(M),startDate:v(i()),note:v(i())}),Wt=pe("action",[c({action:_("shortlist"),actor:q,meta:v(Me)}),c({action:_("move_to_interview"),actor:q,meta:v(Me)}),c({action:_("make_offer"),actor:q,meta:v(Me)}),c({action:_("hire"),actor:q,meta:v(Jt)}),c({action:_("withdraw"),actor:q,meta:v(Me)}),c({action:_("move_to_stage"),actor:q,meta:c({stage:M,stageGroup:H,note:v(i())})}),c({action:_("stage_transition"),actor:q,meta:c({toStage:M,toStageGroup:H,note:v(i())})}),c({action:_("disqualify"),actor:q,meta:c({reason:ke,note:v(i())})}),c({action:_("reinstate"),actor:q,meta:c({toStage:M,toStageGroup:H,note:v(i())})}),c({action:_("rate"),actor:q,meta:c({rating:m(w(b(),le(),ce(1),rn(5)))})})]),ci=c({applicationIds:w(F(i()),L(1)),body:Wt}),Vn=A(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),pi=pe("kind",[c({kind:_("updated"),action:Ge,application:qe}),c({kind:_("skipped"),action:Ge,applicationId:i(),reason:Vn})]),fi=c({updated:F(c({kind:_("updated"),action:Ge,application:qe})),skipped:F(c({kind:_("skipped"),action:Ge,applicationId:i(),reason:Vn})),failed:F(c({applicationId:i(),error:i()}))}),se=w(b(),le(),ce(0)),Kt=c({APPLIED:se,SHORTLISTED:se,INTERVIEWED:se,OFFERED:se,HIRED:se,REJECTED:se,WITHDRAWN:se}),yi=c({job_ids:Bn}),mi=c({counts:K(i(),Kt)});var bi=Fe(_e);var _i=c({avg_score:m(b()),p90_score:m(b()),p85_score:m(b()),p80_score:m(b()),total_scores:b(),total_shortlists:b()});var un=({environment:e,publishableKey:t,logger:n})=>{let r=gn[e];return{checkDuplicate(o){return O(this,null,function*(){try{let a=new URLSearchParams({email:o.email,scope:o.scope});o.scope==="job"&&o.jobId!=null&&a.set("job_id",String(o.jobId));let p=yield fetch(`${r}/applications/check-duplicate?${a}`,{method:"GET",headers:{Accept:"application/json","x-publishable-key":t}});if(!p.ok)return n.error(`[TalentBankClient] checkDuplicate failed with status ${p.status}`),{isDuplicate:!1};let u=yield p.json(),f=Oe(Un,u);return f.success?f.output:(n.error("[TalentBankClient] checkDuplicate response failed strict validation; falling back to isDuplicate flag"),typeof u=="object"&&u!=null&&typeof u.isDuplicate=="boolean"?{isDuplicate:u.isDuplicate}:{isDuplicate:!1})}catch(a){return n.error("[TalentBankClient] checkDuplicate failed:",a),{isDuplicate:!1}}})},identify(o){return O(this,null,function*(){var a;try{if(!o.anonymousId)return n.error("[TalentBankClient] identify skipped because anonymousId is missing"),null;let p={email:o.email,firstName:o.firstName,lastName:o.lastName,phone:o.phone,anonymousId:o.anonymousId,source:(a=o.source)!=null?a:"sdk"},u=Oe(qn,p);if(!u.success)return n.error("[TalentBankClient] identify received invalid input"),null;let f=yield fetch(`${r}/identify`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","x-publishable-key":t},body:JSON.stringify(u.output)});if(!f.ok)return n.error(`[TalentBankClient] identify failed with status ${f.status}`),null;let d=Oe(Mn,yield f.json());return d.success?d.output:(n.error("[TalentBankClient] identify returned an invalid response"),null)}catch(p){return n.error("[TalentBankClient] identify failed:",p),null}})}}};var xe=()=>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 an(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Jn=["DAILY","WEEKLY","MONTHLY"],Ht=K(i(),be([i(),F(i()),c({type:_("provided"),lat:b(),lng:b(),radius:b(),unit:g(A(["miles","km"])),label:g(i())})])),Vi={pathname:"/job/:id",method:"GET",schema:{response:c({id:b(),external_id:v(i()),city:v(i()),town:v(i()),category:v(i())})}};var Xt={pathname:"/search/save",method:"POST",schema:{response:re(),body:c({contact:c({email:w(g(i()),i(),tn()),first_name:g(i()),last_name:g(i())}),alerts:w(g(i()),i(),A(Jn)),filters:Ht})}};Wn();var Hn=7*24*60*60*1e3,Xn=e=>{let t=new Date;return t.setTime(t.getTime()+Hn),`${$}=${e};expires=${t.toUTCString()};path=/`},$t=(e,t)=>{let n=e.get("session_id");if(t||n)return n;let r=sessionStorage.getItem(`${$}-session_id`);return typeof r=="string"?r:null},Yt=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(Te);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Zt=e=>{if(typeof window!="undefined")try{e?window.localStorage.setItem(Te,e):window.localStorage.removeItem(Te)}catch(t){}},Qt=new RegExp(`(?:^|;\\s*)${$}=([^;]+)`),we=e=>{var n,r;let t=e?e.headers.get("cookie"):document.cookie;return t&&(r=(n=Qt.exec(t))==null?void 0:n[1])!=null?r:null},$n=()=>{var e;try{let t=JSON.parse((e=window.localStorage.getItem($))!=null?e:"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch(t){return null}},Kn=()=>{var e;return(e=we())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:$n()},er=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",Yn=e=>{if(document.cookie=Xn(e)+er(),we()!==e)try{window.localStorage.setItem($,JSON.stringify({id:e,expires:Date.now()+Hn}))}catch(t){}},fn=e=>{var r,s,o;let t=e?e.url:location.href,{searchParams:n}=new URL(t);return{anonymous_id:e?(r=we(e))!=null?r:n.get("anonymous_id"):(o=(s=we())!=null?s:n.get("anonymous_id"))!=null?o:$n(),session_id:$t(n,typeof window=="undefined")}},cn=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=fn().anonymous_id;if(e)return e;let t=xe(),n=fn().anonymous_id;return n||(Yn(t),t)},nr=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},tr=e=>e==="about:client"?"":e,rr={pathname:"/log",method:"POST",schema:{response:re(),body:re()}},Zn=({rpcClient:e,logger:t,onEvent:n,talentBank:r,persistence:s="device"})=>{let o=null,a=null,p=0,u=0,f=l=>s==="none"?{anonymous_id:null,session_id:l?null:o}:fn(l),d=(l,k)=>O(void 0,null,function*(){var T,x;try{let C={library:{name:"inploi-sdk",version:bn},page:k},h=f(l.request);s==="device"&&l.event==="IDENTIFY"&&!h.anonymous_id&&!l.request&&typeof window!="undefined"&&(h=G(j({},h),{anonymous_id:cn()}));let Q=s==="none"?null:Yt();if(l.event==="IDENTIFY"&&r&&(h.anonymous_id||s==="none")){let X=l.properties,ne=yield r.identify({email:(T=X.email)!=null?T:X.identifier,firstName:X.first_name,lastName:X.last_name,phone:X.phone_number,anonymousId:(x=h.anonymous_id)!=null?x:xe(),source:"sdk"});ne!=null&&ne.candidateId&&s==="device"&&(Q=ne.candidateId,Zt(ne.candidateId))}let P={anonymous_id:h.anonymous_id,session_id:h.session_id,candidate_id:Q,event:l.event,sent_at:new Date().toISOString(),context:C,properties:l.properties,custom_properties:l.customProperties},oe=s==="none"?null:l.request?we(l.request):Kn(),ue=++p,ee=yield e.request(rr,j({body:P},l.keepalive&&{keepalive:!0})),S=nr(ee);if(s==="none")return!l.request&&(S!=null&&S.session_id)&&ue>u&&(u=ue,S.session_id!==P.session_id&&(o=S.session_id)),P.session_id=l.request?(S==null?void 0:S.session_id)||null:o,n==null||n(P),{success:!0,data:P};let z=l.request?oe:Kn(),D=z!==null&&z!==oe,U=z!=null?z:oe,ye=!D&&(!U||!(S!=null&&S.anonymous_id)||U===S.anonymous_id);return ye?(S!=null&&S.anonymous_id&&(P.anonymous_id=S.anonymous_id),S!=null&&S.session_id&&(P.session_id=S.session_id)):P.anonymous_id=U,!l.request&&typeof window!="undefined"&&P.anonymous_id&&(ye&&P.session_id&&sessionStorage.setItem(`${$}-session_id`,P.session_id.toString()),Yn(P.anonymous_id)),n==null||n(P),{success:!0,data:P}}catch(C){return t.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:C}}}),y=Promise.resolve();return{log:l=>O(void 0,null,function*(){Be(l.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let k="request"in l&&l.request?{href:l.request.url,referrer:tr(l.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};if(s==="none"&&l.event==="FLOW_NODE"&&l.properties&&"trigger"in l.properties&&(l.properties.trigger==="pagehide"||l.properties.trigger==="hidden")&&(l=G(j({},l),{keepalive:!0})),s==="device"||l.request||o||l.keepalive)return d(l,k);let T=()=>d(l,k),x=y.then(T,T);return y=x,x}),getHeaders:l=>{let k=new Headers;return s==="none"||!(l!=null&&l.anonymous_id)||k.append("Set-Cookie",Xn(l.anonymous_id)),k},getSessionInfo:f,getOrCreateAnonymousId:()=>s==="none"?a!=null?a:a=xe():cn()}};function pn({publishableKey:e,env:t,logger:n=ze,onEvent:r,persistence:s}){let o=hn({baseUrl:Ie[t],publishableKey:e}),a=n===!1?Ue:n,p=new ve({environment:t,apiKey:{type:"publishable",key:e},logger:a}),u=un({environment:t,publishableKey:e,logger:a}),f=Zn({rpcClient:p,logger:a,onEvent:r,talentBank:u,persistence:s});return{register:y=>y({logger:a,apiClient:o,analytics:f,rpcClient:p,publishableKey:e,env:t}),analytics:f,apiClient:o}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=pn;window.inploi.ready=an;})();
|
|
3
|
+
"use strict";(()=>{var Jn=Object.defineProperty,Wn=Object.defineProperties;var Hn=Object.getOwnPropertyDescriptors;var ln=Object.getOwnPropertySymbols;var Xn=Object.prototype.hasOwnProperty,$n=Object.prototype.propertyIsEnumerable;var cn=(e,t,n)=>t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))Xn.call(t,n)&&cn(e,n,t[n]);if(ln)for(var n of ln(t))$n.call(t,n)&&cn(e,n,t[n]);return e},G=(e,t)=>Wn(e,Hn(t));var Yn=(e,t)=>()=>(e&&(t=e(e=0)),t);var F=(e,t,n)=>new Promise((r,s)=>{var o=u=>{try{p(n.next(u))}catch(y){s(y)}},a=u=>{try{p(n.throw(u))}catch(y){s(y)}},p=u=>u.done?r(u.value):Promise.resolve(u.value).then(o,a);p((n=n.apply(e,t)).next())});var Fn=Yn(()=>{"use strict"});function Fe(e,t){if(!e)throw new Error(t)}function ie(e,t){return t in e}var ur=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});var _e="%c[inploi SDK]",xe="color: #65BC67; font-weight: bold;",qe={warn:(...e)=>console.warn(_e,xe,...e),error:(...e)=>console.error(_e,xe,...e),info:(...e)=>console.info(_e,xe,...e),log:(...e)=>console.log(_e,xe,...e)},Me={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var Zn="Unauthenticated",Qn="This action is unauthorized.",Q=class extends Error{constructor(n,r){super(n);this.status=r,this.name="ErrorWithStatus"}},pe=class extends Q{constructor(t){super(t!=null?t:"Not found"),this.name="NotFoundError",this.status=404}},fe=class extends Q{constructor(t,n){super(t!=null?t:"You are not authorised to perform this action."),this.name="UnauthorisedError",this.status=n!=null?n:401}},Z=class extends Q{constructor(n,r){let s=r?` in ${r}`:"";super(`Schema validation failed${s}`);this.issues=n;this.source=r;this.name="SchemaValidationError",this.status=400}},Ee=class extends Q{constructor(n,r,s){super(n);this.data=s;this.name="ApiError",this.status=r!=null?r:500}};var ye=class extends Q{constructor(n){var r;super("Error parsing response into JSON.");this.response=n;this.name="ParsingError",this.status=n&&n.status>=300?n.status:500,this.contentType=(r=new Headers(n==null?void 0:n.headers).get("content-type"))!=null?r:void 0}};function Ge(e){return F(this,null,function*(){let t=new Headers(e.headers).get("content-type"),n=t==null?void 0:t.replace(/;.*/,"").trim().toLowerCase();if(n&&n!=="application/json"&&!n.endsWith("+json"))throw new ye(e);return e.json().catch(()=>{throw new ye(e)})})}var et=["message","error","errors","exception","exceptions"];function nt(e){let t=[];if(typeof e=="object"&&e!==null){for(let n of et)if(ie(e,n)){let r=e[n];typeof r=="string"&&t.push(r),Array.isArray(r)&&r.every(s=>typeof s=="string")&&t.push(...r)}ie(e,"integration_response")&&typeof e.integration_response=="object"&&e.integration_response!==null&&ie(e.integration_response,"error")&&typeof e.integration_response.error=="object"&&e.integration_response.error!==null&&ie(e.integration_response.error,"message")&&typeof e.integration_response.error.message=="string"&&t.push(e.integration_response.error.message)}return t.length===0&&t.push("Unknown error"),[...new Set(t)].join(", ")}function Be(e,t){if(t>=300){let n=nt(e);throw t===404?new pe(n):n===Zn?new fe("You are not authenticated.",t):n===Qn?new fe(n,t):new Ee(n,t,e)}}var pn=e=>{let t={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(s,...o)=>F(void 0,[s,...o],function*(n,r={}){let a=G(O({},r),{headers:O(O({},r.headers),t)}),p=yield fetch(`${e.baseUrl}${n}`,a);if(p.status===404)throw new pe;let u=yield Ge(p);return Be(u,p.status),u})}};var fn="3.0.0";var we={sandbox:"https://api.staging.inploi.com",production:"https://api.inploi.com",_internal_local:"http://api.test"};var yn=fn;var H="isdk_session",mn=`${H}-candidate_id`,rt=`${H}-consent`;var Ve="RFC3986",Ke={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)},it="RFC1738";var st=Array.isArray,B=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();var ze=1024,ot=(e,t,n,r,s)=>{if(e.length===0)return e;let o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});let a="";for(let p=0;p<o.length;p+=ze){let u=o.length>=ze?o.slice(p,p+ze):o,y=[];for(let d=0;d<u.length;++d){let f=u.charCodeAt(d);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||s===it&&(f===40||f===41)){y[y.length]=u.charAt(d);continue}if(f<128){y[y.length]=B[f];continue}if(f<2048){y[y.length]=B[192|f>>6]+B[128|f&63];continue}if(f<55296||f>=57344){y[y.length]=B[224|f>>12]+B[128|f>>6&63]+B[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|u.charCodeAt(d)&1023),y[y.length]=B[240|f>>18]+B[128|f>>12&63]+B[128|f>>6&63]+B[128|f&63]}a+=y.join("")}return a};function ut(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function dn(e,t){if(st(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var _r=Array.isArray;var at=Object.prototype.hasOwnProperty,hn={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},z=Array.isArray,lt=Array.prototype.push,vn=function(e,t){lt.apply(e,z(t)?t:[t])},ct=Date.prototype.toISOString,R={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ot,encodeValuesOnly:!1,format:Ve,formatter:Ke[Ve],indices:!1,serializeDate(e){return ct.call(e)},skipNulls:!1,strictNullHandling:!1};function pt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}var Ue={};function gn(e,t,n,r,s,o,a,p,u,y,d,f,S,c,k,j,x,D){let g=e,T=D,$=0,le=!1;for(;(T=T.get(Ue))!==void 0&&!le;){let P=T.get(e);if($+=1,typeof P!="undefined"){if(P===$)throw new RangeError("Cyclic object value");le=!0}typeof T.get(Ue)=="undefined"&&($=0)}if(typeof y=="function"?g=y(t,g):g instanceof Date?g=S==null?void 0:S(g):n==="comma"&&z(g)&&(g=dn(g,function(P){return P instanceof Date?S==null?void 0:S(P):P})),g===null){if(o)return u&&!j?u(t,R.encoder,x,"key",c):t;g=""}if(pt(g)||ut(g)){if(u){let P=j?t:u(t,R.encoder,x,"key",c);return[(k==null?void 0:k(P))+"="+(k==null?void 0:k(u(g,R.encoder,x,"value",c)))]}return[(k==null?void 0:k(t))+"="+(k==null?void 0:k(String(g)))]}let ce=[];if(typeof g=="undefined")return ce;let E;if(n==="comma"&&z(g))j&&u&&(g=dn(g,u)),E=[{value:g.length>0?g.join(",")||null:void 0}];else if(z(y))E=y;else{let P=Object.keys(g);E=d?P.sort(d):P}let Y=p?String(t).replace(/\./g,"%2E"):String(t),re=r&&z(g)&&g.length===1?Y+"[]":Y;if(s&&z(g)&&g.length===0)return re+"[]";for(let P=0;P<E.length;++P){let W=E[P],un=typeof W=="object"&&typeof W.value!="undefined"?W.value:g[W];if(a&&un===null)continue;let Le=f&&p?W.replace(/\./g,"%2E"):W,Kn=z(g)?typeof n=="function"?n(re,Le):re:re+(f?"."+Le:"["+Le+"]");D.set(e,$);let an=new WeakMap;an.set(Ue,D),vn(ce,gn(un,Kn,n,r,s,o,a,p,n==="comma"&&j&&z(g)?null:u,y,d,f,S,c,k,j,x,an))}return ce}function ft(e=R){if(typeof e.allowEmptyArrays!="undefined"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys!="undefined"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder!="undefined"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");let t=e.charset||R.charset;if(typeof e.charset!="undefined"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=Ve;if(typeof e.format!="undefined"){if(!at.call(Ke,e.format))throw new TypeError("Unknown format option provided.");n=e.format}let r=Ke[n],s=R.filter;(typeof e.filter=="function"||z(e.filter))&&(s=e.filter);let o;if(e.arrayFormat&&e.arrayFormat in hn?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=R.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof e.allowDots=="undefined"?e.encodeDotInKeys?!0:R.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:R.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:R.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:R.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter=="undefined"?R.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:R.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:R.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:R.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:R.encodeValuesOnly,filter:s,format:n,formatter:r,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:R.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:R.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:R.strictNullHandling}}function bn(e,t={}){let n=e,r=ft(t),s,o;typeof r.filter=="function"?(o=r.filter,n=o("",n)):z(r.filter)&&(o=r.filter,s=o);let a=[];if(typeof n!="object"||n===null)return"";let p=hn[r.arrayFormat],u=p==="comma"&&r.commaRoundTrip;s||(s=Object.keys(n)),r.sort&&s.sort(r.sort);let y=new WeakMap;for(let S=0;S<s.length;++S){let c=s[S];r.skipNulls&&n[c]===null||vn(a,gn(n[c],c,p,u,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,y))}let d=a.join(r.delimiter),f=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),d.length>0?f+d:""}function Je(e,t,n){let r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Async schema");if(r.issues)throw new Z(r.issues,n);return r.value}function yt(e,t,n){try{return{success:!0,output:Je(e,t,n)}}catch(r){if(r instanceof Z)return{success:!1,issues:r.issues,source:r.source};throw r}}var me=class{constructor(t){if(this.baseUrl=we[t.environment],this.headers=new Headers({"Content-Type":"application/json",Accept:"application/json"}),t.apiKey.type==="secret"){if(typeof window!="undefined")throw new Error("Secret key cannot be used in a browser environment");this.headers.set("x-secret-key",t.apiKey.key)}else this.headers.set("x-publishable-key",t.apiKey.key);this.logger=t.logger,this._environment=t.environment}get environment(){return this._environment}getFetchParams(t,n){var u;let r=(u=n.validateIn)!=null?u:!0,{searchParams:s,body:o}=r?kn(t,n):n,a=new URL(this.baseUrl),p=t.pathname;if("params"in n&&n.params)for(let[y,d]of Object.entries(n.params))p=p.replace(`:${y}`,String(d));return a.pathname=p,t.schema.searchParams&&(a.search=bn(s)),[a.toString(),O({method:t.method,body:o?JSON.stringify(o):void 0,headers:this.headers,signal:n.signal},n.keepalive&&{keepalive:!0})]}parseResponse(t,n){return F(this,null,function*(){var a;let r=yield Ge(n.response);if(Be(r,n.response.status),!((a=n.validateOut)!=null?a:!0))return r;let o=yt(t.schema.response,r,"response");if(!o.success)throw new Z(o.issues,o.source);return o.output})}request(t,n){return F(this,null,function*(){try{let r=this.getFetchParams(t,n),s=yield fetch(...r);return yield this.parseResponse(t,{response:s,validateOut:n.validateOut})}catch(r){throw r instanceof Z?this.logger.error(r.message,r.issues):this.logger.error(r),r}})}};function ee(){return{"~standard":{vendor:"inploi",version:1,validate:e=>({value:e})}}}function kn(e,t){let n={searchParams:void 0,body:void 0,validateIn:!1};return e.schema.searchParams&&(n.searchParams=Je(e.schema.searchParams,"searchParams"in t?t.searchParams:{})),e.schema.body&&(n.body=Je(e.schema.body,"body"in t?t.body:{})),n}var U,mt={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function dt(e){var t,n,r;return!e&&!U?mt:{lang:(t=e==null?void 0:e.lang)!=null?t:U==null?void 0:U.lang,message:e==null?void 0:e.message,abortEarly:(n=e==null?void 0:e.abortEarly)!=null?n:U==null?void 0:U.abortEarly,abortPipeEarly:(r=e==null?void 0:e.abortPipeEarly)!=null?r:U==null?void 0:U.abortPipeEarly}}var We;function ht(e){return We==null?void 0:We.get(e)}var He;function vt(e){return He==null?void 0:He.get(e)}var Xe;function gt(e,t){var n;return(n=Xe==null?void 0:Xe.get(e))==null?void 0:n.get(t)}function ne(e){var n,r,s;let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(s=e&&((r=(n=Object.getPrototypeOf(e))==null?void 0:n.constructor)==null?void 0:r.name))!=null?s:"null":t}function I(e,t,n,r,s){var f,S,c,k,j,x,D,g;let o=s&&"input"in s?s.input:n.value,a=(S=(f=s==null?void 0:s.expected)!=null?f:e.expects)!=null?S:null,p=(c=s==null?void 0:s.received)!=null?c:ne(o),u={kind:e.kind,type:e.type,input:o,expected:a,received:p,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${p}`,requirement:e.requirement,path:s==null?void 0:s.path,issues:s==null?void 0:s.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},y=e.kind==="schema",d=(g=(D=(x=(j=(k=s==null?void 0:s.message)!=null?k:e.message)!=null?j:gt(e.reference,u.lang))!=null?x:y?vt(u.lang):null)!=null?D:r.message)!=null?g:ht(u.lang);d!==void 0&&(u.message=typeof d=="function"?d(u):d),y&&(n.typed=!1),n.issues?n.issues.push(u):n.issues=[u]}var _n=new WeakMap;function C(e){let t=_n.get(e);return t||(t={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},dt())}},_n.set(e,t)),t}function bt(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!=="__proto__"&&t!=="prototype"&&t!=="constructor"}function $e(e,t){var r;let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:(r=n[0])!=null?r:"never"}var kt=/^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu,Pr=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function Ye(e,t){return{kind:"validation",type:"check",reference:Ye,async:!1,expects:null,requirement:e,message:t,"~run"(n,r){return n.typed&&!this.requirement(n.value)&&I(this,"input",n,r),n}}}function Ze(e){return{kind:"validation",type:"email",reference:Ze,expects:null,async:!1,requirement:kt,message:e,"~run"(t,n){return t.typed&&!this.requirement.test(t.value)&&I(this,"email",t,n),t}}}function se(e){return{kind:"validation",type:"integer",reference:se,async:!1,expects:null,requirement:Number.isInteger,message:e,"~run"(t,n){return t.typed&&!this.requirement(t.value)&&I(this,"integer",t,n),t}}}function Se(e,t){return{kind:"validation",type:"max_length",reference:Se,async:!1,expects:`<=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length>this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function Qe(e,t){return{kind:"validation",type:"max_value",reference:Qe,async:!1,expects:`<=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value<=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function N(e,t){return{kind:"validation",type:"min_length",reference:N,async:!1,expects:`>=${e}`,requirement:e,message:t,"~run"(n,r){return n.typed&&n.value.length<this.requirement&&I(this,"length",n,r,{received:`${n.value.length}`}),n}}}function oe(e,t){return{kind:"validation",type:"min_value",reference:oe,async:!1,expects:`>=${e instanceof Date?e.toJSON():ne(e)}`,requirement:e,message:t,"~run"(n,r){return n.typed&&!(n.value>=this.requirement)&&I(this,"value",n,r,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function Ae(e){return{kind:"transformation",type:"transform",reference:Ae,async:!1,operation:e,"~run"(t){return t.value=this.operation(t.value),t}}}function Ie(){return{kind:"transformation",type:"trim",reference:Ie,async:!1,"~run"(e){return e.value=e.value.trim(),e}}}var _t={abortEarly:!0};function xt(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}function Te(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}function L(e,t){return{kind:"schema",type:"array",reference:L,expects:"Array",async:!1,item:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(Array.isArray(s)){n.typed=!0,n.value=[];for(let a=0;a<s.length;a++){let p=s[a],u=this.item["~run"]({value:p},r);if(u.issues){let y={type:"array",origin:"value",input:s,key:a,value:p};for(let d of u.issues)d.path?d.path.unshift(y):d.path=[y],(o=n.issues)==null||o.push(d);if(n.issues||(n.issues=u.issues),r.abortEarly){n.typed=!1;break}}u.typed||(n.typed=!1),n.value.push(u.value)}}else I(this,"type",n,r);return n}}}function de(e){return{kind:"schema",type:"boolean",reference:de,expects:"boolean",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="boolean"?t.typed=!0:I(this,"type",t,n),t}}}function _(e,t){return{kind:"schema",type:"literal",reference:_,expects:ne(e),async:!1,literal:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===this.literal?n.typed=!0:I(this,"type",n,r),n}}}function m(e,t){return{kind:"schema",type:"nullable",reference:m,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===null&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function h(e,t){return{kind:"schema",type:"nullish",reference:h,expects:`(${e.expects} | null | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return(n.value===null||n.value===void 0)&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===null||n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function b(e){return{kind:"schema",type:"number",reference:b,expects:"number",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:I(this,"type",t,n),t}}}function l(e,t){return{kind:"schema",type:"object",reference:l,expects:"Object",async:!1,entries:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){var o;let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let a in this.entries){let p=this.entries[a];if(a in s||(p.type==="exact_optional"||p.type==="optional"||p.type==="nullish")&&p.default!==void 0){let u=a in s?s[a]:Te(p),y=p["~run"]({value:u},r);if(y.issues){let d={type:"object",origin:"value",input:s,key:a,value:u};for(let f of y.issues)f.path?f.path.unshift(d):f.path=[d],(o=n.issues)==null||o.push(f);if(n.issues||(n.issues=y.issues),r.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value[a]=y.value}else if(p.fallback!==void 0)n.value[a]=xt(p);else if(p.type!=="exact_optional"&&p.type!=="optional"&&p.type!=="nullish"&&(I(this,"key",n,r,{input:void 0,expected:`"${a}"`,path:[{type:"object",origin:"key",input:s,key:a,value:s[a]}]}),r.abortEarly))break}}else I(this,"type",n,r);return n}}}function v(e,t){return{kind:"schema",type:"optional",reference:v,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return C(this)},"~run"(n,r){return n.value===void 0&&(this.default!==void 0&&(n.value=Te(this,n,r)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,r)}}}function A(e,t){return{kind:"schema",type:"picklist",reference:A,expects:$e(e.map(ne),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){return this.options.includes(n.value)?n.typed=!0:I(this,"type",n,r),n}}}function V(e,t,n){return{kind:"schema",type:"record",reference:V,expects:"Object",async:!1,key:e,value:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){var a,p;let o=r.value;if(o&&typeof o=="object"){r.typed=!0,r.value={};for(let u in o)if(bt(o,u)){let y=o[u],d=this.key["~run"]({value:u},s);if(d.issues){let S={type:"object",origin:"key",input:o,key:u,value:y};for(let c of d.issues)c.path=[S],(a=r.issues)==null||a.push(c);if(r.issues||(r.issues=d.issues),s.abortEarly){r.typed=!1;break}}let f=this.value["~run"]({value:y},s);if(f.issues){let S={type:"object",origin:"value",input:o,key:u,value:y};for(let c of f.issues)c.path?c.path.unshift(S):c.path=[S],(p=r.issues)==null||p.push(c);if(r.issues||(r.issues=f.issues),s.abortEarly){r.typed=!1;break}}(!d.typed||!f.typed)&&(r.typed=!1),d.typed&&(r.value[d.value]=f.value)}}else I(this,"type",r,s);return r}}}function i(e){return{kind:"schema",type:"string",reference:i,expects:"string",async:!1,message:e,get"~standard"(){return C(this)},"~run"(t,n){return typeof t.value=="string"?t.typed=!0:I(this,"type",t,n),t}}}function xn(e){let t;if(e)for(let n of e)if(t)for(let r of n.issues)t.push(r);else t=n.issues;return t}function he(e,t){return{kind:"schema",type:"union",reference:he,expects:$e(e.map(n=>n.expects),"|"),async:!1,options:e,message:t,get"~standard"(){return C(this)},"~run"(n,r){let s,o,a;for(let p of this.options){let u=p["~run"]({value:n.value},r);if(u.typed)if(u.issues)o?o.push(u):o=[u];else{s=u;break}else a?a.push(u):a=[u]}if(s)return s;if(o){if(o.length===1)return o[0];I(this,"type",n,r,{issues:xn(o)}),n.typed=!0}else{if((a==null?void 0:a.length)===1)return a[0];I(this,"type",n,r,{issues:xn(a)})}return n}}}function en(){return{kind:"schema",type:"unknown",reference:en,expects:"unknown",async:!1,get"~standard"(){return C(this)},"~run"(e){return e.typed=!0,e}}}function ue(e,t,n){return{kind:"schema",type:"variant",reference:ue,expects:"Object",async:!1,key:e,options:t,message:n,get"~standard"(){return C(this)},"~run"(r,s){let o=r.value;if(o&&typeof o=="object"){let a,p=0,u=this.key,y=[],d=(f,S)=>{for(let c of f.options){if(c.type==="variant")d(c,new Set(S).add(c.key));else{let k=!0,j=0;for(let x of S){let D=c.entries[x];if(x in o?D["~run"]({typed:!1,value:o[x]},_t).issues:D.type!=="exact_optional"&&D.type!=="optional"&&D.type!=="nullish"){k=!1,u!==x&&(p<j||p===j&&x in o&&!(u in o))&&(p=j,u=x,y=[]),u===x&&y.push(c.entries[x].expects);break}j++}if(k){let x=c["~run"]({value:o},s);(!a||!a.typed&&x.typed)&&(a=x)}}if(a&&!a.issues)break}};if(d(this,new Set([this.key])),a)return a;I(this,"type",r,s,{input:o[u],expected:$e(y,"|"),path:[{type:"object",origin:"value",input:o,key:u,value:o[u]}]})}else I(this,"type",r,s);return r}}}function w(...e){return G(O({},e[0]),{pipe:e,get"~standard"(){return C(this)},"~run"(t,n){for(let r of e)if(r.kind!=="metadata"){if(t.issues&&(r.kind==="schema"||r.kind==="transformation")){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r["~run"](t,n))}return t}})}var Et=["agent","sdk","form","integration","migration"],wt=["APPLIED","SHORTLISTED","INTERVIEWED","OFFERED","HIRED","REJECTED","WITHDRAWN"];var St=["screening","cv_match","interview","overall"],At=["PENDING","SCHEDULED","IN_PROGRESS","COMPLETED","CANCELLED"],It=["job","company"],Tt=["created_at","updated_at"],Pt=["asc","desc"],Rt=["careers_site","chatbot","plugin_job_search","ats_import","referral","agency","other","unknown"],jt=["submit","stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate","score_written"],Dt=["user","system","automation","integration","candidate"],Pe=A(Et),J=A(wt),M=w(i(),Ie(),N(1),Se(100)),Re=A(St),En=A(At),jr=A(It),wn=A(Tt),Sn=A(Pt),ve=w(i(),Ie(),N(1),Se(100)),je=A(Rt),An=A(jt),In=A(Dt);var q=ue("type",[l({type:_("user"),id:w(i(),N(1)),email:w(i(),N(1)),name:w(i(),N(1))}),l({type:_("system"),id:w(i(),N(1)),name:v(i())}),l({type:_("automation"),id:w(i(),N(1)),name:v(i())}),l({type:_("integration"),id:w(i(),N(1)),name:v(i())}),l({type:_("candidate"),id:w(i(),N(1)),email:v(i())})]);var Ot=l({total:b(),page:b(),perPage:b(),lastPage:b()});function De(e){return l({data:L(e),pagination:Ot})}var ge=l({id:i(),email:m(i()),firstName:m(i()),lastName:m(i()),phone:m(i()),source:m(Pe),identifiedAt:m(i()),createdAt:i(),updatedAt:i()});var ae=w(i(),N(1)),Tn=w(b(),se(),oe(1)),X=V(i(),en());var Pn=l({id:i(),applicationId:i(),status:En,scheduledAt:m(i()),completedAt:m(i()),meta:m(X),createdAt:i(),updatedAt:i()});var nn=l({score:b(),reason:i(),confidence:b()}),Rn=l({id:i(),candidateId:i(),jobId:b(),stage:M,stageGroup:J,stageEnteredAt:i(),rating:m(b()),disqualifiedAt:m(i()),disqualificationReason:m(ve),disqualificationNote:m(i()),source:je,sourceDetail:m(i()),sessionId:m(b()),externalApplicationId:m(i()),meta:m(X),context:m(X),scoredAt:m(i()),createdAt:i(),updatedAt:i()}),Ct=l({id:i(),applicationId:i(),scoreType:Re,score:m(b()),reason:m(i()),categories:m(V(i(),nn)),scoredBy:m(i()),createdAt:i()}),Oe=l(G(O({},Rn.entries),{candidate:m(ge),score:m(Ct),interview:m(Pn)})),Nt=l(G(O({},ge.entries),{applications:L(Rn)})),jn=l({id:i(),applicationId:i(),action:An,fromStage:m(M),fromStageGroup:m(J),toStage:m(M),toStageGroup:m(J),disqualificationReason:m(ve),disqualificationNote:m(i()),actorId:m(i()),actorType:In,actorEmail:m(i()),actorName:m(i()),meta:m(X),schemaVersion:b(),createdAt:i()});var Lt=l({anonymousId:ae,email:ae,firstName:h(i()),lastName:h(i()),phone:h(i()),source:h(Pe)}),Ft=l({candidateId:i(),isNew:de()});var qt=["stage_transition","move_to_stage","shortlist","move_to_interview","make_offer","hire","withdraw","disqualify","reinstate","rate"],Ne=A(qt),Dn=w(i(),Ae(e=>e.split(",").map(t=>t.trim()).filter(t=>t.length>0))),Mt=w(Dn,L(M)),Gt=w(Dn,L(J)),On=w(i(),Ae(e=>e.split(",").map(t=>Number(t.trim())).filter(t=>Number.isInteger(t)&&t>0))),Qr=l({stages:v(Mt),stage_groups:v(Gt),job_id:v(i()),job_ids:v(On),candidate_id:v(i()),is_disqualified:v(A(["true","false"])),created_from:v(i()),created_to:v(i()),updated_from:v(i()),updated_to:v(i()),entered_stage_from:v(i()),entered_stage_to:v(i()),from:v(i()),to:v(i()),q:v(i()),scored:v(A(["true","false"])),sort:v(wn),order:v(Sn),page:v(i()),per_page:v(i())}),ei=w(l({candidateId:ae,jobId:Tn,meta:h(X),sessionId:h(b()),externalApplicationId:h(i()),context:h(X),source:h(je),sourceDetail:h(i()),stage:h(M),stageGroup:h(J),actor:h(q)}),Ye(e=>e.stage==null==(e.stageGroup==null),"stage and stageGroup must be supplied together")),Cn=l({id:i(),stageGroup:i(),createdAt:i()}),ni=he([l({ok:_(!0),duplicate:_(!1),applicationId:i(),candidateId:i()}),l({ok:_(!0),duplicate:_(!0),existingApplication:Cn})]),Bt=l({isDuplicate:de(),existingApplication:v(Cn)}),ti=l({applicationId:ae,scoreType:Re,score:b(),reason:h(i()),categories:h(V(i(),nn)),scoredBy:h(i()),actor:h(q)}),ri=l({scoreId:i()}),ii=De(Oe);var si=A(["already_in_target_stage","not_in_source_stage","disqualified"]),oi=L(jn),Ce=l({stage:h(M),note:h(i())}),zt=l({stage:h(M),startDate:h(i()),note:h(i())}),Ut=ue("action",[l({action:_("shortlist"),actor:q,meta:h(Ce)}),l({action:_("move_to_interview"),actor:q,meta:h(Ce)}),l({action:_("make_offer"),actor:q,meta:h(Ce)}),l({action:_("hire"),actor:q,meta:h(zt)}),l({action:_("withdraw"),actor:q,meta:h(Ce)}),l({action:_("move_to_stage"),actor:q,meta:l({stage:M,stageGroup:J,note:h(i())})}),l({action:_("stage_transition"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("disqualify"),actor:q,meta:l({reason:ve,note:h(i())})}),l({action:_("reinstate"),actor:q,meta:l({toStage:M,toStageGroup:J,note:h(i())})}),l({action:_("rate"),actor:q,meta:l({rating:m(w(b(),se(),oe(1),Qe(5)))})})]),ui=l({applicationIds:w(L(i()),N(1)),body:Ut}),Nn=A(["already_in_target_stage","not_in_source_stage","disqualified","already_disqualified"]),ai=ue("kind",[l({kind:_("updated"),action:Ne,application:Oe}),l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Nn})]),li=l({updated:L(l({kind:_("updated"),action:Ne,application:Oe})),skipped:L(l({kind:_("skipped"),action:Ne,applicationId:i(),reason:Nn})),failed:L(l({applicationId:i(),error:i()}))}),te=w(b(),se(),oe(0)),Vt=l({APPLIED:te,SHORTLISTED:te,INTERVIEWED:te,OFFERED:te,HIRED:te,REJECTED:te,WITHDRAWN:te}),ci=l({job_ids:On}),pi=l({counts:V(i(),Vt)});var hi=De(ge);var gi=l({avg_score:m(b()),p90_score:m(b()),p85_score:m(b()),p80_score:m(b()),total_scores:b(),total_shortlists:b()});var be=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16));function tn(e){if(typeof document!="undefined"){if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",e,{once:!0});return}Promise.resolve().then(e)}}var Ln=["DAILY","WEEKLY","MONTHLY"],Kt=V(i(),he([i(),L(i()),l({type:_("provided"),lat:b(),lng:b(),radius:b(),unit:v(A(["miles","km"])),label:v(i())})])),zi={pathname:"/job/:id",method:"GET",schema:{response:l({id:b(),external_id:h(i()),city:h(i()),town:h(i()),category:h(i())})}};var Jt={pathname:"/search/save",method:"POST",schema:{response:ee(),body:l({contact:l({email:w(v(i()),i(),Ze()),first_name:v(i()),last_name:v(i())}),alerts:w(v(i()),i(),A(Ln)),filters:Kt})}};Fn();var Gn=7*24*60*60*1e3,Bn=e=>{let t=new Date;return t.setTime(t.getTime()+Gn),`${H}=${e};expires=${t.toUTCString()};path=/`},Wt=(e,t)=>{let n=e.get("session_id");if(t||n)return n;let r=sessionStorage.getItem(`${H}-session_id`);return typeof r=="string"?r:null},Ht=()=>{if(typeof window=="undefined")return null;try{let e=window.localStorage.getItem(mn);return typeof e=="string"&&e!==""?e:null}catch(e){return null}},Xt=new RegExp(`(?:^|;\\s*)${H}=([^;]+)`),ke=e=>{var n,r;let t=e?e.headers.get("cookie"):document.cookie;return t&&(r=(n=Xt.exec(t))==null?void 0:n[1])!=null?r:null},zn=()=>{var e;try{let t=JSON.parse((e=window.localStorage.getItem(H))!=null?e:"null");return typeof t!="object"||t===null||!("id"in t)||!("expires"in t)||typeof t.id!="string"||typeof t.expires!="number"?null:t.id!==""&&t.expires>Date.now()?t.id:null}catch(t){return null}},Mn=()=>{var e;return(e=ke())!=null?e:new URL(location.href).searchParams.get("anonymous_id")?null:zn()},$t=()=>location.protocol==="https:"&&window.self!==window.top?";SameSite=None;Secure;Partitioned":"",Un=e=>{if(document.cookie=Bn(e)+$t(),ke()!==e)try{window.localStorage.setItem(H,JSON.stringify({id:e,expires:Date.now()+Gn}))}catch(t){}},on=e=>{var r,s,o;let t=e?e.url:location.href,{searchParams:n}=new URL(t);return{anonymous_id:e?(r=ke(e))!=null?r:n.get("anonymous_id"):(o=(s=ke())!=null?s:n.get("anonymous_id"))!=null?o:zn(),session_id:Wt(n,typeof window=="undefined")}},qn=()=>{if(typeof window=="undefined")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=on().anonymous_id;if(e)return e;let t=be(),n=on().anonymous_id;return n||(Un(t),t)},Yt=e=>typeof e!="object"||e===null?null:{anonymous_id:"anonymous_id"in e&&typeof e.anonymous_id=="string"?e.anonymous_id:null,session_id:"session_id"in e&&typeof e.session_id=="string"?e.session_id:null},Zt=e=>e==="about:client"?"":e,Qt={pathname:"/log",method:"POST",schema:{response:ee(),body:ee()}},Vn=({rpcClient:e,logger:t,onEvent:n,persistence:r="device",siteKind:s})=>{let o=null,a=null,p=0,u=0,y=c=>r==="none"?{anonymous_id:null,session_id:c?null:o}:on(c),d=(c,k,j)=>F(void 0,null,function*(){try{let x={library:{name:"inploi-sdk",version:yn},page:k},D=y(c.request),g=r==="none"?null:Ht(),T={anonymous_id:D.anonymous_id,session_id:D.session_id,candidate_id:g,event:c.event,sent_at:new Date().toISOString(),context:x,properties:c.properties,custom_properties:O(O({},c.customProperties),j)},$=r==="none"?null:c.request?ke(c.request):Mn(),le=++p,ce=yield e.request(Qt,O({body:T},c.keepalive&&{keepalive:!0})),E=Yt(ce);if(r==="none")return!c.request&&(E!=null&&E.session_id)&&le>u&&(u=le,E.session_id!==T.session_id&&(o=E.session_id)),T.session_id=c.request?(E==null?void 0:E.session_id)||null:o,n==null||n(T),{success:!0,data:T};let Y=c.request?$:Mn(),re=Y!==null&&Y!==$,P=Y!=null?Y:$,W=!re&&(!P||!(E!=null&&E.anonymous_id)||P===E.anonymous_id);return W?(E!=null&&E.anonymous_id&&(T.anonymous_id=E.anonymous_id),E!=null&&E.session_id&&(T.session_id=E.session_id)):T.anonymous_id=P,!c.request&&typeof window!="undefined"&&T.anonymous_id&&(W&&T.session_id&&sessionStorage.setItem(`${H}-session_id`,T.session_id.toString()),Un(T.anonymous_id)),n==null||n(T),{success:!0,data:T}}catch(x){return t.error("Failed to send log to API. Inspect error response of `log` for more information."),{success:!1,error:x}}}),f=Promise.resolve();return{log:c=>F(void 0,null,function*(){Fe(c.request||typeof window!="undefined","Cannot log on the server without a request. Please pass a request to `log`.");let k="request"in c&&c.request?{href:c.request.url,referrer:Zt(c.request.referrer),title:""}:{href:location.href,referrer:document.referrer,title:document.title};r==="none"&&c.event==="FLOW_NODE"&&c.properties&&"trigger"in c.properties&&(c.properties.trigger==="pagehide"||c.properties.trigger==="hidden")&&(c=G(O({},c),{keepalive:!0}));let j={event_id:be(),consent_lane:r,site_kind:s};if(r==="device"||c.request||o||c.keepalive)return d(c,k,j);let x=()=>d(c,k,j),D=f.then(x,x);return f=D,D}),getHeaders:c=>{let k=new Headers;return r==="none"||!(c!=null&&c.anonymous_id)||k.append("Set-Cookie",Bn(c.anonymous_id)),k},getSessionInfo:y,getOrCreateAnonymousId:()=>r==="none"?a!=null?a:a=be():qn()}};function sn({publishableKey:e,env:t,logger:n=qe,onEvent:r,persistence:s,siteKind:o}){let a=pn({baseUrl:we[t],publishableKey:e}),p=n===!1?Me:n,u=new me({environment:t,apiKey:{type:"publishable",key:e},logger:p}),y=Vn({rpcClient:u,logger:p,onEvent:r,persistence:s,siteKind:o});return{register:f=>f({logger:p,apiClient:a,analytics:y,rpcClient:u,publishableKey:e,env:t}),analytics:y,apiClient:a}}typeof window.inploi!="object"&&(window.inploi={});window.process=window.process||{};window.process.env=window.process.env||{};window.process.env.NODE_ENV="production";window.inploi.initialiseSdk=sn;window.inploi.ready=tn;})();
|
package/dist/index.d.mts
CHANGED
|
@@ -12,61 +12,6 @@ type Logger = {
|
|
|
12
12
|
declare const inploiBrandedLogger: Logger;
|
|
13
13
|
declare const noLogging: Logger;
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* The environment the SDK should run in.
|
|
17
|
-
* - `production`: data will be stored and displayed on dashboards
|
|
18
|
-
* - `sandbox`: data will be stored temporarily and purged periodically
|
|
19
|
-
*/
|
|
20
|
-
type InploiSdkEnvironment = 'production' | 'sandbox';
|
|
21
|
-
|
|
22
|
-
type DuplicateCheckScope = 'job' | 'company';
|
|
23
|
-
type CandidateSource = 'agent' | 'sdk' | 'form' | 'integration' | 'migration';
|
|
24
|
-
type TalentBankCheckDuplicateResult = {
|
|
25
|
-
isDuplicate: boolean;
|
|
26
|
-
existingApplication?: {
|
|
27
|
-
id: string;
|
|
28
|
-
stageGroup: string;
|
|
29
|
-
createdAt: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
type TalentBankIdentifyParams = {
|
|
33
|
-
anonymousId: string;
|
|
34
|
-
email: string;
|
|
35
|
-
firstName?: string | null;
|
|
36
|
-
lastName?: string | null;
|
|
37
|
-
phone?: string | null;
|
|
38
|
-
/** Caller tag — defaults to `'sdk'`. */
|
|
39
|
-
source?: CandidateSource;
|
|
40
|
-
};
|
|
41
|
-
type TalentBankIdentifyResult = {
|
|
42
|
-
candidateId: string;
|
|
43
|
-
isNew: boolean;
|
|
44
|
-
};
|
|
45
|
-
interface TalentBankClient {
|
|
46
|
-
checkDuplicate(params: {
|
|
47
|
-
email: string;
|
|
48
|
-
jobId?: string | number;
|
|
49
|
-
scope: DuplicateCheckScope;
|
|
50
|
-
}): Promise<TalentBankCheckDuplicateResult>;
|
|
51
|
-
/**
|
|
52
|
-
* Resolve or create a Talent Bank candidate for the supplied identifier.
|
|
53
|
-
*
|
|
54
|
-
* This is the direct-to-Talent-Bank replacement for the old Laravel-proxied
|
|
55
|
-
* `/log` IDENTIFY flow. The SDK calls this and then forwards the returned
|
|
56
|
-
* `candidateId` on every subsequent analytics log so Laravel can stamp it
|
|
57
|
-
* onto the session for attribution.
|
|
58
|
-
*
|
|
59
|
-
* Returns `null` if the call fails — identification is best-effort and must
|
|
60
|
-
* never break the host page.
|
|
61
|
-
*/
|
|
62
|
-
identify(params: TalentBankIdentifyParams): Promise<TalentBankIdentifyResult | null>;
|
|
63
|
-
}
|
|
64
|
-
declare const createTalentBankClient: ({ environment, publishableKey, logger, }: {
|
|
65
|
-
environment: InploiSdkEnvironment;
|
|
66
|
-
publishableKey: string;
|
|
67
|
-
logger: Logger;
|
|
68
|
-
}) => TalentBankClient;
|
|
69
|
-
|
|
70
15
|
type FlowProperties = {
|
|
71
16
|
flow_id: string;
|
|
72
17
|
flow_version: number;
|
|
@@ -81,6 +26,14 @@ type JobProperties = {
|
|
|
81
26
|
id: string;
|
|
82
27
|
id_type: 'internal' | 'external';
|
|
83
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* One id per navigation (a document load, an in-app route change, a restore from the back/forward cache), shared by
|
|
31
|
+
* that navigation's `VIEW_PAGE` or `VIEW_JOB` events, so a view counts once per navigation and a retry is recognised.
|
|
32
|
+
* Minted by the page (`generateUUID`).
|
|
33
|
+
*/
|
|
34
|
+
type NavigationProperties = {
|
|
35
|
+
navigation_id?: string;
|
|
36
|
+
};
|
|
84
37
|
type PageEngagementProperties = {
|
|
85
38
|
/** Random per page view, minted by the page; not a visitor identifier. */
|
|
86
39
|
view_id: string;
|
|
@@ -166,7 +119,7 @@ type AnalyticsLogParams = {
|
|
|
166
119
|
event: 'VIEW_JOB';
|
|
167
120
|
properties: {
|
|
168
121
|
job: JobProperties;
|
|
169
|
-
};
|
|
122
|
+
} & NavigationProperties;
|
|
170
123
|
} | {
|
|
171
124
|
event: 'FLOW_REDIRECT';
|
|
172
125
|
properties: {
|
|
@@ -204,10 +157,15 @@ type AnalyticsLogParams = {
|
|
|
204
157
|
outcome?: 'duplicate' | 'duplicate_after_own_attempt' | 'pending';
|
|
205
158
|
} & FunnelFlowProperties;
|
|
206
159
|
} | {
|
|
207
|
-
event: 'SUBMIT_FORM'
|
|
160
|
+
event: 'SUBMIT_FORM';
|
|
208
161
|
properties?: {
|
|
209
162
|
job: JobProperties | undefined;
|
|
210
163
|
};
|
|
164
|
+
} | {
|
|
165
|
+
event: 'VIEW_PAGE';
|
|
166
|
+
properties?: {
|
|
167
|
+
job: JobProperties | undefined;
|
|
168
|
+
} & NavigationProperties;
|
|
211
169
|
}
|
|
212
170
|
/**
|
|
213
171
|
* `PAGE_ENGAGEMENT`, one careers-site page view's attention summary: sent when the view is hidden or left, never
|
|
@@ -218,16 +176,6 @@ type AnalyticsLogParams = {
|
|
|
218
176
|
| {
|
|
219
177
|
event: 'PAGE_ENGAGEMENT';
|
|
220
178
|
properties: PageEngagementProperties;
|
|
221
|
-
} | {
|
|
222
|
-
event: 'IDENTIFY';
|
|
223
|
-
properties: {
|
|
224
|
-
identifier: string;
|
|
225
|
-
first_name?: string;
|
|
226
|
-
last_name?: string;
|
|
227
|
-
phone_number?: string;
|
|
228
|
-
email?: string;
|
|
229
|
-
custom_traits?: Record<string, unknown>;
|
|
230
|
-
};
|
|
231
179
|
} | {
|
|
232
180
|
event: 'SEARCH_PAGINATE';
|
|
233
181
|
properties: {
|
|
@@ -248,6 +196,12 @@ type AnalyticsLogParams = {
|
|
|
248
196
|
page_size: number;
|
|
249
197
|
page: number;
|
|
250
198
|
};
|
|
199
|
+
} | {
|
|
200
|
+
event: 'SAVE_JOB';
|
|
201
|
+
properties: {
|
|
202
|
+
job_id: number;
|
|
203
|
+
saved: boolean;
|
|
204
|
+
};
|
|
251
205
|
} | {
|
|
252
206
|
event: 'SEARCH_JOB_CLICK';
|
|
253
207
|
properties: {
|
|
@@ -297,6 +251,26 @@ type AnalyticsLogParams = {
|
|
|
297
251
|
};
|
|
298
252
|
};
|
|
299
253
|
type AnalyticsLogEvent = AnalyticsLogParams['event'];
|
|
254
|
+
/**
|
|
255
|
+
* The catalogue: every event the SDK and its plugins send to `/log`, with what it records. Each event's fields are its
|
|
256
|
+
* `AnalyticsLogParams` member above; every event also carries the envelope in `AnalyticsEnvelope`. Typed against
|
|
257
|
+
* `AnalyticsLogEvent`, so an event cannot be added, renamed or removed without changing this list.
|
|
258
|
+
*/
|
|
259
|
+
declare const ANALYTICS_EVENTS: Record<AnalyticsLogEvent, string>;
|
|
260
|
+
/**
|
|
261
|
+
* Sent in `custom_properties` with every event, beside any custom properties the caller passes. Today's api stores
|
|
262
|
+
* `custom_properties` as given (`session_logs.custom_properties`, capped at 1 KB), so these land there.
|
|
263
|
+
*/
|
|
264
|
+
type AnalyticsEnvelope = {
|
|
265
|
+
/** Made once per event where it is logged, so a repeat of the same event can be recognised and counted once. */
|
|
266
|
+
event_id: string;
|
|
267
|
+
/** The analytics service's lane: `device` stores the visitor id, `none` stores nothing. */
|
|
268
|
+
consent_lane: 'device' | 'none';
|
|
269
|
+
/** What kind of site sent it: a Studio careers site (`hub`) or a client's own page (`embedded`). Absent when the host did not say. */
|
|
270
|
+
site_kind?: SiteKind;
|
|
271
|
+
};
|
|
272
|
+
type SiteKind = 'hub' | 'embedded';
|
|
273
|
+
|
|
300
274
|
type EventPropertyMap = {
|
|
301
275
|
[Param in AnalyticsLogParams as Param['event']]: Omit<Param, 'event'>;
|
|
302
276
|
};
|
|
@@ -315,16 +289,15 @@ type TrackPayload<P = EventPropertyMap[keyof EventPropertyMap]['properties']> =
|
|
|
315
289
|
anonymous_id: string | null;
|
|
316
290
|
session_id: string | null;
|
|
317
291
|
/**
|
|
318
|
-
* Talent Bank candidate id
|
|
319
|
-
*
|
|
320
|
-
* this and stamps it onto `session.context.candidate_id` for attribution.
|
|
321
|
-
* `null` for anonymous / unidentified users.
|
|
292
|
+
* Legacy Talent Bank candidate id read from device storage, or `null`.
|
|
293
|
+
* Laravel's session middleware stamps it onto `session.context.candidate_id` for attribution.
|
|
322
294
|
*/
|
|
323
295
|
candidate_id: string | null;
|
|
324
296
|
event: AnalyticsLogEvent;
|
|
325
297
|
sent_at: string;
|
|
326
298
|
context: AnalyticsContext;
|
|
327
299
|
properties: P;
|
|
300
|
+
/** Always sent with the `AnalyticsEnvelope`; typed optional because hosts and tests implement `log` themselves. */
|
|
328
301
|
custom_properties?: Record<string, unknown>;
|
|
329
302
|
};
|
|
330
303
|
type LogFnParams<T extends keyof EventPropertyMap> = {
|
|
@@ -410,6 +383,13 @@ declare const SdkError: {
|
|
|
410
383
|
};
|
|
411
384
|
declare function isSdkError(error: unknown): error is (typeof SdkError)[keyof typeof SdkError];
|
|
412
385
|
|
|
386
|
+
/**
|
|
387
|
+
* The environment the SDK should run in.
|
|
388
|
+
* - `production`: data will be stored and displayed on dashboards
|
|
389
|
+
* - `sandbox`: data will be stored temporarily and purged periodically
|
|
390
|
+
*/
|
|
391
|
+
type InploiSdkEnvironment = 'production' | 'sandbox';
|
|
392
|
+
|
|
413
393
|
type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
414
394
|
/** Extract parameter names from a pathname string */
|
|
415
395
|
type ExtractParamNames<T extends string> = T extends `${infer _Before}:${infer Param}/${infer After}` ? Param | ExtractParamNames<`/${After}`> : T extends `${infer _Before}:${infer Param}` ? Param : never;
|
|
@@ -583,8 +563,10 @@ type InitialiseInploiSdkParams = {
|
|
|
583
563
|
onEvent?: AnalyticsOnEventCallback;
|
|
584
564
|
/** Analytics identity storage. `none` keeps only an API session in memory; defaults to `device`. */
|
|
585
565
|
persistence?: 'device' | 'none';
|
|
566
|
+
/** What kind of site this is, sent with every event as `site_kind`: a Studio careers site (`hub`) or a client's own page (`embedded`). */
|
|
567
|
+
siteKind?: SiteKind;
|
|
586
568
|
};
|
|
587
|
-
declare function initialiseSdk({ publishableKey, env, logger, onEvent, persistence, }: InitialiseInploiSdkParams): {
|
|
569
|
+
declare function initialiseSdk({ publishableKey, env, logger, onEvent, persistence, siteKind, }: InitialiseInploiSdkParams): {
|
|
588
570
|
register: <P extends InploiSdkPlugin>(plugin: P) => ReturnType<P>;
|
|
589
571
|
analytics: AnalyticsService;
|
|
590
572
|
apiClient: ApiClient;
|
|
@@ -649,6 +631,49 @@ declare function getConsentAcceptance(publishableKey: string, config: ConsentCon
|
|
|
649
631
|
*/
|
|
650
632
|
declare function setConsentAcceptance(publishableKey: string, config: ConsentConfig): void;
|
|
651
633
|
|
|
634
|
+
type DuplicateCheckScope = 'job' | 'company';
|
|
635
|
+
type CandidateSource = 'agent' | 'sdk' | 'form' | 'integration' | 'migration';
|
|
636
|
+
type TalentBankCheckDuplicateResult = {
|
|
637
|
+
isDuplicate: boolean;
|
|
638
|
+
existingApplication?: {
|
|
639
|
+
id: string;
|
|
640
|
+
stageGroup: string;
|
|
641
|
+
createdAt: string;
|
|
642
|
+
};
|
|
643
|
+
};
|
|
644
|
+
type TalentBankIdentifyParams = {
|
|
645
|
+
anonymousId: string;
|
|
646
|
+
email: string;
|
|
647
|
+
firstName?: string | null;
|
|
648
|
+
lastName?: string | null;
|
|
649
|
+
phone?: string | null;
|
|
650
|
+
/** Caller tag — defaults to `'sdk'`. */
|
|
651
|
+
source?: CandidateSource;
|
|
652
|
+
};
|
|
653
|
+
type TalentBankIdentifyResult = {
|
|
654
|
+
candidateId: string;
|
|
655
|
+
isNew: boolean;
|
|
656
|
+
};
|
|
657
|
+
interface TalentBankClient {
|
|
658
|
+
checkDuplicate(params: {
|
|
659
|
+
email: string;
|
|
660
|
+
jobId?: string | number;
|
|
661
|
+
scope: DuplicateCheckScope;
|
|
662
|
+
}): Promise<TalentBankCheckDuplicateResult>;
|
|
663
|
+
/**
|
|
664
|
+
* Resolve or create a Talent Bank candidate for the supplied identifier.
|
|
665
|
+
*
|
|
666
|
+
* Returns `null` if the call fails — identification is best-effort and must
|
|
667
|
+
* never break the host page.
|
|
668
|
+
*/
|
|
669
|
+
identify(params: TalentBankIdentifyParams): Promise<TalentBankIdentifyResult | null>;
|
|
670
|
+
}
|
|
671
|
+
declare const createTalentBankClient: ({ environment, publishableKey, logger, }: {
|
|
672
|
+
environment: InploiSdkEnvironment;
|
|
673
|
+
publishableKey: string;
|
|
674
|
+
logger: Logger;
|
|
675
|
+
}) => TalentBankClient;
|
|
676
|
+
|
|
652
677
|
/**
|
|
653
678
|
* Generates a RFC 4122 v4 UUID.
|
|
654
679
|
*
|
|
@@ -729,4 +754,4 @@ declare const searchAddressSuggestions: <T extends AddressSuggestion>(lookup: (c
|
|
|
729
754
|
*/
|
|
730
755
|
declare const jobCountryCodes: (jobCountries: string[]) => string[];
|
|
731
756
|
|
|
732
|
-
export { AnalyticsLogEvent, AnalyticsLogParams, AnalyticsOnEventCallback, AnalyticsService, ApiClient, ApiError, ConsentConfig, FlowPathProperties, FlowPathStep, FlowPathTrigger, FlowType, InitialiseInploiSdkParams, InploiRpcClient, InploiSdk, InploiSdkEnvironment, InploiSdkPlugin, JOB_ALERT_FREQUENCIES, JobAlertsFilters, Logger, NotFoundError, PageEngagementProperties, JsonParsingError as ParsingError, PluginParams, RpcEndpoint, SchemaValidationError, SdkError, TalentBankCheckDuplicateResult, TalentBankClient, TalentBankIdentifyParams, TalentBankIdentifyResult, UnauthorisedError, addressSearchCountry, blendAddressSuggestions, consentStorageKey, createPlugin, createTalentBankClient, endpoint, generateUUID, getConsentAcceptance, getJobCountries, getOrCreateAnonymousId, hashConsentConfig, initialiseSdk, inploiBrandedLogger, isApiErrorWithData, isSdkError, jobCountryCodes, noLogging, ready, saveClosedRoleJobAlerts, saveSearchEndpoint, searchAddressSuggestions, setConsentAcceptance, typed, validateEndpointInputs };
|
|
757
|
+
export { ANALYTICS_EVENTS, AnalyticsEnvelope, AnalyticsLogEvent, AnalyticsLogParams, AnalyticsOnEventCallback, AnalyticsService, ApiClient, ApiError, ConsentConfig, FlowPathProperties, FlowPathStep, FlowPathTrigger, FlowType, InitialiseInploiSdkParams, InploiRpcClient, InploiSdk, InploiSdkEnvironment, InploiSdkPlugin, JOB_ALERT_FREQUENCIES, JobAlertsFilters, Logger, NotFoundError, PageEngagementProperties, JsonParsingError as ParsingError, PluginParams, RpcEndpoint, SchemaValidationError, SdkError, SiteKind, TalentBankCheckDuplicateResult, TalentBankClient, TalentBankIdentifyParams, TalentBankIdentifyResult, UnauthorisedError, addressSearchCountry, blendAddressSuggestions, consentStorageKey, createPlugin, createTalentBankClient, endpoint, generateUUID, getConsentAcceptance, getJobCountries, getOrCreateAnonymousId, hashConsentConfig, initialiseSdk, inploiBrandedLogger, isApiErrorWithData, isSdkError, jobCountryCodes, noLogging, ready, saveClosedRoleJobAlerts, saveSearchEndpoint, searchAddressSuggestions, setConsentAcceptance, typed, validateEndpointInputs };
|