@vamlabs/vam-chatbot 0.1.57 → 0.1.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
37
37
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
38
38
 
39
39
  "use strict";
40
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom/client */ \"./node_modules/react-dom/client.js\");\n/* harmony import */ var _Chatbot__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Chatbot */ \"./Chatbot.jsx\");\n/* harmony import */ var bootstrap_icons_font_bootstrap_icons_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! bootstrap-icons/font/bootstrap-icons.css */ \"./node_modules/bootstrap-icons/font/bootstrap-icons.css\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\n\nlet globalSheets = null;\n\n// function to add the global style sheets to the context of the shadow root element\nfunction getGlobalStyleSheets() {\n if (globalSheets === null) {\n globalSheets = Array.from(document.styleSheets).map(x => {\n let id = x?.ownerNode?.id;\n const sheet = new CSSStyleSheet();\n if (id === \"chatbot-styles\") {\n const css = Array.from(x.cssRules).map(rule => {\n return rule.cssText;\n }).join(\" \");\n sheet.replaceSync(css);\n }\n return sheet;\n });\n }\n return globalSheets;\n}\nfunction addGlobalStylesToShadowRoot(shadowRoot) {\n shadowRoot.adoptedStyleSheets.push(...getGlobalStyleSheets());\n}\n\n// Function to fetch Bootstrap CSS\nasync function fetchBootstrapCSS() {\n const bootstrapResponse = await fetch(\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\");\n const bootstrapCSS = await bootstrapResponse.text();\n return [bootstrapCSS];\n}\nclass WebComponent extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({\n mode: \"open\"\n });\n this.root = null; // Store the root instance\n this.addGtmScript();\n this.loadStylesAndRender();\n addGlobalStylesToShadowRoot(this.shadowRoot);\n }\n async loadStylesAndRender() {\n const [bootstrapCSS] = await fetchBootstrapCSS();\n\n // TODO: here the styles are applied to :root inside the shadow dom, but there is not root there.\n // We need to apply the variables on the :host/topmost class level rather than :root.\n const modifiedBootstrapCSS = bootstrapCSS.replace(/:root/g, \":host\");\n\n // Create a style element for Bootstrap styles\n const bootstrapStyleElement = document.createElement(\"style\");\n bootstrapStyleElement.textContent = modifiedBootstrapCSS;\n this.shadowRoot.appendChild(bootstrapStyleElement);\n\n // Render the React component\n this.render();\n }\n addGtmScript() {\n const head = document.createElement(\"head\");\n const script = document.createElement(\"script\");\n script.textContent = `\n (function (w, d, s, l, i) {\n w[l] = w[l] || [];\n w[l].push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n var f = d.getElementsByTagName(s)[0],\n j = d.createElement(s),\n dl = l != \"dataLayer\" ? \"&l=\" + l : \"\";\n j.async = true;\n j.src = \"https://www.googletagmanager.com/gtm.js?id=\" + i + dl;\n f.parentNode.insertBefore(j, f);\n })(window, document, \"script\", \"dataLayer\", \"GTM-KQ6MGQQ5\");\n `;\n\n // Append the script to the head\n head.appendChild(script);\n\n // Append the head to the document\n this.shadowRoot.appendChild(head);\n }\n\n // Function to push data to GTM data layer\n pushToDataLayer(data) {\n if (window.dataLayer) {\n window.dataLayer.push(data);\n } else {\n console.error(\"GTM data layer not available\");\n }\n }\n\n // Example method to send data to GTM\n sendDataToGTM(dataLayerObject) {\n const customData = {\n ...dataLayerObject,\n event: \"bot_click\",\n clientId: this.getAttribute(\"client-id\")\n };\n this.pushToDataLayer(customData);\n }\n connectedCallback() {\n if (!this.root) {\n this.root = react_dom_client__WEBPACK_IMPORTED_MODULE_1__.createRoot(this.shadowRoot);\n }\n this.render();\n }\n disconnectedCallback() {\n if (this.root) {\n this.root.unmount();\n }\n }\n static get observedAttributes() {\n return [\"client-id\"];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue !== newValue) {\n this.render();\n }\n }\n render() {\n const clientId = this.getAttribute(\"client-id\");\n if (this.root) {\n this.root.render(/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_Chatbot__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n clientId: clientId,\n onTrackEvent: dataLayerObject => this.sendDataToGTM(dataLayerObject)\n }));\n }\n }\n}\ncustomElements.define(\"vam-chatbot\", WebComponent);\n\n//# sourceURL=webpack://VamChatbot/./WebComponent.js?");
40
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom/client */ \"./node_modules/react-dom/client.js\");\n/* harmony import */ var _Chatbot__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Chatbot */ \"./Chatbot.jsx\");\n/* harmony import */ var bootstrap_icons_font_bootstrap_icons_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! bootstrap-icons/font/bootstrap-icons.css */ \"./node_modules/bootstrap-icons/font/bootstrap-icons.css\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\n\nlet globalSheets = null;\n\n// function to add the global style sheets to the context of the shadow root element\nfunction getGlobalStyleSheets() {\n if (globalSheets === null) {\n globalSheets = Array.from(document.styleSheets).map(x => {\n let id = x?.ownerNode?.id;\n const sheet = new CSSStyleSheet();\n if (id === \"chatbot-styles\") {\n const css = Array.from(x.cssRules).map(rule => {\n return rule.cssText;\n }).join(\" \");\n sheet.replaceSync(css);\n }\n return sheet;\n });\n }\n return globalSheets;\n}\nfunction addGlobalStylesToShadowRoot(shadowRoot) {\n shadowRoot.adoptedStyleSheets.push(...getGlobalStyleSheets());\n}\n\n// Function to fetch Bootstrap CSS\nasync function fetchBootstrapCSS() {\n const bootstrapResponse = await fetch(\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\");\n const bootstrapCSS = await bootstrapResponse.text();\n return [bootstrapCSS];\n}\nclass WebComponent extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({\n mode: \"open\"\n });\n this.root = null; // Store the root instance\n this.loadStylesAndRender();\n addGlobalStylesToShadowRoot(this.shadowRoot);\n }\n async loadStylesAndRender() {\n const [bootstrapCSS] = await fetchBootstrapCSS();\n\n // TODO: here the styles are applied to :root inside the shadow dom, but there is not root there.\n // We need to apply the variables on the :host/topmost class level rather than :root.\n const modifiedBootstrapCSS = bootstrapCSS.replace(/:root/g, \":host\");\n\n // Create a style element for Bootstrap styles\n const bootstrapStyleElement = document.createElement(\"style\");\n bootstrapStyleElement.textContent = modifiedBootstrapCSS;\n this.shadowRoot.appendChild(bootstrapStyleElement);\n\n // Render the React component\n this.render();\n }\n addGtmScript() {\n const gtmId = this.getAttribute(\"gtm-id\");\n if (!gtmId) {\n console.error(\"Chatbot GTM ID missing!\");\n return;\n }\n const head = document.createElement(\"head\");\n const script = document.createElement(\"script\");\n script.textContent = `\n (function (w, d, s, l, i) {\n w[l] = w[l] || [];\n w[l].push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n var f = d.getElementsByTagName(s)[0],\n j = d.createElement(s),\n dl = l != \"dataLayer\" ? \"&l=\" + l : \"\";\n j.async = true;\n j.src = \"https://www.googletagmanager.com/gtm.js?id=\" + i + dl;\n f.parentNode.insertBefore(j, f);\n })(window, document, \"script\", \"dataLayer\", \"${gtmId}\");\n `;\n\n // Append the script to the head\n head.appendChild(script);\n\n // Append the head to the document\n this.shadowRoot.appendChild(head);\n }\n\n // Function to push data to GTM data layer\n pushToDataLayer(data) {\n if (window.dataLayer) {\n window.dataLayer.push(data);\n } else {\n console.error(\"GTM data layer not available\");\n }\n }\n\n // Example method to send data to GTM\n sendDataToGTM(dataLayerObject) {\n const customData = {\n ...dataLayerObject,\n event: \"bot_click\",\n clientId: this.getAttribute(\"client-id\")\n };\n this.pushToDataLayer(customData);\n }\n connectedCallback() {\n if (!this.root) {\n this.root = react_dom_client__WEBPACK_IMPORTED_MODULE_1__.createRoot(this.shadowRoot);\n }\n this.addGtmScript();\n this.render();\n }\n disconnectedCallback() {\n if (this.root) {\n this.root.unmount();\n }\n }\n static get observedAttributes() {\n return [\"client-id\", \"gtm-id\"];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue !== newValue) {\n this.render();\n }\n }\n render() {\n const clientId = this.getAttribute(\"client-id\");\n if (this.root) {\n this.root.render(/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_Chatbot__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n clientId: clientId,\n onTrackEvent: dataLayerObject => this.sendDataToGTM(dataLayerObject)\n }));\n }\n }\n}\ncustomElements.define(\"vam-chatbot\", WebComponent);\n\n//# sourceURL=webpack://VamChatbot/./WebComponent.js?");
41
41
 
