// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 import React, { useState, useEffect } from 'react'; import { Modal, ModalHeader, ModalBody, ModalButtonGroup, ModalButton, } from 'amazon-chime-sdk-component-library-react'; import ContactPicker from '../ContactPicker'; import { listChannelFlows, associateChannelFlow } from '../../api/ChimeAPI'; import './ChannelModals.css'; import appConfig from "../../Config"; export const ManageChannelFlowModal = ({ onClose, channel, handlePickerChange, onSubmit, channelFlow }) => { const [channelFlowList, setChannelFlowList] = useState([]); useEffect(() => { getAllChannelFlows(); }, []); const getAllChannelFlows = async () => { let flows = []; try { flows = await listChannelFlows(appConfig.appInstanceArn); } catch (err) { console.error('ERROR', err); } const flowList = flows.map(flow => { return { label: flow.Name, value: flow.ChannelFlowArn }; }); if (channelFlow !== null && Object.keys(channelFlow).length !== 0) { flowList.splice(0, 0, { label: 'None', value: 'None' }); } setChannelFlowList(flowList); }; return (
Current Flow
{channel.ChannelFlowArn == null ? None : {channelFlow.Name} (adding a new flow will replace the current one) }
, , ]} />
); }; export default ManageChannelFlowModal;