@smartico/public-api 0.0.352 → 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 +3 -0
- package/dist/SmarticoAPI.d.ts +16 -11
- package/dist/WSAPI/WSAPI.d.ts +212 -90
- package/dist/index.d.ts +1 -0
- package/dist/index.js +772 -616
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +405 -221
- 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 +5 -1
- package/docs/api/enums/SAWGPMarketType.md +157 -0
- package/docs/api/interfaces/RafflePublicMeta.md +3 -2
- package/docs/api/interfaces/TRaffle.md +8 -0
- package/package.json +4 -2
- package/src/GamePick/GPTypes.ts +4 -0
- package/src/SmarticoAPI.ts +98 -62
- package/src/WSAPI/WSAPI.ts +294 -156
- package/src/index.ts +1 -0
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
|
|
@@ -2198,11 +2193,13 @@ var onUpdateContextKey;
|
|
|
2198
2193
|
/** @group General API */
|
|
2199
2194
|
class WSAPI {
|
|
2200
2195
|
/** @private */
|
|
2201
|
-
constructor(api) {
|
|
2196
|
+
constructor(api, userExtId = null) {
|
|
2202
2197
|
this.api = void 0;
|
|
2203
2198
|
this.onUpdateCallback = new Map();
|
|
2204
2199
|
this.jackpotGetSignature = '';
|
|
2200
|
+
this.userExtId = null;
|
|
2205
2201
|
this.api = api;
|
|
2202
|
+
this.userExtId = userExtId;
|
|
2206
2203
|
OCache.clearAll();
|
|
2207
2204
|
if (this.api.tracker) {
|
|
2208
2205
|
const on = this.api.tracker.on;
|
|
@@ -2288,7 +2285,7 @@ class WSAPI {
|
|
|
2288
2285
|
* **Visitor mode: not supported**
|
|
2289
2286
|
*/
|
|
2290
2287
|
async checkSegmentMatch(segment_id) {
|
|
2291
|
-
const r = await this.api.coreCheckSegments(
|
|
2288
|
+
const r = await this.api.coreCheckSegments(this.userExtId, [segment_id]);
|
|
2292
2289
|
if (r && r.find(s => s.segment_id === segment_id && s.is_matching)) {
|
|
2293
2290
|
return true;
|
|
2294
2291
|
} else {
|
|
@@ -2305,7 +2302,7 @@ class WSAPI {
|
|
|
2305
2302
|
* **Visitor mode: not supported**
|
|
2306
2303
|
*/
|
|
2307
2304
|
async checkSegmentListMatch(segment_ids) {
|
|
2308
|
-
return await this.api.coreCheckSegments(
|
|
2305
|
+
return await this.api.coreCheckSegments(this.userExtId, Array.isArray(segment_ids) ? segment_ids : [segment_ids]);
|
|
2309
2306
|
}
|
|
2310
2307
|
/** Returns all the levels available the current user
|
|
2311
2308
|
* **Example**:
|
|
@@ -2323,7 +2320,7 @@ class WSAPI {
|
|
|
2323
2320
|
* ```
|
|
2324
2321
|
*/
|
|
2325
2322
|
async getLevels() {
|
|
2326
|
-
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);
|
|
2327
2324
|
}
|
|
2328
2325
|
/**
|
|
2329
2326
|
* Returns the current level of the user with extended information including ordinal position and progress.
|
|
@@ -2338,7 +2335,7 @@ class WSAPI {
|
|
|
2338
2335
|
* **Visitor mode: not supported**
|
|
2339
2336
|
*/
|
|
2340
2337
|
async getCurrentLevel() {
|
|
2341
|
-
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);
|
|
2342
2339
|
}
|
|
2343
2340
|
/** Returns all the missions configured for the current user (server-side scoped, not filtered by Widget visibility).
|
|
2344
2341
|
* The returned missions are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
|
|
@@ -2365,7 +2362,7 @@ class WSAPI {
|
|
|
2365
2362
|
if (onUpdate) {
|
|
2366
2363
|
this.onUpdateCallback.set(onUpdateContextKey.Missions, onUpdate);
|
|
2367
2364
|
}
|
|
2368
|
-
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);
|
|
2369
2366
|
}
|
|
2370
2367
|
/**
|
|
2371
2368
|
* Returns all the badges available the current user
|
|
@@ -2373,7 +2370,7 @@ class WSAPI {
|
|
|
2373
2370
|
* **Visitor mode: not supported**
|
|
2374
2371
|
*/
|
|
2375
2372
|
async getBadges() {
|
|
2376
|
-
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);
|
|
2377
2374
|
}
|
|
2378
2375
|
/**
|
|
2379
2376
|
* Returns all the bonuses for the current user
|
|
@@ -2389,7 +2386,7 @@ class WSAPI {
|
|
|
2389
2386
|
if (onUpdate) {
|
|
2390
2387
|
this.onUpdateCallback.set(onUpdateContextKey.Bonuses, onUpdate);
|
|
2391
2388
|
}
|
|
2392
|
-
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);
|
|
2393
2390
|
}
|
|
2394
2391
|
/**
|
|
2395
2392
|
* Claim the bonus by bonus_id. Returns the err_code in case of success or error.
|
|
@@ -2400,7 +2397,7 @@ class WSAPI {
|
|
|
2400
2397
|
* **Visitor mode: not supported**
|
|
2401
2398
|
*/
|
|
2402
2399
|
async claimBonus(bonus_id) {
|
|
2403
|
-
const r = await this.api.bonusClaimItem(
|
|
2400
|
+
const r = await this.api.bonusClaimItem(this.userExtId, bonus_id);
|
|
2404
2401
|
const o = {
|
|
2405
2402
|
err_code: r.errCode,
|
|
2406
2403
|
err_message: r.errMsg,
|
|
@@ -2423,7 +2420,7 @@ class WSAPI {
|
|
|
2423
2420
|
* **Visitor mode: not supported**
|
|
2424
2421
|
*/
|
|
2425
2422
|
async getUserLevelExtraCounters() {
|
|
2426
|
-
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);
|
|
2427
2424
|
}
|
|
2428
2425
|
/**
|
|
2429
2426
|
*
|
|
@@ -2454,7 +2451,7 @@ class WSAPI {
|
|
|
2454
2451
|
if (onUpdate) {
|
|
2455
2452
|
this.onUpdateCallback.set(onUpdateContextKey.StoreItems, onUpdate);
|
|
2456
2453
|
}
|
|
2457
|
-
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);
|
|
2458
2455
|
}
|
|
2459
2456
|
/** Buy the specific shop item by item_id. Returns the err_code in case of success or error.
|
|
2460
2457
|
* **Example**:
|
|
@@ -2467,7 +2464,7 @@ class WSAPI {
|
|
|
2467
2464
|
* **Visitor mode: not supported**
|
|
2468
2465
|
*/
|
|
2469
2466
|
async buyStoreItem(item_id) {
|
|
2470
|
-
const r = await this.api.buyStoreItem(
|
|
2467
|
+
const r = await this.api.buyStoreItem(this.userExtId, item_id);
|
|
2471
2468
|
const o = {
|
|
2472
2469
|
err_code: r.errCode,
|
|
2473
2470
|
err_message: r.errMsg
|
|
@@ -2493,7 +2490,7 @@ class WSAPI {
|
|
|
2493
2490
|
* ```
|
|
2494
2491
|
*/
|
|
2495
2492
|
async getStoreCategories() {
|
|
2496
|
-
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);
|
|
2497
2494
|
}
|
|
2498
2495
|
/**
|
|
2499
2496
|
* Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
@@ -2520,7 +2517,7 @@ class WSAPI {
|
|
|
2520
2517
|
if (onUpdate) {
|
|
2521
2518
|
this.onUpdateCallback.set(onUpdateContextKey.StoreHistory, onUpdate);
|
|
2522
2519
|
}
|
|
2523
|
-
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);
|
|
2524
2521
|
}
|
|
2525
2522
|
/**
|
|
2526
2523
|
* Returns missions & badges categories
|
|
@@ -2541,7 +2538,7 @@ class WSAPI {
|
|
|
2541
2538
|
*
|
|
2542
2539
|
* */
|
|
2543
2540
|
async getAchCategories() {
|
|
2544
|
-
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);
|
|
2545
2542
|
}
|
|
2546
2543
|
/**
|
|
2547
2544
|
* Returns list of custom sections
|
|
@@ -2562,7 +2559,7 @@ class WSAPI {
|
|
|
2562
2559
|
*
|
|
2563
2560
|
* */
|
|
2564
2561
|
async getCustomSections() {
|
|
2565
|
-
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);
|
|
2566
2563
|
}
|
|
2567
2564
|
/**
|
|
2568
2565
|
* Returns the list of mini-games configured for the current user (not filtered by spin availability or Widget visibility).
|
|
@@ -2590,7 +2587,7 @@ class WSAPI {
|
|
|
2590
2587
|
if (onUpdate) {
|
|
2591
2588
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
2592
2589
|
}
|
|
2593
|
-
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);
|
|
2594
2591
|
}
|
|
2595
2592
|
/**
|
|
2596
2593
|
* Returns the list of mini-games based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
@@ -2612,7 +2609,7 @@ class WSAPI {
|
|
|
2612
2609
|
offset,
|
|
2613
2610
|
saw_template_id
|
|
2614
2611
|
}) {
|
|
2615
|
-
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);
|
|
2616
2613
|
}
|
|
2617
2614
|
/**
|
|
2618
2615
|
* Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
@@ -2634,8 +2631,8 @@ class WSAPI {
|
|
|
2634
2631
|
if (onUpdate) {
|
|
2635
2632
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
2636
2633
|
}
|
|
2637
|
-
const r = await this.api.sawSpinRequest(
|
|
2638
|
-
this.api.doAcknowledgeRequest(
|
|
2634
|
+
const r = await this.api.sawSpinRequest(this.userExtId, template_id);
|
|
2635
|
+
this.api.doAcknowledgeRequest(this.userExtId, r.request_id);
|
|
2639
2636
|
const o = {
|
|
2640
2637
|
err_code: r.errCode,
|
|
2641
2638
|
err_message: r.errMsg,
|
|
@@ -2653,7 +2650,7 @@ class WSAPI {
|
|
|
2653
2650
|
* ```
|
|
2654
2651
|
*/
|
|
2655
2652
|
async miniGameWinAcknowledgeRequest(request_id) {
|
|
2656
|
-
return this.api.doAcknowledgeRequest(
|
|
2653
|
+
return this.api.doAcknowledgeRequest(this.userExtId, request_id);
|
|
2657
2654
|
}
|
|
2658
2655
|
/**
|
|
2659
2656
|
* Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
|
|
@@ -2674,9 +2671,9 @@ class WSAPI {
|
|
|
2674
2671
|
if (onUpdate) {
|
|
2675
2672
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
2676
2673
|
}
|
|
2677
|
-
const response = await this.api.sawSpinBatchRequest(
|
|
2674
|
+
const response = await this.api.sawSpinBatchRequest(this.userExtId, template_id, spin_count);
|
|
2678
2675
|
const request_ids = response.results.map(result => result.request_id);
|
|
2679
|
-
this.api.doAcknowledgeBatchRequest(
|
|
2676
|
+
this.api.doAcknowledgeBatchRequest(this.userExtId, request_ids);
|
|
2680
2677
|
const o = response.results.map(result => ({
|
|
2681
2678
|
errCode: result.errCode,
|
|
2682
2679
|
errMessage: result.errMsg,
|
|
@@ -2692,7 +2689,7 @@ class WSAPI {
|
|
|
2692
2689
|
* **Visitor mode: not supported**
|
|
2693
2690
|
*/
|
|
2694
2691
|
async requestMissionOptIn(mission_id) {
|
|
2695
|
-
const r = await this.api.missionOptIn(
|
|
2692
|
+
const r = await this.api.missionOptIn(this.userExtId, mission_id);
|
|
2696
2693
|
const o = {
|
|
2697
2694
|
err_code: r.errCode,
|
|
2698
2695
|
err_message: r.errMsg
|
|
@@ -2705,7 +2702,7 @@ class WSAPI {
|
|
|
2705
2702
|
* **Visitor mode: not supported**
|
|
2706
2703
|
*/
|
|
2707
2704
|
async requestMissionClaimReward(mission_id, ach_completed_id) {
|
|
2708
|
-
const r = await this.api.missionClaimPrize(
|
|
2705
|
+
const r = await this.api.missionClaimPrize(this.userExtId, mission_id, ach_completed_id);
|
|
2709
2706
|
const o = {
|
|
2710
2707
|
err_code: r.errCode,
|
|
2711
2708
|
err_message: r.errMsg
|
|
@@ -2736,7 +2733,7 @@ class WSAPI {
|
|
|
2736
2733
|
if (onUpdate) {
|
|
2737
2734
|
this.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
|
|
2738
2735
|
}
|
|
2739
|
-
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);
|
|
2740
2737
|
}
|
|
2741
2738
|
/**
|
|
2742
2739
|
* Returns details information of specific tournament instance, the response will include tournament info and the leaderboard of players
|
|
@@ -2764,7 +2761,7 @@ class WSAPI {
|
|
|
2764
2761
|
* ```
|
|
2765
2762
|
*/
|
|
2766
2763
|
async getTournamentInstanceInfo(tournamentInstanceId) {
|
|
2767
|
-
return this.api.tournamentsGetInfoT(
|
|
2764
|
+
return this.api.tournamentsGetInfoT(this.userExtId, tournamentInstanceId);
|
|
2768
2765
|
}
|
|
2769
2766
|
/**
|
|
2770
2767
|
* Requests registration for the specified tournament instance. Returns the err_code.
|
|
@@ -2772,7 +2769,7 @@ class WSAPI {
|
|
|
2772
2769
|
* **Visitor mode: not supported**
|
|
2773
2770
|
*/
|
|
2774
2771
|
async registerInTournament(tournamentInstanceId) {
|
|
2775
|
-
const r = await this.api.registerInTournament(
|
|
2772
|
+
const r = await this.api.registerInTournament(this.userExtId, tournamentInstanceId);
|
|
2776
2773
|
const o = {
|
|
2777
2774
|
err_code: r.errCode,
|
|
2778
2775
|
err_message: r.errMsg
|
|
@@ -2798,7 +2795,7 @@ class WSAPI {
|
|
|
2798
2795
|
* ```
|
|
2799
2796
|
*/
|
|
2800
2797
|
async getLeaderBoard(periodType, getPreviousPeriod) {
|
|
2801
|
-
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);
|
|
2802
2799
|
}
|
|
2803
2800
|
/** Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
|
|
2804
2801
|
* The maximum number of messages per request is limited to 20.
|
|
@@ -2825,7 +2822,7 @@ class WSAPI {
|
|
|
2825
2822
|
if (onUpdate) {
|
|
2826
2823
|
this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
|
|
2827
2824
|
}
|
|
2828
|
-
return await this.api.getInboxMessagesT(
|
|
2825
|
+
return await this.api.getInboxMessagesT(this.userExtId, from, to, onlyFavorite, categoryId, read_status);
|
|
2829
2826
|
}
|
|
2830
2827
|
/**
|
|
2831
2828
|
* Returns inbox unread count.
|
|
@@ -2839,7 +2836,7 @@ class WSAPI {
|
|
|
2839
2836
|
if (onUpdate) {
|
|
2840
2837
|
this.onUpdateCallback.set(onUpdateContextKey.InboxUnreadCount, onUpdate);
|
|
2841
2838
|
}
|
|
2842
|
-
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);
|
|
2843
2840
|
}
|
|
2844
2841
|
/**
|
|
2845
2842
|
* Returns the message body of the specified message guid.
|
|
@@ -2855,7 +2852,7 @@ class WSAPI {
|
|
|
2855
2852
|
* **Visitor mode: not supported**
|
|
2856
2853
|
*/
|
|
2857
2854
|
async markInboxMessageAsRead(messageGuid) {
|
|
2858
|
-
const r = await this.api.markInboxMessageRead(
|
|
2855
|
+
const r = await this.api.markInboxMessageRead(this.userExtId, messageGuid);
|
|
2859
2856
|
return {
|
|
2860
2857
|
err_code: r.errCode,
|
|
2861
2858
|
err_message: r.errMsg
|
|
@@ -2867,7 +2864,7 @@ class WSAPI {
|
|
|
2867
2864
|
* **Visitor mode: not supported**
|
|
2868
2865
|
*/
|
|
2869
2866
|
async markAllInboxMessagesAsRead() {
|
|
2870
|
-
const r = await this.api.markAllInboxMessageRead(
|
|
2867
|
+
const r = await this.api.markAllInboxMessageRead(this.userExtId);
|
|
2871
2868
|
return {
|
|
2872
2869
|
err_code: r.errCode,
|
|
2873
2870
|
err_message: r.errMsg
|
|
@@ -2879,7 +2876,7 @@ class WSAPI {
|
|
|
2879
2876
|
* **Visitor mode: not supported**
|
|
2880
2877
|
*/
|
|
2881
2878
|
async markUnmarkInboxMessageAsFavorite(messageGuid, mark) {
|
|
2882
|
-
const r = await this.api.markUnmarkInboxMessageAsFavorite(
|
|
2879
|
+
const r = await this.api.markUnmarkInboxMessageAsFavorite(this.userExtId, messageGuid, mark);
|
|
2883
2880
|
return {
|
|
2884
2881
|
err_code: r.errCode,
|
|
2885
2882
|
err_message: r.errMsg
|
|
@@ -2891,7 +2888,7 @@ class WSAPI {
|
|
|
2891
2888
|
* **Visitor mode: not supported**
|
|
2892
2889
|
*/
|
|
2893
2890
|
async deleteInboxMessage(messageGuid) {
|
|
2894
|
-
const r = await this.api.deleteInboxMessage(
|
|
2891
|
+
const r = await this.api.deleteInboxMessage(this.userExtId, messageGuid);
|
|
2895
2892
|
return {
|
|
2896
2893
|
err_code: r.errCode,
|
|
2897
2894
|
err_message: r.errMsg
|
|
@@ -2903,7 +2900,7 @@ class WSAPI {
|
|
|
2903
2900
|
* **Visitor mode: not supported**
|
|
2904
2901
|
*/
|
|
2905
2902
|
async deleteAllInboxMessages() {
|
|
2906
|
-
const r = await this.api.deleteAllInboxMessages(
|
|
2903
|
+
const r = await this.api.deleteAllInboxMessages(this.userExtId);
|
|
2907
2904
|
return {
|
|
2908
2905
|
err_code: r.errCode,
|
|
2909
2906
|
err_message: r.errMsg
|
|
@@ -2913,7 +2910,7 @@ class WSAPI {
|
|
|
2913
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.
|
|
2914
2911
|
*/
|
|
2915
2912
|
async getTranslations(lang_code) {
|
|
2916
|
-
const r = await this.api.getTranslationsT(
|
|
2913
|
+
const r = await this.api.getTranslationsT(this.userExtId, lang_code, []);
|
|
2917
2914
|
return {
|
|
2918
2915
|
translations: r.translations
|
|
2919
2916
|
};
|
|
@@ -2940,7 +2937,7 @@ class WSAPI {
|
|
|
2940
2937
|
engagement_uid,
|
|
2941
2938
|
activityType
|
|
2942
2939
|
}) {
|
|
2943
|
-
this.api.reportEngagementImpression(
|
|
2940
|
+
this.api.reportEngagementImpression(this.userExtId, engagement_uid, activityType);
|
|
2944
2941
|
}
|
|
2945
2942
|
/**
|
|
2946
2943
|
* Reports a click/action event for an engagement (when user interacts with engagement content).
|
|
@@ -2968,7 +2965,7 @@ class WSAPI {
|
|
|
2968
2965
|
activityType,
|
|
2969
2966
|
action
|
|
2970
2967
|
}) {
|
|
2971
|
-
this.api.reportEngagementAction(
|
|
2968
|
+
this.api.reportEngagementAction(this.userExtId, engagement_uid, activityType, action);
|
|
2972
2969
|
}
|
|
2973
2970
|
/**
|
|
2974
2971
|
* Returns the activity log for a user within a specified time range.
|
|
@@ -3011,21 +3008,36 @@ class WSAPI {
|
|
|
3011
3008
|
if (onUpdate) {
|
|
3012
3009
|
this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
|
|
3013
3010
|
}
|
|
3014
|
-
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);
|
|
3015
3012
|
}
|
|
3016
3013
|
/**
|
|
3017
|
-
* Returns the active rounds for the specified MatchX or Quiz game
|
|
3018
|
-
* Each round
|
|
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
|
|
3019
3031
|
*
|
|
3020
3032
|
* **Example**:
|
|
3021
3033
|
* ```
|
|
3022
3034
|
* _smartico.api.getGamePickActiveRounds({
|
|
3023
|
-
* saw_template_id:
|
|
3024
|
-
* ext_user_id: '149598632',
|
|
3025
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
3026
|
-
* lang: 'EN'
|
|
3035
|
+
* saw_template_id: 1083,
|
|
3027
3036
|
* }).then((result) => {
|
|
3028
|
-
* console.log(result);
|
|
3037
|
+
* console.log(result.data); // GamePickRound[]
|
|
3038
|
+
* result.data.forEach(round => {
|
|
3039
|
+
* console.log(round.round_name, round.events.length);
|
|
3040
|
+
* });
|
|
3029
3041
|
* });
|
|
3030
3042
|
* ```
|
|
3031
3043
|
*
|
|
@@ -3035,20 +3047,28 @@ class WSAPI {
|
|
|
3035
3047
|
if (!props.saw_template_id) {
|
|
3036
3048
|
throw new Error('saw_template_id is required');
|
|
3037
3049
|
}
|
|
3038
|
-
return this.api.gpGetActiveRounds(props.
|
|
3050
|
+
return this.api.gpGetActiveRounds(props.saw_template_id);
|
|
3039
3051
|
}
|
|
3040
3052
|
/**
|
|
3041
|
-
* Returns a single active round
|
|
3042
|
-
*
|
|
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
|
|
3043
3063
|
*
|
|
3044
3064
|
* **Example**:
|
|
3045
3065
|
* ```
|
|
3046
3066
|
* _smartico.api.getGamePickActiveRound({
|
|
3047
|
-
* saw_template_id:
|
|
3048
|
-
*
|
|
3049
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
3067
|
+
* saw_template_id: 1083,
|
|
3068
|
+
* round_id: 31652,
|
|
3050
3069
|
* }).then((result) => {
|
|
3051
|
-
* console.log(result);
|
|
3070
|
+
* console.log(result.data.round_name, result.data.events.length);
|
|
3071
|
+
* console.log(result.data.user_score, result.data.user_placed_bet);
|
|
3052
3072
|
* });
|
|
3053
3073
|
* ```
|
|
3054
3074
|
*
|
|
@@ -3058,19 +3078,31 @@ class WSAPI {
|
|
|
3058
3078
|
if (!props.saw_template_id) {
|
|
3059
3079
|
throw new Error('saw_template_id is required');
|
|
3060
3080
|
}
|
|
3061
|
-
|
|
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);
|
|
3062
3085
|
}
|
|
3063
3086
|
/**
|
|
3064
|
-
* Returns the history of all rounds (including resolved) for the specified MatchX or Quiz game.
|
|
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`
|
|
3065
3097
|
*
|
|
3066
3098
|
* **Example**:
|
|
3067
3099
|
* ```
|
|
3068
3100
|
* _smartico.api.getGamePickHistory({
|
|
3069
|
-
* saw_template_id:
|
|
3070
|
-
* ext_user_id: '149598632',
|
|
3071
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
3101
|
+
* saw_template_id: 1083,
|
|
3072
3102
|
* }).then((result) => {
|
|
3073
|
-
*
|
|
3103
|
+
* result.data.forEach(round => {
|
|
3104
|
+
* console.log(round.round_name, 'Score:', round.user_score, 'Resolved:', round.is_resolved);
|
|
3105
|
+
* });
|
|
3074
3106
|
* });
|
|
3075
3107
|
* ```
|
|
3076
3108
|
*
|
|
@@ -3080,21 +3112,35 @@ class WSAPI {
|
|
|
3080
3112
|
if (!props.saw_template_id) {
|
|
3081
3113
|
throw new Error('saw_template_id is required');
|
|
3082
3114
|
}
|
|
3083
|
-
return this.api.gpGetGamesHistory(props.
|
|
3115
|
+
return this.api.gpGetGamesHistory(props.saw_template_id);
|
|
3084
3116
|
}
|
|
3085
3117
|
/**
|
|
3086
3118
|
* Returns the leaderboard for a specific round within a MatchX or Quiz game.
|
|
3087
|
-
* Use round_id = -1 (AllRoundsGameBoardID)
|
|
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
|
|
3088
3135
|
*
|
|
3089
3136
|
* **Example**:
|
|
3090
3137
|
* ```
|
|
3091
3138
|
* _smartico.api.getGamePickBoard({
|
|
3092
|
-
* saw_template_id:
|
|
3093
|
-
*
|
|
3094
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
3095
|
-
* round_id: 456
|
|
3139
|
+
* saw_template_id: 1083,
|
|
3140
|
+
* round_id: 31652,
|
|
3096
3141
|
* }).then((result) => {
|
|
3097
|
-
* console.log(
|
|
3142
|
+
* console.log('Top players:', result.data.users);
|
|
3143
|
+
* console.log('My position:', result.data.my_user?.gp_position);
|
|
3098
3144
|
* });
|
|
3099
3145
|
* ```
|
|
3100
3146
|
*
|
|
@@ -3104,85 +3150,134 @@ class WSAPI {
|
|
|
3104
3150
|
if (!props.saw_template_id) {
|
|
3105
3151
|
throw new Error('saw_template_id is required');
|
|
3106
3152
|
}
|
|
3107
|
-
if (props.round_id
|
|
3153
|
+
if (!props.round_id) {
|
|
3108
3154
|
throw new Error('round_id is required');
|
|
3109
3155
|
}
|
|
3110
|
-
return this.api.gpGetGameBoard(props.
|
|
3156
|
+
return this.api.gpGetGameBoard(props.saw_template_id, props.round_id);
|
|
3111
3157
|
}
|
|
3112
3158
|
/**
|
|
3113
|
-
* Submits
|
|
3114
|
-
* Sends the
|
|
3115
|
-
* Each event
|
|
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`
|
|
3116
3173
|
*
|
|
3117
3174
|
* **Example**:
|
|
3118
3175
|
* ```
|
|
3119
|
-
* _smartico.api.
|
|
3120
|
-
* saw_template_id:
|
|
3121
|
-
*
|
|
3122
|
-
*
|
|
3123
|
-
* round
|
|
3124
|
-
*
|
|
3125
|
-
*
|
|
3126
|
-
*
|
|
3127
|
-
*
|
|
3128
|
-
*
|
|
3129
|
-
*
|
|
3130
|
-
*
|
|
3131
|
-
*
|
|
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
|
+
* });
|
|
3132
3192
|
* });
|
|
3133
3193
|
* ```
|
|
3134
3194
|
*
|
|
3135
3195
|
* **Visitor mode: not supported**
|
|
3136
3196
|
*/
|
|
3137
3197
|
async submitGamePickSelection(props) {
|
|
3198
|
+
var _props$round;
|
|
3138
3199
|
if (!props.saw_template_id) {
|
|
3139
3200
|
throw new Error('saw_template_id is required');
|
|
3140
3201
|
}
|
|
3141
|
-
|
|
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);
|
|
3142
3206
|
}
|
|
3143
3207
|
/**
|
|
3144
3208
|
* Submits answers for a round in a Quiz game.
|
|
3145
|
-
* Sends the
|
|
3146
|
-
* Each event
|
|
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`
|
|
3147
3222
|
*
|
|
3148
3223
|
* **Example**:
|
|
3149
3224
|
* ```
|
|
3150
|
-
* _smartico.api.
|
|
3151
|
-
* saw_template_id:
|
|
3152
|
-
*
|
|
3153
|
-
*
|
|
3154
|
-
* round
|
|
3155
|
-
*
|
|
3156
|
-
*
|
|
3157
|
-
*
|
|
3158
|
-
*
|
|
3159
|
-
*
|
|
3160
|
-
*
|
|
3161
|
-
*
|
|
3162
|
-
*
|
|
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
|
+
* });
|
|
3163
3240
|
* });
|
|
3164
3241
|
* ```
|
|
3165
3242
|
*
|
|
3166
3243
|
* **Visitor mode: not supported**
|
|
3167
3244
|
*/
|
|
3168
3245
|
async submitGamePickSelectionQuiz(props) {
|
|
3246
|
+
var _props$round2;
|
|
3169
3247
|
if (!props.saw_template_id) {
|
|
3170
3248
|
throw new Error('saw_template_id is required');
|
|
3171
3249
|
}
|
|
3172
|
-
|
|
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);
|
|
3173
3254
|
}
|
|
3174
3255
|
/**
|
|
3175
3256
|
* Returns the current user's profile information within the specified MatchX or Quiz game.
|
|
3176
|
-
*
|
|
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
|
|
3177
3274
|
*
|
|
3178
3275
|
* **Example**:
|
|
3179
3276
|
* ```
|
|
3180
3277
|
* _smartico.api.getGamePickUserInfo({
|
|
3181
|
-
* saw_template_id:
|
|
3182
|
-
* ext_user_id: '149598632',
|
|
3183
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
3278
|
+
* saw_template_id: 1083,
|
|
3184
3279
|
* }).then((result) => {
|
|
3185
|
-
* console.log(result.data.public_username, result.data.
|
|
3280
|
+
* console.log(result.data.public_username, result.data.ach_points_balance);
|
|
3186
3281
|
* });
|
|
3187
3282
|
* ```
|
|
3188
3283
|
*
|
|
@@ -3192,19 +3287,37 @@ class WSAPI {
|
|
|
3192
3287
|
if (!props.saw_template_id) {
|
|
3193
3288
|
throw new Error('saw_template_id is required');
|
|
3194
3289
|
}
|
|
3195
|
-
return this.api.gpGetUserInfo(props.
|
|
3290
|
+
return this.api.gpGetUserInfo(props.saw_template_id);
|
|
3196
3291
|
}
|
|
3197
3292
|
/**
|
|
3198
|
-
* Returns the game configuration
|
|
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
|
|
3199
3312
|
*
|
|
3200
3313
|
* **Example**:
|
|
3201
3314
|
* ```
|
|
3202
3315
|
* _smartico.api.getGamePickGameInfo({
|
|
3203
|
-
* saw_template_id:
|
|
3204
|
-
* ext_user_id: '149598632',
|
|
3205
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
3316
|
+
* saw_template_id: 1189,
|
|
3206
3317
|
* }).then((result) => {
|
|
3207
|
-
* console.log(result.data.sawTemplate
|
|
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);
|
|
3208
3321
|
* });
|
|
3209
3322
|
* ```
|
|
3210
3323
|
*
|
|
@@ -3214,21 +3327,30 @@ class WSAPI {
|
|
|
3214
3327
|
if (!props.saw_template_id) {
|
|
3215
3328
|
throw new Error('saw_template_id is required');
|
|
3216
3329
|
}
|
|
3217
|
-
return this.api.gpGetGameInfo(props.
|
|
3330
|
+
return this.api.gpGetGameInfo(props.saw_template_id);
|
|
3218
3331
|
}
|
|
3219
3332
|
/**
|
|
3220
3333
|
* Returns translations for the MatchX/Quiz game UI.
|
|
3221
|
-
* Translations are returned as a key-value map
|
|
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')
|
|
3222
3345
|
*
|
|
3223
3346
|
* **Example**:
|
|
3224
3347
|
* ```
|
|
3225
3348
|
* _smartico.api.getGamePickTranslations({
|
|
3226
|
-
* saw_template_id:
|
|
3227
|
-
* ext_user_id: '149598632',
|
|
3228
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
3229
|
-
* lang: 'EN'
|
|
3349
|
+
* saw_template_id: 1083,
|
|
3230
3350
|
* }).then((result) => {
|
|
3231
|
-
*
|
|
3351
|
+
* const tr = result.data.translations;
|
|
3352
|
+
* console.log(tr.rgSubmitSelection); // "Submit selection"
|
|
3353
|
+
* console.log(tr.rgLeaderboardTitle); // "Leaderboard"
|
|
3232
3354
|
* });
|
|
3233
3355
|
* ```
|
|
3234
3356
|
*
|
|
@@ -3238,22 +3360,34 @@ class WSAPI {
|
|
|
3238
3360
|
if (!props.saw_template_id) {
|
|
3239
3361
|
throw new Error('saw_template_id is required');
|
|
3240
3362
|
}
|
|
3241
|
-
return this.api.gpGetTranslations(props.
|
|
3363
|
+
return this.api.gpGetTranslations(props.saw_template_id);
|
|
3242
3364
|
}
|
|
3243
3365
|
/**
|
|
3244
3366
|
* Returns round data with events and picks for a specific user (identified by their internal user ID).
|
|
3245
|
-
* Useful for
|
|
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
|
|
3246
3380
|
*
|
|
3247
3381
|
* **Example**:
|
|
3248
3382
|
* ```
|
|
3249
3383
|
* _smartico.api.getGamePickRoundInfoForUser({
|
|
3250
|
-
* saw_template_id:
|
|
3251
|
-
*
|
|
3252
|
-
*
|
|
3253
|
-
* round_id: 456,
|
|
3254
|
-
* int_user_id: 789
|
|
3384
|
+
* saw_template_id: 1083,
|
|
3385
|
+
* round_id: 31652,
|
|
3386
|
+
* int_user_id: 65653810,
|
|
3255
3387
|
* }).then((result) => {
|
|
3256
|
-
*
|
|
3388
|
+
* result.data.events.forEach(e => {
|
|
3389
|
+
* console.log(e.event_meta.team1_name, 'vs', e.event_meta.team2_name, '→', e.user_selection);
|
|
3390
|
+
* });
|
|
3257
3391
|
* });
|
|
3258
3392
|
* ```
|
|
3259
3393
|
*
|
|
@@ -3269,53 +3403,53 @@ class WSAPI {
|
|
|
3269
3403
|
if (!props.int_user_id) {
|
|
3270
3404
|
throw new Error('int_user_id is required');
|
|
3271
3405
|
}
|
|
3272
|
-
return this.api.gpGetRoundInfoForUser(props.
|
|
3406
|
+
return this.api.gpGetRoundInfoForUser(props.saw_template_id, props.round_id, props.int_user_id);
|
|
3273
3407
|
}
|
|
3274
3408
|
async updateOnSpin(data) {
|
|
3275
|
-
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);
|
|
3276
3410
|
const index = templates.findIndex(t => t.id === data.saw_template_id);
|
|
3277
3411
|
templates[index].spin_count = data.spin_count;
|
|
3278
3412
|
this.updateEntity(onUpdateContextKey.Saw, templates);
|
|
3279
3413
|
}
|
|
3280
3414
|
async reloadMiniGameTemplate() {
|
|
3281
|
-
const updatedTemplates = await this.api.sawGetTemplatesT(
|
|
3415
|
+
const updatedTemplates = await this.api.sawGetTemplatesT(this.userExtId);
|
|
3282
3416
|
this.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
3283
3417
|
}
|
|
3284
3418
|
async updateMissions() {
|
|
3285
|
-
const payload = await this.api.missionsGetItemsT(
|
|
3419
|
+
const payload = await this.api.missionsGetItemsT(this.userExtId);
|
|
3286
3420
|
this.updateEntity(onUpdateContextKey.Missions, payload);
|
|
3287
3421
|
}
|
|
3288
3422
|
async updateBonuses() {
|
|
3289
|
-
const payload = await this.api.bonusesGetItemsT(
|
|
3423
|
+
const payload = await this.api.bonusesGetItemsT(this.userExtId);
|
|
3290
3424
|
this.updateEntity(onUpdateContextKey.Bonuses, payload);
|
|
3291
3425
|
}
|
|
3292
3426
|
async updateTournaments() {
|
|
3293
|
-
const payload = await this.api.tournamentsGetLobbyT(
|
|
3427
|
+
const payload = await this.api.tournamentsGetLobbyT(this.userExtId);
|
|
3294
3428
|
this.updateEntity(onUpdateContextKey.TournamentList, payload);
|
|
3295
3429
|
}
|
|
3296
3430
|
async updateStorePurchasedItems() {
|
|
3297
|
-
const payload = await this.api.storeGetPurchasedItemsT(
|
|
3431
|
+
const payload = await this.api.storeGetPurchasedItemsT(this.userExtId, 20, 0);
|
|
3298
3432
|
this.updateEntity(onUpdateContextKey.StoreHistory, payload);
|
|
3299
3433
|
}
|
|
3300
3434
|
async updateStoreItems() {
|
|
3301
|
-
const payload = await this.api.storeGetItemsT(
|
|
3435
|
+
const payload = await this.api.storeGetItemsT(this.userExtId);
|
|
3302
3436
|
this.updateEntity(onUpdateContextKey.StoreItems, payload);
|
|
3303
3437
|
}
|
|
3304
3438
|
async updateInboxUnreadCount(count) {
|
|
3305
3439
|
this.updateEntity(onUpdateContextKey.InboxUnreadCount, count);
|
|
3306
3440
|
}
|
|
3307
3441
|
async updateInboxMessages() {
|
|
3308
|
-
const payload = await this.api.getInboxMessagesT(
|
|
3442
|
+
const payload = await this.api.getInboxMessagesT(this.userExtId);
|
|
3309
3443
|
this.updateEntity(onUpdateContextKey.InboxMessages, payload);
|
|
3310
3444
|
}
|
|
3311
3445
|
async updateRaffles() {
|
|
3312
|
-
const payload = await this.api.getRafflesT(
|
|
3446
|
+
const payload = await this.api.getRafflesT(this.userExtId);
|
|
3313
3447
|
this.updateEntity(onUpdateContextKey.Raffles, payload);
|
|
3314
3448
|
}
|
|
3315
3449
|
async notifyActivityLogUpdate() {
|
|
3316
3450
|
const startSeconds = Date.now() / 1000 - 600;
|
|
3317
3451
|
const endSeconds = Date.now() / 1000;
|
|
3318
|
-
const payload = await this.api.getActivityLogT(
|
|
3452
|
+
const payload = await this.api.getActivityLogT(this.userExtId, startSeconds, endSeconds, 0, 50);
|
|
3319
3453
|
this.updateEntity(onUpdateContextKey.ActivityLog, payload);
|
|
3320
3454
|
}
|
|
3321
3455
|
async updateEntity(contextKey, payload) {
|
|
@@ -3359,7 +3493,7 @@ class WSAPI {
|
|
|
3359
3493
|
let jackpots = [];
|
|
3360
3494
|
let pots = [];
|
|
3361
3495
|
jackpots = await OCache.use(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async function () {
|
|
3362
|
-
const _jackpots = await _this.api.jackpotGet(
|
|
3496
|
+
const _jackpots = await _this.api.jackpotGet(_this.userExtId, filter);
|
|
3363
3497
|
const _pots = _jackpots.items.map(jp => jp.pot);
|
|
3364
3498
|
_jackpots.items.forEach(jp => {
|
|
3365
3499
|
jp.jp_public_meta.custom_data = IntUtils.JsonOrText(jp.jp_public_meta.custom_data);
|
|
@@ -3370,7 +3504,7 @@ class WSAPI {
|
|
|
3370
3504
|
if (jackpots.length > 0) {
|
|
3371
3505
|
pots = await OCache.use(onUpdateContextKey.Pots, ECacheContext.WSAPI, async function () {
|
|
3372
3506
|
const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
|
|
3373
|
-
return (await _this.api.potGet(
|
|
3507
|
+
return (await _this.api.potGet(_this.userExtId, {
|
|
3374
3508
|
jp_template_ids
|
|
3375
3509
|
})).items;
|
|
3376
3510
|
}, JACKPOT_POT_CACHE_SEC);
|
|
@@ -3400,7 +3534,7 @@ class WSAPI {
|
|
|
3400
3534
|
if (!filter.jp_template_id) {
|
|
3401
3535
|
throw new Error('jp_template_id is required in jackpotOptIn');
|
|
3402
3536
|
}
|
|
3403
|
-
const result = await this.api.jackpotOptIn(
|
|
3537
|
+
const result = await this.api.jackpotOptIn(this.userExtId, filter);
|
|
3404
3538
|
return result;
|
|
3405
3539
|
}
|
|
3406
3540
|
/**
|
|
@@ -3421,7 +3555,7 @@ class WSAPI {
|
|
|
3421
3555
|
if (!filter.jp_template_id) {
|
|
3422
3556
|
throw new Error('jp_template_id is required in jackpotOptOut');
|
|
3423
3557
|
}
|
|
3424
|
-
const result = await this.api.jackpotOptOut(
|
|
3558
|
+
const result = await this.api.jackpotOptOut(this.userExtId, filter);
|
|
3425
3559
|
return result;
|
|
3426
3560
|
}
|
|
3427
3561
|
/**
|
|
@@ -3444,7 +3578,7 @@ class WSAPI {
|
|
|
3444
3578
|
offset,
|
|
3445
3579
|
jp_template_id
|
|
3446
3580
|
}) {
|
|
3447
|
-
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);
|
|
3448
3582
|
}
|
|
3449
3583
|
/**
|
|
3450
3584
|
* Returns the eligible games for the jackpot with the specified jp_template_id.
|
|
@@ -3466,7 +3600,7 @@ class WSAPI {
|
|
|
3466
3600
|
if (onUpdate) {
|
|
3467
3601
|
this.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
|
|
3468
3602
|
}
|
|
3469
|
-
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, {
|
|
3470
3604
|
jp_template_id
|
|
3471
3605
|
}), JACKPOT_ELIGIBLE_GAMES_CACHE_SEC);
|
|
3472
3606
|
}
|
|
@@ -3489,7 +3623,7 @@ class WSAPI {
|
|
|
3489
3623
|
* ```
|
|
3490
3624
|
*/
|
|
3491
3625
|
async getRelatedItemsForGame(related_game_id) {
|
|
3492
|
-
const result = await this.api.getRelatedItemsForGame(
|
|
3626
|
+
const result = await this.api.getRelatedItemsForGame(this.userExtId, related_game_id);
|
|
3493
3627
|
return result;
|
|
3494
3628
|
}
|
|
3495
3629
|
/**
|
|
@@ -3520,7 +3654,7 @@ class WSAPI {
|
|
|
3520
3654
|
if (onUpdate) {
|
|
3521
3655
|
this.onUpdateCallback.set(onUpdateContextKey.Raffles, onUpdate);
|
|
3522
3656
|
}
|
|
3523
|
-
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);
|
|
3524
3658
|
}
|
|
3525
3659
|
/**
|
|
3526
3660
|
* Returns draw run for provided raffle_id and run_id.
|
|
@@ -3549,7 +3683,7 @@ class WSAPI {
|
|
|
3549
3683
|
if (!props.raffle_id || !props.run_id) {
|
|
3550
3684
|
throw new Error('both raffle_id and run_id are required');
|
|
3551
3685
|
}
|
|
3552
|
-
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);
|
|
3553
3687
|
}
|
|
3554
3688
|
/**
|
|
3555
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
|
|
@@ -3573,7 +3707,7 @@ class WSAPI {
|
|
|
3573
3707
|
*
|
|
3574
3708
|
*/
|
|
3575
3709
|
async getRaffleDrawRunsHistory(props) {
|
|
3576
|
-
const res = await this.api.getRaffleDrawRunsHistory(
|
|
3710
|
+
const res = await this.api.getRaffleDrawRunsHistory(this.userExtId, props);
|
|
3577
3711
|
if (!props.raffle_id) {
|
|
3578
3712
|
throw new Error('raffle_id is required');
|
|
3579
3713
|
}
|
|
@@ -3604,7 +3738,7 @@ class WSAPI {
|
|
|
3604
3738
|
if (!props.won_id) {
|
|
3605
3739
|
throw new Error('won_id is required');
|
|
3606
3740
|
}
|
|
3607
|
-
const res = await this.api.claimRafflePrize(
|
|
3741
|
+
const res = await this.api.claimRafflePrize(this.userExtId, {
|
|
3608
3742
|
won_id: props.won_id
|
|
3609
3743
|
});
|
|
3610
3744
|
return raffleClaimPrizeResponseTransform(res);
|
|
@@ -3624,7 +3758,7 @@ class WSAPI {
|
|
|
3624
3758
|
if (!props.raffle_run_id) {
|
|
3625
3759
|
throw new Error('raffle_run_id is required');
|
|
3626
3760
|
}
|
|
3627
|
-
const r = await this.api.raffleOptin(
|
|
3761
|
+
const r = await this.api.raffleOptin(this.userExtId, props);
|
|
3628
3762
|
return {
|
|
3629
3763
|
err_code: r.errCode,
|
|
3630
3764
|
err_message: r.errMsg
|
|
@@ -3841,7 +3975,7 @@ const GetJackpotEligibleGamesResponseTransform = ({
|
|
|
3841
3975
|
|
|
3842
3976
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
3843
3977
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
3844
|
-
const GAMES_API_URL = 'https://r-games-api
|
|
3978
|
+
const GAMES_API_URL = 'https://r-games-api.smr.vc';
|
|
3845
3979
|
const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
|
|
3846
3980
|
const DEFAULT_LANG_EN = 'EN';
|
|
3847
3981
|
class SmarticoAPI {
|
|
@@ -3855,6 +3989,7 @@ class SmarticoAPI {
|
|
|
3855
3989
|
this.inboxCdnUrl = void 0;
|
|
3856
3990
|
this.partnerUrl = void 0;
|
|
3857
3991
|
this.gamesApiUrl = void 0;
|
|
3992
|
+
this.baseRgApiParams = void 0;
|
|
3858
3993
|
this.avatarDomain = void 0;
|
|
3859
3994
|
this.envId = void 0;
|
|
3860
3995
|
this.logger = void 0;
|
|
@@ -3873,7 +4008,12 @@ class SmarticoAPI {
|
|
|
3873
4008
|
this.tracker = options.tracker;
|
|
3874
4009
|
this.publicUrl = SmarticoAPI.getPublicUrl(label_api_key);
|
|
3875
4010
|
this.wsUrl = SmarticoAPI.getPublicWsUrl(label_api_key);
|
|
3876
|
-
this.
|
|
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
|
+
};
|
|
3877
4017
|
this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || ((_options$tracker = options.tracker) == null ? void 0 : _options$tracker.label_api_key));
|
|
3878
4018
|
this.label_api_key = SmarticoAPI.getCleanLabelApiKey(label_api_key);
|
|
3879
4019
|
}
|
|
@@ -3927,9 +4067,6 @@ class SmarticoAPI {
|
|
|
3927
4067
|
static getPublicWsUrl(label_api_key) {
|
|
3928
4068
|
return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3929
4069
|
}
|
|
3930
|
-
static getGamesApiUrl(label_api_key) {
|
|
3931
|
-
return GAMES_API_URL.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3932
|
-
}
|
|
3933
4070
|
static getAvatarUrl(label_api_key) {
|
|
3934
4071
|
const avatarUrl = AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3935
4072
|
return SmarticoAPI.replaceSmrDomainsWithCloudfront(avatarUrl);
|
|
@@ -4563,42 +4700,40 @@ class SmarticoAPI {
|
|
|
4563
4700
|
});
|
|
4564
4701
|
return await this.send(message, ClassId.MARK_INBOX_DELETED_RESPONSE);
|
|
4565
4702
|
}
|
|
4566
|
-
buildGamesApiParams(
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
lang
|
|
4572
|
-
|
|
4573
|
-
label_api_key: this.label_api_key,
|
|
4574
|
-
hash: ''
|
|
4575
|
-
};
|
|
4576
|
-
if (this.brand_api_key) {
|
|
4577
|
-
params.brand_key = this.brand_api_key;
|
|
4578
|
-
}
|
|
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
|
+
});
|
|
4579
4710
|
return params;
|
|
4580
4711
|
}
|
|
4581
|
-
async sendGamesApi(
|
|
4582
|
-
|
|
4712
|
+
async sendGamesApi({
|
|
4713
|
+
method,
|
|
4714
|
+
params,
|
|
4715
|
+
usePost = false
|
|
4716
|
+
}) {
|
|
4717
|
+
const baseParams = this.buildGamesApiParams();
|
|
4583
4718
|
const queryString = Object.entries(baseParams).map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join('&');
|
|
4584
|
-
let url = `${
|
|
4719
|
+
let url = `${GAMES_API_URL}/${method}?${queryString}`;
|
|
4585
4720
|
let fetchOptions = {
|
|
4586
4721
|
method: 'GET',
|
|
4587
4722
|
headers: {
|
|
4588
4723
|
'Accept': 'application/json'
|
|
4589
4724
|
}
|
|
4590
4725
|
};
|
|
4591
|
-
if (usePost &&
|
|
4726
|
+
if (usePost && params) {
|
|
4592
4727
|
fetchOptions = {
|
|
4593
4728
|
method: 'POST',
|
|
4594
4729
|
headers: {
|
|
4595
4730
|
'Accept': 'application/json',
|
|
4596
4731
|
'Content-Type': 'application/json'
|
|
4597
4732
|
},
|
|
4598
|
-
body: JSON.stringify(
|
|
4733
|
+
body: JSON.stringify(params)
|
|
4599
4734
|
};
|
|
4600
|
-
} else if (
|
|
4601
|
-
const extraQuery = Object.entries(
|
|
4735
|
+
} else if (params) {
|
|
4736
|
+
const extraQuery = Object.entries(params).map(([k, v]) => `${k}=${encodeURIComponent(JSON.stringify(v))}`).join('&');
|
|
4602
4737
|
url += `&${extraQuery}`;
|
|
4603
4738
|
}
|
|
4604
4739
|
try {
|
|
@@ -4613,43 +4748,92 @@ class SmarticoAPI {
|
|
|
4613
4748
|
throw new Error(`Failed to call games API: ${method}. ${e.message}`);
|
|
4614
4749
|
}
|
|
4615
4750
|
}
|
|
4616
|
-
async gpGetActiveRounds(
|
|
4617
|
-
|
|
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
|
+
});
|
|
4618
4759
|
}
|
|
4619
|
-
async gpGetActiveRound(
|
|
4620
|
-
const
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
}
|
|
4624
|
-
return this.sendGamesApi(
|
|
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
|
+
});
|
|
4625
4769
|
}
|
|
4626
|
-
async gpGetGamesHistory(
|
|
4627
|
-
|
|
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
|
+
});
|
|
4628
4778
|
}
|
|
4629
|
-
async gpGetGameBoard(
|
|
4630
|
-
|
|
4631
|
-
|
|
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
|
|
4632
4787
|
});
|
|
4633
4788
|
}
|
|
4634
|
-
async gpSubmitSelection(
|
|
4789
|
+
async gpSubmitSelection(saw_template_id, round, isQuiz) {
|
|
4635
4790
|
const method = isQuiz ? 'submit-selection-quiz' : 'submit-selection';
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
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
|
+
});
|
|
4639
4800
|
}
|
|
4640
|
-
async gpGetUserInfo(
|
|
4641
|
-
|
|
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
|
+
});
|
|
4642
4809
|
}
|
|
4643
|
-
async gpGetGameInfo(
|
|
4644
|
-
|
|
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
|
+
});
|
|
4645
4818
|
}
|
|
4646
|
-
async gpGetTranslations(
|
|
4647
|
-
|
|
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
|
+
});
|
|
4648
4827
|
}
|
|
4649
|
-
async gpGetRoundInfoForUser(
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
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
|
|
4653
4837
|
});
|
|
4654
4838
|
}
|
|
4655
4839
|
getWSCalls() {
|
|
@@ -5273,5 +5457,5 @@ var GameRoundOrderType;
|
|
|
5273
5457
|
})(GameRoundOrderType || (GameRoundOrderType = {}));
|
|
5274
5458
|
const AllRoundsGameBoardID = -1;
|
|
5275
5459
|
|
|
5276
|
-
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, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
|
|
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 };
|
|
5277
5461
|
//# sourceMappingURL=index.modern.mjs.map
|