@smartico/public-api 0.0.398 → 0.0.400

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.
@@ -9,4 +9,5 @@ export interface Level {
9
9
  required_level_counter_1: number;
10
10
  required_level_counter_2: number;
11
11
  general_level_progress: number;
12
+ ordinal_position?: number;
12
13
  }
@@ -177,10 +177,12 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
177
177
  /**
178
178
  * Plays one round of a mini-game template — runs the server's
179
179
  * randomised prize selection, deducts the buy-in cost (if any),
180
- * and returns the won `prize_id`. After the play resolves, the SDK
181
- * automatically fires a server-side acknowledgement on a
182
- * fire-and-forget basis, marking the spin as "delivered" so the
183
- * prize takes effect.
180
+ * credits the won prize, and returns the won `prize_id`. By default
181
+ * (`acknowledge: true`) the SDK then sends a server-side
182
+ * acknowledgement and AWAITS it before resolving, so the win is
183
+ * marked delivered by the time the promise settles. Pass
184
+ * `acknowledge: false` to skip that step and finalise the win
185
+ * yourself later (see the `acknowledge` parameter).
184
186
  *
185
187
  * Works for all `SAWGameType` values EXCEPT:
186
188
  * - `PrizeDrop` — prizes arrive server-pushed; do NOT call
@@ -244,17 +246,34 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
244
246
  * corresponding domain methods.
245
247
  * - `'manual'` — operator delivers offline.
246
248
  *
247
- * **Auto-acknowledge**
248
- * The SDK calls the server's acknowledge endpoint immediately
249
- * after the spin response, on a fire-and-forget basis (not
250
- * awaited). This marks the spin as "delivered" so prize effects
251
- * take hold. If the auto-acknowledge fails (network drop), the
252
- * spin appears as `is_claimed: false` in
253
- * {@link getMiniGamesHistory}; the consumer can recover it by
254
- * passing the `client_request_id` to
255
- * {@link miniGameWinAcknowledgeRequest}. A server-side fallback
256
- * job auto-acknowledges stale spins every ~60 seconds, so prizes
257
- * are eventually delivered even without consumer action.
249
+ * **Acknowledge** (the `acknowledge` parameter, default `true`)
250
+ * Every spin is finalised by a follow-up acknowledge step that
251
+ * marks the win delivered. By default the SDK sends that
252
+ * acknowledge and AWAITS it, so `playMiniGame` resolves only after
253
+ * the win is finalised server-side. Keep the default unless you
254
+ * have a specific reason not to.
255
+ *
256
+ * Pass `acknowledge: false` to skip that automatic step.
257
+ * `playMiniGame` then resolves as soon as the spin result is known,
258
+ * without waiting for the win to be marked delivered. You finalise
259
+ * it later by calling {@link miniGameWinAcknowledgeRequest} with the
260
+ * `request_id` returned on this result.
261
+ *
262
+ * What `acknowledge: false` does and does NOT defer:
263
+ * - For STANDARD prizes the value is credited at spin time
264
+ * regardless, so opting out does NOT delay the balance change —
265
+ * it only defers the "delivered" bookkeeping and the `is_claimed`
266
+ * flag flipping in {@link getMiniGamesHistory}.
267
+ * - For operator-configured "explicit claim" prizes the credit IS
268
+ * deferred until the spin is acknowledged, so those require an
269
+ * explicit acknowledge to finalise.
270
+ *
271
+ * A server-side fallback auto-acknowledges ordinary un-acknowledged
272
+ * spins after a short delay (about 1–3 minutes), so an ordinary
273
+ * prize is never lost even without consumer action. "Explicit
274
+ * claim" prizes are excluded from that fallback — if you use
275
+ * `acknowledge: false` for one, you MUST acknowledge it explicitly
276
+ * or its prize is never credited.
258
277
  *
259
278
  * **Idempotency**: NOT idempotent. A double-click sends two
260
279
  * spins and deducts the buy-in twice. The SDK does NOT guard
@@ -273,25 +292,33 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
273
292
  * refreshed array.
274
293
  *
275
294
  * **Side effects** (on `err_code === 0`)
276
- * - Buy-in deducted from the user's balance (points / gems /
277
- * diamonds / spin tickets — depending on `saw_buyin_type`).
278
- * Balance updates flow via the user-properties channel
279
- * (subscribe to {@link getUserProfile} `props_change` to
280
- * observe).
281
- * - Prize value credited per the prize's type (see "Prize
282
- * handling" above).
283
- * - A `minigame_attempt` analytics event fires server-side with
284
- * the result status.
295
+ * - Buy-in deducted at spin time (points / gems / diamonds / spin
296
+ * tickets — depending on `saw_buyin_type`), already applied by the
297
+ * time the call resolves. Balance updates flow via the
298
+ * user-properties channel (observe via {@link getUserProfile}).
299
+ * - Prize value credited per the prize's type (see "Prize handling"
300
+ * above). Standard prizes are credited at spin time; "explicit
301
+ * claim" prizes are credited when the spin is acknowledged.
302
+ * - The play is recorded server-side for analytics / reporting.
285
303
  *
286
304
  * **UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
287
305
  *
288
306
  * **Visitor mode**: not supported. Visitor sessions trying to
289
307
  * spin receive `SAW_VISITOR_STOP_SPIN_REQUEST (-40001)`.
290
308
  *
291
- * @param template_id The mini-game template ID (from
292
- * `TMiniGameTemplate.id`).
293
- * @param params Optional. Pass an `onUpdate` callback to
294
- * subscribe to subsequent template refreshes.
309
+ * @param template_id The mini-game template ID (from
310
+ * `TMiniGameTemplate.id`).
311
+ * @param params Optional options bag.
312
+ * @param params.onUpdate Pass a callback to subscribe to
313
+ * subsequent template refreshes (same
314
+ * channel as {@link getMiniGames}).
315
+ * @param params.acknowledge Whether the SDK automatically sends and
316
+ * awaits the win acknowledge after the
317
+ * spin. Defaults to `true` (recommended).
318
+ * Set `false` to finalise the win yourself
319
+ * via {@link miniGameWinAcknowledgeRequest}
320
+ * — see "Acknowledge" above for the
321
+ * request-id caveat.
295
322
  * @returns `{ err_code, err_message, prize_id }` — success when
296
323
  * `err_code === 0`. `prize_id` is always populated; look
297
324
  * it up in `template.prizes` to interpret the prize.
@@ -333,6 +360,23 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
333
360
  * console.error('[smartico] play failed — show generic error with this message:', r.err_message);
334
361
  * }
335
362
  * ```
363
+ *
364
+ * @example
365
+ * Manual finalisation (`acknowledge: false`) — e.g. an explicit
366
+ * "Claim" CTA, or finalising on your own schedule:
367
+ * ```ts
368
+ * const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
369
+ * if (r.err_code === 0) {
370
+ * // Spin resolved but not yet acknowledged. For standard prizes the
371
+ * // balance already changed server-side; "explicit claim" prizes
372
+ * // are credited only by the acknowledge below.
373
+ * console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
374
+ *
375
+ * // On the user's Claim click, finalise with the request_id from the result.
376
+ * await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
377
+ * console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
378
+ * }
379
+ * ```
336
380
  */
