Skip to content

Commit

Permalink
fix(flags): Make sure to add feature props to ffc events (#103)
Browse files Browse the repository at this point in the history
* fix(flags): Make sure to add feature props to ffc events

* add to core
  • Loading branch information
neilkakkar authored Aug 17, 2023
1 parent b70f194 commit 54178fc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions posthog-core/test/posthog.featureflags.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ describe('PostHog Core', () => {
properties: {
$feature_flag: 'feature-1',
$feature_flag_response: true,
'$feature/feature-1': true,
},
type: 'capture',
},
Expand Down
4 changes: 4 additions & 0 deletions posthog-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 3.1.2 - 2023-08-17

1. Returns the current flag property with $feature_flag_called events, to make it easier to use in experiments

# 3.1.1 - 2023-04-26

1. Replace crypto library with pure-js rusha library which makes posthog-node work with Cloudflare Workers in Next.js edge runtime.
Expand Down
2 changes: 1 addition & 1 deletion posthog-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "posthog-node",
"version": "3.1.1",
"version": "3.1.2",
"description": "PostHog Node.js integration",
"repository": "PostHog/posthog-node",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions posthog-node/src/posthog-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export class PostHog extends PostHogCoreStateless implements PostHogNodeV1 {
$feature_flag: key,
$feature_flag_response: response,
locally_evaluated: flagWasLocallyEvaluated,
[`$feature/${key}`]: response,
},
groups,
disableGeoip,
Expand Down
4 changes: 4 additions & 0 deletions posthog-node/test/posthog-node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ describe('PostHog Node.js', () => {
$lib: 'posthog-node',
$lib_version: '1.2.3',
locally_evaluated: true,
'$feature/beta-feature': true,
}),
},
])
Expand Down Expand Up @@ -610,6 +611,7 @@ describe('PostHog Node.js', () => {
properties: expect.objectContaining({
$feature_flag: 'beta-feature',
$feature_flag_response: true,
'$feature/beta-feature': true,
$lib: 'posthog-node',
$lib_version: '1.2.3',
locally_evaluated: true,
Expand Down Expand Up @@ -652,6 +654,7 @@ describe('PostHog Node.js', () => {
$lib: 'posthog-node',
$lib_version: '1.2.3',
locally_evaluated: true,
'$feature/beta-feature': true,
$groups: { x: 'y' },
})
mockedFetch.mockClear()
Expand Down Expand Up @@ -688,6 +691,7 @@ describe('PostHog Node.js', () => {
$lib: 'posthog-node',
$lib_version: '1.2.3',
locally_evaluated: false,
'$feature/decide-flag': 'decide-value',
$groups: { organization: 'org1' },
}),
})
Expand Down

0 comments on commit 54178fc

Please sign in to comment.