@aglyn/aglyn 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/crm.js +8 -7
  3. package/src/lib/app-utils/crm.js.map +1 -1
  4. package/src/lib/app-utils/docs-help-sections.generated.js +4 -3
  5. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  6. package/src/lib/app-utils/docs-help.generated.d.ts +3 -3
  7. package/src/lib/app-utils/docs-help.generated.js +5 -1
  8. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  9. package/src/lib/app-utils/docs-index.generated.js +22 -22
  10. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  11. package/src/lib/app-utils/dynamic-list-rule.js +9 -5
  12. package/src/lib/app-utils/dynamic-list-rule.js.map +1 -1
  13. package/src/lib/app-utils/entity-picker-context.d.ts +6 -0
  14. package/src/lib/app-utils/entity-picker-context.js.map +1 -1
  15. package/src/lib/app-utils/host-status.js +1 -1
  16. package/src/lib/app-utils/host-status.js.map +1 -1
  17. package/src/lib/app-utils/native-nav.d.ts +2 -2
  18. package/src/lib/app-utils/native-nav.js +2 -2
  19. package/src/lib/app-utils/native-nav.js.map +1 -1
  20. package/src/lib/app-utils/org-role-grants.js +1 -1
  21. package/src/lib/app-utils/org-role-grants.js.map +1 -1
  22. package/src/lib/app-utils/page-header-record-context.d.ts +15 -0
  23. package/src/lib/app-utils/page-header-record-context.js +13 -4
  24. package/src/lib/app-utils/page-header-record-context.js.map +1 -1
  25. package/src/lib/app-utils/plan-entitlements.d.ts +38 -11
  26. package/src/lib/app-utils/plan-entitlements.js +39 -13
  27. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  28. package/src/lib/app-utils/release-flags.d.ts +1 -1
  29. package/src/lib/app-utils/release-flags.js +24 -0
  30. package/src/lib/app-utils/release-flags.js.map +1 -1
  31. package/src/lib/app-utils/site-context.d.ts +9 -0
  32. package/src/lib/app-utils/site-context.js.map +1 -1
  33. package/src/lib/app-utils/site-placement.d.ts +25 -7
  34. package/src/lib/app-utils/site-placement.js +17 -25
  35. package/src/lib/app-utils/site-placement.js.map +1 -1
  36. package/src/lib/app-utils/site-starter.d.ts +6 -0
  37. package/src/lib/app-utils/site-starter.js +15 -0
  38. package/src/lib/app-utils/site-starter.js.map +1 -1
  39. package/src/lib/plugin-manager/first-party-plugins.generated.js +1 -0
  40. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  41. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +10 -0
  42. package/src/lib/plugin-manager/plugin-contact-capture.js +11 -0
  43. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
  44. package/src/lib/plugin-manager/plugin-record-lists.d.ts +18 -0
  45. package/src/lib/plugin-manager/plugin-record-lists.js +13 -0
  46. package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
  47. package/src/lib/plugin-manager/video-embed-provider.d.ts +28 -0
  48. package/src/lib/plugin-manager/video-embed-provider.js +21 -0
  49. package/src/lib/plugin-manager/video-embed-provider.js.map +1 -1
  50. package/src/lib/plugin-manager/video-embed-providers.generated.js +3 -1
  51. package/src/lib/plugin-manager/video-embed-providers.generated.js.map +1 -1
@@ -326,6 +326,16 @@ export declare function labelContactSource(source: unknown, fallback?: string):
326
326
  * nothing answers to, without closing the list against a plugin's door.
327
327
  */
328
328
  export declare function isKnownContactSource(source: unknown): boolean;
329
+ /**
330
+ * Whether a capture source is a plugin's word rather than one of the core's.
331
+ *
332
+ * A capture writes its source into the holder's facet, and that is the only place
333
+ * a plugin's word has ever been. A list's sweep still reads the core's words off
334
+ * the top of the row, so reading them from the facet too would change who an
335
+ * existing source-filtered list selects. It asks this to read the facet for the
336
+ * words no existing list could have named.
337
+ */
338
+ export declare function isPluginContactSource(source: string): boolean;
329
339
  /** One source a filter offers: the stored word, and how it reads. */
