@everymatrix/casino-filter 1.17.2 → 1.17.3
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/dist/casino-filter.js
CHANGED
|
@@ -671,7 +671,7 @@ return e[10]?Fn:/*isLoading*/e[9]?void 0:Cn}let i=n(t),o=i&&i(t);return{c(){r=p(
|
|
|
671
671
|
// end custom styling area
|
|
672
672
|
T[d]&&(T={[d]:[]});const C=()=>{r(4,g=!g),window.postMessage({type:"FilterOpened"},window.location.href)},F=e=>{let t=localStorage.getItem("vendorFiltersByCategory");e.isFilterSelected=!e.isFilterSelected,_.length&&0!=_.filter((t=>t.name===e.name)).length?r(6,_=_.filter((t=>t.name!==e.name))):_.push(e),null==t?localStorage.setItem("vendorFiltersByCategory",JSON.stringify(T={[d]:_.map((e=>e.id))})):(t=JSON.parse(t),t[d]=_.map((e=>e.id)),localStorage.setItem("vendorFiltersByCategory",JSON.stringify(t))),window.postMessage({type:"ApplyFilters",origin:"filters"},window.location.href),O()},O=()=>{
|
|
673
673
|
// update filters value
|
|
674
|
-
r(7,S=_.length===E.length||0==_.length),r(8,B=_.length)},L=()=>{const e=new URL(`${a}/casino/vendors`);r(4,g=!1),e.searchParams.append("fields","id,name,logo,subVendors,games"),e.searchParams.append("language",u),e.searchParams.append("datasource",l),e.searchParams.append("platform",(e=>e.toLowerCase().match(/android/i)?"Android":e.toLowerCase().match(/iphone/i)?"iPhone":e.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC")(v)),(d.match(/\$/g)||[]).length>1?(e.searchParams.append("filter",`games(subGroups=${d})`),e.searchParams.append("subVendors",`games(subGroups=${d})`)):e.searchParams.append("filter",`games(groups=${d})`),(e=>{r(9,H=!0),new Promise(((t,n)=>{fetch(e).then((e=>e.json())).then((e=>{e=e.items,t(e.items),r(6,_=[]);let n=JSON.parse(localStorage.getItem("vendorFiltersByCategory"));e.forEach((e=>{var t;n||(n={currentCategoryId:[]}),(null===(t=n[d])||void 0===t?void 0:t.indexOf(e.id))>=0?(e.isFilterSelected=!0,_.push(e)):e.isFilterSelected=!1})),r(5,E=e),
|
|
674
|
+
r(7,S=_.length===E.length||0==_.length),r(8,B=_.length)},L=()=>{const e=new URL(`${a}/v1/casino/vendors`);r(4,g=!1),e.searchParams.append("fields","id,name,logo,subVendors,games"),e.searchParams.append("language",u),e.searchParams.append("datasource",l),e.searchParams.append("platform",(e=>e.toLowerCase().match(/android/i)?"Android":e.toLowerCase().match(/iphone/i)?"iPhone":e.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC")(v)),(d.match(/\$/g)||[]).length>1?(e.searchParams.append("filter",`games(subGroups=${d})`),e.searchParams.append("subVendors",`games(subGroups=${d})`)):e.searchParams.append("filter",`games(groups=${d})`),(e=>{r(9,H=!0),new Promise(((t,n)=>{fetch(e).then((e=>e.json())).then((e=>{e=e.items,t(e.items),r(6,_=[]);let n=JSON.parse(localStorage.getItem("vendorFiltersByCategory"));e.forEach((e=>{var t;n||(n={currentCategoryId:[]}),(null===(t=n[d])||void 0===t?void 0:t.indexOf(e.id))>=0?(e.isFilterSelected=!0,_.push(e)):e.isFilterSelected=!1})),r(5,E=e),
|
|
675
675
|
// needed to force the update of the filters value
|
|
676
676
|
O()})).catch((e=>{console.error(e),r(10,P=!0),n(e)})).finally((()=>{r(9,H=!1)}))}))})(e)},I=()=>{r(6,_=[]),localStorage.setItem("vendorFiltersByCategory",JSON.stringify(T={[d]:_.map((e=>e.id))})),E.forEach((e=>e.isFilterSelected=!1)),
|
|
677
677
|
// this reassignation of the pointer value is required in order to have Svelte trigger a re-render
|