@aglyn/aglyn 1.24.0 → 1.26.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/activity-labels.js +4 -1
- package/src/lib/app-utils/activity-labels.js.map +1 -1
- package/src/lib/app-utils/bandwidth-cap.d.ts +99 -1
- package/src/lib/app-utils/bandwidth-cap.js +148 -4
- package/src/lib/app-utils/bandwidth-cap.js.map +1 -1
- package/src/lib/app-utils/business-details.d.ts +5 -0
- package/src/lib/app-utils/business-details.js +4 -0
- package/src/lib/app-utils/business-details.js.map +1 -1
- package/src/lib/app-utils/crm.d.ts +17 -30
- package/src/lib/app-utils/crm.js +139 -3
- package/src/lib/app-utils/crm.js.map +1 -1
- package/src/lib/app-utils/docs-help-sections.generated.js +4 -1
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-help.generated.d.ts +1 -1
- package/src/lib/app-utils/docs-help.generated.js +7 -0
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +95 -11
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/host-tokens.d.ts +17 -0
- package/src/lib/app-utils/host-tokens.js +18 -0
- package/src/lib/app-utils/host-tokens.js.map +1 -1
- package/src/lib/app-utils/native-app-association.d.ts +5 -3
- package/src/lib/app-utils/native-app-association.js +5 -3
- package/src/lib/app-utils/native-app-association.js.map +1 -1
- package/src/lib/app-utils/native-nav.js +1 -1
- package/src/lib/app-utils/native-nav.js.map +1 -1
- package/src/lib/app-utils/notifications.js +5 -0
- package/src/lib/app-utils/notifications.js.map +1 -1
- package/src/lib/app-utils/plan-entitlements.d.ts +227 -36
- package/src/lib/app-utils/plan-entitlements.js +339 -45
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/reusable-component-keys.d.ts +9 -0
- package/src/lib/app-utils/reusable-component-keys.js +9 -0
- package/src/lib/app-utils/reusable-component-keys.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +1 -0
- package/src/lib/app-utils/server.js +1 -0
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/app-utils/sign-in-hint-cookie.d.ts +58 -0
- package/src/lib/app-utils/sign-in-hint-cookie.js +71 -0
- package/src/lib/app-utils/sign-in-hint-cookie.js.map +1 -0
- package/src/lib/app-utils/sign-in-visibility.d.ts +75 -0
- package/src/lib/app-utils/sign-in-visibility.js +79 -0
- package/src/lib/app-utils/sign-in-visibility.js.map +1 -0
- package/src/lib/app-utils/site-live-url.d.ts +4 -1
- package/src/lib/app-utils/site-live-url.js +17 -3
- package/src/lib/app-utils/site-live-url.js.map +1 -1
- package/src/lib/app-utils/usage-level.d.ts +50 -0
- package/src/lib/app-utils/usage-level.js +94 -0
- package/src/lib/app-utils/usage-level.js.map +1 -0
- package/src/lib/foundation/definitions/org-billing.types.d.ts +45 -2
- package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
- package/src/lib/foundation/definitions/platform.types.d.ts +9 -0
- package/src/lib/foundation/definitions/platform.types.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/site-live-url.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TENANT_APEX } from './tenant-apex'\n\n/**\n * Where a site's pages are live, as the CONSOLE reaches them (AGL-3758):\n * the custom domain, else the platform subdomain, else — on a preview or\n * local console — the tenant preview origin with `?tenantHost=`. Moved out of\n * the console app so a plugin's console card (the Actions element picker)\n * opens the same page every \"View live\" link does.\n */\n\n// Preview consoles link to the tenant preview deployment, which carries\n// no tenant subdomain and resolves the host via the ?tenantHost= override.\nconst TENANT_PREVIEW_HOST =\n process.env.NEXT_PUBLIC_AGLYN_TENANT_PREVIEW_HOST ||\n 'aglyn-tenant-git-main-aglyn.vercel.app'\n\n/**\n * A console served from localhost links to the LOCAL tenant dev server\n * (AGL-1203), not the remote preview deployment.\n *\n * Sending a local console to `aglyn-tenant-git-main-*.vercel.app` meant every\n * Live link 404'd for anything that had not been deployed yet — which is the\n * normal state of the work you are doing on localhost. `nx serve tenant`\n * listens on 4500; override for a different port.\n */\nconst TENANT_LOCAL_ORIGIN =\n process.env.NEXT_PUBLIC_AGLYN_TENANT_LOCAL_ORIGIN || 'http://localhost:4500'\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/site-live-url.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TENANT_APEX } from './tenant-apex'\n\n/**\n * Where a site's pages are live, as the CONSOLE reaches them (AGL-3758):\n * the custom domain, else the platform subdomain, else — on a preview or\n * local console — the tenant preview origin with `?tenantHost=`. Moved out of\n * the console app so a plugin's console card (the Actions element picker)\n * opens the same page every \"View live\" link does.\n */\n\n// Preview consoles link to the tenant preview deployment, which carries\n// no tenant subdomain and resolves the host via the ?tenantHost= override.\nconst TENANT_PREVIEW_HOST =\n process.env.NEXT_PUBLIC_AGLYN_TENANT_PREVIEW_HOST ||\n 'aglyn-tenant-git-main-aglyn.vercel.app'\n\n/**\n * A console served from localhost links to the LOCAL tenant dev server\n * (AGL-1203), not the remote preview deployment.\n *\n * Sending a local console to `aglyn-tenant-git-main-*.vercel.app` meant every\n * Live link 404'd for anything that had not been deployed yet — which is the\n * normal state of the work you are doing on localhost. `nx serve tenant`\n * listens on 4500; override for a different port.\n */\nconst TENANT_LOCAL_ORIGIN =\n process.env.NEXT_PUBLIC_AGLYN_TENANT_LOCAL_ORIGIN || 'http://localhost:4500'\n\n/**\n * Loopback addresses a console is reached at on a developer's machine, which\n * are never a deployment: the IPv4 and IPv6 loopbacks, and `10.0.2.2`, the\n * address the Android emulator gives the machine it runs on, which is how the\n * Android app on a local stack reaches the local console.\n */\nconst LOCAL_CONSOLE_ADDRESSES = new Set(['127.0.0.1', '::1', '[::1]', '10.0.2.2'])\n\n/**\n * True for `localhost`, `*.localhost` and the loopback addresses, which have\n * a local tenant to use.\n */\nexport function isLocalConsole(hostname: string): boolean {\n return (\n hostname === 'localhost' ||\n hostname.endsWith('.localhost') ||\n LOCAL_CONSOLE_ADDRESSES.has(hostname)\n )\n}\n\nexport function isPreviewConsole(hostname: string): boolean {\n return hostname.endsWith('.vercel.app') || isLocalConsole(hostname)\n}\n\n/** The live URL for a site-relative slug on this host's real origin. */\nexport function siteLiveUrlForSlug(\n host: { subdomain?: string | null; cname?: string | null } | undefined,\n slug: string,\n consoleHostname: string | undefined = typeof window !== 'undefined'\n ? window.location.hostname\n : undefined,\n): string | undefined {\n if (!host) return undefined\n // Published slugs are stored with a leading slash (\"/product/besigner\");\n // the origin already ends without one, so strip it rather than emitting the\n // \"//\" that every one of these URLs used to carry.\n const path = slug === '/' ? '' : String(slug).replace(/^\\/+/, '')\n\n if (consoleHostname && isPreviewConsole(consoleHostname)) {\n if (!host.subdomain) return undefined\n const tenantHost = encodeURIComponent(host.subdomain)\n // Local console → local tenant. Both resolve the site through the same\n // `?tenantHost=` override; only the origin differs.\n const origin = isLocalConsole(consoleHostname)\n ? TENANT_LOCAL_ORIGIN\n : `https://${TENANT_PREVIEW_HOST}`\n return `${origin}/${path}?tenantHost=${tenantHost}`\n }\n\n const domain =\n host.cname || (host.subdomain ? `${host.subdomain}.${TENANT_APEX}` : undefined)\n if (!domain) return undefined\n return `https://${domain}/${path}`\n}\n"],"names":["TENANT_APEX","TENANT_PREVIEW_HOST","process","env","NEXT_PUBLIC_AGLYN_TENANT_PREVIEW_HOST","TENANT_LOCAL_ORIGIN","NEXT_PUBLIC_AGLYN_TENANT_LOCAL_ORIGIN","LOCAL_CONSOLE_ADDRESSES","Set","isLocalConsole","hostname","endsWith","has","isPreviewConsole","siteLiveUrlForSlug","host","slug","consoleHostname","window","location","undefined","path","String","replace","subdomain","tenantHost","encodeURIComponent","origin","domain","cname"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,WAAW,QAAQ,mBAAe;AAE3C;;;;;;CAMC,GAED,wEAAwE;AACxE,2EAA2E;AAC3E,MAAMC,sBACJC,QAAQC,GAAG,CAACC,qCAAqC,IACjD;AAEF;;;;;;;;CAQC,GACD,MAAMC,sBACJH,QAAQC,GAAG,CAACG,qCAAqC,IAAI;AAEvD;;;;;CAKC,GACD,MAAMC,0BAA0B,IAAIC,IAAI;IAAC;IAAa;IAAO;IAAS;CAAW;AAEjF;;;CAGC,GACD,OAAO,SAASC,eAAeC,QAAgB;IAC7C,OACEA,aAAa,eACbA,SAASC,QAAQ,CAAC,iBAClBJ,wBAAwBK,GAAG,CAACF;AAEhC;AAEA,OAAO,SAASG,iBAAiBH,QAAgB;IAC/C,OAAOA,SAASC,QAAQ,CAAC,kBAAkBF,eAAeC;AAC5D;AAEA,sEAAsE,GACtE,OAAO,SAASI,mBACdC,IAAsE,EACtEC,IAAY,EACZC,kBAAsC,OAAOC,WAAW,cACpDA,OAAOC,QAAQ,CAACT,QAAQ,GACxBU,SAAS;IAEb,IAAI,CAACL,MAAM,OAAOK;IAClB,yEAAyE;IACzE,4EAA4E;IAC5E,mDAAmD;IACnD,MAAMC,OAAOL,SAAS,MAAM,KAAKM,OAAON,MAAMO,OAAO,CAAC,QAAQ;IAE9D,IAAIN,mBAAmBJ,iBAAiBI,kBAAkB;QACxD,IAAI,CAACF,KAAKS,SAAS,EAAE,OAAOJ;QAC5B,MAAMK,aAAaC,mBAAmBX,KAAKS,SAAS;QACpD,uEAAuE;QACvE,oDAAoD;QACpD,MAAMG,SAASlB,eAAeQ,mBAC1BZ,sBACA,CAAC,QAAQ,EAAEJ,qBAAqB;QACpC,OAAO,GAAG0B,OAAO,CAAC,EAAEN,KAAK,YAAY,EAAEI,YAAY;IACrD;IAEA,MAAMG,SACJb,KAAKc,KAAK,IAAKd,CAAAA,KAAKS,SAAS,GAAG,GAAGT,KAAKS,SAAS,CAAC,CAAC,EAAExB,aAAa,GAAGoB,SAAQ;IAC/E,IAAI,CAACQ,QAAQ,OAAOR;IACpB,OAAO,CAAC,QAAQ,EAAEQ,OAAO,CAAC,EAAEP,MAAM;AACpC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
*/
|
|
17
|
+
/** Where the level is stored, on all three. */
|
|
18
|
+
export declare const USAGE_LEVEL_FIELD = "usageLevel";
|
|
19
|
+
/** When staff last set it (a server timestamp). */
|
|
20
|
+
export declare const USAGE_LEVEL_AT_FIELD = "usageLevelAt";
|
|
21
|
+
/** Which member of staff last set it (their uid). */
|
|
22
|
+
export declare const USAGE_LEVEL_BY_FIELD = "usageLevelBy";
|
|
23
|
+
/** Every key only staff may write. */
|
|
24
|
+
export declare const USAGE_LEVEL_KEYS: readonly ["usageLevel", "usageLevelAt", "usageLevelBy"];
|
|
25
|
+
/** Least use first; `unreviewed` is where everything starts. */
|
|
26
|
+
export declare const USAGE_LEVELS: readonly ["unreviewed", "trying", "building", "live", "power"];
|
|
27
|
+
export type UsageLevel = (typeof USAGE_LEVELS)[number];
|
|
28
|
+
/** The level every new workspace and site is born with. */
|
|
29
|
+
export declare const DEFAULT_USAGE_LEVEL: UsageLevel;
|
|
30
|
+
/** The levels staff pick, which each mark the thing reviewed. */
|
|
31
|
+
export declare const REVIEWED_USAGE_LEVELS: ("live" | "trying" | "building" | "power")[];
|
|
32
|
+
/** What staff read: the chip, the select, the filter. */
|
|
33
|
+
export declare const USAGE_LEVEL_LABELS: Readonly<Record<UsageLevel, string>>;
|
|
34
|
+
/** One line on what each level means, shown under the select. */
|
|
35
|
+
export declare const USAGE_LEVEL_DESCRIPTIONS: Readonly<Record<UsageLevel, string>>;
|
|
36
|
+
/** The chip's MUI color, so the five read apart at a glance. */
|
|
37
|
+
export declare const USAGE_LEVEL_COLORS: Readonly<Record<UsageLevel, 'default' | 'info' | 'warning' | 'success' | 'secondary'>>;
|
|
38
|
+
/** The filter's answers, least use first. */
|
|
39
|
+
export declare const USAGE_LEVEL_FILTER_OPTIONS: ReadonlyArray<{
|
|
40
|
+
value: UsageLevel;
|
|
41
|
+
label: string;
|
|
42
|
+
}>;
|
|
43
|
+
export declare function isUsageLevel(value: unknown): value is UsageLevel;
|
|
44
|
+
/** A stored value as a level: anything missing or unknown is not reviewed. */
|
|
45
|
+
export declare function readUsageLevel(value: unknown): UsageLevel;
|
|
46
|
+
/** The three things staff set a level on. */
|
|
47
|
+
export declare const USAGE_LEVEL_TARGETS: readonly ["user", "org", "site"];
|
|
48
|
+
export type UsageLevelTarget = (typeof USAGE_LEVEL_TARGETS)[number];
|
|
49
|
+
/** The collection each target's level lives in. */
|
|
50
|
+
export declare const USAGE_LEVEL_COLLECTIONS: Readonly<Record<UsageLevelTarget, string>>;
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
*/ /*
|
|
17
|
+
* STAFF USAGE LEVEL (AGL-4228).
|
|
18
|
+
*
|
|
19
|
+
* How much an account, a workspace or a site actually uses the platform, as
|
|
20
|
+
* a member of staff judged it after looking. It is a category staff pick, not
|
|
21
|
+
* a measurement, and it is never "real" or "fake": everybody who signs up is
|
|
22
|
+
* a real person, they just use the platform to very different degrees.
|
|
23
|
+
*
|
|
24
|
+
* Stored on the thing itself — `users/{uid}`, `orgs/{orgId}`, `hosts/{hostId}`
|
|
25
|
+
* — as `usageLevel`, beside who set it and when. Only staff write it, through
|
|
26
|
+
* `/api/admin/usage-level`; the security rules deny every client write to the
|
|
27
|
+
* three keys.
|
|
28
|
+
*
|
|
29
|
+
* `unreviewed` is stored, never left out, on workspaces and sites: the staff
|
|
30
|
+
* lists filter by equality on it, and a query cannot find a document by a
|
|
31
|
+
* field it lacks. `createOrganization` and `provisionHost` write it at birth,
|
|
32
|
+
* and `tools/scripts/backfill-usage-level.mjs` stamped the ones made before.
|
|
33
|
+
* Accounts are listed from Firebase Auth rather than a query, so an account
|
|
34
|
+
* with no `users/{uid}.usageLevel` simply reads as not reviewed.
|
|
35
|
+
*/ /** Where the level is stored, on all three. */ export const USAGE_LEVEL_FIELD = 'usageLevel';
|
|
36
|
+
/** When staff last set it (a server timestamp). */ export const USAGE_LEVEL_AT_FIELD = 'usageLevelAt';
|
|
37
|
+
/** Which member of staff last set it (their uid). */ export const USAGE_LEVEL_BY_FIELD = 'usageLevelBy';
|
|
38
|
+
/** Every key only staff may write. */ export const USAGE_LEVEL_KEYS = [
|
|
39
|
+
USAGE_LEVEL_FIELD,
|
|
40
|
+
USAGE_LEVEL_AT_FIELD,
|
|
41
|
+
USAGE_LEVEL_BY_FIELD
|
|
42
|
+
];
|
|
43
|
+
/** Least use first; `unreviewed` is where everything starts. */ export const USAGE_LEVELS = [
|
|
44
|
+
'unreviewed',
|
|
45
|
+
'trying',
|
|
46
|
+
'building',
|
|
47
|
+
'live',
|
|
48
|
+
'power'
|
|
49
|
+
];
|
|
50
|
+
/** The level every new workspace and site is born with. */ export const DEFAULT_USAGE_LEVEL = 'unreviewed';
|
|
51
|
+
/** The levels staff pick, which each mark the thing reviewed. */ export const REVIEWED_USAGE_LEVELS = USAGE_LEVELS.filter((level)=>level !== 'unreviewed');
|
|
52
|
+
/** What staff read: the chip, the select, the filter. */ export const USAGE_LEVEL_LABELS = {
|
|
53
|
+
unreviewed: 'Not reviewed',
|
|
54
|
+
trying: 'Trying it out',
|
|
55
|
+
building: 'Building',
|
|
56
|
+
live: 'Live and using it',
|
|
57
|
+
power: 'Power user'
|
|
58
|
+
};
|
|
59
|
+
/** One line on what each level means, shown under the select. */ export const USAGE_LEVEL_DESCRIPTIONS = {
|
|
60
|
+
unreviewed: 'Nobody on staff has looked yet.',
|
|
61
|
+
trying: 'Signed up and looked around; little or nothing of their own built.',
|
|
62
|
+
building: 'Putting their own content in; not live or not used yet.',
|
|
63
|
+
live: 'Published their own site and using it for their business.',
|
|
64
|
+
power: 'Runs their business on the platform: several sites, daily use, or selling through it.'
|
|
65
|
+
};
|
|
66
|
+
/** The chip's MUI color, so the five read apart at a glance. */ export const USAGE_LEVEL_COLORS = {
|
|
67
|
+
unreviewed: 'default',
|
|
68
|
+
trying: 'info',
|
|
69
|
+
building: 'warning',
|
|
70
|
+
live: 'success',
|
|
71
|
+
power: 'secondary'
|
|
72
|
+
};
|
|
73
|
+
/** The filter's answers, least use first. */ export const USAGE_LEVEL_FILTER_OPTIONS = USAGE_LEVELS.map((value)=>({
|
|
74
|
+
value,
|
|
75
|
+
label: USAGE_LEVEL_LABELS[value]
|
|
76
|
+
}));
|
|
77
|
+
export function isUsageLevel(value) {
|
|
78
|
+
return typeof value === 'string' && USAGE_LEVELS.includes(value);
|
|
79
|
+
}
|
|
80
|
+
/** A stored value as a level: anything missing or unknown is not reviewed. */ export function readUsageLevel(value) {
|
|
81
|
+
return isUsageLevel(value) ? value : DEFAULT_USAGE_LEVEL;
|
|
82
|
+
}
|
|
83
|
+
/** The three things staff set a level on. */ export const USAGE_LEVEL_TARGETS = [
|
|
84
|
+
'user',
|
|
85
|
+
'org',
|
|
86
|
+
'site'
|
|
87
|
+
];
|
|
88
|
+
/** The collection each target's level lives in. */ export const USAGE_LEVEL_COLLECTIONS = {
|
|
89
|
+
user: 'users',
|
|
90
|
+
org: 'orgs',
|
|
91
|
+
site: 'hosts'
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=usage-level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/usage-level.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 * STAFF USAGE LEVEL (AGL-4228).\n *\n * How much an account, a workspace or a site actually uses the platform, as\n * a member of staff judged it after looking. It is a category staff pick, not\n * a measurement, and it is never \"real\" or \"fake\": everybody who signs up is\n * a real person, they just use the platform to very different degrees.\n *\n * Stored on the thing itself — `users/{uid}`, `orgs/{orgId}`, `hosts/{hostId}`\n * — as `usageLevel`, beside who set it and when. Only staff write it, through\n * `/api/admin/usage-level`; the security rules deny every client write to the\n * three keys.\n *\n * `unreviewed` is stored, never left out, on workspaces and sites: the staff\n * lists filter by equality on it, and a query cannot find a document by a\n * field it lacks. `createOrganization` and `provisionHost` write it at birth,\n * and `tools/scripts/backfill-usage-level.mjs` stamped the ones made before.\n * Accounts are listed from Firebase Auth rather than a query, so an account\n * with no `users/{uid}.usageLevel` simply reads as not reviewed.\n */\n\n/** Where the level is stored, on all three. */\nexport const USAGE_LEVEL_FIELD = 'usageLevel'\n/** When staff last set it (a server timestamp). */\nexport const USAGE_LEVEL_AT_FIELD = 'usageLevelAt'\n/** Which member of staff last set it (their uid). */\nexport const USAGE_LEVEL_BY_FIELD = 'usageLevelBy'\n\n/** Every key only staff may write. */\nexport const USAGE_LEVEL_KEYS = [\n USAGE_LEVEL_FIELD,\n USAGE_LEVEL_AT_FIELD,\n USAGE_LEVEL_BY_FIELD,\n] as const\n\n/** Least use first; `unreviewed` is where everything starts. */\nexport const USAGE_LEVELS = ['unreviewed', 'trying', 'building', 'live', 'power'] as const\n\nexport type UsageLevel = (typeof USAGE_LEVELS)[number]\n\n/** The level every new workspace and site is born with. */\nexport const DEFAULT_USAGE_LEVEL: UsageLevel = 'unreviewed'\n\n/** The levels staff pick, which each mark the thing reviewed. */\nexport const REVIEWED_USAGE_LEVELS = USAGE_LEVELS.filter(\n (level): level is Exclude<UsageLevel, 'unreviewed'> => level !== 'unreviewed',\n)\n\n/** What staff read: the chip, the select, the filter. */\nexport const USAGE_LEVEL_LABELS: Readonly<Record<UsageLevel, string>> = {\n unreviewed: 'Not reviewed',\n trying: 'Trying it out',\n building: 'Building',\n live: 'Live and using it',\n power: 'Power user',\n}\n\n/** One line on what each level means, shown under the select. */\nexport const USAGE_LEVEL_DESCRIPTIONS: Readonly<Record<UsageLevel, string>> = {\n unreviewed: 'Nobody on staff has looked yet.',\n trying: 'Signed up and looked around; little or nothing of their own built.',\n building: 'Putting their own content in; not live or not used yet.',\n live: 'Published their own site and using it for their business.',\n power: 'Runs their business on the platform: several sites, daily use, or selling through it.',\n}\n\n/** The chip's MUI color, so the five read apart at a glance. */\nexport const USAGE_LEVEL_COLORS: Readonly<\n Record<UsageLevel, 'default' | 'info' | 'warning' | 'success' | 'secondary'>\n> = {\n unreviewed: 'default',\n trying: 'info',\n building: 'warning',\n live: 'success',\n power: 'secondary',\n}\n\n/** The filter's answers, least use first. */\nexport const USAGE_LEVEL_FILTER_OPTIONS: ReadonlyArray<{ value: UsageLevel; label: string }> =\n USAGE_LEVELS.map((value) => ({ value, label: USAGE_LEVEL_LABELS[value] }))\n\nexport function isUsageLevel(value: unknown): value is UsageLevel {\n return typeof value === 'string' && (USAGE_LEVELS as readonly string[]).includes(value)\n}\n\n/** A stored value as a level: anything missing or unknown is not reviewed. */\nexport function readUsageLevel(value: unknown): UsageLevel {\n return isUsageLevel(value) ? value : DEFAULT_USAGE_LEVEL\n}\n\n/** The three things staff set a level on. */\nexport const USAGE_LEVEL_TARGETS = ['user', 'org', 'site'] as const\nexport type UsageLevelTarget = (typeof USAGE_LEVEL_TARGETS)[number]\n\n/** The collection each target's level lives in. */\nexport const USAGE_LEVEL_COLLECTIONS: Readonly<Record<UsageLevelTarget, string>> = {\n user: 'users',\n org: 'orgs',\n site: 'hosts',\n}\n"],"names":["USAGE_LEVEL_FIELD","USAGE_LEVEL_AT_FIELD","USAGE_LEVEL_BY_FIELD","USAGE_LEVEL_KEYS","USAGE_LEVELS","DEFAULT_USAGE_LEVEL","REVIEWED_USAGE_LEVELS","filter","level","USAGE_LEVEL_LABELS","unreviewed","trying","building","live","power","USAGE_LEVEL_DESCRIPTIONS","USAGE_LEVEL_COLORS","USAGE_LEVEL_FILTER_OPTIONS","map","value","label","isUsageLevel","includes","readUsageLevel","USAGE_LEVEL_TARGETS","USAGE_LEVEL_COLLECTIONS","user","org","site"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;CAmBC,GAED,6CAA6C,GAC7C,OAAO,MAAMA,oBAAoB,aAAY;AAC7C,iDAAiD,GACjD,OAAO,MAAMC,uBAAuB,eAAc;AAClD,mDAAmD,GACnD,OAAO,MAAMC,uBAAuB,eAAc;AAElD,oCAAoC,GACpC,OAAO,MAAMC,mBAAmB;IAC9BH;IACAC;IACAC;CACD,CAAS;AAEV,8DAA8D,GAC9D,OAAO,MAAME,eAAe;IAAC;IAAc;IAAU;IAAY;IAAQ;CAAQ,CAAS;AAI1F,yDAAyD,GACzD,OAAO,MAAMC,sBAAkC,aAAY;AAE3D,+DAA+D,GAC/D,OAAO,MAAMC,wBAAwBF,aAAaG,MAAM,CACtD,CAACC,QAAsDA,UAAU,cAClE;AAED,uDAAuD,GACvD,OAAO,MAAMC,qBAA2D;IACtEC,YAAY;IACZC,QAAQ;IACRC,UAAU;IACVC,MAAM;IACNC,OAAO;AACT,EAAC;AAED,+DAA+D,GAC/D,OAAO,MAAMC,2BAAiE;IAC5EL,YAAY;IACZC,QAAQ;IACRC,UAAU;IACVC,MAAM;IACNC,OAAO;AACT,EAAC;AAED,8DAA8D,GAC9D,OAAO,MAAME,qBAET;IACFN,YAAY;IACZC,QAAQ;IACRC,UAAU;IACVC,MAAM;IACNC,OAAO;AACT,EAAC;AAED,2CAA2C,GAC3C,OAAO,MAAMG,6BACXb,aAAac,GAAG,CAAC,CAACC,QAAW,CAAA;QAAEA;QAAOC,OAAOX,kBAAkB,CAACU,MAAM;IAAC,CAAA,GAAG;AAE5E,OAAO,SAASE,aAAaF,KAAc;IACzC,OAAO,OAAOA,UAAU,YAAY,AAACf,aAAmCkB,QAAQ,CAACH;AACnF;AAEA,4EAA4E,GAC5E,OAAO,SAASI,eAAeJ,KAAc;IAC3C,OAAOE,aAAaF,SAASA,QAAQd;AACvC;AAEA,2CAA2C,GAC3C,OAAO,MAAMmB,sBAAsB;IAAC;IAAQ;IAAO;CAAO,CAAS;AAGnE,iDAAiD,GACjD,OAAO,MAAMC,0BAAsE;IACjFC,MAAM;IACNC,KAAK;IACLC,MAAM;AACR,EAAC"}
|
|
@@ -515,6 +515,14 @@ export interface CoreOrgEntitlements {
|
|
|
515
515
|
* and activities are not counted — see `CRM_ACTIVITIES_PER_RECORD_CEILING`.
|
|
516
516
|
*/
|
|
517
517
|
contactsPerHost?: number;
|
|
518
|
+
/**
|
|
519
|
+
* The most CRM records (contacts + companies + deals) a workspace may hold,
|
|
520
|
+
* overage included (AGL-4227): Starter stops at Pro's included 10,000 and
|
|
521
|
+
* refuses the next NEW record with an upgrade message; records already
|
|
522
|
+
* held are never touched. `UNLIMITED` from Pro up. Never read below
|
|
523
|
+
* `contactsPerHost`.
|
|
524
|
+
*/
|
|
525
|
+
maxCrmRecords?: number;
|
|
518
526
|
/**
|
|
519
527
|
* CAMPAIGN emails sendable per calendar month (AGL-161), and campaign
|
|
520
528
|
* emails only (AGL-1438).
|
|
@@ -538,9 +546,23 @@ export interface CoreOrgEntitlements {
|
|
|
538
546
|
/** Action runs per calendar month (AGL-148). */
|
|
539
547
|
actionRunsPerMonth?: number;
|
|
540
548
|
/** Included customer REST API requests per calendar month (AGL-634);
|
|
541
|
-
* Beyond it, metered overage per 1,000 where the plan prices it.
|
|
542
|
-
*
|
|
549
|
+
* Beyond it, metered overage per 1,000 where the plan prices it. Free,
|
|
550
|
+
* which has no API, is 0. */
|
|
543
551
|
apiRequestsPerMonth?: number;
|
|
552
|
+
/**
|
|
553
|
+
* Requests per minute for the WHOLE workspace on the customer API, every
|
|
554
|
+
* key and connection together (AGL-4226) — beside the per-key 120, not
|
|
555
|
+
* instead of it. `UNLIMITED` (Custom, unless an agreement sets a figure)
|
|
556
|
+
* asks only the per-key limit.
|
|
557
|
+
*/
|
|
558
|
+
apiRequestsPerMinutePerOrg?: number;
|
|
559
|
+
/**
|
|
560
|
+
* The most API requests a workspace may make in a calendar month, overage
|
|
561
|
+
* included (AGL-4226): a hard stop, refused with `429` until the month
|
|
562
|
+
* turns. `UNLIMITED` from Pro up. Never read below `apiRequestsPerMonth`
|
|
563
|
+
* — an override that raises the band raises the ceiling with it.
|
|
564
|
+
*/
|
|
565
|
+
maxApiRequestsPerMonth?: number;
|
|
544
566
|
/** Dynamic data caps — org-scoped (AGL-239/240): datasets are shared
|
|
545
567
|
* by every host in the org, so counts and size meter per org. */
|
|
546
568
|
datasetsPerOrg?: number;
|
|
@@ -1011,6 +1033,19 @@ export interface OrgBandwidthCap {
|
|
|
1011
1033
|
pageViews?: number;
|
|
1012
1034
|
/** The band those page views were measured against. Diagnostic. */
|
|
1013
1035
|
includedPageViews?: number;
|
|
1036
|
+
/**
|
|
1037
|
+
* The ONE-TIME grace (AGL-4232): epoch ms until which the org's sites stay
|
|
1038
|
+
* online although the cap is engaged. Present only on the engagement that
|
|
1039
|
+
* granted it, which is the first ever for the org's sites
|
|
1040
|
+
* (`AglynHost.bandwidthGraceUsedAt`). Read through `bandwidthCapEngaged`.
|
|
1041
|
+
*/
|
|
1042
|
+
graceUntil?: number;
|
|
1043
|
+
/**
|
|
1044
|
+
* When the owner was told the grace above had ended and the sites are
|
|
1045
|
+
* paused (AGL-4232). Written once by the daily sweep, which is where a
|
|
1046
|
+
* grace's end is noticed, so the news goes out once.
|
|
1047
|
+
*/
|
|
1048
|
+
pauseNotifiedAt?: number;
|
|
1014
1049
|
}
|
|
1015
1050
|
/**
|
|
1016
1051
|
* The organization document.
|
|
@@ -1180,6 +1215,14 @@ export interface AglynOrgBilling extends AglynDocument {
|
|
|
1180
1215
|
* mid-month start serving again without waiting for a cron to clear it.
|
|
1181
1216
|
*/
|
|
1182
1217
|
bandwidthCap?: OrgBandwidthCap;
|
|
1218
|
+
/**
|
|
1219
|
+
* When this workspace's sites were first given the free plan's ONE-TIME
|
|
1220
|
+
* bandwidth grace (AGL-4232), epoch ms, written once by the cap's engage
|
|
1221
|
+
* writer and never cleared. Beside each site's own stamp so deleting the
|
|
1222
|
+
* site and making a new one does not give the workspace a second grace.
|
|
1223
|
+
* Admin-SDK only; denied in the rules.
|
|
1224
|
+
*/
|
|
1225
|
+
bandwidthGraceUsedAt?: number;
|
|
1183
1226
|
/**
|
|
1184
1227
|
* The org's assist hard-cap switch (AGL-2653) — see `OrgAssistOverage`.
|
|
1185
1228
|
* Admin-SDK-only, denied in the rules beside `storageOverage`; read
|