@yext/chat-ui-react 0.8.1 → 0.8.3-beta.1

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.
Files changed (30) hide show
  1. package/lib/bundle.css +1 -1
  2. package/lib/commonjs/package.json.js +1 -1
  3. package/lib/commonjs/src/components/ChatPanel.d.ts +9 -2
  4. package/lib/commonjs/src/components/ChatPanel.d.ts.map +1 -1
  5. package/lib/commonjs/src/components/ChatPanel.js +12 -2
  6. package/lib/commonjs/src/components/ChatPanel.js.map +1 -1
  7. package/lib/commonjs/src/components/MessageSuggestions.d.ts +27 -0
  8. package/lib/commonjs/src/components/MessageSuggestions.d.ts.map +1 -0
  9. package/lib/commonjs/src/components/MessageSuggestions.js +35 -0
  10. package/lib/commonjs/src/components/MessageSuggestions.js.map +1 -0
  11. package/lib/commonjs/src/components/index.d.ts +1 -0
  12. package/lib/commonjs/src/components/index.d.ts.map +1 -1
  13. package/lib/esm/index.d.ts +28 -1
  14. package/lib/esm/package.json.mjs +1 -1
  15. package/lib/esm/src/components/ChatPanel.d.ts +9 -2
  16. package/lib/esm/src/components/ChatPanel.d.ts.map +1 -1
  17. package/lib/esm/src/components/ChatPanel.mjs +13 -3
  18. package/lib/esm/src/components/ChatPanel.mjs.map +1 -1
  19. package/lib/esm/src/components/MessageSuggestions.d.ts +27 -0
  20. package/lib/esm/src/components/MessageSuggestions.d.ts.map +1 -0
  21. package/lib/esm/src/components/MessageSuggestions.mjs +29 -0
  22. package/lib/esm/src/components/MessageSuggestions.mjs.map +1 -0
  23. package/lib/esm/src/components/index.d.ts +1 -0
  24. package/lib/esm/src/components/index.d.ts.map +1 -1
  25. package/package.json +9 -4
  26. package/src/components/ChatPanel.tsx +37 -3
  27. package/src/components/MessageSuggestions.tsx +71 -0
  28. package/src/components/index.ts +5 -0
  29. package/src/hooks/index.ts +1 -1
  30. /package/lib/{esm → commonjs}/src/tsdoc-metadata.json +0 -0
