@everymatrix/casino-play-random-game 1.32.4 → 1.33.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 (48) hide show
  1. package/dist/casino-play-random-game/casino-play-random-game.esm.js +1 -0
  2. package/dist/casino-play-random-game/index.esm.js +0 -0
  3. package/dist/casino-play-random-game/p-0f38b3f8.js +1 -0
  4. package/dist/casino-play-random-game/p-51fa7686.entry.js +1 -0
  5. package/dist/cjs/casino-play-random-game.cjs.entry.js +360 -0
  6. package/dist/cjs/casino-play-random-game.cjs.js +19 -0
  7. package/dist/cjs/index-8944e204.js +1247 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/casino-play-random-game/casino-play-random-game.css +347 -0
  12. package/dist/collection/components/casino-play-random-game/casino-play-random-game.js +473 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +73 -0
  15. package/dist/collection/utils/utils.js +27 -0
  16. package/dist/components/casino-play-random-game.d.ts +11 -0
  17. package/dist/components/casino-play-random-game.js +392 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/casino-play-random-game.entry.js +356 -0
  21. package/dist/esm/casino-play-random-game.js +17 -0
  22. package/dist/esm/index-58563736.js +1221 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +17 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. 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 +2 -0
  35. package/dist/types/components/casino-play-random-game/casino-play-random-game.d.ts +73 -0
  36. package/dist/types/components.d.ts +117 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +6 -0
  40. package/dist/types/utils/utils.d.ts +2 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +2 -3
  48. package/LICENSE +0 -21
