diff --git a/origin-dapp/src/components/notification-message.js b/origin-dapp/src/components/notification-message.js index 580888ebcf25..59af3c2f2212 100644 --- a/origin-dapp/src/components/notification-message.js +++ b/origin-dapp/src/components/notification-message.js @@ -9,49 +9,77 @@ class NotificationMessage extends Component { constructor(props) { super(props) - this.intlMessages = defineMessages({ - offerMade: { - id: 'notification.offerMade', + const intlMessages = defineMessages({ + // + // Notifications received by the seller. + // + sellerOfferCreated: { + id: 'notification.sellerOfferCreated', defaultMessage: 'You have a new offer.' }, - offerAccepted: { - id: 'notification.purchaseSent', - defaultMessage: 'Your offer has been accepted.' + sellerOfferFinalized: { + id: 'notification.sellerOfferFinalized', + defaultMessage: 'Your transaction has been completed.' }, - saleConfirmed: { - id: 'notification.saleConfirmed', - defaultMessage: 'Your sale has been confirmed.' + sellerOfferDisputed: { + id: 'notification.sellerOfferDisputed', + defaultMessage: 'A problem has been reported with your transaction.' }, - sellerReviewed: { - id: 'notification.sellerReviewed', - defaultMessage: 'You have a new review.' + sellerOfferWithdrawn: { + id: 'notification.sellerOfferWithdrawn', + defaultMessage: 'An offer on your listing has been withdrawn.' + }, + sellerOfferRuling: { + id: 'notification.sellerOfferRuling', + defaultMessage: 'A ruling has been issued on your disputed transaction.' + }, + // + // Notifications received by the buyer. + // + buyerOfferAccepted: { + id: 'notification.buyerOfferAccepted', + defaultMessage: 'An offer you made has been accepted.' + }, + buyerOfferDisputed: { + id: 'notification.buyerOfferDisputed', + defaultMessage: 'A problem has been reported with your transaction.' + }, + buyerOfferRuling: { + id: 'notification.buyerOfferRuling', + defaultMessage: 'A ruling has been issued on your disputed transaction.' + }, + buyerOfferReview: { + id: 'notification.buyerOfferReview', + defaultMessage: 'A review has been left on your transaction.' + }, + buyerOfferWithdrawn: { + id: 'notification.buyerOfferWithdrawn', + defaultMessage: 'An offer you made has been rejected.' } + }) + + this.notificationTypeToMessage = { + 'seller_offer_created': intlMessages.sellerOfferCreated, + 'seller_offer_finalized': intlMessages.sellerOfferFinalized, + 'seller_offer_disputed': intlMessages.sellerOfferDisputed, + 'seller_offer_ruling': intlMessages.sellerOfferRuling, + 'seller_offer_withdrawn': intlMessages.sellerOfferWithdrawn, + 'buyer_offer_accepted': intlMessages.buyerOfferAccepted, + 'buyer_offer_disputed': intlMessages.sellerOfferDisputed, + 'buyer_offer_ruling': intlMessages.buyerOfferRuling, + 'buyer_offer_review': intlMessages.buyerOfferReview, + 'buyer_offer_withdrawn': intlMessages.buyerOfferWithdrawn, + } } render() { const { className, type } = this.props - let message - - switch (type) { - case 'buyer_review_received': - message = this.props.intl.formatMessage( - this.intlMessages.sellerReviewed - ) - break - case 'seller_review_received': - message = this.props.intl.formatMessage(this.intlMessages.saleConfirmed) - break - case 'buyer_listing_shipped': - message = this.props.intl.formatMessage(this.intlMessages.offerAccepted) - break - case 'seller_listing_purchased': - message = this.props.intl.formatMessage(this.intlMessages.offerMade) - break - default: + let message = this.notificationTypeToMessage[type] + if (!message) { return
{NON_PURCHASE_RELATED_MESSAGE}
} - + message = this.props.intl.formatMessage(message) return (