42
42
  /***/ }),
43
43
 
@@ -52,17 +52,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
52
52
 
53
53
  /***/ }),
54
54
 
55
- /***/ "./components/Carousal.jsx":
56
- /*!*********************************!*\
57
- !*** ./components/Carousal.jsx ***!
58
- \*********************************/
59
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
60
-
61
- "use strict";
62
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _Carousal_module_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Carousal.module.css */ \"./components/Carousal.module.css\");\n/* harmony import */ var framer_motion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! framer-motion */ \"./node_modules/framer-motion/dist/es/components/LazyMotion/index.mjs\");\n/* harmony import */ var framer_motion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! framer-motion */ \"./node_modules/framer-motion/dist/es/render/dom/features-animation.mjs\");\n/* harmony import */ var framer_motion__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! framer-motion */ \"./node_modules/framer-motion/dist/es/render/components/m/proxy.mjs\");\n/* harmony import */ var _utils_variants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/variants */ \"./utils/variants.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\nfunction Carousal(_ref) {\n let {\n images = []\n } = _ref;\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(framer_motion__WEBPACK_IMPORTED_MODULE_3__.LazyMotion, {\n features: framer_motion__WEBPACK_IMPORTED_MODULE_4__.domAnimation,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(framer_motion__WEBPACK_IMPORTED_MODULE_5__.m.div, {\n id: \"carousel-container\",\n className: \"carousel slide w-100\"\n // data-bs-ride=\"carousel\"\n ,\n initial: \"hide\",\n whileInView: \"show\",\n viewport: {\n once: true\n },\n variants: _utils_variants__WEBPACK_IMPORTED_MODULE_1__.chatbotImageVariants,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"div\", {\n className: `carousel-inner ${_Carousal_module_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].carousalInner}`,\n children: [images[0]].map((image, index) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"div\", {\n className: `carousel-item d-flex ${index === 0 ? \"active\" : \"\"} ${_Carousal_module_css__WEBPACK_IMPORTED_MODULE_0__[\"default\"].carousalItem}`,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(\"img\", {\n src: image,\n className: \"d-block w-100 object-fit-contain\",\n alt: \"carousal item\"\n })\n }, `carousal-item-${index}`))\n })\n })\n });\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Carousal);\n\n//# sourceURL=webpack://VamChatbot/./components/Carousal.jsx?");
63
-
64
- /***/ }),
65
-
66
55
  /***/ "./components/ChatbotBody.jsx":
