@everymatrix/casino-game-thumb-view 1.13.5

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