CASH-160 promo code lost coming from content site /cjrepair.  Added all passed querystring keys to the redirect to return-user so they're not lost.
This commit is contained in:
CarlNation 2025-01-24 13:50:40 -05:00
parent 01986fcd4a
commit ccc3feb15e
2 changed files with 19 additions and 6 deletions

View file

@ -8,3 +8,17 @@ export function getQuerystringParameter(key) {
return lowerCaseParams.get(key) ? lowerCaseParams.get(key) : null;
}
// if you add the fmgPage to the querystringobject before calling, then pass true for skipFmgPageName
export function buildQuerystringObject(qso, skipFmgPageName=false) {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
for (const [name, value] of urlParams) {
if (name.toLowerCase() === "fmgpage" && skipFmgPageName) {
continue;
}
qso[name] = value;
}
return qso;
}

View file

@ -6,7 +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 { getQuerystringParameter, buildQuerystringObject } from "@/helpers/querystring-helper";
import { getDeviceIdValue } from "@/helpers/heritage-integration/cookie-helper";
import { showFmgLoadingModal } from "@/helpers/loading-modal-helper";
import { fmgPageValues, funnelStartPageName } from "@/router/router-constants/fmgPage-values";
@ -108,14 +108,13 @@ const routes = [
var qso = {
fmgPage: fmgPageValues.RETURN_USER,
};
const lg = getQuerystringParameter(queryStrings.LOG);
if (lg) {
qso[queryStrings.LOG] = true;
}
const newQueryString = buildQuerystringObject(qso, true);
log(" -- returnUser add querystring: " + JSON.stringify(newQueryString));
router.push({
path: "/",
query: Object.assign({}, qso),
query: Object.assign({}, newQueryString),
});
return;
}