ahs-cti 1.0.1-beta.76 → 1.0.1-beta.77

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.
@@ -30234,17 +30234,20 @@ var managementDashboard_exports = {};
30234
30234
  __export(managementDashboard_exports, {
30235
30235
  default: () => managementDashboard_default
30236
30236
  });
30237
- function DirectionCard({ title, data, icon }) {
30237
+ function DirectionCard({ title, data, icon, droppedLabel }) {
30238
+ var _a2, _b, _c, _d, _e, _f, _g;
30239
+ const dropped = (_b = (_a2 = data.abandoned) != null ? _a2 : data.unanswered) != null ? _b : 0;
30240
+ const droppedPct = (_d = (_c = data.abandoned_pct) != null ? _c : data.unanswered_pct) != null ? _d : 0;
30238
30241
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Paper, { sx: cardPaper, children: [
30239
30242
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: cardHeader, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: labelSx2, children: title }) }),
30240
30243
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { p: 1.5 }, children: [
30241
30244
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", gap: 1, mb: 1.2 }, children: [
30242
30245
  icon,
30243
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontFamily: "'Barlow Condensed', sans-serif", fontSize: 32, fontWeight: 800, color: C6.navy, lineHeight: 1 }, children: data.total.toLocaleString() })
30246
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: bigNumSx, children: ((_e = data.total) != null ? _e : 0).toLocaleString() })
30244
30247
  ] }),
30245
30248
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr", borderTop: `2px solid ${C6.s3}`, pt: 1 }, children: [
30246
- { label: "ANSWERED", value: data.answered, pct: data.answered_pct },
30247
- { label: "UNANSWERED", value: data.unanswered, pct: data.unanswered_pct }
30249
+ { label: "ANSWERED", value: (_f = data.answered) != null ? _f : 0, pct: (_g = data.answered_pct) != null ? _g : 0 },
30250
+ { label: droppedLabel, value: dropped, pct: droppedPct }
30248
30251
  ].map(({ label, value, pct }, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: __spreadValues({ textAlign: "center" }, idx === 0 && { borderRight: `1px solid ${C6.b1}` }), children: [
30249
30252
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontSize: 10, fontWeight: 700, letterSpacing: 0.5, color: C6.t3, mb: 0.3 }, children: label }),
30250
30253
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { display: "flex", alignItems: "baseline", justifyContent: "center", gap: 0.5 }, children: [
@@ -30286,8 +30289,8 @@ function AbandonedCallbackCard({ data }) {
30286
30289
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Paper, { sx: cardPaper, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr" }, children: [
30287
30290
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: __spreadProps(__spreadValues({}, cardHeader), { borderRight: `1px solid ${C6.b1}` }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: labelSx2, children: "Abandoned" }) }),
30288
30291
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: cardHeader, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: labelSx2, children: "Avg Callback Duration" }) }),
30289
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: __spreadProps(__spreadValues({}, numCellSx), { borderRight: `1px solid ${C6.b1}` }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontFamily: "'Barlow Condensed', sans-serif", fontSize: 30, fontWeight: 800, color: C6.navy, lineHeight: 1 }, children: data.total.toLocaleString() }) }),
30290
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: numCellSx, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontFamily: "'JetBrains Mono', monospace", fontSize: 24, fontWeight: 700, color: C6.navy, letterSpacing: 1 }, children: data.avg_callback_duration }) }),
30292
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: __spreadProps(__spreadValues({}, numCellSx), { borderRight: `1px solid ${C6.b1}` }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: bigNumSx, children: data.total.toLocaleString() }) }),
30293
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: numCellSx, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontFamily: "'JetBrains Mono', monospace", fontSize: { xs: 24, lg: 19, xl: 24 }, fontWeight: 700, color: C6.navy, letterSpacing: 1 }, children: data.avg_callback_duration }) }),
30291
30294
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: __spreadProps(__spreadValues({}, subCellSx), { borderRight: `1px solid ${C6.b1}` }), children: [
30292
30295
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: subLabelSx, children: "Called Back" }),
30293
30296
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: subRowSx, children: [
@@ -30312,6 +30315,70 @@ function AbandonedCallbackCard({ data }) {
30312
30315
  ] })
30313
30316
  ] }) });
30314
30317
  }
