Merge pull request #939 from Safelite/rlsmerge/2023.01.19-to-develop

Rlsmerge/2023.01.19 to develop
This commit is contained in:
Mark Harris 2023-01-16 15:15:40 -05:00 committed by GitHub
commit df7918a264
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 11 deletions

View file

@ -28,6 +28,7 @@
</div>
<div class="modal-footer px-5 py-4">
<buttonMain
isPrimary
class="w-100"
ref="buttonMain"
suppressLoader

View file

@ -46,7 +46,7 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita
export async function navigateToHeritageFunnel({ shouldSaveSession = true, loadingModal }) {
// Create the order (or save existing order) when navigating to Heritage Funnel.
if (shouldSaveSession) {
await saveSession();
await saveSession({ shouldAwaitSaveSessionQueue: true });
}
if (loadingModal && loadingModal.showModal) {

View file

@ -50,9 +50,9 @@ export async function loadSessionIfPresent(isConceptInsurance) {
/*
Will call API to save existing order, or create new one depending where it's called from.
This will also set Referral information in the store after saving, and then
update the cookie.
update the cookie. To force synchronous behavior pass in 'true' for shouldAwaitSaveSessionQueue
*/
export async function saveSession() {
export async function saveSession({ shouldAwaitSaveSessionQueue = false }) {
var saveSessionPromise;
if (store.getters.applicationUser.saveSessionPromise) {
// queue newest request after current saveSessionPromise resolves
@ -66,7 +66,9 @@ export async function saveSession() {
}
store.commit(storeMutations.UPDATE_SAVE_SESSION_PROMISE, saveSessionPromise);
// await here to allow for a caller to await and make the function synchronous
await saveSessionPromise;
if (!store.getters.applicationUser.savedSessionId || shouldAwaitSaveSessionQueue) {
await saveSessionPromise;
}
}
// PRIVATE FUNCTIONS //

View file

@ -170,7 +170,7 @@ describe("saveSession", () => {
const mocks = setupMocksForJsFiles(mockData);
// Act
await saveSession();
await saveSession({});
// Assert
expect(mocks.baseMixin.methods.dispatchStoreAction).toHaveBeenCalledWith(
@ -231,7 +231,7 @@ describe("saveSession", () => {
setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) });
// Act
await saveSession();
await saveSession({});
// Assert
expect(cookieHelper.getFunnelCookie().DidHeritageFunnelUpdateLast).toEqual(false);

View file

@ -111,6 +111,7 @@ import experimentMixin from "@/mixins/experiment-mixin";
import { experimentSettings } from "@/constants/experiments";
import vinPagesMixin from "@/mixins/vin-pages-mixin";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
// Define Validation Rules
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
@ -222,7 +223,9 @@ export default {
} else if (this.$store.getters.order.referralNumber?.length === 6) {
await this.navigateForwardWithSingleCarMatch();
} else if (this.isRepair) {
return this.$router.navigateWithSaving(
// call saveSession here - navigateWithSaving saves too late in the flow
await saveSession({});
return this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
this.$route
);

View file

@ -8,7 +8,7 @@ export default {
async navigateForwardWithSingleCarMatch() {
// If we have not already saved a session, we need to save one now before the lengthy call to getPartsOrQuestions
if (!store.getters.applicationUser.savedSessionId) {
saveSession();
await saveSession({});
}
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS);

View file

@ -160,7 +160,7 @@ const router = createRouter({
//---------------------------------------------------------- Router Functions ----------------------------------------------------------
router.afterEach((to, from) => {
router.afterEach(async (to, from) => {
// Update lastPageVisited in the store
store.commit(storeMutations.UPDATE_LAST_PAGE_VISITED, to.name);
@ -170,7 +170,7 @@ router.afterEach((to, from) => {
store.getters.applicationUser.savedSessionId ||
store.getters.order.customer?.emailAddress
) {
saveSession();
await saveSession({});
}
}

View file

@ -7,7 +7,7 @@
&.list-card {
&:not(.selected) {
position: relative;
z-index: 4;
z-index: 5;
@include box-shadow-hover($blue-300);
}
}