@botonic/webchat-react 2.25.0 → 2.27.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 (100) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/CLAUDE.md +170 -0
  3. package/index.d.ts +12 -5
  4. package/index.js +59 -28
  5. package/lib/components/dialog/backdrop/backdrop.d.ts +5 -0
  6. package/lib/components/dialog/dialog/dialog.d.ts +7 -0
  7. package/lib/components/dialog/dialog-context.d.ts +3 -0
  8. package/lib/components/dialog/dialog-provider.d.ts +17 -0
  9. package/lib/components/dialog/dialog-types.d.ts +24 -0
  10. package/lib/components/dialog/icons/check-icon.d.ts +1 -0
  11. package/lib/components/dialog/icons/xmark-icon.d.ts +1 -0
  12. package/lib/components/dialog/index.d.ts +5 -0
  13. package/lib/components/dialog/webchat-dialog-provider.d.ts +6 -0
  14. package/lib/components/message/audio-message/audio-message.d.ts +2 -0
  15. package/lib/components/message/audio-message/use-audio-message.d.ts +294 -0
  16. package/lib/components/message/button-message/button-message.d.ts +6 -1
  17. package/lib/components/message/carousel-message/carousel-message.d.ts +2 -2
  18. package/lib/components/message/carousel-message/icons/chevron-left-icon.d.ts +1 -0
  19. package/lib/components/message/carousel-message/icons/chevron-right-icon.d.ts +1 -0
  20. package/lib/components/message/carousel-message/index.d.ts +1 -1
  21. package/lib/components/message/carousel-message/use-carousel-message.d.ts +47 -0
  22. package/lib/components/message/document-message/document-message.d.ts +2 -8
  23. package/lib/components/message/document-message/use-document-message.d.ts +11 -0
  24. package/lib/components/message/image-message/use-image-message.d.ts +10 -0
  25. package/lib/components/message/index.d.ts +2 -1
  26. package/lib/components/message/message/message-avatar/message-avatar.d.ts +2 -0
  27. package/lib/components/message/message/message-bubble/message-bubble.d.ts +0 -3
  28. package/lib/components/message/message/message-info/message-info.d.ts +2 -0
  29. package/lib/components/message/message/message.d.ts +2 -0
  30. package/lib/components/message/message/use-message.d.ts +3 -3
  31. package/lib/components/{typing-indicator → message/typing-message}/index.d.ts +1 -1
  32. package/lib/components/{typing-indicator/typing-indicator.d.ts → message/typing-message/typing-message.d.ts} +0 -5
  33. package/lib/components/message/video-message/use-video-message.d.ts +21 -0
  34. package/lib/components/message/video-message/video-message.d.ts +3 -1
  35. package/lib/components/message-machine-renderer/message-machine-renderer.d.ts +1 -0
  36. package/lib/components/message-machine-renderer/use-message-machine-renderer.d.ts +1 -0
  37. package/lib/components/shared/button-component/external-link-icon.d.ts +1 -0
  38. package/lib/components/webchat-app/webchat-app.d.ts +13 -3
  39. package/lib/components/webchat-container/use-webchat-container.d.ts +1 -0
  40. package/lib/components/webchat-header/icons/close-icon.d.ts +1 -0
  41. package/lib/components/webchat-header/icons/download-icon.d.ts +1 -0
  42. package/lib/components/webchat-header/icons/leave-icon.d.ts +1 -0
  43. package/lib/components/webchat-header/icons/menu-icon.d.ts +1 -0
  44. package/lib/components/webchat-header/icons/sounds-icon.d.ts +1 -0
  45. package/lib/components/webchat-header/icons/start-over-icon.d.ts +1 -0
  46. package/lib/components/webchat-header/use-webchat-header.d.ts +11 -2
  47. package/lib/components/webchat-header/webchat-header.d.ts +4 -1
  48. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-download-transcript.d.ts +5 -0
  49. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-conversation.d.ts +5 -0
  50. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-reset-session.d.ts +5 -0
  51. package/lib/components/webchat-header/webchat-menu/dropdown-menu-item-sounds.d.ts +5 -0
  52. package/lib/components/webchat-header/webchat-menu/use-dropdown-menu-item-reset-session.d.ts +9 -0
  53. package/lib/components/webchat-input/attachment-preview/attachment-preview.d.ts +2 -0
  54. package/lib/components/webchat-input/attachment-preview/index.d.ts +3 -0
  55. package/lib/components/webchat-input/attachment-preview/use-attachment-preview.d.ts +23 -0
  56. package/lib/components/webchat-input/audio-input/audio-input.d.ts +2 -0
  57. package/lib/components/webchat-input/audio-input/index.d.ts +3 -0
  58. package/lib/components/webchat-input/audio-input/use-audio-input.d.ts +34 -0
  59. package/lib/components/webchat-input/audio-waveform/audio-waveform.d.ts +5 -0
  60. package/lib/components/webchat-input/audio-waveform/index.d.ts +1 -0
  61. package/lib/components/webchat-input/audio-waveform/static-waveform.d.ts +9 -0
  62. package/lib/components/webchat-input/constants.d.ts +3 -0
  63. package/lib/components/webchat-input/icons/attachment-icon.d.ts +1 -0
  64. package/lib/components/webchat-input/icons/cancel-icon.d.ts +1 -0
  65. package/lib/components/webchat-input/icons/close-icon.d.ts +1 -0
  66. package/lib/components/webchat-input/icons/confirm-icon.d.ts +1 -0
  67. package/lib/components/webchat-input/icons/emoji-icon.d.ts +1 -0
  68. package/lib/components/webchat-input/icons/file-icon.d.ts +2 -0
  69. package/lib/components/webchat-input/icons/file-pdf-icon.d.ts +2 -0
  70. package/lib/components/webchat-input/icons/microphone-icon.d.ts +1 -0
  71. package/lib/components/webchat-input/icons/pause-icon.d.ts +1 -0
  72. package/lib/components/webchat-input/icons/play-icon.d.ts +1 -0
  73. package/lib/components/webchat-input/icons/send-icon.d.ts +1 -0
  74. package/lib/components/webchat-input/icons/svg-attrs.d.ts +7 -0
  75. package/lib/components/webchat-input/use-webchat-input.d.ts +26 -9
  76. package/lib/components/webchat-input/webchat-input.d.ts +6 -1
  77. package/lib/components/webchat-messages/use-webchat-messages-list-scroll.d.ts +15 -0
  78. package/lib/components/webchat-messages/use-webchat-messages.d.ts +18 -0
  79. package/lib/components/webchat-provider/webchat-context.d.ts +8 -0
  80. package/lib/components/webchat-provider/webchat-provider.d.ts +1 -10
  81. package/lib/components/webchat-trigger/icons/chat-icon.d.ts +1 -0
  82. package/lib/components/webchat-trigger/icons/chevron-down-icon.d.ts +1 -0
  83. package/lib/components/webchat-trigger/use-webchat-trigger.d.ts +10 -0
  84. package/lib/contexts/media-playback-context.d.ts +11 -0
  85. package/lib/hero-header-layout/index.d.ts +3 -0
  86. package/lib/hero-header-layout/use-webchat-hero-header-layout.d.ts +40 -0
  87. package/lib/hero-header-layout/webchat-hero-header-layout-config.d.ts +26 -0
  88. package/lib/hero-header-layout/webchat-hero-header-layout-utils.d.ts +2 -0
  89. package/lib/hooks/use-audio-recorder.d.ts +20 -0
  90. package/lib/hooks/use-webchat-state.d.ts +7 -0
  91. package/lib/hooks/webchat-client-settings-behaviors.d.ts +13 -0
  92. package/lib/types/webchat-props.d.ts +57 -2
  93. package/lib/utils/audio-utils.d.ts +1 -0
  94. package/lib/utils/uuid-utils.d.ts +1 -0
  95. package/package.json +4 -3
  96. package/styles.css +177 -16
  97. package/trigger.js +231 -135
  98. package/webchat-app-DSDMjE-m.js +4051 -0
  99. package/lib/components/webchat-messages/use-custom-scrollbar.d.ts +0 -11
  100. package/webchat-app-BUGnjp8Q.js +0 -2408
