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

feat(core): Studio announcements #7515

Open
wants to merge 15 commits into
base: next
Choose a base branch
from
Open

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented Sep 16, 2024

Description

This PR introduces a new floating card and dialog for Studio announcements
This is mandated, by our internal admin studio in which you can define a a new productAnnouncement document to push an announcement into the studios.

It also exports this new components for them to be consumed in the admin studio previews.

How does it works?

We go into the admin studio and create a new productAnnouncement document and publish it.
This document will be fetched by the new /announcements api and returned to the studio.
When a new visitor opens the studio, we will fetch data from two places:

  • /announcements will return the existing announcements, the user could have seen or not.
  • keyValueStore with the key studio.announcement.seen which will return the list of the ids of the seen announcements.
  • The existing announcements will be checked against the seen ones, if at least one announcement is unseen the floating card will show to the user.
  • Clicking the floating card opens a dialog with the announcement, closing the dialog marks the announcement as seen
  • Dismissing the card, marks the announcement as seen.
  • Next time the user opens the studio, the seen announcement will be returned by the key value store so he will only see each announcement once.
studio.announcements.-.floating.card.mov

Note

All announcements returned by /announcements are stored in the studioAnnouncements state in the StudioAnnouncementsContext so the users will be able to click in the Whats new menu item in resources to see all the previous announcements.

studio.announcements.-.resources.menu.mov

Announcements could contain an expiry date, so we don't expect the /announcements api to return a big number of announcements.

How do we keep the key value store data small?

Given announcements will contain an expiry date, we should not receive a big number of announcements from the /announcements API.
We are only going to store as seen the announcements that are returned from the API, we are not keeping the history of all the seen announcements the user has.

Scenario:

  • /announcements API returns 1 document with id foo, user sees that announcement, we will save to the key value store the id of that seen announcement. That user will have saved the value ["foo"]
  • A new announcement is added, /announcements API returns now 2 documents with id foo and bar, user has seen foo so he will see the floating card for announcement bar. When closing the dialog or dismissing the card, we will save to the key value store the two ids. ["foo", "bar"]
  • A new announcement is added and foo is removed. Now the api returns bar and baz, user sees baz , we will update the key value store to ["bar", "baz"], given foo is not returned anymore we don't need to know if the user has seen it or not.

See tests for this behavior

A reset announcements query param can be provided to reset the seen announcements state.
/structure?reset-announcements=foo,bar

What to review

Are the changes correct?
Is it possible to do this in other ways?

Testing

Tests covering the new scenarios have been added

Notes for release

Adds studio announcements to the studio

It implements:

  • GRO-2497
  • GRO-2494
  • GRO-2493
  • GRO-2499
  • GRO-2495
  • GRO-2496
  • GRO-2498

Copy link

vercel bot commented Sep 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 8:52am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 8:52am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 8:52am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 8:52am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 8:52am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 8:52am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Sep 16, 2024

Component Testing Report Updated Sep 19, 2024 8:56 AM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 49s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 39s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 11s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 2m 33s 1 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 47s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 44s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 18s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 27s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 19s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 37s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

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.

1 participant