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

change: [M3-8961] - Change Pendo sanitized url path string to match UXR request #11361

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tech Stories
---

Change Pendo sanitized URL path string ([#11361](https://github.com/linode/manager/pull/11361))
17 changes: 7 additions & 10 deletions packages/manager/src/hooks/usePendo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import { transformUrl } from './usePendo';

const ID_URLS = [
{
expectedTransform: 'https://cloud.linode.com/nodebalancers/XXXX',
expectedTransform: 'https://cloud.linode.com/nodebalancers/*',
position: 'end',
url: 'https://cloud.linode.com/nodebalancers/123',
},
{
expectedTransform:
'https://cloud.linode.com/nodebalancers/XXXX/configurations',
'https://cloud.linode.com/nodebalancers/*/configurations',
position: 'middle',
url: 'https://cloud.linode.com/nodebalancers/123/configurations',
},
{
expectedTransform:
'https://cloud.linode.com/nodebalancers/XXXX/configurations/XXXX',
'https://cloud.linode.com/nodebalancers/*/configurations/*',
position: 'multiple',
url: 'https://cloud.linode.com/nodebalancers/123/configurations/456',
},
Expand All @@ -37,23 +37,20 @@ const USERNAME_URLS = [

const OBJ_URLS = [
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX',
expectedTransform: 'http://cloud.linode.com/object-storage/buckets/*/*',
path: 'us-west/abc123',
},
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX/ssl',
expectedTransform: 'http://cloud.linode.com/object-storage/buckets/*/*/ssl',
path: 'us-west/abc123/ssl',
},
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX',
expectedTransform: 'http://cloud.linode.com/object-storage/buckets/*/*',
path: 'us-west/123abc',
},
{
expectedTransform:
'http://cloud.linode.com/object-storage/buckets/XXXX/XXXX/access',
'http://cloud.linode.com/object-storage/buckets/*/*/access',
path: 'us-west/123abc/access',
},
];
Expand Down
8 changes: 4 additions & 4 deletions packages/manager/src/hooks/usePendo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export const transformUrl = (url: string) => {
const oauthPathMatchingRegex = /(#access_token).*/;
let transformedUrl = url;

// Replace any ids with XXXX and keep the rest of the URL intact
transformedUrl = url.replace(idMatchingRegex, '/XXXX');
// Replace any ids with * and keep the rest of the URL intact
transformedUrl = url.replace(idMatchingRegex, `/*`);

// Replace the region and bucket names with XXXX and keep the rest of the URL intact.
// Replace the region and bucket names with * and keep the rest of the URL intact.
// Object storage file navigation is truncated via the 'clear search' transform.
transformedUrl = transformedUrl.replace(
bucketPathMatchingRegex,
'buckets/XXXX/XXXX'
'buckets/*/*'
);

// Remove everything after access_token
Expand Down
Loading