callix-dialer-widget 1.4.0 → 1.4.2
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.
|
@@ -52878,7 +52878,7 @@ async function getCampaignConfig$1(contactId) {
|
|
|
52878
52878
|
const json = await response.json();
|
|
52879
52879
|
return json;
|
|
52880
52880
|
}
|
|
52881
|
-
async function getCodeToNameMapping
|
|
52881
|
+
async function getCodeToNameMapping(campaignModelId) {
|
|
52882
52882
|
const url = `${API_BASE_URL$1}/api/campaign-fields/${campaignModelId}`;
|
|
52883
52883
|
const response = await fetch(url, {
|
|
52884
52884
|
method: "GET",
|
|
@@ -52952,7 +52952,7 @@ function CampaignCallInfoDisplay(props) {
|
|
|
52952
52952
|
}
|
|
52953
52953
|
console.log("[CampaignCallInfoDisplay] 3. Buscando mapeamento e valores em paralelo...");
|
|
52954
52954
|
const [codeToNameMap, contactValues] = await Promise.all([
|
|
52955
|
-
getCodeToNameMapping
|
|
52955
|
+
getCodeToNameMapping(config.campaignModelId),
|
|
52956
52956
|
getContactValues$1(campaignContact.id)
|
|
52957
52957
|
]);
|
|
52958
52958
|
console.log("[CampaignCallInfoDisplay] 4. Mapeamento recebido:", codeToNameMap);
|
|
@@ -55515,7 +55515,7 @@ async function getCampaignConfig(contactId) {
|
|
|
55515
55515
|
const json = await response.json();
|
|
55516
55516
|
return json;
|
|
55517
55517
|
}
|
|
55518
|
-
async function
|
|
55518
|
+
async function getCampaignFields(campaignModelId) {
|
|
55519
55519
|
const url = `${API_BASE_URL}/api/campaign-fields/${campaignModelId}`;
|
|
55520
55520
|
const response = await fetch(url, {
|
|
55521
55521
|
method: "GET",
|
|
@@ -55524,7 +55524,7 @@ async function getCodeToNameMapping(campaignModelId) {
|
|
|
55524
55524
|
});
|
|
55525
55525
|
if (!response.ok) {
|
|
55526
55526
|
const error2 = await response.json().catch(() => ({ error: "Erro desconhecido" }));
|
|
55527
|
-
throw new Error(error2.error || `Falha ao buscar
|
|
55527
|
+
throw new Error(error2.error || `Falha ao buscar campos: ${response.status}`);
|
|
55528
55528
|
}
|
|
55529
55529
|
const json = await response.json();
|
|
55530
55530
|
return json;
|
|
@@ -55556,6 +55556,7 @@ function DraggableClientInfoModal({
|
|
|
55556
55556
|
const [position2, setPosition] = useState({ x: 100, y: 100 });
|
|
55557
55557
|
const [isDragging, setIsDragging] = useState(false);
|
|
55558
55558
|
const [contactData, setContactData] = useState({});
|
|
55559
|
+
const [fieldRows, setFieldRows] = useState([]);
|
|
55559
55560
|
const [isLoading, setIsLoading] = useState(false);
|
|
55560
55561
|
const [error2, setError] = useState(null);
|
|
55561
55562
|
const [fetchedContactId, setFetchedContactId] = useState(null);
|
|
@@ -55620,22 +55621,17 @@ function DraggableClientInfoModal({
|
|
|
55620
55621
|
if (!config.campaignModelId) {
|
|
55621
55622
|
throw new Error("campaignModelId não encontrado");
|
|
55622
55623
|
}
|
|
55623
|
-
console.log("[DraggableClientInfoModal] 3. Buscando
|
|
55624
|
-
const [
|
|
55625
|
-
|
|
55624
|
+
console.log("[DraggableClientInfoModal] 3. Buscando campos e valores em paralelo...");
|
|
55625
|
+
const [campaignFields, contactValues] = await Promise.all([
|
|
55626
|
+
getCampaignFields(config.campaignModelId),
|
|
55626
55627
|
getContactValues(campaignContact.id)
|
|
55627
55628
|
]);
|
|
55628
|
-
console.log("[DraggableClientInfoModal] 4.
|
|
55629
|
+
console.log("[DraggableClientInfoModal] 4. Campos recebidos:", campaignFields);
|
|
55629
55630
|
console.log("[DraggableClientInfoModal] 5. Valores recebidos:", contactValues);
|
|
55630
|
-
const finalData = {};
|
|
55631
|
-
Object.entries(contactValues).forEach(([code, value]) => {
|
|
55632
|
-
if (code in codeToNameMap) {
|
|
55633
|
-
finalData[codeToNameMap[code]] = value;
|
|
55634
|
-
}
|
|
55635
|
-
});
|
|
55636
55631
|
if (!cancelled) {
|
|
55637
|
-
console.log("[DraggableClientInfoModal] ✅ Dados
|
|
55638
|
-
setContactData(
|
|
55632
|
+
console.log("[DraggableClientInfoModal] ✅ Dados carregados com sucesso");
|
|
55633
|
+
setContactData(contactValues);
|
|
55634
|
+
setFieldRows(campaignFields.rows);
|
|
55639
55635
|
setFetchedContactId(campaignContact.id);
|
|
55640
55636
|
setIsLoading(false);
|
|
55641
55637
|
}
|
|
@@ -55718,14 +55714,8 @@ function DraggableClientInfoModal({
|
|
|
55718
55714
|
return null;
|
|
55719
55715
|
}
|
|
55720
55716
|
const hasData = Object.keys(contactData).length > 0;
|
|
55721
|
-
const getFieldValue = (
|
|
55722
|
-
|
|
55723
|
-
return contactData[fieldName];
|
|
55724
|
-
}
|
|
55725
|
-
const valueKey = Object.keys(contactData).find(
|
|
55726
|
-
(k) => k.toLowerCase() === fieldName.toLowerCase()
|
|
55727
|
-
);
|
|
55728
|
-
return valueKey ? contactData[valueKey] : "-";
|
|
55717
|
+
const getFieldValue = (fieldCode) => {
|
|
55718
|
+
return contactData[fieldCode] || "-";
|
|
55729
55719
|
};
|
|
55730
55720
|
const modalContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
55731
55721
|
"div",
|
|
@@ -55792,29 +55782,36 @@ function DraggableClientInfoModal({
|
|
|
55792
55782
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-[10px] text-red-600`, children: error2 })
|
|
55793
55783
|
] })
|
|
55794
55784
|
] }) }),
|
|
55795
|
-
!isLoading && !error2 && hasData && /* @__PURE__ */ jsxRuntimeExports.
|
|
55796
|
-
|
|
55797
|
-
|
|
55798
|
-
|
|
55799
|
-
|
|
55800
|
-
|
|
55801
|
-
|
|
55802
|
-
|
|
55803
|
-
|
|
55804
|
-
|
|
55805
|
-
|
|
55806
|
-
|
|
55807
|
-
|
|
55808
|
-
|
|
55809
|
-
|
|
55810
|
-
|
|
55811
|
-
|
|
55812
|
-
|
|
55813
|
-
|
|
55814
|
-
|
|
55815
|
-
|
|
55816
|
-
|
|
55817
|
-
|
|
55785
|
+
!isLoading && !error2 && hasData && fieldRows.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`space-y-2`, children: fieldRows.map((row, rowIndex) => {
|
|
55786
|
+
const gridColumns = row.map((field) => {
|
|
55787
|
+
const width = field.width;
|
|
55788
|
+
if (width === "100%") return "1fr";
|
|
55789
|
+
if (width === "50%") return "0.5fr";
|
|
55790
|
+
if (width === "33.33%") return "0.3333fr";
|
|
55791
|
+
if (width === "25%") return "0.25fr";
|
|
55792
|
+
if (width === "20%") return "0.2fr";
|
|
55793
|
+
return "1fr";
|
|
55794
|
+
}).join(" ");
|
|
55795
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55796
|
+
"div",
|
|
55797
|
+
{
|
|
55798
|
+
className: tw`grid gap-2`,
|
|
55799
|
+
style: {
|
|
55800
|
+
gridTemplateColumns: gridColumns
|
|
55801
|
+
},
|
|
55802
|
+
children: row.map((field, fieldIndex) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55803
|
+
Field,
|
|
55804
|
+
{
|
|
55805
|
+
label: field.name,
|
|
55806
|
+
value: getFieldValue(field.code),
|
|
55807
|
+
type: field.type
|
|
55808
|
+
},
|
|
55809
|
+
`${rowIndex}-${fieldIndex}-${field.code}`
|
|
55810
|
+
))
|
|
55811
|
+
},
|
|
55812
|
+
rowIndex
|
|
55813
|
+
);
|
|
55814
|
+
}) }),
|
|
55818
55815
|
!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: [
|
|
55819
55816
|
/* @__PURE__ */ jsxRuntimeExports.jsx(FiUser, { className: tw`mb-2 h-8 w-8 text-slate-400` }),
|
|
55820
55817
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-sm text-slate-500`, children: "Nenhum dado disponível" })
|
|
@@ -55829,7 +55826,7 @@ function DraggableClientInfoModal({
|
|
|
55829
55826
|
}
|
|
55830
55827
|
return null;
|
|
55831
55828
|
}
|
|
55832
|
-
function Field({ label, value }) {
|
|
55829
|
+
function Field({ label, value, type }) {
|
|
55833
55830
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`rounded-lg border border-slate-200 bg-white p-2`, children: [
|
|
55834
55831
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`mb-0.5 truncate text-[9px] font-semibold uppercase tracking-wide text-slate-500`, children: label }),
|
|
55835
55832
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`break-words text-xs font-semibold text-slate-800 line-clamp-2`, children: value })
|