@botpress/webchat 1.0.0 → 1.0.2
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.
- package/package.json +2 -1
- package/dist/vite.svg +0 -1
- package/index.html +0 -18
- package/public/vite.svg +0 -1
- package/src/App.tsx +0 -41
- package/src/Utils/colors.ts +0 -45
- package/src/Utils/eventEmitter.ts +0 -31
- package/src/Utils/index.ts +0 -2
- package/src/assets/check-circle-bold.svg +0 -5
- package/src/assets/chevron-up.svg +0 -3
- package/src/assets/file-05.svg +0 -6
- package/src/assets/globe-02.svg +0 -6
- package/src/assets/help-circle.svg +0 -3
- package/src/assets/info-circle.svg +0 -3
- package/src/assets/lock-01.svg +0 -4
- package/src/assets/mail-01.svg +0 -6
- package/src/assets/minus-circle.svg +0 -3
- package/src/assets/phone.svg +0 -6
- package/src/assets/send-03.svg +0 -4
- package/src/assets/share-04.svg +0 -5
- package/src/assets/slash-circle-01.svg +0 -3
- package/src/assets/x-circle-bold.svg +0 -5
- package/src/assets/x-close.svg +0 -3
- package/src/assets/x.svg +0 -3
- package/src/client/MessagingClient.ts +0 -87
- package/src/client/adapters/Audio.ts +0 -10
- package/src/client/adapters/Card.ts +0 -104
- package/src/client/adapters/Carousel.ts +0 -11
- package/src/client/adapters/Choice.ts +0 -48
- package/src/client/adapters/Dropdown.ts +0 -39
- package/src/client/adapters/File.ts +0 -10
- package/src/client/adapters/Image.ts +0 -10
- package/src/client/adapters/Location.ts +0 -18
- package/src/client/adapters/Message.ts +0 -26
- package/src/client/adapters/Text.ts +0 -11
- package/src/client/adapters/Utils.ts +0 -11
- package/src/client/adapters/Video.ts +0 -10
- package/src/client/adapters/Voice.ts +0 -9
- package/src/client/adapters/index.ts +0 -12
- package/src/client/index.ts +0 -2
- package/src/components/Avatar.tsx +0 -22
- package/src/components/Block.tsx +0 -17
- package/src/components/Composer.tsx +0 -115
- package/src/components/Container.tsx +0 -17
- package/src/components/Header.tsx +0 -141
- package/src/components/LoadingIndicator.tsx +0 -15
- package/src/components/Message.tsx +0 -52
- package/src/components/MessageList.tsx +0 -75
- package/src/components/Modal.tsx +0 -49
- package/src/components/RestartConversation.tsx +0 -52
- package/src/components/Webchat.tsx +0 -68
- package/src/components/dev-tools/DevTools.tsx +0 -496
- package/src/components/dev-tools/configuration.tsx +0 -27
- package/src/components/dev-tools/helpers.ts +0 -21
- package/src/components/index.ts +0 -12
- package/src/components/renderers/Audio.tsx +0 -11
- package/src/components/renderers/Bubble.tsx +0 -12
- package/src/components/renderers/Button.tsx +0 -59
- package/src/components/renderers/Carousel.tsx +0 -51
- package/src/components/renderers/Column.tsx +0 -22
- package/src/components/renderers/Dropdown.tsx +0 -170
- package/src/components/renderers/File.tsx +0 -13
- package/src/components/renderers/Image.tsx +0 -63
- package/src/components/renderers/Location.tsx +0 -16
- package/src/components/renderers/Row.tsx +0 -22
- package/src/components/renderers/Text.tsx +0 -32
- package/src/components/renderers/Video.tsx +0 -11
- package/src/components/renderers/index.ts +0 -28
- package/src/contexts/ComposerContext.ts +0 -16
- package/src/contexts/MessageContext.ts +0 -16
- package/src/contexts/ModalContext.ts +0 -19
- package/src/contexts/WebchatContext.ts +0 -61
- package/src/contexts/index.ts +0 -4
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useImageSize.ts +0 -30
- package/src/hooks/useRefresh.ts +0 -33
- package/src/hooks/useWebchatStore.ts +0 -45
- package/src/index.css +0 -18
- package/src/index.ts +0 -3
- package/src/main.tsx +0 -33
- package/src/providers/ModalProvider.tsx +0 -35
- package/src/providers/WebchatProvider.tsx +0 -107
- package/src/providers/index.ts +0 -2
- package/src/schemas/index.ts +0 -1
- package/src/schemas/theme.ts +0 -188
- package/src/services/clipboard.ts +0 -8
- package/src/services/images.ts +0 -39
- package/src/services/index.ts +0 -3
- package/src/services/toast.tsx +0 -71
- package/src/themes/dawn.ts +0 -277
- package/src/themes/duskTheme.ts +0 -349
- package/src/themes/eggplant.ts +0 -353
- package/src/themes/galaxy.ts +0 -323
- package/src/themes/index.ts +0 -6
- package/src/themes/midnight.ts +0 -276
- package/src/themes/prism.ts +0 -349
- package/src/twind.config.ts +0 -31
- package/src/types/block-type.ts +0 -150
- package/src/types/image.ts +0 -10
- package/src/types/index.ts +0 -2
- package/src/vite-env.d.ts +0 -1
- package/tailwind.config.js +0 -0
- package/tsconfig.json +0 -30
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -31
package/src/types/block-type.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { Theme } from '../schemas'
|
|
2
|
-
|
|
3
|
-
export const blockTypes = [
|
|
4
|
-
'button',
|
|
5
|
-
'text',
|
|
6
|
-
'image',
|
|
7
|
-
'audio',
|
|
8
|
-
'video',
|
|
9
|
-
'file',
|
|
10
|
-
'location',
|
|
11
|
-
'column',
|
|
12
|
-
'row',
|
|
13
|
-
'bubble',
|
|
14
|
-
'carousel',
|
|
15
|
-
'dropdown',
|
|
16
|
-
] as const
|
|
17
|
-
|
|
18
|
-
export const markdownTypes = [
|
|
19
|
-
'heading1',
|
|
20
|
-
'heading2',
|
|
21
|
-
'heading3',
|
|
22
|
-
'text',
|
|
23
|
-
'horizontalRule',
|
|
24
|
-
'link',
|
|
25
|
-
'italic',
|
|
26
|
-
'bold',
|
|
27
|
-
'orderedList',
|
|
28
|
-
'unorderedList',
|
|
29
|
-
'listItem',
|
|
30
|
-
'lineBreak',
|
|
31
|
-
'pre',
|
|
32
|
-
] as const
|
|
33
|
-
|
|
34
|
-
export type MarkdownTypes = (typeof markdownTypes)[number]
|
|
35
|
-
|
|
36
|
-
export type BlockTypes = (typeof blockTypes)[number]
|
|
37
|
-
export type BlockStyles = NonNullable<Theme['message']>['blocks']
|
|
38
|
-
|
|
39
|
-
export type BlockObject =
|
|
40
|
-
| DropdownBlock
|
|
41
|
-
| ButtonBlock
|
|
42
|
-
| TextBlock
|
|
43
|
-
| ImageBlock
|
|
44
|
-
| AudioBlock
|
|
45
|
-
| VideoBlock
|
|
46
|
-
| FileBlock
|
|
47
|
-
| LocationBlock
|
|
48
|
-
| ColumnBlock
|
|
49
|
-
| RowBlock
|
|
50
|
-
| BubbleBlock
|
|
51
|
-
| CarouselBlock
|
|
52
|
-
|
|
53
|
-
export type Sender = {
|
|
54
|
-
name: string
|
|
55
|
-
avatar?: string
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export type MessageObject = {
|
|
59
|
-
direction: 'incoming' | 'outgoing' | 'system'
|
|
60
|
-
disableInput?: boolean
|
|
61
|
-
sender: Sender
|
|
62
|
-
timestamp: Date
|
|
63
|
-
block: BlockObject
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type ButtonBlock = {
|
|
67
|
-
type: 'button'
|
|
68
|
-
variant: 'action' | 'link'
|
|
69
|
-
reusable?: boolean
|
|
70
|
-
groupId?: string
|
|
71
|
-
text: string
|
|
72
|
-
buttonValue: string
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export type TextBlock = {
|
|
76
|
-
type: 'text'
|
|
77
|
-
text: string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export type ImageBlock = {
|
|
81
|
-
type: 'image'
|
|
82
|
-
orientation?: 'portrait' | 'landscape' | 'square' | 'auto'
|
|
83
|
-
url: string
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type AudioBlock = {
|
|
87
|
-
type: 'audio'
|
|
88
|
-
url: string
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export type VideoBlock = {
|
|
92
|
-
type: 'video'
|
|
93
|
-
url: string
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export type FileBlock = {
|
|
97
|
-
type: 'file'
|
|
98
|
-
url: string
|
|
99
|
-
title?: string
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
type DropdownChoice = {
|
|
103
|
-
label: string
|
|
104
|
-
value: string
|
|
105
|
-
}
|
|
106
|
-
export type DropdownBlock = {
|
|
107
|
-
label?: string
|
|
108
|
-
type: 'dropdown'
|
|
109
|
-
reusable?: boolean
|
|
110
|
-
options: DropdownChoice[]
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export type LocationBlock = {
|
|
114
|
-
type: 'location'
|
|
115
|
-
latitude: number
|
|
116
|
-
longitude: number
|
|
117
|
-
title?: string
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export type ColumnBlock = {
|
|
121
|
-
type: 'column'
|
|
122
|
-
blocks: BlockObject[]
|
|
123
|
-
horizontalAlignment?: 'left' | 'center' | 'right'
|
|
124
|
-
verticalAlignment?: 'top' | 'center' | 'bottom' | 'stretch'
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export type RowBlock = {
|
|
128
|
-
type: 'row'
|
|
129
|
-
blocks: BlockObject[]
|
|
130
|
-
horizontalAlignment?: 'left' | 'center' | 'right' | 'stretch'
|
|
131
|
-
verticalAlignment?: 'top' | 'center' | 'bottom'
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export type CarouselBlock = {
|
|
135
|
-
type: 'carousel'
|
|
136
|
-
blocks: BlockObject[]
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export type BubbleBlock = {
|
|
140
|
-
type: 'bubble'
|
|
141
|
-
block: BlockObject
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export type CommonBlockProps = {
|
|
145
|
-
styles?: BlockStyles
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export type BlockMap<P extends BlockObject = BlockObject> = {
|
|
149
|
-
[T in P['type']]: Extract<P, { type: T }>
|
|
150
|
-
}
|
package/src/types/image.ts
DELETED
package/src/types/index.ts
DELETED
package/src/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
package/tailwind.config.js
DELETED
|
File without changes
|
package/tsconfig.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
|
|
10
|
-
/* Bundler mode */
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"allowImportingTsExtensions": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"jsx": "react-jsx",
|
|
17
|
-
|
|
18
|
-
/* Linting */
|
|
19
|
-
"strict": true,
|
|
20
|
-
"noUnusedLocals": false,
|
|
21
|
-
"noUnusedParameters": true,
|
|
22
|
-
"noFallthroughCasesInSwitch": true,
|
|
23
|
-
"forceConsistentCasingInFileNames": false,
|
|
24
|
-
|
|
25
|
-
"typeRoots": ["./node_modules/@types"],
|
|
26
|
-
"outDir": "./dist"
|
|
27
|
-
},
|
|
28
|
-
"include": ["src"],
|
|
29
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
30
|
-
}
|
package/tsconfig.node.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import react from '@vitejs/plugin-react-swc'
|
|
3
|
-
import svgr from 'vite-plugin-svgr'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import dts from 'vite-plugin-dts'
|
|
6
|
-
|
|
7
|
-
// https://vitejs.dev/config/
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
plugins: [react(), svgr({ include: '**/*.svg' }), dts()],
|
|
10
|
-
build: {
|
|
11
|
-
lib: {
|
|
12
|
-
// Could also be a dictionary or array of multiple entry points
|
|
13
|
-
entry: path.join(__dirname, 'src/index.ts'),
|
|
14
|
-
name: 'Webchat',
|
|
15
|
-
// the proper extensions will be added
|
|
16
|
-
fileName: 'index',
|
|
17
|
-
},
|
|
18
|
-
rollupOptions: {
|
|
19
|
-
// make sure to externalize deps that shouldn't be bundled
|
|
20
|
-
// into your library
|
|
21
|
-
external: ['react'],
|
|
22
|
-
output: {
|
|
23
|
-
// Provide global variables to use in the UMD build
|
|
24
|
-
// for externalized deps
|
|
25
|
-
globals: {
|
|
26
|
-
react: 'React',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
})
|