@diffsome/sdk 3.3.0 → 3.3.1

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.js CHANGED
@@ -1953,7 +1953,17 @@ var ChatResource = class {
1953
1953
  connectWebSocket();
1954
1954
  }
1955
1955
  return {
1956
- send: (content, type) => this.send(conversationId, { 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) => this.send(conversationId, { 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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffsome/sdk",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Diffsome SDK for JavaScript/TypeScript - Different + Awesome",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",