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