@aglyn/tenant-feature-instance 1.9.1 → 1.11.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/tenant-feature-instance",
3
- "version": "1.9.1",
3
+ "version": "1.11.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,12 +25,12 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.9.1",
29
- "@aglyn/shared-data-enums": "1.9.1",
30
- "@aglyn/shared-ui-jsx": "1.9.1",
31
- "@aglyn/shared-util-email": "1.9.1",
32
- "@aglyn/shared-util-http": "1.9.1",
33
- "@aglyn/shared-util-timestamp": "1.9.1",
28
+ "@aglyn/aglyn": "1.11.0",
29
+ "@aglyn/shared-data-enums": "1.11.0",
30
+ "@aglyn/shared-ui-jsx": "1.11.0",
31
+ "@aglyn/shared-util-email": "1.11.0",
32
+ "@aglyn/shared-util-http": "1.11.0",
33
+ "@aglyn/shared-util-timestamp": "1.11.0",
34
34
  "@swc/helpers": "0.5.23",
35
35
  "lodash-es": "^4.18.1",
36
36
  "mobx": "^7.0.5"
@@ -31,7 +31,7 @@ export interface PlanFeatureLock {
31
31
  * workspace would see its own feature refused while its doc loads.
32
32
  */
33
33
  locked: boolean;
34
- /** The cheapest plan carrying the feature ("Business"), if any plan does. */
34
+ /** The cheapest plan carrying the feature ("Pro"), if any plan does. */
35
35
  planLabel: string | undefined;
36
36
  /**
37
37
  * The console's plan grid (`/{org}/billing#plans`), or its add-ons section
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/plan-feature-lock.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 */\nimport {\n checkEntitlement,\n planLabelGrantingFeature,\n type OrgFeatureFlags,\n} from '@aglyn/aglyn'\n\n/**\n * A plan-gated feature as a console surface draws it: on, locked with the\n * plan that unlocks it, or not yet known.\n */\nexport interface PlanFeatureLock {\n /** The plan doc has settled. NEVER refuse before this is true. */\n ready: boolean\n /** The plan (or a purchased add-on, or an override) includes the feature. */\n entitled: boolean\n /**\n * `ready && !entitled`: the one state in which a control is drawn disabled\n * with an upgrade path. A pending plan draws nothing locked, because\n * `checkEntitlement(undefined)` answers with the FREE tier and a paying\n * workspace would see its own feature refused while its doc loads.\n */\n locked: boolean\n /** The cheapest plan carrying the feature (\"Business\"), if any plan does. */\n planLabel: string | undefined\n /**\n * The console's plan grid (`/{org}/billing#plans`), or its add-ons section\n * for a feature no plan carries. Undefined until the org slug is known.\n */\n upgradeHref: string | undefined\n}\n\n/**\n * The lock state for one feature, from an org billing doc the caller already\n * holds: the console's `useCurrentOrg()`, or a plugin's `useOrgPlan`.\n *\n * Free sees what the paid plans add instead of a console with pieces missing,\n * so every surface that gates on a plan feature draws its control from this\n * one answer: disabled, with the plan that includes it and a link to buy it.\n *\n * `planLabel` is derived from `PLAN_ENTITLEMENTS` on every call, so a notice\n * can never name a tier that no longer carries the feature.\n */\nexport function resolvePlanFeatureLock(input: {\n org: unknown\n ready: boolean\n feature: keyof OrgFeatureFlags\n orgSlug: string | null | undefined\n}): PlanFeatureLock {\n const { org, ready, feature, orgSlug } = input\n const entitled = checkEntitlement(org as never, feature)\n const planLabel = planLabelGrantingFeature(feature)\n return {\n ready,\n entitled,\n locked: ready === true && !entitled,\n planLabel,\n upgradeHref: orgSlug\n ? `/${orgSlug}/billing#${planLabel ? 'plans' : 'addons'}`\n : undefined,\n }\n}\n\nexport { planLockReason } from '@aglyn/aglyn/app-utils/plan-entitlements'\n"],"names":["checkEntitlement","planLabelGrantingFeature","resolvePlanFeatureLock","input","org","ready","feature","orgSlug","entitled","planLabel","locked","upgradeHref","undefined","planLockReason"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,SACEA,gBAAgB,EAChBC,wBAAwB,QAEnB,eAAc;AA2BrB;;;;;;;;;;CAUC,GACD,OAAO,SAASC,uBAAuBC,KAKtC;IACC,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGJ;IACzC,MAAMK,WAAWR,iBAAiBI,KAAcE;IAChD,MAAMG,YAAYR,yBAAyBK;IAC3C,OAAO;QACLD;QACAG;QACAE,QAAQL,UAAU,QAAQ,CAACG;QAC3BC;QACAE,aAAaJ,UACT,CAAC,CAAC,EAAEA,QAAQ,SAAS,EAAEE,YAAY,UAAU,UAAU,GACvDG;IACN;AACF;AAEA,SAASC,cAAc,QAAQ,2CAA0C"}
1
+ {"version":3,"sources":["../../../../../../../../libs/tenant/feature/instance/src/lib/hooks/plan-feature-lock.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 */\nimport {\n checkEntitlement,\n planLabelGrantingFeature,\n type OrgFeatureFlags,\n} from '@aglyn/aglyn'\n\n/**\n * A plan-gated feature as a console surface draws it: on, locked with the\n * plan that unlocks it, or not yet known.\n */\nexport interface PlanFeatureLock {\n /** The plan doc has settled. NEVER refuse before this is true. */\n ready: boolean\n /** The plan (or a purchased add-on, or an override) includes the feature. */\n entitled: boolean\n /**\n * `ready && !entitled`: the one state in which a control is drawn disabled\n * with an upgrade path. A pending plan draws nothing locked, because\n * `checkEntitlement(undefined)` answers with the FREE tier and a paying\n * workspace would see its own feature refused while its doc loads.\n */\n locked: boolean\n /** The cheapest plan carrying the feature (\"Pro\"), if any plan does. */\n planLabel: string | undefined\n /**\n * The console's plan grid (`/{org}/billing#plans`), or its add-ons section\n * for a feature no plan carries. Undefined until the org slug is known.\n */\n upgradeHref: string | undefined\n}\n\n/**\n * The lock state for one feature, from an org billing doc the caller already\n * holds: the console's `useCurrentOrg()`, or a plugin's `useOrgPlan`.\n *\n * Free sees what the paid plans add instead of a console with pieces missing,\n * so every surface that gates on a plan feature draws its control from this\n * one answer: disabled, with the plan that includes it and a link to buy it.\n *\n * `planLabel` is derived from `PLAN_ENTITLEMENTS` on every call, so a notice\n * can never name a tier that no longer carries the feature.\n */\nexport function resolvePlanFeatureLock(input: {\n org: unknown\n ready: boolean\n feature: keyof OrgFeatureFlags\n orgSlug: string | null | undefined\n}): PlanFeatureLock {\n const { org, ready, feature, orgSlug } = input\n const entitled = checkEntitlement(org as never, feature)\n const planLabel = planLabelGrantingFeature(feature)\n return {\n ready,\n entitled,\n locked: ready === true && !entitled,\n planLabel,\n upgradeHref: orgSlug\n ? `/${orgSlug}/billing#${planLabel ? 'plans' : 'addons'}`\n : undefined,\n }\n}\n\nexport { planLockReason } from '@aglyn/aglyn/app-utils/plan-entitlements'\n"],"names":["checkEntitlement","planLabelGrantingFeature","resolvePlanFeatureLock","input","org","ready","feature","orgSlug","entitled","planLabel","locked","upgradeHref","undefined","planLockReason"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,SACEA,gBAAgB,EAChBC,wBAAwB,QAEnB,eAAc;AA2BrB;;;;;;;;;;CAUC,GACD,OAAO,SAASC,uBAAuBC,KAKtC;IACC,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGJ;IACzC,MAAMK,WAAWR,iBAAiBI,KAAcE;IAChD,MAAMG,YAAYR,yBAAyBK;IAC3C,OAAO;QACLD;QACAG;QACAE,QAAQL,UAAU,QAAQ,CAACG;QAC3BC;QACAE,aAAaJ,UACT,CAAC,CAAC,EAAEA,QAAQ,SAAS,EAAEE,YAAY,UAAU,UAAU,GACvDG;IACN;AACF;AAEA,SAASC,cAAc,QAAQ,2CAA0C"}