@hhgtech/hhg-components
Version:
Hello Health Group common components
75 lines (74 loc) • 2.38 kB
TypeScript
import { ReactNode } from 'react';
import { Category } from "../together/interfaces/types";
import { LOCALE, UserInfo } from "../types";
import { LEADGEN_LAYOUT } from "./LeadGen.helpers";
import { LeadGenBlock, LeadGenFormProps } from "./LeadGenForm";
export type LeadGenFormValue = Record<string, any>;
export type LeadGenExtraPayload = {
key: string;
value: string;
control: string;
};
export type LeadGenProps = {
campaign_code?: string;
forceCampaign?: any;
apiSsoUrl?: string;
apiLeadUrl?: string;
apiSubotUrl?: string;
locale?: LOCALE;
siteId?: string;
siteDomain?: string;
extraValues?: LeadGenFormValue;
extraPayloadValues?: LeadGenExtraPayload[];
userInfo?: UserInfo | null;
onFinish?: (value: LeadGenFormValue, metaValue?: {
blocks?: LeadGenBlock[];
isUpdateSso?: boolean;
}) => void;
articleId?: number;
categoryId?: number | string;
categoryList?: Array<Category>;
};
export type LeadGenComponentProps = LeadGenFormProps & {
loading?: boolean;
visible?: boolean;
onVisible?: (visible: boolean) => void;
banner?: string | ReactNode;
icon?: string | ReactNode;
title?: string | ReactNode;
description?: string | ReactNode;
buttonText?: string;
};
export type LeadGenSubscriptionBoxProps = Omit<LeadGenFormProps, 'className' | 'style'> & {
loading?: boolean;
image?: string;
title?: string | ReactNode;
submitText?: string;
desktopBanner?: string;
mobileBanner?: string;
buttonTextColor?: string;
buttonColor?: string;
isBannerStyle?: boolean;
subscriptionPhoneType?: string;
};
export type TrackingFormProps = {
formRef?: HTMLFormElement;
formValues?: Record<string, any>;
formActiveTime?: number;
listBlockAdded?: any;
type?: 'impression' | 'close' | 'redirects' | 'submit_form';
preventTrackingClose?: boolean;
};
export type TrackingFormParams = {
commonData: {
cookie_id: string;
ga_client_id: string;
campaign_id: string;
total_fields: number;
status: 'complete' | 'in_progress';
country_code: string;
type: 'close' | 'submit_form' | 'impression' | 'redirects';
};
currentLayout: LEADGEN_LAYOUT;
formParams: TrackingFormProps;
};