@botonic/webchat-react 2.29.0 → 2.31.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 (69) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/index.d.ts +2 -2
  3. package/index.js +48 -46
  4. package/lib/components/message/rating-message/use-rating-message.d.ts +12 -9
  5. package/lib/components/message-machine-renderer/message-machine-renderer.d.ts +2 -1
  6. package/lib/components/preview-events/events/ai-agent/ai-agent.d.ts +3 -0
  7. package/lib/components/preview-events/events/ai-agent/executed-tools.d.ts +7 -0
  8. package/lib/components/preview-events/events/ai-agent/index.d.ts +1 -0
  9. package/lib/components/preview-events/events/ai-agent/parse-tools.d.ts +9 -0
  10. package/lib/components/preview-events/events/ai-agent-router/ai-agent-router.d.ts +3 -0
  11. package/lib/components/preview-events/events/ai-agent-router/index.d.ts +1 -0
  12. package/lib/components/preview-events/events/bot-action.d.ts +3 -0
  13. package/lib/components/preview-events/events/components/guardrail-item.d.ts +14 -0
  14. package/lib/components/preview-events/events/components/index.d.ts +2 -0
  15. package/lib/components/preview-events/events/components/sources-section.d.ts +11 -0
  16. package/lib/components/preview-events/events/conditional-channel.d.ts +3 -0
  17. package/lib/components/preview-events/events/conditional-country.d.ts +3 -0
  18. package/lib/components/preview-events/events/conditional-custom.d.ts +3 -0
  19. package/lib/components/preview-events/events/conditional-queue-status.d.ts +3 -0
  20. package/lib/components/preview-events/events/constants.d.ts +32 -0
  21. package/lib/components/preview-events/events/fallback.d.ts +3 -0
  22. package/lib/components/preview-events/events/handoff-success.d.ts +3 -0
  23. package/lib/components/preview-events/events/index.d.ts +15 -0
  24. package/lib/components/preview-events/events/keyword.d.ts +3 -0
  25. package/lib/components/preview-events/events/knowledge-base.d.ts +3 -0
  26. package/lib/components/preview-events/events/redirect-flow.d.ts +3 -0
  27. package/lib/components/preview-events/events/smart-intent.d.ts +3 -0
  28. package/lib/components/preview-events/events/types.d.ts +112 -0
  29. package/lib/components/preview-events/events/webview-action-triggered.d.ts +3 -0
  30. package/lib/components/preview-events/hooks/use-knowledge-base-info.d.ts +19 -0
  31. package/lib/components/preview-events/hooks/use-last-label-position.d.ts +9 -0
  32. package/lib/components/preview-events/icons/ai-router-icon.d.ts +1 -0
  33. package/lib/components/preview-events/icons/ai-specialist-icon.d.ts +1 -0
  34. package/lib/components/preview-events/icons/arrow-progress-icon.d.ts +1 -0
  35. package/lib/components/preview-events/icons/brain-icon.d.ts +1 -0
  36. package/lib/components/preview-events/icons/caret-down-icon.d.ts +1 -0
  37. package/lib/components/preview-events/icons/caret-up-icon.d.ts +1 -0
  38. package/lib/components/preview-events/icons/circle-check-icon.d.ts +1 -0
  39. package/lib/components/preview-events/icons/code-icon.d.ts +1 -0
  40. package/lib/components/preview-events/icons/file-pdf-icon.d.ts +1 -0
  41. package/lib/components/preview-events/icons/file-word-icon.d.ts +1 -0
  42. package/lib/components/preview-events/icons/hand-icon.d.ts +1 -0
  43. package/lib/components/preview-events/icons/head-set-icon.d.ts +1 -0
  44. package/lib/components/preview-events/icons/index.d.ts +19 -0
  45. package/lib/components/preview-events/icons/life-ring-icon.d.ts +1 -0
  46. package/lib/components/preview-events/icons/link-icon.d.ts +1 -0
  47. package/lib/components/preview-events/icons/quote-right-icon.d.ts +1 -0
  48. package/lib/components/preview-events/icons/screwdriver-wrench-icon.d.ts +1 -0
  49. package/lib/components/preview-events/icons/split-icon.d.ts +1 -0
  50. package/lib/components/preview-events/icons/wand-icon.d.ts +1 -0
  51. package/lib/components/preview-events/icons/window-restore-icon.d.ts +1 -0
  52. package/lib/components/preview-events/index.d.ts +3 -0
  53. package/lib/components/preview-events/preview-event-message/index.d.ts +1 -0
  54. package/lib/components/preview-events/preview-event-message/preview-event-message.d.ts +20 -0
  55. package/lib/components/preview-events/preview-event-message/use-preview-event-message.d.ts +17 -0
  56. package/lib/components/preview-events/preview-events-types.d.ts +12 -0
  57. package/lib/components/shared/index.d.ts +2 -0
  58. package/lib/components/shared/markdown-text/index.d.ts +2 -0
  59. package/lib/components/shared/markdown-text/markdown-text.d.ts +6 -0
  60. package/lib/components/webchat-messages/use-webchat-messages.d.ts +1 -1
  61. package/lib/components/webchat-provider/webchat-context.d.ts +2 -0
  62. package/lib/hooks/use-webchat-state.d.ts +2 -6
  63. package/lib/types/webchat-props.d.ts +19 -0
  64. package/package.json +8 -4
  65. package/styles.css +13 -8
  66. package/trigger.js +1 -1
  67. package/webchat-app-Cxzk8Q-q.js +5437 -0
  68. package/lib/hooks/webchat-output-renderers.d.ts +0 -6
  69. package/webchat-app-C3YH_yqx.js +0 -4293
