@open-condo/ui
Version:
A set of React UI components for developing applications inside the condo ecosystem
86 lines • 3.17 kB
TypeScript
import React from 'react';
type AnalyticsEvent = 'click' | 'check' | 'change';
type CommonComponentProps = {
id?: string;
};
type ComponentSpecificClickEventProps = {
Banner: {
title: string;
};
Button: {
value: string;
type: string;
};
IconButton: {
value?: string;
};
'Typography.Link': {
value: string;
href?: string;
};
Dropdown: {
optionValue: string;
optionKey?: string;
optionKeyPath?: Array<string>;
triggerValue?: string;
};
Card: {
title: string;
accent?: boolean;
};
TourStep: {
title: string;
message?: string;
step: number;
};
};
type ComponentSpecificCheckEventProps = {
Radio: {
value: string;
};
Checkbox: {
value: string;
};
};
type ComponentSpecificChangeEventProps = {
Tabs: {
activeKey: string;
};
Steps: {
activeStep: number;
};
Select: {
value: string | Array<string>;
label: string | Array<string>;
};
Switch: {
checked: boolean;
};
TourStep: {
title: string;
message?: string;
step: number;
};
};
type ComponentNames = {
click: keyof ComponentSpecificClickEventProps;
check: keyof ComponentSpecificCheckEventProps;
change: keyof ComponentSpecificChangeEventProps;
};
type AnyComponentName = ComponentNames[AnalyticsEvent];
type CommonAnalyticsProps<Event extends AnalyticsEvent, Component extends AnyComponentName> = {
event: Event;
location: string;
component: Component;
} & CommonComponentProps;
type AnalyticsClickEventParams<Component extends ComponentNames['click']> = CommonAnalyticsProps<'click', Component> & ComponentSpecificClickEventProps[Component];
type AnalyticsCheckEventParams<Component extends ComponentNames['check']> = CommonAnalyticsProps<'check', Component> & ComponentSpecificCheckEventProps[Component];
type AnalyticsChangeEventParams<Component extends ComponentNames['change']> = CommonAnalyticsProps<'change', Component> & ComponentSpecificChangeEventProps[Component];
export type AnalyticsParams = AnalyticsClickEventParams<ComponentNames['click']> | AnalyticsCheckEventParams<ComponentNames['check']> | AnalyticsChangeEventParams<ComponentNames['change']>;
export declare const ANALYTICS_HANDLER_NAME = "CondoWebSendAnalyticsEvent";
export declare function extractChildrenContent(children: React.ReactNode | React.ReactInstance): string | null;
export declare function sendAnalyticsClickEvent<Component extends ComponentNames['click']>(component: Component, data: ComponentSpecificClickEventProps[Component] & CommonComponentProps): void;
export declare function sendAnalyticsCheckEvent<Component extends ComponentNames['check']>(component: Component, data: ComponentSpecificCheckEventProps[Component] & CommonComponentProps): void;
export declare function sendAnalyticsChangeEvent<Component extends ComponentNames['change']>(component: Component, data: ComponentSpecificChangeEventProps[Component] & CommonComponentProps): void;
export {};
//# sourceMappingURL=analytics.d.ts.map