@abyss-project/main 1.8.0 → 1.10.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/dist/api/application.admin.api.d.ts +1 -3
- package/dist/api/application.admin.api.js +1 -10
- package/dist/api/application.admin.api.js.map +1 -1
- package/dist/api/billing-account.admin.api.d.ts +5 -2
- package/dist/api/billing-account.admin.api.js +13 -1
- package/dist/api/billing-account.admin.api.js.map +1 -1
- package/dist/api/billing-plan-request.admin.api.d.ts +6 -0
- package/dist/api/billing-plan-request.admin.api.js +21 -0
- package/dist/api/billing-plan-request.admin.api.js.map +1 -0
- package/dist/api/gift-code.api.d.ts +1 -2
- package/dist/api/gift-code.api.js +1 -7
- package/dist/api/gift-code.api.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/organization-billing.api.d.ts +3 -2
- package/dist/api/organization-billing.api.js +5 -1
- package/dist/api/organization-billing.api.js.map +1 -1
- package/dist/api/project.admin.api.d.ts +1 -3
- package/dist/api/project.admin.api.js +1 -10
- package/dist/api/project.admin.api.js.map +1 -1
- package/dist/api/user-billing.api.d.ts +3 -2
- package/dist/api/user-billing.api.js +5 -1
- package/dist/api/user-billing.api.js.map +1 -1
- package/dist/api/user.admin.api.d.ts +2 -2
- package/dist/api/user.admin.api.js +2 -2
- package/dist/api/user.admin.api.js.map +1 -1
- package/dist/constants/billing-catalog.constants.d.ts +14 -1
- package/dist/constants/billing-catalog.constants.js +218 -24
- package/dist/constants/billing-catalog.constants.js.map +1 -1
- package/dist/constants/enforcement-registry.constants.js +61 -9
- package/dist/constants/enforcement-registry.constants.js.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/metric-price-scale.constants.d.ts +8 -0
- package/dist/constants/metric-price-scale.constants.js +91 -0
- package/dist/constants/metric-price-scale.constants.js.map +1 -0
- package/dist/constants/public-plans.constants.js +3617 -241
- package/dist/constants/public-plans.constants.js.map +1 -1
- package/dist/constants/quota-metric-kind.constants.js +14 -4
- package/dist/constants/quota-metric-kind.constants.js.map +1 -1
- package/dist/index.d.ts +11 -12
- package/dist/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/dist/types/enum/abyss-application-event.enum.d.ts +5 -3
- package/dist/types/enum/abyss-application-event.enum.js +5 -3
- package/dist/types/enum/abyss-application-event.enum.js.map +1 -1
- package/dist/types/enum/admin-audit-target-type.enum.d.ts +0 -1
- package/dist/types/enum/admin-audit-target-type.enum.js +0 -1
- package/dist/types/enum/admin-audit-target-type.enum.js.map +1 -1
- package/dist/types/enum/email-type.enum.d.ts +1 -0
- package/dist/types/enum/email-type.enum.js +1 -0
- package/dist/types/enum/email-type.enum.js.map +1 -1
- package/dist/types/enum/index.d.ts +1 -0
- package/dist/types/enum/index.js +1 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/organization-billing.enum.d.ts +27 -8
- package/dist/types/enum/organization-billing.enum.js +25 -5
- package/dist/types/enum/organization-billing.enum.js.map +1 -1
- package/dist/types/enum/project-access-member-source.enum.d.ts +4 -0
- package/dist/types/enum/project-access-member-source.enum.js +9 -0
- package/dist/types/enum/project-access-member-source.enum.js.map +1 -0
- package/dist/types/enum/user-notification-category.enum.js +1 -0
- package/dist/types/enum/user-notification-category.enum.js.map +1 -1
- package/dist/types/enum/user-notification-content-type.enum.d.ts +11 -0
- package/dist/types/enum/user-notification-content-type.enum.js +2 -1
- package/dist/types/enum/user-notification-content-type.enum.js.map +1 -1
- package/dist/types/interface/api/index.d.ts +2 -2
- package/dist/types/interface/api/index.js +2 -2
- package/dist/types/interface/api/index.js.map +1 -1
- package/dist/types/interface/api/requests/billing-account.admin.request.d.ts +23 -1
- package/dist/types/interface/api/requests/billing-plan-request.admin.request.d.ts +22 -0
- package/dist/types/interface/api/requests/{billing-addon-template.request.js → billing-plan-request.admin.request.js} +1 -1
- package/dist/types/interface/api/requests/billing-plan-request.admin.request.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +1 -1
- package/dist/types/interface/api/requests/index.js +1 -1
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/organization-billing.request.d.ts +10 -1
- package/dist/types/interface/api/requests/user-billing.request.d.ts +7 -1
- package/dist/types/interface/api/requests/user.admin.request.d.ts +3 -0
- package/dist/types/interface/api/responses/billing-account.admin.response.d.ts +27 -0
- package/dist/types/interface/api/responses/billing-plan-request.admin.response.d.ts +23 -0
- package/dist/types/interface/api/responses/{billing-addon-template.response.js → billing-plan-request.admin.response.js} +1 -1
- package/dist/types/interface/api/responses/billing-plan-request.admin.response.js.map +1 -0
- package/dist/types/interface/api/responses/billing.response.d.ts +1 -0
- package/dist/types/interface/api/responses/index.d.ts +1 -1
- package/dist/types/interface/api/responses/index.js +1 -1
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/organization-billing.response.d.ts +4 -0
- package/dist/types/interface/api/responses/project-access.admin.response.d.ts +4 -1
- package/dist/types/interface/api/responses/user-billing.response.d.ts +4 -0
- package/dist/types/interface/index.d.ts +0 -1
- package/dist/types/interface/index.js +0 -1
- package/dist/types/interface/index.js.map +1 -1
- package/dist/types/interface/models/billing-account.model.d.ts +2 -0
- package/dist/types/interface/models/billing-daily-snapshot.model.d.ts +1 -1
- package/dist/types/interface/models/index.d.ts +0 -1
- package/dist/types/interface/models/index.js +0 -1
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/organization-service-quota.model.d.ts +3 -1
- package/dist/types/interface/models/plan-template.model.d.ts +2 -0
- package/dist/utils/billing.utils.d.ts +11 -0
- package/dist/utils/billing.utils.js +39 -1
- package/dist/utils/billing.utils.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/pricing.utils.d.ts +15 -0
- package/dist/utils/pricing.utils.js +99 -0
- package/dist/utils/pricing.utils.js.map +1 -0
- package/dist/utils/quota-ceiling.utils.d.ts +16 -0
- package/dist/utils/quota-ceiling.utils.js +38 -0
- package/dist/utils/quota-ceiling.utils.js.map +1 -0
- package/package.json +1 -1
- package/dist/api/billing-addon-template.admin.api.d.ts +0 -7
- package/dist/api/billing-addon-template.admin.api.js +0 -27
- package/dist/api/billing-addon-template.admin.api.js.map +0 -1
- package/dist/types/enum/admin-role.enum.d.ts +0 -6
- package/dist/types/enum/admin-role.enum.js +0 -11
- package/dist/types/enum/admin-role.enum.js.map +0 -1
- package/dist/types/interface/api/requests/billing-addon-template.request.d.ts +0 -32
- package/dist/types/interface/api/requests/billing-addon-template.request.js.map +0 -1
- package/dist/types/interface/api/responses/billing-addon-template.response.d.ts +0 -19
- package/dist/types/interface/api/responses/billing-addon-template.response.js.map +0 -1
- package/dist/types/interface/models/billing-addon-template.model.d.ts +0 -15
- package/dist/types/interface/models/billing-addon-template.model.js +0 -3
- package/dist/types/interface/models/billing-addon-template.model.js.map +0 -1
|
@@ -4,8 +4,8 @@ export * from './application.request';
|
|
|
4
4
|
export * from './asset.request';
|
|
5
5
|
export * from './auth.request';
|
|
6
6
|
export * from './billing-account.admin.request';
|
|
7
|
-
export * from './billing-addon-template.request';
|
|
8
7
|
export * from './billing-plan.request';
|
|
8
|
+
export * from './billing-plan-request.admin.request';
|
|
9
9
|
export * from './billing-trial.admin.request';
|
|
10
10
|
export * from './billing-trial.request';
|
|
11
11
|
export * from './billing.request';
|
|
@@ -20,8 +20,8 @@ __exportStar(require("./application.request"), exports);
|
|
|
20
20
|
__exportStar(require("./asset.request"), exports);
|
|
21
21
|
__exportStar(require("./auth.request"), exports);
|
|
22
22
|
__exportStar(require("./billing-account.admin.request"), exports);
|
|
23
|
-
__exportStar(require("./billing-addon-template.request"), exports);
|
|
24
23
|
__exportStar(require("./billing-plan.request"), exports);
|
|
24
|
+
__exportStar(require("./billing-plan-request.admin.request"), exports);
|
|
25
25
|
__exportStar(require("./billing-trial.admin.request"), exports);
|
|
26
26
|
__exportStar(require("./billing-trial.request"), exports);
|
|
27
27
|
__exportStar(require("./billing.request"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD;AAChD,8DAA4C;AAC5C,wDAAsC;AACtC,kDAAgC;AAChC,iDAA+B;AAC/B,kEAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD;AAChD,8DAA4C;AAC5C,wDAAsC;AACtC,kDAAgC;AAChC,iDAA+B;AAC/B,kEAAgD;AAChD,yDAAuC;AACvC,uEAAqD;AACrD,gEAA8C;AAC9C,0DAAwC;AACxC,oDAAkC;AAClC,0DAAwC;AACxC,gEAA8C;AAC9C,4DAA0C;AAC1C,sDAAoC;AACpC,uDAAqC;AACrC,0DAAwC;AACxC,6DAA2C;AAC3C,iEAA+C;AAC/C,6EAA2D;AAC3D,gEAA8C;AAC9C,+DAA6C;AAC7C,yDAAuC;AACvC,iEAA+C;AAC/C,2DAAyC;AACzC,4DAA0C;AAC1C,6DAA2C;AAC3C,0DAAwC;AACxC,oDAAkC;AAClC,iEAA+C;AAC/C,+DAA6C;AAC7C,2DAAyC;AACzC,iDAA+B;AAC/B,gEAA8C;AAC9C,yDAAuC;AACvC,oEAAkD;AAClD,8DAA4C;AAC5C,uDAAqC;AACrC,iDAA+B;AAC/B,6DAA2C;AAC3C,gEAA8C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BillingMetric, BillingQuotaCapAction, BillingQuotaCapMode, BillingService, QuotaGrantScope, StorageSubtotalSource } from '../../../enum';
|
|
1
|
+
import { BillingMetric, BillingQuotaCapAction, BillingQuotaCapMode, BillingService, QuotaCeilingMode, QuotaGrantScope, StorageSubtotalSource } from '../../../enum';
|
|
2
2
|
import { IBillingAddress } from '../../models/billing-account.model';
|
|
3
3
|
export interface IGetBillingOrganizationParams {
|
|
4
4
|
organizationId: string;
|
|
@@ -187,6 +187,15 @@ export interface IRemoveOrgQuotaCapParams {
|
|
|
187
187
|
organizationId: string;
|
|
188
188
|
capId: string;
|
|
189
189
|
}
|
|
190
|
+
export interface ISetOrgQuotaCeilingParams {
|
|
191
|
+
organizationId: string;
|
|
192
|
+
}
|
|
193
|
+
export interface ISetOrgQuotaCeilingBody {
|
|
194
|
+
service: BillingService;
|
|
195
|
+
metric: BillingMetric;
|
|
196
|
+
ceilingMode: QuotaCeilingMode;
|
|
197
|
+
ceilingValue?: number | null;
|
|
198
|
+
}
|
|
190
199
|
export interface IGetOrgStorageBreakdownParams {
|
|
191
200
|
organizationId: string;
|
|
192
201
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BillingMetric, BillingQuotaCapAction, BillingQuotaCapMode, BillingService, StorageSubtotalSource } from '../../../enum';
|
|
1
|
+
import { BillingMetric, BillingQuotaCapAction, BillingQuotaCapMode, BillingService, QuotaCeilingMode, StorageSubtotalSource } from '../../../enum';
|
|
2
2
|
import { IBillingAddress } from '../../models/billing-account.model';
|
|
3
3
|
import { QueryPaginate } from '../type-message/base-paginate';
|
|
4
4
|
import { BaseOrder } from '../type-message/base-order';
|
|
@@ -22,6 +22,12 @@ export interface IUpdateUserBillingInfoBody {
|
|
|
22
22
|
billingName?: string | null;
|
|
23
23
|
billingAddress?: IBillingAddress | null;
|
|
24
24
|
}
|
|
25
|
+
export interface ISetUserQuotaCeilingBody {
|
|
26
|
+
service: BillingService;
|
|
27
|
+
metric: BillingMetric;
|
|
28
|
+
ceilingMode: QuotaCeilingMode;
|
|
29
|
+
ceilingValue?: number | null;
|
|
30
|
+
}
|
|
25
31
|
export interface ISubscribeUserPlanBody {
|
|
26
32
|
planTemplateId: string;
|
|
27
33
|
creditAmount?: number;
|
|
@@ -62,6 +62,9 @@ export interface IUpdateSettingsUserAdminBody {
|
|
|
62
62
|
export interface IConnectAsAdminUserAdminParams {
|
|
63
63
|
userId: string;
|
|
64
64
|
}
|
|
65
|
+
export interface IConnectAsAdminUserAdminBody {
|
|
66
|
+
justification: string;
|
|
67
|
+
}
|
|
65
68
|
export interface IJoinNewsletterUserAdminParams {
|
|
66
69
|
userId: string;
|
|
67
70
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { BillingMetric, BillingService, PlanTier, QuotaCeilingMode } from '../../../enum';
|
|
1
2
|
import { IBillingAccount } from '../../models/billing-account.model';
|
|
2
3
|
import { ICreditTransaction } from '../../models/credit-transaction.model';
|
|
3
4
|
import { IEurTransaction } from '../../models/eur-transaction.model';
|
|
4
5
|
import { IInvoice } from '../../models/invoice.model';
|
|
5
6
|
import { IServiceQuota } from '../../models/organization-service-quota.model';
|
|
7
|
+
import { IPlanTemplate } from '../../models/plan-template.model';
|
|
6
8
|
import { IResponse } from '../type-message/response';
|
|
7
9
|
import { BasePaginate } from '../type-message/base-paginate';
|
|
8
10
|
export interface ICreateAccountAdminBillingData {
|
|
@@ -19,6 +21,31 @@ export interface IUpdateAccountAdminBillingData {
|
|
|
19
21
|
billingAccount: IBillingAccount;
|
|
20
22
|
}
|
|
21
23
|
export type IUpdateAccountAdminBillingResponse = IResponse<IUpdateAccountAdminBillingData>;
|
|
24
|
+
export interface ISetQuotaCeilingAdminBillingData {
|
|
25
|
+
billingAccount: IBillingAccount;
|
|
26
|
+
}
|
|
27
|
+
export type ISetQuotaCeilingAdminBillingResponse = IResponse<ISetQuotaCeilingAdminBillingData>;
|
|
28
|
+
export interface IQuotaStateItemAdminBilling {
|
|
29
|
+
service: BillingService;
|
|
30
|
+
metric: BillingMetric;
|
|
31
|
+
limit: number;
|
|
32
|
+
current: number;
|
|
33
|
+
ceilingMode: QuotaCeilingMode;
|
|
34
|
+
ceilingValue: number | null;
|
|
35
|
+
effectiveLimit: number;
|
|
36
|
+
overageAllowed: boolean;
|
|
37
|
+
overagePricePerUnit: number | null;
|
|
38
|
+
unit: string;
|
|
39
|
+
}
|
|
40
|
+
export interface IGetQuotaStateAdminBillingData {
|
|
41
|
+
planTier: PlanTier;
|
|
42
|
+
metrics: IQuotaStateItemAdminBilling[];
|
|
43
|
+
}
|
|
44
|
+
export type IGetQuotaStateAdminBillingResponse = IResponse<IGetQuotaStateAdminBillingData>;
|
|
45
|
+
export interface IEditCustomPlanAdminBillingData {
|
|
46
|
+
plan: IPlanTemplate;
|
|
47
|
+
}
|
|
48
|
+
export type IEditCustomPlanAdminBillingResponse = IResponse<IEditCustomPlanAdminBillingData>;
|
|
22
49
|
export interface IOverrideQuotaAdminBillingData {
|
|
23
50
|
quota: IServiceQuota;
|
|
24
51
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IResponse } from '../type-message/response';
|
|
2
|
+
import { IBillingPlanRequest } from '../../models/billing-plan-request.model';
|
|
3
|
+
import { BasePaginate } from '../type-message/base-paginate';
|
|
4
|
+
import { SupportTicketStatus } from '../../../enum';
|
|
5
|
+
export interface IGetPlanRequestAdminBillingData {
|
|
6
|
+
planRequest: IBillingPlanRequest;
|
|
7
|
+
}
|
|
8
|
+
export type IGetPlanRequestAdminBillingResponse = IResponse<IGetPlanRequestAdminBillingData>;
|
|
9
|
+
export type IBillingPlanRequestAdminListItem = IBillingPlanRequest & {
|
|
10
|
+
ticket: {
|
|
11
|
+
id: string;
|
|
12
|
+
status: SupportTicketStatus;
|
|
13
|
+
title: string;
|
|
14
|
+
} | null;
|
|
15
|
+
};
|
|
16
|
+
export type IPaginatePlanRequestAdminBillingData = BasePaginate<IBillingPlanRequestAdminListItem>;
|
|
17
|
+
export type IPaginatePlanRequestAdminBillingResponse = IResponse<IPaginatePlanRequestAdminBillingData>;
|
|
18
|
+
export interface IApplyPlanRequestAdminBillingData {
|
|
19
|
+
planTemplateId: string;
|
|
20
|
+
checkoutUrl?: string;
|
|
21
|
+
}
|
|
22
|
+
export type IApplyPlanRequestAdminBillingResponse = IResponse<IApplyPlanRequestAdminBillingData>;
|
|
23
|
+
export type IRejectPlanRequestAdminBillingResponse = IResponse<Record<string, never>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-plan-request.admin.response.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/billing-plan-request.admin.response.ts"],"names":[],"mappings":""}
|
|
@@ -2,5 +2,6 @@ import { IBillingPlanRequest } from '../../models/billing-plan-request.model';
|
|
|
2
2
|
import { IResponse } from '../type-message/response';
|
|
3
3
|
export interface ICreatePlanRequestBillingData {
|
|
4
4
|
planRequest: IBillingPlanRequest;
|
|
5
|
+
ticketId: string;
|
|
5
6
|
}
|
|
6
7
|
export type ICreatePlanRequestBillingResponse = IResponse<ICreatePlanRequestBillingData>;
|
|
@@ -4,8 +4,8 @@ export * from './application.response';
|
|
|
4
4
|
export * from './asset.response';
|
|
5
5
|
export * from './auth.response';
|
|
6
6
|
export * from './billing-account.admin.response';
|
|
7
|
-
export * from './billing-addon-template.response';
|
|
8
7
|
export * from './billing-plan.response';
|
|
8
|
+
export * from './billing-plan-request.admin.response';
|
|
9
9
|
export * from './billing-trial.admin.response';
|
|
10
10
|
export * from './billing-trial.response';
|
|
11
11
|
export * from './billing.response';
|
|
@@ -20,8 +20,8 @@ __exportStar(require("./application.response"), exports);
|
|
|
20
20
|
__exportStar(require("./asset.response"), exports);
|
|
21
21
|
__exportStar(require("./auth.response"), exports);
|
|
22
22
|
__exportStar(require("./billing-account.admin.response"), exports);
|
|
23
|
-
__exportStar(require("./billing-addon-template.response"), exports);
|
|
24
23
|
__exportStar(require("./billing-plan.response"), exports);
|
|
24
|
+
__exportStar(require("./billing-plan-request.admin.response"), exports);
|
|
25
25
|
__exportStar(require("./billing-trial.admin.response"), exports);
|
|
26
26
|
__exportStar(require("./billing-trial.response"), exports);
|
|
27
27
|
__exportStar(require("./billing.response"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,+DAA6C;AAC7C,yDAAuC;AACvC,mDAAiC;AACjC,kDAAgC;AAChC,mEAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/interface/api/responses/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,+DAA6C;AAC7C,yDAAuC;AACvC,mDAAiC;AACjC,kDAAgC;AAChC,mEAAiD;AACjD,0DAAwC;AACxC,wEAAsD;AACtD,iEAA+C;AAC/C,2DAAyC;AACzC,qDAAmC;AACnC,0DAAwC;AACxC,2DAAyC;AACzC,iEAA+C;AAC/C,6DAA2C;AAC3C,uDAAqC;AACrC,wDAAsC;AACtC,2DAAyC;AACzC,2DAAyC;AACzC,qDAAmC;AACnC,8DAA4C;AAC5C,kEAAgD;AAChD,iEAA+C;AAC/C,gEAA8C;AAC9C,0DAAwC;AACxC,kEAAgD;AAChD,4DAA0C;AAC1C,6DAA2C;AAC3C,8DAA4C;AAC5C,2DAAyC;AACzC,qDAAmC;AACnC,4DAA0C;AAC1C,kDAAgC;AAChC,iEAA+C;AAC/C,0DAAwC;AACxC,iEAA+C;AAC/C,iEAA+C;AAC/C,qEAAmD;AACnD,+DAA6C;AAC7C,wDAAsC;AACtC,kDAAgC;AAChC,8DAA4C"}
|
|
@@ -140,6 +140,10 @@ export interface IAddOrgQuotaCapData {
|
|
|
140
140
|
quotaCap: IBillingQuotaCap;
|
|
141
141
|
}
|
|
142
142
|
export type IAddOrgQuotaCapResponse = IResponse<IAddOrgQuotaCapData>;
|
|
143
|
+
export interface ISetOrgQuotaCeilingData {
|
|
144
|
+
billingAccount: IBillingAccount;
|
|
145
|
+
}
|
|
146
|
+
export type ISetOrgQuotaCeilingResponse = IResponse<ISetOrgQuotaCeilingData>;
|
|
143
147
|
export type IGetOrgStorageBreakdownData = IStorageBreakdown;
|
|
144
148
|
export type IGetOrgStorageBreakdownResponse = IResponse<IGetOrgStorageBreakdownData>;
|
|
145
149
|
export interface IGetOrgDailySnapshotData {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasePaginate } from '..';
|
|
2
|
-
import { OAuthAccountType, ProjectAccessPermission, ProjectApplicationAccessPermission } from '../../../enum';
|
|
2
|
+
import { OAuthAccountType, ProjectAccessMemberSource, ProjectAccessPermission, ProjectApplicationAccessPermission } from '../../../enum';
|
|
3
3
|
import { IProjectAccess } from '../../models/project-access.model';
|
|
4
4
|
import { IProjectApplicationAccess } from '../../models/project-application-access.model';
|
|
5
5
|
import { IUser } from '../../models/user.model';
|
|
@@ -56,6 +56,9 @@ export interface IListMembersProjectAccessAdminMember {
|
|
|
56
56
|
type: OAuthAccountType;
|
|
57
57
|
accountId: string;
|
|
58
58
|
}[];
|
|
59
|
+
source: ProjectAccessMemberSource;
|
|
60
|
+
teamId: string | null;
|
|
61
|
+
teamName: string | null;
|
|
59
62
|
}
|
|
60
63
|
export interface IListMembersProjectAccessAdminData {
|
|
61
64
|
members: IListMembersProjectAccessAdminMember[];
|
|
@@ -22,6 +22,10 @@ export interface IUpdateUserBillingInfoData {
|
|
|
22
22
|
billingAccount: IBillingAccount;
|
|
23
23
|
}
|
|
24
24
|
export type IUpdateUserBillingInfoResponse = IResponse<IUpdateUserBillingInfoData>;
|
|
25
|
+
export interface ISetUserQuotaCeilingData {
|
|
26
|
+
billingAccount: IBillingAccount;
|
|
27
|
+
}
|
|
28
|
+
export type ISetUserQuotaCeilingResponse = IResponse<ISetUserQuotaCeilingData>;
|
|
25
29
|
export interface ISubscribeUserPlanData {
|
|
26
30
|
billingAccount: IBillingAccount;
|
|
27
31
|
scheduled: boolean;
|
|
@@ -33,7 +33,6 @@ export * from './models/credit-transaction.model';
|
|
|
33
33
|
export * from './models/eur-transaction.model';
|
|
34
34
|
export * from './models/organization-quota-alert.model';
|
|
35
35
|
export * from './models/quota-grant.model';
|
|
36
|
-
export * from './models/billing-addon-template.model';
|
|
37
36
|
export * from './models/billing-plan-request.model';
|
|
38
37
|
export * from './models/billing-quota-cap.model';
|
|
39
38
|
export * from './models/quota-reservation.model';
|
|
@@ -49,7 +49,6 @@ __exportStar(require("./models/credit-transaction.model"), exports);
|
|
|
49
49
|
__exportStar(require("./models/eur-transaction.model"), exports);
|
|
50
50
|
__exportStar(require("./models/organization-quota-alert.model"), exports);
|
|
51
51
|
__exportStar(require("./models/quota-grant.model"), exports);
|
|
52
|
-
__exportStar(require("./models/billing-addon-template.model"), exports);
|
|
53
52
|
__exportStar(require("./models/billing-plan-request.model"), exports);
|
|
54
53
|
__exportStar(require("./models/billing-quota-cap.model"), exports);
|
|
55
54
|
__exportStar(require("./models/quota-reservation.model"), exports);
|
|
@@ -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,8EAA4D;AAC5D,kFAAgE;AAGhE,8DAA4C;AAC5C,0EAAwD;AACxD,qEAAmD;AAGnD,+DAA6C;AAC7C,iEAA+C;AAC/C,4EAA0D;AAC1D,4EAA0D;AAC1D,8DAA4C;AAC5C,yDAAuC;AACvC,oEAAkD;AAClD,iEAA+C;AAC/C,0EAAwD;AACxD,6DAA2C;AAC3C,
|
|
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,8EAA4D;AAC5D,kFAAgE;AAGhE,8DAA4C;AAC5C,0EAAwD;AACxD,qEAAmD;AAGnD,+DAA6C;AAC7C,iEAA+C;AAC/C,4EAA0D;AAC1D,4EAA0D;AAC1D,8DAA4C;AAC5C,yDAAuC;AACvC,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;AAGnD,qEAAmD;AAGnD,kEAAgD;AAGhD,iEAA+C"}
|
|
@@ -5,6 +5,7 @@ import { IPlanTemplate } from './plan-template.model';
|
|
|
5
5
|
import { IInvoice } from './invoice.model';
|
|
6
6
|
import { ICreditTransaction } from './credit-transaction.model';
|
|
7
7
|
import { IEurTransaction } from './eur-transaction.model';
|
|
8
|
+
import { IServiceQuota } from './organization-service-quota.model';
|
|
8
9
|
export interface IBillingAddress {
|
|
9
10
|
line1: string;
|
|
10
11
|
line2: string | null;
|
|
@@ -39,6 +40,7 @@ export interface IBillingAccount {
|
|
|
39
40
|
user?: IUser | null;
|
|
40
41
|
organization?: IOrganization | null;
|
|
41
42
|
planTemplate?: IPlanTemplate;
|
|
43
|
+
serviceQuotas?: IServiceQuota[];
|
|
42
44
|
invoices?: IInvoice[];
|
|
43
45
|
creditTransactions?: ICreditTransaction[];
|
|
44
46
|
eurTransactions?: IEurTransaction[];
|
|
@@ -26,7 +26,6 @@ export * from './credit-transaction.model';
|
|
|
26
26
|
export * from './eur-transaction.model';
|
|
27
27
|
export * from './organization-quota-alert.model';
|
|
28
28
|
export * from './quota-grant.model';
|
|
29
|
-
export * from './billing-addon-template.model';
|
|
30
29
|
export * from './billing-plan-request.model';
|
|
31
30
|
export * from './billing-quota-cap.model';
|
|
32
31
|
export * from './quota-reservation.model';
|
|
@@ -42,7 +42,6 @@ __exportStar(require("./credit-transaction.model"), exports);
|
|
|
42
42
|
__exportStar(require("./eur-transaction.model"), exports);
|
|
43
43
|
__exportStar(require("./organization-quota-alert.model"), exports);
|
|
44
44
|
__exportStar(require("./quota-grant.model"), exports);
|
|
45
|
-
__exportStar(require("./billing-addon-template.model"), exports);
|
|
46
45
|
__exportStar(require("./billing-plan-request.model"), exports);
|
|
47
46
|
__exportStar(require("./billing-quota-cap.model"), exports);
|
|
48
47
|
__exportStar(require("./quota-reservation.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,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,sDAAoC;AACpC
|
|
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,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,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;AAG5C,8DAA4C;AAG5C,2DAAyC;AAGzC,0DAAwC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BillingMetric, BillingService } from '../../enum';
|
|
1
|
+
import { BillingMetric, BillingService, QuotaCeilingMode } from '../../enum';
|
|
2
2
|
import { IBillingAccount } from './billing-account.model';
|
|
3
3
|
export interface IServiceQuota {
|
|
4
4
|
id?: string;
|
|
@@ -7,6 +7,8 @@ export interface IServiceQuota {
|
|
|
7
7
|
metric: BillingMetric;
|
|
8
8
|
limit: number;
|
|
9
9
|
isOverridden: boolean;
|
|
10
|
+
ceilingMode: QuotaCeilingMode;
|
|
11
|
+
ceilingValue: number | null;
|
|
10
12
|
updatedAt?: Date;
|
|
11
13
|
createdAt?: Date;
|
|
12
14
|
billingAccount?: IBillingAccount;
|
|
@@ -25,6 +25,8 @@ export interface IPlanTemplate {
|
|
|
25
25
|
overagePricing: IPlanOveragePricing[];
|
|
26
26
|
quotaAlertThresholds: number[];
|
|
27
27
|
stripePriceId: string | null;
|
|
28
|
+
ownerUserId?: string | null;
|
|
29
|
+
ownerOrganizationId?: string | null;
|
|
28
30
|
updatedAt?: Date;
|
|
29
31
|
createdAt?: Date;
|
|
30
32
|
}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import { BillingAccountStatus } from '../types/enum';
|
|
2
2
|
export declare const isSubscriptionExpired: (status: BillingAccountStatus) => boolean;
|
|
3
|
+
export interface ParsedQuotaUnit {
|
|
4
|
+
multiplier: number;
|
|
5
|
+
baseUnit: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const parseQuotaUnit: (unit: string | null | undefined) => ParsedQuotaUnit;
|
|
8
|
+
export interface ResolvedQuotaAmount {
|
|
9
|
+
amount: number;
|
|
10
|
+
baseUnit: string;
|
|
11
|
+
unlimited: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const resolveQuotaAmount: (limit: number, unit: string | null | undefined) => ResolvedQuotaAmount;
|
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSubscriptionExpired = void 0;
|
|
3
|
+
exports.resolveQuotaAmount = exports.parseQuotaUnit = exports.isSubscriptionExpired = void 0;
|
|
4
4
|
const enum_1 = require("../types/enum");
|
|
5
5
|
const isSubscriptionExpired = (status) => {
|
|
6
6
|
return status === enum_1.BillingAccountStatus.CANCELLED;
|
|
7
7
|
};
|
|
8
8
|
exports.isSubscriptionExpired = isSubscriptionExpired;
|
|
9
|
+
const parseQuotaUnit = (unit) => {
|
|
10
|
+
const raw = (unit ?? '').trim();
|
|
11
|
+
if (!raw) {
|
|
12
|
+
return { multiplier: 1, baseUnit: '' };
|
|
13
|
+
}
|
|
14
|
+
const kMatch = raw.match(/^(\d+)\s*k\s+(.+)$/i);
|
|
15
|
+
if (kMatch) {
|
|
16
|
+
return {
|
|
17
|
+
multiplier: parseInt(kMatch[1], 10) * 1_000,
|
|
18
|
+
baseUnit: kMatch[2].trim(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const millionMatch = raw.match(/^(?:(\d+)\s+)?million\s+(.+)$/i);
|
|
22
|
+
if (millionMatch) {
|
|
23
|
+
const factor = millionMatch[1] ? parseInt(millionMatch[1], 10) : 1;
|
|
24
|
+
return {
|
|
25
|
+
multiplier: factor * 1_000_000,
|
|
26
|
+
baseUnit: millionMatch[2].trim(),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const spacedMatch = raw.match(/^(\d{1,3}(?:\s\d{3})+)\s+(.+)$/);
|
|
30
|
+
if (spacedMatch) {
|
|
31
|
+
return {
|
|
32
|
+
multiplier: parseInt(spacedMatch[1].replace(/\s/g, ''), 10),
|
|
33
|
+
baseUnit: spacedMatch[2].trim(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return { multiplier: 1, baseUnit: raw };
|
|
37
|
+
};
|
|
38
|
+
exports.parseQuotaUnit = parseQuotaUnit;
|
|
39
|
+
const resolveQuotaAmount = (limit, unit) => {
|
|
40
|
+
const { multiplier, baseUnit } = (0, exports.parseQuotaUnit)(unit);
|
|
41
|
+
if (limit === -1) {
|
|
42
|
+
return { amount: -1, baseUnit, unlimited: true };
|
|
43
|
+
}
|
|
44
|
+
return { amount: limit * multiplier, baseUnit, unlimited: false };
|
|
45
|
+
};
|
|
46
|
+
exports.resolveQuotaAmount = resolveQuotaAmount;
|
|
9
47
|
//# sourceMappingURL=billing.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.utils.js","sourceRoot":"","sources":["../../src/utils/billing.utils.ts"],"names":[],"mappings":";;;AAAA,wCAAqD;AAK9C,MAAM,qBAAqB,GAAG,CAAC,MAA4B,EAAW,EAAE;IAC7E,OAAO,MAAM,KAAK,2BAAoB,CAAC,SAAS,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC"}
|
|
1
|
+
{"version":3,"file":"billing.utils.js","sourceRoot":"","sources":["../../src/utils/billing.utils.ts"],"names":[],"mappings":";;;AAAA,wCAAqD;AAK9C,MAAM,qBAAqB,GAAG,CAAC,MAA4B,EAAW,EAAE;IAC7E,OAAO,MAAM,KAAK,2BAAoB,CAAC,SAAS,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AA8BK,MAAM,cAAc,GAAG,CAAC,IAA+B,EAAmB,EAAE;IACjF,MAAM,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;IAGD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAChD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO;YACL,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;YAC3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K,GAAG,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpE,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ export * from './tracking.utils';
|
|
|
15
15
|
export * from './duration.utils';
|
|
16
16
|
export * from './time-period.utils';
|
|
17
17
|
export * from './billing.utils';
|
|
18
|
+
export * from './quota-ceiling.utils';
|
|
18
19
|
export * from './user-language.utils';
|
|
19
20
|
export * from './pricing-calculator.utils';
|
|
20
21
|
export * from './content-share-scope.utils';
|
|
21
22
|
export * from './invitation.utils';
|
|
22
23
|
export * from './resolve-user.utils';
|
|
24
|
+
export * from './pricing.utils';
|
package/dist/utils/index.js
CHANGED
|
@@ -31,9 +31,11 @@ __exportStar(require("./tracking.utils"), exports);
|
|
|
31
31
|
__exportStar(require("./duration.utils"), exports);
|
|
32
32
|
__exportStar(require("./time-period.utils"), exports);
|
|
33
33
|
__exportStar(require("./billing.utils"), exports);
|
|
34
|
+
__exportStar(require("./quota-ceiling.utils"), exports);
|
|
34
35
|
__exportStar(require("./user-language.utils"), exports);
|
|
35
36
|
__exportStar(require("./pricing-calculator.utils"), exports);
|
|
36
37
|
__exportStar(require("./content-share-scope.utils"), exports);
|
|
37
38
|
__exportStar(require("./invitation.utils"), exports);
|
|
38
39
|
__exportStar(require("./resolve-user.utils"), exports);
|
|
40
|
+
__exportStar(require("./pricing.utils"), exports);
|
|
39
41
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -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,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,uDAAqC"}
|
|
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,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,uDAAqC;AAIrC,kDAAgC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PriceTranche } from '../constants/metric-price-scale.constants';
|
|
2
|
+
import { BillingMetric } from '../types/enum/organization-billing.enum';
|
|
3
|
+
export declare const priceForQuantity: (scale: PriceTranche[], quantity: number) => number;
|
|
4
|
+
export declare const quantityForBudget: (scale: PriceTranche[], budgetCents: number) => number;
|
|
5
|
+
export declare const overageNanocentsPerUnit: (scale: PriceTranche[]) => number;
|
|
6
|
+
export declare const resolveOverageNanocentsPerUnit: (metric: BillingMetric) => number | null;
|
|
7
|
+
export declare const overageAmountCents: (nanocentsPerUnit: number, overageQuantity: number) => number;
|
|
8
|
+
export declare const overagePriceCents: (metric: BillingMetric, includedQuantity: number, overageQuantity: number) => number;
|
|
9
|
+
export interface PlanCapacityItem {
|
|
10
|
+
metric: BillingMetric;
|
|
11
|
+
includedQuantity: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const planCapacityValueCents: (items: PlanCapacityItem[]) => number;
|
|
14
|
+
export declare const planCapacityShare: (planPriceCents: number, items: PlanCapacityItem[]) => number;
|
|
15
|
+
export declare const formatNanoCentsAsEur: (nanocents: number) => string;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatNanoCentsAsEur = exports.planCapacityShare = exports.planCapacityValueCents = exports.overagePriceCents = exports.overageAmountCents = exports.resolveOverageNanocentsPerUnit = exports.overageNanocentsPerUnit = exports.quantityForBudget = exports.priceForQuantity = void 0;
|
|
4
|
+
const billing_catalog_constants_1 = require("../constants/billing-catalog.constants");
|
|
5
|
+
const metric_price_scale_constants_1 = require("../constants/metric-price-scale.constants");
|
|
6
|
+
const priceForQuantity = (scale, quantity) => {
|
|
7
|
+
if (!Number.isFinite(quantity) || quantity <= 0) {
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
let remaining = quantity;
|
|
11
|
+
let previousBound = 0;
|
|
12
|
+
let nanocents = 0;
|
|
13
|
+
for (const tranche of scale) {
|
|
14
|
+
const bound = tranche.upToQuantity ?? Number.POSITIVE_INFINITY;
|
|
15
|
+
const slice = Math.min(remaining, bound - previousBound);
|
|
16
|
+
if (slice > 0) {
|
|
17
|
+
nanocents += slice * tranche.nanocentsPerUnit;
|
|
18
|
+
remaining -= slice;
|
|
19
|
+
}
|
|
20
|
+
previousBound = bound;
|
|
21
|
+
if (remaining <= 0) {
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return Math.round(nanocents / metric_price_scale_constants_1.NANOCENTS_PER_CENT);
|
|
26
|
+
};
|
|
27
|
+
exports.priceForQuantity = priceForQuantity;
|
|
28
|
+
const quantityForBudget = (scale, budgetCents) => {
|
|
29
|
+
if (!Number.isFinite(budgetCents) || budgetCents <= 0) {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
let remainingNanocents = budgetCents * metric_price_scale_constants_1.NANOCENTS_PER_CENT;
|
|
33
|
+
let previousBound = 0;
|
|
34
|
+
let quantity = 0;
|
|
35
|
+
for (const tranche of scale) {
|
|
36
|
+
const bound = tranche.upToQuantity ?? Number.POSITIVE_INFINITY;
|
|
37
|
+
const width = bound - previousBound;
|
|
38
|
+
const trancheCost = width * tranche.nanocentsPerUnit;
|
|
39
|
+
if (Number.isFinite(width) && remainingNanocents >= trancheCost) {
|
|
40
|
+
quantity += width;
|
|
41
|
+
remainingNanocents -= trancheCost;
|
|
42
|
+
previousBound = bound;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
return quantity + Math.floor(remainingNanocents / tranche.nanocentsPerUnit);
|
|
46
|
+
}
|
|
47
|
+
return quantity;
|
|
48
|
+
};
|
|
49
|
+
exports.quantityForBudget = quantityForBudget;
|
|
50
|
+
const overageNanocentsPerUnit = (scale) => scale[0].nanocentsPerUnit * metric_price_scale_constants_1.OVERAGE_MULTIPLIER;
|
|
51
|
+
exports.overageNanocentsPerUnit = overageNanocentsPerUnit;
|
|
52
|
+
const resolveOverageNanocentsPerUnit = (metric) => {
|
|
53
|
+
const scale = metric_price_scale_constants_1.METRIC_PRICE_SCALE[metric];
|
|
54
|
+
if (scale) {
|
|
55
|
+
return (0, exports.overageNanocentsPerUnit)(scale);
|
|
56
|
+
}
|
|
57
|
+
const flat = billing_catalog_constants_1.DEFAULT_OVERAGE_BASE_RATES[metric];
|
|
58
|
+
return flat ? flat.rate * metric_price_scale_constants_1.NANOCENTS_PER_CENT : null;
|
|
59
|
+
};
|
|
60
|
+
exports.resolveOverageNanocentsPerUnit = resolveOverageNanocentsPerUnit;
|
|
61
|
+
const overageAmountCents = (nanocentsPerUnit, overageQuantity) => {
|
|
62
|
+
if (!Number.isFinite(nanocentsPerUnit) ||
|
|
63
|
+
!Number.isFinite(overageQuantity) ||
|
|
64
|
+
overageQuantity <= 0) {
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
return Math.round((overageQuantity * nanocentsPerUnit) / metric_price_scale_constants_1.NANOCENTS_PER_CENT);
|
|
68
|
+
};
|
|
69
|
+
exports.overageAmountCents = overageAmountCents;
|
|
70
|
+
const overagePriceCents = (metric, includedQuantity, overageQuantity) => {
|
|
71
|
+
const rate = (0, exports.resolveOverageNanocentsPerUnit)(metric);
|
|
72
|
+
if (rate === null || !Number.isFinite(includedQuantity)) {
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
return (0, exports.overageAmountCents)(rate, overageQuantity);
|
|
76
|
+
};
|
|
77
|
+
exports.overagePriceCents = overagePriceCents;
|
|
78
|
+
const planCapacityValueCents = (items) => items.reduce((total, item) => {
|
|
79
|
+
const scale = metric_price_scale_constants_1.METRIC_PRICE_SCALE[item.metric];
|
|
80
|
+
return scale ? total + (0, exports.priceForQuantity)(scale, item.includedQuantity) : total;
|
|
81
|
+
}, 0);
|
|
82
|
+
exports.planCapacityValueCents = planCapacityValueCents;
|
|
83
|
+
const planCapacityShare = (planPriceCents, items) => {
|
|
84
|
+
const value = (0, exports.planCapacityValueCents)(items);
|
|
85
|
+
if (planPriceCents <= 0) {
|
|
86
|
+
return value > 0 ? 1 : 0;
|
|
87
|
+
}
|
|
88
|
+
return value / planPriceCents;
|
|
89
|
+
};
|
|
90
|
+
exports.planCapacityShare = planCapacityShare;
|
|
91
|
+
const formatNanoCentsAsEur = (nanocents) => {
|
|
92
|
+
if (!Number.isFinite(nanocents)) {
|
|
93
|
+
return '0';
|
|
94
|
+
}
|
|
95
|
+
const euros = nanocents / metric_price_scale_constants_1.NANOCENTS_PER_CENT / 100;
|
|
96
|
+
return euros.toFixed(8).replace(/0+$/, '').replace(/\.$/, '');
|
|
97
|
+
};
|
|
98
|
+
exports.formatNanoCentsAsEur = formatNanoCentsAsEur;
|
|
99
|
+
//# sourceMappingURL=pricing.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing.utils.js","sourceRoot":"","sources":["../../src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AAK,CAAC,CAAC;IAC5C,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,KAAK,GAAG,cAAc,CAAC;AAChC,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B;AAWK,MAAM,oBAAoB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAChE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,KAAK,GAAG,SAAS,GAAG,iDAAkB,GAAG,GAAG,CAAC;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { QuotaCeilingMode } from '../types/enum';
|
|
2
|
+
export interface CeilingParams {
|
|
3
|
+
ceilingMode: QuotaCeilingMode;
|
|
4
|
+
ceilingValue: number | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const deriveCeilingParams: (totalReal: number | null, planLimitStored: number, scale: number, unlimited: boolean) => CeilingParams;
|
|
7
|
+
export interface EurToQuantityResult {
|
|
8
|
+
overStored: number;
|
|
9
|
+
totalStored: number;
|
|
10
|
+
totalReal: number;
|
|
11
|
+
}
|
|
12
|
+
export interface EurCeilingConverter {
|
|
13
|
+
eurToQuantity: (euroCents: number) => EurToQuantityResult;
|
|
14
|
+
quantityToEur: (totalReal: number) => number;
|
|
15
|
+
}
|
|
16
|
+
export declare const eurCeilingConversion: (planLimitStored: number, pricePerUnitCents: number, scale: number) => EurCeilingConverter;
|