callix-dialer-widget 1.3.10 → 1.3.12

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.
@@ -55402,10 +55402,54 @@ function formatDuration(seconds) {
55402
55402
  return `${mins}:${secs.toString().padStart(2, "0")}`;
55403
55403
  }
55404
55404
  const API_BASE_URL = typeof window !== "undefined" ? window.__CALLIX_API_BASE_URL__ || "https://callix-zeta.vercel.app" : "https://callix-zeta.vercel.app";
55405
+ function getSessionToken() {
55406
+ if (typeof window === "undefined") return null;
55407
+ console.log("[DraggableClientInfoModal] 🔍 Buscando token de sessão no localStorage...");
55408
+ const possibleKeys = [
55409
+ "callix_dialer_session_token",
55410
+ "callix_session_token",
55411
+ "sessionToken"
55412
+ ];
55413
+ for (const key of possibleKeys) {
55414
+ const value = localStorage.getItem(key);
55415
+ console.log(`[DraggableClientInfoModal] Verificando chave "${key}":`, value ? "✓ encontrado" : "✗ não encontrado");
55416
+ if (value) {
55417
+ try {
55418
+ const parsed = JSON.parse(value);
55419
+ console.log("[DraggableClientInfoModal] Valor parseado:", parsed);
55420
+ const token = parsed.token || parsed.sessionToken || value;
55421
+ console.log("[DraggableClientInfoModal] ✅ Token extraído:", (token == null ? void 0 : token.substring(0, 20)) + "...");
55422
+ return token;
55423
+ } catch {
55424
+ console.log("[DraggableClientInfoModal] ✅ Token (string direto):", (value == null ? void 0 : value.substring(0, 20)) + "...");
55425
+ return value;
55426
+ }
55427
+ }
55428
+ }
55429
+ console.log("[DraggableClientInfoModal] ⚠️ Token não encontrado. Chaves disponíveis no localStorage:");
55430
+ for (let i2 = 0; i2 < localStorage.length; i2++) {
55431
+ const key = localStorage.key(i2);
55432
+ if (key) {
55433
+ console.log(` - ${key}`);
55434
+ }
55435
+ }
55436
+ return null;
55437
+ }
55438
+ function getAuthHeaders() {
55439
+ const token = getSessionToken();
55440
+ const headers = {
55441
+ "Content-Type": "application/json"
55442
+ };
55443
+ if (token) {
55444
+ headers["x-session-token"] = token;
55445
+ }
55446
+ return headers;
55447
+ }
55405
55448
  async function getCampaignConfig(contactId) {
55406
55449
  const url = `${API_BASE_URL}/api/campaign-config/${contactId}`;
55407
55450
  const response = await fetch(url, {
55408
55451
  method: "GET",
55452
+ headers: getAuthHeaders(),
55409
55453
  credentials: "omit"
55410
55454
  // API usa localStorage, não cookies
55411
55455
  });
@@ -55420,6 +55464,7 @@ async function getCodeToNameMapping(campaignModelId) {
55420
55464
  const url = `${API_BASE_URL}/api/campaign-fields/${campaignModelId}`;
55421
55465
  const response = await fetch(url, {
55422
55466
  method: "GET",
55467
+ headers: getAuthHeaders(),
55423
55468
  credentials: "omit"
55424
55469
  });
55425
55470
  if (!response.ok) {
@@ -55433,6 +55478,7 @@ async function getContactValues(contactId) {
55433
55478
  const url = `${API_BASE_URL}/api/campaign-contact/${contactId}`;
55434
55479
  const response = await fetch(url, {
55435
55480
  method: "GET",
55481
+ headers: getAuthHeaders(),
55436
55482
  credentials: "omit"
55437
55483
  });
55438
55484
  if (!response.ok) {
@@ -55979,12 +56025,12 @@ function DraggableQualificationModal({
55979
56025
  }
55980
56026
  function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
55981
56027
  const isMiniMode = variant === "min";
55982
- const operatorState = isMiniMode && isAuthenticated ? clientSdkReactExports.useCallOperatorState() : null;
55983
- const currentCall = isMiniMode && isAuthenticated ? clientSdkReactExports.useCallOperatorCurrentCall() : null;
55984
- const currentCallInfo = isMiniMode && isAuthenticated ? clientSdkReactExports.useCallOperatorCurrentCallInfo() : null;
55985
- const successQualifications = isMiniMode && isAuthenticated ? clientSdkReactExports.useCallOperatorSuccessQualifications() : [];
55986
- const discardQualifications = isMiniMode && isAuthenticated ? clientSdkReactExports.useCallOperatorDiscardQualifications() : [];
55987
- const { finishAfterCall } = isMiniMode && isAuthenticated ? clientSdkReactExports.useCallOperatorControls() : { finishAfterCall: void 0 };
56028
+ const operatorState = clientSdkReactExports.useCallOperatorState();
56029
+ const currentCall = clientSdkReactExports.useCallOperatorCurrentCall();
56030
+ const currentCallInfo = clientSdkReactExports.useCallOperatorCurrentCallInfo();
56031
+ const successQualifications = clientSdkReactExports.useCallOperatorSuccessQualifications();
56032
+ const discardQualifications = clientSdkReactExports.useCallOperatorDiscardQualifications();
56033
+ const { finishAfterCall } = clientSdkReactExports.useCallOperatorControls();
55988
56034
  const [isClientInfoModalOpen, setIsClientInfoModalOpen] = useState(false);
55989
56035
  const [isQualificationModalOpen, setIsQualificationModalOpen] = useState(false);
55990
56036
  const [callDurationSeconds, setCallDurationSeconds] = useState(0);