@smartico/public-api 0.0.400 → 0.0.401
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/Core/index.d.ts +1 -0
- package/dist/GamePick/GamePickTypes.d.ts +8 -8
- package/dist/Level/Level.d.ts +1 -0
- package/dist/SmarticoGlobal.d.ts +190 -0
- package/dist/WSAPI/WSAPIGamePick.d.ts +6 -6
- package/dist/WSAPI/WSAPIMiniGames.d.ts +55 -42
- package/dist/WSAPI/WSAPITypes.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +71 -55
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +62 -49
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +20 -0
- package/docs/api/classes/WSAPIAvatars.md +1 -8
- package/docs/api/classes/WSAPIGamePick.md +48 -48
- package/docs/api/classes/WSAPIMiniGames.md +132 -70
- package/docs/api/enumerations/GPRoundStatus.md +43 -0
- package/docs/api/enumerations/GamePickMarketType.md +19 -0
- package/docs/api/enumerations/GamePickResolutionType.md +35 -0
- package/docs/api/enumerations/GamePickScoreType.md +19 -0
- package/docs/api/enumerations/GamePickSportType.md +375 -0
- package/docs/api/enumerations/GameRoundOrderType.md +35 -0
- package/docs/api/enumerations/LiquidEntityData.md +6 -0
- package/docs/api/interfaces/GamePickBoardUser.md +75 -0
- package/docs/api/interfaces/GamePickEvent.md +123 -0
- package/docs/api/interfaces/GamePickEventMeta.md +201 -0
- package/docs/api/interfaces/GamePickGameInfo.md +27 -0
- package/docs/api/interfaces/GamePickRequestParams.md +39 -0
- package/docs/api/interfaces/GamePickRound.md +383 -0
- package/docs/api/interfaces/GamePickRoundBase.md +232 -0
- package/docs/api/interfaces/GamePickRoundBoard.md +359 -0
- package/docs/api/interfaces/GamePickRoundPublicMeta.md +103 -0
- package/docs/api/interfaces/GamePickRoundRequestParams.md +63 -0
- package/docs/api/interfaces/GamePickUserInfo.md +107 -0
- package/docs/api/interfaces/GamesApiResponse.md +33 -0
- package/docs/api/interfaces/Level.md +8 -0
- package/docs/api/interfaces/QuizEventMeta.md +61 -0
- package/docs/api/interfaces/RafflePrizePublicMeta.md +9 -0
- package/docs/api/interfaces/TMiniGamePlayResult.md +11 -0
- package/docs/api/interfaces/TRafflePrize.md +9 -0
- package/docs/api/variables/AllRoundsGameBoardID.md +5 -0
- package/docs/ui/minigames/UIGuide_playMiniGame.md +6 -5
- package/package.json +1 -1
- package/src/Core/index.ts +1 -0
- package/src/GamePick/GamePickTypes.ts +8 -8
- package/src/Level/Level.ts +1 -0
- package/src/SmarticoAPI.ts +2 -1
- package/src/SmarticoGlobal.ts +209 -0
- package/src/WSAPI/WSAPIGamePick.ts +6 -6
- package/src/WSAPI/WSAPIMiniGames.ts +55 -42
- package/src/WSAPI/WSAPITypes.ts +2 -2
- package/src/index.ts +1 -0
- package/tsconfig.json +1 -0
package/dist/Core/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export * from './GetLabelInfoResponse';
|
|
|
5
5
|
export * from './GetTranslationsRequest';
|
|
6
6
|
export * from './GetTranslationsResponse';
|
|
7
7
|
export * from './PublicLabelSettings';
|
|
8
|
+
export * from './PublicProperties';
|
|
8
9
|
export * from './ResponseIdentify';
|
|
9
10
|
export * from './TranslationArea';
|
|
@@ -432,9 +432,9 @@ export interface GamePickGameInfo {
|
|
|
432
432
|
* GamesApiResponse is the standard response wrapper for all GamePick/Quiz API calls
|
|
433
433
|
*/
|
|
434
434
|
export interface GamesApiResponse<T> {
|
|
435
|
-
/** Error code
|
|
435
|
+
/** Error code; `0` = success. Per-method code tables live in each `gamePick*` method's TSDoc. */
|
|
436
436
|
errCode: number;
|
|
437
|
-
/** Human-readable error message when errCode is non-zero */
|
|
437
|
+
/** Human-readable error message; populated when `errCode` is non-zero. */
|
|
438
438
|
errMessage?: string;
|
|
439
439
|
/** Response payload, present on success */
|
|
440
440
|
data?: T;
|
|
@@ -443,13 +443,13 @@ export interface GamesApiResponse<T> {
|
|
|
443
443
|
* GamePickRequestParams describes the base parameters required for GamePick API calls
|
|
444
444
|
*/
|
|
445
445
|
export interface GamePickRequestParams {
|
|
446
|
-
/** ID of the MatchX or Quiz game template */
|
|
446
|
+
/** ID of the MatchX or Quiz game template. The only field the consumer supplies. */
|
|
447
447
|
saw_template_id: number;
|
|
448
|
-
/** External user ID */
|
|
449
|
-
ext_user_id
|
|
450
|
-
/**
|
|
451
|
-
smartico_ext_user_id
|
|
452
|
-
/** Language code for translations (e.g. 'EN', 'DE') */
|
|
448
|
+
/** External user ID. Injected by the SDK from the active session; consumers omit it. */
|
|
449
|
+
ext_user_id?: string;
|
|
450
|
+
/** Platform external user ID. Injected by the SDK from the active session; consumers omit it. */
|
|
451
|
+
smartico_ext_user_id?: string;
|
|
452
|
+
/** Language code for translations (e.g. 'EN', 'DE'). Defaults to the session language. */
|
|
453
453
|
lang?: string;
|
|
454
454
|
}
|
|
455
455
|
/**
|
package/dist/Level/Level.d.ts
CHANGED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { WSAPI } from './WSAPI/WSAPI';
|
|
2
|
+
import type { PublicProperties } from './Core/PublicProperties';
|
|
3
|
+
/**
|
|
4
|
+
* Type-only module. Contains no runtime code — interfaces, type aliases and the
|
|
5
|
+
* `declare global` augmentation below all compile to **nothing**, so importing
|
|
6
|
+
* `@smartico/public-api` for these types adds zero bytes to a consumer bundle.
|
|
7
|
+
*
|
|
8
|
+
* It exists so that any TypeScript app embedding the Smartico SDK gets the global
|
|
9
|
+
* `window._smartico` object fully typed *without hand-redeclaring it*. The two
|
|
10
|
+
* heaviest members — `api` and `vapi` — resolve to the real {@link WSAPI} class
|
|
11
|
+
* exported by this same package, so they can never drift out of sync with the SDK
|
|
12
|
+
* the way a hand-copied subset does.
|
|
13
|
+
*
|
|
14
|
+
* The `_smartico` object itself is implemented in the tracker bundle
|
|
15
|
+
* (`window._smartico`) and is loaded on the page by the Smartico embed snippet.
|
|
16
|
+
* This file only describes its *shape*; it does not provide an implementation.
|
|
17
|
+
*
|
|
18
|
+
* @document docs/SmarticoObject.md
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Widget kinds accepted by {@link SmarticoGlobal.showWidget}. Mirrors the widget
|
|
22
|
+
* set the SDK supports; values are stable string identifiers.
|
|
23
|
+
*/
|
|
24
|
+
export type SmarticoWidgetType = 'achievements' | 'short_info' | 'tournaments' | 'store' | 'inbox' | 'missions' | 'mini-game' | 'match-x-2' | 'quiz' | 'custom-section' | 'inbox-widget' | 'ui-widget' | 'liquid';
|
|
25
|
+
/** Presentation options for {@link SmarticoGlobal.showWidget} / {@link SmarticoGlobal.miniGame}. */
|
|
26
|
+
export interface SmarticoWidgetParams {
|
|
27
|
+
/** Theme name to render the widget with. */
|
|
28
|
+
theme?: string;
|
|
29
|
+
/** `'auto'` to size to content, or an explicit CSS height. */
|
|
30
|
+
height?: 'auto' | string;
|
|
31
|
+
/** Render inline instead of as an overlay. */
|
|
32
|
+
inline?: boolean;
|
|
33
|
+
/** Zoom factor applied to the widget iframe. */
|
|
34
|
+
zoom?: number;
|
|
35
|
+
/** Force the mobile layout regardless of viewport. */
|
|
36
|
+
force_mobile?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Options passed to {@link SmarticoGlobal.init} / {@link SmarticoGlobal.initVisitorMode}.
|
|
40
|
+
* All fields are optional; only `brand_key` is commonly set.
|
|
41
|
+
*/
|
|
42
|
+
export interface SmarticoInitParams {
|
|
43
|
+
/** Brand key for multi-brand labels. */
|
|
44
|
+
brand_key?: string | null;
|
|
45
|
+
/** Enable verbose SDK logging. */
|
|
46
|
+
debug?: boolean;
|
|
47
|
+
/** Initial UI language (e.g. `'EN'`). */
|
|
48
|
+
lang?: string;
|
|
49
|
+
/** Override the SDK WebSocket endpoint. */
|
|
50
|
+
ws_url?: string | null;
|
|
51
|
+
/** Allow additional forward-compatible init options. */
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The global `_smartico` object exposed by the Smartico embed on `window`.
|
|
56
|
+
*
|
|
57
|
+
* `api` and `vapi` are the {@link WSAPI} surface documented across this package's
|
|
58
|
+
* API reference; every other member is a core SDK control method implemented in
|
|
59
|
+
* the tracker bundle (see the `_smartico` object reference doc).
|
|
60
|
+
*
|
|
61
|
+
* @document docs/SmarticoObject.md
|
|
62
|
+
*/
|
|
63
|
+
export interface SmarticoGlobal {
|
|
64
|
+
/**
|
|
65
|
+
* The authenticated WebSocket API surface (`_smartico.api.*`). Available once
|
|
66
|
+
* the SDK has initialized and identified the user — gate calls on
|
|
67
|
+
* {@link SmarticoGlobal.checkSuccessfullyIdentify}.
|
|
68
|
+
*/
|
|
69
|
+
api: WSAPI;
|
|
70
|
+
/**
|
|
71
|
+
* Visitor-mode (unauthenticated) API surface for the given language. Returns a
|
|
72
|
+
* {@link WSAPI} scoped to anonymous visitors.
|
|
73
|
+
*/
|
|
74
|
+
vapi(language: string): WSAPI;
|
|
75
|
+
/**
|
|
76
|
+
* `true` once the SDK is initialized **and** the user has been successfully
|
|
77
|
+
* identified. Use as a synchronous gate before calling any `api.*` method.
|
|
78
|
+
*/
|
|
79
|
+
checkSuccessfullyIdentify(): boolean;
|
|
80
|
+
/** Initialize the SDK for an identified integration. */
|
|
81
|
+
init(labelApiKey: string, params?: SmarticoInitParams): void;
|
|
82
|
+
/** Initialize the SDK in visitor (anonymous) mode. */
|
|
83
|
+
initVisitorMode(labelApiKey: string, params?: SmarticoInitParams): void;
|
|
84
|
+
/** Identify the current user against the label. */
|
|
85
|
+
identify(extUserId: string, hash: string, payload?: Record<string, unknown>): Promise<void>;
|
|
86
|
+
/** Mark an identified user as online for the given language. */
|
|
87
|
+
online(extUserId: string, language: string, userHash: string, payload?: Record<string, unknown>): Promise<void>;
|
|
88
|
+
/** Re-run the login flow for the current session. */
|
|
89
|
+
login(language?: string, payload?: Record<string, unknown>): void;
|
|
90
|
+
/** Log the current user out of the SDK session. */
|
|
91
|
+
logout(payload?: Record<string, unknown>): void;
|
|
92
|
+
/** Clear SDK state/cookies. */
|
|
93
|
+
clear(params?: Record<string, unknown>): void;
|
|
94
|
+
/** Switch the active UI language. */
|
|
95
|
+
changeLanguage(language: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Subscribe to a lifecycle/engagement callback. Pass `null` as the handler to
|
|
98
|
+
* unsubscribe. See the callbacks reference for available keys.
|
|
99
|
+
*/
|
|
100
|
+
on(event: string, cb: null | ((...args: any[]) => void), params?: Record<string, unknown>): void;
|
|
101
|
+
/** Remove a previously registered callback. */
|
|
102
|
+
off(event: string, cb: null | ((...args: any[]) => void)): void;
|
|
103
|
+
/** Trigger a Smartico deep link. */
|
|
104
|
+
dp(deepLink: string): void;
|
|
105
|
+
/** Open a Smartico widget overlay/inline. */
|
|
106
|
+
showWidget(widgetType: SmarticoWidgetType, params?: SmarticoWidgetParams): void;
|
|
107
|
+
/** Open a mini-game widget for the given template. */
|
|
108
|
+
miniGame(sawTemplateId: string, params: SmarticoWidgetParams, pendingMessageId?: string | number): void;
|
|
109
|
+
/** Render a banner into a host element. */
|
|
110
|
+
showBanner(params: {
|
|
111
|
+
dom_id: string;
|
|
112
|
+
placement_key: string;
|
|
113
|
+
}): void;
|
|
114
|
+
/** Push data into an already-rendered banner. */
|
|
115
|
+
sendDataToBanner(params: {
|
|
116
|
+
placement_key: string;
|
|
117
|
+
data: Record<string, unknown>;
|
|
118
|
+
}): void;
|
|
119
|
+
/** Embed the gamification block into a host element. */
|
|
120
|
+
gamificationBlock(params: {
|
|
121
|
+
dom_id: string;
|
|
122
|
+
url: string;
|
|
123
|
+
fit?: 'content' | 'fill';
|
|
124
|
+
}): void;
|
|
125
|
+
/** Snapshot of the user's public gamification properties. */
|
|
126
|
+
getPublicProps(): PublicProperties;
|
|
127
|
+
/** Add/remove/replace/clear the user's public tags. */
|
|
128
|
+
updatePublicTags(operation: 'add' | 'remove' | 'replace' | 'clear', tags?: string[]): void;
|
|
129
|
+
/** Set UTM attribution for the session. */
|
|
130
|
+
setUTMs(source: string, campaign: string): void;
|
|
131
|
+
/** Record the last login entry point. */
|
|
132
|
+
setLoginEntry(entry: string): void;
|
|
133
|
+
/** Set the user's avatar. */
|
|
134
|
+
setAvatar(avatarId: string): void;
|
|
135
|
+
/** Set the user's nickname. */
|
|
136
|
+
setNickname(nickname: string): void;
|
|
137
|
+
/** Set the active UI skin. */
|
|
138
|
+
setSkin(skinName: string): void;
|
|
139
|
+
/** Prompt the browser for web-push permission. */
|
|
140
|
+
requestPushPermissions(): void;
|
|
141
|
+
/** Register a native push token (mobile webviews). */
|
|
142
|
+
registerNativePushToken(token: string, platform?: number, appPackageId?: string): void;
|
|
143
|
+
/** Send a client event. */
|
|
144
|
+
event(eventType: string, payload?: Record<string, unknown>): void;
|
|
145
|
+
/** Send a client action. */
|
|
146
|
+
action(actionValue: unknown, extraPayload?: Record<string, unknown>): void;
|
|
147
|
+
/** Report a client-side error to the server. */
|
|
148
|
+
sendServerError(message: string): void;
|
|
149
|
+
/** Send a client-side debug message to the server. */
|
|
150
|
+
sendServerDebug(message: string): void;
|
|
151
|
+
/** Temporarily suspend/resume automatic popups. */
|
|
152
|
+
suspendPopups(flag: boolean): void;
|
|
153
|
+
/** Temporarily suspend/resume the inbox. */
|
|
154
|
+
suspendInbox(flag: boolean): void;
|
|
155
|
+
/** Temporarily suspend/resume mini-games. */
|
|
156
|
+
suspendMiniGames(flag: boolean): void;
|
|
157
|
+
/** Show a visitor-mode game. */
|
|
158
|
+
showVisitorGame(params: Record<string, unknown>): void;
|
|
159
|
+
/** Convert a visitor-mode win into an identified reward. */
|
|
160
|
+
convertVisitorGame(visitorWinUuid: string): void;
|
|
161
|
+
/** Start landing-page analytics for a template. */
|
|
162
|
+
startLpAnalytics(params: {
|
|
163
|
+
lp_template_uuid: string;
|
|
164
|
+
shadow_root?: ShadowRoot | null;
|
|
165
|
+
}): void;
|
|
166
|
+
/** Send a landing-page analytics activity. */
|
|
167
|
+
sendAnalytics(activityId: number, viewTimeSec?: number): void;
|
|
168
|
+
/** `true` on mobile viewports. */
|
|
169
|
+
isMobile(): boolean;
|
|
170
|
+
/** Parse the current URL query into a map. */
|
|
171
|
+
parseUrl(): Record<string, string>;
|
|
172
|
+
/** Parse the current URL hash into a map. */
|
|
173
|
+
parseUrlHash(): Record<string, string>;
|
|
174
|
+
}
|
|
175
|
+
declare global {
|
|
176
|
+
interface Window {
|
|
177
|
+
/**
|
|
178
|
+
* Params injected by the Smartico widget runtime (`widget.js`) when a widget
|
|
179
|
+
* is embedded via `_smartico.showWidget` / a widget script tag. Keys mirror
|
|
180
|
+
* the params passed in the embedding snippet (e.g. `id`).
|
|
181
|
+
*/
|
|
182
|
+
__SMARTICO_LP_PARAMS__?: Record<string, string | number>;
|
|
183
|
+
/**
|
|
184
|
+
* The global Smartico SDK object, present once the embed snippet has loaded.
|
|
185
|
+
* Optional because it is `undefined` until the script initializes — guard
|
|
186
|
+
* access (`window._smartico?.…`) or gate on `checkSuccessfullyIdentify()`.
|
|
187
|
+
*/
|
|
188
|
+
_smartico?: SmarticoGlobal;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -276,9 +276,9 @@ export declare class WSAPIGamePick extends WSAPIAvatars {
|
|
|
276
276
|
* **Side effects**
|
|
277
277
|
* - First successful submit deducts the buy-in (Points / Gems / Diamonds /
|
|
278
278
|
* one Spin) per `saw_buyin_type_id`.
|
|
279
|
-
* -
|
|
280
|
-
*
|
|
281
|
-
*
|
|
279
|
+
* - Records the user's participation against the round and its events
|
|
280
|
+
* server-side and reports a prediction event to the operator's activity
|
|
281
|
+
* stream.
|
|
282
282
|
* - Score is awarded after the operator resolves the round
|
|
283
283
|
* ({@link GPRoundStatus} = `RoundResolved`).
|
|
284
284
|
*
|
|
@@ -370,9 +370,9 @@ export declare class WSAPIGamePick extends WSAPIAvatars {
|
|
|
370
370
|
* **Idempotency**: identical to {@link gamePickSubmitSelection} — re-submit
|
|
371
371
|
* returns `errCode: 3` and never double-charges the buy-in.
|
|
372
372
|
*
|
|
373
|
-
* **Side effects**: identical to {@link gamePickSubmitSelection}
|
|
374
|
-
*
|
|
375
|
-
*
|
|
373
|
+
* **Side effects**: identical to {@link gamePickSubmitSelection} — buy-in
|
|
374
|
+
* deduction on first submit, participation recorded, score awarded on round
|
|
375
|
+
* resolution.
|
|
376
376
|
*
|
|
377
377
|
* **Visitor mode**: not supported.
|
|
378
378
|
*
|
|
@@ -383,63 +383,76 @@ export declare class WSAPIMiniGames extends WSAPIRaffles {
|
|
|
383
383
|
acknowledge?: boolean;
|
|
384
384
|
}): Promise<TMiniGamePlayResult>;
|
|
385
385
|
/**
|
|
386
|
-
* Manually acknowledges a mini-game spin — marks the
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
386
|
+
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
387
|
+
* server-side. Most consumers do NOT need this: {@link playMiniGame}
|
|
388
|
+
* acknowledges by default (`acknowledge: true`) and
|
|
389
|
+
* {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
390
|
+
* directly only when you took ownership of the acknowledge step or
|
|
391
|
+
* need to recover a lost one.
|
|
391
392
|
*
|
|
392
393
|
* @remarks
|
|
393
394
|
* **When to call**
|
|
394
|
-
* - **
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
* spin
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
395
|
+
* - **Primary — after `playMiniGame(..., { acknowledge: false })`.**
|
|
396
|
+
* You opted out of the automatic acknowledge to finalise the win
|
|
397
|
+
* on your own schedule (e.g. on a user "Claim" tap). Pass the
|
|
398
|
+
* `request_id` from that call's result here when ready. This is
|
|
399
|
+
* REQUIRED for operator-configured "explicit claim" prizes — they
|
|
400
|
+
* are not covered by the server-side fallback, so without this
|
|
401
|
+
* call their prize is never credited.
|
|
402
|
+
* - **Recovery — a lost acknowledge.** {@link playMiniGameBatch}
|
|
403
|
+
* acknowledges on a fire-and-forget basis; if one is lost (network
|
|
404
|
+
* drop) the spin shows `is_claimed: false` in
|
|
405
|
+
* {@link getMiniGamesHistory}. Pass that row's `client_request_id`
|
|
406
|
+
* to deliver it.
|
|
407
|
+
*
|
|
408
|
+
* The `request_id` on a {@link playMiniGame} result and the
|
|
409
|
+
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
410
|
+
* same correlation id — this method accepts either.
|
|
411
|
+
*
|
|
412
|
+
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
413
|
+
* finalised — by you, by the automatic acknowledge, or by the
|
|
414
|
+
* fallback — is a no-op with no double credit. Acknowledging a
|
|
415
|
+
* failed spin's id is likewise a no-op.
|
|
408
416
|
*
|
|
409
417
|
* **Server-side fallback**
|
|
410
|
-
* Even
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
* spin
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* - The spin's `is_claimed`
|
|
423
|
-
* {@link getMiniGamesHistory}
|
|
418
|
+
* Even if you never call this, a server-side job finalises ordinary
|
|
419
|
+
* un-acknowledged spins automatically after a short delay (about 1–3
|
|
420
|
+
* minutes), flipping `is_claimed` to `true` on the next
|
|
421
|
+
* {@link getMiniGamesHistory} fetch. "Explicit claim" prizes are the
|
|
422
|
+
* exception — excluded from the fallback, they require an explicit
|
|
423
|
+
* call here.
|
|
424
|
+
*
|
|
425
|
+
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
426
|
+
* - For "explicit claim" prizes, the prize value is credited on this
|
|
427
|
+
* call. For standard prizes the value was already credited at spin
|
|
428
|
+
* time (see {@link playMiniGame} "Prize handling"); this call only
|
|
429
|
+
* marks the win delivered.
|
|
430
|
+
* - The spin's `is_claimed` flips to `true` on the next
|
|
431
|
+
* {@link getMiniGamesHistory} fetch.
|
|
424
432
|
*
|
|
425
433
|
* **Visitor mode**: not supported.
|
|
426
434
|
*
|
|
427
|
-
* @param request_id
|
|
428
|
-
*
|
|
435
|
+
* @param request_id Correlation id of the spin to finalise: the
|
|
436
|
+
* `request_id` from a {@link playMiniGame} result
|
|
437
|
+
* (played with `acknowledge: false`), or the
|
|
438
|
+
* `client_request_id` of a
|
|
439
|
+
* {@link getMiniGamesHistory} row.
|
|
429
440
|
*
|
|
430
441
|
* @example
|
|
431
442
|
* ```ts
|
|
432
|
-
*
|
|
433
|
-
* const
|
|
443
|
+
* // Primary — finalise a win you played with acknowledge: false.
|
|
444
|
+
* const r = await window._smartico.api.playMiniGame(templateId, { acknowledge: false });
|
|
445
|
+
* if (r.err_code === 0) {
|
|
446
|
+
* console.log('[smartico] show the prize / Claim CTA; on Claim, finalise the win');
|
|
447
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
448
|
+
* }
|
|
434
449
|
*
|
|
435
|
-
*
|
|
450
|
+
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
451
|
+
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
452
|
+
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
436
453
|
* console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
|
|
437
454
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
438
455
|
* }
|
|
439
|
-
*
|
|
440
|
-
* // Re-fetch history to see the updated is_claimed flags.
|
|
441
|
-
* const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
442
|
-
* console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
|
|
443
456
|
* ```
|
|
444
457
|
*/
|
|
445
458
|
miniGameWinAcknowledgeRequest(request_id: string): Promise<import("../MiniGames").SAWDoAknowledgeResponse>;
|
|
@@ -99,9 +99,9 @@ export interface TMiniGamePlayResult {
|
|
|
99
99
|
* slot). Always populated, even when `err_code !== 0`. */
|
|
100
100
|
prize_id: number;
|
|
101
101
|
/** Correlation id of this spin. Pass it to
|
|
102
|
-
*
|
|
102
|
+
* `miniGameWinAcknowledgeRequest` to finalise the win when
|
|
103
103
|
* playing with `acknowledge: false` — no need to look it up via
|
|
104
|
-
*
|
|
104
|
+
* `getMiniGamesHistory`. */
|
|
105
105
|
request_id: string;
|
|
106
106
|
}
|
|
107
107
|
/**
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -7533,63 +7533,76 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7533
7533
|
}
|
|
7534
7534
|
}
|
|
7535
7535
|
/**
|
|
7536
|
-
* Manually acknowledges a mini-game spin — marks the
|
|
7537
|
-
*
|
|
7538
|
-
*
|
|
7539
|
-
*
|
|
7540
|
-
*
|
|
7536
|
+
* Manually acknowledges a mini-game spin — marks the win delivered
|
|
7537
|
+
* server-side. Most consumers do NOT need this: {@link playMiniGame}
|
|
7538
|
+
* acknowledges by default (`acknowledge: true`) and
|
|
7539
|
+
* {@link playMiniGameBatch} acknowledges automatically. Call this
|
|
7540
|
+
* directly only when you took ownership of the acknowledge step or
|
|
7541
|
+
* need to recover a lost one.
|
|
7541
7542
|
*
|
|
7542
7543
|
* @remarks
|
|
7543
7544
|
* **When to call**
|
|
7544
|
-
* - **
|
|
7545
|
-
*
|
|
7546
|
-
*
|
|
7547
|
-
*
|
|
7548
|
-
*
|
|
7549
|
-
*
|
|
7550
|
-
*
|
|
7551
|
-
*
|
|
7552
|
-
*
|
|
7553
|
-
* spin
|
|
7554
|
-
*
|
|
7555
|
-
*
|
|
7556
|
-
*
|
|
7557
|
-
*
|
|
7545
|
+
* - **Primary — after `playMiniGame(..., { acknowledge: false })`.**
|
|
7546
|
+
* You opted out of the automatic acknowledge to finalise the win
|
|
7547
|
+
* on your own schedule (e.g. on a user "Claim" tap). Pass the
|
|
7548
|
+
* `request_id` from that call's result here when ready. This is
|
|
7549
|
+
* REQUIRED for operator-configured "explicit claim" prizes — they
|
|
7550
|
+
* are not covered by the server-side fallback, so without this
|
|
7551
|
+
* call their prize is never credited.
|
|
7552
|
+
* - **Recovery — a lost acknowledge.** {@link playMiniGameBatch}
|
|
7553
|
+
* acknowledges on a fire-and-forget basis; if one is lost (network
|
|
7554
|
+
* drop) the spin shows `is_claimed: false` in
|
|
7555
|
+
* {@link getMiniGamesHistory}. Pass that row's `client_request_id`
|
|
7556
|
+
* to deliver it.
|
|
7557
|
+
*
|
|
7558
|
+
* The `request_id` on a {@link playMiniGame} result and the
|
|
7559
|
+
* `client_request_id` on a {@link getMiniGamesHistory} row are the
|
|
7560
|
+
* same correlation id — this method accepts either.
|
|
7561
|
+
*
|
|
7562
|
+
* **Idempotency**: safe. Acknowledging a spin that is already
|
|
7563
|
+
* finalised — by you, by the automatic acknowledge, or by the
|
|
7564
|
+
* fallback — is a no-op with no double credit. Acknowledging a
|
|
7565
|
+
* failed spin's id is likewise a no-op.
|
|
7558
7566
|
*
|
|
7559
7567
|
* **Server-side fallback**
|
|
7560
|
-
* Even
|
|
7561
|
-
*
|
|
7562
|
-
*
|
|
7563
|
-
*
|
|
7564
|
-
*
|
|
7565
|
-
*
|
|
7566
|
-
*
|
|
7567
|
-
*
|
|
7568
|
-
*
|
|
7569
|
-
* spin
|
|
7570
|
-
*
|
|
7571
|
-
*
|
|
7572
|
-
* - The spin's `is_claimed`
|
|
7573
|
-
* {@link getMiniGamesHistory}
|
|
7568
|
+
* Even if you never call this, a server-side job finalises ordinary
|
|
7569
|
+
* un-acknowledged spins automatically after a short delay (about 1–3
|
|
7570
|
+
* minutes), flipping `is_claimed` to `true` on the next
|
|
7571
|
+
* {@link getMiniGamesHistory} fetch. "Explicit claim" prizes are the
|
|
7572
|
+
* exception — excluded from the fallback, they require an explicit
|
|
7573
|
+
* call here.
|
|
7574
|
+
*
|
|
7575
|
+
* **Side effects** (first successful call for an un-acknowledged spin)
|
|
7576
|
+
* - For "explicit claim" prizes, the prize value is credited on this
|
|
7577
|
+
* call. For standard prizes the value was already credited at spin
|
|
7578
|
+
* time (see {@link playMiniGame} "Prize handling"); this call only
|
|
7579
|
+
* marks the win delivered.
|
|
7580
|
+
* - The spin's `is_claimed` flips to `true` on the next
|
|
7581
|
+
* {@link getMiniGamesHistory} fetch.
|
|
7574
7582
|
*
|
|
7575
7583
|
* **Visitor mode**: not supported.
|
|
7576
7584
|
*
|
|
7577
|
-
* @param request_id
|
|
7578
|
-
*
|
|
7585
|
+
* @param request_id Correlation id of the spin to finalise: the
|
|
7586
|
+
* `request_id` from a {@link playMiniGame} result
|
|
7587
|
+
* (played with `acknowledge: false`), or the
|
|
7588
|
+
* `client_request_id` of a
|
|
7589
|
+
* {@link getMiniGamesHistory} row.
|
|
7579
7590
|
*
|
|
7580
7591
|
* @example
|
|
7581
7592
|
* ```ts
|
|
7582
|
-
*
|
|
7583
|
-
* const
|
|
7593
|
+
* // Primary — finalise a win you played with acknowledge: false.
|
|
7594
|
+
* const r = await window._smartico.api.playMiniGame(templateId, { acknowledge: false });
|
|
7595
|
+
* if (r.err_code === 0) {
|
|
7596
|
+
* console.log('[smartico] show the prize / Claim CTA; on Claim, finalise the win');
|
|
7597
|
+
* await window._smartico.api.miniGameWinAcknowledgeRequest(r.request_id);
|
|
7598
|
+
* }
|
|
7584
7599
|
*
|
|
7585
|
-
*
|
|
7600
|
+
* // Recovery — re-acknowledge any spins a batch acknowledge missed.
|
|
7601
|
+
* const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7602
|
+
* for (const row of history.filter(h => !h.is_claimed)) {
|
|
7586
7603
|
* console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
|
|
7587
7604
|
* await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
|
|
7588
7605
|
* }
|
|
7589
|
-
*
|
|
7590
|
-
* // Re-fetch history to see the updated is_claimed flags.
|
|
7591
|
-
* const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
|
|
7592
|
-
* console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
|
|
7593
7606
|
* ```
|
|
7594
7607
|
*/
|
|
7595
7608
|
;
|
|
@@ -8561,9 +8574,9 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
|
|
|
8561
8574
|
* **Side effects**
|
|
8562
8575
|
* - First successful submit deducts the buy-in (Points / Gems / Diamonds /
|
|
8563
8576
|
* one Spin) per `saw_buyin_type_id`.
|
|
8564
|
-
* -
|
|
8565
|
-
*
|
|
8566
|
-
*
|
|
8577
|
+
* - Records the user's participation against the round and its events
|
|
8578
|
+
* server-side and reports a prediction event to the operator's activity
|
|
8579
|
+
* stream.
|
|
8567
8580
|
* - Score is awarded after the operator resolves the round
|
|
8568
8581
|
* ({@link GPRoundStatus} = `RoundResolved`).
|
|
8569
8582
|
*
|
|
@@ -8668,9 +8681,9 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
|
|
|
8668
8681
|
* **Idempotency**: identical to {@link gamePickSubmitSelection} — re-submit
|
|
8669
8682
|
* returns `errCode: 3` and never double-charges the buy-in.
|
|
8670
8683
|
*
|
|
8671
|
-
* **Side effects**: identical to {@link gamePickSubmitSelection}
|
|
8672
|
-
*
|
|
8673
|
-
*
|
|
8684
|
+
* **Side effects**: identical to {@link gamePickSubmitSelection} — buy-in
|
|
8685
|
+
* deduction on first submit, participation recorded, score awarded on round
|
|
8686
|
+
* resolution.
|
|
8674
8687
|
*
|
|
8675
8688
|
* **Visitor mode**: not supported.
|
|
8676
8689
|
*
|
|
@@ -11668,10 +11681,13 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
11668
11681
|
body: JSON.stringify(params)
|
|
11669
11682
|
};
|
|
11670
11683
|
} else if (params) {
|
|
11671
|
-
var extraQuery = Object.entries(params).
|
|
11672
|
-
var
|
|
11673
|
-
|
|
11674
|
-
|
|
11684
|
+
var extraQuery = Object.entries(params).filter(function (_ref5) {
|
|
11685
|
+
var v = _ref5[1];
|
|
11686
|
+
return v !== null && v !== undefined;
|
|
11687
|
+
}).map(function (_ref6) {
|
|
11688
|
+
var k = _ref6[0],
|
|
11689
|
+
v = _ref6[1];
|
|
11690
|
+
return k + "=" + encodeURIComponent(typeof v === 'object' ? JSON.stringify(v) : v);
|
|
11675
11691
|
}).join('&');
|
|
11676
11692
|
url += "&" + extraQuery;
|
|
11677
11693
|
}
|
|
@@ -11692,9 +11708,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
11692
11708
|
return Promise.reject(e);
|
|
11693
11709
|
}
|
|
11694
11710
|
};
|
|
11695
|
-
_proto.sendAvatarApi = function sendAvatarApi(
|
|
11696
|
-
var method =
|
|
11697
|
-
body =
|
|
11711
|
+
_proto.sendAvatarApi = function sendAvatarApi(_ref7) {
|
|
11712
|
+
var method = _ref7.method,
|
|
11713
|
+
body = _ref7.body;
|
|
11698
11714
|
try {
|
|
11699
11715
|
var _this75 = this;
|
|
11700
11716
|
if (!_this75.tracker) {
|