@antelopejs/interface-dms-saas 0.3.0 → 0.4.1
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/README.md +75 -66
- package/dist/billing.d.ts +2 -0
- package/dist/billing.js +2 -1
- package/dist/billing.js.map +1 -1
- package/dist/db/models/billingSettings.model.d.ts +1 -0
- package/dist/db/models/creditNotes.model.d.ts +2 -0
- package/dist/db/models/creditNotes.model.js +9 -0
- package/dist/db/models/creditNotes.model.js.map +1 -1
- package/dist/db/models/features.model.d.ts +1 -0
- package/dist/db/models/invoices.model.d.ts +1 -0
- package/dist/db/models/legalDocuments.model.d.ts +1 -0
- package/dist/db/models/planMigrations.model.d.ts +6 -2
- package/dist/db/models/planMigrations.model.js +25 -8
- package/dist/db/models/planMigrations.model.js.map +1 -1
- package/dist/db/models/plans.model.d.ts +1 -0
- package/dist/db/models/platformNotes.model.d.ts +1 -0
- package/dist/db/models/refunds.model.d.ts +1 -0
- package/dist/db/models/segments.model.d.ts +8 -2
- package/dist/db/models/segments.model.js +14 -3
- package/dist/db/models/segments.model.js.map +1 -1
- package/dist/db/models/stripeWebhookEvents.model.d.ts +1 -0
- package/dist/db/models/tenantBillingInfo.model.d.ts +1 -0
- package/dist/db/models/tenantBillingState.model.d.ts +4 -2
- package/dist/db/models/tenantBillingState.model.js +47 -5
- package/dist/db/models/tenantBillingState.model.js.map +1 -1
- package/dist/db/models/tenantSubscriptions.model.d.ts +2 -0
- package/dist/db/models/tenantSubscriptions.model.js +6 -0
- package/dist/db/models/tenantSubscriptions.model.js.map +1 -1
- package/dist/db/models/trialConsumptions.model.d.ts +1 -0
- package/dist/db/models/userSegments.model.d.ts +3 -1
- package/dist/db/models/userSegments.model.js +2 -2
- package/dist/db/models/userSegments.model.js.map +1 -1
- package/dist/db/tables/billingSettings.table.d.ts +2 -1
- package/dist/db/tables/billingSettings.table.js +5 -1
- package/dist/db/tables/billingSettings.table.js.map +1 -1
- package/dist/db/tables/features.table.js +2 -0
- package/dist/db/tables/features.table.js.map +1 -1
- package/dist/db/tables/invoices.table.d.ts +6 -0
- package/dist/db/tables/invoices.table.js +24 -0
- package/dist/db/tables/invoices.table.js.map +1 -1
- package/dist/db/tables/legalDocuments.table.d.ts +8 -0
- package/dist/db/tables/legalDocuments.table.js +10 -1
- package/dist/db/tables/legalDocuments.table.js.map +1 -1
- package/dist/db/tables/planMigrations.table.d.ts +19 -1
- package/dist/db/tables/planMigrations.table.js +60 -1
- package/dist/db/tables/planMigrations.table.js.map +1 -1
- package/dist/db/tables/plans.table.d.ts +1 -0
- package/dist/db/tables/plans.table.js +2 -1
- package/dist/db/tables/plans.table.js.map +1 -1
- package/dist/db/tables/segments.table.d.ts +6 -0
- package/dist/db/tables/segments.table.js +8 -0
- package/dist/db/tables/segments.table.js.map +1 -1
- package/dist/db/tables/tenantBillingState.table.d.ts +48 -1
- package/dist/db/tables/tenantBillingState.table.js +100 -1
- package/dist/db/tables/tenantBillingState.table.js.map +1 -1
- package/dist/db/tables/tenantSubscriptions.table.d.ts +2 -0
- package/dist/db/tables/tenantSubscriptions.table.js +9 -0
- package/dist/db/tables/tenantSubscriptions.table.js.map +1 -1
- package/dist/page-definitions.d.ts +1 -8
- package/dist/page-definitions.js +1 -27
- package/dist/page-definitions.js.map +1 -1
- package/dist/pages.d.ts +1 -2
- package/dist/pages.js +13 -11
- package/dist/pages.js.map +1 -1
- package/dist/plans.d.ts +1 -1
- package/dist/plans.js +12 -2
- package/dist/plans.js.map +1 -1
- package/docs/1.index.md +47 -0
- package/docs/2.billing.md +66 -0
- package/docs/3.lifecycle-and-usage.md +95 -0
- package/docs/4.pages-plans-data.md +64 -0
- package/docs/tsconfig.json +11 -0
- package/package.json +24 -11
|
@@ -1,12 +1,59 @@
|
|
|
1
1
|
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
import type { PlanBillingMode, PlanInterval } from "./plans.table";
|
|
2
3
|
export declare const tenantBillingStateTableName = "tenant_billing_state";
|
|
3
4
|
export declare const BILLING_STATES: readonly ["free", "active", "trialing", "past_due", "suspended", "cancelled", "pending_payment"];
|
|
4
5
|
export type BillingState = (typeof BILLING_STATES)[number];
|
|
5
|
-
export declare
|
|
6
|
+
export declare const WORKSPACE_OWNER_STATUSES: readonly ["joined", "invited", "expired", "none"];
|
|
7
|
+
export type WorkspaceOwnerStatus = (typeof WORKSPACE_OWNER_STATUSES)[number];
|
|
8
|
+
export declare const WORKSPACE_RENEWAL_KINDS: readonly ["renews", "trial_ends", "free_until", "suspends", "suspended", "awaiting_payment", "deletes"];
|
|
9
|
+
export type WorkspaceRenewalKind = (typeof WORKSPACE_RENEWAL_KINDS)[number];
|
|
10
|
+
export interface WorkspaceDirectoryFields {
|
|
11
|
+
planId: string | null;
|
|
12
|
+
planName: string | null;
|
|
13
|
+
planInterval: PlanInterval | null;
|
|
14
|
+
planBillingMode: PlanBillingMode | null;
|
|
15
|
+
planUnitAmountMinor: number | null;
|
|
16
|
+
currency: string | null;
|
|
17
|
+
seats: number;
|
|
18
|
+
members: number;
|
|
19
|
+
pendingPlanId: string | null;
|
|
20
|
+
isComplimentary: boolean;
|
|
21
|
+
mrrMinor: number;
|
|
22
|
+
previousMrrMinor: number;
|
|
23
|
+
reportingMrr: number;
|
|
24
|
+
renewalKind: WorkspaceRenewalKind | null;
|
|
25
|
+
renewsAt: Date | null;
|
|
26
|
+
stateSince: Date | null;
|
|
27
|
+
ownerStatus: WorkspaceOwnerStatus;
|
|
28
|
+
ownerNeverJoined: boolean;
|
|
29
|
+
ownerName: string | null;
|
|
30
|
+
ownerEmail: string | null;
|
|
31
|
+
}
|
|
32
|
+
export declare class TenantBillingState extends Table implements WorkspaceDirectoryFields {
|
|
6
33
|
_id: string;
|
|
7
34
|
tenantId: string;
|
|
8
35
|
billingState: BillingState;
|
|
9
36
|
updatedAt: Date;
|
|
10
37
|
revision: string;
|
|
11
38
|
deletedAt: Date | null;
|
|
39
|
+
planId: string | null;
|
|
40
|
+
planName: string | null;
|
|
41
|
+
planInterval: PlanInterval | null;
|
|
42
|
+
planBillingMode: PlanBillingMode | null;
|
|
43
|
+
planUnitAmountMinor: number | null;
|
|
44
|
+
currency: string | null;
|
|
45
|
+
seats: number;
|
|
46
|
+
members: number;
|
|
47
|
+
pendingPlanId: string | null;
|
|
48
|
+
isComplimentary: boolean;
|
|
49
|
+
mrrMinor: number;
|
|
50
|
+
previousMrrMinor: number;
|
|
51
|
+
reportingMrr: number;
|
|
52
|
+
renewalKind: WorkspaceRenewalKind | null;
|
|
53
|
+
renewsAt: Date | null;
|
|
54
|
+
stateSince: Date | null;
|
|
55
|
+
ownerStatus: WorkspaceOwnerStatus;
|
|
56
|
+
ownerNeverJoined: boolean;
|
|
57
|
+
ownerName: string | null;
|
|
58
|
+
ownerEmail: string | null;
|
|
12
59
|
}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TenantBillingState = exports.BILLING_STATES = exports.tenantBillingStateTableName = void 0;
|
|
12
|
+
exports.TenantBillingState = exports.WORKSPACE_RENEWAL_KINDS = exports.WORKSPACE_OWNER_STATUSES = exports.BILLING_STATES = exports.tenantBillingStateTableName = void 0;
|
|
13
13
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
14
14
|
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
15
15
|
const tenants_table_1 = require("@antelopejs/interface-dms/db/tables/tenants.table");
|
|
@@ -23,6 +23,21 @@ exports.BILLING_STATES = [
|
|
|
23
23
|
"cancelled",
|
|
24
24
|
"pending_payment",
|
|
25
25
|
];
|
|
26
|
+
exports.WORKSPACE_OWNER_STATUSES = [
|
|
27
|
+
"joined",
|
|
28
|
+
"invited",
|
|
29
|
+
"expired",
|
|
30
|
+
"none",
|
|
31
|
+
];
|
|
32
|
+
exports.WORKSPACE_RENEWAL_KINDS = [
|
|
33
|
+
"renews",
|
|
34
|
+
"trial_ends",
|
|
35
|
+
"free_until",
|
|
36
|
+
"suspends",
|
|
37
|
+
"suspended",
|
|
38
|
+
"awaiting_payment",
|
|
39
|
+
"deletes",
|
|
40
|
+
];
|
|
26
41
|
let TenantBillingState = class TenantBillingState extends interface_database_decorators_1.Table {
|
|
27
42
|
};
|
|
28
43
|
exports.TenantBillingState = TenantBillingState;
|
|
@@ -53,6 +68,90 @@ __decorate([
|
|
|
53
68
|
(0, interface_database_decorators_1.Field)("date"),
|
|
54
69
|
__metadata("design:type", Object)
|
|
55
70
|
], TenantBillingState.prototype, "deletedAt", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, interface_database_decorators_1.Index)(),
|
|
73
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], TenantBillingState.prototype, "planId", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], TenantBillingState.prototype, "planName", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], TenantBillingState.prototype, "planInterval", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
86
|
+
__metadata("design:type", Object)
|
|
87
|
+
], TenantBillingState.prototype, "planBillingMode", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], TenantBillingState.prototype, "planUnitAmountMinor", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
94
|
+
__metadata("design:type", Object)
|
|
95
|
+
], TenantBillingState.prototype, "currency", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
98
|
+
__metadata("design:type", Number)
|
|
99
|
+
], TenantBillingState.prototype, "seats", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
102
|
+
__metadata("design:type", Number)
|
|
103
|
+
], TenantBillingState.prototype, "members", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, interface_database_decorators_1.Index)(),
|
|
106
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
107
|
+
__metadata("design:type", Object)
|
|
108
|
+
], TenantBillingState.prototype, "pendingPlanId", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, interface_database_decorators_1.Field)("boolean"),
|
|
111
|
+
__metadata("design:type", Boolean)
|
|
112
|
+
], TenantBillingState.prototype, "isComplimentary", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, interface_database_decorators_1.Index)(),
|
|
115
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
116
|
+
__metadata("design:type", Number)
|
|
117
|
+
], TenantBillingState.prototype, "mrrMinor", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
120
|
+
__metadata("design:type", Number)
|
|
121
|
+
], TenantBillingState.prototype, "previousMrrMinor", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
124
|
+
__metadata("design:type", Number)
|
|
125
|
+
], TenantBillingState.prototype, "reportingMrr", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], TenantBillingState.prototype, "renewalKind", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, interface_database_decorators_1.Index)(),
|
|
132
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
133
|
+
__metadata("design:type", Object)
|
|
134
|
+
], TenantBillingState.prototype, "renewsAt", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
137
|
+
__metadata("design:type", Object)
|
|
138
|
+
], TenantBillingState.prototype, "stateSince", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
141
|
+
__metadata("design:type", String)
|
|
142
|
+
], TenantBillingState.prototype, "ownerStatus", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, interface_database_decorators_1.Field)("boolean"),
|
|
145
|
+
__metadata("design:type", Boolean)
|
|
146
|
+
], TenantBillingState.prototype, "ownerNeverJoined", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
149
|
+
__metadata("design:type", Object)
|
|
150
|
+
], TenantBillingState.prototype, "ownerName", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
153
|
+
__metadata("design:type", Object)
|
|
154
|
+
], TenantBillingState.prototype, "ownerEmail", void 0);
|
|
56
155
|
exports.TenantBillingState = TenantBillingState = __decorate([
|
|
57
156
|
(0, interface_database_decorators_1.RegisterTable)(exports.tenantBillingStateTableName, constants_1.CORE_SCHEMA_NAME)
|
|
58
157
|
], TenantBillingState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenantBillingState.table.js","sourceRoot":"","sources":["../../../src/db/tables/tenantBillingState.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAMmD;AACnD,mEAAuE;AACvE,qFAA2E;
|
|
1
|
+
{"version":3,"file":"tenantBillingState.table.js","sourceRoot":"","sources":["../../../src/db/tables/tenantBillingState.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAMmD;AACnD,mEAAuE;AACvE,qFAA2E;AAG9D,QAAA,2BAA2B,GAAG,sBAAsB,CAAC;AAErD,QAAA,c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C;;iDACM;AAGd;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;mDACQ;AAIhB;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;yDACqB;AAG7B;IADP,IAAA,qCAAK,EAAC,SAAS,CAAC;;2DACgB;AAIzB;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;oDACS;AAGjB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;4DACiB;AAGzB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;wDACa;AAGrB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;uDACiC;AAIzC;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,MAAM,CAAC;;oDACgB;AAGtB;IADP,IAAA,qCAAK,EAAC,MAAM,CAAC;;sDACkB;AAGxB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;uDAC0B;AAGlC;IADP,IAAA,qCAAK,EAAC,SAAS,CAAC;;4DACiB;AAG1B;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;qDACiB;AAGzB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;sDACkB;6BAxFvB,kBAAkB;IAD9B,IAAA,6CAAa,EAAC,mCAA2B,EAAE,4BAAgB,CAAC;GAChD,kBAAkB,CAyF9B"}
|
|
@@ -36,6 +36,8 @@ export declare class TenantSubscription extends Table {
|
|
|
36
36
|
revision: string;
|
|
37
37
|
createdBy: string | null;
|
|
38
38
|
refundRequestedAt: Date | null;
|
|
39
|
+
deletionRequestedAt: Date | null;
|
|
40
|
+
deletionRequestedBy: string | null;
|
|
39
41
|
pastDueSince: Date | null;
|
|
40
42
|
freeUntil: Date | null;
|
|
41
43
|
isComplimentary: boolean;
|
|
@@ -92,6 +92,7 @@ __decorate([
|
|
|
92
92
|
__metadata("design:type", Object)
|
|
93
93
|
], TenantSubscription.prototype, "currentPeriodEnd", void 0);
|
|
94
94
|
__decorate([
|
|
95
|
+
(0, interface_database_decorators_1.Index)({ crossInstance: true }),
|
|
95
96
|
(0, interface_database_decorators_1.Field)("string"),
|
|
96
97
|
(0, interface_database_decorators_1.Relation)({ to: () => plans_table_1.Plan }),
|
|
97
98
|
__metadata("design:type", Object)
|
|
@@ -117,6 +118,14 @@ __decorate([
|
|
|
117
118
|
(0, interface_database_decorators_1.Field)("date"),
|
|
118
119
|
__metadata("design:type", Object)
|
|
119
120
|
], TenantSubscription.prototype, "refundRequestedAt", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
123
|
+
__metadata("design:type", Object)
|
|
124
|
+
], TenantSubscription.prototype, "deletionRequestedAt", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
127
|
+
__metadata("design:type", Object)
|
|
128
|
+
], TenantSubscription.prototype, "deletionRequestedBy", void 0);
|
|
120
129
|
__decorate([
|
|
121
130
|
(0, exports.DunningClock)(),
|
|
122
131
|
(0, interface_database_decorators_1.Index)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenantSubscriptions.table.js","sourceRoot":"","sources":["../../../src/db/tables/tenantSubscriptions.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sEAA8E;AAC9E,6FAUmD;AACnD,mEAAyE;AACzE,sFAA4E;AAC5E,+CAAqC;AAExB,QAAA,4BAA4B,GAAG,sBAAsB,CAAC;AAEtD,QAAA,4BAA4B,GAAG;IAC1C,iBAAiB;IACjB,QAAQ;IACR,UAAU;IACV,UAAU;IACV,WAAW;IACX,WAAW;CACH,CAAC;AA4BX,MAAM,eAAe,GAA6B,UAAU,CAAC;AAO7D,MAAM,oBAAqB,SAAQ,wCAAQ;IACzC,MAAM,CAAC,MAAyB,EAAE,KAAa;QAC7C,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO;QACxC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS;YAAE,OAAO;QACxC,IAAI,MAAM,CAAC,MAAM,KAAK,eAAe,EAAE,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AAoBY,QAAA,YAAY,GAAG,IAAA,kCAAqB,EAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;IACvE,8CAAsC,CACrC,MAAM,CAAC,WAA+B,EACtC,oBAAoB,EACpB,WAAqB,EACrB,EAAE,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAII,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,qCAAK;
|
|
1
|
+
{"version":3,"file":"tenantSubscriptions.table.js","sourceRoot":"","sources":["../../../src/db/tables/tenantSubscriptions.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sEAA8E;AAC9E,6FAUmD;AACnD,mEAAyE;AACzE,sFAA4E;AAC5E,+CAAqC;AAExB,QAAA,4BAA4B,GAAG,sBAAsB,CAAC;AAEtD,QAAA,4BAA4B,GAAG;IAC1C,iBAAiB;IACjB,QAAQ;IACR,UAAU;IACV,UAAU;IACV,WAAW;IACX,WAAW;CACH,CAAC;AA4BX,MAAM,eAAe,GAA6B,UAAU,CAAC;AAO7D,MAAM,oBAAqB,SAAQ,wCAAQ;IACzC,MAAM,CAAC,MAAyB,EAAE,KAAa;QAC7C,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO;QACxC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS;YAAE,OAAO;QACxC,IAAI,MAAM,CAAC,MAAM,KAAK,eAAe,EAAE,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AAoBY,QAAA,YAAY,GAAG,IAAA,kCAAqB,EAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;IACvE,8CAAsC,CACrC,M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/page";
|
|
2
2
|
interface SaasModuleDefinition {
|
|
3
3
|
fullId: string;
|
|
4
4
|
fullSlug: string;
|
|
5
5
|
registration: ModuleInfo;
|
|
6
6
|
}
|
|
7
|
-
interface WorkspaceSettingsCategoryDefinition extends Omit<MenuOptions, "category" | "module"> {
|
|
8
|
-
id: string;
|
|
9
|
-
fullId: string;
|
|
10
|
-
fullSlug: string;
|
|
11
|
-
}
|
|
12
7
|
export declare const MODULES_ROOT_DEFINITION: PageInfo;
|
|
13
|
-
export declare const SETTINGS_ROOT_DEFINITION: PageInfo;
|
|
14
8
|
export declare const SAAS_MODULE_ID = "saas";
|
|
15
9
|
export declare const SAAS_MODULE_DEFINITION: SaasModuleDefinition;
|
|
16
|
-
export declare const WORKSPACE_SETTINGS_CATEGORY_DEFINITION: WorkspaceSettingsCategoryDefinition;
|
|
17
10
|
export {};
|
package/dist/page-definitions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SAAS_MODULE_DEFINITION = exports.SAAS_MODULE_ID = exports.MODULES_ROOT_DEFINITION = void 0;
|
|
4
4
|
exports.MODULES_ROOT_DEFINITION = {
|
|
5
5
|
id: "modules",
|
|
6
6
|
fullId: "modules",
|
|
@@ -19,23 +19,6 @@ exports.MODULES_ROOT_DEFINITION = {
|
|
|
19
19
|
authOnly: undefined,
|
|
20
20
|
bypassTenantAccessGate: undefined,
|
|
21
21
|
};
|
|
22
|
-
exports.SETTINGS_ROOT_DEFINITION = {
|
|
23
|
-
id: "settings",
|
|
24
|
-
fullId: "settings",
|
|
25
|
-
fullSlug: "/settings",
|
|
26
|
-
layoutUrl: "/settings/pagelayout",
|
|
27
|
-
category: undefined,
|
|
28
|
-
displayName: "$page.settings.title",
|
|
29
|
-
description: "$page.settings.intro",
|
|
30
|
-
urlSlug: "/settings",
|
|
31
|
-
icon: "i-ph-gear",
|
|
32
|
-
order: 3,
|
|
33
|
-
noComponentPermissions: true,
|
|
34
|
-
hidden: undefined,
|
|
35
|
-
publicAccess: undefined,
|
|
36
|
-
authOnly: undefined,
|
|
37
|
-
bypassTenantAccessGate: undefined,
|
|
38
|
-
};
|
|
39
22
|
exports.SAAS_MODULE_ID = "saas";
|
|
40
23
|
exports.SAAS_MODULE_DEFINITION = {
|
|
41
24
|
fullId: `${exports.MODULES_ROOT_DEFINITION.fullId}.${exports.SAAS_MODULE_ID}`,
|
|
@@ -48,13 +31,4 @@ exports.SAAS_MODULE_DEFINITION = {
|
|
|
48
31
|
landingPage: "dashboard",
|
|
49
32
|
},
|
|
50
33
|
};
|
|
51
|
-
exports.WORKSPACE_SETTINGS_CATEGORY_DEFINITION = {
|
|
52
|
-
id: "workspace",
|
|
53
|
-
fullId: `${exports.SETTINGS_ROOT_DEFINITION.fullId}.workspace`,
|
|
54
|
-
fullSlug: `${exports.SETTINGS_ROOT_DEFINITION.fullSlug}/workspace`,
|
|
55
|
-
displayName: "$saas.workspace.settings.title",
|
|
56
|
-
urlSlug: "workspace",
|
|
57
|
-
icon: "i-ph-buildings",
|
|
58
|
-
order: 2,
|
|
59
|
-
};
|
|
60
34
|
//# sourceMappingURL=page-definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-definitions.js","sourceRoot":"","sources":["../src/page-definitions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"page-definitions.js","sourceRoot":"","sources":["../src/page-definitions.ts"],"names":[],"mappings":";;;AAQa,QAAA,uBAAuB,GAAa;IAC/C,EAAE,EAAE,SAAS;IACb,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,qBAAqB;IAChC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,CAAC;IACR,sBAAsB,EAAE,IAAI;IAC5B,YAAY,EAAE,IAAI;IAClB,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,SAAS;IACvB,QAAQ,EAAE,SAAS;IACnB,sBAAsB,EAAE,SAAS;CAClC,CAAC;AAEW,QAAA,cAAc,GAAG,MAAM,CAAC;AAExB,QAAA,sBAAsB,GAAyB;IAC1D,MAAM,EAAE,GAAG,+BAAuB,CAAC,MAAM,IAAI,sBAAc,EAAE;IAC7D,QAAQ,EAAE,GAAG,+BAAuB,CAAC,QAAQ,IAAI,sBAAc,EAAE;IACjE,YAAY,EAAE;QACZ,EAAE,EAAE,sBAAc;QAClB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,WAAW;KACzB;CACF,CAAC"}
|
package/dist/pages.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Component, PlacementSide } from "@antelopejs/interface-dms/component";
|
|
2
2
|
import { type CategoryInfo, type PageExtensionComponent } from "@antelopejs/interface-dms/page";
|
|
3
|
-
export declare const workspaceSettingsCategory: CategoryInfo;
|
|
4
|
-
export declare const GetWorkspaceSettingsCategory: () => Promise<CategoryInfo>;
|
|
5
3
|
export declare const tenantBillingPage: {
|
|
6
4
|
readonly id: "billing";
|
|
7
5
|
readonly fullId: "settings.workspace.billing";
|
|
@@ -17,6 +15,7 @@ export declare const tenantBillingPage: {
|
|
|
17
15
|
};
|
|
18
16
|
};
|
|
19
17
|
export type TenantBillingPageComponentKey = (typeof tenantBillingPage.components)[keyof typeof tenantBillingPage.components];
|
|
18
|
+
export declare const tenantBillingPageAnchorPaths: Readonly<Record<TenantBillingPageComponentKey, readonly string[]>>;
|
|
20
19
|
export interface TenantBillingPageExtensionComponentBase {
|
|
21
20
|
key: string;
|
|
22
21
|
component: Component;
|
package/dist/pages.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.platformWorkspaceDetailPage = exports.GetPlatformSaasModule = exports.platformSaasModule = exports.
|
|
3
|
+
exports.platformWorkspaceDetailPage = exports.GetPlatformSaasModule = exports.platformSaasModule = exports.tenantBillingPageAnchorPaths = exports.tenantBillingPage = void 0;
|
|
4
4
|
exports.RegisterTenantBillingPageExtension = RegisterTenantBillingPageExtension;
|
|
5
5
|
exports.RegisterPlatformWorkspaceDetailPageExtension = RegisterPlatformWorkspaceDetailPageExtension;
|
|
6
6
|
const interface_core_1 = require("@antelopejs/interface-core");
|
|
7
7
|
const page_1 = require("@antelopejs/interface-dms/page");
|
|
8
8
|
const page_definitions_1 = require("./page-definitions");
|
|
9
|
-
exports.workspaceSettingsCategory = {
|
|
10
|
-
...page_definitions_1.WORKSPACE_SETTINGS_CATEGORY_DEFINITION,
|
|
11
|
-
category: page_definitions_1.SETTINGS_ROOT_DEFINITION,
|
|
12
|
-
urlTransparent: false,
|
|
13
|
-
hidden: undefined,
|
|
14
|
-
bypassTenantAccessGate: undefined,
|
|
15
|
-
};
|
|
16
|
-
exports.GetWorkspaceSettingsCategory = (0, interface_core_1.InterfaceFunction)();
|
|
17
9
|
exports.tenantBillingPage = {
|
|
18
10
|
id: "billing",
|
|
19
11
|
fullId: "settings.workspace.billing",
|
|
@@ -28,6 +20,15 @@ exports.tenantBillingPage = {
|
|
|
28
20
|
table: "table",
|
|
29
21
|
},
|
|
30
22
|
};
|
|
23
|
+
exports.tenantBillingPageAnchorPaths = {
|
|
24
|
+
freeAccessBanner: ["freeAccessBanner"],
|
|
25
|
+
pastDueAlert: ["pastDueAlert"],
|
|
26
|
+
planCard: ["overview", "plan", "current", "planCard"],
|
|
27
|
+
paymentMethod: ["overview", "payment", "method", "paymentMethod"],
|
|
28
|
+
refundButton: ["overview", "payment", "guarantee", "refundButton"],
|
|
29
|
+
billingForm: ["billingForm"],
|
|
30
|
+
table: ["invoices", "table"],
|
|
31
|
+
};
|
|
31
32
|
exports.platformSaasModule = {
|
|
32
33
|
id: page_definitions_1.SAAS_MODULE_DEFINITION.registration.id,
|
|
33
34
|
fullId: page_definitions_1.SAAS_MODULE_DEFINITION.fullId,
|
|
@@ -59,8 +60,9 @@ function toPageExtensionComponent(input) {
|
|
|
59
60
|
side: input.side ?? "end",
|
|
60
61
|
order: input.order ?? 0,
|
|
61
62
|
};
|
|
62
|
-
if (input.anchorKey)
|
|
63
|
-
component.anchorPath = [input.anchorKey];
|
|
63
|
+
if (input.anchorKey) {
|
|
64
|
+
component.anchorPath = exports.tenantBillingPageAnchorPaths[input.anchorKey];
|
|
65
|
+
}
|
|
64
66
|
return component;
|
|
65
67
|
}
|
|
66
68
|
function RegisterTenantBillingPageExtension(extension) {
|
package/dist/pages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":";;;AA2JA,gFAYC;AAGD,oGAYC;AAtLD,+DAA+D;AAK/D,yDAKwC;AACxC,yDAG4B;AAGf,QAAA,iBAAiB,GAAG;IAC/B,EAAE,EAAE,SAAS;IACb,MAAM,EAAE,4BAA4B;IACpC,QAAQ,EAAE,6BAA6B;IACvC,UAAU,EAAE;QACV,gBAAgB,EAAE,kBAAkB;QACpC,YAAY,EAAE,cAAc;QAC5B,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,eAAe;QAC9B,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,cAAc;QAC5B,KAAK,EAAE,OAAO;KACf;CACO,CAAC;AAcE,QAAA,4BAA4B,GAErC;IACF,gBAAgB,EAAE,CAAC,kBAAkB,CAAC;IACtC,YAAY,EAAE,CAAC,cAAc,CAAC;IAC9B,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,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C;KACxB,CAAC;IACF,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,SAAS,CAAC,UAAU,GAAG,oCAA4B,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAMD,SAAgB,kCAAkC,CAChD,SAAqC;IAErC,MAAM,IAAI,GAAsB;QAC9B,aAAa,EAAE,SAAS,CAAC,IAAI;QAC7B,YAAY,EAAE,yBAAiB,CAAC,MAAM;QACtC,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,wBAAwB,CAAC;KAC/D,CAAC;IACF,eAAY,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO;QACL,UAAU,EAAE,GAAG,EAAE,CAAC,eAAY,CAAC,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC;KACtE,CAAC;AACJ,CAAC;AAGD,SAAgB,4CAA4C,CAC1D,SAA+C;IAE/C,MAAM,IAAI,GAAsB;QAC9B,aAAa,EAAE,SAAS,CAAC,IAAI;QAC7B,YAAY,EAAE,mCAA2B,CAAC,MAAM;QAChD,UAAU,EAAE,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC;KACtC,CAAC;IACF,eAAY,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO;QACL,UAAU,EAAE,GAAG,EAAE,CAAC,eAAY,CAAC,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC;KACtE,CAAC;AACJ,CAAC"}
|
package/dist/plans.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface TenantPlanCatalog {
|
|
|
23
23
|
features: TenantPlanFeature[];
|
|
24
24
|
}
|
|
25
25
|
export declare function monthlyPrice(plan: Plan): number;
|
|
26
|
-
export declare function isDowngrade(current: Plan | null, target: Plan): boolean;
|
|
26
|
+
export declare function isDowngrade(current: Plan | null, target: Plan, seats?: number): boolean;
|
|
27
27
|
export declare const FEATURE_LOCALIZED_FIELDS: Array<keyof Feature>;
|
|
28
28
|
export declare function localizeFeature(feature: Feature, locale: string): Feature;
|
|
29
29
|
export declare function buildTenantPlanCatalog(planModel: PlanModel, featureModel: FeatureModel, plans: Plan[], locale: string): Promise<TenantPlanCatalog>;
|
package/dist/plans.js
CHANGED
|
@@ -13,14 +13,24 @@ const MONTHS_PER_INTERVAL = {
|
|
|
13
13
|
function monthlyPrice(plan) {
|
|
14
14
|
return plan.price / MONTHS_PER_INTERVAL[plan.interval];
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const SEAT_BILLING_MODE = "seat";
|
|
17
|
+
const MIN_BILLED_SEATS = 1;
|
|
18
|
+
function monthlyCost(plan, seats) {
|
|
19
|
+
const units = plan.billingMode === SEAT_BILLING_MODE
|
|
20
|
+
? Math.max(MIN_BILLED_SEATS, seats)
|
|
21
|
+
: 1;
|
|
22
|
+
return monthlyPrice(plan) * units;
|
|
23
|
+
}
|
|
24
|
+
function isDowngrade(current, target, seats = MIN_BILLED_SEATS) {
|
|
17
25
|
if (!current)
|
|
18
26
|
return false;
|
|
19
|
-
return
|
|
27
|
+
return monthlyCost(target, seats) < monthlyCost(current, seats);
|
|
20
28
|
}
|
|
21
29
|
exports.FEATURE_LOCALIZED_FIELDS = [
|
|
22
30
|
"displayName",
|
|
31
|
+
"description",
|
|
23
32
|
"tooltip",
|
|
33
|
+
"unit",
|
|
24
34
|
];
|
|
25
35
|
function localizeFeature(feature, locale) {
|
|
26
36
|
return feature.localize(locale, exports.FEATURE_LOCALIZED_FIELDS);
|
package/dist/plans.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../src/plans.ts"],"names":[],"mappings":";;;AA6CA,oCAEC;
|
|
1
|
+
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../src/plans.ts"],"names":[],"mappings":";;;AA6CA,oCAEC;AAsBD,kCAOC;AAmBD,0CAEC;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AAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAClE,CAAC;IACF,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC5D,QAAQ,EAAE,QAAQ;aACf,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;aACjE,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;KACnD,CAAC;AACJ,CAAC"}
|
package/docs/1.index.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SaaS interface
|
|
3
|
+
description: Supported backend imports and side-effect boundaries for modules extending DMS SaaS.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SaaS interface
|
|
7
|
+
|
|
8
|
+
Consumers depend on `@antelopejs/interface-dms-saas`, not the runtime's private services or page controllers. Load `@antelopejs/dms-saas` in the same AntelopeJS project for functions that need an implementation. Compile with `moduleResolution: "bundler"`, `"node16"` or `"nodenext"` so subpaths resolve through the package's exports map.
|
|
9
|
+
|
|
10
|
+
## Entry points
|
|
11
|
+
|
|
12
|
+
| Import after `@antelopejs/interface-dms-saas` | Contract |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| Root | Billing, data API, pages, plans, provisioning and registration exports; `invoiceLineItems` and `workspaceLifecycle` namespaces |
|
|
15
|
+
| `/billing` | [Balances, previews and billing-state recomputation](./2.billing.md) |
|
|
16
|
+
| `/invoice-line-items` | [Usage providers, line types and key helpers](./3.lifecycle-and-usage.md#invoice-line-items) |
|
|
17
|
+
| `/workspace-lifecycle` | [Durable lifecycle consumers and provisioning gate](./3.lifecycle-and-usage.md#workspace-lifecycle) |
|
|
18
|
+
| `/provisioning`, `/registration` | [Provisioning payload and registration limits](./3.lifecycle-and-usage.md#registration-and-provisioning) |
|
|
19
|
+
| `/pages`, `/page-definitions` | [Page descriptors and extension registration](./4.pages-plans-data.md#page-extensions) |
|
|
20
|
+
| `/plans` | [Plan projections, localization and pricing helpers](./4.pages-plans-data.md#plan-helpers) |
|
|
21
|
+
| `/data-api`, `/hidden-filter` | [HiddenStringFilter](./4.pages-plans-data.md#hiddenstringfilter) |
|
|
22
|
+
| `/db`, `/db/models`, `/db/tables` | Canonical SaaS models and table classes; see the data boundary below |
|
|
23
|
+
|
|
24
|
+
`invoiceLineItems` and `workspaceLifecycle` are namespaces at the root, not flat exports. Use their direct subpaths for individual functions. Their `internal` proxy namespaces are implementation plumbing, not consumer APIs.
|
|
25
|
+
|
|
26
|
+
```ts docs-check
|
|
27
|
+
import { invoiceLineItems, workspaceLifecycle } from "@antelopejs/interface-dms-saas";
|
|
28
|
+
|
|
29
|
+
export const usageKey = invoiceLineItems.buildInvoiceLineKey("example.compute", "minutes");
|
|
30
|
+
|
|
31
|
+
export async function mayProvision(tenantId: string): Promise<boolean> {
|
|
32
|
+
// Errors propagate: unavailable storage must not grant eligibility.
|
|
33
|
+
return workspaceLifecycle.IsWorkspaceProvisioningCommitted(tenantId);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Database imports have side effects
|
|
38
|
+
|
|
39
|
+
The root does not re-export `db`. Importing `/db` registers the canonical SaaS tables; do not create duplicate table definitions or load the runtime's registration graph to reach them. Prefer `import type` when only a type is needed. The root also exports plan helpers that import database values, so do not assume that a root value import avoids all transitive table registration. Narrow subpaths express which contract the consumer needs.
|
|
40
|
+
|
|
41
|
+
Database exports are persistence primitives, not an authorization or billing-service API. Use tenant-scoped models with the correct tenant, and keep direct writes in trusted import/seed code. Direct writes do not automatically perform all Stripe, lifecycle, cache and directory work of the runtime's normal operations.
|
|
42
|
+
|
|
43
|
+
After seeding or importing subscription records, call [RecomputeTenantBillingState](./2.billing.md#recomputetenantbillingstate) for each affected tenant once writes finish. This republishes derived billing and directory state; it does not make an arbitrary direct write equivalent to a normal billing operation. When seeding plans, leave `Plan.paymentProviderRefs` empty and never overwrite the runtime's Stripe linkage. See the [plan and Stripe guide](/docs/modules/saas/stripe#plans-and-stripe).
|
|
44
|
+
|
|
45
|
+
`workspaceSettingsCategory` belongs to `@antelopejs/interface-dms/page`, not this package. There is no SaaS `GetWorkspaceSettingsCategory` export. Use `/pages` for SaaS billing and platform-workspace extension anchors.
|
|
46
|
+
|
|
47
|
+
The [runtime guide](/docs/modules/saas/extending) covers installation, public screens, UI integration and examples. These pages define the backend consumer contracts.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Billing
|
|
3
|
+
description: Authorized customer balances and invoice previews, and republishing derived billing state after direct writes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Billing
|
|
7
|
+
|
|
8
|
+
Import these functions and types from `@antelopejs/interface-dms-saas/billing` or the package root.
|
|
9
|
+
|
|
10
|
+
## GetTenantCustomerBalance
|
|
11
|
+
|
|
12
|
+
`GetTenantCustomerBalance(scope: TenantCustomerBalanceScope): Promise<TenantCustomerBalance>` takes `{ tenantId: string, userId: string }` from a trusted authentication boundary. It requires membership and a successful tenant access gate; it rejects unauthorized callers with 403. It does not trust a supplied user ID as proof of authentication.
|
|
13
|
+
|
|
14
|
+
| Result | Fields |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `AvailableTenantCustomerBalance` | `status: "available"`, `balanceMinorUnits: number`, `currency: string` |
|
|
17
|
+
| `AbsentTenantCustomerBalance` | `status: "absent"`, `reason: TenantCustomerBalanceAbsenceReason`, `balanceMinorUnits: null`, `currency: null` |
|
|
18
|
+
|
|
19
|
+
Amounts are Stripe minor units: negative means customer credit, positive means money owed, and zero means settled. Currency is uppercase ISO 4217. Absence reasons are `complimentary`, `customer_not_configured`, `customer_deleted`, and `currency_unavailable`. Stripe read failures reject with 502 and `saas.errors.billing.customer_balance_provider_unavailable`; they are not an absent balance. This call does not charge or refund the customer.
|
|
20
|
+
|
|
21
|
+
`isComplimentarySubscription(subscription: ComplimentarySubscriptionState | null | undefined): boolean` is a synchronous helper. `ComplimentarySubscriptionState` has `isComplimentary?: boolean | null`; only an explicit `true` returns true. A free plan alone is not the complimentary marker.
|
|
22
|
+
|
|
23
|
+
## GetUpcomingInvoicePreview
|
|
24
|
+
|
|
25
|
+
`GetUpcomingInvoicePreview(scope: UpcomingInvoicePreviewScope): Promise<UpcomingInvoicePreview>` uses the same `{ tenantId, userId }` scope and authorization checks. Stripe failures become an `unavailable` result rather than an invented total; authentication, implementation availability or local storage failures can still reject.
|
|
26
|
+
|
|
27
|
+
| `status` | Result type and reason |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `available` | `AvailableUpcomingInvoicePreview`: Stripe priced the next invoice |
|
|
30
|
+
| `absent` | `AbsentUpcomingInvoicePreview`: `complimentary`, `free_plan`, `customer_not_configured`, `subscription_not_configured`, or `no_upcoming_invoice` |
|
|
31
|
+
| `unavailable` | `UnavailableUpcomingInvoicePreview`: `stripe_not_configured`, `tax_not_configured`, `tax_location_invalid`, `tax_location_required`, `tax_calculation_failed`, `usage_unavailable`, or `provider_error` |
|
|
32
|
+
|
|
33
|
+
Both non-available variants have `reason` and `computedAt: string`. The corresponding exported unions are `UpcomingInvoicePreviewAbsenceReason` and `UpcomingInvoicePreviewUnavailableReason`.
|
|
34
|
+
|
|
35
|
+
An available preview includes these fields. All amounts are integers in the minor units of its uppercase `currency`; all dates are ISO 8601 strings.
|
|
36
|
+
|
|
37
|
+
| Fields | Type and meaning |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| `subtotalMinorUnits`, `totalExcludingTaxMinorUnits`, `taxMinorUnits`, `totalMinorUnits`, `amountDueMinorUnits` | `number`: subtotal before discounts/tax; total after discounts before tax; tax; tax-inclusive total; amount after customer balance |
|
|
40
|
+
| `lines`, `hasMoreLines` | `UpcomingInvoiceLine[]`, `boolean`: line page and truncation flag; totals remain complete |
|
|
41
|
+
| `taxes`, `taxCountry`, `isReverseCharge` | `UpcomingInvoiceTax[]`, `string \| null`, `boolean` |
|
|
42
|
+
| `periodStart`, `periodEnd`, `billingDate`, `computedAt` | `string`: cycle bounds, issue date and computation time |
|
|
43
|
+
| `usageThrough` | `string \| null`: end of quoted usage, null without usage lines |
|
|
44
|
+
|
|
45
|
+
`UpcomingInvoiceLine` has `kind: UpcomingInvoiceLineKind` (`subscription`, `usage`, or `invoice_item`), `description: string | null`, `amountMinorUnits: number`, `taxMinorUnits: number`, `quantity: number | null`, `periodStart: string`, `periodEnd: string`, `isProration: boolean`, `usageLineKey: string | null`, and `productId: string | null`. Usage keys are `<provider id>:<key>`; other line kinds have a null usage key.
|
|
46
|
+
|
|
47
|
+
`UpcomingInvoiceTax` has `amountMinorUnits: number`, `taxableAmountMinorUnits: number | null`, `isInclusive: boolean`, `ratePercentage: number | null`, `isReverseCharge: boolean`, and nullable string fields `country`, `taxType`, `displayName`, `jurisdiction`, and `taxabilityReason`. A reverse charge can produce zero tax with `isReverseCharge: true`.
|
|
48
|
+
|
|
49
|
+
The preview calls usage providers with `isPreview: true` and can populate a tenant-level shared database cache. It never creates an invoice or charges quoted lines. Usage covers the running cycle so far, not its final total; display `computedAt`. A missing payment method does not itself prevent previewing. Cache lifetime, invalidation and Stripe read timeouts are [runtime configuration](/docs/modules/saas/extending#upcoming-invoice-preview).
|
|
50
|
+
|
|
51
|
+
## RecomputeTenantBillingState
|
|
52
|
+
|
|
53
|
+
`RecomputeTenantBillingState(tenantId: string): Promise<void>` republishes the tenant's billing state and workspace directory fields, including plan, seats, MRR, renewal and owner, from current records. Call it after a seed or import finishes direct writes. Normal runtime billing operations already do this.
|
|
54
|
+
|
|
55
|
+
This is a trusted administrative call with no user scope or membership check. Authorize the tenant before invoking it. It writes derived database state, does not mutate the Stripe subscription, and does not replace lifecycle delivery or preview-cache invalidation. Deleted directory rows and subscriptions whose deletion has started are left alone. Storage errors propagate; repeated concurrent-publication conflicts reject after bounded retries. Await completion and report failures instead of displaying stale directory state as current.
|
|
56
|
+
|
|
57
|
+
```ts docs-check
|
|
58
|
+
import { RecomputeTenantBillingState } from "@antelopejs/interface-dms-saas/billing";
|
|
59
|
+
|
|
60
|
+
// Invoke only after the import has committed all rows for these authorized tenants.
|
|
61
|
+
export async function refreshImportedTenants(tenantIds: readonly string[]): Promise<void> {
|
|
62
|
+
for (const tenantId of new Set(tenantIds)) {
|
|
63
|
+
await RecomputeTenantBillingState(tenantId);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|