@abyss-project/main 20.1.0 → 21.1.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.
Files changed (127) hide show
  1. package/dist/api/billing-account.admin.api.d.ts +9 -0
  2. package/dist/api/billing-account.admin.api.js +21 -1
  3. package/dist/api/billing-account.admin.api.js.map +1 -1
  4. package/dist/api/organization-billing.api.d.ts +15 -2
  5. package/dist/api/organization-billing.api.js +38 -1
  6. package/dist/api/organization-billing.api.js.map +1 -1
  7. package/dist/api/user-billing.api.d.ts +15 -2
  8. package/dist/api/user-billing.api.js +45 -1
  9. package/dist/api/user-billing.api.js.map +1 -1
  10. package/dist/constants/billing-catalog.constants.d.ts +2 -0
  11. package/dist/constants/billing-catalog.constants.js +9 -1
  12. package/dist/constants/billing-catalog.constants.js.map +1 -1
  13. package/dist/constants/index.d.ts +1 -0
  14. package/dist/constants/index.js +1 -0
  15. package/dist/constants/index.js.map +1 -1
  16. package/dist/constants/public-plans.constants.js +8 -0
  17. package/dist/constants/public-plans.constants.js.map +1 -1
  18. package/dist/constants/tests/billing-catalog.constants.spec.js +22 -0
  19. package/dist/constants/tests/billing-catalog.constants.spec.js.map +1 -1
  20. package/dist/constants/unpaid-invoice.constants.d.ts +1 -0
  21. package/dist/constants/unpaid-invoice.constants.js +5 -0
  22. package/dist/constants/unpaid-invoice.constants.js.map +1 -0
  23. package/dist/index.d.ts +23 -0
  24. package/dist/index.js +23 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/translate/en.translate.d.ts +24 -0
  27. package/dist/translate/en.translate.js +24 -0
  28. package/dist/translate/en.translate.js.map +1 -1
  29. package/dist/translate/fr.translate.d.ts +24 -0
  30. package/dist/translate/fr.translate.js +24 -0
  31. package/dist/translate/fr.translate.js.map +1 -1
  32. package/dist/types/enum/abyss-application-event.enum.d.ts +1 -0
  33. package/dist/types/enum/abyss-application-event.enum.js +1 -0
  34. package/dist/types/enum/abyss-application-event.enum.js.map +1 -1
  35. package/dist/types/enum/api-error.enum.d.ts +3 -0
  36. package/dist/types/enum/api-error.enum.js +3 -0
  37. package/dist/types/enum/api-error.enum.js.map +1 -1
  38. package/dist/types/enum/billing-interval.enum.d.ts +8 -0
  39. package/dist/types/enum/billing-interval.enum.js +14 -0
  40. package/dist/types/enum/billing-interval.enum.js.map +1 -0
  41. package/dist/types/enum/billing-subscription-event.enum.d.ts +27 -0
  42. package/dist/types/enum/billing-subscription-event.enum.js +34 -0
  43. package/dist/types/enum/billing-subscription-event.enum.js.map +1 -0
  44. package/dist/types/enum/email-type.enum.d.ts +6 -0
  45. package/dist/types/enum/email-type.enum.js +6 -0
  46. package/dist/types/enum/email-type.enum.js.map +1 -1
  47. package/dist/types/enum/index.d.ts +4 -0
  48. package/dist/types/enum/index.js +4 -0
  49. package/dist/types/enum/index.js.map +1 -1
  50. package/dist/types/enum/loyalty-grant-mode.enum.d.ts +4 -0
  51. package/dist/types/enum/loyalty-grant-mode.enum.js +9 -0
  52. package/dist/types/enum/loyalty-grant-mode.enum.js.map +1 -0
  53. package/dist/types/enum/subscription-pause.enum.d.ts +6 -0
  54. package/dist/types/enum/subscription-pause.enum.js +11 -0
  55. package/dist/types/enum/subscription-pause.enum.js.map +1 -0
  56. package/dist/types/enum/user-notification-category.enum.js +6 -0
  57. package/dist/types/enum/user-notification-category.enum.js.map +1 -1
  58. package/dist/types/enum/user-notification-content-type.enum.d.ts +30 -0
  59. package/dist/types/enum/user-notification-content-type.enum.js +7 -1
  60. package/dist/types/enum/user-notification-content-type.enum.js.map +1 -1
  61. package/dist/types/interface/api/index.d.ts +8 -0
  62. package/dist/types/interface/api/index.js +8 -0
  63. package/dist/types/interface/api/index.js.map +1 -1
  64. package/dist/types/interface/api/requests/loyalty-rule.admin.request.d.ts +16 -0
  65. package/dist/types/interface/api/requests/loyalty-rule.admin.request.js +3 -0
  66. package/dist/types/interface/api/requests/loyalty-rule.admin.request.js.map +1 -0
  67. package/dist/types/interface/api/requests/organization-billing.request.d.ts +15 -1
  68. package/dist/types/interface/api/requests/retention-metrics.admin.request.d.ts +4 -0
  69. package/dist/types/interface/api/requests/retention-metrics.admin.request.js +3 -0
  70. package/dist/types/interface/api/requests/retention-metrics.admin.request.js.map +1 -0
  71. package/dist/types/interface/api/requests/subscription-retention.request.d.ts +34 -0
  72. package/dist/types/interface/api/requests/subscription-retention.request.js +3 -0
  73. package/dist/types/interface/api/requests/subscription-retention.request.js.map +1 -0
  74. package/dist/types/interface/api/requests/user-billing.request.d.ts +12 -1
  75. package/dist/types/interface/api/responses/billing-account.admin.response.d.ts +1 -0
  76. package/dist/types/interface/api/responses/billing-module.response.d.ts +1 -0
  77. package/dist/types/interface/api/responses/billing-plan.response.d.ts +1 -0
  78. package/dist/types/interface/api/responses/loyalty-bonus.response.d.ts +16 -0
  79. package/dist/types/interface/api/responses/loyalty-bonus.response.js +3 -0
  80. package/dist/types/interface/api/responses/loyalty-bonus.response.js.map +1 -0
  81. package/dist/types/interface/api/responses/loyalty-rule.admin.response.d.ts +12 -0
  82. package/dist/types/interface/api/responses/loyalty-rule.admin.response.js +3 -0
  83. package/dist/types/interface/api/responses/loyalty-rule.admin.response.js.map +1 -0
  84. package/dist/types/interface/api/responses/organization-billing.response.d.ts +3 -1
  85. package/dist/types/interface/api/responses/quota-offer.response.d.ts +3 -0
  86. package/dist/types/interface/api/responses/retention-metrics.admin.response.d.ts +29 -0
  87. package/dist/types/interface/api/responses/retention-metrics.admin.response.js +3 -0
  88. package/dist/types/interface/api/responses/retention-metrics.admin.response.js.map +1 -0
  89. package/dist/types/interface/api/responses/subscription-retention.response.d.ts +11 -0
  90. package/dist/types/interface/api/responses/subscription-retention.response.js +3 -0
  91. package/dist/types/interface/api/responses/subscription-retention.response.js.map +1 -0
  92. package/dist/types/interface/api/responses/unpaid-amount.response.d.ts +9 -0
  93. package/dist/types/interface/api/responses/unpaid-amount.response.js +3 -0
  94. package/dist/types/interface/api/responses/unpaid-amount.response.js.map +1 -0
  95. package/dist/types/interface/api/responses/user-billing.response.d.ts +14 -1
  96. package/dist/types/interface/index.d.ts +2 -0
  97. package/dist/types/interface/index.js +2 -0
  98. package/dist/types/interface/index.js.map +1 -1
  99. package/dist/types/interface/models/billing-account.model.d.ts +22 -1
  100. package/dist/types/interface/models/billing-subscription-event.model.d.ts +17 -0
  101. package/dist/types/interface/models/billing-subscription-event.model.js +3 -0
  102. package/dist/types/interface/models/billing-subscription-event.model.js.map +1 -0
  103. package/dist/types/interface/models/index.d.ts +2 -0
  104. package/dist/types/interface/models/index.js +2 -0
  105. package/dist/types/interface/models/index.js.map +1 -1
  106. package/dist/types/interface/models/loyalty-rule.model.d.ts +12 -0
  107. package/dist/types/interface/models/loyalty-rule.model.js +3 -0
  108. package/dist/types/interface/models/loyalty-rule.model.js.map +1 -0
  109. package/dist/types/interface/models/plan-template.model.d.ts +1 -0
  110. package/dist/utils/index.d.ts +1 -0
  111. package/dist/utils/index.js +1 -0
  112. package/dist/utils/index.js.map +1 -1
  113. package/dist/utils/pricing.utils.d.ts +11 -1
  114. package/dist/utils/pricing.utils.js +55 -8
  115. package/dist/utils/pricing.utils.js.map +1 -1
  116. package/dist/utils/subscription-retention.utils.d.ts +12 -0
  117. package/dist/utils/subscription-retention.utils.js +40 -0
  118. package/dist/utils/subscription-retention.utils.js.map +1 -0
  119. package/dist/utils/tests/annual-price.utils.spec.d.ts +1 -0
  120. package/dist/utils/tests/annual-price.utils.spec.js +50 -0
  121. package/dist/utils/tests/annual-price.utils.spec.js.map +1 -0
  122. package/dist/utils/tests/pricing-calculator.utils.spec.js +1 -0
  123. package/dist/utils/tests/pricing-calculator.utils.spec.js.map +1 -1
  124. package/dist/utils/tests/subscription-retention.utils.spec.d.ts +1 -0
  125. package/dist/utils/tests/subscription-retention.utils.spec.js +80 -0
  126. package/dist/utils/tests/subscription-retention.utils.spec.js.map +1 -0
  127. package/package.json +1 -1
