@coventia/softphone 0.4.0 → 0.5.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 (57) hide show
  1. package/dist/{call-C6YpT6uR.d.cts → call-FqcvDg1t.d.cts} +105 -12
  2. package/dist/{call-C6YpT6uR.d.ts → call-FqcvDg1t.d.ts} +105 -12
  3. package/dist/{chunk-EYEDPD7Y.js → chunk-6RR6G35E.js} +92 -17
  4. package/dist/chunk-6RR6G35E.js.map +1 -0
  5. package/dist/{chunk-2ZSOGGPO.js → chunk-FRXHEHQA.js} +15 -2
  6. package/dist/chunk-FRXHEHQA.js.map +1 -0
  7. package/dist/{chunk-UHNLEBBO.js → chunk-I3RSC52R.js} +28 -3
  8. package/dist/chunk-I3RSC52R.js.map +1 -0
  9. package/dist/chunk-M76SAXXM.js +13 -0
  10. package/dist/chunk-M76SAXXM.js.map +1 -0
  11. package/dist/{chunk-7R6LOOAI.js → chunk-N4PLEYFJ.js} +4 -2
  12. package/dist/chunk-N4PLEYFJ.js.map +1 -0
  13. package/dist/element/index.d.ts +142 -6
  14. package/dist/element/index.js +138 -43
  15. package/dist/element/index.js.map +1 -1
  16. package/dist/{engine-DPft99Wj.d.ts → engine-CsNRD7B7.d.ts} +1 -1
  17. package/dist/{engine-CDdaSojx.d.cts → engine-CzOCrfY9.d.cts} +1 -1
  18. package/dist/index.cjs +579 -47
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +5 -5
  21. package/dist/index.d.ts +5 -5
  22. package/dist/index.js +447 -37
  23. package/dist/index.js.map +1 -1
  24. package/dist/react/index.cjs +26 -0
  25. package/dist/react/index.cjs.map +1 -1
  26. package/dist/react/index.d.cts +24 -5
  27. package/dist/react/index.d.ts +24 -5
  28. package/dist/react/index.js +2 -2
  29. package/dist/{softphone-CY5d2WWY.d.cts → softphone-By9sizlV.d.ts} +42 -3
  30. package/dist/{softphone-DXgmTyrX.d.ts → softphone-JZvJdzU3.d.cts} +42 -3
  31. package/dist/{sources-ONYQW733.js → sources-QL2LRZVH.js} +19 -2
  32. package/dist/sources-QL2LRZVH.js.map +1 -0
  33. package/dist/testing/index.cjs +13 -0
  34. package/dist/testing/index.cjs.map +1 -1
  35. package/dist/testing/index.d.cts +2 -2
  36. package/dist/testing/index.d.ts +2 -2
  37. package/dist/testing/index.js +1 -1
  38. package/dist/ui/index.cjs +92 -2
  39. package/dist/ui/index.cjs.map +1 -1
  40. package/dist/ui/index.d.cts +2 -2
  41. package/dist/ui/index.d.ts +2 -2
  42. package/dist/ui/index.js +69 -4
  43. package/dist/ui/index.js.map +1 -1
  44. package/dist/zadarma/index.cjs +111 -14
  45. package/dist/zadarma/index.cjs.map +1 -1
  46. package/dist/zadarma/index.d.cts +5 -6
  47. package/dist/zadarma/index.d.ts +5 -6
  48. package/dist/zadarma/index.js +3 -2
  49. package/dist/zadarma-engine-TIUE7PZ7.js +6 -0
  50. package/dist/{zadarma-engine-L5DEFXUS.js.map → zadarma-engine-TIUE7PZ7.js.map} +1 -1
  51. package/package.json +1 -1
  52. package/dist/chunk-2ZSOGGPO.js.map +0 -1
  53. package/dist/chunk-7R6LOOAI.js.map +0 -1
  54. package/dist/chunk-EYEDPD7Y.js.map +0 -1
  55. package/dist/chunk-UHNLEBBO.js.map +0 -1
  56. package/dist/sources-ONYQW733.js.map +0 -1
  57. package/dist/zadarma-engine-L5DEFXUS.js +0 -5
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { g as Contact, D as ContactsSource, G as HistorySource, a as Call, p as RingtoneOption } from '../call-C6YpT6uR.cjs';
4
- export { Q as CallHistoryEntry, U as ContactsPage } from '../call-C6YpT6uR.cjs';
3
+ import { g as Contact, K as ContactsSource, M as HistorySource, a as Call, s as RingtoneOption } from '../call-FqcvDg1t.cjs';
4
+ export { X as CallHistoryEntry, Y as ContactsPage } from '../call-FqcvDg1t.cjs';
5
5
 
