@smartico/public-api 0.0.200 → 0.0.202
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/NodeCache.d.ts +2 -2
- package/dist/Quiz/MarketsAnswersType.d.ts +22 -0
- package/dist/SmarticoPublicAPI.d.ts +23 -0
- package/dist/Store/BuyShopItemErrorCode.d.ts +10 -0
- package/dist/Store/BuyShopItemRequest.d.ts +4 -0
- package/dist/Store/BuyShopItemResponse.d.ts +4 -0
- package/dist/Store/GetCategoriesShopResponse.d.ts +5 -0
- package/dist/Store/GetShopItemsResponse.d.ts +5 -0
- package/dist/Store/ShopCategory.d.ts +5 -0
- package/dist/Store/ShopCategoryPublicMeta.d.ts +4 -0
- package/dist/Store/ShopItem.d.ts +9 -0
- package/dist/Store/ShopItemPublicMeta.d.ts +10 -0
- package/dist/Store/ShopItemType.d.ts +4 -0
- package/dist/Store/StorItemPruchased.d.ts +6 -0
- package/dist/WSAPI/WSAPI.d.ts +2 -0
- package/dist/index.js +31 -15
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +28 -13
- package/dist/index.modern.mjs.map +1 -1
- package/dist/service/index.d.ts +5 -0
- package/dist/service/types/ErrorCodes.d.ts +13 -0
- package/dist/service/types/GRequest.d.ts +16 -0
- package/dist/service/types/GResponse.d.ts +10 -0
- package/dist/service/types/Game/GameAttemptType.d.ts +6 -0
- package/dist/service/types/Game/GameCanPlayType.d.ts +10 -0
- package/dist/service/types/Game/GameExternalStatus.d.ts +6 -0
- package/dist/service/types/Game/GameInfo.d.ts +9 -0
- package/dist/service/types/Game/GamePick.d.ts +90 -0
- package/dist/service/types/Game/GameUtil.d.ts +7 -0
- package/dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts +7 -0
- package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +7 -0
- package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +5 -0
- package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +6 -0
- package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +5 -0
- package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +34 -0
- package/dist/service/types/SmarticoProto/PublicProperties.d.ts +11 -0
- package/dist/service/types/SmarticoProto/ResponseIdentify.d.ts +12 -0
- package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +15 -0
- package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +10 -0
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts +3 -0
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts +5 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +11 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +8 -0
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +13 -0
- package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +21 -0
- package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +31 -0
- package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +12 -0
- package/dist/service/types/SmarticoProto/TranslationArea.d.ts +9 -0
- package/dist/service/types/User/UserInfo.d.ts +10 -0
- package/dist/util/Util.d.ts +51 -0
- package/package.json +1 -1
- package/src/NodeCache.ts +18 -14
- package/src/OCache.ts +5 -0
- package/src/WSAPI/WSAPI.ts +7 -0
package/dist/NodeCache.d.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum MarketsValueType {
|
|
2
|
+
HomeTeam = "1",
|
|
3
|
+
AwayTeam = "2",
|
|
4
|
+
Draw = "x",
|
|
5
|
+
HomeTeamHomeTeam = "1/1",
|
|
6
|
+
HomeTeamDraw = "1/x",
|
|
7
|
+
HomeTeamAwayTeam = "1/2",
|
|
8
|
+
DrawHomeTeam = "x/1",
|
|
9
|
+
DrawDraw = "x/x",
|
|
10
|
+
DrawAwayTeam = "x/2",
|
|
11
|
+
AwayTeamHomeTeam = "2/1",
|
|
12
|
+
AwayTeamDraw = "2/x",
|
|
13
|
+
AwayTeamAwayTeam = "2/2",
|
|
14
|
+
Yes = "yes",
|
|
15
|
+
No = "no",
|
|
16
|
+
Odd = "odd",
|
|
17
|
+
Even = "even",
|
|
18
|
+
HomeOdd = "1/odd",
|
|
19
|
+
HomeEven = "1/even",
|
|
20
|
+
AwayOdd = "2/odd",
|
|
21
|
+
AwayEven = "2/even"
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ClassId } from "./Base/ClassId";
|
|
2
|
+
import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
|
|
3
|
+
import { SAWTemplate } from './MiniGames/SAWTemplate';
|
|
4
|
+
import { ILogger } from './ILogger';
|
|
5
|
+
interface IOptions {
|
|
6
|
+
logger?: ILogger;
|
|
7
|
+
logCIDs?: ClassId[];
|
|
8
|
+
logHTTPTiming?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare class SmarticoPublicApi {
|
|
11
|
+
private label_api_key;
|
|
12
|
+
private brand_api_key;
|
|
13
|
+
private publicUrl;
|
|
14
|
+
private logger;
|
|
15
|
+
private logCIDs;
|
|
16
|
+
private logHTTPTiming;
|
|
17
|
+
constructor(label_api_key: string, brand_api_key: string, options?: IOptions);
|
|
18
|
+
private send;
|
|
19
|
+
private buildMessage;
|
|
20
|
+
miniGamesGetTemplates(user_ext_id: string): Promise<SAWGetTemplatesResponse>;
|
|
21
|
+
miniGamesFormatTemplatesForWidget(templates: SAWTemplate[], pointsBalance: number): any[];
|
|
22
|
+
}
|
|
23
|
+
export { SmarticoPublicApi };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum BuyShopItemErrorCode {
|
|
2
|
+
FAILED_TO_BUY_SHOP_ITEM = 121,
|
|
3
|
+
SHOP_NO_BALANCE = 11000,
|
|
4
|
+
SHOP_WRONG_LABEL = 11001,
|
|
5
|
+
SHOP_FAILED_TO_BUY_BONUS = 11002,
|
|
6
|
+
SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION = 11003,
|
|
7
|
+
SHOP_FAILED_TO_BUY_SHOP_ITEM_CONDITION_PURSHASE = 11004,
|
|
8
|
+
SHOP_FAILED_TO_BUY_MATCHING_BONUS = 11005,
|
|
9
|
+
SHOP_FAILED_MAX_BOUGHT_ITEMS_REACHED = 11006
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ShopItemPublicMeta } from "./ShopItemPublicMeta";
|
|
2
|
+
import { ShopItemType } from "./ShopItemType";
|
|
3
|
+
export interface ShopItem {
|
|
4
|
+
id: number;
|
|
5
|
+
itemTypeId: ShopItemType;
|
|
6
|
+
itemPublicMeta: ShopItemPublicMeta;
|
|
7
|
+
categoryIds?: number[];
|
|
8
|
+
canBuy?: boolean;
|
|
9
|
+
}
|
package/dist/WSAPI/WSAPI.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -496,14 +496,17 @@ exports.SAWGameLayout = void 0;
|
|
|
496
496
|
|
|
497
497
|
var NodeCache = /*#__PURE__*/function () {
|
|
498
498
|
function NodeCache() {
|
|
499
|
-
|
|
500
|
-
|
|
499
|
+
var _this = this;
|
|
500
|
+
this.ttlChecker = void 0;
|
|
501
|
+
this.cache = {};
|
|
502
|
+
if (this.ttlChecker === undefined) {
|
|
503
|
+
this.ttlChecker = setInterval(function () {
|
|
501
504
|
var now = new Date().getTime();
|
|
502
|
-
for (var key in
|
|
503
|
-
if (
|
|
504
|
-
var o =
|
|
505
|
+
for (var key in _this.cache) {
|
|
506
|
+
if (_this.cache.hasOwnProperty(key)) {
|
|
507
|
+
var o = _this.cache[key];
|
|
505
508
|
if (o.ttl < now) {
|
|
506
|
-
delete
|
|
509
|
+
delete _this.cache[key];
|
|
507
510
|
}
|
|
508
511
|
}
|
|
509
512
|
}
|
|
@@ -512,7 +515,7 @@ var NodeCache = /*#__PURE__*/function () {
|
|
|
512
515
|
}
|
|
513
516
|
var _proto = NodeCache.prototype;
|
|
514
517
|
_proto.get = function get(key) {
|
|
515
|
-
var o =
|
|
518
|
+
var o = this.cache[key];
|
|
516
519
|
if (o !== undefined && o.ttl > new Date().getTime()) {
|
|
517
520
|
return o.value;
|
|
518
521
|
}
|
|
@@ -521,23 +524,25 @@ var NodeCache = /*#__PURE__*/function () {
|
|
|
521
524
|
if (ttlSeconds === void 0) {
|
|
522
525
|
ttlSeconds = 60;
|
|
523
526
|
}
|
|
524
|
-
|
|
527
|
+
this.cache[key] = {
|
|
525
528
|
value: value,
|
|
526
529
|
ttl: new Date().getTime() + ttlSeconds * 1000
|
|
527
530
|
};
|
|
528
531
|
};
|
|
529
532
|
_proto.remove = function remove(key) {
|
|
530
|
-
if (
|
|
531
|
-
delete
|
|
533
|
+
if (this.cache.hasOwnProperty(key)) {
|
|
534
|
+
delete this.cache[key];
|
|
532
535
|
}
|
|
533
536
|
};
|
|
534
537
|
_proto.flushAll = function flushAll() {
|
|
535
|
-
|
|
538
|
+
this.cache = {};
|
|
539
|
+
if (this.ttlChecker) {
|
|
540
|
+
clearInterval(this.ttlChecker);
|
|
541
|
+
this.ttlChecker = undefined;
|
|
542
|
+
}
|
|
536
543
|
};
|
|
537
544
|
return NodeCache;
|
|
538
545
|
}();
|
|
539
|
-
NodeCache.ttlChecker = void 0;
|
|
540
|
-
NodeCache.cache = {};
|
|
541
546
|
|
|
542
547
|
exports.ECacheContext = void 0;
|
|
543
548
|
(function (ECacheContext) {
|
|
@@ -616,6 +621,11 @@ var OCache = /*#__PURE__*/function () {
|
|
|
616
621
|
OCache.clearAll = function clearAll() {
|
|
617
622
|
try {
|
|
618
623
|
var _this3 = this;
|
|
624
|
+
for (var cacheContext in _this3.cache) {
|
|
625
|
+
if (_this3.cache.hasOwnProperty(cacheContext)) {
|
|
626
|
+
_this3.cache[cacheContext].flushAll();
|
|
627
|
+
}
|
|
628
|
+
}
|
|
619
629
|
_this3.cache = {};
|
|
620
630
|
return Promise.resolve();
|
|
621
631
|
} catch (e) {
|
|
@@ -1341,6 +1351,13 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1341
1351
|
});
|
|
1342
1352
|
}
|
|
1343
1353
|
}
|
|
1354
|
+
/** @private */
|
|
1355
|
+
// AA: this method is used from the _smartico script to clear cache when the context is changed,
|
|
1356
|
+
// e.g. when user is changed or language is changed
|
|
1357
|
+
var _proto = WSAPI.prototype;
|
|
1358
|
+
_proto.clearCaches = function clearCaches() {
|
|
1359
|
+
OCache.clearAll();
|
|
1360
|
+
}
|
|
1344
1361
|
/** Returns information about current user
|
|
1345
1362
|
*
|
|
1346
1363
|
* **Example**:
|
|
@@ -1350,8 +1367,7 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
1350
1367
|
* });
|
|
1351
1368
|
* ```
|
|
1352
1369
|
* **Visitor mode: not supported**
|
|
1353
|
-
*
|
|
1354
|
-
var _proto = WSAPI.prototype;
|
|
1370
|
+
* */;
|
|
1355
1371
|
_proto.getUserProfile = function getUserProfile() {
|
|
1356
1372
|
if (this.api.tracker) {
|
|
1357
1373
|
var o = Object.assign({}, this.api.tracker.userPublicProps);
|