@aglyn/aglyn 1.7.0 → 1.9.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 (64) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/ai-credit-blocks.d.ts +124 -0
  3. package/src/lib/app-utils/ai-credit-blocks.js +122 -0
  4. package/src/lib/app-utils/ai-credit-blocks.js.map +1 -0
  5. package/src/lib/app-utils/bundle-intent.d.ts +17 -51
  6. package/src/lib/app-utils/bundle-intent.js +30 -74
  7. package/src/lib/app-utils/bundle-intent.js.map +1 -1
  8. package/src/lib/app-utils/contacts.d.ts +4 -1
  9. package/src/lib/app-utils/contacts.js.map +1 -1
  10. package/src/lib/app-utils/docs-help-sections.generated.js +3 -3
  11. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  12. package/src/lib/app-utils/docs-help.generated.d.ts +1 -1
  13. package/src/lib/app-utils/docs-help.generated.js +1 -1
  14. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  15. package/src/lib/app-utils/docs-index.generated.js +97 -97
  16. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  17. package/src/lib/app-utils/error-beacon.d.ts +25 -1
  18. package/src/lib/app-utils/error-beacon.js +55 -4
  19. package/src/lib/app-utils/error-beacon.js.map +1 -1
  20. package/src/lib/app-utils/foreign-script.d.ts +1 -1
  21. package/src/lib/app-utils/foreign-script.js +1 -1
  22. package/src/lib/app-utils/foreign-script.js.map +1 -1
  23. package/src/lib/app-utils/margin-utilization.js +6 -5
  24. package/src/lib/app-utils/margin-utilization.js.map +1 -1
  25. package/src/lib/app-utils/onboarding-deep-link.d.ts +10 -11
  26. package/src/lib/app-utils/onboarding-deep-link.js +37 -32
  27. package/src/lib/app-utils/onboarding-deep-link.js.map +1 -1
  28. package/src/lib/app-utils/operator-alerts.js +17 -0
  29. package/src/lib/app-utils/operator-alerts.js.map +1 -1
  30. package/src/lib/app-utils/plan-entitlements.d.ts +142 -150
  31. package/src/lib/app-utils/plan-entitlements.js +202 -201
  32. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  33. package/src/lib/app-utils/release-flags.d.ts +6 -4
  34. package/src/lib/app-utils/release-flags.js +8 -9
  35. package/src/lib/app-utils/release-flags.js.map +1 -1
  36. package/src/lib/app-utils/server.d.ts +1 -0
  37. package/src/lib/app-utils/server.js +3 -0
  38. package/src/lib/app-utils/server.js.map +1 -1
  39. package/src/lib/app-utils/site-interactions.d.ts +1 -1
  40. package/src/lib/app-utils/site-interactions.js +2 -2
  41. package/src/lib/app-utils/site-interactions.js.map +1 -1
  42. package/src/lib/app-utils/transactional-email-ceiling.d.ts +119 -0
  43. package/src/lib/app-utils/transactional-email-ceiling.js +134 -0
  44. package/src/lib/app-utils/transactional-email-ceiling.js.map +1 -0
  45. package/src/lib/app-utils/upgrade-proposal.d.ts +17 -7
  46. package/src/lib/app-utils/upgrade-proposal.js +20 -13
  47. package/src/lib/app-utils/upgrade-proposal.js.map +1 -1
  48. package/src/lib/foundation/definitions/org-billing.types.d.ts +4 -29
  49. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  50. package/src/lib/foundation/definitions/organization.types.d.ts +1 -3
  51. package/src/lib/foundation/definitions/organization.types.js.map +1 -1
  52. package/src/lib/foundation/index.d.ts +1 -1
  53. package/src/lib/foundation/index.js.map +1 -1
  54. package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +0 -6
  55. package/src/lib/plugin-manager/first-party-plugins.generated.js +9 -55
  56. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  57. package/src/lib/plugin-manager/plugin-usage-axes.d.ts +14 -0
  58. package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
  59. package/src/lib/plugin-manager/video-embed-provider.d.ts +29 -0
  60. package/src/lib/plugin-manager/video-embed-provider.js +26 -7
  61. package/src/lib/plugin-manager/video-embed-provider.js.map +1 -1
  62. package/src/lib/plugin-manager/video-embed-providers.generated.d.ts +11 -0
  63. package/src/lib/plugin-manager/video-embed-providers.generated.js +161 -0
  64. package/src/lib/plugin-manager/video-embed-providers.generated.js.map +1 -0
