callix-dialer-widget 1.3.16 → 1.3.18

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.
@@ -7,7 +7,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
7
7
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
8
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
9
  import React, { useEffect, useState, useRef, useMemo, useCallback, StrictMode } from "react";
10
- import require$$0$2 from "react-dom";
10
+ import require$$0$2, { createPortal } from "react-dom";
11
11
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
12
12
  function getAugmentedNamespace(n) {
13
13
  if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
@@ -53840,12 +53840,26 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout, vari
53840
53840
  }
53841
53841
  return;
53842
53842
  }
53843
+ const isManualCall = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "manual";
53844
+ const hasNoQualifications = successQualifications.length === 0 && discardQualifications.length === 0;
53845
+ if (isManualCall && hasNoQualifications) {
53846
+ console.log("[FloatingDialer] ?? Chamada manual sem qualificações - finalizando automaticamente");
53847
+ if (typeof finishAfterCall === "function") {
53848
+ void Promise.resolve(
53849
+ finishAfterCall({
53850
+ result: "success",
53851
+ qualificationId: void 0
53852
+ })
53853
+ );
53854
+ }
53855
+ return;
53856
+ }
53843
53857
  const hasSuccessQualification = successQualifications.length > 0;
53844
53858
  setAfterCallResult(hasSuccessQualification ? "success" : "failure");
53845
53859
  setSelectedQualificationId(null);
53846
53860
  setAfterCallError(null);
53847
53861
  }
53848
- }, [callState, successQualifications.length, currentCallInfo, finishAfterCall]);
53862
+ }, [callState, successQualifications.length, discardQualifications.length, currentCallInfo, finishAfterCall]);
53849
53863
  useEffect(() => {
53850
53864
  if (typeof window === "undefined") {
53851
53865
  return;
@@ -55711,7 +55725,7 @@ function DraggableClientInfoModal({
55711
55725
  );
55712
55726
  return valueKey ? contactData[valueKey] : "-";
55713
55727
  };
55714
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
55728
+ const modalContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
55715
55729
  "div",
55716
55730
  {
55717
55731
  ref: containerRef,
@@ -55808,6 +55822,10 @@ function DraggableClientInfoModal({
55808
55822
  ]
55809
55823
  }
55810
55824
  );
55825
+ if (typeof document !== "undefined") {
55826
+ return createPortal(modalContent, document.body);
55827
+ }
55828
+ return null;
55811
55829
  }
55812
55830
  function Field({ label, value }) {
55813
55831
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`rounded-lg border border-slate-200 bg-white p-2`, children: [
@@ -55939,7 +55957,7 @@ function DraggableQualificationModal({
55939
55957
  if (!isOpen) {
55940
55958
  return null;
55941
55959
  }
55942
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
55960
+ const modalContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
55943
55961
  "div",
55944
55962
  {
55945
55963
  ref: containerRef,
@@ -56061,6 +56079,10 @@ function DraggableQualificationModal({
56061
56079
  ]
56062
56080
  }
56063
56081
  );
56082
+ if (typeof document !== "undefined") {
56083
+ return createPortal(modalContent, document.body);
56084
+ }
56085
+ return null;
56064
56086
  }
56065
56087
  function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
56066
56088
  const isMiniMode = variant === "min";
@@ -56117,6 +56139,17 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
56117
56139
  );
56118
56140
  return;
56119
56141
  }
56142
+ const isManualCall = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "manual";
56143
+ const hasNoQualifications = successQualifications.length === 0 && discardQualifications.length === 0;
56144
+ if (isManualCall && hasNoQualifications && finishAfterCall) {
56145
+ void Promise.resolve(
56146
+ finishAfterCall({
56147
+ result: "success",
56148
+ qualificationId: void 0
56149
+ })
56150
+ );
56151
+ return;
56152
+ }
56120
56153
  const hasSuccessQualification = successQualifications.length > 0;
56121
56154
  setAfterCallResult(hasSuccessQualification ? "success" : "failure");
56122
56155
  setSelectedQualificationId(null);
@@ -56125,7 +56158,7 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
56125
56158
  } else {
56126
56159
  setIsQualificationModalOpen(false);
56127
56160
  }
56128
- }, [isMiniMode, isAfterCall, currentCallInfo, finishAfterCall, successQualifications]);
56161
+ }, [isMiniMode, isAfterCall, currentCallInfo, finishAfterCall, successQualifications, discardQualifications]);
56129
56162
  useEffect(() => {
56130
56163
  if (!isMiniMode) return;
56131
56164
  if (!isInCall && !isConnecting && !isAfterCall) {