@abcagency/hc-ui-components 1.4.8 → 1.4.11

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.
Files changed (70) hide show
  1. package/dist/components/HireControlMap.js +30 -5
  2. package/dist/components/HireControlMap.js.map +1 -1
  3. package/dist/components/containers/accordions/filter-item-container.js +2 -2
  4. package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
  5. package/dist/components/containers/accordions/map-accordion-item-container.js +6 -2
  6. package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
  7. package/dist/components/containers/filter/filter-item-container.js +10 -10
  8. package/dist/components/containers/filter/filter-item-container.js.map +1 -1
  9. package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
  10. package/dist/components/containers/maps/map-container.js +0 -1
  11. package/dist/components/containers/maps/map-container.js.map +1 -1
  12. package/dist/components/modules/buttons/button-group-apply.js +12 -12
  13. package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
  14. package/dist/components/modules/dialogs/apply-dialog.js +4 -4
  15. package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
  16. package/dist/components/modules/list/field-mapper-desktop.js +2 -2
  17. package/dist/components/modules/list/field-mapper-desktop.js.map +1 -1
  18. package/dist/components/modules/list/field-mapper-mobile.js +8 -8
  19. package/dist/components/modules/list/field-mapper-mobile.js.map +1 -1
  20. package/dist/components/modules/list/header-item.js +1 -1
  21. package/dist/components/modules/list/header-item.js.map +1 -1
  22. package/dist/contexts/mapListContext.js +17 -15
  23. package/dist/contexts/mapListContext.js.map +1 -1
  24. package/dist/contexts/placesContext.js +7 -6
  25. package/dist/contexts/placesContext.js.map +1 -1
  26. package/dist/services/googlePlacesNearbyService.js +2 -2
  27. package/dist/services/googlePlacesNearbyService.js.map +1 -1
  28. package/dist/services/listingAggregatorService.js +7 -8
  29. package/dist/services/listingAggregatorService.js.map +1 -1
  30. package/dist/services/listingEntityService.js +3 -2
  31. package/dist/services/listingEntityService.js.map +1 -1
  32. package/dist/services/listingService.js +1 -16
  33. package/dist/services/listingService.js.map +1 -1
  34. package/dist/types/contexts/mapListContext.d.ts +1 -1
  35. package/dist/types/services/googlePlacesNearbyService.d.ts +1 -1
  36. package/dist/types/services/listingAggregatorService.d.ts +2 -2
  37. package/dist/types/services/listingEntityService.d.ts +2 -3
  38. package/dist/types/types/GetListingParams.d.ts +1 -1
  39. package/dist/types/types/ListingEntity.d.ts +2 -1
  40. package/dist/types/types/ListingFields.d.ts +4 -2
  41. package/dist/types/types/Listings.d.ts +0 -1
  42. package/dist/types/util/mapUtil.d.ts +3 -3
  43. package/dist/util/filterUtil.js +5 -5
  44. package/dist/util/filterUtil.js.map +1 -1
  45. package/dist/util/mapUtil.js +33 -25
  46. package/dist/util/mapUtil.js.map +1 -1
  47. package/package.json +7 -2
  48. package/src/components/HireControlMap.js +21 -3
  49. package/src/components/containers/accordions/filter-item-container.js +2 -2
  50. package/src/components/containers/accordions/map-accordion-item-container.js +6 -2
  51. package/src/components/containers/filter/filter-item-container.js +10 -10
  52. package/src/components/containers/maps/info-window-content-container.js +1 -1
  53. package/src/components/containers/maps/map-container.js +2 -1
  54. package/src/components/modules/buttons/button-group-apply.js +8 -8
  55. package/src/components/modules/dialogs/apply-dialog.js +2 -2
  56. package/src/components/modules/list/field-mapper-desktop.jsx +2 -2
  57. package/src/components/modules/list/field-mapper-mobile.jsx +8 -8
  58. package/src/components/modules/list/header-item.js +1 -1
  59. package/src/contexts/mapListContext.tsx +37 -40
  60. package/src/contexts/placesContext.js +6 -6
  61. package/src/services/googlePlacesNearbyService.ts +3 -2
  62. package/src/services/listingAggregatorService.ts +12 -11
  63. package/src/services/listingEntityService.ts +3 -3
  64. package/src/services/listingService.ts +1 -11
  65. package/src/types/GetListingParams.ts +1 -1
  66. package/src/types/ListingEntity.ts +2 -1
  67. package/src/types/ListingFields.ts +4 -2
  68. package/src/types/Listings.ts +0 -1
  69. package/src/util/filterUtil.js +6 -6
  70. package/src/util/mapUtil.js +48 -41
@@ -5,18 +5,8 @@ import { Listing } from '../types/Listings';
5
5
 
6
6
  export const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {
7
7
  try {
8
- const query = new URLSearchParams();
8
+ const response = await api.get(`/joblistings/maplistings`);
9
9
 
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
- }
18
-
19
- const response = await api.get(`/Listings?${query.toString()}`);
20
10
  return response as Listing[];
21
11
  } catch (error) {
22
12
  console.error(error);
@@ -1,7 +1,7 @@
1
1
  export type GetListingsParams = {
2
2
  location?: string[];
3
3
  category?: string[];
4
- categoryClass?: string[];
4
+ subCategory?: string[];
5
5
  education?: string[];
6
6
  city?: string[];
7
7
  state?: string[];
@@ -1,9 +1,10 @@
1
1
  import { Address } from './Address';
2
2
 
3
3
  export type ListingEntity = {
4
- id: number;
4
+ id: string;
5
5
  listingId: number;
6
6
  latitude: number;
7
+ entityKey: string;
7
8
  longitude: number;
8
9
  entityDisplayName?: string;
9
10
  address?: Address;
@@ -2,9 +2,10 @@ export type ListingFields = {
2
2
  posted?: string;
3
3
  subTitle?: string;
4
4
  education?: string;
5
- position?: string;
5
+ title?: string;
6
6
  category?: string;
7
- categoryClass?: string;
7
+ subCategory?: string;
8
+ applyUrl?: string;
8
9
  shift?: string;
9
10
  custom1?: string;
10
11
  custom2?: string;
@@ -22,5 +23,6 @@ export type ListingFields = {
22
23
  useClientJobUrl?: boolean;
23
24
  dateCreated: Date;
24
25
  dateLastEdited?: Date;
26
+ entityKey: string;
25
27
  travelTime?: string;
26
28
  }
@@ -7,7 +7,6 @@ import { SimilarListing } from './SimilarListing';
7
7
  export type Listing = {
8
8
  id: number;
9
9
  fields?: ListingFields;
10
- entityId?: number;
11
10
  applyUrl?: string;
12
11
  applyOnline?: number;
13
12
  detailsUrl?: string;
@@ -82,17 +82,17 @@ export const generateFilterOptions = (
82
82
  if (fieldName === parentField && filterOptions?.filters) {
83
83
  return filterOptions.filters.find(filter => filter.id === fieldName);
84
84
  }
85
- if(fieldName == 'categoryClass'){
85
+ if(fieldName == 'category'){
86
86
  return {
87
87
  id: fieldName,
88
88
  title: siteConfig.fieldNames[fieldName],
89
89
  items: getFilterOptions(allListings, allListings, fieldName)
90
90
  };
91
91
  }
92
- if(fieldName == 'category' && selectedFilters.categoryClass){
93
- const categoryClassKeys = Object.keys(selectedFilters.categoryClass);
92
+ if(fieldName == 'subCategory' && selectedFilters.category){
93
+ const categoryKeys = Object.keys(selectedFilters.category);
94
94
  const filteredListings = allListings.filter(
95
- x => categoryClassKeys.includes(x.fields?.categoryClass)
95
+ x => categoryKeys.includes(x.fields?.category)
96
96
  );
97
97
  return {
98
98
  id: fieldName,
@@ -255,9 +255,9 @@ function searchResults(results, query) {
255
255
  'fields.posted',
256
256
  'fields.subtitle',
257
257
  'fields.education',
258
- 'fields.position',
258
+ 'fields.title',
259
259
  'fields.category',
260
- 'fields.categoryclass',
260
+ 'fields.subCategory',
261
261
  'fields.shift',
262
262
  'fields.citystate',
263
263
  'fields.city',
@@ -1,54 +1,55 @@
1
- export const getDistinctItemsByProximity = (items, listingEntitiesDetails) => {
1
+ export const getDistinctItemsByProximity = (items, listingEntitiesDetailsInput) => {
2
2
  const clusters = {};
3
3
 
4
- if (!listingEntitiesDetails) return [];
4
+ if (!listingEntitiesDetailsInput) return [];
5
+
6
+ const listingEntitiesDetails = Array.isArray(listingEntitiesDetailsInput)
7
+ ? listingEntitiesDetailsInput.reduce((acc, entity) => {
8
+ if (entity?.entityKey) acc[entity.entityKey] = entity;
9
+ return acc;
10
+ }, {})
11
+ : listingEntitiesDetailsInput;
5
12
 
6
13
  const closeItemPairs = findCloseItems(listingEntitiesDetails);
7
14
  if (closeItemPairs.length > 0) {
8
- listingEntitiesDetails = adjustItemPositions(
9
- listingEntitiesDetails,
10
- closeItemPairs
11
- );
15
+ const adjusted = adjustItemPositions(listingEntitiesDetails, closeItemPairs);
16
+ Object.assign(listingEntitiesDetails, adjusted);
12
17
  }
13
18
 
14
19
  items?.forEach(item => {
15
- if(item.entityId !== -1){
16
-
17
- const entityDetails = listingEntitiesDetails[item.entityId];
18
-
19
- if (!entityDetails) {
20
- console.error(`Details not found for entityId: ${item.entityId}`);
21
- return;
22
- }
20
+ const entityKey = item?.fields?.entityKey;
21
+ if (!entityKey || entityKey === '-1') return;
22
+ const entityDetails = listingEntitiesDetails[entityKey];
23
+ if (!entityDetails) {
24
+ console.error(`Details not found for entityKey: ${entityKey}`);
25
+ return;
26
+ }
23
27
 
24
- item.mapDetails = entityDetails;
28
+ item.mapDetails = entityDetails;
25
29
 
26
- if (!clusters[item.entityId]) {
27
- clusters[item.entityId] = {
28
- ...item.mapDetails,
29
- items: { [item.id]: item }
30
- };
31
- } else {
32
- clusters[item.entityId].items[item.id] = item;
33
- }}
30
+ if (!clusters[entityKey]) {
31
+ clusters[entityKey] = {
32
+ ...entityDetails,
33
+ items: { [item.id]: item }
34
+ };
35
+ } else {
36
+ clusters[entityKey].items[item.id] = item;
37
+ }
34
38
  });
35
39
 
36
40
  return Object.values(clusters);
37
41
  };
38
42
 
39
- export const findCloseItems = itemsObj => {
43
+ export const findCloseItems = entitiesByKey => {
40
44
  const closeItems = [];
41
- const items = Object.values(itemsObj); // Convert object to array for iteration
45
+ const items = Object.values(entitiesByKey); // Convert object to array
42
46
  const proximityThreshold = 0.0001;
43
47
 
44
48
  for (let i = 0; i < items.length; i++) {
45
49
  for (let j = i + 1; j < items.length; j++) {
46
50
  const distanceLat = Math.abs(items[i].latitude - items[j].latitude);
47
51
  const distanceLng = Math.abs(items[i].longitude - items[j].longitude);
48
- if (
49
- distanceLat < proximityThreshold &&
50
- distanceLng < proximityThreshold
51
- ) {
52
+ if (distanceLat < proximityThreshold && distanceLng < proximityThreshold) {
52
53
  closeItems.push({ item1: items[i], item2: items[j] });
53
54
  }
54
55
  }
@@ -57,14 +58,18 @@ export const findCloseItems = itemsObj => {
57
58
  return closeItems;
58
59
  };
59
60
 
60
- export const adjustItemPositions = (itemsObj, closeItemPairs) => {
61
+ export const adjustItemPositions = (entitiesByKey, closeItemPairs) => {
61
62
  const adjustmentValue = 0.0001;
62
- const adjustedItems = { ...itemsObj }; // Create a shallow copy of the object
63
+ const adjustedItems = { ...entitiesByKey };
63
64
 
64
65
  closeItemPairs.forEach(pair => {
65
- if (adjustedItems[pair.item1.id] && adjustedItems[pair.item2.id]) {
66
- adjustedItems[pair.item2.id].latitude += adjustmentValue;
67
- adjustedItems[pair.item2.id].longitude += adjustmentValue;
66
+ const key2 = pair.item2.entityKey;
67
+ if (adjustedItems[key2]) {
68
+ adjustedItems[key2] = {
69
+ ...adjustedItems[key2],
70
+ latitude: adjustedItems[key2].latitude + adjustmentValue,
71
+ longitude: adjustedItems[key2].longitude + adjustmentValue
72
+ };
68
73
  }
69
74
  });
70
75
 
@@ -74,13 +79,15 @@ export const adjustItemPositions = (itemsObj, closeItemPairs) => {
74
79
  export const clusterOptions = (clusterGridSize, fillColor) => {
75
80
  return {
76
81
  gridSize: clusterGridSize,
77
- maxZoom:15,
78
- styles:[{
79
- url: createSvgDataUri(fillColor),
80
- textColor:'white',
81
- height: 40,
82
- width: 40
83
- }]
82
+ maxZoom: 15,
83
+ styles: [
84
+ {
85
+ url: createSvgDataUri(fillColor),
86
+ textColor: 'white',
87
+ height: 40,
88
+ width: 40
89
+ }
90
+ ]
84
91
  };
85
92
  };
86
93