6
6
  /**
7
7
  * Shaped like a Lucide icon (`size`, `className`, both optional — every SVG prop Lucide's own icons
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { g as Contact, D as ContactsSource, G as HistorySource, a as Call, p as RingtoneOption } from '../call-C6YpT6uR.js';
4
- export { Q as CallHistoryEntry, U as ContactsPage } from '../call-C6YpT6uR.js';
3
+ import { g as Contact, K as ContactsSource, M as HistorySource, a as Call, s as RingtoneOption } from '../call-FqcvDg1t.js';
4
+ export { X as CallHistoryEntry, Y as ContactsPage } from '../call-FqcvDg1t.js';
5
5
 
6
6
  /**
7
7
  * Shaped like a Lucide icon (`size`, `className`, both optional — every SVG prop Lucide's own icons
package/dist/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { isWebRtcSupported } from '../chunk-KAXEMJ7E.js';
2
- import { useSoftphone, useSoftphoneState, useCall, usePresence, useActiveCall, useIsLeader, useLastError, useDevices } from '../chunk-UHNLEBBO.js';
3
- import '../chunk-7R6LOOAI.js';
2
+ import { useSoftphone, useSoftphoneState, useCall, usePresence, useActiveCall, useIsLeader, useLastError, useDevices, useLine } from '../chunk-I3RSC52R.js';
3
+ import '../chunk-N4PLEYFJ.js';
4
4
  import { isOutboundNumberRefused } from '../chunk-5E5OEXS2.js';
5
5
  import { forwardRef, createElement, useState, useRef, useLayoutEffect, useEffect, useCallback, useMemo, useSyncExternalStore, useId } from 'react';
6
6
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -225,6 +225,19 @@ var Pause = createLucideIcon("Pause", [
225
225
  ["rect", { x: "6", y: "4", width: "4", height: "16", rx: "1", key: "1okwgv" }]
226
226
  ]);
227
227
 
228
+ // ../../node_modules/lucide-react/dist/esm/icons/phone-forwarded.js
229
+ var PhoneForwarded = createLucideIcon("PhoneForwarded", [
230
+ ["polyline", { points: "18 2 22 6 18 10", key: "6vjanh" }],
231
+ ["line", { x1: "14", x2: "22", y1: "6", y2: "6", key: "1jsywh" }],
232
+ [
233
+ "path",
234
+ {
235
+ d: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",
236
+ key: "foiqr5"
237
+ }
238
+ ]
239
+ ]);
240
+
228
241
  // ../../node_modules/lucide-react/dist/esm/icons/phone-incoming.js
229
242
  var PhoneIncoming = createLucideIcon("PhoneIncoming", [
230
243
  ["polyline", { points: "16 2 16 8 22 8", key: "1ygljm" }],
@@ -1669,6 +1682,22 @@ var ERROR_TEXT = {
1669
1682
  // thinks they dropped it will hang up on a client to "fix" it.
1670
1683
  "call/transfer-failed": { title: "No se pudo transferir. Sigues en la llamada" },
1671
1684
  "call/unsupported": { title: "Esta funci\xF3n no est\xE1 disponible" },
1685
+ // ── Line owner ──────────────────────────────────────────────────────────────
1686
+ /*
1687
+ Not call outcomes: they answer "Recibir aquí" on `LineGate`, which has ONE line for them where the
1688
+ explanation was, so it reads the pair as two sentences — `${title}. ${body}`. Split anyway, so the
1689
+ title stands alone wherever there is only room for a headline (a host's own toast), under the same
1690
+ one-line rules as every other non-fatal title. "Allí" because the gate has just said where: the
1691
+ other softphone, the one that has the calls.
1692
+ */
1693
+ "line/claim-refused": {
1694
+ title: "Est\xE1s en una llamada all\xED",
1695
+ body: "Podr\xE1s recibirlas aqu\xED cuando cuelgues."
1696
+ },
1697
+ "line/unavailable": {
1698
+ title: "No se ha podido cambiar",
1699
+ body: "Int\xE9ntalo de nuevo."
1700
+ },
1672
1701
  // ── Provider ────────────────────────────────────────────────────────────────
