docs: add consolidated dev URL reference and migrate /shop to /storefront
Some checks failed
Some checks failed
- Add Development URL Quick Reference section to url-routing overview with all login URLs, entry points, and full examples - Replace /shop/ path segments with /storefront/ across 50 docs files - Update file references: shop_pages.py → storefront_pages.py, templates/shop/ → templates/storefront/, api/v1/shop/ → api/v1/storefront/ - Preserve domain references (orion.shop) and /store/ staff dashboard paths - Archive docs left unchanged (historical) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
**Version:** 1.0.0
|
||||
**Last Updated:** 2025
|
||||
**Status:** Phase 1 Complete (Admin), Phase 2-3 Pending (Store, Shop)
|
||||
**Status:** Phase 1 Complete (Admin), Phase 2-3 Pending (Store, Storefront)
|
||||
|
||||
---
|
||||
|
||||
@@ -27,16 +27,16 @@
|
||||
|
||||
### Purpose
|
||||
|
||||
The error handling system provides context-aware error responses throughout the application. It automatically determines whether to return JSON (for API calls) or HTML error pages (for browser requests), and renders appropriate error pages based on the request context (Admin, Store Dashboard, or Shop).
|
||||
The error handling system provides context-aware error responses throughout the application. It automatically determines whether to return JSON (for API calls) or HTML error pages (for browser requests), and renders appropriate error pages based on the request context (Admin, Store Dashboard, or Storefront).
|
||||
|
||||
### Key Features
|
||||
|
||||
- **Context-Aware**: Different error pages for Admin, Store, and Shop areas
|
||||
- **Context-Aware**: Different error pages for Admin, Store, and Storefront areas
|
||||
- **Automatic Detection**: Distinguishes between API and HTML page requests
|
||||
- **Consistent JSON API**: API endpoints always return standardized JSON errors
|
||||
- **Fallback Mechanism**: Gracefully handles missing templates
|
||||
- **Debug Mode**: Shows technical details to admin users only
|
||||
- **Theme Integration**: Shop error pages support store theming (Phase 3)
|
||||
- **Theme Integration**: Storefront error pages support store theming (Phase 3)
|
||||
- **Security**: 401 errors automatically redirect to appropriate login pages
|
||||
|
||||
### Design Principles
|
||||
@@ -58,7 +58,7 @@ HTTP Request
|
||||
↓
|
||||
Store Context Middleware (detects store from domain/subdomain/path)
|
||||
↓
|
||||
Context Detection Middleware (detects API/Admin/Store/Shop)
|
||||
Context Detection Middleware (detects API/Admin/Store/Storefront)
|
||||
↓
|
||||
Route Handler (processes request, may throw exception)
|
||||
↓
|
||||
@@ -84,7 +84,7 @@ app/exceptions/
|
||||
app/templates/
|
||||
├── admin/errors/ # Admin error pages (Phase 1 - COMPLETE)
|
||||
├── store/errors/ # Store error pages (Phase 2 - PENDING)
|
||||
├── shop/errors/ # Shop error pages (Phase 3 - PENDING)
|
||||
├── storefront/errors/ # Storefront error pages (Phase 3 - PENDING)
|
||||
└── shared/ # Shared fallback error pages (COMPLETE)
|
||||
```
|
||||
|
||||
@@ -169,8 +169,8 @@ ErrorPageRenderer.render_error_page(
|
||||
"show_debug": bool, # Whether to show debug info
|
||||
"context_type": str, # Request context type
|
||||
"path": str, # Request path
|
||||
"store": dict, # Store info (shop context only)
|
||||
"theme": dict, # Theme data (shop context only)
|
||||
"store": dict, # Store info (storefront context only)
|
||||
"theme": dict, # Theme data (storefront context only)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -223,7 +223,7 @@ if path.startswith("/admin") or host.startswith("admin."):
|
||||
if path.startswith("/store/"):
|
||||
return RequestContext.STORE_DASHBOARD
|
||||
|
||||
# Priority 4: Shop Context
|
||||
# Priority 4: Storefront Context
|
||||
if hasattr(request.state, 'store') and request.state.store:
|
||||
return RequestContext.SHOP
|
||||
|
||||
@@ -255,7 +255,7 @@ admin.platform.com/dashboard → ADMIN context
|
||||
store1.platform.com/store/dashboard → STORE_DASHBOARD context
|
||||
```
|
||||
|
||||
**Shop Access:**
|
||||
**Storefront Access:**
|
||||
```
|
||||
store1.platform.com/ → SHOP context
|
||||
customdomain.com/ → SHOP context (if store verified)
|
||||
@@ -320,7 +320,7 @@ API endpoints MUST always return JSON, even if the client sends `Accept: text/ht
|
||||
|---------|-------------|
|
||||
| ADMIN | `/admin/login` |
|
||||
| STORE_DASHBOARD | `/store/login` |
|
||||
| SHOP | `/shop/login` |
|
||||
| SHOP | `/storefront/login` |
|
||||
| FALLBACK | `/admin/login` |
|
||||
|
||||
---
|
||||
@@ -350,7 +350,7 @@ app/templates/
|
||||
│ └── errors/
|
||||
│ └── (same structure as admin)
|
||||
│
|
||||
├── shop/
|
||||
├── storefront/
|
||||
│ └── errors/
|
||||
│ └── (same structure as admin)
|
||||
│
|
||||
@@ -446,7 +446,7 @@ Each context has its own `base.html` template:
|
||||
- Primary: "Go to Dashboard" → `/store/dashboard`
|
||||
- Secondary: "Go Back" → `javascript:history.back()`
|
||||
|
||||
#### Shop Error Pages
|
||||
#### Storefront Error Pages
|
||||
|
||||
**Purpose:** Error pages for customers on store storefronts
|
||||
|
||||
@@ -454,16 +454,16 @@ Each context has its own `base.html` template:
|
||||
- **Uses store theme** (colors, logo, fonts)
|
||||
- Customer-friendly language
|
||||
- No technical jargon
|
||||
- Links to shop homepage
|
||||
- Links to storefront homepage
|
||||
- Customer support contact
|
||||
|
||||
**Action Buttons:**
|
||||
- Primary: "Continue Shopping" → Shop homepage
|
||||
- Primary: "Continue Shopping" → Storefront homepage
|
||||
- Secondary: "Contact Support" → Store support page
|
||||
|
||||
**Theme Integration:**
|
||||
```html
|
||||
<!-- Shop error pages use store theme variables -->
|
||||
<!-- Storefront error pages use store theme variables -->
|
||||
<style>
|
||||
:root {
|
||||
--color-primary: {{ theme.colors.primary }};
|
||||
@@ -517,12 +517,12 @@ Each context has its own `base.html` template:
|
||||
|
||||
**Priority:** Medium (stores currently see fallback pages)
|
||||
|
||||
### Phase 3: Shop Error Handling ⏳ PENDING
|
||||
### Phase 3: Storefront Error Handling ⏳ PENDING
|
||||
|
||||
**Status:** Not yet implemented
|
||||
|
||||
**Required Tasks:**
|
||||
1. Create `/app/templates/shop/errors/` directory
|
||||
1. Create `/app/templates/storefront/errors/` directory
|
||||
2. Create customer-facing error templates:
|
||||
- Use customer-friendly language
|
||||
- Integrate store theme variables
|
||||
@@ -675,7 +675,7 @@ raise ValidationException(
|
||||
Determine which context needs the new error page:
|
||||
- Admin Portal → `admin/errors/`
|
||||
- Store Dashboard → `store/errors/`
|
||||
- Customer Shop → `shop/errors/`
|
||||
- Customer Storefront → `storefront/errors/`
|
||||
|
||||
### Step 2: Choose Template Type
|
||||
|
||||
@@ -734,7 +734,7 @@ Determine which context needs the new error page:
|
||||
**Option B: Standalone Template** (For custom designs)
|
||||
|
||||
```html
|
||||
<!-- app/templates/shop/errors/custom.html -->
|
||||
<!-- app/templates/storefront/errors/custom.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -930,16 +930,16 @@ curl -H "Accept: text/html" http://localhost:8000/store/dashboard
|
||||
# Expected: 302 redirect to /store/login
|
||||
```
|
||||
|
||||
**Shop Context (Phase 3):**
|
||||
**Storefront Context (Phase 3):**
|
||||
|
||||
```bash
|
||||
# Test 404 on store subdomain
|
||||
curl -H "Accept: text/html" http://store1.localhost:8000/nonexistent
|
||||
# Expected: Shop 404 page with store theme
|
||||
# Expected: Storefront 404 page with store theme
|
||||
|
||||
# Test 500 error
|
||||
# Trigger server error on shop
|
||||
# Expected: Shop 500 page with store branding
|
||||
# Trigger server error on storefront
|
||||
# Expected: Storefront 500 page with store branding
|
||||
```
|
||||
|
||||
### Performance Testing
|
||||
@@ -1089,7 +1089,7 @@ templates = Jinja2Templates(directory=str(TEMPLATES_DIR))
|
||||
### Issue: Wrong Context Detected
|
||||
|
||||
**Symptoms:**
|
||||
Admin page shows shop error page, or vice versa
|
||||
Admin page shows storefront error page, or vice versa
|
||||
|
||||
**Diagnosis:**
|
||||
Add context logging:
|
||||
@@ -1154,10 +1154,10 @@ Ensure all conditions for HTML page request are met:
|
||||
- Accept header includes `text/html`
|
||||
- NOT already on login page
|
||||
|
||||
### Issue: Store Theme Not Applied to Shop Errors
|
||||
### Issue: Store Theme Not Applied to Storefront Errors
|
||||
|
||||
**Symptoms:**
|
||||
Shop error pages don't use store colors/branding (Phase 3 issue)
|
||||
Storefront error pages don't use store colors/branding (Phase 3 issue)
|
||||
|
||||
**Diagnosis:**
|
||||
1. Check if theme is in request state:
|
||||
|
||||
Reference in New Issue
Block a user