diff --git a/packages/botonic-react/src/components/index.ts b/packages/botonic-react/src/components/index.ts index 02eb3c787..3613996c2 100644 --- a/packages/botonic-react/src/components/index.ts +++ b/packages/botonic-react/src/components/index.ts @@ -31,4 +31,10 @@ export { WhatsappCTAUrlButtonProps, } from './whatsapp-cta-url-button' export { WhatsappProduct } from './whatsapp-product' +export { + ProductItem, + WhatsappProductList, + WhatsappProductListProps, + WhatsappProductListSection, +} from './whatsapp-product-list' export { WhatsappTemplate } from './whatsapp-template' diff --git a/packages/botonic-react/src/components/whatsapp-product-list.tsx b/packages/botonic-react/src/components/whatsapp-product-list.tsx new file mode 100644 index 000000000..cf5ecdf7f --- /dev/null +++ b/packages/botonic-react/src/components/whatsapp-product-list.tsx @@ -0,0 +1,55 @@ +import { INPUT } from '@botonic/core' +import React from 'react' + +import { renderComponent } from '../util/react' +import { Message } from './message' + +export interface ProductItem { + product_retailer_id: string +} + +export interface WhatsappProductListSection { + title: string + product_items: ProductItem[] +} + +export interface WhatsappProductListProps { + body: string + header: string + catalogId: string + sections: WhatsappProductListSection[] + footer?: string +} + +const serialize = (message: string) => { + return { text: message } +} + +export const WhatsappProductList = (props: WhatsappProductListProps) => { + const renderBrowser = () => { + // Return a dummy message for browser + const message = `WhatsApp Product List would be sent to the user.` + return ( + + {message} + + ) + } + + const renderNode = () => { + return ( + // @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'. + + ) + } + + return renderComponent({ renderBrowser, renderNode }) +}