@diffsome/sdk 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -15122,6 +15122,15 @@ interface SendMessageData {
|
|
|
15122
15122
|
interface ChatAvailability {
|
|
15123
15123
|
available: boolean;
|
|
15124
15124
|
agents_online: number;
|
|
15125
|
+
within_operating_hours: boolean;
|
|
15126
|
+
offline_message?: string;
|
|
15127
|
+
operating_hours?: {
|
|
15128
|
+
timezone: string;
|
|
15129
|
+
today: {
|
|
15130
|
+
start: string;
|
|
15131
|
+
end: string;
|
|
15132
|
+
} | null;
|
|
15133
|
+
};
|
|
15125
15134
|
}
|
|
15126
15135
|
interface PollResponse {
|
|
15127
15136
|
messages: ChatMessage[];
|
package/dist/index.d.ts
CHANGED
|
@@ -15122,6 +15122,15 @@ interface SendMessageData {
|
|
|
15122
15122
|
interface ChatAvailability {
|
|
15123
15123
|
available: boolean;
|
|
15124
15124
|
agents_online: number;
|
|
15125
|
+
within_operating_hours: boolean;
|
|
15126
|
+
offline_message?: string;
|
|
15127
|
+
operating_hours?: {
|
|
15128
|
+
timezone: string;
|
|
15129
|
+
today: {
|
|
15130
|
+
start: string;
|
|
15131
|
+
end: string;
|
|
15132
|
+
} | null;
|
|
15133
|
+
};
|
|
15125
15134
|
}
|
|
15126
15135
|
interface PollResponse {
|
|
15127
15136
|
messages: ChatMessage[];
|
package/dist/index.js
CHANGED
|
@@ -1953,7 +1953,17 @@ var ChatResource = class {
|
|
|
1953
1953
|
connectWebSocket();
|
|
1954
1954
|
}
|
|
1955
1955
|
return {
|
|
1956
|
-
send: (content, type) =>
|
|
1956
|
+
send: async (content, type) => {
|
|
1957
|
+
const response = await this.send(conversationId, { content, type });
|
|
1958
|
+
if (response) {
|
|
1959
|
+
const maxId = response.bot_response ? Math.max(response.id, response.bot_response.id) : response.id;
|
|
1960
|
+
const currentLast = this.lastMessageIds.get(conversationId) || 0;
|
|
1961
|
+
if (maxId > currentLast) {
|
|
1962
|
+
this.lastMessageIds.set(conversationId, maxId);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
return response;
|
|
1966
|
+
},
|
|
1957
1967
|
getMessages: (params) => this.getMessages(conversationId, params),
|
|
1958
1968
|
onMessage: (callback) => {
|
|
1959
1969
|
messageListeners.push(callback);
|
package/dist/index.mjs
CHANGED
|
@@ -1923,7 +1923,17 @@ var ChatResource = class {
|
|
|
1923
1923
|
connectWebSocket();
|
|
1924
1924
|
}
|
|
1925
1925
|
return {
|
|
1926
|
-
send: (content, type) =>
|
|
1926
|
+
send: async (content, type) => {
|
|
1927
|
+
const response = await this.send(conversationId, { content, type });
|
|
1928
|
+
if (response) {
|
|
1929
|
+
const maxId = response.bot_response ? Math.max(response.id, response.bot_response.id) : response.id;
|
|
1930
|
+
const currentLast = this.lastMessageIds.get(conversationId) || 0;
|
|
1931
|
+
if (maxId > currentLast) {
|
|
1932
|
+
this.lastMessageIds.set(conversationId, maxId);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return response;
|
|
1936
|
+
},
|
|
1927
1937
|
getMessages: (params) => this.getMessages(conversationId, params),
|
|
1928
1938
|
onMessage: (callback) => {
|
|
1929
1939
|
messageListeners.push(callback);
|