@dialstack/sdk-react 3.7.0 → 3.9.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 (53) 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 +15 -1
  14. package/dist/call-logs.d.ts +15 -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 +37 -3
  24. package/dist/index.d.ts +37 -3
  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 +102 -25
  44. package/dist/softphone.d.ts +102 -25
  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.d.cts +4 -0
  50. package/dist/voicemails.d.ts +4 -0
  51. package/dist/voicemails.mjs +1 -1
  52. package/dist/voicemails.mjs.map +1 -1
  53. package/package.json +3 -3
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { Call, EmergencyAddress, EmergencyAddressInput, CallState, DialStackPhone, CallEndReason } from '@dialstack/sdk-webrtc';
2
+ import { Call, EmergencyAddress, EmergencyAddressInput, PresenceStatus, CallState, DialStackPhone, CallEndReason } from '@dialstack/sdk-webrtc';
3
3
  import { CountryCode } from 'libphonenumber-js';
4
4
  import { Locale } from '@dialstack/sdk-js';
5
- import { Locale as Locale$1, AppearanceOptions, FormattingOptions } from '@dialstack/sdk-js/pure';
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
@@ -223,27 +223,6 @@ interface PeerInfo {
223
223
  */
224
224
  type ResolvePeer = (call: Call) => PeerInfo | null | undefined | Promise<PeerInfo | null | undefined>;
225
225
 
226
- interface UseDialInput {
227
- /**
228
- * Handle a per-keystroke value change: strip display separators only (typing
229
- * stays natural; no mid-field E.164 rewrite). Pass the raw field value.
230
- */
231
- onType: (raw: string) => void;
232
- /**
233
- * Handle a paste: a pasted value is complete, so fully normalize it — a
234
- * formatted `(581) 319-5082` becomes `+15813195082`, so the user sees exactly
235
- * what will be dialed. Pass the raw clipboard text.
236
- */
237
- onPasteText: (raw: string) => void;
238
- }
239
- /**
240
- * Shared cleaning for a dial-string input, used by BOTH the dial pad and the
241
- * transfer field on web + RN so the "what may I type / what does a paste become"
242
- * rule lives in one place. Each platform wires its native input event (web
243
- * onChange/onPaste, RN onChangeText) to these — the string logic never diverges.
244
- */
245
- declare function useDialInput(setValue: (value: string) => void): UseDialInput;
246
-
247
226
  /**
248
227
  * Pure, platform-agnostic view-model helpers shared by the web and React Native
249
228
  * softphones. No React, no DOM, no React Native — just functions over the headless
@@ -333,6 +312,65 @@ declare function sanitizeDestination(value: string, defaultCountry?: CountryCode
333
312
  */
334
313
  declare function callStateLabelKey(state: CallState): keyof Locale['softphone'];
335
314
  declare function errorMessageKey(code: string): keyof Locale['softphone'];
315
+ /**
316
+ * One entry of the host's directory, offered when transferring or adding a
317
+ * call in place of typing the destination from memory.
318
+ */
319
+ interface DirectoryContact {
320
+ /**
321
+ * Unique within the directory and stable across renders: the picked entry
322
+ * is matched on it, so a host may rebuild or refetch the array freely.
323
+ */
324
+ id: string;
325
+ /** The entry's name in the list. */
326
+ label: string;
327
+ /**
328
+ * What to dial: anything the number field accepts (a phone number, an
329
+ * extension or a feature code). Picking the entry uses it, cleaned the
330
+ * same way as a paste.
331
+ */
332
+ destination: string;
333
+ /** A second, smaller line under the label. Defaults to the destination. */
334
+ description?: string;
335
+ /**
336
+ * The heading the entry is listed under. Entries sharing a group are shown
337
+ * together, groups in order of first appearance; entries without one come
338
+ * first, under no heading.
339
+ */
340
+ group?: string;
341
+ /**
342
+ * Short labels shown as chips beside the name (a role, a language, "On
343
+ * call"), and matched by the search like the other fields.
344
+ */
345
+ tags?: readonly string[];
346
+ /**
347
+ * The entry's live availability, drawn as a status dot with its label beside
348
+ * the destination, and matched by the search like a tag. Leave it unset for
349
+ * entries that have no presence (a department, an outside number).
350
+ */
351
+ presence?: PresenceStatus;
352
+ }
353
+
354
+ interface UseDialInput {
355
+ /**
356
+ * Handle a per-keystroke value change: strip display separators only (typing
357
+ * stays natural; no mid-field E.164 rewrite). Pass the raw field value.
358
+ */
359
+ onType: (raw: string) => void;
360
+ /**
361
+ * Handle a paste: a pasted value is complete, so fully normalize it — a
362
+ * formatted `(581) 319-5082` becomes `+15813195082`, so the user sees exactly
363
+ * what will be dialed. Pass the raw clipboard text.
364
+ */
365
+ onPasteText: (raw: string) => void;
366
+ }
367
+ /**
368
+ * Shared cleaning for a dial-string input, used by BOTH the dial pad and the
369
+ * transfer field on web + RN so the "what may I type / what does a paste become"
370
+ * rule lives in one place. Each platform wires its native input event (web
371
+ * onChange/onPaste, RN onChangeText) to these — the string logic never diverges.
372
+ */
373
+ declare function useDialInput(setValue: (value: string) => void): UseDialInput;
336
374
 
337
375
  /**
338
376
  * Shared design tokens for the DialStack Softphone.
@@ -398,6 +436,14 @@ interface SoftphoneContextBase {
398
436
  * web and React Native can't drift on when the overlays reset.
399
437
  */
400
438
  overlays: UseCallOverlays;
439
+ /**
440
+ * Live `m:ss` duration of the active call.
441
+ *
442
+ * @deprecated Use `useCallDuration(activeCall)`. This field changes on every
443
+ * clock tick, so it re-renders every `useSoftphone()` consumer twice a second
444
+ * during a call, even ones that never read it. It will be removed in the next
445
+ * major release.
446
+ */
401
447
  duration: string;
402
448
  consultCall: Call | null;
403
449
  transferOriginal: Call | null;
@@ -437,6 +483,12 @@ interface SoftphoneContextBase {
437
483
  peerInfo: (call: Call | null | undefined) => PeerInfo | null;
438
484
  /** The size tier the host asked for (`'auto'` unless pinned). */
439
485
  layoutVariant: SoftphoneLayoutVariant;
486
+ /**
487
+ * What the transfer / add-call picker lists: the users from
488
+ * `accountDirectory` when on, then the host's `directory`. Empty when neither
489
+ * has entries.
490
+ */
491
+ directory: readonly DirectoryContact[];
440
492
  }
441
493
 
442
494
  /**
@@ -528,6 +580,30 @@ interface SoftphoneProviderProps {
528
580
  * one, whatever the host.
529
581
  */
530
582
  layoutVariant?: SoftphoneLayoutVariant;
583
+ /**
584
+ * People and places the user can pick from instead of typing a number (a
585
+ * directory of people or departments, say). Offered as a searchable
586
+ * list from the dial pad and when transferring or adding a call; typing a
587
+ * destination still works. Pass a new array when the list changes.
588
+ */
589
+ directory?: readonly DirectoryContact[];
590
+ /**
591
+ * Also list the other users in the signed-in user's DialStack account, with
592
+ * live presence. Unset, it is on unless you pass `directory` (even an empty
593
+ * one, so a list that is still loading never shows the account's users
594
+ * first); `true` lists both, the account's users first, and `false` turns it
595
+ * off. Each user is dialled on their first extension; users without one are
596
+ * left out. Presence is watched for the first 100 (the server's limit); the
597
+ * 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.
599
+ */
600
+ accountDirectory?: boolean;
601
+ /**
602
+ * Your application's name and version, reported to DialStack with the SDK's
603
+ * own package versions. Ignored inside a `<DialstackComponentsProvider>`:
604
+ * set `appInfo` on `loadDialstackAndInitialize` there instead.
605
+ */
606
+ appInfo?: ClientAppInfo;
531
607
  /** The softphone UI (or anything that consumes the context). */
532
608
  children: React.ReactNode;
533
609
  }
