@realtimexsco/live-chat 1.4.19 → 1.5.0

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.
@@ -300,21 +300,27 @@ if (rawConfig) {
300
300
  console.log("[realtimex-push] FCM background payload (raw):", payload);
301
301
  console.log("[realtimex-push] FCM background data:", payload && payload.data);
302
302
 
303
+ var data = payload.data || {};
304
+ var isCall = data.kind === "call";
305
+
303
306
  return clients
304
307
  .matchAll({ type: "window", includeUncontrolled: true })
305
308
  .then(function (windowClients) {
306
309
  var hasVisibleClient = windowClients.some(function (client) {
307
310
  return client.visibilityState === "visible";
308
311
  });
309
- if (hasVisibleClient) {
312
+ // Regular messages: a visible tab is assumed to show its own in-app
313
+ // toast, so skip the OS notification. Calls skip that assumption —
314
+ // the in-app ringing dialog only exists while the user is actually
315
+ // on the chat screen (ChatMain mounted), so a visible-but-elsewhere
316
+ // tab still needs the OS notification or the call goes unnoticed.
317
+ if (hasVisibleClient && !isCall) {
310
318
  console.log(
311
319
  "[realtimex-push] app visible — skip OS notification (use in-app toast)",
312
320
  );
313
321
  return;
314
322
  }
315
323
 
316
- var data = payload.data || {};
317
- var isCall = data.kind === "call";
318
324
  var title =
319
325
  (payload.notification && payload.notification.title) ||
320
326
  data.title ||