@aglyn/aglyn 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/lib/app-utils/docs-help-sections.generated.js +1 -0
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-help.generated.d.ts +2 -2
- package/src/lib/app-utils/docs-help.generated.js +3 -1
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +10 -3
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/host-status.d.ts +2 -2
- package/src/lib/app-utils/host-status.js +2 -2
- package/src/lib/app-utils/host-status.js.map +1 -1
- package/src/lib/app-utils/plan-entitlements.d.ts +10 -2
- package/src/lib/app-utils/plan-entitlements.js +18 -7
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
|
@@ -70,12 +70,12 @@ export declare function describeHostStatus(host: {
|
|
|
70
70
|
suspendedUntilMs?: number;
|
|
71
71
|
}): HostStatus;
|
|
72
72
|
/**
|
|
73
|
-
* `6 of 10 sites ·
|
|
73
|
+
* `6 of 10 sites · Pro plan` — the meta line the Sites mockup puts
|
|
74
74
|
* opposite the section heading.
|
|
75
75
|
*
|
|
76
76
|
* Returns `undefined` rather than a partial line while the org or its plan
|
|
77
77
|
* is still resolving. A count against the FREE limit is what an unresolved
|
|
78
|
-
* org produces, and telling a
|
|
78
|
+
* org produces, and telling a Pro customer they are at "1 of 1 sites"
|
|
79
79
|
* is how a correct page delivers a false upgrade prompt.
|
|
80
80
|
*/
|
|
81
81
|
export declare function describeSiteAllowance(options: {
|
|
@@ -98,12 +98,12 @@
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* `6 of 10 sites ·
|
|
101
|
+
* `6 of 10 sites · Pro plan` — the meta line the Sites mockup puts
|
|
102
102
|
* opposite the section heading.
|
|
103
103
|
*
|
|
104
104
|
* Returns `undefined` rather than a partial line while the org or its plan
|
|
105
105
|
* is still resolving. A count against the FREE limit is what an unresolved
|
|
106
|
-
* org produces, and telling a
|
|
106
|
+
* org produces, and telling a Pro customer they are at "1 of 1 sites"
|
|
107
107
|
* is how a correct page delivers a false upgrade prompt.
|
|
108
108
|
*/ export function describeSiteAllowance(options) {
|
|
109
109
|
const { used, limit, planLabel, ready } = options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/host-status.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\nexport interface HostStatus {\n /** `Live`, `Draft`, `In preview`, `Maintenance`, `Suspended`. */\n label: string\n color: 'success' | 'default' | 'warning' | 'error'\n /** Why, in one sentence — the pill's tooltip. */\n detail: string\n}\n\n/**\n * How many pages this site publishes.\n *\n * Read off `host.screens` — the map publishing writes into the host document\n * (`hosts/{hostId}.screens[screenId] = slug`, see `template-screens.ts`) and\n * the tenant reads to route a request. So a site with an entry has at least\n * one page a visitor can reach, and one without has none. That makes this a\n * fact already sitting in a document its readers hold: **no extra read**, on\n * a page that can list a hundred sites.\n *\n * ⚠️ It counts PUBLISHED ROUTES, not authored work. A site with five\n * unpublished drafts counts 0 — the map is written by publishing and by\n * nothing else. Every caller is asking \"what can a visitor reach?\"; a caller\n * that means \"has anyone worked on this?\" is asking a different question and\n * this is the wrong number for it.\n *\n * The placeholder home page a new site is created with (AGL-3408) COUNTS\n * here: it is a page a visitor reaches, so a new site is Live. The first-run\n * offer asks a different question — has the OWNER published anything? — and\n * reads `hostIsBlankSite`, which discounts it.\n */\nexport function publishedScreenCount(\n host: { screens?: Record<string, unknown> } | null | undefined,\n): number {\n return Object.keys(host?.screens ?? {}).length\n}\n\n/**\n * The `Live` / `Draft` pill the console Sites mockup puts on every card\n * (AGL-2166).\n *\n * Derived from {@link publishedScreenCount}: the pill reports what a visitor\n * can reach, placeholder home page included.\n *\n * The staff admin host page has rendered a `published` / `draft` chip since\n * AGL-390 off `host.published`, which is not a field on `AglynHost` and is\n * written by nothing — so that chip has always said `draft`. Deriving from\n * `screens` is what it should have done.\n *\n * Order matters. A suspended site is not \"live\" whatever it has published,\n * and a site in maintenance is serving the 503 screen rather than its\n * pages — reporting either as `Live` would be the console agreeing with a\n * customer who thinks their site is up.\n */\nexport function describeHostStatus(host: {\n screens?: Record<string, unknown>\n maintenance?: boolean\n preview?: boolean\n suspendedAt?: number\n suspendedUntilMs?: number\n}): HostStatus {\n if (host?.suspendedAt) {\n // A timed suspension that has elapsed is over, even though the fields\n // are still on the document — the tenant makes the same check.\n const until = host.suspendedUntilMs\n if (!until || until > Date.now()) {\n return {\n label: 'Suspended',\n color: 'error',\n detail: 'This site is serving a lockdown notice instead of content.',\n }\n }\n }\n if (host?.maintenance) {\n return {\n label: 'Maintenance',\n color: 'warning',\n detail: 'Every path serves the maintenance page.',\n }\n }\n // A site in preview (AGL-4086) is not live to its visitors whatever it has\n // published: they get the 503 page or \"Coming soon\", and only the team\n // sees the pages.\n if (host?.preview === true) {\n return {\n label: 'In preview',\n color: 'default',\n detail:\n 'Only your team can see this site. Visitors see the 503 page or \"Coming soon\".',\n }\n }\n const published = publishedScreenCount(host)\n if (published > 0) {\n return {\n label: 'Live',\n color: 'success',\n detail: `${published} published page${published === 1 ? '' : 's'}.`,\n }\n }\n return {\n label: 'Draft',\n color: 'default',\n detail: 'Nothing published yet — visitors see the placeholder.',\n }\n}\n\n/**\n * `6 of 10 sites ·
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/host-status.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\nexport interface HostStatus {\n /** `Live`, `Draft`, `In preview`, `Maintenance`, `Suspended`. */\n label: string\n color: 'success' | 'default' | 'warning' | 'error'\n /** Why, in one sentence — the pill's tooltip. */\n detail: string\n}\n\n/**\n * How many pages this site publishes.\n *\n * Read off `host.screens` — the map publishing writes into the host document\n * (`hosts/{hostId}.screens[screenId] = slug`, see `template-screens.ts`) and\n * the tenant reads to route a request. So a site with an entry has at least\n * one page a visitor can reach, and one without has none. That makes this a\n * fact already sitting in a document its readers hold: **no extra read**, on\n * a page that can list a hundred sites.\n *\n * ⚠️ It counts PUBLISHED ROUTES, not authored work. A site with five\n * unpublished drafts counts 0 — the map is written by publishing and by\n * nothing else. Every caller is asking \"what can a visitor reach?\"; a caller\n * that means \"has anyone worked on this?\" is asking a different question and\n * this is the wrong number for it.\n *\n * The placeholder home page a new site is created with (AGL-3408) COUNTS\n * here: it is a page a visitor reaches, so a new site is Live. The first-run\n * offer asks a different question — has the OWNER published anything? — and\n * reads `hostIsBlankSite`, which discounts it.\n */\nexport function publishedScreenCount(\n host: { screens?: Record<string, unknown> } | null | undefined,\n): number {\n return Object.keys(host?.screens ?? {}).length\n}\n\n/**\n * The `Live` / `Draft` pill the console Sites mockup puts on every card\n * (AGL-2166).\n *\n * Derived from {@link publishedScreenCount}: the pill reports what a visitor\n * can reach, placeholder home page included.\n *\n * The staff admin host page has rendered a `published` / `draft` chip since\n * AGL-390 off `host.published`, which is not a field on `AglynHost` and is\n * written by nothing — so that chip has always said `draft`. Deriving from\n * `screens` is what it should have done.\n *\n * Order matters. A suspended site is not \"live\" whatever it has published,\n * and a site in maintenance is serving the 503 screen rather than its\n * pages — reporting either as `Live` would be the console agreeing with a\n * customer who thinks their site is up.\n */\nexport function describeHostStatus(host: {\n screens?: Record<string, unknown>\n maintenance?: boolean\n preview?: boolean\n suspendedAt?: number\n suspendedUntilMs?: number\n}): HostStatus {\n if (host?.suspendedAt) {\n // A timed suspension that has elapsed is over, even though the fields\n // are still on the document — the tenant makes the same check.\n const until = host.suspendedUntilMs\n if (!until || until > Date.now()) {\n return {\n label: 'Suspended',\n color: 'error',\n detail: 'This site is serving a lockdown notice instead of content.',\n }\n }\n }\n if (host?.maintenance) {\n return {\n label: 'Maintenance',\n color: 'warning',\n detail: 'Every path serves the maintenance page.',\n }\n }\n // A site in preview (AGL-4086) is not live to its visitors whatever it has\n // published: they get the 503 page or \"Coming soon\", and only the team\n // sees the pages.\n if (host?.preview === true) {\n return {\n label: 'In preview',\n color: 'default',\n detail:\n 'Only your team can see this site. Visitors see the 503 page or \"Coming soon\".',\n }\n }\n const published = publishedScreenCount(host)\n if (published > 0) {\n return {\n label: 'Live',\n color: 'success',\n detail: `${published} published page${published === 1 ? '' : 's'}.`,\n }\n }\n return {\n label: 'Draft',\n color: 'default',\n detail: 'Nothing published yet — visitors see the placeholder.',\n }\n}\n\n/**\n * `6 of 10 sites · Pro plan` — the meta line the Sites mockup puts\n * opposite the section heading.\n *\n * Returns `undefined` rather than a partial line while the org or its plan\n * is still resolving. A count against the FREE limit is what an unresolved\n * org produces, and telling a Pro customer they are at \"1 of 1 sites\"\n * is how a correct page delivers a false upgrade prompt.\n */\nexport function describeSiteAllowance(options: {\n used: number\n limit: number | undefined\n planLabel: string | undefined\n ready: boolean\n}): string | undefined {\n const { used, limit, planLabel, ready } = options\n if (!ready || !planLabel) return undefined\n /*\n * `Number.isFinite`, not `limit < 0` (AGL-2223).\n *\n * `UNLIMITED` is `Number.POSITIVE_INFINITY`, and Enterprise's `hostLimit`\n * is exactly that — so the `< 0` test was never true for the one plan the\n * Unlimited branch existed for, and an Enterprise organization read\n * `4 of Infinity sites · Enterprise plan`. The negative case is kept: an\n * entitlement override can carry a negative sentinel, and reading that as a\n * cap of \"-1 sites\" would be the same class of nonsense.\n */\n const cap =\n limit === undefined || limit === null\n ? undefined\n : !Number.isFinite(limit) || limit < 0\n ? 'Unlimited'\n : String(limit)\n const sites =\n cap === undefined\n ? `${used} site${used === 1 ? '' : 's'}`\n : `${used} of ${cap} site${cap === '1' ? '' : 's'}`\n return `${sites} · ${planLabel} plan`\n}\n"],"names":["publishedScreenCount","host","Object","keys","screens","length","describeHostStatus","suspendedAt","until","suspendedUntilMs","Date","now","label","color","detail","maintenance","preview","published","describeSiteAllowance","options","used","limit","planLabel","ready","undefined","cap","Number","isFinite","String","sites"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAUD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,SAASA,qBACdC,IAA8D;;IAE9D,OAAOC,OAAOC,IAAI,SAACF,wBAAAA,KAAMG,OAAO,mBAAI,CAAC,GAAGC,MAAM;AAChD;AAEA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASC,mBAAmBL,IAMlC;IACC,IAAIA,wBAAAA,KAAMM,WAAW,EAAE;QACrB,sEAAsE;QACtE,+DAA+D;QAC/D,MAAMC,QAAQP,KAAKQ,gBAAgB;QACnC,IAAI,CAACD,SAASA,QAAQE,KAAKC,GAAG,IAAI;YAChC,OAAO;gBACLC,OAAO;gBACPC,OAAO;gBACPC,QAAQ;YACV;QACF;IACF;IACA,IAAIb,wBAAAA,KAAMc,WAAW,EAAE;QACrB,OAAO;YACLH,OAAO;YACPC,OAAO;YACPC,QAAQ;QACV;IACF;IACA,2EAA2E;IAC3E,uEAAuE;IACvE,kBAAkB;IAClB,IAAIb,CAAAA,wBAAAA,KAAMe,OAAO,MAAK,MAAM;QAC1B,OAAO;YACLJ,OAAO;YACPC,OAAO;YACPC,QACE;QACJ;IACF;IACA,MAAMG,YAAYjB,qBAAqBC;IACvC,IAAIgB,YAAY,GAAG;QACjB,OAAO;YACLL,OAAO;YACPC,OAAO;YACPC,QAAQ,GAAGG,UAAU,eAAe,EAAEA,cAAc,IAAI,KAAK,IAAI,CAAC,CAAC;QACrE;IACF;IACA,OAAO;QACLL,OAAO;QACPC,OAAO;QACPC,QAAQ;IACV;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASI,sBAAsBC,OAKrC;IACC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGJ;IAC1C,IAAI,CAACI,SAAS,CAACD,WAAW,OAAOE;IACjC;;;;;;;;;GASC,GACD,MAAMC,MACJJ,UAAUG,aAAaH,UAAU,OAC7BG,YACA,CAACE,OAAOC,QAAQ,CAACN,UAAUA,QAAQ,IACjC,cACAO,OAAOP;IACf,MAAMQ,QACJJ,QAAQD,YACJ,GAAGJ,KAAK,KAAK,EAAEA,SAAS,IAAI,KAAK,KAAK,GACtC,GAAGA,KAAK,IAAI,EAAEK,IAAI,KAAK,EAAEA,QAAQ,MAAM,KAAK,KAAK;IACvD,OAAO,GAAGI,MAAM,GAAG,EAAEP,UAAU,KAAK,CAAC;AACvC"}
|
|
@@ -234,6 +234,14 @@ export declare const RETIRED_PLANS: readonly OrgPlan[];
|
|
|
234
234
|
* ladder; the SALE question ("what may be bought?") reads `SELF_SERVE_PLANS`.
|
|
235
235
|
*/
|
|
236
236
|
export declare const PLAN_LADDER: readonly OrgPlan[];
|
|
237
|
+
/**
|
|
238
|
+
* The plans a staff custom-billing deal may ride on (AGL-4158): Custom first,
|
|
239
|
+
* the default a negotiated deal lands on, then the paid self-serve plans from
|
|
240
|
+
* the top down (Pro, Starter) for a deal scoped to that plan's capability.
|
|
241
|
+
* Built from `SELF_SERVE_PLANS`, so a retired plan is never offered and the
|
|
242
|
+
* staff "Base plan" picker and the provisioning route agree by construction.
|
|
243
|
+
*/
|
|
244
|
+
export declare const CUSTOM_BILLING_BASE_PLANS: readonly OrgPlan[];
|
|
237
245
|
/** Whether a plan is one pricing v4 retired (`RETIRED_PLANS`). */
|
|
238
246
|
export declare function isRetiredPlan(plan: OrgPlan | string | undefined | null): boolean;
|
|
239
247
|
/**
|
|
@@ -2052,13 +2060,13 @@ export declare const SALE_PROCESSING_FIXED_CENTS = 30;
|
|
|
2052
2060
|
*/
|
|
2053
2061
|
export declare function planGrantingFeature(feature: keyof OrgFeatureFlags): OrgPlan | undefined;
|
|
2054
2062
|
/**
|
|
2055
|
-
* The plan name an upsell should name, ready to interpolate — "
|
|
2063
|
+
* The plan name an upsell should name, ready to interpolate — "Pro",
|
|
2056
2064
|
* or undefined when {@link planGrantingFeature} has no answer.
|
|
2057
2065
|
*/
|
|
2058
2066
|
export declare function planLabelGrantingFeature(feature: keyof OrgFeatureFlags): string | undefined;
|
|
2059
2067
|
/**
|
|
2060
2068
|
* The one sentence a locked control carries, on hover and for a screen
|
|
2061
|
-
* reader: "Scheduled publishing is included from
|
|
2069
|
+
* reader: "Scheduled publishing is included from Pro."
|
|
2062
2070
|
*/
|
|
2063
2071
|
export declare function planLockReason(subject: string, planLabel: string | undefined): string;
|
|
2064
2072
|
/**
|
|
@@ -179,8 +179,9 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
179
179
|
// A `Form` node placed on a page still needs no definition to collect,
|
|
180
180
|
// and the 20 submissions above are the band those replies spend.
|
|
181
181
|
//
|
|
182
|
-
// The ladder: Free 1, Starter 5, Pro
|
|
183
|
-
// `FORMS_PER_HOST_CEILING` on Scale
|
|
182
|
+
// The ladder: Free 1, Starter 5, Pro and Custom UNLIMITED; the retired
|
|
183
|
+
// rows keep theirs (Business 100, `FORMS_PER_HOST_CEILING` on Scale,
|
|
184
|
+
// Advanced and Agency).
|
|
184
185
|
formsPerHost: 1,
|
|
185
186
|
// One reusable component per Free site (AGL-3615), counted the way the
|
|
186
187
|
// one saved form is: the create is refused on this number, with the
|
|
@@ -867,8 +868,8 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
867
868
|
// ceiling still flags and pages staff at 3× the band, and does NOT degrade
|
|
868
869
|
// the render on this plan — see `bandwidthCeilingDegradesRender`.
|
|
869
870
|
//
|
|
870
|
-
// `formsPerHost` is
|
|
871
|
-
//
|
|
871
|
+
// `formsPerHost` is UNLIMITED, as on Pro (AGL-4158): Custom is never below
|
|
872
|
+
// Pro, and a contract that wants a bound sets the per-org override.
|
|
872
873
|
enterprise: {
|
|
873
874
|
hostLimit: 200,
|
|
874
875
|
screensPerHost: UNLIMITED,
|
|
@@ -880,7 +881,7 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
880
881
|
maxManagersPerOrg: 1000,
|
|
881
882
|
maxMembersPerHost: 2000,
|
|
882
883
|
bandwidthGb: 790,
|
|
883
|
-
formsPerHost:
|
|
884
|
+
formsPerHost: UNLIMITED,
|
|
884
885
|
componentsPerHost: UNLIMITED,
|
|
885
886
|
variablesPerHost: UNLIMITED,
|
|
886
887
|
functionsPerHost: UNLIMITED,
|
|
@@ -1009,6 +1010,16 @@ fillPluginPlanEntitlements(PLAN_ENTITLEMENTS);
|
|
|
1009
1010
|
...RETIRED_PLANS,
|
|
1010
1011
|
'enterprise'
|
|
1011
1012
|
];
|
|
1013
|
+
/**
|
|
1014
|
+
* The plans a staff custom-billing deal may ride on (AGL-4158): Custom first,
|
|
1015
|
+
* the default a negotiated deal lands on, then the paid self-serve plans from
|
|
1016
|
+
* the top down (Pro, Starter) for a deal scoped to that plan's capability.
|
|
1017
|
+
* Built from `SELF_SERVE_PLANS`, so a retired plan is never offered and the
|
|
1018
|
+
* staff "Base plan" picker and the provisioning route agree by construction.
|
|
1019
|
+
*/ export const CUSTOM_BILLING_BASE_PLANS = [
|
|
1020
|
+
'enterprise',
|
|
1021
|
+
...SELF_SERVE_PLANS.filter((plan)=>plan !== 'free').reverse()
|
|
1022
|
+
];
|
|
1012
1023
|
/** Whether a plan is one pricing v4 retired (`RETIRED_PLANS`). */ export function isRetiredPlan(plan) {
|
|
1013
1024
|
return RETIRED_PLANS.includes(plan);
|
|
1014
1025
|
}
|
|
@@ -3380,7 +3391,7 @@ export function saleProcessingCostCents(chargeCents) {
|
|
|
3380
3391
|
].find((plan)=>Boolean(PLAN_ENTITLEMENTS[plan].features[feature]));
|
|
3381
3392
|
}
|
|
3382
3393
|
/**
|
|
3383
|
-
* The plan name an upsell should name, ready to interpolate — "
|
|
3394
|
+
* The plan name an upsell should name, ready to interpolate — "Pro",
|
|
3384
3395
|
* or undefined when {@link planGrantingFeature} has no answer.
|
|
3385
3396
|
*/ export function planLabelGrantingFeature(feature) {
|
|
3386
3397
|
const plan = planGrantingFeature(feature);
|
|
@@ -3388,7 +3399,7 @@ export function saleProcessingCostCents(chargeCents) {
|
|
|
3388
3399
|
}
|
|
3389
3400
|
/**
|
|
3390
3401
|
* The one sentence a locked control carries, on hover and for a screen
|
|
3391
|
-
* reader: "Scheduled publishing is included from
|
|
3402
|
+
* reader: "Scheduled publishing is included from Pro."
|
|
3392
3403
|
*/ export function planLockReason(subject, planLabel) {
|
|
3393
3404
|
return planLabel ? `${subject} is included from ${planLabel}.` : `${subject} is a paid add-on.`;
|
|
3394
3405
|
}
|