@@ -0,0 +1 @@
1
+ export { PreviewEventMessage, type PreviewEventMessageProps, SYSTEM_MESSAGE_ROLE, } from './preview-event-message';
@@ -0,0 +1,20 @@
1
+ import { PreviewUtils } from '@botonic/shared';
2
+ import { DebugEvent } from '../events';
3
+ /**
4
+ * DOM `role` stamped on every preview debug-event message.
5
+ *
6
+ * This is a cross-package contract, not a decorative attribute: the dashboard's
7
+ * flow-builder preview panel implements its "show debug system events" toggle by
8
+ * querying `[role="system-message"]` and flipping each match's `display` (see
9
+ * `usePersistedToggleSystemEvents` / `usePersistedToggleSystemEventsV2` in
10
+ * feature-flow-builder). Changing this value silently breaks that toggle, so the
11
+ * dashboard's `SYSTEM_MESSAGE_ROLE` / `SYSTEM_MESSAGE_ROLE_V2` constants must stay
12
+ * in sync with it.
13
+ */
14
+ export declare const SYSTEM_MESSAGE_ROLE = "system-message";
15
+ export interface PreviewEventMessageProps {
16
+ debugEvent: DebugEvent;
17
+ messageId?: string;
18
+ previewUtils?: PreviewUtils;
19
+ }
20
+ export declare const PreviewEventMessage: ({ debugEvent, messageId, previewUtils, }: PreviewEventMessageProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { PreviewUtils } from '@botonic/shared';
2
+ import { default as React } from 'react';
3
+ import { DebugEvent } from '../events';
4
+ import { DebugEventConfig } from '../preview-events-types';
5
+ export interface UsePreviewEventMessageProps {
6
+ debugEvent: DebugEvent;
7
+ messageId?: string;
8
+ previewUtils?: PreviewUtils;
9
+ }
10
+ export declare function usePreviewEventMessage({ debugEvent, messageId, previewUtils, }: UsePreviewEventMessageProps): {
11
+ isExpanded: boolean;
12
+ eventConfig: DebugEventConfig | undefined;
13
+ wrapperRef: React.RefObject<HTMLDivElement>;
14
+ messageId: string | undefined;
15
+ previewUtils: PreviewUtils | undefined;
16
+ handleContainerClick: (e: React.MouseEvent) => void;
17
+ };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ export interface IconProps {
3
+ color?: string;
4
+ }
5
+ export interface DebugEventConfig {
6
+ action: string;
7
+ title: React.ReactNode;
8
+ component: React.ComponentType<any> | null;
9
+ icon?: React.ReactNode;
10
+ collapsible?: boolean;
11
+ }
12
+ export type { DebugEvent } from './events/types';
@@ -1,2 +1,4 @@
1
+ export type { MarkdownTextProps } from './markdown-text';
2
+ export { MarkdownText } from './markdown-text';
1
3
  export type { QuickReplyProps } from './quick-reply';
2
4
  export { QuickReply } from './quick-reply';
@@ -0,0 +1,2 @@
1
+ export type { MarkdownTextProps } from './markdown-text';
2
+ export { MarkdownText } from './markdown-text';
@@ -0,0 +1,6 @@
1
+ export interface MarkdownTextProps {
2
+ text: string;
3
+ className?: string;
4
+ }
5
+ export declare const MarkdownText: ({ text, className, }: MarkdownTextProps) => JSX.Element;
6
+ export default MarkdownText;
@@ -33,7 +33,7 @@ export declare function useWebchatMessages(props: WebchatMessagesProps, state: W
33
33
  button: import('@botonic/shared').BotonicButtonContent;
34
34
  }, {
35
35
  [x: string]: import('xstate').ActorRefFromLogic<import('@botonic/webchat-core').PostMessageActor> | undefined;
36
- }, "sending" | "idle" | "checkStatus" | "errorSendingMessage" | "performingPostback", string, import('xstate').NonReducibleUnknown, import('xstate').MetaObject, {
36
+ }, "checkStatus" | "sending" | "idle" | "errorSendingMessage" | "performingPostback", string, import('xstate').NonReducibleUnknown, import('xstate').MetaObject, {
37
37
  states: {
38
38
  readonly checkStatus: {};
39
39
  readonly sending: {};
@@ -1,8 +1,10 @@
1
+ import { PreviewUtils } from '@botonic/shared';
1
2
  import { WebchatController } from '@botonic/webchat-core';
2
3
  import { WebchatState } from '../../hooks/use-webchat-state';
3
4
  export interface WebchatContextValue {
4
5
  state: WebchatState;
5
6
  controller: WebchatController;
7
+ previewUtils?: PreviewUtils;
6
8
  }
7
9
  export declare const WebchatContext: import('react').Context<WebchatContextValue | null>;
8
10
  export declare function useWebchatContext(): WebchatContextValue;
@@ -4,14 +4,10 @@ import { ComponentType } from 'react';
4
4
  import { ActorRefFrom } from 'xstate';
5
5
  import { AvatarConfig } from '../components/message-machine-renderer/use-avatar';
6
6
  import { WebchatClientSettingsBehaviors } from './webchat-client-settings-behaviors';
7
- /** Embedder registry merged with `WEBCHAT_OUTPUT_RENDERERS` (rating UI, …). */
8
7
  export type WebchatCustomMessageComponents = Record<string, ComponentType<Record<string, unknown>>>;
9
8
  export type WebchatStateProps = WebchatConfig & {
10
9
  avatarConfig?: AvatarConfig;
11
- /**
12
- * Extra or replacement custom message components. Framework defaults from
13
- * {@link WEBCHAT_OUTPUT_RENDERERS} are applied first; matching keys here override.
14
- */
10
+ /** Extra or replacement custom message components. */
15
11
  customMessages?: WebchatCustomMessageComponents;
16
12
  };
17
13
  export interface WebchatState {
@@ -30,7 +26,7 @@ export interface WebchatState {
30
26
  avatarConfig?: AvatarConfig;
31
27
  /** Mirrors `WebchatConfig.enableResponsiveHeroHeader`; default true. */
32
28
  enableResponsiveHeroHeader: boolean;
33
- /** Merged `WEBCHAT_OUTPUT_RENDERERS` + embedder `customMessages`. */
29
+ /** Embedder-supplied custom message components. */
34
30
  customMessages: WebchatCustomMessageComponents;
35
31
  }
36
32
  export declare function useWebchatState(stateProps: WebchatStateProps): WebchatState;
@@ -1,6 +1,8 @@
1
1
  import { WebchatController } from '@botonic/webchat-core';
2
2
  import { ComponentType, CSSProperties, ReactNode } from 'react';
3
3
  import { CoverComponentRegistry } from '../components/webchat-overlay';
4
+ import { WebchatHeroHeaderLayoutConfig } from '../hero-header-layout';
5
+ import { WebchatStateProps } from '../hooks/use-webchat-state';
4
6
  export interface WebchatInputIcons {
5
7
  emoji?: ReactNode;
6
8
  attachment?: ReactNode;
@@ -46,6 +48,23 @@ export interface WebchatCompositionProps {
46
48
  /** Additional config passed from WebchatTrigger */
47
49
  [key: string]: unknown;
48
50
  }
51
+ /**
52
+ * Optional config a custom webchat composition may read beyond the required
53
+ * `WebchatCompositionProps`. These arrive through `WebchatCompositionProps`'s
54
+ * `[key: string]: unknown` index signature (the trigger spreads them in), so a
55
+ * composition asserts this shape once to read them with concrete types.
56
+ *
57
+ * Fields forwarded to `WebchatProvider` are picked from `WebchatStateProps` so
58
+ * their types stay in lockstep with the provider (no `as any` at the call site);
59
+ * the remaining fields are composition/layout options consumed by the layout itself.
60
+ */
61
+ export type WebchatCompositionExtras = Pick<WebchatStateProps, 'avatarConfig' | 'customMessages' | 'storage' | 'webchatClientSettings' | 'enableResponsiveHeroHeader' | 'previewUtils'> & {
62
+ title?: string;
63
+ placeholder?: string;
64
+ showBranding?: boolean;
65
+ coverRegistry?: CoverComponentRegistry;
66
+ heroHeaderLayout?: Partial<WebchatHeroHeaderLayoutConfig>;
67
+ };
49
68
  /** Loader function type for lazy loading custom webchat compositions */
50
69
  export type WebchatLoader = () => Promise<{
51
70
  default: ComponentType<WebchatCompositionProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botonic/webchat-react",
3
- "version": "2.29.0",
3
+ "version": "2.31.0",
4
4
  "type": "module",
5
5
  "types": "./index.d.ts",
6
6
  "module": "./index.js",
@@ -21,14 +21,18 @@
21
21
  "dependencies": {
22
22
  "class-variance-authority": "^0.7.0",
23
23
  "react-aria": "3.33.1",
24
+ "react-markdown": "^9.0.1",
25
+ "rehype-external-links": "^3.0.0",
26
+ "remark-breaks": "^4.0.0",
27
+ "remark-gfm": "^4.0.0",
24
28
  "@xstate/react": "^5.0.4"
25
29
  },
26
30
  "peerDependencies": {
27
31
  "react": "^18.0.0",
28
32
  "react-dom": "^18.0.0",
29
- "@botonic/webchat-core": "2.29.0",
30
- "@botonic/shared": "2.29.0",
31
- "@lilara/ui-web-react": ">=0.8.0"
33
+ "@botonic/webchat-core": "2.31.0",
34
+ "@botonic/shared": "2.31.0",
35
+ "@lilara/ui-web-react": ">=0.9.0"
32
36
  },
33
37
  "publishConfig": {
34
38
  "access": "public"