@@ -10,6 +10,7 @@ export interface IPublicPlan {
10
10
  accountType: PlanAccountType;
11
11
  name: string;
12
12
  monthlyPriceEur: number;
13
+ yearlyPriceCents: number;
13
14
  quotas: IPlanServiceQuota[];
14
15
  overagePricing: IPlanOveragePricing[];
15
16
  }
@@ -0,0 +1,16 @@
1
+ import { BillingMetric } from '../../../enum';
2
+ import { IResponse } from '../type-message/response';
3
+ export interface ILoyaltyBonusEntry {
4
+ metric: BillingMetric;
5
+ bonus: number;
6
+ nextTierAt: string | null;
7
+ nextTierBonus: number | null;
8
+ }
9
+ export interface IGetLoyaltyBonusData {
10
+ bonuses: ILoyaltyBonusEntry[];
11
+ }
12
+ export type IGetLoyaltyBonusUserResponse = IResponse<IGetLoyaltyBonusData>;
13
+ export interface IGetLoyaltyBonusOrganizationParams {
14
+ organizationId: string;
15
+ }
16
+ export type IGetLoyaltyBonusOrganizationResponse = IResponse<IGetLoyaltyBonusData>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=loyalty-bonus.response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loyalty-bonus.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/loyalty-bonus.response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { ILoyaltyRule } from '../../models';
2
+ import { IResponse } from '../type-message/response';
3
+ export interface IListLoyaltyRulesAdminBillingData {
4
+ rules: ILoyaltyRule[];
5
+ }
6
+ export type IListLoyaltyRulesAdminBillingResponse = IResponse<IListLoyaltyRulesAdminBillingData>;
7
+ export interface ILoyaltyRuleAdminBillingData {
8
+ rule: ILoyaltyRule;
9
+ }
10
+ export type ICreateLoyaltyRuleAdminBillingResponse = IResponse<ILoyaltyRuleAdminBillingData>;
11
+ export type IUpdateLoyaltyRuleAdminBillingResponse = IResponse<ILoyaltyRuleAdminBillingData>;
12
+ export type IDeleteLoyaltyRuleAdminBillingResponse = IResponse<Record<string, never>>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=loyalty-rule.admin.response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loyalty-rule.admin.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/loyalty-rule.admin.response.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { IBillingAccount } from '../../models/billing-account.model';
2
- import { IPlanChangeOverMetric } from './user-billing.response';
2
+ import { IPlanChangeOverMetric, IPlanChangePricing, ISetBillingIntervalData } from './user-billing.response';
3
3
  import { IBillingQuotaCap } from '../../models/billing-quota-cap.model';
