@smartico/public-api 0.0.220 → 0.0.222

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.
@@ -99,8 +99,8 @@ export declare enum ClassId {
99
99
  JP_OPTOUT_REQUEST = 806,
100
100
  JP_OPTOUT_RESPONSE = 807,
101
101
  JP_WIN_PUSH = 808,
102
- RAF_GET_RAFFLES_REQUEST = 900,
103
- RAF_GET_RAFFLES_RESPONSE = 901,
102
+ RAF_GET_RAFFLES_REQUEST = 902,
103
+ RAF_GET_RAFFLES_RESPONSE = 903,
104
104
  RAF_GET_DRAW_REQUEST = 904,
105
105
  RAF_GET_DRAW_RESPONSE = 905,
106
106
  REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ = 1003,
@@ -49,6 +49,7 @@ declare class SmarticoAPI {
49
49
  tracker?: Tracker;
50
50
  constructor(label_api_key: string, brand_api_key: string, messageSender: MessageSender, options?: IOptions);
51
51
  static getEnvDnsSuffix(label_api_key: string): string;
52
+ private replaceDomains;
52
53
  static getEnvId(label_api_key: string): number;
53
54
  static getCleanLabelApiKey(label_api_key: string): string;
54
55
  static getPublicUrl(label_api_key: string): string;
@@ -2,7 +2,7 @@ import { SmarticoAPI } from '../SmarticoAPI';
2
2
  import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory } from './WSAPITypes';
3
3
  import { LeaderBoardPeriodType } from '../Leaderboard';
4
4
  import { JackpotDetails, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
5
- import { GetRelatedAchTourResponse } from 'src/Missions/GetRelatedAchTourResponse';
5
+ import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
6
6
  import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
7
7
  import { InboxCategories } from '../Inbox/InboxCategories';
8
8
  /** @group General API */
package/dist/index.js CHANGED
@@ -123,8 +123,8 @@ exports.ClassId = void 0;
123
123
  ClassId[ClassId["JP_OPTOUT_REQUEST"] = 806] = "JP_OPTOUT_REQUEST";
124
124
  ClassId[ClassId["JP_OPTOUT_RESPONSE"] = 807] = "JP_OPTOUT_RESPONSE";
125
125
  ClassId[ClassId["JP_WIN_PUSH"] = 808] = "JP_WIN_PUSH";
126
- ClassId[ClassId["RAF_GET_RAFFLES_REQUEST"] = 900] = "RAF_GET_RAFFLES_REQUEST";
127
- ClassId[ClassId["RAF_GET_RAFFLES_RESPONSE"] = 901] = "RAF_GET_RAFFLES_RESPONSE";
126
+ ClassId[ClassId["RAF_GET_RAFFLES_REQUEST"] = 902] = "RAF_GET_RAFFLES_REQUEST";
127
+ ClassId[ClassId["RAF_GET_RAFFLES_RESPONSE"] = 903] = "RAF_GET_RAFFLES_RESPONSE";
128
128
  ClassId[ClassId["RAF_GET_DRAW_REQUEST"] = 904] = "RAF_GET_DRAW_REQUEST";
129
129
  ClassId[ClassId["RAF_GET_DRAW_RESPONSE"] = 905] = "RAF_GET_DRAW_RESPONSE";
130
130
  /*
@@ -2919,6 +2919,26 @@ var SmarticoAPI = /*#__PURE__*/function () {
2919
2919
  }
2920
2920
  return ENV_ID;
2921
2921
  };
2922
+ var _proto = SmarticoAPI.prototype;
2923
+ _proto.replaceDomains = function replaceDomains(obj) {
2924
+ var domains = {
2925
+ 'static4.smr.vc': 'd146b4m7rkvjkw.cloudfront.net',
2926
+ 'img4.smr.vc': 'dvm0p9vsezqr2.cloudfront.net'
2927
+ };
2928
+ var newObject = obj;
2929
+ var oldDomains = Object.keys(domains);
2930
+ for (var _i = 0, _oldDomains = oldDomains; _i < _oldDomains.length; _i++) {
2931
+ var oldDomain = _oldDomains[_i];
2932
+ var stringified = JSON.stringify(newObject);
2933
+ try {
2934
+ var replacedString = stringified.replace(new RegExp(oldDomain, 'g'), domains[oldDomain]);
2935
+ newObject = JSON.parse(replacedString);
2936
+ } catch (error) {
2937
+ console.error(error);
2938
+ }
2939
+ }
2940
+ return newObject;
2941
+ };
2922
2942
  SmarticoAPI.getEnvId = function getEnvId(label_api_key) {
2923
2943
  return label_api_key.length === 38 ? parseInt(label_api_key.substring(37, 38), 10) : 2;
2924
2944
  };
@@ -2939,7 +2959,6 @@ var SmarticoAPI = /*#__PURE__*/function () {
2939
2959
  return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
2940
2960
  }
2941
2961
  };
2942
- var _proto = SmarticoAPI.prototype;
2943
2962
  _proto.send = function send(message, expectCID, force_language) {
2944
2963
  try {
2945
2964
  var _temp2 = function _temp2(_result) {
@@ -2998,6 +3017,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
2998
3017
  return Promise.resolve(_this.messageSender(message, _this.publicUrl, expectCID)).then(function (_this$messageSender) {
2999
3018
  result = _this$messageSender;
3000
3019
  var timeEnd = new Date().getTime();
3020
+ if (_this.label_api_key === 'a6e7ac26-c368-4892-9380-96e7ff82cf3e-4' && result) {
3021
+ result = _this.replaceDomains(result);
3022
+ }
3001
3023
  if (_this.logHTTPTiming) {
3002
3024
  _this.logger.always('HTTP time, ms:' + (timeEnd - timeStart));
3003
3025
  }