Merge pull request #2580 from Safelite/feature/CASH-920
Commit zipcode to store at start of funnel so it persists
This commit is contained in:
commit
ee95ff7a61
6 changed files with 26 additions and 17 deletions
|
|
@ -99,9 +99,7 @@ export default {
|
||||||
lowerCaseParams.append(name.toLowerCase(), value);
|
lowerCaseParams.append(name.toLowerCase(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const zip =
|
const zip = store.getters.order.serviceLocation.zipCode;
|
||||||
peekQueryFromStash(queryStrings.ZIP_CODE) ??
|
|
||||||
store.getters.order.serviceLocation.zipCode;
|
|
||||||
|
|
||||||
var vinByAddressPromise;
|
var vinByAddressPromise;
|
||||||
if (zip) {
|
if (zip) {
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,6 @@ import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
import { routeData } from "@/router/constants/routes";
|
import { routeData } from "@/router/constants/routes";
|
||||||
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
|
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("license-plate-required", required(errorMessages.LICENSE_PLATE_REQUIRED));
|
defineRule("license-plate-required", required(errorMessages.LICENSE_PLATE_REQUIRED));
|
||||||
|
|
@ -164,8 +162,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
licensePlate: this.getLicensePlateFromStore(),
|
licensePlate: this.getLicensePlateFromStore(),
|
||||||
registrationZipCode:
|
registrationZipCode: this.getRegistrationZipFromStore(),
|
||||||
this.getRegistrationZipFromStore() ?? consumeQueryFromStash(queryStrings.ZIP_CODE),
|
|
||||||
emailOrSms: this.getEmailOrSmsFromStore(),
|
emailOrSms: this.getEmailOrSmsFromStore(),
|
||||||
serviceZipCode: this.getServiceZipFromStore(),
|
serviceZipCode: this.getServiceZipFromStore(),
|
||||||
carId: this.getCarIdfromStore(),
|
carId: this.getCarIdfromStore(),
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
import { routeData } from "@/router/constants/routes";
|
import { routeData } from "@/router/constants/routes";
|
||||||
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
|
|
||||||
|
|
||||||
// Define Validation Rules
|
// Define Validation Rules
|
||||||
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
|
@ -116,7 +115,7 @@ export default {
|
||||||
mixins: [vinPagesMixin],
|
mixins: [vinPagesMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
serviceZipCode: this.getZipFromStore() ?? consumeQueryFromStash(queryStrings.ZIP_CODE),
|
serviceZipCode: this.getZipFromStore(),
|
||||||
emailOrSms: this.getEmailOrSmsFromStore(),
|
emailOrSms: this.getEmailOrSmsFromStore(),
|
||||||
carId: this.getCarIdfromStore(),
|
carId: this.getCarIdfromStore(),
|
||||||
isHeavyTruck: this.getIsVehicleHeavyTruckServiceableFromStore(),
|
isHeavyTruck: this.getIsVehicleHeavyTruckServiceableFromStore(),
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,6 @@ import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
import { applicationConfig } from "../../constants/application-config";
|
import { applicationConfig } from "../../constants/application-config";
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||||
import {
|
|
||||||
consumeQueryFromStash,
|
|
||||||
peekQueryFromStash,
|
|
||||||
} from "@/router/methods/helpers/querystring-stash";
|
|
||||||
import { debugLog } from "@/helpers/debug-log-helper";
|
import { debugLog } from "@/helpers/debug-log-helper";
|
||||||
|
|
||||||
//define validation rules
|
//define validation rules
|
||||||
|
|
@ -138,7 +134,7 @@ export default {
|
||||||
imageUrl: this.getImagefromStore(),
|
imageUrl: this.getImagefromStore(),
|
||||||
imageVifNumber: this.getImageVifNumberfromStore(),
|
imageVifNumber: this.getImageVifNumberfromStore(),
|
||||||
imageVifColor: this.getImageVifColorfromStore(),
|
imageVifColor: this.getImageVifColorfromStore(),
|
||||||
serviceZipCode: this.getZipFromStore() ?? peekQueryFromStash(queryStrings.ZIP_CODE),
|
serviceZipCode: this.getZipFromStore(),
|
||||||
yearOptions: [],
|
yearOptions: [],
|
||||||
makeOptions: [],
|
makeOptions: [],
|
||||||
modelOptions: [],
|
modelOptions: [],
|
||||||
|
|
|
||||||
|
|
@ -159,8 +159,6 @@ import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
import { routeData } from "@/router/constants/routes";
|
import { routeData } from "@/router/constants/routes";
|
||||||
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
|
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
|
@ -204,7 +202,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
vin: this.getVinFromStore(),
|
vin: this.getVinFromStore(),
|
||||||
serviceZipCode: this.getZipFromStore() ?? consumeQueryFromStash(queryStrings.ZIP_CODE),
|
serviceZipCode: this.getZipFromStore(),
|
||||||
emailOrSms: this.getEmailOrSmsFromStore(),
|
emailOrSms: this.getEmailOrSmsFromStore(),
|
||||||
carId: this.getCarIdfromStore(),
|
carId: this.getCarIdfromStore(),
|
||||||
isHeavyTruck: this.getIsVehicleHeavyTruckServiceableFromStore(),
|
isHeavyTruck: this.getIsVehicleHeavyTruckServiceableFromStore(),
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@ import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
import { routeData } from "@/router/constants/routes";
|
import { routeData } from "@/router/constants/routes";
|
||||||
import { isVerifiedInsurance } from "@/router/methods/helpers/requires-verified-redirect";
|
import { isVerifiedInsurance } from "@/router/methods/helpers/requires-verified-redirect";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
|
||||||
|
|
||||||
export async function vehicleBeforeEnter(to, from) {
|
export async function vehicleBeforeEnter(to, from) {
|
||||||
// If cookie indicates that vehicle has changed during insurance flow, reset parts info.
|
// If cookie indicates that vehicle has changed during insurance flow, reset parts info.
|
||||||
|
|
@ -12,6 +16,23 @@ export async function vehicleBeforeEnter(to, from) {
|
||||||
store.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
store.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is a zip querystring, consume & commit it here.
|
||||||
|
const newZipFromQuerystring = consumeQueryFromStash(queryStrings.ZIP_CODE);
|
||||||
|
if (newZipFromQuerystring) {
|
||||||
|
const zipData = await baseMixin.methods.getZipCodeData(
|
||||||
|
newZipFromQuerystring,
|
||||||
|
routeData.VEHICLE.name
|
||||||
|
);
|
||||||
|
|
||||||
|
if (zipData.isValid) {
|
||||||
|
store.dispatch(storeActions.SAVE_SERVICE_ZIP_CODE_INFO, {
|
||||||
|
zipCode: newZipFromQuerystring,
|
||||||
|
state: zipData.state.state,
|
||||||
|
zipCodeCtu: zipData.zipCodeCtu,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isVerifiedInsurance()) {
|
if (isVerifiedInsurance()) {
|
||||||
return {
|
return {
|
||||||
name: routeData.VEHICLE_DAMAGE.name,
|
name: routeData.VEHICLE_DAMAGE.name,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue