@abcagency/hc-ui-components 1.3.17 → 1.3.19

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 (196) hide show
  1. package/dist/apis/hcApi.js +85 -183
  2. package/dist/apis/hcApi.js.map +1 -1
  3. package/dist/components/HireControlMap.js +10 -5
  4. package/dist/components/HireControlMap.js.map +1 -1
  5. package/dist/components/modules/accordions/MapAccordionItem.js +10 -67
  6. package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
  7. package/dist/components/modules/filter/index.js.map +1 -1
  8. package/dist/components/modules/filter/radio-item.js +1 -2
  9. package/dist/components/modules/filter/radio-item.js.map +1 -1
  10. package/dist/components/modules/filter/search.js +4 -4
  11. package/dist/components/modules/filter/search.js.map +1 -1
  12. package/dist/components/modules/jobListing/listing-details-container.js +45 -0
  13. package/dist/components/modules/jobListing/listing-details-container.js.map +1 -0
  14. package/dist/components/modules/jobListing/listing-details.js +24 -24
  15. package/dist/components/modules/jobListing/listing-details.js.map +1 -1
  16. package/dist/components/modules/{maps/list → list}/field-mapper.js +8 -7
  17. package/dist/components/modules/list/field-mapper.js.map +1 -0
  18. package/dist/components/modules/{maps/list → list}/header-item.js +2 -2
  19. package/dist/components/modules/list/header-item.js.map +1 -0
  20. package/dist/components/modules/{maps/list → list}/header.js +6 -4
  21. package/dist/components/modules/list/header.js.map +1 -0
  22. package/dist/components/modules/list/index.js +36 -0
  23. package/dist/components/modules/list/index.js.map +1 -0
  24. package/dist/components/modules/{maps/list → list}/item-expand-card/index.js +3 -1
  25. package/dist/components/modules/list/item-expand-card/index.js.map +1 -0
  26. package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-contact-nav.js +2 -2
  27. package/dist/components/modules/list/item-expand-card/recruiter-contact-nav.js.map +1 -0
  28. package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-details.js +1 -1
  29. package/dist/components/modules/list/item-expand-card/recruiter-details.js.map +1 -0
  30. package/dist/components/modules/list/item-expand-card/recruiter-headshot.js.map +1 -0
  31. package/dist/components/modules/list/item-list.js +28 -0
  32. package/dist/components/modules/list/item-list.js.map +1 -0
  33. package/dist/components/modules/list/list-item/index.js +75 -0
  34. package/dist/components/modules/list/list-item/index.js.map +1 -0
  35. package/dist/components/modules/list/list-item/list-item-container.js +47 -0
  36. package/dist/components/modules/list/list-item/list-item-container.js.map +1 -0
  37. package/dist/components/modules/{maps/list/list-item/index.js → list/list-item/list-item.js} +29 -33
  38. package/dist/components/modules/list/list-item/list-item.js.map +1 -0
  39. package/dist/components/modules/maps/map-list.js +3 -3
  40. package/dist/components/modules/maps/map-list.js.map +1 -1
  41. package/dist/constants/eventTypes.js +1 -1
  42. package/dist/constants/eventTypes.js.map +1 -1
  43. package/dist/contexts/mapContext.js +84 -113
  44. package/dist/contexts/mapContext.js.map +1 -1
  45. package/dist/contexts/mapListContext.js +181 -290
  46. package/dist/contexts/mapListContext.js.map +1 -1
  47. package/dist/contexts/trackEventContext.js +1 -1
  48. package/dist/services/configService.js +10 -28
  49. package/dist/services/configService.js.map +1 -1
  50. package/dist/services/googlePlacesNearbyService.js +33 -58
  51. package/dist/services/googlePlacesNearbyService.js.map +1 -1
  52. package/dist/services/listingAggregatorService.js +35 -75
  53. package/dist/services/listingAggregatorService.js.map +1 -1
  54. package/dist/services/listingEntityService.js +10 -31
  55. package/dist/services/listingEntityService.js.map +1 -1
  56. package/dist/services/listingService.js +26 -60
  57. package/dist/services/listingService.js.map +1 -1
  58. package/dist/services/recruiterService.js +11 -31
  59. package/dist/services/recruiterService.js.map +1 -1
  60. package/dist/types/apis/hcApi.d.ts +5 -0
  61. package/dist/types/clientToken.d.ts +2 -0
  62. package/dist/types/components/modules/accordions/MapAccordionItem.d.ts +9 -0
  63. package/dist/types/components/modules/accordions/default.d.ts +19 -0
  64. package/dist/types/components/modules/buttons/button-group-apply.d.ts +24 -0
  65. package/dist/types/components/modules/buttons/commute-pill.d.ts +5 -0
  66. package/dist/types/components/modules/buttons/default.d.ts +48 -0
  67. package/dist/types/components/modules/buttons/pill-wrapper.d.ts +3 -0
  68. package/dist/types/components/modules/dialogs/apply-dialog.d.ts +8 -0
  69. package/dist/types/components/modules/filter/sort.d.ts +8 -0
  70. package/dist/types/components/modules/grid.d.ts +8 -0
  71. package/dist/types/components/modules/icon.d.ts +10 -0
  72. package/dist/types/components/modules/jobListing/listing-details-container.d.ts +6 -0
  73. package/dist/types/components/modules/jobListing/listing-details.d.ts +18 -0
  74. package/dist/types/components/modules/list/field-mapper.d.ts +10 -0
  75. package/dist/types/components/modules/list/header-item.d.ts +11 -0
  76. package/dist/types/components/modules/list/header.d.ts +11 -0
  77. package/dist/types/components/modules/list/index.d.ts +9 -0
  78. package/dist/types/components/modules/list/item-expand-card/index.d.ts +7 -0
  79. package/dist/types/components/modules/list/item-expand-card/recruiter-contact-nav.d.ts +17 -0
  80. package/dist/types/components/modules/list/item-expand-card/recruiter-details.d.ts +21 -0
  81. package/dist/types/components/modules/list/item-expand-card/recruiter-headshot.d.ts +8 -0
  82. package/dist/types/components/modules/list/item-list.d.ts +21 -0
  83. package/dist/types/components/modules/list/list-item/index.d.ts +12 -0
  84. package/dist/types/components/modules/list/list-item/list-item-container.d.ts +14 -0
  85. package/dist/types/components/modules/list/list-item/list-item.d.ts +3 -0
  86. package/dist/types/constants/eventTypes.d.ts +13 -0
  87. package/dist/types/contexts/mapContext.d.ts +29 -0
  88. package/dist/types/contexts/mapListContext.d.ts +58 -0
  89. package/dist/types/contexts/trackEventContext.d.ts +6 -0
  90. package/dist/types/enums/SectionType.d.ts +9 -0
  91. package/dist/types/hooks/useList.d.ts +13 -0
  92. package/dist/types/services/configService.d.ts +6 -0
  93. package/dist/types/services/googlePlacesNearbyService.d.ts +5 -0
  94. package/dist/types/services/listingAggregatorService.d.ts +12 -0
  95. package/dist/types/services/listingEntityService.d.ts +6 -0
  96. package/dist/types/services/listingService.d.ts +9 -0
  97. package/dist/types/services/recruiterService.d.ts +6 -0
  98. package/dist/types/types/Address.d.ts +7 -0
  99. package/dist/types/types/ContentSection.d.ts +8 -0
  100. package/dist/types/types/GetListingParams.d.ts +8 -0
  101. package/dist/types/types/LatLng.d.ts +4 -0
  102. package/dist/types/types/ListingEntity.d.ts +10 -0
  103. package/dist/types/types/ListingFields.d.ts +20 -0
  104. package/dist/types/types/Listings.d.ts +31 -0
  105. package/dist/types/types/Recruiter.d.ts +9 -0
  106. package/dist/types/types/SimilarListing.d.ts +24 -0
  107. package/dist/types/types/config/Colors.d.ts +8 -0
  108. package/dist/types/types/config/MapConfig.d.ts +29 -0
  109. package/dist/types/types/config/PointsOfInterestConfig.d.ts +13 -0
  110. package/dist/types/types/config/SearchConfig.d.ts +4 -0
  111. package/dist/types/util/filterUtil.d.ts +28 -0
  112. package/dist/types/util/loading.d.ts +3 -0
  113. package/dist/types/util/localStorageUtil.d.ts +3 -0
  114. package/dist/types/util/mapUtil.d.ts +15 -0
  115. package/dist/types/util/sortUtil.d.ts +1 -0
  116. package/dist/types/util/stringUtils.d.ts +1 -0
  117. package/dist/util/filterUtil.js +34 -10
  118. package/dist/util/filterUtil.js.map +1 -1
  119. package/dist/util/localStorageUtil.js +37 -28
  120. package/dist/util/localStorageUtil.js.map +1 -1
  121. package/dist/util/mapUtil.js.map +1 -1
  122. package/package.json +22 -14
  123. package/rollup.config.mjs +23 -19
  124. package/src/apis/{hcApi.js → hcApi.ts} +27 -11
  125. package/src/components/HireControlMap.js +132 -129
  126. package/src/components/modules/accordions/MapAccordionItem.js +32 -74
  127. package/src/components/modules/filter/index.js +89 -89
  128. package/src/components/modules/filter/radio-item.js +0 -1
  129. package/src/components/modules/filter/search.js +93 -92
  130. package/src/components/modules/jobListing/listing-details-container.js +40 -0
  131. package/src/components/modules/jobListing/listing-details.js +209 -99
  132. package/src/components/modules/{maps/list → list}/field-mapper.js +114 -112
  133. package/src/components/modules/{maps/list → list}/header.js +49 -47
  134. package/src/components/modules/list/index.tsx +83 -0
  135. package/src/components/modules/{maps/list → list}/item-expand-card/index.js +24 -22
  136. package/src/components/modules/list/item-list.tsx +198 -0
  137. package/src/components/modules/list/list-item/index.js +70 -0
  138. package/src/components/modules/list/list-item/list-item-container.js +43 -0
  139. package/src/components/modules/{maps/list/list-item/index.js → list/list-item/list-item.js} +129 -135
  140. package/src/components/modules/maps/map-list.js +74 -74
  141. package/src/constants/eventTypes.js +13 -13
  142. package/src/contexts/mapContext.tsx +129 -0
  143. package/src/contexts/mapListContext.tsx +297 -0
  144. package/src/enums/SectionType.ts +9 -0
  145. package/src/services/{configService.js → configService.ts} +16 -16
  146. package/src/services/{googlePlacesNearbyService.js → googlePlacesNearbyService.ts} +11 -2
  147. package/src/services/listingAggregatorService.ts +76 -0
  148. package/src/services/listingEntityService.ts +16 -0
  149. package/src/services/listingService.ts +40 -0
  150. package/src/services/{recruiterService.js → recruiterService.ts} +18 -17
  151. package/src/types/Address.ts +7 -0
  152. package/src/types/ContentSection.ts +9 -0
  153. package/src/types/GetListingParams.ts +8 -0
  154. package/src/types/LatLng.ts +4 -0
  155. package/src/types/ListingEntity.ts +11 -0
  156. package/src/types/ListingFields.ts +20 -0
  157. package/src/types/Listings.ts +32 -0
  158. package/src/types/Recruiter.ts +9 -0
  159. package/src/types/SimilarListing.ts +24 -0
  160. package/src/types/config/Colors.ts +8 -0
  161. package/src/types/config/MapConfig.ts +30 -0
  162. package/src/types/config/PointsOfInterestConfig.ts +13 -0
  163. package/src/types/config/SearchConfig.ts +4 -0
  164. package/src/util/filterUtil.js +50 -6
  165. package/src/util/localStorageUtil.ts +34 -0
  166. package/src/util/mapUtil.js +91 -91
  167. package/tsconfig.json +23 -0
  168. package/dist/components/modules/maps/list/field-mapper.js.map +0 -1
  169. package/dist/components/modules/maps/list/header-item.js.map +0 -1
  170. package/dist/components/modules/maps/list/header.js.map +0 -1
  171. package/dist/components/modules/maps/list/index.js +0 -102
  172. package/dist/components/modules/maps/list/index.js.map +0 -1
  173. package/dist/components/modules/maps/list/item-expand-card/index.js.map +0 -1
  174. package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +0 -1
  175. package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +0 -1
  176. package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +0 -1
  177. package/dist/components/modules/maps/list/list-item/index.js.map +0 -1
  178. package/dist/services/_virtual/_rollupPluginBabelHelpers.js +0 -372
  179. package/dist/services/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  180. package/dist/services/apis/hcApi.js +0 -189
  181. package/dist/services/apis/hcApi.js.map +0 -1
  182. package/dist/services/clientToken.js +0 -7
  183. package/dist/services/clientToken.js.map +0 -1
  184. package/dist/services/styles/index.css +0 -3
  185. package/src/components/modules/maps/list/index.js +0 -112
  186. package/src/contexts/mapContext.js +0 -101
  187. package/src/contexts/mapListContext.js +0 -242
  188. package/src/services/listingAggregatorService.js +0 -50
  189. package/src/services/listingEntityService.js +0 -15
  190. package/src/services/listingService.js +0 -26
  191. package/src/util/localStorageUtil.js +0 -27
  192. /package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-headshot.js +0 -0
  193. /package/src/components/modules/{maps/list → list}/header-item.js +0 -0
  194. /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-contact-nav.js +0 -0
  195. /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-details.js +0 -0
  196. /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-headshot.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcagency/hc-ui-components",
