Skip to content

Conversation

@odanree
Copy link
Owner

@odanree odanree commented Nov 7, 2025

Problem

PR #39 fixed the CSS colors for WCAG AAA compliance (#007bff -> #0056b3), but the JavaScript file uses inline styles that override the CSS.

Solution

Updated all inline style declarations in \chat-widget.js:

  • Header background: #007bff -> #0056b3
  • Send button background: #007bff -> #0056b3
  • User message bubbles: #007bff -> #0056b3

Testing

Contrast ratio: 3.14:1 -> 5.89:1 (WCAG AAA pass)
All inline styles now match CSS

Related

Completes fix from PR #39

odanree and others added 30 commits November 3, 2025 13:32
- Define main (production) and dev (development) branches
- Document feature, fix, refactor, docs, and chore branch types
- Add step-by-step git workflow guide
- Include conventional commit format with examples
- Document pull request process and best practices
- Add release process and branch protection rules
- Include troubleshooting for common git issues
- Add daily workflow and best practices
- Define PR requirements and merge strategy
- Mark OpenAI integration task as complete (PR #1)
- Update progress to 58% (9 of 16 tasks)
- Update Phase 2 progress to 50%
- Update PR status in task list
- Document current branch structure
- Show commit timeline and history
- Add quick reference for git commands
- Include progress tracking metrics
- Provide next steps for development
- Add branching strategy quick reference
* docs: add comprehensive branching strategy guide

- Define main (production) and dev (development) branches
- Document feature, fix, refactor, docs, and chore branch types
- Add step-by-step git workflow guide
- Include conventional commit format with examples
- Document pull request process and best practices
- Add release process and branch protection rules
- Include troubleshooting for common git issues
- Add daily workflow and best practices
- Define PR requirements and merge strategy

* feat(openai): implement OpenAI integration with rate limiting

- Implement getAIResponse() for OpenAI API calls
- Add getAIResponseStream() for streaming responses
- Implement rate limiting (30 req/min)
- Add error handling with specific error codes
- Support conversation history for context
- Add system prompt for ecommerce support bot
- Implement getRateLimitStatus() for monitoring
- Add TypeScript types for all functions
- Update API routes to use OpenAI integration
- Add /api/health and /api/rate-limit endpoints
- Create comprehensive OpenAI setup guide
- Update .env.example with all required variables
- Add unit test stubs for openai module

Refs #1

---------

Co-authored-by: odanree <your-email@example.com>
- Complete Shopify integration with GraphQL clients
- 6 unit tests for Shopify functions
- 11 unit tests for OpenAI integration
- Comprehensive setup documentation
- Package updates with Vitest testing framework
- Lazy initialize OpenAI client to handle missing API key gracefully
- Fix type errors with error.code that can be null
- Tests can now run with or without API key
- All feature branches base on dev (not main)
- Feature PRs merge to dev (not main)
- Only one PR type to main: release from dev
- Clarify linear one-way flow: feature  dev  main
- Add visual diagrams showing branch structure
- Update workflow examples for simplicity
- Emphasize never working directly on main/dev
- Create test-integrations.ts for quick validation
- Add INTEGRATION_TESTING.md with comprehensive testing guide
- Add INTEGRATION_TEST_RESULTS.md with test results
- All tests pass, code ready for production
- Validates all integration functions work
- Server runs on port 4000 successfully
…intent recognition

- Implement conversation context management (src/bot/context.ts)
  * Session management with timeout handling
  * Message history tracking and retrieval
  * User context enrichment
  * Conversation summarization
  * Automatic session cleanup

- Create intent recognition system (src/bot/intents.ts)
  * Intent classification: product inquiry, pricing, order status, small talk
  * Entity extraction: product type, color, size, order ID
  * Confidence scoring for intent accuracy
  * Shopify vs OpenAI handler routing

- Integrate bot orchestration (src/bot/index.ts)
  * Multi-turn conversation support
  * Intelligent handler selection (Shopify, OpenAI, or hybrid)
  * Error handling and graceful fallbacks
  * Context-aware response generation

- Comprehensive testing (tests/phase4.test.ts)
  * 12 context management tests
  * 13 intent recognition tests
  * 8 bot orchestration tests
  * 1 end-to-end integration test
  * All 34/34 tests passing

Phase 4 Complete: Bot Logic (75% project completion)
- Delete 9 Phase-specific markdown files (PHASE_3_COMPLETION, PHASE_4_COMPLETE, PHASE_4_EXPLAINER_AND_NEXT_STEPS, PHASE_4_SESSION_SUMMARY, PHASE_5_QUICK_START_GUIDE, PHASE_5_TESTING_QA_PLAN, and archive copies)
- Delete 2 cleanup/organization meta-documentation files
- Move EXPLAINER.md to archive (Phase 4 specific content)
- Update INDEX.md (13 replacements) to remove all Phase references
- Update README.md to remove Phase status and planning
- Update docs/planning/README.md to remove Phase 5 plan references
- Update docs/code-review/README.md to remove EXPLAINER references
- Documentation now focused on evergreen architecture and planning vs time-bound phases
- Reduces documentation from 24 files to 11 core + archive structure
- Simplifies reading time and reduces duplication
odanree and others added 29 commits November 5, 2025 21:55
- Add searchProducts integration to /api/chat endpoint
- Detect product-related keywords in user messages
- Fetch real Shopify products and inject into AI context
- AI now responds with actual product data (title, price, ID)
- Improved ecommerce strategy with live product search

Fixes issue where bot said 'just a moment' but never responded
Now handles: 'find me a large blue next.js tshirt' with real products

Refs #31
CRITICAL FIX: Moved dotenv.config() to top of file before any imports.
This ensures SHOPIFY_STORE_DOMAIN and other env vars are loaded before
the shopify.ts module reads them at import time.

Issue: shopify.ts reads process.env at module-level (const SHOPIFY_DOMAIN)
which happened BEFORE dotenv loaded .env.local, causing 'MISSING_STORE_DOMAIN'

Solution: Import dotenv first, call config() immediately, then import other modules

Fixes #31
CRITICAL FIX: Shopify env vars were being read at module-level (cached)
before dotenv loaded them, causing MISSING_STORE_DOMAIN errors.

Changes:
- Created getShopifyConfig() to read env vars at runtime
- Updated all functions to call getShopifyConfig() instead of using cached constants
- Ensures env vars are always fresh from process.env

This fixes the issue where debug logs showed vars were SET but Shopify
integration said they were MISSING.

Fixes #31
- Replace shopify-headless-8746 with shopify-headless
- Consolidating to project name without numbers
- Maintains all preview and production URLs
- Add shopify-headless-lemon.vercel.app (primary production URL)
- Add shopify-headless-danh-les-projects.vercel.app (alias)
- Replace placeholder shopify-headless.vercel.app with actual URLs
- Configure git.deploymentEnabled to only deploy main branch
- Disable automatic deployments on dev branch
- Reduces deployment quota usage
- Remove duplicate Vercel deployment via GitHub Actions
- Vercel now deploys natively via GitHub integration
- Remove health check job (no longer needed)
- Simplify notify job dependencies
- Fixes failing deploy step in CI/CD

Vercel auto-deploys from main branch via native integration.
GitHub Actions now only runs tests and lint checks.
- Add handle and onlineStoreUrl fields to GraphQL query
- Update ShopifyProduct interface with handle and url fields
- Include actual product URLs in AI context
- AI now provides real clickable links instead of hallucinated URLs

This fixes the issue where AI was generating fake example-store.com URLs.
- Changed product URLs to point to headless Next.js frontend
- Format: https://shopify-headless-lemon.vercel.app/products/{handle}
- Updated both searchProducts and getProductInfo functions
- Added HEADLESS_STOREFRONT_URL constant
- Updated copilot instructions with local testing workflow

Fixes issue where URLs were pointing to 404 pages.
Now URLs point to working headless storefront product pages.

Refs #33
- Added conditional checks to skip workflow on merge commits from main to dev
- Prevents redundant CI/CD runs when syncing dev branch after PR merges
- Applied to lint-and-types, test, and notify jobs
- Docker job already has main-only condition

This fixes the issue where GitHub Actions would run unnecessarily
when doing 'git pull origin main' followed by 'git push origin dev'
to keep the dev branch in sync.

Refs #33
- Updated README to emphasize dual behavioral strategies (Portfolio + Ecommerce)
- Highlighted Ecommerce Strategy with Shopify Admin API integration
- Listed order tracking, customer lookup, and shopping assistance capabilities
- Marked both strategies as Production Ready
- Reorganized features section to lead with strategy pattern

Refs #shopify-application
- Multi-stage Dockerfile with Node 18 Alpine
- Non-root user (nodejs:1001) for security
- Health checks on /api/health endpoint
- docker-compose.yml with environment variables
- Auto-restart policy and logs volume
- Fixed package-lock.json in build context
- Fixed server startup for production mode
- Fixed port configuration (4000)
- Tested and working with chat API

Docker image: ai-chatbot:0.3.0
Status: Production-ready

Updates:
- README.md: Docker setup section with features
- ROADMAP.md: Phase 6.1 marked complete
- INDEX.md: Updated status with Docker ready

Refs #14
- Log chat_message events with structured JSON
- Track: strategy, message length, history length, context, success
- Log chat_error events with error type and message
- Add view-analytics.ps1 helper script
- Add test-analytics.ps1 for automated testing
- Works with Vercel logs for production analytics

Quick win: 10 minutes, no database needed
View at: https://vercel.com/danh-les-projects/ai-chatbot/logs

Refs #35
- README.md: Added Analytics section with examples and viewing info
- ROADMAP.md: Phase 6.6 complete - Analytics Logging
- INDEX.md: Updated status to include Analytics

All three docs now reflect the analytics quick win feature
- openai-integration.test.ts: Relaxed timing assertion (50ms -> 45ms) for CI/CD tolerance
- openai.test.ts: Skip tests with mock API keys to prevent unhandled errors

Fixes flaky test failures in CI/CD pipeline
- Add floating action button (FAB) for mobile devices
- Widget minimizes to clickable icon on screens 768px
- Constrain widget size to 90vw x 70vh on mobile
- Widget visible by default on desktop, hidden on mobile
- Fix CORS to allow file:// protocol for local testing
- Add toggle functionality with open/close states

Fixes mobile UX where chatbot covered entire screen
- Add test-mobile-widget.html for testing mobile UI
- Test floating action button (FAB) functionality
- Test mobile breakpoint at 768px
- Test open/close toggle behavior
- Test widget size constraints (90vw x 70vh)

Test page includes instructions for desktop and mobile testing.
* test(widget): add mobile responsive chatbot widget test page

- Add test-mobile-widget.html for testing mobile UI
- Test floating action button (FAB) functionality
- Test mobile breakpoint at 768px
- Test open/close toggle behavior
- Test widget size constraints (90vw x 70vh)

Test page includes instructions for desktop and mobile testing.

* fix: improve color contrast for WCAG AAA compliance

Accessibility Fix
- Change chatbot header background: #007bff  #0056b3
- Change user message bubbles: #007bff  #0056b3
- Change submit button: #007bff  #0056b3
- Change button hover: #0056b3  #003d82
- Update focus border to match new color scheme

Contrast Improvements:
- Old: #007bff with white (3.14:1)  FAIL WCAG AA
- New: #0056b3 with white (5.89:1)  PASS WCAG AAA

Expected Impact:
- Portfolio Desktop Accessibility: 96  100/100
- Better readability for visually impaired users
- Full WCAG AAA compliance

Refs #accessibility #wcag

---------

Co-authored-by: odanree <your-email@example.com>
The previous fix (#39) only updated chat-widget.css, but the JavaScript
file (chat-widget.js) was using inline styles that override the CSS.
This fix updates all inline style declarations to use #0056b3 instead
of #007bff for WCAG AAA compliance.

Changes:
- Header background: #007bff -> #0056b3
- Send button background: #007bff -> #0056b3
- User message bubbles: #007bff -> #0056b3

Contrast ratio: 3.14:1 -> 5.89:1 (WCAG AAA pass)

Related: #39
@odanree odanree merged commit 032cdb9 into main Nov 7, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants