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/tevroc-sdk.esm.js
CHANGED
|
@@ -40844,6 +40844,7 @@ function createAgentNotificationService(client) {
|
|
|
40844
40844
|
body: request.body,
|
|
40845
40845
|
data: { sessionId: request.sessionId, kind: request.kind || "agent_request" },
|
|
40846
40846
|
channel: "agent_requests",
|
|
40847
|
+
style: request.style,
|
|
40847
40848
|
actions: [
|
|
40848
40849
|
...request.kind === "agent_message" ? [] : [
|
|
40849
40850
|
{ id: "accept", title: "Accept" },
|
|
@@ -40853,7 +40854,7 @@ function createAgentNotificationService(client) {
|
|
|
40853
40854
|
{ id: "reply", title: "Reply", input: true }
|
|
40854
40855
|
]
|
|
40855
40856
|
});
|
|
40856
|
-
const check = async ({ appId = client.appId } = {}) => {
|
|
40857
|
+
const check = async ({ appId = client.appId, notificationStyle } = {}) => {
|
|
40857
40858
|
const sessions = toList(await client.entities.ChatSession.query({ filter: { appId, status: "escalated" }, limit: 100 }));
|
|
40858
40859
|
for (const session of sessions) {
|
|
40859
40860
|
const sessionId = getSessionId(session);
|
|
@@ -40868,7 +40869,8 @@ function createAgentNotificationService(client) {
|
|
|
40868
40869
|
title: `Support request from ${session.visitor_name || "a visitor"}`,
|
|
40869
40870
|
body: latest?.content || "A visitor is requesting a human agent.",
|
|
40870
40871
|
latestMessage: latest,
|
|
40871
|
-
session
|
|
40872
|
+
session,
|
|
40873
|
+
style: notificationStyle
|
|
40872
40874
|
};
|
|
40873
40875
|
await showNative(request);
|
|
40874
40876
|
notify({ type: "request", ...request });
|
|
@@ -40890,7 +40892,8 @@ function createAgentNotificationService(client) {
|
|
|
40890
40892
|
title: `New message from ${session.visitor_name || "visitor"}`,
|
|
40891
40893
|
body: latestVisitor.content || "The visitor sent an attachment.",
|
|
40892
40894
|
latestMessage: latestVisitor,
|
|
40893
|
-
session
|
|
40895
|
+
session,
|
|
40896
|
+
style: notificationStyle
|
|
40894
40897
|
};
|
|
40895
40898
|
await showNative(request);
|
|
40896
40899
|
notify({ type: "message", ...request });
|
|
@@ -40990,7 +40993,8 @@ function createNotificationService() {
|
|
|
40990
40993
|
data: options.data || {},
|
|
40991
40994
|
actions: options.actions || [],
|
|
40992
40995
|
silent: Boolean(options.silent),
|
|
40993
|
-
channel: options.channel || "general"
|
|
40996
|
+
channel: options.channel || "general",
|
|
40997
|
+
style: options.style || {}
|
|
40994
40998
|
};
|
|
40995
40999
|
const plugin = appPlugin();
|
|
40996
41000
|
if (plugin?.show) {
|
|
@@ -41050,7 +41054,7 @@ function createNotificationService() {
|
|
|
41050
41054
|
function createChatNotificationService(client) {
|
|
41051
41055
|
const listeners2 = /* @__PURE__ */ new Set();
|
|
41052
41056
|
const emit2 = (event) => listeners2.forEach((listener) => listener(event));
|
|
41053
|
-
const showMessage = async ({ sessionId, title = "New chat message", body = "", data = {} } = {}) => {
|
|
41057
|
+
const showMessage = async ({ sessionId, title = "New chat message", body = "", data = {}, style } = {}) => {
|
|
41054
41058
|
if (!sessionId) return null;
|
|
41055
41059
|
return client.notifications.show({
|
|
41056
41060
|
id: `chat-message-${sessionId}-${Date.now()}`,
|
|
@@ -41058,13 +41062,14 @@ function createChatNotificationService(client) {
|
|
|
41058
41062
|
body,
|
|
41059
41063
|
data: { ...data, sessionId, kind: "chat_message" },
|
|
41060
41064
|
channel: "chat_messages",
|
|
41065
|
+
style,
|
|
41061
41066
|
actions: [
|
|
41062
41067
|
{ id: "open", title: "Open chat" },
|
|
41063
41068
|
{ id: "reply", title: "Reply", input: true }
|
|
41064
41069
|
]
|
|
41065
41070
|
});
|
|
41066
41071
|
};
|
|
41067
|
-
const showStatus = async ({ sessionId, title = "Chat update", body = "", data = {} } = {}) => {
|
|
41072
|
+
const showStatus = async ({ sessionId, title = "Chat update", body = "", data = {}, style } = {}) => {
|
|
41068
41073
|
if (!sessionId) return null;
|
|
41069
41074
|
return client.notifications.show({
|
|
41070
41075
|
id: `chat-status-${sessionId}-${Date.now()}`,
|
|
@@ -41072,6 +41077,7 @@ function createChatNotificationService(client) {
|
|
|
41072
41077
|
body,
|
|
41073
41078
|
data: { ...data, sessionId, kind: "chat_status" },
|
|
41074
41079
|
channel: "chat_messages",
|
|
41080
|
+
style,
|
|
41075
41081
|
actions: [{ id: "open", title: "Open chat" }]
|
|
41076
41082
|
});
|
|
41077
41083
|
};
|