330
340
  export interface PluginContactSourceOption {
331
341
  value: string;
@@ -117,6 +117,17 @@ export const PLUGIN_CONTACT_SOURCES = definePluginServiceContract('core.contact-
117
117
  if (!word) return false;
118
118
  return Object.hasOwn(CONTACT_SOURCE_LABELS, word) || pluginContactSource(word) !== null;
119
119
  }
120
+ /**
121
+ * Whether a capture source is a plugin's word rather than one of the core's.
122
+ *
123
+ * A capture writes its source into the holder's facet, and that is the only place
124
+ * a plugin's word has ever been. A list's sweep still reads the core's words off
125
+ * the top of the row, so reading them from the facet too would change who an
126
+ * existing source-filtered list selects. It asks this to read the facet for the
127
+ * words no existing list could have named.
128
+ */ export function isPluginContactSource(source) {
129
+ return !Object.hasOwn(CONTACT_SOURCE_LABELS, source);
130
+ }
120
131
  /**
121
132
  * Every source a filter can offer: the core's, then each door a plugin
122
133
  * declared, each reading as {@link labelContactSource} reads it, so a filter's
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-contact-capture.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 { CONTACT_SOURCE_LABELS } from '../app-utils/contacts'\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginServices,\n} from './plugin-services'\n\n/**\n * A person met on a site, handed to whichever plugin keeps people (AGL-3124).\n *\n * Four silos capture the same thing and none of them is the record system: a\n * form submission, a site member signing up, an order, a booking. Each holds\n * an address, a name and the fact that something happened, and each wants the\n * workspace's person record to know. Today each one imports the writer, which\n * makes the highest-fan-in edge in the repo — thirty files in one plugin alone\n * — and makes the record system's plugin something a storefront cannot take a\n * payment without.\n *\n * So the silo stops importing and starts DECLARING: it registers the capture\n * door it owns, and hands a capture to this seam. The plugin that keeps people\n * registers the writer and does every part of the work that is a record\n * system's to do:\n *\n * - normalizing and keying the address, and deciding whether this is a new\n * person or a visit from one the workspace already holds;\n * - the audience band, the erasure rows, and every other refusal — answered,\n * never thrown, so a capture that is refused never costs the silo the order\n * or the submission it was recording;\n * - what a stage, an owner, a company and a tag mean, and what the arrival\n * of a new person sets off.\n *\n * The silo decides none of that. It reports what it saw.\n *\n * ## Why the profile is opaque\n *\n * `profile` is the owner's own field names with scalar values, not a core\n * type. A person's record shape belongs to the plugin that models it, and a\n * typed core shape would be that model spelled in the platform again — which\n * is the defect this seam exists to retire, not a smaller version of it. A key\n * the owner does not document is the owner's to ignore.\n *\n * `source` is the silo's own word for its door, and it is declared rather than\n * enumerated here for the same reason: core listing `form`, `member`, `order`\n * and `booking` would be core holding the plugin set again. A silo registers\n * its source with {@link registerPluginContactSource}, which is what lets a\n * timeline label an entry and a link point back at the thing that captured the\n * person, without the platform knowing what any of them are.\n *\n * ## One writer; many silos\n *\n * A workspace keeps one set of people, so the writer is a slot: a second\n * plugin's writer is refused naming both, and the incumbent keeps serving. A\n * SOURCE is per silo and there are many, but one source word has one owner —\n * two plugins claiming `order` would make the label and the link ambiguous at\n * the point they are read.\n *\n * ## The caller proves who is asking\n *\n * Like `plugin-record-timeline`, the registry authenticates nobody. A silo has\n * already decided, in its own terms and before it asks, that the capture is\n * the workspace's to record — that the submission was accepted, that the order\n * was paid.\n *\n * Server-side: reached by its own subpath, never through\n * `plugin-manager/index.ts`.\n */\n\n/** The person, as the capturing silo saw them. */\nexport interface PluginContactIdentity {\n /**\n * The address they gave. Raw: the owner normalizes and keys on it, and a\n * silo that normalized first would be keeping a second copy of that rule.\n */\n email: unknown\n name?: string | null\n}\n\n/** What happened, in the capturing silo's own words. */\nexport interface PluginContactInteraction {\n /** The silo's declared source word — see {@link registerPluginContactSource}. */\n source: string\n /** When it happened, epoch ms; the owner uses now when absent. */\n atMs?: number\n /**\n * The document it happened on, in the silo's terms\n * (`formSubmissions/{id}`, `orders/{id}`), so a timeline entry can point\n * back at it. Absent where the door leaves nothing to open.\n */\n refId?: string | null\n /** One line a person reads on the timeline. */\n summary?: string | null\n}\n\nexport interface PluginContactCaptureRequest {\n /**\n * Who caused the capture, when it was not the person captured (AGL-3376) —\n * a member adding someone by hand, an integration's key. A door where the\n * visitor acts for themselves (a form, a purchase) may leave it out.\n */\n actor?: {\n kind: 'member' | 'visitor' | 'apiKey' | 'platform'\n uid?: string | null\n email?: string | null\n apiKeyName?: string | null\n }\n orgId: string\n /** The site the person was met on: the brand whose form or checkout it was. */\n hostId: string\n identity: PluginContactIdentity\n interaction: PluginContactInteraction\n /**\n * An explicit marketing opt-in the capture surface carried, recorded against\n * `hostId`: consent to the MARKETING send purpose (`marketing-consent.ts`),\n * whichever plugin's mail later asks for it. Absent is not consent, and\n * filing a capture under a container is not consent either.\n */\n marketingConsent?: boolean\n /**\n * The disclosure key the capture surface rendered beside that opt-in\n * (`consentGroupDisclosureKey`, AGL-3320), passed through as the surface\n * sent it. The owner records the opt-in for the site's whole consent group\n * only when this is the group's current key, and for `hostId` alone\n * otherwise — so a silo whose surface shows no disclosure sends none.\n */\n disclosedConsentGroup?: string\n /** Tags the silo puts on this capture; the owner adds, never replaces. */\n tags?: readonly string[]\n /**\n * What the capture SURFACE is filed under — the merchant's own act — by\n * container kind (`plugin-containers.ts`): `{ [kind]: ids }`. The owner\n * files the person under the kinds it keeps. Filing is not consent.\n */\n containers?: Readonly<Record<string, readonly string[]>>\n /** Money the capture was worth, in cents, where the silo took some. */\n purchaseCents?: number\n /** The currency {@link purchaseCents} is in, lowercase, when the silo knows. */\n purchaseCurrency?: string\n /**\n * The earliest stage this capture describes, in the OWNER's words. A floor\n * and not a value: the owner fills an empty stage and advances an earlier\n * one, and never moves anybody back, so a repeat customer filling in a\n * contact form is still a customer.\n */\n lifecycleFloor?: string\n /**\n * What kind of door this is, which decides WHICH RECORD the person lands\n * on (AGL-3232) — the owner's rule is Salesforce's: one person is one\n * record, a lead until they are qualified and a contact after.\n *\n * - `lead`: a lead surface — a form whose author routes it to leads, a\n * booking request. The person is filed as a LEAD and nothing else,\n * unless the workspace already holds them as a contact, in which case\n * the capture lands on the contact and no lead is filed.\n * - `relationship`: an act that makes the person a known relationship —\n * a member account, a purchase. The person is filed as a CONTACT, and\n * an open lead the site held for them is stamped converted onto it.\n * - `touch`, the default: everything else — a form without lead routing,\n * a newsletter opt-in. The capture lands on the open lead when the site\n * holds one for the address, and on the contact otherwise.\n */\n surface?: 'lead' | 'relationship' | 'touch'\n /**\n * Profile fields the silo knows, keyed by the owner's own field names.\n * Only the keys given are written, so a silo that knows the phone number\n * does not blank a title somebody typed.\n */\n profile?: Readonly<Record<string, unknown>>\n /**\n * Profile fields written only where the record the person lands on holds\n * none (AGL-3493), keyed as {@link profile} is. For what a door learned\n * in passing — the phone a booking form asked for — and must not put over\n * a value somebody typed on the record or gave the business before.\n * A key also present in `profile` is `profile`'s to write.\n */\n profileFill?: Readonly<Record<string, unknown>>\n /**\n * Facts about THIS CAPTURE that the owner models and the platform does not\n * (AGL-3080) — which form was filled in, which page it was on, where the\n * visitor arrived from.\n *\n * Opaque for the reason {@link profile} is: every one of these is a concept\n * belonging to the plugin that keeps people or to the silo that saw it, and\n * a typed core field for each would be those models spelled out in the\n * platform again. `profile` describes the PERSON and outlives the visit;\n * this describes the visit and does not.\n *\n * A key the owner does not recognize is the owner's to ignore, and a silo\n * that sends nothing here loses nothing: every field is an enrichment of a\n * capture that is already complete without it.\n */\n detail?: Readonly<Record<string, unknown>>\n}\n\n/**\n * The owner's answer. `created: false` is a visit by somebody the workspace\n * already held, which is an interaction and not a new person.\n *\n * A refusal is RETURNED. Every one of these silos has already done the thing\n * it was recording, so a throw here would cost an accepted submission or a\n * paid order for a record it could not keep.\n */\nexport type PluginContactCaptured =\n /** The capture landed on a contact — the record every capture used to make. */\n | { ok: true; record: 'contact'; contactId: string; created: boolean }\n /**\n * The capture landed on a LEAD (AGL-3232): a lead surface met somebody the\n * workspace does not hold as a contact, or a touch reached an open lead.\n * `leadId` is the person key the lead is filed under on `hostId`.\n */\n | {\n ok: true\n record: 'lead'\n leadId: string\n created: boolean\n /**\n * Whether this capture's surface was new on the lead — a new person,\n * or one first met through another door. A form counts its leads by\n * it (AGL-3330): the people it filed, not the times they came back.\n * Absent from a writer that does not say, which a caller reads as\n * `created`.\n */\n sourceAdded?: boolean\n }\n | {\n ok: false\n /**\n * `invalid-email`: nothing usable to key a person on. `band`: the\n * workspace is at the audience it may hold. `erased`: the workspace\n * erased this person and a capture must not quietly rebuild them.\n * `error`: the owner failed, and said so rather than silently.\n */\n reason: 'invalid-email' | 'band' | 'erased' | 'error'\n /** Customer-safe: a caller may show or log it as it stands. */\n error: string\n }\n\nexport interface PluginContactCaptureWriter {\n /** Records one capture; a refusal is returned, never thrown. */\n capture(\n request: PluginContactCaptureRequest,\n ): Promise<PluginContactCaptured>\n}\n\n/** A capture door a silo owns. */\nexport interface PluginContactSourceDeclaration {\n /** The silo's word for the door, as its captures carry it. */\n source: string\n /** What a timeline entry from this door says: `Form submission`. */\n label: string\n /**\n * What a link from that entry says when there is something to open —\n * `Open submission`. Absent where the door leaves nothing to open, which\n * is the honest answer for an import or a by-hand add.\n */\n openLabel?: string\n /**\n * The record kind the silo's own document is, for\n * `plugin-record-routes` to address it with. Absent where the door has no\n * record of its own to open.\n */\n recordKind?: string\n}\n\n/** A source declaration with the silo that made it. */\nexport type ResolvedPluginContactSource = PluginContactSourceDeclaration & {\n pluginId: string\n}\n\nexport const PLUGIN_CONTACT_CAPTURE =\n definePluginServiceContract<PluginContactCaptureWriter>(\n 'core.contact-capture',\n { multiple: false },\n )\n\nexport const PLUGIN_CONTACT_SOURCES =\n definePluginServiceContract<PluginContactSourceDeclaration>(\n 'core.contact-capture-sources',\n { multiple: true },\n )\n\n/**\n * Registers the plugin that keeps people. The owner is the loader's marker\n * when a register fn is running, else `options.pluginId`; with neither the\n * registration throws, and a second plugin's writer is refused naming both —\n * the incumbent keeps serving.\n */\nexport function registerPluginContactCaptureWriter(\n writer: PluginContactCaptureWriter,\n options?: { pluginId?: string },\n): void {\n registerPluginService(PLUGIN_CONTACT_CAPTURE, writer, {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n })\n}\n\n/** Declares a capture door. One source word has one owner. */\nexport function registerPluginContactSource(\n declaration: PluginContactSourceDeclaration,\n options?: { pluginId?: string },\n): void {\n const key = declaration.source?.trim() ?? ''\n if (!key) throw new Error('a contact capture source needs a source word')\n if (!declaration.label?.trim()) {\n throw new Error(`contact capture source \"${key}\" needs a label`)\n }\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n const incumbent = resolvePluginServices(PLUGIN_CONTACT_SOURCES).find(\n (entry) => entry.key === key,\n )\n if (incumbent && pluginId && incumbent.pluginId !== pluginId) {\n throw new Error(\n `contact capture source \"${key}\" is already declared by ` +\n `\"${incumbent.pluginId}\"; refused \"${pluginId}\"`,\n )\n }\n registerPluginService(\n PLUGIN_CONTACT_SOURCES,\n { ...declaration, source: key },\n {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n key,\n },\n )\n}\n\nexport interface ResolvedPluginContactCaptureWriter {\n /** The plugin that keeps people. */\n pluginId: string\n writer: PluginContactCaptureWriter\n}\n\n/** The writer with its owner, or `null` when no plugin keeps people here. */\nexport function pluginContactCaptureWriter(): ResolvedPluginContactCaptureWriter | null {\n const entry = resolvePluginServices(PLUGIN_CONTACT_CAPTURE)[0]\n return entry ? { pluginId: entry.pluginId, writer: entry.impl } : null\n}\n\n/**\n * Hands one capture to the plugin that keeps people, or answers `null` when\n * no plugin does.\n *\n * `null` and a refusal are different answers and a silo treats them\n * differently: `null` is a workspace with no record system, where there is\n * nothing to record and nothing has gone wrong; a refusal is a record system\n * that considered this person and declined.\n */\nexport async function capturePluginContact(\n request: PluginContactCaptureRequest,\n): Promise<PluginContactCaptured | null> {\n const found = pluginContactCaptureWriter()\n if (!found) return null\n return found.writer.capture(request)\n}\n\n/** Every declared capture door, with its silo, in registration order. */\nexport function listPluginContactSources(): ResolvedPluginContactSource[] {\n return resolvePluginServices(PLUGIN_CONTACT_SOURCES).map((entry) => ({\n ...entry.impl,\n pluginId: entry.pluginId,\n }))\n}\n\n/** One declared capture door by its source word, or `null`. */\nexport function pluginContactSource(\n source: string,\n): ResolvedPluginContactSource | null {\n const key = source.trim()\n const entry = resolvePluginServices(PLUGIN_CONTACT_SOURCES).find(\n (one) => one.key === key,\n )\n return entry ? { ...entry.impl, pluginId: entry.pluginId } : null\n}\n\n/**\n * How a contact's source word reads on screen, wherever it came from: the\n * core's own words from {@link CONTACT_SOURCE_LABELS}, then the label a\n * plugin declared for its door with {@link registerPluginContactSource},\n * then `fallback` when one is given, else the word itself.\n *\n * The core's map is a closed `Record<ContactSource, string>`, and a plugin's\n * door is an open string by design, so a list, a chip or a report that read\n * the map alone showed a plugin's raw word (`waiver` rather than its label).\n * This is the one place both are asked, in that order, so a plugin cannot\n * relabel a core source. It answers from what is registered in THIS process:\n * a plugin that declares its door from its `declarations` entry is known in\n * the console's browser and on both servers before a page renders.\n */\nexport function labelContactSource(source: unknown, fallback?: string): string {\n const word = typeof source === 'string' ? source.trim() : ''\n if (!word) return fallback ?? ''\n if (Object.hasOwn(CONTACT_SOURCE_LABELS, word)) {\n return CONTACT_SOURCE_LABELS[word as keyof typeof CONTACT_SOURCE_LABELS]\n }\n return pluginContactSource(word)?.label || (fallback ?? word)\n}\n\n/**\n * Whether a word is a source this process can name: one of the core's, or a\n * door a plugin declared. What keeps a saved filter from carrying a word\n * nothing answers to, without closing the list against a plugin's door.\n */\nexport function isKnownContactSource(source: unknown): boolean {\n const word = typeof source === 'string' ? source.trim() : ''\n if (!word) return false\n return Object.hasOwn(CONTACT_SOURCE_LABELS, word) || pluginContactSource(word) !== null\n}\n\n/** One source a filter offers: the stored word, and how it reads. */\nexport interface PluginContactSourceOption {\n value: string\n label: string\n}\n\n/**\n * Every source a filter can offer: the core's, then each door a plugin\n * declared, each reading as {@link labelContactSource} reads it, so a filter's\n * choice and a row's chip cannot disagree. A plugin that declares a core word\n * adds no second entry and does not change its label.\n */\nexport function listContactSourceOptions(): PluginContactSourceOption[] {\n const words = new Set([\n ...Object.keys(CONTACT_SOURCE_LABELS),\n ...listPluginContactSources().map((door) => door.source),\n ])\n return [...words].map((value) => ({ value, label: labelContactSource(value) }))\n}\n"],"names":["CONTACT_SOURCE_LABELS","getRegisteringPluginId","definePluginServiceContract","registerPluginService","resolvePluginServices","PLUGIN_CONTACT_CAPTURE","multiple","PLUGIN_CONTACT_SOURCES","registerPluginContactCaptureWriter","writer","options","pluginId","registerPluginContactSource","declaration","key","source","trim","Error","label","incumbent","find","entry","pluginContactCaptureWriter","impl","capturePluginContact","request","found","capture","listPluginContactSources","map","pluginContactSource","one","labelContactSource","fallback","word","Object","hasOwn","isKnownContactSource","listContactSourceOptions","words","Set","keys","door","value"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,qBAAqB,QAAQ,2BAAuB;AAC7D,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,QAChB,uBAAmB;AAuQ1B,OAAO,MAAMC,yBACXH,4BACE,wBACA;IAAEI,UAAU;AAAM,GACnB;AAEH,OAAO,MAAMC,yBACXL,4BACE,gCACA;IAAEI,UAAU;AAAK,GAClB;AAEH;;;;;CAKC,GACD,OAAO,SAASE,mCACdC,MAAkC,EAClCC,OAA+B;IAE/BP,sBAAsBE,wBAAwBI,QAAQ,aAChDC,CAAAA,2BAAAA,QAASC,QAAQ,IAAG;QAAEA,UAAUD,QAAQC,QAAQ;IAAC,IAAI,CAAC;AAE9D;AAEA,4DAA4D,GAC5D,OAAO,SAASC,4BACdC,WAA2C,EAC3CH,OAA+B;cAObT,OAAAA;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,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-contact-capture.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 { CONTACT_SOURCE_LABELS } from '../app-utils/contacts'\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginServices,\n} from './plugin-services'\n\n/**\n * A person met on a site, handed to whichever plugin keeps people (AGL-3124).\n *\n * Four silos capture the same thing and none of them is the record system: a\n * form submission, a site member signing up, an order, a booking. Each holds\n * an address, a name and the fact that something happened, and each wants the\n * workspace's person record to know. Today each one imports the writer, which\n * makes the highest-fan-in edge in the repo — thirty files in one plugin alone\n * — and makes the record system's plugin something a storefront cannot take a\n * payment without.\n *\n * So the silo stops importing and starts DECLARING: it registers the capture\n * door it owns, and hands a capture to this seam. The plugin that keeps people\n * registers the writer and does every part of the work that is a record\n * system's to do:\n *\n * - normalizing and keying the address, and deciding whether this is a new\n * person or a visit from one the workspace already holds;\n * - the audience band, the erasure rows, and every other refusal — answered,\n * never thrown, so a capture that is refused never costs the silo the order\n * or the submission it was recording;\n * - what a stage, an owner, a company and a tag mean, and what the arrival\n * of a new person sets off.\n *\n * The silo decides none of that. It reports what it saw.\n *\n * ## Why the profile is opaque\n *\n * `profile` is the owner's own field names with scalar values, not a core\n * type. A person's record shape belongs to the plugin that models it, and a\n * typed core shape would be that model spelled in the platform again — which\n * is the defect this seam exists to retire, not a smaller version of it. A key\n * the owner does not document is the owner's to ignore.\n *\n * `source` is the silo's own word for its door, and it is declared rather than\n * enumerated here for the same reason: core listing `form`, `member`, `order`\n * and `booking` would be core holding the plugin set again. A silo registers\n * its source with {@link registerPluginContactSource}, which is what lets a\n * timeline label an entry and a link point back at the thing that captured the\n * person, without the platform knowing what any of them are.\n *\n * ## One writer; many silos\n *\n * A workspace keeps one set of people, so the writer is a slot: a second\n * plugin's writer is refused naming both, and the incumbent keeps serving. A\n * SOURCE is per silo and there are many, but one source word has one owner —\n * two plugins claiming `order` would make the label and the link ambiguous at\n * the point they are read.\n *\n * ## The caller proves who is asking\n *\n * Like `plugin-record-timeline`, the registry authenticates nobody. A silo has\n * already decided, in its own terms and before it asks, that the capture is\n * the workspace's to record — that the submission was accepted, that the order\n * was paid.\n *\n * Server-side: reached by its own subpath, never through\n * `plugin-manager/index.ts`.\n */\n\n/** The person, as the capturing silo saw them. */\nexport interface PluginContactIdentity {\n /**\n * The address they gave. Raw: the owner normalizes and keys on it, and a\n * silo that normalized first would be keeping a second copy of that rule.\n */\n email: unknown\n name?: string | null\n}\n\n/** What happened, in the capturing silo's own words. */\nexport interface PluginContactInteraction {\n /** The silo's declared source word — see {@link registerPluginContactSource}. */\n source: string\n /** When it happened, epoch ms; the owner uses now when absent. */\n atMs?: number\n /**\n * The document it happened on, in the silo's terms\n * (`formSubmissions/{id}`, `orders/{id}`), so a timeline entry can point\n * back at it. Absent where the door leaves nothing to open.\n */\n refId?: string | null\n /** One line a person reads on the timeline. */\n summary?: string | null\n}\n\nexport interface PluginContactCaptureRequest {\n /**\n * Who caused the capture, when it was not the person captured (AGL-3376) —\n * a member adding someone by hand, an integration's key. A door where the\n * visitor acts for themselves (a form, a purchase) may leave it out.\n */\n actor?: {\n kind: 'member' | 'visitor' | 'apiKey' | 'platform'\n uid?: string | null\n email?: string | null\n apiKeyName?: string | null\n }\n orgId: string\n /** The site the person was met on: the brand whose form or checkout it was. */\n hostId: string\n identity: PluginContactIdentity\n interaction: PluginContactInteraction\n /**\n * An explicit marketing opt-in the capture surface carried, recorded against\n * `hostId`: consent to the MARKETING send purpose (`marketing-consent.ts`),\n * whichever plugin's mail later asks for it. Absent is not consent, and\n * filing a capture under a container is not consent either.\n */\n marketingConsent?: boolean\n /**\n * The disclosure key the capture surface rendered beside that opt-in\n * (`consentGroupDisclosureKey`, AGL-3320), passed through as the surface\n * sent it. The owner records the opt-in for the site's whole consent group\n * only when this is the group's current key, and for `hostId` alone\n * otherwise — so a silo whose surface shows no disclosure sends none.\n */\n disclosedConsentGroup?: string\n /** Tags the silo puts on this capture; the owner adds, never replaces. */\n tags?: readonly string[]\n /**\n * What the capture SURFACE is filed under — the merchant's own act — by\n * container kind (`plugin-containers.ts`): `{ [kind]: ids }`. The owner\n * files the person under the kinds it keeps. Filing is not consent.\n */\n containers?: Readonly<Record<string, readonly string[]>>\n /** Money the capture was worth, in cents, where the silo took some. */\n purchaseCents?: number\n /** The currency {@link purchaseCents} is in, lowercase, when the silo knows. */\n purchaseCurrency?: string\n /**\n * The earliest stage this capture describes, in the OWNER's words. A floor\n * and not a value: the owner fills an empty stage and advances an earlier\n * one, and never moves anybody back, so a repeat customer filling in a\n * contact form is still a customer.\n */\n lifecycleFloor?: string\n /**\n * What kind of door this is, which decides WHICH RECORD the person lands\n * on (AGL-3232) — the owner's rule is Salesforce's: one person is one\n * record, a lead until they are qualified and a contact after.\n *\n * - `lead`: a lead surface — a form whose author routes it to leads, a\n * booking request. The person is filed as a LEAD and nothing else,\n * unless the workspace already holds them as a contact, in which case\n * the capture lands on the contact and no lead is filed.\n * - `relationship`: an act that makes the person a known relationship —\n * a member account, a purchase. The person is filed as a CONTACT, and\n * an open lead the site held for them is stamped converted onto it.\n * - `touch`, the default: everything else — a form without lead routing,\n * a newsletter opt-in. The capture lands on the open lead when the site\n * holds one for the address, and on the contact otherwise.\n */\n surface?: 'lead' | 'relationship' | 'touch'\n /**\n * Profile fields the silo knows, keyed by the owner's own field names.\n * Only the keys given are written, so a silo that knows the phone number\n * does not blank a title somebody typed.\n */\n profile?: Readonly<Record<string, unknown>>\n /**\n * Profile fields written only where the record the person lands on holds\n * none (AGL-3493), keyed as {@link profile} is. For what a door learned\n * in passing — the phone a booking form asked for — and must not put over\n * a value somebody typed on the record or gave the business before.\n * A key also present in `profile` is `profile`'s to write.\n */\n profileFill?: Readonly<Record<string, unknown>>\n /**\n * Facts about THIS CAPTURE that the owner models and the platform does not\n * (AGL-3080) — which form was filled in, which page it was on, where the\n * visitor arrived from.\n *\n * Opaque for the reason {@link profile} is: every one of these is a concept\n * belonging to the plugin that keeps people or to the silo that saw it, and\n * a typed core field for each would be those models spelled out in the\n * platform again. `profile` describes the PERSON and outlives the visit;\n * this describes the visit and does not.\n *\n * A key the owner does not recognize is the owner's to ignore, and a silo\n * that sends nothing here loses nothing: every field is an enrichment of a\n * capture that is already complete without it.\n */\n detail?: Readonly<Record<string, unknown>>\n}\n\n/**\n * The owner's answer. `created: false` is a visit by somebody the workspace\n * already held, which is an interaction and not a new person.\n *\n * A refusal is RETURNED. Every one of these silos has already done the thing\n * it was recording, so a throw here would cost an accepted submission or a\n * paid order for a record it could not keep.\n */\nexport type PluginContactCaptured =\n /** The capture landed on a contact — the record every capture used to make. */\n | { ok: true; record: 'contact'; contactId: string; created: boolean }\n /**\n * The capture landed on a LEAD (AGL-3232): a lead surface met somebody the\n * workspace does not hold as a contact, or a touch reached an open lead.\n * `leadId` is the person key the lead is filed under on `hostId`.\n */\n | {\n ok: true\n record: 'lead'\n leadId: string\n created: boolean\n /**\n * Whether this capture's surface was new on the lead — a new person,\n * or one first met through another door. A form counts its leads by\n * it (AGL-3330): the people it filed, not the times they came back.\n * Absent from a writer that does not say, which a caller reads as\n * `created`.\n */\n sourceAdded?: boolean\n }\n | {\n ok: false\n /**\n * `invalid-email`: nothing usable to key a person on. `band`: the\n * workspace is at the audience it may hold. `erased`: the workspace\n * erased this person and a capture must not quietly rebuild them.\n * `error`: the owner failed, and said so rather than silently.\n */\n reason: 'invalid-email' | 'band' | 'erased' | 'error'\n /** Customer-safe: a caller may show or log it as it stands. */\n error: string\n }\n\nexport interface PluginContactCaptureWriter {\n /** Records one capture; a refusal is returned, never thrown. */\n capture(\n request: PluginContactCaptureRequest,\n ): Promise<PluginContactCaptured>\n}\n\n/** A capture door a silo owns. */\nexport interface PluginContactSourceDeclaration {\n /** The silo's word for the door, as its captures carry it. */\n source: string\n /** What a timeline entry from this door says: `Form submission`. */\n label: string\n /**\n * What a link from that entry says when there is something to open —\n * `Open submission`. Absent where the door leaves nothing to open, which\n * is the honest answer for an import or a by-hand add.\n */\n openLabel?: string\n /**\n * The record kind the silo's own document is, for\n * `plugin-record-routes` to address it with. Absent where the door has no\n * record of its own to open.\n */\n recordKind?: string\n}\n\n/** A source declaration with the silo that made it. */\nexport type ResolvedPluginContactSource = PluginContactSourceDeclaration & {\n pluginId: string\n}\n\nexport const PLUGIN_CONTACT_CAPTURE =\n definePluginServiceContract<PluginContactCaptureWriter>(\n 'core.contact-capture',\n { multiple: false },\n )\n\nexport const PLUGIN_CONTACT_SOURCES =\n definePluginServiceContract<PluginContactSourceDeclaration>(\n 'core.contact-capture-sources',\n { multiple: true },\n )\n\n/**\n * Registers the plugin that keeps people. The owner is the loader's marker\n * when a register fn is running, else `options.pluginId`; with neither the\n * registration throws, and a second plugin's writer is refused naming both —\n * the incumbent keeps serving.\n */\nexport function registerPluginContactCaptureWriter(\n writer: PluginContactCaptureWriter,\n options?: { pluginId?: string },\n): void {\n registerPluginService(PLUGIN_CONTACT_CAPTURE, writer, {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n })\n}\n\n/** Declares a capture door. One source word has one owner. */\nexport function registerPluginContactSource(\n declaration: PluginContactSourceDeclaration,\n options?: { pluginId?: string },\n): void {\n const key = declaration.source?.trim() ?? ''\n if (!key) throw new Error('a contact capture source needs a source word')\n if (!declaration.label?.trim()) {\n throw new Error(`contact capture source \"${key}\" needs a label`)\n }\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n const incumbent = resolvePluginServices(PLUGIN_CONTACT_SOURCES).find(\n (entry) => entry.key === key,\n )\n if (incumbent && pluginId && incumbent.pluginId !== pluginId) {\n throw new Error(\n `contact capture source \"${key}\" is already declared by ` +\n `\"${incumbent.pluginId}\"; refused \"${pluginId}\"`,\n )\n }\n registerPluginService(\n PLUGIN_CONTACT_SOURCES,\n { ...declaration, source: key },\n {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n key,\n },\n )\n}\n\nexport interface ResolvedPluginContactCaptureWriter {\n /** The plugin that keeps people. */\n pluginId: string\n writer: PluginContactCaptureWriter\n}\n\n/** The writer with its owner, or `null` when no plugin keeps people here. */\nexport function pluginContactCaptureWriter(): ResolvedPluginContactCaptureWriter | null {\n const entry = resolvePluginServices(PLUGIN_CONTACT_CAPTURE)[0]\n return entry ? { pluginId: entry.pluginId, writer: entry.impl } : null\n}\n\n/**\n * Hands one capture to the plugin that keeps people, or answers `null` when\n * no plugin does.\n *\n * `null` and a refusal are different answers and a silo treats them\n * differently: `null` is a workspace with no record system, where there is\n * nothing to record and nothing has gone wrong; a refusal is a record system\n * that considered this person and declined.\n */\nexport async function capturePluginContact(\n request: PluginContactCaptureRequest,\n): Promise<PluginContactCaptured | null> {\n const found = pluginContactCaptureWriter()\n if (!found) return null\n return found.writer.capture(request)\n}\n\n/** Every declared capture door, with its silo, in registration order. */\nexport function listPluginContactSources(): ResolvedPluginContactSource[] {\n return resolvePluginServices(PLUGIN_CONTACT_SOURCES).map((entry) => ({\n ...entry.impl,\n pluginId: entry.pluginId,\n }))\n}\n\n/** One declared capture door by its source word, or `null`. */\nexport function pluginContactSource(\n source: string,\n): ResolvedPluginContactSource | null {\n const key = source.trim()\n const entry = resolvePluginServices(PLUGIN_CONTACT_SOURCES).find(\n (one) => one.key === key,\n )\n return entry ? { ...entry.impl, pluginId: entry.pluginId } : null\n}\n\n/**\n * How a contact's source word reads on screen, wherever it came from: the\n * core's own words from {@link CONTACT_SOURCE_LABELS}, then the label a\n * plugin declared for its door with {@link registerPluginContactSource},\n * then `fallback` when one is given, else the word itself.\n *\n * The core's map is a closed `Record<ContactSource, string>`, and a plugin's\n * door is an open string by design, so a list, a chip or a report that read\n * the map alone showed a plugin's raw word (`waiver` rather than its label).\n * This is the one place both are asked, in that order, so a plugin cannot\n * relabel a core source. It answers from what is registered in THIS process:\n * a plugin that declares its door from its `declarations` entry is known in\n * the console's browser and on both servers before a page renders.\n */\nexport function labelContactSource(source: unknown, fallback?: string): string {\n const word = typeof source === 'string' ? source.trim() : ''\n if (!word) return fallback ?? ''\n if (Object.hasOwn(CONTACT_SOURCE_LABELS, word)) {\n return CONTACT_SOURCE_LABELS[word as keyof typeof CONTACT_SOURCE_LABELS]\n }\n return pluginContactSource(word)?.label || (fallback ?? word)\n}\n\n/**\n * Whether a word is a source this process can name: one of the core's, or a\n * door a plugin declared. What keeps a saved filter from carrying a word\n * nothing answers to, without closing the list against a plugin's door.\n */\nexport function isKnownContactSource(source: unknown): boolean {\n const word = typeof source === 'string' ? source.trim() : ''\n if (!word) return false\n return Object.hasOwn(CONTACT_SOURCE_LABELS, word) || pluginContactSource(word) !== null\n}\n\n/**\n * Whether a capture source is a plugin's word rather than one of the core's.\n *\n * A capture writes its source into the holder's facet, and that is the only place\n * a plugin's word has ever been. A list's sweep still reads the core's words off\n * the top of the row, so reading them from the facet too would change who an\n * existing source-filtered list selects. It asks this to read the facet for the\n * words no existing list could have named.\n */\nexport function isPluginContactSource(source: string): boolean {\n return !Object.hasOwn(CONTACT_SOURCE_LABELS, source)\n}\n\n/** One source a filter offers: the stored word, and how it reads. */\nexport interface PluginContactSourceOption {\n value: string\n label: string\n}\n\n/**\n * Every source a filter can offer: the core's, then each door a plugin\n * declared, each reading as {@link labelContactSource} reads it, so a filter's\n * choice and a row's chip cannot disagree. A plugin that declares a core word\n * adds no second entry and does not change its label.\n */\nexport function listContactSourceOptions(): PluginContactSourceOption[] {\n const words = new Set([\n ...Object.keys(CONTACT_SOURCE_LABELS),\n ...listPluginContactSources().map((door) => door.source),\n ])\n return [...words].map((value) => ({ value, label: labelContactSource(value) }))\n}\n"],"names":["CONTACT_SOURCE_LABELS","getRegisteringPluginId","definePluginServiceContract","registerPluginService","resolvePluginServices","PLUGIN_CONTACT_CAPTURE","multiple","PLUGIN_CONTACT_SOURCES","registerPluginContactCaptureWriter","writer","options","pluginId","registerPluginContactSource","declaration","key","source","trim","Error","label","incumbent","find","entry","pluginContactCaptureWriter","impl","capturePluginContact","request","found","capture","listPluginContactSources","map","pluginContactSource","one","labelContactSource","fallback","word","Object","hasOwn","isKnownContactSource","isPluginContactSource","listContactSourceOptions","words","Set","keys","door","value"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,qBAAqB,QAAQ,2BAAuB;AAC7D,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,QAChB,uBAAmB;AAuQ1B,OAAO,MAAMC,yBACXH,4BACE,wBACA;IAAEI,UAAU;AAAM,GACnB;AAEH,OAAO,MAAMC,yBACXL,4BACE,gCACA;IAAEI,UAAU;AAAK,GAClB;AAEH;;;;;CAKC,GACD,OAAO,SAASE,mCACdC,MAAkC,EAClCC,OAA+B;IAE/BP,sBAAsBE,wBAAwBI,QAAQ,aAChDC,CAAAA,2BAAAA,QAASC,QAAQ,IAAG;QAAEA,UAAUD,QAAQC,QAAQ;IAAC,IAAI,CAAC;AAE9D;AAEA,4DAA4D,GAC5D,OAAO,SAASC,4BACdC,WAA2C,EAC3CH,OAA+B;cAObT,OAAAA;QALNY,qBAEPA;IAFL,MAAMC,eAAMD,sBAAAA,YAAYE,MAAM,qBAAlBF,oBAAoBG,IAAI,qBAAM;IAC1C,IAAI,CAACF,KAAK,MAAM,IAAIG,MAAM;IAC1B,IAAI,GAACJ,qBAAAA,YAAYK,KAAK,qBAAjBL,mBAAmBG,IAAI,KAAI;QAC9B,MAAM,IAAIC,MAAM,CAAC,wBAAwB,EAAEH,IAAI,eAAe,CAAC;IACj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,QAAQ,aAAKA,MAAME,IAAI;QAAEZ,UAAUU,MAAMV,QAAQ;SAAK;AAC/D;AAEA;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASqB,mBAAmBjB,MAAe,EAAEkB,QAAiB;QAM5DH;IALP,MAAMI,OAAO,OAAOnB,WAAW,WAAWA,OAAOC,IAAI,KAAK;IAC1D,IAAI,CAACkB,MAAM,OAAOD,mBAAAA,WAAY;IAC9B,IAAIE,OAAOC,MAAM,CAACpC,uBAAuBkC,OAAO;QAC9C,OAAOlC,qBAAqB,CAACkC,KAA2C;IAC1E;IACA,OAAOJ,EAAAA,uBAAAA,oBAAoBI,0BAApBJ,qBAA2BZ,KAAK,MAAKe,mBAAAA,WAAYC;AAC1D;AAEA;;;;CAIC,GACD,OAAO,SAASG,qBAAqBtB,MAAe;IAClD,MAAMmB,OAAO,OAAOnB,WAAW,WAAWA,OAAOC,IAAI,KAAK;IAC1D,IAAI,CAACkB,MAAM,OAAO;IAClB,OAAOC,OAAOC,MAAM,CAACpC,uBAAuBkC,SAASJ,oBAAoBI,UAAU;AACrF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASI,sBAAsBvB,MAAc;IAClD,OAAO,CAACoB,OAAOC,MAAM,CAACpC,uBAAuBe;AAC/C;AAQA;;;;;CAKC,GACD,OAAO,SAASwB;IACd,MAAMC,QAAQ,IAAIC,IAAI;WACjBN,OAAOO,IAAI,CAAC1C;WACZ4B,2BAA2BC,GAAG,CAAC,CAACc,OAASA,KAAK5B,MAAM;KACxD;IACD,OAAO;WAAIyB;KAAM,CAACX,GAAG,CAAC,CAACe,QAAW,CAAA;YAAEA;YAAO1B,OAAOc,mBAAmBY;QAAO,CAAA;AAC9E"}
@@ -143,6 +143,16 @@ export interface PluginRecordListSource {
143
143
  doc?(firestore: Firestore, request: PluginRecordListScope & {
144
144
  id: string;
145
145
  }): DocumentReference<DocumentData> | null;
146
+ /**
147
+ * What each record is called in a picker beside the others it lists
148
+ * (AGL-4047): its name, with what tells it apart where two in the list share
149
+ * one, by id. Optional: without it a picker shows names. `hostNames` (site id
150
+ * to name) is what the reader knows of the workspace's sites, for a label
151
+ * that names one.
152
+ */
153
+ pickerLabels?(records: readonly PluginIndexedRecord[], context?: {
154
+ hostNames?: Readonly<Record<string, string>>;
155
+ }): Readonly<Record<string, string>>;
146
156
  }
147
157
  export declare const PLUGIN_RECORD_LISTS: import("./plugin-services").PluginServiceContract<PluginRecordListSource>;
148
158
  /**
@@ -193,3 +203,11 @@ export declare function pluginRecordListByIdsQuery(kind: string, firestore: Fire
193
203
  * query could not state.
194
204
  */
195
205
  export declare function pluginRecordsFromRows(kind: string, rows: ReadonlyArray<Readonly<Record<string, unknown>>> | null | undefined, idField?: string, request?: PluginRecordListRequest): PluginIndexedRecord[];
206
+ /**
207
+ * What each of `records` is called in a picker beside the others (AGL-4047),
208
+ * by id: the owner's answer where it gives one, else the record's name. A
209
+ * kind no plugin keeps here answers names.
210
+ */
211
+ export declare function pluginRecordPickerLabels(kind: string, records: readonly PluginIndexedRecord[], context?: {
212
+ hostNames?: Readonly<Record<string, string>>;
213
+ }): Record<string, string>;
@@ -108,5 +108,18 @@ export const PLUGIN_RECORD_LISTS = definePluginServiceContract('core.record-list
108
108
  return source.record(String((_row_idField = row[idField]) != null ? _row_idField : ''), row, request);
109
109
  }).filter((record)=>record !== null);
