@splash-tech/jackpot-sdk 1.1.3 → 1.1.4
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 +117 -72
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,94 +1,139 @@
|
|
|
1
1
|
# Splash Jackpot SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Splash Jackpot SDK allows operators to integrate jackpot widgets into their applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The SDK provides two widgets:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **Footer Widget** – displays current jackpot values to players
|
|
8
|
+
- **Win Widget** – shows a full-screen animation when a jackpot is won
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
Widgets run inside **isolated iframes hosted by Splash infrastructure**.
|
|
11
|
+
Communication between the host application and widgets is handled automatically by the SDK using `postMessage`.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @splash-tech/jackpot-sdk
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
---
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
# Quick Start
|
|
16
24
|
|
|
17
|
-
|
|
18
|
-
- If the container is not found, the widget will fall back to the body
|
|
19
|
-
- When using a container:
|
|
20
|
-
- The widget will be positioned relative to the container
|
|
21
|
-
- The container will be set to `position: relative`
|
|
22
|
-
- The widget will maintain its size but be contained within the target element
|
|
25
|
+
## Launch Footer Widget
|
|
23
26
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
```ts
|
|
28
|
+
import { splashJackpot } from '@splash-tech/jackpot-sdk';
|
|
29
|
+
|
|
30
|
+
splashJackpot.footerWidget.launch({
|
|
31
|
+
data: widgetData,
|
|
28
32
|
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Launch Win Widget
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
```ts
|
|
40
|
+
import { splashJackpot } from '@splash-tech/jackpot-sdk';
|
|
41
|
+
|
|
42
|
+
splashJackpot.winWidget.launch({
|
|
43
|
+
data: winData,
|
|
34
44
|
});
|
|
45
|
+
```
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
# Widget Launch Parameters
|
|
50
|
+
|
|
51
|
+
| Parameter | Type | Default | Description |
|
|
52
|
+
| --------- | ------ | ------------- | --------------------------------------------------------- |
|
|
53
|
+
| data | object | null | Widget data from Splash backend |
|
|
54
|
+
| container | string | document.body | CSS selector where widget will be injected |
|
|
55
|
+
| mode | string | production | SDK environment (`local`, `dev`, `staging`, `production`) |
|
|
56
|
+
| jackpotId | string | undefined | Jackpot identifier |
|
|
57
|
+
| tag | string | undefined | Game tag |
|
|
58
|
+
| brand | string | undefined | Operator brand |
|
|
59
|
+
|
|
60
|
+
Example:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
splashJackpot.footerWidget.launch({
|
|
64
|
+
data: widgetData,
|
|
65
|
+
container: '#game-container',
|
|
66
|
+
mode: 'production',
|
|
67
|
+
jackpotId: 'jackpot-id',
|
|
68
|
+
tag: 'game-tag',
|
|
69
|
+
brand: 'brand-name',
|
|
70
|
+
});
|
|
38
71
|
```
|
|
39
72
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
# Widget API
|
|
76
|
+
|
|
77
|
+
## Footer Widget
|
|
78
|
+
|
|
79
|
+
- `launch()` – launch widget
|
|
80
|
+
- `updateData()` – update jackpot values
|
|
81
|
+
- `isLaunched()` – check if widget is active
|
|
82
|
+
- `addEventListener()` – listen to widget events
|
|
83
|
+
- `removeEventListener()` – remove specific listener
|
|
84
|
+
- `removeAllEventListeners()` – remove all listeners
|
|
85
|
+
- `destroy()` – remove widget from DOM
|
|
86
|
+
|
|
87
|
+
## Win Widget
|
|
88
|
+
|
|
89
|
+
- `launch()`
|
|
90
|
+
- `isLaunched()`
|
|
91
|
+
- `addEventListener()`
|
|
92
|
+
- `removeEventListener()`
|
|
93
|
+
- `removeAllEventListeners()`
|
|
94
|
+
- `destroy()`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
# Events
|
|
99
|
+
|
|
100
|
+
## Footer Widget
|
|
101
|
+
|
|
102
|
+
| Event | Description |
|
|
103
|
+
| ----------------- | ---------------------------------- |
|
|
104
|
+
| showPopup | Footer popup opened |
|
|
105
|
+
| hidePopup | Footer popup closed |
|
|
106
|
+
| participateChange | User toggled jackpot participation |
|
|
107
|
+
|
|
108
|
+
Example:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
splashJackpot.footerWidget.addEventListener('showPopup', () => {
|
|
112
|
+
console.log('Popup opened');
|
|
113
|
+
});
|
|
70
114
|
```
|
|
71
115
|
|
|
72
|
-
|
|
116
|
+
---
|
|
73
117
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
118
|
+
## Win Widget
|
|
119
|
+
|
|
120
|
+
| Event | Description |
|
|
121
|
+
| ----- | ----------------- |
|
|
122
|
+
| close | Win widget closed |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
# Cleanup
|
|
127
|
+
|
|
128
|
+
When the widget is no longer needed:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
splashJackpot.footerWidget.removeAllEventListeners();
|
|
132
|
+
splashJackpot.footerWidget.destroy();
|
|
89
133
|
```
|
|
90
134
|
|
|
91
|
-
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
# Documentation
|
|
92
138
|
|
|
93
|
-
|
|
94
|
-
- `splash-jackpots.d.ts` - TypeScript type definitions
|
|
139
|
+
For full integration instructions, backend communication flow, and advanced usage, refer to the complete [documentation](https://www.notion.so/Jackpot-Widgets-320975a6f2ab80118284e6165d569843?pvs=25#325975a6f2ab8096be15dfc7eda06028).
|