@contentstack/marketplace-sdk 1.2.6 → 1.2.7

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/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # Changelog
2
+
3
+ ## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-05-15)
4
+ - Fixed base URL path logic in contentstackClient to handle when region and host not provided
5
+
2
6
  ## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-03-03)
3
7
  - Update sanity tests
4
8
 
@@ -6,6 +6,7 @@ import error from './core/contentstackError';
6
6
  import { Marketplace } from './marketplace/index.js';
7
7
  import { Region } from './contentstack.js';
8
8
  export default function contentstackClient(_ref) {
9
+ var _http$defaults;
9
10
  var http = _ref.http;
10
11
  /**
11
12
  * @description The login call is used to sign in to your Contentstack account and obtain the authtoken.
@@ -30,6 +31,10 @@ export default function contentstackClient(_ref) {
30
31
  var baseUrlPath = "/user-session";
31
32
  if (region && region !== Region.NA) {
32
33
  baseUrlPath = "https://".concat(region, "-api.contentstack.com:443/v3/user-session");
34
+ } else if (!region && http !== null && http !== void 0 && (_http$defaults = http.defaults) !== null && _http$defaults !== void 0 && _http$defaults.host) {
35
+ baseUrlPath = "https://".concat(http.defaults.host, ":443/v3/user-session");
36
+ } else {
37
+ baseUrlPath = "https://api.contentstack.io:443/v3/user-session";
33
38
  }
34
39
  function login(requestBody) {
35
40
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -15,6 +15,7 @@ var _contentstack = require("./contentstack.js");
15
15
  */
16
16
 
17
17
  function contentstackClient(_ref) {
18
+ var _http$defaults;
18
19
  var http = _ref.http;
19
20
  /**
20
21
  * @description The login call is used to sign in to your Contentstack account and obtain the authtoken.
@@ -39,6 +40,10 @@ function contentstackClient(_ref) {
39
40
  var baseUrlPath = "/user-session";
40
41
  if (region && region !== _contentstack.Region.NA) {
41
42
  baseUrlPath = "https://".concat(region, "-api.contentstack.com:443/v3/user-session");
43
+ } else if (!region && http !== null && http !== void 0 && (_http$defaults = http.defaults) !== null && _http$defaults !== void 0 && _http$defaults.host) {
44
+ baseUrlPath = "https://".concat(http.defaults.host, ":443/v3/user-session");
45
+ } else {
46
+ baseUrlPath = "https://api.contentstack.io:443/v3/user-session";
42
47
  }
43
48
  function login(requestBody) {
44
49
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};