callix-dialer-widget 1.1.4 → 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 = 720;
53048
- const MAX_DIALER_HEIGHT = 900;
53049
- const MIN_DIALER_SCALE = 0.7;
53050
- const MAX_DIALER_SCALE = 1.25;
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 scaledWrapperStyle = {
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
- flex: 1,
53435
- display: "flex",
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.jsx("div", { className: tw`flex flex-1 flex-col overflow-hidden`, style: scaledWrapperStyle, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: tw`flex flex-1 flex-col rounded-3xl overflow-hidden`, style: cardContentStyle, children: [
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 sm:px-5 sm:py-4 text-white shadow-sm`,
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 sm:h-11 sm:w-11`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FiPhoneCall, { className: tw`text-xl` }) }),
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-sm font-semibold sm:text-base`, children: username ?? "Visitante" })
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 sm:p-4`, children: dialerContent })
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 sm:space-y-4 rounded-2xl outline-none`,
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-2.5 shadow-sm sm:p-3`, children: [
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-xs font-semibold text-slate-800 sm:text-sm`, children: [
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-1.5 sm:gap-2`, children: [
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-7 w-7 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 transition hover:border-primary/60 hover:text-primary sm:h-8 sm:w-8`,
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-[9rem] cursor-pointer appearance-none rounded-full bg-slate-200 accent-primary sm:max-w-none sm:w-32`,
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-7 w-7 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 transition hover:border-primary/60 hover:text-primary sm:h-8 sm:w-8`,
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-[11px] text-slate-600 sm:text-xs`, children: [
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-[8rem] sm:max-w-none`, children: inputDeviceLabel })
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-[8rem] sm:max-w-none`, children: outputDeviceLabel })
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 sm:grid-cols-2`, children: [
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-[11px] shadow-inner focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/40 sm:text-xs`,
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-[11px] shadow-inner focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/40 sm:text-xs`,
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,10 +55055,13 @@ 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
  }
55062
+ .callix-inline-wrapper [data-floating-dialer-card] .overflow-y-auto {
55063
+ max-height: none !important;
55064
+ }
55070
55065
  .callix-inline-wrapper [data-floating-dialer-resize] {
55071
55066
  display: none !important;
55072
55067
  }
@@ -55122,6 +55117,12 @@ class CallixDialerWidget {
55122
55117
  }
55123
55118
  }
55124
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";
55125
55126
  const SESSION_EXPIRATION_MS = 8 * 60 * 60 * 1e3;
55126
55127
  function DialerWrapper({ options }) {
55127
55128
  const [username, setUsername] = useState(null);
@@ -55137,22 +55138,27 @@ function DialerWrapper({ options }) {
55137
55138
  return;
55138
55139
  }
55139
55140
  try {
55140
- const storedUsername = localStorage.getItem(STORAGE_KEYS.USERNAME);
55141
+ const storedLastUsername = localStorage.getItem(LAST_USERNAME_KEY);
55142
+ if (!storedLastUsername) {
55143
+ setIsRestoringSession(false);
55144
+ return;
55145
+ }
55146
+ const STORAGE_KEYS = getStorageKeys(storedLastUsername);
55141
55147
  const storedToken = localStorage.getItem(STORAGE_KEYS.SESSION_TOKEN);
55142
55148
  const storedDomain = localStorage.getItem(STORAGE_KEYS.DOMAIN);
55143
55149
  const storedTimestamp = localStorage.getItem(STORAGE_KEYS.TIMESTAMP);
55144
- if (storedUsername && storedToken && storedDomain && storedTimestamp) {
55150
+ if (storedLastUsername && storedToken && storedDomain && storedTimestamp) {
55145
55151
  const timestamp = parseInt(storedTimestamp, 10);
55146
55152
  const now = Date.now();
55147
55153
  if (now - timestamp < SESSION_EXPIRATION_MS) {
55148
- console.log("[Callix Dialer] Restaurando sessão salva:", storedUsername);
55149
- setUsername(storedUsername);
55154
+ console.log("[Callix Dialer] Restaurando sessão salva:", storedLastUsername);
55155
+ setUsername(storedLastUsername);
55150
55156
  setSessionToken(storedToken);
55151
55157
  setCallixDomain(storedDomain);
55152
55158
  setIsAuthenticated(true);
55153
55159
  } else {
55154
55160
  console.log("[Callix Dialer] Sessão expirada, limpando...");
55155
- localStorage.removeItem(STORAGE_KEYS.USERNAME);
55161
+ localStorage.removeItem(LAST_USERNAME_KEY);
55156
55162
  localStorage.removeItem(STORAGE_KEYS.SESSION_TOKEN);
55157
55163
  localStorage.removeItem(STORAGE_KEYS.DOMAIN);
55158
55164
  localStorage.removeItem(STORAGE_KEYS.TIMESTAMP);
@@ -55190,7 +55196,8 @@ function DialerWrapper({ options }) {
55190
55196
  setError(null);
55191
55197
  if (typeof window !== "undefined") {
55192
55198
  try {
55193
- localStorage.setItem(STORAGE_KEYS.USERNAME, user);
55199
+ const STORAGE_KEYS = getStorageKeys(user);
55200
+ localStorage.setItem(LAST_USERNAME_KEY, user);
55194
55201
  localStorage.setItem(STORAGE_KEYS.SESSION_TOKEN, data.userSessionToken);
55195
55202
  localStorage.setItem(STORAGE_KEYS.DOMAIN, data.domain || "villelabrasil.callix.com.br");
55196
55203
  localStorage.setItem(STORAGE_KEYS.TIMESTAMP, Date.now().toString());
@@ -55210,14 +55217,16 @@ function DialerWrapper({ options }) {
55210
55217
  }
55211
55218
  };
55212
55219
  const handleLogout = () => {
55220
+ const currentUsername = username;
55213
55221
  setUsername(null);
55214
55222
  setIsAuthenticated(false);
55215
55223
  setSessionToken(null);
55216
55224
  setCallixDomain(null);
55217
55225
  setError(null);
55218
- if (typeof window !== "undefined") {
55226
+ if (typeof window !== "undefined" && currentUsername) {
55219
55227
  try {
55220
- localStorage.removeItem(STORAGE_KEYS.USERNAME);
55228
+ const STORAGE_KEYS = getStorageKeys(currentUsername);
55229
+ localStorage.removeItem(LAST_USERNAME_KEY);
55221
55230
  localStorage.removeItem(STORAGE_KEYS.SESSION_TOKEN);
55222
55231
  localStorage.removeItem(STORAGE_KEYS.DOMAIN);
55223
55232
  localStorage.removeItem(STORAGE_KEYS.TIMESTAMP);