bkper-js 2.20.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lib/index.d.ts +64 -27
- package/lib/index.js +1 -0
- package/lib/model/Billing.js +84 -0
- package/lib/model/User.js +9 -36
- package/lib/service/user-service.js +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
See what's new and what has changed in bkper-js
|
|
4
4
|
|
|
5
|
+
## 2026
|
|
6
|
+
|
|
7
|
+
**January 2026**
|
|
8
|
+
- Added `App.setUsers`
|
|
9
|
+
- Added `App.getUsers`
|
|
10
|
+
- Added `App.setDevelopers`
|
|
11
|
+
- Added `App.getDevelopers`
|
|
12
|
+
- Added `Config.agentIdProvider`
|
|
13
|
+
- Added `User.getBillingAdminEmail`
|
|
14
|
+
- Added `User.getTotalTransactionsThisMonth`
|
|
15
|
+
- Added `User.getTotalTransactionsThisYear`
|
|
16
|
+
- Added `User.getUsername`
|
|
17
|
+
- Added `User.isPlanOverdue`
|
|
18
|
+
- Removed `App.setUserEmails` from `App`. Use `App.setUsers` instead
|
|
19
|
+
- Removed `App.setDeveloperEmail` from `App`. Use `App.setDevelopers` instead
|
|
20
|
+
|
|
5
21
|
## 2025
|
|
6
22
|
|
|
7
23
|
**December 2025**
|
package/lib/index.d.ts
CHANGED
|
@@ -1165,6 +1165,67 @@ export declare enum BalanceType {
|
|
|
1165
1165
|
CUMULATIVE = "CUMULATIVE"
|
|
1166
1166
|
}
|
|
1167
1167
|
|
|
1168
|
+
/**
|
|
1169
|
+
* This class defines the Billing information for a [[User]].
|
|
1170
|
+
*
|
|
1171
|
+
* The Billing information includes the plan, the admin email, and the billing portal URL.
|
|
1172
|
+
*
|
|
1173
|
+
* @public
|
|
1174
|
+
*/
|
|
1175
|
+
export declare class Billing extends Resource<bkper.Billing> {
|
|
1176
|
+
private config?;
|
|
1177
|
+
constructor(json?: bkper.Billing, config?: Config);
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Tells if billing is enabled for the User.
|
|
1181
|
+
*
|
|
1182
|
+
* @returns True if billing is enabled for the User
|
|
1183
|
+
*/
|
|
1184
|
+
isEnabled(): boolean | undefined;
|
|
1185
|
+
/**
|
|
1186
|
+
* Gets the current plan of the User.
|
|
1187
|
+
*
|
|
1188
|
+
* @returns The User's plan
|
|
1189
|
+
*/
|
|
1190
|
+
getPlan(): string | undefined;
|
|
1191
|
+
/**
|
|
1192
|
+
* Tells if the User's current plan payment is overdue.
|
|
1193
|
+
*
|
|
1194
|
+
* @returns True if the plan payment is overdue
|
|
1195
|
+
*/
|
|
1196
|
+
isPlanOverdue(): boolean | undefined;
|
|
1197
|
+
/**
|
|
1198
|
+
* Gets the admin email for this User's billing account.
|
|
1199
|
+
*
|
|
1200
|
+
* @returns The billing admin email
|
|
1201
|
+
*/
|
|
1202
|
+
getAdminEmail(): string | undefined;
|
|
1203
|
+
/**
|
|
1204
|
+
* Tells if the User has started the trial period.
|
|
1205
|
+
*
|
|
1206
|
+
* @returns True if the User has started the trial period
|
|
1207
|
+
*/
|
|
1208
|
+
hasStartedTrial(): boolean | undefined;
|
|
1209
|
+
/**
|
|
1210
|
+
* Gets the number of days left in User's trial period.
|
|
1211
|
+
*
|
|
1212
|
+
* @returns The number of days left in trial period
|
|
1213
|
+
*/
|
|
1214
|
+
getDaysLeftInTrial(): number | undefined;
|
|
1215
|
+
/**
|
|
1216
|
+
* Gets the number of total transactions this month for the User's billing account.
|
|
1217
|
+
*
|
|
1218
|
+
* @returns The number of total transactions this month
|
|
1219
|
+
*/
|
|
1220
|
+
getTotalTransactionsThisMonth(): number | undefined;
|
|
1221
|
+
/**
|
|
1222
|
+
* Gets the number of total transactions this year for the User's billing account.
|
|
1223
|
+
*
|
|
1224
|
+
* @returns The number of total transactions this year
|
|
1225
|
+
*/
|
|
1226
|
+
getTotalTransactionsThisYear(): number | undefined;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1168
1229
|
/**
|
|
1169
1230
|
* This is the main entry point of the [bkper-js](https://www.npmjs.com/package/bkper-js) library.
|
|
1170
1231
|
*
|
|
@@ -3688,35 +3749,11 @@ export declare class User extends Resource<bkper.User> {
|
|
|
3688
3749
|
*/
|
|
3689
3750
|
getUsername(): string | undefined;
|
|
3690
3751
|
/**
|
|
3691
|
-
*
|
|
3692
|
-
*
|
|
3693
|
-
* @returns True if the User is in the free plan
|
|
3694
|
-
*/
|
|
3695
|
-
isFree(): boolean | undefined;
|
|
3696
|
-
/**
|
|
3697
|
-
* Gets the plan of the User.
|
|
3698
|
-
*
|
|
3699
|
-
* @returns The User's plan
|
|
3700
|
-
*/
|
|
3701
|
-
getPlan(): string | undefined;
|
|
3702
|
-
/**
|
|
3703
|
-
* Tells if billing is enabled for the User.
|
|
3704
|
-
*
|
|
3705
|
-
* @returns True if billing is enabled for the User
|
|
3706
|
-
*/
|
|
3707
|
-
hasBillingEnabled(): boolean | undefined;
|
|
3708
|
-
/**
|
|
3709
|
-
* Tells if the User has started the trial.
|
|
3752
|
+
* Gets the billing information for this User.
|
|
3710
3753
|
*
|
|
3711
|
-
* @returns
|
|
3754
|
+
* @returns The User's billing information
|
|
3712
3755
|
*/
|
|
3713
|
-
|
|
3714
|
-
/**
|
|
3715
|
-
* Gets the days left in User's trial.
|
|
3716
|
-
*
|
|
3717
|
-
* @returns The User's days left in trial
|
|
3718
|
-
*/
|
|
3719
|
-
getDaysLeftInTrial(): number | undefined;
|
|
3756
|
+
getBilling(): Promise<Billing>;
|
|
3720
3757
|
/**
|
|
3721
3758
|
* Tells if the User has already used [[Connections]].
|
|
3722
3759
|
*
|
package/lib/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { Backlog } from "./model/Backlog.js";
|
|
|
13
13
|
export { Balance } from "./model/Balance.js";
|
|
14
14
|
export { BalancesDataTableBuilder } from "./model/BalancesDataTableBuilder.js";
|
|
15
15
|
export { BalancesReport } from "./model/BalancesReport.js";
|
|
16
|
+
export { Billing } from "./model/Billing.js";
|
|
16
17
|
export { Bkper } from "./model/Bkper.js";
|
|
17
18
|
export { Book } from "./model/Book.js";
|
|
18
19
|
export { Collaborator } from "./model/Collaborator.js";
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Resource } from "./Resource.js";
|
|
2
|
+
import { Bkper } from "./Bkper.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class defines the Billing information for a [[User]].
|
|
5
|
+
*
|
|
6
|
+
* The Billing information includes the plan, the admin email, and the billing portal URL.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class Billing extends Resource {
|
|
11
|
+
constructor(json, config) {
|
|
12
|
+
super(json);
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
16
|
+
getConfig() {
|
|
17
|
+
return this.config || Bkper.globalConfig;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Tells if billing is enabled for the User.
|
|
21
|
+
*
|
|
22
|
+
* @returns True if billing is enabled for the User
|
|
23
|
+
*/
|
|
24
|
+
isEnabled() {
|
|
25
|
+
return this.payload.enabled;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the current plan of the User.
|
|
29
|
+
*
|
|
30
|
+
* @returns The User's plan
|
|
31
|
+
*/
|
|
32
|
+
getPlan() {
|
|
33
|
+
return this.payload.plan;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Tells if the User's current plan payment is overdue.
|
|
37
|
+
*
|
|
38
|
+
* @returns True if the plan payment is overdue
|
|
39
|
+
*/
|
|
40
|
+
isPlanOverdue() {
|
|
41
|
+
return this.payload.planOverdue;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the admin email for this User's billing account.
|
|
45
|
+
*
|
|
46
|
+
* @returns The billing admin email
|
|
47
|
+
*/
|
|
48
|
+
getAdminEmail() {
|
|
49
|
+
return this.payload.adminEmail;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Tells if the User has started the trial period.
|
|
53
|
+
*
|
|
54
|
+
* @returns True if the User has started the trial period
|
|
55
|
+
*/
|
|
56
|
+
hasStartedTrial() {
|
|
57
|
+
return this.payload.startedTrial;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets the number of days left in User's trial period.
|
|
61
|
+
*
|
|
62
|
+
* @returns The number of days left in trial period
|
|
63
|
+
*/
|
|
64
|
+
getDaysLeftInTrial() {
|
|
65
|
+
return this.payload.daysLeftInTrial;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets the number of total transactions this month for the User's billing account.
|
|
69
|
+
*
|
|
70
|
+
* @returns The number of total transactions this month
|
|
71
|
+
*/
|
|
72
|
+
getTotalTransactionsThisMonth() {
|
|
73
|
+
return this.payload.totalTransactionsThisMonth;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Gets the number of total transactions this year for the User's billing account.
|
|
77
|
+
*
|
|
78
|
+
* @returns The number of total transactions this year
|
|
79
|
+
*/
|
|
80
|
+
getTotalTransactionsThisYear() {
|
|
81
|
+
return this.payload.totalTransactionsThisYear;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=Billing.js.map
|
package/lib/model/User.js
CHANGED
|
@@ -11,6 +11,8 @@ import { Connection } from "./Connection.js";
|
|
|
11
11
|
import { Resource } from "./Resource.js";
|
|
12
12
|
import { Bkper } from "./Bkper.js";
|
|
13
13
|
import * as ConnectionService from "../service/connection-service.js";
|
|
14
|
+
import * as UserService from "../service/user-service.js";
|
|
15
|
+
import { Billing } from "./Billing.js";
|
|
14
16
|
/**
|
|
15
17
|
* This class defines a User on the Bkper platform.
|
|
16
18
|
*
|
|
@@ -86,44 +88,15 @@ export class User extends Resource {
|
|
|
86
88
|
return this.payload.username;
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
|
-
*
|
|
91
|
+
* Gets the billing information for this User.
|
|
90
92
|
*
|
|
91
|
-
* @returns
|
|
93
|
+
* @returns The User's billing information
|
|
92
94
|
*/
|
|
93
|
-
|
|
94
|
-
return this
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
* @returns The User's plan
|
|
100
|
-
*/
|
|
101
|
-
getPlan() {
|
|
102
|
-
return this.payload.plan;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Tells if billing is enabled for the User.
|
|
106
|
-
*
|
|
107
|
-
* @returns True if billing is enabled for the User
|
|
108
|
-
*/
|
|
109
|
-
hasBillingEnabled() {
|
|
110
|
-
return this.payload.billingEnabled;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Tells if the User has started the trial.
|
|
114
|
-
*
|
|
115
|
-
* @returns True if the User has started the trial
|
|
116
|
-
*/
|
|
117
|
-
hasStartedTrial() {
|
|
118
|
-
return this.payload.startedTrial;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Gets the days left in User's trial.
|
|
122
|
-
*
|
|
123
|
-
* @returns The User's days left in trial
|
|
124
|
-
*/
|
|
125
|
-
getDaysLeftInTrial() {
|
|
126
|
-
return this.payload.daysLeftInTrial;
|
|
95
|
+
getBilling() {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const payload = yield UserService.getBilling(this.getConfig());
|
|
98
|
+
return new Billing(payload, this.config);
|
|
99
|
+
});
|
|
127
100
|
}
|
|
128
101
|
/**
|
|
129
102
|
* Tells if the User has already used [[Connections]].
|
|
@@ -14,6 +14,12 @@ export function getUser(config) {
|
|
|
14
14
|
return res.data;
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
+
export function getBilling(config) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const res = yield new HttpApiV5Request(`user/billing`, config).setMethod('GET').fetch();
|
|
20
|
+
return res.data;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
17
23
|
export function getBillingPortalUrl(returnUrl, config) {
|
|
18
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
25
|
const res = yield new HttpApiV5Request(`user/billing/portal`, config).addParam('returnUrl', returnUrl).fetch();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0",
|
|
4
4
|
"description": "Javascript client for Bkper REST API",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@bkper/bkper-api-types": "^5.
|
|
38
|
+
"@bkper/bkper-api-types": "^5.34.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"big.js": "^6.0.3",
|