<template>
    <reviewBlock :customHeaderText="header" :content="displayContent" @edit-clicked="editClicked" />
</template>

<script>
import reviewBlock from "@/layouts/payment-method/review-dropdown/review-block/review-block";

export default {
    name: "customer-review",
    props: {
        cmsWidgetName: String,
        customer: Object,
    },
    data() {
        return {};
    },
    methods: {
        editClicked() {
            this.$emit("edit-clicked");
        },
    },
    computed: {
        displayContent() {
            return [this.fullName, this.email, this.phoneNumber, this.smsOptIn];
        },
        header() {
            return this.getCmsContent(this.cmsWidgetName, "HeaderText");
        },
        fullName() {
            return `${this.customer?.firstName} ${this.customer?.lastName}`;
        },
        email() {
            return this.customer?.emailAddress;
        },
        phoneNumber() {
            return this.customer?.phoneNumber;
        },
        smsOptIn() {
            return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
        },
    },
    components: {
        reviewBlock,
    },
};
</script>
