@frontegg/rest-api 3.0.6 → 3.0.9

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/auth/index.js CHANGED
@@ -51,7 +51,9 @@ export async function generateLoginResponseFromOAuthResponse(oauthResponse) {
51
51
  mfaRequired: false,
52
52
  accessToken: oauthResponse.id_token,
53
53
  refreshToken: oauthResponse.refresh_token
54
- }, decodedContent, me);
54
+ }, decodedContent, me, {
55
+ expiresIn: decodedContent.exp ? decodedContent.exp - new Date().getTime() / 1000 : 300
56
+ });
55
57
 
56
58
  ContextHolder.setUser(user);
57
59
  return user;
package/constants.d.ts CHANGED
@@ -118,6 +118,11 @@ export declare const urls: {
118
118
  tenantConfiguration: {
119
119
  v1: string;
120
120
  };
121
+ configurations: {
122
+ vendorPublicConfigurations: {
123
+ v1: string;
124
+ };
125
+ };
121
126
  paymentProviders: {
122
127
  stripe: {
123
128
  customers: {
package/constants.js CHANGED
@@ -118,6 +118,11 @@ export const urls = {
118
118
  tenantConfiguration: {
119
119
  v1: '/subscriptions/resources/billing/tenant-configurations/v1'
120
120
  },
121
+ configurations: {
122
+ vendorPublicConfigurations: {
123
+ v1: '/subscriptions/resources/billing/configurations/vendor-public-configurations/v1'
124
+ }
125
+ },
121
126
  paymentProviders: {
122
127
  stripe: {
123
128
  customers: {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.6
1
+ /** @license Frontegg v3.0.9
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -273,7 +273,9 @@ async function generateLoginResponseFromOAuthResponse(oauthResponse) {
273
273
  mfaRequired: false,
274
274
  accessToken: oauthResponse.id_token,
275
275
  refreshToken: oauthResponse.refresh_token
276
- }, decodedContent, me);
276
+ }, decodedContent, me, {
277
+ expiresIn: decodedContent.exp ? decodedContent.exp - new Date().getTime() / 1000 : 300
278
+ });
277
279
 
278
280
  _ContextHolder.ContextHolder.setUser(user);
279
281
 
package/node/constants.js CHANGED
@@ -124,6 +124,11 @@ const urls = {
124
124
  tenantConfiguration: {
125
125
  v1: '/subscriptions/resources/billing/tenant-configurations/v1'
126
126
  },
127
+ configurations: {
128
+ vendorPublicConfigurations: {
129
+ v1: '/subscriptions/resources/billing/configurations/vendor-public-configurations/v1'
130
+ }
131
+ },
127
132
  paymentProviders: {
128
133
  stripe: {
129
134
  customers: {
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.6
1
+ /** @license Frontegg v3.0.9
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ProviderType = exports.PaymentMethodType = exports.ISubscriptionStatus = exports.ISubscriptionCancellationPolicy = void 0;
6
+ exports.TrialEndAction = exports.TenantCreatedAction = exports.ProviderType = exports.PaymentMethodType = exports.ISubscriptionStatus = exports.ISubscriptionCancellationPolicy = void 0;
7
7
  let ISubscriptionStatus;
8
8
  exports.ISubscriptionStatus = ISubscriptionStatus;
9
9
 
@@ -36,4 +36,19 @@ exports.ProviderType = ProviderType;
36
36
 
37
37
  (function (ProviderType) {
38
38
  ProviderType["Stripe"] = "Stripe";
39
- })(ProviderType || (exports.ProviderType = ProviderType = {}));
39
+ })(ProviderType || (exports.ProviderType = ProviderType = {}));
40
+
41
+ let TrialEndAction;
42
+ exports.TrialEndAction = TrialEndAction;
43
+
44
+ (function (TrialEndAction) {
45
+ TrialEndAction["CHANGE_TO_DEFAULT"] = "change_to_default";
46
+ TrialEndAction["RETAIN_TRIAL"] = "retain_trial";
47
+ })(TrialEndAction || (exports.TrialEndAction = TrialEndAction = {}));
48
+
49
+ let TenantCreatedAction;
50
+ exports.TenantCreatedAction = TenantCreatedAction;
51
+
52
+ (function (TenantCreatedAction) {
53
+ TenantCreatedAction["CREATE"] = "create_customer";
54
+ })(TenantCreatedAction || (exports.TenantCreatedAction = TenantCreatedAction = {}));
@@ -121,6 +121,19 @@ Object.keys(_paymentProviders).forEach(function (key) {
121
121
  });
122
122
  });
123
123
 
124
+ var _vendorPublicConfigurations = require("./vendorPublicConfigurations");
125
+
126
+ Object.keys(_vendorPublicConfigurations).forEach(function (key) {
127
+ if (key === "default" || key === "__esModule") return;
128
+ if (key in exports && exports[key] === _vendorPublicConfigurations[key]) return;
129
+ Object.defineProperty(exports, key, {
130
+ enumerable: true,
131
+ get: function () {
132
+ return _vendorPublicConfigurations[key];
133
+ }
134
+ });
135
+ });
136
+
124
137
  var _enums = require("./enums");
125
138
 
126
139
  Object.keys(_enums).forEach(function (key) {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getVendorPublicConfigurations = getVendorPublicConfigurations;
7
+
8
+ var _fetch = require("../fetch");
9
+
10
+ var _constants = require("../constants");
11
+
12
+ async function getVendorPublicConfigurations() {
13
+ return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.configurations.vendorPublicConfigurations.v1}`);
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.0.6",
3
+ "version": "3.0.9",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -16,3 +16,10 @@ export declare enum ISubscriptionCancellationPolicy {
16
16
  export declare enum ProviderType {
17
17
  Stripe = "Stripe"
18
18
  }
19
+ export declare enum TrialEndAction {
20
+ CHANGE_TO_DEFAULT = "change_to_default",
21
+ RETAIN_TRIAL = "retain_trial"
22
+ }
23
+ export declare enum TenantCreatedAction {
24
+ CREATE = "create_customer"
25
+ }
@@ -26,4 +26,17 @@ export let ProviderType;
26
26
 
27
27
  (function (ProviderType) {
28
28
  ProviderType["Stripe"] = "Stripe";
29
- })(ProviderType || (ProviderType = {}));
29
+ })(ProviderType || (ProviderType = {}));
30
+
31
+ export let TrialEndAction;
32
+
33
+ (function (TrialEndAction) {
34
+ TrialEndAction["CHANGE_TO_DEFAULT"] = "change_to_default";
35
+ TrialEndAction["RETAIN_TRIAL"] = "retain_trial";
36
+ })(TrialEndAction || (TrialEndAction = {}));
37
+
38
+ export let TenantCreatedAction;
39
+
40
+ (function (TenantCreatedAction) {
41
+ TenantCreatedAction["CREATE"] = "create_customer";
42
+ })(TenantCreatedAction || (TenantCreatedAction = {}));
@@ -1,10 +1,11 @@
1
- export * from './subscriptions';
2
- export * from './managedSubscriptions';
3
- export * from './plans';
4
- export * from './invoices';
5
- export * from './paymentMethods';
6
- export * from './providers';
7
- export * from './summaries';
8
- export * from './tenantConfiguration';
9
- export * from './paymentProviders';
10
- export * from './enums';
1
+ export * from "./subscriptions";
2
+ export * from "./managedSubscriptions";
3
+ export * from "./plans";
4
+ export * from "./invoices";
5
+ export * from "./paymentMethods";
6
+ export * from "./providers";
7
+ export * from "./summaries";
8
+ export * from "./tenantConfiguration";
9
+ export * from "./paymentProviders";
10
+ export * from "./vendorPublicConfigurations";
11
+ export * from "./enums";
@@ -1,10 +1,11 @@
1
- export * from './subscriptions';
2
- export * from './managedSubscriptions';
3
- export * from './plans';
4
- export * from './invoices';
5
- export * from './paymentMethods';
6
- export * from './providers';
7
- export * from './summaries';
8
- export * from './tenantConfiguration';
9
- export * from './paymentProviders';
10
- export * from './enums';
1
+ export * from "./subscriptions";
2
+ export * from "./managedSubscriptions";
3
+ export * from "./plans";
4
+ export * from "./invoices";
5
+ export * from "./paymentMethods";
6
+ export * from "./providers";
7
+ export * from "./summaries";
8
+ export * from "./tenantConfiguration";
9
+ export * from "./paymentProviders";
10
+ export * from "./vendorPublicConfigurations";
11
+ export * from "./enums";
@@ -115,3 +115,7 @@ export interface IUpdateManagedSubscriptionRequest {
115
115
  paymentMethodId: string;
116
116
  planId: string;
117
117
  }
118
+ export interface IVendorPublicConfigurationResponse {
119
+ allowPlanDowngrade: boolean;
120
+ allowPlanCancellation: boolean;
121
+ }
@@ -0,0 +1,2 @@
1
+ import { IVendorPublicConfigurationResponse } from "./interfaces";
2
+ export declare function getVendorPublicConfigurations(): Promise<IVendorPublicConfigurationResponse[]>;
@@ -0,0 +1,5 @@
1
+ import { Get } from "../fetch";
2
+ import { urls } from "../constants";
3
+ export async function getVendorPublicConfigurations() {
4
+ return Get(`${urls.subscriptions.billing.configurations.vendorPublicConfigurations.v1}`);
5
+ }