@botpress/webchat 1.2.0 → 1.3.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.
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/messaging-to-target.d.ts +151 -0
- package/dist/adapters/target.d.ts +77 -0
- package/dist/adapters/webchat-to-target.d.ts +126 -0
- package/dist/client/MessagingClient/client.d.ts +7 -4
- package/dist/client/PushpinClient/index.d.ts +4 -2
- package/dist/client/PushpinClient/inner-client/index.d.ts +2 -0
- package/dist/client/types.d.ts +4 -1
- package/dist/components/Avatar.d.ts +2 -3
- package/dist/components/Block.d.ts +3 -2
- package/dist/components/CloseWindow.d.ts +5 -0
- package/dist/components/Composer.d.ts +1 -1
- package/dist/components/renderers/Audio.d.ts +1 -1
- package/dist/components/renderers/Carousel.d.ts +1 -1
- package/dist/components/renderers/File.d.ts +1 -1
- package/dist/components/renderers/Image.d.ts +1 -1
- package/dist/components/renderers/Location.d.ts +1 -1
- package/dist/components/renderers/Video.d.ts +1 -1
- package/dist/contexts/WebchatContext.d.ts +3 -3
- package/dist/gen/client/api.d.ts +349 -31
- package/dist/gen/client/client.d.ts +21 -17
- package/dist/gen/client/errors.d.ts +9 -2
- package/dist/gen/models/index.d.ts +186 -23
- package/dist/gen/models/message.j.d.ts +107 -5
- package/dist/gen/models/message.t.d.ts +49 -0
- package/dist/gen/models/message.z.d.ts +79 -12
- package/dist/gen/models/user.j.d.ts +0 -3
- package/dist/gen/models/user.t.d.ts +0 -1
- package/dist/gen/models/user.z.d.ts +0 -3
- package/dist/gen/signals/index.d.ts +218 -23
- package/dist/gen/signals/messageCreatedSignal.j.d.ts +107 -5
- package/dist/gen/signals/messageCreatedSignal.t.d.ts +49 -0
- package/dist/gen/signals/messageCreatedSignal.z.d.ts +111 -18
- package/dist/get-client.d.ts +8 -0
- package/dist/hooks/useClient.d.ts +2 -2
- package/dist/hooks/useWebchatStore.d.ts +3 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +33301 -40913
- package/dist/index.umd.cjs +96 -125
- package/dist/providers/WebchatProvider.d.ts +4 -3
- package/dist/schemas/configuration.d.ts +117 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/init.d.ts +7650 -0
- package/dist/schemas/theme.d.ts +231 -232
- package/dist/types/block-type.d.ts +3 -6
- package/dist/types/configuration.d.ts +4 -16
- package/dist/types/index.d.ts +2 -0
- package/dist/types/init.d.ts +7 -0
- package/dist/types/theme.d.ts +7 -0
- package/dist/utils/index.d.ts +0 -2
- package/openapi.ts +40 -0
- package/package.json +15 -38
- package/dist/App.d.ts +0 -11
- package/dist/components/dev-tools/DevTools.d.ts +0 -1
- package/dist/components/dev-tools/configuration.d.ts +0 -2
- package/dist/components/dev-tools/helpers.d.ts +0 -5
- package/dist/main.d.ts +0 -0
- package/dist/options.d.ts +0 -11
- package/dist/themes/base.d.ts +0 -3
- package/dist/themes/baseColors.d.ts +0 -736
- package/dist/themes/dawn.d.ts +0 -4
- package/dist/themes/eggplant.d.ts +0 -4
- package/dist/themes/index.d.ts +0 -3
- package/dist/themes/prism.d.ts +0 -4
- package/dist/themes/themeBuilder.d.ts +0 -27
- package/dist/twind.config.d.ts +0 -9
- package/dist/twind.d.ts +0 -16
- package/dist/utils/mergeThemes.d.ts +0 -2
- package/dist/utils/withBaseTheme.d.ts +0 -384
- package/openapi/index.ts +0 -31
- package/openapi/package.json +0 -5
- package/openapi/readme.md +0 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { target } from '
|
|
3
|
-
export
|
|
4
|
-
export declare const markdownTypes: readonly ["heading1", "heading2", "heading3", "text", "horizontalRule", "link", "italic", "bold", "orderedList", "unorderedList", "listItem", "lineBreak", "pre"];
|
|
5
|
-
export type MarkdownTypes = (typeof markdownTypes)[number];
|
|
6
|
-
export type BlockTypes = (typeof blockTypes)[number];
|
|
1
|
+
import { Theme } from './theme';
|
|
2
|
+
import { target } from '../adapters';
|
|
3
|
+
export type BlockTypes = 'button' | 'text' | 'image' | 'audio' | 'video' | 'file' | 'location' | 'column' | 'row' | 'bubble' | 'carousel' | 'dropdown';
|
|
7
4
|
export type BlockStyles = NonNullable<Theme['message']>['blocks'];
|
|
8
5
|
export type AudioBlock = target.AudioMessage;
|
|
9
6
|
export type BubbleBlock = target.BubbleMessage;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type Configuration = {
|
|
6
|
-
composerPlaceholder?: string;
|
|
7
|
-
botName?: string;
|
|
8
|
-
botAvatar?: string;
|
|
9
|
-
botDescription?: string;
|
|
10
|
-
website?: DescriptionItem;
|
|
11
|
-
email?: DescriptionItem;
|
|
12
|
-
phone?: DescriptionItem;
|
|
13
|
-
privacyPolicy?: DescriptionItem;
|
|
14
|
-
termsOfService?: DescriptionItem;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as schemas from '../schemas';
|
|
3
|
+
export type DescriptionItem = z.infer<typeof schemas.descriptionItemSchema>;
|
|
4
|
+
export type Configuration = z.infer<typeof schemas.configurationSchema>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as schemas from '../schemas';
|
|
3
|
+
export type StateProps = z.infer<typeof schemas.statePropsSchema>;
|
|
4
|
+
export type UserProps = z.infer<typeof schemas.userPropsSchema>;
|
|
5
|
+
export type ClientModeProps = z.infer<typeof schemas.clientModePropsSchema>;
|
|
6
|
+
export type ConfigProps = z.infer<typeof schemas.configPropsSchema>;
|
|
7
|
+
export type InitProps = z.infer<typeof schemas.initPropsSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as schemas from '../schemas';
|
|
3
|
+
export type MarkdownType = z.infer<typeof schemas.markdownTypeSchema>;
|
|
4
|
+
export type StyleOption = z.infer<typeof schemas.styleOptionSchema>;
|
|
5
|
+
export type AvatarTheme = z.infer<typeof schemas.avatarThemeSchema>;
|
|
6
|
+
export type BlocksTheme = z.infer<typeof schemas.blockThemeSchema>;
|
|
7
|
+
export type Theme = z.infer<typeof schemas.themeSchema>;
|
package/dist/utils/index.d.ts
CHANGED
package/openapi.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
import type { default as yargs } from '@bpinternal/yargs-extra'
|
|
3
|
+
import { parseEnv, YargsSchema } from '@bpinternal/yargs-extra'
|
|
4
|
+
import { api } from 'webchat-api'
|
|
5
|
+
import pathlib from 'path'
|
|
6
|
+
|
|
7
|
+
const yargsExtra = require('@bpinternal/yargs-extra') // running script from an esm module
|
|
8
|
+
const yargz = yargsExtra.default as typeof yargs
|
|
9
|
+
|
|
10
|
+
const DEFAULT_OPENAPI_GEN_ENDPOINT = 'http://api.openapi-generator.tech'
|
|
11
|
+
|
|
12
|
+
const configSchema = {
|
|
13
|
+
outDir: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
},
|
|
16
|
+
openapiEndpoint: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
default: DEFAULT_OPENAPI_GEN_ENDPOINT,
|
|
19
|
+
},
|
|
20
|
+
} satisfies YargsSchema
|
|
21
|
+
|
|
22
|
+
const description = 'Generate OpenAPI client'
|
|
23
|
+
|
|
24
|
+
void yargz
|
|
25
|
+
.command('$0', description, configSchema, async (argv) => {
|
|
26
|
+
const config = { ...argv, ...parseEnv(configSchema) }
|
|
27
|
+
if (!config.outDir) {
|
|
28
|
+
throw new Error('outDir is required')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const clientDir = pathlib.join(config.outDir, 'client')
|
|
32
|
+
const signalsDir = pathlib.join(config.outDir, 'signals')
|
|
33
|
+
const modelsDir = pathlib.join(config.outDir, 'models')
|
|
34
|
+
await api.exportClient(clientDir, config.openapiEndpoint)
|
|
35
|
+
await api.signals.exportSchemas(signalsDir)
|
|
36
|
+
await api.models.exportSchemas(modelsDir)
|
|
37
|
+
})
|
|
38
|
+
.showHelpOnFail(false)
|
|
39
|
+
.help()
|
|
40
|
+
.parse()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/webchat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -14,72 +14,49 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"type:check": "tsc --noEmit",
|
|
17
|
-
"
|
|
18
|
-
"build": "pnpm type:check && vite build",
|
|
19
|
-
"inspect-build": "vite build --sourcemap && npx source-map-explorer dist/index.js --no-border-checks",
|
|
20
|
-
"bundle": "vite build",
|
|
21
|
-
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
22
|
-
"preview": "vite preview",
|
|
17
|
+
"build": "vite build",
|
|
23
18
|
"test": "vitest run",
|
|
24
|
-
"gen:client": "
|
|
19
|
+
"gen:client": "OUT_DIR=./src/gen es-node ./openapi"
|
|
25
20
|
},
|
|
26
21
|
"dependencies": {
|
|
27
|
-
"@botpress/messaging-socket": "^1.
|
|
22
|
+
"@botpress/messaging-socket": "^1.3.0",
|
|
28
23
|
"@floating-ui/react": "^0.25.4",
|
|
29
24
|
"@headlessui/react": "1.7.11",
|
|
30
25
|
"@heroicons/react": "^2.0.18",
|
|
31
|
-
"@radix-ui/colors": "^3.0.0",
|
|
32
26
|
"@radix-ui/react-avatar": "^1.0.3",
|
|
33
27
|
"@radix-ui/react-collapsible": "^1.0.3",
|
|
34
28
|
"@radix-ui/react-dialog": "^1.0.4",
|
|
35
|
-
"@radix-ui/react-icons": "^1.3.0",
|
|
36
|
-
"@tailwindcss/container-queries": "^0.1.1",
|
|
37
|
-
"@types/culori": "^2.0.4",
|
|
38
|
-
"@types/react-color": "^3.0.10",
|
|
39
29
|
"axios": "1.2.5",
|
|
40
|
-
"classnames": "^2.3.2",
|
|
41
30
|
"clsx": "^2.0.0",
|
|
42
|
-
"culori": "^3.3.0",
|
|
43
31
|
"dayjs": "^1.11.10",
|
|
44
32
|
"embla-carousel-react": "8.0.0-rc11",
|
|
45
33
|
"event-source-polyfill": "^1.0.31",
|
|
46
|
-
"lodash": "^4.17.21",
|
|
47
34
|
"react": "^18.2.0",
|
|
48
|
-
"react-color": "^2.19.3",
|
|
49
35
|
"react-dom": "^18.2.0",
|
|
50
36
|
"react-hot-toast": "^2.4.1",
|
|
51
|
-
"react-markdown": "^
|
|
37
|
+
"react-markdown": "^9.0.1",
|
|
52
38
|
"react-use": "^17.4.0",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"uuid": "^9.0.
|
|
56
|
-
"vite-plugin-svgr": "^3.2.0",
|
|
39
|
+
"remark-breaks": "^4.0.0",
|
|
40
|
+
"remark-gfm": "^4.0.0",
|
|
41
|
+
"uuid": "^9.0.1",
|
|
57
42
|
"zod": "^3.21.4",
|
|
58
43
|
"zustand": "^4.4.1"
|
|
59
44
|
},
|
|
60
45
|
"devDependencies": {
|
|
46
|
+
"@bpinternal/es-node": "^0.0.4",
|
|
61
47
|
"@bpinternal/yargs-extra": "^0.0.3",
|
|
62
|
-
"@twind/core": "^1.1.3",
|
|
63
|
-
"@twind/intellisense": "^1.1.3",
|
|
64
|
-
"@twind/preset-autoprefix": "^1.0.7",
|
|
65
|
-
"@twind/preset-container-queries": "^1.0.7",
|
|
66
|
-
"@twind/preset-tailwind": "^1.1.4",
|
|
67
|
-
"@twind/with-react": "^1.1.3",
|
|
68
|
-
"@types/color-convert": "^2.0.1",
|
|
69
48
|
"@types/event-source-polyfill": "^1.0.2",
|
|
70
|
-
"@types/lodash": "^4.14.199",
|
|
71
49
|
"@types/react": "^18.0.37",
|
|
72
50
|
"@types/react-dom": "^18.0.11",
|
|
73
|
-
"@types/uuid": "^9.0.
|
|
51
|
+
"@types/uuid": "^9.0.7",
|
|
74
52
|
"@types/web": "^0.0.115",
|
|
75
53
|
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
76
|
-
"
|
|
77
|
-
"webchat-api": "workspace:*",
|
|
78
|
-
"message-adapters": "workspace:*",
|
|
79
|
-
"tailwindcss": "^3.3.2",
|
|
80
|
-
"typescript": "^5.0.2",
|
|
54
|
+
"typescript": "^5.4.3",
|
|
81
55
|
"vite": "^4.3.9",
|
|
82
56
|
"vite-plugin-dts": "^3.5.4",
|
|
83
|
-
"
|
|
57
|
+
"vite-plugin-svgr": "^3.2.0",
|
|
58
|
+
"vitest": "^0.34.6",
|
|
59
|
+
"webchat-adapters": "workspace:*",
|
|
60
|
+
"webchat-api": "workspace:*"
|
|
84
61
|
}
|
|
85
62
|
}
|
package/dist/App.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
|
-
import { WebchatClient } from './client';
|
|
3
|
-
import { Container } from './components';
|
|
4
|
-
import { Theme } from './schemas';
|
|
5
|
-
type Props = {
|
|
6
|
-
theme: Theme;
|
|
7
|
-
client?: WebchatClient;
|
|
8
|
-
} & ComponentProps<typeof Container>;
|
|
9
|
-
export declare const App: ({ theme, client }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare function FabSample(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DevTools: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { BlockObject, MessageObject } from '../../types';
|
|
2
|
-
type Direction = 'incoming' | 'outgoing' | 'system';
|
|
3
|
-
export declare function messageInBubble(block: BlockObject, direction?: Direction): MessageObject;
|
|
4
|
-
export declare function splitCamelCase(text: string): string;
|
|
5
|
-
export {};
|
package/dist/main.d.ts
DELETED
|
File without changes
|
package/dist/options.d.ts
DELETED
package/dist/themes/base.d.ts
DELETED