@aglyn/aglyn 1.0.0-beta.220 → 1.0.0-beta.222

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 (358) hide show
  1. package/package.json +15 -11
  2. package/src/lib/app-utils/agent-openapi.js +1 -1
  3. package/src/lib/app-utils/agent-openapi.js.map +1 -1
  4. package/src/lib/app-utils/analytics-events.d.ts +3 -2
  5. package/src/lib/app-utils/analytics-events.js +3 -2
  6. package/src/lib/app-utils/analytics-events.js.map +1 -1
  7. package/src/lib/app-utils/api-plugins.d.ts +30 -0
  8. package/src/lib/app-utils/api-plugins.js +24 -1
  9. package/src/lib/app-utils/api-plugins.js.map +1 -1
  10. package/src/lib/app-utils/author-html.d.ts +1 -1
  11. package/src/lib/app-utils/author-html.js.map +1 -1
  12. package/src/lib/app-utils/bandwidth-cap.d.ts +12 -1
  13. package/src/lib/app-utils/bandwidth-cap.js +17 -1
  14. package/src/lib/app-utils/bandwidth-cap.js.map +1 -1
  15. package/src/lib/app-utils/compose-reusable-components.d.ts +19 -0
  16. package/src/lib/app-utils/compose-reusable-components.js +116 -26
  17. package/src/lib/app-utils/compose-reusable-components.js.map +1 -1
  18. package/src/lib/app-utils/console-routes.d.ts +4 -0
  19. package/src/lib/app-utils/console-routes.js +3 -0
  20. package/src/lib/app-utils/console-routes.js.map +1 -1
  21. package/src/lib/app-utils/contacts.d.ts +71 -0
  22. package/src/lib/app-utils/contacts.js +55 -0
  23. package/src/lib/app-utils/contacts.js.map +1 -1
  24. package/src/lib/app-utils/contexts.d.ts +1 -0
  25. package/src/lib/app-utils/contexts.js +1 -0
  26. package/src/lib/app-utils/contexts.js.map +1 -1
  27. package/src/lib/app-utils/crm-email-templates.js +21 -4
  28. package/src/lib/app-utils/crm-email-templates.js.map +1 -1
  29. package/src/lib/app-utils/crm-kinds.d.ts +2 -0
  30. package/src/lib/app-utils/crm-kinds.js +1 -0
  31. package/src/lib/app-utils/crm-kinds.js.map +1 -1
  32. package/src/lib/app-utils/crm.d.ts +1199 -67
  33. package/src/lib/app-utils/crm.js +1951 -310
  34. package/src/lib/app-utils/crm.js.map +1 -1
  35. package/src/lib/app-utils/csv-import.d.ts +10 -38
  36. package/src/lib/app-utils/csv-import.js +17 -42
  37. package/src/lib/app-utils/csv-import.js.map +1 -1
  38. package/src/lib/app-utils/csv.d.ts +32 -11
  39. package/src/lib/app-utils/csv.js +43 -5
  40. package/src/lib/app-utils/csv.js.map +1 -1
  41. package/src/lib/app-utils/default-site.d.ts +116 -0
  42. package/src/lib/app-utils/default-site.js +1024 -0
  43. package/src/lib/app-utils/default-site.js.map +1 -0
  44. package/src/lib/app-utils/docs-help.generated.d.ts +23 -23
  45. package/src/lib/app-utils/docs-help.generated.js +47 -10
  46. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  47. package/src/lib/app-utils/docs-index.generated.js +746 -151
  48. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  49. package/src/lib/app-utils/draft-placeholders.d.ts +76 -0
  50. package/src/lib/app-utils/draft-placeholders.js +115 -0
  51. package/src/lib/app-utils/draft-placeholders.js.map +1 -0
  52. package/src/lib/app-utils/entity-picker-context.d.ts +19 -15
  53. package/src/lib/app-utils/entity-picker-context.js +4 -4
  54. package/src/lib/app-utils/entity-picker-context.js.map +1 -1
  55. package/src/lib/app-utils/expand-repeatables.d.ts +66 -10
  56. package/src/lib/app-utils/expand-repeatables.js +88 -14
  57. package/src/lib/app-utils/expand-repeatables.js.map +1 -1
  58. package/src/lib/app-utils/forms.d.ts +33 -22
  59. package/src/lib/app-utils/forms.js +47 -28
  60. package/src/lib/app-utils/forms.js.map +1 -1
  61. package/src/lib/app-utils/full-use-cost.d.ts +277 -0
  62. package/src/lib/app-utils/full-use-cost.js +421 -0
  63. package/src/lib/app-utils/full-use-cost.js.map +1 -0
  64. package/src/lib/app-utils/health-report.js +33 -0
  65. package/src/lib/app-utils/health-report.js.map +1 -1
  66. package/src/lib/app-utils/leaving-notice.d.ts +96 -0
  67. package/src/lib/app-utils/leaving-notice.js +157 -0
  68. package/src/lib/app-utils/leaving-notice.js.map +1 -0
  69. package/src/lib/app-utils/llms-txt.d.ts +20 -0
  70. package/src/lib/app-utils/llms-txt.js +7 -1
  71. package/src/lib/app-utils/llms-txt.js.map +1 -1
  72. package/src/lib/app-utils/media-asset-facts.d.ts +16 -1
  73. package/src/lib/app-utils/media-asset-facts.js +40 -13
  74. package/src/lib/app-utils/media-asset-facts.js.map +1 -1
  75. package/src/lib/app-utils/media-bandwidth.d.ts +52 -0
  76. package/src/lib/app-utils/media-bandwidth.js +94 -0
  77. package/src/lib/app-utils/media-bandwidth.js.map +1 -0
  78. package/src/lib/app-utils/media-ref.d.ts +241 -33
  79. package/src/lib/app-utils/media-ref.js +324 -43
  80. package/src/lib/app-utils/media-ref.js.map +1 -1
  81. package/src/lib/app-utils/media-src.d.ts +8 -8
  82. package/src/lib/app-utils/media-src.js +27 -11
  83. package/src/lib/app-utils/media-src.js.map +1 -1
  84. package/src/lib/app-utils/media-takedown-reach.d.ts +4 -1
  85. package/src/lib/app-utils/media-takedown-reach.js +6 -3
  86. package/src/lib/app-utils/media-takedown-reach.js.map +1 -1
  87. package/src/lib/app-utils/notifications.d.ts +1 -1
  88. package/src/lib/app-utils/notifications.js +2 -0
  89. package/src/lib/app-utils/notifications.js.map +1 -1
  90. package/src/lib/app-utils/operator-alerts.js +17 -0
  91. package/src/lib/app-utils/operator-alerts.js.map +1 -1
  92. package/src/lib/app-utils/organizations.d.ts +51 -2
  93. package/src/lib/app-utils/organizations.js +56 -3
  94. package/src/lib/app-utils/organizations.js.map +1 -1
  95. package/src/lib/app-utils/page-record-sources.d.ts +87 -0
  96. package/src/lib/app-utils/page-record-sources.js +53 -0
  97. package/src/lib/app-utils/page-record-sources.js.map +1 -0
  98. package/src/lib/app-utils/paid-media-source.d.ts +3 -7
  99. package/src/lib/app-utils/paid-media-source.js +5 -19
  100. package/src/lib/app-utils/paid-media-source.js.map +1 -1
  101. package/src/lib/app-utils/person-erasure.d.ts +5 -2
  102. package/src/lib/app-utils/person-erasure.js.map +1 -1
  103. package/src/lib/app-utils/picklists.d.ts +187 -0
  104. package/src/lib/app-utils/picklists.js +320 -0
  105. package/src/lib/app-utils/picklists.js.map +1 -0
  106. package/src/lib/app-utils/plan-entitlements.d.ts +220 -50
  107. package/src/lib/app-utils/plan-entitlements.js +309 -115
  108. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  109. package/src/lib/app-utils/realm-host-surface.generated.js +2 -0
  110. package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
  111. package/src/lib/app-utils/release-flags.d.ts +1 -1
  112. package/src/lib/app-utils/release-flags.js +11 -0
  113. package/src/lib/app-utils/release-flags.js.map +1 -1
  114. package/src/lib/app-utils/rendered-widths.d.ts +121 -0
  115. package/src/lib/app-utils/rendered-widths.js +211 -0
  116. package/src/lib/app-utils/rendered-widths.js.map +1 -0
  117. package/src/lib/app-utils/repeat-sources.d.ts +2 -1
  118. package/src/lib/app-utils/repeat-sources.js.map +1 -1
  119. package/src/lib/app-utils/screen-link-context-value.d.ts +7 -0
  120. package/src/lib/app-utils/screen-link-context-value.js.map +1 -1
  121. package/src/lib/app-utils/screen-link-context.js +14 -2
  122. package/src/lib/app-utils/screen-link-context.js.map +1 -1
  123. package/src/lib/app-utils/screen-route.d.ts +157 -36
  124. package/src/lib/app-utils/screen-route.js +191 -41
  125. package/src/lib/app-utils/screen-route.js.map +1 -1
  126. package/src/lib/app-utils/seo-audit.d.ts +11 -1
  127. package/src/lib/app-utils/seo-audit.js +33 -13
  128. package/src/lib/app-utils/seo-audit.js.map +1 -1
  129. package/src/lib/app-utils/seo-keywords.d.ts +11 -0
  130. package/src/lib/app-utils/seo-keywords.js +19 -5
  131. package/src/lib/app-utils/seo-keywords.js.map +1 -1
  132. package/src/lib/app-utils/seo-page-facts.d.ts +47 -4
  133. package/src/lib/app-utils/seo-page-facts.js +136 -31
  134. package/src/lib/app-utils/seo-page-facts.js.map +1 -1
  135. package/src/lib/app-utils/seo-site-scan.d.ts +42 -4
  136. package/src/lib/app-utils/seo-site-scan.js +113 -12
  137. package/src/lib/app-utils/seo-site-scan.js.map +1 -1
  138. package/src/lib/app-utils/server.d.ts +5 -4
  139. package/src/lib/app-utils/server.js +14 -5
  140. package/src/lib/app-utils/server.js.map +1 -1
  141. package/src/lib/app-utils/site-icon-set.d.ts +195 -0
  142. package/src/lib/app-utils/site-icon-set.js +351 -0
  143. package/src/lib/app-utils/site-icon-set.js.map +1 -0
  144. package/src/lib/app-utils/site-interactions.d.ts +101 -4
  145. package/src/lib/app-utils/site-interactions.js +120 -4
  146. package/src/lib/app-utils/site-interactions.js.map +1 -1
  147. package/src/lib/app-utils/starter-template-nodes.d.ts +7 -0
  148. package/src/lib/app-utils/starter-template-nodes.js +3 -0
  149. package/src/lib/app-utils/starter-template-nodes.js.map +1 -1
  150. package/src/lib/app-utils/starter-templates.d.ts +5 -19
  151. package/src/lib/app-utils/starter-templates.js +5 -49
  152. package/src/lib/app-utils/starter-templates.js.map +1 -1
  153. package/src/lib/app-utils/transfer-launcher-context.d.ts +136 -0
  154. package/src/lib/app-utils/transfer-launcher-context.js +23 -0
  155. package/src/lib/app-utils/transfer-launcher-context.js.map +1 -0
  156. package/src/lib/app-utils/transfer-resume-import.d.ts +39 -0
  157. package/src/lib/app-utils/transfer-resume-import.js +128 -0
  158. package/src/lib/app-utils/transfer-resume-import.js.map +1 -0
  159. package/src/lib/app-utils/upgrade-proposal.d.ts +66 -0
  160. package/src/lib/app-utils/upgrade-proposal.js +95 -0
  161. package/src/lib/app-utils/upgrade-proposal.js.map +1 -0
  162. package/src/lib/app-utils/utc-month.d.ts +33 -0
  163. package/src/lib/app-utils/utc-month.js +35 -0
  164. package/src/lib/app-utils/utc-month.js.map +1 -0
  165. package/src/lib/app-utils/visitor-record-ceiling.d.ts +4 -4
  166. package/src/lib/app-utils/visitor-record-ceiling.js +4 -4
  167. package/src/lib/app-utils/visitor-record-ceiling.js.map +1 -1
  168. package/src/lib/app-utils/wire-nodes.d.ts +39 -19
  169. package/src/lib/app-utils/wire-nodes.js +120 -34
  170. package/src/lib/app-utils/wire-nodes.js.map +1 -1
  171. package/src/lib/data-transfer/access.d.ts +74 -0
  172. package/src/lib/data-transfer/access.js +93 -0
  173. package/src/lib/data-transfer/access.js.map +1 -0
  174. package/src/lib/data-transfer/derive.d.ts +246 -0
  175. package/src/lib/data-transfer/derive.js +1007 -0
  176. package/src/lib/data-transfer/derive.js.map +1 -0
  177. package/src/lib/data-transfer/export-file.d.ts +46 -0
  178. package/src/lib/data-transfer/export-file.js +146 -0
  179. package/src/lib/data-transfer/export-file.js.map +1 -0
  180. package/src/lib/data-transfer/field-catalog.d.ts +134 -0
  181. package/src/lib/data-transfer/field-catalog.js +278 -0
  182. package/src/lib/data-transfer/field-catalog.js.map +1 -0
  183. package/src/lib/data-transfer/header-match.d.ts +129 -0
  184. package/src/lib/data-transfer/header-match.js +367 -0
  185. package/src/lib/data-transfer/header-match.js.map +1 -0
  186. package/src/lib/data-transfer/index.d.ts +34 -0
  187. package/src/lib/data-transfer/index.js +40 -0
  188. package/src/lib/data-transfer/index.js.map +1 -0
  189. package/src/lib/data-transfer/job.d.ts +190 -0
  190. package/src/lib/data-transfer/job.js +229 -0
  191. package/src/lib/data-transfer/job.js.map +1 -0
  192. package/src/lib/data-transfer/lookup.d.ts +45 -0
  193. package/src/lib/data-transfer/lookup.js +71 -0
  194. package/src/lib/data-transfer/lookup.js.map +1 -0
  195. package/src/lib/data-transfer/match.d.ts +99 -0
  196. package/src/lib/data-transfer/match.js +244 -0
  197. package/src/lib/data-transfer/match.js.map +1 -0
  198. package/src/lib/data-transfer/package-plan.d.ts +205 -0
  199. package/src/lib/data-transfer/package-plan.js +475 -0
  200. package/src/lib/data-transfer/package-plan.js.map +1 -0
  201. package/src/lib/data-transfer/package.d.ts +181 -0
  202. package/src/lib/data-transfer/package.js +426 -0
  203. package/src/lib/data-transfer/package.js.map +1 -0
  204. package/src/lib/data-transfer/picklist-map.d.ts +139 -0
  205. package/src/lib/data-transfer/picklist-map.js +271 -0
  206. package/src/lib/data-transfer/picklist-map.js.map +1 -0
  207. package/src/lib/data-transfer/plan.d.ts +176 -0
  208. package/src/lib/data-transfer/plan.js +451 -0
  209. package/src/lib/data-transfer/plan.js.map +1 -0
  210. package/src/lib/data-transfer/policy.d.ts +170 -0
  211. package/src/lib/data-transfer/policy.js +378 -0
  212. package/src/lib/data-transfer/policy.js.map +1 -0
  213. package/src/lib/data-transfer/resource.d.ts +211 -0
  214. package/src/lib/data-transfer/resource.js +241 -0
  215. package/src/lib/data-transfer/resource.js.map +1 -0
  216. package/src/lib/data-transfer/review.d.ts +70 -0
  217. package/src/lib/data-transfer/review.js +233 -0
  218. package/src/lib/data-transfer/review.js.map +1 -0
  219. package/src/lib/data-transfer/similarity.d.ts +40 -0
  220. package/src/lib/data-transfer/similarity.js +106 -0
  221. package/src/lib/data-transfer/similarity.js.map +1 -0
  222. package/src/lib/data-transfer/site-package.d.ts +365 -0
  223. package/src/lib/data-transfer/site-package.js +1077 -0
  224. package/src/lib/data-transfer/site-package.js.map +1 -0
  225. package/src/lib/data-transfer/source.d.ts +74 -0
  226. package/src/lib/data-transfer/source.js +293 -0
  227. package/src/lib/data-transfer/source.js.map +1 -0
  228. package/src/lib/data-transfer/transfer-api.d.ts +898 -0
  229. package/src/lib/data-transfer/transfer-api.js +107 -0
  230. package/src/lib/data-transfer/transfer-api.js.map +1 -0
  231. package/src/lib/foundation/definitions/org-billing.types.d.ts +31 -0
  232. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  233. package/src/lib/foundation/definitions/organization.types.d.ts +42 -1
  234. package/src/lib/foundation/definitions/organization.types.js.map +1 -1
  235. package/src/lib/foundation/definitions/platform.types.d.ts +6 -4
  236. package/src/lib/foundation/definitions/platform.types.js.map +1 -1
  237. package/src/lib/foundation/index.d.ts +1 -1
  238. package/src/lib/foundation/index.js.map +1 -1
  239. package/src/lib/plugin-manager/feature-plugins.d.ts +91 -2
  240. package/src/lib/plugin-manager/feature-plugins.js +48 -3
  241. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  242. package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +56 -0
  243. package/src/lib/plugin-manager/first-party-plugins.generated.js +1132 -27
  244. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  245. package/src/lib/plugin-manager/index.d.ts +0 -1
  246. package/src/lib/plugin-manager/index.js +0 -1
  247. package/src/lib/plugin-manager/index.js.map +1 -1
  248. package/src/lib/plugin-manager/interaction-recipes.d.ts +142 -0
  249. package/src/lib/plugin-manager/interaction-recipes.js +104 -0
  250. package/src/lib/plugin-manager/interaction-recipes.js.map +1 -0
  251. package/src/lib/plugin-manager/interaction-step-checks.d.ts +66 -0
  252. package/src/lib/plugin-manager/interaction-step-checks.js +86 -0
  253. package/src/lib/plugin-manager/interaction-step-checks.js.map +1 -0
  254. package/src/lib/plugin-manager/plugin-artifact-types.d.ts +235 -0
  255. package/src/lib/plugin-manager/plugin-artifact-types.js +99 -0
  256. package/src/lib/plugin-manager/plugin-artifact-types.js.map +1 -0
  257. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +8 -0
  258. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
  259. package/src/lib/plugin-manager/plugin-conversion-credit.d.ts +216 -0
  260. package/src/lib/plugin-manager/plugin-conversion-credit.js +91 -0
  261. package/src/lib/plugin-manager/plugin-conversion-credit.js.map +1 -0
  262. package/src/lib/plugin-manager/plugin-entity-pickers.d.ts +83 -0
  263. package/src/lib/plugin-manager/plugin-entity-pickers.js +87 -0
  264. package/src/lib/plugin-manager/plugin-entity-pickers.js.map +1 -0
  265. package/src/lib/plugin-manager/plugin-host-resources.d.ts +6 -0
  266. package/src/lib/plugin-manager/plugin-host-resources.js +6 -1
  267. package/src/lib/plugin-manager/plugin-host-resources.js.map +1 -1
  268. package/src/lib/plugin-manager/plugin-intake-gates.d.ts +75 -0
  269. package/src/lib/plugin-manager/plugin-intake-gates.js +49 -0
  270. package/src/lib/plugin-manager/plugin-intake-gates.js.map +1 -0
  271. package/src/lib/plugin-manager/plugin-jobs.d.ts +5 -5
  272. package/src/lib/plugin-manager/plugin-jobs.js +7 -7
  273. package/src/lib/plugin-manager/plugin-jobs.js.map +1 -1
  274. package/src/lib/plugin-manager/plugin-live-paths.d.ts +70 -0
  275. package/src/lib/plugin-manager/plugin-live-paths.js +66 -0
  276. package/src/lib/plugin-manager/plugin-live-paths.js.map +1 -0
  277. package/src/lib/plugin-manager/plugin-org-erasure.d.ts +3 -2
  278. package/src/lib/plugin-manager/plugin-org-erasure.js +30 -5
  279. package/src/lib/plugin-manager/plugin-org-erasure.js.map +1 -1
  280. package/src/lib/plugin-manager/plugin-person-erasure.d.ts +68 -9
  281. package/src/lib/plugin-manager/plugin-person-erasure.js +196 -51
  282. package/src/lib/plugin-manager/plugin-person-erasure.js.map +1 -1
  283. package/src/lib/plugin-manager/plugin-person-records.d.ts +275 -0
  284. package/src/lib/plugin-manager/plugin-person-records.js +107 -0
  285. package/src/lib/plugin-manager/plugin-person-records.js.map +1 -0
  286. package/src/lib/plugin-manager/plugin-record-counts.d.ts +76 -0
  287. package/src/lib/plugin-manager/plugin-record-counts.js +49 -0
  288. package/src/lib/plugin-manager/plugin-record-counts.js.map +1 -0
  289. package/src/lib/plugin-manager/plugin-record-email-state.d.ts +26 -0
  290. package/src/lib/plugin-manager/plugin-record-email-state.js +16 -0
  291. package/src/lib/plugin-manager/plugin-record-email-state.js.map +1 -1
  292. package/src/lib/plugin-manager/plugin-record-index.d.ts +10 -0
  293. package/src/lib/plugin-manager/plugin-record-index.js.map +1 -1
  294. package/src/lib/plugin-manager/plugin-record-lists.d.ts +86 -6
  295. package/src/lib/plugin-manager/plugin-record-lists.js +42 -5
  296. package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
  297. package/src/lib/plugin-manager/plugin-record-origin.d.ts +79 -0
  298. package/src/lib/plugin-manager/plugin-record-origin.js +46 -0
  299. package/src/lib/plugin-manager/plugin-record-origin.js.map +1 -0
  300. package/src/lib/plugin-manager/plugin-record-pages.d.ts +37 -0
  301. package/src/lib/plugin-manager/plugin-record-pages.js +52 -0
  302. package/src/lib/plugin-manager/plugin-record-pages.js.map +1 -0
  303. package/src/lib/plugin-manager/plugin-record-timeline.d.ts +60 -0
  304. package/src/lib/plugin-manager/plugin-record-timeline.js +16 -0
  305. package/src/lib/plugin-manager/plugin-record-timeline.js.map +1 -1
  306. package/src/lib/plugin-manager/plugin-resource-drafts.d.ts +5 -5
  307. package/src/lib/plugin-manager/plugin-resource-drafts.js.map +1 -1
  308. package/src/lib/plugin-manager/plugin-revocations.d.ts +64 -0
  309. package/src/lib/plugin-manager/plugin-revocations.js +47 -0
  310. package/src/lib/plugin-manager/plugin-revocations.js.map +1 -0
  311. package/src/lib/plugin-manager/plugin-send-tallies.d.ts +69 -0
  312. package/src/lib/plugin-manager/plugin-send-tallies.js +45 -0
  313. package/src/lib/plugin-manager/plugin-send-tallies.js.map +1 -0
  314. package/src/lib/plugin-manager/plugin-server-steps.d.ts +170 -0
  315. package/src/lib/plugin-manager/plugin-server-steps.js +116 -0
  316. package/src/lib/plugin-manager/plugin-server-steps.js.map +1 -0
  317. package/src/lib/plugin-manager/plugin-site-bundle.d.ts +40 -0
  318. package/src/lib/plugin-manager/plugin-site-bundle.js +4 -0
  319. package/src/lib/plugin-manager/plugin-site-bundle.js.map +1 -1
  320. package/src/lib/plugin-manager/plugin-site-export.d.ts +57 -1
  321. package/src/lib/plugin-manager/plugin-site-export.js +23 -10
  322. package/src/lib/plugin-manager/plugin-site-export.js.map +1 -1
  323. package/src/lib/plugin-manager/plugin-sitemap-readers.d.ts +146 -0
  324. package/src/lib/plugin-manager/plugin-sitemap-readers.js +110 -0
  325. package/src/lib/plugin-manager/plugin-sitemap-readers.js.map +1 -0
  326. package/src/lib/plugin-manager/plugin-transfer-resources.d.ts +714 -0
  327. package/src/lib/plugin-manager/plugin-transfer-resources.js +443 -0
  328. package/src/lib/plugin-manager/plugin-transfer-resources.js.map +1 -0
  329. package/src/lib/plugin-manager/plugin-usage-axes.d.ts +54 -5
  330. package/src/lib/plugin-manager/plugin-usage-axes.js +11 -3
  331. package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
  332. package/src/lib/plugin-manager/plugin-user-erasure.js +9 -1
  333. package/src/lib/plugin-manager/plugin-user-erasure.js.map +1 -1
  334. package/src/lib/plugin-manager/plugin-visitor-doors.d.ts +104 -0
  335. package/src/lib/plugin-manager/plugin-visitor-doors.js +108 -0
  336. package/src/lib/plugin-manager/plugin-visitor-doors.js.map +1 -0
  337. package/src/lib/plugin-manager/realm-host-aglyn.generated.js +2 -0
  338. package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
  339. package/src/lib/plugin-manager/repeat-rows.d.ts +5 -6
  340. package/src/lib/plugin-manager/repeat-rows.js.map +1 -1
  341. package/src/lib/app-utils/actions.d.ts +0 -310
  342. package/src/lib/app-utils/actions.js +0 -506
  343. package/src/lib/app-utils/actions.js.map +0 -1
  344. package/src/lib/app-utils/automation-placeholders.d.ts +0 -72
  345. package/src/lib/app-utils/automation-placeholders.js +0 -207
  346. package/src/lib/app-utils/automation-placeholders.js.map +0 -1
  347. package/src/lib/app-utils/dataset-models.d.ts +0 -339
  348. package/src/lib/app-utils/dataset-models.js +0 -722
  349. package/src/lib/app-utils/dataset-models.js.map +0 -1
  350. package/src/lib/app-utils/datasets.d.ts +0 -171
  351. package/src/lib/app-utils/datasets.js +0 -227
  352. package/src/lib/app-utils/datasets.js.map +0 -1
  353. package/src/lib/app-utils/form-abuse-ceiling.d.ts +0 -146
  354. package/src/lib/app-utils/form-abuse-ceiling.js +0 -158
  355. package/src/lib/app-utils/form-abuse-ceiling.js.map +0 -1
  356. package/src/lib/plugin-manager/order-fulfilment.d.ts +0 -142
  357. package/src/lib/plugin-manager/order-fulfilment.js +0 -104
  358. package/src/lib/plugin-manager/order-fulfilment.js.map +0 -1
