Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

130 lines
4.8 KiB
TypeScript

import { memo } from 'react'
import { useMDXComponents } from 'scenes/onboarding/shared/OnboardingDocsContentWrapper'
export const OverridePropertiesSnippet = memo(({ language = 'javascript' }: { language?: string }): JSX.Element => {
const { CodeBlock, dedent, Markdown } = useMDXComponents()
const snippets: Record<string, string> = {
javascript: dedent`
insights.setPersonPropertiesForFlags({'property1': 'value', property2: 'value2'})
`,
'node.js': dedent`
await client.getFeatureFlag(
'flag-key',
'distinct_id_of_the_user',
{
personProperties: {
'property_name': 'value'
},
groups: {
"your_group_type": "your_group_id",
"another_group_type": "your_group_id",
},
groupProperties: {
'your_group_type': {
'group_property_name': 'value'
},
'another_group_type': {
'group_property_name': 'value'
},
},
}
)
`,
python: dedent`
insights.get_feature_flag(
'flag-key',
'distinct_id_of_the_user',
person_properties={'property_name': 'value'},
groups={
'your_group_type': 'your_group_id',
'another_group_type': 'your_group_id'},
group_properties={
'your_group_type': {'group_property_name': 'value'},
'another_group_type': {'group_property_name': 'value'}
},
)
`,
php: dedent`
Insights::getFeatureFlag(
'flag-key',
'distinct_id_of_the_user',
[
'your_group_type' => 'your_group_id',
'another_group_type' => 'your_group_id'
], // groups
['property_name' => 'value'], // person properties
[
'your_group_type' => ['group_property_name' => 'value'],
'another_group_type' => ['group_property_name' => 'value']
], // group properties
false, // onlyEvaluateLocally, Optional. Defaults to false.
true // sendFeatureFlagEvents
)
`,
ruby: dedent`
insights.get_feature_flag(
'flag-key',
'distinct_id_of_the_user',
person_properties: {
'property_name': 'value'
},
groups: {
'your_group_type': 'your_group_id',
'another_group_type': 'your_group_id',
},
group_properties: {
'your_group_type': {
'group_property_name': 'value'
},
'another_group_type': {
'group_property_name': 'value'
},
},
)
`,
go: dedent`
enabledVariant, err := client.GetFeatureFlag(
FeatureFlagPayload{
Key: "flag-key",
DistinctId: "distinct_id_of_the_user",
Groups: insights.NewGroups().
Set("your_group_type", "your_group_id").
Set("another_group_type", "your_group_id"),
PersonProperties: insights.NewProperties().
Set("property_name", "value"),
GroupProperties: map[string]map[string]interface{}{
"your_group_type": {
"group_property_name": "value",
},
"another_group_type": {
"group_property_name": "value",
},
},
},
)
`,
}
const langMap: Record<string, string> = {
javascript: 'javascript',
'node.js': 'javascript',
python: 'python',
php: 'php',
ruby: 'ruby',
go: 'go',
}
return (
<>
<Markdown>
{dedent`
Sometimes, you may want to evaluate feature flags using properties that haven't been ingested yet, or were set incorrectly earlier. You can provide properties to evaluate the flag with:
`}
</Markdown>
<CodeBlock language={langMap[language] || 'javascript'} code={snippets[language] || snippets.javascript} />
</>
)
})