110
110
  }
111
+ /**
112
+ * What each of `records` is called in a picker beside the others (AGL-4047),
113
+ * by id: the owner's answer where it gives one, else the record's name. A
114
+ * kind no plugin keeps here answers names.
115
+ */ export function pluginRecordPickerLabels(kind, records, context) {
116
+ var _ref;
117
+ var _pluginRecordListSource_source_pickerLabels, _pluginRecordListSource;
118
+ const labels = (_ref = (_pluginRecordListSource = pluginRecordListSource(kind)) == null ? void 0 : (_pluginRecordListSource_source_pickerLabels = _pluginRecordListSource.source.pickerLabels) == null ? void 0 : _pluginRecordListSource_source_pickerLabels.call(_pluginRecordListSource.source, records, context)) != null ? _ref : {};
119
+ return Object.fromEntries(records.map((record)=>[
120
+ record.id,
121
+ labels[record.id] || record.name
122
+ ]));
123
+ }
111
124
 
112
125
  //# sourceMappingURL=plugin-record-lists.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-record-lists.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 { DocumentData, DocumentReference, Firestore, Query } from 'firebase/firestore'\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport type { PluginIndexedRecord } from './plugin-record-index'\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginServices,\n} from './plugin-services'\n\n/**\n * A plugin's records, LISTED in the console for another plugin's picker or\n * check (AGL-3080) — the browser's half of `plugin-record-index`.\n *\n * A plugin that offers records it does not own — an automation step picking\n * a dataset, a reference check confirming a workflow still exists, a deal\n * picking a product — used to query the owner's collection from the browser\n * itself: the path, the filter the owner's security rules require, the field\n * a name is in, what a deleted one looks like. Each breaks the day the owner\n * changes one, and none is visible to `check:lib-boundaries`.\n *\n * So the owner publishes a LIST SOURCE for each record kind it keeps: the\n * query the signed-in member's read of a scope is proved by, and how one\n * stored document reads as a record — an id, a name and the facts the owner\n * chooses to share, in the shape its registration documents, the same shape\n * its server index answers. The reader runs the query with its own listener\n * (`pluginRecordListQuery`) and reads the rows back through the owner\n * (`pluginRecordsFromRows`), and never learns where the records are stored.\n *\n * ## Not registered is an answer\n *\n * No source for a kind means no plugin keeps it in this console — the owner is\n * not installed or not loaded. A reader treats that as \"none here\" and says\n * so, rather than reaching for the collection itself.\n *\n * ## One source per kind\n *\n * A second plugin registering a source for a kind another plugin already\n * keeps is refused, naming both, and the incumbent keeps serving.\n */\n\n/** Which records a reader lists. */\nexport interface PluginRecordListRequest {\n /** The organization the records belong to, where the kind is org-scoped. */\n orgId?: string | null\n /**\n * The site the records are listed for. An org-scoped kind narrows to what\n * the site may use; `null` lists the organization's own view, which only an\n * organization-wide reader may hold.\n */\n hostId?: string | null\n /** What a person typed, matched the owner's way; absent lists the scope. */\n search?: string | null\n /**\n * The signed-in member's own scope tokens, where they are not\n * organization-wide and no site is named: an org-scoped kind narrows to\n * what they may see, which is the filter the security rules require of\n * them. Absent for an organization-wide reader; a named site's narrowing\n * wins over it, and a site's own kind has no use for it.\n */\n memberScope?: readonly string[] | null\n /**\n * Only the records installed from this listing — the `listingId` of their\n * install stamp (`app-utils/artifact-provenance.ts`), matched wherever the\n * owner keeps it. A kind that is never installed answers none.\n */\n installedFrom?: string | null\n /**\n * The consent group the named site presents as (`app-utils/consent-groups`),\n * for a kind whose records say different things to different groups — a\n * person's name as one brand knows them. Absent reads as the site alone.\n */\n consentGroupId?: string | null\n /**\n * The signed-in member, for a kind some of whose records are one member's\n * own — a saved view kept private: the owner leaves out what this member\n * may not list. Absent reads as nobody's, which lists only what is shared.\n */\n viewerUid?: string | null\n /** The most documents the query may answer — a reader asks one past its window to learn it was cut. */\n limit: number\n}\n\n/** Where a reader walks a kind, or opens one record of it. */\nexport interface PluginRecordListScope {\n /** The organization, where no site is named. */\n orgId?: string | null\n /** The site; named, it wins over the organization. */\n hostId?: string | null\n}\n\n/**\n * The most records one by-name read asks for: Firestore's `in` takes thirty\n * values, so a reader with more asks in chunks.\n */\nexport const PLUGIN_RECORD_LIST_IDS_MAX = 30\n\n/** Named records of a scope, for a reader that already holds their ids. */\nexport type PluginRecordListByIdsRequest = Omit<PluginRecordListRequest, 'limit' | 'search'> & {\n /** At most {@link PLUGIN_RECORD_LIST_IDS_MAX}; the owner reads no more. */\n ids: readonly string[]\n}\n\nexport interface PluginRecordListSource {\n /**\n * The query the signed-in member's read of the scope is proved by, at most\n * `limit` documents, or `null` for a scope the kind has none in (a site-only\n * kind asked at the organization, a search with nothing to match).\n */\n query(firestore: Firestore, request: PluginRecordListRequest): Query<DocumentData> | null\n /**\n * The query for NAMED records of the scope — a reader that holds ids from\n * somewhere else, an attribution naming the submission it credits — or\n * `null` where none can be read. Optional: a source without it answers no\n * by-name read, and the reader treats every id as one it could not find.\n */\n byIds?(firestore: Firestore, request: PluginRecordListByIdsRequest): Query<DocumentData> | null\n /**\n * One stored document as the owner shares it, or `null` to leave it out\n * (deleted, unnamed, or not the reader's to list). `request` is the one the\n * query was built from, when the reader hands it back: a rule the query\n * cannot state — a site's view of an org-wide row, a member's own view —\n * is applied here.\n */\n record(\n id: string,\n data: Readonly<Record<string, unknown>>,\n request?: PluginRecordListRequest,\n ): PluginIndexedRecord | null\n /**\n * The base a reader WALKS the kind from with the console's paged list query\n * (`useListQuery`), which adds its filters, its order and its pages over the\n * stored fields the owner documents for the kind — or `null` for a scope\n * the kind has none in. For a kind whose reader pages a whole list rather\n * than picking from a window. Where the rules admit a read only narrowed by\n * a field, the owner's registration says which, and the reader adds it.\n */\n walk?(firestore: Firestore, scope: PluginRecordListScope): Query<DocumentData> | null\n /**\n * One record's document, for a reader that opens it whole or changes what\n * the owner documents a reader may change — the security rules hold the\n * rest — or `null` for a scope the kind has none in.\n */\n doc?(\n firestore: Firestore,\n request: PluginRecordListScope & { id: string },\n ): DocumentReference<DocumentData> | null\n}\n\nexport const PLUGIN_RECORD_LISTS = definePluginServiceContract<PluginRecordListSource>(\n 'core.record-lists',\n { multiple: true },\n)\n\n/**\n * Publishes the list source for one record kind. The owner is the loader's\n * marker when a register fn is running, else `options.pluginId`; with neither\n * the registration throws. A kind another plugin lists throws naming both.\n */\nexport function registerPluginRecordListSource(\n kind: string,\n source: PluginRecordListSource,\n options?: { pluginId?: string },\n): void {\n const key = kind.trim()\n if (!key) throw new Error('a record list source needs a record kind')\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(`the record list source for \"${key}\" was registered with no owner`)\n }\n const incumbent = resolvePluginServices(PLUGIN_RECORD_LISTS).find((entry) => entry.key === key)\n if (incumbent && incumbent.pluginId !== pluginId) {\n throw new Error(\n `record kind \"${key}\" is already listed by \"${incumbent.pluginId}\"; refused \"${pluginId}\"`,\n )\n }\n registerPluginService(PLUGIN_RECORD_LISTS, source, { pluginId, key })\n}\n\n/** The list source for a kind, with the plugin that keeps it, or `null` when none does here. */\nexport function pluginRecordListSource(\n kind: string,\n): { pluginId: string; source: PluginRecordListSource } | null {\n const key = kind.trim()\n const entry = resolvePluginServices(PLUGIN_RECORD_LISTS).find((one) => one.key === key)\n return entry ? { pluginId: entry.pluginId, source: entry.impl } : null\n}\n\n/**\n * The query a reader listens to for a kind's records — with the console's own\n * collection listener, so it is bounded, retried and reported like every\n * other list — or `null` when no plugin keeps the kind here or the scope has\n * none.\n */\nexport function pluginRecordListQuery(\n kind: string,\n firestore: Firestore,\n request: PluginRecordListRequest,\n): Query<DocumentData> | null {\n return pluginRecordListSource(kind)?.source.query(firestore, request) ?? null\n}\n\n/**\n * The base a reader walks `kind` from in a scope, or `null` — no plugin keeps\n * the kind here, it offers no walk, or the scope has none.\n */\nexport function pluginRecordListWalk(\n kind: string,\n firestore: Firestore,\n scope: PluginRecordListScope,\n): Query<DocumentData> | null {\n return pluginRecordListSource(kind)?.source.walk?.(firestore, scope) ?? null\n}\n\n/**\n * One record of `kind`'s document, or `null` — no plugin keeps the kind here,\n * it offers no document, or the scope has none.\n */\nexport function pluginRecordListDoc(\n kind: string,\n firestore: Firestore,\n request: PluginRecordListScope & { id: string },\n): DocumentReference<DocumentData> | null {\n return pluginRecordListSource(kind)?.source.doc?.(firestore, request) ?? null\n}\n\n/**\n * The query for named records of `kind` — at most\n * {@link PLUGIN_RECORD_LIST_IDS_MAX} ids, the rest left for the next chunk —\n * or `null` when no plugin keeps the kind here, its source reads none by\n * name, or there is no id to ask for.\n */\nexport function pluginRecordListByIdsQuery(\n kind: string,\n firestore: Firestore,\n request: PluginRecordListByIdsRequest,\n): Query<DocumentData> | null {\n const ids = request.ids.filter(Boolean).slice(0, PLUGIN_RECORD_LIST_IDS_MAX)\n if (!ids.length) return null\n return pluginRecordListSource(kind)?.source.byIds?.(firestore, { ...request, ids }) ?? null\n}\n\n/**\n * The documents a reader's listener answered for `kind`, as their owner\n * shares them: each row's id is read from `idField` (the listener's), and a\n * row the owner leaves out (deleted, unnamed, not this reader's) is not\n * answered. None where no plugin keeps the kind here. `request` is the one\n * the query was built from: hand it back, so the owner can apply what the\n * query could not state.\n */\nexport function pluginRecordsFromRows(\n kind: string,\n rows: ReadonlyArray<Readonly<Record<string, unknown>>> | null | undefined,\n idField = '$id',\n request?: PluginRecordListRequest,\n): PluginIndexedRecord[] {\n const source = pluginRecordListSource(kind)?.source\n if (!source) return []\n return (rows ?? [])\n .map((row) => source.record(String(row[idField] ?? ''), row, request))\n .filter((record): record is PluginIndexedRecord => record !== null)\n}\n"],"names":["getRegisteringPluginId","definePluginServiceContract","registerPluginService","resolvePluginServices","PLUGIN_RECORD_LIST_IDS_MAX","PLUGIN_RECORD_LISTS","multiple","registerPluginRecordListSource","kind","source","options","key","trim","Error","pluginId","incumbent","find","entry","pluginRecordListSource","one","impl","pluginRecordListQuery","firestore","request","query","pluginRecordListWalk","scope","walk","pluginRecordListDoc","doc","pluginRecordListByIdsQuery","ids","filter","Boolean","slice","length","byIds","pluginRecordsFromRows","rows","idField","map","row","record","String"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,sBAAsB,QAAQ,qCAAiC;AAExE,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,QAChB,uBAAmB;AAmF1B;;;CAGC,GACD,OAAO,MAAMC,6BAA6B,GAAE;AAsD5C,OAAO,MAAMC,sBAAsBJ,4BACjC,qBACA;IAAEK,UAAU;AAAK,G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"],"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 { DocumentData, DocumentReference, Firestore, Query } from 'firebase/firestore'\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport type { PluginIndexedRecord } from './plugin-record-index'\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginServices,\n} from './plugin-services'\n\n/**\n * A plugin's records, LISTED in the console for another plugin's picker or\n * check (AGL-3080) — the browser's half of `plugin-record-index`.\n *\n * A plugin that offers records it does not own — an automation step picking\n * a dataset, a reference check confirming a workflow still exists, a deal\n * picking a product — used to query the owner's collection from the browser\n * itself: the path, the filter the owner's security rules require, the field\n * a name is in, what a deleted one looks like. Each breaks the day the owner\n * changes one, and none is visible to `check:lib-boundaries`.\n *\n * So the owner publishes a LIST SOURCE for each record kind it keeps: the\n * query the signed-in member's read of a scope is proved by, and how one\n * stored document reads as a record — an id, a name and the facts the owner\n * chooses to share, in the shape its registration documents, the same shape\n * its server index answers. The reader runs the query with its own listener\n * (`pluginRecordListQuery`) and reads the rows back through the owner\n * (`pluginRecordsFromRows`), and never learns where the records are stored.\n *\n * ## Not registered is an answer\n *\n * No source for a kind means no plugin keeps it in this console — the owner is\n * not installed or not loaded. A reader treats that as \"none here\" and says\n * so, rather than reaching for the collection itself.\n *\n * ## One source per kind\n *\n * A second plugin registering a source for a kind another plugin already\n * keeps is refused, naming both, and the incumbent keeps serving.\n */\n\n/** Which records a reader lists. */\nexport interface PluginRecordListRequest {\n /** The organization the records belong to, where the kind is org-scoped. */\n orgId?: string | null\n /**\n * The site the records are listed for. An org-scoped kind narrows to what\n * the site may use; `null` lists the organization's own view, which only an\n * organization-wide reader may hold.\n */\n hostId?: string | null\n /** What a person typed, matched the owner's way; absent lists the scope. */\n search?: string | null\n /**\n * The signed-in member's own scope tokens, where they are not\n * organization-wide and no site is named: an org-scoped kind narrows to\n * what they may see, which is the filter the security rules require of\n * them. Absent for an organization-wide reader; a named site's narrowing\n * wins over it, and a site's own kind has no use for it.\n */\n memberScope?: readonly string[] | null\n /**\n * Only the records installed from this listing — the `listingId` of their\n * install stamp (`app-utils/artifact-provenance.ts`), matched wherever the\n * owner keeps it. A kind that is never installed answers none.\n */\n installedFrom?: string | null\n /**\n * The consent group the named site presents as (`app-utils/consent-groups`),\n * for a kind whose records say different things to different groups — a\n * person's name as one brand knows them. Absent reads as the site alone.\n */\n consentGroupId?: string | null\n /**\n * The signed-in member, for a kind some of whose records are one member's\n * own — a saved view kept private: the owner leaves out what this member\n * may not list. Absent reads as nobody's, which lists only what is shared.\n */\n viewerUid?: string | null\n /** The most documents the query may answer — a reader asks one past its window to learn it was cut. */\n limit: number\n}\n\n/** Where a reader walks a kind, or opens one record of it. */\nexport interface PluginRecordListScope {\n /** The organization, where no site is named. */\n orgId?: string | null\n /** The site; named, it wins over the organization. */\n hostId?: string | null\n}\n\n/**\n * The most records one by-name read asks for: Firestore's `in` takes thirty\n * values, so a reader with more asks in chunks.\n */\nexport const PLUGIN_RECORD_LIST_IDS_MAX = 30\n\n/** Named records of a scope, for a reader that already holds their ids. */\nexport type PluginRecordListByIdsRequest = Omit<PluginRecordListRequest, 'limit' | 'search'> & {\n /** At most {@link PLUGIN_RECORD_LIST_IDS_MAX}; the owner reads no more. */\n ids: readonly string[]\n}\n\nexport interface PluginRecordListSource {\n /**\n * The query the signed-in member's read of the scope is proved by, at most\n * `limit` documents, or `null` for a scope the kind has none in (a site-only\n * kind asked at the organization, a search with nothing to match).\n */\n query(firestore: Firestore, request: PluginRecordListRequest): Query<DocumentData> | null\n /**\n * The query for NAMED records of the scope — a reader that holds ids from\n * somewhere else, an attribution naming the submission it credits — or\n * `null` where none can be read. Optional: a source without it answers no\n * by-name read, and the reader treats every id as one it could not find.\n */\n byIds?(firestore: Firestore, request: PluginRecordListByIdsRequest): Query<DocumentData> | null\n /**\n * One stored document as the owner shares it, or `null` to leave it out\n * (deleted, unnamed, or not the reader's to list). `request` is the one the\n * query was built from, when the reader hands it back: a rule the query\n * cannot state — a site's view of an org-wide row, a member's own view —\n * is applied here.\n */\n record(\n id: string,\n data: Readonly<Record<string, unknown>>,\n request?: PluginRecordListRequest,\n ): PluginIndexedRecord | null\n /**\n * The base a reader WALKS the kind from with the console's paged list query\n * (`useListQuery`), which adds its filters, its order and its pages over the\n * stored fields the owner documents for the kind — or `null` for a scope\n * the kind has none in. For a kind whose reader pages a whole list rather\n * than picking from a window. Where the rules admit a read only narrowed by\n * a field, the owner's registration says which, and the reader adds it.\n */\n walk?(firestore: Firestore, scope: PluginRecordListScope): Query<DocumentData> | null\n /**\n * One record's document, for a reader that opens it whole or changes what\n * the owner documents a reader may change — the security rules hold the\n * rest — or `null` for a scope the kind has none in.\n */\n doc?(\n firestore: Firestore,\n request: PluginRecordListScope & { id: string },\n ): DocumentReference<DocumentData> | null\n /**\n * What each record is called in a picker beside the others it lists\n * (AGL-4047): its name, with what tells it apart where two in the list share\n * one, by id. Optional: without it a picker shows names. `hostNames` (site id\n * to name) is what the reader knows of the workspace's sites, for a label\n * that names one.\n */\n pickerLabels?(\n records: readonly PluginIndexedRecord[],\n context?: { hostNames?: Readonly<Record<string, string>> },\n ): Readonly<Record<string, string>>\n}\n\nexport const PLUGIN_RECORD_LISTS = definePluginServiceContract<PluginRecordListSource>(\n 'core.record-lists',\n { multiple: true },\n)\n\n/**\n * Publishes the list source for one record kind. The owner is the loader's\n * marker when a register fn is running, else `options.pluginId`; with neither\n * the registration throws. A kind another plugin lists throws naming both.\n */\nexport function registerPluginRecordListSource(\n kind: string,\n source: PluginRecordListSource,\n options?: { pluginId?: string },\n): void {\n const key = kind.trim()\n if (!key) throw new Error('a record list source needs a record kind')\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(`the record list source for \"${key}\" was registered with no owner`)\n }\n const incumbent = resolvePluginServices(PLUGIN_RECORD_LISTS).find((entry) => entry.key === key)\n if (incumbent && incumbent.pluginId !== pluginId) {\n throw new Error(\n `record kind \"${key}\" is already listed by \"${incumbent.pluginId}\"; refused \"${pluginId}\"`,\n )\n }\n registerPluginService(PLUGIN_RECORD_LISTS, source, { pluginId, key })\n}\n\n/** The list source for a kind, with the plugin that keeps it, or `null` when none does here. */\nexport function pluginRecordListSource(\n kind: string,\n): { pluginId: string; source: PluginRecordListSource } | null {\n const key = kind.trim()\n const entry = resolvePluginServices(PLUGIN_RECORD_LISTS).find((one) => one.key === key)\n return entry ? { pluginId: entry.pluginId, source: entry.impl } : null\n}\n\n/**\n * The query a reader listens to for a kind's records — with the console's own\n * collection listener, so it is bounded, retried and reported like every\n * other list — or `null` when no plugin keeps the kind here or the scope has\n * none.\n */\nexport function pluginRecordListQuery(\n kind: string,\n firestore: Firestore,\n request: PluginRecordListRequest,\n): Query<DocumentData> | null {\n return pluginRecordListSource(kind)?.source.query(firestore, request) ?? null\n}\n\n/**\n * The base a reader walks `kind` from in a scope, or `null` — no plugin keeps\n * the kind here, it offers no walk, or the scope has none.\n */\nexport function pluginRecordListWalk(\n kind: string,\n firestore: Firestore,\n scope: PluginRecordListScope,\n): Query<DocumentData> | null {\n return pluginRecordListSource(kind)?.source.walk?.(firestore, scope) ?? null\n}\n\n/**\n * One record of `kind`'s document, or `null` — no plugin keeps the kind here,\n * it offers no document, or the scope has none.\n */\nexport function pluginRecordListDoc(\n kind: string,\n firestore: Firestore,\n request: PluginRecordListScope & { id: string },\n): DocumentReference<DocumentData> | null {\n return pluginRecordListSource(kind)?.source.doc?.(firestore, request) ?? null\n}\n\n/**\n * The query for named records of `kind` — at most\n * {@link PLUGIN_RECORD_LIST_IDS_MAX} ids, the rest left for the next chunk —\n * or `null` when no plugin keeps the kind here, its source reads none by\n * name, or there is no id to ask for.\n */\nexport function pluginRecordListByIdsQuery(\n kind: string,\n firestore: Firestore,\n request: PluginRecordListByIdsRequest,\n): Query<DocumentData> | null {\n const ids = request.ids.filter(Boolean).slice(0, PLUGIN_RECORD_LIST_IDS_MAX)\n if (!ids.length) return null\n return pluginRecordListSource(kind)?.source.byIds?.(firestore, { ...request, ids }) ?? null\n}\n\n/**\n * The documents a reader's listener answered for `kind`, as their owner\n * shares them: each row's id is read from `idField` (the listener's), and a\n * row the owner leaves out (deleted, unnamed, not this reader's) is not\n * answered. None where no plugin keeps the kind here. `request` is the one\n * the query was built from: hand it back, so the owner can apply what the\n * query could not state.\n */\nexport function pluginRecordsFromRows(\n kind: string,\n rows: ReadonlyArray<Readonly<Record<string, unknown>>> | null | undefined,\n idField = '$id',\n request?: PluginRecordListRequest,\n): PluginIndexedRecord[] {\n const source = pluginRecordListSource(kind)?.source\n if (!source) return []\n return (rows ?? [])\n .map((row) => source.record(String(row[idField] ?? ''), row, request))\n .filter((record): record is PluginIndexedRecord => record !== null)\n}\n\n/**\n * What each of `records` is called in a picker beside the others (AGL-4047),\n * by id: the owner's answer where it gives one, else the record's name. A\n * kind no plugin keeps here answers names.\n */\nexport function pluginRecordPickerLabels(\n kind: string,\n records: readonly PluginIndexedRecord[],\n context?: { hostNames?: Readonly<Record<string, string>> },\n): Record<string, string> {\n const labels = pluginRecordListSource(kind)?.source.pickerLabels?.(records, context) ?? {}\n return Object.fromEntries(records.map((record) => [record.id, labels[record.id] || record.name]))\n}\n"],"names":["getRegisteringPluginId","definePluginServiceContract","registerPluginService","resolvePluginServices","PLUGIN_RECORD_LIST_IDS_MAX","PLUGIN_RECORD_LISTS","multiple","registerPluginRecordListSource","kind","source","options","key","trim","Error","pluginId","incumbent","find","entry","pluginRecordListSource","one","impl","pluginRecordListQuery","firestore","request","query","pluginRecordListWalk","scope","walk","pluginRecordListDoc","doc","pluginRecordListByIdsQuery","ids","filter","Boolean","slice","length","byIds","pluginRecordsFromRows","rows","idField","map","row","record","String","pluginRecordPickerLabels","records","context","labels","pickerLabels","Object","fromEntries","id","name"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,sBAAsB,QAAQ,qCAAiC;AAExE,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,QAChB,uBAAmB;AAmF1B;;;CAGC,GACD,OAAO,MAAMC,6BAA6B,GAAE;AAiE5C,OAAO,MAAMC,sBAAsBJ,4BACjC,qBACA;IAAEK,UAAU;AAAK,GAClB;AAED;;;;CAIC,GACD,OAAO,SAASC,+BACdC,IAAY,EACZC,MAA8B,EAC9BC,OAA+B;QAIbV,MAAAA;IAFlB,MAAMW,MAAMH,KAAKI,IAAI;IACrB,IAAI,CAACD,KAAK,MAAM,IAAIE,MAAM;IAC1B,MAAMC,WAAW,EAACd,QAAAA,0BAAAA,oCAAAA,0BAA4BU,2BAAAA,QAASI,QAAQ,YAA7Cd,OAAiD,IAAIY,IAAI;IAC3E,IAAI,CAACE,UAAU;QACb,MAAM,IAAID,MAAM,CAAC,4BAA4B,EAAEF,IAAI,8BAA8B,CAAC;IACpF;IACA,MAAMI,YAAYZ,sBAAsBE,qBAAqBW,IAAI,CAAC,CAACC,QAAUA,MAAMN,GAAG,KAAKA;IAC3F,IAAII,aAAaA,UAAUD,QAAQ,KAAKA,UAAU;QAChD,MAAM,IAAID,MACR,CAAC,aAAa,EAAEF,IAAI,wBAAwB,EAAEI,UAAUD,QAAQ,CAAC,YAAY,EAAEA,SAAS,CAAC,CAAC;IAE9F;IACAZ,sBAAsBG,qBAAqBI,QAAQ;QAAEK;QAAUH;IAAI;AACrE;AAEA,8FAA8F,GAC9F,OAAO,SAASO,uBACdV,IAAY;IAEZ,MAAMG,MAAMH,KAAKI,IAAI;IACrB,MAAMK,QAAQd,sBAAsBE,qBAAqBW,IAAI,CAAC,CAACG,MAAQA,IAA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;QAElBL;IAAf,MAAMT,UAASS,0BAAAA,uBAAuBV,0BAAvBU,wBAA8BT,MAAM;IACnD,IAAI,CAACA,QAAQ,OAAO,EAAE;IACtB,OAAO,CAAC6B,eAAAA,OAAQ,EAAE,EACfE,GAAG,CAAC,CAACC;YAA6BA;eAArBhC,OAAOiC,MAAM,CAACC,QAAOF,eAAAA,GAAG,CAACF,QAAQ,YAAZE,eAAgB,KAAKA,KAAKlB;OAC5DS,MAAM,CAAC,CAACU,SAA0CA,WAAW;AAClE;AAEA;;;;CAIC,GACD,OAAO,SAASE,yBACdpC,IAAY,EACZqC,OAAuC,EACvCC,OAA0D;;QAE3C5B,6CAAAA;IAAf,MAAM6B,kBAAS7B,0BAAAA,uBAAuBV,2BAAvBU,8CAAAA,wBAA8BT,MAAM,CAACuC,YAAY,qBAAjD9B,iDAAAA,wBAA8BT,MAAM,EAAgBoC,SAASC,2BAAY,CAAC;IACzF,OAAOG,OAAOC,WAAW,CAACL,QAAQL,GAAG,CAAC,CAACE,SAAW;YAACA,OAAOS,EAAE;YAAEJ,MAAM,CAACL,OAAOS,EAAE,CAAC,IAAIT,OAAOU,IAAI;SAAC;AACjG"}
