@smartico/public-api 0.0.421 → 0.0.424
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/README.md +14 -0
- package/dist/MiniGames/SAWTemplateUI.d.ts +16 -0
- package/dist/WSAPI/WSAPITypes.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +1 -0
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
- package/src/MiniGames/SAWTemplateUI.ts +17 -0
- package/src/WSAPI/WSAPITypes.ts +2 -0
package/README.md
CHANGED
|
@@ -180,6 +180,17 @@ import { SmarticoAPI, WSAPI } from '@smartico/public-api';
|
|
|
180
180
|
|
|
181
181
|
// publicApiUrl is resolved automatically by SmarticoAPI from your label key
|
|
182
182
|
const messageSender = async (message: any, publicApiUrl?: string): Promise<any> => {
|
|
183
|
+
|
|
184
|
+
// if label has user hash protection enabled, calculate hash and add in the message, e.g.
|
|
185
|
+
const hashValidityTimestampMs = ~~(+new Date() / 1000) * 1000 + 24 * 3600 * 1000;
|
|
186
|
+
const userExtId = message.user_ext_id;
|
|
187
|
+
const saltKey = 'your_secret_salt_key_setup_on_smartico_side';
|
|
188
|
+
const hashValue = md5((userExtId + ':' + saltKey + ':' + hashValidityTimestampMs).toLowerCase()) +
|
|
189
|
+
':' +
|
|
190
|
+
hashValidityTimestampMs;
|
|
191
|
+
|
|
192
|
+
message.hash = hashValue;
|
|
193
|
+
|
|
183
194
|
const res = await fetch(publicApiUrl, {
|
|
184
195
|
method: 'POST',
|
|
185
196
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -229,6 +240,9 @@ You can make HTTP calls to the Smartico public endpoint to interact with user da
|
|
|
229
240
|
|
|
230
241
|
This example checks whether a user belongs to specific segments. It corresponds to `checkSegmentListMatch` (cid: 161 / response cid: 162) described in [Native Protocol](docs/native/PROTOCOL.md).
|
|
231
242
|
|
|
243
|
+
Note: in case your label has user hash protection enabled, you need to calculate it using secret salt key and pass it in the data under "hash" value.
|
|
244
|
+
Check for more details here - https://help.smartico.ai/welcome/technical-guides/front-end-integration/extended-integration#protecting-user-identification-on-the-public-front-end
|
|
245
|
+
|
|
232
246
|
**Request:**
|
|
233
247
|
|
|
234
248
|
```bash
|
|
@@ -374,6 +374,22 @@ export interface SAWTemplateUI {
|
|
|
374
374
|
* Back-Office label: _"Game URL"_.
|
|
375
375
|
*/
|
|
376
376
|
custom_game_url?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Whether this template is played as a custom mini-game.
|
|
379
|
+
*
|
|
380
|
+
* A template of any regular game type (wheel, scratch card, treasure hunt,
|
|
381
|
+
* …) can be switched over to a custom game while keeping its own type,
|
|
382
|
+
* prizes and buy-in settings — only the way it is played changes: the
|
|
383
|
+
* widget loads `custom_game_url` in an iframe instead of rendering the
|
|
384
|
+
* built-in game. `saw_game_type_id` still reports the original type, so
|
|
385
|
+
* treat this flag — not the type — as the answer to "is this played as a
|
|
386
|
+
* custom game", together with `SAWGameType.CustomMinigame`, which is always
|
|
387
|
+
* played that way.
|
|
388
|
+
*
|
|
389
|
+
* When `false` or omitted, the template is played as its own game type.
|
|
390
|
+
* Back-Office label: _"Use Custom Game"_.
|
|
391
|
+
*/
|
|
392
|
+
use_custom?: boolean;
|
|
377
393
|
/**
|
|
378
394
|
* Minutes for the Voyager seed window.
|
|
379
395
|
* The seed window is the range of seeds that can be used to generate the map.
|
|
@@ -205,6 +205,8 @@ export interface TMiniGameTemplate {
|
|
|
205
205
|
activeTillDate?: number;
|
|
206
206
|
/** Number of steps to complete the game and collect the prize (step games — Voyager / Treasure Hunt) */
|
|
207
207
|
steps_to_finish_game?: number;
|
|
208
|
+
/** Minimum number of path steps / collectible prizes a session must include before the game can finish (step games — Voyager / Treasure Hunt). `>= 1` and `<= steps_to_finish_game`; when omitted, no minimum is enforced */
|
|
209
|
+
min_steps_to_finish_game?: number;
|
|
208
210
|
/** ID of the operator-defined custom section (widget menu grouping) the mini-game is assigned to */
|
|
209
211
|
custom_section_id?: number;
|
|
210
212
|
/** Full raw UI definition of the mini-game (skin, colors, per-game visual settings) — see {@link SAWTemplateUI}. The commonly needed values are already lifted onto this template object */
|
package/dist/index.js
CHANGED
|
@@ -516,6 +516,7 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
|
|
|
516
516
|
earliest_expiration_dt: r.earliest_expiration_dt,
|
|
517
517
|
latest_expiration_dt: r.latest_expiration_dt,
|
|
518
518
|
steps_to_finish_game: r.saw_template_ui_definition.steps_to_finish_game,
|
|
519
|
+
min_steps_to_finish_game: r.saw_template_ui_definition.min_steps_to_finish_game,
|
|
519
520
|
custom_section_id: r.saw_template_ui_definition.custom_section_id,
|
|
520
521
|
saw_template_ui_definition: r.saw_template_ui_definition
|
|
521
522
|
}, r.saw_game_type_id === exports.SAWGameType.LootboxCalendarDays || r.saw_game_type_id === exports.SAWGameType.LootboxWeekdays ? {
|