@diffsome/react 1.3.0 → 1.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.js CHANGED
@@ -2908,11 +2908,12 @@ var ChatBubble = ({
2908
2908
  if (seenMessageIds.current.has(msg.id)) {
2909
2909
  return;
2910
2910
  }
2911
+ if (msg.sender_type === "visitor") {
2912
+ return;
2913
+ }
2911
2914
  seenMessageIds.current.add(msg.id);
2912
2915
  setMessages((prev) => [...prev, msg]);
2913
- if (msg.sender_type !== "visitor") {
2914
- setUnreadCount((c) => c + 1);
2915
- }
2916
+ setUnreadCount((c) => c + 1);
2916
2917
  });
2917
2918
  conn.onTyping((senderType) => {
2918
2919
  if (senderType === "agent") {
@@ -3000,11 +3001,13 @@ var ChatBubble = ({
3000
3001
  const response = await conn.send(content);
3001
3002
  if (response) {
3002
3003
  seenMessageIds.current.add(response.id);
3004
+ if (response.bot_response) {
3005
+ seenMessageIds.current.add(response.bot_response.id);
3006
+ }
3003
3007
  setMessages(
3004
3008
  (prev) => prev.map((m) => m.id === tempId ? { ...response, is_pending: false } : m)
3005
3009
  );
3006
3010
  if (response.bot_response) {
3007
- seenMessageIds.current.add(response.bot_response.id);
3008
3011
  setMessages((prev) => [...prev, response.bot_response]);
3009
3012
  }
3010
3013
  }
package/dist/index.mjs CHANGED
@@ -2816,11 +2816,12 @@ var ChatBubble = ({
2816
2816
  if (seenMessageIds.current.has(msg.id)) {
2817
2817
  return;
2818
2818
  }
2819
+ if (msg.sender_type === "visitor") {
2820
+ return;
2821
+ }
2819
2822
  seenMessageIds.current.add(msg.id);
2820
2823
  setMessages((prev) => [...prev, msg]);
2821
- if (msg.sender_type !== "visitor") {
2822
- setUnreadCount((c) => c + 1);
2823
- }
2824
+ setUnreadCount((c) => c + 1);
2824
2825
  });
2825
2826
  conn.onTyping((senderType) => {
2826
2827
  if (senderType === "agent") {
@@ -2908,11 +2909,13 @@ var ChatBubble = ({
2908
2909
  const response = await conn.send(content);
2909
2910
  if (response) {
2910
2911
  seenMessageIds.current.add(response.id);
2912
+ if (response.bot_response) {
2913
+ seenMessageIds.current.add(response.bot_response.id);
2914
+ }
2911
2915
  setMessages(
2912
2916
  (prev) => prev.map((m) => m.id === tempId ? { ...response, is_pending: false } : m)
2913
2917
  );
2914
2918
  if (response.bot_response) {
2915
- seenMessageIds.current.add(response.bot_response.id);
2916
2919
  setMessages((prev) => [...prev, response.bot_response]);
2917
2920
  }
2918
2921
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffsome/react",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "React hooks and providers for Diffsome SDK - Headless e-commerce & CMS",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",