@smartico/public-api 0.0.175 → 0.0.176
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/WSAPI/WSAPI.d.ts +3 -6
- package/dist/index.js +48 -63
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +20 -20
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +1 -3
- package/package.json +1 -1
- package/src/WSAPI/WSAPI.ts +21 -26
package/docs/classes/WSAPI.md
CHANGED
|
@@ -422,8 +422,7 @@ ___
|
|
|
422
422
|
Returns the list of mini-games based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
423
423
|
The maximum number of items per request is limited to 20.
|
|
424
424
|
You can leave this params empty and by default it will return list of mini-games ranging from 0 to 20.
|
|
425
|
-
The returned list of mini-games is cached for 30 seconds.
|
|
426
|
-
Updated templates will be passed to onUpdate callback.
|
|
425
|
+
The returned list of mini-games history is cached for 30 seconds.
|
|
427
426
|
|
|
428
427
|
**Example**:
|
|
429
428
|
```
|
|
@@ -442,7 +441,6 @@ _smartico.api.getMiniGamesHistory().then((result) => {
|
|
|
442
441
|
| › `limit?` | `number` |
|
|
443
442
|
| › `offset?` | `number` |
|
|
444
443
|
| › `saw_template_id?` | `number` |
|
|
445
|
-
| › `onUpdate?` | (`data`: [`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]) => `void` |
|
|
446
444
|
|
|
447
445
|
#### Returns
|
|
448
446
|
|
package/package.json
CHANGED
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -67,6 +67,7 @@ enum onUpdateContextKey {
|
|
|
67
67
|
Pots = 'Pots',
|
|
68
68
|
CustomSections = 'customSections',
|
|
69
69
|
Bonuses = 'bonuses',
|
|
70
|
+
SAWHistory = 'sawHistory'
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/** @group General API */
|
|
@@ -80,10 +81,15 @@ export class WSAPI {
|
|
|
80
81
|
if (this.api.tracker) {
|
|
81
82
|
const on = this.api.tracker.on;
|
|
82
83
|
on(ClassId.SAW_SPINS_COUNT_PUSH, (data: SAWSpinsCountPush) => this.updateOnSpin(data));
|
|
83
|
-
on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.
|
|
84
|
-
on(ClassId.
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.reloadMiniGameTemplate());
|
|
85
|
+
on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => {
|
|
86
|
+
this.reloadMiniGameTemplate();
|
|
87
|
+
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
|
|
88
|
+
});
|
|
89
|
+
on(ClassId.SAW_DO_SPIN_RESPONSE, () => {
|
|
90
|
+
this.reloadMiniGameTemplate();
|
|
91
|
+
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
|
|
92
|
+
});
|
|
87
93
|
on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissions());
|
|
88
94
|
on(ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE, () => this.updateMissions());
|
|
89
95
|
on(ClassId.RELOAD_ACHIEVEMENTS_EVENT, () => this.updateMissions());
|
|
@@ -95,7 +101,10 @@ export class WSAPI {
|
|
|
95
101
|
on(ClassId.JP_OPTOUT_RESPONSE, (data: JackpotsOptoutRequest) => this.jackpotClearCache());
|
|
96
102
|
on(ClassId.JP_OPTIN_RESPONSE, (data: JackpotsOptinResponse) => this.jackpotClearCache());
|
|
97
103
|
on(ClassId.CLAIM_BONUS_RESPONSE, () => this.updateBonuses());
|
|
98
|
-
on(ClassId.SAW_DO_SPIN_BATCH_RESPONSE, () =>
|
|
104
|
+
on(ClassId.SAW_DO_SPIN_BATCH_RESPONSE, () => {
|
|
105
|
+
this.reloadMiniGameTemplate();
|
|
106
|
+
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
|
|
107
|
+
});
|
|
99
108
|
}
|
|
100
109
|
}
|
|
101
110
|
|
|
@@ -461,8 +470,7 @@ export class WSAPI {
|
|
|
461
470
|
* Returns the list of mini-games based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
462
471
|
* The maximum number of items per request is limited to 20.
|
|
463
472
|
* You can leave this params empty and by default it will return list of mini-games ranging from 0 to 20.
|
|
464
|
-
* The returned list of mini-games is cached for 30 seconds.
|
|
465
|
-
* Updated templates will be passed to onUpdate callback.
|
|
473
|
+
* The returned list of mini-games history is cached for 30 seconds.
|
|
466
474
|
*
|
|
467
475
|
* **Example**:
|
|
468
476
|
* ```
|
|
@@ -477,16 +485,11 @@ export class WSAPI {
|
|
|
477
485
|
public async getMiniGamesHistory({
|
|
478
486
|
limit,
|
|
479
487
|
offset,
|
|
480
|
-
saw_template_id
|
|
481
|
-
|
|
482
|
-
} : { limit?: number, offset?: number, saw_template_id?: number, onUpdate?: (data: TMiniGameTemplate[]) => void }): Promise<TSawHistory[]> {
|
|
483
|
-
|
|
484
|
-
if (onUpdate) {
|
|
485
|
-
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
486
|
-
}
|
|
488
|
+
saw_template_id
|
|
489
|
+
} : { limit?: number, offset?: number, saw_template_id?: number } ): Promise<TSawHistory[]> {
|
|
487
490
|
|
|
488
491
|
return OCache.use(
|
|
489
|
-
onUpdateContextKey.
|
|
492
|
+
onUpdateContextKey.SAWHistory,
|
|
490
493
|
ECacheContext.WSAPI,
|
|
491
494
|
() => this.api.getSawWinningHistoryT(null, limit, offset, saw_template_id),
|
|
492
495
|
CACHE_DATA_SEC,
|
|
@@ -826,17 +829,9 @@ export class WSAPI {
|
|
|
826
829
|
this.updateEntity(onUpdateContextKey.Saw, templates);
|
|
827
830
|
}
|
|
828
831
|
|
|
829
|
-
private async
|
|
830
|
-
const
|
|
831
|
-
this.updateEntity(onUpdateContextKey.Saw,
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
private async updateOnPrizeWin(data: SAWDoSpinResponse) {
|
|
835
|
-
if (data.errCode === SAWSpinErrorCode.SAW_OK) {
|
|
836
|
-
|
|
837
|
-
const updatedTemplates = await this.api.sawGetTemplatesT(null);
|
|
838
|
-
this.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
839
|
-
}
|
|
832
|
+
private async reloadMiniGameTemplate() {
|
|
833
|
+
const updatedTemplates = await this.api.sawGetTemplatesT(null);
|
|
834
|
+
this.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
|
|
840
835
|
}
|
|
841
836
|
|
|
842
837
|
private async updateMissions() {
|