Merged in feature/IO-3182-Phone-Number-Consent (pull request #2325)
Feature/IO-3182 Phone Number Consent
This commit is contained in:
@@ -62,10 +62,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
|
||||
const renderConversation = (index, t) => {
|
||||
const item = sortedConversationList[index];
|
||||
const normalizedPhone = phone(item.phone_num, "CA").phoneNumber.replace(/^\+1/, "");
|
||||
// Check if the phone number exists in the consentMap
|
||||
const hasOptOutEntry = optOutMap.has(normalizedPhone);
|
||||
// Only consider it non-consented if it exists and consent_status is false
|
||||
const isOptedOut = hasOptOutEntry ? optOutMap.get(normalizedPhone) : true;
|
||||
|
||||
const cardContentRight = <TimeAgoFormatter>{item.updated_at}</TimeAgoFormatter>;
|
||||
const cardContentLeft =
|
||||
@@ -91,7 +88,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
|
||||
const cardExtra = (
|
||||
<>
|
||||
<Badge count={item.messages_aggregate.aggregate.count} />
|
||||
{hasOptOutEntry && !isOptedOut && <Tag color="red">{t("messaging.labels.no_consent")}</Tag>}
|
||||
{hasOptOutEntry && <Tag color="red">{t("messaging.labels.no_consent")}</Tag>}
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
@@ -39,9 +39,10 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {
|
||||
sorter: (a, b) => a.phone_number.localeCompare(b.phone_number)
|
||||
},
|
||||
{
|
||||
title: t("consent.updated_at"),
|
||||
dataIndex: "consent_updated_at",
|
||||
render: (text) => <TimeAgoFormatter>{text}</TimeAgoFormatter>
|
||||
title: t("consent.created_at"),
|
||||
dataIndex: "created_at",
|
||||
render: (text) => <TimeAgoFormatter>{text}</TimeAgoFormatter>,
|
||||
sorter: (a, b) => new Date(a.created_at) - new Date(b.created_at)
|
||||
}
|
||||
];
|
||||
|
||||
@@ -55,7 +56,7 @@ function PhoneNumberConsentList({ bodyshop, currentUser }) {
|
||||
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={data?.phone_number_consent}
|
||||
dataSource={data?.phone_number_opt_out}
|
||||
loading={loading}
|
||||
rowKey="id"
|
||||
style={{ marginTop: 16 }}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { gql } from "@apollo/client";
|
||||
|
||||
export const GET_PHONE_NUMBER_OPT_OUT = gql`
|
||||
query GET_PHONE_NUMBER_OPT_OUT($bodyshopid: uuid!, $phone_number: String!) {
|
||||
phone_number_consent(where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _eq: $phone_number } }) {
|
||||
phone_number_opt_out(where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _eq: $phone_number } }) {
|
||||
id
|
||||
bodyshopid
|
||||
phone_number
|
||||
@@ -14,9 +14,9 @@ export const GET_PHONE_NUMBER_OPT_OUT = gql`
|
||||
|
||||
export const GET_PHONE_NUMBER_OPT_OUTS = gql`
|
||||
query GET_PHONE_NUMBER_OPT_OUTS($bodyshopid: uuid!, $search: String) {
|
||||
phone_number_consent(
|
||||
phone_number_opt_out(
|
||||
where: { bodyshopid: { _eq: $bodyshopid }, phone_number: { _ilike: $search } }
|
||||
order_by: [{ phone_number: asc }, { consent_updated_at: desc }]
|
||||
order_by: [{ phone_number: asc }, { updated_at: desc }]
|
||||
) {
|
||||
id
|
||||
bodyshopid
|
||||
|
||||
@@ -3869,7 +3869,7 @@
|
||||
"consent": {
|
||||
"phone_number": "Phone Number",
|
||||
"status": "Consent Status",
|
||||
"updated_at": "Last Updated"
|
||||
"created_at": "Created At"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Phone Number Opt-Out List"
|
||||
|
||||
Reference in New Issue
Block a user