callix-dialer-widget 1.3.18 → 1.3.19
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.
|
@@ -6,7 +6,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
6
6
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
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
|
-
import React, { useEffect, useState, useRef, useMemo, useCallback, StrictMode } from "react";
|
|
9
|
+
import React, { useEffect, useState, useRef, useMemo, useCallback, createContext, StrictMode, useContext } from "react";
|
|
10
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) {
|
|
@@ -53715,6 +53715,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout, vari
|
|
|
53715
53715
|
var _a2, _b;
|
|
53716
53716
|
const operator = clientSdkReactExports.useCallOperator();
|
|
53717
53717
|
const isMiniMode = variant === "min";
|
|
53718
|
+
const { skipManualQualification } = useDialerConfig();
|
|
53718
53719
|
const operatorState = clientSdkReactExports.useCallOperatorState();
|
|
53719
53720
|
const currentCall = clientSdkReactExports.useCallOperatorCurrentCall();
|
|
53720
53721
|
const currentCallInfo = clientSdkReactExports.useCallOperatorCurrentCallInfo();
|
|
@@ -53827,9 +53828,9 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout, vari
|
|
|
53827
53828
|
}, [callState, requestAvailability]);
|
|
53828
53829
|
useEffect(() => {
|
|
53829
53830
|
if (callState === "afterCall") {
|
|
53830
|
-
const
|
|
53831
|
-
if (
|
|
53832
|
-
console.log("[FloatingDialer]
|
|
53831
|
+
const shouldSkipCampaignQualification = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "campaign" && currentCallInfo.info.campaign.skipCallQualification === true;
|
|
53832
|
+
if (shouldSkipCampaignQualification) {
|
|
53833
|
+
console.log("[FloatingDialer] 🚀 skipCallQualification ativado - finalizando automaticamente");
|
|
53833
53834
|
if (typeof finishAfterCall === "function") {
|
|
53834
53835
|
void Promise.resolve(
|
|
53835
53836
|
finishAfterCall({
|
|
@@ -53842,8 +53843,8 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout, vari
|
|
|
53842
53843
|
}
|
|
53843
53844
|
const isManualCall = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "manual";
|
|
53844
53845
|
const hasNoQualifications = successQualifications.length === 0 && discardQualifications.length === 0;
|
|
53845
|
-
if (isManualCall && hasNoQualifications) {
|
|
53846
|
-
console.log("[FloatingDialer]
|
|
53846
|
+
if (isManualCall && (skipManualQualification || hasNoQualifications)) {
|
|
53847
|
+
console.log("[FloatingDialer] 🚀 Chamada manual - finalizando automaticamente (skipManualQualification:", skipManualQualification, ", hasNoQualifications:", hasNoQualifications, ")");
|
|
53847
53848
|
if (typeof finishAfterCall === "function") {
|
|
53848
53849
|
void Promise.resolve(
|
|
53849
53850
|
finishAfterCall({
|
|
@@ -53859,7 +53860,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout, vari
|
|
|
53859
53860
|
setSelectedQualificationId(null);
|
|
53860
53861
|
setAfterCallError(null);
|
|
53861
53862
|
}
|
|
53862
|
-
}, [callState, successQualifications.length, discardQualifications.length, currentCallInfo, finishAfterCall]);
|
|
53863
|
+
}, [callState, successQualifications.length, discardQualifications.length, currentCallInfo, finishAfterCall, skipManualQualification]);
|
|
53863
53864
|
useEffect(() => {
|
|
53864
53865
|
if (typeof window === "undefined") {
|
|
53865
53866
|
return;
|
|
@@ -56089,6 +56090,7 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56089
56090
|
if (!isAuthenticated || !isMiniMode) {
|
|
56090
56091
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FloatingDialer, { variant, isAuthenticated, ...props });
|
|
56091
56092
|
}
|
|
56093
|
+
const { skipManualQualification } = useDialerConfig();
|
|
56092
56094
|
const operatorState = clientSdkReactExports.useCallOperatorState();
|
|
56093
56095
|
const currentCall = clientSdkReactExports.useCallOperatorCurrentCall();
|
|
56094
56096
|
const currentCallInfo = clientSdkReactExports.useCallOperatorCurrentCallInfo();
|
|
@@ -56129,8 +56131,8 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56129
56131
|
useEffect(() => {
|
|
56130
56132
|
if (!isMiniMode) return;
|
|
56131
56133
|
if (isAfterCall) {
|
|
56132
|
-
const
|
|
56133
|
-
if (
|
|
56134
|
+
const shouldSkipCampaignQualification = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "campaign" && currentCallInfo.info.campaign.skipCallQualification === true;
|
|
56135
|
+
if (shouldSkipCampaignQualification && finishAfterCall) {
|
|
56134
56136
|
void Promise.resolve(
|
|
56135
56137
|
finishAfterCall({
|
|
56136
56138
|
result: "success",
|
|
@@ -56141,7 +56143,8 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56141
56143
|
}
|
|
56142
56144
|
const isManualCall = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "manual";
|
|
56143
56145
|
const hasNoQualifications = successQualifications.length === 0 && discardQualifications.length === 0;
|
|
56144
|
-
if (isManualCall && hasNoQualifications && finishAfterCall) {
|
|
56146
|
+
if (isManualCall && (skipManualQualification || hasNoQualifications) && finishAfterCall) {
|
|
56147
|
+
console.log("[InlineDialer] 🚀 Chamada manual - finalizando automaticamente (skipManualQualification:", skipManualQualification, ", hasNoQualifications:", hasNoQualifications, ")");
|
|
56145
56148
|
void Promise.resolve(
|
|
56146
56149
|
finishAfterCall({
|
|
56147
56150
|
result: "success",
|
|
@@ -56158,7 +56161,7 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56158
56161
|
} else {
|
|
56159
56162
|
setIsQualificationModalOpen(false);
|
|
56160
56163
|
}
|
|
56161
|
-
}, [isMiniMode, isAfterCall, currentCallInfo, finishAfterCall, successQualifications, discardQualifications]);
|
|
56164
|
+
}, [isMiniMode, isAfterCall, currentCallInfo, finishAfterCall, successQualifications, discardQualifications, skipManualQualification]);
|
|
56162
56165
|
useEffect(() => {
|
|
56163
56166
|
if (!isMiniMode) return;
|
|
56164
56167
|
if (!isInCall && !isConnecting && !isAfterCall) {
|
|
@@ -56353,6 +56356,14 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56353
56356
|
] })
|
|
56354
56357
|
] });
|
|
56355
56358
|
}
|
|
56359
|
+
const DialerConfigContext = createContext(null);
|
|
56360
|
+
function useDialerConfig() {
|
|
56361
|
+
const context = useContext(DialerConfigContext);
|
|
56362
|
+
if (!context) {
|
|
56363
|
+
return { skipManualQualification: false };
|
|
56364
|
+
}
|
|
56365
|
+
return context;
|
|
56366
|
+
}
|
|
56356
56367
|
function deriveOptionsFromElement(element) {
|
|
56357
56368
|
const result2 = {};
|
|
56358
56369
|
const datasetMode = element.getAttribute("data-callix-mode") || element.dataset.callixMode || element.dataset.mode;
|
|
@@ -56440,7 +56451,8 @@ class CallixDialerWidget {
|
|
|
56440
56451
|
const getStorageKeys = (username) => ({
|
|
56441
56452
|
SESSION_TOKEN: `callix_dialer_${username}_session_token`,
|
|
56442
56453
|
DOMAIN: `callix_dialer_${username}_domain`,
|
|
56443
|
-
TIMESTAMP: `callix_dialer_${username}_timestamp
|
|
56454
|
+
TIMESTAMP: `callix_dialer_${username}_timestamp`,
|
|
56455
|
+
SKIP_MANUAL_QUALIFICATION: `callix_dialer_${username}_skip_manual_qualification`
|
|
56444
56456
|
});
|
|
56445
56457
|
const LAST_USERNAME_KEY = "callix_dialer_last_username";
|
|
56446
56458
|
const SESSION_EXPIRATION_MS = 8 * 60 * 60 * 1e3;
|
|
@@ -56452,6 +56464,7 @@ function DialerWrapper({ options }) {
|
|
|
56452
56464
|
const [sessionToken, setSessionToken] = useState(null);
|
|
56453
56465
|
const [callixDomain, setCallixDomain] = useState(null);
|
|
56454
56466
|
const [isRestoringSession, setIsRestoringSession] = useState(true);
|
|
56467
|
+
const [skipManualQualification, setSkipManualQualification] = useState(false);
|
|
56455
56468
|
const presetUsername = options.presetUsername ? options.presetUsername.trim() : null;
|
|
56456
56469
|
const uiVariant = options.uiVariant ?? "default";
|
|
56457
56470
|
const autoLoginAttemptedRef = useRef(false);
|
|
@@ -56485,6 +56498,10 @@ function DialerWrapper({ options }) {
|
|
|
56485
56498
|
setSessionToken(storedToken);
|
|
56486
56499
|
setCallixDomain(storedDomain);
|
|
56487
56500
|
setIsAuthenticated(true);
|
|
56501
|
+
const storedSkipQualification = localStorage.getItem(STORAGE_KEYS.SKIP_MANUAL_QUALIFICATION);
|
|
56502
|
+
if (storedSkipQualification) {
|
|
56503
|
+
setSkipManualQualification(storedSkipQualification === "true");
|
|
56504
|
+
}
|
|
56488
56505
|
} else {
|
|
56489
56506
|
console.log("[Callix Dialer] Sessão expirada, limpando...");
|
|
56490
56507
|
localStorage.removeItem(LAST_USERNAME_KEY);
|
|
@@ -56505,6 +56522,7 @@ function DialerWrapper({ options }) {
|
|
|
56505
56522
|
}
|
|
56506
56523
|
}, [presetUsername, username]);
|
|
56507
56524
|
const handleLogin = useCallback(async (user) => {
|
|
56525
|
+
var _a2, _b;
|
|
56508
56526
|
setIsLoading(true);
|
|
56509
56527
|
setError(null);
|
|
56510
56528
|
try {
|
|
@@ -56528,6 +56546,29 @@ function DialerWrapper({ options }) {
|
|
|
56528
56546
|
setUsername(user);
|
|
56529
56547
|
setIsAuthenticated(true);
|
|
56530
56548
|
setError(null);
|
|
56549
|
+
try {
|
|
56550
|
+
const domain = data.domain || "villelabrasil.callix.com.br";
|
|
56551
|
+
const configUrl = `https://${domain}/sdk/v1/client/user-service/config`;
|
|
56552
|
+
const configResponse = await fetch(configUrl, {
|
|
56553
|
+
headers: {
|
|
56554
|
+
"Cookie": `token=${data.userSessionToken}`
|
|
56555
|
+
}
|
|
56556
|
+
});
|
|
56557
|
+
if (configResponse.ok) {
|
|
56558
|
+
const configData = await configResponse.json();
|
|
56559
|
+
const shouldSkipQualification = ((_b = (_a2 = configData == null ? void 0 : configData.service) == null ? void 0 : _a2.outboundOptions) == null ? void 0 : _b.skipQualification) === true;
|
|
56560
|
+
console.log("[Callix Dialer] skipQualification configurado:", shouldSkipQualification);
|
|
56561
|
+
setSkipManualQualification(shouldSkipQualification);
|
|
56562
|
+
if (typeof window !== "undefined") {
|
|
56563
|
+
const STORAGE_KEYS = getStorageKeys(user);
|
|
56564
|
+
localStorage.setItem(STORAGE_KEYS.SKIP_MANUAL_QUALIFICATION, shouldSkipQualification.toString());
|
|
56565
|
+
}
|
|
56566
|
+
} else {
|
|
56567
|
+
console.warn("[Callix Dialer] Não foi possível buscar config do serviço:", configResponse.status);
|
|
56568
|
+
}
|
|
56569
|
+
} catch (configErr) {
|
|
56570
|
+
console.warn("[Callix Dialer] Erro ao buscar config do serviço:", configErr);
|
|
56571
|
+
}
|
|
56531
56572
|
if (typeof window !== "undefined") {
|
|
56532
56573
|
try {
|
|
56533
56574
|
const STORAGE_KEYS = getStorageKeys(user);
|
|
@@ -56603,7 +56644,7 @@ function DialerWrapper({ options }) {
|
|
|
56603
56644
|
}
|
|
56604
56645
|
);
|
|
56605
56646
|
}
|
|
56606
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
56647
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DialerConfigContext.Provider, { value: { skipManualQualification }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
56607
56648
|
clientSdkReactExports.CallixClientProvider,
|
|
56608
56649
|
{
|
|
56609
56650
|
domain: callixDomain,
|
|
@@ -56621,7 +56662,7 @@ function DialerWrapper({ options }) {
|
|
|
56621
56662
|
}
|
|
56622
56663
|
)
|
|
56623
56664
|
}
|
|
56624
|
-
);
|
|
56665
|
+
) });
|
|
56625
56666
|
}
|
|
56626
56667
|
function init(options) {
|
|
56627
56668
|
const widget = new CallixDialerWidget(options);
|
|
@@ -56636,6 +56677,7 @@ if (typeof window !== "undefined") {
|
|
|
56636
56677
|
window.CallixDialer = CallixDialer;
|
|
56637
56678
|
}
|
|
56638
56679
|
export {
|
|
56639
|
-
CallixDialer as default
|
|
56680
|
+
CallixDialer as default,
|
|
56681
|
+
useDialerConfig
|
|
56640
56682
|
};
|
|
56641
56683
|
//# sourceMappingURL=callix-dialer.es.js.map
|