@@ -9,7 +9,7 @@ import { IterableEmbeddedNotification } from './IterableEmbeddedNotification';
99/**
1010 * The props for the IterableEmbeddedView component.
1111 */
12- interface IterableEmbeddedViewProps extends IterableEmbeddedComponentProps {
12+ export interface IterableEmbeddedViewProps extends IterableEmbeddedComponentProps {
1313 /** The type of view to render. */
1414 viewType : IterableEmbeddedViewType ;
1515}
@@ -20,10 +20,62 @@ interface IterableEmbeddedViewProps extends IterableEmbeddedComponentProps {
2020 * @param message - The message to render.
2121 * @param config - The config for the IterableEmbeddedView component, most likely used to style the view.
2222 * @param onButtonClick - The function to call when a button is clicked.
23+ * @param onMessageClick - The function to call when the message is clicked.
2324 * @returns The IterableEmbeddedView component.
2425 *
2526 * This component is used to render pre-created, customizable message displays
2627 * included with Iterables RN SDK: cards, banners, and notifications.
28+ *
29+ * @example
30+ * ```tsx
31+ * // See `IterableEmbeddedViewType`` for available view types.
32+ * const viewType = IterableEmbeddedViewType.Card;
33+ *
34+ * // The message object that will be rendered.
35+ * // You can retrieve messages by calling `Iterable.embeddedManager.getMessages(IDS)`
36+ * const message = {
37+ * metadata: {
38+ * messageId: 'test-message-123',
39+ * campaignId: 123456,
40+ * placementId: 'test-placement',
41+ * },
42+ * elements: {
43+ * title: 'Test Title',
44+ * body: 'Test Body',
45+ * buttons: [
46+ * { id: 'button-1', label: 'Button 1', action: 'button-1-action' },
47+ * { id: 'button-2', label: 'Button 2', action: 'button-2-action' },
48+ * ],
49+ * },
50+ * };
51+ *
52+ * // The config for the IterableEmbeddedView component, most likely used to style the view.
53+ * // See `IterableEmbeddedViewConfig` for available config options.
54+ * const config = { backgroundColor: '#FFFFFF', borderRadius: 8 };
55+ *
56+ * // A callback that will be called when a button is clicked.
57+ * // General click handling is handled by the SDK; This is only for custom logic.
58+ * const onButtonClick = () => {
59+ * console.log('Button clicked');
60+ * };
61+ *
62+ * // A callback that will be called when the message is clicked.
63+ * // This is not called when a button is clicked.
64+ * // If a default action is set, this is what will be called.
65+ * const onMessageClick = () => {
66+ * console.log('Message clicked');
67+ * };
68+ *
69+ * return (
70+ * <IterableEmbeddedView
71+ * viewType={viewType}
72+ * message={message}
73+ * config={config}
74+ * onButtonClick={onButtonClick}
75+ * onMessageClick={onMessageClick}
76+ * />
77+ * );
78+ * ```
2779 */
2880export const IterableEmbeddedView = ( {
2981 viewType,
0 commit comments