@@ -0,0 +1,13 @@
1
+ import { WebchatClientSettings } from '@botonic/shared';
2
+ export interface WebchatInputBehavior {
3
+ isComposerVisible: boolean;
4
+ isTextInputEnabled: boolean;
5
+ areAttachmentsVisible: boolean;
6
+ isEmojiPickerVisible: boolean;
7
+ isAudioRecordingVisible: boolean;
8
+ blockInputs: WebchatClientSettings['block_inputs'];
9
+ }
10
+ export interface WebchatClientSettingsBehaviors {
11
+ input: WebchatInputBehavior;
12
+ }
13
+ export declare function createWebchatClientSettingsBehaviors(settings: WebchatClientSettings): WebchatClientSettingsBehaviors;
@@ -1,8 +1,15 @@
1
1
  import { WebchatController } from '@botonic/webchat-core';
2
- import { ComponentType, ReactNode } from 'react';
2
+ import { ComponentType, CSSProperties, ReactNode } from 'react';
3
3
  import { CoverComponentRegistry } from '../components/webchat-overlay';
4
+ export interface WebchatInputIcons {
5
+ emoji?: ReactNode;
6
+ attachment?: ReactNode;
7
+ microphone?: ReactNode;
8
+ send?: ReactNode;
9
+ }
4
10
  export interface BaseWebchatProps {
5
11
  className?: string;
12
+ style?: CSSProperties;
6
13
  'aria-label'?: string;
7
14
  }
