@smartico/public-api 0.0.107 → 0.0.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Inbox/GetInboxMessagesResponse.d.ts +2 -0
- package/dist/Inbox/InboxMessage.d.ts +15 -12
- package/dist/Inbox/MarkInboxMessageDeletedResponse.d.ts +1 -0
- package/dist/Inbox/MarkInboxMessageReadResponse.d.ts +1 -0
- package/dist/Inbox/MarkInboxMessageStarredResponse.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +14 -3
- package/dist/WSAPI/WSAPI.d.ts +31 -2
- package/dist/WSAPI/WSAPITypes.d.ts +39 -1
- package/dist/index.js +322 -39
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +190 -16
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/classes/WSAPI.md +144 -27
- package/docs/interfaces/InboxMarkMessageAction.md +17 -0
- package/docs/interfaces/TInboxMessage.md +33 -0
- package/docs/interfaces/TInboxMessageBody.md +52 -0
- package/docs/interfaces/TMissionOrBadge.md +1 -1
- package/docs/interfaces/TTournament.md +1 -1
- package/docs/interfaces/TTournamentDetailed.md +2 -2
- package/package.json +1 -1
- package/src/Inbox/GetInboxMessagesResponse.ts +14 -0
- package/src/Inbox/InboxMessage.ts +35 -9
- package/src/Inbox/MarkInboxMessageDeletedResponse.ts +1 -0
- package/src/Inbox/MarkInboxMessageReadResponse.ts +1 -0
- package/src/Inbox/MarkInboxMessageStarredResponse.ts +1 -0
- package/src/SmarticoAPI.ts +94 -3
- package/src/WSAPI/WSAPI.ts +82 -2
- package/src/WSAPI/WSAPITypes.ts +42 -1
package/dist/index.js
CHANGED
|
@@ -525,6 +525,53 @@ exports.TranslationArea = void 0;
|
|
|
525
525
|
TranslationArea[TranslationArea["AffIliateAdminNew"] = 7] = "AffIliateAdminNew";
|
|
526
526
|
})(exports.TranslationArea || (exports.TranslationArea = {}));
|
|
527
527
|
|
|
528
|
+
var InboxMessagesTransform = function InboxMessagesTransform(items) {
|
|
529
|
+
return items.map(function (item) {
|
|
530
|
+
var x = {
|
|
531
|
+
sent_date: item.createDate,
|
|
532
|
+
message_guid: item.engagement_uid,
|
|
533
|
+
read: item.is_read,
|
|
534
|
+
favorite: item.is_starred
|
|
535
|
+
};
|
|
536
|
+
return x;
|
|
537
|
+
});
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
var InboxMessageBodyTransform = function InboxMessageBodyTransform(item) {
|
|
541
|
+
var x = {
|
|
542
|
+
action: item.action,
|
|
543
|
+
icon: item.image,
|
|
544
|
+
title: item.title,
|
|
545
|
+
preview_body: item.body
|
|
546
|
+
};
|
|
547
|
+
if (item.action === 'dp:inbox') {
|
|
548
|
+
if (item.additional_buttons && item.additional_buttons.length) {
|
|
549
|
+
x.buttons = item.additional_buttons.map(function (b) {
|
|
550
|
+
return {
|
|
551
|
+
action: b.action,
|
|
552
|
+
text: b.inbox_cta_text
|
|
553
|
+
};
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
x.html_body = (item == null ? void 0 : item.html_body) || null;
|
|
557
|
+
}
|
|
558
|
+
return x;
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
exports.InboxMessageType = void 0;
|
|
562
|
+
(function (InboxMessageType) {
|
|
563
|
+
InboxMessageType[InboxMessageType["Custom"] = 0] = "Custom";
|
|
564
|
+
InboxMessageType[InboxMessageType["MissionCompleted"] = 1] = "MissionCompleted";
|
|
565
|
+
InboxMessageType[InboxMessageType["MissionUnlocked"] = 2] = "MissionUnlocked";
|
|
566
|
+
InboxMessageType[InboxMessageType["LeaderboardWon"] = 3] = "LeaderboardWon";
|
|
567
|
+
InboxMessageType[InboxMessageType["LevelChanged"] = 4] = "LevelChanged";
|
|
568
|
+
InboxMessageType[InboxMessageType["BonusGiven"] = 5] = "BonusGiven";
|
|
569
|
+
InboxMessageType[InboxMessageType["PointsAdded"] = 6] = "PointsAdded";
|
|
570
|
+
InboxMessageType[InboxMessageType["PointsUsed"] = 7] = "PointsUsed";
|
|
571
|
+
InboxMessageType[InboxMessageType["PersonalMessage"] = 8] = "PersonalMessage";
|
|
572
|
+
})(exports.InboxMessageType || (exports.InboxMessageType = {}));
|
|
573
|
+
// keep in sync with BO enum
|
|
574
|
+
|
|
528
575
|
exports.BuyStoreItemErrorCode = void 0;
|
|
529
576
|
(function (BuyStoreItemErrorCode) {
|
|
530
577
|
BuyStoreItemErrorCode[BuyStoreItemErrorCode["FAILED_TO_BUY_SHOP_ITEM"] = 121] = "FAILED_TO_BUY_SHOP_ITEM";
|
|
@@ -911,6 +958,7 @@ var onUpdateContextKey;
|
|
|
911
958
|
onUpdateContextKey["Saw"] = "saw";
|
|
912
959
|
onUpdateContextKey["Missions"] = "missions";
|
|
913
960
|
onUpdateContextKey["TournamentList"] = "tournamentList";
|
|
961
|
+
onUpdateContextKey["InboxMessages"] = "inboxMessages";
|
|
914
962
|
})(onUpdateContextKey || (onUpdateContextKey = {}));
|
|
915
963
|
/** @group General API */
|
|
916
964
|
var WSAPI = /*#__PURE__*/function () {
|
|
@@ -938,6 +986,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
938
986
|
on(exports.ClassId.TOURNAMENT_REGISTER_RESPONSE, function () {
|
|
939
987
|
return _this.updateTournamentsOnRegistration();
|
|
940
988
|
});
|
|
989
|
+
on(exports.ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, function () {
|
|
990
|
+
return _this.updateInboxMessages();
|
|
991
|
+
});
|
|
941
992
|
}
|
|
942
993
|
/** Returns information about current user */
|
|
943
994
|
var _proto = WSAPI.prototype;
|
|
@@ -1093,7 +1144,7 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1093
1144
|
} catch (e) {
|
|
1094
1145
|
return Promise.reject(e);
|
|
1095
1146
|
}
|
|
1096
|
-
} /** Returns details information of specific tournament instance, the response will
|
|
1147
|
+
} /** Returns details information of specific tournament instance, the response will include tournament info and the leaderboard of players */;
|
|
1097
1148
|
_proto.getTournamentInstanceInfo = function getTournamentInstanceInfo(tournamentInstanceId) {
|
|
1098
1149
|
try {
|
|
1099
1150
|
var _this12 = this;
|
|
@@ -1115,11 +1166,111 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1115
1166
|
} catch (e) {
|
|
1116
1167
|
return Promise.reject(e);
|
|
1117
1168
|
}
|
|
1169
|
+
}
|
|
1170
|
+
/** Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
|
|
1171
|
+
* The maximum number of messages per request is limited to 20. An indicator "onlyFavorite" can be passed to get only messages marked as favorites.
|
|
1172
|
+
* You can leave this params empty and by default it will return list of messages ranging from 0 to 20.
|
|
1173
|
+
* This functions return list of messages without the body of the message.
|
|
1174
|
+
* To get the body of the message you need to call getInboxMessageBody function and pass the message guid contained in each message of this request.
|
|
1175
|
+
* All other action like mark as read, favorite, delete, etc. can be done using this message GUID.
|
|
1176
|
+
* The "onUpdate" callback will be triggered when the user receives a new message. It will provide an updated list of messages, ranging from 0 to 20, to the onUpdate callback function. */
|
|
1177
|
+
/**
|
|
1178
|
+
* @param params
|
|
1179
|
+
*/
|
|
1180
|
+
;
|
|
1181
|
+
_proto.getInboxMessages = function getInboxMessages(_temp4) {
|
|
1182
|
+
var _ref4 = _temp4 === void 0 ? {} : _temp4,
|
|
1183
|
+
from = _ref4.from,
|
|
1184
|
+
to = _ref4.to,
|
|
1185
|
+
onlyFavorite = _ref4.onlyFavorite,
|
|
1186
|
+
onUpdate = _ref4.onUpdate;
|
|
1187
|
+
try {
|
|
1188
|
+
var _this14 = this;
|
|
1189
|
+
if (onUpdate) {
|
|
1190
|
+
_this14.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
|
|
1191
|
+
}
|
|
1192
|
+
return Promise.resolve(_this14.api.getInboxMessagesT(null, from, to, onlyFavorite));
|
|
1193
|
+
} catch (e) {
|
|
1194
|
+
return Promise.reject(e);
|
|
1195
|
+
}
|
|
1196
|
+
} /** Returns the message body of the specified message guid. */;
|
|
1197
|
+
_proto.getInboxMessageBody = function getInboxMessageBody(messageGuid) {
|
|
1198
|
+
try {
|
|
1199
|
+
var _this15 = this;
|
|
1200
|
+
return Promise.resolve(_this15.api.getInboxMessageBodyT(messageGuid));
|
|
1201
|
+
} catch (e) {
|
|
1202
|
+
return Promise.reject(e);
|
|
1203
|
+
}
|
|
1204
|
+
} /** Requests to mark inbox message with specified guid as read */;
|
|
1205
|
+
_proto.markInboxMessageAsRead = function markInboxMessageAsRead(messageGuid) {
|
|
1206
|
+
try {
|
|
1207
|
+
var _this16 = this;
|
|
1208
|
+
return Promise.resolve(_this16.api.markInboxMessageRead(null, messageGuid)).then(function (r) {
|
|
1209
|
+
return {
|
|
1210
|
+
err_code: r.errCode,
|
|
1211
|
+
err_message: r.errMsg
|
|
1212
|
+
};
|
|
1213
|
+
});
|
|
1214
|
+
} catch (e) {
|
|
1215
|
+
return Promise.reject(e);
|
|
1216
|
+
}
|
|
1217
|
+
} /** Requests to mark all inbox messages as read */;
|
|
1218
|
+
_proto.markAllInboxMessagesAsRead = function markAllInboxMessagesAsRead() {
|
|
1219
|
+
try {
|
|
1220
|
+
var _this17 = this;
|
|
1221
|
+
return Promise.resolve(_this17.api.markAllInboxMessageRead(null)).then(function (r) {
|
|
1222
|
+
return {
|
|
1223
|
+
err_code: r.errCode,
|
|
1224
|
+
err_message: r.errMsg
|
|
1225
|
+
};
|
|
1226
|
+
});
|
|
1227
|
+
} catch (e) {
|
|
1228
|
+
return Promise.reject(e);
|
|
1229
|
+
}
|
|
1230
|
+
} /** Requests to mark inbox message with specified guid as favorite. Pass mark true to add message to favorite and false to remove. */;
|
|
1231
|
+
_proto.markUnmarkInboxMessageAsFavorite = function markUnmarkInboxMessageAsFavorite(messageGuid, mark) {
|
|
1232
|
+
try {
|
|
1233
|
+
var _this18 = this;
|
|
1234
|
+
return Promise.resolve(_this18.api.markUnmarkInboxMessageAsFavorite(null, messageGuid, mark)).then(function (r) {
|
|
1235
|
+
return {
|
|
1236
|
+
err_code: r.errCode,
|
|
1237
|
+
err_message: r.errMsg
|
|
1238
|
+
};
|
|
1239
|
+
});
|
|
1240
|
+
} catch (e) {
|
|
1241
|
+
return Promise.reject(e);
|
|
1242
|
+
}
|
|
1243
|
+
} /** Requests to delete inbox message */;
|
|
1244
|
+
_proto.deleteInboxMessage = function deleteInboxMessage(messageGuid) {
|
|
1245
|
+
try {
|
|
1246
|
+
var _this19 = this;
|
|
1247
|
+
return Promise.resolve(_this19.api.deleteInboxMessage(null, messageGuid)).then(function (r) {
|
|
1248
|
+
return {
|
|
1249
|
+
err_code: r.errCode,
|
|
1250
|
+
err_message: r.errMsg
|
|
1251
|
+
};
|
|
1252
|
+
});
|
|
1253
|
+
} catch (e) {
|
|
1254
|
+
return Promise.reject(e);
|
|
1255
|
+
}
|
|
1256
|
+
} /** Requests to delete all inbox messages */;
|
|
1257
|
+
_proto.deleteAllInboxMessages = function deleteAllInboxMessages() {
|
|
1258
|
+
try {
|
|
1259
|
+
var _this20 = this;
|
|
1260
|
+
return Promise.resolve(_this20.api.deleteAllInboxMessages(null)).then(function (r) {
|
|
1261
|
+
return {
|
|
1262
|
+
err_code: r.errCode,
|
|
1263
|
+
err_message: r.errMsg
|
|
1264
|
+
};
|
|
1265
|
+
});
|
|
1266
|
+
} catch (e) {
|
|
1267
|
+
return Promise.reject(e);
|
|
1268
|
+
}
|
|
1118
1269
|
} /** Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office. */;
|
|
1119
1270
|
_proto.getTranslations = function getTranslations(lang_code) {
|
|
1120
1271
|
try {
|
|
1121
|
-
var
|
|
1122
|
-
return Promise.resolve(
|
|
1272
|
+
var _this21 = this;
|
|
1273
|
+
return Promise.resolve(_this21.api.getTranslationsT(null, lang_code, [])).then(function (r) {
|
|
1123
1274
|
return {
|
|
1124
1275
|
translations: r.translations
|
|
1125
1276
|
};
|
|
@@ -1130,15 +1281,15 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1130
1281
|
};
|
|
1131
1282
|
_proto.updateOnSpin = function updateOnSpin(data) {
|
|
1132
1283
|
try {
|
|
1133
|
-
var
|
|
1284
|
+
var _this22 = this;
|
|
1134
1285
|
return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
|
|
1135
|
-
return
|
|
1286
|
+
return _this22.api.sawGetTemplatesT(null);
|
|
1136
1287
|
}, CACHE_DATA_SEC)).then(function (templates) {
|
|
1137
1288
|
var index = templates.findIndex(function (t) {
|
|
1138
1289
|
return t.id === data.saw_template_id;
|
|
1139
1290
|
});
|
|
1140
1291
|
templates[index].spin_count = data.spin_count;
|
|
1141
|
-
|
|
1292
|
+
_this22.updateEntity(onUpdateContextKey.Saw, templates);
|
|
1142
1293
|
});
|
|
1143
1294
|
} catch (e) {
|
|
1144
1295
|
return Promise.reject(e);
|
|
@@ -1146,9 +1297,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1146
1297
|
};
|
|
1147
1298
|
_proto.updateOnAddSpin = function updateOnAddSpin() {
|
|
1148
1299
|
try {
|
|
1149
|
-
var
|
|
1150
|
-
return Promise.resolve(
|
|
1151
|
-
|
|
1300
|
+
var _this23 = this;
|
|
1301
|
+
return Promise.resolve(_this23.api.sawGetTemplatesT(null)).then(function (payload) {
|
|
1302
|
+
_this23.updateEntity(onUpdateContextKey.Saw, payload);
|
|
1152
1303
|
});
|
|
1153
1304
|
} catch (e) {
|
|
1154
1305
|
return Promise.reject(e);
|
|
@@ -1156,11 +1307,11 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1156
1307
|
};
|
|
1157
1308
|
_proto.updateOnPrizeWin = function updateOnPrizeWin(data) {
|
|
1158
1309
|
try {
|
|
1159
|
-
var
|
|
1160
|
-
var
|
|
1310
|
+
var _this24 = this;
|
|
1311
|
+
var _temp6 = function () {
|
|
1161
1312
|
if (data.errCode === exports.SAWSpinErrorCode.SAW_OK) {
|
|
1162
1313
|
return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
|
|
1163
|
-
return
|
|
1314
|
+
return _this24.api.sawGetTemplatesT(null);
|
|
1164
1315
|
}, CACHE_DATA_SEC)).then(function (templates) {
|
|
1165
1316
|
var _template$prizes$find;
|
|
1166
1317
|
var template = templates.find(function (t) {
|
|
@@ -1171,27 +1322,27 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1171
1322
|
var prizeType = (_template$prizes$find = template.prizes.find(function (p) {
|
|
1172
1323
|
return p.id === data.saw_prize_id;
|
|
1173
1324
|
})) == null ? void 0 : _template$prizes$find.prize_type;
|
|
1174
|
-
var
|
|
1325
|
+
var _temp5 = function () {
|
|
1175
1326
|
if (template.jackpot_add_on_attempt || template.spin_count === 1 || prizeType === exports.MiniGamePrizeTypeName.JACKPOT || prizeType === exports.MiniGamePrizeTypeName.SPIN) {
|
|
1176
|
-
return Promise.resolve(
|
|
1177
|
-
|
|
1327
|
+
return Promise.resolve(_this24.api.sawGetTemplatesT(null)).then(function (updatedTemplates) {
|
|
1328
|
+
_this24.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
1178
1329
|
});
|
|
1179
1330
|
}
|
|
1180
1331
|
}();
|
|
1181
|
-
if (
|
|
1332
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
|
1182
1333
|
});
|
|
1183
1334
|
}
|
|
1184
1335
|
}();
|
|
1185
|
-
return Promise.resolve(
|
|
1336
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
1186
1337
|
} catch (e) {
|
|
1187
1338
|
return Promise.reject(e);
|
|
1188
1339
|
}
|
|
1189
1340
|
};
|
|
1190
1341
|
_proto.updateMissionsOnOptIn = function updateMissionsOnOptIn() {
|
|
1191
1342
|
try {
|
|
1192
|
-
var
|
|
1193
|
-
return Promise.resolve(
|
|
1194
|
-
|
|
1343
|
+
var _this25 = this;
|
|
1344
|
+
return Promise.resolve(_this25.api.missionsGetItemsT(null)).then(function (payload) {
|
|
1345
|
+
_this25.updateEntity(onUpdateContextKey.Missions, payload);
|
|
1195
1346
|
});
|
|
1196
1347
|
} catch (e) {
|
|
1197
1348
|
return Promise.reject(e);
|
|
@@ -1199,9 +1350,19 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1199
1350
|
};
|
|
1200
1351
|
_proto.updateTournamentsOnRegistration = function updateTournamentsOnRegistration() {
|
|
1201
1352
|
try {
|
|
1202
|
-
var
|
|
1203
|
-
return Promise.resolve(
|
|
1204
|
-
|
|
1353
|
+
var _this26 = this;
|
|
1354
|
+
return Promise.resolve(_this26.api.tournamentsGetLobbyT(null)).then(function (payload) {
|
|
1355
|
+
_this26.updateEntity(onUpdateContextKey.TournamentList, payload);
|
|
1356
|
+
});
|
|
1357
|
+
} catch (e) {
|
|
1358
|
+
return Promise.reject(e);
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
_proto.updateInboxMessages = function updateInboxMessages() {
|
|
1362
|
+
try {
|
|
1363
|
+
var _this27 = this;
|
|
1364
|
+
return Promise.resolve(_this27.api.getInboxMessagesT(null)).then(function (payload) {
|
|
1365
|
+
_this27.updateEntity(onUpdateContextKey.InboxMessages, payload);
|
|
1205
1366
|
});
|
|
1206
1367
|
} catch (e) {
|
|
1207
1368
|
return Promise.reject(e);
|
|
@@ -1209,9 +1370,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1209
1370
|
};
|
|
1210
1371
|
_proto.updateEntity = function updateEntity(contextKey, payload) {
|
|
1211
1372
|
try {
|
|
1212
|
-
var
|
|
1373
|
+
var _this28 = this;
|
|
1213
1374
|
OCache.set(contextKey, payload, ECacheContext.WSAPI);
|
|
1214
|
-
var onUpdate =
|
|
1375
|
+
var onUpdate = _this28.onUpdateCallback.get(contextKey);
|
|
1215
1376
|
if (onUpdate) {
|
|
1216
1377
|
onUpdate(payload);
|
|
1217
1378
|
}
|
|
@@ -1249,6 +1410,7 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1249
1410
|
this.messageSender = void 0;
|
|
1250
1411
|
this.publicUrl = void 0;
|
|
1251
1412
|
this.wsUrl = void 0;
|
|
1413
|
+
this.inboxCdnUrl = void 0;
|
|
1252
1414
|
this.partnerUrl = void 0;
|
|
1253
1415
|
this.avatarDomain = void 0;
|
|
1254
1416
|
this.logger = void 0;
|
|
@@ -1832,6 +1994,139 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1832
1994
|
return Promise.reject(e);
|
|
1833
1995
|
}
|
|
1834
1996
|
};
|
|
1997
|
+
_proto.getInboxMessages = function getInboxMessages(user_ext_id, limit, offset, starred_only) {
|
|
1998
|
+
if (limit === void 0) {
|
|
1999
|
+
limit = 20;
|
|
2000
|
+
}
|
|
2001
|
+
if (offset === void 0) {
|
|
2002
|
+
offset = 0;
|
|
2003
|
+
}
|
|
2004
|
+
try {
|
|
2005
|
+
var _this31 = this;
|
|
2006
|
+
var message = _this31.buildMessage(user_ext_id, exports.ClassId.GET_INBOX_MESSAGES_REQUEST, {
|
|
2007
|
+
limit: limit,
|
|
2008
|
+
offset: offset,
|
|
2009
|
+
starred_only: starred_only
|
|
2010
|
+
});
|
|
2011
|
+
return Promise.resolve(_this31.send(message, exports.ClassId.GET_INBOX_MESSAGES_RESPONSE));
|
|
2012
|
+
} catch (e) {
|
|
2013
|
+
return Promise.reject(e);
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
_proto.getInboxMessagesT = function getInboxMessagesT(user_ext_id, from, to, favoriteOnly) {
|
|
2017
|
+
if (from === void 0) {
|
|
2018
|
+
from = 0;
|
|
2019
|
+
}
|
|
2020
|
+
if (to === void 0) {
|
|
2021
|
+
to = 20;
|
|
2022
|
+
}
|
|
2023
|
+
if (favoriteOnly === void 0) {
|
|
2024
|
+
favoriteOnly = false;
|
|
2025
|
+
}
|
|
2026
|
+
try {
|
|
2027
|
+
var _this32 = this;
|
|
2028
|
+
var limit = to - from > 20 ? 20 : to - from;
|
|
2029
|
+
var offset = from;
|
|
2030
|
+
return Promise.resolve(_this32.getInboxMessages(user_ext_id, limit, offset, favoriteOnly)).then(function (_this32$getInboxMessa) {
|
|
2031
|
+
return InboxMessagesTransform(_this32$getInboxMessa.log);
|
|
2032
|
+
});
|
|
2033
|
+
} catch (e) {
|
|
2034
|
+
return Promise.reject(e);
|
|
2035
|
+
}
|
|
2036
|
+
};
|
|
2037
|
+
_proto.getInboxMessageBody = function getInboxMessageBody(messageGuid) {
|
|
2038
|
+
var _this33 = this;
|
|
2039
|
+
var getMessageBody = function getMessageBody(messageGuid) {
|
|
2040
|
+
try {
|
|
2041
|
+
var inboxCdnUrl = _this33.tracker.getLabelSetting(exports.PublicLabelSettings.INBOX_PUBLIC_CDN);
|
|
2042
|
+
return Promise.resolve(_catch(function () {
|
|
2043
|
+
var url = "" + inboxCdnUrl + messageGuid + ".json";
|
|
2044
|
+
return Promise.resolve(fetch(url, {
|
|
2045
|
+
method: 'GET',
|
|
2046
|
+
headers: {
|
|
2047
|
+
'Accept': 'application/json',
|
|
2048
|
+
'Content-Type': 'application/json',
|
|
2049
|
+
'Access-Control-Allow-Origin': '*'
|
|
2050
|
+
}
|
|
2051
|
+
})).then(function (response) {
|
|
2052
|
+
return Promise.resolve(response.json()).then(function (data) {
|
|
2053
|
+
return data || {};
|
|
2054
|
+
});
|
|
2055
|
+
});
|
|
2056
|
+
}, function (error) {
|
|
2057
|
+
_this33.logger.error('Error fetching inbox message body:', error);
|
|
2058
|
+
return null;
|
|
2059
|
+
}));
|
|
2060
|
+
} catch (e) {
|
|
2061
|
+
return Promise.reject(e);
|
|
2062
|
+
}
|
|
2063
|
+
};
|
|
2064
|
+
return Promise.resolve(getMessageBody(messageGuid));
|
|
2065
|
+
};
|
|
2066
|
+
_proto.getInboxMessageBodyT = function getInboxMessageBodyT(messageGuid) {
|
|
2067
|
+
try {
|
|
2068
|
+
var _this34 = this;
|
|
2069
|
+
return Promise.resolve(_this34.getInboxMessageBody(messageGuid)).then(InboxMessageBodyTransform);
|
|
2070
|
+
} catch (e) {
|
|
2071
|
+
return Promise.reject(e);
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
_proto.markInboxMessageRead = function markInboxMessageRead(user_ext_id, messageGuid) {
|
|
2075
|
+
try {
|
|
2076
|
+
var _this35 = this;
|
|
2077
|
+
var message = _this35.buildMessage(user_ext_id, exports.ClassId.MARK_INBOX_READ_REQUEST, {
|
|
2078
|
+
engagement_uid: messageGuid
|
|
2079
|
+
});
|
|
2080
|
+
return Promise.resolve(_this35.send(message, exports.ClassId.MARK_INBOX_READ_RESPONSE));
|
|
2081
|
+
} catch (e) {
|
|
2082
|
+
return Promise.reject(e);
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
_proto.markAllInboxMessageRead = function markAllInboxMessageRead(user_ext_id) {
|
|
2086
|
+
try {
|
|
2087
|
+
var _this36 = this;
|
|
2088
|
+
var message = _this36.buildMessage(user_ext_id, exports.ClassId.MARK_INBOX_READ_REQUEST, {
|
|
2089
|
+
all_read: true
|
|
2090
|
+
});
|
|
2091
|
+
return Promise.resolve(_this36.send(message, exports.ClassId.MARK_INBOX_READ_RESPONSE));
|
|
2092
|
+
} catch (e) {
|
|
2093
|
+
return Promise.reject(e);
|
|
2094
|
+
}
|
|
2095
|
+
};
|
|
2096
|
+
_proto.markUnmarkInboxMessageAsFavorite = function markUnmarkInboxMessageAsFavorite(user_ext_id, messageGuid, mark) {
|
|
2097
|
+
try {
|
|
2098
|
+
var _this37 = this;
|
|
2099
|
+
var message = _this37.buildMessage(user_ext_id, exports.ClassId.MARK_INBOX_STARRED_REQUEST, {
|
|
2100
|
+
engagement_uid: messageGuid,
|
|
2101
|
+
is_starred: mark
|
|
2102
|
+
});
|
|
2103
|
+
return Promise.resolve(_this37.send(message, exports.ClassId.MARK_INBOX_STARRED_RESPONSE));
|
|
2104
|
+
} catch (e) {
|
|
2105
|
+
return Promise.reject(e);
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
_proto.deleteInboxMessage = function deleteInboxMessage(user_ext_id, messageGuid) {
|
|
2109
|
+
try {
|
|
2110
|
+
var _this38 = this;
|
|
2111
|
+
var message = _this38.buildMessage(user_ext_id, exports.ClassId.MARK_INBOX_DELETED_REQUEST, {
|
|
2112
|
+
engagement_uid: messageGuid
|
|
2113
|
+
});
|
|
2114
|
+
return Promise.resolve(_this38.send(message, exports.ClassId.MARK_INBOX_DELETED_RESPONSE));
|
|
2115
|
+
} catch (e) {
|
|
2116
|
+
return Promise.reject(e);
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
_proto.deleteAllInboxMessages = function deleteAllInboxMessages(user_ext_id) {
|
|
2120
|
+
try {
|
|
2121
|
+
var _this39 = this;
|
|
2122
|
+
var message = _this39.buildMessage(user_ext_id, exports.ClassId.MARK_INBOX_DELETED_REQUEST, {
|
|
2123
|
+
all_deleted: true
|
|
2124
|
+
});
|
|
2125
|
+
return Promise.resolve(_this39.send(message, exports.ClassId.MARK_INBOX_DELETED_RESPONSE));
|
|
2126
|
+
} catch (e) {
|
|
2127
|
+
return Promise.reject(e);
|
|
2128
|
+
}
|
|
2129
|
+
};
|
|
1835
2130
|
_proto.getWSCalls = function getWSCalls() {
|
|
1836
2131
|
return new WSAPI(this);
|
|
1837
2132
|
};
|
|
@@ -1853,20 +2148,6 @@ var CookieStore = /*#__PURE__*/function () {
|
|
|
1853
2148
|
}();
|
|
1854
2149
|
CookieStore.cookieStore = new typescriptMap.TSMap();
|
|
1855
2150
|
|
|
1856
|
-
exports.InboxMessageType = void 0;
|
|
1857
|
-
(function (InboxMessageType) {
|
|
1858
|
-
InboxMessageType[InboxMessageType["Custom"] = 0] = "Custom";
|
|
1859
|
-
InboxMessageType[InboxMessageType["MissionCompleted"] = 1] = "MissionCompleted";
|
|
1860
|
-
InboxMessageType[InboxMessageType["MissionUnlocked"] = 2] = "MissionUnlocked";
|
|
1861
|
-
InboxMessageType[InboxMessageType["LeaderboardWon"] = 3] = "LeaderboardWon";
|
|
1862
|
-
InboxMessageType[InboxMessageType["LevelChanged"] = 4] = "LevelChanged";
|
|
1863
|
-
InboxMessageType[InboxMessageType["BonusGiven"] = 5] = "BonusGiven";
|
|
1864
|
-
InboxMessageType[InboxMessageType["PointsAdded"] = 6] = "PointsAdded";
|
|
1865
|
-
InboxMessageType[InboxMessageType["PointsUsed"] = 7] = "PointsUsed";
|
|
1866
|
-
InboxMessageType[InboxMessageType["PersonalMessage"] = 8] = "PersonalMessage";
|
|
1867
|
-
})(exports.InboxMessageType || (exports.InboxMessageType = {}));
|
|
1868
|
-
// keep in sync with BO enum
|
|
1869
|
-
|
|
1870
2151
|
exports.LeaderBoardPeriodType = void 0;
|
|
1871
2152
|
(function (LeaderBoardPeriodType) {
|
|
1872
2153
|
LeaderBoardPeriodType[LeaderBoardPeriodType["DAILY"] = 1] = "DAILY";
|
|
@@ -1877,6 +2158,8 @@ exports.LeaderBoardPeriodType = void 0;
|
|
|
1877
2158
|
exports.CookieStore = CookieStore;
|
|
1878
2159
|
exports.CoreUtils = CoreUtils;
|
|
1879
2160
|
exports.GetLevelMapResponseTransform = GetLevelMapResponseTransform;
|
|
2161
|
+
exports.InboxMessageBodyTransform = InboxMessageBodyTransform;
|
|
2162
|
+
exports.InboxMessagesTransform = InboxMessagesTransform;
|
|
1880
2163
|
exports.MiniGamePrizeTypeNamed = MiniGamePrizeTypeNamed;
|
|
1881
2164
|
exports.SAWBuyInTypeNamed = SAWBuyInTypeNamed;
|
|
1882
2165
|
exports.SAWGameTypeNamed = SAWGameTypeNamed;
|