@abcagency/hc-ui-components 1.1.1 → 1.2.0
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/.editorconfig +12 -0
- package/.eslintrc +144 -0
- package/.prettierignore +3 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +516 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/apis/hcApi.js +189 -0
- package/dist/apis/hcApi.js.map +1 -0
- package/dist/clientToken.js +10 -0
- package/dist/clientToken.js.map +1 -0
- package/dist/components/HireControlMap.js +129 -0
- package/dist/components/HireControlMap.js.map +1 -0
- package/dist/components/modules/accordions/MapAccordionItem.js +76 -0
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -0
- package/dist/components/modules/accordions/default.js +108 -0
- package/dist/components/modules/accordions/default.js.map +1 -0
- package/dist/components/modules/accordions/filterItem.js +50 -0
- package/dist/components/modules/accordions/filterItem.js.map +1 -0
- package/dist/components/modules/accordions/filters.js +46 -0
- package/dist/components/modules/accordions/filters.js.map +1 -0
- package/dist/components/modules/buttons/button-group-apply.js +84 -0
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -0
- package/dist/components/modules/buttons/commute-pill.js +18 -0
- package/dist/components/modules/buttons/commute-pill.js.map +1 -0
- package/dist/components/modules/buttons/default.js +145 -0
- package/dist/components/modules/buttons/default.js.map +1 -0
- package/dist/components/modules/buttons/items-pill.js +23 -0
- package/dist/components/modules/buttons/items-pill.js.map +1 -0
- package/dist/components/modules/buttons/pill-wrapper.js +20 -0
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -0
- package/dist/components/modules/buttons/show-all-button.js +39 -0
- package/dist/components/modules/buttons/show-all-button.js.map +1 -0
- package/dist/components/modules/cards/default.js +102 -0
- package/dist/components/modules/cards/default.js.map +1 -0
- package/dist/components/modules/cards/filter.js +38 -0
- package/dist/components/modules/cards/filter.js.map +1 -0
- package/dist/components/modules/dialogs/apply-dialog.js +46 -0
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -0
- package/dist/components/modules/filter/commute.js +184 -0
- package/dist/components/modules/filter/commute.js.map +1 -0
- package/dist/components/modules/filter/index.js +79 -0
- package/dist/components/modules/filter/index.js.map +1 -0
- package/dist/components/modules/filter/item.js +71 -0
- package/dist/components/modules/filter/item.js.map +1 -0
- package/dist/components/modules/filter/location.js +68 -0
- package/dist/components/modules/filter/location.js.map +1 -0
- package/dist/components/modules/filter/points-of-interest.js +38 -0
- package/dist/components/modules/filter/points-of-interest.js.map +1 -0
- package/dist/components/modules/filter/radio-item.js +46 -0
- package/dist/components/modules/filter/radio-item.js.map +1 -0
- package/dist/components/modules/filter/search.js +83 -0
- package/dist/components/modules/filter/search.js.map +1 -0
- package/dist/components/modules/filter/sort.js +93 -0
- package/dist/components/modules/filter/sort.js.map +1 -0
- package/dist/components/modules/grid.js +39 -0
- package/dist/components/modules/grid.js.map +1 -0
- package/dist/components/modules/icon.js +23 -0
- package/dist/components/modules/icon.js.map +1 -0
- package/dist/components/modules/jobListing/listing-details.js +69 -0
- package/dist/components/modules/jobListing/listing-details.js.map +1 -0
- package/dist/components/modules/maps/info-window-card.js +14 -0
- package/dist/components/modules/maps/info-window-card.js.map +1 -0
- package/dist/components/modules/maps/info-window-content.js +39 -0
- package/dist/components/modules/maps/info-window-content.js.map +1 -0
- package/dist/components/modules/maps/list/field-mapper.js +88 -0
- package/dist/components/modules/maps/list/field-mapper.js.map +1 -0
- package/dist/components/modules/maps/list/header-item.js +59 -0
- package/dist/components/modules/maps/list/header-item.js.map +1 -0
- package/dist/components/modules/maps/list/header.js +37 -0
- package/dist/components/modules/maps/list/header.js.map +1 -0
- package/dist/components/modules/maps/list/index.js +93 -0
- package/dist/components/modules/maps/list/index.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/index.js +16 -0
- package/dist/components/modules/maps/list/item-expand-card/index.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +38 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js +40 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +1 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js +20 -0
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +1 -0
- package/dist/components/modules/maps/list/list-item/index.js +98 -0
- package/dist/components/modules/maps/list/list-item/index.js.map +1 -0
- package/dist/components/modules/maps/map-list.js +57 -0
- package/dist/components/modules/maps/map-list.js.map +1 -0
- package/dist/components/modules/maps/map-marker.js +85 -0
- package/dist/components/modules/maps/map-marker.js.map +1 -0
- package/dist/components/modules/maps/map.js +201 -0
- package/dist/components/modules/maps/map.js.map +1 -0
- package/dist/components/modules/maps/place-marker.js +37 -0
- package/dist/components/modules/maps/place-marker.js.map +1 -0
- package/dist/components/modules/maps/tabs.js +84 -0
- package/dist/components/modules/maps/tabs.js.map +1 -0
- package/dist/constants/placeTypes.js +11 -0
- package/dist/constants/placeTypes.js.map +1 -0
- package/dist/contexts/mapContext.js +133 -0
- package/dist/contexts/mapContext.js.map +1 -0
- package/dist/contexts/mapListContext.js +278 -0
- package/dist/contexts/mapListContext.js.map +1 -0
- package/dist/contexts/placesContext.js +152 -0
- package/dist/contexts/placesContext.js.map +1 -0
- package/dist/hooks/useList.js +119 -0
- package/dist/hooks/useList.js.map +1 -0
- package/dist/index.js +2 -4536
- package/dist/index.js.map +1 -0
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js +372 -0
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/services/apis/hcApi.js +189 -0
- package/dist/services/apis/hcApi.js.map +1 -0
- package/dist/services/clientToken.js +7 -0
- package/dist/services/clientToken.js.map +1 -0
- package/dist/services/configService.js +33 -0
- package/dist/services/configService.js.map +1 -0
- package/dist/services/googlePlacesNearbyService.js +61 -0
- package/dist/services/googlePlacesNearbyService.js.map +1 -0
- package/dist/services/listingAggregatorService.js +56 -0
- package/dist/services/listingAggregatorService.js.map +1 -0
- package/dist/services/listingEntityService.js +36 -0
- package/dist/services/listingEntityService.js.map +1 -0
- package/dist/services/listingService.js +60 -112
- package/dist/services/listingService.js.map +1 -0
- package/dist/services/recruiterService.js +36 -0
- package/dist/services/recruiterService.js.map +1 -0
- package/dist/services/styles/index.css +3 -0
- package/dist/styles/index.css +3 -0
- package/dist/util/filterUtil.js +213 -0
- package/dist/util/filterUtil.js.map +1 -0
- package/dist/util/loading.js +16 -0
- package/dist/util/loading.js.map +1 -0
- package/dist/util/localStorageUtil.js +32 -0
- package/dist/util/localStorageUtil.js.map +1 -0
- package/dist/util/mapIconUtil.js +73 -0
- package/dist/util/mapIconUtil.js.map +1 -0
- package/dist/util/mapUtil.js +76 -0
- package/dist/util/mapUtil.js.map +1 -0
- package/dist/util/sortUtil.js +33 -0
- package/dist/util/sortUtil.js.map +1 -0
- package/dist/util/stringUtils.js +9 -0
- package/dist/util/stringUtils.js.map +1 -0
- package/jsconfig.json +7 -0
- package/package.json +51 -38
- package/postcss.config.js +13 -15
- package/{src/tailwind/preset.default.js → preset.default.js} +15 -15
- package/rollup.config.mjs +87 -0
- package/src/apis/hcApi.js +93 -87
- package/src/clientToken.js +9 -9
- package/src/components/HireControlMap.js +120 -0
- package/src/components/modules/accordions/MapAccordionItem.js +72 -69
- package/src/components/modules/accordions/default.js +171 -173
- package/src/components/modules/accordions/filterItem.js +53 -53
- package/src/components/modules/accordions/filters.js +47 -44
- package/src/components/modules/buttons/button-group-apply.js +113 -85
- package/src/components/modules/buttons/commute-pill.js +22 -21
- package/src/components/modules/buttons/default.js +196 -196
- package/src/components/modules/buttons/items-pill.js +32 -31
- package/src/components/modules/buttons/pill-wrapper.js +27 -26
- package/src/components/modules/buttons/show-all-button.js +20 -20
- package/src/components/modules/cards/default.js +167 -168
- package/src/components/modules/cards/filter.js +56 -55
- package/src/components/modules/dialogs/apply-dialog.js +48 -47
- package/src/components/modules/filter/commute.js +148 -151
- package/src/components/modules/filter/index.js +87 -86
- package/src/components/modules/filter/item.js +76 -77
- package/src/components/modules/filter/location.js +71 -69
- package/src/components/modules/filter/points-of-interest.js +44 -43
- package/src/components/modules/filter/radio-item.js +53 -51
- package/src/components/modules/filter/search.js +92 -91
- package/src/components/modules/filter/sort.js +83 -83
- package/src/components/modules/grid.js +55 -56
- package/src/components/modules/icon.js +33 -33
- package/src/components/modules/jobListing/listing-details.js +94 -88
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/info-window-content.js +58 -60
- package/src/components/modules/maps/list/field-mapper.js +112 -111
- package/src/components/modules/maps/list/header-item.js +91 -90
- package/src/components/modules/maps/list/header.js +47 -46
- package/src/components/modules/maps/list/index.js +107 -104
- package/src/components/modules/maps/list/item-expand-card/index.js +22 -21
- package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +50 -48
- package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +68 -67
- package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -22
- package/src/components/modules/maps/list/list-item/index.js +134 -133
- package/src/components/modules/maps/map-list.js +74 -73
- package/src/components/modules/maps/map-marker.js +86 -84
- package/src/components/modules/maps/map.js +229 -226
- package/src/components/modules/maps/place-marker.js +1 -1
- package/src/components/modules/maps/tabs.js +81 -79
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/mapContext.js +20 -19
- package/src/contexts/mapListContext.js +20 -15
- package/src/contexts/placesContext.js +4 -0
- package/src/hooks/useList.js +12 -10
- package/src/index.js +3 -103
- package/src/services/configService.js +16 -16
- package/src/services/googlePlacesNearbyService.js +33 -33
- package/src/services/listingAggregatorService.js +5 -4
- package/src/services/listingEntityService.js +2 -1
- package/src/services/listingService.js +27 -28
- package/src/services/recruiterService.js +17 -17
- package/src/styles/{globals.css → index.css} +23 -23
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +22 -19
- package/src/util/filterUtil.js +19 -19
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.js +26 -26
- package/src/util/mapIconUtil.js +3 -3
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/{src/tailwind/tailwind.config.js → tailwind.config.js} +126 -127
- package/dist/globals.css +0 -3
- package/dist/output.css +0 -784
- package/dist/services/globals.css +0 -3
- package/rollup.config.js +0 -68
- package/src/components/layout/footer.js +0 -34
- package/src/components/layout/header.js +0 -23
- package/src/components/layout/layout.js +0 -36
- package/src/components/modules/animations/slidein.js +0 -41
- package/src/components/modules/navigation/nav-link.js +0 -65
- package/src/components/modules/navigation/navbar.js +0 -106
- package/src/components/modules/navigation/skip-link.js +0 -21
- package/src/components/modules/navigation/social.js +0 -29
- package/src/components/modules/sections/default.js +0 -59
- package/src/components/modules/sections/sectionContext.js +0 -4
- package/src/hooks/useClickOutside.js +0 -16
- package/src/hooks/useEventListener.js +0 -25
- package/src/hooks/useEventTracker.js +0 -19
- package/src/hooks/useRefScrollProgress.js +0 -24
- package/src/hooks/useScript.js +0 -63
- package/src/hooks/useScrollDirection.js +0 -39
- package/src/hooks/useSectionTracker.js +0 -95
- package/src/hooks/useUserAgent.js +0 -43
- package/src/hooks/useWindowSize.js +0 -28
- package/src/index.css +0 -25
- package/src/styles/fonts.js +0 -0
- package/src/util/page-head.js +0 -62
- package/src/util/provider.js +0 -12
package/package.json
CHANGED
|
@@ -1,38 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@abcagency/hc-ui-components",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "UI Components for HireControl",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "NODE_ENV=production rollup -c",
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"hirecontrol",
|
|
12
|
+
"ui",
|
|
13
|
+
"components"
|
|
14
|
+
],
|
|
15
|
+
"author": "Aloysius Butler & Clark",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@react-google-maps/api": "^2.0.0",
|
|
19
|
+
"@radix-ui/react-tabs": "^0.1.0",
|
|
20
|
+
"@radix-ui/react-accordion": "^0.1.0",
|
|
21
|
+
"@iconify/react": "^1.0.0",
|
|
22
|
+
"@radix-ui/react-select": "^0.1.0",
|
|
23
|
+
"@headlessui/react": "^1.0.0",
|
|
24
|
+
"use-places-autocomplete": "^1.0.0",
|
|
25
|
+
"@radix-ui/react-dialog": "^0.1.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@babel/cli": "^7.24.6",
|
|
29
|
+
"@babel/core": "^7.24.6",
|
|
30
|
+
"@babel/preset-env": "^7.24.6",
|
|
31
|
+
"@babel/preset-react": "^7.24.6",
|
|
32
|
+
"@rollup/plugin-alias": "^5.1.0",
|
|
33
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
34
|
+
"@rollup/plugin-commonjs": "^25.0.8",
|
|
35
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
36
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
37
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
38
|
+
"@tailwindcss/forms": "^0.5.7",
|
|
39
|
+
"@tailwindcss/typography": "^0.5.13",
|
|
40
|
+
"autoprefixer": "^10.4.19",
|
|
41
|
+
"dotenv": "^16.4.5",
|
|
42
|
+
"postcss": "^8.4.38",
|
|
43
|
+
"postcss-prefixer": "^3.0.0",
|
|
44
|
+
"postcss-preset-env": "^9.5.14",
|
|
45
|
+
"rollup": "^4.18.0",
|
|
46
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
47
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
48
|
+
"tailwindcss": "^3.4.3",
|
|
49
|
+
"tailwindcss-animate": "^1.0.7"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/postcss.config.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: {
|
|
3
|
+
'postcss-nesting': {}, // Use postcss-nesting directly
|
|
4
|
+
tailwindcss: {},
|
|
5
|
+
'postcss-preset-env': {
|
|
6
|
+
stage: 4, // Consider specifying a higher stage if you don't need all experimental features
|
|
7
|
+
features: {
|
|
8
|
+
'nesting-rules': false // Ensure no conflict with postcss-nesting
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
autoprefixer: {}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports = {
|
|
3
|
-
theme: {
|
|
4
|
-
extend: {
|
|
5
|
-
colors: {
|
|
6
|
-
"uiText": "#141414",
|
|
7
|
-
"uiAccent": "#0f172a",
|
|
8
|
-
"primary": "#002575",
|
|
9
|
-
"primaryDark": "#001f5f",
|
|
10
|
-
"secondary": "#ff612b",
|
|
11
|
-
"secondaryDark": "#bf900d"
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
1
|
+
|
|
2
|
+
module.exports = {
|
|
3
|
+
theme: {
|
|
4
|
+
extend: {
|
|
5
|
+
colors: {
|
|
6
|
+
"uiText": "#141414",
|
|
7
|
+
"uiAccent": "#0f172a",
|
|
8
|
+
"primary": "#002575",
|
|
9
|
+
"primaryDark": "#001f5f",
|
|
10
|
+
"secondary": "#ff612b",
|
|
11
|
+
"secondaryDark": "#bf900d"
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import babel from '@rollup/plugin-babel';
|
|
2
|
+
import { nodeResolve as resolve } from '@rollup/plugin-node-resolve';
|
|
3
|
+
import external from 'rollup-plugin-peer-deps-external';
|
|
4
|
+
import alias from '@rollup/plugin-alias';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
7
|
+
import replace from '@rollup/plugin-replace';
|
|
8
|
+
import dotenv from 'dotenv';
|
|
9
|
+
import postcss from 'rollup-plugin-postcss';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import tailwindcss from 'tailwindcss';
|
|
12
|
+
import autoprefixer from 'autoprefixer';
|
|
13
|
+
|
|
14
|
+
// Load environment variables from .env file
|
|
15
|
+
dotenv.config();
|
|
16
|
+
|
|
17
|
+
// Convert file URL to file path
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = path.dirname(__filename);
|
|
20
|
+
|
|
21
|
+
// Resolve the project root directory
|
|
22
|
+
const projectRootDir = path.resolve(__dirname);
|
|
23
|
+
|
|
24
|
+
const plugins = [
|
|
25
|
+
external(),
|
|
26
|
+
resolve(),
|
|
27
|
+
postcss({
|
|
28
|
+
extensions: ['.css'],
|
|
29
|
+
extract: 'styles/index.css',
|
|
30
|
+
minimize: true,
|
|
31
|
+
plugins: [
|
|
32
|
+
tailwindcss,
|
|
33
|
+
autoprefixer,
|
|
34
|
+
],
|
|
35
|
+
}),
|
|
36
|
+
replace({
|
|
37
|
+
preventAssignment: true,
|
|
38
|
+
'process.env.GOOGLE_MAPS_API_KEY': JSON.stringify(process.env.GOOGLE_MAPS_API_KEY),
|
|
39
|
+
'process.env.GOOGLE_MAPS_API_URL': JSON.stringify(process.env.GOOGLE_MAPS_API_URL),
|
|
40
|
+
'process.env.HC_API_BASE_URL': JSON.stringify(process.env.HC_API_BASE_URL),
|
|
41
|
+
}),
|
|
42
|
+
alias({
|
|
43
|
+
entries: [{ find: '~', replacement: path.resolve(projectRootDir, 'src') }],
|
|
44
|
+
}),
|
|
45
|
+
babel({
|
|
46
|
+
babelHelpers: 'bundled',
|
|
47
|
+
exclude: 'node_modules/**',
|
|
48
|
+
presets: ['@babel/preset-env', '@babel/preset-react'],
|
|
49
|
+
}),
|
|
50
|
+
commonjs(),
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const externalDependencies = [
|
|
54
|
+
'react', 'react-dom', 'react-router-dom', 'form-data',
|
|
55
|
+
'react/jsx-runtime', 'tailwind-merge'
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
export default [
|
|
59
|
+
{
|
|
60
|
+
input: 'src/index.js',
|
|
61
|
+
output: {
|
|
62
|
+
dir: 'dist',
|
|
63
|
+
format: 'es',
|
|
64
|
+
exports: 'named',
|
|
65
|
+
sourcemap: true,
|
|
66
|
+
preserveModules: true,
|
|
67
|
+
preserveModulesRoot: 'src',
|
|
68
|
+
},
|
|
69
|
+
plugins,
|
|
70
|
+
external: externalDependencies,
|
|
71
|
+
treeshake: true,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
input: 'src/services/listingService.js',
|
|
75
|
+
output: {
|
|
76
|
+
dir: 'dist/services',
|
|
77
|
+
format: 'es',
|
|
78
|
+
exports: 'named',
|
|
79
|
+
sourcemap: true,
|
|
80
|
+
preserveModules: true,
|
|
81
|
+
preserveModulesRoot: 'src/services',
|
|
82
|
+
},
|
|
83
|
+
plugins,
|
|
84
|
+
external: externalDependencies,
|
|
85
|
+
treeshake: true,
|
|
86
|
+
},
|
|
87
|
+
];
|
package/src/apis/hcApi.js
CHANGED
|
@@ -1,87 +1,93 @@
|
|
|
1
|
-
import { getClientAuthKey } from '~/clientToken.js';
|
|
2
|
-
const baseURL =
|
|
3
|
-
|
|
4
|
-
const memoryStorage = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
function setStorage(key, value) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getStorage(key) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const login = async () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
import { getClientAuthKey } from '~/clientToken.js';
|
|
2
|
+
const baseURL = process.env.HC_API_BASE_URL;
|
|
3
|
+
|
|
4
|
+
const memoryStorage = {
|
|
5
|
+
authToken: null,
|
|
6
|
+
tokenExpiration: null
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function setStorage(key, value) {
|
|
10
|
+
try {
|
|
11
|
+
sessionStorage.setItem(key, value);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
memoryStorage[key] = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getStorage(key) {
|
|
18
|
+
try {
|
|
19
|
+
return sessionStorage.getItem(key) || memoryStorage[key];
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return memoryStorage[key];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const login = async () => {
|
|
26
|
+
const clientAuthKey = getClientAuthKey();
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(`${baseURL}/auth/login`, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json'
|
|
33
|
+
},
|
|
34
|
+
body: JSON.stringify({
|
|
35
|
+
clientAuthKey: clientAuthKey
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const data = await response.json();
|
|
40
|
+
|
|
41
|
+
if (data.token && data.expiration) {
|
|
42
|
+
setStorage('authToken', data.token);
|
|
43
|
+
setStorage('tokenExpiration', data.expiration);
|
|
44
|
+
return { token: data.token, expiration: data.expiration };
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error('Login failed:', error);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const fetchWithAuth = async (url, options = {}) => {
|
|
53
|
+
let token = getStorage('authToken');
|
|
54
|
+
|
|
55
|
+
const expirationDateTime = getStorage('tokenExpiration');
|
|
56
|
+
const currentTime = new Date();
|
|
57
|
+
|
|
58
|
+
if (!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime) {
|
|
59
|
+
const authResponse = await login();
|
|
60
|
+
token = authResponse.token;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const headers = new Headers(options.headers || {});
|
|
64
|
+
headers.append('Authorization', `Bearer ${token}`);
|
|
65
|
+
|
|
66
|
+
const finalOptions = {
|
|
67
|
+
...options,
|
|
68
|
+
headers
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const response = await fetch(`${baseURL}${url}`, finalOptions);
|
|
72
|
+
|
|
73
|
+
if (!response.ok) throw new Error('Network response was not ok.');
|
|
74
|
+
|
|
75
|
+
return response;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default {
|
|
79
|
+
get: async (url) => {
|
|
80
|
+
const response = await fetchWithAuth(url);
|
|
81
|
+
return await response.json();
|
|
82
|
+
},
|
|
83
|
+
post: async (url, data) => {
|
|
84
|
+
const response = await fetchWithAuth(url, {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json'
|
|
88
|
+
},
|
|
89
|
+
body: JSON.stringify(data)
|
|
90
|
+
});
|
|
91
|
+
return await response.json();
|
|
92
|
+
}
|
|
93
|
+
};
|
package/src/clientToken.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
let clientAuthKey = null;
|
|
2
|
-
|
|
3
|
-
export const setClientAuthKey = (key) => {
|
|
4
|
-
clientAuthKey = key;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const getClientAuthKey = () => {
|
|
8
|
-
return clientAuthKey;
|
|
9
|
-
};
|
|
1
|
+
let clientAuthKey = null;
|
|
2
|
+
|
|
3
|
+
export const setClientAuthKey = (key) => {
|
|
4
|
+
clientAuthKey = key;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const getClientAuthKey = () => {
|
|
8
|
+
return clientAuthKey;
|
|
9
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
|
|
12
|
+
import { getMapConfig } from '~/services/configService';
|
|
13
|
+
import { setClientAuthKey } from '~/clientToken.js';
|
|
14
|
+
|
|
15
|
+
import '../styles/index.css';
|
|
16
|
+
|
|
17
|
+
const libraries = ['places'];
|
|
18
|
+
|
|
19
|
+
export const HireControlMap = ({
|
|
20
|
+
clientToken,
|
|
21
|
+
navigateToDetails = null,
|
|
22
|
+
navigateToEasyApply = null,
|
|
23
|
+
Link = null
|
|
24
|
+
}) => {
|
|
25
|
+
const [siteConfig, setSiteconfig] = useState(null);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setClientAuthKey(clientToken);
|
|
29
|
+
const fetchSiteConfig = async () => {
|
|
30
|
+
try {
|
|
31
|
+
const configData = await getMapConfig(clientToken);
|
|
32
|
+
setSiteconfig(configData);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('Failed to fetch site configuration:', error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
fetchSiteConfig();
|
|
39
|
+
}, [clientToken]);
|
|
40
|
+
|
|
41
|
+
const { isLoaded } = useLoadScript({
|
|
42
|
+
googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY,
|
|
43
|
+
libraries: libraries,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div>
|
|
48
|
+
{isLoaded && siteConfig && (
|
|
49
|
+
<HomeBody
|
|
50
|
+
siteConfig={siteConfig}
|
|
51
|
+
navigateToDetails={navigateToDetails}
|
|
52
|
+
navigateToEasyApply={navigateToEasyApply}
|
|
53
|
+
Link={Link}
|
|
54
|
+
/>
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const HomeBody = ({ siteConfig, navigateToDetails, navigateToEasyApply, Link }) => {
|
|
61
|
+
const resetFilters = false;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<MapListProvider
|
|
65
|
+
siteConfig={siteConfig}
|
|
66
|
+
resetFilters={resetFilters}
|
|
67
|
+
avigateToDetails={navigateToDetails}
|
|
68
|
+
navigateToEasyApply={navigateToEasyApply}
|
|
69
|
+
Link={Link}
|
|
70
|
+
>
|
|
71
|
+
<MapProvider resetFilters={resetFilters}>
|
|
72
|
+
<PlacesProvider
|
|
73
|
+
placeMappings={siteConfig.pointsOfInterestConfig.placeMappings ?? {}}
|
|
74
|
+
markerColors={{
|
|
75
|
+
fillColor: siteConfig.colors.primary,
|
|
76
|
+
strokeColor: siteConfig.colors.primaryDark,
|
|
77
|
+
selectedFillColor: siteConfig.colors.secondary,
|
|
78
|
+
selectedStrokeColor: siteConfig.colors.secondaryDark,
|
|
79
|
+
placeMarkers: {
|
|
80
|
+
colors: siteConfig.pointsOfInterestConfig.placeMarkerColors,
|
|
81
|
+
size: siteConfig.pointsOfInterestConfig.placeMarkerSize,
|
|
82
|
+
},
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<Grid
|
|
86
|
+
as='section'
|
|
87
|
+
id='job-search-interface'
|
|
88
|
+
columns='md:hc-grid-cols-[1fr_2.5fr] lg:hc-grid-cols-[1fr_3.5fr]'
|
|
89
|
+
gap='hc-gap-0'
|
|
90
|
+
autoRows={false}
|
|
91
|
+
className='hc-items-stretch hc-h-screen hc-min-h-[30rem] hc-divide-x hc-divide-uiAccent/20'
|
|
92
|
+
>
|
|
93
|
+
<Grid.Item className='hc-bg-gray-100'>
|
|
94
|
+
<Filter showMap={siteConfig.showMap} className='hc-hidden md:hc-block' />
|
|
95
|
+
</Grid.Item>
|
|
96
|
+
<MapList
|
|
97
|
+
markerConfigs={{
|
|
98
|
+
fillColor: siteConfig.colors.primary,
|
|
99
|
+
strokeColor: siteConfig.colors.primaryDark,
|
|
100
|
+
selectedFillColor: siteConfig.colors.secondary,
|
|
101
|
+
selectedStrokeColor: siteConfig.colors.secondaryDark,
|
|
102
|
+
placeMarkers: {
|
|
103
|
+
colors: siteConfig.pointsOfInterestConfig.placeMarkerColors,
|
|
104
|
+
size: siteConfig.pointsOfInterestConfig.placeMarkerSize,
|
|
105
|
+
},
|
|
106
|
+
}}
|
|
107
|
+
showMap={siteConfig.showMap}
|
|
108
|
+
fieldsShown={siteConfig.fieldsShown}
|
|
109
|
+
specialFeatures={siteConfig.specialFeatures}
|
|
110
|
+
fieldNames={siteConfig.fieldNames}
|
|
111
|
+
placeMappings={siteConfig.pointsOfInterestConfig.placeMappings ?? {}}
|
|
112
|
+
/>
|
|
113
|
+
</Grid>
|
|
114
|
+
</PlacesProvider>
|
|
115
|
+
</MapProvider>
|
|
116
|
+
</MapListProvider>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default HireControlMap;
|