@@ -47,17 +47,17 @@ export declare function readUpgradeProposal(org: Partial<AglynOrgBilling> | null
47
47
  /**
48
48
  * The bundle half of a proposal (AGL-3956) as it is stored: add-ons through
49
49
  * the shared parser and fitted to the plan, an interval only when one was
50
- * chosen, a coupon only when it reads as a code, and the Aglyn AI tier
51
- * (AGL-3965) only with the AI add-on — an `ai:<tier>` entry, or the stored
52
- * `aiTier`. Whatever cannot be honored is left out rather than stored, so
53
- * Billing is never asked to preselect something the checkout would refuse.
50
+ * chosen, and a coupon only when it reads as a code. Aglyn AI is a number of
51
+ * credit blocks like any quantity add-on (AGL-4144); a retired tier name is
52
+ * dropped by the parser, never stored. Whatever cannot be honored is left out
53
+ * rather than stored, so Billing is never asked to preselect something the
54
+ * checkout would refuse.
54
55
  */
55
56
  export declare function normalizeUpgradeProposalBundle(plan: OrgPlan, input: {
56
57
  addons?: unknown;
57
58
  interval?: unknown;
58
59
  coupon?: unknown;
59
- aiTier?: unknown;
60
- } | null | undefined): Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon' | 'aiTier'>;
60
+ } | null | undefined): Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon'>;
61
61
  /**
62
62
  * The proposal the workspace should be shown: the stored one, while no
63
63
  * subscription is live.
@@ -69,7 +69,7 @@ export declare function normalizeUpgradeProposalBundle(plan: OrgPlan, input: {
69
69
  * clears the field then, and this hides it in the meantime.
70
70
  */
71
71
  export declare function standingUpgradeProposal(org: Partial<AglynOrgBilling> | null | undefined): OrgUpgradeProposal | null;
72
- type ProposalBundle = Pick<OrgUpgradeProposal, 'plan'> & Partial<Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon' | 'aiTier'>>;
72
+ type ProposalBundle = Pick<OrgUpgradeProposal, 'plan'> & Partial<Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon'>>;
73
73
  /**
74
74
  * The intent a proposal carries into Billing: the plan, and the add-ons,
75
75
  * cadence and coupon staff proposed with it (AGL-3956) — the same fields the
@@ -77,6 +77,16 @@ type ProposalBundle = Pick<OrgUpgradeProposal, 'plan'> & Partial<Pick<OrgUpgrade
77
77
  * land on the same preselected page.
78
78
  */
79
79
  export declare function upgradeProposalIntent(proposal: ProposalBundle): OnboardingPlanIntent;
80
+ /**
81
+ * The bundle Billing prices (AGL-4154): the link's, else the standing
82
+ * proposal's.
83
+ *
84
+ * A link says what the visitor came to buy, so it wins. Without one, an owner
85
+ * who opened Billing from the menu still meets the plan, cadence, add-ons and
86
+ * code staff proposed, and the code is tried on the first quote as the link
87
+ * would try it, so a coupon on a hand-off never has to be typed.
88
+ */
89
+ export declare function billingPlanIntent(linkIntent: OnboardingPlanIntent | null, proposal: ProposalBundle | null | undefined): OnboardingPlanIntent | null;
80
90
  /** Where the proposal's button goes: Billing, with the bundle preselected. */
81
91
  export declare function upgradeProposalDestination(orgSlug: string, proposal: ProposalBundle): string;
82
92
  /** "Starter with Site Care, billed yearly, code BOOTH25". */
@@ -26,7 +26,7 @@
26
26
  import { describeBundle, fitBundleAddonsToPlan, hasBundleAddons, normalizeBundleCoupon, parseBundleAddons } from "./bundle-intent.js";
27
27
  import { onboardingDestination } from "./onboarding-deep-link.js";
28
28
  import { isLiveSubscriptionStatus } from "./org-billing-doc.js";
29
- import { isAiTierId, PLAN_LABELS, SELF_SERVE_PLANS } from "./plan-entitlements.js";
29
+ import { PLAN_LABELS, SELF_SERVE_PLANS } from "./plan-entitlements.js";
30
30
  /** The longest staff note a proposal carries. */ export const UPGRADE_PROPOSAL_NOTE_MAX = 500;
31
31
  /**
32
32
  * The plans staff may propose: every tier a customer can buy themselves,
@@ -64,24 +64,22 @@ export function isUpgradeProposalPlan(plan) {
64
64
  /**
65
65
  * The bundle half of a proposal (AGL-3956) as it is stored: add-ons through
66
66
  * the shared parser and fitted to the plan, an interval only when one was
67
- * chosen, a coupon only when it reads as a code, and the Aglyn AI tier
68
- * (AGL-3965) only with the AI add-on — an `ai:<tier>` entry, or the stored
69
- * `aiTier`. Whatever cannot be honored is left out rather than stored, so
70
- * Billing is never asked to preselect something the checkout would refuse.
67
+ * chosen, and a coupon only when it reads as a code. Aglyn AI is a number of
68
+ * credit blocks like any quantity add-on (AGL-4144); a retired tier name is
69
+ * dropped by the parser, never stored. Whatever cannot be honored is left out
70
+ * rather than stored, so Billing is never asked to preselect something the
71
+ * checkout would refuse.
71
72
  */ export function normalizeUpgradeProposalBundle(plan, input) {
72
73
  const parsed = parseBundleAddons(input == null ? void 0 : input.addons);
73
74
  const addons = fitBundleAddonsToPlan(parsed.addons, plan).addons;
74
75
  const interval = (input == null ? void 0 : input.interval) === 'year' || (input == null ? void 0 : input.interval) === 'month' ? input.interval : undefined;
75
76
  const coupon = normalizeBundleCoupon(input == null ? void 0 : input.coupon);
76
- const aiTier = addons.aiAddon ? isAiTierId(input == null ? void 0 : input.aiTier) ? input.aiTier : parsed.aiTier : undefined;
77
77
  return _extends({}, hasBundleAddons(addons) ? {
78
78
  addons
79
79
  } : {}, interval ? {
80
80
  interval
81
81
  } : {}, coupon ? {
82
82
  coupon
83
- } : {}, aiTier ? {
84
- aiTier
85
83
  } : {});
86
84
  }
