@everymatrix/casino-filter-page 1.6.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/casino-filter-page",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.7.1",
|
4
4
|
"main": "dist/casino-filter-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": "
|
39
|
+
"gitHead": "c0b2bf42b27d9f10a77af4c5be6a2708be5435cf"
|
40
40
|
}
|
@@ -21,7 +21,7 @@
|
|
21
21
|
let userAgent:String = window.navigator.userAgent;
|
22
22
|
let applyFilters:boolean = false;
|
23
23
|
let currentCategoryId:string = '';
|
24
|
-
let categoryVendorFiltersCollection:Array<string> = JSON.parse(
|
24
|
+
let categoryVendorFiltersCollection:Array<string> = JSON.parse(localStorage.getItem('vendorFiltersByCategory'));
|
25
25
|
let provisionalVendorArray:any = [];
|
26
26
|
let provisionalVendorObject:any = {};
|
27
27
|
let isLoading:boolean = false;
|
@@ -60,7 +60,7 @@
|
|
60
60
|
case 'ShowFilterModal':
|
61
61
|
// check if session holds any vendorFilters; if not, initialize the key with an empty value
|
62
62
|
if (currentCategoryId) {
|
63
|
-
categoryVendorFiltersCollection = JSON.parse(
|
63
|
+
categoryVendorFiltersCollection = JSON.parse(localStorage.getItem('vendorFiltersByCategory'));
|
64
64
|
|
65
65
|
if (categoryVendorFiltersCollection) {
|
66
66
|
provisionalVendorArray = categoryVendorFiltersCollection[currentCategoryId];
|
@@ -68,17 +68,17 @@
|
|
68
68
|
}
|
69
69
|
|
70
70
|
if (!provisionalVendorArray) {
|
71
|
-
let filters =
|
71
|
+
let filters = localStorage.getItem("vendorFiltersByCategory");
|
72
72
|
|
73
73
|
if (filters == null) {
|
74
|
-
|
74
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(provisionalVendorObject = {
|
75
75
|
[currentCategoryId]: provisionalVendorArray
|
76
76
|
}));
|
77
77
|
} else {
|
78
78
|
filters = JSON.parse(filters);
|
79
79
|
filters[currentCategoryId] = provisionalVendorArray;
|
80
80
|
|
81
|
-
|
81
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(filters))
|
82
82
|
}
|
83
83
|
}
|
84
84
|
|
@@ -173,7 +173,7 @@
|
|
173
173
|
resolve(response.items);
|
174
174
|
|
175
175
|
response.forEach((ven:any) => {
|
176
|
-
let vendors = JSON.parse(
|
176
|
+
let vendors = JSON.parse(localStorage.getItem('vendorFiltersByCategory'));
|
177
177
|
if (!vendors) {
|
178
178
|
vendors = {
|
179
179
|
currentCategoryId: []
|
@@ -234,9 +234,8 @@
|
|
234
234
|
vendorsArray.forEach((ven:any):void => {
|
235
235
|
ven.isFilterSelected = false;
|
236
236
|
});
|
237
|
-
|
238
|
-
let filters
|
239
|
-
|
237
|
+
|
238
|
+
let filters = localStorage.getItem("vendorFiltersByCategory");
|
240
239
|
window.postMessage({ type: "ClearFilters", vendorsArray}, window.location.href);
|
241
240
|
|
242
241
|
filtersMarkedForClearance = true;
|
@@ -250,24 +249,24 @@
|
|
250
249
|
filters = JSON.parse(filters);
|
251
250
|
filters[currentCategoryId] = provisionalVendorArray;
|
252
251
|
|
253
|
-
|
252
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(filters))
|
254
253
|
}
|
255
254
|
}
|
256
255
|
|
257
256
|
const applyVendorFilter = ():void => {
|
258
257
|
isLoading = true;
|
259
258
|
|
260
|
-
let filters =
|
259
|
+
let filters = localStorage.getItem("vendorFiltersByCategory");
|
261
260
|
|
262
261
|
if (filters == null) {
|
263
|
-
|
262
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(provisionalVendorObject = {
|
264
263
|
[currentCategoryId]: provisionalVendorArray
|
265
264
|
}));
|
266
265
|
} else {
|
267
266
|
filters = JSON.parse(filters);
|
268
267
|
filters[currentCategoryId] = provisionalVendorArray;
|
269
268
|
|
270
|
-
|
269
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(filters))
|
271
270
|
}
|
272
271
|
|
273
272
|
window.postMessage({ type: "ApplyFilters"}, window.location.href);
|