@smartico/public-api 0.0.351 → 0.0.353
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/GPTypes.d.ts +268 -0
- package/dist/GamePick/index.d.ts +1 -0
- package/dist/Raffle/Raffle.d.ts +13 -0
- package/dist/SmarticoAPI.d.ts +20 -0
- package/dist/Tournaments/Tournament.d.ts +2 -0
- package/dist/WSAPI/WSAPI.d.ts +334 -1
- package/dist/WSAPI/WSAPITypes.d.ts +10 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1223 -452
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +731 -83
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +3 -0
- package/docs/api/classes/WSAPI.md +199 -0
- package/docs/api/enums/QuizAnswersValueType.md +121 -0
- package/docs/api/enums/RaffleTicketCapVisualization.md +25 -0
- package/docs/api/enums/SAWGPMarketType.md +157 -0
- package/docs/api/interfaces/RafflePublicMeta.md +9 -0
- package/docs/api/interfaces/TRaffle.md +8 -0
- package/docs/api/interfaces/TTournament.md +8 -0
- package/docs/api/interfaces/TTournamentDetailed.md +12 -0
- package/docs/api/interfaces/Tournament.md +8 -0
- package/package.json +4 -2
- package/src/GamePick/GPTypes.ts +277 -0
- package/src/GamePick/index.ts +1 -0
- package/src/Raffle/GetRafflesResponse.ts +1 -0
- package/src/Raffle/Raffle.ts +14 -0
- package/src/SmarticoAPI.ts +158 -13
- package/src/Tournaments/Tournament.ts +5 -2
- package/src/WSAPI/WSAPI.ts +476 -62
- package/src/WSAPI/WSAPITypes.ts +10 -2
- package/src/index.ts +3 -1
package/dist/index.modern.mjs
CHANGED
|
@@ -169,18 +169,13 @@ var ClassId;
|
|
|
169
169
|
})(ClassId || (ClassId = {}));
|
|
170
170
|
|
|
171
171
|
function _extends() {
|
|
172
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
173
|
-
for (var
|
|
174
|
-
var
|
|
175
|
-
for (var
|
|
176
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
177
|
-
target[key] = source[key];
|
|
178
|
-
}
|
|
179
|
-
}
|
|
172
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
173
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
174
|
+
var t = arguments[e];
|
|
175
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
180
176
|
}
|
|
181
|
-
return
|
|
182
|
-
};
|
|
183
|
-
return _extends.apply(this, arguments);
|
|
177
|
+
return n;
|
|
178
|
+
}, _extends.apply(null, arguments);
|
|
184
179
|
}
|
|
185
180
|
|
|
186
181
|
class IntUtils {
|
|
@@ -1211,16 +1206,16 @@ var BadgesTimeLimitStates;
|
|
|
1211
1206
|
BadgesTimeLimitStates[BadgesTimeLimitStates["AfterEndDateWithProgress"] = 5] = "AfterEndDateWithProgress";
|
|
1212
1207
|
})(BadgesTimeLimitStates || (BadgesTimeLimitStates = {}));
|
|
1213
1208
|
|
|
1214
|
-
var
|
|
1209
|
+
var _MissionUtils;
|
|
1215
1210
|
class MissionUtils {}
|
|
1216
|
-
|
|
1211
|
+
_MissionUtils = MissionUtils;
|
|
1217
1212
|
MissionUtils.getAvailabilityStatus = mission => {
|
|
1218
1213
|
if (!mission) {
|
|
1219
1214
|
return null;
|
|
1220
1215
|
}
|
|
1221
|
-
const activeFrom = mission.active_from_ts ?
|
|
1222
|
-
const activeTill = mission.active_till_ts ?
|
|
1223
|
-
const startDate = mission.start_date_ts ?
|
|
1216
|
+
const activeFrom = mission.active_from_ts ? _MissionUtils.getMs(mission.active_from_ts) : null;
|
|
1217
|
+
const activeTill = mission.active_till_ts ? _MissionUtils.getMs(mission.active_till_ts) : null;
|
|
1218
|
+
const startDate = mission.start_date_ts ? _MissionUtils.getMs(mission.start_date_ts) : null;
|
|
1224
1219
|
const timeLimit = mission.time_limit_ms;
|
|
1225
1220
|
const requiresOptIn = mission.requiresOptin;
|
|
1226
1221
|
const optedIn = mission.isOptedIn;
|
|
@@ -1425,7 +1420,7 @@ MissionUtils.replaceFavGameNameTag = ({
|
|
|
1425
1420
|
currencySymbol
|
|
1426
1421
|
}) => {
|
|
1427
1422
|
if (task && task.task_public_meta && task.task_public_meta.name) {
|
|
1428
|
-
task.task_public_meta.name =
|
|
1423
|
+
task.task_public_meta.name = _MissionUtils.replaceTagsFavMissionTask({
|
|
1429
1424
|
task,
|
|
1430
1425
|
valueToReplace: task.task_public_meta.name,
|
|
1431
1426
|
currencySymbol
|
|
@@ -1829,7 +1824,8 @@ const TournamentItemsTransform = items => {
|
|
|
1829
1824
|
is_in_progress: TournamentUtils.isInProgress(r),
|
|
1830
1825
|
is_upcoming: TournamentUtils.isUpcoming(r),
|
|
1831
1826
|
min_scores_win: r.minScoreToWin,
|
|
1832
|
-
hide_leaderboard_min_scores: r.hideLeaderboardsMinScores
|
|
1827
|
+
hide_leaderboard_min_scores: r.hideLeaderboardsMinScores,
|
|
1828
|
+
total_scores: r.totalScores
|
|
1833
1829
|
});
|
|
1834
1830
|
if (r.prizeStructure) {
|
|
1835
1831
|
x.prizes = r.prizeStructure.prizes.map(p => TournamentUtils.getPrizeTransformed(p));
|
|
@@ -2056,7 +2052,8 @@ const raffleTransform = items => {
|
|
|
2056
2052
|
end_date: item.end_date_ts,
|
|
2057
2053
|
max_tickets_count: item.max_tickets_count,
|
|
2058
2054
|
current_tickets_count: item.current_tickets_count,
|
|
2059
|
-
draws: drawTransform(item.draws)
|
|
2055
|
+
draws: drawTransform(item.draws),
|
|
2056
|
+
ticket_cap_visualization: item.public_meta.ticket_cap_visualization
|
|
2060
2057
|
};
|
|
2061
2058
|
});
|
|
2062
2059
|
};
|
|
@@ -2095,6 +2092,16 @@ const drawRunTransform = res => {
|
|
|
2095
2092
|
};
|
|
2096
2093
|
};
|
|
2097
2094
|
|
|
2095
|
+
var RaffleTicketCapVisualization;
|
|
2096
|
+
(function (RaffleTicketCapVisualization) {
|
|
2097
|
+
/** Show nothing */
|
|
2098
|
+
RaffleTicketCapVisualization[RaffleTicketCapVisualization["Empty"] = 0] = "Empty";
|
|
2099
|
+
/** Show ticket counter */
|
|
2100
|
+
RaffleTicketCapVisualization[RaffleTicketCapVisualization["Counter"] = 1] = "Counter";
|
|
2101
|
+
/** Show message when ticket cap is reached */
|
|
2102
|
+
RaffleTicketCapVisualization[RaffleTicketCapVisualization["Message"] = 2] = "Message";
|
|
2103
|
+
})(RaffleTicketCapVisualization || (RaffleTicketCapVisualization = {}));
|
|
2104
|
+
|
|
2098
2105
|
var RaffleDrawInstanceState;
|
|
2099
2106
|
(function (RaffleDrawInstanceState) {
|
|
2100
2107
|
/** Draw is open for the tickets collection */
|
|
@@ -2186,11 +2193,13 @@ var onUpdateContextKey;
|
|
|
2186
2193
|
/** @group General API */
|
|
2187
2194
|
class WSAPI {
|
|
2188
2195
|
/** @private */
|
|
2189
|
-
constructor(api) {
|
|
2196
|
+
constructor(api, userExtId = null) {
|
|
2190
2197
|
this.api = void 0;
|
|
2191
2198
|
this.onUpdateCallback = new Map();
|
|
2192
2199
|
this.jackpotGetSignature = '';
|
|
2200
|
+
this.userExtId = null;
|
|
2193
2201
|
this.api = api;
|
|
2202
|
+
this.userExtId = userExtId;
|
|
2194
2203
|
OCache.clearAll();
|
|
2195
2204
|
if (this.api.tracker) {
|
|
2196
2205
|
const on = this.api.tracker.on;
|
|
@@ -2276,7 +2285,7 @@ class WSAPI {
|
|
|
2276
2285
|
* **Visitor mode: not supported**
|
|
2277
2286
|
*/
|
|
2278
2287
|
async checkSegmentMatch(segment_id) {
|
|
2279
|
-
const r = await this.api.coreCheckSegments(
|
|
2288
|
+
const r = await this.api.coreCheckSegments(this.userExtId, [segment_id]);
|
|
2280
2289
|
if (r && r.find(s => s.segment_id === segment_id && s.is_matching)) {
|
|
2281
2290
|
return true;
|
|
2282
2291
|
} else {
|
|
@@ -2293,7 +2302,7 @@ class WSAPI {
|
|
|
2293
2302
|
* **Visitor mode: not supported**
|
|
2294
2303
|
*/
|
|
2295
2304
|
async checkSegmentListMatch(segment_ids) {
|
|
2296
|
-
return await this.api.coreCheckSegments(
|
|
2305
|
+
return await this.api.coreCheckSegments(this.userExtId, Array.isArray(segment_ids) ? segment_ids : [segment_ids]);
|
|
2297
2306
|
}
|
|
2298
2307
|
/** Returns all the levels available the current user
|
|
2299
2308
|
* **Example**:
|
|
@@ -2311,7 +2320,7 @@ class WSAPI {
|
|
|
2311
2320
|
* ```
|
|
2312
2321
|
*/
|
|
2313
2322
|
async getLevels() {
|
|
2314
|
-
return OCache.use(onUpdateContextKey.Levels, ECacheContext.WSAPI, () => this.api.levelsGetT(
|
|
2323
|
+
return OCache.use(onUpdateContextKey.Levels, ECacheContext.WSAPI, () => this.api.levelsGetT(this.userExtId), CACHE_DATA_SEC);
|
|
2315
2324
|
}
|
|
2316
2325
|
/**
|
|
2317
2326
|
* Returns the current level of the user with extended information including ordinal position and progress.
|
|
@@ -2326,7 +2335,7 @@ class WSAPI {
|
|
|
2326
2335
|
* **Visitor mode: not supported**
|
|
2327
2336
|
*/
|
|
2328
2337
|
async getCurrentLevel() {
|
|
2329
|
-
return OCache.use(onUpdateContextKey.CurrentLevel, ECacheContext.WSAPI, () => this.api.getLevelCurrent(
|
|
2338
|
+
return OCache.use(onUpdateContextKey.CurrentLevel, ECacheContext.WSAPI, () => this.api.getLevelCurrent(this.userExtId), CACHE_DATA_SEC);
|
|
2330
2339
|
}
|
|
2331
2340
|
/** Returns all the missions configured for the current user (server-side scoped, not filtered by Widget visibility).
|
|
2332
2341
|
* The returned missions are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
@@ -2353,7 +2362,7 @@ class WSAPI {
|
|
|
2353
2362
|
if (onUpdate) {
|
|
2354
2363
|
this.onUpdateCallback.set(onUpdateContextKey.Missions, onUpdate);
|
|
2355
2364
|
}
|
|
2356
|
-
return OCache.use(onUpdateContextKey.Missions, ECacheContext.WSAPI, () => this.api.missionsGetItemsT(
|
|
2365
|
+
return OCache.use(onUpdateContextKey.Missions, ECacheContext.WSAPI, () => this.api.missionsGetItemsT(this.userExtId), CACHE_DATA_SEC);
|
|
2357
2366
|
}
|
|
2358
2367
|
/**
|
|
2359
2368
|
* Returns all the badges available the current user
|
|
@@ -2361,7 +2370,7 @@ class WSAPI {
|
|
|
2361
2370
|
* **Visitor mode: not supported**
|
|
2362
2371
|
*/
|
|
2363
2372
|
async getBadges() {
|
|
2364
|
-
return OCache.use(onUpdateContextKey.Badges, ECacheContext.WSAPI, () => this.api.badgetsGetItemsT(
|
|
2373
|
+
return OCache.use(onUpdateContextKey.Badges, ECacheContext.WSAPI, () => this.api.badgetsGetItemsT(this.userExtId), CACHE_DATA_SEC);
|
|
2365
2374
|
}
|
|
2366
2375
|
/**
|
|
2367
2376
|
* Returns all the bonuses for the current user
|
|
@@ -2377,7 +2386,7 @@ class WSAPI {
|
|
|
2377
2386
|
if (onUpdate) {
|
|
2378
2387
|
this.onUpdateCallback.set(onUpdateContextKey.Bonuses, onUpdate);
|
|
2379
2388
|
}
|
|
2380
|
-
return OCache.use(onUpdateContextKey.Bonuses, ECacheContext.WSAPI, () => this.api.bonusesGetItemsT(
|
|
2389
|
+
return OCache.use(onUpdateContextKey.Bonuses, ECacheContext.WSAPI, () => this.api.bonusesGetItemsT(this.userExtId), CACHE_DATA_SEC);
|
|
2381
2390
|
}
|
|
2382
2391
|
/**
|
|
2383
2392
|
* Claim the bonus by bonus_id. Returns the err_code in case of success or error.
|
|
@@ -2388,7 +2397,7 @@ class WSAPI {
|
|
|
2388
2397
|
* **Visitor mode: not supported**
|
|
2389
2398
|
*/
|
|
2390
2399
|
async claimBonus(bonus_id) {
|
|
2391
|
-
const r = await this.api.bonusClaimItem(
|
|
2400
|
+
const r = await this.api.bonusClaimItem(this.userExtId, bonus_id);
|
|
2392
2401
|
const o = {
|
|
2393
2402
|
err_code: r.errCode,
|
|
2394
2403
|
err_message: r.errMsg,
|
|
@@ -2411,7 +2420,7 @@ class WSAPI {
|
|
|
2411
2420
|
* **Visitor mode: not supported**
|
|
2412
2421
|
*/
|
|
2413
2422
|
async getUserLevelExtraCounters() {
|
|
2414
|
-
return OCache.use(onUpdateContextKey.LevelExtraCounters, ECacheContext.WSAPI, () => this.api.getUserGamificationInfoT(
|
|
2423
|
+
return OCache.use(onUpdateContextKey.LevelExtraCounters, ECacheContext.WSAPI, () => this.api.getUserGamificationInfoT(this.userExtId), CACHE_DATA_SEC);
|
|
2415
2424
|
}
|
|
2416
2425
|
/**
|
|
2417
2426
|
*
|
|
@@ -2442,7 +2451,7 @@ class WSAPI {
|
|
|
2442
2451
|
if (onUpdate) {
|
|
2443
2452
|
this.onUpdateCallback.set(onUpdateContextKey.StoreItems, onUpdate);
|
|
2444
2453
|
}
|
|
2445
|
-
return OCache.use(onUpdateContextKey.StoreItems, ECacheContext.WSAPI, () => this.api.storeGetItemsT(
|
|
2454
|
+
return OCache.use(onUpdateContextKey.StoreItems, ECacheContext.WSAPI, () => this.api.storeGetItemsT(this.userExtId), CACHE_DATA_SEC);
|
|
2446
2455
|
}
|
|
2447
2456
|
/** Buy the specific shop item by item_id. Returns the err_code in case of success or error.
|
|
2448
2457
|
* **Example**:
|
|
@@ -2455,7 +2464,7 @@ class WSAPI {
|
|
|
2455
2464
|
* **Visitor mode: not supported**
|
|
2456
2465
|
*/
|
|
2457
2466
|
async buyStoreItem(item_id) {
|
|
2458
|
-
const r = await this.api.buyStoreItem(
|
|
2467
|
+
const r = await this.api.buyStoreItem(this.userExtId, item_id);
|
|
2459
2468
|
const o = {
|
|
2460
2469
|
err_code: r.errCode,
|
|
2461
2470
|
err_message: r.errMsg
|
|
@@ -2481,7 +2490,7 @@ class WSAPI {
|
|
|
2481
2490
|
* ```
|
|
2482
2491
|
*/
|
|
2483
2492
|
async getStoreCategories() {
|
|
2484
|
-
return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(
|
|
2493
|
+
return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(this.userExtId), CACHE_DATA_SEC);
|
|
2485
2494
|
}
|
|
2486
2495
|
/**
|
|
2487
2496
|
* Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
@@ -2508,7 +2517,7 @@ class WSAPI {
|
|
|
2508
2517
|
if (onUpdate) {
|
|
2509
2518
|
this.onUpdateCallback.set(onUpdateContextKey.StoreHistory, onUpdate);
|
|
2510
2519
|
}
|
|
2511
|
-
return OCache.use(onUpdateContextKey.StoreHistory, ECacheContext.WSAPI, () => this.api.storeGetPurchasedItemsT(
|
|
2520
|
+
return OCache.use(onUpdateContextKey.StoreHistory, ECacheContext.WSAPI, () => this.api.storeGetPurchasedItemsT(this.userExtId, limit, offset), CACHE_DATA_SEC);
|
|
2512
2521
|
}
|
|
2513
2522
|
/**
|
|
2514
2523
|
* Returns missions & badges categories
|
|
@@ -2529,7 +2538,7 @@ class WSAPI {
|
|
|
2529
2538
|
*
|
|
2530
2539
|
* */
|
|
2531
2540
|
async getAchCategories() {
|
|
2532
|
-
return OCache.use(onUpdateContextKey.AchCategories, ECacheContext.WSAPI, () => this.api.achGetCategoriesT(
|
|
2541
|
+
return OCache.use(onUpdateContextKey.AchCategories, ECacheContext.WSAPI, () => this.api.achGetCategoriesT(this.userExtId), CACHE_DATA_SEC);
|
|
2533
2542
|
}
|
|
2534
2543
|
/**
|
|
2535
2544
|
* Returns list of custom sections
|
|
@@ -2550,7 +2559,7 @@ class WSAPI {
|
|
|
2550
2559
|
*
|
|
2551
2560
|
* */
|
|
2552
2561
|
async getCustomSections() {
|
|
2553
|
-
return OCache.use(onUpdateContextKey.CustomSections, ECacheContext.WSAPI, () => this.api.customSectionsGetT(
|
|
2562
|
+
return OCache.use(onUpdateContextKey.CustomSections, ECacheContext.WSAPI, () => this.api.customSectionsGetT(this.userExtId), CACHE_DATA_SEC);
|
|
2554
2563
|
}
|
|
2555
2564
|
/**
|
|
2556
2565
|
* Returns the list of mini-games configured for the current user (not filtered by spin availability or Widget visibility).
|
|
@@ -2578,7 +2587,7 @@ class WSAPI {
|
|
|
2578
2587
|
if (onUpdate) {
|
|
2579
2588
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
2580
2589
|
}
|
|
2581
|
-
return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(
|
|
2590
|
+
return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(this.userExtId), CACHE_DATA_SEC);
|
|
2582
2591
|
}
|
|
2583
2592
|
/**
|
|
2584
2593
|
* Returns the list of mini-games based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
@@ -2600,7 +2609,7 @@ class WSAPI {
|
|
|
2600
2609
|
offset,
|
|
2601
2610
|
saw_template_id
|
|
2602
2611
|
}) {
|
|
2603
|
-
return OCache.use(onUpdateContextKey.SAWHistory, ECacheContext.WSAPI, () => this.api.getSawWinningHistoryT(
|
|
2612
|
+
return OCache.use(onUpdateContextKey.SAWHistory, ECacheContext.WSAPI, () => this.api.getSawWinningHistoryT(this.userExtId, limit, offset, saw_template_id), CACHE_DATA_SEC);
|
|
2604
2613
|
}
|
|
2605
2614
|
/**
|
|
2606
2615
|
* Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
@@ -2622,8 +2631,8 @@ class WSAPI {
|
|
|
2622
2631
|
if (onUpdate) {
|
|
2623
2632
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
2624
2633
|
}
|
|
2625
|
-
const r = await this.api.sawSpinRequest(
|
|
2626
|
-
this.api.doAcknowledgeRequest(
|
|
2634
|
+
const r = await this.api.sawSpinRequest(this.userExtId, template_id);
|
|
2635
|
+
this.api.doAcknowledgeRequest(this.userExtId, r.request_id);
|
|
2627
2636
|
const o = {
|
|
2628
2637
|
err_code: r.errCode,
|
|
2629
2638
|
err_message: r.errMsg,
|
|
@@ -2641,7 +2650,7 @@ class WSAPI {
|
|
|
2641
2650
|
* ```
|
|
2642
2651
|
*/
|
|
2643
2652
|
async miniGameWinAcknowledgeRequest(request_id) {
|
|
2644
|
-
return this.api.doAcknowledgeRequest(
|
|
2653
|
+
return this.api.doAcknowledgeRequest(this.userExtId, request_id);
|
|
2645
2654
|
}
|
|
2646
2655
|
/**
|
|
2647
2656
|
* Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
|
|
@@ -2662,9 +2671,9 @@ class WSAPI {
|
|
|
2662
2671
|
if (onUpdate) {
|
|
2663
2672
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
2664
2673
|
}
|
|
2665
|
-
const response = await this.api.sawSpinBatchRequest(
|
|
2674
|
+
const response = await this.api.sawSpinBatchRequest(this.userExtId, template_id, spin_count);
|
|
2666
2675
|
const request_ids = response.results.map(result => result.request_id);
|
|
2667
|
-
this.api.doAcknowledgeBatchRequest(
|
|
2676
|
+
this.api.doAcknowledgeBatchRequest(this.userExtId, request_ids);
|
|
2668
2677
|
const o = response.results.map(result => ({
|
|
2669
2678
|
errCode: result.errCode,
|
|
2670
2679
|
errMessage: result.errMsg,
|
|
@@ -2680,7 +2689,7 @@ class WSAPI {
|
|
|
2680
2689
|
* **Visitor mode: not supported**
|
|
2681
2690
|
*/
|
|
2682
2691
|
async requestMissionOptIn(mission_id) {
|
|
2683
|
-
const r = await this.api.missionOptIn(
|
|
2692
|
+
const r = await this.api.missionOptIn(this.userExtId, mission_id);
|
|
2684
2693
|
const o = {
|
|
2685
2694
|
err_code: r.errCode,
|
|
2686
2695
|
err_message: r.errMsg
|
|
@@ -2693,7 +2702,7 @@ class WSAPI {
|
|
|
2693
2702
|
* **Visitor mode: not supported**
|
|
2694
2703
|
*/
|
|
2695
2704
|
async requestMissionClaimReward(mission_id, ach_completed_id) {
|
|
2696
|
-
const r = await this.api.missionClaimPrize(
|
|
2705
|
+
const r = await this.api.missionClaimPrize(this.userExtId, mission_id, ach_completed_id);
|
|
2697
2706
|
const o = {
|
|
2698
2707
|
err_code: r.errCode,
|
|
2699
2708
|
err_message: r.errMsg
|
|
@@ -2724,7 +2733,7 @@ class WSAPI {
|
|
|
2724
2733
|
if (onUpdate) {
|
|
2725
2734
|
this.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
|
|
2726
2735
|
}
|
|
2727
|
-
return OCache.use(onUpdateContextKey.TournamentList, ECacheContext.WSAPI, () => this.api.tournamentsGetLobbyT(
|
|
2736
|
+
return OCache.use(onUpdateContextKey.TournamentList, ECacheContext.WSAPI, () => this.api.tournamentsGetLobbyT(this.userExtId), CACHE_DATA_SEC);
|
|
2728
2737
|
}
|
|
2729
2738
|
/**
|
|
2730
2739
|
* Returns details information of specific tournament instance, the response will include tournament info and the leaderboard of players
|
|
@@ -2752,7 +2761,7 @@ class WSAPI {
|
|
|
2752
2761
|
* ```
|
|
2753
2762
|
*/
|
|
2754
2763
|
async getTournamentInstanceInfo(tournamentInstanceId) {
|
|
2755
|
-
return this.api.tournamentsGetInfoT(
|
|
2764
|
+
return this.api.tournamentsGetInfoT(this.userExtId, tournamentInstanceId);
|
|
2756
2765
|
}
|
|
2757
2766
|
/**
|
|
2758
2767
|
* Requests registration for the specified tournament instance. Returns the err_code.
|
|
@@ -2760,7 +2769,7 @@ class WSAPI {
|
|
|
2760
2769
|
* **Visitor mode: not supported**
|
|
2761
2770
|
*/
|
|
2762
2771
|
async registerInTournament(tournamentInstanceId) {
|
|
2763
|
-
const r = await this.api.registerInTournament(
|
|
2772
|
+
const r = await this.api.registerInTournament(this.userExtId, tournamentInstanceId);
|
|
2764
2773
|
const o = {
|
|
2765
2774
|
err_code: r.errCode,
|
|
2766
2775
|
err_message: r.errMsg
|
|
@@ -2786,7 +2795,7 @@ class WSAPI {
|
|
|
2786
2795
|
* ```
|
|
2787
2796
|
*/
|
|
2788
2797
|
async getLeaderBoard(periodType, getPreviousPeriod) {
|
|
2789
|
-
return OCache.use(onUpdateContextKey.LeaderBoards, ECacheContext.WSAPI, () => this.api.leaderboardsGetT(
|
|
2798
|
+
return OCache.use(onUpdateContextKey.LeaderBoards, ECacheContext.WSAPI, () => this.api.leaderboardsGetT(this.userExtId, periodType, getPreviousPeriod), CACHE_DATA_SEC);
|
|
2790
2799
|
}
|
|
2791
2800
|
/** Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
|
|
2792
2801
|
* The maximum number of messages per request is limited to 20.
|
|
@@ -2813,7 +2822,7 @@ class WSAPI {
|
|
|
2813
2822
|
if (onUpdate) {
|
|
2814
2823
|
this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
|
|
2815
2824
|
}
|
|
2816
|
-
return await this.api.getInboxMessagesT(
|
|
2825
|
+
return await this.api.getInboxMessagesT(this.userExtId, from, to, onlyFavorite, categoryId, read_status);
|
|
2817
2826
|
}
|
|
2818
2827
|
/**
|
|
2819
2828
|
* Returns inbox unread count.
|
|
@@ -2827,7 +2836,7 @@ class WSAPI {
|
|
|
2827
2836
|
if (onUpdate) {
|
|
2828
2837
|
this.onUpdateCallback.set(onUpdateContextKey.InboxUnreadCount, onUpdate);
|
|
2829
2838
|
}
|
|
2830
|
-
return OCache.use(onUpdateContextKey.InboxUnreadCount, ECacheContext.WSAPI, () => this.api.getInboxUnreadCountT(
|
|
2839
|
+
return OCache.use(onUpdateContextKey.InboxUnreadCount, ECacheContext.WSAPI, () => this.api.getInboxUnreadCountT(this.userExtId), CACHE_DATA_SEC);
|
|
2831
2840
|
}
|
|
2832
2841
|
/**
|
|
2833
2842
|
* Returns the message body of the specified message guid.
|
|
@@ -2843,7 +2852,7 @@ class WSAPI {
|
|
|
2843
2852
|
* **Visitor mode: not supported**
|
|
2844
2853
|
*/
|
|
2845
2854
|
async markInboxMessageAsRead(messageGuid) {
|
|
2846
|
-
const r = await this.api.markInboxMessageRead(
|
|
2855
|
+
const r = await this.api.markInboxMessageRead(this.userExtId, messageGuid);
|
|
2847
2856
|
return {
|
|
2848
2857
|
err_code: r.errCode,
|
|
2849
2858
|
err_message: r.errMsg
|
|
@@ -2855,7 +2864,7 @@ class WSAPI {
|
|
|
2855
2864
|
* **Visitor mode: not supported**
|
|
2856
2865
|
*/
|
|
2857
2866
|
async markAllInboxMessagesAsRead() {
|
|
2858
|
-
const r = await this.api.markAllInboxMessageRead(
|
|
2867
|
+
const r = await this.api.markAllInboxMessageRead(this.userExtId);
|
|
2859
2868
|
return {
|
|
2860
2869
|
err_code: r.errCode,
|
|
2861
2870
|
err_message: r.errMsg
|
|
@@ -2867,7 +2876,7 @@ class WSAPI {
|
|
|
2867
2876
|
* **Visitor mode: not supported**
|
|
2868
2877
|
*/
|
|
2869
2878
|
async markUnmarkInboxMessageAsFavorite(messageGuid, mark) {
|
|
2870
|
-
const r = await this.api.markUnmarkInboxMessageAsFavorite(
|
|
2879
|
+
const r = await this.api.markUnmarkInboxMessageAsFavorite(this.userExtId, messageGuid, mark);
|
|
2871
2880
|
return {
|
|
2872
2881
|
err_code: r.errCode,
|
|
2873
2882
|
err_message: r.errMsg
|
|
@@ -2879,7 +2888,7 @@ class WSAPI {
|
|
|
2879
2888
|
* **Visitor mode: not supported**
|
|
2880
2889
|
*/
|
|
2881
2890
|
async deleteInboxMessage(messageGuid) {
|
|
2882
|
-
const r = await this.api.deleteInboxMessage(
|
|
2891
|
+
const r = await this.api.deleteInboxMessage(this.userExtId, messageGuid);
|
|
2883
2892
|
return {
|
|
2884
2893
|
err_code: r.errCode,
|
|
2885
2894
|
err_message: r.errMsg
|
|
@@ -2891,7 +2900,7 @@ class WSAPI {
|
|
|
2891
2900
|
* **Visitor mode: not supported**
|
|
2892
2901
|
*/
|
|
2893
2902
|
async deleteAllInboxMessages() {
|
|
2894
|
-
const r = await this.api.deleteAllInboxMessages(
|
|
2903
|
+
const r = await this.api.deleteAllInboxMessages(this.userExtId);
|
|
2895
2904
|
return {
|
|
2896
2905
|
err_code: r.errCode,
|
|
2897
2906
|
err_message: r.errMsg
|
|
@@ -2901,7 +2910,7 @@ class WSAPI {
|
|
|
2901
2910
|
* Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office.
|
|
2902
2911
|
*/
|
|
2903
2912
|
async getTranslations(lang_code) {
|
|
2904
|
-
const r = await this.api.getTranslationsT(
|
|
2913
|
+
const r = await this.api.getTranslationsT(this.userExtId, lang_code, []);
|
|
2905
2914
|
return {
|
|
2906
2915
|
translations: r.translations
|
|
2907
2916
|
};
|
|
@@ -2928,7 +2937,7 @@ class WSAPI {
|
|
|
2928
2937
|
engagement_uid,
|
|
2929
2938
|
activityType
|
|
2930
2939
|
}) {
|
|
2931
|
-
this.api.reportEngagementImpression(
|
|
2940
|
+
this.api.reportEngagementImpression(this.userExtId, engagement_uid, activityType);
|
|
2932
2941
|
}
|
|
2933
2942
|
/**
|
|
2934
2943
|
* Reports a click/action event for an engagement (when user interacts with engagement content).
|
|
@@ -2956,7 +2965,7 @@ class WSAPI {
|
|
|
2956
2965
|
activityType,
|
|
2957
2966
|
action
|
|
2958
2967
|
}) {
|
|
2959
|
-
this.api.reportEngagementAction(
|
|
2968
|
+
this.api.reportEngagementAction(this.userExtId, engagement_uid, activityType, action);
|
|
2960
2969
|
}
|
|
2961
2970
|
/**
|
|
2962
2971
|
* Returns the activity log for a user within a specified time range.
|
|
@@ -2999,53 +3008,448 @@ class WSAPI {
|
|
|
2999
3008
|
if (onUpdate) {
|
|
3000
3009
|
this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
|
|
3001
3010
|
}
|
|
3002
|
-
return await OCache.use(onUpdateContextKey.ActivityLog, ECacheContext.WSAPI, () => this.api.getActivityLogT(
|
|
3011
|
+
return await OCache.use(onUpdateContextKey.ActivityLog, ECacheContext.WSAPI, () => this.api.getActivityLogT(this.userExtId, startTimeSeconds, endTimeSeconds, from, to), CACHE_DATA_SEC);
|
|
3012
|
+
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Returns the active rounds for the specified MatchX or Quiz game.
|
|
3015
|
+
* Each round includes its events (matches/questions) along with the current user's selections and scores.
|
|
3016
|
+
*
|
|
3017
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3018
|
+
*
|
|
3019
|
+
* **Response** `GamesApiResponse<GamePickRound[]>`:
|
|
3020
|
+
* - `errCode` - 0 on success
|
|
3021
|
+
* - `data` - Array of rounds, each containing:
|
|
3022
|
+
* - `round_id`, `round_name` - Round identifier and display name
|
|
3023
|
+
* - `open_date`, `last_bet_date` - Timestamps (ms) for round open and betting deadline
|
|
3024
|
+
* - `is_active_now`, `is_resolved` - Round state flags
|
|
3025
|
+
* - `round_status_id` - Round status: -1 (active), 2 (no more bets), 3 (all events resolved), 4 (round resolved)
|
|
3026
|
+
* - `score_full_win`, `score_part_win`, `score_lost` - Scoring rules per prediction outcome
|
|
3027
|
+
* - `user_score` - Current user's total score in this round
|
|
3028
|
+
* - `user_placed_bet` - Whether the user has submitted predictions
|
|
3029
|
+
* - `has_open_for_bet_events` - Whether there are events still open for betting
|
|
3030
|
+
* - `events[]` - Array of events with `gp_event_id`, `market_type_id`, `event_meta` (team names, images, sport), `match_date`, `is_open_for_bets`, `odds_details`, and user selection fields
|
|
3031
|
+
*
|
|
3032
|
+
* **Example**:
|
|
3033
|
+
* ```
|
|
3034
|
+
* _smartico.api.getGamePickActiveRounds({
|
|
3035
|
+
* saw_template_id: 1083,
|
|
3036
|
+
* }).then((result) => {
|
|
3037
|
+
* console.log(result.data); // GamePickRound[]
|
|
3038
|
+
* result.data.forEach(round => {
|
|
3039
|
+
* console.log(round.round_name, round.events.length);
|
|
3040
|
+
* });
|
|
3041
|
+
* });
|
|
3042
|
+
* ```
|
|
3043
|
+
*
|
|
3044
|
+
* **Visitor mode: not supported**
|
|
3045
|
+
*/
|
|
3046
|
+
async getGamePickActiveRounds(props) {
|
|
3047
|
+
if (!props.saw_template_id) {
|
|
3048
|
+
throw new Error('saw_template_id is required');
|
|
3049
|
+
}
|
|
3050
|
+
return this.api.gpGetActiveRounds(props.saw_template_id);
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* Returns a single active round for the specified MatchX or Quiz game.
|
|
3054
|
+
* The round includes full event details with the current user's selections.
|
|
3055
|
+
*
|
|
3056
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3057
|
+
* @param props.round_id - The specific round to retrieve
|
|
3058
|
+
*
|
|
3059
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
3060
|
+
* - `errCode` - 0 on success
|
|
3061
|
+
* - `data` - Single round object with the same structure as in `getGamePickActiveRounds`,
|
|
3062
|
+
* including `events[]` with full event details, user selections, and resolution info
|
|
3063
|
+
*
|
|
3064
|
+
* **Example**:
|
|
3065
|
+
* ```
|
|
3066
|
+
* _smartico.api.getGamePickActiveRound({
|
|
3067
|
+
* saw_template_id: 1083,
|
|
3068
|
+
* round_id: 31652,
|
|
3069
|
+
* }).then((result) => {
|
|
3070
|
+
* console.log(result.data.round_name, result.data.events.length);
|
|
3071
|
+
* console.log(result.data.user_score, result.data.user_placed_bet);
|
|
3072
|
+
* });
|
|
3073
|
+
* ```
|
|
3074
|
+
*
|
|
3075
|
+
* **Visitor mode: not supported**
|
|
3076
|
+
*/
|
|
3077
|
+
async getGamePickActiveRound(props) {
|
|
3078
|
+
if (!props.saw_template_id) {
|
|
3079
|
+
throw new Error('saw_template_id is required');
|
|
3080
|
+
}
|
|
3081
|
+
if (!props.round_id) {
|
|
3082
|
+
throw new Error('round_id is required');
|
|
3083
|
+
}
|
|
3084
|
+
return this.api.gpGetActiveRound(props.saw_template_id, props.round_id);
|
|
3085
|
+
}
|
|
3086
|
+
/**
|
|
3087
|
+
* Returns the history of all rounds (including resolved ones) for the specified MatchX or Quiz game.
|
|
3088
|
+
* Each round contains full event details with results and the current user's predictions.
|
|
3089
|
+
*
|
|
3090
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3091
|
+
*
|
|
3092
|
+
* **Response** `GamesApiResponse<GamePickRound[]>`:
|
|
3093
|
+
* - `errCode` - 0 on success
|
|
3094
|
+
* - `data` - Array of rounds ordered by `round_row_id` descending (newest first).
|
|
3095
|
+
* Each round has the same structure as in `getGamePickActiveRounds`, including resolved events
|
|
3096
|
+
* with `resolution_type_id` (0=None, 2=Lost, 3=PartialWin, 4=FullWin) and `resolution_score`
|
|
3097
|
+
*
|
|
3098
|
+
* **Example**:
|
|
3099
|
+
* ```
|
|
3100
|
+
* _smartico.api.getGamePickHistory({
|
|
3101
|
+
* saw_template_id: 1083,
|
|
3102
|
+
* }).then((result) => {
|
|
3103
|
+
* result.data.forEach(round => {
|
|
3104
|
+
* console.log(round.round_name, 'Score:', round.user_score, 'Resolved:', round.is_resolved);
|
|
3105
|
+
* });
|
|
3106
|
+
* });
|
|
3107
|
+
* ```
|
|
3108
|
+
*
|
|
3109
|
+
* **Visitor mode: not supported**
|
|
3110
|
+
*/
|
|
3111
|
+
async getGamePickHistory(props) {
|
|
3112
|
+
if (!props.saw_template_id) {
|
|
3113
|
+
throw new Error('saw_template_id is required');
|
|
3114
|
+
}
|
|
3115
|
+
return this.api.gpGetGamesHistory(props.saw_template_id);
|
|
3116
|
+
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Returns the leaderboard for a specific round within a MatchX or Quiz game.
|
|
3119
|
+
* Use `round_id = -1` (AllRoundsGameBoardID) to get the season/overall leaderboard across all rounds.
|
|
3120
|
+
*
|
|
3121
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3122
|
+
* @param props.round_id - The round to get the leaderboard for. Use -1 for overall/seasonal leaderboard
|
|
3123
|
+
*
|
|
3124
|
+
* **Response** `GamesApiResponse<GamePickRoundBoard>`:
|
|
3125
|
+
* - `errCode` - 0 on success
|
|
3126
|
+
* - `data` - Leaderboard object containing:
|
|
3127
|
+
* - Round base fields (`round_id`, `round_name`, `open_date`, `last_bet_date`, etc.)
|
|
3128
|
+
* - `users[]` - Ranked list of players, each with:
|
|
3129
|
+
* - `ext_user_id`, `int_user_id` - User identifiers
|
|
3130
|
+
* - `public_username`, `avatar_url` - Display info (usernames may be masked based on label settings)
|
|
3131
|
+
* - `gp_position` - Leaderboard rank (null if not yet ranked)
|
|
3132
|
+
* - `resolution_score` - Total score in this round
|
|
3133
|
+
* - `full_wins_count`, `part_wins_count`, `lost_count` - Prediction outcome counts
|
|
3134
|
+
* - `my_user` - Current user's entry (same fields as above), or null if user hasn't participated
|
|
3135
|
+
*
|
|
3136
|
+
* **Example**:
|
|
3137
|
+
* ```
|
|
3138
|
+
* _smartico.api.getGamePickBoard({
|
|
3139
|
+
* saw_template_id: 1083,
|
|
3140
|
+
* round_id: 31652,
|
|
3141
|
+
* }).then((result) => {
|
|
3142
|
+
* console.log('Top players:', result.data.users);
|
|
3143
|
+
* console.log('My position:', result.data.my_user?.gp_position);
|
|
3144
|
+
* });
|
|
3145
|
+
* ```
|
|
3146
|
+
*
|
|
3147
|
+
* **Visitor mode: not supported**
|
|
3148
|
+
*/
|
|
3149
|
+
async getGamePickBoard(props) {
|
|
3150
|
+
if (!props.saw_template_id) {
|
|
3151
|
+
throw new Error('saw_template_id is required');
|
|
3152
|
+
}
|
|
3153
|
+
if (!props.round_id) {
|
|
3154
|
+
throw new Error('round_id is required');
|
|
3155
|
+
}
|
|
3156
|
+
return this.api.gpGetGameBoard(props.saw_template_id, props.round_id);
|
|
3157
|
+
}
|
|
3158
|
+
/**
|
|
3159
|
+
* Submits score predictions for a round in a MatchX game.
|
|
3160
|
+
* Sends the round object with user selections for all events at once.
|
|
3161
|
+
* Each event must include `team1_user_selection` and `team2_user_selection` representing predicted scores.
|
|
3162
|
+
* If the user hasn't placed bets before, one game attempt (spin) will be consumed.
|
|
3163
|
+
* Predictions can be edited until each match starts (if `allow_edit_answers` is enabled on the round).
|
|
3164
|
+
*
|
|
3165
|
+
* @param props.saw_template_id - The ID of the MatchX game template
|
|
3166
|
+
* @param props.round - Round object containing `round_id` and `events[]`. Typically obtained from `getGamePickActiveRound`
|
|
3167
|
+
* and modified with user predictions. Each event needs: `gp_event_id`, `team1_user_selection`, `team2_user_selection`
|
|
3168
|
+
*
|
|
3169
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
3170
|
+
* - `errCode` - 0 on success. Non-zero codes indicate errors (e.g. not enough points/attempts)
|
|
3171
|
+
* - `data` - Updated round with all events reflecting the submitted selections.
|
|
3172
|
+
* `user_placed_bet` will be `true`, `has_not_submitted_changes` will be `false`
|
|
3173
|
+
*
|
|
3174
|
+
* **Example**:
|
|
3175
|
+
* ```
|
|
3176
|
+
* _smartico.api.getGamePickActiveRound({
|
|
3177
|
+
* saw_template_id: 1190,
|
|
3178
|
+
* round_id: 38665,
|
|
3179
|
+
* }).then((roundData) => {
|
|
3180
|
+
* const round = roundData.data;
|
|
3181
|
+
* round.events = round.events.map(e => ({
|
|
3182
|
+
* gp_event_id: e.gp_event_id,
|
|
3183
|
+
* team1_user_selection: 1,
|
|
3184
|
+
* team2_user_selection: 0,
|
|
3185
|
+
* }));
|
|
3186
|
+
* _smartico.api.submitGamePickSelection({
|
|
3187
|
+
* saw_template_id: 1190,
|
|
3188
|
+
* round: round,
|
|
3189
|
+
* }).then((result) => {
|
|
3190
|
+
* console.log(result.data.user_placed_bet); // true
|
|
3191
|
+
* });
|
|
3192
|
+
* });
|
|
3193
|
+
* ```
|
|
3194
|
+
*
|
|
3195
|
+
* **Visitor mode: not supported**
|
|
3196
|
+
*/
|
|
3197
|
+
async submitGamePickSelection(props) {
|
|
3198
|
+
var _props$round;
|
|
3199
|
+
if (!props.saw_template_id) {
|
|
3200
|
+
throw new Error('saw_template_id is required');
|
|
3201
|
+
}
|
|
3202
|
+
if (!((_props$round = props.round) != null && _props$round.round_id)) {
|
|
3203
|
+
throw new Error('round is required');
|
|
3204
|
+
}
|
|
3205
|
+
return this.api.gpSubmitSelection(props.saw_template_id, props.round, false);
|
|
3206
|
+
}
|
|
3207
|
+
/**
|
|
3208
|
+
* Submits answers for a round in a Quiz game.
|
|
3209
|
+
* Sends the round object with user answers for all events at once.
|
|
3210
|
+
* Each event must include `user_selection` with the answer value (e.g. '1', '2', 'x', 'yes', 'no' — depending on the market type).
|
|
3211
|
+
* If the user hasn't placed bets before, one game attempt (spin) will be consumed.
|
|
3212
|
+
* Answers can be edited until each match starts (if `allow_edit_answers` is enabled on the round).
|
|
3213
|
+
*
|
|
3214
|
+
* @param props.saw_template_id - The ID of the Quiz game template
|
|
3215
|
+
* @param props.round - Round object containing `round_id` and `events[]`. Typically obtained from `getGamePickActiveRound`
|
|
3216
|
+
* and modified with user answers. Each event needs: `gp_event_id`, `user_selection`
|
|
3217
|
+
*
|
|
3218
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
3219
|
+
* - `errCode` - 0 on success. Non-zero codes indicate errors (e.g. not enough points/attempts)
|
|
3220
|
+
* - `data` - Updated round with all events reflecting the submitted answers.
|
|
3221
|
+
* `user_placed_bet` will be `true`, `has_not_submitted_changes` will be `false`
|
|
3222
|
+
*
|
|
3223
|
+
* **Example**:
|
|
3224
|
+
* ```
|
|
3225
|
+
* _smartico.api.getGamePickActiveRound({
|
|
3226
|
+
* saw_template_id: 1183,
|
|
3227
|
+
* round_id: 37974,
|
|
3228
|
+
* }).then((roundData) => {
|
|
3229
|
+
* const round = roundData.data;
|
|
3230
|
+
* round.events = round.events.map(e => ({
|
|
3231
|
+
* gp_event_id: e.gp_event_id,
|
|
3232
|
+
* user_selection: 'x',
|
|
3233
|
+
* }));
|
|
3234
|
+
* _smartico.api.submitGamePickSelectionQuiz({
|
|
3235
|
+
* saw_template_id: 1183,
|
|
3236
|
+
* round: round,
|
|
3237
|
+
* }).then((result) => {
|
|
3238
|
+
* console.log(result.data.user_placed_bet); // true
|
|
3239
|
+
* });
|
|
3240
|
+
* });
|
|
3241
|
+
* ```
|
|
3242
|
+
*
|
|
3243
|
+
* **Visitor mode: not supported**
|
|
3244
|
+
*/
|
|
3245
|
+
async submitGamePickSelectionQuiz(props) {
|
|
3246
|
+
var _props$round2;
|
|
3247
|
+
if (!props.saw_template_id) {
|
|
3248
|
+
throw new Error('saw_template_id is required');
|
|
3249
|
+
}
|
|
3250
|
+
if (!((_props$round2 = props.round) != null && _props$round2.round_id)) {
|
|
3251
|
+
throw new Error('round is required');
|
|
3252
|
+
}
|
|
3253
|
+
return this.api.gpSubmitSelection(props.saw_template_id, props.round, true);
|
|
3254
|
+
}
|
|
3255
|
+
/**
|
|
3256
|
+
* Returns the current user's profile information within the specified MatchX or Quiz game.
|
|
3257
|
+
* The user record is synced from the Smartico platform into the games DB (synced every 1 minute).
|
|
3258
|
+
* If the user doesn't exist in the games DB yet, it will be created automatically on first call.
|
|
3259
|
+
*
|
|
3260
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3261
|
+
*
|
|
3262
|
+
* **Response** `GamesApiResponse<GamePickUserInfo>`:
|
|
3263
|
+
* - `errCode` - 0 on success
|
|
3264
|
+
* - `data`:
|
|
3265
|
+
* - `ext_user_id` - External user ID (Smartico internal numeric ID)
|
|
3266
|
+
* - `int_user_id` - Internal user ID within the games system
|
|
3267
|
+
* - `public_username` - Display name
|
|
3268
|
+
* - `avatar_url` - User's avatar image URL
|
|
3269
|
+
* - `last_wallet_sync_time` - Last time the user's balance was synced from Smartico
|
|
3270
|
+
* - `ach_points_balance` - User's current points balance
|
|
3271
|
+
* - `ach_gems_balance` - User's current gems balance
|
|
3272
|
+
* - `ach_diamonds_balance` - User's current diamonds balance
|
|
3273
|
+
* - `pubic_username_set` - Whether the user has set a custom username
|
|
3274
|
+
*
|
|
3275
|
+
* **Example**:
|
|
3276
|
+
* ```
|
|
3277
|
+
* _smartico.api.getGamePickUserInfo({
|
|
3278
|
+
* saw_template_id: 1083,
|
|
3279
|
+
* }).then((result) => {
|
|
3280
|
+
* console.log(result.data.public_username, result.data.ach_points_balance);
|
|
3281
|
+
* });
|
|
3282
|
+
* ```
|
|
3283
|
+
*
|
|
3284
|
+
* **Visitor mode: not supported**
|
|
3285
|
+
*/
|
|
3286
|
+
async getGamePickUserInfo(props) {
|
|
3287
|
+
if (!props.saw_template_id) {
|
|
3288
|
+
throw new Error('saw_template_id is required');
|
|
3289
|
+
}
|
|
3290
|
+
return this.api.gpGetUserInfo(props.saw_template_id);
|
|
3291
|
+
}
|
|
3292
|
+
/**
|
|
3293
|
+
* Returns the game configuration and the list of all rounds for the specified MatchX or Quiz game.
|
|
3294
|
+
* Includes the SAW template definition, label settings, and round metadata (without events).
|
|
3295
|
+
*
|
|
3296
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3297
|
+
*
|
|
3298
|
+
* **Response** `GamesApiResponse<GamePickGameInfo>`:
|
|
3299
|
+
* - `errCode` - 0 on success
|
|
3300
|
+
* - `data`:
|
|
3301
|
+
* - `sawTemplate` - Game template configuration including:
|
|
3302
|
+
* - `saw_template_id`, `saw_game_type_id` (6 = MatchX/Quiz)
|
|
3303
|
+
* - `saw_template_ui_definition` - UI settings (name, ranking options, ask_for_username, etc.)
|
|
3304
|
+
* - `saw_buyin_type_id` - Cost type (1=Free, 2=Points, 3=Gems, 4=Diamonds, 5=Spins)
|
|
3305
|
+
* - `buyin_cost_points` - Cost per attempt
|
|
3306
|
+
* - `spin_count` - Available attempts for the current user
|
|
3307
|
+
* - `allRounds[]` - List of all rounds (metadata only, no events), each with:
|
|
3308
|
+
* - `round_id`, `round_name`, `round_description`
|
|
3309
|
+
* - `open_date`, `last_bet_date` - Timestamps (ms)
|
|
3310
|
+
* - `is_active_now`, `is_resolved`, `round_status_id`
|
|
3311
|
+
* - `labelInfo` - Label/brand configuration and settings
|
|
3312
|
+
*
|
|
3313
|
+
* **Example**:
|
|
3314
|
+
* ```
|
|
3315
|
+
* _smartico.api.getGamePickGameInfo({
|
|
3316
|
+
* saw_template_id: 1189,
|
|
3317
|
+
* }).then((result) => {
|
|
3318
|
+
* console.log(result.data.sawTemplate.saw_template_ui_definition.name);
|
|
3319
|
+
* console.log('Rounds:', result.data.allRounds.length);
|
|
3320
|
+
* console.log('Buy-in type:', result.data.sawTemplate.saw_buyin_type_id);
|
|
3321
|
+
* });
|
|
3322
|
+
* ```
|
|
3323
|
+
*
|
|
3324
|
+
* **Visitor mode: not supported**
|
|
3325
|
+
*/
|
|
3326
|
+
async getGamePickGameInfo(props) {
|
|
3327
|
+
if (!props.saw_template_id) {
|
|
3328
|
+
throw new Error('saw_template_id is required');
|
|
3329
|
+
}
|
|
3330
|
+
return this.api.gpGetGameInfo(props.saw_template_id);
|
|
3331
|
+
}
|
|
3332
|
+
/**
|
|
3333
|
+
* Returns translations for the MatchX/Quiz game UI.
|
|
3334
|
+
* Translations are returned as a key-value map for the Gamification and RetentionGames areas,
|
|
3335
|
+
* resolved to the current user's language.
|
|
3336
|
+
*
|
|
3337
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3338
|
+
*
|
|
3339
|
+
* **Response** `GamesApiResponse<any>`:
|
|
3340
|
+
* - `errCode` - 0 on success
|
|
3341
|
+
* - `data`:
|
|
3342
|
+
* - `translations` - Key-value map of translation strings (e.g. `rgSubmitSelection`, `rgLeaderboardTitle`, `quizConfirmAnswer`, etc.)
|
|
3343
|
+
* - `hash_code` - Hash for cache invalidation
|
|
3344
|
+
* - `lang_code` - Resolved language code (e.g. 'EN')
|
|
3345
|
+
*
|
|
3346
|
+
* **Example**:
|
|
3347
|
+
* ```
|
|
3348
|
+
* _smartico.api.getGamePickTranslations({
|
|
3349
|
+
* saw_template_id: 1083,
|
|
3350
|
+
* }).then((result) => {
|
|
3351
|
+
* const tr = result.data.translations;
|
|
3352
|
+
* console.log(tr.rgSubmitSelection); // "Submit selection"
|
|
3353
|
+
* console.log(tr.rgLeaderboardTitle); // "Leaderboard"
|
|
3354
|
+
* });
|
|
3355
|
+
* ```
|
|
3356
|
+
*
|
|
3357
|
+
* **Visitor mode: not supported**
|
|
3358
|
+
*/
|
|
3359
|
+
async getGamePickTranslations(props) {
|
|
3360
|
+
if (!props.saw_template_id) {
|
|
3361
|
+
throw new Error('saw_template_id is required');
|
|
3362
|
+
}
|
|
3363
|
+
return this.api.gpGetTranslations(props.saw_template_id);
|
|
3364
|
+
}
|
|
3365
|
+
/**
|
|
3366
|
+
* Returns round data with events and picks for a specific user (identified by their internal user ID).
|
|
3367
|
+
* Useful for viewing another user's predictions from the leaderboard.
|
|
3368
|
+
* The `int_user_id` can be obtained from the `getGamePickBoard` response (`users[].int_user_id`).
|
|
3369
|
+
*
|
|
3370
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
3371
|
+
* @param props.round_id - The round to get info for
|
|
3372
|
+
* @param props.int_user_id - Internal user ID of the player whose predictions to view (from leaderboard data)
|
|
3373
|
+
*
|
|
3374
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
3375
|
+
* - `errCode` - 0 on success
|
|
3376
|
+
* - `data` - Round object with the target user's selections.
|
|
3377
|
+
* Same structure as `getGamePickActiveRound`, but `user_selection`/`team1_user_selection`/`team2_user_selection`
|
|
3378
|
+
* fields on events reflect the specified user's picks instead of the current user's.
|
|
3379
|
+
* Events also include `resolution_type_id` (0=None, 2=Lost, 3=PartialWin, 4=FullWin) showing how each prediction was scored
|
|
3380
|
+
*
|
|
3381
|
+
* **Example**:
|
|
3382
|
+
* ```
|
|
3383
|
+
* _smartico.api.getGamePickRoundInfoForUser({
|
|
3384
|
+
* saw_template_id: 1083,
|
|
3385
|
+
* round_id: 31652,
|
|
3386
|
+
* int_user_id: 65653810,
|
|
3387
|
+
* }).then((result) => {
|
|
3388
|
+
* result.data.events.forEach(e => {
|
|
3389
|
+
* console.log(e.event_meta.team1_name, 'vs', e.event_meta.team2_name, '→', e.user_selection);
|
|
3390
|
+
* });
|
|
3391
|
+
* });
|
|
3392
|
+
* ```
|
|
3393
|
+
*
|
|
3394
|
+
* **Visitor mode: not supported**
|
|
3395
|
+
*/
|
|
3396
|
+
async getGamePickRoundInfoForUser(props) {
|
|
3397
|
+
if (!props.saw_template_id) {
|
|
3398
|
+
throw new Error('saw_template_id is required');
|
|
3399
|
+
}
|
|
3400
|
+
if (!props.round_id) {
|
|
3401
|
+
throw new Error('round_id is required');
|
|
3402
|
+
}
|
|
3403
|
+
if (!props.int_user_id) {
|
|
3404
|
+
throw new Error('int_user_id is required');
|
|
3405
|
+
}
|
|
3406
|
+
return this.api.gpGetRoundInfoForUser(props.saw_template_id, props.round_id, props.int_user_id);
|
|
3003
3407
|
}
|
|
3004
3408
|
async updateOnSpin(data) {
|
|
3005
|
-
const templates = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(
|
|
3409
|
+
const templates = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(this.userExtId), CACHE_DATA_SEC);
|
|
3006
3410
|
const index = templates.findIndex(t => t.id === data.saw_template_id);
|
|
3007
3411
|
templates[index].spin_count = data.spin_count;
|
|
3008
3412
|
this.updateEntity(onUpdateContextKey.Saw, templates);
|
|
3009
3413
|
}
|
|
3010
3414
|
async reloadMiniGameTemplate() {
|
|
3011
|
-
const updatedTemplates = await this.api.sawGetTemplatesT(
|
|
3415
|
+
const updatedTemplates = await this.api.sawGetTemplatesT(this.userExtId);
|
|
3012
3416
|
this.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
3013
3417
|
}
|
|
3014
3418
|
async updateMissions() {
|
|
3015
|
-
const payload = await this.api.missionsGetItemsT(
|
|
3419
|
+
const payload = await this.api.missionsGetItemsT(this.userExtId);
|
|
3016
3420
|
this.updateEntity(onUpdateContextKey.Missions, payload);
|
|
3017
3421
|
}
|
|
3018
3422
|
async updateBonuses() {
|
|
3019
|
-
const payload = await this.api.bonusesGetItemsT(
|
|
3423
|
+
const payload = await this.api.bonusesGetItemsT(this.userExtId);
|
|
3020
3424
|
this.updateEntity(onUpdateContextKey.Bonuses, payload);
|
|
3021
3425
|
}
|
|
3022
3426
|
async updateTournaments() {
|
|
3023
|
-
const payload = await this.api.tournamentsGetLobbyT(
|
|
3427
|
+
const payload = await this.api.tournamentsGetLobbyT(this.userExtId);
|
|
3024
3428
|
this.updateEntity(onUpdateContextKey.TournamentList, payload);
|
|
3025
3429
|
}
|
|
3026
3430
|
async updateStorePurchasedItems() {
|
|
3027
|
-
const payload = await this.api.storeGetPurchasedItemsT(
|
|
3431
|
+
const payload = await this.api.storeGetPurchasedItemsT(this.userExtId, 20, 0);
|
|
3028
3432
|
this.updateEntity(onUpdateContextKey.StoreHistory, payload);
|
|
3029
3433
|
}
|
|
3030
3434
|
async updateStoreItems() {
|
|
3031
|
-
const payload = await this.api.storeGetItemsT(
|
|
3435
|
+
const payload = await this.api.storeGetItemsT(this.userExtId);
|
|
3032
3436
|
this.updateEntity(onUpdateContextKey.StoreItems, payload);
|
|
3033
3437
|
}
|
|
3034
3438
|
async updateInboxUnreadCount(count) {
|
|
3035
3439
|
this.updateEntity(onUpdateContextKey.InboxUnreadCount, count);
|
|
3036
3440
|
}
|
|
3037
3441
|
async updateInboxMessages() {
|
|
3038
|
-
const payload = await this.api.getInboxMessagesT(
|
|
3442
|
+
const payload = await this.api.getInboxMessagesT(this.userExtId);
|
|
3039
3443
|
this.updateEntity(onUpdateContextKey.InboxMessages, payload);
|
|
3040
3444
|
}
|
|
3041
3445
|
async updateRaffles() {
|
|
3042
|
-
const payload = await this.api.getRafflesT(
|
|
3446
|
+
const payload = await this.api.getRafflesT(this.userExtId);
|
|
3043
3447
|
this.updateEntity(onUpdateContextKey.Raffles, payload);
|
|
3044
3448
|
}
|
|
3045
3449
|
async notifyActivityLogUpdate() {
|
|
3046
3450
|
const startSeconds = Date.now() / 1000 - 600;
|
|
3047
3451
|
const endSeconds = Date.now() / 1000;
|
|
3048
|
-
const payload = await this.api.getActivityLogT(
|
|
3452
|
+
const payload = await this.api.getActivityLogT(this.userExtId, startSeconds, endSeconds, 0, 50);
|
|
3049
3453
|
this.updateEntity(onUpdateContextKey.ActivityLog, payload);
|
|
3050
3454
|
}
|
|
3051
3455
|
async updateEntity(contextKey, payload) {
|
|
@@ -3089,7 +3493,7 @@ class WSAPI {
|
|
|
3089
3493
|
let jackpots = [];
|
|
3090
3494
|
let pots = [];
|
|
3091
3495
|
jackpots = await OCache.use(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async function () {
|
|
3092
|
-
const _jackpots = await _this.api.jackpotGet(
|
|
3496
|
+
const _jackpots = await _this.api.jackpotGet(_this.userExtId, filter);
|
|
3093
3497
|
const _pots = _jackpots.items.map(jp => jp.pot);
|
|
3094
3498
|
_jackpots.items.forEach(jp => {
|
|
3095
3499
|
jp.jp_public_meta.custom_data = IntUtils.JsonOrText(jp.jp_public_meta.custom_data);
|
|
@@ -3100,7 +3504,7 @@ class WSAPI {
|
|
|
3100
3504
|
if (jackpots.length > 0) {
|
|
3101
3505
|
pots = await OCache.use(onUpdateContextKey.Pots, ECacheContext.WSAPI, async function () {
|
|
3102
3506
|
const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
|
|
3103
|
-
return (await _this.api.potGet(
|
|
3507
|
+
return (await _this.api.potGet(_this.userExtId, {
|
|
3104
3508
|
jp_template_ids
|
|
3105
3509
|
})).items;
|
|
3106
3510
|
}, JACKPOT_POT_CACHE_SEC);
|
|
@@ -3130,7 +3534,7 @@ class WSAPI {
|
|
|
3130
3534
|
if (!filter.jp_template_id) {
|
|
3131
3535
|
throw new Error('jp_template_id is required in jackpotOptIn');
|
|
3132
3536
|
}
|
|
3133
|
-
const result = await this.api.jackpotOptIn(
|
|
3537
|
+
const result = await this.api.jackpotOptIn(this.userExtId, filter);
|
|
3134
3538
|
return result;
|
|
3135
3539
|
}
|
|
3136
3540
|
/**
|
|
@@ -3151,7 +3555,7 @@ class WSAPI {
|
|
|
3151
3555
|
if (!filter.jp_template_id) {
|
|
3152
3556
|
throw new Error('jp_template_id is required in jackpotOptOut');
|
|
3153
3557
|
}
|
|
3154
|
-
const result = await this.api.jackpotOptOut(
|
|
3558
|
+
const result = await this.api.jackpotOptOut(this.userExtId, filter);
|
|
3155
3559
|
return result;
|
|
3156
3560
|
}
|
|
3157
3561
|
/**
|
|
@@ -3174,7 +3578,7 @@ class WSAPI {
|
|
|
3174
3578
|
offset,
|
|
3175
3579
|
jp_template_id
|
|
3176
3580
|
}) {
|
|
3177
|
-
return OCache.use(onUpdateContextKey.JackpotWinners + jp_template_id, ECacheContext.WSAPI, () => this.api.getJackpotWinnersT(
|
|
3581
|
+
return OCache.use(onUpdateContextKey.JackpotWinners + jp_template_id, ECacheContext.WSAPI, () => this.api.getJackpotWinnersT(this.userExtId, limit, offset, jp_template_id), JACKPOT_WINNERS_CACHE_SEC);
|
|
3178
3582
|
}
|
|
3179
3583
|
/**
|
|
3180
3584
|
* Returns the eligible games for the jackpot with the specified jp_template_id.
|
|
@@ -3196,7 +3600,7 @@ class WSAPI {
|
|
|
3196
3600
|
if (onUpdate) {
|
|
3197
3601
|
this.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
|
|
3198
3602
|
}
|
|
3199
|
-
return OCache.use(onUpdateContextKey.JackpotEligibleGames + jp_template_id, ECacheContext.WSAPI, () => this.api.getJackpotEligibleGamesT(
|
|
3603
|
+
return OCache.use(onUpdateContextKey.JackpotEligibleGames + jp_template_id, ECacheContext.WSAPI, () => this.api.getJackpotEligibleGamesT(this.userExtId, {
|
|
3200
3604
|
jp_template_id
|
|
3201
3605
|
}), JACKPOT_ELIGIBLE_GAMES_CACHE_SEC);
|
|
3202
3606
|
}
|
|
@@ -3219,7 +3623,7 @@ class WSAPI {
|
|
|
3219
3623
|
* ```
|
|
3220
3624
|
*/
|
|
3221
3625
|
async getRelatedItemsForGame(related_game_id) {
|
|
3222
|
-
const result = await this.api.getRelatedItemsForGame(
|
|
3626
|
+
const result = await this.api.getRelatedItemsForGame(this.userExtId, related_game_id);
|
|
3223
3627
|
return result;
|
|
3224
3628
|
}
|
|
3225
3629
|
/**
|
|
@@ -3250,7 +3654,7 @@ class WSAPI {
|
|
|
3250
3654
|
if (onUpdate) {
|
|
3251
3655
|
this.onUpdateCallback.set(onUpdateContextKey.Raffles, onUpdate);
|
|
3252
3656
|
}
|
|
3253
|
-
return OCache.use(onUpdateContextKey.Raffles, ECacheContext.WSAPI, () => this.api.getRafflesT(
|
|
3657
|
+
return OCache.use(onUpdateContextKey.Raffles, ECacheContext.WSAPI, () => this.api.getRafflesT(this.userExtId), CACHE_DATA_SEC);
|
|
3254
3658
|
}
|
|
3255
3659
|
/**
|
|
3256
3660
|
* Returns draw run for provided raffle_id and run_id.
|
|
@@ -3279,7 +3683,7 @@ class WSAPI {
|
|
|
3279
3683
|
if (!props.raffle_id || !props.run_id) {
|
|
3280
3684
|
throw new Error('both raffle_id and run_id are required');
|
|
3281
3685
|
}
|
|
3282
|
-
return await this.api.getRaffleDrawRunT(
|
|
3686
|
+
return await this.api.getRaffleDrawRunT(this.userExtId, props.raffle_id, props.run_id, props.winners_from, props.winners_to);
|
|
3283
3687
|
}
|
|
3284
3688
|
/**
|
|
3285
3689
|
* Returns history of draw runs for the provided raffle_id and draw_id, if the draw_id is not provided will return history of all the draws for the provided raffle_id
|
|
@@ -3303,7 +3707,7 @@ class WSAPI {
|
|
|
3303
3707
|
*
|
|
3304
3708
|
*/
|
|
3305
3709
|
async getRaffleDrawRunsHistory(props) {
|
|
3306
|
-
const res = await this.api.getRaffleDrawRunsHistory(
|
|
3710
|
+
const res = await this.api.getRaffleDrawRunsHistory(this.userExtId, props);
|
|
3307
3711
|
if (!props.raffle_id) {
|
|
3308
3712
|
throw new Error('raffle_id is required');
|
|
3309
3713
|
}
|
|
@@ -3334,7 +3738,7 @@ class WSAPI {
|
|
|
3334
3738
|
if (!props.won_id) {
|
|
3335
3739
|
throw new Error('won_id is required');
|
|
3336
3740
|
}
|
|
3337
|
-
const res = await this.api.claimRafflePrize(
|
|
3741
|
+
const res = await this.api.claimRafflePrize(this.userExtId, {
|
|
3338
3742
|
won_id: props.won_id
|
|
3339
3743
|
});
|
|
3340
3744
|
return raffleClaimPrizeResponseTransform(res);
|
|
@@ -3354,7 +3758,7 @@ class WSAPI {
|
|
|
3354
3758
|
if (!props.raffle_run_id) {
|
|
3355
3759
|
throw new Error('raffle_run_id is required');
|
|
3356
3760
|
}
|
|
3357
|
-
const r = await this.api.raffleOptin(
|
|
3761
|
+
const r = await this.api.raffleOptin(this.userExtId, props);
|
|
3358
3762
|
return {
|
|
3359
3763
|
err_code: r.errCode,
|
|
3360
3764
|
err_message: r.errMsg
|
|
@@ -3571,6 +3975,7 @@ const GetJackpotEligibleGamesResponseTransform = ({
|
|
|
3571
3975
|
|
|
3572
3976
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
3573
3977
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
3978
|
+
const GAMES_API_URL = 'https://r-games-api.smr.vc';
|
|
3574
3979
|
const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
|
|
3575
3980
|
const DEFAULT_LANG_EN = 'EN';
|
|
3576
3981
|
class SmarticoAPI {
|
|
@@ -3583,7 +3988,10 @@ class SmarticoAPI {
|
|
|
3583
3988
|
this.wsUrl = void 0;
|
|
3584
3989
|
this.inboxCdnUrl = void 0;
|
|
3585
3990
|
this.partnerUrl = void 0;
|
|
3991
|
+
this.gamesApiUrl = void 0;
|
|
3992
|
+
this.baseRgApiParams = void 0;
|
|
3586
3993
|
this.avatarDomain = void 0;
|
|
3994
|
+
this.envId = void 0;
|
|
3587
3995
|
this.logger = void 0;
|
|
3588
3996
|
this.logCIDs = void 0;
|
|
3589
3997
|
this.logHTTPTiming = void 0;
|
|
@@ -3600,6 +4008,12 @@ class SmarticoAPI {
|
|
|
3600
4008
|
this.tracker = options.tracker;
|
|
3601
4009
|
this.publicUrl = SmarticoAPI.getPublicUrl(label_api_key);
|
|
3602
4010
|
this.wsUrl = SmarticoAPI.getPublicWsUrl(label_api_key);
|
|
4011
|
+
this.baseRgApiParams = {
|
|
4012
|
+
env_id: String(SmarticoAPI.getEnvId(label_api_key)),
|
|
4013
|
+
label_api_key: label_api_key,
|
|
4014
|
+
brand_key: options.brand_api_key || this.tracker.params.brand_key,
|
|
4015
|
+
hash: IntUtils.uuid()
|
|
4016
|
+
};
|
|
3603
4017
|
this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || ((_options$tracker = options.tracker) == null ? void 0 : _options$tracker.label_api_key));
|
|
3604
4018
|
this.label_api_key = SmarticoAPI.getCleanLabelApiKey(label_api_key);
|
|
3605
4019
|
}
|
|
@@ -3654,7 +4068,6 @@ class SmarticoAPI {
|
|
|
3654
4068
|
return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3655
4069
|
}
|
|
3656
4070
|
static getAvatarUrl(label_api_key) {
|
|
3657
|
-
SmarticoAPI.getEnvDnsSuffix(label_api_key);
|
|
3658
4071
|
const avatarUrl = AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3659
4072
|
return SmarticoAPI.replaceSmrDomainsWithCloudfront(avatarUrl);
|
|
3660
4073
|
}
|
|
@@ -4287,6 +4700,142 @@ class SmarticoAPI {
|
|
|
4287
4700
|
});
|
|
4288
4701
|
return await this.send(message, ClassId.MARK_INBOX_DELETED_RESPONSE);
|
|
4289
4702
|
}
|
|
4703
|
+
buildGamesApiParams() {
|
|
4704
|
+
var _this$tracker$userPub, _this$tracker$userPub2;
|
|
4705
|
+
const params = Object.assign({}, this.baseRgApiParams, {
|
|
4706
|
+
ext_user_id: (_this$tracker$userPub = this.tracker.userPublicProps) == null ? void 0 : _this$tracker$userPub.user_id,
|
|
4707
|
+
smartico_ext_user_id: this.tracker.getExtUserId(),
|
|
4708
|
+
lang: (_this$tracker$userPub2 = this.tracker.userPublicProps) == null ? void 0 : _this$tracker$userPub2.core_user_language
|
|
4709
|
+
});
|
|
4710
|
+
return params;
|
|
4711
|
+
}
|
|
4712
|
+
async sendGamesApi({
|
|
4713
|
+
method,
|
|
4714
|
+
params,
|
|
4715
|
+
usePost = false
|
|
4716
|
+
}) {
|
|
4717
|
+
const baseParams = this.buildGamesApiParams();
|
|
4718
|
+
const queryString = Object.entries(baseParams).map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join('&');
|
|
4719
|
+
let url = `${GAMES_API_URL}/${method}?${queryString}`;
|
|
4720
|
+
let fetchOptions = {
|
|
4721
|
+
method: 'GET',
|
|
4722
|
+
headers: {
|
|
4723
|
+
'Accept': 'application/json'
|
|
4724
|
+
}
|
|
4725
|
+
};
|
|
4726
|
+
if (usePost && params) {
|
|
4727
|
+
fetchOptions = {
|
|
4728
|
+
method: 'POST',
|
|
4729
|
+
headers: {
|
|
4730
|
+
'Accept': 'application/json',
|
|
4731
|
+
'Content-Type': 'application/json'
|
|
4732
|
+
},
|
|
4733
|
+
body: JSON.stringify(params)
|
|
4734
|
+
};
|
|
4735
|
+
} else if (params) {
|
|
4736
|
+
const extraQuery = Object.entries(params).map(([k, v]) => `${k}=${encodeURIComponent(JSON.stringify(v))}`).join('&');
|
|
4737
|
+
url += `&${extraQuery}`;
|
|
4738
|
+
}
|
|
4739
|
+
try {
|
|
4740
|
+
const response = await fetch(url, fetchOptions);
|
|
4741
|
+
const data = await response.json();
|
|
4742
|
+
return SmarticoAPI.replaceSmrDomainsWithCloudfront(data);
|
|
4743
|
+
} catch (e) {
|
|
4744
|
+
this.logger.error(`Failed to call games API: ${method}`, {
|
|
4745
|
+
url,
|
|
4746
|
+
error: e.message
|
|
4747
|
+
});
|
|
4748
|
+
throw new Error(`Failed to call games API: ${method}. ${e.message}`);
|
|
4749
|
+
}
|
|
4750
|
+
}
|
|
4751
|
+
async gpGetActiveRounds(saw_template_id) {
|
|
4752
|
+
const params = {
|
|
4753
|
+
ext_game_id: saw_template_id
|
|
4754
|
+
};
|
|
4755
|
+
return this.sendGamesApi({
|
|
4756
|
+
method: 'active-rounds',
|
|
4757
|
+
params
|
|
4758
|
+
});
|
|
4759
|
+
}
|
|
4760
|
+
async gpGetActiveRound(saw_template_id, round_id) {
|
|
4761
|
+
const params = {
|
|
4762
|
+
ext_game_id: saw_template_id,
|
|
4763
|
+
round_id: round_id
|
|
4764
|
+
};
|
|
4765
|
+
return this.sendGamesApi({
|
|
4766
|
+
method: 'active-round',
|
|
4767
|
+
params
|
|
4768
|
+
});
|
|
4769
|
+
}
|
|
4770
|
+
async gpGetGamesHistory(saw_template_id) {
|
|
4771
|
+
const params = {
|
|
4772
|
+
ext_game_id: saw_template_id
|
|
4773
|
+
};
|
|
4774
|
+
return this.sendGamesApi({
|
|
4775
|
+
method: 'games-history',
|
|
4776
|
+
params
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4779
|
+
async gpGetGameBoard(saw_template_id, round_id) {
|
|
4780
|
+
const params = {
|
|
4781
|
+
ext_game_id: saw_template_id,
|
|
4782
|
+
round_id: round_id
|
|
4783
|
+
};
|
|
4784
|
+
return this.sendGamesApi({
|
|
4785
|
+
method: 'game-board',
|
|
4786
|
+
params
|
|
4787
|
+
});
|
|
4788
|
+
}
|
|
4789
|
+
async gpSubmitSelection(saw_template_id, round, isQuiz) {
|
|
4790
|
+
const method = isQuiz ? 'submit-selection-quiz' : 'submit-selection';
|
|
4791
|
+
const params = {
|
|
4792
|
+
ext_game_id: saw_template_id,
|
|
4793
|
+
round: round
|
|
4794
|
+
};
|
|
4795
|
+
return this.sendGamesApi({
|
|
4796
|
+
method,
|
|
4797
|
+
params,
|
|
4798
|
+
usePost: true
|
|
4799
|
+
});
|
|
4800
|
+
}
|
|
4801
|
+
async gpGetUserInfo(saw_template_id) {
|
|
4802
|
+
const params = {
|
|
4803
|
+
ext_game_id: saw_template_id
|
|
4804
|
+
};
|
|
4805
|
+
return this.sendGamesApi({
|
|
4806
|
+
method: 'user-info',
|
|
4807
|
+
params
|
|
4808
|
+
});
|
|
4809
|
+
}
|
|
4810
|
+
async gpGetGameInfo(saw_template_id) {
|
|
4811
|
+
const params = {
|
|
4812
|
+
ext_game_id: saw_template_id
|
|
4813
|
+
};
|
|
4814
|
+
return this.sendGamesApi({
|
|
4815
|
+
method: 'game-info',
|
|
4816
|
+
params
|
|
4817
|
+
});
|
|
4818
|
+
}
|
|
4819
|
+
async gpGetTranslations(saw_template_id) {
|
|
4820
|
+
const params = {
|
|
4821
|
+
ext_game_id: saw_template_id
|
|
4822
|
+
};
|
|
4823
|
+
return this.sendGamesApi({
|
|
4824
|
+
method: 'translations',
|
|
4825
|
+
params
|
|
4826
|
+
});
|
|
4827
|
+
}
|
|
4828
|
+
async gpGetRoundInfoForUser(saw_template_id, round_id, int_user_id) {
|
|
4829
|
+
const params = {
|
|
4830
|
+
ext_game_id: saw_template_id,
|
|
4831
|
+
round_id: round_id,
|
|
4832
|
+
int_user_id: int_user_id
|
|
4833
|
+
};
|
|
4834
|
+
return this.sendGamesApi({
|
|
4835
|
+
method: 'game-round-info-for-user',
|
|
4836
|
+
params
|
|
4837
|
+
});
|
|
4838
|
+
}
|
|
4290
4839
|
getWSCalls() {
|
|
4291
4840
|
return new WSAPI(this);
|
|
4292
4841
|
}
|
|
@@ -4809,5 +5358,104 @@ var JackpotType;
|
|
|
4809
5358
|
JackpotType[JackpotType["Personal"] = 2] = "Personal";
|
|
4810
5359
|
})(JackpotType || (JackpotType = {}));
|
|
4811
5360
|
|
|
4812
|
-
|
|
5361
|
+
var GamePickMarketType;
|
|
5362
|
+
(function (GamePickMarketType) {
|
|
5363
|
+
GamePickMarketType[GamePickMarketType["Goals"] = 1] = "Goals";
|
|
5364
|
+
GamePickMarketType[GamePickMarketType["Winner"] = 2] = "Winner";
|
|
5365
|
+
})(GamePickMarketType || (GamePickMarketType = {}));
|
|
5366
|
+
var GamePickResolutionType;
|
|
5367
|
+
(function (GamePickResolutionType) {
|
|
5368
|
+
GamePickResolutionType[GamePickResolutionType["None"] = 0] = "None";
|
|
5369
|
+
GamePickResolutionType[GamePickResolutionType["Lost"] = 2] = "Lost";
|
|
5370
|
+
GamePickResolutionType[GamePickResolutionType["PartialWin"] = 3] = "PartialWin";
|
|
5371
|
+
GamePickResolutionType[GamePickResolutionType["FullWin"] = 4] = "FullWin";
|
|
5372
|
+
})(GamePickResolutionType || (GamePickResolutionType = {}));
|
|
5373
|
+
var GPRoundStatus;
|
|
5374
|
+
(function (GPRoundStatus) {
|
|
5375
|
+
GPRoundStatus[GPRoundStatus["Other"] = -1] = "Other";
|
|
5376
|
+
GPRoundStatus[GPRoundStatus["NoEventsDefined"] = 1] = "NoEventsDefined";
|
|
5377
|
+
GPRoundStatus[GPRoundStatus["NoMoreBetsAllowed"] = 2] = "NoMoreBetsAllowed";
|
|
5378
|
+
GPRoundStatus[GPRoundStatus["AllEventsResolved_ButNotRound"] = 3] = "AllEventsResolved_ButNotRound";
|
|
5379
|
+
GPRoundStatus[GPRoundStatus["RoundResolved"] = 4] = "RoundResolved";
|
|
5380
|
+
})(GPRoundStatus || (GPRoundStatus = {}));
|
|
5381
|
+
var GamePickScoreType;
|
|
5382
|
+
(function (GamePickScoreType) {
|
|
5383
|
+
GamePickScoreType[GamePickScoreType["ExactScore"] = 1] = "ExactScore";
|
|
5384
|
+
GamePickScoreType[GamePickScoreType["PointsDifference"] = 2] = "PointsDifference";
|
|
5385
|
+
})(GamePickScoreType || (GamePickScoreType = {}));
|
|
5386
|
+
var GamePickSportType;
|
|
5387
|
+
(function (GamePickSportType) {
|
|
5388
|
+
GamePickSportType[GamePickSportType["Golf"] = 9] = "Golf";
|
|
5389
|
+
GamePickSportType[GamePickSportType["Cycling"] = 17] = "Cycling";
|
|
5390
|
+
GamePickSportType[GamePickSportType["Specials"] = 18] = "Specials";
|
|
5391
|
+
GamePickSportType[GamePickSportType["TouringCarRacing"] = 188] = "TouringCarRacing";
|
|
5392
|
+
GamePickSportType[GamePickSportType["StockCarRacing"] = 191] = "StockCarRacing";
|
|
5393
|
+
GamePickSportType[GamePickSportType["IndyRacing"] = 129] = "IndyRacing";
|
|
5394
|
+
GamePickSportType[GamePickSportType["Biathlon"] = 44] = "Biathlon";
|
|
5395
|
+
GamePickSportType[GamePickSportType["Speedway"] = 131] = "Speedway";
|
|
5396
|
+
GamePickSportType[GamePickSportType["Motorsport"] = 11] = "Motorsport";
|
|
5397
|
+
GamePickSportType[GamePickSportType["AlpineSkiing"] = 43] = "AlpineSkiing";
|
|
5398
|
+
GamePickSportType[GamePickSportType["SkiJumping"] = 48] = "SkiJumping";
|
|
5399
|
+
GamePickSportType[GamePickSportType["Lacrosse"] = 39] = "Lacrosse";
|
|
5400
|
+
GamePickSportType[GamePickSportType["CrossCountry"] = 46] = "CrossCountry";
|
|
5401
|
+
GamePickSportType[GamePickSportType["NordicCombined"] = 47] = "NordicCombined";
|
|
5402
|
+
GamePickSportType[GamePickSportType["Chess"] = 33] = "Chess";
|
|
5403
|
+
GamePickSportType[GamePickSportType["Athletics"] = 36] = "Athletics";
|
|
5404
|
+
GamePickSportType[GamePickSportType["ESportOverwatch"] = 121] = "ESportOverwatch";
|
|
5405
|
+
GamePickSportType[GamePickSportType["MMA"] = 117] = "MMA";
|
|
5406
|
+
GamePickSportType[GamePickSportType["Futsal"] = 29] = "Futsal";
|
|
5407
|
+
GamePickSportType[GamePickSportType["IceHockey"] = 4] = "IceHockey";
|
|
5408
|
+
GamePickSportType[GamePickSportType["Kabaddi"] = 138] = "Kabaddi";
|
|
5409
|
+
GamePickSportType[GamePickSportType["BeachVolley"] = 34] = "BeachVolley";
|
|
5410
|
+
GamePickSportType[GamePickSportType["Formula1"] = 40] = "Formula1";
|
|
5411
|
+
GamePickSportType[GamePickSportType["ESporteBasketball"] = 153] = "ESporteBasketball";
|
|
5412
|
+
GamePickSportType[GamePickSportType["MotorcycleRacing"] = 190] = "MotorcycleRacing";
|
|
5413
|
+
GamePickSportType[GamePickSportType["Bowls"] = 32] = "Bowls";
|
|
5414
|
+
GamePickSportType[GamePickSportType["Boxing"] = 10] = "Boxing";
|
|
5415
|
+
GamePickSportType[GamePickSportType["Floorball"] = 7] = "Floorball";
|
|
5416
|
+
GamePickSportType[GamePickSportType["GaelicHurling"] = 136] = "GaelicHurling";
|
|
5417
|
+
GamePickSportType[GamePickSportType["Bandy"] = 15] = "Bandy";
|
|
5418
|
+
GamePickSportType[GamePickSportType["Handball"] = 6] = "Handball";
|
|
5419
|
+
GamePickSportType[GamePickSportType["Waterpolo"] = 26] = "Waterpolo";
|
|
5420
|
+
GamePickSportType[GamePickSportType["Rugby"] = 12] = "Rugby";
|
|
5421
|
+
GamePickSportType[GamePickSportType["ESporteSoccer"] = 137] = "ESporteSoccer";
|
|
5422
|
+
GamePickSportType[GamePickSportType["FieldHockey"] = 24] = "FieldHockey";
|
|
5423
|
+
GamePickSportType[GamePickSportType["Pesapallo"] = 61] = "Pesapallo";
|
|
5424
|
+
GamePickSportType[GamePickSportType["Snooker"] = 19] = "Snooker";
|
|
5425
|
+
GamePickSportType[GamePickSportType["Badminton"] = 31] = "Badminton";
|
|
5426
|
+
GamePickSportType[GamePickSportType["Cricket"] = 21] = "Cricket";
|
|
5427
|
+
GamePickSportType[GamePickSportType["BeachSoccer"] = 60] = "BeachSoccer";
|
|
5428
|
+
GamePickSportType[GamePickSportType["Baseball"] = 3] = "Baseball";
|
|
5429
|
+
GamePickSportType[GamePickSportType["StarCraft"] = 112] = "StarCraft";
|
|
5430
|
+
GamePickSportType[GamePickSportType["ESportCounterStrike"] = 109] = "ESportCounterStrike";
|
|
5431
|
+
GamePickSportType[GamePickSportType["ESportArenaofValor"] = 158] = "ESportArenaofValor";
|
|
5432
|
+
GamePickSportType[GamePickSportType["Curling"] = 28] = "Curling";
|
|
5433
|
+
GamePickSportType[GamePickSportType["Squash"] = 37] = "Squash";
|
|
5434
|
+
GamePickSportType[GamePickSportType["Darts"] = 22] = "Darts";
|
|
5435
|
+
GamePickSportType[GamePickSportType["TableTennis"] = 20] = "TableTennis";
|
|
5436
|
+
GamePickSportType[GamePickSportType["Basketball3x3"] = 155] = "Basketball3x3";
|
|
5437
|
+
GamePickSportType[GamePickSportType["AussieRules"] = 13] = "AussieRules";
|
|
5438
|
+
GamePickSportType[GamePickSportType["GaelicFootball"] = 135] = "GaelicFootball";
|
|
5439
|
+
GamePickSportType[GamePickSportType["CallOfDuty"] = 118] = "CallOfDuty";
|
|
5440
|
+
GamePickSportType[GamePickSportType["Soccer"] = 1] = "Soccer";
|
|
5441
|
+
GamePickSportType[GamePickSportType["Tennis"] = 5] = "Tennis";
|
|
5442
|
+
GamePickSportType[GamePickSportType["ESportDota"] = 111] = "ESportDota";
|
|
5443
|
+
GamePickSportType[GamePickSportType["Basketball"] = 2] = "Basketball";
|
|
5444
|
+
GamePickSportType[GamePickSportType["ESportLeagueofLegends"] = 110] = "ESportLeagueofLegends";
|
|
5445
|
+
GamePickSportType[GamePickSportType["AmericanFootball"] = 16] = "AmericanFootball";
|
|
5446
|
+
GamePickSportType[GamePickSportType["Volleyball"] = 23] = "Volleyball";
|
|
5447
|
+
GamePickSportType[GamePickSportType["Netball"] = 35] = "Netball";
|
|
5448
|
+
GamePickSportType[GamePickSportType["ESportRocketLeague"] = 128] = "ESportRocketLeague";
|
|
5449
|
+
GamePickSportType[GamePickSportType["Schwingen"] = 56] = "Schwingen";
|
|
5450
|
+
})(GamePickSportType || (GamePickSportType = {}));
|
|
5451
|
+
var GameRoundOrderType;
|
|
5452
|
+
(function (GameRoundOrderType) {
|
|
5453
|
+
GameRoundOrderType[GameRoundOrderType["HowAdded"] = 1] = "HowAdded";
|
|
5454
|
+
GameRoundOrderType[GameRoundOrderType["HowAddedReversed"] = 2] = "HowAddedReversed";
|
|
5455
|
+
GameRoundOrderType[GameRoundOrderType["EventDateAscending"] = 3] = "EventDateAscending";
|
|
5456
|
+
GameRoundOrderType[GameRoundOrderType["EventDateDescending"] = 4] = "EventDateDescending";
|
|
5457
|
+
})(GameRoundOrderType || (GameRoundOrderType = {}));
|
|
5458
|
+
const AllRoundsGameBoardID = -1;
|
|
5459
|
+
|
|
5460
|
+
export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementStatus, AchievementTaskType, AchievementType, ActivityLogTransform, ActivityTypeLimited, AllRoundsGameBoardID, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GPRoundStatus, GamePickMarketType, GamePickResolutionType, GamePickScoreType, GamePickSportType, GameRoundOrderType, GetJackpotEligibleGamesResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContributionType, JackpotType, LeaderBoardPeriodType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWExposeUserSpinId, SAWExposeUserSpinIdName, SAWExposeUserSpinIdNamed, SAWGPMarketType, SAWGameDifficultyType, SAWGameDifficultyTypeName, SAWGameLayout, SAWGameLayoutName, SAWGameLayoutNamed, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, SawGameDifficultyTypeNamed, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UICustomSectionTransform, UserAchievementTransform, UserBalanceType, WSAPI, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
|
|
4813
5461
|
//# sourceMappingURL=index.modern.mjs.map
|