@wavoip/wavoip-webphone 1.2.6 → 1.2.7

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.
package/dist/index.d.ts CHANGED
@@ -48,6 +48,20 @@ export default webphone;
48
48
 
49
49
  declare type WebphoneAPI = {
50
50
  call: {
51
+ start: (to: string, config?: {
52
+ fromTokens?: string[];
53
+ displayName?: string;
54
+ }) => Promise<{
55
+ err: {
56
+ message: string;
57
+ devices: {
58
+ token: string;
59
+ reason: string;
60
+ }[];
61
+ };
62
+ } | {
63
+ err: null;
64
+ }>;
51
65
  startCall: (to: string, fromTokens: string[] | null) => Promise<{
52
66
  err: {
53
67
  message: string;
package/dist/index.es.js CHANGED
@@ -20016,6 +20016,7 @@ const Nd = new Promise((A) => {
20016
20016
  let DA = {};
20017
20017
  const fd = {
20018
20018
  call: {
20019
+ start: (...A) => DA.call?.start?.(...A) ?? Promise.resolve({ err: { message: "API not ready yet", devices: [] } }),
20019
20020
  startCall: (...A) => DA.call?.startCall?.(...A) ?? Promise.resolve({ err: { message: "API not ready yet", devices: [] } }),
20020
20021
  getCallActive: () => DA.call?.getCallActive?.(),
20021
20022
  getCallOutgoing: () => DA.call?.getCallOutgoing?.(),
@@ -20556,14 +20557,14 @@ function qL({ wavoip: A, devices: q }) {
20556
20557
  },
20557
20558
  [t, Y, h, g, l]
20558
20559
  ), I = r.useCallback(
20559
- async (p, T) => {
20560
+ async (p, T = {}) => {
20560
20561
  const { call: L, err: R } = await A.startCall({
20561
- fromTokens: T ?? q.filter((y) => y.enable).map((y) => y.token),
20562
+ fromTokens: T.fromTokens ?? q.filter((y) => y.enable).map((y) => y.token),
20562
20563
  to: p
20563
20564
  });
20564
20565
  if (R)
20565
20566
  return { err: R };
20566
- L.onPeerAccept((y) => {
20567
+ T.displayName && (L.peer.displayName = T.displayName, L.peer.phone = T.displayName), L.onPeerAccept((y) => {
20567
20568
  h(y), c(void 0);
20568
20569
  }), L.onUnanswered(() => G()), L.onEnd(() => G());
20569
20570
  const f = {
@@ -20673,7 +20674,9 @@ const sm = r.createContext(void 0), gL = ({ children: A, wavoip: q }) => {
20673
20674
  }, []), r.useEffect(() => {
20674
20675
  Ht({
20675
20676
  call: {
20676
- startCall: (...Y) => c(...Y),
20677
+ start: (...Y) => c(...Y),
20678
+ startCall: (Y, m) => c(Y, m ? { fromTokens: m } : {}),
20679
+ // Deprecated
20677
20680
  getCallActive: () => {
20678
20681
  if (!B) return;
20679
20682
  const { id: Y, type: m, status: G, device_token: D, direction: h, peer: Q, muted: I } = B;
@@ -25566,7 +25569,7 @@ const oS = "data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwM
25566
25569
  function hS() {
25567
25570
  const [A, q] = r.useState(""), [V, t] = r.useState(""), [o, g] = r.useState(""), [a, l] = r.useState(!1), { startCall: w, devices: B } = zt(), { addNotification: c } = AM(), Y = async (m) => {
25568
25571
  const G = m.length <= 1, D = m[0];
25569
- l(!0), g(""), t(`Ligando de ${D}`), await w(A, [D]).then(({ err: h }) => {
25572
+ l(!0), g(""), t(`Ligando de ${D}`), await w(A, { fromTokens: [D] }).then(({ err: h }) => {
25570
25573
  if (!h) {
25571
25574
  t("Ok"), l(!1);
25572
25575
  return;
@@ -25720,12 +25723,12 @@ function DS() {
25720
25723
  /* @__PURE__ */ E.jsx(_w, { src: A?.peer.profilePicture || void 0 }),
25721
25724
  /* @__PURE__ */ E.jsx($w, { children: Lw(A?.peer?.displayName) })
25722
25725
  ] }),
25723
- /* @__PURE__ */ E.jsx("div", { className: "wv:hidden wv:group-hover/title:block", children: /* @__PURE__ */ E.jsx(Ba, { speed: 10, className: "wv:text-[24px] wv:leading-[28px] wv:select-none", children: A?.peer.displayName || A?.peer.phone }) }),
25726
+ /* @__PURE__ */ E.jsx("div", { className: "wv:hidden wv:group-hover/title:block", children: /* @__PURE__ */ E.jsx(Ba, { speed: 10, className: "wv:text-foreground wv:text-[24px] wv:leading-[28px] wv:select-none", children: A?.peer.displayName || A?.peer.phone }) }),
25724
25727
  /* @__PURE__ */ E.jsxs("div", { className: "wv:flex wv:flex-col wv:justify-center wv:items-start", children: [
25725
25728
  q && /* @__PURE__ */ E.jsx("p", { className: "wv:text-foreground wv:opacity-75 wv:text-[14px] fade-text select-none", children: q }),
25726
25729
  /* @__PURE__ */ E.jsxs("div", { className: "wv:relative wv:group/title wv:flex wv:flex-col wv:overflow-hidden wv:font-normal", children: [
25727
- /* @__PURE__ */ E.jsx("div", { className: "wv:hidden wv:group-hover/title:block", children: /* @__PURE__ */ E.jsx(Ba, { speed: 10, className: "wv:text-[24px] wv:leading-[28px] wv:select-none", children: A?.peer.displayName || A?.peer.phone }) }),
25728
- /* @__PURE__ */ E.jsx("p", { className: "wv:block wv:group-hover/title:hidden wv:text-[24px] wv:leading-[28px] wv:font-normal wv:truncate w-48", children: A?.peer.displayName || A?.peer.phone })
25730
+ /* @__PURE__ */ E.jsx("div", { className: "wv:hidden wv:group-hover/title:block", children: /* @__PURE__ */ E.jsx(Ba, { speed: 10, className: "wv:text-foreground wv:text-[24px] wv:leading-[28px] wv:select-none", children: A?.peer.displayName || A?.peer.phone }) }),
25731
+ /* @__PURE__ */ E.jsx("p", { className: "wv:block wv:group-hover/title:hidden wv:text-foreground wv:text-[24px] wv:leading-[28px] wv:font-normal wv:truncate w-48", children: A?.peer.displayName || A?.peer.phone })
25729
25732
  ] })
25730
25733
  ] })
25731
25734
  ] })