callix-dialer-widget 1.3.17 → 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,8 +6,8 @@ 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";
|
|
10
|
-
import require$$0$2 from "react-dom";
|
|
9
|
+
import React, { useEffect, useState, useRef, useMemo, useCallback, createContext, StrictMode, useContext } from "react";
|
|
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) {
|
|
13
13
|
if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return 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;
|
|
@@ -55725,7 +55726,7 @@ function DraggableClientInfoModal({
|
|
|
55725
55726
|
);
|
|
55726
55727
|
return valueKey ? contactData[valueKey] : "-";
|
|
55727
55728
|
};
|
|
55728
|
-
|
|
55729
|
+
const modalContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
55729
55730
|
"div",
|
|
55730
55731
|
{
|
|
55731
55732
|
ref: containerRef,
|
|
@@ -55822,6 +55823,10 @@ function DraggableClientInfoModal({
|
|
|
55822
55823
|
]
|
|
55823
55824
|
}
|
|
55824
55825
|
);
|
|
55826
|
+
if (typeof document !== "undefined") {
|
|
55827
|
+
return createPortal(modalContent, document.body);
|
|
55828
|
+
}
|
|
55829
|
+
return null;
|
|
55825
55830
|
}
|
|
55826
55831
|
function Field({ label, value }) {
|
|
55827
55832
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`rounded-lg border border-slate-200 bg-white p-2`, children: [
|
|
@@ -55953,7 +55958,7 @@ function DraggableQualificationModal({
|
|
|
55953
55958
|
if (!isOpen) {
|
|
55954
55959
|
return null;
|
|
55955
55960
|
}
|
|
55956
|
-
|
|
55961
|
+
const modalContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
55957
55962
|
"div",
|
|
55958
55963
|
{
|
|
55959
55964
|
ref: containerRef,
|
|
@@ -56075,12 +56080,17 @@ function DraggableQualificationModal({
|
|
|
56075
56080
|
]
|
|
56076
56081
|
}
|
|
56077
56082
|
);
|
|
56083
|
+
if (typeof document !== "undefined") {
|
|
56084
|
+
return createPortal(modalContent, document.body);
|
|
56085
|
+
}
|
|
56086
|
+
return null;
|
|
56078
56087
|
}
|
|
56079
56088
|
function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
56080
56089
|
const isMiniMode = variant === "min";
|
|
56081
56090
|
if (!isAuthenticated || !isMiniMode) {
|
|
56082
56091
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FloatingDialer, { variant, isAuthenticated, ...props });
|
|
56083
56092
|
}
|
|
56093
|
+
const { skipManualQualification } = useDialerConfig();
|
|
56084
56094
|
const operatorState = clientSdkReactExports.useCallOperatorState();
|
|
56085
56095
|
const currentCall = clientSdkReactExports.useCallOperatorCurrentCall();
|
|
56086
56096
|
const currentCallInfo = clientSdkReactExports.useCallOperatorCurrentCallInfo();
|
|
@@ -56121,8 +56131,8 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56121
56131
|
useEffect(() => {
|
|
56122
56132
|
if (!isMiniMode) return;
|
|
56123
56133
|
if (isAfterCall) {
|
|
56124
|
-
const
|
|
56125
|
-
if (
|
|
56134
|
+
const shouldSkipCampaignQualification = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "campaign" && currentCallInfo.info.campaign.skipCallQualification === true;
|
|
56135
|
+
if (shouldSkipCampaignQualification && finishAfterCall) {
|
|
56126
56136
|
void Promise.resolve(
|
|
56127
56137
|
finishAfterCall({
|
|
56128
56138
|
result: "success",
|
|
@@ -56133,7 +56143,8 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56133
56143
|
}
|
|
56134
56144
|
const isManualCall = (currentCallInfo == null ? void 0 : currentCallInfo.type) === "manual";
|
|
56135
56145
|
const hasNoQualifications = successQualifications.length === 0 && discardQualifications.length === 0;
|
|
56136
|
-
if (isManualCall && hasNoQualifications && finishAfterCall) {
|
|
56146
|
+
if (isManualCall && (skipManualQualification || hasNoQualifications) && finishAfterCall) {
|
|
56147
|
+
console.log("[InlineDialer] 🚀 Chamada manual - finalizando automaticamente (skipManualQualification:", skipManualQualification, ", hasNoQualifications:", hasNoQualifications, ")");
|
|
56137
56148
|
void Promise.resolve(
|
|
56138
56149
|
finishAfterCall({
|
|
56139
56150
|
result: "success",
|
|
@@ -56150,7 +56161,7 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56150
56161
|
} else {
|
|
56151
56162
|
setIsQualificationModalOpen(false);
|
|
56152
56163
|
}
|
|
56153
|
-
}, [isMiniMode, isAfterCall, currentCallInfo, finishAfterCall, successQualifications, discardQualifications]);
|
|
56164
|
+
}, [isMiniMode, isAfterCall, currentCallInfo, finishAfterCall, successQualifications, discardQualifications, skipManualQualification]);
|
|
56154
56165
|
useEffect(() => {
|
|
56155
56166
|
if (!isMiniMode) return;
|
|
56156
56167
|
if (!isInCall && !isConnecting && !isAfterCall) {
|
|
@@ -56345,6 +56356,14 @@ function InlineDialer({ variant = "default", isAuthenticated, ...props }) {
|
|
|
56345
56356
|
] })
|
|
56346
56357
|
] });
|
|
56347
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
|
+
}
|
|
56348
56367
|
function deriveOptionsFromElement(element) {
|
|
56349
56368
|
const result2 = {};
|
|
56350
56369
|
const datasetMode = element.getAttribute("data-callix-mode") || element.dataset.callixMode || element.dataset.mode;
|
|
@@ -56432,7 +56451,8 @@ class CallixDialerWidget {
|
|
|
56432
56451
|
const getStorageKeys = (username) => ({
|
|
56433
56452
|
SESSION_TOKEN: `callix_dialer_${username}_session_token`,
|
|
56434
56453
|
DOMAIN: `callix_dialer_${username}_domain`,
|
|
56435
|
-
TIMESTAMP: `callix_dialer_${username}_timestamp
|
|
56454
|
+
TIMESTAMP: `callix_dialer_${username}_timestamp`,
|
|
56455
|
+
SKIP_MANUAL_QUALIFICATION: `callix_dialer_${username}_skip_manual_qualification`
|
|
56436
56456
|
});
|
|
56437
56457
|
const LAST_USERNAME_KEY = "callix_dialer_last_username";
|
|
56438
56458
|
const SESSION_EXPIRATION_MS = 8 * 60 * 60 * 1e3;
|
|
@@ -56444,6 +56464,7 @@ function DialerWrapper({ options }) {
|
|
|
56444
56464
|
const [sessionToken, setSessionToken] = useState(null);
|
|
56445
56465
|
const [callixDomain, setCallixDomain] = useState(null);
|
|
56446
56466
|
const [isRestoringSession, setIsRestoringSession] = useState(true);
|
|
56467
|
+
const [skipManualQualification, setSkipManualQualification] = useState(false);
|
|
56447
56468
|
const presetUsername = options.presetUsername ? options.presetUsername.trim() : null;
|
|
56448
56469
|
const uiVariant = options.uiVariant ?? "default";
|
|
56449
56470
|
const autoLoginAttemptedRef = useRef(false);
|
|
@@ -56477,6 +56498,10 @@ function DialerWrapper({ options }) {
|
|
|
56477
56498
|
setSessionToken(storedToken);
|
|
56478
56499
|
setCallixDomain(storedDomain);
|
|
56479
56500
|
setIsAuthenticated(true);
|
|
56501
|
+
const storedSkipQualification = localStorage.getItem(STORAGE_KEYS.SKIP_MANUAL_QUALIFICATION);
|
|
56502
|
+
if (storedSkipQualification) {
|
|
56503
|
+
setSkipManualQualification(storedSkipQualification === "true");
|
|
56504
|
+
}
|
|
56480
56505
|
} else {
|
|
56481
56506
|
console.log("[Callix Dialer] Sessão expirada, limpando...");
|
|
56482
56507
|
localStorage.removeItem(LAST_USERNAME_KEY);
|
|
@@ -56497,6 +56522,7 @@ function DialerWrapper({ options }) {
|
|
|
56497
56522
|
}
|
|
56498
56523
|
}, [presetUsername, username]);
|
|
56499
56524
|
const handleLogin = useCallback(async (user) => {
|
|
56525
|
+
var _a2, _b;
|
|
56500
56526
|
setIsLoading(true);
|
|
56501
56527
|
setError(null);
|
|
56502
56528
|
try {
|
|
@@ -56520,6 +56546,29 @@ function DialerWrapper({ options }) {
|
|
|
56520
56546
|
setUsername(user);
|
|
56521
56547
|
setIsAuthenticated(true);
|
|
56522
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
|
+
}
|
|
56523
56572
|
if (typeof window !== "undefined") {
|
|
56524
56573
|
try {
|
|
56525
56574
|
const STORAGE_KEYS = getStorageKeys(user);
|
|
@@ -56595,7 +56644,7 @@ function DialerWrapper({ options }) {
|
|
|
56595
56644
|
}
|
|
56596
56645
|
);
|
|
56597
56646
|
}
|
|
56598
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
56647
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DialerConfigContext.Provider, { value: { skipManualQualification }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
56599
56648
|
clientSdkReactExports.CallixClientProvider,
|
|
56600
56649
|
{
|
|
56601
56650
|
domain: callixDomain,
|
|
@@ -56613,7 +56662,7 @@ function DialerWrapper({ options }) {
|
|
|
56613
56662
|
}
|
|
56614
56663
|
)
|
|
56615
56664
|
}
|
|
56616
|
-
);
|
|
56665
|
+
) });
|
|
56617
56666
|
}
|
|
56618
56667
|
function init(options) {
|
|
56619
56668
|
const widget = new CallixDialerWidget(options);
|
|
@@ -56628,6 +56677,7 @@ if (typeof window !== "undefined") {
|
|
|
56628
56677
|
window.CallixDialer = CallixDialer;
|
|
56629
56678
|
}
|
|
56630
56679
|
export {
|
|
56631
|
-
CallixDialer as default
|
|
56680
|
+
CallixDialer as default,
|
|
56681
|
+
useDialerConfig
|
|
56632
56682
|
};
|
|
56633
56683
|
//# sourceMappingURL=callix-dialer.es.js.map
|