Cannot call activateWindow on workspacewrapper JS object, despite being documented here: https://develop.kde.org/docs/plasma/kwin/api/#read-only-properties-4 raiseWindow does not focus the supplied window so this is not the same as activating and is not enough. Sample code at https://rudd-o.com/linux-and-free-software/how-to-raise-a-window-under-wayland-or-x11-when-using-kde-kwin-plasma/ see commented try/catch block.
I think the comment is wrong and you need to use the active window property https://develop.kde.org/docs/plasma/kwin/api/#read-write-properties
Yep it appears the comment is wrong and it should be fixed, but activeWindow property works.