@smartico/public-api 0.0.106 → 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/Store/BuyStoreItemErrorCode.d.ts +2 -1
- package/dist/Store/StoreItem.d.ts +1 -0
- package/dist/WSAPI/WSAPI.d.ts +31 -2
- package/dist/WSAPI/WSAPITypes.d.ts +41 -1
- package/dist/index.js +325 -40
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +193 -17
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/classes/WSAPI.md +118 -1
- package/docs/enums/BuyStoreItemErrorCode.md +6 -0
- 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/TStoreItem.md +8 -0
- 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/Store/BuyStoreItemErrorCode.ts +2 -1
- package/src/Store/StoreItem.ts +3 -1
- package/src/WSAPI/WSAPI.ts +82 -2
- package/src/WSAPI/WSAPITypes.ts +44 -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";
|
|
@@ -535,6 +582,7 @@ exports.BuyStoreItemErrorCode = void 0;
|
|
|
535
582
|
BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE"] = 11004] = "SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE";
|
|
536
583
|
BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_TO_BUY_MATCHING_BONUS"] = 11005] = "SHOP_FAILED_TO_BUY_MATCHING_BONUS";
|
|
537
584
|
BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED"] = 11006] = "SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED";
|
|
585
|
+
BuyStoreItemErrorCode[BuyStoreItemErrorCode["SHOP_FAILED_POOL_EMPTY"] = 11009] = "SHOP_FAILED_POOL_EMPTY";
|
|
538
586
|
})(exports.BuyStoreItemErrorCode || (exports.BuyStoreItemErrorCode = {}));
|
|
539
587
|
|
|
540
588
|
var StoreCategoryTransform = function StoreCategoryTransform(items) {
|
|
@@ -572,7 +620,8 @@ var StoreItemTransform = function StoreItemTransform(items) {
|
|
|
572
620
|
related_item_ids: r.itemPublicMeta.related_items,
|
|
573
621
|
type: (_StoreItemType$Bonus$ = {}, _StoreItemType$Bonus$[exports.StoreItemType.Bonus] = 'bonus', _StoreItemType$Bonus$[exports.StoreItemType.Manual] = 'manual', _StoreItemType$Bonus$)[r.itemTypeId],
|
|
574
622
|
can_buy: r.canBuy,
|
|
575
|
-
category_ids: (_r$categoryIds = r.categoryIds) != null ? _r$categoryIds : []
|
|
623
|
+
category_ids: (_r$categoryIds = r.categoryIds) != null ? _r$categoryIds : [],
|
|
624
|
+
pool: r.shopPool
|
|
576
625
|
};
|
|
577
626
|
return x;
|
|
578
627
|
});
|
|
@@ -909,6 +958,7 @@ var onUpdateContextKey;
|
|
|
909
958
|
onUpdateContextKey["Saw"] = "saw";
|
|
910
959
|
onUpdateContextKey["Missions"] = "missions";
|
|
911
960
|
onUpdateContextKey["TournamentList"] = "tournamentList";
|
|
961
|
+
onUpdateContextKey["InboxMessages"] = "inboxMessages";
|
|
912
962
|
})(onUpdateContextKey || (onUpdateContextKey = {}));
|
|
913
963
|
/** @group General API */
|
|
914
964
|
var WSAPI = /*#__PURE__*/function () {
|
|
@@ -936,6 +986,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
936
986
|
on(exports.ClassId.TOURNAMENT_REGISTER_RESPONSE, function () {
|
|
937
987
|
return _this.updateTournamentsOnRegistration();
|
|
938
988
|
});
|
|
989
|
+
on(exports.ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, function () {
|
|
990
|
+
return _this.updateInboxMessages();
|
|
991
|
+
});
|
|
939
992
|
}
|
|
940
993
|
/** Returns information about current user */
|
|
941
994
|
var _proto = WSAPI.prototype;
|
|
@@ -1091,7 +1144,7 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1091
1144
|
} catch (e) {
|
|
1092
1145
|
return Promise.reject(e);
|
|
1093
1146
|
}
|
|
1094
|
-
} /** 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 */;
|
|
1095
1148
|
_proto.getTournamentInstanceInfo = function getTournamentInstanceInfo(tournamentInstanceId) {
|
|
1096
1149
|
try {
|
|
1097
1150
|
var _this12 = this;
|
|
@@ -1113,11 +1166,111 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1113
1166
|
} catch (e) {
|
|
1114
1167
|
return Promise.reject(e);
|
|
1115
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
|
+
}
|
|
1116
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. */;
|
|
1117
1270
|
_proto.getTranslations = function getTranslations(lang_code) {
|
|
1118
1271
|
try {
|
|
1119
|
-
var
|
|
1120
|
-
return Promise.resolve(
|
|
1272
|
+
var _this21 = this;
|
|
1273
|
+
return Promise.resolve(_this21.api.getTranslationsT(null, lang_code, [])).then(function (r) {
|
|
1121
1274
|
return {
|
|
1122
1275
|
translations: r.translations
|
|
1123
1276
|
};
|
|
@@ -1128,15 +1281,15 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1128
1281
|
};
|
|
1129
1282
|
_proto.updateOnSpin = function updateOnSpin(data) {
|
|
1130
1283
|
try {
|
|
1131
|
-
var
|
|
1284
|
+
var _this22 = this;
|
|
1132
1285
|
return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
|
|
1133
|
-
return
|
|
1286
|
+
return _this22.api.sawGetTemplatesT(null);
|
|
1134
1287
|
}, CACHE_DATA_SEC)).then(function (templates) {
|
|
1135
1288
|
var index = templates.findIndex(function (t) {
|
|
1136
1289
|
return t.id === data.saw_template_id;
|
|
1137
1290
|
});
|
|
1138
1291
|
templates[index].spin_count = data.spin_count;
|
|
1139
|
-
|
|
1292
|
+
_this22.updateEntity(onUpdateContextKey.Saw, templates);
|
|
1140
1293
|
});
|
|
1141
1294
|
} catch (e) {
|
|
1142
1295
|
return Promise.reject(e);
|
|
@@ -1144,9 +1297,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1144
1297
|
};
|
|
1145
1298
|
_proto.updateOnAddSpin = function updateOnAddSpin() {
|
|
1146
1299
|
try {
|
|
1147
|
-
var
|
|
1148
|
-
return Promise.resolve(
|
|
1149
|
-
|
|
1300
|
+
var _this23 = this;
|
|
1301
|
+
return Promise.resolve(_this23.api.sawGetTemplatesT(null)).then(function (payload) {
|
|
1302
|
+
_this23.updateEntity(onUpdateContextKey.Saw, payload);
|
|
1150
1303
|
});
|
|
1151
1304
|
} catch (e) {
|
|
1152
1305
|
return Promise.reject(e);
|
|
@@ -1154,11 +1307,11 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1154
1307
|
};
|
|
1155
1308
|
_proto.updateOnPrizeWin = function updateOnPrizeWin(data) {
|
|
1156
1309
|
try {
|
|
1157
|
-
var
|
|
1158
|
-
var
|
|
1310
|
+
var _this24 = this;
|
|
1311
|
+
var _temp6 = function () {
|
|
1159
1312
|
if (data.errCode === exports.SAWSpinErrorCode.SAW_OK) {
|
|
1160
1313
|
return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
|
|
1161
|
-
return
|
|
1314
|
+
return _this24.api.sawGetTemplatesT(null);
|
|
1162
1315
|
}, CACHE_DATA_SEC)).then(function (templates) {
|
|
1163
1316
|
var _template$prizes$find;
|
|
1164
1317
|
var template = templates.find(function (t) {
|
|
@@ -1169,27 +1322,27 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1169
1322
|
var prizeType = (_template$prizes$find = template.prizes.find(function (p) {
|
|
1170
1323
|
return p.id === data.saw_prize_id;
|
|
1171
1324
|
})) == null ? void 0 : _template$prizes$find.prize_type;
|
|
1172
|
-
var
|
|
1325
|
+
var _temp5 = function () {
|
|
1173
1326
|
if (template.jackpot_add_on_attempt || template.spin_count === 1 || prizeType === exports.MiniGamePrizeTypeName.JACKPOT || prizeType === exports.MiniGamePrizeTypeName.SPIN) {
|
|
1174
|
-
return Promise.resolve(
|
|
1175
|
-
|
|
1327
|
+
return Promise.resolve(_this24.api.sawGetTemplatesT(null)).then(function (updatedTemplates) {
|
|
1328
|
+
_this24.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
1176
1329
|
});
|
|
1177
1330
|
}
|
|
1178
1331
|
}();
|
|
1179
|
-
if (
|
|
1332
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
|
1180
1333
|
});
|
|
1181
1334
|
}
|
|
1182
1335
|
}();
|
|
1183
|
-
return Promise.resolve(
|
|
1336
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
1184
1337
|
} catch (e) {
|
|
1185
1338
|
return Promise.reject(e);
|
|
1186
1339
|
}
|
|
1187
1340
|
};
|
|
1188
1341
|
_proto.updateMissionsOnOptIn = function updateMissionsOnOptIn() {
|
|
1189
1342
|
try {
|
|
1190
|
-
var
|
|
1191
|
-
return Promise.resolve(
|
|
1192
|
-
|
|
1343
|
+
var _this25 = this;
|
|
1344
|
+
return Promise.resolve(_this25.api.missionsGetItemsT(null)).then(function (payload) {
|
|
1345
|
+
_this25.updateEntity(onUpdateContextKey.Missions, payload);
|
|
1193
1346
|
});
|
|
1194
1347
|
} catch (e) {
|
|
1195
1348
|
return Promise.reject(e);
|
|
@@ -1197,9 +1350,19 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1197
1350
|
};
|
|
1198
1351
|
_proto.updateTournamentsOnRegistration = function updateTournamentsOnRegistration() {
|
|
1199
1352
|
try {
|
|
1200
|
-
var
|
|
1201
|
-
return Promise.resolve(
|
|
1202
|
-
|
|
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);
|
|
1203
1366
|
});
|
|
1204
1367
|
} catch (e) {
|
|
1205
1368
|
return Promise.reject(e);
|
|
@@ -1207,9 +1370,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1207
1370
|
};
|
|
1208
1371
|
_proto.updateEntity = function updateEntity(contextKey, payload) {
|
|
1209
1372
|
try {
|
|
1210
|
-
var
|
|
1373
|
+
var _this28 = this;
|
|
1211
1374
|
OCache.set(contextKey, payload, ECacheContext.WSAPI);
|
|
1212
|
-
var onUpdate =
|
|
1375
|
+
var onUpdate = _this28.onUpdateCallback.get(contextKey);
|
|
1213
1376
|
if (onUpdate) {
|
|
1214
1377
|
onUpdate(payload);
|
|
1215
1378
|
}
|
|
@@ -1247,6 +1410,7 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1247
1410
|
this.messageSender = void 0;
|
|
1248
1411
|
this.publicUrl = void 0;
|
|
1249
1412
|
this.wsUrl = void 0;
|
|
1413
|
+
this.inboxCdnUrl = void 0;
|
|
1250
1414
|
this.partnerUrl = void 0;
|
|
1251
1415
|
this.avatarDomain = void 0;
|
|
1252
1416
|
this.logger = void 0;
|
|
@@ -1830,6 +1994,139 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
1830
1994
|
return Promise.reject(e);
|
|
1831
1995
|
}
|
|
1832
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
|
+
};
|
|
1833
2130
|
_proto.getWSCalls = function getWSCalls() {
|
|
1834
2131
|
return new WSAPI(this);
|
|
1835
2132
|
};
|
|
@@ -1851,20 +2148,6 @@ var CookieStore = /*#__PURE__*/function () {
|
|
|
1851
2148
|
}();
|
|
1852
2149
|
CookieStore.cookieStore = new typescriptMap.TSMap();
|
|
1853
2150
|
|
|
1854
|
-
exports.InboxMessageType = void 0;
|
|
1855
|
-
(function (InboxMessageType) {
|
|
1856
|
-
InboxMessageType[InboxMessageType["Custom"] = 0] = "Custom";
|
|
1857
|
-
InboxMessageType[InboxMessageType["MissionCompleted"] = 1] = "MissionCompleted";
|
|
1858
|
-
InboxMessageType[InboxMessageType["MissionUnlocked"] = 2] = "MissionUnlocked";
|
|
1859
|
-
InboxMessageType[InboxMessageType["LeaderboardWon"] = 3] = "LeaderboardWon";
|
|
1860
|
-
InboxMessageType[InboxMessageType["LevelChanged"] = 4] = "LevelChanged";
|
|
1861
|
-
InboxMessageType[InboxMessageType["BonusGiven"] = 5] = "BonusGiven";
|
|
1862
|
-
InboxMessageType[InboxMessageType["PointsAdded"] = 6] = "PointsAdded";
|
|
1863
|
-
InboxMessageType[InboxMessageType["PointsUsed"] = 7] = "PointsUsed";
|
|
1864
|
-
InboxMessageType[InboxMessageType["PersonalMessage"] = 8] = "PersonalMessage";
|
|
1865
|
-
})(exports.InboxMessageType || (exports.InboxMessageType = {}));
|
|
1866
|
-
// keep in sync with BO enum
|
|
1867
|
-
|
|
1868
2151
|
exports.LeaderBoardPeriodType = void 0;
|
|
1869
2152
|
(function (LeaderBoardPeriodType) {
|
|
1870
2153
|
LeaderBoardPeriodType[LeaderBoardPeriodType["DAILY"] = 1] = "DAILY";
|
|
@@ -1875,6 +2158,8 @@ exports.LeaderBoardPeriodType = void 0;
|
|
|
1875
2158
|
exports.CookieStore = CookieStore;
|
|
1876
2159
|
exports.CoreUtils = CoreUtils;
|
|
1877
2160
|
exports.GetLevelMapResponseTransform = GetLevelMapResponseTransform;
|
|
2161
|
+
exports.InboxMessageBodyTransform = InboxMessageBodyTransform;
|
|
2162
|
+
exports.InboxMessagesTransform = InboxMessagesTransform;
|
|
1878
2163
|
exports.MiniGamePrizeTypeNamed = MiniGamePrizeTypeNamed;
|
|
1879
2164
|
exports.SAWBuyInTypeNamed = SAWBuyInTypeNamed;
|
|
1880
2165
|
exports.SAWGameTypeNamed = SAWGameTypeNamed;
|