/**
 * Dashboard Details page stories.
 *
 * Site Kit by Google, Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * External dependencies
 */
import { storiesOf } from '@storybook/react';

/**
 * Internal dependencies
 */
import { provideSiteInfo, provideUserAuthentication, WithTestRegistry } from '../tests/js/utils';
import DashboardDetailsApp from '../assets/js/components/dashboard-details/dashboard-details-app';
import DashboardDetailsEntityNotFoundView from '../assets/js/components/dashboard-details/DashboardDetailsEntityNotFoundView';

storiesOf( 'Dashboard Details', module )
	.add( 'Existing Entity', () => {
		global.featureFlags = {
			widgets: {
				pageDashboard: {
					enabled: false,
				},
			},
		};

		const setupRegistry = ( registry ) => {
			provideUserAuthentication( registry );
			provideSiteInfo( registry, {
				currentEntityTitle: 'Test Page',
				currentEntityURL: 'https://example.com/test-page',
			} );
		};

		return (
			<WithTestRegistry callback={ setupRegistry }>
				<DashboardDetailsApp />
			</WithTestRegistry>
		);
	} )
	.add( 'Not Found Entity', () => (
		<DashboardDetailsEntityNotFoundView permalink="https://example.com/test-page" />
	) )
;

@@ -728,16 +728,104 @@
 eact';%0A%0A
+/**%0A * WordPress dependencies%0A */%0Aimport %7B removeAllFilters %7D from '@wordpress/hooks';%0A%0A
 /**%0A * I
@@ -947,16 +947,111 @@
 utils';%0A
+import %7B STORE_NAME as CORE_SITE %7D from '../assets/js/googlesitekit/datastore/site/constants';%0A
 import D
@@ -1141,23 +1141,29 @@
 s-app';%0A
-import 
+%0AstoriesOf( '
 Dashboar
@@ -1167,194 +1167,229 @@
 oard
+ 
 Details
-EntityNotFoundView from '../assets/js/components/dashboard-details/DashboardDetailsEntityNotFoundView';%0A%0AstoriesOf( 'Dashboard Details', module )%0A%09.add( 'Existing Entity', () =%3E %7B
+', module )%0A%09.add( 'Existing Entity', () =%3E %7B%0A%09%09// Ensure widget API is disabled and don't display legacy widgets either.%0A%09%09// TODO: Expand this story to include new widgets once legacy widgets are no longer used.
 %0A%09%09g
@@ -1480,24 +1480,86 @@
 ,%0A%09%09%09%7D,%0A%09%09%7D;
+%0A%09%09removeAllFilters( 'googlesitekit.DashboardDetailsModule' );
 %0A%0A%09%09const se
@@ -1756,16 +1756,71 @@
 -page',%0A
+%09%09%09%09currentEntityType: 'post',%0A%09%09%09%09currentEntityID: 5,%0A
 %09%09%09%7D );%0A
@@ -1983,59 +1983,256 @@
  =%3E 
-(%0A%09%09%3CDashboardDetailsEntityNotFoundView p
+%7B%0A%09%09const setupRegistry = ( registry ) =%3E %7B%0A%09%09%09provideUserAuthentication( registry );%0A%09%09%09// By default, the current entity info is all %60null%60 as needed here.%0A%09%09%09provideSiteInfo( registry );%0A%09%09%09registry.dispatch( CORE_SITE ).receiveP
 erma
-link=%22
+LinkParam( '
 http
@@ -2251,24 +2251,149 @@
 com/
-test-page%22 /%3E%0A%09)
+invalid-page' );%0A%09%09%7D;%0A%0A%09%09return (%0A%09%09%09%3CWithTestRegistry callback=%7B setupRegistry %7D%3E%0A%09%09%09%09%3CDashboardDetailsApp /%3E%0A%09%09%09%3C/WithTestRegistry%3E%0A%09%09);%0A%09%7D
  )%0A;

Fix dashboard-details Storybook, mainly focusing on header content for now.