mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-22 17:24:15 +01:00
c271eb99a5
* rearrange stories * fix bug in storybook with mock data * convert to TS, fix static path deprecation * wrap all scenes with KeaStory, deprecate getReduxState * remove old text * don't complain about postcss * remove ApiSelector, revert to ".js" main * preview ".ts" * fix msw * move kea story * fix urls * add /decide handler * mount logics that are there on app * reduce boilerplate * refactor history list storybook api * separate data
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import * as React from 'react'
|
|
import '~/styles'
|
|
import { worker } from '~/mocks/browser'
|
|
import { loadPostHogJS } from '~/loadPostHogJS'
|
|
import { KeaStory } from './kea-story'
|
|
|
|
const setupMsw = () => {
|
|
// Make sure the msw worker is started
|
|
worker.start()
|
|
;(window as any).__mockServiceWorker = worker
|
|
}
|
|
setupMsw()
|
|
|
|
const setupPosthogJs = () => {
|
|
// Make sure we don't hit production posthog. We want to control requests to,
|
|
// e.g. `/decide/` for feature flags
|
|
window.JS_POSTHOG_HOST = window.location.origin
|
|
|
|
// We don't be doing any authn so we can just use a fake key
|
|
window.JS_POSTHOG_API_KEY = 'dummy-key'
|
|
|
|
loadPostHogJS()
|
|
}
|
|
|
|
setupPosthogJs()
|
|
|
|
// Setup storybook global parameters. See https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters
|
|
export const parameters = {
|
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/,
|
|
},
|
|
},
|
|
|
|
options: {
|
|
// opt in to panels in your story by overridding `export const parameters`
|
|
showPanel: false,
|
|
},
|
|
}
|
|
|
|
// Setup storybook global decorators. See https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators
|
|
export const decorators = [
|
|
// Make sure the msw service worker is started, and reset the handlers to
|
|
// defaults.
|
|
(Story: any) => {
|
|
return (
|
|
<KeaStory>
|
|
<Story />
|
|
</KeaStory>
|
|
)
|
|
},
|
|
]
|