@everymatrix/casino-games-category-section 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/casino-games-category-section",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "dist/casino-games-category-section.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "ac0e71f6ea97bb7428ee75f5667c1408cbdc3146"
|
|
40
40
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { _, addNewMessages } from './i18n';
|
|
7
7
|
import type { CategoryData } from './CasinoGamesCategorySection.type';
|
|
8
8
|
import { GamesCategorySectionTranslations } from './translations';
|
|
9
|
+
import moment from 'moment';
|
|
9
10
|
|
|
10
11
|
import '@everymatrix/casino-game-thumbnail';
|
|
11
12
|
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
export let favorites:string = '';
|
|
21
22
|
export let clientstyling:string = '';
|
|
22
23
|
export let clientstylingurl:string = '';
|
|
23
|
-
export let
|
|
24
|
+
export let translationurl:string = '';
|
|
24
25
|
export let currency:string = '';
|
|
25
26
|
|
|
26
27
|
export let categoryid:string = '';
|
|
@@ -37,6 +38,9 @@
|
|
|
37
38
|
export let left = 0;
|
|
38
39
|
export let right = 0;
|
|
39
40
|
|
|
41
|
+
//Revert manually
|
|
42
|
+
// let livelobbyendpoint = `${endpoint}/lobby/tables`;
|
|
43
|
+
|
|
40
44
|
// CasinoPage loading state
|
|
41
45
|
let isLoading:boolean = false;
|
|
42
46
|
let hasErrors:boolean = false;
|
|
@@ -91,7 +95,7 @@
|
|
|
91
95
|
/* End Lazy Loading */
|
|
92
96
|
|
|
93
97
|
const setTranslationUrl = ():void => {
|
|
94
|
-
let url:string =
|
|
98
|
+
let url:string = translationurl;
|
|
95
99
|
|
|
96
100
|
fetch(url).then((res:any) => res.json())
|
|
97
101
|
.then((res) => {
|
|
@@ -224,7 +228,7 @@
|
|
|
224
228
|
})[0];
|
|
225
229
|
}
|
|
226
230
|
|
|
227
|
-
dataloaded = true
|
|
231
|
+
dataloaded = true;
|
|
228
232
|
hasErrors = false;
|
|
229
233
|
maxTotal = categoryData.games.total;
|
|
230
234
|
|
|
@@ -334,7 +338,7 @@
|
|
|
334
338
|
getData(e.data.categoryId, 0, e.data.visiblegames).then((res:any) => {
|
|
335
339
|
categoryData = res;
|
|
336
340
|
shownCategoryData = categoryData.games.items;
|
|
337
|
-
if(shownCategoryData) {
|
|
341
|
+
if (shownCategoryData) {
|
|
338
342
|
shownCategoryData.forEach((item:any) => {
|
|
339
343
|
item.isFavorite = checkFavorite(item.id);
|
|
340
344
|
});
|
|
@@ -473,6 +477,31 @@
|
|
|
473
477
|
return false;
|
|
474
478
|
}
|
|
475
479
|
|
|
480
|
+
const addGameTag = (tags:any[]):string => {
|
|
481
|
+
if(tags?.length === 0) return '';
|
|
482
|
+
|
|
483
|
+
let tagName:string;
|
|
484
|
+
let differenceOfTime = 99999999999;
|
|
485
|
+
let firstToExpire:number;
|
|
486
|
+
|
|
487
|
+
const currentDate = new Date(Date.now());
|
|
488
|
+
|
|
489
|
+
tags.forEach((tag, index)=> {
|
|
490
|
+
const startDateOfTag = new Date(tag.schedules[0].startTime);
|
|
491
|
+
const endDateOfTag = new Date(tag.schedules[0].endTime);
|
|
492
|
+
|
|
493
|
+
if (moment(endDateOfTag).diff(currentDate) < differenceOfTime) {
|
|
494
|
+
differenceOfTime = moment(endDateOfTag).diff(currentDate)
|
|
495
|
+
firstToExpire = index;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (moment(currentDate).isAfter(startDateOfTag) && moment(currentDate).isBefore(endDateOfTag)) {
|
|
499
|
+
tagName = tags[firstToExpire].name;
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
return tagName;
|
|
503
|
+
}
|
|
504
|
+
|
|
476
505
|
// @TODO categoryId type fix
|
|
477
506
|
const showCategory = (categoryId:any, categoryData:Object) => {
|
|
478
507
|
window.postMessage({ type: "CategoryChange", itemId: categoryId }, window.location.href);
|
|
@@ -534,7 +563,7 @@
|
|
|
534
563
|
|
|
535
564
|
$: dataloaded && thumbnailContainer && setupObserver();
|
|
536
565
|
$: lang && initialSetup();
|
|
537
|
-
$:
|
|
566
|
+
$: translationurl && setTranslationUrl();
|
|
538
567
|
$: clientstyling && customStylingContainer && setClientStyling();
|
|
539
568
|
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
540
569
|
|
|
@@ -585,7 +614,7 @@
|
|
|
585
614
|
gamename={gameprops.name}
|
|
586
615
|
gamevendor={gameprops.vendor.name}
|
|
587
616
|
gameisnew={gameprops.isNew}
|
|
588
|
-
|
|
617
|
+
gametag={gameprops.advancedTags?.length > 0 && addGameTag(gameprops.advancedTags)}
|
|
589
618
|
gamecellsize={gameprops.cellSize}
|
|
590
619
|
gameid={gameprops.id}
|
|
591
620
|
gamefunmode={gameprops.hasFunMode}
|
|
@@ -639,7 +668,7 @@
|
|
|
639
668
|
gamename={gameprops.name}
|
|
640
669
|
gamevendor={gameprops.vendor.name}
|
|
641
670
|
gameisnew={gameprops.isNew}
|
|
642
|
-
|
|
671
|
+
gametag={gameprops.advancedTags?.length > 0 && addGameTag(gameprops.advancedTags)}
|
|
643
672
|
gamecellsize={gameprops.cellSize}
|
|
644
673
|
gameid={gameprops.id}
|
|
645
674
|
gamefunmode={gameprops.hasFunMode}
|
|
@@ -691,7 +720,7 @@
|
|
|
691
720
|
gamename={gameprops.gameModel.name}
|
|
692
721
|
gamevendor={gameprops.gameModel.vendor.name}
|
|
693
722
|
gameisnew={gameprops.gameModel.isNew}
|
|
694
|
-
|
|
723
|
+
gametag={gameprops.gameModel.advancedTags?.length > 0 && addGameTag(gameprops.advancedTags)}
|
|
695
724
|
gamecellsize={gameprops.cellSize}
|
|
696
725
|
gameid={gameprops.gameModel.id}
|
|
697
726
|
gamefunmode={gameprops.gameModel.hasFunMode}
|
|
@@ -722,7 +751,7 @@
|
|
|
722
751
|
gamename={gameprops.gameModel.name}
|
|
723
752
|
gamevendor={gameprops.gameModel.vendor.name}
|
|
724
753
|
gameisnew={gameprops.gameModel.isNew}
|
|
725
|
-
|
|
754
|
+
gametag={gameprops.gameModel.advancedTags?.length > 0 && addGameTag(gameprops.advancedTags)}
|
|
726
755
|
gamecellsize={gameprops.cellSize}
|
|
727
756
|
gameid={gameprops.gameModel.id}
|
|
728
757
|
gamefunmode={gameprops.gameModel.hasFunMode}
|