@everymatrix/casino-games-category-section 0.0.392 → 0.0.394

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": "0.0.392",
3
+ "version": "0.0.394",
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": "218aa76aa4ef72b20457a0113b4b3e3f58b2194e"
39
+ "gitHead": "74359bffcfcd357bb93adb3f4cbcd7badbc96fae"
40
40
  }
@@ -163,13 +163,20 @@
163
163
 
164
164
  // @TODO categoryId type
165
165
  const getData = (categoryId:any, offset:number, limit:number, filterArray:Array<Object> = []) => {
166
- let url:any = new URL(`${endpoint}/casino/groups/${datasource}/${categoryid}`);
166
+ let categoryidparsed = '';
167
+ let url:any = '';
168
+
169
+ if((categoryid.match(/\$/g) || []).length > 1) {
170
+ categoryidparsed = categoryid.split('$').slice(0, 2).join('$');
171
+ url = new URL(`${endpoint}/casino/groups/${datasource}/${categoryidparsed}/subGroups`);
172
+ } else {
173
+ url = new URL(`${endpoint}/casino/groups/${datasource}/${categoryid}`);
174
+ }
167
175
 
168
176
  let vendorFilters = JSON.parse(sessionStorage.getItem('vendorFiltersByCategory'));
169
177
 
170
178
  return new Promise((resolve, reject) => {
171
179
  url.searchParams.delete("pagination");
172
-
173
180
  url.searchParams.append("expand", "games(vendor)");
174
181
  url.searchParams.append("fields", "id,name,games");
175
182
  url.searchParams.append("platform", getDevice(userAgent));
@@ -199,6 +206,13 @@
199
206
  fetch(url)
200
207
  .then((res:any) => res.json())
201
208
  .then((categoryData:any) => {
209
+
210
+ if((categoryid.match(/\$/g) || []).length > 1) {
211
+ categoryData = categoryData.items.filter(subcategory => {
212
+ if(subcategory.id == categoryid) return subcategory;
213
+ })[0];
214
+ }
215
+
202
216
  dataloaded = true
203
217
  hasErrors = false;
204
218
  maxTotal = categoryData.games.total;
@@ -567,7 +581,7 @@
567
581
  <div class="CasinoGamesContainer" part="CasinoGamesContainer">
568
582
  <div class="CasinoGamesHeader" part="CasinoGamesHeader">
569
583
  <h3 class="CategoryName" part="CategoryName" bind:this={categoryName}>
570
- {categoryData.name}
584
+ {categoryData.name}
571
585
  </h3>
572
586
 
573
587
  {#if showLoadCategory}