synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
233 lines (232 loc) • 6.9 kB
JavaScript
import { jsx as t, jsxs as a, Fragment as c } from "react/jsx-runtime";
import { Alert as b, Typography as m, Box as D, Tooltip as I, Button as e } from "@mui/material";
import { useState as h, useCallback as L, useMemo as M } from "react";
import { DialogBase as W } from "../../DialogBase.js";
import { useQueryVisualizationContext as z } from "../../QueryVisualizationWrapper/QueryVisualizationContext.js";
import N from "../../WizardChoiceButton/WizardChoiceButton.js";
import R from "../../WizardChoiceButton/WizardChoiceButtonGroup.js";
import { EXTERNAL_ANALYSIS_PLATFORMS as s } from "./ExternalAnalysisPlatformsConstants.js";
import j from "./ExternalPlatformActionsRequiredPrecheck.js";
import { ExternalPlatformDisclaimer as q } from "./ExternalPlatformDisclaimer.js";
function F(d) {
const { step: u, setStep: n, onCancel: i, sendToPlatformConfirmButtonProps: o } = d;
switch (u) {
case 0:
return /* @__PURE__ */ a(c, { children: [
/* @__PURE__ */ t(e, { variant: "outlined", onClick: i, children: "Cancel" }),
/* @__PURE__ */ t(
e,
{
variant: "contained",
onClick: () => {
n(
1
/* SELECT_PLATFORM */
);
},
children: "Continue"
}
)
] });
case 1:
return /* @__PURE__ */ a(c, { children: [
/* @__PURE__ */ t(
e,
{
variant: "outlined",
onClick: () => n(
0
/* PREAMBLE_INSTRUCTIONS */
),
sx: { mr: "auto" },
children: "Back"
}
),
/* @__PURE__ */ t(e, { variant: "outlined", onClick: i, children: "Cancel" }),
/* @__PURE__ */ t(
e,
{
variant: "contained",
disabled: !d.selectedPlatform,
onClick: () => {
n(
2
/* PLATFORM_INSTRUCTIONS */
);
},
children: "Continue"
}
)
] });
case 2:
return /* @__PURE__ */ a(c, { children: [
/* @__PURE__ */ t(
e,
{
variant: "outlined",
onClick: () => n(
1
/* SELECT_PLATFORM */
),
sx: { mr: "auto" },
children: "Back"
}
),
/* @__PURE__ */ t(e, { variant: "outlined", onClick: i, children: "Cancel" }),
/* @__PURE__ */ t(
e,
{
variant: "contained",
onClick: () => {
n(
3
/* CHECK_REQUIREMENTS_AND_SUBMIT */
);
},
children: "Continue"
}
)
] });
case 3:
return /* @__PURE__ */ a(c, { children: [
/* @__PURE__ */ t(
e,
{
variant: "outlined",
onClick: () => n(
1
/* SELECT_PLATFORM */
),
sx: { mr: "auto" },
children: "Back"
}
),
/* @__PURE__ */ t(e, { variant: "outlined", onClick: i, children: "Cancel" }),
/* @__PURE__ */ t(e, { variant: "contained", ...o })
] });
}
}
function K(d) {
const { platformInstructionProps: u } = d, [n, i] = h(
0
/* PREAMBLE_INSTRUCTIONS */
), [o, g] = h(null), [
k,
B
] = h({}), {
isShowingExportToAnalysisPlatformModal: x,
setIsShowingExportToAnalysisPlatformModal: P,
enabledExternalAnalysisPlatforms: p
} = z(), [y, v] = h(!0), S = x && y, T = x && !y, w = `Send to ${o && [
2,
3
/* CHECK_REQUIREMENTS_AND_SUBMIT */
].includes(n) ? s[o].name : "Analysis Platform"}`, l = L(() => {
v(!0), P(!1), g(null), i(
0
/* PREAMBLE_INSTRUCTIONS */
);
}, [P]), A = M(() => {
switch (n) {
case 0:
return /* @__PURE__ */ a(c, { children: [
/* @__PURE__ */ t(
D,
{
sx: {
display: "flex",
flexDirection: "row",
gap: 2,
alignItems: "center",
pb: 2
},
children: p.map((r) => {
const { name: f, Logo: C } = s[r];
return /* @__PURE__ */ t(I, { title: f, children: /* @__PURE__ */ t(C, { width: "60px" }) }, r);
})
}
),
/* @__PURE__ */ t(m, { variant: "headline3", gutterBottom: !0, children: "Instructions" }),
/* @__PURE__ */ t(m, { variant: "body1", gutterBottom: !0, children: "This portal supports sending data to third-party platforms for analysis, once all requirements for data access (if any) have been met. We currently support the above platforms." }),
/* @__PURE__ */ t(m, { variant: "body1", children: 'The following screens will help guide you through sending data from this portal into analysis platforms. Press "Continue" to get started.' })
] });
case 1:
return /* @__PURE__ */ t(R, { children: p.map((r) => {
const { name: f, description: C, Logo: E } = s[r];
return /* @__PURE__ */ t(
N,
{
title: f,
description: C,
icon: /* @__PURE__ */ t(E, { width: "60px" }),
onClick: () => {
g(r);
},
selected: o === r
},
r
);
}) });
case 2: {
const { PlatformInstructions: r } = s[o];
return r ? /* @__PURE__ */ t(r, { ...u }) : (console.error(
`No instructions component found for platform: ${o}`
), /* @__PURE__ */ t(b, { severity: "error", children: /* @__PURE__ */ a(m, { variant: "body1", children: [
s[o].name,
" has not been configured for data export on this site."
] }) }));
}
case 3:
return /* @__PURE__ */ t(
j,
{
selectedPlatform: o,
onConfirmButtonPropsChange: B,
onSuccessfulExport: l
}
);
}
}, [
p,
l,
u,
o,
n
]);
return /* @__PURE__ */ a("div", { children: [
/* @__PURE__ */ t(
q,
{
showDisclaimer: S,
onConfirm: () => {
v(!1);
},
onCancel: l
}
),
/* @__PURE__ */ t(
W,
{
open: T,
title: w,
content: A,
actions: /* @__PURE__ */ t(
F,
{
step: n,
setStep: i,
selectedPlatform: o,
onCancel: l,
sendToPlatformConfirmButtonProps: k
}
),
onCancel: l,
maxWidth: "md"
}
)
] });
}
export {
K as default
};
//# sourceMappingURL=ExportToAnalysisPlatformDialog.js.map