@botpress/webchat 1.3.0 → 1.3.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/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 +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 +2 -1
- package/dist/gen/client/api.d.ts +23 -23
- package/dist/gen/client/client.d.ts +19 -19
- package/dist/index.js +9021 -8872
- package/dist/index.umd.cjs +79 -79
- package/dist/schemas/init.d.ts +3828 -22
- package/dist/types/block-type.d.ts +1 -1
- package/dist/types/init.d.ts +1 -0
- package/openapi.ts +40 -0
- package/package.json +6 -3
- package/openapi/index.ts +0 -31
- package/openapi/package.json +0 -5
- package/openapi/readme.md +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Theme } from './theme';
|
|
2
|
-
import { target } from '
|
|
2
|
+
import { target } from '../adapters';
|
|
3
3
|
export type BlockTypes = 'button' | 'text' | 'image' | 'audio' | 'video' | 'file' | 'location' | 'column' | 'row' | 'bubble' | 'carousel' | 'dropdown';
|
|
4
4
|
export type BlockStyles = NonNullable<Theme['message']>['blocks'];
|
|
5
5
|
export type AudioBlock = target.AudioMessage;
|
package/dist/types/init.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ import * as schemas from '../schemas';
|
|
|
3
3
|
export type StateProps = z.infer<typeof schemas.statePropsSchema>;
|
|
4
4
|
export type UserProps = z.infer<typeof schemas.userPropsSchema>;
|
|
5
5
|
export type ClientModeProps = z.infer<typeof schemas.clientModePropsSchema>;
|
|
6
|
+
export type ConfigProps = z.infer<typeof schemas.configPropsSchema>;
|
|
6
7
|
export type InitProps = z.infer<typeof schemas.initPropsSchema>;
|
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.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"type:check": "tsc --noEmit",
|
|
17
17
|
"build": "vite build",
|
|
18
18
|
"test": "vitest run",
|
|
19
|
-
"gen:client": "
|
|
19
|
+
"gen:client": "OUT_DIR=./src/gen es-node ./openapi"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@botpress/messaging-socket": "^1.3.0",
|
|
@@ -38,22 +38,25 @@
|
|
|
38
38
|
"react-use": "^17.4.0",
|
|
39
39
|
"remark-breaks": "^4.0.0",
|
|
40
40
|
"remark-gfm": "^4.0.0",
|
|
41
|
+
"uuid": "^9.0.1",
|
|
41
42
|
"zod": "^3.21.4",
|
|
42
43
|
"zustand": "^4.4.1"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
46
|
+
"@bpinternal/es-node": "^0.0.4",
|
|
45
47
|
"@bpinternal/yargs-extra": "^0.0.3",
|
|
46
48
|
"@types/event-source-polyfill": "^1.0.2",
|
|
47
49
|
"@types/react": "^18.0.37",
|
|
48
50
|
"@types/react-dom": "^18.0.11",
|
|
51
|
+
"@types/uuid": "^9.0.7",
|
|
49
52
|
"@types/web": "^0.0.115",
|
|
50
53
|
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
51
|
-
"webchat-adapters": "workspace:*",
|
|
52
54
|
"typescript": "^5.4.3",
|
|
53
55
|
"vite": "^4.3.9",
|
|
54
56
|
"vite-plugin-dts": "^3.5.4",
|
|
55
57
|
"vite-plugin-svgr": "^3.2.0",
|
|
56
58
|
"vitest": "^0.34.6",
|
|
59
|
+
"webchat-adapters": "workspace:*",
|
|
57
60
|
"webchat-api": "workspace:*"
|
|
58
61
|
}
|
|
59
62
|
}
|
package/openapi/index.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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()
|
package/openapi/package.json
DELETED
package/openapi/readme.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
this script must have its own dedicated package.json and tsconfig.json to run properly with ts-node
|