@everymatrix/casino-game-thumbnail 0.0.2-9.1

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 (130) hide show
  1. package/dist/assets/baccarat.svg +43 -0
  2. package/dist/assets/fav.svg +9 -0
  3. package/dist/assets/favorite.svg +12 -0
  4. package/dist/assets/seat.svg +6 -0
  5. package/dist/assets/unfav.svg +20 -0
  6. package/dist/casino-game-thumbnail/casino-game-thumbnail.esm.js +1 -0
  7. package/dist/casino-game-thumbnail/index.esm.js +0 -0
  8. package/dist/casino-game-thumbnail/p-2958b5c1.js +1 -0
  9. package/dist/casino-game-thumbnail/p-4559874a.entry.js +7 -0
  10. package/dist/casino-game-thumbnail/p-49c54f6d.entry.js +1 -0
  11. package/dist/casino-game-thumbnail/p-4d5d9651.entry.js +1 -0
  12. package/dist/casino-game-thumbnail/p-568cfe7e.entry.js +1 -0
  13. package/dist/casino-game-thumbnail/p-6257f32f.entry.js +1 -0
  14. package/dist/casino-game-thumbnail/p-6788766c.entry.js +1 -0
  15. package/dist/casino-game-thumbnail/p-c410fa58.js +1 -0
  16. package/dist/casino-game-thumbnail/p-d3e1c6ad.js +8 -0
  17. package/dist/casino-game-thumbnail/p-f08b7b59.js +1 -0
  18. package/dist/cjs/casino-extrainfo-baccarat.cjs.entry.js +366 -0
  19. package/dist/cjs/casino-extrainfo-blackjack.cjs.entry.js +58 -0
  20. package/dist/cjs/casino-extrainfo-roulette.cjs.entry.js +44 -0
  21. package/dist/cjs/casino-game-thumbnail-betlimit_2.cjs.entry.js +274 -0
  22. package/dist/cjs/casino-game-thumbnail.cjs.js +19 -0
  23. package/dist/cjs/casino-game-thumbnail_2.cjs.entry.js +1552 -0
  24. package/dist/cjs/casino-normal-game-thumbnail.cjs.entry.js +19 -0
  25. package/dist/cjs/game-thumbnail-eb7b11bd.js +78 -0
  26. package/dist/cjs/index-becce1cd.js +1797 -0
  27. package/dist/cjs/index.cjs.js +2 -0
  28. package/dist/cjs/loader.cjs.js +21 -0
  29. package/dist/cjs/locale.utils-8c5df5f5.js +132 -0
  30. package/dist/cjs/utils-53fbbd1b.js +5745 -0
  31. package/dist/collection/collection-manifest.json +19 -0
  32. package/dist/collection/components/casino-extrainfo-baccarat/casino-extrainfo-baccarat.css +116 -0
  33. package/dist/collection/components/casino-extrainfo-baccarat/casino-extrainfo-baccarat.js +240 -0
  34. package/dist/collection/components/casino-extrainfo-blackjack/casino-extrainfo-blackjack.css +64 -0
  35. package/dist/collection/components/casino-extrainfo-blackjack/casino-extrainfo-blackjack.js +119 -0
  36. package/dist/collection/components/casino-extrainfo-roulette/casino-extrainfo-roulette.css +40 -0
  37. package/dist/collection/components/casino-extrainfo-roulette/casino-extrainfo-roulette.js +122 -0
  38. package/dist/collection/components/casino-game-thumbnail/casino-game-thumbnail.css +361 -0
  39. package/dist/collection/components/casino-game-thumbnail/casino-game-thumbnail.js +968 -0
  40. package/dist/collection/components/casino-game-thumbnail-betlimit/casino-game-thumbnail-betlimit.css +3 -0
  41. package/dist/collection/components/casino-game-thumbnail-betlimit/casino-game-thumbnail-betlimit.js +86 -0
  42. package/dist/collection/components/casino-game-thumbnail-extrainfo/casino-game-thumbnail-extrainfo.css +154 -0
  43. package/dist/collection/components/casino-game-thumbnail-extrainfo/casino-game-thumbnail-extrainfo.js +154 -0
  44. package/dist/collection/components/casino-game-thumbnail-overlay/casino-game-thumbnail-overlay.css +58 -0
  45. package/dist/collection/components/casino-game-thumbnail-overlay/casino-game-thumbnail-overlay.js +208 -0
  46. package/dist/collection/components/casino-normal-game-thumbnail/casino-normal-game-thumbnail.css +3 -0
  47. package/dist/collection/components/casino-normal-game-thumbnail/casino-normal-game-thumbnail.js +13 -0
  48. package/dist/collection/constants/game-thumbnail.js +85 -0
  49. package/dist/collection/index.js +1 -0
  50. package/dist/collection/models/casino-game-thumbnail.js +12 -0
  51. package/dist/collection/models/currency-symbols.js +173 -0
  52. package/dist/collection/static/baccarat.svg +43 -0
  53. package/dist/collection/static/fav.svg +9 -0
  54. package/dist/collection/static/favorite.svg +12 -0
  55. package/dist/collection/static/seat.svg +6 -0
  56. package/dist/collection/static/unfav.svg +20 -0
  57. package/dist/collection/utils/baccarat-board-svg.js +234 -0
  58. package/dist/collection/utils/locale.utils.js +128 -0
  59. package/dist/collection/utils/utils.js +65 -0
  60. package/dist/components/casino-extrainfo-baccarat.d.ts +11 -0
  61. package/dist/components/casino-extrainfo-baccarat.js +400 -0
  62. package/dist/components/casino-extrainfo-blackjack.d.ts +11 -0
  63. package/dist/components/casino-extrainfo-blackjack.js +92 -0
  64. package/dist/components/casino-extrainfo-roulette.d.ts +11 -0
  65. package/dist/components/casino-extrainfo-roulette.js +77 -0
  66. package/dist/components/casino-game-thumbnail-betlimit.d.ts +11 -0
  67. package/dist/components/casino-game-thumbnail-betlimit.js +6 -0
  68. package/dist/components/casino-game-thumbnail-betlimit2.js +227 -0
  69. package/dist/components/casino-game-thumbnail-extrainfo.d.ts +11 -0
  70. package/dist/components/casino-game-thumbnail-extrainfo.js +6 -0
  71. package/dist/components/casino-game-thumbnail-extrainfo2.js +92 -0
  72. package/dist/components/casino-game-thumbnail-overlay.d.ts +11 -0
  73. package/dist/components/casino-game-thumbnail-overlay.js +6 -0
  74. package/dist/components/casino-game-thumbnail-overlay2.js +68 -0
  75. package/dist/components/casino-game-thumbnail.d.ts +11 -0
  76. package/dist/components/casino-game-thumbnail.js +1564 -0
  77. package/dist/components/casino-normal-game-thumbnail.d.ts +11 -0
  78. package/dist/components/casino-normal-game-thumbnail.js +33 -0
  79. package/dist/components/game-thumbnail.js +72 -0
  80. package/dist/components/index.d.ts +26 -0
  81. package/dist/components/index.js +1 -0
  82. package/dist/components/locale.utils.js +130 -0
  83. package/dist/components/utils.js +5739 -0
  84. package/dist/esm/casino-extrainfo-baccarat.entry.js +362 -0
  85. package/dist/esm/casino-extrainfo-blackjack.entry.js +54 -0
  86. package/dist/esm/casino-extrainfo-roulette.entry.js +40 -0
  87. package/dist/esm/casino-game-thumbnail-betlimit_2.entry.js +269 -0
  88. package/dist/esm/casino-game-thumbnail.js +17 -0
  89. package/dist/esm/casino-game-thumbnail_2.entry.js +1547 -0
  90. package/dist/esm/casino-normal-game-thumbnail.entry.js +15 -0
  91. package/dist/esm/game-thumbnail-2649061d.js +72 -0
  92. package/dist/esm/index-9b81dbca.js +1770 -0
  93. package/dist/esm/index.js +1 -0
  94. package/dist/esm/loader.js +17 -0
  95. package/dist/esm/locale.utils-7b901f2b.js +130 -0
  96. package/dist/esm/polyfills/core-js.js +11 -0
  97. package/dist/esm/polyfills/css-shim.js +1 -0
  98. package/dist/esm/polyfills/dom.js +79 -0
  99. package/dist/esm/polyfills/es5-html-element.js +1 -0
  100. package/dist/esm/polyfills/index.js +34 -0
  101. package/dist/esm/polyfills/system.js +6 -0
  102. package/dist/esm/utils-ef280639.js +5739 -0
  103. package/dist/index.cjs.js +1 -0
  104. package/dist/index.js +1 -0
  105. package/dist/stencil.config.js +40 -0
  106. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/casino-game-thumbnail/.stencil/packages/casino-game-thumbnail/stencil.config.d.ts +2 -0
  107. package/dist/types/components/casino-extrainfo-baccarat/casino-extrainfo-baccarat.d.ts +40 -0
  108. package/dist/types/components/casino-extrainfo-blackjack/casino-extrainfo-blackjack.d.ts +36 -0
  109. package/dist/types/components/casino-extrainfo-roulette/casino-extrainfo-roulette.d.ts +21 -0
  110. package/dist/types/components/casino-game-thumbnail/casino-game-thumbnail.d.ts +203 -0
  111. package/dist/types/components/casino-game-thumbnail-betlimit/casino-game-thumbnail-betlimit.d.ts +17 -0
  112. package/dist/types/components/casino-game-thumbnail-extrainfo/casino-game-thumbnail-extrainfo.d.ts +16 -0
  113. package/dist/types/components/casino-game-thumbnail-overlay/casino-game-thumbnail-overlay.d.ts +30 -0
  114. package/dist/types/components/casino-normal-game-thumbnail/casino-normal-game-thumbnail.d.ts +3 -0
  115. package/dist/types/components.d.ts +461 -0
  116. package/dist/types/constants/game-thumbnail.d.ts +83 -0
  117. package/dist/types/index.d.ts +1 -0
  118. package/dist/types/models/casino-game-thumbnail.d.ts +132 -0
  119. package/dist/types/models/currency-symbols.d.ts +172 -0
  120. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  121. package/dist/types/utils/baccarat-board-svg.d.ts +31 -0
  122. package/dist/types/utils/locale.utils.d.ts +1 -0
  123. package/dist/types/utils/utils.d.ts +19 -0
  124. package/loader/cdn.js +3 -0
  125. package/loader/index.cjs.js +3 -0
  126. package/loader/index.d.ts +12 -0
  127. package/loader/index.es2017.js +3 -0
  128. package/loader/index.js +4 -0
  129. package/loader/package.json +10 -0
  130. package/package.json +26 -0
