@botpress/webchat 1.1.1 → 1.3.0
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/client/MessagingClient/client.d.ts +8 -19
- package/dist/client/{ChatClient → PushpinClient}/index.d.ts +7 -5
- package/dist/client/PushpinClient/inner-client/event-emitter.d.ts +10 -0
- package/dist/client/PushpinClient/inner-client/eventsource.d.ts +22 -0
- package/dist/client/PushpinClient/inner-client/index.d.ts +41 -0
- package/dist/client/PushpinClient/inner-client/signal-listener.d.ts +47 -0
- package/dist/client/{ChatClient → PushpinClient}/state-machine.d.ts +13 -13
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.d.ts +8 -2
- 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 +2 -2
- package/dist/components/Header.d.ts +1 -1
- package/dist/components/LoadingIndicator.d.ts +1 -1
- package/dist/components/MessageList.d.ts +1 -1
- package/dist/components/Modal.d.ts +2 -2
- package/dist/components/RestartConversation.d.ts +1 -1
- package/dist/components/Webchat.d.ts +1 -1
- package/dist/components/renderers/Audio.d.ts +1 -1
- package/dist/components/renderers/Button.d.ts +1 -1
- package/dist/components/renderers/Carousel.d.ts +1 -1
- package/dist/components/renderers/Dropdown.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/Text.d.ts +1 -1
- package/dist/components/renderers/Video.d.ts +1 -1
- package/dist/contexts/WebchatContext.d.ts +6 -6
- package/dist/gen/client/api.d.ts +2012 -0
- package/dist/gen/client/base.d.ts +54 -0
- package/dist/gen/client/client.d.ts +61 -0
- package/dist/gen/client/common.d.ts +65 -0
- package/dist/gen/client/configuration.d.ts +83 -0
- package/dist/gen/client/errors.d.ts +204 -0
- package/dist/gen/client/index.d.ts +13 -0
- package/dist/gen/models/conversation.j.d.ts +20 -0
- package/dist/gen/models/conversation.t.d.ts +10 -0
- package/dist/gen/models/conversation.z.d.ts +15 -0
- package/dist/gen/models/index.d.ts +1014 -0
- package/dist/gen/models/message.j.d.ts +490 -0
- package/dist/gen/models/message.t.d.ts +122 -0
- package/dist/gen/models/message.z.d.ts +439 -0
- package/dist/gen/models/user.j.d.ts +26 -0
- package/dist/gen/models/user.t.d.ts +12 -0
- package/dist/gen/models/user.z.d.ts +21 -0
- package/dist/gen/signals/customSignal.j.d.ts +24 -0
- package/dist/gen/signals/customSignal.t.d.ts +13 -0
- package/dist/gen/signals/customSignal.z.d.ts +22 -0
- package/dist/gen/signals/index.d.ts +1249 -0
- package/dist/gen/signals/messageCreatedSignal.j.d.ts +501 -0
- package/dist/gen/signals/messageCreatedSignal.t.d.ts +125 -0
- package/dist/gen/signals/messageCreatedSignal.z.d.ts +608 -0
- package/dist/gen/signals/webchatConfigSignal.j.d.ts +24 -0
- package/dist/gen/signals/webchatConfigSignal.t.d.ts +13 -0
- package/dist/gen/signals/webchatConfigSignal.z.d.ts +22 -0
- package/dist/gen/signals/webchatVisibilitySignal.j.d.ts +24 -0
- package/dist/gen/signals/webchatVisibilitySignal.t.d.ts +11 -0
- package/dist/gen/signals/webchatVisibilitySignal.z.d.ts +22 -0
- package/dist/get-client.d.ts +8 -0
- package/dist/hooks/useClient.d.ts +3 -3
- package/dist/hooks/useWebchatStore.d.ts +3 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +31976 -85703
- package/dist/index.umd.cjs +117 -187
- package/dist/providers/ModalProvider.d.ts +1 -1
- package/dist/providers/WebchatProvider.d.ts +6 -5
- package/dist/schemas/configuration.d.ts +117 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/init.d.ts +3844 -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 +6 -0
- package/dist/types/theme.d.ts +7 -0
- package/dist/utils/index.d.ts +0 -2
- package/openapi/index.ts +31 -0
- package/openapi/package.json +5 -0
- package/openapi/readme.md +1 -0
- package/package.json +18 -38
- package/dist/App.d.ts +0 -11
- package/dist/client/MessagingClient/adapters/Trigger.d.ts +0 -33
- 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
|
@@ -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 'webchat-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,6 @@
|
|
|
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 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/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import yargs, { parseEnv, YargsSchema } from '@bpinternal/yargs-extra'
|
|
2
|
+
import { api } from 'webchat-api'
|
|
3
|
+
import pathlib from 'path'
|
|
4
|
+
|
|
5
|
+
const DEFAULT_OPENAPI_GEN_ENDPOINT = 'http://api.openapi-generator.tech'
|
|
6
|
+
|
|
7
|
+
const configSchema = {
|
|
8
|
+
outDir: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
demandOption: true,
|
|
11
|
+
},
|
|
12
|
+
openapiEndpoint: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: DEFAULT_OPENAPI_GEN_ENDPOINT,
|
|
15
|
+
},
|
|
16
|
+
} satisfies YargsSchema
|
|
17
|
+
|
|
18
|
+
const description = 'Generate OpenAPI client'
|
|
19
|
+
void yargs
|
|
20
|
+
.command('$0', description, configSchema, async (argv) => {
|
|
21
|
+
const args = { ...argv, ...parseEnv(configSchema) }
|
|
22
|
+
|
|
23
|
+
const clientDir = pathlib.join(args.outDir, 'client')
|
|
24
|
+
const signalsDir = pathlib.join(args.outDir, 'signals')
|
|
25
|
+
const modelsDir = pathlib.join(args.outDir, 'models')
|
|
26
|
+
await api.exportClient(clientDir, args.openapiEndpoint)
|
|
27
|
+
await api.signals.exportSchemas(signalsDir)
|
|
28
|
+
await api.models.exportSchemas(modelsDir)
|
|
29
|
+
})
|
|
30
|
+
.help()
|
|
31
|
+
.parse()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
this script must have its own dedicated package.json and tsconfig.json to run properly with ts-node
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/webchat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -14,66 +14,46 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"type:check": "tsc --noEmit",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"bundle": "vite build",
|
|
21
|
-
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
22
|
-
"preview": "vite preview",
|
|
23
|
-
"test": "vitest run"
|
|
17
|
+
"build": "vite build",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"gen:client": "ts-node -T ./openapi --out-dir ./src/gen"
|
|
24
20
|
},
|
|
25
21
|
"dependencies": {
|
|
26
|
-
"@botpress/
|
|
27
|
-
"@botpress/messaging-socket": "^1.2.0",
|
|
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
|
-
"
|
|
36
|
-
"@tailwindcss/container-queries": "^0.1.1",
|
|
37
|
-
"@types/culori": "^2.0.4",
|
|
38
|
-
"@types/react-color": "^3.0.10",
|
|
39
|
-
"classnames": "^2.3.2",
|
|
29
|
+
"axios": "1.2.5",
|
|
40
30
|
"clsx": "^2.0.0",
|
|
41
|
-
"culori": "^3.3.0",
|
|
42
31
|
"dayjs": "^1.11.10",
|
|
43
32
|
"embla-carousel-react": "8.0.0-rc11",
|
|
44
|
-
"
|
|
33
|
+
"event-source-polyfill": "^1.0.31",
|
|
45
34
|
"react": "^18.2.0",
|
|
46
|
-
"react-color": "^2.19.3",
|
|
47
35
|
"react-dom": "^18.2.0",
|
|
48
36
|
"react-hot-toast": "^2.4.1",
|
|
49
|
-
"react-markdown": "^
|
|
37
|
+
"react-markdown": "^9.0.1",
|
|
50
38
|
"react-use": "^17.4.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"uuid": "^9.0.0",
|
|
54
|
-
"vite-plugin-svgr": "^3.2.0",
|
|
39
|
+
"remark-breaks": "^4.0.0",
|
|
40
|
+
"remark-gfm": "^4.0.0",
|
|
55
41
|
"zod": "^3.21.4",
|
|
56
42
|
"zustand": "^4.4.1"
|
|
57
43
|
},
|
|
58
44
|
"devDependencies": {
|
|
59
|
-
"
|
|
60
|
-
"@
|
|
61
|
-
"@twind/intellisense": "^1.1.3",
|
|
62
|
-
"@twind/preset-autoprefix": "^1.0.7",
|
|
63
|
-
"@twind/preset-container-queries": "^1.0.7",
|
|
64
|
-
"@twind/preset-tailwind": "^1.1.4",
|
|
65
|
-
"@twind/with-react": "^1.1.3",
|
|
66
|
-
"@types/color-convert": "^2.0.1",
|
|
67
|
-
"@types/lodash": "^4.14.199",
|
|
45
|
+
"@bpinternal/yargs-extra": "^0.0.3",
|
|
46
|
+
"@types/event-source-polyfill": "^1.0.2",
|
|
68
47
|
"@types/react": "^18.0.37",
|
|
69
48
|
"@types/react-dom": "^18.0.11",
|
|
70
|
-
"@types/
|
|
49
|
+
"@types/web": "^0.0.115",
|
|
71
50
|
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"typescript": "^5.0.2",
|
|
51
|
+
"webchat-adapters": "workspace:*",
|
|
52
|
+
"typescript": "^5.4.3",
|
|
75
53
|
"vite": "^4.3.9",
|
|
76
54
|
"vite-plugin-dts": "^3.5.4",
|
|
77
|
-
"
|
|
55
|
+
"vite-plugin-svgr": "^3.2.0",
|
|
56
|
+
"vitest": "^0.34.6",
|
|
57
|
+
"webchat-api": "workspace:*"
|
|
78
58
|
}
|
|
79
59
|
}
|
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) => JSX.Element;
|
|
10
|
-
export declare function FabSample(props: Props): JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const TriggerSchema: z.ZodObject<{
|
|
3
|
-
trigger: z.ZodUnion<[z.ZodObject<{
|
|
4
|
-
type: z.ZodLiteral<"webchat-visibility">;
|
|
5
|
-
visibility: z.ZodUnion<[z.ZodLiteral<"show">, z.ZodLiteral<"hide">, z.ZodLiteral<"toggle">]>;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
type: "webchat-visibility";
|
|
8
|
-
visibility: "hide" | "show" | "toggle";
|
|
9
|
-
}, {
|
|
10
|
-
type: "webchat-visibility";
|
|
11
|
-
visibility: "hide" | "show" | "toggle";
|
|
12
|
-
}>, z.ZodObject<{
|
|
13
|
-
type: z.ZodLiteral<"custom-event">;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
type: "custom-event";
|
|
16
|
-
}, {
|
|
17
|
-
type: "custom-event";
|
|
18
|
-
}>]>;
|
|
19
|
-
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
trigger: {
|
|
21
|
-
type: "webchat-visibility";
|
|
22
|
-
visibility: "hide" | "show" | "toggle";
|
|
23
|
-
} | {
|
|
24
|
-
type: "custom-event";
|
|
25
|
-
};
|
|
26
|
-
}, {
|
|
27
|
-
trigger: {
|
|
28
|
-
type: "webchat-visibility";
|
|
29
|
-
visibility: "hide" | "show" | "toggle";
|
|
30
|
-
} | {
|
|
31
|
-
type: "custom-event";
|
|
32
|
-
};
|
|
33
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DevTools: () => 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