@botpress/webchat 1.1.1 → 1.2.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/App.d.ts +4 -4
- package/dist/client/MessagingClient/client.d.ts +2 -16
- package/dist/client/{ChatClient → PushpinClient}/index.d.ts +4 -4
- 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 +39 -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 +4 -1
- package/dist/components/Block.d.ts +1 -1
- package/dist/components/Composer.d.ts +1 -1
- 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/dev-tools/DevTools.d.ts +1 -1
- package/dist/components/renderers/Button.d.ts +1 -1
- package/dist/components/renderers/Dropdown.d.ts +1 -1
- package/dist/components/renderers/Text.d.ts +1 -1
- package/dist/contexts/WebchatContext.d.ts +4 -4
- package/dist/gen/client/api.d.ts +1694 -0
- package/dist/gen/client/base.d.ts +54 -0
- package/dist/gen/client/client.d.ts +57 -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 +197 -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 +851 -0
- package/dist/gen/models/message.j.d.ts +388 -0
- package/dist/gen/models/message.t.d.ts +73 -0
- package/dist/gen/models/message.z.d.ts +372 -0
- package/dist/gen/models/user.j.d.ts +29 -0
- package/dist/gen/models/user.t.d.ts +13 -0
- package/dist/gen/models/user.z.d.ts +24 -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 +1054 -0
- package/dist/gen/signals/messageCreatedSignal.j.d.ts +399 -0
- package/dist/gen/signals/messageCreatedSignal.t.d.ts +76 -0
- package/dist/gen/signals/messageCreatedSignal.z.d.ts +515 -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/hooks/useClient.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27937 -73852
- package/dist/index.umd.cjs +113 -154
- package/dist/options.d.ts +3 -3
- package/dist/providers/ModalProvider.d.ts +1 -1
- package/dist/providers/WebchatProvider.d.ts +3 -3
- package/openapi/index.ts +31 -0
- package/openapi/package.json +5 -0
- package/openapi/readme.md +1 -0
- package/package.json +10 -4
- package/dist/client/MessagingClient/adapters/Trigger.d.ts +0 -33
package/dist/options.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
type
|
|
1
|
+
type WebchatOptions = {
|
|
2
2
|
backend: 'messaging';
|
|
3
3
|
apiUrl: string;
|
|
4
4
|
clientId: string;
|
|
5
5
|
} | {
|
|
6
|
-
backend: '
|
|
6
|
+
backend: 'pushpin';
|
|
7
7
|
apiUrl: string;
|
|
8
8
|
clientId: string;
|
|
9
9
|
};
|
|
10
|
-
export declare const getOptions: () =>
|
|
10
|
+
export declare const getOptions: () => WebchatOptions;
|
|
11
11
|
export {};
|
|
@@ -4,5 +4,5 @@ export type ModalProps = {
|
|
|
4
4
|
content: ReactNode | null;
|
|
5
5
|
};
|
|
6
6
|
type Props = PropsWithChildren;
|
|
7
|
-
export declare const ModalProvider: ({ children }: Props) => JSX.Element;
|
|
7
|
+
export declare const ModalProvider: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type WebchatClient } from '../client';
|
|
3
3
|
import { ContextVaue, Renderers, WebchatContext } from '../contexts';
|
|
4
4
|
import { Theme } from '../schemas';
|
|
5
5
|
import { Configuration } from '../types';
|
|
6
6
|
type Props = {
|
|
7
7
|
theme?: Theme;
|
|
8
8
|
renderers?: Renderers;
|
|
9
|
-
client?:
|
|
9
|
+
client?: WebchatClient;
|
|
10
10
|
configuration?: Configuration;
|
|
11
11
|
defaultState?: Partial<ContextVaue['state']>;
|
|
12
12
|
children?: ReactNode | ((configuration: Configuration) => ReactNode);
|
|
13
13
|
} & Omit<ComponentProps<typeof WebchatContext.Provider>, 'value' | 'children'>;
|
|
14
|
-
export declare const WebchatProvider: ({ theme: initialTheme, renderers, client, children, configuration, ...props }: Props) => JSX.Element;
|
|
14
|
+
export declare const WebchatProvider: ({ theme: initialTheme, renderers, client, children, configuration, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|
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.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"bundle": "vite build",
|
|
21
21
|
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
22
22
|
"preview": "vite preview",
|
|
23
|
-
"test": "vitest run"
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"gen:client": "ts-node -T ./openapi --out-dir ./src/gen"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@botpress/chat": "0.2.4",
|
|
27
27
|
"@botpress/messaging-socket": "^1.2.0",
|
|
28
28
|
"@floating-ui/react": "^0.25.4",
|
|
29
29
|
"@headlessui/react": "1.7.11",
|
|
@@ -36,11 +36,13 @@
|
|
|
36
36
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
37
37
|
"@types/culori": "^2.0.4",
|
|
38
38
|
"@types/react-color": "^3.0.10",
|
|
39
|
+
"axios": "1.2.5",
|
|
39
40
|
"classnames": "^2.3.2",
|
|
40
41
|
"clsx": "^2.0.0",
|
|
41
42
|
"culori": "^3.3.0",
|
|
42
43
|
"dayjs": "^1.11.10",
|
|
43
44
|
"embla-carousel-react": "8.0.0-rc11",
|
|
45
|
+
"event-source-polyfill": "^1.0.31",
|
|
44
46
|
"lodash": "^4.17.21",
|
|
45
47
|
"react": "^18.2.0",
|
|
46
48
|
"react-color": "^2.19.3",
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
"zustand": "^4.4.1"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
|
-
"
|
|
61
|
+
"@bpinternal/yargs-extra": "^0.0.3",
|
|
60
62
|
"@twind/core": "^1.1.3",
|
|
61
63
|
"@twind/intellisense": "^1.1.3",
|
|
62
64
|
"@twind/preset-autoprefix": "^1.0.7",
|
|
@@ -64,12 +66,16 @@
|
|
|
64
66
|
"@twind/preset-tailwind": "^1.1.4",
|
|
65
67
|
"@twind/with-react": "^1.1.3",
|
|
66
68
|
"@types/color-convert": "^2.0.1",
|
|
69
|
+
"@types/event-source-polyfill": "^1.0.2",
|
|
67
70
|
"@types/lodash": "^4.14.199",
|
|
68
71
|
"@types/react": "^18.0.37",
|
|
69
72
|
"@types/react-dom": "^18.0.11",
|
|
70
73
|
"@types/uuid": "^9.0.3",
|
|
74
|
+
"@types/web": "^0.0.115",
|
|
71
75
|
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
72
76
|
"autoprefixer": "^10.4.14",
|
|
77
|
+
"webchat-api": "workspace:*",
|
|
78
|
+
"message-adapters": "workspace:*",
|
|
73
79
|
"tailwindcss": "^3.3.2",
|
|
74
80
|
"typescript": "^5.0.2",
|
|
75
81
|
"vite": "^4.3.9",
|
|
@@ -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
|
-
}>;
|