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