Yes, I mostly agree with Martin. I've been in early design meetings where we wanted to provide a direct line cord, but that eventually got shot down due to the hassle and expense of getting regulatory approval. We know that consumers don't like wall warts, but unfortunately the compliance issues in getting a product to market force this tradeoff.
It's actually not a legal requirement. There are surprisingly few of those, at least here in the US. However, in reality you can't have a consumer product that uses wall power in some form without UL or equivalent certification. You can follow all the best design rules and know your product is at least as safe as others with approval, but nobody wants to gamble on the liability of not having their butt covered by UL. Major retailers, for example, wouldn't touch it without formal approval.
If your product sells in the millions, sooner or later someone is going to do something stupid and get zapped. It may even be deliberate fraud just to try to extract a settlement, but that matters little. It helps tremendously in the legal process to say that your product followed "accepted safety practises" and was certified to that effect by UL or equivalent.
If you use a external approved power supply so that low voltage only goes to your unit, you are pretty much off the hook safety-wise. The external power supply provides the isolation, and as long as voltages in your unit are 48V or less and limited to a particular current (I forget the limit), you're basically fine.
For moderate product drawing 10s of Watts or more, it's usually worth it to put the line cord on it directly. Plenty of manufacturers make pre-certified power bricks you can embed into the product. You still will want certification for the whole product, but that's a lot easier and cheaper if you are using a power brick that has already been certified. In that case they usually just look for overall insulation and spacing, that the proper fuse is before the power brick, the mechanics of how the power enters the unit, etc.
If the product is intended for international distribution (and more are these days), you put a standard line cord socket on the product, then provide localized line cords. Power bricks that work over the worldwide range of roughly 90-240 VAC 50/60 Hz are pretty common these days. After a few 10s of Watts, most will have power factor control too.