@everymatrix/casino-slider 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-slider",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "main": "dist/casino-slider.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
  }
@@ -16,7 +16,7 @@
16
16
  export let clientstyling:string = '';
17
17
  export let clientstylingurl:string = '';
18
18
  export let identity:string = '';
19
- export let translationUrl:string = '';
19
+ export let translationurl:string = '';
20
20
  export let containermaxwidth:string = '';
21
21
  export let isprimarymenu:boolean = false;
22
22
  export let issecondarymenu:boolean = false;
@@ -27,7 +27,7 @@
27
27
  setupI18n({ withLocale: 'en', translations: {}});
28
28
 
29
29
  const setTranslationUrl = ():void => {
30
- let url:string = translationUrl;
30
+ let url:string = translationurl;
31
31
 
32
32
  fetch(url).then((res:any) => res.json())
33
33
  .then((res) => {
@@ -61,22 +61,24 @@
61
61
  // Clicking on the slider item will trigger this method and send a postmessage on window
62
62
  // @TODO itemId type fix
63
63
  let handleClick = (item:any, index:number, subItem:any, subIndex:number, itemType:string):void => {
64
+ // guard against triggering on main categories which have subcategories, as per business requirement
65
+ if (item.subGroups && subIndex === null) return;
66
+
64
67
  scrollHandler();
65
68
  activeIndex = index;
66
69
  activeIndex = activeIndex;
67
70
  prevIndex = activeIndex;
68
71
 
69
72
  if(itemType != 'secondary') {
70
- getSubGroups(item, index, 'navigation');
73
+ window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
71
74
  activeSubIndex = null;
72
75
  prevSubIndex = null;
73
76
  return;
74
77
  }
75
-
76
78
  activeSubIndex = subIndex;
77
79
  activeSubIndex = activeSubIndex;
78
80
  prevSubIndex = activeSubIndex;
79
- getSubGroups(subItem, subIndex, 'navigation');
81
+ window.postMessage({ type: actionevent, itemId: subItem.id, subIndex, subItem }, window.location.href);
80
82
  };
81
83
 
82
84
  let scrollLeft = ():void => {
@@ -140,6 +142,7 @@
140
142
  .then((res:any) => res.json())
141
143
  .then((data:any) => {
142
144
  subGroupsData = data;
145
+
143
146
  if(showsubgroups == 'false') {
144
147
  window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
145
148
  } else {
@@ -147,6 +150,9 @@
147
150
  window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
148
151
  }
149
152
  }
153
+
154
+ //Send subgroups ids
155
+ window.postMessage({type: 'SubgroupsIds', subGroupsIds: subGroupsData.items.map(subgroup => subgroup.id)});
150
156
 
151
157
  }).then(() => {
152
158
  if(carousel.querySelectorAll(".DropDown")) scrollHandler();
@@ -217,7 +223,7 @@
217
223
  })
218
224
 
219
225
  $: activeindex && setActiveIndex();
220
- $: translationUrl && setTranslationUrl();
226
+ $: translationurl && setTranslationUrl();
221
227
  $: clientstyling && customStylingContainer && setClientStyling();
222
228
  $: clientstylingurl && customStylingContainer && setClientStylingURL();
223
229
  $: lang && setActiveLanguage();