callix-dialer-widget 1.3.8 → 1.3.9

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.
@@ -48296,9 +48296,6 @@ function FiDelete(props) {
48296
48296
  function FiHeadphones(props) {
48297
48297
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 18v-6a9 9 0 0 1 18 0v6" }, "child": [] }, { "tag": "path", "attr": { "d": "M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z" }, "child": [] }] })(props);
48298
48298
  }
48299
- function FiInfo(props) {
48300
- return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "circle", "attr": { "cx": "12", "cy": "12", "r": "10" }, "child": [] }, { "tag": "line", "attr": { "x1": "12", "y1": "16", "x2": "12", "y2": "12" }, "child": [] }, { "tag": "line", "attr": { "x1": "12", "y1": "8", "x2": "12.01", "y2": "8" }, "child": [] }] })(props);
48301
- }
48302
48299
  function FiLogOut(props) {
48303
48300
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }, "child": [] }, { "tag": "polyline", "attr": { "points": "16 17 21 12 16 7" }, "child": [] }, { "tag": "line", "attr": { "x1": "21", "y1": "12", "x2": "9", "y2": "12" }, "child": [] }] })(props);
48304
48301
  }
@@ -52834,7 +52831,7 @@ if (!globalTwind.__twindInitialized) {
52834
52831
  setup(config);
52835
52832
  globalTwind.__twindInitialized = true;
52836
52833
  }
52837
- async function getCampaignConfig(contactId) {
52834
+ async function getCampaignConfig$1(contactId) {
52838
52835
  const url = `/api/campaign-config/${contactId}`;
52839
52836
  const response = await fetch(url, {
52840
52837
  method: "GET",
@@ -52847,7 +52844,7 @@ async function getCampaignConfig(contactId) {
52847
52844
  const json = await response.json();
52848
52845
  return json;
52849
52846
  }
52850
- async function getCodeToNameMapping(campaignModelId) {
52847
+ async function getCodeToNameMapping$1(campaignModelId) {
52851
52848
  const url = `/api/campaign-fields/${campaignModelId}`;
52852
52849
  const response = await fetch(url, {
52853
52850
  method: "GET",
@@ -52860,7 +52857,7 @@ async function getCodeToNameMapping(campaignModelId) {
52860
52857
  const json = await response.json();
52861
52858
  return json;
52862
52859
  }
52863
- async function getContactValues(contactId) {
52860
+ async function getContactValues$1(contactId) {
52864
52861
  const url = `/api/campaign-contact/${contactId}`;
52865
52862
  const response = await fetch(url, {
52866
52863
  method: "GET",
@@ -52912,15 +52909,15 @@ function CampaignCallInfoDisplay(props) {
52912
52909
  setContactData({ finalData: {}, isLoading: true, error: null });
52913
52910
  try {
52914
52911
  console.log("[CampaignCallInfoDisplay] 1. Buscando config para contato:", campaignContact.id);
52915
- const config = await getCampaignConfig(campaignContact.id);
52912
+ const config = await getCampaignConfig$1(campaignContact.id);
52916
52913
  console.log("[CampaignCallInfoDisplay] 2. Config recebida:", config);
52917
52914
  if (!config.campaignModelId) {
52918
52915
  throw new Error("campaignModelId não encontrado");
52919
52916
  }
52920
52917
  console.log("[CampaignCallInfoDisplay] 3. Buscando mapeamento e valores em paralelo...");
52921
52918
  const [codeToNameMap, contactValues] = await Promise.all([
52922
- getCodeToNameMapping(config.campaignModelId),
52923
- getContactValues(campaignContact.id)
52919
+ getCodeToNameMapping$1(config.campaignModelId),
52920
+ getContactValues$1(campaignContact.id)
52924
52921
  ]);
52925
52922
  console.log("[CampaignCallInfoDisplay] 4. Mapeamento recebido:", codeToNameMap);
52926
52923
  console.log("[CampaignCallInfoDisplay] 5. Valores recebidos:", contactValues);
@@ -52957,7 +52954,7 @@ function CampaignCallInfoDisplay(props) {
52957
52954
  };
52958
52955
  }, [campaignContact == null ? void 0 : campaignContact.id, fetchedContactId]);
52959
52956
  const hasData = Object.keys(contactData.finalData).length > 0;
52960
- const Field = ({ fieldName, label }) => {
52957
+ const Field2 = ({ fieldName, label }) => {
52961
52958
  const displayLabel = label || fieldName;
52962
52959
  let value = "-";
52963
52960
  if (contactData.finalData[fieldName]) {
@@ -53001,25 +52998,25 @@ function CampaignCallInfoDisplay(props) {
53001
52998
  ] }),
53002
52999
  !contactData.isLoading && !contactData.error && hasData && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1.5", children: [
53003
53000
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-3 gap-1.5", children: [
53004
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "CNPJ", label: "CNPJ" }),
53005
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "EMPRESA", label: "EMPRESA" }),
53006
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "TOTAL BENEFICIO", label: "TOTAL BENEFÍCIO" })
53001
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "CNPJ", label: "CNPJ" }),
53002
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "EMPRESA", label: "EMPRESA" }),
53003
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "TOTAL BENEFICIO", label: "TOTAL BENEFÍCIO" })
53007
53004
  ] }),