package/lib/bundle.css CHANGED
@@ -1 +1 @@
1
- .yext-chat { width: 100%; height: 100%; } /*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/.yext-chat *,.yext-chat :after,.yext-chat :before{box-sizing:border-box;border:0 solid #e5e7eb}.yext-chat :after,.yext-chat :before{--tw-content:""}.yext-chat {line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}.yext-chat {margin:0;line-height:inherit}.yext-chat hr{height:0;color:inherit;border-top-width:1px}.yext-chat abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.yext-chat h1,.yext-chat h2,.yext-chat h3,.yext-chat h4,.yext-chat h5,.yext-chat h6{font-size:inherit;font-weight:inherit}.yext-chat a{color:inherit;text-decoration:inherit}.yext-chat b,.yext-chat strong{font-weight:bolder}.yext-chat code,.yext-chat kbd,.yext-chat pre,.yext-chat samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.yext-chat small{font-size:80%}.yext-chat sub,.yext-chat sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}.yext-chat sub{bottom:-.25em}.yext-chat sup{top:-.5em}.yext-chat table{text-indent:0;border-color:inherit;border-collapse:collapse}.yext-chat button,.yext-chat input,.yext-chat optgroup,.yext-chat select,.yext-chat textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}.yext-chat button,.yext-chat select{text-transform:none}.yext-chat [type=button],.yext-chat [type=reset],.yext-chat [type=submit],.yext-chat button{-webkit-appearance:button;background-color:initial;background-image:none}.yext-chat :-moz-focusring{outline:auto}.yext-chat :-moz-ui-invalid{box-shadow:none}.yext-chat progress{vertical-align:initial}.yext-chat ::-webkit-inner-spin-button,.yext-chat ::-webkit-outer-spin-button{height:auto}.yext-chat [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.yext-chat ::-webkit-search-decoration{-webkit-appearance:none}.yext-chat ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.yext-chat summary{display:list-item}.yext-chat blockquote,.yext-chat dd,.yext-chat dl,.yext-chat figure,.yext-chat h1,.yext-chat h2,.yext-chat h3,.yext-chat h4,.yext-chat h5,.yext-chat h6,.yext-chat hr,.yext-chat p,.yext-chat pre{margin:0}.yext-chat fieldset{margin:0}.yext-chat fieldset,.yext-chat legend{padding:0}.yext-chat menu,.yext-chat ol,.yext-chat ul{list-style:none;margin:0;padding:0}.yext-chat textarea{resize:vertical}.yext-chat input::-moz-placeholder,.yext-chat textarea::-moz-placeholder{opacity:1;color:#9ca3af}.yext-chat input::placeholder,.yext-chat textarea::placeholder{opacity:1;color:#9ca3af}.yext-chat [role=button],.yext-chat button{cursor:pointer}.yext-chat :disabled{cursor:default}.yext-chat audio,.yext-chat canvas,.yext-chat embed,.yext-chat iframe,.yext-chat img,.yext-chat object,.yext-chat svg,.yext-chat video{display:block;vertical-align:middle}.yext-chat img,.yext-chat video{max-width:100%;height:auto}.yext-chat [hidden]{display:none}.yext-chat *,.yext-chat ::backdrop,.yext-chat :after,.yext-chat :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.yext-chat .container{width:100%}@media (min-width:640px){.yext-chat .container{max-width:640px}}@media (min-width:768px){.yext-chat .container{max-width:768px}}@media (min-width:1024px){.yext-chat .container{max-width:1024px}}@media (min-width:1280px){.yext-chat .container{max-width:1280px}}@media (min-width:1536px){.yext-chat .container{max-width:1536px}}.yext-chat .prose{color:var(--tw-prose-body);max-width:65ch}.yext-chat .prose :where(p):not(:where([class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.yext-chat .prose :where([class~=lead]):not(:where([class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.yext-chat .prose :where(a):not(:where([class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.yext-chat .prose :where(strong):not(:where([class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.yext-chat .prose :where(a strong):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(blockquote strong):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(thead th strong):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(ol):not(:where([class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-left:1.625em}.yext-chat .prose :where(ol[type=A]):not(:where([class~=not-prose] *)){list-style-type:upper-alpha}.yext-chat .prose :where(ol[type=a]):not(:where([class~=not-prose] *)){list-style-type:lower-alpha}.yext-chat .prose :where(ol[type=A s]):not(:where([class~=not-prose] *)){list-style-type:upper-alpha}.yext-chat .prose :where(ol[type=a s]):not(:where([class~=not-prose] *)){list-style-type:lower-alpha}.yext-chat .prose :where(ol[type=I]):not(:where([class~=not-prose] *)){list-style-type:upper-roman}.yext-chat .prose :where(ol[type=i]):not(:where([class~=not-prose] *)){list-style-type:lower-roman}.yext-chat .prose :where(ol[type=I s]):not(:where([class~=not-prose] *)){list-style-type:upper-roman}.yext-chat .prose :where(ol[type=i s]):not(:where([class~=not-prose] *)){list-style-type:lower-roman}.yext-chat .prose :where(ol[type="1"]):not(:where([class~=not-prose] *)){list-style-type:decimal}.yext-chat .prose :where(ul):not(:where([class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-left:1.625em}.yext-chat .prose :where(ol>li):not(:where([class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.yext-chat .prose :where(ul>li):not(:where([class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.yext-chat .prose :where(hr):not(:where([class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.yext-chat .prose :where(blockquote):not(:where([class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-left-width:.25rem;border-left-color:var(--tw-prose-quote-borders);quotes:"\201C""\201D""\2018""\2019";margin-top:1.6em;margin-bottom:1.6em;padding-left:1em}.yext-chat .prose :where(blockquote p:first-of-type):not(:where([class~=not-prose] *)):before{content:open-quote}.yext-chat .prose :where(blockquote p:last-of-type):not(:where([class~=not-prose] *)):after{content:close-quote}.yext-chat .prose :where(h1):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.yext-chat .prose :where(h1 strong):not(:where([class~=not-prose] *)){font-weight:900;color:inherit}.yext-chat .prose :where(h2):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.yext-chat .prose :where(h2 strong):not(:where([class~=not-prose] *)){font-weight:800;color:inherit}.yext-chat .prose :where(h3):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.yext-chat .prose :where(h3 strong):not(:where([class~=not-prose] *)){font-weight:700;color:inherit}.yext-chat .prose :where(h4):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.yext-chat .prose :where(h4 strong):not(:where([class~=not-prose] *)){font-weight:700;color:inherit}.yext-chat .prose :where(img):not(:where([class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.yext-chat .prose :where(figure>*):not(:where([class~=not-prose] *)){margin-top:0;margin-bottom:0}.yext-chat .prose :where(figcaption):not(:where([class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.yext-chat .prose :where(code):not(:where([class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.yext-chat .prose :where(code):not(:where([class~=not-prose] *)):before{content:"`"}.yext-chat .prose :where(code):not(:where([class~=not-prose] *)):after{content:"`"}.yext-chat .prose :where(a code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(h1 code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(h2 code):not(:where([class~=not-prose] *)){color:inherit;font-size:.875em}.yext-chat .prose :where(h3 code):not(:where([class~=not-prose] *)){color:inherit;font-size:.9em}.yext-chat .prose :where(h4 code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(blockquote code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(thead th code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(pre):not(:where([class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding:.8571429em 1.1428571em}.yext-chat .prose :where(pre code):not(:where([class~=not-prose] *)){background-color:initial;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.yext-chat .prose :where(pre code):not(:where([class~=not-prose] *)):before{content:none}.yext-chat .prose :where(pre code):not(:where([class~=not-prose] *)):after{content:none}.yext-chat .prose :where(table):not(:where([class~=not-prose] *)){width:100%;table-layout:auto;text-align:left;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.yext-chat .prose :where(thead):not(:where([class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.yext-chat .prose :where(thead th):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.yext-chat .prose :where(tbody tr):not(:where([class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.yext-chat .prose :where(tbody tr:last-child):not(:where([class~=not-prose] *)){border-bottom-width:0}.yext-chat .prose :where(tbody td):not(:where([class~=not-prose] *)){vertical-align:initial}.yext-chat .prose :where(tfoot):not(:where([class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.yext-chat .prose :where(tfoot td):not(:where([class~=not-prose] *)){vertical-align:top}.yext-chat .prose{--tw-prose-body:#374151;--tw-prose-headings:#111827;--tw-prose-lead:#4b5563;--tw-prose-links:#111827;--tw-prose-bold:#111827;--tw-prose-counters:#6b7280;--tw-prose-bullets:#d1d5db;--tw-prose-hr:#e5e7eb;--tw-prose-quotes:#111827;--tw-prose-quote-borders:#e5e7eb;--tw-prose-captions:#6b7280;--tw-prose-code:#111827;--tw-prose-pre-code:#e5e7eb;--tw-prose-pre-bg:#1f2937;--tw-prose-th-borders:#d1d5db;--tw-prose-td-borders:#e5e7eb;--tw-prose-invert-body:#d1d5db;--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:#9ca3af;--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:#9ca3af;--tw-prose-invert-bullets:#4b5563;--tw-prose-invert-hr:#374151;--tw-prose-invert-quotes:#f3f4f6;--tw-prose-invert-quote-borders:#374151;--tw-prose-invert-captions:#9ca3af;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:#d1d5db;--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:#4b5563;--tw-prose-invert-td-borders:#374151;font-size:1rem;line-height:1.75}.yext-chat .prose :where(video):not(:where([class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.yext-chat .prose :where(figure):not(:where([class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.yext-chat .prose :where(li):not(:where([class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.yext-chat .prose :where(ol>li):not(:where([class~=not-prose] *)){padding-left:.375em}.yext-chat .prose :where(ul>li):not(:where([class~=not-prose] *)){padding-left:.375em}.yext-chat .prose :where(.prose>ul>li p):not(:where([class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.yext-chat .prose :where(.prose>ul>li>:first-child):not(:where([class~=not-prose] *)){margin-top:1.25em}.yext-chat .prose :where(.prose>ul>li>:last-child):not(:where([class~=not-prose] *)){margin-bottom:1.25em}.yext-chat .prose :where(.prose>ol>li>:first-child):not(:where([class~=not-prose] *)){margin-top:1.25em}.yext-chat .prose :where(.prose>ol>li>:last-child):not(:where([class~=not-prose] *)){margin-bottom:1.25em}.yext-chat .prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.yext-chat .prose :where(hr+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(h2+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(h3+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(h4+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(thead th:first-child):not(:where([class~=not-prose] *)){padding-left:0}.yext-chat .prose :where(thead th:last-child):not(:where([class~=not-prose] *)){padding-right:0}.yext-chat .prose :where(tbody td,tfoot td):not(:where([class~=not-prose] *)){padding:.5714286em}.yext-chat .prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose] *)){padding-left:0}.yext-chat .prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose] *)){padding-right:0}.yext-chat .prose :where(.prose>:first-child):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(.prose>:last-child):not(:where([class~=not-prose] *)){margin-bottom:0}.yext-chat .invisible{visibility:hidden}.yext-chat .fixed{position:fixed}.yext-chat .absolute{position:absolute}.yext-chat .relative{position:relative}.yext-chat .-right-1{right:-.25rem}.yext-chat .-top-3{top:-.75rem}.yext-chat .bottom-2{bottom:.5rem}.yext-chat .bottom-2\.5{bottom:.625rem}.yext-chat .bottom-6{bottom:1.5rem}.yext-chat .right-4{right:1rem}.yext-chat .top-0{top:0}.yext-chat .z-50{z-index:50}.yext-chat .my-0{margin-top:0;margin-bottom:0}.yext-chat .my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.yext-chat .-mr-8{margin-right:-2rem}.yext-chat .mb-3{margin-bottom:.75rem}.yext-chat .ml-4{margin-left:1rem}.yext-chat .ml-auto{margin-left:auto}.yext-chat .mt-auto{margin-top:auto}.yext-chat .line-clamp-1{-webkit-line-clamp:1}.yext-chat .line-clamp-1,.yext-chat .line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical}.yext-chat .line-clamp-2{-webkit-line-clamp:2}.yext-chat .flex{display:flex}.yext-chat .hidden{display:none}.yext-chat .h-10{height:2.5rem}.yext-chat .h-12{height:3rem}.yext-chat .h-2{height:.5rem}.yext-chat .h-4{height:1rem}.yext-chat .h-5{height:1.25rem}.yext-chat .h-6{height:1.5rem}.yext-chat .h-8{height:2rem}.yext-chat .h-\[22px\]{height:22px}.yext-chat .h-\[26px\]{height:26px}.yext-chat .h-\[28px\]{height:28px}.yext-chat .h-\[75vh\]{height:75vh}.yext-chat .h-fit{height:-moz-fit-content;height:fit-content}.yext-chat .h-full{height:100%}.yext-chat .w-12{width:3rem}.yext-chat .w-2{width:.5rem}.yext-chat .w-4{width:1rem}.yext-chat .w-5{width:1.25rem}.yext-chat .w-6{width:1.5rem}.yext-chat .w-60{width:15rem}.yext-chat .w-8{width:2rem}.yext-chat .w-80{width:20rem}.yext-chat .w-\[22px\]{width:22px}.yext-chat .w-\[26px\]{width:26px}.yext-chat .w-\[28px\]{width:28px}.yext-chat .w-fit{width:-moz-fit-content;width:fit-content}.yext-chat .w-full{width:100%}.yext-chat .max-w-\[80\%\]{max-width:80%}.yext-chat .shrink-0{flex-shrink:0}.yext-chat .translate-y-0{--tw-translate-y:0px}.yext-chat .translate-y-0,.yext-chat .translate-y-\[20\%\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .translate-y-\[20\%\]{--tw-translate-y:20%}.yext-chat .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .animate-\[bounce_1s_infinite\]{animation:bounce 1s infinite}.yext-chat .animate-\[bounce_1s_infinite_0\.3s\]{animation:bounce 1s .3s infinite}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.yext-chat .animate-\[bounce_1s_infinite_0\.6s\]{animation:bounce 1s .6s infinite}@keyframes spin{to{transform:rotate(1turn)}}.yext-chat .animate-\[spin_0\.3s_linear\]{animation:spin .3s linear}@keyframes expand-left{0%{margin-left:100%}to{margin-left:0}}.yext-chat .animate-expand-left{animation:expand-left .5s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.yext-chat .animate-fade-in{animation:fade-in .4s}@keyframes heartbeat{0%{transform:scale(1)}80%{transform:scale(1)}90%{transform:scale(1.1)}to{transform:scale(1)}}.yext-chat .animate-heartbeat{animation:heartbeat 2s ease-out infinite}.yext-chat .cursor-pointer{cursor:pointer}.yext-chat .resize-none{resize:none}.yext-chat .flex-row{flex-direction:row}.yext-chat .flex-col{flex-direction:column}.yext-chat .items-center{align-items:center}.yext-chat .justify-center{justify-content:center}.yext-chat .justify-between{justify-content:space-between}.yext-chat .gap-1{gap:.25rem}.yext-chat .gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.yext-chat .gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.yext-chat .gap-x-2\.5{-moz-column-gap:.625rem;column-gap:.625rem}.yext-chat .gap-y-1{row-gap:.25rem}.yext-chat .overflow-auto{overflow:auto}.yext-chat .overflow-hidden{overflow:hidden}.yext-chat .overflow-x-auto{overflow-x:auto}.yext-chat .truncate{overflow:hidden;text-overflow:ellipsis}.yext-chat .truncate,.yext-chat .whitespace-nowrap{white-space:nowrap}.yext-chat .whitespace-pre-wrap{white-space:pre-wrap}.yext-chat .break-words{overflow-wrap:break-word}.yext-chat .rounded-2xl{border-radius:1rem}.yext-chat .rounded-3xl{border-radius:1.5rem}.yext-chat .rounded-full{border-radius:9999px}.yext-chat .rounded-md{border-radius:.375rem}.yext-chat .rounded-xl{border-radius:.75rem}.yext-chat .rounded-b-3xl{border-bottom-right-radius:1.5rem;border-bottom-left-radius:1.5rem}.yext-chat .rounded-l-full{border-top-left-radius:9999px;border-bottom-left-radius:9999px}.yext-chat .rounded-t-3xl{border-top-left-radius:1.5rem;border-top-right-radius:1.5rem}.yext-chat .border{border-width:1px}.yext-chat .border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}.yext-chat .bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity))}.yext-chat .bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.yext-chat .bg-red-700{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity))}.yext-chat .bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity))}.yext-chat .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.yext-chat .bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.yext-chat .bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.yext-chat .from-blue-600{--tw-gradient-from:#2563eb var(--tw-gradient-from-position);--tw-gradient-to:#2563eb00 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.yext-chat .from-slate-50{--tw-gradient-from:#f8fafc var(--tw-gradient-from-position);--tw-gradient-to:#f8fafc00 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.yext-chat .to-blue-700{--tw-gradient-to:#1d4ed8 var(--tw-gradient-to-position)}.yext-chat .to-blue-800{--tw-gradient-to:#1e40af var(--tw-gradient-to-position)}.yext-chat .to-slate-100{--tw-gradient-to:#f1f5f9 var(--tw-gradient-to-position)}.yext-chat .stroke-2{stroke-width:2}.yext-chat .stroke-\[0\.2\]{stroke-width:.2}.yext-chat .p-1{padding:.25rem}.yext-chat .p-1\.5{padding:.375rem}.yext-chat .p-2{padding:.5rem}.yext-chat .p-2\.5{padding:.625rem}.yext-chat .p-3{padding:.75rem}.yext-chat .p-4{padding:1rem}.yext-chat .px-4{padding-left:1rem;padding-right:1rem}.yext-chat .py-3{padding-top:.75rem;padding-bottom:.75rem}.yext-chat .pl-4{padding-left:1rem}.yext-chat .pr-1{padding-right:.25rem}.yext-chat .pr-12{padding-right:3rem}.yext-chat .pr-3{padding-right:.75rem}.yext-chat .pr-8{padding-right:2rem}.yext-chat .text-\[10px\]{font-size:10px}.yext-chat .text-\[13px\]{font-size:13px}.yext-chat .text-sm{font-size:.875rem;line-height:1.25rem}.yext-chat .text-xl{font-size:1.25rem;line-height:1.75rem}.yext-chat .font-bold{font-weight:700}.yext-chat .font-medium{font-weight:500}.yext-chat .text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.yext-chat .text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity))}.yext-chat .text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity))}.yext-chat .text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}.yext-chat .text-slate-700{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity))}.yext-chat .text-slate-900{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity))}.yext-chat .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.yext-chat .opacity-0{opacity:0}.yext-chat .shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.yext-chat .shadow-2xl,.yext-chat .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.yext-chat .shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.yext-chat .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yext-chat .duration-150,.yext-chat .transition-all{transition-duration:.15s}.yext-chat .duration-200{transition-duration:.2s}.yext-chat .duration-300{transition-duration:.3s}.yext-chat .\@container{container-type:inline-size}.yext-chat .placeholder\:text-\[13px\]::-moz-placeholder{font-size:13px}.yext-chat .placeholder\:text-\[13px\]::placeholder{font-size:13px}.yext-chat .first\:mt-4:first-child{margin-top:1rem}.yext-chat .hover\:-translate-y-2:hover{--tw-translate-y:-0.5rem}.yext-chat .hover\:-translate-y-2:hover,.yext-chat .hover\:scale-110:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .hover\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1}.yext-chat .hover\:bg-blue-800:hover{--tw-bg-opacity:1;background-color:rgb(30 64 175/var(--tw-bg-opacity))}.yext-chat .active\:scale-90:active{--tw-scale-x:.9;--tw-scale-y:.9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .disabled\:bg-slate-200:disabled{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.yext-chat .group:hover .group-hover\:opacity-100,.yext-chat .peer:hover~.peer-hover\:opacity-100{opacity:1}@container (min-width: 32rem){.yext-chat .\@lg\:m-1{margin:.25rem}.yext-chat .\@lg\:ml-0{margin-left:0}.yext-chat .\@lg\:flex-row{flex-direction:row}.yext-chat .\@lg\:flex-row-reverse{flex-direction:row-reverse}.yext-chat .\@lg\:items-center{align-items:center}.yext-chat .\@lg\:gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}}@container (min-width: 480px){.yext-chat .\@\[480px\]\:bottom-3\.5{bottom:.875rem}.yext-chat .\@\[480px\]\:text-\[13px\]{font-size:13px}.yext-chat .\@\[480px\]\:text-base{font-size:1rem;line-height:1.5rem}.yext-chat .placeholder\:\@\[480px\]\:text-base::-moz-placeholder{font-size:1rem;line-height:1.5rem}.yext-chat .placeholder\:\@\[480px\]\:text-base::placeholder{font-size:1rem;line-height:1.5rem}}@media (max-width:480px){.yext-chat .max-\[480px\]\:bottom-0{bottom:0}.yext-chat .max-\[480px\]\:right-0{right:0}.yext-chat .max-\[480px\]\:h-full{height:100%}.yext-chat .max-\[480px\]\:w-full{width:100%}.yext-chat .max-\[480px\]\:rounded-none{border-radius:0}}@media (min-width:1024px){.yext-chat .lg\:bottom-14{bottom:3.5rem}.yext-chat .lg\:right-10{right:2.5rem}.yext-chat .lg\:h-14{height:3.5rem}.yext-chat .lg\:h-16{height:4rem}.yext-chat .lg\:h-6{height:1.5rem}.yext-chat .lg\:h-\[40px\]{height:40px}.yext-chat .lg\:w-16{width:4rem}.yext-chat .lg\:w-6{width:1.5rem}.yext-chat .lg\:w-96{width:24rem}.yext-chat .lg\:w-\[40px\]{width:40px}.yext-chat .lg\:text-base{font-size:1rem;line-height:1.5rem}}
1
+ .yext-chat { width: 100%; height: 100%; } /*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/.yext-chat *,.yext-chat :after,.yext-chat :before{box-sizing:border-box;border:0 solid #e5e7eb}.yext-chat :after,.yext-chat :before{--tw-content:""}.yext-chat {line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}.yext-chat {margin:0;line-height:inherit}.yext-chat hr{height:0;color:inherit;border-top-width:1px}.yext-chat abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.yext-chat h1,.yext-chat h2,.yext-chat h3,.yext-chat h4,.yext-chat h5,.yext-chat h6{font-size:inherit;font-weight:inherit}.yext-chat a{color:inherit;text-decoration:inherit}.yext-chat b,.yext-chat strong{font-weight:bolder}.yext-chat code,.yext-chat kbd,.yext-chat pre,.yext-chat samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.yext-chat small{font-size:80%}.yext-chat sub,.yext-chat sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}.yext-chat sub{bottom:-.25em}.yext-chat sup{top:-.5em}.yext-chat table{text-indent:0;border-color:inherit;border-collapse:collapse}.yext-chat button,.yext-chat input,.yext-chat optgroup,.yext-chat select,.yext-chat textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}.yext-chat button,.yext-chat select{text-transform:none}.yext-chat [type=button],.yext-chat [type=reset],.yext-chat [type=submit],.yext-chat button{-webkit-appearance:button;background-color:initial;background-image:none}.yext-chat :-moz-focusring{outline:auto}.yext-chat :-moz-ui-invalid{box-shadow:none}.yext-chat progress{vertical-align:initial}.yext-chat ::-webkit-inner-spin-button,.yext-chat ::-webkit-outer-spin-button{height:auto}.yext-chat [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.yext-chat ::-webkit-search-decoration{-webkit-appearance:none}.yext-chat ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.yext-chat summary{display:list-item}.yext-chat blockquote,.yext-chat dd,.yext-chat dl,.yext-chat figure,.yext-chat h1,.yext-chat h2,.yext-chat h3,.yext-chat h4,.yext-chat h5,.yext-chat h6,.yext-chat hr,.yext-chat p,.yext-chat pre{margin:0}.yext-chat fieldset{margin:0}.yext-chat fieldset,.yext-chat legend{padding:0}.yext-chat menu,.yext-chat ol,.yext-chat ul{list-style:none;margin:0;padding:0}.yext-chat textarea{resize:vertical}.yext-chat input::-moz-placeholder,.yext-chat textarea::-moz-placeholder{opacity:1;color:#9ca3af}.yext-chat input::placeholder,.yext-chat textarea::placeholder{opacity:1;color:#9ca3af}.yext-chat [role=button],.yext-chat button{cursor:pointer}.yext-chat :disabled{cursor:default}.yext-chat audio,.yext-chat canvas,.yext-chat embed,.yext-chat iframe,.yext-chat img,.yext-chat object,.yext-chat svg,.yext-chat video{display:block;vertical-align:middle}.yext-chat img,.yext-chat video{max-width:100%;height:auto}.yext-chat [hidden]{display:none}.yext-chat *,.yext-chat ::backdrop,.yext-chat :after,.yext-chat :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.yext-chat .container{width:100%}@media (min-width:640px){.yext-chat .container{max-width:640px}}@media (min-width:768px){.yext-chat .container{max-width:768px}}@media (min-width:1024px){.yext-chat .container{max-width:1024px}}@media (min-width:1280px){.yext-chat .container{max-width:1280px}}@media (min-width:1536px){.yext-chat .container{max-width:1536px}}.yext-chat .prose{color:var(--tw-prose-body);max-width:65ch}.yext-chat .prose :where(p):not(:where([class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.yext-chat .prose :where([class~=lead]):not(:where([class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.yext-chat .prose :where(a):not(:where([class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.yext-chat .prose :where(strong):not(:where([class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.yext-chat .prose :where(a strong):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(blockquote strong):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(thead th strong):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(ol):not(:where([class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-left:1.625em}.yext-chat .prose :where(ol[type=A]):not(:where([class~=not-prose] *)){list-style-type:upper-alpha}.yext-chat .prose :where(ol[type=a]):not(:where([class~=not-prose] *)){list-style-type:lower-alpha}.yext-chat .prose :where(ol[type=A s]):not(:where([class~=not-prose] *)){list-style-type:upper-alpha}.yext-chat .prose :where(ol[type=a s]):not(:where([class~=not-prose] *)){list-style-type:lower-alpha}.yext-chat .prose :where(ol[type=I]):not(:where([class~=not-prose] *)){list-style-type:upper-roman}.yext-chat .prose :where(ol[type=i]):not(:where([class~=not-prose] *)){list-style-type:lower-roman}.yext-chat .prose :where(ol[type=I s]):not(:where([class~=not-prose] *)){list-style-type:upper-roman}.yext-chat .prose :where(ol[type=i s]):not(:where([class~=not-prose] *)){list-style-type:lower-roman}.yext-chat .prose :where(ol[type="1"]):not(:where([class~=not-prose] *)){list-style-type:decimal}.yext-chat .prose :where(ul):not(:where([class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-left:1.625em}.yext-chat .prose :where(ol>li):not(:where([class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.yext-chat .prose :where(ul>li):not(:where([class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.yext-chat .prose :where(hr):not(:where([class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.yext-chat .prose :where(blockquote):not(:where([class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-left-width:.25rem;border-left-color:var(--tw-prose-quote-borders);quotes:"\201C""\201D""\2018""\2019";margin-top:1.6em;margin-bottom:1.6em;padding-left:1em}.yext-chat .prose :where(blockquote p:first-of-type):not(:where([class~=not-prose] *)):before{content:open-quote}.yext-chat .prose :where(blockquote p:last-of-type):not(:where([class~=not-prose] *)):after{content:close-quote}.yext-chat .prose :where(h1):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.yext-chat .prose :where(h1 strong):not(:where([class~=not-prose] *)){font-weight:900;color:inherit}.yext-chat .prose :where(h2):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.yext-chat .prose :where(h2 strong):not(:where([class~=not-prose] *)){font-weight:800;color:inherit}.yext-chat .prose :where(h3):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.yext-chat .prose :where(h3 strong):not(:where([class~=not-prose] *)){font-weight:700;color:inherit}.yext-chat .prose :where(h4):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.yext-chat .prose :where(h4 strong):not(:where([class~=not-prose] *)){font-weight:700;color:inherit}.yext-chat .prose :where(img):not(:where([class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.yext-chat .prose :where(figure>*):not(:where([class~=not-prose] *)){margin-top:0;margin-bottom:0}.yext-chat .prose :where(figcaption):not(:where([class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.yext-chat .prose :where(code):not(:where([class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.yext-chat .prose :where(code):not(:where([class~=not-prose] *)):before{content:"`"}.yext-chat .prose :where(code):not(:where([class~=not-prose] *)):after{content:"`"}.yext-chat .prose :where(a code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(h1 code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(h2 code):not(:where([class~=not-prose] *)){color:inherit;font-size:.875em}.yext-chat .prose :where(h3 code):not(:where([class~=not-prose] *)){color:inherit;font-size:.9em}.yext-chat .prose :where(h4 code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(blockquote code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(thead th code):not(:where([class~=not-prose] *)){color:inherit}.yext-chat .prose :where(pre):not(:where([class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding:.8571429em 1.1428571em}.yext-chat .prose :where(pre code):not(:where([class~=not-prose] *)){background-color:initial;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.yext-chat .prose :where(pre code):not(:where([class~=not-prose] *)):before{content:none}.yext-chat .prose :where(pre code):not(:where([class~=not-prose] *)):after{content:none}.yext-chat .prose :where(table):not(:where([class~=not-prose] *)){width:100%;table-layout:auto;text-align:left;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.yext-chat .prose :where(thead):not(:where([class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.yext-chat .prose :where(thead th):not(:where([class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-right:.5714286em;padding-bottom:.5714286em;padding-left:.5714286em}.yext-chat .prose :where(tbody tr):not(:where([class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.yext-chat .prose :where(tbody tr:last-child):not(:where([class~=not-prose] *)){border-bottom-width:0}.yext-chat .prose :where(tbody td):not(:where([class~=not-prose] *)){vertical-align:initial}.yext-chat .prose :where(tfoot):not(:where([class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.yext-chat .prose :where(tfoot td):not(:where([class~=not-prose] *)){vertical-align:top}.yext-chat .prose{--tw-prose-body:#374151;--tw-prose-headings:#111827;--tw-prose-lead:#4b5563;--tw-prose-links:#111827;--tw-prose-bold:#111827;--tw-prose-counters:#6b7280;--tw-prose-bullets:#d1d5db;--tw-prose-hr:#e5e7eb;--tw-prose-quotes:#111827;--tw-prose-quote-borders:#e5e7eb;--tw-prose-captions:#6b7280;--tw-prose-code:#111827;--tw-prose-pre-code:#e5e7eb;--tw-prose-pre-bg:#1f2937;--tw-prose-th-borders:#d1d5db;--tw-prose-td-borders:#e5e7eb;--tw-prose-invert-body:#d1d5db;--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:#9ca3af;--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:#9ca3af;--tw-prose-invert-bullets:#4b5563;--tw-prose-invert-hr:#374151;--tw-prose-invert-quotes:#f3f4f6;--tw-prose-invert-quote-borders:#374151;--tw-prose-invert-captions:#9ca3af;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:#d1d5db;--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:#4b5563;--tw-prose-invert-td-borders:#374151;font-size:1rem;line-height:1.75}.yext-chat .prose :where(video):not(:where([class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.yext-chat .prose :where(figure):not(:where([class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.yext-chat .prose :where(li):not(:where([class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.yext-chat .prose :where(ol>li):not(:where([class~=not-prose] *)){padding-left:.375em}.yext-chat .prose :where(ul>li):not(:where([class~=not-prose] *)){padding-left:.375em}.yext-chat .prose :where(.prose>ul>li p):not(:where([class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.yext-chat .prose :where(.prose>ul>li>:first-child):not(:where([class~=not-prose] *)){margin-top:1.25em}.yext-chat .prose :where(.prose>ul>li>:last-child):not(:where([class~=not-prose] *)){margin-bottom:1.25em}.yext-chat .prose :where(.prose>ol>li>:first-child):not(:where([class~=not-prose] *)){margin-top:1.25em}.yext-chat .prose :where(.prose>ol>li>:last-child):not(:where([class~=not-prose] *)){margin-bottom:1.25em}.yext-chat .prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.yext-chat .prose :where(hr+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(h2+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(h3+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(h4+*):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(thead th:first-child):not(:where([class~=not-prose] *)){padding-left:0}.yext-chat .prose :where(thead th:last-child):not(:where([class~=not-prose] *)){padding-right:0}.yext-chat .prose :where(tbody td,tfoot td):not(:where([class~=not-prose] *)){padding:.5714286em}.yext-chat .prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose] *)){padding-left:0}.yext-chat .prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose] *)){padding-right:0}.yext-chat .prose :where(.prose>:first-child):not(:where([class~=not-prose] *)){margin-top:0}.yext-chat .prose :where(.prose>:last-child):not(:where([class~=not-prose] *)){margin-bottom:0}.yext-chat .invisible{visibility:hidden}.yext-chat .fixed{position:fixed}.yext-chat .absolute{position:absolute}.yext-chat .relative{position:relative}.yext-chat .-right-1{right:-.25rem}.yext-chat .-top-3{top:-.75rem}.yext-chat .bottom-2{bottom:.5rem}.yext-chat .bottom-2\.5{bottom:.625rem}.yext-chat .bottom-6{bottom:1.5rem}.yext-chat .right-4{right:1rem}.yext-chat .top-0{top:0}.yext-chat .z-50{z-index:50}.yext-chat .my-0{margin-top:0;margin-bottom:0}.yext-chat .my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.yext-chat .-mr-8{margin-right:-2rem}.yext-chat .mb-3{margin-bottom:.75rem}.yext-chat .ml-4{margin-left:1rem}.yext-chat .ml-auto{margin-left:auto}.yext-chat .mt-4{margin-top:1rem}.yext-chat .mt-auto{margin-top:auto}.yext-chat .line-clamp-1{-webkit-line-clamp:1}.yext-chat .line-clamp-1,.yext-chat .line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical}.yext-chat .line-clamp-2{-webkit-line-clamp:2}.yext-chat .flex{display:flex}.yext-chat .hidden{display:none}.yext-chat .h-10{height:2.5rem}.yext-chat .h-12{height:3rem}.yext-chat .h-2{height:.5rem}.yext-chat .h-4{height:1rem}.yext-chat .h-5{height:1.25rem}.yext-chat .h-6{height:1.5rem}.yext-chat .h-8{height:2rem}.yext-chat .h-\[22px\]{height:22px}.yext-chat .h-\[26px\]{height:26px}.yext-chat .h-\[28px\]{height:28px}.yext-chat .h-\[75vh\]{height:75vh}.yext-chat .h-fit{height:-moz-fit-content;height:fit-content}.yext-chat .h-full{height:100%}.yext-chat .w-12{width:3rem}.yext-chat .w-2{width:.5rem}.yext-chat .w-4{width:1rem}.yext-chat .w-5{width:1.25rem}.yext-chat .w-6{width:1.5rem}.yext-chat .w-60{width:15rem}.yext-chat .w-8{width:2rem}.yext-chat .w-80{width:20rem}.yext-chat .w-\[22px\]{width:22px}.yext-chat .w-\[26px\]{width:26px}.yext-chat .w-\[28px\]{width:28px}.yext-chat .w-fit{width:-moz-fit-content;width:fit-content}.yext-chat .w-full{width:100%}.yext-chat .max-w-\[80\%\]{max-width:80%}.yext-chat .shrink-0{flex-shrink:0}.yext-chat .translate-y-0{--tw-translate-y:0px}.yext-chat .translate-y-0,.yext-chat .translate-y-\[20\%\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .translate-y-\[20\%\]{--tw-translate-y:20%}.yext-chat .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .animate-\[bounce_1s_infinite\]{animation:bounce 1s infinite}.yext-chat .animate-\[bounce_1s_infinite_0\.3s\]{animation:bounce 1s .3s infinite}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.yext-chat .animate-\[bounce_1s_infinite_0\.6s\]{animation:bounce 1s .6s infinite}@keyframes spin{to{transform:rotate(1turn)}}.yext-chat .animate-\[spin_0\.3s_linear\]{animation:spin .3s linear}@keyframes expand-left{0%{margin-left:100%}to{margin-left:0}}.yext-chat .animate-expand-left{animation:expand-left .5s}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.yext-chat .animate-fade-in{animation:fade-in .4s}@keyframes heartbeat{0%{transform:scale(1)}80%{transform:scale(1)}90%{transform:scale(1.1)}to{transform:scale(1)}}.yext-chat .animate-heartbeat{animation:heartbeat 2s ease-out infinite}.yext-chat .cursor-pointer{cursor:pointer}.yext-chat .resize-none{resize:none}.yext-chat .flex-row{flex-direction:row}.yext-chat .flex-col{flex-direction:column}.yext-chat .flex-wrap{flex-wrap:wrap}.yext-chat .items-center{align-items:center}.yext-chat .justify-center{justify-content:center}.yext-chat .justify-between{justify-content:space-between}.yext-chat .gap-1{gap:.25rem}.yext-chat .gap-2{gap:.5rem}.yext-chat .gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.yext-chat .gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.yext-chat .gap-x-2\.5{-moz-column-gap:.625rem;column-gap:.625rem}.yext-chat .gap-y-1{row-gap:.25rem}.yext-chat .overflow-auto{overflow:auto}.yext-chat .overflow-hidden{overflow:hidden}.yext-chat .overflow-x-auto{overflow-x:auto}.yext-chat .truncate{overflow:hidden;text-overflow:ellipsis}.yext-chat .truncate,.yext-chat .whitespace-nowrap{white-space:nowrap}.yext-chat .whitespace-pre-wrap{white-space:pre-wrap}.yext-chat .break-words{overflow-wrap:break-word}.yext-chat .rounded-2xl{border-radius:1rem}.yext-chat .rounded-3xl{border-radius:1.5rem}.yext-chat .rounded-full{border-radius:9999px}.yext-chat .rounded-md{border-radius:.375rem}.yext-chat .rounded-xl{border-radius:.75rem}.yext-chat .rounded-b-3xl{border-bottom-right-radius:1.5rem;border-bottom-left-radius:1.5rem}.yext-chat .rounded-l-full{border-top-left-radius:9999px;border-bottom-left-radius:9999px}.yext-chat .rounded-t-3xl{border-top-left-radius:1.5rem;border-top-right-radius:1.5rem}.yext-chat .border{border-width:1px}.yext-chat .border-blue-700{--tw-border-opacity:1;border-color:rgb(29 78 216/var(--tw-border-opacity))}.yext-chat .border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}.yext-chat .bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity))}.yext-chat .bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.yext-chat .bg-red-700{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity))}.yext-chat .bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity))}.yext-chat .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.yext-chat .bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.yext-chat .bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.yext-chat .from-blue-600{--tw-gradient-from:#2563eb var(--tw-gradient-from-position);--tw-gradient-to:#2563eb00 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.yext-chat .from-slate-50{--tw-gradient-from:#f8fafc var(--tw-gradient-from-position);--tw-gradient-to:#f8fafc00 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.yext-chat .to-blue-700{--tw-gradient-to:#1d4ed8 var(--tw-gradient-to-position)}.yext-chat .to-blue-800{--tw-gradient-to:#1e40af var(--tw-gradient-to-position)}.yext-chat .to-slate-100{--tw-gradient-to:#f1f5f9 var(--tw-gradient-to-position)}.yext-chat .stroke-2{stroke-width:2}.yext-chat .stroke-\[0\.2\]{stroke-width:.2}.yext-chat .p-1{padding:.25rem}.yext-chat .p-1\.5{padding:.375rem}.yext-chat .p-2{padding:.5rem}.yext-chat .p-2\.5{padding:.625rem}.yext-chat .p-3{padding:.75rem}.yext-chat .p-4{padding:1rem}.yext-chat .px-2{padding-left:.5rem;padding-right:.5rem}.yext-chat .px-4{padding-left:1rem;padding-right:1rem}.yext-chat .py-1{padding-top:.25rem;padding-bottom:.25rem}.yext-chat .py-3{padding-top:.75rem;padding-bottom:.75rem}.yext-chat .pl-4{padding-left:1rem}.yext-chat .pr-1{padding-right:.25rem}.yext-chat .pr-12{padding-right:3rem}.yext-chat .pr-3{padding-right:.75rem}.yext-chat .pr-8{padding-right:2rem}.yext-chat .text-\[10px\]{font-size:10px}.yext-chat .text-\[13px\]{font-size:13px}.yext-chat .text-sm{font-size:.875rem;line-height:1.25rem}.yext-chat .text-xl{font-size:1.25rem;line-height:1.75rem}.yext-chat .font-bold{font-weight:700}.yext-chat .font-medium{font-weight:500}.yext-chat .text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.yext-chat .text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity))}.yext-chat .text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity))}.yext-chat .text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}.yext-chat .text-slate-700{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity))}.yext-chat .text-slate-900{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity))}.yext-chat .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.yext-chat .opacity-0{opacity:0}.yext-chat .shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.yext-chat .shadow-2xl,.yext-chat .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.yext-chat .shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.yext-chat .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yext-chat .duration-150,.yext-chat .transition-all{transition-duration:.15s}.yext-chat .duration-200{transition-duration:.2s}.yext-chat .duration-300{transition-duration:.3s}.yext-chat .\@container{container-type:inline-size}.yext-chat .placeholder\:text-\[13px\]::-moz-placeholder{font-size:13px}.yext-chat .placeholder\:text-\[13px\]::placeholder{font-size:13px}.yext-chat .first\:mt-4:first-child{margin-top:1rem}.yext-chat .hover\:-translate-y-2:hover{--tw-translate-y:-0.5rem}.yext-chat .hover\:-translate-y-2:hover,.yext-chat .hover\:scale-110:hover{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .hover\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1}.yext-chat .hover\:cursor-pointer:hover{cursor:pointer}.yext-chat .hover\:bg-blue-800:hover{--tw-bg-opacity:1;background-color:rgb(30 64 175/var(--tw-bg-opacity))}.yext-chat .hover\:bg-slate-300:hover{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}.yext-chat .hover\:underline:hover{text-decoration-line:underline}.yext-chat .active\:scale-90:active{--tw-scale-x:.9;--tw-scale-y:.9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.yext-chat .disabled\:bg-slate-200:disabled{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.yext-chat .group:hover .group-hover\:opacity-100,.yext-chat .peer:hover~.peer-hover\:opacity-100{opacity:1}@container (min-width: 32rem){.yext-chat .\@lg\:m-1{margin:.25rem}.yext-chat .\@lg\:ml-0{margin-left:0}.yext-chat .\@lg\:flex-row{flex-direction:row}.yext-chat .\@lg\:flex-row-reverse{flex-direction:row-reverse}.yext-chat .\@lg\:items-center{align-items:center}.yext-chat .\@lg\:gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}}@container (min-width: 480px){.yext-chat .\@\[480px\]\:bottom-3\.5{bottom:.875rem}.yext-chat .\@\[480px\]\:text-\[13px\]{font-size:13px}.yext-chat .\@\[480px\]\:text-base{font-size:1rem;line-height:1.5rem}.yext-chat .placeholder\:\@\[480px\]\:text-base::-moz-placeholder{font-size:1rem;line-height:1.5rem}.yext-chat .placeholder\:\@\[480px\]\:text-base::placeholder{font-size:1rem;line-height:1.5rem}}@media (max-width:480px){.yext-chat .max-\[480px\]\:bottom-0{bottom:0}.yext-chat .max-\[480px\]\:right-0{right:0}.yext-chat .max-\[480px\]\:h-full{height:100%}.yext-chat .max-\[480px\]\:w-full{width:100%}.yext-chat .max-\[480px\]\:rounded-none{border-radius:0}}@media (min-width:1024px){.yext-chat .lg\:bottom-14{bottom:3.5rem}.yext-chat .lg\:right-10{right:2.5rem}.yext-chat .lg\:h-14{height:3.5rem}.yext-chat .lg\:h-16{height:4rem}.yext-chat .lg\:h-6{height:1.5rem}.yext-chat .lg\:h-\[40px\]{height:40px}.yext-chat .lg\:w-16{width:4rem}.yext-chat .lg\:w-6{width:1.5rem}.yext-chat .lg\:w-96{width:24rem}.yext-chat .lg\:w-\[40px\]{width:40px}.yext-chat .lg\:text-base{font-size:1rem;line-height:1.5rem}}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.8.1";
3
+ var version = "0.8.3-beta.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.js.map
@@ -1,6 +1,7 @@
1
- import React from "react";
1
+ import React, { ReactNode } from "react";
2
2
  import { MessageBubbleCssClasses, MessageBubbleProps } from "./MessageBubble";
3
3
  import { ChatInputCssClasses, ChatInputProps } from "./ChatInput";
4
+ import { MessageSuggestionCssClasses } from "./MessageSuggestions";
4
5
  /**
5
6
  * The CSS class interface for the {@link ChatPanel} component.
6
7
  *
@@ -13,6 +14,7 @@ export interface ChatPanelCssClasses {
13
14
  inputContainer?: string;
14
15
  inputCssClasses?: ChatInputCssClasses;
15
16
  messageBubbleCssClasses?: MessageBubbleCssClasses;
17
+ messageSuggestionClasses?: MessageSuggestionCssClasses;
16
18
  }
17
19
  /**
18
20
  * The props for the {@link ChatPanel} component.
@@ -21,11 +23,16 @@ export interface ChatPanelCssClasses {
21
23
  */
