@dialstack/sdk-react 3.6.0 → 3.8.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.
Files changed (51) hide show
  1. package/dist/ai-agent.cjs +1 -1
  2. package/dist/ai-agent.cjs.map +1 -1
  3. package/dist/ai-agent.d.cts +4 -4
  4. package/dist/ai-agent.d.ts +4 -4
  5. package/dist/ai-agent.mjs +1 -1
  6. package/dist/ai-agent.mjs.map +1 -1
  7. package/dist/call-history.cjs +1 -1
  8. package/dist/call-history.cjs.map +1 -1
  9. package/dist/call-history.mjs +1 -1
  10. package/dist/call-history.mjs.map +1 -1
  11. package/dist/call-logs.cjs +1 -1
  12. package/dist/call-logs.cjs.map +1 -1
  13. package/dist/call-logs.d.cts +11 -1
  14. package/dist/call-logs.d.ts +11 -1
  15. package/dist/call-logs.mjs +1 -1
  16. package/dist/call-logs.mjs.map +1 -1
  17. package/dist/dial-plan.cjs +1 -1
  18. package/dist/dial-plan.cjs.map +1 -1
  19. package/dist/dial-plan.mjs +1 -1
  20. package/dist/dial-plan.mjs.map +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +17 -2
  24. package/dist/index.d.ts +17 -2
  25. package/dist/index.mjs +1 -1
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/onboarding.cjs +1 -1
  28. package/dist/onboarding.cjs.map +1 -1
  29. package/dist/onboarding.mjs +1 -1
  30. package/dist/onboarding.mjs.map +1 -1
  31. package/dist/phone-number-ordering.cjs +1 -1
  32. package/dist/phone-number-ordering.cjs.map +1 -1
  33. package/dist/phone-number-ordering.d.cts +11 -5
  34. package/dist/phone-number-ordering.d.ts +11 -5
  35. package/dist/phone-number-ordering.mjs +1 -1
  36. package/dist/phone-number-ordering.mjs.map +1 -1
  37. package/dist/phone-numbers.cjs +1 -1
  38. package/dist/phone-numbers.cjs.map +1 -1
  39. package/dist/phone-numbers.mjs +1 -1
  40. package/dist/phone-numbers.mjs.map +1 -1
  41. package/dist/softphone.cjs +1 -1
  42. package/dist/softphone.cjs.map +1 -1
  43. package/dist/softphone.d.cts +100 -2
  44. package/dist/softphone.d.ts +100 -2
  45. package/dist/softphone.mjs +1 -1
  46. package/dist/softphone.mjs.map +1 -1
  47. package/dist/voicemails.cjs +1 -1
  48. package/dist/voicemails.cjs.map +1 -1
  49. package/dist/voicemails.mjs +1 -1
  50. package/dist/voicemails.mjs.map +1 -1
  51. package/package.json +4 -4
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Call, EmergencyAddress, EmergencyAddressInput, CallState, DialStackPhone, CallEndReason } from '@dialstack/sdk-webrtc';
3
- import { Locale as Locale$1, AppearanceOptions, FormattingOptions } from '@dialstack/sdk-js/pure';
4
3
  import { CountryCode } from 'libphonenumber-js';
5
4
  import { Locale } from '@dialstack/sdk-js';
5
+ import { Locale as Locale$1, AppearanceOptions, FormattingOptions, ClientAppInfo } from '@dialstack/sdk-js/pure';
6
6
 
7
7
  /**
8
8
  * `usePhone` — sole owner of the softphone's `DialStackPhone` instance and its
@@ -199,6 +199,30 @@ interface UseLastError {
199
199
  */
200
200
  declare function useLastError(onError?: (event: SoftphoneError) => void): UseLastError;
201
201
 
