@smartico/public-api 0.0.433 → 0.0.435
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/Inbox/InboxMessage.d.ts +1 -1
- package/dist/MiniGames/SAWTemplateUI.d.ts +26 -0
- package/dist/SmarticoGlobal.d.ts +18 -0
- package/dist/WSAPI/WSAPIInbox.d.ts +16 -0
- package/dist/WSAPI/WSAPITypes.d.ts +6 -0
- package/dist/index.js +57 -49
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +48 -44
- package/dist/index.modern.mjs.map +1 -1
- package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +24 -2
- package/package.json +1 -1
- package/src/Inbox/InboxMessage.ts +3 -1
- package/src/MiniGames/SAWTemplateUI.ts +29 -0
- package/src/Missions/MissionsUtils.ts +37 -47
- package/src/Missions/UserAchievement.ts +3 -3
- package/src/SmarticoGlobal.ts +18 -0
- package/src/WSAPI/WSAPIInbox.ts +16 -0
- package/src/WSAPI/WSAPITypes.ts +6 -0
|
@@ -390,6 +390,32 @@ export interface SAWTemplateUI {
|
|
|
390
390
|
* Back-Office label: _"Use Custom Game"_.
|
|
391
391
|
*/
|
|
392
392
|
use_custom?: boolean;
|
|
393
|
+
/**
|
|
394
|
+
* Whether a custom mini-game fills the whole mini-game window instead of
|
|
395
|
+
* the default fixed-size frame (800×516 on desktop, 400×745 on mobile).
|
|
396
|
+
*
|
|
397
|
+
* Applies wherever the game is opened — a spin attempt shown to the user,
|
|
398
|
+
* a deep link, or `_smartico.miniGame()` in standalone or inline mode.
|
|
399
|
+
* The `fullscreen` option of `_smartico.miniGame()` overrides it per call.
|
|
400
|
+
*
|
|
401
|
+
* When `false` or omitted, the default frame size is used.
|
|
402
|
+
* Back-Office label: _"Standalone full screen"_.
|
|
403
|
+
*/
|
|
404
|
+
standalone_fullscreen?: boolean;
|
|
405
|
+
/**
|
|
406
|
+
* Width of the custom mini-game frame on desktop when opened standalone or inline,
|
|
407
|
+
* as a CSS size (`800px`, `100%`, `90vw`; a bare number is treated as pixels).
|
|
408
|
+
* Empty or invalid values fall back to the default 800px. Ignored on mobile.
|
|
409
|
+
* Back-Office label: _"Standalone width"_.
|
|
410
|
+
*/
|
|
411
|
+
standalone_width?: string;
|
|
412
|
+
/**
|
|
413
|
+
* Height of the custom mini-game frame on desktop when opened standalone or inline,
|
|
414
|
+
* as a CSS size (`516px`, `100%`, `90vh`; a bare number is treated as pixels).
|
|
415
|
+
* Empty or invalid values fall back to the default 516px. Ignored on mobile.
|
|
416
|
+
* Back-Office label: _"Standalone height"_.
|
|
417
|
+
*/
|
|
418
|
+
standalone_height?: string;
|
|
393
419
|
/**
|
|
394
420
|
* Minutes for the Voyager seed window.
|
|
395
421
|
* The seed window is the range of seeds that can be used to generate the map.
|
package/dist/SmarticoGlobal.d.ts
CHANGED
|
@@ -34,6 +34,24 @@ export interface SmarticoWidgetParams {
|
|
|
34
34
|
zoom?: number;
|
|
35
35
|
/** Force the mobile layout regardless of viewport. */
|
|
36
36
|
force_mobile?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Custom mini-games only ({@link SmarticoGlobal.miniGame}): `true` fills the whole mini-game window,
|
|
39
|
+
* `false` keeps the default fixed-size frame. Overrides the template's "Standalone full screen" setting;
|
|
40
|
+
* when omitted, the template setting is used.
|
|
41
|
+
*/
|
|
42
|
+
fullscreen?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Custom mini-games only ({@link SmarticoGlobal.miniGame}): desktop width of the game frame as a CSS size
|
|
45
|
+
* (`1000px`, `100%`, `90vw`; a number is treated as pixels). Overrides the template's "Standalone width"
|
|
46
|
+
* and "Standalone full screen" settings. Ignored on mobile.
|
|
47
|
+
*/
|
|
48
|
+
frame_width?: string | number;
|
|
49
|
+
/**
|
|
50
|
+
* Custom mini-games only ({@link SmarticoGlobal.miniGame}): desktop height of the game frame as a CSS size
|
|
51
|
+
* (`600px`, `100%`, `90vh`; a number is treated as pixels). Overrides the template's "Standalone height"
|
|
52
|
+
* and "Standalone full screen" settings. Ignored on mobile.
|
|
53
|
+
*/
|
|
54
|
+
frame_height?: string | number;
|
|
37
55
|
}
|
|
38
56
|
/**
|
|
39
57
|
* Options passed to {@link SmarticoGlobal.init} / {@link SmarticoGlobal.initVisitorMode}.
|
|
@@ -318,6 +318,16 @@ export declare class WSAPIInbox extends WSAPILeaderBoard {
|
|
|
318
318
|
* for safe execution — that helper handles URL vs deep-link
|
|
319
319
|
* routing.
|
|
320
320
|
*
|
|
321
|
+
* **Preview vs silent delivery**
|
|
322
|
+
* Every message belongs in your inbox list. `show_preview` decides
|
|
323
|
+
* whether it should also pop up briefly when it arrives:
|
|
324
|
+
* - `show_preview !== false` → show a preview popup for
|
|
325
|
+
* `show_duration_sec ?? 7` seconds.
|
|
326
|
+
* - `show_preview === false` → store it silently, with no popup.
|
|
327
|
+
* These fields are returned exactly as the operator configured them;
|
|
328
|
+
* a missing value means the default above, the same as the default
|
|
329
|
+
* Smartico UI.
|
|
330
|
+
*
|
|
321
331
|
* **Idempotency / Side effects**: safe. Read-only HTTP fetch.
|
|
322
332
|
*
|
|
323
333
|
* **UI guidance**: see [UI Guide — `getInboxMessageBody`](../../docs/ui/inbox/UIGuide_getInboxMessageBody.md).
|
|
@@ -343,6 +353,12 @@ export declare class WSAPIInbox extends WSAPILeaderBoard {
|
|
|
343
353
|
* console.log('[smartico] simple message — show preview_body + single CTA wired to:', body.action,
|
|
344
354
|
* '— execute via _smartico.dp(body.action)');
|
|
345
355
|
* }
|
|
356
|
+
*
|
|
357
|
+
* if (body.show_preview !== false) {
|
|
358
|
+
* console.log('[smartico] new message — show a preview popup for', body.show_duration_sec ?? 7, 'seconds');
|
|
359
|
+
* } else {
|
|
360
|
+
* console.log('[smartico] new message — store it in the inbox silently, no popup');
|
|
361
|
+
* }
|
|
346
362
|
* ```
|
|
347
363
|
*/
|
|
348
364
|
getInboxMessageBody(messageGuid: string): Promise<TInboxMessageBody>;
|
|
@@ -1083,6 +1083,12 @@ export interface TInboxMessageBody {
|
|
|
1083
1083
|
/** Operator-defined custom data. The SDK auto-parses JSON-looking
|
|
1084
1084
|
* strings, so at runtime this is `any` despite the `string` type. */
|
|
1085
1085
|
custom_data?: string;
|
|
1086
|
+
/** Whether to show a short preview popup when the message arrives.
|
|
1087
|
+
* `false` means store it in the inbox silently; missing means `true`. */
|
|
1088
|
+
show_preview?: boolean;
|
|
1089
|
+
/** How long the preview popup stays visible, in seconds.
|
|
1090
|
+
* `null` or missing means 7 seconds. */
|
|
1091
|
+
show_duration_sec?: number | null;
|
|
1086
1092
|
}
|
|
1087
1093
|
/**
|
|
1088
1094
|
* InboxMarkMessageAction is the response of the five inbox mutation
|
package/dist/index.js
CHANGED
|
@@ -961,7 +961,9 @@ var InboxMessageBodyTransform = function InboxMessageBodyTransform(item) {
|
|
|
961
961
|
icon: item.image,
|
|
962
962
|
title: item.title,
|
|
963
963
|
preview_body: item.body,
|
|
964
|
-
custom_data: IntUtils.JsonOrText(item == null ? void 0 : item.custom_data)
|
|
964
|
+
custom_data: IntUtils.JsonOrText(item == null ? void 0 : item.custom_data),
|
|
965
|
+
show_preview: item.show_preview,
|
|
966
|
+
show_duration_sec: item.show_duration_sec
|
|
965
967
|
};
|
|
966
968
|
if (item.action === 'dp:inbox') {
|
|
967
969
|
if (item.additional_buttons && item.additional_buttons.length) {
|
|
@@ -1326,7 +1328,8 @@ exports.BadgesTimeLimitStates = void 0;
|
|
|
1326
1328
|
})(exports.BadgesTimeLimitStates || (exports.BadgesTimeLimitStates = {}));
|
|
1327
1329
|
|
|
1328
1330
|
var _MissionUtils;
|
|
1329
|
-
|
|
1331
|
+
// tag -> favorites (top 3 arrays) that fill it; a task has at most one condition per tag (enforced in the BO)
|
|
1332
|
+
var FAV_TAGS = [['{{suggested_games}}', ['core_fav_game_top3', 'core_fav_game_type_top3', 'core_fav_game_provider_top3']], ['{{suggested_sport}}', ['core_fav_sport_type_top3', 'core_fav_sport_league_top3']]];
|
|
1330
1333
|
var USER_STATE_PARAMS_KEYS_BET_AMOUNT = ['core_recommended_deposit_amount', 'core_recommended_casino_bet_amount', 'core_recommended_sport_bet_amount'];
|
|
1331
1334
|
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']);
|
|
1332
1335
|
function toGameTitleCase(raw) {
|
|
@@ -1505,60 +1508,49 @@ MissionUtils.replaceTagsFavMissionTask = function (_ref) {
|
|
|
1505
1508
|
}
|
|
1506
1509
|
var userStateParams = task.user_state_params || {};
|
|
1507
1510
|
var userStateOperator = (_task$task_public_met = task.task_public_meta) == null ? void 0 : _task$task_public_met.user_state_operations;
|
|
1508
|
-
|
|
1509
|
-
if (userStateParamsKeys.length === 0 || !userStateOperator) {
|
|
1511
|
+
if (Object.keys(userStateParams).length === 0 || !userStateOperator) {
|
|
1510
1512
|
return result;
|
|
1511
1513
|
}
|
|
1512
|
-
var
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1514
|
+
var formatFav = function formatFav(v) {
|
|
1515
|
+
return toGameTitleCase(v.replace(/_/g, ' '));
|
|
1516
|
+
};
|
|
1517
|
+
// 'has' / '!has' -> all favorites, 'posN' -> the N-th one
|
|
1518
|
+
var favValue = function favValue(k) {
|
|
1517
1519
|
var _userStateOperator$k;
|
|
1520
|
+
var values = userStateParams[k];
|
|
1518
1521
|
var operator = (_userStateOperator$k = userStateOperator[k]) == null ? void 0 : _userStateOperator$k.op;
|
|
1519
|
-
if (
|
|
1520
|
-
|
|
1521
|
-
var _userStateParams$k;
|
|
1522
|
-
var value = (_userStateParams$k = userStateParams[k]) == null ? void 0 : _userStateParams$k.filter(function (v) {
|
|
1523
|
-
return Boolean(v);
|
|
1524
|
-
});
|
|
1525
|
-
if (value && value.length > 0) {
|
|
1526
|
-
suggestedGames = value.map(function (v) {
|
|
1527
|
-
var cleaned = v.replace(/_/g, ' ');
|
|
1528
|
-
return toGameTitleCase(cleaned);
|
|
1529
|
-
}).join(', ');
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
if (operatorsPos.includes(operator)) {
|
|
1533
|
-
var _value = userStateParams[k];
|
|
1534
|
-
var pos = Number(operator.replace('pos', '')) - 1;
|
|
1535
|
-
if (IntUtils.isNotNull(pos) && _value && _value[pos]) {
|
|
1536
|
-
suggestedGames = _value[pos];
|
|
1537
|
-
if (suggestedGames) {
|
|
1538
|
-
suggestedGames = toGameTitleCase(suggestedGames.replace(/_/g, ' '));
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1522
|
+
if (!Array.isArray(values)) {
|
|
1523
|
+
return '';
|
|
1542
1524
|
}
|
|
1543
|
-
if (
|
|
1544
|
-
|
|
1545
|
-
if (suggestedValue) {
|
|
1546
|
-
var currencyFromTheTask = userStateParams == null ? void 0 : userStateParams.core_wallet_currency;
|
|
1547
|
-
suggestedValue = suggestedValue + " " + (currencySymbol || currencyFromTheTask || '');
|
|
1548
|
-
}
|
|
1525
|
+
if (operator === 'has' || operator === '!has') {
|
|
1526
|
+
return values.filter(Boolean).map(formatFav).join(', ');
|
|
1549
1527
|
}
|
|
1528
|
+
var pos = /^pos[1-3]$/.test(operator) ? values[Number(operator.substring(3)) - 1] : null;
|
|
1529
|
+
return pos ? formatFav(pos) : '';
|
|
1530
|
+
};
|
|
1531
|
+
// split/join replaces every occurrence of the tag, not only the first one
|
|
1532
|
+
var replaceTag = function replaceTag(tag, value) {
|
|
1533
|
+
if (value && result) {
|
|
1534
|
+
result = result.split(tag).join(value);
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
FAV_TAGS.forEach(function (_ref2) {
|
|
1538
|
+
var tag = _ref2[0],
|
|
1539
|
+
keys = _ref2[1];
|
|
1540
|
+
replaceTag(tag, keys.map(favValue).find(Boolean));
|
|
1550
1541
|
});
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
}
|
|
1554
|
-
if (
|
|
1555
|
-
|
|
1542
|
+
var amountKey = USER_STATE_PARAMS_KEYS_BET_AMOUNT.find(function (k) {
|
|
1543
|
+
return userStateParams[k];
|
|
1544
|
+
});
|
|
1545
|
+
if (amountKey) {
|
|
1546
|
+
var currencyFromTheTask = userStateParams.core_wallet_currency;
|
|
1547
|
+
replaceTag('{{suggested_value}}', userStateParams[amountKey] + " " + (currencySymbol || currencyFromTheTask || ''));
|
|
1556
1548
|
}
|
|
1557
1549
|
return result;
|
|
1558
1550
|
};
|
|
1559
|
-
MissionUtils.replaceFavGameNameTag = function (
|
|
1560
|
-
var task =
|
|
1561
|
-
currencySymbol =
|
|
1551
|
+
MissionUtils.replaceFavGameNameTag = function (_ref3) {
|
|
1552
|
+
var task = _ref3.task,
|
|
1553
|
+
currencySymbol = _ref3.currencySymbol;
|
|
1562
1554
|
if (task && task.task_public_meta && task.task_public_meta.name) {
|
|
1563
1555
|
task.task_public_meta.name = _MissionUtils.replaceTagsFavMissionTask({
|
|
1564
1556
|
task: task,
|
|
@@ -1631,19 +1623,19 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
|
|
|
1631
1623
|
if ((_r$ach_public_meta$na = r.ach_public_meta.name) != null && _r$ach_public_meta$na.includes('{{suggested_')) {
|
|
1632
1624
|
missionName = MissionUtils.replaceTagsFavMissionTask({
|
|
1633
1625
|
task: t,
|
|
1634
|
-
valueToReplace:
|
|
1626
|
+
valueToReplace: missionName
|
|
1635
1627
|
});
|
|
1636
1628
|
}
|
|
1637
1629
|
if ((_r$ach_public_meta$su = r.ach_public_meta.sub_header) != null && _r$ach_public_meta$su.includes('{{suggested_')) {
|
|
1638
1630
|
missionSubHeader = MissionUtils.replaceTagsFavMissionTask({
|
|
1639
1631
|
task: t,
|
|
1640
|
-
valueToReplace:
|
|
1632
|
+
valueToReplace: missionSubHeader
|
|
1641
1633
|
});
|
|
1642
1634
|
}
|
|
1643
1635
|
if ((_r$ach_public_meta$de = r.ach_public_meta.description) != null && _r$ach_public_meta$de.includes('{{suggested_')) {
|
|
1644
1636
|
missionDescription = MissionUtils.replaceTagsFavMissionTask({
|
|
1645
1637
|
task: t,
|
|
1646
|
-
valueToReplace:
|
|
1638
|
+
valueToReplace: missionDescription
|
|
1647
1639
|
});
|
|
1648
1640
|
}
|
|
1649
1641
|
});
|
|
@@ -9877,6 +9869,16 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
|
|
|
9877
9869
|
* for safe execution — that helper handles URL vs deep-link
|
|
9878
9870
|
* routing.
|
|
9879
9871
|
*
|
|
9872
|
+
* **Preview vs silent delivery**
|
|
9873
|
+
* Every message belongs in your inbox list. `show_preview` decides
|
|
9874
|
+
* whether it should also pop up briefly when it arrives:
|
|
9875
|
+
* - `show_preview !== false` → show a preview popup for
|
|
9876
|
+
* `show_duration_sec ?? 7` seconds.
|
|
9877
|
+
* - `show_preview === false` → store it silently, with no popup.
|
|
9878
|
+
* These fields are returned exactly as the operator configured them;
|
|
9879
|
+
* a missing value means the default above, the same as the default
|
|
9880
|
+
* Smartico UI.
|
|
9881
|
+
*
|
|
9880
9882
|
* **Idempotency / Side effects**: safe. Read-only HTTP fetch.
|
|
9881
9883
|
*
|
|
9882
9884
|
* **UI guidance**: see [UI Guide — `getInboxMessageBody`](../../docs/ui/inbox/UIGuide_getInboxMessageBody.md).
|
|
@@ -9902,6 +9904,12 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
|
|
|
9902
9904
|
* console.log('[smartico] simple message — show preview_body + single CTA wired to:', body.action,
|
|
9903
9905
|
* '— execute via _smartico.dp(body.action)');
|
|
9904
9906
|
* }
|
|
9907
|
+
*
|
|
9908
|
+
* if (body.show_preview !== false) {
|
|
9909
|
+
* console.log('[smartico] new message — show a preview popup for', body.show_duration_sec ?? 7, 'seconds');
|
|
9910
|
+
* } else {
|
|
9911
|
+
* console.log('[smartico] new message — store it in the inbox silently, no popup');
|
|
9912
|
+
* }
|
|
9905
9913
|
* ```
|
|
9906
9914
|
*/
|
|
9907
9915
|
;
|