Skip to content

Commit

Permalink
fix(react): fix react TS types
Browse files Browse the repository at this point in the history
  • Loading branch information
dpinol committed Nov 5, 2020
1 parent c2b9d72 commit 5614b0c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/botonic-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/botonic-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botonic/react",
"version": "0.15.3-alpha.4",
"version": "0.15.3-alpha.5",
"license": "MIT",
"description": "Build Chatbots using React",
"main": "src/index.js",
Expand Down
23 changes: 16 additions & 7 deletions packages/botonic-react/src/components/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface ButtonProps {
target?: string
url?: string
webview?: Webview
onClick?: () => void
}

export const Button: React.FunctionComponent<ButtonProps>
Expand All @@ -70,16 +71,22 @@ export const Subtitle: React.FunctionComponent<SubtitleProps>
export const Title: React.FunctionComponent<TitleProps>
export type SubtitleProps = TitleProps

type CustomProp = { custom?: React.Component }
type CustomProp = { custom?: React.ComponentType }
type EnableProp = { enable?: boolean }
type ImageProp = { image?: string } // https URL or imported Image asset
type PersistentMenuCloseOption = { closeLabel: string }
type PersistentMenuOption = { label: string } & ButtonProps
type StyleProp = { style?: any }

export type PersistentMenuProps =
| PersistentMenuCloseOption[]
| PersistentMenuOption[]
export type PersistentMenuTheme = (
| PersistentMenuCloseOption
| PersistentMenuOption
)[]

export interface PersistentMenuProps {
onClick: () => void
options: any
}

export type BlockInputOption = { match: RegExp[]; message: string }

Expand Down Expand Up @@ -151,9 +158,11 @@ export interface ThemeProps extends StyleProp {
blockInputs?: BlockInputOption[]
box?: { placeholder: string } & StyleProp
emojiPicker?: EnableProp
menu?: { darkBackground?: boolean } & CustomProp
menu?: { darkBackground?: boolean } & {
custom?: React.ComponentType<PersistentMenuProps>
}
menuButton?: CustomProp
persistentMenu?: PersistentMenuProps
persistentMenu?: PersistentMenuTheme
sendButton?: EnableProp & CustomProp
} & EnableProp &
StyleProp
Expand All @@ -172,7 +181,7 @@ export interface WebchatSettingsProps {
enableAttachments?: boolean
enableEmojiPicker?: boolean
enableUserInput?: boolean
persistentMenu?: PersistentMenuProps
persistentMenu?: PersistentMenuTheme
theme?: ThemeProps
}
export const WebchatSettings: React.FunctionComponent<WebchatSettingsProps>
Expand Down
5 changes: 2 additions & 3 deletions packages/botonic-react/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
BlockInputOption,
ButtonProps,
CoverComponentOptions,
PersistentMenuProps,
PersistentMenuTheme,
ReplyProps,
ThemeProps,
WebchatSettingsProps,
Expand Down Expand Up @@ -108,8 +108,7 @@ export interface WebchatArgs {
onInit?: (app: WebchatApp, args: any) => void
onMessage?: (app: WebchatApp, message: WebchatMessage) => void
onOpen?: (app: WebchatApp, args: any) => void
persistentMenu?: PersistentMenuProps
setLocale: (locale: string, session: core.Session) => string
persistentMenu?: PersistentMenuTheme
storage?: Storage
storageKey?: any
theme?: ThemeProps
Expand Down

0 comments on commit 5614b0c

Please sign in to comment.