1673
1702
  "provider/provision-failed": {
1674
1703
  title: "No se pudo activar el tel\xE9fono",
@@ -3751,6 +3780,40 @@ function LeaderGate() {
3751
3780
  /* @__PURE__ */ jsx("p", { part: "leader-body", children: "Solo una pesta\xF1a puede usar el tel\xE9fono a la vez. Cierra la otra para activar esta." })
3752
3781
  ] });
3753
3782
  }
3783
+ var BODY = "Las llamadas entran all\xED. Si prefieres recibirlas aqu\xED, pulsa \xABRecibir aqu\xED\xBB.";
3784
+ var sentence = (code) => `${ERROR_TEXT[code].title}. ${ERROR_TEXT[code].body ?? ""}`.trim();
3785
+ function LineGate() {
3786
+ const softphone = useSoftphone();
3787
+ const { where, claim } = useLine();
3788
+ const take = () => {
3789
+ softphone.takeLine().catch(() => {
3790
+ });
3791
+ };
3792
+ const body = claim === "refused" ? sentence("line/claim-refused") : claim === "failed" ? sentence("line/unavailable") : BODY;
3793
+ return (
3794
+ /*
3795
+ `part` on all four, like `ErrorGate`: it replaces the whole dialpad, and inside `<coventia-softphone>`
3796
+ a shadow root makes it otherwise unreachable from the host's CSS. `data-claim` is for the light-DOM
3797
+ `/ui` path and for debugging — it cannot cross the shadow boundary either.
3798
+ */
3799
+ /* @__PURE__ */ jsxs("div", { className: "cv-gate", "data-claim": claim, part: "line-gate", children: [
3800
+ /* @__PURE__ */ jsx("span", { className: "cv-gate-mark", children: /* @__PURE__ */ jsx(PhoneForwarded, { size: 22 }) }),
3801
+ /* @__PURE__ */ jsx("h3", { className: "cv-gate-title", part: "line-title", children: where === "desktop" ? "Tu tel\xE9fono est\xE1 activo en la app de escritorio" : "Tu tel\xE9fono est\xE1 activo en otro sitio" }),
3802
+ /* @__PURE__ */ jsx("p", { role: "status", part: "line-body", children: body }),
3803
+ /* @__PURE__ */ jsx(
3804
+ "button",
3805
+ {
3806
+ className: "cv-btn cv-btn--accent",
3807
+ onClick: take,
3808
+ disabled: claim === "claiming",
3809
+ "aria-busy": claim === "claiming",
3810
+ part: "line-claim",
3811
+ children: claim === "claiming" ? "Cambiando\u2026" : "Recibir aqu\xED"
3812
+ }
3813
+ )
3814
+ ] })
3815
+ );
3816
+ }
3754
3817
  var BACKSTOP_MS = 6e3;