@@ -607,7 +683,8 @@ declare const Softphone: React.FC<SoftphoneProps>;
607
683
 
608
684
  /**
609
685
  * DialPad — the idle/outbound screen of the softphone: connection status chip, a
610
- * destination field, the 12-key pad, and the call button. Reads connection +
686
+ * destination field, the 12-key pad, and the call button. With a directory, a
687
+ * switch swaps the field and pad for the searchable list. Reads connection +
611
688
  * `placeCall` from the softphone context and owns only its own `destination` text.
612
689
  *
613
690
  * The E911 prompt is NOT rendered here — `<EmergencyBanner>` is a separate
@@ -681,4 +758,4 @@ declare const OngoingCall: React.FC;
681
758
  declare const EmergencyBanner: React.FC;
682
759
 
683
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 };
684
- export type { DialPadProps, PeerInfo, ResolvePeer, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneLayoutVariant, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };
761
+ 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
- import { Call, EmergencyAddress, EmergencyAddressInput, CallState, DialStackPhone, CallEndReason } from '@dialstack/sdk-webrtc';
2
+ import { Call, EmergencyAddress, EmergencyAddressInput, PresenceStatus, CallState, DialStackPhone, CallEndReason } from '@dialstack/sdk-webrtc';
3
3
  import { CountryCode } from 'libphonenumber-js';
4
4
  import { Locale } from '@dialstack/sdk-js';
5
- import { Locale as Locale$1, AppearanceOptions, FormattingOptions } from '@dialstack/sdk-js/pure';
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
@@ -223,27 +223,6 @@ interface PeerInfo {
223
223
  */
