-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): pull hotfix-release/3.14.0 into main (#1760)
- Loading branch information
Showing
72 changed files
with
1,176 additions
and
297 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 |
---|---|---|
|
@@ -29,7 +29,8 @@ | |
"cancelAnimationFrame", | ||
"navigator.sendBeacon", | ||
"Uint8Array", | ||
"Set" | ||
"Set", | ||
"atob" | ||
] | ||
}, | ||
"env": { | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
{ | ||
"threshold": 5, | ||
"reporters": ["html", "console"], | ||
"pattern": "**/*", | ||
"ignore": [ | ||
"**/__tests__/**", | ||
"**/__mocks__/**", | ||
"**/__fixtures__/**", | ||
"**/node_modules/**", | ||
"*.test.*" | ||
], | ||
"absolute": true, | ||
"gitignore": true, | ||
"output": "./reports/", | ||
"mode": "strict", | ||
"format": ["typescript", "tsx"] | ||
} |
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,11 @@ | ||
/** | ||
* DO NOT EDIT the size limits configured in this file. | ||
* Should you update them, please contact CODEOWNERS. | ||
*/ | ||
module.exports = [ | ||
{ | ||
name: 'Cookies Utilities', | ||
path: 'dist/**/*.js', | ||
limit: '2 KiB', | ||
}, | ||
]; |
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,17 @@ | ||
# Changelog | ||
|
||
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). | ||
|
||
## 0.1.0 (2024-06-25) | ||
|
||
### Dependency Updates | ||
|
||
* `@rudderstack/analytics-js-common` updated to version `0.1.0` | ||
|
||
### Features | ||
|
||
* create new package for cookie utilities ([#1759](https://github.com/rudderlabs/rudder-sdk-js/issues/1759)) ([92826a4](https://github.com/rudderlabs/rudder-sdk-js/commit/92826a4f2e87dd2d0d755016592e36e4708f34d4)) | ||
|
||
# Changelog | ||
|
||
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). |
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,13 @@ | ||
## 0.1.0 (2024-06-25) | ||
|
||
### Dependency Updates | ||
|
||
* `@rudderstack/analytics-js-common` updated to version `0.1.0` | ||
|
||
### Features | ||
|
||
* create new package for cookie utilities ([#1759](https://github.com/rudderlabs/rudder-sdk-js/issues/1759)) ([92826a4](https://github.com/rudderlabs/rudder-sdk-js/commit/92826a4f2e87dd2d0d755016592e36e4708f34d4)) | ||
|
||
# Changelog | ||
|
||
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 RudderStack | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,78 @@ | ||
## [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](https://www.typescriptlang.org/) | ||
|
||
<p align="center"> | ||
<a href="https://rudderstack.com/"> | ||
<img alt="RudderStack" width="512" src="https://raw.githubusercontent.com/rudderlabs/rudder-sdk-js/develop/assets/rs-logo-full-light.jpg"> | ||
</a> | ||
<br /> | ||
<caption>The Customer Data Platform for Developers</caption> | ||
</p> | ||
<p align="center"> | ||
<b> | ||
<a href="https://rudderstack.com">Website</a> | ||
· | ||
<a href="https://rudderstack.com/docs/stream-sources/rudderstack-sdk-integration-guides/rudderstack-javascript-sdk/">Documentation</a> | ||
· | ||
<a href="https://rudderstack.com/join-rudderstack-slack-community">Community Slack</a> | ||
</b> | ||
</p> | ||
|
||
--- | ||
|
||
# @rudderstack/analytics-js-cookies | ||
|
||
RudderStack JavaScript SDK utility for cookies. | ||
|
||
## APIs | ||
|
||
### `getDecryptedCookie` | ||
|
||
This function decrypts and returns the RudderStack JavaScript SDK cookie values. | ||
|
||
The return type is either a `string` or an `object` as some cookies like user ID, anonymous user ID have string values while user traits are objects. | ||
|
||
It returns `null` in either of the following scenarios: | ||
|
||
- If the cookie is not present. | ||
- If the cookie is not properly encrypted. | ||
- It only decrypts the cookies that are created by the RudderStack JavaScript SDK encryption version "v3". | ||
- If the decrypted cookie value is not a valid JSON string. | ||
- If the provided cookie name is not a valid RudderStack JavaScript SDK cookie name. | ||
|
||
> If unencrypted, the cookie value will be returned as is. | ||
> Any errors during decryption are swallowed by the function, returning `null`. | ||
The following are the available cookie key exports: | ||
- `userIdKey`: The key for the user ID cookie. | ||
- `userTraitsKey`: The key for the user traits cookie. | ||
- `anonymousUserIdKey`: The key for the anonymous user ID cookie. | ||
- `groupIdKey`: The key for the group ID cookie. | ||
- `groupTraitsKey`: The key for the group traits cookie. | ||
- `pageInitialReferrerKey`: The key for the page initial referrer cookie. | ||
- `pageInitialReferringDomainKey`: The key for the page initial referring domain cookie. | ||
- `sessionInfoKey`: The key for the session ID cookie. | ||
- `authTokenKey`: The key for the auth token cookie. | ||
|
||
|
||
```javascript | ||
import { | ||
getDecryptedCookie, | ||
anonymousUserIdKey, | ||
userTraitsKey, | ||
} from '@rudderstack/analytics-js-cookies'; | ||
|
||
const anonymousId = getDecryptedCookie(anonymousUserIdKey); | ||
console.log('Anonymous User ID: ', anonymousId); | ||
// Output: Anonymous User ID: 2c5b6d48-ea90-43a2-a2f6-457d27f90328 | ||
|
||
const userTraits = getDecryptedCookie(userTraitsKey); | ||
console.log('User Traits: ', userTraits); | ||
// Output: User Traits: {"email":"[email protected]","name":"John Doe"} | ||
|
||
const invalidCookie = getDecryptedCookie('invalid-cookie-name'); | ||
console.log('Invalid Cookie: ', invalidCookie); | ||
// Output: Invalid Cookie: null | ||
``` | ||
|
||
> For detailed documentation on the RudderStack JavaScript SDK, click [**here**](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/). |
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
Oops, something went wrong.