tevrocsdk 0.1.73 → 0.1.74
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/package.json +1 -1
- package/tevroc-sdk.cjs.js +12 -6
- package/tevroc-sdk.cjs.js.map +2 -2
- package/tevroc-sdk.esm.js +12 -6
- package/tevroc-sdk.esm.js.map +2 -2
package/package.json
CHANGED
package/tevroc-sdk.cjs.js
CHANGED
|
@@ -47325,6 +47325,7 @@ function createAgentNotificationService(client) {
|
|
|
47325
47325
|
body: request.body,
|
|
47326
47326
|
data: { sessionId: request.sessionId, kind: request.kind || "agent_request" },
|
|
47327
47327
|
channel: "agent_requests",
|
|
47328
|
+
style: request.style,
|
|
47328
47329
|
actions: [
|
|
47329
47330
|
...request.kind === "agent_message" ? [] : [
|
|
47330
47331
|
{ id: "accept", title: "Accept" },
|
|
@@ -47334,7 +47335,7 @@ function createAgentNotificationService(client) {
|
|
|
47334
47335
|
{ id: "reply", title: "Reply", input: true }
|
|
47335
47336
|
]
|
|
47336
47337
|
});
|
|
47337
|
-
const check = async ({ appId = client.appId } = {}) => {
|
|
47338
|
+
const check = async ({ appId = client.appId, notificationStyle } = {}) => {
|
|
47338
47339
|
const sessions = toList(await client.entities.ChatSession.query({ filter: { appId, status: "escalated" }, limit: 100 }));
|
|
47339
47340
|
for (const session of sessions) {
|
|
47340
47341
|
const sessionId = getSessionId(session);
|
|
@@ -47349,7 +47350,8 @@ function createAgentNotificationService(client) {
|
|
|
47349
47350
|
title: `Support request from ${session.visitor_name || "a visitor"}`,
|
|
47350
47351
|
body: latest?.content || "A visitor is requesting a human agent.",
|
|
47351
47352
|
latestMessage: latest,
|
|
47352
|
-
session
|
|
47353
|
+
session,
|
|
47354
|
+
style: notificationStyle
|
|
47353
47355
|
};
|
|
47354
47356
|
await showNative(request);
|
|
47355
47357
|
notify({ type: "request", ...request });
|
|
@@ -47371,7 +47373,8 @@ function createAgentNotificationService(client) {
|
|
|
47371
47373
|
title: `New message from ${session.visitor_name || "visitor"}`,
|
|
47372
47374
|
body: latestVisitor.content || "The visitor sent an attachment.",
|
|
47373
47375
|
latestMessage: latestVisitor,
|
|
47374
|
-
session
|
|
47376
|
+
session,
|
|
47377
|
+
style: notificationStyle
|
|
47375
47378
|
};
|
|
47376
47379
|
await showNative(request);
|
|
47377
47380
|
notify({ type: "message", ...request });
|
|
@@ -47471,7 +47474,8 @@ function createNotificationService() {
|
|
|
47471
47474
|
data: options.data || {},
|
|
47472
47475
|
actions: options.actions || [],
|
|
47473
47476
|
silent: Boolean(options.silent),
|
|
47474
|
-
channel: options.channel || "general"
|
|
47477
|
+
channel: options.channel || "general",
|
|
47478
|
+
style: options.style || {}
|
|
47475
47479
|
};
|
|
47476
47480
|
const plugin = appPlugin();
|
|
47477
47481
|
if (plugin?.show) {
|
|
@@ -47531,7 +47535,7 @@ function createNotificationService() {
|
|
|
47531
47535
|
function createChatNotificationService(client) {
|
|
47532
47536
|
const listeners2 = /* @__PURE__ */ new Set();
|
|
47533
47537
|
const emit2 = (event) => listeners2.forEach((listener) => listener(event));
|
|
47534
|
-
const showMessage = async ({ sessionId, title = "New chat message", body = "", data = {} } = {}) => {
|
|
47538
|
+
const showMessage = async ({ sessionId, title = "New chat message", body = "", data = {}, style } = {}) => {
|
|
47535
47539
|
if (!sessionId) return null;
|
|
47536
47540
|
return client.notifications.show({
|
|
47537
47541
|
id: `chat-message-${sessionId}-${Date.now()}`,
|
|
@@ -47539,13 +47543,14 @@ function createChatNotificationService(client) {
|
|
|
47539
47543
|
body,
|
|
47540
47544
|
data: { ...data, sessionId, kind: "chat_message" },
|
|
47541
47545
|
channel: "chat_messages",
|
|
47546
|
+
style,
|
|
47542
47547
|
actions: [
|
|
47543
47548
|
{ id: "open", title: "Open chat" },
|
|
47544
47549
|
{ id: "reply", title: "Reply", input: true }
|
|
47545
47550
|
]
|
|
47546
47551
|
});
|
|
47547
47552
|
};
|
|
47548
|
-
const showStatus = async ({ sessionId, title = "Chat update", body = "", data = {} } = {}) => {
|
|
47553
|
+
const showStatus = async ({ sessionId, title = "Chat update", body = "", data = {}, style } = {}) => {
|
|
47549
47554
|
if (!sessionId) return null;
|
|
47550
47555
|
return client.notifications.show({
|
|
47551
47556
|
id: `chat-status-${sessionId}-${Date.now()}`,
|
|
@@ -47553,6 +47558,7 @@ function createChatNotificationService(client) {
|
|
|
47553
47558
|
body,
|
|
47554
47559
|
data: { ...data, sessionId, kind: "chat_status" },
|
|
47555
47560
|
channel: "chat_messages",
|
|
47561
|
+
style,
|
|
47556
47562
|
actions: [{ id: "open", title: "Open chat" }]
|
|
47557
47563
|
});
|
|
47558
47564
|
};
|