@aglyn/plugins-workflows 1.12.0 → 1.13.0

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-workflows",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
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.12.0",
29
- "@aglyn/shared-data-mdi": "1.12.0",
30
- "@aglyn/shared-ui-jsx": "1.12.0",
31
- "@aglyn/shared-ui-next": "1.12.0",
32
- "@aglyn/shared-ui-snackstack": "1.12.0",
33
- "@aglyn/shared-util-email": "1.12.0",
34
- "@aglyn/shared-util-http": "1.12.0",
35
- "@aglyn/shared-util-timestamp": "1.12.0",
36
- "@aglyn/tenant-data-admin": "1.12.0",
37
- "@aglyn/tenant-feature-instance": "1.12.0",
38
- "@aglyn/tenant-runtime": "1.12.0",
28
+ "@aglyn/aglyn": "1.13.0",
29
+ "@aglyn/shared-data-mdi": "1.13.0",
30
+ "@aglyn/shared-ui-jsx": "1.13.0",
31
+ "@aglyn/shared-ui-next": "1.13.0",
32
+ "@aglyn/shared-ui-snackstack": "1.13.0",
33
+ "@aglyn/shared-util-email": "1.13.0",
34
+ "@aglyn/shared-util-http": "1.13.0",
35
+ "@aglyn/shared-util-timestamp": "1.13.0",
36
+ "@aglyn/tenant-data-admin": "1.13.0",
37
+ "@aglyn/tenant-feature-instance": "1.13.0",
38
+ "@aglyn/tenant-runtime": "1.13.0",
39
39
  "@swc/helpers": "0.5.23"
40
40
  },
