@@ -39,6 +39,17 @@ Events anonymously logged via pixels.js
3939- ** ` app/page.tsx ` ** - Main page component managing widget lifecycle and event handlers
4040- ** ` components/consent-form/ ` ** - Privacy consent form shown before widget loads
4141- ** ` components/footer/ ` ** - Site footer with links and company information
42+ - ** ` components/burn-animation/ ` ** - Fullscreen burn animation overlay displayed when clearing conversation data
43+ - ` burn-overlay.tsx ` - Overlay wrapper that fetches and displays Lottie animation
44+ - ` burn-animation.tsx ` - Lottie animation component wrapper
45+ - ** ` components/fire-button/ ` ** - Button component for clearing conversation data (icon or button appearance)
46+ - ** ` components/confirm-dialog/ ` ** - Modal confirmation dialog for clearing conversation data with keyboard navigation and focus management
47+ - ** ` components/chat-navigation/ ` ** - Navigation links displayed below the chat widget (FAQs, Feedback)
48+ - ** ` components/main-heading/ ` ** - Main page heading component with consistent branding
49+ - ** ` components/horizontal-rule/ ` ** - Visual separator component for section divisions
50+ - ** ` components/new-tab-label/ ` ** - Screen reader label for links that open in new tabs
51+ - ** ` components/button/ ` ** - Reusable button component with customizable styling
52+ - ** ` components/page-load-pixel/ ` ** - Component that fires page impression pixel on mount
4253
4354### Zendesk Integration
4455
@@ -55,7 +66,12 @@ The application uses three main hooks for Zendesk integration (see [`src/hooks/R
5566- ** ` utils/build-article-url.ts ` ** - Builds complete article URLs using the URL constructor
5667- ** ` utils/update-article-links.ts ` ** - Updates article links in a document based on article ID mapping
5768- ** ` utils/get-css-variable.ts ` ** - Reads CSS variable values from the document root
58- - ** ` utils/get-slug-from-url.ts ` ** - Extracts and sanitizes the last path segment from a URL for use in pixel event tracking
69+ - ** ` utils/get-slug-from-url.ts ` ** - Extracts and sanitizes the last path segment from a URL for use in pixel event logging
70+ - ** ` utils/get-storage-with-expiry.ts ` ** - Retrieves boolean values from localStorage with date-based expiry (YYYY-MM-DD format)
71+ - ** ` utils/set-storage-with-expiry.ts ` ** - Stores boolean values in localStorage with date-based expiry (YYYY-MM-DD format)
72+ - ** ` utils/delete-storage-keys-by-suffix.ts ` ** - Deletes localStorage keys matching a suffix pattern
73+ - ** ` utils/is-browser.ts ` ** - Checks if code is running in a browser environment (SSR safety)
74+ - ** ` utils/cleanup-zendesk.ts ` ** - Cleans up all Zendesk DOM elements, scripts, and global objects when resetting the widget
5975
6076### Logging
6177
@@ -120,6 +136,34 @@ npm run build
120136npm start
121137```
122138
139+ ### Testing
140+
141+ The project uses Playwright for testing. See [ ` src/tests/README.md ` ] ( ./src/tests/README.md ) for comprehensive testing documentation.
142+
143+ ``` bash
144+ # Run all tests
145+ npm test
146+
147+ # Run with UI mode (interactive)
148+ npm run test:ui
149+
150+ # Run in headed mode (visible browser)
151+ npm run test:headed
152+
153+ # Run only integration tests
154+ npm test -- src/tests/integration/
155+
156+ # Run only unit tests
157+ npm test -- src/tests/unit/
158+ ```
159+
160+ ** Test Coverage:**
161+
162+ - ✅ 19 unit tests - Pure utility function tests (build-article-url, get-slug-from-url, get-storage-with-expiry)
163+ - ✅ 9 integration tests - Complete end-to-end user flow tests with Zendesk widget mocking
164+
165+ Tests run automatically in CI before deployment.
166+
123167## Configuration
124168
125169### Common Configuration
@@ -142,50 +186,74 @@ Zendesk configuration is in `src/config/zendesk.ts`:
142186
143187```
144188src/
145- ├── app/ # Next.js App Router pages
146- │ ├── layout.tsx # Root layout with header, footer, theme provider
147- │ └── page.tsx # Main page with Zendesk integration
148- ├── components/ # React components
149- │ ├── button/ # Reusable button component
150- │ ├── consent-form/ # Privacy consent form
151- │ ├── footer/ # Site footer
152- │ └── page-load-pixel/ # Page load event dispatcher
153- ├── config/ # Configuration constants
154- │ ├── common.ts # Common site configuration
155- │ ├── fonts.ts # Font configuration
156- │ └── zendesk.ts # Zendesk widget configuration
157- ├── constants/ # Application constants
158- │ ├── breakpoints.ts # Responsive breakpoint constants
159- │ ├── footerLinks.ts # Footer link definitions
160- │ ├── zendesk-selectors.ts # CSS selectors for Zendesk elements
161- │ ├── zendesk-styles.ts # Custom CSS for Zendesk iframe
162- │ └── zendesk-timing.ts # Timing constants for retries/delays
163- ├── hooks/ # React hooks
164- │ ├── README.md # Documentation for Zendesk integration hooks
165- │ ├── use-media-query.ts # Responsive design hook
166- │ ├── use-zendesk-click-handlers.ts # Click event handlers
167- │ ├── use-zendesk-iframe-styles.ts # Style injection
168- │ └── use-zendesk-swap-article-links.ts # Article link swapping
169- ├── reducers/ # State reducers
170- │ └── widget-reducer.ts # Widget lifecycle state reducer
171- ├── tests/ # Test files
172- │ ├── fixtures/ # Test fixtures and mocks
173- │ │ └── zendesk-mock.js # Zendesk widget mock for testing
174- │ ├── integration/ # Integration tests
175- │ │ └── complete-flow.test.ts # End-to-end user flow tests
176- │ ├── unit/ # Unit tests
177- │ │ ├── build-article-url.test.ts # URL building utility tests
178- │ │ └── get-slug-from-url.test.ts # URL slug extraction tests
179- │ └── README.md # Testing documentation
180- ├── types/ # TypeScript type definitions
181- │ └── zendesk.d.ts # Extended Zendesk Web Widget types
182- └── utils/ # Utility functions
183- ├── build-article-url.ts # URL building utility
184- ├── get-css-variable.ts # CSS variable reader
185- ├── get-slug-from-url.ts # URL slug extraction and sanitization
186- ├── update-article-links.ts # Link updating utility
187- ├── zendesk-iframe.ts # Iframe access utilities
188- └── zendesk-observer.ts # MutationObserver setup utility
189+ ├── app/ # Next.js App Router pages
190+ │ ├── layout.tsx # Root layout with header, footer, theme provider
191+ │ └── page.tsx # Main page with Zendesk integration
192+ ├── components/ # React components
193+ │ ├── burn-animation/ # Burn animation overlay for clearing data
194+ │ ├── button/ # Reusable button component
195+ │ ├── chat-navigation/ # Navigation links below chat widget
196+ │ ├── confirm-dialog/ # Confirmation dialog modal
197+ │ ├── consent-form/ # Privacy consent form
198+ │ ├── error-boundary/ # Error boundary component
199+ │ ├── fire-button/ # Clear conversation data button
200+ │ ├── footer/ # Site footer
201+ │ ├── horizontal-rule/ # Visual separator component
202+ │ ├── main-heading/ # Main page heading
203+ │ ├── new-tab-label/ # Screen reader label for new tab links
204+ │ └── page-load-pixel/ # Page load event dispatcher
205+ ├── config/ # Configuration constants
206+ │ ├── common.ts # Common site configuration
207+ │ ├── fonts.ts # Font configuration
208+ │ └── zendesk.ts # Zendesk widget configuration
209+ ├── constants/ # Application constants
210+ │ ├── breakpoints.ts # Responsive breakpoint constants
211+ │ ├── footerLinks.ts # Footer link definitions
212+ │ ├── test-ids.ts # Test ID constants for Playwright tests
213+ │ ├── theme.ts # Theme constants and types
214+ │ ├── zendesk-selectors.ts # CSS selectors for Zendesk elements
215+ │ ├── zendesk-styles.ts # Custom CSS for Zendesk iframe
216+ │ └── zendesk-timing.ts # Timing constants for retries/delays
217+ ├── contexts/ # React contexts
218+ │ └── theme-context.tsx # Theme context provider (system preference)
219+ ├── hooks/ # React hooks
220+ │ ├── README.md # Documentation for Zendesk integration hooks
221+ │ ├── use-media-query.ts # Responsive design hook
222+ │ ├── use-zendesk-click-handlers.ts # Click event handlers
223+ │ ├── use-zendesk-iframe-styles.ts # Style injection
224+ │ └── use-zendesk-swap-article-links.ts # Article link swapping
225+ ├── reducers/ # State reducers
226+ │ └── widget-reducer.ts # Widget lifecycle state reducer (zendeskReady, loadWidget, firstMessageSent)
227+ ├── tests/ # Test files
228+ │ ├── fixtures/ # Test fixtures and mocks
229+ │ │ └── zendesk-mock.js # Zendesk widget mock for testing
230+ │ ├── integration/ # Integration tests
231+ │ │ └── complete-flow.test.ts # End-to-end user flow tests (9 tests)
232+ │ ├── unit/ # Unit tests
233+ │ │ ├── build-article-url.test.ts # URL building utility tests (3 tests)
234+ │ │ ├── get-slug-from-url.test.ts # URL slug extraction tests (3 tests)
235+ │ │ └── get-storage-with-expiry.test.ts # Storage expiry utility tests (13 tests)
236+ │ └── README.md # Testing documentation
237+ ├── icons/ # SVG icon assets
238+ │ ├── logo-horizontal-dark.svg # DuckDuckGo logo (dark theme)
239+ │ ├── logo-horizontal-light.svg # DuckDuckGo logo (light theme)
240+ │ ├── logo-stacked-dark.svg # DuckDuckGo stacked logo (dark theme)
241+ │ └── logo-stacked-light.svg # DuckDuckGo stacked logo (light theme)
242+ ├── types/ # TypeScript type definitions
243+ │ ├── lottie.ts # Lottie animation type definitions
244+ │ └── zendesk.d.ts # Extended Zendesk Web Widget types
245+ └── utils/ # Utility functions
246+ ├── build-article-url.ts # URL building utility
247+ ├── delete-storage-keys-by-suffix.ts # localStorage key deletion by suffix
248+ ├── get-css-variable.ts # CSS variable reader
249+ ├── get-slug-from-url.ts # URL slug extraction and sanitization
250+ ├── get-storage-with-expiry.ts # localStorage retrieval with date expiry
251+ ├── is-browser.ts # Browser environment detection (SSR safety)
252+ ├── set-storage-with-expiry.ts # localStorage storage with date expiry
253+ ├── cleanup-zendesk.ts # Zendesk widget cleanup utility
254+ ├── update-article-links.ts # Link updating utility
255+ ├── zendesk-iframe.ts # Iframe access utilities
256+ └── zendesk-observer.ts # MutationObserver setup utility
189257```
190258
191259## Deployment
0 commit comments