38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { Dispatch, SetStateAction } from "react";
|
|
import { AnalyticsEvent, CtaData } from "../interface";
|
|
import { ScreenData } from "../interface/widgets/screenData/ScreenData";
|
|
import { ScreenState } from "../screen/BaseScreen";
|
|
|
|
export interface GenericActionPayload {
|
|
baseActionType?: string;
|
|
type?: string; // type is used for analytics seggregations and also screen level API call or handling seggregation
|
|
metaData?: ActionMetaData[];
|
|
ctaData?: CtaData;
|
|
setScreenData?: Dispatch<SetStateAction<ScreenData | null>>;
|
|
setScreenState?: Dispatch<SetStateAction<ScreenState | null>>;
|
|
setErrorMetaData?: Dispatch<SetStateAction<ActionMetaData[] | null>>;
|
|
screenData?: ScreenData | null;
|
|
}
|
|
|
|
export interface ActionMetaData {
|
|
actionType?: string;
|
|
// 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 {
|
|
targetWidgetId?: string;
|
|
keyPath?: string;
|
|
newValue?: any;
|
|
valueType: string;
|
|
widgetId?: string;
|
|
actionId?: string;
|
|
}
|
|
|
|
export const BaseActionTypes = {
|
|
SCREEN_ACTION: "SCREEN_ACTION",
|
|
WIDGET_ACTION: "WIDGET_ACTION",
|
|
ANALYTICS_EVENT_ACTION: "CLICKSTREAM_ACTION",
|
|
}; |