@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.modern.mjs
CHANGED
|
@@ -1236,6 +1236,24 @@ var BadgesTimeLimitStates;
|
|
|
1236
1236
|
var _MissionUtils;
|
|
1237
1237
|
const USER_STATE_PARAMS_KEYS_GAMES = ['core_fav_game_top3', 'core_fav_game_type_top3', 'core_fav_game_provider_top3'];
|
|
1238
1238
|
const 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'];
|
|
1239
|
+
const 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']);
|
|
1240
|
+
function toGameTitleCase(raw) {
|
|
1241
|
+
if (!raw) return raw;
|
|
1242
|
+
const tokens = raw.toLowerCase().split(/(\b\w+\b)/);
|
|
1243
|
+
const wordTokens = tokens.filter(t => /^\w+$/.test(t));
|
|
1244
|
+
const lastWordIdx = wordTokens.length - 1;
|
|
1245
|
+
let wordIndex = 0;
|
|
1246
|
+
return tokens.map(token => {
|
|
1247
|
+
if (!/^\w+$/.test(token)) return token;
|
|
1248
|
+
const isFirst = wordIndex === 0;
|
|
1249
|
+
const isLast = wordIndex === lastWordIdx;
|
|
1250
|
+
wordIndex++;
|
|
1251
|
+
if (isFirst || isLast || !MINOR_WORDS.has(token)) {
|
|
1252
|
+
return token.charAt(0).toUpperCase() + token.slice(1);
|
|
1253
|
+
}
|
|
1254
|
+
return token;
|
|
1255
|
+
}).join('');
|
|
1256
|
+
}
|
|
1239
1257
|
class MissionUtils {}
|
|
1240
1258
|
_MissionUtils = MissionUtils;
|
|
1241
1259
|
MissionUtils.getAvailabilityStatus = mission => {
|
|
@@ -1411,8 +1429,8 @@ MissionUtils.replaceTagsFavMissionTask = ({
|
|
|
1411
1429
|
const value = (_userStateParams$k = userStateParams[k]) == null ? void 0 : _userStateParams$k.filter(v => Boolean(v));
|
|
1412
1430
|
if (value && value.length > 0) {
|
|
1413
1431
|
suggestedGames = value.map(v => {
|
|
1414
|
-
const cleaned = v.replace(/_/g, ' ')
|
|
1415
|
-
return
|
|
1432
|
+
const cleaned = v.replace(/_/g, ' ');
|
|
1433
|
+
return toGameTitleCase(cleaned);
|
|
1416
1434
|
}).join(', ');
|
|
1417
1435
|
}
|
|
1418
1436
|
}
|
|
@@ -1422,8 +1440,7 @@ MissionUtils.replaceTagsFavMissionTask = ({
|
|
|
1422
1440
|
if (IntUtils.isNotNull(pos) && value && value[pos]) {
|
|
1423
1441
|
suggestedGames = value[pos];
|
|
1424
1442
|
if (suggestedGames) {
|
|
1425
|
-
suggestedGames = suggestedGames.replace(
|
|
1426
|
-
suggestedGames = suggestedGames.charAt(0).toUpperCase() + suggestedGames.slice(1);
|
|
1443
|
+
suggestedGames = toGameTitleCase(suggestedGames.replace(/_/g, ' '));
|
|
1427
1444
|
}
|
|
1428
1445
|
}
|
|
1429
1446
|
}
|