22
24
  export interface ChatPanelProps extends Omit<MessageBubbleProps, "customCssClasses" | "message">, Omit<ChatInputProps, "customCssClasses"> {
23
25
  /** A header to render at the top of the panel. */
24
- header?: JSX.Element;
26
+ header?: ReactNode;
25
27
  /**
26
28
  * CSS classes for customizing the component styling.
27
29
  */
28
30
  customCssClasses?: ChatPanelCssClasses;
31
+ /**
32
+ * A set of pre-written initial messages that the user
33
+ * can click on instead of typing their own.
34
+ */
35
+ messageSuggestions?: string[];
29
36
  }
30
37
  /**
31
38
  * A component that renders a full panel for chat bot interactions. This includes
@@ -1 +1 @@
1
- {"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAEL,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAa,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAO7E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAeD;;;;GAIG;AACH,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC,EAC9D,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAC1C,kDAAkD;IAClD,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBAkE9C"}
1
+ {"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAa,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM7E,OAAO,EACL,2BAA2B,EAE5B,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAClD,wBAAwB,CAAC,EAAE,2BAA2B,CAAC;CACxD;AAeD;;;;GAIG;AACH,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC,EAC9D,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAC1C,kDAAkD;IAClD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;IACvC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBAoF9C"}
@@ -9,6 +9,7 @@ var useComposedCssClasses = require('../hooks/useComposedCssClasses.js');
9
9
  var useReportAnalyticsEvent = require('../hooks/useReportAnalyticsEvent.js');
10
10
  var withStylelessCssClasses = require('../utils/withStylelessCssClasses.js');
11
11
  var useFetchInitialMessage = require('../hooks/useFetchInitialMessage.js');
12
+ var MessageSuggestions = require('./MessageSuggestions.js');
12
13
 
13
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
15
 
@@ -33,7 +34,7 @@ const builtInCssClasses = withStylelessCssClasses.withStylelessCssClasses("Panel
33
34
  * @param props - {@link ChatPanelProps}
34
35
  */
