@opencx/widget-core 5.0.0-beta.1 → 5.0.0-beta.10
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.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1608 -901
- package/dist/index.js.map +1 -1
- package/dist/src/api/api-caller.d.ts +102 -3
- package/dist/src/api/api-caller.d.ts.map +1 -1
- package/dist/src/api/elicitation.d.ts +60 -0
- package/dist/src/api/elicitation.d.ts.map +1 -0
- package/dist/src/api/schema.d.ts +596 -41
- package/dist/src/api/schema.d.ts.map +1 -1
- package/dist/src/context/active-session-polling.ctx.d.ts +11 -1
- package/dist/src/context/active-session-polling.ctx.d.ts.map +1 -1
- package/dist/src/context/message.ctx.d.ts +25 -6
- package/dist/src/context/message.ctx.d.ts.map +1 -1
- package/dist/src/context/resolve-client-presentation.d.ts +5 -0
- package/dist/src/context/resolve-client-presentation.d.ts.map +1 -0
- package/dist/src/context/router.ctx.d.ts +8 -10
- package/dist/src/context/router.ctx.d.ts.map +1 -1
- package/dist/src/context/session.ctx.d.ts +18 -1
- package/dist/src/context/session.ctx.d.ts.map +1 -1
- package/dist/src/context/upload.ctx.d.ts +23 -0
- package/dist/src/context/upload.ctx.d.ts.map +1 -0
- package/dist/src/context/widget-agent.d.ts +4 -4
- package/dist/src/context/widget-agent.d.ts.map +1 -1
- package/dist/src/context/widget.ctx.d.ts +19 -6
- package/dist/src/context/widget.ctx.d.ts.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/translation/ar.d.ts.map +1 -1
- package/dist/src/translation/bg.d.ts.map +1 -1
- package/dist/src/translation/bn.d.ts.map +1 -1
- package/dist/src/translation/cs.d.ts.map +1 -1
- package/dist/src/translation/da.d.ts.map +1 -1
- package/dist/src/translation/de.d.ts.map +1 -1
- package/dist/src/translation/el.d.ts.map +1 -1
- package/dist/src/translation/en.d.ts.map +1 -1
- package/dist/src/translation/es.d.ts.map +1 -1
- package/dist/src/translation/et.d.ts.map +1 -1
- package/dist/src/translation/fi.d.ts.map +1 -1
- package/dist/src/translation/fil.d.ts.map +1 -1
- package/dist/src/translation/fr.d.ts.map +1 -1
- package/dist/src/translation/hi.d.ts.map +1 -1
- package/dist/src/translation/hr.d.ts.map +1 -1
- package/dist/src/translation/hu.d.ts.map +1 -1
- package/dist/src/translation/index.d.ts +24 -0
- package/dist/src/translation/index.d.ts.map +1 -1
- package/dist/src/translation/is.d.ts.map +1 -1
- package/dist/src/translation/it.d.ts.map +1 -1
- package/dist/src/translation/ja.d.ts.map +1 -1
- package/dist/src/translation/ko.d.ts.map +1 -1
- package/dist/src/translation/lb.d.ts.map +1 -1
- package/dist/src/translation/lt.d.ts.map +1 -1
- package/dist/src/translation/lv.d.ts.map +1 -1
- package/dist/src/translation/mt.d.ts.map +1 -1
- package/dist/src/translation/nb.d.ts.map +1 -1
- package/dist/src/translation/nl.d.ts.map +1 -1
- package/dist/src/translation/no.d.ts.map +1 -1
- package/dist/src/translation/pl.d.ts.map +1 -1
- package/dist/src/translation/pt.d.ts.map +1 -1
- package/dist/src/translation/ro.d.ts.map +1 -1
- package/dist/src/translation/ru.d.ts.map +1 -1
- package/dist/src/translation/sk.d.ts.map +1 -1
- package/dist/src/translation/sv.d.ts.map +1 -1
- package/dist/src/translation/th.d.ts.map +1 -1
- package/dist/src/translation/tr.d.ts.map +1 -1
- package/dist/src/translation/ur.d.ts.map +1 -1
- package/dist/src/translation/vi.d.ts.map +1 -1
- package/dist/src/translation/zh-cn.d.ts.map +1 -1
- package/dist/src/types/component-name.d.ts +1 -1
- package/dist/src/types/component-name.d.ts.map +1 -1
- package/dist/src/types/messages.d.ts +14 -1
- package/dist/src/types/messages.d.ts.map +1 -1
- package/dist/src/types/widget-config.d.ts +29 -6
- package/dist/src/types/widget-config.d.ts.map +1 -1
- package/package.json +6 -5
- package/dist/src/__tests__/api/agent-stream-parts.spec.d.ts +0 -2
- package/dist/src/__tests__/api/agent-stream-parts.spec.d.ts.map +0 -1
- package/dist/src/__tests__/api/dictation-mint-cache.spec.d.ts +0 -2
- package/dist/src/__tests__/api/dictation-mint-cache.spec.d.ts.map +0 -1
- package/dist/src/__tests__/api/widget-api-wire.spec.d.ts +0 -2
- package/dist/src/__tests__/api/widget-api-wire.spec.d.ts.map +0 -1
- package/dist/src/__tests__/api-caller.mock.d.ts +0 -2
- package/dist/src/__tests__/api-caller.mock.d.ts.map +0 -1
- package/dist/src/__tests__/context/contact/auth/auto-create-unverified-anonymous.spec.d.ts +0 -1
- package/dist/src/__tests__/context/contact/auth/auto-create-unverified-anonymous.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/contact/auth/auto-create-unverified-with-user-data-provided-by-org.spec.d.ts +0 -1
- package/dist/src/__tests__/context/contact/auth/auto-create-unverified-with-user-data-provided-by-org.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/contact/auth/manually-create-unverified-with-user-data-provided-by-user.spec.d.ts +0 -1
- package/dist/src/__tests__/context/contact/auth/manually-create-unverified-with-user-data-provided-by-user.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/contact/auth/with-secure-token.spec.d.ts +0 -1
- package/dist/src/__tests__/context/contact/auth/with-secure-token.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/contact/should-collect-data.spec.d.ts +0 -1
- package/dist/src/__tests__/context/contact/should-collect-data.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/contact-ctx.create-failure.spec.d.ts +0 -2
- package/dist/src/__tests__/context/contact-ctx.create-failure.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/dictation-ctx.spec.d.ts +0 -1
- package/dist/src/__tests__/context/dictation-ctx.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message/merge-send-context.spec.d.ts +0 -2
- package/dist/src/__tests__/context/message/merge-send-context.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message/on-message-received-hook.spec.d.ts +0 -1
- package/dist/src/__tests__/context/message/on-message-received-hook.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message/pending-user-messages.spec.d.ts +0 -1
- package/dist/src/__tests__/context/message/pending-user-messages.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message/sent-text-history.spec.d.ts +0 -1
- package/dist/src/__tests__/context/message/sent-text-history.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message-ctx.agent-handlers.spec.d.ts +0 -2
- package/dist/src/__tests__/context/message-ctx.agent-handlers.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message-ctx.client-context.spec.d.ts +0 -2
- package/dist/src/__tests__/context/message-ctx.client-context.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message-ctx.mentions.spec.d.ts +0 -2
- package/dist/src/__tests__/context/message-ctx.mentions.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message-ctx.page-mark-chips.spec.d.ts +0 -2
- package/dist/src/__tests__/context/message-ctx.page-mark-chips.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message-ctx.send-acceptance.spec.d.ts +0 -2
- package/dist/src/__tests__/context/message-ctx.send-acceptance.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/message-ctx.send-features.spec.d.ts +0 -2
- package/dist/src/__tests__/context/message-ctx.send-features.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/reconcile-after-stream.spec.d.ts +0 -1
- package/dist/src/__tests__/context/reconcile-after-stream.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/restore-last-session.spec.d.ts +0 -2
- package/dist/src/__tests__/context/restore-last-session.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/session-ctx.stale-token-retry.spec.d.ts +0 -2
- package/dist/src/__tests__/context/session-ctx.stale-token-retry.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/storage-ctx.spec.d.ts +0 -2
- package/dist/src/__tests__/context/storage-ctx.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/streaming-engine.spec.d.ts +0 -1
- package/dist/src/__tests__/context/streaming-engine.spec.d.ts.map +0 -1
- package/dist/src/__tests__/context/widget-ctx.features.spec.d.ts +0 -1
- package/dist/src/__tests__/context/widget-ctx.features.spec.d.ts.map +0 -1
- package/dist/src/__tests__/dictation/dictation-commands.utils.spec.d.ts +0 -2
- package/dist/src/__tests__/dictation/dictation-commands.utils.spec.d.ts.map +0 -1
- package/dist/src/__tests__/test-utils.d.ts +0 -448
- package/dist/src/__tests__/test-utils.d.ts.map +0 -1
- package/dist/src/__tests__/translation.spec.d.ts +0 -2
- package/dist/src/__tests__/translation.spec.d.ts.map +0 -1
- package/dist/src/__tests__/utils/Poller.spec.d.ts +0 -2
- package/dist/src/__tests__/utils/Poller.spec.d.ts.map +0 -1
- package/dist/src/__tests__/utils/PrimitiveState.spec.d.ts +0 -2
- package/dist/src/__tests__/utils/PrimitiveState.spec.d.ts.map +0 -1
- package/dist/src/__tests__/utils/companion-layout.spec.d.ts +0 -2
- package/dist/src/__tests__/utils/companion-layout.spec.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,174 +1,324 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { z as h } from "zod";
|
|
2
|
+
import se from "openapi-fetch";
|
|
3
|
+
import oe from "lodash.isequal";
|
|
4
|
+
import { v4 as N } from "uuid";
|
|
5
|
+
const Ga = (i) => i.type === "data-keepalive", $a = (i) => i.type === "data-turn-steered", F = h.object({ const: h.string(), title: h.string().optional() }), ne = h.object({
|
|
6
|
+
type: h.enum(["string", "number", "integer", "boolean", "array"]),
|
|
7
|
+
title: h.string().optional(),
|
|
8
|
+
description: h.string().optional(),
|
|
9
|
+
default: h.union([h.string(), h.number(), h.boolean(), h.array(h.string())]).optional(),
|
|
10
|
+
enum: h.array(h.string()).optional(),
|
|
11
|
+
oneOf: h.array(F).optional(),
|
|
12
|
+
items: h.object({
|
|
13
|
+
enum: h.array(h.string()).optional(),
|
|
14
|
+
anyOf: h.array(F).optional()
|
|
15
|
+
}).optional(),
|
|
16
|
+
minItems: h.number().int().nonnegative().optional(),
|
|
17
|
+
maxItems: h.number().int().nonnegative().optional(),
|
|
18
|
+
minimum: h.number().optional(),
|
|
19
|
+
maximum: h.number().optional(),
|
|
20
|
+
minLength: h.number().optional(),
|
|
21
|
+
maxLength: h.number().optional(),
|
|
22
|
+
format: h.string().optional()
|
|
23
|
+
}), ie = h.array(
|
|
24
|
+
h.object({
|
|
25
|
+
id: h.string(),
|
|
26
|
+
serverId: h.string(),
|
|
27
|
+
serverName: h.string(),
|
|
28
|
+
expiresAt: h.number(),
|
|
29
|
+
approvalKey: h.string().optional(),
|
|
30
|
+
form: h.object({
|
|
31
|
+
message: h.string(),
|
|
32
|
+
requestedSchema: h.object({
|
|
33
|
+
properties: h.record(h.string(), ne),
|
|
34
|
+
required: h.array(h.string()).optional()
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
), re = h.array(
|
|
39
|
+
h.object({
|
|
40
|
+
key: h.string(),
|
|
41
|
+
serverId: h.string(),
|
|
42
|
+
serverName: h.string(),
|
|
43
|
+
message: h.string(),
|
|
44
|
+
toolName: h.string()
|
|
45
|
+
})
|
|
46
|
+
), O = "[opencx]", k = {
|
|
5
47
|
warn: (i, ...e) => {
|
|
6
|
-
console.warn(`${
|
|
48
|
+
console.warn(`${O} ${i}`, ...e);
|
|
7
49
|
},
|
|
8
50
|
error: (i, ...e) => {
|
|
9
|
-
console.error(`${
|
|
51
|
+
console.error(`${O} ${i}`, ...e);
|
|
10
52
|
}
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
const e =
|
|
53
|
+
}, _e = (i) => {
|
|
54
|
+
k.error("request failed", i.error);
|
|
55
|
+
}, le = (i) => {
|
|
56
|
+
const e = se({
|
|
15
57
|
baseUrl: i.baseUrl
|
|
16
58
|
}), t = {
|
|
17
59
|
onRequest: i.onRequest,
|
|
18
60
|
onResponse: i.onResponse,
|
|
19
|
-
onError: i.onError ||
|
|
61
|
+
onError: i.onError || _e
|
|
20
62
|
};
|
|
21
63
|
return e.use(t), e;
|
|
22
|
-
}
|
|
23
|
-
class
|
|
64
|
+
};
|
|
65
|
+
class ce extends Error {
|
|
66
|
+
constructor() {
|
|
67
|
+
super("This connection request expired. Preparing a new request."), this.name = "ConnectionRequestExpiredError";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class pe extends Error {
|
|
71
|
+
constructor() {
|
|
72
|
+
super("This connection attempt is no longer available."), this.name = "ConnectionAttemptUnavailableError";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const de = "/backend/widget/v5/chat/stream", ue = "/backend/widget/v5/chat/{sessionId}/stream", U = (i, e, t) => `${i.replace(/\/$/, "")}${t ? e.replace("{sessionId}", encodeURIComponent(t)) : e}`;
|
|
76
|
+
class B {
|
|
24
77
|
constructor({ config: e }) {
|
|
25
|
-
var
|
|
26
|
-
this.userToken = null, this.constructClientOptions = (
|
|
27
|
-
const
|
|
78
|
+
var r, l;
|
|
79
|
+
this.userToken = null, this.constructClientOptions = (s) => {
|
|
80
|
+
const a = this.config.apiUrl || "https://api.open.cx", n = {
|
|
28
81
|
"X-Bot-Token": this.config.token,
|
|
29
82
|
"Content-Type": "application/json",
|
|
30
83
|
Accept: "application/json",
|
|
31
|
-
Authorization:
|
|
84
|
+
Authorization: s ? `Bearer ${s}` : void 0
|
|
32
85
|
};
|
|
33
|
-
return { baseUrl:
|
|
86
|
+
return { baseUrl: a, headers: n };
|
|
34
87
|
}, this.createOpenAPIClient = ({
|
|
35
|
-
baseUrl:
|
|
36
|
-
headers:
|
|
37
|
-
}) =>
|
|
38
|
-
baseUrl:
|
|
39
|
-
onRequest: ({ request:
|
|
40
|
-
Object.entries(
|
|
41
|
-
|
|
88
|
+
baseUrl: s,
|
|
89
|
+
headers: a
|
|
90
|
+
}) => le({
|
|
91
|
+
baseUrl: s,
|
|
92
|
+
onRequest: ({ request: n }) => {
|
|
93
|
+
Object.entries(a).forEach(([c, d]) => {
|
|
94
|
+
d && n.headers.set(c, d);
|
|
42
95
|
});
|
|
43
96
|
}
|
|
44
|
-
}), this.
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
97
|
+
}), this.listApprovalPreferences = async () => {
|
|
98
|
+
const { baseUrl: s, headers: a } = this.getStreamAuthContext(), n = await fetch(
|
|
99
|
+
`${s}/backend/widget/v5/connections/approval-preferences`,
|
|
100
|
+
{ headers: a }
|
|
101
|
+
);
|
|
102
|
+
if (!n.ok) throw new Error("Could not load permissions.");
|
|
103
|
+
return re.parse(await n.json());
|
|
104
|
+
}, this.revokeApprovalPreference = async (s, a) => {
|
|
105
|
+
const { baseUrl: n, headers: c } = this.getStreamAuthContext();
|
|
106
|
+
if (!(await fetch(
|
|
107
|
+
`${n}/backend/widget/v5/connections/${encodeURIComponent(s)}/approval-preferences/${encodeURIComponent(a)}`,
|
|
108
|
+
{ method: "DELETE", headers: c }
|
|
109
|
+
)).ok) throw new Error("Could not reset permission.");
|
|
110
|
+
}, this.listElicitations = async (s, a) => {
|
|
111
|
+
const { baseUrl: n, headers: c } = this.getStreamAuthContext(), d = await fetch(
|
|
112
|
+
`${n}/backend/widget/v5/connections/elicitation/${encodeURIComponent(s)}`,
|
|
113
|
+
{ headers: c, signal: a }
|
|
114
|
+
);
|
|
115
|
+
if (!d.ok) throw new Error("Could not load the request.");
|
|
116
|
+
return ie.parse(await d.json());
|
|
117
|
+
}, this.answerElicitation = async (s, a, n) => {
|
|
118
|
+
const { baseUrl: c, headers: d } = this.getStreamAuthContext(), _ = await fetch(
|
|
119
|
+
`${c}/backend/widget/v5/connections/elicitation/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,
|
|
120
|
+
{
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: { ...d, "Content-Type": "application/json" },
|
|
123
|
+
body: JSON.stringify(n)
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
if (!_.ok)
|
|
127
|
+
throw new Error(
|
|
128
|
+
_.status === 400 ? "Check your answers and try again." : "This request has ended. Ask the agent to try again."
|
|
129
|
+
);
|
|
130
|
+
}, this.listConnections = async (s) => {
|
|
131
|
+
const { data: a, error: n } = await this.client.GET(
|
|
132
|
+
"/backend/widget/v5/connections",
|
|
133
|
+
{ signal: s }
|
|
134
|
+
);
|
|
135
|
+
if (n || !a)
|
|
136
|
+
throw new Error("Could not load connections. Sign in and try again.");
|
|
137
|
+
return a;
|
|
138
|
+
}, this.startConnection = async (s, a, n) => {
|
|
139
|
+
const { data: c, error: d, response: _ } = await this.client.POST(
|
|
140
|
+
"/backend/widget/v5/connections/{serverId}/start",
|
|
141
|
+
{
|
|
142
|
+
params: { path: { serverId: s } },
|
|
143
|
+
body: { request_id: a },
|
|
144
|
+
signal: n
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
if (_.status === 410) throw new ce();
|
|
148
|
+
if (_.status === 404)
|
|
149
|
+
throw new Error("This connection request is no longer available.");
|
|
150
|
+
if (d || !c)
|
|
151
|
+
throw new Error("Could not start this connection. Please try again.");
|
|
152
|
+
return c;
|
|
153
|
+
}, this.getConnectionAttempt = async (s, a, n) => {
|
|
154
|
+
const { data: c, error: d, response: _ } = await this.client.GET(
|
|
155
|
+
"/backend/widget/v5/connections/{serverId}/attempts/{attemptId}",
|
|
156
|
+
{
|
|
157
|
+
params: { path: { serverId: s, attemptId: a } },
|
|
158
|
+
signal: n
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
if ([401, 403, 404].includes(_.status))
|
|
162
|
+
throw new pe();
|
|
163
|
+
if (d || !c)
|
|
164
|
+
throw new Error(`Could not check the connection (${_.status}).`);
|
|
165
|
+
return c.status;
|
|
166
|
+
}, this.disconnectConnection = async (s) => {
|
|
167
|
+
const { error: a } = await this.client.DELETE(
|
|
168
|
+
"/backend/widget/v5/connections/{serverId}",
|
|
169
|
+
{
|
|
170
|
+
params: { path: { serverId: s } }
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
if (a) throw new Error("Could not disconnect. Please try again.");
|
|
174
|
+
}, this.setAuthToken = (s) => {
|
|
175
|
+
this.userToken = s;
|
|
176
|
+
const { baseUrl: a, headers: n } = this.constructClientOptions(s);
|
|
177
|
+
this.client = this.createOpenAPIClient({ baseUrl: a, headers: n });
|
|
48
178
|
}, this.getStreamAuthContext = () => {
|
|
49
|
-
const { baseUrl:
|
|
50
|
-
for (const [
|
|
51
|
-
typeof
|
|
52
|
-
return { baseUrl:
|
|
179
|
+
const { baseUrl: s, headers: a } = this.constructClientOptions(this.userToken), n = {};
|
|
180
|
+
for (const [c, d] of Object.entries(a))
|
|
181
|
+
typeof d == "string" && (["content-type", "accept"].includes(c.toLowerCase()) || (n[c] = d));
|
|
182
|
+
return { baseUrl: s, headers: n };
|
|
53
183
|
}, this.getStreamTransportOptions = () => {
|
|
54
|
-
const { baseUrl:
|
|
184
|
+
const { baseUrl: s, headers: a } = this.getStreamAuthContext();
|
|
55
185
|
return {
|
|
56
|
-
api:
|
|
57
|
-
reconnectApi: (
|
|
58
|
-
headers:
|
|
186
|
+
api: U(s, de),
|
|
187
|
+
reconnectApi: (n) => U(s, ue, n),
|
|
188
|
+
headers: a
|
|
59
189
|
};
|
|
60
|
-
}, this.stopStream = async (
|
|
61
|
-
const { response:
|
|
190
|
+
}, this.stopStream = async (s) => {
|
|
191
|
+
const { response: a } = await this.client.POST(
|
|
62
192
|
"/backend/widget/v5/chat/{sessionId}/stop",
|
|
63
|
-
{ params: { path: { sessionId:
|
|
193
|
+
{ params: { path: { sessionId: s } } }
|
|
64
194
|
);
|
|
65
|
-
if (!
|
|
66
|
-
throw new Error(`Failed to stop stream: ${
|
|
67
|
-
}, this.
|
|
68
|
-
|
|
195
|
+
if (!a.ok)
|
|
196
|
+
throw new Error(`Failed to stop stream: ${a.status}`);
|
|
197
|
+
}, this.sendPageReply = async (s, a) => {
|
|
198
|
+
try {
|
|
199
|
+
await this.client.POST("/backend/widget/v5/chat/{sessionId}/page-reply", {
|
|
200
|
+
params: { path: { sessionId: s } },
|
|
201
|
+
body: a
|
|
202
|
+
});
|
|
203
|
+
} catch {
|
|
204
|
+
}
|
|
205
|
+
}, this.getAgentTurnMessages = async (s, a) => {
|
|
206
|
+
const { data: n, response: c } = await this.client.GET(
|
|
69
207
|
"/backend/widget/v5/chat/{sessionId}/messages",
|
|
70
|
-
{
|
|
208
|
+
{
|
|
209
|
+
params: {
|
|
210
|
+
path: { sessionId: s },
|
|
211
|
+
query: {
|
|
212
|
+
toolActivity: a == null ? void 0 : a.toolActivity,
|
|
213
|
+
reasoning: (a == null ? void 0 : a.reasoning) === void 0 ? void 0 : a.reasoning ? "true" : "false"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
71
217
|
);
|
|
72
|
-
return n
|
|
218
|
+
return n ? {
|
|
219
|
+
...n,
|
|
220
|
+
handled_connection_request_ids: n.handled_connection_request_ids ?? []
|
|
221
|
+
} : (k.warn("agent turn messages fetch failed", c.status), null);
|
|
73
222
|
}, this.createDictationSession = async ({
|
|
74
|
-
language:
|
|
223
|
+
language: s
|
|
75
224
|
}) => {
|
|
76
|
-
const { data:
|
|
225
|
+
const { data: a, response: n } = await this.client.POST(
|
|
77
226
|
"/backend/widget/v5/dictation/sessions",
|
|
78
|
-
{ body:
|
|
227
|
+
{ body: s ? { language: s } : {} }
|
|
79
228
|
);
|
|
80
|
-
if (!
|
|
81
|
-
throw new Error(`Failed to start dictation: ${
|
|
82
|
-
return
|
|
229
|
+
if (!a)
|
|
230
|
+
throw new Error(`Failed to start dictation: ${n.status}`);
|
|
231
|
+
return a;
|
|
83
232
|
}, this.getExternalWidgetConfig = async () => await this.client.GET("/backend/widget/v2/config", {
|
|
84
233
|
params: {
|
|
85
234
|
header: { "x-bot-token": this.config.token }
|
|
86
235
|
}
|
|
87
|
-
}), this.sendMessage = async (
|
|
88
|
-
body:
|
|
89
|
-
signal:
|
|
90
|
-
}), this.createUnverifiedContact = async (
|
|
236
|
+
}), this.sendMessage = async (s, a) => await this.client.POST("/backend/widget/v2/chat/send", {
|
|
237
|
+
body: s,
|
|
238
|
+
signal: a
|
|
239
|
+
}), this.createUnverifiedContact = async (s) => await this.client.POST(
|
|
91
240
|
"/backend/widget/v2/contact/create-unverified",
|
|
92
241
|
{
|
|
93
242
|
params: { header: { "x-bot-token": this.config.token } },
|
|
94
|
-
body:
|
|
243
|
+
body: s
|
|
95
244
|
}
|
|
96
|
-
), this.createSession = async (a) => await this.client.POST("/backend/widget/v2/create-session", {
|
|
97
|
-
body:
|
|
245
|
+
), this.createSession = async (s, a) => await this.client.POST("/backend/widget/v2/create-session", {
|
|
246
|
+
body: s,
|
|
247
|
+
signal: a
|
|
98
248
|
}), this.pollSessionAndHistory = async ({
|
|
99
|
-
sessionId:
|
|
100
|
-
abortSignal:
|
|
249
|
+
sessionId: s,
|
|
250
|
+
abortSignal: a
|
|
101
251
|
}) => await this.client.GET("/backend/widget/v2/poll/{sessionId}", {
|
|
102
|
-
params: { path: { sessionId:
|
|
103
|
-
signal:
|
|
252
|
+
params: { path: { sessionId: s } },
|
|
253
|
+
signal: a
|
|
104
254
|
}), this.getSessions = async ({
|
|
105
|
-
cursor:
|
|
106
|
-
filters:
|
|
107
|
-
abortSignal:
|
|
255
|
+
cursor: s,
|
|
256
|
+
filters: a,
|
|
257
|
+
abortSignal: n
|
|
108
258
|
}) => await this.client.GET("/backend/widget/v2/sessions", {
|
|
109
259
|
params: {
|
|
110
260
|
query: {
|
|
111
|
-
offset:
|
|
112
|
-
filters: JSON.stringify(
|
|
261
|
+
offset: s,
|
|
262
|
+
filters: JSON.stringify(a)
|
|
113
263
|
}
|
|
114
264
|
},
|
|
115
|
-
signal:
|
|
265
|
+
signal: n
|
|
116
266
|
}), this.uploadFile = async ({
|
|
117
|
-
file:
|
|
118
|
-
abortSignal:
|
|
119
|
-
onProgress:
|
|
120
|
-
}) => new Promise((
|
|
121
|
-
var
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
}),
|
|
128
|
-
|
|
267
|
+
file: s,
|
|
268
|
+
abortSignal: a,
|
|
269
|
+
onProgress: n
|
|
270
|
+
}) => new Promise((c, d) => {
|
|
271
|
+
var f;
|
|
272
|
+
const _ = new FormData();
|
|
273
|
+
_.append("file", s);
|
|
274
|
+
const p = new XMLHttpRequest();
|
|
275
|
+
if (a && (a.addEventListener("abort", () => {
|
|
276
|
+
p.abort(), d(new DOMException("Aborted", "AbortError"));
|
|
277
|
+
}), a.aborted)) {
|
|
278
|
+
d(new DOMException("Aborted", "AbortError"));
|
|
129
279
|
return;
|
|
130
280
|
}
|
|
131
|
-
|
|
132
|
-
if (b.lengthComputable &&
|
|
133
|
-
const
|
|
134
|
-
|
|
281
|
+
p.upload.addEventListener("progress", (b) => {
|
|
282
|
+
if (b.lengthComputable && n) {
|
|
283
|
+
const w = Math.round(b.loaded / b.total * 100);
|
|
284
|
+
n(w);
|
|
135
285
|
}
|
|
136
|
-
}),
|
|
137
|
-
if (
|
|
286
|
+
}), p.addEventListener("load", () => {
|
|
287
|
+
if (p.status >= 200 && p.status < 300)
|
|
138
288
|
try {
|
|
139
|
-
const b = JSON.parse(
|
|
140
|
-
|
|
289
|
+
const b = JSON.parse(p.responseText);
|
|
290
|
+
c(b);
|
|
141
291
|
} catch (b) {
|
|
142
|
-
|
|
292
|
+
d(new Error(`Failed to parse response: ${b}`));
|
|
143
293
|
}
|
|
144
294
|
else
|
|
145
|
-
|
|
146
|
-
}),
|
|
147
|
-
|
|
148
|
-
}),
|
|
149
|
-
|
|
295
|
+
d(new Error(`Upload failed with status: ${p.status}`));
|
|
296
|
+
}), p.addEventListener("error", () => {
|
|
297
|
+
d(new Error("Network error occurred"));
|
|
298
|
+
}), p.addEventListener("timeout", () => {
|
|
299
|
+
d(new Error("Upload timed out"));
|
|
150
300
|
});
|
|
151
|
-
const { baseUrl:
|
|
152
|
-
|
|
153
|
-
}), this.vote = async (
|
|
154
|
-
body:
|
|
155
|
-
signal:
|
|
156
|
-
}), this.createStateCheckpoint = async (
|
|
157
|
-
body:
|
|
158
|
-
}), this.submitCsat = async (
|
|
301
|
+
const { baseUrl: u } = this.constructClientOptions(this.userToken), g = `${u}/backend/widget/v2/upload`;
|
|
302
|
+
p.open("POST", g), p.setRequestHeader("X-Bot-Token", this.config.token), this.userToken ?? ((f = this.config.user) == null ? void 0 : f.token) ? p.setRequestHeader("Authorization", `Bearer ${this.userToken}`) : k.error("user token not set"), p.send(_);
|
|
303
|
+
}), this.vote = async (s) => await this.client.POST("/backend/widget/v2/chat/vote", { body: s }), this.resolveSession = async (s, a) => await this.client.POST("/backend/widget/v2/session/resolve", {
|
|
304
|
+
body: s,
|
|
305
|
+
signal: a
|
|
306
|
+
}), this.createStateCheckpoint = async (s) => await this.client.POST("/backend/widget/v2/checkpoint", {
|
|
307
|
+
body: s
|
|
308
|
+
}), this.submitCsat = async (s) => await this.client.POST("/backend/widget/v2/submit-csat", { body: s }), this.config = e, this.userToken = ((r = e.user) == null ? void 0 : r.token) || null;
|
|
159
309
|
const { baseUrl: t, headers: o } = this.constructClientOptions(
|
|
160
310
|
(l = e.user) == null ? void 0 : l.token
|
|
161
311
|
);
|
|
162
312
|
this.client = this.createOpenAPIClient({ baseUrl: t, headers: o });
|
|
163
313
|
}
|
|
164
314
|
}
|
|
165
|
-
function
|
|
166
|
-
|
|
315
|
+
function me(i, e) {
|
|
316
|
+
k.error(`missing case for ${i} in ${e}`);
|
|
167
317
|
}
|
|
168
|
-
class
|
|
318
|
+
class S {
|
|
169
319
|
constructor(e) {
|
|
170
320
|
this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (t) => {
|
|
171
|
-
|
|
321
|
+
oe(this.state, t) || (this.state = t, this.notifySubscribers(t));
|
|
172
322
|
}, this.setPartial = (t) => {
|
|
173
323
|
if (t == null) return;
|
|
174
324
|
const o = { ...this.state, ...t };
|
|
@@ -176,11 +326,11 @@ class j {
|
|
|
176
326
|
}, this.reset = () => {
|
|
177
327
|
this.set(this.initialState);
|
|
178
328
|
}, this.notifySubscribers = (t) => {
|
|
179
|
-
Array.from(this.subscribers).forEach((
|
|
329
|
+
Array.from(this.subscribers).forEach((r) => {
|
|
180
330
|
try {
|
|
181
|
-
|
|
331
|
+
r(t);
|
|
182
332
|
} catch (l) {
|
|
183
|
-
|
|
333
|
+
k.error("state subscriber threw", l);
|
|
184
334
|
}
|
|
185
335
|
});
|
|
186
336
|
}, this.subscribe = (t) => (this.subscribers.add(t), () => {
|
|
@@ -188,9 +338,9 @@ class j {
|
|
|
188
338
|
}), this.state = e, this.initialState = e;
|
|
189
339
|
}
|
|
190
340
|
}
|
|
191
|
-
class
|
|
341
|
+
class G {
|
|
192
342
|
constructor() {
|
|
193
|
-
this.state = new
|
|
343
|
+
this.state = new S({
|
|
194
344
|
isPolling: !1,
|
|
195
345
|
isError: !1
|
|
196
346
|
}), this.abortController = new AbortController(), this.reset = () => {
|
|
@@ -198,26 +348,26 @@ class V {
|
|
|
198
348
|
this.abortController.abort("Resetting poller"), (e = this.stopPolling) == null || e.call(this), this.stopPolling = null;
|
|
199
349
|
}, this.stopPolling = null, this.startPolling = (e, t) => {
|
|
200
350
|
if (this.stopPolling) return;
|
|
201
|
-
const o = [],
|
|
351
|
+
const o = [], r = async () => {
|
|
202
352
|
this.abortController = new AbortController(), this.state.setPartial({ isPolling: !0 });
|
|
203
353
|
try {
|
|
204
354
|
await e(this.abortController.signal);
|
|
205
355
|
} catch (l) {
|
|
206
356
|
if (this.abortController.signal.aborted)
|
|
207
357
|
return;
|
|
208
|
-
|
|
358
|
+
k.error("failed to poll", l), this.state.setPartial({ isError: !0 });
|
|
209
359
|
} finally {
|
|
210
360
|
this.state.setPartial({ isPolling: !1 });
|
|
211
361
|
}
|
|
212
|
-
this.abortController.signal.aborted || o.push(setTimeout(
|
|
362
|
+
this.abortController.signal.aborted || o.push(setTimeout(r, t));
|
|
213
363
|
};
|
|
214
|
-
|
|
364
|
+
r(), this.stopPolling = () => {
|
|
215
365
|
o.forEach(clearTimeout), this.state.reset();
|
|
216
366
|
};
|
|
217
367
|
};
|
|
218
368
|
}
|
|
219
369
|
}
|
|
220
|
-
function
|
|
370
|
+
function $(i) {
|
|
221
371
|
try {
|
|
222
372
|
const e = i();
|
|
223
373
|
return e instanceof Promise ? e.then((t) => ({ data: t })).catch((t) => ({ error: t })) : { data: e };
|
|
@@ -225,257 +375,280 @@ function H(i) {
|
|
|
225
375
|
return { error: e };
|
|
226
376
|
}
|
|
227
377
|
}
|
|
228
|
-
class
|
|
378
|
+
class he {
|
|
229
379
|
constructor({
|
|
230
380
|
api: e,
|
|
231
381
|
config: t,
|
|
232
382
|
sessionCtx: o,
|
|
233
|
-
messageCtx:
|
|
383
|
+
messageCtx: r,
|
|
234
384
|
sessionPollingIntervalSeconds: l
|
|
235
385
|
}) {
|
|
236
|
-
this.poller = new
|
|
237
|
-
this.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
try {
|
|
244
|
-
this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.fetchSessionAndHistory({
|
|
245
|
-
sessionId: a.id,
|
|
246
|
-
abortSignal: this.fetchSessionAndFullHistoryAbortController.signal
|
|
386
|
+
this.poller = new G(), this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.reconcileAbortController = new AbortController(), this.subscriptions = [], this.reconcilingSessionId = null, this.registerPolling = () => {
|
|
387
|
+
this.subscriptions.push(
|
|
388
|
+
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
389
|
+
s != null && s.id ? this.poller.startPolling(async (a) => {
|
|
390
|
+
this.fetchSessionAndHistory({
|
|
391
|
+
sessionId: s.id,
|
|
392
|
+
abortSignal: a
|
|
247
393
|
});
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
394
|
+
}, this.sessionPollingIntervalSeconds * 1e3) : this.poller.reset();
|
|
395
|
+
})
|
|
396
|
+
), this.subscriptions.push(
|
|
397
|
+
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
398
|
+
if (s != null && s.id && !s.isOpened)
|
|
399
|
+
try {
|
|
400
|
+
this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.fetchSessionAndHistory({
|
|
401
|
+
sessionId: s.id,
|
|
402
|
+
abortSignal: this.fetchSessionAndFullHistoryAbortController.signal
|
|
403
|
+
});
|
|
404
|
+
} catch (a) {
|
|
405
|
+
this.fetchSessionAndFullHistoryAbortController.signal.aborted || k.error("failed to fetch session and full history", a);
|
|
406
|
+
}
|
|
407
|
+
else
|
|
408
|
+
this.fetchSessionAndFullHistoryAbortController.abort();
|
|
409
|
+
})
|
|
410
|
+
), this.subscriptions.push(
|
|
411
|
+
this.sessionCtx.sessionState.subscribe(({ session: s }) => {
|
|
412
|
+
this.reconcilingSessionId !== null && (s == null ? void 0 : s.id) !== this.reconcilingSessionId && this.reconcileAbortController.abort();
|
|
413
|
+
})
|
|
414
|
+
);
|
|
415
|
+
}, this.dispose = () => {
|
|
416
|
+
this.poller.reset(), this.fetchSessionAndFullHistoryAbortController.abort(), this.reconcileAbortController.abort(), this.reconcilingSessionId = null, this.subscriptions.forEach((s) => s()), this.subscriptions = [];
|
|
417
|
+
}, this.reconcileAfterStream = async (s) => {
|
|
257
418
|
this.reconcileAbortController.abort(), this.reconcileAbortController = new AbortController();
|
|
258
|
-
const { signal:
|
|
259
|
-
this.reconcilingSessionId =
|
|
419
|
+
const { signal: a } = this.reconcileAbortController;
|
|
420
|
+
this.reconcilingSessionId = s;
|
|
260
421
|
try {
|
|
261
|
-
await this.fetchSessionAndHistory({ sessionId:
|
|
262
|
-
} catch (
|
|
263
|
-
if (!
|
|
422
|
+
await this.fetchSessionAndHistory({ sessionId: s, abortSignal: a });
|
|
423
|
+
} catch (n) {
|
|
424
|
+
if (!a.aborted) throw n;
|
|
264
425
|
} finally {
|
|
265
|
-
this.reconcilingSessionId ===
|
|
426
|
+
this.reconcilingSessionId === s && (this.reconcilingSessionId = null);
|
|
266
427
|
}
|
|
267
428
|
}, this.fetchSessionAndHistory = async ({
|
|
268
|
-
sessionId:
|
|
269
|
-
abortSignal:
|
|
429
|
+
sessionId: s,
|
|
430
|
+
abortSignal: a
|
|
270
431
|
}) => {
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
const { data:
|
|
274
|
-
sessionId:
|
|
275
|
-
abortSignal:
|
|
432
|
+
const n = this.messageCtx.state.get().messages.length === 0;
|
|
433
|
+
n && this.messageCtx.state.setPartial({ isInitialFetchLoading: !0 });
|
|
434
|
+
const { data: c } = await this.api.pollSessionAndHistory({
|
|
435
|
+
sessionId: s,
|
|
436
|
+
abortSignal: a
|
|
276
437
|
});
|
|
277
|
-
if (
|
|
278
|
-
const
|
|
279
|
-
(
|
|
438
|
+
if (c != null && c.session && (this.sessionCtx.sessionState.setPartial({ session: c.session }), this.sessionCtx.setSessions([c.session])), c != null && c.history && c.history.length > 0) {
|
|
439
|
+
const d = this.messageCtx.state.get().messages, _ = c.history.map(this.mapHistoryToMessage).filter((p) => p !== null).filter(
|
|
440
|
+
(p) => !d.some((u) => u.id === p.id)
|
|
280
441
|
);
|
|
281
|
-
if (
|
|
442
|
+
if (_.length > 0)
|
|
282
443
|
if (this.messageCtx.state.setPartial({
|
|
283
|
-
messages: [...
|
|
284
|
-
}),
|
|
444
|
+
messages: [...d, ..._]
|
|
445
|
+
}), n)
|
|
285
446
|
this.messageCtx.markAsDispatchedToOnMessageReceivedHook(
|
|
286
|
-
|
|
447
|
+
_.map((p) => p.id)
|
|
287
448
|
);
|
|
288
449
|
else
|
|
289
|
-
for (const
|
|
290
|
-
this.messageCtx.dispatchToOnMessageReceivedHook(
|
|
450
|
+
for (const p of _)
|
|
451
|
+
this.messageCtx.dispatchToOnMessageReceivedHook(p);
|
|
291
452
|
}
|
|
292
453
|
this.messageCtx.state.get().isInitialFetchLoading && this.messageCtx.state.setPartial({ isInitialFetchLoading: !1 });
|
|
293
|
-
}, this.mapHistoryToMessage = (
|
|
294
|
-
var
|
|
295
|
-
const
|
|
296
|
-
id:
|
|
297
|
-
timestamp:
|
|
298
|
-
attachments:
|
|
454
|
+
}, this.mapHistoryToMessage = (s) => {
|
|
455
|
+
var n;
|
|
456
|
+
const a = {
|
|
457
|
+
id: s.publicId,
|
|
458
|
+
timestamp: s.sentAt || "",
|
|
459
|
+
attachments: s.attachments || void 0
|
|
299
460
|
};
|
|
300
|
-
if (
|
|
461
|
+
if (s.sender.kind === "user")
|
|
301
462
|
return {
|
|
302
|
-
...
|
|
463
|
+
...a,
|
|
303
464
|
type: "USER",
|
|
304
|
-
content:
|
|
465
|
+
content: s.content.text || "",
|
|
305
466
|
// Backend field name (schema.ts) → widget vocabulary.
|
|
306
|
-
markedElements:
|
|
467
|
+
markedElements: s.pickedElements
|
|
307
468
|
};
|
|
308
|
-
if (
|
|
469
|
+
if (s.sender.kind === "agent")
|
|
309
470
|
return {
|
|
310
|
-
...
|
|
471
|
+
...a,
|
|
311
472
|
type: "AGENT",
|
|
312
473
|
component: "agent_message",
|
|
313
474
|
data: {
|
|
314
|
-
message:
|
|
475
|
+
message: s.content.text || ""
|
|
315
476
|
},
|
|
316
477
|
agent: {
|
|
317
|
-
name:
|
|
478
|
+
name: s.sender.name || "",
|
|
318
479
|
// Do not set avatarUrl from config here... let it be taken from the config at render time
|
|
319
480
|
// Only set avatar url from the backend's response
|
|
320
|
-
avatarUrl:
|
|
321
|
-
avatar:
|
|
481
|
+
avatarUrl: s.sender.avatar || null,
|
|
482
|
+
avatar: s.sender.avatar || null,
|
|
322
483
|
id: null,
|
|
323
484
|
isAi: !1
|
|
324
|
-
}
|
|
485
|
+
},
|
|
486
|
+
...this.constructReplyTo(s)
|
|
325
487
|
};
|
|
326
|
-
if (
|
|
327
|
-
const
|
|
488
|
+
if (s.sender.kind === "ai") {
|
|
489
|
+
const c = s.actionCalls && s.actionCalls.length > 0 ? s.actionCalls[s.actionCalls.length - 1] : void 0;
|
|
328
490
|
return {
|
|
329
|
-
...
|
|
491
|
+
...a,
|
|
330
492
|
type: "AI",
|
|
331
493
|
component: "bot_message",
|
|
332
494
|
agent: {
|
|
333
495
|
id: null,
|
|
334
|
-
name: ((
|
|
496
|
+
name: ((n = this.config.bot) == null ? void 0 : n.name) || "",
|
|
335
497
|
isAi: !0,
|
|
336
498
|
// Do not set avatarUrl from config here... let it be taken from the config at render time
|
|
337
499
|
avatarUrl: null,
|
|
338
500
|
avatar: null
|
|
339
501
|
},
|
|
340
502
|
data: {
|
|
341
|
-
message:
|
|
342
|
-
action:
|
|
343
|
-
name:
|
|
344
|
-
data: this.extractActionResult(
|
|
503
|
+
message: s.content.text || "",
|
|
504
|
+
action: c ? {
|
|
505
|
+
name: c.actionName,
|
|
506
|
+
data: this.extractActionResult(c)
|
|
345
507
|
} : void 0
|
|
346
|
-
}
|
|
508
|
+
},
|
|
509
|
+
...this.constructReplyTo(s)
|
|
347
510
|
};
|
|
348
511
|
}
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
return
|
|
512
|
+
if (s.sender.kind === "system") {
|
|
513
|
+
const c = this.constructSystemMessage(s);
|
|
514
|
+
return c === null ? null : { ...c };
|
|
352
515
|
}
|
|
353
516
|
return null;
|
|
354
|
-
}, this.
|
|
355
|
-
if (!
|
|
356
|
-
|
|
517
|
+
}, this.constructReplyTo = (s) => {
|
|
518
|
+
if (!s.replyTo) return {};
|
|
519
|
+
const { publicId: a, text: n, sender: c } = s.replyTo;
|
|
520
|
+
return {
|
|
521
|
+
replyTo: {
|
|
522
|
+
id: a,
|
|
523
|
+
text: n,
|
|
524
|
+
sender: c
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}, this.constructSystemMessage = (s) => {
|
|
528
|
+
if (!s || !s.systemMessagePayload) return null;
|
|
529
|
+
switch (s.systemMessagePayload.type) {
|
|
357
530
|
case "state_checkpoint":
|
|
358
531
|
return {
|
|
359
|
-
id:
|
|
532
|
+
id: s.publicId,
|
|
360
533
|
type: "SYSTEM",
|
|
361
534
|
subtype: "state_checkpoint",
|
|
362
|
-
data: { payload:
|
|
363
|
-
timestamp:
|
|
535
|
+
data: { payload: s.systemMessagePayload.payload },
|
|
536
|
+
timestamp: s.sentAt || "",
|
|
364
537
|
attachments: void 0
|
|
365
538
|
};
|
|
366
539
|
case "csat_requested":
|
|
367
540
|
return {
|
|
368
|
-
id:
|
|
541
|
+
id: s.publicId,
|
|
369
542
|
type: "SYSTEM",
|
|
370
543
|
subtype: "csat_requested",
|
|
371
544
|
data: { payload: void 0 },
|
|
372
|
-
timestamp:
|
|
545
|
+
timestamp: s.sentAt || "",
|
|
373
546
|
attachments: void 0
|
|
374
547
|
};
|
|
375
548
|
case "csat_submitted":
|
|
376
549
|
return {
|
|
377
|
-
id:
|
|
550
|
+
id: s.publicId,
|
|
378
551
|
type: "SYSTEM",
|
|
379
552
|
subtype: "csat_submitted",
|
|
380
553
|
data: {
|
|
381
554
|
payload: {
|
|
382
|
-
score:
|
|
383
|
-
feedback:
|
|
555
|
+
score: s.systemMessagePayload.payload.score ?? void 0,
|
|
556
|
+
feedback: s.systemMessagePayload.payload.feedback ?? void 0
|
|
384
557
|
}
|
|
385
558
|
},
|
|
386
|
-
timestamp:
|
|
559
|
+
timestamp: s.sentAt || "",
|
|
387
560
|
attachments: void 0
|
|
388
561
|
};
|
|
389
562
|
case "none":
|
|
390
563
|
return null;
|
|
391
564
|
default:
|
|
392
|
-
return
|
|
393
|
-
|
|
565
|
+
return me(
|
|
566
|
+
s.systemMessagePayload,
|
|
394
567
|
this.constructSystemMessage.name
|
|
395
568
|
), null;
|
|
396
569
|
}
|
|
397
|
-
}, this.extractActionResult = (
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
if ("responseBodyText" in
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
570
|
+
}, this.extractActionResult = (s) => {
|
|
571
|
+
const a = s.result;
|
|
572
|
+
if (a === null || typeof a != "object") return a;
|
|
573
|
+
if ("responseBodyText" in a && typeof a.responseBodyText == "string") {
|
|
574
|
+
const n = a.responseBodyText, c = $(() => JSON.parse(n)).data;
|
|
575
|
+
if (c) return c;
|
|
403
576
|
}
|
|
404
|
-
return
|
|
405
|
-
}, this.api = e, this.config = t, this.sessionCtx = o, this.messageCtx =
|
|
577
|
+
return s.result;
|
|
578
|
+
}, this.api = e, this.config = t, this.sessionCtx = o, this.messageCtx = r, this.sessionPollingIntervalSeconds = l, this.registerPolling();
|
|
406
579
|
}
|
|
407
580
|
}
|
|
408
|
-
class
|
|
581
|
+
class ge {
|
|
409
582
|
constructor({
|
|
410
583
|
config: e,
|
|
411
584
|
api: t,
|
|
412
585
|
storageCtx: o
|
|
413
586
|
}) {
|
|
414
|
-
var
|
|
587
|
+
var r;
|
|
415
588
|
this.shouldCollectData = () => {
|
|
416
589
|
var l;
|
|
417
590
|
return !!(!((l = this.state.get().contact) != null && l.token) && this.config.collectUserData);
|
|
418
591
|
}, this.autoCreateUnverifiedUserIfNotExists = async () => {
|
|
419
|
-
var l, a, n,
|
|
592
|
+
var l, s, a, n, c, d, _, p, u, m, g, v, f, b;
|
|
420
593
|
if (!((l = this.config.user) != null && l.token)) {
|
|
421
|
-
if (this.config.collectUserData && !((
|
|
422
|
-
if ((
|
|
594
|
+
if (this.config.collectUserData && !((a = (s = this.config.user) == null ? void 0 : s.data) != null && a.email)) {
|
|
595
|
+
if ((n = this.config.extraDataCollectionFields) != null && n.length)
|
|
423
596
|
return;
|
|
424
|
-
const
|
|
425
|
-
|
|
597
|
+
const w = await ((c = this.storageCtx) == null ? void 0 : c.getContactToken());
|
|
598
|
+
w && await this.setUnverifiedContact(w);
|
|
426
599
|
return;
|
|
427
600
|
}
|
|
428
|
-
if (!((
|
|
429
|
-
const
|
|
430
|
-
if (
|
|
431
|
-
await this.setUnverifiedContact(
|
|
601
|
+
if (!((_ = (d = this.config.user) == null ? void 0 : d.data) != null && _.email)) {
|
|
602
|
+
const w = await ((p = this.storageCtx) == null ? void 0 : p.getContactToken());
|
|
603
|
+
if (w) {
|
|
604
|
+
await this.setUnverifiedContact(w);
|
|
432
605
|
return;
|
|
433
606
|
}
|
|
434
607
|
}
|
|
435
608
|
await this.createUnverifiedContact({
|
|
436
|
-
email: (
|
|
437
|
-
non_verified_name: (
|
|
438
|
-
non_verified_custom_data: (b = (
|
|
609
|
+
email: (m = (u = this.config.user) == null ? void 0 : u.data) == null ? void 0 : m.email,
|
|
610
|
+
non_verified_name: (v = (g = this.config.user) == null ? void 0 : g.data) == null ? void 0 : v.name,
|
|
611
|
+
non_verified_custom_data: (b = (f = this.config.user) == null ? void 0 : f.data) == null ? void 0 : b.customData
|
|
439
612
|
});
|
|
440
613
|
}
|
|
441
|
-
}, this.createUnverifiedContact = async (l,
|
|
442
|
-
this.state.setPartial({ extraCollectedData:
|
|
614
|
+
}, this.createUnverifiedContact = async (l, s) => {
|
|
615
|
+
this.state.setPartial({ extraCollectedData: s });
|
|
443
616
|
try {
|
|
444
617
|
this.state.setPartial({
|
|
445
618
|
isCreatingUnverifiedContact: !0,
|
|
446
619
|
isErrorCreatingUnverifiedContact: !1
|
|
447
620
|
});
|
|
448
|
-
const { data:
|
|
449
|
-
|
|
450
|
-
} catch (
|
|
451
|
-
this.state.setPartial({ isErrorCreatingUnverifiedContact: !0 }),
|
|
452
|
-
_e:
|
|
621
|
+
const { data: a } = await this.api.createUnverifiedContact(l);
|
|
622
|
+
a != null && a.token ? await this.setUnverifiedContact(a.token) : this.state.setPartial({ isErrorCreatingUnverifiedContact: !0 });
|
|
623
|
+
} catch (a) {
|
|
624
|
+
this.state.setPartial({ isErrorCreatingUnverifiedContact: !0 }), k.error("failed to create an unverified contact", {
|
|
625
|
+
_e: a instanceof Error ? a.message : String(a)
|
|
453
626
|
});
|
|
454
627
|
} finally {
|
|
455
628
|
this.state.setPartial({ isCreatingUnverifiedContact: !1 });
|
|
456
629
|
}
|
|
457
630
|
}, this.recoverFromStaleToken = async () => {
|
|
458
|
-
var l, a, n,
|
|
631
|
+
var l, s, a, n, c, d, _, p, u, m;
|
|
459
632
|
if ((l = this.config.user) != null && l.token) return !1;
|
|
460
633
|
this.api.setAuthToken(""), this.state.setPartial({ contact: null });
|
|
461
634
|
try {
|
|
462
|
-
await ((
|
|
635
|
+
await ((s = this.storageCtx) == null ? void 0 : s.clearContactToken()), await ((a = this.storageCtx) == null ? void 0 : a.clearActiveSessionId());
|
|
463
636
|
} catch (g) {
|
|
464
|
-
|
|
637
|
+
k.warn("failed to clear a stale contact token", {
|
|
465
638
|
error: g instanceof Error ? g.message : String(g)
|
|
466
639
|
});
|
|
467
640
|
}
|
|
468
641
|
return await this.createUnverifiedContact({
|
|
469
|
-
email: (
|
|
470
|
-
non_verified_name: (
|
|
471
|
-
non_verified_custom_data: (
|
|
472
|
-
}), !!((
|
|
642
|
+
email: (c = (n = this.config.user) == null ? void 0 : n.data) == null ? void 0 : c.email,
|
|
643
|
+
non_verified_name: (_ = (d = this.config.user) == null ? void 0 : d.data) == null ? void 0 : _.name,
|
|
644
|
+
non_verified_custom_data: (u = (p = this.config.user) == null ? void 0 : p.data) == null ? void 0 : u.customData
|
|
645
|
+
}), !!((m = this.state.get().contact) != null && m.token);
|
|
473
646
|
}, this.setUnverifiedContact = async (l) => {
|
|
474
|
-
var
|
|
475
|
-
const
|
|
476
|
-
this.api.setAuthToken(l), await ((
|
|
477
|
-
}, this.config = e, this.storageCtx = o, this.api = t, this.state = new
|
|
478
|
-
contact: (
|
|
647
|
+
var n, c, d, _;
|
|
648
|
+
const s = await ((n = this.storageCtx) == null ? void 0 : n.getExternalContactId()), a = ((c = this.config.user) == null ? void 0 : c.externalId) || s || N();
|
|
649
|
+
this.api.setAuthToken(l), await ((d = this.storageCtx) == null ? void 0 : d.setContactToken(l)), await ((_ = this.storageCtx) == null ? void 0 : _.setExternalContactId(a)), this.state.setPartial({ contact: { token: l, externalId: a } });
|
|
650
|
+
}, this.config = e, this.storageCtx = o, this.api = t, this.state = new S({
|
|
651
|
+
contact: (r = e.user) != null && r.token ? {
|
|
479
652
|
token: e.user.token,
|
|
480
653
|
// Set optional externalId from config... not local storage
|
|
481
654
|
externalId: e.user.externalId
|
|
@@ -486,48 +659,97 @@ class oe {
|
|
|
486
659
|
}), this.autoCreateUnverifiedUserIfNotExists();
|
|
487
660
|
}
|
|
488
661
|
}
|
|
662
|
+
class ke {
|
|
663
|
+
constructor(e) {
|
|
664
|
+
this.api = e, this.state = new S([]), this.controllers = /* @__PURE__ */ new Map(), this.appendFiles = (t) => {
|
|
665
|
+
const o = t.map(
|
|
666
|
+
(r) => ({
|
|
667
|
+
file: r,
|
|
668
|
+
id: N(),
|
|
669
|
+
status: "pending",
|
|
670
|
+
progress: 0
|
|
671
|
+
})
|
|
672
|
+
);
|
|
673
|
+
this.state.set([...this.state.get(), ...o]), o.forEach((r) => void this.upload(r));
|
|
674
|
+
}, this.cancel = (t) => {
|
|
675
|
+
var o;
|
|
676
|
+
(o = this.controllers.get(t)) == null || o.abort(), this.controllers.delete(t), this.state.set(this.state.get().filter((r) => r.id !== t));
|
|
677
|
+
}, this.reset = () => {
|
|
678
|
+
this.controllers.forEach((t) => t.abort()), this.controllers.clear(), this.state.reset();
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
update(e, t) {
|
|
682
|
+
this.state.set(
|
|
683
|
+
this.state.get().map((o) => o.id === e ? { ...o, ...t } : o)
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
async upload(e) {
|
|
687
|
+
const t = new AbortController();
|
|
688
|
+
this.controllers.set(e.id, t), this.update(e.id, { status: "uploading" });
|
|
689
|
+
try {
|
|
690
|
+
const o = await this.api.uploadFile({
|
|
691
|
+
file: e.file,
|
|
692
|
+
abortSignal: t.signal,
|
|
693
|
+
onProgress: (r) => this.update(e.id, { progress: r })
|
|
694
|
+
});
|
|
695
|
+
this.update(e.id, {
|
|
696
|
+
status: "success",
|
|
697
|
+
fileUrl: o.fileUrl,
|
|
698
|
+
progress: 100
|
|
699
|
+
});
|
|
700
|
+
} catch (o) {
|
|
701
|
+
t.signal.aborted || this.update(e.id, {
|
|
702
|
+
status: "error",
|
|
703
|
+
progress: 0,
|
|
704
|
+
error: o instanceof Error ? o.message : "Upload failed"
|
|
705
|
+
});
|
|
706
|
+
} finally {
|
|
707
|
+
this.controllers.delete(e.id);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
489
711
|
function x() {
|
|
490
|
-
return
|
|
712
|
+
return N();
|
|
491
713
|
}
|
|
492
|
-
class
|
|
714
|
+
class be {
|
|
493
715
|
constructor({
|
|
494
716
|
api: e,
|
|
495
717
|
sessionCtx: t,
|
|
496
718
|
messageCtx: o
|
|
497
719
|
}) {
|
|
498
|
-
this.submitCsat = async (
|
|
499
|
-
var
|
|
500
|
-
const l = (
|
|
720
|
+
this.submitCsat = async (r) => {
|
|
721
|
+
var c;
|
|
722
|
+
const l = (c = this.sessionCtx.sessionState.get().session) == null ? void 0 : c.id;
|
|
501
723
|
if (!l)
|
|
502
724
|
return { data: null, error: "No session id found" };
|
|
503
|
-
const
|
|
725
|
+
const s = x();
|
|
504
726
|
this.messageCtx.state.setPartial({
|
|
505
727
|
messages: [
|
|
506
728
|
...this.messageCtx.state.get().messages,
|
|
507
729
|
{
|
|
508
|
-
id:
|
|
730
|
+
id: s,
|
|
509
731
|
type: "SYSTEM",
|
|
510
732
|
subtype: "csat_submitted",
|
|
511
733
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
512
734
|
data: {
|
|
513
735
|
payload: {
|
|
514
|
-
score:
|
|
515
|
-
feedback:
|
|
736
|
+
score: r.score,
|
|
737
|
+
feedback: r.feedback
|
|
516
738
|
}
|
|
517
739
|
}
|
|
518
740
|
}
|
|
519
741
|
]
|
|
520
742
|
});
|
|
521
|
-
const { data:
|
|
522
|
-
...
|
|
523
|
-
system_message_uuid:
|
|
743
|
+
const { data: a, error: n } = await this.api.submitCsat({
|
|
744
|
+
...r,
|
|
745
|
+
system_message_uuid: s,
|
|
524
746
|
session_id: l
|
|
525
747
|
});
|
|
526
|
-
return { data:
|
|
748
|
+
return { data: a, error: n };
|
|
527
749
|
}, this.api = e, this.sessionCtx = t, this.messageCtx = o;
|
|
528
750
|
}
|
|
529
751
|
}
|
|
530
|
-
const
|
|
752
|
+
const ve = [
|
|
531
753
|
{
|
|
532
754
|
action: "newparagraph",
|
|
533
755
|
phrases: {
|
|
@@ -602,7 +824,7 @@ const re = [
|
|
|
602
824
|
it: ["invia messaggio"]
|
|
603
825
|
}
|
|
604
826
|
}
|
|
605
|
-
],
|
|
827
|
+
], fe = [
|
|
606
828
|
"en",
|
|
607
829
|
"es",
|
|
608
830
|
"fr",
|
|
@@ -610,18 +832,18 @@ const re = [
|
|
|
610
832
|
"pt",
|
|
611
833
|
"it"
|
|
612
834
|
];
|
|
613
|
-
function
|
|
614
|
-
return
|
|
835
|
+
function ye(i) {
|
|
836
|
+
return fe.includes(i);
|
|
615
837
|
}
|
|
616
|
-
function
|
|
838
|
+
function we(i) {
|
|
617
839
|
return i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
618
840
|
}
|
|
619
|
-
function
|
|
620
|
-
const e =
|
|
621
|
-
(
|
|
622
|
-
(l) =>
|
|
841
|
+
function je(i) {
|
|
842
|
+
const e = ve.flatMap(
|
|
843
|
+
(r) => i.flatMap(
|
|
844
|
+
(l) => r.phrases[l].map((s) => ({ phrase: s, action: r.action }))
|
|
623
845
|
)
|
|
624
|
-
), t = e.map((
|
|
846
|
+
), t = e.map((r) => we(r.phrase)).sort((r, l) => l.length - r.length).join("|"), o = String.raw`(?<=^\s{0,3}|[.!?\n]\s{0,3})`;
|
|
625
847
|
return {
|
|
626
848
|
regex: new RegExp(
|
|
627
849
|
`${o}(${t})` + String.raw`([.,!?;:])(?=\s|$)`,
|
|
@@ -632,82 +854,82 @@ function pe(i) {
|
|
|
632
854
|
"giu"
|
|
633
855
|
),
|
|
634
856
|
phraseToAction: new Map(
|
|
635
|
-
e.map((
|
|
857
|
+
e.map((r) => [r.phrase.toLowerCase(), r.action])
|
|
636
858
|
),
|
|
637
|
-
longestPhrase: Math.max(...e.map((
|
|
859
|
+
longestPhrase: Math.max(...e.map((r) => r.phrase.length))
|
|
638
860
|
};
|
|
639
861
|
}
|
|
640
|
-
const
|
|
641
|
-
function
|
|
642
|
-
const e = i &&
|
|
643
|
-
let o =
|
|
644
|
-
return o || (o =
|
|
862
|
+
const V = /* @__PURE__ */ new Map();
|
|
863
|
+
function I(i) {
|
|
864
|
+
const e = i && ye(i) && i !== "en" ? i : null, t = e ?? "en";
|
|
865
|
+
let o = V.get(t);
|
|
866
|
+
return o || (o = je(e ? ["en", e] : ["en"]), V.set(t, o)), o;
|
|
645
867
|
}
|
|
646
|
-
function
|
|
868
|
+
function Se(i) {
|
|
647
869
|
const e = i.replace(/\s+$/, "");
|
|
648
870
|
if (!e) return "";
|
|
649
871
|
const t = e.replace(/[.!?]+$/, "");
|
|
650
872
|
let o = -1;
|
|
651
|
-
for (let
|
|
652
|
-
const l = t[
|
|
873
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
874
|
+
const l = t[r];
|
|
653
875
|
if (l === "." || l === "!" || l === "?" || l === `
|
|
654
876
|
`) {
|
|
655
|
-
o =
|
|
877
|
+
o = r + 1;
|
|
656
878
|
break;
|
|
657
879
|
}
|
|
658
880
|
}
|
|
659
881
|
return o === -1 ? "" : `${t.slice(0, o)} `.replace(/\n $/, `
|
|
660
882
|
`);
|
|
661
883
|
}
|
|
662
|
-
const
|
|
884
|
+
const ze = new RegExp(
|
|
663
885
|
String.raw`(^- |\n(?:- )?)(\p{Ll})`,
|
|
664
886
|
"gu"
|
|
665
887
|
);
|
|
666
|
-
function
|
|
888
|
+
function Ce(i) {
|
|
667
889
|
return i.replace(
|
|
668
|
-
|
|
890
|
+
ze,
|
|
669
891
|
(e, t, o) => t + o.toUpperCase()
|
|
670
892
|
);
|
|
671
893
|
}
|
|
672
|
-
function
|
|
894
|
+
function xe(i) {
|
|
673
895
|
return i.length <= 3 && /^\s*$/.test(i) ? !0 : /[.!?\n]\s{0,3}$/.test(i.slice(-6));
|
|
674
896
|
}
|
|
675
|
-
class
|
|
897
|
+
class q {
|
|
676
898
|
/**
|
|
677
899
|
* Process the full raw transcript accumulated so far into insertable text.
|
|
678
900
|
* Pure and deterministic: always called with the entire raw string so the
|
|
679
901
|
* result never depends on delta chunking.
|
|
680
902
|
*/
|
|
681
903
|
static process(e, t) {
|
|
682
|
-
const o =
|
|
683
|
-
let
|
|
684
|
-
for (const
|
|
685
|
-
const [,
|
|
686
|
-
if (
|
|
687
|
-
if (
|
|
904
|
+
const o = I(t == null ? void 0 : t.language), r = t != null && t.final ? "" : q.commandPrefixTail(e, t == null ? void 0 : t.language), l = e.slice(0, e.length - r.length), s = t != null && t.final ? o.finalRegex : o.regex;
|
|
905
|
+
let a = "", n = null, c = 0;
|
|
906
|
+
for (const _ of Array.from(l.matchAll(s))) {
|
|
907
|
+
const [, p = ""] = _, u = o.phraseToAction.get(p.toLowerCase());
|
|
908
|
+
if (u)
|
|
909
|
+
if (a += l.slice(c, _.index), c = _.index + _[0].length, u === "newline") a = `${a.replace(/[ \t]+$/, "")}
|
|
688
910
|
`;
|
|
689
|
-
else if (
|
|
690
|
-
|
|
911
|
+
else if (u === "newparagraph")
|
|
912
|
+
a = `${a.replace(/[ \t]+$/, "")}
|
|
691
913
|
|
|
692
914
|
`;
|
|
693
|
-
else if (
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
`) ? `${
|
|
915
|
+
else if (u === "bullet") {
|
|
916
|
+
const m = a.replace(/[ \t]+$/, "");
|
|
917
|
+
a = m === "" || m.endsWith(`
|
|
918
|
+
`) ? `${m}- ` : `${m}
|
|
697
919
|
- `;
|
|
698
|
-
} else if (
|
|
920
|
+
} else if (u === "scratch") a = Se(a);
|
|
699
921
|
else {
|
|
700
|
-
|
|
922
|
+
n = u === "send" ? "send" : "stop";
|
|
701
923
|
break;
|
|
702
924
|
}
|
|
703
925
|
}
|
|
704
|
-
return
|
|
705
|
-
|
|
926
|
+
return n === null && (a += l.slice(c)), { text: Ce(
|
|
927
|
+
a.replace(/^\s+/, "").replace(/[ \t]+\n/g, `
|
|
706
928
|
`).replace(/\n[ \t]+/g, `
|
|
707
929
|
`).replace(/(^|\n)- +/g, "$1- ").replace(/ {2,}/g, " ").replace(/\n{3,}/g, `
|
|
708
930
|
|
|
709
931
|
`)
|
|
710
|
-
), pendingTail:
|
|
932
|
+
), pendingTail: r, control: n };
|
|
711
933
|
}
|
|
712
934
|
/**
|
|
713
935
|
* Longest suffix of `raw` that could still become a command — a proper
|
|
@@ -719,15 +941,15 @@ class C {
|
|
|
719
941
|
* mid-sentence.
|
|
720
942
|
*/
|
|
721
943
|
static commandPrefixTail(e, t) {
|
|
722
|
-
const o =
|
|
723
|
-
for (let l =
|
|
724
|
-
const
|
|
725
|
-
if (!
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
728
|
-
for (const
|
|
729
|
-
if (
|
|
730
|
-
return e.slice(
|
|
944
|
+
const o = I(t), r = Math.min(e.length, o.longestPhrase + 2);
|
|
945
|
+
for (let l = r; l > 0; l--) {
|
|
946
|
+
const s = e.length - l;
|
|
947
|
+
if (!xe(e.slice(0, s))) continue;
|
|
948
|
+
const a = e.slice(s).toLowerCase(), n = a.replace(/^\s+/, "");
|
|
949
|
+
if (n) {
|
|
950
|
+
for (const c of Array.from(o.phraseToAction.keys()))
|
|
951
|
+
if (c.startsWith(n))
|
|
952
|
+
return e.slice(s + (a.length - n.length));
|
|
731
953
|
}
|
|
732
954
|
}
|
|
733
955
|
return "";
|
|
@@ -738,12 +960,12 @@ class C {
|
|
|
738
960
|
* the manager's silence timer.
|
|
739
961
|
*/
|
|
740
962
|
static pendingTailIsCompletePhrase(e, t) {
|
|
741
|
-
const o =
|
|
742
|
-
return o ?
|
|
963
|
+
const o = q.commandPrefixTail(e, t).trim().toLowerCase();
|
|
964
|
+
return o ? I(t).phraseToAction.has(o) : !1;
|
|
743
965
|
}
|
|
744
966
|
}
|
|
745
|
-
const
|
|
746
|
-
class
|
|
967
|
+
const qe = 55, Ee = 90;
|
|
968
|
+
class H {
|
|
747
969
|
/**
|
|
748
970
|
* Next paced step toward `processed`: normally one word per tick so text
|
|
749
971
|
* flows evenly instead of landing in bursty chunks; proportionally larger
|
|
@@ -756,12 +978,12 @@ class F {
|
|
|
756
978
|
}) {
|
|
757
979
|
if (t.length <= e.length) return t;
|
|
758
980
|
const o = t.length - e.length;
|
|
759
|
-
if (o >
|
|
981
|
+
if (o > Ee)
|
|
760
982
|
return t.slice(0, e.length + Math.ceil(o / 3));
|
|
761
|
-
let
|
|
762
|
-
for (;
|
|
763
|
-
for (;
|
|
764
|
-
return
|
|
983
|
+
let r = e.length;
|
|
984
|
+
for (; r < t.length && /\s/.test(t.charAt(r)); ) r++;
|
|
985
|
+
for (; r < t.length && !/\s/.test(t.charAt(r)); ) r++;
|
|
986
|
+
return r - e.length > 12 && (r = e.length + 6), t.slice(0, Math.max(r, e.length + 1));
|
|
765
987
|
}
|
|
766
988
|
/** Normalize a BCP-47 browser locale into the hint OpenAI accepts. */
|
|
767
989
|
static languageHint(e) {
|
|
@@ -772,8 +994,8 @@ class F {
|
|
|
772
994
|
return o && /^[a-z]{2,3}$/.test(o) ? o : void 0;
|
|
773
995
|
}
|
|
774
996
|
}
|
|
775
|
-
const
|
|
776
|
-
class
|
|
997
|
+
const Ae = 2e4;
|
|
998
|
+
class Pe {
|
|
777
999
|
constructor() {
|
|
778
1000
|
this.cached = null, this.inflight = null;
|
|
779
1001
|
}
|
|
@@ -781,7 +1003,7 @@ class fe {
|
|
|
781
1003
|
get() {
|
|
782
1004
|
if (!this.cached) return null;
|
|
783
1005
|
const e = Date.parse(this.cached.expiresAt);
|
|
784
|
-
return Number.isNaN(e) || e - Date.now() <
|
|
1006
|
+
return Number.isNaN(e) || e - Date.now() < Ae ? (this.cached = null, null) : this.cached;
|
|
785
1007
|
}
|
|
786
1008
|
/**
|
|
787
1009
|
* Resolve a mint, deduping concurrent requests (hover-prewarm racing a
|
|
@@ -798,89 +1020,89 @@ class fe {
|
|
|
798
1020
|
this.cached = null;
|
|
799
1021
|
}
|
|
800
1022
|
}
|
|
801
|
-
function
|
|
1023
|
+
function Z(i) {
|
|
802
1024
|
return typeof i == "object" && i !== null && !Array.isArray(i);
|
|
803
1025
|
}
|
|
804
|
-
function
|
|
805
|
-
if (!
|
|
806
|
-
const e =
|
|
1026
|
+
function Te(i) {
|
|
1027
|
+
if (!Z(i) || typeof i.type != "string") return null;
|
|
1028
|
+
const e = Z(i.error) ? i.error : null;
|
|
807
1029
|
return {
|
|
808
1030
|
type: i.type,
|
|
809
1031
|
delta: typeof i.delta == "string" ? i.delta : void 0,
|
|
810
1032
|
errorMessage: e && typeof e.message == "string" ? e.message : void 0
|
|
811
1033
|
};
|
|
812
1034
|
}
|
|
813
|
-
const
|
|
814
|
-
class
|
|
1035
|
+
const Ie = "https://api.openai.com/v1/realtime/calls", Me = 600 * 1e3, De = 15e3, Ne = 5e3;
|
|
1036
|
+
class P extends Error {
|
|
815
1037
|
}
|
|
816
|
-
class
|
|
1038
|
+
class Re {
|
|
817
1039
|
constructor({
|
|
818
1040
|
mintToken: e,
|
|
819
1041
|
onDelta: t,
|
|
820
1042
|
onState: o,
|
|
821
|
-
onError:
|
|
1043
|
+
onError: r,
|
|
822
1044
|
onLevel: l
|
|
823
1045
|
}) {
|
|
824
|
-
this.state = "idle", this.pc = null, this.dc = null, this.stream = null, this.audioContext = null, this.levelRaf = 0, this.timers = [], this.loggedParseFailure = !1, this.mintToken = e, this.onDelta = t, this.onState = o, this.onError =
|
|
1046
|
+
this.state = "idle", this.pc = null, this.dc = null, this.stream = null, this.audioContext = null, this.levelRaf = 0, this.timers = [], this.loggedParseFailure = !1, this.mintToken = e, this.onDelta = t, this.onState = o, this.onError = r, this.onLevel = l;
|
|
825
1047
|
}
|
|
826
1048
|
async start() {
|
|
827
1049
|
if (this.state === "idle") {
|
|
828
1050
|
this.setState("connecting"), this.timers.push(
|
|
829
1051
|
setTimeout(() => {
|
|
830
1052
|
this.state === "connecting" && this.fail("unavailable");
|
|
831
|
-
},
|
|
832
|
-
), this.timers.push(setTimeout(() => this.stop(),
|
|
1053
|
+
}, De)
|
|
1054
|
+
), this.timers.push(setTimeout(() => this.stop(), Me));
|
|
833
1055
|
try {
|
|
834
1056
|
const e = this.requestMicrophone();
|
|
835
|
-
e.then((
|
|
836
|
-
(this.isTornDown() || this.stream && this.stream !==
|
|
1057
|
+
e.then((d) => {
|
|
1058
|
+
(this.isTornDown() || this.stream && this.stream !== d) && d.getTracks().forEach((_) => _.stop());
|
|
837
1059
|
}).catch(() => {
|
|
838
1060
|
});
|
|
839
1061
|
const [t, o] = await Promise.all([e, this.mintToken()]);
|
|
840
1062
|
if (this.isTornDown()) {
|
|
841
|
-
t.getTracks().forEach((
|
|
1063
|
+
t.getTracks().forEach((d) => d.stop());
|
|
842
1064
|
return;
|
|
843
1065
|
}
|
|
844
1066
|
this.stream = t, this.startLevelMeter(t);
|
|
845
|
-
const
|
|
846
|
-
this.pc =
|
|
1067
|
+
const r = new RTCPeerConnection();
|
|
1068
|
+
this.pc = r;
|
|
847
1069
|
const [l] = t.getAudioTracks();
|
|
848
|
-
if (!l) throw new
|
|
849
|
-
|
|
850
|
-
const
|
|
851
|
-
this.dc =
|
|
1070
|
+
if (!l) throw new P("No audio track");
|
|
1071
|
+
r.addTrack(l, t);
|
|
1072
|
+
const s = r.createDataChannel("oai-events");
|
|
1073
|
+
this.dc = s, s.addEventListener(
|
|
852
1074
|
"message",
|
|
853
|
-
(
|
|
854
|
-
),
|
|
1075
|
+
(d) => this.handleServerEvent(d.data)
|
|
1076
|
+
), s.addEventListener("open", () => {
|
|
855
1077
|
this.state === "connecting" && this.setState("listening");
|
|
856
|
-
}),
|
|
857
|
-
if (
|
|
1078
|
+
}), r.addEventListener("connectionstatechange", () => {
|
|
1079
|
+
if (r.connectionState === "failed") {
|
|
858
1080
|
this.fail("unavailable");
|
|
859
1081
|
return;
|
|
860
1082
|
}
|
|
861
|
-
|
|
1083
|
+
r.connectionState === "disconnected" && this.timers.push(
|
|
862
1084
|
setTimeout(() => {
|
|
863
|
-
this.pc ===
|
|
864
|
-
},
|
|
1085
|
+
this.pc === r && r.connectionState !== "connected" && this.fail("unavailable");
|
|
1086
|
+
}, Ne)
|
|
865
1087
|
);
|
|
866
1088
|
});
|
|
867
|
-
const
|
|
868
|
-
await
|
|
869
|
-
const
|
|
1089
|
+
const a = await r.createOffer();
|
|
1090
|
+
await r.setLocalDescription(a);
|
|
1091
|
+
const n = await fetch(Ie, {
|
|
870
1092
|
method: "POST",
|
|
871
1093
|
headers: {
|
|
872
1094
|
Authorization: `Bearer ${o.token}`,
|
|
873
1095
|
"Content-Type": "application/sdp"
|
|
874
1096
|
},
|
|
875
|
-
body:
|
|
1097
|
+
body: a.sdp
|
|
876
1098
|
});
|
|
877
|
-
if (!
|
|
878
|
-
throw new Error(`Realtime handshake failed (${
|
|
879
|
-
const
|
|
1099
|
+
if (!n.ok)
|
|
1100
|
+
throw new Error(`Realtime handshake failed (${n.status})`);
|
|
1101
|
+
const c = await n.text();
|
|
880
1102
|
if (this.isTornDown()) return;
|
|
881
|
-
await
|
|
1103
|
+
await r.setRemoteDescription({ type: "answer", sdp: c });
|
|
882
1104
|
} catch (e) {
|
|
883
|
-
e instanceof
|
|
1105
|
+
e instanceof P ? this.fail("microphone") : (k.error("dictation session failed to start", {
|
|
884
1106
|
_e: e instanceof Error ? e.message : String(e)
|
|
885
1107
|
}), this.fail("unavailable"));
|
|
886
1108
|
}
|
|
@@ -892,7 +1114,7 @@ class ze {
|
|
|
892
1114
|
async requestMicrophone() {
|
|
893
1115
|
var e;
|
|
894
1116
|
if (!((e = navigator.mediaDevices) != null && e.getUserMedia))
|
|
895
|
-
throw new
|
|
1117
|
+
throw new P("Microphone is not supported");
|
|
896
1118
|
try {
|
|
897
1119
|
return await navigator.mediaDevices.getUserMedia({
|
|
898
1120
|
audio: {
|
|
@@ -902,7 +1124,7 @@ class ze {
|
|
|
902
1124
|
}
|
|
903
1125
|
});
|
|
904
1126
|
} catch (t) {
|
|
905
|
-
throw new
|
|
1127
|
+
throw new P(
|
|
906
1128
|
t instanceof DOMException ? t.name : "Could not access the microphone"
|
|
907
1129
|
);
|
|
908
1130
|
}
|
|
@@ -913,23 +1135,23 @@ class ze {
|
|
|
913
1135
|
try {
|
|
914
1136
|
t = JSON.parse(e);
|
|
915
1137
|
} catch {
|
|
916
|
-
this.loggedParseFailure || (this.loggedParseFailure = !0,
|
|
1138
|
+
this.loggedParseFailure || (this.loggedParseFailure = !0, k.error("dictation server event was not valid JSON", {
|
|
917
1139
|
snippet: e.slice(0, 120)
|
|
918
1140
|
}));
|
|
919
1141
|
return;
|
|
920
1142
|
}
|
|
921
|
-
const o =
|
|
1143
|
+
const o = Te(t);
|
|
922
1144
|
if (!o) return;
|
|
923
|
-
const { type:
|
|
924
|
-
if (
|
|
1145
|
+
const { type: r, delta: l } = o;
|
|
1146
|
+
if (r === "session.created" || r === "transcription_session.created") {
|
|
925
1147
|
this.setState("listening");
|
|
926
1148
|
return;
|
|
927
1149
|
}
|
|
928
|
-
if (
|
|
1150
|
+
if (r === "conversation.item.input_audio_transcription.delta" && l) {
|
|
929
1151
|
this.state === "connecting" && this.setState("listening"), this.onDelta(l);
|
|
930
1152
|
return;
|
|
931
1153
|
}
|
|
932
|
-
|
|
1154
|
+
r === "error" && (k.error("dictation server event error", {
|
|
933
1155
|
_e: o.errorMessage ?? "unknown"
|
|
934
1156
|
}), this.fail("unavailable"));
|
|
935
1157
|
}
|
|
@@ -938,22 +1160,22 @@ class ze {
|
|
|
938
1160
|
try {
|
|
939
1161
|
const t = new AudioContext();
|
|
940
1162
|
this.audioContext = t;
|
|
941
|
-
const o = t.createMediaStreamSource(e),
|
|
942
|
-
|
|
943
|
-
const l = new Uint8Array(
|
|
944
|
-
var
|
|
945
|
-
|
|
946
|
-
let
|
|
947
|
-
for (let
|
|
948
|
-
const
|
|
949
|
-
|
|
1163
|
+
const o = t.createMediaStreamSource(e), r = t.createAnalyser();
|
|
1164
|
+
r.fftSize = 512, o.connect(r);
|
|
1165
|
+
const l = new Uint8Array(r.frequencyBinCount), s = () => {
|
|
1166
|
+
var c;
|
|
1167
|
+
r.getByteTimeDomainData(l);
|
|
1168
|
+
let a = 0;
|
|
1169
|
+
for (let d = 0; d < l.length; d++) {
|
|
1170
|
+
const _ = ((l[d] ?? 128) - 128) / 128;
|
|
1171
|
+
a += _ * _;
|
|
950
1172
|
}
|
|
951
|
-
const
|
|
952
|
-
(
|
|
1173
|
+
const n = Math.sqrt(a / l.length);
|
|
1174
|
+
(c = this.onLevel) == null || c.call(this, Math.min(1, n * 4)), this.levelRaf = requestAnimationFrame(s);
|
|
953
1175
|
};
|
|
954
|
-
this.levelRaf = requestAnimationFrame(
|
|
1176
|
+
this.levelRaf = requestAnimationFrame(s);
|
|
955
1177
|
} catch (t) {
|
|
956
|
-
|
|
1178
|
+
k.error("dictation level meter unavailable", {
|
|
957
1179
|
_e: t instanceof Error ? t.message : String(t)
|
|
958
1180
|
});
|
|
959
1181
|
}
|
|
@@ -965,9 +1187,9 @@ class ze {
|
|
|
965
1187
|
this.isTornDown() || (this.teardown(), this.setState("error"), this.onError(e));
|
|
966
1188
|
}
|
|
967
1189
|
teardown() {
|
|
968
|
-
var e, t, o,
|
|
969
|
-
this.timers.forEach((l) => clearTimeout(l)), this.timers = [], this.levelRaf && cancelAnimationFrame(this.levelRaf), this.levelRaf = 0, (e = this.dc) == null || e.close(), this.dc = null, (t = this.pc) == null || t.close(), this.pc = null, (o = this.stream) == null || o.getTracks().forEach((l) => l.stop()), this.stream = null, (
|
|
970
|
-
|
|
1190
|
+
var e, t, o, r;
|
|
1191
|
+
this.timers.forEach((l) => clearTimeout(l)), this.timers = [], this.levelRaf && cancelAnimationFrame(this.levelRaf), this.levelRaf = 0, (e = this.dc) == null || e.close(), this.dc = null, (t = this.pc) == null || t.close(), this.pc = null, (o = this.stream) == null || o.getTracks().forEach((l) => l.stop()), this.stream = null, (r = this.audioContext) == null || r.close().catch((l) => {
|
|
1192
|
+
k.error("failed to close dictation audio context", {
|
|
971
1193
|
_e: String(l)
|
|
972
1194
|
});
|
|
973
1195
|
}), this.audioContext = null;
|
|
@@ -976,71 +1198,71 @@ class ze {
|
|
|
976
1198
|
this.state !== e && (this.state = e, this.onState(e));
|
|
977
1199
|
}
|
|
978
1200
|
}
|
|
979
|
-
const
|
|
980
|
-
class
|
|
1201
|
+
const Ke = 1300, Le = { status: "idle", error: null };
|
|
1202
|
+
class Fe {
|
|
981
1203
|
constructor({ api: e, config: t }) {
|
|
982
|
-
this.state = new
|
|
1204
|
+
this.state = new S(Le), this.levelRef = { current: 0 }, this.mintCache = new Pe(), this.session = null, this.target = null, this.prefix = "", this.raw = "", this.processed = "", this.displayed = "", this.dripTimer = null, this.silenceTimer = null, this.isActive = () => this.session !== null, this.prewarm = () => {
|
|
983
1205
|
this.mintToken().catch((o) => {
|
|
984
|
-
this.mintCache.clear(),
|
|
1206
|
+
this.mintCache.clear(), k.error("dictation token prewarm failed", {
|
|
985
1207
|
_e: o instanceof Error ? o.message : String(o)
|
|
986
1208
|
});
|
|
987
1209
|
});
|
|
988
1210
|
}, this.start = (o) => {
|
|
989
|
-
this.session && this.teardown(), this.target = o, this.language =
|
|
1211
|
+
this.session && this.teardown(), this.target = o, this.language = H.languageHint(
|
|
990
1212
|
this.config.language ?? navigator.language
|
|
991
1213
|
), this.prefix = o.getValue(), this.raw = "", this.processed = "", this.displayed = "";
|
|
992
|
-
const
|
|
1214
|
+
const r = new Re({
|
|
993
1215
|
mintToken: this.mintToken,
|
|
994
1216
|
onLevel: (l) => {
|
|
995
1217
|
this.levelRef.current = l;
|
|
996
1218
|
},
|
|
997
1219
|
onState: (l) => {
|
|
998
|
-
|
|
1220
|
+
r === this.session && (l === "connecting" && this.state.set({ status: "connecting", error: null }), l === "listening" && this.state.set({ status: "listening", error: null }), l === "stopped" && this.teardown());
|
|
999
1221
|
},
|
|
1000
1222
|
onError: (l) => {
|
|
1001
|
-
|
|
1223
|
+
r === this.session && (this.mintCache.clear(), this.teardown({ error: l, executeFinalCommand: !1 }));
|
|
1002
1224
|
},
|
|
1003
1225
|
onDelta: (l) => {
|
|
1004
|
-
if (
|
|
1226
|
+
if (r !== this.session || !this.target) return;
|
|
1005
1227
|
if (!this.isConsistent()) {
|
|
1006
1228
|
this.teardown();
|
|
1007
1229
|
return;
|
|
1008
1230
|
}
|
|
1009
1231
|
this.raw += l;
|
|
1010
|
-
const
|
|
1011
|
-
if (
|
|
1232
|
+
const s = this.ingest();
|
|
1233
|
+
if (s === "stop") {
|
|
1012
1234
|
this.teardown();
|
|
1013
1235
|
return;
|
|
1014
1236
|
}
|
|
1015
|
-
if (
|
|
1237
|
+
if (s === "send") {
|
|
1016
1238
|
this.teardown({ send: !0 });
|
|
1017
1239
|
return;
|
|
1018
1240
|
}
|
|
1019
|
-
this.stopSilenceTimer(),
|
|
1241
|
+
this.stopSilenceTimer(), q.pendingTailIsCompletePhrase(
|
|
1020
1242
|
this.raw,
|
|
1021
1243
|
this.language
|
|
1022
1244
|
) && (this.silenceTimer = setTimeout(() => {
|
|
1023
|
-
if (
|
|
1245
|
+
if (r !== this.session) return;
|
|
1024
1246
|
this.raw = `${this.raw}.`;
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
},
|
|
1247
|
+
const a = this.ingest();
|
|
1248
|
+
a === "stop" ? this.teardown() : a === "send" && this.teardown({ send: !0 });
|
|
1249
|
+
}, Ke));
|
|
1028
1250
|
}
|
|
1029
1251
|
});
|
|
1030
|
-
this.session =
|
|
1252
|
+
this.session = r, this.state.set({ status: "connecting", error: null }), this.dripTimer = setInterval(() => {
|
|
1031
1253
|
if (this.target && this.processed !== this.displayed) {
|
|
1032
1254
|
if (!this.isConsistent()) {
|
|
1033
1255
|
this.teardown();
|
|
1034
1256
|
return;
|
|
1035
1257
|
}
|
|
1036
1258
|
this.applyDisplayed(
|
|
1037
|
-
|
|
1259
|
+
H.nextDripText({
|
|
1038
1260
|
displayed: this.displayed,
|
|
1039
1261
|
processed: this.processed
|
|
1040
1262
|
})
|
|
1041
1263
|
);
|
|
1042
1264
|
}
|
|
1043
|
-
},
|
|
1265
|
+
}, qe), r.start();
|
|
1044
1266
|
}, this.stop = () => {
|
|
1045
1267
|
this.session && this.teardown();
|
|
1046
1268
|
}, this.mintToken = async () => this.mintCache.resolve(
|
|
@@ -1057,7 +1279,7 @@ class qe {
|
|
|
1057
1279
|
/** Process the transcript and apply the outcome. Shared by the delta path,
|
|
1058
1280
|
* the silence timer, and (with `final`) teardown. Returns the control. */
|
|
1059
1281
|
ingest(e) {
|
|
1060
|
-
const t =
|
|
1282
|
+
const t = q.process(this.raw, {
|
|
1061
1283
|
language: this.language,
|
|
1062
1284
|
final: e == null ? void 0 : e.final
|
|
1063
1285
|
});
|
|
@@ -1070,15 +1292,15 @@ class qe {
|
|
|
1070
1292
|
var l;
|
|
1071
1293
|
const t = this.session, o = this.target;
|
|
1072
1294
|
this.dripTimer && clearInterval(this.dripTimer), this.dripTimer = null, this.stopSilenceTimer();
|
|
1073
|
-
let
|
|
1295
|
+
let r = (e == null ? void 0 : e.send) ?? !1;
|
|
1074
1296
|
if (o && this.isConsistent()) {
|
|
1075
|
-
const
|
|
1076
|
-
(e == null ? void 0 : e.executeFinalCommand) !== !1 &&
|
|
1297
|
+
const s = this.ingest({ final: !0 });
|
|
1298
|
+
(e == null ? void 0 : e.executeFinalCommand) !== !1 && s === "send" && (r = !0), this.processed !== this.displayed && this.applyDisplayed(this.processed);
|
|
1077
1299
|
}
|
|
1078
|
-
this.session = null, this.target = null, t == null || t.stop(), this.levelRef.current = 0, this.state.set({ status: "idle", error: (e == null ? void 0 : e.error) ?? null }),
|
|
1300
|
+
this.session = null, this.target = null, t == null || t.stop(), this.levelRef.current = 0, this.state.set({ status: "idle", error: (e == null ? void 0 : e.error) ?? null }), r && ((l = o == null ? void 0 : o.onSend) == null || l.call(o));
|
|
1079
1301
|
}
|
|
1080
1302
|
}
|
|
1081
|
-
const
|
|
1303
|
+
const Oe = {
|
|
1082
1304
|
write_a_message_placeholder: "اكتب رسالة...",
|
|
1083
1305
|
your_issue_has_been_resolved: "تم حل مشكلتك!",
|
|
1084
1306
|
new_conversation: "محادثة جديدة",
|
|
@@ -1102,7 +1324,19 @@ const Ee = {
|
|
|
1102
1324
|
companion_layout_floating: "عائم",
|
|
1103
1325
|
companion_layout_sidebar: "الشريط الجانبي",
|
|
1104
1326
|
companion_layout_fullscreen: "ملء الشاشة",
|
|
1327
|
+
companion_close_chat: "إغلاق {title}",
|
|
1105
1328
|
companion_close: "إغلاق",
|
|
1329
|
+
companion_switch_chat: "تبديل المحادثة",
|
|
1330
|
+
companion_viewing: "تعرض الآن",
|
|
1331
|
+
companion_working: "قيد العمل",
|
|
1332
|
+
companion_open: "مفتوحة",
|
|
1333
|
+
companion_closed: "مغلقة",
|
|
1334
|
+
companion_draft: "مسودة",
|
|
1335
|
+
companion_chats: "الجلسات النشطة",
|
|
1336
|
+
companion_chat_number: "محادثة {count}",
|
|
1337
|
+
companion_active_chats: "{count} جلسات نشطة",
|
|
1338
|
+
companion_other_sessions: "الجلسات المفتوحة الأخرى: {count}",
|
|
1339
|
+
companion_working_chats: "{count} قيد العمل",
|
|
1106
1340
|
companion_history: "سجل المحادثات",
|
|
1107
1341
|
companion_expand_chat: "توسيع المحادثة",
|
|
1108
1342
|
companion_sidebar_dock_label: "الإرساء",
|
|
@@ -1165,8 +1399,17 @@ const Ee = {
|
|
|
1165
1399
|
questions_next: "التالي",
|
|
1166
1400
|
questions_send: "إرسال",
|
|
1167
1401
|
questions_type_answer: "سأكتبها بنفسي",
|
|
1168
|
-
questions_answer_placeholder: "اكتب إجابتك…"
|
|
1169
|
-
|
|
1402
|
+
questions_answer_placeholder: "اكتب إجابتك…",
|
|
1403
|
+
close_conversation_title: "إغلاق المحادثة",
|
|
1404
|
+
close_conversation_description: "هل أنت متأكد أنك تريد إغلاق هذه المحادثة؟",
|
|
1405
|
+
close_conversation_cancel: "لا",
|
|
1406
|
+
close_conversation_confirm: "نعم",
|
|
1407
|
+
dialog_close: "إغلاق",
|
|
1408
|
+
zoom_in: "تكبير",
|
|
1409
|
+
zoom_out: "تصغير",
|
|
1410
|
+
reset_zoom: "إعادة تعيين التكبير",
|
|
1411
|
+
support_chat_aria_label: "دردشة الدعم"
|
|
1412
|
+
}, Ue = {
|
|
1170
1413
|
write_a_message_placeholder: "একটি বার্তা লিখুন...",
|
|
1171
1414
|
your_issue_has_been_resolved: "আপনার সমস্যা সমাধান হয়েছে!",
|
|
1172
1415
|
new_conversation: "নতুন কথোপকথন",
|
|
@@ -1253,8 +1496,17 @@ const Ee = {
|
|
|
1253
1496
|
questions_next: "পরবর্তী",
|
|
1254
1497
|
questions_send: "পাঠান",
|
|
1255
1498
|
questions_type_answer: "আমি লিখে দিচ্ছি",
|
|
1256
|
-
questions_answer_placeholder: "আপনার উত্তর লিখুন…"
|
|
1257
|
-
|
|
1499
|
+
questions_answer_placeholder: "আপনার উত্তর লিখুন…",
|
|
1500
|
+
close_conversation_title: "কথোপকথন বন্ধ করুন",
|
|
1501
|
+
close_conversation_description: "আপনি কি নিশ্চিত যে আপনি এই কথোপকথনটি বন্ধ করতে চান?",
|
|
1502
|
+
close_conversation_cancel: "না",
|
|
1503
|
+
close_conversation_confirm: "হ্যাঁ",
|
|
1504
|
+
dialog_close: "বন্ধ করুন",
|
|
1505
|
+
zoom_in: "বড় করুন",
|
|
1506
|
+
zoom_out: "ছোট করুন",
|
|
1507
|
+
reset_zoom: "জুম রিসেট করুন",
|
|
1508
|
+
support_chat_aria_label: "সাপোর্ট চ্যাট"
|
|
1509
|
+
}, Be = {
|
|
1258
1510
|
write_a_message_placeholder: "Напишете съобщение...",
|
|
1259
1511
|
your_issue_has_been_resolved: "Вашият проблем е разрешен!",
|
|
1260
1512
|
new_conversation: "Нов разговор",
|
|
@@ -1341,8 +1593,17 @@ const Ee = {
|
|
|
1341
1593
|
questions_next: "Напред",
|
|
1342
1594
|
questions_send: "Изпрати",
|
|
1343
1595
|
questions_type_answer: "Ще напиша сам",
|
|
1344
|
-
questions_answer_placeholder: "Напишете отговора си…"
|
|
1345
|
-
|
|
1596
|
+
questions_answer_placeholder: "Напишете отговора си…",
|
|
1597
|
+
close_conversation_title: "Затваряне на разговора",
|
|
1598
|
+
close_conversation_description: "Сигурни ли сте, че искате да затворите този разговор?",
|
|
1599
|
+
close_conversation_cancel: "Не",
|
|
1600
|
+
close_conversation_confirm: "Да",
|
|
1601
|
+
dialog_close: "Затваряне",
|
|
1602
|
+
zoom_in: "Увеличаване",
|
|
1603
|
+
zoom_out: "Намаляване",
|
|
1604
|
+
reset_zoom: "Нулиране на мащаба",
|
|
1605
|
+
support_chat_aria_label: "Чат за поддръжка"
|
|
1606
|
+
}, Ve = {
|
|
1346
1607
|
write_a_message_placeholder: "Napište zprávu...",
|
|
1347
1608
|
your_issue_has_been_resolved: "Váš problém byl vyřešen!",
|
|
1348
1609
|
new_conversation: "Nová konverzace",
|
|
@@ -1429,8 +1690,17 @@ const Ee = {
|
|
|
1429
1690
|
questions_next: "Další",
|
|
1430
1691
|
questions_send: "Odeslat",
|
|
1431
1692
|
questions_type_answer: "Napíšu to sám",
|
|
1432
|
-
questions_answer_placeholder: "Napište svou odpověď…"
|
|
1433
|
-
|
|
1693
|
+
questions_answer_placeholder: "Napište svou odpověď…",
|
|
1694
|
+
close_conversation_title: "Uzavřít konverzaci",
|
|
1695
|
+
close_conversation_description: "Opravdu chcete tuto konverzaci uzavřít?",
|
|
1696
|
+
close_conversation_cancel: "Ne",
|
|
1697
|
+
close_conversation_confirm: "Ano",
|
|
1698
|
+
dialog_close: "Zavřít",
|
|
1699
|
+
zoom_in: "Přiblížit",
|
|
1700
|
+
zoom_out: "Oddálit",
|
|
1701
|
+
reset_zoom: "Obnovit přiblížení",
|
|
1702
|
+
support_chat_aria_label: "Chat podpory"
|
|
1703
|
+
}, He = {
|
|
1434
1704
|
write_a_message_placeholder: "Skriv en besked...",
|
|
1435
1705
|
your_issue_has_been_resolved: "Dit problem er løst!",
|
|
1436
1706
|
new_conversation: "Ny samtale",
|
|
@@ -1517,8 +1787,17 @@ const Ee = {
|
|
|
1517
1787
|
questions_next: "Næste",
|
|
1518
1788
|
questions_send: "Send",
|
|
1519
1789
|
questions_type_answer: "Jeg skriver det selv",
|
|
1520
|
-
questions_answer_placeholder: "Skriv dit svar…"
|
|
1521
|
-
|
|
1790
|
+
questions_answer_placeholder: "Skriv dit svar…",
|
|
1791
|
+
close_conversation_title: "Luk samtale",
|
|
1792
|
+
close_conversation_description: "Er du sikker på, at du vil lukke denne samtale?",
|
|
1793
|
+
close_conversation_cancel: "Nej",
|
|
1794
|
+
close_conversation_confirm: "Ja",
|
|
1795
|
+
dialog_close: "Luk",
|
|
1796
|
+
zoom_in: "Zoom ind",
|
|
1797
|
+
zoom_out: "Zoom ud",
|
|
1798
|
+
reset_zoom: "Nulstil zoom",
|
|
1799
|
+
support_chat_aria_label: "Supportchat"
|
|
1800
|
+
}, Ze = {
|
|
1522
1801
|
write_a_message_placeholder: "Γράψτε ένα μήνυμα...",
|
|
1523
1802
|
your_issue_has_been_resolved: "Το πρόβλημά σας επιλύθηκε!",
|
|
1524
1803
|
new_conversation: "Νέα συνομιλία",
|
|
@@ -1605,8 +1884,17 @@ const Ee = {
|
|
|
1605
1884
|
questions_next: "Επόμενο",
|
|
1606
1885
|
questions_send: "Αποστολή",
|
|
1607
1886
|
questions_type_answer: "Θα το γράψω",
|
|
1608
|
-
questions_answer_placeholder: "Γράψτε την απάντησή σας…"
|
|
1609
|
-
|
|
1887
|
+
questions_answer_placeholder: "Γράψτε την απάντησή σας…",
|
|
1888
|
+
close_conversation_title: "Κλείσιμο συνομιλίας",
|
|
1889
|
+
close_conversation_description: "Είστε βέβαιοι ότι θέλετε να κλείσετε αυτήν τη συνομιλία;",
|
|
1890
|
+
close_conversation_cancel: "Όχι",
|
|
1891
|
+
close_conversation_confirm: "Ναι",
|
|
1892
|
+
dialog_close: "Κλείσιμο",
|
|
1893
|
+
zoom_in: "Μεγέθυνση",
|
|
1894
|
+
zoom_out: "Σμίκρυνση",
|
|
1895
|
+
reset_zoom: "Επαναφορά ζουμ",
|
|
1896
|
+
support_chat_aria_label: "Συνομιλία υποστήριξης"
|
|
1897
|
+
}, We = {
|
|
1610
1898
|
write_a_message_placeholder: "Nachricht schreiben...",
|
|
1611
1899
|
your_issue_has_been_resolved: "Ihr Problem wurde gelöst!",
|
|
1612
1900
|
new_conversation: "Neue Konversation",
|
|
@@ -1693,8 +1981,17 @@ const Ee = {
|
|
|
1693
1981
|
questions_next: "Weiter",
|
|
1694
1982
|
questions_send: "Senden",
|
|
1695
1983
|
questions_type_answer: "Ich schreibe es selbst",
|
|
1696
|
-
questions_answer_placeholder: "Antwort eingeben…"
|
|
1697
|
-
|
|
1984
|
+
questions_answer_placeholder: "Antwort eingeben…",
|
|
1985
|
+
close_conversation_title: "Konversation schließen",
|
|
1986
|
+
close_conversation_description: "Möchten Sie diese Konversation wirklich schließen?",
|
|
1987
|
+
close_conversation_cancel: "Nein",
|
|
1988
|
+
close_conversation_confirm: "Ja",
|
|
1989
|
+
dialog_close: "Schließen",
|
|
1990
|
+
zoom_in: "Vergrößern",
|
|
1991
|
+
zoom_out: "Verkleinern",
|
|
1992
|
+
reset_zoom: "Zoom zurücksetzen",
|
|
1993
|
+
support_chat_aria_label: "Support-Chat"
|
|
1994
|
+
}, J = {
|
|
1698
1995
|
write_a_message_placeholder: "Write a message...",
|
|
1699
1996
|
your_issue_has_been_resolved: "Your issue has been resolved!",
|
|
1700
1997
|
new_conversation: "New conversation",
|
|
@@ -1718,7 +2015,19 @@ const Ee = {
|
|
|
1718
2015
|
companion_layout_floating: "Floating",
|
|
1719
2016
|
companion_layout_sidebar: "Sidebar",
|
|
1720
2017
|
companion_layout_fullscreen: "Fullscreen",
|
|
2018
|
+
companion_close_chat: "Close {title}",
|
|
1721
2019
|
companion_close: "Close",
|
|
2020
|
+
companion_switch_chat: "Switch chat",
|
|
2021
|
+
companion_viewing: "Viewing",
|
|
2022
|
+
companion_working: "Working",
|
|
2023
|
+
companion_open: "Open",
|
|
2024
|
+
companion_closed: "Closed",
|
|
2025
|
+
companion_draft: "Draft",
|
|
2026
|
+
companion_chats: "Active sessions",
|
|
2027
|
+
companion_chat_number: "Chat {count}",
|
|
2028
|
+
companion_active_chats: "{count} active sessions",
|
|
2029
|
+
companion_other_sessions: "Other open sessions: {count}",
|
|
2030
|
+
companion_working_chats: "{count} working",
|
|
1722
2031
|
companion_history: "Conversation history",
|
|
1723
2032
|
companion_expand_chat: "Expand chat",
|
|
1724
2033
|
companion_sidebar_dock_label: "Dock",
|
|
@@ -1781,8 +2090,17 @@ const Ee = {
|
|
|
1781
2090
|
questions_next: "Next",
|
|
1782
2091
|
questions_send: "Send",
|
|
1783
2092
|
questions_type_answer: "I'll type it",
|
|
1784
|
-
questions_answer_placeholder: "Type your answer…"
|
|
1785
|
-
|
|
2093
|
+
questions_answer_placeholder: "Type your answer…",
|
|
2094
|
+
close_conversation_title: "Close conversation",
|
|
2095
|
+
close_conversation_description: "Are you sure you want to close this conversation?",
|
|
2096
|
+
close_conversation_cancel: "No",
|
|
2097
|
+
close_conversation_confirm: "Yes",
|
|
2098
|
+
dialog_close: "Close",
|
|
2099
|
+
zoom_in: "Zoom in",
|
|
2100
|
+
zoom_out: "Zoom out",
|
|
2101
|
+
reset_zoom: "Reset zoom",
|
|
2102
|
+
support_chat_aria_label: "Support chat"
|
|
2103
|
+
}, Ge = {
|
|
1786
2104
|
write_a_message_placeholder: "Escribe un mensaje...",
|
|
1787
2105
|
your_issue_has_been_resolved: "¡Tu problema fue resuelto!",
|
|
1788
2106
|
new_conversation: "Nueva conversación",
|
|
@@ -1869,8 +2187,17 @@ const Ee = {
|
|
|
1869
2187
|
questions_next: "Siguiente",
|
|
1870
2188
|
questions_send: "Enviar",
|
|
1871
2189
|
questions_type_answer: "Lo escribo yo",
|
|
1872
|
-
questions_answer_placeholder: "Escribe tu respuesta…"
|
|
1873
|
-
|
|
2190
|
+
questions_answer_placeholder: "Escribe tu respuesta…",
|
|
2191
|
+
close_conversation_title: "Cerrar conversación",
|
|
2192
|
+
close_conversation_description: "¿Seguro que quieres cerrar esta conversación?",
|
|
2193
|
+
close_conversation_cancel: "No",
|
|
2194
|
+
close_conversation_confirm: "Sí",
|
|
2195
|
+
dialog_close: "Cerrar",
|
|
2196
|
+
zoom_in: "Acercar",
|
|
2197
|
+
zoom_out: "Alejar",
|
|
2198
|
+
reset_zoom: "Restablecer zoom",
|
|
2199
|
+
support_chat_aria_label: "Chat de soporte"
|
|
2200
|
+
}, $e = {
|
|
1874
2201
|
write_a_message_placeholder: "Magsulat ng mensahe...",
|
|
1875
2202
|
your_issue_has_been_resolved: "Nalutas na ang iyong isyu!",
|
|
1876
2203
|
new_conversation: "Bagong usapan",
|
|
@@ -1957,8 +2284,17 @@ const Ee = {
|
|
|
1957
2284
|
questions_next: "Susunod",
|
|
1958
2285
|
questions_send: "Ipadala",
|
|
1959
2286
|
questions_type_answer: "Ako na ang magta-type",
|
|
1960
|
-
questions_answer_placeholder: "I-type ang iyong sagot…"
|
|
1961
|
-
|
|
2287
|
+
questions_answer_placeholder: "I-type ang iyong sagot…",
|
|
2288
|
+
close_conversation_title: "Isara ang usapan",
|
|
2289
|
+
close_conversation_description: "Sigurado ka bang gusto mong isara ang usapang ito?",
|
|
2290
|
+
close_conversation_cancel: "Hindi",
|
|
2291
|
+
close_conversation_confirm: "Oo",
|
|
2292
|
+
dialog_close: "Isara",
|
|
2293
|
+
zoom_in: "Palakihin",
|
|
2294
|
+
zoom_out: "Paliitin",
|
|
2295
|
+
reset_zoom: "I-reset ang zoom",
|
|
2296
|
+
support_chat_aria_label: "Chat ng suporta"
|
|
2297
|
+
}, Je = {
|
|
1962
2298
|
write_a_message_placeholder: "Kirjoita viesti...",
|
|
1963
2299
|
your_issue_has_been_resolved: "Ongelmasi on ratkaistu!",
|
|
1964
2300
|
new_conversation: "Uusi keskustelu",
|
|
@@ -2045,8 +2381,17 @@ const Ee = {
|
|
|
2045
2381
|
questions_next: "Seuraava",
|
|
2046
2382
|
questions_send: "Lähetä",
|
|
2047
2383
|
questions_type_answer: "Kirjoitan itse",
|
|
2048
|
-
questions_answer_placeholder: "Kirjoita vastauksesi…"
|
|
2049
|
-
|
|
2384
|
+
questions_answer_placeholder: "Kirjoita vastauksesi…",
|
|
2385
|
+
close_conversation_title: "Sulje keskustelu",
|
|
2386
|
+
close_conversation_description: "Haluatko varmasti sulkea tämän keskustelun?",
|
|
2387
|
+
close_conversation_cancel: "Ei",
|
|
2388
|
+
close_conversation_confirm: "Kyllä",
|
|
2389
|
+
dialog_close: "Sulje",
|
|
2390
|
+
zoom_in: "Lähennä",
|
|
2391
|
+
zoom_out: "Loitonna",
|
|
2392
|
+
reset_zoom: "Palauta zoomaus",
|
|
2393
|
+
support_chat_aria_label: "Tukichat"
|
|
2394
|
+
}, Ye = {
|
|
2050
2395
|
write_a_message_placeholder: "Écrivez un message...",
|
|
2051
2396
|
your_issue_has_been_resolved: "Votre problème a été résolu !",
|
|
2052
2397
|
new_conversation: "Nouvelle conversation",
|
|
@@ -2133,8 +2478,17 @@ const Ee = {
|
|
|
2133
2478
|
questions_next: "Suivant",
|
|
2134
2479
|
questions_send: "Envoyer",
|
|
2135
2480
|
questions_type_answer: "Je préfère écrire",
|
|
2136
|
-
questions_answer_placeholder: "Écrivez votre réponse…"
|
|
2137
|
-
|
|
2481
|
+
questions_answer_placeholder: "Écrivez votre réponse…",
|
|
2482
|
+
close_conversation_title: "Fermer la conversation",
|
|
2483
|
+
close_conversation_description: "Voulez-vous vraiment fermer cette conversation ?",
|
|
2484
|
+
close_conversation_cancel: "Non",
|
|
2485
|
+
close_conversation_confirm: "Oui",
|
|
2486
|
+
dialog_close: "Fermer",
|
|
2487
|
+
zoom_in: "Zoom avant",
|
|
2488
|
+
zoom_out: "Zoom arrière",
|
|
2489
|
+
reset_zoom: "Réinitialiser le zoom",
|
|
2490
|
+
support_chat_aria_label: "Chat de support"
|
|
2491
|
+
}, Qe = {
|
|
2138
2492
|
write_a_message_placeholder: "एक संदेश लिखें...",
|
|
2139
2493
|
your_issue_has_been_resolved: "आपकी समस्या हल हो गई है!",
|
|
2140
2494
|
new_conversation: "नई बातचीत",
|
|
@@ -2221,8 +2575,17 @@ const Ee = {
|
|
|
2221
2575
|
questions_next: "आगे",
|
|
2222
2576
|
questions_send: "भेजें",
|
|
2223
2577
|
questions_type_answer: "मैं खुद लिखूंगा",
|
|
2224
|
-
questions_answer_placeholder: "अपना उत्तर लिखें…"
|
|
2225
|
-
|
|
2578
|
+
questions_answer_placeholder: "अपना उत्तर लिखें…",
|
|
2579
|
+
close_conversation_title: "बातचीत बंद करें",
|
|
2580
|
+
close_conversation_description: "क्या आप वाकई इस बातचीत को बंद करना चाहते हैं?",
|
|
2581
|
+
close_conversation_cancel: "नहीं",
|
|
2582
|
+
close_conversation_confirm: "हाँ",
|
|
2583
|
+
dialog_close: "बंद करें",
|
|
2584
|
+
zoom_in: "ज़ूम इन",
|
|
2585
|
+
zoom_out: "ज़ूम आउट",
|
|
2586
|
+
reset_zoom: "ज़ूम रीसेट करें",
|
|
2587
|
+
support_chat_aria_label: "सहायता चैट"
|
|
2588
|
+
}, Xe = {
|
|
2226
2589
|
write_a_message_placeholder: "Scrivi un messaggio...",
|
|
2227
2590
|
your_issue_has_been_resolved: "Il tuo problema è stato risolto!",
|
|
2228
2591
|
new_conversation: "Nuova conversazione",
|
|
@@ -2309,8 +2672,17 @@ const Ee = {
|
|
|
2309
2672
|
questions_next: "Avanti",
|
|
2310
2673
|
questions_send: "Invia",
|
|
2311
2674
|
questions_type_answer: "Lo scrivo io",
|
|
2312
|
-
questions_answer_placeholder: "Scrivi la tua risposta…"
|
|
2313
|
-
|
|
2675
|
+
questions_answer_placeholder: "Scrivi la tua risposta…",
|
|
2676
|
+
close_conversation_title: "Chiudi conversazione",
|
|
2677
|
+
close_conversation_description: "Vuoi davvero chiudere questa conversazione?",
|
|
2678
|
+
close_conversation_cancel: "No",
|
|
2679
|
+
close_conversation_confirm: "Sì",
|
|
2680
|
+
dialog_close: "Chiudi",
|
|
2681
|
+
zoom_in: "Ingrandisci",
|
|
2682
|
+
zoom_out: "Riduci",
|
|
2683
|
+
reset_zoom: "Reimposta zoom",
|
|
2684
|
+
support_chat_aria_label: "Chat di supporto"
|
|
2685
|
+
}, ea = {
|
|
2314
2686
|
write_a_message_placeholder: "メッセージを入力...",
|
|
2315
2687
|
your_issue_has_been_resolved: "問題が解決しました!",
|
|
2316
2688
|
new_conversation: "新しい会話",
|
|
@@ -2397,8 +2769,17 @@ const Ee = {
|
|
|
2397
2769
|
questions_next: "次へ",
|
|
2398
2770
|
questions_send: "送信",
|
|
2399
2771
|
questions_type_answer: "自分で入力する",
|
|
2400
|
-
questions_answer_placeholder: "回答を入力してください…"
|
|
2401
|
-
|
|
2772
|
+
questions_answer_placeholder: "回答を入力してください…",
|
|
2773
|
+
close_conversation_title: "会話を終了",
|
|
2774
|
+
close_conversation_description: "この会話を終了してもよろしいですか?",
|
|
2775
|
+
close_conversation_cancel: "いいえ",
|
|
2776
|
+
close_conversation_confirm: "はい",
|
|
2777
|
+
dialog_close: "閉じる",
|
|
2778
|
+
zoom_in: "拡大",
|
|
2779
|
+
zoom_out: "縮小",
|
|
2780
|
+
reset_zoom: "ズームをリセット",
|
|
2781
|
+
support_chat_aria_label: "サポートチャット"
|
|
2782
|
+
}, aa = {
|
|
2402
2783
|
write_a_message_placeholder: "메시지를 입력하세요...",
|
|
2403
2784
|
your_issue_has_been_resolved: "문제가 해결되었습니다!",
|
|
2404
2785
|
new_conversation: "새 대화",
|
|
@@ -2485,8 +2866,17 @@ const Ee = {
|
|
|
2485
2866
|
questions_next: "다음",
|
|
2486
2867
|
questions_send: "보내기",
|
|
2487
2868
|
questions_type_answer: "직접 입력할게요",
|
|
2488
|
-
questions_answer_placeholder: "답변을 입력하세요…"
|
|
2489
|
-
|
|
2869
|
+
questions_answer_placeholder: "답변을 입력하세요…",
|
|
2870
|
+
close_conversation_title: "대화 종료",
|
|
2871
|
+
close_conversation_description: "이 대화를 종료하시겠습니까?",
|
|
2872
|
+
close_conversation_cancel: "아니요",
|
|
2873
|
+
close_conversation_confirm: "예",
|
|
2874
|
+
dialog_close: "닫기",
|
|
2875
|
+
zoom_in: "확대",
|
|
2876
|
+
zoom_out: "축소",
|
|
2877
|
+
reset_zoom: "확대/축소 초기화",
|
|
2878
|
+
support_chat_aria_label: "고객 지원 채팅"
|
|
2879
|
+
}, ta = {
|
|
2490
2880
|
write_a_message_placeholder: "Schrijf een bericht...",
|
|
2491
2881
|
your_issue_has_been_resolved: "Uw probleem is opgelost!",
|
|
2492
2882
|
new_conversation: "Nieuw gesprek",
|
|
@@ -2573,8 +2963,17 @@ const Ee = {
|
|
|
2573
2963
|
questions_next: "Volgende",
|
|
2574
2964
|
questions_send: "Verzenden",
|
|
2575
2965
|
questions_type_answer: "Ik typ het zelf",
|
|
2576
|
-
questions_answer_placeholder: "Typ je antwoord…"
|
|
2577
|
-
|
|
2966
|
+
questions_answer_placeholder: "Typ je antwoord…",
|
|
2967
|
+
close_conversation_title: "Gesprek sluiten",
|
|
2968
|
+
close_conversation_description: "Weet je zeker dat je dit gesprek wilt sluiten?",
|
|
2969
|
+
close_conversation_cancel: "Nee",
|
|
2970
|
+
close_conversation_confirm: "Ja",
|
|
2971
|
+
dialog_close: "Sluiten",
|
|
2972
|
+
zoom_in: "Inzoomen",
|
|
2973
|
+
zoom_out: "Uitzoomen",
|
|
2974
|
+
reset_zoom: "Zoom herstellen",
|
|
2975
|
+
support_chat_aria_label: "Supportchat"
|
|
2976
|
+
}, sa = {
|
|
2578
2977
|
write_a_message_placeholder: "Skriv en melding...",
|
|
2579
2978
|
your_issue_has_been_resolved: "Problemet ditt er løst!",
|
|
2580
2979
|
new_conversation: "Ny samtale",
|
|
@@ -2661,8 +3060,17 @@ const Ee = {
|
|
|
2661
3060
|
questions_next: "Neste",
|
|
2662
3061
|
questions_send: "Send",
|
|
2663
3062
|
questions_type_answer: "Jeg skriver det selv",
|
|
2664
|
-
questions_answer_placeholder: "Skriv svaret ditt…"
|
|
2665
|
-
|
|
3063
|
+
questions_answer_placeholder: "Skriv svaret ditt…",
|
|
3064
|
+
close_conversation_title: "Lukk samtale",
|
|
3065
|
+
close_conversation_description: "Er du sikker på at du vil lukke denne samtalen?",
|
|
3066
|
+
close_conversation_cancel: "Nei",
|
|
3067
|
+
close_conversation_confirm: "Ja",
|
|
3068
|
+
dialog_close: "Lukk",
|
|
3069
|
+
zoom_in: "Zoom inn",
|
|
3070
|
+
zoom_out: "Zoom ut",
|
|
3071
|
+
reset_zoom: "Tilbakestill zoom",
|
|
3072
|
+
support_chat_aria_label: "Support-chat"
|
|
3073
|
+
}, oa = {
|
|
2666
3074
|
write_a_message_placeholder: "Napisz wiadomość...",
|
|
2667
3075
|
your_issue_has_been_resolved: "Twój problem został rozwiązany!",
|
|
2668
3076
|
new_conversation: "Nowa rozmowa",
|
|
@@ -2749,8 +3157,17 @@ const Ee = {
|
|
|
2749
3157
|
questions_next: "Dalej",
|
|
2750
3158
|
questions_send: "Wyślij",
|
|
2751
3159
|
questions_type_answer: "Napiszę sam",
|
|
2752
|
-
questions_answer_placeholder: "Wpisz swoją odpowiedź…"
|
|
2753
|
-
|
|
3160
|
+
questions_answer_placeholder: "Wpisz swoją odpowiedź…",
|
|
3161
|
+
close_conversation_title: "Zamknij rozmowę",
|
|
3162
|
+
close_conversation_description: "Czy na pewno chcesz zamknąć tę rozmowę?",
|
|
3163
|
+
close_conversation_cancel: "Nie",
|
|
3164
|
+
close_conversation_confirm: "Tak",
|
|
3165
|
+
dialog_close: "Zamknij",
|
|
3166
|
+
zoom_in: "Powiększ",
|
|
3167
|
+
zoom_out: "Pomniejsz",
|
|
3168
|
+
reset_zoom: "Resetuj powiększenie",
|
|
3169
|
+
support_chat_aria_label: "Czat pomocy"
|
|
3170
|
+
}, na = {
|
|
2754
3171
|
write_a_message_placeholder: "Escreva uma mensagem...",
|
|
2755
3172
|
your_issue_has_been_resolved: "Seu problema foi resolvido!",
|
|
2756
3173
|
new_conversation: "Nova conversa",
|
|
@@ -2837,8 +3254,17 @@ const Ee = {
|
|
|
2837
3254
|
questions_next: "Seguinte",
|
|
2838
3255
|
questions_send: "Enviar",
|
|
2839
3256
|
questions_type_answer: "Prefiro escrever",
|
|
2840
|
-
questions_answer_placeholder: "Escreva a sua resposta…"
|
|
2841
|
-
|
|
3257
|
+
questions_answer_placeholder: "Escreva a sua resposta…",
|
|
3258
|
+
close_conversation_title: "Encerrar conversa",
|
|
3259
|
+
close_conversation_description: "Tem certeza de que deseja encerrar esta conversa?",
|
|
3260
|
+
close_conversation_cancel: "Não",
|
|
3261
|
+
close_conversation_confirm: "Sim",
|
|
3262
|
+
dialog_close: "Fechar",
|
|
3263
|
+
zoom_in: "Ampliar",
|
|
3264
|
+
zoom_out: "Reduzir",
|
|
3265
|
+
reset_zoom: "Redefinir zoom",
|
|
3266
|
+
support_chat_aria_label: "Chat de suporte"
|
|
3267
|
+
}, ia = {
|
|
2842
3268
|
write_a_message_placeholder: "Scrie un mesaj...",
|
|
2843
3269
|
your_issue_has_been_resolved: "Problema ta a fost rezolvată!",
|
|
2844
3270
|
new_conversation: "Conversație nouă",
|
|
@@ -2925,8 +3351,17 @@ const Ee = {
|
|
|
2925
3351
|
questions_next: "Înainte",
|
|
2926
3352
|
questions_send: "Trimite",
|
|
2927
3353
|
questions_type_answer: "Scriu eu",
|
|
2928
|
-
questions_answer_placeholder: "Scrieți răspunsul dvs.…"
|
|
2929
|
-
|
|
3354
|
+
questions_answer_placeholder: "Scrieți răspunsul dvs.…",
|
|
3355
|
+
close_conversation_title: "Închide conversația",
|
|
3356
|
+
close_conversation_description: "Sigur vrei să închizi această conversație?",
|
|
3357
|
+
close_conversation_cancel: "Nu",
|
|
3358
|
+
close_conversation_confirm: "Da",
|
|
3359
|
+
dialog_close: "Închide",
|
|
3360
|
+
zoom_in: "Mărește",
|
|
3361
|
+
zoom_out: "Micșorează",
|
|
3362
|
+
reset_zoom: "Resetează zoomul",
|
|
3363
|
+
support_chat_aria_label: "Chat de asistență"
|
|
3364
|
+
}, ra = {
|
|
2930
3365
|
write_a_message_placeholder: "Skriv ett meddelande...",
|
|
2931
3366
|
your_issue_has_been_resolved: "Ditt problem har lösts!",
|
|
2932
3367
|
new_conversation: "Ny konversation",
|
|
@@ -3013,8 +3448,17 @@ const Ee = {
|
|
|
3013
3448
|
questions_next: "Nästa",
|
|
3014
3449
|
questions_send: "Skicka",
|
|
3015
3450
|
questions_type_answer: "Jag skriver själv",
|
|
3016
|
-
questions_answer_placeholder: "Skriv ditt svar…"
|
|
3017
|
-
|
|
3451
|
+
questions_answer_placeholder: "Skriv ditt svar…",
|
|
3452
|
+
close_conversation_title: "Avsluta konversation",
|
|
3453
|
+
close_conversation_description: "Är du säker på att du vill avsluta den här konversationen?",
|
|
3454
|
+
close_conversation_cancel: "Nej",
|
|
3455
|
+
close_conversation_confirm: "Ja",
|
|
3456
|
+
dialog_close: "Stäng",
|
|
3457
|
+
zoom_in: "Zooma in",
|
|
3458
|
+
zoom_out: "Zooma ut",
|
|
3459
|
+
reset_zoom: "Återställ zoom",
|
|
3460
|
+
support_chat_aria_label: "Supportchatt"
|
|
3461
|
+
}, _a = {
|
|
3018
3462
|
write_a_message_placeholder: "Напишите сообщение...",
|
|
3019
3463
|
your_issue_has_been_resolved: "Ваша проблема решена!",
|
|
3020
3464
|
new_conversation: "Новый разговор",
|
|
@@ -3101,8 +3545,17 @@ const Ee = {
|
|
|
3101
3545
|
questions_next: "Далее",
|
|
3102
3546
|
questions_send: "Отправить",
|
|
3103
3547
|
questions_type_answer: "Напишу сам",
|
|
3104
|
-
questions_answer_placeholder: "Напишите ваш ответ…"
|
|
3105
|
-
|
|
3548
|
+
questions_answer_placeholder: "Напишите ваш ответ…",
|
|
3549
|
+
close_conversation_title: "Закрыть разговор",
|
|
3550
|
+
close_conversation_description: "Вы уверены, что хотите закрыть этот разговор?",
|
|
3551
|
+
close_conversation_cancel: "Нет",
|
|
3552
|
+
close_conversation_confirm: "Да",
|
|
3553
|
+
dialog_close: "Закрыть",
|
|
3554
|
+
zoom_in: "Увеличить",
|
|
3555
|
+
zoom_out: "Уменьшить",
|
|
3556
|
+
reset_zoom: "Сбросить масштаб",
|
|
3557
|
+
support_chat_aria_label: "Чат поддержки"
|
|
3558
|
+
}, la = {
|
|
3106
3559
|
write_a_message_placeholder: "เขียนข้อความ...",
|
|
3107
3560
|
your_issue_has_been_resolved: "ปัญหาของคุณได้รับการแก้ไขแล้ว!",
|
|
3108
3561
|
new_conversation: "การสนทนาใหม่",
|
|
@@ -3189,8 +3642,17 @@ const Ee = {
|
|
|
3189
3642
|
questions_next: "ถัดไป",
|
|
3190
3643
|
questions_send: "ส่ง",
|
|
3191
3644
|
questions_type_answer: "ขอพิมพ์เอง",
|
|
3192
|
-
questions_answer_placeholder: "พิมพ์คำตอบของคุณ…"
|
|
3193
|
-
|
|
3645
|
+
questions_answer_placeholder: "พิมพ์คำตอบของคุณ…",
|
|
3646
|
+
close_conversation_title: "ปิดการสนทนา",
|
|
3647
|
+
close_conversation_description: "คุณแน่ใจหรือไม่ว่าต้องการปิดการสนทนานี้?",
|
|
3648
|
+
close_conversation_cancel: "ไม่",
|
|
3649
|
+
close_conversation_confirm: "ใช่",
|
|
3650
|
+
dialog_close: "ปิด",
|
|
3651
|
+
zoom_in: "ขยาย",
|
|
3652
|
+
zoom_out: "ย่อ",
|
|
3653
|
+
reset_zoom: "รีเซ็ตการซูม",
|
|
3654
|
+
support_chat_aria_label: "แชทฝ่ายสนับสนุน"
|
|
3655
|
+
}, ca = {
|
|
3194
3656
|
write_a_message_placeholder: "Bir mesaj yazın...",
|
|
3195
3657
|
your_issue_has_been_resolved: "Sorununuz çözüldü!",
|
|
3196
3658
|
new_conversation: "Yeni konuşma",
|
|
@@ -3277,8 +3739,17 @@ const Ee = {
|
|
|
3277
3739
|
questions_next: "İleri",
|
|
3278
3740
|
questions_send: "Gönder",
|
|
3279
3741
|
questions_type_answer: "Kendim yazayım",
|
|
3280
|
-
questions_answer_placeholder: "Yanıtınızı yazın…"
|
|
3281
|
-
|
|
3742
|
+
questions_answer_placeholder: "Yanıtınızı yazın…",
|
|
3743
|
+
close_conversation_title: "Görüşmeyi kapat",
|
|
3744
|
+
close_conversation_description: "Bu görüşmeyi kapatmak istediğinizden emin misiniz?",
|
|
3745
|
+
close_conversation_cancel: "Hayır",
|
|
3746
|
+
close_conversation_confirm: "Evet",
|
|
3747
|
+
dialog_close: "Kapat",
|
|
3748
|
+
zoom_in: "Yakınlaştır",
|
|
3749
|
+
zoom_out: "Uzaklaştır",
|
|
3750
|
+
reset_zoom: "Yakınlaştırmayı sıfırla",
|
|
3751
|
+
support_chat_aria_label: "Destek sohbeti"
|
|
3752
|
+
}, pa = {
|
|
3282
3753
|
write_a_message_placeholder: "پیغام لکھیں...",
|
|
3283
3754
|
your_issue_has_been_resolved: "آپ کا مسئلہ حل ہو گیا ہے!",
|
|
3284
3755
|
new_conversation: "نئی گفتگو",
|
|
@@ -3365,8 +3836,17 @@ const Ee = {
|
|
|
3365
3836
|
questions_next: "اگلا",
|
|
3366
3837
|
questions_send: "بھیجیں",
|
|
3367
3838
|
questions_type_answer: "میں خود لکھوں گا",
|
|
3368
|
-
questions_answer_placeholder: "اپنا جواب لکھیں…"
|
|
3369
|
-
|
|
3839
|
+
questions_answer_placeholder: "اپنا جواب لکھیں…",
|
|
3840
|
+
close_conversation_title: "گفتگو بند کریں",
|
|
3841
|
+
close_conversation_description: "کیا آپ واقعی یہ گفتگو بند کرنا چاہتے ہیں؟",
|
|
3842
|
+
close_conversation_cancel: "نہیں",
|
|
3843
|
+
close_conversation_confirm: "ہاں",
|
|
3844
|
+
dialog_close: "بند کریں",
|
|
3845
|
+
zoom_in: "زوم اِن",
|
|
3846
|
+
zoom_out: "زوم آؤٹ",
|
|
3847
|
+
reset_zoom: "زوم دوبارہ ترتیب دیں",
|
|
3848
|
+
support_chat_aria_label: "سپورٹ چیٹ"
|
|
3849
|
+
}, da = {
|
|
3370
3850
|
write_a_message_placeholder: "Viết tin nhắn...",
|
|
3371
3851
|
your_issue_has_been_resolved: "Vấn đề của bạn đã được giải quyết!",
|
|
3372
3852
|
new_conversation: "Cuộc trò chuyện mới",
|
|
@@ -3453,8 +3933,17 @@ const Ee = {
|
|
|
3453
3933
|
questions_next: "Tiếp theo",
|
|
3454
3934
|
questions_send: "Gửi",
|
|
3455
3935
|
questions_type_answer: "Tôi sẽ tự nhập",
|
|
3456
|
-
questions_answer_placeholder: "Nhập câu trả lời của bạn…"
|
|
3457
|
-
|
|
3936
|
+
questions_answer_placeholder: "Nhập câu trả lời của bạn…",
|
|
3937
|
+
close_conversation_title: "Đóng cuộc trò chuyện",
|
|
3938
|
+
close_conversation_description: "Bạn có chắc muốn đóng cuộc trò chuyện này không?",
|
|
3939
|
+
close_conversation_cancel: "Không",
|
|
3940
|
+
close_conversation_confirm: "Có",
|
|
3941
|
+
dialog_close: "Đóng",
|
|
3942
|
+
zoom_in: "Phóng to",
|
|
3943
|
+
zoom_out: "Thu nhỏ",
|
|
3944
|
+
reset_zoom: "Đặt lại thu phóng",
|
|
3945
|
+
support_chat_aria_label: "Trò chuyện hỗ trợ"
|
|
3946
|
+
}, ua = {
|
|
3458
3947
|
write_a_message_placeholder: "写一条消息...",
|
|
3459
3948
|
your_issue_has_been_resolved: "您的问题已解决!",
|
|
3460
3949
|
new_conversation: "新对话",
|
|
@@ -3541,8 +4030,17 @@ const Ee = {
|
|
|
3541
4030
|
questions_next: "下一步",
|
|
3542
4031
|
questions_send: "发送",
|
|
3543
4032
|
questions_type_answer: "我自己输入",
|
|
3544
|
-
questions_answer_placeholder: "输入你的回答…"
|
|
3545
|
-
|
|
4033
|
+
questions_answer_placeholder: "输入你的回答…",
|
|
4034
|
+
close_conversation_title: "结束对话",
|
|
4035
|
+
close_conversation_description: "确定要结束此对话吗?",
|
|
4036
|
+
close_conversation_cancel: "否",
|
|
4037
|
+
close_conversation_confirm: "是",
|
|
4038
|
+
dialog_close: "关闭",
|
|
4039
|
+
zoom_in: "放大",
|
|
4040
|
+
zoom_out: "缩小",
|
|
4041
|
+
reset_zoom: "重置缩放",
|
|
4042
|
+
support_chat_aria_label: "支持对话"
|
|
4043
|
+
}, ma = {
|
|
3546
4044
|
write_a_message_placeholder: "Napišite poruku...",
|
|
3547
4045
|
your_issue_has_been_resolved: "Vaš problem je riješen!",
|
|
3548
4046
|
new_conversation: "Novi razgovor",
|
|
@@ -3629,8 +4127,17 @@ const Ee = {
|
|
|
3629
4127
|
questions_next: "Dalje",
|
|
3630
4128
|
questions_send: "Pošalji",
|
|
3631
4129
|
questions_type_answer: "Napisat ću sam",
|
|
3632
|
-
questions_answer_placeholder: "Napišite svoj odgovor…"
|
|
3633
|
-
|
|
4130
|
+
questions_answer_placeholder: "Napišite svoj odgovor…",
|
|
4131
|
+
close_conversation_title: "Zatvori razgovor",
|
|
4132
|
+
close_conversation_description: "Jeste li sigurni da želite zatvoriti ovaj razgovor?",
|
|
4133
|
+
close_conversation_cancel: "Ne",
|
|
4134
|
+
close_conversation_confirm: "Da",
|
|
4135
|
+
dialog_close: "Zatvori",
|
|
4136
|
+
zoom_in: "Približi",
|
|
4137
|
+
zoom_out: "Udalji",
|
|
4138
|
+
reset_zoom: "Poništi zumiranje",
|
|
4139
|
+
support_chat_aria_label: "Chat za podršku"
|
|
4140
|
+
}, ha = {
|
|
3634
4141
|
write_a_message_placeholder: "Kirjuta sõnum...",
|
|
3635
4142
|
your_issue_has_been_resolved: "Teie probleem on lahendatud!",
|
|
3636
4143
|
new_conversation: "Uus vestlus",
|
|
@@ -3717,8 +4224,17 @@ const Ee = {
|
|
|
3717
4224
|
questions_next: "Edasi",
|
|
3718
4225
|
questions_send: "Saada",
|
|
3719
4226
|
questions_type_answer: "Kirjutan ise",
|
|
3720
|
-
questions_answer_placeholder: "Kirjutage oma vastus…"
|
|
3721
|
-
|
|
4227
|
+
questions_answer_placeholder: "Kirjutage oma vastus…",
|
|
4228
|
+
close_conversation_title: "Sulge vestlus",
|
|
4229
|
+
close_conversation_description: "Kas soovite kindlasti selle vestluse sulgeda?",
|
|
4230
|
+
close_conversation_cancel: "Ei",
|
|
4231
|
+
close_conversation_confirm: "Jah",
|
|
4232
|
+
dialog_close: "Sulge",
|
|
4233
|
+
zoom_in: "Suurenda",
|
|
4234
|
+
zoom_out: "Vähenda",
|
|
4235
|
+
reset_zoom: "Lähtesta suurendus",
|
|
4236
|
+
support_chat_aria_label: "Tugivestlus"
|
|
4237
|
+
}, ga = {
|
|
3722
4238
|
write_a_message_placeholder: "Írjon üzenetet...",
|
|
3723
4239
|
your_issue_has_been_resolved: "A problémája megoldódott!",
|
|
3724
4240
|
new_conversation: "Új beszélgetés",
|
|
@@ -3805,8 +4321,17 @@ const Ee = {
|
|
|
3805
4321
|
questions_next: "Tovább",
|
|
3806
4322
|
questions_send: "Küldés",
|
|
3807
4323
|
questions_type_answer: "Inkább leírom",
|
|
3808
|
-
questions_answer_placeholder: "Írja le a válaszát…"
|
|
3809
|
-
|
|
4324
|
+
questions_answer_placeholder: "Írja le a válaszát…",
|
|
4325
|
+
close_conversation_title: "Beszélgetés lezárása",
|
|
4326
|
+
close_conversation_description: "Biztosan lezárja ezt a beszélgetést?",
|
|
4327
|
+
close_conversation_cancel: "Nem",
|
|
4328
|
+
close_conversation_confirm: "Igen",
|
|
4329
|
+
dialog_close: "Bezárás",
|
|
4330
|
+
zoom_in: "Nagyítás",
|
|
4331
|
+
zoom_out: "Kicsinyítés",
|
|
4332
|
+
reset_zoom: "Nagyítás visszaállítása",
|
|
4333
|
+
support_chat_aria_label: "Ügyfélszolgálati chat"
|
|
4334
|
+
}, ka = {
|
|
3810
4335
|
write_a_message_placeholder: "Skrifaðu skilaboð...",
|
|
3811
4336
|
your_issue_has_been_resolved: "Málið þitt hefur verið leyst!",
|
|
3812
4337
|
new_conversation: "Nýtt samtal",
|
|
@@ -3893,8 +4418,17 @@ const Ee = {
|
|
|
3893
4418
|
questions_next: "Áfram",
|
|
3894
4419
|
questions_send: "Senda",
|
|
3895
4420
|
questions_type_answer: "Ég skrifa það",
|
|
3896
|
-
questions_answer_placeholder: "Skrifaðu svarið þitt…"
|
|
3897
|
-
|
|
4421
|
+
questions_answer_placeholder: "Skrifaðu svarið þitt…",
|
|
4422
|
+
close_conversation_title: "Loka samtali",
|
|
4423
|
+
close_conversation_description: "Ertu viss um að þú viljir loka þessu samtali?",
|
|
4424
|
+
close_conversation_cancel: "Nei",
|
|
4425
|
+
close_conversation_confirm: "Já",
|
|
4426
|
+
dialog_close: "Loka",
|
|
4427
|
+
zoom_in: "Auka aðdrátt",
|
|
4428
|
+
zoom_out: "Minnka aðdrátt",
|
|
4429
|
+
reset_zoom: "Endurstilla aðdrátt",
|
|
4430
|
+
support_chat_aria_label: "Þjónustuspjall"
|
|
4431
|
+
}, ba = {
|
|
3898
4432
|
write_a_message_placeholder: "Rakstiet ziņojumu...",
|
|
3899
4433
|
your_issue_has_been_resolved: "Jūsu problēma ir atrisināta!",
|
|
3900
4434
|
new_conversation: "Jauna saruna",
|
|
@@ -3981,8 +4515,17 @@ const Ee = {
|
|
|
3981
4515
|
questions_next: "Tālāk",
|
|
3982
4516
|
questions_send: "Sūtīt",
|
|
3983
4517
|
questions_type_answer: "Rakstīšu pats",
|
|
3984
|
-
questions_answer_placeholder: "Ierakstiet savu atbildi…"
|
|
3985
|
-
|
|
4518
|
+
questions_answer_placeholder: "Ierakstiet savu atbildi…",
|
|
4519
|
+
close_conversation_title: "Aizvērt sarunu",
|
|
4520
|
+
close_conversation_description: "Vai tiešām vēlaties aizvērt šo sarunu?",
|
|
4521
|
+
close_conversation_cancel: "Nē",
|
|
4522
|
+
close_conversation_confirm: "Jā",
|
|
4523
|
+
dialog_close: "Aizvērt",
|
|
4524
|
+
zoom_in: "Pietuvināt",
|
|
4525
|
+
zoom_out: "Attālināt",
|
|
4526
|
+
reset_zoom: "Atiestatīt tālummaiņu",
|
|
4527
|
+
support_chat_aria_label: "Atbalsta tērzēšana"
|
|
4528
|
+
}, va = {
|
|
3986
4529
|
write_a_message_placeholder: "Parašykite žinutę...",
|
|
3987
4530
|
your_issue_has_been_resolved: "Jūsų problema išspręsta!",
|
|
3988
4531
|
new_conversation: "Naujas pokalbis",
|
|
@@ -4069,8 +4612,17 @@ const Ee = {
|
|
|
4069
4612
|
questions_next: "Toliau",
|
|
4070
4613
|
questions_send: "Siųsti",
|
|
4071
4614
|
questions_type_answer: "Parašysiu pats",
|
|
4072
|
-
questions_answer_placeholder: "Parašykite savo atsakymą…"
|
|
4073
|
-
|
|
4615
|
+
questions_answer_placeholder: "Parašykite savo atsakymą…",
|
|
4616
|
+
close_conversation_title: "Uždaryti pokalbį",
|
|
4617
|
+
close_conversation_description: "Ar tikrai norite uždaryti šį pokalbį?",
|
|
4618
|
+
close_conversation_cancel: "Ne",
|
|
4619
|
+
close_conversation_confirm: "Taip",
|
|
4620
|
+
dialog_close: "Uždaryti",
|
|
4621
|
+
zoom_in: "Priartinti",
|
|
4622
|
+
zoom_out: "Nutolinti",
|
|
4623
|
+
reset_zoom: "Atstatyti mastelį",
|
|
4624
|
+
support_chat_aria_label: "Pagalbos pokalbis"
|
|
4625
|
+
}, fa = {
|
|
4074
4626
|
write_a_message_placeholder: "Schreift eng Noriicht...",
|
|
4075
4627
|
your_issue_has_been_resolved: "Äert Problem gouf geléist!",
|
|
4076
4628
|
new_conversation: "Nei Konversatioun",
|
|
@@ -4157,8 +4709,17 @@ const Ee = {
|
|
|
4157
4709
|
questions_next: "Weider",
|
|
4158
4710
|
questions_send: "Schécken",
|
|
4159
4711
|
questions_type_answer: "Ech schreiwen et selwer",
|
|
4160
|
-
questions_answer_placeholder: "Schreift Är Äntwert…"
|
|
4161
|
-
|
|
4712
|
+
questions_answer_placeholder: "Schreift Är Äntwert…",
|
|
4713
|
+
close_conversation_title: "Konversatioun zoumaachen",
|
|
4714
|
+
close_conversation_description: "Wëllt Dir dës Konversatioun wierklech zoumaachen?",
|
|
4715
|
+
close_conversation_cancel: "Nee",
|
|
4716
|
+
close_conversation_confirm: "Jo",
|
|
4717
|
+
dialog_close: "Zoumaachen",
|
|
4718
|
+
zoom_in: "Erazoomen",
|
|
4719
|
+
zoom_out: "Erauszoomen",
|
|
4720
|
+
reset_zoom: "Zoom zrécksetzen",
|
|
4721
|
+
support_chat_aria_label: "Support-Chat"
|
|
4722
|
+
}, ya = {
|
|
4162
4723
|
write_a_message_placeholder: "Ikteb messaġġ...",
|
|
4163
4724
|
your_issue_has_been_resolved: "Il-problema tiegħek ġiet riżolta!",
|
|
4164
4725
|
new_conversation: "Konversazzjoni ġdida",
|
|
@@ -4245,8 +4806,17 @@ const Ee = {
|
|
|
4245
4806
|
questions_next: "Li jmiss",
|
|
4246
4807
|
questions_send: "Ibgħat",
|
|
4247
4808
|
questions_type_answer: "Nikteb jien",
|
|
4248
|
-
questions_answer_placeholder: "Ikteb it-tweġiba tiegħek…"
|
|
4249
|
-
|
|
4809
|
+
questions_answer_placeholder: "Ikteb it-tweġiba tiegħek…",
|
|
4810
|
+
close_conversation_title: "Agħlaq il-konversazzjoni",
|
|
4811
|
+
close_conversation_description: "Żgur li trid tagħlaq din il-konversazzjoni?",
|
|
4812
|
+
close_conversation_cancel: "Le",
|
|
4813
|
+
close_conversation_confirm: "Iva",
|
|
4814
|
+
dialog_close: "Agħlaq",
|
|
4815
|
+
zoom_in: "Kabbar",
|
|
4816
|
+
zoom_out: "Ċekken",
|
|
4817
|
+
reset_zoom: "Irrisettja ż-zoom",
|
|
4818
|
+
support_chat_aria_label: "Chat ta’ appoġġ"
|
|
4819
|
+
}, wa = {
|
|
4250
4820
|
write_a_message_placeholder: "Skriv en melding...",
|
|
4251
4821
|
your_issue_has_been_resolved: "Saken din er løst!",
|
|
4252
4822
|
new_conversation: "Ny samtale",
|
|
@@ -4333,8 +4903,17 @@ const Ee = {
|
|
|
4333
4903
|
questions_next: "Neste",
|
|
4334
4904
|
questions_send: "Send",
|
|
4335
4905
|
questions_type_answer: "Jeg skriver det selv",
|
|
4336
|
-
questions_answer_placeholder: "Skriv svaret ditt…"
|
|
4337
|
-
|
|
4906
|
+
questions_answer_placeholder: "Skriv svaret ditt…",
|
|
4907
|
+
close_conversation_title: "Lukk samtale",
|
|
4908
|
+
close_conversation_description: "Er du sikker på at du vil lukke denne samtalen?",
|
|
4909
|
+
close_conversation_cancel: "Nei",
|
|
4910
|
+
close_conversation_confirm: "Ja",
|
|
4911
|
+
dialog_close: "Lukk",
|
|
4912
|
+
zoom_in: "Zoom inn",
|
|
4913
|
+
zoom_out: "Zoom ut",
|
|
4914
|
+
reset_zoom: "Tilbakestill zoom",
|
|
4915
|
+
support_chat_aria_label: "Support-chat"
|
|
4916
|
+
}, ja = {
|
|
4338
4917
|
write_a_message_placeholder: "Napíšte správu...",
|
|
4339
4918
|
your_issue_has_been_resolved: "Váš problém bol vyriešený!",
|
|
4340
4919
|
new_conversation: "Nová konverzácia",
|
|
@@ -4421,86 +5000,96 @@ const Ee = {
|
|
|
4421
5000
|
questions_next: "Ďalej",
|
|
4422
5001
|
questions_send: "Odoslať",
|
|
4423
5002
|
questions_type_answer: "Napíšem to sám",
|
|
4424
|
-
questions_answer_placeholder: "Napíšte svoju odpoveď…"
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
5003
|
+
questions_answer_placeholder: "Napíšte svoju odpoveď…",
|
|
5004
|
+
close_conversation_title: "Uzavrieť konverzáciu",
|
|
5005
|
+
close_conversation_description: "Naozaj chcete túto konverzáciu uzavrieť?",
|
|
5006
|
+
close_conversation_cancel: "Nie",
|
|
5007
|
+
close_conversation_confirm: "Áno",
|
|
5008
|
+
dialog_close: "Zavrieť",
|
|
5009
|
+
zoom_in: "Priblížiť",
|
|
5010
|
+
zoom_out: "Oddialiť",
|
|
5011
|
+
reset_zoom: "Obnoviť priblíženie",
|
|
5012
|
+
support_chat_aria_label: "Chat podpory"
|
|
5013
|
+
}, Y = {
|
|
5014
|
+
ar: Oe,
|
|
5015
|
+
bn: Ue,
|
|
5016
|
+
bg: Be,
|
|
5017
|
+
cs: Ve,
|
|
5018
|
+
da: He,
|
|
5019
|
+
de: We,
|
|
5020
|
+
el: Ze,
|
|
5021
|
+
en: J,
|
|
5022
|
+
es: Ge,
|
|
5023
|
+
et: ha,
|
|
5024
|
+
fi: Je,
|
|
5025
|
+
fil: $e,
|
|
5026
|
+
fr: Ye,
|
|
5027
|
+
hi: Qe,
|
|
5028
|
+
hr: ma,
|
|
5029
|
+
hu: ga,
|
|
5030
|
+
is: ka,
|
|
5031
|
+
it: Xe,
|
|
5032
|
+
ja: ea,
|
|
5033
|
+
ko: aa,
|
|
5034
|
+
lb: fa,
|
|
5035
|
+
lt: va,
|
|
5036
|
+
lv: ba,
|
|
5037
|
+
mt: ya,
|
|
5038
|
+
nb: wa,
|
|
5039
|
+
nl: ta,
|
|
5040
|
+
no: sa,
|
|
5041
|
+
pl: oa,
|
|
5042
|
+
pt: na,
|
|
5043
|
+
ro: ia,
|
|
5044
|
+
ru: _a,
|
|
5045
|
+
sk: ja,
|
|
5046
|
+
sv: ra,
|
|
5047
|
+
th: la,
|
|
5048
|
+
tr: ca,
|
|
5049
|
+
ur: pa,
|
|
5050
|
+
vi: da,
|
|
5051
|
+
"zh-cn": ua
|
|
5052
|
+
}, Sa = Object.keys(Y);
|
|
5053
|
+
function za(i) {
|
|
5054
|
+
return Sa.includes(i);
|
|
4467
5055
|
}
|
|
4468
|
-
const
|
|
4469
|
-
function
|
|
4470
|
-
return
|
|
5056
|
+
const Ca = /* @__PURE__ */ new Set(["ar", "ur"]);
|
|
5057
|
+
function Ja(i) {
|
|
5058
|
+
return Ca.has(i);
|
|
4471
5059
|
}
|
|
4472
|
-
function
|
|
4473
|
-
return
|
|
5060
|
+
function xa(i) {
|
|
5061
|
+
return za(i) ? i : "en";
|
|
4474
5062
|
}
|
|
4475
|
-
function
|
|
5063
|
+
function qa(i, e, t, o) {
|
|
4476
5064
|
var l;
|
|
4477
|
-
const
|
|
4478
|
-
return o ?
|
|
5065
|
+
const r = ((l = t == null ? void 0 : t[e]) == null ? void 0 : l[i]) || Y[e][i] || J[i] || i;
|
|
5066
|
+
return o ? r.replace(
|
|
4479
5067
|
/\{(\w+)\}/g,
|
|
4480
|
-
(
|
|
4481
|
-
) :
|
|
5068
|
+
(s, a) => a in o ? String(o[a]) : s
|
|
5069
|
+
) : r;
|
|
4482
5070
|
}
|
|
4483
|
-
function
|
|
4484
|
-
return
|
|
5071
|
+
function Ea(i, e, t) {
|
|
5072
|
+
return qa(
|
|
4485
5073
|
e,
|
|
4486
|
-
|
|
5074
|
+
xa(i.language),
|
|
4487
5075
|
i.translationOverrides,
|
|
4488
5076
|
t
|
|
4489
5077
|
);
|
|
4490
5078
|
}
|
|
4491
|
-
class
|
|
5079
|
+
class Aa {
|
|
4492
5080
|
constructor({
|
|
4493
5081
|
config: e,
|
|
4494
5082
|
api: t,
|
|
4495
5083
|
contactCtx: o,
|
|
4496
|
-
storageCtx:
|
|
4497
|
-
sessionsPollingIntervalSeconds: l
|
|
5084
|
+
storageCtx: r,
|
|
5085
|
+
sessionsPollingIntervalSeconds: l,
|
|
5086
|
+
sharedSessions: s
|
|
4498
5087
|
}) {
|
|
4499
|
-
this.sessionsRefresher = new
|
|
5088
|
+
this.sessionsRefresher = new G(), this.persistedSessionId = null, this.sessionAbortController = new AbortController(), this.sessionState = new S({
|
|
4500
5089
|
session: null,
|
|
4501
5090
|
isCreatingSession: !1,
|
|
4502
5091
|
isResolvingSession: !1
|
|
4503
|
-
}), this.sessionsState = new
|
|
5092
|
+
}), this.sessionsState = new S({
|
|
4504
5093
|
data: [],
|
|
4505
5094
|
cursor: void 0,
|
|
4506
5095
|
isLastPage: !1,
|
|
@@ -4510,14 +5099,25 @@ class fa {
|
|
|
4510
5099
|
*/
|
|
4511
5100
|
isInitialFetchLoading: !0
|
|
4512
5101
|
}), this.registerActiveSessionPersistence = () => {
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
5102
|
+
this.storageCtx && (this.stopPersistingSession = this.sessionState.subscribe(
|
|
5103
|
+
this.persistSession
|
|
5104
|
+
));
|
|
5105
|
+
}, this.restoreActiveSessionTracking = () => {
|
|
5106
|
+
var a;
|
|
5107
|
+
(a = this.stopPersistingSession) == null || a.call(this), this.stopPersistingSession = void 0, this.registerActiveSessionPersistence();
|
|
5108
|
+
}, this.trackActiveSession = (a) => {
|
|
5109
|
+
var n;
|
|
5110
|
+
(n = this.stopPersistingSession) == null || n.call(this), this.stopPersistingSession = a.sessionState.subscribe(
|
|
5111
|
+
this.persistSession
|
|
5112
|
+
), this.persistSession(a.sessionState.get());
|
|
5113
|
+
}, this.persistSession = ({ session: a }) => {
|
|
5114
|
+
const n = this.storageCtx;
|
|
5115
|
+
if (!n) return;
|
|
5116
|
+
const c = a != null && a.isOpened ? a.id : null;
|
|
5117
|
+
if (c === this.persistedSessionId || !c && this.persistedSessionId === null) return;
|
|
5118
|
+
this.persistedSessionId = c, (c ? n.setActiveSessionId(c) : n.clearActiveSessionId()).catch((_) => {
|
|
5119
|
+
k.warn("failed to persist the active session", {
|
|
5120
|
+
error: _ instanceof Error ? _.message : String(_)
|
|
4521
5121
|
});
|
|
4522
5122
|
});
|
|
4523
5123
|
}, this.getLastActiveSessionId = async () => {
|
|
@@ -4528,78 +5128,95 @@ class fa {
|
|
|
4528
5128
|
return null;
|
|
4529
5129
|
}
|
|
4530
5130
|
}, this.reset = async () => {
|
|
4531
|
-
this.sessionState.reset();
|
|
5131
|
+
this.sessionAbortController.abort(), this.sessionAbortController = new AbortController(), this.sessionState.reset();
|
|
4532
5132
|
}, this.registerSessionsRefresherWrapper = () => {
|
|
4533
5133
|
var a;
|
|
4534
5134
|
// If the widget config was initially provided with a contact token, no state change would be triggered, so we just fetch
|
|
4535
|
-
(a = this.contactCtx.state.get().contact) != null && a.token && !this.sessionsState.get().didStartInitialFetch ? this.registerSessionsRefresher() : this.contactCtx.state.subscribe(
|
|
4536
|
-
|
|
4537
|
-
|
|
5135
|
+
(a = this.contactCtx.state.get().contact) != null && a.token && !this.sessionsState.get().didStartInitialFetch ? this.registerSessionsRefresher() : this.stopWaitingForContact = this.contactCtx.state.subscribe(
|
|
5136
|
+
({ contact: n }) => {
|
|
5137
|
+
n != null && n.token && !this.sessionsState.get().didStartInitialFetch && this.registerSessionsRefresher();
|
|
5138
|
+
}
|
|
5139
|
+
);
|
|
4538
5140
|
}, this.registerSessionsRefresher = () => {
|
|
4539
5141
|
this.sessionsRefresher.startPolling(async () => {
|
|
4540
5142
|
this.sessionsState.get().didStartInitialFetch === !1 && this.sessionsState.setPartial({ didStartInitialFetch: !0 }), await this.refreshSessions(), this.sessionsState.get().isInitialFetchLoading === !0 && this.sessionsState.setPartial({ isInitialFetchLoading: !1 });
|
|
4541
5143
|
}, this.sessionsPollingIntervalSeconds * 1e3);
|
|
5144
|
+
}, this.dispose = ({ clearActiveSession: a = !1 } = {}) => {
|
|
5145
|
+
var n, c;
|
|
5146
|
+
if (this.sessionsRefresher.reset(), this.sessionAbortController.abort(), (n = this.stopPersistingSession) == null || n.call(this), this.stopPersistingSession = void 0, (c = this.stopWaitingForContact) == null || c.call(this), this.stopWaitingForContact = void 0, this.sessionState.reset(), a && this.storageCtx)
|
|
5147
|
+
return this.persistedSessionId = null, this.storageCtx.clearActiveSessionId().catch((d) => {
|
|
5148
|
+
k.warn("failed to clear the replaced session", {
|
|
5149
|
+
error: d instanceof Error ? d.message : String(d)
|
|
5150
|
+
});
|
|
5151
|
+
});
|
|
4542
5152
|
}, this.getParsedCustomData = () => Object.fromEntries(
|
|
4543
5153
|
Object.entries(this.config.sessionCustomData || {}).map(
|
|
4544
5154
|
([a, n]) => {
|
|
4545
|
-
var
|
|
4546
|
-
return typeof n == "string" ? [a, n] : typeof n == "boolean" ? [a, n] : typeof n == "number" ? [a, n] : [a, ((
|
|
5155
|
+
var c;
|
|
5156
|
+
return typeof n == "string" ? [a, n] : typeof n == "boolean" ? [a, n] : typeof n == "number" ? [a, n] : [a, ((c = $(() => JSON.stringify(n))) == null ? void 0 : c.data) || ""];
|
|
4547
5157
|
}
|
|
4548
5158
|
)
|
|
4549
5159
|
), this.createSession = async () => {
|
|
5160
|
+
const { signal: a } = this.sessionAbortController;
|
|
4550
5161
|
this.sessionState.setPartial({ session: null, isCreatingSession: !0 });
|
|
4551
5162
|
try {
|
|
4552
|
-
const
|
|
4553
|
-
if (a.
|
|
4554
|
-
if (
|
|
4555
|
-
|
|
4556
|
-
|
|
5163
|
+
const n = await this.requestSession(a);
|
|
5164
|
+
if (a.aborted) return null;
|
|
5165
|
+
if (n.session) return n.session;
|
|
5166
|
+
if (n.status === 401 && await this.contactCtx.recoverFromStaleToken()) {
|
|
5167
|
+
if (a.aborted) return null;
|
|
5168
|
+
const c = await this.requestSession(a);
|
|
5169
|
+
return a.aborted ? null : c.session ? c.session : (k.error("failed to create session", c.error), null);
|
|
4557
5170
|
}
|
|
4558
|
-
return
|
|
4559
|
-
} catch (
|
|
4560
|
-
return
|
|
5171
|
+
return k.error("failed to create session", n.error), null;
|
|
5172
|
+
} catch (n) {
|
|
5173
|
+
return a.aborted || k.error("failed to create session", n), null;
|
|
4561
5174
|
} finally {
|
|
4562
|
-
this.sessionState.setPartial({ isCreatingSession: !1 });
|
|
5175
|
+
a.aborted || this.sessionState.setPartial({ isCreatingSession: !1 });
|
|
4563
5176
|
}
|
|
4564
|
-
}, this.requestSession = async () => {
|
|
4565
|
-
var
|
|
4566
|
-
const
|
|
5177
|
+
}, this.requestSession = async (a) => {
|
|
5178
|
+
var u, m, g;
|
|
5179
|
+
const n = (u = this.contactCtx.state.get().contact) == null ? void 0 : u.externalId, c = {
|
|
4567
5180
|
...this.getParsedCustomData(),
|
|
4568
|
-
...
|
|
5181
|
+
...n ? { external_id: n } : {}
|
|
4569
5182
|
}, {
|
|
4570
|
-
data:
|
|
4571
|
-
error:
|
|
4572
|
-
response:
|
|
4573
|
-
} = await this.api.createSession(
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
5183
|
+
data: d,
|
|
5184
|
+
error: _,
|
|
5185
|
+
response: p
|
|
5186
|
+
} = await this.api.createSession(
|
|
5187
|
+
{
|
|
5188
|
+
customData: Object.keys(c).length > 0 ? c : void 0
|
|
5189
|
+
},
|
|
5190
|
+
a
|
|
5191
|
+
);
|
|
5192
|
+
if (a.aborted || !d)
|
|
5193
|
+
return { session: null, status: p == null ? void 0 : p.status, error: _ };
|
|
5194
|
+
this.sessionState.setPartial({ session: d });
|
|
4578
5195
|
try {
|
|
4579
|
-
(
|
|
4580
|
-
} catch (
|
|
4581
|
-
|
|
5196
|
+
(g = (m = this.config.hooks) == null ? void 0 : m.onSessionCreated) == null || g.call(m, { session: d });
|
|
5197
|
+
} catch (v) {
|
|
5198
|
+
k.error("onSessionCreated hook failed", v);
|
|
4582
5199
|
}
|
|
4583
|
-
return { session:
|
|
5200
|
+
return { session: d, status: p.status, error: void 0 };
|
|
4584
5201
|
}, this.loadMoreSessions = async () => {
|
|
4585
5202
|
if (this.sessionsState.get().isLastPage) return;
|
|
4586
5203
|
const { data: a } = await this.getSessions({
|
|
4587
5204
|
cursor: this.sessionsState.get().cursor
|
|
4588
5205
|
});
|
|
4589
5206
|
if (a) {
|
|
4590
|
-
const
|
|
4591
|
-
(
|
|
5207
|
+
const c = [...this.sessionsState.get().data, ...a.items].filter(
|
|
5208
|
+
(d, _, p) => _ === p.findIndex((u) => d.id === u.id)
|
|
4592
5209
|
);
|
|
4593
5210
|
this.sessionsState.setPartial({
|
|
4594
|
-
data:
|
|
5211
|
+
data: c,
|
|
4595
5212
|
cursor: a.next || void 0,
|
|
4596
5213
|
isLastPage: a.next === null
|
|
4597
5214
|
});
|
|
4598
5215
|
}
|
|
4599
5216
|
}, this.getSessions = async ({ cursor: a }) => {
|
|
4600
|
-
var
|
|
4601
|
-
if (!((
|
|
4602
|
-
const n = (
|
|
5217
|
+
var c, d;
|
|
5218
|
+
if (!((c = this.contactCtx.state.get().contact) != null && c.token)) return { data: null };
|
|
5219
|
+
const n = (d = this.contactCtx.state.get().contact) == null ? void 0 : d.externalId;
|
|
4603
5220
|
return await this.api.getSessions({
|
|
4604
5221
|
cursor: a,
|
|
4605
5222
|
filters: n ? {
|
|
@@ -4608,7 +5225,7 @@ class fa {
|
|
|
4608
5225
|
});
|
|
4609
5226
|
}, this.setSessions = (a) => {
|
|
4610
5227
|
const n = [...a, ...this.sessionsState.get().data].filter(
|
|
4611
|
-
(
|
|
5228
|
+
(c, d, _) => d === _.findIndex((p) => c.id === p.id)
|
|
4612
5229
|
);
|
|
4613
5230
|
this.sessionsState.setPartial({ data: n });
|
|
4614
5231
|
}, this.refreshSessions = async () => {
|
|
@@ -4619,62 +5236,69 @@ class fa {
|
|
|
4619
5236
|
if (!a || !a.isOpened)
|
|
4620
5237
|
return { success: !1, error: "Session is not opened" };
|
|
4621
5238
|
this.sessionState.setPartial({ isResolvingSession: !0 });
|
|
4622
|
-
const {
|
|
4623
|
-
|
|
5239
|
+
const { signal: n } = this.sessionAbortController, c = await this.api.resolveSession({ session_id: a.id }, n).catch((p) => {
|
|
5240
|
+
if (n.aborted) return null;
|
|
5241
|
+
throw p;
|
|
4624
5242
|
});
|
|
4625
|
-
|
|
5243
|
+
if (!c || n.aborted)
|
|
5244
|
+
return { success: !1, error: "Session was reset" };
|
|
5245
|
+
const { data: d, error: _ } = c;
|
|
5246
|
+
return d ? (this.sessionState.setPartial({ session: d, isResolvingSession: !1 }), { success: !0, data: d }) : (this.sessionState.setPartial({ isResolvingSession: !1 }), { success: !1, error: _ });
|
|
4626
5247
|
}, this.createStateCheckpoint = async (a) => {
|
|
4627
|
-
var
|
|
4628
|
-
const n = (
|
|
5248
|
+
var d;
|
|
5249
|
+
const n = (d = this.sessionState.get().session) == null ? void 0 : d.id;
|
|
4629
5250
|
if (!n) return;
|
|
4630
|
-
const { data:
|
|
5251
|
+
const { data: c } = await this.api.createStateCheckpoint({
|
|
4631
5252
|
session_id: n,
|
|
4632
5253
|
payload: a
|
|
4633
5254
|
});
|
|
4634
|
-
return
|
|
4635
|
-
}, this.config = e, this.api = t, this.contactCtx = o, this.storageCtx =
|
|
5255
|
+
return c != null && c.success ? { success: !0 } : { success: !1 };
|
|
5256
|
+
}, this.config = e, this.api = t, this.contactCtx = o, this.storageCtx = r, this.sessionsPollingIntervalSeconds = l, s ? this.sessionsState = s : this.registerSessionsRefresherWrapper(), this.registerActiveSessionPersistence();
|
|
4636
5257
|
}
|
|
4637
5258
|
}
|
|
4638
|
-
const
|
|
4639
|
-
const o =
|
|
5259
|
+
const Pa = (i, e, { sendsPageContext: t }) => {
|
|
5260
|
+
const o = Ma(i), r = t && e.mentions && e.mentions.length > 0 ? { mentions: e.mentions.map(Ta) } : void 0, l = t && (e.clientContext || r) ? { ...o, ...e.clientContext, ...r } : o, s = e.connectionRequestId ? {
|
|
5261
|
+
...l,
|
|
5262
|
+
opencx__connection_request_id: e.connectionRequestId
|
|
5263
|
+
} : l, a = e.withPageEntity === !1 && s && "entity" in s ? Ia(s, "entity") : s;
|
|
4640
5264
|
return {
|
|
4641
|
-
clientContext: e.
|
|
5265
|
+
clientContext: e.background ? { ...a, opencx__background: !0 } : a,
|
|
4642
5266
|
custom_data: {
|
|
4643
5267
|
...i.messageCustomData || {},
|
|
4644
5268
|
...e.customData || {}
|
|
4645
5269
|
}
|
|
4646
5270
|
};
|
|
4647
|
-
},
|
|
5271
|
+
}, Ta = ({ type: i, id: e, title: t, meta: o }) => ({
|
|
4648
5272
|
type: i,
|
|
4649
5273
|
id: e,
|
|
4650
5274
|
title: t,
|
|
4651
5275
|
...o ? { meta: o } : {}
|
|
4652
|
-
}),
|
|
5276
|
+
}), Ia = (i, e) => {
|
|
4653
5277
|
const { [e]: t, ...o } = i;
|
|
4654
5278
|
return Object.keys(o).length > 0 ? o : void 0;
|
|
4655
|
-
},
|
|
5279
|
+
}, Ma = (i) => {
|
|
4656
5280
|
if (typeof i.context != "function") return i.context;
|
|
4657
5281
|
try {
|
|
4658
5282
|
return i.context();
|
|
4659
5283
|
} catch (e) {
|
|
4660
|
-
|
|
5284
|
+
k.error("context getter threw; sending without context", e);
|
|
4661
5285
|
return;
|
|
4662
5286
|
}
|
|
4663
|
-
},
|
|
5287
|
+
}, Da = (i) => {
|
|
4664
5288
|
const e = i.features;
|
|
4665
5289
|
if (!e) return;
|
|
4666
5290
|
const t = {};
|
|
4667
5291
|
return e.preamble !== void 0 && (t.preamble = e.preamble), e.inlineUi !== void 0 && (t.inline_ui = e.inlineUi), e.pageContext !== void 0 && (t.page_context = e.pageContext), e.clientTools !== void 0 && (t.client_tools = e.clientTools), Object.keys(t).length > 0 ? t : void 0;
|
|
4668
|
-
},
|
|
5292
|
+
}, Na = ({
|
|
4669
5293
|
config: i,
|
|
4670
5294
|
input: e,
|
|
4671
5295
|
uuid: t,
|
|
4672
5296
|
sessionId: o,
|
|
4673
|
-
content:
|
|
5297
|
+
content: r,
|
|
4674
5298
|
initialMessages: l,
|
|
4675
|
-
sendsPageContext:
|
|
5299
|
+
sendsPageContext: s
|
|
4676
5300
|
}) => {
|
|
4677
|
-
var n;
|
|
5301
|
+
var a, n, c, d, _, p, u, m;
|
|
4678
5302
|
return {
|
|
4679
5303
|
uuid: t,
|
|
4680
5304
|
bot_token: i.token,
|
|
@@ -4682,227 +5306,253 @@ const va = (i, e, { sendsPageContext: t }) => {
|
|
|
4682
5306
|
query_params: i.queryParams,
|
|
4683
5307
|
body_properties: i.bodyProperties,
|
|
4684
5308
|
session_id: o,
|
|
4685
|
-
content:
|
|
5309
|
+
content: r,
|
|
4686
5310
|
attachments: e.attachments,
|
|
4687
|
-
...
|
|
5311
|
+
...Pa(i, e, { sendsPageContext: s }),
|
|
4688
5312
|
language: i.language,
|
|
4689
|
-
features:
|
|
4690
|
-
|
|
5313
|
+
features: Da(i),
|
|
5314
|
+
presentation: i.presentation,
|
|
5315
|
+
capabilities: [
|
|
5316
|
+
(a = i.capabilities) == null ? void 0 : a.connections,
|
|
5317
|
+
(n = i.capabilities) == null ? void 0 : n.structuredQuestions,
|
|
5318
|
+
(c = i.capabilities) == null ? void 0 : c.richReplies,
|
|
5319
|
+
(d = i.capabilities) == null ? void 0 : d.pageEffects
|
|
5320
|
+
].some((g) => g !== void 0) ? {
|
|
5321
|
+
connections: (_ = i.capabilities) == null ? void 0 : _.connections,
|
|
5322
|
+
structured_questions: (p = i.capabilities) == null ? void 0 : p.structuredQuestions,
|
|
5323
|
+
rich_replies: (u = i.capabilities) == null ? void 0 : u.richReplies,
|
|
5324
|
+
page_effects: (m = i.capabilities) == null ? void 0 : m.pageEffects
|
|
5325
|
+
} : void 0,
|
|
4691
5326
|
exit_mode_prompt: e.exitModePrompt,
|
|
4692
|
-
initial_messages: l.length > 0 ? l.map((
|
|
5327
|
+
initial_messages: l.length > 0 ? l.map((g) => ({ uuid: g.id, content: g.data.message })) : void 0
|
|
4693
5328
|
};
|
|
4694
|
-
},
|
|
5329
|
+
}, C = class C {
|
|
4695
5330
|
constructor({
|
|
4696
5331
|
config: e,
|
|
4697
5332
|
api: t,
|
|
4698
5333
|
sessionCtx: o,
|
|
4699
|
-
contactCtx:
|
|
5334
|
+
contactCtx: r,
|
|
4700
5335
|
streaming: l,
|
|
4701
|
-
sendsPageContext:
|
|
4702
|
-
getClientCapabilities:
|
|
5336
|
+
sendsPageContext: s,
|
|
5337
|
+
getClientCapabilities: a,
|
|
5338
|
+
getRequestConfig: n,
|
|
5339
|
+
isStreaming: c,
|
|
5340
|
+
getSendsPageContext: d
|
|
4703
5341
|
}) {
|
|
4704
|
-
this.state = new
|
|
5342
|
+
this.state = new S({
|
|
4705
5343
|
messages: [],
|
|
4706
5344
|
isSendingMessage: !1,
|
|
4707
5345
|
isSendingMessageToAI: !1,
|
|
5346
|
+
settledAgentUserMessageId: null,
|
|
4708
5347
|
lastAIResMightSolveUserIssue: !1,
|
|
4709
5348
|
isInitialFetchLoading: !1
|
|
5349
|
+
}), this.draftState = new S({
|
|
5350
|
+
text: "",
|
|
5351
|
+
mentions: []
|
|
4710
5352
|
}), this.agentHandlers = null, this.bufferedAgentSends = [], this.sendMessageAbortController = new AbortController(), this.messageIdsDispatchedToOnMessageReceivedHook = /* @__PURE__ */ new Set(), this.sentTextHistory = [], this.reset = () => {
|
|
4711
|
-
this.sendMessageAbortController.abort("Resetting chat"), this.bufferedAgentSends = [], this.state.reset(), this.messageIdsDispatchedToOnMessageReceivedHook.clear(), this.sentTextHistory = [];
|
|
4712
|
-
}, this.rememberSentText = (
|
|
4713
|
-
const
|
|
4714
|
-
!
|
|
4715
|
-
}, this.getSentTextHistory = () => this.sentTextHistory, this.registerAgentHandlers = (
|
|
4716
|
-
this.agentHandlers =
|
|
4717
|
-
const
|
|
4718
|
-
this.bufferedAgentSends = [],
|
|
4719
|
-
|
|
5353
|
+
this.sendMessageAbortController.abort("Resetting chat"), this.bufferedAgentSends = [], this.state.reset(), this.messageIdsDispatchedToOnMessageReceivedHook.clear(), this.sentTextHistory = [], this.draftState.reset();
|
|
5354
|
+
}, this.rememberSentText = (_) => {
|
|
5355
|
+
const p = _.trim();
|
|
5356
|
+
!p || this.sentTextHistory.at(-1) === p || (this.sentTextHistory.push(p), this.sentTextHistory.length > C.SENT_TEXT_HISTORY_MAX && this.sentTextHistory.shift());
|
|
5357
|
+
}, this.getSentTextHistory = () => this.sentTextHistory, this.registerAgentHandlers = (_) => {
|
|
5358
|
+
this.agentHandlers = _;
|
|
5359
|
+
const p = this.bufferedAgentSends;
|
|
5360
|
+
this.bufferedAgentSends = [], p.forEach((u) => {
|
|
5361
|
+
C.dispatchToEngine(_, u);
|
|
4720
5362
|
});
|
|
4721
|
-
}, this.unregisterAgentHandlers = (
|
|
4722
|
-
this.agentHandlers ===
|
|
4723
|
-
}, this.dispatchToOnMessageReceivedHook = (
|
|
4724
|
-
var
|
|
4725
|
-
if (
|
|
5363
|
+
}, this.unregisterAgentHandlers = (_) => {
|
|
5364
|
+
this.agentHandlers === _ && (this.agentHandlers = null);
|
|
5365
|
+
}, this.dispatchToOnMessageReceivedHook = (_) => {
|
|
5366
|
+
var u, m;
|
|
5367
|
+
if (_.type === "USER" || this.messageIdsDispatchedToOnMessageReceivedHook.has(_.id))
|
|
4726
5368
|
return;
|
|
4727
|
-
const
|
|
4728
|
-
|
|
4729
|
-
}, this.markAsDispatchedToOnMessageReceivedHook = (
|
|
4730
|
-
|
|
4731
|
-
(
|
|
5369
|
+
const p = this.sessionCtx.sessionState.get().session;
|
|
5370
|
+
p && (this.messageIdsDispatchedToOnMessageReceivedHook.add(_.id), (m = (u = this.config.hooks) == null ? void 0 : u.onMessageReceived) == null || m.call(u, { message: _, session: p }));
|
|
5371
|
+
}, this.markAsDispatchedToOnMessageReceivedHook = (_) => {
|
|
5372
|
+
_.forEach(
|
|
5373
|
+
(p) => this.messageIdsDispatchedToOnMessageReceivedHook.add(p)
|
|
4732
5374
|
);
|
|
4733
5375
|
}, this.buildPersistentInitialMessages = () => {
|
|
4734
|
-
var
|
|
4735
|
-
return !((
|
|
4736
|
-
(
|
|
5376
|
+
var p, u;
|
|
5377
|
+
return !((p = this.sessionCtx.sessionState.get().session) != null && p.id) && this.state.get().messages.length === 0 && ((u = this.config.advancedInitialMessages) == null ? void 0 : u.some((m) => m.persistent)) ? (this.config.advancedInitialMessages || []).filter((m) => m.persistent).map(
|
|
5378
|
+
(m) => ({
|
|
4737
5379
|
id: x(),
|
|
4738
5380
|
component: "bot_message",
|
|
4739
5381
|
type: "AI",
|
|
4740
5382
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4741
|
-
data: { message:
|
|
5383
|
+
data: { message: m.message },
|
|
4742
5384
|
agent: this.config.bot ? { ...this.config.bot, isAi: !0, id: null } : void 0
|
|
4743
5385
|
})
|
|
4744
5386
|
) : [];
|
|
4745
5387
|
}, this.ensureSessionId = async () => {
|
|
4746
|
-
var
|
|
4747
|
-
if (!((
|
|
5388
|
+
var _, p;
|
|
5389
|
+
if (!((_ = this.sessionCtx.sessionState.get().session) != null && _.id)) {
|
|
4748
5390
|
if (!await this.sessionCtx.createSession()) return null;
|
|
4749
5391
|
this.sessionCtx.refreshSessions();
|
|
4750
5392
|
}
|
|
4751
|
-
return ((
|
|
4752
|
-
}, this.rollbackOptimisticMessages = (
|
|
4753
|
-
if (
|
|
4754
|
-
const
|
|
4755
|
-
|
|
4756
|
-
}, this.notifySendAccepted = (
|
|
4757
|
-
var
|
|
5393
|
+
return ((p = this.sessionCtx.sessionState.get().session) == null ? void 0 : p.id) ?? null;
|
|
5394
|
+
}, this.rollbackOptimisticMessages = (_) => {
|
|
5395
|
+
if (_.length === 0) return;
|
|
5396
|
+
const p = new Set(_), u = this.state.get().messages, m = u.filter((g) => !p.has(g.id));
|
|
5397
|
+
m.length !== u.length && this.state.setPartial({ messages: m });
|
|
5398
|
+
}, this.notifySendAccepted = (_) => {
|
|
5399
|
+
var p;
|
|
4758
5400
|
try {
|
|
4759
|
-
(
|
|
4760
|
-
} catch (
|
|
4761
|
-
|
|
5401
|
+
(p = _.onAccepted) == null || p.call(_);
|
|
5402
|
+
} catch (u) {
|
|
5403
|
+
k.error("send acceptance callback failed", u);
|
|
4762
5404
|
}
|
|
4763
|
-
}, this.stageUserTurn = async (
|
|
4764
|
-
const
|
|
4765
|
-
if (!
|
|
4766
|
-
const
|
|
4767
|
-
...
|
|
4768
|
-
|
|
5405
|
+
}, this.stageUserTurn = async (_, { pending: p }) => {
|
|
5406
|
+
const u = this.buildUserMessage(_);
|
|
5407
|
+
if (!u) return null;
|
|
5408
|
+
const m = p ? { ...u, pending: !0 } : u, g = this.buildPersistentInitialMessages(), v = [
|
|
5409
|
+
...g.map((b) => b.id),
|
|
5410
|
+
m.id
|
|
4769
5411
|
];
|
|
4770
5412
|
this.state.setPartial({
|
|
4771
|
-
messages: [
|
|
5413
|
+
messages: [
|
|
5414
|
+
...g,
|
|
5415
|
+
...this.state.get().messages,
|
|
5416
|
+
...m.background ? [] : [m]
|
|
5417
|
+
]
|
|
4772
5418
|
});
|
|
4773
|
-
let
|
|
5419
|
+
let f;
|
|
4774
5420
|
try {
|
|
4775
|
-
|
|
4776
|
-
} catch (
|
|
4777
|
-
throw this.rollbackOptimisticMessages(
|
|
5421
|
+
f = await this.ensureSessionId();
|
|
5422
|
+
} catch (b) {
|
|
5423
|
+
throw this.rollbackOptimisticMessages(v), b;
|
|
4778
5424
|
}
|
|
4779
|
-
return
|
|
4780
|
-
}, this.buildQueuedUserMessage = (
|
|
5425
|
+
return f ? { sessionId: f, userMessage: m, initialMessages: g } : (this.rollbackOptimisticMessages(v), null);
|
|
5426
|
+
}, this.buildQueuedUserMessage = (_) => {
|
|
5427
|
+
var m;
|
|
5428
|
+
const p = this.buildUserMessage(_);
|
|
5429
|
+
if (!p) return null;
|
|
5430
|
+
const u = (m = this.sessionCtx.sessionState.get().session) == null ? void 0 : m.id;
|
|
5431
|
+
return u ? { sessionId: u, userMessage: { ...p, pending: !0 } } : null;
|
|
5432
|
+
}, this.buildUserMessage = (_) => {
|
|
4781
5433
|
var p;
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
);
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
const r = this.state.get().messages, c = r.findIndex(
|
|
4799
|
-
(m) => m.id === s && m.type === "USER" && m.pending
|
|
5434
|
+
return !_.content.trim() && (!_.attachments || _.attachments.length === 0) ? (k.warn("cannot send an empty message of no content or attachments"), null) : {
|
|
5435
|
+
...this.toUserMessage(
|
|
5436
|
+
_.content.trim(),
|
|
5437
|
+
_.attachments || void 0,
|
|
5438
|
+
this.sendsPageContext ? C.markedElementNames(_.clientContext) : void 0,
|
|
5439
|
+
this.sendsPageContext && ((p = _.mentions) != null && p.length) ? _.mentions : void 0
|
|
5440
|
+
),
|
|
5441
|
+
..._.background ? { background: !0 } : {}
|
|
5442
|
+
};
|
|
5443
|
+
}, this.appendUserMessageIfAbsent = (_) => {
|
|
5444
|
+
if (_.background) return;
|
|
5445
|
+
const p = this.state.get().messages;
|
|
5446
|
+
p.some((u) => u.id === _.id) || this.state.setPartial({ messages: [...p, _] });
|
|
5447
|
+
}, this.markUserMessageDelivered = (_) => {
|
|
5448
|
+
const p = this.state.get().messages, u = p.findIndex(
|
|
5449
|
+
(v) => v.id === _ && v.type === "USER" && v.pending
|
|
4800
5450
|
);
|
|
4801
|
-
if (
|
|
4802
|
-
const
|
|
4803
|
-
if (!
|
|
4804
|
-
const
|
|
4805
|
-
|
|
4806
|
-
messages:
|
|
5451
|
+
if (u === -1) return;
|
|
5452
|
+
const m = p[u];
|
|
5453
|
+
if (!m || m.type !== "USER") return;
|
|
5454
|
+
const g = [...p];
|
|
5455
|
+
g[u] = { ...m, pending: !1 }, this.state.setPartial({
|
|
5456
|
+
messages: g
|
|
4807
5457
|
});
|
|
4808
|
-
}, this.sendMessage = async (
|
|
4809
|
-
var
|
|
5458
|
+
}, this.sendMessage = async (_) => {
|
|
5459
|
+
var u, m, g, v, f;
|
|
4810
5460
|
if (this.streaming) {
|
|
4811
5461
|
if (!this.agentHandlers) {
|
|
4812
|
-
this.bufferedAgentSends.push(
|
|
5462
|
+
this.bufferedAgentSends.push(_);
|
|
4813
5463
|
return;
|
|
4814
5464
|
}
|
|
4815
|
-
await this.agentHandlers.send(
|
|
5465
|
+
await this.agentHandlers.send(_);
|
|
4816
5466
|
return;
|
|
4817
5467
|
}
|
|
4818
|
-
let
|
|
5468
|
+
let p;
|
|
4819
5469
|
try {
|
|
4820
|
-
const
|
|
4821
|
-
if (this.blocksSendWhileAwaitingReply && (
|
|
4822
|
-
|
|
4823
|
-
|
|
5470
|
+
const b = this.sessionCtx.sessionState.get().session, R = (b == null ? void 0 : b.assignee.kind) === "ai", X = this.state.get().isSendingMessageToAI, E = this.state.get().messages.at(-1);
|
|
5471
|
+
if (this.blocksSendWhileAwaitingReply && (X || // If last message is from user, then bot response did not arrive yet
|
|
5472
|
+
R && (E == null ? void 0 : E.type) === "USER" && E.id !== this.state.get().settledAgentUserMessageId)) {
|
|
5473
|
+
k.warn("cannot send messages while awaiting AI response");
|
|
4824
5474
|
return;
|
|
4825
5475
|
}
|
|
4826
|
-
this.sendMessageAbortController.abort("Superseded by a newer message"), this.sendMessageAbortController = new AbortController(),
|
|
5476
|
+
this.sendMessageAbortController.abort("Superseded by a newer message"), this.sendMessageAbortController = new AbortController(), p = this.sendMessageAbortController, this.state.setPartial({
|
|
4827
5477
|
lastAIResMightSolveUserIssue: !1,
|
|
4828
5478
|
isSendingMessage: !0,
|
|
4829
|
-
isSendingMessageToAI: !!
|
|
5479
|
+
isSendingMessageToAI: !!R || !b
|
|
4830
5480
|
});
|
|
4831
|
-
const
|
|
4832
|
-
if (!
|
|
4833
|
-
const { sessionId:
|
|
4834
|
-
this.notifySendAccepted(
|
|
4835
|
-
const { data:
|
|
4836
|
-
|
|
5481
|
+
const K = await this.stageUserTurn(_, { pending: !1 });
|
|
5482
|
+
if (!K) return;
|
|
5483
|
+
const { sessionId: ee, userMessage: L, initialMessages: ae } = K;
|
|
5484
|
+
this.notifySendAccepted(_);
|
|
5485
|
+
const { data: y } = await this.api.sendMessage(
|
|
5486
|
+
Na({
|
|
4837
5487
|
config: {
|
|
4838
|
-
...this.
|
|
5488
|
+
...this.getRequestConfig(),
|
|
4839
5489
|
capabilities: this.getClientCapabilities()
|
|
4840
5490
|
},
|
|
4841
|
-
input:
|
|
4842
|
-
uuid:
|
|
4843
|
-
sessionId:
|
|
4844
|
-
content:
|
|
4845
|
-
initialMessages:
|
|
5491
|
+
input: _,
|
|
5492
|
+
uuid: L.id,
|
|
5493
|
+
sessionId: ee,
|
|
5494
|
+
content: L.content,
|
|
5495
|
+
initialMessages: ae,
|
|
4846
5496
|
sendsPageContext: this.sendsPageContext
|
|
4847
5497
|
}),
|
|
4848
|
-
|
|
5498
|
+
p.signal
|
|
4849
5499
|
);
|
|
4850
|
-
if (
|
|
4851
|
-
const
|
|
4852
|
-
if (
|
|
4853
|
-
const
|
|
4854
|
-
if (!!
|
|
4855
|
-
(
|
|
5500
|
+
if (y != null && y.success) {
|
|
5501
|
+
const z = this.toBotMessage(y);
|
|
5502
|
+
if (z) {
|
|
5503
|
+
const A = this.state.get().messages;
|
|
5504
|
+
if (!!A.some(
|
|
5505
|
+
(te) => te.id === z.id
|
|
4856
5506
|
)) {
|
|
4857
5507
|
this.state.setPartial({
|
|
4858
|
-
lastAIResMightSolveUserIssue: ((
|
|
5508
|
+
lastAIResMightSolveUserIssue: ((u = y.autopilotResponse) == null ? void 0 : u.mightSolveUserIssue) || ((m = y.uiResponse) == null ? void 0 : m.mightSolveUserIssue)
|
|
4859
5509
|
});
|
|
4860
5510
|
return;
|
|
4861
5511
|
}
|
|
4862
5512
|
this.state.setPartial({
|
|
4863
|
-
messages: [...
|
|
4864
|
-
lastAIResMightSolveUserIssue: ((
|
|
4865
|
-
}), this.dispatchToOnMessageReceivedHook(
|
|
5513
|
+
messages: [...A, z],
|
|
5514
|
+
lastAIResMightSolveUserIssue: ((g = y.autopilotResponse) == null ? void 0 : g.mightSolveUserIssue) || ((v = y.uiResponse) == null ? void 0 : v.mightSolveUserIssue)
|
|
5515
|
+
}), this.dispatchToOnMessageReceivedHook(z);
|
|
4866
5516
|
}
|
|
4867
|
-
|
|
5517
|
+
y.session && this.sessionCtx.sessionState.setPartial({ session: y.session });
|
|
4868
5518
|
} else {
|
|
4869
|
-
const
|
|
4870
|
-
((
|
|
4871
|
-
),
|
|
5519
|
+
const z = this.toBotErrorMessage(
|
|
5520
|
+
((f = y == null ? void 0 : y.error) == null ? void 0 : f.message) || Ea(this.config, "turn_failed_message")
|
|
5521
|
+
), A = this.state.get().messages;
|
|
4872
5522
|
this.state.setPartial({
|
|
4873
|
-
messages: [...
|
|
5523
|
+
messages: [...A, z]
|
|
4874
5524
|
});
|
|
4875
5525
|
}
|
|
4876
|
-
} catch (
|
|
4877
|
-
|
|
5526
|
+
} catch (b) {
|
|
5527
|
+
p != null && p.signal.aborted || k.error("failed to send message", b);
|
|
4878
5528
|
} finally {
|
|
4879
|
-
|
|
5529
|
+
p != null && p.signal.aborted || this.state.setPartial({
|
|
4880
5530
|
isSendingMessage: !1,
|
|
4881
5531
|
isSendingMessageToAI: !1
|
|
4882
5532
|
});
|
|
4883
5533
|
}
|
|
4884
|
-
}, this.toUserMessage = (
|
|
4885
|
-
const
|
|
4886
|
-
const
|
|
4887
|
-
return this.state.get().messages.length === 0 &&
|
|
5534
|
+
}, this.toUserMessage = (_, p, u, m) => {
|
|
5535
|
+
const g = (() => {
|
|
5536
|
+
const v = this.contactCtx.state.get().extraCollectedData;
|
|
5537
|
+
return this.state.get().messages.length === 0 && v && Object.keys(v).length > 0 ? `${Object.entries(v).filter(([b, w]) => !!w).map(([b, w]) => `${b}: ${w}`).join(`
|
|
4888
5538
|
`)}
|
|
4889
5539
|
|
|
4890
|
-
${
|
|
5540
|
+
${_}` : _;
|
|
4891
5541
|
})();
|
|
4892
5542
|
return {
|
|
4893
5543
|
id: x(),
|
|
4894
5544
|
type: "USER",
|
|
4895
|
-
content:
|
|
4896
|
-
attachments:
|
|
4897
|
-
markedElements:
|
|
4898
|
-
mentions:
|
|
5545
|
+
content: g,
|
|
5546
|
+
attachments: p,
|
|
5547
|
+
markedElements: u,
|
|
5548
|
+
mentions: m,
|
|
4899
5549
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
4900
5550
|
};
|
|
4901
|
-
}, this.toBotMessage = (
|
|
4902
|
-
var
|
|
4903
|
-
return
|
|
5551
|
+
}, this.toBotMessage = (_) => {
|
|
5552
|
+
var p;
|
|
5553
|
+
return _.success && _.autopilotResponse ? {
|
|
4904
5554
|
type: "AI",
|
|
4905
|
-
id:
|
|
5555
|
+
id: _.autopilotResponse.id || x(),
|
|
4906
5556
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4907
5557
|
component: "bot_message",
|
|
4908
5558
|
agent: this.config.bot ? {
|
|
@@ -4914,35 +5564,49 @@ ${s}` : s;
|
|
|
4914
5564
|
id: null
|
|
4915
5565
|
} : void 0,
|
|
4916
5566
|
data: {
|
|
4917
|
-
message:
|
|
4918
|
-
action: (
|
|
4919
|
-
name:
|
|
4920
|
-
data:
|
|
5567
|
+
message: _.autopilotResponse.value.content,
|
|
5568
|
+
action: (p = _.uiResponse) != null && p.value.name ? {
|
|
5569
|
+
name: _.uiResponse.value.name,
|
|
5570
|
+
data: _.uiResponse.value.request_response
|
|
4921
5571
|
} : void 0
|
|
4922
5572
|
}
|
|
4923
5573
|
} : null;
|
|
4924
|
-
}, this.toBotErrorMessage = (
|
|
5574
|
+
}, this.toBotErrorMessage = (_) => ({
|
|
4925
5575
|
type: "AI",
|
|
4926
5576
|
id: x(),
|
|
4927
5577
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4928
5578
|
component: "bot_message",
|
|
4929
5579
|
data: {
|
|
4930
|
-
message:
|
|
5580
|
+
message: _,
|
|
4931
5581
|
variant: "error",
|
|
4932
5582
|
action: void 0
|
|
4933
5583
|
}
|
|
4934
|
-
}), this.config = e, this.getClientCapabilities =
|
|
5584
|
+
}), this.config = e, this.getClientCapabilities = a ?? (() => this.getRequestConfig().capabilities), this.api = t, this.sessionCtx = o, this.contactCtx = r, this.isStreaming = c ?? (() => l), this.getRequestConfig = n ?? (() => this.config), this.getSendsPageContext = d ?? (() => s);
|
|
5585
|
+
}
|
|
5586
|
+
/**
|
|
5587
|
+
* Current transport choice. The org or this embed may request polling
|
|
5588
|
+
* independently of the server's agent version.
|
|
5589
|
+
*/
|
|
5590
|
+
get streaming() {
|
|
5591
|
+
return this.isStreaming();
|
|
5592
|
+
}
|
|
5593
|
+
get sendsPageContext() {
|
|
5594
|
+
return this.getSendsPageContext();
|
|
4935
5595
|
}
|
|
4936
5596
|
/** Hand a send to the streaming engine; its failure can never propagate. */
|
|
4937
5597
|
static dispatchToEngine(e, t) {
|
|
4938
5598
|
try {
|
|
4939
5599
|
Promise.resolve(e.send(t)).catch((o) => {
|
|
4940
|
-
|
|
5600
|
+
k.error("streaming send failed", o);
|
|
4941
5601
|
});
|
|
4942
5602
|
} catch (o) {
|
|
4943
|
-
|
|
5603
|
+
k.error("streaming send failed", o);
|
|
4944
5604
|
}
|
|
4945
5605
|
}
|
|
5606
|
+
get hasPendingAgentWork() {
|
|
5607
|
+
var e, t;
|
|
5608
|
+
return this.bufferedAgentSends.length > 0 || (((t = (e = this.agentHandlers) == null ? void 0 : e.hasPendingWork) == null ? void 0 : t.call(e)) ?? !1);
|
|
5609
|
+
}
|
|
4946
5610
|
/**
|
|
4947
5611
|
* Defensive read of `clientContext.page_marks` → the user bubble's context
|
|
4948
5612
|
* chips: each mark contributes the element it was placed on, the note the
|
|
@@ -4953,17 +5617,17 @@ ${s}` : s;
|
|
|
4953
5617
|
static markedElementNames(e) {
|
|
4954
5618
|
const t = e == null ? void 0 : e.page_marks;
|
|
4955
5619
|
if (!Array.isArray(t)) return;
|
|
4956
|
-
const o = t.flatMap((
|
|
4957
|
-
if (typeof
|
|
4958
|
-
const l =
|
|
4959
|
-
if (typeof
|
|
4960
|
-
const
|
|
5620
|
+
const o = t.flatMap((r) => {
|
|
5621
|
+
if (typeof r != "object" || r === null) return [];
|
|
5622
|
+
const l = r.elements, s = Array.isArray(l) ? l[0] : void 0, a = typeof s == "object" && s !== null && "name" in s ? s.name : void 0;
|
|
5623
|
+
if (typeof a != "string" || a.length === 0) return [];
|
|
5624
|
+
const n = r.note, c = r.snapshotUrl;
|
|
4961
5625
|
return [
|
|
4962
5626
|
{
|
|
4963
|
-
name:
|
|
4964
|
-
...typeof
|
|
4965
|
-
...typeof
|
|
4966
|
-
mark:
|
|
5627
|
+
name: a,
|
|
5628
|
+
...typeof n == "string" && n.length > 0 ? { note: n } : {},
|
|
5629
|
+
...typeof c == "string" && c.length > 0 ? { snapshotUrl: c } : {},
|
|
5630
|
+
mark: r
|
|
4967
5631
|
}
|
|
4968
5632
|
];
|
|
4969
5633
|
});
|
|
@@ -4977,77 +5641,77 @@ ${s}` : s;
|
|
|
4977
5641
|
return !this.streaming && this.config.disableSendingWhenAwaitingAIReply !== !1;
|
|
4978
5642
|
}
|
|
4979
5643
|
};
|
|
4980
|
-
|
|
4981
|
-
let
|
|
4982
|
-
class
|
|
4983
|
-
constructor({
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
sessionCtx: o,
|
|
4987
|
-
resetChat: _
|
|
4988
|
-
}) {
|
|
4989
|
-
var l, a;
|
|
4990
|
-
this.restorableSessionId = null, this.didReadStoredSession = !1, this.readStoredSession = () => {
|
|
5644
|
+
C.SENT_TEXT_HISTORY_MAX = 50;
|
|
5645
|
+
let D = C;
|
|
5646
|
+
class Ra {
|
|
5647
|
+
constructor(e) {
|
|
5648
|
+
var t, o;
|
|
5649
|
+
this.widget = e, this.subscriptions = [], this.disposed = !1, this.restorableSessionId = null, this.didReadStoredSession = !1, this.readStoredSession = () => {
|
|
4991
5650
|
if (!this.shouldRestoreLastSession) {
|
|
4992
5651
|
this.didReadStoredSession = !0;
|
|
4993
5652
|
return;
|
|
4994
5653
|
}
|
|
4995
|
-
this.sessionCtx.getLastActiveSessionId().then((
|
|
4996
|
-
this.restorableSessionId =
|
|
5654
|
+
this.sessionCtx.getLastActiveSessionId().then((r) => {
|
|
5655
|
+
this.restorableSessionId = r;
|
|
4997
5656
|
}).finally(() => {
|
|
4998
5657
|
this.didReadStoredSession = !0, this.routeFromSessions(this.sessionCtx.sessionsState.get());
|
|
4999
5658
|
});
|
|
5000
5659
|
}, this.registerRoutingListener = () => {
|
|
5001
|
-
this.
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5660
|
+
this.subscriptions.push(
|
|
5661
|
+
this.contactCtx.state.subscribe(({ contact: r }) => {
|
|
5662
|
+
var l;
|
|
5663
|
+
r != null && r.token && this.state.get().screen === "welcome" && this.state.setPartial({
|
|
5664
|
+
screen: (l = this.config.router) != null && l.chatScreenOnly ? "chat" : "sessions"
|
|
5665
|
+
});
|
|
5666
|
+
})
|
|
5667
|
+
), this.subscriptions.push(
|
|
5668
|
+
this.sessionCtx.sessionsState.subscribe(this.routeFromSessions)
|
|
5669
|
+
);
|
|
5007
5670
|
}, this.routeFromSessions = ({
|
|
5008
|
-
isInitialFetchLoading:
|
|
5009
|
-
data:
|
|
5671
|
+
isInitialFetchLoading: r,
|
|
5672
|
+
data: l
|
|
5010
5673
|
}) => {
|
|
5011
|
-
var
|
|
5012
|
-
if (this.didReadStoredSession) {
|
|
5013
|
-
if (this.restorableSessionId && !((
|
|
5014
|
-
const
|
|
5015
|
-
(
|
|
5674
|
+
var s, a, n, c, d;
|
|
5675
|
+
if (!(this.disposed || !this.didReadStoredSession)) {
|
|
5676
|
+
if (this.restorableSessionId && !((s = this.sessionCtx.sessionState.get().session) != null && s.id)) {
|
|
5677
|
+
const _ = l.find(
|
|
5678
|
+
(p) => p.id === this.restorableSessionId && p.isOpened
|
|
5016
5679
|
);
|
|
5017
|
-
if (
|
|
5018
|
-
this.restorableSessionId = null, this.toChatScreen(
|
|
5680
|
+
if (_) {
|
|
5681
|
+
this.restorableSessionId = null, this.toChatScreen(_.id);
|
|
5019
5682
|
return;
|
|
5020
5683
|
}
|
|
5021
|
-
if (
|
|
5684
|
+
if (r) return;
|
|
5022
5685
|
this.restorableSessionId = null;
|
|
5023
5686
|
}
|
|
5024
|
-
if ((
|
|
5687
|
+
if ((a = this.config.router) != null && a.chatScreenOnly && // Do not route to a chat if we are currently inside one already
|
|
5025
5688
|
// This also applies to newly created sessions; the new session will be in `sessionState` before it is refreshed and included in `sessionsState`
|
|
5026
|
-
!((
|
|
5027
|
-
const
|
|
5028
|
-
return
|
|
5689
|
+
!((n = this.sessionCtx.sessionState.get().session) != null && n.id)) {
|
|
5690
|
+
const _ = (c = l.find((p) => p.isOpened)) == null ? void 0 : c.id;
|
|
5691
|
+
return _ ? this.toChatScreen(_) : void 0;
|
|
5029
5692
|
}
|
|
5030
|
-
|
|
5693
|
+
l.length || ((d = this.config.router) == null ? void 0 : d.goToChatIfNoSessions) !== !1 && !r && this.state.get().screen !== "chat" && this.toChatScreen();
|
|
5031
5694
|
}
|
|
5695
|
+
}, this.dispose = () => {
|
|
5696
|
+
this.disposed = !0, this.subscriptions.forEach((r) => r()), this.subscriptions = [], this.navigateConversation = void 0;
|
|
5032
5697
|
}, this.toSessionsScreen = () => {
|
|
5033
|
-
this.resetChat(), this.state.setPartial({ screen: "sessions" });
|
|
5034
|
-
}, this.toChatScreen = (
|
|
5035
|
-
var
|
|
5698
|
+
this.navigateConversation || this.resetChat(), this.state.setPartial({ screen: "sessions" });
|
|
5699
|
+
}, this.toChatScreen = (r) => {
|
|
5700
|
+
var s, a;
|
|
5701
|
+
if (this.navigateConversation) return this.navigateConversation(r);
|
|
5036
5702
|
this.resetChat();
|
|
5037
|
-
let
|
|
5038
|
-
if (
|
|
5039
|
-
if (
|
|
5040
|
-
this.sessionCtx.sessionState.setPartial({ session:
|
|
5703
|
+
let l;
|
|
5704
|
+
if (r) {
|
|
5705
|
+
if (l = this.sessionCtx.sessionsState.get().data.find((n) => n.id === r), !l) return;
|
|
5706
|
+
this.sessionCtx.sessionState.setPartial({ session: l });
|
|
5041
5707
|
}
|
|
5042
|
-
this.state.setPartial({ screen: "chat" }), (
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
}, this.
|
|
5046
|
-
screen: this.contactCtx.shouldCollectData() ? "welcome" : (l = this.config.router) != null && l.chatScreenOnly ? "chat" : "sessions"
|
|
5047
|
-
}), this.shouldRestoreLastSession = ((a = this.config.router) == null ? void 0 : a.restoreLastSession) ?? !1, this.readStoredSession(), this.registerRoutingListener();
|
|
5708
|
+
return this.state.setPartial({ screen: "chat" }), (a = (s = this.config.hooks) == null ? void 0 : s.onNavigateToChat) == null || a.call(s, { session: l }), this.widget;
|
|
5709
|
+
}, this.config = e.config, this.contactCtx = e.contactCtx, this.sessionCtx = e.sessionCtx, this.resetChat = e.resetChat, this.state = new S({
|
|
5710
|
+
screen: this.contactCtx.shouldCollectData() ? "welcome" : (t = this.config.router) != null && t.chatScreenOnly ? "chat" : "sessions"
|
|
5711
|
+
}), this.shouldRestoreLastSession = ((o = this.config.router) == null ? void 0 : o.restoreLastSession) ?? !1, this.readStoredSession(), this.registerRoutingListener();
|
|
5048
5712
|
}
|
|
5049
5713
|
}
|
|
5050
|
-
class
|
|
5714
|
+
class Ka {
|
|
5051
5715
|
constructor({
|
|
5052
5716
|
storage: e,
|
|
5053
5717
|
config: t
|
|
@@ -5055,7 +5719,7 @@ class Ca {
|
|
|
5055
5719
|
this.KEYS = {
|
|
5056
5720
|
contactToken: (o) => `opencx-widget:org-token-${o}:contact-token`,
|
|
5057
5721
|
externalContactId: (o) => `opencx-widget:org-token-${o}:external-contact-id`,
|
|
5058
|
-
companionPreference: (o,
|
|
5722
|
+
companionPreference: (o, r) => `opencx-widget:org-token-${o}:companion-${r}`,
|
|
5059
5723
|
activeSession: (o) => `opencx-widget:org-token-${o}:active-session`
|
|
5060
5724
|
}, this.setContactToken = async (o) => {
|
|
5061
5725
|
await this.storage.set(this.KEYS.contactToken(this.config.token), o);
|
|
@@ -5068,9 +5732,9 @@ class Ca {
|
|
|
5068
5732
|
}, this.setExternalContactId = async (o) => {
|
|
5069
5733
|
await this.storage.set(this.KEYS.externalContactId(this.config.token), o);
|
|
5070
5734
|
}, this.getExternalContactId = async () => this.storage.get(this.KEYS.externalContactId(this.config.token)), this.companionKey = (o) => this.KEYS.companionPreference(this.config.token, o), this.getFiniteNumber = async (o) => {
|
|
5071
|
-
const
|
|
5072
|
-
if (
|
|
5073
|
-
const l = Number(
|
|
5735
|
+
const r = await this.storage.get(o);
|
|
5736
|
+
if (r === null) return null;
|
|
5737
|
+
const l = Number(r);
|
|
5074
5738
|
return Number.isFinite(l) ? l : null;
|
|
5075
5739
|
}, this.getCompanionPillOffsetX = async () => this.getFiniteNumber(this.companionKey("pill-offset-x")), this.setCompanionPillOffsetX = async (o) => {
|
|
5076
5740
|
Number.isFinite(o) && await this.storage.set(this.companionKey("pill-offset-x"), String(o));
|
|
@@ -5094,7 +5758,7 @@ class Ca {
|
|
|
5094
5758
|
}, this.storage = e, this.config = t;
|
|
5095
5759
|
}
|
|
5096
5760
|
}
|
|
5097
|
-
function
|
|
5761
|
+
function La({
|
|
5098
5762
|
org: i,
|
|
5099
5763
|
agent: e
|
|
5100
5764
|
}) {
|
|
@@ -5102,6 +5766,7 @@ function qa({
|
|
|
5102
5766
|
name: e.name,
|
|
5103
5767
|
avatarUrl: e.avatar_url,
|
|
5104
5768
|
streaming: e.streaming,
|
|
5769
|
+
...e.presentation ? { presentation: e.presentation } : {},
|
|
5105
5770
|
features: {
|
|
5106
5771
|
dictation: e.features.dictation,
|
|
5107
5772
|
attachments: e.features.attachments,
|
|
@@ -5120,56 +5785,85 @@ function qa({
|
|
|
5120
5785
|
}
|
|
5121
5786
|
};
|
|
5122
5787
|
}
|
|
5123
|
-
function
|
|
5788
|
+
function M(i, e) {
|
|
5124
5789
|
return i && e !== !1;
|
|
5125
5790
|
}
|
|
5126
|
-
function
|
|
5791
|
+
function Fa(i, e) {
|
|
5127
5792
|
const t = e.features;
|
|
5128
5793
|
return {
|
|
5129
|
-
dictation:
|
|
5794
|
+
dictation: M(i.features.dictation, t == null ? void 0 : t.dictation),
|
|
5130
5795
|
attachments: i.features.attachments,
|
|
5131
|
-
pageContext:
|
|
5796
|
+
pageContext: M(
|
|
5132
5797
|
i.features.pageContext,
|
|
5133
5798
|
t == null ? void 0 : t.pageContext
|
|
5134
5799
|
),
|
|
5135
|
-
clientTools:
|
|
5800
|
+
clientTools: M(
|
|
5136
5801
|
i.features.clientTools,
|
|
5137
5802
|
t == null ? void 0 : t.clientTools
|
|
5138
5803
|
)
|
|
5139
5804
|
};
|
|
5140
5805
|
}
|
|
5141
|
-
class
|
|
5806
|
+
class Oa extends Error {
|
|
5142
5807
|
constructor(e, t, o) {
|
|
5143
5808
|
super(t), this.name = "WidgetInitializationError", this.code = e, this.details = o;
|
|
5144
5809
|
}
|
|
5145
5810
|
}
|
|
5146
|
-
const
|
|
5811
|
+
const j = class j {
|
|
5147
5812
|
constructor({
|
|
5148
5813
|
config: e,
|
|
5149
5814
|
storage: t,
|
|
5150
5815
|
getClientCapabilities: o,
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5816
|
+
getRequestConfig: r,
|
|
5817
|
+
modes: l,
|
|
5818
|
+
org: s,
|
|
5819
|
+
agent: a,
|
|
5820
|
+
parent: n
|
|
5154
5821
|
}) {
|
|
5155
|
-
if (this.modes = [], this.
|
|
5156
|
-
|
|
5157
|
-
|
|
5822
|
+
if (this.modes = [], this.disposed = !1, this.createConversation = () => {
|
|
5823
|
+
const c = new j({
|
|
5824
|
+
config: {
|
|
5825
|
+
...this.config,
|
|
5826
|
+
router: {
|
|
5827
|
+
...this.config.router,
|
|
5828
|
+
restoreLastSession: !1,
|
|
5829
|
+
chatScreenOnly: !1,
|
|
5830
|
+
goToChatIfNoSessions: !1
|
|
5831
|
+
}
|
|
5832
|
+
},
|
|
5833
|
+
modes: this.modes,
|
|
5834
|
+
org: this.org,
|
|
5835
|
+
agent: this.agent,
|
|
5836
|
+
parent: this,
|
|
5837
|
+
getRequestConfig: this.getRequestConfig,
|
|
5838
|
+
getClientCapabilities: this.getClientCapabilities
|
|
5839
|
+
});
|
|
5840
|
+
return c.routerCtx.state.setPartial({
|
|
5841
|
+
screen: this.contactCtx.shouldCollectData() ? "welcome" : "chat"
|
|
5842
|
+
}), c;
|
|
5843
|
+
}, this.releaseConversation = () => this.dispose(), this.dispose = ({ clearActiveSession: c = !1 } = {}) => {
|
|
5844
|
+
if (this.disposed) return;
|
|
5845
|
+
this.disposed = !0, this.routerCtx.dispose(), this.activeSessionPollingCtx.dispose();
|
|
5846
|
+
const d = this.sessionCtx.dispose({ clearActiveSession: c });
|
|
5847
|
+
return this.messageCtx.reset(), this.uploadCtx.reset(), this.dictationCtx.stop(), d;
|
|
5848
|
+
}, this.resetChat = () => {
|
|
5849
|
+
this.sessionCtx.reset(), this.messageCtx.reset(), this.uploadCtx.reset();
|
|
5850
|
+
}, this.reconcileAfterStream = (c) => this.activeSessionPollingCtx.reconcileAfterStream(c), !j.pollingIntervalsSeconds)
|
|
5158
5851
|
throw Error(
|
|
5159
5852
|
"Widget polling values are not defined, did you call WidgetCtx.initialize()"
|
|
5160
5853
|
);
|
|
5161
|
-
this.config = e, this.
|
|
5854
|
+
this.config = e, this.getRequestConfig = r ?? (() => this.config), this.getClientCapabilities = o, this.org = s, this.agent = a, this.api = (n == null ? void 0 : n.api) ?? new B({ config: e }), this.storageCtx = (n == null ? void 0 : n.storageCtx) ?? (t ? new Ka({ storage: t, config: e }) : void 0), this.modes = l, this.contactCtx = (n == null ? void 0 : n.contactCtx) ?? new ge({
|
|
5162
5855
|
api: this.api,
|
|
5163
5856
|
config: this.config,
|
|
5164
5857
|
storageCtx: this.storageCtx
|
|
5165
|
-
}), this.sessionCtx = new
|
|
5858
|
+
}), this.sessionCtx = new Aa({
|
|
5166
5859
|
config: this.config,
|
|
5167
5860
|
api: this.api,
|
|
5168
5861
|
contactCtx: this.contactCtx,
|
|
5169
5862
|
// Remembers the open conversation so a reload can return to it.
|
|
5170
|
-
storageCtx: this.storageCtx,
|
|
5171
|
-
|
|
5172
|
-
|
|
5863
|
+
storageCtx: n ? void 0 : this.storageCtx,
|
|
5864
|
+
sharedSessions: n == null ? void 0 : n.sessionCtx.sessionsState,
|
|
5865
|
+
sessionsPollingIntervalSeconds: j.pollingIntervalsSeconds.sessions
|
|
5866
|
+
}), this.messageCtx = new D({
|
|
5173
5867
|
config: this.config,
|
|
5174
5868
|
api: this.api,
|
|
5175
5869
|
sessionCtx: this.sessionCtx,
|
|
@@ -5177,69 +5871,79 @@ const v = class v {
|
|
|
5177
5871
|
// Streaming orgs send their turns over the AI SDK transport instead of
|
|
5178
5872
|
// the blocking bot-chat send.
|
|
5179
5873
|
streaming: this.streaming,
|
|
5874
|
+
isStreaming: () => this.streaming,
|
|
5180
5875
|
sendsPageContext: this.features.pageContext,
|
|
5181
|
-
|
|
5182
|
-
|
|
5876
|
+
getSendsPageContext: () => this.features.pageContext,
|
|
5877
|
+
getClientCapabilities: o,
|
|
5878
|
+
getRequestConfig: r
|
|
5879
|
+
}), this.uploadCtx = new ke(this.api), this.csatCtx = new be({
|
|
5183
5880
|
api: this.api,
|
|
5184
5881
|
sessionCtx: this.sessionCtx,
|
|
5185
5882
|
messageCtx: this.messageCtx
|
|
5186
|
-
}), this.dictationCtx = new
|
|
5883
|
+
}), this.dictationCtx = new Fe({
|
|
5187
5884
|
api: this.api,
|
|
5188
5885
|
config: this.config
|
|
5189
|
-
}), this.activeSessionPollingCtx = new
|
|
5886
|
+
}), this.activeSessionPollingCtx = new he({
|
|
5190
5887
|
api: this.api,
|
|
5191
5888
|
config: this.config,
|
|
5192
5889
|
sessionCtx: this.sessionCtx,
|
|
5193
5890
|
messageCtx: this.messageCtx,
|
|
5194
|
-
sessionPollingIntervalSeconds:
|
|
5195
|
-
}), this.routerCtx = new
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
});
|
|
5891
|
+
sessionPollingIntervalSeconds: j.pollingIntervalsSeconds.session
|
|
5892
|
+
}), this.routerCtx = new Ra(this);
|
|
5893
|
+
}
|
|
5894
|
+
get streaming() {
|
|
5895
|
+
var e, t;
|
|
5896
|
+
return (e = this.messageCtx) != null && e.hasPendingAgentWork ? !0 : (t = this.messageCtx) != null && t.state.get().isSendingMessage ? !1 : this.agent.streaming && this.getRequestConfig().streaming !== !1;
|
|
5201
5897
|
}
|
|
5202
5898
|
/**
|
|
5203
|
-
*
|
|
5204
|
-
*
|
|
5205
|
-
* "which engine?" decision in the widget.
|
|
5899
|
+
* The org's features narrowed by this embed's `config.features` — the
|
|
5900
|
+
* answers the UI asks for, resolved against the current options.
|
|
5206
5901
|
*/
|
|
5207
|
-
get
|
|
5208
|
-
return this.agent.
|
|
5902
|
+
get features() {
|
|
5903
|
+
return Fa(this.agent, this.getRequestConfig());
|
|
5209
5904
|
}
|
|
5210
5905
|
};
|
|
5211
|
-
|
|
5906
|
+
j.pollingIntervalsSeconds = null, j.initialize = async ({
|
|
5212
5907
|
config: e,
|
|
5213
5908
|
storage: t,
|
|
5214
|
-
getClientCapabilities: o
|
|
5909
|
+
getClientCapabilities: o,
|
|
5910
|
+
getRequestConfig: r
|
|
5215
5911
|
}) => {
|
|
5216
|
-
var
|
|
5217
|
-
const
|
|
5912
|
+
var s, a;
|
|
5913
|
+
const l = await new B({
|
|
5218
5914
|
config: e
|
|
5219
5915
|
}).getExternalWidgetConfig();
|
|
5220
|
-
if (!
|
|
5221
|
-
throw
|
|
5916
|
+
if (!l.data)
|
|
5917
|
+
throw k.error("widget config fetch failed", l.error), new Oa(
|
|
5222
5918
|
"config-fetch-failed",
|
|
5223
5919
|
"Failed to fetch widget config",
|
|
5224
|
-
|
|
5920
|
+
l.error
|
|
5225
5921
|
);
|
|
5226
|
-
return
|
|
5227
|
-
session: ((
|
|
5228
|
-
sessions: ((a =
|
|
5229
|
-
}, new
|
|
5922
|
+
return j.pollingIntervalsSeconds = {
|
|
5923
|
+
session: ((s = l.data) == null ? void 0 : s.sessionPollingIntervalSeconds) || 10,
|
|
5924
|
+
sessions: ((a = l.data) == null ? void 0 : a.sessionsPollingIntervalSeconds) || 60
|
|
5925
|
+
}, new j({
|
|
5230
5926
|
config: e,
|
|
5231
5927
|
storage: t,
|
|
5232
5928
|
getClientCapabilities: o,
|
|
5233
|
-
|
|
5929
|
+
getRequestConfig: r,
|
|
5930
|
+
modes: l.data.modes || [],
|
|
5234
5931
|
org: {
|
|
5235
|
-
id:
|
|
5236
|
-
name:
|
|
5932
|
+
id: l.data.org.id,
|
|
5933
|
+
name: l.data.org.name
|
|
5237
5934
|
},
|
|
5238
|
-
agent:
|
|
5935
|
+
agent: La(l.data)
|
|
5239
5936
|
});
|
|
5240
5937
|
};
|
|
5241
|
-
let
|
|
5242
|
-
|
|
5938
|
+
let W = j;
|
|
5939
|
+
function Ya(i, e) {
|
|
5940
|
+
return i ? {
|
|
5941
|
+
streaming: i.streaming && (e == null ? void 0 : e.streaming) !== !1,
|
|
5942
|
+
toolActivity: i.toolActivity === "hidden" || (e == null ? void 0 : e.toolActivity) === "hidden" ? "hidden" : i.toolActivity === "status" || (e == null ? void 0 : e.toolActivity) === "status" ? "status" : "details",
|
|
5943
|
+
reasoning: i.reasoning && (e == null ? void 0 : e.reasoning) !== !1
|
|
5944
|
+
} : e;
|
|
5945
|
+
}
|
|
5946
|
+
class Qa {
|
|
5243
5947
|
constructor({ attack: e, release: t }) {
|
|
5244
5948
|
this.value = 0, this.attack = e, this.release = t;
|
|
5245
5949
|
}
|
|
@@ -5250,53 +5954,56 @@ class La {
|
|
|
5250
5954
|
return this.value;
|
|
5251
5955
|
}
|
|
5252
5956
|
}
|
|
5253
|
-
const
|
|
5957
|
+
const T = [
|
|
5254
5958
|
"compact",
|
|
5255
5959
|
"sidebar",
|
|
5256
5960
|
"fullscreen"
|
|
5257
|
-
],
|
|
5258
|
-
|
|
5961
|
+
], Ua = new Set(
|
|
5962
|
+
T
|
|
5259
5963
|
);
|
|
5260
|
-
function
|
|
5261
|
-
return
|
|
5964
|
+
function Q(i) {
|
|
5965
|
+
return Ua.has(i);
|
|
5262
5966
|
}
|
|
5263
|
-
function
|
|
5264
|
-
if (!Array.isArray(i)) return
|
|
5967
|
+
function Xa(i) {
|
|
5968
|
+
if (!Array.isArray(i)) return T;
|
|
5265
5969
|
const e = [], t = /* @__PURE__ */ new Set();
|
|
5266
5970
|
for (const o of i)
|
|
5267
|
-
!
|
|
5268
|
-
return e.length > 0 ? e :
|
|
5971
|
+
!Q(o) || t.has(o) || (t.add(o), e.push(o));
|
|
5972
|
+
return e.length > 0 ? e : T;
|
|
5269
5973
|
}
|
|
5270
|
-
function
|
|
5271
|
-
return
|
|
5974
|
+
function et(i, e) {
|
|
5975
|
+
return Q(i) && e.includes(i) ? i : e[0] ?? T[0];
|
|
5272
5976
|
}
|
|
5273
|
-
function
|
|
5977
|
+
function at(i, e) {
|
|
5274
5978
|
return i === "left" || i === "right" ? i : e === "rtl" ? "left" : "right";
|
|
5275
5979
|
}
|
|
5276
|
-
function
|
|
5980
|
+
function tt(i) {
|
|
5277
5981
|
return i === "docked" ? "docked" : "floating";
|
|
5278
5982
|
}
|
|
5279
5983
|
export {
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5984
|
+
pe as ConnectionAttemptUnavailableError,
|
|
5985
|
+
ce as ConnectionRequestExpiredError,
|
|
5986
|
+
Qa as DictationLevelSmoother,
|
|
5987
|
+
S as PrimitiveState,
|
|
5988
|
+
W as WidgetCtx,
|
|
5989
|
+
Oa as WidgetInitializationError,
|
|
5990
|
+
Na as buildSendMessageBody,
|
|
5285
5991
|
x as genUuid,
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5992
|
+
qa as getTranslation,
|
|
5993
|
+
Ga as isAgentStreamKeepalive,
|
|
5994
|
+
me as isExhaustive,
|
|
5995
|
+
Z as isRecord,
|
|
5996
|
+
Ja as isRtlLanguage,
|
|
5997
|
+
za as isSupportedLanguage,
|
|
5998
|
+
$a as isTurnSteeredPart,
|
|
5999
|
+
k as log,
|
|
6000
|
+
Xa as normalizeCompanionLayouts,
|
|
6001
|
+
Ya as resolveClientPresentation,
|
|
6002
|
+
et as resolveCompanionDefaultLayout,
|
|
6003
|
+
Ma as resolveConfigContext,
|
|
6004
|
+
xa as resolveLanguage,
|
|
6005
|
+
tt as resolveSidebarMode,
|
|
6006
|
+
at as resolveSidebarSide,
|
|
6007
|
+
Ea as translate
|
|
5301
6008
|
};
|
|
5302
6009
|
//# sourceMappingURL=index.js.map
|