@@ -0,0 +1,392 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+
3
+ const getDevice = () => {
4
+ let userAgent = window.navigator.userAgent;
5
+ if (userAgent.toLowerCase().match(/android/i)) {
6
+ return 'Android';
7
+ }
8
+ if (userAgent.toLowerCase().match(/iphone/i)) {
9
+ return 'iPhone';
10
+ }
11
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
12
+ return 'iPad';
13
+ }
14
+ return 'PC';
15
+ };
16
+ const getDevicePlatform = () => {
17
+ const device = getDevice();
18
+ if (device) {
19
+ if (device === 'PC') {
20
+ return 'dk';
21
+ }
22
+ else if (device === 'iPad' || device === 'iPhone') {
23
+ return 'mtWeb';
24
+ }
25
+ else {
26
+ return 'mtWeb';
27
+ }
28
+ }
29
+ };
30
+
31
+ const DEFAULT_LANGUAGE = 'en';
32
+ const TRANSLATIONS = {
33
+ en: {
34
+ error: 'Error',
35
+ randomGameLoading: 'Loading ...',
36
+ playRandomGame: 'Play a random game',
37
+ playNowRandomGame: 'Play now',
38
+ spinRandomGame: 'Spin'
39
+ },
40
+ ro: {
41
+ error: 'Error',
42
+ randomGameLoading: 'Loading ...',
43
+ playRandomGame: 'Play a random game',
44
+ playNowRandomGame: 'Play now',
45
+ spinRandomGame: 'Spin'
46
+ },
47
+ fr: {
48
+ error: 'Error',
49
+ randomGameLoading: 'Loading ...',
50
+ playRandomGame: 'Play a random game',
51
+ playNowRandomGame: 'Play now',
52
+ spinRandomGame: 'Spin'
53
+ },
54
+ hr: {
55
+ error: 'Error',
56
+ randomGameLoading: 'Loading ...',
57
+ playRandomGame: 'Play a random game',
58
+ playNowRandomGame: 'Play now',
59
+ spinRandomGame: 'Spin'
60
+ },
61
+ hu: {
62
+ error: 'Error',
63
+ randomGameLoading: 'Loading ...',
64
+ playRandomGame: 'Play a random game',
65
+ playNowRandomGame: 'Play now',
66
+ spinRandomGame: 'Spin'
67
+ },
68
+ tr: {
69
+ error: "Hata",
70
+ randomGameLoading: "Yükleniyor...",
71
+ playRandomGame: "Rasgele bir oyun oyna",
72
+ playNowRandomGame: "Şimdi Oyna",
73
+ spinRandomGame: "DEĞİŞTİR"
74
+ }
75
+ };
76
+ const getTranslations = (url) => {
77
+ return new Promise((resolve) => {
78
+ fetch(url)
79
+ .then((res) => res.json())
80
+ .then((data) => {
81
+ Object.keys(data).forEach((item) => {
82
+ if (!(item in TRANSLATIONS)) {
83
+ TRANSLATIONS[item] = {};
84
+ }
85
+ for (let key in data[item]) {
86
+ TRANSLATIONS[item][key] = data[item][key];
87
+ }
88
+ });
89
+ resolve(true);
90
+ });
91
+ });
92
+ };
93
+ const translate = (key, customLang, values) => {
94
+ const lang = customLang;
95
+ let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
96
+ if (values !== undefined) {
97
+ for (const [key, value] of Object.entries(values.values)) {
98
+ const regex = new RegExp(`{${key}}`, 'g');
99
+ translation = translation.replace(regex, value);
100
+ }
101
+ }
102
+ return translation;
103
+ };
104
+
105
+ const casinoPlayRandomGameCss = ":host {\n display: block;\n font-family: inherit;\n}\n\n.RandomGameWrapper {\n width: 100%;\n overflow: hidden;\n background: transparent;\n position: relative;\n}\n\n.GameContainerGradient {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100%;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 0%, rgba(7, 7, 42, 0.5) 25%, rgba(7, 7, 42, 0) 50%, rgba(7, 7, 42, 0.5) 75%, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 100%);\n pointer-events: none;\n z-index: 1;\n}\n\n.GamesContainer {\n display: flex;\n height: 330px;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: center;\n align-content: flex-start;\n gap: 20px;\n}\n\n.RandomGameCard {\n position: relative;\n width: 256px;\n height: 170px;\n border-radius: 5px;\n filter: blur(5px);\n}\n.RandomGameCard .RandomGameVendor {\n position: absolute;\n font-size: 12px;\n bottom: 10px;\n left: 10px;\n color: var(--emfe-w-color-white, #FFFFFF);\n}\n\n.TheRandomGame {\n animation-name: ZoomFadeIn;\n animation-duration: 0.5s;\n animation-fill-mode: forwards;\n -webkit-animation-name: ZoomFadeIn;\n -webkit-animation-duration: 0.5s;\n -webkit-animation-fill-mode: forwards;\n opacity: 1;\n cursor: pointer;\n filter: blur(0);\n}\n\n.RandomGameImage {\n width: 256px;\n height: 170px;\n}\n\n.RandomGameDetails {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n color: var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF));\n font-size: 14px;\n width: 100%;\n}\n.RandomGameDetails .RandomGameTitle {\n line-height: 18px;\n}\n.RandomGameDetails .RandomGameInfo {\n border-radius: 50%;\n width: 16px;\n height: 16px;\n font-size: 12px;\n font-weight: 400;\n border: solid 1px var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF));\n text-align: center;\n margin: 4px 0;\n line-height: 14px;\n cursor: pointer;\n}\n.RandomGameDetails .RandomGamePlay {\n background: var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n border: none;\n border-radius: 5px;\n width: 200px;\n height: 40px;\n font-size: 14px;\n cursor: pointer;\n}\n\n.ButtonWrapper {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.ButtonContainer {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 10px;\n width: 100%;\n}\n\n.ButtonIcon {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 5px;\n}\n\n.QustionMark {\n position: relative;\n font-size: 80px;\n font-weight: 700;\n color: var(--emfe-w-color-white, #FFFFFF);\n z-index: 5;\n bottom: 20px;\n text-shadow: 0px 4px 0px var(--emfe-w-color-black, #000000);\n}\n\n.HexagonMark {\n position: absolute;\n width: 70px;\n height: 85px;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)) 0%, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)) 100%);\n clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0% 70%, 0% 30%);\n}\n\n.HexagonMarkBorder {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n top: 5px;\n left: 5px;\n width: 60px;\n height: 75px;\n background: linear-gradient(180deg, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)) 0%, var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)) 100%);\n clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0% 70%, 0% 30%);\n}\n\n.RandomButtons {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: 5px;\n width: 100%;\n}\n\n.RandomButton {\n font-size: 18px;\n text-transform: uppercase;\n width: max-content;\n border-radius: 5px;\n padding: 5px 25px;\n border: solid 3px var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n opacity: 1;\n text-shadow: 1px 1px 2px var(--emfe-w-color-black, #000000);\n animation: ButtonEffect 3s linear infinite;\n background-image: linear-gradient(to right, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)), var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)));\n background-size: 300% 100%;\n cursor: pointer;\n}\n.RandomButton:hover {\n opacity: 0.8;\n}\n\n.HideAnimation {\n filter: blur(5px);\n animation: AnimateButton 0.2s forwards;\n}\n\n.Flip {\n animation-name: Flip, Blur;\n animation-duration: 0.75s, 3s;\n animation-iteration-count: infinite, 1;\n -webkit-animation-name: Flip, Blur;\n -webkit-animation-duration: 0.75s, 3s;\n -webkit-animation-iteration-count: infinite, 1;\n}\n\n@keyframes ButtonEffect {\n 0% {\n background-position: 0% 50%;\n }\n 33% {\n background-position: 100% 50%;\n }\n 66% {\n background-position: 200% 50%;\n }\n 100% {\n background-position: 300% 50%;\n }\n}\n@keyframes ZoomFadeIn {\n 0% {\n transform: scale(0.2) translateY(0);\n filter: blur(5px);\n opacity: 0.3;\n }\n 50% {\n transform: scale(1.1) translateY(-30px);\n filter: blur(2px);\n opacity: 0.7;\n }\n 100% {\n transform: scale(1) translateY(-30px);\n filter: blur(0px);\n opacity: 1;\n }\n}\n@keyframes AnimateButton {\n 0% {\n opacity: 0.7;\n }\n 50% {\n opacity: 0.4;\n }\n 100% {\n opacity: 0;\n display: none;\n }\n}\n@keyframes Flip {\n 0% {\n transform: rotateY(0deg);\n }\n 50% {\n transform: rotateY(180deg);\n }\n 100% {\n transform: rotateY(360deg);\n }\n}\n@keyframes Blur {\n 0% {\n filter: blur(0);\n }\n 50% {\n filter: blur(1px);\n }\n 100% {\n filter: blur(3px);\n }\n}\n@container (max-width: 475px) {\n .GameContainerGradient {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100%;\n background: linear-gradient(90deg, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 0%, rgba(7, 7, 42, 0.2) 25%, rgba(7, 7, 42, 0) 50%, rgba(7, 7, 42, 0.2) 75%, var(--emfe-w-casino-color-bg, var(--emfe-w-color-background, #07072A)) 100%);\n pointer-events: none;\n z-index: 1;\n }\n\n .RandomGameCard {\n width: 102px;\n height: 146px;\n border-radius: 5px;\n filter: blur(5px);\n }\n\n .RandomGameImage {\n width: 102px;\n height: 146px;\n }\n\n .RandomGameDetails {\n font-size: 14px;\n width: 100%;\n }\n .RandomGameDetails .RandomGameTitle {\n line-height: 18px;\n width: 75%;\n }\n .RandomGameDetails .RandomGameInfo {\n border-radius: 50%;\n width: 16px;\n height: 16px;\n font-size: 12px;\n line-height: 14px;\n }\n .RandomGameDetails .RandomGamePlay {\n background: var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n border: none;\n border-radius: 5px;\n width: 200px;\n height: 40px;\n font-size: 14px;\n cursor: pointer;\n }\n\n .RandomGameCard .RandomGameVendor {\n font-size: 12px;\n bottom: 5px;\n right: 5px;\n }\n\n .RandomButtons {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 5px;\n width: 100%;\n }\n\n .RandomButton {\n font-size: 18px;\n text-transform: uppercase;\n width: max-content;\n border-radius: 5px;\n padding: 5px 25px;\n border: solid 3px var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C));\n color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));\n opacity: 1;\n text-shadow: 1px 1px 2px var(--emfe-w-color-black, #000000);\n animation: ButtonEffect 3s linear infinite;\n background-image: linear-gradient(to right, var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)), var(--emfe-w-categories-color-secondary, var(--emfe-w-color-secondary, #FD2839)), var(--emfe-w-casino-color-primary, var(--emfe-w-color-primary, #D0046C)));\n background-size: 300% 100%;\n cursor: pointer;\n }\n .RandomButton:hover {\n opacity: 0.8;\n }\n}";
106
+
107
+ const CasinoPlayRandomGame$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
108
+ constructor() {
109
+ super();
110
+ this.__registerHost();
111
+ this.__attachShadow();
112
+ /**
113
+ * Language of the widget
114
+ */
115
+ this.language = 'en';
116
+ /**
117
+ * Configure a specific category for randomising the games.
118
+ */
119
+ this.specificCategory = '';
120
+ /**
121
+ * Icon visible initially
122
+ */
123
+ this.iconVisible = '';
124
+ /**
125
+ * Icon visible while rolling
126
+ */
127
+ this.iconVisibleOnAnim = '';
128
+ /**
129
+ * Open event on the game card.
130
+ */
131
+ this.launchByGameCard = '';
132
+ /**
133
+ * Client custom styling via string
134
+ */
135
+ this.clientStyling = '';
136
+ /**
137
+ * Client custom styling via url
138
+ */
139
+ this.clientStylingUrl = '';
140
+ /**
141
+ * Translations via URL
142
+ */
143
+ this.translationUrl = '';
144
+ this.hasErrors = false;
145
+ this.limitStylingAppends = false;
146
+ this.isLoading = true;
147
+ this.selectedGame = null;
148
+ this.animationDone = false;
149
+ this.animationStarted = false;
150
+ this.animation = null;
151
+ this.selectedGameIndex = null;
152
+ this.selectedGameEl = null;
153
+ this.iconVisibility = null;
154
+ this.shuffle = (array) => {
155
+ let currentIndex = array.length;
156
+ let randomIndex;
157
+ while (currentIndex !== 0) {
158
+ randomIndex = Math.floor(Math.random() * currentIndex);
159
+ currentIndex--;
160
+ [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
161
+ }
162
+ return array;
163
+ };
164
+ this.setClientStyling = () => {
165
+ let sheet = document.createElement('style');
166
+ sheet.innerHTML = this.clientStyling;
167
+ this.host.shadowRoot.prepend(sheet);
168
+ };
169
+ this.setClientStylingURL = () => {
170
+ let url = new URL(this.clientStylingUrl);
171
+ let cssFile = document.createElement('style');
172
+ fetch(url.href)
173
+ .then((res) => res.text())
174
+ .then((data) => {
175
+ cssFile.innerHTML = data;
176
+ this.clientStyling = data;
177
+ setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
178
+ });
179
+ };
180
+ }
181
+ watchEndpoint(newValue, oldValue) {
182
+ if (newValue && newValue != oldValue && this.endpoint) {
183
+ this.fetchGameList();
184
+ }
185
+ }
186
+ handleNewTranslations() {
187
+ this.isLoading = true;
188
+ getTranslations(this.translationUrl).then(() => {
189
+ this.isLoading = false;
190
+ });
191
+ }
192
+ connectedCallback() {
193
+ this.iconVisibility = this.iconVisible === 'true' ? true : false;
194
+ }
195
+ componentWillLoad() {
196
+ if (this.translationUrl.length > 2) {
197
+ getTranslations(this.translationUrl);
198
+ }
199
+ if (this.endpoint && this.language && this.datasource) {
200
+ return this.fetchGameList();
201
+ }
202
+ }
203
+ componentDidLoad() {
204
+ if (!this.limitStylingAppends && this.host) {
205
+ if (this.clientStyling)
206
+ this.setClientStyling();
207
+ if (this.clientStylingUrl)
208
+ this.setClientStylingURL();
209
+ this.limitStylingAppends = true;
210
+ }
211
+ }
212
+ fetchGameList() {
213
+ let url = new URL(`${this.endpoint}/v1/casino/games`);
214
+ url.searchParams.append('device', getDevicePlatform());
215
+ url.searchParams.append('datasource', this.datasource);
216
+ url.searchParams.append('fields', 'gId,id,href,thumbnail,name,vendor,launchUrl,subVendor');
217
+ url.searchParams.append('expand', 'vendor');
218
+ // Number of games chosen
219
+ url.searchParams.append('pagination', 'offset=0,limit=423');
220
+ url.searchParams.append('language', this.language);
221
+ if (this.specificCategory) {
222
+ url.searchParams.append('filter', `categories(id=${this.specificCategory})`);
223
+ }
224
+ return new Promise((resolve, reject) => {
225
+ this.isLoading = true;
226
+ fetch(url.href)
227
+ .then((res) => res.json())
228
+ .then((data) => {
229
+ this.gamesToShow = this.setUpGames(data === null || data === void 0 ? void 0 : data.items);
230
+ resolve(true);
231
+ }).catch((err) => {
232
+ console.error(err);
233
+ this.hasErrors = true;
234
+ reject(err);
235
+ }).finally(() => {
236
+ this.isLoading = false;
237
+ });
238
+ });
239
+ }
240
+ setUpGames(games) {
241
+ // Only 40 games will be selected at a time; the random game will be selected from these.
242
+ const shuffledGames = this.shuffle(games).slice(0, 40);
243
+ // Clone the games
244
+ return shuffledGames.concat(shuffledGames);
245
+ }
246
+ selectRandomGame() {
247
+ const originalGamesLength = this.gamesToShow.length / 2;
248
+ // Substract 3 to ensure there are always at least 5 cards after the selected one
249
+ this.selectedGameIndex = Math.floor(Math.random() * (originalGamesLength - 3));
250
+ // Offset by the length of the original to select from the cloned part
251
+ this.selectedGameIndex += originalGamesLength;
252
+ this.selectedGameEl = this.gameContainer.children[this.selectedGameIndex];
253
+ }
254
+ playRandomGame() {
255
+ this.animateGames();
256
+ //@ts-ignore
257
+ if (typeof gtag == 'function') {
258
+ //@ts-ignore
259
+ gtag('event', 'PlayRandomGame', {
260
+ 'context': 'CasinoPlayRandomGame'
261
+ });
262
+ }
263
+ }
264
+ respin() {
265
+ this.animateGames();
266
+ //@ts-ignore
267
+ if (typeof gtag == 'function') {
268
+ //@ts-ignore
269
+ gtag('event', 'RespinRandomGame', {
270
+ 'context': 'CasinoPlayRandomGame'
271
+ });
272
+ }
273
+ }
274
+ animateGames() {
275
+ this.iconVisibility = this.iconVisibleOnAnim === 'true' ? true : false;
276
+ this.animationStarted = true;
277
+ this.animationDone = false;
278
+ if (this.animation)
279
+ this.animation.cancel();
280
+ if (this.selectedGameEl) {
281
+ this.selectedGameEl.classList.remove('TheRandomGame');
282
+ this.selectedGame = null;
283
+ this.selectedGameIndex = null;
284
+ }
285
+ this.selectRandomGame();
286
+ const gapStyle = window.getComputedStyle(this.gameContainer).getPropertyValue('gap');
287
+ const gap = parseInt(gapStyle, 10);
288
+ const cardWidth = this.selectedGameEl.offsetWidth;
289
+ const gameContainerWidth = this.gameContainer.offsetWidth;
290
+ const translation = ((cardWidth + gap) * this.selectedGameIndex) + // Width of game cards up to the selected
291
+ (cardWidth / 2) - // Additional half card width to center to the selected game
292
+ (gameContainerWidth / 2); // Minus half the container width to center the card
293
+ const containerRolling = [
294
+ { transform: `translateX(0px)`, scale: 1 },
295
+ { scale: 0.75 },
296
+ { transform: `translateX(-${translation}px)`, scale: 1 }
297
+ ];
298
+ const containerTiming = {
299
+ duration: 3000,
300
+ easing: 'cubic-bezier(0.5, 0, 0.5, 1.2)',
301
+ fill: 'forwards'
302
+ };
303
+ this.animation = this.gameContainer.animate(containerRolling, containerTiming);
304
+ this.animation.onfinish = () => {
305
+ this.animationDone = true;
306
+ this.selectedGameEl.classList.add('TheRandomGame');
307
+ this.selectedGame = this.gamesToShow[this.selectedGameIndex];
308
+ };
309
+ }
310
+ playGame() {
311
+ if (!this.selectedGame)
312
+ return;
313
+ window.postMessage({ type: 'PlayRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
314
+ //@ts-ignore
315
+ if (typeof gtag == 'function') {
316
+ //@ts-ignore
317
+ gtag('event', 'OpenRandomGame', {
318
+ 'context': 'CasinoPlayRandomGame'
319
+ });
320
+ }
321
+ }
322
+ ;
323
+ showGameInfo() {
324
+ window.postMessage({ type: 'InfoRandomGame', gameId: this.selectedGame.id, launchUrl: this.selectedGame.launchUrl, gameName: this.selectedGame.name, subVendor: this.selectedGame.subVendor }, window.location.href);
325
+ //@ts-ignore
326
+ if (typeof gtag == 'function') {
327
+ //@ts-ignore
328
+ gtag('event', 'OpenRandomGameInfo', {
329
+ 'context': 'CasinoPlayRandomGame'
330
+ });
331
+ }
332
+ }
333
+ renderGameDetails() {
334
+ 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 &&
335
+ h("button", { class: "RandomButton On", onClick: () => this.playGame() }, translate('playNowRandomGame', this.language))));
336
+ }
337
+ render() {
338
+ if (this.hasErrors) {
339
+ return (h("div", { class: "RandomGameError" }, h("div", { class: "Title" }, translate('error', this.language))));
340
+ }
341
+ if (this.isLoading) {
342
+ return (h("div", { class: "RandomGameLoading" }, h("div", { class: "Title" }, translate('randomGameLoading', this.language))));
343
+ }
344
+ if (!this.isLoading) {
345
+ 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 ${this.animationStarted ? 'Flip' : ''}` }, "?"), h("div", { class: "HexagonMark" }, h("div", { class: "HexagonMarkBorder" }))), !this.animationStarted && h("div", { class: `RandomButton ${this.animationStarted ? 'HideAnimation' : ''}`, onClick: () => this.playRandomGame() }, translate('playRandomGame', this.language)))));
346
+ }
347
+ }
348
+ get host() { return this; }
349
+ static get watchers() { return {
350
+ "endpoint": ["watchEndpoint"],
351
+ "datasource": ["watchEndpoint"],
352
+ "language": ["watchEndpoint"],
353
+ "translationUrl": ["handleNewTranslations"]
354
+ }; }
355
+ static get style() { return casinoPlayRandomGameCss; }
356
+ }, [1, "casino-play-random-game", {
357
+ "endpoint": [513],
358
+ "datasource": [513],
359
+ "language": [513],
360
+ "specificCategory": [513, "specific-category"],
361
+ "iconVisible": [513, "icon-visible"],
362
+ "iconVisibleOnAnim": [513, "icon-visible-on-anim"],
363
+ "launchByGameCard": [513, "launch-by-game-card"],
364
+ "clientStyling": [513, "client-styling"],
365
+ "clientStylingUrl": [513, "client-styling-url"],
366
+ "translationUrl": [513, "translation-url"],
367
+ "hasErrors": [32],
368
+ "limitStylingAppends": [32],
369
+ "isLoading": [32],
370
+ "gamesToShow": [32],
371
+ "selectedGame": [32],
372
+ "animationDone": [32],
373
+ "animationStarted": [32]
374
+ }]);
375
+ function defineCustomElement$1() {
376
+ if (typeof customElements === "undefined") {
377
+ return;
378
+ }
379
+ const components = ["casino-play-random-game"];
380
+ components.forEach(tagName => { switch (tagName) {
381
+ case "casino-play-random-game":
382
+ if (!customElements.get(tagName)) {
383
+ customElements.define(tagName, CasinoPlayRandomGame$1);
384
+ }
385
+ break;
386
+ } });
387
+ }
388
+
389
+ const CasinoPlayRandomGame = CasinoPlayRandomGame$1;
390
+ const defineCustomElement = defineCustomElement$1;
391
+
392
+ export { CasinoPlayRandomGame, defineCustomElement };
@@ -0,0 +1,26 @@
1
+ /* CasinoPlayRandomGame custom elements */
2
+
3
+ import type { Components, JSX } from "../types/components";
4
+
5
+ /**
6
+ * Used to manually set the base path where assets can be found.
7
+ * If the script is used as "module", it's recommended to use "import.meta.url",
8
+ * such as "setAssetPath(import.meta.url)". Other options include
9
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
10
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
11
+ * But do note that this configuration depends on how your script is bundled, or lack of
12
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
13
+ * will have to ensure the static assets are copied to its build directory.
14
+ */
15
+ export declare const setAssetPath: (path: string) => void;
16
+
17
+ export interface SetPlatformOptions {
18
+ raf?: (c: FrameRequestCallback) => number;
19
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
21
+ }
22
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
+
24
+ export type { Components, JSX };
25
+
26
+ export * from '../types';
@@ -0,0 +1 @@
1
+ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';