CSR-1994
This commit is contained in:
parent
caeca9bbef
commit
2833666a34
7 changed files with 68 additions and 4 deletions
|
|
@ -72,6 +72,10 @@ const endpoints = {
|
|||
url: "/parts/api/v1/parts/mobile-fee",
|
||||
method: "GET",
|
||||
},
|
||||
CashServicePackageDiscount: {
|
||||
url: "/parts/api/v1/parts/service-package-discount",
|
||||
method: "POST",
|
||||
},
|
||||
GetServiceabilityDetails: {
|
||||
url: "/location/api/v1/location/serviceability-details",
|
||||
method: "GET",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ const experimentSettings = {
|
|||
PIA_INSURANCE: "DisplayPIAInsurance",
|
||||
SUBMIT_ORDER_ENABLE_PIA: "SubmitOrder_Enable_PIA",
|
||||
IS_EMAIL_OPTIONAL: "isEmailOptional",
|
||||
SERVICE_PACKAGE_DISCOUNT: "OfferServicePackageDiscount",
|
||||
};
|
||||
|
||||
const experimentTriggers = {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ const storeActions = {
|
|||
GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: "getPartFromCapabilityQuestionAnswer",
|
||||
GET_MOLDING_QUESTIONS: "getMoldingQuestions",
|
||||
GET_MOBILE_FEE_PART: "getMobileFeePart",
|
||||
CASH_SERVICE_PACKAGE_DISCOUNT: "cashServicePackageDiscount",
|
||||
GET_SERVICEABILITY_DETAILS: "getServiceabilityDetails",
|
||||
GET_SHOP_TIME_SLOTS: "getShopTimeSlots",
|
||||
GET_MOBILE_TIME_SLOTS: "getMobileTimeSlots",
|
||||
|
|
|
|||
|
|
@ -28,8 +28,10 @@
|
|||
groupName="ServicePackageQuestion"
|
||||
:availableLineItems="availableLineItems"
|
||||
:isInsuranceSelected="isInsuranceSelected"
|
||||
:isDiscount="getServicePackageDiscount"
|
||||
@vapsItemsSelected="vapsItemsSelectedAction"
|
||||
:activePromos="lineItems.promos"
|
||||
:lineItems="lineItems"
|
||||
v-on="{ 'buttonEvent.openModal': openModalAction }"
|
||||
validationRules="option-required"
|
||||
isRequired />
|
||||
|
|
@ -105,6 +107,7 @@ import {
|
|||
import { queryStrings } from "@/constants/query-strings";
|
||||
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||
import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question";
|
||||
import { experimentSettings } from "@/constants/experiments";
|
||||
|
||||
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||
|
||||
|
|
@ -126,6 +129,11 @@ export default {
|
|||
null,
|
||||
"quote"
|
||||
);
|
||||
const servicePackageDiscountPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.CASH_SERVICE_PACKAGE_DISCOUNT,
|
||||
null,
|
||||
"quote"
|
||||
);
|
||||
const supportingItemsPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.GET_SUPPORTING_ITEMS,
|
||||
null,
|
||||
|
|
@ -145,6 +153,10 @@ export default {
|
|||
resultKey: "rainDefense",
|
||||
promise: rainDefensePromise,
|
||||
},
|
||||
{
|
||||
resultKey: "servicePackageDiscount",
|
||||
promise: servicePackageDiscountPromise,
|
||||
},
|
||||
{
|
||||
resultKey: "supportingItems",
|
||||
promise: supportingItemsPromise,
|
||||
|
|
@ -155,9 +167,13 @@ export default {
|
|||
const lineItems = deepClone(store.getters.order.lineItems);
|
||||
lineItems.vaps = lineItems.vaps ?? [];
|
||||
const nullSafeGlassParts = lineItems.glassParts ?? [];
|
||||
lineItems.supportingItems = [
|
||||
...resultMap.supportingItems,
|
||||
resultMap.servicePackageDiscount,
|
||||
];
|
||||
const availableLineItems = [
|
||||
resultMap.rainDefense,
|
||||
...resultMap.supportingItems,
|
||||
...lineItems.supportingItems,
|
||||
...resultMap.wipers,
|
||||
...nullSafeGlassParts,
|
||||
];
|
||||
|
|
@ -170,13 +186,12 @@ export default {
|
|||
"quote",
|
||||
false
|
||||
);
|
||||
|
||||
baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
resultMap.supportingItems,
|
||||
lineItems.supportingItems,
|
||||
false
|
||||
);
|
||||
lineItems.supportingItems = resultMap.supportingItems;
|
||||
|
||||
const addableVaps = [...resultMap.wipers, resultMap.rainDefense];
|
||||
|
||||
// Promo logic
|
||||
|
|
@ -236,6 +251,12 @@ export default {
|
|||
lineItemsCloneForWatcher() {
|
||||
return Object.assign({}, this.lineItems);
|
||||
},
|
||||
getServicePackageDiscount() {
|
||||
const isServicePackageDiscount = this.getSettingValue(
|
||||
experimentSettings.SERVICE_PACKAGE_DISCOUNT
|
||||
);
|
||||
return isServicePackageDiscount === "True";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openModalAction(modalName) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ export default {
|
|||
isRequired: Boolean,
|
||||
isInsuranceSelected: Boolean,
|
||||
availableLineItems: null,
|
||||
lineItems: null,
|
||||
isDiscount: Boolean,
|
||||
activePromos: null,
|
||||
},
|
||||
data() {
|
||||
|
|
@ -103,6 +105,7 @@ export default {
|
|||
buttonFooterCopy: this.getFooterTextFromCms(answer.SubWidgetName),
|
||||
additionalButtonData: {
|
||||
strikeThroughPrice: this.getPackagePriceString(answer.Name),
|
||||
discountedPrice: this.getServicePackageDiscount(),
|
||||
},
|
||||
}));
|
||||
return modifiedAnswers;
|
||||
|
|
@ -224,6 +227,17 @@ export default {
|
|||
|
||||
return price;
|
||||
},
|
||||
// getServicePackageDiscountPrice(packageName, packageDiscount = false) {
|
||||
// let price = 0;
|
||||
// const discount = this.getDiscountedPackagePrice(packageName);
|
||||
// if (packageDiscount) {
|
||||
// price += baseMixin.methods.getTotalLineItemPrice(discount);
|
||||
// }
|
||||
// return price;
|
||||
// },
|
||||
getServicePackageDiscount() {
|
||||
if (!this.isInsuranceSelected && this.isDiscount) return true;
|
||||
},
|
||||
selectDefaultPackage() {
|
||||
const promosWithAddableVaps = getPromosWithAddableVaps(this.activePromos);
|
||||
const vapsThatMatchPromos = getLineItemsThatMatchPromos(
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@
|
|||
v-if="this.buttonFooterCopy"
|
||||
v-html="this.buttonFooterCopy"></div>
|
||||
</div>
|
||||
<span class="alert-success" v-if="this.additionalButtonData.discountedPrice"
|
||||
>Special: Save $ {{
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</baseInputButton>
|
||||
|
|
|
|||
|
|
@ -1391,6 +1391,26 @@ export const actions = {
|
|||
pageNameToLog: pageNameToLog,
|
||||
});
|
||||
},
|
||||
cashServicePackageDiscount(context, { pageNameToLog }) {
|
||||
const damage = context.getters.damage;
|
||||
const damageType = damage.isRepair ? "Repair" : "Replace";
|
||||
const glassPieces = convertGlassPieceNamingForApi(damage.glassToReplace);
|
||||
|
||||
return globalMethods
|
||||
.callHttpClient({
|
||||
method: endpoints.CashServicePackageDiscount.method,
|
||||
endpoint: endpoints.CashServicePackageDiscount.url,
|
||||
payload: {
|
||||
glassPieces: glassPieces,
|
||||
damageType: damageType,
|
||||
},
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
})
|
||||
.then((response) => {
|
||||
return response;
|
||||
});
|
||||
},
|
||||
|
||||
getServiceabilityDetails(context, { payload: { serviceZipCode }, pageNameToLog }) {
|
||||
const lineItemsWithOnlyPartNumbers = context.getters.order.lineItems.supportingItems?.map(
|
||||
|
|
|
|||
Loading…
Reference in a new issue