35
36
  function ChatPanel(props) {
36
- const { header, customCssClasses, stream, handleError } = props;
37
+ const { header, customCssClasses, stream, handleError, messageSuggestions } = props;
37
38
  const messages = chatHeadlessReact.useChatState((state) => state.conversation.messages);
38
39
  const loading = chatHeadlessReact.useChatState((state) => state.conversation.isLoading);
39
40
  const cssClasses = useComposedCssClasses.useComposedCssClasses(builtInCssClasses, customCssClasses);
@@ -44,6 +45,14 @@ function ChatPanel(props) {
44
45
  action: "CHAT_IMPRESSION",
45
46
  });
46
47
  }, [reportAnalyticsEvent]);
48
+ const suggestions = React.useMemo(() => {
49
+ if (messages.length === 0 ||
50
+ (messages.length === 1 && messages[0].source === "BOT")) {
51
+ return messageSuggestions;
52
+ }
53
+ // TODO: Chat API will send suggestions in the message notes eventually; add that here. [CLIP-852]
54
+ return null;
55
+ }, [messages, messageSuggestions]);
47
56
  const messagesRef = React.useRef([]);
48
57
  const messagesContainer = React.useRef(null);
49
58
  // Handle scrolling when messages change
@@ -75,7 +84,8 @@ function ChatPanel(props) {
75
84
  React__default.default.createElement("div", { ref: messagesContainer, className: cssClasses.messagesContainer },
76
85
  messages.map((message, index) => (React__default.default.createElement("div", { key: index, ref: setMessagesRef(index) },
77
86
  React__default.default.createElement(MessageBubble.MessageBubble, { ...props, customCssClasses: cssClasses.messageBubbleCssClasses, message: message })))),
78
- loading && React__default.default.createElement(LoadingDots.LoadingDots, null))),
87
+ loading && React__default.default.createElement(LoadingDots.LoadingDots, null),
88
+ suggestions && (React__default.default.createElement(MessageSuggestions.MessageSuggestions, { suggestions: suggestions, customCssClasses: cssClasses.messageSuggestionClasses })))),
79
89
  React__default.default.createElement("div", { className: cssClasses.inputContainer },
80
90
  React__default.default.createElement(ChatInput.ChatInput, { ...props, customCssClasses: cssClasses.inputCssClasses })))));
