@mydoormot/app-types 2.1.1 → 2.1.2

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mydoormot/app-types@2.1.0 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
2
+ > @mydoormot/app-types@2.1.1 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@ CLI tsup v7.3.0
8
8
  CLI Target: es2021
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.js 14.90 KB
12
- ESM ⚡️ Build success in 59ms
13
- CJS dist/index.cjs 17.95 KB
14
- CJS ⚡️ Build success in 59ms
11
+ ESM dist/index.js 14.94 KB
12
+ ESM ⚡️ Build success in 161ms
13
+ CJS dist/index.cjs 17.98 KB
14
+ CJS ⚡️ Build success in 171ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 738ms
17
- DTS dist/index.d.ts 55.42 KB
18
- DTS dist/index.d.cts 55.42 KB
16
+ DTS ⚡️ Build success in 737ms
17
+ DTS dist/index.d.ts 56.99 KB
18
+ DTS dist/index.d.cts 56.99 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 2.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Aded moduleStates
8
+
3
9
  ## 2.1.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -305,6 +305,7 @@ var BusinessType = /* @__PURE__ */ ((BusinessType2) => {
305
305
  return BusinessType2;
306
306
  })(BusinessType || {});
307
307
  var BusinessPlan = /* @__PURE__ */ ((BusinessPlan2) => {
308
+ BusinessPlan2["NONE"] = "none";
308
309
  BusinessPlan2["MVP"] = "mvp";
309
310
  BusinessPlan2["FULL"] = "full";
310
311
  BusinessPlan2["INTERNAL"] = "internal";
package/dist/index.d.cts CHANGED
@@ -358,10 +358,36 @@ declare enum BusinessType {
358
358
  * reaches customers by someone forgetting to hide it.
359
359
  */
360
360
  declare enum BusinessPlan {
361
+ /**
362
+ * No tier at all — every module falls to its default of off.
363
+ *
364
+ * For a business that has bought nothing, or whose access is being pulled
365
+ * without deleting anything. Per-business overrides in `settings.modules`
366
+ * still apply on top: an override is a deliberate grant, and a plan change
367
+ * must not silently revoke one. For a hard cut-off use `BusinessStatus`.
368
+ */
369
+ NONE = "none",
361
370
  MVP = "mvp",
362
371
  FULL = "full",
363
372
  INTERNAL = "internal"
364
373
  }
374
+ /**
375
+ * What a module looks like to one business.
376
+ *
377
+ * The distinction `modules` alone cannot make. A boolean says only on or off,
378
+ * so a dashboard reading it hides everything that is off — including things
379
+ * the business could have, which is how a feature disappears instead of
380
+ * inviting an upgrade.
381
+ *
382
+ * - `available` — they have it.
383
+ * - `locked` — real for this kind of business, their tier does not include
384
+ * it. Show the screen, show the pitch. This is the upsell.
385
+ * - `hidden` — no tier for their type ever grants it. A restaurant is not
386
+ * a lapsed courier; offering to sell them client-invoicing is
387
+ * noise.
388
+ */
389
+ type ModuleState = 'available' | 'locked' | 'hidden';
390
+ type BusinessModuleStates = Record<keyof BusinessModules, ModuleState>;
365
391
  declare enum BusinessStatus {
366
392
  ACTIVE = "active",
367
393
  DISABLED = "disabled"
@@ -423,6 +449,13 @@ interface Business {
423
449
  modules: Required<{
424
450
  [K in keyof BusinessModules]: boolean;
425
451
  }>;
452
+ /**
453
+ * Per module: available, locked, or hidden. Render from this, not from
454
+ * `modules` — a boolean cannot tell "you don't have this yet" apart from
455
+ * "this isn't for you", and hiding the first kind is how a customer never
456
+ * learns the feature exists.
457
+ */
458
+ moduleStates: BusinessModuleStates;
426
459
  }
427
460
  interface BusinessPg extends Business {
428
461
  pgId: any;
@@ -1836,4 +1869,4 @@ declare enum LinkDestination {
1836
1869
  }
1837
1870
  type NullOrUndefined = null | undefined;
1838
1871
 
1839
- export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModuleKey, type BusinessModules, type BusinessPg, BusinessPlan, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, BusinessType, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandFulfilment, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionRiderUser, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
1872
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModuleKey, type BusinessModuleStates, type BusinessModules, type BusinessPg, BusinessPlan, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, BusinessType, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandFulfilment, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type ModuleState, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionRiderUser, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
package/dist/index.d.ts CHANGED
@@ -358,10 +358,36 @@ declare enum BusinessType {
358
358
  * reaches customers by someone forgetting to hide it.
359
359
  */
360
360
  declare enum BusinessPlan {
361
+ /**
362
+ * No tier at all — every module falls to its default of off.
363
+ *
364
+ * For a business that has bought nothing, or whose access is being pulled
365
+ * without deleting anything. Per-business overrides in `settings.modules`
366
+ * still apply on top: an override is a deliberate grant, and a plan change
367
+ * must not silently revoke one. For a hard cut-off use `BusinessStatus`.
368
+ */
369
+ NONE = "none",
361
370
  MVP = "mvp",
362
371
  FULL = "full",
363
372
  INTERNAL = "internal"
364
373
  }
374
+ /**
375
+ * What a module looks like to one business.
376
+ *
377
+ * The distinction `modules` alone cannot make. A boolean says only on or off,
378
+ * so a dashboard reading it hides everything that is off — including things
379
+ * the business could have, which is how a feature disappears instead of
380
+ * inviting an upgrade.
381
+ *
382
+ * - `available` — they have it.
383
+ * - `locked` — real for this kind of business, their tier does not include
384
+ * it. Show the screen, show the pitch. This is the upsell.
385
+ * - `hidden` — no tier for their type ever grants it. A restaurant is not
386
+ * a lapsed courier; offering to sell them client-invoicing is
387
+ * noise.
388
+ */
389
+ type ModuleState = 'available' | 'locked' | 'hidden';
390
+ type BusinessModuleStates = Record<keyof BusinessModules, ModuleState>;
365
391
  declare enum BusinessStatus {
366
392
  ACTIVE = "active",
367
393
  DISABLED = "disabled"
@@ -423,6 +449,13 @@ interface Business {
423
449
  modules: Required<{
424
450
  [K in keyof BusinessModules]: boolean;
425
451
  }>;
452
+ /**
453
+ * Per module: available, locked, or hidden. Render from this, not from
454
+ * `modules` — a boolean cannot tell "you don't have this yet" apart from
455
+ * "this isn't for you", and hiding the first kind is how a customer never
456
+ * learns the feature exists.
457
+ */
458
+ moduleStates: BusinessModuleStates;
426
459
  }
427
460
  interface BusinessPg extends Business {
428
461
  pgId: any;
@@ -1836,4 +1869,4 @@ declare enum LinkDestination {
1836
1869
  }
1837
1870
  type NullOrUndefined = null | undefined;
1838
1871
 
1839
- export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModuleKey, type BusinessModules, type BusinessPg, BusinessPlan, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, BusinessType, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandFulfilment, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionRiderUser, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
1872
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModuleKey, type BusinessModuleStates, type BusinessModules, type BusinessPg, BusinessPlan, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, BusinessType, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandFulfilment, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type ModuleState, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionRiderUser, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
package/dist/index.js CHANGED
@@ -233,6 +233,7 @@ var BusinessType = /* @__PURE__ */ ((BusinessType2) => {
233
233
  return BusinessType2;
234
234
  })(BusinessType || {});
235
235
  var BusinessPlan = /* @__PURE__ */ ((BusinessPlan2) => {
236
+ BusinessPlan2["NONE"] = "none";
236
237
  BusinessPlan2["MVP"] = "mvp";
237
238
  BusinessPlan2["FULL"] = "full";
238
239
  BusinessPlan2["INTERNAL"] = "internal";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/src/business.ts CHANGED
@@ -58,11 +58,42 @@ export enum BusinessType {
58
58
  * reaches customers by someone forgetting to hide it.
59
59
  */
60
60
  export enum BusinessPlan {
61
+ /**
62
+ * No tier at all — every module falls to its default of off.
63
+ *
64
+ * For a business that has bought nothing, or whose access is being pulled
65
+ * without deleting anything. Per-business overrides in `settings.modules`
66
+ * still apply on top: an override is a deliberate grant, and a plan change
67
+ * must not silently revoke one. For a hard cut-off use `BusinessStatus`.
68
+ */
69
+ NONE = 'none',
61
70
  MVP = 'mvp',
62
71
  FULL = 'full',
63
72
  INTERNAL = 'internal',
64
73
  }
65
74
 
75
+ /**
76
+ * What a module looks like to one business.
77
+ *
78
+ * The distinction `modules` alone cannot make. A boolean says only on or off,
79
+ * so a dashboard reading it hides everything that is off — including things
80
+ * the business could have, which is how a feature disappears instead of
81
+ * inviting an upgrade.
82
+ *
83
+ * - `available` — they have it.
84
+ * - `locked` — real for this kind of business, their tier does not include
85
+ * it. Show the screen, show the pitch. This is the upsell.
86
+ * - `hidden` — no tier for their type ever grants it. A restaurant is not
87
+ * a lapsed courier; offering to sell them client-invoicing is
88
+ * noise.
89
+ */
90
+ export type ModuleState = 'available' | 'locked' | 'hidden';
91
+
92
+ export type BusinessModuleStates = Record<
93
+ keyof BusinessModules,
94
+ ModuleState
95
+ >;
96
+
66
97
  export enum BusinessStatus {
67
98
  ACTIVE = 'active',
68
99
  DISABLED = 'disabled',
@@ -134,6 +165,14 @@ export interface Business {
134
165
  * which holds only the deliberate exceptions.
135
166
  */
136
167
  modules: Required<{ [K in keyof BusinessModules]: boolean }>;
168
+
169
+ /**
170
+ * Per module: available, locked, or hidden. Render from this, not from
171
+ * `modules` — a boolean cannot tell "you don't have this yet" apart from
172
+ * "this isn't for you", and hiding the first kind is how a customer never
173
+ * learns the feature exists.
174
+ */
175
+ moduleStates: BusinessModuleStates;
137
176
  }
138
177
 
139
178
  export interface BusinessPg extends Business {