4
4
  import { ICreditTransaction } from '../../models/credit-transaction.model';
5
5
  import { IInvoice, IInvoiceCommercialGestureRequest } from '../../models/invoice.model';
@@ -41,8 +41,10 @@ export interface IPreviewOrganizationPlanChangeData {
41
41
  hasCard: boolean;
42
42
  effectiveDate: string;
43
43
  overMetrics: IPlanChangeOverMetric[];
44
+ pricing: IPlanChangePricing;
44
45
  }
45
46
  export type IPreviewOrganizationPlanChangeResponse = IResponse<IPreviewOrganizationPlanChangeData>;
47
+ export type ISetBillingIntervalOrganizationResponse = IResponse<ISetBillingIntervalData>;
46
48
  export type ICustomerCommercialGesture = Omit<ICommercialGesture, 'reason' | 'internalComment' | 'grantedByAdminId' | 'idempotencyKey' | 'failureReason' | 'failureCode' | 'requestedPercent'>;
47
49
  export interface ICustomerInvoice extends Omit<IInvoice, 'lines' | 'commercialGestures' | 'creditNotes' | 'commercialGestureRequest'> {
48
50
  lines: IInvoiceLine[];
@@ -4,6 +4,7 @@ import { IResponse } from '../type-message/response';
4
4
  export interface IQuotaOfferBranch {
5
5
  kind: 'extension' | 'overage';
6
6
  priceCents: number | null;
7
+ priceNanocentsPerUnit?: number | null;
7
8
  lot?: number;
8
9
  moduleId?: BillingModuleId;
9
10
  }
@@ -18,6 +19,8 @@ export interface IQuotaOffer {
18
19
  isSetting: boolean;
19
20
  moduleSuspendedByPlan: boolean;
20
21
  lotSize: number | null;
22
+ overageAvailable: boolean;
23
+ overageExcludedByPlan: boolean;
21
24
  branches: IQuotaOfferBranch[];
22
25
  asOf: 'live' | 'snapshot';
23
26
  }
@@ -0,0 +1,29 @@
1
+ import { BillingInterval, CancellationReason, RetentionOffer } from '../../../enum';
2
+ import { IResponse } from '../type-message/response';
3
+ export type RetentionCohortMonth = 'm1' | 'm2' | 'm3' | 'm6' | 'm12';
4
+ export interface IRetentionCohort {
5
+ month: string;
6
+ size: number;
7
+ retained: Record<RetentionCohortMonth, number | null>;
8
+ }
9
+ export interface IRetentionOfferAcceptance {
10
+ shown: number;
11
+ accepted: number;
12
+ }
13
+ export interface IRetentionMetrics {
14
+ cohorts: IRetentionCohort[];
15
+ mrrCents: number;
16
+ payingAccounts: number;
17
+ intervalSplit: Record<BillingInterval, number>;
18
+ churnVoluntary: number;
19
+ churnInvoluntary: number;
20
+ cancellationReasons: Record<CancellationReason | 'NONE', number>;
21
+ offerAcceptance: Record<RetentionOffer, IRetentionOfferAcceptance>;
22
+ pauses: {
23
+ active: number;
24
+ resumed: number;
25
+ failed: number;
26
+ };
27
+ }
28
+ export type IGetRetentionMetricsAdminBillingData = IRetentionMetrics;
29
+ export type IGetRetentionMetricsAdminBillingResponse = IResponse<IGetRetentionMetricsAdminBillingData>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=retention-metrics.admin.response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retention-metrics.admin.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/retention-metrics.admin.response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { RetentionOffer } from '../../../enum';
2
+ import { IBillingAccount } from '../../models/billing-account.model';
3
+ import { IResponse } from '../type-message/response';
4
+ export interface ISubscriptionRetentionData {
5
+ billingAccount: IBillingAccount;
6
+ }
7
+ export type ISubscriptionRetentionResponse = IResponse<ISubscriptionRetentionData>;
8
+ export interface IListRetentionOffersData {
9
+ offers: RetentionOffer[];
10
+ }
11
+ export type IListRetentionOffersResponse = IResponse<IListRetentionOffersData>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subscription-retention.response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-retention.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/subscription-retention.response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { IResponse } from '../type-message/response';
2
+ export interface IGetUnpaidAmountData {
3
+ amountDueCents: number;
4
+ }
5
+ export type IGetUnpaidAmountUserResponse = IResponse<IGetUnpaidAmountData>;
6
+ export interface IGetUnpaidAmountOrganizationParams {
7
+ organizationId: string;
8
+ }
9
+ export type IGetUnpaidAmountOrganizationResponse = IResponse<IGetUnpaidAmountData>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unpaid-amount.response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpaid-amount.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/unpaid-amount.response.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { BillingMetric, BillingService } from '../../../enum';
1
+ import { BillingInterval, BillingMetric, BillingService, PlanChangeTiming } from '../../../enum';
2
2
  import { IBillingAccount } from '../../models/billing-account.model';
3
3
  import { IBillingQuotaCap } from '../../models/billing-quota-cap.model';
4
4
  import { IStorageBreakdown } from '../../models/storage-subtotal.model';
@@ -42,12 +42,25 @@ export interface IPlanChangeOverMetric {
42
42
  nanocentsPerUnit: number;
43
43
  estimateEur: number;
44
44
  }
45
+ export interface IPlanChangePricing {
46
+ interval: BillingInterval;
47
+ recurringPriceCents: number;
48
+ monthlyEquivalentCents: number;
49
+ dueNowCents: number;
50
+ timing: PlanChangeTiming;
51
+ }
45
52
  export interface IPreviewUserPlanChangeData {
46
53
  hasCard: boolean;
47
54
  effectiveDate: string;
48
55
  overMetrics: IPlanChangeOverMetric[];
56
+ pricing: IPlanChangePricing;
49
57
  }
50
58
  export type IPreviewUserPlanChangeResponse = IResponse<IPreviewUserPlanChangeData>;
59
+ export interface ISetBillingIntervalData {
60
+ billingAccount: IBillingAccount;
61
+ scheduled: boolean;
62
+ }
63
+ export type ISetUserBillingIntervalResponse = IResponse<ISetBillingIntervalData>;
51
64
  export interface IListUserInvoicesData {
52
65
  invoices: ICustomerInvoice[];
53
66
  }
@@ -79,3 +79,5 @@ export * from './mcp';
79
79
  export * from './models/activity.model';
80
80
  export * from './models/service-nudge.model';
81
81
  export * from './models/funding.model';
82
+ export * from './models/billing-subscription-event.model';
83
+ export * from './models/loyalty-rule.model';
@@ -95,4 +95,6 @@ __exportStar(require("./mcp"), exports);
95
95
  __exportStar(require("./models/activity.model"), exports);
96
96
  __exportStar(require("./models/service-nudge.model"), exports);
97
97
  __exportStar(require("./models/funding.model"), exports);
98
+ __exportStar(require("./models/billing-subscription-event.model"), exports);
99
+ __exportStar(require("./models/loyalty-rule.model"), exports);
98
100
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/interface/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,yDAAuC;AACvC,gEAA8C;AAC9C,4EAA0D;AAC1D,6DAA2C;AAC3C,mEAAiD;AACjD,yEAAuD;AACvD,+DAA6C;AAC7C,+DAA6C;AAC7C,8DAA4C;AAC5C,mEAAiD;AACjD,oEAAkD;AAGlD,2DAAyC;AACzC,sEAAoD;AAGpD,wCAAsB;AAGtB,uDAAqC;AAGrC,wDAAsC;AACtC,gEAA8C;AAC9C,8DAA4C;AAC5C,oEAAkD;AAClD,oEAAkD;AAClD,qEAAmD;AACnD,8EAA4D;AAC5D,kFAAgE;AAGhE,8DAA4C;AAC5C,0EAAwD;AACxD,qEAAmD;AACnD,gFA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;AACnD,8EAA4D;AAC5D,kFAAgE;AAGhE,8DAA4C;AAC5C,0EAAwD;AACxD,qEAAmD;AACnD,gFAA8D;AAC9D,mEAAiD;AAGjD,+DAA6C;AAC7C,iEAA+C;AAC/C,uEAAqD;AACrD,4EAA0D;AAC1D,4EAA0D;AAC1D,8DAA4C;AAC5C,yDAAuC;AACvC,8DAA4C;AAC5C,oEAAkD;AAClD,6DAA2C;AAC3C,oEAAkD;AAClD,iEAA+C;AAC/C,0EAAwD;AACxD,6DAA2C;AAC3C,sEAAoD;AACpD,mEAAiD;AACjD,mEAAiD;AACjD,kEAAgD;AAChD,qEAAmD;AACnD,wEAAsD;AACtD,+DAA6C;AAC7C,8DAA4C;AAC5C,qEAAmD;AACnD,sDAAoC;AACpC,6DAA2C;AAC3C,qEAAmD;AACnD,iFAA+D;AAC/D,iEAA+C;AAC/C,oFAAkE;AAGlE,kEAAgD;AAGhD,mEAAiD;AAGjD,+DAA6C;AAO7C,gEAA8C;AAG9C,gEAA8C;AAC9C,wEAAsD;AACtD,2EAAyD;AACzD,oEAAkD;AAClD,yEAAuD;AAGvD,4DAA0C;AAG1C,4DAA0C;AAG1C,qEAAmD;AAKnD,kEAAgD;AAGhD,iEAA+C;AAC/C,4DAA0C;AAG1C,yDAAuC;AACvC,yDAAuC;AAGvC,gEAA8C;AAC9C,qEAAmD;AACnD,wCAAsB;AAGtB,0DAAwC;AAGxC,+DAA6C;AAG7C,yDAAuC;AAGvC,4EAA0D;AAC1D,8DAA4C"}
@@ -1,4 +1,5 @@
1
- import { BillingAccountStatus } from '../../enum';
1
+ import { BillingAccountStatus, BillingAddonStatus, BillingInterval } from '../../enum';
2
+ import { BillingModuleId } from '../../../constants/module-catalog.constants';
2
3
  import { IOrganization } from './organization.model';
3
4
  import { IUser } from './user.model';
4
5
  import { IPlanTemplate } from './plan-template.model';
@@ -13,6 +14,17 @@ export interface IBillingAddress {
13
14
  postalCode: string;
14
15
  country: string;
15
16
  }
17
+ export interface IPausedSubscriptionModule {
18
+ moduleId: BillingModuleId;
19
+ quantity: number;
20
+ status: BillingAddonStatus.ACTIVE | BillingAddonStatus.SUSPENDED_BY_PLAN;
21
+ }
22
+ export interface IPausedSubscriptionSnapshot {
23
+ planTemplateId: string;
24
+ interval: BillingInterval;
25
+ modules: IPausedSubscriptionModule[];
26
+ pausedAt: string;
27
+ }
16
28
  export interface IBillingAccount {
17
29
  id?: string;
18
30
  userId: string | null;
@@ -36,6 +48,15 @@ export interface IBillingAccount {
36
48
  currentPeriodEnd: Date;
37
49
  billingAnchorDay: number | null;
38
50
  trialEndsAt: Date | null;
51
+ paidSince: Date | null;
52
+ billingInterval: BillingInterval;
53
+ pendingBillingInterval: BillingInterval | null;
54
+ annualPeriodStart: Date | null;
55
+ annualPeriodEnd: Date | null;
56
+ pauseStartsAt: Date | null;
57
+ pauseEndsAt: Date | null;
58
+ pausedSnapshot: IPausedSubscriptionSnapshot | null;
59
+ pauseResumeFailedAt: Date | null;
39
60
  unpaidStripeInvoiceIds: string[];
40
61
  openStripeDisputeIds: string[];
41
62
  billingEmail: string | null;
@@ -0,0 +1,17 @@
1
+ import { BillingInterval, BillingSubscriptionEventType } from '../../enum';
2
+ export interface IBillingSubscriptionEvent {
3
+ id: string;
4
+ billingAccountId: string;
5
+ type: BillingSubscriptionEventType;
6
+ occurredAt: Date;
7
+ planBefore: string | null;
8
+ planAfter: string | null;
9
+ intervalBefore: BillingInterval | null;
10
+ intervalAfter: BillingInterval | null;
11
+ mrrCentsBefore: number | null;
12
+ mrrCentsAfter: number | null;
13
+ payload: Record<string, unknown>;
14
+ stripeEventId: string | null;
15
+ createdAt: Date;
16
+ updatedAt: Date;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=billing-subscription-event.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-subscription-event.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/billing-subscription-event.model.ts"],"names":[],"mappings":""}
@@ -35,6 +35,8 @@ export * from './billing-quota-cap.model';
35
35
  export * from './quota-reservation.model';
36
36
  export * from './storage-subtotal.model';
37
37
  export * from './billing-trial-grant.model';
38
+ export * from './billing-subscription-event.model';
39
+ export * from './loyalty-rule.model';
38
40
  export * from './billing-daily-snapshot.model';
39
41
  export * from './webhook-event.model';
40
42
  export * from './ledger-entry.model';
@@ -51,6 +51,8 @@ __exportStar(require("./billing-quota-cap.model"), exports);
51
51
  __exportStar(require("./quota-reservation.model"), exports);
52
52
  __exportStar(require("./storage-subtotal.model"), exports);
53
53
  __exportStar(require("./billing-trial-grant.model"), exports);
54
+ __exportStar(require("./billing-subscription-event.model"), exports);
55
+ __exportStar(require("./loyalty-rule.model"), exports);
54
56
  __exportStar(require("./billing-daily-snapshot.model"), exports);
55
57
  __exportStar(require("./webhook-event.model"), exports);
56
58
  __exportStar(require("./ledger-entry.model"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,qEAAmD;AACnD,sDAAoC;AACpC,4DAA0C;AAC1C,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,4DAA0C;AAC1C,6DAA2C;AAG3C,oDAAkC;AAClC,+DAA6C;AAG7C,gDAA8B;AAG9B,iDAA+B;AAG/B,uDAAqC;AACrC,mEAAiD;AACjD,8DAA4C;AAG5C,wDAAsC;AACtC,0DAAwC;AACxC,gEAA8C;AAC9C,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,uDAAqC;AACrC,6DAA2C;AAC3C,sDAAoC;AACpC,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,8DAA4C;AAC5C,+CAA6B;AAC7B,sDAAoC;AACpC,8DAA4C;AAC5C,0EAAwD;AACxD,0DAAwC;AACxC,6EAA2D;AAG3D,2DAAyC;AAGzC,4DAA0C;AAG1C,wDAAsC;AAGtC,yDAAuC;AACvC,iEAA+C;AAC/C,oEAAkD;AAClD,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAGhD,qDAAmC;AAGnC,qDAAmC;AAGnC,8DAA4C;AAK5C,2DAAyC;AAGzC,0DAAwC;AAGxC,kDAAgC;AAChC,kDAAgC;AAGhC,yDAAuC;AACvC,8DAA4C;AAG5C,mDAAiC;AAGjC,wDAAsC;AAGtC,kDAAgC;AAEhC,6DAA2C;AAC3C,8DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,qEAAmD;AACnD,sDAAoC;AACpC,4DAA0C;AAC1C,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,4DAA0C;AAC1C,6DAA2C;AAG3C,oDAAkC;AAClC,+DAA6C;AAG7C,gDAA8B;AAG9B,iDAA+B;AAG/B,uDAAqC;AACrC,mEAAiD;AACjD,8DAA4C;AAG5C,wDAAsC;AACtC,0DAAwC;AACxC,gEAA8C;AAC9C,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,uDAAqC;AACrC,6DAA2C;AAC3C,sDAAoC;AACpC,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,qEAAmD;AACnD,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,8DAA4C;AAC5C,+CAA6B;AAC7B,sDAAoC;AACpC,8DAA4C;AAC5C,0EAAwD;AACxD,0DAAwC;AACxC,6EAA2D;AAG3D,2DAAyC;AAGzC,4DAA0C;AAG1C,wDAAsC;AAGtC,yDAAuC;AACvC,iEAA+C;AAC/C,oEAAkD;AAClD,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAGhD,qDAAmC;AAGnC,qDAAmC;AAGnC,8DAA4C;AAK5C,2DAAyC;AAGzC,0DAAwC;AAGxC,kDAAgC;AAChC,kDAAgC;AAGhC,yDAAuC;AACvC,8DAA4C;AAG5C,mDAAiC;AAGjC,wDAAsC;AAGtC,kDAAgC;AAEhC,6DAA2C;AAC3C,8DAA4C"}
@@ -0,0 +1,12 @@
1
+ import { BillingMetric, LoyaltyGrantMode, PlanAccountType } from '../../enum';
2
+ export interface ILoyaltyRule {
3
+ id: string;
4
+ metric: BillingMetric;
5
+ minTenureMonths: number;
6
+ mode: LoyaltyGrantMode;
7
+ value: number;
8
+ scopes: PlanAccountType[];
9
+ active: boolean;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=loyalty-rule.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loyalty-rule.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/loyalty-rule.model.ts"],"names":[],"mappings":""}
@@ -22,6 +22,7 @@ export interface IPlanTemplate {
22
22
  isPublic: boolean;
23
23
  isArchived: boolean;
24
24
  monthlyPriceEur: number;
25
+ yearlyPriceCents: number;
25
26
  quotas: IPlanServiceQuota[];
26
27
  overagePricing: IPlanOveragePricing[];
27
28
  quotaAlertThresholds: number[];
@@ -25,6 +25,7 @@ export * from './invoice-amounts.utils';
25
25
  export * from './invoice-line-label.utils';
26
26
  export * from './resolve-user.utils';
27
27
  export * from './record-presence.utils';
28
+ export * from './subscription-retention.utils';
28
29
  export * from './pricing.utils';
29
30
  export * from './plan-capacity.utils';
30
31
  export * from './billing-deep-link.utils';
@@ -41,6 +41,7 @@ __exportStar(require("./invoice-amounts.utils"), exports);
41
41
  __exportStar(require("./invoice-line-label.utils"), exports);
42
42
  __exportStar(require("./resolve-user.utils"), exports);
43
43
  __exportStar(require("./record-presence.utils"), exports);
44
+ __exportStar(require("./subscription-retention.utils"), exports);
44
45
  __exportStar(require("./pricing.utils"), exports);
45
46
  __exportStar(require("./plan-capacity.utils"), exports);
46
47
  __exportStar(require("./billing-deep-link.utils"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,6DAA2C;AAC3C,uDAAqC;AACrC,0DAAwC;AAIxC,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,6DAA2C;AAC3C,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C;AAI/C,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C"}
@@ -2,6 +2,7 @@ import { BillingPackId } from '../constants/pack-catalog.constants';
2
2
  import { BillingModuleId } from '../constants/module-catalog.constants';
3
3
  import { PriceTranche } from '../constants/metric-price-scale.constants';
4
4
  import { BillingMetric } from '../types/enum/organization-billing.enum';
5
+ import { BillingInterval } from '../types/enum/billing-interval.enum';
5
6
  export declare const priceForQuantity: (scale: PriceTranche[], quantity: number) => number;
6
7
  export declare const quantityForBudget: (scale: PriceTranche[], budgetCents: number) => number;
7
8
  export declare const overageNanocentsPerUnit: (scale: PriceTranche[]) => number;
@@ -37,8 +38,17 @@ export interface StripePriceTier {
37
38
  }
38
39
  export declare const shiftedTiersForModule: (scale: PriceTranche[], includedQuantity: number) => StripePriceTier[];
39
40
  export declare const modulePriceCentsFor: (scale: PriceTranche[], includedQuantity: number, quantity: number) => number;
41
+ export declare const moduleExactPriceCentsFor: (scale: PriceTranche[], includedQuantity: number, quantity: number) => number;
40
42
  export declare const moduleMonthlyPriceCents: (moduleId: BillingModuleId, includedQuantity: number, quantity: number) => number;
43
+ export declare const moduleExactMonthlyPriceCents: (moduleId: BillingModuleId, includedQuantity: number, quantity: number) => number;
44
+ export declare const moduleIntervalPriceCents: (moduleId: BillingModuleId, includedQuantity: number, quantity: number, interval: BillingInterval) => number;
41
45
  export declare const moduleMetricUnits: (moduleId: BillingModuleId, lots: number) => number;
42
46
  export declare const remainingPeriodShare: (now: Date, periodStart: Date, periodEnd: Date) => number;
43
- export declare const moduleProratedPriceCents: (moduleId: BillingModuleId, includedQuantity: number, quantity: number, now: Date, periodStart: Date, periodEnd: Date) => number;
47
+ export declare const moduleProratedPriceCents: (moduleId: BillingModuleId, includedQuantity: number, quantity: number, now: Date, periodStart: Date, periodEnd: Date, interval?: BillingInterval) => number;
44
48
  export declare const packMonthlyPriceCents: (packId: BillingPackId, includedByModule: Partial<Record<BillingModuleId, number>>) => number;
49
+ export declare const ANNUAL_MONTHS_CHARGED = 10;
50
+ export declare const annualPriceCents: (monthlyCents: number) => number;
51
+ export declare const intervalPriceCents: (monthlyCents: number, interval: BillingInterval) => number;
52
+ export declare const monthlyEquivalentCents: (priceCents: number, interval: BillingInterval) => number;
53
+ export declare const decimalTimesTen: (decimal: string) => string;
54
+ export declare const annualTiersForModule: (tiers: StripePriceTier[]) => StripePriceTier[];
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.packMonthlyPriceCents = exports.moduleProratedPriceCents = exports.remainingPeriodShare = exports.moduleMetricUnits = exports.moduleMonthlyPriceCents = exports.modulePriceCentsFor = exports.shiftedTiersForModule = exports.quoteOverageRate = exports.OVERAGE_QUOTE_QUANTITIES = exports.formatNanoCentsAsEur = exports.planCapacityShare = exports.planCapacityValueCents = exports.overagePriceCents = exports.overageAmountCents = exports.resolveOverageNanocentsPerUnit = exports.resolveOverageRate = exports.OverageRateSource = exports.overageNanocentsPerUnit = exports.quantityForBudget = exports.priceForQuantity = void 0;
3
+ exports.annualTiersForModule = exports.decimalTimesTen = exports.monthlyEquivalentCents = exports.intervalPriceCents = exports.annualPriceCents = exports.ANNUAL_MONTHS_CHARGED = exports.packMonthlyPriceCents = exports.moduleProratedPriceCents = exports.remainingPeriodShare = exports.moduleMetricUnits = exports.moduleIntervalPriceCents = exports.moduleExactMonthlyPriceCents = exports.moduleMonthlyPriceCents = exports.moduleExactPriceCentsFor = exports.modulePriceCentsFor = exports.shiftedTiersForModule = exports.quoteOverageRate = exports.OVERAGE_QUOTE_QUANTITIES = exports.formatNanoCentsAsEur = exports.planCapacityShare = exports.planCapacityValueCents = exports.overagePriceCents = exports.overageAmountCents = exports.resolveOverageNanocentsPerUnit = exports.resolveOverageRate = exports.OverageRateSource = exports.overageNanocentsPerUnit = exports.quantityForBudget = exports.priceForQuantity = void 0;
4
4
  const pack_catalog_constants_1 = require("../constants/pack-catalog.constants");
5
5
  const overage_base_rates_constants_1 = require("../constants/overage-base-rates.constants");
6
6
  const module_catalog_constants_1 = require("../constants/module-catalog.constants");
7
7
  const metric_price_scale_constants_1 = require("../constants/metric-price-scale.constants");
8
+ const billing_interval_enum_1 = require("../types/enum/billing-interval.enum");
8
9
  const priceForQuantity = (scale, quantity) => {
9
10
  if (!Number.isFinite(quantity) || quantity <= 0) {
10
11
  return 0;
@@ -170,7 +171,9 @@ const shiftedTiersForModule = (scale, includedQuantity) => {
170
171
  return tiers;
171
172
  };
172
173
  exports.shiftedTiersForModule = shiftedTiersForModule;
173
- const modulePriceCentsFor = (scale, includedQuantity, quantity) => {
174
+ const modulePriceCentsFor = (scale, includedQuantity, quantity) => Math.round((0, exports.moduleExactPriceCentsFor)(scale, includedQuantity, quantity));
175
+ exports.modulePriceCentsFor = modulePriceCentsFor;
176
+ const moduleExactPriceCentsFor = (scale, includedQuantity, quantity) => {
174
177
  if (!Number.isFinite(quantity) || quantity <= 0) {
175
178
  return 0;
176
179
  }
@@ -190,10 +193,12 @@ const modulePriceCentsFor = (scale, includedQuantity, quantity) => {
190
193
  break;
191
194
  }
192
195
  }
193
- return Math.round(centimes);
196
+ return centimes;
194
197
  };
195
- exports.modulePriceCentsFor = modulePriceCentsFor;
196
- const moduleMonthlyPriceCents = (moduleId, includedQuantity, quantity) => {
198
+ exports.moduleExactPriceCentsFor = moduleExactPriceCentsFor;
199
+ const moduleMonthlyPriceCents = (moduleId, includedQuantity, quantity) => Math.round((0, exports.moduleExactMonthlyPriceCents)(moduleId, includedQuantity, quantity));
200
+ exports.moduleMonthlyPriceCents = moduleMonthlyPriceCents;
201
+ const moduleExactMonthlyPriceCents = (moduleId, includedQuantity, quantity) => {
197
202
  const module = (0, module_catalog_constants_1.moduleById)(moduleId);
198
203
  if (!module || !Number.isFinite(quantity) || quantity <= 0) {
199
204
  return 0;
@@ -205,9 +210,11 @@ const moduleMonthlyPriceCents = (moduleId, includedQuantity, quantity) => {
205
210
  if (!scale) {
206
211
  return 0;
207
212
  }
208
- return (0, exports.modulePriceCentsFor)(scale, includedQuantity, (0, exports.moduleMetricUnits)(module.id, quantity));
213
+ return (0, exports.moduleExactPriceCentsFor)(scale, includedQuantity, (0, exports.moduleMetricUnits)(module.id, quantity));
209
214
  };
210
- exports.moduleMonthlyPriceCents = moduleMonthlyPriceCents;
215
+ exports.moduleExactMonthlyPriceCents = moduleExactMonthlyPriceCents;
216
+ const moduleIntervalPriceCents = (moduleId, includedQuantity, quantity, interval) => (0, exports.intervalPriceCents)((0, exports.moduleExactMonthlyPriceCents)(moduleId, includedQuantity, quantity), interval);
217
+ exports.moduleIntervalPriceCents = moduleIntervalPriceCents;
211
218
  const moduleMetricUnits = (moduleId, lots) => {
212
219
  const module = (0, module_catalog_constants_1.moduleById)(moduleId);
213
220
  if (!module || !Number.isFinite(lots) || lots <= 0) {
@@ -234,7 +241,7 @@ const remainingPeriodShare = (now, periodStart, periodEnd) => {
234
241
  return Math.min(1, restant / duree);
235
242
  };
236
243
  exports.remainingPeriodShare = remainingPeriodShare;
237
- const moduleProratedPriceCents = (moduleId, includedQuantity, quantity, now, periodStart, periodEnd) => Math.floor((0, exports.moduleMonthlyPriceCents)(moduleId, includedQuantity, quantity) *
244
+ const moduleProratedPriceCents = (moduleId, includedQuantity, quantity, now, periodStart, periodEnd, interval = billing_interval_enum_1.BillingInterval.MONTH) => Math.floor((0, exports.moduleIntervalPriceCents)(moduleId, includedQuantity, quantity, interval) *
238
245
  (0, exports.remainingPeriodShare)(now, periodStart, periodEnd));
239
246
  exports.moduleProratedPriceCents = moduleProratedPriceCents;
240
247
  const packMonthlyPriceCents = (packId, includedByModule) => {
@@ -246,4 +253,44 @@ const packMonthlyPriceCents = (packId, includedByModule) => {
246
253
  return Math.round(somme * (1 - pack_catalog_constants_1.PACK_DISCOUNT_RATE));
247
254
  };
248
255
  exports.packMonthlyPriceCents = packMonthlyPriceCents;
256
+ exports.ANNUAL_MONTHS_CHARGED = 10;
257
+ const MONTHS_PER_YEAR = 12;
258
+ const annualPriceCents = (monthlyCents) => {
259
+ if (!Number.isFinite(monthlyCents) || monthlyCents <= 0) {
260
+ return 0;
261
+ }
262
+ return Math.round(monthlyCents * exports.ANNUAL_MONTHS_CHARGED);
263
+ };
264
+ exports.annualPriceCents = annualPriceCents;
265
+ const intervalPriceCents = (monthlyCents, interval) => {
266
+ if (interval === billing_interval_enum_1.BillingInterval.YEAR) {
267
+ return (0, exports.annualPriceCents)(monthlyCents);
268
+ }
269
+ if (!Number.isFinite(monthlyCents) || monthlyCents <= 0) {
270
+ return 0;
271
+ }
272
+ return Math.round(monthlyCents);
273
+ };
274
+ exports.intervalPriceCents = intervalPriceCents;
275
+ const monthlyEquivalentCents = (priceCents, interval) => interval === billing_interval_enum_1.BillingInterval.YEAR ? Math.round(priceCents / MONTHS_PER_YEAR) : priceCents;
276
+ exports.monthlyEquivalentCents = monthlyEquivalentCents;
277
+ const decimalTimesTen = (decimal) => {
278
+ const [mantissa, exponentText = '0'] = decimal.toLowerCase().split('e');
279
+ const [integerPart, fractionPart = ''] = mantissa.split('.');
280
+ const digits = `${integerPart}${fractionPart}`;
281
+ const pointIndex = integerPart.length + Number(exponentText) + 1;
282
+ const padded = pointIndex <= 0
283
+ ? `${'0'.repeat(1 - pointIndex)}${digits}`
284
+ : digits.padEnd(Math.max(digits.length, pointIndex), '0');
285
+ const at = Math.max(pointIndex, 1);
286
+ const whole = padded.slice(0, at).replace(/^0+(?=\d)/, '');
287
+ const fraction = padded.slice(at).replace(/0+$/, '');
288
+ return fraction.length > 0 ? `${whole}.${fraction}` : whole;
289
+ };
290
+ exports.decimalTimesTen = decimalTimesTen;
291
+ const annualTiersForModule = (tiers) => tiers.map((tier) => ({
292
+ upTo: tier.upTo,
293
+ unitAmountDecimal: (0, exports.decimalTimesTen)(tier.unitAmountDecimal),
294
+ }));
295
+ exports.annualTiersForModule = annualTiersForModule;
249
296
  //# sourceMappingURL=pricing.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricing.utils.js","sourceRoot":"","sources":["../../src/utils/pricing.utils.ts"],"names":[],"mappings":";;;AAAA,gFAAkG;AAClG,4FAAuF;AACvF,oFAK+C;AAC/C,4FAKmD;AAS5C,MAAM,gBAAgB,GAAG,CAAC,KAAqB,EAAE,QAAgB,EAAU,EAAE;IAKlF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAChD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,SAAS,GAAG,QAAQ,CAAC;IACzB,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,IAAI,MAAM,CAAC,iBAAiB,CAAC;QAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,GAAG,aAAa,CAAC,CAAC;QACzD,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,SAAS,IAAI,KAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAC9C,SAAS,IAAI,KAAK,CAAC;QACrB,CAAC;QACD,aAAa,GAAG,KAAK,CAAC;QACtB,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;YACnB,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,iDAAkB,CAAC,CAAC;AACpD,CAAC,CAAC;AAxBW,QAAA,gBAAgB,oBAwB3B;AAOK,MAAM,iBAAiB,GAAG,CAAC,KAAqB,EAAE,WAAmB,EAAU,EAAE;IAC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O,QAAA,oBAAoB,wBAI3B"}
@@ -0,0 +1,12 @@
1
+ import { CancellationReason, RetentionOffer } from '../types/enum/billing-subscription-event.enum';
2
+ import { SubscriptionPauseState } from '../types/enum/subscription-pause.enum';
3
+ import type { IBillingAccount } from '../types/interface/models/billing-account.model';
4
+ export declare const SUBSCRIPTION_PAUSE_MONTHS: readonly [1, 2, 3];
5
+ export type SubscriptionPauseMonths = typeof SUBSCRIPTION_PAUSE_MONTHS[number];
6
+ export declare const SUBSCRIPTION_PAUSE_WINDOW_MONTHS = 12;
7
+ export declare const SUBSCRIPTION_RESUME_REMINDER_DAYS = 7;
8
+ export declare const CANCELLATION_REASON_TEXT_MAX_LENGTH = 500;
9
+ export declare const subscriptionPauseStateOf: (account: Pick<IBillingAccount, "pauseStartsAt" | "pausedSnapshot" | "pauseResumeFailedAt">) => SubscriptionPauseState;
10
+ export declare const retentionOffersFor: (reason?: CancellationReason | null) => RetentionOffer[];
11
+ export declare const RETENTION_OFFERS_SHOWN_MAX = 2;
12
+ export declare const retentionOffersShownMax: (reason?: CancellationReason | null) => number;