SA5 - Force user info refresh?

Hello! I’m very happily using SA5 on my WebFlow site (read-only link here), specifically to load current user info on the user-access page. It uses WebFlow e-commerce with webhooks to generate API keys and load them into custom user fields dynamically. So far, it works a treat! However, I’m not quite sure how to handle these situations:

  1. When the user creates a new suscription/membership while logged in, the user’s new API is generated and assigned to user data, but how can I reload user data?
  2. When the user cancels an existing subscription/membership while logged in, how can I get refreshed user data in this case?

I get a webhook notification for the first case, but unfortunately, the WebFlow webhooks do not seem to fire in the second case, even user_account_updated (when the membership is tied to an access group) and ecomm_order_changed (because the order is fundamentally canceled), which is disappointing. If both supported webhooks, then I could at least do some websocket shenanigans, but they’re not.

In any case, I’m (reasonably) confident that I can capture most of those events in the UI with a bit of clever scripting. However, even if I can observe when the user data is likely to change, it’s not obvious to me how to force SA5 to reload the user data. I have poked around the code on GitHub and found webflow-membership.ts specifically, but I would strongly prefer an official, documented (or at least recommended and blessed) solution as opposed to whatever tomfoolery I might come up with.

Thanks so much for this lovely library, and thank you also in advance for your attention and any help you may be able to provide!

There are a few possible directions to go here, so… to video.

EDIT: To force a refresh of the user object without logging the user out, you can delete the wfuUser key from Session storage. SA5 will still have the wfuUserKey so it will be able to rebuild the user object on the next page load- so I’d have the script delete the key and then reload the page immediately.