feature/IO-3182-Phone-Number-Consent - Checkpoint
This commit is contained in:
@@ -62,10 +62,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
|
|||||||
const renderConversation = (index, t) => {
|
const renderConversation = (index, t) => {
|
||||||
const item = sortedConversationList[index];
|
const item = sortedConversationList[index];
|
||||||
const normalizedPhone = phone(item.phone_num, "CA").phoneNumber.replace(/^\+1/, "");
|
const normalizedPhone = phone(item.phone_num, "CA").phoneNumber.replace(/^\+1/, "");
|
||||||
// Check if the phone number exists in the consentMap
|
|
||||||
const hasOptOutEntry = optOutMap.has(normalizedPhone);
|
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 cardContentRight = <TimeAgoFormatter>{item.updated_at}</TimeAgoFormatter>;
|
||||||
const cardContentLeft =
|
const cardContentLeft =
|
||||||
@@ -91,7 +88,7 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
|
|||||||
const cardExtra = (
|
const cardExtra = (
|
||||||
<>
|
<>
|
||||||
<Badge count={item.messages_aggregate.aggregate.count} />
|
<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)
|
sorter: (a, b) => a.phone_number.localeCompare(b.phone_number)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("consent.updated_at"),
|
title: t("consent.created_at"),
|
||||||
dataIndex: "consent_updated_at",
|
dataIndex: "created_at",
|
||||||
render: (text) => <TimeAgoFormatter>{text}</TimeAgoFormatter>
|
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
|
<Table
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={data?.phone_number_consent}
|
dataSource={data?.phone_number_opt_out}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
style={{ marginTop: 16 }}
|
style={{ marginTop: 16 }}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { gql } from "@apollo/client";
|
|||||||
|
|
||||||
export const GET_PHONE_NUMBER_OPT_OUT = gql`
|
export const GET_PHONE_NUMBER_OPT_OUT = gql`
|
||||||
query GET_PHONE_NUMBER_OPT_OUT($bodyshopid: uuid!, $phone_number: String!) {
|
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
|
id
|
||||||
bodyshopid
|
bodyshopid
|
||||||
phone_number
|
phone_number
|
||||||
@@ -14,9 +14,9 @@ export const GET_PHONE_NUMBER_OPT_OUT = gql`
|
|||||||
|
|
||||||
export const GET_PHONE_NUMBER_OPT_OUTS = gql`
|
export const GET_PHONE_NUMBER_OPT_OUTS = gql`
|
||||||
query GET_PHONE_NUMBER_OPT_OUTS($bodyshopid: uuid!, $search: String) {
|
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 } }
|
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
|
id
|
||||||
bodyshopid
|
bodyshopid
|
||||||
|
|||||||
@@ -3869,7 +3869,7 @@
|
|||||||
"consent": {
|
"consent": {
|
||||||
"phone_number": "Phone Number",
|
"phone_number": "Phone Number",
|
||||||
"status": "Consent Status",
|
"status": "Consent Status",
|
||||||
"updated_at": "Last Updated"
|
"created_at": "Created At"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"title": "Phone Number Opt-Out List"
|
"title": "Phone Number Opt-Out List"
|
||||||
|
|||||||
@@ -5868,6 +5868,25 @@
|
|||||||
- name: bodyshop
|
- name: bodyshop
|
||||||
using:
|
using:
|
||||||
foreign_key_constraint_on: bodyshopid
|
foreign_key_constraint_on: bodyshopid
|
||||||
|
select_permissions:
|
||||||
|
- role: user
|
||||||
|
permission:
|
||||||
|
columns:
|
||||||
|
- phone_number
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- bodyshopid
|
||||||
|
- id
|
||||||
|
filter:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
comment: ""
|
||||||
- table:
|
- table:
|
||||||
name: phonebook
|
name: phonebook
|
||||||
schema: public
|
schema: public
|
||||||
|
|||||||
Reference in New Issue
Block a user