{"version":3,"file":"EndPollAlert.mjs","names":[],"sources":["../../../../../src/components/Poll/PollActions/EndPollAlert.tsx"],"sourcesContent":["import React from 'react';\nimport { Alert } from '../../Dialog';\nimport { useModalContext, usePollContext, useTranslationContext } from '../../../context';\nimport { Button } from '../../Button';\nimport { useNotificationApi } from '../../Notifications';\n\nexport const EndPollAlert = () => {\n  const { addNotification } = useNotificationApi();\n  const { t } = useTranslationContext();\n  const { poll } = usePollContext();\n  const { close } = useModalContext();\n\n  return (\n    <Alert.Root className={'str-chat__end-poll-alert'}>\n      <Alert.Header\n        description={t(\n          'poll.endPollAlert.description',\n          'Do you want to end this poll now? Nobody will be able to vote in this poll anymore.',\n        )}\n        title={t('poll.endPollAlert.endPoll.title', 'End this Poll?')}\n      ></Alert.Header>\n      <Alert.Actions>\n        <Button\n          appearance='outline'\n          className='str-chat__end-poll-alert__end-vote-button'\n          data-testid='end-poll-alert-end-vote-button'\n          onClick={async () => {\n            try {\n              await poll.close();\n              close();\n              addNotification({\n                emitter: 'EndPollAlert',\n                message: t('notification.pollEndSuccess', 'Poll Ended'),\n                severity: 'success',\n                type: 'api:poll:end:success',\n              });\n            } catch (e) {\n              addNotification({\n                emitter: 'EndPollAlert',\n                error: e instanceof Error ? e : undefined,\n                message: t('notification.pollEndFailed', 'Failed to end the poll'),\n                severity: 'error',\n                type: 'api:poll:end:failed',\n              });\n            }\n          }}\n          size='md'\n          variant='danger'\n        >\n          {t('poll.endPollAlert.endPoll.text', 'End Poll')}\n        </Button>\n        <Button\n          appearance='outline'\n          className='str-chat__end-poll-alert__cancel-button'\n          data-testid='end-poll-alert-cancel-button'\n          onClick={close}\n          size='md'\n          variant='secondary'\n        >\n          {t('common.cancel.label', 'Cancel')}\n        </Button>\n      </Alert.Actions>\n    </Alert.Root>\n  );\n};\n"],"mappings":";;;;;;;;;AAMA,IAAa,qBAAqB;CAChC,MAAM,EAAE,oBAAoB,mBAAmB;CAC/C,MAAM,EAAE,MAAM,sBAAsB;CACpC,MAAM,EAAE,SAAS,eAAe;CAChC,MAAM,EAAE,UAAU,gBAAgB;CAElC,OACE,qBAAC,MAAM,MAAP;EAAY,WAAW;YAAvB,CACE,oBAAC,MAAM,QAAP;GACE,aAAa,EACX,iCACA,qFACF;GACA,OAAO,EAAE,mCAAmC,gBAAgB;EAC/C,CAAA,GACf,qBAAC,MAAM,SAAP,EAAA,UAAA,CACE,oBAAC,QAAD;GACE,YAAW;GACX,WAAU;GACV,eAAY;GACZ,SAAS,YAAY;IACnB,IAAI;KACF,MAAM,KAAK,MAAM;KACjB,MAAM;KACN,gBAAgB;MACd,SAAS;MACT,SAAS,EAAE,+BAA+B,YAAY;MACtD,UAAU;MACV,MAAM;KACR,CAAC;IACH,SAAS,GAAG;KACV,gBAAgB;MACd,SAAS;MACT,OAAO,aAAa,QAAQ,IAAI,KAAA;MAChC,SAAS,EAAE,8BAA8B,wBAAwB;MACjE,UAAU;MACV,MAAM;KACR,CAAC;IACH;GACF;GACA,MAAK;GACL,SAAQ;aAEP,EAAE,kCAAkC,UAAU;EACzC,CAAA,GACR,oBAAC,QAAD;GACE,YAAW;GACX,WAAU;GACV,eAAY;GACZ,SAAS;GACT,MAAK;GACL,SAAQ;aAEP,EAAE,uBAAuB,QAAQ;EAC5B,CAAA,CACK,EAAA,CAAA,CACL;;AAEhB"}