@smartico/public-api 0.0.394 → 0.0.396
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/GamePick/GamePickTypes.d.ts +1 -1
- package/dist/SmarticoLib/index.d.ts +1 -1
- package/dist/WSAPI/WSAPIGamePick.d.ts +1 -1
- package/dist/index.js +33 -26
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +29 -21
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/GamePick/GamePickTypes.ts +1 -1
- package/src/Missions/MissionsUtils.ts +1 -1
- package/src/SmarticoAPI.ts +37 -22
- package/src/SmarticoLib/index.ts +1 -1
- package/src/WSAPI/WSAPIGamePick.ts +1 -1
package/dist/index.modern.mjs
CHANGED
|
@@ -9478,6 +9478,24 @@ const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
|
9478
9478
|
const GAMES_API_URL = 'https://r-games-api.smr.vc';
|
|
9479
9479
|
const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
|
|
9480
9480
|
const DEFAULT_LANG_EN = 'EN';
|
|
9481
|
+
const SMR_TO_CLOUDFRONT_DOMAINS = {
|
|
9482
|
+
'img.smr.vc': 'd1am61onjxtys8.cloudfront.net',
|
|
9483
|
+
'img3.smr.vc': 'd3dubbodzd2q05.cloudfront.net',
|
|
9484
|
+
'img4.smr.vc': 'dvm0p9vsezqr2.cloudfront.net',
|
|
9485
|
+
'img5.smr.vc': 'd3gen1ksvxhac8.cloudfront.net',
|
|
9486
|
+
'img6.smr.vc': 'db1kmyg7iufeo.cloudfront.net',
|
|
9487
|
+
'img7.smr.vc': 'd36om2g86xefo6.cloudfront.net',
|
|
9488
|
+
'img8.smr.vc': 'd2zme31v54n5pb.cloudfront.net',
|
|
9489
|
+
'static.smr.vc': 'dtt380pweilws.cloudfront.net',
|
|
9490
|
+
'static3.smr.vc': 'd1qt8ake8g4imn.cloudfront.net',
|
|
9491
|
+
'static4.smr.vc': 'd146b4m7rkvjkw.cloudfront.net',
|
|
9492
|
+
'static5.smr.vc': 'd3l7suk1kl9rwh.cloudfront.net',
|
|
9493
|
+
'static6.smr.vc': 'd121pfj16xdfcq.cloudfront.net',
|
|
9494
|
+
'static7.smr.vc': 'd21deilz814qgl.cloudfront.net',
|
|
9495
|
+
'static8.smr.vc': 'd1uffsroxjy2ku.cloudfront.net'
|
|
9496
|
+
};
|
|
9497
|
+
// Single combined matcher built once, so a call is one pass instead of one per domain.
|
|
9498
|
+
const SMR_DOMAIN_REGEX = new RegExp(Object.keys(SMR_TO_CLOUDFRONT_DOMAINS).map(d => d.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
|
|
9481
9499
|
class SmarticoAPI {
|
|
9482
9500
|
constructor(label_api_key, brand_api_key, messageSender, options = {}) {
|
|
9483
9501
|
var _options$tracker, _options$tracker2;
|
|
@@ -9533,29 +9551,19 @@ class SmarticoAPI {
|
|
|
9533
9551
|
if (!value) {
|
|
9534
9552
|
return value;
|
|
9535
9553
|
}
|
|
9536
|
-
const
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
'static4.smr.vc': 'd146b4m7rkvjkw.cloudfront.net',
|
|
9547
|
-
'static5.smr.vc': 'd3l7suk1kl9rwh.cloudfront.net',
|
|
9548
|
-
'static6.smr.vc': 'd121pfj16xdfcq.cloudfront.net',
|
|
9549
|
-
'static7.smr.vc': 'd21deilz814qgl.cloudfront.net',
|
|
9550
|
-
'static8.smr.vc': 'd1uffsroxjy2ku.cloudfront.net'
|
|
9551
|
-
};
|
|
9552
|
-
const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
9553
|
-
let replacedValue = typeof value === 'string' ? value : JSON.stringify(value);
|
|
9554
|
-
for (const [oldDomain, newDomain] of Object.entries(domains)) {
|
|
9555
|
-
replacedValue = replacedValue.replace(new RegExp(escapeRegExp(oldDomain), 'g'), newDomain);
|
|
9554
|
+
const isString = typeof value === 'string';
|
|
9555
|
+
const source = isString ? value : JSON.stringify(value);
|
|
9556
|
+
if (!source.includes('smr.vc')) return value; // ← skip even the regex
|
|
9557
|
+
const replaced = source.replace(SMR_DOMAIN_REGEX, match => SMR_TO_CLOUDFRONT_DOMAINS[match]);
|
|
9558
|
+
// No domain matched: skip the JSON re-parse and return the input untouched.
|
|
9559
|
+
if (replaced === source) {
|
|
9560
|
+
return value;
|
|
9561
|
+
}
|
|
9562
|
+
if (isString) {
|
|
9563
|
+
return replaced;
|
|
9556
9564
|
}
|
|
9557
9565
|
try {
|
|
9558
|
-
return
|
|
9566
|
+
return JSON.parse(replaced);
|
|
9559
9567
|
} catch (err) {
|
|
9560
9568
|
return value;
|
|
9561
9569
|
}
|