8
15
  /**
@@ -57,6 +64,14 @@ export interface WebchatContainerProps extends BaseWebchatProps {
57
64
  export interface WebchatMessagesProps extends BaseWebchatProps {
58
65
  variant?: 'default';
59
66
  enableScrollToBottom?: boolean;
67
+ /** When true, message list can drive expanded vs collapsed from scroll position. */
68
+ hasUserInteracted?: boolean;
69
+ /** Called when the messages scroll area is no longer at the top. */
70
+ onScrollDepthChange?: (hasDepth: boolean) => void;
71
+ /** `true` when the message list is at the scroll top (hero header), `false` when scrolled away. */
72
+ onMessagesScrollAtTopChange?: (isAtTop: boolean) => void;
73
+ /** Called when a quick-reply or message action is selected. */
74
+ onUserInteraction?: () => void;
60
75
  }
61
76
  export interface WebchatInputProps extends BaseWebchatProps {
62
77
  placeholder?: string;
@@ -64,13 +79,43 @@ export interface WebchatInputProps extends BaseWebchatProps {
64
79
  disabled?: boolean;
65
80
  /** When true, shows the "Powered by Hubtype" line below the input. Default: true. */
66
81
  showBranding?: boolean;
82
+ /** Called when the emoji control is activated (UI-only until wired by consumer). */
83
+ onEmojiClick?: () => void;
84
+ /** Called when the attachment control is activated (UI-only until wired by consumer). */
85
+ onAttachmentClick?: () => void;
86
+ /** Called when the microphone control is activated (UI-only until wired by consumer). */
87
+ onMicrophoneClick?: () => void;
88
+ /** Override default SVG icons for action bar buttons. */
89
+ icons?: WebchatInputIcons;
90
+ /** Called when the user submits a message from the input. */
91
+ onUserMessageSent?: () => void;
67
92
  }
68
93
  export interface WebchatHeaderProps extends BaseWebchatProps {
69
94
  title?: string;
95
+ /** URL for the avatar image shown in the header. If omitted, a placeholder background is shown. */
96
+ avatarSrc?: string;
97
+ /** Alt text for the avatar image. */
98
+ avatarAlt?: string;
70
99
  showStatus?: boolean;
71
100
  showClose?: boolean;
72
101
  onClose?: () => void;
73
- variant?: 'default';
102
+ variant?: 'default' | 'expanded' | 'collapsed';
103
+ /**
104
+ * Collapse progress from 0 (expanded hero) to 1 (compact bar).
105
+ * When omitted, derived from `variant`: expanded → 0, default/collapsed → 1.
106
+ */
107
+ collapseProgress?: number;
108
+ hasShadow?: boolean;
109
+ /**
110
+ * When false, responsive hero header behavior is disabled (fixed compact bar).
111
+ * Defaults from `WebchatConfig.enableResponsiveHeroHeader` via context when omitted.
112
+ */
113
+ enableResponsiveHeroHeader?: boolean;
114
+ /**
115
+ * Composable slot for header actions (right side, before the close button).
116
+ * Use together with `PopoverTrigger` + `DropdownMenu` to build the menu.
117
+ */
118
+ children?: ReactNode;
74
119
  }
75
120
  export interface WebchatTriggerProps extends BaseWebchatProps {
76
121
  /** Hubtype App ID - required for webchat connection */
@@ -102,4 +147,14 @@ export interface WebchatTriggerProps extends BaseWebchatProps {
102
147
  * ```
103
148
  */
104
149
  loader?: WebchatLoader;
150
+ /**
151
+ * Message to show in a proactive pop-up bubble above the trigger.
152
+ * When undefined (default), no pop-up is shown.
153
+ */
154
+ proactiveMessage?: string;
155
+ /**
156
+ * Seconds of idle time before the proactive pop-up appears.
157
+ * @default 5
158
+ */
159
+ proactiveDelay?: number;
105
160
  }
@@ -0,0 +1 @@
1
+ export declare function formatTime(seconds: number): string;
@@ -0,0 +1 @@
1
+ export declare function timestampFromUuidV7(id: string): Date | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botonic/webchat-react",
3
- "version": "2.25.0",
3
+ "version": "2.27.0",
4
4
  "type": "module",
5
5
  "types": "./index.d.ts",
6
6
  "module": "./index.js",
@@ -26,8 +26,9 @@
26
26
  "peerDependencies": {
27
27
  "react": "^18.0.0",
28
28
  "react-dom": "^18.0.0",
29
- "@botonic/webchat-core": "2.25.0",
30
- "@botonic/shared": "2.25.0"
29
+ "@botonic/webchat-core": "2.27.0",
30
+ "@botonic/shared": "2.27.0",
31
+ "@lilara/ui-web-react": ">=0.6.0"
31
32
  },
32
33
  "publishConfig": {
33
34
  "access": "public"