hazo_chat 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 (135) hide show
  1. package/README.md +437 -0
  2. package/SETUP_CHECKLIST.md +858 -0
  3. package/dist/components/hazo_chat/hazo_chat.d.ts +16 -0
  4. package/dist/components/hazo_chat/hazo_chat.d.ts.map +1 -0
  5. package/dist/components/hazo_chat/hazo_chat.js +155 -0
  6. package/dist/components/hazo_chat/hazo_chat.js.map +1 -0
  7. package/dist/components/hazo_chat/hazo_chat_attachment_preview.d.ts +17 -0
  8. package/dist/components/hazo_chat/hazo_chat_attachment_preview.d.ts.map +1 -0
  9. package/dist/components/hazo_chat/hazo_chat_attachment_preview.js +60 -0
  10. package/dist/components/hazo_chat/hazo_chat_attachment_preview.js.map +1 -0
  11. package/dist/components/hazo_chat/hazo_chat_context.d.ts +36 -0
  12. package/dist/components/hazo_chat/hazo_chat_context.d.ts.map +1 -0
  13. package/dist/components/hazo_chat/hazo_chat_context.js +249 -0
  14. package/dist/components/hazo_chat/hazo_chat_context.js.map +1 -0
  15. package/dist/components/hazo_chat/hazo_chat_document_viewer.d.ts +15 -0
  16. package/dist/components/hazo_chat/hazo_chat_document_viewer.d.ts.map +1 -0
  17. package/dist/components/hazo_chat/hazo_chat_document_viewer.js +111 -0
  18. package/dist/components/hazo_chat/hazo_chat_document_viewer.js.map +1 -0
  19. package/dist/components/hazo_chat/hazo_chat_header.d.ts +16 -0
  20. package/dist/components/hazo_chat/hazo_chat_header.d.ts.map +1 -0
  21. package/dist/components/hazo_chat/hazo_chat_header.js +24 -0
  22. package/dist/components/hazo_chat/hazo_chat_header.js.map +1 -0
  23. package/dist/components/hazo_chat/hazo_chat_input.d.ts +18 -0
  24. package/dist/components/hazo_chat/hazo_chat_input.d.ts.map +1 -0
  25. package/dist/components/hazo_chat/hazo_chat_input.js +134 -0
  26. package/dist/components/hazo_chat/hazo_chat_input.js.map +1 -0
  27. package/dist/components/hazo_chat/hazo_chat_messages.d.ts +17 -0
  28. package/dist/components/hazo_chat/hazo_chat_messages.d.ts.map +1 -0
  29. package/dist/components/hazo_chat/hazo_chat_messages.js +109 -0
  30. package/dist/components/hazo_chat/hazo_chat_messages.js.map +1 -0
  31. package/dist/components/hazo_chat/hazo_chat_reference_list.d.ts +16 -0
  32. package/dist/components/hazo_chat/hazo_chat_reference_list.d.ts.map +1 -0
  33. package/dist/components/hazo_chat/hazo_chat_reference_list.js +59 -0
  34. package/dist/components/hazo_chat/hazo_chat_reference_list.js.map +1 -0
  35. package/dist/components/hazo_chat/hazo_chat_sidebar.d.ts +18 -0
  36. package/dist/components/hazo_chat/hazo_chat_sidebar.d.ts.map +1 -0
  37. package/dist/components/hazo_chat/hazo_chat_sidebar.js +72 -0
  38. package/dist/components/hazo_chat/hazo_chat_sidebar.js.map +1 -0
  39. package/dist/components/hazo_chat/index.d.ts +16 -0
  40. package/dist/components/hazo_chat/index.d.ts.map +1 -0
  41. package/dist/components/hazo_chat/index.js +19 -0
  42. package/dist/components/hazo_chat/index.js.map +1 -0
  43. package/dist/components/index.d.ts +9 -0
  44. package/dist/components/index.d.ts.map +1 -0
  45. package/dist/components/index.js +11 -0
  46. package/dist/components/index.js.map +1 -0
  47. package/dist/components/ui/avatar.d.ts +13 -0
  48. package/dist/components/ui/avatar.d.ts.map +1 -0
  49. package/dist/components/ui/avatar.js +28 -0
  50. package/dist/components/ui/avatar.js.map +1 -0
  51. package/dist/components/ui/badge.d.ts +16 -0
  52. package/dist/components/ui/badge.d.ts.map +1 -0
  53. package/dist/components/ui/badge.js +36 -0
  54. package/dist/components/ui/badge.js.map +1 -0
  55. package/dist/components/ui/button.d.ts +18 -0
  56. package/dist/components/ui/button.d.ts.map +1 -0
  57. package/dist/components/ui/button.js +47 -0
  58. package/dist/components/ui/button.js.map +1 -0
  59. package/dist/components/ui/chat_bubble.d.ts +19 -0
  60. package/dist/components/ui/chat_bubble.d.ts.map +1 -0
  61. package/dist/components/ui/chat_bubble.js +101 -0
  62. package/dist/components/ui/chat_bubble.js.map +1 -0
  63. package/dist/components/ui/index.d.ts +18 -0
  64. package/dist/components/ui/index.d.ts.map +1 -0
  65. package/dist/components/ui/index.js +20 -0
  66. package/dist/components/ui/index.js.map +1 -0
  67. package/dist/components/ui/input.d.ts +11 -0
  68. package/dist/components/ui/input.d.ts.map +1 -0
  69. package/dist/components/ui/input.js +18 -0
  70. package/dist/components/ui/input.js.map +1 -0
  71. package/dist/components/ui/loading_skeleton.d.ts +19 -0
  72. package/dist/components/ui/loading_skeleton.d.ts.map +1 -0
  73. package/dist/components/ui/loading_skeleton.js +30 -0
  74. package/dist/components/ui/loading_skeleton.js.map +1 -0
  75. package/dist/components/ui/scroll-area.d.ts +12 -0
  76. package/dist/components/ui/scroll-area.d.ts.map +1 -0
  77. package/dist/components/ui/scroll-area.js +25 -0
  78. package/dist/components/ui/scroll-area.js.map +1 -0
  79. package/dist/components/ui/separator.d.ts +11 -0
  80. package/dist/components/ui/separator.d.ts.map +1 -0
  81. package/dist/components/ui/separator.js +18 -0
  82. package/dist/components/ui/separator.js.map +1 -0
  83. package/dist/components/ui/skeleton.d.ts +9 -0
  84. package/dist/components/ui/skeleton.d.ts.map +1 -0
  85. package/dist/components/ui/skeleton.js +16 -0
  86. package/dist/components/ui/skeleton.js.map +1 -0
  87. package/dist/components/ui/textarea.d.ts +11 -0
  88. package/dist/components/ui/textarea.d.ts.map +1 -0
  89. package/dist/components/ui/textarea.js +18 -0
  90. package/dist/components/ui/textarea.js.map +1 -0
  91. package/dist/components/ui/tooltip.d.ts +14 -0
  92. package/dist/components/ui/tooltip.d.ts.map +1 -0
  93. package/dist/components/ui/tooltip.js +30 -0
  94. package/dist/components/ui/tooltip.js.map +1 -0
  95. package/dist/hooks/index.d.ts +10 -0
  96. package/dist/hooks/index.d.ts.map +1 -0
  97. package/dist/hooks/index.js +10 -0
  98. package/dist/hooks/index.js.map +1 -0
  99. package/dist/hooks/use_chat_messages.d.ts +25 -0
  100. package/dist/hooks/use_chat_messages.d.ts.map +1 -0
  101. package/dist/hooks/use_chat_messages.js +430 -0
  102. package/dist/hooks/use_chat_messages.js.map +1 -0
  103. package/dist/hooks/use_chat_references.d.ts +17 -0
  104. package/dist/hooks/use_chat_references.d.ts.map +1 -0
  105. package/dist/hooks/use_chat_references.js +133 -0
  106. package/dist/hooks/use_chat_references.js.map +1 -0
  107. package/dist/hooks/use_file_upload.d.ts +23 -0
  108. package/dist/hooks/use_file_upload.d.ts.map +1 -0
  109. package/dist/hooks/use_file_upload.js +212 -0
  110. package/dist/hooks/use_file_upload.js.map +1 -0
  111. package/dist/index.d.ts +13 -0
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.js +17 -0
  114. package/dist/index.js.map +1 -0
  115. package/dist/lib/config.d.ts +41 -0
  116. package/dist/lib/config.d.ts.map +1 -0
  117. package/dist/lib/config.js +93 -0
  118. package/dist/lib/config.js.map +1 -0
  119. package/dist/lib/constants.d.ts +39 -0
  120. package/dist/lib/constants.d.ts.map +1 -0
  121. package/dist/lib/constants.js +70 -0
  122. package/dist/lib/constants.js.map +1 -0
  123. package/dist/lib/index.d.ts +9 -0
  124. package/dist/lib/index.d.ts.map +1 -0
  125. package/dist/lib/index.js +9 -0
  126. package/dist/lib/index.js.map +1 -0
  127. package/dist/lib/utils.d.ts +17 -0
  128. package/dist/lib/utils.d.ts.map +1 -0
  129. package/dist/lib/utils.js +20 -0
  130. package/dist/lib/utils.js.map +1 -0
  131. package/dist/types/index.d.ts +367 -0
  132. package/dist/types/index.d.ts.map +1 -0
  133. package/dist/types/index.js +8 -0
  134. package/dist/types/index.js.map +1 -0
  135. package/package.json +93 -0
