@everymatrix/casino-play-random-game 1.44.0 → 1.45.2
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/casino-play-random-game/casino-play-random-game.esm.js +1 -1
- package/dist/casino-play-random-game/p-b4a84056.entry.js +1 -0
- package/dist/casino-play-random-game/p-d2e799c3.js +2 -0
- package/dist/casino-play-random-game/p-e1255160.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/casino-play-random-game.cjs.entry.js +288 -308
- package/dist/cjs/casino-play-random-game.cjs.js +17 -11
- package/dist/cjs/index-4cc20a8d.js +1217 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/casino-play-random-game/casino-play-random-game.css +0 -11
- package/dist/collection/components/casino-play-random-game/casino-play-random-game.js +432 -463
- package/dist/collection/components/casino-play-random-game/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +58 -58
- package/dist/collection/utils/utils.js +22 -22
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/casino-play-random-game.entry.js +288 -308
- package/dist/esm/casino-play-random-game.js +14 -11
- package/dist/esm/index-7666b794.js +1190 -0
- package/dist/esm/loader.js +7 -13
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-play-random-game/.stencil/packages/stencil/casino-play-random-game/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-play-random-game/.stencil/packages/stencil/casino-play-random-game/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/casino-play-random-game/casino-play-random-game.d.ts +72 -72
- package/dist/types/components/casino-play-random-game/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +8 -1
- package/dist/casino-play-random-game/p-0f38b3f8.js +0 -1
- package/dist/casino-play-random-game/p-1a049c0f.entry.js +0 -1
- package/dist/cjs/index-8944e204.js +0 -1247
- package/dist/components/casino-play-random-game.d.ts +0 -11
- package/dist/components/casino-play-random-game.js +0 -375
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/esm/index-58563736.js +0 -1221
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-play-random-game/.stencil/packages/casino-play-random-game/stencil.config.d.ts +0 -2
|
@@ -1,479 +1,448 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getDevice } from
|
|
3
|
-
import { getTranslations, translate } from
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { getDevice } from "../../utils/utils";
|
|
3
|
+
import { getTranslations, translate } from "../../utils/locale.utils";
|
|
4
4
|
export class CasinoPlayRandomGame {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
currentIndex--;
|
|
54
|
-
[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
|
|
55
|
-
}
|
|
56
|
-
return array;
|
|
57
|
-
};
|
|
58
|
-
this.setClientStyling = () => {
|
|
59
|
-
let sheet = document.createElement('style');
|
|
60
|
-
sheet.innerHTML = this.clientStyling;
|
|
61
|
-
this.host.shadowRoot.prepend(sheet);
|
|
62
|
-
};
|
|
63
|
-
this.setClientStylingURL = () => {
|
|
64
|
-
let url = new URL(this.clientStylingUrl);
|
|
65
|
-
let cssFile = document.createElement('style');
|
|
66
|
-
fetch(url.href)
|
|
67
|
-
.then((res) => res.text())
|
|
68
|
-
.then((data) => {
|
|
69
|
-
cssFile.innerHTML = data;
|
|
70
|
-
this.clientStyling = data;
|
|
71
|
-
setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
watchEndpoint(newValue, oldValue) {
|
|
76
|
-
if (newValue && newValue != oldValue && this.endpoint) {
|
|
77
|
-
this.fetchGameList();
|
|
5
|
+
constructor() {
|
|
6
|
+
this.animation = null;
|
|
7
|
+
this.selectedGameIndex = null;
|
|
8
|
+
this.selectedGameEl = null;
|
|
9
|
+
this.iconVisibility = null;
|
|
10
|
+
this.shuffle = (array) => {
|
|
11
|
+
let currentIndex = array.length;
|
|
12
|
+
let randomIndex;
|
|
13
|
+
while (currentIndex !== 0) {
|
|
14
|
+
randomIndex = Math.floor(Math.random() * currentIndex);
|
|
15
|
+
currentIndex--;
|
|
16
|
+
[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
|
|
17
|
+
}
|
|
18
|
+
return array;
|
|
19
|
+
};
|
|
20
|
+
this.setClientStyling = () => {
|
|
21
|
+
let sheet = document.createElement('style');
|
|
22
|
+
sheet.innerHTML = this.clientStyling;
|
|
23
|
+
this.host.shadowRoot.prepend(sheet);
|
|
24
|
+
};
|
|
25
|
+
this.setClientStylingURL = () => {
|
|
26
|
+
let url = new URL(this.clientStylingUrl);
|
|
27
|
+
let cssFile = document.createElement('style');
|
|
28
|
+
fetch(url.href)
|
|
29
|
+
.then((res) => res.text())
|
|
30
|
+
.then((data) => {
|
|
31
|
+
cssFile.innerHTML = data;
|
|
32
|
+
this.clientStyling = data;
|
|
33
|
+
setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
this.endpoint = undefined;
|
|
37
|
+
this.datasource = undefined;
|
|
38
|
+
this.language = 'en';
|
|
39
|
+
this.specificCategory = '';
|
|
40
|
+
this.iconVisible = '';
|
|
41
|
+
this.iconVisibleOnAnim = '';
|
|
42
|
+
this.launchByGameCard = '';
|
|
43
|
+
this.clientStyling = '';
|
|
44
|
+
this.clientStylingUrl = '';
|
|
45
|
+
this.translationUrl = '';
|
|
46
|
+
this.hasErrors = false;
|
|
47
|
+
this.limitStylingAppends = false;
|
|
48
|
+
this.isLoading = true;
|
|
49
|
+
this.gamesToShow = undefined;
|
|
50
|
+
this.selectedGame = null;
|
|
51
|
+
this.animationDone = false;
|
|
52
|
+
this.animationStarted = false;
|
|
78
53
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.isLoading = false;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
handleIsIconVisible() {
|
|
87
|
-
this.iconVisibility = this.iconVisible === 'true' ? true : false;
|
|
88
|
-
}
|
|
89
|
-
connectedCallback() {
|
|
90
|
-
this.handleIsIconVisible();
|
|
91
|
-
}
|
|
92
|
-
componentWillLoad() {
|
|
93
|
-
if (this.translationUrl.length > 2) {
|
|
94
|
-
getTranslations(this.translationUrl);
|
|
54
|
+
watchEndpoint(newValue, oldValue) {
|
|
55
|
+
if (newValue && newValue != oldValue && this.endpoint) {
|
|
56
|
+
this.fetchGameList();
|
|
57
|
+
}
|
|
95
58
|
}
|
|
96
|
-
|
|
97
|
-
|
|
59
|
+
handleNewTranslations() {
|
|
60
|
+
this.isLoading = true;
|
|
61
|
+
getTranslations(this.translationUrl).then(() => {
|
|
62
|
+
this.isLoading = false;
|
|
63
|
+
});
|
|
98
64
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!this.limitStylingAppends && this.host) {
|
|
102
|
-
if (this.clientStyling)
|
|
103
|
-
this.setClientStyling();
|
|
104
|
-
if (this.clientStylingUrl)
|
|
105
|
-
this.setClientStylingURL();
|
|
106
|
-
this.limitStylingAppends = true;
|
|
65
|
+
handleIsIconVisible() {
|
|
66
|
+
this.iconVisibility = this.iconVisible === 'true' ? true : false;
|
|
107
67
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
let url = new URL(`${this.endpoint}/v1/casino/games`);
|
|
111
|
-
url.searchParams.append('platform', getDevice());
|
|
112
|
-
url.searchParams.append('datasource', this.datasource);
|
|
113
|
-
url.searchParams.append('fields', 'gId,id,href,thumbnail,name,vendor,launchUrl,subVendor');
|
|
114
|
-
url.searchParams.append('expand', 'vendor');
|
|
115
|
-
// Number of games chosen
|
|
116
|
-
url.searchParams.append('pagination', 'offset=0,limit=423');
|
|
117
|
-
url.searchParams.append('language', this.language);
|
|
118
|
-
if (this.specificCategory) {
|
|
119
|
-
url.searchParams.append('filter', `categories(id=${this.specificCategory})`);
|
|
68
|
+
connectedCallback() {
|
|
69
|
+
this.handleIsIconVisible();
|
|
120
70
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}).catch((err) => {
|
|
129
|
-
console.error(err);
|
|
130
|
-
this.hasErrors = true;
|
|
131
|
-
reject(err);
|
|
132
|
-
}).finally(() => {
|
|
133
|
-
this.isLoading = false;
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
setUpGames(games) {
|
|
138
|
-
// Only 40 games will be selected at a time; the random game will be selected from these.
|
|
139
|
-
const shuffledGames = this.shuffle(games).slice(0, 40);
|
|
140
|
-
// Clone the games
|
|
141
|
-
return shuffledGames.concat(shuffledGames);
|
|
142
|
-
}
|
|
143
|
-
selectRandomGame() {
|
|
144
|
-
const originalGamesLength = this.gamesToShow.length / 2;
|
|
145
|
-
// Substract 3 to ensure there are always at least 5 cards after the selected one
|
|
146
|
-
this.selectedGameIndex = Math.floor(Math.random() * (originalGamesLength - 3));
|
|
147
|
-
// Offset by the length of the original to select from the cloned part
|
|
148
|
-
this.selectedGameIndex += originalGamesLength;
|
|
149
|
-
this.selectedGameEl = this.gameContainer.children[this.selectedGameIndex];
|
|
150
|
-
}
|
|
151
|
-
playRandomGame() {
|
|
152
|
-
this.animateGames();
|
|
153
|
-
//@ts-ignore
|
|
154
|
-
if (typeof gtag == 'function') {
|
|
155
|
-
//@ts-ignore
|
|
156
|
-
gtag('event', 'PlayRandomGame', {
|
|
157
|
-
'context': 'CasinoPlayRandomGame'
|
|
158
|
-
});
|
|
71
|
+
componentWillLoad() {
|
|
72
|
+
if (this.translationUrl.length > 2) {
|
|
73
|
+
getTranslations(this.translationUrl);
|
|
74
|
+
}
|
|
75
|
+
if (this.endpoint && this.language && this.datasource) {
|
|
76
|
+
return this.fetchGameList();
|
|
77
|
+
}
|
|
159
78
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
79
|
+
componentDidLoad() {
|
|
80
|
+
if (!this.limitStylingAppends && this.host) {
|
|
81
|
+
if (this.clientStyling)
|
|
82
|
+
this.setClientStyling();
|
|
83
|
+
if (this.clientStylingUrl)
|
|
84
|
+
this.setClientStylingURL();
|
|
85
|
+
this.limitStylingAppends = true;
|
|
86
|
+
}
|
|
169
87
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
88
|
+
fetchGameList() {
|
|
89
|
+
let url = new URL(`${this.endpoint}/v1/casino/games`);
|
|
90
|
+
url.searchParams.append('platform', getDevice());
|
|
91
|
+
url.searchParams.append('datasource', this.datasource);
|
|
92
|
+
url.searchParams.append('fields', 'gId,id,href,thumbnail,name,vendor,launchUrl,subVendor');
|
|
93
|
+
url.searchParams.append('expand', 'vendor');
|
|
94
|
+
// Number of games chosen
|
|
95
|
+
url.searchParams.append('pagination', 'offset=0,limit=423');
|
|
96
|
+
url.searchParams.append('language', this.language);
|
|
97
|
+
if (this.specificCategory) {
|
|
98
|
+
url.searchParams.append('filter', `categories(id=${this.specificCategory})`);
|
|
99
|
+
}
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
this.isLoading = true;
|
|
102
|
+
fetch(url.href)
|
|
103
|
+
.then((res) => res.json())
|
|
104
|
+
.then((data) => {
|
|
105
|
+
this.gamesToShow = this.setUpGames(data === null || data === void 0 ? void 0 : data.items);
|
|
106
|
+
resolve(true);
|
|
107
|
+
}).catch((err) => {
|
|
108
|
+
console.error(err);
|
|
109
|
+
this.hasErrors = true;
|
|
110
|
+
reject(err);
|
|
111
|
+
}).finally(() => {
|
|
112
|
+
this.isLoading = false;
|
|
113
|
+
});
|
|
114
|
+
});
|
|
181
115
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const translation = ((cardWidth + gap) * this.selectedGameIndex) + // Width of game cards up to the selected
|
|
188
|
-
(cardWidth / 2) - // Additional half card width to center to the selected game
|
|
189
|
-
(gameContainerWidth / 2); // Minus half the container width to center the card
|
|
190
|
-
const containerRolling = [
|
|
191
|
-
{ transform: `translateX(0px)`, scale: 1 },
|
|
192
|
-
{ scale: 0.75 },
|
|
193
|
-
{ transform: `translateX(-${translation}px)`, scale: 1 }
|
|
194
|
-
];
|
|
195
|
-
const containerTiming = {
|
|
196
|
-
duration: 3000,
|
|
197
|
-
easing: 'cubic-bezier(0.5, 0, 0.5, 1.2)',
|
|
198
|
-
fill: 'forwards'
|
|
199
|
-
};
|
|
200
|
-
this.animation = this.gameContainer.animate(containerRolling, containerTiming);
|
|
201
|
-
this.animation.onfinish = () => {
|
|
202
|
-
this.animationDone = true;
|
|
203
|
-
this.selectedGameEl.classList.add('TheRandomGame');
|
|
204
|
-
this.selectedGame = this.gamesToShow[this.selectedGameIndex];
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
playGame() {
|
|
208
|
-
if (!this.selectedGame)
|
|
209
|
-
return;
|
|
210
|
-
window.postMessage({ type: 'PlayRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
|
|
211
|
-
//@ts-ignore
|
|
212
|
-
if (typeof gtag == 'function') {
|
|
213
|
-
//@ts-ignore
|
|
214
|
-
gtag('event', 'OpenRandomGame', {
|
|
215
|
-
'context': 'CasinoPlayRandomGame'
|
|
216
|
-
});
|
|
116
|
+
setUpGames(games) {
|
|
117
|
+
// Only 40 games will be selected at a time; the random game will be selected from these.
|
|
118
|
+
const shuffledGames = this.shuffle(games).slice(0, 40);
|
|
119
|
+
// Clone the games
|
|
120
|
+
return shuffledGames.concat(shuffledGames);
|
|
217
121
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
gtag('event', 'OpenRandomGameInfo', {
|
|
226
|
-
'context': 'CasinoPlayRandomGame'
|
|
227
|
-
});
|
|
122
|
+
selectRandomGame() {
|
|
123
|
+
const originalGamesLength = this.gamesToShow.length / 2;
|
|
124
|
+
// Substract 3 to ensure there are always at least 5 cards after the selected one
|
|
125
|
+
this.selectedGameIndex = Math.floor(Math.random() * (originalGamesLength - 3));
|
|
126
|
+
// Offset by the length of the original to select from the cloned part
|
|
127
|
+
this.selectedGameIndex += originalGamesLength;
|
|
128
|
+
this.selectedGameEl = this.gameContainer.children[this.selectedGameIndex];
|
|
228
129
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
h("button", { class: "RandomButton On", onClick: () => this.playGame() }, translate('playNowRandomGame', this.language))));
|
|
239
|
-
}
|
|
240
|
-
render() {
|
|
241
|
-
if (this.hasErrors) {
|
|
242
|
-
return (h("div", { class: "RandomGameError" },
|
|
243
|
-
h("div", { class: "Title" }, translate('error', this.language))));
|
|
130
|
+
playRandomGame() {
|
|
131
|
+
this.animateGames();
|
|
132
|
+
//@ts-ignore
|
|
133
|
+
if (typeof gtag == 'function') {
|
|
134
|
+
//@ts-ignore
|
|
135
|
+
gtag('event', 'PlayRandomGame', {
|
|
136
|
+
'context': 'CasinoPlayRandomGame'
|
|
137
|
+
});
|
|
138
|
+
}
|
|
244
139
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
140
|
+
respin() {
|
|
141
|
+
this.animateGames();
|
|
142
|
+
//@ts-ignore
|
|
143
|
+
if (typeof gtag == 'function') {
|
|
144
|
+
//@ts-ignore
|
|
145
|
+
gtag('event', 'RespinRandomGame', {
|
|
146
|
+
'context': 'CasinoPlayRandomGame'
|
|
147
|
+
});
|
|
148
|
+
}
|
|
248
149
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
this.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
150
|
+
animateGames() {
|
|
151
|
+
this.iconVisibility = this.iconVisibleOnAnim === 'true' ? true : false;
|
|
152
|
+
this.animationStarted = true;
|
|
153
|
+
this.animationDone = false;
|
|
154
|
+
if (this.animation)
|
|
155
|
+
this.animation.cancel();
|
|
156
|
+
if (this.selectedGameEl) {
|
|
157
|
+
this.selectedGameEl.classList.remove('TheRandomGame');
|
|
158
|
+
this.selectedGame = null;
|
|
159
|
+
this.selectedGameIndex = null;
|
|
160
|
+
}
|
|
161
|
+
this.selectRandomGame();
|
|
162
|
+
const gapStyle = window.getComputedStyle(this.gameContainer).getPropertyValue('gap');
|
|
163
|
+
const gap = parseInt(gapStyle, 10);
|
|
164
|
+
const cardWidth = this.selectedGameEl.offsetWidth;
|
|
165
|
+
const gameContainerWidth = this.gameContainer.offsetWidth;
|
|
166
|
+
const translation = ((cardWidth + gap) * this.selectedGameIndex) + // Width of game cards up to the selected
|
|
167
|
+
(cardWidth / 2) - // Additional half card width to center to the selected game
|
|
168
|
+
(gameContainerWidth / 2); // Minus half the container width to center the card
|
|
169
|
+
const containerRolling = [
|
|
170
|
+
{ transform: `translateX(0px)`, scale: 1 },
|
|
171
|
+
{ scale: 0.75 },
|
|
172
|
+
{ transform: `translateX(-${translation}px)`, scale: 1 }
|
|
173
|
+
];
|
|
174
|
+
const containerTiming = {
|
|
175
|
+
duration: 3000,
|
|
176
|
+
easing: 'cubic-bezier(0.5, 0, 0.5, 1.2)',
|
|
177
|
+
fill: 'forwards'
|
|
178
|
+
};
|
|
179
|
+
this.animation = this.gameContainer.animate(containerRolling, containerTiming);
|
|
180
|
+
this.animation.onfinish = () => {
|
|
181
|
+
this.animationDone = true;
|
|
182
|
+
this.selectedGameEl.classList.add('TheRandomGame');
|
|
183
|
+
this.selectedGame = this.gamesToShow[this.selectedGameIndex];
|
|
184
|
+
};
|
|
263
185
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
186
|
+
playGame() {
|
|
187
|
+
if (!this.selectedGame)
|
|
188
|
+
return;
|
|
189
|
+
window.postMessage({ type: 'PlayRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
|
|
190
|
+
//@ts-ignore
|
|
191
|
+
if (typeof gtag == 'function') {
|
|
192
|
+
//@ts-ignore
|
|
193
|
+
gtag('event', 'OpenRandomGame', {
|
|
194
|
+
'context': 'CasinoPlayRandomGame'
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
;
|
|
199
|
+
showGameInfo() {
|
|
200
|
+
window.postMessage({ type: 'InfoRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
|
|
201
|
+
//@ts-ignore
|
|
202
|
+
if (typeof gtag == 'function') {
|
|
203
|
+
//@ts-ignore
|
|
204
|
+
gtag('event', 'OpenRandomGameInfo', {
|
|
205
|
+
'context': 'CasinoPlayRandomGame'
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
renderGameDetails() {
|
|
210
|
+
return h("div", { class: "RandomButtonsWrapper" }, h("div", { class: "RandomGameDetails" }, h("span", { class: "RandomGameTitle" }, this.selectedGame.name), h("span", { class: "RandomGameInfo", onClick: () => this.showGameInfo() }, "i")), h("div", { class: "RandomButtons" }, h("button", { class: "RandomButton On", onClick: () => this.respin() }, translate('spinRandomGame', this.language)), !this.launchByGameCard &&
|
|
211
|
+
h("button", { class: "RandomButton On", onClick: () => this.playGame() }, translate('playNowRandomGame', this.language))));
|
|
212
|
+
}
|
|
213
|
+
render() {
|
|
214
|
+
if (this.hasErrors) {
|
|
215
|
+
return (h("div", { class: "RandomGameError" }, h("div", { class: "Title" }, translate('error', this.language))));
|
|
216
|
+
}
|
|
217
|
+
if (this.isLoading) {
|
|
218
|
+
return (h("div", { class: "RandomGameLoading" }, h("div", { class: "Title" }, translate('randomGameLoading', this.language))));
|
|
219
|
+
}
|
|
220
|
+
if (!this.isLoading) {
|
|
221
|
+
return h("div", { class: "RandomGameWrapper" }, h("div", { class: 'GameContainerGradient' }), h("div", { class: 'GamesContainer', ref: (el) => this.gameContainer = el }, this.gamesToShow && this.gamesToShow.map((game, index) => (h("div", { class: 'RandomGameCard', key: index, onClick: this.launchByGameCard === 'true' ? () => this.playGame() : null }, h("div", { class: "RandomGameVendor" }, game.vendor.name), h("img", { class: 'RandomGameImage', src: game.thumbnail, alt: game.name, title: game.name }), this.selectedGame && this.selectedGameIndex === index && this.renderGameDetails())))), h("div", { class: `ButtonWrapper ${this.animationDone ? 'HideAnimation' : ''}` }, h("div", { class: "ButtonContainer" }, this.iconVisibility && h("div", { class: `ButtonIcon ${this.animationStarted ? 'Flip' : ''}` }, h("div", { class: "QustionMark" }, "?"), h("div", { class: "HexagonMarkShadow" }), h("div", { class: "HexagonMark" })), !this.animationStarted && h("div", { class: `RandomButton ${this.animationStarted ? 'HideAnimation' : ''}`, onClick: () => this.playRandomGame() }, translate('playRandomGame', this.language)))));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
static get is() { return "casino-play-random-game"; }
|
|
225
|
+
static get encapsulation() { return "shadow"; }
|
|
226
|
+
static get originalStyleUrls() {
|
|
227
|
+
return {
|
|
228
|
+
"$": ["casino-play-random-game.scss"]
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
static get styleUrls() {
|
|
232
|
+
return {
|
|
233
|
+
"$": ["casino-play-random-game.css"]
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
static get properties() {
|
|
237
|
+
return {
|
|
238
|
+
"endpoint": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "string",
|
|
243
|
+
"resolved": "string",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "Endpoint URL for the source of data"
|
|
251
|
+
},
|
|
252
|
+
"attribute": "endpoint",
|
|
253
|
+
"reflect": true
|
|
254
|
+
},
|
|
255
|
+
"datasource": {
|
|
256
|
+
"type": "string",
|
|
257
|
+
"mutable": false,
|
|
258
|
+
"complexType": {
|
|
259
|
+
"original": "string",
|
|
260
|
+
"resolved": "string",
|
|
261
|
+
"references": {}
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"optional": false,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [],
|
|
267
|
+
"text": "Name of the datasource, as configured in CE."
|
|
268
|
+
},
|
|
269
|
+
"attribute": "datasource",
|
|
270
|
+
"reflect": true
|
|
271
|
+
},
|
|
272
|
+
"language": {
|
|
273
|
+
"type": "string",
|
|
274
|
+
"mutable": false,
|
|
275
|
+
"complexType": {
|
|
276
|
+
"original": "string",
|
|
277
|
+
"resolved": "string",
|
|
278
|
+
"references": {}
|
|
279
|
+
},
|
|
280
|
+
"required": false,
|
|
281
|
+
"optional": false,
|
|
282
|
+
"docs": {
|
|
283
|
+
"tags": [],
|
|
284
|
+
"text": "Language of the widget"
|
|
285
|
+
},
|
|
286
|
+
"attribute": "language",
|
|
287
|
+
"reflect": true,
|
|
288
|
+
"defaultValue": "'en'"
|
|
289
|
+
},
|
|
290
|
+
"specificCategory": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "string",
|
|
295
|
+
"resolved": "string",
|
|
296
|
+
"references": {}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": false,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": "Configure a specific category for randomising the games."
|
|
303
|
+
},
|
|
304
|
+
"attribute": "specific-category",
|
|
305
|
+
"reflect": true,
|
|
306
|
+
"defaultValue": "''"
|
|
307
|
+
},
|
|
308
|
+
"iconVisible": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"mutable": false,
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "string",
|
|
313
|
+
"resolved": "string",
|
|
314
|
+
"references": {}
|
|
315
|
+
},
|
|
316
|
+
"required": false,
|
|
317
|
+
"optional": false,
|
|
318
|
+
"docs": {
|
|
319
|
+
"tags": [],
|
|
320
|
+
"text": "Icon visible initially"
|
|
321
|
+
},
|
|
322
|
+
"attribute": "icon-visible",
|
|
323
|
+
"reflect": true,
|
|
324
|
+
"defaultValue": "''"
|
|
325
|
+
},
|
|
326
|
+
"iconVisibleOnAnim": {
|
|
327
|
+
"type": "string",
|
|
328
|
+
"mutable": false,
|
|
329
|
+
"complexType": {
|
|
330
|
+
"original": "string",
|
|
331
|
+
"resolved": "string",
|
|
332
|
+
"references": {}
|
|
333
|
+
},
|
|
334
|
+
"required": false,
|
|
335
|
+
"optional": false,
|
|
336
|
+
"docs": {
|
|
337
|
+
"tags": [],
|
|
338
|
+
"text": "Icon visible while rolling"
|
|
339
|
+
},
|
|
340
|
+
"attribute": "icon-visible-on-anim",
|
|
341
|
+
"reflect": true,
|
|
342
|
+
"defaultValue": "''"
|
|
343
|
+
},
|
|
344
|
+
"launchByGameCard": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"mutable": false,
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "string",
|
|
349
|
+
"resolved": "string",
|
|
350
|
+
"references": {}
|
|
351
|
+
},
|
|
352
|
+
"required": false,
|
|
353
|
+
"optional": false,
|
|
354
|
+
"docs": {
|
|
355
|
+
"tags": [],
|
|
356
|
+
"text": "Open event on the game card."
|
|
357
|
+
},
|
|
358
|
+
"attribute": "launch-by-game-card",
|
|
359
|
+
"reflect": true,
|
|
360
|
+
"defaultValue": "''"
|
|
361
|
+
},
|
|
362
|
+
"clientStyling": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"mutable": false,
|
|
365
|
+
"complexType": {
|
|
366
|
+
"original": "string",
|
|
367
|
+
"resolved": "string",
|
|
368
|
+
"references": {}
|
|
369
|
+
},
|
|
370
|
+
"required": false,
|
|
371
|
+
"optional": false,
|
|
372
|
+
"docs": {
|
|
373
|
+
"tags": [],
|
|
374
|
+
"text": "Client custom styling via string"
|
|
375
|
+
},
|
|
376
|
+
"attribute": "client-styling",
|
|
377
|
+
"reflect": true,
|
|
378
|
+
"defaultValue": "''"
|
|
379
|
+
},
|
|
380
|
+
"clientStylingUrl": {
|
|
381
|
+
"type": "string",
|
|
382
|
+
"mutable": false,
|
|
383
|
+
"complexType": {
|
|
384
|
+
"original": "string",
|
|
385
|
+
"resolved": "string",
|
|
386
|
+
"references": {}
|
|
387
|
+
},
|
|
388
|
+
"required": false,
|
|
389
|
+
"optional": false,
|
|
390
|
+
"docs": {
|
|
391
|
+
"tags": [],
|
|
392
|
+
"text": "Client custom styling via url"
|
|
393
|
+
},
|
|
394
|
+
"attribute": "client-styling-url",
|
|
395
|
+
"reflect": true,
|
|
396
|
+
"defaultValue": "''"
|
|
397
|
+
},
|
|
398
|
+
"translationUrl": {
|
|
399
|
+
"type": "string",
|
|
400
|
+
"mutable": false,
|
|
401
|
+
"complexType": {
|
|
402
|
+
"original": "string",
|
|
403
|
+
"resolved": "string",
|
|
404
|
+
"references": {}
|
|
405
|
+
},
|
|
406
|
+
"required": false,
|
|
407
|
+
"optional": false,
|
|
408
|
+
"docs": {
|
|
409
|
+
"tags": [],
|
|
410
|
+
"text": "Translations via URL"
|
|
411
|
+
},
|
|
412
|
+
"attribute": "translation-url",
|
|
413
|
+
"reflect": true,
|
|
414
|
+
"defaultValue": "''"
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
static get states() {
|
|
419
|
+
return {
|
|
420
|
+
"hasErrors": {},
|
|
421
|
+
"limitStylingAppends": {},
|
|
422
|
+
"isLoading": {},
|
|
423
|
+
"gamesToShow": {},
|
|
424
|
+
"selectedGame": {},
|
|
425
|
+
"animationDone": {},
|
|
426
|
+
"animationStarted": {}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
static get elementRef() { return "host"; }
|
|
430
|
+
static get watchers() {
|
|
431
|
+
return [{
|
|
432
|
+
"propName": "endpoint",
|
|
433
|
+
"methodName": "watchEndpoint"
|
|
434
|
+
}, {
|
|
435
|
+
"propName": "datasource",
|
|
436
|
+
"methodName": "watchEndpoint"
|
|
437
|
+
}, {
|
|
438
|
+
"propName": "language",
|
|
439
|
+
"methodName": "watchEndpoint"
|
|
440
|
+
}, {
|
|
441
|
+
"propName": "translationUrl",
|
|
442
|
+
"methodName": "handleNewTranslations"
|
|
443
|
+
}, {
|
|
444
|
+
"propName": "iconVisible",
|
|
445
|
+
"methodName": "handleIsIconVisible"
|
|
446
|
+
}];
|
|
451
447
|
}
|
|
452
|
-
}; }
|
|
453
|
-
static get states() { return {
|
|
454
|
-
"hasErrors": {},
|
|
455
|
-
"limitStylingAppends": {},
|
|
456
|
-
"isLoading": {},
|
|
457
|
-
"gamesToShow": {},
|
|
458
|
-
"selectedGame": {},
|
|
459
|
-
"animationDone": {},
|
|
460
|
-
"animationStarted": {}
|
|
461
|
-
}; }
|
|
462
|
-
static get elementRef() { return "host"; }
|
|
463
|
-
static get watchers() { return [{
|
|
464
|
-
"propName": "endpoint",
|
|
465
|
-
"methodName": "watchEndpoint"
|
|
466
|
-
}, {
|
|
467
|
-
"propName": "datasource",
|
|
468
|
-
"methodName": "watchEndpoint"
|
|
469
|
-
}, {
|
|
470
|
-
"propName": "language",
|
|
471
|
-
"methodName": "watchEndpoint"
|
|
472
|
-
}, {
|
|
473
|
-
"propName": "translationUrl",
|
|
474
|
-
"methodName": "handleNewTranslations"
|
|
475
|
-
}, {
|
|
476
|
-
"propName": "iconVisible",
|
|
477
|
-
"methodName": "handleIsIconVisible"
|
|
478
|
-
}]; }
|
|
479
448
|
}
|