121 lines
3.0 KiB
JavaScript
121 lines
3.0 KiB
JavaScript
// Planes de suscripción con sus límites y precios
|
|
export const SUBSCRIPTION_PLANS = {
|
|
free: {
|
|
id: 'free',
|
|
name: 'Gratis',
|
|
description: 'Perfecto para empezar',
|
|
price: {
|
|
monthly: 0,
|
|
yearly: 0,
|
|
},
|
|
limits: {
|
|
maxWorkers: 2, // Número máximo de búsquedas/workers
|
|
maxNotificationsPerDay: 50,
|
|
platforms: ['wallapop'], // Solo Wallapop
|
|
},
|
|
features: [
|
|
'Hasta 2 búsquedas simultáneas',
|
|
'Solo Wallapop',
|
|
'50 notificaciones por día',
|
|
'Soporte por email',
|
|
],
|
|
},
|
|
basic: {
|
|
id: 'basic',
|
|
name: 'Básico',
|
|
description: 'Para usuarios ocasionales',
|
|
price: {
|
|
monthly: 9.99,
|
|
yearly: 99.99, // ~17% descuento
|
|
},
|
|
limits: {
|
|
maxWorkers: 5,
|
|
maxNotificationsPerDay: 200,
|
|
platforms: ['wallapop', 'vinted'],
|
|
},
|
|
features: [
|
|
'Hasta 5 búsquedas simultáneas',
|
|
'Wallapop y Vinted',
|
|
'200 notificaciones por día',
|
|
'Soporte prioritario',
|
|
'Sin límite de favoritos',
|
|
],
|
|
},
|
|
pro: {
|
|
id: 'pro',
|
|
name: 'Pro',
|
|
description: 'Para usuarios avanzados',
|
|
price: {
|
|
monthly: 19.99,
|
|
yearly: 199.99, // ~17% descuento
|
|
},
|
|
limits: {
|
|
maxWorkers: 15,
|
|
maxNotificationsPerDay: 1000,
|
|
platforms: ['wallapop', 'vinted', 'buyee'],
|
|
},
|
|
features: [
|
|
'Hasta 15 búsquedas simultáneas',
|
|
'Todas las plataformas',
|
|
'1000 notificaciones por día',
|
|
'Soporte prioritario 24/7',
|
|
'API access',
|
|
'Webhooks personalizados',
|
|
],
|
|
},
|
|
enterprise: {
|
|
id: 'enterprise',
|
|
name: 'Enterprise',
|
|
description: 'Para equipos y uso intensivo',
|
|
price: {
|
|
monthly: 49.99,
|
|
yearly: 499.99, // ~17% descuento
|
|
},
|
|
limits: {
|
|
maxWorkers: -1, // Ilimitado
|
|
maxNotificationsPerDay: -1, // Ilimitado
|
|
platforms: ['wallapop', 'vinted', 'buyee'], // Todas
|
|
},
|
|
features: [
|
|
'Búsquedas ilimitadas',
|
|
'Notificaciones ilimitadas',
|
|
'Todas las plataformas',
|
|
'Soporte dedicado',
|
|
'API completa',
|
|
'Webhooks personalizados',
|
|
'Gestión de múltiples usuarios',
|
|
'Estadísticas avanzadas',
|
|
],
|
|
},
|
|
};
|
|
|
|
// Obtener plan por ID
|
|
export function getPlan(planId) {
|
|
return SUBSCRIPTION_PLANS[planId] || SUBSCRIPTION_PLANS.free;
|
|
}
|
|
|
|
// Verificar si un plan tiene una característica
|
|
export function hasFeature(planId, feature) {
|
|
const plan = getPlan(planId);
|
|
return plan.features.includes(feature);
|
|
}
|
|
|
|
// Verificar si un plan tiene acceso a una plataforma
|
|
export function hasPlatformAccess(planId, platform) {
|
|
const plan = getPlan(planId);
|
|
return plan.limits.platforms.includes(platform) || plan.limits.platforms.length === 0;
|
|
}
|
|
|
|
// Obtener límite de workers para un plan
|
|
export function getMaxWorkers(planId) {
|
|
const plan = getPlan(planId);
|
|
return plan.limits.maxWorkers;
|
|
}
|
|
|
|
// Obtener límite de notificaciones diarias
|
|
export function getMaxNotificationsPerDay(planId) {
|
|
const plan = getPlan(planId);
|
|
return plan.limits.maxNotificationsPerDay;
|
|
}
|
|
|