41
41
  "peerDependencies": {
@@ -1,3 +1,4 @@
1
+ import { type WebhookSiteAccess } from './use-webhook-site-access';
1
2
  import { type WorkflowsOrgMount } from './workflows-org-mount';
2
3
  /** The three site collections the org hub lists across its sites. */
3
4
  export type OrgSiteAutomationKind = 'workflows' | 'actions' | 'webhooks';
@@ -28,16 +29,29 @@ export declare const ORG_SITE_LIST_ROWS = 10;
28
29
  * linking into that site's own Automation hub, where the thing is edited.
29
30
  * "Add" asks which site and goes there.
30
31
  *
31
- * `canRead` gates the webhooks list: a webhook holds its site's secret and
32
- * the rules admit only a site's admins and editors, so a reader who is
33
- * neither is told so rather than handed listeners that would be refused.
32
+ * `access` gates the webhooks list, site by site: a webhook holds its site's
33
+ * secret and the rules ask "See orders and webhooks" of each site, so only the
34
+ * sites the reader holds it on are read, and the others are named as left out
35
+ * rather than handed listeners that would be refused. Workflows and actions
36
+ * pass none: every member reads those.
34
37
  */
35
38
  export declare function OrgSiteAutomationList(props: {
36
39
  mount: WorkflowsOrgMount;
37
40
  kind: OrgSiteAutomationKind;
38
- canRead: boolean;
41
+ access?: WebhookSiteAccess;
39
42
  }): import("react").JSX.Element;
40
43
  export declare namespace OrgSiteAutomationList {
41
44
  var displayName: string;
42
45
  }
46
+ /**
47
+ * The webhooks section: the list above, answering to the reader's verdict on
48
+ * each site. A component of its own so the membership is read for this section
49
+ * alone, never for the workflows and actions lists beside it.
50
+ */
51
+ export declare function OrgSiteWebhookList(props: {
52
+ mount: WorkflowsOrgMount;
53
+ }): import("react").JSX.Element;
54
+ export declare namespace OrgSiteWebhookList {
55
+ var displayName: string;
56
+ }
43
57
  export default OrgSiteAutomationList;
@@ -17,6 +17,7 @@
17
17
  import { _ as _extends } from "@swc/helpers/_/_extends";
18
18
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
19
  import { hostEventLabel, pluginDocsHelp } from "@aglyn/aglyn";
20
+ import { orgPermissionLabel } from "@aglyn/aglyn/app-utils/org-permissions";
20
21
  import { AppLink, CardDisplay } from "@aglyn/shared-ui-jsx";
21
22
  import { ScrollTable } from "@aglyn/shared-ui-jsx/components/scroll-table.component";
22
23
  import { useFirestore, useFirestoreCollection } from "@aglyn/tenant-feature-instance";
@@ -28,6 +29,7 @@ import { useFirestore, useFirestoreCollection } from "@aglyn/tenant-feature-inst
28
29
  import { Alert, Button, Menu, MenuItem, Stack, TableBody, TableCell, TableHead, TableRow, Typography } from "@mui/material";
29
30
  import { collection } from "firebase/firestore";
30
31
  import { useState } from "react";
32
+ import { useWebhookSiteAccess, WEBHOOKS_PERMISSION, WEBHOOKS_REFUSAL } from "./use-webhook-site-access.js";
31
33
  import { orgSiteAutomationPath } from "./workflows-org-mount.js";
32
34
  /**
33
35
  * How many sites a list opens with their rows read. The rest wait behind
@@ -74,15 +76,18 @@ const COPY = {
74
76
  * linking into that site's own Automation hub, where the thing is edited.
75
77
  * "Add" asks which site and goes there.
76
78
  *
77
- * `canRead` gates the webhooks list: a webhook holds its site's secret and
78
- * the rules admit only a site's admins and editors, so a reader who is
79
- * neither is told so rather than handed listeners that would be refused.
79
+ * `access` gates the webhooks list, site by site: a webhook holds its site's
80
+ * secret and the rules ask "See orders and webhooks" of each site, so only the
81
+ * sites the reader holds it on are read, and the others are named as left out
82
+ * rather than handed listeners that would be refused. Workflows and actions
83
+ * pass none: every member reads those.
80
84
  */ export function OrgSiteAutomationList(props) {
81
- const { mount, kind, canRead } = props;
85
+ const { mount, kind, access } = props;
82
86
  const copy = COPY[kind];
83
87
  const [opened, setOpened] = useState(false);
84
88
  const [addAnchor, setAddAnchor] = useState(null);
85
- const reachable = mount.hosts.slice(0, ORG_SITE_LIST_MAX_SITES);
89
+ const readable = access ? mount.hosts.filter((host)=>access.holds(host.id)) : mount.hosts;
90
+ const reachable = readable.slice(0, ORG_SITE_LIST_MAX_SITES);
86
91
  const shown = opened ? reachable : reachable.slice(0, ORG_SITE_LIST_OPEN_SITES);
87
92
  const folded = reachable.length - shown.length;
88
93
  const linkable = mount.hosts.filter((host)=>orgSiteAutomationPath(mount, host.id, kind));
@@ -102,10 +107,10 @@ const COPY = {
102
107
  color: "text.secondary",
103
108
  children: copy.intro
104
109
  }),
105
- !canRead ? /*#__PURE__*/ _jsx(Alert, {
106
- severity: "info",
107
- children: `Each site’s ${copy.plural} are listed for its admins and editors.`
108
- }) : !mount.hostsReady ? /*#__PURE__*/ _jsx(Typography, {
110
+ (access == null ? void 0 : access.errored) ? /*#__PURE__*/ _jsx(Alert, {
111
+ severity: "warning",
112
+ children: 'Your access could not be checked. Reload the page to try again.'
113
+ }) : !mount.hostsReady || access && !access.known ? /*#__PURE__*/ _jsx(Typography, {
109
114
  variant: "caption",
110
115
  color: "text.secondary",
111
116
  children: '…'
@@ -113,8 +118,15 @@ const COPY = {
113
118
  variant: "body2",
114
119
  color: "text.secondary",
115
120
  children: 'This organization has no sites yet.'
121
+ }) : !readable.length ? /*#__PURE__*/ _jsx(Alert, {
122
+ severity: "info",
123
+ children: WEBHOOKS_REFUSAL
116
124
  }) : /*#__PURE__*/ _jsxs(_Fragment, {
117
125
  children: [
126
+ readable.length < mount.hosts.length ? /*#__PURE__*/ _jsx(Alert, {
127
+ severity: "info",
128
+ children: `The ${copy.plural} of sites where your role does not include ` + `"${orgPermissionLabel(WEBHOOKS_PERMISSION)}" are not listed.`
129
+ }) : null,
118
130
  /*#__PURE__*/ _jsxs(ScrollTable, {
119
131
  size: "small",
120
132
  "aria-label": copy.header,
@@ -155,7 +167,7 @@ const COPY = {
155
167
  },
156
168
  children: `Show ${folded} more ${folded === 1 ? 'site' : 'sites'}`
157
169
  }) : null,
158
- mount.hosts.length > ORG_SITE_LIST_MAX_SITES ? /*#__PURE__*/ _jsx(Alert, {
170
+ readable.length > ORG_SITE_LIST_MAX_SITES ? /*#__PURE__*/ _jsx(Alert, {
159
171
  severity: "info",
160
172
  children: `Listing the first ${ORG_SITE_LIST_MAX_SITES} sites. Open a ` + `site’s own Automation for the ${copy.plural} of the rest.`
161
173
  }) : null
@@ -198,6 +210,19 @@ const COPY = {
198
210
  });
199
211
  }
200
212
  OrgSiteAutomationList.displayName = 'OrgSiteAutomationList';
213
+ /**
214
+ * The webhooks section: the list above, answering to the reader's verdict on
215
+ * each site. A component of its own so the membership is read for this section
216
+ * alone, never for the workflows and actions lists beside it.
217
+ */ export function OrgSiteWebhookList(props) {
218
+ const access = useWebhookSiteAccess(props.mount.orgId);
219
+ return /*#__PURE__*/ _jsx(OrgSiteAutomationList, {
220
+ mount: props.mount,
221
+ kind: "webhooks",
222
+ access: access
223
+ });
224
+ }
225
+ OrgSiteWebhookList.displayName = 'OrgSiteWebhookList';
201
226
  /** How a row's trigger or direction reads. */ function rowTrigger(kind, row) {
202
227
  var _row_trigger;
203
228
  if (kind === 'webhooks') {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/workflows/src/lib/components/org-site-automation-list.component.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 type { ConsolePluginOrgHost } from '@aglyn/aglyn'\nimport { hostEventLabel, pluginDocsHelp } from '@aglyn/aglyn'\nimport { AppLink, CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport {\n useFirestore,\n useFirestoreCollection,\n} from '@aglyn/tenant-feature-instance'\n/*\n * The MODULE, not the barrel, for the two pure helpers — the cards' specs\n * mock `@aglyn/tenant-feature-instance` wholesale, and a query builder\n * imported through that barrel disappears under the mock.\n */\nimport {\n ceilingedWindow,\n collectionCeiling,\n} from '@aglyn/tenant-feature-instance/hooks/host-collection-queries'\nimport {\n Alert,\n Button,\n Menu,\n MenuItem,\n Stack,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Typography,\n} from '@mui/material'\nimport { collection } from 'firebase/firestore'\nimport { useState } from 'react'\nimport {\n orgSiteAutomationPath,\n type WorkflowsOrgMount,\n} from './workflows-org-mount'\n\n/** The three site collections the org hub lists across its sites. */\nexport type OrgSiteAutomationKind = 'workflows' | 'actions' | 'webhooks'\n\n/**\n * How many sites a list opens with their rows read. The rest wait behind\n * \"Show more\" — and, since each site's rows are read by the row group that\n * shows them, are not read until then either.\n */\nexport const ORG_SITE_LIST_OPEN_SITES = 5\n\n/**\n * The most sites one list will read, however many the organization has —\n * the platform's per-scan site bound. Past it the list says so and each\n * site's own hub is the way in.\n */\nexport const ORG_SITE_LIST_MAX_SITES = 25\n\n/**\n * Rows read per site. A ceiling with a probe row, not a page: the org list is\n * an index of where things are, and each site's own hub holds the full,\n * editable list the row links to.\n */\nexport const ORG_SITE_LIST_ROWS = 10\n\n/** A trigger bound to one element, which makes an `actions` row an interaction. */\nconst LEAF_SELECTOR = /^\\[data-aglyn=\"leaf:.+\"\\]$/\n\nconst COPY: Record<\n OrgSiteAutomationKind,\n { header: string; noun: string; plural: string; intro: string }\n> = {\n workflows: {\n header: 'Workflows on every site',\n noun: 'workflow',\n plural: 'workflows',\n intro:\n 'Every site’s workflows, side by side. A workflow calls its own site’s ' +\n 'functions and variables, so it is built and edited in that site’s ' +\n 'Automation.',\n },\n actions: {\n header: 'Actions on every site',\n noun: 'action',\n plural: 'actions',\n intro:\n 'Every site’s own actions, side by side. To run one automation on ' +\n 'several sites, make it an org automation instead.',\n },\n webhooks: {\n header: 'Webhooks on every site',\n noun: 'webhook',\n plural: 'webhooks',\n intro:\n 'Every site’s webhooks, side by side. A webhook holds its site’s ' +\n 'address and secret, so it is managed in that site’s Automation.',\n },\n}\n\n/**\n * EVERY SITE'S WORKFLOWS, ACTIONS OR WEBHOOKS, on the org hub (AGL-3302).\n *\n * Read-only and bounded: one ceilinged read per open site, the first\n * {@link ORG_SITE_LIST_OPEN_SITES} sites on arrival and up to\n * {@link ORG_SITE_LIST_MAX_SITES} when asked, each row naming its site and\n * linking into that site's own Automation hub, where the thing is edited.\n * \"Add\" asks which site and goes there.\n *\n * `canRead` gates the webhooks list: a webhook holds its site's secret and\n * the rules admit only a site's admins and editors, so a reader who is\n * neither is told so rather than handed listeners that would be refused.\n */\nexport function OrgSiteAutomationList(props: {\n mount: WorkflowsOrgMount\n kind: OrgSiteAutomationKind\n canRead: boolean\n}) {\n const { mount, kind, canRead } = props\n const copy = COPY[kind]\n const [opened, setOpened] = useState(false)\n const [addAnchor, setAddAnchor] = useState<HTMLElement | null>(null)\n const reachable = mount.hosts.slice(0, ORG_SITE_LIST_MAX_SITES)\n const shown = opened\n ? reachable\n : reachable.slice(0, ORG_SITE_LIST_OPEN_SITES)\n const folded = reachable.length - shown.length\n const linkable = mount.hosts.filter((host) =>\n orgSiteAutomationPath(mount, host.id, kind),\n )\n return (\n <CardDisplay\n header={copy.header}\n help={pluginDocsHelp('orgAutomations', {\n anchor: '#every-sites-own-automations',\n })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1.5}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {copy.intro}\n </Typography>\n {!canRead ? (\n <Alert severity=\"info\">\n {`Each site’s ${copy.plural} are listed for its admins and editors.`}\n </Alert>\n ) : !mount.hostsReady ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'…'}\n </Typography>\n ) : !mount.hosts.length ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'This organization has no sites yet.'}\n </Typography>\n ) : (\n <>\n <ScrollTable size=\"small\" aria-label={copy.header}>\n <TableHead>\n <TableRow>\n <TableCell>{'Name'}</TableCell>\n <TableCell>{'Site'}</TableCell>\n <TableCell>\n {kind === 'webhooks' ? 'Direction' : 'Trigger'}\n </TableCell>\n <TableCell>{'Status'}</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {shown.map((host) => (\n <SiteRows key={host.id} mount={mount} host={host} kind={kind} />\n ))}\n </TableBody>\n </ScrollTable>\n {folded > 0 ? (\n <Button\n size=\"small\"\n variant=\"text\"\n onClick={() => setOpened(true)}\n sx={{ alignSelf: 'flex-start' }}\n >\n {`Show ${folded} more ${folded === 1 ? 'site' : 'sites'}`}\n </Button>\n ) : null}\n {mount.hosts.length > ORG_SITE_LIST_MAX_SITES ? (\n <Alert severity=\"info\">\n {`Listing the first ${ORG_SITE_LIST_MAX_SITES} sites. Open a ` +\n `site’s own Automation for the ${copy.plural} of the rest.`}\n </Alert>\n ) : null}\n </>\n )}\n {linkable.length ? (\n <Stack direction=\"row\" spacing={1} sx={{ alignSelf: 'flex-start' }}>\n <Button\n size=\"small\"\n color=\"primary\"\n aria-haspopup=\"menu\"\n onClick={(event) => setAddAnchor(event.currentTarget)}\n >\n {`Add ${copy.noun} on a site`}\n </Button>\n </Stack>\n ) : null}\n </Stack>\n <Menu\n anchorEl={addAnchor}\n open={Boolean(addAnchor)}\n onClose={() => setAddAnchor(null)}\n >\n {linkable.map((host) => (\n <MenuItem\n key={host.id}\n component={AppLink as any}\n {...({ componentVariant: 'naked' } as any)}\n href={orgSiteAutomationPath(mount, host.id, kind) ?? ''}\n onClick={() => setAddAnchor(null)}\n >\n {host.name || host.subdomain || host.id}\n </MenuItem>\n ))}\n </Menu>\n </CardDisplay>\n )\n}\nOrgSiteAutomationList.displayName = 'OrgSiteAutomationList'\n\n/** How a row's trigger or direction reads. */\nfunction rowTrigger(kind: OrgSiteAutomationKind, row: any): string {\n if (kind === 'webhooks') {\n return row?.direction === 'inbound' ? 'Inbound' : 'Outbound'\n }\n const event = row?.trigger?.event\n if (!event) return kind === 'workflows' ? 'Run by other automations' : '—'\n return hostEventLabel(event)\n}\n\n/** How a row's status reads. */\nfunction rowStatus(kind: OrgSiteAutomationKind, row: any): string {\n if (kind === 'workflows') return 'Ready'\n return row?.enabled === false ? 'Off' : 'On'\n}\n\n/**\n * One site's rows: its own ceilinged read, drawn as table rows naming the\n * site. A site with none draws nothing; one past the ceiling says so in a row\n * that links to where the rest are.\n */\nfunction SiteRows(props: {\n mount: WorkflowsOrgMount\n host: ConsolePluginOrgHost\n kind: OrgSiteAutomationKind\n}) {\n const { mount, host, kind } = props\n const firestore = useFirestore()\n const { data } = useFirestoreCollection<any>(\n () =>\n collectionCeiling(\n collection(firestore, 'hosts', host.id, kind),\n ORG_SITE_LIST_ROWS,\n ),\n [firestore, host.id, kind],\n { idField: '$id' },\n )\n const { rows, truncated } = ceilingedWindow<any>(data, ORG_SITE_LIST_ROWS)\n const live = (rows ?? []).filter(\n (row: any) =>\n !row.deletedAt &&\n // An element interaction belongs to its page, not to the site's\n // automation list — the site's own Actions card counts rather than\n // lists them, and so does this.\n !(kind === 'actions' && LEAF_SELECTOR.test(String(row?.trigger?.selector ?? ''))),\n )\n const siteName = host.name || host.subdomain || host.id\n const href = orgSiteAutomationPath(mount, host.id, kind)\n const site = href ? (\n <AppLink href={href} underline=\"hover\">\n {siteName}\n </AppLink>\n ) : (\n siteName\n )\n return (\n <>\n {live.map((row: any) => (\n <TableRow key={`${host.id}/${row.$id}`}>\n <TableCell>\n {href ? (\n <AppLink href={href} underline=\"hover\">\n {String(row.name || row.$id)}\n </AppLink>\n ) : (\n String(row.name || row.$id)\n )}\n </TableCell>\n <TableCell>{site}</TableCell>\n <TableCell>{rowTrigger(kind, row)}</TableCell>\n <TableCell>{rowStatus(kind, row)}</TableCell>\n </TableRow>\n ))}\n {truncated ? (\n <TableRow>\n <TableCell colSpan={4}>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`${siteName} has more than ${ORG_SITE_LIST_ROWS} — `}\n {href ? (\n <AppLink href={href} underline=\"hover\">\n {'open the site to see them all'}\n </AppLink>\n ) : (\n 'open the site to see them all'\n )}\n </Typography>\n </TableCell>\n </TableRow>\n ) : null}\n </>\n )\n}\nSiteRows.displayName = 'SiteRows'\n\nexport default OrgSiteAutomationList\n"],"names":["hostEventLabel","pluginDocsHelp","AppLink","CardDisplay","ScrollTable","useFirestore","useFirestoreCollection","ceilingedWindow","collectionCeiling","Alert","Button","Menu","MenuItem","Stack","TableBody","TableCell","TableHead","TableRow","Typography","collection","useState","orgSiteAutomationPath","ORG_SITE_LIST_OPEN_SITES","ORG_SITE_LIST_MAX_SITES","ORG_SITE_LIST_ROWS","LEAF_SELECTOR","COPY","workflows","header","noun","plural","intro","actions","webhooks","OrgSiteAutomationList","props","mount","kind","canRead","copy","opened","setOpened","addAnchor","setAddAnchor","reachable","hosts","slice","shown","folded","length","linkable","filter","host","id","help","anchor","contentGutterX","contentGutterY","spacing","variant","color","severity","hostsReady","size","aria-label","map","SiteRows","onClick","sx","alignSelf","direction","aria-haspopup","event","currentTarget","anchorEl","open","Boolean","onClose","component","componentVariant","href","name","subdomain","displayName","rowTrigger","row","trigger","rowStatus","enabled","firestore","data","idField","rows","truncated","live","deletedAt","test","String","selector","siteName","site","underline","$id","colSpan"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAGA,SAASA,cAAc,EAAEC,cAAc,QAAQ,eAAc;AAC7D,SAASC,OAAO,EAAEC,WAAW,QAAQ,uBAAsB;AAC3D,SAASC,WAAW,QAAQ,yDAAwD;AACpF,SACEC,YAAY,EACZC,sBAAsB,QACjB,iCAAgC;AACvC;;;;CAIC,GACD,SACEC,eAAe,EACfC,iBAAiB,QACZ,+DAA8D;AACrE,SACEC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,UAAU,QACL,gBAAe;AACtB,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,QAAQ,QAAQ,QAAO;AAChC,SACEC,qBAAqB,QAEhB,2BAAuB;AAK9B;;;;CAIC,GACD,OAAO,MAAMC,2BAA2B,EAAC;AAEzC;;;;CAIC,GACD,OAAO,MAAMC,0BAA0B,GAAE;AAEzC;;;;CAIC,GACD,OAAO,MAAMC,qBAAqB,GAAE;AAEpC,iFAAiF,GACjF,MAAMC,gBAAgB;AA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ows/src/lib/components/org-site-automation-list.component.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 type { ConsolePluginOrgHost } from '@aglyn/aglyn'\nimport { hostEventLabel, pluginDocsHelp } from '@aglyn/aglyn'\nimport { orgPermissionLabel } from '@aglyn/aglyn/app-utils/org-permissions'\nimport { AppLink, CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport {\n useFirestore,\n useFirestoreCollection,\n} from '@aglyn/tenant-feature-instance'\n/*\n * The MODULE, not the barrel, for the two pure helpers — the cards' specs\n * mock `@aglyn/tenant-feature-instance` wholesale, and a query builder\n * imported through that barrel disappears under the mock.\n */\nimport {\n ceilingedWindow,\n collectionCeiling,\n} from '@aglyn/tenant-feature-instance/hooks/host-collection-queries'\nimport {\n Alert,\n Button,\n Menu,\n MenuItem,\n Stack,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Typography,\n} from '@mui/material'\nimport { collection } from 'firebase/firestore'\nimport { useState } from 'react'\nimport {\n useWebhookSiteAccess,\n WEBHOOKS_PERMISSION,\n WEBHOOKS_REFUSAL,\n type WebhookSiteAccess,\n} from './use-webhook-site-access'\nimport {\n orgSiteAutomationPath,\n type WorkflowsOrgMount,\n} from './workflows-org-mount'\n\n/** The three site collections the org hub lists across its sites. */\nexport type OrgSiteAutomationKind = 'workflows' | 'actions' | 'webhooks'\n\n/**\n * How many sites a list opens with their rows read. The rest wait behind\n * \"Show more\" — and, since each site's rows are read by the row group that\n * shows them, are not read until then either.\n */\nexport const ORG_SITE_LIST_OPEN_SITES = 5\n\n/**\n * The most sites one list will read, however many the organization has —\n * the platform's per-scan site bound. Past it the list says so and each\n * site's own hub is the way in.\n */\nexport const ORG_SITE_LIST_MAX_SITES = 25\n\n/**\n * Rows read per site. A ceiling with a probe row, not a page: the org list is\n * an index of where things are, and each site's own hub holds the full,\n * editable list the row links to.\n */\nexport const ORG_SITE_LIST_ROWS = 10\n\n/** A trigger bound to one element, which makes an `actions` row an interaction. */\nconst LEAF_SELECTOR = /^\\[data-aglyn=\"leaf:.+\"\\]$/\n\nconst COPY: Record<\n OrgSiteAutomationKind,\n { header: string; noun: string; plural: string; intro: string }\n> = {\n workflows: {\n header: 'Workflows on every site',\n noun: 'workflow',\n plural: 'workflows',\n intro:\n 'Every site’s workflows, side by side. A workflow calls its own site’s ' +\n 'functions and variables, so it is built and edited in that site’s ' +\n 'Automation.',\n },\n actions: {\n header: 'Actions on every site',\n noun: 'action',\n plural: 'actions',\n intro:\n 'Every site’s own actions, side by side. To run one automation on ' +\n 'several sites, make it an org automation instead.',\n },\n webhooks: {\n header: 'Webhooks on every site',\n noun: 'webhook',\n plural: 'webhooks',\n intro:\n 'Every site’s webhooks, side by side. A webhook holds its site’s ' +\n 'address and secret, so it is managed in that site’s Automation.',\n },\n}\n\n/**\n * EVERY SITE'S WORKFLOWS, ACTIONS OR WEBHOOKS, on the org hub (AGL-3302).\n *\n * Read-only and bounded: one ceilinged read per open site, the first\n * {@link ORG_SITE_LIST_OPEN_SITES} sites on arrival and up to\n * {@link ORG_SITE_LIST_MAX_SITES} when asked, each row naming its site and\n * linking into that site's own Automation hub, where the thing is edited.\n * \"Add\" asks which site and goes there.\n *\n * `access` gates the webhooks list, site by site: a webhook holds its site's\n * secret and the rules ask \"See orders and webhooks\" of each site, so only the\n * sites the reader holds it on are read, and the others are named as left out\n * rather than handed listeners that would be refused. Workflows and actions\n * pass none: every member reads those.\n */\nexport function OrgSiteAutomationList(props: {\n mount: WorkflowsOrgMount\n kind: OrgSiteAutomationKind\n access?: WebhookSiteAccess\n}) {\n const { mount, kind, access } = props\n const copy = COPY[kind]\n const [opened, setOpened] = useState(false)\n const [addAnchor, setAddAnchor] = useState<HTMLElement | null>(null)\n const readable = access\n ? mount.hosts.filter((host) => access.holds(host.id))\n : mount.hosts\n const reachable = readable.slice(0, ORG_SITE_LIST_MAX_SITES)\n const shown = opened\n ? reachable\n : reachable.slice(0, ORG_SITE_LIST_OPEN_SITES)\n const folded = reachable.length - shown.length\n const linkable = mount.hosts.filter((host) =>\n orgSiteAutomationPath(mount, host.id, kind),\n )\n return (\n <CardDisplay\n header={copy.header}\n help={pluginDocsHelp('orgAutomations', {\n anchor: '#every-sites-own-automations',\n })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1.5}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {copy.intro}\n </Typography>\n {access?.errored ? (\n <Alert severity=\"warning\">\n {'Your access could not be checked. Reload the page to try again.'}\n </Alert>\n ) : !mount.hostsReady || (access && !access.known) ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'…'}\n </Typography>\n ) : !mount.hosts.length ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'This organization has no sites yet.'}\n </Typography>\n ) : !readable.length ? (\n <Alert severity=\"info\">{WEBHOOKS_REFUSAL}</Alert>\n ) : (\n <>\n {readable.length < mount.hosts.length ? (\n <Alert severity=\"info\">\n {`The ${copy.plural} of sites where your role does not include ` +\n `\"${orgPermissionLabel(WEBHOOKS_PERMISSION)}\" are not listed.`}\n </Alert>\n ) : null}\n <ScrollTable size=\"small\" aria-label={copy.header}>\n <TableHead>\n <TableRow>\n <TableCell>{'Name'}</TableCell>\n <TableCell>{'Site'}</TableCell>\n <TableCell>\n {kind === 'webhooks' ? 'Direction' : 'Trigger'}\n </TableCell>\n <TableCell>{'Status'}</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {shown.map((host) => (\n <SiteRows key={host.id} mount={mount} host={host} kind={kind} />\n ))}\n </TableBody>\n </ScrollTable>\n {folded > 0 ? (\n <Button\n size=\"small\"\n variant=\"text\"\n onClick={() => setOpened(true)}\n sx={{ alignSelf: 'flex-start' }}\n >\n {`Show ${folded} more ${folded === 1 ? 'site' : 'sites'}`}\n </Button>\n ) : null}\n {readable.length > ORG_SITE_LIST_MAX_SITES ? (\n <Alert severity=\"info\">\n {`Listing the first ${ORG_SITE_LIST_MAX_SITES} sites. Open a ` +\n `site’s own Automation for the ${copy.plural} of the rest.`}\n </Alert>\n ) : null}\n </>\n )}\n {linkable.length ? (\n <Stack direction=\"row\" spacing={1} sx={{ alignSelf: 'flex-start' }}>\n <Button\n size=\"small\"\n color=\"primary\"\n aria-haspopup=\"menu\"\n onClick={(event) => setAddAnchor(event.currentTarget)}\n >\n {`Add ${copy.noun} on a site`}\n </Button>\n </Stack>\n ) : null}\n </Stack>\n <Menu\n anchorEl={addAnchor}\n open={Boolean(addAnchor)}\n onClose={() => setAddAnchor(null)}\n >\n {linkable.map((host) => (\n <MenuItem\n key={host.id}\n component={AppLink as any}\n {...({ componentVariant: 'naked' } as any)}\n href={orgSiteAutomationPath(mount, host.id, kind) ?? ''}\n onClick={() => setAddAnchor(null)}\n >\n {host.name || host.subdomain || host.id}\n </MenuItem>\n ))}\n </Menu>\n </CardDisplay>\n )\n}\nOrgSiteAutomationList.displayName = 'OrgSiteAutomationList'\n\n/**\n * The webhooks section: the list above, answering to the reader's verdict on\n * each site. A component of its own so the membership is read for this section\n * alone, never for the workflows and actions lists beside it.\n */\nexport function OrgSiteWebhookList(props: { mount: WorkflowsOrgMount }) {\n const access = useWebhookSiteAccess(props.mount.orgId)\n return <OrgSiteAutomationList mount={props.mount} kind=\"webhooks\" access={access} />\n}\nOrgSiteWebhookList.displayName = 'OrgSiteWebhookList'\n\n/** How a row's trigger or direction reads. */\nfunction rowTrigger(kind: OrgSiteAutomationKind, row: any): string {\n if (kind === 'webhooks') {\n return row?.direction === 'inbound' ? 'Inbound' : 'Outbound'\n }\n const event = row?.trigger?.event\n if (!event) return kind === 'workflows' ? 'Run by other automations' : '—'\n return hostEventLabel(event)\n}\n\n/** How a row's status reads. */\nfunction rowStatus(kind: OrgSiteAutomationKind, row: any): string {\n if (kind === 'workflows') return 'Ready'\n return row?.enabled === false ? 'Off' : 'On'\n}\n\n/**\n * One site's rows: its own ceilinged read, drawn as table rows naming the\n * site. A site with none draws nothing; one past the ceiling says so in a row\n * that links to where the rest are.\n */\nfunction SiteRows(props: {\n mount: WorkflowsOrgMount\n host: ConsolePluginOrgHost\n kind: OrgSiteAutomationKind\n}) {\n const { mount, host, kind } = props\n const firestore = useFirestore()\n const { data } = useFirestoreCollection<any>(\n () =>\n collectionCeiling(\n collection(firestore, 'hosts', host.id, kind),\n ORG_SITE_LIST_ROWS,\n ),\n [firestore, host.id, kind],\n { idField: '$id' },\n )\n const { rows, truncated } = ceilingedWindow<any>(data, ORG_SITE_LIST_ROWS)\n const live = (rows ?? []).filter(\n (row: any) =>\n !row.deletedAt &&\n // An element interaction belongs to its page, not to the site's\n // automation list — the site's own Actions card counts rather than\n // lists them, and so does this.\n !(kind === 'actions' && LEAF_SELECTOR.test(String(row?.trigger?.selector ?? ''))),\n )\n const siteName = host.name || host.subdomain || host.id\n const href = orgSiteAutomationPath(mount, host.id, kind)\n const site = href ? (\n <AppLink href={href} underline=\"hover\">\n {siteName}\n </AppLink>\n ) : (\n siteName\n )\n return (\n <>\n {live.map((row: any) => (\n <TableRow key={`${host.id}/${row.$id}`}>\n <TableCell>\n {href ? (\n <AppLink href={href} underline=\"hover\">\n {String(row.name || row.$id)}\n </AppLink>\n ) : (\n String(row.name || row.$id)\n )}\n </TableCell>\n <TableCell>{site}</TableCell>\n <TableCell>{rowTrigger(kind, row)}</TableCell>\n <TableCell>{rowStatus(kind, row)}</TableCell>\n </TableRow>\n ))}\n {truncated ? (\n <TableRow>\n <TableCell colSpan={4}>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`${siteName} has more than ${ORG_SITE_LIST_ROWS} — `}\n {href ? (\n <AppLink href={href} underline=\"hover\">\n {'open the site to see them all'}\n </AppLink>\n ) : (\n 'open the site to see them all'\n )}\n </Typography>\n </TableCell>\n </TableRow>\n ) : null}\n </>\n )\n}\nSiteRows.displayName = 'SiteRows'\n\nexport default OrgSiteAutomationList\n"],"names":["hostEventLabel","pluginDocsHelp","orgPermissionLabel","AppLink","CardDisplay","ScrollTable","useFirestore","useFirestoreCollection","ceilingedWindow","collectionCeiling","Alert","Button","Menu","MenuItem","Stack","TableBody","TableCell","TableHead","TableRow","Typography","collection","useState","useWebhookSiteAccess","WEBHOOKS_PERMISSION","WEBHOOKS_REFUSAL","orgSiteAutomationPath","ORG_SITE_LIST_OPEN_SITES","ORG_SITE_LIST_MAX_SITES","ORG_SITE_LIST_ROWS","LEAF_SELECTOR","COPY","workflows","header","noun","plural","intro","actions","webhooks","OrgSiteAutomationList","props","mount","kind","access","copy","opened","setOpened","addAnchor","setAddAnchor","readable","hosts","filter","host","holds","id","reachable","slice","shown","folded","length","linkable","help","anchor","contentGutterX","contentGutterY","spacing","variant","color","errored","severity","hostsReady","known","size","aria-label","map","SiteRows","onClick","sx","alignSelf","direction","aria-haspopup","event","currentTarget","anchorEl","open","Boolean","onClose","component","componentVariant","href","name","subdomain","displayName","OrgSiteWebhookList","orgId","rowTrigger","row","trigger","rowStatus","enabled","firestore","data","idField","rows","truncated","live","deletedAt","test","String","selector","siteName","site","underline","$id","colSpan"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAGA,SAASA,cAAc,EAAEC,cAAc,QAAQ,eAAc;AAC7D,SAASC,kBAAkB,QAAQ,yCAAwC;AAC3E,SAASC,OAAO,EAAEC,WAAW,QAAQ,uBAAsB;AAC3D,SAASC,WAAW,QAAQ,yDAAwD;AACpF,SACEC,YAAY,EACZC,sBAAsB,QACjB,iCAAgC;AACvC;;;;CAIC,GACD,SACEC,eAAe,EACfC,iBAAiB,QACZ,+DAA8D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AS,aAAaZ,cAAc6E,IAAI,CAACC,eAAOZ,wBAAAA,eAAAA,IAAKC,OAAO,qBAAZD,aAAca,QAAQ,mBAAI,IAAG;;IAEnF,MAAMC,WAAW1D,KAAKsC,IAAI,IAAItC,KAAKuC,SAAS,IAAIvC,KAAKE,EAAE;IACvD,MAAMmC,OAAO/D,sBAAsBe,OAAOW,KAAKE,EAAE,EAAEZ;IACnD,MAAMqE,OAAOtB,qBACX,KAACrF;QAAQqF,MAAMA;QAAMuB,WAAU;kBAC5BF;SAGHA;IAEF,qBACE;;YACGL,KAAK/B,GAAG,CAAC,CAACsB,oBACT,MAAC7E;;sCACC,KAACF;sCACEwE,qBACC,KAACrF;gCAAQqF,MAAMA;gCAAMuB,WAAU;0CAC5BJ,OAAOZ,IAAIN,IAAI,IAAIM,IAAIiB,GAAG;iCAG7BL,OAAOZ,IAAIN,IAAI,IAAIM,IAAIiB,GAAG;;sCAG9B,KAAChG;sCAAW8F;;sCACZ,KAAC9F;sCAAW8E,WAAWrD,MAAMsD;;sCAC7B,KAAC/E;sCAAWiF,UAAUxD,MAAMsD;;;mBAZf,GAAG5C,KAAKE,EAAE,CAAC,CAAC,EAAE0C,IAAIiB,GAAG,EAAE;YAevCT,0BACC,KAACrF;0BACC,cAAA,KAACF;oBAAUiG,SAAS;8BAClB,cAAA,MAAC9F;wBAAW8C,SAAQ;wBAAUC,OAAM;;4BACjC,GAAG2C,SAAS,eAAe,EAAEjF,mBAAmB,GAAG,CAAC;4BACpD4D,qBACC,KAACrF;gCAAQqF,MAAMA;gCAAMuB,WAAU;0CAC5B;iCAGH;;;;iBAKN;;;AAGV;AACArC,SAASiB,WAAW,GAAG;AAEvB,eAAerD,sBAAqB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /** "See orders and webhooks": what the rules ask of a site's `webhooks`. */
18
+ export declare const WEBHOOKS_PERMISSION = "site.sensitive";
19
+ /** What a member without it is told, naming the permission. */
20
+ export declare const WEBHOOKS_REFUSAL: string;
21
+ /** The reader's standing for each site's webhooks. */
22
+ export interface WebhookSiteAccess {
23
+ /** True once the answer is in. Until then nothing is opened or refused. */
24
+ known: boolean;
25
+ /** The read behind the answer failed, so nothing can be said about any site. */
26
+ errored: boolean;
27
+ /** May the reader read this site's webhooks? */
28
+ holds(hostId: string): boolean;
29
+ }
30
+ /**
31
+ * Which sites' webhooks the signed-in member may read (AGL-4047), the rule's
32
+ * `canReadHostSensitive`: the key decided per site, so an editor narrowed on one
33
+ * site and a viewer raised on another each get the answer the rule gives them.
34
+ *
35
+ * Resolved by the function the site's `memberPermissions` stamp is written from,
36
+ * so a workspace of many sites pays for no host document: the membership holds
37
+ * the site roles, the site toggles and the member's overrides. A member of the
38
+ * whole workspace on a custom role pays one more read, of that role. A reader
39
+ * with no membership is staff, whom the rule admits.
40
+ */
41
+ export declare function useWebhookSiteAccess(orgId: string | null | undefined): WebhookSiteAccess;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { resolveSiteRolePresetPermissions } from "@aglyn/aglyn/app-utils/host-permissions";
17
+ import { permissionRefusalText } from "@aglyn/aglyn/app-utils/org-permissions";
18
+ import { isOrgWideMember } from "@aglyn/aglyn/app-utils/organizations";
19
+ import { useFirestore, useFirestoreDoc, useUser } from "@aglyn/tenant-feature-instance";
20
+ import { doc } from "firebase/firestore";
21
+ /** "See orders and webhooks": what the rules ask of a site's `webhooks`. */ export const WEBHOOKS_PERMISSION = 'site.sensitive';
22
+ /** What a member without it is told, naming the permission. */ export const WEBHOOKS_REFUSAL = permissionRefusalText(WEBHOOKS_PERMISSION);
23
+ const HOLDS_NOTHING = ()=>false;
24
+ const HOLDS_EVERYTHING = ()=>true;
25
+ /**
26
+ * Which sites' webhooks the signed-in member may read (AGL-4047), the rule's
27
+ * `canReadHostSensitive`: the key decided per site, so an editor narrowed on one
28
+ * site and a viewer raised on another each get the answer the rule gives them.
29
+ *
30
+ * Resolved by the function the site's `memberPermissions` stamp is written from,
31
+ * so a workspace of many sites pays for no host document: the membership holds
32
+ * the site roles, the site toggles and the member's overrides. A member of the
33
+ * whole workspace on a custom role pays one more read, of that role. A reader
34
+ * with no membership is staff, whom the rule admits.
35
+ */ export function useWebhookSiteAccess(orgId) {
36
+ var _ref, _member_data_roleId, _role_data;
37
+ const firestore = useFirestore();
38
+ const { data: user } = useUser();
39
+ const uid = (_ref = user == null ? void 0 : user.uid) != null ? _ref : '';
40
+ const member = useFirestoreDoc(()=>orgId && uid ? doc(firestore, 'orgs', orgId, 'members', uid) : null, [
41
+ firestore,
42
+ orgId,
43
+ uid
44
+ ]);
45
+ const roleId = member.status === 'success' && member.data && isOrgWideMember(member.data) ? (_member_data_roleId = member.data.roleId) != null ? _member_data_roleId : '' : '';
46
+ const role = useFirestoreDoc(()=>orgId && roleId ? doc(firestore, 'orgs', orgId, 'roles', roleId) : null, [
47
+ firestore,
48
+ orgId,
49
+ roleId
50
+ ]);
51
+ if (member.status === 'error' || roleId && role.status === 'error') {
52
+ return {
53
+ known: false,
54
+ errored: true,
55
+ holds: HOLDS_NOTHING
56
+ };
57
+ }
58
+ // The cache answers "missing" for a document it has never held; only the
59
+ // server says a reader has no membership.
60
+ const unsettled = member.status !== 'success' || !member.data && member.fromCache;
61
+ if (unsettled || roleId && role.status !== 'success') {
62
+ return {
63
+ known: false,
64
+ errored: false,
65
+ holds: HOLDS_NOTHING
66
+ };
67
+ }
68
+ const held = member.data;
69
+ if (!held) return {
70
+ known: true,
71
+ errored: false,
72
+ holds: HOLDS_EVERYTHING
73
+ };
74
+ const customRole = roleId ? (_role_data = role.data) != null ? _role_data : null : null;
75
+ return {
76
+ known: true,
77
+ errored: false,
78
+ holds: (hostId)=>resolveSiteRolePresetPermissions(held, hostId, customRole)[WEBHOOKS_PERMISSION] === true
79
+ };
80
+ }
81
+
82
+ //# sourceMappingURL=use-webhook-site-access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/workflows/src/lib/components/use-webhook-site-access.ts"],"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\nimport { resolveSiteRolePresetPermissions } from '@aglyn/aglyn/app-utils/host-permissions'\nimport { permissionRefusalText, type AglynOrgCustomRole } from '@aglyn/aglyn/app-utils/org-permissions'\nimport { isOrgWideMember } from '@aglyn/aglyn/app-utils/organizations'\nimport type { AglynOrgMember } from '@aglyn/aglyn/foundation/definitions/organization.types'\nimport { useFirestore, useFirestoreDoc, useUser } from '@aglyn/tenant-feature-instance'\nimport { doc } from 'firebase/firestore'\n\n/** \"See orders and webhooks\": what the rules ask of a site's `webhooks`. */\nexport const WEBHOOKS_PERMISSION = 'site.sensitive'\n\n/** What a member without it is told, naming the permission. */\nexport const WEBHOOKS_REFUSAL = permissionRefusalText(WEBHOOKS_PERMISSION)\n\n/** The reader's standing for each site's webhooks. */\nexport interface WebhookSiteAccess {\n /** True once the answer is in. Until then nothing is opened or refused. */\n known: boolean\n /** The read behind the answer failed, so nothing can be said about any site. */\n errored: boolean\n /** May the reader read this site's webhooks? */\n holds(hostId: string): boolean\n}\n\nconst HOLDS_NOTHING = () => false\nconst HOLDS_EVERYTHING = () => true\n\n/**\n * Which sites' webhooks the signed-in member may read (AGL-4047), the rule's\n * `canReadHostSensitive`: the key decided per site, so an editor narrowed on one\n * site and a viewer raised on another each get the answer the rule gives them.\n *\n * Resolved by the function the site's `memberPermissions` stamp is written from,\n * so a workspace of many sites pays for no host document: the membership holds\n * the site roles, the site toggles and the member's overrides. A member of the\n * whole workspace on a custom role pays one more read, of that role. A reader\n * with no membership is staff, whom the rule admits.\n */\nexport function useWebhookSiteAccess(orgId: string | null | undefined): WebhookSiteAccess {\n const firestore = useFirestore()\n const { data: user } = useUser()\n const uid = user?.uid ?? ''\n const member = useFirestoreDoc<AglynOrgMember & { roleId?: string | null }>(\n () => (orgId && uid ? doc(firestore, 'orgs', orgId, 'members', uid) : null),\n [firestore, orgId, uid],\n )\n const roleId =\n member.status === 'success' && member.data && isOrgWideMember(member.data) ? (member.data.roleId ?? '') : ''\n const role = useFirestoreDoc<AglynOrgCustomRole>(\n () => (orgId && roleId ? doc(firestore, 'orgs', orgId, 'roles', roleId) : null),\n [firestore, orgId, roleId],\n )\n if (member.status === 'error' || (roleId && role.status === 'error')) {\n return { known: false, errored: true, holds: HOLDS_NOTHING }\n }\n // The cache answers \"missing\" for a document it has never held; only the\n // server says a reader has no membership.\n const unsettled = member.status !== 'success' || (!member.data && member.fromCache)\n if (unsettled || (roleId && role.status !== 'success')) {\n return { known: false, errored: false, holds: HOLDS_NOTHING }\n }\n const held = member.data\n if (!held) return { known: true, errored: false, holds: HOLDS_EVERYTHING }\n const customRole = roleId ? (role.data ?? null) : null\n return {\n known: true,\n errored: false,\n holds: (hostId) =>\n resolveSiteRolePresetPermissions(held, hostId as never, customRole)[WEBHOOKS_PERMISSION] === true,\n }\n}\n"],"names":["resolveSiteRolePresetPermissions","permissionRefusalText","isOrgWideMember","useFirestore","useFirestoreDoc","useUser","doc","WEBHOOKS_PERMISSION","WEBHOOKS_REFUSAL","HOLDS_NOTHING","HOLDS_EVERYTHING","useWebhookSiteAccess","orgId","member","role","firestore","data","user","uid","roleId","status","known","errored","holds","unsettled","fromCache","held","customRole","hostId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,gCAAgC,QAAQ,0CAAyC;AAC1F,SAASC,qBAAqB,QAAiC,yCAAwC;AACvG,SAASC,eAAe,QAAQ,uCAAsC;AAEtE,SAASC,YAAY,EAAEC,eAAe,EAAEC,OAAO,QAAQ,iCAAgC;AACvF,SAASC,GAAG,QAAQ,qBAAoB;AAExC,0EAA0E,GAC1E,OAAO,MAAMC,sBAAsB,iBAAgB;AAEnD,6DAA6D,GAC7D,OAAO,MAAMC,mBAAmBP,sBAAsBM,qBAAoB;AAY1E,MAAME,gBAAgB,IAAM;AAC5B,MAAMC,mBAAmB,IAAM;AAE/B;;;;;;;;;;CAUC,GACD,OAAO,SAASC,qBAAqBC,KAAgC;cASaC,qBAgBnDC;IAxB7B,MAAMC,YAAYZ;IAClB,MAAM,EAAEa,MAAMC,IAAI,EAAE,GAAGZ;IACvB,MAAMa,cAAMD,wBAAAA,KAAMC,GAAG,mBAAI;IACzB,MAAML,SAAST,gBACb,IAAOQ,SAASM,MAAMZ,IAAIS,WAAW,QAAQH,OAAO,WAAWM,OAAO,MACtE;QAACH;QAAWH;QAAOM;KAAI;IAEzB,MAAMC,SACJN,OAAOO,MAAM,KAAK,aAAaP,OAAOG,IAAI,IAAId,gBAAgBW,OAAOG,IAAI,KAAKH,sBAAAA,OAAOG,IAAI,CAACG,MAAM,YAAlBN,sBAAsB,KAAM;IAC5G,MAAMC,OAAOV,gBACX,IAAOQ,SAASO,SAASb,IAAIS,WAAW,QAAQH,OAAO,SAASO,UAAU,MAC1E;QAACJ;QAAWH;QAAOO;KAAO;IAE5B,IAAIN,OAAOO,MAAM,KAAK,WAAYD,UAAUL,KAAKM,MAAM,KAAK,SAAU;QACpE,OAAO;YAAEC,OAAO;YAAOC,SAAS;YAAMC,OAAOd;QAAc;IAC7D;IACA,yEAAyE;IACzE,0CAA0C;IAC1C,MAAMe,YAAYX,OAAOO,MAAM,KAAK,aAAc,CAACP,OAAOG,IAAI,IAAIH,OAAOY,SAAS;IAClF,IAAID,aAAcL,UAAUL,KAAKM,MAAM,KAAK,WAAY;QACtD,OAAO;YAAEC,OAAO;YAAOC,SAAS;YAAOC,OAAOd;QAAc;IAC9D;IACA,MAAMiB,OAAOb,OAAOG,IAAI;IACxB,IAAI,CAACU,MAAM,OAAO;QAAEL,OAAO;QAAMC,SAAS;QAAOC,OAAOb;IAAiB;IACzE,MAAMiB,aAAaR,UAAUL,aAAAA,KAAKE,IAAI,YAATF,aAAa,OAAQ;IAClD,OAAO;QACLO,OAAO;QACPC,SAAS;QACTC,OAAO,CAACK,SACN5B,iCAAiC0B,MAAME,QAAiBD,WAAW,CAACpB,oBAAoB,KAAK;IACjG;AACF"}
@@ -22,7 +22,7 @@ import HostActionsCard from "./host-actions-card.component.js";
22
22
  import HostWebhooksCard from "./host-webhooks-card.component.js";
23
23
  import HostWorkflowsCard from "./host-workflows-card.component.js";
24
24
  import OrgAutomationsCard from "./org-automations-card.component.js";
25
- import OrgSiteAutomationList from "./org-site-automation-list.component.js";
25
+ import OrgSiteAutomationList, { OrgSiteWebhookList } from "./org-site-automation-list.component.js";
26
26
  import RunQuotaLine from "./run-quota-line.component.js";
27
27
  import SiteOrgAutomationsPanel from "./site-org-automations-panel.component.js";
28
28
  import { workflowsOrgMount } from "./workflows-org-mount.js";
@@ -113,18 +113,15 @@ import { workflowsOrgMount } from "./workflows-org-mount.js";
113
113
  }),
114
114
  /*#__PURE__*/ _jsx(OrgSiteAutomationList, {
115
115
  mount: mount,
116
- kind: section,
117
- canRead: true
116
+ kind: section
118
117
  })
119
118
  ]
120
119
  });
121
120
  case 'webhooks':
122
- // A webhook holds its site's secret: the rules admit a site's admins
123
- // and editors, which every org-wide member but a viewer is.
124
- return /*#__PURE__*/ _jsx(OrgSiteAutomationList, {
125
- mount: mount,
126
- kind: "webhooks",
127
- canRead: canEdit
121
+ // A webhook holds its site's secret: it asks what the rules ask of each
122
+ // site, "See orders and webhooks" (`site.sensitive`).
123
+ return /*#__PURE__*/ _jsx(OrgSiteWebhookList, {
124
+ mount: mount
128
125
  });
129
126
  default:
130
127
  return null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/workflows/src/lib/components/workflows-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 type { AglynOrgBilling, ConsolePluginPageProps } from '@aglyn/aglyn'\nimport { HubSections } from '@aglyn/shared-ui-next'\nimport { Stack } from '@mui/material'\nimport { useMemo, type ReactNode } from 'react'\nimport HostActionsCard from './host-actions-card.component'\nimport HostWebhooksCard from './host-webhooks-card.component'\nimport HostWorkflowsCard from './host-workflows-card.component'\nimport OrgAutomationsCard from './org-automations-card.component'\nimport OrgSiteAutomationList from './org-site-automation-list.component'\nimport RunQuotaLine from './run-quota-line.component'\nimport SiteOrgAutomationsPanel from './site-org-automations-panel.component'\nimport type { WorkflowsConsoleSectionId } from './workflows-console-sections'\nimport {\n workflowsOrgMount,\n type WorkflowsOrgMount,\n} from './workflows-org-mount'\n\n/**\n * The body of one workflows section, built only when that section is the one\n * being read (AGL-2501).\n *\n * A function rather than a map of nodes on purpose: a `Record<id, ReactNode>`\n * would CONSTRUCT all three every render, and each card opens its Firestore\n * listens on mount — which is the entire cost this page exists to stop paying.\n * Only the returned branch is ever built.\n */\nfunction sectionBody(\n section: WorkflowsConsoleSectionId,\n hostId: string,\n org: Partial<AglynOrgBilling> | undefined,\n /** The Actions section's address, where a drafted action is opened. */\n actionsHref?: string,\n): ReactNode {\n switch (section) {\n case 'workflows':\n return (\n /*\n * `N runs this month · M included` (AGL-2171), which the run-history\n * mockup puts opposite the heading. The quota silently stops\n * automations running once it is reached, and the only place it was\n * reported was the Billing page.\n */\n <Stack spacing={1}>\n <RunQuotaLine hostId={hostId} org={org} counter=\"workflowRuns\" />\n <HostWorkflowsCard\n hostId={hostId}\n org={org}\n actionsHref={actionsHref}\n />\n </Stack>\n )\n case 'actions':\n return (\n <Stack spacing={1}>\n {/* `actionRunsPerMonth` had NO customer-facing surface at all\n before this — staff panel and usage-alerts only. */}\n <RunQuotaLine hostId={hostId} org={org} counter=\"actionRuns\" />\n <HostActionsCard hostId={hostId} org={org} />\n {/* What the organization runs on this site beside the site's own\n actions, and the site's pause for each (AGL-3302). */}\n <SiteOrgAutomationsPanel hostId={hostId} />\n </Stack>\n )\n case 'webhooks':\n return <HostWebhooksCard hostId={hostId} org={org} />\n default:\n return null\n }\n}\n\n/**\n * The body of one ORGANIZATION-level section (AGL-3302): the org automations,\n * and every site's own workflows, actions and webhooks listed with the site\n * each belongs to.\n *\n * The run allowance line heads the workflows and actions lists here too: the\n * allowance is the workspace's (AGL-3472), every site's runs spend it, and\n * this is the page that lists them all.\n */\nfunction orgSectionBody(\n section: WorkflowsConsoleSectionId,\n mount: WorkflowsOrgMount,\n org: Partial<AglynOrgBilling> | undefined,\n canEdit: boolean,\n): ReactNode {\n switch (section) {\n case 'automations':\n return <OrgAutomationsCard mount={mount} org={org} canEdit={canEdit} />\n case 'workflows':\n case 'actions':\n return (\n <Stack spacing={1}>\n <RunQuotaLine\n hostId={null}\n orgId={mount.orgId}\n org={org}\n counter={section === 'workflows' ? 'workflowRuns' : 'actionRuns'}\n />\n <OrgSiteAutomationList mount={mount} kind={section} canRead />\n </Stack>\n )\n case 'webhooks':\n // A webhook holds its site's secret: the rules admit a site's admins\n // and editors, which every org-wide member but a viewer is.\n return (\n <OrgSiteAutomationList mount={mount} kind=\"webhooks\" canRead={canEdit} />\n )\n default:\n return null\n }\n}\n\n/**\n * Automation page (AGL-101/148/149 → AGL-395): the automation surface —\n * workflow builder, event-triggered actions, and webhooks — owned by the\n * workflows plugin and rendered by the shell's generic plugin route. Each card\n * runs its own entitlement check (workflows / actions / webhooks are distinct\n * plan flags), so the shell's resolved `org` doc flows into all three.\n *\n * Sections are ROUTES (AGL-2501). `HubTabs lazy` already mounted one panel, so\n * this is not a read saving — `workflows-console-read-cost.spec.tsx` was\n * written BEFORE the conversion precisely to hold that line, and reports the\n * same counts after. What routing adds is that the URL names the section: it is\n * linkable, the back button walks sections, the breadcrumb says where you are,\n * and \"mount only what is open\" is structural rather than a `lazy` flag.\n *\n * The section ids are unchanged by the Automation rename: they are the\n * addresses people bookmark and the docs link to. A workflow belongs to the\n * site and an ACTION belongs to the site too; an interaction belongs to the\n * document that holds it and is edited on the element, not here.\n */\nexport function WorkflowsConsolePage(props: ConsolePluginPageProps) {\n const { hostId, orgMount, org, permissions, section, sections, basePath } =\n props\n /*\n * Mounted with no site: the organization's hub (AGL-3302). Memoised so the\n * cards below, which key their listeners on the mount's org, see one object.\n */\n const mount = useMemo(\n () => (hostId == null ? workflowsOrgMount(orgMount, basePath) : null),\n [hostId, orgMount, basePath],\n )\n\n /*\n * Nothing until the URL names a section. The shell redirects a bare hub URL\n * to the landing section and holds a spinner while it does, so this state is\n * transient — and rendering a default section here instead would pay for its\n * listens on a URL that is already being replaced.\n */\n if (!section || !sections?.length || !basePath) return null\n\n if (hostId == null) {\n // No site and no org to stand in for it: nothing this page can scope.\n if (!mount) return null\n return (\n <HubSections sections={sections}>\n {orgSectionBody(\n section as WorkflowsConsoleSectionId,\n mount,\n org,\n // An org viewer's `editHosts` is false; every other org role's is\n // true. The server routes decide — this keeps a viewer from being\n // offered controls that are about to refuse them.\n permissions?.editHosts !== false,\n )}\n </HubSections>\n )\n }\n\n return (\n <HubSections sections={sections}>\n {sectionBody(\n section as WorkflowsConsoleSectionId,\n hostId,\n org,\n sections.find((one) => one.id === 'actions')?.href,\n )}\n </HubSections>\n )\n}\nWorkflowsConsolePage.displayName = 'WorkflowsConsolePage'\n\nexport default WorkflowsConsolePage\n"],"names":["HubSections","Stack","useMemo","HostActionsCard","HostWebhooksCard","HostWorkflowsCard","OrgAutomationsCard","OrgSiteAutomationList","RunQuotaLine","SiteOrgAutomationsPanel","workflowsOrgMount","sectionBody","section","hostId","org","actionsHref","spacing","counter","orgSectionBody","mount","canEdit","orgId","kind","canRead","WorkflowsConsolePage","props","sections","orgMount","permissions","basePath","length","editHosts","find","one","id","href","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAGA,SAASA,WAAW,QAAQ,wBAAuB;AACnD,SAASC,KAAK,QAAQ,gBAAe;AACrC,SAASC,OAAO,QAAwB,QAAO;AAC/C,OAAOC,qBAAqB,mCAA+B;AAC3D,OAAOC,sBAAsB,oCAAgC;AAC7D,OAAOC,uBAAuB,qCAAiC;AAC/D,OAAOC,wBAAwB,sCAAkC;AACjE,OAAOC,2BAA2B,0CAAsC;AACxE,OAAOC,kBAAkB,gCAA4B;AACrD,OAAOC,6BAA6B,4CAAwC;AAE5E,SACEC,iBAAiB,QAEZ,2BAAuB;AAE9B;;;;;;;;CAQC,GACD,SAASC,YACPC,OAAkC,EAClCC,MAAc,EACdC,GAAyC,EACzC,qEAAqE,GACrEC,WAAoB;IAEp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MAAMN,QAAQjB,QACZ,IAAOW,UAAU,OAAOH,kBAAkBiB,UAAUE,YAAY,MAChE;QAAChB;QAAQc;QAAUE;KAAS;IAG9B;;;;;GAKC,GACD,IAAI,CAACjB,WAAW,EAACc,4BAAAA,SAAUI,MAAM,KAAI,CAACD,UAAU,OAAO;IAEvD,IAAIhB,UAAU,MAAM;QAClB,sEAAsE;QACtE,IAAI,CAACM,OAAO,OAAO;QACnB,qBACE,KAACnB;YAAY0B,UAAUA;sBACpBR,eACCN,SACAO,OACAL,KACA,kEAAkE;YAClE,kEAAkE;YAClE,kDAAkD;YAClDc,CAAAA,+BAAAA,YAAaG,SAAS,MAAK;;IAInC;IAEA,qBACE,KAAC/B;QAAY0B,UAAUA;kBACpBf,YACCC,SACAC,QACAC,MACAY,iBAAAA,SAASM,IAAI,CAAC,CAACC,MAAQA,IAAIC,EAAE,KAAK,+BAAlCR,eAA8CS,IAAI;;AAI1D;AACAX,qBAAqBY,WAAW,GAAG;AAEnC,eAAeZ,qBAAoB"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/workflows/src/lib/components/workflows-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 type { AglynOrgBilling, ConsolePluginPageProps } from '@aglyn/aglyn'\nimport { HubSections } from '@aglyn/shared-ui-next'\nimport { Stack } from '@mui/material'\nimport { useMemo, type ReactNode } from 'react'\nimport HostActionsCard from './host-actions-card.component'\nimport HostWebhooksCard from './host-webhooks-card.component'\nimport HostWorkflowsCard from './host-workflows-card.component'\nimport OrgAutomationsCard from './org-automations-card.component'\nimport OrgSiteAutomationList, { OrgSiteWebhookList } from './org-site-automation-list.component'\nimport RunQuotaLine from './run-quota-line.component'\nimport SiteOrgAutomationsPanel from './site-org-automations-panel.component'\nimport type { WorkflowsConsoleSectionId } from './workflows-console-sections'\nimport {\n workflowsOrgMount,\n type WorkflowsOrgMount,\n} from './workflows-org-mount'\n\n/**\n * The body of one workflows section, built only when that section is the one\n * being read (AGL-2501).\n *\n * A function rather than a map of nodes on purpose: a `Record<id, ReactNode>`\n * would CONSTRUCT all three every render, and each card opens its Firestore\n * listens on mount — which is the entire cost this page exists to stop paying.\n * Only the returned branch is ever built.\n */\nfunction sectionBody(\n section: WorkflowsConsoleSectionId,\n hostId: string,\n org: Partial<AglynOrgBilling> | undefined,\n /** The Actions section's address, where a drafted action is opened. */\n actionsHref?: string,\n): ReactNode {\n switch (section) {\n case 'workflows':\n return (\n /*\n * `N runs this month · M included` (AGL-2171), which the run-history\n * mockup puts opposite the heading. The quota silently stops\n * automations running once it is reached, and the only place it was\n * reported was the Billing page.\n */\n <Stack spacing={1}>\n <RunQuotaLine hostId={hostId} org={org} counter=\"workflowRuns\" />\n <HostWorkflowsCard\n hostId={hostId}\n org={org}\n actionsHref={actionsHref}\n />\n </Stack>\n )\n case 'actions':\n return (\n <Stack spacing={1}>\n {/* `actionRunsPerMonth` had NO customer-facing surface at all\n before this — staff panel and usage-alerts only. */}\n <RunQuotaLine hostId={hostId} org={org} counter=\"actionRuns\" />\n <HostActionsCard hostId={hostId} org={org} />\n {/* What the organization runs on this site beside the site's own\n actions, and the site's pause for each (AGL-3302). */}\n <SiteOrgAutomationsPanel hostId={hostId} />\n </Stack>\n )\n case 'webhooks':\n return <HostWebhooksCard hostId={hostId} org={org} />\n default:\n return null\n }\n}\n\n/**\n * The body of one ORGANIZATION-level section (AGL-3302): the org automations,\n * and every site's own workflows, actions and webhooks listed with the site\n * each belongs to.\n *\n * The run allowance line heads the workflows and actions lists here too: the\n * allowance is the workspace's (AGL-3472), every site's runs spend it, and\n * this is the page that lists them all.\n */\nfunction orgSectionBody(\n section: WorkflowsConsoleSectionId,\n mount: WorkflowsOrgMount,\n org: Partial<AglynOrgBilling> | undefined,\n canEdit: boolean,\n): ReactNode {\n switch (section) {\n case 'automations':\n return <OrgAutomationsCard mount={mount} org={org} canEdit={canEdit} />\n case 'workflows':\n case 'actions':\n return (\n <Stack spacing={1}>\n <RunQuotaLine\n hostId={null}\n orgId={mount.orgId}\n org={org}\n counter={section === 'workflows' ? 'workflowRuns' : 'actionRuns'}\n />\n <OrgSiteAutomationList mount={mount} kind={section} />\n </Stack>\n )\n case 'webhooks':\n // A webhook holds its site's secret: it asks what the rules ask of each\n // site, \"See orders and webhooks\" (`site.sensitive`).\n return <OrgSiteWebhookList mount={mount} />\n default:\n return null\n }\n}\n\n/**\n * Automation page (AGL-101/148/149 → AGL-395): the automation surface —\n * workflow builder, event-triggered actions, and webhooks — owned by the\n * workflows plugin and rendered by the shell's generic plugin route. Each card\n * runs its own entitlement check (workflows / actions / webhooks are distinct\n * plan flags), so the shell's resolved `org` doc flows into all three.\n *\n * Sections are ROUTES (AGL-2501). `HubTabs lazy` already mounted one panel, so\n * this is not a read saving — `workflows-console-read-cost.spec.tsx` was\n * written BEFORE the conversion precisely to hold that line, and reports the\n * same counts after. What routing adds is that the URL names the section: it is\n * linkable, the back button walks sections, the breadcrumb says where you are,\n * and \"mount only what is open\" is structural rather than a `lazy` flag.\n *\n * The section ids are unchanged by the Automation rename: they are the\n * addresses people bookmark and the docs link to. A workflow belongs to the\n * site and an ACTION belongs to the site too; an interaction belongs to the\n * document that holds it and is edited on the element, not here.\n */\nexport function WorkflowsConsolePage(props: ConsolePluginPageProps) {\n const { hostId, orgMount, org, permissions, section, sections, basePath } =\n props\n /*\n * Mounted with no site: the organization's hub (AGL-3302). Memoised so the\n * cards below, which key their listeners on the mount's org, see one object.\n */\n const mount = useMemo(\n () => (hostId == null ? workflowsOrgMount(orgMount, basePath) : null),\n [hostId, orgMount, basePath],\n )\n\n /*\n * Nothing until the URL names a section. The shell redirects a bare hub URL\n * to the landing section and holds a spinner while it does, so this state is\n * transient — and rendering a default section here instead would pay for its\n * listens on a URL that is already being replaced.\n */\n if (!section || !sections?.length || !basePath) return null\n\n if (hostId == null) {\n // No site and no org to stand in for it: nothing this page can scope.\n if (!mount) return null\n return (\n <HubSections sections={sections}>\n {orgSectionBody(\n section as WorkflowsConsoleSectionId,\n mount,\n org,\n // An org viewer's `editHosts` is false; every other org role's is\n // true. The server routes decide — this keeps a viewer from being\n // offered controls that are about to refuse them.\n permissions?.editHosts !== false,\n )}\n </HubSections>\n )\n }\n\n return (\n <HubSections sections={sections}>\n {sectionBody(\n section as WorkflowsConsoleSectionId,\n hostId,\n org,\n sections.find((one) => one.id === 'actions')?.href,\n )}\n </HubSections>\n )\n}\nWorkflowsConsolePage.displayName = 'WorkflowsConsolePage'\n\nexport default WorkflowsConsolePage\n"],"names":["HubSections","Stack","useMemo","HostActionsCard","HostWebhooksCard","HostWorkflowsCard","OrgAutomationsCard","OrgSiteAutomationList","OrgSiteWebhookList","RunQuotaLine","SiteOrgAutomationsPanel","workflowsOrgMount","sectionBody","section","hostId","org","actionsHref","spacing","counter","orgSectionBody","mount","canEdit","orgId","kind","WorkflowsConsolePage","props","sections","orgMount","permissions","basePath","length","editHosts","find","one","id","href","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAGA,SAASA,WAAW,QAAQ,wBAAuB;AACnD,SAASC,KAAK,QAAQ,gBAAe;AACrC,SAASC,OAAO,QAAwB,QAAO;AAC/C,OAAOC,qBAAqB,mCAA+B;AAC3D,OAAOC,sBAAsB,oCAAgC;AAC7D,OAAOC,uBAAuB,qCAAiC;AAC/D,OAAOC,wBAAwB,sCAAkC;AACjE,OAAOC,yBAAyBC,kBAAkB,QAAQ,0CAAsC;AAChG,OAAOC,kBAAkB,gCAA4B;AACrD,OAAOC,6BAA6B,4CAAwC;AAE5E,SACEC,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