mirror of
https://github.com/hanzoai/insights.git
synced 2026-11-03 00:52:32 +00:00
243 files rewritten and 12 renamed, by family rather than by a bare substring: stamphog->stamp, review_hog->review, supporthog->support, hogdesk->desk, personhog->person, hoggies->mascot, tophog->topfn, hogflow->flow, hogfunction->function, and hog->script for the rest. Also drops the last alias in the nodejs tree. @hanzo/[email protected] is ours and exports `class Insights` directly, so import { PostHog as Insights } from 'insights-node' becomes an import of the package that already has the name. The catalog entry aliasing insights-node onto posthog-node is no longer what nodejs depends on. Three exclusions, each one learned by breaking it first: migrations/ Django records an applied migration by (app, name). A first pass renamed 0224_tophog.py and three others; that makes them look unapplied and they run again. Reverted; the renamer now refuses any path under migrations/. whogho an integration vendor, sitting in generated_configs/ between Whop and WhenIWork. The same pass turned it into wscriptho.py. Held aside now, and untouched in this diff. case `s/hog/script/I` turned HogDebug.tsx into scriptDebug.tsx, so a component file stopped matching its export. Each rule carries its own casing: ScriptDebug.tsx, ScriptRepl.tsx, but scriptReplLogic.ts. Checked after: every changed .json still parses, and the diff introduces no word where `script` landed inside an unrelated English one — ORTHOGONAL contains "hog" and survives, as does every `subscription`. Co-authored-by: Hanzo Dev <[email protected]>
106 lines
3.8 KiB
TypeScript
106 lines
3.8 KiB
TypeScript
import { MOCK_DEFAULT_PROJECT, MOCK_DEFAULT_TEAM } from 'lib/api.mock'
|
|
|
|
import { UserProductListReason } from '~/queries/schema/schema-general'
|
|
import { AppContext } from '~/types'
|
|
|
|
export const getStorybookAppContext = (): AppContext => ({
|
|
anonymous: false,
|
|
// Ideally we wouldn't set `current_team` here, the same way we don't set `current_user`, but unfortunately
|
|
// as of March 2024, a bunch of logics make the assumption that this is set, via `AppConfig`
|
|
current_team: MOCK_DEFAULT_TEAM,
|
|
current_project: MOCK_DEFAULT_PROJECT,
|
|
current_user: undefined as any, // `undefined` triggers a fetch and lets us mock the data
|
|
default_event_name: '$pageview',
|
|
has_pageview: true,
|
|
has_screen: true,
|
|
has_person_email: false,
|
|
persisted_feature_flags: [],
|
|
commit_sha: undefined,
|
|
preflight: null as any, // `null` triggers a fetch and lets us mock the data
|
|
switched_team: null,
|
|
custom_products: [
|
|
{
|
|
id: 'product-1',
|
|
product_path: 'Product analytics',
|
|
enabled: true,
|
|
reason: UserProductListReason.USED_BY_COLLEAGUES,
|
|
reason_text: null,
|
|
created_at: new Date().toISOString(), // Recent, should show green dot
|
|
updated_at: new Date().toISOString(),
|
|
},
|
|
{
|
|
id: 'product-2',
|
|
product_path: 'Session replay',
|
|
enabled: true,
|
|
reason: UserProductListReason.NEW_PRODUCT,
|
|
reason_text: 'This is a brand new product we just launched!',
|
|
created_at: new Date().toISOString(), // Recent, should show green dot
|
|
updated_at: new Date().toISOString(),
|
|
},
|
|
{
|
|
id: 'product-3',
|
|
product_path: 'Feature flags',
|
|
enabled: true,
|
|
reason: UserProductListReason.USED_ON_SEPARATE_TEAM, // Should NOT show green dot
|
|
reason_text: null,
|
|
created_at: new Date().toISOString(),
|
|
updated_at: new Date().toISOString(),
|
|
},
|
|
{
|
|
id: 'product-4',
|
|
product_path: 'Dashboards',
|
|
enabled: true,
|
|
reason: UserProductListReason.SALES_LED,
|
|
reason_text: null,
|
|
created_at: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString(), // 10 days ago, should NOT show dot
|
|
updated_at: new Date().toISOString(),
|
|
},
|
|
{
|
|
id: 'product-5',
|
|
product_path: 'Experiments',
|
|
enabled: true,
|
|
reason: UserProductListReason.USED_SIMILAR_PRODUCTS,
|
|
reason_text: null,
|
|
created_at: new Date().toISOString(), // Recent, should show green dot
|
|
updated_at: new Date().toISOString(),
|
|
},
|
|
],
|
|
oauth_application: {
|
|
client_id: 'storybook-client-id',
|
|
name: 'Storybook OAuth App',
|
|
is_verified: false,
|
|
logo_uri: null,
|
|
},
|
|
resource_access_control: {
|
|
action: 'manager',
|
|
feature_flag: 'manager',
|
|
script_flow: 'manager',
|
|
heatmap: 'manager',
|
|
dashboard: 'manager',
|
|
dashboard_template: 'manager',
|
|
insight: 'manager',
|
|
notebook: 'manager',
|
|
session_recording: 'manager',
|
|
sharing_configuration: 'manager',
|
|
revenue_analytics: 'manager',
|
|
survey: 'manager',
|
|
ticket: 'manager',
|
|
experiment: 'manager',
|
|
export: 'manager',
|
|
early_access_feature: 'manager',
|
|
external_data_source: 'manager',
|
|
web_analytics: 'manager',
|
|
activity_log: 'viewer',
|
|
customer_analytics: 'manager',
|
|
llm_analytics: 'manager',
|
|
llm_playground: 'manager',
|
|
mcp_analytics: 'manager',
|
|
tagger: 'manager',
|
|
llm_skill: 'manager',
|
|
toolbar: 'viewer',
|
|
error_tracking: 'manager',
|
|
metrics: 'manager',
|
|
replay_scanner: 'manager',
|
|
},
|
|
})
|