TP-62888 | Feature | Market benefit comparison (#10870)
This commit is contained in:
committed by
GitHub
parent
a9630e73f8
commit
68d20a76c6
@@ -1,5 +1,6 @@
|
||||
export { default as QuoteOfferScreen } from "./screen/quote-offer-screen/QuoteOfferScreen";
|
||||
export { default as QuoteApologyScreen } from "./screen/quote-apology-screen/QuoteApologyScreen";
|
||||
export { default as ComparePlanScreen } from "./screen/compare-plan-screen/ComparePlanScreen";
|
||||
export { default as MarketBenefitCompareScreen } from "./screen/market-benefit-compare-screen/MarketBenefitCompareScreen";
|
||||
export { default as GenericShimmerScreen } from "./screen/generic-shimmer-screen/GenericShimmerScreen";
|
||||
export { default as GenericErrorScreen } from "./screen/generic-error-screen/GenericErrorScreen";
|
||||
export { default as GenericErrorScreen } from "./screen/generic-error-screen/GenericErrorScreen";
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import React, { useEffect } from "react";
|
||||
import {
|
||||
BackHandler,
|
||||
NativeScrollEvent,
|
||||
NativeSyntheticEvent,
|
||||
View,
|
||||
} from "react-native";
|
||||
import Animated, {
|
||||
useAnimatedStyle,
|
||||
useSharedValue,
|
||||
} from "react-native-reanimated";
|
||||
import BaseWidget from "../../../../../components/widgets/BaseWidget";
|
||||
import {
|
||||
BaseActionTypes,
|
||||
GenericActionPayload,
|
||||
} from "../../../../common/actions/GenericAction";
|
||||
import {
|
||||
AnalyticsEventNameConstants,
|
||||
ConstantCta,
|
||||
} from "../../../../common/constants";
|
||||
import { sendAsAnalyticsEvent } from "../../../../common/hooks/useAnalyticsEvent";
|
||||
import { logToSentry } from "../../../../common/hooks/useSentryLogging";
|
||||
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 { ScreenState } from "../../../../common/screen/BaseScreen";
|
||||
import { ScreenActionTypes } from "../../../../common/screen/ScreenActionTypes";
|
||||
import GenericShimmerScreen from "../generic-shimmer-screen/GenericShimmerScreen";
|
||||
import QuoteOfferErrorScreen from "../quote-offer-screen/error-screen/QuoteOfferErrorScreen";
|
||||
import styles from "./MarketBenefitCompareScreenStyles";
|
||||
const MarketBenefitCompareScreen = ({
|
||||
ctaData,
|
||||
screenData,
|
||||
handleActions,
|
||||
}: {
|
||||
ctaData: CtaData;
|
||||
screenData: ScreenData | null;
|
||||
handleActions: (screenPayload?: GenericActionPayload) => void;
|
||||
}) => {
|
||||
const navigation = useNavigation();
|
||||
const y = useSharedValue(0);
|
||||
const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||
y.value = event.nativeEvent.contentOffset.y;
|
||||
};
|
||||
const handleClick = (cta?: CtaData) => {
|
||||
if (!cta) {
|
||||
logToSentry(
|
||||
`Navigation cta is missing or invalid: ${cta} | MethodName: handleClick}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const { navigatorType } = extractCtaParameters(cta);
|
||||
|
||||
try {
|
||||
switch (cta.type) {
|
||||
case CtaType.DEEP_LINK:
|
||||
case CtaType.USE_ROOT_DEEPLINK_NAVIGATOR:
|
||||
NativeDeeplinkNavigatorModule.navigateToNaviInsuranceDeeplinkNavigator(
|
||||
JSON.stringify(cta),
|
||||
);
|
||||
break;
|
||||
case CtaType.RN_NAVIGATOR:
|
||||
CtaNavigator.performNavigation(navigation, navigatorType, cta);
|
||||
break;
|
||||
case CtaType.GO_BACK:
|
||||
if (navigation.canGoBack()) {
|
||||
navigation.goBack();
|
||||
} else {
|
||||
BackHandler.exitApp();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NativeDeeplinkNavigatorModule.navigateToNaviDeeplinkNavigator(
|
||||
JSON.stringify(cta),
|
||||
);
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
logToSentry(
|
||||
`Error while navigating to deep link with CTA: ${cta} | MethodName: handleClick}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
handleActions({
|
||||
baseActionType: BaseActionTypes.SCREEN_ACTION,
|
||||
metaData: [
|
||||
{
|
||||
actionType: ScreenActionTypes.FETCH_BENEFIT_COMPARE_LIST,
|
||||
data: ctaData?.data,
|
||||
},
|
||||
],
|
||||
});
|
||||
}, [ctaData]);
|
||||
|
||||
const headerStyle = useAnimatedStyle(() => {
|
||||
return {
|
||||
shadowColor: y.value > 1 ? "black" : "transparent",
|
||||
shadowOpacity: y.value > 1 ? 1 : 0,
|
||||
shadowRadius: y.value > 1 ? 8 : 0,
|
||||
elevation: y.value > 1 ? 32 : 0,
|
||||
};
|
||||
});
|
||||
|
||||
const Header = () => {
|
||||
return (
|
||||
<Animated.View style={[styles.header, headerStyle]}>
|
||||
{getWidgetViews(
|
||||
screenData?.screenWidgets?.headerWidgets,
|
||||
handleActions,
|
||||
screenData?.screenState,
|
||||
handleClick,
|
||||
)}
|
||||
</Animated.View>
|
||||
);
|
||||
};
|
||||
|
||||
const ContentWidgets = () => {
|
||||
return getWidgetViews(
|
||||
screenData?.screenWidgets?.contentWidgets,
|
||||
handleActions,
|
||||
screenData?.screenState,
|
||||
handleClick,
|
||||
);
|
||||
};
|
||||
|
||||
const Footer = () => {
|
||||
return (
|
||||
<View style={styles.footer}>
|
||||
{getWidgetViews(
|
||||
screenData?.screenWidgets?.footerWidgets,
|
||||
handleActions,
|
||||
screenData?.screenState,
|
||||
handleClick,
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
switch (screenData?.screenState) {
|
||||
case ScreenState.LOADED:
|
||||
const initEvent: AnalyticsEvent = {
|
||||
name: AnalyticsEventNameConstants.HI_RN_BENEFIT_COMPARE_PAGE_INIT,
|
||||
};
|
||||
sendAsAnalyticsEvent(initEvent);
|
||||
break;
|
||||
case ScreenState.ERROR:
|
||||
const errorEvent: AnalyticsEvent = {
|
||||
name: AnalyticsEventNameConstants.HI_RN_BENEFIT_COMPARE_PAGE_ERROR_VIEW,
|
||||
};
|
||||
sendAsAnalyticsEvent(errorEvent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}, [screenData?.screenState]);
|
||||
|
||||
if (screenData?.screenState === ScreenState.LOADING) {
|
||||
return <GenericShimmerScreen />;
|
||||
}
|
||||
|
||||
if (screenData?.screenState === ScreenState.ERROR) {
|
||||
return (
|
||||
<QuoteOfferErrorScreen
|
||||
errorMetaData={screenData.errorMetaData}
|
||||
handleActions={handleActions}
|
||||
handleClick={handleClick}
|
||||
headerProperties={{
|
||||
leftIconCta: ConstantCta.STATIC_HEADER_LEFT_ICON_CTA,
|
||||
rightIconCta: ConstantCta.STATIC_HEADER_RIGHT_ICON_CTA,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<View style={[styles.container, screenData?.screenStyle]}>
|
||||
<Header />
|
||||
<Animated.ScrollView
|
||||
showsVerticalScrollIndicator={false}
|
||||
contentContainerStyle={styles.content}
|
||||
nestedScrollEnabled={true}
|
||||
onScroll={onScroll}
|
||||
>
|
||||
<ContentWidgets />
|
||||
</Animated.ScrollView>
|
||||
<Footer />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
function getWidgetViews(
|
||||
widgetList: Widget[] | undefined,
|
||||
handleActions: (screenActionPayload?: GenericActionPayload) => void,
|
||||
screenState?: ScreenState | null,
|
||||
handleClick?: (ctaData: CtaData) => void,
|
||||
): React.JSX.Element {
|
||||
return (
|
||||
<View>
|
||||
{widgetList?.map((widget, index) => {
|
||||
return (
|
||||
<BaseWidget
|
||||
widget={widget}
|
||||
handleScreenActions={handleActions}
|
||||
screenState={screenState}
|
||||
widgetIndex={index}
|
||||
key={index}
|
||||
handleClick={handleClick}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default MarketBenefitCompareScreen;
|
||||
@@ -0,0 +1,22 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
flexDirection: "column",
|
||||
},
|
||||
header: {
|
||||
width: "100%",
|
||||
alignItems: "stretch",
|
||||
backgroundColor: "#FFFFFF",
|
||||
zIndex: 1
|
||||
},
|
||||
content: {
|
||||
flexGrow: 1,
|
||||
},
|
||||
footer: {
|
||||
alignItems: "stretch",
|
||||
},
|
||||
});
|
||||
|
||||
export default styles;
|
||||
@@ -2,6 +2,8 @@ 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",
|
||||
HI_RN_BENEFIT_COMPARE_PAGE_INIT: "hi_rn_benefit_compare_page_init",
|
||||
HI_RN_BENEFIT_COMPARE_PAGE_ERROR_VIEW: "hi_rn_benefit_compare_page_error_view",
|
||||
PATCH_QUOTE_V2: "patch_quote_v2",
|
||||
};
|
||||
|
||||
@@ -26,7 +28,8 @@ export const AnalyticsMethodNameConstant = {
|
||||
FETCH_QUOTE_V3: "fetchQuoteV3",
|
||||
FETCH_QUOTE_V4: "fetchQuoteV4",
|
||||
FINAL_PATCH_CALL: "finalPatchCall",
|
||||
COMPARE_PLAN_LIST : "comparePlanList",
|
||||
COMPARE_PLAN_LIST: "comparePlanList",
|
||||
MARKET_BENEFIT_COMPARE_LIST: "gi_market_benefit_compare_list_error",
|
||||
};
|
||||
|
||||
export const AnalyticsGlobalErrorTypeConstant = {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export const PREMIUM_DETAILS_BOTTOM_SHEET = "premium_details_bottom_sheet";
|
||||
export const TITLE_WITH_FEEDBACK_PILL_BOTTOM_SHEET = "title_with_feedback_pill_bottom_sheet";
|
||||
export const TITLE_WITH_STEPS_BOTTOM_SHEET = "title_with_steps_bottom_sheet"
|
||||
export const MEMBER_DETAILS_BOTTOM_SHEET = "member_details_bottom_sheet"
|
||||
export const POLICY_AMOUNT_BOTTOM_SHEET = "policy_amount_bottom_sheet"
|
||||
export const TITLE_WITH_LEFT_RIGHT_BUTTONS_BOTTOM_SHEET = "title_with_left_right_buttons_bottom_sheet"
|
||||
export const TITLE_WITH_FEEDBACK_PILL_BOTTOM_SHEET =
|
||||
"title_with_feedback_pill_bottom_sheet";
|
||||
export const TITLE_WITH_STEPS_BOTTOM_SHEET = "title_with_steps_bottom_sheet";
|
||||
export const TITLE_SUBTITLE_WITH_DROPDOWN_BOTTOM_SHEET =
|
||||
"title_subtitle_with_dropdown_bottom_sheet";
|
||||
export const MEMBER_DETAILS_BOTTOM_SHEET = "member_details_bottom_sheet";
|
||||
export const POLICY_AMOUNT_BOTTOM_SHEET = "policy_amount_bottom_sheet";
|
||||
export const TITLE_WITH_LEFT_RIGHT_BUTTONS_BOTTOM_SHEET =
|
||||
"title_with_left_right_buttons_bottom_sheet";
|
||||
|
||||
@@ -7,4 +7,5 @@ export const INSURANCE_LANDING_PAGE_SCREEN = "insurance_landing_page";
|
||||
export const QUOTE_OFFER_SCREEN = "quote_offer";
|
||||
export const BUY_INSURANCE_SCREEN = "buyinsurance";
|
||||
export const QUOTE_APOLOGY_SCREEN = "fresh_policy_form";
|
||||
export const COMPARE_PLAN_SCREEN = "compare_plans";
|
||||
export const MARKET_BENEFITS_COMPARE_SCREEN = "market_benefits_compare";
|
||||
export const COMPARE_PLAN_SCREEN = "compare_plans";
|
||||
|
||||
@@ -17,5 +17,6 @@ export const TITLE_WITH_COLUMN_WIDGET = "TITLE_WITH_COLUMN_WIDGET";
|
||||
export const TITLE_WITH_ASSET_BACKGROUND_WIDGET = "TITLE_WITH_ASSET_BACKGROUND_WIDGET";
|
||||
export const CARD_WITH_ICON_WIDGET = "CARD_WITH_ICON_WIDGET";
|
||||
export const SPACER_WIDGET = "SPACER_WIDGET";
|
||||
export const SELECT_CARD_WITH_DETAIL_LIST_WIDGET = "SELECT_CARD_WITH_DETAIL_LIST_WIDGET";
|
||||
export const TABLE_WIDGET = "TABLE_WIDGET";
|
||||
export const HERO_SECTION_WIDGET = "HERO_SECTION_WIDGET";
|
||||
export const SELECT_CARD_WITH_DETAIL_LIST_WIDGET = "SELECT_CARD_WITH_DETAIL_LIST_WIDGET";
|
||||
|
||||
@@ -44,8 +44,8 @@ export const useBottomSheet = (
|
||||
setTimeout(() => {
|
||||
removeBottomSheet();
|
||||
addBottomSheet(modalView);
|
||||
}, 3 * BOTTOMSHEET_ANIMATION_DURATION);
|
||||
// 3 * BOTTOMSHEET_ANIMATION_DURATION is for allowing the current bottomsheet to close animatically before opening the new one.
|
||||
}, BOTTOMSHEET_ANIMATION_DURATION);
|
||||
// BOTTOMSHEET_ANIMATION_DURATION is for allowing the current bottomsheet to close animatically before opening the new one.
|
||||
};
|
||||
|
||||
return { bottomsheet, addBottomSheet, removeBottomSheet, replaceBottomSheet };
|
||||
|
||||
@@ -57,5 +57,6 @@ export enum CtaType {
|
||||
DISMISS_MODAL = "DISMISS_MODAL",
|
||||
USE_ROOT_DEEPLINK_NAVIGATOR = "USE_ROOT_DEEPLINK_NAVIGATOR",
|
||||
RN_NAVIGATOR = "RN_NAVIGATOR",
|
||||
GO_BACK = "GO_BACK",
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { ViewStyle } from "react-native";
|
||||
import { CtaData } from "../..";
|
||||
import { GenericWidgetData } from "../Widget";
|
||||
import { ImageFieldData, TextFieldData } from "../widgetData/TitleWidgetData";
|
||||
import { KeyValueInfoData } from "./PremiumDetailsBottomSheetData";
|
||||
|
||||
export interface TitleSubtitleWithDropdownBottomSheetData
|
||||
extends GenericWidgetData {
|
||||
title?: TextFieldData;
|
||||
rightTitle?: TextFieldData;
|
||||
subtitle?: TextFieldData;
|
||||
infoList?: KeyValueInfoData[];
|
||||
dropdownData?: DropdownData;
|
||||
viewStyle?: ViewStyle;
|
||||
}
|
||||
|
||||
export interface TitleSubtitleWithDropdownBottomSheetProps {
|
||||
bottomSheetData: TitleSubtitleWithDropdownBottomSheetData;
|
||||
handleModalClick: (cta: CtaData) => void;
|
||||
}
|
||||
|
||||
export interface DropdownData {
|
||||
title?: TextFieldData;
|
||||
rightIcon?: ImageFieldData;
|
||||
titleContainerStyle?: TitleContainerStyle;
|
||||
contentList?: DropdownContent[];
|
||||
style?: ViewStyle;
|
||||
}
|
||||
|
||||
export interface TitleContainerStyle {
|
||||
expanded?: ViewStyle;
|
||||
collapsed?: ViewStyle;
|
||||
}
|
||||
|
||||
export interface DropdownContent {
|
||||
icon?: ImageFieldData;
|
||||
content?: TextFieldData;
|
||||
}
|
||||
@@ -40,4 +40,4 @@ export enum ButtonState {
|
||||
ENABLED = "ENABLED",
|
||||
DISABLED = "DISABLED",
|
||||
LOADING = "LOADING",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { ViewStyle } from "react-native";
|
||||
import { CtaData } from "../..";
|
||||
import { GenericActionPayload } from "../../../actions/GenericAction";
|
||||
import { GenericWidgetData } from "../Widget";
|
||||
import { ImageFieldData, TextFieldData } from "./TitleWidgetData";
|
||||
|
||||
export interface HeroSectionWidgetData extends GenericWidgetData {
|
||||
title?: TextFieldData;
|
||||
image?: ImageFieldData;
|
||||
backgroundGradient?: string[];
|
||||
gradientOrientation?: string;
|
||||
callout?: CalloutData;
|
||||
}
|
||||
|
||||
export interface HeroSectionWidgetProps {
|
||||
widgetData: HeroSectionWidgetData;
|
||||
widgetStyle?: ViewStyle;
|
||||
handleActions?: (screenActionPayload?: GenericActionPayload) => void;
|
||||
handleClick?: (cta: CtaData) => void;
|
||||
widgetIndex?: number;
|
||||
}
|
||||
|
||||
export interface CalloutData {
|
||||
title?: TextFieldData;
|
||||
calloutStyle?: ViewStyle;
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
import { ViewStyle } from "react-native";
|
||||
import { AnalyticsEvent, CtaData } from "../..";
|
||||
import { GenericActionPayload } from "../../../actions/GenericAction";
|
||||
import { GenericWidgetData } from "../Widget";
|
||||
import { ImageFieldData, TextFieldData } from "./TitleWidgetData";
|
||||
import { GenericActionPayload } from "../../../actions/GenericAction";
|
||||
import { AnalyticsEvent, CtaData } from "../..";
|
||||
|
||||
export interface Column {
|
||||
title: TextFieldData;
|
||||
subtitle: TextFieldData;
|
||||
image?: ImageFieldData;
|
||||
columnStyle?: ViewStyle;
|
||||
}
|
||||
|
||||
@@ -15,16 +16,18 @@ export interface Cell {
|
||||
subtitle?: TextFieldData;
|
||||
image?: ImageFieldData;
|
||||
cta?: CtaData;
|
||||
analyticEvents?: CellAnalyticEvents
|
||||
analyticEvents?: CellAnalyticEvents;
|
||||
action?: GenericActionPayload;
|
||||
cellStyle?: ViewStyle;
|
||||
}
|
||||
|
||||
export interface Row {
|
||||
cells?: Cell[];
|
||||
rowStyle?: ViewStyle;
|
||||
analyticEvents?: CellAnalyticEvents;
|
||||
}
|
||||
|
||||
export interface TableWidgetData extends GenericWidgetData {
|
||||
rowsToDisplay?: number;
|
||||
viewButton? : TextFieldData;
|
||||
viewButton?: TextFieldData;
|
||||
columns?: Column[];
|
||||
rows?: Row[];
|
||||
}
|
||||
@@ -38,7 +41,6 @@ export interface TableWidgetProps {
|
||||
) => void;
|
||||
handleClick?: (cta: CtaData) => void;
|
||||
widgetIndex?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface ColumnsProps {
|
||||
@@ -49,7 +51,10 @@ export interface RowsProps {
|
||||
widgetData?: TableWidgetData;
|
||||
rowsToDisplay?: number;
|
||||
handleClick?: (cta: CtaData) => void;
|
||||
|
||||
handleActions: (
|
||||
value?: any | undefined | null,
|
||||
screenActionPayload?: GenericActionPayload,
|
||||
) => void;
|
||||
}
|
||||
|
||||
export interface CellProps {
|
||||
@@ -57,8 +62,12 @@ export interface CellProps {
|
||||
cell?: Cell;
|
||||
index: number;
|
||||
handleClick?: (cta: CtaData) => void;
|
||||
handleActions: (
|
||||
value?: any | undefined | null,
|
||||
screenActionPayload?: GenericActionPayload,
|
||||
) => void;
|
||||
}
|
||||
|
||||
export interface CellAnalyticEvents{
|
||||
onViewEvent?: AnalyticsEvent
|
||||
export interface CellAnalyticEvents {
|
||||
onViewEvent?: AnalyticsEvent;
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@ export interface TitleWithAssetsWidgetData extends GenericWidgetData {
|
||||
rightIcon?: ImageFieldData;
|
||||
rightLottie?: LottieFieldData;
|
||||
cta?: CtaData;
|
||||
actions?: GenericActionPayload
|
||||
actions?: GenericActionPayload;
|
||||
}
|
||||
|
||||
@@ -18,3 +18,7 @@ export type {
|
||||
RowsProps,
|
||||
CellProps,
|
||||
} from "./TableWidgetData";
|
||||
|
||||
export type {
|
||||
HeroSectionWidgetData
|
||||
} from "./HeroSectionWidgetData"
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
MEMBER_DETAILS_BOTTOM_SHEET,
|
||||
POLICY_AMOUNT_BOTTOM_SHEET,
|
||||
PREMIUM_DETAILS_BOTTOM_SHEET,
|
||||
TITLE_SUBTITLE_WITH_DROPDOWN_BOTTOM_SHEET,
|
||||
TITLE_WITH_FEEDBACK_PILL_BOTTOM_SHEET,
|
||||
TITLE_WITH_LEFT_RIGHT_BUTTONS_BOTTOM_SHEET,
|
||||
TITLE_WITH_STEPS_BOTTOM_SHEET,
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
import { CtaData } from "../interface";
|
||||
import { ModalView } from "../interface/modals/ModalView";
|
||||
import { GenericWidgetData } from "../interface/widgets/Widget";
|
||||
import TitleSubtitleWithDropdownBottomSheet from "../../../components/bottomsheet/title-subtitle-with-dropdown-bottom-sheet/TitleSubtitleWithDropdownBottomSheet";
|
||||
import { MemberDetailBottomSheet } from "../../../components/bottomsheet/member-details-bottom-sheet/MemberDetailsBottomSheet";
|
||||
import { PolicyAmountBottomSheet } from "../../../components/bottomsheet/policy-amount-bottom-sheet/PolicyAmountBottomSheet";
|
||||
import { GenericActionPayload } from "../actions/GenericAction";
|
||||
@@ -29,7 +31,13 @@ export const GetModalView = {
|
||||
) => void,
|
||||
): JSX.Element => {
|
||||
const { modalName, modalData, modalStyle } = modal;
|
||||
return resolveModalView(modalName, modalData, modalStyle, handleModalClick, handleActions);
|
||||
return resolveModalView(
|
||||
modalName,
|
||||
modalData,
|
||||
modalStyle,
|
||||
handleModalClick,
|
||||
handleActions,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -67,6 +75,13 @@ function resolveModalView(
|
||||
handleModalClick={handleModalClick}
|
||||
/>
|
||||
);
|
||||
case TITLE_SUBTITLE_WITH_DROPDOWN_BOTTOM_SHEET:
|
||||
return (
|
||||
<TitleSubtitleWithDropdownBottomSheet
|
||||
bottomSheetData={modalData}
|
||||
handleModalClick={handleModalClick}
|
||||
/>
|
||||
);
|
||||
case MEMBER_DETAILS_BOTTOM_SHEET:
|
||||
return (
|
||||
<MemberDetailBottomSheet
|
||||
@@ -74,7 +89,7 @@ function resolveModalView(
|
||||
handleModalClick={handleModalClick}
|
||||
handleActions={handleActions}
|
||||
/>
|
||||
)
|
||||
);
|
||||
case POLICY_AMOUNT_BOTTOM_SHEET:
|
||||
return (
|
||||
<PolicyAmountBottomSheet
|
||||
@@ -82,16 +97,16 @@ function resolveModalView(
|
||||
handleModalClick={handleModalClick}
|
||||
handleActions={handleActions}
|
||||
/>
|
||||
)
|
||||
case TITLE_WITH_LEFT_RIGHT_BUTTONS_BOTTOM_SHEET:
|
||||
return (
|
||||
<TitleWithLeftRightButtonsBottomSheet
|
||||
bottomSheetData={modalData}
|
||||
handleModalClick={handleModalClick}
|
||||
handleActions={handleActions}
|
||||
/>
|
||||
)
|
||||
);
|
||||
case TITLE_WITH_LEFT_RIGHT_BUTTONS_BOTTOM_SHEET:
|
||||
return (
|
||||
<TitleWithLeftRightButtonsBottomSheet
|
||||
bottomSheetData={modalData}
|
||||
handleModalClick={handleModalClick}
|
||||
handleActions={handleActions}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return <View />;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ const BaseScreen: React.FC<{ navigation: any; route: any }> = ({
|
||||
const [screenName, setScreenName] = useState<string | null>(null);
|
||||
const [screenKey, setScreenKey] = useState<string | null>(null);
|
||||
const [screenState, setScreenState] = useState<ScreenState | null>(
|
||||
ScreenState.LOADING
|
||||
ScreenState.LOADING,
|
||||
);
|
||||
const [errorMetaData, setErrorMetaData] = useState<ActionMetaData[] | null>(
|
||||
null
|
||||
null,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -69,7 +69,7 @@ const BaseScreen: React.FC<{ navigation: any; route: any }> = ({
|
||||
if (isScreenWhiteListedForCaching(screenName)) {
|
||||
retrieveScreenDataFromCache(
|
||||
getScreenNameFromCtaData(route.params?.ctaData)!!,
|
||||
route.params?.ctaData?.screenKey
|
||||
route.params?.ctaData?.screenKey,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -79,11 +79,11 @@ const BaseScreen: React.FC<{ navigation: any; route: any }> = ({
|
||||
|
||||
const retrieveScreenDataFromCache = (
|
||||
screenName: string | null | undefined,
|
||||
screenKey: string | null | undefined
|
||||
screenKey: string | null | undefined,
|
||||
) => {
|
||||
let cacheKey = getCacheKey(screenName, screenKey);
|
||||
if (!!cacheKey) {
|
||||
getScreenDataFromCache(cacheKey).then((screenData) => {
|
||||
getScreenDataFromCache(cacheKey).then(screenData => {
|
||||
if (!!screenData) {
|
||||
setScreenData(screenData);
|
||||
}
|
||||
@@ -105,16 +105,18 @@ const BaseScreen: React.FC<{ navigation: any; route: any }> = ({
|
||||
dispatch(updateCtaData({ cta: ctaData, setScreenState: screenState }));
|
||||
}
|
||||
}, [route.params.ctaData, screenState]);
|
||||
|
||||
|
||||
const handleActions = (actionPayload?: GenericActionPayload) => {
|
||||
actionPayload?.metaData?.forEach((ActionMetaData) => {
|
||||
actionPayload?.metaData?.forEach(ActionMetaData => {
|
||||
if (!!ActionMetaData.analyticsEventProperties) {
|
||||
sendAsAnalyticsEvent(ActionMetaData.analyticsEventProperties);
|
||||
}
|
||||
if (ActionMetaData.actionType === WidgetActionTypes.OPEN_BOTTOM_SHEET) {
|
||||
addBottomSheet(ActionMetaData.data as ModalView);
|
||||
}
|
||||
if(ActionMetaData.actionType === WidgetActionTypes.REPLACE_BOTTOM_SHEET) {
|
||||
if (
|
||||
ActionMetaData.actionType === WidgetActionTypes.REPLACE_BOTTOM_SHEET
|
||||
) {
|
||||
replaceBottomSheet(ActionMetaData.data as ModalView);
|
||||
}
|
||||
});
|
||||
@@ -136,12 +138,13 @@ const BaseScreen: React.FC<{ navigation: any; route: any }> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const { bottomsheet, addBottomSheet, replaceBottomSheet } = useBottomSheet(handleActions);
|
||||
const { bottomsheet, addBottomSheet, replaceBottomSheet } =
|
||||
useBottomSheet(handleActions);
|
||||
|
||||
const MemoizedScreenMapper = useMemo(() => {
|
||||
const secondIdentifier = getScreenMapperNameFromCtaData(cta);
|
||||
setCurrentScreenName(
|
||||
"RN_" + secondIdentifier?.toUpperCase() + "_" + screenName
|
||||
"RN_" + secondIdentifier?.toUpperCase() + "_" + screenName,
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -207,6 +207,25 @@ export const ScreenActionHandler = {
|
||||
);
|
||||
});
|
||||
}
|
||||
case ScreenActionTypes.FETCH_BENEFIT_COMPARE_LIST: {
|
||||
return get<ApiResponse<CtaData>>(
|
||||
"market-benefit-compare",
|
||||
getXTargetHeaderInfo(GI.toLocaleUpperCase()),
|
||||
)
|
||||
.then(response => {
|
||||
handleResponseData(setScreenData, response);
|
||||
return;
|
||||
})
|
||||
.catch(error => {
|
||||
handleErrorData(
|
||||
error,
|
||||
setScreenData,
|
||||
screenMetaData,
|
||||
AnalyticsMethodNameConstant.MARKET_BENEFIT_COMPARE_LIST,
|
||||
ScreenActionTypes.FETCH_BENEFIT_COMPARE_LIST,
|
||||
);
|
||||
});
|
||||
}
|
||||
case ScreenActionTypes.SHOW_LOADER: {
|
||||
const updatedScreenData: ScreenData = {
|
||||
...screenData,
|
||||
|
||||
@@ -4,5 +4,6 @@ export const ScreenActionTypes = {
|
||||
FETCH_QUOTE_V3: "FETCH_QUOTE_V3",
|
||||
FETCH_QUOTE_V4: "FETCH_QUOTE_V4",
|
||||
SHOW_LOADER: "SHOW_LOADER",
|
||||
FETCH_BENEFIT_COMPARE_LIST: "FETCH_BENEFIT_COMPARE_LIST",
|
||||
FETCH_COMPARE_PLAN_LIST: "FETCH_COMPARE_PLAN_LIST",
|
||||
};
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import { View } from "react-native";
|
||||
import {
|
||||
QuoteOfferScreen,
|
||||
QuoteApologyScreen,
|
||||
ComparePlanScreen,
|
||||
MarketBenefitCompareScreen,
|
||||
QuoteApologyScreen,
|
||||
QuoteOfferScreen,
|
||||
} from "../../../Container/Navi-Insurance";
|
||||
import { GenericActionPayload } from "../../actions/GenericAction";
|
||||
import {
|
||||
QUOTE_OFFER_SCREEN,
|
||||
BUY_INSURANCE_SCREEN,
|
||||
QUOTE_APOLOGY_SCREEN,
|
||||
COMPARE_PLAN_SCREEN,
|
||||
MARKET_BENEFITS_COMPARE_SCREEN,
|
||||
QUOTE_APOLOGY_SCREEN,
|
||||
QUOTE_OFFER_SCREEN,
|
||||
} from "../../constants";
|
||||
import { logToSentry } from "../../hooks/useSentryLogging";
|
||||
import { CtaData } from "../../interface";
|
||||
@@ -42,6 +44,14 @@ export const GIScreenMapper = {
|
||||
handleActions={handleActions}
|
||||
/>
|
||||
);
|
||||
case MARKET_BENEFITS_COMPARE_SCREEN:
|
||||
return (
|
||||
<MarketBenefitCompareScreen
|
||||
ctaData={ctaData}
|
||||
screenData={screenData}
|
||||
handleActions={handleActions}
|
||||
/>
|
||||
);
|
||||
case COMPARE_PLAN_SCREEN:
|
||||
return (
|
||||
<ComparePlanScreen
|
||||
|
||||
@@ -11,6 +11,7 @@ const styles = StyleSheet.create({
|
||||
borderTopRightRadius: 8,
|
||||
borderTopLeftRadius: 8,
|
||||
overflow: "hidden",
|
||||
maxHeight: "90%",
|
||||
},
|
||||
|
||||
barContainer: {
|
||||
|
||||
@@ -7,5 +7,5 @@ export const WidgetActionTypes = {
|
||||
REPLACE_BOTTOM_SHEET: "REPLACE_BOTTOM_SHEET",
|
||||
SHOW_LOADER: "SHOW_LOADER",
|
||||
FINAL_PATCH_CALL: "FINAL_PATCH_CALL",
|
||||
ANALYTIC_ACTION: "ANALYTIC_ACTION"
|
||||
ANALYTIC_ACTION: "ANALYTIC_ACTION",
|
||||
};
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
import { View, ViewStyle } from "react-native";
|
||||
import {
|
||||
SelectCardWithDetailListWidget,
|
||||
TableWidget,
|
||||
TitleWithAssetBackgroundWidget,
|
||||
HeroSectionWidget
|
||||
} from "../../../components/widgets";
|
||||
import ComparisonWidget from "../../../components/widgets/ComparisonWidget";
|
||||
import HeaderLottieAnimationWidget from "../../../components/widgets/HeaderLottieAnimationWidget";
|
||||
import HeaderWithAssetsWidget from "../../../components/widgets/HeaderWithAssetsWidget";
|
||||
import SliderWidget from "../../../components/widgets/SliderWidget";
|
||||
import TitleWithAssetsWidget from "../../../components/widgets/TitleWithAssetsWidget";
|
||||
import CardWithIconWidget from "../../../components/widgets/card-with-icon-widget/CardWithIconWidget";
|
||||
import FAB from "../../../components/widgets/fab/FAB";
|
||||
import FooterWithCardWidget from "../../../components/widgets/footer-with-card-widget/FooterWithCardWidget";
|
||||
import GridWithCardWidget from "../../../components/widgets/grid-with-card-widget/GridWithCardWidget";
|
||||
import SpacerWidget from "../../../components/widgets/spacer-widget/SpacerWidget";
|
||||
import SumInsuredWidget from "../../../components/widgets/sum-insured-carousel-widget/SumInsuredWidget";
|
||||
import TitleSubtitleWithAssetWidget from "../../../components/widgets/title-subtitle-with-asset-widget/TitleSubtitleWithAssetWidget";
|
||||
import TitleWidget from "../../../components/widgets/title-widget/TitleWidget";
|
||||
import { TitleWithColumnWidget } from "../../../components/widgets/title-with-column-widget/TitleWithColumnWidget";
|
||||
import TitleWithListWidget from "../../../components/widgets/title-with-list-widget/TitleWithListWidget";
|
||||
import SpacerWidget from "../../../components/widgets/spacer-widget/SpacerWidget";
|
||||
import { GenericActionPayload } from "../actions/GenericAction";
|
||||
import {
|
||||
CARD_WITH_ICON_WIDGET,
|
||||
@@ -21,29 +29,23 @@ import {
|
||||
GRID_WITH_CARD_WIDGET,
|
||||
HEADER_LOTTIE_ANIMATION_WIDGET,
|
||||
HEADER_WITH_ASSETS_WIDGET,
|
||||
HERO_SECTION_WIDGET,
|
||||
SELECT_CARD_WITH_DETAIL_LIST_WIDGET,
|
||||
SLIDER_WIDGET,
|
||||
SPACER_WIDGET,
|
||||
SUM_INSURED_WIDGET,
|
||||
TABLE_WIDGET,
|
||||
TITLE_SUBTITLE_WITH_ASSET_WIDGET,
|
||||
TITLE_WIDGET,
|
||||
TITLE_WITH_ASSETS_WIDGET,
|
||||
TITLE_WITH_ASSET_BACKGROUND_WIDGET,
|
||||
TITLE_WITH_COLUMN_WIDGET,
|
||||
TITLE_WITH_LIST_WIDGET,
|
||||
SELECT_CARD_WITH_DETAIL_LIST_WIDGET,
|
||||
TABLE_WIDGET,
|
||||
} from "../constants";
|
||||
import { CtaData } from "../interface";
|
||||
import { GenericWidgetData, Widget } from "../interface/widgets/Widget";
|
||||
import { SumInsuredWidgetData } from "../interface/widgets/widgetData/SumInsuredWidgetData";
|
||||
import { ScreenState } from "../screen/BaseScreen";
|
||||
import { TitleWithColumnWidget } from "../../../components/widgets/title-with-column-widget/TitleWithColumnWidget";
|
||||
import CardWithIconWidget from "../../../components/widgets/card-with-icon-widget/CardWithIconWidget";
|
||||
import {
|
||||
SelectCardWithDetailListWidget,
|
||||
TableWidget,
|
||||
TitleWithAssetBackgroundWidget,
|
||||
} from "../../../components/widgets";
|
||||
|
||||
export const GetWidgetView = {
|
||||
getWidget: (
|
||||
@@ -271,6 +273,17 @@ function resolveWidgetView(
|
||||
handleClick={handleClick}
|
||||
/>
|
||||
);
|
||||
case HERO_SECTION_WIDGET:
|
||||
return (
|
||||
<HeroSectionWidget
|
||||
widgetData={widgetData}
|
||||
widgetStyle={widgetStyle}
|
||||
handleActions={handleActions}
|
||||
widgetIndex={widgetIndex}
|
||||
key={widgetIndex}
|
||||
handleClick={handleClick}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return <View />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user