clarion-shared-types 1.0.108 → 1.0.110
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/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/billing/index.js +19 -0
- package/dist/cjs/modules/billing/index.js.map +1 -0
- package/dist/cjs/modules/billing/interfaces/billing-analytics.js +17 -0
- package/dist/cjs/modules/billing/interfaces/billing-analytics.js.map +1 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +4 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/cjs/modules/user/index.js +1 -0
- package/dist/cjs/modules/user/index.js.map +1 -1
- package/dist/cjs/modules/user/interfaces/account-analytics.js +17 -0
- package/dist/cjs/modules/user/interfaces/account-analytics.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/billing/index.js +3 -0
- package/dist/esm/modules/billing/index.js.map +1 -0
- package/dist/esm/modules/billing/interfaces/billing-analytics.js +16 -0
- package/dist/esm/modules/billing/interfaces/billing-analytics.js.map +1 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +4 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/esm/modules/user/index.js +1 -0
- package/dist/esm/modules/user/index.js.map +1 -1
- package/dist/esm/modules/user/interfaces/account-analytics.js +16 -0
- package/dist/esm/modules/user/interfaces/account-analytics.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/modules/billing/index.d.ts +1 -0
- package/dist/types/modules/billing/interfaces/billing-analytics.d.ts +432 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +2 -0
- package/dist/types/modules/user/index.d.ts +1 -0
- package/dist/types/modules/user/interfaces/account-analytics.d.ts +278 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __exportStar(require("./modules/alert-intake/index"), exports);
|
|
|
40
40
|
__exportStar(require("./modules/partner/index"), exports);
|
|
41
41
|
__exportStar(require("./modules/support/index"), exports);
|
|
42
42
|
__exportStar(require("./modules/safety/index"), exports);
|
|
43
|
+
__exportStar(require("./modules/billing/index"), exports);
|
|
43
44
|
// Interfaces
|
|
44
45
|
__exportStar(require("./modules/common/interfaces/server-message"), exports);
|
|
45
46
|
__exportStar(require("./modules/common/interfaces/pagination"), exports);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,UAAU;AACV,uDAAqC;AACrC,+DAA6C;AAC7C,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,2DAAyC;AACzC,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC;AACvC,mEAAiD;AACjD,+DAA6C;AAC7C,uDAAqC;AACrC,0DAAwC;AACxC,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,+DAA6C;AAC7C,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,UAAU;AACV,uDAAqC;AACrC,+DAA6C;AAC7C,yDAAuC;AACvC,6DAA2C;AAC3C,uDAAqC;AACrC,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,2DAAyC;AACzC,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,yDAAuC;AACvC,mEAAiD;AACjD,+DAA6C;AAC7C,uDAAqC;AACrC,0DAAwC;AACxC,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,+DAA6C;AAC7C,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,0DAAwC;AAExC,aAAa;AACb,6EAA2D;AAC3D,yEAAuD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Interfaces
|
|
18
|
+
__exportStar(require("./interfaces/billing-analytics"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/billing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,aAAa;AACb,iEAA+C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Billing analytics: what came in over a period and what it was for, what was invoiced
|
|
4
|
+
* and is still owed, how checkouts went, how subscriptions and the people they cover
|
|
5
|
+
* moved, how trials turned into paying customers, and what is owed to the platform.
|
|
6
|
+
*
|
|
7
|
+
* One read, computed by clarion-billing from one consistent snapshot, so every number
|
|
8
|
+
* on a dashboard agrees with every other. Money is in minor units of ONE currency (the
|
|
9
|
+
* answer's `currency`): an organization that sells in two currencies is read one
|
|
10
|
+
* currency at a time, never added up across them.
|
|
11
|
+
*
|
|
12
|
+
* Totals and counts only: never a person's name, phone number or e-mail. A corporate
|
|
13
|
+
* client and a package appear by name - they are the organization's own customers and
|
|
14
|
+
* products, already on its billing screens.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
//# sourceMappingURL=billing-analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-analytics.js","sourceRoot":"","sources":["../../../../../src/modules/billing/interfaces/billing-analytics.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -41,6 +41,8 @@ var PermissionActions;
|
|
|
41
41
|
PermissionActions["READ_USER"] = "read:user";
|
|
42
42
|
PermissionActions["UPDATE_USER"] = "update:user";
|
|
43
43
|
PermissionActions["DELETE_USER"] = "delete:user";
|
|
44
|
+
// User Analytics - accounts, sign-ups, sign-ins, codes, guardians and deletions over a period, counts only.
|
|
45
|
+
PermissionActions["READ_USER_ANALYTICS"] = "read:user-analytics";
|
|
44
46
|
// Module: Incident
|
|
45
47
|
PermissionActions["CREATE_INCIDENT"] = "create:incident";
|
|
46
48
|
PermissionActions["READ_INCIDENT"] = "read:incident";
|
|
@@ -191,6 +193,8 @@ var PermissionActions;
|
|
|
191
193
|
PermissionActions["CREATE_SETTLEMENT_BATCH"] = "create:settlement-batch";
|
|
192
194
|
PermissionActions["RECONCILE_SETTLEMENT_BATCH"] = "reconcile:settlement-batch";
|
|
193
195
|
PermissionActions["READ_BILLING_OPERATIONS"] = "read:billing-operations";
|
|
196
|
+
// Billing Analytics - the organization's billing over a period, totals and counts only.
|
|
197
|
+
PermissionActions["READ_BILLING_ANALYTICS"] = "read:billing-analytics";
|
|
194
198
|
PermissionActions["READ_PREMIUM_TRIAL"] = "read:premium-trial";
|
|
195
199
|
PermissionActions["GRANT_PREMIUM_TRIAL"] = "grant:premium-trial";
|
|
196
200
|
PermissionActions["REVOKE_PREMIUM_TRIAL"] = "revoke:premium-trial";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-actions.enum.js","sourceRoot":"","sources":["../../../../../src/modules/permission/enums/permission-actions.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"permission-actions.enum.js","sourceRoot":"","sources":["../../../../../src/modules/permission/enums/permission-actions.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAoRX;AApRD,WAAY,iBAAiB;IACzB,uBAAuB;IACvB,gEAA2C,CAAA;IAC3C,4DAAuC,CAAA;IACvC,gEAA2C,CAAA;IAC3C,gEAA2C,CAAA;IAE3C,kBAAkB;IAClB,sDAAiC,CAAA;IACjC,kDAA6B,CAAA;IAC7B,sDAAiC,CAAA;IACjC,sDAAiC,CAAA;IACjC,wEAAwE;IACxE,mEAAmE;IACnE,oEAA+C,CAAA;IAC/C,0EAAqD,CAAA;IACrD,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,2EAA2E;IAC3E,4EAA4E;IAC5E,qEAAqE;IACrE,uDAAuD;IACvD,wEAAmD,CAAA;IACnD,4EAAuD,CAAA;IAEvD,wBAAwB;IACxB,oEAA+C,CAAA;IAC/C,gEAA2C,CAAA;IAC3C,oEAA+C,CAAA;IAC/C,oEAA+C,CAAA;IAE/C,eAAe;IACf,gDAA2B,CAAA;IAC3B,4CAAuB,CAAA;IACvB,gDAA2B,CAAA;IAC3B,gDAA2B,CAAA;IAE3B,eAAe;IACf,gDAA2B,CAAA;IAC3B,4CAAuB,CAAA;IACvB,gDAA2B,CAAA;IAC3B,gDAA2B,CAAA;IAC3B,4GAA4G;IAC5G,gEAA2C,CAAA;IAE3C,mBAAmB;IACnB,wDAAmC,CAAA;IACnC,oDAA+B,CAAA;IAC/B,wDAAmC,CAAA;IACn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sDAAiC,CAAA;IACjC,wDAAmC,CAAA;IAEnC,4DAA4D;IAC5D,8DAAyC,CAAA;IACzC,wGAAwG;IACxG,4DAAuC,CAAA;IACvC,wGAAwG;IACxG,gEAA2C,CAAA;AAC/C,CAAC,EApRW,iBAAiB,iCAAjB,iBAAiB,QAoR5B"}
|
|
@@ -24,4 +24,5 @@ __exportStar(require("./interfaces/guardian"), exports);
|
|
|
24
24
|
__exportStar(require("./interfaces/guardian-relation"), exports);
|
|
25
25
|
__exportStar(require("./interfaces/guardians-response"), exports);
|
|
26
26
|
__exportStar(require("./interfaces/user-analytics-data"), exports);
|
|
27
|
+
__exportStar(require("./interfaces/account-analytics"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/user/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,qEAAmD;AACnD,wEAAsD;AAEtD,oDAAkC;AAClC,4DAA0C;AAC1C,4DAA0C;AAC1C,wDAAsC;AACtC,iEAA+C;AAC/C,kEAAgD;AAChD,mEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/user/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,qEAAmD;AACnD,wEAAsD;AAEtD,oDAAkC;AAClC,4DAA0C;AAC1C,4DAA0C;AAC1C,wDAAsC;AACtC,iEAA+C;AAC/C,kEAAgD;AAChD,mEAAiD;AACjD,iEAA+C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Account analytics (the admin's User Analytics): who has an account and how they got
|
|
4
|
+
* one, whether they finished signing up, who signs in and how often, what goes wrong
|
|
5
|
+
* signing in, one-time codes and passwords, guardians, and who asked to leave.
|
|
6
|
+
*
|
|
7
|
+
* One read, computed by clarion-authentication from one consistent snapshot, so every
|
|
8
|
+
* number on a dashboard agrees with every other. Counts only: never a name, an e-mail
|
|
9
|
+
* address, a phone number or anything a user typed.
|
|
10
|
+
*
|
|
11
|
+
* Two kinds of source. Accounts, guardians and deletion requests are records the service
|
|
12
|
+
* has always kept, so their history goes back to the first account. Sign-ins, one-time
|
|
13
|
+
* codes and password changes come from the service's activity log, which begins on
|
|
14
|
+
* `activitySince`: before it, the only trace of a sign-in is each account's LAST one.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
//# sourceMappingURL=account-analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-analytics.js","sourceRoot":"","sources":["../../../../../src/modules/user/interfaces/account-analytics.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG"}
|
package/dist/esm/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export * from './modules/alert-intake/index';
|
|
|
24
24
|
export * from './modules/partner/index';
|
|
25
25
|
export * from './modules/support/index';
|
|
26
26
|
export * from './modules/safety/index';
|
|
27
|
+
export * from './modules/billing/index';
|
|
27
28
|
// Interfaces
|
|
28
29
|
export * from './modules/common/interfaces/server-message';
|
|
29
30
|
export * from './modules/common/interfaces/pagination';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB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1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/billing/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing analytics: what came in over a period and what it was for, what was invoiced
|
|
3
|
+
* and is still owed, how checkouts went, how subscriptions and the people they cover
|
|
4
|
+
* moved, how trials turned into paying customers, and what is owed to the platform.
|
|
5
|
+
*
|
|
6
|
+
* One read, computed by clarion-billing from one consistent snapshot, so every number
|
|
7
|
+
* on a dashboard agrees with every other. Money is in minor units of ONE currency (the
|
|
8
|
+
* answer's `currency`): an organization that sells in two currencies is read one
|
|
9
|
+
* currency at a time, never added up across them.
|
|
10
|
+
*
|
|
11
|
+
* Totals and counts only: never a person's name, phone number or e-mail. A corporate
|
|
12
|
+
* client and a package appear by name - they are the organization's own customers and
|
|
13
|
+
* products, already on its billing screens.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=billing-analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-analytics.js","sourceRoot":"","sources":["../../../../../src/modules/billing/interfaces/billing-analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -38,6 +38,8 @@ export var PermissionActions;
|
|
|
38
38
|
PermissionActions["READ_USER"] = "read:user";
|
|
39
39
|
PermissionActions["UPDATE_USER"] = "update:user";
|
|
40
40
|
PermissionActions["DELETE_USER"] = "delete:user";
|
|
41
|
+
// User Analytics - accounts, sign-ups, sign-ins, codes, guardians and deletions over a period, counts only.
|
|
42
|
+
PermissionActions["READ_USER_ANALYTICS"] = "read:user-analytics";
|
|
41
43
|
// Module: Incident
|
|
42
44
|
PermissionActions["CREATE_INCIDENT"] = "create:incident";
|
|
43
45
|
PermissionActions["READ_INCIDENT"] = "read:incident";
|
|
@@ -188,6 +190,8 @@ export var PermissionActions;
|
|
|
188
190
|
PermissionActions["CREATE_SETTLEMENT_BATCH"] = "create:settlement-batch";
|
|
189
191
|
PermissionActions["RECONCILE_SETTLEMENT_BATCH"] = "reconcile:settlement-batch";
|
|
190
192
|
PermissionActions["READ_BILLING_OPERATIONS"] = "read:billing-operations";
|
|
193
|
+
// Billing Analytics - the organization's billing over a period, totals and counts only.
|
|
194
|
+
PermissionActions["READ_BILLING_ANALYTICS"] = "read:billing-analytics";
|
|
191
195
|
PermissionActions["READ_PREMIUM_TRIAL"] = "read:premium-trial";
|
|
192
196
|
PermissionActions["GRANT_PREMIUM_TRIAL"] = "grant:premium-trial";
|
|
193
197
|
PermissionActions["REVOKE_PREMIUM_TRIAL"] = "revoke:premium-trial";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-actions.enum.js","sourceRoot":"","sources":["../../../../../src/modules/permission/enums/permission-actions.enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"permission-actions.enum.js","sourceRoot":"","sources":["../../../../../src/modules/permission/enums/permission-actions.enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAoRX;AApRD,WAAY,iBAAiB;IACzB,uBAAuB;IACvB,gEAA2C,CAAA;IAC3C,4DAAuC,CAAA;IACvC,gEAA2C,CAAA;IAC3C,gEAA2C,CAAA;IAE3C,kBAAkB;IAClB,sDAAiC,CAAA;IACjC,kDAA6B,CAAA;IAC7B,sDAAiC,CAAA;IACjC,sDAAiC,CAAA;IACjC,wEAAwE;IACxE,mEAAmE;IACnE,oEAA+C,CAAA;IAC/C,0EAAqD,CAAA;IACrD,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,wEAAmD,CAAA;IACnD,2EAA2E;IAC3E,4EAA4E;IAC5E,qEAAqE;IACrE,uDAAuD;IACvD,wEAAmD,CAAA;IACnD,4EAAuD,CAAA;IAEvD,wBAAwB;IACxB,oEAA+C,CAAA;IAC/C,gEA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,4EAAuD,CAAA;IACvD,8EAAyD,CAAA;IACzD,8FAAyE,CAAA;IACzE,kGAA6E,CAAA;IAC7E,gFAA2D,CAAA;IAC3D,gFAAgF;IAChF,sFAAsF;IACtF,kFAA6D,CAAA;IAE7D,gFAAgF;IAChF,0EAA0E;IAC1E,gDAAgD;IAChD,0DAAqC,CAAA;IACrC,4DAAuC,CAAA;IACvC,8EAAyD,CAAA;IACzD,2EAA2E;IAC3E,oEAA+C,CAAA;IAC/C,iFAAiF;IACjF,4EAA4E;IAC5E,mEAAmE;IACnE,oDAA+B,CAAA;IAC/B,sDAAiC,CAAA;IACjC,wDAAmC,CAAA;IAEnC,4DAA4D;IAC5D,8DAAyC,CAAA;IACzC,wGAAwG;IACxG,4DAAuC,CAAA;IACvC,wGAAwG;IACxG,gEAA2C,CAAA;AAC/C,CAAC,EApRW,iBAAiB,KAAjB,iBAAiB,QAoR5B"}
|
|
@@ -8,4 +8,5 @@ export * from './interfaces/guardian';
|
|
|
8
8
|
export * from './interfaces/guardian-relation';
|
|
9
9
|
export * from './interfaces/guardians-response';
|
|
10
10
|
export * from './interfaces/user-analytics-data';
|
|
11
|
+
export * from './interfaces/account-analytics';
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AAEtD,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AAEtD,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account analytics (the admin's User Analytics): who has an account and how they got
|
|
3
|
+
* one, whether they finished signing up, who signs in and how often, what goes wrong
|
|
4
|
+
* signing in, one-time codes and passwords, guardians, and who asked to leave.
|
|
5
|
+
*
|
|
6
|
+
* One read, computed by clarion-authentication from one consistent snapshot, so every
|
|
7
|
+
* number on a dashboard agrees with every other. Counts only: never a name, an e-mail
|
|
8
|
+
* address, a phone number or anything a user typed.
|
|
9
|
+
*
|
|
10
|
+
* Two kinds of source. Accounts, guardians and deletion requests are records the service
|
|
11
|
+
* has always kept, so their history goes back to the first account. Sign-ins, one-time
|
|
12
|
+
* codes and password changes come from the service's activity log, which begins on
|
|
13
|
+
* `activitySince`: before it, the only trace of a sign-in is each account's LAST one.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=account-analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-analytics.js","sourceRoot":"","sources":["../../../../../src/modules/user/interfaces/account-analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -23,5 +23,6 @@ export * from './modules/alert-intake/index';
|
|
|
23
23
|
export * from './modules/partner/index';
|
|
24
24
|
export * from './modules/support/index';
|
|
25
25
|
export * from './modules/safety/index';
|
|
26
|
+
export * from './modules/billing/index';
|
|
26
27
|
export * from './modules/common/interfaces/server-message';
|
|
27
28
|
export * from './modules/common/interfaces/pagination';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './interfaces/billing-analytics';
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing analytics: what came in over a period and what it was for, what was invoiced
|
|
3
|
+
* and is still owed, how checkouts went, how subscriptions and the people they cover
|
|
4
|
+
* moved, how trials turned into paying customers, and what is owed to the platform.
|
|
5
|
+
*
|
|
6
|
+
* One read, computed by clarion-billing from one consistent snapshot, so every number
|
|
7
|
+
* on a dashboard agrees with every other. Money is in minor units of ONE currency (the
|
|
8
|
+
* answer's `currency`): an organization that sells in two currencies is read one
|
|
9
|
+
* currency at a time, never added up across them.
|
|
10
|
+
*
|
|
11
|
+
* Totals and counts only: never a person's name, phone number or e-mail. A corporate
|
|
12
|
+
* client and a package appear by name - they are the organization's own customers and
|
|
13
|
+
* products, already on its billing screens.
|
|
14
|
+
*/
|
|
15
|
+
/** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
|
|
16
|
+
export type BillingAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
|
|
17
|
+
export interface BillingAnalyticsRange {
|
|
18
|
+
/** Inclusive, ISO 8601. The first billing record when the period asked for was "forever". */
|
|
19
|
+
from: string;
|
|
20
|
+
/** Exclusive, ISO 8601. */
|
|
21
|
+
to: string;
|
|
22
|
+
bucket: BillingAnalyticsBucket;
|
|
23
|
+
/** IANA time zone the buckets are cut in. */
|
|
24
|
+
timeZone: string;
|
|
25
|
+
}
|
|
26
|
+
/** A count by a key (a status, a band, a provider), largest first unless the section says otherwise. */
|
|
27
|
+
export interface BillingAnalyticsCount<K extends string = string> {
|
|
28
|
+
key: K;
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
31
|
+
/** A count by a key, and the money in it. */
|
|
32
|
+
export interface BillingAnalyticsAmount<K extends string = string> {
|
|
33
|
+
key: K;
|
|
34
|
+
count: number;
|
|
35
|
+
amountMinor: number;
|
|
36
|
+
}
|
|
37
|
+
/** A currency the scope has done business in, so a dashboard can offer to switch to it. */
|
|
38
|
+
export interface BillingAnalyticsCurrency {
|
|
39
|
+
currency: string;
|
|
40
|
+
/** Money received in the period, in this currency. */
|
|
41
|
+
collectedMinor: number;
|
|
42
|
+
/** Subscriptions ever started in this currency. */
|
|
43
|
+
subscriptions: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* What a payment was for:
|
|
47
|
+
* - NEW the first period of a subscription;
|
|
48
|
+
* - RENEWAL a later period;
|
|
49
|
+
* - SEATS people added to a running subscription, for what was left of its period;
|
|
50
|
+
* - ORDER a corporate order;
|
|
51
|
+
* - OTHER anything else (a payment from before payments named their invoice).
|
|
52
|
+
*/
|
|
53
|
+
export type BillingRevenueKind = 'NEW' | 'RENEWAL' | 'SEATS' | 'ORDER' | 'OTHER';
|
|
54
|
+
/**
|
|
55
|
+
* Money received from customers in the period, by when it was paid. A payment made to
|
|
56
|
+
* the PLATFORM (an organization settling its fees) is not revenue here; it is in
|
|
57
|
+
* `settlements`.
|
|
58
|
+
*/
|
|
59
|
+
export interface BillingAnalyticsRevenue {
|
|
60
|
+
/** Every successful customer payment, VAT included. */
|
|
61
|
+
collectedMinor: number;
|
|
62
|
+
payments: number;
|
|
63
|
+
/** Distinct customers who paid: an individual, or a corporate client. */
|
|
64
|
+
payers: number;
|
|
65
|
+
/** The VAT in what was collected (from the invoices the payments settled). */
|
|
66
|
+
taxMinor: number;
|
|
67
|
+
/** Collected less VAT. */
|
|
68
|
+
netMinor: number;
|
|
69
|
+
/** Paid through Paystack or Flutterwave. */
|
|
70
|
+
gatewayMinor: number;
|
|
71
|
+
/** Recorded by a person: bank transfer, cheque, LPO, cash... */
|
|
72
|
+
manualMinor: number;
|
|
73
|
+
/** Received and not used - the invoice was already paid, void, or for another amount. Included in `collectedMinor`. */
|
|
74
|
+
unappliedMinor: number;
|
|
75
|
+
unappliedPayments: number;
|
|
76
|
+
averagePaymentMinor: number | null;
|
|
77
|
+
/** Credits and refunds recorded in the period (as positive amounts). */
|
|
78
|
+
creditsMinor: number;
|
|
79
|
+
refundsMinor: number;
|
|
80
|
+
/** Every kind, in a fixed order, zeros included. */
|
|
81
|
+
byKind: BillingAnalyticsAmount<BillingRevenueKind>[];
|
|
82
|
+
/** INDIVIDUAL and CORPORATE customers, zeros included. */
|
|
83
|
+
byProfile: BillingAnalyticsAmount[];
|
|
84
|
+
/** PAYSTACK, FLUTTERWAVE, MANUAL. */
|
|
85
|
+
byProvider: BillingAnalyticsAmount[];
|
|
86
|
+
/** CARD, MOBILE_MONEY, BANK_TRANSFER, UNKNOWN for a gateway; MANUAL_<method> for one recorded by a person. */
|
|
87
|
+
byMethod: BillingAnalyticsAmount[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Recurring revenue at the end of the period: the price of every paid, covered seat on
|
|
91
|
+
* a recurring plan, as a monthly figure (an annual seat counts a twelfth).
|
|
92
|
+
*/
|
|
93
|
+
export interface BillingAnalyticsRecurring {
|
|
94
|
+
mrrMinor: number;
|
|
95
|
+
/** MRR × 12. */
|
|
96
|
+
arrMinor: number;
|
|
97
|
+
/** Subscriptions with at least one paid, covered seat. */
|
|
98
|
+
payingSubscriptions: number;
|
|
99
|
+
billableSeats: number;
|
|
100
|
+
averagePerSubscriptionMinor: number | null;
|
|
101
|
+
}
|
|
102
|
+
/** How long an invoice still owed at the end of the period has been due. */
|
|
103
|
+
export type BillingAgingBand = 'NOT_DUE' | 'NO_DUE_DATE' | '1-30' | '31-60' | '61-90' | '90+';
|
|
104
|
+
/**
|
|
105
|
+
* Customer invoices. A checkout's own invoice that was never paid (DRAFT) is not
|
|
106
|
+
* counted as issued: nobody was asked to pay it but the person who walked away.
|
|
107
|
+
*/
|
|
108
|
+
export interface BillingAnalyticsInvoices {
|
|
109
|
+
/** Issued in the period. */
|
|
110
|
+
issued: number;
|
|
111
|
+
issuedMinor: number;
|
|
112
|
+
/** Of those, paid by the end of the period. */
|
|
113
|
+
paid: number;
|
|
114
|
+
paidMinor: number;
|
|
115
|
+
voided: number;
|
|
116
|
+
voidedMinor: number;
|
|
117
|
+
/** paidMinor as a share of issuedMinor (voided ones left out); null with nothing issued. */
|
|
118
|
+
collectionRate: number | null;
|
|
119
|
+
/** Any invoice paid in the period, whenever it was issued. */
|
|
120
|
+
paidInPeriod: number;
|
|
121
|
+
paidInPeriodMinor: number;
|
|
122
|
+
/** From issued to paid, for the invoices paid in the period. */
|
|
123
|
+
medianDaysToPay: number | null;
|
|
124
|
+
averageDaysToPay: number | null;
|
|
125
|
+
/** Still owed at the end of the period, and the part of it past its due date. */
|
|
126
|
+
outstanding: number;
|
|
127
|
+
outstandingMinor: number;
|
|
128
|
+
overdue: number;
|
|
129
|
+
overdueMinor: number;
|
|
130
|
+
/** The period's invoices as they stand now: PAID, ISSUED, OVERDUE, VOID. */
|
|
131
|
+
byStatus: BillingAnalyticsAmount[];
|
|
132
|
+
/** What is owed at the end of the period, by how long it has been due. Fixed order, zeros included. */
|
|
133
|
+
aging: BillingAnalyticsAmount<BillingAgingBand>[];
|
|
134
|
+
/** The period's invoices by what they were for: SUBSCRIPTION_PERIOD, SEAT_ADJUSTMENT, CORPORATE_ORDER, OTHER. */
|
|
135
|
+
byPurpose: BillingAnalyticsAmount[];
|
|
136
|
+
}
|
|
137
|
+
/** Gateway checkouts opened in the period, as they stand now. */
|
|
138
|
+
export interface BillingAnalyticsCheckoutProvider {
|
|
139
|
+
provider: string;
|
|
140
|
+
attempts: number;
|
|
141
|
+
succeeded: number;
|
|
142
|
+
failed: number;
|
|
143
|
+
abandoned: number;
|
|
144
|
+
pending: number;
|
|
145
|
+
successRate: number | null;
|
|
146
|
+
}
|
|
147
|
+
export interface BillingAnalyticsCheckouts {
|
|
148
|
+
attempts: number;
|
|
149
|
+
succeeded: number;
|
|
150
|
+
failed: number;
|
|
151
|
+
/** Closed without a payment: never completed, or the customer walked away. */
|
|
152
|
+
abandoned: number;
|
|
153
|
+
/** Still waiting for the customer or the provider. */
|
|
154
|
+
pending: number;
|
|
155
|
+
cancelled: number;
|
|
156
|
+
/** succeeded / (succeeded + failed + abandoned + cancelled); null when none has finished. */
|
|
157
|
+
successRate: number | null;
|
|
158
|
+
/** From opening the checkout to the money arriving, for the ones that succeeded. */
|
|
159
|
+
medianSecondsToPay: number | null;
|
|
160
|
+
byProvider: BillingAnalyticsCheckoutProvider[];
|
|
161
|
+
/** Why the failed ones failed, as the provider (or reconciliation) put it - top 8. */
|
|
162
|
+
failureReasons: BillingAnalyticsCount[];
|
|
163
|
+
/** Payments recorded by a person in the period. */
|
|
164
|
+
manualRecorded: number;
|
|
165
|
+
manualRecordedMinor: number;
|
|
166
|
+
}
|
|
167
|
+
/** Size of a subscription by the people covered on it at the end of the period. */
|
|
168
|
+
export type BillingPlanSizeBand = '1' | '2-3' | '4-9' | '10-49' | '50+';
|
|
169
|
+
/** What is coming up, counted from NOW - whatever period is being looked at. */
|
|
170
|
+
export interface BillingAnalyticsRenewalsAhead {
|
|
171
|
+
dueIn7Days: number;
|
|
172
|
+
dueIn30Days: number;
|
|
173
|
+
/** What the subscriptions due in the next 30 days cost per period. */
|
|
174
|
+
dueIn30DaysMinor: number;
|
|
175
|
+
/** Of those due in 30 days: renew on their own (a saved card), or need somebody to pay. */
|
|
176
|
+
autoRenewing: number;
|
|
177
|
+
manualRenewing: number;
|
|
178
|
+
/** Cancelled for the end of their period: they will not renew. */
|
|
179
|
+
endingAtPeriodEnd: number;
|
|
180
|
+
/** A renewal charge failed; still covered until the end of the period. */
|
|
181
|
+
pastDue: number;
|
|
182
|
+
/** Waiting for the customer to pay the renewal themselves (mobile money). */
|
|
183
|
+
manualRenewalRequired: number;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* A subscription is LIVE from its first activation to the end of what was paid for (or
|
|
187
|
+
* to its cancellation or suspension) - so "live at the start" and "live at the end" can
|
|
188
|
+
* be read for any date in the past.
|
|
189
|
+
*/
|
|
190
|
+
export interface BillingAnalyticsSubscriptions {
|
|
191
|
+
/** Null for "forever". */
|
|
192
|
+
liveAtStart: number | null;
|
|
193
|
+
liveAtEnd: number;
|
|
194
|
+
/** First activated in the period. */
|
|
195
|
+
started: number;
|
|
196
|
+
/** A second or later period that started in the period. */
|
|
197
|
+
renewed: number;
|
|
198
|
+
/** Cover ended in the period because it was cancelled... */
|
|
199
|
+
cancelled: number;
|
|
200
|
+
/** ...or because it ran out and was not renewed. */
|
|
201
|
+
expired: number;
|
|
202
|
+
/** (cancelled + expired) / liveAtStart; null for "forever" or with nothing live at the start. */
|
|
203
|
+
churnRate: number | null;
|
|
204
|
+
/** renewed / (renewed + expired); null when none came up. */
|
|
205
|
+
renewalRate: number | null;
|
|
206
|
+
/** Created, never paid, and still waiting now. */
|
|
207
|
+
awaitingFirstPayment: number;
|
|
208
|
+
/** Every subscription in scope, as it stands now - every status, zeros included. */
|
|
209
|
+
byStatus: BillingAnalyticsCount[];
|
|
210
|
+
/** The subscriptions live at the end of the period, split four ways. */
|
|
211
|
+
byProfile: BillingAnalyticsCount[];
|
|
212
|
+
byCycle: BillingAnalyticsCount[];
|
|
213
|
+
byRenewalMode: BillingAnalyticsCount[];
|
|
214
|
+
byCollection: BillingAnalyticsCount[];
|
|
215
|
+
/** Fixed order, zeros included. */
|
|
216
|
+
sizes: BillingAnalyticsCount<BillingPlanSizeBand>[];
|
|
217
|
+
ahead: BillingAnalyticsRenewalsAhead;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Who holds the cover:
|
|
221
|
+
* - SUBSCRIBER an individual on their own plan;
|
|
222
|
+
* - BENEFICIARY somebody covered under a subscriber or a corporate member;
|
|
223
|
+
* - MEMBER a corporate client's member;
|
|
224
|
+
* - MANUAL cover granted by hand.
|
|
225
|
+
*/
|
|
226
|
+
export type BillingCoverKind = 'SUBSCRIBER' | 'BENEFICIARY' | 'MEMBER' | 'MANUAL';
|
|
227
|
+
export interface BillingAnalyticsSeatType {
|
|
228
|
+
/** PRIMARY, BENEFICIARY, CORPORATE_MEMBER, CORPORATE_MEMBER_BENEFICIARY. */
|
|
229
|
+
type: string;
|
|
230
|
+
/** Covered at the end of the period, charged for. */
|
|
231
|
+
paid: number;
|
|
232
|
+
/** Covered at no charge (a zero-priced package, or beneficiaries not charged for). */
|
|
233
|
+
included: number;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The people covered: from their cover itself (what the incident service is told), so
|
|
237
|
+
* a person on two plans is one person. Seats are the places on plans that are paid for
|
|
238
|
+
* - a corporate member without an app account holds a seat but no cover yet.
|
|
239
|
+
*/
|
|
240
|
+
export interface BillingAnalyticsCover {
|
|
241
|
+
/** Null for "forever". */
|
|
242
|
+
peopleAtStart: number | null;
|
|
243
|
+
peopleAtEnd: number;
|
|
244
|
+
/** People whose first-ever cover started in the period. */
|
|
245
|
+
newlyCovered: number;
|
|
246
|
+
/** At the end of the period, every kind in a fixed order. */
|
|
247
|
+
byKind: BillingAnalyticsCount<BillingCoverKind>[];
|
|
248
|
+
seats: {
|
|
249
|
+
/** Covered at the end of the period. */
|
|
250
|
+
paid: number;
|
|
251
|
+
included: number;
|
|
252
|
+
/** Waiting for their charge to be paid now: nobody is covered on them yet. */
|
|
253
|
+
pending: number;
|
|
254
|
+
/** Added to a running plan in the period. */
|
|
255
|
+
addedMidPeriod: number;
|
|
256
|
+
/** What those additions were charged, for what was left of their period. */
|
|
257
|
+
addedMidPeriodMinor: number;
|
|
258
|
+
/** Taken off a plan in the period. */
|
|
259
|
+
removed: number;
|
|
260
|
+
};
|
|
261
|
+
seatsByType: BillingAnalyticsSeatType[];
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Premium trials (a few alerts with full cover, free): started in the period, and
|
|
265
|
+
* whether the person went on to pay for a plan of their own. Trials carry no currency;
|
|
266
|
+
* these figures are the same whichever currency is being read.
|
|
267
|
+
*/
|
|
268
|
+
export interface BillingAnalyticsTrials {
|
|
269
|
+
started: number;
|
|
270
|
+
/** Started a paid subscription of their own after the trial began. */
|
|
271
|
+
converted: number;
|
|
272
|
+
conversionRate: number | null;
|
|
273
|
+
medianDaysToConvert: number | null;
|
|
274
|
+
/** Alerts raised on a trial. */
|
|
275
|
+
alertsUsed: number;
|
|
276
|
+
/** Of the period's trials: ACTIVE, EXHAUSTED, EXPIRED, REVOKED - now. */
|
|
277
|
+
byStatus: BillingAnalyticsCount[];
|
|
278
|
+
/** AUTO_ENROLL (on first use) or MANUAL_GRANT. */
|
|
279
|
+
bySource: BillingAnalyticsCount[];
|
|
280
|
+
}
|
|
281
|
+
/** One month an organization was charged by the platform. */
|
|
282
|
+
export interface BillingAnalyticsSettlementRow {
|
|
283
|
+
id: number;
|
|
284
|
+
organizationId: number;
|
|
285
|
+
/** ISO 8601. */
|
|
286
|
+
periodStart: string;
|
|
287
|
+
periodEnd: string;
|
|
288
|
+
/** DRAFT, INVOICED, PAID, OVERDUE. */
|
|
289
|
+
status: string;
|
|
290
|
+
/** CALCULATED, or MINIMUM when the minimum monthly charge applied. */
|
|
291
|
+
feeBasis: string;
|
|
292
|
+
grossRevenueMinor: number;
|
|
293
|
+
netRevenueMinor: number;
|
|
294
|
+
feeMinor: number;
|
|
295
|
+
platformTaxMinor: number;
|
|
296
|
+
totalDueMinor: number;
|
|
297
|
+
organizationNetMinor: number;
|
|
298
|
+
paidAt: string | null;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* What the organization owes the platform for the months the period touches. For a
|
|
302
|
+
* Super-Admin looking at every organization, what the platform has earned.
|
|
303
|
+
*/
|
|
304
|
+
export interface BillingAnalyticsSettlements {
|
|
305
|
+
months: number;
|
|
306
|
+
grossRevenueMinor: number;
|
|
307
|
+
feesMinor: number;
|
|
308
|
+
platformTaxMinor: number;
|
|
309
|
+
totalDueMinor: number;
|
|
310
|
+
paidMinor: number;
|
|
311
|
+
/** Invoiced or overdue, not yet paid. */
|
|
312
|
+
outstandingMinor: number;
|
|
313
|
+
organizationNetMinor: number;
|
|
314
|
+
/** Months on which the minimum monthly charge applied. */
|
|
315
|
+
onMinimum: number;
|
|
316
|
+
/** Newest first, at most 36. */
|
|
317
|
+
rows: BillingAnalyticsSettlementRow[];
|
|
318
|
+
}
|
|
319
|
+
export interface BillingAnalyticsTimelinePoint {
|
|
320
|
+
/** The bucket's start, local to the range's time zone, without an offset ("2026-09-21T00:00:00"). */
|
|
321
|
+
bucket: string;
|
|
322
|
+
collectedMinor: number;
|
|
323
|
+
newMinor: number;
|
|
324
|
+
renewalMinor: number;
|
|
325
|
+
seatsMinor: number;
|
|
326
|
+
orderMinor: number;
|
|
327
|
+
otherMinor: number;
|
|
328
|
+
payments: number;
|
|
329
|
+
invoices: number;
|
|
330
|
+
invoicedMinor: number;
|
|
331
|
+
/** Invoices paid in the bucket, and their value. */
|
|
332
|
+
invoicesPaidMinor: number;
|
|
333
|
+
attempts: number;
|
|
334
|
+
succeeded: number;
|
|
335
|
+
failed: number;
|
|
336
|
+
abandoned: number;
|
|
337
|
+
started: number;
|
|
338
|
+
renewed: number;
|
|
339
|
+
ended: number;
|
|
340
|
+
/** Live at the end of the bucket. */
|
|
341
|
+
liveSubscriptions: number;
|
|
342
|
+
/** Covered at the end of the bucket. */
|
|
343
|
+
peopleCovered: number;
|
|
344
|
+
trialsStarted: number;
|
|
345
|
+
trialsConverted: number;
|
|
346
|
+
}
|
|
347
|
+
/** The previous period of the same length, for the change on each headline figure. Absent for "forever". */
|
|
348
|
+
export interface BillingAnalyticsPrevious {
|
|
349
|
+
from: string;
|
|
350
|
+
to: string;
|
|
351
|
+
collectedMinor: number;
|
|
352
|
+
netMinor: number;
|
|
353
|
+
payments: number;
|
|
354
|
+
invoices: number;
|
|
355
|
+
invoicedMinor: number;
|
|
356
|
+
attempts: number;
|
|
357
|
+
succeeded: number;
|
|
358
|
+
started: number;
|
|
359
|
+
renewed: number;
|
|
360
|
+
ended: number;
|
|
361
|
+
seatsAdded: number;
|
|
362
|
+
trialsStarted: number;
|
|
363
|
+
trialsConverted: number;
|
|
364
|
+
}
|
|
365
|
+
export interface BillingAnalyticsPackageRow {
|
|
366
|
+
packageId: number;
|
|
367
|
+
organizationId: number;
|
|
368
|
+
name: string;
|
|
369
|
+
profileType: string;
|
|
370
|
+
billingCycle: string;
|
|
371
|
+
liveSubscriptions: number;
|
|
372
|
+
coveredSeats: number;
|
|
373
|
+
started: number;
|
|
374
|
+
collectedMinor: number;
|
|
375
|
+
mrrMinor: number;
|
|
376
|
+
}
|
|
377
|
+
export interface BillingAnalyticsClientRow {
|
|
378
|
+
corporateClientId: number;
|
|
379
|
+
organizationId: number;
|
|
380
|
+
name: string;
|
|
381
|
+
liveSubscriptions: number;
|
|
382
|
+
coveredSeats: number;
|
|
383
|
+
collectedMinor: number;
|
|
384
|
+
invoicedMinor: number;
|
|
385
|
+
outstandingMinor: number;
|
|
386
|
+
overdueMinor: number;
|
|
387
|
+
}
|
|
388
|
+
/** A Super-Admin's view of every organization: one row each, busiest first. */
|
|
389
|
+
export interface BillingAnalyticsOrganizationRow {
|
|
390
|
+
organizationId: number;
|
|
391
|
+
collectedMinor: number;
|
|
392
|
+
invoicedMinor: number;
|
|
393
|
+
outstandingMinor: number;
|
|
394
|
+
mrrMinor: number;
|
|
395
|
+
liveSubscriptions: number;
|
|
396
|
+
peopleCovered: number;
|
|
397
|
+
feesMinor: number;
|
|
398
|
+
}
|
|
399
|
+
export interface BillingAnalytics {
|
|
400
|
+
/** Whose figures: one organization, or null for every organization (a Super-Admin's view). */
|
|
401
|
+
organizationId: number | null;
|
|
402
|
+
range: BillingAnalyticsRange;
|
|
403
|
+
generatedAt: string;
|
|
404
|
+
/** The currency every money figure is in. */
|
|
405
|
+
currency: string;
|
|
406
|
+
/** Every currency the scope has business in, busiest first. */
|
|
407
|
+
currencies: BillingAnalyticsCurrency[];
|
|
408
|
+
previous: BillingAnalyticsPrevious | null;
|
|
409
|
+
timeline: BillingAnalyticsTimelinePoint[];
|
|
410
|
+
revenue: BillingAnalyticsRevenue;
|
|
411
|
+
recurring: BillingAnalyticsRecurring;
|
|
412
|
+
invoices: BillingAnalyticsInvoices;
|
|
413
|
+
checkouts: BillingAnalyticsCheckouts;
|
|
414
|
+
subscriptions: BillingAnalyticsSubscriptions;
|
|
415
|
+
cover: BillingAnalyticsCover;
|
|
416
|
+
trials: BillingAnalyticsTrials;
|
|
417
|
+
settlements: BillingAnalyticsSettlements;
|
|
418
|
+
/** Packages with anything live or any money in the period, most money first - at most 25. */
|
|
419
|
+
packages: BillingAnalyticsPackageRow[];
|
|
420
|
+
/** Corporate clients with anything live, owed or paid, most money first - at most 25. */
|
|
421
|
+
clients: BillingAnalyticsClientRow[];
|
|
422
|
+
/** A Super-Admin looking at every organization only. */
|
|
423
|
+
byOrganization?: BillingAnalyticsOrganizationRow[];
|
|
424
|
+
}
|
|
425
|
+
/** What a dashboard asks: the period, and - for a Super-Admin - whose figures. */
|
|
426
|
+
export interface BillingAnalyticsQuery {
|
|
427
|
+
from?: string;
|
|
428
|
+
to?: string;
|
|
429
|
+
timeZone?: string;
|
|
430
|
+
currency?: string;
|
|
431
|
+
organizationId?: number;
|
|
432
|
+
}
|
|
@@ -26,6 +26,7 @@ export declare enum PermissionActions {
|
|
|
26
26
|
READ_USER = "read:user",
|
|
27
27
|
UPDATE_USER = "update:user",
|
|
28
28
|
DELETE_USER = "delete:user",
|
|
29
|
+
READ_USER_ANALYTICS = "read:user-analytics",
|
|
29
30
|
CREATE_INCIDENT = "create:incident",
|
|
30
31
|
READ_INCIDENT = "read:incident",
|
|
31
32
|
UPDATE_INCIDENT = "update:incident",
|
|
@@ -152,6 +153,7 @@ export declare enum PermissionActions {
|
|
|
152
153
|
CREATE_SETTLEMENT_BATCH = "create:settlement-batch",
|
|
153
154
|
RECONCILE_SETTLEMENT_BATCH = "reconcile:settlement-batch",
|
|
154
155
|
READ_BILLING_OPERATIONS = "read:billing-operations",
|
|
156
|
+
READ_BILLING_ANALYTICS = "read:billing-analytics",
|
|
155
157
|
READ_PREMIUM_TRIAL = "read:premium-trial",
|
|
156
158
|
GRANT_PREMIUM_TRIAL = "grant:premium-trial",
|
|
157
159
|
REVOKE_PREMIUM_TRIAL = "revoke:premium-trial",
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account analytics (the admin's User Analytics): who has an account and how they got
|
|
3
|
+
* one, whether they finished signing up, who signs in and how often, what goes wrong
|
|
4
|
+
* signing in, one-time codes and passwords, guardians, and who asked to leave.
|
|
5
|
+
*
|
|
6
|
+
* One read, computed by clarion-authentication from one consistent snapshot, so every
|
|
7
|
+
* number on a dashboard agrees with every other. Counts only: never a name, an e-mail
|
|
8
|
+
* address, a phone number or anything a user typed.
|
|
9
|
+
*
|
|
10
|
+
* Two kinds of source. Accounts, guardians and deletion requests are records the service
|
|
11
|
+
* has always kept, so their history goes back to the first account. Sign-ins, one-time
|
|
12
|
+
* codes and password changes come from the service's activity log, which begins on
|
|
13
|
+
* `activitySince`: before it, the only trace of a sign-in is each account's LAST one.
|
|
14
|
+
*/
|
|
15
|
+
/** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
|
|
16
|
+
export type AccountAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
|
|
17
|
+
export interface AccountAnalyticsRange {
|
|
18
|
+
/** Inclusive, ISO 8601. The first account when the period asked for was "forever". */
|
|
19
|
+
from: string;
|
|
20
|
+
/** Exclusive, ISO 8601. */
|
|
21
|
+
to: string;
|
|
22
|
+
bucket: AccountAnalyticsBucket;
|
|
23
|
+
/** IANA time zone the buckets, the days and the hour-of-week grid are cut in. */
|
|
24
|
+
timeZone: string;
|
|
25
|
+
}
|
|
26
|
+
/** A count by a key (a status, a role, a band), largest first unless the section says otherwise. */
|
|
27
|
+
export interface AccountAnalyticsCount<K extends string = string> {
|
|
28
|
+
key: K;
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What an account is for, from its roles - one per account, the first that applies:
|
|
33
|
+
* - PLATFORM Super-Admin;
|
|
34
|
+
* - ORGANIZATION an organization's staff (any Organization:* role);
|
|
35
|
+
* - CONTROL_CENTRE a control room's staff (any Control-Centre:* role);
|
|
36
|
+
* - RESPONDER a responder;
|
|
37
|
+
* - CORPORATE_CLIENT a corporate client's own staff;
|
|
38
|
+
* - MOBILE somebody using the app (Mobile-User);
|
|
39
|
+
* - NONE no role.
|
|
40
|
+
*/
|
|
41
|
+
export type AccountKind = 'PLATFORM' | 'ORGANIZATION' | 'CONTROL_CENTRE' | 'RESPONDER' | 'CORPORATE_CLIENT' | 'MOBILE' | 'NONE';
|
|
42
|
+
/** How long ago an account last signed in, as it stands now. */
|
|
43
|
+
export type AccountRecencyBand = '1d' | '7d' | '30d' | '90d' | 'older' | 'never';
|
|
44
|
+
/** A row per brand of app: accounts that belong to it. */
|
|
45
|
+
export interface AccountAnalyticsAppRow {
|
|
46
|
+
/** IncidentAppId: Upesy, G4S, GardaWorld, GRM, Pasha... */
|
|
47
|
+
app: string;
|
|
48
|
+
/** At the end of the period. */
|
|
49
|
+
total: number;
|
|
50
|
+
/** Created in the period. */
|
|
51
|
+
created: number;
|
|
52
|
+
/** Signed in during the period (as far as is known - see `AccountAnalyticsAccounts.activeInPeriod`). */
|
|
53
|
+
active: number;
|
|
54
|
+
}
|
|
55
|
+
export interface AccountAnalyticsKindRow {
|
|
56
|
+
kind: AccountKind;
|
|
57
|
+
total: number;
|
|
58
|
+
created: number;
|
|
59
|
+
active: number;
|
|
60
|
+
}
|
|
61
|
+
/** Of the accounts created in the period, how far each got - as they stand now. */
|
|
62
|
+
export interface AccountAnalyticsFunnel {
|
|
63
|
+
created: number;
|
|
64
|
+
/** Confirmed their phone or e-mail with a one-time code. */
|
|
65
|
+
verified: number;
|
|
66
|
+
acceptedTerms: number;
|
|
67
|
+
/** Signed in at least once. */
|
|
68
|
+
signedIn: number;
|
|
69
|
+
}
|
|
70
|
+
export interface AccountAnalyticsAccounts {
|
|
71
|
+
/** Null for "forever". */
|
|
72
|
+
totalAtStart: number | null;
|
|
73
|
+
totalAtEnd: number;
|
|
74
|
+
created: number;
|
|
75
|
+
/** Of those: somebody using the app, and everybody else (staff of any kind). */
|
|
76
|
+
createdMobile: number;
|
|
77
|
+
createdStaff: number;
|
|
78
|
+
/**
|
|
79
|
+
* Accounts that signed in during the period: every account with a sign-in in the
|
|
80
|
+
* activity log, and - for the time before the log - every account whose LAST sign-in
|
|
81
|
+
* falls in the period. Exact from `activitySince` on; a floor before it.
|
|
82
|
+
*/
|
|
83
|
+
activeInPeriod: number;
|
|
84
|
+
/** Active accounts that were created in an earlier period. */
|
|
85
|
+
returning: number;
|
|
86
|
+
funnel: AccountAnalyticsFunnel;
|
|
87
|
+
/** Now: never confirmed their phone or e-mail with a one-time code. */
|
|
88
|
+
pendingNow: number;
|
|
89
|
+
/** Now: never signed in. */
|
|
90
|
+
neverSignedIn: number;
|
|
91
|
+
/** Now: last signed in more than 90 days ago. */
|
|
92
|
+
dormant: number;
|
|
93
|
+
/** Hours from creating the account to its first sign-in, for first sign-ins in the period (activity log only). */
|
|
94
|
+
medianHoursToFirstSignIn: number | null;
|
|
95
|
+
byKind: AccountAnalyticsKindRow[];
|
|
96
|
+
byApp: AccountAnalyticsAppRow[];
|
|
97
|
+
/** At the end of the period: an account is counted under every role it holds. */
|
|
98
|
+
byRole: AccountAnalyticsCount[];
|
|
99
|
+
/** Now: active, pending, inactive. */
|
|
100
|
+
byStatus: AccountAnalyticsCount[];
|
|
101
|
+
/** At the end of the period: KE, UG, TZ. */
|
|
102
|
+
byCountry: AccountAnalyticsCount[];
|
|
103
|
+
/** Now, fixed order, zeros included. */
|
|
104
|
+
recency: AccountAnalyticsCount<AccountRecencyBand>[];
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* How somebody signed in:
|
|
108
|
+
* - PASSWORD e-mail and password (the admin and the web);
|
|
109
|
+
* - OTP phone number and a one-time code (the app);
|
|
110
|
+
* - REVIEWER the app-store reviewers' account.
|
|
111
|
+
*/
|
|
112
|
+
export type AccountSignInMethod = 'PASSWORD' | 'OTP' | 'REVIEWER';
|
|
113
|
+
export interface AccountAnalyticsMethodRow {
|
|
114
|
+
method: string;
|
|
115
|
+
succeeded: number;
|
|
116
|
+
failed: number;
|
|
117
|
+
}
|
|
118
|
+
export interface AccountAnalyticsSignIns {
|
|
119
|
+
attempts: number;
|
|
120
|
+
succeeded: number;
|
|
121
|
+
failed: number;
|
|
122
|
+
/** succeeded / attempts; null with none. */
|
|
123
|
+
successRate: number | null;
|
|
124
|
+
/** Distinct accounts that signed in. */
|
|
125
|
+
users: number;
|
|
126
|
+
/** An account's very first sign-in. */
|
|
127
|
+
firstSignIns: number;
|
|
128
|
+
/** Failed for an e-mail or a code that matches no account (counted, never stored). */
|
|
129
|
+
unknownAccount: number;
|
|
130
|
+
byMethod: AccountAnalyticsMethodRow[];
|
|
131
|
+
/** INVALID_CREDENTIALS, UNVERIFIED, UNKNOWN_ACCOUNT, INVALID_TOKEN, ERROR... */
|
|
132
|
+
failureReasons: AccountAnalyticsCount[];
|
|
133
|
+
averageDailyUsers: number;
|
|
134
|
+
peakDailyUsers: number;
|
|
135
|
+
/** YYYY-MM-DD, local to the range's time zone. */
|
|
136
|
+
peakDay: string | null;
|
|
137
|
+
}
|
|
138
|
+
export interface AccountAnalyticsOtpActionRow {
|
|
139
|
+
/** What the code was for: login, register, verify_phone, reset_password, create_user... */
|
|
140
|
+
action: string;
|
|
141
|
+
sent: number;
|
|
142
|
+
verified: number;
|
|
143
|
+
}
|
|
144
|
+
export interface AccountAnalyticsOtp {
|
|
145
|
+
/** First sends and resends. */
|
|
146
|
+
sent: number;
|
|
147
|
+
resent: number;
|
|
148
|
+
/** Refused for asking too often. */
|
|
149
|
+
refused: number;
|
|
150
|
+
verified: number;
|
|
151
|
+
failed: number;
|
|
152
|
+
/** verified / (verified + failed); null with none. */
|
|
153
|
+
successRate: number | null;
|
|
154
|
+
/** From a code being sent to it being confirmed. */
|
|
155
|
+
medianSecondsToVerify: number | null;
|
|
156
|
+
byAction: AccountAnalyticsOtpActionRow[];
|
|
157
|
+
/** INVALID_OTP, EXPIRED_OTP, NO_OTP, INVALID_TOKEN. */
|
|
158
|
+
failureReasons: AccountAnalyticsCount[];
|
|
159
|
+
}
|
|
160
|
+
export interface AccountAnalyticsPasswords {
|
|
161
|
+
resetRequested: number;
|
|
162
|
+
resetCompleted: number;
|
|
163
|
+
resetFailed: number;
|
|
164
|
+
changed: number;
|
|
165
|
+
changeFailed: number;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The people an account holder chose to be alerted when they raise an SOS: app users
|
|
169
|
+
* (a two-way link, which the guardian accepts) and people reached by SMS.
|
|
170
|
+
*/
|
|
171
|
+
export interface AccountAnalyticsGuardians {
|
|
172
|
+
/** Accepted app-guardian links at the end of the period. */
|
|
173
|
+
links: number;
|
|
174
|
+
/** Links made in the period. */
|
|
175
|
+
linksCreated: number;
|
|
176
|
+
/** Accounts with at least one accepted app guardian, at the end of the period. */
|
|
177
|
+
protectedAccounts: number;
|
|
178
|
+
/** Distinct app users guarding somebody. */
|
|
179
|
+
guardians: number;
|
|
180
|
+
/** Share of app (Mobile-User) accounts with at least one guardian of either kind, now. */
|
|
181
|
+
mobileCoverage: number | null;
|
|
182
|
+
pending: number;
|
|
183
|
+
rejected: number;
|
|
184
|
+
/** Links with the guardian marked primary. */
|
|
185
|
+
primary: number;
|
|
186
|
+
/** Guardians reached by SMS, and the accounts that have one - now. */
|
|
187
|
+
smsGuardians: number;
|
|
188
|
+
accountsWithSmsGuardians: number;
|
|
189
|
+
byRelationship: AccountAnalyticsCount[];
|
|
190
|
+
}
|
|
191
|
+
/** Requests to delete an account, and why. */
|
|
192
|
+
export interface AccountAnalyticsDeletions {
|
|
193
|
+
requested: number;
|
|
194
|
+
/** Every request ever made in scope. */
|
|
195
|
+
total: number;
|
|
196
|
+
/** Requesters whose account still exists now. */
|
|
197
|
+
stillPresent: number;
|
|
198
|
+
byReason: AccountAnalyticsCount[];
|
|
199
|
+
}
|
|
200
|
+
export interface AccountAnalyticsPoint {
|
|
201
|
+
/** The bucket's start, local to the range's time zone, without an offset ("2026-09-21T00:00:00"). */
|
|
202
|
+
bucket: string;
|
|
203
|
+
created: number;
|
|
204
|
+
createdMobile: number;
|
|
205
|
+
createdStaff: number;
|
|
206
|
+
/** Of those created in the bucket: verified, signed in - as they stand now. */
|
|
207
|
+
createdVerified: number;
|
|
208
|
+
createdSignedIn: number;
|
|
209
|
+
/** Accounts in existence at the end of the bucket. */
|
|
210
|
+
totalAccounts: number;
|
|
211
|
+
signIns: number;
|
|
212
|
+
failedSignIns: number;
|
|
213
|
+
/** Distinct accounts that signed in during the bucket (activity log). */
|
|
214
|
+
activeUsers: number;
|
|
215
|
+
otpSent: number;
|
|
216
|
+
otpVerified: number;
|
|
217
|
+
deletionRequests: number;
|
|
218
|
+
guardianLinks: number;
|
|
219
|
+
}
|
|
220
|
+
/** When accounts are created and used, by weekday (1 = Monday) and hour. */
|
|
221
|
+
export interface AccountAnalyticsHeatCell {
|
|
222
|
+
weekday: number;
|
|
223
|
+
hour: number;
|
|
224
|
+
signUps: number;
|
|
225
|
+
signIns: number;
|
|
226
|
+
}
|
|
227
|
+
/** The previous period of the same length, for the change on each headline figure. Absent for "forever". */
|
|
228
|
+
export interface AccountAnalyticsPrevious {
|
|
229
|
+
from: string;
|
|
230
|
+
to: string;
|
|
231
|
+
created: number;
|
|
232
|
+
activeInPeriod: number;
|
|
233
|
+
signIns: number;
|
|
234
|
+
failedSignIns: number;
|
|
235
|
+
otpSent: number;
|
|
236
|
+
otpVerified: number;
|
|
237
|
+
deletionRequests: number;
|
|
238
|
+
guardianLinks: number;
|
|
239
|
+
}
|
|
240
|
+
/** A Super-Admin's view of every organization: one row each, biggest first. */
|
|
241
|
+
export interface AccountAnalyticsOrganizationRow {
|
|
242
|
+
organizationId: number;
|
|
243
|
+
total: number;
|
|
244
|
+
created: number;
|
|
245
|
+
active: number;
|
|
246
|
+
mobile: number;
|
|
247
|
+
staff: number;
|
|
248
|
+
signIns: number;
|
|
249
|
+
failedSignIns: number;
|
|
250
|
+
}
|
|
251
|
+
export interface AccountAnalytics {
|
|
252
|
+
/** Whose figures: one organization (and one control centre in it), or null for every organization. */
|
|
253
|
+
organizationId: number | null;
|
|
254
|
+
controlCentreId: number | null;
|
|
255
|
+
range: AccountAnalyticsRange;
|
|
256
|
+
generatedAt: string;
|
|
257
|
+
/** When the activity log's first record in scope was made; null while it is empty. */
|
|
258
|
+
activitySince: string | null;
|
|
259
|
+
previous: AccountAnalyticsPrevious | null;
|
|
260
|
+
timeline: AccountAnalyticsPoint[];
|
|
261
|
+
/** All 168 hours of the week, Monday first, zeros included. */
|
|
262
|
+
heatmap: AccountAnalyticsHeatCell[];
|
|
263
|
+
accounts: AccountAnalyticsAccounts;
|
|
264
|
+
signIns: AccountAnalyticsSignIns;
|
|
265
|
+
otp: AccountAnalyticsOtp;
|
|
266
|
+
passwords: AccountAnalyticsPasswords;
|
|
267
|
+
guardians: AccountAnalyticsGuardians;
|
|
268
|
+
deletions: AccountAnalyticsDeletions;
|
|
269
|
+
/** A Super-Admin looking at every organization only. */
|
|
270
|
+
byOrganization?: AccountAnalyticsOrganizationRow[];
|
|
271
|
+
}
|
|
272
|
+
/** What a dashboard asks: the period, and - for a Super-Admin - whose figures. */
|
|
273
|
+
export interface AccountAnalyticsQuery {
|
|
274
|
+
from?: string;
|
|
275
|
+
to?: string;
|
|
276
|
+
timeZone?: string;
|
|
277
|
+
organizationId?: number;
|
|
278
|
+
}
|