11 Commits

Author SHA1 Message Date
c2b5168a04 fix: resolve inventory sync crash loop and parallel execution issues
- Remove process.exit(1) that caused PM2 to restart in an infinite loop
- Fix && false bug that forced Turn14 token refresh on every run
- Remove global SHOP/ACCESS_TOKEN to eliminate race conditions
- Make shop loop sequential (for...of + await) to prevent Turn14 429s
- Add early return when Turn14 credentials are missing for a shop
- Guard non-JSON Turn14 responses (429 plain text) before calling .json()
- Ensure logs/ and exports/ dirs exist before writing
- Pass shop/accessToken as params to all helper functions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 00:53:55 +05:30
9b5e16b1c1 feat: auto-inject chat widget on all storefronts via Shopify ScriptTag API
- auth.js: register chat widget ScriptTag during OAuth callback so every
  new install automatically gets the floating chat button — no manual
  theme editing required
- server.js: GET /chat/backfill-scripttags endpoint to register the widget
  on all already-installed shops in one hit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 20:52:18 +05:30
a27d586c82 fix: chat widget route ordering and missing body parser
- Move GET /chat/widget.js before GET /chat/:shop to prevent Express
  matching 'widget.js' as the :shop param and returning JSON
- Move POST/GET /chat/:shop after body parser registration so req.body
  is populated when customers send messages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 20:50:42 +05:30
aef977eb99 feat: customer chat system with admin panel inbox and embeddable widget
- chatStore.js: per-shop JSON storage in data/chats/, message history,
  unread tracking, markRead on admin open
- adminPanel.js: new Chat tab (WhatsApp-style left sidebar + right panel),
  3s polling, admin reply, unread badge on tab
- server.js: public POST /chat/:shop and GET /chat/:shop for widget,
  GET /chat/widget.js serves embeddable script
- Widget: floating chat button, popup window, customer sends messages,
  polls for admin replies, visitor ID persisted in localStorage
  Usage: <script src="https://backend.data4autos.com/chat/widget.js?shop=SHOP"></script>

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 20:45:18 +05:30
0cb6e260f7 feat: admin panel shows all app users with inline grant/revoke free access
- New GET /d4a-admin/api/users endpoint merges tokens.json (all installed
  shops) with freeAccessStore to show every user and their access status
- Dashboard replaced with a full user list: shop domain, last auth date,
  free-access status badge, and Grant Free / Revoke buttons per row
- Grant opens a modal to set optional expiry date and note (no manual typing)
- Search filter to find shops quickly across large user lists
- Removed the manual text-input add form

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 14:52:46 +05:30
4be12dc9d4 redesign admin panel with full light theme (Stripe/Linear aesthetic)
- Login: vibrant blue gradient left panel + pure white right form panel
- Dashboard: white topbar with blue accent, white cards, light gray page bg
- Status tags: light-coloured pill badges (green/red/blue) with dot indicators
- Remove all dark glassmorphism and near-black surfaces
- Sync count badge across topbar and table header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 13:34:55 +05:30
0c52aeb1aa style: redesign admin login page — split layout, glassmorphism, animated blobs
- Full-screen split layout: left branding panel + right login card
- Animated background gradient blobs with CSS keyframes
- Dot-grid overlay for depth
- Glassmorphism login card (backdrop-filter blur, subtle borders)
- Brand icon with pulsing glow animation
- Feature list on left panel
- Input fields with icon prefix (user/key) and password show/hide toggle
- Shimmer effect on sign-in button on hover
- Error shake animation
- Secure badge with green dot indicator
- Blobs hidden after login so dashboard background is clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 13:23:29 +05:30
35b3f98d5f feat: free-access whitelist + admin panel
- freeAccessStore.js: JSON-persisted whitelist of shops with optional
  expiry dates; isShopAllowed(), addShop(), removeShop(), listShops()
- routes/adminPanel.js: password-protected single-page admin dashboard
  served at /d4a-admin; cookie-based session auth (no extra deps);
  add / remove / list shops with expiry dates and notes
- server.js: mount /d4a-admin panel; expose GET /free-access/:shop
  public API for frontend loaders; import freeAccessStore

Credentials: d4a-admin / Data4autos@2026.
Migrates racewerksengg.myshopify.com from hardcode into the JSON store.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 13:19:06 +05:30
6582ec5641 feat: add live import progress tracking with job store
- Add jobStore.js: in-memory job store with rich job objects (liveStats,
  logs, errors, cancellation, timing, success rate)
- Rewrite manageProducts.js: structured logging ([STATS], [PRODUCT-OK],
  [PRODUCT-FAIL], [SKIP], [FETCH], [CANCEL], etc.), per-product cancel
  checks, jobStore integration
- server.js: expose GET /health, GET /jobs, GET /jobs/:id,
  POST /jobs/:id/cancel, GET /shops endpoints
- tokenStore.js: add listTokens() export

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 02:22:58 +05:30
Manesh
abd0d8b7a5 Servre 2026-04-17 21:16:29 +00:00
Manesh
624c2f2d32 first commit 2026-04-13 05:23:25 +00:00