diff --git a/jest.config.js b/jest.config.js
index 8962dfa67..6703eb608 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -28,13 +28,13 @@ module.exports = {
"!src/layouts/insurance/*.vue", // Temp test exclusion while in development
"!src/layouts/insurance-company/*.vue", // Temp test exclusion while in development
"!src/layouts/insurance-company/insurance-company-question/*.vue", // Temp test exclusion while in development
- "!src/experiment-components/.vue",
+ "!src/experiment-components/*.vue",
// END
], // ! means exclude from coverage.
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
coverageThreshold: {
global: {
- statements: 75,
+ statements: 74,
},
},
// Uncomment this to avoid the massive amount of warnings we are getting for onSubmit and onInvalidSubmit
diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js
index 4750f1641..187d0c3e6 100644
--- a/src/constants/store-actions.js
+++ b/src/constants/store-actions.js
@@ -107,6 +107,7 @@ const storeActions = {
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
+ ADD_DONATION_TO_SUBMITTED_ORDER: "addDonationToSubmittedOrder",
RESET_EXTERNAL_PARAMETER_STATE: "resetExternalParameterState",
UPDATE_EXTERNAL_PARAMETER_MMS: "updateExternalParameterMMS",
diff --git a/src/experiment-components/donation-block.vue b/src/experiment-components/donation-block.vue
new file mode 100644
index 000000000..211cc3e28
--- /dev/null
+++ b/src/experiment-components/donation-block.vue
@@ -0,0 +1,274 @@
+
+
+
+
+
+
+
diff --git a/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue b/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue
index c6e31b781..3628a372c 100644
--- a/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue
+++ b/src/fmg-components/save-progress-modal-question/save-progress-modal-question.vue
@@ -149,6 +149,21 @@ export default {
transition: all 150ms linear;
background: none;
+ &.btn {
+ &.btn-secondary {
+ font-weight: 900;
+ border: none;
+ &:hover,
+ &:active,
+ &:focus,
+ &:focus-visible {
+ color: $blue-700;
+ background: none;
+ box-shadow: none;
+ }
+ }
+ }
+
&:hover,
&:active,
&:focus,
@@ -166,6 +181,7 @@ export default {
transition: background 0s 0s ease-in-out;
}
}
+
.modal.modal-component .modal-dialog .modal-content {
.modal-header {
padding-top: 0;
diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue
index 804ed5608..b839ae1ad 100644
--- a/src/layouts/confirmation/confirmation.vue
+++ b/src/layouts/confirmation/confirmation.vue
@@ -64,6 +64,19 @@
:isItac="isItac"
:isNoComp="isNoComp" />
+
+
+
+
+
+
@@ -108,6 +121,7 @@ import experimentMixin from "@/mixins/experiment-mixin.js";
import { partTypeStrings } from "@/constants/part-type-strings";
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
import { containsRecalParts } from "@/helpers/recal-helper.js";
+import donationBlock from "@/experiment-components/donation-block.vue";
export default {
name: "confirmation",
@@ -204,6 +218,11 @@ export default {
return hasRecalPriceRemoveExperiment && isRecalibrationOnOrder;
};
+ const donationItems = lineItemsFromSubmittedOrder.supportingItems?.filter(
+ (item) => item.partNumber === "DONATION"
+ );
+ const donationAmount = donationItems?.length > 0 ? donationItems[0].sellingPrice : 0;
+
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
@@ -211,6 +230,7 @@ export default {
vm.vaps = availableVaps;
vm.submittedOrder = submittedOrder;
vm.shouldHideRecalibration = shouldHideRecalibration();
+ vm.donationAmount = donationAmount;
});
},
data() {
@@ -219,6 +239,9 @@ export default {
vaps: [],
submittedOrder: null,
shouldHideRecalibration: null,
+ donationAmount: 0,
+ showDonationSuccess: null,
+ showDonationError: null,
};
},
computed: {
@@ -447,6 +470,9 @@ export default {
);
}
},
+ donationValues() {
+ return [1, 3, 5];
+ },
},
methods: {
arePagePrerequisitesValid() {
@@ -489,6 +515,56 @@ export default {
forwardButtonAction() {
window.location.assign(location.protocol + "//" + location.host);
},
+ async addDonation(amount, plateTemp) {
+ // try to call API to add donation to order
+
+ // TEMP DUMMY CALL TO SIMULATE SUCCESS OR ERROR FROM API CALL
+ // TO BE REPLACED BY REAL CALL LATER
+ const donationResponse = await this.dispatchStoreActionWithLogging(
+ storeActions.LOOKUP_VIN_BY_PLATE,
+ { licensePlate: plateTemp, licenseState: "OH" },
+ "test",
+ false
+ ).catch((error) => {
+ // this.$refs.navbar.removeLoader();
+ console.error("Error!!! error: ", error);
+ return error;
+ });
+
+ console.log("ran addDonation()... (*fake call*) donationResponse: ", donationResponse);
+
+ if (donationResponse?.status == "200") {
+ this.showDonationSuccess = true;
+ this.showDonationError = false;
+ const donationResponse = await baseMixin.methods.dispatchStoreAction(
+ storeActions.ADD_DONATION_TO_SUBMITTED_ORDER,
+ amount,
+ false
+ );
+ } else {
+ this.showDonationError = true;
+ this.showDonationSuccess = false;
+ const donationResponse = await baseMixin.methods.dispatchStoreAction(
+ storeActions.ADD_DONATION_TO_SUBMITTED_ORDER,
+ 0,
+ false
+ );
+ }
+ },
+ },
+ watch: {
+ donationAmount(newValue) {
+ newValue = parseInt(newValue);
+ console.log("WATCHED donationAmount changed: ", newValue);
+
+ // this.addDonation(newValue);
+ // TODO - when backend code is final, then remove the below and restore the line above
+ if (newValue === 5) {
+ this.addDonation(newValue, "FAILING_PLATE"); // throws error
+ } else {
+ this.addDonation(newValue, "2fast"); // should give successful response
+ }
+ },
},
components: {
funnelHeader,
@@ -497,6 +573,7 @@ export default {
addToCalendar,
cart,
textBlock,
+ donationBlock,
},
};
diff --git a/src/store/index.js b/src/store/index.js
index 7a1f74732..6234f7b1a 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -12,6 +12,7 @@ import { singleWindshieldCarIds } from "@/constants/single-windshield-carids";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper.js";
import { deepEqual } from "@/helpers/object-helper";
+import baseMixin from "@/mixins/base-mixin.js";
import {
AppointmentTypeStrings,
PREMIUM_FEE_PART_TYPE,
@@ -525,6 +526,7 @@ export const mutations = {
},
resetExternalParameterQuoteState(state) {
externalParameterState.quote.servicePackage = null;
+ externalParameterState.quote.isInsurance = null;
saveExternalParameterState(externalParameterState);
},
resetIsExternalParameter(state) {
@@ -3165,6 +3167,42 @@ export const actions = {
context.commit(storeMutations.UPDATE_AFFILIATE_COOKIES, affiliateCookies);
},
+ addDonationToSubmittedOrder(context, donationAmount) {
+ console.log("running addDonationToSubmittedOrder()... donationAmount: ", donationAmount);
+
+ const submittedOrder = deepClone(baseMixin.methods.getSubmittedOrder());
+
+ if (donationAmount > 0) {
+ console.log(
+ "running addDonationToSubmittedOrder()... adding donation to supportingItems in session storage "
+ );
+ submittedOrder.lineItems.supportingItems.push({
+ partNumber: "DONATION",
+ description: null,
+ partType: "DONATION",
+ isInsurable: false,
+ isChildPart: false,
+ laborAmount: 0,
+ sellingPrice: donationAmount,
+ kitPrice: 0,
+ salesTax: null,
+ id: "donation-" + donationAmount,
+ });
+ } else {
+ // filter out all donations
+ console.log(
+ "running addDonationToSubmittedOrder()... removing all donation items in supportingItems in session storage "
+ );
+
+ const nonDonationItems = submittedOrder.lineItems.supportingItems.filter((item) => {
+ return item.partType !== "DONATION";
+ });
+ submittedOrder.lineItems.supportingItems = nonDonationItems;
+ }
+ // set to local storage
+ window.sessionStorage.setItem("submittedOrder", JSON.stringify(submittedOrder));
+ },
+
resetSubmittedOrder(context) {
// clear from local storage
window.sessionStorage.removeItem("submittedOrder");
diff --git a/src/ux-components/button-main/button-main.vue b/src/ux-components/button-main/button-main.vue
index 7980adf99..982e7bb1b 100644
--- a/src/ux-components/button-main/button-main.vue
+++ b/src/ux-components/button-main/button-main.vue
@@ -156,5 +156,48 @@ export default {
transition: background 0s 0s ease-in-out;
}
}
+ &.btn-success {
+ position: relative;
+ background: $green-100;
+ border: 1px solid $green-400;
+ border-radius: $border-radius-lg;
+ color: $black;
+ font-weight: 500;
+ transition: all 150ms linear;
+ height: 3rem;
+ &:hover {
+ color: $black;
+ background: $green-200;
+ }
+ &:focus, // Mouse, touch, stylus focus
+ &:focus-visible {
+ // Keyboard focus for accessibility
+ outline: none;
+ box-shadow:
+ 0 0 0 3px $white,
+ 0 0 0 5.5px $green-400;
+ color: $black;
+ background: $green-100;
+ }
+ &:disabled {
+ background: transparent;
+ color: $gray-550 !important;
+ font-weight: 400;
+ height: 48px;
+ border: 1px solid $gray-550;
+ border-radius: $border-radius-lg;
+ cursor: pointer;
+ pointer-events: all;
+ }
+ &.has-loader {
+ color: $white;
+ @include blue-gradient;
+ pointer-events: none;
+ }
+ &.delay {
+ // fixes flicker while transitioning between states
+ transition: background 0s 0s ease-in-out;
+ }
+ }
}