@frontegg/rest-api 3.0.48 → 3.0.49

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
@@ -9,7 +9,7 @@ interface RequestOptions {
9
9
  headers?: Record<string, string>;
10
10
  credentials?: RequestCredentials;
11
11
  }
12
- export declare function getBaseUrl(context: ContextOptions, url: string, withFronteggSuffix?: boolean): string;
12
+ export declare function getBaseUrl(context: ContextOptions, url: string, withFronteggPrefix?: boolean): string;
13
13
  export declare const Get: (url: string, params?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
14
14
  export declare const Post: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
15
15
  export declare const Patch: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
package/fetch.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { ContextHolder } from './ContextHolder';
3
3
  import { FronteggApiError } from './error';
4
- export function getBaseUrl(context, url, withFronteggSuffix = true) {
4
+ export function getBaseUrl(context, url, withFronteggPrefix = true) {
5
5
  let baseUrl;
6
6
 
7
7
  if (typeof context.baseUrl === 'function') {
@@ -10,13 +10,14 @@ export function getBaseUrl(context, url, withFronteggSuffix = true) {
10
10
  baseUrl = context.baseUrl;
11
11
  }
12
12
 
13
- const prefix = context.urlPrefix || withFronteggSuffix ? 'frontegg' : '';
13
+ const prefix = context.urlPrefix || 'frontegg';
14
+ const removePrefix = prefix === 'frontegg' && !withFronteggPrefix;
14
15
 
15
16
  if (!baseUrl.endsWith('/')) {
16
17
  baseUrl += '/';
17
18
  }
18
19
 
19
- if (!baseUrl.endsWith(prefix)) {
20
+ if (!baseUrl.endsWith(prefix) && !removePrefix) {
20
21
  baseUrl += prefix;
21
22
  }
22
23
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.48
1
+ /** @license Frontegg v3.0.49
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/node/fetch.js CHANGED
@@ -14,7 +14,7 @@ var _ContextHolder = require("./ContextHolder");
14
14
 
15
15
  var _error = require("./error");
16
16
 
17
- function getBaseUrl(context, url, withFronteggSuffix = true) {
17
+ function getBaseUrl(context, url, withFronteggPrefix = true) {
18
18
  let baseUrl;
19
19
 
20
20
  if (typeof context.baseUrl === 'function') {
@@ -23,13 +23,14 @@ function getBaseUrl(context, url, withFronteggSuffix = true) {
23
23
  baseUrl = context.baseUrl;
24
24
  }
25
25
 
26
- const prefix = context.urlPrefix || withFronteggSuffix ? 'frontegg' : '';
26
+ const prefix = context.urlPrefix || 'frontegg';
27
+ const removePrefix = prefix === 'frontegg' && !withFronteggPrefix;
27
28
 
28
29
  if (!baseUrl.endsWith('/')) {
29
30
  baseUrl += '/';
30
31
  }
31
32
 
32
- if (!baseUrl.endsWith(prefix)) {
33
+ if (!baseUrl.endsWith(prefix) && !removePrefix) {
33
34
  baseUrl += prefix;
34
35
  }
35
36
 
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.48
1
+ /** @license Frontegg v3.0.49
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.0.48",
3
+ "version": "3.0.49",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {