@unito/integration-debugger
Version:
The Unito Integration Debugger
45 lines (44 loc) • 2.15 kB
JavaScript
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 configuration_1 = require("../../resources/configuration");
const styles_1 = require("../../styles");
const ChooseEnvironment = (props) => {
const listRef = (0, react_1.useRef)(null);
const configuration = (0, store_1.useConfigurationState)();
(0, react_1.useEffect)(() => {
if (listRef.current) {
listRef.current.focus();
listRef.current.key(['escape'], function () {
props.close();
});
listRef.current.on('select', (_list, index) => {
configuration.environment = Object.values(configuration_1.Environment).at(index) ?? configuration_1.Environment.None;
configuration.integrationUrl = undefined;
configuration.graphRelativeUrl = undefined;
configuration.credentialAccountRelativeUrl = undefined;
configuration.webhookParsingRelativeUrl = undefined;
configuration.webhookSubscriptionsRelativeUrl = undefined;
configuration.webhookAcknowledgeRelativeUrl = undefined;
configuration.integrationId = undefined;
configuration.credentialPayload = undefined;
configuration.credentialId = undefined;
props.close();
});
}
return () => {
if (listRef.current) {
listRef.current.free();
}
};
}, [listRef]);
return ((0, jsx_runtime_1.jsx)("box", { label: (0, styles_1.paneTitle)('choose the environment'), top: "center", left: "center", width: 30, height: 7, border: styles_1.paneBorder, style: styles_1.pane, children: (0, jsx_runtime_1.jsx)("list", { ref: listRef, items: Object.values(configuration_1.Environment), keys: true, style: {
selected: {
bg: 'blue',
bold: true,
},
} }) }));
};
exports.default = ChooseEnvironment;
;