@smartico/public-api 0.0.219 → 0.0.221

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.
@@ -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
@@ -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
  };
@@ -2932,9 +2952,13 @@ var SmarticoAPI = /*#__PURE__*/function () {
2932
2952
  return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
2933
2953
  };
2934
2954
  SmarticoAPI.getAvatarUrl = function getAvatarUrl(label_api_key) {
2935
- return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
2955
+ var envId = SmarticoAPI.getEnvDnsSuffix(label_api_key);
2956
+ if (envId === '4') {
2957
+ return 'https://dvm0p9vsezqr2.cloudfront.net';
2958
+ } else {
2959
+ return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
2960
+ }
2936
2961
  };
2937
- var _proto = SmarticoAPI.prototype;
2938
2962
  _proto.send = function send(message, expectCID, force_language) {
2939
2963
  try {
2940
2964
  var _temp2 = function _temp2(_result) {
@@ -2993,6 +3017,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
2993
3017
  return Promise.resolve(_this.messageSender(message, _this.publicUrl, expectCID)).then(function (_this$messageSender) {
2994
3018
  result = _this$messageSender;
2995
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
+ }
2996
3023
  if (_this.logHTTPTiming) {
2997
3024
  _this.logger.always('HTTP time, ms:' + (timeEnd - timeStart));
2998
3025
  }