@dialstack/sdk-react 3.9.0 → 3.11.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.
@@ -63,8 +63,10 @@ interface UseCallActions extends CallActions {
63
63
  * Blind-transfer the active call to `destination`. Returns `true` when the
64
64
  * transfer was *initiated* (so the UI can close its transfer overlay), `false`
65
65
  * on empty input or a synchronous failure routed to `onError`. `true` means
66
- * initiated, not confirmed — the core call is fire-and-forget, so the outcome
67
- * arrives later as the call ending ('transferred') or an `onError`.
66
+ * initiated, not confirmed: once the far end accepts, the call ends
67
+ * ('transferred') as on a deskphone, so a target that is then busy or doesn't
68
+ * answer is not reported. A refusal arrives as a `transfer_failed` `onError`
69
+ * and leaves the call up.
68
70
  */
69
71
  transfer: (destination: string) => boolean;
70
72
  /**
@@ -134,14 +136,14 @@ declare function useCallDuration(call: Call | null, intervalMs?: number): string
134
136
  * `useEmergencyBinding` — the Softphone's built-in E911 provisioning logic.
135
137
  *
136
138
  * Model: "always send it, the server decides." The server binds the presented
137
- * emergency address to the connection's network at the `authenticate` handshake
138
- * and is the authority on whether it's valid here — it rejects a mismatch via
139
- * the `network.changed` signal.
139
+ * emergency address to the connection's network, at the `authenticate` handshake
140
+ * or in-band on the open socket, and is the authority on whether it's valid
141
+ * here — it rejects a mismatch via the `network.changed` signal.
140
142
  *
141
143
  * - On connect, if the session has a saved address but presented none (fresh
142
- * browser), auto-present it (select + reconnect once). Same network → the
143
- * server binds it silently (reused). Different network → the server denies
144
- * (network.changed) → we prompt.
144
+ * browser), auto-present it (one in-band rebind). Same network → the server
145
+ * binds it silently (reused). Different network → the server denies
146
+ * (network.changed) → we prompt. Live calls are unaffected either way.
145
147
  * - `bound` is true unless the server denied (network.changed) or there is no
146
148
  * saved address to present at all.
147
149
  *
@@ -164,15 +166,15 @@ interface UseEmergencyBinding {
164
166
  bound: boolean;
165
167
  /** Saved addresses to offer as "Are you here?" choices. */
166
168
  savedAddresses: EmergencyAddress[];
167
- /** True while an address submit (confirm/create, which forces a reconnect) is in flight. */
169
+ /** True while an address submit (confirm/create) is in flight. */
168
170
  submitting: boolean;
169
171
  /** Last error (e.g. a carrier rejection). */
170
172
  error: string | null;
171
173
  /** Called from the Softphone when the phone emits `network.changed` (denied). */
172
174
  onNetworkChanged: () => void;
173
- /** Confirm an existing saved address for this network (selects + reconnects). */
175
+ /** Confirm an existing saved address for this network (clears its anchor + rebinds). */
174
176
  confirm: (id: string) => Promise<void>;
175
- /** Create + validate a new address, then bind it (reconnect). */
177
+ /** Create + validate a new address, then bind it. */
176
178
  create: (input: EmergencyAddressInput) => Promise<void>;
177
179
  }
178
180
 
@@ -215,9 +217,11 @@ interface PeerInfo {
215
217
  };
216
218
  }
217
219
  /**
218
- * Looks up the remote party of a call; may be async. Called once per call for
219
- * each resolver identity, so pass a new function (e.g. `useCallback` over the
220
- * data it reads) when its answers would change, and keep it stable otherwise.
220
+ * Looks up the remote party of a call; may be async. Called once per remote
221
+ * number for each resolver identity: calls to or from the same number share
222
+ * the answer, so base it on the number, and a call whose other party changes
223
+ * is asked about again. Pass a new function (e.g. `useCallback` over the data
224
+ * it reads) when its answers would change, and keep it stable otherwise.
221
225
  * A `null`/`undefined` result, a rejection or a throw all leave the call on the
222
226
  * default display (caller-id name, else the number).
223
227
  */