3
- "version": "1.3.17",
3
+ "version": "1.3.19",
4
4
  "description": "UI Components for HireControl",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -15,39 +15,46 @@
15
15
  "author": "Aloysius Butler & Clark",
16
16
  "license": "ISC",
17
17
  "peerDependencies": {
18
- "@react-google-maps/api": "^2.0.0",
18
+ "@headlessui/react": "^1.0.0",
19
+ "@iconify/react": "^1.0.0",
19
20
  "@radix-ui/react-accordion": "^1.1.2",
20
21
  "@radix-ui/react-dialog": "^1.0.5",
21
22
  "@radix-ui/react-select": "^2.0.0",
22
23
  "@radix-ui/react-tabs": "^1.0.4",
23
- "@iconify/react": "^1.0.0",
24
- "@headlessui/react": "^1.0.0",
24
+ "@react-google-maps/api": "^2.0.0",
25
+ "fuse.js": "^7.0.0",
25
26
  "use-places-autocomplete": "^1.0.0"
26
27
  },
27
28
  "devDependencies": {
28
- "cross-env": "^7.0.3",
29
- "eslint": "^8.0.0",
30
- "eslint-config-prettier": "^9.1.0",
31
- "eslint-plugin-import": "^2.29.1",
32
- "eslint-plugin-jsx-a11y": "^6.8.0",
33
- "eslint-plugin-prettier": "^5.1.3",
34
- "eslint-plugin-react": "^7.34.2",
35
- "eslint-plugin-react-hooks": "^4.6.2",
36
- "@babel/eslint-parser": "^7.24.6",
37
29
  "@babel/cli": "^7.24.6",
38
30
  "@babel/core": "^7.24.6",
31
+ "@babel/eslint-parser": "^7.24.6",
39
32
  "@babel/preset-env": "^7.24.6",
40
33
  "@babel/preset-react": "^7.24.6",
34
+ "@iconify/react": "^4.1.1",
41
35
  "@rollup/plugin-alias": "^5.1.0",
42
36
  "@rollup/plugin-babel": "^6.0.4",
43
37
  "@rollup/plugin-commonjs": "^25.0.8",
44
38
  "@rollup/plugin-node-resolve": "^15.2.3",
45
39
  "@rollup/plugin-replace": "^5.0.5",
40
+ "@rollup/plugin-typescript": "^11.1.6",
46
41
  "@tailwindcss/aspect-ratio": "^0.4.2",
47
42
  "@tailwindcss/forms": "^0.5.7",
48
43
  "@tailwindcss/typography": "^0.5.13",
44
+ "@types/node": "^20.14.2",
45
+ "@types/react": "^18.3.3",
46
+ "@typescript-eslint/eslint-plugin": "^7.13.0",
47
+ "@typescript-eslint/parser": "^7.13.0",
49
48
  "autoprefixer": "^10.4.19",
49
+ "cross-env": "^7.0.3",
50
50
  "dotenv": "^16.4.5",
51
+ "eslint": "^8.57.0",
52
+ "eslint-config-prettier": "^9.1.0",
53
+ "eslint-plugin-import": "^2.29.1",
54
+ "eslint-plugin-jsx-a11y": "^6.8.0",
55
+ "eslint-plugin-prettier": "^5.1.3",
56
+ "eslint-plugin-react": "^7.34.2",
57
+ "eslint-plugin-react-hooks": "^4.6.2",
51
58
  "postcss": "^8.4.38",
52
59
  "postcss-prefixer": "^3.0.0",
53
60
  "postcss-preset-env": "^9.5.14",
@@ -55,6 +62,7 @@
55
62
  "rollup-plugin-peer-deps-external": "^2.2.4",
56
63
  "rollup-plugin-postcss": "^4.0.2",
57
64
  "tailwindcss": "^3.4.3",
58
- "tailwindcss-animate": "^1.0.7"
65
+ "tailwindcss-animate": "^1.0.7",
66
+ "typescript": "^4.9.5"
59
67
  }
