(core) Reopen HelpScout beacon to the last-opened article

Summary:
- When opening HelpScout beacon to an article ("answers"), avoid a 'navigate'
  call to let the beacon show the previously open article.
- Work around a bug with reloading a page with a beacon article open: HelpScout
  renders the last state without triggering usual events.
- Report errors to server when beacon fails to load.
- reportWarning() method now reports the message to the server.

Test Plan: Added a test case

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3345
This commit is contained in:
Dmitry S
2022-03-29 10:40:12 -04:00
parent 499e24b744
commit d55bdbcdf3
2 changed files with 55 additions and 24 deletions

View File

@@ -53,10 +53,14 @@ export function reportMessage(msg: string, options?: Partial<INotifyOptions>) {
}
/**
* Shows warning toast notification (with yellow styling).
* Shows warning toast notification (with yellow styling), and log to server and to console. Pass
* {level: 'error'} for same behavior with adjusted styling.
*/
export function reportWarning(msg: string, options?: Partial<INotifyOptions>) {
reportMessage(msg, {level: 'warning', ...options});
options = {level: 'warning', ...options};
log.warn(`${options.level}: `, msg);
_logError(msg);
reportMessage(msg, options);
}
/**