productCardDefinition top-level property
Implementation
final productCardDefinition = BlockDefinition(
name: 'ProductCard',
builder: (context, props) => ProductCard(
title: '${props['title'] ?? props['name'] ?? 'Product'}',
description: props['description']?.toString(),
imageUrl: props['imageUrl']?.toString() ?? props['image']?.toString(),
price: props['price']?.toString(),
badges: (props['badges'] as List?)?.map((item) => '$item').toList() ?? const [],
meta: (props['meta'] as List?)?.map((item) => '$item').toList() ?? const [],
primaryActionId: props['primaryActionId']?.toString(),
primaryActionLabel: props['primaryActionLabel']?.toString(),
),
allowedPlacements: const [BlockPlacement.chat, BlockPlacement.zone],
interventionEligible: true,
interventionType: BlockInterventionType.decisionSupport,
);