224
224
  type ResolvePeer = (call: Call) => PeerInfo | null | undefined | Promise<PeerInfo | null | undefined>;
225
225
 
226
- interface UseDialInput {
227
- /**
228
- * Handle a per-keystroke value change: strip display separators only (typing
229
- * stays natural; no mid-field E.164 rewrite). Pass the raw field value.
230
- */
231
- onType: (raw: string) => void;
232
- /**
233
- * Handle a paste: a pasted value is complete, so fully normalize it — a
234
- * formatted `(581) 319-5082` becomes `+15813195082`, so the user sees exactly
235
- * what will be dialed. Pass the raw clipboard text.
236
- */
237
- onPasteText: (raw: string) => void;
238
- }
239
- /**
240
- * Shared cleaning for a dial-string input, used by BOTH the dial pad and the
241
- * transfer field on web + RN so the "what may I type / what does a paste become"
242
- * rule lives in one place. Each platform wires its native input event (web
243
- * onChange/onPaste, RN onChangeText) to these — the string logic never diverges.
244
- */
245
- declare function useDialInput(setValue: (value: string) => void): UseDialInput;
246
-
247
226
  /**
248
227
  * Pure, platform-agnostic view-model helpers shared by the web and React Native
249
228
  * softphones. No React, no DOM, no React Native — just functions over the headless
@@ -333,6 +312,65 @@ declare function sanitizeDestination(value: string, defaultCountry?: CountryCode
333
312
  */
334
313
  declare function callStateLabelKey(state: CallState): keyof Locale['softphone'];
335
314
  declare function errorMessageKey(code: string): keyof Locale['softphone'];
315
+ /**
316
+ * One entry of the host's directory, offered when transferring or adding a
317
+ * call in place of typing the destination from memory.
318
+ */
319
+ interface DirectoryContact {
320
+ /**
321
+ * Unique within the directory and stable across renders: the picked entry
322
+ * is matched on it, so a host may rebuild or refetch the array freely.
323
+ */
324
+ id: string;
325
+ /** The entry's name in the list. */
326
+ label: string;
327
+ /**
328
+ * What to dial: anything the number field accepts (a phone number, an
329
+ * extension or a feature code). Picking the entry uses it, cleaned the
330
+ * same way as a paste.
331
+ */
332
+ destination: string;
333
+ /** A second, smaller line under the label. Defaults to the destination. */
334
+ description?: string;
335
+ /**
336
+ * The heading the entry is listed under. Entries sharing a group are shown
337
+ * together, groups in order of first appearance; entries without one come
338
+ * first, under no heading.
339
+ */
340
+ group?: string;
341
+ /**
342
+ * Short labels shown as chips beside the name (a role, a language, "On
343
+ * call"), and matched by the search like the other fields.
344
+ */
345
+ tags?: readonly string[];
346
+ /**
347
+ * The entry's live availability, drawn as a status dot with its label beside
348
+ * the destination, and matched by the search like a tag. Leave it unset for
349
+ * entries that have no presence (a department, an outside number).
350
+ */
351
+ presence?: PresenceStatus;
352
+ }
353
+
354
+ interface UseDialInput {
355
+ /**
356
+ * Handle a per-keystroke value change: strip display separators only (typing
357
+ * stays natural; no mid-field E.164 rewrite). Pass the raw field value.
358
+ */
359
+ onType: (raw: string) => void;
360
+ /**
361
+ * Handle a paste: a pasted value is complete, so fully normalize it — a
362
+ * formatted `(581) 319-5082` becomes `+15813195082`, so the user sees exactly
363
+ * what will be dialed. Pass the raw clipboard text.
364
+ */
365
+ onPasteText: (raw: string) => void;
366
+ }
367
+ /**
368
+ * Shared cleaning for a dial-string input, used by BOTH the dial pad and the
369
+ * transfer field on web + RN so the "what may I type / what does a paste become"
370
+ * rule lives in one place. Each platform wires its native input event (web
371
+ * onChange/onPaste, RN onChangeText) to these — the string logic never diverges.
372
+ */
373
+ declare function useDialInput(setValue: (value: string) => void): UseDialInput;
336
374
 
