From f4be3e966879fc037d251e4f89e9ac03c3dc2b6c Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Tue, 14 May 2024 12:20:49 -0400 Subject: [PATCH 1/3] Fix issue with global search --- .../global-search/global-search-os.component.jsx | 10 +--------- .../global-search/global-search.component.jsx | 9 +-------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/client/src/components/global-search/global-search-os.component.jsx b/client/src/components/global-search/global-search-os.component.jsx index 62e44da5f..fbe2efad1 100644 --- a/client/src/components/global-search/global-search-os.component.jsx +++ b/client/src/components/global-search/global-search-os.component.jsx @@ -178,15 +178,7 @@ export default function GlobalSearchOs() { }; return ( - { - history(opt.label.props.to); - }} - onClear={() => setData([])} - > + setData([])}> ; return ( - { - history(opt.label.props.to); - }} - > + Date: Tue, 14 May 2024 12:38:56 -0400 Subject: [PATCH 2/3] Fix eslint regression Signed-off-by: Dave Richer --- .../components/global-search/global-search-os.component.jsx | 3 +-- .../src/components/global-search/global-search.component.jsx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/client/src/components/global-search/global-search-os.component.jsx b/client/src/components/global-search/global-search-os.component.jsx index fbe2efad1..f46a4c811 100644 --- a/client/src/components/global-search/global-search-os.component.jsx +++ b/client/src/components/global-search/global-search-os.component.jsx @@ -3,14 +3,13 @@ import axios from "axios"; import _ from "lodash"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link, useNavigate } from "react-router-dom"; +import { Link } from "react-router-dom"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import OwnerNameDisplay, { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component"; export default function GlobalSearchOs() { const { t } = useTranslation(); - const history = useNavigate(); const [loading, setLoading] = useState(false); const [data, setData] = useState(false); diff --git a/client/src/components/global-search/global-search.component.jsx b/client/src/components/global-search/global-search.component.jsx index e16e663c7..37b94f46c 100644 --- a/client/src/components/global-search/global-search.component.jsx +++ b/client/src/components/global-search/global-search.component.jsx @@ -3,7 +3,7 @@ import { AutoComplete, Divider, Input, Space } from "antd"; import _ from "lodash"; import React from "react"; import { useTranslation } from "react-i18next"; -import { Link, useNavigate } from "react-router-dom"; +import { Link } from "react-router-dom"; import { GLOBAL_SEARCH_QUERY } from "../../graphql/search.queries"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import AlertComponent from "../alert/alert.component"; @@ -12,7 +12,6 @@ import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.compon export default function GlobalSearch() { const { t } = useTranslation(); - const history = useNavigate(); const [callSearch, { loading, error, data }] = useLazyQuery(GLOBAL_SEARCH_QUERY); const executeSearch = (v) => { From f4511556890513f250720c2b938679a26861254d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 15 May 2024 10:27:42 -0700 Subject: [PATCH 3/3] Add Firebase Service Worker to public. --- client/public/firebase-messaging-sw.js | 56 ++++++++++++++++++++++++++ client/src/utils/fcm-handler.js | 1 + 2 files changed, 57 insertions(+) create mode 100644 client/public/firebase-messaging-sw.js diff --git a/client/public/firebase-messaging-sw.js b/client/public/firebase-messaging-sw.js new file mode 100644 index 000000000..7ee3f3d98 --- /dev/null +++ b/client/public/firebase-messaging-sw.js @@ -0,0 +1,56 @@ +// Scripts for firebase and firebase messaging +importScripts("https://www.gstatic.com/firebasejs/8.2.0/firebase-app.js"); +importScripts("https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js"); + +// Initialize the Firebase app in the service worker by passing the generated config +let firebaseConfig; +switch (this.location.hostname) { + case "localhost": + firebaseConfig = { + apiKey: "AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc", + authDomain: "imex-dev.firebaseapp.com", + databaseURL: "https://imex-dev.firebaseio.com", + projectId: "imex-dev", + storageBucket: "imex-dev.appspot.com", + messagingSenderId: "759548147434", + appId: "1:759548147434:web:e8239868a48ceb36700993", + measurementId: "G-K5XRBVVB4S", + }; + break; + case "test.imex.online": + firebaseConfig = { + apiKey: "AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c", + authDomain: "imex-test.firebaseapp.com", + projectId: "imex-test", + storageBucket: "imex-test.appspot.com", + messagingSenderId: "991923618608", + appId: "1:991923618608:web:633437569cdad78299bef5", + // measurementId: "${config.measurementId}", + }; + break; + case "imex.online": + default: + firebaseConfig = { + apiKey: "AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU", + authDomain: "imex-prod.firebaseapp.com", + databaseURL: "https://imex-prod.firebaseio.com", + projectId: "imex-prod", + storageBucket: "imex-prod.appspot.com", + messagingSenderId: "253497221485", + appId: "1:253497221485:web:3c81c483b94db84b227a64", + measurementId: "G-NTWBKG2L0M", + }; +} + +firebase.initializeApp(firebaseConfig); + +// Retrieve firebase messaging +const messaging = firebase.messaging(); + +messaging.onBackgroundMessage(function (payload) { + // Customize notification here + const channel = new BroadcastChannel("imex-sw-messages"); + channel.postMessage(payload); + + //self.registration.showNotification(notificationTitle, notificationOptions); +}); diff --git a/client/src/utils/fcm-handler.js b/client/src/utils/fcm-handler.js index 0b44abb49..c6284c764 100644 --- a/client/src/utils/fcm-handler.js +++ b/client/src/utils/fcm-handler.js @@ -1,4 +1,5 @@ export default async function FcmHandler({ client, payload }) { + console.log("FCM", payload); switch (payload.type) { case "messaging-inbound": client.cache.modify({