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