@bunnyapp/api-client 1.0.14 → 1.0.16

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 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,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/api-client",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Node.js client for Bunny CRM",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -1,13 +1,19 @@
1
- const query = `mutation portalSessionCreate ($tenantCode: String!) {
2
- portalSessionCreate (tenantCode: $tenantCode) {
3
- token
4
- errors
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 (tenantCode) {
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
  };
@@ -39,6 +39,7 @@ module.exports = async function (priceListCode, options = {}) {
39
39
  attributes: {
40
40
  priceListCode: priceListCode,
41
41
  trial: options["trial"] || false,
42
+ evergreen: options["evergreen"] || false,
42
43
  },
43
44
  };
44
45