diff --git a/src/models/constructor-items/common.ts b/src/models/constructor-items/common.ts index 6f8c8fea6..8f92481c6 100644 --- a/src/models/constructor-items/common.ts +++ b/src/models/constructor-items/common.ts @@ -383,7 +383,10 @@ export interface PriceDetailsProps { items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[]; } -export interface PriceItemProps extends PriceDetailsProps, PriceDescriptionProps {} +export interface PriceItemProps + extends PriceDetailsProps, + PriceDescriptionProps, + AnalyticsEventsBase {} export interface PriceFoldableDetailsProps { title: string; diff --git a/src/models/constructor-items/sub-blocks.ts b/src/models/constructor-items/sub-blocks.ts index 27b827f6b..75ddfb11a 100644 --- a/src/models/constructor-items/sub-blocks.ts +++ b/src/models/constructor-items/sub-blocks.ts @@ -100,6 +100,7 @@ export interface QuoteProps extends Themable, CardBaseProps { export interface BackgroundCardProps extends CardBaseProps, + AnalyticsEventsBase, Omit { url?: string; background?: ThemeSupporting; @@ -109,6 +110,7 @@ export interface BackgroundCardProps export interface BasicCardProps extends CardBaseProps, + AnalyticsEventsBase, Omit { url: string; icon?: ImageProps; @@ -126,9 +128,9 @@ export interface BannerCardProps { button: Pick; } -export interface MediaCardProps extends MediaProps, CardBaseProps {} +export interface MediaCardProps extends MediaProps, AnalyticsEventsBase, CardBaseProps {} -export interface LayoutItemProps extends ClassNameProps { +export interface LayoutItemProps extends ClassNameProps, AnalyticsEventsBase { content: Omit; media: MediaProps; metaInfo?: string[]; diff --git a/src/sub-blocks/BackgroundCard/BackgroundCard.tsx b/src/sub-blocks/BackgroundCard/BackgroundCard.tsx index 72eb30664..b491867a3 100644 --- a/src/sub-blocks/BackgroundCard/BackgroundCard.tsx +++ b/src/sub-blocks/BackgroundCard/BackgroundCard.tsx @@ -23,6 +23,7 @@ const BackgroundCard = (props: BackgroundCardProps) => { theme: cardTheme = 'default', links, buttons, + analyticsEvents, } = props; const theme = useTheme(); @@ -34,6 +35,7 @@ const BackgroundCard = (props: BackgroundCardProps) => { className={b({padding: paddingBottom, theme: cardTheme})} url={url} border={borderType} + analyticsEvents={analyticsEvents} > (
{fullscreen && hasFullscreen(media) ? ( @@ -31,11 +32,12 @@ const LayoutItem = ({ {...media} {...fullscreenMediaProps} className={b('media', {border}, mediaClassName)} + analyticsEvents={analyticsEvents} /> )} ) : ( - + )} {metaInfo && }
diff --git a/src/sub-blocks/LayoutItem/schema.ts b/src/sub-blocks/LayoutItem/schema.ts index 31ef2466f..7f254bbb4 100644 --- a/src/sub-blocks/LayoutItem/schema.ts +++ b/src/sub-blocks/LayoutItem/schema.ts @@ -2,6 +2,7 @@ import {omit} from 'lodash'; import metaInfo from '../../components/MetaInfo/schema'; import {BaseProps, MediaProps} from '../../schema/validators/common'; +import {AnalyticsEventSchema} from '../../schema/validators/event'; import {ContentBase} from '../../sub-blocks/Content/schema'; export const LayoutItem = { @@ -19,5 +20,18 @@ export const LayoutItem = { fullscreen: { type: 'boolean', }, + analyticsEvents: { + oneOf: [ + { + ...AnalyticsEventSchema, + optionName: 'single', + }, + { + type: 'array', + items: AnalyticsEventSchema, + optionName: 'list', + }, + ], + }, }, }; diff --git a/src/sub-blocks/MediaCard/MediaCard.tsx b/src/sub-blocks/MediaCard/MediaCard.tsx index 19624b727..4aa8cd7bc 100644 --- a/src/sub-blocks/MediaCard/MediaCard.tsx +++ b/src/sub-blocks/MediaCard/MediaCard.tsx @@ -8,8 +8,13 @@ import './MediaCard.scss'; const b = block('MediaCard'); -const MediaCard = ({border, ...mediaProps}: MediaCardProps) => ( - +const MediaCard = ({border, analyticsEvents, ...mediaProps}: MediaCardProps) => ( + diff --git a/src/sub-blocks/MediaCard/schema.ts b/src/sub-blocks/MediaCard/schema.ts index 3a046e976..6ec523240 100644 --- a/src/sub-blocks/MediaCard/schema.ts +++ b/src/sub-blocks/MediaCard/schema.ts @@ -1,4 +1,5 @@ import {AnimatableProps, BaseProps, CardBase, MediaProps} from '../../schema/validators/common'; +import {AnalyticsEventSchema} from '../../schema/validators/event'; export const MediaCardBlock = { 'media-card': { @@ -9,6 +10,19 @@ export const MediaCardBlock = { ...CardBase, ...MediaProps, ...AnimatableProps, + analyticsEvents: { + oneOf: [ + { + ...AnalyticsEventSchema, + optionName: 'single', + }, + { + type: 'array', + items: AnalyticsEventSchema, + optionName: 'list', + }, + ], + }, }, }, }; diff --git a/src/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.tsx b/src/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.tsx index d14df3594..df128a12a 100644 --- a/src/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.tsx +++ b/src/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.tsx @@ -6,6 +6,7 @@ import {CardBase} from '../../../components'; import {BREAKPOINTS} from '../../../constants'; import {Col, Grid, GridColumnSize, Row} from '../../../grid'; import { + AnalyticsEventsBase, CardBorder, PriceDescriptionProps, PriceDetailsListProps, @@ -24,7 +25,7 @@ const CombinedPricesGroupSize = { [GridColumnSize.Lg]: 3, }; -interface CombinedPriceDetailedProps { +interface CombinedPriceDetailedProps extends AnalyticsEventsBase { items: PriceItemProps[]; numberGroupItems: number; useMixedView?: boolean; @@ -43,6 +44,7 @@ const CombinedPriceDetailed = (props: CombinedPriceDetailedProps) => { useMixedView, getDescriptionComponent, getDetailsComponent, + analyticsEvents, } = props; const [groupItemsSize, setGroupItemsSize] = useState(numberGroupItems); @@ -103,7 +105,7 @@ const CombinedPriceDetailed = (props: CombinedPriceDetailedProps) => { const chunkedItems = _.chunk(items, groupItemsSize); return ( - + {chunkedItems.map((chunk: PriceItemProps[], id) => { diff --git a/src/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.tsx b/src/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.tsx index 9fcf29d0d..6697fdeb1 100644 --- a/src/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.tsx +++ b/src/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.tsx @@ -28,8 +28,13 @@ const SeparatePriceDetailed = (props: SeparatePriceDetailedProps) => { return ( - {items.map((item: PriceItemProps, id: number) => ( - + {items.map(({analyticsEvents, ...item}: PriceItemProps, id: number) => ( + {getDescriptionComponent(item)} {getDetailsComponent(item.items)} diff --git a/src/sub-blocks/PriceDetailed/schema.ts b/src/sub-blocks/PriceDetailed/schema.ts index 31ed177e1..83d11183c 100644 --- a/src/sub-blocks/PriceDetailed/schema.ts +++ b/src/sub-blocks/PriceDetailed/schema.ts @@ -1,4 +1,5 @@ import {AnimatableProps, BaseProps, textSize} from '../../schema/validators/common'; +import {AnalyticsEventSchema} from '../../schema/validators/event'; import {filteredArray} from '../../schema/validators/utils'; const PriceDetailedDetailsType = ['marked-list', 'settings']; @@ -162,6 +163,19 @@ const PriceItem = { properties: { ...PriceDetailsProps, ...PriceDescriptionProps, + analyticsEvents: { + oneOf: [ + { + ...AnalyticsEventSchema, + optionName: 'single', + }, + { + type: 'array', + items: AnalyticsEventSchema, + optionName: 'list', + }, + ], + }, }, };