callix-dialer-widget 1.1.5 → 1.1.6
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.
|
@@ -53044,10 +53044,10 @@ const MAX_DIAL_LENGTH = 32;
|
|
|
53044
53044
|
const DEFAULT_DIALER_DIMENSIONS = { width: 448, height: 640 };
|
|
53045
53045
|
const MIN_DIALER_WIDTH = 280;
|
|
53046
53046
|
const MIN_DIALER_HEIGHT = 420;
|
|
53047
|
-
const MAX_DIALER_WIDTH =
|
|
53048
|
-
const MAX_DIALER_HEIGHT =
|
|
53049
|
-
const MIN_DIALER_SCALE = 0.
|
|
53050
|
-
const MAX_DIALER_SCALE =
|
|
53047
|
+
const MAX_DIALER_WIDTH = 1024;
|
|
53048
|
+
const MAX_DIALER_HEIGHT = 960;
|
|
53049
|
+
const MIN_DIALER_SCALE = 0.65;
|
|
53050
|
+
const MAX_DIALER_SCALE = 2.5;
|
|
53051
53051
|
const VIEWPORT_MARGIN_SMALL = 12;
|
|
53052
53052
|
const VIEWPORT_MARGIN_DEFAULT = 16;
|
|
53053
53053
|
const keypadKeys = [
|
|
@@ -53421,21 +53421,10 @@ function FloatingDialer({
|
|
|
53421
53421
|
maxWidth: `min(${MAX_DIALER_WIDTH}px, calc(100vw - 1.5rem))`,
|
|
53422
53422
|
maxHeight: `calc(100vh - 3rem)`
|
|
53423
53423
|
};
|
|
53424
|
-
const
|
|
53425
|
-
flex: 1,
|
|
53426
|
-
display: "flex",
|
|
53427
|
-
flexDirection: "column",
|
|
53428
|
-
transform: `scale(${scale})`,
|
|
53429
|
-
transformOrigin: "top left",
|
|
53430
|
-
width: `${DEFAULT_DIALER_DIMENSIONS.width}px`,
|
|
53431
|
-
minHeight: `${DEFAULT_DIALER_DIMENSIONS.height}px`
|
|
53432
|
-
};
|
|
53424
|
+
const scalePercent = Math.round(scale * 1e4) / 100;
|
|
53433
53425
|
const cardContentStyle = {
|
|
53434
|
-
|
|
53435
|
-
|
|
53436
|
-
flexDirection: "column",
|
|
53437
|
-
minHeight: `${DEFAULT_DIALER_DIMENSIONS.height}px`,
|
|
53438
|
-
width: `${DEFAULT_DIALER_DIMENSIONS.width}px`
|
|
53426
|
+
fontSize: `${scalePercent}%`,
|
|
53427
|
+
lineHeight: 1.25
|
|
53439
53428
|
};
|
|
53440
53429
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
53441
53430
|
"div",
|
|
@@ -53455,18 +53444,18 @@ function FloatingDialer({
|
|
|
53455
53444
|
className: tw`relative flex flex-col items-start overflow-hidden rounded-3xl border border-slate-200/60 bg-gradient-to-br from-white/95 via-slate-50/95 to-white/90 shadow-2xl backdrop-blur-lg transition-all duration-300 w-[min(32rem,calc(100vw-1.5rem))] max-w-[calc(100vw-1.5rem)] sm:w-[28rem] md:w-[30rem] max-h-[calc(100vh-3rem)] sm:max-h-none`,
|
|
53456
53445
|
style: cardStyle,
|
|
53457
53446
|
children: [
|
|
53458
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
53447
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex flex-1 flex-col rounded-3xl overflow-hidden`, style: cardContentStyle, children: [
|
|
53459
53448
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
53460
53449
|
"div",
|
|
53461
53450
|
{
|
|
53462
|
-
className: tw`cursor-grab touch-none active:cursor-grabbing flex items-center justify-between bg-gradient-to-r from-primary to-primaryDark px-4 py-3
|
|
53451
|
+
className: tw`cursor-grab touch-none active:cursor-grabbing flex items-center justify-between bg-gradient-to-r from-primary to-primaryDark px-4 py-3 text-white shadow-sm`,
|
|
53463
53452
|
onPointerDown: beginDrag,
|
|
53464
53453
|
children: [
|
|
53465
53454
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-3`, children: [
|
|
53466
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-white/15 shadow-inner
|
|
53455
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-white/15 shadow-inner`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FiPhoneCall, { className: tw`text-xl` }) }),
|
|
53467
53456
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`space-y-0.5`, children: [
|
|
53468
53457
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-[11px] uppercase tracking-[0.2em] text-white/70`, children: "Discadora" }),
|
|
53469
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-
|
|
53458
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-base font-semibold`, children: username ?? "Visitante" })
|
|
53470
53459
|
] })
|
|
53471
53460
|
] }),
|
|
53472
53461
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -53482,8 +53471,8 @@ function FloatingDialer({
|
|
|
53482
53471
|
]
|
|
53483
53472
|
}
|
|
53484
53473
|
),
|
|
53485
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`flex-1 overflow-y-auto p-3
|
|
53486
|
-
] })
|
|
53474
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: tw`flex-1 overflow-y-auto p-3`, children: dialerContent })
|
|
53475
|
+
] }),
|
|
53487
53476
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
53488
53477
|
"div",
|
|
53489
53478
|
{
|
|
@@ -54297,7 +54286,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
|
|
|
54297
54286
|
"aria-label": "Discador manual",
|
|
54298
54287
|
onFocusCapture: handleFocusWithin,
|
|
54299
54288
|
onBlurCapture: handleBlurWithin,
|
|
54300
|
-
className: tw`space-y-3
|
|
54289
|
+
className: tw`space-y-3 rounded-2xl outline-none`,
|
|
54301
54290
|
children: [
|
|
54302
54291
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center justify-between gap-2`, children: [
|
|
54303
54292
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-2 min-w-0 flex-1`, children: [
|
|
@@ -54506,23 +54495,23 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
|
|
|
54506
54495
|
}
|
|
54507
54496
|
)
|
|
54508
54497
|
] }),
|
|
54509
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`rounded-xl border border-slate-200 bg-white/80 p-
|
|
54498
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`rounded-xl border border-slate-200 bg-white/80 p-3 shadow-sm`, children: [
|
|
54510
54499
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex flex-wrap items-center justify-between gap-2`, children: [
|
|
54511
54500
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
54512
54501
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: tw`text-[10px] uppercase tracking-wide text-slate-500`, children: "Volume" }),
|
|
54513
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: tw`text-
|
|
54502
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: tw`text-sm font-semibold text-slate-800`, children: [
|
|
54514
54503
|
"Saída ",
|
|
54515
54504
|
volumePercent,
|
|
54516
54505
|
"%"
|
|
54517
54506
|
] })
|
|
54518
54507
|
] }),
|
|
54519
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-
|
|
54508
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-2`, children: [
|
|
54520
54509
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
54521
54510
|
"button",
|
|
54522
54511
|
{
|
|
54523
54512
|
type: "button",
|
|
54524
54513
|
onClick: () => setVolumeClamped((outputVolume ?? 0) - 0.05),
|
|
54525
|
-
className: tw`inline-flex h-
|
|
54514
|
+
className: tw`inline-flex h-8 w-8 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 transition hover:border-primary/60 hover:text-primary`,
|
|
54526
54515
|
"aria-label": "Diminuir volume",
|
|
54527
54516
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(FiMinus, { className: tw`text-sm` })
|
|
54528
54517
|
}
|
|
@@ -54536,7 +54525,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
|
|
|
54536
54525
|
step: 0.01,
|
|
54537
54526
|
value: Number.isFinite(outputVolume) ? outputVolume : 0,
|
|
54538
54527
|
onChange: (event2) => setVolumeClamped(parseFloat(event2.target.value)),
|
|
54539
|
-
className: tw`h-1 w-full max-w-
|
|
54528
|
+
className: tw`h-1 w-full max-w-full cursor-pointer appearance-none rounded-full bg-slate-200 accent-primary`,
|
|
54540
54529
|
"aria-label": "Volume de saida"
|
|
54541
54530
|
}
|
|
54542
54531
|
),
|
|
@@ -54545,21 +54534,21 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
|
|
|
54545
54534
|
{
|
|
54546
54535
|
type: "button",
|
|
54547
54536
|
onClick: () => setVolumeClamped((outputVolume ?? 0) + 0.05),
|
|
54548
|
-
className: tw`inline-flex h-
|
|
54537
|
+
className: tw`inline-flex h-8 w-8 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 transition hover:border-primary/60 hover:text-primary`,
|
|
54549
54538
|
"aria-label": "Aumentar volume",
|
|
54550
54539
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(FiPlus, { className: tw`text-sm` })
|
|
54551
54540
|
}
|
|
54552
54541
|
)
|
|
54553
54542
|
] })
|
|
54554
54543
|
] }),
|
|
54555
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`mt-2 flex flex-wrap items-center gap-2 text-
|
|
54544
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`mt-2 flex flex-wrap items-center gap-2 text-xs text-slate-600`, children: [
|
|
54556
54545
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-1.5`, children: [
|
|
54557
54546
|
/* @__PURE__ */ jsxRuntimeExports.jsx(FiMic, { className: tw`text-sm text-primary` }),
|
|
54558
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`truncate max-w-
|
|
54547
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`truncate max-w-full`, children: inputDeviceLabel })
|
|
54559
54548
|
] }),
|
|
54560
54549
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex items-center gap-1.5`, children: [
|
|
54561
54550
|
/* @__PURE__ */ jsxRuntimeExports.jsx(FiHeadphones, { className: tw`text-sm text-primary` }),
|
|
54562
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`truncate max-w-
|
|
54551
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: tw`truncate max-w-full`, children: outputDeviceLabel })
|
|
54563
54552
|
] }),
|
|
54564
54553
|
(audioDevices.inputs.length > 0 || audioDevices.outputs.length > 0) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
54565
54554
|
"button",
|
|
@@ -54574,7 +54563,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
|
|
|
54574
54563
|
}
|
|
54575
54564
|
)
|
|
54576
54565
|
] }),
|
|
54577
|
-
isDevicePanelOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`mt-3 grid gap-2
|
|
54566
|
+
isDevicePanelOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`mt-3 grid gap-2`, children: [
|
|
54578
54567
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: tw`space-y-1 text-xs text-slate-700`, children: [
|
|
54579
54568
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: tw`flex items-center gap-1.5 font-semibold`, children: [
|
|
54580
54569
|
/* @__PURE__ */ jsxRuntimeExports.jsx(FiMic, { className: tw`text-sm text-primary` }),
|
|
@@ -54583,7 +54572,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
|
|
|
54583
54572
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
54584
54573
|
"select",
|
|
54585
54574
|
{
|
|
54586
|
-
className: tw`w-full rounded-lg border border-slate-200 bg-white px-2.5 py-1.5 text-
|
|
54575
|
+
className: tw`w-full rounded-lg border border-slate-200 bg-white px-2.5 py-1.5 text-xs shadow-inner focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/40`,
|
|
54587
54576
|
value: selectedInputId ?? "",
|
|
54588
54577
|
onChange: handleSelectInputDevice,
|
|
54589
54578
|
children: [
|
|
@@ -54601,7 +54590,7 @@ function AuthenticatedDialer({ username, dialValue, setDialValue, onLogout }) {
|
|
|
54601
54590
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
54602
54591
|
"select",
|
|
54603
54592
|
{
|
|
54604
|
-
className: tw`w-full rounded-lg border border-slate-200 bg-white px-2.5 py-1.5 text-
|
|
54593
|
+
className: tw`w-full rounded-lg border border-slate-200 bg-white px-2.5 py-1.5 text-xs shadow-inner focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/40`,
|
|
54605
54594
|
value: selectedOutputId ?? "",
|
|
54606
54595
|
onChange: handleSelectOutputDevice,
|
|
54607
54596
|
children: [
|
|
@@ -55054,6 +55043,9 @@ function InlineDialer(props) {
|
|
|
55054
55043
|
min-height: 0 !important;
|
|
55055
55044
|
}
|
|
55056
55045
|
.callix-inline-wrapper [data-floating-dialer-card] {
|
|
55046
|
+
position: relative !important;
|
|
55047
|
+
inset: auto !important;
|
|
55048
|
+
transform: none !important;
|
|
55057
55049
|
width: 100% !important;
|
|
55058
55050
|
max-width: 100% !important;
|
|
55059
55051
|
min-width: 0 !important;
|
|
@@ -55063,19 +55055,10 @@ function InlineDialer(props) {
|
|
|
55063
55055
|
box-shadow: none !important;
|
|
55064
55056
|
backdrop-filter: none !important;
|
|
55065
55057
|
}
|
|
55066
|
-
.callix-inline-wrapper [data-floating-dialer-card] >
|
|
55058
|
+
.callix-inline-wrapper [data-floating-dialer-card] > div {
|
|
55067
55059
|
width: 100% !important;
|
|
55068
55060
|
height: 100% !important;
|
|
55069
55061
|
}
|
|
55070
|
-
.callix-inline-wrapper [data-floating-dialer-card] > div:first-child {
|
|
55071
|
-
transform: none !important;
|
|
55072
|
-
width: 100% !important;
|
|
55073
|
-
min-height: 100% !important;
|
|
55074
|
-
}
|
|
55075
|
-
.callix-inline-wrapper [data-floating-dialer-card] > div:first-child > div:first-child {
|
|
55076
|
-
width: 100% !important;
|
|
55077
|
-
min-height: 100% !important;
|
|
55078
|
-
}
|
|
55079
55062
|
.callix-inline-wrapper [data-floating-dialer-card] .overflow-y-auto {
|
|
55080
55063
|
max-height: none !important;
|
|
55081
55064
|
}
|
|
@@ -55134,6 +55117,12 @@ class CallixDialerWidget {
|
|
|
55134
55117
|
}
|
|
55135
55118
|
}
|
|
55136
55119
|
}
|
|
55120
|
+
const getStorageKeys = (username) => ({
|
|
55121
|
+
SESSION_TOKEN: `callix_dialer_${username}_session_token`,
|
|
55122
|
+
DOMAIN: `callix_dialer_${username}_domain`,
|
|
55123
|
+
TIMESTAMP: `callix_dialer_${username}_timestamp`
|
|
55124
|
+
});
|
|
55125
|
+
const LAST_USERNAME_KEY = "callix_dialer_last_username";
|
|
55137
55126
|
const SESSION_EXPIRATION_MS = 8 * 60 * 60 * 1e3;
|
|
55138
55127
|
function DialerWrapper({ options }) {
|
|
55139
55128
|
const [username, setUsername] = useState(null);
|
|
@@ -55149,22 +55138,27 @@ function DialerWrapper({ options }) {
|
|
|
55149
55138
|
return;
|
|
55150
55139
|
}
|
|
55151
55140
|
try {
|
|
55152
|
-
const
|
|
55141
|
+
const storedLastUsername = localStorage.getItem(LAST_USERNAME_KEY);
|
|
55142
|
+
if (!storedLastUsername) {
|
|
55143
|
+
setIsRestoringSession(false);
|
|
55144
|
+
return;
|
|
55145
|
+
}
|
|
55146
|
+
const STORAGE_KEYS = getStorageKeys(storedLastUsername);
|
|
55153
55147
|
const storedToken = localStorage.getItem(STORAGE_KEYS.SESSION_TOKEN);
|
|
55154
55148
|
const storedDomain = localStorage.getItem(STORAGE_KEYS.DOMAIN);
|
|
55155
55149
|
const storedTimestamp = localStorage.getItem(STORAGE_KEYS.TIMESTAMP);
|
|
55156
|
-
if (
|
|
55150
|
+
if (storedLastUsername && storedToken && storedDomain && storedTimestamp) {
|
|
55157
55151
|
const timestamp = parseInt(storedTimestamp, 10);
|
|
55158
55152
|
const now = Date.now();
|
|
55159
55153
|
if (now - timestamp < SESSION_EXPIRATION_MS) {
|
|
55160
|
-
console.log("[Callix Dialer] Restaurando sessão salva:",
|
|
55161
|
-
setUsername(
|
|
55154
|
+
console.log("[Callix Dialer] Restaurando sessão salva:", storedLastUsername);
|
|
55155
|
+
setUsername(storedLastUsername);
|
|
55162
55156
|
setSessionToken(storedToken);
|
|
55163
55157
|
setCallixDomain(storedDomain);
|
|
55164
55158
|
setIsAuthenticated(true);
|
|
55165
55159
|
} else {
|
|
55166
55160
|
console.log("[Callix Dialer] Sessão expirada, limpando...");
|
|
55167
|
-
localStorage.removeItem(
|
|
55161
|
+
localStorage.removeItem(LAST_USERNAME_KEY);
|
|
55168
55162
|
localStorage.removeItem(STORAGE_KEYS.SESSION_TOKEN);
|
|
55169
55163
|
localStorage.removeItem(STORAGE_KEYS.DOMAIN);
|
|
55170
55164
|
localStorage.removeItem(STORAGE_KEYS.TIMESTAMP);
|
|
@@ -55202,7 +55196,8 @@ function DialerWrapper({ options }) {
|
|
|
55202
55196
|
setError(null);
|
|
55203
55197
|
if (typeof window !== "undefined") {
|
|
55204
55198
|
try {
|
|
55205
|
-
|
|
55199
|
+
const STORAGE_KEYS = getStorageKeys(user);
|
|
55200
|
+
localStorage.setItem(LAST_USERNAME_KEY, user);
|
|
55206
55201
|
localStorage.setItem(STORAGE_KEYS.SESSION_TOKEN, data.userSessionToken);
|
|
55207
55202
|
localStorage.setItem(STORAGE_KEYS.DOMAIN, data.domain || "villelabrasil.callix.com.br");
|
|
55208
55203
|
localStorage.setItem(STORAGE_KEYS.TIMESTAMP, Date.now().toString());
|
|
@@ -55222,14 +55217,16 @@ function DialerWrapper({ options }) {
|
|
|
55222
55217
|
}
|
|
55223
55218
|
};
|
|
55224
55219
|
const handleLogout = () => {
|
|
55220
|
+
const currentUsername = username;
|
|
55225
55221
|
setUsername(null);
|
|
55226
55222
|
setIsAuthenticated(false);
|
|
55227
55223
|
setSessionToken(null);
|
|
55228
55224
|
setCallixDomain(null);
|
|
55229
55225
|
setError(null);
|
|
55230
|
-
if (typeof window !== "undefined") {
|
|
55226
|
+
if (typeof window !== "undefined" && currentUsername) {
|
|
55231
55227
|
try {
|
|
55232
|
-
|
|
55228
|
+
const STORAGE_KEYS = getStorageKeys(currentUsername);
|
|
55229
|
+
localStorage.removeItem(LAST_USERNAME_KEY);
|
|
55233
55230
|
localStorage.removeItem(STORAGE_KEYS.SESSION_TOKEN);
|
|
55234
55231
|
localStorage.removeItem(STORAGE_KEYS.DOMAIN);
|
|
55235
55232
|
localStorage.removeItem(STORAGE_KEYS.TIMESTAMP);
|