TP-83691 | Adverse Changes (#12899)
This commit is contained in:
@@ -12,12 +12,10 @@ import { CtaData, CtaType } from "../../../../common/interface";
|
||||
import { Widget } from "../../../../common/interface/widgets/Widget";
|
||||
import { ScreenData } from "../../../../common/interface/widgets/screenData/ScreenData";
|
||||
import { NativeDeeplinkNavigatorModule } from "../../../../common/native-module/NativeModules";
|
||||
import {
|
||||
CtaNavigator,
|
||||
extractCtaParameters,
|
||||
} from "../../../../common/navigator/NavigationRouter";
|
||||
import { CtaNavigator } from "../../../../common/navigator/NavigationRouter";
|
||||
import { ScreenState } from "../../../../common/screen/BaseScreen";
|
||||
import { ScreenActionTypes } from "../../../../common/screen/ScreenActionTypes";
|
||||
import { extractCtaParameters } from "../../../../common/utilities/CtaParamsUtils";
|
||||
import QuoteOfferErrorScreen from "../quote-offer-screen/error-screen/QuoteOfferErrorScreen";
|
||||
import ComparePlanShimmerScreen from "./shimmer-screen/ComparePlanShimmerScreen";
|
||||
|
||||
|
||||
@@ -26,12 +26,10 @@ import { AnalyticsEvent, CtaData, CtaType } from "../../../../common/interface";
|
||||
import { Widget } from "../../../../common/interface/widgets/Widget";
|
||||
import { ScreenData } from "../../../../common/interface/widgets/screenData/ScreenData";
|
||||
import { NativeDeeplinkNavigatorModule } from "../../../../common/native-module/NativeModules";
|
||||
import {
|
||||
CtaNavigator,
|
||||
extractCtaParameters,
|
||||
} from "../../../../common/navigator/NavigationRouter";
|
||||
import { CtaNavigator } from "../../../../common/navigator/NavigationRouter";
|
||||
import { ScreenState } from "../../../../common/screen/BaseScreen";
|
||||
import { ScreenActionTypes } from "../../../../common/screen/ScreenActionTypes";
|
||||
import { extractCtaParameters } from "../../../../common/utilities/CtaParamsUtils";
|
||||
import GenericShimmerScreen from "../generic-shimmer-screen/GenericShimmerScreen";
|
||||
import QuoteOfferErrorScreen from "../quote-offer-screen/error-screen/QuoteOfferErrorScreen";
|
||||
import styles from "./MarketBenefitCompareScreenStyles";
|
||||
|
||||
@@ -12,7 +12,6 @@ import Animated, {
|
||||
useAnimatedStyle,
|
||||
useDerivedValue,
|
||||
useSharedValue,
|
||||
withDelay,
|
||||
withTiming,
|
||||
} from "react-native-reanimated";
|
||||
import Colors from "../../../../../assets/colors/colors";
|
||||
@@ -23,7 +22,9 @@ import {
|
||||
GenericActionPayload,
|
||||
} from "../../../../common/actions/GenericAction";
|
||||
import {
|
||||
ADVERSE,
|
||||
ConstantCta,
|
||||
HOME,
|
||||
QUOTE_OFFER_SCREEN,
|
||||
ScreenProperties,
|
||||
} from "../../../../common/constants";
|
||||
@@ -40,12 +41,11 @@ import { Widget } from "../../../../common/interface/widgets/Widget";
|
||||
import { ScreenData } from "../../../../common/interface/widgets/screenData/ScreenData";
|
||||
import { FabWidgetData } from "../../../../common/interface/widgets/widgetData/FabWidgetData";
|
||||
import { NativeDeeplinkNavigatorModule } from "../../../../common/native-module/NativeModules";
|
||||
import {
|
||||
CtaNavigator,
|
||||
extractCtaParameters,
|
||||
} from "../../../../common/navigator/NavigationRouter";
|
||||
import { CtaNavigator } from "../../../../common/navigator/NavigationRouter";
|
||||
import { ScreenState } from "../../../../common/screen/BaseScreen";
|
||||
import { ScreenActionTypes } from "../../../../common/screen/ScreenActionTypes";
|
||||
import { extractCtaParameters } from "../../../../common/utilities/CtaParamsUtils";
|
||||
import { handleGoBackOrExitApp } from "../../../../common/utilities/NavigationUtil";
|
||||
import styles from "./QuoteOfferScreenStyle";
|
||||
import QuoteOfferErrorScreen from "./error-screen/QuoteOfferErrorScreen";
|
||||
import QuoteOfferShimmerScreen from "./shimmer-screen/QuoteOfferShimmerScreen";
|
||||
@@ -113,7 +113,7 @@ const QuoteOfferScreen = ({
|
||||
};
|
||||
});
|
||||
|
||||
const { applicationId, preQuoteId, quoteId, navigatorType } =
|
||||
const { applicationId, preQuoteId, quoteId, source } =
|
||||
extractCtaParameters(ctaData);
|
||||
|
||||
const nativeEventListener = new NativeEventEmitter();
|
||||
@@ -126,6 +126,10 @@ const QuoteOfferScreen = ({
|
||||
);
|
||||
return;
|
||||
}
|
||||
if ((cta.url = HOME) && source == ADVERSE) {
|
||||
cta.type = CtaType.GO_BACK;
|
||||
}
|
||||
const { navigatorType } = extractCtaParameters(cta);
|
||||
|
||||
try {
|
||||
switch (cta.type) {
|
||||
@@ -138,6 +142,9 @@ const QuoteOfferScreen = ({
|
||||
case CtaType.RN_NAVIGATOR:
|
||||
CtaNavigator.performNavigation(navigation, navigatorType, cta);
|
||||
break;
|
||||
case CtaType.GO_BACK:
|
||||
handleGoBackOrExitApp(navigation);
|
||||
break;
|
||||
default:
|
||||
NativeDeeplinkNavigatorModule.navigateToNaviDeeplinkNavigator(
|
||||
JSON.stringify(cta),
|
||||
|
||||
@@ -28,12 +28,10 @@ import { AnalyticsEvent, CtaData, CtaType } from "../../../../common/interface";
|
||||
import { Widget } from "../../../../common/interface/widgets/Widget";
|
||||
import { ScreenData } from "../../../../common/interface/widgets/screenData/ScreenData";
|
||||
import { NativeDeeplinkNavigatorModule } from "../../../../common/native-module/NativeModules";
|
||||
import {
|
||||
CtaNavigator,
|
||||
extractCtaParameters,
|
||||
} from "../../../../common/navigator/NavigationRouter";
|
||||
import { CtaNavigator } from "../../../../common/navigator/NavigationRouter";
|
||||
import { ScreenState } from "../../../../common/screen/BaseScreen";
|
||||
import { ScreenActionTypes } from "../../../../common/screen/ScreenActionTypes";
|
||||
import { extractCtaParameters } from "../../../../common/utilities/CtaParamsUtils";
|
||||
import GenericShimmerScreen from "../generic-shimmer-screen/GenericShimmerScreen";
|
||||
import QuoteOfferErrorScreen from "../quote-offer-screen/error-screen/QuoteOfferErrorScreen";
|
||||
import styles from "./WaitingPeriodScreenStyles";
|
||||
|
||||
@@ -47,6 +47,8 @@ export const BUILD_CONFIG_DETAILS = "BUILD_CONFIG_DETAILS";
|
||||
export const SPACE_UNICODE = "\u00A0";
|
||||
export const REACT_NATIVE = "rn";
|
||||
export const NAVIGATION_ERROR = "Navigation Error";
|
||||
export const HOME = "home";
|
||||
export const ADVERSE = "adverse";
|
||||
|
||||
export enum SeparatorType {
|
||||
DASHED = "dashed",
|
||||
|
||||
@@ -52,6 +52,7 @@ export enum ParameterType {
|
||||
QUOTE_ID = "quoteId",
|
||||
NAVIGATOR_TYPE = "RnNavigatorType",
|
||||
APPLICATION_ID = "applicationId",
|
||||
SOURCE = "source",
|
||||
}
|
||||
|
||||
export enum CtaType {
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
BaseNavigator,
|
||||
NavigationType,
|
||||
CtaParameter,
|
||||
ParameterType,
|
||||
} from "../interface";
|
||||
import { BASE_SCREEN } from "../constants/ScreenNameConstants";
|
||||
import {
|
||||
ActionMetaData,
|
||||
BaseActionTypes,
|
||||
GenericActionPayload,
|
||||
ActionMetaData,
|
||||
} from "../actions/GenericAction";
|
||||
import WidgetActionHandler from "../widgets/widget-actions/WidgetActionHandler";
|
||||
import { ScreenActionHandler } from "../screen/ScreenActionHandler";
|
||||
import { BASE_SCREEN } from "../constants/ScreenNameConstants";
|
||||
import { logToSentry } from "../hooks/useSentryLogging";
|
||||
import { BaseNavigator, NavigationType } from "../interface";
|
||||
import { ScreenActionHandler } from "../screen/ScreenActionHandler";
|
||||
import WidgetActionHandler from "../widgets/widget-actions/WidgetActionHandler";
|
||||
|
||||
export const CtaNavigator: BaseNavigator = {
|
||||
navigate: (navigationRef, ctaData) => {
|
||||
@@ -43,41 +38,6 @@ export const CtaNavigator: BaseNavigator = {
|
||||
},
|
||||
};
|
||||
|
||||
export const extractCtaParameters = (
|
||||
ctaData: any,
|
||||
): {
|
||||
preQuoteId?: string | undefined | null;
|
||||
quoteId?: string | undefined | null;
|
||||
navigatorType?: string | undefined | null;
|
||||
applicationId?: string | undefined | null;
|
||||
} => {
|
||||
let preQuoteId: string | undefined | null = undefined;
|
||||
let quoteId: string | undefined | null = undefined;
|
||||
let navigatorType: string | undefined | null = undefined;
|
||||
let applicationId: string | undefined | null = undefined;
|
||||
|
||||
ctaData?.parameters?.forEach((item: CtaParameter) => {
|
||||
switch (item.key) {
|
||||
case ParameterType.PRE_QUOTE_ID:
|
||||
preQuoteId = item.value;
|
||||
break;
|
||||
case ParameterType.QUOTE_ID:
|
||||
quoteId = item.value;
|
||||
break;
|
||||
case ParameterType.NAVIGATOR_TYPE:
|
||||
navigatorType = item.value;
|
||||
break;
|
||||
case ParameterType.APPLICATION_ID:
|
||||
applicationId = item.value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return { preQuoteId, quoteId, navigatorType, applicationId };
|
||||
};
|
||||
|
||||
export const Router = {
|
||||
handleAction(actionPayload: GenericActionPayload, navigation?: any): void {
|
||||
switch (actionPayload.baseActionType) {
|
||||
|
||||
@@ -1,7 +1,46 @@
|
||||
import { APPLICATION_ID, QUOTE_ID } from "../constants";
|
||||
import { CtaData } from "../interface";
|
||||
import { CtaData, CtaParameter, ParameterType } from "../interface";
|
||||
import { ScreenMetaData } from "../interface/widgets/screenData/ScreenMetaData";
|
||||
|
||||
export const extractCtaParameters = (
|
||||
ctaData: any,
|
||||
): {
|
||||
preQuoteId?: string | undefined | null;
|
||||
quoteId?: string | undefined | null;
|
||||
navigatorType?: string | undefined | null;
|
||||
applicationId?: string | undefined | null;
|
||||
source?: string | undefined | null;
|
||||
} => {
|
||||
let preQuoteId: string | undefined | null = undefined;
|
||||
let quoteId: string | undefined | null = undefined;
|
||||
let navigatorType: string | undefined | null = undefined;
|
||||
let applicationId: string | undefined | null = undefined;
|
||||
let source: string | undefined | null = undefined;
|
||||
|
||||
ctaData?.parameters?.forEach((item: CtaParameter) => {
|
||||
switch (item.key) {
|
||||
case ParameterType.PRE_QUOTE_ID:
|
||||
preQuoteId = item.value;
|
||||
break;
|
||||
case ParameterType.QUOTE_ID:
|
||||
quoteId = item.value;
|
||||
break;
|
||||
case ParameterType.NAVIGATOR_TYPE:
|
||||
navigatorType = item.value;
|
||||
break;
|
||||
case ParameterType.APPLICATION_ID:
|
||||
applicationId = item.value;
|
||||
break;
|
||||
case ParameterType.SOURCE:
|
||||
source = item.value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
return { preQuoteId, quoteId, navigatorType, applicationId, source };
|
||||
};
|
||||
|
||||
export const getQuoteIdFromCta = (ctaData?: CtaData) => {
|
||||
const quoteObj = ctaData?.parameters?.find(item => item.key === QUOTE_ID);
|
||||
return quoteObj?.value;
|
||||
|
||||
10
App/common/utilities/NavigationUtil.ts
Normal file
10
App/common/utilities/NavigationUtil.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NavigationProp } from "@react-navigation/native";
|
||||
import { BackHandler } from "react-native";
|
||||
|
||||
export const handleGoBackOrExitApp = (navigation: NavigationProp<any>) => {
|
||||
if (navigation.canGoBack()) {
|
||||
navigation.goBack();
|
||||
} else {
|
||||
BackHandler.exitApp();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user