@botpress/webchat 1.3.1 → 1.3.3

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.
Files changed (36) hide show
  1. package/dist/adapters/messaging-to-target.d.ts +58 -26
  2. package/dist/adapters/target.d.ts +5 -0
  3. package/dist/adapters/webchat-to-target.d.ts +56 -32
  4. package/dist/client/MessagingClient/client.d.ts +1 -0
  5. package/dist/client/types.d.ts +1 -0
  6. package/dist/components/Block.d.ts +7 -5
  7. package/dist/contexts/WebchatContext.d.ts +5 -8
  8. package/dist/gen/client/api.d.ts +37 -10
  9. package/dist/gen/signals/{customSignal.t.d.ts → custom.t.d.ts} +1 -1
  10. package/dist/gen/signals/index.d.ts +16 -16
  11. package/dist/gen/signals/{messageCreatedSignal.t.d.ts → messageCreated.t.d.ts} +1 -1
  12. package/dist/gen/signals/{webchatConfigSignal.t.d.ts → webchatConfig.t.d.ts} +1 -1
  13. package/dist/gen/signals/{webchatVisibilitySignal.t.d.ts → webchatVisibility.t.d.ts} +1 -1
  14. package/dist/index.js +6923 -6940
  15. package/dist/index.umd.cjs +77 -77
  16. package/dist/types/block-type.d.ts +3 -3
  17. package/openapi.ts +4 -5
  18. package/package.json +2 -1
  19. package/dist/gen/models/conversation.j.d.ts +0 -20
  20. package/dist/gen/models/conversation.t.d.ts +0 -10
  21. package/dist/gen/models/conversation.z.d.ts +0 -15
  22. package/dist/gen/models/index.d.ts +0 -1014
  23. package/dist/gen/models/message.j.d.ts +0 -490
  24. package/dist/gen/models/message.t.d.ts +0 -122
  25. package/dist/gen/models/message.z.d.ts +0 -439
  26. package/dist/gen/models/user.j.d.ts +0 -26
  27. package/dist/gen/models/user.t.d.ts +0 -12
  28. package/dist/gen/models/user.z.d.ts +0 -21
  29. /package/dist/gen/signals/{customSignal.j.d.ts → custom.j.d.ts} +0 -0
  30. /package/dist/gen/signals/{customSignal.z.d.ts → custom.z.d.ts} +0 -0
  31. /package/dist/gen/signals/{messageCreatedSignal.j.d.ts → messageCreated.j.d.ts} +0 -0
  32. /package/dist/gen/signals/{messageCreatedSignal.z.d.ts → messageCreated.z.d.ts} +0 -0
  33. /package/dist/gen/signals/{webchatConfigSignal.j.d.ts → webchatConfig.j.d.ts} +0 -0
  34. /package/dist/gen/signals/{webchatConfigSignal.z.d.ts → webchatConfig.z.d.ts} +0 -0
  35. /package/dist/gen/signals/{webchatVisibilitySignal.j.d.ts → webchatVisibility.j.d.ts} +0 -0
  36. /package/dist/gen/signals/{webchatVisibilitySignal.z.d.ts → webchatVisibility.z.d.ts} +0 -0
@@ -1,6 +1,5 @@
1
1
  import { Theme } from './theme';
2
2
  import { target } from '../adapters';
3
- export type BlockTypes = 'button' | 'text' | 'image' | 'audio' | 'video' | 'file' | 'location' | 'column' | 'row' | 'bubble' | 'carousel' | 'dropdown';
4
3
  export type BlockStyles = NonNullable<Theme['message']>['blocks'];
5
4
  export type AudioBlock = target.AudioMessage;
6
5
  export type BubbleBlock = target.BubbleMessage;
@@ -15,6 +14,7 @@ export type RowBlock = target.RowMessage;
15
14
  export type TextBlock = target.TextMessage;
16
15
  export type VideoBlock = target.VideoMessage;
17
16
  export type BlockObject = target.Message;
17
+ export type BlockType = BlockObject['type'];
18
18
  export type Sender = {
19
19
  name: string;
20
20
  avatar?: string;
@@ -29,8 +29,8 @@ export type MessageObject<T = BlockObject> = {
29
29
  export type CommonBlockProps = {
30
30
  styles?: BlockStyles;
31
31
  };
32
- export type BlockMap<P extends BlockObject = BlockObject> = {
33
- [T in P['type']]: Extract<P, {
32
+ export type BlockObjects = {
33
+ [T in BlockType]: Extract<BlockObject, {
34
34
  type: T;
35
35
  }>;
36
36
  };
package/openapi.ts CHANGED
@@ -5,7 +5,7 @@ import { api } from 'webchat-api'
5
5
  import pathlib from 'path'
6
6
 
7
7
  const yargsExtra = require('@bpinternal/yargs-extra') // running script from an esm module
8
- const yargz = yargsExtra.default as typeof yargs
8
+ const yargz = yargsExtra.default as ReturnType<typeof yargs>
9
9
 
10
10
  const DEFAULT_OPENAPI_GEN_ENDPOINT = 'http://api.openapi-generator.tech'
11
11
 
@@ -17,7 +17,7 @@ const configSchema = {
17
17
  type: 'string',
18
18
  default: DEFAULT_OPENAPI_GEN_ENDPOINT,
19
19
  },
20
- } satisfies YargsSchema
20
+ } as const satisfies YargsSchema
21
21
 
22
22
  const description = 'Generate OpenAPI client'
23
23
 
@@ -29,11 +29,10 @@ void yargz
29
29
  }
30
30
 
31
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
32
  await api.exportClient(clientDir, config.openapiEndpoint)
33
+
34
+ const signalsDir = pathlib.join(config.outDir, 'signals')
35
35
  await api.signals.exportSchemas(signalsDir)
36
- await api.models.exportSchemas(modelsDir)
37
36
  })
38
37
  .showHelpOnFail(false)
39
38
  .help()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.cjs",
@@ -46,6 +46,7 @@
46
46
  "@bpinternal/es-node": "^0.0.4",
47
47
  "@bpinternal/yargs-extra": "^0.0.3",
48
48
  "@types/event-source-polyfill": "^1.0.2",
49
+ "@types/json-schema": "^7.0.15",
49
50
  "@types/react": "^18.0.37",
50
51
  "@types/react-dom": "^18.0.11",
51
52
  "@types/uuid": "^9.0.7",
@@ -1,20 +0,0 @@
1
- declare const _default: {
2
- type: string;
3
- properties: {
4
- id: {
5
- type: string;
6
- };
7
- createdAt: {
8
- type: string;
9
- format: string;
10
- };
11
- updatedAt: {
12
- type: string;
13
- format: string;
14
- };
15
- };
16
- required: string[];
17
- additionalProperties: boolean;
18
- $schema: string;
19
- };
20
- export default _default;
@@ -1,10 +0,0 @@
1
- /**
2
- * This file was automatically generated by json-schema-to-typescript.
3
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
- * and run json-schema-to-typescript to regenerate this file.
5
- */
6
- export interface Conversation {
7
- id: string;
8
- createdAt: string;
9
- updatedAt: string;
10
- }
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- declare const _default: z.ZodObject<{
3
- id: z.ZodString;
4
- createdAt: z.ZodString;
5
- updatedAt: z.ZodString;
6
- }, "strip", z.ZodTypeAny, {
7
- id: string;
8
- createdAt: string;
9
- updatedAt: string;
10
- }, {
11
- id: string;
12
- createdAt: string;
13
- updatedAt: string;
14
- }>;
15
- export default _default;