@everymatrix/casino-play-random-game 1.43.4 → 1.45.0

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.
Files changed (49) hide show
  1. package/dist/casino-play-random-game/casino-play-random-game.esm.js +1 -1
  2. package/dist/casino-play-random-game/p-b4a84056.entry.js +1 -0
  3. package/dist/casino-play-random-game/p-d2e799c3.js +2 -0
  4. package/dist/casino-play-random-game/p-e1255160.js +1 -0
  5. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  6. package/dist/cjs/casino-play-random-game.cjs.entry.js +288 -308
  7. package/dist/cjs/casino-play-random-game.cjs.js +17 -11
  8. package/dist/cjs/index-4cc20a8d.js +1217 -0
  9. package/dist/cjs/loader.cjs.js +7 -13
  10. package/dist/collection/collection-manifest.json +3 -3
  11. package/dist/collection/components/casino-play-random-game/casino-play-random-game.css +0 -11
  12. package/dist/collection/components/casino-play-random-game/casino-play-random-game.js +432 -463
  13. package/dist/collection/components/casino-play-random-game/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +58 -58
  15. package/dist/collection/utils/utils.js +22 -22
  16. package/dist/esm/app-globals-0f993ce5.js +3 -0
  17. package/dist/esm/casino-play-random-game.entry.js +288 -308
  18. package/dist/esm/casino-play-random-game.js +14 -11
  19. package/dist/esm/index-7666b794.js +1190 -0
  20. package/dist/esm/loader.js +7 -13
  21. package/dist/stencil.config.dev.js +17 -0
  22. package/dist/stencil.config.js +14 -19
  23. 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
  24. 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
  25. package/dist/types/components/casino-play-random-game/casino-play-random-game.d.ts +72 -72
  26. package/dist/types/components/casino-play-random-game/index.d.ts +1 -0
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/loader/cdn.js +1 -3
  29. package/loader/index.cjs.js +1 -3
  30. package/loader/index.d.ts +13 -1
  31. package/loader/index.es2017.js +1 -3
  32. package/loader/index.js +1 -3
  33. package/loader/package.json +1 -0
  34. package/package.json +8 -1
  35. package/dist/casino-play-random-game/p-0f38b3f8.js +0 -1
  36. package/dist/casino-play-random-game/p-1a049c0f.entry.js +0 -1
  37. package/dist/cjs/index-8944e204.js +0 -1247
  38. package/dist/components/casino-play-random-game.d.ts +0 -11
  39. package/dist/components/casino-play-random-game.js +0 -375
  40. package/dist/components/index.d.ts +0 -26
  41. package/dist/components/index.js +0 -1
  42. package/dist/esm/index-58563736.js +0 -1221
  43. package/dist/esm/polyfills/core-js.js +0 -11
  44. package/dist/esm/polyfills/css-shim.js +0 -1
  45. package/dist/esm/polyfills/dom.js +0 -79
  46. package/dist/esm/polyfills/es5-html-element.js +0 -1
  47. package/dist/esm/polyfills/index.js +0 -34
  48. package/dist/esm/polyfills/system.js +0 -6
  49. 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 { Component, Prop, State, Watch, h, Element } from '@stencil/core';
