@botpress/webchat 1.0.28 → 1.0.29

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.
@@ -1,12 +1,13 @@
1
1
  import { ComponentProps, ReactNode } from 'react';
2
2
  import { type WebChatClient } from '../client';
3
- import { Configuration, ContextVaue, Renderers, WebchatContext } from '../contexts';
3
+ import { ContextVaue, Renderers, WebchatContext } from '../contexts';
4
4
  import { Theme } from '../schemas';
5
+ import { Configuration } from '../types';
5
6
  type Props = {
6
7
  theme?: Theme;
7
8
  renderers?: Renderers;
8
9
  client?: WebChatClient;
9
- configuration: Configuration;
10
+ configuration?: Configuration;
10
11
  defaultState?: Partial<ContextVaue['state']>;
11
12
  children?: ReactNode | ((configuration: Configuration) => ReactNode);
12
13
  } & Omit<ComponentProps<typeof WebchatContext.Provider>, 'value' | 'children'>;
@@ -1833,6 +1833,46 @@ export declare const ThemeSchema: z.ZodObject<{
1833
1833
  } | undefined;
1834
1834
  } | undefined;
1835
1835
  }>>;
1836
+ fab: z.ZodOptional<z.ZodObject<{
1837
+ icon: z.ZodOptional<z.ZodObject<{
1838
+ className: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
1839
+ style: z.ZodEffects<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>, CSSProperties | undefined, z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined>;
1840
+ }, "strip", z.ZodTypeAny, {
1841
+ className?: string | undefined;
1842
+ style?: CSSProperties | undefined;
1843
+ }, {
1844
+ className?: string | undefined;
1845
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1846
+ }>>;
1847
+ container: z.ZodOptional<z.ZodObject<{
1848
+ className: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
1849
+ style: z.ZodEffects<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>, CSSProperties | undefined, z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined>;
1850
+ }, "strip", z.ZodTypeAny, {
1851
+ className?: string | undefined;
1852
+ style?: CSSProperties | undefined;
1853
+ }, {
1854
+ className?: string | undefined;
1855
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1856
+ }>>;
1857
+ }, "strip", z.ZodTypeAny, {
1858
+ icon?: {
1859
+ className?: string | undefined;
1860
+ style?: CSSProperties | undefined;
1861
+ } | undefined;
1862
+ container?: {
1863
+ className?: string | undefined;
1864
+ style?: CSSProperties | undefined;
1865
+ } | undefined;
1866
+ }, {
1867
+ icon?: {
1868
+ className?: string | undefined;
1869
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1870
+ } | undefined;
1871
+ container?: {
1872
+ className?: string | undefined;
1873
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1874
+ } | undefined;
1875
+ }>>;
1836
1876
  messageList: z.ZodOptional<z.ZodObject<{
1837
1877
  container: z.ZodOptional<z.ZodObject<{
1838
1878
  className: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
@@ -2006,6 +2046,64 @@ export declare const ThemeSchema: z.ZodObject<{
2006
2046
  style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2007
2047
  } | undefined;
2008
2048
  }>>;
2049
+ scrollDownButton: z.ZodOptional<z.ZodObject<{
2050
+ container: z.ZodOptional<z.ZodObject<{
2051
+ className: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
2052
+ style: z.ZodEffects<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>, CSSProperties | undefined, z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined>;
2053
+ }, "strip", z.ZodTypeAny, {
2054
+ className?: string | undefined;
2055
+ style?: CSSProperties | undefined;
2056
+ }, {
2057
+ className?: string | undefined;
2058
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2059
+ }>>;
2060
+ button: z.ZodOptional<z.ZodObject<{
2061
+ className: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
2062
+ style: z.ZodEffects<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>, CSSProperties | undefined, z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined>;
2063
+ }, "strip", z.ZodTypeAny, {
2064
+ className?: string | undefined;
2065
+ style?: CSSProperties | undefined;
2066
+ }, {
2067
+ className?: string | undefined;
2068
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2069
+ }>>;
2070
+ icon: z.ZodOptional<z.ZodObject<{
2071
+ className: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
2072
+ style: z.ZodEffects<z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>, CSSProperties | undefined, z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined>;
2073
+ }, "strip", z.ZodTypeAny, {
2074
+ className?: string | undefined;
2075
+ style?: CSSProperties | undefined;
2076
+ }, {
2077
+ className?: string | undefined;
2078
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2079
+ }>>;
2080
+ }, "strip", z.ZodTypeAny, {
2081
+ container?: {
2082
+ className?: string | undefined;
2083
+ style?: CSSProperties | undefined;
2084
+ } | undefined;
2085
+ button?: {
2086
+ className?: string | undefined;
2087
+ style?: CSSProperties | undefined;
2088
+ } | undefined;
2089
+ icon?: {
2090
+ className?: string | undefined;
2091
+ style?: CSSProperties | undefined;
2092
+ } | undefined;
2093
+ }, {
2094
+ container?: {
2095
+ className?: string | undefined;
2096
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2097
+ } | undefined;
2098
+ button?: {
2099
+ className?: string | undefined;
2100
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2101
+ } | undefined;
2102
+ icon?: {
2103
+ className?: string | undefined;
2104
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2105
+ } | undefined;
2106
+ }>>;
2009
2107
  }, "strip", z.ZodTypeAny, {
2010
2108
  container?: {
2011
2109
  className?: string | undefined;
@@ -2043,6 +2141,20 @@ export declare const ThemeSchema: z.ZodObject<{
2043
2141
  style?: CSSProperties | undefined;
2044
2142
  } | undefined;
2045
2143
  } | undefined;
2144
+ scrollDownButton?: {
2145
+ container?: {
2146
+ className?: string | undefined;
2147
+ style?: CSSProperties | undefined;
2148
+ } | undefined;
2149
+ button?: {
2150
+ className?: string | undefined;
2151
+ style?: CSSProperties | undefined;
2152
+ } | undefined;
2153
+ icon?: {
2154
+ className?: string | undefined;
2155
+ style?: CSSProperties | undefined;
2156
+ } | undefined;
2157
+ } | undefined;
2046
2158
  }, {
2047
2159
  container?: {
2048
2160
  className?: string | undefined;
@@ -2080,6 +2192,20 @@ export declare const ThemeSchema: z.ZodObject<{
2080
2192
  style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2081
2193
  } | undefined;
2082
2194
  } | undefined;
2195
+ scrollDownButton?: {
2196
+ container?: {
2197
+ className?: string | undefined;
2198
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2199
+ } | undefined;
2200
+ button?: {
2201
+ className?: string | undefined;
2202
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2203
+ } | undefined;
2204
+ icon?: {
2205
+ className?: string | undefined;
2206
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
2207
+ } | undefined;
2208
+ } | undefined;
2083
2209
  }>>;