@@ -96,6 +96,23 @@ export interface VideoEmbedProviderDeclaration {
96
96
  playerPath: string;
97
97
  /** The query every player address carries, in this order. */
98
98
  playerQuery?: readonly VideoEmbedPlayerParam[];
99
+ /**
100
+ * The one origin the host serves its own still of each film from
101
+ * (AGL-4140), for a host that publishes one at an address built from the
102
+ * media id alone. With {@link posterPath}, or neither: a host with no
103
+ * public still keeps asking the author for a poster.
104
+ *
105
+ * A visitor's browser loads the still from here on page load, before any
106
+ * press, so a page that shows one sends the host the visitor's IP address
107
+ * and user-agent. That is a recipient the platform chooses, not the author:
108
+ * the Video element shows it only where `release_video_embed_posters` is on
109
+ * for the site's workspace (`SiteContextValue.videoEmbedPosters`), and the
110
+ * published page's `img-src` admits {@link videoEmbedPosterOrigins} only
111
+ * there.
112
+ */
113
+ posterOrigin?: string;
114
+ /** The still's path on {@link posterOrigin}; `{id}` is the media id. */
115
+ posterPath?: string;
99
116
  }
100
117
  /** A declaration, with the plugin that made it. */
101
118
  export interface ResolvedVideoEmbedProvider extends VideoEmbedProviderDeclaration {
@@ -133,5 +150,16 @@ export declare function videoEmbedPlayerSrc(value: unknown, options?: VideoEmbed
133
150
  * `frame-src` admits for the Video element.
134
151
  */
135
152
  export declare function videoEmbedPlayerOrigins(providers?: readonly ResolvedVideoEmbedProvider[]): string[];
153
+ /**
154
+ * The host's own still of the film a declared host's link names
155
+ * (AGL-4140), rebuilt from the media id and the declaration alone, or
156
+ * `undefined` for a host that publishes none and for any other value.
157
+ */
158
+ export declare function videoEmbedPosterSrc(value: unknown, providers?: readonly ResolvedVideoEmbedProvider[]): string | undefined;
159
+ /**
160
+ * Every origin a declared host serves its stills from: what a published
161
+ * page's `img-src` admits, where the site's workspace shows them.
162
+ */
163
+ export declare function videoEmbedPosterOrigins(providers?: readonly ResolvedVideoEmbedProvider[]): string[];
136
164
  /** The declared hosts' names, as an author knows them. */
137
165
  export declare function videoEmbedProviderLabels(providers?: readonly ResolvedVideoEmbedProvider[]): string[];
@@ -177,6 +177,27 @@ function onDomain(hostname, domains) {
177
177
  ...new Set(providers.map((provider)=>provider.playerOrigin))
178
178
  ];
179
179
  }
180
+ /**
181
+ * The host's own still of the film a declared host's link names
182
+ * (AGL-4140), rebuilt from the media id and the declaration alone, or
183
+ * `undefined` for a host that publishes none and for any other value.
184
+ */ export function videoEmbedPosterSrc(value, providers) {
185
+ var _ref;
186
+ const embed = videoEmbedOf(value, providers);
187
+ const { posterOrigin, posterPath } = (_ref = embed == null ? void 0 : embed.provider) != null ? _ref : {};
188
+ if (!embed || !posterOrigin || !posterPath) return undefined;
189
+ return `${posterOrigin}${posterPath.replace(ID_PLACEHOLDER, embed.mediaId)}`;
190
+ }
191
+ /**
192
+ * Every origin a declared host serves its stills from: what a published
193
+ * page's `img-src` admits, where the site's workspace shows them.
194
+ */ export function videoEmbedPosterOrigins(providers = videoEmbedProviders()) {
195
+ return [
196
+ ...new Set(providers.flatMap((provider)=>provider.posterOrigin && provider.posterPath ? [
197
+ provider.posterOrigin
198
+ ] : []))
199
+ ];
200
+ }
180
201
  /** The declared hosts' names, as an author knows them. */ export function videoEmbedProviderLabels(providers = videoEmbedProviders()) {
181
202
  return providers.map((provider)=>provider.label);
182
203
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-provider.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\n/**\n * A VIDEO HOST WHOSE OWN PLAYER A VIDEO PLAYS IN (AGL-3080).\n *\n * Some video hosts hand an author a link to a page, not to a file: the film\n * plays only inside the host's player, framed from the host's origin. The\n * Video element recognizes such a link, keeps only the media id it names,\n * and frames the host's player for it. Core never names a host. A plugin\n * DECLARES one — the domains its links live on, where in the path the media\n * id sits, the one origin its player is framed from, and the query that\n * player reads — and core's resolvers answer from the declarations alone.\n *\n * This sits beside `media-delivery-provider.ts` and is not that seam. A\n * delivery provider is where the platform serves ITS OWN copy of a file\n * from; an embed provider is a host whose player the author chose, which the\n * platform never serves a byte of.\n *\n * ## Only the media id survives\n *\n * The string an author pasted never reaches a frame. {@link videoEmbedOf}\n * reads the media id out of it, and every address below is rebuilt from the\n * declaration and that id alone, so a declared player is framed from its\n * declared origin and nowhere else. That closed set is what lets a published\n * page's `frame-src` name the origin for every site\n * ({@link videoEmbedPlayerOrigins}). The id must match the declaration's own\n * pattern AND {@link SAFE_MEDIA_ID}, so no declaration can widen the path it\n * is put into.\n *\n * ## Compiled, and deliberately without a runtime registrar\n *\n * The readers are the published page and its policy: the Video element that\n * plays the link, the `VideoObject` a crawler reads, the built-in entry page\n * that decides whether a featured film can play, and the tenant middleware\n * whose `frame-src` must admit the player. None of them loads a plugin's\n * console code, and the middleware loads no plugin at all. A registry one of\n * them had not filled would render a customer's link as a `<video>` pointed\n * at an HTML page, or refuse the frame, and nothing would go red — the\n * AGL-3025 shape, on the customer's own film. So a first-party plugin\n * declares its hosts under `videoEmbedProviders` in `plugins.config.json`,\n * `tools/scripts/generate-plugin-manifests.mjs` validates and compiles them,\n * and this module reads the compiled list.\n *\n * A marketplace plugin cannot add a host this way, and that is the point\n * rather than a gap: a declaration widens every published page's\n * `frame-src`, which is a platform decision, not one a plugin's own code\n * makes at runtime.\n *\n * ## What \"absent\" means\n *\n * A link no declaration recognizes is an ordinary URL, rendered exactly as\n * any other link is. Removing a declaration therefore turns its links back\n * into plain URLs, which play nothing — so the declaring plugin's spec holds\n * the declaration to the links it must keep reading.\n */\n\nimport { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from './video-embed-providers.generated'\n\n/**\n * A choice the Video element makes for each player it frames. A declaration\n * says how its player spells each one it supports; one it does not name is\n * never sent.\n *\n * - `autoPlay` — start as soon as the player is ready. ON unless the caller\n * passes exactly `false`: the usual frame is the one a visitor's press\n * loads, and a second play button inside it would ask them twice.\n * - `doNotTrack` — ask the host not to record the viewing session.\n * - `muted` — start without sound.\n * - `loop` — restart at the end.\n */\nexport type VideoEmbedPlayerOption = 'autoPlay' | 'doNotTrack' | 'muted' | 'loop'\n\nexport const VIDEO_EMBED_PLAYER_OPTIONS: readonly VideoEmbedPlayerOption[] = [\n 'autoPlay',\n 'doNotTrack',\n 'muted',\n 'loop',\n]\n\nexport type VideoEmbedPlayerOptions = Partial<\n Record<VideoEmbedPlayerOption, boolean>\n>\n\n/**\n * One query parameter of a player address, in the order the declaration\n * lists them. Either `value`, sent on every address, or an `option` whose\n * state picks `on` or `off`; a state with no value leaves the parameter out.\n *\n * A value may name the media id as `{id}` (AGL-4140), for a player that\n * repeats it in its query, such as one that loops a single film only as a\n * playlist of itself. The id has passed both patterns by then, so it\n * carries nothing a query could be widened with.\n */\nexport type VideoEmbedPlayerParam =\n | { param: string; value: string }\n | {\n param: string\n option: VideoEmbedPlayerOption\n on?: string\n off?: string\n }\n\n/**\n * A link shape {@link VideoEmbedProviderDeclaration.mediaIdPaths} cannot\n * describe (AGL-4140): one that names its media id in the QUERY rather than\n * the path (`/watch?v={id}`), or one only some of the host's domains use (a\n * short-link domain whose whole path is the id, a shape that would misread a\n * page on the host's main domain).\n */\nexport interface VideoEmbedMediaIdLink {\n /**\n * A regular expression over the link's PATH, anchored at both ends. Without\n * {@link param}, its first capture group is the media id.\n */\n path: string\n /** The query parameter that holds the media id, for a path that names none. */\n param?: string\n /**\n * The declared domains this shape is read on, each matched as\n * {@link VideoEmbedProviderDeclaration.domains} are; every declared domain\n * when absent.\n */\n domains?: readonly string[]\n}\n\nexport interface VideoEmbedProviderDeclaration {\n /** Stable id, unique across plugins. */\n id: string\n /** The host's name as an author knows it, for labels and help text. */\n label: string\n /**\n * The domains a link's host must equal or end in (after a dot). Exact or\n * dot-anchored only, so a domain that merely contains one is refused.\n */\n domains: readonly string[]\n /**\n * Regular expressions over a link's PATH, anchored at both ends, whose\n * first capture group is the media id. The host is checked separately,\n * against {@link domains}.\n */\n mediaIdPaths: readonly string[]\n /** The link shapes the paths cannot describe, tried after them. */\n mediaIdLinks?: readonly VideoEmbedMediaIdLink[]\n /** A regular expression, anchored at both ends, a media id must match. */\n mediaIdPattern: string\n /** The one origin the host's player is framed from. */\n playerOrigin: string\n /** The player page's path on {@link playerOrigin}; `{id}` is the media id. */\n playerPath: string\n /** The query every player address carries, in this order. */\n playerQuery?: readonly VideoEmbedPlayerParam[]\n}\n\n/** A declaration, with the plugin that made it. */\nexport interface ResolvedVideoEmbedProvider\n extends VideoEmbedProviderDeclaration {\n pluginId: string\n}\n\n/** A link a declared host recognized. */\nexport interface VideoEmbed {\n provider: ResolvedVideoEmbedProvider\n /** The media id the link named, and nothing else of it. */\n mediaId: string\n /**\n * The player page with no per-visit options — what a `VideoObject`\n * publishes as `embedUrl`.\n */\n embedUrl: string\n}\n\n/**\n * The floor every media id stands on, whatever a declaration's own pattern\n * admits: no separator, dot, query or fragment can reach the player path.\n */\nconst SAFE_MEDIA_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The placeholder a `playerPath` names the media id with. */\nconst ID_PLACEHOLDER = '{id}'\n\n/** Every host a first-party plugin declares. */\nexport function videoEmbedProviders(): readonly ResolvedVideoEmbedProvider[] {\n return FIRST_PARTY_VIDEO_EMBED_PROVIDERS\n}\n\ninterface CompiledLink {\n path: RegExp\n param?: string\n domains?: readonly string[]\n}\n\ninterface CompiledProvider {\n paths: RegExp[]\n links: CompiledLink[]\n mediaId: RegExp\n}\n\nconst compiled = new WeakMap<VideoEmbedProviderDeclaration, CompiledProvider>()\n\nfunction compile(provider: VideoEmbedProviderDeclaration): CompiledProvider {\n let answer = compiled.get(provider)\n if (!answer) {\n answer = {\n paths: provider.mediaIdPaths.map((source) => new RegExp(source)),\n links: (provider.mediaIdLinks ?? []).map((link) => ({\n path: new RegExp(link.path),\n param: link.param,\n domains: link.domains,\n })),\n mediaId: new RegExp(provider.mediaIdPattern),\n }\n compiled.set(provider, answer)\n }\n return answer\n}\n\n/** The media id a link shape reads from this URL, unchecked. */\nfunction linkMediaId(link: CompiledLink, url: URL): string | undefined {\n if (link.domains && !onDomain(url.hostname, link.domains)) return undefined\n const match = link.path.exec(url.pathname)\n if (!match) return undefined\n return link.param ? (url.searchParams.get(link.param) ?? undefined) : match[1]\n}\n\nfunction onDomain(hostname: string, domains: readonly string[]): boolean {\n return domains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n )\n}\n\n/**\n * The declared host a link belongs to, with the media id it names, or\n * `undefined` for anything else: a value that is not an http(s) URL, a host\n * nothing declares, or a path that names no id the host's pattern accepts.\n */\nexport function videoEmbedOf(\n value: unknown,\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): VideoEmbed | undefined {\n if (typeof value !== 'string' || !providers.length) return undefined\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n for (const provider of providers) {\n if (!onDomain(url.hostname, provider.domains)) continue\n const { paths, links, mediaId } = compile(provider)\n const candidates = [\n ...paths.map((pattern) => pattern.exec(url.pathname)?.[1]),\n ...links.map((link) => linkMediaId(link, url)),\n ]\n for (const id of candidates) {\n if (id && mediaId.test(id) && SAFE_MEDIA_ID.test(id)) {\n return {\n provider,\n mediaId: id,\n embedUrl: `${provider.playerOrigin}${provider.playerPath.replace(ID_PLACEHOLDER, id)}`,\n }\n }\n }\n }\n return undefined\n}\n\n/** The player page for a declared host's link, with no per-visit options. */\nexport function videoEmbedUrl(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n return videoEmbedOf(value, providers)?.embedUrl\n}\n\n/**\n * The address of a declared host's player frame for this visit, carrying the\n * declaration's query in its own order. See {@link VideoEmbedPlayerOption}\n * for what each option means and which way it defaults.\n */\nexport function videoEmbedPlayerSrc(\n value: unknown,\n options: VideoEmbedPlayerOptions = {},\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n if (!embed) return undefined\n const params = new URLSearchParams()\n const withId = (value: string) =>\n value.split(ID_PLACEHOLDER).join(embed.mediaId)\n for (const entry of embed.provider.playerQuery ?? []) {\n if ('value' in entry) {\n params.set(entry.param, withId(entry.value))\n continue\n }\n const on =\n entry.option === 'autoPlay'\n ? options.autoPlay !== false\n : Boolean(options[entry.option])\n const sent = on ? entry.on : entry.off\n if (sent !== undefined) params.set(entry.param, withId(sent))\n }\n const query = params.toString()\n return query ? `${embed.embedUrl}?${query}` : embed.embedUrl\n}\n\n/**\n * Every origin a declared player is framed from: what a published page's\n * `frame-src` admits for the Video element.\n */\nexport function videoEmbedPlayerOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [...new Set(providers.map((provider) => provider.playerOrigin))]\n}\n\n/** The declared hosts' names, as an author knows them. */\nexport function videoEmbedProviderLabels(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return providers.map((provider) => provider.label)\n}\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS","VIDEO_EMBED_PLAYER_OPTIONS","SAFE_MEDIA_ID","ID_PLACEHOLDER","videoEmbedProviders","compiled","WeakMap","compile","provider","answer","get","paths","mediaIdPaths","map","source","RegExp","links","mediaIdLinks","link","path","param","domains","mediaId","mediaIdPattern","set","linkMediaId","url","onDomain","hostname","undefined","match","exec","pathname","searchParams","some","domain","endsWith","videoEmbedOf","value","providers","length","URL","trim","protocol","candidates","pattern","id","test","embedUrl","playerOrigin","playerPath","replace","videoEmbedUrl","videoEmbedPlayerSrc","options","embed","params","URLSearchParams","withId","split","join","entry","playerQuery","on","option","autoPlay","Boolean","sent","off","query","toString","videoEmbedPlayerOrigins","Set","videoEmbedProviderLabels","label"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDC,GAED,SAASA,iCAAiC,QAAQ,uCAAmC;AAgBrF,OAAO,MAAMC,6BAAgE;IAC3E;IACA;IACA;IACA;CACD,CAAA;AA8FD;;;CAGC,GACD,MAAMC,gBAAgB;AAEtB,4DAA4D,GAC5D,MAAMC,iBAAiB;AAEvB,8CAA8C,GAC9C,OAAO,SAASC;IACd,OAAOJ;AACT;AAcA,MAAMK,WAAW,IAAIC;AAErB,SAASC,QAAQC,QAAuC;IACtD,IAAIC,SAASJ,SAASK,GAAG,CAACF;IAC1B,IAAI,CAACC,QAAQ;YAGDD;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pBL,OAAOhC,GAAG,CAACqC,MAAMzC,KAAK,EAAEsC,OAAOG,MAAMvB,KAAK;YAC1C;QACF;QACA,MAAMyB,KACJF,MAAMG,MAAM,KAAK,aACbV,QAAQW,QAAQ,KAAK,QACrBC,QAAQZ,OAAO,CAACO,MAAMG,MAAM,CAAC;QACnC,MAAMG,OAAOJ,KAAKF,MAAME,EAAE,GAAGF,MAAMO,GAAG;QACtC,IAAID,SAAStC,WAAW2B,OAAOhC,GAAG,CAACqC,MAAMzC,KAAK,EAAEsC,OAAOS;IACzD;IACA,MAAME,QAAQb,OAAOc,QAAQ;IAC7B,OAAOD,QAAQ,GAAGd,MAAMP,QAAQ,CAAC,CAAC,EAAEqB,OAAO,GAAGd,MAAMP,QAAQ;AAC9D;AAEA;;;CAGC,GACD,OAAO,SAASuB,wBACdhC,YAAmDnC,qBAAqB;IAExE,OAAO;WAAI,IAAIoE,IAAIjC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASyC,YAAY;KAAG;AACzE;AAEA,wDAAwD,GACxD,OAAO,SAASwB,yBACdlC,YAAmDnC,qBAAqB;IAExE,OAAOmC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASkE,KAAK;AACnD"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-provider.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\n/**\n * A VIDEO HOST WHOSE OWN PLAYER A VIDEO PLAYS IN (AGL-3080).\n *\n * Some video hosts hand an author a link to a page, not to a file: the film\n * plays only inside the host's player, framed from the host's origin. The\n * Video element recognizes such a link, keeps only the media id it names,\n * and frames the host's player for it. Core never names a host. A plugin\n * DECLARES one — the domains its links live on, where in the path the media\n * id sits, the one origin its player is framed from, and the query that\n * player reads — and core's resolvers answer from the declarations alone.\n *\n * This sits beside `media-delivery-provider.ts` and is not that seam. A\n * delivery provider is where the platform serves ITS OWN copy of a file\n * from; an embed provider is a host whose player the author chose, which the\n * platform never serves a byte of.\n *\n * ## Only the media id survives\n *\n * The string an author pasted never reaches a frame. {@link videoEmbedOf}\n * reads the media id out of it, and every address below is rebuilt from the\n * declaration and that id alone, so a declared player is framed from its\n * declared origin and nowhere else. That closed set is what lets a published\n * page's `frame-src` name the origin for every site\n * ({@link videoEmbedPlayerOrigins}). The id must match the declaration's own\n * pattern AND {@link SAFE_MEDIA_ID}, so no declaration can widen the path it\n * is put into.\n *\n * ## Compiled, and deliberately without a runtime registrar\n *\n * The readers are the published page and its policy: the Video element that\n * plays the link, the `VideoObject` a crawler reads, the built-in entry page\n * that decides whether a featured film can play, and the tenant middleware\n * whose `frame-src` must admit the player. None of them loads a plugin's\n * console code, and the middleware loads no plugin at all. A registry one of\n * them had not filled would render a customer's link as a `<video>` pointed\n * at an HTML page, or refuse the frame, and nothing would go red — the\n * AGL-3025 shape, on the customer's own film. So a first-party plugin\n * declares its hosts under `videoEmbedProviders` in `plugins.config.json`,\n * `tools/scripts/generate-plugin-manifests.mjs` validates and compiles them,\n * and this module reads the compiled list.\n *\n * A marketplace plugin cannot add a host this way, and that is the point\n * rather than a gap: a declaration widens every published page's\n * `frame-src`, which is a platform decision, not one a plugin's own code\n * makes at runtime.\n *\n * ## What \"absent\" means\n *\n * A link no declaration recognizes is an ordinary URL, rendered exactly as\n * any other link is. Removing a declaration therefore turns its links back\n * into plain URLs, which play nothing — so the declaring plugin's spec holds\n * the declaration to the links it must keep reading.\n */\n\nimport { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from './video-embed-providers.generated'\n\n/**\n * A choice the Video element makes for each player it frames. A declaration\n * says how its player spells each one it supports; one it does not name is\n * never sent.\n *\n * - `autoPlay` — start as soon as the player is ready. ON unless the caller\n * passes exactly `false`: the usual frame is the one a visitor's press\n * loads, and a second play button inside it would ask them twice.\n * - `doNotTrack` — ask the host not to record the viewing session.\n * - `muted` — start without sound.\n * - `loop` — restart at the end.\n */\nexport type VideoEmbedPlayerOption = 'autoPlay' | 'doNotTrack' | 'muted' | 'loop'\n\nexport const VIDEO_EMBED_PLAYER_OPTIONS: readonly VideoEmbedPlayerOption[] = [\n 'autoPlay',\n 'doNotTrack',\n 'muted',\n 'loop',\n]\n\nexport type VideoEmbedPlayerOptions = Partial<\n Record<VideoEmbedPlayerOption, boolean>\n>\n\n/**\n * One query parameter of a player address, in the order the declaration\n * lists them. Either `value`, sent on every address, or an `option` whose\n * state picks `on` or `off`; a state with no value leaves the parameter out.\n *\n * A value may name the media id as `{id}` (AGL-4140), for a player that\n * repeats it in its query, such as one that loops a single film only as a\n * playlist of itself. The id has passed both patterns by then, so it\n * carries nothing a query could be widened with.\n */\nexport type VideoEmbedPlayerParam =\n | { param: string; value: string }\n | {\n param: string\n option: VideoEmbedPlayerOption\n on?: string\n off?: string\n }\n\n/**\n * A link shape {@link VideoEmbedProviderDeclaration.mediaIdPaths} cannot\n * describe (AGL-4140): one that names its media id in the QUERY rather than\n * the path (`/watch?v={id}`), or one only some of the host's domains use (a\n * short-link domain whose whole path is the id, a shape that would misread a\n * page on the host's main domain).\n */\nexport interface VideoEmbedMediaIdLink {\n /**\n * A regular expression over the link's PATH, anchored at both ends. Without\n * {@link param}, its first capture group is the media id.\n */\n path: string\n /** The query parameter that holds the media id, for a path that names none. */\n param?: string\n /**\n * The declared domains this shape is read on, each matched as\n * {@link VideoEmbedProviderDeclaration.domains} are; every declared domain\n * when absent.\n */\n domains?: readonly string[]\n}\n\nexport interface VideoEmbedProviderDeclaration {\n /** Stable id, unique across plugins. */\n id: string\n /** The host's name as an author knows it, for labels and help text. */\n label: string\n /**\n * The domains a link's host must equal or end in (after a dot). Exact or\n * dot-anchored only, so a domain that merely contains one is refused.\n */\n domains: readonly string[]\n /**\n * Regular expressions over a link's PATH, anchored at both ends, whose\n * first capture group is the media id. The host is checked separately,\n * against {@link domains}.\n */\n mediaIdPaths: readonly string[]\n /** The link shapes the paths cannot describe, tried after them. */\n mediaIdLinks?: readonly VideoEmbedMediaIdLink[]\n /** A regular expression, anchored at both ends, a media id must match. */\n mediaIdPattern: string\n /** The one origin the host's player is framed from. */\n playerOrigin: string\n /** The player page's path on {@link playerOrigin}; `{id}` is the media id. */\n playerPath: string\n /** The query every player address carries, in this order. */\n playerQuery?: readonly VideoEmbedPlayerParam[]\n /**\n * The one origin the host serves its own still of each film from\n * (AGL-4140), for a host that publishes one at an address built from the\n * media id alone. With {@link posterPath}, or neither: a host with no\n * public still keeps asking the author for a poster.\n *\n * A visitor's browser loads the still from here on page load, before any\n * press, so a page that shows one sends the host the visitor's IP address\n * and user-agent. That is a recipient the platform chooses, not the author:\n * the Video element shows it only where `release_video_embed_posters` is on\n * for the site's workspace (`SiteContextValue.videoEmbedPosters`), and the\n * published page's `img-src` admits {@link videoEmbedPosterOrigins} only\n * there.\n */\n posterOrigin?: string\n /** The still's path on {@link posterOrigin}; `{id}` is the media id. */\n posterPath?: string\n}\n\n/** A declaration, with the plugin that made it. */\nexport interface ResolvedVideoEmbedProvider\n extends VideoEmbedProviderDeclaration {\n pluginId: string\n}\n\n/** A link a declared host recognized. */\nexport interface VideoEmbed {\n provider: ResolvedVideoEmbedProvider\n /** The media id the link named, and nothing else of it. */\n mediaId: string\n /**\n * The player page with no per-visit options — what a `VideoObject`\n * publishes as `embedUrl`.\n */\n embedUrl: string\n}\n\n/**\n * The floor every media id stands on, whatever a declaration's own pattern\n * admits: no separator, dot, query or fragment can reach the player path.\n */\nconst SAFE_MEDIA_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The placeholder a `playerPath` names the media id with. */\nconst ID_PLACEHOLDER = '{id}'\n\n/** Every host a first-party plugin declares. */\nexport function videoEmbedProviders(): readonly ResolvedVideoEmbedProvider[] {\n return FIRST_PARTY_VIDEO_EMBED_PROVIDERS\n}\n\ninterface CompiledLink {\n path: RegExp\n param?: string\n domains?: readonly string[]\n}\n\ninterface CompiledProvider {\n paths: RegExp[]\n links: CompiledLink[]\n mediaId: RegExp\n}\n\nconst compiled = new WeakMap<VideoEmbedProviderDeclaration, CompiledProvider>()\n\nfunction compile(provider: VideoEmbedProviderDeclaration): CompiledProvider {\n let answer = compiled.get(provider)\n if (!answer) {\n answer = {\n paths: provider.mediaIdPaths.map((source) => new RegExp(source)),\n links: (provider.mediaIdLinks ?? []).map((link) => ({\n path: new RegExp(link.path),\n param: link.param,\n domains: link.domains,\n })),\n mediaId: new RegExp(provider.mediaIdPattern),\n }\n compiled.set(provider, answer)\n }\n return answer\n}\n\n/** The media id a link shape reads from this URL, unchecked. */\nfunction linkMediaId(link: CompiledLink, url: URL): string | undefined {\n if (link.domains && !onDomain(url.hostname, link.domains)) return undefined\n const match = link.path.exec(url.pathname)\n if (!match) return undefined\n return link.param ? (url.searchParams.get(link.param) ?? undefined) : match[1]\n}\n\nfunction onDomain(hostname: string, domains: readonly string[]): boolean {\n return domains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n )\n}\n\n/**\n * The declared host a link belongs to, with the media id it names, or\n * `undefined` for anything else: a value that is not an http(s) URL, a host\n * nothing declares, or a path that names no id the host's pattern accepts.\n */\nexport function videoEmbedOf(\n value: unknown,\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): VideoEmbed | undefined {\n if (typeof value !== 'string' || !providers.length) return undefined\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n for (const provider of providers) {\n if (!onDomain(url.hostname, provider.domains)) continue\n const { paths, links, mediaId } = compile(provider)\n const candidates = [\n ...paths.map((pattern) => pattern.exec(url.pathname)?.[1]),\n ...links.map((link) => linkMediaId(link, url)),\n ]\n for (const id of candidates) {\n if (id && mediaId.test(id) && SAFE_MEDIA_ID.test(id)) {\n return {\n provider,\n mediaId: id,\n embedUrl: `${provider.playerOrigin}${provider.playerPath.replace(ID_PLACEHOLDER, id)}`,\n }\n }\n }\n }\n return undefined\n}\n\n/** The player page for a declared host's link, with no per-visit options. */\nexport function videoEmbedUrl(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n return videoEmbedOf(value, providers)?.embedUrl\n}\n\n/**\n * The address of a declared host's player frame for this visit, carrying the\n * declaration's query in its own order. See {@link VideoEmbedPlayerOption}\n * for what each option means and which way it defaults.\n */\nexport function videoEmbedPlayerSrc(\n value: unknown,\n options: VideoEmbedPlayerOptions = {},\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n if (!embed) return undefined\n const params = new URLSearchParams()\n const withId = (value: string) =>\n value.split(ID_PLACEHOLDER).join(embed.mediaId)\n for (const entry of embed.provider.playerQuery ?? []) {\n if ('value' in entry) {\n params.set(entry.param, withId(entry.value))\n continue\n }\n const on =\n entry.option === 'autoPlay'\n ? options.autoPlay !== false\n : Boolean(options[entry.option])\n const sent = on ? entry.on : entry.off\n if (sent !== undefined) params.set(entry.param, withId(sent))\n }\n const query = params.toString()\n return query ? `${embed.embedUrl}?${query}` : embed.embedUrl\n}\n\n/**\n * Every origin a declared player is framed from: what a published page's\n * `frame-src` admits for the Video element.\n */\nexport function videoEmbedPlayerOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [...new Set(providers.map((provider) => provider.playerOrigin))]\n}\n\n/**\n * The host's own still of the film a declared host's link names\n * (AGL-4140), rebuilt from the media id and the declaration alone, or\n * `undefined` for a host that publishes none and for any other value.\n */\nexport function videoEmbedPosterSrc(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n const { posterOrigin, posterPath } = embed?.provider ?? {}\n if (!embed || !posterOrigin || !posterPath) return undefined\n return `${posterOrigin}${posterPath.replace(ID_PLACEHOLDER, embed.mediaId)}`\n}\n\n/**\n * Every origin a declared host serves its stills from: what a published\n * page's `img-src` admits, where the site's workspace shows them.\n */\nexport function videoEmbedPosterOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [\n ...new Set(\n providers.flatMap((provider) =>\n provider.posterOrigin && provider.posterPath ? [provider.posterOrigin] : [],\n ),\n ),\n ]\n}\n\n/** The declared hosts' names, as an author knows them. */\nexport function videoEmbedProviderLabels(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return providers.map((provider) => provider.label)\n}\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS","VIDEO_EMBED_PLAYER_OPTIONS","SAFE_MEDIA_ID","ID_PLACEHOLDER","videoEmbedProviders","compiled","WeakMap","compile","provider","answer","get","paths","mediaIdPaths","map","source","RegExp","links","mediaIdLinks","link","path","param","domains","mediaId","mediaIdPattern","set","linkMediaId","url","onDomain","hostname","undefined","match","exec","pathname","searchParams","some","domain","endsWith","videoEmbedOf","value","providers","length","URL","trim","protocol","candidates","pattern","id","test","embedUrl","playerOrigin","playerPath","replace","videoEmbedUrl","videoEmbedPlayerSrc","options","embed","params","URLSearchParams","withId","split","join","entry","playerQuery","on","option","autoPlay","Boolean","sent","off","query","toString","videoEmbedPlayerOrigins","Set","videoEmbedPosterSrc","posterOrigin","posterPath","videoEmbedPosterOrigins","flatMap","videoEmbedProviderLabels","label"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDC,GAED,SAASA,iCAAiC,QAAQ,uCAAmC;AAgBrF,OAAO,MAAMC,6BAAgE;IAC3E;IACA;IACA;IACA;CACD,CAAA;AA+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GACD,OAAO,SAASsD,wBACdrC,YAAmDnC,qBAAqB;IAExE,OAAO;WACF,IAAIoE,IACLjC,UAAUsC,OAAO,CAAC,CAACrE,WACjBA,SAASkE,YAAY,IAAIlE,SAASmE,UAAU,GAAG;gBAACnE,SAASkE,YAAY;aAAC,GAAG,EAAE;KAGhF;AACH;AAEA,wDAAwD,GACxD,OAAO,SAASI,yBACdvC,YAAmDnC,qBAAqB;IAExE,OAAOmC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASuE,KAAK;AACnD"}
@@ -154,7 +154,9 @@
154
154
  "option": "loop",
