-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bugfix] update analytics.reset() to clear group data (#611)
* adds analytics.reset() test * updates analytics.reset() to clear group data * add changelog
- @segment/analytics-signals-runtime@1.1.1
- @segment/analytics-signals-runtime@1.1.0
- @segment/analytics-signals-runtime@1.0.0
- @segment/analytics-signals@1.8.0
- @segment/analytics-signals@1.7.1
- @segment/analytics-signals@1.7.0
- @segment/analytics-signals@1.6.0
- @segment/analytics-signals@1.5.1
- @segment/analytics-signals@1.5.0
- @segment/analytics-signals@1.4.0
- @segment/analytics-signals@1.3.0
- @segment/analytics-signals@1.2.0
- @segment/analytics-signals@1.1.0
- @segment/analytics-signals@1.0.1
- @segment/analytics-signals@1.0.0
- @segment/analytics-signals@0.1.1
- @segment/analytics-signals@0.1.0
- @segment/analytics-signals@0.0.1
- @segment/analytics-node@2.2.0
- @segment/analytics-node@2.1.3
- @segment/analytics-node@2.1.2
- @segment/analytics-node@2.1.1
- @segment/analytics-node@2.1.0
- @segment/analytics-node@2.0.0
- @segment/analytics-node@1.3.0
- @segment/analytics-node@1.2.0
- @segment/analytics-node@1.1.4
- @segment/analytics-node@1.1.3
- @segment/analytics-node@1.1.2
- @segment/analytics-node@1.1.1
- @segment/analytics-node@1.1.0
- @segment/analytics-node@1.0.0
- @segment/analytics-next@1.76.0
- @segment/analytics-next@1.75.0
- @segment/analytics-next@1.74.0
- @segment/analytics-next@1.73.0
- @segment/analytics-next@1.72.2
- @segment/analytics-next@1.72.1
- @segment/analytics-next@1.72.0
- @segment/analytics-next@1.71.0
- @segment/analytics-next@1.70.0
- @segment/analytics-next@1.69.0
- @segment/analytics-next@1.68.0
- @segment/analytics-next@1.67.0
- @segment/analytics-next@1.66.0
- @segment/analytics-next@1.64.0
- @segment/analytics-next@1.63.0
- @segment/analytics-next@1.62.1
- @segment/analytics-next@1.62.0
- @segment/analytics-next@1.61.0
- @segment/analytics-next@1.60.0
- @segment/analytics-next@1.59.0
- @segment/analytics-next@1.58.0
- @segment/analytics-next@1.57.0
- @segment/analytics-next@1.56.0
- @segment/analytics-next@1.55.0
- @segment/analytics-next@1.54.0
- @segment/analytics-next@1.53.4
- @segment/analytics-next@1.53.3
- @segment/analytics-next@1.53.2
- @segment/analytics-next@1.53.1
- @segment/analytics-next@1.53.0
- @segment/analytics-next@1.52.0
- @segment/analytics-next@1.51.7
- @segment/analytics-next@1.51.6
- @segment/analytics-next@1.51.5
- @segment/analytics-next@1.51.4
- @segment/analytics-next@1.51.3
- @segment/analytics-next@1.51.2
- @segment/analytics-next@1.51.1
- @segment/analytics-next@1.51.0
- @segment/analytics-next@1.50.0
- @segment/analytics-next@1.49.2
- @segment/analytics-next@1.49.1
- @segment/analytics-next@1.49.0
- @segment/analytics-next@1.48.0
- @segment/analytics-next@1.47.1
- @segment/analytics-next@1.47.0
- @segment/analytics-next@1.46.4
- @segment/analytics-next@1.46.3
- @segment/analytics-next@1.46.2
- @segment/analytics-next@1.46.1
- @segment/analytics-next@1.46.0
- @segment/analytics-next@1.45.0
- @segment/analytics-next@1.44.0
- @segment/analytics-next@1.43.2
- @segment/analytics-next@1.43.1
- @segment/analytics-generic-utils@1.2.0
- @segment/analytics-generic-utils@1.1.1
- @segment/analytics-generic-utils@1.1.0
- @segment/analytics-generic-utils@1.0.0
- @segment/analytics-core@1.8.0
- @segment/analytics-core@1.7.0
- @segment/analytics-core@1.6.0
- @segment/analytics-core@1.5.1
- @segment/analytics-core@1.5.0
- @segment/analytics-core@1.4.1
- @segment/analytics-core@1.4.0
- @segment/analytics-core@1.3.2
- @segment/analytics-core@1.3.1
- @segment/analytics-core@1.3.0
- @segment/analytics-core@1.2.5
- @segment/analytics-core@1.2.4
- @segment/analytics-core@1.2.3
- @segment/analytics-core@1.2.2
- @segment/analytics-core@1.2.1
- @segment/analytics-core@1.2.0
- @segment/analytics-core@1.1.6
- @segment/analytics-core@1.1.5
- @segment/analytics-core@1.1.4
- @segment/analytics-core@1.1.3
- @segment/analytics-core@1.1.2
- @segment/analytics-core@1.1.1
- @segment/analytics-core@1.1.0
- @segment/analytics-consent-wrapper-onetrust@1.1.1
- @segment/analytics-consent-wrapper-onetrust@1.1.0
- @segment/analytics-consent-wrapper-onetrust@1.0.1
- @segment/analytics-consent-wrapper-onetrust@1.0.0
- @segment/analytics-consent-wrapper-onetrust@0.4.1
- @segment/analytics-consent-wrapper-onetrust@0.4.0
- @segment/analytics-consent-wrapper-onetrust@0.3.3
- @segment/analytics-consent-wrapper-onetrust@0.3.2
- @segment/analytics-consent-wrapper-onetrust@0.3.1
- @segment/analytics-consent-wrapper-onetrust@0.3.0
- @segment/analytics-consent-wrapper-onetrust@0.2.0
- @segment/analytics-consent-wrapper-onetrust@0.1.0
- @segment/analytics-consent-wrapper-onetrust@0.0.4
- @segment/analytics-consent-wrapper-onetrust@0.0.3
- @segment/analytics-consent-wrapper-onetrust@0.0.2
- @segment/analytics-consent-wrapper-onetrust@0.0.1
- @segment/analytics-consent-tools@2.0.1
- @segment/analytics-consent-tools@2.0.0
- @segment/analytics-consent-tools@1.2.0
- @segment/analytics-consent-tools@1.1.0
- @segment/analytics-consent-tools@1.0.0
- @segment/analytics-consent-tools@0.2.1
- @segment/analytics-consent-tools@0.2.0
- @segment/analytics-consent-tools@0.1.1
- @segment/analytics-consent-tools@0.1.0
- @segment/analytics-consent-tools@0.0.4
- @segment/analytics-consent-tools@0.0.3
- @segment/analytics-consent-tools@0.0.2
- @segment/analytics-consent-tools@0.0.1
1 parent
a23ccee
commit 29c3bd7
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@segment/analytics-next': patch | ||
--- | ||
|
||
Fixes analytics.reset() so that it clears group data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import cookie from 'js-cookie' | ||
|
||
export interface RetrieveStoredDataProps { | ||
cookieNames: string[] | ||
localStorageKeys: string[] | ||
} | ||
|
||
export function retrieveStoredData({ | ||
cookieNames, | ||
localStorageKeys, | ||
}: RetrieveStoredDataProps): Record<string, string | {}> { | ||
const result: ReturnType<typeof retrieveStoredData> = {} | ||
|
||
const cookies = cookie.get() | ||
cookieNames.forEach((name) => { | ||
if (name in cookies) { | ||
result[name] = cookies[name] | ||
} | ||
}) | ||
|
||
localStorageKeys.forEach((key) => { | ||
const value = localStorage.getItem(key) | ||
if (value !== null && typeof value !== 'undefined') { | ||
result[key] = JSON.parse(value) | ||
} | ||
}) | ||
|
||
return result | ||
} |