81
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatPanel.js","sources":["../../../../src/components/ChatPanel.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { useChatState } from \"@yext/chat-headless-react\";\nimport {\n MessageBubble,\n MessageBubbleCssClasses,\n MessageBubbleProps,\n} from \"./MessageBubble\";\nimport { ChatInput, ChatInputCssClasses, ChatInputProps } from \"./ChatInput\";\nimport { LoadingDots } from \"./LoadingDots\";\nimport { useComposedCssClasses } from \"../hooks\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\nimport { useReportAnalyticsEvent } from \"../hooks/useReportAnalyticsEvent\";\nimport { useFetchInitialMessage } from \"../hooks/useFetchInitialMessage\";\n\n/**\n * The CSS class interface for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelCssClasses {\n container?: string;\n messagesContainer?: string;\n messagesScrollContainer?: string;\n inputContainer?: string;\n inputCssClasses?: ChatInputCssClasses;\n messageBubbleCssClasses?: MessageBubbleCssClasses;\n}\n\nconst builtInCssClasses: ChatPanelCssClasses = withStylelessCssClasses(\n \"Panel\",\n {\n container: \"h-full w-full flex flex-col relative shadow-2xl bg-white\",\n messagesScrollContainer: \"flex flex-col mt-auto overflow-hidden\",\n messagesContainer: \"flex flex-col gap-y-1 px-4 overflow-auto\",\n inputContainer: \"w-full p-4\",\n messageBubbleCssClasses: {\n topContainer: \"first:mt-4\",\n },\n }\n);\n\n/**\n * The props for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelProps\n extends Omit<MessageBubbleProps, \"customCssClasses\" | \"message\">,\n Omit<ChatInputProps, \"customCssClasses\"> {\n /** A header to render at the top of the panel. */\n header?: JSX.Element;\n /**\n * CSS classes for customizing the component styling.\n */\n customCssClasses?: ChatPanelCssClasses;\n}\n\n/**\n * A component that renders a full panel for chat bot interactions. This includes\n * the message bubbles for the conversation, input box with send button, and header\n * (if provided).\n *\n * @public\n *\n * @param props - {@link ChatPanelProps}\n */\nexport function ChatPanel(props: ChatPanelProps) {\n const { header, customCssClasses, stream, handleError } = props;\n const messages = useChatState((state) => state.conversation.messages);\n const loading = useChatState((state) => state.conversation.isLoading);\n const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);\n const reportAnalyticsEvent = useReportAnalyticsEvent();\n useFetchInitialMessage(handleError, stream);\n\n useEffect(() => {\n reportAnalyticsEvent({\n action: \"CHAT_IMPRESSION\",\n });\n }, [reportAnalyticsEvent]);\n\n const messagesRef = useRef<Array<HTMLDivElement | null>>([]);\n const messagesContainer = useRef<HTMLDivElement>(null);\n\n // Handle scrolling when messages change\n useEffect(() => {\n let scrollTop = 0;\n messagesRef.current = messagesRef.current.slice(0, messages.length);\n\n // Sums up scroll heights of all messages except the last one\n if (messagesRef?.current.length > 1) {\n scrollTop = messagesRef.current\n .slice(0, -1)\n .map((elem, _) => elem?.scrollHeight ?? 0)\n .reduce((total, height) => total + height);\n }\n\n // Scroll to the top of the last message\n messagesContainer.current?.scroll({\n top: scrollTop,\n behavior: \"smooth\",\n });\n }, [messages]);\n\n const setMessagesRef = useCallback((index) => {\n if (!messagesRef?.current) return null;\n return (message) => (messagesRef.current[index] = message);\n }, []);\n\n return (\n <div className=\"yext-chat w-full h-full\">\n <div className={cssClasses.container}>\n {header}\n <div className={cssClasses.messagesScrollContainer}>\n <div ref={messagesContainer} className={cssClasses.messagesContainer}>\n {messages.map((message, index) => (\n <div key={index} ref={setMessagesRef(index)}>\n <MessageBubble\n {...props}\n customCssClasses={cssClasses.messageBubbleCssClasses}\n message={message}\n />\n </div>\n ))}\n {loading && <LoadingDots />}\n </div>\n </div>\n <div className={cssClasses.inputContainer}>\n <ChatInput {...props} customCssClasses={cssClasses.inputCssClasses} />\n </div>\n </div>\n </div>\n );\n}\n"],"names":["withStylelessCssClasses","useChatState","useComposedCssClasses","useReportAnalyticsEvent","useFetchInitialMessage","useEffect","useRef","useCallback","React","MessageBubble","LoadingDots","ChatInput"],"mappings":";;;;;;;;;;;;;;;;AA4BA,MAAM,iBAAiB,GAAwBA,+CAAuB,CACpE,OAAO,EACP;AACE,IAAA,SAAS,EAAE,0DAA0D;AACrE,IAAA,uBAAuB,EAAE,uCAAuC;AAChE,IAAA,iBAAiB,EAAE,0CAA0C;AAC7D,IAAA,cAAc,EAAE,YAAY;AAC5B,IAAA,uBAAuB,EAAE;AACvB,QAAA,YAAY,EAAE,YAAY;AAC3B,KAAA;AACF,CAA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K,EACT,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,EACpD,OAAO,EAAE,OAAO,EAChB,CAAA,CACE,CACP,CAAC;AACD,oBAAA,OAAO,IAAID,sBAAA,CAAA,aAAA,CAACE,uBAAW,EAAA,IAAA,CAAG,CACvB,CACF;AACN,YAAAF,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,cAAc,EAAA;AACvC,gBAAAA,sBAAA,CAAA,aAAA,CAACG,mBAAS,EAAA,EAAA,GAAK,KAAK,EAAE,gBAAgB,EAAE,UAAU,CAAC,eAAe,EAAI,CAAA,CAClE,CACF,CACF,EACN;AACJ;;;;"}
1
+ {"version":3,"file":"ChatPanel.js","sources":["../../../../src/components/ChatPanel.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { useChatState } from \"@yext/chat-headless-react\";\nimport {\n MessageBubble,\n MessageBubbleCssClasses,\n MessageBubbleProps,\n} from \"./MessageBubble\";\nimport { ChatInput, ChatInputCssClasses, ChatInputProps } from \"./ChatInput\";\nimport { LoadingDots } from \"./LoadingDots\";\nimport { useComposedCssClasses } from \"../hooks\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\nimport { useReportAnalyticsEvent } from \"../hooks/useReportAnalyticsEvent\";\nimport { useFetchInitialMessage } from \"../hooks/useFetchInitialMessage\";\nimport {\n MessageSuggestionCssClasses,\n MessageSuggestions,\n} from \"./MessageSuggestions\";\n\n/**\n * The CSS class interface for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelCssClasses {\n container?: string;\n messagesContainer?: string;\n messagesScrollContainer?: string;\n inputContainer?: string;\n inputCssClasses?: ChatInputCssClasses;\n messageBubbleCssClasses?: MessageBubbleCssClasses;\n messageSuggestionClasses?: MessageSuggestionCssClasses;\n}\n\nconst builtInCssClasses: ChatPanelCssClasses = withStylelessCssClasses(\n \"Panel\",\n {\n container: \"h-full w-full flex flex-col relative shadow-2xl bg-white\",\n messagesScrollContainer: \"flex flex-col mt-auto overflow-hidden\",\n messagesContainer: \"flex flex-col gap-y-1 px-4 overflow-auto\",\n inputContainer: \"w-full p-4\",\n messageBubbleCssClasses: {\n topContainer: \"first:mt-4\",\n },\n }\n);\n\n/**\n * The props for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelProps\n extends Omit<MessageBubbleProps, \"customCssClasses\" | \"message\">,\n Omit<ChatInputProps, \"customCssClasses\"> {\n /** A header to render at the top of the panel. */\n header?: ReactNode;\n /**\n * CSS classes for customizing the component styling.\n */\n customCssClasses?: ChatPanelCssClasses;\n /**\n * A set of pre-written initial messages that the user\n * can click on instead of typing their own.\n */\n messageSuggestions?: string[];\n}\n\n/**\n * A component that renders a full panel for chat bot interactions. This includes\n * the message bubbles for the conversation, input box with send button, and header\n * (if provided).\n *\n * @public\n *\n * @param props - {@link ChatPanelProps}\n */\nexport function ChatPanel(props: ChatPanelProps) {\n const { header, customCssClasses, stream, handleError, messageSuggestions } =\n props;\n const messages = useChatState((state) => state.conversation.messages);\n const loading = useChatState((state) => state.conversation.isLoading);\n const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);\n const reportAnalyticsEvent = useReportAnalyticsEvent();\n useFetchInitialMessage(handleError, stream);\n\n useEffect(() => {\n reportAnalyticsEvent({\n action: \"CHAT_IMPRESSION\",\n });\n }, [reportAnalyticsEvent]);\n\n const suggestions = useMemo(() => {\n if (\n messages.length === 0 ||\n (messages.length === 1 && messages[0].source === \"BOT\")\n ) {\n return messageSuggestions;\n }\n // TODO: Chat API will send suggestions in the message notes eventually; add that here. [CLIP-852]\n return null;\n }, [messages, messageSuggestions]);\n\n const messagesRef = useRef<Array<HTMLDivElement | null>>([]);\n const messagesContainer = useRef<HTMLDivElement>(null);\n\n // Handle scrolling when messages change\n useEffect(() => {\n let scrollTop = 0;\n messagesRef.current = messagesRef.current.slice(0, messages.length);\n\n // Sums up scroll heights of all messages except the last one\n if (messagesRef?.current.length > 1) {\n scrollTop = messagesRef.current\n .slice(0, -1)\n .map((elem, _) => elem?.scrollHeight ?? 0)\n .reduce((total, height) => total + height);\n }\n\n // Scroll to the top of the last message\n messagesContainer.current?.scroll({\n top: scrollTop,\n behavior: \"smooth\",\n });\n }, [messages]);\n\n const setMessagesRef = useCallback((index) => {\n if (!messagesRef?.current) return null;\n return (message) => (messagesRef.current[index] = message);\n }, []);\n\n return (\n <div className=\"yext-chat w-full h-full\">\n <div className={cssClasses.container}>\n {header}\n <div className={cssClasses.messagesScrollContainer}>\n <div ref={messagesContainer} className={cssClasses.messagesContainer}>\n {messages.map((message, index) => (\n <div key={index} ref={setMessagesRef(index)}>\n <MessageBubble\n {...props}\n customCssClasses={cssClasses.messageBubbleCssClasses}\n message={message}\n />\n </div>\n ))}\n {loading && <LoadingDots />}\n {suggestions && (\n <MessageSuggestions\n suggestions={suggestions}\n customCssClasses={cssClasses.messageSuggestionClasses}\n />\n )}\n </div>\n </div>\n <div className={cssClasses.inputContainer}>\n <ChatInput {...props} customCssClasses={cssClasses.inputCssClasses} />\n </div>\n </div>\n </div>\n );\n}\n"],"names":["withStylelessCssClasses","useChatState","useComposedCssClasses","useReportAnalyticsEvent","useFetchInitialMessage","useEffect","useMemo","useRef","useCallback","React","MessageBubble","LoadingDots","MessageSuggestions","ChatInput"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,MAAM,iBAAiB,GAAwBA,+CAAuB,CACpE,OAAO,EACP;AACE,IAAA,SAAS,EAAE,0DAA0D;AACrE,IAAA,uBAAuB,EAAE,uCAAuC;AAChE,IAAA,iBAAiB,EAAE,0CAA0C;AAC7D,IAAA,cAAc,EAAE,YAAY;AAC5B,IAAA,uBAAuB,EAAE;AACvB,QAAA,YAAY,EAAE,YAAY;AAC3B,KAAA;AACF,CAAA,CACF,CAAC;AAuBF;;;;;;;;AAQG;AACG,SAAU,SAAS,CAAC,KAAqB,EAAA;AAC7C,IAAA,MA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SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAA;oBACjE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,MAC3BA,sBAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,EAAA;AACzC,wBAAAA,sBAAA,CAAA,aAAA,CAACC,2BAAa,EACR,EAAA,GAAA,KAAK,EACT,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,EACpD,OAAO,EAAE,OAAO,EAChB,CAAA,CACE,CACP,CAAC;oBACD,OAAO,IAAID,sBAAC,CAAA,aAAA,CAAAE,uBAAW,EAAG,IAAA,CAAA;AAC1B,oBAAA,WAAW,KACVF,sBAAA,CAAA,aAAA,CAACG,qCAAkB,EAAA,EACjB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,UAAU,CAAC,wBAAwB,EACrD,CAAA,CACH,CACG,CACF;AACN,YAAAH,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,cAAc,EAAA;AACvC,gBAAAA,sBAAA,CAAA,aAAA,CAACI,mBAAS,EAAA,EAAA,GAAK,KAAK,EAAE,gBAAgB,EAAE,UAAU,CAAC,eAAe,EAAI,CAAA,CAClE,CACF,CACF,EACN;AACJ;;;;"}
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ /**
3
+ * The CSS class interface for the MessageSuggestion component.
4
+ *
5
+ * @public
6
+ */
7
+ export interface MessageSuggestionCssClasses {
8
+ container?: string;
9
+ suggestion?: string;
10
+ }
11
+ /**
12
+ * The props for the MessageSuggestions component.
13
+ *
14
+ * @public
15
+ */
16
+ export interface MessageSuggestionsProps {
17
+ suggestions: string[];
18
+ customCssClasses?: MessageSuggestionCssClasses;
19
+ }
20
+ /**
21
+ * A component that displays a list of suggested messages
22
+ * to the user, which they can click to send the message to the bot.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare const MessageSuggestions: React.FC<MessageSuggestionsProps>;
27
+ //# sourceMappingURL=MessageSuggestions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageSuggestions.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageSuggestions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAM3C;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;CAChD;AAWD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6BhE,CAAC"}
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var chatHeadlessReact = require('@yext/chat-headless-react');
5
+ var useDefaultHandleApiError = require('../hooks/useDefaultHandleApiError.js');
6
+ var withStylelessCssClasses = require('../utils/withStylelessCssClasses.js');
7
+ var useComposedCssClasses = require('../hooks/useComposedCssClasses.js');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefault(React);
12
+
13
+ const defaultClassnames = withStylelessCssClasses.withStylelessCssClasses("Suggestions", {
14
+ container: "flex gap-2 mt-4 w-full overflow-x-auto flex-wrap",
15
+ suggestion: "hover:cursor-pointer px-2 py-1 bg-white hover:bg-slate-300 rounded-full text-sm text-blue-700 border border-blue-700 hover:underline",
16
+ });
17
+ /**
18
+ * A component that displays a list of suggested messages
19
+ * to the user, which they can click to send the message to the bot.
20
+ *
21
+ * @internal
22
+ */
23
+ const MessageSuggestions = ({ suggestions, customCssClasses, }) => {
24
+ const actions = chatHeadlessReact.useChatActions();
25
+ const defaultHandleApiError = useDefaultHandleApiError.useDefaultHandleApiError();
26
+ const sendMsg = React.useCallback((msg) => {
27
+ const res = actions.getNextMessage(msg);
28
+ res.catch(defaultHandleApiError);
29
+ }, [defaultHandleApiError, actions]);
30
+ const classes = useComposedCssClasses.useComposedCssClasses(defaultClassnames, customCssClasses);
31
+ return (React__default.default.createElement("div", { className: classes.container }, suggestions.map((suggestion, index) => (React__default.default.createElement("button", { key: index, className: classes.suggestion, onClick: () => sendMsg(suggestion) }, suggestion)))));
32
+ };
33
+
34
+ exports.MessageSuggestions = MessageSuggestions;
35
+ //# sourceMappingURL=MessageSuggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageSuggestions.js","sources":["../../../../src/components/MessageSuggestions.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { useChatActions } from \"@yext/chat-headless-react\";\nimport { useDefaultHandleApiError } from \"../hooks/useDefaultHandleApiError\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\nimport { useComposedCssClasses } from \"../hooks\";\n\n/**\n * The CSS class interface for the MessageSuggestion component.\n *\n * @public\n */\nexport interface MessageSuggestionCssClasses {\n container?: string;\n suggestion?: string;\n}\n\n/**\n * The props for the MessageSuggestions component.\n *\n * @public\n */\nexport interface MessageSuggestionsProps {\n suggestions: string[];\n customCssClasses?: MessageSuggestionCssClasses;\n}\n\nconst defaultClassnames: MessageSuggestionCssClasses = withStylelessCssClasses(\n \"Suggestions\",\n {\n container: \"flex gap-2 mt-4 w-full overflow-x-auto flex-wrap\",\n suggestion:\n \"hover:cursor-pointer px-2 py-1 bg-white hover:bg-slate-300 rounded-full text-sm text-blue-700 border border-blue-700 hover:underline\",\n }\n);\n\n/**\n * A component that displays a list of suggested messages\n * to the user, which they can click to send the message to the bot.\n *\n * @internal\n */\nexport const MessageSuggestions: React.FC<MessageSuggestionsProps> = ({\n suggestions,\n customCssClasses,\n}) => {\n const actions = useChatActions();\n const defaultHandleApiError = useDefaultHandleApiError();\n const sendMsg = useCallback(\n (msg: string) => {\n const res = actions.getNextMessage(msg);\n res.catch(defaultHandleApiError);\n },\n [defaultHandleApiError, actions]\n );\n\n const classes = useComposedCssClasses(defaultClassnames, customCssClasses);\n\n return (\n <div className={classes.container}>\n {suggestions.map((suggestion, index) => (\n <button\n key={index}\n className={classes.suggestion}\n onClick={() => sendMsg(suggestion)}\n >\n {suggestion}\n </button>\n ))}\n </div>\n );\n};\n"],"names":["withStylelessCssClasses","useChatActions","useDefaultHandleApiError","useCallback","useComposedCssClasses","React"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,iBAAiB,GAAgCA,+CAAuB,CAC5E,aAAa,EACb;AACE,IAAA,SAAS,EAAE,kDAAkD;AAC7D,IAAA,UAAU,EACR,sIAAsI;AACzI,CAAA,CACF,CAAC;AAEF;;;;;AAKG;AACU,MAAA,kBAAkB,GAAsC,CAAC,EACpE,WAAW,EACX,gBAAgB,GACjB,KAAI;AACH,IAAA,MAAM,OAAO,GAAGC,gCAAc,EAAE,CAAC;AACjC,IAAA,MAAM,qBAAqB,GAAGC,iDAAwB,EAAE,CAAC;AACzD,IAAA,MAAM,OAAO,GAAGC,iBAAW,CACzB,CAAC,GAAW,KAAI;QACd,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACxC,QAAA,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACnC,KAAC,EACD,CAAC,qBAAqB,EAAE,OAAO,CAAC,CACjC,CAAC;IAEF,MAAM,OAAO,GAAGC,2CAAqB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IAE3E,QACEC,8CAAK,SAAS,EAAE,OAAO,CAAC,SAAS,IAC9B,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,MACjCA,sBAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EACE,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,OAAO,CAAC,UAAU,EAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,EAEjC,EAAA,UAAU,CACJ,CACV,CAAC,CACE,EACN;AACJ;;;;"}
@@ -10,4 +10,5 @@ export { ChatPopUp } from "./ChatPopUp";
10
10
  export type { ChatPopUpCssClasses, ChatPopUpProps } from "./ChatPopUp";
11
11
  export type { FeedbackButtonsCssClasses } from "./FeedbackButtons";
12
12
  export type { InitialMessagePopUpCssClasses } from "./InitialMessagePopUp";
13
+ export type { MessageSuggestionCssClasses, MessageSuggestionsProps, } from "./MessageSuggestions";
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E,YAAY,EACV,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { ChatHeadless } from '@yext/chat-headless-react';
2
2
  import { Message } from '@yext/chat-headless-react';
3
3
  import { default as React_2 } from 'react';
4
+ import { ReactNode } from 'react';
4
5
 
5
6
  /**
6
7
  * A component that renders the header of a chat bot panel,
@@ -133,6 +134,7 @@ export declare interface ChatPanelCssClasses {
133
134
  inputContainer?: string;
134
135
  inputCssClasses?: ChatInputCssClasses;
135
136
  messageBubbleCssClasses?: MessageBubbleCssClasses;
137
+ messageSuggestionClasses?: MessageSuggestionCssClasses;
136
138
  }
137
139
 
138
140
  /**
@@ -142,11 +144,16 @@ export declare interface ChatPanelCssClasses {
142
144
  */
143
145
  export declare interface ChatPanelProps extends Omit<MessageBubbleProps, "customCssClasses" | "message">, Omit<ChatInputProps, "customCssClasses"> {
144
146
  /** A header to render at the top of the panel. */
145
- header?: JSX.Element;
147
+ header?: ReactNode;
146
148
  /**
147
149
  * CSS classes for customizing the component styling.
148
150
  */
149
151
  customCssClasses?: ChatPanelCssClasses;
152
+ /**
153
+ * A set of pre-written initial messages that the user
154
+ * can click on instead of typing their own.
155
+ */
156
+ messageSuggestions?: string[];
150
157
  }
151
158
 
152
159
  /**
@@ -303,6 +310,26 @@ export declare interface MessageBubbleProps {
303
310
  customCssClasses?: MessageBubbleCssClasses;
304
311
  }
305
312
 
313
+ /**
314
+ * The CSS class interface for the MessageSuggestion component.
315
+ *
316
+ * @public
317
+ */
318
+ export declare interface MessageSuggestionCssClasses {
319
+ container?: string;
320
+ suggestion?: string;
321
+ }
322
+
323
+ /**
324
+ * The props for the MessageSuggestions component.
325
+ *
326
+ * @public
327
+ */
328
+ export declare interface MessageSuggestionsProps {
329
+ suggestions: string[];
330
+ customCssClasses?: MessageSuggestionCssClasses;
331
+ }
332
+
306
333
  /**
307
334
  * useComposedCssClasses merges a component's built-in tailwind classes with custom tailwind classes.
308
335
  *
@@ -1,4 +1,4 @@
1
- var version = "0.8.1";
1
+ var version = "0.8.3-beta.1";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.mjs.map
@@ -1,6 +1,7 @@
1
- import React from "react";
1
+ import React, { ReactNode } from "react";
2
2
  import { MessageBubbleCssClasses, MessageBubbleProps } from "./MessageBubble";
3
3
  import { ChatInputCssClasses, ChatInputProps } from "./ChatInput";
4
+ import { MessageSuggestionCssClasses } from "./MessageSuggestions";
4
5
  /**
5
6
  * The CSS class interface for the {@link ChatPanel} component.
6
7
  *
@@ -13,6 +14,7 @@ export interface ChatPanelCssClasses {
13
14
  inputContainer?: string;
14
15
  inputCssClasses?: ChatInputCssClasses;
15
16
  messageBubbleCssClasses?: MessageBubbleCssClasses;
17
+ messageSuggestionClasses?: MessageSuggestionCssClasses;
16
18
  }
17
19
  /**
18
20
  * The props for the {@link ChatPanel} component.
@@ -21,11 +23,16 @@ export interface ChatPanelCssClasses {
21
23
  */
22
24
  export interface ChatPanelProps extends Omit<MessageBubbleProps, "customCssClasses" | "message">, Omit<ChatInputProps, "customCssClasses"> {
23
25
  /** A header to render at the top of the panel. */
24
- header?: JSX.Element;
26
+ header?: ReactNode;
25
27
  /**
26
28
  * CSS classes for customizing the component styling.
27
29
  */
28
30
  customCssClasses?: ChatPanelCssClasses;
31
+ /**
32
+ * A set of pre-written initial messages that the user
33
+ * can click on instead of typing their own.
34
+ */
35
+ messageSuggestions?: string[];
29
36
  }
30
37
  /**
31
38
  * A component that renders a full panel for chat bot interactions. This includes
@@ -1 +1 @@
1
- {"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAEL,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAa,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAO7E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAeD;;;;GAIG;AACH,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC,EAC9D,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAC1C,kDAAkD;IAClD,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBAkE9C"}
1
+ {"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAa,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM7E,OAAO,EACL,2BAA2B,EAE5B,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAClD,wBAAwB,CAAC,EAAE,2BAA2B,CAAC;CACxD;AAeD;;;;GAIG;AACH,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC,EAC9D,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAC1C,kDAAkD;IAClD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;IACvC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBAoF9C"}
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef, useCallback } from 'react';
1
+ import React, { useEffect, useMemo, useRef, useCallback } from 'react';
2
2
  import { useChatState } from '@yext/chat-headless-react';
3
3
  import { MessageBubble } from './MessageBubble.mjs';
4
4
  import { ChatInput } from './ChatInput.mjs';
@@ -7,6 +7,7 @@ import { useComposedCssClasses } from '../hooks/useComposedCssClasses.mjs';
7
7
  import { useReportAnalyticsEvent } from '../hooks/useReportAnalyticsEvent.mjs';
8
8
  import { withStylelessCssClasses } from '../utils/withStylelessCssClasses.mjs';
9
9
  import { useFetchInitialMessage } from '../hooks/useFetchInitialMessage.mjs';
10
+ import { MessageSuggestions } from './MessageSuggestions.mjs';
10
11
 
11
12
  const builtInCssClasses = withStylelessCssClasses("Panel", {
12
13
  container: "h-full w-full flex flex-col relative shadow-2xl bg-white",
@@ -27,7 +28,7 @@ const builtInCssClasses = withStylelessCssClasses("Panel", {
27
28
  * @param props - {@link ChatPanelProps}
28
29
  */
29
30
  function ChatPanel(props) {
30
- const { header, customCssClasses, stream, handleError } = props;
31
+ const { header, customCssClasses, stream, handleError, messageSuggestions } = props;
31
32
  const messages = useChatState((state) => state.conversation.messages);
32
33
  const loading = useChatState((state) => state.conversation.isLoading);
33
34
  const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);
@@ -38,6 +39,14 @@ function ChatPanel(props) {
38
39
  action: "CHAT_IMPRESSION",
39
40
  });
40
41
  }, [reportAnalyticsEvent]);
