TP-60261 | API ErrorTag | SI Event | Status Bar | Unnecessary Log (#10265)

This commit is contained in:
Prajjaval Verma
2024-04-01 18:40:47 +05:30
committed by GitHub
parent 680e32f9ca
commit 36c65dd1d2
17 changed files with 145 additions and 52 deletions

View File

@@ -7,7 +7,6 @@ const IntroScreen: React.FC<{ ctaData: CtaData }> = ({ ctaData }) => {
useEffect(() => { useEffect(() => {
getApplicationId().then( getApplicationId().then(
(result) => (result) =>
// console.log("klogs",result.data)
result.data result.data
); );
}, []); }, []);

View File

@@ -2,9 +2,7 @@ import React, { useEffect } from "react";
import { import {
NativeEventEmitter, NativeEventEmitter,
NativeScrollEvent, NativeScrollEvent,
NativeSyntheticEvent, NativeSyntheticEvent, View
StatusBar,
View,
} from "react-native"; } from "react-native";
import Animated, { import Animated, {
useAnimatedStyle, useAnimatedStyle,
@@ -17,8 +15,7 @@ import {
GenericActionPayload, GenericActionPayload,
} from "../../../../common/actions/GenericAction"; } from "../../../../common/actions/GenericAction";
import { import {
HI_RN_QUOTE_PAGE_ERROR_VIEW, AnalyticsEventNameConstants
HI_RN_QUOTE_PAGE_INIT,
} from "../../../../common/constants/AnalyticsEventsConstant"; } from "../../../../common/constants/AnalyticsEventsConstant";
import { NativeEventNameConstants } from "../../../../common/constants/EventNameConstants"; import { NativeEventNameConstants } from "../../../../common/constants/EventNameConstants";
import { import {
@@ -154,13 +151,13 @@ const QuoteOfferScreen = ({
switch (screenData?.screenState) { switch (screenData?.screenState) {
case ScreenState.LOADED: case ScreenState.LOADED:
const initEvent: AnalyticsEvent = { const initEvent: AnalyticsEvent = {
name: HI_RN_QUOTE_PAGE_INIT, name: AnalyticsEventNameConstants.HI_RN_QUOTE_PAGE_INIT,
}; };
sendAsAnalyticsEvent(initEvent); sendAsAnalyticsEvent(initEvent);
break; break;
case ScreenState.ERROR: case ScreenState.ERROR:
const errorEvent: AnalyticsEvent = { const errorEvent: AnalyticsEvent = {
name: HI_RN_QUOTE_PAGE_ERROR_VIEW, name: AnalyticsEventNameConstants.HI_RN_QUOTE_PAGE_ERROR_VIEW,
}; };
sendAsAnalyticsEvent(errorEvent); sendAsAnalyticsEvent(errorEvent);
break; break;
@@ -194,7 +191,6 @@ const QuoteOfferScreen = ({
}; };
return ( return (
<View style={[styles.container, screenData?.screenStyle]}> <View style={[styles.container, screenData?.screenStyle]}>
<StatusBar backgroundColor={Colors.white} barStyle="dark-content" />
<Animated.View style={[styles.header, headerBgStyle]}> <Animated.View style={[styles.header, headerBgStyle]}>
{getWidgetViews( {getWidgetViews(
screenData?.screenWidgets?.headerWidgets, screenData?.screenWidgets?.headerWidgets,

View File

@@ -1,4 +1,32 @@
export const HI_SI_PILLS_CLICK = "hi_si_pills_click" export const AnalyticsEventNameConstants = {
export const SUM_INSURED = "sum_insured"; HI_SI_PILLS_CLICK: "hi_si_pills_click",
export const HI_RN_QUOTE_PAGE_INIT = "hi_rn_quote_page_init"; HI_RN_QUOTE_PAGE_INIT: "hi_rn_quote_page_init",
export const HI_RN_QUOTE_PAGE_ERROR_VIEW = "hi_rn_quote_page_error_view"; HI_RN_QUOTE_PAGE_ERROR_VIEW: "hi_rn_quote_page_error_view",
};
export const AnalyticsEventPropertyConstants = {
SUM_INSURED: "sum_insured",
TAG: "tag",
RECOMMENDED: "recommended",
NOT_RECOMMENDED: "not_recommended",
QUOTE_ID: "quoteId",
};
export const AnalyticsFlowNameConstant = {
GI_RN_QUOTE: "GiRnQuote",
};
export const AnalyticsModuleNameConstant = {
GI: "gi",
};
export const AnalyticsMethodNameConstant = {
FETCH_INSURANCE_QUOTE_PAGE_FROM_BACKEND: "fetchInsuranceQuotePageFromBackend",
FETCH_QUOTE_V3: "fetchQuoteV3",
FINAL_PATCH_CALL: "finalPatchCall",
};
export const AnalyticsGlobalErrorTypeConstant = {
GLOBAL_INTERNAL_ERRORS: "global_internal_errors",
GLOBAL_GENERIC_ERRORS: "global_generic_errors",
};

View File

@@ -52,6 +52,7 @@ export const sendAsGlobalErrorEvent = (event: GlobalErrorData) => {
vendorName = null, vendorName = null,
extras = null, extras = null,
journeySource = null, journeySource = null,
isAppDowntimeEvent = null
} = event; } = event;
NativeAnalyticsModule.sendAsGlobalErrorEvent({ NativeAnalyticsModule.sendAsGlobalErrorEvent({
@@ -66,5 +67,6 @@ export const sendAsGlobalErrorEvent = (event: GlobalErrorData) => {
vendorName, vendorName,
extras, extras,
journeySource, journeySource,
isAppDowntimeEvent
}); });
}; };

View File

@@ -10,4 +10,5 @@ interface GlobalErrorData {
vendorName?: string | null; vendorName?: string | null;
extras?: Map<string, string> | null; extras?: Map<string, string> | null;
journeySource?: string | null; journeySource?: string | null;
isAppDowntimeEvent?: boolean | null;
} }

View File

@@ -6,7 +6,7 @@ import {
} from "../constants/ScreenNameConstants"; } from "../constants/ScreenNameConstants";
import { CtaData } from "../interface"; import { CtaData } from "../interface";
import { ThemeProvider } from "../../../components/ThemeContext"; import { ThemeProvider } from "../../../components/ThemeContext";
import { LogBox } from "react-native"; import { LogBox, StatusBar } from "react-native";
import { NavigationContainer } from "@react-navigation/native"; import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack"; import { createStackNavigator } from "@react-navigation/stack";
@@ -15,6 +15,7 @@ import reduxStore from "../redux/store";
import { PersistGate } from "redux-persist/integration/react"; import { PersistGate } from "redux-persist/integration/react";
import BaseScreen from "../screen/BaseScreen"; import BaseScreen from "../screen/BaseScreen";
import { navigationRef } from "./NavigationRouter"; import { navigationRef } from "./NavigationRouter";
import Colors from "../../../assets/colors/colors";
LogBox.ignoreLogs(["Warning: ..."]); // Ignore log notification by message LogBox.ignoreLogs(["Warning: ..."]); // Ignore log notification by message
LogBox.ignoreAllLogs(); //Ignore all log notifications LogBox.ignoreAllLogs(); //Ignore all log notifications
@@ -29,6 +30,7 @@ export const RnApp = {
<PersistGate loading={null} persistor={persistor}> <PersistGate loading={null} persistor={persistor}>
<ThemeProvider> <ThemeProvider>
<NavigationContainer ref={navigationRef}> <NavigationContainer ref={navigationRef}>
<StatusBar backgroundColor={Colors.white} barStyle="dark-content" />
{getScreenStack(ctaData)} {getScreenStack(ctaData)}
</NavigationContainer> </NavigationContainer>
</ThemeProvider> </ThemeProvider>

View File

@@ -103,20 +103,7 @@ const BaseScreen: React.FC<{ navigation: any; route: any }> = ({
} }
}, [route.params.ctaData, screenState]); }, [route.params.ctaData, screenState]);
useFocusEffect(
React.useCallback(() => {
// This function will be called when the screen is focused (resumed)
console.log("Screen resumed");
// add code here to perform actions on screen resume
// update redux store based on current screen name
return () => {
// This function will be called when the screen loses focus (paused)
console.log("Screen paused");
};
}, [])
);
const { bottomsheet, addBottomSheet } = useBottomSheet(); const { bottomsheet, addBottomSheet } = useBottomSheet();
const handleActions = (actionPayload?: GenericActionPayload) => { const handleActions = (actionPayload?: GenericActionPayload) => {

View File

@@ -9,6 +9,13 @@ import { GI } from "../constants/NavigationHandlerConstants";
import { ScreenState } from "./BaseScreen"; import { ScreenState } from "./BaseScreen";
import { BASE_SCREEN } from "../constants/ScreenNameConstants"; import { BASE_SCREEN } from "../constants/ScreenNameConstants";
import { logToSentry } from "../hooks/useSentryLogging"; import { logToSentry } from "../hooks/useSentryLogging";
import { sendAsGlobalErrorEvent } from "../hooks/useAnalyticsEvent";
import {
AnalyticsFlowNameConstant,
AnalyticsGlobalErrorTypeConstant,
AnalyticsMethodNameConstant,
AnalyticsModuleNameConstant,
} from "../constants/AnalyticsEventsConstant";
export const ScreenActionHandler = { export const ScreenActionHandler = {
handleScreenAction: ( handleScreenAction: (
@@ -35,6 +42,17 @@ export const ScreenActionHandler = {
logToSentry( logToSentry(
`No response from api call: ${screenMetaData.actionType} | Error: ${error} | MethodName: handleScreenAction` `No response from api call: ${screenMetaData.actionType} | Error: ${error} | MethodName: handleScreenAction`
); );
const errorEvent: GlobalErrorData = {
reason: error.toString(),
moduleName: AnalyticsModuleNameConstant.GI,
flowName: AnalyticsFlowNameConstant.GI_RN_QUOTE,
methodName:
AnalyticsMethodNameConstant.FETCH_INSURANCE_QUOTE_PAGE_FROM_BACKEND,
globalErrorType:
AnalyticsGlobalErrorTypeConstant.GLOBAL_INTERNAL_ERRORS,
isAppDowntimeEvent: true,
};
sendAsGlobalErrorEvent(errorEvent);
const updatedScreenData: ScreenData = { const updatedScreenData: ScreenData = {
screenState: ScreenState.ERROR, screenState: ScreenState.ERROR,
errorMetaData: { errorMetaData: {
@@ -75,6 +93,16 @@ export const ScreenActionHandler = {
logToSentry( logToSentry(
`No response from api call: ${screenMetaData.actionType} | Error: ${error} | MethodName: handleScreenAction}` `No response from api call: ${screenMetaData.actionType} | Error: ${error} | MethodName: handleScreenAction}`
); );
const errorEvent: GlobalErrorData = {
reason: error.toString(),
moduleName: AnalyticsModuleNameConstant.GI,
flowName: AnalyticsFlowNameConstant.GI_RN_QUOTE,
methodName: AnalyticsMethodNameConstant.FETCH_QUOTE_V3,
globalErrorType:
AnalyticsGlobalErrorTypeConstant.GLOBAL_INTERNAL_ERRORS,
isAppDowntimeEvent: true,
};
sendAsGlobalErrorEvent(errorEvent);
const updatedScreenData: ScreenData = { const updatedScreenData: ScreenData = {
screenState: ScreenState.ERROR, screenState: ScreenState.ERROR,
errorMetaData: { errorMetaData: {

View File

@@ -15,7 +15,6 @@ export const ScreenMapper = {
handleActions: (actionPayload?: GenericActionPayload) => void handleActions: (actionPayload?: GenericActionPayload) => void
): JSX.Element { ): JSX.Element {
if (!!ctaData) { if (!!ctaData) {
console.log("ScreenMapper", ctaData);
const secondIdentifier = getScreenMapperNameFromCtaData(ctaData); const secondIdentifier = getScreenMapperNameFromCtaData(ctaData);
switch (secondIdentifier) { switch (secondIdentifier) {
case GI: case GI:

View File

@@ -83,11 +83,6 @@ export const getBuildConfigDetails = async (
export const isScreenWhiteListedForCaching = ( export const isScreenWhiteListedForCaching = (
screenName: string | null | undefined screenName: string | null | undefined
) => { ) => {
console.log(
"Caching eligibilty",
screenName,
!screensWithCachingDisabled.includes(screenName || "")
);
return !screensWithCachingDisabled.includes(screenName || ""); return !screensWithCachingDisabled.includes(screenName || "");
}; };

View File

@@ -16,10 +16,15 @@ import { parseValue } from "../../utilities/SerializerUtil";
import { WidgetActionTypes } from "./WidgetActionTypes"; import { WidgetActionTypes } from "./WidgetActionTypes";
import { NativeDeeplinkNavigatorModule } from "../../native-module/NativeModules"; import { NativeDeeplinkNavigatorModule } from "../../native-module/NativeModules";
import { FinalPatchCallRequestBody } from "../../interface/widgets/widgetData/FooterWithCardWidgetData"; import { FinalPatchCallRequestBody } from "../../interface/widgets/widgetData/FooterWithCardWidgetData";
import { ToastAndroid } from "react-native";
import { getQuoteIdFromCta } from "../../utilities/CtaParamsUtils"; import { getQuoteIdFromCta } from "../../utilities/CtaParamsUtils";
import { QUOTE_PATCH_FAIL_TOAST } from "../../constants/StringConstant";
import { logToSentry } from "../../hooks/useSentryLogging"; import { logToSentry } from "../../hooks/useSentryLogging";
import {
AnalyticsFlowNameConstant,
AnalyticsGlobalErrorTypeConstant,
AnalyticsMethodNameConstant,
AnalyticsModuleNameConstant,
} from "../../constants/AnalyticsEventsConstant";
import { sendAsGlobalErrorEvent } from "../../hooks/useAnalyticsEvent";
const WidgetActionHandler = { const WidgetActionHandler = {
handleWidgetAction: ( handleWidgetAction: (
@@ -153,11 +158,20 @@ const WidgetActionHandler = {
logToSentry( logToSentry(
`No response from api call: ${widgetMetaData.actionType} | Error: ${error} | MethodName: handleWidgetAction}` `No response from api call: ${widgetMetaData.actionType} | Error: ${error} | MethodName: handleWidgetAction}`
); );
const errorEvent: GlobalErrorData = {
reason: error.toString(),
moduleName: AnalyticsModuleNameConstant.GI,
flowName: AnalyticsFlowNameConstant.GI_RN_QUOTE,
methodName: AnalyticsMethodNameConstant.FINAL_PATCH_CALL,
globalErrorType:
AnalyticsGlobalErrorTypeConstant.GLOBAL_INTERNAL_ERRORS,
isAppDowntimeEvent: true,
};
sendAsGlobalErrorEvent(errorEvent);
setScreenData({ setScreenData({
...screenData, ...screenData,
screenState: ScreenState.LOADED, screenState: ScreenState.LOADED,
}); });
ToastAndroid.show(QUOTE_PATCH_FAIL_TOAST, ToastAndroid.SHORT);
return; return;
}); });
} }

View File

@@ -66,7 +66,6 @@ function resolveWidgetView(
handleClick?: (ctaData: CtaData) => void, handleClick?: (ctaData: CtaData) => void,
screenState?: ScreenState | null screenState?: ScreenState | null
) { ) {
console.log(widgetName);
switch (widgetName) { switch (widgetName) {
case SLIDER_WIDGET: case SLIDER_WIDGET:
return ( return (

View File

@@ -9,11 +9,14 @@ import android.provider.Settings
import android.text.TextUtils import android.text.TextUtils
import android.view.KeyEvent import android.view.KeyEvent
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.facebook.react.ReactApplication import com.facebook.react.ReactApplication
import com.facebook.react.ReactInstanceManager import com.facebook.react.ReactInstanceManager
import com.facebook.react.ReactRootView import com.facebook.react.ReactRootView
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
import com.facebook.react.modules.core.DeviceEventManagerModule import com.facebook.react.modules.core.DeviceEventManagerModule
import com.google.gson.Gson
import com.navi.base.model.CtaData
import com.navi.base.utils.PROD import com.navi.base.utils.PROD
import com.navi.base.utils.orFalse import com.navi.base.utils.orFalse
import com.navi.common.CommonLibManager import com.navi.common.CommonLibManager
@@ -21,7 +24,10 @@ import com.navi.common.callback.RequestToCallbackHandler
import com.navi.common.model.ModuleNameV2 import com.navi.common.model.ModuleNameV2
import com.navi.common.ui.activity.BaseActivity import com.navi.common.ui.activity.BaseActivity
import com.navi.common.utils.Constants import com.navi.common.utils.Constants
import com.navi.common.utils.setStatusBarColor
import com.navi.design.utils.parseColorSafe
import com.naviapp.BuildConfig import com.naviapp.BuildConfig
import com.naviapp.R
import com.naviapp.analytics.utils.NaviAnalytics import com.naviapp.analytics.utils.NaviAnalytics
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@@ -30,6 +36,7 @@ class ReactActivity : BaseActivity() , DefaultHardwareBackBtnHandler, RequestToC
private lateinit var reactRootView: ReactRootView private lateinit var reactRootView: ReactRootView
private lateinit var reactInstanceManager: ReactInstanceManager private lateinit var reactInstanceManager: ReactInstanceManager
private val RELOAD_PAGE = "reloadPage" private val RELOAD_PAGE = "reloadPage"
val gson = Gson()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null) super.onCreate(null)
@@ -47,12 +54,20 @@ class ReactActivity : BaseActivity() , DefaultHardwareBackBtnHandler, RequestToC
val reactApplication = application as ReactApplication val reactApplication = application as ReactApplication
reactInstanceManager = reactApplication.reactNativeHost.reactInstanceManager reactInstanceManager = reactApplication.reactNativeHost.reactInstanceManager
val ctaData = intent.extras?.getString(Constants.KEY_CTA_DATA) val ctaData = intent.extras?.getString(Constants.KEY_CTA_DATA)
val ctaDataObject: CtaData? = gson.fromJson(ctaData, CtaData::class.java)
var statusBarColor: Int? = R.color.white
ctaDataObject?.parameters?.forEach {
if (it.key == "statusBarColor") {
statusBarColor = it.value.parseColorSafe()
}
}
val bundle: Bundle? = if (ctaData != null) Bundle() else null val bundle: Bundle? = if (ctaData != null) Bundle() else null
bundle?.putString(Constants.KEY_CTA_DATA, ctaData.toString()) bundle?.putString(Constants.KEY_CTA_DATA, ctaData.toString())
reactRootView.startReactApplication(reactInstanceManager, reactRootView.startReactApplication(reactInstanceManager,
"NaviApp", bundle ?: intent.extras "NaviApp", bundle ?: intent.extras
) )
setContentView(reactRootView) setContentView(reactRootView)
statusBarColor?.let { this.setStatusBarColor(it) }
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {

View File

@@ -4,6 +4,7 @@ import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.ReadableMap
import com.navi.base.utils.orFalse
import com.navi.common.utils.CommonNaviAnalytics import com.navi.common.utils.CommonNaviAnalytics
import com.naviapp.utils.toMap import com.naviapp.utils.toMap
@@ -37,7 +38,8 @@ class NativeAnalyticsConnector internal constructor(context: ReactApplicationCon
val flowName = propsMap["flowName"] as? String val flowName = propsMap["flowName"] as? String
val methodName = propsMap["methodName"] as? String val methodName = propsMap["methodName"] as? String
val vendorName = propsMap["vendorName"] as? String val vendorName = propsMap["vendorName"] as? String
val extras: HashMap<String,String> = propsMap["extras"] as? HashMap<String, String> ?: hashMapOf() val extras: HashMap<String, String> =
propsMap["extras"] as? HashMap<String, String> ?: hashMapOf()
val eventName = propsMap["eventName"] as? String ?: "global_app_downtime" val eventName = propsMap["eventName"] as? String ?: "global_app_downtime"
CommonNaviAnalytics.naviAnalytics.Errors().onAppDowntime( CommonNaviAnalytics.naviAnalytics.Errors().onAppDowntime(
@@ -69,8 +71,10 @@ class NativeAnalyticsConnector internal constructor(context: ReactApplicationCon
val flowName = propsMap["flowName"] as? String val flowName = propsMap["flowName"] as? String
val methodName = propsMap["methodName"] as? String val methodName = propsMap["methodName"] as? String
val vendorName = propsMap["vendorName"] as? String val vendorName = propsMap["vendorName"] as? String
val extras: HashMap<String,String> = propsMap["extras"] as? HashMap<String, String> ?: hashMapOf() val extras: HashMap<String, String> =
propsMap["extras"] as? HashMap<String, String> ?: hashMapOf()
val journeySource = propsMap["journeySource"] as? String val journeySource = propsMap["journeySource"] as? String
val isAppDowntimeEvent = propsMap["isAppDowntimeEvent"] as? Boolean
CommonNaviAnalytics.naviAnalytics.ErrorBottomSheet().onGlobalError( CommonNaviAnalytics.naviAnalytics.ErrorBottomSheet().onGlobalError(
reason = reason, reason = reason,
@@ -85,5 +89,10 @@ class NativeAnalyticsConnector internal constructor(context: ReactApplicationCon
extras = extras.toMutableMap(), extras = extras.toMutableMap(),
journeySource = journeySource journeySource = journeySource
) )
if (isAppDowntimeEvent.orFalse()) {
sendAsAppDowntimeEvent(
eventProps
)
}
} }
} }

View File

@@ -25,12 +25,6 @@ const BaseWidget = ({
value: any | undefined | null, value: any | undefined | null,
actionPayloadList: GenericActionPayload | undefined actionPayloadList: GenericActionPayload | undefined
) { ) {
// console.log(
// "handleWidgetActions payload list" +
// JSON.stringify(actionPayloadList) +
// "value " +
// JSON.stringify(value)
// );
let payload = actionPayloadList; let payload = actionPayloadList;
let needPayloadCompression = false; let needPayloadCompression = false;
actionPayloadList?.metaData?.forEach((actionPayload) => { actionPayloadList?.metaData?.forEach((actionPayload) => {

View File

@@ -10,6 +10,13 @@ import { GenericActionPayload } from "../../../App/common/actions/GenericAction"
import { SumInsuredWidgetData } from "../../../App/common/interface/widgets/widgetData/SumInsuredWidgetData"; import { SumInsuredWidgetData } from "../../../App/common/interface/widgets/widgetData/SumInsuredWidgetData";
import { getIndexFromOffset } from "../../../App/common/utilities/SizeUtils"; import { getIndexFromOffset } from "../../../App/common/utilities/SizeUtils";
import CarouselItem from "./component/CarouselItem"; import CarouselItem from "./component/CarouselItem";
import { logToSentry } from "../../../App/common/hooks/useSentryLogging";
import { AnalyticsEvent } from "../../../App/common/interface";
import { sendAsAnalyticsEvent } from "../../../App/common/hooks/useAnalyticsEvent";
import {
AnalyticsEventNameConstants,
AnalyticsEventPropertyConstants,
} from "../../../App/common/constants/AnalyticsEventsConstant";
const SumInsuredWidget = ({ const SumInsuredWidget = ({
widgetData, widgetData,
@@ -26,7 +33,7 @@ const SumInsuredWidget = ({
widgetStyle?: ViewStyle; widgetStyle?: ViewStyle;
}) => { }) => {
const { width } = useWindowDimensions(); const { width } = useWindowDimensions();
const SIZE = width * 0.400; const SIZE = width * 0.4;
const SPACER_SIZE = (width - SIZE) / 2; const SPACER_SIZE = (width - SIZE) / 2;
const x = useSharedValue(0); const x = useSharedValue(0);
const isMiddleCard = useSharedValue(false); const isMiddleCard = useSharedValue(false);
@@ -48,11 +55,15 @@ const SumInsuredWidget = ({
}, },
}); });
// Makes a patch call to update the sumInsured in the backend
const handleActionApiCall = (index: number) => { const handleActionApiCall = (index: number) => {
const actionPayloadList = widgetData?.widgetMetaData?.onCarouselReleaseActionSequence; const actionPayloadList =
widgetData?.widgetMetaData?.onCarouselReleaseActionSequence;
if (!actionPayloadList) { if (!actionPayloadList) {
console.error("Action payload list is not defined."); logToSentry(
`Payload not present: ${actionPayloadList} | MethodName: handleActionApiCall`
);
return; return;
} }
@@ -86,6 +97,22 @@ const SumInsuredWidget = ({
widgetData?.widgetMetaData?.onValueChangeAction widgetData?.widgetMetaData?.onValueChangeAction
); );
} }
const clickEvent: AnalyticsEvent = {
name: AnalyticsEventNameConstants.HI_SI_PILLS_CLICK,
properties: new Map([
[
AnalyticsEventPropertyConstants.SUM_INSURED,
widgetData?.carouselListData?.at(index)?.sumInsured?.toString() ?? "",
],
[
AnalyticsEventPropertyConstants.TAG,
widgetData?.widgetMetaData?.recommendItemIndex === index
? AnalyticsEventPropertyConstants.RECOMMENDED
: AnalyticsEventPropertyConstants.NOT_RECOMMENDED,
],
]),
};
sendAsAnalyticsEvent(clickEvent);
}; };
const data = widgetData.carouselListData && [ const data = widgetData.carouselListData && [

View File

@@ -43,8 +43,6 @@ export const post = async <T>(
timeout: 10000, timeout: 10000,
headers: requestConfig.headers headers: requestConfig.headers
}) })
console.log("HeaderDataApiClient:", requestConfig?.headers)
console.log("ApiUrl:", BASE_URL + url)
const response = await axiosInstance.post<T>(baseUrl + url, data, requestConfig); const response = await axiosInstance.post<T>(baseUrl + url, data, requestConfig);
return handleSuccess<T>(response); return handleSuccess<T>(response);
} catch (error) { } catch (error) {