Subtask of EPIC #38702
We need to agree on how we're going to create a temporary user account and site.
The path of least resistance might be to chain two HTTP calls to users/new and sites/new. Changes to these endpoints will probably be necessary, e.g., to suppress marketing emails, add meta/flags to temporary accounts and sites.
Request for advice post: pMz3w-aWr-p2
wpcom.undocumented() methods usersNew and sitesNew (for built-in authentication)?Temporary account and site generation: initial musings: pbxlJb-4a-p2
oops 😊
- How should we bake the HTTP calls into the Gutenboarding code (POST to users/new sites/new)? Let's ask @Automattic/luna
Should this be part of a @wordpress/data data store? We have some patterns that could be followed there, although we don't have any update-type (POST) usage yet. The gist would be to dispatch an action from a store.
Have a look at the new @automattic/data-stores package. Happy to chat more about this or other options.
should we use the existing
wpcom.undocumented()methodsusersNewandsitesNew(for built-in authentication)?
What do you mean by "built-in authentication"? We have a precedent in Gutenboarding to avoid pulling in dependencies directly from Calypso source code, as this tends to lead to a dependency graph that we don't understand and can't control the bounds of, affectionately referred to as "Calypso soup." That precedent and the goal of avoiding bloated bundles —I believe the wpcom lib is not tree-shaking friendly— likely precludes its usage.
Mentioned functions for reference:
https://github.com/Automattic/wp-calypso/blob/e3654a578c59a835459f7a7fe10ce0aada50def4/client/lib/wpcom-undocumented/lib/undocumented.js#L1344-L1357
https://github.com/Automattic/wp-calypso/blob/e3654a578c59a835459f7a7fe10ce0aada50def4/client/lib/wpcom-undocumented/lib/undocumented.js#L1462-L1481
Thanks for the info @sirreal !!
Should this be part of a @wordpress/data data store? We have some patterns that could be followed there, although we don't have any update-type (POST) usage yet.
At first sight, yes. I did hack around with creating a POST variant in the @automattic/data-stores package, and got it and the associated state modules firing off fine based on the existing architectural examples.
I only moved my experiment to landing/gutenboarding so I could more easily import wpcom relatively. 😇
We'll look at implementing our stuff there. 👍
What do you mean by "built-in authentication"?
This was a bit of a covfefe on my part.
It's the _path-of-least-resistance_ approach of _"since it's already written and set up to send REST API tokens"_ and so on, why don't we use it?
I'm also assuming a lot based on some very shallow tracing, and the observation thatwpcom.js ships requests through a proxy iframe
I don't yet know how much we'd need to pull over to make it all play nice. Maybe nothing. I'll need to school myself a bit harder on that.
We have a precedent in Gutenboarding to avoid pulling in dependencies directly from Calypso source code
Good to have confirmed, cheers.
On hold until we come up with a solution that works for everyone.
See discussion at pMz3w-aWr-p2
Closing for now while we work on https://github.com/Automattic/wp-calypso/issues/38701
Most helpful comment
oops 😊