30318
+ function IvrAbandonedCard({ data }) {
30319
+ const gridCellSx = { p: 1, textAlign: "center", borderTop: `1px solid ${C6.b1}` };
30320
+ const gridLabelSx = { fontSize: 10, fontWeight: 600, color: C6.t3, mb: 0.3, lineHeight: 1.2 };
30321
+ const splitSx = { display: "flex", alignItems: "baseline", justifyContent: "center", gap: 0.5 };
30322
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Paper, { sx: cardPaper, children: [
30323
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: cardHeader, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: labelSx2, children: "IVR Abandoned" }) }),
30324
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: { py: 1.1, px: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", gap: 1 }, children: [
30325
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_PhoneMissed.default, { sx: numIconSx }),
30326
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: bigNumSx, children: data.total.toLocaleString() })
30327
+ ] }) }),
30328
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: { display: "grid", gridTemplateColumns: "1fr 1fr" }, children: [
30329
+ { label: "Called Back", value: data.called_back, pct: data.called_back_pct },
30330
+ { label: "To be Called Back", value: data.to_call, pct: data.to_call_pct }
30331
+ ].map(({ label, value, pct }, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: __spreadValues(__spreadValues({}, gridCellSx), idx === 0 && { borderRight: `1px solid ${C6.b1}` }), children: [
30332
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: gridLabelSx, children: label }),
30333
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: splitSx, children: [
30334
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontSize: 15, fontWeight: 700, color: C6.blue }, children: value.toLocaleString() }),
30335
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontSize: 11, color: C6.t3 }, children: "|" }),
30336
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Typography, { sx: { fontSize: 12, fontWeight: 600, color: C6.blue }, children: [
30337
+ pct.toFixed(1),
30338
+ "%"
30339
+ ] })
30340
+ ] })
30341
+ ] }, label)) })
30342
+ ] });
30343
+ }
30344
+ function HourlyTooltip({ active, payload }) {
30345
+ if (!active || !(payload == null ? void 0 : payload.length)) return null;
30346
+ const row = payload[0].payload;
30347
+ const calls = Number(row.answered) + Number(row.abandoned);
30348
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: {
30349
+ background: C6.surface,
30350
+ border: `1px solid ${C6.b2}`,
30351
+ borderRadius: "8px",
30352
+ boxShadow: "0 6px 18px rgba(20,80,91,.18)",
30353
+ px: 1.25,
30354
+ py: 1,
30355
+ minWidth: 168,
30356
+ pointerEvents: "none"
30357
+ }, children: [
30358
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: { mb: 0.75, pb: 0.6, borderBottom: `1px solid ${C6.b1}` }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Typography, { sx: __spreadProps(__spreadValues({}, monoSx2), { fontSize: 12, color: C6.navy }), children: [
30359
+ row.hour,
30360
+ ":00 \u2013 ",
30361
+ row.hour,
30362
+ ":59"
30363
+ ] }) }),
30364
+ HOURLY_SERIES.map(({ key, label, color, line }) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { display: "flex", alignItems: "center", gap: 0.9, mb: 0.4 }, children: [
30365
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Box, { sx: { width: 10, height: line ? 3 : 10, borderRadius: "2px", background: color, flexShrink: 0 } }),
30366
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontSize: 11, color: C6.t2, flex: 1 }, children: label }),
30367
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontSize: 12, fontWeight: 700, color: C6.t1, fontVariantNumeric: "tabular-nums" }, children: row[key] })
30368
+ ] }, key)),
30369
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "baseline", mt: 0.7, pt: 0.6, borderTop: `1px solid ${C6.b1}` }, children: [
30370
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontSize: 11, color: C6.t3 }, children: "Total calls" }),
30371
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { display: "flex", alignItems: "baseline", gap: 0.5 }, children: [
30372
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material27.Typography, { sx: { fontSize: 13, fontWeight: 700, color: C6.blue, fontVariantNumeric: "tabular-nums" }, children: calls }),
30373
+ calls > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Typography, { sx: { fontSize: 10, color: C6.t3 }, children: [
30374
+ "\xB7 ",
30375
+ (Number(row.answered) / calls * 100).toFixed(0),
30376
+ "% answered"
30377
+ ] })
30378
+ ] })
30379
+ ] })
30380
+ ] });
30381
+ }
30315
30382
  function statusColor(status) {
30316
30383
  const s2 = status == null ? void 0 : status.toUpperCase();
30317
30384
  if (s2 === "ANSWERED") return C6.green;
@@ -30412,8 +30479,11 @@ function ManagementDashboardContent() {
30412
30479
  startIcon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_FileDownload5.default, { sx: { fontSize: "0.95rem !important" } }),
30413
30480
  disabled: loading || data.totals.total_calls === 0,
30414
30481
  onClick: () => {
30415
- const rows = data.repeated_calls.map((r) => Object.values(r).join(","));
30416
- const csv = ["Phone,Date,Count,Status,Type,Comments", ...rows].join("\n");
30482
+ const esc = (v) => `"${String(v != null ? v : "").replace(/"/g, '""')}"`;
30483
+ const rows = data.repeated_calls.map(
30484
+ (r) => [r.phone_number, r.date, r.call_count, r.latest_status, r.latest_call_type].map(esc).join(",")
30485
+ );
30486
+ const csv = ["Phone,Date,Count,Status,Type", ...rows].join("\n");
30417
30487
  const a = document.createElement("a");
30418
30488
  a.href = URL.createObjectURL(new Blob([csv], { type: "text/csv" }));
30419
30489
  a.download = `mgmt_dashboard_${startDate == null ? void 0 : startDate.format("YYYY-MM-DD")}.csv`;
@@ -30442,14 +30512,23 @@ function ManagementDashboardContent() {
30442
30512
  !loading && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: { px: { xs: 1, md: 2 }, py: 1.5 }, children: [
30443
30513
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: {
30444
30514
  display: "grid",
30445
- gridTemplateColumns: { xs: "1fr", sm: "repeat(2, 1fr)", md: "repeat(3, 1fr)", lg: "1.3fr 1.2fr 1.9fr 1.3fr" },
30515
+ gridTemplateColumns: {
30516
+ xs: "1fr",
30517
+ sm: "repeat(2, 1fr)",
30518
+ md: "repeat(3, 1fr)",
30519
+ lg: "1.1fr 1fr 1.6fr 1.1fr 1.2fr"
30520
+ },
30446
30521
  gap: 1.2,
30447
- mb: 1.2
30522
+ mb: 1.2,
30523
+ alignItems: "stretch",
30524
+ /* the wide Abandoned card gets a full row of its own while stacked 2-up */
30525
+ "& > :nth-of-type(3)": { gridColumn: { xs: "auto", sm: "span 2", md: "auto" } }
30448
30526
  }, children: [
30449
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DirectionCard, { title: "Inbound Calls", data: data.inbound, icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_PhoneCallback.default, { sx: numIconSx }) }),
30527
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DirectionCard, { title: "Inbound Calls", data: data.inbound, icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_PhoneCallback.default, { sx: numIconSx }), droppedLabel: "ABANDONED" }),
30450
30528
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(QueueCallsCard, { data: data.queue_calls }),
30451
30529
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AbandonedCallbackCard, { data: data.abandoned }),
30452
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DirectionCard, { title: "Outbound Calls", data: data.outbound, icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_PhoneForwarded.default, { sx: numIconSx }) })
30530
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DirectionCard, { title: "Outbound Calls", data: data.outbound, icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_PhoneForwarded.default, { sx: numIconSx }), droppedLabel: "UNANSWERED" }),
30531
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IvrAbandonedCard, { data: data.ivr })
30453
30532
  ] }),
