immersive2/public/api/user
Michael Mainguy 970f6fc78a Fix label positioning, add billboard mode, fix XR entry shift, and fix config system
Label Positioning Fixes:
- Fix labels accounting for mesh scaling using maximumWorld coordinates
- Labels now properly positioned on scaled objects (spheres, boxes, etc.)
- Restore world→local coordinate transformation in updateLabelPosition

Billboard Mode Implementation:
- Add configurable label rendering modes: fixed, billboard, dynamic, distance-based
- Implement billboard mode (labels always face camera using BILLBOARDMODE_Y)
- Add label rendering mode to AppConfig with default 'billboard'
- Add UI selector in ConfigModal for label rendering mode
- Observable pattern updates all existing labels when mode changes

XR Entry Positioning Fix:
- Synchronize desktop camera position to platform before entering XR
- Transfer camera world position and rotation to prevent scene shift
- Reset physics velocity on XR entry to prevent drift
- Add debug logging for position synchronization

Config System Architecture Fix:
- Create singleton appConfigInstance to ensure single source of truth
- Update DiagramObject to use singleton instead of creating instances
- Update DiagramManager to use singleton
- Fix ConfigModal to update AppConfig directly (was only updating legacy config)
- ConfigModal now triggers Observable notifications via appConfigInstance setters
- Maintain legacy config for backward compatibility
- Fixes issue where label rendering mode changes didn't take effect

Files Modified:
- src/diagram/diagramObject.ts - Label positioning, billboard mode, singleton config
- src/diagram/diagramManager.ts - Use singleton config
- src/util/appConfig.ts - Add labelRenderingMode, export singleton
- src/util/appConfigType.ts - Add LabelRenderingMode type
- src/react/pages/configModal.tsx - Update AppConfig directly, add label mode UI
- src/util/functions/groundMeshObserver.ts - Add camera position sync on XR entry
- public/api/user/features - Update test config
- package.json - Version bump

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 08:52:04 -06:00
..
features Fix label positioning, add billboard mode, fix XR entry shift, and fix config system 2025-11-18 08:52:04 -06:00
features-basic.json Add configurable feature management system with JSON-based feature flags 2025-11-18 06:52:39 -06:00
features-free.json Add configurable feature management system with JSON-based feature flags 2025-11-18 06:52:39 -06:00
features-none.json Add configurable feature management system with JSON-based feature flags 2025-11-18 06:52:39 -06:00
features-pro.json Add configurable feature management system with JSON-based feature flags 2025-11-18 06:52:39 -06:00
README.md Add configurable feature management system with JSON-based feature flags 2025-11-18 06:52:39 -06:00

Feature Configuration Testing

This directory contains static JSON files for testing different user tiers locally.

Available Configurations

Default: features (none tier)

  • What you see: Only the home page
  • All pages and features: Disabled
  • Use case: Unauthenticated users or when API is unavailable

Free Tier: features-free.json

  • Pages: All marketing pages + VR Experience
  • Features: Basic diagram creation, management, immersive mode
  • Limits: 6 diagrams max, 100MB storage
  • No access to: Templates, private/encrypted designs, collaboration

Basic Tier: features-basic.json

  • Pages: All pages available
  • Features: Free features + templates + private designs
  • Limits: 25 diagrams max, 500MB storage
  • No access to: Encrypted designs, collaboration

Pro Tier: features-pro.json

  • Pages: All pages available
  • Features: Everything unlocked
  • Limits: Unlimited (indicated by -1)

How to Test Locally

Method 1: Copy the file you want to test

# Test free tier
cp public/api/user/features-free.json public/api/user/features

# Test basic tier
cp public/api/user/features-basic.json public/api/user/features

# Test pro tier
cp public/api/user/features-pro.json public/api/user/features

# Test none/default (locked down)
cp public/api/user/features-none.json public/api/user/features
# Remove the default file
rm public/api/user/features

# Create a symlink to the tier you want to test
ln -s features-free.json public/api/user/features
# or
ln -s features-basic.json public/api/user/features
# or
ln -s features-pro.json public/api/user/features

What Changes Between Tiers

Feature None Free Basic Pro
Pages (Examples, Docs, Pricing)
VR Experience
Create Diagram
Create From Template
Private Designs
Encrypted Designs
Share/Collaborate
Max Diagrams 0 6 25
Storage 0 100MB 500MB

Backend Implementation (Future)

When you're ready to implement the backend, create an endpoint at:

GET https://www.deepdiagram.com/api/user/features

The endpoint should:

  1. Validate the Auth0 JWT token from Authorization: Bearer <token> header
  2. Query the user's subscription tier from your database
  3. Return JSON matching one of these structures based on their tier
  4. Handle errors gracefully (401 for invalid token, 403 for unauthorized)

The frontend will automatically fall back to the static features file if:

  • User is not authenticated
  • API returns an error
  • Network request fails