@inkeep/agents-ui 0.0.0-dev-20260501182500 → 0.0.0-dev-20260501195414
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),w=require("../../node_modules/.pnpm/botid@1.5.11_next@16.2.4_@babel_core@7.29.0_@opentelemetry_api@1.9.1_react-dom@19.3.0-c_6ac35f5bf61166da3243b6cf36e09c95/node_modules/botid/dist/client/core/index.cjs"),I=require("./config-provider.cjs");function _(){const{baseSettings:f,aiChatSettings:b}=I.useInkeepConfig(),{shouldBypassCaptcha:l}=f,{baseUrl:
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),w=require("../../node_modules/.pnpm/botid@1.5.11_next@16.2.4_@babel_core@7.29.0_@opentelemetry_api@1.9.1_react-dom@19.3.0-c_6ac35f5bf61166da3243b6cf36e09c95/node_modules/botid/dist/client/core/index.cjs"),I=require("./config-provider.cjs");function _(){const{baseSettings:f,aiChatSettings:b}=I.useInkeepConfig(),{shouldBypassCaptcha:l}=f,{baseUrl:t,apiKey:d,botProtectionLevel:u}=b,h=g.useRef(!1);return g.useEffect(()=>{if(h.current||l||d||!t)return;if(typeof window<"u"&&!window.__INKEEP_FETCH_DEBUG__){window.__INKEEP_FETCH_DEBUG__=!0;const i=window.fetch;window.fetch=async function(e,s){let r;typeof e=="string"?r=e:e instanceof URL?r=e.toString():r=e.url;try{const o=new URL(r,location.href);if(o.pathname.startsWith("/run/")){const a=new Headers(s?.headers??(e instanceof Request?e.headers:void 0)),m=s?.method??(e instanceof Request?e.method:"GET");console.log("[botid-debug] fetch →",{url:o.toString(),method:m,locationOrigin:location.origin,targetOrigin:o.origin,sameOrigin:o.origin===location.origin,hasXIsHuman:a.has("x-is-human"),xIsHumanLength:a.get("x-is-human")?.length??null,xPath:a.get("x-path"),xMethod:a.get("x-method")});const c=await i.call(this,e,s);return console.log("[botid-debug] fetch ←",{url:o.toString(),status:c.status,statusText:c.statusText}),c}}catch{}return i.call(this,e,s)}}const n={checkLevel:u};try{console.log("[botid-debug] calling initBotId",{baseUrl:t,advancedOptions:n}),w.initBotId({protect:[{path:`${t}/run/auth/apps/*/anonymous-session`,method:"POST",advancedOptions:n},{path:`${t}/run/api/chat`,method:"POST",advancedOptions:n},{path:`${t}/run/v1/feedback`,method:"POST",advancedOptions:n}]}),h.current=!0,console.log("[botid-debug] initBotId returned successfully")}catch(i){console.warn("[botid-debug] initBotId threw",i)}},[t,d,l,u]),null}exports.BotIdInitializer=_;
|
|
@@ -3,61 +3,61 @@ import { useRef as w, useEffect as b } from "react";
|
|
|
3
3
|
import { initBotId as I } from "../../node_modules/.pnpm/botid@1.5.11_next@16.2.4_@babel_core@7.29.0_@opentelemetry_api@1.9.1_react-dom@19.3.0-c_6ac35f5bf61166da3243b6cf36e09c95/node_modules/botid/dist/client/core/index.js";
|
|
4
4
|
import { useInkeepConfig as _ } from "./config-provider.js";
|
|
5
5
|
function B() {
|
|
6
|
-
const { baseSettings: f, aiChatSettings: g } = _(), { shouldBypassCaptcha: l } = f, { baseUrl:
|
|
6
|
+
const { baseSettings: f, aiChatSettings: g } = _(), { shouldBypassCaptcha: l } = f, { baseUrl: e, apiKey: h, botProtectionLevel: d } = g, u = w(!1);
|
|
7
7
|
return b(() => {
|
|
8
|
-
if (u.current || l || h || !
|
|
8
|
+
if (u.current || l || h || !e) return;
|
|
9
9
|
if (typeof window < "u" && !window.__INKEEP_FETCH_DEBUG__) {
|
|
10
10
|
window.__INKEEP_FETCH_DEBUG__ = !0;
|
|
11
|
-
const
|
|
12
|
-
window.fetch = async function(t,
|
|
13
|
-
let
|
|
14
|
-
typeof t == "string" ?
|
|
11
|
+
const s = window.fetch;
|
|
12
|
+
window.fetch = async function(t, i) {
|
|
13
|
+
let r;
|
|
14
|
+
typeof t == "string" ? r = t : t instanceof URL ? r = t.toString() : r = t.url;
|
|
15
15
|
try {
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
), m =
|
|
16
|
+
const o = new URL(r, location.href);
|
|
17
|
+
if (o.pathname.startsWith("/run/")) {
|
|
18
|
+
const a = new Headers(
|
|
19
|
+
i?.headers ?? (t instanceof Request ? t.headers : void 0)
|
|
20
|
+
), m = i?.method ?? (t instanceof Request ? t.method : "GET");
|
|
21
21
|
console.log("[botid-debug] fetch →", {
|
|
22
|
-
url:
|
|
22
|
+
url: o.toString(),
|
|
23
23
|
method: m,
|
|
24
24
|
locationOrigin: location.origin,
|
|
25
|
-
targetOrigin:
|
|
26
|
-
sameOrigin:
|
|
27
|
-
hasXIsHuman:
|
|
28
|
-
xIsHumanLength:
|
|
29
|
-
xPath:
|
|
30
|
-
xMethod:
|
|
25
|
+
targetOrigin: o.origin,
|
|
26
|
+
sameOrigin: o.origin === location.origin,
|
|
27
|
+
hasXIsHuman: a.has("x-is-human"),
|
|
28
|
+
xIsHumanLength: a.get("x-is-human")?.length ?? null,
|
|
29
|
+
xPath: a.get("x-path"),
|
|
30
|
+
xMethod: a.get("x-method")
|
|
31
31
|
});
|
|
32
|
-
const c = await
|
|
32
|
+
const c = await s.call(this, t, i);
|
|
33
33
|
return console.log("[botid-debug] fetch ←", {
|
|
34
|
-
url:
|
|
34
|
+
url: o.toString(),
|
|
35
35
|
status: c.status,
|
|
36
36
|
statusText: c.statusText
|
|
37
37
|
}), c;
|
|
38
38
|
}
|
|
39
39
|
} catch {
|
|
40
40
|
}
|
|
41
|
-
return
|
|
41
|
+
return s.call(this, t, i);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const n = { checkLevel: d };
|
|
45
45
|
try {
|
|
46
|
-
console.log("[botid-debug] calling initBotId", { baseUrl:
|
|
46
|
+
console.log("[botid-debug] calling initBotId", { baseUrl: e, advancedOptions: n }), I({
|
|
47
47
|
protect: [
|
|
48
48
|
{
|
|
49
|
-
path:
|
|
49
|
+
path: `${e}/run/auth/apps/*/anonymous-session`,
|
|
50
50
|
method: "POST",
|
|
51
|
-
advancedOptions:
|
|
51
|
+
advancedOptions: n
|
|
52
52
|
},
|
|
53
|
-
{ path:
|
|
54
|
-
{ path:
|
|
53
|
+
{ path: `${e}/run/api/chat`, method: "POST", advancedOptions: n },
|
|
54
|
+
{ path: `${e}/run/v1/feedback`, method: "POST", advancedOptions: n }
|
|
55
55
|
]
|
|
56
56
|
}), u.current = !0, console.log("[botid-debug] initBotId returned successfully");
|
|
57
|
-
} catch (
|
|
58
|
-
console.warn("[botid-debug] initBotId threw",
|
|
57
|
+
} catch (s) {
|
|
58
|
+
console.warn("[botid-debug] initBotId threw", s);
|
|
59
59
|
}
|
|
60
|
-
}, [
|
|
60
|
+
}, [e, h, l, d]), null;
|
|
61
61
|
}
|
|
62
62
|
export {
|
|
63
63
|
B as BotIdInitializer
|