@abcagency/hc-ui-components 1.3.57 → 1.3.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/hcApi.js +85 -85
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/clientToken.js.map +1 -1
- package/dist/components/containers/accordions/filter-container.js.map +1 -1
- package/dist/components/containers/accordions/filter-item-container.js +4 -2
- package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js +4 -2
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
- package/dist/components/containers/list/item-list-container.js +21 -21
- package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/buttons/commute-pill.js.map +1 -1
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/list/header.js.map +1 -1
- package/dist/components/modules/list/item-list.js +40 -40
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/constants/placeTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +83 -83
- package/dist/contexts/mapListContext.js +190 -190
- package/dist/contexts/trackEventContext.js.map +1 -1
- package/dist/hooks/useList.js.map +1 -1
- package/dist/services/configService.js +9 -9
- package/dist/services/googlePlacesNearbyService.js +32 -32
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +34 -34
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +9 -9
- package/dist/services/listingService.js +24 -24
- package/dist/services/recruiterService.js +10 -10
- package/dist/types/apis/hcApi.d.ts +5 -5
- package/dist/types/clientToken.d.ts +2 -2
- package/dist/types/components/containers/accordions/map-accordion-item-container.d.ts +12 -12
- package/dist/types/components/containers/jobListing/listing-details-container.d.ts +6 -6
- package/dist/types/components/containers/list/item-list-container.d.ts +9 -9
- package/dist/types/components/containers/list/list-item/list-item-container.d.ts +14 -14
- package/dist/types/components/modules/accordions/MapAccordionItem.d.ts +10 -10
- package/dist/types/components/modules/accordions/default.d.ts +19 -19
- package/dist/types/components/modules/buttons/button-group-apply.d.ts +24 -24
- package/dist/types/components/modules/buttons/commute-pill.d.ts +5 -5
- package/dist/types/components/modules/buttons/default.d.ts +48 -48
- package/dist/types/components/modules/buttons/pill-wrapper.d.ts +3 -3
- package/dist/types/components/modules/dialogs/apply-dialog.d.ts +8 -8
- package/dist/types/components/modules/filter/sort.d.ts +8 -8
- package/dist/types/components/modules/grid.d.ts +8 -8
- package/dist/types/components/modules/icon.d.ts +10 -10
- package/dist/types/components/modules/jobListing/listing-details.d.ts +18 -18
- package/dist/types/components/modules/list/field-mapper.d.ts +10 -10
- package/dist/types/components/modules/list/header-item.d.ts +11 -11
- package/dist/types/components/modules/list/header.d.ts +12 -12
- package/dist/types/components/modules/list/item-expand-card/index.d.ts +7 -7
- package/dist/types/components/modules/list/item-expand-card/recruiter-contact-nav.d.ts +17 -17
- package/dist/types/components/modules/list/item-expand-card/recruiter-details.d.ts +21 -21
- package/dist/types/components/modules/list/item-expand-card/recruiter-headshot.d.ts +8 -8
- package/dist/types/components/modules/list/item-list.d.ts +20 -20
- package/dist/types/components/modules/list/list-item/list-item.d.ts +3 -3
- package/dist/types/constants/eventTypes.d.ts +14 -14
- package/dist/types/contexts/mapContext.d.ts +29 -29
- package/dist/types/contexts/mapListContext.d.ts +61 -61
- package/dist/types/contexts/trackEventContext.d.ts +6 -6
- package/dist/types/enums/SectionType.d.ts +9 -9
- package/dist/types/hooks/useList.d.ts +13 -13
- package/dist/types/services/configService.d.ts +6 -6
- package/dist/types/services/googlePlacesNearbyService.d.ts +5 -5
- package/dist/types/services/listingAggregatorService.d.ts +12 -12
- package/dist/types/services/listingEntityService.d.ts +6 -6
- package/dist/types/services/listingService.d.ts +9 -9
- package/dist/types/services/recruiterService.d.ts +6 -6
- package/dist/types/types/Address.d.ts +7 -7
- package/dist/types/types/ContentSection.d.ts +8 -8
- package/dist/types/types/GetListingParams.d.ts +8 -8
- package/dist/types/types/LatLng.d.ts +4 -4
- package/dist/types/types/ListingEntity.d.ts +10 -10
- package/dist/types/types/ListingFields.d.ts +25 -25
- package/dist/types/types/Listings.d.ts +31 -31
- package/dist/types/types/Recruiter.d.ts +9 -9
- package/dist/types/types/SimilarListing.d.ts +24 -24
- package/dist/types/types/config/Colors.d.ts +8 -8
- package/dist/types/types/config/MapConfig.d.ts +30 -30
- package/dist/types/types/config/PointsOfInterestConfig.d.ts +13 -13
- package/dist/types/types/config/SearchConfig.d.ts +4 -4
- package/dist/types/util/filterUtil.d.ts +28 -28
- package/dist/types/util/loading.d.ts +3 -3
- package/dist/types/util/localStorageUtil.d.ts +3 -3
- package/dist/types/util/mapUtil.d.ts +16 -16
- package/dist/types/util/sortUtil.d.ts +1 -1
- package/dist/types/util/stringUtils.d.ts +1 -1
- package/dist/types/util/urlFilterUtil.d.ts +8 -8
- package/dist/util/filterUtil.js +2 -2
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js.map +1 -1
- package/dist/util/localStorageUtil.js +37 -37
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/sortUtil.js.map +1 -1
- package/dist/util/stringUtils.js.map +1 -1
- package/dist/util/urlFilterUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/apis/hcApi.ts +109 -109
- package/src/clientToken.js +9 -9
- package/src/components/containers/accordions/filter-container.js +48 -48
- package/src/components/containers/accordions/filter-item-container.js +2 -0
- package/src/components/containers/accordions/map-accordion-item-container.js +70 -70
- package/src/components/containers/filter/filter-item-container.js +2 -1
- package/src/components/containers/jobListing/listing-details-container.js +40 -40
- package/src/components/containers/list/list-item/list-item-container.js +43 -43
- package/src/components/containers/maps/map-container.js +249 -249
- package/src/components/modules/accordions/MapAccordionItem.js +30 -30
- package/src/components/modules/accordions/default.js +171 -171
- package/src/components/modules/buttons/commute-pill.js +22 -22
- package/src/components/modules/buttons/default.js +194 -194
- package/src/components/modules/buttons/items-pill.js +35 -35
- package/src/components/modules/buttons/pill-wrapper.js +27 -27
- package/src/components/modules/buttons/show-all-button.js +19 -19
- package/src/components/modules/cards/default.js +167 -167
- package/src/components/modules/cards/filter.js +56 -56
- package/src/components/modules/filter/item.js +69 -69
- package/src/components/modules/filter/sort.js +83 -83
- package/src/components/modules/grid.js +54 -54
- package/src/components/modules/icon.js +33 -33
- package/src/components/modules/list/header.js +51 -51
- package/src/components/modules/list/item-expand-card/recruiter-contact-nav.js +50 -50
- package/src/components/modules/list/item-expand-card/recruiter-details.js +68 -68
- package/src/components/modules/list/item-expand-card/recruiter-headshot.js +22 -22
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/map.js +64 -64
- package/src/components/modules/maps/place-marker.js +41 -41
- package/src/components/modules/maps/tabs.js +81 -81
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/trackEventContext.js +14 -14
- package/src/enums/SectionType.ts +9 -9
- package/src/hooks/useList.js +89 -89
- package/src/index.js +3 -3
- package/src/services/googlePlacesNearbyService.ts +42 -42
- package/src/services/listingAggregatorService.ts +76 -76
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +22 -22
- package/src/util/filterUtil.js +311 -310
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.ts +34 -34
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/src/util/urlFilterUtil.js +85 -85
- package/dist/types/contexts/themeContext.d.ts +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterUtil.js","sources":["../../src/util/filterUtil.js"],"sourcesContent":["/* eslint-disable no-undef */\r\nimport { getDistinctItemsByProximity } from '~/util/mapUtil';\r\n\r\nimport Fuse from 'fuse.js';\r\n\r\nexport const getFilterOptions = (listings, filteredListings, field, excludeZeroCount = null) => {\r\n\tconst options = new Set();\r\n\tlistings.forEach(listing => {\r\n\t\tif (listing.fields[field]) {\r\n\t\t\toptions.add(listing.fields[field]);\r\n\t\t}\r\n\t});\r\n\r\n\tconst optionCounts = {};\r\n\toptions.forEach(option => {\r\n\t\toptionCounts[option] = 0;\r\n\t});\r\n\r\n\tfilteredListings.forEach(listing => {\r\n\t\tconst value = listing.fields[field];\r\n\t\tif (value && optionCounts.hasOwnProperty(value)) {\r\n\t\t\toptionCounts[value] += 1;\r\n\t\t}\r\n\t});\r\n\r\n\treturn Array.from(options)\r\n\t\t.sort()\r\n\t\t.map(option => ({\r\n\t\t\tname: option,\r\n\t\t\tcount: optionCounts[option] || 0\r\n\t\t}))\r\n\t\t.filter(option => !(excludeZeroCount === true && option.count === 0));\r\n};\r\n\r\nexport const getSpecialFeatureOptions = (listings, filteredListings, siteConfig, favorites) => {\r\n\tconst specialFeatures = siteConfig.specialFeatures;\r\n\tconst featureCounts = Object.keys(specialFeatures).sort().reduce((acc, key) => {\r\n\t\tacc[specialFeatures[key]] = 0;\r\n\t\treturn acc;\r\n\t}, {});\r\n\r\n\tfilteredListings.forEach(listing => {\r\n\t\tObject.entries(specialFeatures).forEach(([featureKey, featureName]) => {\r\n\t\t\tif (listing.fields[featureKey] == 1) {\r\n\t\t\t\tfeatureCounts[featureName] += 1;\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\tconst specialFeatureOptions = Object.entries(featureCounts).map(([name, count]) => ({\r\n\t\tname,\r\n\t\tcount\r\n\t}));\r\n\r\n\tfor (let option of specialFeatureOptions) {\r\n\t\tif (option.name === 'Favorite') {\r\n\t\t\toption.count = filteredListings.filter(x => favorites.includes(x.id)).length;\r\n\t\t}\r\n\t}\r\n\r\n\treturn specialFeatureOptions;\r\n};\r\n\r\nconst getPointsOfInterestOptions = pointsOfInterestNames => {\r\n\treturn Object.entries(pointsOfInterestNames).sort().map(([key, name]) => ({\r\n\t\tkey,\r\n\t\tname\r\n\t}));\r\n};\r\n\r\nexport const generateFilterOptions = (\r\n\tfilteredListings,\r\n\tallListings,\r\n\tsiteConfig,\r\n\tfilterOptions,\r\n\tparentField,\r\n\tfavorites,\r\n\tselectedFilters\r\n) => {\r\n\tif (allListings.length > 0) {\r\n\t\tconst dynamicFilters = siteConfig.fieldFiltersShown.map(fieldName => {\r\n\t\t\tif (fieldName === parentField && filterOptions?.filters) {\r\n\t\t\t\treturn filterOptions.filters.find(filter => filter.id === fieldName);\r\n\t\t\t}\r\n\t\t\tif(fieldName == 'categoryClass'){\r\n\t\t\t\treturn {\r\n\t\t\t\t\tid: fieldName,\r\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\t\titems: getFilterOptions(allListings, allListings, fieldName)\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tif(fieldName == 'category' && selectedFilters.categoryClass){\r\n\t\t\t\tconst categoryClassKeys = Object.keys(selectedFilters.categoryClass);\r\n\t\t\t\tconst filteredListings = allListings.filter(\r\n\t\t\t\t\tx => categoryClassKeys.includes(x.fields?.categoryClass)\r\n\t\t\t\t);\r\n\t\t\t\treturn {\r\n\t\t\t\t\tid: fieldName,\r\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\t\titems: getFilterOptions(allListings, filteredListings, fieldName, false)\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tif (fieldName == \"specialFeatures\") {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tid: fieldName,\r\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\t\titems: getSpecialFeatureOptions(allListings, filteredListings, siteConfig, favorites).sort()\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\treturn {\r\n\t\t\t\tid: fieldName,\r\n\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\titems: getFilterOptions(allListings, filteredListings, fieldName)\r\n\t\t\t};\r\n\t\t});\r\n\r\n\t\tconst locations =\r\n\t\t\tsiteConfig.locationFiltersShown.map((fieldName, index) => {\r\n\t\t\t\tlet locationFilteredListings = allListings;\r\n\t\t\t\tlocationFilteredListings = allListings.filter(listing => {\r\n\t\t\t\t\treturn Object.entries(selectedFilters).every(([key, value]) => {\r\n\t\t\t\t\t\tif (siteConfig.locationFiltersShown.includes(key)) return true;\r\n\t\t\t\t\t\tif (value && typeof value === 'object' && value[listing.fields[key]] === true) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t\tif (index === 0) {\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tid: fieldName,\r\n\t\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\t\t\titems: getFilterOptions(allListings, locationFilteredListings, fieldName, true)\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\t\t\t\t if (fieldName === 'entityName' && filterOptions?.locations) {\r\n\t\t\t\t\tconst cityIncluded = siteConfig.locationFiltersShown.includes('city');\r\n\t\t\t\t\tconst stateIncluded = siteConfig.locationFiltersShown.includes('state');\r\n\t\t\t\t\tconst cityStateIncluded = siteConfig.locationFiltersShown.includes('cityState');\r\n\t\t\t\t\tconst uniqueCities = cityIncluded ? [...new Set(filteredListings.map(listing => listing.fields.city))] : [];\r\n\t\t\t\t\tconst uniqueStates = stateIncluded ? [...new Set(filteredListings.map(listing => listing.fields.state))] : [];\r\n\t\t\t\t\tconst uniqueCityStates = cityStateIncluded ? [...new Set(filteredListings.map(listing => listing.fields.cityState))] : [];\r\n\t\t\t\t\tconst filteredByLocation = locationFilteredListings.filter(listing => {\r\n\t\t\t\t\t\tconst cityMatches = cityIncluded ? uniqueCities.includes(listing.fields.city) : true;\r\n\t\t\t\t\t\tconst stateMatches = stateIncluded ? uniqueStates.includes(listing.fields.state) : true;\r\n\t\t\t\t\t\tconst cityStateMatches = cityStateIncluded ? uniqueCityStates.includes(listing.fields.cityState) : true;\r\n\t\t\t\t\t\treturn cityMatches && stateMatches && cityStateMatches;\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tid: fieldName,\r\n\t\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\t\t\titems: getFilterOptions(allListings, filteredByLocation, fieldName, true)\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\t\t\t\tif (fieldName === 'city') {\r\n\t\t\t\t\tif (siteConfig.locationFiltersShown.includes('state') && selectedFilters.state) {\r\n\t\t\t\t\t\tconst selectedStates = Object.keys(selectedFilters.state).filter(\r\n\t\t\t\t\t\t\tstate => selectedFilters.state[state] === true\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tconst filteredByLocation = locationFilteredListings.filter(listing =>\r\n\t\t\t\t\t\t\tselectedStates.includes(listing.fields.state)\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\tid: fieldName,\r\n\t\t\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\t\t\t\titems: getFilterOptions(allListings, filteredByLocation, fieldName, true)\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn {\r\n\t\t\t\t\tid: fieldName,\r\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\r\n\t\t\t\t\titems: getFilterOptions(allListings, filteredListings, fieldName, true)\r\n\t\t\t\t};\r\n\t\t\t});\r\n\r\n\t\tconst pointsOfInterest = {\r\n\t\t\tid: \"pointsOfInterest\",\r\n\t\t\ttitle: siteConfig.pointsOfInterestConfig.title,\r\n\t\t\titems: getPointsOfInterestOptions(\r\n\t\t\t\tsiteConfig.pointsOfInterestConfig.pointsOfInterestNames\r\n\t\t\t)\r\n\t\t};\r\n\r\n\t\treturn {\r\n\t\t\tfilters: dynamicFilters,\r\n\t\t\tlocations: locations,\r\n\t\t\tpointsOfInterest: pointsOfInterest\r\n\t\t};\r\n\t}\r\n\r\n\treturn null;\r\n};\r\n\r\nexport const applyFilters = (\r\n\tallListings,\r\n\tselectedFilters,\r\n\tquery,\r\n\tlistingEntities,\r\n\tfavorites,\r\n\tsiteConfig\r\n) => {\r\n\tlet results = allListings;\r\n\tlet invertedSpecialFeaturesMap;\r\n\tif (siteConfig.specialFeatures) {\r\n\t\tinvertedSpecialFeaturesMap = Object.entries(siteConfig.specialFeatures).reduce((acc, [key, value]) => {\r\n\t\t\tacc[value] = key;\r\n\t\t\treturn acc;\r\n\t\t}, {});\r\n\r\n\t}\r\n\tconst hasFavorite = !!selectedFilters.specialFeatures && !!selectedFilters.specialFeatures.Favorite;\r\n\r\n\tif (hasFavorite && selectedFilters.specialFeatures.Favorite == true) {\r\n\t\tresults = results.filter(x => favorites.includes(x.id));\r\n\t}\r\n\tvar favorite;\r\n\tif (hasFavorite) {\r\n\t\tfavorite = selectedFilters.specialFeatures.Favorite;\r\n\t\tdelete selectedFilters.specialFeatures.Favorite;\r\n\t}\r\n\tfor (const [field, filterItems] of Object.entries(selectedFilters)) {\r\n\t\tconst formattedField = field;\r\n\t\tif (field === \"pointsOfInterest\") continue;\r\n\t\tif (field === \"specialFeatures\" && invertedSpecialFeaturesMap && Object.keys(filterItems).length > 0) {\r\n\t\t\tresults = results.filter(listing => {\r\n\t\t\t\treturn Object.entries(filterItems).some(([filterName, filterValue]) => {\r\n\t\t\t\t\tconst listingFieldName = invertedSpecialFeaturesMap[filterName];\r\n\t\t\t\t\treturn filterValue && listing.fields[listingFieldName] == 1;\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t} else if (Object.keys(filterItems).length > 0) {\r\n\t\t\tresults = results.filter(listing =>\r\n\t\t\t\tfilterItems.hasOwnProperty(listing.fields[formattedField])\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\tif (query) {\r\n\t\tresults = searchResults(results, query);\r\n\t}\r\n\tconst distinctItems = getDistinctItemsByProximity(results, listingEntities);\r\n\tif (hasFavorite) {\r\n\t\tselectedFilters.specialFeatures.Favorite = favorite;\r\n\t}\r\n\treturn { filteredListings: results, mapItems: distinctItems };\r\n};\r\n\r\nfunction searchResults(results, query) {\r\n\tconst fields = [\r\n\t\t'id',\r\n\t\t'fields.posted',\r\n\t\t'fields.subtitle',\r\n\t\t'fields.education',\r\n\t\t'fields.position',\r\n\t\t'fields.category',\r\n\t\t'fields.categoryclass',\r\n\t\t'fields.shift',\r\n\t\t'fields.citystate',\r\n\t\t'fields.city',\r\n\t\t'fields.state',\r\n\t\t'fields.schedule',\r\n\t\t'fields.customflag1',\r\n\t\t'fields.bonus',\r\n\t\t'fields.remote',\r\n\t\t'fields.useclientjoburl',\r\n\t\t'fields.datecreated',\r\n\t\t'fields.datelastedited'\r\n\t];\r\n\r\n\tconst options = {\r\n\t\tincludeScore: true,\r\n\t\tthreshold: 0.3,\r\n\t\tkeys: fields\r\n\t};\r\n\r\n\tconst fuse = new Fuse(results, options);\r\n\tconst lowerCaseQuery = query.toLowerCase();\r\n\tconst queryTerms = lowerCaseQuery.split(' ');\r\n\r\n\tconst exactIdMatch = results.find(result => result.id.toString() === query);\r\n\tif (exactIdMatch) {\r\n\t\treturn [exactIdMatch];\r\n\t}\r\n\r\n\tconst fuseQuery = queryTerms.map(term => ({\r\n\t\t$or: fields.map(field => ({ [field]: term }))\r\n\t}));\r\n\r\n\tconst fuseResults = fuse.search({ $and: fuseQuery });\r\n\r\n\treturn fuseResults.map(result => result.item);\r\n}\r\n\r\nexport const filterListingsByLocation = (\r\n\tallListings,\r\n\tselectedLocation,\r\n\tlistingEntities\r\n) => {\r\n\tlet results = allListings;\r\n\tif (selectedLocation !== null) {\r\n\t\tresults = results.filter(item =>\r\n\t\t\tselectedLocation.items.hasOwnProperty(item.id)\r\n\t\t);\r\n\t}\r\n\tconst mapItems = getDistinctItemsByProximity(results, listingEntities);\r\n\treturn { filteredListings: results, mapItems: mapItems };\r\n};\r\n"],"names":["getFilterOptions","listings","filteredListings","field","excludeZeroCount","arguments","length","undefined","options","Set","forEach","listing","fields","add","optionCounts","option","value","hasOwnProperty","Array","from","sort","map","name","count","filter","getSpecialFeatureOptions","siteConfig","favorites","specialFeatures","featureCounts","Object","keys","reduce","acc","key","entries","_ref","_ref2","_slicedToArray","featureKey","featureName","specialFeatureOptions","_ref3","_ref4","_iterator","_createForOfIteratorHelper","_step","s","n","done","x","includes","id","err","e","f","getPointsOfInterestOptions","pointsOfInterestNames","_ref5","_ref6","generateFilterOptions","allListings","filterOptions","parentField","selectedFilters","dynamicFilters","fieldFiltersShown","fieldName","filters","find","title","fieldNames","items","categoryClass","categoryClassKeys","_x$fields","locations","locationFiltersShown","index","locationFilteredListings","every","_ref7","_ref8","_typeof","cityIncluded","stateIncluded","cityStateIncluded","uniqueCities","_toConsumableArray","city","uniqueStates","state","uniqueCityStates","cityState","filteredByLocation","cityMatches","stateMatches","cityStateMatches","selectedStates","pointsOfInterest","pointsOfInterestConfig","applyFilters","query","listingEntities","results","invertedSpecialFeaturesMap","_ref9","_ref10","hasFavorite","Favorite","favorite","_loop","_Object$entries$_i","_Object$entries","_i","filterItems","formattedField","some","_ref11","_ref12","filterName","filterValue","listingFieldName","searchResults","distinctItems","getDistinctItemsByProximity","mapItems","includeScore","threshold","fuse","Fuse","lowerCaseQuery","toLowerCase","queryTerms","split","exactIdMatch","result","toString","fuseQuery","term","$or","_defineProperty","fuseResults","search","$and","item","filterListingsByLocation","selectedLocation"],"mappings":";;;;AAKO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,QAAQ,EAAEC,gBAAgB,EAAEC,KAAK,EAA8B;AAAA,EAAA,IAA5BC,gBAAgB,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,IAAI,CAAA;AAC1F,EAAA,IAAMG,OAAO,GAAG,IAAIC,GAAG,EAAE,CAAA;AACzBR,EAAAA,QAAQ,CAACS,OAAO,CAAC,UAAAC,OAAO,EAAI;AAC3B,IAAA,IAAIA,OAAO,CAACC,MAAM,CAACT,KAAK,CAAC,EAAE;MAC1BK,OAAO,CAACK,GAAG,CAACF,OAAO,CAACC,MAAM,CAACT,KAAK,CAAC,CAAC,CAAA;AACnC,KAAA;AACD,GAAC,CAAC,CAAA;EAEF,IAAMW,YAAY,GAAG,EAAE,CAAA;AACvBN,EAAAA,OAAO,CAACE,OAAO,CAAC,UAAAK,MAAM,EAAI;AACzBD,IAAAA,YAAY,CAACC,MAAM,CAAC,GAAG,CAAC,CAAA;AACzB,GAAC,CAAC,CAAA;AAEFb,EAAAA,gBAAgB,CAACQ,OAAO,CAAC,UAAAC,OAAO,EAAI;AACnC,IAAA,IAAMK,KAAK,GAAGL,OAAO,CAACC,MAAM,CAACT,KAAK,CAAC,CAAA;IACnC,IAAIa,KAAK,IAAIF,YAAY,CAACG,cAAc,CAACD,KAAK,CAAC,EAAE;AAChDF,MAAAA,YAAY,CAACE,KAAK,CAAC,IAAI,CAAC,CAAA;AACzB,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOE,KAAK,CAACC,IAAI,CAACX,OAAO,CAAC,CACxBY,IAAI,EAAE,C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,IAAAA,QAAQ,EAAEA,QAAAA;GAAU,CAAA;AACzD;;;;"}
|
|
1
|
+
{"version":3,"file":"filterUtil.js","sources":["../../src/util/filterUtil.js"],"sourcesContent":["/* eslint-disable no-undef */\nimport { getDistinctItemsByProximity } from '~/util/mapUtil';\n\nimport Fuse from 'fuse.js';\n\nexport const getFilterOptions = (listings, filteredListings, field, excludeZeroCount = null) => {\n\tconst options = new Set();\n\tlistings.forEach(listing => {\n\t\tif (listing.fields[field]) {\n\t\t\toptions.add(listing.fields[field]);\n\t\t}\n\t});\n\n\tconst optionCounts = {};\n\toptions.forEach(option => {\n\t\toptionCounts[option] = 0;\n\t});\n\n\tfilteredListings.forEach(listing => {\n\t\tconst value = listing.fields[field];\n\t\tif (value && optionCounts.hasOwnProperty(value)) {\n\t\t\toptionCounts[value] += 1;\n\t\t}\n\t});\n\n\treturn Array.from(options)\n\t\t.sort()\n\t\t.map(option => ({\n\t\t\tname: option,\n\t\t\tcount: optionCounts[option] || 0\n\t\t}))\n\t\t.filter(option => !(excludeZeroCount === true && option.count === 0));\n};\n\nexport const getSpecialFeatureOptions = (listings, filteredListings, siteConfig, favorites) => {\n\tconst specialFeatures = siteConfig.specialFeatures;\n\tconst featureCounts = Object.keys(specialFeatures).sort().reduce((acc, key) => {\n\t\tacc[specialFeatures[key]] = 0;\n\t\treturn acc;\n\t}, {});\n\n\tfilteredListings.forEach(listing => {\n\t\tObject.entries(specialFeatures).forEach(([featureKey, featureName]) => {\n\t\t\tif (listing.fields[featureKey] == 1) {\n\t\t\t\tfeatureCounts[featureName] += 1;\n\t\t\t}\n\t\t});\n\t});\n\n\tconst specialFeatureOptions = Object.entries(featureCounts).map(([name, count]) => ({\n\t\tname,\n\t\tcount\n\t}));\n\n\tfor (let option of specialFeatureOptions) {\n\t\tif (option.name === 'Favorite') {\n\t\t\toption.count = filteredListings.filter(x => favorites.includes(x.id)).length;\n\t\t}\n\t}\n\n\treturn specialFeatureOptions;\n};\n\nconst getPointsOfInterestOptions = pointsOfInterestNames => {\n\treturn Object.entries(pointsOfInterestNames).sort().map(([key, name]) => ({\n\t\tkey,\n\t\tname\n\t}));\n};\n\nexport const generateFilterOptions = (\n\tfilteredListings,\n\tallListings,\n\tsiteConfig,\n\tfilterOptions,\n\tparentField,\n\tfavorites,\n\tselectedFilters\n) => {\n\tif (allListings.length > 0) {\n\t\tconst dynamicFilters = siteConfig.fieldFiltersShown.map(fieldName => {\n\t\t\tif (fieldName === parentField && filterOptions?.filters) {\n\t\t\t\treturn filterOptions.filters.find(filter => filter.id === fieldName);\n\t\t\t}\n\t\t\tif(fieldName == 'categoryClass'){\n\t\t\t\treturn {\n\t\t\t\t\tid: fieldName,\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\t\titems: getFilterOptions(allListings, allListings, fieldName)\n\t\t\t\t};\n\t\t\t}\n\t\t\tif(fieldName == 'category' && selectedFilters.categoryClass){\n\t\t\t\tconst categoryClassKeys = Object.keys(selectedFilters.categoryClass);\n\t\t\t\tconst filteredListings = allListings.filter(\n\t\t\t\t\tx => categoryClassKeys.includes(x.fields?.categoryClass)\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tid: fieldName,\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\t\titems: getFilterOptions(allListings, filteredListings, fieldName, false)\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (fieldName == \"specialFeatures\") {\n\t\t\t\treturn {\n\t\t\t\t\tid: fieldName,\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\t\titems: getSpecialFeatureOptions(allListings, filteredListings, siteConfig, favorites).sort()\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: fieldName,\n\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\titems: getFilterOptions(allListings, filteredListings, fieldName)\n\t\t\t};\n\t\t});\n\n\t\tconst locations =\n\t\t\tsiteConfig.locationFiltersShown.map((fieldName, index) => {\n\t\t\t\tlet locationFilteredListings = allListings;\n\t\t\t\tlocationFilteredListings = allListings.filter(listing => {\n\t\t\t\t\treturn Object.entries(selectedFilters).every(([key, value]) => {\n\t\t\t\t\t\tif (siteConfig.locationFiltersShown.includes(key)) return true;\n\t\t\t\t\t\tif (value && typeof value === 'object' && value[listing.fields[key]] === true) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tif (index === 0) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: fieldName,\n\t\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\t\t\titems: getFilterOptions(allListings, locationFilteredListings, fieldName, true)\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t if (fieldName === 'entityName' && filterOptions?.locations) {\n\t\t\t\t\tconst cityIncluded = siteConfig.locationFiltersShown.includes('city');\n\t\t\t\t\tconst stateIncluded = siteConfig.locationFiltersShown.includes('state');\n\t\t\t\t\tconst cityStateIncluded = siteConfig.locationFiltersShown.includes('cityState');\n\t\t\t\t\tconst uniqueCities = cityIncluded ? [...new Set(filteredListings.map(listing => listing.fields.city))] : [];\n\t\t\t\t\tconst uniqueStates = stateIncluded ? [...new Set(filteredListings.map(listing => listing.fields.state))] : [];\n\t\t\t\t\tconst uniqueCityStates = cityStateIncluded ? [...new Set(filteredListings.map(listing => listing.fields.cityState))] : [];\n\t\t\t\t\tconst filteredByLocation = locationFilteredListings.filter(listing => {\n\t\t\t\t\t\tconst cityMatches = cityIncluded ? uniqueCities.includes(listing.fields.city) : true;\n\t\t\t\t\t\tconst stateMatches = stateIncluded ? uniqueStates.includes(listing.fields.state) : true;\n\t\t\t\t\t\tconst cityStateMatches = cityStateIncluded ? uniqueCityStates.includes(listing.fields.cityState) : true;\n\t\t\t\t\t\treturn cityMatches && stateMatches && cityStateMatches;\n\t\t\t\t\t});\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: fieldName,\n\t\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\t\t\titems: getFilterOptions(allListings, filteredByLocation, fieldName, true)\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (fieldName === 'city') {\n\t\t\t\t\tif (siteConfig.locationFiltersShown.includes('state') && selectedFilters.state) {\n\t\t\t\t\t\tconst selectedStates = Object.keys(selectedFilters.state).filter(\n\t\t\t\t\t\t\tstate => selectedFilters.state[state] === true\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst filteredByLocation = locationFilteredListings.filter(listing =>\n\t\t\t\t\t\t\tselectedStates.includes(listing.fields.state)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tid: fieldName,\n\t\t\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\t\t\t\titems: getFilterOptions(allListings, filteredByLocation, fieldName, true)\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tid: fieldName,\n\t\t\t\t\ttitle: siteConfig.fieldNames[fieldName],\n\t\t\t\t\titems: getFilterOptions(allListings, filteredListings, fieldName, true)\n\t\t\t\t};\n\t\t\t});\n\n\t\tconst pointsOfInterest = {\n\t\t\tid: \"pointsOfInterest\",\n\t\t\ttitle: siteConfig.pointsOfInterestConfig.title,\n\t\t\titems: getPointsOfInterestOptions(\n\t\t\t\tsiteConfig.pointsOfInterestConfig.pointsOfInterestNames\n\t\t\t)\n\t\t};\n\n\t\treturn {\n\t\t\tfilters: dynamicFilters,\n\t\t\tlocations: locations,\n\t\t\tpointsOfInterest: pointsOfInterest\n\t\t};\n\t}\n\n\treturn null;\n};\n\nexport const applyFilters = (\n\tallListings,\n\tselectedFilters,\n\tquery,\n\tlistingEntities,\n\tfavorites,\n\tsiteConfig\n) => {\n\tlet results = allListings;\n\tlet invertedSpecialFeaturesMap;\n\tif (siteConfig.specialFeatures) {\n\t\tinvertedSpecialFeaturesMap = Object.entries(siteConfig.specialFeatures).reduce((acc, [key, value]) => {\n\t\t\tacc[value] = key;\n\t\t\treturn acc;\n\t\t}, {});\n\n\t}\n\tconst hasFavorite = !!selectedFilters.specialFeatures && !!selectedFilters.specialFeatures.Favorite;\n\n\tif (hasFavorite && selectedFilters.specialFeatures.Favorite == true) {\n\t\tresults = results.filter(x => favorites.includes(x.id));\n\t}\n\tvar favorite;\n\tif (hasFavorite) {\n\t\tfavorite = selectedFilters.specialFeatures.Favorite;\n\t\tdelete selectedFilters.specialFeatures.Favorite;\n\t}\n\tfor (const [field, filterItems] of Object.entries(selectedFilters)) {\n\t\tconst formattedField = field;\n\t\tif (field === \"pointsOfInterest\") continue;\n\t\tif (field === \"specialFeatures\" && invertedSpecialFeaturesMap && Object.keys(filterItems).length > 0) {\n\t\t\tresults = results.filter(listing => {\n\t\t\t\treturn Object.entries(filterItems).some(([filterName, filterValue]) => {\n\t\t\t\t\tconst listingFieldName = invertedSpecialFeaturesMap[filterName];\n\t\t\t\t\treturn filterValue && listing.fields[listingFieldName] == 1;\n\t\t\t\t});\n\t\t\t});\n\t\t} else if (Object.keys(filterItems).length > 0) {\n\t\t\tresults = results.filter(listing =>\n\t\t\t\tfilterItems.hasOwnProperty(listing.fields[formattedField])\n\t\t\t);\n\t\t}\n\t}\n\tif (query) {\n\t\tresults = searchResults(results, query);\n\t}\n\tconst distinctItems = getDistinctItemsByProximity(results, listingEntities);\n\tif (hasFavorite) {\n\t\tselectedFilters.specialFeatures.Favorite = favorite;\n\t}\n\treturn { filteredListings: results, mapItems: distinctItems };\n};\n\nfunction searchResults(results, query) {\n\tconst fields = [\n\t\t'id',\n\t\t'uniqueId',\n\t\t'fields.posted',\n\t\t'fields.subtitle',\n\t\t'fields.education',\n\t\t'fields.position',\n\t\t'fields.category',\n\t\t'fields.categoryclass',\n\t\t'fields.shift',\n\t\t'fields.citystate',\n\t\t'fields.city',\n\t\t'fields.state',\n\t\t'fields.schedule',\n\t\t'fields.customflag1',\n\t\t'fields.bonus',\n\t\t'fields.remote',\n\t\t'fields.useclientjoburl',\n\t\t'fields.datecreated',\n\t\t'fields.datelastedited'\n\t];\n\n\tconst options = {\n\t\tincludeScore: true,\n\t\tthreshold: 0.3,\n\t\tkeys: fields\n\t};\n\n\tconst fuse = new Fuse(results, options);\n\tconst lowerCaseQuery = query.toLowerCase();\n\tconst queryTerms = lowerCaseQuery.split(' ');\n\n\tconst exactIdMatch = results.find(result => result.id.toString() === query || result.uniqueId === query);\n\tif (exactIdMatch) {\n\t\treturn [exactIdMatch];\n\t}\n\n\tconst fuseQuery = queryTerms.map(term => ({\n\t\t$or: fields.map(field => ({ [field]: term }))\n\t}));\n\n\tconst fuseResults = fuse.search({ $and: fuseQuery });\n\n\treturn fuseResults.map(result => result.item);\n}\n\nexport const filterListingsByLocation = (\n\tallListings,\n\tselectedLocation,\n\tlistingEntities\n) => {\n\tlet results = allListings;\n\tif (selectedLocation !== null) {\n\t\tresults = results.filter(item =>\n\t\t\tselectedLocation.items.hasOwnProperty(item.id)\n\t\t);\n\t}\n\tconst mapItems = getDistinctItemsByProximity(results, listingEntities);\n\treturn { filteredListings: results, mapItems: mapItems };\n};\n"],"names":["getFilterOptions","listings","filteredListings","field","excludeZeroCount","arguments","length","undefined","options","Set","forEach","listing","fields","add","optionCounts","option","value","hasOwnProperty","Array","from","sort","map","name","count","filter","getSpecialFeatureOptions","siteConfig","favorites","specialFeatures","featureCounts","Object","keys","reduce","acc","key","entries","_ref","_ref2","_slicedToArray","featureKey","featureName","specialFeatureOptions","_ref3","_ref4","_iterator","_createForOfIteratorHelper","_step","s","n","done","x","includes","id","err","e","f","getPointsOfInterestOptions","pointsOfInterestNames","_ref5","_ref6","generateFilterOptions","allListings","filterOptions","parentField","selectedFilters","dynamicFilters","fieldFiltersShown","fieldName","filters","find","title","fieldNames","items","categoryClass","categoryClassKeys","_x$fields","locations","locationFiltersShown","index","locationFilteredListings","every","_ref7","_ref8","_typeof","cityIncluded","stateIncluded","cityStateIncluded","uniqueCities","_toConsumableArray","city","uniqueStates","state","uniqueCityStates","cityState","filteredByLocation","cityMatches","stateMatches","cityStateMatches","selectedStates","pointsOfInterest","pointsOfInterestConfig","applyFilters","query","listingEntities","results","invertedSpecialFeaturesMap","_ref9","_ref10","hasFavorite","Favorite","favorite","_loop","_Object$entries$_i","_Object$entries","_i","filterItems","formattedField","some","_ref11","_ref12","filterName","filterValue","listingFieldName","searchResults","distinctItems","getDistinctItemsByProximity","mapItems","includeScore","threshold","fuse","Fuse","lowerCaseQuery","toLowerCase","queryTerms","split","exactIdMatch","result","toString","uniqueId","fuseQuery","term","$or","_defineProperty","fuseResults","search","$and","item","filterListingsByLocation","selectedLocation"],"mappings":";;;;AAKO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,QAAQ,EAAEC,gBAAgB,EAAEC,KAAK,EAA8B;AAAA,EAAA,IAA5BC,gBAAgB,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,IAAI,CAAA;AAC1F,EAAA,IAAMG,OAAO,GAAG,IAAIC,GAAG,EAAE,CAAA;AACzBR,EAAAA,QAAQ,CAACS,OAAO,CAAC,UAAAC,OAAO,EAAI;AAC3B,IAAA,IAAIA,OAAO,CAACC,MAAM,CAACT,KAAK,CAAC,EAAE;MAC1BK,OAAO,CAACK,GAAG,CAACF,OAAO,CAACC,MAAM,CAACT,KAAK,CAAC,CAAC,CAAA;AACnC,KAAA;AACD,GAAC,CAAC,CAAA;EAEF,IAAMW,YAAY,GAAG,EAAE,CAAA;AACvBN,EAAAA,OAAO,CAACE,OAAO,CAAC,UAAAK,MAAM,EAAI;AACzBD,IAAAA,YAAY,CAACC,MAAM,CAAC,GAAG,CAAC,CAAA;AACzB,GAAC,CAAC,CAAA;AAEFb,EAAAA,gBAAgB,CAACQ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AO,GAAG3C,WAAW,CAAA;EACzB,IAAIuF,gBAAgB,KAAK,IAAI,EAAE;AAC9B5C,IAAAA,OAAO,GAAGA,OAAO,CAAChF,MAAM,CAAC,UAAA0H,IAAI,EAAA;MAAA,OAC5BE,gBAAgB,CAAC5E,KAAK,CAACvD,cAAc,CAACiI,IAAI,CAAC9F,EAAE,CAAC,CAAA;AAAA,KAC/C,CAAC,CAAA;AACF,GAAA;AACA,EAAA,IAAM0E,QAAQ,GAAGD,2BAA2B,CAACrB,OAAO,EAAED,eAAe,CAAC,CAAA;EACtE,OAAO;AAAErG,IAAAA,gBAAgB,EAAEsG,OAAO;AAAEsB,IAAAA,QAAQ,EAAEA,QAAAA;GAAU,CAAA;AACzD;;;;"}
|
package/dist/util/loading.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.js","sources":["../../src/util/loading.js"],"sourcesContent":["import React from 'react';\
|
|
1
|
+
{"version":3,"file":"loading.js","sources":["../../src/util/loading.js"],"sourcesContent":["import React from 'react';\nimport Icon from '~/components/modules/icon';\n\nconst Loading = () => {\n\treturn (\n\t\t<div className=\"hc-flex hc-items-center hc-justify-center hc-w-full hc-h-full\">\n\t\t\t<Icon\n\t\t\t\ticon=\"ph:spinner\"\n\t\t\t\tclassName=\"hc-animate-spin hc-text-gray-300\"\n\t\t\t\twidth=\"40\"\n\t\t\t\theight=\"40\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nexport default Loading;\n"],"names":["Loading","React","createElement","className","Icon","icon","width","height"],"mappings":";;;AAGA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,GAAS;EACrB,oBACCC,cAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,+DAAA;AAA+D,GAAA,eAC7EF,cAAA,CAAAC,aAAA,CAACE,aAAI,EAAA;AACJC,IAAAA,IAAI,EAAC,YAAY;AACjBF,IAAAA,SAAS,EAAC,kCAAkC;AAC5CG,IAAAA,KAAK,EAAC,IAAI;AACVC,IAAAA,MAAM,EAAC,IAAA;AAAI,GACX,CACG,CAAC,CAAA;AAER;;;;"}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
const getStorageObject = (item, defaultItem = null) => {
|
|
2
|
-
if (typeof window === 'undefined')
|
|
3
|
-
return defaultItem;
|
|
4
|
-
const storageItem = localStorage.getItem(item);
|
|
5
|
-
if (storageItem === null || storageItem === 'undefined') {
|
|
6
|
-
localStorage.removeItem(item);
|
|
7
|
-
return defaultItem;
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
return JSON.parse(storageItem) ?? defaultItem;
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
console.error(`Error parsing JSON for ${item}:`, error);
|
|
14
|
-
return defaultItem;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const getStorageItem = (item, defaultItem = null) => {
|
|
18
|
-
if (typeof window === 'undefined')
|
|
19
|
-
return defaultItem;
|
|
20
|
-
const storageItem = localStorage.getItem(item);
|
|
21
|
-
if (storageItem === null || storageItem === 'undefined') {
|
|
22
|
-
localStorage.removeItem(item);
|
|
23
|
-
return defaultItem;
|
|
24
|
-
}
|
|
25
|
-
return storageItem ?? defaultItem;
|
|
26
|
-
};
|
|
27
|
-
const setStorageObject = (key, item) => {
|
|
28
|
-
if (typeof window === 'undefined')
|
|
29
|
-
return;
|
|
30
|
-
if (item === undefined)
|
|
31
|
-
return;
|
|
32
|
-
try {
|
|
33
|
-
localStorage.setItem(key, JSON.stringify(item));
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
console.error(`Error setting item ${key} in localStorage:`, err);
|
|
37
|
-
}
|
|
1
|
+
const getStorageObject = (item, defaultItem = null) => {
|
|
2
|
+
if (typeof window === 'undefined')
|
|
3
|
+
return defaultItem;
|
|
4
|
+
const storageItem = localStorage.getItem(item);
|
|
5
|
+
if (storageItem === null || storageItem === 'undefined') {
|
|
6
|
+
localStorage.removeItem(item);
|
|
7
|
+
return defaultItem;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(storageItem) ?? defaultItem;
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
console.error(`Error parsing JSON for ${item}:`, error);
|
|
14
|
+
return defaultItem;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const getStorageItem = (item, defaultItem = null) => {
|
|
18
|
+
if (typeof window === 'undefined')
|
|
19
|
+
return defaultItem;
|
|
20
|
+
const storageItem = localStorage.getItem(item);
|
|
21
|
+
if (storageItem === null || storageItem === 'undefined') {
|
|
22
|
+
localStorage.removeItem(item);
|
|
23
|
+
return defaultItem;
|
|
24
|
+
}
|
|
25
|
+
return storageItem ?? defaultItem;
|
|
26
|
+
};
|
|
27
|
+
const setStorageObject = (key, item) => {
|
|
28
|
+
if (typeof window === 'undefined')
|
|
29
|
+
return;
|
|
30
|
+
if (item === undefined)
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
localStorage.setItem(key, JSON.stringify(item));
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.error(`Error setting item ${key} in localStorage:`, err);
|
|
37
|
+
}
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export { getStorageItem, getStorageObject, setStorageObject };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localStorageUtil.js","sources":["../../src/util/localStorageUtil.ts"],"sourcesContent":["export const getStorageObject = <T>(item: string, defaultItem: T | null = null): T | null => {\
|
|
1
|
+
{"version":3,"file":"localStorageUtil.js","sources":["../../src/util/localStorageUtil.ts"],"sourcesContent":["export const getStorageObject = <T>(item: string, defaultItem: T | null = null): T | null => {\n\tif (typeof window === 'undefined') return defaultItem;\n\tconst storageItem = localStorage.getItem(item);\n\tif (storageItem === null || storageItem === 'undefined') {\n\t\tlocalStorage.removeItem(item);\n\t\treturn defaultItem;\n\t}\n\ttry {\n\t\treturn JSON.parse(storageItem) ?? defaultItem;\n\t} catch (error) {\n\t\tconsole.error(`Error parsing JSON for ${item}:`, error);\n\t\treturn defaultItem;\n\t}\n};\n\nexport const getStorageItem = (item: string, defaultItem: string | null = null): string | null => {\n\tif (typeof window === 'undefined') return defaultItem;\n\tconst storageItem = localStorage.getItem(item);\n\tif (storageItem === null || storageItem === 'undefined') {\n\t\tlocalStorage.removeItem(item);\n\t\treturn defaultItem;\n\t}\n\treturn storageItem ?? defaultItem;\n};\n\nexport const setStorageObject = (key: string, item: any): void => {\n\tif (typeof window === 'undefined') return;\n\tif (item === undefined) return;\n\ttry {\n\t\tlocalStorage.setItem(key, JSON.stringify(item));\n\t} catch (err) {\n\t\tconsole.error(`Error setting item ${key} in localStorage:`, err);\n\t}\n};\n"],"names":[],"mappings":"AAAa,MAAA,gBAAgB,GAAG,CAAI,IAAY,EAAE,WAAA,GAAwB,IAAI,KAAc;IAC3F,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,WAAW,CAAC;IACtD,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/C,IAAA,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,WAAW,EAAE;AACxD,QAAA,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,QAAA,OAAO,WAAW,CAAC;AACnB,KAAA;IACD,IAAI;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC;AAC9C,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,CAAA,uBAAA,EAA0B,IAAI,CAAG,CAAA,CAAA,EAAE,KAAK,CAAC,CAAC;AACxD,QAAA,OAAO,WAAW,CAAC;AACnB,KAAA;AACF,EAAE;AAEW,MAAA,cAAc,GAAG,CAAC,IAAY,EAAE,WAAA,GAA6B,IAAI,KAAmB;IAChG,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,WAAW,CAAC;IACtD,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/C,IAAA,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,WAAW,EAAE;AACxD,QAAA,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,QAAA,OAAO,WAAW,CAAC;AACnB,KAAA;IACD,OAAO,WAAW,IAAI,WAAW,CAAC;AACnC,EAAE;MAEW,gBAAgB,GAAG,CAAC,GAAW,EAAE,IAAS,KAAU;IAChE,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO;IAC/B,IAAI;AACH,QAAA,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAChD,KAAA;AAAC,IAAA,OAAO,GAAG,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,CAAA,mBAAA,EAAsB,GAAG,CAAmB,iBAAA,CAAA,EAAE,GAAG,CAAC,CAAC;AACjE,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortUtil.js","sources":["../../src/util/sortUtil.js"],"sourcesContent":["export const dynamicSort = (items, fieldName, order = \"asc\") => {\
|
|
1
|
+
{"version":3,"file":"sortUtil.js","sources":["../../src/util/sortUtil.js"],"sourcesContent":["export const dynamicSort = (items, fieldName, order = \"asc\") => {\n\tif (!items || !items.length) {\n\t\treturn [];\n\t}\n\n\tconst inferType = value => {\n\t\tif (!isNaN(Date.parse(value)) && isNaN(value)) {\n\t\t\treturn \"date\";\n\t\t} else if (!isNaN(parseFloat(value)) && isFinite(value)) {\n\t\t\treturn \"number\";\n\t\t} else {\n\t\t\treturn \"string\";\n\t\t}\n\t};\n\n\tconst dataType = inferType(items[0].fields[fieldName]);\n\n\treturn items.sort((a, b) => {\n\t\tlet valA = a.fields[fieldName];\n\t\tlet valB = b.fields[fieldName];\n\t\tif (!valA || !valB) return;\n\t\tlet comparison = 0;\n\n\t\tif (dataType === \"string\") {\n\t\t\tcomparison = valA.localeCompare(valB);\n\t\t} else if (dataType === \"number\") {\n\t\t\tcomparison = valA - valB;\n\t\t} else if (dataType === \"date\") {\n\t\t\tcomparison = new Date(valA) - new Date(valB);\n\t\t}\n\t\treturn order === \"desc\" ? comparison * -1 : comparison;\n\t});\n};"],"names":["dynamicSort","items","fieldName","order","arguments","length","undefined","inferType","value","isNaN","Date","parse","parseFloat","isFinite","dataType","fields","sort","a","b","valA","valB","comparison","localeCompare"],"mappings":"AAAO,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,KAAK,EAAEC,SAAS,EAAoB;AAAA,EAAA,IAAlBC,KAAK,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,KAAK,CAAA;AAC1D,EAAA,IAAI,CAACH,KAAK,IAAI,CAACA,KAAK,CAACI,MAAM,EAAE;AAC5B,IAAA,OAAO,EAAE,CAAA;AACV,GAAA;AAEA,EAAA,IAAME,SAAS,GAAG,SAAZA,SAASA,CAAGC,KAAK,EAAI;AAC1B,IAAA,IAAI,CAACC,KAAK,CAACC,IAAI,CAACC,KAAK,CAACH,KAAK,CAAC,CAAC,IAAIC,KAAK,CAACD,KAAK,CAAC,EAAE;AAC9C,MAAA,OAAO,MAAM,CAAA;AACd,KAAC,MAAM,IAAI,CAACC,KAAK,CAACG,UAAU,CAACJ,KAAK,CAAC,CAAC,IAAIK,QAAQ,CAACL,KAAK,CAAC,EAAE;AACxD,MAAA,OAAO,QAAQ,CAAA;AAChB,KAAC,MAAM;AACN,MAAA,OAAO,QAAQ,CAAA;AAChB,KAAA;GACA,CAAA;AAED,EAAA,IAAMM,QAAQ,GAAGP,SAAS,CAACN,KAAK,CAAC,CAAC,CAAC,CAACc,MAAM,CAACb,SAAS,CAAC,CAAC,CAAA;EAEtD,OAAOD,KAAK,CAACe,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;AAC3B,IAAA,IAAIC,IAAI,GAAGF,CAAC,CAACF,MAAM,CAACb,SAAS,CAAC,CAAA;AAC9B,IAAA,IAAIkB,IAAI,GAAGF,CAAC,CAACH,MAAM,CAACb,SAAS,CAAC,CAAA;AAC9B,IAAA,IAAI,CAACiB,IAAI,IAAI,CAACC,IAAI,EAAE,OAAA;IACpB,IAAIC,UAAU,GAAG,CAAC,CAAA;IAElB,IAAIP,QAAQ,KAAK,QAAQ,EAAE;AAC1BO,MAAAA,UAAU,GAAGF,IAAI,CAACG,aAAa,CAACF,IAAI,CAAC,CAAA;AACtC,KAAC,MAAM,IAAIN,QAAQ,KAAK,QAAQ,EAAE;MACjCO,UAAU,GAAGF,IAAI,GAAGC,IAAI,CAAA;AACzB,KAAC,MAAM,IAAIN,QAAQ,KAAK,MAAM,EAAE;MAC/BO,UAAU,GAAG,IAAIX,IAAI,CAACS,IAAI,CAAC,GAAG,IAAIT,IAAI,CAACU,IAAI,CAAC,CAAA;AAC7C,KAAA;IACA,OAAOjB,KAAK,KAAK,MAAM,GAAGkB,UAAU,GAAG,CAAC,CAAC,GAAGA,UAAU,CAAA;AACvD,GAAC,CAAC,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringUtils.js","sources":["../../src/util/stringUtils.js"],"sourcesContent":["export const capitalize = str => {\
|
|
1
|
+
{"version":3,"file":"stringUtils.js","sources":["../../src/util/stringUtils.js"],"sourcesContent":["export const capitalize = str => {\n\tif (str && typeof str === \"string\") {\n\t\treturn str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n\t}\n\treturn str;\n};\n"],"names":["capitalize","str","charAt","toUpperCase","slice","toLowerCase"],"mappings":"IAAaA,UAAU,GAAG,SAAbA,UAAUA,CAAGC,GAAG,EAAI;AAChC,EAAA,IAAIA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IACnC,OAAOA,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,GAAGF,GAAG,CAACG,KAAK,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,CAAA;AAChE,GAAA;AACA,EAAA,OAAOJ,GAAG,CAAA;AACX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlFilterUtil.js","sources":["../../src/util/urlFilterUtil.js"],"sourcesContent":["export const updateURLWithFilters = (filters, location, query, handleUrlUpdate) => {\
|
|
1
|
+
{"version":3,"file":"urlFilterUtil.js","sources":["../../src/util/urlFilterUtil.js"],"sourcesContent":["export const updateURLWithFilters = (filters, location, query, handleUrlUpdate) => {\n\tconst searchParams = new URLSearchParams(location.search);\n\n\tconst filteredSearchParams = new URLSearchParams();\n\tfor (const [key, value] of searchParams.entries()) {\n\t\tif (!key.includes('.') && key !== 'query') {\n\t\t\tfilteredSearchParams.set(key, value);\n\t\t}\n\t}\n\n\tif (query) {\n\t\tfilteredSearchParams.set('query', query);\n\t}\n\n\tfor (const category in filters) {\n\t\tfor (const filter in filters[category]) {\n\t\t\tconst key = `${category}.${filter}`;\n\t\t\tif (filters[category][filter]) {\n\t\t\t\tfilteredSearchParams.set(key, 'true');\n\t\t\t}\n\t\t}\n\t}\n\n\thandleUrlUpdate(filteredSearchParams.toString());\n};\n\nfunction notifyParentOfUrlChange() {\n\tsetTimeout(() => {\n\t\tvar message = {\n\t\t\ttype: 'URL_CHANGE',\n\t\t\turl: window.location.href\n\t\t};\n\t\twindow.parent.postMessage(message, \"*\");\n\t}, 500);\n}\n\nexport const parseQueryParams = search => {\n\tconst queryParams = {};\n\tif (!search) return queryParams;\n\tlet queryString = search.split('?')[1];\n\tif (!queryString) {\n\t\treturn queryParams;\n\t}\n\tqueryString = queryString.replaceAll('+', ' ');\n\tqueryString.split('&').forEach(param => {\n\t\tconst [key, value] = param.split('=');\n\t\tqueryParams[decodeURIComponent(key)] = decodeURIComponent(value);\n\t});\n\treturn queryParams;\n};\n\nexport const filtersFromURL = location => {\n\tif (!location || !location.search) return;\n\tconst filters = {};\n\tlet queryParam = null;\n\tconst queryParams = parseQueryParams(location.search);\n\tif (!queryParams) return;\n\tObject.keys(queryParams).forEach(key => {\n\t\tif (key && key.includes('.')) {\n\t\t\tconst [category, filter] = key.split('.');\n\t\t\tif (!filters[category]) {\n\t\t\t\tfilters[category] = {};\n\t\t\t}\n\t\t\tfilters[category][filter] = queryParams[key] === 'true';\n\t\t} else if (key === 'query') {\n\t\t\tqueryParam = queryParams[key];\n\t\t}\n\t});\n\n\treturn { filters, query: queryParam };\n};\n\nexport const hasFiltersInURL = location => {\n\tif (!location || !location.search) return;\n\tconst queryParams = parseQueryParams(location.search);\n\tif (!queryParams) return;\n\treturn Object.keys(queryParams).some(key => key.includes('.'));\n};\n\nexport const hasQueryInUrl = location => {\n\tif (!location || !location.search) return;\n\tconst queryParams = parseQueryParams(location.search);\n\tif (!queryParams) return;\n\treturn Object.keys(queryParams).includes('query');\n};\n"],"names":["updateURLWithFilters","filters","location","query","handleUrlUpdate","searchParams","URLSearchParams","search","filteredSearchParams","_iterator","_createForOfIteratorHelper","entries","_step","s","n","done","_step$value","_slicedToArray","value","key","includes","set","err","e","f","category","filter","concat","toString","parseQueryParams","queryParams","queryString","split","replaceAll","forEach","param","_param$split","_param$split2","decodeURIComponent","filtersFromURL","queryParam","Object","keys","_key$split","_key$split2"],"mappings":";;AAAaA,IAAAA,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIC,OAAO,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,eAAe,EAAK;EAClF,IAAMC,YAAY,GAAG,IAAIC,eAAe,CAACJ,QAAQ,CAACK,MAAM,CAAC,CAAA;AAEzD,EAAA,IAAMC,oBAAoB,GAAG,IAAIF,eAAe,EAAE,CAAA;EAAC,IAAAG,SAAA,GA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WAAW,GAAGD,gBAAgB,CAAC3B,QAAQ,CAACK,MAAM,CAAC,CAAA;EACrD,IAAI,CAACuB,WAAW,EAAE,OAAA;EAClBW,MAAM,CAACC,IAAI,CAACZ,WAAW,CAAC,CAACI,OAAO,CAAC,UAAAf,GAAG,EAAI;IACvC,IAAIA,GAAG,IAAIA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC7B,MAAA,IAAAuB,UAAA,GAA2BxB,GAAG,CAACa,KAAK,CAAC,GAAG,CAAC;QAAAY,WAAA,GAAA3B,cAAA,CAAA0B,UAAA,EAAA,CAAA,CAAA;AAAlClB,QAAAA,QAAQ,GAAAmB,WAAA,CAAA,CAAA,CAAA;AAAElB,QAAAA,MAAM,GAAAkB,WAAA,CAAA,CAAA,CAAA,CAAA;AACvB,MAAA,IAAI,CAAC3C,OAAO,CAACwB,QAAQ,CAAC,EAAE;AACvBxB,QAAAA,OAAO,CAACwB,QAAQ,CAAC,GAAG,EAAE,CAAA;AACvB,OAAA;AACAxB,MAAAA,OAAO,CAACwB,QAAQ,CAAC,CAACC,MAAM,CAAC,GAAGI,WAAW,CAACX,GAAG,CAAC,KAAK,MAAM,CAAA;AACxD,KAAC,MAAM,IAAIA,GAAG,KAAK,OAAO,EAAE;AAC3BqB,MAAAA,UAAU,GAAGV,WAAW,CAACX,GAAG,CAAC,CAAA;AAC9B,KAAA;AACD,GAAC,CAAC,CAAA;EAEF,OAAO;AAAElB,IAAAA,OAAO,EAAPA,OAAO;AAAEE,IAAAA,KAAK,EAAEqC,UAAAA;GAAY,CAAA;AACtC;;;;"}
|
package/package.json
CHANGED
package/src/apis/hcApi.ts
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { getClientAuthKey } from '~/clientToken';
|
|
2
|
-
const baseURL = process.env.HC_API_BASE_URL as string;
|
|
3
|
-
|
|
4
|
-
interface MemoryStorage {
|
|
5
|
-
authToken: string | null;
|
|
6
|
-
tokenExpiration: string | null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const memoryStorage: MemoryStorage = {
|
|
10
|
-
authToken: null,
|
|
11
|
-
tokenExpiration: null
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
function setStorage(key: keyof MemoryStorage, value: string): void {
|
|
15
|
-
try {
|
|
16
|
-
sessionStorage.setItem(key, value);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
memoryStorage[key] = value;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getStorage(key: keyof MemoryStorage): string | null {
|
|
23
|
-
try {
|
|
24
|
-
return sessionStorage.getItem(key) || memoryStorage[key];
|
|
25
|
-
} catch (error) {
|
|
26
|
-
return memoryStorage[key];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface AuthResponse {
|
|
31
|
-
token: string;
|
|
32
|
-
expiration: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const login = async (): Promise<AuthResponse> => {
|
|
36
|
-
const clientAuthKey = getClientAuthKey();
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const response = await fetch(`${baseURL}/auth/login`, {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: {
|
|
42
|
-
'Content-Type': 'application/json'
|
|
43
|
-
},
|
|
44
|
-
body: JSON.stringify({
|
|
45
|
-
clientAuthKey: clientAuthKey
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (!response.ok) {
|
|
50
|
-
throw new Error('Login failed');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const data = await response.json();
|
|
54
|
-
|
|
55
|
-
if (data.token && data.expiration) {
|
|
56
|
-
setStorage('authToken', data.token);
|
|
57
|
-
setStorage('tokenExpiration', data.expiration);
|
|
58
|
-
return { token: data.token, expiration: data.expiration };
|
|
59
|
-
} else {
|
|
60
|
-
throw new Error('Invalid login response');
|
|
61
|
-
}
|
|
62
|
-
} catch (error) {
|
|
63
|
-
console.error('Login failed:', error);
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const fetchWithAuth = async (url: string, options: RequestInit = {}): Promise<Response> => {
|
|
69
|
-
let token = getStorage('authToken');
|
|
70
|
-
|
|
71
|
-
const expirationDateTime = getStorage('tokenExpiration');
|
|
72
|
-
const currentTime = new Date();
|
|
73
|
-
|
|
74
|
-
if (!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime) {
|
|
75
|
-
const authResponse = await login();
|
|
76
|
-
token = authResponse.token;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const headers = new Headers(options.headers || {});
|
|
80
|
-
headers.append('Authorization', `Bearer ${token}`);
|
|
81
|
-
|
|
82
|
-
const finalOptions = {
|
|
83
|
-
...options,
|
|
84
|
-
headers
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const response = await fetch(`${baseURL}${url}`, finalOptions);
|
|
88
|
-
|
|
89
|
-
if (!response.ok) throw new Error('Network response was not ok.');
|
|
90
|
-
|
|
91
|
-
return response;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export default {
|
|
95
|
-
get: async <T>(url: string): Promise<T> => {
|
|
96
|
-
const response = await fetchWithAuth(url);
|
|
97
|
-
return await response.json() as T;
|
|
98
|
-
},
|
|
99
|
-
post: async <T>(url: string, data: any): Promise<T> => {
|
|
100
|
-
const response = await fetchWithAuth(url, {
|
|
101
|
-
method: 'POST',
|
|
102
|
-
headers: {
|
|
103
|
-
'Content-Type': 'application/json'
|
|
104
|
-
},
|
|
105
|
-
body: JSON.stringify(data)
|
|
106
|
-
});
|
|
107
|
-
return await response.json() as T;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
1
|
+
import { getClientAuthKey } from '~/clientToken';
|
|
2
|
+
const baseURL = process.env.HC_API_BASE_URL as string;
|
|
3
|
+
|
|
4
|
+
interface MemoryStorage {
|
|
5
|
+
authToken: string | null;
|
|
6
|
+
tokenExpiration: string | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const memoryStorage: MemoryStorage = {
|
|
10
|
+
authToken: null,
|
|
11
|
+
tokenExpiration: null
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function setStorage(key: keyof MemoryStorage, value: string): void {
|
|
15
|
+
try {
|
|
16
|
+
sessionStorage.setItem(key, value);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
memoryStorage[key] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getStorage(key: keyof MemoryStorage): string | null {
|
|
23
|
+
try {
|
|
24
|
+
return sessionStorage.getItem(key) || memoryStorage[key];
|
|
25
|
+
} catch (error) {
|
|
26
|
+
return memoryStorage[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface AuthResponse {
|
|
31
|
+
token: string;
|
|
32
|
+
expiration: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const login = async (): Promise<AuthResponse> => {
|
|
36
|
+
const clientAuthKey = getClientAuthKey();
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetch(`${baseURL}/auth/login`, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: {
|
|
42
|
+
'Content-Type': 'application/json'
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
clientAuthKey: clientAuthKey
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
throw new Error('Login failed');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const data = await response.json();
|
|
54
|
+
|
|
55
|
+
if (data.token && data.expiration) {
|
|
56
|
+
setStorage('authToken', data.token);
|
|
57
|
+
setStorage('tokenExpiration', data.expiration);
|
|
58
|
+
return { token: data.token, expiration: data.expiration };
|
|
59
|
+
} else {
|
|
60
|
+
throw new Error('Invalid login response');
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('Login failed:', error);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const fetchWithAuth = async (url: string, options: RequestInit = {}): Promise<Response> => {
|
|
69
|
+
let token = getStorage('authToken');
|
|
70
|
+
|
|
71
|
+
const expirationDateTime = getStorage('tokenExpiration');
|
|
72
|
+
const currentTime = new Date();
|
|
73
|
+
|
|
74
|
+
if (!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime) {
|
|
75
|
+
const authResponse = await login();
|
|
76
|
+
token = authResponse.token;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const headers = new Headers(options.headers || {});
|
|
80
|
+
headers.append('Authorization', `Bearer ${token}`);
|
|
81
|
+
|
|
82
|
+
const finalOptions = {
|
|
83
|
+
...options,
|
|
84
|
+
headers
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const response = await fetch(`${baseURL}${url}`, finalOptions);
|
|
88
|
+
|
|
89
|
+
if (!response.ok) throw new Error('Network response was not ok.');
|
|
90
|
+
|
|
91
|
+
return response;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default {
|
|
95
|
+
get: async <T>(url: string): Promise<T> => {
|
|
96
|
+
const response = await fetchWithAuth(url);
|
|
97
|
+
return await response.json() as T;
|
|
98
|
+
},
|
|
99
|
+
post: async <T>(url: string, data: any): Promise<T> => {
|
|
100
|
+
const response = await fetchWithAuth(url, {
|
|
101
|
+
method: 'POST',
|
|
102
|
+
headers: {
|
|
103
|
+
'Content-Type': 'application/json'
|
|
104
|
+
},
|
|
105
|
+
body: JSON.stringify(data)
|
|
106
|
+
});
|
|
107
|
+
return await response.json() as T;
|
|
108
|
+
}
|
|
109
|
+
};
|
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
|
+
};
|