@@ -0,0 +1,421 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ // Imported from BOTH graphs — the staff pages (client) and the App Routes
17
+ // that refuse a quote or a discount — so it may import neither entry barrel,
18
+ // for the reason `margin-utilization.ts` states at its own head.
19
+ import { _ as _extends } from "@swc/helpers/_/_extends";
20
+ import { ESTIMATED_PAGE_TRANSFER_BYTES, INFRA_COGS_PER_SITE_USD, METERED_MARKUP, ORG_COGS_UNIT_RATES_USD, PAGE_VIEW_CDN_REQUEST_COST_USD, PLAN_LABELS, PLAN_PRICING, SELF_SERVE_PLANS, applyDiscountUsd, checkSeatQuota, netOfProcessorFee, orgListPriceMonthlyUsd, resolveCollaboratorSeatPool, resolveOrgEntitlements } from "./plan-entitlements.js";
21
+ import { planQuotaOf } from "../plugin-manager/plugin-plan-entitlements.js";
22
+ import { pluginCostAxes, pluginUsageBands } from "../plugin-manager/plugin-usage-axes.js";
23
+ /**
24
+ * WHAT A WORKSPACE COSTS IF IT SPENDS EXACTLY WHAT IT BOUGHT (AGL-3473).
25
+ *
26
+ * `orgMonthlyCogsUsd` prices what an org DID use, from its rollup. Every
27
+ * guard that rated a price against it — the discount guardrail, the
28
+ * enterprise quote card — therefore approved deals on the strength of how
29
+ * little the customer had used so far, and a deal is a promise about the
30
+ * whole allowance. Agency at 20% off read "ok, 75.5%" against its measured
31
+ * month while sitting under what its bands cost at 100%.
32
+ *
33
+ * This is the same multiplication `tier-margin-floor.spec.ts` does for the
34
+ * price list — every band at 100%, at the rates the platform's own model
35
+ * uses — over RESOLVED entitlements, so a staff override, a comp's plan and
36
+ * a purchased add-on all cost what they deliver. That spec holds its own
37
+ * independent model and asserts this function agrees with it on every plan.
38
+ *
39
+ * Two readers, held to it differently. An enterprise quote must clear
40
+ * `FULL_USE_QUOTE_MULTIPLE` × the cost and is refused below it. A coupon or
41
+ * discount is judged on the charges it reaches and WARNED about below 1× —
42
+ * never refused, because a first-month or first-year discount that spends
43
+ * cost to close a deal is a decision staff are allowed to make.
44
+ *
45
+ * ## An unbounded band costs Infinity, never 0
46
+ *
47
+ * A band that is `UNLIMITED` cannot be costed, and every cost model in this
48
+ * repo that scored one as zero reported the largest line item on a plan as
49
+ * contributing nothing. So a non-finite term — or one that is `NaN` because a
50
+ * zero met an infinity — is `Infinity`, the total is `Infinity`, and no price
51
+ * clears it. The term is named in `unbounded` so a refusal or a warning can
52
+ * say which band to bound.
53
+ */ /**
54
+ * What one console seat costs to serve for a month — about 60,000 reads and
55
+ * 10,000 writes at `nam5` list prices, ≈$0.054, carried as $0.06 (the Drive
56
+ * pricing decision of 2026-09-05).
57
+ *
58
+ * NOT in `ORG_COGS_UNIT_RATES_USD`: no rollup meter counts seat-months, so a
59
+ * rate there would be one no axis of `orgMonthlyCogsUsd` reads.
60
+ */ export const SEAT_COGS_USD_PER_MONTH = 0.06;
61
+ /**
62
+ * Days a daily band is spent at 100% in a month: the one-to-one email cap is
63
+ * a pace per UTC day, and the whole month at that pace is thirty of them.
64
+ */ const DAYS_PER_FULL_MONTH = 30;
65
+ /** Page views one GB of included bandwidth buys — `pageViewsFromBandwidthGb`'s constant. */ const VIEWS_PER_GB = 1024 * 1024 * 1024 / ESTIMATED_PAGE_TRANSFER_BYTES;
66
+ /**
67
+ * How many times its full-use cost an enterprise quote must cover, net of
68
+ * Stripe: cost + 30%, the markup every metered overage already carries, so a
69
+ * negotiated deal earns what the price list does.
70
+ */ export const FULL_USE_QUOTE_MULTIPLE = METERED_MARKUP;
71
+ /**
72
+ * The full-use cost a discounted charge is judged against, net of Stripe: 1×.
73
+ * A discount that spends only the 30% a price carries above cost clears it;
74
+ * one that reaches into the cost is WARNED about, never refused — a coupon is
75
+ * a tool for closing a deal, and staff choose to spend cost on one knowingly.
76
+ */ export const FULL_USE_DISCOUNT_MULTIPLE = 1;
77
+ /** A term that cannot be costed is unbounded, never free. */ function termUsd(value) {
78
+ return Number.isFinite(value) ? value : Number.POSITIVE_INFINITY;
79
+ }
80
+ /**
81
+ * The USD one unit of a plugin's declared band costs.
82
+ *
83
+ * A band sold in a unit OF cost declares that unit's price (`unitCostUsd`).
84
+ * Every other band is priced by the cost axis that records the same rollup
85
+ * field the band is measured by — the meter `orgMonthlyCogsUsd` already
86
+ * prices its usage on — at that axis's `ORG_COGS_UNIT_RATES_USD` rate, or at
87
+ * ×1 where the axis records dollars.
88
+ *
89
+ * ⚑ A band no axis records, or an axis naming a rate core does not carry,
90
+ * THROWS. Pricing it at zero would make a plan cost less than it does, which
91
+ * is the direction that approves a quote.
92
+ */ function declaredBandUnitCostUsd(band) {
93
+ var _band_fallbackFields;
94
+ if (typeof band.unitCostUsd === 'number') return band.unitCostUsd;
95
+ const measuredBy = [
96
+ ...band.fields,
97
+ ...(_band_fallbackFields = band.fallbackFields) != null ? _band_fallbackFields : []
98
+ ];
99
+ const axis = pluginCostAxes().find((candidate)=>measuredBy.some((field)=>{
100
+ var _candidate_fallbackFields;
101
+ return candidate.fields.includes(field) || ((_candidate_fallbackFields = candidate.fallbackFields) != null ? _candidate_fallbackFields : []).includes(field);
102
+ }));
103
+ if (!axis) {
104
+ throw new Error(`usage band "${band.id}" is measured by no declared cost axis, so its full-use cost has no rate`);
105
+ }
106
+ if (axis.rate === undefined) return 1;
107
+ const rate = ORG_COGS_UNIT_RATES_USD[axis.rate];
108
+ if (typeof rate !== 'number' || !Number.isFinite(rate)) {
109
+ throw new Error(`cost axis "${axis.id}" names the rate "${axis.rate}", which ORG_COGS_UNIT_RATES_USD does not carry`);
110
+ }
111
+ return rate;
112
+ }
113
+ /**
114
+ * Every cost a workspace's RESOLVED bands imply at 100%, per month.
115
+ *
116
+ * The platform's own bands, each at the rate `orgMonthlyCogsUsd` prices its
117
+ * meter on: media storage per site (× `hostLimit`), bandwidth at its weight
118
+ * (`perPageView`) and at its CDN requests (`PAGE_VIEW_CDN_REQUEST_COST_USD`),
119
+ * stored data (`dataStorageMbPerOrg`), API requests and every email the
120
+ * campaign band sends. Then every band a plugin declares
121
+ * (`plugin-usage-axes.ts`), a per-site one expanded by `hostLimit`. Then the
122
+ * two costs no meter records:
123
+ *
124
+ * - SEATS — every collaborator each site admits on every site
125
+ * (`membersPerHost × hostLimit`), the org's managers (`managersPerOrg`)
126
+ * and any bought on top, at `SEAT_COGS_USD_PER_MONTH`;
127
+ * - ONE-TO-ONE EMAIL — the CRM's daily cap spent every day of the month, at
128
+ * the rate every other send costs.
129
+ *
130
+ * `INFRA_COGS_PER_SITE_USD × hostLimit` is a FLOOR rather than an added
131
+ * term, exactly as in `orgMonthlyCogsUsd`.
132
+ */ export function fullUseCogs(entitlements, options = {}) {
133
+ var _options_extraSeats;
134
+ const rates = ORG_COGS_UNIT_RATES_USD;
135
+ const hosts = entitlements.hostLimit;
136
+ const quota = (key)=>planQuotaOf(entitlements, key);
137
+ const extraSeats = Math.max(0, Number((_options_extraSeats = options.extraSeats) != null ? _options_extraSeats : 0) || 0);
138
+ const breakdown = {
139
+ mediaStorage: termUsd(hosts * entitlements.storagePerHostMb / 1024 * rates.storagePerGbMonth),
140
+ bandwidth: termUsd(entitlements.bandwidthGb * VIEWS_PER_GB * rates.perPageView),
141
+ cdnRequests: termUsd(entitlements.bandwidthGb * VIEWS_PER_GB * PAGE_VIEW_CDN_REQUEST_COST_USD),
142
+ dataStorage: termUsd(entitlements.dataStorageMbPerOrg / 1024 * rates.dataStoragePerGbMonth),
143
+ apiRequests: termUsd(entitlements.apiRequestsPerMonth * rates.perApiRequest),
144
+ emailSends: termUsd(entitlements.emailSendsPerMonth * rates.perEmailSend)
145
+ };
146
+ for (const band of pluginUsageBands()){
147
+ const units = quota(band.entitlement) * (band.perHost ? hosts : 1);
148
+ breakdown[band.id] = termUsd(units * declaredBandUnitCostUsd(band));
149
+ }
150
+ breakdown['seats'] = termUsd((entitlements.membersPerHost * hosts + entitlements.managersPerOrg + extraSeats) * SEAT_COGS_USD_PER_MONTH);
151
+ // Read by key, as `checkCrmEmailQuota` reads it: a daily pace is not a
152
+ // monthly band, so no usage-band declaration carries it.
153
+ breakdown['crmEmail'] = termUsd(quota('crmEmailsPerDay') * DAYS_PER_FULL_MONTH * rates.perEmailSend);
154
+ const unbounded = Object.entries(breakdown).filter(([, usd])=>!Number.isFinite(usd)).map(([term])=>term).sort();
155
+ const measuredUsd = Object.values(breakdown).reduce((sum, usd)=>sum + usd, 0);
156
+ const floorUsd = termUsd(Math.max(0, hosts) * INFRA_COGS_PER_SITE_USD);
157
+ return {
158
+ cogsUsd: Math.max(measuredUsd, floorUsd),
159
+ measuredUsd,
160
+ floorUsd,
161
+ breakdown,
162
+ unbounded
163
+ };
164
+ }
165
+ /** `fullUseCogs(entitlements).cogsUsd` — the figure every guard compares against. */ export function fullUseMonthlyCogsUsd(entitlements, options = {}) {
166
+ return fullUseCogs(entitlements, options).cogsUsd;
167
+ }
168
+ /**
169
+ * The full-use cost of an org as it stands: its resolved entitlements, plus
170
+ * the manager and collaborator seats it bought, which no band carries.
171
+ */ export function orgFullUseCogs(org) {
172
+ return fullUseCogs(resolveOrgEntitlements(org), {
173
+ extraSeats: checkSeatQuota(org, 'managers', 0).purchased + resolveCollaboratorSeatPool(org).purchased
174
+ });
175
+ }
176
+ /**
177
+ * A discount as it reaches a MONTH of the price. A percentage scales every
178
+ * charge alike. An amount comes off each CHARGE, and an annual subscription
179
+ * is charged once for twelve months, so it is a twelfth of that a month.
180
+ */ function monthlyDiscount(discount, annual) {
181
+ if (!discount) return null;
182
+ if (typeof discount.percentOff === 'number') return {
183
+ percentOff: discount.percentOff
184
+ };
185
+ if (typeof discount.amountOffUsd === 'number') {
186
+ return {
187
+ amountOffUsd: annual ? discount.amountOffUsd / 12 : discount.amountOffUsd
188
+ };
189
+ }
190
+ return null;
191
+ }
192
+ /**
193
+ * Rate a monthly price — after `discount`, net of Stripe — against `multiple`
194
+ * times a full-use cost. Pure: the callers below bring the price and the cost.
195
+ */ export function rateAgainstFullUse(input) {
196
+ const listUsd = Math.max(0, Number(input.listMonthlyUsd) || 0);
197
+ const discountedUsd = applyDiscountUsd(listUsd, monthlyDiscount(input.discount, input.annual));
198
+ const netUsd = netOfProcessorFee(discountedUsd, input.annual);
199
+ const fullUseCogsUsd = input.cogs.cogsUsd;
200
+ const requiredNetUsd = input.multiple * fullUseCogsUsd;
201
+ const coverage = Number.isFinite(fullUseCogsUsd) && fullUseCogsUsd > 0 ? netUsd / fullUseCogsUsd : 0;
202
+ return {
203
+ listUsd,
204
+ discountedUsd,
205
+ netUsd,
206
+ annual: input.annual,
207
+ fullUseCogsUsd,
208
+ multiple: input.multiple,
209
+ requiredNetUsd,
210
+ coverage,
211
+ ok: netUsd >= requiredNetUsd,
212
+ unbounded: input.cogs.unbounded
213
+ };
214
+ }
215
+ /**
216
+ * An org's subscription after `discount`, against `multiple` × its full-use
217
+ * cost — the enterprise quote floor, where the negotiated `customMonthlyUsd`
218
+ * is the list price. `org` must carry its subscription: a list price of 0
219
+ * rates against nothing and fails, so a caller holding a stale mirror is
220
+ * refused rather than waved through.
221
+ */ export function orgFullUseFloor(org, options) {
222
+ var _org_subscription;
223
+ return rateAgainstFullUse({
224
+ listMonthlyUsd: orgListPriceMonthlyUsd(org),
225
+ annual: (org == null ? void 0 : (_org_subscription = org.subscription) == null ? void 0 : _org_subscription.interval) === 'year',
226
+ cogs: orgFullUseCogs(org),
227
+ multiple: options.multiple,
228
+ discount: options.discount
229
+ });
230
+ }
231
+ /**
232
+ * Which charges a coupon of `duration` comes off (AGL-3473).
233
+ *
234
+ * `once` is the first charge: the first month billed monthly, the whole first
235
+ * year billed annually. `repeating` covers the invoices dated within its
236
+ * months of redemption: N monthly charges, or — billed annually — the annual
237
+ * charges that fall inside them, which is the first one for any N up to 12.
238
+ * `forever` is every charge. A duration not on record is judged as
239
+ * `forever`, the reading that cannot understate what a discount gives away.
240
+ */ export function discountReach(coupon, annual) {
241
+ const monthsPerCharge = annual ? 12 : 1;
242
+ const months = Math.floor(Number(coupon == null ? void 0 : coupon.durationInMonths));
243
+ if ((coupon == null ? void 0 : coupon.duration) === 'once') {
244
+ return {
245
+ duration: 'once',
246
+ charges: 1,
247
+ monthsPerCharge,
248
+ monthsOfFirstYear: monthsPerCharge
249
+ };
250
+ }
251
+ if ((coupon == null ? void 0 : coupon.duration) === 'repeating' && months >= 1) {
252
+ return annual ? {
253
+ duration: 'repeating',
254
+ charges: Math.ceil(months / 12),
255
+ monthsPerCharge,
256
+ monthsOfFirstYear: 12
257
+ } : {
258
+ duration: 'repeating',
259
+ charges: months,
260
+ monthsPerCharge,
261
+ monthsOfFirstYear: Math.min(months, 12)
262
+ };
263
+ }
264
+ return {
265
+ duration: (coupon == null ? void 0 : coupon.duration) === 'forever' ? 'forever' : 'unknown',
266
+ charges: Number.POSITIVE_INFINITY,
267
+ monthsPerCharge,
268
+ monthsOfFirstYear: 12
269
+ };
270
+ }
271
+ /** `cost − net`, never negative; an unbounded cost is an unbounded shortfall. */ function shortfall(cogsUsd, netUsd) {
272
+ if (!Number.isFinite(cogsUsd)) return Number.POSITIVE_INFINITY;
273
+ return Math.max(0, Math.round((cogsUsd - netUsd) * 100) / 100);
274
+ }
275
+ /**
276
+ * Judge a discount on one price against full-use cost — pure: the callers
277
+ * below bring the price, the cost and the coupon.
278
+ */ export function assessDiscountAgainstFullUse(input) {
279
+ const charge = rateAgainstFullUse(_extends({}, input, {
280
+ multiple: FULL_USE_DISCOUNT_MULTIPLE
281
+ }));
282
+ const undiscounted = rateAgainstFullUse(_extends({}, input, {
283
+ discount: null,
284
+ multiple: FULL_USE_DISCOUNT_MULTIPLE
285
+ }));
286
+ const reach = discountReach(input.duration, input.annual);
287
+ const chargeNetUsd = Math.round(charge.netUsd * reach.monthsPerCharge * 100) / 100;
288
+ const chargeCogsUsd = charge.fullUseCogsUsd * reach.monthsPerCharge;
289
+ const firstYearNetUsd = Math.round((charge.netUsd * reach.monthsOfFirstYear + undiscounted.netUsd * (12 - reach.monthsOfFirstYear)) * 100) / 100;
290
+ const firstYearCogsUsd = charge.fullUseCogsUsd * 12;
291
+ return _extends({}, charge, {
292
+ reach,
293
+ chargeNetUsd,
294
+ chargeCogsUsd,
295
+ chargeUnderCostUsd: shortfall(chargeCogsUsd, chargeNetUsd),
296
+ firstYearNetUsd,
297
+ firstYearCogsUsd,
298
+ firstYearCoverage: Number.isFinite(firstYearCogsUsd) && firstYearCogsUsd > 0 ? firstYearNetUsd / firstYearCogsUsd : 0,
299
+ firstYearUnderCostUsd: shortfall(firstYearCogsUsd, firstYearNetUsd)
300
+ });
301
+ }
302
+ /**
303
+ * A discount on an org as it bills — its plan, overrides, add-ons, interval
304
+ * and the price it pays — against its full-use cost: the warning behind
305
+ * applying a coupon to an org and behind the winback. A list price of 0 (no
306
+ * subscription on record) is reported as such, never as covered.
307
+ */ export function orgDiscountFullUse(org, discount, duration) {
308
+ var _org_subscription;
309
+ return assessDiscountAgainstFullUse({
310
+ listMonthlyUsd: orgListPriceMonthlyUsd(org),
311
+ annual: (org == null ? void 0 : (_org_subscription = org.subscription) == null ? void 0 : _org_subscription.interval) === 'year',
312
+ cogs: orgFullUseCogs(org),
313
+ discount,
314
+ duration
315
+ });
316
+ }
317
+ /**
318
+ * Judge a coupon or promotion code against full-use cost before it is minted
319
+ * (AGL-3473) — a WARNING for staff, never a refusal.
320
+ *
321
+ * A coupon here carries no plan restriction, so its code can be redeemed on
322
+ * any paid self-serve plan, on either interval, by a customer using
323
+ * everything the plan includes; each case is that plan's list price against
324
+ * its own bands at 100%, on the charges `duration` reaches. Enterprise is
325
+ * quoted per deal and never takes a code at checkout; a coupon applied to one
326
+ * is judged on that org.
327
+ */ export function rateCouponAgainstFullUse(discount, duration) {
328
+ const cases = [];
329
+ for (const plan of SELF_SERVE_PLANS){
330
+ var _PLAN_PRICING_plan;
331
+ if (!(((_PLAN_PRICING_plan = PLAN_PRICING[plan]) == null ? void 0 : _PLAN_PRICING_plan.basePriceMonthlyUsd) > 0)) continue;
332
+ for (const interval of [
333
+ 'month',
334
+ 'year'
335
+ ]){
336
+ const org = {
337
+ plan,
338
+ subscription: {
339
+ status: 'active',
340
+ interval
341
+ }
342
+ };
343
+ cases.push(_extends({
344
+ plan,
345
+ interval
346
+ }, orgDiscountFullUse(org, discount, duration)));
347
+ }
348
+ }
349
+ const worst = cases.reduce((least, one)=>one.coverage < least.coverage ? one : least);
350
+ const under = cases.filter((one)=>!one.ok).map(couponCaseLabel);
351
+ const ok = under.length === 0;
352
+ return {
353
+ ok,
354
+ cases,
355
+ worst,
356
+ under,
357
+ warning: ok ? null : `Under full-use cost on ${under.length} of ${cases.length} plan and billing ` + `combinations (${under.join('; ')}). Worst case ` + describeDiscountFullUse(worst, couponCaseLabel(worst))
358
+ };
359
+ }
360
+ /**
361
+ * The deepest whole percent off a coupon can take with every discounted
362
+ * charge, on every paid self-serve plan, still covering its full-use cost —
363
+ * or `null` when a plan is under it at list price.
364
+ */ export function deepestCouponPercentWithinFullUse() {
365
+ if (!rateCouponAgainstFullUse({}).ok) return null;
366
+ let deepest = 0;
367
+ while(deepest < 100 && rateCouponAgainstFullUse({
368
+ percentOff: deepest + 1
369
+ }).ok){
370
+ deepest += 1;
371
+ }
372
+ return deepest;
373
+ }
374
+ /** Which charges a reach names, in words. */ function chargesReached(reach) {
375
+ const annual = reach.monthsPerCharge === 12;
376
+ if (reach.duration === 'unknown') return 'every charge (no duration on record)';
377
+ if (!Number.isFinite(reach.charges)) {
378
+ return annual ? 'every annual charge' : 'every monthly charge';
379
+ }
380
+ if (annual) {
381
+ return reach.charges === 1 ? 'the first annual charge (the whole first year)' : `the first ${reach.charges} annual charges`;
382
+ }
383
+ return reach.charges === 1 ? "the first month's charge" : `the first ${reach.charges} monthly charges`;
384
+ }
385
+ /**
386
+ * The staff sentence for a discount against full-use cost: which charges it
387
+ * reaches, what each keeps against what its months cost, how far under, and
388
+ * the first year as a whole. Staff-facing only — it names Aglyn's cost.
389
+ */ export function describeDiscountFullUse(result, subject) {
390
+ const about = subject ? `${subject}: ` : '';
391
+ if (result.unbounded.length) {
392
+ return `${about}cannot be costed — ${result.unbounded.join(', ')} ` + `${result.unbounded.length === 1 ? 'is' : 'are'} unbounded, so the full-use cost is too.`;
393
+ }
394
+ if (!(result.listUsd > 0)) {
395
+ return `${about}no subscription price is on record to judge the discount against.`;
396
+ }
397
+ const each = `${chargesReached(result.reach)}: each keeps ${usd(result.chargeNetUsd)} net of ` + `Stripe against ${usd(result.chargeCogsUsd)} of full-use cost ` + `(${result.coverage.toFixed(2)}×`;
398
+ if (result.ok) return `${about}clears full-use cost on ${each}).`;
399
+ const year = `It touches ${result.reach.monthsOfFirstYear} of the first 12 months; the first ` + `year as a whole covers ${result.firstYearCoverage.toFixed(2)}×` + (result.firstYearUnderCostUsd > 0 ? ` (${usd(result.firstYearUnderCostUsd)} under).` : '.');
400
+ return `${about}under full-use cost on ${each}, ${usd(result.chargeUnderCostUsd)} under ` + `each). ${year}`;
401
+ }
402
+ /** Two decimals, or "unbounded". */ function usd(value) {
403
+ return Number.isFinite(value) ? `$${value.toFixed(2)}` : 'unbounded';
404
+ }
405
+ /**
406
+ * The sentence an enterprise quote refusal or verdict states: the floor, and
407
+ * the figures that missed it. Staff-facing only — it names Aglyn's cost.
408
+ */ export function describeFullUseFloor(result, subject) {
409
+ const floor = result.multiple === 1 ? 'its full-use cost' : `${result.multiple.toFixed(2)}× its full-use cost`;
410
+ const about = subject ? `${subject}: ` : '';
411
+ if (result.unbounded.length) {
412
+ return `${about}cannot be rated — ${result.unbounded.join(', ')} ` + `${result.unbounded.length === 1 ? 'is' : 'are'} unbounded, so the full-use cost is too. ` + 'Bound the band with an entitlement override first.';
413
+ }
414
+ return `${about}keeps ${usd(result.netUsd)}/mo net of Stripe ` + `against ${usd(result.requiredNetUsd)} (${floor}, ${usd(result.fullUseCogsUsd)}) — ` + `${result.coverage.toFixed(2)}× full-use cost.`;
415
+ }
416
+ /** "Agency, annual" — how a coupon case names itself. */ export function couponCaseLabel(one) {
417
+ var _PLAN_LABELS_one_plan;
418
+ return `${(_PLAN_LABELS_one_plan = PLAN_LABELS[one.plan]) != null ? _PLAN_LABELS_one_plan : one.plan}, ${one.interval === 'year' ? 'annual' : 'monthly'}`;
419
+ }
420
+
421
+ //# sourceMappingURL=full-use-cost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/full-use-cost.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// Imported from BOTH graphs — the staff pages (client) and the App Routes\n// that refuse a quote or a discount — so it may import neither entry barrel,\n// for the reason `margin-utilization.ts` states at its own head.\nimport type { AglynOrgBilling, OrgDiscount, OrgPlan } from '../foundation'\nimport {\n ESTIMATED_PAGE_TRANSFER_BYTES,\n INFRA_COGS_PER_SITE_USD,\n METERED_MARKUP,\n ORG_COGS_UNIT_RATES_USD,\n PAGE_VIEW_CDN_REQUEST_COST_USD,\n PLAN_LABELS,\n PLAN_PRICING,\n SELF_SERVE_PLANS,\n applyDiscountUsd,\n checkSeatQuota,\n netOfProcessorFee,\n orgListPriceMonthlyUsd,\n resolveCollaboratorSeatPool,\n resolveOrgEntitlements,\n type ResolvedOrgEntitlements,\n} from './plan-entitlements'\nimport { planQuotaOf } from '../plugin-manager/plugin-plan-entitlements'\nimport {\n pluginCostAxes,\n pluginUsageBands,\n type ResolvedPluginUsageBand,\n} from '../plugin-manager/plugin-usage-axes'\n\n/**\n * WHAT A WORKSPACE COSTS IF IT SPENDS EXACTLY WHAT IT BOUGHT (AGL-3473).\n *\n * `orgMonthlyCogsUsd` prices what an org DID use, from its rollup. Every\n * guard that rated a price against it — the discount guardrail, the\n * enterprise quote card — therefore approved deals on the strength of how\n * little the customer had used so far, and a deal is a promise about the\n * whole allowance. Agency at 20% off read \"ok, 75.5%\" against its measured\n * month while sitting under what its bands cost at 100%.\n *\n * This is the same multiplication `tier-margin-floor.spec.ts` does for the\n * price list — every band at 100%, at the rates the platform's own model\n * uses — over RESOLVED entitlements, so a staff override, a comp's plan and\n * a purchased add-on all cost what they deliver. That spec holds its own\n * independent model and asserts this function agrees with it on every plan.\n *\n * Two readers, held to it differently. An enterprise quote must clear\n * `FULL_USE_QUOTE_MULTIPLE` × the cost and is refused below it. A coupon or\n * discount is judged on the charges it reaches and WARNED about below 1× —\n * never refused, because a first-month or first-year discount that spends\n * cost to close a deal is a decision staff are allowed to make.\n *\n * ## An unbounded band costs Infinity, never 0\n *\n * A band that is `UNLIMITED` cannot be costed, and every cost model in this\n * repo that scored one as zero reported the largest line item on a plan as\n * contributing nothing. So a non-finite term — or one that is `NaN` because a\n * zero met an infinity — is `Infinity`, the total is `Infinity`, and no price\n * clears it. The term is named in `unbounded` so a refusal or a warning can\n * say which band to bound.\n */\n\n/**\n * What one console seat costs to serve for a month — about 60,000 reads and\n * 10,000 writes at `nam5` list prices, ≈$0.054, carried as $0.06 (the Drive\n * pricing decision of 2026-09-05).\n *\n * NOT in `ORG_COGS_UNIT_RATES_USD`: no rollup meter counts seat-months, so a\n * rate there would be one no axis of `orgMonthlyCogsUsd` reads.\n */\nexport const SEAT_COGS_USD_PER_MONTH = 0.06\n\n/**\n * Days a daily band is spent at 100% in a month: the one-to-one email cap is\n * a pace per UTC day, and the whole month at that pace is thirty of them.\n */\nconst DAYS_PER_FULL_MONTH = 30\n\n/** Page views one GB of included bandwidth buys — `pageViewsFromBandwidthGb`'s constant. */\nconst VIEWS_PER_GB = (1024 * 1024 * 1024) / ESTIMATED_PAGE_TRANSFER_BYTES\n\n/**\n * How many times its full-use cost an enterprise quote must cover, net of\n * Stripe: cost + 30%, the markup every metered overage already carries, so a\n * negotiated deal earns what the price list does.\n */\nexport const FULL_USE_QUOTE_MULTIPLE = METERED_MARKUP\n\n/**\n * The full-use cost a discounted charge is judged against, net of Stripe: 1×.\n * A discount that spends only the 30% a price carries above cost clears it;\n * one that reaches into the cost is WARNED about, never refused — a coupon is\n * a tool for closing a deal, and staff choose to spend cost on one knowingly.\n */\nexport const FULL_USE_DISCOUNT_MULTIPLE = 1\n\nexport interface FullUseCogsResult {\n /** `measuredUsd` or the per-site floor, whichever is larger; `Infinity` when any band is unbounded. */\n cogsUsd: number\n /** The sum of every term at 100% of its band. */\n measuredUsd: number\n /** `INFRA_COGS_PER_SITE_USD × hostLimit` — the sites sold, not the sites built. */\n floorUsd: number\n /** Every term, in USD a month, for showing the working. */\n breakdown: Record<string, number>\n /** The terms whose band is unbounded, sorted. Empty when the plan can be costed. */\n unbounded: string[]\n}\n\nexport interface FullUseCogsOptions {\n /**\n * Seats bought on top of the plan's — the org-wide manager add-on and the\n * collaborator pool, neither of which `resolveOrgEntitlements` folds into\n * a band.\n */\n extraSeats?: number\n}\n\n/** A term that cannot be costed is unbounded, never free. */\nfunction termUsd(value: number): number {\n return Number.isFinite(value) ? value : Number.POSITIVE_INFINITY\n}\n\n/**\n * The USD one unit of a plugin's declared band costs.\n *\n * A band sold in a unit OF cost declares that unit's price (`unitCostUsd`).\n * Every other band is priced by the cost axis that records the same rollup\n * field the band is measured by — the meter `orgMonthlyCogsUsd` already\n * prices its usage on — at that axis's `ORG_COGS_UNIT_RATES_USD` rate, or at\n * ×1 where the axis records dollars.\n *\n * ⚑ A band no axis records, or an axis naming a rate core does not carry,\n * THROWS. Pricing it at zero would make a plan cost less than it does, which\n * is the direction that approves a quote.\n */\nfunction declaredBandUnitCostUsd(band: ResolvedPluginUsageBand): number {\n if (typeof band.unitCostUsd === 'number') return band.unitCostUsd\n const measuredBy = [...band.fields, ...(band.fallbackFields ?? [])]\n const axis = pluginCostAxes().find((candidate) =>\n measuredBy.some(\n (field) =>\n candidate.fields.includes(field) ||\n (candidate.fallbackFields ?? []).includes(field),\n ),\n )\n if (!axis) {\n throw new Error(\n `usage band \"${band.id}\" is measured by no declared cost axis, so its full-use cost has no rate`,\n )\n }\n if (axis.rate === undefined) return 1\n const rate = (ORG_COGS_UNIT_RATES_USD as Record<string, number>)[axis.rate]\n if (typeof rate !== 'number' || !Number.isFinite(rate)) {\n throw new Error(\n `cost axis \"${axis.id}\" names the rate \"${axis.rate}\", which ORG_COGS_UNIT_RATES_USD does not carry`,\n )\n }\n return rate\n}\n\n/**\n * Every cost a workspace's RESOLVED bands imply at 100%, per month.\n *\n * The platform's own bands, each at the rate `orgMonthlyCogsUsd` prices its\n * meter on: media storage per site (× `hostLimit`), bandwidth at its weight\n * (`perPageView`) and at its CDN requests (`PAGE_VIEW_CDN_REQUEST_COST_USD`),\n * stored data (`dataStorageMbPerOrg`), API requests and every email the\n * campaign band sends. Then every band a plugin declares\n * (`plugin-usage-axes.ts`), a per-site one expanded by `hostLimit`. Then the\n * two costs no meter records:\n *\n * - SEATS — every collaborator each site admits on every site\n * (`membersPerHost × hostLimit`), the org's managers (`managersPerOrg`)\n * and any bought on top, at `SEAT_COGS_USD_PER_MONTH`;\n * - ONE-TO-ONE EMAIL — the CRM's daily cap spent every day of the month, at\n * the rate every other send costs.\n *\n * `INFRA_COGS_PER_SITE_USD × hostLimit` is a FLOOR rather than an added\n * term, exactly as in `orgMonthlyCogsUsd`.\n */\nexport function fullUseCogs(\n entitlements: ResolvedOrgEntitlements,\n options: FullUseCogsOptions = {},\n): FullUseCogsResult {\n const rates = ORG_COGS_UNIT_RATES_USD\n const hosts = entitlements.hostLimit\n const quota = (key: string) => planQuotaOf(entitlements, key)\n const extraSeats = Math.max(0, Number(options.extraSeats ?? 0) || 0)\n const breakdown: Record<string, number> = {\n mediaStorage: termUsd(\n ((hosts * entitlements.storagePerHostMb) / 1024) * rates.storagePerGbMonth,\n ),\n bandwidth: termUsd(entitlements.bandwidthGb * VIEWS_PER_GB * rates.perPageView),\n cdnRequests: termUsd(\n entitlements.bandwidthGb * VIEWS_PER_GB * PAGE_VIEW_CDN_REQUEST_COST_USD,\n ),\n dataStorage: termUsd(\n (entitlements.dataStorageMbPerOrg / 1024) * rates.dataStoragePerGbMonth,\n ),\n apiRequests: termUsd(entitlements.apiRequestsPerMonth * rates.perApiRequest),\n emailSends: termUsd(entitlements.emailSendsPerMonth * rates.perEmailSend),\n }\n for (const band of pluginUsageBands()) {\n const units = quota(band.entitlement) * (band.perHost ? hosts : 1)\n breakdown[band.id] = termUsd(units * declaredBandUnitCostUsd(band))\n }\n breakdown['seats'] = termUsd(\n (entitlements.membersPerHost * hosts + entitlements.managersPerOrg + extraSeats) *\n SEAT_COGS_USD_PER_MONTH,\n )\n // Read by key, as `checkCrmEmailQuota` reads it: a daily pace is not a\n // monthly band, so no usage-band declaration carries it.\n breakdown['crmEmail'] = termUsd(\n quota('crmEmailsPerDay') * DAYS_PER_FULL_MONTH * rates.perEmailSend,\n )\n const unbounded = Object.entries(breakdown)\n .filter(([, usd]) => !Number.isFinite(usd))\n .map(([term]) => term)\n .sort()\n const measuredUsd = Object.values(breakdown).reduce((sum, usd) => sum + usd, 0)\n const floorUsd = termUsd(Math.max(0, hosts) * INFRA_COGS_PER_SITE_USD)\n return {\n cogsUsd: Math.max(measuredUsd, floorUsd),\n measuredUsd,\n floorUsd,\n breakdown,\n unbounded,\n }\n}\n\n/** `fullUseCogs(entitlements).cogsUsd` — the figure every guard compares against. */\nexport function fullUseMonthlyCogsUsd(\n entitlements: ResolvedOrgEntitlements,\n options: FullUseCogsOptions = {},\n): number {\n return fullUseCogs(entitlements, options).cogsUsd\n}\n\n/**\n * The full-use cost of an org as it stands: its resolved entitlements, plus\n * the manager and collaborator seats it bought, which no band carries.\n */\nexport function orgFullUseCogs(\n org: Partial<AglynOrgBilling> | null | undefined,\n): FullUseCogsResult {\n return fullUseCogs(resolveOrgEntitlements(org), {\n extraSeats:\n checkSeatQuota(org, 'managers', 0).purchased +\n resolveCollaboratorSeatPool(org).purchased,\n })\n}\n\n/** A price rated against what the bands it buys cost at 100%. */\nexport interface FullUseFloorResult {\n /** The monthly list price before the discount (annual billing as its monthly equivalent). */\n listUsd: number\n /** The same after the discount. */\n discountedUsd: number\n /** The discounted price net of Stripe's fee — what is kept before any cost. */\n netUsd: number\n annual: boolean\n /** `fullUseCogs(…).cogsUsd`; `Infinity` when a band is unbounded. */\n fullUseCogsUsd: number\n /** The multiple of full-use cost the net price must reach. */\n multiple: number\n /** `multiple × fullUseCogsUsd` — the net price the floor asks for. */\n requiredNetUsd: number\n /** `netUsd / fullUseCogsUsd`: 1.30 is cost + 30%. 0 when the cost is unbounded. */\n coverage: number\n ok: boolean\n /** The unbounded terms, when that is why it fails. */\n unbounded: string[]\n}\n\n/**\n * A discount as it reaches a MONTH of the price. A percentage scales every\n * charge alike. An amount comes off each CHARGE, and an annual subscription\n * is charged once for twelve months, so it is a twelfth of that a month.\n */\nfunction monthlyDiscount(\n discount: Pick<OrgDiscount, 'percentOff' | 'amountOffUsd'> | null | undefined,\n annual: boolean,\n): Pick<OrgDiscount, 'percentOff' | 'amountOffUsd'> | null {\n if (!discount) return null\n if (typeof discount.percentOff === 'number') return { percentOff: discount.percentOff }\n if (typeof discount.amountOffUsd === 'number') {\n return { amountOffUsd: annual ? discount.amountOffUsd / 12 : discount.amountOffUsd }\n }\n return null\n}\n\n/**\n * Rate a monthly price — after `discount`, net of Stripe — against `multiple`\n * times a full-use cost. Pure: the callers below bring the price and the cost.\n */\nexport function rateAgainstFullUse(input: {\n listMonthlyUsd: number\n annual: boolean\n cogs: FullUseCogsResult\n multiple: number\n discount?: Pick<OrgDiscount, 'percentOff' | 'amountOffUsd'> | null\n}): FullUseFloorResult {\n const listUsd = Math.max(0, Number(input.listMonthlyUsd) || 0)\n const discountedUsd = applyDiscountUsd(listUsd, monthlyDiscount(input.discount, input.annual))\n const netUsd = netOfProcessorFee(discountedUsd, input.annual)\n const fullUseCogsUsd = input.cogs.cogsUsd\n const requiredNetUsd = input.multiple * fullUseCogsUsd\n const coverage =\n Number.isFinite(fullUseCogsUsd) && fullUseCogsUsd > 0 ? netUsd / fullUseCogsUsd : 0\n return {\n listUsd,\n discountedUsd,\n netUsd,\n annual: input.annual,\n fullUseCogsUsd,\n multiple: input.multiple,\n requiredNetUsd,\n coverage,\n ok: netUsd >= requiredNetUsd,\n unbounded: input.cogs.unbounded,\n }\n}\n\n/**\n * An org's subscription after `discount`, against `multiple` × its full-use\n * cost — the enterprise quote floor, where the negotiated `customMonthlyUsd`\n * is the list price. `org` must carry its subscription: a list price of 0\n * rates against nothing and fails, so a caller holding a stale mirror is\n * refused rather than waved through.\n */\nexport function orgFullUseFloor(\n org: Partial<AglynOrgBilling> | null | undefined,\n options: {\n multiple: number\n discount?: Pick<OrgDiscount, 'percentOff' | 'amountOffUsd'> | null\n },\n): FullUseFloorResult {\n return rateAgainstFullUse({\n listMonthlyUsd: orgListPriceMonthlyUsd(org),\n annual: org?.subscription?.interval === 'year',\n cogs: orgFullUseCogs(org),\n multiple: options.multiple,\n discount: options.discount,\n })\n}\n\n/** How long a coupon takes its discount off — Stripe's `duration` and `duration_in_months`. */\nexport interface CouponDuration {\n duration?: string | null\n durationInMonths?: number | null\n}\n\n/** Which charges a discount reaches on one billing interval. */\nexport interface DiscountReach {\n /** Stripe's duration, or `unknown` when none is on record — judged as `forever`. */\n duration: 'once' | 'repeating' | 'forever' | 'unknown'\n /** How many charges it comes off; `Infinity` for every one. */\n charges: number\n /** The months one charge pays for: 1 billed monthly, 12 billed annually. */\n monthsPerCharge: 1 | 12\n /** How many of the first twelve months the discounted charges pay for. */\n monthsOfFirstYear: number\n}\n\n/**\n * Which charges a coupon of `duration` comes off (AGL-3473).\n *\n * `once` is the first charge: the first month billed monthly, the whole first\n * year billed annually. `repeating` covers the invoices dated within its\n * months of redemption: N monthly charges, or — billed annually — the annual\n * charges that fall inside them, which is the first one for any N up to 12.\n * `forever` is every charge. A duration not on record is judged as\n * `forever`, the reading that cannot understate what a discount gives away.\n */\nexport function discountReach(\n coupon: CouponDuration | null | undefined,\n annual: boolean,\n): DiscountReach {\n const monthsPerCharge = annual ? 12 : 1\n const months = Math.floor(Number(coupon?.durationInMonths))\n if (coupon?.duration === 'once') {\n return { duration: 'once', charges: 1, monthsPerCharge, monthsOfFirstYear: monthsPerCharge }\n }\n if (coupon?.duration === 'repeating' && months >= 1) {\n return annual\n ? { duration: 'repeating', charges: Math.ceil(months / 12), monthsPerCharge, monthsOfFirstYear: 12 }\n : { duration: 'repeating', charges: months, monthsPerCharge, monthsOfFirstYear: Math.min(months, 12) }\n }\n return {\n duration: coupon?.duration === 'forever' ? 'forever' : 'unknown',\n charges: Number.POSITIVE_INFINITY,\n monthsPerCharge,\n monthsOfFirstYear: 12,\n }\n}\n\n/**\n * A discount against full-use cost on the charges it actually reaches, and on\n * the first year as a whole. `ok` and `coverage` are one DISCOUNTED charge's:\n * the warning is about the charges a coupon touches, never about the ones it\n * does not.\n */\nexport interface DiscountFullUseAssessment extends FullUseFloorResult {\n reach: DiscountReach\n /** What one discounted charge keeps, net of Stripe. */\n chargeNetUsd: number\n /** What the months one charge pays for cost at full use. */\n chargeCogsUsd: number\n /** How far under its full-use cost each discounted charge falls; 0 when it clears. */\n chargeUnderCostUsd: number\n /** The first twelve months together: the discounted charges, the rest at list. */\n firstYearNetUsd: number\n firstYearCogsUsd: number\n /** `firstYearNetUsd / firstYearCogsUsd`; 0 when the cost is unbounded. */\n firstYearCoverage: number\n /** How far under twelve months of full-use cost the first year falls; 0 when covered. */\n firstYearUnderCostUsd: number\n}\n\n/** `cost − net`, never negative; an unbounded cost is an unbounded shortfall. */\nfunction shortfall(cogsUsd: number, netUsd: number): number {\n if (!Number.isFinite(cogsUsd)) return Number.POSITIVE_INFINITY\n return Math.max(0, Math.round((cogsUsd - netUsd) * 100) / 100)\n}\n\n/**\n * Judge a discount on one price against full-use cost — pure: the callers\n * below bring the price, the cost and the coupon.\n */\nexport function assessDiscountAgainstFullUse(input: {\n listMonthlyUsd: number\n annual: boolean\n cogs: FullUseCogsResult\n discount: Pick<OrgDiscount, 'percentOff' | 'amountOffUsd'> | null | undefined\n duration: CouponDuration | null | undefined\n}): DiscountFullUseAssessment {\n const charge = rateAgainstFullUse({ ...input, multiple: FULL_USE_DISCOUNT_MULTIPLE })\n const undiscounted = rateAgainstFullUse({\n ...input,\n discount: null,\n multiple: FULL_USE_DISCOUNT_MULTIPLE,\n })\n const reach = discountReach(input.duration, input.annual)\n const chargeNetUsd = Math.round(charge.netUsd * reach.monthsPerCharge * 100) / 100\n const chargeCogsUsd = charge.fullUseCogsUsd * reach.monthsPerCharge\n const firstYearNetUsd =\n Math.round(\n (charge.netUsd * reach.monthsOfFirstYear +\n undiscounted.netUsd * (12 - reach.monthsOfFirstYear)) *\n 100,\n ) / 100\n const firstYearCogsUsd = charge.fullUseCogsUsd * 12\n return {\n ...charge,\n reach,\n chargeNetUsd,\n chargeCogsUsd,\n chargeUnderCostUsd: shortfall(chargeCogsUsd, chargeNetUsd),\n firstYearNetUsd,\n firstYearCogsUsd,\n firstYearCoverage:\n Number.isFinite(firstYearCogsUsd) && firstYearCogsUsd > 0\n ? firstYearNetUsd / firstYearCogsUsd\n : 0,\n firstYearUnderCostUsd: shortfall(firstYearCogsUsd, firstYearNetUsd),\n }\n}\n\n/**\n * A discount on an org as it bills — its plan, overrides, add-ons, interval\n * and the price it pays — against its full-use cost: the warning behind\n * applying a coupon to an org and behind the winback. A list price of 0 (no\n * subscription on record) is reported as such, never as covered.\n */\nexport function orgDiscountFullUse(\n org: Partial<AglynOrgBilling> | null | undefined,\n discount: Pick<OrgDiscount, 'percentOff' | 'amountOffUsd'> | null | undefined,\n duration: CouponDuration | null | undefined,\n): DiscountFullUseAssessment {\n return assessDiscountAgainstFullUse({\n listMonthlyUsd: orgListPriceMonthlyUsd(org),\n annual: org?.subscription?.interval === 'year',\n cogs: orgFullUseCogs(org),\n discount,\n duration,\n })\n}\n\n/** One plan and interval a coupon could be redeemed on, judged. */\nexport interface CouponFullUseCase extends DiscountFullUseAssessment {\n plan: OrgPlan\n interval: 'month' | 'year'\n}\n\nexport interface CouponFullUseVerdict {\n /** Every case clears: no discounted charge, on any plan, falls under its full-use cost. */\n ok: boolean\n /** Every paid self-serve plan, monthly and annual, judged. */\n cases: CouponFullUseCase[]\n /** The case with the least cover — the one the warning leads with. */\n worst: CouponFullUseCase\n /** The cases under full-use cost, as \"Agency, annual\". */\n under: string[]\n /** The staff warning, with the figures; `null` when every case clears. */\n warning: string | null\n}\n\n/**\n * Judge a coupon or promotion code against full-use cost before it is minted\n * (AGL-3473) — a WARNING for staff, never a refusal.\n *\n * A coupon here carries no plan restriction, so its code can be redeemed on\n * any paid self-serve plan, on either interval, by a customer using\n * everything the plan includes; each case is that plan's list price against\n * its own bands at 100%, on the charges `duration` reaches. Enterprise is\n * quoted per deal and never takes a code at checkout; a coupon applied to one\n * is judged on that org.\n */\nexport function rateCouponAgainstFullUse(\n discount: Pick<OrgDiscount, 'percentOff' | 'amountOffUsd'>,\n duration?: CouponDuration | null,\n): CouponFullUseVerdict {\n const cases: CouponFullUseCase[] = []\n for (const plan of SELF_SERVE_PLANS) {\n if (!(PLAN_PRICING[plan]?.basePriceMonthlyUsd > 0)) continue\n for (const interval of ['month', 'year'] as const) {\n const org = { plan, subscription: { status: 'active', interval } } as never\n cases.push({ plan, interval, ...orgDiscountFullUse(org, discount, duration) })\n }\n }\n const worst = cases.reduce((least, one) => (one.coverage < least.coverage ? one : least))\n const under = cases.filter((one) => !one.ok).map(couponCaseLabel)\n const ok = under.length === 0\n return {\n ok,\n cases,\n worst,\n under,\n warning: ok\n ? null\n : `Under full-use cost on ${under.length} of ${cases.length} plan and billing ` +\n `combinations (${under.join('; ')}). Worst case ` +\n describeDiscountFullUse(worst, couponCaseLabel(worst)),\n }\n}\n\n/**\n * The deepest whole percent off a coupon can take with every discounted\n * charge, on every paid self-serve plan, still covering its full-use cost —\n * or `null` when a plan is under it at list price.\n */\nexport function deepestCouponPercentWithinFullUse(): number | null {\n if (!rateCouponAgainstFullUse({}).ok) return null\n let deepest = 0\n while (deepest < 100 && rateCouponAgainstFullUse({ percentOff: deepest + 1 }).ok) {\n deepest += 1\n }\n return deepest\n}\n\n/** Which charges a reach names, in words. */\nfunction chargesReached(reach: DiscountReach): string {\n const annual = reach.monthsPerCharge === 12\n if (reach.duration === 'unknown') return 'every charge (no duration on record)'\n if (!Number.isFinite(reach.charges)) {\n return annual ? 'every annual charge' : 'every monthly charge'\n }\n if (annual) {\n return reach.charges === 1\n ? 'the first annual charge (the whole first year)'\n : `the first ${reach.charges} annual charges`\n }\n return reach.charges === 1\n ? \"the first month's charge\"\n : `the first ${reach.charges} monthly charges`\n}\n\n/**\n * The staff sentence for a discount against full-use cost: which charges it\n * reaches, what each keeps against what its months cost, how far under, and\n * the first year as a whole. Staff-facing only — it names Aglyn's cost.\n */\nexport function describeDiscountFullUse(\n result: DiscountFullUseAssessment,\n subject?: string,\n): string {\n const about = subject ? `${subject}: ` : ''\n if (result.unbounded.length) {\n return (\n `${about}cannot be costed — ${result.unbounded.join(', ')} ` +\n `${result.unbounded.length === 1 ? 'is' : 'are'} unbounded, so the full-use cost is too.`\n )\n }\n if (!(result.listUsd > 0)) {\n return `${about}no subscription price is on record to judge the discount against.`\n }\n const each =\n `${chargesReached(result.reach)}: each keeps ${usd(result.chargeNetUsd)} net of ` +\n `Stripe against ${usd(result.chargeCogsUsd)} of full-use cost ` +\n `(${result.coverage.toFixed(2)}×`\n if (result.ok) return `${about}clears full-use cost on ${each}).`\n const year =\n `It touches ${result.reach.monthsOfFirstYear} of the first 12 months; the first ` +\n `year as a whole covers ${result.firstYearCoverage.toFixed(2)}×` +\n (result.firstYearUnderCostUsd > 0\n ? ` (${usd(result.firstYearUnderCostUsd)} under).`\n : '.')\n return (\n `${about}under full-use cost on ${each}, ${usd(result.chargeUnderCostUsd)} under ` +\n `each). ${year}`\n )\n}\n\n/** Two decimals, or \"unbounded\". */\nfunction usd(value: number): string {\n return Number.isFinite(value) ? `$${value.toFixed(2)}` : 'unbounded'\n}\n\n/**\n * The sentence an enterprise quote refusal or verdict states: the floor, and\n * the figures that missed it. Staff-facing only — it names Aglyn's cost.\n */\nexport function describeFullUseFloor(\n result: FullUseFloorResult,\n subject?: string,\n): string {\n const floor =\n result.multiple === 1\n ? 'its full-use cost'\n : `${result.multiple.toFixed(2)}× its full-use cost`\n const about = subject ? `${subject}: ` : ''\n if (result.unbounded.length) {\n return (\n `${about}cannot be rated — ${result.unbounded.join(', ')} ` +\n `${result.unbounded.length === 1 ? 'is' : 'are'} unbounded, so the full-use cost is too. ` +\n 'Bound the band with an entitlement override first.'\n )\n }\n return (\n `${about}keeps ${usd(result.netUsd)}/mo net of Stripe ` +\n `against ${usd(result.requiredNetUsd)} (${floor}, ${usd(result.fullUseCogsUsd)}) — ` +\n `${result.coverage.toFixed(2)}× full-use cost.`\n )\n}\n\n/** \"Agency, annual\" — how a coupon case names itself. */\nexport function couponCaseLabel(one: Pick<CouponFullUseCase, 'plan' | 'interval'>): string {\n return `${PLAN_LABELS[one.plan] ?? one.plan}, ${one.interval === 'year' ? 'annual' : 'monthly'}`\n}\n"],"names":["ESTIMATED_PAGE_TRANSFER_BYTES","INFRA_COGS_PER_SITE_USD","METERED_MARKUP","ORG_COGS_UNIT_RATES_USD","PAGE_VIEW_CDN_REQUEST_COST_USD","PLAN_LABELS","PLAN_PRICING","SELF_SERVE_PLANS","applyDiscountUsd","checkSeatQuota","netOfProcessorFee","orgListPriceMonthlyUsd","resolveCollaboratorSeatPool","resolveOrgEntitlements","planQuotaOf","pluginCostAxes","pluginUsageBands","SEAT_COGS_USD_PER_MONTH","DAYS_PER_FULL_MONTH","VIEWS_PER_GB","FULL_USE_QUOTE_MULTIPLE","FULL_USE_DISCOUNT_MULTIPLE","termUsd","value","Number","isFinite","POSITIVE_INFINITY","declaredBandUnitCostUsd","band","unitCostUsd","measuredBy","fields","fallbackFields","axis","find","candidate","some","field","includes","Error","id","rate","undefined","fullUseCogs","entitlements","options","rates","hosts","hostLimit","quota","key","extraSeats","Math","max","breakdown","mediaStorage","storagePerHostMb","storagePerGbMonth","bandwidth","bandwidthGb","perPageView","cdnRequests","dataStorage","dataStorageMbPerOrg","dataStoragePerGbMonth","apiRequests","apiRequestsPerMonth","perApiRequest","emailSends","emailSendsPerMonth","perEmailSend","units","entitlement","perHost","membersPerHost","managersPerOrg","unbounded","Object","entries","filter","usd","map","term","sort","measuredUsd","values","reduce","sum","floorUsd","cogsUsd","fullUseMonthlyCogsUsd","orgFullUseCogs","org","purchased","monthlyDiscount","discount","annual","percentOff","amountOffUsd","rateAgainstFullUse","input","listUsd","listMonthlyUsd","discountedUsd","netUsd","fullUseCogsUsd","cogs","requiredNetUsd","multiple","coverage","ok","orgFullUseFloor","subscription","interval","discountReach","coupon","monthsPerCharge","months","floor","durationInMonths","duration","charges","monthsOfFirstYear","ceil","min","shortfall","round","assessDiscountAgainstFullUse","charge","undiscounted","reach","chargeNetUsd","chargeCogsUsd","firstYearNetUsd","firstYearCogsUsd","chargeUnderCostUsd","firstYearCoverage","firstYearUnderCostUsd","orgDiscountFullUse","rateCouponAgainstFullUse","cases","plan","basePriceMonthlyUsd","status","push","worst","least","one","under","couponCaseLabel","length","warning","join","describeDiscountFullUse","deepestCouponPercentWithinFullUse","deepest","chargesReached","result","subject","about","each","toFixed","year","describeFullUseFloor"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,0EAA0E;AAC1E,6EA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C,CAAC,EAAEA,MAAM0I,OAAO,CAAC,IAAI,GAAG;AAC3D;AAEA;;;CAGC,GACD,OAAO,SAASE,qBACdN,MAA0B,EAC1BC,OAAgB;IAEhB,MAAMxC,QACJuC,OAAOjD,QAAQ,KAAK,IAChB,sBACA,GAAGiD,OAAOjD,QAAQ,CAACqD,OAAO,CAAC,GAAG,mBAAmB,CAAC;IACxD,MAAMF,QAAQD,UAAU,GAAGA,QAAQ,EAAE,CAAC,GAAG;IACzC,IAAID,OAAOjF,SAAS,CAAC0E,MAAM,EAAE;QAC3B,OACE,GAAGS,MAAM,kBAAkB,EAAEF,OAAOjF,SAAS,CAAC4E,IAAI,CAAC,MAAM,CAAC,CAAC,GAC3D,GAAGK,OAAOjF,SAAS,CAAC0E,MAAM,KAAK,IAAI,OAAO,MAAM,yCAAyC,CAAC,GAC1F;IAEJ;IACA,OACE,GAAGS,MAAM,MAAM,EAAE/E,IAAI6E,OAAOrD,MAAM,EAAE,kBAAkB,CAAC,GACvD,CAAC,QAAQ,EAAExB,IAAI6E,OAAOlD,cAAc,EAAE,EAAE,EAAEW,MAAM,EAAE,EAAEtC,IAAI6E,OAAOpD,cAAc,EAAE,IAAI,CAAC,GACpF,GAAGoD,OAAOhD,QAAQ,CAACoD,OAAO,CAAC,GAAG,gBAAgB,CAAC;AAEnD;AAEA,uDAAuD,GACvD,OAAO,SAASZ,gBAAgBF,GAAiD;QACrE9I;IAAV,OAAO,IAAGA,wBAAAA,WAAW,CAAC8I,IAAIN,IAAI,CAAC,YAArBxI,wBAAyB8I,IAAIN,IAAI,CAAC,EAAE,EAAEM,IAAIlC,QAAQ,KAAK,SAAS,WAAW,WAAW;AAClG"}
@@ -1404,6 +1404,16 @@ export function meteredPricingHealth(facts, ms) {
1404
1404
  graceMinutes: 90,
1405
1405
  drives: 'Sends the one summary a workspace gets when more items were held or flagged in an hour than are sent one by one (AGL-3368). If it stops, a workspace whose attack ended hears nothing about the items folded into its digest until its next notice.'
1406
1406
  },
