1919/**
2020 * WordPress dependencies
2121 */
22- import { Component , Fragment } from '@wordpress/element' ;
23-
24- /**
25- * External dependencies
26- */
27- import { trackEvent } from 'GoogleUtil' ;
22+ import { Component } from '@wordpress/element' ;
23+ import { __ } from '@wordpress/i18n' ;
2824
2925/**
3026 * Internal dependencies
3127 */
28+ // eslint-disable-next-line @wordpress/dependency-group
29+ import ErrorHandler from 'GoogleComponents/ErrorHandler' ;
30+ import { trackEvent } from 'GoogleUtil' ;
3231import { ActivationMain } from './activation-main' ;
33- import Notification from '../notifications/notification' ;
3432import NotificationCounter from '../notifications/notification-counter' ;
35- import { __ } from '@wordpress/i18n' ;
3633
3734export class ActivationApp extends Component {
38- constructor ( props ) {
39- super ( props ) ;
40- this . state = {
41- hasError : false ,
42- } ;
43- }
44-
45- componentDidCatch ( error , info ) {
46- this . setState ( {
47- hasError : true ,
48- error,
49- info,
50- } ) ;
51- }
52-
5335 render ( ) {
54- const {
55- hasError,
56- error,
57- info,
58- } = this . state ;
59-
60- if ( hasError ) {
61- return < Notification
62- id = "googlesitekit-error"
63- key = "googlesitekit-error"
64- title = { error . message }
65- description = { info . componentStack }
66- dismiss = { '' }
67- isDismissable = { false }
68- format = "small"
69- type = "win-error"
70- /> ;
71- }
7236 const { proxySetupURL, splashURL } = global . _googlesitekitBase ;
7337 const { canViewDashboard } = global . googlesitekit . permissions ;
7438 const { dashboardPermalink } = global . googlesitekit ;
@@ -82,7 +46,7 @@ export class ActivationApp extends Component {
8246 }
8347
8448 return (
85- < Fragment >
49+ < ErrorHandler >
8650 < NotificationCounter />
8751 < ActivationMain
8852 buttonURL = { buttonURL }
@@ -91,7 +55,7 @@ export class ActivationApp extends Component {
9155 trackEvent ( 'plugin_setup' , proxySetupURL ? 'proxy_start_setup_banner' : 'goto_sitekit' ) ;
9256 } }
9357 />
94- </ Fragment >
58+ </ ErrorHandler >
9559 ) ;
9660 }
9761}
0 commit comments