package/README.md ADDED
@@ -0,0 +1,437 @@
1
+ # hazo_chat
2
+
3
+ A full-featured React chat component library for 1-1 communication with document sharing, file attachments, and real-time messaging capabilities.
4
+
5
+ ## Features
6
+
7
+ - 📱 **Responsive Design** - Works on desktop and mobile with adaptive layout
8
+ - 💬 **Real-time Messaging** - Polling-based message updates with optimistic UI
9
+ - 📎 **File Attachments** - Support for documents and images with preview
10
+ - 📄 **Document Viewer** - Built-in PDF and image viewer
11
+ - 👤 **User Profiles** - Avatar display and user information
12
+ - 🔄 **Infinite Scroll** - Cursor-based pagination for message history
13
+ - ✅ **Read Receipts** - Track message read status
14
+ - 🗑️ **Soft Delete** - Delete messages with undo capability
15
+ - 🎨 **Customizable** - TailwindCSS-based theming
16
+
17
+ ## Table of Contents
18
+
19
+ - [Installation](#installation)
20
+ - [Quick Start](#quick-start)
21
+ - [Prerequisites](#prerequisites)
22
+ - [Main Component](#main-component)
23
+ - [Props Reference](#props-reference)
24
+ - [Hooks](#hooks)
25
+ - [Types](#types)
26
+ - [Database Schema](#database-schema)
27
+ - [Configuration](#configuration)
28
+ - [Development](#development)
29
+ - [License](#license)
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install hazo_chat hazo_connect hazo_auth
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ```tsx
40
+ 'use client';
41
+
42
+ import { HazoChat } from 'hazo_chat';
43
+ import { getHazoConnectSingleton } from 'hazo_connect/nextjs/setup';
44
+
45
+ // Create hazo_auth service wrapper
46
+ const hazo_auth = {
47
+ hazo_get_auth: async () => {
48
+ const response = await fetch('/api/hazo_auth/me');
49
+ const data = await response.json();
50
+ return data.is_authenticated ? { id: data.user_id, email: data.email } : null;
51
+ },
52
+ hazo_get_user_profiles: async (user_ids: string[]) => {
53
+ const response = await fetch('/api/hazo_auth/profiles', {
54
+ method: 'POST',
55
+ headers: { 'Content-Type': 'application/json' },
56
+ body: JSON.stringify({ user_ids }),
57
+ });
58
+ const data = await response.json();
59
+ return data.profiles;
60
+ },
61
+ };
62
+
63
+ function ChatPage() {
64
+ const hazo_connect = getHazoConnectSingleton();
65
+
66
+ return (
67
+ <HazoChat
68
+ hazo_connect={hazo_connect}
69
+ hazo_auth={hazo_auth}
70
+ receiver_user_id="recipient-uuid"
71
+ document_save_location="/uploads/chat"
72
+ reference_id="conversation-123"
73
+ reference_type="support"
74
+ title="Chat with Support"
75
+ subtitle="We're here to help"
76
+ />
77
+ );
78
+ }
79
+ ```
80
+
81
+ ## Prerequisites
82
+
83
+ ### Peer Dependencies
84
+
85
+ | Package | Version | Description |
86
+ |---------|---------|-------------|
87
+ | `hazo_connect` | ^2.3.1 | Database adapter (required) |
88
+ | `hazo_auth` | ^1.0.0 | Authentication service (required) |
89
+ | `react` | ^18.0.0 | React framework |
90
+ | `react-dom` | ^18.0.0 | React DOM |
91
+
92
+ ### Required Setup
93
+
94
+ 1. **Database** - SQLite or PostgreSQL with the `hazo_chat` table
95
+ 2. **Authentication** - Working hazo_auth setup with user management
96
+ 3. **API Routes** - Backend endpoints for chat operations
97
+ 4. **Configuration Files** - hazo_connect_config.ini for database connection
98
+
99
+ See [SETUP_CHECKLIST.md](./SETUP_CHECKLIST.md) for detailed setup instructions.
100
+
101
+ ## Main Component
102
+
103
+ ### HazoChat
104
+
105
+ The primary component that provides a complete chat interface.
106
+
107
+ ```tsx
108
+ import { HazoChat } from 'hazo_chat';
109
+
110
+ <HazoChat
111
+ hazo_connect={adapter}
112
+ hazo_auth={authService}
113
+ receiver_user_id="user-123"
114
+ document_save_location="/uploads"
115
+ reference_id="project-456"
116
+ reference_type="project_chat"
117
+ timezone="Australia/Sydney"
118
+ title="Project Discussion"
119
+ subtitle="Design Review"
120
+ additional_references={[
121
+ { id: 'doc-1', type: 'document', name: 'Design.pdf', url: '/files/design.pdf', scope: 'field' }
122
+ ]}
123
+ on_close={() => console.log('Chat closed')}
124
+ className="h-[600px]"
125
+ />
126
+ ```
127
+
128
+ ## Props Reference
129
+
130
+ ### HazoChatProps
131
+
132
+ | Prop | Type | Required | Default | Description |
133
+ |------|------|----------|---------|-------------|
134
+ | `hazo_connect` | `HazoConnectAdapter` | ✅ | - | Database adapter instance |
135
+ | `hazo_auth` | `HazoAuthInstance` | ✅ | - | Authentication service |
136
+ | `receiver_user_id` | `string` | ✅ | - | UUID of the chat recipient |
137
+ | `document_save_location` | `string` | ✅ | - | Path for uploaded documents |
138
+ | `reference_id` | `string` | ❌ | - | Main reference ID for the chat |
139
+ | `reference_type` | `string` | ❌ | `'chat'` | Type of reference |
140
+ | `additional_references` | `ReferenceItem[]` | ❌ | `[]` | Pre-loaded document references |
141
+ | `timezone` | `string` | ❌ | `'GMT+10'` | Timezone for timestamps |
142
+ | `title` | `string` | ❌ | - | Chat header title |
143
+ | `subtitle` | `string` | ❌ | - | Chat header subtitle |
144
+ | `on_close` | `() => void` | ❌ | - | Close button callback |
145
+ | `className` | `string` | ❌ | - | Additional CSS classes |
146
+
147
+ ### HazoAuthInstance
148
+
149
+ The authentication service must implement these methods:
150
+
151
+ ```typescript
152
+ interface HazoAuthInstance {
153
+ /** Get current authenticated user */
154
+ hazo_get_auth: () => Promise<{ id: string; email?: string } | null>;
155
+
156
+ /** Get user profiles by IDs */
157
+ hazo_get_user_profiles: (user_ids: string[]) => Promise<HazoUserProfile[]>;
158
+ }
159
+
160
+ interface HazoUserProfile {
161
+ id: string;
162
+ name: string;
163
+ email?: string;
164
+ avatar_url?: string;
165
+ }
166
+ ```
167
+
168
+ ## Hooks
169
+
170
+ ### useChatMessages
171
+
172
+ Manages chat messages with pagination, polling, and CRUD operations.
173
+
174
+ ```tsx
175
+ import { useChatMessages } from 'hazo_chat';
176
+
177
+ const {
178
+ messages, // ChatMessage[] - All loaded messages
179
+ is_loading, // boolean - Initial loading state
180
+ is_loading_more, // boolean - Pagination loading state
181
+ has_more, // boolean - More messages available
182
+ error, // string | null - Error message
183
+ polling_status, // 'connected' | 'reconnecting' | 'error'
184
+ load_more, // () => void - Load older messages
185
+ send_message, // (payload) => Promise<boolean>
186
+ delete_message, // (message_id) => Promise<boolean>
187
+ mark_as_read, // (message_id) => Promise<void>
188
+ refresh, // () => void - Reload messages
189
+ } = useChatMessages({
190
+ hazo_connect,
191
+ hazo_auth,
192
+ reference_id: 'chat-123',
193
+ receiver_user_id: 'user-456',
194
+ polling_interval: 5000, // Optional, default: 5000ms
195
+ messages_per_page: 20, // Optional, default: 20
196
+ });
197
+ ```
198
+
199
+ ### useChatReferences
200
+
201
+ Manages document references across messages and props.
202
+
203
+ ```tsx
204
+ import { useChatReferences } from 'hazo_chat';
205
+
206
+ const {
207
+ references, // ChatReferenceItem[] - All references
208
+ selected_reference, // ChatReferenceItem | null
209
+ select_reference, // (ref) => void
210
+ clear_selection, // () => void
211
+ add_reference, // (ref) => void
212
+ get_message_for_reference, // (ref_id) => string | null
213
+ } = useChatReferences({
214
+ messages,
215
+ initial_references: [],
216
+ on_selection_change: (ref) => console.log('Selected:', ref),
217
+ });
218
+ ```
219
+
220
+ ### useFileUpload
221
+
222
+ Handles file validation, preview, and upload.
223
+
224
+ ```tsx
225
+ import { useFileUpload } from 'hazo_chat';
226
+
227
+ const {
228
+ pending_attachments, // PendingAttachment[]
229
+ add_files, // (files: File[]) => void
230
+ remove_file, // (id: string) => void
231
+ upload_all, // () => Promise<UploadedFile[]>
232
+ clear_all, // () => void
233
+ is_uploading, // boolean
234
+ validation_errors, // string[]
235
+ } = useFileUpload({
236
+ upload_location: '/uploads/chat',
237
+ max_file_size_mb: 10, // Optional, default: 10
238
+ allowed_types: ['pdf', 'png', 'jpg'], // Optional
239
+ upload_function: customUploader, // Optional custom uploader
240
+ });
241
+ ```
242
+
243
+ ## Types
244
+
245
+ ### ChatMessage
246
+
247
+ ```typescript
248
+ interface ChatMessage {
249
+ id: string;
250
+ reference_id: string;
251
+ reference_type: string;
252
+ sender_user_id: string;
253
+ receiver_user_id: string;
254
+ message_text: string | null;
255
+ reference_list: ChatReferenceItem[] | null;
256
+ read_at: string | null;
257
+ deleted_at: string | null;
258
+ created_at: string;
259
+ changed_at: string;
260
+ sender_profile?: HazoUserProfile;
261
+ receiver_profile?: HazoUserProfile;
262
+ is_sender: boolean;
263
+ send_status?: 'sending' | 'sent' | 'failed';
264
+ }
265
+ ```
266
+
267
+ ### ChatReferenceItem
268
+
269
+ ```typescript
270
+ interface ChatReferenceItem {
271
+ id: string;
272
+ type: 'document' | 'field' | 'url';
273
+ scope: 'chat' | 'field';
274
+ name: string;
275
+ url: string;
276
+ mime_type?: string;
277
+ file_size?: number;
278
+ message_id?: string;
279
+ }
280
+ ```
281
+
282
+ ### CreateMessagePayload
283
+
284
+ ```typescript
285
+ interface CreateMessagePayload {
286
+ reference_id: string;
287
+ reference_type: string;
288
+ receiver_user_id: string;
289
+ message_text: string;
290
+ reference_list?: ChatReferenceItem[];
291
+ }
292
+ ```
293
+
294
+ ## Database Schema
295
+
296
+ ### hazo_chat Table
297
+
298
+ ```sql
299
+ CREATE TABLE hazo_chat (
300
+ id TEXT PRIMARY KEY,
301
+ reference_id TEXT NOT NULL,
302
+ reference_type TEXT DEFAULT 'chat',
303
+ sender_user_id TEXT NOT NULL,
304
+ receiver_user_id TEXT NOT NULL,
305
+ message_text TEXT,
306
+ reference_list TEXT, -- JSON array of ChatReferenceItem
307
+ read_at TEXT,
308
+ deleted_at TEXT,
309
+ created_at TEXT NOT NULL,
310
+ changed_at TEXT NOT NULL,
311
+
312
+ -- Foreign keys (if using referential integrity)
313
+ FOREIGN KEY (sender_user_id) REFERENCES hazo_users(id),
314
+ FOREIGN KEY (receiver_user_id) REFERENCES hazo_users(id)
315
+ );
316
+
317
+ -- Indexes for performance
318
+ CREATE INDEX idx_hazo_chat_reference_id ON hazo_chat(reference_id);
319
+ CREATE INDEX idx_hazo_chat_sender ON hazo_chat(sender_user_id);
320
+ CREATE INDEX idx_hazo_chat_receiver ON hazo_chat(receiver_user_id);
321
+ CREATE INDEX idx_hazo_chat_created ON hazo_chat(created_at);
322
+ ```
323
+
324
+ ## Configuration
325
+
326
+ ### hazo_chat_config.ini (Optional)
327
+
328
+ ```ini
329
+ [chat]
330
+ # Polling interval in milliseconds
331
+ polling_interval = 5000
332
+
333
+ # Messages to load per page
334
+ messages_per_page = 20
335
+
336
+ [uploads]
337
+ # Maximum file size in MB
338
+ max_file_size_mb = 10
339
+
340
+ # Allowed file extensions (comma-separated)
341
+ allowed_types = pdf,png,jpg,jpeg,gif,txt,doc,docx
342
+ ```
343
+
344
+ ### Default Values
345
+
346
+ | Setting | Default | Description |
347
+ |---------|---------|-------------|
348
+ | `polling_interval` | 5000ms | How often to check for new messages |
349
+ | `messages_per_page` | 20 | Messages loaded per pagination request |
350
+ | `max_file_size_mb` | 10 | Maximum upload file size |
351
+ | `timezone` | 'GMT+10' | Default timezone for timestamps |
352
+
353
+ ## Development
354
+
355
+ ### Building the Package
356
+
357
+ ```bash
358
+ # Clean and build
359
+ npm run build
360
+
361
+ # Watch mode
362
+ npm run dev:package
363
+ ```
364
+
365
+ ### Running Test App
366
+
367
+ ```bash
368
+ # Build package and start test app
369
+ npm run dev:test-app
370
+
371
+ # Or build both for production
372
+ npm run build:test-app
373
+ ```
374
+
375
+ ### Project Structure
376
+
377
+ ```
378
+ hazo_chat/
379
+ ├── src/
380
+ │ ├── components/
381
+ │ │ ├── hazo_chat/ # Main chat components
382
+ │ │ └── ui/ # Reusable UI components
383
+ │ ├── hooks/ # React hooks
384
+ │ ├── lib/ # Utilities and constants
385
+ │ └── types/ # TypeScript definitions
386
+ ├── test-app/ # Next.js test application
387
+ ├── dist/ # Compiled output (git-ignored)
388
+ └── package.json
389
+ ```
390
+
391
+ ### Package Exports
392
+
393
+ ```typescript
394
+ // Main export
395
+ import { HazoChat, useChatMessages, useChatReferences, useFileUpload } from 'hazo_chat';
396
+
397
+ // Components only
398
+ import { HazoChat, ChatBubble, ChatInput } from 'hazo_chat/components';
399
+
400
+ // Library utilities
401
+ import { DEFAULT_POLLING_INTERVAL, MIME_TYPE_MAP } from 'hazo_chat/lib';
402
+ ```
403
+
404
+ ## Troubleshooting
405
+
406
+ ### Common Issues
407
+
408
+ 1. **"hazo_connect.from is not a function"**
409
+ - Ensure you're using `getHazoConnectSingleton()` from `hazo_connect/nextjs/setup`
410
+ - The adapter must be the HazoConnectAdapter type, not a raw connection
411
+
412
+ 2. **Hydration errors**
413
+ - Wrap client components in Suspense boundaries
414
+ - Use `mounted` state to delay client-side rendering
415
+
416
+ 3. **Module not found errors**
417
+ - Add transpilePackages in next.config.js: `['hazo_chat', 'hazo_connect', 'hazo_auth']`
418
+ - Check webpack aliases for hazo_auth imports
419
+
420
+ 4. **Messages not loading**
421
+ - Verify database connection in hazo_connect_config.ini
422
+ - Check API route `/api/hazo_chat/messages` exists and works
423
+ - Ensure `reference_id` is provided to the component
424
+
425
+ ## Related Packages
426
+
427
+ - [hazo_connect](https://github.com/pub12/hazo_connect) - Database adapter
428
+ - [hazo_auth](https://github.com/pub12/hazo_auth) - Authentication service
429
+ - [hazo_config](https://github.com/pub12/hazo_config) - Configuration management
430
+
431
+ ## License
432
+
433
+ MIT © Pubs Abayasiri
434
+
435
+ ---
436
+
437
+ For detailed setup instructions, see [SETUP_CHECKLIST.md](./SETUP_CHECKLIST.md).