@realtimexsco/live-chat 1.5.1 → 1.5.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.d.mts CHANGED
@@ -2043,6 +2043,15 @@ interface CallState {
2043
2043
  endCall: () => void;
2044
2044
  /** Drop back to idle without notifying anyone (e.g. after a fatal error). */
2045
2045
  reset: () => void;
2046
+ /**
2047
+ * Tell the server this call is over WITHOUT touching local UI state —
2048
+ * for when the in-call session itself crashed (e.g. VideoSDK failed to
2049
+ * load) and the error needs to stay on screen. The backend already
2050
+ * marked this call ongoing/this user busy once accepted (CALLS_API.md
2051
+ * §3.3); without this, that busy lock would stick until the caller/callee
2052
+ * explicitly closes the error (endCall()) or the 4h Redis TTL expires.
2053
+ */
2054
+ notifyServerCallFailed: () => void;
2046
2055
  _receiveIncoming: (payload: CallIncomingPayload) => void;
2047
2056
  _receiveAccepted: (payload: CallAcceptedPayload) => void;
2048
2057
  _receiveRejected: (payload: CallRejectedPayload) => void;
package/dist/index.d.ts CHANGED
@@ -2043,6 +2043,15 @@ interface CallState {
2043
2043
  endCall: () => void;
2044
2044
  /** Drop back to idle without notifying anyone (e.g. after a fatal error). */
2045
2045
  reset: () => void;
2046
+ /**
2047
+ * Tell the server this call is over WITHOUT touching local UI state —
2048
+ * for when the in-call session itself crashed (e.g. VideoSDK failed to
2049
+ * load) and the error needs to stay on screen. The backend already
2050
+ * marked this call ongoing/this user busy once accepted (CALLS_API.md
2051
+ * §3.3); without this, that busy lock would stick until the caller/callee
2052
+ * explicitly closes the error (endCall()) or the 4h Redis TTL expires.
2053
+ */
2054
+ notifyServerCallFailed: () => void;
2046
2055
  _receiveIncoming: (payload: CallIncomingPayload) => void;
2047
2056
  _receiveAccepted: (payload: CallAcceptedPayload) => void;
2048
2057
  _receiveRejected: (payload: CallRejectedPayload) => void;
package/dist/index.mjs CHANGED
@@ -789,6 +789,12 @@ var init_call_store = __esm({
789
789
  clearRingTimer();
790
790
  set({ ...idleState });
791
791
  },
792
+ notifyServerCallFailed: () => {
793
+ const { callId } = get();
794
+ if (callId) {
795
+ socket_service_default.emitCallEnd({ callId });
796
+ }
797
+ },
792
798
  _receiveIncoming: (payload) => {
793
799
  const currentStatus = get().uiStatus;
794
800
  if (currentStatus !== "idle") {
@@ -6206,9 +6212,16 @@ var CallOverlay = () => {
6206
6212
  const callStartedAt = useCallStore((s) => s.callStartedAt);
6207
6213
  const cancelCall = useCallStore((s) => s.cancelCall);
6208
6214
  const reset = useCallStore((s) => s.reset);
6215
+ const notifyServerCallFailed = useCallStore((s) => s.notifyServerCallFailed);
6209
6216
  const [sessionError, setSessionError] = useState(null);
6210
6217
  const secondsLeft = useRingCountdown(uiStatus === "ringing-out", callId);
6211
6218
  const duration = useCallDuration(callStartedAt);
6219
+ useEffect(() => {
6220
+ setSessionError(null);
6221
+ }, [callId]);
6222
+ useEffect(() => {
6223
+ if (sessionError) notifyServerCallFailed();
6224
+ }, [sessionError, notifyServerCallFailed]);
6212
6225
  const isOpen = uiStatus !== "idle" && uiStatus !== "incoming";
6213
6226
  if (!isOpen) return null;
6214
6227
  const displayError = error || sessionError;