Skip to content

feat(feedback): Add onClose description to user-feedback#8484

Merged
AbhiPrasad merged 2 commits intogetsentry:masterfrom
arya-s:feat/feedback-reportdialog-onClose-callback
Nov 27, 2023
Merged

feat(feedback): Add onClose description to user-feedback#8484
AbhiPrasad merged 2 commits intogetsentry:masterfrom
arya-s:feat/feedback-reportdialog-onClose-callback

Conversation

@arya-s
Copy link
Contributor

@arya-s arya-s commented Nov 14, 2023

Fixes getsentry/sentry-javascript#9433

Pre-merge checklist

If you work at Sentry, you're able to merge your own PR without review, but please don't unless there's a good reason.

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

Description of changes

Adds onClose to the user-feedback section and a short description for both onClose and onLoad.

Please see the accompanying PRs:

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Extra resources

@vercel
Copy link

vercel bot commented Nov 14, 2023

@arya-s is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@shanamatthews
Copy link
Contributor

Hey @arya-s - Thanks for the contribution! FYI, I'm going to wait until the code PRs are reviewed before taking a look at this.

@arya-s
Copy link
Contributor Author

arya-s commented Nov 15, 2023

Hey @arya-s - Thanks for the contribution! FYI, I'm going to wait until the code PRs are reviewed before taking a look at this.

Thanks!

Please let me know if there should be more documentation. As far as I've seen, onLoad also has no code samples so I orientated myself around that, but I'd be happy to add a snippet similar to the one I have in my sample project repo.

@AbhiPrasad
Copy link
Contributor

hey @arya-s, we've merged in the SDK and sentry changes. We can only merge in the docs once the SDK has been released, but I think adding a code snippet is a cool idea.

@shanamatthews, where do you think the best place to keep this content is?

@vercel
Copy link

vercel bot commented Nov 22, 2023

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

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2023 7:19pm

Comment on lines +112 to +113
| `onLoad` | n/a - **an optional callback that will be invoked when the widget opens** |
| `onClose` | n/a - **an optional callback that will be invoked when the widget closes** |
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the N/A mean here? Like, what is not available about this param?

@AbhiPrasad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shanamatthews my guess was that n/a refers to there being no default value as per column name. However, the whole table could use some rework given that it's a mixture of default values and descriptions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, got it, thank you. Yeah, let me take a look at this and see if I can figure out a way to make it more intuitive.

@shanamatthews
Copy link
Contributor

hey @arya-s, we've merged in the SDK and sentry changes. We can only merge in the docs once the SDK has been released, but I think adding a code snippet is a cool idea.

@shanamatthews, where do you think the best place to keep this content is?

@AbhiPrasad @arya-s,

I think these docs are being moved and reworked in #8528, so for now, I think we can just put a code snippet on this page as an H3 subheading under "Customizing the Widget", as the last thing before "Feedback API"

Maybe something like "Using onLoad and onClose"?

What do you think?

@arya-s
Copy link
Contributor Author

arya-s commented Nov 22, 2023

I think these docs are being moved and reworked in #8528, so for now, I think we can just put a code snippet on this page as an H3 subheading under "Customizing the Widget", as the last thing before "Feedback API"

Maybe something like "Using onLoad and onClose"?

What do you think?

I had this in mind:

The optional callback handlers onLoad and onClose will be called when the widget opens or closes respectively. You can use these to run custom logic every time the widget is invoked and interacted with:

Sentry.showReportDialog({
  // ...
  onLoad() {
    // Log an event to amplitude when the report dialog opens
    amplitude.logEvent('report_dialog_seen');
  },
  onClose() {
    // Refresh the page after the user closes the report dialog
    location.reload();
  }
});

But it's going to take me a bit to write snippets for all the supported languages/frameworks, some of which I don't have too much experience in and don't have them running locally to test the code... 😅

Thoughts?

@shanamatthews
Copy link
Contributor

shanamatthews commented Nov 22, 2023

I had this in mind:

The optional callback handlers onLoad and onClose will be called when the widget opens or closes respectively. You can use these to run custom logic every time the widget is invoked and interacted with:

Sentry.showReportDialog({
  // ...
  onLoad() {
    // Log an event to amplitude when the report dialog opens
    amplitude.logEvent('report_dialog_seen');
  },
  onClose() {
    // Refresh the page after the user closes the report dialog
    location.reload();
  }
});

But it's going to take me a bit to write snippets for all the supported languages/frameworks, some of which I don't have too much experience in and don't have them running locally to test the code... 😅

Thoughts?

The snippet looks good to me! @AbhiPrasad - thoughts?

I would say just create code snippets for the language(s) you're comfortable with. We can wrap this section in a <PlatformSection supported={["<languages>"]}> and recruit SDK engineers to create other samples for their respective languages once this is merged.

@AbhiPrasad
Copy link
Contributor

The snippet looks good to me!

Looks good to me too, let's make that change!

@arya-s arya-s force-pushed the feat/feedback-reportdialog-onClose-callback branch from 2c642d7 to adfa206 Compare November 25, 2023 06:16
@arya-s
Copy link
Contributor Author

arya-s commented Nov 25, 2023

@shanamatthews @AbhiPrasad
I added snippets for js and python.

Regarding the exact SDK version I wasn't sure. I'm assuming the onClose feature will go out with v7.82.0 (next minor) but if not, please change or let me know and I can change it.

Copy link
Contributor

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

7.82.0 is correct - see getsentry/publish#3070

@AbhiPrasad AbhiPrasad merged commit 07bed55 into getsentry:master Nov 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add onClose callback (or equiv) to showReportDialog

4 participants