@coventia/softphone 0.1.0 → 0.2.1

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 (54) hide show
  1. package/dist/{call-BTYlT2SU.d.cts → call-VKq1I8yP.d.cts} +158 -5
  2. package/dist/{call-BTYlT2SU.d.ts → call-VKq1I8yP.d.ts} +158 -5
  3. package/dist/{chunk-N2N2EQQJ.js → chunk-7R6LOOAI.js} +4 -2
  4. package/dist/chunk-7R6LOOAI.js.map +1 -0
  5. package/dist/{chunk-5BGEHMPP.js → chunk-EYEDPD7Y.js} +146 -20
  6. package/dist/chunk-EYEDPD7Y.js.map +1 -0
  7. package/dist/{chunk-3V2L6UTK.js → chunk-LMJXX4YM.js} +17 -3
  8. package/dist/chunk-LMJXX4YM.js.map +1 -0
  9. package/dist/element/index.d.ts +162 -7
  10. package/dist/element/index.js +866 -421
  11. package/dist/element/index.js.map +1 -1
  12. package/dist/{engine-D9nbeY08.d.cts → engine-BlQBo2Ys.d.cts} +1 -1
  13. package/dist/{engine-Doa6Brkm.d.ts → engine-C0BOkIcW.d.ts} +1 -1
  14. package/dist/index.cjs +586 -28
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +5 -5
  17. package/dist/index.d.ts +5 -5
  18. package/dist/index.js +335 -8
  19. package/dist/index.js.map +1 -1
  20. package/dist/react/index.cjs +15 -0
  21. package/dist/react/index.cjs.map +1 -1
  22. package/dist/react/index.d.cts +14 -3
  23. package/dist/react/index.d.ts +14 -3
  24. package/dist/react/index.js +2 -2
  25. package/dist/{softphone-DhuhcKCy.d.cts → softphone-Cyq3hiIM.d.ts} +17 -2
  26. package/dist/{softphone-DHmhotbf.d.ts → softphone-DlGV12Xp.d.cts} +17 -2
  27. package/dist/softphone.css +477 -35
  28. package/dist/{sources-N4BOEDRL.js → sources-IRKNQPWW.js} +108 -5
  29. package/dist/sources-IRKNQPWW.js.map +1 -0
  30. package/dist/testing/index.cjs +41 -5
  31. package/dist/testing/index.cjs.map +1 -1
  32. package/dist/testing/index.d.cts +8 -2
  33. package/dist/testing/index.d.ts +8 -2
  34. package/dist/testing/index.js +41 -5
  35. package/dist/testing/index.js.map +1 -1
  36. package/dist/ui/index.cjs +846 -410
  37. package/dist/ui/index.cjs.map +1 -1
  38. package/dist/ui/index.d.cts +17 -6
  39. package/dist/ui/index.d.ts +17 -6
  40. package/dist/ui/index.js +878 -456
  41. package/dist/ui/index.js.map +1 -1
  42. package/dist/zadarma/index.cjs +144 -18
  43. package/dist/zadarma/index.cjs.map +1 -1
  44. package/dist/zadarma/index.d.cts +2 -2
  45. package/dist/zadarma/index.d.ts +2 -2
  46. package/dist/zadarma/index.js +1 -1
  47. package/dist/zadarma-engine-L5DEFXUS.js +5 -0
  48. package/dist/{zadarma-engine-DN2SZSQ3.js.map → zadarma-engine-L5DEFXUS.js.map} +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-3V2L6UTK.js.map +0 -1
  51. package/dist/chunk-5BGEHMPP.js.map +0 -1
  52. package/dist/chunk-N2N2EQQJ.js.map +0 -1
  53. package/dist/sources-N4BOEDRL.js.map +0 -1
  54. package/dist/zadarma-engine-DN2SZSQ3.js +0 -5
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { S as Softphone, A as AudioDevices } from '../softphone-DHmhotbf.js';
4
- import { f as CallState, R as RemoteParty, a as Call, h as FatalSoftphoneError, o as SoftphoneState } from '../call-BTYlT2SU.js';
3
+ import { S as Softphone, A as AudioDevices } from '../softphone-Cyq3hiIM.js';
4
+ import { f as CallState, R as RemoteParty, a as Call, h as FatalSoftphoneError, P as PresenceEntry, o as SoftphoneState } from '../call-VKq1I8yP.js';
5
5
 
