@smartico/public-api 0.0.411 → 0.0.413
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/Jackpots/JackpotPublicMeta.d.ts +1 -1
- package/dist/Level/LevelPublicMeta.d.ts +1 -1
- package/dist/MiniGames/SAWTemplate.d.ts +2 -0
- package/dist/Raffle/Raffle.d.ts +1 -1
- package/dist/SmarticoLib/index.d.ts +3 -3
- package/dist/WSAPI/WSAPIJackpots.d.ts +3 -1
- package/dist/WSAPI/WSAPIMissions.d.ts +40 -12
- package/dist/WSAPI/WSAPITypes.d.ts +7 -5
- package/dist/index.js +47 -14
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +47 -14
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPIMissions.md +40 -12
- package/docs/api/interfaces/JackpotPublicMeta.md +1 -1
- package/docs/api/interfaces/LevelPublicMeta.md +1 -1
- package/docs/api/interfaces/RafflePublicMeta.md +1 -1
- package/docs/api/interfaces/SAWTemplate.md +8 -0
- package/docs/api/interfaces/TMissionOrBadge.md +6 -4
- package/docs/api/interfaces/TRaffle.md +1 -1
- package/docs/capabilities/getBadges.md +4 -4
- package/docs/capabilities/getMissions.md +44 -16
- package/docs/capabilities/getRaffles.md +1 -1
- package/docs/capabilities/jackpotGet.md +1 -1
- package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +3 -2
- package/docs/ui/missions/UIGuide_getMissions.md +44 -24
- package/package.json +1 -1
- package/src/Jackpots/JackpotPublicMeta.ts +1 -1
- package/src/Level/LevelPublicMeta.ts +1 -1
- package/src/MiniGames/SAWTemplate.ts +2 -0
- package/src/Raffle/Raffle.ts +1 -1
- package/src/SmarticoLib/index.ts +3 -3
- package/src/WSAPI/WSAPIJackpots.ts +7 -2
- package/src/WSAPI/WSAPIMissions.ts +40 -12
- package/src/WSAPI/WSAPITypes.ts +7 -5
|
@@ -17,7 +17,7 @@ interface JackpotPublicMeta {
|
|
|
17
17
|
/**
|
|
18
18
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
19
19
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
20
|
-
* Read more here - <https://help.smartico.ai/welcome/products/
|
|
20
|
+
* Read more here - <https://help.smartico.ai/welcome/products/tools-and-guides/custom-fields-attributes>
|
|
21
21
|
*/
|
|
22
22
|
custom_data: string;
|
|
23
23
|
}
|
|
@@ -17,7 +17,7 @@ export interface LevelPublicMeta {
|
|
|
17
17
|
/**
|
|
18
18
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
19
19
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
20
|
-
* Read more here - https://help.smartico.ai/welcome/products/
|
|
20
|
+
* Read more here - https://help.smartico.ai/welcome/products/tools-and-guides/custom-fields-attributes
|
|
21
21
|
*/
|
|
22
22
|
custom_data?: string;
|
|
23
23
|
}
|
|
@@ -56,6 +56,8 @@ export interface SAWTemplate {
|
|
|
56
56
|
expose_game_stat_on_api?: boolean;
|
|
57
57
|
/** Prize Drop only: when true, the pushed prize requires an explicit claim by the user before it is credited */
|
|
58
58
|
requires_prize_claim?: boolean;
|
|
59
|
+
/** Prize Drop only: when true, the pushed prize requires a manual claim by the user before it is credited. The difference between this and `requires_prize_claim` is that requires_manual_claim gives the user the ability to cancel the claim. */
|
|
60
|
+
requires_manual_claim?: boolean;
|
|
59
61
|
/** Timezone offset in minutes used to evaluate the template's period-based rules (UTC minus local, as in JS `Date.getTimezoneOffset()`) */
|
|
60
62
|
relative_period_timezone?: number;
|
|
61
63
|
/** Operator setting: show a prize-history entry point (icon / button) on this game's view */
|
package/dist/Raffle/Raffle.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ interface RafflePublicMeta {
|
|
|
23
23
|
/**
|
|
24
24
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
25
25
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
26
|
-
* Read more here - <https://help.smartico.ai/welcome/products/
|
|
26
|
+
* Read more here - <https://help.smartico.ai/welcome/products/tools-and-guides/custom-fields-attributes>
|
|
27
27
|
*/
|
|
28
28
|
custom_data: string;
|
|
29
29
|
/**
|
|
@@ -854,21 +854,21 @@ export interface TLevel {
|
|
|
854
854
|
/**
|
|
855
855
|
* The counter of 1st metric used to reach the Level.
|
|
856
856
|
* Relevant in case of using advanced leveling logic
|
|
857
|
-
* https://help.smartico.ai/welcome/
|
|
857
|
+
* https://help.smartico.ai/welcome/products/release-notes/september-2022#new-logic-for-leveling-users
|
|
858
858
|
*
|
|
859
859
|
*/
|
|
860
860
|
required_level_counter_1: number;
|
|
861
861
|
/**
|
|
862
862
|
* The counter of 2nd metric used to reach the Level.
|
|
863
863
|
* Relevant in case of using advanced leveling logic
|
|
864
|
-
* https://help.smartico.ai/welcome/
|
|
864
|
+
* https://help.smartico.ai/welcome/products/release-notes/september-2022#new-logic-for-leveling-users
|
|
865
865
|
*
|
|
866
866
|
*/
|
|
867
867
|
required_level_counter_2: number;
|
|
868
868
|
/**
|
|
869
869
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
870
870
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
871
|
-
* Read more here - https://help.smartico.ai/welcome/products/
|
|
871
|
+
* Read more here - https://help.smartico.ai/welcome/products/tools-and-guides/custom-fields-attributes
|
|
872
872
|
*/
|
|
873
873
|
custom_data: string;
|
|
874
874
|
}
|
|
@@ -245,7 +245,9 @@ export declare class WSAPIJackpots extends WSAPIClans {
|
|
|
245
245
|
* user-currency display is needed, the consumer must convert client-side.
|
|
246
246
|
*
|
|
247
247
|
* **Refresh**
|
|
248
|
-
* - The SDK caches per `jp_template_id`
|
|
248
|
+
* - The SDK caches each page separately (per `jp_template_id` +
|
|
249
|
+
* `limit` + `offset`) for 30 seconds, so paging back and forth is
|
|
250
|
+
* served from cache and each page keeps its own fresh copy.
|
|
249
251
|
* - Caches clear on jackpot-win push events and on opt-in / opt-out.
|
|
250
252
|
*
|
|
251
253
|
* **Error handling**
|
|
@@ -55,18 +55,46 @@ export declare class WSAPIMissions extends WSAPIGeneral {
|
|
|
55
55
|
* `only_in_custom_section: true` are intended for their custom-section
|
|
56
56
|
* view only and should be hidden from the main mission list.
|
|
57
57
|
*
|
|
58
|
-
* **
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
58
|
+
* **Status bucketing (which tab / section a mission belongs to)**
|
|
59
|
+
* There is no pre-computed bucket field — assign each mission to exactly
|
|
60
|
+
* ONE section reading the raw state fields directly (NOT `availability_status`;
|
|
61
|
+
* see "Timers" below). Priority order, FIRST match wins:
|
|
62
|
+
* 1. **Missed / Expired** — not completed and the window has closed:
|
|
63
|
+
* `!is_completed && ((time_limit_ms && dt_start && dt_start + time_limit_ms < Date.now())`
|
|
64
|
+
* `|| (active_till_ts && active_till_ts < Date.now()))`. Do NOT gate this on
|
|
65
|
+
* opt-in — an opt-in mission whose window closed before the user ever
|
|
66
|
+
* opted in is still Missed. Sort by `position` ASC.
|
|
67
|
+
* 2. **Completed** — `is_completed === true`, OR (recurring-upon-completion
|
|
68
|
+
* missions) at least one cycle done / the cap reached — see the recurring
|
|
69
|
+
* caveats below. Sort by `complete_date_ts` DESC.
|
|
70
|
+
* 3. **Locked** — `is_locked === true`, OR not yet started
|
|
71
|
+
* (`active_from_ts > Date.now()`). Sort by `position` ASC.
|
|
72
|
+
* 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
|
|
73
|
+
* `progress > 0`). Sort by `position` ASC.
|
|
74
|
+
* 5. **Available** — everything else (opt-in required but not yet joined, or
|
|
75
|
+
* an unrestricted mission not yet started). Sort by `position` ASC.
|
|
76
|
+
*
|
|
77
|
+
* **Recurring-upon-completion caveats** (the common mis-bucketing trap):
|
|
78
|
+
* - `is_completed` NEVER flips true for a recurring-upon-completion mission
|
|
79
|
+
* (only for one-shot missions) — detect a completed cycle from
|
|
80
|
+
* `completion_count > 0`, not `is_completed`.
|
|
81
|
+
* - A non-null `completion_count` is what identifies a recurring-upon-completion
|
|
82
|
+
* mission. `max_completion_count === null` means an INFINITE cap (still
|
|
83
|
+
* recurring — never read null as "not recurring"), so only test
|
|
84
|
+
* `completion_count >= max_completion_count` when `max_completion_count` is set.
|
|
85
|
+
*
|
|
86
|
+
* **Timers & timestamps** (display only — NOT bucketing)
|
|
87
|
+
* `availability_status` (enum {@link AchievementAvailabilityStatus}) is the
|
|
88
|
+
* timer/window signal: use it to pick WHICH countdown to show and whether the
|
|
89
|
+
* window has elapsed — NOT to choose the section. It does not read
|
|
90
|
+
* `completion_count`, and between cycles the server may keep reporting the
|
|
91
|
+
* just-elapsed cycle's `Missed*` value even after `dt_start` / `active_till_ts`
|
|
92
|
+
* are cleared for the next attempt, so bucketing by it sends recurring missions
|
|
93
|
+
* to the wrong tab. For time-limited / opt-in missions `dt_start` is the opt-in
|
|
94
|
+
* timestamp (or unlock timestamp for previously-locked missions), and a
|
|
95
|
+
* time-limited mission expires at `dt_start + time_limit_ms`.
|
|
96
|
+
* `next_recurrence_date_ts` is populated for `RECURRING` / `RECURRING_QUANTITY`
|
|
97
|
+
* missions but is no longer meaningful once `active_till_ts` has passed.
|
|
70
98
|
*
|
|
71
99
|
* **Refresh after a mutation**
|
|
72
100
|
* After `requestMissionOptIn(...)` or `requestMissionClaimReward(...)`
|
|
@@ -826,7 +826,9 @@ export interface TMissionOrBadge {
|
|
|
826
826
|
reward: string;
|
|
827
827
|
/** URL of the image of the mission or badge, 256x256px */
|
|
828
828
|
image: string;
|
|
829
|
-
/** Indicator if the mission is completed or badge is granted
|
|
829
|
+
/** Indicator if the mission is completed or badge is granted. Stays `false` for
|
|
830
|
+
* Recurring-upon-completion missions even after cycles complete — use `completion_count`
|
|
831
|
+
* to detect completed cycles (see `getMissions` bucketing). */
|
|
830
832
|
is_completed: boolean;
|
|
831
833
|
/** Indicator if the mission is locked. Means that it's visible to the user, but he cannot progress in it until it's unlocked.
|
|
832
834
|
* Mission may optionally contain the explanation of what should be done to unlock it in the unlock_mission_description property
|
|
@@ -898,15 +900,15 @@ export interface TMissionOrBadge {
|
|
|
898
900
|
completed_this_month?: boolean;
|
|
899
901
|
/** ID of specific Custom Section type */
|
|
900
902
|
custom_section_type_id?: number;
|
|
901
|
-
/** Max number of times the user can complete a mission in case if mission type is Recurring upon completion. NULL equals infinite. */
|
|
903
|
+
/** Max number of times the user can complete a mission in case if mission type is Recurring upon completion. NULL equals infinite (still recurring — not "no cap disables recurring"). */
|
|
902
904
|
max_completion_count?: number;
|
|
903
|
-
/** Current completion count for Recurring
|
|
905
|
+
/** Current completion count for Recurring-upon-completion missions. Non-null ONLY for that mission type, so its presence identifies one; `> 0` means at least one cycle completed. */
|
|
904
906
|
completion_count?: number;
|
|
905
907
|
/** The date/timestamp for recurring missions, which indicating the time remaining until the next recurrence of the mission.
|
|
906
908
|
* Note that if a mission has an "Active till" date defined, this field is not relevant after that date.
|
|
907
909
|
*/
|
|
908
910
|
next_recurrence_date_ts?: number;
|
|
909
|
-
/**
|
|
911
|
+
/** Timer/window state derived from the mission's time limits (which countdown to show / whether the window elapsed). NOT a tab-bucketing signal — it ignores `completion_count`, so bucket sections from the raw fields instead (see `getMissions`). */
|
|
910
912
|
availability_status?: AchievementAvailabilityStatus;
|
|
911
913
|
/** Title for the claim reward button */
|
|
912
914
|
claim_button_title?: string;
|
|
@@ -1343,7 +1345,7 @@ export interface TRaffle {
|
|
|
1343
1345
|
/**
|
|
1344
1346
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
1345
1347
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
1346
|
-
* Read more here - https://help.smartico.ai/welcome/products/
|
|
1348
|
+
* Read more here - https://help.smartico.ai/welcome/products/tools-and-guides/custom-fields-attributes
|
|
1347
1349
|
*/
|
|
1348
1350
|
custom_data: string;
|
|
1349
1351
|
/** Date of start */
|
package/dist/index.js
CHANGED
|
@@ -3409,18 +3409,46 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
|
|
|
3409
3409
|
* `only_in_custom_section: true` are intended for their custom-section
|
|
3410
3410
|
* view only and should be hidden from the main mission list.
|
|
3411
3411
|
*
|
|
3412
|
-
* **
|
|
3413
|
-
*
|
|
3414
|
-
*
|
|
3415
|
-
*
|
|
3416
|
-
*
|
|
3417
|
-
*
|
|
3418
|
-
*
|
|
3419
|
-
*
|
|
3420
|
-
*
|
|
3421
|
-
*
|
|
3422
|
-
*
|
|
3423
|
-
*
|
|
3412
|
+
* **Status bucketing (which tab / section a mission belongs to)**
|
|
3413
|
+
* There is no pre-computed bucket field — assign each mission to exactly
|
|
3414
|
+
* ONE section reading the raw state fields directly (NOT `availability_status`;
|
|
3415
|
+
* see "Timers" below). Priority order, FIRST match wins:
|
|
3416
|
+
* 1. **Missed / Expired** — not completed and the window has closed:
|
|
3417
|
+
* `!is_completed && ((time_limit_ms && dt_start && dt_start + time_limit_ms < Date.now())`
|
|
3418
|
+
* `|| (active_till_ts && active_till_ts < Date.now()))`. Do NOT gate this on
|
|
3419
|
+
* opt-in — an opt-in mission whose window closed before the user ever
|
|
3420
|
+
* opted in is still Missed. Sort by `position` ASC.
|
|
3421
|
+
* 2. **Completed** — `is_completed === true`, OR (recurring-upon-completion
|
|
3422
|
+
* missions) at least one cycle done / the cap reached — see the recurring
|
|
3423
|
+
* caveats below. Sort by `complete_date_ts` DESC.
|
|
3424
|
+
* 3. **Locked** — `is_locked === true`, OR not yet started
|
|
3425
|
+
* (`active_from_ts > Date.now()`). Sort by `position` ASC.
|
|
3426
|
+
* 4. **In-progress** — `is_opted_in === true`, OR (no opt-in required and
|
|
3427
|
+
* `progress > 0`). Sort by `position` ASC.
|
|
3428
|
+
* 5. **Available** — everything else (opt-in required but not yet joined, or
|
|
3429
|
+
* an unrestricted mission not yet started). Sort by `position` ASC.
|
|
3430
|
+
*
|
|
3431
|
+
* **Recurring-upon-completion caveats** (the common mis-bucketing trap):
|
|
3432
|
+
* - `is_completed` NEVER flips true for a recurring-upon-completion mission
|
|
3433
|
+
* (only for one-shot missions) — detect a completed cycle from
|
|
3434
|
+
* `completion_count > 0`, not `is_completed`.
|
|
3435
|
+
* - A non-null `completion_count` is what identifies a recurring-upon-completion
|
|
3436
|
+
* mission. `max_completion_count === null` means an INFINITE cap (still
|
|
3437
|
+
* recurring — never read null as "not recurring"), so only test
|
|
3438
|
+
* `completion_count >= max_completion_count` when `max_completion_count` is set.
|
|
3439
|
+
*
|
|
3440
|
+
* **Timers & timestamps** (display only — NOT bucketing)
|
|
3441
|
+
* `availability_status` (enum {@link AchievementAvailabilityStatus}) is the
|
|
3442
|
+
* timer/window signal: use it to pick WHICH countdown to show and whether the
|
|
3443
|
+
* window has elapsed — NOT to choose the section. It does not read
|
|
3444
|
+
* `completion_count`, and between cycles the server may keep reporting the
|
|
3445
|
+
* just-elapsed cycle's `Missed*` value even after `dt_start` / `active_till_ts`
|
|
3446
|
+
* are cleared for the next attempt, so bucketing by it sends recurring missions
|
|
3447
|
+
* to the wrong tab. For time-limited / opt-in missions `dt_start` is the opt-in
|
|
3448
|
+
* timestamp (or unlock timestamp for previously-locked missions), and a
|
|
3449
|
+
* time-limited mission expires at `dt_start + time_limit_ms`.
|
|
3450
|
+
* `next_recurrence_date_ts` is populated for `RECURRING` / `RECURRING_QUANTITY`
|
|
3451
|
+
* missions but is no longer meaningful once `active_till_ts` has passed.
|
|
3424
3452
|
*
|
|
3425
3453
|
* **Refresh after a mutation**
|
|
3426
3454
|
* After `requestMissionOptIn(...)` or `requestMissionClaimReward(...)`
|
|
@@ -6312,7 +6340,9 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6312
6340
|
* user-currency display is needed, the consumer must convert client-side.
|
|
6313
6341
|
*
|
|
6314
6342
|
* **Refresh**
|
|
6315
|
-
* - The SDK caches per `jp_template_id`
|
|
6343
|
+
* - The SDK caches each page separately (per `jp_template_id` +
|
|
6344
|
+
* `limit` + `offset`) for 30 seconds, so paging back and forth is
|
|
6345
|
+
* served from cache and each page keeps its own fresh copy.
|
|
6316
6346
|
* - Caches clear on jackpot-win push events and on opt-in / opt-out.
|
|
6317
6347
|
*
|
|
6318
6348
|
* **Error handling**
|
|
@@ -6350,7 +6380,10 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
6350
6380
|
jp_template_id = _ref.jp_template_id;
|
|
6351
6381
|
try {
|
|
6352
6382
|
var _this5 = this;
|
|
6353
|
-
|
|
6383
|
+
// Cache per (jp_template_id, limit, offset) so paging or switching
|
|
6384
|
+
// jackpot within the TTL doesn't return a colliding winners list.
|
|
6385
|
+
var cacheKey = "" + onUpdateContextKey.JackpotWinners + jp_template_id + ":" + limit + ":" + offset;
|
|
6386
|
+
return Promise.resolve(OCache.use(cacheKey, exports.ECacheContext.WSAPI, function () {
|
|
6354
6387
|
return _this5.api.getJackpotWinnersT(_this5.userExtId, limit, offset, jp_template_id);
|
|
6355
6388
|
}, JACKPOT_WINNERS_CACHE_SEC));
|
|
6356
6389
|
} catch (e) {
|