@botonic/react
Version:
Build Chatbots using React
22 lines • 1.13 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { INPUT } from '@botonic/core';
import { toSnakeCaseKeys } from '../util/functional';
import { renderComponent } from '../util/react';
import { Message } from './message';
const serialize = (message) => {
return { text: message };
};
export const WhatsappProductList = (props) => {
const renderBrowser = () => {
// Return a dummy message for browser
const message = `WhatsApp Product List would be sent to the user.`;
return (_jsx(Message, Object.assign({ json: serialize(message) }, props, { type: INPUT.TEXT }, { children: message })));
};
const renderNode = () => {
return (
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
_jsx("message", Object.assign({}, props, { body: props.body, footer: props.footer, header: props.header, sections: JSON.stringify(toSnakeCaseKeys(props.sections)), catalogId: props.catalogId, type: INPUT.WHATSAPP_PRODUCT_LIST })));
};
return renderComponent({ renderBrowser, renderNode });
};
//# sourceMappingURL=whatsapp-product-list.js.map