NTP-17879 | GI NAP Phase 2 Changes (#13975)
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
AnalyticsEventNameConstants,
|
||||
AnalyticsFlowNameConstant,
|
||||
AnalyticsMethodNameConstant,
|
||||
ApiMethod,
|
||||
GI,
|
||||
} from "../../../common/constants";
|
||||
import { sendAsAnalyticsEvent } from "../../../common/hooks/useAnalyticsEvent";
|
||||
@@ -62,6 +63,8 @@ export const getBenefitPageData = async (
|
||||
AnalyticsFlowNameConstant.GI_RN_BENEFIT,
|
||||
AnalyticsMethodNameConstant.FETCH_BENEFIT_LIST,
|
||||
startTime,
|
||||
url,
|
||||
ApiMethod.GET,
|
||||
);
|
||||
isScreenLoaded = true;
|
||||
} else {
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
AnalyticsEventNameConstants,
|
||||
AnalyticsFlowNameConstant,
|
||||
AnalyticsMethodNameConstant,
|
||||
ApiMethod,
|
||||
GI,
|
||||
} from "../../../common/constants";
|
||||
import { sendAsAnalyticsEvent } from "../../../common/hooks/useAnalyticsEvent";
|
||||
@@ -58,6 +59,8 @@ export const getMarketBenefitComparePageData = async (
|
||||
AnalyticsFlowNameConstant.GI_RN_BENEFIT_COMPARE,
|
||||
AnalyticsMethodNameConstant.MARKET_BENEFIT_COMPARE_LIST,
|
||||
startTime,
|
||||
url,
|
||||
ApiMethod.GET,
|
||||
);
|
||||
isScreenLoaded = true;
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ActionMetaData } from "../../../common/actions/GenericAction";
|
||||
import {
|
||||
AnalyticsFlowNameConstant,
|
||||
AnalyticsMethodNameConstant,
|
||||
ApiMethod,
|
||||
BASE_SCREEN,
|
||||
} from "../../../common/constants";
|
||||
import { GI } from "../../../common/constants/NavigationHandlerConstants";
|
||||
@@ -68,6 +69,8 @@ export const createQuote = async (
|
||||
AnalyticsFlowNameConstant.GI_RN_QUOTE,
|
||||
AnalyticsMethodNameConstant.FETCH_QUOTE_V4,
|
||||
startTime,
|
||||
url,
|
||||
ApiMethod.POST,
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -103,6 +106,8 @@ export const getQuotePageData = async (
|
||||
AnalyticsFlowNameConstant.GI_RN_QUOTE,
|
||||
AnalyticsMethodNameConstant.FETCH_INSURANCE_QUOTE_PAGE_FROM_BACKEND,
|
||||
startTime,
|
||||
url,
|
||||
ApiMethod.GET,
|
||||
);
|
||||
});
|
||||
};
|
||||
@@ -124,8 +129,9 @@ export const fetchComparisonPlanList = async (
|
||||
setScreenData: Dispatch<SetStateAction<ScreenData | null>>,
|
||||
) => {
|
||||
const startTime = Date.now();
|
||||
const url = "quotes/compare-plans";
|
||||
return post<ApiResponse<CtaData>>(
|
||||
"quotes/compare-plans",
|
||||
url,
|
||||
screenMetaData.data,
|
||||
getXTargetHeaderInfo(GI.toLocaleUpperCase()),
|
||||
)
|
||||
@@ -144,6 +150,8 @@ export const fetchComparisonPlanList = async (
|
||||
AnalyticsFlowNameConstant.GI_RN_QUOTE,
|
||||
AnalyticsMethodNameConstant.COMPARE_PLAN_LIST,
|
||||
startTime,
|
||||
url,
|
||||
ApiMethod.POST,
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
AnalyticsEventNameConstants,
|
||||
AnalyticsFlowNameConstant,
|
||||
AnalyticsMethodNameConstant,
|
||||
ApiMethod,
|
||||
GI,
|
||||
} from "../../../common/constants";
|
||||
import { sendAsAnalyticsEvent } from "../../../common/hooks/useAnalyticsEvent";
|
||||
@@ -58,6 +59,8 @@ export const getWaitingPeriodScreenData = async (
|
||||
AnalyticsFlowNameConstant.GI_WAITING_PERIOD,
|
||||
AnalyticsMethodNameConstant.WAITING_PERIOD_SCREEN,
|
||||
startTime,
|
||||
url,
|
||||
ApiMethod.GET,
|
||||
);
|
||||
isScreenLoaded = true;
|
||||
} else {
|
||||
|
||||
@@ -4,3 +4,11 @@ export enum BuildConfigConstants {
|
||||
APP_VERSION_CODE = "appVersionCode",
|
||||
FLAVOR = "flavor",
|
||||
}
|
||||
|
||||
export const ApiMethod = {
|
||||
POST: "POST",
|
||||
GET: "GET",
|
||||
PUT: "PUT",
|
||||
DELETE: "DELETE",
|
||||
PATCH: "PATCH",
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ import { EVENT_PROPERTY_KEYS, REACT_NATIVE } from "../constants";
|
||||
import { AnalyticsEvent } from "../interface";
|
||||
import { NativeAnalyticsModule } from "../native-module/NativeModules";
|
||||
import { ScreenState } from "../screen/BaseScreen";
|
||||
import { BASE_URL } from "../../../network/NetworkConstant";
|
||||
|
||||
export const useAnalyticsEvent = () => {
|
||||
return {
|
||||
@@ -74,9 +75,13 @@ export const sendAsGlobalErrorEvent = (event: GlobalErrorData) => {
|
||||
errorCode = null,
|
||||
errorTitle = null,
|
||||
latency = null,
|
||||
isNae = null,
|
||||
apiUrl = null,
|
||||
apiMethod = null,
|
||||
} = event;
|
||||
|
||||
const updatedSource = moduleName + "_" + REACT_NATIVE + "_" + source;
|
||||
const updatedApiUrl = BASE_URL + apiUrl;
|
||||
|
||||
NativeAnalyticsModule.sendAsGlobalErrorEvent({
|
||||
reason,
|
||||
@@ -94,6 +99,9 @@ export const sendAsGlobalErrorEvent = (event: GlobalErrorData) => {
|
||||
errorCode,
|
||||
errorTitle,
|
||||
latency,
|
||||
isNae,
|
||||
apiUrl: updatedApiUrl,
|
||||
apiMethod,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -14,4 +14,7 @@ interface GlobalErrorData {
|
||||
latency?: number | null;
|
||||
errorCode?: string | null;
|
||||
errorTitle?: string | null;
|
||||
isNae?: boolean | null;
|
||||
apiUrl?: string | null;
|
||||
apiMethod?: string | null;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,8 @@ export const handleErrorData = (
|
||||
flowName: string,
|
||||
methodName: string,
|
||||
startTime: number,
|
||||
apiUrl: string,
|
||||
apiMethod: string,
|
||||
) => {
|
||||
sendAsAnalyticsEvent({
|
||||
name: AnalyticsEventNameConstants.HI_RN_INVALID_DATA_ERROR,
|
||||
@@ -105,6 +107,9 @@ export const handleErrorData = (
|
||||
errorCode: error.axiosCode,
|
||||
errorTitle: getErrorTitleFromError(error.statusCode || -1),
|
||||
latency: latency,
|
||||
isNae: error.statusCode === 20 ? false : true,
|
||||
apiUrl: apiUrl,
|
||||
apiMethod: apiMethod,
|
||||
};
|
||||
sendAsGlobalErrorEvent(errorEvent);
|
||||
const updatedScreenData: ScreenData = {
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
GenericActionPayload,
|
||||
TargetWidgetPayload,
|
||||
} from "../../actions/GenericAction";
|
||||
import { ApiMethod } from "../../constants";
|
||||
import {
|
||||
AnalyticsEventNameConstants,
|
||||
AnalyticsFlowNameConstant,
|
||||
@@ -34,7 +35,6 @@ import { getErrorTypeFromStatusCode } from "../../utilities/ErrorUtils";
|
||||
import { updateValueByKeyPath } from "../../utilities/MiscUtils";
|
||||
import { parseValue } from "../../utilities/SerializerUtil";
|
||||
import { WidgetActionTypes } from "./WidgetActionTypes";
|
||||
import { BASE_SCREEN } from "../../constants";
|
||||
|
||||
const WidgetActionHandler = {
|
||||
handleWidgetAction: (
|
||||
@@ -172,6 +172,7 @@ const WidgetActionHandler = {
|
||||
widgetMetaData?.data as FinalPatchCallRequestBody
|
||||
).nextPageCta;
|
||||
requestData.applicationId = applicationId;
|
||||
const url = `v3/quotes/${quoteId}`;
|
||||
return updateSumInsuredData(requestData, quoteId!!)
|
||||
.then(response => {
|
||||
handleResponseData(nextPageCta, setScreenData, screenData);
|
||||
@@ -183,6 +184,8 @@ const WidgetActionHandler = {
|
||||
widgetMetaData,
|
||||
AnalyticsMethodNameConstant.FINAL_PATCH_CALL,
|
||||
screenData,
|
||||
url,
|
||||
ApiMethod.PATCH,
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -278,6 +281,8 @@ const handleErrorData = (
|
||||
widgetMetaData: ActionMetaData,
|
||||
methodName: string,
|
||||
screenData?: ScreenData | null,
|
||||
apiUrl?: string,
|
||||
apiMethod?: string,
|
||||
) => {
|
||||
sendAsAnalyticsEvent({
|
||||
name: AnalyticsEventNameConstants.HI_RN_INVALID_DATA_ERROR,
|
||||
@@ -296,6 +301,9 @@ const handleErrorData = (
|
||||
methodName: methodName,
|
||||
globalErrorType: getErrorTypeFromStatusCode(error.statusCode || -1),
|
||||
isAppDowntimeEvent: false,
|
||||
isNae: false,
|
||||
apiUrl: apiUrl,
|
||||
apiMethod: apiMethod,
|
||||
};
|
||||
sendAsGlobalErrorEvent(errorEvent);
|
||||
setScreenData({
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
||||
import com.facebook.react.bridge.ReactMethod
|
||||
import com.facebook.react.bridge.ReadableMap
|
||||
import com.navi.base.utils.EMPTY
|
||||
import com.navi.base.utils.orFalse
|
||||
import com.navi.base.utils.orZero
|
||||
import com.navi.common.checkmate.core.CheckMateManager
|
||||
@@ -105,17 +104,20 @@ class NativeAnalyticsConnector internal constructor(context: ReactApplicationCon
|
||||
val latency = (propsMap["latency"] as? Double)?.toLong() ?: 0L
|
||||
val errorCode = propsMap["errorCode"] as? String
|
||||
val errorTitle = propsMap["errorTitle"] as? String
|
||||
val isNae = propsMap["isNae"] as? Boolean ?: true
|
||||
val apiUrl = propsMap["apiUrl"] as? String
|
||||
val apiMethod = propsMap["apiMethod"] as? String
|
||||
|
||||
CheckMateManager.recordNetworkEvent(
|
||||
statusCode = statusCode?.toInt().orZero(),
|
||||
actualLatency = latency.orZero(),
|
||||
networkLatency = latency.orZero(),
|
||||
isNae = statusCode?.toInt() != 20,
|
||||
isNae = isNae,
|
||||
httpStatusCode = statusCode?.toInt().orZero(),
|
||||
vertical = getModuleNameForCheckMate(moduleName),
|
||||
screen = source.orEmpty(),
|
||||
method = EMPTY,
|
||||
endpoint = methodName.orEmpty(),
|
||||
method = apiMethod.orEmpty(),
|
||||
endpoint = apiUrl.orEmpty(),
|
||||
errorCode = errorCode.orEmpty(),
|
||||
errorTitle = errorTitle.orEmpty(),
|
||||
errorDes = reason.orEmpty(),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package com.navi.insurance.paymentreview.autopayoption.repository
|
||||
|
||||
import com.navi.common.checkmate.model.MetricInfo
|
||||
import com.navi.common.network.models.RepoResult
|
||||
import com.navi.common.network.retrofit.ResponseCallback
|
||||
import com.navi.insurance.models.response.PaymentReviewResponse
|
||||
@@ -19,13 +20,15 @@ class PaymentReviewRepository @Inject constructor(private val retrofitService: R
|
||||
suspend fun fetchPaymentReviewInMR(
|
||||
id: String? = null,
|
||||
paymentFlowIdentifier: String?,
|
||||
applicationId: String? = null
|
||||
applicationId: String? = null,
|
||||
metricInfo: MetricInfo<RepoResult<PaymentReviewResponse>>? = null
|
||||
): RepoResult<PaymentReviewResponse> =
|
||||
apiResponseCallback(
|
||||
retrofitService.fetchPAymentReviewInMR(
|
||||
id = id,
|
||||
paymentFlowIdentifier,
|
||||
applicationId = applicationId
|
||||
)
|
||||
),
|
||||
metricInfo
|
||||
)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ import com.navi.base.model.CtaData
|
||||
import com.navi.base.utils.isNotNull
|
||||
import com.navi.base.utils.isNull
|
||||
import com.navi.common.ResponseState
|
||||
import com.navi.common.checkmate.model.MetricInfo
|
||||
import com.navi.common.di.CoroutineDispatcherProvider
|
||||
import com.navi.common.network.models.isSuccessWithData
|
||||
import com.navi.insurance.common.models.GiErrorMetaData
|
||||
import com.navi.insurance.common.util.ActionHandler
|
||||
import com.navi.insurance.models.response.PaymentReviewResponse
|
||||
@@ -70,8 +72,18 @@ constructor(
|
||||
dispatcher.io + exceptionHandler(ApiErrorTagType.PAYMENT_REVIEW_SCREEN_LOAD_ERROR.value)
|
||||
) {
|
||||
_paymentRequestFlow.value = ResponseState.Loading
|
||||
val metricInfo =
|
||||
MetricInfo.InsuranceMetricInfo<PaymentReviewResponse>(
|
||||
screen = "paymentReviewScreen",
|
||||
isNae = { !it.isSuccessWithData() }
|
||||
)
|
||||
val response =
|
||||
repository.fetchPaymentReviewInMR(id, paymentFlowIdentifier, applicationId)
|
||||
repository.fetchPaymentReviewInMR(
|
||||
id,
|
||||
paymentFlowIdentifier,
|
||||
applicationId,
|
||||
metricInfo
|
||||
)
|
||||
if (
|
||||
response.error.isNull() &&
|
||||
response.errors.isNullOrEmpty() &&
|
||||
|
||||
@@ -365,7 +365,7 @@ constructor(
|
||||
) {
|
||||
val metricInfo =
|
||||
MetricInfo.InsuranceMetricInfo<PreQuotePatchResponse>(
|
||||
screen = "PreQuoteJourneyViewModel",
|
||||
screen = "PreQuoteJourney",
|
||||
isNae = { !it.isSuccessWithData() && it.statusCode != ERROR_CODE_400 }
|
||||
)
|
||||
val response =
|
||||
|
||||
Reference in New Issue
Block a user