@mydoormot/app-types 2.1.3 → 2.1.4

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,18 +1,18 @@
1
-
2
- > @mydoormot/app-types@2.1.2 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
3
- > tsup src/index.ts --format esm,cjs --dts
4
-
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v7.3.0
8
- CLI Target: es2021
9
- ESM Build start
10
- CJS Build start
11
- ESM dist/index.js 14.81 KB
12
- ESM ⚡️ Build success in 69ms
13
- CJS dist/index.cjs 17.79 KB
14
- CJS ⚡️ Build success in 69ms
15
- DTS Build start
16
- DTS ⚡️ Build success in 723ms
17
- DTS dist/index.d.ts 55.91 KB
18
- DTS dist/index.d.cts 55.91 KB
1
+
2
+ > @mydoormot/app-types@2.1.4 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
3
+ > tsup src/index.ts --format esm,cjs --dts
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v7.3.0
8
+ CLI Target: es2021
9
+ ESM Build start
10
+ CJS Build start
11
+ ESM dist/index.js 15.04 KB
12
+ ESM ⚡️ Build success in 82ms
13
+ CJS dist/index.cjs 18.11 KB
14
+ CJS ⚡️ Build success in 83ms
15
+ DTS Build start
16
+ DTS ⚡️ Build success in 1467ms
17
+ DTS dist/index.d.ts 56.90 KB
18
+ DTS dist/index.d.cts 56.90 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 2.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated plan
8
+
3
9
  ## 2.1.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -49,6 +49,8 @@ __export(src_exports, {
49
49
  LinkDestination: () => LinkDestination,
50
50
  MembershipStatus: () => MembershipStatus,
51
51
  NotificationType: () => NotificationType,
52
+ PLAN_LIMIT_REACHED: () => PLAN_LIMIT_REACHED,
53
+ PLAN_REQUIRED: () => PLAN_REQUIRED,
52
54
  PaymentOptions: () => PaymentOptions,
53
55
  PayoutPeriodType: () => PayoutPeriodType,
54
56
  PayoutRateSource: () => PayoutRateSource,
@@ -305,10 +307,15 @@ var BusinessType = /* @__PURE__ */ ((BusinessType2) => {
305
307
  })(BusinessType || {});
306
308
  var BusinessPlan = /* @__PURE__ */ ((BusinessPlan2) => {
307
309
  BusinessPlan2["NONE"] = "none";
310
+ BusinessPlan2["STARTER"] = "starter";
311
+ BusinessPlan2["GROWTH"] = "growth";
312
+ BusinessPlan2["SCALE"] = "scale";
308
313
  BusinessPlan2["FULL"] = "full";
309
314
  BusinessPlan2["INTERNAL"] = "internal";
310
315
  return BusinessPlan2;
311
316
  })(BusinessPlan || {});
