Marketplace Module Migration Guide
This guide explains how to update code that uses the older marketplace module patterns to use the new consolidated structure.Overview of Changes
We’ve made the following major changes to the marketplace module:- Consolidated Types: All marketplace types are now in
types.ts(domain types) andcomponents/types.ts(UI types) - Deprecated data-service.ts: The duplicate functionality has been deprecated in favor of marketplace-service.ts
- Consolidated Builder Image Components: Multiple implementations merged into a single component
- Aligned with Domain Architecture: Followed the standard pattern of actions.ts, api.ts, schemas.ts, types.ts, and utils.ts
- Standardized Component Structure: Every component in its own directory with consistent file naming
- Documented API and Architecture: Created comprehensive documentation in Mintlify
Migration Steps
Step 1: Update Type Imports
Before:Step 2: Update API Function Imports
Before:Step 3: Use Barrel Exports
Before:Step 4: Migrate from Deprecated Builder Image Components
Before:src: The image URL (equivalent to src, url, imageUrl in legacy components)alt: Alt text, usually the builder’s namesize: One of ‘sm’ | ‘md’ | ‘lg’ (small, medium, large)className: Optional custom CSS classes
Code Patterns
Client-Side API Functions
Use the functions inapi.ts for all client-side API calls:
Server-Side Functions
Use the functions inmarketplace-service.ts for server-side operations:
Migration Timeline
- Immediate: Begin migration to new structure for all new code
- Within 2 Weeks: Update existing imports to use consolidated types and barrel exports
- Within 4 Weeks: Replace all uses of deprecated components with consolidated implementations
- Next Sprint: The
data-service.tsfile will display console warnings when used - Next Major Release (v2.5): All deprecated components and services will be removed
Testing Your Migration
After migrating, verify your changes by:- Checking that all imports resolve correctly with
npm run typecheck - Running unit tests with
npm test - Visually confirming components render correctly in development environment
- Testing performance improvements from consolidated implementation
Testing Error Handling
The consolidated components include robust error handling that should be thoroughly tested:1. Test BuilderImage Error Scenarios
2. Component Validators
Use these validation functions to test components before and after migration:3. Visual Testing
Verify that the BuilderImage component correctly handles errors by checking:- Fallback displays initials when no image is available
- No error messages or broken image icons appear
- Different size variants maintain proportions
- Custom classes are correctly applied
- Component transitions smoothly when images fail to load
Benefits of Migration
Migrating to the consolidated marketplace architecture provides several benefits:- Reduced Bundle Size: Elimination of duplicate code reduces overall bundle size
- Type Safety: Consolidated type system prevents type-related errors
- Consistent APIs: Standardized component APIs improve developer experience
- Better Maintainability: Simpler codebase structure makes future changes easier
- Performance: Optimized components with proper error handling and fallbacks