2084
2210
  message: z.ZodOptional<z.ZodObject<{
2085
2211
  container: z.ZodOptional<z.ZodObject<{
@@ -3306,6 +3432,16 @@ export declare const ThemeSchema: z.ZodObject<{
3306
3432
  } | undefined;
3307
3433
  } | undefined;
3308
3434
  } | undefined;
3435
+ fab?: {
3436
+ icon?: {
3437
+ className?: string | undefined;
3438
+ style?: CSSProperties | undefined;
3439
+ } | undefined;
3440
+ container?: {
3441
+ className?: string | undefined;
3442
+ style?: CSSProperties | undefined;
3443
+ } | undefined;
3444
+ } | undefined;
3309
3445
  messageList?: {
3310
3446
  container?: {
3311
3447
  className?: string | undefined;
@@ -3343,6 +3479,20 @@ export declare const ThemeSchema: z.ZodObject<{
3343
3479
  style?: CSSProperties | undefined;
3344
3480
  } | undefined;
3345
3481
  } | undefined;
3482
+ scrollDownButton?: {
3483
+ container?: {
3484
+ className?: string | undefined;
3485
+ style?: CSSProperties | undefined;
3486
+ } | undefined;
3487
+ button?: {
3488
+ className?: string | undefined;
3489
+ style?: CSSProperties | undefined;
3490
+ } | undefined;
3491
+ icon?: {
3492
+ className?: string | undefined;
3493
+ style?: CSSProperties | undefined;
3494
+ } | undefined;
3495
+ } | undefined;
3346
3496
  } | undefined;
