From 9e4888dc46a9e632fb4671887fdbc178b9c9c89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Fri, 29 Oct 2021 11:06:35 +0200 Subject: [PATCH] Add tracking unauthorized emails in modal [MAILPOET-3881] --- assets/js/src/common/set_from_address_modal.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/js/src/common/set_from_address_modal.tsx b/assets/js/src/common/set_from_address_modal.tsx index 2b1ce3750c..d242aa9835 100644 --- a/assets/js/src/common/set_from_address_modal.tsx +++ b/assets/js/src/common/set_from_address_modal.tsx @@ -144,6 +144,9 @@ const SetFromAddressModal = ({ onRequestClose, setAuthorizedAddress }: Props) => notices.success(getSuccessMessage(), { timeout: false }); } catch (e) { const error = e.errors && e.errors[0] ? e.errors[0] : null; + if (error.error === 'unauthorized') { + MailPoet.trackEvent('Unauthorized email used', { 'Unauthorized email source': 'modal' }); + } const message = getErrorMessage(error, address); addressValidator.addError('saveError', { message }); }