Merge branch 'develop' into feature/CSR-1072

This commit is contained in:
CarlNation 2024-03-01 15:41:43 -05:00
commit 5733ae6b82
5 changed files with 21 additions and 24 deletions

View file

@ -103,7 +103,7 @@
ref="promoModalQuestion" ref="promoModalQuestion"
class="small mt-4" class="small mt-4"
v-model="lineItems" v-model="lineItems"
@addedPromo="handleAddedPromo" emitToGrandparent="true"
:availableVaps="availableVaps" :availableVaps="availableVaps"
modalWidgetName="PromoModalWidget" /> modalWidgetName="PromoModalWidget" />
</div> </div>
@ -245,10 +245,6 @@ export default {
} }
return []; return [];
}, },
handleAddedPromo(lineItems) {
// NOTE: these lineItems are passed from promo-modal-question
this.$emit("update:modelValue", lineItems);
},
}, },
computed: { computed: {
screenReaderTotalAmountDueText() { screenReaderTotalAmountDueText() {

View file

@ -106,6 +106,11 @@ export default {
required: false, required: false,
default: true, default: true,
}, },
emitToGrandparent: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
promoLinkText() { promoLinkText() {
@ -175,6 +180,7 @@ export default {
}, },
onModalClosed() { onModalClosed() {
this.resetAlerts(); this.resetAlerts();
if (this.emitToGrandparent) this.$parent.$emit("update:modelValue", this.lineItems);
this.$emit("update:modelValue", this.lineItems); this.$emit("update:modelValue", this.lineItems);
this.promoCode = ""; this.promoCode = "";
this.modal.resetForm(); this.modal.resetForm();
@ -304,7 +310,6 @@ export default {
this.lineItems.vaps?.push(...getVaps); this.lineItems.vaps?.push(...getVaps);
} }
this.lineItems?.promos.push(...promoCodeData.promoCode); this.lineItems?.promos.push(...promoCodeData.promoCode);
this.$emit("added-promo", this.lineItems);
this.closeModal(); this.closeModal();
} else { } else {
this.getErrorMessage(promoCodeData.errorCode, promoCodeData.additionalInfo); this.getErrorMessage(promoCodeData.errorCode, promoCodeData.additionalInfo);

View file

@ -331,10 +331,10 @@ export function getNewlyInactivatedPromos(oldInactivePromos, newInactivePromos)
export function createPromoSuccessAlert(promoCode) { export function createPromoSuccessAlert(promoCode) {
return { return {
messageHeadline: "Promo applied!", messageHeadline: "Promo code applied!",
messageCopy: `Promo "${getPromoCodeWithoutBundleIdentifier( messageCopy: `Promo code ${getPromoCodeWithoutBundleIdentifier(
promoCode.toUpperCase() promoCode.toUpperCase()
)}" was successfully applied to your cart.`, )} was successfully applied to your cart.`,
type: "alert-success", type: "alert-success",
isDismissible: true, isDismissible: true,
shouldAutoFade: true, shouldAutoFade: true,
@ -343,19 +343,19 @@ export function createPromoSuccessAlert(promoCode) {
export function createPromoErrorAlert(promoCode, errorCode = null, additionalInfo) { export function createPromoErrorAlert(promoCode, errorCode = null, additionalInfo) {
const alert = { const alert = {
messageHeadline: "Promo error", messageHeadline: "Promo code error",
type: "alert-danger", type: "alert-danger",
shouldAutoFade: false, shouldAutoFade: false,
isDismissible: true, isDismissible: true,
}; };
if (stackingPromoErrorCodes.includes(errorCode)) { if (stackingPromoErrorCodes.includes(errorCode)) {
alert.messageCopy = `Sorry, promo code "${getPromoCodeWithoutBundleIdentifier( alert.messageCopy = `Sorry, promo code ${getPromoCodeWithoutBundleIdentifier(
promoCode.toUpperCase() promoCode.toUpperCase()
)}" cannot be combined with "${additionalInfo[0].toUpperCase()}"`; )} cannot be combined with ${additionalInfo[0].toUpperCase()}`;
} else { } else {
alert.messageCopy = `Sorry, promo code "${getPromoCodeWithoutBundleIdentifier( alert.messageCopy = `Sorry, promo code ${getPromoCodeWithoutBundleIdentifier(
promoCode.toUpperCase() promoCode.toUpperCase()
)}" is not valid`; )} is not valid`;
} }
return alert; return alert;
} }

View file

@ -95,19 +95,14 @@ export default {
}, },
tintSelectionOptions() { tintSelectionOptions() {
let tintOptions = []; const tintOptions = Object.keys(this.featureListData).map((tintOption) => {
const buttonImage = this.getTintSourceImage(this.glassLocation, tintOption);
Object.keys(this.featureListData).forEach((tintOption) => { return {
tintOptions.push({
value: tintOption, value: tintOption,
buttonLabel: tintOption, buttonLabel: tintOption,
buttonImage: require(`@/assets/img/tints/${this.getTintSourceImage( buttonImage: buttonImage ? require(`@/assets/img/tints/${buttonImage}`) : null,
this.glassLocation, };
tintOption
)}`),
});
}); });
return tintOptions; return tintOptions;
}, },

View file

@ -10,6 +10,7 @@
class="d-flex w-100 align-items-center px-2 h-100 list-card-content button-content rounded-3" class="d-flex w-100 align-items-center px-2 h-100 list-card-content button-content rounded-3"
:class="labelClasses"> :class="labelClasses">
<img <img
v-if="buttonImage"
:id="buttonImageId" :id="buttonImageId"
:class="!isWide ? 'order-1' : 'ms-auto order-3'" :class="!isWide ? 'order-1' : 'ms-auto order-3'"
:src="buttonImage" :src="buttonImage"