3755
3818
  function useCallOutcome() {
3756
3819
  const softphone = useSoftphone();
@@ -3982,11 +4045,12 @@ function SoftphoneWidget(props) {
3982
4045
  const isLeader = useIsLeader();
3983
4046
  const softphoneState = useSoftphoneState();
3984
4047
  const isFollower = !isLeader && softphoneState === "starting";
4048
+ const isStandby = softphoneState === "standby";
3985
4049
  const mic = useMicPermission();
3986
4050
  useCallAudio(sounds);
3987
4051
  const blocked = requireMic && mic.state !== "ready";
3988
4052
  const fatal = useLastError();
3989
- const screenIsFree = !call && !blocked && !fatal && !isFollower;
4053
+ const screenIsFree = !call && !blocked && !fatal && !isFollower && !isStandby;
3990
4054
  const { outcome, clear: clearOutcome } = useCallOutcome();
3991
4055
  const { notices: transferNotices, dismiss: dismissTransferNotice } = useTransferNotices();
3992
4056
  const retry = () => {
@@ -4013,7 +4077,7 @@ function SoftphoneWidget(props) {
4013
4077
  ...theme === "system" ? {} : { "data-cv-theme": theme },
4014
4078
  children: [
4015
4079
  screenIsFree ? /* @__PURE__ */ jsx(TransferNotices, { notices: transferNotices, dismiss: dismissTransferNotice }) : null,
4016
- /* @__PURE__ */ jsx("div", { className: "cv-body", children: isFollower ? /* @__PURE__ */ jsx(LeaderGate, {}) : blocked ? /* @__PURE__ */ jsx(MicPrompt, { state: mic.state, onRequest: () => void mic.request() }) : call ? /* @__PURE__ */ jsx(CallScreen, { call, keyTones: sounds, ...incomingCallAction ? { incomingCallAction } : {} }) : fatal ? /* @__PURE__ */ jsx(ErrorGate, { error: fatal, onRetry: retry }) : tab === "contacts" && contactsSource ? /* @__PURE__ */ jsx(ContactsTab, { source: contactsSource, ...contactAction ? { contactAction } : {} }) : tab === "history" && historySource ? /* @__PURE__ */ jsx(HistoryTab, { source: historySource }) : tab === "settings" ? /* @__PURE__ */ jsx(SettingsTab, {}) : /* @__PURE__ */ jsx(Dialpad, { outcome, onIntent: clearOutcome, keyTones: sounds }) }),
4080
+ /* @__PURE__ */ jsx("div", { className: "cv-body", children: isFollower ? /* @__PURE__ */ jsx(LeaderGate, {}) : isStandby && !call ? /* @__PURE__ */ jsx(LineGate, {}) : blocked ? /* @__PURE__ */ jsx(MicPrompt, { state: mic.state, onRequest: () => void mic.request() }) : call ? /* @__PURE__ */ jsx(CallScreen, { call, keyTones: sounds, ...incomingCallAction ? { incomingCallAction } : {} }) : fatal ? /* @__PURE__ */ jsx(ErrorGate, { error: fatal, onRetry: retry }) : tab === "contacts" && contactsSource ? /* @__PURE__ */ jsx(ContactsTab, { source: contactsSource, ...contactAction ? { contactAction } : {} }) : tab === "history" && historySource ? /* @__PURE__ */ jsx(HistoryTab, { source: historySource }) : tab === "settings" ? /* @__PURE__ */ jsx(SettingsTab, {}) : /* @__PURE__ */ jsx(Dialpad, { outcome, onIntent: clearOutcome, keyTones: sounds }) }),
4017
4081
  screenIsFree ? /* @__PURE__ */ jsx("div", { className: "cv-tabs", role: "tablist", children: tabs.map(({ id, icon: Icon3, label }) => /* @__PURE__ */ jsxs(
4018
4082
  "button",
4019
4083
  {
@@ -4059,6 +4123,7 @@ lucide-react/dist/esm/icons/mic.js:
4059
4123
  lucide-react/dist/esm/icons/monitor-smartphone.js:
4060
4124
  lucide-react/dist/esm/icons/music.js:
4061
4125
  lucide-react/dist/esm/icons/pause.js:
4126
+ lucide-react/dist/esm/icons/phone-forwarded.js:
4062
4127
  lucide-react/dist/esm/icons/phone-incoming.js:
4063
4128
  lucide-react/dist/esm/icons/phone-missed.js:
4064
4129
  lucide-react/dist/esm/icons/phone-off.js: