@botpress/webchat 1.3.2 → 1.3.4

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 (62) hide show
  1. package/.turbo/turbo-build.log +23 -0
  2. package/dist/adapters/messaging-to-target.d.ts +72 -40
  3. package/dist/adapters/target.d.ts +5 -0
  4. package/dist/adapters/webchat-to-target.d.ts +58 -34
  5. package/dist/client/MessagingClient/client.d.ts +1 -0
  6. package/dist/client/PushpinClient/inner-client/index.d.ts +2 -2
  7. package/dist/client/types.d.ts +1 -0
  8. package/dist/components/Block.d.ts +7 -5
  9. package/dist/contexts/WebchatContext.d.ts +3 -7
  10. package/dist/gen/client/index.d.ts +78 -13
  11. package/dist/gen/{models/message.t.d.ts → client/models.d.ts} +91 -3
  12. package/dist/gen/client/operations/addParticipant.d.ts +51 -0
  13. package/dist/gen/client/operations/createConversation.d.ts +39 -0
  14. package/dist/gen/client/operations/createEvent.d.ts +79 -0
  15. package/dist/gen/client/operations/createMessage.d.ts +274 -0
  16. package/dist/gen/client/operations/createUser.d.ts +60 -0
  17. package/dist/gen/client/operations/deleteConversation.d.ts +22 -0
  18. package/dist/gen/client/operations/deleteMessage.d.ts +22 -0
  19. package/dist/gen/client/operations/deleteUser.d.ts +21 -0
  20. package/dist/gen/client/operations/getConversation.d.ts +36 -0
  21. package/dist/gen/client/operations/getEvent.d.ts +58 -0
  22. package/dist/gen/client/operations/getMessage.d.ts +157 -0
  23. package/dist/gen/client/operations/getParticipant.d.ts +48 -0
  24. package/dist/gen/client/operations/getUser.d.ts +46 -0
  25. package/dist/gen/client/operations/listConversationMessages.d.ts +161 -0
  26. package/dist/gen/client/operations/listConversations.d.ts +42 -0
  27. package/dist/gen/client/operations/listParticipants.d.ts +51 -0
  28. package/dist/gen/client/operations/listenConversation.d.ts +22 -0
  29. package/dist/gen/client/operations/removeParticipant.d.ts +23 -0
  30. package/dist/gen/client/operations/updateUser.d.ts +60 -0
  31. package/dist/gen/signals/{customSignal.t.d.ts → custom.t.d.ts} +1 -1
  32. package/dist/gen/signals/index.d.ts +16 -16
  33. package/dist/gen/signals/{messageCreatedSignal.t.d.ts → messageCreated.t.d.ts} +1 -1
  34. package/dist/gen/signals/{webchatConfigSignal.t.d.ts → webchatConfig.t.d.ts} +1 -1
  35. package/dist/gen/signals/{webchatVisibilitySignal.t.d.ts → webchatVisibility.t.d.ts} +1 -1
  36. package/dist/index.js +32913 -21174
  37. package/dist/index.umd.cjs +278 -95
  38. package/dist/types/block-type.d.ts +3 -3
  39. package/openapi.ts +6 -11
  40. package/package.json +4 -1
  41. package/dist/gen/client/api.d.ts +0 -2012
  42. package/dist/gen/client/base.d.ts +0 -54
  43. package/dist/gen/client/client.d.ts +0 -61
  44. package/dist/gen/client/common.d.ts +0 -65
  45. package/dist/gen/client/configuration.d.ts +0 -83
  46. package/dist/gen/models/conversation.j.d.ts +0 -20
  47. package/dist/gen/models/conversation.t.d.ts +0 -10
  48. package/dist/gen/models/conversation.z.d.ts +0 -15
  49. package/dist/gen/models/index.d.ts +0 -1014
  50. package/dist/gen/models/message.j.d.ts +0 -490
  51. package/dist/gen/models/message.z.d.ts +0 -439
  52. package/dist/gen/models/user.j.d.ts +0 -26
  53. package/dist/gen/models/user.t.d.ts +0 -12
  54. package/dist/gen/models/user.z.d.ts +0 -21
  55. /package/dist/gen/signals/{customSignal.j.d.ts → custom.j.d.ts} +0 -0
  56. /package/dist/gen/signals/{customSignal.z.d.ts → custom.z.d.ts} +0 -0
  57. /package/dist/gen/signals/{messageCreatedSignal.j.d.ts → messageCreated.j.d.ts} +0 -0
  58. /package/dist/gen/signals/{messageCreatedSignal.z.d.ts → messageCreated.z.d.ts} +0 -0
  59. /package/dist/gen/signals/{webchatConfigSignal.j.d.ts → webchatConfig.j.d.ts} +0 -0
  60. /package/dist/gen/signals/{webchatConfigSignal.z.d.ts → webchatConfig.z.d.ts} +0 -0
  61. /package/dist/gen/signals/{webchatVisibilitySignal.j.d.ts → webchatVisibility.j.d.ts} +0 -0
  62. /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,17 +5,11 @@ 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
9
-
10
- const DEFAULT_OPENAPI_GEN_ENDPOINT = 'http://api.openapi-generator.tech'
8
+ const yargz = yargsExtra.default as ReturnType<typeof yargs>
11
9
 
12
10
  const configSchema = {
13
11
  outDir: {
14
- type: 'string',
15
- },
16
- openapiEndpoint: {
17
- type: 'string',
18
- default: DEFAULT_OPENAPI_GEN_ENDPOINT,
12
+ type: 'string' as const,
19
13
  },
20
14
  } satisfies YargsSchema
21
15
 
@@ -29,11 +23,12 @@ void yargz
29
23
  }
30
24
 
31
25
  const clientDir = pathlib.join(config.outDir, 'client')
26
+ await api.exportClient(clientDir, {
27
+ generator: 'opapi',
28
+ })
29
+
32
30
  const signalsDir = pathlib.join(config.outDir, 'signals')
33
- const modelsDir = pathlib.join(config.outDir, 'models')
34
- await api.exportClient(clientDir, config.openapiEndpoint)
35
31
  await api.signals.exportSchemas(signalsDir)
36
- await api.models.exportSchemas(modelsDir)
37
32
  })
38
33
  .showHelpOnFail(false)
39
34
  .help()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.cjs",
@@ -26,11 +26,13 @@
26
26
  "@radix-ui/react-avatar": "^1.0.3",
27
27
  "@radix-ui/react-collapsible": "^1.0.3",
28
28
  "@radix-ui/react-dialog": "^1.0.4",
29
+ "@types/qs": "^6.9.8",
29
30
  "axios": "1.2.5",
30
31
  "clsx": "^2.0.0",
31
32
  "dayjs": "^1.11.10",
32
33
  "embla-carousel-react": "8.0.0-rc11",
33
34
  "event-source-polyfill": "^1.0.31",
35
+ "qs": "^6.11.2",
34
36
  "react": "^18.2.0",
35
37
  "react-dom": "^18.2.0",
36
38
  "react-hot-toast": "^2.4.1",
@@ -46,6 +48,7 @@
46
48
  "@bpinternal/es-node": "^0.0.4",
47
49
  "@bpinternal/yargs-extra": "^0.0.3",
48
50
  "@types/event-source-polyfill": "^1.0.2",
51
+ "@types/json-schema": "^7.0.15",
49
52
  "@types/react": "^18.0.37",
50
53
  "@types/react-dom": "^18.0.11",
51
54
  "@types/uuid": "^9.0.7",