From 53400c7aa57b647fb4aaeaeb257704a19a2526d6 Mon Sep 17 00:00:00 2001 From: Ben White Date: Mon, 4 Dec 2023 12:04:37 +0100 Subject: [PATCH] fix: Renamed some properties to match posthog-js (#130) --- posthog-core/src/index.ts | 22 ++++++++++++++++++++-- posthog-react-native/CHANGELOG.md | 5 +++++ posthog-react-native/package.json | 2 +- posthog-web/CHANGELOG.md | 5 +++++ posthog-web/package.json | 2 +- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/posthog-core/src/index.ts b/posthog-core/src/index.ts index 0fe39c51..fba08b6d 100644 --- a/posthog-core/src/index.ts +++ b/posthog-core/src/index.ts @@ -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>(PostHogPersistedProperty.PersonProperties) || {} @@ -880,7 +880,16 @@ export abstract class PostHogCore extends PostHogCoreStateless { return this } - groupProperties(properties: { [type: string]: Record }): this { + resetPersonPropertiesForFlags(): void { + this.setPersistedProperty(PostHogPersistedProperty.PersonProperties, {}) + } + + /** @deprecated - Renamed to setPersonPropertiesForFlags */ + personProperties(properties: { [type: string]: string }): this { + return this.setPersonPropertiesForFlags(properties) + } + + setGroupPropertiesForFlags(properties: { [type: string]: Record }): this { // Get persisted group properties const existingProperties = this.getPersistedProperty>>(PostHogPersistedProperty.GroupProperties) || {} @@ -902,6 +911,15 @@ export abstract class PostHogCore extends PostHogCoreStateless { return this } + resetGroupPropertiesForFlags(): void { + this.setPersistedProperty(PostHogPersistedProperty.GroupProperties, {}) + } + + /** @deprecated - Renamed to setGroupPropertiesForFlags */ + groupProperties(properties: { [type: string]: Record }): this { + return this.setGroupPropertiesForFlags(properties) + } + /*** *** FEATURE FLAGS ***/ diff --git a/posthog-react-native/CHANGELOG.md b/posthog-react-native/CHANGELOG.md index 7434a86f..83c0259e 100644 --- a/posthog-react-native/CHANGELOG.md +++ b/posthog-react-native/CHANGELOG.md @@ -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 diff --git a/posthog-react-native/package.json b/posthog-react-native/package.json index 11f1710a..f1abffdb 100644 --- a/posthog-react-native/package.json +++ b/posthog-react-native/package.json @@ -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/" diff --git a/posthog-web/CHANGELOG.md b/posthog-web/CHANGELOG.md index f7d08c28..7176dfd0 100644 --- a/posthog-web/CHANGELOG.md +++ b/posthog-web/CHANGELOG.md @@ -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 diff --git a/posthog-web/package.json b/posthog-web/package.json index c47e260a..7966580c 100644 --- a/posthog-web/package.json +++ b/posthog-web/package.json @@ -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",