@everymatrix/casino-last-played-section 1.13.19 → 1.13.21
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.
|
@@ -1465,10 +1465,10 @@ let de=new IntersectionObserver((e=>{e.forEach((async e=>{let t=e.target.gameid,
|
|
|
1465
1465
|
// eslint-disable-line
|
|
1466
1466
|
e.isIntersecting?(1.2*r>X&&fe(k),n(34,se[t]=1,se)):n(34,se[t]=0,se)}))}));
|
|
1467
1467
|
// Start favored games section
|
|
1468
|
-
const he=(e,t,r
|
|
1469
|
-
return(k.match(/\$/g)||[]).length>1?(
|
|
1468
|
+
const he=(e,t,r)=>{n(20,z=!0);let i="",a="",o=JSON.parse(localStorage.getItem("vendorFiltersByCategory")),s=JSON.parse(localStorage.getItem("vendorSortingBy")),c=g.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
|
|
1469
|
+
return(k.match(/\$/g)||[]).length>1?(i=k.split("$").slice(0,2).join("$"),a=new URL(`${c}/casino/groups/${y}/${i}/subGroups`)):a=new URL(`${c}/casino/groups/${y}/${k}`),new Promise(((e,i)=>{if(a.searchParams.delete("pagination"),a.searchParams.append("expand","games(vendor)"),a.searchParams.append("fields","id,name,games"),a.searchParams.append("platform",wr(W)),a.searchParams.append("pagination",`games(offset=${t},limit=${r})`),a.searchParams.append("language",v),
|
|
1470
1470
|
// if vendor filters are active, get filtered games
|
|
1471
|
-
window.postMessage({type:"CategoryVendors",categoryid:k},window.location.href),
|
|
1471
|
+
window.postMessage({type:"CategoryVendors",categoryid:k},window.location.href),o&&o[k])if(o[k].length&&!1===V&&!1===ie){let e="";n(28,te=!0),o[k].forEach((t=>{e+=e?`,games(vendor(id=${t}))`:`games(vendor(id=${t}))`})),a.searchParams.append("filter",(o&&o[k].length<2?"$and":"$or")+`(${e})`)}else n(28,te=!1);s&&(s[k]?s[k]&&"All"!=s[k]&&("isNew"==s[k]||"advancedTags(name(hot))"==s[k]?(a.searchParams.append("sortedField",`games(${s[k]})`),a.searchParams.append("orderBy","DES")):a.searchParams.append("sortedField",`games(${s[k]})`)):ce&&"All"!=ce&&("advancedTags(name(hot))"==ce||"isNew"==ce?(a.searchParams.append("sortedField",`games(${ce})`),a.searchParams.append("orderBy","DES")):a.searchParams.append("sortedField",`games(${ce})`))),fetch(a).then((e=>e.json())).then((t=>{n(20,z=!1),(k.match(/\$/g)||[]).length>1&&(t=t.items.filter((e=>{if(e.id==k)return e}))[0]),n(50,f=!0),n(21,j=!1),l=t.games.total,e(t)}),(e=>{n(21,j=!0),console.error(e),i(e)}))}))},me=e=>{if(e.data)switch(e.data.type){case"MostPlayedData":"MOSTPLAYED"==k&&(n(25,J=!1),V=!1,n(24,K=!1),n(23,Z=e.data.mostPlayedGames),n(22,o={id:"MOSTPLAYED",name:"Most Played Games",games:{count:e.data.mostPlayedGames.length,total:e.data.mostPlayedGames.length,items:e.data.mostPlayedGames}})),n(20,z=!1);break;case"LastPlayedData":"LASTPLAYED"==k&&(n(25,J=!1),V=!1,n(24,K=!1),n(23,Z=e.data.lastPlayedGames),n(22,o={id:"LASTPLAYED",name:"Last Played Games",games:{count:e.data.lastPlayedGames.length,total:e.data.lastPlayedGames.length,items:e.data.lastPlayedGames}})),n(20,z=!1);break;case"CustomOperatorData":e.data.operatordetail;break;case"RecentSearchData":n(25,J=!0),n(26,q=!0),e.data.searchData.length>0?(n(23,Z=e.data.searchData),n(29,ne=!0),Z&&Z.forEach((e=>{e.isFavorite=pe(e.id)}))):(n(23,Z=[]),n(29,ne=!1));break;case"OutOfRecentSearches":n(25,J=!1),n(26,q=!1);break;case"SearchData":n(25,J=!0),n(26,q=!1),n(23,Z=e.data.searchData.items||[]),n(27,ee=!0),e.data.receivedFavoriteResults&&(d=e.data.receivedFavoriteResults.items),Z&&Z.forEach((e=>{e.isFavorite=pe(e.id)}));break;case`CategoryData_${k}`:n(25,J=!1),V=!0,n(24,K=!0),n(27,ee=!1),ae=!1,e.data.receivedFavoriteResults&&(d=e.data.receivedFavoriteResults.items),he(e.data.categoryId,0,e.data.visiblegames).then((e=>{n(22,o=e),n(23,Z=o.games.items),Z&&Z.forEach((e=>{e.isFavorite=pe(e.id)}))}));break;case"CategoryChange":X=20;break;case"ApplySorter":n(0,k=e.data.itemId),ce=e.data.sortBy,he(0,0,X).then((e=>{n(22,o=e),n(23,Z=o.games.items),n(24,K=!1)}));break;case"CategoryUpdate":n(25,J=!1),V=!1,n(27,ee=!1),ae=!0,n(0,k=e.data.itemId),"MOSTPLAYED"!==k&&n(24,K=!1),"true"!==I&&he(0,0,X).then((t=>{n(22,o=t),o.games.items.forEach((e=>{e.isFavorite=pe(e.id)})),n(23,Z=o.games.items),n(24,K=!1),
|
|
1472
1472
|
// @TODO: replace this quick fix - when there are only a few category games, the view scrolls to the footer
|
|
1473
1473
|
Z.length<10&&0==e.data.origin&&(Q=!0,setTimeout((()=>{window.postMessage({type:"WidgetTopReference",scrollTop:Q},window.location.href)}),500))}));break;case"FavoriteUpdate":V=!0,o&&(n(23,Z=o.games.items),Z.forEach((e=>{e.isFavorite=pe(e.id)})));break;case"UpdateCategoryFavoriteGames":if(e.data.receivedFavoriteResults){if(d=e.data.receivedFavoriteResults.items,e.data.favStadalone)return;ie?V||window.postMessage({type:"CategoryUpdate",itemId:k},window.location.href):window.postMessage({type:"FavoriteUpdate"},window.location.href)}break;case"ShowFavoriteSection":let t;V=!1,e.data&&(t=e.data.receivedFavoriteResults.items,t.length&&t.forEach((e=>{e.gameModel&&(e.gameModel.isFavorite=!!e.gameModel)})),n(36,ue.items=
|
|
1474
1474
|
// separate favorites array into mobile and desktop favorites
|