@droppii-org/chat-sdk 0.4.15 → 0.4.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAQ3C,QAAA,MAAM,oBAAoB,gFA0XvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAQ3C,QAAA,MAAM,oBAAoB,gFA+XvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
@@ -86,7 +86,7 @@ const useConversationStore = create((set, get) => ({
86
86
  }));
87
87
  },
88
88
  updateCurrentConversation: async (conversation, options) => {
89
- var _a, _b;
89
+ var _a;
90
90
  if (!conversation) {
91
91
  set({
92
92
  currentConversation: undefined,
@@ -131,22 +131,27 @@ const useConversationStore = create((set, get) => ({
131
131
  get().getCurrentMemberInGroupByReq(groupID),
132
132
  ]);
133
133
  }
134
- // Fresh page load skips leftGroupHandler's WS-driven detection
135
- // derive the same public->view-only / private->block state from the
136
- // fetch/cache above. currentConversation isn't set until after this
137
- // block, so guard via conversationData's groupID instead.
134
+ // Fresh page load / external entry (search, notification) skips
135
+ // leftGroupHandler's WS-driven detection derive the same
136
+ // public->view-only / private->block state from the fetch/cache
137
+ // above. Compare against `conversation.groupID` (the argument, not
138
+ // global state) — conversationData can be clobbered by a concurrent
139
+ // setConversationData call before this async function resumes past
140
+ // its first await, which previously made this check unreliable.
138
141
  // Require confirmed peerType — a CX/bot session can ride a Group
139
142
  // session with peerType missing from a raw fetch; don't block on that.
140
143
  const isConfirmedGroup = conversation.peerType === PeerType.GROUP;
141
- const stillOpen = ((_a = get().conversationData) === null || _a === void 0 ? void 0 : _a.groupID) === groupID;
142
144
  const notAMember = !get().currentMemberInGroup.has(groupID);
143
- const isPublic = ((_b = get().currentGroupInfo.get(groupID)) === null || _b === void 0 ? void 0 : _b.visibility) === GroupVisibility.Public;
144
- if (isConfirmedGroup && stillOpen && notAMember && isPublic) {
145
+ const isPublic = ((_a = get().currentGroupInfo.get(groupID)) === null || _a === void 0 ? void 0 : _a.visibility) === GroupVisibility.Public;
146
+ if (isConfirmedGroup && notAMember && isPublic) {
145
147
  set({ isViewOnlyMember: true });
146
148
  }
147
- else if (isConfirmedGroup && stillOpen && notAMember) {
149
+ else if (isConfirmedGroup && notAMember) {
150
+ // Blocked: don't fall through to setting currentConversation below
151
+ // — that would re-open the very conversation just cleared.
148
152
  get().clearSelectedConversation();
149
153
  get().showRemovedFromGroupModal();
154
+ return;
150
155
  }
151
156
  }
152
157
  // Non-group conversations never carry group Map state — nothing to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droppii-org/chat-sdk",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "description": "Droppii React Chat SDK",
5
5
  "repository": {
6
6
  "type": "git",