@bunnyapp/api-client 1.0.14 → 1.0.15
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 +6 -0
- package/package.json +1 -1
- package/src/helpers/create-portal-session.js +11 -5
package/README.md
CHANGED
|
@@ -57,6 +57,12 @@ bunny.createSubscription("priceListCode", {
|
|
|
57
57
|
// Get a session token for the Bunny customer portal
|
|
58
58
|
bunny.createPortalSession("tenantCode");
|
|
59
59
|
|
|
60
|
+
// Optionally supply a return url to get back to your app
|
|
61
|
+
bunny.createPortalSession("tenantCode", "https://example.com");
|
|
62
|
+
|
|
63
|
+
// Default session length is 24 hours but you can change it. e.g 12 hours
|
|
64
|
+
bunny.createPortalSession("tenantCode", "https://example.com", 12);
|
|
65
|
+
|
|
60
66
|
// Track usage for billing
|
|
61
67
|
bunny.trackUsage(featureCode, quantity, tenantCode, usageAt);
|
|
62
68
|
```
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
const query = `mutation portalSessionCreate ($tenantCode: String!) {
|
|
2
|
-
portalSessionCreate (tenantCode: $tenantCode) {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const query = `mutation portalSessionCreate ($tenantCode: String!, $expiry: Int!, $returnUrl: String!) {
|
|
2
|
+
portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry, returnUrl: $returnUrl) {
|
|
3
|
+
errors
|
|
4
|
+
token
|
|
5
5
|
}
|
|
6
6
|
}`;
|
|
7
7
|
|
|
8
|
-
module.exports = async function (
|
|
8
|
+
module.exports = async function (
|
|
9
|
+
tenantCode,
|
|
10
|
+
returnUrl = null,
|
|
11
|
+
expiryInHours = 24
|
|
12
|
+
) {
|
|
9
13
|
let variables = {
|
|
10
14
|
tenantCode: tenantCode,
|
|
15
|
+
returnUrl: returnUrl,
|
|
16
|
+
expiry: expiryInHours,
|
|
11
17
|
};
|
|
12
18
|
return this.query(query, variables);
|
|
13
19
|
};
|