87
85
  /**
@@ -115,25 +113,34 @@ export function isUpgradeProposalPlan(plan) {
115
113
  contactSales: false
116
114
  }, addons.aiAddon ? {
117
115
  ai: true
118
- } : {}, addons.aiAddon && isAiTierId(proposal.aiTier) ? {
119
- aiTier: proposal.aiTier
120
116
  } : {}, hasBundleAddons(addons) ? {
121
117
  addons
122
118
  } : {}, coupon ? {
123
119
  coupon
124
120
  } : {});
125
121
  }
122
+ /**
123
+ * The bundle Billing prices (AGL-4154): the link's, else the standing
124
+ * proposal's.
125
+ *
126
+ * A link says what the visitor came to buy, so it wins. Without one, an owner
127
+ * who opened Billing from the menu still meets the plan, cadence, add-ons and
128
+ * code staff proposed, and the code is tried on the first quote as the link
129
+ * would try it, so a coupon on a hand-off never has to be typed.
130
+ */ export function billingPlanIntent(linkIntent, proposal) {
131
+ if (linkIntent) return linkIntent;
132
+ return proposal ? upgradeProposalIntent(proposal) : null;
133
+ }
126
134
  /** Where the proposal's button goes: Billing, with the bundle preselected. */ export function upgradeProposalDestination(orgSlug, proposal) {
127
135
  return onboardingDestination(orgSlug, upgradeProposalIntent(proposal));
128
136
  }
129
137
  /** "Starter with Site Care, billed yearly, code BOOTH25". */ export function upgradeProposalSummary(proposal, options = {}) {
130
- var _proposal_addons, _proposal_interval, _proposal_coupon, _proposal_aiTier;
138
+ var _proposal_addons, _proposal_interval, _proposal_coupon;
131
139
  return describeBundle({
132
140
  plan: proposal.plan,
133
141
  addons: (_proposal_addons = proposal.addons) != null ? _proposal_addons : null,
134
142
  interval: (_proposal_interval = proposal.interval) != null ? _proposal_interval : null,
135
- coupon: (_proposal_coupon = proposal.coupon) != null ? _proposal_coupon : null,
136
- aiTier: (_proposal_aiTier = proposal.aiTier) != null ? _proposal_aiTier : null
143
+ coupon: (_proposal_coupon = proposal.coupon) != null ? _proposal_coupon : null
137
144
  }, options);
138
145
  }
