@everymatrix/casino-game-thumbnail 1.0.2 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-game-thumbnail",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "dist/casino-game-thumbnail.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -4,7 +4,7 @@
4
4
  import moment from 'moment';
5
5
  import { onMount, tick } from "svelte";
6
6
  import { isMobile, getDevice } from 'rvhelper';
7
- import { _, addNewMessages } from './i18n';
7
+ import { _, addNewMessages} from './i18n';
8
8
  import { GameThumbnailTranslations } from './translations';
9
9
  import { currenciesSymbols } from './currency-symbols';
10
10
 
@@ -171,6 +171,24 @@
171
171
  const toggleGameFrame = (gameId:any):void => {
172
172
  if (searchitem) {
173
173
  window.postMessage({ type: 'SearchedItemClicked', gameId }, window.location.href);
174
+
175
+ //Analytics event -- if game was searched
176
+ if(typeof gtag == 'function'){
177
+ gtag('event', 'OpenGame', {
178
+ 'context' : 'GameThumbnail--Searched',
179
+ 'gameId' : `${gameId}`,
180
+ 'userId' : `${playerID ? playerID : 'Not logged in'}`
181
+ });
182
+ }
183
+ } else {
184
+ //Analytics event
185
+ if(typeof gtag == 'function'){
186
+ gtag('event', 'OpenGame', {
187
+ 'context': 'GameThumbnail',
188
+ 'gameId' : `${gameId}`,
189
+ 'userId' : `${playerID ? playerID : 'Not logged in'}`
190
+ });
191
+ }
174
192
  }
175
193
 
176
194
  if (isMobile(userAgent) && integratedgameframemobile == "true") {
@@ -198,19 +216,19 @@
198
216
  }
199
217
 
200
218
  const gameTouch = ():void => {
201
- window.postMessage({ type: 'GameHovered' }, window.location.href);
219
+ window.postMessage({ type: 'GameHoveredMobile' }, window.location.href);
202
220
  }
203
221
 
204
222
  const gameTouchEnd = ():void => {
205
- window.postMessage({ type: 'GameBlur' }, window.location.href);
223
+ window.postMessage({ type: 'GameBlurMobile' }, window.location.href);
206
224
  }
207
225
 
208
226
  const gameHover = ():void => {
209
- window.postMessage({ type: 'GameHovered' }, window.location.href);
227
+ window.postMessage({ type: 'GameHoveredPc' }, window.location.href);
210
228
  }
211
229
 
212
230
  const gameBlur = ():void => {
213
- window.postMessage({ type: 'GameBlur' }, window.location.href);
231
+ window.postMessage({ type: 'GameBlurPc' }, window.location.href);
214
232
  }
215
233
 
216
234
  const setActiveLanguage = ():void => {
@@ -250,34 +268,12 @@
250
268
  }
251
269
  }
252
270
 
253
- const setClientStyling = ():void => {
254
- let sheet = document.createElement('style');
255
-
256
- sheet.innerHTML = clientstyling;
257
-
258
- setTimeout(() => { customStylingContainer.appendChild(sheet);});
259
- }
260
-
261
271
  const setFavorites = ():void => {
262
272
  if (favorites == 'true') {
263
273
  fav = true;
264
274
  }
265
275
  }
266
276
 
267
- const setClientStylingURL = ():void => {
268
- let url:URL = new URL(clientstylingurl);
269
-
270
- let cssFile:HTMLElement = document.createElement('style');
271
-
272
- fetch(url.href)
273
- .then((res:any) => res.text())
274
- .then((data:any) => {
275
- cssFile.innerHTML = data
276
-
277
- setTimeout(() => { customStylingContainer.appendChild(cssFile); });
278
- });
279
- }
280
-
281
277
  const liveLobbyMessageHandler = async (event) => {
282
278
  const { type, data: rawData } = event;
283
279
  let data;
@@ -541,6 +537,25 @@
541
537
  }
542
538
  }
543
539
 
540
+ const setClientStyling = ():void => {
541
+ let sheet = document.createElement('style');
542
+ sheet.innerHTML = clientstyling;
543
+ customStylingContainer.appendChild(sheet);
544
+ }
545
+
546
+ const setClientStylingURL = ():void => {
547
+ let url:URL = new URL(clientstylingurl);
548
+ let cssFile:HTMLElement = document.createElement('style');
549
+
550
+ fetch(url.href)
551
+ .then((res:any) => res.text())
552
+ .then((data:any) => {
553
+ cssFile.innerHTML = data
554
+
555
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
556
+ });
557
+ }
558
+
544
559
  onMount(() => {
545
560
  window.addEventListener('message', messageHandler, false);
546
561
 
@@ -557,9 +572,9 @@
557
572
  $: lang && setActiveLanguage();
558
573
  $: session && userid && endpoint && setSession();
559
574
  $: gamethumbnail && setOnLoad();
560
- $: clientstyling && setClientStyling();
575
+ $: clientstyling && customStylingContainer && setClientStyling();
576
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
561
577
  $: favorites && setFavorites();
562
- $: gamecellsize && clientstylingurl && setClientStylingURL();
563
578
  $: endpoint && livelobbyendpoint && setLiveLobbyData();
564
579
  $: livegamedata && updateComponent();
565
580
  $: roulletteref && roulleteresults && attachAnimations();