1407
+ {
1408
+ id: 'web-risk-recheck',
1409
+ label: 'Link re-check (Web Risk)',
1410
+ // Daily on Cloud Scheduler (AGL-3451); the dailies' ninety-minute grace.
1411
+ cron: '30 9 * * *',
1412
+ runner: 'cloud-scheduler',
1413
+ target: '/api/admin/web-risk-recheck',
1414
+ graceMinutes: 90,
1415
+ drives: 'Looks up every live page’s outside links against Google Web Risk again, and holds a page whose link has been listed since it went live; a new workspace’s page also gets its security hold (AGL-3451, AGL-3450). If it stops, a page that linked to a harvester before the harvester was listed keeps serving until somebody publishes it again or a render after the cache expires catches it.'
1416
+ },
1407
1417
  {
1408
1418
  id: 'firestore-export',
1409
1419
  label: 'Weekly Firestore export',
@@ -1556,6 +1566,29 @@ export function meteredPricingHealth(facts, ms) {
1556
1566
  graceMinutes: 45,
1557
1567
  drives: 'Asks every health check on the install so a degraded one emails the operator even with no uptime monitor watching; flags support tickets past their response time; sends the daily operator digest (AGL-3377). If it stops, a check that goes red is only noticed by whoever reads it, overdue tickets say nothing, and digest alerts pile up unsent — while every immediate alert still goes out.'
1558
1568
  },
1569
+ {
1570
+ id: 'security-holds',
1571
+ label: 'Automatic security holds',
1572
+ // The ninth route on the `consoleFastCrons` job (AGL-3450): the page
1573
+ // screen records a young workspace's hold wherever it runs, and this is
1574
+ // what places it.
1575
+ cron: '*/15 * * * *',
1576
+ runner: 'cloud-scheduler',
1577
+ target: 'consoleFastCrons \u2192 console /api/admin/security-holds',
1578
+ graceMinutes: 45,
1579
+ drives: 'Places the security hold the page screen asks for when it holds a phishing page from a workspace in its first two weeks: the workspace, the site (as a takedown) and the publishing account are locked as security, and staff are alerted (AGL-3450). If it stops, the page itself stays held, but the account that published it keeps working — it can publish the next page and send mail — until somebody locks it by hand.'
1580
+ },
1581
+ {
1582
+ id: 'transfer-jobs',
1583
+ label: 'Import sweep',
1584
+ // The tenth route on the `consoleFastCrons` job (AGL-3524): the browser
1585
+ // drives an import's Apply, and this finishes one whose tab closed.
1586
+ cron: '*/15 * * * *',
1587
+ runner: 'cloud-scheduler',
1588
+ target: 'consoleFastCrons \u2192 console /api/admin/transfer-jobs',
1589
+ graceMinutes: 45,
1590
+ drives: 'Resumes every import a closed tab left part-written: the rows not yet written are written, chunk by chunk, under the ledger that keeps a row from being written twice (AGL-3524). If it stops, an import someone started and walked away from stays half applied until they open it again and press Resume.'
1591
+ },
1559
1592
  {
1560
1593
  id: 'ai-jobs-beat',
1561
1594
  label: 'AI jobs beat',