Use wiki page when editing wishes, add centralized config and Util class
[[Wikimedia Foundation wish submission]] is the new entrypoint. Run npm run setup
to install the page.
We no longer load on action=wishlistedit
or Special:CreateProposal because these show MW-supplied error pages and/or respond with a 404. It is important to have fallback content instructing the user to enable the gadget if they have (somehow) disbaled it. Loading the form on an actual wiki page makes this possible, while also allowing the instructions to be translated. Additionally, we don't have as disruptive of a "flash of content" when the gadget loads, since the page title is the same.
Centralize all names of things into config.json. Things will likely be changed soon, and having everything go off the config will make this easier.
Add Util class and add tests. This class will also be used by the bot.
Unit test changes:
- Add jest config and instruct to include coverage report
- Use jsdom environment to simulate a real browser
- Add setup.js and import mockMediaWiki.js for easier testing (the package is called mw-node-qunit but we're not using QUnit)
- Add @jest/globals to package.json for better IDE support
Finally, wrap both dev and prod builds with mw.loader.using so that loading as a user script works even for prod builds.
Bug: T362809
Bug: T362913
Bug: T361067