@smartico/public-api 0.0.208 → 0.0.210
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/Missions/AchievementAvailabilityStatus.d.ts +61 -0
- package/dist/Missions/MissionsUtils.d.ts +6 -0
- package/dist/Missions/index.d.ts +1 -0
- package/dist/SmarticoLib/index.d.ts +9 -0
- package/dist/WSAPI/WSAPITypes.d.ts +10 -2
- package/dist/index.js +218 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +219 -3
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +3 -3
- package/docs/enums/AchievementAvailabilityStatus.md +139 -0
- package/docs/interfaces/TMissionOrBadge.md +18 -1
- package/docs/interfaces/TTournamentDetailed.md +20 -0
- package/package.json +1 -1
- package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
- package/src/Missions/AchievementAvailabilityStatus.ts +76 -0
- package/src/Missions/MissionsUtils.ts +166 -0
- package/src/Missions/UserAchievement.ts +7 -1
- package/src/Missions/index.ts +1 -0
- package/src/SmarticoLib/index.ts +16 -5
- package/src/WSAPI/WSAPITypes.ts +13 -3
- package/tsconfig.json +2 -1
- package/dist/Quiz/MarketsAnswersType.d.ts +0 -22
- package/dist/SmarticoPublicAPI.d.ts +0 -23
- package/dist/Store/BuyShopItemErrorCode.d.ts +0 -10
- package/dist/Store/BuyShopItemRequest.d.ts +0 -4
- package/dist/Store/BuyShopItemResponse.d.ts +0 -4
- package/dist/Store/GetCategoriesShopResponse.d.ts +0 -5
- package/dist/Store/GetShopItemsResponse.d.ts +0 -5
- package/dist/Store/ShopCategory.d.ts +0 -5
- package/dist/Store/ShopCategoryPublicMeta.d.ts +0 -4
- package/dist/Store/ShopItem.d.ts +0 -9
- package/dist/Store/ShopItemPublicMeta.d.ts +0 -10
- package/dist/Store/ShopItemType.d.ts +0 -4
- package/dist/Store/StorItemPruchased.d.ts +0 -6
- package/dist/service/index.d.ts +0 -5
- package/dist/service/types/ErrorCodes.d.ts +0 -13
- package/dist/service/types/GRequest.d.ts +0 -16
- package/dist/service/types/GResponse.d.ts +0 -10
- package/dist/service/types/Game/GameAttemptType.d.ts +0 -6
- package/dist/service/types/Game/GameCanPlayType.d.ts +0 -10
- package/dist/service/types/Game/GameExternalStatus.d.ts +0 -6
- package/dist/service/types/Game/GameInfo.d.ts +0 -9
- package/dist/service/types/Game/GamePick.d.ts +0 -90
- package/dist/service/types/Game/GameUtil.d.ts +0 -7
- package/dist/service/types/SmarticoProto/GetTranslationsRequest.d.ts +0 -7
- package/dist/service/types/SmarticoProto/GetTranslationsResponse.d.ts +0 -7
- package/dist/service/types/SmarticoProto/ProtocolMessage.d.ts +0 -5
- package/dist/service/types/SmarticoProto/ProtocolRequest.d.ts +0 -6
- package/dist/service/types/SmarticoProto/ProtocolResponse.d.ts +0 -5
- package/dist/service/types/SmarticoProto/PublicLabelInfo.d.ts +0 -34
- package/dist/service/types/SmarticoProto/PublicProperties.d.ts +0 -11
- package/dist/service/types/SmarticoProto/ResponseIdentify.d.ts +0 -12
- package/dist/service/types/SmarticoProto/SAW/SAWAcknowledgeType.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWBuyInType.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinRequest.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWDoSpinResponse.d.ts +0 -15
- package/dist/service/types/SmarticoProto/SAW/SAWGameType.d.ts +0 -10
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesRequest.d.ts +0 -3
- package/dist/service/types/SmarticoProto/SAW/SAWGetTemplatesResponse.d.ts +0 -5
- package/dist/service/types/SmarticoProto/SAW/SAWPrize.d.ts +0 -11
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeType.d.ts +0 -8
- package/dist/service/types/SmarticoProto/SAW/SAWPrizeUI.d.ts +0 -13
- package/dist/service/types/SmarticoProto/SAW/SAWTemplate.d.ts +0 -21
- package/dist/service/types/SmarticoProto/SAW/SAWTemplateUI.d.ts +0 -31
- package/dist/service/types/SmarticoProto/SAW/SAWWinSoundType.d.ts +0 -12
- package/dist/service/types/SmarticoProto/TranslationArea.d.ts +0 -9
- package/dist/service/types/User/UserInfo.d.ts +0 -10
- package/dist/util/Util.d.ts +0 -51
package/docs/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- [SAWGameTypeName](enums/SAWGameTypeName.md)
|
|
10
10
|
- [MiniGamePrizeTypeName](enums/MiniGamePrizeTypeName.md)
|
|
11
11
|
- [SAWSpinErrorCode](enums/SAWSpinErrorCode.md)
|
|
12
|
+
- [AchievementAvailabilityStatus](enums/AchievementAvailabilityStatus.md)
|
|
12
13
|
- [BuyStoreItemErrorCode](enums/BuyStoreItemErrorCode.md)
|
|
13
14
|
- [TournamentRegistrationError](enums/TournamentRegistrationError.md)
|
|
14
15
|
- [TournamentRegistrationStatusName](enums/TournamentRegistrationStatusName.md)
|
package/docs/classes/WSAPI.md
CHANGED
|
@@ -471,7 +471,7 @@ _smartico.api.playMiniGame(55).then((result) => {
|
|
|
471
471
|
| :------ | :------ |
|
|
472
472
|
| `template_id` | `number` |
|
|
473
473
|
| `«destructured»` | `Object` |
|
|
474
|
-
| › `onUpdate?` | (`data`: [`
|
|
474
|
+
| › `onUpdate?` | (`data`: [`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]) => `void` |
|
|
475
475
|
|
|
476
476
|
#### Returns
|
|
477
477
|
|
|
@@ -934,7 +934,7 @@ ___
|
|
|
934
934
|
|
|
935
935
|
### getRelatedItemsForGame
|
|
936
936
|
|
|
937
|
-
▸ **getRelatedItemsForGame**(`related_game_id`): `Promise`\<`
|
|
937
|
+
▸ **getRelatedItemsForGame**(`related_game_id`): `Promise`\<`GetRelatedAchTourResponse`\>
|
|
938
938
|
|
|
939
939
|
Returns all the related tournaments and missions for the provided game id for the current user
|
|
940
940
|
The provided Game ID should correspond to the ID from the Games Catalog - https://help.smartico.ai/welcome/technical-guides/games-catalog-api
|
|
@@ -961,4 +961,4 @@ _smartico.vapi('EN').getRelatedItemsForGame('gold-slot2').then((result) => {
|
|
|
961
961
|
|
|
962
962
|
#### Returns
|
|
963
963
|
|
|
964
|
-
`Promise`\<`
|
|
964
|
+
`Promise`\<`GetRelatedAchTourResponse`\>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Enumeration: AchievementAvailabilityStatus
|
|
2
|
+
|
|
3
|
+
Possible statuses of the mission availability.
|
|
4
|
+
Notes:
|
|
5
|
+
- Recurring missions have a special field next_recurrence_date_ts, but it's only relevant if the mission has no active till date or the next recurrence date is before the active till date.
|
|
6
|
+
- For a locked mission or mission that requires opt-in, the time limit should be calculated as dt_start + time_limit_ms. For a mission that does not require opt-in or type is not Locked, it should be the highest value of dt_start and active_from_ts (if defined) + time_limit_ms.
|
|
7
|
+
|
|
8
|
+
## Enumeration Members
|
|
9
|
+
|
|
10
|
+
### Available
|
|
11
|
+
|
|
12
|
+
• **Available** = ``0``
|
|
13
|
+
|
|
14
|
+
Mission without date/time restrictions or with passed active from date and no opt-in required and mission is unlocked
|
|
15
|
+
|
|
16
|
+
___
|
|
17
|
+
|
|
18
|
+
### AvailableInactive
|
|
19
|
+
|
|
20
|
+
• **AvailableInactive** = ``1``
|
|
21
|
+
|
|
22
|
+
Mission without date/time restrictions or with passed active from date, opt-in is required, user is not opted-in or mission is locked
|
|
23
|
+
|
|
24
|
+
___
|
|
25
|
+
|
|
26
|
+
### AvailableActive
|
|
27
|
+
|
|
28
|
+
• **AvailableActive** = ``2``
|
|
29
|
+
|
|
30
|
+
Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked
|
|
31
|
+
|
|
32
|
+
___
|
|
33
|
+
|
|
34
|
+
### UnavailableWithActiveFrom
|
|
35
|
+
|
|
36
|
+
• **UnavailableWithActiveFrom** = ``3``
|
|
37
|
+
|
|
38
|
+
Mission with active from date defined, date is in future.
|
|
39
|
+
Field: active_from_ts
|
|
40
|
+
|
|
41
|
+
___
|
|
42
|
+
|
|
43
|
+
### AvailableWithActiveTill
|
|
44
|
+
|
|
45
|
+
• **AvailableWithActiveTill** = ``4``
|
|
46
|
+
|
|
47
|
+
Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
|
|
48
|
+
Field: active_till_ts
|
|
49
|
+
|
|
50
|
+
___
|
|
51
|
+
|
|
52
|
+
### AvailableWithActiveTillInactive
|
|
53
|
+
|
|
54
|
+
• **AvailableWithActiveTillInactive** = ``5``
|
|
55
|
+
|
|
56
|
+
Mission with active till date defined, date is in future, and opt-in is required, user is not opted in or mission is locked.
|
|
57
|
+
Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
|
|
58
|
+
|
|
59
|
+
___
|
|
60
|
+
|
|
61
|
+
### AvailableWithActiveTillActive
|
|
62
|
+
|
|
63
|
+
• **AvailableWithActiveTillActive** = ``6``
|
|
64
|
+
|
|
65
|
+
Mission with active till date defined, date is in future, and opt-in is required, user is opted in or mission is unlocked.
|
|
66
|
+
Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
|
|
67
|
+
|
|
68
|
+
___
|
|
69
|
+
|
|
70
|
+
### AvailableLimited
|
|
71
|
+
|
|
72
|
+
• **AvailableLimited** = ``7``
|
|
73
|
+
|
|
74
|
+
Available mission with time limit, and opt-in is required or mission is unlocked.
|
|
75
|
+
The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
|
|
76
|
+
|
|
77
|
+
___
|
|
78
|
+
|
|
79
|
+
### AvailableLimitedInactive
|
|
80
|
+
|
|
81
|
+
• **AvailableLimitedInactive** = ``8``
|
|
82
|
+
|
|
83
|
+
Available mission with time limit, opt-in is required, user is not opted-in or mission is locked.
|
|
84
|
+
Time limit at this stage is not relevant, user should be opted-in or mission should be unlocked.
|
|
85
|
+
|
|
86
|
+
___
|
|
87
|
+
|
|
88
|
+
### AvailableLimitedActive
|
|
89
|
+
|
|
90
|
+
• **AvailableLimitedActive** = ``9``
|
|
91
|
+
|
|
92
|
+
Available mission with time limit, opt-in is required, user is opted-in or mission unlocked.
|
|
93
|
+
The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
|
|
94
|
+
|
|
95
|
+
___
|
|
96
|
+
|
|
97
|
+
### AvailableFullyLimited
|
|
98
|
+
|
|
99
|
+
• **AvailableFullyLimited** = ``10``
|
|
100
|
+
|
|
101
|
+
Available mission with time limit and active till date, opt-in is not required and mission is unlocked.
|
|
102
|
+
Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts;
|
|
103
|
+
The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
|
|
104
|
+
|
|
105
|
+
___
|
|
106
|
+
|
|
107
|
+
### AvailableFullyLimitedInactive
|
|
108
|
+
|
|
109
|
+
• **AvailableFullyLimitedInactive** = ``11``
|
|
110
|
+
|
|
111
|
+
Available mission with time limit and active till date, opt-in is required, user is not opted in or mission is locked.
|
|
112
|
+
Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts, is_requires_optin, is_opted_in, is_locked.
|
|
113
|
+
On this stage only active_till_ts is relevant. time_limit_ms is ignored because user should be opted in.
|
|
114
|
+
|
|
115
|
+
___
|
|
116
|
+
|
|
117
|
+
### AvailableFullyLimitedActive
|
|
118
|
+
|
|
119
|
+
• **AvailableFullyLimitedActive** = ``12``
|
|
120
|
+
|
|
121
|
+
Available mission with time limit and active till date, opt-in is required, user is opted in or mission is unlocked.
|
|
122
|
+
Fields: active_till_ts, time_limit_ms, dt_start, is_requires_optin, is_opted_in, is_locked.
|
|
123
|
+
The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
|
|
124
|
+
|
|
125
|
+
___
|
|
126
|
+
|
|
127
|
+
### MissedByActiveTill
|
|
128
|
+
|
|
129
|
+
• **MissedByActiveTill** = ``13``
|
|
130
|
+
|
|
131
|
+
Missed mission when active till date is already passed. is_completed field indicating if mission is completed or just missed
|
|
132
|
+
|
|
133
|
+
___
|
|
134
|
+
|
|
135
|
+
### MissedByLimitInTime
|
|
136
|
+
|
|
137
|
+
• **MissedByLimitInTime** = ``14``
|
|
138
|
+
|
|
139
|
+
Missed mission when start_date + time_limit_ms is already passed. is_completed field indicating if mission is completed or just missed
|
|
@@ -121,7 +121,7 @@ ___
|
|
|
121
121
|
|
|
122
122
|
• **dt\_start**: `number`
|
|
123
123
|
|
|
124
|
-
The date when the mission was started, relevant for the time limited missions
|
|
124
|
+
The date when the mission was started, relevant for the time limited missions, also indicating opt-it date for mission that requires opt-in and unlock date for Locked mission.
|
|
125
125
|
|
|
126
126
|
___
|
|
127
127
|
|
|
@@ -309,3 +309,20 @@ ___
|
|
|
309
309
|
• `Optional` **completion\_count**: `number`
|
|
310
310
|
|
|
311
311
|
Current completion count for Recurring upon completion missions
|
|
312
|
+
|
|
313
|
+
___
|
|
314
|
+
|
|
315
|
+
### next\_recurrence\_date\_ts
|
|
316
|
+
|
|
317
|
+
• `Optional` **next\_recurrence\_date\_ts**: `number`
|
|
318
|
+
|
|
319
|
+
The date/timestamp for recurring missions, which indicating the time remaining until the next recurrence of the mission.
|
|
320
|
+
Note that if a mission has an "Active till" date defined, this field is not relevant after that date.
|
|
321
|
+
|
|
322
|
+
___
|
|
323
|
+
|
|
324
|
+
### availability\_status
|
|
325
|
+
|
|
326
|
+
• `Optional` **availability\_status**: [`AchievementAvailabilityStatus`](../enums/AchievementAvailabilityStatus.md)
|
|
327
|
+
|
|
328
|
+
Availability status of the mission depends on the defined time limits
|
|
@@ -373,6 +373,26 @@ Indicator if tournament instance is upcoming (status PUBLISHED or REGISTER)
|
|
|
373
373
|
|
|
374
374
|
___
|
|
375
375
|
|
|
376
|
+
### min\_scores\_win
|
|
377
|
+
|
|
378
|
+
• `Optional` **min\_scores\_win**: `number`
|
|
379
|
+
|
|
380
|
+
#### Inherited from
|
|
381
|
+
|
|
382
|
+
[TTournament](TTournament.md).[min_scores_win](TTournament.md#min_scores_win)
|
|
383
|
+
|
|
384
|
+
___
|
|
385
|
+
|
|
386
|
+
### hide\_leaderboard\_min\_scores
|
|
387
|
+
|
|
388
|
+
• `Optional` **hide\_leaderboard\_min\_scores**: `boolean`
|
|
389
|
+
|
|
390
|
+
#### Inherited from
|
|
391
|
+
|
|
392
|
+
[TTournament](TTournament.md).[hide_leaderboard_min_scores](TTournament.md#hide_leaderboard_min_scores)
|
|
393
|
+
|
|
394
|
+
___
|
|
395
|
+
|
|
376
396
|
### related\_games
|
|
377
397
|
|
|
378
398
|
• `Optional` **related\_games**: [`AchRelatedGame`](AchRelatedGame-1.md)[]
|
package/package.json
CHANGED
|
@@ -40,6 +40,7 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
|
|
|
40
40
|
activeTillDate: r.activeTillDate,
|
|
41
41
|
next_available_spin_ts: r.next_available_spin_ts,
|
|
42
42
|
steps_to_finish_game: r.saw_template_ui_definition.steps_to_finish_game,
|
|
43
|
+
custom_section_id: r.saw_template_ui_definition.custom_section_id,
|
|
43
44
|
|
|
44
45
|
prizes: r.prizes.map((p) => {
|
|
45
46
|
const y: TMiniGamePrize = {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Possible statuses of the mission availability.
|
|
2
|
+
* Notes:
|
|
3
|
+
* - Recurring missions have a special field next_recurrence_date_ts, but it's only relevant if the mission has no active till date or the next recurrence date is before the active till date.
|
|
4
|
+
* - For a locked mission or mission that requires opt-in, the time limit should be calculated as dt_start + time_limit_ms. For a mission that does not require opt-in or type is not Locked, it should be the highest value of dt_start and active_from_ts (if defined) + time_limit_ms.
|
|
5
|
+
* */
|
|
6
|
+
|
|
7
|
+
export enum AchievementAvailabilityStatus {
|
|
8
|
+
/** Mission without date/time restrictions or with passed active from date and no opt-in required and mission is unlocked */
|
|
9
|
+
Available = 0,
|
|
10
|
+
|
|
11
|
+
/** Mission without date/time restrictions or with passed active from date, opt-in is required, user is not opted-in or mission is locked */
|
|
12
|
+
AvailableInactive = 1,
|
|
13
|
+
|
|
14
|
+
/** Mission without date/time restrictions or with passed active from date, opt-in is required, user is opted-in or mission is unlocked*/
|
|
15
|
+
AvailableActive = 2,
|
|
16
|
+
|
|
17
|
+
/** Mission with active from date defined, date is in future.
|
|
18
|
+
* Field: active_from_ts
|
|
19
|
+
*/
|
|
20
|
+
UnavailableWithActiveFrom = 3,
|
|
21
|
+
|
|
22
|
+
/** Mission with active till date defined, date is in future, and no opt-in required and mission is unlocked.
|
|
23
|
+
* Field: active_till_ts
|
|
24
|
+
*/
|
|
25
|
+
AvailableWithActiveTill = 4,
|
|
26
|
+
|
|
27
|
+
/** Mission with active till date defined, date is in future, and opt-in is required, user is not opted in or mission is locked.
|
|
28
|
+
* Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
|
|
29
|
+
*/
|
|
30
|
+
AvailableWithActiveTillInactive = 5,
|
|
31
|
+
|
|
32
|
+
/** Mission with active till date defined, date is in future, and opt-in is required, user is opted in or mission is unlocked.
|
|
33
|
+
* Fields: active_till_ts, is_requires_optin, is_opted_in, is_locked.
|
|
34
|
+
*/
|
|
35
|
+
AvailableWithActiveTillActive = 6,
|
|
36
|
+
|
|
37
|
+
/** Available mission with time limit, and opt-in is required or mission is unlocked.
|
|
38
|
+
* The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
AvailableLimited = 7,
|
|
42
|
+
|
|
43
|
+
/** Available mission with time limit, opt-in is required, user is not opted-in or mission is locked.
|
|
44
|
+
* Time limit at this stage is not relevant, user should be opted-in or mission should be unlocked.
|
|
45
|
+
*/
|
|
46
|
+
AvailableLimitedInactive = 8,
|
|
47
|
+
|
|
48
|
+
/** Available mission with time limit, opt-in is required, user is opted-in or mission unlocked.
|
|
49
|
+
* The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
|
|
50
|
+
*/
|
|
51
|
+
AvailableLimitedActive = 9,
|
|
52
|
+
|
|
53
|
+
/** Available mission with time limit and active till date, opt-in is not required and mission is unlocked.
|
|
54
|
+
* Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts;
|
|
55
|
+
* The time limit is calculated as the sum of two properties: (highest value from dt_start and active_from_ts) + time_limit_ms.
|
|
56
|
+
*/
|
|
57
|
+
AvailableFullyLimited = 10,
|
|
58
|
+
|
|
59
|
+
/** Available mission with time limit and active till date, opt-in is required, user is not opted in or mission is locked.
|
|
60
|
+
* Fields: active_till_ts, time_limit_ms, dt_start, active_from_ts, is_requires_optin, is_opted_in, is_locked.
|
|
61
|
+
* On this stage only active_till_ts is relevant. time_limit_ms is ignored because user should be opted in.
|
|
62
|
+
*/
|
|
63
|
+
AvailableFullyLimitedInactive = 11,
|
|
64
|
+
|
|
65
|
+
/** Available mission with time limit and active till date, opt-in is required, user is opted in or mission is unlocked.
|
|
66
|
+
* Fields: active_till_ts, time_limit_ms, dt_start, is_requires_optin, is_opted_in, is_locked.
|
|
67
|
+
* The time limit is calculated as the sum of two properties: dt_start + time_limit_ms.
|
|
68
|
+
*/
|
|
69
|
+
AvailableFullyLimitedActive = 12,
|
|
70
|
+
|
|
71
|
+
/** Missed mission when active till date is already passed. is_completed field indicating if mission is completed or just missed */
|
|
72
|
+
MissedByActiveTill = 13,
|
|
73
|
+
|
|
74
|
+
/** Missed mission when start_date + time_limit_ms is already passed. is_completed field indicating if mission is completed or just missed */
|
|
75
|
+
MissedByLimitInTime = 14,
|
|
76
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { AchievementAvailabilityStatus } from "./AchievementAvailabilityStatus";
|
|
2
|
+
import { AchievementStatus } from "./AchievementStatus";
|
|
3
|
+
import { UserAchievement } from "./UserAchievement";
|
|
4
|
+
|
|
5
|
+
export class MissionUtils {
|
|
6
|
+
|
|
7
|
+
public static getAvailabilityStatus = (mission: UserAchievement) => {
|
|
8
|
+
|
|
9
|
+
if (!mission) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const activeFrom = mission.active_from_ts ? MissionUtils.getMs(mission.active_from_ts) : null
|
|
14
|
+
const activeTill = mission.active_till_ts ? MissionUtils.getMs(mission.active_till_ts) : null;
|
|
15
|
+
const startDate = mission.start_date_ts ? MissionUtils.getMs(mission.start_date_ts) : null;
|
|
16
|
+
const timeLimit = mission.time_limit_ms;
|
|
17
|
+
const requiresOptIn = mission.requiresOptin;
|
|
18
|
+
const optedIn = mission.isOptedIn;
|
|
19
|
+
const isLockedMission = mission.ach_status_id === AchievementStatus.AvailableLocked;
|
|
20
|
+
const isLocked = mission.isLocked;
|
|
21
|
+
|
|
22
|
+
if (!activeFrom && !activeTill && !timeLimit) {
|
|
23
|
+
if (requiresOptIn) {
|
|
24
|
+
if (optedIn) {
|
|
25
|
+
return AchievementAvailabilityStatus.AvailableActive;
|
|
26
|
+
} else {
|
|
27
|
+
return AchievementAvailabilityStatus.AvailableInactive;
|
|
28
|
+
}
|
|
29
|
+
} else if (isLockedMission) {
|
|
30
|
+
if (!isLocked) {
|
|
31
|
+
return AchievementAvailabilityStatus.AvailableActive;
|
|
32
|
+
} else {
|
|
33
|
+
return AchievementAvailabilityStatus.AvailableInactive;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
return AchievementAvailabilityStatus.Available;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (activeFrom && activeFrom > Date.now()) {
|
|
41
|
+
return AchievementAvailabilityStatus.UnavailableWithActiveFrom;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if ((activeFrom && activeFrom < Date.now()) || !activeFrom) {
|
|
45
|
+
if (!activeTill && !timeLimit) {
|
|
46
|
+
if (requiresOptIn) {
|
|
47
|
+
if (optedIn) {
|
|
48
|
+
return AchievementAvailabilityStatus.AvailableActive;
|
|
49
|
+
} else {
|
|
50
|
+
return AchievementAvailabilityStatus.AvailableInactive;
|
|
51
|
+
}
|
|
52
|
+
} else if (isLockedMission) {
|
|
53
|
+
if (!isLocked) {
|
|
54
|
+
return AchievementAvailabilityStatus.AvailableActive;
|
|
55
|
+
} else {
|
|
56
|
+
return AchievementAvailabilityStatus.AvailableInactive;
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
return AchievementAvailabilityStatus.Available;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (activeTill && !timeLimit) {
|
|
64
|
+
if (activeTill > Date.now()) {
|
|
65
|
+
if (requiresOptIn) {
|
|
66
|
+
if (optedIn) {
|
|
67
|
+
return AchievementAvailabilityStatus.AvailableWithActiveTillActive;
|
|
68
|
+
} else {
|
|
69
|
+
return AchievementAvailabilityStatus.AvailableWithActiveTillInactive;
|
|
70
|
+
}
|
|
71
|
+
} else if (isLockedMission) {
|
|
72
|
+
if (!isLocked) {
|
|
73
|
+
return AchievementAvailabilityStatus.AvailableWithActiveTillActive;
|
|
74
|
+
} else {
|
|
75
|
+
return AchievementAvailabilityStatus.AvailableWithActiveTillInactive;
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
return AchievementAvailabilityStatus.AvailableWithActiveTill;
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
return AchievementAvailabilityStatus.MissedByActiveTill;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (timeLimit && !activeTill) {
|
|
86
|
+
if (requiresOptIn) {
|
|
87
|
+
const endDate = startDate + timeLimit;
|
|
88
|
+
|
|
89
|
+
if (optedIn) {
|
|
90
|
+
if (endDate > Date.now()) {
|
|
91
|
+
return AchievementAvailabilityStatus.AvailableLimitedActive;
|
|
92
|
+
} else {
|
|
93
|
+
return AchievementAvailabilityStatus.MissedByLimitInTime;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return AchievementAvailabilityStatus.AvailableLimitedInactive;
|
|
97
|
+
}
|
|
98
|
+
} else if (isLockedMission) {
|
|
99
|
+
const endDate = startDate + timeLimit;
|
|
100
|
+
|
|
101
|
+
if (!isLocked) {
|
|
102
|
+
if (endDate > Date.now()) {
|
|
103
|
+
return AchievementAvailabilityStatus.AvailableLimitedActive;
|
|
104
|
+
} else {
|
|
105
|
+
return AchievementAvailabilityStatus.MissedByLimitInTime;
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
return AchievementAvailabilityStatus.AvailableLimitedInactive;
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
const endDate = activeFrom && activeFrom > startDate ? activeFrom + timeLimit : startDate + timeLimit;
|
|
112
|
+
|
|
113
|
+
if (endDate > Date.now()) {
|
|
114
|
+
return AchievementAvailabilityStatus.AvailableLimited;
|
|
115
|
+
} else {
|
|
116
|
+
return AchievementAvailabilityStatus.MissedByLimitInTime;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (timeLimit && activeTill) {
|
|
122
|
+
if (activeTill > Date.now()) {
|
|
123
|
+
if (requiresOptIn) {
|
|
124
|
+
if (optedIn) {
|
|
125
|
+
const endDate = startDate + timeLimit;
|
|
126
|
+
|
|
127
|
+
if (endDate > Date.now()) {
|
|
128
|
+
return AchievementAvailabilityStatus.AvailableFullyLimitedActive;
|
|
129
|
+
} else {
|
|
130
|
+
return AchievementAvailabilityStatus.MissedByLimitInTime;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
return AchievementAvailabilityStatus.AvailableFullyLimitedInactive;
|
|
134
|
+
}
|
|
135
|
+
} else if (isLockedMission) {
|
|
136
|
+
if (!isLocked) {
|
|
137
|
+
const endDate = startDate + timeLimit;
|
|
138
|
+
|
|
139
|
+
if (endDate > Date.now()) {
|
|
140
|
+
return AchievementAvailabilityStatus.AvailableFullyLimitedActive;
|
|
141
|
+
} else {
|
|
142
|
+
return AchievementAvailabilityStatus.MissedByLimitInTime;
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
return AchievementAvailabilityStatus.AvailableFullyLimitedInactive;
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
const endDate = activeFrom && activeFrom > startDate ? activeFrom + timeLimit : startDate + timeLimit;
|
|
149
|
+
|
|
150
|
+
if (endDate > Date.now()) {
|
|
151
|
+
return AchievementAvailabilityStatus.AvailableFullyLimited;
|
|
152
|
+
} else {
|
|
153
|
+
return AchievementAvailabilityStatus.MissedByLimitInTime;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
return AchievementAvailabilityStatus.MissedByActiveTill;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
public static getMs = (ts: number): number => {
|
|
164
|
+
return new Date(ts).getTime();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -5,6 +5,7 @@ import { AchievementPublicMeta } from './AchievementPublicMeta';
|
|
|
5
5
|
import { AchievementStatus } from './AchievementStatus';
|
|
6
6
|
import { AchievementTaskType } from './AchievementTaskType';
|
|
7
7
|
import { AchievementType } from './AchievementType';
|
|
8
|
+
import { MissionUtils } from './MissionsUtils';
|
|
8
9
|
import { ScheduledMissionType } from './ScheduledMissionType';
|
|
9
10
|
import { UserAchievementTask } from './UserAchievementTask';
|
|
10
11
|
|
|
@@ -67,7 +68,7 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
|
|
|
67
68
|
is_opted_in: r.isOptedIn,
|
|
68
69
|
time_limit_ms: r.time_limit_ms,
|
|
69
70
|
active_from_ts: r.active_from_ts,
|
|
70
|
-
active_till_ts: r.
|
|
71
|
+
active_till_ts: r.active_till_ts,
|
|
71
72
|
dt_start: r.start_date_ts,
|
|
72
73
|
reward: r.ach_public_meta.reward,
|
|
73
74
|
progress: r.progress,
|
|
@@ -114,8 +115,13 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
|
|
|
114
115
|
completed_this_week: completedThisWeek,
|
|
115
116
|
completed_this_month: completedThisMonth,
|
|
116
117
|
custom_section_type_id: r.ach_public_meta.custom_section_type_id,
|
|
118
|
+
availability_status: MissionUtils.getAvailabilityStatus(r),
|
|
117
119
|
};
|
|
118
120
|
|
|
121
|
+
if (r.ach_status_id === AchievementStatus.Recurring) {
|
|
122
|
+
x.next_recurrence_date_ts = r.next_recurrence_date_ts;
|
|
123
|
+
}
|
|
124
|
+
|
|
119
125
|
if (r.ach_status_id === AchievementStatus.RecurringUponCompletion) {
|
|
120
126
|
x.completion_count = r.completed_count;
|
|
121
127
|
x.max_completion_count = r.recurring_quantity;
|
package/src/Missions/index.ts
CHANGED
package/src/SmarticoLib/index.ts
CHANGED
|
@@ -1500,23 +1500,34 @@ export interface UserAchievement {
|
|
|
1500
1500
|
isLocked?: boolean;
|
|
1501
1501
|
requiresOptin?: boolean;
|
|
1502
1502
|
isOptedIn?: boolean;
|
|
1503
|
-
start_date?: string;
|
|
1503
|
+
start_date?: string; // time when mission unlocked or opted-in. Needed to calculated "remaining time" in case time_limit_ms is set
|
|
1504
1504
|
start_date_ts?: number;
|
|
1505
1505
|
time_limit_ms?: number;
|
|
1506
1506
|
progress?: number;
|
|
1507
1507
|
complete_date?: string;
|
|
1508
|
+
complete_date_ts?: number;
|
|
1508
1509
|
unlock_date?: string;
|
|
1509
1510
|
milliseconds_till_available?: number;
|
|
1510
1511
|
completed_tasks?: number;
|
|
1511
1512
|
achievementTasks?: UserAchievementTask[];
|
|
1513
|
+
next_recurrence_date_ts?: number;
|
|
1512
1514
|
ach_status_id?: AchievementStatus;
|
|
1513
1515
|
scheduledMissionType?: ScheduledMissionType;
|
|
1514
1516
|
related_games?: AchRelatedGame[];
|
|
1515
|
-
active_from_ts?: number;
|
|
1517
|
+
active_from_ts?: number; // indicates when 'scheduled' mission is active from,
|
|
1518
|
+
active_till_ts?: number; // indicates when 'scheduled' mission is active till,
|
|
1516
1519
|
ach_categories?: number[];
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
+
recurring_quantity?: number; // max completion count for Recurring upon completion
|
|
1521
|
+
completed_count?: number; // completion count for Recurring upon completion
|
|
1522
|
+
|
|
1523
|
+
ach_completed_id?: number; // ID of the completion fact from ach_completed or ach_completed_recurring tables
|
|
1524
|
+
requires_prize_claim?: boolean; // flag from achievement if the mission prize will be given only after user claims it
|
|
1525
|
+
prize_claimed_date_ts?: number; // the date/timestamp indicating when the prize was claimed by the user
|
|
1526
|
+
|
|
1527
|
+
completed_today?: boolean;
|
|
1528
|
+
completed_this_week?: boolean;
|
|
1529
|
+
completed_this_month?: boolean;
|
|
1530
|
+
custom_section_type_id?: number;
|
|
1520
1531
|
}
|
|
1521
1532
|
export interface GetAchievementMapResponse extends ProtocolResponse {
|
|
1522
1533
|
achievements?: UserAchievement[];
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BuyStoreItemErrorCode } from '../Store';
|
|
2
2
|
import { MiniGamePrizeTypeName, SAWAcknowledgeTypeName, SAWBuyInTypeName, SAWGameTypeName, SAWSpinErrorCode, SAWTemplate } from '../MiniGames';
|
|
3
3
|
import { TournamentRegistrationError, TournamentRegistrationStatusName, TournamentRegistrationTypeName } from '../Tournaments';
|
|
4
|
-
import { AchCategory } from '../Missions';
|
|
4
|
+
import { AchCategory, AchievementAvailabilityStatus } from '../Missions';
|
|
5
5
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
6
6
|
import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter } from '../CustomSections';
|
|
7
7
|
import { BonusStatus , BonusTemplateMetaMap, BonusMetaMap} from '../Bonuses';
|
|
@@ -65,7 +65,7 @@ export interface TMiniGamePrize {
|
|
|
65
65
|
/** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
|
|
66
66
|
custom_data?: any;
|
|
67
67
|
/** Prize modifiers that will multiply by 2x, 5x or 10x the current total. This will not affect the final Prize Amount that will be awarded. */
|
|
68
|
-
prize_modifiers?: PrizeModifiers;
|
|
68
|
+
prize_modifiers?: PrizeModifiers[];
|
|
69
69
|
/** When enabled, you can split prize value by decimal values */
|
|
70
70
|
allow_split_decimal?: boolean;
|
|
71
71
|
}
|
|
@@ -158,6 +158,8 @@ export interface TMiniGameTemplate {
|
|
|
158
158
|
activeTillDate?: number;
|
|
159
159
|
/* The amount of steps to complete the game and gather the prize */
|
|
160
160
|
steps_to_finish_game?: number;
|
|
161
|
+
/* Hold the id of the custom section */
|
|
162
|
+
custom_section_id?: number;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
/**
|
|
@@ -503,7 +505,7 @@ export interface TMissionOrBadge {
|
|
|
503
505
|
/** Holds time till mission will become unavailable, for the missions that are targeted to be available from specific date/time */
|
|
504
506
|
active_till_ts: number;
|
|
505
507
|
|
|
506
|
-
/** The date when the mission was started, relevant for the time limited missions */
|
|
508
|
+
/** The date when the mission was started, relevant for the time limited missions, also indicating opt-it date for mission that requires opt-in and unlock date for Locked mission. */
|
|
507
509
|
dt_start: number;
|
|
508
510
|
/** The progress of the mission in percents calculated as the aggregated relative percentage of all tasks */
|
|
509
511
|
progress: number;
|
|
@@ -576,6 +578,14 @@ export interface TMissionOrBadge {
|
|
|
576
578
|
|
|
577
579
|
/** Current completion count for Recurring upon completion missions */
|
|
578
580
|
completion_count?: number;
|
|
581
|
+
|
|
582
|
+
/** The date/timestamp for recurring missions, which indicating the time remaining until the next recurrence of the mission.
|
|
583
|
+
* Note that if a mission has an "Active till" date defined, this field is not relevant after that date.
|
|
584
|
+
*/
|
|
585
|
+
next_recurrence_date_ts?: number;
|
|
586
|
+
|
|
587
|
+
/** Availability status of the mission depends on the defined time limits */
|
|
588
|
+
availability_status?: AchievementAvailabilityStatus
|
|
579
589
|
}
|
|
580
590
|
|
|
581
591
|
export interface AchRelatedGame {
|
package/tsconfig.json
CHANGED
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"src/Store/BuyStoreItemErrorCode.ts",
|
|
27
27
|
"src/Leaderboard/LeaderBoardPeriodType.ts",
|
|
28
28
|
"src/Base/AchRelatedGame.ts",
|
|
29
|
-
"src/Jackpots/index.ts"
|
|
29
|
+
"src/Jackpots/index.ts",
|
|
30
|
+
"src/Missions/AchievementAvailabilityStatus.ts"
|
|
30
31
|
],
|
|
31
32
|
"out": "docs",
|
|
32
33
|
"plugin": ["typedoc-plugin-markdown", "typedoc-plugin-merge-modules"],
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare enum MarketsValueType {
|
|
2
|
-
HomeTeam = "1",
|
|
3
|
-
AwayTeam = "2",
|
|
4
|
-
Draw = "x",
|
|
5
|
-
HomeTeamHomeTeam = "1/1",
|
|
6
|
-
HomeTeamDraw = "1/x",
|
|
7
|
-
HomeTeamAwayTeam = "1/2",
|
|
8
|
-
DrawHomeTeam = "x/1",
|
|
9
|
-
DrawDraw = "x/x",
|
|
10
|
-
DrawAwayTeam = "x/2",
|
|
11
|
-
AwayTeamHomeTeam = "2/1",
|
|
12
|
-
AwayTeamDraw = "2/x",
|
|
13
|
-
AwayTeamAwayTeam = "2/2",
|
|
14
|
-
Yes = "yes",
|
|
15
|
-
No = "no",
|
|
16
|
-
Odd = "odd",
|
|
17
|
-
Even = "even",
|
|
18
|
-
HomeOdd = "1/odd",
|
|
19
|
-
HomeEven = "1/even",
|
|
20
|
-
AwayOdd = "2/odd",
|
|
21
|
-
AwayEven = "2/even"
|
|
22
|
-
}
|