@aslaluroba/help-center-react 3.2.12 → 3.2.13

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.esm.js CHANGED
@@ -40246,20 +40246,23 @@ var HelpCenterContent = _ref => {
40246
40246
  var _ref2 = _asyncToGenerator(function* (options) {
40247
40247
  if (!sessionId || !selectedOption) return;
40248
40248
  var fromChatScreen = (options === null || options === void 0 ? void 0 : options.fromChatScreen) === true;
40249
+ // When Ably sends end_session (e.g. admin closed from dashboard), skip close API call
40250
+ var sessionClosedByServer = (options === null || options === void 0 ? void 0 : options.sessionClosedByServer) === true;
40249
40251
  try {
40250
40252
  yield ClientAblyService.stopConnection();
40251
40253
  setIsAblyConnected(false);
40252
40254
  setAssistantStatus('idle');
40253
- var response = yield apiRequest("Client/ClientChatSession/".concat(sessionId, "/close"), 'POST', null, {
40254
- language: language
40255
- });
40256
- if (!response.ok) throw new Error('Failed to close chat session');
40255
+ if (!sessionClosedByServer) {
40256
+ var response = yield apiRequest("Client/ClientChatSession/".concat(sessionId, "/close"), 'POST', null, {
40257
+ language: language
40258
+ });
40259
+ if (!response.ok) throw new Error('Failed to close chat session');
40260
+ }
40257
40261
  setReviewSessionId(sessionId);
40258
40262
  setSessionId(null);
40259
40263
  if (fromChatScreen) {
40260
40264
  setInChatReviewSessionId(sessionId);
40261
40265
  setIsChatClosed(true);
40262
- // Keep selectedOption and messages; do not open popup
40263
40266
  } else {
40264
40267
  setSelectedOption(null);
40265
40268
  setMessages([]);
@@ -40463,10 +40466,11 @@ var HelpCenterContent = _ref => {
40463
40466
  actionHandler.registerHandler('needs_agent', () => {
40464
40467
  setNeedsAgent(true);
40465
40468
  });
40466
- // "end_session" → close session and show in-chat review (user stays in chat)
40469
+ // "end_session" → session was closed by server (e.g. admin from dashboard); update local state only, do not call close API
40467
40470
  actionHandler.registerHandler('end_session', () => {
40468
40471
  void handleEndChat({
40469
- fromChatScreen: true
40472
+ fromChatScreen: true,
40473
+ sessionClosedByServer: true
40470
40474
  });
40471
40475
  });
40472
40476
  return () => {