@botpress/webchat-client 0.3.1 → 0.4.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.
@@ -1,10 +1,10 @@
1
1
 
2
- > @botpress/webchat-client@0.3.1 build /home/runner/work/genisys/genisys/packages/webchat-client
2
+ > @botpress/webchat-client@0.4.0 build /home/runner/work/genisys/genisys/packages/webchat-client
3
3
  > openapi-ts && vite build
4
4
 
5
5
  ⏳ Generating from raw OpenAPI specification
6
6
  🚀 Done! Your output is in ./src/gen/client
7
- vite v5.4.10 building for production...
7
+ vite v5.4.8 building for production...
8
8
  transforming...
9
9
  ✓ 17 modules transformed.
10
10
  rendering chunks...
@@ -16,14 +16,14 @@ computing gzip size...
16
16
  dist/webchat-client4.js  0.29 kB │ gzip: 0.18 kB
17
17
  dist/webchat-client6.js  0.30 kB │ gzip: 0.22 kB
18
18
  dist/webchat-client7.js  0.45 kB │ gzip: 0.26 kB
19
- dist/webchat-client9.js  2.63 kB │ gzip: 1.15 kB
19
+ dist/webchat-client9.js  2.66 kB │ gzip: 1.17 kB
20
20
  dist/webchat-client3.js  3.50 kB │ gzip: 0.60 kB
21
21
  dist/webchat-client2.js  5.66 kB │ gzip: 1.60 kB
22
22
  dist/webchat-client10.js  8.58 kB │ gzip: 2.91 kB
23
23
  dist/webchat-client5.js 10.93 kB │ gzip: 3.47 kB
24
24
  [vite:dts] Start rollup declaration files...
25
- Analysis will use the bundled TypeScript version 5.4.2
26
- *** The target project appears to use TypeScript 5.6.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
27
- [vite:dts] Declaration files built in 4664ms.
25
+ Analysis will use the bundled TypeScript version 5.8.2
26
+ *** The target project appears to use TypeScript 5.9.3 which is newer than the bundled compiler engine; consider upgrading API Extractor.
27
+ [vite:dts] Declaration files built in 6143ms.
28
28
 
