CSR-514 Fix experimentOrder
This commit is contained in:
parent
8964d6e1b0
commit
2167c240bb
3 changed files with 22 additions and 8 deletions
|
|
@ -18,7 +18,9 @@ export default {
|
|||
if (endpoint.includes("/experiments/")) {
|
||||
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 })
|
||||
.then((response) => {
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ export async function loadOrderIfPresent() {
|
|||
update the cookie.
|
||||
*/
|
||||
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;
|
||||
if (store.getters.applicationUser.saveOrderPromise) {
|
||||
// queue newest request after current saveOrderPromise resolves
|
||||
|
|
|
|||
|
|
@ -362,19 +362,23 @@ export const getters = {
|
|||
serviceZipCode: state.order.serviceLocation.zipCode,
|
||||
parentAccountNumber: state.order.accountNumber,
|
||||
isCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
|
||||
orderPartNumbers: [...Object.values(state.order.lineItems.glassParts ?? []), ...Object.values(state.order.lineItems.otherParts ?? [])],
|
||||
orderPartTypes: [...Object.keys(state.order.lineItems.glassParts ?? []), ...Object.keys(state.order.lineItems.otherParts ?? [])],
|
||||
hasRecalibrationPart: Object.values(state.order.lineItems.glassParts ?? []).filter(x => x.requiresRecalibration)?.length > 0,
|
||||
orderPartNumbers: [...testHelper(state.order.lineItems.glassParts, "partNumber"), ...testHelper(state.order.lineItems.otherParts, "partNumber")],
|
||||
orderPartTypes: [...testHelper(state.order.lineItems.glassParts, "recalibrationType"), ...testHelper(state.order.lineItems.otherParts, "recalibrationType")],
|
||||
hasRecalibrationPart: (state.order.lineItems.glassParts ?? []).filter(x => x.requiresRecalibration)?.length > 0,
|
||||
selectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||
selectedWindshieldGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.WINDSHIELD),
|
||||
selectedBackGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.REAR),
|
||||
selectedDriverSideGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.DRIVER),
|
||||
selectedPassengerSideGlass: (state.order.damage.glassToReplace ?? []).map(x => x.glassLocation).includes(damageLocationsSelected.PASSENGER)
|
||||
selectedWindshieldGlass: testHelper(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD),
|
||||
selectedBackGlass: testHelper(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.REAR),
|
||||
selectedDriverSideGlass: testHelper(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.DRIVER),
|
||||
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), {})
|
||||
}
|
||||
|
||||
function testHelper(array, propertyName) {
|
||||
return (array ?? []).map(x => x[propertyName]).filter(x => x);
|
||||
}
|
||||
|
||||
// Export Actions
|
||||
export const actions = {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue