@abcagency/hc-ui-components 1.3.59 → 1.3.61
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/HireControlMap.js +11 -1
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/filter-container.js.map +1 -1
- 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/commute-container.js +1 -1
- package/dist/components/containers/filter/commute-container.js.map +1 -1
- package/dist/components/containers/filter/filter-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/filter/location-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-radio-item-container.js.map +1 -1
- package/dist/components/containers/filter/search-container.js.map +1 -1
- package/dist/components/containers/jobListing/listing-details-container.js +5 -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/item-list-container.js.map +1 -1
- package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +1 -1
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/containers/maps/map-list-container.js.map +1 -1
- package/dist/components/containers/maps/map-marker-container.js +1 -1
- package/dist/components/containers/maps/map-marker-container.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js +2 -2
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +45 -54
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/commute-pill.js.map +1 -1
- package/dist/components/modules/buttons/default.js +2 -2
- 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 +2 -2
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js +2 -2
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/filter/sort.js +2 -2
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js +1 -1
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js +1 -1
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details.js +8 -7
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/list/field-mapper.js.map +1 -1
- package/dist/components/modules/list/header-item.js.map +1 -1
- package/dist/components/modules/list/header.js +1 -1
- package/dist/components/modules/list/header.js.map +1 -1
- package/dist/components/modules/list/item-expand-card/index.js +1 -1
- package/dist/components/modules/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/list/item-expand-card/recruiter-contact-nav.js +38 -38
- package/dist/components/modules/list/item-expand-card/recruiter-details.js +40 -40
- package/dist/components/modules/list/item-expand-card/recruiter-headshot.js +20 -20
- package/dist/components/modules/list/item-list.js +43 -43
- package/dist/components/modules/list/item-list.js.map +1 -1
- package/dist/components/modules/list/list-item/list-item.js.map +1 -1
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js +1 -1
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js +1 -1
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js +1 -1
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js +1 -1
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/constants/eventTypes.js +1 -0
- package/dist/constants/eventTypes.js.map +1 -1
- package/dist/constants/placeTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +83 -83
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +192 -190
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/contexts/themeContext.js.map +1 -1
- 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/configService.js.map +1 -1
- 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/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +24 -24
- package/dist/services/listingService.js.map +1 -1
- package/dist/services/recruiterService.js +10 -10
- package/dist/services/recruiterService.js.map +1 -1
- 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 +20 -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 +15 -14
- package/dist/types/contexts/mapContext.d.ts +29 -29
- package/dist/types/contexts/mapListContext.d.ts +65 -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 +1 -1
- 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/mapIconUtil.js.map +1 -1
- package/dist/util/mapUtil.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 +90 -90
- package/src/.editorconfig +12 -12
- package/src/apis/hcApi.ts +109 -109
- package/src/bundleIndex.js +14 -14
- package/src/clientToken.js +9 -9
- package/src/components/HireControlMap.js +148 -142
- package/src/components/containers/accordions/filter-container.js +48 -48
- package/src/components/containers/accordions/filter-item-container.js +83 -83
- package/src/components/containers/accordions/map-accordion-item-container.js +70 -70
- package/src/components/containers/filter/commute-container.js +89 -89
- package/src/components/containers/filter/filter-container.js +76 -76
- package/src/components/containers/filter/filter-item-container.js +117 -117
- package/src/components/containers/filter/location-container.js +45 -45
- package/src/components/containers/filter/points-of-interest-container.js +33 -33
- package/src/components/containers/filter/points-of-interest-radio-item-container.js +35 -35
- package/src/components/containers/filter/search-container.js +61 -61
- package/src/components/containers/jobListing/listing-details-container.js +42 -40
- package/src/components/containers/list/item-list-container.tsx +81 -81
- package/src/components/containers/list/list-item/list-item-container.js +43 -43
- package/src/components/containers/maps/info-window-content-container.js +53 -53
- package/src/components/containers/maps/map-container.js +249 -249
- package/src/components/containers/maps/map-list-container.js +50 -50
- package/src/components/containers/maps/map-marker-container.js +78 -78
- package/src/components/modules/accordions/MapAccordionItem.js +30 -30
- package/src/components/modules/accordions/default.js +171 -171
- package/src/components/modules/accordions/filterItem.js +27 -27
- package/src/components/modules/accordions/filters.js +32 -32
- package/src/components/modules/buttons/button-group-apply.js +115 -135
- 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/dialogs/apply-dialog.js +48 -48
- package/src/components/modules/filter/commute.js +108 -108
- package/src/components/modules/filter/index.js +55 -55
- package/src/components/modules/filter/item.js +69 -69
- package/src/components/modules/filter/location.js +51 -51
- package/src/components/modules/filter/radio-item.js +42 -42
- package/src/components/modules/filter/search.js +79 -79
- 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/jobListing/listing-details.js +110 -108
- package/src/components/modules/list/field-mapper.js +130 -130
- package/src/components/modules/list/header-item.js +92 -92
- package/src/components/modules/list/header.js +51 -51
- package/src/components/modules/list/item-expand-card/index.js +22 -22
- 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/list/item-list.tsx +117 -117
- package/src/components/modules/list/list-item/list-item.js +130 -130
- package/src/components/modules/maps/info-window-card.js +17 -17
- package/src/components/modules/maps/info-window-content.js +64 -64
- package/src/components/modules/maps/map-list.js +38 -38
- package/src/components/modules/maps/map-marker.js +29 -29
- 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/eventTypes.js +15 -14
- package/src/constants/placeTypes.js +8 -8
- package/src/contexts/mapContext.tsx +129 -129
- package/src/contexts/mapListContext.tsx +326 -318
- package/src/contexts/placesContext.js +102 -102
- package/src/contexts/themeContext.js +40 -40
- 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/configService.ts +16 -16
- package/src/services/googlePlacesNearbyService.ts +42 -42
- package/src/services/listingAggregatorService.ts +76 -76
- package/src/services/listingEntityService.ts +16 -16
- package/src/services/listingService.ts +40 -40
- package/src/services/recruiterService.ts +18 -18
- package/src/styles/bundle.css +268 -268
- package/src/styles/index.css +33 -33
- package/src/types/Address.ts +7 -7
- package/src/types/ContentSection.ts +9 -9
- package/src/types/GetListingParams.ts +8 -8
- package/src/types/LatLng.ts +4 -4
- package/src/types/ListingEntity.ts +11 -11
- package/src/types/ListingFields.ts +25 -25
- package/src/types/Listings.ts +32 -32
- package/src/types/Recruiter.ts +9 -9
- package/src/types/SimilarListing.ts +24 -24
- package/src/types/config/Colors.ts +8 -8
- package/src/types/config/MapConfig.ts +31 -31
- package/src/types/config/PointsOfInterestConfig.ts +13 -13
- package/src/types/config/SearchConfig.ts +4 -4
- package/src/util/arrayUtil.js +3 -3
- package/src/util/fieldMapper.js +22 -22
- package/src/util/filterUtil.js +311 -311
- package/src/util/loading.js +17 -17
- package/src/util/localStorageUtil.ts +34 -34
- package/src/util/mapIconUtil.js +180 -180
- package/src/util/mapUtil.js +92 -92
- package/src/util/sortUtil.js +32 -32
- package/src/util/stringUtils.js +6 -6
- package/src/util/urlFilterUtil.js +85 -85
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapIconUtil.js","sources":["../../src/util/mapIconUtil.js"],"sourcesContent":["/* eslint-disable no-undef */\nimport { placeTypes } from '~/constants/placeTypes';\n\nconst customSVGIcon = (\n\ttype,\n\tfillColor = \"#FFFFFF\",\n\tstrokeColor = \"#000000\",\n\tbackgroundFill = \"#000000\",\n\tbackgroundStroke = \"#000000\"\n) => {\n\tlet svg = \"\";\n\tswitch (type) {\n\t\tcase placeTypes.FOOD:\n\t\t\tsvg = `\n\t\t\t\t\t<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\n\t\t\t\t\t<style type=\"text/css\">\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\n\t\t\t\t\t</style>\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M25.7,36.6l0.6,15.8c0.1,2.4-2.3,2.4-2.3,2.4s-2.4,0-2.3-2.4l0.6-15.8c0.1-2-4.3-2.9-4-4.9l2.3-13.3h1.1\n\t\t\t\t\t\tl-0.6,9.7l1.7,1.2l0.6-10.9h1.1l0.6,10.9l1.7-1.2l-0.6-9.7h1.1l2.3,13.3C29.7,33.7,25.6,34.6,25.7,36.6z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M40,52.4c0,2.4-2.3,2.4-2.3,2.4s-2.5,0-2.3-2.4L36.6,39c-0.9,0-3.4-0.4-3.4-2.4v-6.1c0-2.4,0.3-6.4,1.2-8.2\n\t\t\t\t\t\tc1.1-2.4,3.9-4,5.6-4C40,18.3,40,52.4,40,52.4z\"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t`;\n\t\t\tbreak;\n\t\tcase placeTypes.TOURIST_ATTRACTION:\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\n\t\t\t\t\t<style type=\"text/css\">\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\n\t\t\t\t\t</style>\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M27,18.5c-1.2,0-1.7,1.1-2.2,2.2L23.7,23h-4.5c-1.9,0-3.4,1.5-3.4,3.4v11.2c0,1.9,1.5,3.4,3.4,3.4h22.5\n\t\t\t\t\t\tc1.9,0,3.4-1.5,3.4-3.4V26.4c0-1.9-1.5-3.4-3.4-3.4h-4.5L36,20.8c-0.6-1.1-1-2.2-2.2-2.2H27z M19.2,25.3c0.6,0,1.1,0.5,1.1,1.1\n\t\t\t\t\t\tc0,0.6-0.5,1.1-1.1,1.1c-0.6,0-1.1-0.5-1.1-1.1C18,25.8,18.5,25.3,19.2,25.3z M30.4,25.3c3.7,0,6.7,3,6.7,6.7s-3,6.7-6.7,6.7\n\t\t\t\t\t\ts-6.7-3-6.7-6.7S26.7,25.3,30.4,25.3z M30.4,28.7c-1.9,0-3.4,1.5-3.4,3.4s1.5,3.4,3.4,3.4c1.9,0,3.4-1.5,3.4-3.4\n\t\t\t\t\t\tS32.3,28.7,30.4,28.7z\"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t`;\n\t\t\tbreak;\n\t\tcase placeTypes.SCHOOL:\n\t\t\tsvg = `\n\t\t\t\t\t<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\n\t\t\t\t\t<style type=\"text/css\">\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\n\t\t\t\t\t</style>\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M39.2,40.6c0,0-4.1,4.6-9.1,4.6S21,40.6,21,40.6v-5.2l9.1,5l9.1-5V40.6z\"/>\n\t\t\t\t\t<polygon class=\"st0\" points=\"44.4,40.4 41.8,40.4 41.8,31.4 30.1,37.8 15.8,30 30.1,22.2 44.4,30 \"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t`;\n\t\t\tbreak;\n\t\tcase placeTypes.STORE:\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\n\t\t\t\t\t<style type=\"text/css\">\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\n\t\t\t\t\t</style>\n\t\t\t\t\t<g>\n\t\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t</g>\n\t\t\t\t\t<path class=\"st0\" d=\"M45.4,27.7L42,41.1c-0.1,0.6-0.7,1-1.3,1c1.8,0,3.3,1.5,3.3,3.3s-1.5,3.3-3.3,3.3s-3.3-1.5-3.3-3.3\n\t\t\t\t\t\ts1.5-3.3,3.3-3.3H23.3c1.8,0,3.3,1.5,3.3,3.3s-1.5,3.3-3.3,3.3S20,47.2,20,45.4s1.5-3.3,3.3-3.3c-0.6,0-1.2-0.4-1.3-1l-4.1-16.4\n\t\t\t\t\t\th-1.3c-0.7,0-1.3-0.6-1.3-1.3s0.6-1.3,1.3-1.3h2.3c0.6,0,1.2,0.4,1.3,1l0.8,3h23.1c0.4,0,0.8,0.2,1.1,0.5\n\t\t\t\t\t\tC45.4,26.9,45.5,27.3,45.4,27.7z\"/>\n\t\t\t\t\t<path d=\"M41.4,45.5c0-0.4-0.3-0.7-0.7-0.7S40,45.1,40,45.5C40.1,46.2,41.4,46.2,41.4,45.5z\"/>\n\t\t\t\t\t<path d=\"M24,45.5c0-0.4-0.3-0.7-0.7-0.7s-0.7,0.3-0.7,0.7C22.6,46.2,24,46.2,24,45.5z\"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t`;\n\t\t\tbreak;\n\t\tcase placeTypes.TRANSIT_STATION:\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\n\t\t\t\t\t<style type=\"text/css\">\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\n\t\t\t\t\t</style>\n\t\t\t\t\t<g>\n\t\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t</g>\n\t\t\t\t\t<path class=\"st0\" d=\"M26.3,41.3h-2.8L20.7,44h-1.4v-1.4l1.4-1.4c-2.3,0-4.2-1.9-4.2-4.2V26c0-2.3,1.9-4.2,4.2-4.2h9.7\n\t\t\t\t\t\tc2.3,0,4.2,1.9,4.2,4.2v1.4h-2.8v-2.8H19.3v9.7h6.9v7H26.3z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M44.3,43c0,0.5-0.4,1-1,1h-0.8c-0.5,0-1-0.5-1-1.1v-1.7H30.4V43c0,0.5-0.4,1.1-0.9,1.1h-0.9c-0.5,0-1-0.5-1-1\n\t\t\t\t\t\tv-7.6l2-5.7c0.2-0.6,0.7-0.9,1.4-0.9h10c0.6,0,1.1,0.4,1.3,0.9l2,5.7V43z\"/>\n\t\t\t\t\t<circle cx=\"20.7\" cy=\"37.1\" r=\"1.4\"/>\n\t\t\t\t\t<circle cx=\"41.5\" cy=\"37.1\" r=\"1.4\"/>\n\t\t\t\t\t<circle cx=\"30.4\" cy=\"37.1\" r=\"1.4\"/>\n\t\t\t\t\t<polygon points=\"31,30.2 29.6,34.4 42.4,34.4 40.9,30.2 \"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t`;\n\t\t\tbreak;\n\t\tcase placeTypes.PLACE_OF_WORSHIP:\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\n\t\t\t\t\t<style type=\"text/css\">\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\n\t\t\t\t\t</style>\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M21.3,40.8h-3.8c-1.3,0-2.3-1-2.3-2.3v-4.3c0-0.8,0.5-1.6,1.2-2l4.9-2.7V40.8z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M38,40.8h-4.6v-4.6c0-1.7-1.4-3-3-3c-1.7,0-3,1.4-3,3v4.6h-4.6V30c0-0.8,0.4-1.5,1.1-2l1.9-1.2v-5.1l0,0\n\t\t\t\t\t\tc0-0.4,0.2-0.8,0.4-1.1l3.6-3.6c0.3-0.3,0.8-0.3,1.1,0l3.6,3.6c0.3,0.3,0.4,0.7,0.4,1.1v5.1l1.9,1.2c0.7,0.4,1.1,1.2,1.1,2L38,40.8\n\t\t\t\t\t\tL38,40.8z\"/>\n\t\t\t\t\t<path class=\"st0\" d=\"M45.6,38.5c0,1.3-1,2.3-2.3,2.3h-3.8V29.5l4.9,2.7c0.7,0.4,1.2,1.2,1.2,2C45.6,34.2,45.6,38.5,45.6,38.5z\"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t`;\n\t\t\tbreak;\n\t}\n\n\tconst iconUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;\n\treturn iconUrl;\n};\n\nexport const iconPath = \"M5.5 0A5.27 5.27 0 0 0 0 5.01v.49c0 1.73 1.38 3.43 2.07 4.12s3.43 4.12 3.43 4.12 2.75-3.43 3.43-4.12 2.06-2.39 2.06-4.12c.14-2.9-2.1-5.36-5-5.5H5.5Zm-.04 5.71c-.32 0-.57-.27-.56-.58 0-.32.27-.57.58-.56.32 0 .57.27.56.58 0 .31-.25.55-.56.56h-.02Z\";\n\nexport const markerIconProps = (placeMarkerConfigs, type) => {\n\n\tconst scaledWidth = placeMarkerConfigs.size;\n\tconst scaledHeight = (scaledWidth * 3) / 2;\n\tconst iconUrl = customSVGIcon(\n\t\ttype,\n\t\tplaceMarkerConfigs.colors.innerFillColor,\n\t\tplaceMarkerConfigs.colors.innerStrokeColor,\n\t\tplaceMarkerConfigs.colors.outerFillColor,\n\t\tplaceMarkerConfigs.colors.outerStrokeColor\n\t);\n\treturn {\n\t\turl: iconUrl,\n\t\tscaledSize: new google.maps.Size(scaledWidth, scaledHeight),\n\t\tanchor: new google.maps.Point(scaledWidth / 2, scaledHeight)\n\t};\n};\n\nexport const iconProps = () => {\n\treturn {\n\t\tpath: iconPath,\n\t\tfillOpacity: 1,\n\t\tstrokeWeight: 1.75,\n\t\tscale: 1.6,\n\t\tanchor: new google.maps.Point(12, 17)\n\t};\n};\n\nexport const markerIcon = markerConfigs => {\n\treturn {\n\t\t...iconProps(),\n\t\tfillColor: markerConfigs.fillColor,\n\t\tstrokeColor: markerConfigs.strokeColor\n\t};\n};\n\nexport const markerIconSelected = markerConfigs => {\n\treturn {\n\t\t...iconProps(),\n\t\tfillColor: markerConfigs.selectedFillColor,\n\t\tstrokeColor: markerConfigs.selectedStrokeColor\n\t};\n};\n\nexport const pinIcon = markerConfigs => {\n\tconst { fillColor, strokeColor } = markerConfigs;\n\n\tconst svg = `\n\t<svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"-6 -4 24 24\">\n\t\t<path d=\"${iconPath}\" fill=\"${fillColor}\" stroke=\"${strokeColor}\" stroke-width=\"2\"/>\n\t </svg>\n\t`;\n\n\treturn `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;\n};\n\n"],"names":["customSVGIcon","type","fillColor","arguments","length","undefined","strokeColor","backgroundFill","backgroundStroke","svg","placeTypes","FOOD","concat","TOURIST_ATTRACTION","SCHOOL","STORE","TRANSIT_STATION","PLACE_OF_WORSHIP","iconUrl","encodeURIComponent","iconPath","markerIconProps","placeMarkerConfigs","scaledWidth","size","scaledHeight","colors","innerFillColor","innerStrokeColor","outerFillColor","outerStrokeColor","url","scaledSize","google","maps","Size","anchor","Point","iconProps","path","fillOpacity","strokeWeight","scale","markerIcon","markerConfigs","_objectSpread","markerIconSelected","selectedFillColor","selectedStrokeColor","pinIcon"],"mappings":";;;AAGA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAClBC,IAAI,EAKA;AAAA,EAAA,IAJJC,SAAS,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,SAAS,CAAA;AAAA,EAAA,IACrBG,WAAW,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,SAAS,CAAA;AAAA,EAAA,IACvBI,cAAc,GAAAJ,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAA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W,GAAKsC,aAAa,CAA7BtC,WAAW,CAAA;AAE9B,EAAA,IAAMG,GAAG,GAAA,wIAAA,CAAAG,MAAA,CAEGQ,QAAQ,EAAA,YAAA,CAAA,CAAAR,MAAA,CAAWV,SAAS,EAAA,cAAA,CAAA,CAAAU,MAAA,CAAaN,WAAW,EAE/D,yCAAA,CAAA,CAAA;AAED,EAAA,OAAA,0BAAA,CAAAM,MAAA,CAAkCO,kBAAkB,CAACV,GAAG,CAAC,CAAA,CAAA;AAC1D;;;;"}
|
|
1
|
+
{"version":3,"file":"mapIconUtil.js","sources":["../../src/util/mapIconUtil.js"],"sourcesContent":["/* eslint-disable no-undef */\r\nimport { placeTypes } from '~/constants/placeTypes';\r\n\r\nconst customSVGIcon = (\r\n\ttype,\r\n\tfillColor = \"#FFFFFF\",\r\n\tstrokeColor = \"#000000\",\r\n\tbackgroundFill = \"#000000\",\r\n\tbackgroundStroke = \"#000000\"\r\n) => {\r\n\tlet svg = \"\";\r\n\tswitch (type) {\r\n\t\tcase placeTypes.FOOD:\r\n\t\t\tsvg = `\r\n\t\t\t\t\t<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n\t\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\r\n\t\t\t\t\t<style type=\"text/css\">\r\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\r\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\r\n\t\t\t\t\t</style>\r\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M25.7,36.6l0.6,15.8c0.1,2.4-2.3,2.4-2.3,2.4s-2.4,0-2.3-2.4l0.6-15.8c0.1-2-4.3-2.9-4-4.9l2.3-13.3h1.1\r\n\t\t\t\t\t\tl-0.6,9.7l1.7,1.2l0.6-10.9h1.1l0.6,10.9l1.7-1.2l-0.6-9.7h1.1l2.3,13.3C29.7,33.7,25.6,34.6,25.7,36.6z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M40,52.4c0,2.4-2.3,2.4-2.3,2.4s-2.5,0-2.3-2.4L36.6,39c-0.9,0-3.4-0.4-3.4-2.4v-6.1c0-2.4,0.3-6.4,1.2-8.2\r\n\t\t\t\t\t\tc1.1-2.4,3.9-4,5.6-4C40,18.3,40,52.4,40,52.4z\"/>\r\n\t\t\t\t\t</svg>\r\n\t\t\t\t\t`;\r\n\t\t\tbreak;\r\n\t\tcase placeTypes.TOURIST_ATTRACTION:\r\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\r\n\t\t\t\t\t<style type=\"text/css\">\r\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\r\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\r\n\t\t\t\t\t</style>\r\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M27,18.5c-1.2,0-1.7,1.1-2.2,2.2L23.7,23h-4.5c-1.9,0-3.4,1.5-3.4,3.4v11.2c0,1.9,1.5,3.4,3.4,3.4h22.5\r\n\t\t\t\t\t\tc1.9,0,3.4-1.5,3.4-3.4V26.4c0-1.9-1.5-3.4-3.4-3.4h-4.5L36,20.8c-0.6-1.1-1-2.2-2.2-2.2H27z M19.2,25.3c0.6,0,1.1,0.5,1.1,1.1\r\n\t\t\t\t\t\tc0,0.6-0.5,1.1-1.1,1.1c-0.6,0-1.1-0.5-1.1-1.1C18,25.8,18.5,25.3,19.2,25.3z M30.4,25.3c3.7,0,6.7,3,6.7,6.7s-3,6.7-6.7,6.7\r\n\t\t\t\t\t\ts-6.7-3-6.7-6.7S26.7,25.3,30.4,25.3z M30.4,28.7c-1.9,0-3.4,1.5-3.4,3.4s1.5,3.4,3.4,3.4c1.9,0,3.4-1.5,3.4-3.4\r\n\t\t\t\t\t\tS32.3,28.7,30.4,28.7z\"/>\r\n\t\t\t\t\t</svg>\r\n\t\t\t\t\t`;\r\n\t\t\tbreak;\r\n\t\tcase placeTypes.SCHOOL:\r\n\t\t\tsvg = `\r\n\t\t\t\t\t<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n\t\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\r\n\t\t\t\t\t<style type=\"text/css\">\r\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\r\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\r\n\t\t\t\t\t</style>\r\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M39.2,40.6c0,0-4.1,4.6-9.1,4.6S21,40.6,21,40.6v-5.2l9.1,5l9.1-5V40.6z\"/>\r\n\t\t\t\t\t<polygon class=\"st0\" points=\"44.4,40.4 41.8,40.4 41.8,31.4 30.1,37.8 15.8,30 30.1,22.2 44.4,30 \"/>\r\n\t\t\t\t\t</svg>\r\n\t\t\t\t\t`;\r\n\t\t\tbreak;\r\n\t\tcase placeTypes.STORE:\r\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\r\n\t\t\t\t\t<style type=\"text/css\">\r\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\r\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\r\n\t\t\t\t\t</style>\r\n\t\t\t\t\t<g>\r\n\t\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t</g>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M45.4,27.7L42,41.1c-0.1,0.6-0.7,1-1.3,1c1.8,0,3.3,1.5,3.3,3.3s-1.5,3.3-3.3,3.3s-3.3-1.5-3.3-3.3\r\n\t\t\t\t\t\ts1.5-3.3,3.3-3.3H23.3c1.8,0,3.3,1.5,3.3,3.3s-1.5,3.3-3.3,3.3S20,47.2,20,45.4s1.5-3.3,3.3-3.3c-0.6,0-1.2-0.4-1.3-1l-4.1-16.4\r\n\t\t\t\t\t\th-1.3c-0.7,0-1.3-0.6-1.3-1.3s0.6-1.3,1.3-1.3h2.3c0.6,0,1.2,0.4,1.3,1l0.8,3h23.1c0.4,0,0.8,0.2,1.1,0.5\r\n\t\t\t\t\t\tC45.4,26.9,45.5,27.3,45.4,27.7z\"/>\r\n\t\t\t\t\t<path d=\"M41.4,45.5c0-0.4-0.3-0.7-0.7-0.7S40,45.1,40,45.5C40.1,46.2,41.4,46.2,41.4,45.5z\"/>\r\n\t\t\t\t\t<path d=\"M24,45.5c0-0.4-0.3-0.7-0.7-0.7s-0.7,0.3-0.7,0.7C22.6,46.2,24,46.2,24,45.5z\"/>\r\n\t\t\t\t\t</svg>\r\n\t\t\t\t\t`;\r\n\t\t\tbreak;\r\n\t\tcase placeTypes.TRANSIT_STATION:\r\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" preserveAspectRatio=\"xMidYMid meet\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\r\n\t\t\t\t\t<style type=\"text/css\">\r\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\r\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\r\n\t\t\t\t\t</style>\r\n\t\t\t\t\t<g>\r\n\t\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t</g>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M26.3,41.3h-2.8L20.7,44h-1.4v-1.4l1.4-1.4c-2.3,0-4.2-1.9-4.2-4.2V26c0-2.3,1.9-4.2,4.2-4.2h9.7\r\n\t\t\t\t\t\tc2.3,0,4.2,1.9,4.2,4.2v1.4h-2.8v-2.8H19.3v9.7h6.9v7H26.3z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M44.3,43c0,0.5-0.4,1-1,1h-0.8c-0.5,0-1-0.5-1-1.1v-1.7H30.4V43c0,0.5-0.4,1.1-0.9,1.1h-0.9c-0.5,0-1-0.5-1-1\r\n\t\t\t\t\t\tv-7.6l2-5.7c0.2-0.6,0.7-0.9,1.4-0.9h10c0.6,0,1.1,0.4,1.3,0.9l2,5.7V43z\"/>\r\n\t\t\t\t\t<circle cx=\"20.7\" cy=\"37.1\" r=\"1.4\"/>\r\n\t\t\t\t\t<circle cx=\"41.5\" cy=\"37.1\" r=\"1.4\"/>\r\n\t\t\t\t\t<circle cx=\"30.4\" cy=\"37.1\" r=\"1.4\"/>\r\n\t\t\t\t\t<polygon points=\"31,30.2 29.6,34.4 42.4,34.4 40.9,30.2 \"/>\r\n\t\t\t\t\t</svg>\r\n\t\t\t\t\t`;\r\n\t\t\tbreak;\r\n\t\tcase placeTypes.PLACE_OF_WORSHIP:\r\n\t\t\tsvg = `<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n\t\t\t\t\tviewBox=\"0 0 60.8 89.6\" style=\"enable-background:new 0 0 60.8 89.6;\" xml:space=\"preserve\">\r\n\t\t\t\t\t<style type=\"text/css\">\r\n\t\t\t\t\t.st0{fill:${fillColor}; stroke:${strokeColor};}\r\n\t\t\t\t\t.svg-background{fill:${backgroundFill}; stroke:${backgroundStroke};}\r\n\t\t\t\t\t</style>\r\n\t\t\t\t\t<path class=\"svg-background\" d=\"M30.4,3.9C14.3,3.9,1.3,16.8,1.3,33c0,21,18.6,29.1,29.1,56.6C40.9,62.1,59.5,54.9,59.5,33C60.3,16.8,46.6,3.9,30.4,3.9z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M21.3,40.8h-3.8c-1.3,0-2.3-1-2.3-2.3v-4.3c0-0.8,0.5-1.6,1.2-2l4.9-2.7V40.8z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M38,40.8h-4.6v-4.6c0-1.7-1.4-3-3-3c-1.7,0-3,1.4-3,3v4.6h-4.6V30c0-0.8,0.4-1.5,1.1-2l1.9-1.2v-5.1l0,0\r\n\t\t\t\t\t\tc0-0.4,0.2-0.8,0.4-1.1l3.6-3.6c0.3-0.3,0.8-0.3,1.1,0l3.6,3.6c0.3,0.3,0.4,0.7,0.4,1.1v5.1l1.9,1.2c0.7,0.4,1.1,1.2,1.1,2L38,40.8\r\n\t\t\t\t\t\tL38,40.8z\"/>\r\n\t\t\t\t\t<path class=\"st0\" d=\"M45.6,38.5c0,1.3-1,2.3-2.3,2.3h-3.8V29.5l4.9,2.7c0.7,0.4,1.2,1.2,1.2,2C45.6,34.2,45.6,38.5,45.6,38.5z\"/>\r\n\t\t\t\t\t</svg>\r\n\t\t\t\t\t`;\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tconst iconUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;\r\n\treturn iconUrl;\r\n};\r\n\r\nexport const iconPath = \"M5.5 0A5.27 5.27 0 0 0 0 5.01v.49c0 1.73 1.38 3.43 2.07 4.12s3.43 4.12 3.43 4.12 2.75-3.43 3.43-4.12 2.06-2.39 2.06-4.12c.14-2.9-2.1-5.36-5-5.5H5.5Zm-.04 5.71c-.32 0-.57-.27-.56-.58 0-.32.27-.57.58-.56.32 0 .57.27.56.58 0 .31-.25.55-.56.56h-.02Z\";\r\n\r\nexport const markerIconProps = (placeMarkerConfigs, type) => {\r\n\r\n\tconst scaledWidth = placeMarkerConfigs.size;\r\n\tconst scaledHeight = (scaledWidth * 3) / 2;\r\n\tconst iconUrl = customSVGIcon(\r\n\t\ttype,\r\n\t\tplaceMarkerConfigs.colors.innerFillColor,\r\n\t\tplaceMarkerConfigs.colors.innerStrokeColor,\r\n\t\tplaceMarkerConfigs.colors.outerFillColor,\r\n\t\tplaceMarkerConfigs.colors.outerStrokeColor\r\n\t);\r\n\treturn {\r\n\t\turl: iconUrl,\r\n\t\tscaledSize: new google.maps.Size(scaledWidth, scaledHeight),\r\n\t\tanchor: new google.maps.Point(scaledWidth / 2, scaledHeight)\r\n\t};\r\n};\r\n\r\nexport const iconProps = () => {\r\n\treturn {\r\n\t\tpath: iconPath,\r\n\t\tfillOpacity: 1,\r\n\t\tstrokeWeight: 1.75,\r\n\t\tscale: 1.6,\r\n\t\tanchor: new google.maps.Point(12, 17)\r\n\t};\r\n};\r\n\r\nexport const markerIcon = markerConfigs => {\r\n\treturn {\r\n\t\t...iconProps(),\r\n\t\tfillColor: markerConfigs.fillColor,\r\n\t\tstrokeColor: markerConfigs.strokeColor\r\n\t};\r\n};\r\n\r\nexport const markerIconSelected = markerConfigs => {\r\n\treturn {\r\n\t\t...iconProps(),\r\n\t\tfillColor: markerConfigs.selectedFillColor,\r\n\t\tstrokeColor: markerConfigs.selectedStrokeColor\r\n\t};\r\n};\r\n\r\nexport const pinIcon = markerConfigs => {\r\n\tconst { fillColor, strokeColor } = markerConfigs;\r\n\r\n\tconst svg = `\r\n\t<svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"-6 -4 24 24\">\r\n\t\t<path d=\"${iconPath}\" fill=\"${fillColor}\" stroke=\"${strokeColor}\" stroke-width=\"2\"/>\r\n\t </svg>\r\n\t`;\r\n\r\n\treturn `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;\r\n};\r\n\r\n"],"names":["customSVGIcon","type","fillColor","arguments","length","undefined","strokeColor","backgroundFill","backgroundStroke","svg","placeTypes","FOOD","concat","TOURIST_ATTRACTION","SCHOOL","STORE","TRANSIT_STATION","PLACE_OF_WORSHIP","iconUrl","encodeURIComponent","iconPath","markerIconProps","placeMarkerConfigs","scaledWidth","size","scaledHeight","colors","innerFillColor","innerStrokeColor","outerFillColor","outerStrokeColor","url","scaledSize","google","maps","Size","anchor","Point","iconProps","path","fillOpacity","strokeWeight","scale","markerIcon","markerConfigs","_objectSpread","markerIconSelected","selectedFillColor","selectedStrokeColor","pinIcon"],"mappings":";;;AAGA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAClBC,IAAI,EAKA;AAAA,EAAA,IAJJC,SAAS,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,SAAS,CAAA;AAAA,EAAA,IACrBG,WAAW,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,SAAS,CAAA;AAAA,EAAA,IACvBI,cAAc,GAAAJ,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,SAAS,CAAA;AAAA,EAAA,IAC1BK,gBAAgB,GAAAL,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,SAAS,CAAA;EAE5B,IAAIM,GAAG,GAAG,EAAE,CAAA;AACZ,EAAA,QAAQR,IAAI;IACX,KAAKS,UAAU,CAACC,IAAI;AACnBF,MAAAA,GAAG,0WAAAG,MAAA,CAIWV,SAAS,EAAA,WAAA,CAAA,CAAAU,MAAA,CAAYN,WAAW,EAAAM,qCAAAA,CAAAA,CAAAA,MAAA,CACrBL,cAAc,EAAA,WAAA,CAAA,CAAAK,MAAA,CAAYJ,gBAAgB,EAQhE,qqBAAA,CAAA,CAAA;AACH,MAAA,MAAA;IACD,KAAKE,UAAU,CAACG,kBAAkB;AACjCJ,MAAAA,GAAG,4VAAAG,MAAA,CA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a,EAAI;AAC1C,EAAA,OAAAC,cAAA,CAAAA,cAAA,CACIP,EAAAA,EAAAA,SAAS,EAAE,CAAA,EAAA,EAAA,EAAA;IACdpC,SAAS,EAAE0C,aAAa,CAAC1C,SAAS;IAClCI,WAAW,EAAEsC,aAAa,CAACtC,WAAAA;AAAW,GAAA,CAAA,CAAA;AAExC,EAAC;IAEYwC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAGF,aAAa,EAAI;AAClD,EAAA,OAAAC,cAAA,CAAAA,cAAA,CACIP,EAAAA,EAAAA,SAAS,EAAE,CAAA,EAAA,EAAA,EAAA;IACdpC,SAAS,EAAE0C,aAAa,CAACG,iBAAiB;IAC1CzC,WAAW,EAAEsC,aAAa,CAACI,mBAAAA;AAAmB,GAAA,CAAA,CAAA;AAEhD,EAAC;IAEYC,OAAO,GAAG,SAAVA,OAAOA,CAAGL,aAAa,EAAI;AACvC,EAAA,IAAQ1C,SAAS,GAAkB0C,aAAa,CAAxC1C,SAAS;IAAEI,WAAW,GAAKsC,aAAa,CAA7BtC,WAAW,CAAA;AAE9B,EAAA,IAAMG,GAAG,GAAA,wIAAA,CAAAG,MAAA,CAEGQ,QAAQ,EAAA,YAAA,CAAA,CAAAR,MAAA,CAAWV,SAAS,EAAA,cAAA,CAAA,CAAAU,MAAA,CAAaN,WAAW,EAE/D,yCAAA,CAAA,CAAA;AAED,EAAA,OAAA,0BAAA,CAAAM,MAAA,CAAkCO,kBAAkB,CAACV,GAAG,CAAC,CAAA,CAAA;AAC1D;;;;"}
|
package/dist/util/mapUtil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapUtil.js","sources":["../../src/util/mapUtil.js"],"sourcesContent":["export const getDistinctItemsByProximity = (items, listingEntitiesDetails) => {\n\tconst clusters = {};\n\n\tif (!listingEntitiesDetails) return [];\n\n\tconst closeItemPairs = findCloseItems(listingEntitiesDetails);\n\tif (closeItemPairs.length > 0) {\n\t\tlistingEntitiesDetails = adjustItemPositions(\n\t\t\tlistingEntitiesDetails,\n\t\t\tcloseItemPairs\n\t\t);\n\t}\n\n\titems?.forEach(item => {\n\t\tif(item.entityId !== -1){\n\n\t\t\tconst entityDetails = listingEntitiesDetails[item.entityId];\n\n\t\t\tif (!entityDetails) {\n\t\t\t\tconsole.error(`Details not found for entityId: ${item.entityId}`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titem.mapDetails = entityDetails;\n\n\t\t\tif (!clusters[item.entityId]) {\n\t\t\t\tclusters[item.entityId] = {\n\t\t\t\t\t...item.mapDetails,\n\t\t\t\t\titems: { [item.id]: item }\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tclusters[item.entityId].items[item.id] = item;\n\t\t\t}}\n\t});\n\n\treturn Object.values(clusters);\n};\n\nexport const findCloseItems = itemsObj => {\n\tconst closeItems = [];\n\tconst items = Object.values(itemsObj); // Convert object to array for iteration\n\tconst proximityThreshold = 0.0001;\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\tfor (let j = i + 1; j < items.length; j++) {\n\t\t\tconst distanceLat = Math.abs(items[i].latitude - items[j].latitude);\n\t\t\tconst distanceLng = Math.abs(items[i].longitude - items[j].longitude);\n\t\t\tif (\n\t\t\t\tdistanceLat < proximityThreshold &&\n\t\t\t\tdistanceLng < proximityThreshold\n\t\t\t) {\n\t\t\t\tcloseItems.push({ item1: items[i], item2: items[j] });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn closeItems;\n};\n\nexport const adjustItemPositions = (itemsObj, closeItemPairs) => {\n\tconst adjustmentValue = 0.0001;\n\tconst adjustedItems = { ...itemsObj }; // Create a shallow copy of the object\n\n\tcloseItemPairs.forEach(pair => {\n\t\tif (adjustedItems[pair.item1.id] && adjustedItems[pair.item2.id]) {\n\t\t\tadjustedItems[pair.item2.id].latitude += adjustmentValue;\n\t\t\tadjustedItems[pair.item2.id].longitude += adjustmentValue;\n\t\t}\n\t});\n\n\treturn adjustedItems;\n};\n\nexport const clusterOptions = (clusterGridSize, fillColor) => {\n\treturn {\n\t\tgridSize: clusterGridSize,\n\t\tmaxZoom:15,\n\t\tstyles:[{\n\t\t\turl: createSvgDataUri(fillColor),\n\t\t\ttextColor:'white',\n\t\t\theight: 40,\n\t\t\twidth: 40\n\t\t}]\n\t};\n};\n\nfunction createSvgDataUri(fillColor) {\n\tconst svg = `<svg width=\"50\" height=\"50\" xmlns=\"http://www.w3.org/2000/svg\">\n\t <circle cx=\"25\" cy=\"25\" r=\"20\" fill=\"${fillColor}\" />\n\t</svg>`;\n\treturn `data:image/svg+xml;base64,${btoa(svg)}`;\n}\n"],"names":["getDistinctItemsByProximity","items","listingEntitiesDetails","clusters","closeItemPairs","findCloseItems","length","adjustItemPositions","forEach","item","entityId","entityDetails","console","error","concat","mapDetails","_objectSpread","_defineProperty","id","Object","values","itemsObj","closeItems","proximityThreshold","i","j","distanceLat","Math","abs","latitude","distanceLng","longitude","push","item1","item2","adjustmentValue","adjustedItems","pair","clusterOptions","clusterGridSize","fillColor","gridSize","maxZoom","styles","url","createSvgDataUri","textColor","height","width","svg","btoa"],"mappings":";;AAAO,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,KAAK,EAAEC,sBAAsB,EAAK;EAC7E,IAAMC,QAAQ,GAAG,EAAE,CAAA;AAEnB,EAAA,IAAI,CAACD,sBAAsB,EAAE,OAAO,EAAE,CAAA;AAEtC,EAAA,IAAME,cAAc,GAAGC,cAAc,CAACH,sBAAsB,CAAC,CAAA;AAC7D,EAAA,IAAIE,cAAc,CAACE,MAAM,GAAG,CAAC,EAAE;AAC9BJ,IAAAA,sBAAsB,GAAGK,mBAAmB,CAC3CL,sBAAsB,EACtBE,cACD,CAAC,CAAA;AACF,GAAA;EAEAH,KAAK,KAAA,IAAA,IAALA,KAAK,KAALA,KAAAA,CAAAA,IAAAA,KAAK,CAAEO,OAAO,CAAC,UAAAC,IAAI,EAAI;AACtB,IAAA,IAAGA,IAAI,CAACC,QAAQ,KAAK,CAA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ACa,SAAS,IAAII,eAAe,CAAA;AAC1D,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOC,aAAa,CAAA;AACrB,EAAC;AAEM,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,eAAe,EAAEC,SAAS,EAAK;EAC7D,OAAO;AACNC,IAAAA,QAAQ,EAAEF,eAAe;AACzBG,IAAAA,OAAO,EAAC,EAAE;AACVC,IAAAA,MAAM,EAAC,CAAC;AACPC,MAAAA,GAAG,EAAEC,gBAAgB,CAACL,SAAS,CAAC;AAChCM,MAAAA,SAAS,EAAC,OAAO;AACjBC,MAAAA,MAAM,EAAE,EAAE;AACVC,MAAAA,KAAK,EAAE,EAAA;KACP,CAAA;GACD,CAAA;AACF,EAAC;AAED,SAASH,gBAAgBA,CAACL,SAAS,EAAE;AACpC,EAAA,IAAMS,GAAG,GAAA,yHAAA,CAAAnC,MAAA,CACgC0B,SAAS,EAC3C,iBAAA,CAAA,CAAA;AACP,EAAA,OAAA,4BAAA,CAAA1B,MAAA,CAAoCoC,IAAI,CAACD,GAAG,CAAC,CAAA,CAAA;AAC9C;;;;"}
|
|
1
|
+
{"version":3,"file":"mapUtil.js","sources":["../../src/util/mapUtil.js"],"sourcesContent":["export const getDistinctItemsByProximity = (items, listingEntitiesDetails) => {\r\n\tconst clusters = {};\r\n\r\n\tif (!listingEntitiesDetails) return [];\r\n\r\n\tconst closeItemPairs = findCloseItems(listingEntitiesDetails);\r\n\tif (closeItemPairs.length > 0) {\r\n\t\tlistingEntitiesDetails = adjustItemPositions(\r\n\t\t\tlistingEntitiesDetails,\r\n\t\t\tcloseItemPairs\r\n\t\t);\r\n\t}\r\n\r\n\titems?.forEach(item => {\r\n\t\tif(item.entityId !== -1){\r\n\r\n\t\t\tconst entityDetails = listingEntitiesDetails[item.entityId];\r\n\r\n\t\t\tif (!entityDetails) {\r\n\t\t\t\tconsole.error(`Details not found for entityId: ${item.entityId}`);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\titem.mapDetails = entityDetails;\r\n\r\n\t\t\tif (!clusters[item.entityId]) {\r\n\t\t\t\tclusters[item.entityId] = {\r\n\t\t\t\t\t...item.mapDetails,\r\n\t\t\t\t\titems: { [item.id]: item }\r\n\t\t\t\t};\r\n\t\t\t} else {\r\n\t\t\t\tclusters[item.entityId].items[item.id] = item;\r\n\t\t\t}}\r\n\t});\r\n\r\n\treturn Object.values(clusters);\r\n};\r\n\r\nexport const findCloseItems = itemsObj => {\r\n\tconst closeItems = [];\r\n\tconst items = Object.values(itemsObj); // Convert object to array for iteration\r\n\tconst proximityThreshold = 0.0001;\r\n\r\n\tfor (let i = 0; i < items.length; i++) {\r\n\t\tfor (let j = i + 1; j < items.length; j++) {\r\n\t\t\tconst distanceLat = Math.abs(items[i].latitude - items[j].latitude);\r\n\t\t\tconst distanceLng = Math.abs(items[i].longitude - items[j].longitude);\r\n\t\t\tif (\r\n\t\t\t\tdistanceLat < proximityThreshold &&\r\n\t\t\t\tdistanceLng < proximityThreshold\r\n\t\t\t) {\r\n\t\t\t\tcloseItems.push({ item1: items[i], item2: items[j] });\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn closeItems;\r\n};\r\n\r\nexport const adjustItemPositions = (itemsObj, closeItemPairs) => {\r\n\tconst adjustmentValue = 0.0001;\r\n\tconst adjustedItems = { ...itemsObj }; // Create a shallow copy of the object\r\n\r\n\tcloseItemPairs.forEach(pair => {\r\n\t\tif (adjustedItems[pair.item1.id] && adjustedItems[pair.item2.id]) {\r\n\t\t\tadjustedItems[pair.item2.id].latitude += adjustmentValue;\r\n\t\t\tadjustedItems[pair.item2.id].longitude += adjustmentValue;\r\n\t\t}\r\n\t});\r\n\r\n\treturn adjustedItems;\r\n};\r\n\r\nexport const clusterOptions = (clusterGridSize, fillColor) => {\r\n\treturn {\r\n\t\tgridSize: clusterGridSize,\r\n\t\tmaxZoom:15,\r\n\t\tstyles:[{\r\n\t\t\turl: createSvgDataUri(fillColor),\r\n\t\t\ttextColor:'white',\r\n\t\t\theight: 40,\r\n\t\t\twidth: 40\r\n\t\t}]\r\n\t};\r\n};\r\n\r\nfunction createSvgDataUri(fillColor) {\r\n\tconst svg = `<svg width=\"50\" height=\"50\" xmlns=\"http://www.w3.org/2000/svg\">\r\n\t <circle cx=\"25\" cy=\"25\" r=\"20\" fill=\"${fillColor}\" />\r\n\t</svg>`;\r\n\treturn `data:image/svg+xml;base64,${btoa(svg)}`;\r\n}\r\n"],"names":["getDistinctItemsByProximity","items","listingEntitiesDetails","clusters","closeItemPairs","findCloseItems","length","adjustItemPositions","forEach","item","entityId","entityDetails","console","error","concat","mapDetails","_objectSpread","_defineProperty","id","Object","values","itemsObj","closeItems","proximityThreshold","i","j","distanceLat","Math","abs","latitude","distanceLng","longitude","push","item1","item2","adjustmentValue","adjustedItems","pair","clusterOptions","clusterGridSize","fillColor","gridSize","maxZoom","styles","url","createSvgDataUri","textColor","height","width","svg","btoa"],"mappings":";;AAAO,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,KAAK,EAAEC,sBAAsB,EAAK;EAC7E,IAAMC,QAAQ,GAAG,EAAE,CAAA;AAEnB,EAAA,IAAI,CAACD,sBAAsB,EAAE,OAAO,EAAE,CAAA;AAEtC,EAAA,IAAME,cAAc,GAAGC,cAAc,CAACH,sBAAsB,CAAC,CAAA;AAC7D,EAAA,IAAIE,cAAc,CAACE,MAAM,GAAG,CAAC,EAAE;AAC9BJ,IAAAA,sBAAsB,GAAGK,mBAAmB,CAC3CL,sBAAsB,EACtBE,cACD,CAAC,CAAA;AACF,GAAA;EAEAH,KAAK,KAAA,IAAA,IAALA,KAAK,KAALA,KAAAA,CAAAA,IAAAA,KAAK,CAAEO,OAAO,CAAC,UAAAC,IAAI,EAAI;AACtB,IAAA,IAAGA,IAAI,CAACC,QAAQ,KAAK,CAAC,CAAC,EAAC;AAEvB,MAAA,IAAMC,aAAa,GAAGT,sBAAsB,CAACO,IAAI,CAACC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A,OAAOC,aAAa,CAAA;AACrB,EAAC;AAEM,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,eAAe,EAAEC,SAAS,EAAK;EAC7D,OAAO;AACNC,IAAAA,QAAQ,EAAEF,eAAe;AACzBG,IAAAA,OAAO,EAAC,EAAE;AACVC,IAAAA,MAAM,EAAC,CAAC;AACPC,MAAAA,GAAG,EAAEC,gBAAgB,CAACL,SAAS,CAAC;AAChCM,MAAAA,SAAS,EAAC,OAAO;AACjBC,MAAAA,MAAM,EAAE,EAAE;AACVC,MAAAA,KAAK,EAAE,EAAA;KACP,CAAA;GACD,CAAA;AACF,EAAC;AAED,SAASH,gBAAgBA,CAACL,SAAS,EAAE;AACpC,EAAA,IAAMS,GAAG,GAAA,yHAAA,CAAAnC,MAAA,CACgC0B,SAAS,EAC3C,iBAAA,CAAA,CAAA;AACP,EAAA,OAAA,4BAAA,CAAA1B,MAAA,CAAoCoC,IAAI,CAACD,GAAG,CAAC,CAAA,CAAA;AAC9C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"version":3,"file":"sortUtil.js","sources":["../../src/util/sortUtil.js"],"sourcesContent":["export const dynamicSort = (items, fieldName, order = \"asc\") => {\r\n\tif (!items || !items.length) {\r\n\t\treturn [];\r\n\t}\r\n\r\n\tconst inferType = value => {\r\n\t\tif (!isNaN(Date.parse(value)) && isNaN(value)) {\r\n\t\t\treturn \"date\";\r\n\t\t} else if (!isNaN(parseFloat(value)) && isFinite(value)) {\r\n\t\t\treturn \"number\";\r\n\t\t} else {\r\n\t\t\treturn \"string\";\r\n\t\t}\r\n\t};\r\n\r\n\tconst dataType = inferType(items[0].fields[fieldName]);\r\n\r\n\treturn items.sort((a, b) => {\r\n\t\tlet valA = a.fields[fieldName];\r\n\t\tlet valB = b.fields[fieldName];\r\n\t\tif (!valA || !valB) return;\r\n\t\tlet comparison = 0;\r\n\r\n\t\tif (dataType === \"string\") {\r\n\t\t\tcomparison = valA.localeCompare(valB);\r\n\t\t} else if (dataType === \"number\") {\r\n\t\t\tcomparison = valA - valB;\r\n\t\t} else if (dataType === \"date\") {\r\n\t\t\tcomparison = new Date(valA) - new Date(valB);\r\n\t\t}\r\n\t\treturn order === \"desc\" ? comparison * -1 : comparison;\r\n\t});\r\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 => {\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
|
+
{"version":3,"file":"stringUtils.js","sources":["../../src/util/stringUtils.js"],"sourcesContent":["export const capitalize = str => {\r\n\tif (str && typeof str === \"string\") {\r\n\t\treturn str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\r\n\t}\r\n\treturn str;\r\n};\r\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) => {\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,SAAvB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
{"version":3,"file":"urlFilterUtil.js","sources":["../../src/util/urlFilterUtil.js"],"sourcesContent":["export const updateURLWithFilters = (filters, location, query, handleUrlUpdate) => {\r\n\tconst searchParams = new URLSearchParams(location.search);\r\n\r\n\tconst filteredSearchParams = new URLSearchParams();\r\n\tfor (const [key, value] of searchParams.entries()) {\r\n\t\tif (!key.includes('.') && key !== 'query') {\r\n\t\t\tfilteredSearchParams.set(key, value);\r\n\t\t}\r\n\t}\r\n\r\n\tif (query) {\r\n\t\tfilteredSearchParams.set('query', query);\r\n\t}\r\n\r\n\tfor (const category in filters) {\r\n\t\tfor (const filter in filters[category]) {\r\n\t\t\tconst key = `${category}.${filter}`;\r\n\t\t\tif (filters[category][filter]) {\r\n\t\t\t\tfilteredSearchParams.set(key, 'true');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\thandleUrlUpdate(filteredSearchParams.toString());\r\n};\r\n\r\nfunction notifyParentOfUrlChange() {\r\n\tsetTimeout(() => {\r\n\t\tvar message = {\r\n\t\t\ttype: 'URL_CHANGE',\r\n\t\t\turl: window.location.href\r\n\t\t};\r\n\t\twindow.parent.postMessage(message, \"*\");\r\n\t}, 500);\r\n}\r\n\r\nexport const parseQueryParams = search => {\r\n\tconst queryParams = {};\r\n\tif (!search) return queryParams;\r\n\tlet queryString = search.split('?')[1];\r\n\tif (!queryString) {\r\n\t\treturn queryParams;\r\n\t}\r\n\tqueryString = queryString.replaceAll('+', ' ');\r\n\tqueryString.split('&').forEach(param => {\r\n\t\tconst [key, value] = param.split('=');\r\n\t\tqueryParams[decodeURIComponent(key)] = decodeURIComponent(value);\r\n\t});\r\n\treturn queryParams;\r\n};\r\n\r\nexport const filtersFromURL = location => {\r\n\tif (!location || !location.search) return;\r\n\tconst filters = {};\r\n\tlet queryParam = null;\r\n\tconst queryParams = parseQueryParams(location.search);\r\n\tif (!queryParams) return;\r\n\tObject.keys(queryParams).forEach(key => {\r\n\t\tif (key && key.includes('.')) {\r\n\t\t\tconst [category, filter] = key.split('.');\r\n\t\t\tif (!filters[category]) {\r\n\t\t\t\tfilters[category] = {};\r\n\t\t\t}\r\n\t\t\tfilters[category][filter] = queryParams[key] === 'true';\r\n\t\t} else if (key === 'query') {\r\n\t\t\tqueryParam = queryParams[key];\r\n\t\t}\r\n\t});\r\n\r\n\treturn { filters, query: queryParam };\r\n};\r\n\r\nexport const hasFiltersInURL = location => {\r\n\tif (!location || !location.search) return;\r\n\tconst queryParams = parseQueryParams(location.search);\r\n\tif (!queryParams) return;\r\n\treturn Object.keys(queryParams).some(key => key.includes('.'));\r\n};\r\n\r\nexport const hasQueryInUrl = location => {\r\n\tif (!location || !location.search) return;\r\n\tconst queryParams = parseQueryParams(location.search);\r\n\tif (!queryParams) return;\r\n\treturn Object.keys(queryParams).includes('query');\r\n};\r\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,GAAAC,0BAAA,CACxBL,YAAY,CAACM,OAAO,EAAE,CAAA;IAAAC,KAAA,CAAA;AAAA,EAAA,IAAA;IAAjD,KAAAH,SAAA,CAAAI,CAAA,EAAAD,EAAAA,CAAAA,CAAAA,KAAA,GAAAH,SAAA,CAAAK,CAAA,EAAAC,EAAAA,IAAA,GAAm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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
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@abcagency/hc-ui-components",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "UI Components for HireControl",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist",
|
|
8
|
-
"src"
|
|
9
|
-
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "cross-env NODE_ENV=production rollup -c",
|
|
12
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"hirecontrol",
|
|
16
|
-
"ui",
|
|
17
|
-
"components"
|
|
18
|
-
],
|
|
19
|
-
"author": "Aloysius Butler & Clark",
|
|
20
|
-
"license": "ISC",
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@headlessui/react": "^1.7.19",
|
|
23
|
-
"@iconify/react": "^4.1.1",
|
|
24
|
-
"@radix-ui/react-accordion": "^1.1.2",
|
|
25
|
-
"@radix-ui/react-dialog": "^1.0.5",
|
|
26
|
-
"@radix-ui/react-select": "^2.0.0",
|
|
27
|
-
"@radix-ui/react-tabs": "^1.0.4",
|
|
28
|
-
"@react-google-maps/api": "^2.19.3",
|
|
29
|
-
"@testing-library/react": "^13.4.0",
|
|
30
|
-
"ajv": "^8.16.0",
|
|
31
|
-
"ajv-keywords": "^5.1.0",
|
|
32
|
-
"framer-motion": "^10.18.0",
|
|
33
|
-
"fuse.js": "^7.0.0",
|
|
34
|
-
"npm": "^10.8.1",
|
|
35
|
-
"react-router-dom": "^6.23.1",
|
|
36
|
-
"react-scripts": "5.0.1",
|
|
37
|
-
"react-wrap-balancer": "^1.1.1",
|
|
38
|
-
"rollup-plugin-filesize": "^10.0.0",
|
|
39
|
-
"rollup-plugin-progress": "^1.1.2",
|
|
40
|
-
"rollup-plugin-visualizer": "^5.12.0",
|
|
41
|
-
"tailwind-merge": "^2.2.0",
|
|
42
|
-
"use-places-autocomplete": "^4.0.1",
|
|
43
|
-
"web-vitals": "^2.1.4"
|
|
44
|
-
},
|
|
45
|
-
"resolutions": {
|
|
46
|
-
"react": "^18.3.1",
|
|
47
|
-
"react-dom": "^18.3.1"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@babel/cli": "^7.24.6",
|
|
51
|
-
"@babel/core": "^7.24.6",
|
|
52
|
-
"@babel/eslint-parser": "^7.24.6",
|
|
53
|
-
"@babel/preset-env": "^7.24.6",
|
|
54
|
-
"@babel/preset-react": "^7.24.6",
|
|
55
|
-
"@iconify/react": "^4.1.1",
|
|
56
|
-
"@rollup/plugin-alias": "^5.1.0",
|
|
57
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
58
|
-
"@rollup/plugin-commonjs": "^25.0.8",
|
|
59
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
60
|
-
"@rollup/plugin-replace": "^5.0.5",
|
|
61
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
62
|
-
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
63
|
-
"@tailwindcss/forms": "^0.5.7",
|
|
64
|
-
"@tailwindcss/typography": "^0.5.13",
|
|
65
|
-
"@types/node": "^20.14.2",
|
|
66
|
-
"@types/react": "^18.3.3",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^7.13.0",
|
|
68
|
-
"@typescript-eslint/parser": "^7.13.0",
|
|
69
|
-
"autoprefixer": "^10.4.19",
|
|
70
|
-
"cross-env": "^7.0.3",
|
|
71
|
-
"dotenv": "^16.4.5",
|
|
72
|
-
"eslint": "^8.57.0",
|
|
73
|
-
"eslint-config-prettier": "^9.1.0",
|
|
74
|
-
"eslint-plugin-import": "^2.29.1",
|
|
75
|
-
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
76
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
77
|
-
"eslint-plugin-react": "^7.34.2",
|
|
78
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
79
|
-
"npm-force-resolutions": "^0.0.10",
|
|
80
|
-
"postcss": "^8.4.38",
|
|
81
|
-
"postcss-prefixer": "^3.0.0",
|
|
82
|
-
"postcss-preset-env": "^9.5.14",
|
|
83
|
-
"rollup": "^4.18.0",
|
|
84
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
85
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
86
|
-
"tailwindcss": "^3.4.3",
|
|
87
|
-
"tailwindcss-animate": "^1.0.7",
|
|
88
|
-
"typescript": "^4.9.5"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@abcagency/hc-ui-components",
|
|
3
|
+
"version": "1.3.61",
|
|
4
|
+
"description": "UI Components for HireControl",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"src"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "cross-env NODE_ENV=production rollup -c",
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"hirecontrol",
|
|
16
|
+
"ui",
|
|
17
|
+
"components"
|
|
18
|
+
],
|
|
19
|
+
"author": "Aloysius Butler & Clark",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@headlessui/react": "^1.7.19",
|
|
23
|
+
"@iconify/react": "^4.1.1",
|
|
24
|
+
"@radix-ui/react-accordion": "^1.1.2",
|
|
25
|
+
"@radix-ui/react-dialog": "^1.0.5",
|
|
26
|
+
"@radix-ui/react-select": "^2.0.0",
|
|
27
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
28
|
+
"@react-google-maps/api": "^2.19.3",
|
|
29
|
+
"@testing-library/react": "^13.4.0",
|
|
30
|
+
"ajv": "^8.16.0",
|
|
31
|
+
"ajv-keywords": "^5.1.0",
|
|
32
|
+
"framer-motion": "^10.18.0",
|
|
33
|
+
"fuse.js": "^7.0.0",
|
|
34
|
+
"npm": "^10.8.1",
|
|
35
|
+
"react-router-dom": "^6.23.1",
|
|
36
|
+
"react-scripts": "5.0.1",
|
|
37
|
+
"react-wrap-balancer": "^1.1.1",
|
|
38
|
+
"rollup-plugin-filesize": "^10.0.0",
|
|
39
|
+
"rollup-plugin-progress": "^1.1.2",
|
|
40
|
+
"rollup-plugin-visualizer": "^5.12.0",
|
|
41
|
+
"tailwind-merge": "^2.2.0",
|
|
42
|
+
"use-places-autocomplete": "^4.0.1",
|
|
43
|
+
"web-vitals": "^2.1.4"
|
|
44
|
+
},
|
|
45
|
+
"resolutions": {
|
|
46
|
+
"react": "^18.3.1",
|
|
47
|
+
"react-dom": "^18.3.1"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@babel/cli": "^7.24.6",
|
|
51
|
+
"@babel/core": "^7.24.6",
|
|
52
|
+
"@babel/eslint-parser": "^7.24.6",
|
|
53
|
+
"@babel/preset-env": "^7.24.6",
|
|
54
|
+
"@babel/preset-react": "^7.24.6",
|
|
55
|
+
"@iconify/react": "^4.1.1",
|
|
56
|
+
"@rollup/plugin-alias": "^5.1.0",
|
|
57
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
58
|
+
"@rollup/plugin-commonjs": "^25.0.8",
|
|
59
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
60
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
61
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
62
|
+
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
63
|
+
"@tailwindcss/forms": "^0.5.7",
|
|
64
|
+
"@tailwindcss/typography": "^0.5.13",
|
|
65
|
+
"@types/node": "^20.14.2",
|
|
66
|
+
"@types/react": "^18.3.3",
|
|
67
|
+
"@typescript-eslint/eslint-plugin": "^7.13.0",
|
|
68
|
+
"@typescript-eslint/parser": "^7.13.0",
|
|
69
|
+
"autoprefixer": "^10.4.19",
|
|
70
|
+
"cross-env": "^7.0.3",
|
|
71
|
+
"dotenv": "^16.4.5",
|
|
72
|
+
"eslint": "^8.57.0",
|
|
73
|
+
"eslint-config-prettier": "^9.1.0",
|
|
74
|
+
"eslint-plugin-import": "^2.29.1",
|
|
75
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
76
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
77
|
+
"eslint-plugin-react": "^7.34.2",
|
|
78
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
79
|
+
"npm-force-resolutions": "^0.0.10",
|
|
80
|
+
"postcss": "^8.4.38",
|
|
81
|
+
"postcss-prefixer": "^3.0.0",
|
|
82
|
+
"postcss-preset-env": "^9.5.14",
|
|
83
|
+
"rollup": "^4.18.0",
|
|
84
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
85
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
86
|
+
"tailwindcss": "^3.4.3",
|
|
87
|
+
"tailwindcss-animate": "^1.0.7",
|
|
88
|
+
"typescript": "^4.9.5"
|
|
89
|
+
}
|
|
90
|
+
}
|
package/src/.editorconfig
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# EditorConfig is awesome: http://EditorConfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
end_of_line = lf
|
|
7
|
-
indent_style = tab
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.md]
|
|
12
|
-
trim_trailing_whitespace = false
|
|
1
|
+
# EditorConfig is awesome: http://EditorConfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
indent_style = tab
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.md]
|
|
12
|
+
trim_trailing_whitespace = false
|
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/bundleIndex.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import HireControlMap from '~/components/HireControlMap';
|
|
4
|
-
|
|
5
|
-
const initializeComponent = (elementId, props) => {
|
|
6
|
-
const element = document.getElementById(elementId);
|
|
7
|
-
if (element) {
|
|
8
|
-
ReactDOM.render(<div className='hc-bundle'><HireControlMap {...props} /></div>, element);
|
|
9
|
-
} else {
|
|
10
|
-
console.error(`Element with id ${elementId} not found`);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { HireControlMap, initializeComponent };
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import HireControlMap from '~/components/HireControlMap';
|
|
4
|
+
|
|
5
|
+
const initializeComponent = (elementId, props) => {
|
|
6
|
+
const element = document.getElementById(elementId);
|
|
7
|
+
if (element) {
|
|
8
|
+
ReactDOM.render(<div className='hc-bundle'><HireControlMap {...props} /></div>, element);
|
|
9
|
+
} else {
|
|
10
|
+
console.error(`Element with id ${elementId} not found`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { HireControlMap, initializeComponent };
|