The quota and remaining parameters received from /studio-app/ai-assistant/quota endpoint are integers. When the prompt limit is reached, the remaining value will be 0 which produces a false value in the parsing code. This has been updated to only fallback to an empty string when the value is not defined.
Add unit tests to cover the functionality of the usePromptUsage hook.
Fix a React error coming from rendering the extra example prompts.
Testing Instructions
Update manually the assistant quota usage for a WPCOM account (this can only be performed internally, more info in p1726581507875539/1726577612.250489-slack-C04GESRBWKW).
Run the app with the command npm start.
Log in with a WPCOM account.
Open the settings modal.
Observe the Assistant usage is 100%.
Navigate to the Assistant tab.
Observe there's a warning message notifying about the prompt limit reached.
Pre-merge Checklist
[x] Have you checked for TypeScript, React or other console errors?
Related to p1726577612250489-slack-C04GESRBWKW.
Proposed Changes
/studio-app/ai-assistant/quota
endpoint are integers. When the prompt limit is reached, the remaining value will be0
which produces a false value in the parsing code. This has been updated to only fallback to an empty string when the value is not defined.usePromptUsage
hook.Testing Instructions
npm start
.Pre-merge Checklist