29
- ✓ built in 4.95s
29
+ ✓ built in 6.49s
package/dist/index.d.ts CHANGED
@@ -496,6 +496,162 @@ export declare type Conversation = {
496
496
  * Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
497
497
  */
498
498
  updatedAt: string;
499
+ /**
500
+ * The last [Message](#schema_message) sent in the [Conversation](#schema_conversation)
501
+ */
502
+ lastMessage?: {
503
+ /**
504
+ * Id of the [Message](#schema_message)
505
+ */
506
+ id: string;
507
+ /**
508
+ * Creation date of the [Message](#schema_message) in ISO 8601 format
509
+ */
510
+ createdAt: string;
511
+ /**
512
+ * Payload is the content of the message.
513
+ */
514
+ payload: {
515
+ audioUrl: string;
516
+ type: 'audio';
517
+ } | {
518
+ title: string;
519
+ subtitle?: string;
520
+ imageUrl?: string;
521
+ actions: Array<{
522
+ action: 'postback' | 'url' | 'say';
523
+ label: string;
524
+ value: string;
525
+ }>;
526
+ type: 'card';
527
+ } | {
528
+ items: Array<{
529
+ title: string;
530
+ subtitle?: string;
531
+ imageUrl?: string;
532
+ actions: Array<{
533
+ action: 'postback' | 'url' | 'say';
534
+ label: string;
535
+ value: string;
536
+ }>;
537
+ }>;
538
+ type: 'carousel';
539
+ } | {
540
+ text: string;
541
+ options: Array<{
542
+ label: string;
543
+ value: string;
544
+ }>;
545
+ disableFreeText?: boolean;
546
+ type: 'choice';
547
+ } | {
548
+ text: string;
549
+ options: Array<{
550
+ label: string;
551
+ value: string;
552
+ }>;
553
+ disableFreeText?: boolean;
554
+ type: 'dropdown';
555
+ } | {
556
+ fileUrl: string;
557
+ title?: string;
558
+ type: 'file';
559
+ } | {
560
+ imageUrl: string;
561
+ type: 'image';
562
+ } | {
563
+ latitude: number;
564
+ longitude: number;
565
+ address?: string;
566
+ title?: string;
567
+ type: 'location';
568
+ } | {
569
+ text: string;
570
+ value?: string;
571
+ type: 'text';
572
+ } | {
573
+ videoUrl: string;
574
+ type: 'video';
575
+ } | {
576
+ items: Array<{
577
+ type: 'text';
578
+ payload: {
579
+ text: string;
580
+ value?: string;
581
+ };
582
+ } | {
583
+ type: 'markdown';
584
+ payload: {
585
+ markdown: string;
586
+ };
587
+ } | {
588
+ type: 'image';
589
+ payload: {
590
+ imageUrl: string;
591
+ };
592
+ } | {
593
+ type: 'audio';
594
+ payload: {
595
+ audioUrl: string;
596
+ };
597
+ } | {
598
+ type: 'video';
599
+ payload: {
600
+ videoUrl: string;
601
+ };
602
+ } | {
603
+ type: 'file';
604
+ payload: {
605
+ fileUrl: string;
606
+ title?: string;
607
+ };
608
+ } | {
609
+ type: 'location';
610
+ payload: {
611
+ latitude: number;
612
+ longitude: number;
613
+ address?: string;
614
+ title?: string;
615
+ };
616
+ }>;
617
+ type: 'bloc';
618
+ } | {
619
+ markdown: string;
620
+ type: 'markdown';
621
+ } | {
622
+ url: string;
623
+ name: string;
624
+ data?: unknown;
625
+ type: 'custom';
626
+ };
627
+ /**
628
+ * ID of the [User](#schema_user)
629
+ */
630
+ userId: string;
631
+ /**
632
+ * ID of the [Conversation](#schema_conversation)
633
+ */
634
+ conversationId: string;
635
+ /**
636
+ * Metadata of the message
637
+ */
638
+ metadata?: {};
639
+ /**
640
+ * ID of the message this message is replying to
641
+ */
642
+ replyTo?: string;
643
+ /**
644
+ * ID of the user who selected this message. Undefined if not selected.
645
+ */
646
+ selectedBy?: string;
647
+ /**
648
+ * Feedback of the message
649
+ */
650
+ feedback?: {
651
+ value: 'positive' | 'negative';
652
+ comment?: string;
653
+ };
654
+ };
499
655
  };
500
656
 