30454
30533
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material27.Box, { sx: {
30455
30534
  display: "grid",
@@ -30557,11 +30636,10 @@ function ManagementDashboardContent() {
30557
30636
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
30558
30637
  import_recharts2.Tooltip,
30559
30638
  {
30560
- contentStyle: { fontSize: 11, borderRadius: 6, border: `1px solid ${C6.b2}` },
30561
- formatter: (v, n) => {
30562
- const s2 = String(n != null ? n : "");
30563
- return [v, s2.charAt(0).toUpperCase() + s2.slice(1)];
30564
- }
30639
+ content: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(HourlyTooltip, {}),
30640
+ cursor: { fill: "rgba(26,95,108,.07)" },
30641
+ animationDuration: 140,
30642
+ wrapperStyle: { outline: "none", zIndex: 2 }
30565
30643
  }
30566
30644
  ),
30567
30645
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_recharts2.Bar, { yAxisId: "left", dataKey: "answered", fill: "#F2B51D", radius: [2, 2, 0, 0], maxBarSize: 14 }),
@@ -30610,7 +30688,7 @@ function ManagementDashboardContent() {
30610
30688
  ] })
30611
30689
  ] }) });
30612
30690
  }
30613
- var import_react35, import_material27, import_dayjs9, import_LocalizationProvider6, import_AdapterDayjs6, import_recharts2, import_Search6, import_FileDownload5, import_Refresh7, import_PhoneCallback, import_PhoneForwarded, import_jsx_runtime30, C6, headSx, cellSx, monoSx2, labelSx2, cardPaper, cardHeader, numIconSx, EMPTY, ManagementDashboard, managementDashboard_default;
30691
+ var import_react35, import_material27, import_dayjs9, import_LocalizationProvider6, import_AdapterDayjs6, import_recharts2, import_Search6, import_FileDownload5, import_Refresh7, import_PhoneCallback, import_PhoneForwarded, import_PhoneMissed, import_jsx_runtime30, C6, headSx, cellSx, monoSx2, labelSx2, cardPaper, cardHeader, numIconSx, bigNumSx, EMPTY, HOURLY_SERIES, ManagementDashboard, managementDashboard_default;
30614
30692
  var init_managementDashboard = __esm({
30615
30693
  "call-control-sdk/lib/pages/managementDashboard/index.tsx"() {
30616
30694
  "use strict";
@@ -30625,6 +30703,7 @@ var init_managementDashboard = __esm({
30625
30703
  import_Refresh7 = __toESM(require("@mui/icons-material/Refresh"));
30626
30704
  import_PhoneCallback = __toESM(require("@mui/icons-material/PhoneCallback"));
30627
30705
  import_PhoneForwarded = __toESM(require("@mui/icons-material/PhoneForwarded"));
30706
+ import_PhoneMissed = __toESM(require("@mui/icons-material/PhoneMissed"));
30628
30707
  init_PageHeader();
30629
30708
  init_ReportFilterBar();
30630
30709
  init_AppButton();
@@ -30656,10 +30735,11 @@ var init_managementDashboard = __esm({
30656
30735
  headSx = __spreadProps(__spreadValues({}, headCellSx2), { py: 1, px: 1.5 });
30657
30736
  cellSx = { fontSize: 12, py: 0.8, px: 1.5, borderBottom: `1px solid ${C6.b1}` };
30658
30737
  monoSx2 = { fontFamily: "'JetBrains Mono', monospace", fontSize: 12, fontWeight: 700 };
30659
- labelSx2 = { fontSize: 11, fontWeight: 700, letterSpacing: 0.7, textTransform: "uppercase", color: C6.t2 };
30738
+ labelSx2 = { fontSize: 11, fontWeight: 700, letterSpacing: 0.7, textTransform: "uppercase", color: C6.t2, textAlign: "center", lineHeight: 1.2 };
30660
30739
  cardPaper = { background: C6.surface, border: `1px solid #dce3ef`, borderRadius: "6px", overflow: "hidden", boxShadow: "0 1px 4px rgba(0,0,0,.09)" };
30661
- cardHeader = { px: 1.5, py: 1, background: C6.s2, borderBottom: `1px solid ${C6.b1}`, display: "flex", alignItems: "center", justifyContent: "center" };
30662
- numIconSx = { fontSize: 28, color: C6.blue };
30740
+ cardHeader = { px: 1.5, py: 1, minHeight: 36, background: C6.s2, borderBottom: `1px solid ${C6.b1}`, display: "flex", alignItems: "center", justifyContent: "center" };
30741
+ numIconSx = { fontSize: { xs: 28, lg: 24, xl: 28 }, color: C6.blue };
30742
+ bigNumSx = { fontFamily: "'Barlow Condensed', sans-serif", fontSize: { xs: 32, lg: 26, xl: 32 }, fontWeight: 800, color: C6.navy, lineHeight: 1 };
30663
30743
  EMPTY = {
30664
30744
  inbound: { total: 0, answered: 0, unanswered: 0, answered_pct: 0, unanswered_pct: 0 },
30665
30745
  outbound: { total: 0, answered: 0, unanswered: 0, answered_pct: 0, unanswered_pct: 0 },
@@ -30672,6 +30752,11 @@ var init_managementDashboard = __esm({
30672
30752
  hourly_chart: [],
30673
30753
  repeated_calls: []
30674
30754
  };
30755
+ HOURLY_SERIES = [
30756
+ { key: "answered", label: "Answered", color: "#F2B51D", line: false },
30757
+ { key: "abandoned", label: "Abandoned", color: "#9fc4cb", line: false },
30758
+ { key: "agents", label: "Agents", color: "#14505b", line: true }
30759
+ ];
30675
30760
  ManagementDashboard = () => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SDKProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ManagementDashboardContent, {}) });
30676
30761
  managementDashboard_default = ManagementDashboard;
30677
30762
  }