67
56
  /*!************************************!*\
68
57
  !*** ./components/ChatbotBody.jsx ***!
@@ -103,7 +92,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
103
92
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
104
93
 
105
94
  "use strict";
106
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var marked__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! marked */ \"./node_modules/marked/lib/marked.esm.js\");\n/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dompurify */ \"./node_modules/dompurify/dist/purify.js\");\n/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Chatbot.module.css */ \"./Chatbot.module.css\");\n/* harmony import */ var _Carousal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Carousal */ \"./components/Carousal.jsx\");\n/* harmony import */ var _SourceList__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SourceList */ \"./components/SourceList.jsx\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _Typewriter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Typewriter */ \"./components/Typewriter.jsx\");\n/* harmony import */ var _PromotedTopics__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./PromotedTopics */ \"./components/PromotedTopics.jsx\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\n\n\n\n\n\nconst markdownToHtml = markdown => {\n let htmlResponse = \"\";\n dompurify__WEBPACK_IMPORTED_MODULE_1___default().addHook(\"afterSanitizeAttributes\", function (node) {\n // set all elements owning target to target=_blank\n if (\"target\" in node) {\n node.setAttribute(\"target\", \"_blank\");\n node.setAttribute(\"rel\", \"noopener noreferrer\");\n }\n });\n try {\n htmlResponse = dompurify__WEBPACK_IMPORTED_MODULE_1___default().sanitize(marked__WEBPACK_IMPORTED_MODULE_0__.marked.parse(markdown));\n } catch (error) {\n console.log(error);\n }\n return htmlResponse;\n};\nfunction MessageCore(_ref) {\n let {\n chatbotIcon,\n messageText,\n messageReferenceLinks,\n messageImageLinks,\n messageSource,\n messageStatus,\n promotedTopics,\n typewriterEffect\n } = _ref;\n let messageProps = {};\n if (messageSource === \"user\") {\n messageProps.backgroundColor = \"var(--chatbot-user-bubble-color)\";\n } else if (messageSource === \"bot\") {\n messageProps.backgroundColor = \"var(--chatbot-bot-bubble-color)\";\n } else if (messageSource === \"error\") {\n messageProps.justifyDirection = \"center\";\n }\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"div\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].message,\n style: {\n color: messageSource === \"error\" ? \"red\" : \"\",\n justifyContent: messageProps?.justifyDirection,\n flexDirection: messageSource === \"user\" ? \"row-reverse\" : \"\"\n },\n children: [messageSource === \"user\" ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"i\", {\n className: \"bi bi-person-circle\",\n style: {\n color: \"var(--chatbot-user-icon-color)\"\n }\n }) : messageSource === \"bot\" ? chatbotIcon && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"img\", {\n src: chatbotIcon,\n alt: \"chatbot icon\",\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].chatbotIcon\n }) : \"\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"div\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].messageBody,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(\"div\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].messageText,\n style: {\n backgroundColor: messageProps.backgroundColor,\n color: messageSource === \"error\" ? \"red\" : messageSource === \"user\" ? \"var(--chatbot-user-text-color)\" : \"var(--chatbot-bot-text-color)\"\n },\n children: [typewriterEffect ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_Typewriter__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n text: markdownToHtml(messageText)\n }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(\"span\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].markdownToHtmlContainer,\n dangerouslySetInnerHTML: {\n __html: markdownToHtml(messageText)\n }\n }), messageStatus === \"done\" && promotedTopics?.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_PromotedTopics__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n data: promotedTopics\n }), messageStatus === \"done\" && messageReferenceLinks?.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_SourceList__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n sources: messageReferenceLinks\n }), messageImageLinks?.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_Carousal__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n images: messageImageLinks\n })]\n })\n })]\n });\n}\n\n// wrap the component in useMemo() to re-render\n// only the latest Message when streaming response\nconst Message = _ref2 => {\n let {\n chatbotIcon,\n messageText,\n messageReferenceLinks,\n messageImageLinks,\n messageSource,\n messageStatus,\n promotedTopics,\n typewriterEffect\n } = _ref2;\n return (0,react__WEBPACK_IMPORTED_MODULE_5__.useMemo)(() => {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(MessageCore, {\n chatbotIcon: chatbotIcon,\n messageText: messageText,\n messageReferenceLinks: messageReferenceLinks,\n messageImageLinks: messageImageLinks,\n messageSource: messageSource,\n messageStatus: messageStatus,\n promotedTopics: promotedTopics,\n typewriterEffect: typewriterEffect\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messageText, messageStatus, chatbotIcon]);\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Message);\n\n//# sourceURL=webpack://VamChatbot/./components/Message.jsx?");
95
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var marked__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! marked */ \"./node_modules/marked/lib/marked.esm.js\");\n/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dompurify */ \"./node_modules/dompurify/dist/purify.js\");\n/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Chatbot.module.css */ \"./Chatbot.module.css\");\n/* harmony import */ var _SourceList__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SourceList */ \"./components/SourceList.jsx\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _Typewriter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Typewriter */ \"./components/Typewriter.jsx\");\n/* harmony import */ var _PromotedTopics__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./PromotedTopics */ \"./components/PromotedTopics.jsx\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n// import Carousal from \"./Carousal\";\n\n\n\n\n\nconst markdownToHtml = markdown => {\n let htmlResponse = \"\";\n dompurify__WEBPACK_IMPORTED_MODULE_1___default().addHook(\"afterSanitizeAttributes\", function (node) {\n // set all elements owning target to target=_blank\n if (\"target\" in node) {\n node.setAttribute(\"target\", \"_blank\");\n node.setAttribute(\"rel\", \"noopener noreferrer\");\n }\n });\n try {\n htmlResponse = dompurify__WEBPACK_IMPORTED_MODULE_1___default().sanitize(marked__WEBPACK_IMPORTED_MODULE_0__.marked.parse(markdown));\n } catch (error) {\n console.log(error);\n }\n return htmlResponse;\n};\nfunction MessageCore(_ref) {\n let {\n chatbotIcon,\n messageText,\n messageReferenceLinks,\n messageImageLinks,\n messageSource,\n messageStatus,\n promotedTopics,\n typewriterEffect\n } = _ref;\n let messageProps = {};\n if (messageSource === \"user\") {\n messageProps.backgroundColor = \"var(--chatbot-user-bubble-color)\";\n } else if (messageSource === \"bot\") {\n messageProps.backgroundColor = \"var(--chatbot-bot-bubble-color)\";\n } else if (messageSource === \"error\") {\n messageProps.justifyDirection = \"center\";\n }\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].message,\n style: {\n color: messageSource === \"error\" ? \"red\" : \"\",\n justifyContent: messageProps?.justifyDirection,\n flexDirection: messageSource === \"user\" ? \"row-reverse\" : \"\"\n },\n children: [messageSource === \"user\" ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"i\", {\n className: \"bi bi-person-circle\",\n style: {\n color: \"var(--chatbot-user-icon-color)\"\n }\n }) : messageSource === \"bot\" ? chatbotIcon && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"img\", {\n src: chatbotIcon,\n alt: \"chatbot icon\",\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].chatbotIcon\n }) : \"\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].messageBody,\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].messageText,\n style: {\n backgroundColor: messageProps.backgroundColor,\n color: messageSource === \"error\" ? \"red\" : messageSource === \"user\" ? \"var(--chatbot-user-text-color)\" : \"var(--chatbot-bot-text-color)\"\n },\n children: [typewriterEffect ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_Typewriter__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n text: markdownToHtml(messageText)\n }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"span\", {\n className: _Chatbot_module_css__WEBPACK_IMPORTED_MODULE_2__[\"default\"].markdownToHtmlContainer,\n dangerouslySetInnerHTML: {\n __html: markdownToHtml(messageText)\n }\n }), messageStatus === \"done\" && promotedTopics?.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_PromotedTopics__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n data: promotedTopics\n }), messageStatus === \"done\" && messageReferenceLinks?.length > 0 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_SourceList__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n sources: messageReferenceLinks\n })]\n })\n })]\n });\n}\n\n// wrap the component in useMemo() to re-render\n// only the latest Message when streaming response\nconst Message = _ref2 => {\n let {\n chatbotIcon,\n messageText,\n messageReferenceLinks,\n messageImageLinks,\n messageSource,\n messageStatus,\n promotedTopics,\n typewriterEffect\n } = _ref2;\n return (0,react__WEBPACK_IMPORTED_MODULE_4__.useMemo)(() => {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(MessageCore, {\n chatbotIcon: chatbotIcon,\n messageText: messageText,\n messageReferenceLinks: messageReferenceLinks,\n messageImageLinks: messageImageLinks,\n messageSource: messageSource,\n messageStatus: messageStatus,\n promotedTopics: promotedTopics,\n typewriterEffect: typewriterEffect\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [messageText, messageStatus, chatbotIcon]);\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Message);\n\n//# sourceURL=webpack://VamChatbot/./components/Message.jsx?");
107
96
 
