@everymatrix/casino-page 1.2.0 → 1.2.2

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-page",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "main": "dist/casino-page.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": "3800c3e93fdc948c5bc48101acce6cd81ce65706"
39
+ "gitHead": "02dbae5b4d167acdb57c72905b756343a318870a"
40
40
  }
@@ -29,7 +29,7 @@
29
29
  export let userid:string = ''; // Value for UserID;
30
30
  export let clientstyling:string = '';
31
31
  export let clientstylingurl:string = '';
32
- export let translationUrl:string = '';
32
+ export let translationurl:string = '';
33
33
 
34
34
  export let categorybackground:string = '';
35
35
  export let visiblegames:string;
@@ -127,6 +127,7 @@
127
127
  let categories:Array<CategoriesItems> = [];
128
128
  let shownCategories:Array<CategoriesItems> = [];
129
129
  let activeCategory:string;
130
+ let allCategoriesIds:string[] = [];
130
131
 
131
132
  let searchValue:string = '';
132
133
  let searchWrapper:HTMLElement;
@@ -161,7 +162,7 @@
161
162
  setupI18n({ withLocale: 'en', translations: {}});
162
163
 
163
164
  const setTranslationUrl = ():void => {
164
- let url:string = translationUrl;
165
+ let url:string = translationurl;
165
166
 
166
167
  fetch(url).then((res:any) => res.json())
167
168
  .then((res) => {
@@ -324,6 +325,13 @@
324
325
  }
325
326
  break;
326
327
 
328
+ case 'SubgroupsIds':
329
+ //Add subgroups ids fetched in the slider to the list of categories ids
330
+ if(!allCategoriesIds.some(categoryId => e.data.subGroupsIds.includes(categoryId))) {
331
+ allCategoriesIds.push(...e.data.subGroupsIds);
332
+ }
333
+ break;
334
+
327
335
  default:
328
336
  // Nothing to do here
329
337
  break;
@@ -819,6 +827,9 @@
819
827
 
820
828
  shownCategories = categoriesData.map(category => category.id);
821
829
 
830
+ //Create a list of all categories to check the activecategory against.
831
+ allCategoriesIds = data.items.map(category => category.id.toString());
832
+
822
833
  isLoading = false;
823
834
  }
824
835
  });
@@ -846,6 +857,11 @@
846
857
  const setActiveCategory = ():void => {
847
858
  activeCategory = activecategory;
848
859
  CategoryChangeHandler({ data: { itemId: activeCategory }});
860
+
861
+ //Check if the active category is found in the list of available categories. IF not send event to the state manager.
862
+ if (allCategoriesIds && !allCategoriesIds.includes(activeCategory) && activeCategory != '') {
863
+ window.postMessage({type: 'NonExistentCategory'}, window.location.href);
864
+ }
849
865
  }
850
866
 
851
867
  const setSession = () => {
@@ -931,7 +947,7 @@
931
947
  $: session && userid && endpoint && setSession();
932
948
  $: endpoint && datasource && lang && alternativesearch && initialSetup();
933
949
  $: lang && updateCategoriesLanguage();
934
- $: translationUrl && setTranslationUrl();
950
+ $: translationurl && setTranslationUrl();
935
951
  $: clientstyling && customStylingContainer && setClientStyling();
936
952
  $: clientstylingurl && customStylingContainer && setClientStylingURL();
937
953
  $: panicButton && addEventsToDisplayedElements();