@smartico/public-api 0.0.55 → 0.0.56
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/MiniGames/SAWBuyInType.d.ts +9 -5
- package/dist/MiniGames/SAWGameType.d.ts +10 -6
- package/dist/MiniGames/SAWGetTemplatesResponse.d.ts +2 -0
- package/dist/MiniGames/SAWPrizeType.d.ts +12 -0
- package/dist/SmarticoAPI.d.ts +5 -2
- package/dist/Store/StoreCategory.d.ts +2 -0
- package/dist/Tournaments/TournamentRegistrationStatus.d.ts +11 -2
- package/dist/WSAPI/WSAPI.d.ts +5 -1
- package/dist/WSAPI/WSAPITypes.d.ts +57 -0
- package/dist/index.js +204 -62
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +138 -20
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +10 -6
- package/docs/classes/WSAPI.md +24 -0
- package/docs/enums/MiniGamePrizeTypeName.md +43 -0
- package/docs/enums/SAWBuyInTypeName.md +25 -0
- package/docs/enums/SAWGameTypeName.md +31 -0
- package/docs/enums/TournamentRegistrationStatusName.md +49 -0
- package/docs/interfaces/TMiniGamePrize.md +51 -0
- package/docs/interfaces/TMiniGameTemplate.md +109 -0
- package/docs/interfaces/TStoreCategory.md +21 -0
- package/docs/interfaces/TTournament.md +1 -1
- package/docs/interfaces/TTournamentDetailed.md +1 -1
- package/package.json +1 -1
- package/src/MiniGames/SAWBuyInType.ts +15 -4
- package/src/MiniGames/SAWGameType.ts +18 -5
- package/src/MiniGames/SAWGetTemplatesResponse.ts +47 -0
- package/src/MiniGames/SAWPrizeType.ts +23 -0
- package/src/SmarticoAPI.ts +18 -6
- package/src/Store/StoreCategory.ts +12 -0
- package/src/Tournaments/Tournament.ts +2 -2
- package/src/Tournaments/TournamentRegistrationStatus.ts +19 -10
- package/src/WSAPI/WSAPI.ts +11 -1
- package/src/WSAPI/WSAPITypes.ts +75 -1
- package/tsconfig.json +4 -1
package/docs/README.md
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
# Smartico API documentation
|
|
2
2
|
|
|
3
|
+
## Enumerations
|
|
4
|
+
|
|
5
|
+
- [SAWBuyInTypeName](enums/SAWBuyInTypeName.md)
|
|
6
|
+
- [SAWGameTypeName](enums/SAWGameTypeName.md)
|
|
7
|
+
- [MiniGamePrizeTypeName](enums/MiniGamePrizeTypeName.md)
|
|
8
|
+
- [TournamentRegistrationStatusName](enums/TournamentRegistrationStatusName.md)
|
|
9
|
+
|
|
3
10
|
## Interfaces
|
|
4
11
|
|
|
12
|
+
- [TMiniGamePrize](interfaces/TMiniGamePrize.md)
|
|
13
|
+
- [TMiniGameTemplate](interfaces/TMiniGameTemplate.md)
|
|
5
14
|
- [TUserProfile](interfaces/TUserProfile.md)
|
|
6
15
|
- [TLevel](interfaces/TLevel.md)
|
|
7
16
|
- [TTournament](interfaces/TTournament.md)
|
|
8
17
|
- [TTournamentDetailed](interfaces/TTournamentDetailed.md)
|
|
18
|
+
- [TStoreCategory](interfaces/TStoreCategory.md)
|
|
9
19
|
- [TStoreItem](interfaces/TStoreItem.md)
|
|
10
20
|
- [TMissionOrBadge](interfaces/TMissionOrBadge.md)
|
|
11
21
|
- [TMissionOrBadgeTask](interfaces/TMissionOrBadgeTask.md)
|
|
@@ -16,12 +26,6 @@
|
|
|
16
26
|
|
|
17
27
|
## Type Aliases
|
|
18
28
|
|
|
19
|
-
### TournamentRegistrationStatusName
|
|
20
|
-
|
|
21
|
-
Ƭ **TournamentRegistrationStatusName**: ``"NOT_REGISTERED"`` \| ``"REGISTERED"`` \| ``"FINISHED"`` \| ``"PENDING"`` \| ``"CANCELLED"`` \| ``"REGISTERED_PENDING_QUALIFICATION"`` \| ``"QUALIFIED_PENDING_REGISTRATION"``
|
|
22
|
-
|
|
23
|
-
___
|
|
24
|
-
|
|
25
29
|
### TournamentRegistrationTypeName
|
|
26
30
|
|
|
27
31
|
Ƭ **TournamentRegistrationTypeName**: ``"AUTO"`` \| ``"OPT_IN"`` \| ``"BUY_IN_POINTS"`` \| ``"MANUAL_APPROVAL"`` \| ``"REQUIRES_QUALIFICATION"`` \| ``"UNKNOWN"``
|
package/docs/classes/WSAPI.md
CHANGED
|
@@ -62,6 +62,30 @@ Returns all the store items available the current user
|
|
|
62
62
|
|
|
63
63
|
___
|
|
64
64
|
|
|
65
|
+
### getStoreCategories
|
|
66
|
+
|
|
67
|
+
▸ **getStoreCategories**(): `Promise`<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
68
|
+
|
|
69
|
+
Returns store categories
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`Promise`<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
74
|
+
|
|
75
|
+
___
|
|
76
|
+
|
|
77
|
+
### getMiniGames
|
|
78
|
+
|
|
79
|
+
▸ **getMiniGames**(): `Promise`<[`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]\>
|
|
80
|
+
|
|
81
|
+
Returns the list of mini-games available for user
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
`Promise`<[`TMiniGameTemplate`](../interfaces/TMiniGameTemplate.md)[]\>
|
|
86
|
+
|
|
87
|
+
___
|
|
88
|
+
|
|
65
89
|
### getTournamentsList
|
|
66
90
|
|
|
67
91
|
▸ **getTournamentsList**(): `Promise`<[`TTournament`](../interfaces/TTournament.md)[]\>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Enumeration: MiniGamePrizeTypeName
|
|
2
|
+
|
|
3
|
+
## Enumeration Members
|
|
4
|
+
|
|
5
|
+
### NO\_PRIZE
|
|
6
|
+
|
|
7
|
+
• **NO\_PRIZE** = ``"no-prize"``
|
|
8
|
+
|
|
9
|
+
___
|
|
10
|
+
|
|
11
|
+
### POINTS
|
|
12
|
+
|
|
13
|
+
• **POINTS** = ``"points"``
|
|
14
|
+
|
|
15
|
+
___
|
|
16
|
+
|
|
17
|
+
### BONUS
|
|
18
|
+
|
|
19
|
+
• **BONUS** = ``"bonus"``
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### MANUAL
|
|
24
|
+
|
|
25
|
+
• **MANUAL** = ``"manual"``
|
|
26
|
+
|
|
27
|
+
___
|
|
28
|
+
|
|
29
|
+
### SPIN
|
|
30
|
+
|
|
31
|
+
• **SPIN** = ``"spin"``
|
|
32
|
+
|
|
33
|
+
___
|
|
34
|
+
|
|
35
|
+
### JACKPOT
|
|
36
|
+
|
|
37
|
+
• **JACKPOT** = ``"jackpot"``
|
|
38
|
+
|
|
39
|
+
___
|
|
40
|
+
|
|
41
|
+
### UNKNOWN
|
|
42
|
+
|
|
43
|
+
• **UNKNOWN** = ``"unknown"``
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Enumeration: SAWBuyInTypeName
|
|
2
|
+
|
|
3
|
+
## Enumeration Members
|
|
4
|
+
|
|
5
|
+
### Free
|
|
6
|
+
|
|
7
|
+
• **Free** = ``"free"``
|
|
8
|
+
|
|
9
|
+
___
|
|
10
|
+
|
|
11
|
+
### Points
|
|
12
|
+
|
|
13
|
+
• **Points** = ``"points"``
|
|
14
|
+
|
|
15
|
+
___
|
|
16
|
+
|
|
17
|
+
### Spins
|
|
18
|
+
|
|
19
|
+
• **Spins** = ``"spins"``
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### Unknown
|
|
24
|
+
|
|
25
|
+
• **Unknown** = ``"unknown"``
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Enumeration: SAWGameTypeName
|
|
2
|
+
|
|
3
|
+
## Enumeration Members
|
|
4
|
+
|
|
5
|
+
### SpinAWheel
|
|
6
|
+
|
|
7
|
+
• **SpinAWheel** = ``"wheel"``
|
|
8
|
+
|
|
9
|
+
___
|
|
10
|
+
|
|
11
|
+
### ScratchCard
|
|
12
|
+
|
|
13
|
+
• **ScratchCard** = ``"scratch"``
|
|
14
|
+
|
|
15
|
+
___
|
|
16
|
+
|
|
17
|
+
### MatchX
|
|
18
|
+
|
|
19
|
+
• **MatchX** = ``"matchx"``
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### GiftBox
|
|
24
|
+
|
|
25
|
+
• **GiftBox** = ``"giftbox"``
|
|
26
|
+
|
|
27
|
+
___
|
|
28
|
+
|
|
29
|
+
### Unknown
|
|
30
|
+
|
|
31
|
+
• **Unknown** = ``"unknown"``
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Enumeration: TournamentRegistrationStatusName
|
|
2
|
+
|
|
3
|
+
## Enumeration Members
|
|
4
|
+
|
|
5
|
+
### NOT\_REGISTERED
|
|
6
|
+
|
|
7
|
+
• **NOT\_REGISTERED** = ``"NOT_REGISTERED"``
|
|
8
|
+
|
|
9
|
+
___
|
|
10
|
+
|
|
11
|
+
### REGISTERED
|
|
12
|
+
|
|
13
|
+
• **REGISTERED** = ``"REGISTERED"``
|
|
14
|
+
|
|
15
|
+
___
|
|
16
|
+
|
|
17
|
+
### FINISHED
|
|
18
|
+
|
|
19
|
+
• **FINISHED** = ``"FINISHED"``
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### PENDING
|
|
24
|
+
|
|
25
|
+
• **PENDING** = ``"PENDING"``
|
|
26
|
+
|
|
27
|
+
___
|
|
28
|
+
|
|
29
|
+
### CANCELLED
|
|
30
|
+
|
|
31
|
+
• **CANCELLED** = ``"CANCELLED"``
|
|
32
|
+
|
|
33
|
+
___
|
|
34
|
+
|
|
35
|
+
### REGISTERED\_PENDING\_QUALIFICATION
|
|
36
|
+
|
|
37
|
+
• **REGISTERED\_PENDING\_QUALIFICATION** = ``"REGISTERED_PENDING_QUALIFICATION"``
|
|
38
|
+
|
|
39
|
+
___
|
|
40
|
+
|
|
41
|
+
### QUALIFIED\_PENDING\_REGISTRATION
|
|
42
|
+
|
|
43
|
+
• **QUALIFIED\_PENDING\_REGISTRATION** = ``"QUALIFIED_PENDING_REGISTRATION"``
|
|
44
|
+
|
|
45
|
+
___
|
|
46
|
+
|
|
47
|
+
### UNKNOWN
|
|
48
|
+
|
|
49
|
+
• **UNKNOWN** = ``"UNKNOWN"``
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Interface: TMiniGamePrize
|
|
2
|
+
|
|
3
|
+
TMiniGamePrize interface describes the information of prize in the array of prizes in the TMiniGameTemplate
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### id
|
|
8
|
+
|
|
9
|
+
• **id**: `number`
|
|
10
|
+
|
|
11
|
+
ID of the prize
|
|
12
|
+
|
|
13
|
+
___
|
|
14
|
+
|
|
15
|
+
### name
|
|
16
|
+
|
|
17
|
+
• **name**: `string`
|
|
18
|
+
|
|
19
|
+
The visual name of the prize
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### prize\_type
|
|
24
|
+
|
|
25
|
+
• **prize\_type**: [`MiniGamePrizeTypeName`](../enums/MiniGamePrizeTypeName.md)
|
|
26
|
+
|
|
27
|
+
The type of the prize, no-prize, points, bonus, manual, spin, jackpot
|
|
28
|
+
|
|
29
|
+
___
|
|
30
|
+
|
|
31
|
+
### prize\_value
|
|
32
|
+
|
|
33
|
+
• `Optional` **prize\_value**: `number`
|
|
34
|
+
|
|
35
|
+
Numeric value of the prize in case it's pints or spin type
|
|
36
|
+
|
|
37
|
+
___
|
|
38
|
+
|
|
39
|
+
### font\_size
|
|
40
|
+
|
|
41
|
+
• `Optional` **font\_size**: `number`
|
|
42
|
+
|
|
43
|
+
Custom font size for the prize
|
|
44
|
+
|
|
45
|
+
___
|
|
46
|
+
|
|
47
|
+
### icon
|
|
48
|
+
|
|
49
|
+
• `Optional` **icon**: `string`
|
|
50
|
+
|
|
51
|
+
The URL of the icon of the prize
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Interface: TMiniGameTemplate
|
|
2
|
+
|
|
3
|
+
TMiniGameTemplate interface describes the information of mini-games available for the user
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### id
|
|
8
|
+
|
|
9
|
+
• **id**: `number`
|
|
10
|
+
|
|
11
|
+
ID of the mini-game template
|
|
12
|
+
|
|
13
|
+
___
|
|
14
|
+
|
|
15
|
+
### name
|
|
16
|
+
|
|
17
|
+
• **name**: `string`
|
|
18
|
+
|
|
19
|
+
Name of the mini-game template, translated to the user language
|
|
20
|
+
|
|
21
|
+
___
|
|
22
|
+
|
|
23
|
+
### description
|
|
24
|
+
|
|
25
|
+
• **description**: `string`
|
|
26
|
+
|
|
27
|
+
Description of the mini-game template, translated to the user language
|
|
28
|
+
|
|
29
|
+
___
|
|
30
|
+
|
|
31
|
+
### thumbnail
|
|
32
|
+
|
|
33
|
+
• **thumbnail**: `string`
|
|
34
|
+
|
|
35
|
+
URL of the icon of the mini-game template
|
|
36
|
+
|
|
37
|
+
___
|
|
38
|
+
|
|
39
|
+
### saw\_game\_type
|
|
40
|
+
|
|
41
|
+
• **saw\_game\_type**: [`SAWGameTypeName`](../enums/SAWGameTypeName.md)
|
|
42
|
+
|
|
43
|
+
The type of the game, e.g. Spin the Wheel, Gift Box, Scratch card, MatchX etc
|
|
44
|
+
|
|
45
|
+
___
|
|
46
|
+
|
|
47
|
+
### saw\_buyin\_type
|
|
48
|
+
|
|
49
|
+
• **saw\_buyin\_type**: [`SAWBuyInTypeName`](../enums/SAWBuyInTypeName.md)
|
|
50
|
+
|
|
51
|
+
How the user is charged for each game attempt e.g. Free, Points or Spin attempts
|
|
52
|
+
|
|
53
|
+
___
|
|
54
|
+
|
|
55
|
+
### buyin\_cost\_points
|
|
56
|
+
|
|
57
|
+
• **buyin\_cost\_points**: `number`
|
|
58
|
+
|
|
59
|
+
___
|
|
60
|
+
|
|
61
|
+
### spin\_count
|
|
62
|
+
|
|
63
|
+
• `Optional` **spin\_count**: `number`
|
|
64
|
+
|
|
65
|
+
___
|
|
66
|
+
|
|
67
|
+
### over\_limit\_message
|
|
68
|
+
|
|
69
|
+
• **over\_limit\_message**: `string`
|
|
70
|
+
|
|
71
|
+
The message that should be shown to the user when he cannot play the game, server rejected attempt with error code SAWSpinErrorCode.SAW_FAILED_MAX_SPINS_REACHED
|
|
72
|
+
|
|
73
|
+
___
|
|
74
|
+
|
|
75
|
+
### no\_attempts\_message
|
|
76
|
+
|
|
77
|
+
• **no\_attempts\_message**: `string`
|
|
78
|
+
|
|
79
|
+
The message that should be shown to the user when he cannot play the game because he doesn't have spin attempts or points.
|
|
80
|
+
|
|
81
|
+
___
|
|
82
|
+
|
|
83
|
+
### jackpot\_current
|
|
84
|
+
|
|
85
|
+
• **jackpot\_current**: `number`
|
|
86
|
+
|
|
87
|
+
Current jackpont amount, if jackpot is enabled.
|
|
88
|
+
|
|
89
|
+
___
|
|
90
|
+
|
|
91
|
+
### jackpot\_add\_on\_attempt
|
|
92
|
+
|
|
93
|
+
• **jackpot\_add\_on\_attempt**: `number`
|
|
94
|
+
|
|
95
|
+
The amount that will be added to the jackpot every time when somebody plays the game. Note that the contribution amount is abstract, means that no money or points are deducted from the user balance.
|
|
96
|
+
|
|
97
|
+
___
|
|
98
|
+
|
|
99
|
+
### jackpot\_symbol
|
|
100
|
+
|
|
101
|
+
• **jackpot\_symbol**: `string`
|
|
102
|
+
|
|
103
|
+
The symbol of jackpot that is giving the sense to the 'amount' E.g. the symbol could be EUR and connected to the amount it can indicate that amount is monetary, e.g. '100 EUR'. Or the symbol can be 'Free spins' and connected to the amount it can indicate that amount is number of free spins, e.g. '100 Free spins'.
|
|
104
|
+
|
|
105
|
+
___
|
|
106
|
+
|
|
107
|
+
### prizes
|
|
108
|
+
|
|
109
|
+
• **prizes**: [`TMiniGamePrize`](TMiniGamePrize.md)[]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Interface: TStoreCategory
|
|
2
|
+
|
|
3
|
+
TStoreCategory interface describes the store category item. Each store item can be assigned to 1 or more categories
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### id
|
|
8
|
+
|
|
9
|
+
• **id**: `number`
|
|
10
|
+
|
|
11
|
+
___
|
|
12
|
+
|
|
13
|
+
### name
|
|
14
|
+
|
|
15
|
+
• **name**: `string`
|
|
16
|
+
|
|
17
|
+
___
|
|
18
|
+
|
|
19
|
+
### order
|
|
20
|
+
|
|
21
|
+
• **order**: `number`
|
|
@@ -165,7 +165,7 @@ ___
|
|
|
165
165
|
|
|
166
166
|
### registration\_status
|
|
167
167
|
|
|
168
|
-
• **registration\_status**: `TournamentRegistrationStatusName`
|
|
168
|
+
• **registration\_status**: [`TournamentRegistrationStatusName`](../enums/TournamentRegistrationStatusName.md)
|
|
169
169
|
|
|
170
170
|
Status of registration in the tournament for current user
|
|
171
171
|
|
|
@@ -245,7 +245,7 @@ ___
|
|
|
245
245
|
|
|
246
246
|
### registration\_status
|
|
247
247
|
|
|
248
|
-
• **registration\_status**: `TournamentRegistrationStatusName`
|
|
248
|
+
• **registration\_status**: [`TournamentRegistrationStatusName`](../enums/TournamentRegistrationStatusName.md)
|
|
249
249
|
|
|
250
250
|
Status of registration in the tournament for current user
|
|
251
251
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
/** @hidden */
|
|
1
2
|
export enum SAWBuyInType {
|
|
2
3
|
Free = 1,
|
|
3
4
|
Points = 2,
|
|
4
5
|
Spins = 3
|
|
5
6
|
}
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export enum SAWBuyInTypeName {
|
|
9
|
+
Free = 'free',
|
|
10
|
+
Points = 'points',
|
|
11
|
+
Spins = 'spins',
|
|
12
|
+
Unknown = 'unknown'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** @hidden */
|
|
16
|
+
export const SAWBuyInTypeNamed = (type: SAWBuyInType): SAWBuyInTypeName => {
|
|
17
|
+
return {
|
|
18
|
+
[SAWBuyInType.Free]: SAWBuyInTypeName.Free,
|
|
19
|
+
[SAWBuyInType.Points]: SAWBuyInTypeName.Points,
|
|
20
|
+
[SAWBuyInType.Spins]: SAWBuyInTypeName.Spins
|
|
21
|
+
}[type] || SAWBuyInTypeName.Unknown;
|
|
11
22
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @hidden */
|
|
2
|
+
|
|
1
3
|
export enum SAWGameType {
|
|
2
4
|
SpinAWheel = 1,
|
|
3
5
|
ScratchCard = 2,
|
|
@@ -5,9 +7,20 @@ export enum SAWGameType {
|
|
|
5
7
|
GiftBox = 4
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export enum SAWGameTypeName {
|
|
11
|
+
SpinAWheel = "wheel",
|
|
12
|
+
ScratchCard = "scratch",
|
|
13
|
+
MatchX = "matchx",
|
|
14
|
+
GiftBox = "giftbox",
|
|
15
|
+
Unknown = "unknown"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** @hidden */
|
|
19
|
+
export const SAWGameTypeNamed = (type: SAWGameType): SAWGameTypeName => {
|
|
20
|
+
return {
|
|
21
|
+
[SAWGameType.SpinAWheel]: SAWGameTypeName.SpinAWheel,
|
|
22
|
+
[SAWGameType.ScratchCard]: SAWGameTypeName.ScratchCard,
|
|
23
|
+
[SAWGameType.MatchX]: SAWGameTypeName.MatchX,
|
|
24
|
+
[SAWGameType.GiftBox]: SAWGameTypeName.GiftBox
|
|
25
|
+
}[type] || SAWGameTypeName.Unknown;
|
|
13
26
|
}
|
|
@@ -1,8 +1,55 @@
|
|
|
1
|
+
import { TMiniGamePrize, TMiniGameTemplate } from "../WSAPI/WSAPITypes";
|
|
1
2
|
import { ProtocolResponse } from "./../Base/ProtocolResponse";
|
|
3
|
+
import { SAWBuyInTypeNamed } from "./SAWBuyInType";
|
|
4
|
+
import { SAWGameTypeNamed } from "./SAWGameType";
|
|
5
|
+
import { MiniGamePrizeTypeName, MiniGamePrizeTypeNamed } from "./SAWPrizeType";
|
|
2
6
|
import { SAWTemplate } from "./SAWTemplate";
|
|
7
|
+
import { SAWUtils } from "./SAWUtils";
|
|
3
8
|
|
|
4
9
|
|
|
5
10
|
export interface SAWGetTemplatesResponse extends ProtocolResponse {
|
|
6
11
|
|
|
7
12
|
templates: SAWTemplate[];
|
|
8
13
|
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[] => {
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
return items.map( r => {
|
|
20
|
+
|
|
21
|
+
const x: TMiniGameTemplate = {
|
|
22
|
+
|
|
23
|
+
id: r.saw_template_id,
|
|
24
|
+
name: r.saw_template_ui_definition.name,
|
|
25
|
+
description: r.saw_template_ui_definition.description,
|
|
26
|
+
thumbnail:
|
|
27
|
+
r.saw_skin_ui_definition?.skin_folder
|
|
28
|
+
? r.saw_skin_ui_definition?.skin_folder + '/ico.png'
|
|
29
|
+
: `https://libs.smartico.ai/gf/images/saw/${r.saw_skin_key}/ico.png`
|
|
30
|
+
,
|
|
31
|
+
over_limit_message: r.saw_template_ui_definition.over_limit_message,
|
|
32
|
+
no_attempts_message: r.saw_template_ui_definition.no_attempts_message,
|
|
33
|
+
jackpot_symbol: r.saw_template_ui_definition.jackpot_symbol,
|
|
34
|
+
saw_game_type: SAWGameTypeNamed[r.saw_game_type_id],
|
|
35
|
+
saw_buyin_type: SAWBuyInTypeNamed[r.saw_buyin_type_id],
|
|
36
|
+
buyin_cost_points: r.buyin_cost_points,
|
|
37
|
+
jackpot_add_on_attempt: r.jackpot_add_on_attempt,
|
|
38
|
+
jackpot_current: r.jackpot_current,
|
|
39
|
+
|
|
40
|
+
prizes: r.prizes.map( p => {
|
|
41
|
+
const y: TMiniGamePrize = {
|
|
42
|
+
id: p.saw_prize_id,
|
|
43
|
+
name: p.saw_prize_ui_definition.name,
|
|
44
|
+
prize_type: MiniGamePrizeTypeNamed(p.prize_type_id),
|
|
45
|
+
prize_value: p.prize_value,
|
|
46
|
+
font_size: p.saw_prize_ui_definition.font_size,
|
|
47
|
+
icon: p.saw_prize_ui_definition.icon
|
|
48
|
+
}
|
|
49
|
+
return y;
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
return x;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @hidden */
|
|
1
2
|
export enum SAWPrizeType {
|
|
2
3
|
|
|
3
4
|
NO_PRIZE = 1,
|
|
@@ -7,3 +8,25 @@ export enum SAWPrizeType {
|
|
|
7
8
|
SPIN = 5,
|
|
8
9
|
JACKPOT = 6
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
export enum MiniGamePrizeTypeName {
|
|
13
|
+
NO_PRIZE = 'no-prize',
|
|
14
|
+
POINTS = 'points',
|
|
15
|
+
BONUS = 'bonus',
|
|
16
|
+
MANUAL = 'manual',
|
|
17
|
+
SPIN = 'spin',
|
|
18
|
+
JACKPOT = 'jackpot',
|
|
19
|
+
UNKNOWN = "unknown"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @hidden */
|
|
23
|
+
export const MiniGamePrizeTypeNamed = (type: SAWPrizeType): MiniGamePrizeTypeName => {
|
|
24
|
+
return {
|
|
25
|
+
[SAWPrizeType.NO_PRIZE]: MiniGamePrizeTypeName.NO_PRIZE,
|
|
26
|
+
[SAWPrizeType.POINTS]: MiniGamePrizeTypeName.POINTS,
|
|
27
|
+
[SAWPrizeType.BONUS]: MiniGamePrizeTypeName.BONUS,
|
|
28
|
+
[SAWPrizeType.MANUAL]: MiniGamePrizeTypeName.MANUAL,
|
|
29
|
+
[SAWPrizeType.SPIN]: MiniGamePrizeTypeName.SPIN,
|
|
30
|
+
[SAWPrizeType.JACKPOT]: MiniGamePrizeTypeName.JACKPOT,
|
|
31
|
+
}[type] || MiniGamePrizeTypeName.UNKNOWN;
|
|
32
|
+
}
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -5,19 +5,19 @@ import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
|
|
|
5
5
|
import { SAWGetTemplatesRequest } from './MiniGames/SAWGetTemplatesRequest';
|
|
6
6
|
import { IntUtils } from './IntUtils';
|
|
7
7
|
import { ILogger } from './ILogger';
|
|
8
|
-
import { SAWDoSpinRequest, SAWDoSpinResponse, SAWSpinErrorCode } from './MiniGames';
|
|
8
|
+
import { SAWDoSpinRequest, SAWDoSpinResponse, SAWSpinErrorCode, SAWTemplatesTransform } from './MiniGames';
|
|
9
9
|
import { ECacheContext, OCache } from './OCache';
|
|
10
10
|
import { CoreUtils, GetTranslationsRequest, GetTranslationsResponse, ResponseIdentify, TranslationArea } from './Core';
|
|
11
11
|
import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
|
|
12
12
|
import { GetLabelInfoRequest } from './Core/GetLabelInfoRequest';
|
|
13
13
|
import { GetInboxMessagesRequest, GetInboxMessagesResponse } from './Inbox';
|
|
14
|
-
import { GetStoreItemsResponse, StoreItemTransform } from './Store';
|
|
14
|
+
import { GetCategoriesStoreResponse, GetStoreItemsResponse, StoreCategoryTransform, StoreItemTransform } from './Store';
|
|
15
15
|
import { AchievementType, GetAchievementMapRequest, GetAchievementMapResponse, UserAchievementTransform } from './Missions';
|
|
16
16
|
import { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequest, GetTournamentsResponse, TournamentItemsTransform, tournamentInfoItemTransform } from './Tournaments';
|
|
17
17
|
import { GetLeaderBoardsRequest, GetLeaderBoardsResponse, LeaderBoardDetails, LeaderBoardPeriodType } from "./Leaderboard";
|
|
18
18
|
import { GetLevelMapResponse, GetLevelMapResponseTransform } from "./Level";
|
|
19
19
|
import { WSAPI } from "./WSAPI/WSAPI";
|
|
20
|
-
import { TLevel, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed } from "./WSAPI/WSAPITypes";
|
|
20
|
+
import { TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed } from "./WSAPI/WSAPITypes";
|
|
21
21
|
|
|
22
22
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
23
23
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
@@ -289,9 +289,12 @@ class SmarticoAPI {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
return response;
|
|
292
|
-
|
|
293
292
|
}
|
|
294
293
|
|
|
294
|
+
public async sawGetTemplatesT(user_ext_id: string): Promise<TMiniGameTemplate[]> {
|
|
295
|
+
return SAWTemplatesTransform((await this.sawGetTemplates(user_ext_id)).templates);
|
|
296
|
+
}
|
|
297
|
+
|
|
295
298
|
public async sawSpinRequest(user_ext_id: string, saw_template_id: number, round_id: number): Promise<SAWDoSpinResponse> {
|
|
296
299
|
|
|
297
300
|
const message = this.buildMessage<SAWDoSpinRequest, SAWDoSpinResponse>(user_ext_id, ClassId.SAW_DO_SPIN_REQUEST, {
|
|
@@ -336,12 +339,21 @@ class SmarticoAPI {
|
|
|
336
339
|
|
|
337
340
|
const message = this.buildMessage<any, GetStoreItemsResponse>(user_ext_id, ClassId.GET_SHOP_ITEMS_REQUEST);
|
|
338
341
|
return await this.send<GetStoreItemsResponse>(message, ClassId.GET_SHOP_ITEMS_RESPONSE);
|
|
339
|
-
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
public async storeGetItemsT(user_ext_id: string): Promise<TStoreItem[]> {
|
|
343
345
|
return StoreItemTransform((await this.storeGetItems(user_ext_id)).items);
|
|
344
|
-
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
public async storeGetCategories(user_ext_id: string): Promise<GetCategoriesStoreResponse> {
|
|
349
|
+
|
|
350
|
+
const message = this.buildMessage<any, GetCategoriesStoreResponse>(user_ext_id, ClassId.GET_SHOP_CATEGORIES_REQUEST);
|
|
351
|
+
return await this.send<GetCategoriesStoreResponse>(message, ClassId.GET_SHOP_CATEGORIES_RESPONSE);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
public async storeGetCategoriesT(user_ext_id: string): Promise<TStoreCategory[]> {
|
|
355
|
+
return StoreCategoryTransform((await this.storeGetCategories(user_ext_id)).categories);
|
|
356
|
+
}
|
|
345
357
|
|
|
346
358
|
public async missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse> {
|
|
347
359
|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
import { TStoreCategory } from "../WSAPI/WSAPITypes";
|
|
1
2
|
import { StoreCategoryPublicMeta } from "./StoreCategoryPublicMeta";
|
|
2
3
|
|
|
3
4
|
export interface StoreCategory {
|
|
4
5
|
|
|
5
6
|
id?: number;
|
|
6
7
|
publicMeta?: StoreCategoryPublicMeta;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const StoreCategoryTransform = (items: StoreCategory[]): TStoreCategory[] => {
|
|
11
|
+
return items.map( r => {
|
|
12
|
+
const x: TStoreCategory = {
|
|
13
|
+
id: r.id,
|
|
14
|
+
name: r.publicMeta?.name,
|
|
15
|
+
order: r.publicMeta?.order
|
|
16
|
+
}
|
|
17
|
+
return x;
|
|
18
|
+
})
|
|
7
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {TournamentRegistrationType, TournamentRegistrationTypeGetName} from "./TournamentRegistrationType";
|
|
2
2
|
import {TournamentInstanceStatus} from "./TournamentInstanceStatus";
|
|
3
|
-
import { TournamentRegistrationStatus, TournamentRegistrationStatusName } from "./TournamentRegistrationStatus";
|
|
3
|
+
import { TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed } from "./TournamentRegistrationStatus";
|
|
4
4
|
import { TournamentType } from "./TournamentType";
|
|
5
5
|
import { TournamentPublicMeta } from "./TournamentPublicMeta";
|
|
6
6
|
import { TTournament } from "../WSAPI/WSAPITypes";
|
|
@@ -77,7 +77,7 @@ export const TournamentItemsTransform = (items: Tournament[]): TTournament[] =>
|
|
|
77
77
|
is_user_registered: r.isUserRegistered,
|
|
78
78
|
players_min_count: r.playersMinCount,
|
|
79
79
|
players_max_count: r.playersMaxCount,
|
|
80
|
-
registration_status:
|
|
80
|
+
registration_status: TournamentRegistrationStatusNamed(r.tournamentRegistrationStatus),
|
|
81
81
|
|
|
82
82
|
registration_type: TournamentRegistrationTypeGetName(r.registrationType),
|
|
83
83
|
registration_cost_points: r.buyInAmount,
|