Merge pull request #106 from Safelite/feature/SSR-201

Feature/ssr 201
This commit is contained in:
Kulbhushan Kaushik 2023-01-11 14:21:58 -05:00 committed by GitHub
commit bf1fb54d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 14 deletions

View file

@ -37,6 +37,7 @@ describe("site-footer.vue", () => {
const mockMixin = {
methods: {
getCmsContent: jest.fn(),
getPageNameByQueryString: jest.fn(() => "welcome-page"),
getFooterInfoBoxHeight: jest.fn(() => 80),
},
};

View file

@ -37,6 +37,7 @@
<script>
import textLink from "@/ux-components/text-link/text-link";
import buttonMain from "@/ux-components/button-main/button-main";
import { issPageValues } from "@/router/router-constants/issPage-values"
export default {
name: "siteFooter",
@ -57,7 +58,7 @@ export default {
};
},
mounted() {
this.paddingHeight = this.getFooterInfoBoxHeight() + 24;
this.paddingHeight = this.includeFooterImage ? this.getFooterInfoBoxHeight() + 89 : this.getFooterInfoBoxHeight() + 24;
this.$nextTick(() => {
window.addEventListener("resize", this.onResize);
});
@ -80,6 +81,11 @@ export default {
footerImageURL()
{
return this.getCmsContent(this.cmsWidgetName, "FooterImageURL");
},
includeFooterImage()
{
const currentPageName = this.getPageNameByQueryString();
return (currentPageName.toLowerCase() == issPageValues.WELCOME_PAGE);
}
},
methods: {
@ -145,6 +151,7 @@ export default {
text-align: center;
position: sticky;
bottom: 72px;
}
#siteFooterImage
{

View file

@ -79,6 +79,7 @@ function setupMocks() {
return '';
}),
getFooterInfoBoxHeight: jest.fn(() => 80),
getPageNameByQueryString: jest.fn(() => "vehicle-lookup"),
},
},
],

View file

@ -18,9 +18,18 @@ import { cookieNames } from "@/constants/cookie-names";
import { useMainStore } from "@/store";
export default {
methods: {
methods: {
getPageNameByQueryString() {
const params = new URLSearchParams(location.search);
if (params.has(queryStrings.ISS_PAGE)) {
return params.get(queryStrings.ISS_PAGE);
} else {
return "";
}
},
logPageView(pageEvent) {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
var payload = {
userId: getDeviceIdValue(),
sessionKey: getSessionKeyValue(),
@ -36,7 +45,7 @@ export default {
},
logCustomEvent(category, action, label, value) {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
var payload = {
userId: getDeviceIdValue(),
@ -55,7 +64,7 @@ export default {
},
pushEventToGA(category, action, label, pushToLogApp = false, valueToLogType = null) {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
const labelToLog = getValueToLog(label, valueToLogType);
const eventToBePushed = {
@ -75,7 +84,7 @@ export default {
},
pushPageViewToGA() {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
const pageViewEvent = {
event: GaEvents.PAGE_VIEW_EVENT,
pagePath: `/iss/?${queryStrings.ISS_PAGE}=${currentPageName}`,
@ -187,15 +196,7 @@ function pushToDataLayerIfDefined(data) {
}
}
function getPageNameByQueryString() {
const params = new URLSearchParams(location.search);
if (params.has(queryStrings.ISS_PAGE)) {
return params.get(queryStrings.ISS_PAGE);
} else {
return "";
}
}
function getValueToLog(value, valueToLogType) {
if (valueToLogType != null && valueToLogType === ValueToLogTypes.LAST_5) {