@@ -311,6 +315,14 @@ declare function sanitizeDestination(value: string, defaultCountry?: CountryCode
311
315
  * state shows which label, without forcing a shared i18n table.
312
316
  */
313
317
  declare function callStateLabelKey(state: CallState): keyof Locale['softphone'];
318
+ /**
319
+ * The in-call status line: "Reconnecting…" while the signalling socket is down
320
+ * and the call is being resumed, the call state otherwise.
321
+ */
322
+ declare function callStatusLabelKey(call: {
323
+ state: CallState;
324
+ isReconnecting: boolean;
325
+ }): keyof Locale['softphone'];
314
326
  declare function errorMessageKey(code: string): keyof Locale['softphone'];
315
327
  /**
316
328
  * One entry of the host's directory, offered when transferring or adding a
@@ -373,19 +385,19 @@ interface UseDialInput {
373
385
  declare function useDialInput(setValue: (value: string) => void): UseDialInput;
374
386
 
375
387
  /**
376
- * Shared design tokens for the DialStack Softphone.
388
+ * The design tokens shared by every call UI: the softphone and the components
389
+ * that show and control calls.
377
390
  *
378
- * This module is intentionally framework-agnostic (no DOM, no React Native) so
379
- * that BOTH the web Softphone (Web Component, consumes these as CSS values) and the
380
- * React Native Softphone (consumes these in a StyleSheet) render from a single
381
- * source of truth — that is what makes the two look identical by default.
391
+ * Framework-agnostic (no DOM, no React Native), so the web UIs consume these as
392
+ * CSS values and the React Native ones in a StyleSheet, and the two look the
393
+ * same by default.
382
394
  *
383
395
  * Colors resolve from the same `AppearanceOptions` surface the rest of the SDK
384
396
  * uses (theme + variables), so theming through `DialstackComponentsProvider` /
385
397
  * the `appearance` prop flows through identically on both platforms.
386
398
  */
387
399
 
388
- interface SoftphonePalette {
400
+ interface CallPalette {
389
401
  background: string;
390
402
  surface: string;
391
403
  surfaceActive: string;
@@ -474,7 +486,7 @@ interface SoftphoneContextBase {
474
486
  t: (key: keyof Locale$1['softphone']) => string;
475
487
  displayNumber: (value: string) => string;
476
488
  /** Resolved theme palette — computed on both platforms so mobile themes like web. */
477
- palette: SoftphonePalette;
489
+ palette: CallPalette;
478
490
  /**
479
491
  * The host's {@link PeerInfo} for a call, from `resolvePeer`, or null while it
480
492
  * resolves, when the host has none, or when no resolver is set. The built-in
@@ -489,6 +501,11 @@ interface SoftphoneContextBase {
489
501
  * has entries.
490
502
  */
491
503
  directory: readonly DirectoryContact[];
504
+ /**
505
+ * The name for a call's number, or null: the host's `directory` first, then
506
+ * the account's users when they are listed, matched in `defaultCountry`.
507
+ */
508
+ peerName: (number: string) => string | null;
492
509
  }
493
510
 
494
511
  /**
@@ -595,7 +612,8 @@ interface SoftphoneProviderProps {
595
612
  * off. Each user is dialled on their first extension; users without one are
596
613
  * left out. Presence is watched for the first 100 (the server's limit); the
597
614
  * rest are listed without a status. A `directory` entry whose `id` is a
598
- * user's id replaces them in the list and keeps their presence.
615
+ * user's id replaces them in the list and keeps their presence. Listed
616
+ * users also name calls to and from their extensions.
599
617
  */
600
618
  accountDirectory?: boolean;
601
619
  /**
@@ -757,5 +775,5 @@ declare const OngoingCall: React.FC;
757
775
 
758
776
  declare const EmergencyBanner: React.FC;
759
777
 
760
- export { DIAL_COUNTRY, DialPad, EmergencyBanner, IncomingCall, IncomingStack, OngoingCall, Softphone, SoftphoneProvider, callPeerName, callPeerNumber, callStateLabelKey, errorMessageKey, formatCallDuration, formatDisplayNumber, isCallActive, isIncomingRinging, sanitizeDestination, selectScreen, shouldRingIncoming, stripToDialString, useActiveCall, useCallActions, useCallDuration, useDialInput, useIncomingCall, useLastError, useSoftphone };
778
+ export { DIAL_COUNTRY, DialPad, EmergencyBanner, IncomingCall, IncomingStack, OngoingCall, Softphone, SoftphoneProvider, callPeerName, callPeerNumber, callStateLabelKey, callStatusLabelKey, errorMessageKey, formatCallDuration, formatDisplayNumber, isCallActive, isIncomingRinging, sanitizeDestination, selectScreen, shouldRingIncoming, stripToDialString, useActiveCall, useCallActions, useCallDuration, useDialInput, useIncomingCall, useLastError, useSoftphone };
761
779
  export type { DialPadProps, DirectoryContact, PeerInfo, ResolvePeer, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneLayoutVariant, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };
@@ -63,8 +63,10 @@ interface UseCallActions extends CallActions {
63
63
  * Blind-transfer the active call to `destination`. Returns `true` when the
64
64
  * transfer was *initiated* (so the UI can close its transfer overlay), `false`
65
65
  * on empty input or a synchronous failure routed to `onError`. `true` means
66
- * initiated, not confirmed — the core call is fire-and-forget, so the outcome
67
- * arrives later as the call ending ('transferred') or an `onError`.
66
+ * initiated, not confirmed: once the far end accepts, the call ends
67
+ * ('transferred') as on a deskphone, so a target that is then busy or doesn't
68
+ * answer is not reported. A refusal arrives as a `transfer_failed` `onError`
69
+ * and leaves the call up.
68
70
  */
69
71
  transfer: (destination: string) => boolean;
70
72
  /**
@@ -134,14 +136,14 @@ declare function useCallDuration(call: Call | null, intervalMs?: number): string
134
136
  * `useEmergencyBinding` — the Softphone's built-in E911 provisioning logic.
135
137
  *
136
138
  * Model: "always send it, the server decides." The server binds the presented
137
- * emergency address to the connection's network at the `authenticate` handshake
138
- * and is the authority on whether it's valid here — it rejects a mismatch via
139
- * the `network.changed` signal.
139
+ * emergency address to the connection's network, at the `authenticate` handshake
140
+ * or in-band on the open socket, and is the authority on whether it's valid
141
+ * here — it rejects a mismatch via the `network.changed` signal.
140
142
  *
141
143
  * - On connect, if the session has a saved address but presented none (fresh
142
- * browser), auto-present it (select + reconnect once). Same network → the
143
- * server binds it silently (reused). Different network → the server denies
144
- * (network.changed) → we prompt.
144
+ * browser), auto-present it (one in-band rebind). Same network → the server
145
+ * binds it silently (reused). Different network → the server denies
146
+ * (network.changed) → we prompt. Live calls are unaffected either way.
145
147
  * - `bound` is true unless the server denied (network.changed) or there is no
146
148
  * saved address to present at all.
147
149
  *
@@ -164,15 +166,15 @@ interface UseEmergencyBinding {
164
166
  bound: boolean;
165
167
  /** Saved addresses to offer as "Are you here?" choices. */
166
168
  savedAddresses: EmergencyAddress[];
167
- /** True while an address submit (confirm/create, which forces a reconnect) is in flight. */
169
+ /** True while an address submit (confirm/create) is in flight. */
168
170
  submitting: boolean;
169
171
  /** Last error (e.g. a carrier rejection). */
170
172
  error: string | null;
171
173
  /** Called from the Softphone when the phone emits `network.changed` (denied). */
172
174
  onNetworkChanged: () => void;
173
- /** Confirm an existing saved address for this network (selects + reconnects). */
175
+ /** Confirm an existing saved address for this network (clears its anchor + rebinds). */
174
176
  confirm: (id: string) => Promise<void>;
175
- /** Create + validate a new address, then bind it (reconnect). */
177
+ /** Create + validate a new address, then bind it. */
176
178
  create: (input: EmergencyAddressInput) => Promise<void>;
177
179
  }
178
180
 
@@ -215,9 +217,11 @@ interface PeerInfo {
215
217
  };
216
218
  }
217
219
  /**
218
- * Looks up the remote party of a call; may be async. Called once per call for
219
- * each resolver identity, so pass a new function (e.g. `useCallback` over the
220
- * data it reads) when its answers would change, and keep it stable otherwise.
220
+ * Looks up the remote party of a call; may be async. Called once per remote
221
+ * number for each resolver identity: calls to or from the same number share
222
+ * the answer, so base it on the number, and a call whose other party changes
223
+ * is asked about again. Pass a new function (e.g. `useCallback` over the data
224
+ * it reads) when its answers would change, and keep it stable otherwise.
221
225
  * A `null`/`undefined` result, a rejection or a throw all leave the call on the
222
226
  * default display (caller-id name, else the number).
223
227
  */
@@ -311,6 +315,14 @@ declare function sanitizeDestination(value: string, defaultCountry?: CountryCode
311
315
  * state shows which label, without forcing a shared i18n table.
312
316
  */
313
317
  declare function callStateLabelKey(state: CallState): keyof Locale['softphone'];
318
+ /**
319
+ * The in-call status line: "Reconnecting…" while the signalling socket is down
320
+ * and the call is being resumed, the call state otherwise.
321
+ */
322
+ declare function callStatusLabelKey(call: {
323
+ state: CallState;
324
+ isReconnecting: boolean;
325
+ }): keyof Locale['softphone'];
314
326
  declare function errorMessageKey(code: string): keyof Locale['softphone'];
315
327
  /**
316
328
  * One entry of the host's directory, offered when transferring or adding a
@@ -373,19 +385,19 @@ interface UseDialInput {
373
385
  declare function useDialInput(setValue: (value: string) => void): UseDialInput;
374
386
 
375
387
  /**
376
- * Shared design tokens for the DialStack Softphone.
388
+ * The design tokens shared by every call UI: the softphone and the components
389
+ * that show and control calls.
377
390
  *
378
- * This module is intentionally framework-agnostic (no DOM, no React Native) so
379
- * that BOTH the web Softphone (Web Component, consumes these as CSS values) and the
380
- * React Native Softphone (consumes these in a StyleSheet) render from a single
381
- * source of truth — that is what makes the two look identical by default.
391
+ * Framework-agnostic (no DOM, no React Native), so the web UIs consume these as
392
+ * CSS values and the React Native ones in a StyleSheet, and the two look the
393
+ * same by default.
382
394
  *
383
395
  * Colors resolve from the same `AppearanceOptions` surface the rest of the SDK
384
396
  * uses (theme + variables), so theming through `DialstackComponentsProvider` /
385
397
  * the `appearance` prop flows through identically on both platforms.
386
398
  */
387
399
 
388
- interface SoftphonePalette {
400
+ interface CallPalette {
389
401
  background: string;
390
402
  surface: string;
391
403
  surfaceActive: string;
@@ -474,7 +486,7 @@ interface SoftphoneContextBase {
474
486
  t: (key: keyof Locale$1['softphone']) => string;
475
487
  displayNumber: (value: string) => string;
476
488
  /** Resolved theme palette — computed on both platforms so mobile themes like web. */
477
- palette: SoftphonePalette;
489
+ palette: CallPalette;
478
490
  /**
479
491
  * The host's {@link PeerInfo} for a call, from `resolvePeer`, or null while it
480
492
  * resolves, when the host has none, or when no resolver is set. The built-in
@@ -489,6 +501,11 @@ interface SoftphoneContextBase {
489
501
  * has entries.
490
502
  */
491
503
  directory: readonly DirectoryContact[];
504
+ /**
505
+ * The name for a call's number, or null: the host's `directory` first, then
506
+ * the account's users when they are listed, matched in `defaultCountry`.
507
+ */
508
+ peerName: (number: string) => string | null;
492
509
  }
493
510
 
494
511
  /**
@@ -595,7 +612,8 @@ interface SoftphoneProviderProps {
595
612
  * off. Each user is dialled on their first extension; users without one are
596
613
  * left out. Presence is watched for the first 100 (the server's limit); the
597
614
  * rest are listed without a status. A `directory` entry whose `id` is a
598
- * user's id replaces them in the list and keeps their presence.
615
+ * user's id replaces them in the list and keeps their presence. Listed
616
+ * users also name calls to and from their extensions.
599
617
  */
600
618
  accountDirectory?: boolean;
601
619
  /**
@@ -757,5 +775,5 @@ declare const OngoingCall: React.FC;
757
775
 
758
776
  declare const EmergencyBanner: React.FC;
759
777
 
760
- export { DIAL_COUNTRY, DialPad, EmergencyBanner, IncomingCall, IncomingStack, OngoingCall, Softphone, SoftphoneProvider, callPeerName, callPeerNumber, callStateLabelKey, errorMessageKey, formatCallDuration, formatDisplayNumber, isCallActive, isIncomingRinging, sanitizeDestination, selectScreen, shouldRingIncoming, stripToDialString, useActiveCall, useCallActions, useCallDuration, useDialInput, useIncomingCall, useLastError, useSoftphone };
778
+ export { DIAL_COUNTRY, DialPad, EmergencyBanner, IncomingCall, IncomingStack, OngoingCall, Softphone, SoftphoneProvider, callPeerName, callPeerNumber, callStateLabelKey, callStatusLabelKey, errorMessageKey, formatCallDuration, formatDisplayNumber, isCallActive, isIncomingRinging, sanitizeDestination, selectScreen, shouldRingIncoming, stripToDialString, useActiveCall, useCallActions, useCallDuration, useDialInput, useIncomingCall, useLastError, useSoftphone };
761
779
  export type { DialPadProps, DirectoryContact, PeerInfo, ResolvePeer, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneLayoutVariant, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };