Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | 12x 255x 3026x 12x 137x 84x 252x 252x 3018x 3018x 252x 12x 1135x 1135x 84x 84x 87x 87x 87x 87x 87x 87x 29x 58x 58x 29x 58x 29x 29x 58x 58x 29x 2x 8x | import { CHARGEBACK_TEXT } from "@constants/stringConstants";
import { ALERT_NAMES_ENUM } from "@features/Notifications/NotificationsCenter/types";
import {
APIResponseAlert,
TGroupedAlerts,
TParsedAlert,
TReceiver,
} from "../types";
type TAlertPermissions = {
isTransferFundsAllowed: boolean;
};
/**
* Hides permission-gated alerts (GB-21568): the "Transfer Funds Completed"
* alert must not be selectable by acquirer users who lack the Transfer Funds
* permission (explicit or implicit deny). All other alerts pass through.
*/
export const filterAlertsByPermissions = (
alerts: TParsedAlert[],
{ isTransferFundsAllowed }: TAlertPermissions,
) =>
alerts.filter((alert) =>
alert.name === ALERT_NAMES_ENUM.MOVE_FUNDS_COMPLETED
? isTransferFundsAllowed
: true,
);
/**
* Applies {@link filterAlertsByPermissions} to every receiver group so the
* gated alert is removed from the underlying data - not just the rendered
* list - keeping display, "select all", and the submitted payload consistent.
*/
export const filterGroupedAlertsByPermissions = (
grouped: TGroupedAlerts | undefined,
permissions: TAlertPermissions,
): TGroupedAlerts | undefined => {
if (!grouped) return grouped;
return Object.entries(grouped).reduce((acc, [receiver, hashedData]) => {
const kept = filterAlertsByPermissions(
Object.values(hashedData),
permissions,
);
acc[receiver as TReceiver] = kept.reduce((hashed, alert) => {
hashed[alert.id] = alert;
return hashed;
}, {} as Record<string, TParsedAlert>);
return acc;
}, {} as TGroupedAlerts);
};
export const getTitleAndSubTitle = (
obj: APIResponseAlert,
receiver: string,
) => {
const isEnterprise = receiver === "enterprise";
switch (obj.name) {
case "chargeback":
return {
title: "Chargeback alert",
subTitle: CHARGEBACK_TEXT,
};
case "chargeback_reversed":
return {
title: obj.displayName,
subTitle:
"You will be notified when a chargeback has been reversed during money transfers from bank accounts.",
};
case "new_member":
return {
title: obj.displayName,
subTitle: "Receive notifications when a new member joins.",
};
case "transfer":
return {
title: "Money transfers",
subTitle: "Receive notifications for all money transfer activities.",
};
case "daily_transaction_summary":
return {
title: "Daily report",
subTitle:
"Receive detailed daily reports on the performance of your payment forms.",
};
case "monthly_transaction_summary":
return {
title: "Monthly report",
subTitle:
"Receive detailed monthly reports on the performance of your payment forms.",
};
case "transaction":
return {
title: "Transactions",
subTitle: "You'll be notified on new transactions",
};
case "high_transaction":
return {
title: obj.displayName,
subTitle: "You'll be notified on high transactions",
};
case "refund":
return {
title: obj.displayName,
subTitle: "Get notified when a refund is processed.",
};
case "new_bank_account":
return {
title: obj.displayName,
subTitle: "Get notified when a new bank account is added.",
};
case "new_sweepstakes_winner":
return {
title: "New sweepstake",
subTitle:
"You will receive an notification for each new sweepstakes winner",
};
case "first_transaction_alert":
return {
title: obj.displayName,
subTitle:
"You will receive an notification when you get your first transaction",
};
case "new_enterprise":
return {
title: "Create Provider",
subTitle: "Get notified upon the creation of a new provider.",
};
case "new_merchant":
return {
title: "Create Merchant",
subTitle: "Get notified upon the creation of a new merchant.",
};
case "merchant_mid_issue":
return {
title: "MID issue",
subTitle: isEnterprise
? "Receive notifications for every new MID issue."
: "Receive notifications for every new MID (Merchant Identification Number) issue.",
};
case "merchant_levels":
return {
title: "Merchant level 2-4",
subTitle:
"You will receive notifications for every for any new issues related to Merchant Level 2-4",
};
case "merchant_declined":
return {
title: "Merchant declined",
subTitle: "You will receive notifications for every merchant declined",
};
case "merchant_suspended":
return {
title: "Merchant suspended",
subTitle: "You will receive notifications when merchant is suspended",
};
case "ofac_match":
return {
title: "OFAC Match",
subTitle:
"Receive immediate notifications for any matches found with the OFAC sanctions list.",
};
case "negative_balance":
return {
title: "Negative balance",
subTitle:
"Receive immediate notifications for any negative balance occurrences in your account.",
};
case "mrp_level_eq_1":
return {
title: "Merchant Risk Profile Medium Level",
subTitle:
"Receive notifications when any merchant reaches a Medium Risk Level.",
highlight: "Medium Level",
};
case "mrp_level_gt_1":
return {
title: "Merchant Risk Profile High Level and above ",
subTitle:
"Receive daily notifications for each merchant with a Risk Level of High or above.",
highlight: "High or above.",
};
case "merchant_owner_underwriting_approval":
return {
title: "Merchant Owner Underwriting Approval",
subTitle:
"Get notified when a merchant owner's underwriting is approved.",
};
case "merchant_underwriting_approval":
return {
title: "Merchant Underwriting Approval",
subTitle: "Get notified when a merchant's underwriting is approved.",
};
case "convo_mention_alert":
return {
title: "Conversations Mention Alert",
subTitle: "Receive alerts when you are mentioned in conversations.",
};
// PAH006 SS-5 (AC009). TODO(PAH006): confirm verbatim copy with PO.
case "pah_ready_for_approval":
return {
title: "New Primary Account Holder Ready for Approval",
subTitle:
"Get notified when a new primary account holder has completed identity verification and is ready for approval.",
};
default:
return {
title: obj.displayName,
subTitle: obj.displayName,
};
}
};
|