108
97
  /***/ }),
109
98
 
@@ -250,17 +239,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
250
239
 
251
240
  /***/ }),
252
241
 
253
- /***/ "./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./components/Carousal.module.css":
254
- /*!**********************************************************************************************************!*\
255
- !*** ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./components/Carousal.module.css ***!
256
- \**********************************************************************************************************/
257
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
258
-
259
- "use strict";
260
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n// Imports\n\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.bM7UYUIV67pDU1mIqhBb {\n border-radius: 10px;\n}\n\n.FCedTtDmiTfcKbb9XOGz {\n max-height: 24rem;\n}\n`, \"\"]);\n// Exports\n___CSS_LOADER_EXPORT___.locals = {\n\t\"carousalInner\": `bM7UYUIV67pDU1mIqhBb`,\n\t\"carousalItem\": `FCedTtDmiTfcKbb9XOGz`\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://VamChatbot/./components/Carousal.module.css?./node_modules/css-loader/dist/cjs.js??ruleSet%5B1%5D.rules%5B1%5D.use%5B1%5D");
261
-
262
- /***/ }),
263
-
264
242
  /***/ "./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./components/PromotedTopics.module.css":
265
243
  /*!****************************************************************************************************************!*\
266
244
  !*** ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./components/PromotedTopics.module.css ***!
@@ -601,17 +579,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
601
579
 
602
580
  /***/ }),
