@abcagency/hc-ui-components 1.3.58 → 1.3.59
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/apis/hcApi.js +85 -85
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/clientToken.js.map +1 -1
- package/dist/components/containers/accordions/filter-container.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
- package/dist/components/containers/list/item-list-container.js +21 -21
- package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/buttons/commute-pill.js.map +1 -1
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/list/header.js.map +1 -1
- package/dist/components/modules/list/item-list.js +40 -40
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/constants/placeTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +83 -83
- package/dist/contexts/mapListContext.js +190 -190
- package/dist/contexts/trackEventContext.js.map +1 -1
- package/dist/hooks/useList.js.map +1 -1
- package/dist/services/configService.js +9 -9
- package/dist/services/googlePlacesNearbyService.js +32 -32
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +34 -34
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +9 -9
- package/dist/services/listingService.js +24 -24
- package/dist/services/recruiterService.js +10 -10
- package/dist/types/apis/hcApi.d.ts +5 -5
- package/dist/types/clientToken.d.ts +2 -2
- package/dist/types/components/containers/accordions/map-accordion-item-container.d.ts +12 -12
- package/dist/types/components/containers/jobListing/listing-details-container.d.ts +6 -6
- package/dist/types/components/containers/list/item-list-container.d.ts +9 -9
- package/dist/types/components/containers/list/list-item/list-item-container.d.ts +14 -14
- package/dist/types/components/modules/accordions/MapAccordionItem.d.ts +10 -10
- package/dist/types/components/modules/accordions/default.d.ts +19 -19
- package/dist/types/components/modules/buttons/button-group-apply.d.ts +24 -24
- package/dist/types/components/modules/buttons/commute-pill.d.ts +5 -5
- package/dist/types/components/modules/buttons/default.d.ts +48 -48
- package/dist/types/components/modules/buttons/pill-wrapper.d.ts +3 -3
- package/dist/types/components/modules/dialogs/apply-dialog.d.ts +8 -8
- package/dist/types/components/modules/filter/sort.d.ts +8 -8
- package/dist/types/components/modules/grid.d.ts +8 -8
- package/dist/types/components/modules/icon.d.ts +10 -10
- package/dist/types/components/modules/jobListing/listing-details.d.ts +18 -18
- package/dist/types/components/modules/list/field-mapper.d.ts +10 -10
- package/dist/types/components/modules/list/header-item.d.ts +11 -11
- package/dist/types/components/modules/list/header.d.ts +12 -12
- package/dist/types/components/modules/list/item-expand-card/index.d.ts +7 -7
- package/dist/types/components/modules/list/item-expand-card/recruiter-contact-nav.d.ts +17 -17
- package/dist/types/components/modules/list/item-expand-card/recruiter-details.d.ts +21 -21
- package/dist/types/components/modules/list/item-expand-card/recruiter-headshot.d.ts +8 -8
- package/dist/types/components/modules/list/item-list.d.ts +20 -20
- package/dist/types/components/modules/list/list-item/list-item.d.ts +3 -3
- package/dist/types/constants/eventTypes.d.ts +14 -14
- package/dist/types/contexts/mapContext.d.ts +29 -29
- package/dist/types/contexts/mapListContext.d.ts +61 -61
- package/dist/types/contexts/trackEventContext.d.ts +6 -6
- package/dist/types/enums/SectionType.d.ts +9 -9
- package/dist/types/hooks/useList.d.ts +13 -13
- package/dist/types/services/configService.d.ts +6 -6
- package/dist/types/services/googlePlacesNearbyService.d.ts +5 -5
- package/dist/types/services/listingAggregatorService.d.ts +12 -12
- package/dist/types/services/listingEntityService.d.ts +6 -6
- package/dist/types/services/listingService.d.ts +9 -9
- package/dist/types/services/recruiterService.d.ts +6 -6
- package/dist/types/types/Address.d.ts +7 -7
- package/dist/types/types/ContentSection.d.ts +8 -8
- package/dist/types/types/GetListingParams.d.ts +8 -8
- package/dist/types/types/LatLng.d.ts +4 -4
- package/dist/types/types/ListingEntity.d.ts +10 -10
- package/dist/types/types/ListingFields.d.ts +25 -25
- package/dist/types/types/Listings.d.ts +31 -31
- package/dist/types/types/Recruiter.d.ts +9 -9
- package/dist/types/types/SimilarListing.d.ts +24 -24
- package/dist/types/types/config/Colors.d.ts +8 -8
- package/dist/types/types/config/MapConfig.d.ts +30 -30
- package/dist/types/types/config/PointsOfInterestConfig.d.ts +13 -13
- package/dist/types/types/config/SearchConfig.d.ts +4 -4
- package/dist/types/util/filterUtil.d.ts +28 -28
- package/dist/types/util/loading.d.ts +3 -3
- package/dist/types/util/localStorageUtil.d.ts +3 -3
- package/dist/types/util/mapUtil.d.ts +16 -16
- package/dist/types/util/sortUtil.d.ts +1 -1
- package/dist/types/util/stringUtils.d.ts +1 -1
- package/dist/types/util/urlFilterUtil.d.ts +8 -8
- package/dist/util/filterUtil.js +2 -2
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js.map +1 -1
- package/dist/util/localStorageUtil.js +37 -37
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/sortUtil.js.map +1 -1
- package/dist/util/stringUtils.js.map +1 -1
- package/dist/util/urlFilterUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/apis/hcApi.ts +109 -109
- package/src/clientToken.js +9 -9
- package/src/components/containers/accordions/filter-container.js +48 -48
- package/src/components/containers/accordions/map-accordion-item-container.js +70 -70
- package/src/components/containers/jobListing/listing-details-container.js +40 -40
- package/src/components/containers/list/list-item/list-item-container.js +43 -43
- package/src/components/containers/maps/map-container.js +249 -249
- package/src/components/modules/accordions/MapAccordionItem.js +30 -30
- package/src/components/modules/accordions/default.js +171 -171
- package/src/components/modules/buttons/commute-pill.js +22 -22
- package/src/components/modules/buttons/default.js +194 -194
- package/src/components/modules/buttons/items-pill.js +35 -35
- package/src/components/modules/buttons/pill-wrapper.js +27 -27
- package/src/components/modules/buttons/show-all-button.js +19 -19
- package/src/components/modules/cards/default.js +167 -167
- package/src/components/modules/cards/filter.js +56 -56
- package/src/components/modules/filter/item.js +69 -69
- package/src/components/modules/filter/sort.js +83 -83
- package/src/components/modules/grid.js +54 -54
- package/src/components/modules/icon.js +33 -33
- package/src/components/modules/list/header.js +51 -51
- package/src/components/modules/list/item-expand-card/recruiter-contact-nav.js +50 -50
- package/src/components/modules/list/item-expand-card/recruiter-details.js +68 -68
- package/src/components/modules/list/item-expand-card/recruiter-headshot.js +22 -22
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/map.js +64 -64
- package/src/components/modules/maps/place-marker.js +41 -41
- package/src/components/modules/maps/tabs.js +81 -81
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/trackEventContext.js +14 -14
- package/src/enums/SectionType.ts +9 -9
- package/src/hooks/useList.js +89 -89
- package/src/index.js +3 -3
- package/src/services/googlePlacesNearbyService.ts +42 -42
- package/src/services/listingAggregatorService.ts +76 -76
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +22 -22
- package/src/util/filterUtil.js +311 -310
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.ts +34 -34
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/src/util/urlFilterUtil.js +85 -85
- package/dist/types/contexts/themeContext.d.ts +0 -11
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export const getStorageObject = <T>(item: string, defaultItem: T | null = null): T | null => {
|
|
2
|
-
if (typeof window === 'undefined') return defaultItem;
|
|
3
|
-
const storageItem = localStorage.getItem(item);
|
|
4
|
-
if (storageItem === null || storageItem === 'undefined') {
|
|
5
|
-
localStorage.removeItem(item);
|
|
6
|
-
return defaultItem;
|
|
7
|
-
}
|
|
8
|
-
try {
|
|
9
|
-
return JSON.parse(storageItem) ?? defaultItem;
|
|
10
|
-
} catch (error) {
|
|
11
|
-
console.error(`Error parsing JSON for ${item}:`, error);
|
|
12
|
-
return defaultItem;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const getStorageItem = (item: string, defaultItem: string | null = null): string | null => {
|
|
17
|
-
if (typeof window === 'undefined') return defaultItem;
|
|
18
|
-
const storageItem = localStorage.getItem(item);
|
|
19
|
-
if (storageItem === null || storageItem === 'undefined') {
|
|
20
|
-
localStorage.removeItem(item);
|
|
21
|
-
return defaultItem;
|
|
22
|
-
}
|
|
23
|
-
return storageItem ?? defaultItem;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const setStorageObject = (key: string, item: any): void => {
|
|
27
|
-
if (typeof window === 'undefined') return;
|
|
28
|
-
if (item === undefined) return;
|
|
29
|
-
try {
|
|
30
|
-
localStorage.setItem(key, JSON.stringify(item));
|
|
31
|
-
} catch (err) {
|
|
32
|
-
console.error(`Error setting item ${key} in localStorage:`, err);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
1
|
+
export const getStorageObject = <T>(item: string, defaultItem: T | null = null): T | null => {
|
|
2
|
+
if (typeof window === 'undefined') return defaultItem;
|
|
3
|
+
const storageItem = localStorage.getItem(item);
|
|
4
|
+
if (storageItem === null || storageItem === 'undefined') {
|
|
5
|
+
localStorage.removeItem(item);
|
|
6
|
+
return defaultItem;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(storageItem) ?? defaultItem;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(`Error parsing JSON for ${item}:`, error);
|
|
12
|
+
return defaultItem;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const getStorageItem = (item: string, defaultItem: string | null = null): string | null => {
|
|
17
|
+
if (typeof window === 'undefined') return defaultItem;
|
|
18
|
+
const storageItem = localStorage.getItem(item);
|
|
19
|
+
if (storageItem === null || storageItem === 'undefined') {
|
|
20
|
+
localStorage.removeItem(item);
|
|
21
|
+
return defaultItem;
|
|
22
|
+
}
|
|
23
|
+
return storageItem ?? defaultItem;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const setStorageObject = (key: string, item: any): void => {
|
|
27
|
+
if (typeof window === 'undefined') return;
|
|
28
|
+
if (item === undefined) return;
|
|
29
|
+
try {
|
|
30
|
+
localStorage.setItem(key, JSON.stringify(item));
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.error(`Error setting item ${key} in localStorage:`, err);
|
|
33
|
+
}
|
|
34
|
+
};
|
package/src/util/sortUtil.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export const dynamicSort = (items, fieldName, order = "asc") => {
|
|
2
|
-
if (!items || !items.length) {
|
|
3
|
-
return [];
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const inferType = value => {
|
|
7
|
-
if (!isNaN(Date.parse(value)) && isNaN(value)) {
|
|
8
|
-
return "date";
|
|
9
|
-
} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
|
10
|
-
return "number";
|
|
11
|
-
} else {
|
|
12
|
-
return "string";
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const dataType = inferType(items[0].fields[fieldName]);
|
|
17
|
-
|
|
18
|
-
return items.sort((a, b) => {
|
|
19
|
-
let valA = a.fields[fieldName];
|
|
20
|
-
let valB = b.fields[fieldName];
|
|
21
|
-
if (!valA || !valB) return;
|
|
22
|
-
let comparison = 0;
|
|
23
|
-
|
|
24
|
-
if (dataType === "string") {
|
|
25
|
-
comparison = valA.localeCompare(valB);
|
|
26
|
-
} else if (dataType === "number") {
|
|
27
|
-
comparison = valA - valB;
|
|
28
|
-
} else if (dataType === "date") {
|
|
29
|
-
comparison = new Date(valA) - new Date(valB);
|
|
30
|
-
}
|
|
31
|
-
return order === "desc" ? comparison * -1 : comparison;
|
|
32
|
-
});
|
|
1
|
+
export const dynamicSort = (items, fieldName, order = "asc") => {
|
|
2
|
+
if (!items || !items.length) {
|
|
3
|
+
return [];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const inferType = value => {
|
|
7
|
+
if (!isNaN(Date.parse(value)) && isNaN(value)) {
|
|
8
|
+
return "date";
|
|
9
|
+
} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
|
10
|
+
return "number";
|
|
11
|
+
} else {
|
|
12
|
+
return "string";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const dataType = inferType(items[0].fields[fieldName]);
|
|
17
|
+
|
|
18
|
+
return items.sort((a, b) => {
|
|
19
|
+
let valA = a.fields[fieldName];
|
|
20
|
+
let valB = b.fields[fieldName];
|
|
21
|
+
if (!valA || !valB) return;
|
|
22
|
+
let comparison = 0;
|
|
23
|
+
|
|
24
|
+
if (dataType === "string") {
|
|
25
|
+
comparison = valA.localeCompare(valB);
|
|
26
|
+
} else if (dataType === "number") {
|
|
27
|
+
comparison = valA - valB;
|
|
28
|
+
} else if (dataType === "date") {
|
|
29
|
+
comparison = new Date(valA) - new Date(valB);
|
|
30
|
+
}
|
|
31
|
+
return order === "desc" ? comparison * -1 : comparison;
|
|
32
|
+
});
|
|
33
33
|
};
|
package/src/util/stringUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const capitalize = str => {
|
|
2
|
-
if (str && typeof str === "string") {
|
|
3
|
-
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
4
|
-
}
|
|
5
|
-
return str;
|
|
6
|
-
};
|
|
1
|
+
export const capitalize = str => {
|
|
2
|
+
if (str && typeof str === "string") {
|
|
3
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
4
|
+
}
|
|
5
|
+
return str;
|
|
6
|
+
};
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
export const updateURLWithFilters = (filters, location, query, handleUrlUpdate) => {
|
|
2
|
-
const searchParams = new URLSearchParams(location.search);
|
|
3
|
-
|
|
4
|
-
const filteredSearchParams = new URLSearchParams();
|
|
5
|
-
for (const [key, value] of searchParams.entries()) {
|
|
6
|
-
if (!key.includes('.') && key !== 'query') {
|
|
7
|
-
filteredSearchParams.set(key, value);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (query) {
|
|
12
|
-
filteredSearchParams.set('query', query);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
for (const category in filters) {
|
|
16
|
-
for (const filter in filters[category]) {
|
|
17
|
-
const key = `${category}.${filter}`;
|
|
18
|
-
if (filters[category][filter]) {
|
|
19
|
-
filteredSearchParams.set(key, 'true');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
handleUrlUpdate(filteredSearchParams.toString());
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
function notifyParentOfUrlChange() {
|
|
28
|
-
setTimeout(() => {
|
|
29
|
-
var message = {
|
|
30
|
-
type: 'URL_CHANGE',
|
|
31
|
-
url: window.location.href
|
|
32
|
-
};
|
|
33
|
-
window.parent.postMessage(message, "*");
|
|
34
|
-
}, 500);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const parseQueryParams = search => {
|
|
38
|
-
const queryParams = {};
|
|
39
|
-
if (!search) return queryParams;
|
|
40
|
-
let queryString = search.split('?')[1];
|
|
41
|
-
if (!queryString) {
|
|
42
|
-
return queryParams;
|
|
43
|
-
}
|
|
44
|
-
queryString = queryString.replaceAll('+', ' ');
|
|
45
|
-
queryString.split('&').forEach(param => {
|
|
46
|
-
const [key, value] = param.split('=');
|
|
47
|
-
queryParams[decodeURIComponent(key)] = decodeURIComponent(value);
|
|
48
|
-
});
|
|
49
|
-
return queryParams;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const filtersFromURL = location => {
|
|
53
|
-
if (!location || !location.search) return;
|
|
54
|
-
const filters = {};
|
|
55
|
-
let queryParam = null;
|
|
56
|
-
const queryParams = parseQueryParams(location.search);
|
|
57
|
-
if (!queryParams) return;
|
|
58
|
-
Object.keys(queryParams).forEach(key => {
|
|
59
|
-
if (key && key.includes('.')) {
|
|
60
|
-
const [category, filter] = key.split('.');
|
|
61
|
-
if (!filters[category]) {
|
|
62
|
-
filters[category] = {};
|
|
63
|
-
}
|
|
64
|
-
filters[category][filter] = queryParams[key] === 'true';
|
|
65
|
-
} else if (key === 'query') {
|
|
66
|
-
queryParam = queryParams[key];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return { filters, query: queryParam };
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const hasFiltersInURL = location => {
|
|
74
|
-
if (!location || !location.search) return;
|
|
75
|
-
const queryParams = parseQueryParams(location.search);
|
|
76
|
-
if (!queryParams) return;
|
|
77
|
-
return Object.keys(queryParams).some(key => key.includes('.'));
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const hasQueryInUrl = location => {
|
|
81
|
-
if (!location || !location.search) return;
|
|
82
|
-
const queryParams = parseQueryParams(location.search);
|
|
83
|
-
if (!queryParams) return;
|
|
84
|
-
return Object.keys(queryParams).includes('query');
|
|
85
|
-
};
|
|
1
|
+
export const updateURLWithFilters = (filters, location, query, handleUrlUpdate) => {
|
|
2
|
+
const searchParams = new URLSearchParams(location.search);
|
|
3
|
+
|
|
4
|
+
const filteredSearchParams = new URLSearchParams();
|
|
5
|
+
for (const [key, value] of searchParams.entries()) {
|
|
6
|
+
if (!key.includes('.') && key !== 'query') {
|
|
7
|
+
filteredSearchParams.set(key, value);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (query) {
|
|
12
|
+
filteredSearchParams.set('query', query);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
for (const category in filters) {
|
|
16
|
+
for (const filter in filters[category]) {
|
|
17
|
+
const key = `${category}.${filter}`;
|
|
18
|
+
if (filters[category][filter]) {
|
|
19
|
+
filteredSearchParams.set(key, 'true');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
handleUrlUpdate(filteredSearchParams.toString());
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function notifyParentOfUrlChange() {
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
var message = {
|
|
30
|
+
type: 'URL_CHANGE',
|
|
31
|
+
url: window.location.href
|
|
32
|
+
};
|
|
33
|
+
window.parent.postMessage(message, "*");
|
|
34
|
+
}, 500);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const parseQueryParams = search => {
|
|
38
|
+
const queryParams = {};
|
|
39
|
+
if (!search) return queryParams;
|
|
40
|
+
let queryString = search.split('?')[1];
|
|
41
|
+
if (!queryString) {
|
|
42
|
+
return queryParams;
|
|
43
|
+
}
|
|
44
|
+
queryString = queryString.replaceAll('+', ' ');
|
|
45
|
+
queryString.split('&').forEach(param => {
|
|
46
|
+
const [key, value] = param.split('=');
|
|
47
|
+
queryParams[decodeURIComponent(key)] = decodeURIComponent(value);
|
|
48
|
+
});
|
|
49
|
+
return queryParams;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const filtersFromURL = location => {
|
|
53
|
+
if (!location || !location.search) return;
|
|
54
|
+
const filters = {};
|
|
55
|
+
let queryParam = null;
|
|
56
|
+
const queryParams = parseQueryParams(location.search);
|
|
57
|
+
if (!queryParams) return;
|
|
58
|
+
Object.keys(queryParams).forEach(key => {
|
|
59
|
+
if (key && key.includes('.')) {
|
|
60
|
+
const [category, filter] = key.split('.');
|
|
61
|
+
if (!filters[category]) {
|
|
62
|
+
filters[category] = {};
|
|
63
|
+
}
|
|
64
|
+
filters[category][filter] = queryParams[key] === 'true';
|
|
65
|
+
} else if (key === 'query') {
|
|
66
|
+
queryParam = queryParams[key];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return { filters, query: queryParam };
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const hasFiltersInURL = location => {
|
|
74
|
+
if (!location || !location.search) return;
|
|
75
|
+
const queryParams = parseQueryParams(location.search);
|
|
76
|
+
if (!queryParams) return;
|
|
77
|
+
return Object.keys(queryParams).some(key => key.includes('.'));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const hasQueryInUrl = location => {
|
|
81
|
+
if (!location || !location.search) return;
|
|
82
|
+
const queryParams = parseQueryParams(location.search);
|
|
83
|
+
if (!queryParams) return;
|
|
84
|
+
return Object.keys(queryParams).includes('query');
|
|
85
|
+
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function ThemeProvider({ children, uiText, uiAccent, primary, primaryDark, secondary, secondaryDark }: {
|
|
2
|
-
children: any;
|
|
3
|
-
uiText: any;
|
|
4
|
-
uiAccent: any;
|
|
5
|
-
primary: any;
|
|
6
|
-
primaryDark: any;
|
|
7
|
-
secondary: any;
|
|
8
|
-
secondaryDark: any;
|
|
9
|
-
}): React.JSX.Element;
|
|
10
|
-
export function useTheme(): any;
|
|
11
|
-
import React from "react";
|