139
146
  /** "Acme's Aglyn team proposed the Starter plan". */ export function upgradeProposalHeadline(proposal, options) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/upgrade-proposal.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 * The platform team's request that a workspace move to a paid plan\n * (AGL-3466), read in one place.\n *\n * A workspace staff build for a client is handed over first and sold second:\n * the client joins, looks around on whatever the workspace already has, and\n * only then is asked to upgrade. Staff record that ask as\n * `orgs/{orgId}.upgradeProposal`; this module decides whether it still\n * stands, what it may name, and where the button under it goes.\n */\n\nimport type {\n AglynOrgBilling,\n OrgPlan,\n OrgUpgradeProposal,\n} from '../foundation/definitions/org-billing.types'\nimport {\n describeBundle,\n fitBundleAddonsToPlan,\n hasBundleAddons,\n normalizeBundleCoupon,\n parseBundleAddons,\n type BundleAddons,\n} from './bundle-intent'\nimport {\n onboardingDestination,\n type OnboardingPlanIntent,\n} from './onboarding-deep-link'\nimport { isLiveSubscriptionStatus } from './org-billing-doc'\nimport { isAiTierId, PLAN_LABELS, SELF_SERVE_PLANS } from './plan-entitlements'\n\n/** The longest staff note a proposal carries. */\nexport const UPGRADE_PROPOSAL_NOTE_MAX = 500\n\n/**\n * The plans staff may propose: every tier a customer can buy themselves,\n * less Free, which is not a purchase. Enterprise is quoted per deal, so it\n * is never proposed through a checkout link.\n */\nexport const UPGRADE_PROPOSAL_PLANS: readonly OrgPlan[] = SELF_SERVE_PLANS.filter(\n (plan) => plan !== 'free',\n)\n\nexport function isUpgradeProposalPlan(plan: unknown): plan is OrgPlan {\n return (\n typeof plan === 'string' &&\n (UPGRADE_PROPOSAL_PLANS as readonly string[]).includes(plan)\n )\n}\n\n/** A staff note as it is stored: trimmed, bounded, and absent when blank. */\nexport function normalizeUpgradeProposalNote(note: unknown): string | undefined {\n if (typeof note !== 'string') return undefined\n const trimmed = note.trim().slice(0, UPGRADE_PROPOSAL_NOTE_MAX)\n return trimmed || undefined\n}\n\n/**\n * The stored proposal, narrowed, or null when there is none worth showing.\n *\n * A proposal naming a plan this build cannot sell reads as none: a card whose\n * button opens a checkout for an unknown tier is worse than no card.\n */\nexport function readUpgradeProposal(\n org: Partial<AglynOrgBilling> | null | undefined,\n): OrgUpgradeProposal | null {\n const raw = org?.upgradeProposal as Partial<OrgUpgradeProposal> | null | undefined\n if (!raw || typeof raw !== 'object' || !isUpgradeProposalPlan(raw.plan)) {\n return null\n }\n const note = normalizeUpgradeProposalNote(raw.note)\n const bundle = normalizeUpgradeProposalBundle(raw.plan, raw)\n return {\n plan: raw.plan,\n proposedBy: typeof raw.proposedBy === 'string' ? raw.proposedBy : '',\n proposedAt: Number.isFinite(raw.proposedAt) ? Number(raw.proposedAt) : 0,\n ...(note ? { note } : {}),\n ...bundle,\n }\n}\n\n/**\n * The bundle half of a proposal (AGL-3956) as it is stored: add-ons through\n * the shared parser and fitted to the plan, an interval only when one was\n * chosen, a coupon only when it reads as a code, and the Aglyn AI tier\n * (AGL-3965) only with the AI add-on — an `ai:<tier>` entry, or the stored\n * `aiTier`. Whatever cannot be honored is left out rather than stored, so\n * Billing is never asked to preselect something the checkout would refuse.\n */\nexport function normalizeUpgradeProposalBundle(\n plan: OrgPlan,\n input:\n | { addons?: unknown; interval?: unknown; coupon?: unknown; aiTier?: unknown }\n | null\n | undefined,\n): Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon' | 'aiTier'> {\n const parsed = parseBundleAddons(input?.addons)\n const addons: BundleAddons = fitBundleAddonsToPlan(parsed.addons, plan).addons\n const interval =\n input?.interval === 'year' || input?.interval === 'month' ? input.interval : undefined\n const coupon = normalizeBundleCoupon(input?.coupon)\n const aiTier = addons.aiAddon\n ? isAiTierId(input?.aiTier)\n ? input.aiTier\n : parsed.aiTier\n : undefined\n return {\n ...(hasBundleAddons(addons) ? { addons } : {}),\n ...(interval ? { interval } : {}),\n ...(coupon ? { coupon } : {}),\n ...(aiTier ? { aiTier } : {}),\n }\n}\n\n/**\n * The proposal the workspace should be shown: the stored one, while no\n * subscription is live.\n *\n * `billingStatus` is the org document's mirror of the subscription status,\n * readable by every member, so this answers from the document the console\n * already holds. A live subscription means the workspace has bought a plan,\n * which settles the question the proposal asked; `writeOrgBilling`'s caller\n * clears the field then, and this hides it in the meantime.\n */\nexport function standingUpgradeProposal(\n org: Partial<AglynOrgBilling> | null | undefined,\n): OrgUpgradeProposal | null {\n if (isLiveSubscriptionStatus(org?.billingStatus)) return null\n return readUpgradeProposal(org)\n}\n\ntype ProposalBundle = Pick<OrgUpgradeProposal, 'plan'> &\n Partial<Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon' | 'aiTier'>>\n\n/**\n * The intent a proposal carries into Billing: the plan, and the add-ons,\n * cadence and coupon staff proposed with it (AGL-3956) — the same fields the\n * bundle checkout link carries (AGL-3955), so the proposal card and the link\n * land on the same preselected page.\n */\nexport function upgradeProposalIntent(proposal: ProposalBundle): OnboardingPlanIntent {\n const addons = fitBundleAddonsToPlan(proposal.addons, proposal.plan).addons\n const coupon = normalizeBundleCoupon(proposal.coupon)\n const interval = proposal.interval === 'year' || proposal.interval === 'month'\n ? proposal.interval\n : null\n return {\n plan: proposal.plan,\n interval: interval ?? 'month',\n // A proposal with no cadence names a plan, not a cadence, so the page\n // keeps whatever its toggle says rather than being told \"monthly\".\n intervalStated: interval !== null,\n contactSales: false,\n ...(addons.aiAddon ? { ai: true as const } : {}),\n ...(addons.aiAddon && isAiTierId(proposal.aiTier) ? { aiTier: proposal.aiTier } : {}),\n ...(hasBundleAddons(addons) ? { addons } : {}),\n ...(coupon ? { coupon } : {}),\n }\n}\n\n/** Where the proposal's button goes: Billing, with the bundle preselected. */\nexport function upgradeProposalDestination(\n orgSlug: string,\n proposal: ProposalBundle,\n): string {\n return onboardingDestination(orgSlug, upgradeProposalIntent(proposal))\n}\n\n/** \"Starter with Site Care, billed yearly, code BOOTH25\". */\nexport function upgradeProposalSummary(\n proposal: ProposalBundle,\n options: { brand?: string } = {},\n): string {\n return describeBundle(\n {\n plan: proposal.plan,\n addons: proposal.addons ?? null,\n interval: proposal.interval ?? null,\n coupon: proposal.coupon ?? null,\n aiTier: proposal.aiTier ?? null,\n },\n options,\n )\n}\n\n/** \"Acme's Aglyn team proposed the Starter plan\". */\nexport function upgradeProposalHeadline(\n proposal: Pick<OrgUpgradeProposal, 'plan'>,\n options: { orgName?: string | null; productName: string },\n): string {\n const workspace = options.orgName?.trim()\n const team = workspace\n ? `${workspace}'s ${options.productName} team`\n : `Your ${options.productName} team`\n return `${team} proposed the ${PLAN_LABELS[proposal.plan]} plan`\n}\n"],"names":["describeBundle","fitBundleAddonsToPlan","hasBundleAddons","normalizeBundleCoupon","parseBundleAddons","onboardingDestination","isLiveSubscriptionStatus","isAiTierId","PLAN_LABELS","SELF_SERVE_PLANS","UPGRADE_PROPOSAL_NOTE_MAX","UPGRADE_PROPOSAL_PLANS","filter","plan","isUpgradeProposalPlan","includes","normalizeUpgradeProposalNote","note","undefined","trimmed","trim","slice","readUpgradeProposal","org","raw","upgradeProposal","bundle","normalizeUpgradeProposalBundle","proposedBy","proposedAt","Number","isFinite","input","parsed","addons","interval","coupon","aiTier","aiAddon","standingUpgradeProposal","billingStatus","upgradeProposalIntent","proposal","intervalStated","contactSales","ai","upgradeProposalDestination","orgSlug","upgradeProposalSummary","options","upgradeProposalHeadline","workspace","orgName","team","productName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;CASC;AAOD,SACEA,cAAc,EACdC,qBAAqB,EACrBC,eAAe,EACfC,qBAAqB,EACrBC,iBAAiB,QAEZ,qBAAiB;AACxB,SACEC,qBAAqB,QAEhB,4BAAwB;AAC/B,SAASC,wBAAwB,QAAQ,uBAAmB;AAC5D,SAASC,UAAU,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,yBAAqB;AAE/E,+CAA+C,GAC/C,OAAO,MAAMC,4BAA4B,IAAG;AAE5C;;;;CAIC,GACD,OAAO,MAAMC,yBAA6CF,iBAAiBG,MAAM,CAC/E,CAACC,OAASA,SAAS,QACpB;AAED,OAAO,SAASC,sBAAsBD,IAAa;IACjD,OACE,OAAOA,SAAS,YAChB,AAACF,uBAA6CI,QAAQ,CAACF;AAE3D;AAEA,2EAA2E,GAC3E,OAAO,SAASG,6BAA6BC,IAAa;IACxD,IAAI,OAAOA,SAAS,UAAU,OAAOC;IACrC,MAAMC,UAAUF,KAAKG,IAAI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M,mBAAAA,SAASN,MAAM,YAAfM,mBAAmB;QAC3BL,MAAM,GAAEK,mBAAAA,SAASL,MAAM,YAAfK,mBAAmB;IAC7B,GACAO;AAEJ;AAEA,mDAAmD,GACnD,OAAO,SAASC,wBACdR,QAA0C,EAC1CO,OAAyD;QAEvCA;IAAlB,MAAME,aAAYF,mBAAAA,QAAQG,OAAO,qBAAfH,iBAAiB7B,IAAI;IACvC,MAAMiC,OAAOF,YACT,GAAGA,UAAU,GAAG,EAAEF,QAAQK,WAAW,CAAC,KAAK,CAAC,GAC5C,CAAC,KAAK,EAAEL,QAAQK,WAAW,CAAC,KAAK,CAAC;IACtC,OAAO,GAAGD,KAAK,cAAc,EAAE7C,WAAW,CAACkC,SAAS7B,IAAI,CAAC,CAAC,KAAK,CAAC;AAClE"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/upgrade-proposal.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 * The platform team's request that a workspace move to a paid plan\n * (AGL-3466), read in one place.\n *\n * A workspace staff build for a client is handed over first and sold second:\n * the client joins, looks around on whatever the workspace already has, and\n * only then is asked to upgrade. Staff record that ask as\n * `orgs/{orgId}.upgradeProposal`; this module decides whether it still\n * stands, what it may name, and where the button under it goes.\n */\n\nimport type {\n AglynOrgBilling,\n OrgPlan,\n OrgUpgradeProposal,\n} from '../foundation/definitions/org-billing.types'\nimport {\n describeBundle,\n fitBundleAddonsToPlan,\n hasBundleAddons,\n normalizeBundleCoupon,\n parseBundleAddons,\n type BundleAddons,\n} from './bundle-intent'\nimport {\n onboardingDestination,\n type OnboardingPlanIntent,\n} from './onboarding-deep-link'\nimport { isLiveSubscriptionStatus } from './org-billing-doc'\nimport { PLAN_LABELS, SELF_SERVE_PLANS } from './plan-entitlements'\n\n/** The longest staff note a proposal carries. */\nexport const UPGRADE_PROPOSAL_NOTE_MAX = 500\n\n/**\n * The plans staff may propose: every tier a customer can buy themselves,\n * less Free, which is not a purchase. Enterprise is quoted per deal, so it\n * is never proposed through a checkout link.\n */\nexport const UPGRADE_PROPOSAL_PLANS: readonly OrgPlan[] = SELF_SERVE_PLANS.filter(\n (plan) => plan !== 'free',\n)\n\nexport function isUpgradeProposalPlan(plan: unknown): plan is OrgPlan {\n return (\n typeof plan === 'string' &&\n (UPGRADE_PROPOSAL_PLANS as readonly string[]).includes(plan)\n )\n}\n\n/** A staff note as it is stored: trimmed, bounded, and absent when blank. */\nexport function normalizeUpgradeProposalNote(note: unknown): string | undefined {\n if (typeof note !== 'string') return undefined\n const trimmed = note.trim().slice(0, UPGRADE_PROPOSAL_NOTE_MAX)\n return trimmed || undefined\n}\n\n/**\n * The stored proposal, narrowed, or null when there is none worth showing.\n *\n * A proposal naming a plan this build cannot sell reads as none: a card whose\n * button opens a checkout for an unknown tier is worse than no card.\n */\nexport function readUpgradeProposal(\n org: Partial<AglynOrgBilling> | null | undefined,\n): OrgUpgradeProposal | null {\n const raw = org?.upgradeProposal as Partial<OrgUpgradeProposal> | null | undefined\n if (!raw || typeof raw !== 'object' || !isUpgradeProposalPlan(raw.plan)) {\n return null\n }\n const note = normalizeUpgradeProposalNote(raw.note)\n const bundle = normalizeUpgradeProposalBundle(raw.plan, raw)\n return {\n plan: raw.plan,\n proposedBy: typeof raw.proposedBy === 'string' ? raw.proposedBy : '',\n proposedAt: Number.isFinite(raw.proposedAt) ? Number(raw.proposedAt) : 0,\n ...(note ? { note } : {}),\n ...bundle,\n }\n}\n\n/**\n * The bundle half of a proposal (AGL-3956) as it is stored: add-ons through\n * the shared parser and fitted to the plan, an interval only when one was\n * chosen, and a coupon only when it reads as a code. Aglyn AI is a number of\n * credit blocks like any quantity add-on (AGL-4144); a retired tier name is\n * dropped by the parser, never stored. Whatever cannot be honored is left out\n * rather than stored, so Billing is never asked to preselect something the\n * checkout would refuse.\n */\nexport function normalizeUpgradeProposalBundle(\n plan: OrgPlan,\n input:\n | { addons?: unknown; interval?: unknown; coupon?: unknown }\n | null\n | undefined,\n): Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon'> {\n const parsed = parseBundleAddons(input?.addons)\n const addons: BundleAddons = fitBundleAddonsToPlan(parsed.addons, plan).addons\n const interval =\n input?.interval === 'year' || input?.interval === 'month' ? input.interval : undefined\n const coupon = normalizeBundleCoupon(input?.coupon)\n return {\n ...(hasBundleAddons(addons) ? { addons } : {}),\n ...(interval ? { interval } : {}),\n ...(coupon ? { coupon } : {}),\n }\n}\n\n/**\n * The proposal the workspace should be shown: the stored one, while no\n * subscription is live.\n *\n * `billingStatus` is the org document's mirror of the subscription status,\n * readable by every member, so this answers from the document the console\n * already holds. A live subscription means the workspace has bought a plan,\n * which settles the question the proposal asked; `writeOrgBilling`'s caller\n * clears the field then, and this hides it in the meantime.\n */\nexport function standingUpgradeProposal(\n org: Partial<AglynOrgBilling> | null | undefined,\n): OrgUpgradeProposal | null {\n if (isLiveSubscriptionStatus(org?.billingStatus)) return null\n return readUpgradeProposal(org)\n}\n\ntype ProposalBundle = Pick<OrgUpgradeProposal, 'plan'> &\n Partial<Pick<OrgUpgradeProposal, 'addons' | 'interval' | 'coupon'>>\n\n/**\n * The intent a proposal carries into Billing: the plan, and the add-ons,\n * cadence and coupon staff proposed with it (AGL-3956) — the same fields the\n * bundle checkout link carries (AGL-3955), so the proposal card and the link\n * land on the same preselected page.\n */\nexport function upgradeProposalIntent(proposal: ProposalBundle): OnboardingPlanIntent {\n const addons = fitBundleAddonsToPlan(proposal.addons, proposal.plan).addons\n const coupon = normalizeBundleCoupon(proposal.coupon)\n const interval = proposal.interval === 'year' || proposal.interval === 'month'\n ? proposal.interval\n : null\n return {\n plan: proposal.plan,\n interval: interval ?? 'month',\n // A proposal with no cadence names a plan, not a cadence, so the page\n // keeps whatever its toggle says rather than being told \"monthly\".\n intervalStated: interval !== null,\n contactSales: false,\n ...(addons.aiAddon ? { ai: true as const } : {}),\n ...(hasBundleAddons(addons) ? { addons } : {}),\n ...(coupon ? { coupon } : {}),\n }\n}\n\n/**\n * The bundle Billing prices (AGL-4154): the link's, else the standing\n * proposal's.\n *\n * A link says what the visitor came to buy, so it wins. Without one, an owner\n * who opened Billing from the menu still meets the plan, cadence, add-ons and\n * code staff proposed, and the code is tried on the first quote as the link\n * would try it, so a coupon on a hand-off never has to be typed.\n */\nexport function billingPlanIntent(\n linkIntent: OnboardingPlanIntent | null,\n proposal: ProposalBundle | null | undefined,\n): OnboardingPlanIntent | null {\n if (linkIntent) return linkIntent\n return proposal ? upgradeProposalIntent(proposal) : null\n}\n\n/** Where the proposal's button goes: Billing, with the bundle preselected. */\nexport function upgradeProposalDestination(\n orgSlug: string,\n proposal: ProposalBundle,\n): string {\n return onboardingDestination(orgSlug, upgradeProposalIntent(proposal))\n}\n\n/** \"Starter with Site Care, billed yearly, code BOOTH25\". */\nexport function upgradeProposalSummary(\n proposal: ProposalBundle,\n options: { brand?: string } = {},\n): string {\n return describeBundle(\n {\n plan: proposal.plan,\n addons: proposal.addons ?? null,\n interval: proposal.interval ?? null,\n coupon: proposal.coupon ?? null,\n },\n options,\n )\n}\n\n/** \"Acme's Aglyn team proposed the Starter plan\". */\nexport function upgradeProposalHeadline(\n proposal: Pick<OrgUpgradeProposal, 'plan'>,\n options: { orgName?: string | null; productName: string },\n): string {\n const workspace = options.orgName?.trim()\n const team = workspace\n ? `${workspace}'s ${options.productName} team`\n : `Your ${options.productName} team`\n return `${team} proposed the ${PLAN_LABELS[proposal.plan]} plan`\n}\n"],"names":["describeBundle","fitBundleAddonsToPlan","hasBundleAddons","normalizeBundleCoupon","parseBundleAddons","onboardingDestination","isLiveSubscriptionStatus","PLAN_LABELS","SELF_SERVE_PLANS","UPGRADE_PROPOSAL_NOTE_MAX","UPGRADE_PROPOSAL_PLANS","filter","plan","isUpgradeProposalPlan","includes","normalizeUpgradeProposalNote","note","undefined","trimmed","trim","slice","readUpgradeProposal","org","raw","upgradeProposal","bundle","normalizeUpgradeProposalBundle","proposedBy","proposedAt","Number","isFinite","input","parsed","addons","interval","coupon","standingUpgradeProposal","billingStatus","upgradeProposalIntent","proposal","intervalStated","contactSales","aiAddon","ai","billingPlanIntent","linkIntent","upgradeProposalDestination","orgSlug","upgradeProposalSummary","options","upgradeProposalHeadline","workspace","orgName","team","productName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;CASC;AAOD,SACEA,cAAc,EACdC,qBAAqB,EACrBC,eAAe,EACfC,qBAAqB,EACrBC,iBAAiB,QAEZ,qBAAiB;AACxB,SACEC,qBAAqB,QAEhB,4BAAwB;AAC/B,SAASC,wBAAwB,QAAQ,uBAAmB;AAC5D,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,yBAAqB;AAEnE,+CAA+C,GAC/C,OAAO,MAAMC,4BAA4B,IAAG;AAE5C;;;;CAIC,GACD,OAAO,MAAMC,yBAA6CF,iBAAiBG,MAAM,CAC/E,CAACC,OAASA,SAAS,QACpB;AAED,OAAO,SAASC,sBAAsBD,IAAa;IACjD,OACE,OAAOA,SAAS,YAChB,AAACF,uBAA6CI,QAAQ,CAACF;AAE3D;AAEA,2EAA2E,GAC3E,OAAO,SAASG,6BAA6BC,IAAa;IACxD,IAAI,OAAOA,SAAS,UAAU,OAAOC;IACrC,MAAMC,UAAUF,KAAKG,IAAI,GAAGC,KAAK,CAAC,GAAGX;IACrC,OAAOS,WAAWD;AACpB;AAEA;;;;;CAKC,GACD,OAAO,SAASI,oBACdC,GAAgD;IAEhD,MAAMC,MAAMD,uBAAAA,IAAKE,eAAe;IAChC,IAAI,CAACD,OAAO,OAAOA,QAAQ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WAAW,CAAC,KAAK,CAAC;IACtC,OAAO,GAAGD,KAAK,cAAc,EAAE9C,WAAW,CAACgC,SAAS3B,IAAI,CAAC,CAAC,KAAK,CAAC;AAClE"}