42
+ const suggestions = useMemo(() => {
43
+ if (messages.length === 0 ||
44
+ (messages.length === 1 && messages[0].source === "BOT")) {
45
+ return messageSuggestions;
46
+ }
47
+ // TODO: Chat API will send suggestions in the message notes eventually; add that here. [CLIP-852]
48
+ return null;
49
+ }, [messages, messageSuggestions]);
41
50
  const messagesRef = useRef([]);
42
51
  const messagesContainer = useRef(null);
43
52
  // Handle scrolling when messages change
@@ -69,7 +78,8 @@ function ChatPanel(props) {
69
78
  React.createElement("div", { ref: messagesContainer, className: cssClasses.messagesContainer },
70
79
  messages.map((message, index) => (React.createElement("div", { key: index, ref: setMessagesRef(index) },
71
80
  React.createElement(MessageBubble, { ...props, customCssClasses: cssClasses.messageBubbleCssClasses, message: message })))),
72
- loading && React.createElement(LoadingDots, null))),
81
+ loading && React.createElement(LoadingDots, null),
82
+ suggestions && (React.createElement(MessageSuggestions, { suggestions: suggestions, customCssClasses: cssClasses.messageSuggestionClasses })))),
73
83
  React.createElement("div", { className: cssClasses.inputContainer },
74
84
  React.createElement(ChatInput, { ...props, customCssClasses: cssClasses.inputCssClasses })))));
