callix-dialer-widget 1.3.13 → 1.3.15
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.
|
@@ -52831,11 +52831,45 @@ if (!globalTwind.__twindInitialized) {
|
|
|
52831
52831
|
setup(config);
|
|
52832
52832
|
globalTwind.__twindInitialized = true;
|
|
52833
52833
|
}
|
|
52834
|
+
const API_BASE_URL$1 = typeof window !== "undefined" ? window.__CALLIX_API_BASE_URL__ || (window.location.origin.includes("localhost") ? window.location.origin : "https://callix-zeta.vercel.app") : "";
|
|
52835
|
+
function getSessionToken$1() {
|
|
52836
|
+
if (typeof window === "undefined") return null;
|
|
52837
|
+
const lastUsername = localStorage.getItem("callix_dialer_last_username");
|
|
52838
|
+
if (lastUsername) {
|
|
52839
|
+
const sessionKey = `callix_dialer_${lastUsername}_session_token`;
|
|
52840
|
+
const token = localStorage.getItem(sessionKey);
|
|
52841
|
+
if (token) {
|
|
52842
|
+
return token;
|
|
52843
|
+
}
|
|
52844
|
+
}
|
|
52845
|
+
for (let i2 = 0; i2 < localStorage.length; i2++) {
|
|
52846
|
+
const key = localStorage.key(i2);
|
|
52847
|
+
if (key && key.match(/^callix_dialer_.*_session_token$/)) {
|
|
52848
|
+
const token = localStorage.getItem(key);
|
|
52849
|
+
if (token) {
|
|
52850
|
+
return token;
|
|
52851
|
+
}
|
|
52852
|
+
}
|
|
52853
|
+
}
|
|
52854
|
+
return null;
|
|
52855
|
+
}
|
|
52856
|
+
function getAuthHeaders$1() {
|
|
52857
|
+
const token = getSessionToken$1();
|
|
52858
|
+
const headers = {
|
|
52859
|
+
"Content-Type": "application/json"
|
|
52860
|
+
};
|
|
52861
|
+
if (token) {
|
|
52862
|
+
headers["x-session-token"] = token;
|
|
52863
|
+
}
|
|
52864
|
+
return headers;
|
|
52865
|
+
}
|
|
52834
52866
|
async function getCampaignConfig$1(contactId) {
|
|
52835
|
-
const url =
|
|
52867
|
+
const url = `${API_BASE_URL$1}/api/campaign-config/${contactId}`;
|
|
52836
52868
|
const response = await fetch(url, {
|
|
52837
52869
|
method: "GET",
|
|
52838
|
-
|
|
52870
|
+
headers: getAuthHeaders$1(),
|
|
52871
|
+
credentials: "omit"
|
|
52872
|
+
// API usa localStorage, não cookies
|
|
52839
52873
|
});
|
|
52840
52874
|
if (!response.ok) {
|
|
52841
52875
|
const error2 = await response.json().catch(() => ({ error: "Erro desconhecido" }));
|
|
@@ -52845,10 +52879,11 @@ async function getCampaignConfig$1(contactId) {
|
|
|
52845
52879
|
return json;
|
|
52846
52880
|
}
|
|
52847
52881
|
async function getCodeToNameMapping$1(campaignModelId) {
|
|
52848
|
-
const url =
|
|
52882
|
+
const url = `${API_BASE_URL$1}/api/campaign-fields/${campaignModelId}`;
|
|
52849
52883
|
const response = await fetch(url, {
|
|
52850
52884
|
method: "GET",
|
|
52851
|
-
|
|
52885
|
+
headers: getAuthHeaders$1(),
|
|
52886
|
+
credentials: "omit"
|
|
52852
52887
|
});
|
|
52853
52888
|
if (!response.ok) {
|
|
52854
52889
|
const error2 = await response.json().catch(() => ({ error: "Erro desconhecido" }));
|
|
@@ -52858,10 +52893,11 @@ async function getCodeToNameMapping$1(campaignModelId) {
|
|
|
52858
52893
|
return json;
|
|
52859
52894
|
}
|
|
52860
52895
|
async function getContactValues$1(contactId) {
|
|
52861
|
-
const url =
|
|
52896
|
+
const url = `${API_BASE_URL$1}/api/campaign-contact/${contactId}`;
|
|
52862
52897
|
const response = await fetch(url, {
|
|
52863
52898
|
method: "GET",
|
|
52864
|
-
|
|
52899
|
+
headers: getAuthHeaders$1(),
|
|
52900
|
+
credentials: "omit"
|
|
52865
52901
|
});
|
|
52866
52902
|
if (!response.ok) {
|
|
52867
52903
|
const error2 = await response.json().catch(() => ({ error: "Erro desconhecido" }));
|
|
@@ -55405,28 +55441,31 @@ const API_BASE_URL = typeof window !== "undefined" ? window.__CALLIX_API_BASE_UR
|
|
|
55405
55441
|
function getSessionToken() {
|
|
55406
55442
|
if (typeof window === "undefined") return null;
|
|
55407
55443
|
console.log("[DraggableClientInfoModal] 🔍 Buscando token de sessão no localStorage...");
|
|
55408
|
-
const
|
|
55409
|
-
|
|
55410
|
-
|
|
55411
|
-
|
|
55412
|
-
|
|
55413
|
-
|
|
55414
|
-
|
|
55415
|
-
|
|
55416
|
-
|
|
55417
|
-
|
|
55418
|
-
|
|
55419
|
-
|
|
55420
|
-
|
|
55421
|
-
|
|
55444
|
+
const lastUsername = localStorage.getItem("callix_dialer_last_username");
|
|
55445
|
+
if (lastUsername) {
|
|
55446
|
+
const sessionKey = `callix_dialer_${lastUsername}_session_token`;
|
|
55447
|
+
const token = localStorage.getItem(sessionKey);
|
|
55448
|
+
if (token) {
|
|
55449
|
+
console.log(`[DraggableClientInfoModal] ✅ Token encontrado para usuário "${lastUsername}":`, token.substring(0, 20) + "...");
|
|
55450
|
+
return token;
|
|
55451
|
+
} else {
|
|
55452
|
+
console.log(`[DraggableClientInfoModal] ⚠️ Chave de sessão "${sessionKey}" não encontrada`);
|
|
55453
|
+
}
|
|
55454
|
+
} else {
|
|
55455
|
+
console.log("[DraggableClientInfoModal] ⚠️ callix_dialer_last_username não encontrado");
|
|
55456
|
+
}
|
|
55457
|
+
console.log("[DraggableClientInfoModal] 🔍 Procurando qualquer chave de sessão...");
|
|
55458
|
+
for (let i2 = 0; i2 < localStorage.length; i2++) {
|
|
55459
|
+
const key = localStorage.key(i2);
|
|
55460
|
+
if (key && key.match(/^callix_dialer_.*_session_token$/)) {
|
|
55461
|
+
const token = localStorage.getItem(key);
|
|
55462
|
+
if (token) {
|
|
55463
|
+
console.log(`[DraggableClientInfoModal] ✅ Token encontrado na chave "${key}":`, token.substring(0, 20) + "...");
|
|
55422
55464
|
return token;
|
|
55423
|
-
} catch {
|
|
55424
|
-
console.log("[DraggableClientInfoModal] ✅ Token (string direto):", (value == null ? void 0 : value.substring(0, 20)) + "...");
|
|
55425
|
-
return value;
|
|
55426
55465
|
}
|
|
55427
55466
|
}
|
|
55428
55467
|
}
|
|
55429
|
-
console.log("[DraggableClientInfoModal] ⚠️
|
|
55468
|
+
console.log("[DraggableClientInfoModal] ⚠️ Nenhum token encontrado. Chaves disponíveis no localStorage:");
|
|
55430
55469
|
for (let i2 = 0; i2 < localStorage.length; i2++) {
|
|
55431
55470
|
const key = localStorage.key(i2);
|
|
55432
55471
|
if (key) {
|