3347
3497
  message?: {
3348
3498
  container?: {
@@ -3663,6 +3813,16 @@ export declare const ThemeSchema: z.ZodObject<{
3663
3813
  } | undefined;
3664
3814
  } | undefined;
3665
3815
  } | undefined;
3816
+ fab?: {
3817
+ icon?: {
3818
+ className?: string | undefined;
3819
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
3820
+ } | undefined;
3821
+ container?: {
3822
+ className?: string | undefined;
3823
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
3824
+ } | undefined;
3825
+ } | undefined;
3666
3826
  messageList?: {
3667
3827
  container?: {
3668
3828
  className?: string | undefined;
@@ -3700,6 +3860,20 @@ export declare const ThemeSchema: z.ZodObject<{
3700
3860
  style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
3701
3861
  } | undefined;
3702
3862
  } | undefined;
3863
+ scrollDownButton?: {
3864
+ container?: {
3865
+ className?: string | undefined;
3866
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
3867
+ } | undefined;
3868
+ button?: {
3869
+ className?: string | undefined;
3870
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
3871
+ } | undefined;
3872
+ icon?: {
3873
+ className?: string | undefined;
3874
+ style?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
3875
+ } | undefined;
3876
+ } | undefined;
3703
3877
  } | undefined;
3704
3878
  message?: {
3705
3879
  container?: {
@@ -9,12 +9,12 @@ export type Sender = {
9
9
  name: string;
10
10
  avatar?: string;
11
11
  };
12
- export type MessageObject = {
12
+ export type MessageObject<T = BlockObject> = {
13
13
  direction: 'incoming' | 'outgoing' | 'system';
14
14
  disableInput?: boolean;
15
15
  sender: Sender;
16
16
  timestamp: Date;
17
- block: BlockObject;
17
+ block: T;
18
18
  };
19
19
  export type ButtonBlock = {
20
20
  type: 'button';
@@ -0,0 +1,16 @@
1
+ type DescriptionItem = {
2
+ title: string;
3
+ link?: string;
4
+ };
5
+ export type Configuration = {
6
+ composerPlaceholder?: string;
7
+ botName?: string;
8
+ botAvatar?: string;
9
+ botDescription?: string;
10
+ website?: DescriptionItem;
11
+ email?: DescriptionItem;
12
+ phone?: DescriptionItem;
13
+ privacyPolicy?: DescriptionItem;
14
+ termsOfService?: DescriptionItem;
15
+ };
16
+ export {};
@@ -1,2 +1,3 @@
1
1
  export * from './block-type';
2
2
  export * from './image';
3
+ export * from './configuration';
@@ -0,0 +1,8 @@
1
+ import { OpUnitType } from 'dayjs';
2
+ import { MessageObject } from '../types';
3
+ /**
4
+ * @param interval - The interval to check for date differences (default is 'day')
5
+ * @returns Array of message objects with system date messages inserted at every change of date more than the `interval`
6
+ * */
7
+ export declare function withDateSystemMessages(messages: MessageObject[], interval?: OpUnitType): MessageObject[];
8
+ export declare function humanizeTimestamp(timestamp: Date, long?: boolean): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -177,6 +177,16 @@ export declare function withBaseTheme(theme: Theme): {
177
177
  } | undefined;
178
178
  } | undefined;
179
179
  } | undefined;
180
+ fab?: {
181
+ icon?: {
182
+ className?: string | undefined;
183
+ style?: import("react").CSSProperties | undefined;
184
+ } | undefined;
185
+ container?: {
186
+ className?: string | undefined;
187
+ style?: import("react").CSSProperties | undefined;
188
+ } | undefined;
189
+ } | undefined;
180
190
  messageList?: {
181
191
  container?: {
182
192
  className?: string | undefined;
@@ -214,6 +224,20 @@ export declare function withBaseTheme(theme: Theme): {
214
224
  style?: import("react").CSSProperties | undefined;
215
225
  } | undefined;
216
226
  } | undefined;
227
+ scrollDownButton?: {
228
+ container?: {
229
+ className?: string | undefined;
230
+ style?: import("react").CSSProperties | undefined;
231
+ } | undefined;
232
+ button?: {
233
+ className?: string | undefined;
234
+ style?: import("react").CSSProperties | undefined;
235
+ } | undefined;
236
+ icon?: {
237
+ className?: string | undefined;
238
+ style?: import("react").CSSProperties | undefined;
239
+ } | undefined;
240
+ } | undefined;
217
241
  } | undefined;
218
242
  message?: {
219
243
  container?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.cjs",
@@ -16,11 +16,14 @@
16
16
  "type:check": "tsc --noEmit",
17
17
  "dev": "vite --debug --log-level info",
18
18
  "build": "pnpm type:check && vite build",
19
+ "inspect-build": "vite build --sourcemap && npx source-map-explorer dist/index.js --no-border-checks",
19
20
  "bundle": "vite build",
20
21
  "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
21
- "preview": "vite preview"
22
+ "preview": "vite preview",
23
+ "test": "vitest"
22
24
  },
23
25
  "dependencies": {
26
+ "@botpress/chat": "^0.0.2",
24
27
  "@botpress/messaging-socket": "^1.2.0",
25
28
  "@floating-ui/react": "^0.25.4",
26
29
  "@headlessui/react": "1.7.11",
@@ -31,15 +34,11 @@
31
34
  "@radix-ui/react-dialog": "^1.0.4",
32
35
  "@radix-ui/react-icons": "^1.3.0",
33
36
  "@tailwindcss/container-queries": "^0.1.1",
34
- "@types/color-convert": "^2.0.1",
35
- "@types/lodash": "^4.14.199",
36
- "@types/uuid": "^9.0.3",
37
- "@botpress/chat": "^0.0.1",
38
37
  "classnames": "^2.3.2",
39
38
  "clsx": "^2.0.0",
40
39
  "color-convert": "^2.0.1",
40
+ "dayjs": "^1.11.10",
41
41
  "embla-carousel-react": "8.0.0-rc11",
42
- "google-map-react": "^2.2.1",
43
42
  "lodash": "^4.17.21",
44
43
  "react": "^18.2.0",
45
44
  "react-colorful": "^5.6.1",
@@ -55,6 +54,9 @@
55
54
  "zustand": "^4.4.1"
56
55
  },
57
56
  "devDependencies": {
57
+ "@types/color-convert": "^2.0.1",
58
+ "@types/lodash": "^4.14.199",
59
+ "@types/uuid": "^9.0.3",
58
60
  "@twind/core": "^1.1.3",
59
61
  "@twind/intellisense": "^1.1.3",
60
62
  "@twind/preset-autoprefix": "^1.0.7",
@@ -68,6 +70,7 @@
68
70
  "tailwindcss": "^3.3.2",
69
71
  "typescript": "^5.0.2",
70
72
  "vite": "^4.3.9",
71
- "vite-plugin-dts": "^3.5.4"
73
+ "vite-plugin-dts": "^3.5.4",
74
+ "vitest": "^0.34.6"
72
75
  }
73
76
  }