@inkeep/agents-ui 0.0.0-dev-20260513213554 → 0.0.0-dev-20260528130902
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/dist/primitives/components/embedded-chat/use-captcha.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-captcha.d.ts +1 -22
- package/dist/primitives/components/embedded-chat/use-captcha.js +81 -60
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +74 -76
- package/dist/primitives/components/embedded-chat.d.ts +1 -1
- package/dist/primitives/hooks/use-anonymous-session.cjs +1 -1
- package/dist/primitives/hooks/use-anonymous-session.js +70 -65
- package/dist/primitives/hooks/use-events-api.cjs +1 -1
- package/dist/primitives/hooks/use-events-api.d.ts +3 -1
- package/dist/primitives/hooks/use-events-api.js +30 -29
- package/dist/primitives/hooks/use-feedback-api.cjs +1 -1
- package/dist/primitives/hooks/use-feedback-api.d.ts +3 -1
- package/dist/primitives/hooks/use-feedback-api.js +27 -26
- package/dist/primitives/hooks/use-inkeep-api-client.cjs +1 -1
- package/dist/primitives/hooks/use-inkeep-api-client.js +29 -42
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/primitives/providers/chat-auth-provider.cjs +1 -1
- package/dist/primitives/providers/chat-auth-provider.js +24 -28
- package/dist/primitives/providers/chat-base-events-provider.cjs +1 -1
- package/dist/primitives/providers/chat-base-events-provider.js +33 -33
- package/dist/primitives/providers/feedback-provider.cjs +1 -1
- package/dist/primitives/providers/feedback-provider.js +19 -18
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),m="[sentinel]",g="https://cdn.jsdelivr.net/npm/altcha@3.0.9/dist/main/altcha.min.js",v="sha384-SAvZpYmIwEwxkbER1dijvBKm10sobAn/28KXy+Z7/lGbsCshTPhYrFJ2kU7LKiFM",p=1e4;let f=null;function w(){if(typeof customElements>"u"||customElements.get("altcha-widget"))return Promise.resolve();if(f)return f;const a=r=>e=>{f=null,r(e)};return f=new Promise((r,e)=>{const t=a(e);if(document.querySelector(`script[src="${g}"]`)){customElements.whenDefined("altcha-widget").then(()=>r()).catch(t);return}const n=document.createElement("script");n.src=g,n.integrity=v,n.crossOrigin="anonymous",n.type="module",n.async=!0,n.onload=()=>{customElements.whenDefined("altcha-widget").then(()=>r()).catch(()=>t(new Error("altcha-widget custom element never registered")))},n.onerror=()=>{console.error(m,"failed to load widget script"),t(new Error("Failed to load altcha-widget script"))},document.head.appendChild(n)}),f}function y(a){const r=document.createElement("div");r.style.cssText="position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;pointer-events:none",document.body.appendChild(r);const e=document.createElement("altcha-widget");e.setAttribute("challenge",a),e.setAttribute("auto","onload"),e.setAttribute("hidefooter","true"),e.setAttribute("hidelogo","true"),r.appendChild(e);let t=null,i,n="mounted",d=!1,o=!1;const c=()=>{d||(i=void 0,n="resetting",e.reset?.(),e.verify?.())},h=l=>{const s=l.detail;s&&(n=s.state??n,s.state==="verified"&&s.payload&&(o=!0,i=s.payload,t&&(t(s.payload),t=null)),s.state==="error"&&(i=void 0,t&&(t(void 0),t=null),o||(d=!0,console.warn(m,"Sentinel unavailable, requests will proceed without bot protection"))))};return e.addEventListener("statechange",h),{getPayload:()=>{if(d)return Promise.resolve(void 0);if(i){const l=i;return i=void 0,c(),Promise.resolve(l)}return n==="verified"&&c(),new Promise(l=>{t=l,setTimeout(()=>{t===l&&(t=null,l(void 0))},p)})},startNextSolve:c,destroy:()=>{e.removeEventListener("statechange",h),t=null,r.remove()}}}const E=({baseUrl:a,shouldBypassCaptcha:r=!1})=>{const e=u.useRef(null),t=u.useRef(null),i=u.useCallback(()=>e.current?Promise.resolve():(t.current||(t.current=w().then(()=>{if(!e.current){const o=`${a}/run/auth/sentinel/challenge`;e.current=y(o)}}).catch(o=>{console.error(m,"failed to mount widget",o),t.current=null})),t.current),[a]);u.useEffect(()=>{if(!r)return i(),()=>{e.current?.destroy(),e.current=null,t.current=null}},[r,i]);const n=u.useCallback(async()=>{if(r)return{};await i();const o=e.current;if(!o)return{};const c=await o.getPayload();return c?{"x-inkeep-challenge-solution":btoa(JSON.stringify({payload:c}))}:{}},[r,i]),d=u.useCallback(()=>{e.current?.startNextSolve()},[]);return{getCaptchaHeader:n,invalidate:d}};exports.useCaptcha=E;
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
import { Payload } from 'altcha-lib/types';
|
|
2
1
|
interface UseCaptchaOptions {
|
|
3
2
|
baseUrl: string;
|
|
4
3
|
shouldBypassCaptcha?: boolean;
|
|
5
|
-
shouldMakeInitialRequest?: boolean;
|
|
6
4
|
}
|
|
7
|
-
|
|
8
|
-
payload: Payload;
|
|
9
|
-
expiresAt: number | null;
|
|
10
|
-
}
|
|
11
|
-
export declare const fetchAndSolveChallenge: (fetchUrl: string) => Promise<SolvedEntry | undefined>;
|
|
12
|
-
/**
|
|
13
|
-
* Manages the PoW captcha lifecycle for /run/* API requests.
|
|
14
|
-
*
|
|
15
|
-
* - getCaptchaHeader(): atomically consumes the current pre-fetched challenge,
|
|
16
|
-
* immediately kicks off the next fetch so a fresh solution is always warm, and
|
|
17
|
-
* returns the ready-to-use `{ 'x-inkeep-challenge-solution': '...' }` header
|
|
18
|
-
* (or {} when bypassing or on failure). Checks token expiry and falls back to
|
|
19
|
-
* the already-started pre-fetch if the resolved token is stale.
|
|
20
|
-
*
|
|
21
|
-
* - invalidate(): discards any in-flight solution and starts a fresh fetch.
|
|
22
|
-
* Call this on request errors to recover from a rejected/stale challenge.
|
|
23
|
-
*
|
|
24
|
-
* All hooks are called unconditionally — bypass logic lives inside callbacks.
|
|
25
|
-
*/
|
|
26
|
-
export declare const useCaptcha: ({ baseUrl, shouldBypassCaptcha, shouldMakeInitialRequest, }: UseCaptchaOptions) => {
|
|
5
|
+
export declare const useCaptcha: ({ baseUrl, shouldBypassCaptcha }: UseCaptchaOptions) => {
|
|
27
6
|
getCaptchaHeader: () => Promise<Record<string, string>>;
|
|
28
7
|
invalidate: () => void;
|
|
29
8
|
};
|
|
@@ -1,67 +1,88 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function E(
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { useRef as g, useCallback as f, useEffect as v } from "react";
|
|
3
|
+
const m = "[sentinel]", p = "https://cdn.jsdelivr.net/npm/altcha@3.0.9/dist/main/altcha.min.js", w = "sha384-SAvZpYmIwEwxkbER1dijvBKm10sobAn/28KXy+Z7/lGbsCshTPhYrFJ2kU7LKiFM", y = 1e4;
|
|
4
|
+
let d = null;
|
|
5
|
+
function E() {
|
|
6
|
+
if (typeof customElements > "u" || customElements.get("altcha-widget")) return Promise.resolve();
|
|
7
|
+
if (d) return d;
|
|
8
|
+
const c = (r) => (e) => {
|
|
9
|
+
d = null, r(e);
|
|
10
|
+
};
|
|
11
|
+
return d = new Promise((r, e) => {
|
|
12
|
+
const t = c(e);
|
|
13
|
+
if (document.querySelector(
|
|
14
|
+
`script[src="${p}"]`
|
|
15
|
+
)) {
|
|
16
|
+
customElements.whenDefined("altcha-widget").then(() => r()).catch(t);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const n = document.createElement("script");
|
|
20
|
+
n.src = p, n.integrity = w, n.crossOrigin = "anonymous", n.type = "module", n.async = !0, n.onload = () => {
|
|
21
|
+
customElements.whenDefined("altcha-widget").then(() => r()).catch(() => t(new Error("altcha-widget custom element never registered")));
|
|
22
|
+
}, n.onerror = () => {
|
|
23
|
+
console.error(m, "failed to load widget script"), t(new Error("Failed to load altcha-widget script"));
|
|
24
|
+
}, document.head.appendChild(n);
|
|
25
|
+
}), d;
|
|
8
26
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}, k = ({
|
|
31
|
-
baseUrl: i,
|
|
32
|
-
shouldBypassCaptcha: e = !1,
|
|
33
|
-
shouldMakeInitialRequest: c = !0
|
|
34
|
-
}) => {
|
|
35
|
-
const s = `${i}/run/auth/pow/challenge`, t = p(null), r = p(null), n = h(() => {
|
|
36
|
-
const o = y(s);
|
|
37
|
-
t.current = o, o.then((l) => {
|
|
38
|
-
l && (r.current = l.expiresAt);
|
|
39
|
-
});
|
|
40
|
-
}, [s]), g = h(async () => {
|
|
41
|
-
if (e) return {};
|
|
42
|
-
t.current || n();
|
|
43
|
-
const o = t.current;
|
|
44
|
-
t.current = null, n();
|
|
45
|
-
const l = t.current, f = await o;
|
|
46
|
-
if (!f) {
|
|
47
|
-
const a = await l;
|
|
48
|
-
return a ? { "x-inkeep-challenge-solution": btoa(JSON.stringify(a.payload)) } : {};
|
|
27
|
+
function P(c) {
|
|
28
|
+
const r = document.createElement("div");
|
|
29
|
+
r.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;pointer-events:none", document.body.appendChild(r);
|
|
30
|
+
const e = document.createElement("altcha-widget");
|
|
31
|
+
e.setAttribute("challenge", c), e.setAttribute("auto", "onload"), e.setAttribute("hidefooter", "true"), e.setAttribute("hidelogo", "true"), r.appendChild(e);
|
|
32
|
+
let t = null, i, n = "mounted", u = !1, o = !1;
|
|
33
|
+
const a = () => {
|
|
34
|
+
u || (i = void 0, n = "resetting", e.reset?.(), e.verify?.());
|
|
35
|
+
}, h = (l) => {
|
|
36
|
+
const s = l.detail;
|
|
37
|
+
s && (n = s.state ?? n, s.state === "verified" && s.payload && (o = !0, i = s.payload, t && (t(s.payload), t = null)), s.state === "error" && (i = void 0, t && (t(void 0), t = null), o || (u = !0, console.warn(
|
|
38
|
+
m,
|
|
39
|
+
"Sentinel unavailable, requests will proceed without bot protection"
|
|
40
|
+
))));
|
|
41
|
+
};
|
|
42
|
+
return e.addEventListener("statechange", h), { getPayload: () => {
|
|
43
|
+
if (u) return Promise.resolve(void 0);
|
|
44
|
+
if (i) {
|
|
45
|
+
const l = i;
|
|
46
|
+
return i = void 0, a(), Promise.resolve(l);
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
return n === "verified" && a(), new Promise((l) => {
|
|
49
|
+
t = l, setTimeout(() => {
|
|
50
|
+
t === l && (t = null, l(void 0));
|
|
51
|
+
}, y);
|
|
52
|
+
});
|
|
53
|
+
}, startNextSolve: a, destroy: () => {
|
|
54
|
+
e.removeEventListener("statechange", h), t = null, r.remove();
|
|
55
|
+
} };
|
|
56
|
+
}
|
|
57
|
+
const b = ({ baseUrl: c, shouldBypassCaptcha: r = !1 }) => {
|
|
58
|
+
const e = g(null), t = g(null), i = f(() => e.current ? Promise.resolve() : (t.current || (t.current = E().then(() => {
|
|
59
|
+
if (!e.current) {
|
|
60
|
+
const o = `${c}/run/auth/sentinel/challenge`;
|
|
61
|
+
e.current = P(o);
|
|
53
62
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
+
}).catch((o) => {
|
|
64
|
+
console.error(m, "failed to mount widget", o), t.current = null;
|
|
65
|
+
})), t.current), [c]);
|
|
66
|
+
v(() => {
|
|
67
|
+
if (!r)
|
|
68
|
+
return i(), () => {
|
|
69
|
+
e.current?.destroy(), e.current = null, t.current = null;
|
|
70
|
+
};
|
|
71
|
+
}, [r, i]);
|
|
72
|
+
const n = f(async () => {
|
|
73
|
+
if (r) return {};
|
|
74
|
+
await i();
|
|
75
|
+
const o = e.current;
|
|
76
|
+
if (!o) return {};
|
|
77
|
+
const a = await o.getPayload();
|
|
78
|
+
return a ? {
|
|
79
|
+
"x-inkeep-challenge-solution": btoa(JSON.stringify({ payload: a }))
|
|
80
|
+
} : {};
|
|
81
|
+
}, [r, i]), u = f(() => {
|
|
82
|
+
e.current?.startNextSolve();
|
|
83
|
+
}, []);
|
|
84
|
+
return { getCaptchaHeader: n, invalidate: u };
|
|
63
85
|
};
|
|
64
86
|
export {
|
|
65
|
-
|
|
66
|
-
k as useCaptcha
|
|
87
|
+
b as useCaptcha
|
|
67
88
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("@ai-sdk/react"),Xe=require("./file-upload-input.cjs"),Ye=require("ai"),t=require("react"),et=require("../../providers/config-provider.cjs"),tt=require("../../providers/chat-auth-provider.cjs"),st=require("../../hooks/use-media-query.cjs"),rt=require("../../hooks/use-conversation-loader.cjs"),nt=require("../../hooks/use-initial-conversation.cjs"),
|
|
2
|
-
`)??"";t.useEffect(()=>{
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("@ai-sdk/react"),Xe=require("./file-upload-input.cjs"),Ye=require("ai"),t=require("react"),et=require("../../providers/config-provider.cjs"),tt=require("../../providers/chat-auth-provider.cjs"),st=require("../../hooks/use-media-query.cjs"),rt=require("../../hooks/use-conversation-loader.cjs"),nt=require("../../hooks/use-initial-conversation.cjs"),k=require("../../utils/generate-uid.cjs"),at=require("../../providers/base-events-provider.cjs"),ot=require("../../providers/chat-form-provider.cjs"),it=require("../../providers/widget-provider.cjs"),ct=require("@radix-ui/react-use-controllable-state"),ut=require("../../hooks/use-streaming-events.cjs"),lt=require("../../hooks/use-input-notification.cjs"),p=require("./chat-error-helpers.cjs"),dt=()=>{const{baseSettings:se,aiChatSettings:E}=et.useInkeepConfig(),[c="",m]=ct.useControllableState({prop:E.conversationIdOverride,defaultProp:E.conversationIdOverride??""}),{logEvent:h}=at.useBaseEvents(),{setConversationId:ke,emitToParent:F}=ut.useStreamingEvents(),re=t.useRef(c);t.useEffect(()=>{const e=re.current;re.current=c,e!==c&&h({eventName:"chat_conversation_changed",properties:{conversationId:c,previousConversationId:e}})},[c,h]);const[S,C]=t.useState(""),Fe=e=>C(e.target.value),{shouldBypassCaptcha:_e,filters:ne,userProperties:N,analyticsProperties:O}=se,{authToken:ae,isAuthenticated:v,isAuthConfigured:oe,refreshAuthToken:ie,sessionToken:ce,refreshSession:ue,getCaptchaHeader:_,invalidateCaptcha:d,effectiveAuthToken:le,applicableRefreshSession:Pe}=tt.useChatAuth(),{onInputMessageChange:xe,filters:de,baseUrl:pe,agentUrl:qe,context:fe,headers:ge,appId:P,apiKey:U,files:I}=E,he=t.useRef(_);he.current=_;const me=qe||`${pe}/run/api/chat`,{loadConversation:ve}=rt.useConversationLoader({baseUrl:pe,appId:P,authToken:le,getCaptchaHeader:_,invalidateCaptcha:d,refreshSession:Pe}),[Le,ye]=t.useState(!1),D=t.useRef(null);D.current=ce;const $=t.useRef(null);$.current=ae;const B=t.useRef(void 0);B.current=N&&Object.keys(N).length>0?N:void 0;const G=t.useRef(void 0);G.current=O&&Object.keys(O).length>0?O:void 0;const y=t.useRef(0),H=t.useRef(null),K=t.useRef(null),R=t.useRef(void 0),Ne=I?.map(e=>`${e.filename??""}:${e.mediaType}:${e.url.length}:${e.url.slice(0,64)}:${e.url.slice(-32)}`).join(`
|
|
2
|
+
`)??"";t.useEffect(()=>{R.current=I?.length?I:void 0},[Ne]);const Re=t.useRef(ge);Re.current=ge;const z=t.useRef(void 0);z.current=ne||de?JSON.stringify({...ne,...de}):void 0;const Oe=e=>{switch(p.resolveHttpStatusCode(e)){case 400:try{const s=JSON.parse(e.message??"");return s.detail??s.error?.message??p.RECOVERABLE_FALLBACK_MESSAGE}catch{return e.message?.trim()||p.RECOVERABLE_FALLBACK_MESSAGE}case 401:return oe?"Authentication failed. Please try again.":p.DEFAULT_ERROR_MESSAGE;case 403:return`There seems to be a configuration error. Please contact ${se.organizationDisplayName??"Administrator"}`;case 429:return p.RATE_LIMIT_MESSAGE;default:return p.DEFAULT_ERROR_MESSAGE}},[A,j]=t.useState([]),Ue=t.useMemo(()=>new Ye.DefaultChatTransport({api:me,headers:()=>{const e=U??$.current??D.current;return{"x-inkeep-client-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone,"x-inkeep-client-timestamp":new Date().toISOString(),"x-inkeep-invocation-type":"chat_widget",...P?{"x-inkeep-app-id":P}:{},...e?{Authorization:`Bearer ${e}`}:{},...z.current?{"inkeep-filters":z.current}:{},...Re.current}},prepareSendMessagesRequest:async e=>{const a=await he.current(),s=e.messages[e.messages.length-1];return s||console.warn("[useInkeepChat] prepareSendMessagesRequest called with empty messages array"),{body:{...e.body,id:e.id,messages:s?[s]:[],trigger:e.trigger,messageId:e.messageId,...B.current?{userProperties:B.current}:{},...G.current?{properties:G.current}:{}},headers:{...e.headers,...a}}},body:{requestContext:fe}}),[me,fe,P,U]),{messages:b,sendMessage:V,addToolApprovalResponse:J,status:Ee,setMessages:f,stop:x,error:q}=Ze.useChat({transport:Ue,onData(e){F(e.type,e.data)},async onFinish({message:e}){F("completion",{conversationId:c}),await h({eventName:"assistant_message_received",properties:{conversationId:c,messageId:e.id}}),h({eventName:"assistant_answer_displayed",properties:{conversationId:c,messageId:e.id}})},onError(e){console.error("onError",{code:e.code,message:e.message});const a=_e||U?null:p.resolveStreamingAuthError(e);if(a!==null&&y.current<1){y.current++;const n=K.current,r=H.current;(async()=>{if(a==="session"&&oe){const l=await ie();if(!l)throw new Error("Auth token refresh failed");$.current=l}else if(a==="session"){const l=await ue();l&&(D.current=l)}else d();if(n){J(n);return}r&&(f(l=>{let o=[...l];return o.at(-1)?.role==="assistant"&&(o=o.slice(0,-1)),o.at(-1)?.role==="user"&&(o=o.slice(0,-1)),o}),V({id:r.messageId,parts:[...r.content.trim()?[{type:"text",text:r.content}]:[],...r.files??[]]},{body:r.body}))})().catch(()=>{y.current=0,d(),f(l=>{const o=[...l],g=o[o.length-1];if(!g)return o;const L=p.DEFAULT_ERROR_MESSAGE;return g.role==="user"?o.push({id:k.generateUid(16),role:"assistant",parts:[{type:"text",text:L}]}):g.parts=[{type:"text",text:L}],o})});return}y.current=0,a!==null&&d();const s=p.isRecoverableError(e),u=Oe(e);if(h({eventName:"chat_error",properties:{conversationId:c,messageId:b.at(-1)?.id,error:e.message}}),s){Y({title:"Request failed",message:u},p.RECOVERABLE_NOTIFICATION_DURATION_MS),f(r=>{let i=[...r];return i.at(-1)?.role==="assistant"&&(i=i.slice(0,-1)),i.at(-1)?.role==="user"&&(i=i.slice(0,-1)),i});const n=H.current?.content;n&&C(n),X.current=e;return}f(n=>{const r=[...n],i=r[r.length-1];return i&&(i.role==="user"?r.push({id:k.generateUid(16),role:"assistant",parts:[{type:"text",text:u}]}):i.parts=[{type:"text",text:u}]),r})}}),Se=t.useRef(v);t.useEffect(()=>{const e=Se.current;Se.current=v,e!==v&&(x(),w(null),f([]),m(""),C(""),j([]),d())},[v,x,f,m,d]);const Ce=Ee==="submitted",Q=Ee==="streaming",De=t.useMemo(()=>{const e=n=>{if(!n||typeof n!="object")return!1;const r=n;return typeof r.type=="string"&&r.type.startsWith("tool-")},s=[...b??[]].reverse().find(n=>n.role==="assistant");if(!s)return!1;const u=s.parts?.at(-1);return!(!e(u)||u.state!=="output-available"||!u.approval?.id||Q)},[b,Q]),[$e,W]=t.useState(!1),Ie=Q||De&&!$e,Ae=Ce||Ie,Be=b.length===0,Z=!S.trim()&&A.length===0||Ae,Ge=st.useMediaQuery("(max-width: 768px)"),[He,w]=t.useState(null),X=t.useRef(null);t.useEffect(()=>{if(q){if(X.current===q){X.current=null;return}w(q)}},[q]);const Ke=()=>w(null),{inputNotification:ze,showInputNotification:Y,clearInputNotification:je}=lt.useInputNotification(),be=t.useRef(null);t.useEffect(()=>{xe?.(S)},[S]);const Ve=e=>{e.key==="Enter"&&!e.shiftKey&&!Z&&!e.nativeEvent.isComposing&&(e.preventDefault(),ee())},ee=async(e=S)=>{if(Z&&(!e||e.trim().length===0)&&A.length===0||!e.trim()&&!A.length&&!R.current?.length)return;const a=A;j([]),C(""),y.current=0,K.current=null,W(!1);let s=c;s||(s=`conv_${k.generateUid(16)}`,m(s));const u=k.generateUid(21);ke(s),await h({eventName:"user_message_submitted",properties:{conversationId:s,messageId:u}});const n=R.current;R.current=void 0;let r=[];if(a.length>0)try{r=await Promise.all(a.map(o=>{const g=Xe.normalizeFileType(o);return new Promise((L,Te)=>{const T=new FileReader;T.onload=()=>{if(typeof T.result!="string"){Te(new Error(`Failed to read file "${g.name}"`));return}L({type:"file",url:T.result,mediaType:g.type,filename:g.name})},T.onerror=()=>Te(new Error(`Failed to read file "${g.name}"`)),T.readAsDataURL(g)})}))}catch{Y({title:"Failed to attach files",message:"Could not read one or more files. Please try again."});return}const i=r.length||n?.length?[...r,...n??[]]:void 0,l=[...e.trim()?[{type:"text",text:e}]:[],...i??[]];H.current={content:e,messageId:u,body:{conversationId:s},files:i},V({id:u,parts:l},{body:{conversationId:s}})},Je=t.useCallback(e=>{y.current=0,K.current=e,W(!1),J(e)},[J]),te=t.useCallback(()=>{W(!0),x().then(()=>{F("aborted",{conversationId:c})})},[x,c,F]),we=()=>{Ke(),f([]),m(""),d(),R.current=I?.length?I:void 0,h({eventName:"chat_clear_button_clicked",properties:{conversationId:c}})},M=t.useCallback((e,a)=>{w(null),f(a),m(e),d(),R.current=void 0},[f,m,d]),Me=t.useCallback(async(e,a)=>{te(),M(e,[]),ye(!0);try{const s=await ve(e,a);if(s===null)return!1;const n=s[s.length-1]?.role==="user"?[...s,{id:k.generateUid(16),role:"assistant",parts:[{type:"text",text:"This session was interrupted. Please check back in a few minutes or start a new conversation."}]}]:s;return M(e,n),!0}finally{a?.aborted||ye(!1)}},[M,ve,te]);nt.useInitialConversation({conversationId:E.conversationId,effectiveAuthToken:le,loadAndRestoreSession:Me,onLoadFailed:()=>M("",[])});const{openForm:Qe}=ot.useChatForm(),We=it.useWidget();return t.useImperativeHandle(E.chatFunctionsRef,()=>({submitMessage:ee,updateInputMessage(e){C(e)},clearChat:we,openForm:e=>{We?.setView("chat"),Qe(e,void 0)},focusInput:()=>{be.current?.focus()}})),{messages:b,sendMessage:V,addToolApprovalResponse:Je,isLoading:Ce,isStreaming:Ie,isBusy:Ae,error:He,setError:w,isSubmitDisabled:Z,input:S,handleInputChange:Fe,handleInputKeyDown:Ve,handleSubmit:ee,stop:te,clear:we,inputRef:be,isMobile:Ge,files:A,setFiles:j,isNewChat:Be,conversationId:c,restoreSession:M,loadAndRestoreSession:Me,isSessionLoading:Le,authToken:v?ae:ce,refreshSession:v?ie:ue,getCaptchaHeader:_,invalidateCaptcha:d,inputNotification:ze,showInputNotification:Y,clearInputNotification:je}};exports.useInkeepChat=dt;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { useChat as st } from "@ai-sdk/react";
|
|
3
3
|
import { normalizeFileType as rt } from "./file-upload-input.js";
|
|
4
4
|
import { DefaultChatTransport as nt } from "ai";
|
|
5
|
-
import { useRef as i, useEffect as
|
|
5
|
+
import { useRef as i, useEffect as M, useState as k, useMemo as _e, useCallback as L, useImperativeHandle as ot } from "react";
|
|
6
6
|
import { useInkeepConfig as at } from "../../providers/config-provider.js";
|
|
7
7
|
import { useChatAuth as it } from "../../providers/chat-auth-provider.js";
|
|
8
8
|
import { useMediaQuery as ct } from "../../hooks/use-media-query.js";
|
|
9
9
|
import { useConversationLoader as lt } from "../../hooks/use-conversation-loader.js";
|
|
10
10
|
import { useInitialConversation as ut } from "../../hooks/use-initial-conversation.js";
|
|
11
|
-
import { generateUid as
|
|
11
|
+
import { generateUid as F } from "../../utils/generate-uid.js";
|
|
12
12
|
import { useBaseEvents as pt } from "../../providers/base-events-provider.js";
|
|
13
13
|
import { useChatForm as dt } from "../../providers/chat-form-provider.js";
|
|
14
14
|
import { useWidget as ft } from "../../providers/widget-provider.js";
|
|
@@ -17,11 +17,11 @@ import { useStreamingEvents as gt } from "../../hooks/use-streaming-events.js";
|
|
|
17
17
|
import { useInputNotification as ht } from "../../hooks/use-input-notification.js";
|
|
18
18
|
import { resolveStreamingAuthError as vt, DEFAULT_ERROR_MESSAGE as ne, isRecoverableError as yt, RECOVERABLE_NOTIFICATION_DURATION_MS as It, resolveHttpStatusCode as Ct, RATE_LIMIT_MESSAGE as Rt, RECOVERABLE_FALLBACK_MESSAGE as Ne } from "./chat-error-helpers.js";
|
|
19
19
|
const Bt = () => {
|
|
20
|
-
const { baseSettings: oe, aiChatSettings:
|
|
21
|
-
prop:
|
|
22
|
-
defaultProp:
|
|
23
|
-
}), { logEvent: m } = pt(), { setConversationId: Pe, emitToParent:
|
|
24
|
-
|
|
20
|
+
const { baseSettings: oe, aiChatSettings: I } = at(), [c = "", g] = mt({
|
|
21
|
+
prop: I.conversationIdOverride,
|
|
22
|
+
defaultProp: I.conversationIdOverride ?? ""
|
|
23
|
+
}), { logEvent: m } = pt(), { setConversationId: Pe, emitToParent: x } = gt(), ae = i(c);
|
|
24
|
+
M(() => {
|
|
25
25
|
const e = ae.current;
|
|
26
26
|
ae.current = c, e !== c && m({
|
|
27
27
|
eventName: "chat_conversation_changed",
|
|
@@ -31,7 +31,7 @@ const Bt = () => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
}, [c, m]);
|
|
34
|
-
const [
|
|
34
|
+
const [C, R] = k(""), Oe = (e) => R(e.target.value), {
|
|
35
35
|
shouldBypassCaptcha: De,
|
|
36
36
|
filters: ie,
|
|
37
37
|
userProperties: $,
|
|
@@ -43,7 +43,7 @@ const Bt = () => {
|
|
|
43
43
|
refreshAuthToken: ue,
|
|
44
44
|
sessionToken: pe,
|
|
45
45
|
refreshSession: de,
|
|
46
|
-
getCaptchaHeader:
|
|
46
|
+
getCaptchaHeader: _,
|
|
47
47
|
invalidateCaptcha: p,
|
|
48
48
|
effectiveAuthToken: fe,
|
|
49
49
|
applicableRefreshSession: Le
|
|
@@ -54,19 +54,19 @@ const Bt = () => {
|
|
|
54
54
|
agentUrl: Be,
|
|
55
55
|
context: he,
|
|
56
56
|
headers: ve,
|
|
57
|
-
appId:
|
|
57
|
+
appId: N,
|
|
58
58
|
apiKey: U,
|
|
59
|
-
files:
|
|
60
|
-
} =
|
|
61
|
-
ye.current =
|
|
59
|
+
files: S
|
|
60
|
+
} = I, ye = i(_);
|
|
61
|
+
ye.current = _;
|
|
62
62
|
const Ie = Be || `${ge}/run/api/chat`, { loadConversation: Ce } = lt({
|
|
63
63
|
baseUrl: ge,
|
|
64
|
-
appId:
|
|
64
|
+
appId: N,
|
|
65
65
|
authToken: fe,
|
|
66
|
-
getCaptchaHeader:
|
|
66
|
+
getCaptchaHeader: _,
|
|
67
67
|
invalidateCaptcha: p,
|
|
68
68
|
refreshSession: Le
|
|
69
|
-
}), [Ue, Re] =
|
|
69
|
+
}), [Ue, Re] = k(!1), z = i(null);
|
|
70
70
|
z.current = pe;
|
|
71
71
|
const H = i(null);
|
|
72
72
|
H.current = ce;
|
|
@@ -74,12 +74,12 @@ const Bt = () => {
|
|
|
74
74
|
K.current = $ && Object.keys($).length > 0 ? $ : void 0;
|
|
75
75
|
const q = i(void 0);
|
|
76
76
|
q.current = B && Object.keys(B).length > 0 ? B : void 0;
|
|
77
|
-
const v = i(0), j = i(null), G = i(null),
|
|
77
|
+
const v = i(0), j = i(null), G = i(null), y = i(void 0), ze = S?.map(
|
|
78
78
|
(e) => `${e.filename ?? ""}:${e.mediaType}:${e.url.length}:${e.url.slice(0, 64)}:${e.url.slice(-32)}`
|
|
79
79
|
).join(`
|
|
80
80
|
`) ?? "";
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
M(() => {
|
|
82
|
+
y.current = S?.length ? S : void 0;
|
|
83
83
|
}, [ze]);
|
|
84
84
|
const Se = i(ve);
|
|
85
85
|
Se.current = ve;
|
|
@@ -103,7 +103,7 @@ const Bt = () => {
|
|
|
103
103
|
default:
|
|
104
104
|
return ne;
|
|
105
105
|
}
|
|
106
|
-
}, [
|
|
106
|
+
}, [w, J] = k([]), Ke = _e(
|
|
107
107
|
() => new nt({
|
|
108
108
|
api: Ie,
|
|
109
109
|
headers: () => {
|
|
@@ -112,7 +112,7 @@ const Bt = () => {
|
|
|
112
112
|
"x-inkeep-client-timezone": Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
113
113
|
"x-inkeep-client-timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
114
114
|
"x-inkeep-invocation-type": "chat_widget",
|
|
115
|
-
...
|
|
115
|
+
...N ? { "x-inkeep-app-id": N } : {},
|
|
116
116
|
...e ? { Authorization: `Bearer ${e}` } : {},
|
|
117
117
|
...V.current ? { "inkeep-filters": V.current } : {},
|
|
118
118
|
...Se.current
|
|
@@ -142,9 +142,9 @@ const Bt = () => {
|
|
|
142
142
|
requestContext: he
|
|
143
143
|
}
|
|
144
144
|
}),
|
|
145
|
-
[Ie, he,
|
|
145
|
+
[Ie, he, N, U]
|
|
146
146
|
), {
|
|
147
|
-
messages:
|
|
147
|
+
messages: A,
|
|
148
148
|
sendMessage: W,
|
|
149
149
|
addToolApprovalResponse: Q,
|
|
150
150
|
status: we,
|
|
@@ -154,10 +154,10 @@ const Bt = () => {
|
|
|
154
154
|
} = st({
|
|
155
155
|
transport: Ke,
|
|
156
156
|
onData(e) {
|
|
157
|
-
|
|
157
|
+
x(e.type, e.data);
|
|
158
158
|
},
|
|
159
159
|
async onFinish({ message: e }) {
|
|
160
|
-
|
|
160
|
+
x("completion", { conversationId: c }), await m({
|
|
161
161
|
eventName: "assistant_message_received",
|
|
162
162
|
properties: {
|
|
163
163
|
conversationId: c,
|
|
@@ -198,7 +198,7 @@ const Bt = () => {
|
|
|
198
198
|
{
|
|
199
199
|
id: s.messageId,
|
|
200
200
|
parts: [
|
|
201
|
-
...s.content ? [{ type: "text", text: s.content }] : [],
|
|
201
|
+
...s.content.trim() ? [{ type: "text", text: s.content }] : [],
|
|
202
202
|
...s.files ?? []
|
|
203
203
|
]
|
|
204
204
|
},
|
|
@@ -210,7 +210,7 @@ const Bt = () => {
|
|
|
210
210
|
if (!f) return o;
|
|
211
211
|
const D = ne;
|
|
212
212
|
return f.role === "user" ? o.push({
|
|
213
|
-
id:
|
|
213
|
+
id: F(16),
|
|
214
214
|
role: "assistant",
|
|
215
215
|
parts: [{ type: "text", text: D }]
|
|
216
216
|
}) : f.parts = [{ type: "text", text: D }], o;
|
|
@@ -224,7 +224,7 @@ const Bt = () => {
|
|
|
224
224
|
eventName: "chat_error",
|
|
225
225
|
properties: {
|
|
226
226
|
conversationId: c,
|
|
227
|
-
messageId:
|
|
227
|
+
messageId: A.at(-1)?.id,
|
|
228
228
|
error: e.message
|
|
229
229
|
}
|
|
230
230
|
}), t) {
|
|
@@ -236,55 +236,56 @@ const Bt = () => {
|
|
|
236
236
|
return a.at(-1)?.role === "assistant" && (a = a.slice(0, -1)), a.at(-1)?.role === "user" && (a = a.slice(0, -1)), a;
|
|
237
237
|
});
|
|
238
238
|
const r = j.current?.content;
|
|
239
|
-
r &&
|
|
239
|
+
r && R(r), ee.current = e;
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
242
|
d((r) => {
|
|
243
243
|
const s = [...r], a = s[s.length - 1];
|
|
244
244
|
return a && (a.role === "user" ? s.push({
|
|
245
|
-
id:
|
|
245
|
+
id: F(16),
|
|
246
246
|
role: "assistant",
|
|
247
247
|
parts: [{ type: "text", text: l }]
|
|
248
248
|
}) : a.parts = [{ type: "text", text: l }]), s;
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
}), Ae = i(h);
|
|
252
|
-
|
|
252
|
+
M(() => {
|
|
253
253
|
const e = Ae.current;
|
|
254
|
-
Ae.current = h, e !== h && (P(),
|
|
254
|
+
Ae.current = h, e !== h && (P(), b(null), d([]), g(""), R(""), J([]), p());
|
|
255
255
|
}, [h, P, d, g, p]);
|
|
256
256
|
const be = we === "submitted", Z = we === "streaming", qe = _e(() => {
|
|
257
257
|
const e = (r) => {
|
|
258
258
|
if (!r || typeof r != "object") return !1;
|
|
259
259
|
const s = r;
|
|
260
260
|
return typeof s.type == "string" && s.type.startsWith("tool-");
|
|
261
|
-
}, t = [...
|
|
261
|
+
}, t = [...A ?? []].reverse().find((r) => r.role === "assistant");
|
|
262
262
|
if (!t) return !1;
|
|
263
263
|
const l = t.parts?.at(-1);
|
|
264
264
|
return !(!e(l) || l.state !== "output-available" || !l.approval?.id || Z);
|
|
265
|
-
}, [
|
|
266
|
-
|
|
265
|
+
}, [A, Z]), [je, X] = k(!1), Ee = Z || qe && !je, Te = be || Ee, Ge = A.length === 0, Y = !C.trim() && w.length === 0 || Te, Ve = ct("(max-width: 768px)"), [Je, b] = k(null), ee = i(null);
|
|
266
|
+
M(() => {
|
|
267
267
|
if (O) {
|
|
268
268
|
if (ee.current === O) {
|
|
269
269
|
ee.current = null;
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
b(O);
|
|
273
273
|
}
|
|
274
274
|
}, [O]);
|
|
275
|
-
const We = () =>
|
|
276
|
-
|
|
277
|
-
$e?.(
|
|
278
|
-
}, [
|
|
275
|
+
const We = () => b(null), { inputNotification: Qe, showInputNotification: te, clearInputNotification: Ze } = ht(), Me = i(null);
|
|
276
|
+
M(() => {
|
|
277
|
+
$e?.(C);
|
|
278
|
+
}, [C]);
|
|
279
279
|
const Xe = (e) => {
|
|
280
280
|
e.key === "Enter" && !e.shiftKey && !Y && !e.nativeEvent.isComposing && (e.preventDefault(), se());
|
|
281
|
-
}, se = async (e =
|
|
282
|
-
if (Y && (!e || e.trim().length === 0) &&
|
|
283
|
-
|
|
284
|
-
|
|
281
|
+
}, se = async (e = C) => {
|
|
282
|
+
if (Y && (!e || e.trim().length === 0) && w.length === 0 || !e.trim() && !w.length && !y.current?.length)
|
|
283
|
+
return;
|
|
284
|
+
const n = w;
|
|
285
|
+
J([]), R(""), v.current = 0, G.current = null, X(!1);
|
|
285
286
|
let t = c;
|
|
286
|
-
t || (t = `conv_${
|
|
287
|
-
const l =
|
|
287
|
+
t || (t = `conv_${F(16)}`, g(t));
|
|
288
|
+
const l = F(21);
|
|
288
289
|
Pe(t), await m({
|
|
289
290
|
eventName: "user_message_submitted",
|
|
290
291
|
properties: {
|
|
@@ -292,8 +293,8 @@ const Bt = () => {
|
|
|
292
293
|
messageId: l
|
|
293
294
|
}
|
|
294
295
|
});
|
|
295
|
-
const r =
|
|
296
|
-
|
|
296
|
+
const r = y.current;
|
|
297
|
+
y.current = void 0;
|
|
297
298
|
let s = [];
|
|
298
299
|
if (n.length > 0)
|
|
299
300
|
try {
|
|
@@ -301,19 +302,19 @@ const Bt = () => {
|
|
|
301
302
|
n.map((o) => {
|
|
302
303
|
const f = rt(o);
|
|
303
304
|
return new Promise((D, xe) => {
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
if (typeof
|
|
305
|
+
const T = new FileReader();
|
|
306
|
+
T.onload = () => {
|
|
307
|
+
if (typeof T.result != "string") {
|
|
307
308
|
xe(new Error(`Failed to read file "${f.name}"`));
|
|
308
309
|
return;
|
|
309
310
|
}
|
|
310
311
|
D({
|
|
311
312
|
type: "file",
|
|
312
|
-
url:
|
|
313
|
+
url: T.result,
|
|
313
314
|
mediaType: f.type,
|
|
314
315
|
filename: f.name
|
|
315
316
|
});
|
|
316
|
-
},
|
|
317
|
+
}, T.onerror = () => xe(new Error(`Failed to read file "${f.name}"`)), T.readAsDataURL(f);
|
|
317
318
|
});
|
|
318
319
|
})
|
|
319
320
|
);
|
|
@@ -333,10 +334,7 @@ const Bt = () => {
|
|
|
333
334
|
messageId: l,
|
|
334
335
|
body: { conversationId: t },
|
|
335
336
|
files: a
|
|
336
|
-
}, W(
|
|
337
|
-
{ id: l, parts: u },
|
|
338
|
-
{ body: { conversationId: t } }
|
|
339
|
-
);
|
|
337
|
+
}, W({ id: l, parts: u }, { body: { conversationId: t } });
|
|
340
338
|
}, Ye = L(
|
|
341
339
|
(e) => {
|
|
342
340
|
v.current = 0, G.current = e, X(!1), Q(e);
|
|
@@ -344,30 +342,30 @@ const Bt = () => {
|
|
|
344
342
|
[Q]
|
|
345
343
|
), re = L(() => {
|
|
346
344
|
X(!0), P().then(() => {
|
|
347
|
-
|
|
345
|
+
x("aborted", { conversationId: c });
|
|
348
346
|
});
|
|
349
|
-
}, [P, c,
|
|
350
|
-
We(), d([]), g(""), p(),
|
|
347
|
+
}, [P, c, x]), ke = () => {
|
|
348
|
+
We(), d([]), g(""), p(), y.current = S?.length ? S : void 0, m({
|
|
351
349
|
eventName: "chat_clear_button_clicked",
|
|
352
350
|
properties: {
|
|
353
351
|
conversationId: c
|
|
354
352
|
}
|
|
355
353
|
});
|
|
356
|
-
},
|
|
354
|
+
}, E = L(
|
|
357
355
|
(e, n) => {
|
|
358
|
-
|
|
356
|
+
b(null), d(n), g(e), p(), y.current = void 0;
|
|
359
357
|
},
|
|
360
358
|
[d, g, p]
|
|
361
359
|
), Fe = L(
|
|
362
360
|
async (e, n) => {
|
|
363
|
-
re(),
|
|
361
|
+
re(), E(e, []), Re(!0);
|
|
364
362
|
try {
|
|
365
363
|
const t = await Ce(e, n);
|
|
366
364
|
if (t === null) return !1;
|
|
367
365
|
const r = t[t.length - 1]?.role === "user" ? [
|
|
368
366
|
...t,
|
|
369
367
|
{
|
|
370
|
-
id:
|
|
368
|
+
id: F(16),
|
|
371
369
|
role: "assistant",
|
|
372
370
|
parts: [
|
|
373
371
|
{
|
|
@@ -377,24 +375,24 @@ const Bt = () => {
|
|
|
377
375
|
]
|
|
378
376
|
}
|
|
379
377
|
] : t;
|
|
380
|
-
return
|
|
378
|
+
return E(e, r), !0;
|
|
381
379
|
} finally {
|
|
382
380
|
n?.aborted || Re(!1);
|
|
383
381
|
}
|
|
384
382
|
},
|
|
385
|
-
[
|
|
383
|
+
[E, Ce, re]
|
|
386
384
|
);
|
|
387
385
|
ut({
|
|
388
|
-
conversationId:
|
|
386
|
+
conversationId: I.conversationId,
|
|
389
387
|
effectiveAuthToken: fe,
|
|
390
388
|
loadAndRestoreSession: Fe,
|
|
391
|
-
onLoadFailed: () =>
|
|
389
|
+
onLoadFailed: () => E("", [])
|
|
392
390
|
});
|
|
393
391
|
const { openForm: et } = dt(), tt = ft();
|
|
394
|
-
return ot(
|
|
392
|
+
return ot(I.chatFunctionsRef, () => ({
|
|
395
393
|
submitMessage: se,
|
|
396
394
|
updateInputMessage(e) {
|
|
397
|
-
|
|
395
|
+
R(e);
|
|
398
396
|
},
|
|
399
397
|
clearChat: ke,
|
|
400
398
|
openForm: (e) => {
|
|
@@ -404,16 +402,16 @@ const Bt = () => {
|
|
|
404
402
|
Me.current?.focus();
|
|
405
403
|
}
|
|
406
404
|
})), {
|
|
407
|
-
messages:
|
|
405
|
+
messages: A,
|
|
408
406
|
sendMessage: W,
|
|
409
407
|
addToolApprovalResponse: Ye,
|
|
410
408
|
isLoading: be,
|
|
411
409
|
isStreaming: Ee,
|
|
412
410
|
isBusy: Te,
|
|
413
411
|
error: Je,
|
|
414
|
-
setError:
|
|
412
|
+
setError: b,
|
|
415
413
|
isSubmitDisabled: Y,
|
|
416
|
-
input:
|
|
414
|
+
input: C,
|
|
417
415
|
handleInputChange: Oe,
|
|
418
416
|
handleInputKeyDown: Xe,
|
|
419
417
|
handleSubmit: se,
|
|
@@ -421,16 +419,16 @@ const Bt = () => {
|
|
|
421
419
|
clear: ke,
|
|
422
420
|
inputRef: Me,
|
|
423
421
|
isMobile: Ve,
|
|
424
|
-
files:
|
|
422
|
+
files: w,
|
|
425
423
|
setFiles: J,
|
|
426
424
|
isNewChat: Ge,
|
|
427
425
|
conversationId: c,
|
|
428
|
-
restoreSession:
|
|
426
|
+
restoreSession: E,
|
|
429
427
|
loadAndRestoreSession: Fe,
|
|
430
428
|
isSessionLoading: Ue,
|
|
431
429
|
authToken: h ? ce : pe,
|
|
432
430
|
refreshSession: h ? ue : de,
|
|
433
|
-
getCaptchaHeader:
|
|
431
|
+
getCaptchaHeader: _,
|
|
434
432
|
invalidateCaptcha: p,
|
|
435
433
|
inputNotification: Qe,
|
|
436
434
|
showInputNotification: te,
|