1import { o as __toESM } from "./chunk-6z4oVpB-.js"; 2import "./capitalize-YV0fqYBS.js"; 3import { t as require_react } from "./react-CCT1erMQ.js"; 4import "./prop-types-BP3O0vhg.js"; 5import { t as require_jsx_runtime } from "./jsx-runtime-6ToSbptA.js"; 6import "./hoist-non-react-statics.cjs-aYVW55CP.js"; 7import "./clsx-BbsgvS4T.js"; 8import "./Stack-DHo_Jfjl.js"; 9import "./setPrototypeOf-BJGl62Ep.js"; 10import "./chainPropTypes-Bly6swO2.js"; 11import "./SvgIcon-C1SXqgmo.js"; 12import "./typeof-CtObx4yR.js"; 13import "./Amplify-D0fRojM9.js"; 14import "./types-Badw_GZ3.js"; 15import "./amplifyUrl-DDtOFVK1.js"; 16import "./tslib.es6-DOCxQXyJ.js"; 17import { l as queryClient } from "./api-CPx3dJPV.js"; 18import "./createCognitoUserPoolEndpointResolver-CeOq9LYq.js"; 19import "./auth-112vuqrd.js"; 20import { o as formatDate } from "./helpers-CIThgqfh.js"; 21import "./getCurrentUser-BNfTg9dP.js"; 22import "./_baseGetTag-DyzlKCT_.js"; 23import "./errors-Bz8_MS_m.js"; 24import "./_arrayPush-zqmRK2Sh.js"; 25import "./isArray-DQJAKxTk.js"; 26import "./isObjectLike-YfNJf3G6.js"; 27import "./isArguments-jbXyUacA.js"; 28import "./shim-tM7ZK01N.js"; 29import "./use-isomorphic-layout-effect.browser.esm-B8DPirtA.js"; 30import "./_arrayMap-CdYGT3WW.js"; 31import "./isSymbol-fHles11u.js"; 32import "./toString-BaR9Xa8n.js"; 33import { n as getFlag } from "./launchDarklyClient-DUgxdCdE.js"; 34import "./_basePropertyOf-jCWVBh4B.js"; 35import "./debounce-BI4AKE0v.js"; 36import "./dist-9_GVLiOM.js"; 37import "./dist-CuFlg_4O.js"; 38import "./react-dom-ld7mzddK.js"; 39import "./dist-DoGjUkMb.js"; 40import "./dist-CNliTmfT.js"; 41import "./classPrivateFieldGet2-T1C0ibFM.js"; 42import "./dist-D_mba0Ln.js"; 43import "./dist-wmihWyUh.js"; 44import "./Combination-CbWrdVoQ.js"; 45import "./dist-DNn8DQrd.js"; 46import "./dist-4SRU2SWZ.js"; 47import "./dist-auk7r2og.js"; 48import "./dist-KMtZa6Tg.js"; 49import "./select-CAOM9JtG.js"; 50import "./dist-CvnDO-P6.js"; 51import { n as ie } from "./esm-OeroYQy0.js"; 52import { F as useSearchParams, T as useLoaderData, _ as redirect, k as useNavigation, r as Link } from "./chunk-62JRHF6Z-af5QuQJC.js"; 53import "./exports-BpI0uky7.js"; 54import "./notifyManager-DecSEhne.js"; 55import "./useBaseQuery-B2Mj_MCe.js"; 56import "./useInfiniteQuery-C4nk9Xz0.js"; 57import "./useMutation-IAQRP4R7.js"; 58import "./QueryClientProvider-C1UBWQV0.js"; 59import "./useQuery-CSX9sxP2.js"; 60import { c as uiSettingQueryKey, n as createUiSettingSyncParamsAdapter, r as hydrateSyncParamsUiSetting, s as scheduleUiSettingPut, t as clearUiSettingQueryCache } from "./uiSettingQueries-DxMHZzte.js"; 61import { r as DEFAULT_PAGE_SIZE } from "./constants-DgZg1qAf.js"; 62import "./session-CHB6zjYw.js"; 63import "./iconPropTypes-C5chbmyn-FDi75KL4.js"; 64import "./bucket-0-Dd64UaRz.js"; 65import { i as ChevronDown, n as Checkmark } from "./bucket-3-C2c54QJ8.js"; 66import "./bucket-6-Bmdc6sX9.js"; 67import "./bucket-10-23Eagi9e.js"; 68import "./bucket-15-CpUGvMi0.js"; 69import "./dist-Z60waVX1.js"; 70import "./dist-CWLu0srv.js"; 71import "./createLucideIcon-COoV7LiJ.js"; 72import "./loader-2-BcfWHp3w.js"; 73import "./search-8Hqcfgqj.js"; 74import { t as cn } from "./utils-DCaTMnxb.js"; 75import "./use-toast-DjpclxwO.js"; 76import "./subDays-Bn5Ubekx.js"; 77import "./addMonths-DV_ETa6N.js"; 78import "./endOfMonth-DiAWB7_8.js"; 79import "./roundingMethods-XHnUL5k_.js"; 80import "./differenceInWeeks-sFLJRI4F.js"; 81import "./constants-fq6SDD6N.js"; 82import "./isValid-B-21K4uE.js"; 83import "./parseISO-CXlN910B.js"; 84import "./vanilla-CLGkZFy8.js"; 85import "./react-DHanflfZ.js"; 86import "./client.gen-BrTEPecv.js"; 87import "./defineProperty-D5y_YB9q.js"; 88import { t as Button } from "./button-CgeNlB2Q.js"; 89import { i as TooltipTrigger, n as TooltipContent, r as TooltipProvider, t as Tooltip } from "./tooltip-B35baM50.js"; 90import { n as LongText_default } from "./LongText-BPuPQL-1.js"; 91import { t as Badge } from "./badge-B_ZVhNO-.js"; 92import "./xstate-react.esm-Bnt7Kjod.js"; 93import "./utils-B9FPGvAJ.js"; 94import "./atoms-DP7aIs_n.js"; 95import { i as createBreadcrumbConfig } from "./dynamic-breadcrumbs.utils-CfffO9VU.js"; 96import "./Button-B4_Mm4Dz.js"; 97import "./Typography-Ds0rUQpc.js"; 98import "./Link-B8ZxMx_M.js"; 99import "./ErrorPage-BhyGtQ5j.js"; 100import "./useSessionQuery-CaAx9LCq.js"; 101import "./bootstrap-PD0gOsLT.js"; 102import "./command-BOGRc9Sm.js"; 103import "./dist-FSwW85_l.js"; 104import "./dialog-CHSk6eNP.js"; 105import "./utils-DMECC7FS.js"; 106import "./comments-CJXe8Uor.js"; 107import "./base-path-DffKLrHl.js"; 108import "./zod-Cm5HR22p.js"; 109import "./input-Ct-ouO13.js"; 110import "./separator-keJIpHAu.js"; 111import "./sheet-DOB9Or8E.js"; 112import "./skeleton-BN73VL4N.js"; 113import { t as LogErrorBoundary } from "./LogErrorBoundary-DcZPNxdu.js"; 114import "./spinner-cFg3Zggn.js"; 115import "./useDebounceCallback-BTOGb8mZ.js"; 116import { i as getCoreRowModel, n as useReactTable, r as createColumnHelper } from "./lib-BY10gxfc.js"; 117import "./controlled-pagination-CBMDgEEg.js"; 118import "./table-Dy8slfUO.js"; 119import "./reset-to-first-page-C9Ia8cgw.js"; 120import "./filter-search-params-BsP9grdP.js"; 121import { c as getFilterParamKeys, r as useFilterDrawerMap, s as getFilterParamKey } from "./use-table-context-vmbhWTsO.js"; 122import { Zt as listUpstreamEventsQueue } from "./sdk.gen-Bm4osd6G.js"; 123import "./client-BXjQlaNr.js"; 124import "./api-DYsscDZP.js"; 125import "./useMatchesData-BspVY2Cp.js"; 126import "./api-BkfjtxrG.js"; 127import "./queries-BCemRJki.js"; 128import "./_baseFlatten-CQ5kwHSA.js"; 129import "./flatten-C45Vd0Yy.js"; 130import "./assignee-select-value-mUf-X1Sf.js"; 131import "./utils-O1BD-TND.js"; 132import "./tmpDataManipulation-LqS79Zqw.js"; 133import "./dist-CbAgl5nj.js"; 134import { a as EVENT_QUEUE_DATE_RANGE_OPTIONS, c as EVENT_TYPE_OPTIONS, d as normalizeCustomerStatusList, f as resolveEventQueueStatusForUrl, i as EVENT_QUEUE_CUSTOMER_STATUS_OPTIONS, l as eventQueueStatusParamsNeedRedirect, n as DEFAULT_EVENT_QUEUE_SORT_FIELD, o as EVENT_QUEUE_SEVERITY_OPTIONS, s as EVENT_QUEUE_STATUS_OPTIONS, t as DEFAULT_EVENT_QUEUE_SORT_DIRECTION } from "./utils-nG8rdJfp.js"; 135import { t as CustomerStatusField } from "./customer-status-field-Bl9IOwQ7.js"; 136import { n as FilterPills, r as SearchInput, t as FilterDrawer$1 } from "./filter-drawer-C1ffOgXG.js"; 137import { a as TableLayoutHeader, n as TableLayoutBody, o as TableLayoutHeaderRow, r as TableLayoutFilterPills, s as TableLayoutRoot, t as TableLayoutActions } from "./table-layout-2gagLD1U.js"; 138import { i as PillButton, n as useMultiSelect, o as PillButtonToggle, r as useSingleSelect, t as DefaultMultiSelectFilter, u as useFilterFormListener } from "./default-multi-select-filter-DNKy0h2-.js"; 139import "./tabs-BHdYoQLd.js"; 140import { t as DisruptionMonitorTabs } from "./disruption-monitor-tabs-A2gjE2SO.js"; 141import { r as DefaultTableCell, t as DefaultTableHead } from "./table-header-CTtTwFyN.js"; 142import { t as Table } from "./table-BsIdRRX9.js"; 143import { t as TableProvider } from "./table-provider-5zUFpHUQ.js"; 144import "./sync-route-params-Br0QEQ45.js";
145import { t as syncRouteParamsV2 } from "./sync-route-params-v2-DWFBBA2x.js"; 146import { r as disruptionEventStatusFiltersV2Schema, t as DEFAULT_DISRUPTION_EVENT_STATUS_FILTERS_V2_SYNC_PARAMS } from "./sync-route-params-schemas-BwnhhqOy.js"; 147import { t as SortableHeader } from "./sortable-header-BnXefpAa.js"; 148import { a as ComboboxInput, i as ComboboxGroup, n as ComboboxContent, o as ComboboxItem, s as ComboboxList, t as Combobox, u as ComboboxTrigger } from "./combobox-Bh-YgLkU.js"; 149import "./plural-C8SkjErM.js"; 150import "./dist-Bn3bRngM.js"; 151import { t as Switch } from "./switch-J6Zy9iRe.js"; 152import { t as UrlPagination } from "./url-pagination-DfpV7bwU.js"; 153var import_react = /* @__PURE__ */ __toESM(require_react(), 1); 154var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1); 155function Announced({ row }) { 156 const date = row.original.published_at; 157 if (!date) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "â" }); 158 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: formatDate(typeof date === "string" ? date : date.toISOString(), "numeric", "2-digit", "2-digit") }); 159} 160function CustomerStatusCell({ row }) { 161 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomerStatusField, { 162 eventId: row.original.event_id, 163 status: row.original.customer_status, 164 display: row.original.customer_status_display 165 }); 166} 167function EventTypes({ row }) { 168 const types = row.original.types; 169 if (!types || types.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "â" }); 170 if (types.length > 1) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { 171 delayDuration: 100, 172 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 173 asChild: true, 174 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 175 variant: "informative", 176 className: "cursor-default text-nowrap hover:bg-blue-300", 177 children: [ 178 types[0], 179 " + ", 180 types.length - 1 181 ] 182 }) 183 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 184 className: "flex max-w-[300px] flex-col gap-1 text-wrap p-2", 185 children: types.join(", ") 186 })] 187 }) }); 188 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 189 variant: "informative", 190 className: "text-nowrap", 191 children: types[0] 192 }); 193} 194function LocationsImpacted({ row }) { 195 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 196 variant: "outline", 197 children: row.original.locations_impacted ?? 0 198 }); 199} 200function ProductsAffected({ row }) { 201 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 202 variant: "outline", 203 children: row.original.products_affected ?? 0 204 }); 205} 206var EventSeverity = /* @__PURE__ */ function(EventSeverity$1) { 207 EventSeverity$1[EventSeverity$1["LOW"] = 0] = "LOW"; 208 EventSeverity$1[EventSeverity$1["MODERATE"] = 1] = "MODERATE"; 209 EventSeverity$1[EventSeverity$1["MAJOR"] = 2] = "MAJOR"; 210 EventSeverity$1[EventSeverity$1["CRITICAL"] = 3] = "CRITICAL"; 211 return EventSeverity$1; 212}(EventSeverity || {}); 213var EVENT_SEVERITY_EXPLANATION = { 214 [EventSeverity.LOW]: "Potential risk only, forward-looking plans, resolved issues, or financial announcements without immediate supply impact", 215 [EventSeverity.MODERATE]: "Class III recall; regional shortage; warning letter that could escalate; price increase 2-10%", 216 [EventSeverity.MAJOR]: "Class II recall; FDA shortage list; multi-state hospital impact; >10% price spike or prolonged rationing", 217 [EventSeverity.CRITICAL]: "Class I recall; national shortage of life-support products; >50% U.S. supply lost; any event causing deaths or surgery cancellations" 218}; 219var EVENT_SEVERITY_NAME = { 220 [EventSeverity.LOW]: "Low", 221 [EventSeverity.MODERATE]: "Moderate", 222 [EventSeverity.MAJOR]: "Major", 223 [EventSeverity.CRITICAL]: "Critical" 224}; 225function Severity({ row }) { 226 const severity = row.original.severity; 227 switch (severity) { 228 case EventSeverity.LOW: return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BadgeWithTooltip, { 229 severity, 230 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 231 variant: "secondary", 232 className: "cursor-default", 233 children: "Low" 234 }) 235 }); 236 case EventSeverity.MODERATE: return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BadgeWithTooltip, { 237 severity, 238 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 239 variant: "yellow", 240 className: "cursor-default text-red-950", 241 children: "Moderate" 242 }) 243 }); 244 case EventSeverity.MAJOR: return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BadgeWithTooltip, { 245 severity, 246 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 247 variant: "warningMuted", 248 className: "cursor-default", 249 children: "Major" 250 }) 251 }); 252 case EventSeverity.CRITICAL: return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BadgeWithTooltip, { 253 severity, 254 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 255 variant: "destructiveMuted", 256 className: "cursor-default", 257 children: "Critical" 258 }) 259 }); 260 default: return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "â" }); 261 } 262} 263function BadgeWithTooltip({ children, severity }) { 264 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 265 asChild: true, 266 children 267 }
267), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipContent, { 268 className: "flex w-[300px] flex-col gap-1 text-wrap p-2", 269 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 270 className: "type-body-xs pl-1 pt-1 font-medium", 271 children: EVENT_SEVERITY_NAME[severity] 272 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 273 className: "type-body-2xs pl-1 font-medium leading-normal", 274 children: EVENT_SEVERITY_EXPLANATION[severity] 275 })] 276 })] }) }); 277} 278function Status({ row }) { 279 const status = row.original.status; 280 if (!status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "â" }); 281 switch (status.toLowerCase()) { 282 case "announced": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 283 className: "bg-violet-200 text-violet-950", 284 children: status 285 }); 286 case "ongoing": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 287 className: "bg-cyan-100 text-cyan-950", 288 children: status 289 }); 290 case "resolved": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 291 className: "bg-zinc-200 text-zinc-800", 292 children: status 293 }); 294 default: return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 295 variant: "informative", 296 children: status 297 }); 298 } 299} 300function Title({ row }) { 301 const title = row.original.title; 302 const eventId = row.original.event_id; 303 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 304 to: `/disruptions/events/${eventId}`, 305 className: "min-w-0 font-medium text-indigo-600", 306 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, { text: title }) 307 }); 308} 309function Updated({ row }) { 310 const date = row.original.updated_at; 311 if (!date) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "â" }); 312 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: formatDate(typeof date === "string" ? date : date.toISOString(), "numeric", "2-digit", "2-digit") }); 313} 314var columnHelper = createColumnHelper(); 315const columns = [ 316 columnHelper.accessor("status", { 317 id: "status", 318 size: 115, 319 meta: { 320 label: "Status", 321 isNumeric: false, 322 sort: { param: "status" } 323 }, 324 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 325 header: props.header, 326 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 327 }), 328 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 329 cell: props.cell, 330 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Status, { row: props.row }) 331 }) 332 }), 333 columnHelper.accessor("customer_status", { 334 id: "customer_status", 335 size: 140, 336 meta: { 337 label: "Your Status", 338 isNumeric: false, 339 sort: { param: "customer_status" } 340 }, 341 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 342 header: props.header, 343 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 344 }), 345 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 346 cell: props.cell, 347 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomerStatusCell, { row: props.row }) 348 }) 349 }), 350 columnHelper.accessor("severity", { 351 id: "severity", 352 size: 115, 353 meta: { 354 label: "Severity", 355 isNumeric: false, 356 sort: { param: "severity" } 357 }, 358 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 359 header: props.header, 360 className: "items-end justify-end text-right", 361 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 362 }), 363 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 364 cell: props.cell, 365 className: "justify-center", 366 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Severity, { row: props.row }) 367 }) 368 }), 369 columnHelper.accessor("title", { 370 id: "title", 371 size: 400, 372 meta: { 373 label: "Event Description", 374 isNumeric: false, 375 sort: { param: "title" } 376 }, 377 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 378 header: props.header, 379 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { c
379olumn: props.column }) 380 }), 381 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 382 cell: props.cell, 383 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Title, { row: props.row }) 384 }) 385 }), 386 columnHelper.accessor("published_at", { 387 id: "published_at", 388 size: 130, 389 meta: { 390 label: "Announced", 391 isNumeric: false, 392 sort: { param: "published_at" }, 393 align: "left" 394 }, 395 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 396 header: props.header, 397 className: "text-center", 398 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 399 }), 400 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 401 cell: props.cell, 402 className: "justify-start", 403 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Announced, { row: props.row }) 404 }) 405 }), 406 columnHelper.accessor("updated_at", { 407 id: "updated_at", 408 size: 130, 409 meta: { 410 label: "Updated", 411 isNumeric: false, 412 sort: { param: "updated_at" }, 413 align: "left" 414 }, 415 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 416 header: props.header, 417 className: "text-center", 418 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 419 }), 420 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 421 cell: props.cell, 422 className: "justify-start", 423 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Updated, { row: props.row }) 424 }) 425 }), 426 columnHelper.accessor("types", { 427 id: "types", 428 size: 200, 429 meta: { 430 label: "Event Type", 431 isNumeric: false 432 }, 433 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 434 header: props.header, 435 children: "Event Type" 436 }), 437 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 438 cell: props.cell, 439 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EventTypes, { row: props.row }) 440 }) 441 }), 442 columnHelper.accessor("products_affected", { 443 id: "products_affected", 444 size: 150, 445 meta: { 446 label: "Products Affected", 447 isNumeric: true, 448 sort: { param: "products_affected" } 449 }, 450 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 451 header: props.header, 452 className: "text-center", 453 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 454 }), 455 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 456 cell: props.cell, 457 className: "justify-center", 458 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProductsAffected, { row: props.row }) 459 }) 460 }), 461 columnHelper.accessor("locations_impacted", { 462 id: "locations_impacted", 463 size: 150, 464 meta: { 465 label: "Locations Impacted", 466 isNumeric: true, 467 sort: { param: "locations_impacted" } 468 }, 469 header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 470 header: props.header, 471 className: "text-center", 472 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 473 }), 474 cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 475 cell: props.cell, 476 className: "justify-center", 477 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LocationsImpacted, { row: props.row }) 478 }) 479 }) 480]; 481function getEventQueueColumns(eventMitigationProject) { 482 if (eventMitigationProject) return columns; 483 return columns.filter((column) => column.id !== "customer_status"); 484} 485function FilterDrawer() { 486 const filterMap = useFilterDrawerMap(); 487 const status = filterMap.get("status"); 488 const customerStatus = filterMap.get("customer_status"); 489 const severity = filterMap.get("severity"); 490 const eventType = filterMap.get("event_type"); 491 const hasAffectedItems = filterMap.get("has_affected_items"); 492 const hasImpactedLocations = filterMap.get("has_impacted_locations"); 493 const announcedDate = filterMap.get("announced_date"); 494 const lastUpdated = filterMap.get("last_updated"); 495 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterDrawer$1, { 496 method: "GET", 497 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 498 className: "flex flex-col gap-5", 499 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterSection, { 500 className: "gap-3",
501 children: [hasAffectedItems && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(hasAffectedItems.Component, {}), hasImpactedLocations && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(hasImpactedLocations.Component, {})] 502 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterSection, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterGroup, { children: [ 503 status && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterGroupItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterGroupItemLabel, { children: status.meta.label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(status.Component, {})] }), 504 customerStatus && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterGroupItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterGroupItemLabel, { children: customerStatus.meta.label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(customerStatus.Component, {})] }), 505 severity && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterGroupItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterGroupItemLabel, { children: severity.meta.label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(severity.Component, {})] }), 506 eventType && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterGroupItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterGroupItemLabel, { children: eventType.meta.label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(eventType.Component, {})] }), 507 announcedDate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterGroupItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterGroupItemLabel, { children: announcedDate.meta.label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(announcedDate.Component, {})] }),
508 lastUpdated && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FilterGroupItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterGroupItemLabel, { children: lastUpdated.meta.label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lastUpdated.Component, {})] }) 509 ] }) })] 510 }) 511 }); 512} 513function FilterSection(props) { 514 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 515 ...props, 516 className: cn("flex flex-col gap-2", props.className) 517 }); 518} 519function FilterGroup(props) { 520 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 521 ...props, 522 className: cn("flex flex-col gap-5", props.className) 523 }); 524} 525function FilterGroupItem(props) { 526 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 527 ...props, 528 className: cn("flex flex-col gap-1", props.className) 529 }); 530} 531function FilterGroupItemLabel(props) { 532 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 533 ...props, 534 className: cn("text-smallMedium", props.className) 535 }); 536} 537function DefaultSelectFilter(props) { 538 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Combobox, { 539 onOpenChange: props.onOpenChange, 540 children: [ 541 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxTrigger, { 542 asChild: true, 543 children: props.children 544 }), 545 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ComboboxContent, { 546 align: "start", 547 className: "min-w-min", 548 shouldFilter: props.shouldFilter, 549 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxInput, { onInput: props.onInput }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxList, { children: props.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ComboboxItem, { 550 value: option.value, 551 onSelect: props.onSelect, 552 className: "group w-full justify-between gap-4", 553 "data-active": props.value === option.value, 554 keywords: option.keywords, 555 children: [typeof option.label === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, { text: option.label }) : option.label, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkmark, { className: "size-4 shrink-0 group-data-[active=false]:opacity-0 group-data-[active=true]:opacity-100" })] 556 }, option.value)) }) })] 557 }),
558 props.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { 559 type: "hidden", 560 name: props.name, 561 value: props.value 562 }) : null 563 ] 564 }); 565} 566var options$5 = EVENT_QUEUE_DATE_RANGE_OPTIONS; 567function AnnouncedDateFilter(props) { 568 const [searchParams] = useSearchParams(); 569 if (!props.meta?.filter) return null; 570 const paramKey = getFilterParamKey(props.meta.filter.param) ?? ""; 571 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnnouncedDateSelect, { 572 name: paramKey, 573 defaultValue: options$5.find((option) => option.value === searchParams.get(paramKey)) ?? null, 574 children: ({ selectedOption }) => { 575 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 576 variant: "outline", 577 className: "w-full justify-between overflow-hidden", 578 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: selectedOption ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, { text: selectedOption.label }) : "All" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, {})] 579 }); 580 } 581 }); 582} 583function AnnouncedDateFilterPill(props) { 584 const [searchParams] = useSearchParams(); 585 if (!props.meta?.filter) return null; 586 const paramKey = getFilterParamKey(props.meta.filter.param) ?? ""; 587 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnnouncedDateSelect, { 588 name: paramKey, 589 defaultValue: options$5.find((option) => option.value === searchParams.get(paramKey)) ?? null, 590 onOpenChange: (open) => { 591 if (!open) props.formRef?.current?.requestSubmit(); 592 }, 593 children: ({ selectedOption }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButton, { 594 label: props.meta?.label ?? "", 595 selectedOptions: selectedOption ? [selectedOption] : [], 596 pinned: props.meta?.filter?.pinned, 597 param: paramKey 598 }) 599 }); 600} 601function AnnouncedDateSelect(props) { 602 const [selectedOption, update, reset] = useSingleSelect({ defaultValue: props.defaultValue ?? void 0 }); 603 useFilterFormListener(import_react.useCallback((event) => { 604 if (event.type === "CLEAR") update(null); 605 else if (event.type === "RESET") reset(); 606 }, [update, reset])); 607 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultSelectFilter, { 608 name: props.name, 609 value: selectedOption?.value ?? null, 610 options: options$5.map((option) => ({ 611 ...option, 612 keywords: [option.label] 613 })), 614 onSelect: (value) => { 615 if (value.trim().length === 0) return; 616 const selectedOption$1 = options$5.find((option) => option.value === value); 617 if (!selectedOption$1) return; 618 update(selectedOption$1); 619 }, 620 onOpenChange: props.onOpenChange, 621 children: props.children({ selectedOption: selectedOption ?? null }) 622 }); 623} 624var options$4 = EVENT_QUEUE_CUSTOMER_STATUS_OPTIONS; 625function CustomerStatusFilter(props) { 626 const [searchParams] = useSearchParams(); 627 if (!props.meta?.filter) return null; 628 const paramKeys = getFilterParamKeys(props.meta.filter.param); 629 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomerStatusSelect, { 630 name: paramKeys[0] ?? "", 631 defaultValue: options$4.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 632 children: ({ selectedOptions }) => { 633 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 634 variant: "outline", 635 className: "w-full justify-between overflow-hidden", 636 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: selectedOptions.length > 0 ? `${selectedOptions.length} selected` : "All" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, {})] 637 }); 638 } 639 }); 640} 641function CustomerStatusFilterPill(props) { 642 const [searchParams] = useSearchParams(); 643 if (!props.meta?.filter) return null; 644 const paramKeys = getFilterParamKeys(props.meta.filter.param); 645 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomerStatusSelect, { 646 name: paramKeys[0] ?? "", 647 defaultValue: options$4.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 648 onOpenChange: (open) => { 649 if (!open) props.formRef?.current?.requestSubmit(); 650 }, 651 children: ({ selectedOptions }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButton, { 652 label: props.meta?.label ?? "", 653 selectedOptions, 654 pinned: props.meta?.filter?.pinned, 655 param: paramKeys[0] ?? "" 656 }) 657 }); 658} 659function CustomerStatusSelect(props) { 660 const [selectedOptions, update, reset] = useMultiSelect({ defaultValue: props.defaultValue }); 661 useFilterFormListener(import_react.useCallback((event) => { 662 if (event.type === "CLEAR") update([]); 663 else if (event.type === "RESET") reset(); 664 }, [update, reset])); 665 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultMultiSelectFilter, { 666 name: props.name, 667 value: selectedOptions.map((option) => option.value), 668 options: options$4.map((option) => ({ 669 ...option, 670 keywords: [option.label, option.value] 671 })), 672 onOpenChange: props.onOpenChange, 673 onSelect: (value) => { 674 if (value.trim().length === 0) return; 675 const selectedOption = options$4.find((option) => option.value === value); 676 if (!selectedOption) return; 677 if (selectedOptions.some((opt) => opt.value === value)) update(selectedOptions.filter((opt) => opt.value !== value)); 678 else update([...selectedOptions, selectedOption]); 679 props.onSelect?.(value); 680 }, 681 children: props.children({ selectedOptions }) 682 }); 683} 684var options$3 = EVENT_TYPE_OPTIONS; 685function EventTypeFilter(props) { 686 const [searchParams] = useSearchParams(); 687 if (!props.meta?.filter) return null; 688 const paramKeys = getFilterParamKeys(props.meta.filter.param); 689 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EventTypeSelect, { 690 name: paramKeys[0] ?? "", 691 defaultValue: options$3.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 692 children: ({ selectedOptions }) => { 693 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 694 variant: "outline", 695 className: "w-full justify-between overflow-hidden", 696 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: selectedOptions.length > 0 ? `${selectedOptions.length} selected` : "All" }
696), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, {})] 697 }); 698 } 699 }); 700} 701function EventTypeFilterPill(props) { 702 const [searchParams] = useSearchParams(); 703 if (!props.meta?.filter) return null; 704 const paramKeys = getFilterParamKeys(props.meta.filter.param); 705 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EventTypeSelect, { 706 name: paramKeys[0] ?? "", 707 defaultValue: options$3.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 708 onOpenChange: (open) => { 709 if (!open) props.formRef?.current?.requestSubmit(); 710 }, 711 children: ({ selectedOptions }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButton, { 712 label: props.meta?.label ?? "", 713 selectedOptions, 714 pinned: props.meta?.filter?.pinned, 715 param: paramKeys[0] ?? "" 716 }) 717 }); 718} 719function EventTypeSelect(props) { 720 const [selectedOptions, update, reset] = useMultiSelect({ defaultValue: props.defaultValue }); 721 useFilterFormListener(import_react.useCallback((event) => { 722 if (event.type === "CLEAR") update([]); 723 else if (event.type === "RESET") reset(); 724 }, [update, reset])); 725 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultMultiSelectFilter, { 726 name: props.name, 727 value: selectedOptions.map((option) => option.value), 728 options: options$3.map((option) => ({ 729 ...option, 730 keywords: [option.label, option.value] 731 })), 732 onOpenChange: props.onOpenChange, 733 onSelect: (value) => { 734 if (value.trim().length === 0) return; 735 const selectedOption = options$3.find((option) => option.value === value); 736 if (!selectedOption) return; 737 if (selectedOptions.some((opt) => opt.value === value)) update(selectedOptions.filter((opt) => opt.value !== value)); 738 else update([...selectedOptions, selectedOption]); 739 props.onSelect?.(value); 740 }, 741 children: props.children({ selectedOptions }) 742 }); 743} 744function HasAffectedItemsToggle(props) { 745 const [searchParams, _setSearchParams] = useSearchParams(); 746 const paramKey = getFilterParamKey(props.meta.filter?.param) ?? ""; 747 const [checked, setChecked] = import_react.useState(searchParams.get(paramKey) === "true"); 748 useFilterFormListener(import_react.useCallback((event) => { 749 if (event.type === "CLEAR") setChecked(false); 750 }, [])); 751 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { 752 className: "flex items-center justify-start gap-2", 753 children: [ 754 checked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { 755 type: "hidden", 756 name: paramKey, 757 value: "true" 758 }) : null, 759 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, { 760 variant: "purple", 761 checked, 762 onCheckedChange: setChecked 763 }), 764 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: props.meta.label }) 765 ] 766 }); 767} 768function HasAffectedItemsTogglePill(props) { 769 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButtonToggle, { 770 label: props.meta.label ?? "", 771 param: getFilterParamKey(props.meta.filter?.param) 772 }); 773} 774function HasImpactedLocationsToggle(props) { 775 const [searchParams, _setSearchParams] = useSearchParams(); 776 const paramKey = getFilterParamKey(props.meta.filter?.param) ?? ""; 777 const [checked, setChecked] = import_react.useState(searchParams.get(paramKey) === "true"); 778 useFilterFormListener(import_react.useCallback((event) => { 779 if (event.type === "CLEAR") setChecked(false); 780 }, [])); 781 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { 782 className: "flex items-center justify-start gap-2", 783 children: [ 784 checked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { 785 type: "hidden", 786 name: paramKey, 787 value: "true" 788 }) : null, 789 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, { 790 variant: "purple", 791 checked, 792 onCheckedChange: setChecked 793 }), 794 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: props.meta.label }) 795 ] 796 }); 797} 798function HasImpactedLocationsTogglePill(props) { 799 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButtonToggle, { 800 label: props.meta.label ?? "", 801 param: getFilterParamKey(props.meta.filter?.param) 802 }); 803} 804var options$2 = EVENT_QUEUE_DATE_RANGE_OPTIONS; 805function LastUpdatedFilter(props) { 806 const [searchParams] = useSearchParams(); 807 if (!props.meta?.filter) return null; 808 const paramKey = getFilterParamKey(props.meta.filter.param) ?? ""; 809 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastUpdatedSelect, { 810 name: paramKey, 811 defaultValue: options$2.find((option) => option.value === searchParams.get(paramKey)) ?? null, 812 children: ({ selectedOption }) => { 813 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 814 variant: "outline", 815 className: "w-full justify-between overflow-hidden", 816 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: selectedOption ? /* @__P
816URE__ */ (0, import_jsx_runtime.jsx)(LongText_default, { text: selectedOption.label }) : "All" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, {})] 817 }); 818 } 819 }); 820} 821function LastUpdatedFilterPill(props) { 822 const [searchParams] = useSearchParams(); 823 if (!props.meta?.filter) return null; 824 const paramKey = getFilterParamKey(props.meta.filter.param) ?? ""; 825 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LastUpdatedSelect, { 826 name: paramKey, 827 defaultValue: options$2.find((option) => option.value === searchParams.get(paramKey)) ?? null, 828 onOpenChange: (open) => { 829 if (!open) props.formRef?.current?.requestSubmit(); 830 }, 831 children: ({ selectedOption }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButton, { 832 label: props.meta?.label ?? "", 833 selectedOptions: selectedOption ? [selectedOption] : [], 834 pinned: props.meta?.filter?.pinned, 835 param: paramKey 836 }) 837 }); 838} 839function LastUpdatedSelect(props) { 840 const [selectedOption, update, reset] = useSingleSelect({ defaultValue: props.defaultValue ?? void 0 }); 841 useFilterFormListener(import_react.useCallback((event) => { 842 if (event.type === "CLEAR") update(null); 843 else if (event.type === "RESET") reset(); 844 }, [update, reset])); 845 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultSelectFilter, { 846 name: props.name, 847 value: selectedOption?.value ?? null, 848 options: options$2.map((option) => ({ 849 ...option, 850 keywords: [option.label] 851 })), 852 onSelect: (value) => { 853 if (value.trim().length === 0) return; 854 const selectedOption$1 = options$2.find((option) => option.value === value); 855 if (!selectedOption$1) return; 856 update(selectedOption$1); 857 }, 858 onOpenChange: props.onOpenChange, 859 children: props.children({ selectedOption: selectedOption ?? null }) 860 }); 861} 862var options$1 = EVENT_QUEUE_SEVERITY_OPTIONS; 863function SeverityFilter(props) { 864 const [searchParams] = useSearchParams(); 865 if (!props.meta?.filter) return null; 866 const paramKeys = getFilterParamKeys(props.meta.filter.param); 867 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SeveritySelect, { 868 name: paramKeys[0] ?? "", 869 defaultValue: options$1.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 870 children: ({ selectedOptions }) => { 871 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 872 variant: "outline", 873 className: "w-full justify-between overflow-hidden", 874 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: selectedOptions.length > 0 ? `${selectedOptions.length} selected` : "All" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, {})] 875 }); 876 } 877 }); 878} 879function SeverityFilterPill(props) { 880 const [searchParams] = useSearchParams(); 881 if (!props.meta?.filter) return null; 882 const paramKeys = getFilterParamKeys(props.meta.filter.param); 883 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SeveritySelect, { 884 name: paramKeys[0] ?? "", 885 defaultValue: options$1.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 886 onOpenChange: (open) => { 887 if (!open) props.formRef?.current?.requestSubmit(); 888 }, 889 children: ({ selectedOptions }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButton, { 890 label: props.meta?.label ?? "", 891 selectedOptions, 892 pinned: props.meta?.filter?.pinned, 893 param: paramKeys[0] ?? "" 894 }) 895 }); 896} 897function SeveritySelect(props) { 898 const [selectedOptions, update, reset] = useMultiSelect({ defaultValue: props.defaultValue }); 899 useFilterFormListener(import_react.useCallback((event) => { 900 if (event.type === "CLEAR") update([]); 901 else if (event.type === "RESET") reset(); 902 }, [update, reset])); 903 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultMultiSelectFilter, { 904 name: props.name, 905 value: selectedOptions.map((option) => option.value), 906 options: options$1.map((option) => ({ 907 ...option, 908 keywords: [option.label, option.value] 909 })), 910 onOpenChange: props.onOpenChange, 911 onSelect: (value) => { 912 if (value.trim().length === 0) return; 913 const selectedOption = options$1.find((option) => option.value === value); 914 if (!selectedOption) return; 915 if (selectedOptions.some((opt) => opt.value === value)) update(selectedOptions.filter((opt) => opt.value !== value)); 916 else update([...selectedOptions, selectedOption]); 917 props.onSelect?.(value); 918 }, 919 children: props.children({ selectedOptions }) 920 }); 921} 922var options = EVENT_QUEUE_STATUS_OPTIONS; 923function StatusFilter(props) { 924 const [searchParams] = useSearchParams(); 925 if (!props.meta?.filter) return null; 926 const paramKeys = getFilterParamKeys(props.meta.filter.param); 927 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusSelect, { 928 name: paramKeys[0] ?? "", 929 defaultValue: options.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 930 children: ({ selectedOptions }) => { 931 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 932 variant: "outline", 933 className: "w-full justify-between overflow-hidden", 934 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: selectedOptions.length > 0 ? `${selectedOptions.length} selected` : "All" }
934), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, {})] 935 }); 936 } 937 }); 938} 939function StatusFilterPill(props) { 940 const [searchParams] = useSearchParams(); 941 if (!props.meta?.filter) return null; 942 const paramKeys = getFilterParamKeys(props.meta.filter.param); 943 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusSelect, { 944 name: paramKeys[0] ?? "", 945 defaultValue: options.filter((option) => searchParams.getAll(paramKeys[0] ?? "").includes(option.value)), 946 onOpenChange: (open) => { 947 if (!open) props.formRef?.current?.requestSubmit(); 948 }, 949 children: ({ selectedOptions }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillButton, { 950 label: props.meta?.label ?? "", 951 selectedOptions, 952 pinned: props.meta?.filter?.pinned, 953 param: paramKeys[0] ?? "" 954 }) 955 }); 956} 957function StatusSelect(props) { 958 const [selectedOptions, update, reset] = useMultiSelect({ defaultValue: props.defaultValue }); 959 useFilterFormListener(import_react.useCallback((event) => { 960 if (event.type === "CLEAR") update([]); 961 else if (event.type === "RESET") reset(); 962 }, [update, reset])); 963 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultMultiSelectFilter, { 964 name: props.name, 965 value: selectedOptions.map((option) => option.value), 966 options: options.map((option) => ({ 967 ...option, 968 keywords: [option.label, option.value] 969 })), 970 onOpenChange: props.onOpenChange, 971 onSelect: (value) => { 972 if (value.trim().length === 0) return; 973 const selectedOption = options.find((option) => option.value === value); 974 if (!selectedOption) return; 975 if (selectedOptions.some((opt) => opt.value === value)) update(selectedOptions.filter((opt) => opt.value !== value)); 976 else update([...selectedOptions, selectedOption]); 977 props.onSelect?.(value); 978 }, 979 children: props.children({ selectedOptions }) 980 }); 981} 982function EventQueuePagination() { 983 const count = useEventsQuery()?.count ?? 0; 984 const [searchParams] = useSearchParams(); 985 const page = parseInt(searchParams.get("page") || "1", 10); 986 const pageSize = parseInt(searchParams.get("page_size") || 25 .toString(), 10); 987 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UrlPagination, { 988 page, 989 pageSize, 990 total: count, 991 totalPages: Math.ceil(count / pageSize) 992 }); 993} 994var tableMetaFilters = [ 995 { 996 param: "has_affected_items", 997 label: "Has Affected Items", 998 components: { 999 Filter: HasAffectedItemsToggle, 1000 Pill: HasAffectedItemsTogglePill 1001 } 1002 }, 1003 { 1004 param: "has_impacted_locations", 1005 label: "Has Impacted Locations", 1006 components: { 1007 Filter: HasImpactedLocationsToggle, 1008 Pill: HasImpactedLocationsTogglePill 1009 } 1010 }, 1011 { 1012 param: "status", 1013 label: "Status", 1014 components: { 1015 Filter: StatusFilter, 1016 Pill: StatusFilterPill 1017 } 1018 }, 1019 { 1020 param: "customer_status", 1021 label: "Your Status", 1022 components: { 1023 Filter: CustomerStatusFilter, 1024 Pill: CustomerStatusFilterPill 1025 } 1026 }, 1027 { 1028 param: "severity", 1029 label: "Severity", 1030 components: { 1031 Filter: SeverityFilter, 1032 Pill: SeverityFilterPill 1033 } 1034 }, 1035 { 1036 param: "event_type", 1037 label: "Event Type", 1038 components: { 1039 Filter: EventTypeFilter, 1040 Pill: EventTypeFilterPill 1041 } 1042 }, 1043 { 1044 param: "announced_date", 1045 label: "Announced Date", 1046 components: { 1047 Filter: AnnouncedDateFilter, 1048 Pill: AnnouncedDateFilterPill 1049 } 1050 }, 1051 { 1052 param: "last_updated", 1053 label: "Last Updated", 1054 components: { 1055 Filter: LastUpdatedFilter, 1056 Pill: LastUpdatedFilterPill 1057 } 1058 } 1059]; 1060function getEventQueueFilters(eventMitigationProject) { 1061 if (eventMitigationProject) return tableMetaFilters; 1062 return tableMetaFilters.filter((filter) => filter.param !== "customer_status"); 1063} 1064var EVENT_STATUS_FILTERS_SETTING = "disruption_event_status_filters_v2"; 1065function redirectIfEventStatusParamsNeedUpdate(url, statuses) { 1066 if (!eventQueueStatusParamsNeedRedirect(url.searchParams.getAll("status"), statuses)) return null; 1067 const next = new URL(url); 1068 next.searchParams.delete("status"); 1069 for (const status of statuses) next.searchParams.append("status", status); 1070 return redirect(`${next.pathname}${next.search}${next.hash}`); 1071} 1072async function loader({ request }) { 1073 const hydrated = await hydrateSyncParamsUiSetting(EVENT_STATUS_FILTERS_SETTING, DEFAULT_DISRUPTION_EVENT_STATUS_FILTERS_V2_SYNC_PARAMS); 1074 queryClient.setQueryData(uiSettingQueryKey(EVENT_STATUS_FILTERS_SETTING), { 1075 ...DEFAULT_DISRUPTION_EVENT_STATUS_FILTERS_V2_SYNC_PARAMS, 1076 ...hydrated 1077 });
1078 await syncRouteParamsV2(request, { 1079 storageKey: EVENT_STATUS_FILTERS_SETTING, 1080 schema: disruptionEventStatusFiltersV2Schema, 1081 storage: createUiSettingSyncParamsAdapter(EVENT_STATUS_FILTERS_SETTING) 1082 }); 1083 const url = new URL(request.url); 1084 const searchParams = url.searchParams; 1085 const severityParams = searchParams.getAll("severity").map((param) => parseInt(param)); 1086 const statusParams = resolveEventQueueStatusForUrl(searchParams.getAll("status")); 1087 const statusRedirect = redirectIfEventStatusParamsNeedUpdate(url, statusParams); 1088 if (statusRedirect) throw statusRedirect; 1089 const eventMitigationProject = await getFlag("eventMitigationProject"); 1090 const customerStatusParams = eventMitigationProject ? normalizeCustomerStatusList(searchParams.getAll("customer_status")) : []; 1091 const requestedSort = searchParams.get("sort"); 1092 const sort = requestedSort && (eventMitigationProject || !requestedSort.startsWith("customer_status|")) ? [requestedSort] : [`${DEFAULT_EVENT_QUEUE_SORT_FIELD}|${DEFAULT_EVENT_QUEUE_SORT_DIRECTION}`]; 1093 const response = await listUpstreamEventsQueue({ query: { 1094 page: searchParams.get("page") ? parseInt(searchParams.get("page")) : 1, 1095 page_size: searchParams.get("page_size") ? parseInt(searchParams.get("page_size")) : 25, 1096 search: searchParams.get("search") ?? void 0, 1097 has_affected_items: searchParams.get("has_affected_items") ? searchParams.get("has_affected_items") === "true" : void 0, 1098 has_impacted_locations: searchParams.get("has_impacted_locations") ? searchParams.get("has_impacted_locations") === "true" : void 0, 1099 status: statusParams, 1100 ...customerStatusParams.length > 0 ? { customer_status: customerStatusParams } : {}, 1101 severity: searchParams.getAll("severity") ? severityParams : void 0, 1102 event_type: searchParams.getAll("event_type") ? searchParams.getAll("event_type") : void 0, 1103 announced_date: searchParams.get("announced_date") ? parseInt(searchParams.get("announced_date")) : void 0, 1104 last_updated: searchParams.get("last_updated") ? parseInt(searchParams.get("last_updated")) : void 0, 1105 sort 1106 } }); 1107 return { 1108 data: response.data?.events ?? [], 1109 count: response.data?.result_set_size ?? 0, 1110 ...createBreadcrumbConfig({ 1111 label: "Events", 1112 module: "DISRUPTION_MONITOR" 1113 }) 1114 }; 1115} 1116function useEventsQuery() { 1117 return useLoaderData(); 1118} 1119function Component() { 1120 const isFetching = useNavigation().state === "loading"; 1121 const data = useEventsQuery().data; 1122 const { eventMitigationProject } = ie(); 1123 const columns$1 = import_react.useMemo(() => getEventQueueColumns(Boolean(eventMitigationProject)), [eventMitigationProject]); 1124 const filters = import_react.useMemo(() => getEventQueueFilters(Boolean(eventMitigationProject)), [eventMitigationProject]); 1125 const table = useReactTable({ 1126 data: data ?? [], 1127 columns: columns$1, 1128 getCoreRowModel: getCoreRowModel(), 1129 manualFiltering: true, 1130 manualSorting: true, 1131 manualPagination: true,
1132 autoResetPageIndex: false, 1133 enableSortingRemoval: false, 1134 meta: { 1135 filters, 1136 defaultFilters: DEFAULT_DISRUPTION_EVENT_STATUS_FILTERS_V2_SYNC_PARAMS 1137 } 1138 }); 1139 const handleResetFilters = import_react.useCallback(() => { 1140 clearUiSettingQueryCache(EVENT_STATUS_FILTERS_SETTING); 1141 scheduleUiSettingPut(EVENT_STATUS_FILTERS_SETTING, DEFAULT_DISRUPTION_EVENT_STATUS_FILTERS_V2_SYNC_PARAMS, 0); 1142 }, []); 1143 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 1144 className: "flex h-[--app-viewport-height] min-h-full w-full flex-col overflow-y-hidden bg-background", 1145 children: [ 1146 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("header", { 1147 className: "border-b bg-white", 1148 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1149 className: "flex flex-wrap items-center justify-between gap-2 px-8 pb-4 pt-6", 1150 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisruptionMonitorTabs, {}) 1151 }) 1152 }), 1153 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1154 className: "relative mx-auto flex min-h-0 w-full flex-col p-2 pb-1 md:p-8 md:py-2", 1155 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutRoot, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableProvider, { 1156 table, 1157 isLoading: isFetching, 1158 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableLayoutHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableLayoutHeaderRow, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SearchInput, { 1159 name: "search", 1160 placeholder: "Search by Event Description", 1161 className: "h-8" 1162 }) }
1162), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutActions, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterDrawer, {}) })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutHeaderRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutFilterPills, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterPills, { onReset: handleResetFilters }) }) })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutBody, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, { containerClassName: "h-full" }) })] 1163 }) }) 1164 }), 1165 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1166 className: "relative mx-auto w-full p-2 pt-0 md:px-8 md:pb-3 md:pt-0", 1167 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EventQueuePagination, {}) 1168 }) 1169 ] 1170 }); 1171} 1172Component.displayName = "DisruptionMonitorEvents"; 1173const ErrorBoundary = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LogErrorBoundary, { routeComponent: "DisruptionMonitorEvents" }); 1174export { Component, ErrorBoundary, getEventQueueFilters, loader, useEventsQuery }; 1175 1176//# sourceMappingURL=events.route-cwAyq7hf.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.