2
- import { getDevice } from '../../utils/utils';
3
- import { getTranslations, translate } from '../../utils/locale.utils';
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
- constructor() {
6
- /**
7
- * Language of the widget
8
- */
9
- this.language = 'en';
10
- /**
11
- * Configure a specific category for randomising the games.
12
- */
13
- this.specificCategory = '';
14
- /**
15
- * Icon visible initially
16
- */
17
- this.iconVisible = '';
18
- /**
19
- * Icon visible while rolling
20
- */
21
- this.iconVisibleOnAnim = '';
22
- /**
23
- * Open event on the game card.
24
- */
25
- this.launchByGameCard = '';
26
- /**
27
- * Client custom styling via string
28
- */
29
- this.clientStyling = '';
30
- /**
31
- * Client custom styling via url
32
- */
33
- this.clientStylingUrl = '';
34
- /**
35
- * Translations via URL
36
- */
37
- this.translationUrl = '';
38
- this.hasErrors = false;
39
- this.limitStylingAppends = false;
40
- this.isLoading = true;
41
- this.selectedGame = null;
42
- this.animationDone = false;
43
- this.animationStarted = false;
44
- this.animation = null;
45
- this.selectedGameIndex = null;
46
- this.selectedGameEl = null;
47
- this.iconVisibility = null;
48
- this.shuffle = (array) => {
49
- let currentIndex = array.length;
50
- let randomIndex;
51
- while (currentIndex !== 0) {
52
- randomIndex = Math.floor(Math.random() * currentIndex);
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
- handleNewTranslations() {
81
- this.isLoading = true;
82
- getTranslations(this.translationUrl).then(() => {
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
- if (this.endpoint && this.language && this.datasource) {
97
- return this.fetchGameList();
59
+ handleNewTranslations() {
60
+ this.isLoading = true;
61
+ getTranslations(this.translationUrl).then(() => {
62
+ this.isLoading = false;
63
+ });
98
64
  }
99
- }
100
- componentDidLoad() {
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
- fetchGameList() {
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
- return new Promise((resolve, reject) => {
122
- this.isLoading = true;
123
- fetch(url.href)
124
- .then((res) => res.json())
125
- .then((data) => {
126
- this.gamesToShow = this.setUpGames(data === null || data === void 0 ? void 0 : data.items);
127
- resolve(true);
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
- respin() {
162
- this.animateGames();
163
- //@ts-ignore
164
- if (typeof gtag == 'function') {
165
- //@ts-ignore
166
- gtag('event', 'RespinRandomGame', {
167
- 'context': 'CasinoPlayRandomGame'
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
- animateGames() {
172
- this.iconVisibility = this.iconVisibleOnAnim === 'true' ? true : false;
173
- this.animationStarted = true;
174
- this.animationDone = false;
175
- if (this.animation)
176
- this.animation.cancel();
177
- if (this.selectedGameEl) {
178
- this.selectedGameEl.classList.remove('TheRandomGame');
179
- this.selectedGame = null;
180
- this.selectedGameIndex = null;
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
- this.selectRandomGame();
183
- const gapStyle = window.getComputedStyle(this.gameContainer).getPropertyValue('gap');
184
- const gap = parseInt(gapStyle, 10);
185
- const cardWidth = this.selectedGameEl.offsetWidth;
186
- const gameContainerWidth = this.gameContainer.offsetWidth;
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
- showGameInfo() {
221
- window.postMessage({ type: 'InfoRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
222
- //@ts-ignore
223
- if (typeof gtag == 'function') {
224
- //@ts-ignore
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
- renderGameDetails() {
231
- return h("div", { class: "RandomButtonsWrapper" },
232
- h("div", { class: "RandomGameDetails" },
233
- h("span", { class: "RandomGameTitle" }, this.selectedGame.name),
234
- h("span", { class: "RandomGameInfo", onClick: () => this.showGameInfo() }, "i")),
235
- h("div", { class: "RandomButtons" },
236
- h("button", { class: "RandomButton On", onClick: () => this.respin() }, translate('spinRandomGame', this.language)),
237
- !this.launchByGameCard &&
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
- if (this.isLoading) {
246
- return (h("div", { class: "RandomGameLoading" },
247
- h("div", { class: "Title" }, translate('randomGameLoading', this.language))));
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
- if (!this.isLoading) {
250
- return h("div", { class: "RandomGameWrapper" },
251
- h("div", { class: 'GameContainerGradient' }),
252
- 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 },
253
- h("div", { class: "RandomGameVendor" }, game.vendor.name),
254
- h("img", { class: 'RandomGameImage', src: game.thumbnail, alt: game.name, title: game.name }),
255
- this.selectedGame && this.selectedGameIndex === index && this.renderGameDetails())))),
256
- h("div", { class: `ButtonWrapper ${this.animationDone ? 'HideAnimation' : ''}` },
257
- h("div", { class: "ButtonContainer" },
258
- this.iconVisibility && h("div", { class: `ButtonIcon ${this.animationStarted ? 'Flip' : ''}` },
259
- h("div", { class: "QustionMark" }, "?"),
260
- h("div", { class: "HexagonMarkShadow" }),
261
- h("div", { class: "HexagonMark" })),
262
- !this.animationStarted && h("div", { class: `RandomButton ${this.animationStarted ? 'HideAnimation' : ''}`, onClick: () => this.playRandomGame() }, translate('playRandomGame', this.language)))));
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
- static get is() { return "casino-play-random-game"; }
266
- static get encapsulation() { return "shadow"; }
267
- static get originalStyleUrls() { return {
268
- "$": ["casino-play-random-game.scss"]
269
- }; }
270
- static get styleUrls() { return {
271
- "$": ["casino-play-random-game.css"]
272
- }; }
273
- static get properties() { return {
274
- "endpoint": {
275
- "type": "string",
276
- "mutable": false,
277
- "complexType": {
278
- "original": "string",
279
- "resolved": "string",
280
- "references": {}
281
- },
282
- "required": false,
283
- "optional": false,
284
- "docs": {
285
- "tags": [],
286
- "text": "Endpoint URL for the source of data"
287
- },
288
- "attribute": "endpoint",
289
- "reflect": true
290
- },
291
- "datasource": {
292
- "type": "string",
293
- "mutable": false,
294
- "complexType": {
295
- "original": "string",
296
- "resolved": "string",
297
- "references": {}
298
- },
299
- "required": false,
300
- "optional": false,
301
- "docs": {
302
- "tags": [],
303
- "text": "Name of the datasource, as configured in CE."
304
- },
305
- "attribute": "datasource",
306
- "reflect": true
307
- },
308
- "language": {
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": "Language of the widget"
321
- },
322
- "attribute": "language",
323
- "reflect": true,
324
- "defaultValue": "'en'"
325
- },
326
- "specificCategory": {
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": "Configure a specific category for randomising the games."
339
- },
340
- "attribute": "specific-category",
341
- "reflect": true,
342
- "defaultValue": "''"
343
- },
344
- "iconVisible": {
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": "Icon visible initially"
357
- },
358
- "attribute": "icon-visible",
359
- "reflect": true,
360
- "defaultValue": "''"
361
- },
362
- "iconVisibleOnAnim": {
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": "Icon visible while rolling"
375
- },
376
- "attribute": "icon-visible-on-anim",
377
- "reflect": true,
378
- "defaultValue": "''"
379
- },
380
- "launchByGameCard": {
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": "Open event on the game card."
393
- },
394
- "attribute": "launch-by-game-card",
395
- "reflect": true,
396
- "defaultValue": "''"
397
- },
398
- "clientStyling": {
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": "Client custom styling via string"
411
- },
412
- "attribute": "client-styling",
413
- "reflect": true,
414
- "defaultValue": "''"
415
- },
416
- "clientStylingUrl": {
417
- "type": "string",
418
- "mutable": false,
419
- "complexType": {
420
- "original": "string",
421
- "resolved": "string",
422
- "references": {}
423
- },
424
- "required": false,
425
- "optional": false,
426
- "docs": {
427
- "tags": [],
428
- "text": "Client custom styling via url"
429
- },
430
- "attribute": "client-styling-url",
431
- "reflect": true,
432
- "defaultValue": "''"
433
- },
434
- "translationUrl": {
435
- "type": "string",
436
- "mutable": false,
437
- "complexType": {
438
- "original": "string",
439
- "resolved": "string",
440
- "references": {}
441
- },
442
- "required": false,
443
- "optional": false,
444
- "docs": {
445
- "tags": [],
446
- "text": "Translations via URL"
447
- },
448
- "attribute": "translation-url",
449
- "reflect": true,
450
- "defaultValue": "''"
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
  }