diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index 5ff1f636c..a0009bae0 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -2,6 +2,7 @@ const queryStrings = { FMG_PAGE: "fmgPage", START_TYPE: "start_type", ZIP_CODE: "zipcode", + PROMO: "promo", }; export { queryStrings }; diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index db7881527..ff651aab5 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -1,4 +1,5 @@ import { queryStrings } from "@/constants/query-strings"; +import { getQuerystringParameter } from "@/helpers/querystring-helper"; import { externalUrls } from "@/router/router-constants/externalUrl-values"; import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js"; import { saveSession } from "@/helpers/heritage-integration/order-helper.js"; @@ -59,12 +60,20 @@ export async function navigateToHeritageFunnel({ shouldSaveSession = true, loadi loadingModal.showModal(); } - router.navigateToExternalUrl(externalUrls.HERITAGE_FUNNEL, { + var heritageParms = { corid: store.getters.order.referralCorrelationId, src: "concept-funnel", conceptsqid: store.getters.applicationUser.savedSessionId, isInsurance: store.getters.payment.isInsurance, - }); + }; + + const promo = getQuerystringParameter(queryStrings.PROMO) + + if (promo) { + heritageParms["promo"] = promo; + } + + router.navigateToExternalUrl(externalUrls.HERITAGE_FUNNEL, heritageParms); } export async function skipVinLookup() { diff --git a/src/router/index.js b/src/router/index.js index 11efa6080..424d09dcd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -6,6 +6,7 @@ import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js" import { routingTable } from "@/router/router-constants/routing-table.js"; import { globalEvents, globalEventTypes } from "@/constants/events"; import { queryStrings } from "@/constants/query-strings"; +import { getQuerystringParameter } from "@/helpers/querystring-helper"; import { getDeviceIdValue } from "@/helpers/heritage-integration/cookie-helper"; // Heritage integration @@ -277,14 +278,9 @@ async function navigate( fmgPage: destinationFmgPageValue, }; - const queryString = window.location.search; - const urlParams = new URLSearchParams(queryString); - const lowerCaseParams = new URLSearchParams(); - for (const [name, value] of urlParams) { - lowerCaseParams.append(name.toLowerCase(), value); - } - const hasZip = lowerCaseParams.has(queryStrings.ZIP_CODE); - const zip = lowerCaseParams.get(queryStrings.ZIP_CODE); + const hasZip = getQuerystringParameter(queryStrings.ZIP_CODE) + const zip = getQuerystringParameter(queryStrings.ZIP_CODE) + const promo = getQuerystringParameter(queryStrings.PROMO) if ( hasZip && @@ -296,6 +292,10 @@ async function navigate( queryStringsObject[queryStrings.ZIP_CODE] = zip; } + if (promo) { + queryStringsObject[queryStrings.PROMO] = promo; + } + router.push({ name: "root", query: Object.assign(optionalQuery, queryStringsObject),