@@ -660,11 +660,6 @@ export interface OrgPlanComp {
660
660
  /** When it was granted — the server's clock. */
661
661
  grantedAt: ITimestamp | null;
662
662
  }
663
- /**
664
- * The Aglyn AI tiers (AGL-3965), smallest first. Sold on their own to any
665
- * paid plan; the figures are `AI_TIERS` in `plan-entitlements.ts`.
666
- */
667
- export type AiTierId = 'spark' | 'boost' | 'plus' | 'max' | 'ultra' | 'studio';
668
663
  /**
669
664
  * Paid addon quantities (AGL-112/524) purchased on top of the plan's
670
665
  * included allowances, billed as items on the org's Stripe subscription.
@@ -718,12 +713,10 @@ export interface OrgSeatAddons {
718
713
  */
719
714
  siteCare?: number;
720
715
  /**
721
- * Aglyn AI org-wide toggle, 0/1 (AGL-2896). One purchase covers every
722
- * host in the org, the way Event Calendar does: `resolveOrgEntitlements`
723
- * reads any quantity >= 1 as one and adds the purchased tier's credits
724
- * (`AI_TIERS[org.aiTier].credits`, AGL-3965) to `assistCreditsPerMonth`.
725
- * WHICH tier is `AglynOrgBilling.aiTier`; the price is the tier's, on any
726
- * paid plan (`planSellsAiTiers`).
716
+ * Aglyn AI credit blocks, 0 to 30 (AGL-2896, AGL-4144). Org-wide: one
717
+ * pool covers every host. `resolveOrgEntitlements` adds 5,000 credits a
718
+ * block (`ai-credit-blocks.ts`) to `assistCreditsPerMonth`, on any paid
719
+ * self-serve plan (`planSellsAiCredits`), at $10 a month a block.
727
720
  */
