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
@@ -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`;
@@ -30808,10 +30812,6 @@ function useLeadIntegrations() {
30808
30812
  const res = await axios_default2.post(END_POINT.LEAD_INTEGRATION_REGENERATE_TOKEN(id));
30809
30813
  return res.data;
30810
30814
  }, []);
30811
- const getFacebookConnectUrl = (0, import_react36.useCallback)(async (id) => {
30812
- const res = await axios_default2.get(END_POINT.LEAD_INTEGRATION_FACEBOOK_CONNECT_URL(id));
30813
- return res.data;
30814
- }, []);
30815
30815
  const getAvailableForms = (0, import_react36.useCallback)(async (integrationId) => {
30816
30816
  const res = await axios_default2.get(END_POINT.LEAD_INTEGRATION_AVAILABLE_FORMS(integrationId));
30817
30817
  return deepFindArray(res.data, ["forms"]);
@@ -30853,7 +30853,6 @@ function useLeadIntegrations() {
30853
30853
  updateIntegration,
30854
30854
  deleteIntegration,
30855
30855
  regenerateWebhookToken,
30856
- getFacebookConnectUrl,
30857
30856
  getAvailableForms,
30858
30857
  createFormMapping,
30859
30858
  updateFormMapping,
@@ -30885,7 +30884,7 @@ function getEffectiveExpiry(integration) {
30885
30884
  }
30886
30885
  function getRenewalInstructions(reasonLabel) {
30887
30886
  if (reasonLabel === "Data access authorization") {
30888
- 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.";
30887
+ 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.";
30889
30888
  }
30890
30889
  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.";
30891
30890
  }
@@ -30940,10 +30939,7 @@ function TokenStatusChip({ integration }) {
30940
30939
  }
30941
30940
  ) });
30942
30941
  }
30943
- function TokenExpiryAlert({
30944
- integration,
30945
- onReconnect
30946
- }) {
30942
+ function TokenExpiryAlert({ integration }) {
30947
30943
  const meta = TOKEN_STATUS_META[integration.tokenExpiryStatus];
30948
30944
  if (!meta || integration.tokenExpiryStatus === "ok") return null;
30949
30945
  const effective = getEffectiveExpiry(integration);
@@ -30953,8 +30949,7 @@ function TokenExpiryAlert({
30953
30949
  effective ? `${effective.label} ${isExpired ? "expired" : "expires"} ${effective.date.toLocaleDateString()} (${effective.date.toLocaleTimeString()})` : isExpired ? "This integration is no longer valid." : "This integration is expiring soon.",
30954
30950
  isExpired ? " \u2014 lead ingestion has stopped." : " \u2014 lead ingestion will stop once this passes."
30955
30951
  ] }),
30956
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material31.Typography, { variant: "body2", sx: { mb: 1 }, children: getRenewalInstructions((effective == null ? void 0 : effective.label) || "Access token") }),
30957
- (integration.sourceType === "facebook" || integration.sourceType === "instagram") && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SDKButton, { size: "small", variant: "outlined", onClick: () => onReconnect(integration), children: "Reconnect with Facebook" })
30952
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material31.Typography, { variant: "body2", children: getRenewalInstructions((effective == null ? void 0 : effective.label) || "Access token") })
30958
30953
  ] });
30959
30954
  }
30960
30955
  function ModalShell({
@@ -31114,7 +31109,7 @@ function ConfirmDialog2({
31114
31109
  }
31115
31110
  );
31116
31111
  }
31117
- var import_react37, import_material31, import_Add2, import_ArrowDownward2, import_ArrowUpward, import_ContentCopy2, import_Delete2, import_Edit3, import_History, import_Refresh8, import_WarningAmber, import_jsx_runtime34, INTEGRATION_COLS, CENTER_COLS2, MANAGE_PERMISSIONS, defaultIntegrationForm, defaultMappingForm, errMsg, Required, IntegrationDialog, MappingDialog, LeadIntegrationsContent, LeadIntegrations, leadIntegrations_default;
31112
+ var import_react37, import_material31, import_Add2, import_ArrowDownward2, import_ArrowUpward, import_ContentCopy2, import_Delete2, import_Edit3, import_History, import_Refresh8, import_WarningAmber, import_jsx_runtime34, INTEGRATION_COLS, CENTER_COLS2, MANAGE_PERMISSIONS, defaultIntegrationForm, defaultMappingForm, errMsg, Required, SELECT_MENU_Z_INDEX, IntegrationDialog, MappingDialog, LeadIntegrationsContent, LeadIntegrations, leadIntegrations_default;
31118
31113
  var init_leadIntegrations = __esm({
31119
31114
  "call-control-sdk/lib/pages/leadIntegrations/index.tsx"() {
31120
31115
  "use strict";
@@ -31184,6 +31179,7 @@ var init_leadIntegrations = __esm({
31184
31179
  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;
31185
31180
  };
31186
31181
  Required = () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { style: { color: "#c0392b" }, children: "*" });
31182
+ SELECT_MENU_Z_INDEX = 1600;
31187
31183
  IntegrationDialog = (0, import_react37.memo)(function IntegrationDialog2({
31188
31184
  open,
31189
31185
  mode,
@@ -31196,8 +31192,7 @@ var init_leadIntegrations = __esm({
31196
31192
  onClose,
31197
31193
  onAddMapping,
31198
31194
  onEditMapping,
31199
- onDeleteMapping,
31200
- onReconnect
31195
+ onDeleteMapping
31201
31196
  }) {
31202
31197
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
31203
31198
  const [tab, setTab] = (0, import_react37.useState)(0);
@@ -31286,6 +31281,7 @@ var init_leadIntegrations = __esm({
31286
31281
  {
31287
31282
  value: formData.sourceType,
31288
31283
  sx: inputSx,
31284
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
31289
31285
  disabled: mode === "edit",
31290
31286
  onChange: (e) => setFormData((prev) => __spreadProps(__spreadValues({}, prev), { sourceType: e.target.value })),
31291
31287
  children: SOURCE_TYPE_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material31.MenuItem, { value: opt.value, children: [
@@ -31306,6 +31302,7 @@ var init_leadIntegrations = __esm({
31306
31302
  value: (_b = formData.defaultCampaignId) != null ? _b : "",
31307
31303
  displayEmpty: true,
31308
31304
  sx: inputSx,
31305
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
31309
31306
  onChange: (e) => setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
31310
31307
  defaultCampaignId: e.target.value ? Number(e.target.value) : null
31311
31308
  })),
@@ -31345,7 +31342,7 @@ var init_leadIntegrations = __esm({
31345
31342
  tab === 1 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material31.Box, { sx: { p: 2.5 }, children: [
31346
31343
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material31.Typography, { sx: sectionTitleSx, children: "API Credentials" }),
31347
31344
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material31.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2, fontSize: "0.82rem" }, children: "Enter your platform credentials. These are encrypted and stored securely." }),
31348
- mode === "edit" && editingIntegration && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TokenExpiryAlert, { integration: editingIntegration, onReconnect }),
31345
+ mode === "edit" && editingIntegration && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TokenExpiryAlert, { integration: editingIntegration }),
31349
31346
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material31.Box, { sx: { display: "grid", gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" }, gap: 2 }, children: [
31350
31347
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material31.Box, { children: [
31351
31348
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material31.Typography, { sx: labelSx, children: "App ID" }),
@@ -31546,6 +31543,7 @@ var init_leadIntegrations = __esm({
31546
31543
  value: formData.sourceFormId || "",
31547
31544
  displayEmpty: true,
31548
31545
  sx: inputSx,
31546
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
31549
31547
  disabled: mode === "edit",
31550
31548
  renderValue: (selected) => {
31551
31549
  var _a3;
@@ -31594,6 +31592,7 @@ var init_leadIntegrations = __esm({
31594
31592
  value: formData.campaignId || "",
31595
31593
  displayEmpty: true,
31596
31594
  sx: inputSx,
31595
+ MenuProps: { sx: { zIndex: SELECT_MENU_Z_INDEX } },
31597
31596
  renderValue: (selected) => {
31598
31597
  var _a3;
31599
31598
  return !selected ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { style: { color: "#9e9e9e" }, children: "Select Campaign" }) : ((_a3 = campaigns.find((c) => c.id === selected)) == null ? void 0 : _a3.name) || String(selected);
@@ -31698,7 +31697,6 @@ var init_leadIntegrations = __esm({
31698
31697
  updateIntegration,
31699
31698
  deleteIntegration,
31700
31699
  regenerateWebhookToken,
31701
- getFacebookConnectUrl,
31702
31700
  getAvailableForms,
31703
31701
  createFormMapping,
31704
31702
  updateFormMapping,
@@ -31831,32 +31829,6 @@ var init_leadIntegrations = __esm({
31831
31829
  (_a3 = navigator.clipboard) == null ? void 0 : _a3.writeText(url);
31832
31830
  showToast("Webhook URL copied to clipboard", "info");
31833
31831
  };
31834
- const handleReconnectFacebook = async (integration) => {
31835
- try {
31836
- const { authorizeUrl } = await getFacebookConnectUrl(integration.id);
31837
- const popup = window.open(authorizeUrl, "fb-oauth-reconnect", "width=600,height=700");
31838
- if (!popup) {
31839
- showToast("Popup blocked \u2014 allow popups for this site and try again", "warning");
31840
- return;
31841
- }
31842
- const onMessage = (event) => {
31843
- if (!event.data || event.data.type !== "lead-integration-fb-oauth-result") return;
31844
- window.removeEventListener("message", onMessage);
31845
- if (event.data.success) {
31846
- showToast(
31847
- event.data.pageName ? `Reconnected to "${event.data.pageName}"` : "Facebook integration reconnected",
31848
- "success"
31849
- );
31850
- refresh();
31851
- } else {
31852
- showToast(event.data.error || "Facebook reconnect failed", "error");
31853
- }
31854
- };
31855
- window.addEventListener("message", onMessage);
31856
- } catch (error) {
31857
- showToast(errMsg(error, "Failed to start Facebook reconnect"), "error");
31858
- }
31859
- };
31860
31832
  const openMappingDialog = async (integration, mode, mapping) => {
31861
31833
  setSelectedIntegration(integration);
31862
31834
  setMappingMode(mode);
@@ -32115,8 +32087,7 @@ var init_leadIntegrations = __esm({
32115
32087
  onClose: () => setDialogOpen(false),
32116
32088
  onAddMapping: (integration) => openMappingDialog(integration, "add"),
32117
32089
  onEditMapping: (integration, mapping) => openMappingDialog(integration, "edit", mapping),
32118
- onDeleteMapping: (integration, mapping) => setMappingDeleteTarget({ integration, mapping }),
32119
- onReconnect: handleReconnectFacebook
32090
+ onDeleteMapping: (integration, mapping) => setMappingDeleteTarget({ integration, mapping })
32120
32091
  }
32121
32092
  ),
32122
32093
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
@@ -34290,9 +34261,105 @@ function CallTransferDialog({ open }) {
34290
34261
  )
34291
34262
  ] });
34292
34263
  }
34293
- function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34264
+ function dispoLevelLabel(depth) {
34265
+ let prefix = "";
34266
+ for (let i = 0; i < depth; i++) prefix += "Sub-";
34267
+ return prefix + "Disposition";
34268
+ }
34269
+ function dispoField(d2, ...keys) {
34270
+ for (const k2 of keys) {
34271
+ const v = d2 == null ? void 0 : d2[k2];
34272
+ if (v !== void 0 && v !== null && v !== "") return v;
34273
+ }
34274
+ return null;
34275
+ }
34276
+ function normDispo(d2) {
34294
34277
  var _a2, _b, _c, _d, _e;
34295
- const [getDispositions, data] = useGetRequest();
34278
+ const id = dispoField(d2, "id", "disposition_id", "dispositionId");
34279
+ const code = String((_b = (_a2 = dispoField(d2, "code", "disposition_code")) != null ? _a2 : dispoField(d2, "name")) != null ? _b : "");
34280
+ const pid = dispoField(d2, "parentId", "parent_id", "parentDispositionId", "parent_disposition_id");
34281
+ const pcode = dispoField(d2, "parentCode", "parent_code");
34282
+ return {
34283
+ key: id != null ? "#" + id : "c:" + code,
34284
+ parentKey: pid != null ? "#" + pid : pcode ? "c:" + pcode : null,
34285
+ code,
34286
+ name: String((_d = (_c = dispoField(d2, "name")) != null ? _c : code) != null ? _d : ""),
34287
+ sortOrder: Number((_e = dispoField(d2, "sortOrder", "sort_order")) != null ? _e : 0),
34288
+ requiresNotes: !!dispoField(d2, "requiresNotes", "requires_notes"),
34289
+ children: []
34290
+ };
34291
+ }
34292
+ function hasSubDispositions(list) {
34293
+ return list.some((d2) => normDispo(d2).parentKey != null);
34294
+ }
34295
+ function hasNotesFlag(list) {
34296
+ return list.some((r) => "requiresNotes" in r || "requires_notes" in r);
34297
+ }
34298
+ function buildDispoTree(list) {
34299
+ const nodes = list.map(normDispo);
34300
+ const byKey = {};
34301
+ let roots = [];
34302
+ nodes.forEach((n) => {
34303
+ byKey[n.key] = n;
34304
+ });
34305
+ nodes.forEach((n) => {
34306
+ const parent = n.parentKey ? byKey[n.parentKey] : null;
34307
+ if (parent && parent !== n) parent.children.push(n);
34308
+ else roots.push(n);
34309
+ });
34310
+ if (!roots.length && nodes.length) {
34311
+ nodes.forEach((n) => {
34312
+ n.children = [];
34313
+ });
34314
+ roots = nodes;
34315
+ }
34316
+ const sortLevel = (arr) => {
34317
+ arr.sort((a, b) => a.sortOrder - b.sortOrder || a.name.localeCompare(b.name));
34318
+ arr.forEach((n) => sortLevel(n.children));
34319
+ };
34320
+ sortLevel(roots);
34321
+ return roots;
34322
+ }
34323
+ async function fetchDispoList(url) {
34324
+ try {
34325
+ const res = await axios_default2.get(url);
34326
+ const body = res == null ? void 0 : res.data;
34327
+ const d2 = body && body.data !== void 0 ? body.data : body;
34328
+ return Array.isArray(d2) ? d2 : d2 && Array.isArray(d2.data) ? d2.data : [];
34329
+ } catch (e) {
34330
+ return [];
34331
+ }
34332
+ }
34333
+ async function withNotesFlags(list) {
34334
+ if (!list.length || hasNotesFlag(list)) return list;
34335
+ const master = await fetchDispoList(END_POINT.AGENT_SELECTABLE_DISPOSITIONS);
34336
+ if (!master.length || !hasNotesFlag(master)) return list;
34337
+ const codeOf = (r) => String(r.code || r.name || "").toUpperCase();
34338
+ const flag = {};
34339
+ master.forEach((m) => {
34340
+ const c = codeOf(m);
34341
+ if (c) flag[c] = !!(m.requiresNotes || m.requires_notes);
34342
+ });
34343
+ return list.map((r) => {
34344
+ const c = codeOf(r);
34345
+ return Object.prototype.hasOwnProperty.call(flag, c) ? __spreadProps(__spreadValues({}, r), { requiresNotes: flag[c] }) : r;
34346
+ });
34347
+ }
34348
+ function DispoFieldLabel({ children }) {
34349
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34350
+ import_material3.Typography,
34351
+ {
34352
+ variant: "caption",
34353
+ sx: { display: "block", fontWeight: 600, fontSize: "0.8rem", color: "text.secondary", mb: 0.5 },
34354
+ children
34355
+ }
34356
+ );
34357
+ }
34358
+ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34359
+ var _a2, _b, _c, _d;
34360
+ const [dispoTree, setDispoTree] = (0, import_react10.useState)([]);
34361
+ const [dispoPath, setDispoPath] = (0, import_react10.useState)([]);
34362
+ const [notesError, setNotesError] = (0, import_react10.useState)(false);
34296
34363
  const [formData, setFormData] = (0, import_react10.useState)({
34297
34364
  disposition: { label: "", value: "", id: 0 },
34298
34365
  followUp: { label: "No", value: "N" },
@@ -34319,22 +34386,53 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34319
34386
  selected_break: false,
34320
34387
  notes: ""
34321
34388
  });
34389
+ setDispoPath([]);
34390
+ setNotesError(false);
34322
34391
  };
34323
34392
  const handleClose = () => {
34324
34393
  handleReset();
34325
34394
  setOpen(false);
34326
34395
  };
34327
34396
  (0, import_react10.useEffect)(() => {
34328
- getDispositions(END_POINT.DISPOSITIONS);
34397
+ let cancelled = false;
34398
+ (async () => {
34399
+ let list = await fetchDispoList(END_POINT.DISPOSITIONS);
34400
+ if (list.length && !hasSubDispositions(list)) {
34401
+ const alt = await fetchDispoList(END_POINT.AGENT_SELECTABLE_DISPOSITIONS);
34402
+ if (hasSubDispositions(alt)) list = alt;
34403
+ }
34404
+ list = await withNotesFlags(list);
34405
+ if (!cancelled) {
34406
+ setDispoTree(buildDispoTree(list));
34407
+ setDispoPath([]);
34408
+ }
34409
+ })();
34410
+ return () => {
34411
+ cancelled = true;
34412
+ };
34329
34413
  }, []);
34330
- const dispositionsOptions = (0, import_react10.useMemo)(() => {
34331
- var _a3, _b2, _c2, _d2;
34332
- 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) => ({
34333
- label: item.name,
34334
- value: item.code,
34335
- id: item.disposition_id
34336
- }))) == null ? void 0 : _d2.sort((a, b) => a.label.localeCompare(b.label))) || [];
34337
- }, [(_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.data]);
34414
+ const notesRequired = dispoPath.some((n) => n.requiresNotes);
34415
+ const pickDispo = (level, picked) => {
34416
+ setDispoPath((prev) => {
34417
+ const next = prev.slice(0, level);
34418
+ if (picked) next.push(picked);
34419
+ return next;
34420
+ });
34421
+ setNotesError(false);
34422
+ };
34423
+ const handleSubmit = () => {
34424
+ if (notesRequired && !formData.notes.trim()) {
34425
+ setNotesError(true);
34426
+ return;
34427
+ }
34428
+ const leaf = dispoPath[dispoPath.length - 1];
34429
+ onSubmitDisposition(__spreadProps(__spreadValues({}, formData), {
34430
+ disposition: leaf ? { label: leaf.name, value: leaf.code, id: 0 } : { label: "", value: "", id: 0 }
34431
+ }));
34432
+ };
34433
+ const selectedNode = dispoPath[dispoPath.length - 1] || null;
34434
+ const dispoBreadcrumb = dispoPath.map((n) => n.name).join(" \u203A ");
34435
+ const dispoHint = selectedNode ? selectedNode.children.length ? `You can pick a ${dispoLevelLabel(dispoPath.length).toLowerCase()} for more detail.` : "Leaf reached \u2014 this path is complete." : "";
34338
34436
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34339
34437
  import_material3.Dialog,
34340
34438
  {
@@ -34343,251 +34441,357 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34343
34441
  "aria-describedby": "alert-dialog-description",
34344
34442
  maxWidth: "sm",
34345
34443
  fullWidth: true,
34346
- slotProps: { paper: { sx: { minWidth: 600 } } },
34444
+ slotProps: { paper: { sx: { minWidth: 600, borderRadius: 3, maxHeight: "85vh" } } },
34347
34445
  sx: {
34348
34446
  minWidth: "650px"
34349
34447
  },
34350
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
34351
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34352
- import_material3.Box,
34353
- {
34354
- sx: {
34355
- display: "flex",
34356
- justifyContent: "center",
34357
- alignItems: "center",
34358
- padding: "4px 16px",
34359
- boxShadow: "0px 1px 2px #f5f5f5ff"
34360
- },
34361
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34362
- import_material3.Typography,
34448
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34449
+ import_material3.Paper,
34450
+ {
34451
+ sx: {
34452
+ borderRadius: 3,
34453
+ display: "flex",
34454
+ flexDirection: "column",
34455
+ maxHeight: "85vh",
34456
+ overflow: "hidden"
34457
+ },
34458
+ children: [
34459
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34460
+ import_material3.Box,
34363
34461
  {
34364
- variant: "body1",
34365
- sx: { m: 1 },
34366
- children: [
34367
- " ",
34368
- "Call Disposition"
34369
- ]
34462
+ sx: {
34463
+ flexShrink: 0,
34464
+ px: 2,
34465
+ py: 1.5,
34466
+ borderBottom: "1px solid",
34467
+ borderColor: "divider"
34468
+ },
34469
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34470
+ import_material3.Typography,
34471
+ {
34472
+ variant: "h6",
34473
+ sx: { fontWeight: 600, color: "text.primary", fontSize: "1.05rem" },
34474
+ children: "Call Disposition"
34475
+ }
34476
+ )
34370
34477
  }
34371
- )
34372
- }
34373
- ),
34374
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34375
- import_material3.Box,
34376
- {
34377
- sx: {
34378
- boxShadow: "1px 1px 4px #d3d3d3ff",
34379
- padding: "10px",
34380
- margin: "10px",
34381
- borderRadius: "10px"
34382
- },
34383
- children: [
34384
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34385
- import_material3.Box,
34386
- {
34387
- sx: { display: "flex", gap: 2 },
34388
- children: [
34389
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34390
- import_material3.Autocomplete,
34391
- {
34392
- value: formData.disposition,
34393
- options: dispositionsOptions,
34394
- getOptionLabel: (opt) => opt.label,
34395
- onChange: (_, val) => handleChange("disposition", val),
34396
- size: "small",
34397
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34398
- import_material3.TextField,
34399
- __spreadProps(__spreadValues({}, params), {
34400
- label: "Disposition",
34401
- fullWidth: true
34402
- })
34403
- ),
34404
- sx: { flex: 1 }
34405
- }
34406
- ),
34407
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34408
- import_material3.Autocomplete,
34409
- {
34410
- options: followUpOptions,
34411
- getOptionLabel: (opt) => opt.label,
34412
- value: formData.followUp,
34413
- onChange: (_, val) => handleChange("followUp", val),
34414
- size: "small",
34415
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34416
- import_material3.TextField,
34417
- __spreadProps(__spreadValues({}, params), {
34418
- label: "Follow Up",
34419
- fullWidth: true
34420
- })
34421
- ),
34422
- sx: { flex: 1 }
34423
- }
34424
- )
34425
- ]
34426
- }
34427
- ),
34428
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34429
- import_material3.Box,
34430
- {
34431
- sx: { display: "flex", gap: 2, mt: 2 },
34432
- children: [
34433
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34434
- import_material3.Box,
34435
- {
34436
- sx: {
34437
- flex: "1",
34438
- border: "1px solid #bdbdbd",
34439
- borderRadius: "5px"
34440
- },
34441
- children: [
34478
+ ),
34479
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", p: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34480
+ import_material3.Box,
34481
+ {
34482
+ sx: {
34483
+ boxShadow: "1px 1px 4px #d3d3d3ff",
34484
+ padding: "10px",
34485
+ borderRadius: "10px"
34486
+ },
34487
+ children: [
34488
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34489
+ import_material3.Box,
34490
+ {
34491
+ sx: { display: "flex", flexDirection: "column", gap: 2 },
34492
+ children: [
34493
+ (() => {
34494
+ const levels = [];
34495
+ let siblings = dispoTree;
34496
+ let depth = 0;
34497
+ while (siblings.length) {
34498
+ const chosen = dispoPath[depth] || null;
34499
+ const options = siblings;
34500
+ const level = depth;
34501
+ levels.push(
34502
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { children: [
34503
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: dispoLevelLabel(level) }),
34504
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34505
+ import_material3.Autocomplete,
34506
+ {
34507
+ value: chosen,
34508
+ options,
34509
+ getOptionLabel: (opt) => opt ? opt.name : "",
34510
+ isOptionEqualToValue: (opt, val) => (opt == null ? void 0 : opt.key) === (val == null ? void 0 : val.key),
34511
+ onChange: (_, picked) => pickDispo(level, picked),
34512
+ size: "small",
34513
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34514
+ import_material3.TextField,
34515
+ __spreadProps(__spreadValues({}, params), {
34516
+ placeholder: `Select ${dispoLevelLabel(level).toLowerCase()}\u2026`,
34517
+ fullWidth: true
34518
+ })
34519
+ ),
34520
+ fullWidth: true
34521
+ }
34522
+ )
34523
+ ] }, level)
34524
+ );
34525
+ if (!chosen) break;
34526
+ siblings = chosen.children;
34527
+ depth++;
34528
+ }
34529
+ if (!levels.length) {
34530
+ levels.push(
34531
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { children: [
34532
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Disposition" }),
34533
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34534
+ import_material3.TextField,
34535
+ {
34536
+ size: "small",
34537
+ value: "",
34538
+ disabled: true,
34539
+ placeholder: "Loading dispositions\u2026",
34540
+ fullWidth: true
34541
+ }
34542
+ )
34543
+ ] }, "loading")
34544
+ );
34545
+ }
34546
+ return levels;
34547
+ })(),
34548
+ dispoPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { mt: 0.5 }, children: [
34442
34549
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34443
- import_material3.Checkbox,
34550
+ import_material3.Box,
34444
34551
  {
34445
- name: "selected_break",
34446
34552
  sx: {
34447
- padding: "6px"
34448
- },
34449
- checked: formData.selected_break,
34450
- onChange: (event) => {
34451
- handleChange("selected_break", event.target.checked);
34553
+ px: 1.5,
34554
+ py: 1,
34555
+ borderRadius: "8px",
34556
+ bgcolor: "#e6f4f1",
34557
+ fontSize: "0.8rem",
34558
+ fontWeight: 500,
34559
+ color: "text.primary",
34560
+ wordBreak: "break-word"
34452
34561
  },
34453
- slotProps: {
34454
- input: { "aria-label": "controlled" }
34455
- }
34562
+ children: dispoBreadcrumb
34456
34563
  }
34457
34564
  ),
34458
- " ",
34459
- "Mark as break"
34460
- ]
34461
- }
34462
- ),
34463
- ((_c = (_b = formData == null ? void 0 : formData.followUp) == null ? void 0 : _b.label) == null ? void 0 : _c.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34464
- import_material3.TextField,
34465
- {
34466
- size: "small",
34467
- label: "Callback Date",
34468
- type: "date",
34469
- slotProps: {
34470
- inputLabel: { shrink: true },
34471
- htmlInput: {
34472
- min: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
34473
- }
34474
- },
34475
- value: formData.callbackDate,
34476
- onChange: (e) => {
34477
- handleChange("callbackDate", e.target.value);
34478
- const isToday = e.target.value === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34479
- if (isToday) {
34480
- const now = /* @__PURE__ */ new Date();
34481
- const currentHr = now.getHours();
34482
- if (formData.callbackHrs && Number(formData.callbackHrs) < currentHr) {
34483
- handleChange("callbackHrs", "");
34484
- handleChange("callbackMins", "");
34485
- } else if (formData.callbackHrs && Number(formData.callbackHrs) === currentHr && formData.callbackMins && Number(formData.callbackMins) < now.getMinutes()) {
34486
- handleChange("callbackMins", "");
34565
+ dispoHint && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34566
+ import_material3.Typography,
34567
+ {
34568
+ variant: "caption",
34569
+ sx: {
34570
+ display: "block",
34571
+ mt: 0.5,
34572
+ color: notesRequired ? "warning.main" : "text.secondary"
34573
+ },
34574
+ children: [
34575
+ dispoHint,
34576
+ notesRequired ? " Notes are required for this disposition." : ""
34577
+ ]
34487
34578
  }
34579
+ )
34580
+ ] })
34581
+ ]
34582
+ }
34583
+ ),
34584
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34585
+ import_material3.Box,
34586
+ {
34587
+ sx: { display: "flex", gap: 2, mt: 2 },
34588
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34589
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Follow up" }),
34590
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34591
+ import_material3.Autocomplete,
34592
+ {
34593
+ options: followUpOptions,
34594
+ getOptionLabel: (opt) => opt.label,
34595
+ value: formData.followUp,
34596
+ onChange: (_, val) => handleChange("followUp", val),
34597
+ size: "small",
34598
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34599
+ import_material3.TextField,
34600
+ __spreadProps(__spreadValues({}, params), {
34601
+ placeholder: "Select follow up",
34602
+ fullWidth: true
34603
+ })
34604
+ ),
34605
+ fullWidth: true
34488
34606
  }
34489
- },
34490
- fullWidth: true,
34491
- sx: { flex: 1 }
34492
- }
34493
- ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
34494
- ]
34495
- }
34496
- ),
34497
- ((_e = (_d = formData == null ? void 0 : formData.followUp) == null ? void 0 : _d.label) == null ? void 0 : _e.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34498
- import_material3.Box,
34499
- {
34500
- sx: { display: "flex", gap: 2, mt: 2 },
34501
- children: [
34502
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34503
- import_material3.Autocomplete,
34504
- {
34505
- size: "small",
34506
- options: Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")),
34507
- getOptionDisabled: (option) => {
34508
- const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34509
- return isToday && Number(option) < (/* @__PURE__ */ new Date()).getHours();
34510
- },
34511
- value: formData.callbackHrs || null,
34512
- onChange: (_, value) => handleChange("callbackHrs", value || ""),
34513
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { label: "Hours (0-23)" })),
34514
- fullWidth: true,
34515
- sx: { flex: 1 }
34516
- }
34517
- ),
34607
+ )
34608
+ ] })
34609
+ }
34610
+ ),
34611
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34612
+ import_material3.Box,
34613
+ {
34614
+ sx: { display: "flex", gap: 2, mt: 2 },
34615
+ children: [
34616
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34617
+ import_material3.Box,
34618
+ {
34619
+ sx: {
34620
+ flex: "1",
34621
+ border: "1px solid #bdbdbd",
34622
+ borderRadius: "5px"
34623
+ },
34624
+ children: [
34625
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34626
+ import_material3.Checkbox,
34627
+ {
34628
+ name: "selected_break",
34629
+ sx: {
34630
+ padding: "6px"
34631
+ },
34632
+ checked: formData.selected_break,
34633
+ onChange: (event) => {
34634
+ handleChange("selected_break", event.target.checked);
34635
+ },
34636
+ slotProps: {
34637
+ input: { "aria-label": "controlled" }
34638
+ }
34639
+ }
34640
+ ),
34641
+ " ",
34642
+ "Mark as break"
34643
+ ]
34644
+ }
34645
+ ),
34646
+ ((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34647
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Callback date" }),
34648
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34649
+ import_material3.TextField,
34650
+ {
34651
+ size: "small",
34652
+ type: "date",
34653
+ slotProps: {
34654
+ htmlInput: {
34655
+ min: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
34656
+ }
34657
+ },
34658
+ value: formData.callbackDate,
34659
+ onChange: (e) => {
34660
+ handleChange("callbackDate", e.target.value);
34661
+ const isToday = e.target.value === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34662
+ if (isToday) {
34663
+ const now = /* @__PURE__ */ new Date();
34664
+ const currentHr = now.getHours();
34665
+ if (formData.callbackHrs && Number(formData.callbackHrs) < currentHr) {
34666
+ handleChange("callbackHrs", "");
34667
+ handleChange("callbackMins", "");
34668
+ } else if (formData.callbackHrs && Number(formData.callbackHrs) === currentHr && formData.callbackMins && Number(formData.callbackMins) < now.getMinutes()) {
34669
+ handleChange("callbackMins", "");
34670
+ }
34671
+ }
34672
+ },
34673
+ fullWidth: true
34674
+ }
34675
+ )
34676
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
34677
+ ]
34678
+ }
34679
+ ),
34680
+ ((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34681
+ import_material3.Box,
34682
+ {
34683
+ sx: { display: "flex", gap: 2, mt: 2 },
34684
+ children: [
34685
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34686
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Hrs" }),
34687
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34688
+ import_material3.Autocomplete,
34689
+ {
34690
+ size: "small",
34691
+ options: Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")),
34692
+ getOptionDisabled: (option) => {
34693
+ const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34694
+ return isToday && Number(option) < (/* @__PURE__ */ new Date()).getHours();
34695
+ },
34696
+ value: formData.callbackHrs || null,
34697
+ onChange: (_, value) => handleChange("callbackHrs", value || ""),
34698
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { placeholder: "Hrs" })),
34699
+ fullWidth: true
34700
+ }
34701
+ )
34702
+ ] }),
34703
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34704
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Mins" }),
34705
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34706
+ import_material3.Autocomplete,
34707
+ {
34708
+ size: "small",
34709
+ options: Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0")),
34710
+ getOptionDisabled: (option) => {
34711
+ const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34712
+ const now = /* @__PURE__ */ new Date();
34713
+ const isCurrentHr = isToday && formData.callbackHrs === String(now.getHours()).padStart(2, "0");
34714
+ return isCurrentHr && Number(option) < now.getMinutes();
34715
+ },
34716
+ value: formData.callbackMins || null,
34717
+ onChange: (_, value) => handleChange("callbackMins", value || ""),
34718
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { placeholder: "Mins" })),
34719
+ fullWidth: true
34720
+ }
34721
+ )
34722
+ ] })
34723
+ ]
34724
+ }
34725
+ ),
34726
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { mt: 2 }, children: [
34727
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: notesRequired ? "Notes *" : "Notes" }),
34518
34728
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34519
- import_material3.Autocomplete,
34729
+ import_material3.TextField,
34520
34730
  {
34521
34731
  size: "small",
34522
- options: Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0")),
34523
- getOptionDisabled: (option) => {
34524
- const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34525
- const now = /* @__PURE__ */ new Date();
34526
- const isCurrentHr = isToday && formData.callbackHrs === String(now.getHours()).padStart(2, "0");
34527
- return isCurrentHr && Number(option) < now.getMinutes();
34732
+ placeholder: notesRequired ? "Notes are required for this disposition" : "Notes (optional)",
34733
+ multiline: true,
34734
+ minRows: 2,
34735
+ maxRows: 4,
34736
+ value: formData.notes,
34737
+ onChange: (e) => {
34738
+ handleChange("notes", e.target.value);
34739
+ if (notesError) setNotesError(false);
34528
34740
  },
34529
- value: formData.callbackMins || null,
34530
- onChange: (_, value) => handleChange("callbackMins", value || ""),
34531
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { label: "Minutes (0-59)" })),
34532
- fullWidth: true,
34533
- sx: { flex: 1 }
34741
+ error: notesError,
34742
+ helperText: notesError ? "Notes are required for this disposition." : "",
34743
+ fullWidth: true
34534
34744
  }
34535
34745
  )
34536
- ]
34537
- }
34538
- ),
34539
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { mt: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34540
- import_material3.TextField,
34541
- {
34542
- size: "small",
34543
- label: "Notes",
34544
- multiline: true,
34545
- minRows: 2,
34546
- maxRows: 4,
34547
- value: formData.notes,
34548
- onChange: (e) => handleChange("notes", e.target.value),
34549
- fullWidth: true
34550
- }
34551
- ) })
34552
- ]
34553
- }
34554
- ),
34555
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34556
- import_material3.Box,
34557
- {
34558
- sx: { textAlign: "right", m: 2 },
34559
- children: [
34560
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34561
- import_material3.Button,
34562
- {
34563
- variant: "outlined",
34564
- color: "error",
34565
- size: "large",
34566
- onClick: handleClose,
34567
- sx: {
34568
- px: 2,
34569
- mx: 1,
34570
- borderRadius: "10px",
34571
- textTransform: "capitalize"
34572
- },
34573
- children: "cancel"
34574
- }
34575
- ),
34576
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34577
- import_material3.Button,
34578
- {
34579
- variant: "contained",
34580
- color: "primary",
34581
- size: "large",
34582
- onClick: () => onSubmitDisposition(formData),
34583
- sx: { px: 2, borderRadius: "10px", textTransform: "capitalize" },
34584
- children: "Submit"
34585
- }
34586
- )
34587
- ]
34588
- }
34589
- )
34590
- ] })
34746
+ ] })
34747
+ ]
34748
+ }
34749
+ ) }),
34750
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34751
+ import_material3.Box,
34752
+ {
34753
+ sx: {
34754
+ flexShrink: 0,
34755
+ textAlign: "right",
34756
+ px: 2,
34757
+ py: 1.5,
34758
+ borderTop: "1px solid",
34759
+ borderColor: "divider"
34760
+ },
34761
+ children: [
34762
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34763
+ import_material3.Button,
34764
+ {
34765
+ variant: "outlined",
34766
+ color: "error",
34767
+ size: "large",
34768
+ onClick: handleClose,
34769
+ sx: {
34770
+ px: 2,
34771
+ mx: 1,
34772
+ borderRadius: "10px",
34773
+ textTransform: "capitalize"
34774
+ },
34775
+ children: "cancel"
34776
+ }
34777
+ ),
34778
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34779
+ import_material3.Button,
34780
+ {
34781
+ variant: "contained",
34782
+ color: "primary",
34783
+ size: "large",
34784
+ onClick: handleSubmit,
34785
+ sx: { px: 2, borderRadius: "10px", textTransform: "capitalize" },
34786
+ children: "Submit"
34787
+ }
34788
+ )
34789
+ ]
34790
+ }
34791
+ )
34792
+ ]
34793
+ }
34794
+ )
34591
34795
  }
34592
34796
  ) });
34593
34797
  }