Skip to content

Commit

Permalink
Merge pull request #217 from makeen-project/dependabot-fixes
Browse files Browse the repository at this point in the history
Fix dependabot issues
  • Loading branch information
wadhawh authored Jul 25, 2024
2 parents d75fa16 + 27d4095 commit c7f3285
Show file tree
Hide file tree
Showing 9 changed files with 2,023 additions and 7,643 deletions.
1 change: 1 addition & 0 deletions extra/create-build-with-demo-lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async function main() {
console.log("Done.");
} catch (error) {
console.error(`Error: ${error.message}`);
throw new Error(`Error: ${error}`);
}
}

Expand Down
9,576 changes: 1,998 additions & 7,578 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"@aws-sdk/client-pinpoint": "3.496.0",
"@aws-sdk/credential-providers": "3.370.0",
"@turf/turf": "6.5.0",
"aws-amplify": "4.3.43",
"cypress-mochawesome-reporter": "3.8.2",
"aws-amplify": "5.3.19",
"date-fns": "2.29.3",
"i18next": "23.2.8",
"i18next-browser-languagedetector": "7.1.0",
Expand Down Expand Up @@ -81,6 +80,7 @@
"ajv": "8.17.1",
"cypress": "12.10.0",
"cypress-browser-permissions": "1.1.0",
"cypress-mochawesome-reporter": "3.8.2",
"eslint": "8.22.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-flowtype": "8.0.3",
Expand Down Expand Up @@ -110,15 +110,26 @@
"node": ">=14.x.x"
},
"overrides": {
"ava": "^3.0.0",
"braces": "^3.0.3",
"@cypress/request": "^3.0.0",
"fast-xml-parser": "^4.1.2",
"got": "^11.8.5",
"json5": "^1.0.2",
"lodash": "^4.17.21",
"minimist": "^1.2.8",
"underscore": "^1.12.1"
"nth-check": "^2.0.1",
"postcss": "^8.4.31",
"semver": "^5.7.2",
"trim-newlines": "^3.0.1",
"underscore": "^1.12.1",
"underscore.string": "^3.3.5"
},
"jest": {
"moduleNameMapper": {
"^@demo/(.*)$": "<rootDir>/src/$1",
"\\.(css|scss)$": "<rootDir>/__mocks__/styleMock.ts"
"\\.(css|scss)$": "<rootDir>/__mocks__/styleMock.ts",
"^axios$": "axios/dist/node/axios.cjs"
},
"collectCoverageFrom": [
"**/*.{js,jsx,ts,tsx}",
Expand Down
15 changes: 2 additions & 13 deletions src/core/AppWrapper/AppWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ThemeProvider } from "@aws-amplify/ui-react";
import { appConfig } from "@demo/core/constants";
import { useAmplifyAuth } from "@demo/hooks";
import { appTheme } from "@demo/theme";
import { EsriMapEnum } from "@demo/types";

import "@aws-amplify/ui-react/styles.css";
import "react-toastify/dist/ReactToastify.min.css";
Expand All @@ -16,8 +15,7 @@ import "react-tooltip/dist/react-tooltip.css";
import "mapbox-gl/dist/mapbox-gl.css";

const {
ROUTES: { DEMO },
MAP_RESOURCES: { MAP_ITEMS }
ROUTES: { DEMO }
} = appConfig;

interface AppWrapperProps {
Expand Down Expand Up @@ -47,16 +45,7 @@ const AppWrapper: FC<AppWrapperProps> = ({ children }) => {
: {
identityPoolId,
region
},
geo: {
AmazonLocationService: {
maps: {
items: MAP_ITEMS,
default: EsriMapEnum.ESRI_LIGHT
},
region
}
}
}
}),
[identityPoolId, region, userPoolId, userPoolClientId, userDomain]
);
Expand Down
21 changes: 1 addition & 20 deletions src/hooks/useAmplifyMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { useEffect, useMemo } from "react";

import { appConfig } from "@demo/core/constants";
import { useAmplifyMapService } from "@demo/services";
import { useAmplifyMapStore } from "@demo/stores";
import {
CurrentLocationDataType,
Expand All @@ -18,8 +17,6 @@ import {

import { OpenDataMapEnum } from "@demo/types/Enums";
import { getCountryCode } from "@demo/utils/countryUtil";
import { errorHandler } from "@demo/utils/errorHandler";
import { useTranslation } from "react-i18next";

const {
MAP_RESOURCES: { IMPERIAL_COUNTRIES },
Expand All @@ -32,8 +29,6 @@ const useAmplifyMap = () => {
const store = useAmplifyMapStore();
const { setInitial } = store;
const { setState } = useAmplifyMapStore;
const mapsService = useAmplifyMapService();
const { t } = useTranslation();

useEffect(() => {
if (store.autoMapUnit.selected) {
Expand All @@ -48,20 +43,6 @@ const useAmplifyMap = () => {

const methods = useMemo(
() => ({
getDefaultMap: () => {
try {
return mapsService.getDefaultMap();
} catch (error) {
errorHandler(error, t("error_handler__failed_fetch_default_map.text") as string);
}
},
getAvailableMaps: () => {
try {
return mapsService.getAvailableMaps();
} catch (error) {
errorHandler(error, t("error_handler__failed_fetch_available_map.text") as string);
}
},
setCurrentLocation: (currentLocationData: CurrentLocationDataType) => {
setState({ currentLocationData });
},
Expand Down Expand Up @@ -95,7 +76,7 @@ const useAmplifyMap = () => {
setInitial();
}
}),
[mapsService, setState, setInitial, t]
[setState, setInitial]
);

return useMemo(() => ({ ...methods, ...store }), [methods, store]);
Expand Down
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import appConfig from "./core/constants/appConfig";
import useAmplifyAuth from "./hooks/useAmplifyAuth";
import useAmplifyMap from "./hooks/useAmplifyMap";
import useAws from "./hooks/useAws";
Expand All @@ -8,15 +7,14 @@ import useAwsRoute from "./hooks/useAwsRoute";
import useAwsTracker from "./hooks/useAwsTracker";
import usePersistedData from "./hooks/usePersistedData";
import useRecordViewPage from "./hooks/useRecordViewPage";
import { EsriMapEnum, EventTypeEnum, TriggeredByEnum } from "./types/Enums";
import { EventTypeEnum, TriggeredByEnum } from "./types/Enums";
import { record } from "./utils/analyticsUtils";
import { debounce } from "./utils/debounce";
import { clearStorage } from "./utils/localstorageUtils";

export * as theme from "./theme";
export { default as DemoPage } from "./atomicui/pages/DemoPage/DemoPage";
export {
appConfig as demoAppConfig,
useAmplifyAuth,
useAmplifyMap,
useAws,
Expand All @@ -26,7 +24,6 @@ export {
useAwsTracker,
usePersistedData,
useRecordViewPage,
EsriMapEnum,
EventTypeEnum,
TriggeredByEnum,
record,
Expand Down
1 change: 0 additions & 1 deletion src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

export { default as useAmplifyAuthService } from "./useAmplifyAuthService";
export { default as useAwsService } from "./useAwsService";
export { default as useAmplifyMapService } from "./useAmplifyMapService";
export { default as useAwsPlaceService } from "./useAwsPlaceService";
export { default as useAwsRouteService } from "./useAwsRouteService";
export { default as useAwsGeofenceService } from "./useAwsGeofenceService";
Expand Down
18 changes: 0 additions & 18 deletions src/services/useAmplifyMapService.ts

This file was deleted.

10 changes: 5 additions & 5 deletions src/services/useWebSocketService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ const useWebSocketService = (
stopName = "",
coordinates = []
}
} = data;
} = data as any;

if (source === "aws.geo") {
if (stopName) {
/* Unauth simulation events */
const unauthEvent = { ...data.value };
const unauthEvent = { ...(data.value as Record<string, unknown>) };
const busRouteId = geofenceId.split("-")[0];

if (trackerEventType === "ENTER") {
Expand All @@ -102,7 +102,7 @@ const useWebSocketService = (
});
}

if (unauthEvents.length === 0 || !unauthEvents.some(equals(unauthEvent))) {
if (unauthEvents.length === 0 || !unauthEvents.some(equals(unauthEvent as unknown))) {
setUnauthNotifications({
busRouteId,
geofenceCollection,
Expand Down Expand Up @@ -132,9 +132,9 @@ const useWebSocketService = (
});
} else {
/* Auth simulation events */
const authEvent = { ...data.value };
const authEvent = { ...(data.value as Record<string, unknown>) };

if (authEvents.length === 0 || !authEvents.some(equals(authEvent))) {
if (authEvents.length === 0 || !authEvents.some(equals(authEvent as unknown))) {
showToast({
content:
i18n.dir() === "ltr"
Expand Down

0 comments on commit c7f3285

Please sign in to comment.