ahs-cti 0.0.35 → 0.0.37

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.
Files changed (87) hide show
  1. package/dist/{agentDetailReport-BYGYSA33.mjs → agentDetailReport-237EX6RU.mjs} +3 -3
  2. package/dist/{agentPerformanceReport-Y5YYKSWG.mjs → agentPerformanceReport-YC5FISYA.mjs} +5 -5
  3. package/dist/{auditReport-C4WFAP3L.mjs → auditReport-AXM3UDVY.mjs} +3 -3
  4. package/dist/{callHistory-6YAMF7QO.mjs → callHistory-L5Y3RIOZ.mjs} +2 -2
  5. package/dist/{campaigns-65A75UG5.mjs → campaigns-HLUCEESZ.mjs} +6 -6
  6. package/dist/{cdrReport-KHIUZEDV.mjs → cdrReport-LDKZ4C5W.mjs} +6 -6
  7. package/dist/{chunk-QQWALIZA.mjs → chunk-35EFKRSJ.mjs} +2 -2
  8. package/dist/{chunk-PUNELTD5.mjs → chunk-B76VHVV3.mjs} +2 -2
  9. package/dist/{chunk-CBEMLYOM.mjs → chunk-BKUTHWV7.mjs} +2 -2
  10. package/dist/{chunk-TT6SICS2.mjs → chunk-E552PJN7.mjs} +2 -2
  11. package/dist/{chunk-2AXMZZAY.mjs → chunk-FO6G3FID.mjs} +6 -2
  12. package/{dist-react/chunk-IVWVTBHM.mjs.map → dist/chunk-FO6G3FID.mjs.map} +1 -1
  13. package/dist/{chunk-WL4HBALM.mjs → chunk-M4YVMYCX.mjs} +2 -2
  14. package/dist/{chunk-AJWEGY5E.mjs → chunk-O7GXLWRQ.mjs} +2 -2
  15. package/dist/{chunk-JNXXK4LS.mjs → chunk-RLCMDPZJ.mjs} +2 -2
  16. package/dist/{chunk-JM7LCPTI.mjs → chunk-SYGGG4NF.mjs} +2 -2
  17. package/dist/index.js +491 -287
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +487 -254
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/{leadIntegrations-E5ECRGCW.mjs → leadIntegrations-6WBRGXZH.mjs} +15 -48
  22. package/dist/leadIntegrations-6WBRGXZH.mjs.map +1 -0
  23. package/dist/{liveStatus-MLIDJGJ2.mjs → liveStatus-TUGLMCT3.mjs} +4 -4
  24. package/dist/{loginReport-7NPPKMNK.mjs → loginReport-7RHXDB2M.mjs} +4 -4
  25. package/dist/{managementDashboard-RAHEBYB5.mjs → managementDashboard-CIIHP7ET.mjs} +3 -3
  26. package/dist-react/{agentDetailReport-DFRSOEVZ.mjs → agentDetailReport-Q2FSBCYY.mjs} +3 -3
  27. package/dist-react/{agentPerformanceReport-ZWJNU7JX.mjs → agentPerformanceReport-S74XCLJY.mjs} +5 -5
  28. package/dist-react/{auditReport-XYKDEO4D.mjs → auditReport-HSO7MDZI.mjs} +3 -3
  29. package/dist-react/{callHistory-JJZMVID5.mjs → callHistory-FGZXPFCO.mjs} +2 -2
  30. package/dist-react/{campaigns-DPTUOXLO.mjs → campaigns-EFUWKCJR.mjs} +6 -6
  31. package/dist-react/{cdrReport-DPSZI6JP.mjs → cdrReport-ALE6CRSN.mjs} +6 -6
  32. package/dist-react/{chunk-IVWVTBHM.mjs → chunk-BU3SA5MK.mjs} +6 -2
  33. package/{dist/chunk-2AXMZZAY.mjs.map → dist-react/chunk-BU3SA5MK.mjs.map} +1 -1
  34. package/dist-react/{chunk-FZJ6XJ2L.mjs → chunk-BWTRNMSY.mjs} +2 -2
  35. package/dist-react/{chunk-YDI4675U.mjs → chunk-D2ZGON5Q.mjs} +2 -2
  36. package/dist-react/{chunk-7GV5PSYT.mjs → chunk-DSJ6MU32.mjs} +2 -2
  37. package/dist-react/{chunk-KGHC54RU.mjs → chunk-K753FJWM.mjs} +2 -2
  38. package/dist-react/{chunk-CJBSOTXC.mjs → chunk-MSBV3FVM.mjs} +2 -2
  39. package/dist-react/{chunk-JEI4KQEF.mjs → chunk-V4YFGJYD.mjs} +2 -2
  40. package/dist-react/{chunk-FFGFKWIY.mjs → chunk-VBYKJMDH.mjs} +2 -2
  41. package/dist-react/{chunk-F4MYU2U4.mjs → chunk-ZZWFK6UN.mjs} +2 -2
  42. package/dist-react/index.js +487 -283
  43. package/dist-react/index.js.map +1 -1
  44. package/dist-react/index.mjs +487 -254
  45. package/dist-react/index.mjs.map +1 -1
  46. package/dist-react/{leadIntegrations-5PHHYP6P.mjs → leadIntegrations-O2SFF566.mjs} +15 -48
  47. package/dist-react/leadIntegrations-O2SFF566.mjs.map +1 -0
  48. package/dist-react/{liveStatus-GGCOZECH.mjs → liveStatus-GE4LXGBR.mjs} +4 -4
  49. package/dist-react/{loginReport-SXQMA2AZ.mjs → loginReport-BA7TURDS.mjs} +4 -4
  50. package/dist-react/{managementDashboard-DUMWSZ4H.mjs → managementDashboard-AMEYHYMZ.mjs} +3 -3
  51. package/package.json +1 -1
  52. package/dist/leadIntegrations-E5ECRGCW.mjs.map +0 -1
  53. package/dist-react/leadIntegrations-5PHHYP6P.mjs.map +0 -1
  54. /package/dist/{agentDetailReport-BYGYSA33.mjs.map → agentDetailReport-237EX6RU.mjs.map} +0 -0
  55. /package/dist/{agentPerformanceReport-Y5YYKSWG.mjs.map → agentPerformanceReport-YC5FISYA.mjs.map} +0 -0
  56. /package/dist/{auditReport-C4WFAP3L.mjs.map → auditReport-AXM3UDVY.mjs.map} +0 -0
  57. /package/dist/{callHistory-6YAMF7QO.mjs.map → callHistory-L5Y3RIOZ.mjs.map} +0 -0
  58. /package/dist/{campaigns-65A75UG5.mjs.map → campaigns-HLUCEESZ.mjs.map} +0 -0
  59. /package/dist/{cdrReport-KHIUZEDV.mjs.map → cdrReport-LDKZ4C5W.mjs.map} +0 -0
  60. /package/dist/{chunk-QQWALIZA.mjs.map → chunk-35EFKRSJ.mjs.map} +0 -0
  61. /package/dist/{chunk-PUNELTD5.mjs.map → chunk-B76VHVV3.mjs.map} +0 -0
  62. /package/dist/{chunk-CBEMLYOM.mjs.map → chunk-BKUTHWV7.mjs.map} +0 -0
  63. /package/dist/{chunk-TT6SICS2.mjs.map → chunk-E552PJN7.mjs.map} +0 -0
  64. /package/dist/{chunk-WL4HBALM.mjs.map → chunk-M4YVMYCX.mjs.map} +0 -0
  65. /package/dist/{chunk-AJWEGY5E.mjs.map → chunk-O7GXLWRQ.mjs.map} +0 -0
  66. /package/dist/{chunk-JNXXK4LS.mjs.map → chunk-RLCMDPZJ.mjs.map} +0 -0
  67. /package/dist/{chunk-JM7LCPTI.mjs.map → chunk-SYGGG4NF.mjs.map} +0 -0
  68. /package/dist/{liveStatus-MLIDJGJ2.mjs.map → liveStatus-TUGLMCT3.mjs.map} +0 -0
  69. /package/dist/{loginReport-7NPPKMNK.mjs.map → loginReport-7RHXDB2M.mjs.map} +0 -0
  70. /package/dist/{managementDashboard-RAHEBYB5.mjs.map → managementDashboard-CIIHP7ET.mjs.map} +0 -0
  71. /package/dist-react/{agentDetailReport-DFRSOEVZ.mjs.map → agentDetailReport-Q2FSBCYY.mjs.map} +0 -0
  72. /package/dist-react/{agentPerformanceReport-ZWJNU7JX.mjs.map → agentPerformanceReport-S74XCLJY.mjs.map} +0 -0
  73. /package/dist-react/{auditReport-XYKDEO4D.mjs.map → auditReport-HSO7MDZI.mjs.map} +0 -0
  74. /package/dist-react/{callHistory-JJZMVID5.mjs.map → callHistory-FGZXPFCO.mjs.map} +0 -0
  75. /package/dist-react/{campaigns-DPTUOXLO.mjs.map → campaigns-EFUWKCJR.mjs.map} +0 -0
  76. /package/dist-react/{cdrReport-DPSZI6JP.mjs.map → cdrReport-ALE6CRSN.mjs.map} +0 -0
  77. /package/dist-react/{chunk-FZJ6XJ2L.mjs.map → chunk-BWTRNMSY.mjs.map} +0 -0
  78. /package/dist-react/{chunk-YDI4675U.mjs.map → chunk-D2ZGON5Q.mjs.map} +0 -0
  79. /package/dist-react/{chunk-7GV5PSYT.mjs.map → chunk-DSJ6MU32.mjs.map} +0 -0
  80. /package/dist-react/{chunk-KGHC54RU.mjs.map → chunk-K753FJWM.mjs.map} +0 -0
  81. /package/dist-react/{chunk-CJBSOTXC.mjs.map → chunk-MSBV3FVM.mjs.map} +0 -0
  82. /package/dist-react/{chunk-JEI4KQEF.mjs.map → chunk-V4YFGJYD.mjs.map} +0 -0
  83. /package/dist-react/{chunk-FFGFKWIY.mjs.map → chunk-VBYKJMDH.mjs.map} +0 -0
  84. /package/dist-react/{chunk-F4MYU2U4.mjs.map → chunk-ZZWFK6UN.mjs.map} +0 -0
  85. /package/dist-react/{liveStatus-GGCOZECH.mjs.map → liveStatus-GE4LXGBR.mjs.map} +0 -0
  86. /package/dist-react/{loginReport-SXQMA2AZ.mjs.map → loginReport-BA7TURDS.mjs.map} +0 -0
  87. /package/dist-react/{managementDashboard-DUMWSZ4H.mjs.map → managementDashboard-AMEYHYMZ.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -7694,6 +7694,11 @@ var init_endPoint = __esm({
7694
7694
  get DISPOSITIONS() {
7695
7695
  return `${getBaseURL()}${VERSION.v1}/cti/calls/dispositions`;
7696
7696
  },
7697
+ // Master disposition list, used as the hierarchy/notes-flag source when the CTI
7698
+ // list above comes back flat (no parent links) — same fallback the browser phone uses.
7699
+ get AGENT_SELECTABLE_DISPOSITIONS() {
7700
+ return `${getBaseURL()}${VERSION.v1}/master/disposition/agent-selectable`;
7701
+ },
7697
7702
  get HOSPITALS_SERVICES() {
7698
7703
  return `${getBaseURL()}${VERSION.v1}/cti/hospital/services`;
7699
7704
  },
@@ -7757,7 +7762,6 @@ var init_endPoint = __esm({
7757
7762
  LEAD_INTEGRATION_FORM_MAPPING_BY_ID: (id, mappingId) => `${getBaseURL()}${VERSION.v1}/lead-integrations/${id}/form-mappings/${mappingId}`,
7758
7763
  LEAD_INTEGRATION_AVAILABLE_FORMS: (id) => `${getBaseURL()}${VERSION.v1}/lead-integrations/${id}/available-forms`,
7759
7764
  LEAD_INTEGRATION_LOGS: (id) => `${getBaseURL()}${VERSION.v1}/lead-integrations/${id}/logs`,
7760
- LEAD_INTEGRATION_FACEBOOK_CONNECT_URL: (id) => `${getBaseURL()}${VERSION.v1}/lead-integrations/${id}/facebook/connect-url`,
7761
7765
  // Login Report
7762
7766
  get LOGIN_REPORT() {
7763
7767
  return `${getBaseURL()}${VERSION.v1}/reports/login-report`;
@@ -103697,14 +103701,14 @@ var require_with_selector_development = __commonJS({
103697
103701
  return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
103698
103702
  }
103699
103703
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
103700
- var React302 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is5, useSyncExternalStore2 = shim.useSyncExternalStore, useRef86 = React302.useRef, useEffect85 = React302.useEffect, useMemo76 = React302.useMemo, useDebugValue5 = React302.useDebugValue;
103704
+ var React302 = require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is5, useSyncExternalStore2 = shim.useSyncExternalStore, useRef86 = React302.useRef, useEffect85 = React302.useEffect, useMemo75 = React302.useMemo, useDebugValue5 = React302.useDebugValue;
103701
103705
  exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
103702
103706
  var instRef = useRef86(null);
103703
103707
  if (null === instRef.current) {
103704
103708
  var inst = { hasValue: false, value: null };
103705
103709
  instRef.current = inst;
103706
103710
  } else inst = instRef.current;
103707
- instRef = useMemo76(
103711
+ instRef = useMemo75(
103708
103712
  function() {
103709
103713
  function memoizedSelector(nextSnapshot) {
103710
103714
  if (!hasMemo) {
@@ -109379,14 +109383,14 @@ var require_use_sync_external_store_with_selector_development = __commonJS({
109379
109383
  return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
109380
109384
  }
109381
109385
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
109382
- var React302 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is5, useSyncExternalStore2 = React302.useSyncExternalStore, useRef86 = React302.useRef, useEffect85 = React302.useEffect, useMemo76 = React302.useMemo, useDebugValue5 = React302.useDebugValue;
109386
+ var React302 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is5, useSyncExternalStore2 = React302.useSyncExternalStore, useRef86 = React302.useRef, useEffect85 = React302.useEffect, useMemo75 = React302.useMemo, useDebugValue5 = React302.useDebugValue;
109383
109387
  exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
109384
109388
  var instRef = useRef86(null);
109385
109389
  if (null === instRef.current) {
109386
109390
  var inst = { hasValue: false, value: null };
109387
109391
  instRef.current = inst;
109388
109392
  } else inst = instRef.current;
109389
- instRef = useMemo76(
109393
+ instRef = useMemo75(
109390
109394
  function() {
109391
109395
  function memoizedSelector(nextSnapshot) {
109392
109396
  if (!hasMemo) {
@@ -134961,10 +134965,6 @@ function useLeadIntegrations() {
134961
134965
  const res = await axios_default2.post(END_POINT.LEAD_INTEGRATION_REGENERATE_TOKEN(id));
134962
134966
  return res.data;
134963
134967
  }, []);
134964
- const getFacebookConnectUrl = (0, import_react107.useCallback)(async (id) => {
134965
- const res = await axios_default2.get(END_POINT.LEAD_INTEGRATION_FACEBOOK_CONNECT_URL(id));
134966
- return res.data;
134967
- }, []);
134968
134968
  const getAvailableForms = (0, import_react107.useCallback)(async (integrationId) => {
134969
134969
  const res = await axios_default2.get(END_POINT.LEAD_INTEGRATION_AVAILABLE_FORMS(integrationId));
134970
134970
  return deepFindArray(res.data, ["forms"]);
@@ -135006,7 +135006,6 @@ function useLeadIntegrations() {
135006
135006
  updateIntegration,
135007
135007
  deleteIntegration,
135008
135008
  regenerateWebhookToken,
135009
- getFacebookConnectUrl,
135010
135009
  getAvailableForms,
135011
135010
  createFormMapping,
135012
135011
  updateFormMapping,
@@ -135038,7 +135037,7 @@ function getEffectiveExpiry(integration) {
135038
135037
  }
135039
135038
  function getRenewalInstructions(reasonLabel) {
135040
135039
  if (reasonLabel === "Data access authorization") {
135041
- return "Meta requires the Page admin to re-authorize this app before that date (Meta Business Suite \u2192 Settings \u2192 Integrations, or re-run the app's login/consent flow) to keep the leads_retrieval permission active. After re-authorizing, generate a fresh long-lived Page Access Token and paste it into the Page Access Token field below.";
135040
+ return "Meta requires the Page admin to re-authorize this app before that date (Meta Business Suite \u2192 Settings \u2192 Integrations, or Graph API Explorer) to keep the leads_retrieval permission active. After re-authorizing, generate a fresh long-lived Page Access Token and paste it into the Page Access Token field below.";
135042
135041
  }
135043
135042
  return "Generate a new long-lived Page Access Token from the Facebook App Dashboard (or via the Graph API token exchange) and paste it into the Page Access Token field below before the current one stops working.";
135044
135043
  }
@@ -135093,10 +135092,7 @@ function TokenStatusChip({ integration }) {
135093
135092
  }
135094
135093
  ) });
135095
135094
  }
135096
- function TokenExpiryAlert({
135097
- integration,
135098
- onReconnect
135099
- }) {
135095
+ function TokenExpiryAlert({ integration }) {
135100
135096
  const meta = TOKEN_STATUS_META[integration.tokenExpiryStatus];
135101
135097
  if (!meta || integration.tokenExpiryStatus === "ok") return null;
135102
135098
  const effective = getEffectiveExpiry(integration);
@@ -135106,8 +135102,7 @@ function TokenExpiryAlert({
135106
135102
  effective ? `${effective.label} ${isExpired ? "expired" : "expires"} ${effective.date.toLocaleDateString()} (${effective.date.toLocaleTimeString()})` : isExpired ? "This integration is no longer valid." : "This integration is expiring soon.",
135107
135103
  isExpired ? " \u2014 lead ingestion has stopped." : " \u2014 lead ingestion will stop once this passes."
135108
135104
  ] }),
135109
- /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(Typography_default, { variant: "body2", sx: { mb: 1 }, children: getRenewalInstructions((effective == null ? void 0 : effective.label) || "Access token") }),
135110
- (integration.sourceType === "facebook" || integration.sourceType === "instagram") && /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(SDKButton, { size: "small", variant: "outlined", onClick: () => onReconnect(integration), children: "Reconnect with Facebook" })
135105
+ /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(Typography_default, { variant: "body2", children: getRenewalInstructions((effective == null ? void 0 : effective.label) || "Access token") })
135111
135106
  ] });
135112
135107
  }
135113
135108
  function ModalShell({
@@ -135267,7 +135262,7 @@ function ConfirmDialog2({
135267
135262
  }
135268
135263
  );
135269
135264
  }
135270
- var import_react108, import_jsx_runtime300, INTEGRATION_COLS, CENTER_COLS2, MANAGE_PERMISSIONS, defaultIntegrationForm, defaultMappingForm, errMsg, Required, IntegrationDialog, MappingDialog, LeadIntegrationsContent, LeadIntegrations, leadIntegrations_default;
135265
+ var import_react108, import_jsx_runtime300, INTEGRATION_COLS, CENTER_COLS2, MANAGE_PERMISSIONS, defaultIntegrationForm, defaultMappingForm, errMsg, Required, SELECT_MENU_Z_INDEX, IntegrationDialog, MappingDialog, LeadIntegrationsContent, LeadIntegrations, leadIntegrations_default;
135271
135266
  var init_leadIntegrations = __esm({
135272
135267
  "call-control-sdk/lib/pages/leadIntegrations/index.tsx"() {
135273
135268
  "use strict";
@@ -135337,6 +135332,7 @@ var init_leadIntegrations = __esm({
135337
135332
  return ((_b = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message) || ((_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.detail) || (error == null ? void 0 : error.message) || fallback;
135338
135333
  };
135339
135334
  Required = () => /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("span", { style: { color: "#c0392b" }, children: "*" });
135335
+ SELECT_MENU_Z_INDEX = 1600;
135340
135336
  IntegrationDialog = (0, import_react108.memo)(function IntegrationDialog2({
135341
135337
  open,
135342
135338
  mode,
@@ -135349,8 +135345,7 @@ var init_leadIntegrations = __esm({
135349
135345
  onClose,
135350
135346
  onAddMapping,
135351
135347
  onEditMapping,
135352
- onDeleteMapping,
135353
- onReconnect
135348
+ onDeleteMapping
135354
135349
  }) {
135355
135350
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
135356
135351
  const [tab, setTab] = (0, import_react108.useState)(0);
@@ -135439,6 +135434,7 @@ var init_leadIntegrations = __esm({
135439
135434
  {
135440
135435
  value: formData.sourceType,
135441
135436
  sx: inputSx,
135437
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
135442
135438
  disabled: mode === "edit",
135443
135439
  onChange: (e) => setFormData((prev2) => __spreadProps(__spreadValues({}, prev2), { sourceType: e.target.value })),
135444
135440
  children: SOURCE_TYPE_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(MenuItem_default, { value: opt.value, children: [
@@ -135459,6 +135455,7 @@ var init_leadIntegrations = __esm({
135459
135455
  value: (_b = formData.defaultCampaignId) != null ? _b : "",
135460
135456
  displayEmpty: true,
135461
135457
  sx: inputSx,
135458
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
135462
135459
  onChange: (e) => setFormData((prev2) => __spreadProps(__spreadValues({}, prev2), {
135463
135460
  defaultCampaignId: e.target.value ? Number(e.target.value) : null
135464
135461
  })),
@@ -135498,7 +135495,7 @@ var init_leadIntegrations = __esm({
135498
135495
  tab === 1 && /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(Box_default, { sx: { p: 2.5 }, children: [
135499
135496
  /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(Typography_default, { sx: sectionTitleSx, children: "API Credentials" }),
135500
135497
  /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(Typography_default, { variant: "body2", color: "text.secondary", sx: { mb: 2, fontSize: "0.82rem" }, children: "Enter your platform credentials. These are encrypted and stored securely." }),
135501
- mode === "edit" && editingIntegration && /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(TokenExpiryAlert, { integration: editingIntegration, onReconnect }),
135498
+ mode === "edit" && editingIntegration && /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(TokenExpiryAlert, { integration: editingIntegration }),
135502
135499
  /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(Box_default, { sx: { display: "grid", gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" }, gap: 2 }, children: [
135503
135500
  /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)(Box_default, { children: [
135504
135501
  /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(Typography_default, { sx: labelSx, children: "App ID" }),
@@ -135699,6 +135696,7 @@ var init_leadIntegrations = __esm({
135699
135696
  value: formData.sourceFormId || "",
135700
135697
  displayEmpty: true,
135701
135698
  sx: inputSx,
135699
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
135702
135700
  disabled: mode === "edit",
135703
135701
  renderValue: (selected) => {
135704
135702
  var _a3;
@@ -135747,6 +135745,7 @@ var init_leadIntegrations = __esm({
135747
135745
  value: formData.campaignId || "",
135748
135746
  displayEmpty: true,
135749
135747
  sx: inputSx,
135748
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
135750
135749
  renderValue: (selected) => {
135751
135750
  var _a3;
135752
135751
  return !selected ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("span", { style: { color: "#9e9e9e" }, children: "Select Campaign" }) : ((_a3 = campaigns.find((c2) => c2.id === selected)) == null ? void 0 : _a3.name) || String(selected);
@@ -135851,7 +135850,6 @@ var init_leadIntegrations = __esm({
135851
135850
  updateIntegration,
135852
135851
  deleteIntegration,
135853
135852
  regenerateWebhookToken,
135854
- getFacebookConnectUrl,
135855
135853
  getAvailableForms,
135856
135854
  createFormMapping,
135857
135855
  updateFormMapping,
@@ -135984,32 +135982,6 @@ var init_leadIntegrations = __esm({
135984
135982
  (_a3 = navigator.clipboard) == null ? void 0 : _a3.writeText(url);
135985
135983
  showToast("Webhook URL copied to clipboard", "info");
135986
135984
  };
135987
- const handleReconnectFacebook = async (integration) => {
135988
- try {
135989
- const { authorizeUrl } = await getFacebookConnectUrl(integration.id);
135990
- const popup = window.open(authorizeUrl, "fb-oauth-reconnect", "width=600,height=700");
135991
- if (!popup) {
135992
- showToast("Popup blocked \u2014 allow popups for this site and try again", "warning");
135993
- return;
135994
- }
135995
- const onMessage = (event) => {
135996
- if (!event.data || event.data.type !== "lead-integration-fb-oauth-result") return;
135997
- window.removeEventListener("message", onMessage);
135998
- if (event.data.success) {
135999
- showToast(
136000
- event.data.pageName ? `Reconnected to "${event.data.pageName}"` : "Facebook integration reconnected",
136001
- "success"
136002
- );
136003
- refresh();
136004
- } else {
136005
- showToast(event.data.error || "Facebook reconnect failed", "error");
136006
- }
136007
- };
136008
- window.addEventListener("message", onMessage);
136009
- } catch (error) {
136010
- showToast(errMsg(error, "Failed to start Facebook reconnect"), "error");
136011
- }
136012
- };
136013
135985
  const openMappingDialog = async (integration, mode, mapping) => {
136014
135986
  setSelectedIntegration(integration);
136015
135987
  setMappingMode(mode);
@@ -136268,8 +136240,7 @@ var init_leadIntegrations = __esm({
136268
136240
  onClose: () => setDialogOpen(false),
136269
136241
  onAddMapping: (integration) => openMappingDialog(integration, "add"),
136270
136242
  onEditMapping: (integration, mapping) => openMappingDialog(integration, "edit", mapping),
136271
- onDeleteMapping: (integration, mapping) => setMappingDeleteTarget({ integration, mapping }),
136272
- onReconnect: handleReconnectFacebook
136243
+ onDeleteMapping: (integration, mapping) => setMappingDeleteTarget({ integration, mapping })
136273
136244
  }
136274
136245
  ),
136275
136246
  /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
@@ -138591,9 +138562,105 @@ function CallTransferDialog({ open }) {
138591
138562
  )
138592
138563
  ] });
138593
138564
  }
138594
- function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
138565
+ function dispoLevelLabel(depth) {
138566
+ let prefix3 = "";
138567
+ for (let i = 0; i < depth; i++) prefix3 += "Sub-";
138568
+ return prefix3 + "Disposition";
138569
+ }
138570
+ function dispoField(d2, ...keys) {
138571
+ for (const k3 of keys) {
138572
+ const v = d2 == null ? void 0 : d2[k3];
138573
+ if (v !== void 0 && v !== null && v !== "") return v;
138574
+ }
138575
+ return null;
138576
+ }
138577
+ function normDispo(d2) {
138595
138578
  var _a2, _b, _c, _d, _e;
138596
- const [getDispositions, data] = useGetRequest();
138579
+ const id = dispoField(d2, "id", "disposition_id", "dispositionId");
138580
+ const code = String((_b = (_a2 = dispoField(d2, "code", "disposition_code")) != null ? _a2 : dispoField(d2, "name")) != null ? _b : "");
138581
+ const pid = dispoField(d2, "parentId", "parent_id", "parentDispositionId", "parent_disposition_id");
138582
+ const pcode = dispoField(d2, "parentCode", "parent_code");
138583
+ return {
138584
+ key: id != null ? "#" + id : "c:" + code,
138585
+ parentKey: pid != null ? "#" + pid : pcode ? "c:" + pcode : null,
138586
+ code,
138587
+ name: String((_d = (_c = dispoField(d2, "name")) != null ? _c : code) != null ? _d : ""),
138588
+ sortOrder: Number((_e = dispoField(d2, "sortOrder", "sort_order")) != null ? _e : 0),
138589
+ requiresNotes: !!dispoField(d2, "requiresNotes", "requires_notes"),
138590
+ children: []
138591
+ };
138592
+ }
138593
+ function hasSubDispositions(list) {
138594
+ return list.some((d2) => normDispo(d2).parentKey != null);
138595
+ }
138596
+ function hasNotesFlag(list) {
138597
+ return list.some((r2) => "requiresNotes" in r2 || "requires_notes" in r2);
138598
+ }
138599
+ function buildDispoTree(list) {
138600
+ const nodes = list.map(normDispo);
138601
+ const byKey = {};
138602
+ let roots = [];
138603
+ nodes.forEach((n) => {
138604
+ byKey[n.key] = n;
138605
+ });
138606
+ nodes.forEach((n) => {
138607
+ const parent = n.parentKey ? byKey[n.parentKey] : null;
138608
+ if (parent && parent !== n) parent.children.push(n);
138609
+ else roots.push(n);
138610
+ });
138611
+ if (!roots.length && nodes.length) {
138612
+ nodes.forEach((n) => {
138613
+ n.children = [];
138614
+ });
138615
+ roots = nodes;
138616
+ }
138617
+ const sortLevel = (arr) => {
138618
+ arr.sort((a2, b) => a2.sortOrder - b.sortOrder || a2.name.localeCompare(b.name));
138619
+ arr.forEach((n) => sortLevel(n.children));
138620
+ };
138621
+ sortLevel(roots);
138622
+ return roots;
138623
+ }
138624
+ async function fetchDispoList(url) {
138625
+ try {
138626
+ const res = await axios_default2.get(url);
138627
+ const body = res == null ? void 0 : res.data;
138628
+ const d2 = body && body.data !== void 0 ? body.data : body;
138629
+ return Array.isArray(d2) ? d2 : d2 && Array.isArray(d2.data) ? d2.data : [];
138630
+ } catch (e) {
138631
+ return [];
138632
+ }
138633
+ }
138634
+ async function withNotesFlags(list) {
138635
+ if (!list.length || hasNotesFlag(list)) return list;
138636
+ const master = await fetchDispoList(END_POINT.AGENT_SELECTABLE_DISPOSITIONS);
138637
+ if (!master.length || !hasNotesFlag(master)) return list;
138638
+ const codeOf = (r2) => String(r2.code || r2.name || "").toUpperCase();
138639
+ const flag = {};
138640
+ master.forEach((m) => {
138641
+ const c2 = codeOf(m);
138642
+ if (c2) flag[c2] = !!(m.requiresNotes || m.requires_notes);
138643
+ });
138644
+ return list.map((r2) => {
138645
+ const c2 = codeOf(r2);
138646
+ return Object.prototype.hasOwnProperty.call(flag, c2) ? __spreadProps(__spreadValues({}, r2), { requiresNotes: flag[c2] }) : r2;
138647
+ });
138648
+ }
138649
+ function DispoFieldLabel({ children }) {
138650
+ return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138651
+ Typography_default,
138652
+ {
138653
+ variant: "caption",
138654
+ sx: { display: "block", fontWeight: 600, fontSize: "0.8rem", color: "text.secondary", mb: 0.5 },
138655
+ children
138656
+ }
138657
+ );
138658
+ }
138659
+ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
138660
+ var _a2, _b, _c, _d;
138661
+ const [dispoTree, setDispoTree] = (0, import_react22.useState)([]);
138662
+ const [dispoPath, setDispoPath] = (0, import_react22.useState)([]);
138663
+ const [notesError, setNotesError] = (0, import_react22.useState)(false);
138597
138664
  const [formData, setFormData] = (0, import_react22.useState)({
138598
138665
  disposition: { label: "", value: "", id: 0 },
138599
138666
  followUp: { label: "No", value: "N" },
@@ -138620,22 +138687,53 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
138620
138687
  selected_break: false,
138621
138688
  notes: ""
138622
138689
  });
138690
+ setDispoPath([]);
138691
+ setNotesError(false);
138623
138692
  };
138624
138693
  const handleClose = () => {
138625
138694
  handleReset();
138626
138695
  setOpen(false);
138627
138696
  };
138628
138697
  (0, import_react22.useEffect)(() => {
138629
- getDispositions(END_POINT.DISPOSITIONS);
138698
+ let cancelled2 = false;
138699
+ (async () => {
138700
+ let list = await fetchDispoList(END_POINT.DISPOSITIONS);
138701
+ if (list.length && !hasSubDispositions(list)) {
138702
+ const alt = await fetchDispoList(END_POINT.AGENT_SELECTABLE_DISPOSITIONS);
138703
+ if (hasSubDispositions(alt)) list = alt;
138704
+ }
138705
+ list = await withNotesFlags(list);
138706
+ if (!cancelled2) {
138707
+ setDispoTree(buildDispoTree(list));
138708
+ setDispoPath([]);
138709
+ }
138710
+ })();
138711
+ return () => {
138712
+ cancelled2 = true;
138713
+ };
138630
138714
  }, []);
138631
- const dispositionsOptions = (0, import_react22.useMemo)(() => {
138632
- var _a3, _b2, _c2, _d2;
138633
- return ((_d2 = (_c2 = (_b2 = (_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.data) == null ? void 0 : _b2.filter((item) => item.name !== "Resolved")) == null ? void 0 : _c2.map((item) => ({
138634
- label: item.name,
138635
- value: item.code,
138636
- id: item.disposition_id
138637
- }))) == null ? void 0 : _d2.sort((a2, b) => a2.label.localeCompare(b.label))) || [];
138638
- }, [(_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.data]);
138715
+ const notesRequired = dispoPath.some((n) => n.requiresNotes);
138716
+ const pickDispo = (level, picked) => {
138717
+ setDispoPath((prev2) => {
138718
+ const next2 = prev2.slice(0, level);
138719
+ if (picked) next2.push(picked);
138720
+ return next2;
138721
+ });
138722
+ setNotesError(false);
138723
+ };
138724
+ const handleSubmit = () => {
138725
+ if (notesRequired && !formData.notes.trim()) {
138726
+ setNotesError(true);
138727
+ return;
138728
+ }
138729
+ const leaf = dispoPath[dispoPath.length - 1];
138730
+ onSubmitDisposition(__spreadProps(__spreadValues({}, formData), {
138731
+ disposition: leaf ? { label: leaf.name, value: leaf.code, id: 0 } : { label: "", value: "", id: 0 }
138732
+ }));
138733
+ };
138734
+ const selectedNode = dispoPath[dispoPath.length - 1] || null;
138735
+ const dispoBreadcrumb = dispoPath.map((n) => n.name).join(" \u203A ");
138736
+ const dispoHint = selectedNode ? selectedNode.children.length ? `You can pick a ${dispoLevelLabel(dispoPath.length).toLowerCase()} for more detail.` : "Leaf reached \u2014 this path is complete." : "";
138639
138737
  return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_jsx_runtime153.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138640
138738
  Dialog_default,
138641
138739
  {
@@ -138644,251 +138742,357 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
138644
138742
  "aria-describedby": "alert-dialog-description",
138645
138743
  maxWidth: "sm",
138646
138744
  fullWidth: true,
138647
- slotProps: { paper: { sx: { minWidth: 600 } } },
138745
+ slotProps: { paper: { sx: { minWidth: 600, borderRadius: 3, maxHeight: "85vh" } } },
138648
138746
  sx: {
138649
138747
  minWidth: "650px"
138650
138748
  },
138651
- children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Paper_default, { sx: { borderRadius: 2 }, children: [
138652
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138653
- Box_default,
138654
- {
138655
- sx: {
138656
- display: "flex",
138657
- justifyContent: "center",
138658
- alignItems: "center",
138659
- padding: "4px 16px",
138660
- boxShadow: "0px 1px 2px #f5f5f5ff"
138661
- },
138662
- children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138663
- Typography_default,
138749
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138750
+ Paper_default,
138751
+ {
138752
+ sx: {
138753
+ borderRadius: 3,
138754
+ display: "flex",
138755
+ flexDirection: "column",
138756
+ maxHeight: "85vh",
138757
+ overflow: "hidden"
138758
+ },
138759
+ children: [
138760
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138761
+ Box_default,
138664
138762
  {
138665
- variant: "body1",
138666
- sx: { m: 1 },
138667
- children: [
138668
- " ",
138669
- "Call Disposition"
138670
- ]
138763
+ sx: {
138764
+ flexShrink: 0,
138765
+ px: 2,
138766
+ py: 1.5,
138767
+ borderBottom: "1px solid",
138768
+ borderColor: "divider"
138769
+ },
138770
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138771
+ Typography_default,
138772
+ {
138773
+ variant: "h6",
138774
+ sx: { fontWeight: 600, color: "text.primary", fontSize: "1.05rem" },
138775
+ children: "Call Disposition"
138776
+ }
138777
+ )
138671
138778
  }
138672
- )
138673
- }
138674
- ),
138675
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138676
- Box_default,
138677
- {
138678
- sx: {
138679
- boxShadow: "1px 1px 4px #d3d3d3ff",
138680
- padding: "10px",
138681
- margin: "10px",
138682
- borderRadius: "10px"
138683
- },
138684
- children: [
138685
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138686
- Box_default,
138687
- {
138688
- sx: { display: "flex", gap: 2 },
138689
- children: [
138690
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138691
- Autocomplete_default,
138692
- {
138693
- value: formData.disposition,
138694
- options: dispositionsOptions,
138695
- getOptionLabel: (opt) => opt.label,
138696
- onChange: (_, val) => handleChange("disposition", val),
138697
- size: "small",
138698
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138699
- TextField_default,
138700
- __spreadProps(__spreadValues({}, params), {
138701
- label: "Disposition",
138702
- fullWidth: true
138703
- })
138704
- ),
138705
- sx: { flex: 1 }
138706
- }
138707
- ),
138708
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138709
- Autocomplete_default,
138710
- {
138711
- options: followUpOptions,
138712
- getOptionLabel: (opt) => opt.label,
138713
- value: formData.followUp,
138714
- onChange: (_, val) => handleChange("followUp", val),
138715
- size: "small",
138716
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138717
- TextField_default,
138718
- __spreadProps(__spreadValues({}, params), {
138719
- label: "Follow Up",
138720
- fullWidth: true
138721
- })
138722
- ),
138723
- sx: { flex: 1 }
138724
- }
138725
- )
138726
- ]
138727
- }
138728
- ),
138729
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138730
- Box_default,
138731
- {
138732
- sx: { display: "flex", gap: 2, mt: 2 },
138733
- children: [
138734
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138735
- Box_default,
138736
- {
138737
- sx: {
138738
- flex: "1",
138739
- border: "1px solid #bdbdbd",
138740
- borderRadius: "5px"
138741
- },
138742
- children: [
138779
+ ),
138780
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Box_default, { sx: { flex: 1, minHeight: 0, overflowY: "auto", p: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138781
+ Box_default,
138782
+ {
138783
+ sx: {
138784
+ boxShadow: "1px 1px 4px #d3d3d3ff",
138785
+ padding: "10px",
138786
+ borderRadius: "10px"
138787
+ },
138788
+ children: [
138789
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138790
+ Box_default,
138791
+ {
138792
+ sx: { display: "flex", flexDirection: "column", gap: 2 },
138793
+ children: [
138794
+ (() => {
138795
+ const levels = [];
138796
+ let siblings = dispoTree;
138797
+ let depth = 0;
138798
+ while (siblings.length) {
138799
+ const chosen = dispoPath[depth] || null;
138800
+ const options = siblings;
138801
+ const level = depth;
138802
+ levels.push(
138803
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { children: [
138804
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DispoFieldLabel, { children: dispoLevelLabel(level) }),
138805
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138806
+ Autocomplete_default,
138807
+ {
138808
+ value: chosen,
138809
+ options,
138810
+ getOptionLabel: (opt) => opt ? opt.name : "",
138811
+ isOptionEqualToValue: (opt, val) => (opt == null ? void 0 : opt.key) === (val == null ? void 0 : val.key),
138812
+ onChange: (_, picked) => pickDispo(level, picked),
138813
+ size: "small",
138814
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138815
+ TextField_default,
138816
+ __spreadProps(__spreadValues({}, params), {
138817
+ placeholder: `Select ${dispoLevelLabel(level).toLowerCase()}\u2026`,
138818
+ fullWidth: true
138819
+ })
138820
+ ),
138821
+ fullWidth: true
138822
+ }
138823
+ )
138824
+ ] }, level)
138825
+ );
138826
+ if (!chosen) break;
138827
+ siblings = chosen.children;
138828
+ depth++;
138829
+ }
138830
+ if (!levels.length) {
138831
+ levels.push(
138832
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { children: [
138833
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DispoFieldLabel, { children: "Disposition" }),
138834
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138835
+ TextField_default,
138836
+ {
138837
+ size: "small",
138838
+ value: "",
138839
+ disabled: true,
138840
+ placeholder: "Loading dispositions\u2026",
138841
+ fullWidth: true
138842
+ }
138843
+ )
138844
+ ] }, "loading")
138845
+ );
138846
+ }
138847
+ return levels;
138848
+ })(),
138849
+ dispoPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { sx: { mt: 0.5 }, children: [
138743
138850
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138744
- Checkbox_default,
138851
+ Box_default,
138745
138852
  {
138746
- name: "selected_break",
138747
138853
  sx: {
138748
- padding: "6px"
138749
- },
138750
- checked: formData.selected_break,
138751
- onChange: (event) => {
138752
- handleChange("selected_break", event.target.checked);
138854
+ px: 1.5,
138855
+ py: 1,
138856
+ borderRadius: "8px",
138857
+ bgcolor: "#e6f4f1",
138858
+ fontSize: "0.8rem",
138859
+ fontWeight: 500,
138860
+ color: "text.primary",
138861
+ wordBreak: "break-word"
138753
138862
  },
138754
- slotProps: {
138755
- input: { "aria-label": "controlled" }
138756
- }
138863
+ children: dispoBreadcrumb
138757
138864
  }
138758
138865
  ),
138759
- " ",
138760
- "Mark as break"
138761
- ]
138762
- }
138763
- ),
138764
- ((_c = (_b = formData == null ? void 0 : formData.followUp) == null ? void 0 : _b.label) == null ? void 0 : _c.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138765
- TextField_default,
138766
- {
138767
- size: "small",
138768
- label: "Callback Date",
138769
- type: "date",
138770
- slotProps: {
138771
- inputLabel: { shrink: true },
138772
- htmlInput: {
138773
- min: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
138774
- }
138775
- },
138776
- value: formData.callbackDate,
138777
- onChange: (e) => {
138778
- handleChange("callbackDate", e.target.value);
138779
- const isToday = e.target.value === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
138780
- if (isToday) {
138781
- const now = /* @__PURE__ */ new Date();
138782
- const currentHr = now.getHours();
138783
- if (formData.callbackHrs && Number(formData.callbackHrs) < currentHr) {
138784
- handleChange("callbackHrs", "");
138785
- handleChange("callbackMins", "");
138786
- } else if (formData.callbackHrs && Number(formData.callbackHrs) === currentHr && formData.callbackMins && Number(formData.callbackMins) < now.getMinutes()) {
138787
- handleChange("callbackMins", "");
138866
+ dispoHint && /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138867
+ Typography_default,
138868
+ {
138869
+ variant: "caption",
138870
+ sx: {
138871
+ display: "block",
138872
+ mt: 0.5,
138873
+ color: notesRequired ? "warning.main" : "text.secondary"
138874
+ },
138875
+ children: [
138876
+ dispoHint,
138877
+ notesRequired ? " Notes are required for this disposition." : ""
138878
+ ]
138788
138879
  }
138880
+ )
138881
+ ] })
138882
+ ]
138883
+ }
138884
+ ),
138885
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138886
+ Box_default,
138887
+ {
138888
+ sx: { display: "flex", gap: 2, mt: 2 },
138889
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { sx: { flex: 1 }, children: [
138890
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DispoFieldLabel, { children: "Follow up" }),
138891
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138892
+ Autocomplete_default,
138893
+ {
138894
+ options: followUpOptions,
138895
+ getOptionLabel: (opt) => opt.label,
138896
+ value: formData.followUp,
138897
+ onChange: (_, val) => handleChange("followUp", val),
138898
+ size: "small",
138899
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138900
+ TextField_default,
138901
+ __spreadProps(__spreadValues({}, params), {
138902
+ placeholder: "Select follow up",
138903
+ fullWidth: true
138904
+ })
138905
+ ),
138906
+ fullWidth: true
138789
138907
  }
138790
- },
138791
- fullWidth: true,
138792
- sx: { flex: 1 }
138793
- }
138794
- ) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Box_default, { sx: { flex: 1 } })
138795
- ]
138796
- }
138797
- ),
138798
- ((_e = (_d = formData == null ? void 0 : formData.followUp) == null ? void 0 : _d.label) == null ? void 0 : _e.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138799
- Box_default,
138800
- {
138801
- sx: { display: "flex", gap: 2, mt: 2 },
138802
- children: [
138803
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138804
- Autocomplete_default,
138805
- {
138806
- size: "small",
138807
- options: Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")),
138808
- getOptionDisabled: (option) => {
138809
- const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
138810
- return isToday && Number(option) < (/* @__PURE__ */ new Date()).getHours();
138811
- },
138812
- value: formData.callbackHrs || null,
138813
- onChange: (_, value) => handleChange("callbackHrs", value || ""),
138814
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(TextField_default, __spreadProps(__spreadValues({}, params), { label: "Hours (0-23)" })),
138815
- fullWidth: true,
138816
- sx: { flex: 1 }
138817
- }
138818
- ),
138908
+ )
138909
+ ] })
138910
+ }
138911
+ ),
138912
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138913
+ Box_default,
138914
+ {
138915
+ sx: { display: "flex", gap: 2, mt: 2 },
138916
+ children: [
138917
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138918
+ Box_default,
138919
+ {
138920
+ sx: {
138921
+ flex: "1",
138922
+ border: "1px solid #bdbdbd",
138923
+ borderRadius: "5px"
138924
+ },
138925
+ children: [
138926
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138927
+ Checkbox_default,
138928
+ {
138929
+ name: "selected_break",
138930
+ sx: {
138931
+ padding: "6px"
138932
+ },
138933
+ checked: formData.selected_break,
138934
+ onChange: (event) => {
138935
+ handleChange("selected_break", event.target.checked);
138936
+ },
138937
+ slotProps: {
138938
+ input: { "aria-label": "controlled" }
138939
+ }
138940
+ }
138941
+ ),
138942
+ " ",
138943
+ "Mark as break"
138944
+ ]
138945
+ }
138946
+ ),
138947
+ ((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { sx: { flex: 1 }, children: [
138948
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DispoFieldLabel, { children: "Callback date" }),
138949
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138950
+ TextField_default,
138951
+ {
138952
+ size: "small",
138953
+ type: "date",
138954
+ slotProps: {
138955
+ htmlInput: {
138956
+ min: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
138957
+ }
138958
+ },
138959
+ value: formData.callbackDate,
138960
+ onChange: (e) => {
138961
+ handleChange("callbackDate", e.target.value);
138962
+ const isToday = e.target.value === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
138963
+ if (isToday) {
138964
+ const now = /* @__PURE__ */ new Date();
138965
+ const currentHr = now.getHours();
138966
+ if (formData.callbackHrs && Number(formData.callbackHrs) < currentHr) {
138967
+ handleChange("callbackHrs", "");
138968
+ handleChange("callbackMins", "");
138969
+ } else if (formData.callbackHrs && Number(formData.callbackHrs) === currentHr && formData.callbackMins && Number(formData.callbackMins) < now.getMinutes()) {
138970
+ handleChange("callbackMins", "");
138971
+ }
138972
+ }
138973
+ },
138974
+ fullWidth: true
138975
+ }
138976
+ )
138977
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Box_default, { sx: { flex: 1 } })
138978
+ ]
138979
+ }
138980
+ ),
138981
+ ((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138982
+ Box_default,
138983
+ {
138984
+ sx: { display: "flex", gap: 2, mt: 2 },
138985
+ children: [
138986
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { sx: { flex: 1 }, children: [
138987
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DispoFieldLabel, { children: "Hrs" }),
138988
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138989
+ Autocomplete_default,
138990
+ {
138991
+ size: "small",
138992
+ options: Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")),
138993
+ getOptionDisabled: (option) => {
138994
+ const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
138995
+ return isToday && Number(option) < (/* @__PURE__ */ new Date()).getHours();
138996
+ },
138997
+ value: formData.callbackHrs || null,
138998
+ onChange: (_, value) => handleChange("callbackHrs", value || ""),
138999
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(TextField_default, __spreadProps(__spreadValues({}, params), { placeholder: "Hrs" })),
139000
+ fullWidth: true
139001
+ }
139002
+ )
139003
+ ] }),
139004
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { sx: { flex: 1 }, children: [
139005
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DispoFieldLabel, { children: "Mins" }),
139006
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
139007
+ Autocomplete_default,
139008
+ {
139009
+ size: "small",
139010
+ options: Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0")),
139011
+ getOptionDisabled: (option) => {
139012
+ const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
139013
+ const now = /* @__PURE__ */ new Date();
139014
+ const isCurrentHr = isToday && formData.callbackHrs === String(now.getHours()).padStart(2, "0");
139015
+ return isCurrentHr && Number(option) < now.getMinutes();
139016
+ },
139017
+ value: formData.callbackMins || null,
139018
+ onChange: (_, value) => handleChange("callbackMins", value || ""),
139019
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(TextField_default, __spreadProps(__spreadValues({}, params), { placeholder: "Mins" })),
139020
+ fullWidth: true
139021
+ }
139022
+ )
139023
+ ] })
139024
+ ]
139025
+ }
139026
+ ),
139027
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Box_default, { sx: { mt: 2 }, children: [
139028
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(DispoFieldLabel, { children: notesRequired ? "Notes *" : "Notes" }),
138819
139029
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138820
- Autocomplete_default,
139030
+ TextField_default,
138821
139031
  {
138822
139032
  size: "small",
138823
- options: Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0")),
138824
- getOptionDisabled: (option) => {
138825
- const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
138826
- const now = /* @__PURE__ */ new Date();
138827
- const isCurrentHr = isToday && formData.callbackHrs === String(now.getHours()).padStart(2, "0");
138828
- return isCurrentHr && Number(option) < now.getMinutes();
139033
+ placeholder: notesRequired ? "Notes are required for this disposition" : "Notes (optional)",
139034
+ multiline: true,
139035
+ minRows: 2,
139036
+ maxRows: 4,
139037
+ value: formData.notes,
139038
+ onChange: (e) => {
139039
+ handleChange("notes", e.target.value);
139040
+ if (notesError) setNotesError(false);
138829
139041
  },
138830
- value: formData.callbackMins || null,
138831
- onChange: (_, value) => handleChange("callbackMins", value || ""),
138832
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(TextField_default, __spreadProps(__spreadValues({}, params), { label: "Minutes (0-59)" })),
138833
- fullWidth: true,
138834
- sx: { flex: 1 }
139042
+ error: notesError,
139043
+ helperText: notesError ? "Notes are required for this disposition." : "",
139044
+ fullWidth: true
138835
139045
  }
138836
139046
  )
138837
- ]
138838
- }
138839
- ),
138840
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Box_default, { sx: { mt: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138841
- TextField_default,
138842
- {
138843
- size: "small",
138844
- label: "Notes",
138845
- multiline: true,
138846
- minRows: 2,
138847
- maxRows: 4,
138848
- value: formData.notes,
138849
- onChange: (e) => handleChange("notes", e.target.value),
138850
- fullWidth: true
138851
- }
138852
- ) })
138853
- ]
138854
- }
138855
- ),
138856
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
138857
- Box_default,
138858
- {
138859
- sx: { textAlign: "right", m: 2 },
138860
- children: [
138861
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138862
- Button_default,
138863
- {
138864
- variant: "outlined",
138865
- color: "error",
138866
- size: "large",
138867
- onClick: handleClose,
138868
- sx: {
138869
- px: 2,
138870
- mx: 1,
138871
- borderRadius: "10px",
138872
- textTransform: "capitalize"
138873
- },
138874
- children: "cancel"
138875
- }
138876
- ),
138877
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
138878
- Button_default,
138879
- {
138880
- variant: "contained",
138881
- color: "primary",
138882
- size: "large",
138883
- onClick: () => onSubmitDisposition(formData),
138884
- sx: { px: 2, borderRadius: "10px", textTransform: "capitalize" },
138885
- children: "Submit"
138886
- }
138887
- )
138888
- ]
138889
- }
138890
- )
138891
- ] })
139047
+ ] })
139048
+ ]
139049
+ }
139050
+ ) }),
139051
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
139052
+ Box_default,
139053
+ {
139054
+ sx: {
139055
+ flexShrink: 0,
139056
+ textAlign: "right",
139057
+ px: 2,
139058
+ py: 1.5,
139059
+ borderTop: "1px solid",
139060
+ borderColor: "divider"
139061
+ },
139062
+ children: [
139063
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
139064
+ Button_default,
139065
+ {
139066
+ variant: "outlined",
139067
+ color: "error",
139068
+ size: "large",
139069
+ onClick: handleClose,
139070
+ sx: {
139071
+ px: 2,
139072
+ mx: 1,
139073
+ borderRadius: "10px",
139074
+ textTransform: "capitalize"
139075
+ },
139076
+ children: "cancel"
139077
+ }
139078
+ ),
139079
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
139080
+ Button_default,
139081
+ {
139082
+ variant: "contained",
139083
+ color: "primary",
139084
+ size: "large",
139085
+ onClick: handleSubmit,
139086
+ sx: { px: 2, borderRadius: "10px", textTransform: "capitalize" },
139087
+ children: "Submit"
139088
+ }
139089
+ )
139090
+ ]
139091
+ }
139092
+ )
139093
+ ]
139094
+ }
139095
+ )
138892
139096
  }
138893
139097
  ) });
138894
139098
  }