@botpress/webchat 1.0.31 → 1.1.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.
Files changed (43) hide show
  1. package/dist/client/ChatClient/index.d.ts +0 -1
  2. package/dist/client/MessagingClient/adapters/Trigger.d.ts +33 -0
  3. package/dist/client/MessagingClient/client.d.ts +4 -9
  4. package/dist/components/Block.d.ts +1 -1
  5. package/dist/components/renderers/Audio.d.ts +2 -2
  6. package/dist/components/renderers/Carousel.d.ts +2 -2
  7. package/dist/components/renderers/File.d.ts +2 -2
  8. package/dist/components/renderers/Image.d.ts +2 -2
  9. package/dist/components/renderers/Location.d.ts +2 -2
  10. package/dist/components/renderers/Video.d.ts +2 -2
  11. package/dist/hooks/useClient.d.ts +2 -2
  12. package/dist/index.js +58443 -50603
  13. package/dist/index.umd.cjs +117 -395
  14. package/dist/schemas/theme.d.ts +8 -8
  15. package/dist/themes/base.d.ts +1 -1
  16. package/dist/themes/baseColors.d.ts +736 -0
  17. package/dist/themes/dawn.d.ts +3 -1
  18. package/dist/themes/eggplant.d.ts +3 -1
  19. package/dist/themes/index.d.ts +0 -3
  20. package/dist/themes/prism.d.ts +3 -1
  21. package/dist/themes/themeBuilder.d.ts +27 -0
  22. package/dist/types/block-type.d.ts +14 -68
  23. package/dist/utils/index.d.ts +0 -1
  24. package/dist/utils/withBaseTheme.d.ts +1 -1
  25. package/package.json +11 -8
  26. package/dist/client/MessagingClient/adapters/Audio.d.ts +0 -19
  27. package/dist/client/MessagingClient/adapters/Card.d.ts +0 -188
  28. package/dist/client/MessagingClient/adapters/Carousel.d.ts +0 -147
  29. package/dist/client/MessagingClient/adapters/Choice.d.ts +0 -45
  30. package/dist/client/MessagingClient/adapters/Dropdown.d.ts +0 -46
  31. package/dist/client/MessagingClient/adapters/File.d.ts +0 -19
  32. package/dist/client/MessagingClient/adapters/Image.d.ts +0 -19
  33. package/dist/client/MessagingClient/adapters/Location.d.ts +0 -27
  34. package/dist/client/MessagingClient/adapters/Message.d.ts +0 -433
  35. package/dist/client/MessagingClient/adapters/Text.d.ts +0 -20
  36. package/dist/client/MessagingClient/adapters/Utils.d.ts +0 -5
  37. package/dist/client/MessagingClient/adapters/Video.d.ts +0 -19
  38. package/dist/client/MessagingClient/adapters/Voice.d.ts +0 -15
  39. package/dist/client/MessagingClient/adapters/index.d.ts +0 -12
  40. package/dist/themes/dusk.d.ts +0 -2
  41. package/dist/themes/galaxy.d.ts +0 -2
  42. package/dist/themes/midnight.d.ts +0 -2
  43. package/dist/utils/colors.d.ts +0 -18
@@ -1,2 +1,4 @@
1
1
  import { Theme } from '../schemas';
2
- export declare const eggplant: Theme;
2
+ export declare function buildEggplantTheme(color: string, { darkMode }?: {
3
+ darkMode?: boolean;
4
+ }): Theme;
@@ -1,6 +1,3 @@
1
1
  export * from './dawn';
2
- export * from './midnight';
3
- export * from './dusk';
4
2
  export * from './eggplant';
5
- export * from './galaxy';
6
3
  export * from './prism';
@@ -1,2 +1,4 @@
1
1
  import { Theme } from '../schemas';
