@smartico/public-api 0.0.354 → 0.0.355

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.
@@ -4009,12 +4009,15 @@ class SmarticoAPI {
4009
4009
  this.tracker = options.tracker;
4010
4010
  this.publicUrl = SmarticoAPI.getPublicUrl(label_api_key);
4011
4011
  this.wsUrl = SmarticoAPI.getPublicWsUrl(label_api_key);
4012
- this.baseRgApiParams = {
4013
- env_id: String(SmarticoAPI.getEnvId(label_api_key)),
4014
- label_api_key: label_api_key,
4015
- brand_key: options.brand_api_key || this.tracker.params.brand_key,
4016
- hash: IntUtils.uuid()
4017
- };
4012
+ if (this.tracker) {
4013
+ // available only for real users
4014
+ this.baseRgApiParams = {
4015
+ env_id: String(SmarticoAPI.getEnvId(label_api_key)),
4016
+ label_api_key: label_api_key,
4017
+ brand_key: options.brand_api_key || this.tracker.params.brand_key,
4018
+ hash: IntUtils.uuid()
4019
+ };
4020
+ }
4018
4021
  this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || ((_options$tracker = options.tracker) == null ? void 0 : _options$tracker.label_api_key));
4019
4022
  this.label_api_key = SmarticoAPI.getCleanLabelApiKey(label_api_key);
4020
4023
  }
@@ -4715,6 +4718,9 @@ class SmarticoAPI {
4715
4718
  params,
4716
4719
  usePost = false
4717
4720
  }) {
4721
+ if (!this.tracker) {
4722
+ throw new Error(`MatchX and Quiz APIs are not available in the visitor mode`);
4723
+ }
4718
4724
  const baseParams = this.buildGamesApiParams();
4719
4725
  const queryString = Object.entries(baseParams).map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join('&');
4720
4726
  let url = `${GAMES_API_URL}/${method}?${queryString}`;