/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */ import * as React from 'react' ; import * as OF from 'office-ui-fabric-react' ; import { FM } from '../react-intl-messages' ; import HelpIcon from '../components/HelpIcon' ; import { TipType } from '../components/ToolTips/ToolTips' ; import FormattedMessageId from '../components/FormattedMessageId' ; import * as CLM from '@conversationlearner/models' ; export function renderReplayError ( replayError ) { switch ( replayError . type ) { case CLM . ReplayErrorType . ActionUndefined : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_ACTION_UNDEFINED } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_ACTION_UNDEFINED } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . ActionStub : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_ACTION_STUB } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_ACTION_STUB } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . EntityEmpty : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_ENTITY_EMPTY } /> { ` "${ ( replayError as CLM . ReplayErrorEntityEmpty ) . values . join ( ", " ) }"` } < HelpIcon tipType = { TipType . REPLAYERROR_DESC_ENTITY_EMPTY } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . EntityUndefined : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_ENTITY_UNDEFINED } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_ENTITY_UNDEFINED } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . APIBadCard : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_API_BADCARD } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_API_BADCARD } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . APIMalformed : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_API_MALFORMED } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_API_MALFORMED } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . APIUndefined : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_API_UNDEFINED } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_API_UNDEFINED } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . APIException : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_API_EXCEPTION } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_API_EXCEPTION } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . APIPlaceholder : return ( < div className = "cl-editdialog-warning" data - testid = "dialog-modal-warning" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_API_PLACEHOLDER } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_API_PLACEHOLDER } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . EntityUnexpectedMultivalue : return ( < div className = "cl-editdialog-warning" data - testid = "dialog-modal-warning" > < div className = { OF . FontClassNames . mediumPlus } > < span > < FormattedMessageId id = { FM . REPLAYERROR_DESC_ENTITY_UNEXPECTED_MULTIVALUE } /> { `: "${ ( replayError as CLM . EntityUnexpectedMultivalue ) . entityName }"` } < /span> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_ENTITY_UNEXPECTED_MULTIVALUE } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . ActionUnavailable : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_ACTION_UNAVAILABLE } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_ACTION_UNAVAILABLE } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . ActionAfterWait : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_ACTION_AFTER_WAIT } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_ACTION_AFTER_WAIT } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . TwoUserInputs : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_TWO_USER_INPUTS } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_TWO_USER_INPUTS } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . InputAfterNonWait : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_INPUT_AFTER_NONWAIT } /> < HelpIcon tipType = { TipType . REPLAYERROR_DESC_INPUT_AFTER_NONWAIT } customClass = "cl-icon-redbackground" / > < /div> < /div>); case CLM . ReplayErrorType . Exception : return ( < div className = "cl-editdialog-error" > < div className = { OF . FontClassNames . mediumPlus } > < FormattedMessageId id = { FM . REPLAYERROR_DESC_EXCEPTION } /> < /div> < /div>); default : throw new Error ( `Unhandled ReplayErrorType case: ${ replayError . type }` ) ; } }