2
- export declare const prism: Theme;
2
+ export declare function buildPrismTheme(color: string, { darkMode }?: {
3
+ darkMode?: boolean;
4
+ }): Theme;
@@ -0,0 +1,27 @@
1
+ declare const aliases: readonly ["base", "bgSubtle", "bg", "bgHover", "bgActive", "line", "border", "borderHover", "solid", "solidHover", "text", "textContrast", "onSolid"];
2
+ declare const shades: readonly ["25", "50", "100", "150", "200", "300", "400", "500", "600", "700", "800", "900", "0"];
3
+ type Aliases = Record<(typeof aliases)[number], string>;
4
+ type Shades = Record<(typeof shades)[number], string>;
5
+ type Palette = {
6
+ aliases: Aliases;
7
+ shades: Shades;
8
+ };
9
+ type Theme = {
10
+ light: {
11
+ primary: Palette;
12
+ secondary: Palette;
13
+ tertiary: Palette;
14
+ grey: Palette;
15
+ };
16
+ dark: {
17
+ primary: Palette;
18
+ secondary: Palette;
19
+ tertiary: Palette;
20
+ grey: Palette;
21
+ };
22
+ };
23
+ type ThemeOptions = {
24
+ scheme?: 'analogous' | 'complementary' | 'triadic';
25
+ };
26
+ export declare function buildTheme(color: string, { scheme }?: ThemeOptions): Theme;
27
+ export {};
@@ -1,10 +1,23 @@
1
1
  import type { Theme } from '../schemas';
2
+ import { target } from 'message-adapters';
2
3
  export declare const blockTypes: readonly ["button", "text", "image", "audio", "video", "file", "location", "column", "row", "bubble", "carousel", "dropdown"];
3
4
  export declare const markdownTypes: readonly ["heading1", "heading2", "heading3", "text", "horizontalRule", "link", "italic", "bold", "orderedList", "unorderedList", "listItem", "lineBreak", "pre"];
4
5
  export type MarkdownTypes = (typeof markdownTypes)[number];
5
6
  export type BlockTypes = (typeof blockTypes)[number];
6
7
  export type BlockStyles = NonNullable<Theme['message']>['blocks'];
7
- export type BlockObject = DropdownBlock | ButtonBlock | TextBlock | ImageBlock | AudioBlock | VideoBlock | FileBlock | LocationBlock | ColumnBlock | RowBlock | BubbleBlock | CarouselBlock;
8
+ export type AudioBlock = target.AudioMessage;
9
+ export type BubbleBlock = target.BubbleMessage;
10
+ export type ButtonBlock = target.ButtonMessage;
11
+ export type CarouselBlock = target.CarouselMessage;
12
+ export type ColumnBlock = target.ColumnMessage;
13
+ export type DropdownBlock = target.DropdownMessage;
14
+ export type FileBlock = target.FileMessage;
15
+ export type ImageBlock = target.ImageMessage;
16
+ export type LocationBlock = target.LocationMessage;
17
+ export type RowBlock = target.RowMessage;
18
+ export type TextBlock = target.TextMessage;
19
+ export type VideoBlock = target.VideoMessage;
20
+ export type BlockObject = target.Message;
8
21
  export type Sender = {
9
22
  name: string;
10
23
  avatar?: string;
@@ -16,72 +29,6 @@ export type MessageObject<T = BlockObject> = {
16
29
  timestamp: Date;
17
30
  block: T;
18
31
  };
19
- export type ButtonBlock = {
20
- type: 'button';
21
- variant: 'action' | 'link';
22
- reusable?: boolean;
23
- groupId?: string;
24
- text: string;
25
- buttonValue: string;
26
- };
27
- export type TextBlock = {
28
- type: 'text';
29
- text: string;
30
- };
31
- export type ImageBlock = {
32
- type: 'image';
33
- orientation?: 'portrait' | 'landscape' | 'square' | 'auto';
34
- url: string;
35
- };
36
- export type AudioBlock = {
37
- type: 'audio';
38
- url: string;
39
- };
40
- export type VideoBlock = {
41
- type: 'video';
42
- url: string;
43
- };
44
- export type FileBlock = {
45
- type: 'file';
46
- url: string;
47
- title?: string;
48
- };
49
- type DropdownChoice = {
50
- label: string;
51
- value: string;
52
- };
53
- export type DropdownBlock = {
54
- label?: string;
55
- type: 'dropdown';
56
- reusable?: boolean;
57
- options: DropdownChoice[];
58
- };
59
- export type LocationBlock = {
60
- type: 'location';
61
- latitude: number;
62
- longitude: number;
63
- title?: string;
64
- };
65
- export type ColumnBlock = {
66
- type: 'column';
67
- blocks: BlockObject[];
68
- horizontalAlignment?: 'left' | 'center' | 'right';
69
- verticalAlignment?: 'top' | 'center' | 'bottom' | 'stretch';
70
- };
71
- export type RowBlock = {
72
- type: 'row';
73
- blocks: BlockObject[];
74
- horizontalAlignment?: 'left' | 'center' | 'right' | 'stretch';
75
- verticalAlignment?: 'top' | 'center' | 'bottom';
76
- };
77
- export type CarouselBlock = {
78
- type: 'carousel';
79
- blocks: BlockObject[];
80
- };
81
- export type BubbleBlock = {
82
- type: 'bubble';
83
- block: BlockObject;
84
- };
85
32
  export type CommonBlockProps = {
86
33
  styles?: BlockStyles;
87
34
  };
@@ -90,4 +37,3 @@ export type BlockMap<P extends BlockObject = BlockObject> = {
90
37
  type: T;
91
38
  }>;
92
39
  };