337
375
  /**
338
376
  * Shared design tokens for the DialStack Softphone.
@@ -398,6 +436,14 @@ interface SoftphoneContextBase {
398
436
  * web and React Native can't drift on when the overlays reset.
399
437
  */
400
438
  overlays: UseCallOverlays;
439
+ /**
440
+ * Live `m:ss` duration of the active call.
441
+ *
442
+ * @deprecated Use `useCallDuration(activeCall)`. This field changes on every
443
+ * clock tick, so it re-renders every `useSoftphone()` consumer twice a second
444
+ * during a call, even ones that never read it. It will be removed in the next
445
+ * major release.
446
+ */
401
447
  duration: string;
402
448
  consultCall: Call | null;
403
449
  transferOriginal: Call | null;
@@ -437,6 +483,12 @@ interface SoftphoneContextBase {
437
483
  peerInfo: (call: Call | null | undefined) => PeerInfo | null;
438
484
  /** The size tier the host asked for (`'auto'` unless pinned). */
439
485
  layoutVariant: SoftphoneLayoutVariant;
486
+ /**
487
+ * What the transfer / add-call picker lists: the users from
488
+ * `accountDirectory` when on, then the host's `directory`. Empty when neither
489
+ * has entries.
490
+ */
491
+ directory: readonly DirectoryContact[];
440
492
  }
441
493
 
442
494
  /**
@@ -528,6 +580,30 @@ interface SoftphoneProviderProps {
528
580
  * one, whatever the host.
529
581
  */
530
582
  layoutVariant?: SoftphoneLayoutVariant;
583
+ /**
584
+ * People and places the user can pick from instead of typing a number (a
585
+ * directory of people or departments, say). Offered as a searchable
586
+ * list from the dial pad and when transferring or adding a call; typing a
587
+ * destination still works. Pass a new array when the list changes.
588
+ */
589
+ directory?: readonly DirectoryContact[];
590
+ /**
591
+ * Also list the other users in the signed-in user's DialStack account, with
592
+ * live presence. Unset, it is on unless you pass `directory` (even an empty
593
+ * one, so a list that is still loading never shows the account's users
594
+ * first); `true` lists both, the account's users first, and `false` turns it
595
+ * off. Each user is dialled on their first extension; users without one are
596
+ * left out. Presence is watched for the first 100 (the server's limit); the
597
+ * 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.
599
+ */
600
+ accountDirectory?: boolean;
601
+ /**
602
+ * Your application's name and version, reported to DialStack with the SDK's
603
+ * own package versions. Ignored inside a `<DialstackComponentsProvider>`:
604
+ * set `appInfo` on `loadDialstackAndInitialize` there instead.
605
+ */
606
+ appInfo?: ClientAppInfo;
531
607
  /** The softphone UI (or anything that consumes the context). */
532
608
  children: React.ReactNode;
533
609
  }
@@ -607,7 +683,8 @@ declare const Softphone: React.FC<SoftphoneProps>;
607
683
 
608
684
  /**
609
685
  * DialPad — the idle/outbound screen of the softphone: connection status chip, a
610
- * destination field, the 12-key pad, and the call button. Reads connection +
686
+ * destination field, the 12-key pad, and the call button. With a directory, a
687
+ * switch swaps the field and pad for the searchable list. Reads connection +
611
688
  * `placeCall` from the softphone context and owns only its own `destination` text.
612
689
  *
613
690
  * The E911 prompt is NOT rendered here — `<EmergencyBanner>` is a separate
@@ -681,4 +758,4 @@ declare const OngoingCall: React.FC;
681
758
  declare const EmergencyBanner: React.FC;
682
759
 
683
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 };
684
- export type { DialPadProps, PeerInfo, ResolvePeer, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneLayoutVariant, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };
761
+ export type { DialPadProps, DirectoryContact, PeerInfo, ResolvePeer, SoftphoneConnectionState, SoftphoneContextValue, SoftphoneError, SoftphoneLayoutVariant, SoftphoneProps, SoftphoneProviderProps, SoftphoneScreen, UseCallActions, UseCallActionsOptions, UseDialInput, UseLastError };