INNER CODE UNIT · JavaScript
resolveAtomLimit
adeekshith/watomatic · functions/index.js:61
function resolveAtomLimit(productId, planType) {
const id = (productId || '').toLowerCase();
const pt = (planType || '').toLowerCase();
// Check productId first (most specific)
if (id.includes('pro')) return { planKey: 'pro', totalAtoms: PLAN_ATOM_LIMITS.pro };
if (id.includes('standard')) return { planKey: 'standard', totalAtoms: PLAN_ATOM_LIMITS.standard };
if (id.includes('mini')) return { planKey: 'mini', totalAtoms: PLAN_ATOM_LIMITS.mini };
if (id.includes('free')) return { planKey: 'free', totalAtoms: PLAN_ATOM_LIMITS.free };
// Fall back to planType
if (pt.includes('pro')) return { planKey: 'pro', totalAtoms: PLAN_ATOM_LIMITS.pro };
if (pt.includes('standard')) return { planKey: 'standard', totalAtoms: PLAN_ATOM_LIMITS.standard };
if (pt.includes('mini')) return { planKey: 'mini', totalAtoms: PLAN_ATOM_LIMITS.mini };
// Default to free
return { planKey: 'free', totalAtoms: PLAN_ATOM_LIMITS.free };
}