@smartico/public-api 0.0.172 → 0.0.173

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.
@@ -417,9 +417,11 @@ ___
417
417
 
418
418
  ### playMiniGame
419
419
 
420
- ▸ **playMiniGame**(`template_id`): `Promise`\<[`TMiniGamePlayResult`](../interfaces/TMiniGamePlayResult.md)\>
420
+ ▸ **playMiniGame**(`template_id`, `«destructured»?`): `Promise`\<[`TMiniGamePlayResult`](../interfaces/TMiniGamePlayResult.md)\>
421
421
 
422
422
  Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
423
+ * After playMiniGame is called, you can call getMiniGames to get the list of mini-games.The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
424
+ The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
423
425
 
424
426
  **Example**:
425
427
  ```
@@ -435,6 +437,8 @@ _smartico.api.playMiniGame(55).then((result) => {
435
437
  | Name | Type |
436
438
  | :------ | :------ |
437
439
  | `template_id` | `number` |
440
+ | `«destructured»` | `Object` |
441
+ | › `onUpdate?` | (`data`: [`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]) => `void` |
438
442
 
439
443
  #### Returns
440
444
 
@@ -444,9 +448,11 @@ ___
444
448
 
445
449
  ### playMiniGameBatch
446
450
 
447
- ▸ **playMiniGameBatch**(`template_id`, `spin_count`): `Promise`\<[`TMiniGamePlayBatchResult`](../interfaces/TMiniGamePlayBatchResult.md)[]\>
451
+ ▸ **playMiniGameBatch**(`template_id`, `spin_count`, `«destructured»?`): `Promise`\<[`TMiniGamePlayBatchResult`](../interfaces/TMiniGamePlayBatchResult.md)[]\>
448
452
 
449
453
  Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
454
+ After playMiniGameBatch is called, you can call getMiniGames to get the list of mini-games. The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGameBatch with a new onUpdate callback, the old one will be overwritten by the new one.
455
+ The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
450
456
 
451
457
  **Example**:
452
458
  ```
@@ -462,6 +468,8 @@ _smartico.api.playMiniGameBatch(55, 10).then((result) => {
462
468
  | :------ | :------ |
463
469
  | `template_id` | `number` |
464
470
  | `spin_count` | `number` |
471
+ | `«destructured»` | `Object` |
472
+ | › `onUpdate?` | (`data`: [`TMissionOrBadge`](../interfaces/TMissionOrBadge.md)[]) => `void` |
465
473
 
466
474
  #### Returns
467
475
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.172",
3
+ "version": "0.0.173",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -93,6 +93,7 @@ export class WSAPI {
93
93
  on(ClassId.JP_WIN_PUSH, (data: JackpotWinPush) => this.jackpotClearCache());
94
94
  on(ClassId.JP_OPTOUT_RESPONSE, (data: JackpotsOptoutRequest) => this.jackpotClearCache());
95
95
  on(ClassId.CLAIM_BONUS_RESPONSE, () => this.updateBonuses());
96
+ on(ClassId.SAW_DO_SPIN_BATCH_RESPONSE, () => this.updateOnAddSpin());
96
97
  }
97
98
  }
98
99
 
@@ -456,7 +457,9 @@ export class WSAPI {
456
457
 
457
458
  /**
458
459
  * Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
459
- *
460
+ * After playMiniGame is called, you can call getMiniGames to get the list of mini-games.The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
461
+ * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
462
+ *
460
463
  * **Example**:
461
464
  * ```
462
465
  * _smartico.api.playMiniGame(55).then((result) => {
@@ -466,7 +469,12 @@ export class WSAPI {
466
469
  *
467
470
  * **Visitor mode: not supported**
468
471
  */
469
- public async playMiniGame(template_id: number): Promise<TMiniGamePlayResult> {
472
+ public async playMiniGame(template_id: number, { onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void } = {}): Promise<TMiniGamePlayResult> {
473
+
474
+ if (onUpdate) {
475
+ this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
476
+ }
477
+
470
478
  const r = await this.api.sawSpinRequest(null, template_id);
471
479
  this.api.doAcknowledgeRequest(null, r.request_id);
472
480
 
@@ -481,7 +489,9 @@ export class WSAPI {
481
489
 
482
490
  /**
483
491
  * Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
484
- *
492
+ * After playMiniGameBatch is called, you can call getMiniGames to get the list of mini-games. The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGameBatch with a new onUpdate callback, the old one will be overwritten by the new one.
493
+ * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
494
+ *
485
495
  * **Example**:
486
496
  * ```
487
497
  * _smartico.api.playMiniGameBatch(55, 10).then((result) => {
@@ -490,7 +500,12 @@ export class WSAPI {
490
500
  * ```
491
501
  * **Visitor mode: not supported**
492
502
  */
493
- public async playMiniGameBatch(template_id: number, spin_count: number): Promise<TMiniGamePlayBatchResult[]> {
503
+ public async playMiniGameBatch(template_id: number, spin_count: number, { onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void } = {}): Promise<TMiniGamePlayBatchResult[]> {
504
+
505
+ if (onUpdate) {
506
+ this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
507
+ }
508
+
494
509
  const response = await this.api.sawSpinBatchRequest(null, template_id, spin_count);
495
510
 
496
511
  const request_ids = response.results.map((result) => result.request_id);