Merge branch 'master' into feature/america

This commit is contained in:
Patrick Fic
2023-11-06 14:48:49 -08:00
38 changed files with 379 additions and 293 deletions

View File

@@ -6,6 +6,7 @@ const INITIAL_STATE = {
isSending: false,
error: null,
message: null,
searchingForConversation: false,
};
const messagingReducer = (state = INITIAL_STATE, action) => {
@@ -17,10 +18,16 @@ const messagingReducer = (state = INITIAL_STATE, action) => {
...state,
visible: !state.visible,
};
case MessagingActionTypes.OPEN_CHAT_BY_PHONE:
return {
...state,
searchingForConversation: true,
};
case MessagingActionTypes.SET_SELECTED_CONVERSATION:
return {
...state,
visible: true,
searchingForConversation: false,
selectedConversationId: action.payload,
};
case MessagingActionTypes.SEND_MESSAGE:

View File

@@ -4,7 +4,7 @@ import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { logImEXEvent } from "../../firebase/firebase.utils";
import {
CONVERSATION_ID_BY_PHONE,
CREATE_CONVERSATION
CREATE_CONVERSATION,
} from "../../graphql/conversations.queries";
import { INSERT_CONVERSATION_TAG } from "../../graphql/job-conversations.queries";
import client from "../../utils/GraphQLClient";
@@ -12,7 +12,7 @@ import { selectBodyshop } from "../user/user.selectors";
import {
sendMessageFailure,
sendMessageSuccess,
setSelectedConversation
setSelectedConversation,
} from "./messaging.actions";
import MessagingActionTypes from "./messaging.types";
@@ -79,6 +79,7 @@ export function* openChatByPhone({ payload }) {
});
} else {
console.log("ERROR: Multiple conversations found. ");
yield put(setSelectedConversation(null));
}
} catch (error) {
console.log("Error in sendMessage saga.", error);

View File

@@ -26,3 +26,8 @@ export const selectMessage = createSelector(
[selectMessaging],
(messaging) => messaging.message
);
export const searchingForConversation = createSelector(
[selectMessaging],
(messaging) => messaging.searchingForConversation
);