728
721
  aiAddon?: number;
729
722
  }
@@ -1145,18 +1138,6 @@ export interface AglynOrgBilling extends AglynDocument {
1145
1138
  enabledPlugins?: string[];
1146
1139
  /** Purchased addon seats (AGL-112); billed monthly per seat. */
1147
1140
  seatAddons?: OrgSeatAddons;
1148
- /**
1149
- * Which Aglyn AI tier `seatAddons.aiAddon` is (AGL-3965): Spark through
1150
- * Studio, read off the subscription's AI item by the webhook and the
1151
- * add-ons route, and written beside `seatAddons` by the same writes. An
1152
- * ENTITLEMENT INPUT like `seatAddons`, so Admin-SDK-only.
1153
- *
1154
- * Absent on an org whose add-on was bought before tiers existed: it then
1155
- * reads as the tier with that plan's old band and price
1156
- * (`LEGACY_AI_ADDON_TIER_BY_PLAN`), so no bill and no credit figure moved.
1157
- * `null` once written means no tier is held.
1158
- */
1159
- aiTier?: AiTierId | null;
1160
1141
  /**
1161
1142
  * POS register seats assigned out of the org pool (AGL-1775). An
1162
1143
  * ENTITLEMENT INPUT: it raises a per-site cap, so it is Admin-SDK-only.
@@ -1283,12 +1264,6 @@ export interface OrgUpgradeProposal {
1283
1264
  interval?: 'month' | 'year';
1284
1265
  /** A promotion code minted on the staff Coupons page, applied at checkout. */
1285
1266
  coupon?: string;
1286
- /**
1287
- * The Aglyn AI tier proposed with the AI add-on (AGL-3965), written
1288
- * `ai:<tier>` in the add-on list. Absent, checkout sells the plan's
1289
- * default tier.
1290
- */
1291
- aiTier?: AiTierId;
1292
1267
  }
1293
1268
  /**
1294
1269
  * What the CRM lets an organization decide for every site at once