@everymatrix/casino-games-category-section 1.6.0 → 1.7.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/casino-games-category-section",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
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": "c0b2bf42b27d9f10a77af4c5be6a2708be5435cf"
|
|
40
40
|
}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
import moment from 'moment';
|
|
10
10
|
|
|
11
11
|
import '@everymatrix/casino-game-thumbnail';
|
|
12
|
+
import '@everymatrix/casino-filter';
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
const MASONRY_CLASS_PREFIX = 'game-tile-';
|
|
14
16
|
|
|
@@ -32,6 +34,9 @@
|
|
|
32
34
|
export let integratedgameframedesktop:string = 'false';
|
|
33
35
|
export let integratedgameframemobile:string = 'false';
|
|
34
36
|
export let casinomygames:string = 'false';
|
|
37
|
+
export let addfilterselector:string = 'false';
|
|
38
|
+
export let addsortingselector:string = 'false';
|
|
39
|
+
export let filterbylogo:string = '';
|
|
35
40
|
|
|
36
41
|
export let once = true;
|
|
37
42
|
export let top = 0;
|
|
@@ -181,16 +186,16 @@
|
|
|
181
186
|
|
|
182
187
|
let categoryidparsed = '';
|
|
183
188
|
let url:any = '';
|
|
184
|
-
|
|
185
|
-
|
|
189
|
+
let vendorFilters = JSON.parse(localStorage.getItem('vendorFiltersByCategory'));
|
|
190
|
+
|
|
191
|
+
let tempEndpoint:string = endpoint.replace(/.$/, "2"); // @TODO remove after we migrate with all endpoints to v2 - hack for the endpoint since the filtering of categories functionality was developed only for the v2 api
|
|
192
|
+
if((categoryid.match(/\$/g) || []).length > 1) {
|
|
186
193
|
categoryidparsed = categoryid.split('$').slice(0, 2).join('$');
|
|
187
|
-
url = new URL(`${
|
|
194
|
+
url = new URL(`${tempEndpoint}/casino/groups/${datasource}/${categoryidparsed}/subGroups`);
|
|
188
195
|
} else {
|
|
189
|
-
url = new URL(`${
|
|
196
|
+
url = new URL(`${tempEndpoint}/casino/groups/${datasource}/${categoryid}`);
|
|
190
197
|
}
|
|
191
198
|
|
|
192
|
-
let vendorFilters = JSON.parse(sessionStorage.getItem('vendorFiltersByCategory'));
|
|
193
|
-
|
|
194
199
|
return new Promise((resolve, reject) => {
|
|
195
200
|
url.searchParams.delete("pagination");
|
|
196
201
|
url.searchParams.append("expand", "games(vendor)");
|
|
@@ -209,10 +214,10 @@
|
|
|
209
214
|
|
|
210
215
|
filteresPresent = true;
|
|
211
216
|
vendorFilters[categoryid].forEach(vendorId => {
|
|
212
|
-
queryParamVendorId = queryParamVendorId + (queryParamVendorId ? `,
|
|
217
|
+
queryParamVendorId = queryParamVendorId + (queryParamVendorId ? `,games(vendor(id=${vendorId}))` : `games(vendor(id=${vendorId}))`);
|
|
213
218
|
});
|
|
214
219
|
|
|
215
|
-
url.searchParams.append('filter', `
|
|
220
|
+
url.searchParams.append('filter', ((vendorFilters && vendorFilters[categoryid].length < 2) ? `$and` : `$or`) + `(${queryParamVendorId})`);
|
|
216
221
|
} else {
|
|
217
222
|
filteresPresent = false;
|
|
218
223
|
}
|
|
@@ -370,7 +375,7 @@
|
|
|
370
375
|
shownCategoryData = categoryData.games.items;
|
|
371
376
|
showLoadCategory = false;
|
|
372
377
|
// @TODO: replace this quick fix - when there are only a few category games, the view scrolls to the footer
|
|
373
|
-
if(shownCategoryData.length < 10) {
|
|
378
|
+
if(shownCategoryData.length < 10 && e.data.origin ==! 'filters') {
|
|
374
379
|
scrollTop = true;
|
|
375
380
|
setTimeout(() => {
|
|
376
381
|
window.postMessage({ type: 'WidgetTopReference', scrollTop }, window.location.href);
|
|
@@ -382,16 +387,17 @@
|
|
|
382
387
|
|
|
383
388
|
case 'FavoriteUpdate':
|
|
384
389
|
lobbyView = true;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
390
|
+
if(categoryData) {
|
|
391
|
+
shownCategoryData = categoryData.games.items;
|
|
392
|
+
shownCategoryData.forEach((item:any) => {
|
|
393
|
+
item.isFavorite = checkFavorite(item.id);
|
|
394
|
+
});
|
|
395
|
+
}
|
|
389
396
|
|
|
390
397
|
break;
|
|
391
398
|
|
|
392
399
|
// Start favorite category section
|
|
393
400
|
case 'UpdateCategoryFavoriteGames':
|
|
394
|
-
|
|
395
401
|
if (e.data.receivedFavoriteResults) {
|
|
396
402
|
favoriteGames = e.data.receivedFavoriteResults.items;
|
|
397
403
|
if(e.data.favStadalone) return;
|
|
@@ -478,10 +484,10 @@
|
|
|
478
484
|
}
|
|
479
485
|
|
|
480
486
|
const addGameTag = (tags:any[]):string => {
|
|
481
|
-
if(tags?.length === 0) return '';
|
|
487
|
+
if (tags?.length === 0) return '';
|
|
482
488
|
|
|
483
|
-
let tagName:string;
|
|
484
|
-
let differenceOfTime =
|
|
489
|
+
let tagName:string = '';
|
|
490
|
+
let differenceOfTime = 999999999999;
|
|
485
491
|
let firstToExpire:number;
|
|
486
492
|
|
|
487
493
|
const currentDate = new Date(Date.now());
|
|
@@ -662,18 +668,34 @@
|
|
|
662
668
|
<div class="CasinoGamesContainer" part="CasinoGamesContainer">
|
|
663
669
|
{#if casinomygames !== 'true'}
|
|
664
670
|
<div class="CasinoGamesHeader" part="CasinoGamesHeader">
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
671
|
+
<h3 class="CategoryName" part="CategoryName" bind:this={categoryName}>
|
|
672
|
+
{categoryData.name}
|
|
673
|
+
</h3>
|
|
674
|
+
{#if showLoadCategory}
|
|
675
|
+
<!-- svelte-ignore a11y-missing-attribute -->
|
|
676
|
+
<a class="CategoryNameLink" part="CategoryNameLink" on:click="{e => showCategory(categoryData.id, categoryData)}">
|
|
677
|
+
<span class="CategoryLoadMore" part="CategoryLoadMore">
|
|
678
|
+
{$_('gamesCategorySection.viewAll')} ({categoryData.games.total})
|
|
679
|
+
</span>
|
|
680
|
+
</a>
|
|
681
|
+
{:else}
|
|
682
|
+
<div class=" {(addfilterselector == 'true' && addsortingselector == 'true') ? 'CategoryFilterContainer' : ''}">
|
|
683
|
+
{#if addfilterselector == "true"}
|
|
684
|
+
<casino-filter
|
|
685
|
+
{clientstylingurl}
|
|
686
|
+
{clientstyling}
|
|
687
|
+
{endpoint}
|
|
688
|
+
{datasource}
|
|
689
|
+
{lang}
|
|
690
|
+
{categoryid}
|
|
691
|
+
{addfilterselector}
|
|
692
|
+
{addsortingselector}
|
|
693
|
+
{filterbylogo}>
|
|
694
|
+
</casino-filter>
|
|
695
|
+
{/if}
|
|
696
|
+
</div>
|
|
697
|
+
{/if}
|
|
698
|
+
</div>
|
|
677
699
|
{/if}
|
|
678
700
|
{#if isLoading}
|
|
679
701
|
<div class="lds-dual-ring" part="lds-dual-ring"></div>
|
|
@@ -681,7 +703,7 @@
|
|
|
681
703
|
{#if shownCategoryData.length !== 0}
|
|
682
704
|
<ul class="{(favoriteGamesData.items.length === 0 && showFavGamesCategory) ? '' : 'CasinoGamesGrid'} GamesListIncreasedGap" part="{(favoriteGamesData.items.length === 0 && showFavGamesCategory) ? '' : 'CasinoGamesGrid'} GamesListIncreasedGap" bind:this={container}>
|
|
683
705
|
{#each shownCategoryData as gameprops, index}
|
|
684
|
-
|
|
706
|
+
{#if intersecting || nativeLoading}
|
|
685
707
|
<casino-game-thumbnail
|
|
686
708
|
session={session}
|
|
687
709
|
userid={userid}
|
|
@@ -723,10 +745,10 @@
|
|
|
723
745
|
<div class="CasinoGamesContainer" part="CasinoGamesContainer">
|
|
724
746
|
{#if casinomygames !== 'true'}
|
|
725
747
|
<div class="CasinoGamesHeader" part="CasinoGamesHeader">
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
748
|
+
<h3 class="CategoryName" part="CategoryName" bind:this={categoryName}>
|
|
749
|
+
{$_('gamesCategorySection.favorites')}
|
|
750
|
+
<span class="CategoryFavName">({favoriteGamesData.items.length})</span>
|
|
751
|
+
</h3>
|
|
730
752
|
</div>
|
|
731
753
|
{/if}
|
|
732
754
|
|
|
@@ -741,7 +763,7 @@
|
|
|
741
763
|
{#if intersecting || nativeLoading}
|
|
742
764
|
{#if isMobile(userAgent)}
|
|
743
765
|
{#if (gameprops.gameModel.platform.includes("iPad") || gameprops.gameModel.platform.includes("iPhone") || gameprops.gameModel.platform.includes("Android"))}
|
|
744
|
-
|
|
766
|
+
<casino-game-thumbnail
|
|
745
767
|
class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
|
|
746
768
|
part="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
|
|
747
769
|
session={session}
|
|
@@ -752,7 +774,7 @@
|
|
|
752
774
|
gamename={gameprops.gameModel.name}
|
|
753
775
|
gamevendor={gameprops.gameModel.vendor.name}
|
|
754
776
|
gameisnew={gameprops.gameModel.isNew}
|
|
755
|
-
gametag={gameprops.gameModel.advancedTags?.length > 0 && addGameTag(gameprops.advancedTags)}
|
|
777
|
+
gametag={gameprops.gameModel.advancedTags?.length > 0 && addGameTag(gameprops.gameModel.advancedTags)}
|
|
756
778
|
gamecellsize={gameprops.cellSize}
|
|
757
779
|
gameid={gameprops.gameModel.id}
|
|
758
780
|
gamefunmode={gameprops.gameModel.hasFunMode}
|
|
@@ -783,7 +805,7 @@
|
|
|
783
805
|
gamename={gameprops.gameModel.name}
|
|
784
806
|
gamevendor={gameprops.gameModel.vendor.name}
|
|
785
807
|
gameisnew={gameprops.gameModel.isNew}
|
|
786
|
-
gametag={gameprops.gameModel.advancedTags?.length > 0 && addGameTag(gameprops.advancedTags)}
|
|
808
|
+
gametag={gameprops.gameModel.advancedTags?.length > 0 && addGameTag(gameprops.gameModel.advancedTags)}
|
|
787
809
|
gamecellsize={gameprops.cellSize}
|
|
788
810
|
gameid={gameprops.gameModel.id}
|
|
789
811
|
gamefunmode={gameprops.gameModel.hasFunMode}
|
|
@@ -984,6 +1006,12 @@
|
|
|
984
1006
|
}
|
|
985
1007
|
}
|
|
986
1008
|
|
|
1009
|
+
.CategoryFilterContainer {
|
|
1010
|
+
display: grid;
|
|
1011
|
+
grid-template-columns: 1fr 1fr;
|
|
1012
|
+
gap: 20px;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
987
1015
|
@media screen and (max-width: 385px) {
|
|
988
1016
|
.CasinoGamesGrid {
|
|
989
1017
|
display: grid;
|
|
@@ -1014,6 +1042,17 @@
|
|
|
1014
1042
|
}
|
|
1015
1043
|
}
|
|
1016
1044
|
|
|
1045
|
+
@media only screen and (max-width: 768px) {
|
|
1046
|
+
.CasinoGamesHeader {
|
|
1047
|
+
align-items: unset;
|
|
1048
|
+
flex-direction: column;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.CategoryName {
|
|
1052
|
+
margin-bottom: 20px;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1017
1056
|
@media screen and (min-width: 1100px) {
|
|
1018
1057
|
.CasinoGamesGrid {
|
|
1019
1058
|
grid-template-rows: repeat(auto-fill, 142px);
|