From 7028142b161cbafe15444327f5511ce180e3a416 Mon Sep 17 00:00:00 2001 From: Alejandro Loaiza Date: Mon, 1 Jul 2024 14:55:16 +1000 Subject: [PATCH] feat: [CM-728] Tracks popup blocked event (#1952) --- packages/passport/sdk/src/confirmation/confirmation.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/passport/sdk/src/confirmation/confirmation.ts b/packages/passport/sdk/src/confirmation/confirmation.ts index 4711a24083..1023d16d3b 100644 --- a/packages/passport/sdk/src/confirmation/confirmation.ts +++ b/packages/passport/sdk/src/confirmation/confirmation.ts @@ -1,4 +1,6 @@ import { TransactionApprovalRequestChainTypeEnum } from '@imtbl/guardian'; +import { trackError } from '@imtbl/metrics'; + import { ConfirmationResult, PASSPORT_EVENT_TYPE, @@ -180,8 +182,10 @@ export default class ConfirmationScreen { height: popupOptions?.height || CONFIRMATION_WINDOW_HEIGHT, }); this.overlay = new Overlay(this.config.popupOverlayOptions); - } catch (e) { + } catch (error) { // If an error is thrown here then the popup is blocked + const errorMessage = error instanceof Error ? error.message : String(error); + trackError('passport', 'confirmationPopupDenied', new Error(errorMessage)); this.overlay = new Overlay(this.config.popupOverlayOptions, true); }