93
- export {};
@@ -1,4 +1,3 @@
1
- export * from './colors';
2
1
  export * from './eventEmitter';
3
2
  export * from './hashStringToInt';
4
3
  export * from './mergeThemes';
@@ -259,7 +259,7 @@ export declare function withBaseTheme(theme: Theme): {
259
259
  } | undefined;
260
260
  } | undefined;
261
261
  blocks?: {
262
- text: Partial<Record<"text" | "heading1" | "heading2" | "heading3" | "horizontalRule" | "link" | "italic" | "bold" | "orderedList" | "unorderedList" | "listItem" | "lineBreak" | "pre", {
262
+ text: Partial<Record<"text" | "link" | "heading1" | "heading2" | "heading3" | "horizontalRule" | "italic" | "bold" | "orderedList" | "unorderedList" | "listItem" | "lineBreak" | "pre", {
263
263
  className?: string | undefined;
264
264
  style?: import("react").CSSProperties | undefined;
265
265
  } | undefined>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat",
3
- "version": "1.0.31",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.cjs",
@@ -23,25 +23,28 @@
23
23
  "test": "vitest run"
24
24
  },
25
25
  "dependencies": {
26
- "@botpress/chat": "^0.2.2",
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",
30
30
  "@heroicons/react": "^2.0.18",
31
- "@material/material-color-utilities": "^0.2.7",
31
+ "@radix-ui/colors": "^3.0.0",
32
32
  "@radix-ui/react-avatar": "^1.0.3",
33
33
  "@radix-ui/react-collapsible": "^1.0.3",
34
34
  "@radix-ui/react-dialog": "^1.0.4",
35
35
  "@radix-ui/react-icons": "^1.3.0",
36
36
  "@tailwindcss/container-queries": "^0.1.1",
37
+ "@types/culori": "^2.0.4",
38
+ "@types/react-color": "^3.0.10",
37
39
  "classnames": "^2.3.2",
38
40
  "clsx": "^2.0.0",
39
- "color-convert": "^2.0.1",
41
+ "culori": "^3.3.0",
40
42
  "dayjs": "^1.11.10",
41
43
  "embla-carousel-react": "8.0.0-rc11",
42
44
  "lodash": "^4.17.21",
45
+ "message-adapters": "workspace:*",
43
46
  "react": "^18.2.0",
44
- "react-colorful": "^5.6.1",
47
+ "react-color": "^2.19.3",
45
48
  "react-dom": "^18.2.0",
46
49
  "react-hot-toast": "^2.4.1",
47
50
  "react-markdown": "^8.0.7",
@@ -54,17 +57,17 @@
54
57
  "zustand": "^4.4.1"
55
58
  },
56
59
  "devDependencies": {
57
- "@types/color-convert": "^2.0.1",
58
- "@types/lodash": "^4.14.199",
59
- "@types/uuid": "^9.0.3",
60
60
  "@twind/core": "^1.1.3",
61
61
  "@twind/intellisense": "^1.1.3",
62
62
  "@twind/preset-autoprefix": "^1.0.7",
63
63
  "@twind/preset-container-queries": "^1.0.7",
64
64
  "@twind/preset-tailwind": "^1.1.4",
65
65
  "@twind/with-react": "^1.1.3",
66
+ "@types/color-convert": "^2.0.1",
67
+ "@types/lodash": "^4.14.199",
66
68
  "@types/react": "^18.0.37",
67
69
  "@types/react-dom": "^18.0.11",
70
+ "@types/uuid": "^9.0.3",
68
71
  "@vitejs/plugin-react-swc": "^3.0.0",
69
72
  "autoprefixer": "^10.4.14",
70
73
  "tailwindcss": "^3.3.2",
@@ -1,19 +0,0 @@
1
- import { z } from 'zod';
2
- import { AudioBlock } from '../../../types';
3
- export declare const AudioSchema: z.ZodEffects<z.ZodObject<{
4
- type: z.ZodLiteral<"audio">;
5
- audio: z.ZodString;
6
- title: z.ZodOptional<z.ZodString>;
7
- }, "strip", z.ZodTypeAny, {
8
- audio: string;
9
- type: "audio";
10
- title?: string | undefined;
11
- }, {
12
- audio: string;
13
- type: "audio";
14
- title?: string | undefined;
15
- }>, AudioBlock, {
16
- audio: string;
17
- type: "audio";
18
- title?: string | undefined;
19
- }>;
@@ -1,188 +0,0 @@
1
- import { z } from 'zod';
2
- import { ButtonBlock, ColumnBlock, ImageBlock, TextBlock } from '../../../types';
3
- import { WithBubble } from './Utils';
4
- export type CardBlockType = {
5
- blocks: CardBlocks;
6
- } & Omit<ColumnBlock, 'blocks'>;
7
- type CardBlocks = (ImageBlock | TextBlock | {
8
- type: 'row';
9
- blocks: ButtonBlock[];
10
- })[];
11
- export declare const BaseCardSchema: z.ZodObject<{
12
- type: z.ZodLiteral<"card">;
13
- title: z.ZodOptional<z.ZodString>;
14
- subtitle: z.ZodOptional<z.ZodString>;
15
- image: z.ZodOptional<z.ZodString>;
16
- actions: z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
17
- title: z.ZodString;
18
- action: z.ZodLiteral<"Say something">;
19
- text: z.ZodString;
20
- }, "strip", z.ZodTypeAny, {
21
- text: string;
22
- title: string;
23
- action: "Say something";
24
- }, {
25
- text: string;
26
- title: string;
27
- action: "Say something";
28
- }>, ButtonBlock, {
29
- text: string;
30
- title: string;
31
- action: "Say something";
32
- }>, z.ZodEffects<z.ZodObject<{
33
- title: z.ZodString;
34
- action: z.ZodLiteral<"Open URL">;
35
- url: z.ZodString;
36
- }, "strip", z.ZodTypeAny, {
37
- title: string;
38
- action: "Open URL";
39
- url: string;
40
- }, {
41
- title: string;
42
- action: "Open URL";
43
- url: string;
44
- }>, ButtonBlock, {
45
- title: string;
46
- action: "Open URL";
47
- url: string;
48
- }>, z.ZodEffects<z.ZodObject<{
49
- title: z.ZodString;
50
- action: z.ZodLiteral<"Postback">;
51
- payload: z.ZodString;
52
- }, "strip", z.ZodTypeAny, {
53
- title: string;
54
- action: "Postback";
55
- payload: string;
56
- }, {
57
- title: string;
58
- action: "Postback";
59
- payload: string;
60
- }>, ButtonBlock, {
61
- title: string;
62
- action: "Postback";
63
- payload: string;
64
- }>]>, "many">;
65
- }, "strip", z.ZodTypeAny, {
66
- type: "card";
67
- actions: ButtonBlock[];
68
- title?: string | undefined;
69
- subtitle?: string | undefined;
70
- image?: string | undefined;
71
- }, {
72
- type: "card";
73
- actions: ({
74
- text: string;
75
- title: string;
76
- action: "Say something";
77
- } | {
78
- title: string;
79
- action: "Open URL";
80
- url: string;
81
- } | {
82
- title: string;
83
- action: "Postback";
84
- payload: string;
85
- })[];
86
- title?: string | undefined;
87
- subtitle?: string | undefined;
88
- image?: string | undefined;
89
- }>;
90
- export declare const CardSchemaTransform: ({ title, image, actions, subtitle, }: Omit<z.infer<typeof BaseCardSchema>, 'type'>) => CardBlockType;
91
- export declare const CardSchema: z.ZodEffects<z.ZodObject<{
92
- type: z.ZodLiteral<"card">;
93
- title: z.ZodOptional<z.ZodString>;
94
- subtitle: z.ZodOptional<z.ZodString>;
95
- image: z.ZodOptional<z.ZodString>;
96
- actions: z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
97
- title: z.ZodString;
98
- action: z.ZodLiteral<"Say something">;
99
- text: z.ZodString;
100
- }, "strip", z.ZodTypeAny, {
101
- text: string;
102
- title: string;
103
- action: "Say something";
104
- }, {
105
- text: string;
106
- title: string;
107
- action: "Say something";
108
- }>, ButtonBlock, {
109
- text: string;
110
- title: string;
111
- action: "Say something";
112
- }>, z.ZodEffects<z.ZodObject<{
113
- title: z.ZodString;
114
- action: z.ZodLiteral<"Open URL">;
115
- url: z.ZodString;
116
- }, "strip", z.ZodTypeAny, {
117
- title: string;
118
- action: "Open URL";
119
- url: string;
120
- }, {
121
- title: string;
122
- action: "Open URL";
123
- url: string;
124
- }>, ButtonBlock, {
125
- title: string;
126
- action: "Open URL";
127
- url: string;
128
- }>, z.ZodEffects<z.ZodObject<{
129
- title: z.ZodString;
130
- action: z.ZodLiteral<"Postback">;
131
- payload: z.ZodString;
132
- }, "strip", z.ZodTypeAny, {
133
- title: string;
134
- action: "Postback";
135
- payload: string;
136
- }, {
137
- title: string;
138
- action: "Postback";
139
- payload: string;
140
- }>, ButtonBlock, {
141
- title: string;
142
- action: "Postback";
143
- payload: string;
144
- }>]>, "many">;
145
- }, "strip", z.ZodTypeAny, {
146
- type: "card";
147
- actions: ButtonBlock[];
148
- title?: string | undefined;
149
- subtitle?: string | undefined;
150
- image?: string | undefined;
151
- }, {
152
- type: "card";
153
- actions: ({
154
- text: string;
155
- title: string;
156
- action: "Say something";
157
- } | {
158
- title: string;
159
- action: "Open URL";
160
- url: string;
161
- } | {
162
- title: string;
163
- action: "Postback";
164
- payload: string;
165
- })[];
166
- title?: string | undefined;
167
- subtitle?: string | undefined;
168
- image?: string | undefined;
169
- }>, WithBubble<CardBlockType>, {
170
- type: "card";
171
- actions: ({
172
- text: string;
173
- title: string;
174
- action: "Say something";
175
- } | {
176
- title: string;
177
- action: "Open URL";
178
- url: string;
179
- } | {
180
- title: string;
181
- action: "Postback";
182
- payload: string;
183
- })[];
184
- title?: string | undefined;
185
- subtitle?: string | undefined;
186
- image?: string | undefined;
187
- }>;
188
- export {};
@@ -1,147 +0,0 @@
1
- import { z } from 'zod';
2
- import { CardBlockType } from './Card';
3
- import { CarouselBlock } from '../../../types';
4
- type CarouselBlockType = {
5
- blocks: CardBlockType[];
6
- } & Omit<CarouselBlock, 'blocks'>;
7
- export declare const CarouselSchema: z.ZodEffects<z.ZodObject<{
8
- type: z.ZodLiteral<"carousel">;
9
- items: z.ZodArray<z.ZodEffects<z.ZodObject<Omit<{
10
- type: z.ZodLiteral<"card">;
11
- title: z.ZodOptional<z.ZodString>;
12
- subtitle: z.ZodOptional<z.ZodString>;
13
- image: z.ZodOptional<z.ZodString>;
14
- actions: z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
15
- title: z.ZodString;
16
- action: z.ZodLiteral<"Say something">;
17
- text: z.ZodString;
18
- }, "strip", z.ZodTypeAny, {
19
- text: string;
20
- title: string;
21
- action: "Say something";
22
- }, {
23
- text: string;
24
- title: string;
25
- action: "Say something";
26
- }>, import("../../../types").ButtonBlock, {
27
- text: string;
28
- title: string;
29
- action: "Say something";
30
- }>, z.ZodEffects<z.ZodObject<{
31
- title: z.ZodString;
32
- action: z.ZodLiteral<"Open URL">;
33
- url: z.ZodString;
34
- }, "strip", z.ZodTypeAny, {
35
- title: string;
36
- action: "Open URL";
37
- url: string;
38
- }, {
39
- title: string;
40
- action: "Open URL";
41
- url: string;
42
- }>, import("../../../types").ButtonBlock, {
43
- title: string;
44
- action: "Open URL";
45
- url: string;
46
- }>, z.ZodEffects<z.ZodObject<{
47
- title: z.ZodString;
48
- action: z.ZodLiteral<"Postback">;
49
- payload: z.ZodString;
50
- }, "strip", z.ZodTypeAny, {
51
- title: string;
52
- action: "Postback";
53
- payload: string;
54
- }, {
55
- title: string;
56
- action: "Postback";
57
- payload: string;
58
- }>, import("../../../types").ButtonBlock, {
59
- title: string;
60
- action: "Postback";
61
- payload: string;
62
- }>]>, "many">;
63
- }, "type">, "strip", z.ZodTypeAny, {
64
- actions: import("../../../types").ButtonBlock[];
65
- image?: string | undefined;
66
- title?: string | undefined;
67
- subtitle?: string | undefined;
68
- }, {
69
- actions: ({
70
- text: string;
71
- title: string;
72
- action: "Say something";
73
- } | {
74
- title: string;
75
- action: "Open URL";
76
- url: string;
77
- } | {
78
- title: string;
79
- action: "Postback";
80
- payload: string;
81
- })[];
82
- image?: string | undefined;
83
- title?: string | undefined;
84
- subtitle?: string | undefined;
85
- }>, CardBlockType, {
86
- actions: ({
87
- text: string;
88
- title: string;
89
- action: "Say something";
90
- } | {
91
- title: string;
92
- action: "Open URL";
93
- url: string;
94
- } | {
95
- title: string;
96
- action: "Postback";
97
- payload: string;
98
- })[];
99
- image?: string | undefined;
100
- title?: string | undefined;
101
- subtitle?: string | undefined;
102
- }>, "many">;
103
- }, "strip", z.ZodTypeAny, {
104
- type: "carousel";
105
- items: CardBlockType[];
106
- }, {
107
- type: "carousel";
108
- items: {
109
- actions: ({
110
- text: string;
111
- title: string;
112
- action: "Say something";
113
- } | {
114
- title: string;
115
- action: "Open URL";
116
- url: string;
117
- } | {
118
- title: string;
119
- action: "Postback";
120
- payload: string;
121
- })[];
122
- image?: string | undefined;
123
- title?: string | undefined;
124
- subtitle?: string | undefined;
125
- }[];
126
- }>, CarouselBlockType, {
127
- type: "carousel";
128
- items: {
129
- actions: ({
130
- text: string;
131
- title: string;
132
- action: "Say something";
133
- } | {
134
- title: string;
135
- action: "Open URL";
136
- url: string;
137
- } | {
138
- title: string;
139
- action: "Postback";
140
- payload: string;
141
- })[];
142
- image?: string | undefined;
143
- title?: string | undefined;
144
- subtitle?: string | undefined;
145
- }[];
146
- }>;
147
- export {};
@@ -1,45 +0,0 @@
1
- import { z } from 'zod';
2
- import { ButtonBlock, ColumnBlock, RowBlock, TextBlock } from '../../../types';
3
- import { WithBubble } from './Utils';
4
- type ButtonBlocks = {
5
- blocks: ButtonBlock[];
6
- } & Omit<RowBlock, 'blocks'>;
7
- type ChoiceBlockType = {
8
- blocks: (ButtonBlocks | TextBlock)[];
9
- } & Omit<ColumnBlock, 'blocks'>;
10
- export declare const ChoiceSchema: z.ZodEffects<z.ZodObject<{
11
- type: z.ZodLiteral<"single-choice">;
12
- text: z.ZodString;
13
- choices: z.ZodArray<z.ZodObject<{
14
- title: z.ZodString;
15
- value: z.ZodString;
16
- }, "strip", z.ZodTypeAny, {
17
- value: string;
18
- title: string;
19
- }, {
20
- value: string;
21
- title: string;
22
- }>, "many">;
23
- }, "strip", z.ZodTypeAny, {
24
- text: string;
25
- type: "single-choice";
26
- choices: {
27
- value: string;
28
- title: string;
29
- }[];
30
- }, {
31
- text: string;
32
- type: "single-choice";
33
- choices: {
34
- value: string;
35
- title: string;
36
- }[];
37
- }>, WithBubble<ChoiceBlockType>, {
38
- text: string;
39
- type: "single-choice";
40
- choices: {
41
- value: string;
42
- title: string;
43
- }[];
44
- }>;
45
- export {};
@@ -1,46 +0,0 @@
1
- import { z } from 'zod';
2
- import { ColumnBlock, DropdownBlock, TextBlock } from '../../../types';
3
- import { WithBubble } from './Utils';
4
- type DropdownBlockType = {
5
- blocks: (DropdownBlock | TextBlock)[];
6
- } & Omit<ColumnBlock, 'blocks'>;
7
- export declare const DropdownSchema: z.ZodEffects<z.ZodObject<{
8
- type: z.ZodLiteral<"dropdown">;
9
- text: z.ZodOptional<z.ZodString>;
10
- message: z.ZodOptional<z.ZodString>;
11
- options: z.ZodArray<z.ZodObject<{
12
- label: z.ZodString;
13
- value: z.ZodString;
14
- }, "strip", z.ZodTypeAny, {
15
- value: string;
16
- label: string;
17
- }, {
18
- value: string;
19
- label: string;
20
- }>, "many">;
21
- }, "strip", z.ZodTypeAny, {
22
- options: {
23
- value: string;
24
- label: string;
25
- }[];
26
- type: "dropdown";
27
- text?: string | undefined;
28
- message?: string | undefined;
29
- }, {
30
- options: {
31
- value: string;
32
- label: string;
33
- }[];
34
- type: "dropdown";
35
- text?: string | undefined;
36
- message?: string | undefined;
37
- }>, WithBubble<DropdownBlockType>, {
38
- options: {
39
- value: string;
40
- label: string;
41
- }[];
42
- type: "dropdown";
43
- text?: string | undefined;
44
- message?: string | undefined;
45
- }>;
46
- export {};