@liquidcommercedev/rmn-sdk 1.4.2 → 1.4.3-beta.2

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/dist/index.cjs CHANGED
@@ -71,6 +71,7 @@ exports.RMN_ENV = void 0;
71
71
  RMN_ENV["PRODUCTION"] = "production";
72
72
  })(exports.RMN_ENV || (exports.RMN_ENV = {}));
73
73
 
74
+ const REQUEST_CLOUD_PARTNER_SITE = 'X-Liquid-Partner-Site';
74
75
  const REQUEST_CLOUD_PROTECTED_KEY = 'X-Liquid-Protected';
75
76
  const REQUEST_CLOUD_PROTECTED_TIMESTAMP = 'X-Liquid-Timestamp';
76
77
  const REQUEST_CLOUD_API_KEY = 'X-Liquid-Api-Key';
@@ -79,7 +80,7 @@ const SDK_CONFIG = {
79
80
  url: {
80
81
  [exports.RMN_ENV.LOCAL]: 'http://localhost:8300',
81
82
  [exports.RMN_ENV.DEVELOPMENT]: 'https://dev.rmn.liquidcommerce.cloud',
82
- [exports.RMN_ENV.STAGING]: 'https://stage.rmn.liquidcommerce.cloud',
83
+ [exports.RMN_ENV.STAGING]: 'https://staging.rmn.liquidcommerce.cloud',
83
84
  [exports.RMN_ENV.PRODUCTION]: 'https://rmn.liquidcommerce.cloud',
84
85
  },
85
86
  apiHeader: REQUEST_CLOUD_API_KEY,
@@ -14943,13 +14944,25 @@ class BaseApi extends BaseApiAbstract {
14943
14944
  this.encryptedApi = EncryptedApi.getInstance(this.authInfo.apiKey);
14944
14945
  this.objectHelper = ObjectHelper.getInstance();
14945
14946
  this.baseUrl = (_a = SDK_CONFIG.url[this.authInfo.env]) !== null && _a !== void 0 ? _a : SDK_CONFIG.url.development;
14947
+ const configHeaders = {
14948
+ [SDK_CONFIG.accessHeader]: `Bearer ${this.authInfo.token}`,
14949
+ };
14950
+ const partnerSite = this.getPartnerSite();
14951
+ const isPartnerSiteValid = partnerSite === null || partnerSite === void 0 ? void 0 : partnerSite.startsWith('http');
14952
+ if (partnerSite && isPartnerSiteValid) {
14953
+ configHeaders[REQUEST_CLOUD_PARTNER_SITE] = partnerSite;
14954
+ }
14946
14955
  this.client = axios.create({
14947
14956
  baseURL: this.baseUrl,
14948
- ...this.getConfig({
14949
- [SDK_CONFIG.accessHeader]: `Bearer ${this.authInfo.token}`,
14950
- }),
14957
+ ...this.getConfig(configHeaders),
14951
14958
  });
14952
14959
  }
14960
+ getPartnerSite() {
14961
+ if (typeof window !== 'undefined' && window.location) {
14962
+ return window.location.origin;
14963
+ }
14964
+ return null;
14965
+ }
14953
14966
  /**
14954
14967
  * Retrieve the configuration for making an Axios request.
14955
14968
  *
package/dist/index.esm.js CHANGED
@@ -69,6 +69,7 @@ var RMN_ENV;
69
69
  RMN_ENV["PRODUCTION"] = "production";
70
70
  })(RMN_ENV || (RMN_ENV = {}));
71
71
 
72
+ const REQUEST_CLOUD_PARTNER_SITE = 'X-Liquid-Partner-Site';
72
73
  const REQUEST_CLOUD_PROTECTED_KEY = 'X-Liquid-Protected';
73
74
  const REQUEST_CLOUD_PROTECTED_TIMESTAMP = 'X-Liquid-Timestamp';
74
75
  const REQUEST_CLOUD_API_KEY = 'X-Liquid-Api-Key';
@@ -77,7 +78,7 @@ const SDK_CONFIG = {
77
78
  url: {
78
79
  [RMN_ENV.LOCAL]: 'http://localhost:8300',
79
80
  [RMN_ENV.DEVELOPMENT]: 'https://dev.rmn.liquidcommerce.cloud',
80
- [RMN_ENV.STAGING]: 'https://stage.rmn.liquidcommerce.cloud',
81
+ [RMN_ENV.STAGING]: 'https://staging.rmn.liquidcommerce.cloud',
81
82
  [RMN_ENV.PRODUCTION]: 'https://rmn.liquidcommerce.cloud',
82
83
  },
83
84
  apiHeader: REQUEST_CLOUD_API_KEY,
@@ -14941,13 +14942,25 @@ class BaseApi extends BaseApiAbstract {
14941
14942
  this.encryptedApi = EncryptedApi.getInstance(this.authInfo.apiKey);
14942
14943
  this.objectHelper = ObjectHelper.getInstance();
14943
14944
  this.baseUrl = (_a = SDK_CONFIG.url[this.authInfo.env]) !== null && _a !== void 0 ? _a : SDK_CONFIG.url.development;
14945
+ const configHeaders = {
14946
+ [SDK_CONFIG.accessHeader]: `Bearer ${this.authInfo.token}`,
14947
+ };
14948
+ const partnerSite = this.getPartnerSite();
14949
+ const isPartnerSiteValid = partnerSite === null || partnerSite === void 0 ? void 0 : partnerSite.startsWith('http');
14950
+ if (partnerSite && isPartnerSiteValid) {
14951
+ configHeaders[REQUEST_CLOUD_PARTNER_SITE] = partnerSite;
14952
+ }
14944
14953
  this.client = axios.create({
14945
14954
  baseURL: this.baseUrl,
14946
- ...this.getConfig({
14947
- [SDK_CONFIG.accessHeader]: `Bearer ${this.authInfo.token}`,
14948
- }),
14955
+ ...this.getConfig(configHeaders),
14949
14956
  });
14950
14957
  }
14958
+ getPartnerSite() {
14959
+ if (typeof window !== 'undefined' && window.location) {
14960
+ return window.location.origin;
14961
+ }
14962
+ return null;
14963
+ }
14951
14964
  /**
14952
14965
  * Retrieve the configuration for making an Axios request.
14953
14966
  *
@@ -1,4 +1,5 @@
1
1
  import type { IAuthConfigs } from '../../modules/auth';
2
+ export declare const REQUEST_CLOUD_PARTNER_SITE = "X-Liquid-Partner-Site";
2
3
  export declare const REQUEST_CLOUD_PROTECTED_KEY = "X-Liquid-Protected";
3
4
  export declare const REQUEST_CLOUD_PROTECTED_TIMESTAMP = "X-Liquid-Timestamp";
4
5
  export declare const REQUEST_CLOUD_API_KEY = "X-Liquid-Api-Key";
@@ -10,6 +10,7 @@ export declare class BaseApi extends BaseApiAbstract {
10
10
  private readonly encryptedApi;
11
11
  private readonly client;
12
12
  constructor(auth: IAuthCredentials);
13
+ private getPartnerSite;
13
14
  /**
14
15
  * Retrieve the configuration for making an Axios request.
15
16
  *
@@ -2,6 +2,7 @@ import type { RMN_ENV } from './../../enums';
2
2
  import type { RMN_SPOT_EVENT, RMN_SPOT_TYPE } from './spot.enum';
3
3
  import type { RmnFilterType, RmnSpotType, SpotIdentifierType, SpotVariantType } from './spot.type';
4
4
  export interface ISpotSelectionParams {
5
+ url?: string;
5
6
  spots: RmnSpotType[];
6
7
  filter?: Partial<RmnFilterType>;
7
8
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@liquidcommercedev/rmn-sdk",
3
3
  "description": "LiquidCommerce RMN SDK",
4
4
  "author": "LiquidCommerce Tech",
5
- "version": "1.4.2",
5
+ "version": "1.4.3-beta.2",
6
6
  "homepage": "https://docs.liquidcommerce.co/rmn-sdk",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.esm.js",