202
+ /**
203
+ * What the host knows about the remote party of a call — typically the record in
204
+ * its own system that the caller's number matches. Kept to what a call screen
205
+ * already shows: the softphone uses the name as the call's title and draws the
206
+ * avatar above it, and everything else on the screen stays as it is.
207
+ */
208
+ interface PeerInfo {
209
+ /** Replaces the caller-id name or the bare number as the call's title. */
210
+ name?: string;
211
+ /** Initials for the avatar disc, or an image URL drawn inside it. */
212
+ avatar?: {
213
+ initials?: string;
214
+ uri?: string;
215
+ };
216
+ }
217
+ /**
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.
221
+ * A `null`/`undefined` result, a rejection or a throw all leave the call on the
222
+ * default display (caller-id name, else the number).
223
+ */
224
+ type ResolvePeer = (call: Call) => PeerInfo | null | undefined | Promise<PeerInfo | null | undefined>;
225
+
202
226
  interface UseDialInput {
203
227
  /**
204
228
  * Handle a per-keystroke value change: strip display separators only (typing
@@ -250,6 +274,12 @@ declare function shouldRingIncoming(calls: Call | Call[] | null): boolean;
250
274
  declare function isCallActive(call: Call): boolean;
251
275
  /** Pick the screen for the current foreground call (null → the dial pad). */
252
276
  declare function selectScreen(call: Call | null): SoftphoneScreen;
277
+ /**
278
+ * The softphone's size tier. `'auto'` (the default) follows the host's size:
279
+ * compact below about 300x480, full otherwise. `'full'` and `'compact'` pin
280
+ * one, whatever the host.
281
+ */
282
+ type SoftphoneLayoutVariant = 'auto' | 'full' | 'compact';
253
283
  /** The remote party's raw number/address for a call, by direction. */
254
284
  declare function callPeerNumber(call: Call): string;
255
285
  /** The remote party's display name, when the server supplied one (inbound only). */
@@ -303,6 +333,38 @@ declare function sanitizeDestination(value: string, defaultCountry?: CountryCode
303
333
  */
304
334
  declare function callStateLabelKey(state: CallState): keyof Locale['softphone'];
305
335
  declare function errorMessageKey(code: string): keyof Locale['softphone'];
336
+ /**
337
+ * One entry of the host's directory, offered when transferring or adding a
338
+ * call in place of typing the destination from memory.
339
+ */
340
+ interface DirectoryContact {
341
+ /**
342
+ * Unique within the directory and stable across renders: the picked entry
343
+ * is matched on it, so a host may rebuild or refetch the array freely.
344
+ */
345
+ id: string;
346
+ /** The entry's name in the list. */
347
+ label: string;
348
+ /**
349
+ * What to dial: anything the number field accepts (a phone number, an
350
+ * extension or a feature code). Picking the entry uses it, cleaned the
351
+ * same way as a paste.
352
+ */
353
+ destination: string;
354
+ /** A second, smaller line under the label. Defaults to the destination. */
355
+ description?: string;
356
+ /**
357
+ * The heading the entry is listed under. Entries sharing a group are shown
358
+ * together, groups in order of first appearance; entries without one come
359
+ * first, under no heading.
360
+ */
361
+ group?: string;
362
+ /**
363
+ * Short labels shown as chips beside the name (a role, a language, "On
364
+ * call"), and matched by the search like the other fields.
365
+ */
366
+ tags?: readonly string[];
367
+ }
306
368
 
307
369
  /**
308
370
  * Shared design tokens for the DialStack Softphone.
@@ -399,6 +461,16 @@ interface SoftphoneContextBase {
399
461
  displayNumber: (value: string) => string;
400
462
  /** Resolved theme palette — computed on both platforms so mobile themes like web. */
401
463
  palette: SoftphonePalette;
464
+ /**
465
+ * The host's {@link PeerInfo} for a call, from `resolvePeer`, or null while it
466
+ * resolves, when the host has none, or when no resolver is set. The built-in
467
+ * views read it; a custom UI can too.
468
+ */
469
+ peerInfo: (call: Call | null | undefined) => PeerInfo | null;
470
+ /** The size tier the host asked for (`'auto'` unless pinned). */
471
+ layoutVariant: SoftphoneLayoutVariant;
472
+ /** The host's `directory`; empty when none were supplied. */
473
+ directory: readonly DirectoryContact[];
402
474
  }
403
475
 
404
476
  /**
@@ -477,6 +549,32 @@ interface SoftphoneProviderProps {
477
549
  code: string;
478
550
  message: string;
479
551
  }) => void;
552
+ /**
553
+ * Look up the remote party of each call in your own records (e.g. the customer
554
+ * behind a caller id). The softphone titles the call with the name and draws the
555
+ * avatar above it, in its own styles. Also
556
+ * readable from a custom UI via `useSoftphone().peerInfo(call)`.
557
+ */
558
+ resolvePeer?: ResolvePeer;
559
+ /**
560
+ * The size tier: `'auto'` (default) follows the host's size, compact below
561
+ * about 300x480; `'full'` keeps the full layout and `'compact'` the compact
562
+ * one, whatever the host.
563
+ */
564
+ layoutVariant?: SoftphoneLayoutVariant;
565
+ /**
566
+ * People and places the user can pick from instead of typing a number (a
567
+ * directory of colleagues or departments, say). Offered as a searchable
568
+ * list when transferring and when adding a call; typing a destination
569
+ * still works. Pass a new array when the list changes.
570
+ */
571
+ directory?: readonly DirectoryContact[];
572
+ /**
573
+ * Your application's name and version, reported to DialStack with the SDK's
574
+ * own package versions. Ignored inside a `<DialstackComponentsProvider>`:
575
+ * set `appInfo` on `loadDialstackAndInitialize` there instead.
576
+ */
577
+ appInfo?: ClientAppInfo;
480
578
  /** The softphone UI (or anything that consumes the context). */
481
579
  children: React.ReactNode;
482
580
  }
