@aglyn/plugins-redirects 1.21.0 → 1.22.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-redirects",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.
|
|
29
|
-
"@aglyn/shared-data-mdi": "1.
|
|
30
|
-
"@aglyn/shared-ui-jsx": "1.
|
|
31
|
-
"@aglyn/shared-ui-snackstack": "1.
|
|
32
|
-
"@aglyn/shared-util-email": "1.
|
|
33
|
-
"@aglyn/shared-util-http": "1.
|
|
34
|
-
"@aglyn/shared-util-timestamp": "1.
|
|
35
|
-
"@aglyn/shared-util-tools": "1.
|
|
36
|
-
"@aglyn/tenant-data-admin": "1.
|
|
37
|
-
"@aglyn/tenant-feature-instance": "1.
|
|
38
|
-
"@swc/helpers": "0.5.
|
|
28
|
+
"@aglyn/aglyn": "1.22.1",
|
|
29
|
+
"@aglyn/shared-data-mdi": "1.22.1",
|
|
30
|
+
"@aglyn/shared-ui-jsx": "1.22.1",
|
|
31
|
+
"@aglyn/shared-ui-snackstack": "1.22.1",
|
|
32
|
+
"@aglyn/shared-util-email": "1.22.1",
|
|
33
|
+
"@aglyn/shared-util-http": "1.22.1",
|
|
34
|
+
"@aglyn/shared-util-timestamp": "1.22.1",
|
|
35
|
+
"@aglyn/shared-util-tools": "1.22.1",
|
|
36
|
+
"@aglyn/tenant-data-admin": "1.22.1",
|
|
37
|
+
"@aglyn/tenant-feature-instance": "1.22.1",
|
|
38
|
+
"@swc/helpers": "0.5.24"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@mui/material": "^9.3.1",
|
|
@@ -33,7 +33,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
|
|
33
33
|
import { ListPagination } from "@aglyn/shared-ui-jsx/components/list-pagination.component";
|
|
34
34
|
import { TABLE_PAGE_SIZE_DEFAULT } from "@aglyn/shared-ui-jsx/const/table-pagination";
|
|
35
35
|
import { ceilingedWindow, collectionCeiling, useFirestore, useFirestoreCollection, useFirestoreDoc, useHostResourceApi, useUser, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
|
|
36
|
-
import { isSeedChecking, seedCheckingText } from "@aglyn/tenant-feature-instance/hooks/use-seed-edits";
|
|
36
|
+
import { heldSaveLabel, isSeedChecking, seedCheckingText, useHeldSave } from "@aglyn/tenant-feature-instance/hooks/use-seed-edits";
|
|
37
37
|
import { useSeedDraft } from "@aglyn/tenant-feature-instance/hooks/use-seed-draft";
|
|
38
38
|
/**
|
|
39
39
|
* How many redirect documents this page reads.
|
|
@@ -606,6 +606,15 @@ export function RedirectsConsolePage(props) {
|
|
|
606
606
|
})
|
|
607
607
|
]
|
|
608
608
|
}) : null;
|
|
609
|
+
// A press while Save is held is kept, and saves once confirmed (AGL-4047).
|
|
610
|
+
const held = useHeldSave(handleSave, {
|
|
611
|
+
checking: draftChecking,
|
|
612
|
+
subject: 'redirect',
|
|
613
|
+
onRefused: (message)=>enqueueSnackbar(message, {
|
|
614
|
+
variant: 'warning',
|
|
615
|
+
persist: false
|
|
616
|
+
})
|
|
617
|
+
});
|
|
609
618
|
return /*#__PURE__*/ _jsxs(CardDisplay, {
|
|
610
619
|
header: 'URL redirects',
|
|
611
620
|
help: pluginDocsHelp('redirects', {
|
|
@@ -877,9 +886,9 @@ export function RedirectsConsolePage(props) {
|
|
|
877
886
|
/*#__PURE__*/ _jsx(Button, {
|
|
878
887
|
variant: "contained",
|
|
879
888
|
color: "primary",
|
|
880
|
-
disabled:
|
|
881
|
-
onClick:
|
|
882
|
-
children: 'Save redirect'
|
|
889
|
+
disabled: !(draft == null ? void 0 : draft.source.trim()) || !(draft == null ? void 0 : draft.destination.trim()) || held.saving,
|
|
890
|
+
onClick: held.press,
|
|
891
|
+
children: heldSaveLabel(held, 'Save redirect')
|
|
883
892
|
})
|
|
884
893
|
]
|
|
885
894
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/redirects/src/lib/components/redirects-console-page.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 { TransferResumeImport } from '@aglyn/aglyn/app-utils/transfer-resume-import'\nimport { checkQuota, pluginDocsHelp, useTransferLauncher } from '@aglyn/aglyn'\nimport { type ConsolePluginPageProps } from '@aglyn/aglyn'\nimport { TENANT_APEX } from '@aglyn/aglyn/app-utils/tenant-apex'\nimport { findDuplicateRedirect, isExternalRedirectDestination, isSelfRedirect, matchRedirect, normalizeRedirectDestination, normalizeRedirectSource, REDIRECT_DEFAULT_PRIORITY, redirectHitKey, redirectSourceIsLivePage, validateRedirectRule, REDIRECT_STATUS_CODES, walkRedirectChain } from '../model'\nimport { CardDisplay, useConfirmationContext } from '@aglyn/shared-ui-jsx'\nimport { REDIRECTS_TRANSFER_KEY } from '../transfer/redirects-transfer-fields'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport QuotaReadoutComponent from '@aglyn/shared-ui-jsx/components/quota-readout.component'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { Timestamp } from '@aglyn/shared-util-timestamp'\nimport {\n Alert,\n Button,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n MenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n collection,\n deleteField,\n doc,\n getDoc,\n setDoc,\n updateDoc,\n} from 'firebase/firestore'\nimport { getLiveCountFromServer } from '@aglyn/aglyn/app-utils/live-document-count.client'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { TABLE_PAGE_SIZE_DEFAULT } from '@aglyn/shared-ui-jsx/const/table-pagination'\nimport {\n ceilingedWindow,\n collectionCeiling,\n useFirestore,\n useFirestoreCollection,\n useFirestoreDoc,\n useHostResourceApi,\n useUser,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport {\n isSeedChecking,\n seedCheckingText,\n} from '@aglyn/tenant-feature-instance/hooks/use-seed-edits'\nimport { useSeedDraft } from '@aglyn/tenant-feature-instance/hooks/use-seed-draft'\n\n/**\n * How many redirect documents this page reads.\n *\n * A CEILING, not a page size. Everything the page decides is computed over\n * the WHOLE rule set: the duplicate-source check, the chain-loop walk that\n * follows internal destinations through the rules, and the inline tester that\n * runs the enforcement matcher. A server page would give each of them a\n * tenth of the rules to reason about, and the duplicate check would then\n * create exactly the collision it exists to prevent.\n */\nconst REDIRECT_CEILING = 200\n\ninterface RedirectDraft {\n id: string | null\n source: string\n destination: string\n statusCode: number\n /** Match mode (AGL-375): exact | prefix | regex. */\n kind: string\n /** Lower fires first. */\n priority: number\n /**\n * The rule's on/off state, carried through the editor rather than reset by\n * it (AGL-1372). The save used to hardcode `true`, so changing a **disabled**\n * rule's target turned it back on and rerouted the site without the author\n * asking. A new rule seeds this `true`; an edit seeds it from the stored\n * rule, which is also where the row's switch reads from.\n */\n enabled: boolean\n}\n\n/**\n * Redirect manager (AGL-156): CRUD over `hosts/{hostId}/redirects` with\n * the shared AGL-154 validation (normalized sources, https-or-internal\n * destinations, self-redirect refusal, duplicate-source check). Paid\n * (`redirects` flag + `redirectsPerHost` quota); rules take effect on the\n * site within ~30 seconds (AGL-155 ISR window).\n *\n * The plan gate is the SHELL's, and it runs before this component exists\n * (AGL-2484): the console resolves `redirects` from the org billing doc and\n * renders its own refusal notice in place of the surface, so this card is\n * only ever mounted for an entitled org and states no plan terms of its own.\n * Redirects registers no `upgradeNotice` override because it is a genuine\n * upgrade — free denies it, Starter and above grant it — which makes the\n * shell's plan-derived sentence the accurate one already.\n *\n * `entitled` is still read below, where it is not redundant: it holds back\n * the thirty analytics day-doc reads behind the hit counts, and refuses the\n * add path ahead of the server that enforces it.\n */\n/** A stored rule as the editor holds it. */\nfunction redirectDraftOf(redirect: any): RedirectDraft {\n return {\n id: redirect.$id,\n source: redirect.source ?? '',\n destination: redirect.destination ?? '',\n statusCode: redirect.statusCode ?? 302,\n kind: redirect.kind ?? 'exact',\n priority: redirect.priority ?? REDIRECT_DEFAULT_PRIORITY,\n // Read exactly as the switch beside it does (AGL-1372): an edit must not\n // be a way to turn a rule back on.\n enabled: redirect.enabled !== false,\n }\n}\n\nexport function RedirectsConsolePage(props: ConsolePluginPageProps) {\n const { hostId, entitled, org } = props\n const firestore = useFirestore()\n const createHostResource = useHostResourceApi()\n const { data: currentUser } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const { confirm } = useConfirmationContext()\n\n const {\n data: redirectDocs,\n status: redirectsStatus,\n /**\n * The rows this editor is seeded from are unconfirmed by the server\n * (AGL-1358). Editing copies every field the form owns out of the stored\n * rule and writes all of them back, so `merge: true` protects only the\n * fields written elsewhere (`lastHitAt`, `deletedAt`). This is the site\n * where a rollback is hardest to undo: a reverted `destination` on a\n * **301** is cached by every browser that has already followed it, so the\n * stale target outlives the fix in the console. `kind` reverting from\n * exact to prefix silently widens a rule over a whole subtree, and\n * `priority` reorders which rule fires when several match.\n */\n fromCache: redirectsFromCache,\n listen: redirectsListen,\n } = useFirestoreCollection<any>(\n /*\n * ORDERED AND CEILINGED, with a probe (AGL-2501).\n *\n * `limit(200)` alone is answered in DOCUMENT-ID order and the ids are\n * generated, so the window was a pseudo-random two hundred of the site's\n * rules — sorted by `source` in the browser afterwards, which is what\n * made it invisible: the rules on screen run alphabetically and are\n * simply the wrong rules, and the ones missing leave no gap to notice.\n *\n * `orderBy('source')` is the tempting fix and the dangerous one. It\n * matches only documents that HAVE the field, and nothing validates\n * `source` for presence — `/api/hosts/resources` stores an allow-list of\n * fields and checks none of them — so a rule saved without one would\n * vanish from this page while still redirecting live traffic. The\n * document NAME cannot be absent, so the walk is total: every rule is\n * reachable, and the alphabetical order stays where it belongs, in the\n * sort below over a window the page holds whole.\n */\n () =>\n collectionCeiling(\n collection(firestore, 'hosts', hostId, 'redirects'),\n REDIRECT_CEILING,\n ),\n [firestore, hostId],\n { idField: '$id' },\n )\n const { rows: readRedirects, truncated: redirectsTruncated } =\n ceilingedWindow<any>(redirectDocs, REDIRECT_CEILING)\n const redirects = [...readRedirects]\n .filter((redirect: any) => !redirect.deletedAt)\n .sort((a: any, b: any) =>\n String(a.source ?? '').localeCompare(String(b.source ?? '')),\n )\n\n /*\n * The page is a SLICE of the ceiling, which is what the three whole-set\n * consumers above require. The count is the rules this page HOLDS, after\n * soft-deleted ones are dropped — not the quota, which is a server count of\n * every document including the soft-deleted, and is read separately below.\n */\n const [page, setPage] = useState(0)\n const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT)\n const visibleRedirects = useMemo(\n () => redirects.slice(page * pageSize, page * pageSize + pageSize),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [redirectDocs, page, pageSize],\n )\n\n /**\n * What the ENFORCING route counts, which is not what this page was counting.\n *\n * `hosts/{id}/redirects` is read here as an unordered `limit(200)` window\n * and then filtered to drop soft-deleted rows, and that filtered length was\n * feeding both `checkQuota('redirectsPerHost')` and the readout beside it.\n * The route in `app/api/hosts/resources` counted the collection plainly,\n * soft-deleted rules included, so the two disagreed on both counts at\n * once: a rule deleted in this console still occupied a slot on the\n * server, and a site past 200 rules has rows the window never saw.\n *\n * The visible effect is the worst kind: the page shows room, the author\n * fills in the form, and the save is refused by a server counting something\n * else. Same shape as AGL-1716.\n *\n * The RULE is now that a deleted rule frees its slot and a disabled one\n * keeps it (AGL-3918), on the route and here alike: every document less\n * the tombstones (`getLiveCountFromServer`), two aggregation queries that\n * cost one read unit per thousand documents rather than reading them.\n * Re-run when the LIVE set read here changes, which covers an add and a\n * delete alike.\n */\n const [enforcedCount, setEnforcedCount] = useState<number | null>(null)\n const liveRedirectDocCount = (redirectDocs ?? []).filter(\n (redirect: any) => !redirect.deletedAt,\n ).length\n\n /**\n * `null` when the count cannot be taken, never a number.\n *\n * `try`, not `.catch()`: `getCountFromServer` validates its reference and\n * THROWS synchronously on a bad one, so a rejection handler alone leaves the\n * error to escape the effect and take the page down with it. Unreadable is\n * also not zero — answering zero would tell an author at their cap that the\n * whole allowance is free.\n */\n const countRedirects = useCallback(async (): Promise<number | null> => {\n try {\n return await getLiveCountFromServer(\n collection(firestore, 'hosts', hostId, 'redirects'),\n )\n } catch {\n return null\n }\n }, [firestore, hostId])\n\n useEffect(() => {\n let active = true\n void countRedirects().then((count) => {\n if (active && count != null) setEnforcedCount(count)\n })\n return () => {\n active = false\n }\n }, [countRedirects, liveRedirectDocCount])\n\n /*\n * The editor's draft, kept as EDITS over the rule as the list has it now\n * (AGL-4047): opened from the cache's row, the server's copy replaces it\n * under every field nobody touched (`enabled` among them), and Save is\n * held until it has.\n */\n const [draft, setDraft] = useSeedDraft<RedirectDraft>((opened) => {\n const row = opened.id\n ? redirects.find((redirect: any) => redirect.$id === opened.id)\n : undefined\n return row ? redirectDraftOf(row) : undefined\n })\n const draftChecking =\n Boolean(draft?.id) &&\n isSeedChecking({\n fromCache: redirectsFromCache,\n unreadable: redirectsStatus === 'error',\n })\n const [testPath, setTestPath] = useState('')\n\n // Host routing map for the screen-collision warning (AGL-156 spec).\n const { data: host } = useFirestoreDoc<any>(\n () => doc(firestore, 'hosts', hostId),\n [firestore, hostId],\n { idField: '$id' },\n )\n\n // Sampled hit counts (AGL-157): summed from the last 30 analytics day\n // docs' `redirects` maps written by enforcement. Counts are sampled —\n // one per ISR revalidation window with traffic, not per request.\n const [hits, setHits] = useState<Record<string, number> | null>(null)\n useEffect(() => {\n if (!entitled) return\n let active = true\n const ids = Array.from({ length: 30 }, (_, index) => {\n const date = new Date()\n date.setDate(date.getDate() - index)\n return date.toISOString().slice(0, 10)\n })\n void Promise.all(\n ids.map((id) =>\n getDoc(doc(firestore, 'hosts', hostId, 'analytics', id))\n .then((snapshot) => (snapshot.get('redirects') ?? {}) as Record<string, number>)\n .catch(() => ({}) as Record<string, number>),\n ),\n ).then((days) => {\n if (!active) return\n const totals: Record<string, number> = {}\n for (const dayMap of days) {\n for (const [redirectId, count] of Object.entries(dayMap)) {\n totals[redirectId] = (totals[redirectId] ?? 0) + Number(count)\n }\n }\n setHits(totals)\n })\n return () => {\n active = false\n }\n }, [entitled, firestore, hostId])\n const totalHits = Object.values(hits ?? {}).reduce(\n (sum, count) => sum + count,\n 0,\n )\n\n const handleAdd = useCallback(() => {\n if (!entitled) {\n return void enqueueSnackbar(\n 'URL redirects require a Starter plan — see Billing to upgrade',\n { variant: 'warning', persist: false },\n )\n }\n /*\n * The SERVER's count, not the rows on screen — the whole point of this\n * fix. Read from the polled value rather than re-counted on the click:\n * this gate is a courtesy that spares the author a form they are about to\n * be refused, the route is the actual enforcer, and making the button\n * await an aggregation would delay the dialog on every press to sharpen a\n * number the server re-checks anyway.\n *\n * `null` means the count could not be read, and that lets the add through:\n * refusing on a number we do not have would block an author who may well\n * be inside their cap.\n */\n const quota = checkQuota(org, 'redirectsPerHost', enforcedCount ?? 0)\n if (!quota.allowed) {\n return void enqueueSnackbar(\n `Redirect limit reached (${quota.limit}) — upgrade in Billing`,\n { variant: 'warning', persist: false },\n )\n }\n setDraft({\n id: null,\n source: '',\n destination: '',\n statusCode: 302,\n kind: 'exact',\n priority: REDIRECT_DEFAULT_PRIORITY,\n // A NEW rule is on: the author is adding it to make it fire, and\n // enforcement queries `where('enabled', '==', true)`, so a rule created\n // without the field would never resolve (AGL-1372).\n enabled: true,\n })\n }, [setDraft, entitled, org, enforcedCount, enqueueSnackbar])\n\n /**\n * Tell the tenant a rule changed (best effort, never awaited into the save\n * outcome). Rule writes are client Firestore writes with no publish step,\n * and the tenant's rules list sits behind the hour-long\n * `tenant-data:{hostId}` backstop — without this call a new rule waits out\n * that TTL while the snackbar above promises ~30 seconds. The route busts\n * the host tag and drops the source path's cached HTML; a regex pattern has\n * no single literal path, so it announces `/` for the tag bust alone and\n * the matching pages catch up on their own ISR window.\n */\n const announceRuleChange = useCallback(\n (source: string | undefined) => {\n const redirectPath =\n typeof source === 'string' && source.startsWith('/') ? source : '/'\n void authorizedFetch(currentUser, '/api/screens/revalidate', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ hostId, redirectPath }),\n }).catch(() => undefined)\n },\n [currentUser, hostId],\n )\n\n const handleSave = useCallback(async () => {\n if (!draft) return\n const kind = draft.kind || 'exact'\n // Shared v2 validation (AGL-375): regex patterns must compile; path\n // kinds keep the v1 normalization. A destination that wears another\n // brand is refused (AGL-3447); the site's own hosts never do.\n const problem = validateRedirectRule(\n {\n kind,\n source: draft.source,\n destination: draft.destination,\n },\n {\n ownDomains: [\n typeof host?.cname === 'string' ? host.cname : null,\n typeof host?.subdomain === 'string' && host.subdomain\n ? `${host.subdomain}.${TENANT_APEX}`\n : null,\n ],\n },\n )\n if (problem) {\n return void enqueueSnackbar(problem, {\n variant: 'warning',\n persist: false,\n })\n }\n const source =\n kind === 'regex'\n ? draft.source.trim()\n : (normalizeRedirectSource(draft.source) as string)\n const destination = normalizeRedirectDestination(\n draft.destination,\n ) as string\n if (kind !== 'regex' && isSelfRedirect({ source, destination })) {\n return void enqueueSnackbar('That would redirect the path to itself', {\n variant: 'warning',\n persist: false,\n })\n }\n const duplicate = findDuplicateRedirect(redirects, {\n $id: draft.id,\n source,\n kind,\n })\n if (duplicate) {\n return void enqueueSnackbar(`A rule for ${source} already exists`, {\n variant: 'warning',\n persist: false,\n })\n }\n // Chain-loop detection (AGL-156): follow internal destinations through\n // the rule set; a walk that returns to this source can never execute.\n if (walkRedirectChain(redirects, { $id: draft.id, source, destination }).loop) {\n return void enqueueSnackbar(\n 'That destination chains back to this rule — a redirect loop',\n { variant: 'warning', persist: false },\n )\n }\n // Screen-route collision: shadowing a live page may be intentional\n // (moved pages) — warn, don't block (decision per the issue).\n if (redirectSourceIsLivePage(host?.screens, source)) {\n enqueueSnackbar(\n `${source} is a published page — the redirect takes precedence`,\n { variant: 'info', persist: false },\n )\n }\n const fields = {\n source,\n destination,\n statusCode: (REDIRECT_STATUS_CODES as readonly number[]).includes(\n draft.statusCode,\n )\n ? draft.statusCode\n : 302,\n kind,\n priority: Number.isFinite(Number(draft.priority))\n ? Number(draft.priority)\n : REDIRECT_DEFAULT_PRIORITY,\n /**\n * Whatever the rule already was (AGL-1372). This was `true`, so editing\n * a **disabled** rule's target silently re-enabled it — a deliberate\n * \"off\" (a retired campaign, a rule that broke something) undone by a\n * routine save, changing site routing without the author asking.\n *\n * `!== false` rather than the raw value, because the switch below reads\n * the stored field the same way: absent means on. Enforcement's query is\n * `where('enabled', '==', true)`, so a rule missing the field is not\n * served, and normalising it here makes the console's claim true.\n *\n * The create default lives in `handleAdd` — a new rule seeds the draft\n * `true`, so both defaults hold without either one reading the other.\n */\n enabled: draft.enabled !== false,\n }\n /**\n * The publisher's stamp on an external destination (AGL-1881).\n *\n * `matchRedirect` will not send traffic off the platform without it, and\n * `cloud/firebase-firestore.rules` admits no write to this collection from\n * anyone but `canPublishHostContent` — so reaching this line at all is the\n * approval, and saving is how a rule written before that fix starts firing\n * again.\n *\n * Written on EDIT only. A create rides /api/hosts/resources, which stamps\n * the same field from the id token's verified uid; sending it from here\n * would be the client supplying its own provenance, and that route drops\n * it for exactly that reason.\n *\n * Cleared with `deleteField()` when the destination is internal, rather\n * than left standing. `merge: true` never removes a key, so an edit from\n * `https://elsewhere.example` back to `/pricing` would otherwise leave a\n * stamp behind that a LATER edit back to an external target would inherit\n * — approval carried across a destination nobody approved.\n */\n const approval = isExternalRedirectDestination(destination)\n ? { externalDestinationApprovedBy: currentUser?.uid ?? null }\n : { externalDestinationApprovedBy: deleteField() }\n try {\n if (draft.id) {\n /**\n * Edit stays client-direct (no quota consumed) — and is refused when\n * its seed was never confirmed by the server (AGL-1358); the eight\n * validation refusals above have all already returned by here.\n *\n * `merge: true` is load-bearing, contrary to what this said before\n * (AGL-1372): `fields` is every key the FORM owns, not every key the\n * document holds. `lastHitAt` is written by enforcement\n * (`resolve-redirect`), and `deletedAt` by the delete below — a\n * replacing write would erase both.\n *\n * The guard WRAPS the write. An early return is a shape you can keep\n * while losing the protection; here the write is only reachable\n * through the verdict.\n */\n const verdict = await writeGuardedBySeed(\n {\n subject: 'redirect',\n unreadable: redirectsStatus === 'error',\n fromCache: redirectsFromCache,\n listen: redirectsListen,\n },\n async () => {\n await setDoc(\n doc(firestore, 'hosts', hostId, 'redirects', draft.id),\n { ...fields, ...approval, updatedAt: Timestamp.now() },\n { merge: true },\n )\n },\n )\n // Before `setDraft(null)`, so a refusal keeps the dialog open with\n // what was typed, in the same warning vocabulary as the validation\n // refusals above it.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n } else {\n // New redirect rides the quota-enforcing resources API (AGL-473) —\n // it also re-checks the `redirects` entitlement server-side.\n await createHostResource({ hostId, resource: 'redirect', data: fields })\n }\n // The changed rule, and — when an edit moved the source — the path\n // that just STOPPED redirecting, so its page refreshes too.\n announceRuleChange(source)\n if (draft.id) {\n const previous = (redirects ?? []).find(\n (rule: any) => rule.$id === draft.id,\n )?.source\n if (previous && previous !== source) announceRuleChange(previous)\n }\n setDraft(null)\n enqueueSnackbar('Redirect saved — live within ~30 seconds', {\n variant: 'success',\n persist: false,\n })\n } catch (error: any) {\n console.error(error)\n enqueueSnackbar(error?.message ?? 'An error has occurred', {\n variant: 'error',\n allowDuplicate: true,\n })\n }\n }, [\n setDraft,\n draft,\n redirects,\n host,\n firestore,\n hostId,\n createHostResource,\n currentUser,\n enqueueSnackbar,\n redirectsStatus,\n redirectsFromCache,\n redirectsListen,\n announceRuleChange,\n ])\n\n /**\n * A refusal has to be visible (AGL-1881).\n *\n * These two writes were bare `await`s. The rules now gate this collection on\n * a publishing role, so an `author` reaching either gets a\n * permission-denied — and an unhandled rejection renders as a control that\n * flips back with no error, which is the worst way to say no. `handleSave`\n * has always ended in a snackbar; these now match it.\n *\n * The card is not role-gated on purpose: it is entitlement-gated, and the\n * rules leave READ to the catch-all so an author can still see the rules\n * that affect the pages they write.\n */\n const reportWriteFailure = useCallback(\n (error: any) => {\n enqueueSnackbar(\n error?.code === 'permission-denied'\n ? 'Changing a redirect needs a publishing role — ask an editor or admin'\n : (error?.message ?? 'An error has occurred'),\n { variant: 'warning', persist: false },\n )\n },\n [enqueueSnackbar],\n )\n\n const handleToggle = useCallback(\n (redirect: any) => async (event: { target: { checked: boolean } }) => {\n try {\n await updateDoc(\n doc(firestore, 'hosts', hostId, 'redirects', redirect.$id),\n { enabled: event.target.checked, updatedAt: Timestamp.now() },\n )\n announceRuleChange(redirect.source)\n } catch (error: any) {\n reportWriteFailure(error)\n }\n },\n [firestore, hostId, reportWriteFailure, announceRuleChange],\n )\n\n const handleDelete = useCallback(\n (redirect: any) => async () => {\n const confirmed = await confirm({\n title: 'Delete this redirect?',\n description: `${redirect.source} stops redirecting.`,\n confirmationText: 'Delete',\n confirmationButtonProps: { color: 'error' },\n })\n .then(() => true)\n .catch(() => false)\n if (!confirmed) return\n try {\n await updateDoc(\n doc(firestore, 'hosts', hostId, 'redirects', redirect.$id),\n { deletedAt: Timestamp.now(), enabled: false },\n )\n announceRuleChange(redirect.source)\n } catch (error: any) {\n reportWriteFailure(error)\n }\n },\n [confirm, firestore, hostId, reportWriteFailure, announceRuleChange],\n )\n\n /*\n * Import and Export, through the console's transfer launcher (`null`\n * outside the console shell, where there is no workspace to move rules in\n * or out of). The list above is a live listener, so an import's rules show\n * up without a refresh.\n */\n const transfer = useTransferLauncher()\n const transferTarget = { resource: REDIRECTS_TRANSFER_KEY, scope: 'host' as const, hostId }\n // Import for those who may write the records, Export for those who may read them.\n const canImport = Boolean(transfer?.can('import', transferTarget))\n const canExport = Boolean(transfer?.can('export', transferTarget))\n const transferActions =\n transfer && (canImport || canExport) ? (\n <Stack direction=\"row\" spacing={1}>\n {/* An import left unfinished, reopened where it stopped (AGL-3549). */}\n <TransferResumeImport target={transferTarget} />\n {canImport && (\n <Button size=\"small\" onClick={() => transfer.openImport(transferTarget)}>\n {'Import'}\n </Button>\n )}\n {canExport && (\n <Button\n size=\"small\"\n onClick={() =>\n transfer.openExport(transferTarget)\n }\n >\n {'Export'}\n </Button>\n )}\n </Stack>\n ) : null\n\n return (\n <CardDisplay\n header={'URL redirects'}\n help={pluginDocsHelp('redirects', { anchor: '#manage-redirects' })}\n HeaderProps={transferActions ? { action: transferActions } : undefined}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Exact-path rules; 302 while testing, promote to 301 when ' +\n 'sure (browsers cache 301 aggressively). Changes go live ' +\n 'within ~30 seconds. A visitor’s query string is passed on: ' +\n 'its parameters are added to the destination’s, and the ' +\n 'destination’s own win.'}\n </Typography>\n {hits && totalHits > 0 ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`${totalHits} redirect hit${totalHits === 1 ? '' : 's'} in ` +\n 'the last 30 days (sampled — one per cache window with ' +\n 'traffic).'}\n </Typography>\n ) : null}\n {visibleRedirects.map((redirect: any) => (\n <Stack\n key={redirect.$id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n >\n <Switch\n size=\"small\"\n checked={redirect.enabled !== false}\n onChange={handleToggle(redirect)}\n />\n <Chip size=\"small\" label={redirect.statusCode ?? 302} />\n {(redirect.kind ?? 'exact') !== 'exact' ? (\n <Chip\n size=\"small\"\n variant=\"outlined\"\n label={redirect.kind}\n />\n ) : null}\n {/* An external rule with no publisher stamp is not being served\n (AGL-1881) — `matchRedirect` skips it. Say so on the row\n rather than letting it read as live: a rule that silently\n stops firing is the failure mode a fail-closed gate owes an\n explanation for, and pressing Edit → Save is the whole fix.\n Shown for external destinations only, since that is the only\n case the gate applies to. */}\n {isExternalRedirectDestination(redirect.destination) &&\n !redirect.externalDestinationApprovedBy ? (\n <Chip\n size=\"small\"\n color=\"warning\"\n variant=\"outlined\"\n label=\"not serving\"\n title={\n 'This rule sends visitors to another site. Open it and ' +\n 'save to confirm the destination — until then it is ' +\n 'skipped.'\n }\n />\n ) : null}\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {`${redirect.source} → ${redirect.destination}`}\n </Typography>\n {hits || redirect.lastHitAt ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {[\n hits\n ? `${hits[redirectHitKey(redirect.$id)] ?? 0} hits (30d, sampled)`\n : null,\n redirect.lastHitAt\n ? `last ${redirect.lastHitAt\n .toDate()\n .toLocaleString()}`\n : null,\n ]\n .filter(Boolean)\n .join(' · ')}\n </Typography>\n ) : null}\n </Stack>\n <Button\n size=\"small\"\n onClick={() => setDraft(redirectDraftOf(redirect))}\n >\n {'Edit'}\n </Button>\n <Button\n size=\"small\"\n color=\"error\"\n onClick={handleDelete(redirect)}\n >\n {'Delete'}\n </Button>\n </Stack>\n ))}\n {redirects.length === 0 ? null : (\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={visibleRedirects.length}\n // The rules this page HOLDS, after the soft-deleted ones are\n // dropped. Not the quota figure below it: that is a server\n // count over every document, soft-deleted rows included,\n // because a deleted rule still occupies a slot.\n count={redirects.length}\n onPageChange={setPage}\n onPageSizeChange={setPageSize}\n />\n )}\n {redirectsTruncated ? (\n <Alert severity=\"info\">\n {`Showing ${REDIRECT_CEILING} rules, ordered by id. This site ` +\n 'has more — the duplicate check and the tester below only ' +\n 'cover the ones listed here.'}\n </Alert>\n ) : null}\n <Button\n size=\"small\"\n color=\"primary\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={handleAdd}\n >\n {'Add redirect'}\n </Button>\n {/* The cap, standing rather than only on refusal (AGL-2113).\n `enforcedCount` is what the enforcing route counts and what\n `handleAdd` checks against, so the readout, the gate and the\n server cannot disagree. It is deliberately NOT the number of rows\n on screen: the list is a capped window, and the live count past\n it is what the server refuses at. */}\n <QuotaReadoutComponent\n ready={org != null && enforcedCount != null}\n used={enforcedCount ?? 0}\n limit={\n checkQuota(org, 'redirectsPerHost', enforcedCount ?? 0).limit\n }\n noun=\"redirect\"\n />\n {/* Inline tester (AGL-375): same matcher as enforcement. */}\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <TextField\n size=\"small\"\n label=\"Test a path\"\n placeholder=\"/old-page\"\n value={testPath}\n onChange={(event) => setTestPath(event.target.value)}\n sx={{ maxWidth: 260 }}\n />\n {testPath.trim() ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {(() => {\n const normalized =\n normalizeRedirectSource(testPath) ?? testPath.trim()\n const result = matchRedirect(redirects as any, normalized)\n return result\n ? `→ ${result.destination} (${result.statusCode})`\n : 'No rule matches'\n })()}\n </Typography>\n ) : null}\n </Stack>\n </Stack>\n\n <Dialog\n open={Boolean(draft)}\n onClose={() => setDraft(null)}\n maxWidth=\"xs\"\n fullWidth\n >\n <DialogTitle>{draft?.id ? 'Edit redirect' : 'Add redirect'}</DialogTitle>\n <DialogContent\n sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, pt: 1 }}\n >\n <TextField\n select\n label=\"Match mode\"\n value={draft?.kind ?? 'exact'}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, kind: event.target.value } : prev,\n )\n }\n size=\"small\"\n sx={{ mt: 1 }}\n >\n <MenuItem value=\"exact\">{'Exact path'}</MenuItem>\n <MenuItem value=\"prefix\">{'Path prefix'}</MenuItem>\n <MenuItem value=\"regex\">{'Regular expression'}</MenuItem>\n </TextField>\n <TextField\n label={draft?.kind === 'regex' ? 'Pattern' : 'From path'}\n placeholder={\n draft?.kind === 'regex' ? '/product/(\\\\d+)' : '/old-page'\n }\n helperText={\n draft?.kind === 'regex'\n ? 'Anchored to the whole path; use $1, $2 in the destination'\n : draft?.kind === 'prefix'\n ? 'Matches the path and everything under it'\n : undefined\n }\n value={draft?.source ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, source: event.target.value } : prev,\n )\n }\n size=\"small\"\n autoFocus\n />\n <TextField\n label=\"To\"\n placeholder=\"/new-page or https://example.com\"\n value={draft?.destination ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, destination: event.target.value } : prev,\n )\n }\n size=\"small\"\n />\n <TextField\n select\n label=\"Status code\"\n value={draft?.statusCode ?? 302}\n onChange={(event) =>\n setDraft((prev) =>\n prev\n ? { ...prev, statusCode: Number(event.target.value) }\n : prev,\n )\n }\n size=\"small\"\n >\n <MenuItem value={302}>{'302 — temporary (default)'}</MenuItem>\n <MenuItem value={301}>{'301 — permanent'}</MenuItem>\n <MenuItem value={307}>{'307 — temporary, keep method'}</MenuItem>\n <MenuItem value={308}>{'308 — permanent, keep method'}</MenuItem>\n </TextField>\n <TextField\n label=\"Priority\"\n type=\"number\"\n helperText=\"Lower fires first when several rules match\"\n value={draft?.priority ?? REDIRECT_DEFAULT_PRIORITY}\n onChange={(event) =>\n setDraft((prev) =>\n prev\n ? { ...prev, priority: Number(event.target.value) }\n : prev,\n )\n }\n size=\"small\"\n />\n </DialogContent>\n <DialogActions>\n {draftChecking ? (\n <Typography variant=\"body2\" color=\"text.secondary\" role=\"status\" sx={{ mr: 'auto' }}>\n {seedCheckingText('redirect')}\n </Typography>\n ) : null}\n <Button onClick={() => setDraft(null)}>{'Cancel'}</Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={\n draftChecking || !draft?.source.trim() || !draft?.destination.trim()\n }\n onClick={handleSave}\n >\n {'Save redirect'}\n </Button>\n </DialogActions>\n </Dialog>\n </CardDisplay>\n )\n}\nRedirectsConsolePage.displayName = 'RedirectsConsolePage'\n\nexport default RedirectsConsolePage\n"],"names":["TransferResumeImport","checkQuota","pluginDocsHelp","useTransferLauncher","TENANT_APEX","findDuplicateRedirect","isExternalRedirectDestination","isSelfRedirect","matchRedirect","normalizeRedirectDestination","normalizeRedirectSource","REDIRECT_DEFAULT_PRIORITY","redirectHitKey","redirectSourceIsLivePage","validateRedirectRule","REDIRECT_STATUS_CODES","walkRedirectChain","CardDisplay","useConfirmationContext","REDIRECTS_TRANSFER_KEY","authorizedFetch","QuotaReadoutComponent","useSnackbar","Timestamp","Alert","Button","Chip","Dialog","DialogActions","DialogContent","DialogTitle","MenuItem","Stack","Switch","TextField","Typography","collection","deleteField","doc","getDoc","setDoc","updateDoc","getLiveCountFromServer","useCallback","useEffect","useMemo","useState","ListPagination","TABLE_PAGE_SIZE_DEFAULT","ceilingedWindow","collectionCeiling","useFirestore","useFirestoreCollection","useFirestoreDoc","useHostResourceApi","useUser","writeGuardedBySeed","isSeedChecking","seedCheckingText","useSeedDraft","REDIRECT_CEILING","redirectDraftOf","redirect","id","$id","source","destination","statusCode","kind","priority","enabled","RedirectsConsolePage","props","hostId","entitled","org","firestore","createHostResource","data","currentUser","enqueueSnackbar","confirm","redirectDocs","status","redirectsStatus","fromCache","redirectsFromCache","listen","redirectsListen","idField","rows","readRedirects","truncated","redirectsTruncated","redirects","filter","deletedAt","sort","a","b","String","localeCompare","page","setPage","pageSize","setPageSize","visibleRedirects","slice","enforcedCount","setEnforcedCount","liveRedirectDocCount","length","countRedirects","active","then","count","draft","setDraft","opened","row","find","undefined","draftChecking","Boolean","unreadable","testPath","setTestPath","host","hits","setHits","ids","Array","from","_","index","date","Date","setDate","getDate","toISOString","Promise","all","map","snapshot","get","catch","days","totals","dayMap","redirectId","Object","entries","Number","totalHits","values","reduce","sum","handleAdd","variant","persist","quota","allowed","limit","announceRuleChange","redirectPath","startsWith","method","headers","body","JSON","stringify","handleSave","problem","ownDomains","cname","subdomain","trim","duplicate","loop","screens","fields","includes","isFinite","approval","externalDestinationApprovedBy","uid","verdict","subject","updatedAt","now","merge","ok","message","resource","previous","rule","error","console","allowDuplicate","reportWriteFailure","code","handleToggle","event","target","checked","handleDelete","confirmed","title","description","confirmationText","confirmationButtonProps","color","transfer","transferTarget","scope","canImport","can","canExport","transferActions","direction","spacing","size","onClick","openImport","openExport","header","help","anchor","HeaderProps","action","contentGutterX","contentGutterY","sx","alignItems","onChange","label","flex","minWidth","noWrap","lastHitAt","toDate","toLocaleString","join","rowCount","onPageChange","onPageSizeChange","severity","alignSelf","ready","used","noun","placeholder","value","maxWidth","normalized","result","open","onClose","fullWidth","display","flexDirection","gap","pt","select","prev","mt","helperText","autoFocus","type","role","mr","disabled","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,UAAU,EAAEC,cAAc,EAAEC,mBAAmB,QAAQ,eAAc;AAE9E,SAASC,WAAW,QAAQ,qCAAoC;AAChE,SAASC,qBAAqB,EAAEC,6BAA6B,EAAEC,cAAc,EAAEC,aAAa,EAAEC,4BAA4B,EAAEC,uBAAuB,EAAEC,yBAAyB,EAAEC,cAAc,EAAEC,wBAAwB,EAAEC,oBAAoB,EAAEC,qBAAqB,EAAEC,iBAAiB,QAAQ,oBAAU;AAC1S,SAASC,WAAW,EAAEC,sBAAsB,QAAQ,uBAAsB;AAC1E,SAASC,sBAAsB,QAAQ,2CAAuC;AAC9E,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,OAAOC,2BAA2B,0DAAyD;AAC3F,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,SAAS,QAAQ,+BAA8B;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../../../../../libs/plugins/redirects/src/lib/components/redirects-console-page.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 { TransferResumeImport } from '@aglyn/aglyn/app-utils/transfer-resume-import'\nimport { checkQuota, pluginDocsHelp, useTransferLauncher } from '@aglyn/aglyn'\nimport { type ConsolePluginPageProps } from '@aglyn/aglyn'\nimport { TENANT_APEX } from '@aglyn/aglyn/app-utils/tenant-apex'\nimport { findDuplicateRedirect, isExternalRedirectDestination, isSelfRedirect, matchRedirect, normalizeRedirectDestination, normalizeRedirectSource, REDIRECT_DEFAULT_PRIORITY, redirectHitKey, redirectSourceIsLivePage, validateRedirectRule, REDIRECT_STATUS_CODES, walkRedirectChain } from '../model'\nimport { CardDisplay, useConfirmationContext } from '@aglyn/shared-ui-jsx'\nimport { REDIRECTS_TRANSFER_KEY } from '../transfer/redirects-transfer-fields'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport QuotaReadoutComponent from '@aglyn/shared-ui-jsx/components/quota-readout.component'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { Timestamp } from '@aglyn/shared-util-timestamp'\nimport {\n Alert,\n Button,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n MenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n collection,\n deleteField,\n doc,\n getDoc,\n setDoc,\n updateDoc,\n} from 'firebase/firestore'\nimport { getLiveCountFromServer } from '@aglyn/aglyn/app-utils/live-document-count.client'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { TABLE_PAGE_SIZE_DEFAULT } from '@aglyn/shared-ui-jsx/const/table-pagination'\nimport {\n ceilingedWindow,\n collectionCeiling,\n useFirestore,\n useFirestoreCollection,\n useFirestoreDoc,\n useHostResourceApi,\n useUser,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport {\n heldSaveLabel,\n isSeedChecking,\n seedCheckingText,\n useHeldSave,\n} from '@aglyn/tenant-feature-instance/hooks/use-seed-edits'\nimport { useSeedDraft } from '@aglyn/tenant-feature-instance/hooks/use-seed-draft'\n\n/**\n * How many redirect documents this page reads.\n *\n * A CEILING, not a page size. Everything the page decides is computed over\n * the WHOLE rule set: the duplicate-source check, the chain-loop walk that\n * follows internal destinations through the rules, and the inline tester that\n * runs the enforcement matcher. A server page would give each of them a\n * tenth of the rules to reason about, and the duplicate check would then\n * create exactly the collision it exists to prevent.\n */\nconst REDIRECT_CEILING = 200\n\ninterface RedirectDraft {\n id: string | null\n source: string\n destination: string\n statusCode: number\n /** Match mode (AGL-375): exact | prefix | regex. */\n kind: string\n /** Lower fires first. */\n priority: number\n /**\n * The rule's on/off state, carried through the editor rather than reset by\n * it (AGL-1372). The save used to hardcode `true`, so changing a **disabled**\n * rule's target turned it back on and rerouted the site without the author\n * asking. A new rule seeds this `true`; an edit seeds it from the stored\n * rule, which is also where the row's switch reads from.\n */\n enabled: boolean\n}\n\n/**\n * Redirect manager (AGL-156): CRUD over `hosts/{hostId}/redirects` with\n * the shared AGL-154 validation (normalized sources, https-or-internal\n * destinations, self-redirect refusal, duplicate-source check). Paid\n * (`redirects` flag + `redirectsPerHost` quota); rules take effect on the\n * site within ~30 seconds (AGL-155 ISR window).\n *\n * The plan gate is the SHELL's, and it runs before this component exists\n * (AGL-2484): the console resolves `redirects` from the org billing doc and\n * renders its own refusal notice in place of the surface, so this card is\n * only ever mounted for an entitled org and states no plan terms of its own.\n * Redirects registers no `upgradeNotice` override because it is a genuine\n * upgrade — free denies it, Starter and above grant it — which makes the\n * shell's plan-derived sentence the accurate one already.\n *\n * `entitled` is still read below, where it is not redundant: it holds back\n * the thirty analytics day-doc reads behind the hit counts, and refuses the\n * add path ahead of the server that enforces it.\n */\n/** A stored rule as the editor holds it. */\nfunction redirectDraftOf(redirect: any): RedirectDraft {\n return {\n id: redirect.$id,\n source: redirect.source ?? '',\n destination: redirect.destination ?? '',\n statusCode: redirect.statusCode ?? 302,\n kind: redirect.kind ?? 'exact',\n priority: redirect.priority ?? REDIRECT_DEFAULT_PRIORITY,\n // Read exactly as the switch beside it does (AGL-1372): an edit must not\n // be a way to turn a rule back on.\n enabled: redirect.enabled !== false,\n }\n}\n\nexport function RedirectsConsolePage(props: ConsolePluginPageProps) {\n const { hostId, entitled, org } = props\n const firestore = useFirestore()\n const createHostResource = useHostResourceApi()\n const { data: currentUser } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const { confirm } = useConfirmationContext()\n\n const {\n data: redirectDocs,\n status: redirectsStatus,\n /**\n * The rows this editor is seeded from are unconfirmed by the server\n * (AGL-1358). Editing copies every field the form owns out of the stored\n * rule and writes all of them back, so `merge: true` protects only the\n * fields written elsewhere (`lastHitAt`, `deletedAt`). This is the site\n * where a rollback is hardest to undo: a reverted `destination` on a\n * **301** is cached by every browser that has already followed it, so the\n * stale target outlives the fix in the console. `kind` reverting from\n * exact to prefix silently widens a rule over a whole subtree, and\n * `priority` reorders which rule fires when several match.\n */\n fromCache: redirectsFromCache,\n listen: redirectsListen,\n } = useFirestoreCollection<any>(\n /*\n * ORDERED AND CEILINGED, with a probe (AGL-2501).\n *\n * `limit(200)` alone is answered in DOCUMENT-ID order and the ids are\n * generated, so the window was a pseudo-random two hundred of the site's\n * rules — sorted by `source` in the browser afterwards, which is what\n * made it invisible: the rules on screen run alphabetically and are\n * simply the wrong rules, and the ones missing leave no gap to notice.\n *\n * `orderBy('source')` is the tempting fix and the dangerous one. It\n * matches only documents that HAVE the field, and nothing validates\n * `source` for presence — `/api/hosts/resources` stores an allow-list of\n * fields and checks none of them — so a rule saved without one would\n * vanish from this page while still redirecting live traffic. The\n * document NAME cannot be absent, so the walk is total: every rule is\n * reachable, and the alphabetical order stays where it belongs, in the\n * sort below over a window the page holds whole.\n */\n () =>\n collectionCeiling(\n collection(firestore, 'hosts', hostId, 'redirects'),\n REDIRECT_CEILING,\n ),\n [firestore, hostId],\n { idField: '$id' },\n )\n const { rows: readRedirects, truncated: redirectsTruncated } =\n ceilingedWindow<any>(redirectDocs, REDIRECT_CEILING)\n const redirects = [...readRedirects]\n .filter((redirect: any) => !redirect.deletedAt)\n .sort((a: any, b: any) =>\n String(a.source ?? '').localeCompare(String(b.source ?? '')),\n )\n\n /*\n * The page is a SLICE of the ceiling, which is what the three whole-set\n * consumers above require. The count is the rules this page HOLDS, after\n * soft-deleted ones are dropped — not the quota, which is a server count of\n * every document including the soft-deleted, and is read separately below.\n */\n const [page, setPage] = useState(0)\n const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT)\n const visibleRedirects = useMemo(\n () => redirects.slice(page * pageSize, page * pageSize + pageSize),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [redirectDocs, page, pageSize],\n )\n\n /**\n * What the ENFORCING route counts, which is not what this page was counting.\n *\n * `hosts/{id}/redirects` is read here as an unordered `limit(200)` window\n * and then filtered to drop soft-deleted rows, and that filtered length was\n * feeding both `checkQuota('redirectsPerHost')` and the readout beside it.\n * The route in `app/api/hosts/resources` counted the collection plainly,\n * soft-deleted rules included, so the two disagreed on both counts at\n * once: a rule deleted in this console still occupied a slot on the\n * server, and a site past 200 rules has rows the window never saw.\n *\n * The visible effect is the worst kind: the page shows room, the author\n * fills in the form, and the save is refused by a server counting something\n * else. Same shape as AGL-1716.\n *\n * The RULE is now that a deleted rule frees its slot and a disabled one\n * keeps it (AGL-3918), on the route and here alike: every document less\n * the tombstones (`getLiveCountFromServer`), two aggregation queries that\n * cost one read unit per thousand documents rather than reading them.\n * Re-run when the LIVE set read here changes, which covers an add and a\n * delete alike.\n */\n const [enforcedCount, setEnforcedCount] = useState<number | null>(null)\n const liveRedirectDocCount = (redirectDocs ?? []).filter(\n (redirect: any) => !redirect.deletedAt,\n ).length\n\n /**\n * `null` when the count cannot be taken, never a number.\n *\n * `try`, not `.catch()`: `getCountFromServer` validates its reference and\n * THROWS synchronously on a bad one, so a rejection handler alone leaves the\n * error to escape the effect and take the page down with it. Unreadable is\n * also not zero — answering zero would tell an author at their cap that the\n * whole allowance is free.\n */\n const countRedirects = useCallback(async (): Promise<number | null> => {\n try {\n return await getLiveCountFromServer(\n collection(firestore, 'hosts', hostId, 'redirects'),\n )\n } catch {\n return null\n }\n }, [firestore, hostId])\n\n useEffect(() => {\n let active = true\n void countRedirects().then((count) => {\n if (active && count != null) setEnforcedCount(count)\n })\n return () => {\n active = false\n }\n }, [countRedirects, liveRedirectDocCount])\n\n /*\n * The editor's draft, kept as EDITS over the rule as the list has it now\n * (AGL-4047): opened from the cache's row, the server's copy replaces it\n * under every field nobody touched (`enabled` among them), and Save is\n * held until it has.\n */\n const [draft, setDraft] = useSeedDraft<RedirectDraft>((opened) => {\n const row = opened.id\n ? redirects.find((redirect: any) => redirect.$id === opened.id)\n : undefined\n return row ? redirectDraftOf(row) : undefined\n })\n const draftChecking =\n Boolean(draft?.id) &&\n isSeedChecking({\n fromCache: redirectsFromCache,\n unreadable: redirectsStatus === 'error',\n })\n const [testPath, setTestPath] = useState('')\n\n // Host routing map for the screen-collision warning (AGL-156 spec).\n const { data: host } = useFirestoreDoc<any>(\n () => doc(firestore, 'hosts', hostId),\n [firestore, hostId],\n { idField: '$id' },\n )\n\n // Sampled hit counts (AGL-157): summed from the last 30 analytics day\n // docs' `redirects` maps written by enforcement. Counts are sampled —\n // one per ISR revalidation window with traffic, not per request.\n const [hits, setHits] = useState<Record<string, number> | null>(null)\n useEffect(() => {\n if (!entitled) return\n let active = true\n const ids = Array.from({ length: 30 }, (_, index) => {\n const date = new Date()\n date.setDate(date.getDate() - index)\n return date.toISOString().slice(0, 10)\n })\n void Promise.all(\n ids.map((id) =>\n getDoc(doc(firestore, 'hosts', hostId, 'analytics', id))\n .then((snapshot) => (snapshot.get('redirects') ?? {}) as Record<string, number>)\n .catch(() => ({}) as Record<string, number>),\n ),\n ).then((days) => {\n if (!active) return\n const totals: Record<string, number> = {}\n for (const dayMap of days) {\n for (const [redirectId, count] of Object.entries(dayMap)) {\n totals[redirectId] = (totals[redirectId] ?? 0) + Number(count)\n }\n }\n setHits(totals)\n })\n return () => {\n active = false\n }\n }, [entitled, firestore, hostId])\n const totalHits = Object.values(hits ?? {}).reduce(\n (sum, count) => sum + count,\n 0,\n )\n\n const handleAdd = useCallback(() => {\n if (!entitled) {\n return void enqueueSnackbar(\n 'URL redirects require a Starter plan — see Billing to upgrade',\n { variant: 'warning', persist: false },\n )\n }\n /*\n * The SERVER's count, not the rows on screen — the whole point of this\n * fix. Read from the polled value rather than re-counted on the click:\n * this gate is a courtesy that spares the author a form they are about to\n * be refused, the route is the actual enforcer, and making the button\n * await an aggregation would delay the dialog on every press to sharpen a\n * number the server re-checks anyway.\n *\n * `null` means the count could not be read, and that lets the add through:\n * refusing on a number we do not have would block an author who may well\n * be inside their cap.\n */\n const quota = checkQuota(org, 'redirectsPerHost', enforcedCount ?? 0)\n if (!quota.allowed) {\n return void enqueueSnackbar(\n `Redirect limit reached (${quota.limit}) — upgrade in Billing`,\n { variant: 'warning', persist: false },\n )\n }\n setDraft({\n id: null,\n source: '',\n destination: '',\n statusCode: 302,\n kind: 'exact',\n priority: REDIRECT_DEFAULT_PRIORITY,\n // A NEW rule is on: the author is adding it to make it fire, and\n // enforcement queries `where('enabled', '==', true)`, so a rule created\n // without the field would never resolve (AGL-1372).\n enabled: true,\n })\n }, [setDraft, entitled, org, enforcedCount, enqueueSnackbar])\n\n /**\n * Tell the tenant a rule changed (best effort, never awaited into the save\n * outcome). Rule writes are client Firestore writes with no publish step,\n * and the tenant's rules list sits behind the hour-long\n * `tenant-data:{hostId}` backstop — without this call a new rule waits out\n * that TTL while the snackbar above promises ~30 seconds. The route busts\n * the host tag and drops the source path's cached HTML; a regex pattern has\n * no single literal path, so it announces `/` for the tag bust alone and\n * the matching pages catch up on their own ISR window.\n */\n const announceRuleChange = useCallback(\n (source: string | undefined) => {\n const redirectPath =\n typeof source === 'string' && source.startsWith('/') ? source : '/'\n void authorizedFetch(currentUser, '/api/screens/revalidate', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ hostId, redirectPath }),\n }).catch(() => undefined)\n },\n [currentUser, hostId],\n )\n\n const handleSave = useCallback(async () => {\n if (!draft) return\n const kind = draft.kind || 'exact'\n // Shared v2 validation (AGL-375): regex patterns must compile; path\n // kinds keep the v1 normalization. A destination that wears another\n // brand is refused (AGL-3447); the site's own hosts never do.\n const problem = validateRedirectRule(\n {\n kind,\n source: draft.source,\n destination: draft.destination,\n },\n {\n ownDomains: [\n typeof host?.cname === 'string' ? host.cname : null,\n typeof host?.subdomain === 'string' && host.subdomain\n ? `${host.subdomain}.${TENANT_APEX}`\n : null,\n ],\n },\n )\n if (problem) {\n return void enqueueSnackbar(problem, {\n variant: 'warning',\n persist: false,\n })\n }\n const source =\n kind === 'regex'\n ? draft.source.trim()\n : (normalizeRedirectSource(draft.source) as string)\n const destination = normalizeRedirectDestination(\n draft.destination,\n ) as string\n if (kind !== 'regex' && isSelfRedirect({ source, destination })) {\n return void enqueueSnackbar('That would redirect the path to itself', {\n variant: 'warning',\n persist: false,\n })\n }\n const duplicate = findDuplicateRedirect(redirects, {\n $id: draft.id,\n source,\n kind,\n })\n if (duplicate) {\n return void enqueueSnackbar(`A rule for ${source} already exists`, {\n variant: 'warning',\n persist: false,\n })\n }\n // Chain-loop detection (AGL-156): follow internal destinations through\n // the rule set; a walk that returns to this source can never execute.\n if (walkRedirectChain(redirects, { $id: draft.id, source, destination }).loop) {\n return void enqueueSnackbar(\n 'That destination chains back to this rule — a redirect loop',\n { variant: 'warning', persist: false },\n )\n }\n // Screen-route collision: shadowing a live page may be intentional\n // (moved pages) — warn, don't block (decision per the issue).\n if (redirectSourceIsLivePage(host?.screens, source)) {\n enqueueSnackbar(\n `${source} is a published page — the redirect takes precedence`,\n { variant: 'info', persist: false },\n )\n }\n const fields = {\n source,\n destination,\n statusCode: (REDIRECT_STATUS_CODES as readonly number[]).includes(\n draft.statusCode,\n )\n ? draft.statusCode\n : 302,\n kind,\n priority: Number.isFinite(Number(draft.priority))\n ? Number(draft.priority)\n : REDIRECT_DEFAULT_PRIORITY,\n /**\n * Whatever the rule already was (AGL-1372). This was `true`, so editing\n * a **disabled** rule's target silently re-enabled it — a deliberate\n * \"off\" (a retired campaign, a rule that broke something) undone by a\n * routine save, changing site routing without the author asking.\n *\n * `!== false` rather than the raw value, because the switch below reads\n * the stored field the same way: absent means on. Enforcement's query is\n * `where('enabled', '==', true)`, so a rule missing the field is not\n * served, and normalising it here makes the console's claim true.\n *\n * The create default lives in `handleAdd` — a new rule seeds the draft\n * `true`, so both defaults hold without either one reading the other.\n */\n enabled: draft.enabled !== false,\n }\n /**\n * The publisher's stamp on an external destination (AGL-1881).\n *\n * `matchRedirect` will not send traffic off the platform without it, and\n * `cloud/firebase-firestore.rules` admits no write to this collection from\n * anyone but `canPublishHostContent` — so reaching this line at all is the\n * approval, and saving is how a rule written before that fix starts firing\n * again.\n *\n * Written on EDIT only. A create rides /api/hosts/resources, which stamps\n * the same field from the id token's verified uid; sending it from here\n * would be the client supplying its own provenance, and that route drops\n * it for exactly that reason.\n *\n * Cleared with `deleteField()` when the destination is internal, rather\n * than left standing. `merge: true` never removes a key, so an edit from\n * `https://elsewhere.example` back to `/pricing` would otherwise leave a\n * stamp behind that a LATER edit back to an external target would inherit\n * — approval carried across a destination nobody approved.\n */\n const approval = isExternalRedirectDestination(destination)\n ? { externalDestinationApprovedBy: currentUser?.uid ?? null }\n : { externalDestinationApprovedBy: deleteField() }\n try {\n if (draft.id) {\n /**\n * Edit stays client-direct (no quota consumed) — and is refused when\n * its seed was never confirmed by the server (AGL-1358); the eight\n * validation refusals above have all already returned by here.\n *\n * `merge: true` is load-bearing, contrary to what this said before\n * (AGL-1372): `fields` is every key the FORM owns, not every key the\n * document holds. `lastHitAt` is written by enforcement\n * (`resolve-redirect`), and `deletedAt` by the delete below — a\n * replacing write would erase both.\n *\n * The guard WRAPS the write. An early return is a shape you can keep\n * while losing the protection; here the write is only reachable\n * through the verdict.\n */\n const verdict = await writeGuardedBySeed(\n {\n subject: 'redirect',\n unreadable: redirectsStatus === 'error',\n fromCache: redirectsFromCache,\n listen: redirectsListen,\n },\n async () => {\n await setDoc(\n doc(firestore, 'hosts', hostId, 'redirects', draft.id),\n { ...fields, ...approval, updatedAt: Timestamp.now() },\n { merge: true },\n )\n },\n )\n // Before `setDraft(null)`, so a refusal keeps the dialog open with\n // what was typed, in the same warning vocabulary as the validation\n // refusals above it.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n } else {\n // New redirect rides the quota-enforcing resources API (AGL-473) —\n // it also re-checks the `redirects` entitlement server-side.\n await createHostResource({ hostId, resource: 'redirect', data: fields })\n }\n // The changed rule, and — when an edit moved the source — the path\n // that just STOPPED redirecting, so its page refreshes too.\n announceRuleChange(source)\n if (draft.id) {\n const previous = (redirects ?? []).find(\n (rule: any) => rule.$id === draft.id,\n )?.source\n if (previous && previous !== source) announceRuleChange(previous)\n }\n setDraft(null)\n enqueueSnackbar('Redirect saved — live within ~30 seconds', {\n variant: 'success',\n persist: false,\n })\n } catch (error: any) {\n console.error(error)\n enqueueSnackbar(error?.message ?? 'An error has occurred', {\n variant: 'error',\n allowDuplicate: true,\n })\n }\n }, [\n setDraft,\n draft,\n redirects,\n host,\n firestore,\n hostId,\n createHostResource,\n currentUser,\n enqueueSnackbar,\n redirectsStatus,\n redirectsFromCache,\n redirectsListen,\n announceRuleChange,\n ])\n\n /**\n * A refusal has to be visible (AGL-1881).\n *\n * These two writes were bare `await`s. The rules now gate this collection on\n * a publishing role, so an `author` reaching either gets a\n * permission-denied — and an unhandled rejection renders as a control that\n * flips back with no error, which is the worst way to say no. `handleSave`\n * has always ended in a snackbar; these now match it.\n *\n * The card is not role-gated on purpose: it is entitlement-gated, and the\n * rules leave READ to the catch-all so an author can still see the rules\n * that affect the pages they write.\n */\n const reportWriteFailure = useCallback(\n (error: any) => {\n enqueueSnackbar(\n error?.code === 'permission-denied'\n ? 'Changing a redirect needs a publishing role — ask an editor or admin'\n : (error?.message ?? 'An error has occurred'),\n { variant: 'warning', persist: false },\n )\n },\n [enqueueSnackbar],\n )\n\n const handleToggle = useCallback(\n (redirect: any) => async (event: { target: { checked: boolean } }) => {\n try {\n await updateDoc(\n doc(firestore, 'hosts', hostId, 'redirects', redirect.$id),\n { enabled: event.target.checked, updatedAt: Timestamp.now() },\n )\n announceRuleChange(redirect.source)\n } catch (error: any) {\n reportWriteFailure(error)\n }\n },\n [firestore, hostId, reportWriteFailure, announceRuleChange],\n )\n\n const handleDelete = useCallback(\n (redirect: any) => async () => {\n const confirmed = await confirm({\n title: 'Delete this redirect?',\n description: `${redirect.source} stops redirecting.`,\n confirmationText: 'Delete',\n confirmationButtonProps: { color: 'error' },\n })\n .then(() => true)\n .catch(() => false)\n if (!confirmed) return\n try {\n await updateDoc(\n doc(firestore, 'hosts', hostId, 'redirects', redirect.$id),\n { deletedAt: Timestamp.now(), enabled: false },\n )\n announceRuleChange(redirect.source)\n } catch (error: any) {\n reportWriteFailure(error)\n }\n },\n [confirm, firestore, hostId, reportWriteFailure, announceRuleChange],\n )\n\n /*\n * Import and Export, through the console's transfer launcher (`null`\n * outside the console shell, where there is no workspace to move rules in\n * or out of). The list above is a live listener, so an import's rules show\n * up without a refresh.\n */\n const transfer = useTransferLauncher()\n const transferTarget = { resource: REDIRECTS_TRANSFER_KEY, scope: 'host' as const, hostId }\n // Import for those who may write the records, Export for those who may read them.\n const canImport = Boolean(transfer?.can('import', transferTarget))\n const canExport = Boolean(transfer?.can('export', transferTarget))\n const transferActions =\n transfer && (canImport || canExport) ? (\n <Stack direction=\"row\" spacing={1}>\n {/* An import left unfinished, reopened where it stopped (AGL-3549). */}\n <TransferResumeImport target={transferTarget} />\n {canImport && (\n <Button size=\"small\" onClick={() => transfer.openImport(transferTarget)}>\n {'Import'}\n </Button>\n )}\n {canExport && (\n <Button\n size=\"small\"\n onClick={() =>\n transfer.openExport(transferTarget)\n }\n >\n {'Export'}\n </Button>\n )}\n </Stack>\n ) : null\n\n // A press while Save is held is kept, and saves once confirmed (AGL-4047).\n const held = useHeldSave(handleSave, {\n checking: draftChecking,\n subject: 'redirect',\n onRefused: (message) => enqueueSnackbar(message, { variant: 'warning', persist: false }),\n })\n\n return (\n <CardDisplay\n header={'URL redirects'}\n help={pluginDocsHelp('redirects', { anchor: '#manage-redirects' })}\n HeaderProps={transferActions ? { action: transferActions } : undefined}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Exact-path rules; 302 while testing, promote to 301 when ' +\n 'sure (browsers cache 301 aggressively). Changes go live ' +\n 'within ~30 seconds. A visitor’s query string is passed on: ' +\n 'its parameters are added to the destination’s, and the ' +\n 'destination’s own win.'}\n </Typography>\n {hits && totalHits > 0 ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`${totalHits} redirect hit${totalHits === 1 ? '' : 's'} in ` +\n 'the last 30 days (sampled — one per cache window with ' +\n 'traffic).'}\n </Typography>\n ) : null}\n {visibleRedirects.map((redirect: any) => (\n <Stack\n key={redirect.$id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n >\n <Switch\n size=\"small\"\n checked={redirect.enabled !== false}\n onChange={handleToggle(redirect)}\n />\n <Chip size=\"small\" label={redirect.statusCode ?? 302} />\n {(redirect.kind ?? 'exact') !== 'exact' ? (\n <Chip\n size=\"small\"\n variant=\"outlined\"\n label={redirect.kind}\n />\n ) : null}\n {/* An external rule with no publisher stamp is not being served\n (AGL-1881) — `matchRedirect` skips it. Say so on the row\n rather than letting it read as live: a rule that silently\n stops firing is the failure mode a fail-closed gate owes an\n explanation for, and pressing Edit → Save is the whole fix.\n Shown for external destinations only, since that is the only\n case the gate applies to. */}\n {isExternalRedirectDestination(redirect.destination) &&\n !redirect.externalDestinationApprovedBy ? (\n <Chip\n size=\"small\"\n color=\"warning\"\n variant=\"outlined\"\n label=\"not serving\"\n title={\n 'This rule sends visitors to another site. Open it and ' +\n 'save to confirm the destination — until then it is ' +\n 'skipped.'\n }\n />\n ) : null}\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {`${redirect.source} → ${redirect.destination}`}\n </Typography>\n {hits || redirect.lastHitAt ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {[\n hits\n ? `${hits[redirectHitKey(redirect.$id)] ?? 0} hits (30d, sampled)`\n : null,\n redirect.lastHitAt\n ? `last ${redirect.lastHitAt\n .toDate()\n .toLocaleString()}`\n : null,\n ]\n .filter(Boolean)\n .join(' · ')}\n </Typography>\n ) : null}\n </Stack>\n <Button\n size=\"small\"\n onClick={() => setDraft(redirectDraftOf(redirect))}\n >\n {'Edit'}\n </Button>\n <Button\n size=\"small\"\n color=\"error\"\n onClick={handleDelete(redirect)}\n >\n {'Delete'}\n </Button>\n </Stack>\n ))}\n {redirects.length === 0 ? null : (\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={visibleRedirects.length}\n // The rules this page HOLDS, after the soft-deleted ones are\n // dropped. Not the quota figure below it: that is a server\n // count over every document, soft-deleted rows included,\n // because a deleted rule still occupies a slot.\n count={redirects.length}\n onPageChange={setPage}\n onPageSizeChange={setPageSize}\n />\n )}\n {redirectsTruncated ? (\n <Alert severity=\"info\">\n {`Showing ${REDIRECT_CEILING} rules, ordered by id. This site ` +\n 'has more — the duplicate check and the tester below only ' +\n 'cover the ones listed here.'}\n </Alert>\n ) : null}\n <Button\n size=\"small\"\n color=\"primary\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={handleAdd}\n >\n {'Add redirect'}\n </Button>\n {/* The cap, standing rather than only on refusal (AGL-2113).\n `enforcedCount` is what the enforcing route counts and what\n `handleAdd` checks against, so the readout, the gate and the\n server cannot disagree. It is deliberately NOT the number of rows\n on screen: the list is a capped window, and the live count past\n it is what the server refuses at. */}\n <QuotaReadoutComponent\n ready={org != null && enforcedCount != null}\n used={enforcedCount ?? 0}\n limit={\n checkQuota(org, 'redirectsPerHost', enforcedCount ?? 0).limit\n }\n noun=\"redirect\"\n />\n {/* Inline tester (AGL-375): same matcher as enforcement. */}\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <TextField\n size=\"small\"\n label=\"Test a path\"\n placeholder=\"/old-page\"\n value={testPath}\n onChange={(event) => setTestPath(event.target.value)}\n sx={{ maxWidth: 260 }}\n />\n {testPath.trim() ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {(() => {\n const normalized =\n normalizeRedirectSource(testPath) ?? testPath.trim()\n const result = matchRedirect(redirects as any, normalized)\n return result\n ? `→ ${result.destination} (${result.statusCode})`\n : 'No rule matches'\n })()}\n </Typography>\n ) : null}\n </Stack>\n </Stack>\n\n <Dialog\n open={Boolean(draft)}\n onClose={() => setDraft(null)}\n maxWidth=\"xs\"\n fullWidth\n >\n <DialogTitle>{draft?.id ? 'Edit redirect' : 'Add redirect'}</DialogTitle>\n <DialogContent\n sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, pt: 1 }}\n >\n <TextField\n select\n label=\"Match mode\"\n value={draft?.kind ?? 'exact'}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, kind: event.target.value } : prev,\n )\n }\n size=\"small\"\n sx={{ mt: 1 }}\n >\n <MenuItem value=\"exact\">{'Exact path'}</MenuItem>\n <MenuItem value=\"prefix\">{'Path prefix'}</MenuItem>\n <MenuItem value=\"regex\">{'Regular expression'}</MenuItem>\n </TextField>\n <TextField\n label={draft?.kind === 'regex' ? 'Pattern' : 'From path'}\n placeholder={\n draft?.kind === 'regex' ? '/product/(\\\\d+)' : '/old-page'\n }\n helperText={\n draft?.kind === 'regex'\n ? 'Anchored to the whole path; use $1, $2 in the destination'\n : draft?.kind === 'prefix'\n ? 'Matches the path and everything under it'\n : undefined\n }\n value={draft?.source ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, source: event.target.value } : prev,\n )\n }\n size=\"small\"\n autoFocus\n />\n <TextField\n label=\"To\"\n placeholder=\"/new-page or https://example.com\"\n value={draft?.destination ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, destination: event.target.value } : prev,\n )\n }\n size=\"small\"\n />\n <TextField\n select\n label=\"Status code\"\n value={draft?.statusCode ?? 302}\n onChange={(event) =>\n setDraft((prev) =>\n prev\n ? { ...prev, statusCode: Number(event.target.value) }\n : prev,\n )\n }\n size=\"small\"\n >\n <MenuItem value={302}>{'302 — temporary (default)'}</MenuItem>\n <MenuItem value={301}>{'301 — permanent'}</MenuItem>\n <MenuItem value={307}>{'307 — temporary, keep method'}</MenuItem>\n <MenuItem value={308}>{'308 — permanent, keep method'}</MenuItem>\n </TextField>\n <TextField\n label=\"Priority\"\n type=\"number\"\n helperText=\"Lower fires first when several rules match\"\n value={draft?.priority ?? REDIRECT_DEFAULT_PRIORITY}\n onChange={(event) =>\n setDraft((prev) =>\n prev\n ? { ...prev, priority: Number(event.target.value) }\n : prev,\n )\n }\n size=\"small\"\n />\n </DialogContent>\n <DialogActions>\n {draftChecking ? (\n <Typography variant=\"body2\" color=\"text.secondary\" role=\"status\" sx={{ mr: 'auto' }}>\n {seedCheckingText('redirect')}\n </Typography>\n ) : null}\n <Button onClick={() => setDraft(null)}>{'Cancel'}</Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={\n !draft?.source.trim() || !draft?.destination.trim() ||\n held.saving\n }\n onClick={held.press}\n >\n {heldSaveLabel(held, 'Save redirect')}\n </Button>\n </DialogActions>\n </Dialog>\n </CardDisplay>\n )\n}\nRedirectsConsolePage.displayName = 'RedirectsConsolePage'\n\nexport default RedirectsConsolePage\n"],"names":["TransferResumeImport","checkQuota","pluginDocsHelp","useTransferLauncher","TENANT_APEX","findDuplicateRedirect","isExternalRedirectDestination","isSelfRedirect","matchRedirect","normalizeRedirectDestination","normalizeRedirectSource","REDIRECT_DEFAULT_PRIORITY","redirectHitKey","redirectSourceIsLivePage","validateRedirectRule","REDIRECT_STATUS_CODES","walkRedirectChain","CardDisplay","useConfirmationContext","REDIRECTS_TRANSFER_KEY","authorizedFetch","QuotaReadoutComponent","useSnackbar","Timestamp","Alert","Button","Chip","Dialog","DialogActions","DialogContent","DialogTitle","MenuItem","Stack","Switch","TextField","Typography","collection","deleteField","doc","getDoc","setDoc","updateDoc","getLiveCountFromServer","useCallback","useEffect","useMemo","useState","ListPagination","TABLE_PAGE_SIZE_DEFAULT","ceilingedWindow","collectionCeiling","useFirestore","useFirestoreCollection","useFirestoreDoc","useHostResourceApi","useUser","writeGuardedBySeed","heldSaveLabel","isSeedChecking","seedCheckingText","useHeldSave","useSeedDraft","REDIRECT_CEILING","redirectDraftOf","redirect","id","$id","source","destination","statusCode","kind","priority","enabled","RedirectsConsolePage","props","hostId","entitled","org","firestore","createHostResource","data","currentUser","enqueueSnackbar","confirm","redirectDocs","status","redirectsStatus","fromCache","redirectsFromCache","listen","redirectsListen","idField","rows","readRedirects","truncated","redirectsTruncated","redirects","filter","deletedAt","sort","a","b","String","localeCompare","page","setPage","pageSize","setPageSize","visibleRedirects","slice","enforcedCount","setEnforcedCount","liveRedirectDocCount","length","countRedirects","active","then","count","draft","setDraft","opened","row","find","undefined","draftChecking","Boolean","unreadable","testPath","setTestPath","host","hits","setHits","ids","Array","from","_","index","date","Date","setDate","getDate","toISOString","Promise","all","map","snapshot","get","catch","days","totals","dayMap","redirectId","Object","entries","Number","totalHits","values","reduce","sum","handleAdd","variant","persist","quota","allowed","limit","announceRuleChange","redirectPath","startsWith","method","headers","body","JSON","stringify","handleSave","problem","ownDomains","cname","subdomain","trim","duplicate","loop","screens","fields","includes","isFinite","approval","externalDestinationApprovedBy","uid","verdict","subject","updatedAt","now","merge","ok","message","resource","previous","rule","error","console","allowDuplicate","reportWriteFailure","code","handleToggle","event","target","checked","handleDelete","confirmed","title","description","confirmationText","confirmationButtonProps","color","transfer","transferTarget","scope","canImport","can","canExport","transferActions","direction","spacing","size","onClick","openImport","openExport","held","checking","onRefused","header","help","anchor","HeaderProps","action","contentGutterX","contentGutterY","sx","alignItems","onChange","label","flex","minWidth","noWrap","lastHitAt","toDate","toLocaleString","join","rowCount","onPageChange","onPageSizeChange","severity","alignSelf","ready","used","noun","placeholder","value","maxWidth","normalized","result","open","onClose","fullWidth","display","flexDirection","gap","pt","select","prev","mt","helperText","autoFocus","type","role","mr","disabled","saving","press","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,UAAU,EAAEC,cAAc,EAAEC,mBAAmB,QAAQ,eAAc;AAE9E,SAASC,WAAW,QAAQ,qCAAoC;AAChE,SAASC,qBAAqB,EAAEC,6BAA6B,EAAEC,cAAc,EAAEC,aAAa,EAAEC,4BAA4B,EAAEC,uBAAuB,EAAEC,yBAAyB,EAAEC,cAAc,EAAEC,wBAAwB,EAAEC,oBAAoB,EAAEC,qBAAqB,EAAEC,iBAAiB,QAAQ,oBAAU;AAC1S,SAASC,WAAW,EAAEC,sBAAsB,QAAQ,uBAAsB;AAC1E,SAASC,sBAAsB,QAAQ,2CAAuC;AAC9E,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,OAAOC,2BAA2B,0DAAyD;AAC3F,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,SAAS,QAAQ,+BAA8B;AACxD,SACEC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,MAAM,EACNC,aAAa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