@@ -0,0 +1,968 @@
1
+ import { Component, h, Prop, State, Event, Watch, Listen, } from '@stencil/core';
2
+ import { isMobile, convertGicBaccaratUpdateItem } from '../../utils/utils';
3
+ import { WIDGETTYPE_GAMECATEGORY, GAME_CATEGORY, GAME_TYPE, } from '../../constants/game-thumbnail';
4
+ import { EventSourcePolyfill } from 'event-source-polyfill';
5
+ import Fav from '../../static/fav.svg';
6
+ import UnFavSvg from '../../static/unfav.svg';
7
+ export class CasinoGameThumbnail {
8
+ constructor() {
9
+ /**
10
+ * Widget Setting, Game language
11
+ */
12
+ this.language = 'en';
13
+ /**
14
+ * startDetailUpdaterForGame
15
+ */
16
+ this.startDetailUpdaterForGame = false;
17
+ /**
18
+ * Widget Setting, Client custom styling via string
19
+ */
20
+ this.clientStyling = '';
21
+ /**
22
+ * Widget Setting, Client custom styling via url content
23
+ */
24
+ this.clientStylingUrl = '';
25
+ /**
26
+ * Widget Setting, show game in a frame when user clicked 'start'
27
+ */
28
+ this.integratedGameFrameMobile = false;
29
+ /**
30
+ * Widget Setting, show game in a frame when user clicked 'start', Open game aframe,
31
+ * gamepageModalUrl value should be set
32
+ */
33
+ this.integratedGameFrameDesktop = false;
34
+ /**
35
+ * Widget Setting, Load game details when set it as true, default value: false
36
+ * When loadDetails is true and type=='live-casino-tables',
37
+ * Load gameDetails by endpoint/vendor/gameId if livelobbyEndpoint is null
38
+ */
39
+ this.loadDetails = false;
40
+ /**
41
+ * Widget Setting, showRoundBoard, default value: false
42
+ */
43
+ this.showRoundBoard = false;
44
+ /**
45
+ * Game Property, default ''
46
+ */
47
+ this.gameCategory = '';
48
+ /**
49
+ * Game Property, Game lunch platform
50
+ */
51
+ this.platform = 'PC';
52
+ this.gameInfo = {};
53
+ this.thumbnailLoaded = false;
54
+ this.containerClassWhenDetailChange = '';
55
+ this.isUserLoggedIn = false;
56
+ this.limitStylingAppends = false;
57
+ //customize style setting
58
+ this.setClientStyling = () => {
59
+ let sheet = document.createElement('style');
60
+ sheet.innerHTML = this.clientStyling;
61
+ this.stylingContainer.prepend(sheet);
62
+ };
63
+ //customize style setting
64
+ this.setClientStylingURL = () => {
65
+ let url = new URL(this.clientStylingUrl);
66
+ let cssFile = document.createElement('style');
67
+ fetch(url.href)
68
+ .then((res) => res.text())
69
+ .then((data) => {
70
+ cssFile.innerHTML = data;
71
+ setTimeout(() => {
72
+ this.stylingContainer.prepend(cssFile);
73
+ }, 1);
74
+ })
75
+ .catch((err) => {
76
+ console.error('error ', err);
77
+ });
78
+ };
79
+ this.getGameCategoryType = () => {
80
+ if (this.isLiveCasino && this.gameCategory) {
81
+ return `casino-extrainfo-${this.getWidgetTypeByGameCategory(this.gameCategory).toLowerCase()}`;
82
+ }
83
+ return `casino-normal-game-thumbnail`;
84
+ };
85
+ this.getGameContainerClass = () => {
86
+ let gameContainerClass = `GameContainer `;
87
+ if (this.gameInfo) {
88
+ if (this.gameInfo && this.gameInfo.details) {
89
+ gameContainerClass += ' ListGame ';
90
+ if (this.gameInfo.details.isOpen &&
91
+ this.gameInfo.details.currentRouletteNumbers) {
92
+ gameContainerClass += ' GameBackdrop ';
93
+ }
94
+ }
95
+ }
96
+ return gameContainerClass;
97
+ };
98
+ }
99
+ onSessionChanged() {
100
+ this.isUserLoggedIn = !!(this.session && this.userId);
101
+ }
102
+ onTableFullChanged(newVal, oldVal) {
103
+ if (oldVal == undefined) {
104
+ return;
105
+ }
106
+ this.containerClassWhenDetailChange =
107
+ newVal && !oldVal ? 'PulsatingRedShadow' : 'PulsatingGreenShadow';
108
+ }
109
+ handleMouseOver(event) {
110
+ this.hover = event.type === 'mouseenter';
111
+ }
112
+ gameFavoritedHandler(event) {
113
+ let eventDetail = event.detail;
114
+ this.gameInfo.isFavorite = eventDetail[this.gameId];
115
+ this.gameInfo = Object.assign({}, this.gameInfo);
116
+ }
117
+ gameDetailChangeHandler(e) {
118
+ var _a, _b;
119
+ let message = JSON.parse(e.data);
120
+ if (message.needReconnect && this.eventSource) {
121
+ this.eventSource.close();
122
+ this.startLiveGameUpdateListener(this.eventSource.url);
123
+ return;
124
+ }
125
+ if (!(message && message.InternalTableId == this.gameId)) {
126
+ return;
127
+ }
128
+ let MessageType = message.MessageType;
129
+ switch (MessageType) {
130
+ case 'TableOpened':
131
+ case 'TableClosed':
132
+ this.gameInfo.details.isOpen = message.Open;
133
+ break;
134
+ case 'PlayersUpdated':
135
+ this.gameInfo.details.numberOfPlayers = message.Players;
136
+ break;
137
+ case 'RouletteResultsUpdated':
138
+ this.gameInfo.details.currentRouletteNumbers = message.Results;
139
+ break;
140
+ case 'DoubleBallRouletteResultsUpdated':
141
+ this.gameInfo.details.currentDoubleBallRouletteNumbers =
142
+ message.Results;
143
+ break;
144
+ case 'SeatsUpdated':
145
+ this.gameInfo.details.currentOccupiedSeats = message.Seats;
146
+ break;
147
+ case 'DealerChanged':
148
+ this.gameInfo.details.dealer = message.Dealer;
149
+ break;
150
+ case 'BaccaratResultsUpdated':
151
+ if (this.showRoundBoard) {
152
+ const Results = message.Results;
153
+ this.gameInfo.details.results = [];
154
+ Results.forEach((item) => {
155
+ this.gameInfo.details.results.push(convertGicBaccaratUpdateItem(item));
156
+ });
157
+ (_a = this.extraInfoRef) === null || _a === void 0 ? void 0 : _a.onBaccaratResultChanged(this.gameInfo.details.results);
158
+ }
159
+ break;
160
+ }
161
+ this.resetLiveProperties();
162
+ (_b = this.extraInfoRef) === null || _b === void 0 ? void 0 : _b.onGameDetailUpdated(this.gameInfo.details);
163
+ window.postMessage({ messageType: MessageType, value: e.data });
164
+ }
165
+ resetLiveProperties() {
166
+ var _a, _b;
167
+ const details = this.gameInfo.details;
168
+ if (this.isBlackJack(this.gameCategory.toLowerCase())) {
169
+ this.isTableFull =
170
+ details.totalSeats == ((_a = details.currentOccupiedSeats) === null || _a === void 0 ? void 0 : _a.length);
171
+ }
172
+ else if (this.isBaccarat(this.gameCategory.toLowerCase()) &&
173
+ ((_b = details.baccaratResults) === null || _b === void 0 ? void 0 : _b.length) > 0) {
174
+ this.gameInfo.details.results = [];
175
+ details.baccaratResults.forEach((item) => {
176
+ this.gameInfo.details.results.push(convertGicBaccaratUpdateItem(item));
177
+ });
178
+ delete details.baccaratResults;
179
+ }
180
+ }
181
+ /**
182
+ * Start a event source to check casino details update info
183
+ * @param updateUrl: the url for sse
184
+ */
185
+ startLiveGameUpdateListener(updateUrl) {
186
+ this.eventSource = new EventSourcePolyfill(updateUrl);
187
+ this.eventSource.removeEventListener('message');
188
+ this.eventSource.addEventListener('message', (evt) => {
189
+ this.gameDetailChangeHandler(evt);
190
+ });
191
+ }
192
+ isBlackJack(gameCategory) {
193
+ return gameCategory.toLowerCase() === GAME_CATEGORY.BLACKJACK;
194
+ }
195
+ isBaccarat(gameCategory) {
196
+ return gameCategory.toLowerCase() === GAME_CATEGORY.BACCARAT;
197
+ }
198
+ /**
199
+ * Calculate component properties by game info,
200
+ * eg: isLiveCasino, gameInfo, isTableFull
201
+ */
202
+ initCtrlProperties() {
203
+ var _a;
204
+ if (this.isLiveCasino && ((_a = this.gameInfo) === null || _a === void 0 ? void 0 : _a.details)) {
205
+ this.resetLiveProperties();
206
+ }
207
+ this.gameInfo = Object.assign({}, this.gameInfo);
208
+ setTimeout(() => {
209
+ var _a;
210
+ (_a = this.extraInfoRef) === null || _a === void 0 ? void 0 : _a.onGameLoaded(this.gameInfo);
211
+ window.postMessage({
212
+ type: 'casinoGameLoaded',
213
+ gameInfo: this.gameInfo,
214
+ });
215
+ }, 200);
216
+ }
217
+ /**
218
+ * Parse game info by game info api response
219
+ * @param data
220
+ */
221
+ parseGameResponse(data) {
222
+ if (data.length == 1) {
223
+ this.gameInfo = data[0];
224
+ if (this.isLiveCasino) {
225
+ if (!this.gameInfo.details) {
226
+ this.loadGameDetailInfo();
227
+ }
228
+ else {
229
+ this.parseGameDetailsResponse();
230
+ }
231
+ }
232
+ else {
233
+ this.initCtrlProperties();
234
+ }
235
+ }
236
+ }
237
+ /**
238
+ * Parse game detail info, set it to game info
239
+ */
240
+ parseGameDetailsResponse() {
241
+ this.initCtrlProperties();
242
+ //start sse depends on props(startDetailUpdaterForGame) setting
243
+ if (this.startDetailUpdaterForGame) {
244
+ const updateUrl = `${this.endpoint}/encoder/lobby/updates/${this.gameInfo.vendor.name}/${this.gameInfo.id}`;
245
+ this.startLiveGameUpdateListener(updateUrl);
246
+ }
247
+ }
248
+ /**
249
+ * Get game base info from game api(casino/games/{id})
250
+ * @private
251
+ */
252
+ loadGameById() {
253
+ let url = `${this.endpoint}/casino/games/${this.gameId}?expand=vendor&platform=${this.platform}&language=${this.language}`;
254
+ fetch(url)
255
+ .then((res) => res.json())
256
+ .then((data) => this.parseGameResponse(data))
257
+ .catch((err) => {
258
+ console.error(err);
259
+ });
260
+ }
261
+ /*
262
+ * Load game info when widget property 'livelobbyEndpoint' set
263
+ * @private
264
+ */
265
+ loadGameInfoByLobbyEndpoint() {
266
+ let url = new URL(`${this.livelobbyEndpoint.split('?')[0]}`);
267
+ url.searchParams.append('expand', 'vendor');
268
+ url.searchParams.append('platform', this.platform);
269
+ url.searchParams.append('language', this.language);
270
+ fetch(url.toString())
271
+ .then((res) => res.json())
272
+ .then((data) => this.parseGameResponse(data))
273
+ .catch((error) => console.error(error));
274
+ }
275
+ /*
276
+ * load game info when widget property 'livelobbyEndpoint' setted
277
+ * @private
278
+ */
279
+ loadGameDetailInfo() {
280
+ let url = new URL(`${this.endpoint}/lobby/tables/${this.gameId}`);
281
+ url.searchParams.append('platform', this.platform);
282
+ url.searchParams.append('language', this.language);
283
+ fetch(url.toString())
284
+ .then((res) => res.json())
285
+ .then((data) => {
286
+ if (!(data === null || data === void 0 ? void 0 : data.category)) {
287
+ return;
288
+ }
289
+ this.gameInfo.details = data;
290
+ this.parseGameDetailsResponse();
291
+ })
292
+ .catch((err) => {
293
+ console.error(err);
294
+ setTimeout(() => this.loadGameDetailInfo(), 1000);
295
+ });
296
+ }
297
+ /**
298
+ * Toggle game favorite property
299
+ * @param gameId
300
+ * @private
301
+ */
302
+ toggleFavoriteGame(gameId) {
303
+ let triggerFactor = 'thumbnail';
304
+ if (this.gameInfo.isFavorite) {
305
+ window.postMessage({ type: 'SetUnfavoredGame', gameId, triggerFactor }, window.location.href);
306
+ }
307
+ else {
308
+ window.postMessage({ type: 'SetFavoredGame', gameId, triggerFactor }, window.location.href);
309
+ }
310
+ this.toggleFavoriteCasinoGameEvent.emit(gameId);
311
+ }
312
+ /**
313
+ * Generate gameInfo obj by props
314
+ * @private
315
+ */
316
+ generateGameInfoByProps() {
317
+ return {
318
+ id: this.gameId,
319
+ name: this.gameName,
320
+ subVendor: this.subVendor,
321
+ hasFunMode: this.hasFunMode,
322
+ hasAnonymousFunMode: this.hasAnonymousFunMode,
323
+ thumbnail: this.thumbnail,
324
+ cellSize: this.cellSize,
325
+ gameTag: this.gameTag,
326
+ vendor: { href: '', name: this.gameVendor },
327
+ isFavorite: this.isFavorite,
328
+ isNew: this.isNew,
329
+ type: this.type,
330
+ liveCasinoCategory: this.gameCategory || '',
331
+ };
332
+ }
333
+ componentDidRender() {
334
+ // start custom styling area
335
+ if (!this.limitStylingAppends && this.stylingContainer) {
336
+ if (this.clientStyling)
337
+ this.setClientStyling();
338
+ if (this.clientStylingUrl)
339
+ this.setClientStylingURL();
340
+ this.limitStylingAppends = true;
341
+ }
342
+ // end custom styling area
343
+ }
344
+ componentDidLoad() {
345
+ var _a;
346
+ //Init this.extraInfoRef, prepare for data loader, this.gameInfo did not inited might
347
+ this.extraInfoRef = (_a = this.extraInfoSlotRef) === null || _a === void 0 ? void 0 : _a.querySelector(this.getGameCategoryType());
348
+ }
349
+ connectedCallback() {
350
+ this.isLiveCasino = this.type == GAME_TYPE.LIVE_CASINO;
351
+ this.extraInfoWidget = this.getGameCategoryType();
352
+ this.isUserLoggedIn = !!(this.session && this.userId);
353
+ if (this.isLiveCasino && this.livelobbyEndpoint) {
354
+ this.loadGameInfoByLobbyEndpoint();
355
+ return;
356
+ }
357
+ //generate gameInfo obj by props
358
+ if (this.thumbnail) {
359
+ this.gameInfo = this.generateGameInfoByProps();
360
+ // loadLiveDetails if game is live casino
361
+ if (this.isLiveCasino &&
362
+ this.endpoint &&
363
+ this.loadDetails &&
364
+ this.gameId) {
365
+ this.loadGameDetailInfo();
366
+ return;
367
+ }
368
+ return;
369
+ }
370
+ //fetch data from api if no game properties set except gameId
371
+ if (this.gameId && this.endpoint) {
372
+ this.loadGameById();
373
+ }
374
+ }
375
+ // end custom styling area
376
+ getWidgetTypeByGameCategory(gameCategory) {
377
+ return WIDGETTYPE_GAMECATEGORY[gameCategory.toLowerCase()];
378
+ }
379
+ getGameOverlayProps() {
380
+ return {
381
+ gameName: this.gameInfo.name,
382
+ gameId: this.gameInfo.gameId,
383
+ gameVendor: this.gameVendor || this.gameInfo.vendor.name,
384
+ hasFunMode: this.gameInfo.hasFunMode,
385
+ language: this.language,
386
+ integratedGameFrameMobile: this.integratedGameFrameMobile,
387
+ integratedGameFrameDesktop: this.integratedGameFrameDesktop,
388
+ gamepageModalUrl: this.gamepageModalUrl,
389
+ };
390
+ }
391
+ render() {
392
+ var _a, _b;
393
+ if (!this.gameInfo) {
394
+ return (h("div", { class: "GameInnerContainer", part: "GameInnerContainer", slot: "Game-Inner" },
395
+ h("img", { src: this.thumbnail, alt: "", loading: "lazy", part: "GameContainer", class: "GameContainer", onLoad: () => (this.thumbnailLoaded = true) })));
396
+ }
397
+ const gameOverlayProps = this.getGameOverlayProps();
398
+ const gameThumbnail = ((_a = this.gameInfo) === null || _a === void 0 ? void 0 : _a.thumbnail) || ((_b = this.gameInfo) === null || _b === void 0 ? void 0 : _b.defaultThumbnail);
399
+ const gameContainerClass = this.getGameContainerClass();
400
+ const gameThumbnailClass = `GameBg ${this.cellSize ? 'GameBg-' + this.cellSize : ''}
401
+ ${this.hover ? ' GameContainerHovered' : ''} ${this.thumbnailLoaded ? ' Loaded' : ''}`;
402
+ return (h("div", { class: `${gameContainerClass} ${this.containerClassWhenDetailChange}`, part: `${gameContainerClass} ${this.containerClassWhenDetailChange}`, ref: (el) => (this.stylingContainer = el), "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrl },
403
+ h("div", { class: `GameInnerContainer ${this.hover ? 'Hovered' : ''}`, part: `GameInnerContainer ${this.hover ? 'Hovered' : ''}` },
404
+ h("img", { src: gameThumbnail, alt: "Game Thumbnail ", loading: "lazy", part: gameThumbnailClass, class: gameThumbnailClass, onLoad: () => (this.thumbnailLoaded = true) }),
405
+ this.isUserLoggedIn && (h("div", { class: `FavIconContainer ${this.gameInfo.isFavorite ? 'Favorited' : ''}`, part: `FavIconContainer ${this.gameInfo.isFavorite ? 'Favorited' : ''}`, onClick: () => this.toggleFavoriteGame(this.gameId) }, this.gameInfo.isFavorite ? (h("slot", { name: "fav-icon" },
406
+ h("span", { class: "FavoredIcon", part: "FavoredIcon", innerHTML: Fav }))) : (h("slot", { name: "UnFavIcon" }, !isMobile(window.navigator.userAgent) && (h("span", { class: "UnfavoredIcon", part: "UnfavoredIcon", innerHTML: UnFavSvg })))))),
407
+ h("slot", { name: "game-overlay" },
408
+ h("casino-game-thumbnail-overlay", Object.assign({ language: this.language }, gameOverlayProps))),
409
+ h("slot", { name: "extra-info", ref: (el) => (this.extraInfoSlotRef = el) },
410
+ h(this.extraInfoWidget, { language: this.language, "show-round-board": this.showRoundBoard })),
411
+ h("slot", { name: "game-property-slot" })),
412
+ this.showGameName && (h("slot", { name: "game-name" },
413
+ h("p", { class: "GameNameBelow", part: "GameNameBelow", title: gameOverlayProps.gameName }, gameOverlayProps.gameName)))));
414
+ }
415
+ static get is() { return "casino-game-thumbnail"; }
416
+ static get encapsulation() { return "shadow"; }
417
+ static get originalStyleUrls() { return {
418
+ "$": ["casino-game-thumbnail.scss"]
419
+ }; }
420
+ static get styleUrls() { return {
421
+ "$": ["casino-game-thumbnail.css"]
422
+ }; }
423
+ static get assetsDirs() { return ["static"]; }
424
+ static get properties() { return {
425
+ "language": {
426
+ "type": "string",
427
+ "mutable": false,
428
+ "complexType": {
429
+ "original": "string",
430
+ "resolved": "string",
431
+ "references": {}
432
+ },
433
+ "required": false,
434
+ "optional": false,
435
+ "docs": {
436
+ "tags": [],
437
+ "text": "Widget Setting, Game language"
438
+ },
439
+ "attribute": "language",
440
+ "reflect": false,
441
+ "defaultValue": "'en'"
442
+ },
443
+ "endpoint": {
444
+ "type": "string",
445
+ "mutable": false,
446
+ "complexType": {
447
+ "original": "string",
448
+ "resolved": "string",
449
+ "references": {}
450
+ },
451
+ "required": false,
452
+ "optional": false,
453
+ "docs": {
454
+ "tags": [],
455
+ "text": "Widget Setting, Api endpoint for loading game details"
456
+ },
457
+ "attribute": "endpoint",
458
+ "reflect": false
459
+ },
460
+ "userId": {
461
+ "type": "any",
462
+ "mutable": false,
463
+ "complexType": {
464
+ "original": "string | number",
465
+ "resolved": "number | string",
466
+ "references": {}
467
+ },
468
+ "required": false,
469
+ "optional": false,
470
+ "docs": {
471
+ "tags": [],
472
+ "text": "Widget Setting, User id"
473
+ },
474
+ "attribute": "user-id",
475
+ "reflect": false
476
+ },
477
+ "showGameName": {
478
+ "type": "boolean",
479
+ "mutable": false,
480
+ "complexType": {
481
+ "original": "boolean",
482
+ "resolved": "boolean",
483
+ "references": {}
484
+ },
485
+ "required": false,
486
+ "optional": false,
487
+ "docs": {
488
+ "tags": [],
489
+ "text": "Widget Setting, Show game name if set it as true"
490
+ },
491
+ "attribute": "show-game-name",
492
+ "reflect": false
493
+ },
494
+ "session": {
495
+ "type": "string",
496
+ "mutable": false,
497
+ "complexType": {
498
+ "original": "string",
499
+ "resolved": "string",
500
+ "references": {}
501
+ },
502
+ "required": false,
503
+ "optional": false,
504
+ "docs": {
505
+ "tags": [],
506
+ "text": "Widget Setting, User session"
507
+ },
508
+ "attribute": "session",
509
+ "reflect": false
510
+ },
511
+ "startDetailUpdaterForGame": {
512
+ "type": "boolean",
513
+ "mutable": false,
514
+ "complexType": {
515
+ "original": "boolean",
516
+ "resolved": "boolean",
517
+ "references": {}
518
+ },
519
+ "required": false,
520
+ "optional": false,
521
+ "docs": {
522
+ "tags": [],
523
+ "text": "startDetailUpdaterForGame"
524
+ },
525
+ "attribute": "start-detail-updater-for-game",
526
+ "reflect": false,
527
+ "defaultValue": "false"
528
+ },
529
+ "clientStyling": {
530
+ "type": "string",
531
+ "mutable": false,
532
+ "complexType": {
533
+ "original": "string",
534
+ "resolved": "string",
535
+ "references": {}
536
+ },
537
+ "required": false,
538
+ "optional": false,
539
+ "docs": {
540
+ "tags": [],
541
+ "text": "Widget Setting, Client custom styling via string"
542
+ },
543
+ "attribute": "client-styling",
544
+ "reflect": false,
545
+ "defaultValue": "''"
546
+ },
547
+ "clientStylingUrl": {
548
+ "type": "string",
549
+ "mutable": false,
550
+ "complexType": {
551
+ "original": "string",
552
+ "resolved": "string",
553
+ "references": {}
554
+ },
555
+ "required": false,
556
+ "optional": false,
557
+ "docs": {
558
+ "tags": [],
559
+ "text": "Widget Setting, Client custom styling via url content"
560
+ },
561
+ "attribute": "client-styling-url",
562
+ "reflect": false,
563
+ "defaultValue": "''"
564
+ },
565
+ "integratedGameFrameMobile": {
566
+ "type": "boolean",
567
+ "mutable": false,
568
+ "complexType": {
569
+ "original": "boolean",
570
+ "resolved": "boolean",
571
+ "references": {}
572
+ },
573
+ "required": false,
574
+ "optional": false,
575
+ "docs": {
576
+ "tags": [],
577
+ "text": "Widget Setting, show game in a frame when user clicked 'start'"
578
+ },
579
+ "attribute": "integrated-game-frame-mobile",
580
+ "reflect": false,
581
+ "defaultValue": "false"
582
+ },
583
+ "gamepageModalUrl": {
584
+ "type": "string",
585
+ "mutable": false,
586
+ "complexType": {
587
+ "original": "string",
588
+ "resolved": "string",
589
+ "references": {}
590
+ },
591
+ "required": false,
592
+ "optional": false,
593
+ "docs": {
594
+ "tags": [],
595
+ "text": "Widget Setting, show game in a frame when user clicked 'start'\nthe frame url when integratedGameFrameDesktop is true"
596
+ },
597
+ "attribute": "gamepage-modal-url",
598
+ "reflect": false
599
+ },
600
+ "integratedGameFrameDesktop": {
601
+ "type": "boolean",
602
+ "mutable": false,
603
+ "complexType": {
604
+ "original": "boolean",
605
+ "resolved": "boolean",
606
+ "references": {}
607
+ },
608
+ "required": false,
609
+ "optional": false,
610
+ "docs": {
611
+ "tags": [],
612
+ "text": "Widget Setting, show game in a frame when user clicked 'start', Open game aframe,\ngamepageModalUrl value should be set"
613
+ },
614
+ "attribute": "integrated-game-frame-desktop",
615
+ "reflect": false,
616
+ "defaultValue": "false"
617
+ },
618
+ "loadDetails": {
619
+ "type": "boolean",
620
+ "mutable": false,
621
+ "complexType": {
622
+ "original": "boolean",
623
+ "resolved": "boolean",
624
+ "references": {}
625
+ },
626
+ "required": false,
627
+ "optional": false,
628
+ "docs": {
629
+ "tags": [],
630
+ "text": "Widget Setting, Load game details when set it as true, default value: false\nWhen loadDetails is true and type=='live-casino-tables',\nLoad gameDetails by endpoint/vendor/gameId if livelobbyEndpoint is null"
631
+ },
632
+ "attribute": "load-details",
633
+ "reflect": false,
634
+ "defaultValue": "false"
635
+ },
636
+ "showRoundBoard": {
637
+ "type": "boolean",
638
+ "mutable": false,
639
+ "complexType": {
640
+ "original": "boolean",
641
+ "resolved": "boolean",
642
+ "references": {}
643
+ },
644
+ "required": false,
645
+ "optional": false,
646
+ "docs": {
647
+ "tags": [],
648
+ "text": "Widget Setting, showRoundBoard, default value: false"
649
+ },
650
+ "attribute": "show-round-board",
651
+ "reflect": false,
652
+ "defaultValue": "false"
653
+ },
654
+ "gameCategory": {
655
+ "type": "string",
656
+ "mutable": false,
657
+ "complexType": {
658
+ "original": "string",
659
+ "resolved": "string",
660
+ "references": {}
661
+ },
662
+ "required": false,
663
+ "optional": false,
664
+ "docs": {
665
+ "tags": [],
666
+ "text": "Game Property, default ''"
667
+ },
668
+ "attribute": "game-category",
669
+ "reflect": false,
670
+ "defaultValue": "''"
671
+ },
672
+ "livelobbyEndpoint": {
673
+ "type": "string",
674
+ "mutable": false,
675
+ "complexType": {
676
+ "original": "string",
677
+ "resolved": "string",
678
+ "references": {}
679
+ },
680
+ "required": false,
681
+ "optional": false,
682
+ "docs": {
683
+ "tags": [],
684
+ "text": "Widget Setting, Live lobby endpoint, use to start a game\nLoad game info by this url if type=='live-casino-tables'"
685
+ },
686
+ "attribute": "livelobby-endpoint",
687
+ "reflect": false
688
+ },
689
+ "gameId": {
690
+ "type": "any",
691
+ "mutable": false,
692
+ "complexType": {
693
+ "original": "number | string",
694
+ "resolved": "number | string",
695
+ "references": {}
696
+ },
697
+ "required": false,
698
+ "optional": false,
699
+ "docs": {
700
+ "tags": [],
701
+ "text": "Game Property, GameId"
702
+ },
703
+ "attribute": "game-id",
704
+ "reflect": false
705
+ },
706
+ "gameName": {
707
+ "type": "string",
708
+ "mutable": false,
709
+ "complexType": {
710
+ "original": "string",
711
+ "resolved": "string",
712
+ "references": {}
713
+ },
714
+ "required": false,
715
+ "optional": false,
716
+ "docs": {
717
+ "tags": [],
718
+ "text": "Game Property, Game Name"
719
+ },
720
+ "attribute": "game-name",
721
+ "reflect": false
722
+ },
723
+ "subVendor": {
724
+ "type": "string",
725
+ "mutable": false,
726
+ "complexType": {
727
+ "original": "string",
728
+ "resolved": "string",
729
+ "references": {}
730
+ },
731
+ "required": false,
732
+ "optional": false,
733
+ "docs": {
734
+ "tags": [],
735
+ "text": "Game Property, Game SubVendor"
736
+ },
737
+ "attribute": "sub-vendor",
738
+ "reflect": false
739
+ },
740
+ "gameVendor": {
741
+ "type": "string",
742
+ "mutable": false,
743
+ "complexType": {
744
+ "original": "string",
745
+ "resolved": "string",
746
+ "references": {}
747
+ },
748
+ "required": false,
749
+ "optional": false,
750
+ "docs": {
751
+ "tags": [],
752
+ "text": "Game Property, Game vendor"
753
+ },
754
+ "attribute": "game-vendor",
755
+ "reflect": false
756
+ },
757
+ "hasFunMode": {
758
+ "type": "boolean",
759
+ "mutable": false,
760
+ "complexType": {
761
+ "original": "boolean",
762
+ "resolved": "boolean",
763
+ "references": {}
764
+ },
765
+ "required": false,
766
+ "optional": false,
767
+ "docs": {
768
+ "tags": [],
769
+ "text": "Game Property, Game funMode"
770
+ },
771
+ "attribute": "has-fun-mode",
772
+ "reflect": false
773
+ },
774
+ "hasAnonymousFunMode": {
775
+ "type": "boolean",
776
+ "mutable": false,
777
+ "complexType": {
778
+ "original": "boolean",
779
+ "resolved": "boolean",
780
+ "references": {}
781
+ },
782
+ "required": false,
783
+ "optional": false,
784
+ "docs": {
785
+ "tags": [],
786
+ "text": "Game Property, hasAnonymousFunMode"
787
+ },
788
+ "attribute": "has-anonymous-fun-mode",
789
+ "reflect": false
790
+ },
791
+ "platform": {
792
+ "type": "string",
793
+ "mutable": false,
794
+ "complexType": {
795
+ "original": "string",
796
+ "resolved": "string",
797
+ "references": {}
798
+ },
799
+ "required": false,
800
+ "optional": false,
801
+ "docs": {
802
+ "tags": [],
803
+ "text": "Game Property, Game lunch platform"
804
+ },
805
+ "attribute": "platform",
806
+ "reflect": false,
807
+ "defaultValue": "'PC'"
808
+ },
809
+ "thumbnail": {
810
+ "type": "string",
811
+ "mutable": false,
812
+ "complexType": {
813
+ "original": "string",
814
+ "resolved": "string",
815
+ "references": {}
816
+ },
817
+ "required": false,
818
+ "optional": false,
819
+ "docs": {
820
+ "tags": [],
821
+ "text": "Game Property, Game thumbnail"
822
+ },
823
+ "attribute": "thumbnail",
824
+ "reflect": false
825
+ },
826
+ "isFavorite": {
827
+ "type": "boolean",
828
+ "mutable": false,
829
+ "complexType": {
830
+ "original": "boolean",
831
+ "resolved": "boolean",
832
+ "references": {}
833
+ },
834
+ "required": false,
835
+ "optional": false,
836
+ "docs": {
837
+ "tags": [],
838
+ "text": "Game Property, is Game Favorited"
839
+ },
840
+ "attribute": "is-favorite",
841
+ "reflect": false
842
+ },
843
+ "isNew": {
844
+ "type": "boolean",
845
+ "mutable": false,
846
+ "complexType": {
847
+ "original": "boolean",
848
+ "resolved": "boolean",
849
+ "references": {}
850
+ },
851
+ "required": false,
852
+ "optional": false,
853
+ "docs": {
854
+ "tags": [],
855
+ "text": "Game Property, is Game new"
856
+ },
857
+ "attribute": "is-new",
858
+ "reflect": false
859
+ },
860
+ "cellSize": {
861
+ "type": "string",
862
+ "mutable": false,
863
+ "complexType": {
864
+ "original": "string",
865
+ "resolved": "string",
866
+ "references": {}
867
+ },
868
+ "required": false,
869
+ "optional": false,
870
+ "docs": {
871
+ "tags": [],
872
+ "text": "Game Property, Customize game cell size"
873
+ },
874
+ "attribute": "cell-size",
875
+ "reflect": false
876
+ },
877
+ "gameTag": {
878
+ "type": "string",
879
+ "mutable": false,
880
+ "complexType": {
881
+ "original": "string",
882
+ "resolved": "string",
883
+ "references": {}
884
+ },
885
+ "required": false,
886
+ "optional": false,
887
+ "docs": {
888
+ "tags": [],
889
+ "text": "Game Property, gameTag"
890
+ },
891
+ "attribute": "game-tag",
892
+ "reflect": false
893
+ },
894
+ "type": {
895
+ "type": "string",
896
+ "mutable": false,
897
+ "complexType": {
898
+ "original": "string",
899
+ "resolved": "string",
900
+ "references": {}
901
+ },
902
+ "required": true,
903
+ "optional": false,
904
+ "docs": {
905
+ "tags": [],
906
+ "text": "Game Property, type, isLiveCasino when type == 'live-casino-tables'"
907
+ },
908
+ "attribute": "type",
909
+ "reflect": false
910
+ }
911
+ }; }
912
+ static get states() { return {
913
+ "gameInfo": {},
914
+ "isTableFull": {},
915
+ "hover": {}
916
+ }; }
917
+ static get events() { return [{
918
+ "method": "toggleFavoriteCasinoGameEvent",
919
+ "name": "toggleCasinoGameFavorite",
920
+ "bubbles": true,
921
+ "cancelable": true,
922
+ "composed": true,
923
+ "docs": {
924
+ "tags": [],
925
+ "text": ""
926
+ },
927
+ "complexType": {
928
+ "original": "number | string",
929
+ "resolved": "number | string",
930
+ "references": {}
931
+ }
932
+ }]; }
933
+ static get watchers() { return [{
934
+ "propName": "session",
935
+ "methodName": "onSessionChanged"
936
+ }, {
937
+ "propName": "userId",
938
+ "methodName": "onSessionChanged"
939
+ }, {
940
+ "propName": "isTableFull",
941
+ "methodName": "onTableFullChanged"
942
+ }]; }
943
+ static get listeners() { return [{
944
+ "name": "mouseenter",
945
+ "method": "handleMouseOver",
946
+ "target": undefined,
947
+ "capture": false,
948
+ "passive": true
949
+ }, {
950
+ "name": "mouseleave",
951
+ "method": "handleMouseOver",
952
+ "target": undefined,
953
+ "capture": false,
954
+ "passive": true
955
+ }, {
956
+ "name": "gameFavorited",
957
+ "method": "gameFavoritedHandler",
958
+ "target": "document",
959
+ "capture": false,
960
+ "passive": false
961
+ }, {
962
+ "name": "gameDetailChange",
963
+ "method": "gameDetailChangeHandler",
964
+ "target": undefined,
965
+ "capture": false,
966
+ "passive": false
967
+ }]; }
968
+ }