@inploi/plugin-chatbot 14.13.2 → 14.13.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 +2 -2
- package/dist/{chatbot-body-25f7559d.js → chatbot-body-0eb387f9.js} +2 -2
- package/dist/{chatbot-body-21b3975a.cjs → chatbot-body-dd27d81b.cjs} +1 -1
- package/dist/i18n.d.ts +12 -12
- package/dist/{index-d9d11554.js → index-89864783.js} +67 -67
- package/dist/index-93dabc80.cjs +5 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +2 -2
- package/dist/index-0b229542.cjs +0 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Sn = Object.defineProperty;
|
|
2
2
|
var En = (e, r, t) => r in e ? Sn(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
3
|
var Y = (e, r, t) => (En(e, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
|
-
import { u as Br, p as vt, D as Dt, l as Ge, f as $r, T as jr, a as An, E as In, N as Fn, I as Pr, C as Vn, s as Mn, g as Ln, S as Nn, U as nr, $ as sr, R as Rn, w as ar, m as Tn, y as Dn, b as qr, k as On, x as Bn, h as $n, z as jn, Z as Ur, H as Pn, v as qn, c as q, d as ne, o as u, e as Qe, i as xt, j as ke, _ as ye, n as Oe, q as Le, r as be, L as Ut, F as Un, t as Wr, A as zr, B as Wn, G as zn, J as et, K as ir, M as ae, O as ue, P as Hn, Q as Kn, V as Gn, W as Jn, X as Hr, Y as Zn } from "./index-
|
|
4
|
+
import { u as Br, p as vt, D as Dt, l as Ge, f as $r, T as jr, a as An, E as In, N as Fn, I as Pr, C as Vn, s as Mn, g as Ln, S as Nn, U as nr, $ as sr, R as Rn, w as ar, m as Tn, y as Dn, b as qr, k as On, x as Bn, h as $n, z as jn, Z as Ur, H as Pn, v as qn, c as q, d as ne, o as u, e as Qe, i as xt, j as ke, _ as ye, n as Oe, q as Le, r as be, L as Ut, F as Un, t as Wr, A as zr, B as Wn, G as zn, J as et, K as ir, M as ae, O as ue, P as Hn, Q as Kn, V as Gn, W as Jn, X as Hr, Y as Zn } from "./index-89864783.js";
|
|
5
5
|
import "@inploi/sdk";
|
|
6
|
-
var Xn = "9.10.
|
|
6
|
+
var Xn = "9.10.1", Kr = `https://sdk.inploi.com/@inploi/flows@${Xn}/cdn/captcha/index.html`, Yn = new URL(Kr).origin, or = 3e4, Qn = 5 * 6e4, es = (e) => typeof e == "object" && e !== null && e.source === "inploi-captcha", Ft = /* @__PURE__ */ new WeakMap(), ts = (e) => {
|
|
7
7
|
let r = Ft.get(e);
|
|
8
8
|
return r || (r = e.fetch("/flow/captcha").then((t) => {
|
|
9
9
|
let n = t == null ? void 0 : t.site_key;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Jr=Object.defineProperty;var Zr=(e,r,t)=>r in e?Jr(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var X=(e,r,t)=>(Zr(e,typeof r!="symbol"?r+"":r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-0b229542.cjs");require("@inploi/sdk");var Xr="9.10.0",gr=`https://sdk.inploi.com/@inploi/flows@${Xr}/cdn/captcha/index.html`,Yr=new URL(gr).origin,Pt=3e4,Qr=5*6e4,en=e=>typeof e=="object"&&e!==null&&e.source==="inploi-captcha",mt=new WeakMap,tn=e=>{let r=mt.get(e);return r||(r=e.fetch("/flow/captcha").then(t=>{let n=t==null?void 0:t.site_key;return typeof n=="string"&&n!==""?n:void 0}).catch(t=>{throw mt.delete(e),t}),mt.set(e,r)),r},rn=(e,r={})=>new Promise((t,n)=>{let{signal:a,container:o=null,theme:i,onInteractive:l}=r instanceof AbortSignal?{signal:r}:r,c=!1,f=()=>{},v=_=>{c||(c=!0,clearTimeout(y),a==null||a.removeEventListener("abort",p),f(),_())},b=_=>v(()=>n(new Error(_))),p=()=>b("Captcha aborted"),y,C=_=>{clearTimeout(y),y=setTimeout(()=>b("Captcha timed out"),_)};if(C(Pt),a==null?void 0:a.aborted)return p();a==null||a.addEventListener("abort",p),(async()=>{let _=await tn(e);if(_===void 0)return v(()=>t(void 0));if(c)return;let k=document.createElement("iframe");k.src=`${gr}?${new URLSearchParams({sitekey:_,origin:window.location.origin,...i&&{theme:i}}).toString()}`,k.title="Cloudflare security check",k.style.cssText=`display:block;border:0;width:${o?"100%":"300px"};height:0;color-scheme:normal`,o?o.appendChild(k):(k.style.cssText+=";position:fixed;bottom:16px;right:16px;z-index:2147483647",document.body.appendChild(k));let I=!1,g=T=>{if(!k.contentWindow||T.source!==k.contentWindow||T.origin!==Yr||!en(T.data))return;let V=T.data;switch(V.type){case"token":return v(()=>t(V.token));case"resize":k.style.height=`${Math.max(0,Math.ceil(V.height))}px`;return;case"before-interactive":return I=!0,C(Qr),l==null?void 0:l();case"after-interactive":return I=!1,C(Pt);case"error":!I&&!V.interactive&&b("Captcha failed");return;case"expired":return b("Captcha expired");case"timeout":return b("Captcha timed out")}};window.addEventListener("message",g),f=()=>{window.removeEventListener("message",g),k.remove()}})().catch(_=>v(()=>n(_)))}),qt=({condition:e,context:r,submissions:t,ifBlock:n})=>{let[a,...o]=e.compareKey.split(".");if(!a)return!1;let i=s.ue({context:r,key:a,path:o,submissions:t});if(!i)return!1;switch(i.type){case"address":{let l=s.D(i.value,o);switch(e.compare){case"equals":return l===e.compareValue;case"contains":return typeof l!="string"?!1:l.includes(e.compareValue);case"notEquals":return l!==e.compareValue;case"notContains":return typeof l!="string"?!0:!l.includes(e.compareValue)}break}case"integration":{if(typeof i.value!="object"||Array.isArray(i.value))return!1;let l=s.D(i.value,o),c={...n,data:{compareKey:"_temp",compare:e.compare,compareValue:e.compareValue}};switch(typeof l){case"boolean":return Ze(c,{submissions:{_temp:{value:l,type:"boolean"}},context:r});case"string":return Ze(c,{submissions:{_temp:{value:l,type:"string"}},context:r});case"number":return Ze(c,{submissions:{_temp:{value:l,type:"number"}},context:r});case"object":return Array.isArray(l)&&l.every(f=>typeof f=="string")?Ze(c,{submissions:{_temp:{value:l,type:"enum"}},context:r}):!1}break}case"boolean":{let l=e.compareValue==="true";switch(e.compare){case"equals":return i.value===l;case"notEquals":return i.value!==l}break}case"phone":case"string":{let l=i.type==="phone"?s.pe(i.value):i.value;switch(e.compare){case"equals":return l===e.compareValue;case"contains":return l?l.includes(e.compareValue):!1;case"notEquals":return l!==e.compareValue;case"notContains":return l?!l.includes(e.compareValue):!0}break}case"number":{try{let l=Number(e.compareValue);switch(e.compare){case"equals":return i.value===l;case"notEquals":return i.value!==l;case"greaterThan":return i.value>l;case"greaterThanOrEqualTo":return i.value>=l;case"lessThan":return i.value<l;case"lessThanOrEqualTo":return i.value<=l}}catch{return console.error(`Failed to parse number in if-block ${n.id}`,i.value),!1}break}case"enum":switch(e.compare){case"equals":return i.value.length===1&&i.value[0]===e.compareValue;case"notEquals":return i.value.length===1&&i.value[0]!==e.compareValue;case"contains":return i.value.includes(e.compareValue);case"notContains":return!i.value.includes(e.compareValue)}break}},Ze=(e,{context:r,submissions:t})=>{let n="combinator"in e.data?e.data.conditions:[e.data];if(("combinator"in e.data?e.data.combinator:"and")==="or"){for(let a of n)if(qt({condition:a,context:r,submissions:t,ifBlock:e}))return!0;return!1}else{for(let a of n)if(!qt({condition:a,context:r,submissions:t,ifBlock:e}))return!1;return!0}},nn=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,sn=(e,{context:r,submissions:t})=>e.replace(nn,(n,a,o="")=>{let[i,...l]=a.trim().split("."),c=s.ue({key:i,path:l,submissions:t,context:r});if(!c)return o;switch(c.type){case"boolean":return c.value===!0?"true":"false";case"file":return c.value.map(f=>`${f.name} (${s.le(f.sizeKb)})`).join(", ");case"enum":return c.value.join(", ");case"address":return Object.values(c.value).filter(f=>f&&f.trim().length>0).join(", ");case"number":case"string":return c.value?c.value.toString():o;case"phone":return s.pe(c.value);case"integration":{if(typeof c.value!="object"||Array.isArray(c.value))break;let f=s.D(c.value,l);switch(typeof f){case"boolean":return f===!0?"true":"false";case"string":return f;case"number":return f.toString();case"object":if(Array.isArray(f)&&f.every(v=>typeof v=="string"))return f.join(", ")}break}}return o});/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function an(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function At(e,r,t=""){const n=an(e),a=e==null?void 0:e.length,o=r!==void 0;if(!n||o&&a!==r){const i=t&&`"${t}" `,l=o?` of length ${r}`:"",c=n?`length=${a}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+l+", got "+c)}return e}function Ut(e,r=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(r&&e.finished)throw new Error("Hash#digest() has already been called")}function on(e,r){At(e,void 0,"digestInto() output");const t=r.outputLen;if(e.length<t)throw new Error('"digestInto() output" expected to be of length >='+t)}function _t(...e){for(let r=0;r<e.length;r++)e[r].fill(0)}function yt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ce(e,r){return e<<32-r|e>>>r}const ln=(()=>typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function")(),un=Array.from({length:256},(e,r)=>r.toString(16).padStart(2,"0"));function cn(e){if(At(e),ln)return e.toHex();let r="";for(let t=0;t<e.length;t++)r+=un[e[t]];return r}function dn(e,r={}){const t=(a,o)=>e(o).update(a).digest(),n=e(void 0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=a=>e(a),Object.assign(t,r),Object.freeze(t)}const fn=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function hn(e,r,t){return e&r^~e&t}function pn(e,r,t){return e&r^e&t^r&t}class mn{constructor(r,t,n,a){X(this,"blockLen");X(this,"outputLen");X(this,"padOffset");X(this,"isLE");X(this,"buffer");X(this,"view");X(this,"finished",!1);X(this,"length",0);X(this,"pos",0);X(this,"destroyed",!1);this.blockLen=r,this.outputLen=t,this.padOffset=n,this.isLE=a,this.buffer=new Uint8Array(r),this.view=yt(this.buffer)}update(r){Ut(this),At(r);const{view:t,buffer:n,blockLen:a}=this,o=r.length;for(let i=0;i<o;){const l=Math.min(a-this.pos,o-i);if(l===a){const c=yt(r);for(;a<=o-i;i+=a)this.process(c,i);continue}n.set(r.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===a&&(this.process(t,0),this.pos=0)}return this.length+=r.length,this.roundClean(),this}digestInto(r){Ut(this),on(r,this),this.finished=!0;const{buffer:t,view:n,blockLen:a,isLE:o}=this;let{pos:i}=this;t[i++]=128,_t(this.buffer.subarray(i)),this.padOffset>a-i&&(this.process(n,0),i=0);for(let b=i;b<a;b++)t[b]=0;n.setBigUint64(a-8,BigInt(this.length*8),o),this.process(n,0);const l=yt(r),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const f=c/4,v=this.get();if(f>v.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;b<f;b++)l.setUint32(4*b,v[b],o)}digest(){const{buffer:r,outputLen:t}=this;this.digestInto(r);const n=r.slice(0,t);return this.destroy(),n}_cloneInto(r){r||(r=new this.constructor),r.set(...this.get());const{blockLen:t,buffer:n,length:a,finished:o,destroyed:i,pos:l}=this;return r.destroyed=i,r.finished=o,r.length=a,r.pos=l,a%t&&r.buffer.set(n),r}clone(){return this._cloneInto()}}const we=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yn=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_e=new Uint32Array(64);class bn extends mn{constructor(r){super(64,r,8,!1)}get(){const{A:r,B:t,C:n,D:a,E:o,F:i,G:l,H:c}=this;return[r,t,n,a,o,i,l,c]}set(r,t,n,a,o,i,l,c){this.A=r|0,this.B=t|0,this.C=n|0,this.D=a|0,this.E=o|0,this.F=i|0,this.G=l|0,this.H=c|0}process(r,t){for(let b=0;b<16;b++,t+=4)_e[b]=r.getUint32(t,!1);for(let b=16;b<64;b++){const p=_e[b-15],y=_e[b-2],C=ce(p,7)^ce(p,18)^p>>>3,_=ce(y,17)^ce(y,19)^y>>>10;_e[b]=_+_e[b-7]+C+_e[b-16]|0}let{A:n,B:a,C:o,D:i,E:l,F:c,G:f,H:v}=this;for(let b=0;b<64;b++){const p=ce(l,6)^ce(l,11)^ce(l,25),y=v+p+hn(l,c,f)+yn[b]+_e[b]|0,_=(ce(n,2)^ce(n,13)^ce(n,22))+pn(n,a,o)|0;v=f,f=c,c=l,l=i+y|0,i=o,o=a,a=n,n=y+_|0}n=n+this.A|0,a=a+this.B|0,o=o+this.C|0,i=i+this.D|0,l=l+this.E|0,c=c+this.F|0,f=f+this.G|0,v=v+this.H|0,this.set(n,a,o,i,l,c,f,v)}roundClean(){_t(_e)}destroy(){this.set(0,0,0,0,0,0,0,0),_t(this.buffer)}}class gn extends bn{constructor(){super(32);X(this,"A",we[0]|0);X(this,"B",we[1]|0);X(this,"C",we[2]|0);X(this,"D",we[3]|0);X(this,"E",we[4]|0);X(this,"F",we[5]|0);X(this,"G",we[6]|0);X(this,"H",we[7]|0)}}const vn=dn(()=>new gn,fn(1));var vr=e=>{let r=e.find(t=>t.isHead);if(!r)throw new Error("No head node found");return r},Ft=e=>{var r,t;if(!(e.data.isFinished||(r=e.data.startedWriteNodeIds)!=null&&r.length))return(t=[...e.data.messages].reverse().find(n=>n.groupId&&e.nodes.some(a=>a.id===n.groupId&&a.type.startsWith("question-"))&&(n.type==="system"||"author"in n&&n.author==="user")))==null?void 0:t.groupId},kt=e=>Array.isArray(e)?e.map(kt):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>[r,kt(t)])):typeof e=="function"?void 0:e,xn=e=>cn(vn(new TextEncoder().encode(JSON.stringify(kt(e)))));function wn(e,r,t,n){var a;if(n!=null&&n.aborted)return;let o=xn(t),i=(a=e.data).preApplyFingerprints??(a.preApplyFingerprints=[]);if(i.includes(o))return;i.push(o);let l=new AbortController,c=setTimeout(()=>l.abort(),5e3);r.fetch("/flow/pre-apply",{method:"POST",signal:l.signal,body:JSON.stringify(t)}).catch(()=>{let f=i.indexOf(o);f!==-1&&i.splice(f,1)}).finally(()=>{clearTimeout(c)})}var xr=({context:e,submissions:r})=>({context:e,submissions:r??{}}),ue=(e,r)=>sn(e,xr(r)),_n=(e,r)=>Ze(e,xr(r)),wr=({node:e,nodes:r,stopWhen:t})=>{if((t==null?void 0:t(e))===!0)return e;let n=e.nextId?r.find(a=>a.id===e.nextId):void 0;if(n)return wr({node:n,nodes:r,stopWhen:t})},kn=({childNode:e,nodes:r})=>{let t=r.filter(n=>n.type==="if-block").find(n=>{if(!n.branchId)return!1;let a=r.find(i=>i.id===n.branchId);if(!a)return!1;let o=wr({node:a,nodes:r,stopWhen:i=>i.id===e.id});return!(!o||o.id!==e.id)});if(t!=null&&t.nextId)return r.find(n=>n.id===t.nextId)},Cn=3,Sn=({flow:e,analytics:r,logger:t,talentBankClient:n,context:a,apiClient:o,getSubmissions:i,getApplicationRecovery:l,setApplicationRecovery:c,chatService:f,persistWriteBarrier:v,onSubmitNetworkError:b,closedRoleBehaviour:p,settledOutcomes:y=p,dateEchoLocale:C,onFlowEnd:_,onInterpret:k,forceSubmitConfirmation:I,flowType:g,t:T})=>{var V;let M=new AbortController,O={submitAccepted:!1};(V=e.data).startedWriteNodeIds??(V.startedWriteNodeIds=e.nodes.flatMap(R=>{var B,A;if(R.type!=="integration-application-submit"||!e.data.nodeHistory.includes(R.id))return[];let N=R.data.key?(B=i())==null?void 0:B[R.data.key]:void 0;return(N==null?void 0:N.type)==="integration"&&((A=s.fe(N.value))==null?void 0:A.verdict)==="not_submitted"?[]:[R.id]}));let W={...r.service,log:R=>r.service.log({...R,customProperties:{...R.customProperties,...r.customProperties}})},Q=async(R,N)=>{let B=M.signal;if(B.aborted)return;let A=i(),F=l(),j=(F==null?void 0:F.submitNodeId)===R.id?e.nodes.find(L=>{var U;return L.id===F.fileQuestionNodeId&&L.type==="question-file"&&((U=A==null?void 0:A[L.data.key])==null?void 0:U.type)!=="file"}):void 0;if(j)return Q(j,N);k==null||k(R,N);try{await In({flow:e,analytics:W,logger:t,talentBankClient:n,apiClient:o,context:a,node:R,submissions:A,applicationRecovery:F,setApplicationRecovery:async L=>{if(!B.aborted)try{await c(L)}catch(U){t.error("Failed to persist application recovery",U)}},forceSubmitConfirmation:I||(F==null?void 0:F.submitNodeId)===R.id,run:O,persistWriteBarrier:v,onSubmitNetworkError:b,settledOutcomes:y,dateEchoLocale:C,flowType:g,signal:B,t:T,chat:{sendMessage:async L=>f.send({groupId:R.id,message:L,signal:B}),userInput:async L=>f.input({input:L,signal:B}),setSubmission:(L,U)=>{B.aborted||f.setSubmission(L,U)},captcha:f.captcha},next:L=>{if(B.aborted)return;let U=(F==null?void 0:F.fileQuestionNodeId)===R.id?F.submitNodeId:L,q=U?e.nodes.find(ee=>ee.id===U):kn({childNode:R,nodes:e.nodes});return q?Q(q,R):_==null?void 0:_(R)},end:()=>{B.aborted||(_==null||_(R))}})}catch(L){if(L instanceof s.T)return;throw L}};return{interpret:async R=>{let N=e.nodes.find(B=>B.id===R)??vr(e.nodes);return Q(N)},undo:R=>{var U;if(delete e.data.reviewReplay,((U=e.data.startedWriteNodeIds)==null?void 0:U.length)||e.data.isFinished)return{removed:0};let N=Ft(e),B=N?R.lastIndexOf(N):-1,A=e.nodes.find(q=>q.id===N);if(B===-1||!A)return{removed:0};let F=e.nodes.find(q=>q.id===R[R.length-1]);M.abort();let j=R.splice(B);e.data.messages=e.data.messages.filter(q=>!q.groupId||!j.includes(q.groupId)),e.data.currentInput=null;let L=i();for(let q of j.slice(1)){let ee=e.nodes.find(Z=>Z.id===q);if(!(!ee||!L||ee.id===N)&&("key"in ee.data&&ee.data.key&&delete L[ee.data.key],"keys"in ee.data))for(let Z of Object.values(ee.data.keys))typeof Z=="string"&&delete L[Z]}return M=new AbortController,Q(A,F),{removed:j.length}},abort:()=>{M.abort()}}};async function In(e){let r=e.node;switch(r.type){case"flow-section":return await e.chat.sendMessage({type:"system",variant:"info",text:r.data.title}),e.next(r.nextId);case"pre-apply-result":return Jn({...e,node:r});case"text":return $n({...e,node:r});case"image":return jn({...e,node:r});case"question-text":return Pn({...e,node:r});case"question-enum":return zn({...e,node:r});case"question-number":return qn({...e,node:r});case"question-phone":return Un({...e,node:r});case"question-boolean":return Hn({...e,node:r});case"question-file":return Kn({...e,node:r});case"question-address":return Wn({...e,node:r});case"end-flow":return Gn({...e,node:r});case"if-block":return Bn({...e,node:r});case"jump":return Fn({...e,node:r});case"link":return On({...e,node:r});case"integration-application-submit":return Dn({...e,node:r});case"add-submission":return Vn({...e,node:r});case"integration-workflow-get":throw Error("Workflow should be unreachable");case"check-duplicate":return An({...e,node:r});case"feedback":return En({...e,node:r});default:throw new Error(`Unknown node: ${JSON.stringify(r)}`)}}async function En({next:e,node:r}){e(r.nextId)}async function An({next:e,node:r,talentBankClient:t,submissions:n,flow:a,logger:o,chat:i}){var c;let l={isDuplicate:!1};if(n&&t){let f=r.data.scope==="job"?(c=a.job)==null?void 0:c.id:void 0;if(r.data.scope==="company"||f!=null)try{l=await t.checkDuplicate({email:s.ae({key:r.data.email,submissions:n}).toString(),jobId:f,scope:r.data.scope})}catch(v){o.error("[check-duplicate]",v)}}i.setSubmission(r.data.key,{type:"integration",value:l}),e(r.nextId)}async function Fn({next:e,node:r}){e(r.data.targetId)}async function Vn({next:e,node:r,logger:t,submissions:n,context:a}){if(!n){t.error("Submissions not found");return}n[r.data.key]={type:"string",value:ue(r.data.value,{submissions:n,context:a})},e(r.nextId)}var Mn=5e3,Ln=(e,r)=>r?`${e}@${r.id_type}:${r.id}`:e,Tn=(e,r=Date.now())=>Math.min(e.until,r+(e.maintenance?s.z:e.throttles?s.Z:s.H)),Nn=(e,r,t)=>{let{waitMs:n,throttles:a,maintenance:o}=s.ve(r==null?void 0:r.throttles,t);return{key:e,until:Date.now()+n,...a!==void 0&&{throttles:a},...o&&{maintenance:o}}},Rn=["ApiError","NotFoundError","UnauthorisedError","SchemaValidationError","ParsingError"],Ct=e=>e instanceof Error&&Rn.includes(e.name)?e:void 0,zt=e=>{let r=Ct(e);return(r==null?void 0:r.name)==="ApiError"?r:void 0};async function Dn({chat:e,next:r,end:t,node:n,logger:a,apiClient:o,submissions:i,analytics:l,flow:c,applicationRecovery:f,setApplicationRecovery:v,forceSubmitConfirmation:b,flowType:p,run:y,persistWriteBarrier:C,signal:_,onSubmitNetworkError:k,settledOutcomes:I,t:g}){var Q,R;let T=async({redirect_url:N,message:B,button_text:A})=>{let{anonymous_id:F,session_id:j}=l.getSessionInfo();await e.sendMessage({type:"text",author:"bot",text:B??g("submission_redirect_message")});try{let L=new URL(N);F&&!L.searchParams.has("anonymous_id")&&L.searchParams.set("anonymous_id",F),await e.sendMessage({type:"link",href:L.toString(),text:A??g("complete_submission"),onClick:()=>{if(!j){a.error("session_id not set, cannot log FLOW_REDIRECT event");return}l.log({event:"FLOW_REDIRECT",properties:{flow_build:c.build,flow_id:c.id,flow_session_id:j,flow_version:c.version,href:L.toString(),job:c.job}})}})}catch(L){a.error(`Invalid redirect URL: ${N}`,L),e.sendMessage({type:"system",variant:"error",text:g("redirect_url_error")})}};if((Q=c.data.startedWriteNodeIds)!=null&&Q.includes(n.id)&&(f==null?void 0:f.submitNodeId)!==n.id){let N=(R=c.data.submitRedirects)==null?void 0:R[n.id];return N?(await T(N),r(n.nextId)):(await e.sendMessage({type:"system",variant:"warning",text:g("submission_unknown")}),t())}let V=Ln(n.id,c.job),M=0,O=y.submitAccepted&&n.data.skipConfirmation===!0&&(f==null?void 0:f.submitNodeId)!==n.id,W=async N=>{var We,rt,nt,ft,Ke,u,d,h,w;let B=((We=c.data.submitCooldown)==null?void 0:We.key)===V?c.data.submitCooldown:void 0;B&&(B.until=Tn(B));let A=B==null?void 0:B.until;(c.data.reviewRequiresSend===!0&&!O||N!==!0||A!==void 0&&A>Date.now())&&await e.userInput({type:"submit",key:void 0,config:{label:n.data.submitLabel,...A!==void 0&&{availableAt:A}}}),O=!1;let F;if(n.data.captcha){let m=e.captcha,x=!0;try{F=await rn(o,{signal:_,container:(m==null?void 0:m.container())??null,theme:m==null?void 0:m.theme,onInteractive:()=>{e.sendMessage({type:"text",author:"bot",text:g("captcha_check")}).catch(()=>{}).then(()=>{x&&(m==null||m.reveal(!0))})}})}catch(E){if(a.error("Captcha check failed",E),_.aborted)return}finally{x=!1,m==null||m.reveal(!1)}}await e.sendMessage({type:"loading",text:g("submitting")});let{anonymous_id:j,session_id:L}=l.getSessionInfo();if(_.aborted)return;let U=((rt=c.data.startedWriteNodeIds)==null?void 0:rt.includes(n.id))===!0;if((f==null?void 0:f.submitNodeId)===n.id&&await v(void 0),U||(c.data.startedWriteNodeIds=[...c.data.startedWriteNodeIds??[],n.id]),await C().catch(m=>a.error("Failed to persist application write barrier",m)),_.aborted)return;let q,ee=setTimeout(()=>{q=e.sendMessage({type:"loading",semantic:"submission-still-working",text:g("submission_still_working")}).catch(m=>a.error("Failed to send submission progress message",m))},Mn),Z,H=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({log_submit:!1,integration_id:n.data.integrationId,anonymous_id:j,session_id:L,job:c.job,flow_build:c.build,...F!==void 0&&{captcha_token:F},submissions:s.C(c.nodes,s.se(i||{},n.data.submitKeys)),pre_apply:s.I(c.nodes,i||{},c.data.flowSessionId)})}).catch(m=>{Z=m;let x=zt(m);return(x==null?void 0:x.data)!==void 0?x.data:m});if(clearTimeout(ee),await q,_.aborted)return;if(Z!==void 0&&!Ct(Z)&&k)return await k(Z,_),W(!0);n.data.key&&e.setSubmission(n.data.key,{type:"integration",value:H});let ze=(nt=zt(Z))==null?void 0:nt.status,Ve=typeof ze=="number"?ze:void 0,D=s.fe(H,Ve),Me=D===void 0&&Ve===429,Le=I==="terminal"&&((D==null?void 0:D.outcome)==="closed"||(D==null?void 0:D.outcome)==="duplicate"),ve=c.data.failedAttemptAt,Se=ve==null?void 0:ve[V];ve&&Se!==void 0&&Se>Date.now()&&(Se=ve[V]=Date.now());let Te=Se!==void 0&&Date.now()-Se<s.ge||((ft=c.data.unconfirmedAttemptKeys)==null?void 0:ft.includes(V))===!0,He=(Ke=Ct(Z))==null?void 0:Ke.status,he=s.Se(H,typeof He=="number"?He:void 0);he&&l.log({event:"FLOW_SUBMIT",properties:{flow_id:c.id,flow_version:c.version,flow_session_id:c.data.flowSessionId,flow_build:c.build,service:he.service,response:he.response,captured:(H==null?void 0:H.captured)===!0,flow_type:(p==null?void 0:p())??"CHATBOT_DRAWER",job:c.job,...(D==null?void 0:D.outcome)==="duplicate"&&{outcome:Te?"duplicate_after_own_attempt":"duplicate"},...he.outcome&&{outcome:he.outcome}}});let Ne=s.U(H)||(H==null?void 0:H.success)===!0;if((Ne||s.$(H))&&(y.submitAccepted=!0),Ne&&((u=c.data.submitCooldown)==null?void 0:u.throttles)!==void 0&&(delete c.data.submitCooldown.throttles,await C().catch(m=>a.error("Failed to persist submit cooldown reset",m))),s.U(H)){let{redirect_url:m,message:x,button_text:E}=H.integration_response.data,$={redirect_url:m,message:x,button_text:E};return _.aborted?void 0:(c.data.submitRedirects={...c.data.submitRedirects,[n.id]:$},await C().catch(P=>a.error("Failed to persist submit redirect",P)),await T($),r(n.nextId))}let tt=s.$(H);if(tt)return await e.sendMessage({type:"system",variant:"success",text:tt.message??g("submission_pending")}),r(n.nextId);if((H==null?void 0:H.success)===!0)return n.data.skipConfirmation!==!0&&await e.sendMessage({type:"system",variant:"success",text:g("submission_completed")}),r(n.nextId);let Re=s.Re(D),De=Re!==void 0&&((d=i==null?void 0:i[Re])==null?void 0:d.type)==="file"?Re:void 0,Ie=De===void 0?void 0:c.nodes.find(m=>m.type==="question-file"&&m.data.key===De);if(!Ie&&!Le&&!s.we(D)&&(c.data.submitCooldown=Nn(V,B,D)),(D==null?void 0:D.outcome)!=="duplicate"&&!Me&&(c.data.failedAttemptAt={...c.data.failedAttemptAt,[V]:Date.now()},(h=c.data.unconfirmedAttemptKeys)!=null&&h.includes(V)&&(c.data.unconfirmedAttemptKeys=c.data.unconfirmedAttemptKeys.filter(m=>m!==V))),(D==null?void 0:D.verdict)==="not_submitted"||(D==null?void 0:D.outcome)==="duplicate"||(D==null?void 0:D.outcome)==="closed"||Me||s.me(H,Ve)?(U||(c.data.startedWriteNodeIds=(w=c.data.startedWriteNodeIds)==null?void 0:w.filter(m=>m!==n.id)),(f==null?void 0:f.submitNodeId)===n.id&&await v(f),await C().catch(m=>a.error("Failed to persist application write barrier release",m))):await C().catch(m=>a.error("Failed to persist submit cooldown",m)),D){if(a.error(Z??D.message),Ie&&De!==void 0)return e.setSubmission(De,null),await v({fileQuestionNodeId:Ie.id,submitNodeId:n.id}),await e.sendMessage({type:"system",variant:"error",text:g("submission_unreadable_document")}),r(Ie.id);if(D.outcome==="duplicate")return await e.sendMessage({type:"system",variant:Le?"success":"info",semantic:"submission-duplicate",text:g(Te?"submission_duplicate_earlier_attempt":"submission_duplicate")}),Le?(delete c.data.submitCooldown,t()):W(!1);if(D.outcome==="closed")return await e.sendMessage({type:"system",variant:"info",semantic:"submission-closed",text:g("submission_closed")}),Le?(delete c.data.submitCooldown,t()):W(!1);let m=s.ye(D);return m?(await e.sendMessage({type:"system",variant:"warning",text:m.until===void 0?g("submission_provider_maintenance_later"):g("submission_provider_maintenance",{time:s.be(m.until,void 0)})}),W(!1)):D.outcome==="unknown"?(await e.sendMessage({type:"system",variant:"warning",text:g(s.ke(D)?"submission_unknown_do_not_resubmit":"submission_unknown")}),W(!1)):s.we(D)?s.xe(H)?(await e.sendMessage({type:"text",author:"bot",text:D.message}),W(!1)):(M===0&&await e.sendMessage({type:"system",variant:"warning",text:g("captcha_failed")}),M++,W(M<=Cn)):s.he(D)?(await e.sendMessage({type:"system",variant:"error",text:g("submission_retryable")}),W(!1)):(await e.sendMessage({type:"system",variant:"error",text:g("submission_failed")}),t())}return a.error(Z??H),Me?(await e.sendMessage({type:"system",variant:"error",text:g("submission_retryable")}),W(!1)):(await e.sendMessage({type:"system",variant:"error",text:g("submission_failed")}),t())};await W(b===!0&&!O?!1:n.data.skipConfirmation)}async function On({chat:e,next:r,node:t,submissions:n,context:a}){await e.sendMessage({type:"link",href:ue(t.data.href,{submissions:n,context:a}),text:ue(t.data.cta,{submissions:n,context:a})}),r(t.nextId)}async function Bn({submissions:e,next:r,node:t,context:n}){r(_n(t,{submissions:e,context:n})?t.branchId:t.nextId)}async function $n({chat:e,next:r,node:t,submissions:n,context:a}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.text,{submissions:n,context:a})}),r(t.nextId)}async function jn({chat:e,next:r,node:t}){await e.sendMessage({author:"bot",type:"image",url:t.data.url,height:t.data.height,width:t.data.width}),r(t.nextId)}async function Pn({chat:e,next:r,node:t,submissions:n,context:a,t:o,dateEchoLocale:i}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let l=t.data.format==="phone"?await e.userInput({key:t.data.key,type:"phone",config:{optional:t.data.optional,placeholder:t.data.placeholder,minChars:t.data.minChars,maxChars:t.data.maxChars,submissionFormat:"text",defaultValue:{}}}):await e.userInput({key:t.data.key,type:"text",config:{optional:t.data.optional,placeholder:t.data.placeholder,format:t.data.format,maxChars:t.data.maxChars,minChars:t.data.minChars,multiline:t.data.format==="text"&&t.data.multiline===!0}});l===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.type==="phone"?s.pe(l.value):t.data.format==="date"&&i!==void 0?s.Ee(l.value,i):l.value}),r(t.nextId)}async function qn({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"number",config:{max:t.data.max,min:t.data.min,optional:t.data.optional,placeholder:t.data.placeholder,decimalCases:t.data.decimalCases}});i===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:i.value.toString()}),r(t.nextId)}async function Un({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"phone",config:{minChars:t.data.minChars,defaultValue:{countryCode:t.data.defaultCountryCode},placeholder:t.data.placeholder,submissionFormat:"phone",optional:t.data.optional}});i===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:i.type==="phone"?s.pe(i.value):i.value}),r(t.nextId)}async function zn({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"multiple-choice",config:t.data});i.value.length===0?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:t.data.options.filter(l=>i.value.includes(l.value)).map(l=>l.label).join(", ")}),r(t.nextId)}async function Hn({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"boolean",config:{optional:t.data.optional,labels:{true:t.data.trueLabel,false:t.data.falseLabel}}});i===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:i.value===!0?t.data.trueLabel:t.data.falseLabel}),r(t.nextId)}async function Wn({chat:e,next:r,node:t,t:n}){await e.sendMessage({author:"bot",type:"text",text:t.data.question});let a=await e.userInput({type:"address",key:t.data.key,config:{optional:t.data.optional,keys:t.data.keys,line2Required:t.data.line2Required,placeholder:t.data.placeholder}});if(a===null)await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:n("skipped")});else{let o=Object.values(a.value).filter(i=>i&&i.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:o})}return r(t.nextId)}async function Kn({node:e,chat:r,next:t,submissions:n,context:a,t:o}){await r.sendMessage({author:"bot",type:"text",text:ue(e.data.question,{submissions:n,context:a})});let i=await r.userInput({key:e.data.key,type:"file",config:{optional:e.data.optional,extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb??10*1024,allowMultiple:e.data.multiple===!0}});if(i===null)await r.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")});else for(let l of i.value)await r.sendMessage({author:"user",type:"file",fileName:l.name,fileSizeKb:l.sizeKb});return t(e.nextId)}async function Gn({chat:e,end:r,node:t}){await e.sendMessage({type:"system",variant:"info",text:t.data.systemMessage}),r()}async function Jn({node:e,flow:r,submissions:t,chat:n,next:a,apiClient:o,analytics:i,signal:l,context:c}){let f=s.N(r.nodes,t||{}),{answers:v,...b}=f;if(n.setSubmission(e.data.key,{type:"integration",value:b}),wn(r,o,{...i.getSessionInfo(),job:r.job,flow_build:r.build,pre_apply:s.I(r.nodes,t||{},r.data.flowSessionId)},l),f.status!=="skipped"){let p=[f.status==="unavailable"?"We could not prepare your pre-apply summary. You can still continue to your application.":f.hasHardConcerns?e.data.messages.hard:f.hasAdvisoryConcerns?e.data.messages.advisory:e.data.messages.matched];for(let y of["hard","advisory"]){let C=v.filter(_=>!_.matched&&_.severity===y);C.length&&p.push((y==="hard"?"Role requirements":"Other things to consider")+`
|
|
1
|
+
"use strict";var Jr=Object.defineProperty;var Zr=(e,r,t)=>r in e?Jr(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var X=(e,r,t)=>(Zr(e,typeof r!="symbol"?r+"":r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-93dabc80.cjs");require("@inploi/sdk");var Xr="9.10.1",gr=`https://sdk.inploi.com/@inploi/flows@${Xr}/cdn/captcha/index.html`,Yr=new URL(gr).origin,Pt=3e4,Qr=5*6e4,en=e=>typeof e=="object"&&e!==null&&e.source==="inploi-captcha",mt=new WeakMap,tn=e=>{let r=mt.get(e);return r||(r=e.fetch("/flow/captcha").then(t=>{let n=t==null?void 0:t.site_key;return typeof n=="string"&&n!==""?n:void 0}).catch(t=>{throw mt.delete(e),t}),mt.set(e,r)),r},rn=(e,r={})=>new Promise((t,n)=>{let{signal:a,container:o=null,theme:i,onInteractive:l}=r instanceof AbortSignal?{signal:r}:r,c=!1,f=()=>{},v=_=>{c||(c=!0,clearTimeout(y),a==null||a.removeEventListener("abort",p),f(),_())},b=_=>v(()=>n(new Error(_))),p=()=>b("Captcha aborted"),y,C=_=>{clearTimeout(y),y=setTimeout(()=>b("Captcha timed out"),_)};if(C(Pt),a==null?void 0:a.aborted)return p();a==null||a.addEventListener("abort",p),(async()=>{let _=await tn(e);if(_===void 0)return v(()=>t(void 0));if(c)return;let k=document.createElement("iframe");k.src=`${gr}?${new URLSearchParams({sitekey:_,origin:window.location.origin,...i&&{theme:i}}).toString()}`,k.title="Cloudflare security check",k.style.cssText=`display:block;border:0;width:${o?"100%":"300px"};height:0;color-scheme:normal`,o?o.appendChild(k):(k.style.cssText+=";position:fixed;bottom:16px;right:16px;z-index:2147483647",document.body.appendChild(k));let I=!1,g=T=>{if(!k.contentWindow||T.source!==k.contentWindow||T.origin!==Yr||!en(T.data))return;let V=T.data;switch(V.type){case"token":return v(()=>t(V.token));case"resize":k.style.height=`${Math.max(0,Math.ceil(V.height))}px`;return;case"before-interactive":return I=!0,C(Qr),l==null?void 0:l();case"after-interactive":return I=!1,C(Pt);case"error":!I&&!V.interactive&&b("Captcha failed");return;case"expired":return b("Captcha expired");case"timeout":return b("Captcha timed out")}};window.addEventListener("message",g),f=()=>{window.removeEventListener("message",g),k.remove()}})().catch(_=>v(()=>n(_)))}),qt=({condition:e,context:r,submissions:t,ifBlock:n})=>{let[a,...o]=e.compareKey.split(".");if(!a)return!1;let i=s.ue({context:r,key:a,path:o,submissions:t});if(!i)return!1;switch(i.type){case"address":{let l=s.D(i.value,o);switch(e.compare){case"equals":return l===e.compareValue;case"contains":return typeof l!="string"?!1:l.includes(e.compareValue);case"notEquals":return l!==e.compareValue;case"notContains":return typeof l!="string"?!0:!l.includes(e.compareValue)}break}case"integration":{if(typeof i.value!="object"||Array.isArray(i.value))return!1;let l=s.D(i.value,o),c={...n,data:{compareKey:"_temp",compare:e.compare,compareValue:e.compareValue}};switch(typeof l){case"boolean":return Ze(c,{submissions:{_temp:{value:l,type:"boolean"}},context:r});case"string":return Ze(c,{submissions:{_temp:{value:l,type:"string"}},context:r});case"number":return Ze(c,{submissions:{_temp:{value:l,type:"number"}},context:r});case"object":return Array.isArray(l)&&l.every(f=>typeof f=="string")?Ze(c,{submissions:{_temp:{value:l,type:"enum"}},context:r}):!1}break}case"boolean":{let l=e.compareValue==="true";switch(e.compare){case"equals":return i.value===l;case"notEquals":return i.value!==l}break}case"phone":case"string":{let l=i.type==="phone"?s.pe(i.value):i.value;switch(e.compare){case"equals":return l===e.compareValue;case"contains":return l?l.includes(e.compareValue):!1;case"notEquals":return l!==e.compareValue;case"notContains":return l?!l.includes(e.compareValue):!0}break}case"number":{try{let l=Number(e.compareValue);switch(e.compare){case"equals":return i.value===l;case"notEquals":return i.value!==l;case"greaterThan":return i.value>l;case"greaterThanOrEqualTo":return i.value>=l;case"lessThan":return i.value<l;case"lessThanOrEqualTo":return i.value<=l}}catch{return console.error(`Failed to parse number in if-block ${n.id}`,i.value),!1}break}case"enum":switch(e.compare){case"equals":return i.value.length===1&&i.value[0]===e.compareValue;case"notEquals":return i.value.length===1&&i.value[0]!==e.compareValue;case"contains":return i.value.includes(e.compareValue);case"notContains":return!i.value.includes(e.compareValue)}break}},Ze=(e,{context:r,submissions:t})=>{let n="combinator"in e.data?e.data.conditions:[e.data];if(("combinator"in e.data?e.data.combinator:"and")==="or"){for(let a of n)if(qt({condition:a,context:r,submissions:t,ifBlock:e}))return!0;return!1}else{for(let a of n)if(!qt({condition:a,context:r,submissions:t,ifBlock:e}))return!1;return!0}},nn=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,sn=(e,{context:r,submissions:t})=>e.replace(nn,(n,a,o="")=>{let[i,...l]=a.trim().split("."),c=s.ue({key:i,path:l,submissions:t,context:r});if(!c)return o;switch(c.type){case"boolean":return c.value===!0?"true":"false";case"file":return c.value.map(f=>`${f.name} (${s.le(f.sizeKb)})`).join(", ");case"enum":return c.value.join(", ");case"address":return Object.values(c.value).filter(f=>f&&f.trim().length>0).join(", ");case"number":case"string":return c.value?c.value.toString():o;case"phone":return s.pe(c.value);case"integration":{if(typeof c.value!="object"||Array.isArray(c.value))break;let f=s.D(c.value,l);switch(typeof f){case"boolean":return f===!0?"true":"false";case"string":return f;case"number":return f.toString();case"object":if(Array.isArray(f)&&f.every(v=>typeof v=="string"))return f.join(", ")}break}}return o});/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function an(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function At(e,r,t=""){const n=an(e),a=e==null?void 0:e.length,o=r!==void 0;if(!n||o&&a!==r){const i=t&&`"${t}" `,l=o?` of length ${r}`:"",c=n?`length=${a}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+l+", got "+c)}return e}function Ut(e,r=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(r&&e.finished)throw new Error("Hash#digest() has already been called")}function on(e,r){At(e,void 0,"digestInto() output");const t=r.outputLen;if(e.length<t)throw new Error('"digestInto() output" expected to be of length >='+t)}function _t(...e){for(let r=0;r<e.length;r++)e[r].fill(0)}function yt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ce(e,r){return e<<32-r|e>>>r}const ln=(()=>typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function")(),un=Array.from({length:256},(e,r)=>r.toString(16).padStart(2,"0"));function cn(e){if(At(e),ln)return e.toHex();let r="";for(let t=0;t<e.length;t++)r+=un[e[t]];return r}function dn(e,r={}){const t=(a,o)=>e(o).update(a).digest(),n=e(void 0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=a=>e(a),Object.assign(t,r),Object.freeze(t)}const fn=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function hn(e,r,t){return e&r^~e&t}function pn(e,r,t){return e&r^e&t^r&t}class mn{constructor(r,t,n,a){X(this,"blockLen");X(this,"outputLen");X(this,"padOffset");X(this,"isLE");X(this,"buffer");X(this,"view");X(this,"finished",!1);X(this,"length",0);X(this,"pos",0);X(this,"destroyed",!1);this.blockLen=r,this.outputLen=t,this.padOffset=n,this.isLE=a,this.buffer=new Uint8Array(r),this.view=yt(this.buffer)}update(r){Ut(this),At(r);const{view:t,buffer:n,blockLen:a}=this,o=r.length;for(let i=0;i<o;){const l=Math.min(a-this.pos,o-i);if(l===a){const c=yt(r);for(;a<=o-i;i+=a)this.process(c,i);continue}n.set(r.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===a&&(this.process(t,0),this.pos=0)}return this.length+=r.length,this.roundClean(),this}digestInto(r){Ut(this),on(r,this),this.finished=!0;const{buffer:t,view:n,blockLen:a,isLE:o}=this;let{pos:i}=this;t[i++]=128,_t(this.buffer.subarray(i)),this.padOffset>a-i&&(this.process(n,0),i=0);for(let b=i;b<a;b++)t[b]=0;n.setBigUint64(a-8,BigInt(this.length*8),o),this.process(n,0);const l=yt(r),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const f=c/4,v=this.get();if(f>v.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;b<f;b++)l.setUint32(4*b,v[b],o)}digest(){const{buffer:r,outputLen:t}=this;this.digestInto(r);const n=r.slice(0,t);return this.destroy(),n}_cloneInto(r){r||(r=new this.constructor),r.set(...this.get());const{blockLen:t,buffer:n,length:a,finished:o,destroyed:i,pos:l}=this;return r.destroyed=i,r.finished=o,r.length=a,r.pos=l,a%t&&r.buffer.set(n),r}clone(){return this._cloneInto()}}const we=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yn=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_e=new Uint32Array(64);class bn extends mn{constructor(r){super(64,r,8,!1)}get(){const{A:r,B:t,C:n,D:a,E:o,F:i,G:l,H:c}=this;return[r,t,n,a,o,i,l,c]}set(r,t,n,a,o,i,l,c){this.A=r|0,this.B=t|0,this.C=n|0,this.D=a|0,this.E=o|0,this.F=i|0,this.G=l|0,this.H=c|0}process(r,t){for(let b=0;b<16;b++,t+=4)_e[b]=r.getUint32(t,!1);for(let b=16;b<64;b++){const p=_e[b-15],y=_e[b-2],C=ce(p,7)^ce(p,18)^p>>>3,_=ce(y,17)^ce(y,19)^y>>>10;_e[b]=_+_e[b-7]+C+_e[b-16]|0}let{A:n,B:a,C:o,D:i,E:l,F:c,G:f,H:v}=this;for(let b=0;b<64;b++){const p=ce(l,6)^ce(l,11)^ce(l,25),y=v+p+hn(l,c,f)+yn[b]+_e[b]|0,_=(ce(n,2)^ce(n,13)^ce(n,22))+pn(n,a,o)|0;v=f,f=c,c=l,l=i+y|0,i=o,o=a,a=n,n=y+_|0}n=n+this.A|0,a=a+this.B|0,o=o+this.C|0,i=i+this.D|0,l=l+this.E|0,c=c+this.F|0,f=f+this.G|0,v=v+this.H|0,this.set(n,a,o,i,l,c,f,v)}roundClean(){_t(_e)}destroy(){this.set(0,0,0,0,0,0,0,0),_t(this.buffer)}}class gn extends bn{constructor(){super(32);X(this,"A",we[0]|0);X(this,"B",we[1]|0);X(this,"C",we[2]|0);X(this,"D",we[3]|0);X(this,"E",we[4]|0);X(this,"F",we[5]|0);X(this,"G",we[6]|0);X(this,"H",we[7]|0)}}const vn=dn(()=>new gn,fn(1));var vr=e=>{let r=e.find(t=>t.isHead);if(!r)throw new Error("No head node found");return r},Ft=e=>{var r,t;if(!(e.data.isFinished||(r=e.data.startedWriteNodeIds)!=null&&r.length))return(t=[...e.data.messages].reverse().find(n=>n.groupId&&e.nodes.some(a=>a.id===n.groupId&&a.type.startsWith("question-"))&&(n.type==="system"||"author"in n&&n.author==="user")))==null?void 0:t.groupId},kt=e=>Array.isArray(e)?e.map(kt):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>[r,kt(t)])):typeof e=="function"?void 0:e,xn=e=>cn(vn(new TextEncoder().encode(JSON.stringify(kt(e)))));function wn(e,r,t,n){var a;if(n!=null&&n.aborted)return;let o=xn(t),i=(a=e.data).preApplyFingerprints??(a.preApplyFingerprints=[]);if(i.includes(o))return;i.push(o);let l=new AbortController,c=setTimeout(()=>l.abort(),5e3);r.fetch("/flow/pre-apply",{method:"POST",signal:l.signal,body:JSON.stringify(t)}).catch(()=>{let f=i.indexOf(o);f!==-1&&i.splice(f,1)}).finally(()=>{clearTimeout(c)})}var xr=({context:e,submissions:r})=>({context:e,submissions:r??{}}),ue=(e,r)=>sn(e,xr(r)),_n=(e,r)=>Ze(e,xr(r)),wr=({node:e,nodes:r,stopWhen:t})=>{if((t==null?void 0:t(e))===!0)return e;let n=e.nextId?r.find(a=>a.id===e.nextId):void 0;if(n)return wr({node:n,nodes:r,stopWhen:t})},kn=({childNode:e,nodes:r})=>{let t=r.filter(n=>n.type==="if-block").find(n=>{if(!n.branchId)return!1;let a=r.find(i=>i.id===n.branchId);if(!a)return!1;let o=wr({node:a,nodes:r,stopWhen:i=>i.id===e.id});return!(!o||o.id!==e.id)});if(t!=null&&t.nextId)return r.find(n=>n.id===t.nextId)},Cn=3,Sn=({flow:e,analytics:r,logger:t,talentBankClient:n,context:a,apiClient:o,getSubmissions:i,getApplicationRecovery:l,setApplicationRecovery:c,chatService:f,persistWriteBarrier:v,onSubmitNetworkError:b,closedRoleBehaviour:p,settledOutcomes:y=p,dateEchoLocale:C,onFlowEnd:_,onInterpret:k,forceSubmitConfirmation:I,flowType:g,t:T})=>{var V;let M=new AbortController,O={submitAccepted:!1};(V=e.data).startedWriteNodeIds??(V.startedWriteNodeIds=e.nodes.flatMap(R=>{var B,A;if(R.type!=="integration-application-submit"||!e.data.nodeHistory.includes(R.id))return[];let N=R.data.key?(B=i())==null?void 0:B[R.data.key]:void 0;return(N==null?void 0:N.type)==="integration"&&((A=s.fe(N.value))==null?void 0:A.verdict)==="not_submitted"?[]:[R.id]}));let W={...r.service,log:R=>r.service.log({...R,customProperties:{...R.customProperties,...r.customProperties}})},Q=async(R,N)=>{let B=M.signal;if(B.aborted)return;let A=i(),F=l(),j=(F==null?void 0:F.submitNodeId)===R.id?e.nodes.find(L=>{var U;return L.id===F.fileQuestionNodeId&&L.type==="question-file"&&((U=A==null?void 0:A[L.data.key])==null?void 0:U.type)!=="file"}):void 0;if(j)return Q(j,N);k==null||k(R,N);try{await In({flow:e,analytics:W,logger:t,talentBankClient:n,apiClient:o,context:a,node:R,submissions:A,applicationRecovery:F,setApplicationRecovery:async L=>{if(!B.aborted)try{await c(L)}catch(U){t.error("Failed to persist application recovery",U)}},forceSubmitConfirmation:I||(F==null?void 0:F.submitNodeId)===R.id,run:O,persistWriteBarrier:v,onSubmitNetworkError:b,settledOutcomes:y,dateEchoLocale:C,flowType:g,signal:B,t:T,chat:{sendMessage:async L=>f.send({groupId:R.id,message:L,signal:B}),userInput:async L=>f.input({input:L,signal:B}),setSubmission:(L,U)=>{B.aborted||f.setSubmission(L,U)},captcha:f.captcha},next:L=>{if(B.aborted)return;let U=(F==null?void 0:F.fileQuestionNodeId)===R.id?F.submitNodeId:L,q=U?e.nodes.find(ee=>ee.id===U):kn({childNode:R,nodes:e.nodes});return q?Q(q,R):_==null?void 0:_(R)},end:()=>{B.aborted||(_==null||_(R))}})}catch(L){if(L instanceof s.T)return;throw L}};return{interpret:async R=>{let N=e.nodes.find(B=>B.id===R)??vr(e.nodes);return Q(N)},undo:R=>{var U;if(delete e.data.reviewReplay,((U=e.data.startedWriteNodeIds)==null?void 0:U.length)||e.data.isFinished)return{removed:0};let N=Ft(e),B=N?R.lastIndexOf(N):-1,A=e.nodes.find(q=>q.id===N);if(B===-1||!A)return{removed:0};let F=e.nodes.find(q=>q.id===R[R.length-1]);M.abort();let j=R.splice(B);e.data.messages=e.data.messages.filter(q=>!q.groupId||!j.includes(q.groupId)),e.data.currentInput=null;let L=i();for(let q of j.slice(1)){let ee=e.nodes.find(Z=>Z.id===q);if(!(!ee||!L||ee.id===N)&&("key"in ee.data&&ee.data.key&&delete L[ee.data.key],"keys"in ee.data))for(let Z of Object.values(ee.data.keys))typeof Z=="string"&&delete L[Z]}return M=new AbortController,Q(A,F),{removed:j.length}},abort:()=>{M.abort()}}};async function In(e){let r=e.node;switch(r.type){case"flow-section":return await e.chat.sendMessage({type:"system",variant:"info",text:r.data.title}),e.next(r.nextId);case"pre-apply-result":return Jn({...e,node:r});case"text":return $n({...e,node:r});case"image":return jn({...e,node:r});case"question-text":return Pn({...e,node:r});case"question-enum":return zn({...e,node:r});case"question-number":return qn({...e,node:r});case"question-phone":return Un({...e,node:r});case"question-boolean":return Hn({...e,node:r});case"question-file":return Kn({...e,node:r});case"question-address":return Wn({...e,node:r});case"end-flow":return Gn({...e,node:r});case"if-block":return Bn({...e,node:r});case"jump":return Fn({...e,node:r});case"link":return On({...e,node:r});case"integration-application-submit":return Dn({...e,node:r});case"add-submission":return Vn({...e,node:r});case"integration-workflow-get":throw Error("Workflow should be unreachable");case"check-duplicate":return An({...e,node:r});case"feedback":return En({...e,node:r});default:throw new Error(`Unknown node: ${JSON.stringify(r)}`)}}async function En({next:e,node:r}){e(r.nextId)}async function An({next:e,node:r,talentBankClient:t,submissions:n,flow:a,logger:o,chat:i}){var c;let l={isDuplicate:!1};if(n&&t){let f=r.data.scope==="job"?(c=a.job)==null?void 0:c.id:void 0;if(r.data.scope==="company"||f!=null)try{l=await t.checkDuplicate({email:s.ae({key:r.data.email,submissions:n}).toString(),jobId:f,scope:r.data.scope})}catch(v){o.error("[check-duplicate]",v)}}i.setSubmission(r.data.key,{type:"integration",value:l}),e(r.nextId)}async function Fn({next:e,node:r}){e(r.data.targetId)}async function Vn({next:e,node:r,logger:t,submissions:n,context:a}){if(!n){t.error("Submissions not found");return}n[r.data.key]={type:"string",value:ue(r.data.value,{submissions:n,context:a})},e(r.nextId)}var Mn=5e3,Ln=(e,r)=>r?`${e}@${r.id_type}:${r.id}`:e,Tn=(e,r=Date.now())=>Math.min(e.until,r+(e.maintenance?s.z:e.throttles?s.Z:s.H)),Nn=(e,r,t)=>{let{waitMs:n,throttles:a,maintenance:o}=s.ve(r==null?void 0:r.throttles,t);return{key:e,until:Date.now()+n,...a!==void 0&&{throttles:a},...o&&{maintenance:o}}},Rn=["ApiError","NotFoundError","UnauthorisedError","SchemaValidationError","ParsingError"],Ct=e=>e instanceof Error&&Rn.includes(e.name)?e:void 0,zt=e=>{let r=Ct(e);return(r==null?void 0:r.name)==="ApiError"?r:void 0};async function Dn({chat:e,next:r,end:t,node:n,logger:a,apiClient:o,submissions:i,analytics:l,flow:c,applicationRecovery:f,setApplicationRecovery:v,forceSubmitConfirmation:b,flowType:p,run:y,persistWriteBarrier:C,signal:_,onSubmitNetworkError:k,settledOutcomes:I,t:g}){var Q,R;let T=async({redirect_url:N,message:B,button_text:A})=>{let{anonymous_id:F,session_id:j}=l.getSessionInfo();await e.sendMessage({type:"text",author:"bot",text:B??g("submission_redirect_message")});try{let L=new URL(N);F&&!L.searchParams.has("anonymous_id")&&L.searchParams.set("anonymous_id",F),await e.sendMessage({type:"link",href:L.toString(),text:A??g("complete_submission"),onClick:()=>{if(!j){a.error("session_id not set, cannot log FLOW_REDIRECT event");return}l.log({event:"FLOW_REDIRECT",properties:{flow_build:c.build,flow_id:c.id,flow_session_id:j,flow_version:c.version,href:L.toString(),job:c.job}})}})}catch(L){a.error(`Invalid redirect URL: ${N}`,L),e.sendMessage({type:"system",variant:"error",text:g("redirect_url_error")})}};if((Q=c.data.startedWriteNodeIds)!=null&&Q.includes(n.id)&&(f==null?void 0:f.submitNodeId)!==n.id){let N=(R=c.data.submitRedirects)==null?void 0:R[n.id];return N?(await T(N),r(n.nextId)):(await e.sendMessage({type:"system",variant:"warning",text:g("submission_unknown")}),t())}let V=Ln(n.id,c.job),M=0,O=y.submitAccepted&&n.data.skipConfirmation===!0&&(f==null?void 0:f.submitNodeId)!==n.id,W=async N=>{var We,rt,nt,ft,Ke,u,d,h,w;let B=((We=c.data.submitCooldown)==null?void 0:We.key)===V?c.data.submitCooldown:void 0;B&&(B.until=Tn(B));let A=B==null?void 0:B.until;(c.data.reviewRequiresSend===!0&&!O||N!==!0||A!==void 0&&A>Date.now())&&await e.userInput({type:"submit",key:void 0,config:{label:n.data.submitLabel,...A!==void 0&&{availableAt:A}}}),O=!1;let F;if(n.data.captcha){let m=e.captcha,x=!0;try{F=await rn(o,{signal:_,container:(m==null?void 0:m.container())??null,theme:m==null?void 0:m.theme,onInteractive:()=>{e.sendMessage({type:"text",author:"bot",text:g("captcha_check")}).catch(()=>{}).then(()=>{x&&(m==null||m.reveal(!0))})}})}catch(E){if(a.error("Captcha check failed",E),_.aborted)return}finally{x=!1,m==null||m.reveal(!1)}}await e.sendMessage({type:"loading",text:g("submitting")});let{anonymous_id:j,session_id:L}=l.getSessionInfo();if(_.aborted)return;let U=((rt=c.data.startedWriteNodeIds)==null?void 0:rt.includes(n.id))===!0;if((f==null?void 0:f.submitNodeId)===n.id&&await v(void 0),U||(c.data.startedWriteNodeIds=[...c.data.startedWriteNodeIds??[],n.id]),await C().catch(m=>a.error("Failed to persist application write barrier",m)),_.aborted)return;let q,ee=setTimeout(()=>{q=e.sendMessage({type:"loading",semantic:"submission-still-working",text:g("submission_still_working")}).catch(m=>a.error("Failed to send submission progress message",m))},Mn),Z,H=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({log_submit:!1,integration_id:n.data.integrationId,anonymous_id:j,session_id:L,job:c.job,flow_build:c.build,...F!==void 0&&{captcha_token:F},submissions:s.C(c.nodes,s.se(i||{},n.data.submitKeys)),pre_apply:s.I(c.nodes,i||{},c.data.flowSessionId)})}).catch(m=>{Z=m;let x=zt(m);return(x==null?void 0:x.data)!==void 0?x.data:m});if(clearTimeout(ee),await q,_.aborted)return;if(Z!==void 0&&!Ct(Z)&&k)return await k(Z,_),W(!0);n.data.key&&e.setSubmission(n.data.key,{type:"integration",value:H});let ze=(nt=zt(Z))==null?void 0:nt.status,Ve=typeof ze=="number"?ze:void 0,D=s.fe(H,Ve),Me=D===void 0&&Ve===429,Le=I==="terminal"&&((D==null?void 0:D.outcome)==="closed"||(D==null?void 0:D.outcome)==="duplicate"),ve=c.data.failedAttemptAt,Se=ve==null?void 0:ve[V];ve&&Se!==void 0&&Se>Date.now()&&(Se=ve[V]=Date.now());let Te=Se!==void 0&&Date.now()-Se<s.ge||((ft=c.data.unconfirmedAttemptKeys)==null?void 0:ft.includes(V))===!0,He=(Ke=Ct(Z))==null?void 0:Ke.status,he=s.Se(H,typeof He=="number"?He:void 0);he&&l.log({event:"FLOW_SUBMIT",properties:{flow_id:c.id,flow_version:c.version,flow_session_id:c.data.flowSessionId,flow_build:c.build,service:he.service,response:he.response,captured:(H==null?void 0:H.captured)===!0,flow_type:(p==null?void 0:p())??"CHATBOT_DRAWER",job:c.job,...(D==null?void 0:D.outcome)==="duplicate"&&{outcome:Te?"duplicate_after_own_attempt":"duplicate"},...he.outcome&&{outcome:he.outcome}}});let Ne=s.U(H)||(H==null?void 0:H.success)===!0;if((Ne||s.$(H))&&(y.submitAccepted=!0),Ne&&((u=c.data.submitCooldown)==null?void 0:u.throttles)!==void 0&&(delete c.data.submitCooldown.throttles,await C().catch(m=>a.error("Failed to persist submit cooldown reset",m))),s.U(H)){let{redirect_url:m,message:x,button_text:E}=H.integration_response.data,$={redirect_url:m,message:x,button_text:E};return _.aborted?void 0:(c.data.submitRedirects={...c.data.submitRedirects,[n.id]:$},await C().catch(P=>a.error("Failed to persist submit redirect",P)),await T($),r(n.nextId))}let tt=s.$(H);if(tt)return await e.sendMessage({type:"system",variant:"success",text:tt.message??g("submission_pending")}),r(n.nextId);if((H==null?void 0:H.success)===!0)return n.data.skipConfirmation!==!0&&await e.sendMessage({type:"system",variant:"success",text:g("submission_completed")}),r(n.nextId);let Re=s.Re(D),De=Re!==void 0&&((d=i==null?void 0:i[Re])==null?void 0:d.type)==="file"?Re:void 0,Ie=De===void 0?void 0:c.nodes.find(m=>m.type==="question-file"&&m.data.key===De);if(!Ie&&!Le&&!s.we(D)&&(c.data.submitCooldown=Nn(V,B,D)),(D==null?void 0:D.outcome)!=="duplicate"&&!Me&&(c.data.failedAttemptAt={...c.data.failedAttemptAt,[V]:Date.now()},(h=c.data.unconfirmedAttemptKeys)!=null&&h.includes(V)&&(c.data.unconfirmedAttemptKeys=c.data.unconfirmedAttemptKeys.filter(m=>m!==V))),(D==null?void 0:D.verdict)==="not_submitted"||(D==null?void 0:D.outcome)==="duplicate"||(D==null?void 0:D.outcome)==="closed"||Me||s.me(H,Ve)?(U||(c.data.startedWriteNodeIds=(w=c.data.startedWriteNodeIds)==null?void 0:w.filter(m=>m!==n.id)),(f==null?void 0:f.submitNodeId)===n.id&&await v(f),await C().catch(m=>a.error("Failed to persist application write barrier release",m))):await C().catch(m=>a.error("Failed to persist submit cooldown",m)),D){if(a.error(Z??D.message),Ie&&De!==void 0)return e.setSubmission(De,null),await v({fileQuestionNodeId:Ie.id,submitNodeId:n.id}),await e.sendMessage({type:"system",variant:"error",text:g("submission_unreadable_document")}),r(Ie.id);if(D.outcome==="duplicate")return await e.sendMessage({type:"system",variant:Le?"success":"info",semantic:"submission-duplicate",text:g(Te?"submission_duplicate_earlier_attempt":"submission_duplicate")}),Le?(delete c.data.submitCooldown,t()):W(!1);if(D.outcome==="closed")return await e.sendMessage({type:"system",variant:"info",semantic:"submission-closed",text:g("submission_closed")}),Le?(delete c.data.submitCooldown,t()):W(!1);let m=s.ye(D);return m?(await e.sendMessage({type:"system",variant:"warning",text:m.until===void 0?g("submission_provider_maintenance_later"):g("submission_provider_maintenance",{time:s.be(m.until,void 0)})}),W(!1)):D.outcome==="unknown"?(await e.sendMessage({type:"system",variant:"warning",text:g(s.ke(D)?"submission_unknown_do_not_resubmit":"submission_unknown")}),W(!1)):s.we(D)?s.xe(H)?(await e.sendMessage({type:"text",author:"bot",text:D.message}),W(!1)):(M===0&&await e.sendMessage({type:"system",variant:"warning",text:g("captcha_failed")}),M++,W(M<=Cn)):s.he(D)?(await e.sendMessage({type:"system",variant:"error",text:g("submission_retryable")}),W(!1)):(await e.sendMessage({type:"system",variant:"error",text:g("submission_failed")}),t())}return a.error(Z??H),Me?(await e.sendMessage({type:"system",variant:"error",text:g("submission_retryable")}),W(!1)):(await e.sendMessage({type:"system",variant:"error",text:g("submission_failed")}),t())};await W(b===!0&&!O?!1:n.data.skipConfirmation)}async function On({chat:e,next:r,node:t,submissions:n,context:a}){await e.sendMessage({type:"link",href:ue(t.data.href,{submissions:n,context:a}),text:ue(t.data.cta,{submissions:n,context:a})}),r(t.nextId)}async function Bn({submissions:e,next:r,node:t,context:n}){r(_n(t,{submissions:e,context:n})?t.branchId:t.nextId)}async function $n({chat:e,next:r,node:t,submissions:n,context:a}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.text,{submissions:n,context:a})}),r(t.nextId)}async function jn({chat:e,next:r,node:t}){await e.sendMessage({author:"bot",type:"image",url:t.data.url,height:t.data.height,width:t.data.width}),r(t.nextId)}async function Pn({chat:e,next:r,node:t,submissions:n,context:a,t:o,dateEchoLocale:i}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let l=t.data.format==="phone"?await e.userInput({key:t.data.key,type:"phone",config:{optional:t.data.optional,placeholder:t.data.placeholder,minChars:t.data.minChars,maxChars:t.data.maxChars,submissionFormat:"text",defaultValue:{}}}):await e.userInput({key:t.data.key,type:"text",config:{optional:t.data.optional,placeholder:t.data.placeholder,format:t.data.format,maxChars:t.data.maxChars,minChars:t.data.minChars,multiline:t.data.format==="text"&&t.data.multiline===!0}});l===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.type==="phone"?s.pe(l.value):t.data.format==="date"&&i!==void 0?s.Ee(l.value,i):l.value}),r(t.nextId)}async function qn({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"number",config:{max:t.data.max,min:t.data.min,optional:t.data.optional,placeholder:t.data.placeholder,decimalCases:t.data.decimalCases}});i===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:i.value.toString()}),r(t.nextId)}async function Un({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"phone",config:{minChars:t.data.minChars,defaultValue:{countryCode:t.data.defaultCountryCode},placeholder:t.data.placeholder,submissionFormat:"phone",optional:t.data.optional}});i===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:i.type==="phone"?s.pe(i.value):i.value}),r(t.nextId)}async function zn({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"multiple-choice",config:t.data});i.value.length===0?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:t.data.options.filter(l=>i.value.includes(l.value)).map(l=>l.label).join(", ")}),r(t.nextId)}async function Hn({chat:e,next:r,node:t,submissions:n,context:a,t:o}){await e.sendMessage({author:"bot",type:"text",text:ue(t.data.question,{submissions:n,context:a})});let i=await e.userInput({key:t.data.key,type:"boolean",config:{optional:t.data.optional,labels:{true:t.data.trueLabel,false:t.data.falseLabel}}});i===null?await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")}):await e.sendMessage({author:"user",type:"text",text:i.value===!0?t.data.trueLabel:t.data.falseLabel}),r(t.nextId)}async function Wn({chat:e,next:r,node:t,t:n}){await e.sendMessage({author:"bot",type:"text",text:t.data.question});let a=await e.userInput({type:"address",key:t.data.key,config:{optional:t.data.optional,keys:t.data.keys,line2Required:t.data.line2Required,placeholder:t.data.placeholder}});if(a===null)await e.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:n("skipped")});else{let o=Object.values(a.value).filter(i=>i&&i.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:o})}return r(t.nextId)}async function Kn({node:e,chat:r,next:t,submissions:n,context:a,t:o}){await r.sendMessage({author:"bot",type:"text",text:ue(e.data.question,{submissions:n,context:a})});let i=await r.userInput({key:e.data.key,type:"file",config:{optional:e.data.optional,extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb??10*1024,allowMultiple:e.data.multiple===!0}});if(i===null)await r.sendMessage({type:"system",variant:"info",semantic:"question-skipped",text:o("skipped")});else for(let l of i.value)await r.sendMessage({author:"user",type:"file",fileName:l.name,fileSizeKb:l.sizeKb});return t(e.nextId)}async function Gn({chat:e,end:r,node:t}){await e.sendMessage({type:"system",variant:"info",text:t.data.systemMessage}),r()}async function Jn({node:e,flow:r,submissions:t,chat:n,next:a,apiClient:o,analytics:i,signal:l,context:c}){let f=s.N(r.nodes,t||{}),{answers:v,...b}=f;if(n.setSubmission(e.data.key,{type:"integration",value:b}),wn(r,o,{...i.getSessionInfo(),job:r.job,flow_build:r.build,pre_apply:s.I(r.nodes,t||{},r.data.flowSessionId)},l),f.status!=="skipped"){let p=[f.status==="unavailable"?"We could not prepare your pre-apply summary. You can still continue to your application.":f.hasHardConcerns?e.data.messages.hard:f.hasAdvisoryConcerns?e.data.messages.advisory:e.data.messages.matched];for(let y of["hard","advisory"]){let C=v.filter(_=>!_.matched&&_.severity===y);C.length&&p.push((y==="hard"?"Role requirements":"Other things to consider")+`
|
|
2
2
|
`+C.map(_=>`• ${_.message}`).join(`
|
|
3
3
|
`))}await n.sendMessage({type:"text",author:"bot",text:p.join(`
|
|
4
4
|
|
package/dist/i18n.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare const TranslationProvider: (props: {
|
|
|
49
49
|
readonly file_total_size: string;
|
|
50
50
|
readonly loading: string;
|
|
51
51
|
readonly minimize: string;
|
|
52
|
-
readonly submission_redirect_message: "
|
|
53
|
-
readonly complete_submission: "
|
|
52
|
+
readonly submission_redirect_message: "One last step: finish your application on the employer's site.";
|
|
53
|
+
readonly complete_submission: "Continue on the employer's site";
|
|
54
54
|
readonly submission_completed: "Submission completed!";
|
|
55
55
|
readonly submission_pending: "Thanks, we've received your application and are processing it.";
|
|
56
56
|
readonly submission_provider_maintenance: "Sorry, our recruitment system is down for scheduled maintenance until about {{time}}. Please keep this page open and try again when maintenance ends. We apologise for the inconvenience.";
|
|
@@ -171,8 +171,8 @@ export declare const TranslationProvider: (props: {
|
|
|
171
171
|
readonly file_total_size: string;
|
|
172
172
|
readonly loading: string;
|
|
173
173
|
readonly minimize: string;
|
|
174
|
-
readonly submission_redirect_message: "
|
|
175
|
-
readonly complete_submission: "
|
|
174
|
+
readonly submission_redirect_message: "One last step: finish your application on the employer's site.";
|
|
175
|
+
readonly complete_submission: "Continue on the employer's site";
|
|
176
176
|
readonly submission_completed: "Submission completed!";
|
|
177
177
|
readonly submission_pending: "Thanks, we've received your application and are processing it.";
|
|
178
178
|
readonly submission_provider_maintenance: "Sorry, our recruitment system is down for scheduled maintenance until about {{time}}. Please keep this page open and try again when maintenance ends. We apologise for the inconvenience.";
|
|
@@ -290,8 +290,8 @@ export declare const TranslationProvider: (props: {
|
|
|
290
290
|
readonly file_total_size: string;
|
|
291
291
|
readonly loading: string;
|
|
292
292
|
readonly minimize: string;
|
|
293
|
-
readonly submission_redirect_message: "
|
|
294
|
-
readonly complete_submission: "
|
|
293
|
+
readonly submission_redirect_message: "One last step: finish your application on the employer's site.";
|
|
294
|
+
readonly complete_submission: "Continue on the employer's site";
|
|
295
295
|
readonly submission_completed: "Submission completed!";
|
|
296
296
|
readonly submission_pending: "Thanks, we've received your application and are processing it.";
|
|
297
297
|
readonly submission_provider_maintenance: "Sorry, our recruitment system is down for scheduled maintenance until about {{time}}. Please keep this page open and try again when maintenance ends. We apologise for the inconvenience.";
|
|
@@ -412,8 +412,8 @@ export declare const TranslationProvider: (props: {
|
|
|
412
412
|
readonly file_total_size: string;
|
|
413
413
|
readonly loading: string;
|
|
414
414
|
readonly minimize: string;
|
|
415
|
-
readonly submission_redirect_message: "
|
|
416
|
-
readonly complete_submission: "
|
|
415
|
+
readonly submission_redirect_message: "One last step: finish your application on the employer's site.";
|
|
416
|
+
readonly complete_submission: "Continue on the employer's site";
|
|
417
417
|
readonly submission_completed: "Submission completed!";
|
|
418
418
|
readonly submission_pending: "Thanks, we've received your application and are processing it.";
|
|
419
419
|
readonly submission_provider_maintenance: "Sorry, our recruitment system is down for scheduled maintenance until about {{time}}. Please keep this page open and try again when maintenance ends. We apologise for the inconvenience.";
|
|
@@ -531,8 +531,8 @@ export declare const TranslationProvider: (props: {
|
|
|
531
531
|
readonly file_total_size: string;
|
|
532
532
|
readonly loading: string;
|
|
533
533
|
readonly minimize: string;
|
|
534
|
-
readonly submission_redirect_message: "
|
|
535
|
-
readonly complete_submission: "
|
|
534
|
+
readonly submission_redirect_message: "One last step: finish your application on the employer's site.";
|
|
535
|
+
readonly complete_submission: "Continue on the employer's site";
|
|
536
536
|
readonly submission_completed: "Submission completed!";
|
|
537
537
|
readonly submission_pending: "Thanks, we've received your application and are processing it.";
|
|
538
538
|
readonly submission_provider_maintenance: "Sorry, our recruitment system is down for scheduled maintenance until about {{time}}. Please keep this page open and try again when maintenance ends. We apologise for the inconvenience.";
|
|
@@ -651,8 +651,8 @@ export declare const TranslationProvider: (props: {
|
|
|
651
651
|
readonly file_total_size: string;
|
|
652
652
|
readonly loading: string;
|
|
653
653
|
readonly minimize: string;
|
|
654
|
-
readonly submission_redirect_message: "
|
|
655
|
-
readonly complete_submission: "
|
|
654
|
+
readonly submission_redirect_message: "One last step: finish your application on the employer's site.";
|
|
655
|
+
readonly complete_submission: "Continue on the employer's site";
|
|
656
656
|
readonly submission_completed: "Submission completed!";
|
|
657
657
|
readonly submission_pending: "Thanks, we've received your application and are processing it.";
|
|
658
658
|
readonly submission_provider_maintenance: "Sorry, our recruitment system is down for scheduled maintenance until about {{time}}. Please keep this page open and try again when maintenance ends. We apologise for the inconvenience.";
|