317
+ var PLAN_LIMIT_REACHED = "PLAN_LIMIT_REACHED";
318
+ var PLAN_REQUIRED = "PLAN_REQUIRED";
312
319
  var BusinessStatus = /* @__PURE__ */ ((BusinessStatus2) => {
313
320
  BusinessStatus2["ACTIVE"] = "active";
314
321
  BusinessStatus2["DISABLED"] = "disabled";
@@ -459,6 +466,8 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
459
466
  LinkDestination,
460
467
  MembershipStatus,
461
468
  NotificationType,
469
+ PLAN_LIMIT_REACHED,
470
+ PLAN_REQUIRED,
462
471
  PaymentOptions,
463
472
  PayoutPeriodType,
464
473
  PayoutRateSource,
package/dist/index.d.cts CHANGED
@@ -365,9 +365,25 @@ declare enum BusinessPlan {
365
365
  * without deleting anything. For a hard cut-off use `BusinessStatus`.
366
366
  */
367
367
  NONE = "none",
368
+ /** Paid tiers: same modules, different rider caps. */
369
+ STARTER = "starter",
370
+ GROWTH = "growth",
371
+ SCALE = "scale",
372
+ /** Pre-pricing businesses, grandfathered: no caps. */
368
373
  FULL = "full",
369
374
  INTERNAL = "internal"
370
375
  }
376
+ /**
377
+ * Plan caps. `null` is unlimited. `riders` counts every rider not archived,
378
+ * suspended ones included.
379
+ */
380
+ interface BusinessLimits {
381
+ riders: number | null;
382
+ }
383
+ /** 403 code: adding past a plan cap. */
384
+ declare const PLAN_LIMIT_REACHED = "PLAN_LIMIT_REACHED";
385
+ /** 403 code: creating anything with no active plan (trial over, unpaid). */
386
+ declare const PLAN_REQUIRED = "PLAN_REQUIRED";
371
387
  /**
372
388
  * What a module looks like to one business.
373
389
  *
@@ -397,6 +413,11 @@ interface Business {
397
413
  officeNumber: string;
398
414
  type: BusinessType | `${BusinessType}`;
399
415
  plan: BusinessPlan | `${BusinessPlan}`;
416
+ /** Trial plan, in force until `trialEndsAt`. Kept after it ends. */
417
+ trialPlan: BusinessPlan | `${BusinessPlan}` | NullOrUndefined;
418
+ trialEndsAt: string | Date | NullOrUndefined;
419
+ /** The plan in force (trial included). Show this, not `plan`. */
420
+ effectivePlan: BusinessPlan | `${BusinessPlan}`;
400
421
  categoryId: string;
401
422
  address: string | NullOrUndefined;
402
423
  addressCoordinates: number[] | NullOrUndefined | {
@@ -452,6 +473,8 @@ interface Business {
452
473
  * learns the feature exists.
453
474
  */
454
475
  moduleStates: BusinessModuleStates;
476
+ /** Caps from `effectivePlan`. */
477
+ limits: BusinessLimits;
455
478
  }
456
479
  interface BusinessPg extends Business {
457
480
  pgId: any;
@@ -1848,4 +1871,4 @@ declare enum LinkDestination {
1848
1871
  }
1849
1872
  type NullOrUndefined = null | undefined;
1850
1873
 
1851
- 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_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 };
1874
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessLimits, 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_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, PLAN_LIMIT_REACHED, PLAN_REQUIRED, 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
@@ -365,9 +365,25 @@ declare enum BusinessPlan {
365
365
  * without deleting anything. For a hard cut-off use `BusinessStatus`.
366
366
  */
367
367
  NONE = "none",
368
+ /** Paid tiers: same modules, different rider caps. */
369
+ STARTER = "starter",
370
+ GROWTH = "growth",
371
+ SCALE = "scale",
372
+ /** Pre-pricing businesses, grandfathered: no caps. */
368
373
  FULL = "full",
369
374
  INTERNAL = "internal"
370
375
  }
376
+ /**
377
+ * Plan caps. `null` is unlimited. `riders` counts every rider not archived,
378
+ * suspended ones included.
379
+ */
380
+ interface BusinessLimits {
381
+ riders: number | null;
382
+ }
383
+ /** 403 code: adding past a plan cap. */
384
+ declare const PLAN_LIMIT_REACHED = "PLAN_LIMIT_REACHED";
385
+ /** 403 code: creating anything with no active plan (trial over, unpaid). */
386
+ declare const PLAN_REQUIRED = "PLAN_REQUIRED";
371
387
  /**
372
388
  * What a module looks like to one business.
373
389
  *
@@ -397,6 +413,11 @@ interface Business {
397
413
  officeNumber: string;
398
414
  type: BusinessType | `${BusinessType}`;
399
415
  plan: BusinessPlan | `${BusinessPlan}`;
416
+ /** Trial plan, in force until `trialEndsAt`. Kept after it ends. */
417
+ trialPlan: BusinessPlan | `${BusinessPlan}` | NullOrUndefined;
418
+ trialEndsAt: string | Date | NullOrUndefined;
419
+ /** The plan in force (trial included). Show this, not `plan`. */
420
+ effectivePlan: BusinessPlan | `${BusinessPlan}`;
400
421
  categoryId: string;
401
422
  address: string | NullOrUndefined;
402
423
  addressCoordinates: number[] | NullOrUndefined | {
@@ -452,6 +473,8 @@ interface Business {
452
473
  * learns the feature exists.
453
474
  */
454
475
  moduleStates: BusinessModuleStates;
476
+ /** Caps from `effectivePlan`. */
477
+ limits: BusinessLimits;
455
478
  }
456
479
  interface BusinessPg extends Business {
457
480
  pgId: any;
@@ -1848,4 +1871,4 @@ declare enum LinkDestination {
1848
1871
  }
1849
1872
  type NullOrUndefined = null | undefined;
1850
1873
 
1851
- 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_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 };
1874
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessLimits, 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_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, PLAN_LIMIT_REACHED, PLAN_REQUIRED, 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
@@ -234,10 +234,15 @@ var BusinessType = /* @__PURE__ */ ((BusinessType2) => {
234
234
  })(BusinessType || {});
235
235
  var BusinessPlan = /* @__PURE__ */ ((BusinessPlan2) => {
236
236
  BusinessPlan2["NONE"] = "none";
237
+ BusinessPlan2["STARTER"] = "starter";
238
+ BusinessPlan2["GROWTH"] = "growth";
239
+ BusinessPlan2["SCALE"] = "scale";
237
240
  BusinessPlan2["FULL"] = "full";
238
241
  BusinessPlan2["INTERNAL"] = "internal";
239
242
  return BusinessPlan2;
240
243
  })(BusinessPlan || {});
244
+ var PLAN_LIMIT_REACHED = "PLAN_LIMIT_REACHED";
245
+ var PLAN_REQUIRED = "PLAN_REQUIRED";
241
246
  var BusinessStatus = /* @__PURE__ */ ((BusinessStatus2) => {
242
247
  BusinessStatus2["ACTIVE"] = "active";
243
248
  BusinessStatus2["DISABLED"] = "disabled";
@@ -387,6 +392,8 @@ export {
387
392
  LinkDestination,
388
393
  MembershipStatus,
389
394
  NotificationType,
395
+ PLAN_LIMIT_REACHED,
396
+ PLAN_REQUIRED,
390
397
  PaymentOptions,
391
398
  PayoutPeriodType,
392
399
  PayoutRateSource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/src/business.ts CHANGED
@@ -22,7 +22,6 @@ export enum BusinessCapability {
22
22
  SELF_FULFILLMENT = 'self_fulfillment',
23
23
  }
24
24
 
25
-
26
25
  /**
27
26
  * Who carried an errand: the originating business's own rider, or the wider
28
27
  * network. The field rider-cost reporting splits on — own-rider cost against
@@ -65,10 +64,29 @@ export enum BusinessPlan {
65
64
  * without deleting anything. For a hard cut-off use `BusinessStatus`.
66
65
  */
67
66
  NONE = 'none',
67
+ /** Paid tiers: same modules, different rider caps. */
68
+ STARTER = 'starter',
69
+ GROWTH = 'growth',
70
+ SCALE = 'scale',
71
+ /** Pre-pricing businesses, grandfathered: no caps. */
68
72
  FULL = 'full',
69
73
  INTERNAL = 'internal',
70
74
  }
71
75
 
76
+ /**
77
+ * Plan caps. `null` is unlimited. `riders` counts every rider not archived,
78
+ * suspended ones included.
79
+ */
80
+ export interface BusinessLimits {
81
+ riders: number | null;
82
+ }
83
+
84
+ /** 403 code: adding past a plan cap. */
85
+ export const PLAN_LIMIT_REACHED = 'PLAN_LIMIT_REACHED';
86
+
87
+ /** 403 code: creating anything with no active plan (trial over, unpaid). */
88
+ export const PLAN_REQUIRED = 'PLAN_REQUIRED';
89
+
72
90
  /**
73
91
  * What a module looks like to one business.
74
92
  *
@@ -86,10 +104,7 @@ export enum BusinessPlan {
86
104
  */
87
105
  export type ModuleState = 'available' | 'locked' | 'hidden';
88
106
 
89
- export type BusinessModuleStates = Record<
90
- keyof BusinessModules,
91
- ModuleState
92
- >;
107
+ export type BusinessModuleStates = Record<keyof BusinessModules, ModuleState>;
93
108
 
94
109
  export enum BusinessStatus {
95
110
  ACTIVE = 'active',
@@ -104,6 +119,11 @@ export interface Business {
104
119
  officeNumber: string;
105
120
  type: BusinessType | `${BusinessType}`;
106
121
  plan: BusinessPlan | `${BusinessPlan}`;
122
+ /** Trial plan, in force until `trialEndsAt`. Kept after it ends. */
123
+ trialPlan: BusinessPlan | `${BusinessPlan}` | NullOrUndefined;
124
+ trialEndsAt: string | Date | NullOrUndefined;
125
+ /** The plan in force (trial included). Show this, not `plan`. */
126
+ effectivePlan: BusinessPlan | `${BusinessPlan}`;
107
127
  categoryId: string;
108
128
  address: string | NullOrUndefined;
109
129
  addressCoordinates:
@@ -169,6 +189,9 @@ export interface Business {
169
189
  * learns the feature exists.
170
190
  */
171
191
  moduleStates: BusinessModuleStates;
192
+
193
+ /** Caps from `effectivePlan`. */
194
+ limits: BusinessLimits;
172
195
  }
173
196
 
174
197
  export interface BusinessPg extends Business {