Selling to consumers with endogenous types