From bbd1ca9d3b9dbe29a0e799e87ecf62c18bc78bca Mon Sep 17 00:00:00 2001 From: Prajjaval Verma Date: Mon, 20 May 2024 11:18:06 +0530 Subject: [PATCH] TP-67104 | Undefined QuoteId Fix (#10902) Co-authored-by: Raaj Gopal --- .../constants/AnalyticsEventsConstant.ts | 1 + .../widget-actions/WidgetActionHandler.ts | 28 +++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/App/common/constants/AnalyticsEventsConstant.ts b/App/common/constants/AnalyticsEventsConstant.ts index 2a3be6c6b8..d979359652 100644 --- a/App/common/constants/AnalyticsEventsConstant.ts +++ b/App/common/constants/AnalyticsEventsConstant.ts @@ -2,6 +2,7 @@ export const AnalyticsEventNameConstants = { HI_SI_PILLS_CLICK: "hi_si_pills_click", HI_RN_QUOTE_PAGE_INIT: "hi_rn_quote_page_init", HI_RN_QUOTE_PAGE_ERROR_VIEW: "hi_rn_quote_page_error_view", + PATCH_QUOTE_V2: "patch_quote_v2", }; export const AnalyticsEventPropertyConstants = { diff --git a/App/common/widgets/widget-actions/WidgetActionHandler.ts b/App/common/widgets/widget-actions/WidgetActionHandler.ts index f8666a8bbd..a3ab17577d 100644 --- a/App/common/widgets/widget-actions/WidgetActionHandler.ts +++ b/App/common/widgets/widget-actions/WidgetActionHandler.ts @@ -9,14 +9,18 @@ import { TargetWidgetPayload, } from "../../actions/GenericAction"; import { + AnalyticsEventNameConstants, AnalyticsFlowNameConstant, AnalyticsGlobalErrorTypeConstant, AnalyticsMethodNameConstant, AnalyticsModuleNameConstant, } from "../../constants/AnalyticsEventsConstant"; -import { sendAsAnalyticsEvent, sendAsGlobalErrorEvent } from "../../hooks/useAnalyticsEvent"; +import { + sendAsAnalyticsEvent, + sendAsGlobalErrorEvent, +} from "../../hooks/useAnalyticsEvent"; import { logToSentry } from "../../hooks/useSentryLogging"; -import { CtaData } from "../../interface"; +import { AnalyticsEvent, CtaData } from "../../interface"; import { ScreenData } from "../../interface/widgets/screenData/ScreenData"; import { FinalPatchCallRequestBody } from "../../interface/widgets/widgetData/FooterWithCardWidgetData"; import { NativeDeeplinkNavigatorModule } from "../../native-module/NativeModules"; @@ -132,17 +136,31 @@ const WidgetActionHandler = { case WidgetActionTypes.PATCH_QUOTE_V2: { let quoteId = getQuoteIdFromCta(ctaData); const requestData: SumInsuredRequestData = widgetMetaData.data; - if (!!quoteId) { + if (!quoteId) { getQuoteIdFromCache().then((value) => { if (!!value) { quoteId = value; - return updateSumInsuredData(requestData, quoteId!!); + return updateSumInsuredData(requestData, quoteId!!) + .then((response) => {}) + .catch((error) => { + const errorEvent: AnalyticsEvent = { + name: AnalyticsEventNameConstants.PATCH_QUOTE_V2 + }; + sendAsAnalyticsEvent(errorEvent); + }); } return; }); return; } else { - return updateSumInsuredData(requestData, quoteId!!); + return updateSumInsuredData(requestData, quoteId!!) + .then((response) => {}) + .catch((error) => { + const errorEvent: AnalyticsEvent = { + name: AnalyticsEventNameConstants.PATCH_QUOTE_V2 + }; + sendAsAnalyticsEvent(errorEvent); + }); } }