@@ -32,7 +32,6 @@ import {
3232 SidePanelHeader ,
3333 SidePanelPushContentWrapper ,
3434} from "@twilio-paste/side-panel" ;
35-
3635import * as React from "react" ;
3736
3837import {
@@ -169,7 +168,7 @@ export const SidePanelScroll: StoryFn = () => {
169168 < AIChatMessageAuthor aria-label = "AI said" > Good Bot</ AIChatMessageAuthor >
170169 < AIChatMessageBody >
171170 This is an indicator that the message was filtered (blocked) by Twilio or by the carrier. This may be done
172- by Twilio for violating Twilio's { " " }
171+ by Twilio for violating Twilio& aposs { " " }
173172 < Anchor href = "https://www.twilio.com/en-us/legal/messaging-policy" showExternal >
174173 Messaging Policy
175174 </ Anchor > { " " }
@@ -203,7 +202,7 @@ export const SidePanelScroll: StoryFn = () => {
203202 setMounted ( true ) ;
204203 } , [ ] ) ;
205204
206- const scrollToChatEnd = ( ) => {
205+ const scrollToChatEnd = ( ) : void => {
207206 const scrollPosition : any = scrollerRef . current ;
208207 const scrollHeight : any = loggerRef . current ;
209208 scrollPosition ?. scrollTo ( { top : scrollHeight . scrollHeight , behavior : "smooth" } ) ;
@@ -221,12 +220,12 @@ export const SidePanelScroll: StoryFn = () => {
221220 } ) ;
222221 } ;
223222
224- const onAnimationEnd = ( ) => {
223+ const onAnimationEnd = ( ) : void => {
225224 setIsAnimating ( false ) ;
226225 scrollToChatEnd ( ) ;
227226 } ;
228227
229- const onAnimationStart = ( ) => {
228+ const onAnimationStart = ( ) : void => {
230229 setIsAnimating ( true ) ;
231230 } ;
232231
@@ -239,20 +238,20 @@ export const SidePanelScroll: StoryFn = () => {
239238 } , [ isAnimating ] ) ;
240239
241240 // eslint-disable-next-line storybook/prefer-pascal-case
242- const createNewMessage = ( message : any , forceBot ?: boolean ) : Omit < AIChat , "id" > => {
243- const messageDirection = forceBot ? "bot" : getRandomInt ( 2 ) === 1 ? "user" : "bot" ;
241+ const createNewMessage = ( newMessage : any , forceBot ?: boolean ) : Omit < AIChat , "id" > => {
242+ const messageDirection = getRandomInt ( 2 ) === 1 && ! forceBot ? "user" : "bot" ;
244243
245244 return {
246245 variant : messageDirection ,
247246 content :
248247 messageDirection === "user" ? (
249248 < AIChatMessage variant = "user" >
250249 < AIChatMessageAuthor aria-label = "You said at 2:39pm" > Gibby Radki</ AIChatMessageAuthor >
251- < AIChatMessageBody > { message } </ AIChatMessageBody >
250+ < AIChatMessageBody > { newMessage } </ AIChatMessageBody >
252251 </ AIChatMessage >
253252 ) : (
254253 < AIChatMessage variant = "bot" >
255- < BotMessage message = { message } onAnimationEnd = { onAnimationEnd } onAnimationStart = { onAnimationStart } />
254+ < BotMessage message = { newMessage } onAnimationEnd = { onAnimationEnd } onAnimationStart = { onAnimationStart } />
256255 </ AIChatMessage >
257256 ) ,
258257 } ;
@@ -263,7 +262,7 @@ export const SidePanelScroll: StoryFn = () => {
263262 push ( createNewMessage ( message ) ) ;
264263 } ;
265264
266- const pushLargeBotMessage = ( ) => {
265+ const pushLargeBotMessage = ( ) : void => {
267266 push (
268267 createNewMessage (
269268 < >
0 commit comments