60
68
  }
package/rollup.config.mjs CHANGED
@@ -10,21 +10,21 @@ import postcss from 'rollup-plugin-postcss';
10
10
  import { fileURLToPath } from 'url';
11
11
  import tailwindcss from 'tailwindcss';
12
12
  import autoprefixer from 'autoprefixer';
13
+ import typescript from '@rollup/plugin-typescript';
13
14
 
14
- // Convert file URL to file path
15
15
  const __filename = fileURLToPath(import.meta.url);
16
16
  const __dirname = path.dirname(__filename);
17
17
 
18
- // Load environment variables from .env file
19
18
  dotenv.config({ path: path.resolve(__dirname, '.env') });
20
19
  console.log('GOOGLE_MAPS_API_KEY:', process.env.GOOGLE_MAPS_API_KEY);
21
20
 
22
- // Resolve the project root directory
23
21
  const projectRootDir = path.resolve(__dirname);
24
22
 
25
23
  const plugins = [
26
24
  external(),
27
- resolve(),
25
+ resolve({
26
+ extensions: ['.js', '.jsx', '.ts', '.tsx'] // Ensure resolve works with these extensions
27
+ }),
28
28
  postcss({
29
29
  extensions: ['.css'],
30
30
  extract: 'styles/index.css',
@@ -48,6 +48,10 @@ const plugins = [
48
48
  exclude: 'node_modules/**',
49
49
  presets: ['@babel/preset-env', '@babel/preset-react']
50
50
  }),
51
+ typescript({
52
+ tsconfig: path.resolve(__dirname, 'tsconfig.json'),
53
+ allowJs: true
54
+ }),
51
55
  commonjs()
52
56
  ];
53
57
 
@@ -58,7 +62,7 @@ const externalDependencies = [
58
62
 
59
63
  export default [
60
64
  {
61
- input: path.resolve(__dirname, 'src/index.js'),
65
+ input: path.resolve(__dirname, 'src/index.js'), // Change to .ts if your entry point is TypeScript
62
66
  output: {
63
67
  dir: path.resolve(__dirname, 'dist'),
64
68
  format: 'es',
@@ -71,18 +75,18 @@ export default [
71
75
  external: externalDependencies,
72
76
  treeshake: true
73
77
  },
74
- {
75
- input: path.resolve(__dirname, 'src/services/listingService.js'),
76
- output: {
77
- dir: path.resolve(__dirname, 'dist/services'),
78
- format: 'es',
79
- exports: 'named',
80
- sourcemap: true,
81
- preserveModules: true,
82
- preserveModulesRoot: 'src/services'
83
- },
84
- plugins,
85
- external: externalDependencies,
86
- treeshake: true
87
- }
78
+ // {
79
+ // input: path.resolve(__dirname, 'src/services/listingService.ts'),
80
+ // output: {
81
+ // dir: path.resolve(__dirname, 'dist'),
82
+ // format: 'es',
83
+ // exports: 'named',
84
+ // sourcemap: true,
85
+ // preserveModules: true,
86
+ // preserveModulesRoot: 'src/services'
87
+ // },
88
+ // plugins,
89
+ // external: externalDependencies,
90
+ // treeshake: true
91
+ // }
88
92
  ];
@@ -1,12 +1,17 @@
1
- import { getClientAuthKey } from '~/clientToken.js';
2
- const baseURL = process.env.HC_API_BASE_URL;
1
+ import { getClientAuthKey } from '~/clientToken';
2
+ const baseURL = process.env.HC_API_BASE_URL as string;
3
3
 
4
- const memoryStorage = {
4
+ interface MemoryStorage {
5
+ authToken: string | null;
6
+ tokenExpiration: string | null;
7
+ }
8
+
9
+ const memoryStorage: MemoryStorage = {
5
10
  authToken: null,
6
11
  tokenExpiration: null
7
12
  };
8
13
 
9
- function setStorage(key, value) {
14
+ function setStorage(key: keyof MemoryStorage, value: string): void {
10
15
  try {
11
16
  sessionStorage.setItem(key, value);
12
17
  } catch (error) {
@@ -14,7 +19,7 @@ function setStorage(key, value) {
14
19
  }
15
20
  }
16
21
 
17
- function getStorage(key) {
22
+ function getStorage(key: keyof MemoryStorage): string | null {
18
23
  try {
19
24
  return sessionStorage.getItem(key) || memoryStorage[key];
20
25
  } catch (error) {
@@ -22,7 +27,12 @@ function getStorage(key) {
22
27
  }
23
28
  }
24
29
 
25
- const login = async () => {
30
+ interface AuthResponse {
31
+ token: string;
32
+ expiration: string;
33
+ }
34
+
35
+ const login = async (): Promise<AuthResponse> => {
26
36
  const clientAuthKey = getClientAuthKey();
27
37
 
28
38
  try {
@@ -36,12 +46,18 @@ const login = async () => {
36
46
  })
37
47
  });
38
48
 
49
+ if (!response.ok) {
50
+ throw new Error('Login failed');
51
+ }
52
+
39
53
  const data = await response.json();
40
54
 
41
55
  if (data.token && data.expiration) {
42
56
  setStorage('authToken', data.token);
43
57
  setStorage('tokenExpiration', data.expiration);
44
58
  return { token: data.token, expiration: data.expiration };
59
+ } else {
60
+ throw new Error('Invalid login response');
45
61
  }
46
62
  } catch (error) {
47
63
  console.error('Login failed:', error);
@@ -49,7 +65,7 @@ const login = async () => {
49
65
  }
50
66
  };
51
67
 
52
- const fetchWithAuth = async (url, options = {}) => {
68
+ const fetchWithAuth = async (url: string, options: RequestInit = {}): Promise<Response> => {
53
69
  let token = getStorage('authToken');
54
70
 
55
71
  const expirationDateTime = getStorage('tokenExpiration');
@@ -76,11 +92,11 @@ const fetchWithAuth = async (url, options = {}) => {
76
92
  };
77
93
 
78
94
  export default {
79
- get: async url => {
95
+ get: async <T>(url: string): Promise<T> => {
80
96
  const response = await fetchWithAuth(url);
81
- return await response.json();
97
+ return await response.json() as T;
82
98
  },
83
- post: async (url, data) => {
99
+ post: async <T>(url: string, data: any): Promise<T> => {
84
100
  const response = await fetchWithAuth(url, {
85
101
  method: 'POST',
86
102
  headers: {
@@ -88,6 +104,6 @@ export default {
88
104
  },
89
105
  body: JSON.stringify(data)
90
106
  });
91
- return await response.json();
107
+ return await response.json() as T;
92
108
  }
93
109
  };
@@ -1,129 +1,132 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { useLoadScript } from '@react-google-maps/api';
3
-
4
- import Grid from '~/components/modules/grid';
5
- import Filter from '~/components/modules/filter';
6
- import MapList from '~/components/modules/maps/map-list';
7
-
8
- import { MapProvider } from '~/contexts/mapContext';
9
- import { PlacesProvider } from '~/contexts/placesContext';
10
- import { MapListProvider } from '~/contexts/mapListContext';
11
- import { TrackEventProvider } from '~/contexts/trackEventContext';
12
-
13
- import { getMapConfig } from '~/services/configService';
14
- import { setClientAuthKey } from '~/clientToken.js';
15
-
16
- import '../styles/index.css';
17
-
18
- const libraries = ['places'];
19
-
20
- export const HireControlMap = ({
21
- clientToken,
22
- navigateToDetails = null,
23
- navigateToEasyApply = null,
24
- Link = null,
25
- linkFormat = '/jobs/[slug]',
26
- trackEvent = (eventType, eventObj) => {console.log(eventType); console.log(eventObj);}
27
- }) => {
28
- const [siteConfig, setSiteconfig] = useState(null);
29
-
30
- useEffect(() => {
31
- setClientAuthKey(clientToken);
32
- const fetchSiteConfig = async () => {
33
- try {
34
- const configData = await getMapConfig(clientToken);
35
- setSiteconfig(configData);
36
- } catch (error) {
37
- console.error('Failed to fetch site configuration:', error);
38
- }
39
- };
40
-
41
- fetchSiteConfig();
42
- }, [clientToken]);
43
-
44
- const { isLoaded } = useLoadScript({
45
- googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY,
46
- version: 'quarterly',
47
- libraries: libraries
48
- });
49
-
50
- return (
51
- <div>
52
- {isLoaded && siteConfig && (
53
- <HomeBody
54
- siteConfig={siteConfig}
55
- navigateToDetails={navigateToDetails}
56
- navigateToEasyApply={navigateToEasyApply}
57
- Link={Link}
58
- linkFormat={linkFormat}
59
- trackEvent={trackEvent}
60
- />
61
- )}
62
- </div>
63
- );
64
- };
65
-
66
- const HomeBody = ({ siteConfig, navigateToDetails, navigateToEasyApply, Link, linkFormat, trackEvent }) => {
67
- const resetFilters = false;
68
-
69
- return (
70
- <TrackEventProvider trackEvent={trackEvent}>
71
- <MapListProvider
72
- siteConfig={siteConfig}
73
- resetFilters={resetFilters}
74
- avigateToDetails={navigateToDetails}
75
- navigateToEasyApply={navigateToEasyApply}
76
- Link={Link}
77
- linkFormat={linkFormat}
78
- >
79
- <MapProvider resetFilters={resetFilters}>
80
- <PlacesProvider
81
- placeMappings={siteConfig.pointsOfInterestConfig.placeMappings ?? {}}
82
- markerColors={{
83
- fillColor: siteConfig.colors.primary,
84
- strokeColor: siteConfig.colors.primaryDark,
85
- selectedFillColor: siteConfig.colors.secondary,
86
- selectedStrokeColor: siteConfig.colors.secondaryDark,
87
- placeMarkers: {
88
- colors: siteConfig.pointsOfInterestConfig.placeMarkerColors,
89
- size: siteConfig.pointsOfInterestConfig.placeMarkerSize
90
- }
91
- }}
92
- >
93
- <Grid
94
- as='section'
95
- id='job-search-interface'
96
- columns='md:hc-grid-cols-[1fr_2.5fr] lg:hc-grid-cols-[1fr_3.5fr]'
97
- gap='hc-gap-0'
98
- autoRows={false}
99
- className='hc-items-stretch hc-h-screen hc-min-h-[30rem] hc-divide-x hc-divide-uiAccent/20'
100
- >
101
- <Grid.Item className='hc-bg-gray-100'>
102
- <Filter showMap={siteConfig.showMap} className='hc-hidden md:hc-block' />
103
- </Grid.Item>
104
- <MapList
105
- markerConfigs={{
106
- fillColor: siteConfig.colors.primary,
107
- strokeColor: siteConfig.colors.primaryDark,
108
- selectedFillColor: siteConfig.colors.secondary,
109
- selectedStrokeColor: siteConfig.colors.secondaryDark,
110
- placeMarkers: {
111
- colors: siteConfig.pointsOfInterestConfig.placeMarkerColors,
112
- size: siteConfig.pointsOfInterestConfig.placeMarkerSize
113
- }
114
- }}
115
- showMap={siteConfig.showMap}
116
- fieldsShown={siteConfig.fieldsShown}
117
- specialFeatures={siteConfig.specialFeatures}
118
- fieldNames={siteConfig.fieldNames}
119
- placeMappings={siteConfig.pointsOfInterestConfig.placeMappings ?? {}}
120
- />
121
- </Grid>
122
- </PlacesProvider>
123
- </MapProvider>
124
- </MapListProvider>
125
- </TrackEventProvider>
126
- );
127
- };
128
-
129
- export default HireControlMap;
1
+ import React, { useEffect, useState } from 'react';
2
+ import { useLoadScript } from '@react-google-maps/api';
3
+
4
+ import Grid from '~/components/modules/grid';
5
+ import Filter from '~/components/modules/filter';
6
+ import MapList from '~/components/modules/maps/map-list';
7
+
8
+ import { MapProvider } from '~/contexts/mapContext';
9
+ import { PlacesProvider } from '~/contexts/placesContext';
10
+ import { MapListProvider } from '~/contexts/mapListContext';
11
+ import { TrackEventProvider } from '~/contexts/trackEventContext';
12
+
13
+ import { getMapConfig } from '~/services/configService';
14
+ import { setClientAuthKey } from '~/clientToken.js';
15
+
16
+ import '../styles/index.css';
17
+
18
+ const libraries = ['places'];
19
+
20
+ export const HireControlMap = ({
21
+ clientToken,
22
+ navigateToDetails = null,
23
+ navigateToEasyApply = null,
24
+ Link = null,
25
+ linkFormat = '/jobs/[slug]',
26
+ trackEvent = (eventType, eventObj) => {console.log(eventType); console.log(eventObj);},
27
+ listings = []
28
+ }) => {
29
+ const [siteConfig, setSiteconfig] = useState(null);
30
+
31
+ useEffect(() => {
32
+ setClientAuthKey(clientToken);
33
+ const fetchSiteConfig = async () => {
34
+ try {
35
+ const configData = await getMapConfig(clientToken);
36
+ setSiteconfig(configData);
37
+ } catch (error) {
38
+ console.error('Failed to fetch site configuration:', error);
39
+ }
40
+ };
41
+
42
+ fetchSiteConfig();
43
+ }, [clientToken]);
44
+
45
+ const { isLoaded } = useLoadScript({
46
+ googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY,
47
+ version: 'quarterly',
48
+ libraries: libraries
49
+ });
50
+
51
+ return (
52
+ <div>
53
+ {isLoaded && siteConfig && (
54
+ <HomeBody
55
+ siteConfig={siteConfig}
56
+ navigateToDetails={navigateToDetails}
57
+ navigateToEasyApply={navigateToEasyApply}
58
+ Link={Link}
59
+ linkFormat={linkFormat}
60
+ trackEvent={trackEvent}
61
+ listings={listings}
62
+ />
63
+ )}
64
+ </div>
65
+ );
66
+ };
67
+
68
+ const HomeBody = ({ siteConfig, navigateToDetails, navigateToEasyApply, Link, linkFormat, trackEvent, listings }) => {
69
+ const resetFilters = false;
70
+
71
+ return (
72
+ <TrackEventProvider trackEvent={trackEvent}>
73
+ <MapListProvider
74
+ siteConfig={siteConfig}
75
+ resetFilters={resetFilters}
76
+ avigateToDetails={navigateToDetails}
77
+ navigateToEasyApply={navigateToEasyApply}
78
+ Link={Link}
79
+ linkFormat={linkFormat}
80
+ listings={listings}
81
+ >
82
+ <MapProvider resetFilters={resetFilters}>
83
+ <PlacesProvider
84
+ placeMappings={siteConfig.pointsOfInterestConfig.placeMappings ?? {}}
85
+ markerColors={{
86
+ fillColor: siteConfig.colors.primary,
87
+ strokeColor: siteConfig.colors.primaryDark,
88
+ selectedFillColor: siteConfig.colors.secondary,
89
+ selectedStrokeColor: siteConfig.colors.secondaryDark,
90
+ placeMarkers: {
91
+ colors: siteConfig.pointsOfInterestConfig.placeMarkerColors,
92
+ size: siteConfig.pointsOfInterestConfig.placeMarkerSize
93
+ }
94
+ }}
95
+ >
96
+ <Grid
97
+ as='section'
98
+ id='job-search-interface'
99
+ columns='md:hc-grid-cols-[1fr_2.5fr] lg:hc-grid-cols-[1fr_3.5fr]'
100
+ gap='hc-gap-0'
101
+ autoRows={false}
102
+ className='hc-items-stretch hc-h-screen hc-min-h-[30rem] hc-divide-x hc-divide-uiAccent/20'
103
+ >
104
+ <Grid.Item className='hc-bg-gray-100'>
105
+ <Filter showMap={siteConfig.showMap} className='hc-hidden md:hc-block' />
106
+ </Grid.Item>
107
+ <MapList
108
+ markerConfigs={{
109
+ fillColor: siteConfig.colors.primary,
110
+ strokeColor: siteConfig.colors.primaryDark,
111
+ selectedFillColor: siteConfig.colors.secondary,
112
+ selectedStrokeColor: siteConfig.colors.secondaryDark,
113
+ placeMarkers: {
114
+ colors: siteConfig.pointsOfInterestConfig.placeMarkerColors,
115
+ size: siteConfig.pointsOfInterestConfig.placeMarkerSize
116
+ }
117
+ }}
118
+ showMap={siteConfig.showMap}
119
+ fieldsShown={siteConfig.fieldsShown}
120
+ specialFeatures={siteConfig.specialFeatures}
121
+ fieldNames={siteConfig.fieldNames}
122
+ placeMappings={siteConfig.pointsOfInterestConfig.placeMappings ?? {}}
123
+ />
124
+ </Grid>
125
+ </PlacesProvider>
126
+ </MapProvider>
127
+ </MapListProvider>
128
+ </TrackEventProvider>
129
+ );
130
+ };
131
+
132
+ export default HireControlMap;
@@ -1,74 +1,32 @@
1
- import React from 'react';
2
-
3
- import Accordion from '~/components/modules/accordions/default';
4
- import ListItem from '~/components/modules/maps/list/list-item';
5
- import ItemExpandCard from '~/components/modules/maps/list/item-expand-card';
6
-
7
- import { useMap } from '~/contexts/mapContext';
8
- import { useMapList } from '~/contexts/mapListContext';
9
- import { useTrackEvent } from '~/contexts/trackEventContext';
10
-
11
- import { setStorageObject } from '~/util/localStorageUtil';
12
-
13
- const MapAccordionItem = ({
14
- item,
15
- itemRefs,
16
- itemExpandedContent,
17
- fieldsShown,
18
- showMap,
19
- hasListItemSelected,
20
- specialFeatures,
21
- isActive
22
- }) => {
23
- const {
24
- mapItems,
25
- recruiters,
26
- setMobileTab,
27
- favorites,
28
- handleSettingFavorites
29
- } = useMapList();
30
- const { selectItem } = useMap();
31
- const { trackEvent, eventTypes } = useTrackEvent();
32
- const setSelectedItemAndZoomMap = item => {
33
- if (isActive) {
34
- localStorage.removeItem("selectedListItem");
35
- mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.id)) || null;
36
- selectItem(null, null, 9, { lat: 39.8283, lng: -98.5795 });
37
- } else {
38
- setStorageObject("selectedListItem", item);
39
- let location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.id)) || null;
40
- selectItem(item, location, 12, {
41
- lat: location?.latitude,
42
- lng: location?.longitude
43
- });
44
- }
45
- };
46
- return (
47
- <Accordion.Item key={item.id} id={item.id}>
48
- <Accordion.Trigger.Blank>
49
- <ListItem
50
- ref={el => (itemRefs.current[item.id] = el)}
51
- id={item.id}
52
- key={item.id}
53
- item={item}
54
- fieldsShown={fieldsShown}
55
- onClick={() => { trackEvent(eventTypes.JOB_LISTING_SELECTED, { jobTitle: item.fields.position, jobCategory: item.fields.category, entityDisplayName: item?.mapDetails?.entityDisplayName });setSelectedItemAndZoomMap(item);}}
56
- showMap={showMap}
57
- isActive={isActive}
58
- setMobileTab={setMobileTab}
59
- specialFeatures={specialFeatures}
60
- className={hasListItemSelected ? isActive ? "!hc-border-secondary hc-border hc-border-b-0" : "hc-opacity-85" : ""}
61
- favorites={favorites}
62
- setFavorites={handleSettingFavorites}
63
- />
64
- </Accordion.Trigger.Blank>
65
- {isActive &&
66
- <Accordion.Content bodyClassName="hc-px-2 hc-py-2 hc-pt-0 hc-bg-uiAccent/5 hc-border-secondary hc-border hc-border-t-0">
67
- <ItemExpandCard content={itemExpandedContent(item, recruiters)} />
68
- </Accordion.Content>
69
- }
70
- </Accordion.Item>
71
- );
72
- };
73
-
74
- export default MapAccordionItem;
1
+ import React from 'react';
2
+ import Accordion from '~/components/modules/accordions/default';
3
+ import ItemExpandCard from '~/components/modules/list/item-expand-card';
4
+
5
+ const MapAccordionItem = ({
6
+ item,
7
+ itemRefs,
8
+ itemExpandedContent,
9
+ isActive,
10
+ children
11
+ }) => {
12
+ if(isActive){
13
+ console.log("accordion rerender ");
14
+ }
15
+ return (
16
+ <Accordion.Item key={item.id} id={item.id}>
17
+ <Accordion.Trigger.Blank>
18
+ <div ref={el => (itemRefs.current[item.id] = el)}>
19
+ {children}
20
+ </div>
21
+ </Accordion.Trigger.Blank>
22
+ {isActive &&
23
+
24
+ <Accordion.Content bodyClassName="hc-px-2 hc-py-2 hc-pt-0 hc-bg-uiAccent/5 hc-border-secondary hc-border hc-border-t-0">
25
+ { <ItemExpandCard content={itemExpandedContent(item)} />}
26
+ </Accordion.Content>
27
+ }
28
+ </Accordion.Item>
29
+ );
30
+ };
31
+
32
+ export default MapAccordionItem;