@smartico/public-api 0.0.350 → 0.0.352
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 +265 -0
- package/dist/GamePick/index.d.ts +1 -0
- package/dist/Raffle/Raffle.d.ts +13 -0
- package/dist/SmarticoAPI.d.ts +15 -0
- package/dist/Tournaments/Tournament.d.ts +2 -0
- package/dist/WSAPI/WSAPI.d.ts +211 -0
- package/dist/WSAPI/WSAPITypes.d.ts +10 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +713 -96
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +470 -4
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/enums/RaffleTicketCapVisualization.md +21 -0
- package/docs/api/interfaces/RafflePublicMeta.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 +1 -1
- package/src/ActivityLog/GetActivityLogResponse.ts +2 -0
- package/src/GamePick/GPTypes.ts +273 -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 +110 -1
- package/src/Tournaments/Tournament.ts +5 -2
- package/src/WSAPI/WSAPI.ts +276 -0
- package/src/WSAPI/WSAPITypes.ts +10 -2
- package/src/index.ts +2 -1
package/dist/index.modern.mjs
CHANGED
|
@@ -1829,7 +1829,8 @@ const TournamentItemsTransform = items => {
|
|
|
1829
1829
|
is_in_progress: TournamentUtils.isInProgress(r),
|
|
1830
1830
|
is_upcoming: TournamentUtils.isUpcoming(r),
|
|
1831
1831
|
min_scores_win: r.minScoreToWin,
|
|
1832
|
-
hide_leaderboard_min_scores: r.hideLeaderboardsMinScores
|
|
1832
|
+
hide_leaderboard_min_scores: r.hideLeaderboardsMinScores,
|
|
1833
|
+
total_scores: r.totalScores
|
|
1833
1834
|
});
|
|
1834
1835
|
if (r.prizeStructure) {
|
|
1835
1836
|
x.prizes = r.prizeStructure.prizes.map(p => TournamentUtils.getPrizeTransformed(p));
|
|
@@ -2056,7 +2057,8 @@ const raffleTransform = items => {
|
|
|
2056
2057
|
end_date: item.end_date_ts,
|
|
2057
2058
|
max_tickets_count: item.max_tickets_count,
|
|
2058
2059
|
current_tickets_count: item.current_tickets_count,
|
|
2059
|
-
draws: drawTransform(item.draws)
|
|
2060
|
+
draws: drawTransform(item.draws),
|
|
2061
|
+
ticket_cap_visualization: item.public_meta.ticket_cap_visualization
|
|
2060
2062
|
};
|
|
2061
2063
|
});
|
|
2062
2064
|
};
|
|
@@ -2095,6 +2097,16 @@ const drawRunTransform = res => {
|
|
|
2095
2097
|
};
|
|
2096
2098
|
};
|
|
2097
2099
|
|
|
2100
|
+
var RaffleTicketCapVisualization;
|
|
2101
|
+
(function (RaffleTicketCapVisualization) {
|
|
2102
|
+
/** Show nothing */
|
|
2103
|
+
RaffleTicketCapVisualization[RaffleTicketCapVisualization["Empty"] = 0] = "Empty";
|
|
2104
|
+
/** Show ticket counter */
|
|
2105
|
+
RaffleTicketCapVisualization[RaffleTicketCapVisualization["Counter"] = 1] = "Counter";
|
|
2106
|
+
/** Show message when ticket cap is reached */
|
|
2107
|
+
RaffleTicketCapVisualization[RaffleTicketCapVisualization["Message"] = 2] = "Message";
|
|
2108
|
+
})(RaffleTicketCapVisualization || (RaffleTicketCapVisualization = {}));
|
|
2109
|
+
|
|
2098
2110
|
var RaffleDrawInstanceState;
|
|
2099
2111
|
(function (RaffleDrawInstanceState) {
|
|
2100
2112
|
/** Draw is open for the tickets collection */
|
|
@@ -3001,6 +3013,264 @@ class WSAPI {
|
|
|
3001
3013
|
}
|
|
3002
3014
|
return await OCache.use(onUpdateContextKey.ActivityLog, ECacheContext.WSAPI, () => this.api.getActivityLogT(null, startTimeSeconds, endTimeSeconds, from, to), CACHE_DATA_SEC);
|
|
3003
3015
|
}
|
|
3016
|
+
/**
|
|
3017
|
+
* Returns the active rounds for the specified MatchX or Quiz game (identified by saw_template_id).
|
|
3018
|
+
* Each round contains events (matches/questions) with user selections.
|
|
3019
|
+
*
|
|
3020
|
+
* **Example**:
|
|
3021
|
+
* ```
|
|
3022
|
+
* _smartico.api.getGamePickActiveRounds({
|
|
3023
|
+
* saw_template_id: 123,
|
|
3024
|
+
* ext_user_id: '149598632',
|
|
3025
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3026
|
+
* lang: 'EN'
|
|
3027
|
+
* }).then((result) => {
|
|
3028
|
+
* console.log(result);
|
|
3029
|
+
* });
|
|
3030
|
+
* ```
|
|
3031
|
+
*
|
|
3032
|
+
* **Visitor mode: not supported**
|
|
3033
|
+
*/
|
|
3034
|
+
async getGamePickActiveRounds(props) {
|
|
3035
|
+
if (!props.saw_template_id) {
|
|
3036
|
+
throw new Error('saw_template_id is required');
|
|
3037
|
+
}
|
|
3038
|
+
return this.api.gpGetActiveRounds(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
|
|
3039
|
+
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Returns a single active round (the "home" round or a specific round by ID) for the specified MatchX or Quiz game.
|
|
3042
|
+
* If round_id is not provided, returns the most relevant active round.
|
|
3043
|
+
*
|
|
3044
|
+
* **Example**:
|
|
3045
|
+
* ```
|
|
3046
|
+
* _smartico.api.getGamePickActiveRound({
|
|
3047
|
+
* saw_template_id: 123,
|
|
3048
|
+
* ext_user_id: '149598632',
|
|
3049
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3050
|
+
* }).then((result) => {
|
|
3051
|
+
* console.log(result);
|
|
3052
|
+
* });
|
|
3053
|
+
* ```
|
|
3054
|
+
*
|
|
3055
|
+
* **Visitor mode: not supported**
|
|
3056
|
+
*/
|
|
3057
|
+
async getGamePickActiveRound(props) {
|
|
3058
|
+
if (!props.saw_template_id) {
|
|
3059
|
+
throw new Error('saw_template_id is required');
|
|
3060
|
+
}
|
|
3061
|
+
return this.api.gpGetActiveRound(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang, props.round_id);
|
|
3062
|
+
}
|
|
3063
|
+
/**
|
|
3064
|
+
* Returns the history of all rounds (including resolved) for the specified MatchX or Quiz game.
|
|
3065
|
+
*
|
|
3066
|
+
* **Example**:
|
|
3067
|
+
* ```
|
|
3068
|
+
* _smartico.api.getGamePickHistory({
|
|
3069
|
+
* saw_template_id: 123,
|
|
3070
|
+
* ext_user_id: '149598632',
|
|
3071
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3072
|
+
* }).then((result) => {
|
|
3073
|
+
* console.log(result);
|
|
3074
|
+
* });
|
|
3075
|
+
* ```
|
|
3076
|
+
*
|
|
3077
|
+
* **Visitor mode: not supported**
|
|
3078
|
+
*/
|
|
3079
|
+
async getGamePickHistory(props) {
|
|
3080
|
+
if (!props.saw_template_id) {
|
|
3081
|
+
throw new Error('saw_template_id is required');
|
|
3082
|
+
}
|
|
3083
|
+
return this.api.gpGetGamesHistory(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
|
|
3084
|
+
}
|
|
3085
|
+
/**
|
|
3086
|
+
* Returns the leaderboard for a specific round within a MatchX or Quiz game.
|
|
3087
|
+
* Use round_id = -1 (AllRoundsGameBoardID) for the season/overall leaderboard.
|
|
3088
|
+
*
|
|
3089
|
+
* **Example**:
|
|
3090
|
+
* ```
|
|
3091
|
+
* _smartico.api.getGamePickBoard({
|
|
3092
|
+
* saw_template_id: 123,
|
|
3093
|
+
* ext_user_id: '149598632',
|
|
3094
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3095
|
+
* round_id: 456
|
|
3096
|
+
* }).then((result) => {
|
|
3097
|
+
* console.log(result.data.users, result.data.my_user);
|
|
3098
|
+
* });
|
|
3099
|
+
* ```
|
|
3100
|
+
*
|
|
3101
|
+
* **Visitor mode: not supported**
|
|
3102
|
+
*/
|
|
3103
|
+
async getGamePickBoard(props) {
|
|
3104
|
+
if (!props.saw_template_id) {
|
|
3105
|
+
throw new Error('saw_template_id is required');
|
|
3106
|
+
}
|
|
3107
|
+
if (props.round_id === undefined || props.round_id === null) {
|
|
3108
|
+
throw new Error('round_id is required');
|
|
3109
|
+
}
|
|
3110
|
+
return this.api.gpGetGameBoard(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round_id, props.lang);
|
|
3111
|
+
}
|
|
3112
|
+
/**
|
|
3113
|
+
* Submits picks for a round in a MatchX game.
|
|
3114
|
+
* Sends the entire round with user selections for all events at once.
|
|
3115
|
+
* Each event should have team1_user_selection and team2_user_selection (predicted scores).
|
|
3116
|
+
*
|
|
3117
|
+
* **Example**:
|
|
3118
|
+
* ```
|
|
3119
|
+
* _smartico.api.submitGamePickSelection({
|
|
3120
|
+
* saw_template_id: 123,
|
|
3121
|
+
* ext_user_id: '149598632',
|
|
3122
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3123
|
+
* round: {
|
|
3124
|
+
* round_id: 456,
|
|
3125
|
+
* events: [
|
|
3126
|
+
* { gp_event_id: 789, team1_user_selection: 2, team2_user_selection: 1 },
|
|
3127
|
+
* { gp_event_id: 790, team1_user_selection: 0, team2_user_selection: 3 }
|
|
3128
|
+
* ]
|
|
3129
|
+
* }
|
|
3130
|
+
* }).then((result) => {
|
|
3131
|
+
* console.log(result);
|
|
3132
|
+
* });
|
|
3133
|
+
* ```
|
|
3134
|
+
*
|
|
3135
|
+
* **Visitor mode: not supported**
|
|
3136
|
+
*/
|
|
3137
|
+
async submitGamePickSelection(props) {
|
|
3138
|
+
if (!props.saw_template_id) {
|
|
3139
|
+
throw new Error('saw_template_id is required');
|
|
3140
|
+
}
|
|
3141
|
+
return this.api.gpSubmitSelection(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round, false, props.lang);
|
|
3142
|
+
}
|
|
3143
|
+
/**
|
|
3144
|
+
* Submits answers for a round in a Quiz game.
|
|
3145
|
+
* Sends the entire round with user answers for all events at once.
|
|
3146
|
+
* Each event should have user_selection (answer value from QuizAnswersValueType).
|
|
3147
|
+
*
|
|
3148
|
+
* **Example**:
|
|
3149
|
+
* ```
|
|
3150
|
+
* _smartico.api.submitGamePickSelectionQuiz({
|
|
3151
|
+
* saw_template_id: 123,
|
|
3152
|
+
* ext_user_id: '149598632',
|
|
3153
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3154
|
+
* round: {
|
|
3155
|
+
* round_id: 456,
|
|
3156
|
+
* events: [
|
|
3157
|
+
* { gp_event_id: 789, user_selection: '1' },
|
|
3158
|
+
* { gp_event_id: 790, user_selection: 'x' }
|
|
3159
|
+
* ]
|
|
3160
|
+
* }
|
|
3161
|
+
* }).then((result) => {
|
|
3162
|
+
* console.log(result);
|
|
3163
|
+
* });
|
|
3164
|
+
* ```
|
|
3165
|
+
*
|
|
3166
|
+
* **Visitor mode: not supported**
|
|
3167
|
+
*/
|
|
3168
|
+
async submitGamePickSelectionQuiz(props) {
|
|
3169
|
+
if (!props.saw_template_id) {
|
|
3170
|
+
throw new Error('saw_template_id is required');
|
|
3171
|
+
}
|
|
3172
|
+
return this.api.gpSubmitSelection(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round, true, props.lang);
|
|
3173
|
+
}
|
|
3174
|
+
/**
|
|
3175
|
+
* Returns the current user's profile information within the specified MatchX or Quiz game.
|
|
3176
|
+
* Includes username, avatar, position, scores, and balances.
|
|
3177
|
+
*
|
|
3178
|
+
* **Example**:
|
|
3179
|
+
* ```
|
|
3180
|
+
* _smartico.api.getGamePickUserInfo({
|
|
3181
|
+
* saw_template_id: 123,
|
|
3182
|
+
* ext_user_id: '149598632',
|
|
3183
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3184
|
+
* }).then((result) => {
|
|
3185
|
+
* console.log(result.data.public_username, result.data.gp_position);
|
|
3186
|
+
* });
|
|
3187
|
+
* ```
|
|
3188
|
+
*
|
|
3189
|
+
* **Visitor mode: not supported**
|
|
3190
|
+
*/
|
|
3191
|
+
async getGamePickUserInfo(props) {
|
|
3192
|
+
if (!props.saw_template_id) {
|
|
3193
|
+
throw new Error('saw_template_id is required');
|
|
3194
|
+
}
|
|
3195
|
+
return this.api.gpGetUserInfo(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
|
|
3196
|
+
}
|
|
3197
|
+
/**
|
|
3198
|
+
* Returns the game configuration (template, label info) and the list of all rounds for the specified MatchX or Quiz game.
|
|
3199
|
+
*
|
|
3200
|
+
* **Example**:
|
|
3201
|
+
* ```
|
|
3202
|
+
* _smartico.api.getGamePickGameInfo({
|
|
3203
|
+
* saw_template_id: 123,
|
|
3204
|
+
* ext_user_id: '149598632',
|
|
3205
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3206
|
+
* }).then((result) => {
|
|
3207
|
+
* console.log(result.data.sawTemplate, result.data.allRounds);
|
|
3208
|
+
* });
|
|
3209
|
+
* ```
|
|
3210
|
+
*
|
|
3211
|
+
* **Visitor mode: not supported**
|
|
3212
|
+
*/
|
|
3213
|
+
async getGamePickGameInfo(props) {
|
|
3214
|
+
if (!props.saw_template_id) {
|
|
3215
|
+
throw new Error('saw_template_id is required');
|
|
3216
|
+
}
|
|
3217
|
+
return this.api.gpGetGameInfo(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Returns translations for the MatchX/Quiz game UI.
|
|
3221
|
+
* Translations are returned as a key-value map based on the user's language.
|
|
3222
|
+
*
|
|
3223
|
+
* **Example**:
|
|
3224
|
+
* ```
|
|
3225
|
+
* _smartico.api.getGamePickTranslations({
|
|
3226
|
+
* saw_template_id: 123,
|
|
3227
|
+
* ext_user_id: '149598632',
|
|
3228
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3229
|
+
* lang: 'EN'
|
|
3230
|
+
* }).then((result) => {
|
|
3231
|
+
* console.log(result.data);
|
|
3232
|
+
* });
|
|
3233
|
+
* ```
|
|
3234
|
+
*
|
|
3235
|
+
* **Visitor mode: not supported**
|
|
3236
|
+
*/
|
|
3237
|
+
async getGamePickTranslations(props) {
|
|
3238
|
+
if (!props.saw_template_id) {
|
|
3239
|
+
throw new Error('saw_template_id is required');
|
|
3240
|
+
}
|
|
3241
|
+
return this.api.gpGetTranslations(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.lang);
|
|
3242
|
+
}
|
|
3243
|
+
/**
|
|
3244
|
+
* Returns round data with events and picks for a specific user (identified by their internal user ID).
|
|
3245
|
+
* Useful for showing another user's predictions from the leaderboard.
|
|
3246
|
+
*
|
|
3247
|
+
* **Example**:
|
|
3248
|
+
* ```
|
|
3249
|
+
* _smartico.api.getGamePickRoundInfoForUser({
|
|
3250
|
+
* saw_template_id: 123,
|
|
3251
|
+
* ext_user_id: '149598632',
|
|
3252
|
+
* smartico_ext_user_id: 'user@example.com',
|
|
3253
|
+
* round_id: 456,
|
|
3254
|
+
* int_user_id: 789
|
|
3255
|
+
* }).then((result) => {
|
|
3256
|
+
* console.log(result.data.events);
|
|
3257
|
+
* });
|
|
3258
|
+
* ```
|
|
3259
|
+
*
|
|
3260
|
+
* **Visitor mode: not supported**
|
|
3261
|
+
*/
|
|
3262
|
+
async getGamePickRoundInfoForUser(props) {
|
|
3263
|
+
if (!props.saw_template_id) {
|
|
3264
|
+
throw new Error('saw_template_id is required');
|
|
3265
|
+
}
|
|
3266
|
+
if (!props.round_id) {
|
|
3267
|
+
throw new Error('round_id is required');
|
|
3268
|
+
}
|
|
3269
|
+
if (!props.int_user_id) {
|
|
3270
|
+
throw new Error('int_user_id is required');
|
|
3271
|
+
}
|
|
3272
|
+
return this.api.gpGetRoundInfoForUser(props.ext_user_id, props.smartico_ext_user_id, props.saw_template_id, props.round_id, props.int_user_id, props.lang);
|
|
3273
|
+
}
|
|
3004
3274
|
async updateOnSpin(data) {
|
|
3005
3275
|
const templates = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
3006
3276
|
const index = templates.findIndex(t => t.id === data.saw_template_id);
|
|
@@ -3488,12 +3758,14 @@ const ActivityLogTransform = items => {
|
|
|
3488
3758
|
return [];
|
|
3489
3759
|
}
|
|
3490
3760
|
return items.map(item => {
|
|
3761
|
+
var _item$type;
|
|
3491
3762
|
const itemTransformed = {
|
|
3492
3763
|
create_date: item.create_date,
|
|
3493
3764
|
user_ext_id: item.user_ext_id,
|
|
3494
3765
|
crm_brand_id: item.crm_brand_id,
|
|
3495
3766
|
source_type_id: item.source_type_id
|
|
3496
3767
|
};
|
|
3768
|
+
item.type = (_item$type = item.type) != null ? _item$type : UserBalanceType.Points;
|
|
3497
3769
|
if (item.type === UserBalanceType.Diamonds || item.type === UserBalanceType.Gems) {
|
|
3498
3770
|
itemTransformed.type = item.type;
|
|
3499
3771
|
itemTransformed.amount = item.amount;
|
|
@@ -3569,6 +3841,7 @@ const GetJackpotEligibleGamesResponseTransform = ({
|
|
|
3569
3841
|
|
|
3570
3842
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
3571
3843
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
3844
|
+
const GAMES_API_URL = 'https://r-games-api{ENV_ID}.smr.vc';
|
|
3572
3845
|
const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
|
|
3573
3846
|
const DEFAULT_LANG_EN = 'EN';
|
|
3574
3847
|
class SmarticoAPI {
|
|
@@ -3581,7 +3854,9 @@ class SmarticoAPI {
|
|
|
3581
3854
|
this.wsUrl = void 0;
|
|
3582
3855
|
this.inboxCdnUrl = void 0;
|
|
3583
3856
|
this.partnerUrl = void 0;
|
|
3857
|
+
this.gamesApiUrl = void 0;
|
|
3584
3858
|
this.avatarDomain = void 0;
|
|
3859
|
+
this.envId = void 0;
|
|
3585
3860
|
this.logger = void 0;
|
|
3586
3861
|
this.logCIDs = void 0;
|
|
3587
3862
|
this.logHTTPTiming = void 0;
|
|
@@ -3598,6 +3873,7 @@ class SmarticoAPI {
|
|
|
3598
3873
|
this.tracker = options.tracker;
|
|
3599
3874
|
this.publicUrl = SmarticoAPI.getPublicUrl(label_api_key);
|
|
3600
3875
|
this.wsUrl = SmarticoAPI.getPublicWsUrl(label_api_key);
|
|
3876
|
+
this.gamesApiUrl = SmarticoAPI.getGamesApiUrl(label_api_key);
|
|
3601
3877
|
this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || ((_options$tracker = options.tracker) == null ? void 0 : _options$tracker.label_api_key));
|
|
3602
3878
|
this.label_api_key = SmarticoAPI.getCleanLabelApiKey(label_api_key);
|
|
3603
3879
|
}
|
|
@@ -3651,8 +3927,10 @@ class SmarticoAPI {
|
|
|
3651
3927
|
static getPublicWsUrl(label_api_key) {
|
|
3652
3928
|
return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3653
3929
|
}
|
|
3930
|
+
static getGamesApiUrl(label_api_key) {
|
|
3931
|
+
return GAMES_API_URL.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3932
|
+
}
|
|
3654
3933
|
static getAvatarUrl(label_api_key) {
|
|
3655
|
-
SmarticoAPI.getEnvDnsSuffix(label_api_key);
|
|
3656
3934
|
const avatarUrl = AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
3657
3935
|
return SmarticoAPI.replaceSmrDomainsWithCloudfront(avatarUrl);
|
|
3658
3936
|
}
|
|
@@ -4285,6 +4563,95 @@ class SmarticoAPI {
|
|
|
4285
4563
|
});
|
|
4286
4564
|
return await this.send(message, ClassId.MARK_INBOX_DELETED_RESPONSE);
|
|
4287
4565
|
}
|
|
4566
|
+
buildGamesApiParams(ext_user_id, smartico_ext_user_id, ext_game_id, lang) {
|
|
4567
|
+
const params = {
|
|
4568
|
+
ext_user_id,
|
|
4569
|
+
smartico_ext_user_id,
|
|
4570
|
+
ext_game_id: String(ext_game_id),
|
|
4571
|
+
lang,
|
|
4572
|
+
env_id: String(SmarticoAPI.getEnvId(this.label_api_key)),
|
|
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
|
+
}
|
|
4579
|
+
return params;
|
|
4580
|
+
}
|
|
4581
|
+
async sendGamesApi(method, ext_user_id, smartico_ext_user_id, ext_game_id, lang, extraParams, usePost = false) {
|
|
4582
|
+
const baseParams = this.buildGamesApiParams(ext_user_id, smartico_ext_user_id, ext_game_id, lang);
|
|
4583
|
+
const queryString = Object.entries(baseParams).map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join('&');
|
|
4584
|
+
let url = `${this.gamesApiUrl}/${method}?${queryString}`;
|
|
4585
|
+
let fetchOptions = {
|
|
4586
|
+
method: 'GET',
|
|
4587
|
+
headers: {
|
|
4588
|
+
'Accept': 'application/json'
|
|
4589
|
+
}
|
|
4590
|
+
};
|
|
4591
|
+
if (usePost && extraParams) {
|
|
4592
|
+
fetchOptions = {
|
|
4593
|
+
method: 'POST',
|
|
4594
|
+
headers: {
|
|
4595
|
+
'Accept': 'application/json',
|
|
4596
|
+
'Content-Type': 'application/json'
|
|
4597
|
+
},
|
|
4598
|
+
body: JSON.stringify(extraParams)
|
|
4599
|
+
};
|
|
4600
|
+
} else if (extraParams) {
|
|
4601
|
+
const extraQuery = Object.entries(extraParams).map(([k, v]) => `${k}=${encodeURIComponent(JSON.stringify(v))}`).join('&');
|
|
4602
|
+
url += `&${extraQuery}`;
|
|
4603
|
+
}
|
|
4604
|
+
try {
|
|
4605
|
+
const response = await fetch(url, fetchOptions);
|
|
4606
|
+
const data = await response.json();
|
|
4607
|
+
return SmarticoAPI.replaceSmrDomainsWithCloudfront(data);
|
|
4608
|
+
} catch (e) {
|
|
4609
|
+
this.logger.error(`Failed to call games API: ${method}`, {
|
|
4610
|
+
url,
|
|
4611
|
+
error: e.message
|
|
4612
|
+
});
|
|
4613
|
+
throw new Error(`Failed to call games API: ${method}. ${e.message}`);
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
async gpGetActiveRounds(ext_user_id, smartico_ext_user_id, saw_template_id, lang = DEFAULT_LANG_EN) {
|
|
4617
|
+
return this.sendGamesApi('active-rounds', ext_user_id, smartico_ext_user_id, saw_template_id, lang);
|
|
4618
|
+
}
|
|
4619
|
+
async gpGetActiveRound(ext_user_id, smartico_ext_user_id, saw_template_id, lang = DEFAULT_LANG_EN, round_id) {
|
|
4620
|
+
const extraParams = {};
|
|
4621
|
+
if (round_id !== undefined) {
|
|
4622
|
+
extraParams.round_id = round_id;
|
|
4623
|
+
}
|
|
4624
|
+
return this.sendGamesApi('active-round', ext_user_id, smartico_ext_user_id, saw_template_id, lang, Object.keys(extraParams).length > 0 ? extraParams : undefined);
|
|
4625
|
+
}
|
|
4626
|
+
async gpGetGamesHistory(ext_user_id, smartico_ext_user_id, saw_template_id, lang = DEFAULT_LANG_EN) {
|
|
4627
|
+
return this.sendGamesApi('games-history', ext_user_id, smartico_ext_user_id, saw_template_id, lang);
|
|
4628
|
+
}
|
|
4629
|
+
async gpGetGameBoard(ext_user_id, smartico_ext_user_id, saw_template_id, round_id, lang = DEFAULT_LANG_EN) {
|
|
4630
|
+
return this.sendGamesApi('game-board', ext_user_id, smartico_ext_user_id, saw_template_id, lang, {
|
|
4631
|
+
round_id
|
|
4632
|
+
});
|
|
4633
|
+
}
|
|
4634
|
+
async gpSubmitSelection(ext_user_id, smartico_ext_user_id, saw_template_id, round, isQuiz, lang = DEFAULT_LANG_EN) {
|
|
4635
|
+
const method = isQuiz ? 'submit-selection-quiz' : 'submit-selection';
|
|
4636
|
+
return this.sendGamesApi(method, ext_user_id, smartico_ext_user_id, saw_template_id, lang, {
|
|
4637
|
+
round
|
|
4638
|
+
}, true);
|
|
4639
|
+
}
|
|
4640
|
+
async gpGetUserInfo(ext_user_id, smartico_ext_user_id, saw_template_id, lang = DEFAULT_LANG_EN) {
|
|
4641
|
+
return this.sendGamesApi('user-info', ext_user_id, smartico_ext_user_id, saw_template_id, lang);
|
|
4642
|
+
}
|
|
4643
|
+
async gpGetGameInfo(ext_user_id, smartico_ext_user_id, saw_template_id, lang = DEFAULT_LANG_EN) {
|
|
4644
|
+
return this.sendGamesApi('game-info', ext_user_id, smartico_ext_user_id, saw_template_id, lang);
|
|
4645
|
+
}
|
|
4646
|
+
async gpGetTranslations(ext_user_id, smartico_ext_user_id, saw_template_id, lang = DEFAULT_LANG_EN) {
|
|
4647
|
+
return this.sendGamesApi('translations', ext_user_id, smartico_ext_user_id, saw_template_id, lang);
|
|
4648
|
+
}
|
|
4649
|
+
async gpGetRoundInfoForUser(ext_user_id, smartico_ext_user_id, saw_template_id, round_id, int_user_id, lang = DEFAULT_LANG_EN) {
|
|
4650
|
+
return this.sendGamesApi('game-round-info-for-user', ext_user_id, smartico_ext_user_id, saw_template_id, lang, {
|
|
4651
|
+
round_id,
|
|
4652
|
+
int_user_id
|
|
4653
|
+
});
|
|
4654
|
+
}
|
|
4288
4655
|
getWSCalls() {
|
|
4289
4656
|
return new WSAPI(this);
|
|
4290
4657
|
}
|
|
@@ -4807,5 +5174,104 @@ var JackpotType;
|
|
|
4807
5174
|
JackpotType[JackpotType["Personal"] = 2] = "Personal";
|
|
4808
5175
|
})(JackpotType || (JackpotType = {}));
|
|
4809
5176
|
|
|
4810
|
-
|
|
5177
|
+
var GamePickMarketType;
|
|
5178
|
+
(function (GamePickMarketType) {
|
|
5179
|
+
GamePickMarketType[GamePickMarketType["Goals"] = 1] = "Goals";
|
|
5180
|
+
GamePickMarketType[GamePickMarketType["Winner"] = 2] = "Winner";
|
|
5181
|
+
})(GamePickMarketType || (GamePickMarketType = {}));
|
|
5182
|
+
var GamePickResolutionType;
|
|
5183
|
+
(function (GamePickResolutionType) {
|
|
5184
|
+
GamePickResolutionType[GamePickResolutionType["None"] = 0] = "None";
|
|
5185
|
+
GamePickResolutionType[GamePickResolutionType["Lost"] = 2] = "Lost";
|
|
5186
|
+
GamePickResolutionType[GamePickResolutionType["PartialWin"] = 3] = "PartialWin";
|
|
5187
|
+
GamePickResolutionType[GamePickResolutionType["FullWin"] = 4] = "FullWin";
|
|
5188
|
+
})(GamePickResolutionType || (GamePickResolutionType = {}));
|
|
5189
|
+
var GPRoundStatus;
|
|
5190
|
+
(function (GPRoundStatus) {
|
|
5191
|
+
GPRoundStatus[GPRoundStatus["Other"] = -1] = "Other";
|
|
5192
|
+
GPRoundStatus[GPRoundStatus["NoEventsDefined"] = 1] = "NoEventsDefined";
|
|
5193
|
+
GPRoundStatus[GPRoundStatus["NoMoreBetsAllowed"] = 2] = "NoMoreBetsAllowed";
|
|
5194
|
+
GPRoundStatus[GPRoundStatus["AllEventsResolved_ButNotRound"] = 3] = "AllEventsResolved_ButNotRound";
|
|
5195
|
+
GPRoundStatus[GPRoundStatus["RoundResolved"] = 4] = "RoundResolved";
|
|
5196
|
+
})(GPRoundStatus || (GPRoundStatus = {}));
|
|
5197
|
+
var GamePickScoreType;
|
|
5198
|
+
(function (GamePickScoreType) {
|
|
5199
|
+
GamePickScoreType[GamePickScoreType["ExactScore"] = 1] = "ExactScore";
|
|
5200
|
+
GamePickScoreType[GamePickScoreType["PointsDifference"] = 2] = "PointsDifference";
|
|
5201
|
+
})(GamePickScoreType || (GamePickScoreType = {}));
|
|
5202
|
+
var GamePickSportType;
|
|
5203
|
+
(function (GamePickSportType) {
|
|
5204
|
+
GamePickSportType[GamePickSportType["Golf"] = 9] = "Golf";
|
|
5205
|
+
GamePickSportType[GamePickSportType["Cycling"] = 17] = "Cycling";
|
|
5206
|
+
GamePickSportType[GamePickSportType["Specials"] = 18] = "Specials";
|
|
5207
|
+
GamePickSportType[GamePickSportType["TouringCarRacing"] = 188] = "TouringCarRacing";
|
|
5208
|
+
GamePickSportType[GamePickSportType["StockCarRacing"] = 191] = "StockCarRacing";
|
|
5209
|
+
GamePickSportType[GamePickSportType["IndyRacing"] = 129] = "IndyRacing";
|
|
5210
|
+
GamePickSportType[GamePickSportType["Biathlon"] = 44] = "Biathlon";
|
|
5211
|
+
GamePickSportType[GamePickSportType["Speedway"] = 131] = "Speedway";
|
|
5212
|
+
GamePickSportType[GamePickSportType["Motorsport"] = 11] = "Motorsport";
|
|
5213
|
+
GamePickSportType[GamePickSportType["AlpineSkiing"] = 43] = "AlpineSkiing";
|
|
5214
|
+
GamePickSportType[GamePickSportType["SkiJumping"] = 48] = "SkiJumping";
|
|
5215
|
+
GamePickSportType[GamePickSportType["Lacrosse"] = 39] = "Lacrosse";
|
|
5216
|
+
GamePickSportType[GamePickSportType["CrossCountry"] = 46] = "CrossCountry";
|
|
5217
|
+
GamePickSportType[GamePickSportType["NordicCombined"] = 47] = "NordicCombined";
|
|
5218
|
+
GamePickSportType[GamePickSportType["Chess"] = 33] = "Chess";
|
|
5219
|
+
GamePickSportType[GamePickSportType["Athletics"] = 36] = "Athletics";
|
|
5220
|
+
GamePickSportType[GamePickSportType["ESportOverwatch"] = 121] = "ESportOverwatch";
|
|
5221
|
+
GamePickSportType[GamePickSportType["MMA"] = 117] = "MMA";
|
|
5222
|
+
GamePickSportType[GamePickSportType["Futsal"] = 29] = "Futsal";
|
|
5223
|
+
GamePickSportType[GamePickSportType["IceHockey"] = 4] = "IceHockey";
|
|
5224
|
+
GamePickSportType[GamePickSportType["Kabaddi"] = 138] = "Kabaddi";
|
|
5225
|
+
GamePickSportType[GamePickSportType["BeachVolley"] = 34] = "BeachVolley";
|
|
5226
|
+
GamePickSportType[GamePickSportType["Formula1"] = 40] = "Formula1";
|
|
5227
|
+
GamePickSportType[GamePickSportType["ESporteBasketball"] = 153] = "ESporteBasketball";
|
|
5228
|
+
GamePickSportType[GamePickSportType["MotorcycleRacing"] = 190] = "MotorcycleRacing";
|
|
5229
|
+
GamePickSportType[GamePickSportType["Bowls"] = 32] = "Bowls";
|
|
5230
|
+
GamePickSportType[GamePickSportType["Boxing"] = 10] = "Boxing";
|
|
5231
|
+
GamePickSportType[GamePickSportType["Floorball"] = 7] = "Floorball";
|
|
5232
|
+
GamePickSportType[GamePickSportType["GaelicHurling"] = 136] = "GaelicHurling";
|
|
5233
|
+
GamePickSportType[GamePickSportType["Bandy"] = 15] = "Bandy";
|
|
5234
|
+
GamePickSportType[GamePickSportType["Handball"] = 6] = "Handball";
|
|
5235
|
+
GamePickSportType[GamePickSportType["Waterpolo"] = 26] = "Waterpolo";
|
|
5236
|
+
GamePickSportType[GamePickSportType["Rugby"] = 12] = "Rugby";
|
|
5237
|
+
GamePickSportType[GamePickSportType["ESporteSoccer"] = 137] = "ESporteSoccer";
|
|
5238
|
+
GamePickSportType[GamePickSportType["FieldHockey"] = 24] = "FieldHockey";
|
|
5239
|
+
GamePickSportType[GamePickSportType["Pesapallo"] = 61] = "Pesapallo";
|
|
5240
|
+
GamePickSportType[GamePickSportType["Snooker"] = 19] = "Snooker";
|
|
5241
|
+
GamePickSportType[GamePickSportType["Badminton"] = 31] = "Badminton";
|
|
5242
|
+
GamePickSportType[GamePickSportType["Cricket"] = 21] = "Cricket";
|
|
5243
|
+
GamePickSportType[GamePickSportType["BeachSoccer"] = 60] = "BeachSoccer";
|
|
5244
|
+
GamePickSportType[GamePickSportType["Baseball"] = 3] = "Baseball";
|
|
5245
|
+
GamePickSportType[GamePickSportType["StarCraft"] = 112] = "StarCraft";
|
|
5246
|
+
GamePickSportType[GamePickSportType["ESportCounterStrike"] = 109] = "ESportCounterStrike";
|
|
5247
|
+
GamePickSportType[GamePickSportType["ESportArenaofValor"] = 158] = "ESportArenaofValor";
|
|
5248
|
+
GamePickSportType[GamePickSportType["Curling"] = 28] = "Curling";
|
|
5249
|
+
GamePickSportType[GamePickSportType["Squash"] = 37] = "Squash";
|
|
5250
|
+
GamePickSportType[GamePickSportType["Darts"] = 22] = "Darts";
|
|
5251
|
+
GamePickSportType[GamePickSportType["TableTennis"] = 20] = "TableTennis";
|
|
5252
|
+
GamePickSportType[GamePickSportType["Basketball3x3"] = 155] = "Basketball3x3";
|
|
5253
|
+
GamePickSportType[GamePickSportType["AussieRules"] = 13] = "AussieRules";
|
|
5254
|
+
GamePickSportType[GamePickSportType["GaelicFootball"] = 135] = "GaelicFootball";
|
|
5255
|
+
GamePickSportType[GamePickSportType["CallOfDuty"] = 118] = "CallOfDuty";
|
|
5256
|
+
GamePickSportType[GamePickSportType["Soccer"] = 1] = "Soccer";
|
|
5257
|
+
GamePickSportType[GamePickSportType["Tennis"] = 5] = "Tennis";
|
|
5258
|
+
GamePickSportType[GamePickSportType["ESportDota"] = 111] = "ESportDota";
|
|
5259
|
+
GamePickSportType[GamePickSportType["Basketball"] = 2] = "Basketball";
|
|
5260
|
+
GamePickSportType[GamePickSportType["ESportLeagueofLegends"] = 110] = "ESportLeagueofLegends";
|
|
5261
|
+
GamePickSportType[GamePickSportType["AmericanFootball"] = 16] = "AmericanFootball";
|
|
5262
|
+
GamePickSportType[GamePickSportType["Volleyball"] = 23] = "Volleyball";
|
|
5263
|
+
GamePickSportType[GamePickSportType["Netball"] = 35] = "Netball";
|
|
5264
|
+
GamePickSportType[GamePickSportType["ESportRocketLeague"] = 128] = "ESportRocketLeague";
|
|
5265
|
+
GamePickSportType[GamePickSportType["Schwingen"] = 56] = "Schwingen";
|
|
5266
|
+
})(GamePickSportType || (GamePickSportType = {}));
|
|
5267
|
+
var GameRoundOrderType;
|
|
5268
|
+
(function (GameRoundOrderType) {
|
|
5269
|
+
GameRoundOrderType[GameRoundOrderType["HowAdded"] = 1] = "HowAdded";
|
|
5270
|
+
GameRoundOrderType[GameRoundOrderType["HowAddedReversed"] = 2] = "HowAddedReversed";
|
|
5271
|
+
GameRoundOrderType[GameRoundOrderType["EventDateAscending"] = 3] = "EventDateAscending";
|
|
5272
|
+
GameRoundOrderType[GameRoundOrderType["EventDateDescending"] = 4] = "EventDateDescending";
|
|
5273
|
+
})(GameRoundOrderType || (GameRoundOrderType = {}));
|
|
5274
|
+
const AllRoundsGameBoardID = -1;
|
|
5275
|
+
|
|
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 };
|
|
4811
5277
|
//# sourceMappingURL=index.modern.mjs.map
|