53008
53005
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-3 gap-1.5", children: [
53009
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "DECISOR", label: "DECISOR" }),
53010
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "PRODUTO PROSPECTADO", label: "PRODUTO PROSPECTADO" }),
53011
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "VALOR QUE PAGA POR MÊS EM PARCELAMENTOS", label: "VALOR PARCELAMENTO" })
53006
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "DECISOR", label: "DECISOR" }),
53007
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "PRODUTO PROSPECTADO", label: "PRODUTO PROSPECTADO" }),
53008
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "VALOR QUE PAGA POR MÊS EM PARCELAMENTOS", label: "VALOR PARCELAMENTO" })
53012
53009
  ] }),
53013
53010
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-3 gap-1.5", children: [
53014
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "TOTAL SALDO DEVEDOR PGFN", label: "SALDO DEVEDOR PGFN" }),
53015
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "TOTAL SALDO DEVEDOR RFB", label: "SALDO DEVEDOR RFB" }),
53016
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "DIVIDA ATIVA", label: "DÍVIDA ATIVA" })
53011
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "TOTAL SALDO DEVEDOR PGFN", label: "SALDO DEVEDOR PGFN" }),
53012
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "TOTAL SALDO DEVEDOR RFB", label: "SALDO DEVEDOR RFB" }),
53013
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "DIVIDA ATIVA", label: "DÍVIDA ATIVA" })
53017
53014
  ] }),
53018
53015
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-4 gap-1.5", children: [
53019
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "CORRESPONSABILIDADE SOCIO", label: "CORRESP. SÓCIO" }),
53020
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "EXECUÇÃO FISCAL", label: "EXECUÇÃO FISCAL" }),
53021
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "TRANSAÇÃO COM BENEFICIO", label: "TRANSAÇÃO BENEFÍCIO" }),
53022
- /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { fieldName: "REGIME TRIBUTARIO", label: "REGIME TRIBUTÁRIO" })
53016
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "CORRESPONSABILIDADE SOCIO", label: "CORRESP. SÓCIO" }),
53017
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "EXECUÇÃO FISCAL", label: "EXECUÇÃO FISCAL" }),
53018
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "TRANSAÇÃO COM BENEFICIO", label: "TRANSAÇÃO BENEFÍCIO" }),
53019
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field2, { fieldName: "REGIME TRIBUTARIO", label: "REGIME TRIBUTÁRIO" })
53023
53020
  ] })
53024
53021
  ] })
53025
53022
  ] });
@@ -53049,31 +53046,72 @@ function useOperatorBreak() {
53049
53046
  };
53050
53047
  }