6
6
  interface SoftphoneProviderProps {
7
7
  readonly softphone: Softphone;
@@ -37,6 +37,17 @@ declare function useIsLeader(): boolean;
37
37
  * `phone.activeCall` returns a stable reference for a given call, so it is a safe snapshot.
38
38
  */
39
39
  declare function useActiveCall(): Call | null;
40
+ /**
41
+ * The live agent-presence list (`phone.presence`, Phase B) — reactive on `SoftphoneEvent.
42
+ * PresenceChanged`. `active` gates the SUBSCRIPTION only, not the underlying connection: the socket
43
+ * itself stays governed entirely by `online && isLeader` inside the softphone (spec's own
44
+ * always-connected decision), so passing `false` here does not close it — it only stops this
45
+ * particular component from re-rendering on every update while it has no reason to care, e.g. the
46
+ * transfer step being closed (spec §4.5: "subscribe when the step opens... unsubscribe when it
47
+ * closes"). `phone.presence` is still read fresh on every call, so flipping `active` back to `true`
48
+ * never shows a stale snapshot.
49
+ */
50
+ declare function usePresence(active: boolean): readonly PresenceEntry[];
40
51
  /** An immutable snapshot of a call's reactive fields. */
41
52
  interface CallView {
42
53
  readonly state: CallState;
@@ -65,4 +76,4 @@ declare function useCall(call: Call | null): CallView | null;
65
76
  */
66
77
  declare function useDevices(): AudioDevices;
67
78
 
68
- export { type CallView, SoftphoneProvider, type SoftphoneProviderProps, useActiveCall, useCall, useDevices, useIsLeader, useLastError, useSoftphone, useSoftphoneState };
79
+ export { type CallView, SoftphoneProvider, type SoftphoneProviderProps, useActiveCall, useCall, useDevices, useIsLeader, useLastError, usePresence, useSoftphone, useSoftphoneState };
@@ -1,4 +1,4 @@
1
- export { SoftphoneProvider, useActiveCall, useCall, useDevices, useIsLeader, useLastError, useSoftphone, useSoftphoneState } from '../chunk-3V2L6UTK.js';
2
- import '../chunk-N2N2EQQJ.js';
1
+ export { SoftphoneProvider, useActiveCall, useCall, useDevices, useIsLeader, useLastError, usePresence, useSoftphone, useSoftphoneState } from '../chunk-LMJXX4YM.js';
2
+ import '../chunk-7R6LOOAI.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,19 @@
1
- import { u as ContactsSource, v as HistorySource, g as Contact, A as AgentsDirectory, q as TypedEmitter, n as SoftphoneEventMap, o as SoftphoneState, h as FatalSoftphoneError, e as CallOptions, a as Call } from './call-BTYlT2SU.cjs';
1
+ import { u as ContactsSource, v as HistorySource, g as Contact, A as AgentsDirectory, w as TransferOutcomesPage, x as PresenceSource, q as TypedEmitter, n as SoftphoneEventMap, o as SoftphoneState, h as FatalSoftphoneError, e as CallOptions, a as Call, P as PresenceEntry } from './call-VKq1I8yP.js';
2
2
 
3
- /** Contacts, history, caller ID and the agents directory, all from one config. */
3
+ /** Contacts, history, caller ID, the agents directory, transfer outcomes and presence, all from one
4
+ * config. */
4
5
  interface BackendSources {
5
6
  readonly contacts: ContactsSource;
6
7
  readonly history: HistorySource;
7
8
  readonly resolveContact: (number: string) => Promise<Contact | null>;
8
9
  /** The Historial tab's "filter by person" directory. Always Coventia's own org membership. */
9
10
  readonly listAgents: () => Promise<AgentsDirectory>;
11
+ /** Phase A (transfer outcome relay) — polled by the transfer watch, never by UI directly. */
12
+ readonly transferOutcomes: (params: {
13
+ readonly since?: string;
14
+ }) => Promise<TransferOutcomesPage>;
15
+ /** Phase B (presence-gated transfer picker) — opened by `presence-socket.ts`, never by UI directly. */
16
+ readonly presence: PresenceSource;
10
17
  }
11
18
 
12
19
  /**
@@ -114,6 +121,14 @@ interface Softphone extends TypedEmitter<SoftphoneEventMap> {
114
121
  */
115
122
  readonly sources: BackendSources | null;
116
123
  readonly audio: AudioDevices;
124
+ /**
125
+ * The live agent-presence list (Phase B, `docs/specs/transfer-presence-picker.md`) — every org
126
+ * member with a phone extension, whatever their state. Empty when there is no `PresenceSource`
127
+ * (no Coventia backend, or a host that omitted one), or while this tab is not `online && isLeader`
128
+ * — never an error, just nothing to show (spec §4.4's own success criterion). Updates fire
129
+ * `SoftphoneEvent.PresenceChanged`; `usePresence()` is the reactive read.
130
+ */
131
+ readonly presence: readonly PresenceEntry[];
117
132
  /**
118
133
  * False when the browser has blocked audio playback.
119
134
  *
@@ -1,12 +1,19 @@
1
- import { u as ContactsSource, v as HistorySource, g as Contact, A as AgentsDirectory, q as TypedEmitter, n as SoftphoneEventMap, o as SoftphoneState, h as FatalSoftphoneError, e as CallOptions, a as Call } from './call-BTYlT2SU.js';
1
+ import { u as ContactsSource, v as HistorySource, g as Contact, A as AgentsDirectory, w as TransferOutcomesPage, x as PresenceSource, q as TypedEmitter, n as SoftphoneEventMap, o as SoftphoneState, h as FatalSoftphoneError, e as CallOptions, a as Call, P as PresenceEntry } from './call-VKq1I8yP.cjs';
2
2
 
3
- /** Contacts, history, caller ID and the agents directory, all from one config. */
3
+ /** Contacts, history, caller ID, the agents directory, transfer outcomes and presence, all from one
4
+ * config. */
4
5
  interface BackendSources {
5
6
  readonly contacts: ContactsSource;
6
7
  readonly history: HistorySource;
7
8
  readonly resolveContact: (number: string) => Promise<Contact | null>;
8
9
  /** The Historial tab's "filter by person" directory. Always Coventia's own org membership. */
9
10
  readonly listAgents: () => Promise<AgentsDirectory>;
11
+ /** Phase A (transfer outcome relay) — polled by the transfer watch, never by UI directly. */
12
+ readonly transferOutcomes: (params: {
13
+ readonly since?: string;
14
+ }) => Promise<TransferOutcomesPage>;
15
+ /** Phase B (presence-gated transfer picker) — opened by `presence-socket.ts`, never by UI directly. */
16
+ readonly presence: PresenceSource;
10
17
  }
11
18
 
12
19
  /**
@@ -114,6 +121,14 @@ interface Softphone extends TypedEmitter<SoftphoneEventMap> {
114
121
  */
115
122
  readonly sources: BackendSources | null;
116
123
  readonly audio: AudioDevices;
124
+ /**
125
+ * The live agent-presence list (Phase B, `docs/specs/transfer-presence-picker.md`) — every org
126
+ * member with a phone extension, whatever their state. Empty when there is no `PresenceSource`
127
+ * (no Coventia backend, or a host that omitted one), or while this tab is not `online && isLeader`
128
+ * — never an error, just nothing to show (spec §4.4's own success criterion). Updates fire
129
+ * `SoftphoneEvent.PresenceChanged`; `usePresence()` is the reactive read.
130
+ */
131
+ readonly presence: readonly PresenceEntry[];
117
132
  /**
118
133
  * False when the browser has blocked audio playback.
119
134
  *