@smartico/public-api 0.0.353 → 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.
@@ -3934,6 +3934,7 @@ var PointChangeSourceType;
3934
3934
  PointChangeSourceType[PointChangeSourceType["API"] = 18] = "API";
3935
3935
  PointChangeSourceType[PointChangeSourceType["DynamicFormula"] = 19] = "DynamicFormula";
3936
3936
  PointChangeSourceType[PointChangeSourceType["Raffle"] = 21] = "Raffle";
3937
+ PointChangeSourceType[PointChangeSourceType["Avatars"] = 22] = "Avatars";
3937
3938
  })(PointChangeSourceType || (PointChangeSourceType = {}));
3938
3939
 
3939
3940
  /**
@@ -4008,12 +4009,15 @@ class SmarticoAPI {
4008
4009
  this.tracker = options.tracker;
4009
4010
  this.publicUrl = SmarticoAPI.getPublicUrl(label_api_key);
4010
4011
  this.wsUrl = SmarticoAPI.getPublicWsUrl(label_api_key);
4011
- this.baseRgApiParams = {
4012
- env_id: String(SmarticoAPI.getEnvId(label_api_key)),
4013
- label_api_key: label_api_key,
4014
- brand_key: options.brand_api_key || this.tracker.params.brand_key,
4015
- hash: IntUtils.uuid()
4016
- };
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
+ }
4017
4021
  this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || ((_options$tracker = options.tracker) == null ? void 0 : _options$tracker.label_api_key));
4018
4022
  this.label_api_key = SmarticoAPI.getCleanLabelApiKey(label_api_key);
4019
4023
  }
@@ -4714,6 +4718,9 @@ class SmarticoAPI {
4714
4718
  params,
4715
4719
  usePost = false
4716
4720
  }) {
4721
+ if (!this.tracker) {
4722
+ throw new Error(`MatchX and Quiz APIs are not available in the visitor mode`);
4723
+ }
4717
4724
  const baseParams = this.buildGamesApiParams();
4718
4725
  const queryString = Object.entries(baseParams).map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join('&');
4719
4726
  let url = `${GAMES_API_URL}/${method}?${queryString}`;