603
581
 
604
- /***/ "./components/Carousal.module.css":
605
- /*!****************************************!*\
606
- !*** ./components/Carousal.module.css ***!
607
- \****************************************/
608
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
609
-
610
- "use strict";
611
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ \"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleDomAPI.js */ \"./node_modules/style-loader/dist/runtime/styleDomAPI.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertBySelector.js */ \"./node_modules/style-loader/dist/runtime/insertBySelector.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithAttributesAndNonce_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/setAttributesWithAttributesAndNonce.js */ \"./node_modules/style-loader/dist/runtime/setAttributesWithAttributesAndNonce.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithAttributesAndNonce_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_setAttributesWithAttributesAndNonce_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertStyleElement.js */ \"./node_modules/style-loader/dist/runtime/insertStyleElement.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleTagTransform.js */ \"./node_modules/style-loader/dist/runtime/styleTagTransform.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_Carousal_module_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./Carousal.module.css */ \"./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./components/Carousal.module.css\");\n\n \n \n \n \n \n \n \n \n \n\nvar options = {\"attributes\":{\"id\":\"chatbot-styles\"}};\n\noptions.styleTagTransform = (_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());\noptions.setAttributes = (_node_modules_style_loader_dist_runtime_setAttributesWithAttributesAndNonce_js__WEBPACK_IMPORTED_MODULE_3___default());\noptions.insert = _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, \"head\");\noptions.domAPI = (_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());\noptions.insertStyleElement = (_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_Carousal_module_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"], options);\n\n\n\n\n /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_Carousal_module_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"] && _node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_Carousal_module_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals ? _node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_Carousal_module_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals : undefined);\n\n\n//# sourceURL=webpack://VamChatbot/./components/Carousal.module.css?");
612
-
613
- /***/ }),
614
-
615
582
  /***/ "./components/PromotedTopics.module.css":
616
583
  /*!**********************************************!*\
617
584
  !*** ./components/PromotedTopics.module.css ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vamlabs/vam-chatbot",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "main": "dist/web-component.js",
5
5
  "description": "VAM Chatbot Web Component",
6
6
  "files": [