@@ -630,4 +728,4 @@ declare const OngoingCall: React.FC;
630
728
  declare const EmergencyBanner: React.FC;
631
729
 
632
730
  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 };
633
- export type { DialPadProps, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };
731
+ export type { DialPadProps, DirectoryContact, PeerInfo, ResolvePeer, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneLayoutVariant, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Call, EmergencyAddress, EmergencyAddressInput, CallState, DialStackPhone, CallEndReason } from '@dialstack/sdk-webrtc';
3
- import { Locale as Locale$1, AppearanceOptions, FormattingOptions } from '@dialstack/sdk-js/pure';
4
3
  import { CountryCode } from 'libphonenumber-js';
5
4
  import { Locale } from '@dialstack/sdk-js';
5
+ import { Locale as Locale$1, AppearanceOptions, FormattingOptions, ClientAppInfo } from '@dialstack/sdk-js/pure';
6
6
 
7
7
  /**
8
8
  * `usePhone` — sole owner of the softphone's `DialStackPhone` instance and its
@@ -199,6 +199,30 @@ interface UseLastError {
199
199
  */
200
200
  declare function useLastError(onError?: (event: SoftphoneError) => void): UseLastError;
201
201
 
202
+ /**
203
+ * What the host knows about the remote party of a call — typically the record in
204
+ * its own system that the caller's number matches. Kept to what a call screen
205
+ * already shows: the softphone uses the name as the call's title and draws the
206
+ * avatar above it, and everything else on the screen stays as it is.
207
+ */
208
+ interface PeerInfo {
209
+ /** Replaces the caller-id name or the bare number as the call's title. */
210
+ name?: string;
211
+ /** Initials for the avatar disc, or an image URL drawn inside it. */
212
+ avatar?: {
213
+ initials?: string;
214
+ uri?: string;
215
+ };
216
+ }
217
+ /**
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.
221
+ * A `null`/`undefined` result, a rejection or a throw all leave the call on the
222
+ * default display (caller-id name, else the number).
223
+ */
224
+ type ResolvePeer = (call: Call) => PeerInfo | null | undefined | Promise<PeerInfo | null | undefined>;
225
+
202
226
  interface UseDialInput {
203
227
  /**
204
228
  * Handle a per-keystroke value change: strip display separators only (typing
@@ -250,6 +274,12 @@ declare function shouldRingIncoming(calls: Call | Call[] | null): boolean;
250
274
  declare function isCallActive(call: Call): boolean;
251
275
  /** Pick the screen for the current foreground call (null → the dial pad). */
252
276
  declare function selectScreen(call: Call | null): SoftphoneScreen;
277
+ /**
278
+ * The softphone's size tier. `'auto'` (the default) follows the host's size:
279
+ * compact below about 300x480, full otherwise. `'full'` and `'compact'` pin
280
+ * one, whatever the host.
281
+ */
282
+ type SoftphoneLayoutVariant = 'auto' | 'full' | 'compact';
253
283
  /** The remote party's raw number/address for a call, by direction. */
254
284
  declare function callPeerNumber(call: Call): string;
255
285
  /** The remote party's display name, when the server supplied one (inbound only). */
@@ -303,6 +333,38 @@ declare function sanitizeDestination(value: string, defaultCountry?: CountryCode
303
333
  */
304
334
  declare function callStateLabelKey(state: CallState): keyof Locale['softphone'];
305
335
  declare function errorMessageKey(code: string): keyof Locale['softphone'];
336
+ /**
337
+ * One entry of the host's directory, offered when transferring or adding a
338
+ * call in place of typing the destination from memory.
339
+ */
340
+ interface DirectoryContact {
341
+ /**
342
+ * Unique within the directory and stable across renders: the picked entry
343
+ * is matched on it, so a host may rebuild or refetch the array freely.
344
+ */
345
+ id: string;
346
+ /** The entry's name in the list. */
347
+ label: string;
348
+ /**
349
+ * What to dial: anything the number field accepts (a phone number, an
350
+ * extension or a feature code). Picking the entry uses it, cleaned the
351
+ * same way as a paste.
352
+ */
353
+ destination: string;
354
+ /** A second, smaller line under the label. Defaults to the destination. */
355
+ description?: string;
356
+ /**
357
+ * The heading the entry is listed under. Entries sharing a group are shown
358
+ * together, groups in order of first appearance; entries without one come
359
+ * first, under no heading.
360
+ */
361
+ group?: string;
362
+ /**
363
+ * Short labels shown as chips beside the name (a role, a language, "On
364
+ * call"), and matched by the search like the other fields.
365
+ */
366
+ tags?: readonly string[];
367
+ }
306
368
 
307
369
  /**
308
370
  * Shared design tokens for the DialStack Softphone.
@@ -399,6 +461,16 @@ interface SoftphoneContextBase {
399
461
  displayNumber: (value: string) => string;
400
462
  /** Resolved theme palette — computed on both platforms so mobile themes like web. */
401
463
  palette: SoftphonePalette;
464
+ /**
465
+ * The host's {@link PeerInfo} for a call, from `resolvePeer`, or null while it
466
+ * resolves, when the host has none, or when no resolver is set. The built-in
467
+ * views read it; a custom UI can too.
468
+ */
469
+ peerInfo: (call: Call | null | undefined) => PeerInfo | null;
470
+ /** The size tier the host asked for (`'auto'` unless pinned). */
471
+ layoutVariant: SoftphoneLayoutVariant;
472
+ /** The host's `directory`; empty when none were supplied. */
473
+ directory: readonly DirectoryContact[];
402
474
  }
403
475
 
404
476
  /**
@@ -477,6 +549,32 @@ interface SoftphoneProviderProps {
477
549
  code: string;
478
550
  message: string;
479
551
  }) => void;
552
+ /**
553
+ * Look up the remote party of each call in your own records (e.g. the customer
554
+ * behind a caller id). The softphone titles the call with the name and draws the
555
+ * avatar above it, in its own styles. Also
556
+ * readable from a custom UI via `useSoftphone().peerInfo(call)`.
557
+ */
558
+ resolvePeer?: ResolvePeer;
559
+ /**
560
+ * The size tier: `'auto'` (default) follows the host's size, compact below
561
+ * about 300x480; `'full'` keeps the full layout and `'compact'` the compact
562
+ * one, whatever the host.
563
+ */
564
+ layoutVariant?: SoftphoneLayoutVariant;
565
+ /**
566
+ * People and places the user can pick from instead of typing a number (a
567
+ * directory of colleagues or departments, say). Offered as a searchable
568
+ * list when transferring and when adding a call; typing a destination
569
+ * still works. Pass a new array when the list changes.
570
+ */
571
+ directory?: readonly DirectoryContact[];
572
+ /**
573
+ * Your application's name and version, reported to DialStack with the SDK's
574
+ * own package versions. Ignored inside a `<DialstackComponentsProvider>`:
575
+ * set `appInfo` on `loadDialstackAndInitialize` there instead.
576
+ */
577
+ appInfo?: ClientAppInfo;
480
578
  /** The softphone UI (or anything that consumes the context). */
481
579
  children: React.ReactNode;
482
580
  }
@@ -630,4 +728,4 @@ declare const OngoingCall: React.FC;
630
728
  declare const EmergencyBanner: React.FC;
631
729
 
632
730
  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 };
633
- export type { DialPadProps, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };
731
+ export type { DialPadProps, DirectoryContact, PeerInfo, ResolvePeer, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneLayoutVariant, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };