@abcagency/hc-ui-components 1.4.4 → 1.4.7
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 +1 -1
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js +1 -3
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +1 -0
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +4 -4
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/contexts/mapListContext.js +13 -17
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/services/listingAggregatorService.js +10 -11
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +2 -3
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +16 -10
- package/dist/services/listingService.js.map +1 -1
- package/dist/types/contexts/mapListContext.d.ts +1 -0
- package/dist/types/services/listingAggregatorService.d.ts +1 -1
- package/dist/types/services/listingEntityService.d.ts +3 -2
- package/dist/types/types/ListingEntity.d.ts +1 -2
- package/dist/types/types/ListingFields.d.ts +2 -4
- package/dist/types/types/Listings.d.ts +1 -0
- package/dist/types/util/mapUtil.d.ts +3 -3
- package/dist/util/mapUtil.js +25 -33
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/components/containers/accordions/map-accordion-item-container.js +1 -3
- package/src/components/containers/maps/info-window-content-container.js +1 -1
- package/src/components/containers/maps/map-container.js +1 -2
- package/src/components/modules/buttons/button-group-apply.js +4 -4
- package/src/contexts/mapListContext.tsx +17 -17
- package/src/services/listingAggregatorService.ts +12 -13
- package/src/services/listingEntityService.ts +3 -3
- package/src/services/listingService.ts +10 -11
- package/src/types/ListingEntity.ts +1 -2
- package/src/types/ListingFields.ts +2 -4
- package/src/types/Listings.ts +1 -0
- package/src/util/mapUtil.js +41 -48
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import api from '../apis/hcApi.js';
|
|
2
2
|
|
|
3
|
-
const getListingEntities = async (origin = '') => {
|
|
3
|
+
const getListingEntities = async (entityIds, origin = '') => {
|
|
4
4
|
try {
|
|
5
|
-
|
|
6
|
-
const response = await api.get(`/listingentities/MapEntities?origin=${origin}`);
|
|
5
|
+
const response = await api.post(`/ListingEntities?origin=${origin}`, entityIds);
|
|
7
6
|
return response;
|
|
8
7
|
}
|
|
9
8
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listingEntityService.js","sources":["../../src/services/listingEntityService.ts"],"sourcesContent":["import api from '~/apis/hcApi';\n\nexport const getListingEntities = async (origin = ''): Promise<
|
|
1
|
+
{"version":3,"file":"listingEntityService.js","sources":["../../src/services/listingEntityService.ts"],"sourcesContent":["import api from '~/apis/hcApi';\nimport { ListingEntity } from '~/types/ListingEntity';\n\nexport const getListingEntities = async (entityIds: number[], origin = ''): Promise<ListingEntity[]> => {\n\ttry {\n\t\tconst response = await api.post<ListingEntity[]>(`/ListingEntities?origin=${origin}`, entityIds);\n\t\treturn response;\n\t} catch (error) {\n\t\tconsole.error(\"Error fetching listing entities:\", error);\n\t\tthrow error;\n\t}\n};\n\nexport default {\n\tgetListingEntities\n};\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,GAAG,OAAO,SAAmB,EAAE,MAAM,GAAG,EAAE,KAA8B;IACtG,IAAI;AACH,QAAA,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,CAAkB,CAAA,wBAAA,EAA2B,MAAM,CAAA,CAAE,EAAE,SAAS,CAAC,CAAC;AACjG,QAAA,OAAO,QAAQ,CAAC;AAChB,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACf,QAAA,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;AACzD,QAAA,MAAM,KAAK,CAAC;AACZ,KAAA;AACF;;;;"}
|
|
@@ -2,16 +2,22 @@ import api from '../apis/hcApi.js';
|
|
|
2
2
|
|
|
3
3
|
const getListings = async (params) => {
|
|
4
4
|
try {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
const query = new URLSearchParams();
|
|
6
|
+
if (params) {
|
|
7
|
+
if (params.location)
|
|
8
|
+
params.location.forEach(loc => query.append('location', loc));
|
|
9
|
+
if (params.category)
|
|
10
|
+
params.category.forEach(cat => query.append('category', cat));
|
|
11
|
+
if (params.categoryClass)
|
|
12
|
+
params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));
|
|
13
|
+
if (params.education)
|
|
14
|
+
params.education.forEach(edu => query.append('education', edu));
|
|
15
|
+
if (params.city)
|
|
16
|
+
params.city.forEach(cty => query.append('city', cty));
|
|
17
|
+
if (params.state)
|
|
18
|
+
params.state.forEach(st => query.append('state', st));
|
|
19
|
+
}
|
|
20
|
+
const response = await api.get(`/Listings?${query.toString()}`);
|
|
15
21
|
return response;
|
|
16
22
|
}
|
|
17
23
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listingService.js","sources":["../../src/services/listingService.ts"],"sourcesContent":["// listingService.ts\nimport { GetListingsParams } from '~/types/GetListingParams';\nimport api from '../apis/hcApi';\nimport { Listing } from '../types/Listings';\n\nexport const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {\n\ttry {\n\t\
|
|
1
|
+
{"version":3,"file":"listingService.js","sources":["../../src/services/listingService.ts"],"sourcesContent":["// listingService.ts\nimport { GetListingsParams } from '~/types/GetListingParams';\nimport api from '../apis/hcApi';\nimport { Listing } from '../types/Listings';\n\nexport const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {\n\ttry {\n\t\tconst query = new URLSearchParams();\n\n\t\tif (params) {\n\t\t\tif (params.location) params.location.forEach(loc => query.append('location', loc));\n\t\t\tif (params.category) params.category.forEach(cat => query.append('category', cat));\n\t\t\tif (params.categoryClass) params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));\n\t\t\tif (params.education) params.education.forEach(edu => query.append('education', edu));\n\t\t\tif (params.city) params.city.forEach(cty => query.append('city', cty));\n\t\t\tif (params.state) params.state.forEach(st => query.append('state', st));\n\t\t}\n\n\t\tconst response = await api.get(`/Listings?${query.toString()}`);\n\t\treturn response as Listing[];\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tthrow error;\n\t}\n};\n\nexport const getListingDetails = async (listingId: string) => {\n\ttry {\n\t\tconst response = await api.get(`/ListingDetails/${listingId}`);\n\t\treturn response;\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tthrow error;\n\t}\n};\n\nexport default {\n\tgetListings,\n\tgetListingDetails\n};\n"],"names":[],"mappings":";;MAKa,WAAW,GAAG,OAAO,MAA0B,KAAwB;IACnF,IAAI;AACH,QAAA,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;AAEpC,QAAA,IAAI,MAAM,EAAE;YACX,IAAI,MAAM,CAAC,QAAQ;AAAE,gBAAA,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YACnF,IAAI,MAAM,CAAC,QAAQ;AAAE,gBAAA,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YACnF,IAAI,MAAM,CAAC,aAAa;AAAE,gBAAA,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC5G,IAAI,MAAM,CAAC,SAAS;AAAE,gBAAA,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;YACtF,IAAI,MAAM,CAAC,IAAI;AAAE,gBAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;YACvE,IAAI,MAAM,CAAC,KAAK;AAAE,gBAAA,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACxE,SAAA;AAED,QAAA,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,CAAa,UAAA,EAAA,KAAK,CAAC,QAAQ,EAAE,CAAA,CAAE,CAAC,CAAC;AAChE,QAAA,OAAO,QAAqB,CAAC;AAC7B,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACf,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,QAAA,MAAM,KAAK,CAAC;AACZ,KAAA;AACF;;;;"}
|
|
@@ -73,6 +73,7 @@ interface MapListProviderProps {
|
|
|
73
73
|
defaultFilters?: Record<string, any>;
|
|
74
74
|
containerStyle?: any;
|
|
75
75
|
localStorageKey: string;
|
|
76
|
+
getListingEntitiesCallback?: (entityIds: number[], origin?: string) => Promise<Record<number, ListingEntity>>;
|
|
76
77
|
ExpandListComponent?: React.ComponentType<{
|
|
77
78
|
listing: Listing;
|
|
78
79
|
}> | ((listing: Listing) => JSX.Element) | null;
|
|
@@ -2,7 +2,7 @@ import { Listing } from '~/types/Listings';
|
|
|
2
2
|
import { ListingEntity } from '~/types/ListingEntity';
|
|
3
3
|
interface FetchListingsResult {
|
|
4
4
|
listingsResult: Listing[];
|
|
5
|
-
|
|
5
|
+
fetchedEntities: Record<number, ListingEntity>;
|
|
6
6
|
distinctItems: any;
|
|
7
7
|
}
|
|
8
8
|
declare const fetchListings: (commuteLocation: any | null, entities: ListingEntity[] | null, listings: Listing[] | null) => Promise<FetchListingsResult>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ListingEntity } from '~/types/ListingEntity';
|
|
2
|
+
export declare const getListingEntities: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;
|
|
2
3
|
declare const _default: {
|
|
3
|
-
getListingEntities: (origin?: string) => Promise<
|
|
4
|
+
getListingEntities: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;
|
|
4
5
|
};
|
|
5
6
|
export default _default;
|
|
@@ -2,10 +2,9 @@ export type ListingFields = {
|
|
|
2
2
|
posted?: string;
|
|
3
3
|
subTitle?: string;
|
|
4
4
|
education?: string;
|
|
5
|
-
|
|
5
|
+
position?: string;
|
|
6
6
|
category?: string;
|
|
7
|
-
|
|
8
|
-
applyUrl?: string;
|
|
7
|
+
categoryClass?: string;
|
|
9
8
|
shift?: string;
|
|
10
9
|
custom1?: string;
|
|
11
10
|
custom2?: string;
|
|
@@ -23,6 +22,5 @@ export type ListingFields = {
|
|
|
23
22
|
useClientJobUrl?: boolean;
|
|
24
23
|
dateCreated: Date;
|
|
25
24
|
dateLastEdited?: Date;
|
|
26
|
-
entityKey: string;
|
|
27
25
|
travelTime?: string;
|
|
28
26
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function getDistinctItemsByProximity(items: any,
|
|
2
|
-
export function findCloseItems(
|
|
1
|
+
export function getDistinctItemsByProximity(items: any, listingEntitiesDetails: any): any[];
|
|
2
|
+
export function findCloseItems(itemsObj: any): {
|
|
3
3
|
item1: any;
|
|
4
4
|
item2: any;
|
|
5
5
|
}[];
|
|
6
|
-
export function adjustItemPositions(
|
|
6
|
+
export function adjustItemPositions(itemsObj: any, closeItemPairs: any): any;
|
|
7
7
|
export function clusterOptions(clusterGridSize: any, fillColor: any): {
|
|
8
8
|
gridSize: any;
|
|
9
9
|
maxZoom: number;
|
package/dist/util/mapUtil.js
CHANGED
|
@@ -1,40 +1,34 @@
|
|
|
1
1
|
import { objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
|
|
3
|
-
var getDistinctItemsByProximity = function getDistinctItemsByProximity(items,
|
|
3
|
+
var getDistinctItemsByProximity = function getDistinctItemsByProximity(items, listingEntitiesDetails) {
|
|
4
4
|
var clusters = {};
|
|
5
|
-
if (!
|
|
6
|
-
var listingEntitiesDetails = Array.isArray(listingEntitiesDetailsInput) ? listingEntitiesDetailsInput.reduce(function (acc, entity) {
|
|
7
|
-
if (entity !== null && entity !== void 0 && entity.entityKey) acc[entity.entityKey] = entity;
|
|
8
|
-
return acc;
|
|
9
|
-
}, {}) : listingEntitiesDetailsInput;
|
|
5
|
+
if (!listingEntitiesDetails) return [];
|
|
10
6
|
var closeItemPairs = findCloseItems(listingEntitiesDetails);
|
|
11
7
|
if (closeItemPairs.length > 0) {
|
|
12
|
-
|
|
13
|
-
Object.assign(listingEntitiesDetails, adjusted);
|
|
8
|
+
listingEntitiesDetails = adjustItemPositions(listingEntitiesDetails, closeItemPairs);
|
|
14
9
|
}
|
|
15
10
|
items === null || items === void 0 || items.forEach(function (item) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
clusters[entityKey].items[item.id] = item;
|
|
11
|
+
if (item.entityId !== -1) {
|
|
12
|
+
var entityDetails = listingEntitiesDetails[item.entityId];
|
|
13
|
+
if (!entityDetails) {
|
|
14
|
+
console.error("Details not found for entityId: ".concat(item.entityId));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
item.mapDetails = entityDetails;
|
|
18
|
+
if (!clusters[item.entityId]) {
|
|
19
|
+
clusters[item.entityId] = _objectSpread2(_objectSpread2({}, item.mapDetails), {}, {
|
|
20
|
+
items: _defineProperty({}, item.id, item)
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
clusters[item.entityId].items[item.id] = item;
|
|
24
|
+
}
|
|
31
25
|
}
|
|
32
26
|
});
|
|
33
27
|
return Object.values(clusters);
|
|
34
28
|
};
|
|
35
|
-
var findCloseItems = function findCloseItems(
|
|
29
|
+
var findCloseItems = function findCloseItems(itemsObj) {
|
|
36
30
|
var closeItems = [];
|
|
37
|
-
var items = Object.values(
|
|
31
|
+
var items = Object.values(itemsObj); // Convert object to array for iteration
|
|
38
32
|
var proximityThreshold = 0.0001;
|
|
39
33
|
for (var i = 0; i < items.length; i++) {
|
|
40
34
|
for (var j = i + 1; j < items.length; j++) {
|
|
@@ -50,16 +44,14 @@ var findCloseItems = function findCloseItems(entitiesByKey) {
|
|
|
50
44
|
}
|
|
51
45
|
return closeItems;
|
|
52
46
|
};
|
|
53
|
-
var adjustItemPositions = function adjustItemPositions(
|
|
47
|
+
var adjustItemPositions = function adjustItemPositions(itemsObj, closeItemPairs) {
|
|
54
48
|
var adjustmentValue = 0.0001;
|
|
55
|
-
var adjustedItems = _objectSpread2({},
|
|
49
|
+
var adjustedItems = _objectSpread2({}, itemsObj); // Create a shallow copy of the object
|
|
50
|
+
|
|
56
51
|
closeItemPairs.forEach(function (pair) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
adjustedItems[
|
|
60
|
-
latitude: adjustedItems[key2].latitude + adjustmentValue,
|
|
61
|
-
longitude: adjustedItems[key2].longitude + adjustmentValue
|
|
62
|
-
});
|
|
52
|
+
if (adjustedItems[pair.item1.id] && adjustedItems[pair.item2.id]) {
|
|
53
|
+
adjustedItems[pair.item2.id].latitude += adjustmentValue;
|
|
54
|
+
adjustedItems[pair.item2.id].longitude += adjustmentValue;
|
|
63
55
|
}
|
|
64
56
|
});
|
|
65
57
|
return adjustedItems;
|
package/dist/util/mapUtil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapUtil.js","sources":["../../src/util/mapUtil.js"],"sourcesContent":["export const getDistinctItemsByProximity = (items,
|
|
1
|
+
{"version":3,"file":"mapUtil.js","sources":["../../src/util/mapUtil.js"],"sourcesContent":["export const getDistinctItemsByProximity = (items, listingEntitiesDetails) => {\n\tconst clusters = {};\n\n\tif (!listingEntitiesDetails) return [];\n\n\tconst closeItemPairs = findCloseItems(listingEntitiesDetails);\n\tif (closeItemPairs.length > 0) {\n\t\tlistingEntitiesDetails = adjustItemPositions(\n\t\t\tlistingEntitiesDetails,\n\t\t\tcloseItemPairs\n\t\t);\n\t}\n\n\titems?.forEach(item => {\n\t\tif(item.entityId !== -1){\n\n\t\t\tconst entityDetails = listingEntitiesDetails[item.entityId];\n\n\t\t\tif (!entityDetails) {\n\t\t\t\tconsole.error(`Details not found for entityId: ${item.entityId}`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titem.mapDetails = entityDetails;\n\n\t\t\tif (!clusters[item.entityId]) {\n\t\t\t\tclusters[item.entityId] = {\n\t\t\t\t\t...item.mapDetails,\n\t\t\t\t\titems: { [item.id]: item }\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tclusters[item.entityId].items[item.id] = item;\n\t\t\t}}\n\t});\n\n\treturn Object.values(clusters);\n};\n\nexport const findCloseItems = itemsObj => {\n\tconst closeItems = [];\n\tconst items = Object.values(itemsObj); // Convert object to array for iteration\n\tconst proximityThreshold = 0.0001;\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\tfor (let j = i + 1; j < items.length; j++) {\n\t\t\tconst distanceLat = Math.abs(items[i].latitude - items[j].latitude);\n\t\t\tconst distanceLng = Math.abs(items[i].longitude - items[j].longitude);\n\t\t\tif (\n\t\t\t\tdistanceLat < proximityThreshold &&\n\t\t\t\tdistanceLng < proximityThreshold\n\t\t\t) {\n\t\t\t\tcloseItems.push({ item1: items[i], item2: items[j] });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn closeItems;\n};\n\nexport const adjustItemPositions = (itemsObj, closeItemPairs) => {\n\tconst adjustmentValue = 0.0001;\n\tconst adjustedItems = { ...itemsObj }; // Create a shallow copy of the object\n\n\tcloseItemPairs.forEach(pair => {\n\t\tif (adjustedItems[pair.item1.id] && adjustedItems[pair.item2.id]) {\n\t\t\tadjustedItems[pair.item2.id].latitude += adjustmentValue;\n\t\t\tadjustedItems[pair.item2.id].longitude += adjustmentValue;\n\t\t}\n\t});\n\n\treturn adjustedItems;\n};\n\nexport const clusterOptions = (clusterGridSize, fillColor) => {\n\treturn {\n\t\tgridSize: clusterGridSize,\n\t\tmaxZoom:15,\n\t\tstyles:[{\n\t\t\turl: createSvgDataUri(fillColor),\n\t\t\ttextColor:'white',\n\t\t\theight: 40,\n\t\t\twidth: 40\n\t\t}]\n\t};\n};\n\nfunction createSvgDataUri(fillColor) {\n\tconst svg = `<svg width=\"50\" height=\"50\" xmlns=\"http://www.w3.org/2000/svg\">\n\t <circle cx=\"25\" cy=\"25\" r=\"20\" fill=\"${fillColor}\" />\n\t</svg>`;\n\treturn `data:image/svg+xml;base64,${btoa(svg)}`;\n}\n"],"names":["getDistinctItemsByProximity","items","listingEntitiesDetails","clusters","closeItemPairs","findCloseItems","length","adjustItemPositions","forEach","item","entityId","entityDetails","console","error","concat","mapDetails","_objectSpread","_defineProperty","id","Object","values","itemsObj","closeItems","proximityThreshold","i","j","distanceLat","Math","abs","latitude","distanceLng","longitude","push","item1","item2","adjustmentValue","adjustedItems","pair","clusterOptions","clusterGridSize","fillColor","gridSize","maxZoom","styles","url","createSvgDataUri","textColor","height","width","svg","btoa"],"mappings":";;AAAO,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,KAAK,EAAEC,sBAAsB,EAAK;EAC7E,IAAMC,QAAQ,GAAG,EAAE,CAAA;AAEnB,EAAA,IAAI,CAACD,sBAAsB,EAAE,OAAO,EAAE,CAAA;AAEtC,EAAA,IAAME,cA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CAAC;;AAEtCjB,EAAAA,cAAc,CAACI,OAAO,CAAC,UAAA6B,IAAI,EAAI;AAC9B,IAAA,IAAID,aAAa,CAACC,IAAI,CAACJ,KAAK,CAACf,EAAE,CAAC,IAAIkB,aAAa,CAACC,IAAI,CAACH,KAAK,CAAChB,EAAE,CAAC,EAAE;MACjEkB,aAAa,CAACC,IAAI,CAACH,KAAK,CAAChB,EAAE,CAAC,CAACW,QAAQ,IAAIM,eAAe,CAAA;MACxDC,aAAa,CAACC,IAAI,CAACH,KAAK,CAAChB,EAAE,CAAC,CAACa,SAAS,IAAII,eAAe,CAAA;AAC1D,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOC,aAAa,CAAA;AACrB,EAAC;AAEM,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,eAAe,EAAEC,SAAS,EAAK;EAC7D,OAAO;AACNC,IAAAA,QAAQ,EAAEF,eAAe;AACzBG,IAAAA,OAAO,EAAC,EAAE;AACVC,IAAAA,MAAM,EAAC,CAAC;AACPC,MAAAA,GAAG,EAAEC,gBAAgB,CAACL,SAAS,CAAC;AAChCM,MAAAA,SAAS,EAAC,OAAO;AACjBC,MAAAA,MAAM,EAAE,EAAE;AACVC,MAAAA,KAAK,EAAE,EAAA;KACP,CAAA;GACD,CAAA;AACF,EAAC;AAED,SAASH,gBAAgBA,CAACL,SAAS,EAAE;AACpC,EAAA,IAAMS,GAAG,GAAA,yHAAA,CAAAnC,MAAA,CACgC0B,SAAS,EAC3C,iBAAA,CAAA,CAAA;AACP,EAAA,OAAA,4BAAA,CAAA1B,MAAA,CAAoCoC,IAAI,CAACD,GAAG,CAAC,CAAA,CAAA;AAC9C;;;;"}
|
package/package.json
CHANGED
|
@@ -25,9 +25,7 @@ const MapAccordionItemContainer = ({
|
|
|
25
25
|
selectItem(null, null, 9, { lat: 39.8283, lng: -98.5795 });
|
|
26
26
|
} else {
|
|
27
27
|
setStorageObject("selectedListItem", item);
|
|
28
|
-
|
|
29
|
-
//edited here for new structure of entity key
|
|
30
|
-
const location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.entityKey)) || null;
|
|
28
|
+
const location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.id)) || null;
|
|
31
29
|
selectItem(item, location, 12, {
|
|
32
30
|
lat: location?.latitude,
|
|
33
31
|
lng: location?.longitude
|
|
@@ -57,7 +57,7 @@ const InfoWindowContentContainer = ({
|
|
|
57
57
|
newFilters.state = { [items[0].fields.state]: true };
|
|
58
58
|
filters.push({ filterType: 'state', filterChecked: items[0].fields.state });
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
newFilters.entityName = { [items[0].fields.entityName]: true };
|
|
62
62
|
filters.push({ filterType: 'entityName', filterChecked: items[0].fields.entityName });
|
|
63
63
|
|
|
@@ -256,10 +256,9 @@ const MapContainer = ({ markerConfigs, infoWindowClasses, clusterGridSize = 60 }
|
|
|
256
256
|
if (!mapItems) {
|
|
257
257
|
return null;
|
|
258
258
|
}
|
|
259
|
-
|
|
260
259
|
const mapItemsKey = mapItems.map(item => item.id).join("-");
|
|
261
260
|
|
|
262
|
-
|
|
261
|
+
console.log(location);
|
|
263
262
|
return (
|
|
264
263
|
<Map
|
|
265
264
|
zoom={zoom}
|
|
@@ -78,9 +78,9 @@ const ButtonGroupApply = ({
|
|
|
78
78
|
</Button.Anchor>
|
|
79
79
|
) : null}
|
|
80
80
|
|
|
81
|
-
{item.
|
|
81
|
+
{item.applyOnline == 1 && item.applyUrl && !includeDialog &&
|
|
82
82
|
<Button.Anchor
|
|
83
|
-
href={item.
|
|
83
|
+
href={item.applyUrl}
|
|
84
84
|
variant={applyButtonVariant}
|
|
85
85
|
size={buttonSize}
|
|
86
86
|
className={"map-apply-now-button"}
|
|
@@ -91,8 +91,8 @@ const ButtonGroupApply = ({
|
|
|
91
91
|
{applyNowText}
|
|
92
92
|
</Button.Anchor>
|
|
93
93
|
}
|
|
94
|
-
{item.
|
|
95
|
-
<ApplyDialog applyUrl={item.
|
|
94
|
+
{item.applyOnline == 1 && item.applyUrl && includeDialog &&
|
|
95
|
+
<ApplyDialog applyUrl={item.applyUrl} internalApplyLink={internalApplyLink} companyName={companyName} item={item} trackEvent={trackEvent} eventTypes={eventTypes} isIframe={isIframe}>
|
|
96
96
|
<Button.Anchor
|
|
97
97
|
variant={applyButtonVariant}
|
|
98
98
|
size={buttonSize}
|
|
@@ -92,6 +92,7 @@ interface MapListProviderProps {
|
|
|
92
92
|
defaultFilters?: Record<string, any>;
|
|
93
93
|
containerStyle?: any;
|
|
94
94
|
localStorageKey: string;
|
|
95
|
+
getListingEntitiesCallback?: (entityIds: number[], origin?: string) => Promise<Record<number, ListingEntity>>;
|
|
95
96
|
ExpandListComponent?: React.ComponentType<{ listing: Listing }> | ((listing: Listing) => JSX.Element) | null;
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -115,6 +116,7 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
115
116
|
defaultFilters,
|
|
116
117
|
containerStyle,
|
|
117
118
|
ExpandListComponent,
|
|
119
|
+
getListingEntitiesCallback,
|
|
118
120
|
localStorageKey
|
|
119
121
|
}) => {
|
|
120
122
|
const firstLoadFilters = () =>{
|
|
@@ -161,31 +163,29 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
161
163
|
if (!commuteLocation) return;
|
|
162
164
|
|
|
163
165
|
async function fetchEntities() {
|
|
166
|
+
const distinctEntityIds = [
|
|
167
|
+
...new Set(allListings.map(listing => listing.entityId ?? -1))
|
|
168
|
+
];
|
|
164
169
|
try {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
const fetchedEntities = getListingEntitiesCallback !== null && getListingEntitiesCallback !== undefined ? await getListingEntitiesCallback(distinctEntityIds,
|
|
171
|
+
`${commuteLocation.lat}, ${commuteLocation.lng}`) : await getListingEntities(
|
|
172
|
+
distinctEntityIds,
|
|
168
173
|
`${commuteLocation.lat}, ${commuteLocation.lng}`
|
|
169
174
|
);
|
|
170
|
-
const entitiesByKey = fetchedEntities;
|
|
171
|
-
|
|
172
175
|
setListingEntities(fetchedEntities);
|
|
173
176
|
const newFilteredListings: Listing[] = [...filteredListings] ?? [];
|
|
174
|
-
console.log("Filtered lsitngs:", newFilteredListings);
|
|
175
|
-
console.log("all listings", allListings);
|
|
176
177
|
for (let i = 0; i < allListings.length; i++) {
|
|
177
178
|
const listing = newFilteredListings[i];
|
|
178
179
|
if (
|
|
179
180
|
listing &&
|
|
180
181
|
listing.fields &&
|
|
181
|
-
listing.
|
|
182
|
-
listing.
|
|
182
|
+
listing.entityId !== undefined &&
|
|
183
|
+
listing.entityId !== -1
|
|
183
184
|
) {
|
|
184
|
-
const
|
|
185
|
-
const travelTime =
|
|
186
|
-
|
|
185
|
+
const entityId = listing.entityId;
|
|
186
|
+
const travelTime = fetchedEntities[entityId]?.travelTime;
|
|
187
|
+
|
|
187
188
|
if (travelTime !== undefined && listing.fields) {
|
|
188
|
-
console.log("Setting travel time for listing", travelTime);
|
|
189
189
|
listing.fields.travelTime = travelTime;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
@@ -207,7 +207,7 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
207
207
|
try {
|
|
208
208
|
const {
|
|
209
209
|
listingsResult,
|
|
210
|
-
|
|
210
|
+
fetchedEntities,
|
|
211
211
|
distinctItems
|
|
212
212
|
} = await fetchListings(commuteLocation, entities, listings);
|
|
213
213
|
if (defaultFilters) {
|
|
@@ -224,8 +224,8 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
224
224
|
} else {
|
|
225
225
|
setAllListings(listingsResult);
|
|
226
226
|
}
|
|
227
|
-
setListingEntities(
|
|
228
|
-
setMapItems(
|
|
227
|
+
setListingEntities(fetchedEntities);
|
|
228
|
+
setMapItems(distinctItems);
|
|
229
229
|
} catch (error) {
|
|
230
230
|
console.log(error);
|
|
231
231
|
}
|
|
@@ -266,7 +266,7 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
266
266
|
updateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);
|
|
267
267
|
}
|
|
268
268
|
tempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');
|
|
269
|
-
setMapItems(
|
|
269
|
+
setMapItems(mapItems);
|
|
270
270
|
|
|
271
271
|
if (tempSelectedFilters) {
|
|
272
272
|
const keys = Object.keys(tempSelectedFilters);
|
|
@@ -6,7 +6,7 @@ import { ListingEntity } from '~/types/ListingEntity';
|
|
|
6
6
|
|
|
7
7
|
interface FetchListingsResult {
|
|
8
8
|
listingsResult: Listing[];
|
|
9
|
-
|
|
9
|
+
fetchedEntities: Record<number, ListingEntity>;
|
|
10
10
|
distinctItems: any; // Update this type based on the return type of getDistinctItemsByProximity
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -17,36 +17,35 @@ const fetchListings = async (
|
|
|
17
17
|
): Promise<FetchListingsResult> => {
|
|
18
18
|
try {
|
|
19
19
|
const listingsResult = listings && listings.length > 0 ? listings : await getListings();
|
|
20
|
+
const distinctEntityIds: number[] = [
|
|
21
|
+
...new Set(listingsResult.map(listing => listing.entityId))
|
|
22
|
+
] as number[];
|
|
20
23
|
|
|
21
24
|
const fetchedEntities = !commuteLocation
|
|
22
|
-
? entities && entities.length > 0 ? entities : await getListingEntities()
|
|
25
|
+
? entities && entities.length > 0 ? entities : await getListingEntities(distinctEntityIds)
|
|
23
26
|
: await getListingEntities(
|
|
27
|
+
distinctEntityIds,
|
|
24
28
|
`${commuteLocation.lat}, ${commuteLocation.lng}`
|
|
25
29
|
);
|
|
26
|
-
|
|
27
|
-
//possible quick workaround fix, need to implement clearer code
|
|
28
|
-
|
|
29
|
-
const entitiesByKey = fetchedEntities;
|
|
30
30
|
for (let i = 0; i < listingsResult.length; i++) {
|
|
31
31
|
const listing = listingsResult[i];
|
|
32
|
-
if (listing.
|
|
33
|
-
const entity =
|
|
34
|
-
console.log("Entity for listing with travel time", listing.fields.entityKey, entity);
|
|
32
|
+
if (listing.entityId && listing.entityId !== -1 && listing.fields) {
|
|
33
|
+
const entity = fetchedEntities[listing.entityId];
|
|
35
34
|
if (entity) {
|
|
36
35
|
listing.fields.travelTime = entity.travelTime;
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
}
|
|
39
|
+
|
|
40
40
|
const distinctItems = getDistinctItemsByProximity(
|
|
41
41
|
listingsResult,
|
|
42
|
-
|
|
42
|
+
fetchedEntities
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
46
|
listingsResult,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
distinctItems: distinctItems
|
|
47
|
+
fetchedEntities,
|
|
48
|
+
distinctItems
|
|
50
49
|
};
|
|
51
50
|
} catch (error) {
|
|
52
51
|
console.error("Error fetching listings:", error);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import api from '~/apis/hcApi';
|
|
2
|
+
import { ListingEntity } from '~/types/ListingEntity';
|
|
2
3
|
|
|
3
|
-
export const getListingEntities = async (origin = ''): Promise<
|
|
4
|
+
export const getListingEntities = async (entityIds: number[], origin = ''): Promise<ListingEntity[]> => {
|
|
4
5
|
try {
|
|
5
|
-
|
|
6
|
-
const response = await api.get<any>(`/listingentities/MapEntities?origin=${origin}`);
|
|
6
|
+
const response = await api.post<ListingEntity[]>(`/ListingEntities?origin=${origin}`, entityIds);
|
|
7
7
|
return response;
|
|
8
8
|
} catch (error) {
|
|
9
9
|
console.error("Error fetching listing entities:", error);
|
|
@@ -5,19 +5,18 @@ import { Listing } from '../types/Listings';
|
|
|
5
5
|
|
|
6
6
|
export const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {
|
|
7
7
|
try {
|
|
8
|
-
|
|
8
|
+
const query = new URLSearchParams();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const response = await api.get(`/joblistings/maplistings`);
|
|
10
|
+
if (params) {
|
|
11
|
+
if (params.location) params.location.forEach(loc => query.append('location', loc));
|
|
12
|
+
if (params.category) params.category.forEach(cat => query.append('category', cat));
|
|
13
|
+
if (params.categoryClass) params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));
|
|
14
|
+
if (params.education) params.education.forEach(edu => query.append('education', edu));
|
|
15
|
+
if (params.city) params.city.forEach(cty => query.append('city', cty));
|
|
16
|
+
if (params.state) params.state.forEach(st => query.append('state', st));
|
|
17
|
+
}
|
|
20
18
|
|
|
19
|
+
const response = await api.get(`/Listings?${query.toString()}`);
|
|
21
20
|
return response as Listing[];
|
|
22
21
|
} catch (error) {
|
|
23
22
|
console.error(error);
|
|
@@ -2,10 +2,9 @@ export type ListingFields = {
|
|
|
2
2
|
posted?: string;
|
|
3
3
|
subTitle?: string;
|
|
4
4
|
education?: string;
|
|
5
|
-
|
|
5
|
+
position?: string;
|
|
6
6
|
category?: string;
|
|
7
|
-
|
|
8
|
-
applyUrl?: string;
|
|
7
|
+
categoryClass?: string;
|
|
9
8
|
shift?: string;
|
|
10
9
|
custom1?: string;
|
|
11
10
|
custom2?: string;
|
|
@@ -23,6 +22,5 @@ export type ListingFields = {
|
|
|
23
22
|
useClientJobUrl?: boolean;
|
|
24
23
|
dateCreated: Date;
|
|
25
24
|
dateLastEdited?: Date;
|
|
26
|
-
entityKey: string;
|
|
27
25
|
travelTime?: string;
|
|
28
26
|
}
|