CSR-514 Fix experimentOrder
This commit is contained in:
parent
8964d6e1b0
commit
2167c240bb
3 changed files with 22 additions and 8 deletions
|
|
@ -18,6 +18,8 @@ export default {
|
||||||
if (endpoint.includes("/experiments/")) {
|
if (endpoint.includes("/experiments/")) {
|
||||||
cfDistroUrl = "https://localhost:44372";
|
cfDistroUrl = "https://localhost:44372";
|
||||||
}
|
}
|
||||||
|
else if (endpoint.includes("/order/"))
|
||||||
|
cfDistroUrl = "https://localhost:44346"
|
||||||
|
|
||||||
axios({ method: method, url: cfDistroUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {}, headers: headers })
|
axios({ method: method, url: cfDistroUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {}, headers: headers })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,14 @@ export async function loadOrderIfPresent() {
|
||||||
update the cookie.
|
update the cookie.
|
||||||
*/
|
*/
|
||||||
export async function saveOrder() {
|
export async function saveOrder() {
|
||||||
|
// TODO DELETE THIS, TEMP FOR TESTING
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RUN_EXPERIMENTS_FOR_TRIGGER, {
|
||||||
|
userId: "test",
|
||||||
|
triggerEvent: "test",
|
||||||
|
triggerValue: "test"
|
||||||
|
})
|
||||||
|
// END DELETE
|
||||||
|
|
||||||
var saveOrderPromise;
|
var saveOrderPromise;
|
||||||
if (store.getters.applicationUser.saveOrderPromise) {
|
if (store.getters.applicationUser.saveOrderPromise) {
|
||||||
// queue newest request after current saveOrderPromise resolves
|
// queue newest request after current saveOrderPromise resolves
|
||||||
|
|
|
||||||
|
|
@ -362,19 +362,23 @@ export const getters = {
|
||||||
serviceZipCode: state.order.serviceLocation.zipCode,
|
serviceZipCode: state.order.serviceLocation.zipCode,
|
||||||
parentAccountNumber: state.order.accountNumber,
|
parentAccountNumber: state.order.accountNumber,
|
||||||
isCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
isCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
||||||
orderPartNumbers: [...Object.values(state.order.lineItems.glassParts ?? []), ...Object.values(state.order.lineItems.otherParts ?? [])],
|
orderPartNumbers: [...testHelper(state.order.lineItems.glassParts, "partNumber"), ...testHelper(state.order.lineItems.otherParts, "partNumber")],
|
||||||
orderPartTypes: [...Object.keys(state.order.lineItems.glassParts ?? []), ...Object.keys(state.order.lineItems.otherParts ?? [])],
|
orderPartTypes: [...testHelper(state.order.lineItems.glassParts, "recalibrationType"), ...testHelper(state.order.lineItems.otherParts, "recalibrationType")],
|
||||||
hasRecalibrationPart: Object.values(state.order.lineItems.glassParts ?? []).filter(x => x.requiresRecalibration)?.length > 0,
|
hasRecalibrationPart: (state.order.lineItems.glassParts ?? []).filter(x => x.requiresRecalibration)?.length > 0,
|
||||||
selectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
selectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||||
selectedWindshieldGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.WINDSHIELD),
|
selectedWindshieldGlass: testHelper(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD),
|
||||||
selectedBackGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.REAR),
|
selectedBackGlass: testHelper(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.REAR),
|
||||||
selectedDriverSideGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.DRIVER),
|
selectedDriverSideGlass: testHelper(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.DRIVER),
|
||||||
selectedPassengerSideGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.PASSENGER)
|
selectedPassengerSideGlass: testHelper(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.PASSENGER)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
experimentSettings: (state) => state.applicationUser.experiments.map(x => x.settings).reduce((r, c) => Object.assign(r, c), {})
|
experimentSettings: (state) => state.applicationUser.experiments.map(x => x.settings).reduce((r, c) => Object.assign(r, c), {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testHelper(array, propertyName) {
|
||||||
|
return (array ?? []).map(x => x[propertyName]).filter(x => x);
|
||||||
|
}
|
||||||
|
|
||||||
// Export Actions
|
// Export Actions
|
||||||
export const actions = {
|
export const actions = {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue