Skip to content

Commit

Permalink
refactor(botonic-react): add some types and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru89 committed Dec 20, 2024
1 parent 39d20c2 commit d715a12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
18 changes: 9 additions & 9 deletions packages/botonic-react/src/index-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export interface WebchatProps {
shadowDOM?: any
theme?: ThemeProps
persistentMenu?: PersistentMenuTheme
coverComponent?: any
blockInputs?: any
coverComponent?: CoverComponentOptions
blockInputs?: BlockInputOption[]
enableEmojiPicker?: boolean
enableAttachments?: boolean
enableUserInput?: boolean
Expand All @@ -136,7 +136,7 @@ export interface WebchatProps {
onInit?: (args?: any) => void
onOpen?: (args?: any) => void
onClose?: (args?: any) => void
onUserInput(args: OnUserInputArgs): Promise<void> // TODO: Review this function and params types
onUserInput(args: OnUserInputArgs): Promise<void>
onTrackEvent?: TrackEventFunction
host?: any
server?: ServerConfig
Expand Down Expand Up @@ -164,19 +164,19 @@ export interface WebchatMessage {
ack: 0 | 1
blob: boolean
buttons: ButtonProps[]
children: any
data: any
children: any // messageJSON don't have children prop
data: any // if message.type === 'text' => message.data = {text: string}
delay: number
display: boolean
enabletimestamps: boolean
enabletimestamps?: boolean
id: string
imagestyle: any
imagestyle?: any
isUnread: boolean
json: any
markdown: boolean
markdown: boolean // 0 | 1
replies: ReplyProps[]
sentBy: SENDERS
style: any
style?: any
timestamp: string
type: CoreInputType
typing: number
Expand Down
6 changes: 5 additions & 1 deletion packages/botonic-react/src/webchat-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ export class WebchatApp {
sentBy: SENDERS.user,
isUnread: false,
} as unknown as WebchatMessage)
this.hubtypeService.postMessage(user, input)
this.hubtypeService.postMessage(user, {

Check warning on line 199 in packages/botonic-react/src/webchat-app.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/webchat-app.tsx#L199

Added line #L199 was not covered by tests
...input,
// TODO: Review if this is correct add sent_by or this is added in backend
// sent_by: 'message_sent_by_user',
})
return
}

Expand Down

0 comments on commit d715a12

Please sign in to comment.