75
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatPanel.mjs","sources":["../../../../src/components/ChatPanel.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { useChatState } from \"@yext/chat-headless-react\";\nimport {\n MessageBubble,\n MessageBubbleCssClasses,\n MessageBubbleProps,\n} from \"./MessageBubble\";\nimport { ChatInput, ChatInputCssClasses, ChatInputProps } from \"./ChatInput\";\nimport { LoadingDots } from \"./LoadingDots\";\nimport { useComposedCssClasses } from \"../hooks\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\nimport { useReportAnalyticsEvent } from \"../hooks/useReportAnalyticsEvent\";\nimport { useFetchInitialMessage } from \"../hooks/useFetchInitialMessage\";\n\n/**\n * The CSS class interface for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelCssClasses {\n container?: string;\n messagesContainer?: string;\n messagesScrollContainer?: string;\n inputContainer?: string;\n inputCssClasses?: ChatInputCssClasses;\n messageBubbleCssClasses?: MessageBubbleCssClasses;\n}\n\nconst builtInCssClasses: ChatPanelCssClasses = withStylelessCssClasses(\n \"Panel\",\n {\n container: \"h-full w-full flex flex-col relative shadow-2xl bg-white\",\n messagesScrollContainer: \"flex flex-col mt-auto overflow-hidden\",\n messagesContainer: \"flex flex-col gap-y-1 px-4 overflow-auto\",\n inputContainer: \"w-full p-4\",\n messageBubbleCssClasses: {\n topContainer: \"first:mt-4\",\n },\n }\n);\n\n/**\n * The props for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelProps\n extends Omit<MessageBubbleProps, \"customCssClasses\" | \"message\">,\n Omit<ChatInputProps, \"customCssClasses\"> {\n /** A header to render at the top of the panel. */\n header?: JSX.Element;\n /**\n * CSS classes for customizing the component styling.\n */\n customCssClasses?: ChatPanelCssClasses;\n}\n\n/**\n * A component that renders a full panel for chat bot interactions. This includes\n * the message bubbles for the conversation, input box with send button, and header\n * (if provided).\n *\n * @public\n *\n * @param props - {@link ChatPanelProps}\n */\nexport function ChatPanel(props: ChatPanelProps) {\n const { header, customCssClasses, stream, handleError } = props;\n const messages = useChatState((state) => state.conversation.messages);\n const loading = useChatState((state) => state.conversation.isLoading);\n const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);\n const reportAnalyticsEvent = useReportAnalyticsEvent();\n useFetchInitialMessage(handleError, stream);\n\n useEffect(() => {\n reportAnalyticsEvent({\n action: \"CHAT_IMPRESSION\",\n });\n }, [reportAnalyticsEvent]);\n\n const messagesRef = useRef<Array<HTMLDivElement | null>>([]);\n const messagesContainer = useRef<HTMLDivElement>(null);\n\n // Handle scrolling when messages change\n useEffect(() => {\n let scrollTop = 0;\n messagesRef.current = messagesRef.current.slice(0, messages.length);\n\n // Sums up scroll heights of all messages except the last one\n if (messagesRef?.current.length > 1) {\n scrollTop = messagesRef.current\n .slice(0, -1)\n .map((elem, _) => elem?.scrollHeight ?? 0)\n .reduce((total, height) => total + height);\n }\n\n // Scroll to the top of the last message\n messagesContainer.current?.scroll({\n top: scrollTop,\n behavior: \"smooth\",\n });\n }, [messages]);\n\n const setMessagesRef = useCallback((index) => {\n if (!messagesRef?.current) return null;\n return (message) => (messagesRef.current[index] = message);\n }, []);\n\n return (\n <div className=\"yext-chat w-full h-full\">\n <div className={cssClasses.container}>\n {header}\n <div className={cssClasses.messagesScrollContainer}>\n <div ref={messagesContainer} className={cssClasses.messagesContainer}>\n {messages.map((message, index) => (\n <div key={index} ref={setMessagesRef(index)}>\n <MessageBubble\n {...props}\n customCssClasses={cssClasses.messageBubbleCssClasses}\n message={message}\n />\n </div>\n ))}\n {loading && <LoadingDots />}\n </div>\n </div>\n <div className={cssClasses.inputContainer}>\n <ChatInput {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KAAA,EAAA,EAAA,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAA;oBACjE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,MAC3B,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,EAAA;AACzC,wBAAA,KAAA,CAAA,aAAA,CAAC,aAAa,EACR,EAAA,GAAA,KAAK,EACT,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,EACpD,OAAO,EAAE,OAAO,EAChB,CAAA,CACE,CACP,CAAC;AACD,oBAAA,OAAO,IAAI,KAAA,CAAA,aAAA,CAAC,WAAW,EAAA,IAAA,CAAG,CACvB,CACF;AACN,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,cAAc,EAAA;AACvC,gBAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EAAA,GAAK,KAAK,EAAE,gBAAgB,EAAE,UAAU,CAAC,eAAe,EAAI,CAAA,CAClE,CACF,CACF,EACN;AACJ;;;;"}
1
+ {"version":3,"file":"ChatPanel.mjs","sources":["../../../../src/components/ChatPanel.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { useChatState } from \"@yext/chat-headless-react\";\nimport {\n MessageBubble,\n MessageBubbleCssClasses,\n MessageBubbleProps,\n} from \"./MessageBubble\";\nimport { ChatInput, ChatInputCssClasses, ChatInputProps } from \"./ChatInput\";\nimport { LoadingDots } from \"./LoadingDots\";\nimport { useComposedCssClasses } from \"../hooks\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\nimport { useReportAnalyticsEvent } from \"../hooks/useReportAnalyticsEvent\";\nimport { useFetchInitialMessage } from \"../hooks/useFetchInitialMessage\";\nimport {\n MessageSuggestionCssClasses,\n MessageSuggestions,\n} from \"./MessageSuggestions\";\n\n/**\n * The CSS class interface for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelCssClasses {\n container?: string;\n messagesContainer?: string;\n messagesScrollContainer?: string;\n inputContainer?: string;\n inputCssClasses?: ChatInputCssClasses;\n messageBubbleCssClasses?: MessageBubbleCssClasses;\n messageSuggestionClasses?: MessageSuggestionCssClasses;\n}\n\nconst builtInCssClasses: ChatPanelCssClasses = withStylelessCssClasses(\n \"Panel\",\n {\n container: \"h-full w-full flex flex-col relative shadow-2xl bg-white\",\n messagesScrollContainer: \"flex flex-col mt-auto overflow-hidden\",\n messagesContainer: \"flex flex-col gap-y-1 px-4 overflow-auto\",\n inputContainer: \"w-full p-4\",\n messageBubbleCssClasses: {\n topContainer: \"first:mt-4\",\n },\n }\n);\n\n/**\n * The props for the {@link ChatPanel} component.\n *\n * @public\n */\nexport interface ChatPanelProps\n extends Omit<MessageBubbleProps, \"customCssClasses\" | \"message\">,\n Omit<ChatInputProps, \"customCssClasses\"> {\n /** A header to render at the top of the panel. */\n header?: ReactNode;\n /**\n * CSS classes for customizing the component styling.\n */\n customCssClasses?: ChatPanelCssClasses;\n /**\n * A set of pre-written initial messages that the user\n * can click on instead of typing their own.\n */\n messageSuggestions?: string[];\n}\n\n/**\n * A component that renders a full panel for chat bot interactions. This includes\n * the message bubbles for the conversation, input box with send button, and header\n * (if provided).\n *\n * @public\n *\n * @param props - {@link ChatPanelProps}\n */\nexport function ChatPanel(props: ChatPanelProps) {\n const { header, customCssClasses, stream, handleError, messageSuggestions } =\n props;\n const messages = useChatState((state) => state.conversation.messages);\n const loading = useChatState((state) => state.conversation.isLoading);\n const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);\n const reportAnalyticsEvent = useReportAnalyticsEvent();\n useFetchInitialMessage(handleError, stream);\n\n useEffect(() => {\n reportAnalyticsEvent({\n action: \"CHAT_IMPRESSION\",\n });\n }, [reportAnalyticsEvent]);\n\n const suggestions = useMemo(() => {\n if (\n messages.length === 0 ||\n (messages.length === 1 && messages[0].source === \"BOT\")\n ) {\n return messageSuggestions;\n }\n // TODO: Chat API will send suggestions in the message notes eventually; add that here. [CLIP-852]\n return null;\n }, [messages, messageSuggestions]);\n\n const messagesRef = useRef<Array<HTMLDivElement | null>>([]);\n const messagesContainer = useRef<HTMLDivElement>(null);\n\n // Handle scrolling when messages change\n useEffect(() => {\n let scrollTop = 0;\n messagesRef.current = messagesRef.current.slice(0, messages.length);\n\n // Sums up scroll heights of all messages except the last one\n if (messagesRef?.current.length > 1) {\n scrollTop = messagesRef.current\n .slice(0, -1)\n .map((elem, _) => elem?.scrollHeight ?? 0)\n .reduce((total, height) => total + height);\n }\n\n // Scroll to the top of the last message\n messagesContainer.current?.scroll({\n top: scrollTop,\n behavior: \"smooth\",\n });\n }, [messages]);\n\n const setMessagesRef = useCallback((index) => {\n if (!messagesRef?.current) return null;\n return (message) => (messagesRef.current[index] = message);\n }, []);\n\n return (\n <div className=\"yext-chat w-full h-full\">\n <div className={cssClasses.container}>\n {header}\n <div className={cssClasses.messagesScrollContainer}>\n <div ref={messagesContainer} className={cssClasses.messagesContainer}>\n {messages.map((message, index) => (\n <div key={index} ref={setMessagesRef(index)}>\n <MessageBubble\n {...props}\n customCssClasses={cssClasses.messageBubbleCssClasses}\n message={message}\n />\n </div>\n ))}\n {loading && <LoadingDots />}\n {suggestions && (\n <MessageSuggestions\n suggestions={suggestions}\n customCssClasses={cssClasses.messageSuggestionClasses}\n />\n )}\n </div>\n </div>\n <div className={cssClasses.inputContainer}>\n <ChatInput {...props} customCssClasses={cssClasses.inputCssClasses} />\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAuCA,MAAM,iBAAiB,GAAwB,uBAAuB,CACpE,OAAO,EACP;AACE,IAAA,SAAS,EAAE,0DAA0D;AACrE,IAAA,uBAAuB,EAAE,uCAAuC;AAChE,IAAA,iBAAiB,EAAE,0CAA0C;AAC7D,IAAA,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,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,uBAAuB,EAAA;gBAChD,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAA;oBACjE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,MAC3B,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,EAAA;AACzC,wBAAA,KAAA,CAAA,aAAA,CAAC,aAAa,EACR,EAAA,GAAA,KAAK,EACT,gBAAgB,EAAE,UAAU,CAAC,uBAAuB,EACpD,OAAO,EAAE,OAAO,EAChB,CAAA,CACE,CACP,CAAC;oBACD,OAAO,IAAI,KAAC,CAAA,aAAA,CAAA,WAAW,EAAG,IAAA,CAAA;AAC1B,oBAAA,WAAW,KACV,KAAA,CAAA,aAAA,CAAC,kBAAkB,EAAA,EACjB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,UAAU,CAAC,wBAAwB,EACrD,CAAA,CACH,CACG,CACF;AACN,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,cAAc,EAAA;AACvC,gBAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EAAA,GAAK,KAAK,EAAE,gBAAgB,EAAE,UAAU,CAAC,eAAe,EAAI,CAAA,CAClE,CACF,CACF,EACN;AACJ;;;;"}
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ /**
3
+ * The CSS class interface for the MessageSuggestion component.
4
+ *
5
+ * @public
6
+ */
7
+ export interface MessageSuggestionCssClasses {
8
+ container?: string;
9
+ suggestion?: string;
10
+ }
11
+ /**
12
+ * The props for the MessageSuggestions component.
13
+ *
14
+ * @public
15
+ */
16
+ export interface MessageSuggestionsProps {
17
+ suggestions: string[];
18
+ customCssClasses?: MessageSuggestionCssClasses;
19
+ }
20
+ /**
21
+ * A component that displays a list of suggested messages
22
+ * to the user, which they can click to send the message to the bot.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare const MessageSuggestions: React.FC<MessageSuggestionsProps>;
27
+ //# sourceMappingURL=MessageSuggestions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageSuggestions.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageSuggestions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAM3C;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;CAChD;AAWD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6BhE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useChatActions } from '@yext/chat-headless-react';
3
+ import { useDefaultHandleApiError } from '../hooks/useDefaultHandleApiError.mjs';
4
+ import { withStylelessCssClasses } from '../utils/withStylelessCssClasses.mjs';
5
+ import { useComposedCssClasses } from '../hooks/useComposedCssClasses.mjs';
6
+
7
+ const defaultClassnames = withStylelessCssClasses("Suggestions", {
8
+ container: "flex gap-2 mt-4 w-full overflow-x-auto flex-wrap",
9
+ suggestion: "hover:cursor-pointer px-2 py-1 bg-white hover:bg-slate-300 rounded-full text-sm text-blue-700 border border-blue-700 hover:underline",
10
+ });
11
+ /**
12
+ * A component that displays a list of suggested messages
13
+ * to the user, which they can click to send the message to the bot.
14
+ *
15
+ * @internal
16
+ */
17
+ const MessageSuggestions = ({ suggestions, customCssClasses, }) => {
18
+ const actions = useChatActions();
19
+ const defaultHandleApiError = useDefaultHandleApiError();
20
+ const sendMsg = useCallback((msg) => {
21
+ const res = actions.getNextMessage(msg);
22
+ res.catch(defaultHandleApiError);
23
+ }, [defaultHandleApiError, actions]);
24
+ const classes = useComposedCssClasses(defaultClassnames, customCssClasses);
25
+ return (React.createElement("div", { className: classes.container }, suggestions.map((suggestion, index) => (React.createElement("button", { key: index, className: classes.suggestion, onClick: () => sendMsg(suggestion) }, suggestion)))));
26
+ };
27
+
28
+ export { MessageSuggestions };
29
+ //# sourceMappingURL=MessageSuggestions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageSuggestions.mjs","sources":["../../../../src/components/MessageSuggestions.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { useChatActions } from \"@yext/chat-headless-react\";\nimport { useDefaultHandleApiError } from \"../hooks/useDefaultHandleApiError\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\nimport { useComposedCssClasses } from \"../hooks\";\n\n/**\n * The CSS class interface for the MessageSuggestion component.\n *\n * @public\n */\nexport interface MessageSuggestionCssClasses {\n container?: string;\n suggestion?: string;\n}\n\n/**\n * The props for the MessageSuggestions component.\n *\n * @public\n */\nexport interface MessageSuggestionsProps {\n suggestions: string[];\n customCssClasses?: MessageSuggestionCssClasses;\n}\n\nconst defaultClassnames: MessageSuggestionCssClasses = withStylelessCssClasses(\n \"Suggestions\",\n {\n container: \"flex gap-2 mt-4 w-full overflow-x-auto flex-wrap\",\n suggestion:\n \"hover:cursor-pointer px-2 py-1 bg-white hover:bg-slate-300 rounded-full text-sm text-blue-700 border border-blue-700 hover:underline\",\n }\n);\n\n/**\n * A component that displays a list of suggested messages\n * to the user, which they can click to send the message to the bot.\n *\n * @internal\n */\nexport const MessageSuggestions: React.FC<MessageSuggestionsProps> = ({\n suggestions,\n customCssClasses,\n}) => {\n const actions = useChatActions();\n const defaultHandleApiError = useDefaultHandleApiError();\n const sendMsg = useCallback(\n (msg: string) => {\n const res = actions.getNextMessage(msg);\n res.catch(defaultHandleApiError);\n },\n [defaultHandleApiError, actions]\n );\n\n const classes = useComposedCssClasses(defaultClassnames, customCssClasses);\n\n return (\n <div className={classes.container}>\n {suggestions.map((suggestion, index) => (\n <button\n key={index}\n className={classes.suggestion}\n onClick={() => sendMsg(suggestion)}\n >\n {suggestion}\n </button>\n ))}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,iBAAiB,GAAgC,uBAAuB,CAC5E,aAAa,EACb;AACE,IAAA,SAAS,EAAE,kDAAkD;AAC7D,IAAA,UAAU,EACR,sIAAsI;AACzI,CAAA,CACF,CAAC;AAEF;;;;;AAKG;AACU,MAAA,kBAAkB,GAAsC,CAAC,EACpE,WAAW,EACX,gBAAgB,GACjB,KAAI;AACH,IAAA,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;AACjC,IAAA,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAC;AACzD,IAAA,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,GAAW,KAAI;QACd,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACxC,QAAA,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACnC,KAAC,EACD,CAAC,qBAAqB,EAAE,OAAO,CAAC,CACjC,CAAC;IAEF,MAAM,OAAO,GAAG,qBAAqB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IAE3E,QACE,6BAAK,SAAS,EAAE,OAAO,CAAC,SAAS,IAC9B,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,MACjC,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EACE,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,OAAO,CAAC,UAAU,EAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,EAEjC,EAAA,UAAU,CACJ,CACV,CAAC,CACE,EACN;AACJ;;;;"}
@@ -10,4 +10,5 @@ export { ChatPopUp } from "./ChatPopUp";
10
10
  export type { ChatPopUpCssClasses, ChatPopUpProps } from "./ChatPopUp";
11
11
  export type { FeedbackButtonsCssClasses } from "./FeedbackButtons";
12
12
  export type { InitialMessagePopUpCssClasses } from "./InitialMessagePopUp";
13
+ export type { MessageSuggestionCssClasses, MessageSuggestionsProps, } from "./MessageSuggestions";
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E,YAAY,EACV,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "name": "@yext/chat-ui-react",
3
- "version": "0.8.1",
3
+ "version": "0.8.3-beta.1",
4
4
  "description": "A library of React Components for powering Yext Chat integrations.",
5
5
  "author": "clippy@yext.com",
6
6
  "main": "./lib/commonjs/src/index.js",
7
7
  "module": "./lib/esm/src/index.mjs",
8
- "types": "./lib/esm/src/index.d.ts",
9
8
  "sideEffects": false,
10
9
  "exports": {
11
10
  ".": {
12
- "import": "./lib/esm/src/index.mjs",
13
- "require": "./lib/commonjs/src/index.js"
11
+ "import": {
12
+ "default": "./lib/esm/src/index.mjs",
13
+ "types": "./lib/esm/index.d.ts"
14
+ },
15
+ "require": {
16
+ "default": "./lib/commonjs/src/index.js",
17
+ "types": "./lib/commonjs/src/index.d.ts"
18
+ }
14
19
  },
15
20
  "./bundle.css": "./lib/bundle.css"
16
21
  },
@@ -1,4 +1,10 @@
1
- import React, { useCallback, useEffect, useRef } from "react";
1
+ import React, {
2
+ ReactNode,
3
+ useCallback,
4
+ useEffect,
5
+ useMemo,
6
+ useRef,
7
+ } from "react";
2
8
  import { useChatState } from "@yext/chat-headless-react";
3
9
  import {
4
10
  MessageBubble,
@@ -11,6 +17,10 @@ import { useComposedCssClasses } from "../hooks";
11
17
  import { withStylelessCssClasses } from "../utils/withStylelessCssClasses";
12
18
  import { useReportAnalyticsEvent } from "../hooks/useReportAnalyticsEvent";
13
19
  import { useFetchInitialMessage } from "../hooks/useFetchInitialMessage";
20
+ import {
21
+ MessageSuggestionCssClasses,
22
+ MessageSuggestions,
23
+ } from "./MessageSuggestions";
14
24
 
15
25
  /**
16
26
  * The CSS class interface for the {@link ChatPanel} component.
@@ -24,6 +34,7 @@ export interface ChatPanelCssClasses {
24
34
  inputContainer?: string;
25
35
  inputCssClasses?: ChatInputCssClasses;
26
36
  messageBubbleCssClasses?: MessageBubbleCssClasses;
37
+ messageSuggestionClasses?: MessageSuggestionCssClasses;
27
38
  }
28
39
 
29
40
  const builtInCssClasses: ChatPanelCssClasses = withStylelessCssClasses(
@@ -48,11 +59,16 @@ export interface ChatPanelProps
48
59
  extends Omit<MessageBubbleProps, "customCssClasses" | "message">,
49
60
  Omit<ChatInputProps, "customCssClasses"> {
50
61
  /** A header to render at the top of the panel. */
51
- header?: JSX.Element;
62
+ header?: ReactNode;
52
63
  /**
53
64
  * CSS classes for customizing the component styling.
54
65
  */
55
66
  customCssClasses?: ChatPanelCssClasses;
67
+ /**
68
+ * A set of pre-written initial messages that the user
69
+ * can click on instead of typing their own.
70
+ */
71
+ messageSuggestions?: string[];
56
72
  }
57
73
 
58
74
  /**
@@ -65,7 +81,8 @@ export interface ChatPanelProps
65
81
  * @param props - {@link ChatPanelProps}
66
82
  */
67
83
  export function ChatPanel(props: ChatPanelProps) {
68
- const { header, customCssClasses, stream, handleError } = props;
84
+ const { header, customCssClasses, stream, handleError, messageSuggestions } =
85
+ props;
69
86
  const messages = useChatState((state) => state.conversation.messages);
70
87
  const loading = useChatState((state) => state.conversation.isLoading);
71
88
  const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);
@@ -78,6 +95,17 @@ export function ChatPanel(props: ChatPanelProps) {
78
95
  });
