mitra-interactions-sdk 1.0.61 → 1.0.62
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/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -925,6 +925,12 @@ interface MitraConfig {
|
|
|
925
925
|
integrationURL?: string;
|
|
926
926
|
/** URL da página de autenticação Mitra (ex: https://coder.mitralab.io/sdk-auth/) */
|
|
927
927
|
authUrl?: string;
|
|
928
|
+
/**
|
|
929
|
+
* URL do WebSocket do agente (Agent Chat). Opcional: em apps publicadas pela
|
|
930
|
+
* plataforma vem de window.__mitraEnv.agentWsUrl (build-proxy). Fora do browser
|
|
931
|
+
* (ex: MitraSDK em Node) passe aqui — config explícito tem prioridade sobre o window.
|
|
932
|
+
*/
|
|
933
|
+
agentWsUrl?: string;
|
|
928
934
|
/** ID do projeto (usado como fallback nos métodos de login e serviços) */
|
|
929
935
|
projectId?: number;
|
|
930
936
|
/** Callback chamado quando o token é renovado automaticamente (após 401/403). Recebe a nova sessão. */
|
package/dist/index.d.ts
CHANGED
|
@@ -925,6 +925,12 @@ interface MitraConfig {
|
|
|
925
925
|
integrationURL?: string;
|
|
926
926
|
/** URL da página de autenticação Mitra (ex: https://coder.mitralab.io/sdk-auth/) */
|
|
927
927
|
authUrl?: string;
|
|
928
|
+
/**
|
|
929
|
+
* URL do WebSocket do agente (Agent Chat). Opcional: em apps publicadas pela
|
|
930
|
+
* plataforma vem de window.__mitraEnv.agentWsUrl (build-proxy). Fora do browser
|
|
931
|
+
* (ex: MitraSDK em Node) passe aqui — config explícito tem prioridade sobre o window.
|
|
932
|
+
*/
|
|
933
|
+
agentWsUrl?: string;
|
|
928
934
|
/** ID do projeto (usado como fallback nos métodos de login e serviços) */
|
|
929
935
|
projectId?: number;
|
|
930
936
|
/** Callback chamado quando o token é renovado automaticamente (após 401/403). Recebe a nova sessão. */
|
package/dist/index.js
CHANGED
|
@@ -1358,11 +1358,13 @@ function resolveProjectId3(override) {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
function getWsUrl() {
|
|
1360
1360
|
var _a;
|
|
1361
|
+
const configured = getConfig().agentWsUrl;
|
|
1362
|
+
if (typeof configured === "string" && configured) return configured;
|
|
1361
1363
|
if (typeof window !== "undefined") {
|
|
1362
1364
|
const injected = (_a = window.__mitraEnv) == null ? void 0 : _a.agentWsUrl;
|
|
1363
1365
|
if (typeof injected === "string" && injected) return injected;
|
|
1364
1366
|
}
|
|
1365
|
-
throw new Error("Agent Chat:
|
|
1367
|
+
throw new Error("Agent Chat: agentWsUrl indispon\xEDvel. Passe em configureSdkMitra({ agentWsUrl }) ou rode em uma app publicada pelo Mitra (build-proxy injeta window.__mitraEnv.agentWsUrl).");
|
|
1366
1368
|
}
|
|
1367
1369
|
function connect() {
|
|
1368
1370
|
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
@@ -2038,6 +2040,7 @@ function readInjectedEnv() {
|
|
|
2038
2040
|
if (typeof env.apiBaseURL === "string" && env.apiBaseURL) out.baseURL = env.apiBaseURL;
|
|
2039
2041
|
if (typeof env.integrationURL === "string" && env.integrationURL) out.integrationURL = env.integrationURL;
|
|
2040
2042
|
if (typeof env.authUrl === "string" && env.authUrl) out.authUrl = env.authUrl;
|
|
2043
|
+
if (typeof env.agentWsUrl === "string" && env.agentWsUrl) out.agentWsUrl = env.agentWsUrl;
|
|
2041
2044
|
return out;
|
|
2042
2045
|
}
|
|
2043
2046
|
function configureSdkMitra(config = {}) {
|