From 08a5a35b893deb079abcab2a4d1176b876b7c40c Mon Sep 17 00:00:00 2001
From: abrunner <abrunner@newrelic.com>
Date: Tue, 30 Nov 2021 10:17:26 -0600
Subject: [PATCH] fix: redirect to specific nerdlets if returning user

---
 .../super_tiles/components/CodeStreamTile.js     | 11 +++++++++--
 .../super_tiles/components/GuidedInstallTile.js  | 16 ++++++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/experiments/super_tiles/components/CodeStreamTile.js b/src/experiments/super_tiles/components/CodeStreamTile.js
index d5293e182..590b416d1 100644
--- a/src/experiments/super_tiles/components/CodeStreamTile.js
+++ b/src/experiments/super_tiles/components/CodeStreamTile.js
@@ -3,12 +3,19 @@ import { css } from '@emotion/react';
 import SuperTile from './SuperTile';
 import { Button, useTessen } from '@newrelic/gatsby-theme-newrelic';
 import { Link } from 'gatsby';
+import Cookies from 'js-cookie';
+import { getPackNr1Url } from '../../../utils/get-pack-nr1-url';
 
 const CodeStreamTile = () => {
   const tessen = useTessen();
 
-  const link =
-    '/instant-observability/codestream/29bd9a4a-1c19-4219-9694-0942f6411ce7/';
+  const isReturningUser = Boolean(Cookies.get('ajs_user_id'));
+  const quickstartId = '29bd9a4a-1c19-4219-9694-0942f6411ce7';
+  const nerdletId = 'codestream-install.home';
+
+  const link = isReturningUser
+    ? getPackNr1Url(quickstartId, nerdletId)
+    : '/instant-observability/codestream/29bd9a4a-1c19-4219-9694-0942f6411ce7/';
 
   const handleButtonClick = () => {
     tessen.track('clickSuperTile', 'QuickstartLanding', { tile: 'codestream' });
diff --git a/src/experiments/super_tiles/components/GuidedInstallTile.js b/src/experiments/super_tiles/components/GuidedInstallTile.js
index 80e4c7095..f625069ee 100644
--- a/src/experiments/super_tiles/components/GuidedInstallTile.js
+++ b/src/experiments/super_tiles/components/GuidedInstallTile.js
@@ -7,13 +7,25 @@ import {
 } from '@newrelic/gatsby-theme-newrelic';
 import { navigate } from 'gatsby';
 import Cookies from 'js-cookie';
-import { SIGNUP_LINK, LOGIN_LINK } from '../../../data/constants';
+import {
+  SIGNUP_LINK,
+  NR1_GUIDED_INSTALL_NERDLET,
+} from '../../../data/constants';
+import { getGuidedInstallStackedNr1Url } from '../../../utils/get-pack-nr1-url';
 
 const GuidedInstallTile = () => {
   const isReturningUser = Boolean(Cookies.get('ajs_user_id'));
 
+  const handleNavigation = () => {
+    const platformUrl = isReturningUser
+      ? getGuidedInstallStackedNr1Url(NR1_GUIDED_INSTALL_NERDLET)
+      : SIGNUP_LINK;
+
+    navigate(platformUrl);
+  };
+
   const handleButtonClick = useInstrumentedHandler(
-    () => navigate(isReturningUser ? LOGIN_LINK : SIGNUP_LINK),
+    handleNavigation,
     {
       tessenEventName: 'clickSuperTile',
       tessenCategoryName: 'QuickstartLanding',