@smartico/public-api 0.0.363 → 0.0.364
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/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +21 -4
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Missions/MissionsUtils.ts +32 -4
package/dist/index.js
CHANGED
|
@@ -1248,6 +1248,26 @@ exports.BadgesTimeLimitStates = void 0;
|
|
|
1248
1248
|
var _MissionUtils;
|
|
1249
1249
|
var USER_STATE_PARAMS_KEYS_GAMES = ['core_fav_game_top3', 'core_fav_game_type_top3', 'core_fav_game_provider_top3'];
|
|
1250
1250
|
var USER_STATE_PARAMS_KEYS_BET_AMOUNT = ['core_recommended_deposit_amount', 'core_recommended_casino_bet_amount', 'casino_last_bet_amount', 'casino_last_bet_amount_real', 'casino_last_bet_amount_bonus', 'acc_last_deposit_amount'];
|
|
1251
|
+
var MINOR_WORDS = new Set(['of', 'at', 'in', 'on', 'to', 'up', 'as', 'by', 'for', 'from', 'into', 'onto', 'with', 'upon', 'via', 'and', 'but', 'or', 'nor', 'so', 'yet', 'vs', 'v', 'a', 'an', 'the']);
|
|
1252
|
+
function toGameTitleCase(raw) {
|
|
1253
|
+
if (!raw) return raw;
|
|
1254
|
+
var tokens = raw.toLowerCase().split(/(\b\w+\b)/);
|
|
1255
|
+
var wordTokens = tokens.filter(function (t) {
|
|
1256
|
+
return /^\w+$/.test(t);
|
|
1257
|
+
});
|
|
1258
|
+
var lastWordIdx = wordTokens.length - 1;
|
|
1259
|
+
var wordIndex = 0;
|
|
1260
|
+
return tokens.map(function (token) {
|
|
1261
|
+
if (!/^\w+$/.test(token)) return token;
|
|
1262
|
+
var isFirst = wordIndex === 0;
|
|
1263
|
+
var isLast = wordIndex === lastWordIdx;
|
|
1264
|
+
wordIndex++;
|
|
1265
|
+
if (isFirst || isLast || !MINOR_WORDS.has(token)) {
|
|
1266
|
+
return token.charAt(0).toUpperCase() + token.slice(1);
|
|
1267
|
+
}
|
|
1268
|
+
return token;
|
|
1269
|
+
}).join('');
|
|
1270
|
+
}
|
|
1251
1271
|
var MissionUtils = function MissionUtils() {};
|
|
1252
1272
|
_MissionUtils = MissionUtils;
|
|
1253
1273
|
MissionUtils.getAvailabilityStatus = function (mission) {
|
|
@@ -1424,8 +1444,8 @@ MissionUtils.replaceTagsFavMissionTask = function (_ref) {
|
|
|
1424
1444
|
});
|
|
1425
1445
|
if (value && value.length > 0) {
|
|
1426
1446
|
suggestedGames = value.map(function (v) {
|
|
1427
|
-
var cleaned = v.replace(/_/g, ' ')
|
|
1428
|
-
return
|
|
1447
|
+
var cleaned = v.replace(/_/g, ' ');
|
|
1448
|
+
return toGameTitleCase(cleaned);
|
|
1429
1449
|
}).join(', ');
|
|
1430
1450
|
}
|
|
1431
1451
|
}
|
|
@@ -1435,8 +1455,7 @@ MissionUtils.replaceTagsFavMissionTask = function (_ref) {
|
|
|
1435
1455
|
if (IntUtils.isNotNull(pos) && _value && _value[pos]) {
|
|
1436
1456
|
suggestedGames = _value[pos];
|
|
1437
1457
|
if (suggestedGames) {
|
|
1438
|
-
suggestedGames = suggestedGames.replace(
|
|
1439
|
-
suggestedGames = suggestedGames.charAt(0).toUpperCase() + suggestedGames.slice(1);
|
|
1458
|
+
suggestedGames = toGameTitleCase(suggestedGames.replace(/_/g, ' '));
|
|
1440
1459
|
}
|
|
1441
1460
|
}
|
|
1442
1461
|
}
|