@frontegg/rest-api 3.1.51 → 3.1.53

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/fetch.d.ts CHANGED
@@ -11,6 +11,7 @@ interface RequestOptions {
11
11
  }
12
12
  export declare function getBaseUrl(context: ContextOptions, url: string, withFronteggPrefix?: boolean): string;
13
13
  export declare function getMetadataHeaders(context: ContextOptions): Record<string, string>;
14
+ export declare function getScopedTenant(): string | null;
14
15
  export declare const Get: (url: string, params?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
15
16
  export declare const Post: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
16
17
  export declare const Patch: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
package/fetch.js CHANGED
@@ -55,6 +55,16 @@ export function getMetadataHeaders(context) {
55
55
 
56
56
  return headers;
57
57
  }
58
+ export function getScopedTenant() {
59
+ const urlParams = new URLSearchParams(window.location.search);
60
+ const scopedTenant = urlParams.get('tenantId');
61
+
62
+ if (scopedTenant) {
63
+ return scopedTenant;
64
+ }
65
+
66
+ return null;
67
+ }
58
68
 
59
69
  async function buildRequestHeaders(context, contentType) {
60
70
  var _context$tokenResolve;
@@ -62,6 +72,7 @@ async function buildRequestHeaders(context, contentType) {
62
72
  const headers = getMetadataHeaders(context);
63
73
  const authToken = await ((_context$tokenResolve = context == null ? void 0 : context.tokenResolver) != null ? _context$tokenResolve : ContextHolder.getAccessToken)();
64
74
  const requestSource = ContextHolder.getRequestSource();
75
+ const scopedTenant = getScopedTenant();
65
76
 
66
77
  if (contentType) {
67
78
  headers[fronteggHeaders.contentType] = contentType;
@@ -75,6 +86,10 @@ async function buildRequestHeaders(context, contentType) {
75
86
  headers.Authorization = `Bearer ${authToken}`;
76
87
  }
77
88
 
89
+ if (scopedTenant) {
90
+ headers[fronteggHeaders.scopedTenant] = scopedTenant;
91
+ }
92
+
78
93
  for (const additionalHeader of await getAdditionalHeaders(context)) {
79
94
  headers[`${additionalHeader.key}`] = `${additionalHeader.value}`;
80
95
  }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.1.51
1
+ /** @license Frontegg v3.1.53
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.
package/interfaces.d.ts CHANGED
@@ -35,6 +35,7 @@ export declare const fronteggHeaders: {
35
35
  fronteggSdkVersion: string;
36
36
  contentType: string;
37
37
  source: string;
38
+ scopedTenant: string;
38
39
  };
39
40
  export declare enum RequestSource {
40
41
  AdminPortal = "admin-portal",
package/interfaces.js CHANGED
@@ -2,7 +2,8 @@ export const fronteggHeaders = {
2
2
  frameWork: 'x-frontegg-framework',
3
3
  fronteggSdkVersion: 'x-frontegg-sdk',
4
4
  contentType: 'Content-Type',
5
- source: 'frontegg-source'
5
+ source: 'frontegg-source',
6
+ scopedTenant: 'frontegg-scoped-tenant'
6
7
  };
7
8
  export let RequestSource;
8
9
 
package/node/fetch.js CHANGED
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.extractHeadersFromOptions = exports.Put = exports.PostDownload = exports.Post = exports.Patch = exports.Get = exports.Delete = void 0;
9
9
  exports.getBaseUrl = getBaseUrl;
10
10
  exports.getMetadataHeaders = getMetadataHeaders;
11
+ exports.getScopedTenant = getScopedTenant;
11
12
 
12
13
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14
 
@@ -72,6 +73,17 @@ function getMetadataHeaders(context) {
72
73
  return headers;
73
74
  }
74
75
 
76
+ function getScopedTenant() {
77
+ const urlParams = new URLSearchParams(window.location.search);
78
+ const scopedTenant = urlParams.get('tenantId');
79
+
80
+ if (scopedTenant) {
81
+ return scopedTenant;
82
+ }
83
+
84
+ return null;
85
+ }
86
+
75
87
  async function buildRequestHeaders(context, contentType) {
76
88
  var _context$tokenResolve;
77
89
 
@@ -80,6 +92,8 @@ async function buildRequestHeaders(context, contentType) {
80
92
 
81
93
  const requestSource = _ContextHolder.ContextHolder.getRequestSource();
82
94
 
95
+ const scopedTenant = getScopedTenant();
96
+
83
97
  if (contentType) {
84
98
  headers[_interfaces.fronteggHeaders.contentType] = contentType;
85
99
  }
@@ -92,6 +106,10 @@ async function buildRequestHeaders(context, contentType) {
92
106
  headers.Authorization = `Bearer ${authToken}`;
93
107
  }
94
108
 
109
+ if (scopedTenant) {
110
+ headers[_interfaces.fronteggHeaders.scopedTenant] = scopedTenant;
111
+ }
112
+
95
113
  for (const additionalHeader of await getAdditionalHeaders(context)) {
96
114
  headers[`${additionalHeader.key}`] = `${additionalHeader.value}`;
97
115
  }
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.1.51
1
+ /** @license Frontegg v3.1.53
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.
@@ -8,7 +8,8 @@ const fronteggHeaders = {
8
8
  frameWork: 'x-frontegg-framework',
9
9
  fronteggSdkVersion: 'x-frontegg-sdk',
10
10
  contentType: 'Content-Type',
11
- source: 'frontegg-source'
11
+ source: 'frontegg-source',
12
+ scopedTenant: 'frontegg-scoped-tenant'
12
13
  };
13
14
  exports.fronteggHeaders = fronteggHeaders;
14
15
  let RequestSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.1.51",
3
+ "version": "3.1.53",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -27,7 +27,7 @@ export declare type ITeamUser = {
27
27
  tenants?: ITeamUserTenant;
28
28
  verified?: boolean;
29
29
  managedBy?: UserManagedByEnum;
30
- expirationInSeconds?: number;
30
+ temporaryExpirationDate?: Date;
31
31
  };
32
32
  export declare type ITeamUserRole = {
33
33
  id: string;