Skip to content

Commit

Permalink
fix: Renamed some properties to match posthog-js (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Dec 4, 2023
1 parent 14ceeab commit 53400c7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
22 changes: 20 additions & 2 deletions posthog-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ export abstract class PostHogCore extends PostHogCoreStateless {
/***
* PROPERTIES
***/
personProperties(properties: { [type: string]: string }): this {
setPersonPropertiesForFlags(properties: { [type: string]: string }): this {
// Get persisted person properties
const existingProperties =
this.getPersistedProperty<Record<string, string>>(PostHogPersistedProperty.PersonProperties) || {}
Expand All @@ -880,7 +880,16 @@ export abstract class PostHogCore extends PostHogCoreStateless {
return this
}

groupProperties(properties: { [type: string]: Record<string, string> }): this {
resetPersonPropertiesForFlags(): void {
this.setPersistedProperty<PostHogEventProperties>(PostHogPersistedProperty.PersonProperties, {})
}

/** @deprecated - Renamed to setPersonPropertiesForFlags */
personProperties(properties: { [type: string]: string }): this {
return this.setPersonPropertiesForFlags(properties)
}

setGroupPropertiesForFlags(properties: { [type: string]: Record<string, string> }): this {
// Get persisted group properties
const existingProperties =
this.getPersistedProperty<Record<string, Record<string, string>>>(PostHogPersistedProperty.GroupProperties) || {}
Expand All @@ -902,6 +911,15 @@ export abstract class PostHogCore extends PostHogCoreStateless {
return this
}

resetGroupPropertiesForFlags(): void {
this.setPersistedProperty<PostHogEventProperties>(PostHogPersistedProperty.GroupProperties, {})
}

/** @deprecated - Renamed to setGroupPropertiesForFlags */
groupProperties(properties: { [type: string]: Record<string, string> }): this {
return this.setGroupPropertiesForFlags(properties)
}

/***
*** FEATURE FLAGS
***/
Expand Down
5 changes: 5 additions & 0 deletions posthog-react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 2.9.0 - 2023-12-04

1. Renamed `personProperties` to `setPersonPropertiesForFlags` to match `posthog-js` and more clearly indicated what it does
2. Renamed `groupProperties` to `setGroupPropertiesForFlags` to match `posthog-js` and more clearly indicated what it does

# 2.8.1 - 2023-10-09

1. Fixes a type generation issue
Expand Down
2 changes: 1 addition & 1 deletion posthog-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "posthog-react-native",
"version": "2.8.1",
"version": "2.9.0",
"main": "lib/posthog-react-native/index.js",
"files": [
"lib/"
Expand Down
5 changes: 5 additions & 0 deletions posthog-web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 2.5.0 - 2023-12-04

1. Renamed `personProperties` to `setPersonPropertiesForFlags` to match `posthog-js` and more clearly indicated what it does
2. Renamed `groupProperties` to `setGroupPropertiesForFlags` to match `posthog-js` and more clearly indicated what it does

# 2.4.0 - 2023-04-20

1. Fixes a race condition that could occur when initialising PostHog
Expand Down
2 changes: 1 addition & 1 deletion posthog-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "posthog-js-lite",
"version": "2.4.0",
"version": "2.5.0",
"main": "lib/index.cjs.js",
"module": "lib/index.esm.js",
"types": "lib/index.d.ts",
Expand Down

0 comments on commit 53400c7

Please sign in to comment.