- {cardContentLeft}
- {cardContentRight}
+
+
+ {cardContentLeft}
+
+
+ {cardContentRight}
+
);
@@ -85,7 +134,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
renderConversation(index)}
+ itemContent={(index) => renderConversation(index, t)}
style={{ height: "100%", width: "100%" }}
/>
diff --git a/client/src/components/chat-send-message/chat-send-message.component.jsx b/client/src/components/chat-send-message/chat-send-message.component.jsx
index aa5b3f035..798532a3e 100644
--- a/client/src/components/chat-send-message/chat-send-message.component.jsx
+++ b/client/src/components/chat-send-message/chat-send-message.component.jsx
@@ -11,8 +11,8 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
import ChatMediaSelector from "../chat-media-selector/chat-media-selector.component";
import ChatPresetsComponent from "../chat-presets/chat-presets.component";
import { useQuery } from "@apollo/client";
-import { GET_PHONE_NUMBER_CONSENT } from "../../graphql/consent.queries";
import { phone } from "phone";
+import { GET_PHONE_NUMBER_OPT_OUT } from "../../graphql/phone-number-opt-out.queries";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -31,12 +31,12 @@ function ChatSendMessageComponent({ conversation, bodyshop, sendMessage, isSendi
const { t } = useTranslation();
const normalizedPhone = phone(conversation.phone_num, "CA").phoneNumber.replace(/^\+1/, "");
- const { data: consentData } = useQuery(GET_PHONE_NUMBER_CONSENT, {
+ const { data: optOutData } = useQuery(GET_PHONE_NUMBER_OPT_OUT, {
variables: { bodyshopid: bodyshop.id, phone_number: normalizedPhone },
fetchPolicy: "cache-and-network"
});
- const isConsented = consentData?.phone_number_consent?.[0]?.consent_status ?? false;
+ const isOptedOut = !!optOutData?.phone_number_opt_out?.[0];
useEffect(() => {
inputArea.current.focus();
@@ -45,7 +45,7 @@ function ChatSendMessageComponent({ conversation, bodyshop, sendMessage, isSendi
const handleEnter = () => {
const selectedImages = selectedMedia.filter((i) => i.isSelected);
if ((message === "" || !message) && selectedImages.length === 0) return;
- if (!isConsented) return;
+ if (isOptedOut) return; // Prevent sending if phone number is opted out
logImEXEvent("messaging_send_message");
if (selectedImages.length < 11) {
@@ -69,7 +69,7 @@ function ChatSendMessageComponent({ conversation, bodyshop, sendMessage, isSendi
return (
- {!isConsented &&
}
+ {isOptedOut &&
}
setMessage(e.target.value)}
onPressEnter={(event) => {
event.preventDefault();
- if (!event.shiftKey && isConsented) handleEnter();
+ if (!event.shiftKey && !isOptedOut) handleEnter();
}}
/>
RO",
"2tiersetup": "2 Tier Setup",
"2tiersource": "Source => RO",
@@ -3872,7 +3872,7 @@
"updated_at": "Last Updated"
},
"settings": {
- "title": "Phone Number Opt-Out list"
+ "title": "Phone Number Opt-Out List"
}
}
}
diff --git a/server/sms/send.js b/server/sms/send.js
index c5e897a98..fdd2c81ae 100644
--- a/server/sms/send.js
+++ b/server/sms/send.js
@@ -4,13 +4,18 @@ const { INSERT_MESSAGE } = require("../graphql-client/queries");
const client = twilio(process.env.TWILIO_AUTH_TOKEN, process.env.TWILIO_AUTH_KEY);
const gqlClient = require("../graphql-client/graphql-client").client;
+/**
+ * Send an outbound SMS message
+ * @param req
+ * @param res
+ * @returns {Promise}
+ */
const send = async (req, res) => {
const { to, messagingServiceSid, body, conversationid, selectedMedia, imexshopid } = req.body;
const {
ioRedis,
logger,
- ioHelpers: { getBodyshopRoom, getBodyshopConversationRoom },
- sessionUtils: { getBodyshopFromRedis }
+ ioHelpers: { getBodyshopRoom, getBodyshopConversationRoom }
} = req;
logger.log("sms-outbound", "DEBUG", req.user.email, null, {