TP-79757 | ScreenName in RN error events (#12314)
This commit is contained in:
@@ -19,7 +19,7 @@ import {
|
||||
extractCtaParameters,
|
||||
} from "../../../../common/navigator/NavigationRouter";
|
||||
import QuoteOfferErrorScreen from "../quote-offer-screen/error-screen/QuoteOfferErrorScreen";
|
||||
import { ConstantCta } from "../../../../common/constants";
|
||||
import { COMPARE_PLAN_SCREEN, ConstantCta } from "../../../../common/constants";
|
||||
|
||||
const ComparePlanScreen = ({
|
||||
ctaData,
|
||||
@@ -71,6 +71,7 @@ const ComparePlanScreen = ({
|
||||
{
|
||||
actionType: ScreenActionTypes.FETCH_COMPARE_PLAN_LIST,
|
||||
data: ctaData?.data,
|
||||
screenName: COMPARE_PLAN_SCREEN
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import {
|
||||
AnalyticsEventNameConstants,
|
||||
ConstantCta,
|
||||
MARKET_BENEFITS_COMPARE_SCREEN,
|
||||
} from "../../../../common/constants";
|
||||
import { sendAsAnalyticsEvent } from "../../../../common/hooks/useAnalyticsEvent";
|
||||
import { logToSentry } from "../../../../common/hooks/useSentryLogging";
|
||||
@@ -96,6 +97,7 @@ const MarketBenefitCompareScreen = ({
|
||||
{
|
||||
actionType: ScreenActionTypes.FETCH_BENEFIT_COMPARE_LIST,
|
||||
data: ctaData?.data,
|
||||
screenName: MARKET_BENEFITS_COMPARE_SCREEN
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
BaseActionTypes,
|
||||
GenericActionPayload,
|
||||
} from "../../../../common/actions/GenericAction";
|
||||
import { ConstantCta, ScreenProperties } from "../../../../common/constants";
|
||||
import { ConstantCta, QUOTE_OFFER_SCREEN, ScreenProperties } from "../../../../common/constants";
|
||||
import { AnalyticsEventNameConstants } from "../../../../common/constants/AnalyticsEventsConstant";
|
||||
import { NativeEventNameConstants } from "../../../../common/constants/EventNameConstants";
|
||||
import {
|
||||
@@ -179,6 +179,7 @@ const QuoteOfferScreen = ({
|
||||
{
|
||||
actionType: screenActionType,
|
||||
data: data,
|
||||
screenName: QUOTE_OFFER_SCREEN
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -203,6 +204,7 @@ const QuoteOfferScreen = ({
|
||||
{
|
||||
actionType: screenActionType,
|
||||
data: data,
|
||||
screenName: QUOTE_OFFER_SCREEN
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface ActionMetaData {
|
||||
// ActionMetaData has some key attributes required to perform any action e.g. critical widget communications i.e. inter/intra widget, screen level API calls, bottom sheet, modal, etc.
|
||||
data?: any;
|
||||
analyticsEventProperties?: AnalyticsEvent;
|
||||
screenName?: string;
|
||||
}
|
||||
|
||||
export interface TargetWidgetPayload {
|
||||
|
||||
@@ -44,3 +44,4 @@ export const QUOTE_PATCH_FAIL_TOAST = "Failed. Try again";
|
||||
export const QUOTE_ID = "quoteId";
|
||||
export const BUILD_CONFIG_DETAILS = "BUILD_CONFIG_DETAILS";
|
||||
export const SPACE_UNICODE = "\u00A0";
|
||||
export const REACT_NATIVE = 'rn'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getBundleVersion } from "../../../network/NetworkUtils";
|
||||
import { EVENT_PROPERTY_KEYS } from "../constants";
|
||||
import { EVENT_PROPERTY_KEYS, REACT_NATIVE } from "../constants";
|
||||
import { AnalyticsEvent } from "../interface";
|
||||
import { NativeAnalyticsModule } from "../native-module/NativeModules";
|
||||
|
||||
@@ -37,9 +37,11 @@ export const sendAsAppDowntimeEvent = (event: AppDowntimeData) => {
|
||||
eventName = "global_app_downtime",
|
||||
} = event;
|
||||
|
||||
const updatedScreenName = moduleName + "_" + REACT_NATIVE + "_" + screenName;
|
||||
|
||||
NativeAnalyticsModule.sendAsAppDowntimeEvent({
|
||||
reason,
|
||||
screenName,
|
||||
screenName: updatedScreenName,
|
||||
moduleName,
|
||||
statusCode,
|
||||
networkType,
|
||||
@@ -67,9 +69,11 @@ export const sendAsGlobalErrorEvent = (event: GlobalErrorData) => {
|
||||
isAppDowntimeEvent = null,
|
||||
} = event;
|
||||
|
||||
const updatedSource = moduleName + "_" + REACT_NATIVE + "_" + source;
|
||||
|
||||
NativeAnalyticsModule.sendAsGlobalErrorEvent({
|
||||
reason,
|
||||
source,
|
||||
source: updatedSource,
|
||||
moduleName,
|
||||
globalErrorType,
|
||||
statusCode,
|
||||
|
||||
@@ -23,6 +23,7 @@ import { CtaData } from "../interface";
|
||||
import { ScreenData } from "../interface/widgets/screenData/ScreenData";
|
||||
import { ScreenState } from "./BaseScreen";
|
||||
import { ScreenActionTypes } from "./ScreenActionTypes";
|
||||
import { getErrorTypeFromStatusCode } from "../utilities/ErrorUtils";
|
||||
|
||||
export const ScreenActionHandler = {
|
||||
handleScreenAction: (
|
||||
@@ -212,12 +213,13 @@ const handleErrorData = (
|
||||
);
|
||||
const errorEvent: GlobalErrorData = {
|
||||
reason: `${error.message}, axiosError: ${error.axiosCode}`,
|
||||
source: screenMetaData.screenName || "",
|
||||
statusCode: error.statusCode,
|
||||
moduleName: AnalyticsModuleNameConstant.GI,
|
||||
flowName: AnalyticsFlowNameConstant.GI_RN_QUOTE,
|
||||
methodName: methodName,
|
||||
globalErrorType: AnalyticsGlobalErrorTypeConstant.GLOBAL_INTERNAL_ERRORS,
|
||||
isAppDowntimeEvent: true,
|
||||
globalErrorType: getErrorTypeFromStatusCode(error.statusCode || -1),
|
||||
isAppDowntimeEvent: false,
|
||||
};
|
||||
sendAsGlobalErrorEvent(errorEvent);
|
||||
const updatedScreenData: ScreenData = {
|
||||
|
||||
12
App/common/utilities/ErrorUtils.ts
Normal file
12
App/common/utilities/ErrorUtils.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { AnalyticsGlobalErrorTypeConstant } from "../constants";
|
||||
|
||||
export const getErrorTypeFromStatusCode = (statusCode: number) => {
|
||||
const statusCodeforGenericError = [20, 23, 24, 401, 404];
|
||||
|
||||
if (statusCodeforGenericError.includes(statusCode) || statusCode >= 500) {
|
||||
return AnalyticsGlobalErrorTypeConstant.GLOBAL_GENERIC_ERRORS;
|
||||
}
|
||||
|
||||
return AnalyticsGlobalErrorTypeConstant.GLOBAL_INTERNAL_ERRORS;
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
import { updateValueByKeyPath } from "../../utilities/MiscUtils";
|
||||
import { parseValue } from "../../utilities/SerializerUtil";
|
||||
import { WidgetActionTypes } from "./WidgetActionTypes";
|
||||
import { getErrorTypeFromStatusCode } from "../../utilities/ErrorUtils";
|
||||
|
||||
const WidgetActionHandler = {
|
||||
handleWidgetAction: (
|
||||
@@ -273,12 +274,13 @@ const handleErrorData = (
|
||||
);
|
||||
const errorEvent: GlobalErrorData = {
|
||||
reason: `${error.message}, axiosError: ${error.axiosCode}`,
|
||||
source: widgetMetaData.screenName || "",
|
||||
statusCode: error.statusCode,
|
||||
moduleName: AnalyticsModuleNameConstant.GI,
|
||||
flowName: AnalyticsFlowNameConstant.GI_RN_QUOTE,
|
||||
methodName: methodName,
|
||||
globalErrorType: AnalyticsGlobalErrorTypeConstant.GLOBAL_INTERNAL_ERRORS,
|
||||
isAppDowntimeEvent: true,
|
||||
globalErrorType: getErrorTypeFromStatusCode(error.statusCode || -1),
|
||||
isAppDowntimeEvent: false,
|
||||
};
|
||||
sendAsGlobalErrorEvent(errorEvent);
|
||||
setScreenData({
|
||||
|
||||
Reference in New Issue
Block a user