53051
53048
  function normalizePhoneNumberPaste(pastedText) {
53052
- let cleaned = pastedText.replace(/[^\d+]/g, "");
53053
- if (cleaned.startsWith("+55")) {
53054
- cleaned = cleaned.substring(3);
53055
- } else if (cleaned.startsWith("55") && cleaned.length > 11) {
53049
+ let cleaned = pastedText.replace(/\D/g, "");
53050
+ if (!cleaned) {
53051
+ return "";
53052
+ }
53053
+ if (cleaned.startsWith("55") && cleaned.length >= 12) {
53056
53054
  cleaned = cleaned.substring(2);
53057
53055
  }
53058
- if (cleaned.length === 11 && cleaned.startsWith("0")) {
53056
+ while (cleaned.startsWith("0") && cleaned.length > 11) {
53059
53057
  cleaned = cleaned.substring(1);
53060
53058
  }
53061
- if (cleaned.length === 10) {
53059
+ const len = cleaned.length;
53060
+ if (len === 11) {
53062
53061
  const ddd = cleaned.substring(0, 2);
53063
- const restante = cleaned.substring(2);
53064
- if (restante[0] !== "9") {
53065
- cleaned = ddd + "9" + restante;
53062
+ const numero = cleaned.substring(2);
53063
+ if (numero[0] === "9") {
53064
+ return cleaned;
53065
+ }
53066
+ if (numero.length === 9) {
53067
+ return ddd + "9" + numero;
53066
53068
  }
53069
+ return cleaned;
53067
53070
  }
53068
- if (cleaned.length === 8) {
53069
- if (cleaned[0] !== "9") {
53070
- cleaned = "489" + cleaned;
53071
- } else {
53072
- cleaned = "48" + cleaned;
53071
+ if (len === 10) {
53072
+ const ddd = cleaned.substring(0, 2);
53073
+ const numero = cleaned.substring(2);
53074
+ if (numero[0] === "9") {
53075
+ return cleaned;
53076
+ }
53077
+ return ddd + "9" + numero;
53078
+ }
53079
+ if (len === 12) {
53080
+ if (cleaned[0] === "0") {
53081
+ return normalizePhoneNumberPaste(cleaned.substring(1));
53082
+ }
53083
+ const last11 = cleaned.substring(len - 11);
53084
+ if (last11[2] === "9") {
53085
+ return last11;
53073
53086
  }
53087
+ return cleaned.substring(1);
53074
53088
  }
53075
- if (cleaned.length === 9 && cleaned[0] === "9") {
53076
- cleaned = "48" + cleaned;
53089
+ if (len === 13) {
53090
+ return cleaned.substring(2);
53091
+ }
53092
+ if (len === 9) {
53093
+ if (cleaned[0] === "9") {
53094
+ return "48" + cleaned;
53095
+ }
53096
+ return "489" + cleaned;
53097
+ }
53098
+ if (len === 8) {
53099
+ return "489" + cleaned;
53100
+ }
53101
+ if (len < 8) {
53102
+ return cleaned;
53103
+ }
53104
+ if (len > 13) {
53105
+ const last11 = cleaned.substring(len - 11);
53106
+ if (last11[2] === "9") {
53107
+ return last11;
53108
+ }
53109
+ const last10 = cleaned.substring(len - 10);
53110
+ if (last10[2] !== "9") {
53111
+ const ddd = last10.substring(0, 2);
53112
+ const numero = last10.substring(2);
53113
+ return ddd + "9" + numero;
53114
+ }
53077
53115
  }
53078
53116
  return cleaned;
53079
53117
  }
@@ -55363,9 +55401,50 @@ function formatDuration(seconds) {
55363
55401
  }
55364
55402
  return `${mins}:${secs.toString().padStart(2, "0")}`;
55365
55403
  }
55404
+ const API_BASE_URL = typeof window !== "undefined" ? window.__CALLIX_API_BASE_URL__ || "https://callix-zeta.vercel.app" : "https://callix-zeta.vercel.app";
55405
+ async function getCampaignConfig(contactId) {
55406
+ const url = `${API_BASE_URL}/api/campaign-config/${contactId}`;
55407
+ const response = await fetch(url, {
55408
+ method: "GET",
55409
+ credentials: "include"
55410
+ // Usar 'include' para cross-origin
55411
+ });
55412
+ if (!response.ok) {
55413
+ const error2 = await response.json().catch(() => ({ error: "Erro desconhecido" }));
55414
+ throw new Error(error2.error || `Falha ao buscar config: ${response.status}`);
55415
+ }
55416
+ const json = await response.json();
55417
+ return json;
55418
+ }
55419
+ async function getCodeToNameMapping(campaignModelId) {
55420
+ const url = `${API_BASE_URL}/api/campaign-fields/${campaignModelId}`;
55421
+ const response = await fetch(url, {
55422
+ method: "GET",
55423
+ credentials: "include"
55424
+ });
55425
+ if (!response.ok) {
55426
+ const error2 = await response.json().catch(() => ({ error: "Erro desconhecido" }));
55427
+ throw new Error(error2.error || `Falha ao buscar mapeamento: ${response.status}`);
55428
+ }
55429
+ const json = await response.json();
55430
+ return json;
55431
+ }
55432
+ async function getContactValues(contactId) {
55433
+ const url = `${API_BASE_URL}/api/campaign-contact/${contactId}`;
55434
+ const response = await fetch(url, {
55435
+ method: "GET",
55436
+ credentials: "include"
55437
+ });
55438
+ if (!response.ok) {
55439
+ const error2 = await response.json().catch(() => ({ error: "Erro desconhecido" }));
55440
+ throw new Error(error2.error || `Falha ao buscar valores: ${response.status}`);
55441
+ }
55442
+ const json = await response.json();
55443
+ return json;
55444
+ }
55366
55445
  function DraggableClientInfoModal({
55367
55446
  isOpen,
55368
- clientInfo,
55447
+ campaignCallInfo,
55369
55448
  callDuration,
55370
55449
  isCallActive,
55371
55450
  onClose
@@ -55375,6 +55454,11 @@ function DraggableClientInfoModal({
55375
55454
  const dragMovedRef = useRef(false);
55376
55455
  const [position2, setPosition] = useState({ x: 100, y: 100 });
55377
55456
  const [isDragging, setIsDragging] = useState(false);
55457
+ const [contactData, setContactData] = useState({});
55458
+ const [isLoading, setIsLoading] = useState(false);
55459
+ const [error2, setError] = useState(null);
55460
+ const [fetchedContactId, setFetchedContactId] = useState(null);
55461
+ const campaignContact = campaignCallInfo == null ? void 0 : campaignCallInfo.campaignContact;
55378
55462
  const clampPositionToViewport = useCallback((proposed) => {
55379
55463
  if (typeof window === "undefined") {
55380
55464
  return proposed;
@@ -55382,8 +55466,8 @@ function DraggableClientInfoModal({
55382
55466
  const viewportWidth = window.innerWidth;
55383
55467
  const viewportHeight = window.innerHeight;
55384
55468
  const element = containerRef.current;
55385
- const width = (element == null ? void 0 : element.offsetWidth) ?? 400;
55386
- const height = (element == null ? void 0 : element.offsetHeight) ?? 300;
55469
+ const width = (element == null ? void 0 : element.offsetWidth) ?? 500;
55470
+ const height = (element == null ? void 0 : element.offsetHeight) ?? 600;
55387
55471
  const minX = VIEWPORT_MARGIN$1;
55388
55472
  const minY = VIEWPORT_MARGIN$1;
55389
55473
  const maxX = Math.max(minX, viewportWidth - width - VIEWPORT_MARGIN$1);
@@ -55396,8 +55480,8 @@ function DraggableClientInfoModal({
55396
55480
  useEffect(() => {
55397
55481
  if (isOpen && typeof window !== "undefined") {
55398
55482
  const element = containerRef.current;
55399
- const width = (element == null ? void 0 : element.offsetWidth) ?? 400;
55400
- const height = (element == null ? void 0 : element.offsetHeight) ?? 300;
55483
+ const width = (element == null ? void 0 : element.offsetWidth) ?? 500;
55484
+ const height = (element == null ? void 0 : element.offsetHeight) ?? 600;
55401
55485
  const centerX = (window.innerWidth - width) / 2;
55402
55486
  const centerY = (window.innerHeight - height) / 2;
55403
55487
  setPosition(clampPositionToViewport({ x: centerX, y: centerY }));
@@ -55417,6 +55501,57 @@ function DraggableClientInfoModal({
55417
55501
  window.removeEventListener("orientationchange", handleViewportChange);
55418
55502
  };
55419
55503
  }, [isOpen, clampPositionToViewport]);
55504
+ useEffect(() => {
55505
+ if (!(campaignContact == null ? void 0 : campaignContact.id)) {
55506
+ return;
55507
+ }
55508
+ if (fetchedContactId === campaignContact.id) {
55509
+ return;
55510
+ }
55511
+ let cancelled = false;
55512
+ const fetchContactData = async () => {
55513
+ setIsLoading(true);
55514
+ setError(null);
55515
+ try {
55516
+ console.log("[DraggableClientInfoModal] 1. Buscando config para contato:", campaignContact.id);
55517
+ const config = await getCampaignConfig(campaignContact.id);
55518
+ console.log("[DraggableClientInfoModal] 2. Config recebida:", config);
55519
+ if (!config.campaignModelId) {
55520
+ throw new Error("campaignModelId não encontrado");
55521
+ }
55522
+ console.log("[DraggableClientInfoModal] 3. Buscando mapeamento e valores em paralelo...");
55523
+ const [codeToNameMap, contactValues] = await Promise.all([
55524
+ getCodeToNameMapping(config.campaignModelId),
55525
+ getContactValues(campaignContact.id)
55526
+ ]);
55527
+ console.log("[DraggableClientInfoModal] 4. Mapeamento recebido:", codeToNameMap);
55528
+ console.log("[DraggableClientInfoModal] 5. Valores recebidos:", contactValues);
55529
+ const finalData = {};
55530
+ Object.entries(contactValues).forEach(([code, value]) => {
55531
+ if (code in codeToNameMap) {
55532
+ finalData[codeToNameMap[code]] = value;
55533
+ }
55534
+ });
55535
+ if (!cancelled) {
55536
+ console.log("[DraggableClientInfoModal] ✅ Dados finais mapeados:", finalData);
55537
+ setContactData(finalData);
55538
+ setFetchedContactId(campaignContact.id);
55539
+ setIsLoading(false);
55540
+ }
55541
+ } catch (err) {
55542
+ if (!cancelled) {
55543
+ console.error("[DraggableClientInfoModal] ❌ Erro ao buscar dados:", err);
55544
+ const errorMessage = err instanceof Error ? err.message : "Erro ao buscar dados do contato";
55545
+ setError(errorMessage);
55546
+ setIsLoading(false);
55547
+ }
55548
+ }
55549
+ };
55550
+ void fetchContactData();
55551
+ return () => {
55552
+ cancelled = true;
55553
+ };
55554
+ }, [campaignContact == null ? void 0 : campaignContact.id, fetchedContactId]);
55420
55555
  useEffect(() => {
55421
55556
  if (!isDragging) {
55422
55557
  return;
@@ -55481,7 +55616,16 @@ function DraggableClientInfoModal({
55481
55616
  if (!isOpen) {
55482
55617
  return null;
55483
55618
  }
55484
- const hasClientInfo = clientInfo && (clientInfo.name || clientInfo.phoneNumber || clientInfo.email);
55619
+ const hasData = Object.keys(contactData).length > 0;
55620
+ const getFieldValue = (fieldName) => {
55621
+ if (contactData[fieldName]) {
55622
+ return contactData[fieldName];
55623
+ }
55624
+ const valueKey = Object.keys(contactData).find(
55625
+ (k) => k.toLowerCase() === fieldName.toLowerCase()
55626
+ );
55627
+ return valueKey ? contactData[valueKey] : "-";
55628
+ };
55485
55629
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
55486
55630
  "div",
55487
55631
  {
@@ -55490,8 +55634,9 @@ function DraggableClientInfoModal({
55490
55634
  style: {
55491
55635
  left: `${position2.x}px`,
55492
55636
  top: `${position2.y}px`,
55493
- width: "380px",
55494
- maxWidth: "calc(100vw - 32px)"
55637
+ width: "520px",
55638
+ maxWidth: "calc(100vw - 32px)",
55639
+ maxHeight: "calc(100vh - 32px)"
55495
55640
  },
55496
55641
  children: [
55497
55642
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -55502,7 +55647,7 @@ function DraggableClientInfoModal({
55502
55647
  children: [
55503
55648
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-2`, children: [
55504
55649
  /* @__PURE__ */ jsxRuntimeExports.jsx(FiUser, { className: tw`h-5 w-5` }),
55505
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: tw`text-sm font-bold`, children: "Informações do Cliente" })
55650
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: tw`text-sm font-bold`, children: "Informações da Campanha" })
55506
55651
  ] }),
55507
55652
  /* @__PURE__ */ jsxRuntimeExports.jsx(
55508
55653
  "button",
@@ -55518,43 +55663,60 @@ function DraggableClientInfoModal({
55518
55663
  ]
55519
55664
  }
55520
55665
  ),
55521
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex-1 space-y-4 overflow-y-auto p-4`, children: [
55522
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center justify-between rounded-lg border border-slate-200 bg-slate-50 px-3 py-2`, children: [
55523
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`text-xs font-medium text-slate-600`, children: "Duração da chamada:" }),
55524
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`text-sm font-bold text-slate-800`, children: formatDuration(callDuration) })
55666
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex-1 space-y-3 overflow-y-auto p-4`, children: [
55667
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`grid grid-cols-2 gap-3`, children: [
55668
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2`, children: [
55669
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FiClock, { className: tw`h-4 w-4 text-slate-500` }),
55670
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
55671
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-[10px] text-slate-500 uppercase tracking-wide font-medium`, children: "Duração" }),
55672
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-sm font-bold text-slate-800`, children: formatDuration(callDuration) })
55673
+ ] })
55674
+ ] }),
55675
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2`, children: [
55676
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FiUser, { className: tw`h-4 w-4 text-slate-500` }),
55677
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`min-w-0 flex-1`, children: [
55678
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-[10px] text-slate-500 uppercase tracking-wide font-medium`, children: "Cliente" }),
55679
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`truncate text-sm font-bold text-slate-800`, children: (campaignContact == null ? void 0 : campaignContact.label) || "N/A" })
55680
+ ] })
55681
+ ] })
55525
55682
  ] }),
55526
- hasClientInfo ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-3`, children: [
55527
- clientInfo.name && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-1`, children: [
55528
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: tw`flex items-center gap-1 text-xs font-semibold text-slate-600`, children: [
55529
- /* @__PURE__ */ jsxRuntimeExports.jsx(FiUser, { className: tw`h-3.5 w-3.5` }),
55530
- "Nome"
55531
- ] }),
55532
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm text-slate-800`, children: clientInfo.name })
55683
+ isLoading && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`rounded-lg border border-blue-200 bg-blue-50 p-6 text-center`, children: [
55684
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`mx-auto mb-2 inline-block h-6 w-6 animate-spin rounded-full border-2 border-blue-500 border-t-transparent` }),
55685
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-xs font-medium text-blue-700`, children: "Carregando dados do contato..." })
55686
+ ] }),
55687
+ error2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`rounded-lg border border-red-200 bg-red-50 p-3`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-2`, children: [
55688
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FiAlertCircle, { className: tw`h-4 w-4 flex-shrink-0 text-red-600` }),
55689
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
55690
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-xs font-semibold text-red-700`, children: "Erro ao carregar dados" }),
55691
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-[10px] text-red-600`, children: error2 })
55692
+ ] })
55693
+ ] }) }),
55694
+ !isLoading && !error2 && hasData && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-2`, children: [
55695
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`grid grid-cols-3 gap-2`, children: [
55696
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "CNPJ", value: getFieldValue("CNPJ") }),
55697
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "EMPRESA", value: getFieldValue("EMPRESA") }),
55698
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "TOTAL BENEFÍCIO", value: getFieldValue("TOTAL BENEFICIO") })
55533
55699
  ] }),
55534
- clientInfo.phoneNumber && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-1`, children: [
55535
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: tw`flex items-center gap-1 text-xs font-semibold text-slate-600`, children: [
55536
- /* @__PURE__ */ jsxRuntimeExports.jsx(FiPhone, { className: tw`h-3.5 w-3.5` }),
55537
- "Telefone"
55538
- ] }),
55539
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm text-slate-800`, children: clientInfo.phoneNumber })
55700
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`grid grid-cols-3 gap-2`, children: [
55701
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "DECISOR", value: getFieldValue("DECISOR") }),
55702
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "PRODUTO", value: getFieldValue("PRODUTO PROSPECTADO") }),
55703
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "VALOR PARCELAMENTO", value: getFieldValue("VALOR QUE PAGA POR MÊS EM PARCELAMENTOS") })
55540
55704
  ] }),
55541
- clientInfo.email && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-1`, children: [
55542
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: tw`flex items-center gap-1 text-xs font-semibold text-slate-600`, children: [
55543
- /* @__PURE__ */ jsxRuntimeExports.jsx(FiInfo, { className: tw`h-3.5 w-3.5` }),
55544
- "E-mail"
55545
- ] }),
55546
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm text-slate-800`, children: clientInfo.email })
55705
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`grid grid-cols-3 gap-2`, children: [
55706
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "SALDO PGFN", value: getFieldValue("TOTAL SALDO DEVEDOR PGFN") }),
55707
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "SALDO RFB", value: getFieldValue("TOTAL SALDO DEVEDOR RFB") }),
55708
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "DÍVIDA ATIVA", value: getFieldValue("DIVIDA ATIVA") })
55547
55709
  ] }),
55548
- clientInfo.customFields && Object.keys(clientInfo.customFields).length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-2`, children: [
55549
- /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: tw`text-xs font-semibold text-slate-600`, children: "Campos adicionais" }),
55550
- Object.entries(clientInfo.customFields).map(([key, value]) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-1`, children: [
55551
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: tw`text-xs font-medium text-slate-500`, children: key }),
55552
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm text-slate-800`, children: String(value) })
55553
- ] }, key))
55710
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`grid grid-cols-4 gap-2`, children: [
55711
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "CORRESP. SÓCIO", value: getFieldValue("CORRESPONSABILIDADE SOCIO") }),
55712
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "EXEC. FISCAL", value: getFieldValue("EXECUÇÃO FISCAL") }),
55713
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "TRANSAÇÃO BENEF.", value: getFieldValue("TRANSAÇÃO COM BENEFICIO") }),
55714
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Field, { label: "REGIME TRIB.", value: getFieldValue("REGIME TRIBUTARIO") })
55554
55715
  ] })
55555
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex flex-col items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-4 py-8 text-center`, children: [
55556
- /* @__PURE__ */ jsxRuntimeExports.jsx(FiInfo, { className: tw`mb-2 h-8 w-8 text-slate-400` }),
55557
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-sm text-slate-500`, children: "Nenhuma informação do cliente disponível" })
55716
+ ] }),
55717
+ !isLoading && !error2 && !hasData && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex flex-col items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-4 py-8 text-center`, children: [
55718
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FiUser, { className: tw`mb-2 h-8 w-8 text-slate-400` }),
55719
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-sm text-slate-500`, children: "Nenhum dado disponível" })
55558
55720
  ] })
