Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Renamed some properties to match posthog-js #130

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
"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