79
96
  }, [reportAnalyticsEvent]);
80
97
 
98
+ const suggestions = useMemo(() => {
99
+ if (
100
+ messages.length === 0 ||
101
+ (messages.length === 1 && messages[0].source === "BOT")
102
+ ) {
103
+ return messageSuggestions;
104
+ }
105
+ // TODO: Chat API will send suggestions in the message notes eventually; add that here. [CLIP-852]
106
+ return null;
107
+ }, [messages, messageSuggestions]);
108
+
81
109
  const messagesRef = useRef<Array<HTMLDivElement | null>>([]);
82
110
  const messagesContainer = useRef<HTMLDivElement>(null);
83
111
 
@@ -122,6 +150,12 @@ export function ChatPanel(props: ChatPanelProps) {
122
150
  </div>
123
151
  ))}
124
152
  {loading && <LoadingDots />}
153
+ {suggestions && (
154
+ <MessageSuggestions
155
+ suggestions={suggestions}
156
+ customCssClasses={cssClasses.messageSuggestionClasses}
157
+ />
158
+ )}
125
159
  </div>
126
160
  </div>
127
161
  <div className={cssClasses.inputContainer}>
@@ -0,0 +1,71 @@
1
+ import React, { useCallback } from "react";
2
+ import { useChatActions } from "@yext/chat-headless-react";
3
+ import { useDefaultHandleApiError } from "../hooks/useDefaultHandleApiError";
4
+ import { withStylelessCssClasses } from "../utils/withStylelessCssClasses";
5
+ import { useComposedCssClasses } from "../hooks";
6
+
7
+ /**
8
+ * The CSS class interface for the MessageSuggestion component.
9
+ *
10
+ * @public
11
+ */
12
+ export interface MessageSuggestionCssClasses {
13
+ container?: string;
14
+ suggestion?: string;
15
+ }
16
+
17
+ /**
18
+ * The props for the MessageSuggestions component.
19
+ *
20
+ * @public
21
+ */
22
+ export interface MessageSuggestionsProps {
23
+ suggestions: string[];
24
+ customCssClasses?: MessageSuggestionCssClasses;
25
+ }
26
+
27
+ const defaultClassnames: MessageSuggestionCssClasses = withStylelessCssClasses(
28
+ "Suggestions",
29
+ {
30
+ container: "flex gap-2 mt-4 w-full overflow-x-auto flex-wrap",
31
+ suggestion:
32
+ "hover:cursor-pointer px-2 py-1 bg-white hover:bg-slate-300 rounded-full text-sm text-blue-700 border border-blue-700 hover:underline",
33
+ }
34
+ );
35
+
36
+ /**
37
+ * A component that displays a list of suggested messages
38
+ * to the user, which they can click to send the message to the bot.
39
+ *
40
+ * @internal
41
+ */
42
+ export const MessageSuggestions: React.FC<MessageSuggestionsProps> = ({
43
+ suggestions,
44
+ customCssClasses,
45
+ }) => {
46
+ const actions = useChatActions();
47
+ const defaultHandleApiError = useDefaultHandleApiError();
48
+ const sendMsg = useCallback(
49
+ (msg: string) => {
50
+ const res = actions.getNextMessage(msg);
51
+ res.catch(defaultHandleApiError);
52
+ },
53
+ [defaultHandleApiError, actions]
54
+ );
55
+
56
+ const classes = useComposedCssClasses(defaultClassnames, customCssClasses);
57
+
58
+ return (
59
+ <div className={classes.container}>
60
+ {suggestions.map((suggestion, index) => (
61
+ <button
62
+ key={index}
63
+ className={classes.suggestion}
64
+ onClick={() => sendMsg(suggestion)}
65
+ >
66
+ {suggestion}
67
+ </button>
68
+ ))}
69
+ </div>
70
+ );
71
+ };
@@ -18,3 +18,8 @@ export type { ChatPopUpCssClasses, ChatPopUpProps } from "./ChatPopUp";
18
18
 
19
19
  export type { FeedbackButtonsCssClasses } from "./FeedbackButtons";
20
20
  export type { InitialMessagePopUpCssClasses } from "./InitialMessagePopUp";
21
+
22
+ export type {
23
+ MessageSuggestionCssClasses,
24
+ MessageSuggestionsProps,
25
+ } from "./MessageSuggestions";
@@ -1,2 +1,2 @@
1
1
  export { useComposedCssClasses } from "./useComposedCssClasses";
2
- export { useReportAnalyticsEvent } from "./useReportAnalyticsEvent";
2
+ export { useReportAnalyticsEvent } from "./useReportAnalyticsEvent";
File without changes