From c2e805f847b26cac355a2dde0e5e94023455b08e Mon Sep 17 00:00:00 2001 From: mjac0bs Date: Tue, 3 Dec 2024 10:11:47 -0800 Subject: [PATCH] Change sanitized url path string to match UXR request --- packages/manager/src/hooks/usePendo.test.ts | 17 +++++++---------- packages/manager/src/hooks/usePendo.ts | 8 ++++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/manager/src/hooks/usePendo.test.ts b/packages/manager/src/hooks/usePendo.test.ts index 3699979c033..a5afd581bd0 100644 --- a/packages/manager/src/hooks/usePendo.test.ts +++ b/packages/manager/src/hooks/usePendo.test.ts @@ -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', }, @@ -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', }, ]; diff --git a/packages/manager/src/hooks/usePendo.ts b/packages/manager/src/hooks/usePendo.ts index d15c4f435f8..f60805ef2d7 100644 --- a/packages/manager/src/hooks/usePendo.ts +++ b/packages/manager/src/hooks/usePendo.ts @@ -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