Merge pull request #8 from Safelite/feature/Digital/SSR-47
setting up initial Pinia store state.
This commit is contained in:
commit
2f9b193eb3
7 changed files with 59 additions and 171 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
const applicationConfig = {
|
const applicationConfig = {
|
||||||
CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT, // "Localhost", "Dev", "QA", and "Prod"
|
CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT, // "Localhost", "Dev", "QA", and "Prod"
|
||||||
|
CONSUMER_CF_DISTRO: process.env.VUE_APP_CONSUMER_CF_DISTRO,
|
||||||
APPLICATION_NAME: "SelfService",
|
APPLICATION_NAME: "SelfService",
|
||||||
SITE_ENTRY_TRIGGER_VALUE: "SelfService"
|
SITE_ENTRY_TRIGGER_VALUE: "SelfService"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,70 +7,10 @@ const endpoints = {
|
||||||
url: "/content/api/v1/content/HomepageInfo",
|
url: "/content/api/v1/content/HomepageInfo",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
GetVehicleYears: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/years",
|
|
||||||
method: "GET",
|
|
||||||
},
|
|
||||||
GetVehicleMakes: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/Makes",
|
|
||||||
method: "GET",
|
|
||||||
},
|
|
||||||
GetVehicleModels: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/Models",
|
|
||||||
method: "GET",
|
|
||||||
},
|
|
||||||
GetVehicleStyles: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/Styles",
|
|
||||||
method: "GET",
|
|
||||||
},
|
|
||||||
GetVehicle: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/lookup",
|
|
||||||
method: "GET",
|
|
||||||
},
|
|
||||||
GetDamageOptions: {
|
|
||||||
url: "/parts/api/v1/parts/damage-options",
|
|
||||||
method: "GET",
|
|
||||||
},
|
|
||||||
GetPageData: {
|
GetPageData: {
|
||||||
url: "/content/api/v1/content",
|
url: "/content/api/v1/content",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
LookupVehicleByYmms: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/Lookup",
|
|
||||||
method: "GET",
|
|
||||||
},
|
|
||||||
LookupVehicleByVin: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/Lookup",
|
|
||||||
method: "POST",
|
|
||||||
},
|
|
||||||
LookupVinByPlate: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/lookup-vin-by-plate",
|
|
||||||
method: "POST",
|
|
||||||
},
|
|
||||||
LookupVinByAddress: {
|
|
||||||
url: "/vehicle/api/v1/vehicle/lookup-vin-by-address",
|
|
||||||
method: "POST",
|
|
||||||
},
|
|
||||||
GetPartsOrQuestions: {
|
|
||||||
url: "/parts/api/v1/parts/parts-or-questions",
|
|
||||||
method: "POST",
|
|
||||||
},
|
|
||||||
GetParts: {
|
|
||||||
url: "/parts/api/v1/parts/parts",
|
|
||||||
method: "POST",
|
|
||||||
},
|
|
||||||
GetCapabilityQuestions: {
|
|
||||||
url: "/parts/api/v1/parts/capability-questions",
|
|
||||||
method: "GET"
|
|
||||||
},
|
|
||||||
GetPartFromCapabilityAnswer: {
|
|
||||||
url: "/parts/api/v1/parts/part-from-capability-answer",
|
|
||||||
method: "POST"
|
|
||||||
},
|
|
||||||
ValidateZip: {
|
|
||||||
url: "/location/api/v1/location/zip",
|
|
||||||
method: "GET",
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { endpoints };
|
export { endpoints };
|
||||||
|
|
|
||||||
|
|
@ -3,43 +3,6 @@ const storeActions = {
|
||||||
GET_ROUTE_INFO_ACTION: "getRouteInfo",
|
GET_ROUTE_INFO_ACTION: "getRouteInfo",
|
||||||
GET_HOMEPAGE_NAME: "getHomepageName",
|
GET_HOMEPAGE_NAME: "getHomepageName",
|
||||||
GET_PAGE_DATA: "getPageData",
|
GET_PAGE_DATA: "getPageData",
|
||||||
|
|
||||||
// Vehicle Actions
|
|
||||||
GET_VEHICLE_YEARS: "getVehicleYears",
|
|
||||||
GET_VEHICLE_MAKES: "getVehicleMakes",
|
|
||||||
GET_VEHICLE_MODELS: "getVehicleModels",
|
|
||||||
GET_VEHICLE_STYLES: "getVehicleStyles",
|
|
||||||
SET_VEHICLE: "setVehicle",
|
|
||||||
GET_DAMAGE_OPTIONS: "getDamageOptions",
|
|
||||||
GET_EVOX_IMAGE: "getEvoxImage",
|
|
||||||
|
|
||||||
// Lookup Actions
|
|
||||||
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
|
|
||||||
LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
|
|
||||||
LOOKUP_VIN_BY_PLATE: "lookupVinByPlate",
|
|
||||||
LOOKUP_VIN_BY_ADDRESS: "lookupVinByAddress",
|
|
||||||
|
|
||||||
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
|
||||||
GET_PARTS: "getParts",
|
|
||||||
GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions",
|
|
||||||
GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: "getPartFromCapabilityQuestionAnswer",
|
|
||||||
GET_MOLDING_QUESTIONS: "getMoldingQuestions",
|
|
||||||
VALIDATE_ZIP: "validateZip",
|
|
||||||
CLEAR_VIN: "clearVin",
|
|
||||||
|
|
||||||
// VEHICLE Actions
|
|
||||||
UPDATE_YEAR: "updateYear",
|
|
||||||
UPDATE_MAKE: "updateMake",
|
|
||||||
UPDATE_MODEL: "updateModel",
|
|
||||||
UPDATE_STYLE: "updateStyle",
|
|
||||||
UPDATE_CAR_ID: "updateCarId",
|
|
||||||
UPDATE_VEHICLE_CATEGORY: "updateVehicleCategory",
|
|
||||||
UPDATE_VEHICLE_IMAGE_URL: "updateVehicleImageUrl",
|
|
||||||
UPDATE_VEHICLE_IMAGE_VIF_NUMBER: "updateVehicleImageVifNumber",
|
|
||||||
UPDATE_VEHICLE_IMAGE_COLOR: "updateVehicleImageColor",
|
|
||||||
UPDATE_VEHICLE_VIN: "updateVehicleVin",
|
|
||||||
UPDATE_VEHICLE: "updateVehicle",
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { storeActions } from "@/constants/store-actions";
|
|
||||||
export default {
|
export default {
|
||||||
name: 'vehicle-make',
|
name: 'vehicle-make',
|
||||||
methods:
|
methods:
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,21 @@ import { useMainStore } from './store';
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
const vueApp = createApp(App);
|
const vueApp = createApp(App);
|
||||||
|
|
||||||
|
// Pinia
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
pinia.use(piniaPluginPersistedstate);
|
pinia.use(piniaPluginPersistedstate);
|
||||||
vueApp.use(pinia);
|
vueApp.use(pinia);
|
||||||
vueApp.config.globalProperties.$store = useMainStore();
|
vueApp.config.globalProperties.$store = useMainStore();
|
||||||
|
useMainStore().populateInitialState();
|
||||||
|
|
||||||
|
// Additional Vue items to setup
|
||||||
vueApp.mixin(baseMixin);
|
vueApp.mixin(baseMixin);
|
||||||
vueApp.use(router);
|
vueApp.use(router);
|
||||||
|
|
||||||
vueApp.mount("#app");
|
vueApp.mount("#app");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,80 +1,52 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { endpoints } from "@/constants/endpoints.js";
|
|
||||||
import globalMethods from "@/global-methods";
|
const storeId = 'main';
|
||||||
import { storeActions } from "@/constants/store-actions";
|
|
||||||
|
const getDefaultState = () => {
|
||||||
|
return {
|
||||||
|
order: {
|
||||||
|
vehicle: {
|
||||||
|
year: null,
|
||||||
|
make: null,
|
||||||
|
model: null,
|
||||||
|
style: null,
|
||||||
|
carId: null,
|
||||||
|
category: null,
|
||||||
|
vin: null,
|
||||||
|
imageUrl: null,
|
||||||
|
imageVifNumber: null,
|
||||||
|
imageColor: null,
|
||||||
|
registration: {
|
||||||
|
licensePlate: null,
|
||||||
|
address: null,
|
||||||
|
city: null,
|
||||||
|
state: null,
|
||||||
|
zipCode: null,
|
||||||
|
firstName: null,
|
||||||
|
lastName: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
referralNumber: null,
|
||||||
|
referralDate: null,
|
||||||
|
accountNumber: 0,
|
||||||
|
},
|
||||||
|
applicationUser: {
|
||||||
|
crmCustomerId: null,
|
||||||
|
lastPageVisited: null,
|
||||||
|
experiments: [],
|
||||||
|
triggeredSiteEntry: false
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const state = getDefaultState();
|
||||||
|
|
||||||
export const useMainStore = defineStore({
|
export const useMainStore = defineStore({
|
||||||
id: 'main',
|
id: storeId,
|
||||||
state() {
|
state: () => state,
|
||||||
return {
|
|
||||||
order: {
|
|
||||||
vehicle: {
|
|
||||||
year: null,
|
|
||||||
make: null,
|
|
||||||
model: null,
|
|
||||||
style: null,
|
|
||||||
carId: null,
|
|
||||||
category: null,
|
|
||||||
vin: null,
|
|
||||||
imageUrl: null,
|
|
||||||
imageVifNumber: null,
|
|
||||||
imageColor: null,
|
|
||||||
registration: {
|
|
||||||
licensePlate: null,
|
|
||||||
address: null,
|
|
||||||
city: null,
|
|
||||||
state: null,
|
|
||||||
zipCode: null,
|
|
||||||
firstName: null,
|
|
||||||
lastName: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
serviceLocation: {
|
|
||||||
address: null,
|
|
||||||
city: null,
|
|
||||||
state: null,
|
|
||||||
zipCode: null,
|
|
||||||
},
|
|
||||||
customer: {
|
|
||||||
emailAddress: null,
|
|
||||||
},
|
|
||||||
damage: {
|
|
||||||
isRepair: null,
|
|
||||||
numberOfChips: null,
|
|
||||||
glassToReplace: null,
|
|
||||||
partQuestionAnswers: null,
|
|
||||||
moldingQuestionAnswers: null,
|
|
||||||
capabilityQuestionAnswers: null
|
|
||||||
},
|
|
||||||
lineItems: {
|
|
||||||
glassParts: null
|
|
||||||
},
|
|
||||||
payment: {
|
|
||||||
isInsurance: null,
|
|
||||||
insuranceCoverage: {
|
|
||||||
isVerified: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
referralNumber: null,
|
|
||||||
referralDate: null,
|
|
||||||
referralCorrelationId: null,
|
|
||||||
accountNumber: 0,
|
|
||||||
eon: null
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
getters: {},
|
getters: {},
|
||||||
actions:
|
actions:
|
||||||
{
|
{
|
||||||
updateYear(year) {
|
|
||||||
this.order.vehicle.year = year;
|
|
||||||
},
|
|
||||||
updateMake(make) {
|
|
||||||
this.order.vehicle.make = make;
|
|
||||||
},
|
|
||||||
updateModel(model) {
|
|
||||||
this.order.vehicle.model = model;
|
|
||||||
},
|
|
||||||
// Vehicle
|
// Vehicle
|
||||||
saveVehicleYear(year)
|
saveVehicleYear(year)
|
||||||
{
|
{
|
||||||
|
|
@ -82,6 +54,12 @@ export const useMainStore = defineStore({
|
||||||
this.updateYear(year);
|
this.updateYear(year);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
populateInitialState()
|
||||||
|
{
|
||||||
|
if(!localStorage.getItem(storeId)) {
|
||||||
|
this.$state = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
persist: true
|
persist: true
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
process.env.VUE_APP_CONSUMER_CF_DISTRO =
|
process.env.VUE_APP_CONSUMER_CF_DISTRO ="https://digitalapi.dev.sagaws.net";
|
||||||
"https://consumerapidev.safelite.com";
|
|
||||||
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost";
|
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost";
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue