Compare commits
8 Commits
feature/IO
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01e103fd0e | ||
|
|
4b184d1d42 | ||
|
|
8c541dad05 | ||
|
|
921cca86c1 | ||
|
|
841312ebcd | ||
|
|
5ed00eaffe | ||
|
|
024b4fe21b | ||
|
|
760f2ac7f9 |
@@ -42,8 +42,7 @@ export function ChatPopupComponent({ chatVisible, selectedConversation, toggleCh
|
|||||||
const { data: unreadData } = useQuery(UNREAD_CONVERSATION_COUNT, {
|
const { data: unreadData } = useQuery(UNREAD_CONVERSATION_COUNT, {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
skip: chatVisible, // Skip when chat is visible
|
pollInterval: 60 * 1000 // TODO: This is a fix for now, should be coming from sockets
|
||||||
...(pollInterval > 0 ? { pollInterval } : {})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Socket connection status
|
// Socket connection status
|
||||||
@@ -85,29 +84,25 @@ export function ChatPopupComponent({ chatVisible, selectedConversation, toggleCh
|
|||||||
|
|
||||||
// Get unread count from the cache
|
// Get unread count from the cache
|
||||||
const unreadCount = (() => {
|
const unreadCount = (() => {
|
||||||
if (chatVisible) {
|
try {
|
||||||
try {
|
const cachedData = client.readQuery({
|
||||||
const cachedData = client.readQuery({
|
query: CONVERSATION_LIST_QUERY,
|
||||||
query: CONVERSATION_LIST_QUERY,
|
variables: { offset: 0 }
|
||||||
variables: { offset: 0 }
|
});
|
||||||
});
|
|
||||||
|
|
||||||
if (!cachedData?.conversations) return 0;
|
if (!cachedData?.conversations) {
|
||||||
|
return unreadData?.messages_aggregate?.aggregate?.count;
|
||||||
// Aggregate unread message count
|
|
||||||
return cachedData.conversations.reduce((total, conversation) => {
|
|
||||||
const unread = conversation.messages_aggregate?.aggregate?.count || 0;
|
|
||||||
return total + unread;
|
|
||||||
}, 0);
|
|
||||||
} catch (error) {
|
|
||||||
console.warn("Unread count not found in cache:", error);
|
|
||||||
return 0; // Fallback if not in cache
|
|
||||||
}
|
}
|
||||||
} else if (unreadData?.messages_aggregate?.aggregate?.count) {
|
|
||||||
// Use the unread count from the query result
|
// Aggregate unread message count
|
||||||
return unreadData.messages_aggregate.aggregate.count;
|
return cachedData.conversations.reduce((total, conversation) => {
|
||||||
|
const unread = conversation.messages_aggregate?.aggregate?.count || 0;
|
||||||
|
return total + unread;
|
||||||
|
}, 0);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Unread count not found in cache:", error);
|
||||||
|
return 0; // Fallback if not in cache
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import i18next from "i18next";
|
|
||||||
import React from "react";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { setUserLanguage } from "../../redux/user/user.actions";
|
|
||||||
import HeaderComponent from "./header.component";
|
import HeaderComponent from "./header.component";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
// const mapDispatchToProps = (dispatch) => ({
|
||||||
setUserLanguage: (language) => dispatch(setUserLanguage(language))
|
// setUserLanguage: (language) => dispatch(setUserLanguage(language))
|
||||||
});
|
// });
|
||||||
|
|
||||||
export function HeaderContainer({ setUserLanguage }) {
|
// setUserLanguage was removed from signature because it is not used in the component, and it is throwing a deprecation warning
|
||||||
const handleMenuClick = (e) => {
|
export function HeaderContainer() {
|
||||||
|
// Commented out the handleMenuClick function because it is not used in the component, and it is throwing a deprecation warning
|
||||||
|
|
||||||
|
/* const handleMenuClick = (e) => {
|
||||||
if (e.item.props.actiontype === "lang-select") {
|
if (e.item.props.actiontype === "lang-select") {
|
||||||
i18next.changeLanguage(e.key, (err, t) => {
|
i18next.changeLanguage(e.key, (err, t) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -23,9 +22,10 @@ export function HeaderContainer({ setUserLanguage }) {
|
|||||||
setUserLanguage(e.key);
|
setUserLanguage(e.key);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};*/
|
||||||
|
// return <HeaderComponent handleMenuClick={handleMenuClick} />;
|
||||||
|
|
||||||
return <HeaderComponent handleMenuClick={handleMenuClick} />;
|
return <HeaderComponent />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps)(HeaderContainer);
|
export default connect(null, null)(HeaderContainer);
|
||||||
|
|||||||
@@ -347,6 +347,9 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
|||||||
window.$zoho.salesiq.visitor.info({ "Shop Name": payload.shopname });
|
window.$zoho.salesiq.visitor.info({ "Shop Name": payload.shopname });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
payload.features?.allAccess === true
|
||||||
|
? window.$crisp.push(["set", "session:segments", [["allAccess"]]])
|
||||||
|
: window.$crisp.push(["set", "session:segments", [["basic"]]]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Couldnt find $crisp.");
|
console.error("Couldnt find $crisp.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const sendServerEmail = async ({ subject, text }) => {
|
|||||||
imex: `ImEX Online API - ${process.env.NODE_ENV} <noreply@imex.online>`,
|
imex: `ImEX Online API - ${process.env.NODE_ENV} <noreply@imex.online>`,
|
||||||
rome: `Rome Online API - ${process.env.NODE_ENV} <noreply@romeonline.io>`
|
rome: `Rome Online API - ${process.env.NODE_ENV} <noreply@romeonline.io>`
|
||||||
}),
|
}),
|
||||||
to: ["patrick@imexsystems.ca", "support@thinkimex.com"],
|
to: ["support@thinkimex.com"],
|
||||||
subject: subject,
|
subject: subject,
|
||||||
text: text,
|
text: text,
|
||||||
ses: {
|
ses: {
|
||||||
|
|||||||
Reference in New Issue
Block a user