155
155
  "on": "{id}"
156
156
  }
157
- ]
157
+ ],
158
+ "posterOrigin": "https://i.ytimg.com",
159
+ "posterPath": "/vi/{id}/hqdefault.jpg"
158
160
  }
159
161
  ];
160
162
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-providers.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-plugin-manifests.mjs\n *\n * Every video host whose own player the Video element frames, declared by\n * the plugin that plays it (AGL-3080). Core names no host. Its own file,\n * not the catalog's, so a published page with no video downloads none of\n * it (AGL-4140).\n */\n\nimport type { ResolvedVideoEmbedProvider } from './video-embed-provider'\n\nexport const FIRST_PARTY_VIDEO_EMBED_PROVIDERS: readonly ResolvedVideoEmbedProvider[] = [\n {\n \"pluginId\": \"mui\",\n \"id\": \"vimeo\",\n \"label\": \"Vimeo\",\n \"domains\": [\n \"vimeo.com\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/channels\\\\/[^/]+\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/groups\\\\/[^/]+\\\\/videos\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/showcase\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/album\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/manage\\\\/videos\\\\/([0-9]+)\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[0-9]{6,12}$\",\n \"playerOrigin\": \"https://player.vimeo.com\",\n \"playerPath\": \"/video/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"dnt\",\n \"value\": \"1\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"wistia\",\n \"label\": \"Wistia\",\n \"domains\": [\n \"wistia.com\",\n \"wistia.net\",\n \"wi.st\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/medias\\\\/([^/]+)(?:\\\\/manage)?\\\\/?$\",\n \"^\\\\/m\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/iframe\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/medias\\\\/([^/.]+)(?:\\\\.jsonp?)?\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[a-z0-9]{10}$\",\n \"playerOrigin\": \"https://fast.wistia.net\",\n \"playerPath\": \"/embed/iframe/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoPlay\",\n \"option\": \"autoPlay\",\n \"on\": \"true\",\n \"off\": \"false\"\n },\n {\n \"param\": \"roundedPlayer\",\n \"value\": \"false\"\n },\n {\n \"param\": \"doNotTrack\",\n \"option\": \"doNotTrack\",\n \"on\": \"true\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"true\"\n },\n {\n \"param\": \"endVideoBehavior\",\n \"option\": \"loop\",\n \"on\": \"loop\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"youtube\",\n \"label\": \"YouTube\",\n \"domains\": [\n \"youtube.com\",\n \"youtube-nocookie.com\",\n \"youtu.be\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/embed\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/shorts\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/live\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/v\\\\/([^/]+)\\\\/?$\"\n ],\n \"mediaIdLinks\": [\n {\n \"path\": \"^\\\\/watch\\\\/?$\",\n \"param\": \"v\",\n \"domains\": [\n \"youtube.com\"\n ]\n },\n {\n \"path\": \"^\\\\/([^/]+)\\\\/?$\",\n \"domains\": [\n \"youtu.be\"\n ]\n }\n ],\n \"mediaIdPattern\": \"^(?!videoseries$)[A-Za-z0-9_-]{11}$\",\n \"playerOrigin\": \"https://www.youtube-nocookie.com\",\n \"playerPath\": \"/embed/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"playsinline\",\n \"value\": \"1\"\n },\n {\n \"param\": \"mute\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n },\n {\n \"param\": \"playlist\",\n \"option\": \"loop\",\n \"on\": \"{id}\"\n }\n ]\n },\n]\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS"],"mappings":"AAAA;;;;;;;;CAQC,GAID,OAAO,MAAMA,oCAA2E;IACtF;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,gBAAgB;YACd;gBACE,QAAQ;gBACR,SAAS;gBACT,WAAW;oBACT;iBACD;YACH;YACA;gBACE,QAAQ;gBACR,WAAW;oBACT;iBACD;YACH;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;CACD,CAAA"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-providers.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-plugin-manifests.mjs\n *\n * Every video host whose own player the Video element frames, declared by\n * the plugin that plays it (AGL-3080). Core names no host. Its own file,\n * not the catalog's, so a published page with no video downloads none of\n * it (AGL-4140).\n */\n\nimport type { ResolvedVideoEmbedProvider } from './video-embed-provider'\n\nexport const FIRST_PARTY_VIDEO_EMBED_PROVIDERS: readonly ResolvedVideoEmbedProvider[] = [\n {\n \"pluginId\": \"mui\",\n \"id\": \"vimeo\",\n \"label\": \"Vimeo\",\n \"domains\": [\n \"vimeo.com\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/channels\\\\/[^/]+\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/groups\\\\/[^/]+\\\\/videos\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/showcase\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/album\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/manage\\\\/videos\\\\/([0-9]+)\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[0-9]{6,12}$\",\n \"playerOrigin\": \"https://player.vimeo.com\",\n \"playerPath\": \"/video/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"dnt\",\n \"value\": \"1\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"wistia\",\n \"label\": \"Wistia\",\n \"domains\": [\n \"wistia.com\",\n \"wistia.net\",\n \"wi.st\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/medias\\\\/([^/]+)(?:\\\\/manage)?\\\\/?$\",\n \"^\\\\/m\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/iframe\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/medias\\\\/([^/.]+)(?:\\\\.jsonp?)?\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[a-z0-9]{10}$\",\n \"playerOrigin\": \"https://fast.wistia.net\",\n \"playerPath\": \"/embed/iframe/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoPlay\",\n \"option\": \"autoPlay\",\n \"on\": \"true\",\n \"off\": \"false\"\n },\n {\n \"param\": \"roundedPlayer\",\n \"value\": \"false\"\n },\n {\n \"param\": \"doNotTrack\",\n \"option\": \"doNotTrack\",\n \"on\": \"true\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"true\"\n },\n {\n \"param\": \"endVideoBehavior\",\n \"option\": \"loop\",\n \"on\": \"loop\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"youtube\",\n \"label\": \"YouTube\",\n \"domains\": [\n \"youtube.com\",\n \"youtube-nocookie.com\",\n \"youtu.be\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/embed\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/shorts\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/live\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/v\\\\/([^/]+)\\\\/?$\"\n ],\n \"mediaIdLinks\": [\n {\n \"path\": \"^\\\\/watch\\\\/?$\",\n \"param\": \"v\",\n \"domains\": [\n \"youtube.com\"\n ]\n },\n {\n \"path\": \"^\\\\/([^/]+)\\\\/?$\",\n \"domains\": [\n \"youtu.be\"\n ]\n }\n ],\n \"mediaIdPattern\": \"^(?!videoseries$)[A-Za-z0-9_-]{11}$\",\n \"playerOrigin\": \"https://www.youtube-nocookie.com\",\n \"playerPath\": \"/embed/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"playsinline\",\n \"value\": \"1\"\n },\n {\n \"param\": \"mute\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n },\n {\n \"param\": \"playlist\",\n \"option\": \"loop\",\n \"on\": \"{id}\"\n }\n ],\n \"posterOrigin\": \"https://i.ytimg.com\",\n \"posterPath\": \"/vi/{id}/hqdefault.jpg\"\n },\n]\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS"],"mappings":"AAAA;;;;;;;;CAQC,GAID,OAAO,MAAMA,oCAA2E;IACtF;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,gBAAgB;YACd;gBACE,QAAQ;gBACR,SAAS;gBACT,WAAW;oBACT;iBACD;YACH;YACA;gBACE,QAAQ;gBACR,WAAW;oBACT;iBACD;YACH;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;QACD,gBAAgB;QAChB,cAAc;IAChB;CACD,CAAA"}