@smartico/public-api 0.0.227 → 0.0.229
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/SmarticoAPI.d.ts +3 -1
- package/dist/index.js +33 -19
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +27 -17
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SmarticoAPI.ts +30 -18
- package/dist/Quiz/MarketsAnswersType.d.ts +0 -22
- package/dist/Raffle/GetDrawResponse.d.ts +0 -5
- package/dist/SmarticoPublicAPI.d.ts +0 -23
- package/dist/Store/BuyShopItemErrorCode.d.ts +0 -10
- package/dist/Store/BuyShopItemRequest.d.ts +0 -4
- package/dist/Store/BuyShopItemResponse.d.ts +0 -4
- package/dist/Store/GetCategoriesShopResponse.d.ts +0 -5
- package/dist/Store/GetShopItemsResponse.d.ts +0 -5
- package/dist/Store/ShopCategory.d.ts +0 -5
- package/dist/Store/ShopCategoryPublicMeta.d.ts +0 -4
- package/dist/Store/ShopItem.d.ts +0 -9
- package/dist/Store/ShopItemPublicMeta.d.ts +0 -10
- package/dist/Store/ShopItemType.d.ts +0 -4
- package/dist/Store/StorItemPruchased.d.ts +0 -6
- package/dist/service/index.d.ts +0 -5
- package/dist/service/types/ErrorCodes.d.ts +0 -13
- package/dist/service/types/GRequest.d.ts +0 -16
- package/dist/service/types/GResponse.d.ts +0 -10
- package/dist/service/types/Game/GameAttemptType.d.ts +0 -6
- package/dist/service/types/Game/GameCanPlayType.d.ts +0 -10
- package/dist/service/types/Game/GameExternalStatus.d.ts +0 -6
- package/dist/service/types/Game/GameInfo.d.ts +0 -9
- package/dist/service/types/Game/GamePick.d.ts +0 -90
- package/dist/service/types/Game/GameUtil.d.ts +0 -7
- package/dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts +0 -7
- package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +0 -7
- package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +0 -5
- package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +0 -6
- package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +0 -5
- package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +0 -34
- package/dist/service/types/SmarticoProto/PublicProperties.d.ts +0 -11
- package/dist/service/types/SmarticoProto/ResponseIdentify.d.ts +0 -12
- package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +0 -15
- package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +0 -10
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts +0 -3
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +0 -11
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +0 -8
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +0 -13
- package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +0 -21
- package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +0 -31
- package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +0 -12
- package/dist/service/types/SmarticoProto/TranslationArea.d.ts +0 -9
- package/dist/service/types/User/UserInfo.d.ts +0 -10
- package/dist/util/Util.d.ts +0 -51
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -50,7 +50,9 @@ declare class SmarticoAPI {
|
|
|
50
50
|
tracker?: Tracker;
|
|
51
51
|
constructor(label_api_key: string, brand_api_key: string, messageSender: MessageSender, options?: IOptions);
|
|
52
52
|
static getEnvDnsSuffix(label_api_key: string): string;
|
|
53
|
-
|
|
53
|
+
static replaceSmrDomainsWithCloudfront<T>(value: string | {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}): T;
|
|
54
56
|
static getEnvId(label_api_key: string): number;
|
|
55
57
|
static getCleanLabelApiKey(label_api_key: string): string;
|
|
56
58
|
static getPublicUrl(label_api_key: string): string;
|
package/dist/index.js
CHANGED
|
@@ -2949,25 +2949,37 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
2949
2949
|
}
|
|
2950
2950
|
return ENV_ID;
|
|
2951
2951
|
};
|
|
2952
|
-
|
|
2953
|
-
|
|
2952
|
+
SmarticoAPI.replaceSmrDomainsWithCloudfront = function replaceSmrDomainsWithCloudfront(value) {
|
|
2953
|
+
if (!value) {
|
|
2954
|
+
return value;
|
|
2955
|
+
}
|
|
2954
2956
|
var domains = {
|
|
2957
|
+
'img.smr.vc': 'd1am61onjxtys8.cloudfront.net',
|
|
2958
|
+
'img3.smr.vc': 'd3dubbodzd2q05.cloudfront.net',
|
|
2959
|
+
'img4.smr.vc': 'dvm0p9vsezqr2.cloudfront.net',
|
|
2960
|
+
'img5.smr.vc': 'd3gen1ksvxhac8.cloudfront.net',
|
|
2961
|
+
'img6.smr.vc': 'db1kmyg7iufeo.cloudfront.net',
|
|
2962
|
+
'static.smr.vc': 'dtt380pweilws.cloudfront.net',
|
|
2963
|
+
'static3.smr.vc': 'd1qt8ake8g4imn.cloudfront.net',
|
|
2955
2964
|
'static4.smr.vc': 'd146b4m7rkvjkw.cloudfront.net',
|
|
2956
|
-
'
|
|
2965
|
+
'static5.smr.vc': 'd121pfj16xdfcq.cloudfront.net',
|
|
2966
|
+
'static6.smr.vc': 'd21deilz814qgl.cloudfront.net'
|
|
2957
2967
|
};
|
|
2958
|
-
var
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2968
|
+
var escapeRegExp = function escapeRegExp(str) {
|
|
2969
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2970
|
+
};
|
|
2971
|
+
var replacedValue = typeof value === 'string' ? value : JSON.stringify(value);
|
|
2972
|
+
for (var _i = 0, _Object$entries = Object.entries(domains); _i < _Object$entries.length; _i++) {
|
|
2973
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
2974
|
+
oldDomain = _Object$entries$_i[0],
|
|
2975
|
+
newDomain = _Object$entries$_i[1];
|
|
2976
|
+
replacedValue = replacedValue.replace(new RegExp(escapeRegExp(oldDomain), 'g'), newDomain);
|
|
2977
|
+
}
|
|
2978
|
+
try {
|
|
2979
|
+
return typeof value === 'string' ? replacedValue : JSON.parse(replacedValue);
|
|
2980
|
+
} catch (err) {
|
|
2981
|
+
return value;
|
|
2969
2982
|
}
|
|
2970
|
-
return newObject;
|
|
2971
2983
|
};
|
|
2972
2984
|
SmarticoAPI.getEnvId = function getEnvId(label_api_key) {
|
|
2973
2985
|
return label_api_key.length === 38 ? parseInt(label_api_key.substring(37, 38), 10) : 2;
|
|
@@ -2983,12 +2995,14 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
2983
2995
|
};
|
|
2984
2996
|
SmarticoAPI.getAvatarUrl = function getAvatarUrl(label_api_key) {
|
|
2985
2997
|
var envId = SmarticoAPI.getEnvDnsSuffix(label_api_key);
|
|
2998
|
+
var avatarUrl = AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
2986
2999
|
if (envId === '4') {
|
|
2987
|
-
return
|
|
3000
|
+
return SmarticoAPI.replaceSmrDomainsWithCloudfront(avatarUrl);
|
|
2988
3001
|
} else {
|
|
2989
|
-
return
|
|
3002
|
+
return avatarUrl;
|
|
2990
3003
|
}
|
|
2991
3004
|
};
|
|
3005
|
+
var _proto = SmarticoAPI.prototype;
|
|
2992
3006
|
_proto.send = function send(message, expectCID, force_language) {
|
|
2993
3007
|
try {
|
|
2994
3008
|
var _temp2 = function _temp2(_result) {
|
|
@@ -3047,8 +3061,8 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
3047
3061
|
return Promise.resolve(_this.messageSender(message, _this.publicUrl, expectCID)).then(function (_this$messageSender) {
|
|
3048
3062
|
result = _this$messageSender;
|
|
3049
3063
|
var timeEnd = new Date().getTime();
|
|
3050
|
-
if (_this.label_api_key === 'a6e7ac26-c368-4892-9380-96e7ff82cf3e-4' && result) {
|
|
3051
|
-
result =
|
|
3064
|
+
if (SmarticoAPI.getEnvDnsSuffix(_this.label_api_key) === 'a6e7ac26-c368-4892-9380-96e7ff82cf3e-4' && result) {
|
|
3065
|
+
result = SmarticoAPI.replaceSmrDomainsWithCloudfront(result);
|
|
3052
3066
|
}
|
|
3053
3067
|
if (_this.logHTTPTiming) {
|
|
3054
3068
|
_this.logger.always('HTTP time, ms:' + (timeEnd - timeStart));
|