Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUX API #2810

Merged
merged 11 commits into from
Sep 11, 2024
Merged

NUX API #2810

merged 11 commits into from
Sep 11, 2024

Conversation

estrattonbailey
Copy link
Member

@estrattonbailey estrattonbailey commented Sep 11, 2024

Adds a generic storage interface for "new user experiences". In the app, these will behave like:

  • user loads app and encounters a new experience
  • we check this storage interface to see if the user has completed this NUX
    • if completed === true we do nothing
  • we show the user the NUX
    • we can optionally store data on this NUX also using its data attribute
  • when NUX is dismissed, we set completed === true and data is stored in prefs

The interface of a NUX is as follows:

  • id a string with a max length of 64 characters, meant to be unique but human readable, this will be defined by the app
  • completed a boolean, you get the idea
  • expiresAt optional datetime, if expired, app will treat NUX as completed
  • data string, max length of 300 chars (matches posts), optional stash of data, app will handle serde

Validation

NUXs are validated before insertion, and before we even hit the prefs API. No additional properties beyond what is defined are allowed.

Cleanup

Over time, these will accrue. In the app, we'll need to be judicious about how many NUXs are present for a given user. On a rolling basis, we will need to remove old NUXs as we add new ones. Some time after a NUX is removed from the app, we can remove old ids either on app load or on next write. This PR does not specify solutions to this.

Naming

"New user experiences" as an acronym is NUXs. Not NUXes. nuxs does look a little weird, but for consistency I left it like that. NUX is how we've been referring to these internally, but if anyone has a better idea for a name lmk.

packages/api/src/agent.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@dholms dholms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup yup look good 👌

@estrattonbailey estrattonbailey merged commit 33aa0c7 into main Sep 11, 2024
10 checks passed
@github-actions github-actions bot mentioned this pull request Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants