bkper-js 2.29.1 → 2.29.3
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/lib/index.d.ts +2 -1
- package/lib/model/App.js +2 -2
- package/lib/model/Billing.js +6 -5
- package/lib/service/user-service.js +8 -3
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1340,10 +1340,11 @@ export declare class Billing extends Resource<bkper.Billing> {
|
|
|
1340
1340
|
* @param plan - The plan to checkout
|
|
1341
1341
|
* @param successUrl - The URL to redirect to after the User has successfully checked out
|
|
1342
1342
|
* @param cancelUrl - The URL to redirect to in case the checkout is cancelled
|
|
1343
|
+
* @param cycle - The billing cycle to checkout - "monthly" (default) or "yearly"
|
|
1343
1344
|
*
|
|
1344
1345
|
* @returns The URL to redirect the User to the billing checkout
|
|
1345
1346
|
*/
|
|
1346
|
-
getCheckoutUrl(plan: string, successUrl?: string, cancelUrl?: string): Promise<string | undefined>;
|
|
1347
|
+
getCheckoutUrl(plan: string, successUrl?: string, cancelUrl?: string, cycle?: string): Promise<string | undefined>;
|
|
1347
1348
|
}
|
|
1348
1349
|
|
|
1349
1350
|
/**
|
package/lib/model/App.js
CHANGED
|
@@ -261,7 +261,7 @@ export class App extends Resource {
|
|
|
261
261
|
* @returns The readme text
|
|
262
262
|
*/
|
|
263
263
|
getReadme() {
|
|
264
|
-
return this.payload.readme;
|
|
264
|
+
return this.payload.readmeMd || this.payload.readme;
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
267
|
* Sets the readme.md file as text.
|
|
@@ -271,7 +271,7 @@ export class App extends Resource {
|
|
|
271
271
|
* @returns This App, for chaining
|
|
272
272
|
*/
|
|
273
273
|
setReadme(readme) {
|
|
274
|
-
this.payload.
|
|
274
|
+
this.payload.readmeMd = readme;
|
|
275
275
|
return this;
|
|
276
276
|
}
|
|
277
277
|
/**
|
package/lib/model/Billing.js
CHANGED
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Resource } from
|
|
11
|
-
import { Bkper } from
|
|
12
|
-
import * as UserService from
|
|
10
|
+
import { Resource } from './Resource.js';
|
|
11
|
+
import { Bkper } from './Bkper.js';
|
|
12
|
+
import * as UserService from '../service/user-service.js';
|
|
13
13
|
/**
|
|
14
14
|
* This class defines the Billing information for a [[User]].
|
|
15
15
|
*
|
|
@@ -136,12 +136,13 @@ export class Billing extends Resource {
|
|
|
136
136
|
* @param plan - The plan to checkout
|
|
137
137
|
* @param successUrl - The URL to redirect to after the User has successfully checked out
|
|
138
138
|
* @param cancelUrl - The URL to redirect to in case the checkout is cancelled
|
|
139
|
+
* @param cycle - The billing cycle to checkout - "monthly" (default) or "yearly"
|
|
139
140
|
*
|
|
140
141
|
* @returns The URL to redirect the User to the billing checkout
|
|
141
142
|
*/
|
|
142
|
-
getCheckoutUrl(plan, successUrl, cancelUrl) {
|
|
143
|
+
getCheckoutUrl(plan, successUrl, cancelUrl, cycle) {
|
|
143
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const urlPayload = yield UserService.getBillingCheckoutUrl(plan, successUrl, cancelUrl, this.getConfig());
|
|
145
|
+
const urlPayload = yield UserService.getBillingCheckoutUrl(plan, successUrl, cancelUrl, cycle, this.getConfig());
|
|
145
146
|
return urlPayload === null || urlPayload === void 0 ? void 0 : urlPayload.url;
|
|
146
147
|
});
|
|
147
148
|
}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { HttpApiV5Request } from
|
|
10
|
+
import { HttpApiV5Request } from './http-api-request.js';
|
|
11
11
|
export function getUser(config) {
|
|
12
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
13
|
const res = yield new HttpApiV5Request(`user`, config).setMethod('GET').fetch();
|
|
@@ -28,13 +28,18 @@ export function getBillingCounts(config) {
|
|
|
28
28
|
}
|
|
29
29
|
export function getBillingPortalUrl(returnUrl, config) {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const res = yield new HttpApiV5Request(`user/billing/portal`, config)
|
|
31
|
+
const res = yield new HttpApiV5Request(`user/billing/portal`, config)
|
|
32
|
+
.addParam('returnUrl', returnUrl)
|
|
33
|
+
.fetch();
|
|
32
34
|
return res.data;
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
|
-
export function getBillingCheckoutUrl(plan, successUrl, cancelUrl, config) {
|
|
37
|
+
export function getBillingCheckoutUrl(plan, successUrl, cancelUrl, cycle, config) {
|
|
36
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
39
|
const request = new HttpApiV5Request(`user/billing/checkout`, config).addParam('plan', plan);
|
|
40
|
+
if (cycle) {
|
|
41
|
+
request.addParam('cycle', cycle);
|
|
42
|
+
}
|
|
38
43
|
if (successUrl) {
|
|
39
44
|
request.addParam('successUrl', successUrl);
|
|
40
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper-js",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.3",
|
|
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
|
"dependencies": {
|
|
38
|
-
"@bkper/bkper-api-types": "^5.
|
|
38
|
+
"@bkper/bkper-api-types": "^5.36.0",
|
|
39
39
|
"big.js": "^6.0.3",
|
|
40
40
|
"dayjs": "^1.10.3",
|
|
41
41
|
"luxon": "^1.25.0",
|