@aglyn/plugins-outreach 1.0.0-beta.232 → 1.0.0-beta.234
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.
- package/package.json +14 -14
- package/src/lib/components/do-not-contact-domains.js +23 -8
- package/src/lib/components/do-not-contact-domains.js.map +1 -1
- package/src/lib/components/enrollments-table.js +93 -48
- package/src/lib/components/enrollments-table.js.map +1 -1
- package/src/lib/components/sequences-section.js +46 -15
- package/src/lib/components/sequences-section.js.map +1 -1
- package/src/lib/model/do-not-contact-domain-list-query.js +60 -2
- package/src/lib/model/do-not-contact-domain-list-query.js.map +1 -1
- package/src/lib/model/enrollment-list-query.js +55 -2
- package/src/lib/model/enrollment-list-query.js.map +1 -1
- package/src/lib/model/sequence-list-query.js +36 -2
- package/src/lib/model/sequence-list-query.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/outreach/src/lib/components/enrollments-table.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport EmptyStateComponent from '@aglyn/shared-ui-jsx/components/empty-state.component'\nimport ListFilterChips from '@aglyn/shared-ui-jsx/components/list-filter-chips.component'\nimport ListQueryNotices, {\n listQueryRefusals,\n} from '@aglyn/shared-ui-jsx/components/list-query-notices.component'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport {\n ListRowActions,\n ListTable,\n listActionsColumn,\n type ListTableProps,\n} from '@aglyn/shared-ui-jsx/components/list-table.component'\nimport { hiddenFilterVisibility, type ListFilterField } from '@aglyn/shared-ui-jsx/const/list-filter'\nimport {\n listFilterGridColumns,\n type ListFilterClause,\n type ListFilterOption,\n} from '@aglyn/shared-ui-jsx/const/list-grid-filter'\nimport { useListGridFilter } from '@aglyn/shared-ui-jsx/hooks/use-list-grid-filter'\nimport {\n Card,\n CardContent,\n Chip,\n Link,\n Stack,\n Tooltip,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material'\nimport { type MouseEvent, type ReactNode, useMemo } from 'react'\nimport {\n outreachClickCountLabel,\n outreachClickSummary,\n outreachMachineOpenLabel,\n outreachOpenCountLabel,\n outreachOpenSummary,\n type OutreachClickSummary,\n type OutreachOpenSummary,\n} from '../model/enrollment-engagement'\nimport {\n OUTREACH_ENROLLMENT_CLICK_FIELDS,\n OUTREACH_ENROLLMENT_LIST_QUERY,\n} from '../model/enrollment-list-query'\nimport {\n OUTREACH_ENROLLMENT_STATUSES,\n OUTREACH_STOP_REASONS,\n OUTREACH_TASK_KIND_LABELS,\n type OutreachEnrollment,\n type OutreachMailbox,\n type OutreachSequence,\n type OutreachSequenceStep,\n} from '../model/outreach.types'\nimport { outreachNextSendState, type OutreachNextSendState } from '../engine/next-send'\nimport { useOutreachEnrollmentActions } from './enrollment-actions'\nimport { OUTREACH_CLICKED_FILTER_VALUE, OUTREACH_UNCLICKED_FILTER_VALUE } from './enrollment-filter-params'\nimport {\n OutreachNextSend,\n outreachNextSendDetail,\n outreachNextSendLabel,\n useOutreachNowMs,\n} from './next-send'\nimport {\n formatOutreachTime,\n OUTREACH_ENROLLMENT_STATUS_LABELS,\n OUTREACH_STOP_REASON_LABELS,\n OutreachEnrollmentStatusChip,\n OutreachLoading,\n OutreachLoadProblem,\n} from './outreach-ui'\nimport type { OutreachApi } from './use-outreach-api'\nimport { useOutreachEnrollmentList } from './use-outreach-data'\n\nexport interface OutreachEnrollmentsTableProps {\n /** The organization, whose enrollments the table asks for. */\n orgId: string\n /** The sequence whose people these are: every page is narrowed to it. */\n sequenceId: string\n steps: readonly OutreachSequenceStep[]\n /**\n * Whether this sequence counts link clicks (AGL-3239). The Clicks column\n * is shown only when it does: a column of dashes for a sequence that\n * measures nothing reads as \"nobody clicked\", which is a different claim\n * and a false one.\n */\n trackClicks?: boolean\n /**\n * Whether this sequence counts opens, or once did (AGL-3488). The Opens\n * column is shown only then, for the reason the Clicks column is: a\n * column of dashes where nothing was measured reads as \"nobody opened\".\n */\n countOpens?: boolean\n /** The mailbox's IANA zone, which next sends are read in; `null` for the reader's own. */\n timeZone: string | null\n /**\n * The sequence's mailbox, whose pacing a due enrollment waits on\n * (AGL-3366): `undefined` while the mailboxes load, `null` when it has none.\n */\n mailbox?: OutreachMailbox | null\n /** The sequence, whose status and window a due enrollment waits on too. */\n sequence?: Pick<OutreachSequence, 'status' | 'steps' | 'settings'> | null\n api: OutreachApi\n /** Shown in the empty state when the sequence takes people. */\n enrollAction?: ReactNode\n /**\n * Opens one person's page (AGL-3332): a row's click, Enter on a focused\n * row, or the name on a phone's card. The row's menu never opens it.\n */\n onOpen?: (enrollment: OutreachEnrollment) => void\n /** The person's page, for the name on a phone's card, which is a real link. */\n hrefFor?: (enrollment: OutreachEnrollment) => string\n /**\n * The clauses the table is narrowed by, when the page holds them — so the\n * Results card's \"Clicked\" and \"Links followed\" can set one (AGL-3332).\n * Omitted, the table holds its own.\n */\n clauses?: readonly ListFilterClause[]\n onClausesChange?: (clauses: ListFilterClause[]) => void\n /** Destinations the sequence's links went to, for the \"Link followed\" filter's choices. */\n linkOptions?: readonly ListFilterOption[]\n}\n\n/** The step an enrollment is on, as a person reads it. */\nexport function outreachCurrentStepLabel(\n enrollment: Pick<OutreachEnrollment, 'status' | 'stepIndex'>,\n steps: readonly OutreachSequenceStep[],\n): string {\n if (enrollment.status === 'finished' || enrollment.stepIndex >= steps.length)\n return 'All steps done'\n const step = steps[enrollment.stepIndex]\n const kind =\n step?.kind === 'email'\n ? 'Email'\n : step?.kind === 'task'\n ? OUTREACH_TASK_KIND_LABELS[step.taskKind]\n : 'Step'\n return `Step ${enrollment.stepIndex + 1} of ${steps.length} · ${kind}`\n}\n\n/** Why an enrollment stopped, as the table says it; `''` while it runs. */\nexport function outreachStopLabel(\n enrollment: Pick<OutreachEnrollment, 'stopReason' | 'stopDetail'>,\n): string {\n if (!enrollment.stopReason) return ''\n const reason = OUTREACH_STOP_REASON_LABELS[enrollment.stopReason] ?? ''\n return enrollment.stopDetail ? `${reason} — ${enrollment.stopDetail}` : reason\n}\n\n/** The last thing that happened: a send, a stop, or the enrollment itself. */\nfunction lastActivityMs(enrollment: OutreachEnrollment): number {\n return Math.max(\n enrollment.lastSentAtMs ?? 0,\n enrollment.stoppedAtMs ?? 0,\n enrollment.createdAtMs ?? 0,\n )\n}\n\n/** Whether the step the enrollment is on goes out as this person's own copy (AGL-3324). */\nexport function outreachStepIsCurated(\n enrollment: Pick<OutreachEnrollment, 'stepIndex' | 'stepOverrides'>,\n): boolean {\n return Boolean(enrollment.stepOverrides?.[String(enrollment.stepIndex)])\n}\n\n/*\n * What the enrollments grid's Filters panel offers (AGL-3317), each field on\n * the table's Firestore query (AGL-3321, `OUTREACH_ENROLLMENT_LIST_QUERY`).\n * Status, whether the person is a lead and the stop reason are picked; the\n * address is typed whole. `target` and `email` are no column of their own,\n * so they are hidden columns the panel can still reach; the search box\n * reads the person's name and address.\n *\n * A sequence that counts clicks adds two more (AGL-3332), on the same query:\n * whether the person clicked, and a destination they followed — matched\n * whole against the destinations stored on the enrollment, never by a piece\n * of its address, so \"followed /pricing\" does not also list the people who\n * followed \"/pricing/enterprise\".\n */\nconst BASE_FILTER_FIELDS = OUTREACH_ENROLLMENT_LIST_QUERY.fields.filter(\n (field) => !(OUTREACH_ENROLLMENT_CLICK_FIELDS as readonly string[]).includes(field.column),\n)\nconst ENROLLMENT_FILTER_HEADERS: Readonly<Record<string, string>> = {\n status: 'Status',\n target: 'Enrolled as',\n stopReason: 'Stop reason',\n email: 'Email',\n enrolled: 'Enrolled',\n clicked: 'Clicked',\n link: 'Link followed',\n}\nconst BASE_FILTER_OPTIONS: Record<string, readonly ListFilterOption[]> = {\n status: OUTREACH_ENROLLMENT_STATUSES.map((status) => ({\n value: status,\n label: OUTREACH_ENROLLMENT_STATUS_LABELS[status],\n })),\n target: [\n { value: 'contact', label: 'Contact' },\n { value: 'lead', label: 'Lead' },\n ],\n stopReason: OUTREACH_STOP_REASONS.map((reason) => ({\n value: reason,\n label: OUTREACH_STOP_REASON_LABELS[reason],\n })),\n}\nconst CLICKED_OPTIONS: readonly ListFilterOption[] = [\n { value: OUTREACH_CLICKED_FILTER_VALUE, label: 'Yes' },\n { value: OUTREACH_UNCLICKED_FILTER_VALUE, label: 'No' },\n]\n/** Columns a reader can show from the column chooser, off until they do (AGL-3332). */\nconst CLICK_DETAIL_COLUMNS = ['linksFollowed', 'lastClick', 'scannerClicks'] as const\n/** The opens column a reader can show from the column chooser, off until they do. */\nconst OPEN_DETAIL_COLUMNS = ['lastOpen'] as const\n\n/** The table's grammar, with the click fields when the sequence counts clicks. */\nfunction filterFieldsFor(trackClicks: boolean): readonly ListFilterField[] {\n return trackClicks ? OUTREACH_ENROLLMENT_LIST_QUERY.fields : BASE_FILTER_FIELDS\n}\n\n/** What the grid's cells and its export read off one enrollment. */\nfunction filterRow(\n enrollment: OutreachEnrollment,\n steps: readonly OutreachSequenceStep[],\n clicks: OutreachClickSummary,\n) {\n return {\n enrollment,\n status: enrollment.status,\n target: enrollment.target === 'lead' ? 'lead' : 'contact',\n contactName: enrollment.contactName,\n email: enrollment.email,\n step: outreachCurrentStepLabel(enrollment, steps),\n stopReason: outreachStopLabel(enrollment),\n clicked: clicks.clicks > 0 ? OUTREACH_CLICKED_FILTER_VALUE : OUTREACH_UNCLICKED_FILTER_VALUE,\n link: clicks.followed,\n }\n}\n\n/** The stop reason: its short label, with every word of it on hover and on the person's page. */\nfunction StopReasonCell(props: { enrollment: OutreachEnrollment }) {\n const { enrollment } = props\n if (!enrollment.stopReason) {\n return (\n <Typography variant=\"body2\" color=\"text.secondary\">\n —\n </Typography>\n )\n }\n const label = OUTREACH_STOP_REASON_LABELS[enrollment.stopReason] ?? ''\n const text = (\n <Typography\n variant=\"body2\"\n sx={{\n whiteSpace: 'normal',\n lineHeight: 1.3,\n ...(enrollment.stopDetail\n ? { textDecoration: 'underline dotted', textUnderlineOffset: 3, cursor: 'help' }\n : {}),\n }}\n >\n {label}\n </Typography>\n )\n return enrollment.stopDetail ? (\n <Tooltip title={outreachStopLabel(enrollment)} describeChild>\n {text}\n </Tooltip>\n ) : (\n text\n )\n}\n\n/**\n * The Opens cell (AGL-3488): the person's opens, and under them the fetches\n * a machine made — counted apart and never in the person's number, as\n * scanner clicks are never in their clicks.\n */\nfunction OpensCell(props: { opens: OutreachOpenSummary }) {\n const { opens } = props\n const machines = outreachMachineOpenLabel(opens)\n return (\n <Stack spacing={0} sx={{ justifyContent: 'center', height: '100%' }}>\n <Typography variant=\"body2\" color={opens.opens ? undefined : 'text.secondary'}>\n {opens.opens ? String(opens.opens) : '—'}\n </Typography>\n {machines ? (\n <Tooltip\n title=\"Fetches of the tracking image by a mail provider’s proxy or a security scanner. They aren’t counted as the person’s opens.\"\n describeChild\n >\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n noWrap\n sx={{ textDecoration: 'underline dotted', textUnderlineOffset: 3, cursor: 'help' }}\n >\n {machines}\n </Typography>\n </Tooltip>\n ) : null}\n </Stack>\n )\n}\n\n/** The table's columns; the person and the actions are drawn from the row's enrollment. */\nfunction columns(\n rowActions: (enrollment: OutreachEnrollment) => ReactNode,\n trackClicks: boolean,\n countOpens: boolean,\n timeZone: string | null,\n): NonNullable<ListTableProps['columns']> {\n return [\n {\n field: 'person',\n headerName: 'Person',\n flex: 1.2,\n minWidth: 190,\n sortable: false,\n // What the export writes for a column that is drawn rather than read.\n valueGetter: (_value: unknown, row: { enrollment: OutreachEnrollment }) =>\n row.enrollment.contactName\n ? `${row.enrollment.contactName} <${row.enrollment.email}>`\n : row.enrollment.email,\n renderCell: ({ row }) => (\n <Stack\n spacing={0}\n sx={{ justifyContent: 'center', height: '100%', minWidth: 0 }}\n >\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center', minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {row.enrollment.contactName || row.enrollment.email}\n </Typography>\n {row.enrollment.target === 'lead' ? (\n <Chip size=\"small\" variant=\"outlined\" label=\"Lead\" />\n ) : null}\n </Stack>\n {row.enrollment.contactName ? (\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {row.enrollment.email}\n </Typography>\n ) : null}\n </Stack>\n ),\n },\n {\n field: 'status',\n headerName: 'Status',\n width: 110,\n renderCell: ({ row }) => (\n <OutreachEnrollmentStatusChip status={row.status} />\n ),\n },\n {\n field: 'step',\n headerName: 'Current step',\n flex: 1,\n minWidth: 170,\n renderCell: ({ row }) => (\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center', height: '100%', minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {row.step}\n </Typography>\n {outreachStepIsCurated(row.enrollment) ? (\n <Chip size=\"small\" variant=\"outlined\" color=\"success\" label=\"Curated\" />\n ) : null}\n </Stack>\n ),\n },\n {\n field: 'nextSend',\n headerName: 'Next send',\n width: 190,\n sortable: false,\n renderCell: ({ row }: { row: { nextSendState: OutreachNextSendState } }) => (\n <Stack sx={{ justifyContent: 'center', height: '100%' }}>\n <OutreachNextSend state={row.nextSendState} timeZone={timeZone} />\n </Stack>\n ),\n },\n {\n field: 'lastActivity',\n headerName: 'Last activity',\n width: 170,\n sortable: false,\n },\n ...(countOpens\n ? [\n {\n field: 'opens',\n headerName: 'Opens',\n description:\n 'A person’s opens of the emails. Fetches by mail proxies and security scanners are shown under them and not counted.',\n width: 130,\n sortable: false,\n renderCell: ({ row }: { row: { openSummary: OutreachOpenSummary } }) => (\n <OpensCell opens={row.openSummary} />\n ),\n },\n { field: 'lastOpen', headerName: 'Last open', width: 170, sortable: false },\n ]\n : []),\n ...(trackClicks\n ? [\n {\n field: 'clicks',\n headerName: 'Clicks',\n description: 'A person’s clicks, and how many different links they followed. Scanners are not counted.',\n width: 110,\n sortable: false,\n renderCell: ({ row }: { row: { clicks: string } }) => (\n <Typography variant=\"body2\" color={row.clicks === '—' ? 'text.secondary' : undefined}>\n {row.clicks}\n </Typography>\n ),\n },\n {\n field: 'linksFollowed',\n headerName: 'Links followed',\n flex: 1,\n minWidth: 220,\n sortable: false,\n },\n { field: 'lastClick', headerName: 'Last click', width: 170, sortable: false },\n {\n field: 'scannerClicks',\n headerName: 'Scanner clicks',\n description: 'Clicks a security scanner made, which are not counted as the person’s.',\n width: 130,\n sortable: false,\n },\n ]\n : []),\n {\n field: 'stopReason',\n headerName: 'Stop reason',\n flex: 1,\n minWidth: 170,\n renderCell: ({ row }) => <StopReasonCell enrollment={row.enrollment} />,\n },\n listActionsColumn((row) => rowActions(row.enrollment), { width: 72 }),\n ]\n}\n\n/** A plain click on a link, which the page handles itself; any other is the browser's. */\nconst plainClick = (event: MouseEvent) =>\n !event.defaultPrevented &&\n event.button === 0 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey\n\n/**\n * A sequence's enrollments (AGL-2980): who is in it, where each person\n * stands, when their next step goes out in the mailbox's timezone, and the\n * four things a member can do about it — pause, resume, stop, and mark\n * do-not-contact. A table on wider screens, a list of cards on a phone.\n *\n * Each row opens the person's own page (AGL-3332), which holds everything\n * else known about them: so a cell says one thing, whole, and the detail\n * behind it is a click away rather than cut off at the column's edge.\n */\nexport function OutreachEnrollmentsTable(props: OutreachEnrollmentsTableProps) {\n const { steps, timeZone, api, onOpen, hrefFor } = props\n const trackClicks = props.trackClicks === true\n const countOpens = props.countOpens === true\n const nowMs = useOutreachNowMs()\n const theme = useTheme()\n const narrow = useMediaQuery(theme.breakpoints.down('md'))\n const actions = useOutreachEnrollmentActions({ api, steps })\n const fields = useMemo(() => filterFieldsFor(trackClicks), [trackClicks])\n const gridFilter = useListGridFilter({\n selectFields: ['status', 'target', 'stopReason', 'clicked', 'link'],\n ...(props.clauses !== undefined\n ? { clauses: props.clauses, onChange: props.onClausesChange }\n : {}),\n })\n const filtering =\n gridFilter.clauses.length > 0 || gridFilter.searchWords.some((word) => word.trim())\n /*\n * One page of the sequence's enrollments, newest enrolled first, with\n * every clause and the search word on the query (AGL-3321): a filter\n * reaches the enrollment on page forty as surely as the one on page one,\n * and nothing is matched over the rows that happen to be loaded. The\n * click filters (AGL-3332) are on it too, answered by the `clicked` flag\n * and the destinations the click route stores on each enrollment.\n */\n const enrollments = useOutreachEnrollmentList(props.orgId, props.sequenceId, {\n clauses: gridFilter.clauses,\n search: gridFilter.searchWords,\n })\n const loadedData = enrollments.rows\n const summaries = useMemo(\n () =>\n new Map(\n loadedData.map((enrollment) => [enrollment.id, outreachClickSummary(enrollment.engagement)]),\n ),\n [loadedData],\n )\n const clicksOf = (enrollment: OutreachEnrollment) =>\n summaries.get(enrollment.id) ?? outreachClickSummary(enrollment.engagement)\n\n /*\n * The destinations the \"Link followed\" filter offers: the sequence's own\n * rollup, and any a loaded person followed that it does not list — the\n * rollup is capped, and a filter that could not name a destination a\n * person followed would hide them from it.\n */\n const linkOptions = useMemo(() => {\n const options = new Map<string, string>()\n for (const option of props.linkOptions ?? []) options.set(option.value, option.label)\n for (const summary of summaries.values()) {\n for (const url of summary.followed) if (!options.has(url)) options.set(url, url)\n }\n return [...options].map(([value, label]) => ({ value, label }))\n }, [props.linkOptions, summaries])\n const filterOptions = useMemo(\n () =>\n trackClicks\n ? { ...BASE_FILTER_OPTIONS, clicked: CLICKED_OPTIONS, link: linkOptions }\n : BASE_FILTER_OPTIONS,\n [trackClicks, linkOptions],\n )\n const hiddenColumns = useMemo(\n () => ({\n ...hiddenFilterVisibility(fields, ['status', 'stopReason']),\n ...(trackClicks\n ? Object.fromEntries(CLICK_DETAIL_COLUMNS.map((column) => [column, false]))\n : {}),\n ...(countOpens\n ? Object.fromEntries(OPEN_DETAIL_COLUMNS.map((column) => [column, false]))\n : {}),\n }),\n [fields, trackClicks, countOpens],\n )\n /*\n * A person who followed this destination before each click was recorded\n * on its own, and another link after it, is known by their LAST link only\n * — so a \"Link followed\" filter says it may miss them rather than\n * implying the list is whole. Which people those are is exactly what the\n * query cannot see, so the caveat stands whenever the filter does.\n */\n const linkFilterMayMiss =\n trackClicks && gridFilter.clauses.some((clause) => clause.field === 'link')\n\n const chips = (\n <ListFilterChips\n fields={fields}\n headers={ENROLLMENT_FILTER_HEADERS}\n clauses={gridFilter.clauses}\n onChange={gridFilter.setClauses}\n options={filterOptions}\n />\n )\n if (enrollments.status === 'loading' && !filtering)\n return <OutreachLoading label=\"Loading enrollments…\" />\n if (enrollments.status === 'error' || enrollments.status === 'refused') {\n return (\n <Stack spacing={1.5}>\n {chips}\n <OutreachLoadProblem status={enrollments.status} what=\"enrollments\" />\n </Stack>\n )\n }\n if (\n enrollments.status === 'ready' &&\n !enrollments.rows.length &&\n !filtering &&\n enrollments.page === 0\n ) {\n return (\n <Card variant=\"outlined\">\n <EmptyStateComponent\n label=\"Nobody is enrolled yet\"\n description=\"People you enroll show here, with where each of them is in the sequence.\"\n action={props.enrollAction}\n />\n </Card>\n )\n }\n\n const rowActions = (enrollment: OutreachEnrollment) => (\n <ListRowActions\n label={enrollment.contactName || enrollment.email}\n items={actions.menuItems(enrollment)}\n />\n )\n /*\n * A next send whose time has come says it is queued, and why, rather than\n * showing a time already past (AGL-3366): the mailbox sends its share of\n * the day each run, follow-ups first, so a first email can wait its turn\n * for an hour or more without anything having failed.\n */\n const nextSendState = (enrollment: OutreachEnrollment) =>\n outreachNextSendState({\n enrollment,\n sequence: props.sequence ?? null,\n mailbox: props.mailbox,\n nowMs,\n })\n const personName = (enrollment: OutreachEnrollment) => {\n const name = enrollment.contactName || enrollment.email\n if (!hrefFor) return <Typography variant=\"body2\">{name}</Typography>\n return (\n <Link\n href={hrefFor(enrollment)}\n variant=\"body2\"\n underline=\"hover\"\n onClick={(event) => {\n if (!onOpen || !plainClick(event)) return\n event.preventDefault()\n onOpen(enrollment)\n }}\n >\n {name}\n </Link>\n )\n }\n const person = (enrollment: OutreachEnrollment) => (\n <Stack spacing={0}>\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center' }}>\n {personName(enrollment)}\n {enrollment.target === 'lead' ? (\n <Chip size=\"small\" variant=\"outlined\" label=\"Lead\" />\n ) : null}\n </Stack>\n {enrollment.contactName ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {enrollment.email}\n </Typography>\n ) : null}\n </Stack>\n )\n\n const pageRows = enrollments.rows\n\n return (\n <Stack spacing={1.5}>\n {chips}\n <ListQueryNotices\n refused={listQueryRefusals(enrollments.plan.refused, {\n fields,\n headers: ENROLLMENT_FILTER_HEADERS,\n options: filterOptions,\n })}\n notices={enrollments.plan.notices}\n />\n {linkFilterMayMiss ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n Clicks made before each one was recorded on its own kept only the person’s last link, so\n someone who followed this link and then another back then is not listed here.\n </Typography>\n ) : null}\n {narrow ? (\n <Stack\n spacing={1}\n component=\"ul\"\n sx={{ listStyle: 'none', p: 0, m: 0 }}\n aria-label=\"Enrollments\"\n >\n {pageRows.map((enrollment) => {\n const clicks = clicksOf(enrollment)\n const opens = outreachOpenSummary(enrollment.engagement)\n return (\n <Card key={enrollment.id} variant=\"outlined\" component=\"li\">\n <CardContent>\n <Stack spacing={1}>\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'flex-start' }}\n >\n <Stack sx={{ flexGrow: 1, minWidth: 0 }}>\n {person(enrollment)}\n </Stack>\n <OutreachEnrollmentStatusChip status={enrollment.status} />\n {rowActions(enrollment)}\n </Stack>\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center' }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {outreachCurrentStepLabel(enrollment, steps)}\n </Typography>\n {outreachStepIsCurated(enrollment) ? (\n <Chip size=\"small\" variant=\"outlined\" color=\"success\" label=\"Curated\" />\n ) : null}\n </Stack>\n <Stack\n useFlexGap\n direction=\"row\"\n spacing={0.5}\n sx={{ alignItems: 'baseline', flexWrap: 'wrap', color: 'text.secondary' }}\n >\n <Typography variant=\"body2\">Next send:</Typography>\n <OutreachNextSend state={nextSendState(enrollment)} timeZone={timeZone} />\n <Typography variant=\"body2\">\n {`· Last activity: ${formatOutreachTime(lastActivityMs(enrollment), timeZone)}`}\n </Typography>\n </Stack>\n {countOpens && (opens.opens || opens.machineOpens) ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`Opens: ${outreachOpenCountLabel(opens)}`}\n </Typography>\n ) : null}\n {trackClicks && clicks.clicks ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`Clicks: ${outreachClickCountLabel(clicks)}`}\n </Typography>\n ) : null}\n {outreachStopLabel(enrollment) ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {outreachStopLabel(enrollment)}\n </Typography>\n ) : null}\n </Stack>\n </CardContent>\n </Card>\n )\n })}\n </Stack>\n ) : (\n <ListTable\n aria-label=\"Enrollments\"\n columns={listFilterGridColumns(\n columns(rowActions, trackClicks, countOpens, timeZone),\n fields,\n filterOptions,\n ENROLLMENT_FILTER_HEADERS,\n )}\n initialState={{ columns: { columnVisibilityModel: hiddenColumns } }}\n loading={enrollments.status === 'loading'}\n rows={pageRows.map((enrollment) => {\n const clicks = clicksOf(enrollment)\n const opens = outreachOpenSummary(enrollment.engagement)\n const next = nextSendState(enrollment)\n return {\n $id: enrollment.id,\n ...filterRow(enrollment, steps, clicks),\n nextSendState: next,\n // What the export writes: the label, and for a queued send, why.\n nextSend: [outreachNextSendLabel(next, timeZone), outreachNextSendDetail(next, timeZone)]\n .filter(Boolean)\n .join(' — '),\n lastActivity: formatOutreachTime(\n lastActivityMs(enrollment),\n timeZone,\n ),\n // What the export writes; the cells draw these their own way.\n openSummary: opens,\n opens: outreachOpenCountLabel(opens),\n lastOpen: opens.opens ? formatOutreachTime(opens.lastOpenAtMs, timeZone) : '—',\n clicks: outreachClickCountLabel(clicks),\n linksFollowed: clicks.followed.join(' ') || '—',\n lastClick: clicks.clicks\n ? formatOutreachTime(enrollment.engagement?.lastClickAtMs, timeZone)\n : '—',\n scannerClicks: clicks.machineClicks ? String(clicks.machineClicks) : '—',\n stopReason: outreachStopLabel(enrollment) || '—',\n }\n })}\n onOpen={\n onOpen\n ? (_id, row: { enrollment: OutreachEnrollment }) => onOpen(row.enrollment)\n : undefined\n }\n /*\n * The panel and the search are the grid's; every clause and the\n * search word are on the table's query (AGL-3321). The grid\n * neither filters nor sorts the page it is handed: the query's\n * one order, newest enrolled first, is the table's.\n */\n filterMode=\"server\"\n filterModel={gridFilter.filterModel}\n onFilterModelChange={gridFilter.onFilterModelChange}\n quickFilter\n disableColumnSorting\n noRowsLabel=\"No enrollments match these filters\"\n hideFooter\n />\n )}\n <ListPagination\n page={enrollments.page}\n pageSize={enrollments.pageSize}\n rowCount={pageRows.length}\n hasMore={enrollments.hasMore}\n onPageChange={enrollments.setPage}\n onPageSizeChange={enrollments.setPageSize}\n />\n {actions.dialogs}\n </Stack>\n )\n}\nOutreachEnrollmentsTable.displayName = 'OutreachEnrollmentsTable'\n\nexport default OutreachEnrollmentsTable\n"],"names":["EmptyStateComponent","ListFilterChips","ListQueryNotices","listQueryRefusals","ListPagination","ListRowActions","ListTable","listActionsColumn","hiddenFilterVisibility","listFilterGridColumns","useListGridFilter","Card","CardContent","Chip","Link","Stack","Tooltip","Typography","useMediaQuery","useTheme","useMemo","outreachClickCountLabel","outreachClickSummary","outreachMachineOpenLabel","outreachOpenCountLabel","outreachOpenSummary","OUTREACH_ENROLLMENT_CLICK_FIELDS","OUTREACH_ENROLLMENT_LIST_QUERY","OUTREACH_ENROLLMENT_STATUSES","OUTREACH_STOP_REASONS","OUTREACH_TASK_KIND_LABELS","outreachNextSendState","useOutreachEnrollmentActions","OUTREACH_CLICKED_FILTER_VALUE","OUTREACH_UNCLICKED_FILTER_VALUE","OutreachNextSend","outreachNextSendDetail","outreachNextSendLabel","useOutreachNowMs","formatOutreachTime","OUTREACH_ENROLLMENT_STATUS_LABELS","OUTREACH_STOP_REASON_LABELS","OutreachEnrollmentStatusChip","OutreachLoading","OutreachLoadProblem","useOutreachEnrollmentList","outreachCurrentStepLabel","enrollment","steps","status","stepIndex","length","step","kind","taskKind","outreachStopLabel","stopReason","reason","stopDetail","lastActivityMs","Math","max","lastSentAtMs","stoppedAtMs","createdAtMs","outreachStepIsCurated","Boolean","stepOverrides","String","BASE_FILTER_FIELDS","fields","filter","field","includes","column","ENROLLMENT_FILTER_HEADERS","target","email","enrolled","clicked","link","BASE_FILTER_OPTIONS","map","value","label","CLICKED_OPTIONS","CLICK_DETAIL_COLUMNS","OPEN_DETAIL_COLUMNS","filterFieldsFor","trackClicks","filterRow","clicks","contactName","followed","StopReasonCell","props","variant","color","text","sx","whiteSpace","lineHeight","textDecoration","textUnderlineOffset","cursor","title","describeChild","OpensCell","opens","machines","spacing","justifyContent","height","undefined","noWrap","columns","rowActions","countOpens","timeZone","headerName","flex","minWidth","sortable","valueGetter","_value","row","renderCell","direction","alignItems","size","width","state","nextSendState","description","openSummary","plainClick","event","defaultPrevented","button","metaKey","ctrlKey","shiftKey","altKey","OutreachEnrollmentsTable","api","onOpen","hrefFor","nowMs","theme","narrow","breakpoints","down","actions","gridFilter","selectFields","clauses","onChange","onClausesChange","filtering","searchWords","some","word","trim","enrollments","orgId","sequenceId","search","loadedData","rows","summaries","Map","id","engagement","clicksOf","get","linkOptions","options","option","set","summary","values","url","has","filterOptions","hiddenColumns","Object","fromEntries","linkFilterMayMiss","clause","chips","headers","setClauses","what","page","action","enrollAction","items","menuItems","sequence","mailbox","personName","name","href","underline","onClick","preventDefault","person","pageRows","refused","plan","notices","component","listStyle","p","m","aria-label","flexGrow","useFlexGap","flexWrap","machineOpens","initialState","columnVisibilityModel","loading","next","$id","nextSend","join","lastActivity","lastOpen","lastOpenAtMs","linksFollowed","lastClick","lastClickAtMs","scannerClicks","machineClicks","_id","filterMode","filterModel","onFilterModelChange","quickFilter","disableColumnSorting","noRowsLabel","hideFooter","pageSize","rowCount","hasMore","onPageChange","setPage","onPageSizeChange","setPageSize","dialogs","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,OAAOA,yBAAyB,wDAAuD;AACvF,OAAOC,qBAAqB,8DAA6D;AACzF,OAAOC,oBACLC,iBAAiB,QACZ,+DAA8D;AACrE,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SACEC,cAAc,EACdC,SAAS,EACTC,iBAAiB,QAEZ,uDAAsD;AAC7D,SAASC,sBAAsB,QAA8B,yCAAwC;AACrG,SACEC,qBAAqB,QAGhB,8CAA6C;AACpD,SAASC,iBAAiB,QAAQ,kDAAiD;AACnF,SACEC,IAAI,EACJC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,aAAa,EACbC,QAAQ,QACH,gBAAe;AACtB,SAA0CC,OAAO,QAAQ,QAAO;AAChE,SACEC,uBAAuB,EACvBC,oBAAoB,EACpBC,wBAAwB,EACxBC,sBAAsB,EACtBC,mBAAmB,QAGd,oCAAgC;AACvC,SACEC,gCAAgC,EAChCC,8BAA8B,QACzB,oCAAgC;AACvC,SACEC,4BAA4B,EAC5BC,qBAAqB,EACrBC,yBAAyB,QAKpB,6BAAyB;AAChC,SAASC,qBAAqB,QAAoC,yBAAqB;AACvF,SAASC,4BAA4B,QAAQ,0BAAsB;AACnE,SAASC,6BAA6B,EAAEC,+BAA+B,QAAQ,gCAA4B;AAC3G,SACEC,gBAAgB,EAChBC,sBAAsB,EACtBC,qBAAqB,EACrBC,gBAAgB,QACX,iBAAa;AACpB,SACEC,kBAAkB,EAClBC,iCAAiC,EACjCC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,eAAe,EACfC,mBAAmB,QACd,mBAAe;AAEtB,SAASC,yBAAyB,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BAC5CK,WAAW5I,OAAOA,MAAM,GACpBpD,oBAAmBQ,yBAAAA,WAAW6H,UAAU,qBAArB7H,uBAAuByL,aAAa,EAAElH,YACzD;wBACJmH,eAAe9I,OAAO+I,aAAa,GAAGtK,OAAOuB,OAAO+I,aAAa,IAAI;wBACrElL,YAAYD,kBAAkBR,eAAe;;gBAEjD;gBACAkG,QACEA,SACI,CAAC0F,KAAK9G,MAA4CoB,OAAOpB,IAAI9E,UAAU,IACvEkE;gBAEN;;;;;WAKC,GACD2H,YAAW;gBACXC,aAAapF,WAAWoF,WAAW;gBACnCC,qBAAqBrF,WAAWqF,mBAAmB;gBACnDC,WAAW;gBACXC,oBAAoB;gBACpBC,aAAY;gBACZC,UAAU;;0BAGd,KAAC9O;gBACC6L,MAAM9B,YAAY8B,IAAI;gBACtBkD,UAAUhF,YAAYgF,QAAQ;gBAC9BC,UAAUrC,SAAS5J,MAAM;gBACzBkM,SAASlF,YAAYkF,OAAO;gBAC5BC,cAAcnF,YAAYoF,OAAO;gBACjCC,kBAAkBrF,YAAYsF,WAAW;;YAE1CjG,QAAQkG,OAAO;;;AAGtB;AACA3G,yBAAyB4G,WAAW,GAAG;AAEvC,eAAe5G,yBAAwB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/outreach/src/lib/components/enrollments-table.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport EmptyStateComponent from '@aglyn/shared-ui-jsx/components/empty-state.component'\nimport ListFilterChips from '@aglyn/shared-ui-jsx/components/list-filter-chips.component'\nimport ListQueryNotices, {\n listQueryRefusals,\n} from '@aglyn/shared-ui-jsx/components/list-query-notices.component'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport {\n ListRowActions,\n ListTable,\n listActionsColumn,\n type ListTableProps,\n} from '@aglyn/shared-ui-jsx/components/list-table.component'\nimport { hiddenFilterVisibility, type ListFilterField } from '@aglyn/shared-ui-jsx/const/list-filter'\nimport {\n listFilterGridColumns,\n type ListFilterClause,\n type ListFilterOption,\n} from '@aglyn/shared-ui-jsx/const/list-grid-filter'\nimport { useListGridFilter } from '@aglyn/shared-ui-jsx/hooks/use-list-grid-filter'\nimport { useListColumnSort } from '@aglyn/shared-ui-jsx/hooks/use-list-column-sort'\nimport type { ListQuerySort } from '@aglyn/shared-ui-jsx/const/list-query-plan'\nimport {\n Card,\n CardContent,\n Chip,\n Link,\n Stack,\n Tooltip,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material'\nimport { type MouseEvent, type ReactNode, useMemo, useState } from 'react'\nimport {\n outreachClickCountLabel,\n outreachClickSummary,\n outreachMachineOpenLabel,\n outreachOpenCountLabel,\n outreachOpenSummary,\n type OutreachClickSummary,\n type OutreachOpenSummary,\n} from '../model/enrollment-engagement'\nimport {\n OUTREACH_ENROLLMENT_CLICK_FIELDS,\n OUTREACH_ENROLLMENT_LIST_QUERY,\n} from '../model/enrollment-list-query'\nimport {\n OUTREACH_ENROLLMENT_STATUSES,\n OUTREACH_STOP_REASONS,\n OUTREACH_TASK_KIND_LABELS,\n type OutreachEnrollment,\n type OutreachMailbox,\n type OutreachSequence,\n type OutreachSequenceStep,\n} from '../model/outreach.types'\nimport { outreachNextSendState, type OutreachNextSendState } from '../engine/next-send'\nimport { useOutreachEnrollmentActions } from './enrollment-actions'\nimport { OUTREACH_CLICKED_FILTER_VALUE, OUTREACH_UNCLICKED_FILTER_VALUE } from './enrollment-filter-params'\nimport {\n OutreachNextSend,\n outreachNextSendDetail,\n outreachNextSendLabel,\n useOutreachNowMs,\n} from './next-send'\nimport {\n formatOutreachTime,\n OUTREACH_ENROLLMENT_STATUS_LABELS,\n OUTREACH_STOP_REASON_LABELS,\n OutreachEnrollmentStatusChip,\n OutreachLoading,\n OutreachLoadProblem,\n} from './outreach-ui'\nimport type { OutreachApi } from './use-outreach-api'\nimport { useOutreachEnrollmentList } from './use-outreach-data'\n\nexport interface OutreachEnrollmentsTableProps {\n /** The organization, whose enrollments the table asks for. */\n orgId: string\n /** The sequence whose people these are: every page is narrowed to it. */\n sequenceId: string\n steps: readonly OutreachSequenceStep[]\n /**\n * Whether this sequence counts link clicks (AGL-3239). The Clicks column\n * is shown only when it does: a column of dashes for a sequence that\n * measures nothing reads as \"nobody clicked\", which is a different claim\n * and a false one.\n */\n trackClicks?: boolean\n /**\n * Whether this sequence counts opens, or once did (AGL-3488). The Opens\n * column is shown only then, for the reason the Clicks column is: a\n * column of dashes where nothing was measured reads as \"nobody opened\".\n */\n countOpens?: boolean\n /** The mailbox's IANA zone, which next sends are read in; `null` for the reader's own. */\n timeZone: string | null\n /**\n * The sequence's mailbox, whose pacing a due enrollment waits on\n * (AGL-3366): `undefined` while the mailboxes load, `null` when it has none.\n */\n mailbox?: OutreachMailbox | null\n /** The sequence, whose status and window a due enrollment waits on too. */\n sequence?: Pick<OutreachSequence, 'status' | 'steps' | 'settings'> | null\n api: OutreachApi\n /** Shown in the empty state when the sequence takes people. */\n enrollAction?: ReactNode\n /**\n * Opens one person's page (AGL-3332): a row's click, Enter on a focused\n * row, or the name on a phone's card. The row's menu never opens it.\n */\n onOpen?: (enrollment: OutreachEnrollment) => void\n /** The person's page, for the name on a phone's card, which is a real link. */\n hrefFor?: (enrollment: OutreachEnrollment) => string\n /**\n * The clauses the table is narrowed by, when the page holds them — so the\n * Results card's \"Clicked\" and \"Links followed\" can set one (AGL-3332).\n * Omitted, the table holds its own.\n */\n clauses?: readonly ListFilterClause[]\n onClausesChange?: (clauses: ListFilterClause[]) => void\n /** Destinations the sequence's links went to, for the \"Link followed\" filter's choices. */\n linkOptions?: readonly ListFilterOption[]\n}\n\n/** The step an enrollment is on, as a person reads it. */\nexport function outreachCurrentStepLabel(\n enrollment: Pick<OutreachEnrollment, 'status' | 'stepIndex'>,\n steps: readonly OutreachSequenceStep[],\n): string {\n if (enrollment.status === 'finished' || enrollment.stepIndex >= steps.length)\n return 'All steps done'\n const step = steps[enrollment.stepIndex]\n const kind =\n step?.kind === 'email'\n ? 'Email'\n : step?.kind === 'task'\n ? OUTREACH_TASK_KIND_LABELS[step.taskKind]\n : 'Step'\n return `Step ${enrollment.stepIndex + 1} of ${steps.length} · ${kind}`\n}\n\n/** Why an enrollment stopped, as the table says it; `''` while it runs. */\nexport function outreachStopLabel(\n enrollment: Pick<OutreachEnrollment, 'stopReason' | 'stopDetail'>,\n): string {\n if (!enrollment.stopReason) return ''\n const reason = OUTREACH_STOP_REASON_LABELS[enrollment.stopReason] ?? ''\n return enrollment.stopDetail ? `${reason} — ${enrollment.stopDetail}` : reason\n}\n\n/** The last thing that happened: a send, a stop, or the enrollment itself. */\nfunction lastActivityMs(enrollment: OutreachEnrollment): number {\n return Math.max(\n enrollment.lastSentAtMs ?? 0,\n enrollment.stoppedAtMs ?? 0,\n enrollment.createdAtMs ?? 0,\n )\n}\n\n/** Whether the step the enrollment is on goes out as this person's own copy (AGL-3324). */\nexport function outreachStepIsCurated(\n enrollment: Pick<OutreachEnrollment, 'stepIndex' | 'stepOverrides'>,\n): boolean {\n return Boolean(enrollment.stepOverrides?.[String(enrollment.stepIndex)])\n}\n\n/*\n * What the enrollments grid's Filters panel offers (AGL-3317), each field on\n * the table's Firestore query (AGL-3321, `OUTREACH_ENROLLMENT_LIST_QUERY`).\n * Status, whether the person is a lead and the stop reason are picked; the\n * address is typed whole. `target` and `email` are no column of their own,\n * so they are hidden columns the panel can still reach; the search box\n * reads the person's name and address.\n *\n * A sequence that counts clicks adds two more (AGL-3332), on the same query:\n * whether the person clicked, and a destination they followed — matched\n * whole against the destinations stored on the enrollment, never by a piece\n * of its address, so \"followed /pricing\" does not also list the people who\n * followed \"/pricing/enterprise\".\n */\nconst BASE_FILTER_FIELDS = OUTREACH_ENROLLMENT_LIST_QUERY.fields.filter(\n (field) => !(OUTREACH_ENROLLMENT_CLICK_FIELDS as readonly string[]).includes(field.column),\n)\nconst ENROLLMENT_FILTER_HEADERS: Readonly<Record<string, string>> = {\n status: 'Status',\n target: 'Enrolled as',\n stopReason: 'Stop reason',\n email: 'Email',\n enrolled: 'Enrolled',\n clicked: 'Clicked',\n link: 'Link followed',\n}\nconst BASE_FILTER_OPTIONS: Record<string, readonly ListFilterOption[]> = {\n status: OUTREACH_ENROLLMENT_STATUSES.map((status) => ({\n value: status,\n label: OUTREACH_ENROLLMENT_STATUS_LABELS[status],\n })),\n target: [\n { value: 'contact', label: 'Contact' },\n { value: 'lead', label: 'Lead' },\n ],\n stopReason: OUTREACH_STOP_REASONS.map((reason) => ({\n value: reason,\n label: OUTREACH_STOP_REASON_LABELS[reason],\n })),\n}\nconst CLICKED_OPTIONS: readonly ListFilterOption[] = [\n { value: OUTREACH_CLICKED_FILTER_VALUE, label: 'Yes' },\n { value: OUTREACH_UNCLICKED_FILTER_VALUE, label: 'No' },\n]\n/** Columns a reader can show from the column chooser, off until they do (AGL-3332). */\nconst CLICK_DETAIL_COLUMNS = ['linksFollowed', 'lastClick', 'scannerClicks'] as const\n/** The opens column a reader can show from the column chooser, off until they do. */\nconst OPEN_DETAIL_COLUMNS = ['lastOpen'] as const\n\n/** The table's grammar, with the click fields when the sequence counts clicks. */\nfunction filterFieldsFor(trackClicks: boolean): readonly ListFilterField[] {\n return trackClicks ? OUTREACH_ENROLLMENT_LIST_QUERY.fields : BASE_FILTER_FIELDS\n}\n\n/** What the grid's cells and its export read off one enrollment. */\nfunction filterRow(\n enrollment: OutreachEnrollment,\n steps: readonly OutreachSequenceStep[],\n clicks: OutreachClickSummary,\n) {\n return {\n enrollment,\n status: enrollment.status,\n target: enrollment.target === 'lead' ? 'lead' : 'contact',\n contactName: enrollment.contactName,\n email: enrollment.email,\n step: outreachCurrentStepLabel(enrollment, steps),\n stopReason: outreachStopLabel(enrollment),\n clicked: clicks.clicks > 0 ? OUTREACH_CLICKED_FILTER_VALUE : OUTREACH_UNCLICKED_FILTER_VALUE,\n link: clicks.followed,\n }\n}\n\n/** One table row: the enrollment and what its cells draw. */\ntype EnrollmentTableRow = ReturnType<typeof filterRow> & {\n $id: string\n openSummary: OutreachOpenSummary\n clickSummary: OutreachClickSummary\n}\n\n/*\n * The columns read from `engagement.*` — absent until a person's first\n * event — and the derived Last activity sort the page on screen (AGL-3680);\n * Person, Status, Current step, Next send and Stop reason order the query\n * (`OUTREACH_ENROLLMENT_LIST_QUERY.sorts`).\n */\nconst ENROLLMENT_PAGE_SORTS = {\n lastActivity: (row: EnrollmentTableRow) => lastActivityMs(row.enrollment) || null,\n opens: (row: EnrollmentTableRow) => row.openSummary.opens,\n lastOpen: (row: EnrollmentTableRow) => row.openSummary.lastOpenAtMs,\n clicks: (row: EnrollmentTableRow) => row.clickSummary.clicks,\n linksFollowed: (row: EnrollmentTableRow) => row.clickSummary.followed.length,\n lastClick: (row: EnrollmentTableRow) => row.enrollment.engagement?.lastClickAtMs ?? null,\n scannerClicks: (row: EnrollmentTableRow) => row.clickSummary.machineClicks,\n}\nconst ENROLLMENT_PAGE_SORT_HEADERS = {\n lastActivity: 'Last activity',\n opens: 'Opens',\n lastOpen: 'Last open',\n clicks: 'Clicks',\n linksFollowed: 'Links followed',\n lastClick: 'Last click',\n scannerClicks: 'Scanner clicks',\n}\n\n/** The stop reason: its short label, with every word of it on hover and on the person's page. */\nfunction StopReasonCell(props: { enrollment: OutreachEnrollment }) {\n const { enrollment } = props\n if (!enrollment.stopReason) {\n return (\n <Typography variant=\"body2\" color=\"text.secondary\">\n —\n </Typography>\n )\n }\n const label = OUTREACH_STOP_REASON_LABELS[enrollment.stopReason] ?? ''\n const text = (\n <Typography\n variant=\"body2\"\n sx={{\n whiteSpace: 'normal',\n lineHeight: 1.3,\n ...(enrollment.stopDetail\n ? { textDecoration: 'underline dotted', textUnderlineOffset: 3, cursor: 'help' }\n : {}),\n }}\n >\n {label}\n </Typography>\n )\n return enrollment.stopDetail ? (\n <Tooltip title={outreachStopLabel(enrollment)} describeChild>\n {text}\n </Tooltip>\n ) : (\n text\n )\n}\n\n/**\n * The Opens cell (AGL-3488): the person's opens, and under them the fetches\n * a machine made — counted apart and never in the person's number, as\n * scanner clicks are never in their clicks.\n */\nfunction OpensCell(props: { opens: OutreachOpenSummary }) {\n const { opens } = props\n const machines = outreachMachineOpenLabel(opens)\n return (\n <Stack spacing={0} sx={{ justifyContent: 'center', height: '100%' }}>\n <Typography variant=\"body2\" color={opens.opens ? undefined : 'text.secondary'}>\n {opens.opens ? String(opens.opens) : '—'}\n </Typography>\n {machines ? (\n <Tooltip\n title=\"Fetches of the tracking image by a mail provider’s proxy or a security scanner. They aren’t counted as the person’s opens.\"\n describeChild\n >\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n noWrap\n sx={{ textDecoration: 'underline dotted', textUnderlineOffset: 3, cursor: 'help' }}\n >\n {machines}\n </Typography>\n </Tooltip>\n ) : null}\n </Stack>\n )\n}\n\n/** The table's columns; the person and the actions are drawn from the row's enrollment. */\nfunction columns(\n rowActions: (enrollment: OutreachEnrollment) => ReactNode,\n trackClicks: boolean,\n countOpens: boolean,\n timeZone: string | null,\n): NonNullable<ListTableProps['columns']> {\n return [\n {\n field: 'person',\n headerName: 'Person',\n flex: 1.2,\n minWidth: 190,\n sortable: false,\n // What the export writes for a column that is drawn rather than read.\n valueGetter: (_value: unknown, row: { enrollment: OutreachEnrollment }) =>\n row.enrollment.contactName\n ? `${row.enrollment.contactName} <${row.enrollment.email}>`\n : row.enrollment.email,\n renderCell: ({ row }) => (\n <Stack\n spacing={0}\n sx={{ justifyContent: 'center', height: '100%', minWidth: 0 }}\n >\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center', minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {row.enrollment.contactName || row.enrollment.email}\n </Typography>\n {row.enrollment.target === 'lead' ? (\n <Chip size=\"small\" variant=\"outlined\" label=\"Lead\" />\n ) : null}\n </Stack>\n {row.enrollment.contactName ? (\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {row.enrollment.email}\n </Typography>\n ) : null}\n </Stack>\n ),\n },\n {\n field: 'status',\n headerName: 'Status',\n width: 110,\n renderCell: ({ row }) => (\n <OutreachEnrollmentStatusChip status={row.status} />\n ),\n },\n {\n field: 'step',\n headerName: 'Current step',\n flex: 1,\n minWidth: 170,\n renderCell: ({ row }) => (\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center', height: '100%', minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {row.step}\n </Typography>\n {outreachStepIsCurated(row.enrollment) ? (\n <Chip size=\"small\" variant=\"outlined\" color=\"success\" label=\"Curated\" />\n ) : null}\n </Stack>\n ),\n },\n {\n field: 'nextSend',\n headerName: 'Next send',\n width: 190,\n sortable: false,\n renderCell: ({ row }: { row: { nextSendState: OutreachNextSendState } }) => (\n <Stack sx={{ justifyContent: 'center', height: '100%' }}>\n <OutreachNextSend state={row.nextSendState} timeZone={timeZone} />\n </Stack>\n ),\n },\n {\n field: 'lastActivity',\n headerName: 'Last activity',\n width: 170,\n sortable: false,\n },\n ...(countOpens\n ? [\n {\n field: 'opens',\n headerName: 'Opens',\n description:\n 'A person’s opens of the emails. Fetches by mail proxies and security scanners are shown under them and not counted.',\n width: 130,\n sortable: false,\n renderCell: ({ row }: { row: { openSummary: OutreachOpenSummary } }) => (\n <OpensCell opens={row.openSummary} />\n ),\n },\n { field: 'lastOpen', headerName: 'Last open', width: 170, sortable: false },\n ]\n : []),\n ...(trackClicks\n ? [\n {\n field: 'clicks',\n headerName: 'Clicks',\n description: 'A person’s clicks, and how many different links they followed. Scanners are not counted.',\n width: 110,\n sortable: false,\n renderCell: ({ row }: { row: { clicks: string } }) => (\n <Typography variant=\"body2\" color={row.clicks === '—' ? 'text.secondary' : undefined}>\n {row.clicks}\n </Typography>\n ),\n },\n {\n field: 'linksFollowed',\n headerName: 'Links followed',\n flex: 1,\n minWidth: 220,\n sortable: false,\n },\n { field: 'lastClick', headerName: 'Last click', width: 170, sortable: false },\n {\n field: 'scannerClicks',\n headerName: 'Scanner clicks',\n description: 'Clicks a security scanner made, which are not counted as the person’s.',\n width: 130,\n sortable: false,\n },\n ]\n : []),\n {\n field: 'stopReason',\n headerName: 'Stop reason',\n flex: 1,\n minWidth: 170,\n renderCell: ({ row }) => <StopReasonCell enrollment={row.enrollment} />,\n },\n listActionsColumn((row) => rowActions(row.enrollment), { width: 72 }),\n ]\n}\n\n/** A plain click on a link, which the page handles itself; any other is the browser's. */\nconst plainClick = (event: MouseEvent) =>\n !event.defaultPrevented &&\n event.button === 0 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey\n\n/**\n * A sequence's enrollments (AGL-2980): who is in it, where each person\n * stands, when their next step goes out in the mailbox's timezone, and the\n * four things a member can do about it — pause, resume, stop, and mark\n * do-not-contact. A table on wider screens, a list of cards on a phone.\n *\n * Each row opens the person's own page (AGL-3332), which holds everything\n * else known about them: so a cell says one thing, whole, and the detail\n * behind it is a click away rather than cut off at the column's edge.\n */\nexport function OutreachEnrollmentsTable(props: OutreachEnrollmentsTableProps) {\n const { steps, timeZone, api, onOpen, hrefFor } = props\n const trackClicks = props.trackClicks === true\n const countOpens = props.countOpens === true\n const nowMs = useOutreachNowMs()\n const theme = useTheme()\n const narrow = useMediaQuery(theme.breakpoints.down('md'))\n const actions = useOutreachEnrollmentActions({ api, steps })\n const fields = useMemo(() => filterFieldsFor(trackClicks), [trackClicks])\n const gridFilter = useListGridFilter({\n selectFields: ['status', 'target', 'stopReason', 'clicked', 'link'],\n ...(props.clauses !== undefined\n ? { clauses: props.clauses, onChange: props.onClausesChange }\n : {}),\n })\n const filtering =\n gridFilter.clauses.length > 0 || gridFilter.searchWords.some((word) => word.trim())\n /*\n * One page of the sequence's enrollments, newest enrolled first, with\n * every clause and the search word on the query (AGL-3321): a filter\n * reaches the enrollment on page forty as surely as the one on page one,\n * and nothing is matched over the rows that happen to be loaded. The\n * click filters (AGL-3332) are on it too, answered by the `clicked` flag\n * and the destinations the click route stores on each enrollment.\n */\n const [askedSort, setAskedSort] = useState<ListQuerySort | null>(null)\n const enrollments = useOutreachEnrollmentList(props.orgId, props.sequenceId, {\n clauses: gridFilter.clauses,\n search: gridFilter.searchWords,\n sort: askedSort,\n })\n const loadedData = enrollments.rows\n const summaries = useMemo(\n () =>\n new Map(\n loadedData.map((enrollment) => [enrollment.id, outreachClickSummary(enrollment.engagement)]),\n ),\n [loadedData],\n )\n const clicksOf = (enrollment: OutreachEnrollment) =>\n summaries.get(enrollment.id) ?? outreachClickSummary(enrollment.engagement)\n\n /*\n * The destinations the \"Link followed\" filter offers: the sequence's own\n * rollup, and any a loaded person followed that it does not list — the\n * rollup is capped, and a filter that could not name a destination a\n * person followed would hide them from it.\n */\n const linkOptions = useMemo(() => {\n const options = new Map<string, string>()\n for (const option of props.linkOptions ?? []) options.set(option.value, option.label)\n for (const summary of summaries.values()) {\n for (const url of summary.followed) if (!options.has(url)) options.set(url, url)\n }\n return [...options].map(([value, label]) => ({ value, label }))\n }, [props.linkOptions, summaries])\n const filterOptions = useMemo(\n () =>\n trackClicks\n ? { ...BASE_FILTER_OPTIONS, clicked: CLICKED_OPTIONS, link: linkOptions }\n : BASE_FILTER_OPTIONS,\n [trackClicks, linkOptions],\n )\n const hiddenColumns = useMemo(\n () => ({\n ...hiddenFilterVisibility(fields, ['status', 'stopReason']),\n ...(trackClicks\n ? Object.fromEntries(CLICK_DETAIL_COLUMNS.map((column) => [column, false]))\n : {}),\n ...(countOpens\n ? Object.fromEntries(OPEN_DETAIL_COLUMNS.map((column) => [column, false]))\n : {}),\n }),\n [fields, trackClicks, countOpens],\n )\n /*\n * A person who followed this destination before each click was recorded\n * on its own, and another link after it, is known by their LAST link only\n * — so a \"Link followed\" filter says it may miss them rather than\n * implying the list is whole. Which people those are is exactly what the\n * query cannot see, so the caveat stands whenever the filter does.\n */\n const linkFilterMayMiss =\n trackClicks && gridFilter.clauses.some((clause) => clause.field === 'link')\n\n const chips = (\n <ListFilterChips\n fields={fields}\n headers={ENROLLMENT_FILTER_HEADERS}\n clauses={gridFilter.clauses}\n onChange={gridFilter.setClauses}\n options={filterOptions}\n />\n )\n /*\n * A next send whose time has come says it is queued, and why, rather than\n * showing a time already past (AGL-3366): the mailbox sends its share of\n * the day each run, follow-ups first, so a first email can wait its turn\n * for an hour or more without anything having failed.\n */\n const nextSendState = (enrollment: OutreachEnrollment) =>\n outreachNextSendState({\n enrollment,\n sequence: props.sequence ?? null,\n mailbox: props.mailbox,\n nowMs,\n })\n const pageRows = enrollments.rows\n const tableRows: EnrollmentTableRow[] = pageRows.map((enrollment) => {\n const clicks = clicksOf(enrollment)\n const opens = outreachOpenSummary(enrollment.engagement)\n const next = nextSendState(enrollment)\n return {\n $id: enrollment.id,\n ...filterRow(enrollment, steps, clicks),\n nextSendState: next,\n // What the export writes: the label, and for a queued send, why.\n nextSend: [outreachNextSendLabel(next, timeZone), outreachNextSendDetail(next, timeZone)]\n .filter(Boolean)\n .join(' — '),\n lastActivity: formatOutreachTime(\n lastActivityMs(enrollment),\n timeZone,\n ),\n // What the export writes; the cells draw these their own way.\n openSummary: opens,\n clickSummary: clicks,\n opens: outreachOpenCountLabel(opens),\n lastOpen: opens.opens ? formatOutreachTime(opens.lastOpenAtMs, timeZone) : '—',\n clicks: outreachClickCountLabel(clicks),\n linksFollowed: clicks.followed.join(' ') || '—',\n lastClick: clicks.clicks\n ? formatOutreachTime(enrollment.engagement?.lastClickAtMs, timeZone)\n : '—',\n scannerClicks: clicks.machineClicks ? String(clicks.machineClicks) : '—',\n stopReason: outreachStopLabel(enrollment) || '—',\n } as EnrollmentTableRow\n })\n const columnSort = useListColumnSort<EnrollmentTableRow>({\n sorts: OUTREACH_ENROLLMENT_LIST_QUERY.sorts,\n sort: askedSort,\n onSortChange: setAskedSort,\n orderBy: enrollments.plan.orderBy,\n rows: tableRows,\n pageSorts: ENROLLMENT_PAGE_SORTS,\n headers: ENROLLMENT_PAGE_SORT_HEADERS,\n })\n\n if (enrollments.status === 'loading' && !filtering)\n return <OutreachLoading label=\"Loading enrollments…\" />\n if (enrollments.status === 'error' || enrollments.status === 'refused') {\n return (\n <Stack spacing={1.5}>\n {chips}\n <OutreachLoadProblem status={enrollments.status} what=\"enrollments\" />\n </Stack>\n )\n }\n if (\n enrollments.status === 'ready' &&\n !enrollments.rows.length &&\n !filtering &&\n enrollments.page === 0\n ) {\n return (\n <Card variant=\"outlined\">\n <EmptyStateComponent\n label=\"Nobody is enrolled yet\"\n description=\"People you enroll show here, with where each of them is in the sequence.\"\n action={props.enrollAction}\n />\n </Card>\n )\n }\n\n const rowActions = (enrollment: OutreachEnrollment) => (\n <ListRowActions\n label={enrollment.contactName || enrollment.email}\n items={actions.menuItems(enrollment)}\n />\n )\n const personName = (enrollment: OutreachEnrollment) => {\n const name = enrollment.contactName || enrollment.email\n if (!hrefFor) return <Typography variant=\"body2\">{name}</Typography>\n return (\n <Link\n href={hrefFor(enrollment)}\n variant=\"body2\"\n underline=\"hover\"\n onClick={(event) => {\n if (!onOpen || !plainClick(event)) return\n event.preventDefault()\n onOpen(enrollment)\n }}\n >\n {name}\n </Link>\n )\n }\n const person = (enrollment: OutreachEnrollment) => (\n <Stack spacing={0}>\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center' }}>\n {personName(enrollment)}\n {enrollment.target === 'lead' ? (\n <Chip size=\"small\" variant=\"outlined\" label=\"Lead\" />\n ) : null}\n </Stack>\n {enrollment.contactName ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {enrollment.email}\n </Typography>\n ) : null}\n </Stack>\n )\n\n\n return (\n <Stack spacing={1.5}>\n {chips}\n <ListQueryNotices\n refused={listQueryRefusals(enrollments.plan.refused, {\n fields,\n headers: ENROLLMENT_FILTER_HEADERS,\n options: filterOptions,\n })}\n notices={[...enrollments.plan.notices, ...columnSort.notices]}\n />\n {linkFilterMayMiss ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n Clicks made before each one was recorded on its own kept only the person’s last link, so\n someone who followed this link and then another back then is not listed here.\n </Typography>\n ) : null}\n {narrow ? (\n <Stack\n spacing={1}\n component=\"ul\"\n sx={{ listStyle: 'none', p: 0, m: 0 }}\n aria-label=\"Enrollments\"\n >\n {pageRows.map((enrollment) => {\n const clicks = clicksOf(enrollment)\n const opens = outreachOpenSummary(enrollment.engagement)\n return (\n <Card key={enrollment.id} variant=\"outlined\" component=\"li\">\n <CardContent>\n <Stack spacing={1}>\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'flex-start' }}\n >\n <Stack sx={{ flexGrow: 1, minWidth: 0 }}>\n {person(enrollment)}\n </Stack>\n <OutreachEnrollmentStatusChip status={enrollment.status} />\n {rowActions(enrollment)}\n </Stack>\n <Stack direction=\"row\" spacing={0.75} sx={{ alignItems: 'center' }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {outreachCurrentStepLabel(enrollment, steps)}\n </Typography>\n {outreachStepIsCurated(enrollment) ? (\n <Chip size=\"small\" variant=\"outlined\" color=\"success\" label=\"Curated\" />\n ) : null}\n </Stack>\n <Stack\n useFlexGap\n direction=\"row\"\n spacing={0.5}\n sx={{ alignItems: 'baseline', flexWrap: 'wrap', color: 'text.secondary' }}\n >\n <Typography variant=\"body2\">Next send:</Typography>\n <OutreachNextSend state={nextSendState(enrollment)} timeZone={timeZone} />\n <Typography variant=\"body2\">\n {`· Last activity: ${formatOutreachTime(lastActivityMs(enrollment), timeZone)}`}\n </Typography>\n </Stack>\n {countOpens && (opens.opens || opens.machineOpens) ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`Opens: ${outreachOpenCountLabel(opens)}`}\n </Typography>\n ) : null}\n {trackClicks && clicks.clicks ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`Clicks: ${outreachClickCountLabel(clicks)}`}\n </Typography>\n ) : null}\n {outreachStopLabel(enrollment) ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {outreachStopLabel(enrollment)}\n </Typography>\n ) : null}\n </Stack>\n </CardContent>\n </Card>\n )\n })}\n </Stack>\n ) : (\n <ListTable\n aria-label=\"Enrollments\"\n columns={listFilterGridColumns(\n columns(rowActions, trackClicks, countOpens, timeZone),\n fields,\n filterOptions,\n ENROLLMENT_FILTER_HEADERS,\n )}\n initialState={{ columns: { columnVisibilityModel: hiddenColumns } }}\n loading={enrollments.status === 'loading'}\n rows={columnSort.rows}\n onOpen={\n onOpen\n ? (_id, row: { enrollment: OutreachEnrollment }) => onOpen(row.enrollment)\n : undefined\n }\n /*\n * The panel and the search are the grid's; every clause and the\n * search word are on the table's query (AGL-3321). The grid\n * neither filters nor sorts the page it is handed: a stored\n * column's header orders the query, an engagement one the page\n * (AGL-3680), newest enrolled first until one is clicked.\n */\n filterMode=\"server\"\n filterModel={gridFilter.filterModel}\n onFilterModelChange={gridFilter.onFilterModelChange}\n quickFilter\n columnSort={columnSort}\n noRowsLabel=\"No enrollments match these filters\"\n hideFooter\n />\n )}\n <ListPagination\n page={enrollments.page}\n pageSize={enrollments.pageSize}\n rowCount={pageRows.length}\n hasMore={enrollments.hasMore}\n onPageChange={enrollments.setPage}\n onPageSizeChange={enrollments.setPageSize}\n />\n {actions.dialogs}\n </Stack>\n )\n}\nOutreachEnrollmentsTable.displayName = 'OutreachEnrollmentsTable'\n\nexport default OutreachEnrollmentsTable\n"],"names":["EmptyStateComponent","ListFilterChips","ListQueryNotices","listQueryRefusals","ListPagination","ListRowActions","ListTable","listActionsColumn","hiddenFilterVisibility","listFilterGridColumns","useListGridFilter","useListColumnSort","Card","CardContent","Chip","Link","Stack","Tooltip","Typography","useMediaQuery","useTheme","useMemo","useState","outreachClickCountLabel","outreachClickSummary","outreachMachineOpenLabel","outreachOpenCountLabel","outreachOpenSummary","OUTREACH_ENROLLMENT_CLICK_FIELDS","OUTREACH_ENROLLMENT_LIST_QUERY","OUTREACH_ENROLLMENT_STATUSES","OUTREACH_STOP_REASONS","OUTREACH_TASK_KIND_LABELS","outreachNextSendState","useOutreachEnrollmentActions","OUTREACH_CLICKED_FILTER_VALUE","OUTREACH_UNCLICKED_FILTER_VALUE","OutreachNextSend","outreachNextSendDetail","outreachNextSendLabel","useOutreachNowMs","formatOutreachTime","OUTREACH_ENROLLMENT_STATUS_LABELS","OUTREACH_STOP_REASON_LABELS","OutreachEnrollmentStatusChip","OutreachLoading","OutreachLoadProblem","useOutreachEnrollmentList","outreachCurrentStepLabel","enrollment","steps","status","stepIndex","length","step","kind","taskKind","outreachStopLabel","stopReason","reason","stopDetail","lastActivityMs","Math","max","lastSentAtMs","stoppedAtMs","createdAtMs","outreachStepIsCurated","Boolean","stepOverrides","String","BASE_FILTER_FIELDS","fields","filter","field","includes","column","ENROLLMENT_FILTER_HEADERS","target","email","enrolled","clicked","link","BASE_FILTER_OPTIONS","map","value","label","CLICKED_OPTIONS","CLICK_DETAIL_COLUMNS","OPEN_DETAIL_COLUMNS","filterFieldsFor","trackClicks","filterRow","clicks","contactName","followed","ENROLLMENT_PAGE_SORTS","lastActivity","row","opens","openSummary","lastOpen","lastOpenAtMs","clickSummary","linksFollowed","lastClick","engagement","lastClickAtMs","scannerClicks","machineClicks","ENROLLMENT_PAGE_SORT_HEADERS","StopReasonCell","props","variant","color","text","sx","whiteSpace","lineHeight","textDecoration","textUnderlineOffset","cursor","title","describeChild","OpensCell","machines","spacing","justifyContent","height","undefined","noWrap","columns","rowActions","countOpens","timeZone","headerName","flex","minWidth","sortable","valueGetter","_value","renderCell","direction","alignItems","size","width","state","nextSendState","description","plainClick","event","defaultPrevented","button","metaKey","ctrlKey","shiftKey","altKey","OutreachEnrollmentsTable","api","onOpen","hrefFor","nowMs","theme","narrow","breakpoints","down","actions","gridFilter","selectFields","clauses","onChange","onClausesChange","filtering","searchWords","some","word","trim","askedSort","setAskedSort","enrollments","orgId","sequenceId","search","sort","loadedData","rows","summaries","Map","id","clicksOf","get","linkOptions","options","option","set","summary","values","url","has","filterOptions","hiddenColumns","Object","fromEntries","linkFilterMayMiss","clause","chips","headers","setClauses","sequence","mailbox","pageRows","tableRows","next","$id","nextSend","join","columnSort","sorts","onSortChange","orderBy","plan","pageSorts","what","page","action","enrollAction","items","menuItems","personName","name","href","underline","onClick","preventDefault","person","refused","notices","component","listStyle","p","m","aria-label","flexGrow","useFlexGap","flexWrap","machineOpens","initialState","columnVisibilityModel","loading","_id","filterMode","filterModel","onFilterModelChange","quickFilter","noRowsLabel","hideFooter","pageSize","rowCount","hasMore","onPageChange","setPage","onPageSizeChange","setPageSize","dialogs","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,OAAOA,yBAAyB,wDAAuD;AACvF,OAAOC,qBAAqB,8DAA6D;AACzF,OAAOC,oBACLC,iBAAiB,QACZ,+DAA8D;AACrE,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SACEC,cAAc,EACdC,SAAS,EACTC,iBAAiB,QAEZ,uDAAsD;AAC7D,SAASC,sBAAsB,QAA8B,yCAAwC;AACrG,SACEC,qBAAqB,QAGhB,8CAA6C;AACpD,SAASC,iBAAiB,QAAQ,kDAAiD;AACnF,SAASC,iBAAiB,QAAQ,kDAAiD;AAEnF,SACEC,IAAI,EACJC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,aAAa,EACbC,QAAQ,QACH,gBAAe;AACtB,SAA0CC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAC1E,SACEC,uBAAuB,EACvBC,oBAAoB,EACpBC,wBAAwB,EACxBC,sBAAsB,EACtBC,mBAAmB,QAGd,oCAAgC;AACvC,SACEC,gCAAgC,EAChCC,8BAA8B,QACzB,oCAAgC;AACvC,SAC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AQ;wCAAQC,OAAM;kDAC/BzD,kBAAkBR;yCAEnB;;;;uBAhDCA,WAAW2I,EAAE;gBAqD5B;+BAGF,KAACtL;gBACC2O,cAAW;gBACX9G,SAAS1H,sBACP0H,QAAQC,YAAYzC,aAAa0C,YAAYC,WAC7C9D,QACA+H,eACA1H;gBAEFyK,cAAc;oBAAEnH,SAAS;wBAAEoH,uBAAuB/C;oBAAc;gBAAE;gBAClEgD,SAASrE,YAAYhI,MAAM,KAAK;gBAChCsI,MAAM+B,WAAW/B,IAAI;gBACrB1B,QACEA,SACI,CAAC0F,KAAKvJ,MAA4C6D,OAAO7D,IAAIjD,UAAU,IACvEgF;gBAEN;;;;;;WAMC,GACDyH,YAAW;gBACXC,aAAapF,WAAWoF,WAAW;gBACnCC,qBAAqBrF,WAAWqF,mBAAmB;gBACnDC,WAAW;gBACXrC,YAAYA;gBACZsC,aAAY;gBACZC,UAAU;;0BAGd,KAAC3P;gBACC2N,MAAM5C,YAAY4C,IAAI;gBACtBiC,UAAU7E,YAAY6E,QAAQ;gBAC9BC,UAAU/C,SAAS7J,MAAM;gBACzB6M,SAAS/E,YAAY+E,OAAO;gBAC5BC,cAAchF,YAAYiF,OAAO;gBACjCC,kBAAkBlF,YAAYmF,WAAW;;YAE1ChG,QAAQiG,OAAO;;;AAGtB;AACA1G,yBAAyB2G,WAAW,GAAG;AAEvC,eAAe3G,yBAAwB"}
|
|
@@ -27,8 +27,9 @@ import ListQueryNotices, { listQueryRefusals } from "@aglyn/shared-ui-jsx/compon
|
|
|
27
27
|
import { hiddenFilterVisibility } from "@aglyn/shared-ui-jsx/const/list-filter";
|
|
28
28
|
import { listFilterGridColumns } from "@aglyn/shared-ui-jsx/const/list-grid-filter";
|
|
29
29
|
import { useListGridFilter } from "@aglyn/shared-ui-jsx/hooks/use-list-grid-filter";
|
|
30
|
+
import { useListColumnSort } from "@aglyn/shared-ui-jsx/hooks/use-list-column-sort";
|
|
30
31
|
import { Button, Card, CardContent, Chip, Stack, Typography, useMediaQuery, useTheme } from "@mui/material";
|
|
31
|
-
import { useMemo } from "react";
|
|
32
|
+
import { useMemo, useState } from "react";
|
|
32
33
|
import { OUTREACH_SEQUENCE_STATUSES } from "../model/outreach.types.js";
|
|
33
34
|
import { OUTREACH_SEQUENCE_LIST_QUERY } from "../model/sequence-list-query.js";
|
|
34
35
|
import { OUTREACH_SEQUENCE_STATUS_LABELS, OutreachLink, OutreachLoading, OutreachLoadProblem, OutreachSequenceStatusChip, useOutreachNavigate } from "./outreach-ui.js";
|
|
@@ -133,6 +134,20 @@ const COUNT_COLUMNS = [
|
|
|
133
134
|
'Opted out'
|
|
134
135
|
]
|
|
135
136
|
];
|
|
137
|
+
/*
|
|
138
|
+
* Name and Status order the query (`OUTREACH_SEQUENCE_LIST_QUERY.sorts`);
|
|
139
|
+
* the mailbox's label is looked up and the counts are counted for the page,
|
|
140
|
+
* so those sort the page on screen (AGL-3680).
|
|
141
|
+
*/ const countValue = (raw)=>raw && raw !== '—' && Number.isFinite(Number(raw)) ? Number(raw) : null;
|
|
142
|
+
const SEQUENCE_PAGE_SORTS = _extends({
|
|
143
|
+
mailbox: (row)=>row.mailbox
|
|
144
|
+
}, Object.fromEntries(COUNT_COLUMNS.map(([key])=>[
|
|
145
|
+
key,
|
|
146
|
+
(row)=>countValue(row[key])
|
|
147
|
+
])));
|
|
148
|
+
const SEQUENCE_PAGE_SORT_HEADERS = _extends({
|
|
149
|
+
mailbox: 'Mailbox'
|
|
150
|
+
}, Object.fromEntries(COUNT_COLUMNS));
|
|
136
151
|
/*
|
|
137
152
|
* What the sequences grid's Filters panel offers (AGL-3317), each field on
|
|
138
153
|
* the list's Firestore query (AGL-3321, `OUTREACH_SEQUENCE_LIST_QUERY`).
|
|
@@ -176,9 +191,11 @@ const SEQUENCE_STATUS_OPTIONS = OUTREACH_SEQUENCE_STATUSES.map((status)=>({
|
|
|
176
191
|
'mailbox'
|
|
177
192
|
]
|
|
178
193
|
});
|
|
194
|
+
const [askedSort, setAskedSort] = useState(null);
|
|
179
195
|
const sequences = useOutreachSequenceList(orgId, {
|
|
180
196
|
clauses: gridFilter.clauses,
|
|
181
|
-
search: gridFilter.searchWords
|
|
197
|
+
search: gridFilter.searchWords,
|
|
198
|
+
sort: askedSort
|
|
182
199
|
});
|
|
183
200
|
const filtering = gridFilter.clauses.length > 0 || gridFilter.searchWords.some((word)=>word.trim());
|
|
184
201
|
const filterOptions = useMemo(()=>({
|
|
@@ -220,6 +237,24 @@ const SEQUENCE_STATUS_OPTIONS = OUTREACH_SEQUENCE_STATUSES.map((status)=>({
|
|
|
220
237
|
children: "New sequence"
|
|
221
238
|
});
|
|
222
239
|
const count = (sequence, key)=>counts[sequence.id] ? String(counts[sequence.id][key]) : '—';
|
|
240
|
+
const tableRows = pageRows.map((sequence)=>_extends({
|
|
241
|
+
$id: sequence.id,
|
|
242
|
+
name: sequence.name || 'Untitled',
|
|
243
|
+
mailbox: mailboxLabel(sequence),
|
|
244
|
+
status: sequence.status
|
|
245
|
+
}, Object.fromEntries(COUNT_COLUMNS.map(([key])=>[
|
|
246
|
+
key,
|
|
247
|
+
count(sequence, key)
|
|
248
|
+
]))));
|
|
249
|
+
const columnSort = useListColumnSort({
|
|
250
|
+
sorts: OUTREACH_SEQUENCE_LIST_QUERY.sorts,
|
|
251
|
+
sort: askedSort,
|
|
252
|
+
onSortChange: setAskedSort,
|
|
253
|
+
orderBy: sequences.plan.orderBy,
|
|
254
|
+
rows: tableRows,
|
|
255
|
+
pageSorts: SEQUENCE_PAGE_SORTS,
|
|
256
|
+
headers: SEQUENCE_PAGE_SORT_HEADERS
|
|
257
|
+
});
|
|
223
258
|
const chips = /*#__PURE__*/ _jsx(ListFilterChips, {
|
|
224
259
|
fields: SEQUENCE_FILTER_FIELDS,
|
|
225
260
|
headers: SEQUENCE_FILTER_HEADERS,
|
|
@@ -233,7 +268,10 @@ const SEQUENCE_STATUS_OPTIONS = OUTREACH_SEQUENCE_STATUSES.map((status)=>({
|
|
|
233
268
|
headers: SEQUENCE_FILTER_HEADERS,
|
|
234
269
|
options: filterOptions
|
|
235
270
|
}),
|
|
236
|
-
notices:
|
|
271
|
+
notices: [
|
|
272
|
+
...sequences.plan.notices,
|
|
273
|
+
...columnSort.notices
|
|
274
|
+
]
|
|
237
275
|
});
|
|
238
276
|
/** Nothing stored at all — not a filter that matched nothing. */ const none = sequences.status === 'ready' && !pageRows.length && !filtering && sequences.page === 0;
|
|
239
277
|
let body;
|
|
@@ -373,27 +411,20 @@ const SEQUENCE_STATUS_OPTIONS = OUTREACH_SEQUENCE_STATUSES.map((status)=>({
|
|
|
373
411
|
columnVisibilityModel: SEQUENCE_HIDDEN_COLUMNS
|
|
374
412
|
}
|
|
375
413
|
},
|
|
376
|
-
rows:
|
|
377
|
-
$id: sequence.id,
|
|
378
|
-
name: sequence.name || 'Untitled',
|
|
379
|
-
mailbox: mailboxLabel(sequence),
|
|
380
|
-
status: sequence.status
|
|
381
|
-
}, Object.fromEntries(COUNT_COLUMNS.map(([key])=>[
|
|
382
|
-
key,
|
|
383
|
-
count(sequence, key)
|
|
384
|
-
])))),
|
|
414
|
+
rows: columnSort.rows,
|
|
385
415
|
onOpen: (id)=>navigate(`${sectionPath}/${id}`),
|
|
386
416
|
loading: sequences.status === 'loading',
|
|
387
417
|
/*
|
|
388
418
|
* The panel and the search are the grid's; every clause and the
|
|
389
419
|
* search word are on the list's query (AGL-3321), and the grid
|
|
390
|
-
* neither filters nor sorts the page it is handed:
|
|
391
|
-
*
|
|
420
|
+
* neither filters nor sorts the page it is handed: Name and
|
|
421
|
+
* Status order the query, the rest the page (AGL-3680), newest
|
|
422
|
+
* first until a header is clicked.
|
|
392
423
|
*/ filterMode: "server",
|
|
393
424
|
filterModel: gridFilter.filterModel,
|
|
394
425
|
onFilterModelChange: gridFilter.onFilterModelChange,
|
|
395
426
|
quickFilter: true,
|
|
396
|
-
|
|
427
|
+
columnSort: columnSort,
|
|
397
428
|
noRowsLabel: "No sequences match these filters",
|
|
398
429
|
hideFooter: true
|
|
399
430
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/outreach/src/lib/components/sequences-section.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { pluginDocsHelp, type ConsolePluginOrgMount } from '@aglyn/aglyn'\nimport { mdiPlus } from '@aglyn/shared-data-mdi'\nimport { CardDisplay, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport EmptyStateComponent from '@aglyn/shared-ui-jsx/components/empty-state.component'\nimport ListFilterChips from '@aglyn/shared-ui-jsx/components/list-filter-chips.component'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport {\n ListTable,\n type ListTableProps,\n} from '@aglyn/shared-ui-jsx/components/list-table.component'\nimport ListQueryNotices, {\n listQueryRefusals,\n} from '@aglyn/shared-ui-jsx/components/list-query-notices.component'\nimport { hiddenFilterVisibility } from '@aglyn/shared-ui-jsx/const/list-filter'\nimport { listFilterGridColumns } from '@aglyn/shared-ui-jsx/const/list-grid-filter'\nimport { useListGridFilter } from '@aglyn/shared-ui-jsx/hooks/use-list-grid-filter'\nimport {\n Button,\n Card,\n CardContent,\n Chip,\n Stack,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material'\nimport { useMemo } from 'react'\nimport {\n OUTREACH_SEQUENCE_STATUSES,\n type OutreachMailbox,\n type OutreachSequence,\n} from '../model/outreach.types'\nimport { OUTREACH_SEQUENCE_LIST_QUERY } from '../model/sequence-list-query'\nimport {\n OUTREACH_SEQUENCE_STATUS_LABELS,\n OutreachLink,\n OutreachLoading,\n OutreachLoadProblem,\n OutreachSequenceStatusChip,\n useOutreachNavigate,\n} from './outreach-ui'\nimport { OutreachEnrollmentDetail } from './enrollment-detail'\nimport {\n OutreachSequenceDetail,\n type OutreachSequenceTab,\n} from './sequence-detail'\nimport { OutreachSequenceEditor } from './sequence-editor'\nimport { useOutreachApi } from './use-outreach-api'\nimport {\n type OutreachSequenceCounts,\n useOutreachSequenceCounts,\n useOutreachSequenceList,\n} from './use-outreach-data'\nimport { useOutreachMailboxes } from './use-outreach-mailboxes'\nimport { useOutreachComplianceSettings } from './use-outreach-settings'\n\nexport interface OutreachSequencesSectionProps {\n /** The organization the hub is mounted under; `null` until the shell knows it. */\n orgId: string | null\n orgMount?: ConsolePluginOrgMount\n org?: Record<string, unknown> | null\n /** The section's own path: `/[orgSlug]/outreach/sequences`. */\n sectionPath: string\n /**\n * The path below the section: `[]`, `['new']`, `[id]`, `[id, 'enrollments']`\n * or `[id, 'enrollments', enrollmentId]` — one person's page (AGL-3332).\n */\n subpath: readonly string[]\n /** The Mailboxes section: `/[orgSlug]/outreach/mailboxes`. */\n mailboxesPath: string\n /** The Compliance section: `/[orgSlug]/outreach/compliance`. */\n compliancePath: string\n}\n\n/** The new-sequence page's segment below the section. */\nexport const OUTREACH_NEW_SEQUENCE_SEGMENT = 'new'\n\n/**\n * The Sequences section (AGL-2980), and the pages below it: the list, a new\n * sequence, and one sequence's steps and enrollments. Each is a real URL, so\n * a sequence is a link a rep can keep and the back button walks them.\n */\nexport function OutreachSequencesSection(props: OutreachSequencesSectionProps) {\n const { orgId, sectionPath, subpath } = props\n const api = useOutreachApi(orgId)\n const settings = useOutreachComplianceSettings(api, orgId)\n const mailboxes = useOutreachMailboxes(orgId)\n const navigate = useOutreachNavigate()\n\n if (!orgId) return <OutreachLoading label=\"Loading sequences…\" />\n const [first, second, third] = subpath\n if (first === OUTREACH_NEW_SEQUENCE_SEGMENT) {\n return (\n <Stack spacing={2}>\n <OutreachLink href={sectionPath}>Sequences</OutreachLink>\n <Typography variant=\"h5\" component=\"h2\">\n New sequence\n </Typography>\n <OutreachSequenceEditor\n orgId={orgId}\n orgMount={props.orgMount}\n sequence={null}\n settings={settings}\n mailboxes={mailboxes}\n mailboxesPath={props.mailboxesPath}\n onSaved={(sequence) => navigate(`${sectionPath}/${sequence.id}`)}\n onCancel={() => navigate(sectionPath)}\n />\n </Stack>\n )\n }\n if (first && second === 'enrollments' && third) {\n return (\n <OutreachEnrollmentDetail\n orgId={orgId}\n orgMount={props.orgMount}\n sectionPath={sectionPath}\n sequenceId={first}\n enrollmentId={third}\n mailboxes={mailboxes}\n />\n )\n }\n if (first) {\n return (\n <OutreachSequenceDetail\n orgId={orgId}\n orgMount={props.orgMount}\n org={props.org}\n sectionPath={sectionPath}\n sequenceId={first}\n tab={\n (second === 'enrollments'\n ? 'enrollments'\n : 'steps') as OutreachSequenceTab\n }\n settings={settings}\n mailboxes={mailboxes}\n mailboxesPath={props.mailboxesPath}\n compliancePath={props.compliancePath}\n />\n )\n }\n return (\n <OutreachSequenceList\n orgId={orgId}\n sectionPath={sectionPath}\n mailboxes={mailboxes.mailboxes}\n />\n )\n}\nOutreachSequencesSection.displayName = 'OutreachSequencesSection'\n\nconst COUNT_COLUMNS: ReadonlyArray<[keyof OutreachSequenceCounts, string]> = [\n ['enrolled', 'Enrolled'],\n ['active', 'Active'],\n ['replied', 'Replied'],\n ['bounced', 'Bounced'],\n ['optedOut', 'Opted out'],\n]\n\n/*\n * What the sequences grid's Filters panel offers (AGL-3317), each field on\n * the list's Firestore query (AGL-3321, `OUTREACH_SEQUENCE_LIST_QUERY`).\n */\nconst SEQUENCE_FILTER_FIELDS = OUTREACH_SEQUENCE_LIST_QUERY.fields\nconst SEQUENCE_FILTER_HEADERS: Readonly<Record<string, string>> = {\n name: 'Name',\n mailbox: 'Mailbox',\n status: 'Status',\n created: 'Created',\n}\n/** `created` is no column of its own: a filter-only column, never shown. */\nconst SEQUENCE_HIDDEN_COLUMNS = hiddenFilterVisibility(SEQUENCE_FILTER_FIELDS, [\n 'name',\n 'mailbox',\n 'status',\n])\nconst SEQUENCE_STATUS_OPTIONS = OUTREACH_SEQUENCE_STATUSES.map((status) => ({\n value: status,\n label: OUTREACH_SEQUENCE_STATUS_LABELS[status],\n}))\n\n/** How a mailbox reads in the list: the address it sends as. */\nconst mailboxName = (mailbox: OutreachMailbox) => mailbox.sendAs || mailbox.email\n\n/**\n * Every sequence: its mailbox, its status, and how many people it enrolled\n * and where they stand — a table on wider screens, cards on a phone.\n *\n * ## Asked of Firestore, a page at a time\n *\n * The Filters panel and the search box are the grid's; the clauses and the\n * words go onto ONE query over the organization's sequences, newest first,\n * and each page is a page of that query's matches (AGL-3321). A clause the\n * query cannot hold beside the others is not applied, and the notice above\n * the list says which and why — never answered over the sequences that\n * happen to be loaded.\n */\nexport function OutreachSequenceList(props: {\n orgId: string\n sectionPath: string\n mailboxes: readonly OutreachMailbox[]\n}) {\n const { orgId, sectionPath } = props\n const theme = useTheme()\n const narrow = useMediaQuery(theme.breakpoints.down('md'))\n const navigate = useOutreachNavigate()\n const gridFilter = useListGridFilter({ selectFields: ['status', 'mailbox'] })\n const sequences = useOutreachSequenceList(orgId, {\n clauses: gridFilter.clauses,\n search: gridFilter.searchWords,\n })\n const filtering =\n gridFilter.clauses.length > 0 || gridFilter.searchWords.some((word) => word.trim())\n const filterOptions = useMemo(\n () => ({\n status: SEQUENCE_STATUS_OPTIONS,\n mailbox: props.mailboxes.map((mailbox) => ({\n value: mailbox.id,\n label: mailboxName(mailbox),\n })),\n }),\n [props.mailboxes],\n )\n const mailboxLabel = (sequence: OutreachSequence) => {\n const mailbox = props.mailboxes.find(\n (entry) => entry.id === sequence.mailboxId,\n )\n return mailbox\n ? mailboxName(mailbox)\n : sequence.mailboxId\n ? 'Mailbox removed'\n : 'No mailbox yet'\n }\n const pageRows = sequences.rows\n // Counted for the page on screen only: five aggregations a sequence.\n const counts = useOutreachSequenceCounts(\n orgId,\n pageRows.map((sequence) => sequence.id),\n )\n const footer = (\n <ListPagination\n page={sequences.page}\n pageSize={sequences.pageSize}\n rowCount={pageRows.length}\n hasMore={sequences.hasMore}\n onPageChange={sequences.setPage}\n onPageSizeChange={sequences.setPageSize}\n />\n )\n const newHref = `${sectionPath}/${OUTREACH_NEW_SEQUENCE_SEGMENT}`\n const newButton = (\n <Button\n variant=\"contained\"\n startIcon={<MdiIcon path={mdiPlus.path} fontSize=\"small\" />}\n href={newHref}\n onClick={(event) => {\n event.preventDefault()\n navigate(newHref)\n }}\n >\n New sequence\n </Button>\n )\n const count = (\n sequence: OutreachSequence,\n key: keyof OutreachSequenceCounts,\n ) => (counts[sequence.id] ? String(counts[sequence.id][key]) : '—')\n\n const chips = (\n <ListFilterChips\n fields={SEQUENCE_FILTER_FIELDS}\n headers={SEQUENCE_FILTER_HEADERS}\n clauses={gridFilter.clauses}\n onChange={gridFilter.setClauses}\n options={filterOptions}\n />\n )\n const notices = (\n <ListQueryNotices\n refused={listQueryRefusals(sequences.plan.refused, {\n fields: SEQUENCE_FILTER_FIELDS,\n headers: SEQUENCE_FILTER_HEADERS,\n options: filterOptions,\n })}\n notices={sequences.plan.notices}\n />\n )\n /** Nothing stored at all — not a filter that matched nothing. */\n const none =\n sequences.status === 'ready' &&\n !pageRows.length &&\n !filtering &&\n sequences.page === 0\n let body\n if (sequences.status === 'loading' && !filtering)\n body = <OutreachLoading label=\"Loading sequences…\" />\n else if (sequences.status === 'error' || sequences.status === 'refused') {\n body = (\n <Stack spacing={1}>\n {chips}\n <OutreachLoadProblem status={sequences.status} what=\"sequences\" />\n </Stack>\n )\n } else if (none) {\n body = (\n <Card variant=\"outlined\">\n <EmptyStateComponent\n label=\"No sequences yet\"\n description=\"A sequence is the emails, and the tasks between them, one person gets from one rep.\"\n action={newButton}\n />\n </Card>\n )\n } else if (narrow) {\n body = (\n <Stack spacing={1}>\n {chips}\n {notices}\n {pageRows.length ? (\n <Stack\n spacing={1}\n component=\"ul\"\n sx={{ listStyle: 'none', p: 0, m: 0 }}\n aria-label=\"Sequences\"\n >\n {pageRows.map((sequence) => (\n <Card key={sequence.id} variant=\"outlined\" component=\"li\">\n <CardContent>\n <Stack spacing={1}>\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <OutreachLink href={`${sectionPath}/${sequence.id}`}>\n {sequence.name || 'Untitled'}\n </OutreachLink>\n <OutreachSequenceStatusChip status={sequence.status} />\n </Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {mailboxLabel(sequence)}\n </Typography>\n <Stack\n useFlexGap\n direction=\"row\"\n spacing={0.5}\n sx={{ flexWrap: 'wrap', rowGap: 0.5 }}\n >\n {COUNT_COLUMNS.map(([key, label]) => (\n <Chip\n key={key}\n size=\"small\"\n variant=\"outlined\"\n label={`${label} ${count(sequence, key)}`}\n />\n ))}\n </Stack>\n </Stack>\n </CardContent>\n </Card>\n ))}\n </Stack>\n ) : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {sequences.status === 'loading'\n ? 'Loading sequences…'\n : 'No sequences match these filters'}\n </Typography>\n )}\n {footer}\n </Stack>\n )\n } else {\n const columns: NonNullable<ListTableProps['columns']> = listFilterGridColumns([\n { field: 'name', headerName: 'Name', flex: 1, minWidth: 180 },\n { field: 'mailbox', headerName: 'Mailbox', flex: 1, minWidth: 180 },\n {\n field: 'status',\n headerName: 'Status',\n width: 110,\n renderCell: ({ row }) => (\n <OutreachSequenceStatusChip status={row.status} />\n ),\n },\n ...COUNT_COLUMNS.map(([key, label]) => ({\n field: key,\n headerName: label,\n width: 96,\n align: 'right' as const,\n headerAlign: 'right' as const,\n })),\n ], SEQUENCE_FILTER_FIELDS, filterOptions, SEQUENCE_FILTER_HEADERS)\n body = (\n <Stack spacing={1}>\n {chips}\n {notices}\n <ListTable\n aria-label=\"Sequences\"\n columns={columns}\n initialState={{ columns: { columnVisibilityModel: SEQUENCE_HIDDEN_COLUMNS } }}\n rows={pageRows.map((sequence) => ({\n $id: sequence.id,\n name: sequence.name || 'Untitled',\n mailbox: mailboxLabel(sequence),\n status: sequence.status,\n ...Object.fromEntries(\n COUNT_COLUMNS.map(([key]) => [key, count(sequence, key)]),\n ),\n }))}\n onOpen={(id) => navigate(`${sectionPath}/${id}`)}\n loading={sequences.status === 'loading'}\n /*\n * The panel and the search are the grid's; every clause and the\n * search word are on the list's query (AGL-3321), and the grid\n * neither filters nor sorts the page it is handed: the query's\n * one order, newest first, is the list's.\n */\n filterMode=\"server\"\n filterModel={gridFilter.filterModel}\n onFilterModelChange={gridFilter.onFilterModelChange}\n quickFilter\n disableColumnSorting\n noRowsLabel=\"No sequences match these filters\"\n hideFooter\n />\n {footer}\n </Stack>\n )\n }\n\n return (\n <CardDisplay\n header=\"Sequences\"\n help={pluginDocsHelp('sequences', { anchor: '#sequences' })}\n HeaderProps={{\n action: none || sequences.status === 'loading' ? undefined : newButton,\n }}\n contentGutterX\n contentGutterY\n >\n {body}\n </CardDisplay>\n )\n}\nOutreachSequenceList.displayName = 'OutreachSequenceList'\n\nexport default OutreachSequencesSection\n"],"names":["pluginDocsHelp","mdiPlus","CardDisplay","MdiIcon","EmptyStateComponent","ListFilterChips","ListPagination","ListTable","ListQueryNotices","listQueryRefusals","hiddenFilterVisibility","listFilterGridColumns","useListGridFilter","Button","Card","CardContent","Chip","Stack","Typography","useMediaQuery","useTheme","useMemo","OUTREACH_SEQUENCE_STATUSES","OUTREACH_SEQUENCE_LIST_QUERY","OUTREACH_SEQUENCE_STATUS_LABELS","OutreachLink","OutreachLoading","OutreachLoadProblem","OutreachSequenceStatusChip","useOutreachNavigate","OutreachEnrollmentDetail","OutreachSequenceDetail","OutreachSequenceEditor","useOutreachApi","useOutreachSequenceCounts","useOutreachSequenceList","useOutreachMailboxes","useOutreachComplianceSettings","OUTREACH_NEW_SEQUENCE_SEGMENT","OutreachSequencesSection","props","orgId","sectionPath","subpath","api","settings","mailboxes","navigate","label","first","second","third","spacing","href","variant","component","orgMount","sequence","mailboxesPath","onSaved","id","onCancel","sequenceId","enrollmentId","org","tab","compliancePath","OutreachSequenceList","displayName","COUNT_COLUMNS","SEQUENCE_FILTER_FIELDS","fields","SEQUENCE_FILTER_HEADERS","name","mailbox","status","created","SEQUENCE_HIDDEN_COLUMNS","SEQUENCE_STATUS_OPTIONS","map","value","mailboxName","sendAs","email","theme","narrow","breakpoints","down","gridFilter","selectFields","sequences","clauses","search","searchWords","filtering","length","some","word","trim","filterOptions","mailboxLabel","find","entry","mailboxId","pageRows","rows","counts","footer","page","pageSize","rowCount","hasMore","onPageChange","setPage","onPageSizeChange","setPageSize","newHref","newButton","startIcon","path","fontSize","onClick","event","preventDefault","count","key","String","chips","headers","onChange","setClauses","options","notices","refused","plan","none","body","what","description","action","sx","listStyle","p","m","aria-label","direction","alignItems","justifyContent","color","useFlexGap","flexWrap","rowGap","size","columns","field","headerName","flex","minWidth","width","renderCell","row","align","headerAlign","initialState","columnVisibilityModel","$id","Object","fromEntries","onOpen","loading","filterMode","filterModel","onFilterModelChange","quickFilter","disableColumnSorting","noRowsLabel","hideFooter","header","help","anchor","HeaderProps","undefined","contentGutterX","contentGutterY"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,cAAc,QAAoC,eAAc;AACzE,SAASC,OAAO,QAAQ,yBAAwB;AAChD,SAASC,WAAW,EAAEC,OAAO,QAAQ,uBAAsB;AAC3D,OAAOC,yBAAyB,wDAAuD;AACvF,OAAOC,qBAAqB,8DAA6D;AACzF,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SACEC,SAAS,QAEJ,uDAAsD;AAC7D,OAAOC,oBACLC,iBAAiB,QACZ,+DAA8D;AACrE,SAASC,sBAAsB,QAAQ,yCAAwC;AAC/E,SAASC,qBAAqB,QAAQ,8CAA6C;AACnF,SAASC,iBAAiB,QAAQ,kDAAiD;AACnF,SACEC,MAAM,EACNC,IAAI,EACJC,WA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L,eAAe,aAAa;YAAEmL,QAAQ;QAAa;QACzDC,aAAa;YACXzC,QAAQJ,QAAQ7C,UAAUf,MAAM,KAAK,YAAY0G,YAAYhE;QAC/D;QACAiE,cAAc;QACdC,cAAc;kBAEb/C;;AAGP;AACArE,qBAAqBC,WAAW,GAAG;AAEnC,eAAe7B,yBAAwB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/outreach/src/lib/components/sequences-section.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { pluginDocsHelp, type ConsolePluginOrgMount } from '@aglyn/aglyn'\nimport { mdiPlus } from '@aglyn/shared-data-mdi'\nimport { CardDisplay, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport EmptyStateComponent from '@aglyn/shared-ui-jsx/components/empty-state.component'\nimport ListFilterChips from '@aglyn/shared-ui-jsx/components/list-filter-chips.component'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport {\n ListTable,\n type ListTableProps,\n} from '@aglyn/shared-ui-jsx/components/list-table.component'\nimport ListQueryNotices, {\n listQueryRefusals,\n} from '@aglyn/shared-ui-jsx/components/list-query-notices.component'\nimport { hiddenFilterVisibility } from '@aglyn/shared-ui-jsx/const/list-filter'\nimport { listFilterGridColumns } from '@aglyn/shared-ui-jsx/const/list-grid-filter'\nimport { useListGridFilter } from '@aglyn/shared-ui-jsx/hooks/use-list-grid-filter'\nimport { useListColumnSort } from '@aglyn/shared-ui-jsx/hooks/use-list-column-sort'\nimport type { ListQuerySort } from '@aglyn/shared-ui-jsx/const/list-query-plan'\nimport {\n Button,\n Card,\n CardContent,\n Chip,\n Stack,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material'\nimport { useMemo, useState } from 'react'\nimport {\n OUTREACH_SEQUENCE_STATUSES,\n type OutreachMailbox,\n type OutreachSequence,\n} from '../model/outreach.types'\nimport { OUTREACH_SEQUENCE_LIST_QUERY } from '../model/sequence-list-query'\nimport {\n OUTREACH_SEQUENCE_STATUS_LABELS,\n OutreachLink,\n OutreachLoading,\n OutreachLoadProblem,\n OutreachSequenceStatusChip,\n useOutreachNavigate,\n} from './outreach-ui'\nimport { OutreachEnrollmentDetail } from './enrollment-detail'\nimport {\n OutreachSequenceDetail,\n type OutreachSequenceTab,\n} from './sequence-detail'\nimport { OutreachSequenceEditor } from './sequence-editor'\nimport { useOutreachApi } from './use-outreach-api'\nimport {\n type OutreachSequenceCounts,\n useOutreachSequenceCounts,\n useOutreachSequenceList,\n} from './use-outreach-data'\nimport { useOutreachMailboxes } from './use-outreach-mailboxes'\nimport { useOutreachComplianceSettings } from './use-outreach-settings'\n\nexport interface OutreachSequencesSectionProps {\n /** The organization the hub is mounted under; `null` until the shell knows it. */\n orgId: string | null\n orgMount?: ConsolePluginOrgMount\n org?: Record<string, unknown> | null\n /** The section's own path: `/[orgSlug]/outreach/sequences`. */\n sectionPath: string\n /**\n * The path below the section: `[]`, `['new']`, `[id]`, `[id, 'enrollments']`\n * or `[id, 'enrollments', enrollmentId]` — one person's page (AGL-3332).\n */\n subpath: readonly string[]\n /** The Mailboxes section: `/[orgSlug]/outreach/mailboxes`. */\n mailboxesPath: string\n /** The Compliance section: `/[orgSlug]/outreach/compliance`. */\n compliancePath: string\n}\n\n/** The new-sequence page's segment below the section. */\nexport const OUTREACH_NEW_SEQUENCE_SEGMENT = 'new'\n\n/**\n * The Sequences section (AGL-2980), and the pages below it: the list, a new\n * sequence, and one sequence's steps and enrollments. Each is a real URL, so\n * a sequence is a link a rep can keep and the back button walks them.\n */\nexport function OutreachSequencesSection(props: OutreachSequencesSectionProps) {\n const { orgId, sectionPath, subpath } = props\n const api = useOutreachApi(orgId)\n const settings = useOutreachComplianceSettings(api, orgId)\n const mailboxes = useOutreachMailboxes(orgId)\n const navigate = useOutreachNavigate()\n\n if (!orgId) return <OutreachLoading label=\"Loading sequences…\" />\n const [first, second, third] = subpath\n if (first === OUTREACH_NEW_SEQUENCE_SEGMENT) {\n return (\n <Stack spacing={2}>\n <OutreachLink href={sectionPath}>Sequences</OutreachLink>\n <Typography variant=\"h5\" component=\"h2\">\n New sequence\n </Typography>\n <OutreachSequenceEditor\n orgId={orgId}\n orgMount={props.orgMount}\n sequence={null}\n settings={settings}\n mailboxes={mailboxes}\n mailboxesPath={props.mailboxesPath}\n onSaved={(sequence) => navigate(`${sectionPath}/${sequence.id}`)}\n onCancel={() => navigate(sectionPath)}\n />\n </Stack>\n )\n }\n if (first && second === 'enrollments' && third) {\n return (\n <OutreachEnrollmentDetail\n orgId={orgId}\n orgMount={props.orgMount}\n sectionPath={sectionPath}\n sequenceId={first}\n enrollmentId={third}\n mailboxes={mailboxes}\n />\n )\n }\n if (first) {\n return (\n <OutreachSequenceDetail\n orgId={orgId}\n orgMount={props.orgMount}\n org={props.org}\n sectionPath={sectionPath}\n sequenceId={first}\n tab={\n (second === 'enrollments'\n ? 'enrollments'\n : 'steps') as OutreachSequenceTab\n }\n settings={settings}\n mailboxes={mailboxes}\n mailboxesPath={props.mailboxesPath}\n compliancePath={props.compliancePath}\n />\n )\n }\n return (\n <OutreachSequenceList\n orgId={orgId}\n sectionPath={sectionPath}\n mailboxes={mailboxes.mailboxes}\n />\n )\n}\nOutreachSequencesSection.displayName = 'OutreachSequencesSection'\n\nconst COUNT_COLUMNS: ReadonlyArray<[keyof OutreachSequenceCounts, string]> = [\n ['enrolled', 'Enrolled'],\n ['active', 'Active'],\n ['replied', 'Replied'],\n ['bounced', 'Bounced'],\n ['optedOut', 'Opted out'],\n]\n\n/** A sequences-grid row: the sequence's name, mailbox label, status and counts. */\ntype SequenceTableRow = { $id: string; name: string; mailbox: string; status: string } & Record<\n string,\n string\n>\n\n/*\n * Name and Status order the query (`OUTREACH_SEQUENCE_LIST_QUERY.sorts`);\n * the mailbox's label is looked up and the counts are counted for the page,\n * so those sort the page on screen (AGL-3680).\n */\nconst countValue = (raw: string | undefined): number | null =>\n raw && raw !== '—' && Number.isFinite(Number(raw)) ? Number(raw) : null\nconst SEQUENCE_PAGE_SORTS = {\n mailbox: (row: SequenceTableRow) => row.mailbox,\n ...Object.fromEntries(\n COUNT_COLUMNS.map(([key]) => [key, (row: SequenceTableRow) => countValue(row[key])]),\n ),\n}\nconst SEQUENCE_PAGE_SORT_HEADERS = {\n mailbox: 'Mailbox',\n ...Object.fromEntries(COUNT_COLUMNS),\n}\n\n/*\n * What the sequences grid's Filters panel offers (AGL-3317), each field on\n * the list's Firestore query (AGL-3321, `OUTREACH_SEQUENCE_LIST_QUERY`).\n */\nconst SEQUENCE_FILTER_FIELDS = OUTREACH_SEQUENCE_LIST_QUERY.fields\nconst SEQUENCE_FILTER_HEADERS: Readonly<Record<string, string>> = {\n name: 'Name',\n mailbox: 'Mailbox',\n status: 'Status',\n created: 'Created',\n}\n/** `created` is no column of its own: a filter-only column, never shown. */\nconst SEQUENCE_HIDDEN_COLUMNS = hiddenFilterVisibility(SEQUENCE_FILTER_FIELDS, [\n 'name',\n 'mailbox',\n 'status',\n])\nconst SEQUENCE_STATUS_OPTIONS = OUTREACH_SEQUENCE_STATUSES.map((status) => ({\n value: status,\n label: OUTREACH_SEQUENCE_STATUS_LABELS[status],\n}))\n\n/** How a mailbox reads in the list: the address it sends as. */\nconst mailboxName = (mailbox: OutreachMailbox) => mailbox.sendAs || mailbox.email\n\n/**\n * Every sequence: its mailbox, its status, and how many people it enrolled\n * and where they stand — a table on wider screens, cards on a phone.\n *\n * ## Asked of Firestore, a page at a time\n *\n * The Filters panel and the search box are the grid's; the clauses and the\n * words go onto ONE query over the organization's sequences, newest first,\n * and each page is a page of that query's matches (AGL-3321). A clause the\n * query cannot hold beside the others is not applied, and the notice above\n * the list says which and why — never answered over the sequences that\n * happen to be loaded.\n */\nexport function OutreachSequenceList(props: {\n orgId: string\n sectionPath: string\n mailboxes: readonly OutreachMailbox[]\n}) {\n const { orgId, sectionPath } = props\n const theme = useTheme()\n const narrow = useMediaQuery(theme.breakpoints.down('md'))\n const navigate = useOutreachNavigate()\n const gridFilter = useListGridFilter({ selectFields: ['status', 'mailbox'] })\n const [askedSort, setAskedSort] = useState<ListQuerySort | null>(null)\n const sequences = useOutreachSequenceList(orgId, {\n clauses: gridFilter.clauses,\n search: gridFilter.searchWords,\n sort: askedSort,\n })\n const filtering =\n gridFilter.clauses.length > 0 || gridFilter.searchWords.some((word) => word.trim())\n const filterOptions = useMemo(\n () => ({\n status: SEQUENCE_STATUS_OPTIONS,\n mailbox: props.mailboxes.map((mailbox) => ({\n value: mailbox.id,\n label: mailboxName(mailbox),\n })),\n }),\n [props.mailboxes],\n )\n const mailboxLabel = (sequence: OutreachSequence) => {\n const mailbox = props.mailboxes.find(\n (entry) => entry.id === sequence.mailboxId,\n )\n return mailbox\n ? mailboxName(mailbox)\n : sequence.mailboxId\n ? 'Mailbox removed'\n : 'No mailbox yet'\n }\n const pageRows = sequences.rows\n // Counted for the page on screen only: five aggregations a sequence.\n const counts = useOutreachSequenceCounts(\n orgId,\n pageRows.map((sequence) => sequence.id),\n )\n const footer = (\n <ListPagination\n page={sequences.page}\n pageSize={sequences.pageSize}\n rowCount={pageRows.length}\n hasMore={sequences.hasMore}\n onPageChange={sequences.setPage}\n onPageSizeChange={sequences.setPageSize}\n />\n )\n const newHref = `${sectionPath}/${OUTREACH_NEW_SEQUENCE_SEGMENT}`\n const newButton = (\n <Button\n variant=\"contained\"\n startIcon={<MdiIcon path={mdiPlus.path} fontSize=\"small\" />}\n href={newHref}\n onClick={(event) => {\n event.preventDefault()\n navigate(newHref)\n }}\n >\n New sequence\n </Button>\n )\n const count = (\n sequence: OutreachSequence,\n key: keyof OutreachSequenceCounts,\n ) => (counts[sequence.id] ? String(counts[sequence.id][key]) : '—')\n const tableRows: SequenceTableRow[] = pageRows.map((sequence) => ({\n $id: sequence.id,\n name: sequence.name || 'Untitled',\n mailbox: mailboxLabel(sequence),\n status: sequence.status,\n ...Object.fromEntries(\n COUNT_COLUMNS.map(([key]) => [key, count(sequence, key)]),\n ),\n }))\n const columnSort = useListColumnSort<SequenceTableRow>({\n sorts: OUTREACH_SEQUENCE_LIST_QUERY.sorts,\n sort: askedSort,\n onSortChange: setAskedSort,\n orderBy: sequences.plan.orderBy,\n rows: tableRows,\n pageSorts: SEQUENCE_PAGE_SORTS,\n headers: SEQUENCE_PAGE_SORT_HEADERS,\n })\n\n const chips = (\n <ListFilterChips\n fields={SEQUENCE_FILTER_FIELDS}\n headers={SEQUENCE_FILTER_HEADERS}\n clauses={gridFilter.clauses}\n onChange={gridFilter.setClauses}\n options={filterOptions}\n />\n )\n const notices = (\n <ListQueryNotices\n refused={listQueryRefusals(sequences.plan.refused, {\n fields: SEQUENCE_FILTER_FIELDS,\n headers: SEQUENCE_FILTER_HEADERS,\n options: filterOptions,\n })}\n notices={[...sequences.plan.notices, ...columnSort.notices]}\n />\n )\n /** Nothing stored at all — not a filter that matched nothing. */\n const none =\n sequences.status === 'ready' &&\n !pageRows.length &&\n !filtering &&\n sequences.page === 0\n let body\n if (sequences.status === 'loading' && !filtering)\n body = <OutreachLoading label=\"Loading sequences…\" />\n else if (sequences.status === 'error' || sequences.status === 'refused') {\n body = (\n <Stack spacing={1}>\n {chips}\n <OutreachLoadProblem status={sequences.status} what=\"sequences\" />\n </Stack>\n )\n } else if (none) {\n body = (\n <Card variant=\"outlined\">\n <EmptyStateComponent\n label=\"No sequences yet\"\n description=\"A sequence is the emails, and the tasks between them, one person gets from one rep.\"\n action={newButton}\n />\n </Card>\n )\n } else if (narrow) {\n body = (\n <Stack spacing={1}>\n {chips}\n {notices}\n {pageRows.length ? (\n <Stack\n spacing={1}\n component=\"ul\"\n sx={{ listStyle: 'none', p: 0, m: 0 }}\n aria-label=\"Sequences\"\n >\n {pageRows.map((sequence) => (\n <Card key={sequence.id} variant=\"outlined\" component=\"li\">\n <CardContent>\n <Stack spacing={1}>\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <OutreachLink href={`${sectionPath}/${sequence.id}`}>\n {sequence.name || 'Untitled'}\n </OutreachLink>\n <OutreachSequenceStatusChip status={sequence.status} />\n </Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {mailboxLabel(sequence)}\n </Typography>\n <Stack\n useFlexGap\n direction=\"row\"\n spacing={0.5}\n sx={{ flexWrap: 'wrap', rowGap: 0.5 }}\n >\n {COUNT_COLUMNS.map(([key, label]) => (\n <Chip\n key={key}\n size=\"small\"\n variant=\"outlined\"\n label={`${label} ${count(sequence, key)}`}\n />\n ))}\n </Stack>\n </Stack>\n </CardContent>\n </Card>\n ))}\n </Stack>\n ) : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {sequences.status === 'loading'\n ? 'Loading sequences…'\n : 'No sequences match these filters'}\n </Typography>\n )}\n {footer}\n </Stack>\n )\n } else {\n const columns: NonNullable<ListTableProps['columns']> = listFilterGridColumns([\n { field: 'name', headerName: 'Name', flex: 1, minWidth: 180 },\n { field: 'mailbox', headerName: 'Mailbox', flex: 1, minWidth: 180 },\n {\n field: 'status',\n headerName: 'Status',\n width: 110,\n renderCell: ({ row }) => (\n <OutreachSequenceStatusChip status={row.status} />\n ),\n },\n ...COUNT_COLUMNS.map(([key, label]) => ({\n field: key,\n headerName: label,\n width: 96,\n align: 'right' as const,\n headerAlign: 'right' as const,\n })),\n ], SEQUENCE_FILTER_FIELDS, filterOptions, SEQUENCE_FILTER_HEADERS)\n body = (\n <Stack spacing={1}>\n {chips}\n {notices}\n <ListTable\n aria-label=\"Sequences\"\n columns={columns}\n initialState={{ columns: { columnVisibilityModel: SEQUENCE_HIDDEN_COLUMNS } }}\n rows={columnSort.rows}\n onOpen={(id) => navigate(`${sectionPath}/${id}`)}\n loading={sequences.status === 'loading'}\n /*\n * The panel and the search are the grid's; every clause and the\n * search word are on the list's query (AGL-3321), and the grid\n * neither filters nor sorts the page it is handed: Name and\n * Status order the query, the rest the page (AGL-3680), newest\n * first until a header is clicked.\n */\n filterMode=\"server\"\n filterModel={gridFilter.filterModel}\n onFilterModelChange={gridFilter.onFilterModelChange}\n quickFilter\n columnSort={columnSort}\n noRowsLabel=\"No sequences match these filters\"\n hideFooter\n />\n {footer}\n </Stack>\n )\n }\n\n return (\n <CardDisplay\n header=\"Sequences\"\n help={pluginDocsHelp('sequences', { anchor: '#sequences' })}\n HeaderProps={{\n action: none || sequences.status === 'loading' ? undefined : newButton,\n }}\n contentGutterX\n contentGutterY\n >\n {body}\n </CardDisplay>\n )\n}\nOutreachSequenceList.displayName = 'OutreachSequenceList'\n\nexport default OutreachSequencesSection\n"],"names":["pluginDocsHelp","mdiPlus","CardDisplay","MdiIcon","EmptyStateComponent","ListFilterChips","ListPagination","ListTable","ListQueryNotices","listQueryRefusals","hiddenFilterVisibility","listFilterGridColumns","useListGridFilter","useListColumnSort","Button","Card","CardContent","Chip","Stack","Typography","useMediaQuery","useTheme","useMemo","useState","OUTREACH_SEQUENCE_STATUSES","OUTREACH_SEQUENCE_LIST_QUERY","OUTREACH_SEQUENCE_STATUS_LABELS","OutreachLink","OutreachLoading","OutreachLoadProblem","OutreachSequenceStatusChip","useOutreachNavigate","OutreachEnrollmentDetail","OutreachSequenceDetail","OutreachSequenceEditor","useOutreachApi","useOutreachSequenceCounts","useOutreachSequenceList","useOutreachMailboxes","useOutreachComplianceSettings","OUTREACH_NEW_SEQUENCE_SEGMENT","OutreachSequencesSection","props","orgId","sectionPath","subpath","api","settings","mailboxes","navigate","label","first","second","third","spacing","href","variant","component","orgMount","sequence","mailboxesPath","onSaved","id","onCancel","sequenceId","enrollmentId","org","tab","compliancePath","OutreachSequenceList","displayName","COUNT_COLUMNS","countValue","raw","Number","isFinite","SEQUENCE_PAGE_SORTS","mailbox","row","Object","fromEntries","map","key","SEQUENCE_PAGE_SORT_HEADERS","SEQUENCE_FILTER_FIELDS","fields","SEQUENCE_FILTER_HEADERS","name","status","created","SEQUENCE_HIDDEN_COLUMNS","SEQUENCE_STATUS_OPTIONS","value","mailboxName","sendAs","email","theme","narrow","breakpoints","down","gridFilter","selectFields","askedSort","setAskedSort","sequences","clauses","search","searchWords","sort","filtering","length","some","word","trim","filterOptions","mailboxLabel","find","entry","mailboxId","pageRows","rows","counts","footer","page","pageSize","rowCount","hasMore","onPageChange","setPage","onPageSizeChange","setPageSize","newHref","newButton","startIcon","path","fontSize","onClick","event","preventDefault","count","String","tableRows","$id","columnSort","sorts","onSortChange","orderBy","plan","pageSorts","headers","chips","onChange","setClauses","options","notices","refused","none","body","what","description","action","sx","listStyle","p","m","aria-label","direction","alignItems","justifyContent","color","useFlexGap","flexWrap","rowGap","size","columns","field","headerName","flex","minWidth","width","renderCell","align","headerAlign","initialState","columnVisibilityModel","onOpen","loading","filterMode","filterModel","onFilterModelChange","quickFilter","noRowsLabel","hideFooter","header","help","anchor","HeaderProps","undefined","contentGutterX","contentGutterY"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,cAAc,QAAoC,eAAc;AACzE,SAASC,OAAO,QAAQ,yBAAwB;AAChD,SAASC,WAAW,EAAEC,OAAO,QAAQ,uBAAsB;AAC3D,OAAOC,yBAAyB,wDAAuD;AACvF,OAAOC,qBAAqB,8DAA6D;AACzF,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SACEC,SAAS,QAEJ,uDAAsD;AAC7D,OAAOC,oBACLC,iBAAiB,QACZ,+DAA8D;AACrE,SAASC,sBAAsB,QAAQ,yCAAwC;AAC/E,SAASC,qBAAqB,QAAQ,8CAA6C;AACnF,SAASC,iBAAiB,QAAQ,kDAAiD;AACnF,SAASC,iBAAiB,QAAQ,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EAAEtG,GAAG,EAAE,iBAClB,KAAChD;wBAA2B0D,QAAQV,IAAIU,MAAM;;YAElD;eACGjB,cAAcU,GAAG,CAAC,CAAC,CAACC,KAAKhC,MAAM,GAAM,CAAA;oBACtC6H,OAAO7F;oBACP8F,YAAY9H;oBACZiI,OAAO;oBACPE,OAAO;oBACPC,aAAa;gBACf,CAAA;SACD,EAAElG,wBAAwB8B,eAAe5B;QAC1CuE,qBACE,MAAC3I;YAAMoC,SAAS;;gBACbgG;gBACAI;8BACD,KAACnJ;oBACC8J,cAAW;oBACXS,SAASA;oBACTS,cAAc;wBAAET,SAAS;4BAAEU,uBAAuB9F;wBAAwB;oBAAE;oBAC5E8B,MAAMuB,WAAWvB,IAAI;oBACrBiE,QAAQ,CAAC3H,KAAOb,SAAS,GAAGL,YAAY,CAAC,EAAEkB,IAAI;oBAC/C4H,SAASlF,UAAUhB,MAAM,KAAK;oBAC9B;;;;;;WAMC,GACDmG,YAAW;oBACXC,aAAaxF,WAAWwF,WAAW;oBACnCC,qBAAqBzF,WAAWyF,mBAAmB;oBACnDC,WAAW;oBACX/C,YAAYA;oBACZgD,aAAY;oBACZC,UAAU;;gBAEXtE;;;IAGP;IAEA,qBACE,KAACxH;QACC+L,QAAO;QACPC,MAAMlM,eAAe,aAAa;YAAEmM,QAAQ;QAAa;QACzDC,aAAa;YACXpC,QAAQJ,QAAQpD,UAAUhB,MAAM,KAAK,YAAY6G,YAAYjE;QAC/D;QACAkE,cAAc;QACdC,cAAc;kBAEb1C;;AAGP;AACAxF,qBAAqBC,WAAW,GAAG;AAEnC,eAAe7B,yBAAwB"}
|
|
@@ -73,10 +73,68 @@ export const OUTREACH_DO_NOT_CONTACT_DOMAIN_LIST_QUERY = {
|
|
|
73
73
|
]
|
|
74
74
|
}
|
|
75
75
|
],
|
|
76
|
-
|
|
76
|
+
/*
|
|
77
|
+
* The headers (AGL-3680). A domain IS its document id, so Domain orders by
|
|
78
|
+
* the id, alphabetical first as the list always was. Why, Added and Detail
|
|
79
|
+
* are on every entry — the one writer stamps `reason`, `addedAtMs` and
|
|
80
|
+
* `detail` (null when none) — and order the query `alone`: on this
|
|
81
|
+
* unscoped collection that costs no composite. Added newest first is also
|
|
82
|
+
* the order its date range imposes.
|
|
83
|
+
*/ sorts: [
|
|
77
84
|
{
|
|
78
85
|
path: LIST_QUERY_ID_PATH,
|
|
79
|
-
direction: 'asc'
|
|
86
|
+
direction: 'asc',
|
|
87
|
+
column: 'domain',
|
|
88
|
+
label: 'Domain'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
path: LIST_QUERY_ID_PATH,
|
|
92
|
+
direction: 'desc',
|
|
93
|
+
column: 'domain',
|
|
94
|
+
label: 'Domain',
|
|
95
|
+
alone: true
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
path: 'reason',
|
|
99
|
+
direction: 'asc',
|
|
100
|
+
column: 'reason',
|
|
101
|
+
label: 'Why',
|
|
102
|
+
alone: true
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
path: 'reason',
|
|
106
|
+
direction: 'desc',
|
|
107
|
+
column: 'reason',
|
|
108
|
+
label: 'Why',
|
|
109
|
+
alone: true
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
path: 'addedAtMs',
|
|
113
|
+
direction: 'desc',
|
|
114
|
+
column: 'addedAtMs',
|
|
115
|
+
label: 'Added',
|
|
116
|
+
alone: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
path: 'addedAtMs',
|
|
120
|
+
direction: 'asc',
|
|
121
|
+
column: 'addedAtMs',
|
|
122
|
+
label: 'Added',
|
|
123
|
+
alone: true
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
path: 'detail',
|
|
127
|
+
direction: 'asc',
|
|
128
|
+
column: 'detail',
|
|
129
|
+
label: 'Detail',
|
|
130
|
+
alone: true
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
path: 'detail',
|
|
134
|
+
direction: 'desc',
|
|
135
|
+
column: 'detail',
|
|
136
|
+
label: 'Detail',
|
|
137
|
+
alone: true
|
|
80
138
|
}
|
|
81
139
|
],
|
|
82
140
|
search: {
|