Webpack 4-based builder for Storybook that provides framework-agnostic build engine for preview iframe compilation and bundling.
91
You need to build a custom Storybook addon that tracks user interactions with stories and displays analytics in a dedicated panel. The addon should allow developers to see which stories are being viewed and how often components are being manipulated through controls.
Create a system that tracks the following events:
The addon should collect this data and make it available for display.
Implement a custom panel in the Storybook UI that displays:
The panel should update in real-time as users interact with stories.
The addon must properly integrate with Storybook's addon system by:
addons array in Storybook's main configurationProvides APIs for creating and managing Storybook addons, including panel registration and state management.
Provides APIs for interacting with the story preview context and accessing story lifecycle events.
File: addon.test.js { .test }
Input: Register the addon with Storybook { .input }
Expected Output: The analytics panel appears in the addons panel list with the correct title { .expected_output }
Tags: @test
File: addon.test.js { .test }
Input: Navigate to three different stories { .input }
Expected Output: The panel displays all three stories with a view count of 1 each { .expected_output }
Tags: @test
File: addon.test.js { .test }
Input: Change story arguments twice using controls { .input }
Expected Output: The panel shows the total arg update count as 2 { .expected_output }
Tags: @test
File: addon.test.js { .test }
Input: View stories and update args, then click the clear/reset button { .input }
Expected Output: All analytics data is reset to zero { .expected_output }
Tags: @test
Install with Tessl CLI
npx tessl i tessl/npm-storybook--builder-webpack4evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10