@aglyn/plugins-marketplace 1.20.1 → 1.20.2
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 +15 -15
- package/src/lib/components/listing-content.component.d.ts +8 -1
- package/src/lib/components/listing-content.component.js +52 -12
- package/src/lib/components/listing-content.component.js.map +1 -1
- package/src/lib/components/listing-detail-page.component.d.ts +6 -0
- package/src/lib/components/listing-detail-page.component.js +24 -4
- package/src/lib/components/listing-detail-page.component.js.map +1 -1
- package/src/lib/components/marketplace-hub.component.js +2 -0
- package/src/lib/components/marketplace-hub.component.js.map +1 -1
- package/src/lib/components/org-plugin-installs-card.component.js +67 -9
- package/src/lib/components/org-plugin-installs-card.component.js.map +1 -1
- package/src/lib/components/org-seller-panel.component.js +14 -4
- package/src/lib/components/org-seller-panel.component.js.map +1 -1
- package/src/lib/components/plugin-reviews-surface.component.js +17 -6
- package/src/lib/components/plugin-reviews-surface.component.js.map +1 -1
- package/src/lib/components/plugin-site-set-panel.component.d.ts +11 -0
- package/src/lib/components/plugin-site-set-panel.component.js +52 -9
- package/src/lib/components/plugin-site-set-panel.component.js.map +1 -1
- package/src/lib/hooks/use-starter-publish-facts.js +5 -1
- package/src/lib/hooks/use-starter-publish-facts.js.map +1 -1
- package/src/lib/model/marketplace-catalog.d.ts +40 -1
- package/src/lib/model/marketplace-catalog.js +46 -2
- package/src/lib/model/marketplace-catalog.js.map +1 -1
- package/src/lib/model/marketplace.d.ts +1 -1
- package/src/lib/model/marketplace.js +1 -1
- package/src/lib/model/marketplace.js.map +1 -1
- package/src/lib/model/starter-publish.d.ts +12 -5
- package/src/lib/model/starter-publish.js +18 -6
- package/src/lib/model/starter-publish.js.map +1 -1
- package/src/lib/server/connect.js +45 -13
- package/src/lib/server/connect.js.map +1 -1
- package/src/lib/server/starter-publish-facts.js +4 -0
- package/src/lib/server/starter-publish-facts.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/components/plugin-site-set-panel.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 { Typography } from '@mui/material'\nimport { doc, getDoc } from 'firebase/firestore'\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useFirestore,\n useFirestoreDoc,\n useHostOrgId,\n} from '@aglyn/tenant-feature-instance'\nimport { offeredPluginVersion } from '@aglyn/aglyn'\nimport { resolveOrgInstallSummary, type OrgInstallHost } from '../model/marketplace'\nimport { useMarketplaceActions } from '../hooks/use-marketplace-actions'\nimport PluginSiteSet from './plugin-site-set.component'\n\nexport interface PluginSiteSetPanelProps {\n /** Acting site — org pins still resolve their org through one. */\n hostId: string\n listingId: string\n /**\n * Every site, with its own `disabledPlugins` when the page has it\n * (AGL-4047): a site that switched this listing off is pinned but does not\n * run it, and the panel says so instead of listing it as running.\n */\n hosts?: ReadonlyArray<OrgInstallHost>\n}\n\n/**\n * The `pluginSiteSet` slot (AGL-1007): the site-set control as something the\n * console can drop onto the installation detail page without importing this\n * plugin.\n *\n * It reads its own pins rather than taking them as props, because the page\n * that hosts it has no other use for them — unlike the listing page, which\n * also gates its pre-install picker and primary button on the same state and\n * therefore keeps ownership of it there.\n */\nexport function PluginSiteSetPanel(props: PluginSiteSetPanelProps) {\n const { hostId, listingId, hosts } = props\n const firestore = useFirestore()\n const orgId = useHostOrgId(hostId)\n const { installPlan, uninstall } = useMarketplaceActions(hostId)\n\n // Held at null while `useHostOrgId` is in flight, never `orgs/-pending-`\n // (AGL-1440): installs are member-gated, so the sentinel was a\n // guaranteed-denied listen on every mount of this panel.\n const { data: orgPin } = useFirestoreDoc<any>(\n () =>\n orgId && listingId\n ? doc(firestore, 'orgs', orgId, 'installs', listingId)\n : null,\n [firestore, orgId, listingId],\n )\n const [sitePins, setSitePins] = useState<Record<string, any>>({})\n const [pinsNonce, setPinsNonce] = useState(0)\n const hostIdsKey = (hosts ?? []).map((host) => host.id).join('|')\n useEffect(() => {\n if (!listingId || !hosts?.length) return\n let active = true\n void Promise.all(\n hosts.map(async (host) => {\n const snapshot = await getDoc(\n doc(firestore, 'hosts', host.id, 'installs', listingId),\n )\n return [host.id, snapshot.exists() ? snapshot.data() : null] as const\n }),\n )\n .then((entries) => {\n if (active) setSitePins(Object.fromEntries(entries))\n })\n .catch(() => undefined)\n return () => {\n active = false\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [firestore, listingId, hostIdsKey, pinsNonce])\n\n // The listing, for the version actually on offer (AGL-1017). This used to\n // pass a PIN's own version as `latestVersion`, which is by definition the\n // version that pin is already at — so no site ever looked stale and the\n // update control never appeared on this page at all.\n const { data: listing } = useFirestoreDoc<any>(\n () => doc(firestore, 'marketplaceListings', listingId || '-missing-'),\n [firestore, listingId],\n )\n\n // The kill switch (AGL-2368). This panel offers an UPDATE, so it is asking\n // \"what installs today\" and had only the review-verdict mirror to ask —\n // which nothing cleared on revoke, so it offered a version the install\n // route refuses. Listing-scoped and public, one read for the panel.\n const { data: revocation } = useFirestoreDoc<any>(\n () =>\n listingId ? doc(firestore, 'revocations', listingId) : null,\n [firestore, listingId],\n )\n\n const orgInstall = useMemo(\n () =>\n resolveOrgInstallSummary(hosts ?? [], sitePins, orgPin ?? null, listingId),\n [hosts, sitePins, orgPin, listingId],\n )\n // The listing doc the actions need. The pin carries the denormalised copy\n // the actions actually read (`$id`, `displayName`, `pluginId`), so this page\n // does not pay for a second read of the listing itself. `pluginId` is what\n // the uninstall dialog scans published pages by; without it the impact is\n // unknown and every uninstall asks for the typed acknowledgement.\n const anyPin = orgPin ?? Object.values(sitePins).find(Boolean) ?? null\n const actionListing = useMemo(\n () => ({\n $id: listingId,\n displayName: listing?.displayName ?? anyPin?.displayName ?? listingId,\n artifactType: 'plugin',\n latestVersion: listing?.latestVersion ?? anyPin?.version,\n pluginId: listing?.pluginId ?? anyPin?.pluginId,\n }),\n [\n listingId,\n listing?.displayName,\n listing?.latestVersion,\n listing?.pluginId,\n anyPin?.displayName,\n anyPin?.version,\n anyPin?.pluginId,\n ],\n )\n\n if (!orgInstall.installedAnywhere) {\n return (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Not installed on any site in this organization.'}\n </Typography>\n )\n }\n\n return (\n <PluginSiteSet\n listing={actionListing}\n hosts={hosts ?? []}\n orgInstall={orgInstall}\n // The newest INSTALLABLE version (AGL-1016/2368) — never `latestVersion`,\n // and never the review verdict alone, or the page offers an update the\n // install route refuses.\n latestVersion={offeredPluginVersion(listing, revocation) ?? undefined}\n installPlan={installPlan}\n uninstall={uninstall}\n onChanged={() => setPinsNonce((current) => current + 1)}\n />\n )\n}\n\nPluginSiteSetPanel.displayName = 'PluginSiteSetPanel'\n\nexport default PluginSiteSetPanel\n"],"names":["Typography","doc","getDoc","useEffect","useMemo","useState","useFirestore","useFirestoreDoc","useHostOrgId","offeredPluginVersion","resolveOrgInstallSummary","useMarketplaceActions","PluginSiteSet","PluginSiteSetPanel","props","orgPin","hostId","listingId","hosts","firestore","orgId","installPlan","uninstall","data","sitePins","setSitePins","pinsNonce","setPinsNonce","hostIdsKey","map","host","id","join","length","active","Promise","all","snapshot","exists","then","entries","Object","fromEntries","catch","undefined","listing","revocation","orgInstall","anyPin","values","find","Boolean","actionListing","$id","displayName","artifactType","latestVersion","version","pluginId","installedAnywhere","variant","color","onChanged","current"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,UAAU,QAAQ,gBAAe;AAC1C,SAASC,GAAG,EAAEC,MAAM,QAAQ,qBAAoB;AACh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AASS,WAAW;QACpBT,2BAAAA,QAASW,aAAa;QACtBX,2BAAAA,QAASa,QAAQ;QACjBV,0BAAAA,OAAQM,WAAW;QACnBN,0BAAAA,OAAQS,OAAO;QACfT,0BAAAA,OAAQU,QAAQ;KACjB;IAGH,IAAI,CAACX,WAAWY,iBAAiB,EAAE;QACjC,qBACE,KAAC3D;YAAW4D,SAAQ;YAAQC,OAAM;sBAC/B;;IAGP;IAEA,qBACE,KAACjD;QACCiC,SAASO;QACTlC,KAAK,EAAEA,gBAAAA,QAAS,EAAE;QAClB6B,YAAYA;QACZ,0EAA0E;QAC1E,uEAAuE;QACvE,yBAAyB;QACzBS,aAAa,GAAE/C,wBAAAA,qBAAqBoC,SAASC,uBAA9BrC,wBAA6CmC;QAC5DvB,aAAaA;QACbC,WAAWA;QACXwC,WAAW,IAAMnC,aAAa,CAACoC,UAAYA,UAAU;;AAG3D;AAEAlD,mBAAmByC,WAAW,GAAG;AAEjC,eAAezC,mBAAkB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/components/plugin-site-set-panel.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 { Alert, CircularProgress, Stack, Typography } from '@mui/material'\nimport { doc, getDoc } from 'firebase/firestore'\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useFirestore,\n useFirestoreDoc,\n useHostOrgIdState,\n} from '@aglyn/tenant-feature-instance'\nimport { offeredPluginVersion } from '@aglyn/aglyn'\nimport {\n installPictureReadPhase,\n resolveOrgInstallSummary,\n type OrgInstallHost,\n} from '../model/marketplace'\nimport { useMarketplaceActions } from '../hooks/use-marketplace-actions'\nimport PluginSiteSet from './plugin-site-set.component'\n\nexport interface PluginSiteSetPanelProps {\n /** Acting site — org pins still resolve their org through one. */\n hostId: string\n listingId: string\n /**\n * Every site, with its own `disabledPlugins` when the page has it\n * (AGL-4047): a site that switched this listing off is pinned but does not\n * run it, and the panel says so instead of listing it as running.\n */\n hosts?: ReadonlyArray<OrgInstallHost>\n /**\n * Whether `hosts` is the whole site list yet (AGL-4047). Absent reads as\n * true, for a caller that only mounts this once its sites are known.\n */\n hostsReady?: boolean\n /**\n * The workspace, when the page knows it (AGL-4047). Read through the\n * acting site otherwise, and that lookup is a one-shot read that settles\n * to \"no org\" when it fails, after which no org pin is ever read.\n */\n orgId?: string\n}\n\n/**\n * The `pluginSiteSet` slot (AGL-1007): the site-set control as something the\n * console can drop onto the installation detail page without importing this\n * plugin.\n *\n * It reads its own pins rather than taking them as props, because the page\n * that hosts it has no other use for them — unlike the listing page, which\n * also gates its pre-install picker and primary button on the same state and\n * therefore keeps ownership of it there.\n */\nexport function PluginSiteSetPanel(props: PluginSiteSetPanelProps) {\n const { hostId, listingId, hosts, hostsReady = true } = props\n const firestore = useFirestore()\n const hostOrg = useHostOrgIdState(props.orgId ? undefined : hostId)\n const orgId = props.orgId || hostOrg.orgId\n const { installPlan, uninstall } = useMarketplaceActions(hostId)\n\n // Held at null while `useHostOrgId` is in flight, never `orgs/-pending-`\n // (AGL-1440): installs are member-gated, so the sentinel was a\n // guaranteed-denied listen on every mount of this panel.\n const orgPinRead = useFirestoreDoc<any>(\n () =>\n orgId && listingId\n ? doc(firestore, 'orgs', orgId, 'installs', listingId)\n : null,\n [firestore, orgId, listingId],\n )\n const orgPin = orgPinRead.data\n const [sitePins, setSitePins] = useState<Record<string, any>>({})\n const [pinsNonce, setPinsNonce] = useState(0)\n const hostIdsKey = (hosts ?? []).map((host) => host.id).join('|')\n /** The site set the pins answer for, or that reading them failed (AGL-4047). */\n const [sitePinsFor, setSitePinsFor] = useState<string | null>(null)\n const [sitePinsFailed, setSitePinsFailed] = useState(false)\n useEffect(() => {\n setSitePinsFailed(false)\n if (!listingId || !hosts?.length) return\n let active = true\n void Promise.all(\n hosts.map(async (host) => {\n const snapshot = await getDoc(\n doc(firestore, 'hosts', host.id, 'installs', listingId),\n )\n return [host.id, snapshot.exists() ? snapshot.data() : null] as const\n }),\n )\n .then((entries) => {\n if (!active) return\n setSitePins(Object.fromEntries(entries))\n setSitePinsFor(`${listingId}:${hostIdsKey}`)\n })\n .catch(() => {\n if (active) setSitePinsFailed(true)\n })\n return () => {\n active = false\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [firestore, listingId, hostIdsKey, pinsNonce])\n\n // The listing, for the version actually on offer (AGL-1017). This used to\n // pass a PIN's own version as `latestVersion`, which is by definition the\n // version that pin is already at — so no site ever looked stale and the\n // update control never appeared on this page at all.\n const { data: listing } = useFirestoreDoc<any>(\n () => doc(firestore, 'marketplaceListings', listingId || '-missing-'),\n [firestore, listingId],\n )\n\n // The kill switch (AGL-2368). This panel offers an UPDATE, so it is asking\n // \"what installs today\" and had only the review-verdict mirror to ask —\n // which nothing cleared on revoke, so it offered a version the install\n // route refuses. Listing-scoped and public, one read for the panel.\n const { data: revocation } = useFirestoreDoc<any>(\n () =>\n listingId ? doc(firestore, 'revocations', listingId) : null,\n [firestore, listingId],\n )\n\n const orgInstall = useMemo(\n () =>\n resolveOrgInstallSummary(hosts ?? [], sitePins, orgPin ?? null, listingId),\n [hosts, sitePins, orgPin, listingId],\n )\n // The listing doc the actions need. The pin carries the denormalised copy\n // the actions actually read (`$id`, `displayName`, `pluginId`), so this page\n // does not pay for a second read of the listing itself. `pluginId` is what\n // the uninstall dialog scans published pages by; without it the impact is\n // unknown and every uninstall asks for the typed acknowledgement.\n const anyPin = orgPin ?? Object.values(sitePins).find(Boolean) ?? null\n const actionListing = useMemo(\n () => ({\n $id: listingId,\n displayName: listing?.displayName ?? anyPin?.displayName ?? listingId,\n artifactType: 'plugin',\n latestVersion: listing?.latestVersion ?? anyPin?.version,\n pluginId: listing?.pluginId ?? anyPin?.pluginId,\n }),\n [\n listingId,\n listing?.displayName,\n listing?.latestVersion,\n listing?.pluginId,\n anyPin?.displayName,\n anyPin?.version,\n anyPin?.pluginId,\n ],\n )\n\n /*\n * Loading is said as loading (AGL-4047). \"Not installed\" rests on no pin\n * anywhere, and a pin the server has not answered for yet is not absent:\n * this page said \"Not installed on any site\" for seconds about a plugin\n * running org-wide.\n */\n const readPhase = installPictureReadPhase({\n orgPin: !listingId\n ? null\n : orgId\n ? orgPinRead\n : props.orgId || !hostOrg.loaded\n ? 'pending'\n : null,\n sitePins: sitePinsFailed\n ? 'failed'\n : !hostsReady\n ? 'loading'\n : !hosts?.length || sitePinsFor === `${listingId}:${hostIdsKey}`\n ? 'answered'\n : 'loading',\n })\n if (readPhase === 'loading') {\n return (\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <CircularProgress size={16} />\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Loading where it is installed…'}\n </Typography>\n </Stack>\n )\n }\n if (readPhase === 'error') {\n return (\n <Alert severity=\"warning\">\n {'Could not load where this plugin is installed. Reload the page to ' +\n 'try again.'}\n </Alert>\n )\n }\n\n if (!orgInstall.installedAnywhere) {\n return (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Not installed on any site in this organization.'}\n </Typography>\n )\n }\n\n return (\n <PluginSiteSet\n listing={actionListing}\n hosts={hosts ?? []}\n orgInstall={orgInstall}\n // The newest INSTALLABLE version (AGL-1016/2368) — never `latestVersion`,\n // and never the review verdict alone, or the page offers an update the\n // install route refuses.\n latestVersion={offeredPluginVersion(listing, revocation) ?? undefined}\n installPlan={installPlan}\n uninstall={uninstall}\n onChanged={() => setPinsNonce((current) => current + 1)}\n />\n )\n}\n\nPluginSiteSetPanel.displayName = 'PluginSiteSetPanel'\n\nexport default PluginSiteSetPanel\n"],"names":["Alert","CircularProgress","Stack","Typography","doc","getDoc","useEffect","useMemo","useState","useFirestore","useFirestoreDoc","useHostOrgIdState","offeredPluginVersion","installPictureReadPhase","resolveOrgInstallSummary","useMarketplaceActions","PluginSiteSet","PluginSiteSetPanel","props","orgPin","hostId","listingId","hosts","hostsReady","firestore","hostOrg","orgId","undefined","installPlan","uninstall","orgPinRead","data","sitePins","setSitePins","pinsNonce","setPinsNonce","hostIdsKey","map","host","id","join","sitePinsFor","setSitePinsFor","sitePinsFailed","setSitePinsFailed","length","active","Promise","all","snapshot","exists","then","entries","Object","fromEntries","catch","listing","revocation","orgInstall","anyPin","values","find","Boolean","actionListing","$id","displayName","artifactType","latestVersion","version","pluginId","readPhase","loaded","direction","spacing","sx","alignItems","size","variant","color","severity","installedAnywhere","onChanged","current"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,KAAK,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AAC1E,SAASC,GAAG,EAAEC,MAAM,QAAQ,qBAAoB;AAChD,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SACEC,YAAY,EACZC,eAAe,EACfC,iBAAiB,QACZ,iCAAgC;AACvC,SAASC,oBAAoB,QAAQ,eAAc;AACnD,SACEC,uBAAuB,EACvBC,wBAAwB,QAEnB,0BAAsB;AAC7B,SAASC,qBAAqB,QAAQ,sCAAkC;AACxE,OAAOC,mBAAmB,iCAA6B;AAyBvD;;;;;;;;;CASC,GACD,OAAO,SAASC,mBAAmBC,KAA8B;QA+EhDC,MA6EIP;IA3JnB,MAAM,EAAEQ,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,aAAa,IAAI,EAAE,GAAGL;IACxD,MAAMM,YAAYf;IAClB,MAAMgB,UAAUd,kBAAkBO,MAAMQ,KAAK,GAAGC,YAAYP;IAC5D,MAAMM,QAAQR,MAAMQ,KAAK,IAAID,QAAQC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wBAAwB;QACxCM,QAAQ,CAACE,YACL,OACAK,QACEI,aACAZ,MAAMQ,KAAK,IAAI,CAACD,QAAQ8C,MAAM,GAC5B,YACA;QACRvC,UAAUW,iBACN,WACA,CAACpB,aACC,YACA,EAACD,yBAAAA,MAAOuB,MAAM,KAAIJ,gBAAgB,GAAGpB,UAAU,CAAC,EAAEe,YAAY,GAC5D,aACA;IACV;IACA,IAAIkC,cAAc,WAAW;QAC3B,qBACE,MAACpE;YAAMsE,WAAU;YAAMC,SAAS;YAAGC,IAAI;gBAAEC,YAAY;YAAS;;8BAC5D,KAAC1E;oBAAiB2E,MAAM;;8BACxB,KAACzE;oBAAW0E,SAAQ;oBAAQC,OAAM;8BAC/B;;;;IAIT;IACA,IAAIR,cAAc,SAAS;QACzB,qBACE,KAACtE;YAAM+E,UAAS;sBACb,uEACC;;IAGR;IAEA,IAAI,CAACrB,WAAWsB,iBAAiB,EAAE;QACjC,qBACE,KAAC7E;YAAW0E,SAAQ;YAAQC,OAAM;sBAC/B;;IAGP;IAEA,qBACE,KAAC9D;QACCwC,SAASO;QACTzC,KAAK,EAAEA,gBAAAA,QAAS,EAAE;QAClBoC,YAAYA;QACZ,0EAA0E;QAC1E,uEAAuE;QACvE,yBAAyB;QACzBS,aAAa,GAAEvD,wBAAAA,qBAAqB4C,SAASC,uBAA9B7C,wBAA6Ce;QAC5DC,aAAaA;QACbC,WAAWA;QACXoD,WAAW,IAAM9C,aAAa,CAAC+C,UAAYA,UAAU;;AAG3D;AAEAjE,mBAAmBgD,WAAW,GAAG;AAEjC,eAAehD,mBAAkB"}
|
|
@@ -18,6 +18,7 @@ import { buildRoute, Route } from "@aglyn/aglyn/app-utils/console-routes";
|
|
|
18
18
|
import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
|
|
19
19
|
import { SITE_STARTER_MAX_SCREENS } from "@aglyn/aglyn/app-utils/site-starter";
|
|
20
20
|
import { siteStarterBuiltinThemeOf } from "@aglyn/aglyn/app-utils/site-starter-theme";
|
|
21
|
+
import { merchantPaymentsPlatformMode } from "@aglyn/tenant-feature-instance/hooks/merchant-payments-state";
|
|
21
22
|
import { useConsoleHostRoute, useFirestore, useFirestoreCollection, useFirestoreDoc, usePlanFeature, useUser } from "@aglyn/tenant-feature-instance";
|
|
22
23
|
import { collection, doc, documentId, query, where } from "firebase/firestore";
|
|
23
24
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -61,7 +62,8 @@ import { payoutsReady, starterPublishPages } from "../model/starter-publish.js";
|
|
|
61
62
|
// has nothing the answer could change, and nearly every publisher does.
|
|
62
63
|
const { data: user } = useUser();
|
|
63
64
|
const [sellsAsPlatform, setSellsAsPlatform] = useState(false);
|
|
64
|
-
const
|
|
65
|
+
const platformMode = merchantPaymentsPlatformMode();
|
|
66
|
+
const needsStanding = Boolean(profile.data && !payoutsReady(profile.data, platformMode));
|
|
65
67
|
useEffect(()=>{
|
|
66
68
|
if (!needsStanding || !orgId || !user) return;
|
|
67
69
|
let current = true;
|
|
@@ -87,6 +89,7 @@ import { payoutsReady, starterPublishPages } from "../model/starter-publish.js";
|
|
|
87
89
|
plan,
|
|
88
90
|
profile: profile.status === 'success' ? (_profile_data = profile.data) != null ? _profile_data : null : undefined,
|
|
89
91
|
sellsAsPlatform,
|
|
92
|
+
platformMode,
|
|
90
93
|
pages: pagesReady ? starterPublishPages(routing, screens.data) : null,
|
|
91
94
|
marketplacePath: route.orgSlug ? orgMarketplacePath(route.orgSlug) : null,
|
|
92
95
|
pagesPath: route.orgSlug && route.subdomain ? buildRoute(Route.HOST_SCREENS, {
|
|
@@ -102,6 +105,7 @@ import { payoutsReady, starterPublishPages } from "../model/starter-publish.js";
|
|
|
102
105
|
profile.status,
|
|
103
106
|
profile.data,
|
|
104
107
|
sellsAsPlatform,
|
|
108
|
+
platformMode,
|
|
105
109
|
pagesReady,
|
|
106
110
|
routing,
|
|
107
111
|
screens.data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/hooks/use-starter-publish-facts.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'use client'\n\nimport { buildRoute, Route } from '@aglyn/aglyn/app-utils/console-routes'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { SITE_STARTER_MAX_SCREENS } from '@aglyn/aglyn/app-utils/site-starter'\nimport {\n siteStarterBuiltinThemeOf,\n type SiteStarterBuiltinReading,\n} from '@aglyn/aglyn/app-utils/site-starter-theme'\nimport {\n useConsoleHostRoute,\n useFirestore,\n useFirestoreCollection,\n useFirestoreDoc,\n usePlanFeature,\n useUser,\n} from '@aglyn/tenant-feature-instance'\nimport { collection, doc, documentId, query, where } from 'firebase/firestore'\nimport { useEffect, useMemo, useState } from 'react'\nimport { orgMarketplacePath } from '../model/marketplace-paths'\nimport {\n payoutsReady,\n starterPublishPages,\n type StarterPublishFacts,\n type StarterPublishScreen,\n} from '../model/starter-publish'\n\n/** Everything \"Publish as a starter\" reads before the click. */\nexport interface StarterPublishFactsState {\n /** The reads; the form adds the price it holds. */\n facts: Omit<StarterPublishFacts, 'priceUsd'>\n /** The site's built-in theme as a starter would carry it, or `null` when it wears none. */\n builtin: SiteStarterBuiltinReading | null\n /** The host document has arrived, so `builtin` is an answer rather than a wait. */\n hostReady: boolean\n}\n\n/**\n * What a starter publish of one site would capture and what stands in its\n * way (AGL-4049): the host (its theme and routing), the routed pages it\n * would take, the publishing org's profile, and its plan.\n *\n * The routed pages are read by id, at most one past the most a starter may\n * have, the same window the door walks: enough to count them and to say a\n * site is past the limit, never the whole screens collection.\n */\nexport function useStarterPublishFacts(input: {\n hostId: string | null | undefined\n orgId: string | null | undefined\n}): StarterPublishFactsState {\n const { hostId, orgId } = input\n const firestore = useFirestore()\n const host = useFirestoreDoc<Record<string, unknown>>(\n () => (hostId ? doc(firestore, 'hosts', hostId) : null),\n [firestore, hostId],\n )\n const routing = host.data?.['screens']\n const routedIds = useMemo(\n () =>\n routing && typeof routing === 'object' && !Array.isArray(routing)\n ? Object.keys(routing).slice(0, SITE_STARTER_MAX_SCREENS + 1)\n : [],\n [routing],\n )\n const routedKey = routedIds.join('|')\n const screens = useFirestoreCollection<StarterPublishScreen>(\n () =>\n hostId && routedIds.length\n ? query(collection(firestore, 'hosts', hostId, 'screens'), where(documentId(), 'in', routedIds))\n : null,\n // `routedKey` stands for the ids: a new array of the same ids is the same read.\n [firestore, hostId, routedKey],\n { idField: '$id' },\n )\n const profile = useFirestoreDoc<Record<string, unknown>>(\n () => (orgId ? doc(firestore, 'publisherProfiles', orgId) : null),\n [firestore, orgId],\n )\n const plan = usePlanFeature(hostId ?? undefined, 'marketplaceSelling')\n // Asked only of a profile with no payout account: a publisher that has one\n // has nothing the answer could change, and nearly every publisher does.\n const { data: user } = useUser()\n const [sellsAsPlatform, setSellsAsPlatform] = useState(false)\n const needsStanding = Boolean(profile.data && !payoutsReady(profile.data))\n useEffect(() => {\n if (!needsStanding || !orgId || !user) return\n let current = true\n authorizedFetch(user, `/api/marketplace/publisher-standing?orgId=${encodeURIComponent(orgId)}`)\n .then((response) => (response.ok ? response.json() : null))\n .then((answer: { sellsAsPlatform?: unknown } | null) => {\n if (current) setSellsAsPlatform(answer?.sellsAsPlatform === true)\n })\n // Not knowing leaves the payouts step up: the door has the last word.\n .catch(() => undefined)\n return () => {\n current = false\n }\n }, [needsStanding, orgId, user])\n const route = useConsoleHostRoute(hostId)\n\n const hostReady = host.status === 'success'\n const pagesReady =\n hostReady && (routedIds.length === 0 || screens.status === 'success')\n return useMemo(\n () => ({\n facts: {\n plan,\n profile:\n profile.status === 'success' ? (profile.data ?? null) : undefined,\n sellsAsPlatform,\n pages: pagesReady ? starterPublishPages(routing, screens.data) : null,\n marketplacePath: route.orgSlug ? orgMarketplacePath(route.orgSlug) : null,\n pagesPath:\n route.orgSlug && route.subdomain\n ? buildRoute(Route.HOST_SCREENS, { orgSlug: route.orgSlug, host: route.subdomain })\n : null,\n },\n builtin: hostReady ? siteStarterBuiltinThemeOf(host.data ?? null) : null,\n hostReady,\n }),\n [plan, profile.status, profile.data, sellsAsPlatform, pagesReady, routing, screens.data, route.orgSlug, route.subdomain, hostReady, host.data],\n )\n}\n\nexport default useStarterPublishFacts\n"],"names":["buildRoute","Route","authorizedFetch","SITE_STARTER_MAX_SCREENS","siteStarterBuiltinThemeOf","useConsoleHostRoute","useFirestore","useFirestoreCollection","useFirestoreDoc","usePlanFeature","useUser","collection","doc","documentId","query","where","useEffect","useMemo","useState","orgMarketplacePath","payoutsReady","starterPublishPages","useStarterPublishFacts","input","host","hostId","orgId","firestore","routing","data","routedIds","Array","isArray","Object","keys","slice","routedKey","join","screens","length","idField","profile","plan","undefined","user","sellsAsPlatform","setSellsAsPlatform","needsStanding","Boolean","current","encodeURIComponent","then","response","ok","json","answer","catch","route","hostReady","status","pagesReady","facts","pages","marketplacePath","orgSlug","pagesPath","subdomain","HOST_SCREENS","builtin"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;AAEA,SAASA,UAAU,EAAEC,KAAK,QAAQ,wCAAuC;AACzE,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,wBAAwB,QAAQ,sCAAqC;AAC9E,SACEC,yBAAyB,QAEpB,4CAA2C;AAClD,SACEC,mBAAmB,EACnBC,YAAY,EACZC,sBAAsB,EACtBC,eAAe,EACfC,cAAc,EACdC,OAAO,QACF,iCAAgC;AACvC,SAASC,UAAU,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,qBAAoB;AAC9E,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SAASC,kBAAkB,QAAQ,gCAA4B;AAC/D,SACEC,YAAY,EACZC,mBAAmB,QAGd,8BAA0B;AAYjC;;;;;;;;CAQC,GACD,OAAO,SAASC,uBAAuBC,KAGtC;QAOiBC;IANhB,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGH;IAC1B,MAAMI,YAAYrB;IAClB,MAAMkB,OAAOhB,gBACX,IAAOiB,SAASb,IAAIe,WAAW,SAASF,UAAU,MAClD;QAACE;QAAWF;KAAO;IAErB,MAAMG,WAAUJ,aAAAA,KAAKK,IAAI,qBAATL,UAAW,CAAC,UAAU;IACtC,MAAMM,YAAYb,QAChB,IACEW,WAAW,OAAOA,YAAY,YAAY,CAACG,MAAMC,OAAO,CAACJ,WACrDK,OAAOC,IAAI,CAACN,SAASO,KAAK,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/hooks/use-starter-publish-facts.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'use client'\n\nimport { buildRoute, Route } from '@aglyn/aglyn/app-utils/console-routes'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { SITE_STARTER_MAX_SCREENS } from '@aglyn/aglyn/app-utils/site-starter'\nimport {\n siteStarterBuiltinThemeOf,\n type SiteStarterBuiltinReading,\n} from '@aglyn/aglyn/app-utils/site-starter-theme'\nimport { merchantPaymentsPlatformMode } from '@aglyn/tenant-feature-instance/hooks/merchant-payments-state'\nimport {\n useConsoleHostRoute,\n useFirestore,\n useFirestoreCollection,\n useFirestoreDoc,\n usePlanFeature,\n useUser,\n} from '@aglyn/tenant-feature-instance'\nimport { collection, doc, documentId, query, where } from 'firebase/firestore'\nimport { useEffect, useMemo, useState } from 'react'\nimport { orgMarketplacePath } from '../model/marketplace-paths'\nimport {\n payoutsReady,\n starterPublishPages,\n type StarterPublishFacts,\n type StarterPublishScreen,\n} from '../model/starter-publish'\n\n/** Everything \"Publish as a starter\" reads before the click. */\nexport interface StarterPublishFactsState {\n /** The reads; the form adds the price it holds. */\n facts: Omit<StarterPublishFacts, 'priceUsd'>\n /** The site's built-in theme as a starter would carry it, or `null` when it wears none. */\n builtin: SiteStarterBuiltinReading | null\n /** The host document has arrived, so `builtin` is an answer rather than a wait. */\n hostReady: boolean\n}\n\n/**\n * What a starter publish of one site would capture and what stands in its\n * way (AGL-4049): the host (its theme and routing), the routed pages it\n * would take, the publishing org's profile, and its plan.\n *\n * The routed pages are read by id, at most one past the most a starter may\n * have, the same window the door walks: enough to count them and to say a\n * site is past the limit, never the whole screens collection.\n */\nexport function useStarterPublishFacts(input: {\n hostId: string | null | undefined\n orgId: string | null | undefined\n}): StarterPublishFactsState {\n const { hostId, orgId } = input\n const firestore = useFirestore()\n const host = useFirestoreDoc<Record<string, unknown>>(\n () => (hostId ? doc(firestore, 'hosts', hostId) : null),\n [firestore, hostId],\n )\n const routing = host.data?.['screens']\n const routedIds = useMemo(\n () =>\n routing && typeof routing === 'object' && !Array.isArray(routing)\n ? Object.keys(routing).slice(0, SITE_STARTER_MAX_SCREENS + 1)\n : [],\n [routing],\n )\n const routedKey = routedIds.join('|')\n const screens = useFirestoreCollection<StarterPublishScreen>(\n () =>\n hostId && routedIds.length\n ? query(collection(firestore, 'hosts', hostId, 'screens'), where(documentId(), 'in', routedIds))\n : null,\n // `routedKey` stands for the ids: a new array of the same ids is the same read.\n [firestore, hostId, routedKey],\n { idField: '$id' },\n )\n const profile = useFirestoreDoc<Record<string, unknown>>(\n () => (orgId ? doc(firestore, 'publisherProfiles', orgId) : null),\n [firestore, orgId],\n )\n const plan = usePlanFeature(hostId ?? undefined, 'marketplaceSelling')\n // Asked only of a profile with no payout account: a publisher that has one\n // has nothing the answer could change, and nearly every publisher does.\n const { data: user } = useUser()\n const [sellsAsPlatform, setSellsAsPlatform] = useState(false)\n const platformMode = merchantPaymentsPlatformMode()\n const needsStanding = Boolean(profile.data && !payoutsReady(profile.data, platformMode))\n useEffect(() => {\n if (!needsStanding || !orgId || !user) return\n let current = true\n authorizedFetch(user, `/api/marketplace/publisher-standing?orgId=${encodeURIComponent(orgId)}`)\n .then((response) => (response.ok ? response.json() : null))\n .then((answer: { sellsAsPlatform?: unknown } | null) => {\n if (current) setSellsAsPlatform(answer?.sellsAsPlatform === true)\n })\n // Not knowing leaves the payouts step up: the door has the last word.\n .catch(() => undefined)\n return () => {\n current = false\n }\n }, [needsStanding, orgId, user])\n const route = useConsoleHostRoute(hostId)\n\n const hostReady = host.status === 'success'\n const pagesReady =\n hostReady && (routedIds.length === 0 || screens.status === 'success')\n return useMemo(\n () => ({\n facts: {\n plan,\n profile:\n profile.status === 'success' ? (profile.data ?? null) : undefined,\n sellsAsPlatform,\n platformMode,\n pages: pagesReady ? starterPublishPages(routing, screens.data) : null,\n marketplacePath: route.orgSlug ? orgMarketplacePath(route.orgSlug) : null,\n pagesPath:\n route.orgSlug && route.subdomain\n ? buildRoute(Route.HOST_SCREENS, { orgSlug: route.orgSlug, host: route.subdomain })\n : null,\n },\n builtin: hostReady ? siteStarterBuiltinThemeOf(host.data ?? null) : null,\n hostReady,\n }),\n [plan, profile.status, profile.data, sellsAsPlatform, platformMode, pagesReady, routing, screens.data, route.orgSlug, route.subdomain, hostReady, host.data],\n )\n}\n\nexport default useStarterPublishFacts\n"],"names":["buildRoute","Route","authorizedFetch","SITE_STARTER_MAX_SCREENS","siteStarterBuiltinThemeOf","merchantPaymentsPlatformMode","useConsoleHostRoute","useFirestore","useFirestoreCollection","useFirestoreDoc","usePlanFeature","useUser","collection","doc","documentId","query","where","useEffect","useMemo","useState","orgMarketplacePath","payoutsReady","starterPublishPages","useStarterPublishFacts","input","host","hostId","orgId","firestore","routing","data","routedIds","Array","isArray","Object","keys","slice","routedKey","join","screens","length","idField","profile","plan","undefined","user","sellsAsPlatform","setSellsAsPlatform","platformMode","needsStanding","Boolean","current","encodeURIComponent","then","response","ok","json","answer","catch","route","hostReady","status","pagesReady","facts","pages","marketplacePath","orgSlug","pagesPath","subdomain","HOST_SCREENS","builtin"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;AAEA,SAASA,UAAU,EAAEC,KAAK,QAAQ,wCAAuC;AACzE,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,wBAAwB,QAAQ,sCAAqC;AAC9E,SACEC,yBAAyB,QAEpB,4CAA2C;AAClD,SAASC,4BAA4B,QAAQ,+DAA8D;AAC3G,SACEC,mBAAmB,EACnBC,YAAY,EACZC,sBAAsB,EACtBC,eAAe,EACfC,cAAc,EACdC,OAAO,QACF,iCAAgC;AACvC,SAASC,UAAU,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,qBAAoB;AAC9E,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SAASC,kBAAkB,QAAQ,gCAA4B;AAC/D,SACEC,YAAY,EACZC,mBAAmB,QAGd,8BAA0B;AAYjC;;;;;;;;CAQC,GACD,OAAO,SAASC,uBAAuBC,KAGtC;QAOiBC;IANhB,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGH;IAC1B,MAAMI,YAAYrB;IAClB,MAAMkB,OAAOhB,gBACX,IAAOiB,SAASb,IAAIe,WAAW,SAASF,UAAU,MAClD;QAACE;QAAWF;KAAO;IAErB,MAAMG,WAAUJ,aAAAA,KAAKK,IAAI,qBAATL,UAAW,CAAC,UAAU;IACtC,MAAMM,YAAYb,QACh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AMc,QAAQrD,oBAAoBoB;IAElC,MAAMkC,YAAYnC,KAAKoC,MAAM,KAAK;IAClC,MAAMC,aACJF,aAAc7B,CAAAA,UAAUS,MAAM,KAAK,KAAKD,QAAQsB,MAAM,KAAK,SAAQ;IACrE,OAAO3C,QACL;YAIsCwB,eAUWjB;eAd1C;YACLsC,OAAO;gBACLpB;gBACAD,SACEA,QAAQmB,MAAM,KAAK,aAAanB,gBAAAA,QAAQZ,IAAI,YAAZY,gBAAgB,OAAQE;gBAC1DE;gBACAE;gBACAgB,OAAOF,aAAaxC,oBAAoBO,SAASU,QAAQT,IAAI,IAAI;gBACjEmC,iBAAiBN,MAAMO,OAAO,GAAG9C,mBAAmBuC,MAAMO,OAAO,IAAI;gBACrEC,WACER,MAAMO,OAAO,IAAIP,MAAMS,SAAS,GAC5BpE,WAAWC,MAAMoE,YAAY,EAAE;oBAAEH,SAASP,MAAMO,OAAO;oBAAEzC,MAAMkC,MAAMS,SAAS;gBAAC,KAC/E;YACR;YACAE,SAASV,YAAYxD,2BAA0BqB,aAAAA,KAAKK,IAAI,YAATL,aAAa,QAAQ;YACpEmC;QACF;OACA;QAACjB;QAAMD,QAAQmB,MAAM;QAAEnB,QAAQZ,IAAI;QAAEgB;QAAiBE;QAAcc;QAAYjC;QAASU,QAAQT,IAAI;QAAE6B,MAAMO,OAAO;QAAEP,MAAMS,SAAS;QAAER;QAAWnC,KAAKK,IAAI;KAAC;AAEhK;AAEA,eAAeP,uBAAsB"}
|
|
@@ -237,6 +237,35 @@ export interface OrgInstallSummary {
|
|
|
237
237
|
* picture is the pins alone, as before.
|
|
238
238
|
*/
|
|
239
239
|
export declare function resolveOrgInstallSummary(hosts: ReadonlyArray<OrgInstallHost>, hostPins: Readonly<Record<string, InstallPin | null | undefined>>, orgPin: InstallPin | null | undefined, listingId?: string): OrgInstallSummary;
|
|
240
|
+
/** A pin's document read, as a live listen reports it. */
|
|
241
|
+
export interface InstallPinRead {
|
|
242
|
+
data?: unknown;
|
|
243
|
+
status?: string;
|
|
244
|
+
/** The answer came from the local cache and the server has not confirmed it. */
|
|
245
|
+
fromCache?: boolean;
|
|
246
|
+
}
|
|
247
|
+
/** Where the install picture of one listing stands: still loading, failed, or answered. */
|
|
248
|
+
export type InstallPictureReadPhase = 'loading' | 'error' | 'ready';
|
|
249
|
+
/**
|
|
250
|
+
* Whether a page may state where a plugin is installed yet (AGL-4047).
|
|
251
|
+
*
|
|
252
|
+
* "Not installed" and "Install" are verdicts, and both rest on ABSENCE: no
|
|
253
|
+
* org pin and no site pin. An absence read too early is not an answer. The
|
|
254
|
+
* cache answers "missing" first for a pin it has never held, and while
|
|
255
|
+
* another tab holds the shared cache that answer can stand for seconds, so a
|
|
256
|
+
* pin is missing only once the server says so, and the sites' pins only once
|
|
257
|
+
* every one of them has been read. Until then a page shows that it is
|
|
258
|
+
* loading, and a read that failed is said as a failure, never as "not
|
|
259
|
+
* installed".
|
|
260
|
+
*
|
|
261
|
+
* `orgPin` is `'pending'` while the org id is still resolving and `null` when
|
|
262
|
+
* there is no org to read a pin under. `sitePins` is the fan-in over the
|
|
263
|
+
* sites' own pins.
|
|
264
|
+
*/
|
|
265
|
+
export declare function installPictureReadPhase(input: {
|
|
266
|
+
orgPin: InstallPinRead | null | 'pending';
|
|
267
|
+
sitePins: 'loading' | 'failed' | 'answered';
|
|
268
|
+
}): InstallPictureReadPhase;
|
|
240
269
|
/** One site an uninstall would touch, and whether it really loses the plugin. */
|
|
241
270
|
export interface UninstallTarget {
|
|
242
271
|
hostId: string;
|
|
@@ -366,11 +395,21 @@ export declare function installPlanOutcome(input: {
|
|
|
366
395
|
tone: 'success' | 'warning' | 'error';
|
|
367
396
|
text: string;
|
|
368
397
|
};
|
|
369
|
-
/**
|
|
398
|
+
/**
|
|
399
|
+
* The row of the plugins list for one install: the version and where it runs.
|
|
400
|
+
*
|
|
401
|
+
* `switchedOff` (AGL-4047): the sites it covers whose own Admin › Plugins
|
|
402
|
+
* switch has it off. They keep the pin but run nothing, so the row does not
|
|
403
|
+
* call them sites it runs on, the way "Where it runs" and the listing say it.
|
|
404
|
+
* For an org-wide install that is any site of the workspace; for site pins,
|
|
405
|
+
* any pinned site. `siteCount` is how many sites the workspace has.
|
|
406
|
+
*/
|
|
370
407
|
export declare function installedPluginCaption(input: {
|
|
371
408
|
version?: unknown;
|
|
372
409
|
orgWide: boolean;
|
|
373
410
|
siteLabels: readonly string[];
|
|
411
|
+
switchedOff?: readonly string[];
|
|
412
|
+
siteCount?: number;
|
|
374
413
|
}): string;
|
|
375
414
|
interface ManifestConfigField {
|
|
376
415
|
key: string;
|
|
@@ -323,6 +323,31 @@
|
|
|
323
323
|
installedAnywhere: orgWide || hostPinnedIds.length > 0
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Whether a page may state where a plugin is installed yet (AGL-4047).
|
|
328
|
+
*
|
|
329
|
+
* "Not installed" and "Install" are verdicts, and both rest on ABSENCE: no
|
|
330
|
+
* org pin and no site pin. An absence read too early is not an answer. The
|
|
331
|
+
* cache answers "missing" first for a pin it has never held, and while
|
|
332
|
+
* another tab holds the shared cache that answer can stand for seconds, so a
|
|
333
|
+
* pin is missing only once the server says so, and the sites' pins only once
|
|
334
|
+
* every one of them has been read. Until then a page shows that it is
|
|
335
|
+
* loading, and a read that failed is said as a failure, never as "not
|
|
336
|
+
* installed".
|
|
337
|
+
*
|
|
338
|
+
* `orgPin` is `'pending'` while the org id is still resolving and `null` when
|
|
339
|
+
* there is no org to read a pin under. `sitePins` is the fan-in over the
|
|
340
|
+
* sites' own pins.
|
|
341
|
+
*/ export function installPictureReadPhase(input) {
|
|
342
|
+
const { orgPin, sitePins } = input;
|
|
343
|
+
if (orgPin === 'pending') return 'loading';
|
|
344
|
+
if (orgPin && !orgPin.data) {
|
|
345
|
+
if (orgPin.status === 'error') return 'error';
|
|
346
|
+
if (orgPin.status === 'loading' || orgPin.fromCache === true) return 'loading';
|
|
347
|
+
}
|
|
348
|
+
if (sitePins === 'failed') return 'error';
|
|
349
|
+
return sitePins === 'loading' ? 'loading' : 'ready';
|
|
350
|
+
}
|
|
326
351
|
/**
|
|
327
352
|
* Which sites an uninstall actually affects (AGL-1027).
|
|
328
353
|
*
|
|
@@ -481,8 +506,27 @@ const PLACEMENT_NOUNS = {
|
|
|
481
506
|
text: (_errors_ = errors[0]) != null ? _errors_ : 'Install failed'
|
|
482
507
|
};
|
|
483
508
|
}
|
|
484
|
-
/**
|
|
485
|
-
|
|
509
|
+
/**
|
|
510
|
+
* The row of the plugins list for one install: the version and where it runs.
|
|
511
|
+
*
|
|
512
|
+
* `switchedOff` (AGL-4047): the sites it covers whose own Admin › Plugins
|
|
513
|
+
* switch has it off. They keep the pin but run nothing, so the row does not
|
|
514
|
+
* call them sites it runs on, the way "Where it runs" and the listing say it.
|
|
515
|
+
* For an org-wide install that is any site of the workspace; for site pins,
|
|
516
|
+
* any pinned site. `siteCount` is how many sites the workspace has.
|
|
517
|
+
*/ export function installedPluginCaption(input) {
|
|
518
|
+
var _input_switchedOff;
|
|
519
|
+
const off = (_input_switchedOff = input.switchedOff) != null ? _input_switchedOff : [];
|
|
520
|
+
const offNamed = off.length === 1 ? off[0] : `${off.length} of them`;
|
|
521
|
+
let where;
|
|
522
|
+
if (input.orgWide) {
|
|
523
|
+
where = !off.length ? 'every site in this organization' : input.siteCount != null && off.length >= input.siteCount ? 'every site switched it off' : off.length === 1 ? `every site except ${off[0]}, which switched it off` : `every site except ${off.length} that switched it off`;
|
|
524
|
+
} else if (input.siteLabels.length === 1) {
|
|
525
|
+
where = off.length ? `${input.siteLabels[0]}, which switched it off` : input.siteLabels[0];
|
|
526
|
+
} else {
|
|
527
|
+
where = `${input.siteLabels.length} sites` + (off.length ? ` · ${offNamed} switched it off` : '');
|
|
528
|
+
}
|
|
529
|
+
return `v${input.version} · ${where}`;
|
|
486
530
|
}
|
|
487
531
|
// ─── A marketplace plugin's settings, from its manifest (AGL-428, AGL-3671) ───
|
|
488
532
|
const MANIFEST_CONFIG_FIELD_LIMIT = 50;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/model/marketplace-catalog.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 type { InstallableArtifactType as MarketplaceArtifactType } from '@aglyn/aglyn/app-utils/artifact-provenance'\n\n/**\n * The marketplace's catalog vocabulary, pure (AGL-3668): what each artifact\n * type is called, where each installs, the categories, a plugin's install\n * state from its two pins, and which route installs a type and what its\n * install says. The native apps generate from it; `marketplace.ts` and the\n * install hook re-export and use it.\n */\n\n/**\n * Human-readable label for each artifact type (AGL-864).\n *\n * Shared by browse cards, the listing detail page, and the seller panel so\n * \"what kind of thing is this\" reads the same everywhere. Resolve a listing's\n * label through {@link listingArtifactLabel}, which tolerates the legacy\n * `type`/`kind` shape the way {@link listingArtifactType} does.\n */\nexport const ARTIFACT_TYPE_LABELS: Record<MarketplaceArtifactType, string> = {\n plugin: 'Plugin',\n component: 'Component',\n template: 'Site template',\n layout: 'Layout',\n datasetSchema: 'Dataset schema',\n emailTemplate: 'Email template',\n emailStarter: 'Email starter',\n theme: 'Theme',\n siteStarter: 'Site starter',\n}\n\n/** Where an installed artifact lives. */\nexport type InstallTarget = 'org' | 'host'\n\n/**\n * Install targets each artifact type actually supports (AGL-656).\n *\n * This is not a policy choice — it is where the install routes physically\n * write. Only plugins have an org-scoped pin\n * (`orgs/{orgId}/installs/{listingId}`, applying to every site, shadowed by\n * a host pin). Components land in `hosts/{h}/components`, templates and\n * layouts in `hosts/{h}/templates`: all host-scoped by nature, because a\n * screen tree belongs to a site.\n *\n * Exported so the UI can ask rather than assume — an install picker that\n * offers \"this whole organization\" for a template would be lying.\n */\nexport const INSTALL_TARGETS: Record<\n MarketplaceArtifactType,\n readonly InstallTarget[]\n> = {\n plugin: ['org', 'host'],\n component: ['host'],\n template: ['host'],\n layout: ['host'],\n // Dataset schemas are org-shared data (AGL-237), so they install at org\n // scope — as a new empty dataset, not a pin (AGL-657).\n datasetSchema: ['org'],\n emailTemplate: ['host'],\n // A campaign email is a screen, and a screen belongs to a site.\n emailStarter: ['host'],\n // A theme is one site's visual identity, written to `hosts/{h}.theme`\n // (AGL-1020). Applying one org-wide would repaint every site at once from a\n // control that says \"install\".\n theme: ['host'],\n // A site starter installs by creating a site from it (AGL-4049), never\n // into an existing one.\n siteStarter: ['host'],\n}\n\n/** A plugin install pin — the version-pinned doc the install API writes. */\nexport interface InstallPin {\n version?: number | string\n}\n\n/**\n * The install state of a plugin listing for one site, told honestly (AGL-656).\n *\n * A plugin can be pinned at two scopes: the org pin\n * (`orgs/{orgId}/installs/{listingId}`) applies to every site, and a host pin\n * (`hosts/{hostId}/installs/{listingId}`) applies to just this one AND shadows\n * the org pin. Detecting installs from `hosts/{h}/components` — the COMPONENT\n * collection — never sees either pin, so an installed plugin used to read as\n * \"not installed\" on both the browse grid and the detail page. This resolves\n * the effective state from the two pins the way the loader does.\n */\nexport interface PluginInstallState {\n /** Effective pin scope for this site — host wins over org — or null. */\n scope: InstallTarget | null\n /** Version pinned at the effective scope, or null when not installed. */\n installedVersion: string | null\n /** Both pins exist: the host pin takes precedence, shadowing the org one. */\n shadowed: boolean\n /** Installed, but the pinned version is behind the listing's latest. */\n updateAvailable: boolean\n}\n\n/**\n * Resolves a plugin listing's install state for a site from its two pins\n * (AGL-656). The host pin shadows the org pin, mirroring the loader, so the\n * effective version and update prompt always describe what actually runs here.\n */\nexport function resolvePluginInstallState(\n latestVersion: number | string | undefined,\n hostPin: InstallPin | null | undefined,\n orgPin: InstallPin | null | undefined,\n): PluginInstallState {\n const effective = hostPin ?? orgPin ?? null\n const installedVersion =\n effective?.version != null ? String(effective.version) : null\n return {\n scope: hostPin ? 'host' : orgPin ? 'org' : null,\n installedVersion,\n shadowed: Boolean(hostPin && orgPin),\n // Any difference is an upgrade prompt, matching the installed-plugins card\n // — pins only ever move forward, so \"different\" means \"behind\".\n updateAvailable:\n installedVersion != null &&\n latestVersion != null &&\n String(latestVersion) !== installedVersion,\n }\n}\n\n/** Fixed category taxonomy for marketplace listings (AGL-430). */\nexport const LISTING_CATEGORIES: readonly string[] = [\n 'analytics',\n 'automation',\n 'commerce',\n 'communication',\n 'content',\n 'design',\n 'forms',\n 'integrations',\n 'marketing',\n 'productivity',\n 'seo',\n 'security',\n] as const\n\n/**\n * Each artifact type has its own installer route (AGL-672): routing\n * everything to the component one silently installed the wrong thing or\n * 404'd. `listingArtifactType` tolerates the legacy `type`/`kind`\n * discriminators (AGL-654).\n */\nexport function marketplaceInstallEndpoint(artifactType: string): string {\n switch (artifactType) {\n case 'template':\n return 'marketplace/install-template'\n case 'layout':\n return 'marketplace/install-layout'\n case 'plugin':\n return 'marketplace/install-plugin'\n case 'datasetSchema':\n return 'marketplace/install-dataset-schema'\n case 'emailTemplate':\n return 'marketplace/install-email-template'\n case 'emailStarter':\n return 'marketplace/install-email-starter'\n case 'theme':\n return 'marketplace/install-theme'\n default:\n return 'marketplace/install'\n }\n}\n\n/**\n * Artifact types whose install deliberately does NOT touch the running site\n * (AGL-669/671/657) — the copy must not imply otherwise. Templates and layouts\n * land in the Templates library; an email template lands as an inactive\n * version the owner still has to activate.\n */\nexport function marketplaceLandingMessage(\n artifactType: string,\n displayName: string,\n): string | null {\n switch (artifactType) {\n case 'template':\n case 'layout':\n return (\n `Saved \"${displayName}\" to your Templates — nothing is live until ` +\n 'you use it.'\n )\n case 'emailTemplate':\n return (\n `Saved \"${displayName}\" as a draft version — activate it in the ` +\n 'email designer to start sending it.'\n )\n case 'emailStarter':\n // A copy, and saying so is the point: the publisher cannot reach it\n // again, and nothing goes out until a campaign is sent from it.\n return (\n `Added \"${displayName}\" to your Email templates as your own copy — ` +\n 'edit it freely, nothing is sent until you send a campaign.'\n )\n case 'datasetSchema':\n return `Created \"${displayName}\" as a new, empty dataset.`\n case 'theme':\n // The one type that DOES change the running site on install, so it gets\n // the opposite of the reassurance the others get — plus the way back,\n // because a repainted site is alarming if you cannot see how to undo it.\n return (\n `Applied \"${displayName}\" to this site. Setup → Theme has a way back ` +\n 'to your previous theme.'\n )\n default:\n return null\n }\n}\n\n/**\n * ─── WHAT A PLUGIN'S PAGE SAYS ABOUT ITS INSTALLS (AGL-1016, AGL-997, AGL-1027, AGL-3671) ───\n *\n * The version comparison, the update status, the org-wide picture of one listing's pins, which sites an\n * uninstall touches and the sentences the workspace's plugin pages and their dialogs say about them. All of\n * it was spread across `update-state.ts`, `marketplace.ts` and the plugin-site-set components; it lives here,\n * pure, so the native apps replay the very same answers (`libs/native/contracts/function-cases.generated.json`).\n * Those modules re-export what moved.\n */\n\n/**\n * Orders two artifact versions, or returns null when they cannot be ordered.\n *\n * Two numbering schemes are in play and both are real: copied artifacts get a\n * monotonic integer from the publish route, plugins get the semver string off\n * their manifest. A single string compare handles neither (\"10\" < \"9\",\n * \"1.10.0\" < \"1.9.0\"), so both are parsed as dotted numbers — which covers the\n * integer case as a one-segment version.\n *\n * Anything non-numeric (a prerelease tag, a date-stamped build) is not ordered\n * by guesswork: unequal-and-incomparable is reported as such and surfaces as\n * `unknown`, which is honest, where a string compare would confidently point\n * an update button at an older build.\n */\nexport function compareArtifactVersions(\n a: string | number | null | undefined,\n b: string | number | null | undefined,\n): -1 | 0 | 1 | null {\n if (a == null || b == null || a === '' || b === '') return null\n const left = String(a)\n const right = String(b)\n if (left === right) return 0\n const parse = (value: string): number[] | null => {\n const parts = value.split('.')\n const numbers: number[] = []\n for (const part of parts) {\n if (!/^\\d+$/.test(part)) return null\n numbers.push(Number(part))\n }\n return numbers.length ? numbers : null\n }\n const leftParts = parse(left)\n const rightParts = parse(right)\n if (!leftParts || !rightParts) return null\n const length = Math.max(leftParts.length, rightParts.length)\n for (let index = 0; index < length; index += 1) {\n const leftPart = leftParts[index] ?? 0\n const rightPart = rightParts[index] ?? 0\n if (leftPart < rightPart) return -1\n if (leftPart > rightPart) return 1\n }\n // Equal numerically but not as strings — \"1.0\" and \"1.0.0\" are the same\n // version written two ways.\n return 0\n}\n\nexport type UpdateState =\n /** Running the newest version the publisher offers. */\n | 'current'\n /** A newer version exists and can be taken. */\n | 'update-available'\n /**\n * Installed version is NEWER than what is offered. Not a bug: a publisher\n * installs their own unapproved version to test it, and a version can be\n * withdrawn after someone installed it.\n */\n | 'ahead'\n /** Not enough is known to say — no provenance, or nothing published to compare. */\n | 'unknown'\n\nexport interface UpdateStatus {\n state: UpdateState\n /** The version running, or null when provenance cannot say. */\n installedVersion: string | null\n /** The newest version on offer — for plugins, the newest APPROVED one. */\n availableVersion: string | null\n /**\n * Why the answer is `unknown`, for a UI that should say which kind of\n * silence this is rather than implying the artifact is current.\n */\n unknownReason?: 'no-provenance' | 'nothing-published' | 'incomparable'\n}\n\n/**\n * One sentence describing an update state, so four surfaces do not each invent\n * their own wording for the same fact.\n */\nexport function updateStateLabel(status: UpdateStatus): string {\n switch (status.state) {\n case 'update-available':\n return `You have v${status.installedVersion} · v${status.availableVersion} available`\n case 'current':\n return `Up to date · v${status.installedVersion}`\n case 'ahead':\n return `You have v${status.installedVersion}, newer than the published v${status.availableVersion}`\n default:\n return status.unknownReason === 'nothing-published'\n ? 'No published version to compare against'\n : status.unknownReason === 'incomparable'\n ? `You have v${status.installedVersion}; v${status.availableVersion} cannot be ordered against it`\n : 'Installed before update tracking — version unknown'\n }\n}\n\n/** The pin fields an update comparison reads, in every shape the install routes have written. */\nexport interface UpdateComparablePin {\n version?: unknown\n installedFrom?: { listingId?: string; version?: unknown } | null\n marketplace?: { listingId?: string; version?: unknown } | null\n source?: { listingId?: string; version?: unknown } | null\n listingId?: string\n}\n\n/**\n * What a listing OFFERS right now (the plugin branch of `offeredPluginVersion`): the newest approved version, unless a\n * revocation (`versions` naming it, or `'all'`) has stopped it, in which case nothing is offered.\n */\nexport function pluginOfferedVersion(\n latestApprovedVersion: unknown,\n revocationVersions: readonly string[] | 'all' | null | undefined,\n): string | null {\n const offered = String(latestApprovedVersion ?? '')\n if (!offered) return null\n if (revocationVersions === 'all') return null\n return Array.isArray(revocationVersions) && revocationVersions.includes(offered) ? null : offered\n}\n\n/**\n * Whether the installed plugin is still what the publisher ships (the plugin branch of `resolveUpdateState`): the\n * pin's version against the version on offer. A pin that names no listing is the one shape that records no version\n * (`no-provenance`).\n */\nexport function pluginUpdateStatus(\n pin: UpdateComparablePin | null | undefined,\n offeredVersion: string | null | undefined,\n): UpdateStatus {\n const unknown: UpdateStatus = { state: 'unknown', installedVersion: null, availableVersion: null, unknownReason: 'no-provenance' }\n if (!pin) return unknown\n const recorded = pin.installedFrom?.listingId\n ? pin.installedFrom.version\n : pin.marketplace?.listingId\n ? pin.marketplace.version\n : pin.source?.listingId\n ? pin.source.version\n : pin.listingId\n ? pin.version\n : undefined\n const installedVersion = recorded == null || recorded === '' ? null : String(recorded)\n if (!installedVersion) return unknown\n if (offeredVersion == null || offeredVersion === '') {\n return { state: 'unknown', installedVersion, availableVersion: null, unknownReason: 'nothing-published' }\n }\n const availableVersion = String(offeredVersion)\n const order = compareArtifactVersions(installedVersion, availableVersion)\n if (order === null) return { state: 'unknown', installedVersion, availableVersion, unknownReason: 'incomparable' }\n return { state: order === 0 ? 'current' : order < 0 ? 'update-available' : 'ahead', installedVersion, availableVersion }\n}\n\n\n/** One site's slice of an org-scope install picture (AGL-997). */\nexport interface OrgInstallSite {\n hostId: string\n label: string\n /** The version that actually runs here, from the effective pin. */\n version: string | null\n /** Where that pin lives — a host pin shadows the org one, as the loader does. */\n pinnedBy: InstallTarget\n /** This site has its OWN pin on top of an org pin. */\n shadowed: boolean\n /**\n * Pinned here, but the site's own Admin › Plugins switch has it off (its\n * `disabledPlugins` holds the listing id, AGL-4047), so it does not run\n * here. Present only when true, and only when the caller handed over the\n * sites' lists and the listing id.\n */\n switchedOff?: true\n}\n\n/** A site as the install picture reads it: its id, its name, and the plugins it switched off. */\nexport interface OrgInstallHost {\n id: string\n label: string\n /** The site's own deny-list (`disabledPlugins`), when the caller has it. */\n disabledPlugins?: readonly string[] | null\n}\n\n/**\n * The whole org's install picture for one listing (AGL-997).\n *\n * At org scope, \"installed\" is a SET, not a boolean. The detail page used to\n * resolve state against the single acting host, so a plugin installed on one\n * of five sites reported \"Installed on this site\" — describing one arbitrary\n * site and staying silent about the other four — and offered an Uninstall\n * that was all-or-nothing.\n *\n * `orgWide` and per-site pins are not exclusive: an org pin covers every\n * site including ones created later, and a host pin on top of it shadows it\n * for that one site. Both facts have to survive into the UI, which is why\n * this returns the sites AND the pins rather than a single scope.\n */\nexport interface OrgInstallSummary {\n /** An org pin exists: every site is covered, including future ones. */\n orgWide: boolean\n /** Version of the org pin, when there is one. */\n orgVersion: string | null\n /** Every site the listing effectively runs on. */\n sites: OrgInstallSite[]\n /** Sites carrying their own removable host pin. */\n hostPinnedIds: string[]\n /** Sites with no pin of their own and no org pin covering them. */\n availableHostIds: string[]\n installedAnywhere: boolean\n}\n\n/**\n * `listingId` (AGL-4047): a pin is not the whole answer. A site whose own\n * switch has the listing off (`disabledPlugins`, written by its Admin ›\n * Plugins page or by an install that left it out) keeps its pin or its org\n * coverage but runs nothing, exactly as the realm join drops it. Given the id\n * and each site's list, such a site is marked `switchedOff`; without them the\n * picture is the pins alone, as before.\n */\nexport function resolveOrgInstallSummary(\n hosts: ReadonlyArray<OrgInstallHost>,\n hostPins: Readonly<Record<string, InstallPin | null | undefined>>,\n orgPin: InstallPin | null | undefined,\n listingId?: string,\n): OrgInstallSummary {\n const orgWide = Boolean(orgPin)\n const orgVersion = orgPin?.version != null ? String(orgPin.version) : null\n const sites: OrgInstallSite[] = []\n const hostPinnedIds: string[] = []\n const availableHostIds: string[] = []\n for (const host of hosts) {\n const hostPin = hostPins[host.id]\n if (hostPin) hostPinnedIds.push(host.id)\n if (!hostPin && !orgPin) {\n availableHostIds.push(host.id)\n continue\n }\n sites.push({\n hostId: host.id,\n label: host.label,\n version:\n hostPin?.version != null ? String(hostPin.version) : orgVersion,\n pinnedBy: hostPin ? 'host' : 'org',\n shadowed: Boolean(hostPin && orgPin),\n ...(listingId && host.disabledPlugins?.includes(listingId)\n ? { switchedOff: true as const }\n : {}),\n })\n }\n return {\n orgWide,\n orgVersion,\n sites,\n hostPinnedIds,\n availableHostIds,\n installedAnywhere: orgWide || hostPinnedIds.length > 0,\n }\n}\n\n/** One site an uninstall would touch, and whether it really loses the plugin. */\nexport interface UninstallTarget {\n hostId: string\n label: string\n /**\n * The plugin keeps running here. Removing a HOST pin while an org pin still\n * covers the site, or the ORG pin while the site holds its own host pin,\n * changes which pointer is in use and nothing a visitor can see.\n */\n stillCovered: boolean\n}\n\n/**\n * Which sites an uninstall actually affects (AGL-1027).\n *\n * The shadowing case is the whole reason this is a function rather than a\n * filter at the call site. A pin is not a boolean per site: an org pin covers\n * everything, a host pin names one site, and where both exist the host pin\n * wins. So \"remove\" means three different things depending on which pointer is\n * being dropped and what is left underneath — and the one thing the dialog must\n * never do is tell someone a plugin will stop working when it will not.\n *\n * Returns every site the operation touches, including the ones that keep the\n * plugin, so the dialog can say so explicitly instead of omitting them and\n * leaving the count unexplained.\n */\nexport function resolveUninstallTargets(\n orgInstall: OrgInstallSummary,\n scope: 'org' | 'host',\n hostId?: string,\n): UninstallTarget[] {\n if (scope === 'host') {\n const site = orgInstall.sites.find((entry) => entry.hostId === hostId)\n if (!site) return []\n // Its own pin goes; the org pin, if there is one, still covers it.\n return [\n { hostId: site.hostId, label: site.label, stillCovered: orgInstall.orgWide },\n ]\n }\n // Dropping the org pin: every site loses it EXCEPT those holding a host pin\n // of their own, which were already shadowing the org pin anyway.\n return orgInstall.sites.map((site) => ({\n hostId: site.hostId,\n label: site.label,\n stillCovered: site.pinnedBy === 'host',\n }))\n}\n\n// ─── The sentences of a plugin's install pages and their dialogs (AGL-1017, AGL-1027, AGL-3671) ───\n\n/** The sites of an org-wide picture whose running version is behind the one on offer. */\nexport function staleSites(sites: readonly OrgInstallSite[], latestVersion: string | number | null | undefined): OrgInstallSite[] {\n return sites.filter((site) => (compareArtifactVersions(site.version, latestVersion) ?? 0) < 0)\n}\n\n/** What \"Where it runs\" opens with: the whole organization, or how many of its sites. */\nexport function pluginSiteSetSummary(install: OrgInstallSummary, siteCount: number): string {\n // Sites whose own switch has it off (AGL-4047): pinned, but not running.\n const off = install.sites.filter((site) => site.switchedOff).map((site) => site.label)\n if (install.orgWide) {\n const head = `Installed for the whole organization (v${install.orgVersion})`\n if (!off.length) return `${head} — every site, including ones you add later.`\n return off.length === install.sites.length\n ? `${head}. Every site switched it off, so it runs only on sites you add later.`\n : `${head}. It runs on every site except ${namesList(off)}, which switched it off, and on sites you add later.`\n }\n const head = `Installed on ${install.sites.length} of ${siteCount} sites`\n if (!off.length) return `${head}.`\n const running = install.sites.length - off.length\n return `${head}. ${namesList(off)} switched it off, so it runs on ${running ? running : 'none of them'}.`\n}\n\n/** \"A\", \"A and B\", \"A, B and C\". */\nfunction namesList(names: readonly string[]): string {\n return names.length < 2 ? (names[0] ?? '') : `${names.slice(0, -1).join(', ')} and ${names[names.length - 1]}`\n}\n\n/** What the update confirmation says: the plugin, the version it moves to and where, and what stays put. */\nexport function pluginUpdatePrompt(input: {\n name: string\n latestVersion: string\n label: string\n /** The update is for one site: other sites stay on the version they run. */\n singleSite: boolean\n}): { title: string; body: string; others: string | null; note: string } {\n return {\n title: `Update to v${input.latestVersion}?`,\n body: `${input.name} moves from the version running now to v${input.latestVersion} on ${input.label}.`,\n others: input.singleSite ? 'Other sites stay on the version they are running.' : null,\n note: 'Pins only move forward — there is no going back to the previous version from here.',\n }\n}\n\n/** What the update button of a pin that is org-wide, or of the stale per-site ones, is called and aims at. */\nexport function pluginUpdateAll(install: OrgInstallSummary, stale: readonly OrgInstallSite[], latestVersion: string) {\n return {\n label: install.orgWide ? `Update to v${latestVersion}` : `Update all ${stale.length} to v${latestVersion}`,\n target: install.orgWide ? 'every site in this organization' : `${stale.length} site${stale.length === 1 ? '' : 's'}`,\n hostIds: install.orgWide ? null : stale.map((site) => site.hostId),\n }\n}\n\n/** The notice above an org-wide update: one pin moves every site at once. */\nexport const PLUGIN_ORG_WIDE_UPDATE_NOTE =\n 'This is one organization-wide pin, so updating moves every site at once. To take a version on one site first, install per site instead.'\n\n/** One site an uninstall dialog was told about by the impact check. */\nexport interface UninstallImpactSite {\n hostId: string\n label: string\n stillCovered: boolean\n placements: Array<{ type: 'screen' | 'layout' | 'component'; id: string; name: string; count: number }>\n affectedScreens: number\n truncated: boolean\n}\n\n/** What `/api/hosts/plugin-impact` answers. */\nexport interface UninstallImpact {\n sites: UninstallImpactSite[]\n losingSites: number\n placements: number\n affectedScreens: number\n truncated: boolean\n dataSurvives: boolean\n}\n\n/** The word typed to confirm an uninstall that breaks pages, or whose impact could not be checked. */\nexport const UNINSTALL_ACKNOWLEDGEMENT = 'UNINSTALL'\n\n/** What the uninstall dialog shows, worked out from the targets and the impact check's answer. */\nexport interface UninstallImpactView {\n title: string\n confirmLabel: string\n /** The check is still running. */\n scanning: boolean\n /** Alerts above the sites, in order. */\n alerts: Array<{ tone: 'warning' | 'error' | 'info'; text: string }>\n /** Sites that lose the plugin and place it on pages: the site, how many pages, and the chips. */\n sites: Array<{ label: string; pages: string; chips: string[] }>\n /** The closing note, when sites lose the plugin. */\n note: string | null\n /** Pages stop rendering it, or the check could not say: the person types {@link UNINSTALL_ACKNOWLEDGEMENT}. */\n needsAcknowledgement: boolean\n}\n\nconst PLACEMENT_NOUNS = { screen: 'page', layout: 'layout', component: 'component' } as const\n\n/** The uninstall dialog (`UninstallImpactDialog`) as data, so every client says the same things. */\nexport function uninstallImpactView(input: {\n name: string\n scope: 'org' | 'host'\n /** The listing's plugin id; without one the placements cannot be found. */\n pluginId: string\n targets: readonly UninstallTarget[]\n /** The impact check's answer, once it has come. */\n impact: UninstallImpact | null\n /** The impact check failed. */\n failed: boolean\n}): UninstallImpactView {\n const { name, scope, pluginId, targets, impact, failed } = input\n const losing = targets.filter((target) => !target.stillCovered)\n const covered = targets.filter((target) => target.stillCovered)\n const scanning = Boolean(pluginId) && losing.length > 0 && !impact && !failed\n const affected = impact?.affectedScreens ?? 0\n const unknown = failed || (!pluginId && losing.length > 0)\n const alerts: UninstallImpactView['alerts'] = []\n if (unknown && !scanning) {\n alerts.push({\n tone: 'warning',\n text: pluginId\n ? 'The impact check could not run, so this cannot say what would stop working. Nothing here means \"nothing breaks\".'\n : 'This listing records no plugin id, so its placements cannot be found. Pages using it may stop rendering it.',\n })\n }\n if (!scanning && !unknown && affected > 0) {\n const sites = impact?.losingSites ?? losing.length\n alerts.push({\n tone: 'error',\n text:\n `Removes ${name} from ${sites} site${sites === 1 ? '' : 's'}; ` +\n `${impact?.truncated ? 'at least ' : ''}${affected} published page${affected === 1 ? '' : 's'} ` +\n `place${affected === 1 ? 's' : ''} it and will stop rendering it.`,\n })\n }\n if (!scanning && !unknown && affected === 0 && losing.length) {\n alerts.push({ tone: 'info', text: 'No published page places this plugin, so nothing visitors can see changes.' })\n }\n if (covered.length) {\n alerts.push({\n tone: 'info',\n text:\n covered.length === targets.length\n ? `The plugin keeps running on ${covered.length === 1 ? 'this site' : `all ${covered.length} of these sites`}, ` +\n `because another install still covers ${covered.length === 1 ? 'it' : 'them'}. Only which version is in use changes.`\n : `${covered.length} of these sites keep the plugin — ${covered.map((target) => target.label).join(', ')} — ` +\n 'because another install still covers them.',\n })\n }\n const sites = (impact?.sites ?? [])\n .filter((site) => !site.stillCovered && site.placements.length)\n .map((site) => ({\n label: site.label,\n pages: `${site.affectedScreens} published page${site.affectedScreens === 1 ? '' : 's'} affected`,\n chips: [\n ...site.placements\n .slice(0, 12)\n .map((placement) => `${PLACEMENT_NOUNS[placement.type]}: ${placement.name}${placement.count > 1 ? ` ×${placement.count}` : ''}`),\n ...(site.placements.length > 12 ? [`+${site.placements.length - 12} more`] : []),\n ],\n }))\n return {\n title: scope === 'org' ? `Uninstall ${name} across the organization?` : `Remove ${name} from this site?`,\n confirmLabel: scope === 'org' ? 'Uninstall org-wide' : 'Remove',\n scanning,\n alerts,\n sites,\n note:\n !scanning && losing.length\n ? 'Uninstalling removes the install only. The plugin’s settings and any data it stored are kept, and installing it again restores the pages that place it.'\n : null,\n needsAcknowledgement: !scanning && (affected > 0 || unknown),\n }\n}\n\n/** What a run of installs (an install, an update, or the several steps of one) says once it is done. */\nexport function installPlanOutcome(input: {\n name: string\n /** Steps that went through, and the refusals of those that did not. */\n installed: number\n errors: readonly string[]\n /** One of the steps was the org-wide pin. */\n orgWide: boolean\n /** The steps moved existing pins to {@link version}. */\n updating: boolean\n version?: string | null\n /** The artifact lands in a library and is not live (a template, a layout): \"Saved\", not \"Installed\". */\n saved?: boolean\n /** Sites the org-wide pin left out, \"All sites except…\" (AGL-4047). */\n leftOut?: number\n}): { tone: 'success' | 'warning' | 'error'; text: string } {\n const { name, installed, errors, orgWide, updating, version, saved } = input\n const leftOut = input.leftOut ?? 0\n const noun = updating ? 'Updated' : saved ? 'Saved' : 'Installed'\n const toVersion = updating && version != null ? ` to v${version}` : ''\n if (installed && !errors.length) {\n return {\n tone: 'success',\n text: orgWide\n ? leftOut > 0\n ? `${noun} \"${name}\"${toVersion} for every site but ${leftOut === 1 ? 'the one' : `the ${leftOut}`} you left out, and for sites you add later`\n : `${noun} \"${name}\"${toVersion} for the whole organization`\n : `${noun} \"${name}\"${toVersion} on ${installed} site${installed === 1 ? '' : 's'}`,\n }\n }\n if (installed && errors.length) {\n return { tone: 'warning', text: `${noun} on ${installed} site(s); ${errors.length} failed — ${errors[0]}` }\n }\n return { tone: 'error', text: errors[0] ?? 'Install failed' }\n}\n\n/** The row of the plugins list for one install: the version and where it runs. */\nexport function installedPluginCaption(input: { version?: unknown; orgWide: boolean; siteLabels: readonly string[] }): string {\n return (\n `v${input.version} · ` +\n (input.orgWide ? 'every site in this organization' : input.siteLabels.length === 1 ? input.siteLabels[0] : `${input.siteLabels.length} sites`)\n )\n}\n\n// ─── A marketplace plugin's settings, from its manifest (AGL-428, AGL-3671) ───\n\nconst MANIFEST_CONFIG_FIELD_LIMIT = 50\nconst MANIFEST_CONFIG_FIELD_TYPES: ReadonlySet<string> = new Set(['string', 'number', 'boolean', 'select'])\n\ninterface ManifestConfigField {\n key: string\n label: string\n type: 'string' | 'number' | 'boolean' | 'select'\n description?: string\n options?: Array<{ value: string; label: string }>\n min?: number\n max?: number\n}\n\n/** A stored or declared value as its field takes it (`coerce` of `plugin-config.ts`), else [fallback]. */\nfunction coerceManifestConfigValue(field: ManifestConfigField, raw: unknown, fallback: unknown): unknown {\n switch (field.type) {\n case 'boolean':\n return typeof raw === 'boolean' ? raw : fallback\n case 'number': {\n const value = typeof raw === 'number' && Number.isFinite(raw) ? raw : NaN\n if (Number.isNaN(value)) return fallback\n if (field.min != null && value < field.min) return field.min\n if (field.max != null && value > field.max) return field.max\n return value\n }\n case 'select': {\n const value = typeof raw === 'string' ? raw : undefined\n return field.options?.some((option) => option.value === value) ? value : fallback\n }\n default:\n return typeof raw === 'string' ? raw : fallback\n }\n}\n\n/**\n * The fields a plugin's MANIFEST declares for its settings and the values they start from (`pluginConfigSchemaFromManifest`\n * of `plugin-config.ts`, which this repeats without its imports so the native apps replay it). Everything is re-validated\n * rather than trusted: a junk type drops the field, a duplicate key drops the second, a select with nothing to select is\n * dropped, and the count is capped. `null` when the manifest declares nothing usable, which means \"this plugin has no\n * settings\".\n */\nexport function manifestSettingsFields(manifest: unknown): { fields: ManifestConfigField[]; defaults: Record<string, unknown> } | null {\n const declared = (manifest as { config?: unknown } | null | undefined)?.config\n const rawFields = (declared as { fields?: unknown } | undefined)?.fields\n if (!Array.isArray(rawFields)) return null\n const seen = new Set<string>()\n const fields: ManifestConfigField[] = []\n for (const raw of rawFields) {\n if (fields.length >= MANIFEST_CONFIG_FIELD_LIMIT) break\n const entry = raw as Record<string, unknown> | null\n const key = typeof entry?.['key'] === 'string' ? entry['key'].trim() : ''\n if (!key || seen.has(key)) continue\n const type = String(entry?.['type'] ?? 'string')\n if (!MANIFEST_CONFIG_FIELD_TYPES.has(type)) continue\n const options = Array.isArray(entry?.['options'])\n ? (entry['options'] as unknown[])\n .map((option) => option as Record<string, unknown> | null)\n .filter((option) => typeof option?.['value'] === 'string' && typeof option?.['label'] === 'string')\n .map((option) => ({ value: String(option?.['value']), label: String(option?.['label']) }))\n : undefined\n if (type === 'select' && !options?.length) continue\n seen.add(key)\n fields.push({\n key,\n label: typeof entry?.['label'] === 'string' && entry['label'].trim() ? String(entry['label']).slice(0, 120) : key,\n type: type as ManifestConfigField['type'],\n description: typeof entry?.['description'] === 'string' ? String(entry['description']).slice(0, 400) : undefined,\n options,\n min: typeof entry?.['min'] === 'number' ? entry['min'] : undefined,\n max: typeof entry?.['max'] === 'number' ? entry['max'] : undefined,\n })\n }\n if (!fields.length) return null\n const rawDefaults = (declared as { defaults?: unknown } | undefined)?.defaults\n const defaults: Record<string, unknown> = {}\n for (const field of fields) {\n const supplied = rawDefaults && typeof rawDefaults === 'object' ? (rawDefaults as Record<string, unknown>)[field.key] : undefined\n const empty =\n field.type === 'boolean' ? false : field.type === 'number' ? (field.min ?? 0) : field.type === 'select' ? (field.options?.[0]?.value ?? '') : ''\n defaults[field.key] = coerceManifestConfigValue(field, supplied, empty)\n }\n return { fields, defaults }\n}\n\nconst MANIFEST_FIELD_KIND = { string: 'text', number: 'number', boolean: 'toggle', select: 'select' } as const\n\n/**\n * The workspace-settings screen of a marketplace plugin, as a native screen spec: the console's `PluginConfigCards` for a\n * pin's manifest. The same shape the generated screens of the built-in plugins have (`pluginSettingsScreen` of\n * `native-plugin-settings.mjs`), under an id of its own, saved to `orgs/{org}/pluginSettings/{plugin}` as the console\n * saves it. `null` for a plugin that declares no settings.\n */\nexport function manifestSettingsScreen(pluginId: string, label: string, manifest: unknown): Record<string, unknown> | null {\n const schema = pluginId ? manifestSettingsFields(manifest) : null\n if (!schema) return null\n const fields = schema.fields.map((field) => {\n const out: Record<string, unknown> = {\n key: field.key,\n label: field.label,\n kind: MANIFEST_FIELD_KIND[field.type],\n // `??` keeps a stored false or 0, which `|` would skip for the default.\n initial: `{item.${field.key} ?? const.defaults.${field.key}}`,\n }\n if (field.type === 'select') out['options'] = (field.options ?? []).map(({ value, label: text }) => ({ value, label: text }))\n const band = field.type === 'number' && (field.min != null || field.max != null) ? `Between ${field.min ?? 'any'} and ${field.max ?? 'any'}.` : ''\n const help = [field.description, band].filter(Boolean).join(' ')\n if (help) out['help'] = help\n return out\n })\n const written = Object.fromEntries(schema.fields.map((field) => [field.key, `{form.${field.key}}`]))\n return {\n id: `marketplace.pluginSettings.${pluginId}`,\n title: `${label} settings`,\n subtitle: `How ${label} behaves for this workspace`,\n icon: 'gearshape|settings',\n scope: 'org',\n requires: 'org.can[org.settings]',\n constants: { defaults: schema.defaults },\n load: { settings: { doc: `orgs/{org.id}/pluginSettings/${pluginId}`, optional: true } },\n blocks: [\n {\n type: 'form',\n id: 'settings',\n object: 'data.settings',\n footer: 'A site can override these on its own plugin page.',\n fields,\n submit: {\n label: 'Save settings',\n write: { doc: `orgs/{org.id}/pluginSettings/${pluginId}`, fields: { ...written, updatedBy: '{user.uid}' } },\n success: 'Settings saved',\n },\n },\n ],\n }\n}\n"],"names":["ARTIFACT_TYPE_LABELS","plugin","component","template","layout","datasetSchema","emailTemplate","emailStarter","theme","siteStarter","INSTALL_TARGETS","resolvePluginInstallState","latestVersion","hostPin","orgPin","effective","installedVersion","version","String","scope","shadowed","Boolean","updateAvailable","LISTING_CATEGORIES","marketplaceInstallEndpoint","artifactType","marketplaceLandingMessage","displayName","compareArtifactVersions","a","b","left","right","parse","value","parts","split","numbers","part","test","push","Number","length","leftParts","rightParts","Math","max","index","leftPart","rightPart","updateStateLabel","status","state","availableVersion","unknownReason","pluginOfferedVersion","latestApprovedVersion","revocationVersions","offered","Array","isArray","includes","pluginUpdateStatus","pin","offeredVersion","unknown","recorded","installedFrom","listingId","marketplace","source","undefined","order","resolveOrgInstallSummary","hosts","hostPins","orgWide","orgVersion","sites","hostPinnedIds","availableHostIds","host","id","hostId","label","pinnedBy","disabledPlugins","switchedOff","installedAnywhere","resolveUninstallTargets","orgInstall","site","find","entry","stillCovered","map","staleSites","filter","pluginSiteSetSummary","install","siteCount","off","head","namesList","running","names","slice","join","pluginUpdatePrompt","input","title","body","name","others","singleSite","note","pluginUpdateAll","stale","target","hostIds","PLUGIN_ORG_WIDE_UPDATE_NOTE","UNINSTALL_ACKNOWLEDGEMENT","PLACEMENT_NOUNS","screen","uninstallImpactView","pluginId","targets","impact","failed","losing","covered","scanning","affected","affectedScreens","alerts","tone","text","losingSites","truncated","placements","pages","chips","placement","type","count","confirmLabel","needsAcknowledgement","installPlanOutcome","errors","installed","updating","saved","leftOut","noun","toVersion","installedPluginCaption","siteLabels","MANIFEST_CONFIG_FIELD_LIMIT","MANIFEST_CONFIG_FIELD_TYPES","Set","coerceManifestConfigValue","field","raw","fallback","isFinite","NaN","isNaN","min","options","some","option","manifestSettingsFields","manifest","declared","config","rawFields","fields","seen","key","trim","has","add","description","rawDefaults","defaults","supplied","empty","MANIFEST_FIELD_KIND","string","number","boolean","select","manifestSettingsScreen","schema","out","kind","initial","band","help","written","Object","fromEntries","subtitle","icon","requires","constants","load","settings","doc","optional","blocks","object","footer","submit","write","updatedBy","success"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAID;;;;;;CAMC,GAED;;;;;;;CAOC,GACD,OAAO,MAAMA,uBAAgE;IAC3EC,QAAQ;IACRC,WAAW;IACXC,UAAU;IACVC,QAAQ;IACRC,eAAe;IACfC,eAAe;IACfC,cAAc;IACdC,OAAO;IACPC,aAAa;AACf,EAAC;AAKD;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,kBAGT;IACFT,QA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,EAAEjB,MAAMiB,GAAG,CAAC,CAAC,CAAC;SAAC;IAClG,OAAO;QACLhG,IAAI,CAAC,2BAA2B,EAAE2C,UAAU;QAC5Cf,OAAO,GAAG1B,MAAM,SAAS,CAAC;QAC1BsH,UAAU,CAAC,IAAI,EAAEtH,MAAM,2BAA2B,CAAC;QACnDuH,MAAM;QACNxL,OAAO;QACPyL,UAAU;QACVC,WAAW;YAAErB,UAAUS,OAAOT,QAAQ;QAAC;QACvCsB,MAAM;YAAEC,UAAU;gBAAEC,KAAK,CAAC,6BAA6B,EAAEnF,UAAU;gBAAEoF,UAAU;YAAK;QAAE;QACtFC,QAAQ;YACN;gBACEnE,MAAM;gBACN7D,IAAI;gBACJiI,QAAQ;gBACRC,QAAQ;gBACRpC;gBACAqC,QAAQ;oBACNjI,OAAO;oBACPkI,OAAO;wBAAEN,KAAK,CAAC,6BAA6B,EAAEnF,UAAU;wBAAEmD,QAAQ,aAAKuB;4BAASgB,WAAW;;oBAAe;oBAC1GC,SAAS;gBACX;YACF;SACD;IACH;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/model/marketplace-catalog.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 type { InstallableArtifactType as MarketplaceArtifactType } from '@aglyn/aglyn/app-utils/artifact-provenance'\n\n/**\n * The marketplace's catalog vocabulary, pure (AGL-3668): what each artifact\n * type is called, where each installs, the categories, a plugin's install\n * state from its two pins, and which route installs a type and what its\n * install says. The native apps generate from it; `marketplace.ts` and the\n * install hook re-export and use it.\n */\n\n/**\n * Human-readable label for each artifact type (AGL-864).\n *\n * Shared by browse cards, the listing detail page, and the seller panel so\n * \"what kind of thing is this\" reads the same everywhere. Resolve a listing's\n * label through {@link listingArtifactLabel}, which tolerates the legacy\n * `type`/`kind` shape the way {@link listingArtifactType} does.\n */\nexport const ARTIFACT_TYPE_LABELS: Record<MarketplaceArtifactType, string> = {\n plugin: 'Plugin',\n component: 'Component',\n template: 'Site template',\n layout: 'Layout',\n datasetSchema: 'Dataset schema',\n emailTemplate: 'Email template',\n emailStarter: 'Email starter',\n theme: 'Theme',\n siteStarter: 'Site starter',\n}\n\n/** Where an installed artifact lives. */\nexport type InstallTarget = 'org' | 'host'\n\n/**\n * Install targets each artifact type actually supports (AGL-656).\n *\n * This is not a policy choice — it is where the install routes physically\n * write. Only plugins have an org-scoped pin\n * (`orgs/{orgId}/installs/{listingId}`, applying to every site, shadowed by\n * a host pin). Components land in `hosts/{h}/components`, templates and\n * layouts in `hosts/{h}/templates`: all host-scoped by nature, because a\n * screen tree belongs to a site.\n *\n * Exported so the UI can ask rather than assume — an install picker that\n * offers \"this whole organization\" for a template would be lying.\n */\nexport const INSTALL_TARGETS: Record<\n MarketplaceArtifactType,\n readonly InstallTarget[]\n> = {\n plugin: ['org', 'host'],\n component: ['host'],\n template: ['host'],\n layout: ['host'],\n // Dataset schemas are org-shared data (AGL-237), so they install at org\n // scope — as a new empty dataset, not a pin (AGL-657).\n datasetSchema: ['org'],\n emailTemplate: ['host'],\n // A campaign email is a screen, and a screen belongs to a site.\n emailStarter: ['host'],\n // A theme is one site's visual identity, written to `hosts/{h}.theme`\n // (AGL-1020). Applying one org-wide would repaint every site at once from a\n // control that says \"install\".\n theme: ['host'],\n // A site starter installs by creating a site from it (AGL-4049), never\n // into an existing one.\n siteStarter: ['host'],\n}\n\n/** A plugin install pin — the version-pinned doc the install API writes. */\nexport interface InstallPin {\n version?: number | string\n}\n\n/**\n * The install state of a plugin listing for one site, told honestly (AGL-656).\n *\n * A plugin can be pinned at two scopes: the org pin\n * (`orgs/{orgId}/installs/{listingId}`) applies to every site, and a host pin\n * (`hosts/{hostId}/installs/{listingId}`) applies to just this one AND shadows\n * the org pin. Detecting installs from `hosts/{h}/components` — the COMPONENT\n * collection — never sees either pin, so an installed plugin used to read as\n * \"not installed\" on both the browse grid and the detail page. This resolves\n * the effective state from the two pins the way the loader does.\n */\nexport interface PluginInstallState {\n /** Effective pin scope for this site — host wins over org — or null. */\n scope: InstallTarget | null\n /** Version pinned at the effective scope, or null when not installed. */\n installedVersion: string | null\n /** Both pins exist: the host pin takes precedence, shadowing the org one. */\n shadowed: boolean\n /** Installed, but the pinned version is behind the listing's latest. */\n updateAvailable: boolean\n}\n\n/**\n * Resolves a plugin listing's install state for a site from its two pins\n * (AGL-656). The host pin shadows the org pin, mirroring the loader, so the\n * effective version and update prompt always describe what actually runs here.\n */\nexport function resolvePluginInstallState(\n latestVersion: number | string | undefined,\n hostPin: InstallPin | null | undefined,\n orgPin: InstallPin | null | undefined,\n): PluginInstallState {\n const effective = hostPin ?? orgPin ?? null\n const installedVersion =\n effective?.version != null ? String(effective.version) : null\n return {\n scope: hostPin ? 'host' : orgPin ? 'org' : null,\n installedVersion,\n shadowed: Boolean(hostPin && orgPin),\n // Any difference is an upgrade prompt, matching the installed-plugins card\n // — pins only ever move forward, so \"different\" means \"behind\".\n updateAvailable:\n installedVersion != null &&\n latestVersion != null &&\n String(latestVersion) !== installedVersion,\n }\n}\n\n/** Fixed category taxonomy for marketplace listings (AGL-430). */\nexport const LISTING_CATEGORIES: readonly string[] = [\n 'analytics',\n 'automation',\n 'commerce',\n 'communication',\n 'content',\n 'design',\n 'forms',\n 'integrations',\n 'marketing',\n 'productivity',\n 'seo',\n 'security',\n] as const\n\n/**\n * Each artifact type has its own installer route (AGL-672): routing\n * everything to the component one silently installed the wrong thing or\n * 404'd. `listingArtifactType` tolerates the legacy `type`/`kind`\n * discriminators (AGL-654).\n */\nexport function marketplaceInstallEndpoint(artifactType: string): string {\n switch (artifactType) {\n case 'template':\n return 'marketplace/install-template'\n case 'layout':\n return 'marketplace/install-layout'\n case 'plugin':\n return 'marketplace/install-plugin'\n case 'datasetSchema':\n return 'marketplace/install-dataset-schema'\n case 'emailTemplate':\n return 'marketplace/install-email-template'\n case 'emailStarter':\n return 'marketplace/install-email-starter'\n case 'theme':\n return 'marketplace/install-theme'\n default:\n return 'marketplace/install'\n }\n}\n\n/**\n * Artifact types whose install deliberately does NOT touch the running site\n * (AGL-669/671/657) — the copy must not imply otherwise. Templates and layouts\n * land in the Templates library; an email template lands as an inactive\n * version the owner still has to activate.\n */\nexport function marketplaceLandingMessage(\n artifactType: string,\n displayName: string,\n): string | null {\n switch (artifactType) {\n case 'template':\n case 'layout':\n return (\n `Saved \"${displayName}\" to your Templates — nothing is live until ` +\n 'you use it.'\n )\n case 'emailTemplate':\n return (\n `Saved \"${displayName}\" as a draft version — activate it in the ` +\n 'email designer to start sending it.'\n )\n case 'emailStarter':\n // A copy, and saying so is the point: the publisher cannot reach it\n // again, and nothing goes out until a campaign is sent from it.\n return (\n `Added \"${displayName}\" to your Email templates as your own copy — ` +\n 'edit it freely, nothing is sent until you send a campaign.'\n )\n case 'datasetSchema':\n return `Created \"${displayName}\" as a new, empty dataset.`\n case 'theme':\n // The one type that DOES change the running site on install, so it gets\n // the opposite of the reassurance the others get — plus the way back,\n // because a repainted site is alarming if you cannot see how to undo it.\n return (\n `Applied \"${displayName}\" to this site. Setup → Theme has a way back ` +\n 'to your previous theme.'\n )\n default:\n return null\n }\n}\n\n/**\n * ─── WHAT A PLUGIN'S PAGE SAYS ABOUT ITS INSTALLS (AGL-1016, AGL-997, AGL-1027, AGL-3671) ───\n *\n * The version comparison, the update status, the org-wide picture of one listing's pins, which sites an\n * uninstall touches and the sentences the workspace's plugin pages and their dialogs say about them. All of\n * it was spread across `update-state.ts`, `marketplace.ts` and the plugin-site-set components; it lives here,\n * pure, so the native apps replay the very same answers (`libs/native/contracts/function-cases.generated.json`).\n * Those modules re-export what moved.\n */\n\n/**\n * Orders two artifact versions, or returns null when they cannot be ordered.\n *\n * Two numbering schemes are in play and both are real: copied artifacts get a\n * monotonic integer from the publish route, plugins get the semver string off\n * their manifest. A single string compare handles neither (\"10\" < \"9\",\n * \"1.10.0\" < \"1.9.0\"), so both are parsed as dotted numbers — which covers the\n * integer case as a one-segment version.\n *\n * Anything non-numeric (a prerelease tag, a date-stamped build) is not ordered\n * by guesswork: unequal-and-incomparable is reported as such and surfaces as\n * `unknown`, which is honest, where a string compare would confidently point\n * an update button at an older build.\n */\nexport function compareArtifactVersions(\n a: string | number | null | undefined,\n b: string | number | null | undefined,\n): -1 | 0 | 1 | null {\n if (a == null || b == null || a === '' || b === '') return null\n const left = String(a)\n const right = String(b)\n if (left === right) return 0\n const parse = (value: string): number[] | null => {\n const parts = value.split('.')\n const numbers: number[] = []\n for (const part of parts) {\n if (!/^\\d+$/.test(part)) return null\n numbers.push(Number(part))\n }\n return numbers.length ? numbers : null\n }\n const leftParts = parse(left)\n const rightParts = parse(right)\n if (!leftParts || !rightParts) return null\n const length = Math.max(leftParts.length, rightParts.length)\n for (let index = 0; index < length; index += 1) {\n const leftPart = leftParts[index] ?? 0\n const rightPart = rightParts[index] ?? 0\n if (leftPart < rightPart) return -1\n if (leftPart > rightPart) return 1\n }\n // Equal numerically but not as strings — \"1.0\" and \"1.0.0\" are the same\n // version written two ways.\n return 0\n}\n\nexport type UpdateState =\n /** Running the newest version the publisher offers. */\n | 'current'\n /** A newer version exists and can be taken. */\n | 'update-available'\n /**\n * Installed version is NEWER than what is offered. Not a bug: a publisher\n * installs their own unapproved version to test it, and a version can be\n * withdrawn after someone installed it.\n */\n | 'ahead'\n /** Not enough is known to say — no provenance, or nothing published to compare. */\n | 'unknown'\n\nexport interface UpdateStatus {\n state: UpdateState\n /** The version running, or null when provenance cannot say. */\n installedVersion: string | null\n /** The newest version on offer — for plugins, the newest APPROVED one. */\n availableVersion: string | null\n /**\n * Why the answer is `unknown`, for a UI that should say which kind of\n * silence this is rather than implying the artifact is current.\n */\n unknownReason?: 'no-provenance' | 'nothing-published' | 'incomparable'\n}\n\n/**\n * One sentence describing an update state, so four surfaces do not each invent\n * their own wording for the same fact.\n */\nexport function updateStateLabel(status: UpdateStatus): string {\n switch (status.state) {\n case 'update-available':\n return `You have v${status.installedVersion} · v${status.availableVersion} available`\n case 'current':\n return `Up to date · v${status.installedVersion}`\n case 'ahead':\n return `You have v${status.installedVersion}, newer than the published v${status.availableVersion}`\n default:\n return status.unknownReason === 'nothing-published'\n ? 'No published version to compare against'\n : status.unknownReason === 'incomparable'\n ? `You have v${status.installedVersion}; v${status.availableVersion} cannot be ordered against it`\n : 'Installed before update tracking — version unknown'\n }\n}\n\n/** The pin fields an update comparison reads, in every shape the install routes have written. */\nexport interface UpdateComparablePin {\n version?: unknown\n installedFrom?: { listingId?: string; version?: unknown } | null\n marketplace?: { listingId?: string; version?: unknown } | null\n source?: { listingId?: string; version?: unknown } | null\n listingId?: string\n}\n\n/**\n * What a listing OFFERS right now (the plugin branch of `offeredPluginVersion`): the newest approved version, unless a\n * revocation (`versions` naming it, or `'all'`) has stopped it, in which case nothing is offered.\n */\nexport function pluginOfferedVersion(\n latestApprovedVersion: unknown,\n revocationVersions: readonly string[] | 'all' | null | undefined,\n): string | null {\n const offered = String(latestApprovedVersion ?? '')\n if (!offered) return null\n if (revocationVersions === 'all') return null\n return Array.isArray(revocationVersions) && revocationVersions.includes(offered) ? null : offered\n}\n\n/**\n * Whether the installed plugin is still what the publisher ships (the plugin branch of `resolveUpdateState`): the\n * pin's version against the version on offer. A pin that names no listing is the one shape that records no version\n * (`no-provenance`).\n */\nexport function pluginUpdateStatus(\n pin: UpdateComparablePin | null | undefined,\n offeredVersion: string | null | undefined,\n): UpdateStatus {\n const unknown: UpdateStatus = { state: 'unknown', installedVersion: null, availableVersion: null, unknownReason: 'no-provenance' }\n if (!pin) return unknown\n const recorded = pin.installedFrom?.listingId\n ? pin.installedFrom.version\n : pin.marketplace?.listingId\n ? pin.marketplace.version\n : pin.source?.listingId\n ? pin.source.version\n : pin.listingId\n ? pin.version\n : undefined\n const installedVersion = recorded == null || recorded === '' ? null : String(recorded)\n if (!installedVersion) return unknown\n if (offeredVersion == null || offeredVersion === '') {\n return { state: 'unknown', installedVersion, availableVersion: null, unknownReason: 'nothing-published' }\n }\n const availableVersion = String(offeredVersion)\n const order = compareArtifactVersions(installedVersion, availableVersion)\n if (order === null) return { state: 'unknown', installedVersion, availableVersion, unknownReason: 'incomparable' }\n return { state: order === 0 ? 'current' : order < 0 ? 'update-available' : 'ahead', installedVersion, availableVersion }\n}\n\n\n/** One site's slice of an org-scope install picture (AGL-997). */\nexport interface OrgInstallSite {\n hostId: string\n label: string\n /** The version that actually runs here, from the effective pin. */\n version: string | null\n /** Where that pin lives — a host pin shadows the org one, as the loader does. */\n pinnedBy: InstallTarget\n /** This site has its OWN pin on top of an org pin. */\n shadowed: boolean\n /**\n * Pinned here, but the site's own Admin › Plugins switch has it off (its\n * `disabledPlugins` holds the listing id, AGL-4047), so it does not run\n * here. Present only when true, and only when the caller handed over the\n * sites' lists and the listing id.\n */\n switchedOff?: true\n}\n\n/** A site as the install picture reads it: its id, its name, and the plugins it switched off. */\nexport interface OrgInstallHost {\n id: string\n label: string\n /** The site's own deny-list (`disabledPlugins`), when the caller has it. */\n disabledPlugins?: readonly string[] | null\n}\n\n/**\n * The whole org's install picture for one listing (AGL-997).\n *\n * At org scope, \"installed\" is a SET, not a boolean. The detail page used to\n * resolve state against the single acting host, so a plugin installed on one\n * of five sites reported \"Installed on this site\" — describing one arbitrary\n * site and staying silent about the other four — and offered an Uninstall\n * that was all-or-nothing.\n *\n * `orgWide` and per-site pins are not exclusive: an org pin covers every\n * site including ones created later, and a host pin on top of it shadows it\n * for that one site. Both facts have to survive into the UI, which is why\n * this returns the sites AND the pins rather than a single scope.\n */\nexport interface OrgInstallSummary {\n /** An org pin exists: every site is covered, including future ones. */\n orgWide: boolean\n /** Version of the org pin, when there is one. */\n orgVersion: string | null\n /** Every site the listing effectively runs on. */\n sites: OrgInstallSite[]\n /** Sites carrying their own removable host pin. */\n hostPinnedIds: string[]\n /** Sites with no pin of their own and no org pin covering them. */\n availableHostIds: string[]\n installedAnywhere: boolean\n}\n\n/**\n * `listingId` (AGL-4047): a pin is not the whole answer. A site whose own\n * switch has the listing off (`disabledPlugins`, written by its Admin ›\n * Plugins page or by an install that left it out) keeps its pin or its org\n * coverage but runs nothing, exactly as the realm join drops it. Given the id\n * and each site's list, such a site is marked `switchedOff`; without them the\n * picture is the pins alone, as before.\n */\nexport function resolveOrgInstallSummary(\n hosts: ReadonlyArray<OrgInstallHost>,\n hostPins: Readonly<Record<string, InstallPin | null | undefined>>,\n orgPin: InstallPin | null | undefined,\n listingId?: string,\n): OrgInstallSummary {\n const orgWide = Boolean(orgPin)\n const orgVersion = orgPin?.version != null ? String(orgPin.version) : null\n const sites: OrgInstallSite[] = []\n const hostPinnedIds: string[] = []\n const availableHostIds: string[] = []\n for (const host of hosts) {\n const hostPin = hostPins[host.id]\n if (hostPin) hostPinnedIds.push(host.id)\n if (!hostPin && !orgPin) {\n availableHostIds.push(host.id)\n continue\n }\n sites.push({\n hostId: host.id,\n label: host.label,\n version:\n hostPin?.version != null ? String(hostPin.version) : orgVersion,\n pinnedBy: hostPin ? 'host' : 'org',\n shadowed: Boolean(hostPin && orgPin),\n ...(listingId && host.disabledPlugins?.includes(listingId)\n ? { switchedOff: true as const }\n : {}),\n })\n }\n return {\n orgWide,\n orgVersion,\n sites,\n hostPinnedIds,\n availableHostIds,\n installedAnywhere: orgWide || hostPinnedIds.length > 0,\n }\n}\n\n/** A pin's document read, as a live listen reports it. */\nexport interface InstallPinRead {\n data?: unknown\n status?: string\n /** The answer came from the local cache and the server has not confirmed it. */\n fromCache?: boolean\n}\n\n/** Where the install picture of one listing stands: still loading, failed, or answered. */\nexport type InstallPictureReadPhase = 'loading' | 'error' | 'ready'\n\n/**\n * Whether a page may state where a plugin is installed yet (AGL-4047).\n *\n * \"Not installed\" and \"Install\" are verdicts, and both rest on ABSENCE: no\n * org pin and no site pin. An absence read too early is not an answer. The\n * cache answers \"missing\" first for a pin it has never held, and while\n * another tab holds the shared cache that answer can stand for seconds, so a\n * pin is missing only once the server says so, and the sites' pins only once\n * every one of them has been read. Until then a page shows that it is\n * loading, and a read that failed is said as a failure, never as \"not\n * installed\".\n *\n * `orgPin` is `'pending'` while the org id is still resolving and `null` when\n * there is no org to read a pin under. `sitePins` is the fan-in over the\n * sites' own pins.\n */\nexport function installPictureReadPhase(input: {\n orgPin: InstallPinRead | null | 'pending'\n sitePins: 'loading' | 'failed' | 'answered'\n}): InstallPictureReadPhase {\n const { orgPin, sitePins } = input\n if (orgPin === 'pending') return 'loading'\n if (orgPin && !orgPin.data) {\n if (orgPin.status === 'error') return 'error'\n if (orgPin.status === 'loading' || orgPin.fromCache === true) return 'loading'\n }\n if (sitePins === 'failed') return 'error'\n return sitePins === 'loading' ? 'loading' : 'ready'\n}\n\n/** One site an uninstall would touch, and whether it really loses the plugin. */\nexport interface UninstallTarget {\n hostId: string\n label: string\n /**\n * The plugin keeps running here. Removing a HOST pin while an org pin still\n * covers the site, or the ORG pin while the site holds its own host pin,\n * changes which pointer is in use and nothing a visitor can see.\n */\n stillCovered: boolean\n}\n\n/**\n * Which sites an uninstall actually affects (AGL-1027).\n *\n * The shadowing case is the whole reason this is a function rather than a\n * filter at the call site. A pin is not a boolean per site: an org pin covers\n * everything, a host pin names one site, and where both exist the host pin\n * wins. So \"remove\" means three different things depending on which pointer is\n * being dropped and what is left underneath — and the one thing the dialog must\n * never do is tell someone a plugin will stop working when it will not.\n *\n * Returns every site the operation touches, including the ones that keep the\n * plugin, so the dialog can say so explicitly instead of omitting them and\n * leaving the count unexplained.\n */\nexport function resolveUninstallTargets(\n orgInstall: OrgInstallSummary,\n scope: 'org' | 'host',\n hostId?: string,\n): UninstallTarget[] {\n if (scope === 'host') {\n const site = orgInstall.sites.find((entry) => entry.hostId === hostId)\n if (!site) return []\n // Its own pin goes; the org pin, if there is one, still covers it.\n return [\n { hostId: site.hostId, label: site.label, stillCovered: orgInstall.orgWide },\n ]\n }\n // Dropping the org pin: every site loses it EXCEPT those holding a host pin\n // of their own, which were already shadowing the org pin anyway.\n return orgInstall.sites.map((site) => ({\n hostId: site.hostId,\n label: site.label,\n stillCovered: site.pinnedBy === 'host',\n }))\n}\n\n// ─── The sentences of a plugin's install pages and their dialogs (AGL-1017, AGL-1027, AGL-3671) ───\n\n/** The sites of an org-wide picture whose running version is behind the one on offer. */\nexport function staleSites(sites: readonly OrgInstallSite[], latestVersion: string | number | null | undefined): OrgInstallSite[] {\n return sites.filter((site) => (compareArtifactVersions(site.version, latestVersion) ?? 0) < 0)\n}\n\n/** What \"Where it runs\" opens with: the whole organization, or how many of its sites. */\nexport function pluginSiteSetSummary(install: OrgInstallSummary, siteCount: number): string {\n // Sites whose own switch has it off (AGL-4047): pinned, but not running.\n const off = install.sites.filter((site) => site.switchedOff).map((site) => site.label)\n if (install.orgWide) {\n const head = `Installed for the whole organization (v${install.orgVersion})`\n if (!off.length) return `${head} — every site, including ones you add later.`\n return off.length === install.sites.length\n ? `${head}. Every site switched it off, so it runs only on sites you add later.`\n : `${head}. It runs on every site except ${namesList(off)}, which switched it off, and on sites you add later.`\n }\n const head = `Installed on ${install.sites.length} of ${siteCount} sites`\n if (!off.length) return `${head}.`\n const running = install.sites.length - off.length\n return `${head}. ${namesList(off)} switched it off, so it runs on ${running ? running : 'none of them'}.`\n}\n\n/** \"A\", \"A and B\", \"A, B and C\". */\nfunction namesList(names: readonly string[]): string {\n return names.length < 2 ? (names[0] ?? '') : `${names.slice(0, -1).join(', ')} and ${names[names.length - 1]}`\n}\n\n/** What the update confirmation says: the plugin, the version it moves to and where, and what stays put. */\nexport function pluginUpdatePrompt(input: {\n name: string\n latestVersion: string\n label: string\n /** The update is for one site: other sites stay on the version they run. */\n singleSite: boolean\n}): { title: string; body: string; others: string | null; note: string } {\n return {\n title: `Update to v${input.latestVersion}?`,\n body: `${input.name} moves from the version running now to v${input.latestVersion} on ${input.label}.`,\n others: input.singleSite ? 'Other sites stay on the version they are running.' : null,\n note: 'Pins only move forward — there is no going back to the previous version from here.',\n }\n}\n\n/** What the update button of a pin that is org-wide, or of the stale per-site ones, is called and aims at. */\nexport function pluginUpdateAll(install: OrgInstallSummary, stale: readonly OrgInstallSite[], latestVersion: string) {\n return {\n label: install.orgWide ? `Update to v${latestVersion}` : `Update all ${stale.length} to v${latestVersion}`,\n target: install.orgWide ? 'every site in this organization' : `${stale.length} site${stale.length === 1 ? '' : 's'}`,\n hostIds: install.orgWide ? null : stale.map((site) => site.hostId),\n }\n}\n\n/** The notice above an org-wide update: one pin moves every site at once. */\nexport const PLUGIN_ORG_WIDE_UPDATE_NOTE =\n 'This is one organization-wide pin, so updating moves every site at once. To take a version on one site first, install per site instead.'\n\n/** One site an uninstall dialog was told about by the impact check. */\nexport interface UninstallImpactSite {\n hostId: string\n label: string\n stillCovered: boolean\n placements: Array<{ type: 'screen' | 'layout' | 'component'; id: string; name: string; count: number }>\n affectedScreens: number\n truncated: boolean\n}\n\n/** What `/api/hosts/plugin-impact` answers. */\nexport interface UninstallImpact {\n sites: UninstallImpactSite[]\n losingSites: number\n placements: number\n affectedScreens: number\n truncated: boolean\n dataSurvives: boolean\n}\n\n/** The word typed to confirm an uninstall that breaks pages, or whose impact could not be checked. */\nexport const UNINSTALL_ACKNOWLEDGEMENT = 'UNINSTALL'\n\n/** What the uninstall dialog shows, worked out from the targets and the impact check's answer. */\nexport interface UninstallImpactView {\n title: string\n confirmLabel: string\n /** The check is still running. */\n scanning: boolean\n /** Alerts above the sites, in order. */\n alerts: Array<{ tone: 'warning' | 'error' | 'info'; text: string }>\n /** Sites that lose the plugin and place it on pages: the site, how many pages, and the chips. */\n sites: Array<{ label: string; pages: string; chips: string[] }>\n /** The closing note, when sites lose the plugin. */\n note: string | null\n /** Pages stop rendering it, or the check could not say: the person types {@link UNINSTALL_ACKNOWLEDGEMENT}. */\n needsAcknowledgement: boolean\n}\n\nconst PLACEMENT_NOUNS = { screen: 'page', layout: 'layout', component: 'component' } as const\n\n/** The uninstall dialog (`UninstallImpactDialog`) as data, so every client says the same things. */\nexport function uninstallImpactView(input: {\n name: string\n scope: 'org' | 'host'\n /** The listing's plugin id; without one the placements cannot be found. */\n pluginId: string\n targets: readonly UninstallTarget[]\n /** The impact check's answer, once it has come. */\n impact: UninstallImpact | null\n /** The impact check failed. */\n failed: boolean\n}): UninstallImpactView {\n const { name, scope, pluginId, targets, impact, failed } = input\n const losing = targets.filter((target) => !target.stillCovered)\n const covered = targets.filter((target) => target.stillCovered)\n const scanning = Boolean(pluginId) && losing.length > 0 && !impact && !failed\n const affected = impact?.affectedScreens ?? 0\n const unknown = failed || (!pluginId && losing.length > 0)\n const alerts: UninstallImpactView['alerts'] = []\n if (unknown && !scanning) {\n alerts.push({\n tone: 'warning',\n text: pluginId\n ? 'The impact check could not run, so this cannot say what would stop working. Nothing here means \"nothing breaks\".'\n : 'This listing records no plugin id, so its placements cannot be found. Pages using it may stop rendering it.',\n })\n }\n if (!scanning && !unknown && affected > 0) {\n const sites = impact?.losingSites ?? losing.length\n alerts.push({\n tone: 'error',\n text:\n `Removes ${name} from ${sites} site${sites === 1 ? '' : 's'}; ` +\n `${impact?.truncated ? 'at least ' : ''}${affected} published page${affected === 1 ? '' : 's'} ` +\n `place${affected === 1 ? 's' : ''} it and will stop rendering it.`,\n })\n }\n if (!scanning && !unknown && affected === 0 && losing.length) {\n alerts.push({ tone: 'info', text: 'No published page places this plugin, so nothing visitors can see changes.' })\n }\n if (covered.length) {\n alerts.push({\n tone: 'info',\n text:\n covered.length === targets.length\n ? `The plugin keeps running on ${covered.length === 1 ? 'this site' : `all ${covered.length} of these sites`}, ` +\n `because another install still covers ${covered.length === 1 ? 'it' : 'them'}. Only which version is in use changes.`\n : `${covered.length} of these sites keep the plugin — ${covered.map((target) => target.label).join(', ')} — ` +\n 'because another install still covers them.',\n })\n }\n const sites = (impact?.sites ?? [])\n .filter((site) => !site.stillCovered && site.placements.length)\n .map((site) => ({\n label: site.label,\n pages: `${site.affectedScreens} published page${site.affectedScreens === 1 ? '' : 's'} affected`,\n chips: [\n ...site.placements\n .slice(0, 12)\n .map((placement) => `${PLACEMENT_NOUNS[placement.type]}: ${placement.name}${placement.count > 1 ? ` ×${placement.count}` : ''}`),\n ...(site.placements.length > 12 ? [`+${site.placements.length - 12} more`] : []),\n ],\n }))\n return {\n title: scope === 'org' ? `Uninstall ${name} across the organization?` : `Remove ${name} from this site?`,\n confirmLabel: scope === 'org' ? 'Uninstall org-wide' : 'Remove',\n scanning,\n alerts,\n sites,\n note:\n !scanning && losing.length\n ? 'Uninstalling removes the install only. The plugin’s settings and any data it stored are kept, and installing it again restores the pages that place it.'\n : null,\n needsAcknowledgement: !scanning && (affected > 0 || unknown),\n }\n}\n\n/** What a run of installs (an install, an update, or the several steps of one) says once it is done. */\nexport function installPlanOutcome(input: {\n name: string\n /** Steps that went through, and the refusals of those that did not. */\n installed: number\n errors: readonly string[]\n /** One of the steps was the org-wide pin. */\n orgWide: boolean\n /** The steps moved existing pins to {@link version}. */\n updating: boolean\n version?: string | null\n /** The artifact lands in a library and is not live (a template, a layout): \"Saved\", not \"Installed\". */\n saved?: boolean\n /** Sites the org-wide pin left out, \"All sites except…\" (AGL-4047). */\n leftOut?: number\n}): { tone: 'success' | 'warning' | 'error'; text: string } {\n const { name, installed, errors, orgWide, updating, version, saved } = input\n const leftOut = input.leftOut ?? 0\n const noun = updating ? 'Updated' : saved ? 'Saved' : 'Installed'\n const toVersion = updating && version != null ? ` to v${version}` : ''\n if (installed && !errors.length) {\n return {\n tone: 'success',\n text: orgWide\n ? leftOut > 0\n ? `${noun} \"${name}\"${toVersion} for every site but ${leftOut === 1 ? 'the one' : `the ${leftOut}`} you left out, and for sites you add later`\n : `${noun} \"${name}\"${toVersion} for the whole organization`\n : `${noun} \"${name}\"${toVersion} on ${installed} site${installed === 1 ? '' : 's'}`,\n }\n }\n if (installed && errors.length) {\n return { tone: 'warning', text: `${noun} on ${installed} site(s); ${errors.length} failed — ${errors[0]}` }\n }\n return { tone: 'error', text: errors[0] ?? 'Install failed' }\n}\n\n/**\n * The row of the plugins list for one install: the version and where it runs.\n *\n * `switchedOff` (AGL-4047): the sites it covers whose own Admin › Plugins\n * switch has it off. They keep the pin but run nothing, so the row does not\n * call them sites it runs on, the way \"Where it runs\" and the listing say it.\n * For an org-wide install that is any site of the workspace; for site pins,\n * any pinned site. `siteCount` is how many sites the workspace has.\n */\nexport function installedPluginCaption(input: {\n version?: unknown\n orgWide: boolean\n siteLabels: readonly string[]\n switchedOff?: readonly string[]\n siteCount?: number\n}): string {\n const off = input.switchedOff ?? []\n const offNamed = off.length === 1 ? off[0] : `${off.length} of them`\n let where: string\n if (input.orgWide) {\n where = !off.length\n ? 'every site in this organization'\n : input.siteCount != null && off.length >= input.siteCount\n ? 'every site switched it off'\n : off.length === 1\n ? `every site except ${off[0]}, which switched it off`\n : `every site except ${off.length} that switched it off`\n } else if (input.siteLabels.length === 1) {\n where = off.length ? `${input.siteLabels[0]}, which switched it off` : input.siteLabels[0]\n } else {\n where = `${input.siteLabels.length} sites` + (off.length ? ` · ${offNamed} switched it off` : '')\n }\n return `v${input.version} · ${where}`\n}\n\n// ─── A marketplace plugin's settings, from its manifest (AGL-428, AGL-3671) ───\n\nconst MANIFEST_CONFIG_FIELD_LIMIT = 50\nconst MANIFEST_CONFIG_FIELD_TYPES: ReadonlySet<string> = new Set(['string', 'number', 'boolean', 'select'])\n\ninterface ManifestConfigField {\n key: string\n label: string\n type: 'string' | 'number' | 'boolean' | 'select'\n description?: string\n options?: Array<{ value: string; label: string }>\n min?: number\n max?: number\n}\n\n/** A stored or declared value as its field takes it (`coerce` of `plugin-config.ts`), else [fallback]. */\nfunction coerceManifestConfigValue(field: ManifestConfigField, raw: unknown, fallback: unknown): unknown {\n switch (field.type) {\n case 'boolean':\n return typeof raw === 'boolean' ? raw : fallback\n case 'number': {\n const value = typeof raw === 'number' && Number.isFinite(raw) ? raw : NaN\n if (Number.isNaN(value)) return fallback\n if (field.min != null && value < field.min) return field.min\n if (field.max != null && value > field.max) return field.max\n return value\n }\n case 'select': {\n const value = typeof raw === 'string' ? raw : undefined\n return field.options?.some((option) => option.value === value) ? value : fallback\n }\n default:\n return typeof raw === 'string' ? raw : fallback\n }\n}\n\n/**\n * The fields a plugin's MANIFEST declares for its settings and the values they start from (`pluginConfigSchemaFromManifest`\n * of `plugin-config.ts`, which this repeats without its imports so the native apps replay it). Everything is re-validated\n * rather than trusted: a junk type drops the field, a duplicate key drops the second, a select with nothing to select is\n * dropped, and the count is capped. `null` when the manifest declares nothing usable, which means \"this plugin has no\n * settings\".\n */\nexport function manifestSettingsFields(manifest: unknown): { fields: ManifestConfigField[]; defaults: Record<string, unknown> } | null {\n const declared = (manifest as { config?: unknown } | null | undefined)?.config\n const rawFields = (declared as { fields?: unknown } | undefined)?.fields\n if (!Array.isArray(rawFields)) return null\n const seen = new Set<string>()\n const fields: ManifestConfigField[] = []\n for (const raw of rawFields) {\n if (fields.length >= MANIFEST_CONFIG_FIELD_LIMIT) break\n const entry = raw as Record<string, unknown> | null\n const key = typeof entry?.['key'] === 'string' ? entry['key'].trim() : ''\n if (!key || seen.has(key)) continue\n const type = String(entry?.['type'] ?? 'string')\n if (!MANIFEST_CONFIG_FIELD_TYPES.has(type)) continue\n const options = Array.isArray(entry?.['options'])\n ? (entry['options'] as unknown[])\n .map((option) => option as Record<string, unknown> | null)\n .filter((option) => typeof option?.['value'] === 'string' && typeof option?.['label'] === 'string')\n .map((option) => ({ value: String(option?.['value']), label: String(option?.['label']) }))\n : undefined\n if (type === 'select' && !options?.length) continue\n seen.add(key)\n fields.push({\n key,\n label: typeof entry?.['label'] === 'string' && entry['label'].trim() ? String(entry['label']).slice(0, 120) : key,\n type: type as ManifestConfigField['type'],\n description: typeof entry?.['description'] === 'string' ? String(entry['description']).slice(0, 400) : undefined,\n options,\n min: typeof entry?.['min'] === 'number' ? entry['min'] : undefined,\n max: typeof entry?.['max'] === 'number' ? entry['max'] : undefined,\n })\n }\n if (!fields.length) return null\n const rawDefaults = (declared as { defaults?: unknown } | undefined)?.defaults\n const defaults: Record<string, unknown> = {}\n for (const field of fields) {\n const supplied = rawDefaults && typeof rawDefaults === 'object' ? (rawDefaults as Record<string, unknown>)[field.key] : undefined\n const empty =\n field.type === 'boolean' ? false : field.type === 'number' ? (field.min ?? 0) : field.type === 'select' ? (field.options?.[0]?.value ?? '') : ''\n defaults[field.key] = coerceManifestConfigValue(field, supplied, empty)\n }\n return { fields, defaults }\n}\n\nconst MANIFEST_FIELD_KIND = { string: 'text', number: 'number', boolean: 'toggle', select: 'select' } as const\n\n/**\n * The workspace-settings screen of a marketplace plugin, as a native screen spec: the console's `PluginConfigCards` for a\n * pin's manifest. The same shape the generated screens of the built-in plugins have (`pluginSettingsScreen` of\n * `native-plugin-settings.mjs`), under an id of its own, saved to `orgs/{org}/pluginSettings/{plugin}` as the console\n * saves it. `null` for a plugin that declares no settings.\n */\nexport function manifestSettingsScreen(pluginId: string, label: string, manifest: unknown): Record<string, unknown> | null {\n const schema = pluginId ? manifestSettingsFields(manifest) : null\n if (!schema) return null\n const fields = schema.fields.map((field) => {\n const out: Record<string, unknown> = {\n key: field.key,\n label: field.label,\n kind: MANIFEST_FIELD_KIND[field.type],\n // `??` keeps a stored false or 0, which `|` would skip for the default.\n initial: `{item.${field.key} ?? const.defaults.${field.key}}`,\n }\n if (field.type === 'select') out['options'] = (field.options ?? []).map(({ value, label: text }) => ({ value, label: text }))\n const band = field.type === 'number' && (field.min != null || field.max != null) ? `Between ${field.min ?? 'any'} and ${field.max ?? 'any'}.` : ''\n const help = [field.description, band].filter(Boolean).join(' ')\n if (help) out['help'] = help\n return out\n })\n const written = Object.fromEntries(schema.fields.map((field) => [field.key, `{form.${field.key}}`]))\n return {\n id: `marketplace.pluginSettings.${pluginId}`,\n title: `${label} settings`,\n subtitle: `How ${label} behaves for this workspace`,\n icon: 'gearshape|settings',\n scope: 'org',\n requires: 'org.can[org.settings]',\n constants: { defaults: schema.defaults },\n load: { settings: { doc: `orgs/{org.id}/pluginSettings/${pluginId}`, optional: true } },\n blocks: [\n {\n type: 'form',\n id: 'settings',\n object: 'data.settings',\n footer: 'A site can override these on its own plugin page.',\n fields,\n submit: {\n label: 'Save settings',\n write: { doc: `orgs/{org.id}/pluginSettings/${pluginId}`, fields: { ...written, updatedBy: '{user.uid}' } },\n success: 'Settings saved',\n },\n },\n ],\n }\n}\n"],"names":["ARTIFACT_TYPE_LABELS","plugin","component","template","layout","datasetSchema","emailTemplate","emailStarter","theme","siteStarter","INSTALL_TARGETS","resolvePluginInstallState","latestVersion","hostPin","orgPin","effective","installedVersion","version","String","scope","shadowed","Boolean","updateAvailable","LISTING_CATEGORIES","marketplaceInstallEndpoint","artifactType","marketplaceLandingMessage","displayName","compareArtifactVersions","a","b","left","right","parse","value","parts","split","numbers","part","test","push","Number","length","leftParts","rightParts","Math","max","index","leftPart","rightPart","updateStateLabel","status","state","availableVersion","unknownReason","pluginOfferedVersion","latestApprovedVersion","revocationVersions","offered","Array","isArray","includes","pluginUpdateStatus","pin","offeredVersion","unknown","recorded","installedFrom","listingId","marketplace","source","undefined","order","resolveOrgInstallSummary","hosts","hostPins","orgWide","orgVersion","sites","hostPinnedIds","availableHostIds","host","id","hostId","label","pinnedBy","disabledPlugins","switchedOff","installedAnywhere","installPictureReadPhase","input","sitePins","data","fromCache","resolveUninstallTargets","orgInstall","site","find","entry","stillCovered","map","staleSites","filter","pluginSiteSetSummary","install","siteCount","off","head","namesList","running","names","slice","join","pluginUpdatePrompt","title","body","name","others","singleSite","note","pluginUpdateAll","stale","target","hostIds","PLUGIN_ORG_WIDE_UPDATE_NOTE","UNINSTALL_ACKNOWLEDGEMENT","PLACEMENT_NOUNS","screen","uninstallImpactView","pluginId","targets","impact","failed","losing","covered","scanning","affected","affectedScreens","alerts","tone","text","losingSites","truncated","placements","pages","chips","placement","type","count","confirmLabel","needsAcknowledgement","installPlanOutcome","errors","installed","updating","saved","leftOut","noun","toVersion","installedPluginCaption","offNamed","where","siteLabels","MANIFEST_CONFIG_FIELD_LIMIT","MANIFEST_CONFIG_FIELD_TYPES","Set","coerceManifestConfigValue","field","raw","fallback","isFinite","NaN","isNaN","min","options","some","option","manifestSettingsFields","manifest","declared","config","rawFields","fields","seen","key","trim","has","add","description","rawDefaults","defaults","supplied","empty","MANIFEST_FIELD_KIND","string","number","boolean","select","manifestSettingsScreen","schema","out","kind","initial","band","help","written","Object","fromEntries","subtitle","icon","requires","constants","load","settings","doc","optional","blocks","object","footer","submit","write","updatedBy","success"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAID;;;;;;CAMC,GAED;;;;;;;CAOC,GACD,OAAO,MAAMA,uBAAgE;IAC3EC,QAAQ;IACRC,WAAW;IACXC,UAAU;IACVC,QAAQ;IACRC,eAAe;IACfC,eAAe;IACfC,cAAc;IACdC,OAAO;IACPC,aAAa;AACf,EAAC;AAKD;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,kBAGT;IACFT,QAAQ;QAAC;QAAO;KAAO;IACvBC,WAAW;QAAC;KAAO;IACnBC,UAAU;QAAC;KAAO;IAClBC,QAAQ;QAAC;KAAO;IAChB,wEAAwE;IACxE,uDAAuD;IACvDC,eAAe;QAAC;KAAM;IACtBC,eAAe;QAAC;KAAO;IACvB,gEAAgE;IAChEC,cAAc;QAAC;KAAO;IACtB,sEAAsE;IACtE,4EAA4E;IAC5E,+BAA+B;IAC/BC,OAAO;QAAC;KAAO;IACf,uEAAuE;IACvE,wBAAwB;IACxBC,aAAa;QAAC;KAAO;AACvB,EAAC;AA6BD;;;;CAIC,GACD,OAAO,SAASE,0BACdC,aAA0C,EAC1CC,OAAsC,EACtCC,MAAqC;QAEnBD;IAAlB,MAAME,aAAYF,OAAAA,kBAAAA,UAAWC,kBAAXD,OAAqB;IACvC,MAAMG,m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;;oBAAe;oBAC1GC,SAAS;gBACX;YACF;SACD;IACH;AACF"}
|
|
@@ -243,7 +243,7 @@ export interface MarketplaceListing {
|
|
|
243
243
|
* re-exported here under the name publishing code has always used.
|
|
244
244
|
*/
|
|
245
245
|
export type { MarketplaceArtifactType };
|
|
246
|
-
export { ARTIFACT_TYPE_LABELS, INSTALL_TARGETS, type InstallPin, type InstallTarget, LISTING_CATEGORIES, type OrgInstallHost, type OrgInstallSite, type OrgInstallSummary, type PluginInstallState, resolveOrgInstallSummary, resolvePluginInstallState, resolveUninstallTargets, type UninstallTarget, } from './marketplace-catalog';
|
|
246
|
+
export { ARTIFACT_TYPE_LABELS, INSTALL_TARGETS, type InstallPictureReadPhase, type InstallPin, type InstallPinRead, type InstallTarget, installPictureReadPhase, LISTING_CATEGORIES, type OrgInstallHost, type OrgInstallSite, type OrgInstallSummary, type PluginInstallState, resolveOrgInstallSummary, resolvePluginInstallState, resolveUninstallTargets, type UninstallTarget, } from './marketplace-catalog';
|
|
247
247
|
import { type InstallTarget } from './marketplace-catalog';
|
|
248
248
|
/** The friendly artifact-type label for a listing (AGL-864). */
|
|
249
249
|
export declare function listingArtifactLabel(listing: {
|
|
@@ -46,7 +46,7 @@ export { isListingBrowsable, isListingDeleted, isPrivateListing, LISTING_CLIENT_
|
|
|
46
46
|
export function isValidPublisherHandle(handle) {
|
|
47
47
|
return PUBLISHER_HANDLE_PATTERN.test(handle);
|
|
48
48
|
}
|
|
49
|
-
export { ARTIFACT_TYPE_LABELS, INSTALL_TARGETS, LISTING_CATEGORIES, resolveOrgInstallSummary, resolvePluginInstallState, resolveUninstallTargets } from "./marketplace-catalog.js";
|
|
49
|
+
export { ARTIFACT_TYPE_LABELS, INSTALL_TARGETS, installPictureReadPhase, LISTING_CATEGORIES, resolveOrgInstallSummary, resolvePluginInstallState, resolveUninstallTargets } from "./marketplace-catalog.js";
|
|
50
50
|
import { ARTIFACT_TYPE_LABELS, INSTALL_TARGETS, LISTING_CATEGORIES } from "./marketplace-catalog.js";
|
|
51
51
|
/** The friendly artifact-type label for a listing (AGL-864). */ export function listingArtifactLabel(listing) {
|
|
52
52
|
var _ARTIFACT_TYPE_LABELS_listingArtifactType;
|