337
381
  playMiniGame(template_id: number, { onUpdate, acknowledge }?: {
338
382
  onUpdate?: (data: TMiniGameTemplate[]) => void;
@@ -98,6 +98,11 @@ export interface TMiniGamePlayResult {
98
98
  * (including `prize_type === 'no-prize'` for a configured loss
99
99
  * slot). Always populated, even when `err_code !== 0`. */
100
100
  prize_id: number;
101
+ /** Correlation id of this spin. Pass it to
102
+ * {@link miniGameWinAcknowledgeRequest} to finalise the win when
103
+ * playing with `acknowledge: false` — no need to look it up via
104
+ * {@link getMiniGamesHistory}. */
105
+ request_id: string;
101
106
  }
102
107
  /**
103
108
  * TMiniGamePlayBatchResult describes one entry in the array returned
package/dist/index.js CHANGED
@@ -7299,10 +7299,12 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7299
7299
  /**
7300
7300
  * Plays one round of a mini-game template — runs the server's
7301
7301
  * randomised prize selection, deducts the buy-in cost (if any),
7302
- * and returns the won `prize_id`. After the play resolves, the SDK
7303
- * automatically fires a server-side acknowledgement on a
7304
- * fire-and-forget basis, marking the spin as "delivered" so the
7305
- * prize takes effect.
7302
+ * credits the won prize, and returns the won `prize_id`. By default
7303
+ * (`acknowledge: true`) the SDK then sends a server-side
7304
+ * acknowledgement and AWAITS it before resolving, so the win is
7305
+ * marked delivered by the time the promise settles. Pass
7306
+ * `acknowledge: false` to skip that step and finalise the win
7307
+ * yourself later (see the `acknowledge` parameter).
7306
7308
  *
7307
7309
  * Works for all `SAWGameType` values EXCEPT:
7308
7310
  * - `PrizeDrop` — prizes arrive server-pushed; do NOT call
@@ -7366,17 +7368,34 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7366
7368
  * corresponding domain methods.
7367
7369
  * - `'manual'` — operator delivers offline.
7368
7370
  *
7369
- * **Auto-acknowledge**
7370
- * The SDK calls the server's acknowledge endpoint immediately
7371
- * after the spin response, on a fire-and-forget basis (not
7372
- * awaited). This marks the spin as "delivered" so prize effects
7373
- * take hold. If the auto-acknowledge fails (network drop), the
7374
- * spin appears as `is_claimed: false` in
7375
- * {@link getMiniGamesHistory}; the consumer can recover it by
7376
- * passing the `client_request_id` to
7377
- * {@link miniGameWinAcknowledgeRequest}. A server-side fallback
7378
- * job auto-acknowledges stale spins every ~60 seconds, so prizes
7379
- * are eventually delivered even without consumer action.
7371
+ * **Acknowledge** (the `acknowledge` parameter, default `true`)
7372
+ * Every spin is finalised by a follow-up acknowledge step that
7373
+ * marks the win delivered. By default the SDK sends that
7374
+ * acknowledge and AWAITS it, so `playMiniGame` resolves only after
7375
+ * the win is finalised server-side. Keep the default unless you
7376
+ * have a specific reason not to.
7377
+ *
7378
+ * Pass `acknowledge: false` to skip that automatic step.
7379
+ * `playMiniGame` then resolves as soon as the spin result is known,
7380
+ * without waiting for the win to be marked delivered. You finalise
7381
+ * it later by calling {@link miniGameWinAcknowledgeRequest} with the
7382
+ * `request_id` returned on this result.
7383
+ *
7384
+ * What `acknowledge: false` does and does NOT defer:
7385
+ * - For STANDARD prizes the value is credited at spin time
7386
+ * regardless, so opting out does NOT delay the balance change —
7387
+ * it only defers the "delivered" bookkeeping and the `is_claimed`
7388
+ * flag flipping in {@link getMiniGamesHistory}.
7389
+ * - For operator-configured "explicit claim" prizes the credit IS
7390
+ * deferred until the spin is acknowledged, so those require an
7391
+ * explicit acknowledge to finalise.
7392
+ *
7393
+ * A server-side fallback auto-acknowledges ordinary un-acknowledged
7394
+ * spins after a short delay (about 1–3 minutes), so an ordinary
7395
+ * prize is never lost even without consumer action. "Explicit
7396
+ * claim" prizes are excluded from that fallback — if you use
7397
+ * `acknowledge: false` for one, you MUST acknowledge it explicitly
7398
+ * or its prize is never credited.
7380
7399
  *
7381
7400
  * **Idempotency**: NOT idempotent. A double-click sends two
7382
7401
  * spins and deducts the buy-in twice. The SDK does NOT guard
@@ -7395,25 +7414,33 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7395
7414
  * refreshed array.
7396
7415
  *
7397
7416
  * **Side effects** (on `err_code === 0`)
7398
- * - Buy-in deducted from the user's balance (points / gems /
7399
- * diamonds / spin tickets — depending on `saw_buyin_type`).
7400
- * Balance updates flow via the user-properties channel
7401
- * (subscribe to {@link getUserProfile} `props_change` to
7402
- * observe).
7403
- * - Prize value credited per the prize's type (see "Prize
7404
- * handling" above).
7405
- * - A `minigame_attempt` analytics event fires server-side with
7406
- * the result status.
7417
+ * - Buy-in deducted at spin time (points / gems / diamonds / spin
7418
+ * tickets — depending on `saw_buyin_type`), already applied by the
7419
+ * time the call resolves. Balance updates flow via the
7420
+ * user-properties channel (observe via {@link getUserProfile}).
7421
+ * - Prize value credited per the prize's type (see "Prize handling"
7422
+ * above). Standard prizes are credited at spin time; "explicit
7423
+ * claim" prizes are credited when the spin is acknowledged.
7424
+ * - The play is recorded server-side for analytics / reporting.
7407
7425
  *
7408
7426
  * **UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
7409
7427
  *
7410
7428
  * **Visitor mode**: not supported. Visitor sessions trying to
7411
7429
  * spin receive `SAW_VISITOR_STOP_SPIN_REQUEST (-40001)`.
7412
7430
  *
7413
- * @param template_id The mini-game template ID (from
7414
- * `TMiniGameTemplate.id`).
7415
- * @param params Optional. Pass an `onUpdate` callback to
7416
- * subscribe to subsequent template refreshes.
7431
+ * @param template_id The mini-game template ID (from
7432
+ * `TMiniGameTemplate.id`).
7433
+ * @param params Optional options bag.
7434
+ * @param params.onUpdate Pass a callback to subscribe to
7435
+ * subsequent template refreshes (same
7436
+ * channel as {@link getMiniGames}).
7437
+ * @param params.acknowledge Whether the SDK automatically sends and
7438
+ * awaits the win acknowledge after the
7439
+ * spin. Defaults to `true` (recommended).
7440
+ * Set `false` to finalise the win yourself
7441
+ * via {@link miniGameWinAcknowledgeRequest}
7442
+ * — see "Acknowledge" above for the
7443
+ * request-id caveat.
7417
7444
  * @returns `{ err_code, err_message, prize_id }` — success when
7418
7445
  * `err_code === 0`. `prize_id` is always populated; look
7419
7446
  * it up in `template.prizes` to interpret the prize.
@@ -7455,6 +7482,23 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7455
7482
  * console.error('[smartico] play failed — show generic error with this message:', r.err_message);
7456
7483
  * }
7457
7484
  * ```
7485
+ *
7486
+ * @example
7487
+ * Manual finalisation (`acknowledge: false`) — e.g. an explicit
7488
+ * "Claim" CTA, or finalising on your own schedule:
7489
+ * ```ts
7490
+ * const r = await window._smartico.api.playMiniGame(game.id, { acknowledge: false });
7491
+ * if (r.err_code === 0) {
7492
+ * // Spin resolved but not yet acknowledged. For standard prizes the
7493
+ * // balance already changed server-side; "explicit claim" prizes
7494
+ * // are credited only by the acknowledge below.
7495
+ * console.log('[smartico] prize won — show the result / Claim CTA, then finalise');
7496
+ *
7497
+ * // On the user's Claim click, finalise with the request_id from the result.
7498
+ * await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
7499
+ * console.log('[smartico] win finalised — refresh getUserProfile / getMiniGames to reflect it');
7500
+ * }
7501
+ * ```
7458
7502
  */
7459
7503
  ;
7460
7504
  _proto.playMiniGame = function playMiniGame(template_id, _temp4) {
@@ -7472,7 +7516,8 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7472
7516
  var o = {
7473
7517
  err_code: r.errCode,
7474
7518
  err_message: r.errMsg,
7475
- prize_id: r.saw_prize_id
7519
+ prize_id: r.saw_prize_id,
7520
+ request_id: r.request_id
7476
7521
  };
7477
7522
  return o;
7478
7523
  }