501
657
  declare type ConversationIdParam = {
@@ -1556,6 +1712,10 @@ export declare type InitializeConversationData = {
1556
1712
  * Authentication Key
1557
1713
  */
1558
1714
  'x-user-key'?: string;
1715
+ /**
1716
+ * Admin Key for managing users
1717
+ */
1718
+ 'x-admin-secret'?: string;
1559
1719
  };
1560
1720
  path?: never;
1561
1721
  query?: {
@@ -1689,6 +1849,132 @@ declare const listConversations: <ThrowOnError extends boolean = false>(options:
1689
1849
  id: string;
1690
1850
  createdAt: string;
1691
1851
  updatedAt: string;
1852
+ lastMessage?: {
1853
+ id: string;
1854
+ createdAt: string;
1855
+ payload: {
1856
+ audioUrl: string;
1857
+ type: "audio";
1858
+ } | {
1859
+ title: string;
1860
+ subtitle?: string;
1861
+ imageUrl?: string;
1862
+ actions: Array<{
1863
+ action: "postback" | "url" | "say";
1864
+ label: string;
1865
+ value: string;
1866
+ }>;
1867
+ type: "card";
1868
+ } | {
1869
+ items: Array<{
1870
+ title: string;
1871
+ subtitle?: string;
1872
+ imageUrl?: string;
1873
+ actions: Array<{
1874
+ action: "postback" | "url" | "say";
1875
+ label: string;
1876
+ value: string;
1877
+ }>;
1878
+ }>;
1879
+ type: "carousel";
1880
+ } | {
1881
+ text: string;
1882
+ options: Array<{
1883
+ label: string;
1884
+ value: string;
1885
+ }>;
1886
+ disableFreeText?: boolean;
1887
+ type: "choice";
1888
+ } | {
1889
+ text: string;
1890
+ options: Array<{
1891
+ label: string;
1892
+ value: string;
1893
+ }>;
1894
+ disableFreeText?: boolean;
1895
+ type: "dropdown";
1896
+ } | {
1897
+ fileUrl: string;
1898
+ title?: string;
1899
+ type: "file";
1900
+ } | {
1901
+ imageUrl: string;
1902
+ type: "image";
1903
+ } | {
1904
+ latitude: number;
1905
+ longitude: number;
1906
+ address?: string;
1907
+ title?: string;
1908
+ type: "location";
1909
+ } | {
1910
+ text: string;
1911
+ value?: string;
1912
+ type: "text";
1913
+ } | {
1914
+ videoUrl: string;
1915
+ type: "video";
1916
+ } | {
1917
+ items: Array<{
1918
+ type: "text";
1919
+ payload: {
1920
+ text: string;
1921
+ value?: string;
1922
+ };
1923
+ } | {
1924
+ type: "markdown";
1925
+ payload: {
1926
+ markdown: string;
1927
+ };
1928
+ } | {
1929
+ type: "image";
1930
+ payload: {
1931
+ imageUrl: string;
1932
+ };
1933
+ } | {
1934
+ type: "audio";
1935
+ payload: {
1936
+ audioUrl: string;
1937
+ };
1938
+ } | {
1939
+ type: "video";
1940
+ payload: {
1941
+ videoUrl: string;
1942
+ };
1943
+ } | {
1944
+ type: "file";
1945
+ payload: {
1946
+ fileUrl: string;
1947
+ title?: string;
1948
+ };
1949
+ } | {
1950
+ type: "location";
1951
+ payload: {
1952
+ latitude: number;
1953
+ longitude: number;
1954
+ address?: string;
1955
+ title?: string;
1956
+ };
1957
+ }>;
1958
+ type: "bloc";
1959
+ } | {
1960
+ markdown: string;
1961
+ type: "markdown";
1962
+ } | {
1963
+ url: string;
1964
+ name: string;
1965
+ data?: unknown;
1966
+ type: "custom";
1967
+ };
1968
+ userId: string;
1969
+ conversationId: string;
1970
+ metadata?: {};
1971
+ replyTo?: string;
1972
+ selectedBy?: string;
1973
+ feedback?: {
1974
+ value: "positive" | "negative";
1975
+ comment?: string;
1976
+ };
1977
+ };
1692
1978
  }>;
1693
1979
  meta: {
1694
1980
  nextToken?: string;
@@ -1698,6 +1984,132 @@ declare const listConversations: <ThrowOnError extends boolean = false>(options:
1698
1984
  id: string;
1699
1985
  createdAt: string;
1700
1986
  updatedAt: string;
1987
+ lastMessage?: {
1988
+ id: string;
1989
+ createdAt: string;
1990
+ payload: {
1991
+ audioUrl: string;
1992
+ type: "audio";
1993
+ } | {
1994
+ title: string;
1995
+ subtitle?: string;
1996
+ imageUrl?: string;
1997
+ actions: Array<{
1998
+ action: "postback" | "url" | "say";
1999
+ label: string;
2000
+ value: string;
2001
+ }>;
2002
+ type: "card";
2003
+ } | {
2004
+ items: Array<{
2005
+ title: string;
2006
+ subtitle?: string;
2007
+ imageUrl?: string;
2008
+ actions: Array<{
2009
+ action: "postback" | "url" | "say";
2010
+ label: string;
2011
+ value: string;
2012
+ }>;
2013
+ }>;
2014
+ type: "carousel";
2015
+ } | {
2016
+ text: string;
2017
+ options: Array<{
2018
+ label: string;
2019
+ value: string;
2020
+ }>;
2021
+ disableFreeText?: boolean;
2022
+ type: "choice";
2023
+ } | {
2024
+ text: string;
2025
+ options: Array<{
2026
+ label: string;
2027
+ value: string;
2028
+ }>;
2029
+ disableFreeText?: boolean;
2030
+ type: "dropdown";
2031
+ } | {
2032
+ fileUrl: string;
2033
+ title?: string;
2034
+ type: "file";
2035
+ } | {
2036
+ imageUrl: string;
2037
+ type: "image";
2038
+ } | {
2039
+ latitude: number;
2040
+ longitude: number;
2041
+ address?: string;
2042
+ title?: string;
2043
+ type: "location";
2044
+ } | {
2045
+ text: string;
2046
+ value?: string;
2047
+ type: "text";
2048
+ } | {
2049
+ videoUrl: string;
2050
+ type: "video";
2051
+ } | {
2052
+ items: Array<{
2053
+ type: "text";
2054
+ payload: {
2055
+ text: string;
2056
+ value?: string;
2057
+ };
2058
+ } | {
2059
+ type: "markdown";
2060
+ payload: {
2061
+ markdown: string;
2062
+ };
2063
+ } | {
2064
+ type: "image";
2065
+ payload: {
2066
+ imageUrl: string;
2067
+ };
2068
+ } | {
2069
+ type: "audio";
2070
+ payload: {
2071
+ audioUrl: string;
2072
+ };
2073
+ } | {
2074
+ type: "video";
2075
+ payload: {
2076
+ videoUrl: string;
2077
+ };
2078
+ } | {
2079
+ type: "file";
2080
+ payload: {
2081
+ fileUrl: string;
2082
+ title?: string;
2083
+ };
2084
+ } | {
2085
+ type: "location";
2086
+ payload: {
2087
+ latitude: number;
2088
+ longitude: number;
2089
+ address?: string;
2090
+ title?: string;
2091
+ };
2092
+ }>;
2093
+ type: "bloc";
2094
+ } | {
2095
+ markdown: string;
2096
+ type: "markdown";
2097
+ } | {
2098
+ url: string;
2099
+ name: string;
2100
+ data?: unknown;
2101
+ type: "custom";
2102
+ };
2103
+ userId: string;
2104
+ conversationId: string;
2105
+ metadata?: {};
2106
+ replyTo?: string;
2107
+ selectedBy?: string;
2108
+ feedback?: {
2109
+ value: "positive" | "negative";
2110
+ comment?: string;
2111
+ };
2112
+ };
1701
2113
  }>;
1702
2114
  meta: {
1703
2115
  nextToken?: string;
@@ -1742,6 +2154,162 @@ export declare type ListConversationsErrors = {
1742
2154
  * Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
1743
2155
  */
1744
2156
  updatedAt: string;
2157
+ /**
2158
+ * The last [Message](#schema_message) sent in the [Conversation](#schema_conversation)
2159
+ */
2160
+ lastMessage?: {
2161
+ /**
2162
+ * Id of the [Message](#schema_message)
2163
+ */
2164
+ id: string;
2165
+ /**
2166
+ * Creation date of the [Message](#schema_message) in ISO 8601 format
2167
+ */
2168
+ createdAt: string;
2169
+ /**
2170
+ * Payload is the content of the message.
2171
+ */
2172
+ payload: {
2173
+ audioUrl: string;
2174
+ type: 'audio';
2175
+ } | {
2176
+ title: string;
2177
+ subtitle?: string;
2178
+ imageUrl?: string;
2179
+ actions: Array<{
2180
+ action: 'postback' | 'url' | 'say';
2181
+ label: string;
2182
+ value: string;
2183
+ }>;
2184
+ type: 'card';
2185
+ } | {
2186
+ items: Array<{
2187
+ title: string;
2188
+ subtitle?: string;
2189
+ imageUrl?: string;
2190
+ actions: Array<{
2191
+ action: 'postback' | 'url' | 'say';
2192
+ label: string;
2193
+ value: string;
2194
+ }>;
2195
+ }>;
2196
+ type: 'carousel';
2197
+ } | {
2198
+ text: string;
2199
+ options: Array<{
2200
+ label: string;
2201
+ value: string;
2202
+ }>;
2203
+ disableFreeText?: boolean;
2204
+ type: 'choice';
2205
+ } | {
2206
+ text: string;
2207
+ options: Array<{
2208
+ label: string;
2209
+ value: string;
2210
+ }>;
2211
+ disableFreeText?: boolean;
2212
+ type: 'dropdown';
2213
+ } | {
2214
+ fileUrl: string;
2215
+ title?: string;
2216
+ type: 'file';
2217
+ } | {
2218
+ imageUrl: string;
2219
+ type: 'image';
2220
+ } | {
2221
+ latitude: number;
2222
+ longitude: number;
2223
+ address?: string;
2224
+ title?: string;
2225
+ type: 'location';
2226
+ } | {
2227
+ text: string;
2228
+ value?: string;
2229
+ type: 'text';
2230
+ } | {
2231
+ videoUrl: string;
2232
+ type: 'video';
2233
+ } | {
2234
+ items: Array<{
2235
+ type: 'text';
2236
+ payload: {
2237
+ text: string;
2238
+ value?: string;
2239
+ };
2240
+ } | {
2241
+ type: 'markdown';
2242
+ payload: {
2243
+ markdown: string;
2244
+ };
2245
+ } | {
2246
+ type: 'image';
2247
+ payload: {
2248
+ imageUrl: string;
2249
+ };
2250
+ } | {
2251
+ type: 'audio';
2252
+ payload: {
2253
+ audioUrl: string;
2254
+ };
2255
+ } | {
2256
+ type: 'video';
2257
+ payload: {
2258
+ videoUrl: string;
2259
+ };
2260
+ } | {
2261
+ type: 'file';
2262
+ payload: {
2263
+ fileUrl: string;
2264
+ title?: string;
2265
+ };
2266
+ } | {
2267
+ type: 'location';
2268
+ payload: {
2269
+ latitude: number;
2270
+ longitude: number;
2271
+ address?: string;
2272
+ title?: string;
2273
+ };
2274
+ }>;
2275
+ type: 'bloc';
2276
+ } | {
2277
+ markdown: string;
2278
+ type: 'markdown';
2279
+ } | {
2280
+ url: string;
2281
+ name: string;
2282
+ data?: unknown;
2283
+ type: 'custom';
2284
+ };
2285
+ /**
2286
+ * ID of the [User](#schema_user)
2287
+ */
2288
+ userId: string;
2289
+ /**
2290
+ * ID of the [Conversation](#schema_conversation)
2291
+ */
2292
+ conversationId: string;
2293
+ /**
2294
+ * Metadata of the message
2295
+ */
2296
+ metadata?: {};
2297
+ /**
2298
+ * ID of the message this message is replying to
2299
+ */
2300
+ replyTo?: string;
2301
+ /**
2302
+ * ID of the user who selected this message. Undefined if not selected.
2303
+ */
2304
+ selectedBy?: string;
2305
+ /**
2306
+ * Feedback of the message
2307
+ */
2308
+ feedback?: {
2309
+ value: 'positive' | 'negative';
2310
+ comment?: string;
2311
+ };
2312
+ };
1745
2313
  }>;
1746
2314
  meta: {
1747
2315
  /**
@@ -1772,6 +2340,162 @@ export declare type ListConversationsResponses = {
1772
2340
  * Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
1773
2341
  */
1774
2342
  updatedAt: string;
2343
+ /**
2344
+ * The last [Message](#schema_message) sent in the [Conversation](#schema_conversation)
2345
+ */
2346
+ lastMessage?: {
2347
+ /**
2348
+ * Id of the [Message](#schema_message)
2349
+ */
2350
+ id: string;
2351
+ /**
2352
+ * Creation date of the [Message](#schema_message) in ISO 8601 format
2353
+ */
2354
+ createdAt: string;
2355
+ /**
2356
+ * Payload is the content of the message.
2357
+ */
2358
+ payload: {
2359
+ audioUrl: string;
2360
+ type: 'audio';
2361
+ } | {
2362
+ title: string;
2363
+ subtitle?: string;
2364
+ imageUrl?: string;
2365
+ actions: Array<{
2366
+ action: 'postback' | 'url' | 'say';
2367
+ label: string;
2368
+ value: string;
2369
+ }>;
2370
+ type: 'card';
2371
+ } | {
2372
+ items: Array<{
2373
+ title: string;
2374
+ subtitle?: string;
2375
+ imageUrl?: string;
2376
+ actions: Array<{
2377
+ action: 'postback' | 'url' | 'say';
2378
+ label: string;
2379
+ value: string;
2380
+ }>;
2381
+ }>;
2382
+ type: 'carousel';
2383
+ } | {
2384
+ text: string;
2385
+ options: Array<{
2386
+ label: string;
2387
+ value: string;
2388
+ }>;
2389
+ disableFreeText?: boolean;
2390
+ type: 'choice';
2391
+ } | {
2392
+ text: string;
2393
+ options: Array<{
2394
+ label: string;
2395
+ value: string;
2396
+ }>;
2397
+ disableFreeText?: boolean;
2398
+ type: 'dropdown';
2399
+ } | {
2400
+ fileUrl: string;
2401
+ title?: string;
2402
+ type: 'file';
2403
+ } | {
2404
+ imageUrl: string;
2405
+ type: 'image';
2406
+ } | {
2407
+ latitude: number;
2408
+ longitude: number;
2409
+ address?: string;
2410
+ title?: string;
2411
+ type: 'location';
2412
+ } | {
2413
+ text: string;
2414
+ value?: string;
2415
+ type: 'text';
2416
+ } | {
2417
+ videoUrl: string;
2418
+ type: 'video';
2419
+ } | {
2420
+ items: Array<{
2421
+ type: 'text';
2422
+ payload: {
2423
+ text: string;
2424
+ value?: string;
2425
+ };
2426
+ } | {
2427
+ type: 'markdown';
2428
+ payload: {
2429
+ markdown: string;
2430
+ };
2431
+ } | {
2432
+ type: 'image';
2433
+ payload: {
2434
+ imageUrl: string;
2435
+ };
2436
+ } | {
2437
+ type: 'audio';
2438
+ payload: {
2439
+ audioUrl: string;
2440
+ };
2441
+ } | {
2442
+ type: 'video';
2443
+ payload: {
2444
+ videoUrl: string;
2445
+ };
2446
+ } | {
2447
+ type: 'file';
2448
+ payload: {
2449
+ fileUrl: string;
2450
+ title?: string;
2451
+ };
2452
+ } | {
2453
+ type: 'location';
2454
+ payload: {
2455
+ latitude: number;
2456
+ longitude: number;
2457
+ address?: string;
2458
+ title?: string;
2459
+ };
2460
+ }>;
2461
+ type: 'bloc';
2462
+ } | {
2463
+ markdown: string;
2464
+ type: 'markdown';
2465
+ } | {
2466
+ url: string;
2467
+ name: string;
2468
+ data?: unknown;
2469
+ type: 'custom';
2470
+ };
2471
+ /**
2472
+ * ID of the [User](#schema_user)
2473
+ */
2474
+ userId: string;
2475
+ /**
2476
+ * ID of the [Conversation](#schema_conversation)
2477
+ */
2478
+ conversationId: string;
2479
+ /**
2480
+ * Metadata of the message
2481
+ */
2482
+ metadata?: {};
2483
+ /**
2484
+ * ID of the message this message is replying to
2485
+ */
2486
+ replyTo?: string;
2487
+ /**
2488
+ * ID of the user who selected this message. Undefined if not selected.
2489
+ */
2490
+ selectedBy?: string;
2491
+ /**
2492
+ * Feedback of the message
2493
+ */
2494
+ feedback?: {
2495
+ value: 'positive' | 'negative';
2496
+ comment?: string;
2497
+ };
2498
+ };
1775
2499
  }>;
1776
2500
  meta: {
1777
2501
  /**
@@ -1,22 +1,22 @@
1
1
  class E extends Error {
2
- constructor(d, s) {
3
- super(d), this.name = "ParseError", this.type = s.type, this.field = s.field, this.value = s.value, this.line = s.line;
2
+ constructor(d, i) {
3
+ super(d), this.name = "ParseError", this.type = i.type, this.field = i.field, this.value = i.value, this.line = i.line;
4
4
  }
5
5
  }
6
6
  function x(n) {
7
7
  }
8
- function I(n) {
8
+ function w(n) {
9
9
  if (typeof n == "function")
10
10
  throw new TypeError(
11
11
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
12
12
  );
13
- const { onEvent: d = x, onError: s = x, onRetry: r = x, onComment: a } = n;
14
- let i = "", o = !0, f, c = "", p = "";
13
+ const { onEvent: d = x, onError: i = x, onRetry: r = x, onComment: c } = n;
14
+ let o = "", s = !0, f, a = "", p = "";
15
15
  function b(e) {
16
- const t = o ? e.replace(/^\xEF\xBB\xBF/, "") : e, [l, u] = w(`${i}${t}`);
16
+ const t = s ? e.replace(/^\xEF\xBB\xBF/, "") : e, [l, u] = g(`${o}${t}`);
17
17
  for (const h of l)
18
18
  y(h);
19
- i = u, o = !1;
19
+ o = u, s = !1;
20
20
  }
21
21
  function y(e) {
22
22
  if (e === "") {
@@ -24,7 +24,7 @@ function I(n) {
24
24
  return;
25
25
  }
26
26
  if (e.startsWith(":")) {
27
- a && a(e.slice(e.startsWith(": ") ? 2 : 1));
27
+ c && c(e.slice(e.startsWith(": ") ? 2 : 1));
28
28
  return;
29
29
  }
30
30
  const t = e.indexOf(":");
@@ -41,14 +41,14 @@ function I(n) {
41
41
  p = t;
42
42
  break;
43
43
  case "data":
44
- c = `${c}${t}
44
+ a = `${a}${t}
45
45
  `;
46
46
  break;
47
47
  case "id":
48
48
  f = t.includes("\0") ? void 0 : t;
49
49
  break;
50
50
  case "retry":
51
- /^\d+$/.test(t) ? r(parseInt(t, 10)) : s(
51
+ /^\d+$/.test(t) ? r(parseInt(t, 10)) : i(
52
52
  new E(`Invalid \`retry\` value: "${t}"`, {
53
53
  type: "invalid-retry",
54
54
  value: t,
@@ -57,7 +57,7 @@ function I(n) {
57
57
  );
58
58
  break;
59
59
  default:
60
- s(
60
+ i(
61
61
  new E(
62
62
  `Unknown field "${e.length > 20 ? `${e.slice(0, 20)}…` : e}"`,
63
63
  { type: "unknown-field", field: e, value: t, line: l }
@@ -67,39 +67,39 @@ function I(n) {
67
67
  }
68
68
  }
69
69
  function v() {
70
- c.length > 0 && d({
70
+ a.length > 0 && d({
71
71
  id: f,
72
72
  event: p || void 0,
73
73
  // If the data buffer's last character is a U+000A LINE FEED (LF) character,
74
74
  // then remove the last character from the data buffer.
75
- data: c.endsWith(`
76
- `) ? c.slice(0, -1) : c
77
- }), f = void 0, c = "", p = "";
75
+ data: a.endsWith(`
76
+ `) ? a.slice(0, -1) : a
77
+ }), f = void 0, a = "", p = "";
78
78
  }
79
79
  function $(e = {}) {
80
- i && e.consume && y(i), o = !0, f = void 0, c = "", p = "", i = "";
80
+ o && e.consume && y(o), s = !0, f = void 0, a = "", p = "", o = "";
81
81
  }
82
82
  return { feed: b, reset: $ };
83
83
  }
84
- function w(n) {
84
+ function g(n) {
85
85
  const d = [];
86
- let s = "", r = 0;
86
+ let i = "", r = 0;
87
87
  for (; r < n.length; ) {
88
- const a = n.indexOf("\r", r), i = n.indexOf(`
88
+ const c = n.indexOf("\r", r), o = n.indexOf(`
89
89
  `, r);
90
- let o = -1;
91
- if (a !== -1 && i !== -1 ? o = Math.min(a, i) : a !== -1 ? o = a : i !== -1 && (o = i), o === -1) {
92
- s = n.slice(r);
90
+ let s = -1;
91
+ if (c !== -1 && o !== -1 ? s = Math.min(c, o) : c !== -1 ? c === n.length - 1 ? s = -1 : s = c : o !== -1 && (s = o), s === -1) {
92
+ i = n.slice(r);
93
93
  break;
94
94
  } else {
95
- const f = n.slice(r, o);
96
- d.push(f), r = o + 1, n[r - 1] === "\r" && n[r] === `
95
+ const f = n.slice(r, s);
96
+ d.push(f), r = s + 1, n[r - 1] === "\r" && n[r] === `
97
97
  ` && r++;
98
98
  }
99
99
  }
100
- return [d, s];
100
+ return [d, i];
101
101
  }
102
102
  export {
103
103
  E as ParseError,
104
- I as createParser
104
+ w as createParser
105
105
  };
@@ -0,0 +1,10 @@
1
+ import { clientInternalConfig } from '@repo/eslint-config/client-internal'
2
+ import { defineConfig } from 'eslint/config'
3
+
4
+ export default defineConfig([clientInternalConfig], {
5
+ languageOptions: {
6
+ parserOptions: {
7
+ tsconfigRootDir: import.meta.dirname,
8
+ },
9
+ },
10
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat-client",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -19,6 +19,7 @@
19
19
  "exports": {
20
20
  ".": {
21
21
  "import": "./dist/webchat-client.js",
22
+ "require": "./dist/webchat-client.js",
22
23
  "types": "./dist/index.d.ts"
23
24
  }
24
25
  },
@@ -29,7 +30,7 @@
29
30
  "eventsource": "^3.0.6"
30
31
  },
31
32
  "devDependencies": {
32
- "@bpinternal/webchat-http-client": "0.6.0",
33
+ "@bpinternal/webchat-http-client": "0.8.0",
33
34
  "@hey-api/client-fetch": "^0.10.0",
34
35
  "@hey-api/openapi-ts": "^0.66.4",
35
36
  "@repo/eslint-config": "workspace:*",
package/.eslintrc.cjs DELETED
@@ -1,11 +0,0 @@
1
- /** @type {import("eslint").Linter.Config} */
2
- module.exports = {
3
- root: true,
4
- extends: ["@repo/eslint-config/react-internal.js"],
5
- parser: "@typescript-eslint/parser",
6
- ignorePatterns: ["dist", "node_modules", "storybook-static", ".turbo", "turbo/*"],
7
- parserOptions: {
8
- project: "./tsconfig.json",
9
- tsconfigRootDir: __dirname,
10
- },
11
- };