UNPKG

@unito/integration-debugger

Version:

The Unito Integration Debugger

33 lines (32 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const store_1 = require("../../store"); const styles_1 = require("../../styles"); const SetApiKey = (props) => { const configuration = (0, store_1.useConfigurationState)(); const inputRef = (0, react_1.useRef)(null); (0, react_1.useEffect)(() => { if (inputRef.current) { inputRef.current.focus(); inputRef.current.setValue(configuration.apiKey ?? ''); inputRef.current.key(['escape'], function () { props.close(); }); inputRef.current.on('submit', apiKey => { configuration.apiKey = apiKey; configuration.integrationId = undefined; configuration.credentialId = undefined; props.close(); }); } return () => { if (inputRef.current) { inputRef.current.free(); } }; }, [inputRef]); return ((0, jsx_runtime_1.jsx)("box", { label: (0, styles_1.paneTitle)('set your API key'), top: "center", left: "center", width: 60, height: 3, border: styles_1.paneBorder, style: styles_1.pane, children: (0, jsx_runtime_1.jsx)("textbox", { ref: inputRef, keys: true, inputOnFocus: true }) })); }; exports.default = SetApiKey;