@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/index.modern.mjs
CHANGED
|
@@ -2532,23 +2532,32 @@ class SmarticoAPI {
|
|
|
2532
2532
|
}
|
|
2533
2533
|
return ENV_ID;
|
|
2534
2534
|
}
|
|
2535
|
-
|
|
2535
|
+
static replaceSmrDomainsWithCloudfront(value) {
|
|
2536
|
+
if (!value) {
|
|
2537
|
+
return value;
|
|
2538
|
+
}
|
|
2536
2539
|
const domains = {
|
|
2540
|
+
'img.smr.vc': 'd1am61onjxtys8.cloudfront.net',
|
|
2541
|
+
'img3.smr.vc': 'd3dubbodzd2q05.cloudfront.net',
|
|
2542
|
+
'img4.smr.vc': 'dvm0p9vsezqr2.cloudfront.net',
|
|
2543
|
+
'img5.smr.vc': 'd3gen1ksvxhac8.cloudfront.net',
|
|
2544
|
+
'img6.smr.vc': 'db1kmyg7iufeo.cloudfront.net',
|
|
2545
|
+
'static.smr.vc': 'dtt380pweilws.cloudfront.net',
|
|
2546
|
+
'static3.smr.vc': 'd1qt8ake8g4imn.cloudfront.net',
|
|
2537
2547
|
'static4.smr.vc': 'd146b4m7rkvjkw.cloudfront.net',
|
|
2538
|
-
'
|
|
2548
|
+
'static5.smr.vc': 'd121pfj16xdfcq.cloudfront.net',
|
|
2549
|
+
'static6.smr.vc': 'd21deilz814qgl.cloudfront.net'
|
|
2539
2550
|
};
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
for (const oldDomain of
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
}
|
|
2551
|
+
const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2552
|
+
let replacedValue = typeof value === 'string' ? value : JSON.stringify(value);
|
|
2553
|
+
for (const [oldDomain, newDomain] of Object.entries(domains)) {
|
|
2554
|
+
replacedValue = replacedValue.replace(new RegExp(escapeRegExp(oldDomain), 'g'), newDomain);
|
|
2555
|
+
}
|
|
2556
|
+
try {
|
|
2557
|
+
return typeof value === 'string' ? replacedValue : JSON.parse(replacedValue);
|
|
2558
|
+
} catch (err) {
|
|
2559
|
+
return value;
|
|
2550
2560
|
}
|
|
2551
|
-
return newObject;
|
|
2552
2561
|
}
|
|
2553
2562
|
static getEnvId(label_api_key) {
|
|
2554
2563
|
return label_api_key.length === 38 ? parseInt(label_api_key.substring(37, 38), 10) : 2;
|
|
@@ -2564,10 +2573,11 @@ class SmarticoAPI {
|
|
|
2564
2573
|
}
|
|
2565
2574
|
static getAvatarUrl(label_api_key) {
|
|
2566
2575
|
const envId = SmarticoAPI.getEnvDnsSuffix(label_api_key);
|
|
2576
|
+
const avatarUrl = AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
2567
2577
|
if (envId === '4') {
|
|
2568
|
-
return
|
|
2578
|
+
return SmarticoAPI.replaceSmrDomainsWithCloudfront(avatarUrl);
|
|
2569
2579
|
} else {
|
|
2570
|
-
return
|
|
2580
|
+
return avatarUrl;
|
|
2571
2581
|
}
|
|
2572
2582
|
}
|
|
2573
2583
|
async send(message, expectCID, force_language) {
|
|
@@ -2582,8 +2592,8 @@ class SmarticoAPI {
|
|
|
2582
2592
|
const timeStart = new Date().getTime();
|
|
2583
2593
|
result = await this.messageSender(message, this.publicUrl, expectCID);
|
|
2584
2594
|
const timeEnd = new Date().getTime();
|
|
2585
|
-
if (this.label_api_key === 'a6e7ac26-c368-4892-9380-96e7ff82cf3e-4' && result) {
|
|
2586
|
-
result =
|
|
2595
|
+
if (SmarticoAPI.getEnvDnsSuffix(this.label_api_key) === 'a6e7ac26-c368-4892-9380-96e7ff82cf3e-4' && result) {
|
|
2596
|
+
result = SmarticoAPI.replaceSmrDomainsWithCloudfront(result);
|
|
2587
2597
|
}
|
|
2588
2598
|
if (this.logHTTPTiming) {
|
|
2589
2599
|
this.logger.always('HTTP time, ms:' + (timeEnd - timeStart));
|