55559
55721
  ] }),
55560
55722
  isCallActive && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`border-t border-slate-200 bg-slate-50 px-4 py-2`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-center text-xs text-slate-500`, children: "Aguarde o fim da chamada para fechar" }) })
@@ -55562,6 +55724,12 @@ function DraggableClientInfoModal({
55562
55724
  }
55563
55725
  );
55564
55726
  }
55727
+ function Field({ label, value }) {
55728
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`rounded-lg border border-slate-200 bg-white p-2`, children: [
55729
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`mb-0.5 truncate text-[9px] font-semibold uppercase tracking-wide text-slate-500`, children: label }),
55730
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`break-words text-xs font-semibold text-slate-800 line-clamp-2`, children: value })
55731
+ ] });
55732
+ }
55565
55733
  const VIEWPORT_MARGIN = 16;
55566
55734
  function clamp(value, min2, max2) {
55567
55735
  return Math.min(Math.max(value, min2), max2);
@@ -55876,18 +56044,11 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
55876
56044
  setIsClientInfoModalOpen(false);
55877
56045
  }
55878
56046
  }, [isMiniMode, isInCall, isConnecting, isAfterCall]);
55879
- const clientInfo = useMemo(() => {
56047
+ const campaignCallInfo = useMemo(() => {
55880
56048
  if (!currentCallInfo || currentCallInfo.type !== "campaign") {
55881
56049
  return null;
55882
56050
  }
55883
- const contact = currentCallInfo.info.campaignContact;
55884
- return {
55885
- name: contact.label || null,
55886
- phoneNumber: contact.phoneNumber || null,
55887
- email: null,
55888
- // Não disponível na estrutura atual
55889
- customFields: contact.customer ? { customerId: contact.customer.id, formId: contact.customer.formId } : void 0
55890
- };
56051
+ return currentCallInfo.info;
55891
56052
  }, [currentCallInfo]);
55892
56053
  const handleFinishAfterCall = async () => {
55893
56054
  const qualifications = afterCallResult === "success" ? successQualifications : discardQualifications;
@@ -56047,7 +56208,7 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
56047
56208
  DraggableClientInfoModal,
56048
56209
  {
56049
56210
  isOpen: isClientInfoModalOpen,
56050
- clientInfo,
56211
+ campaignCallInfo,
56051
56212
  callDuration: callDurationSeconds,
56052
56213
  isCallActive: isInCall || isConnecting,
56053
56214
  onClose: () => setIsClientInfoModalOpen(false)